From 1f9a6772797ad536d9a458001fd90b7a2a7a5a6c Mon Sep 17 00:00:00 2001 From: Matt Lyons Date: Wed, 27 Nov 2024 12:52:07 -0600 Subject: [PATCH] Fix VerseRefs not working as expected with check ranges (#1353) --- .../src/checks/check-aggregator.service.ts | 28 +- lib/platform-bible-utils/dist/index.cjs | 9 +- lib/platform-bible-utils/dist/index.cjs.map | 2 +- lib/platform-bible-utils/dist/index.js | 5575 ++++++++++------- lib/platform-bible-utils/dist/index.js.map | 2 +- .../src/serialization.test.ts | 64 + lib/platform-bible-utils/src/serialization.ts | 41 +- 7 files changed, 3569 insertions(+), 2152 deletions(-) create mode 100644 lib/platform-bible-utils/src/serialization.test.ts diff --git a/extensions/src/platform-scripture/src/checks/check-aggregator.service.ts b/extensions/src/platform-scripture/src/checks/check-aggregator.service.ts index 41e56a88ff..5be76e75f8 100644 --- a/extensions/src/platform-scripture/src/checks/check-aggregator.service.ts +++ b/extensions/src/platform-scripture/src/checks/check-aggregator.service.ts @@ -17,7 +17,7 @@ import { ICheckRunner, SettableCheckDetails, } from 'platform-scripture'; -import { VerseRef } from '@sillsdev/scripture'; +import { Canon, ScrVers, VerseRef } from '@sillsdev/scripture'; import { CHECK_RUNNER_NETWORK_OBJECT_TYPE } from './check.model'; import { aggregateProjectIdsByCheckId, @@ -131,6 +131,32 @@ class CheckAggregatorDataProviderEngine ): Promise> { if (!subscriptionId) return false; + // Fix problems when range objects are VerseRefs but not working as expected + ranges.forEach((range) => { + if (!(range.start instanceof VerseRef)) { + // TS says range.start is of type "never", but treat it as a VerseRef with the wrong prototype + // eslint-disable-next-line no-type-assertion/no-type-assertion + const start = range.start as VerseRef; + range.start = new VerseRef( + Canon.bookIdToNumber(start.book), + start.chapterNum, + start.verseNum, + start.versificationStr ? new ScrVers(start.versificationStr) : undefined, + ); + } + if (range.end && !(range.end instanceof VerseRef)) { + // TS says range.end is of type "never", but treat it as a VerseRef with the wrong prototype + // eslint-disable-next-line no-type-assertion/no-type-assertion + const end = range.end as VerseRef; + range.end = new VerseRef( + Canon.bookIdToNumber(end.book), + end.chapterNum, + end.verseNum, + end.versificationStr ? new ScrVers(end.versificationStr) : undefined, + ); + } + }); + // Update the subscription this.findSubscription(subscriptionId).ranges = ranges; diff --git a/lib/platform-bible-utils/dist/index.cjs b/lib/platform-bible-utils/dist/index.cjs index 4c824a353f..6147c2c04b 100644 --- a/lib/platform-bible-utils/dist/index.cjs +++ b/lib/platform-bible-utils/dist/index.cjs @@ -1,6 +1,7 @@ -"use strict";var fu=Object.defineProperty;var pu=(t,e,r)=>e in t?fu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var E=(t,e,r)=>pu(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const hu=require("async-mutex"),yt=require("jsonpath-plus");class du{constructor(e,r=1e4){E(this,"variableName");E(this,"promiseToValue");E(this,"resolver");E(this,"rejecter");this.variableName=e,this.promiseToValue=new Promise((u,n)=>{this.resolver=u,this.rejecter=n}),r>0&&setTimeout(()=>{this.rejecter&&(this.rejecter(`Timeout reached when waiting for ${this.variableName} to settle`),this.complete())},r),Object.seal(this)}get promise(){return this.promiseToValue}get hasSettled(){return Object.isFrozen(this)}resolveToValue(e,r=!1){if(this.resolver)console.debug(`${this.variableName} is being resolved now`),this.resolver(e),this.complete();else{if(r)throw Error(`${this.variableName} was already settled`);console.debug(`Ignoring subsequent resolution of ${this.variableName}`)}}rejectWithReason(e,r=!1){if(this.rejecter)console.debug(`${this.variableName} is being rejected now`),this.rejecter(e),this.complete();else{if(r)throw Error(`${this.variableName} was already settled`);console.debug(`Ignoring subsequent rejection of ${this.variableName}`)}}complete(){this.resolver=void 0,this.rejecter=void 0,Object.freeze(this)}}class mu{constructor(e,r){E(this,"collator");this.collator=new Intl.Collator(e,r)}compare(e,r){return this.collator.compare(e,r)}resolvedOptions(){return this.collator.resolvedOptions()}}class Zt{constructor(e,r){E(this,"dateTimeFormatter");this.dateTimeFormatter=new Intl.DateTimeFormat(e,r)}format(e){return this.dateTimeFormatter.format(e)}formatRange(e,r){return this.dateTimeFormatter.formatRange(e,r)}formatRangeToParts(e,r){return this.dateTimeFormatter.formatRangeToParts(e,r)}formatToParts(e){return this.dateTimeFormatter.formatToParts(e)}resolvedOptions(){return this.dateTimeFormatter.resolvedOptions()}}class Qt{constructor(){E(this,"subscribe",this.event);E(this,"subscriptions");E(this,"lazyEvent");E(this,"isDisposed",!1);E(this,"dispose",()=>this.disposeFn());E(this,"emit",e=>{this.emitFn(e)})}get event(){return this.assertNotDisposed(),this.lazyEvent||(this.lazyEvent=e=>{if(!e||typeof e!="function")throw new Error("Event handler callback must be a function!");return this.subscriptions||(this.subscriptions=[]),this.subscriptions.push(e),()=>{if(!this.subscriptions)return!1;const r=this.subscriptions.indexOf(e);return r<0?!1:(this.subscriptions.splice(r,1),!0)}}),this.lazyEvent}emitFn(e){this.assertNotDisposed(),[...this.subscriptions??[]].forEach(u=>u(e))}assertNotDisposed(){if(this.isDisposed)throw new Error("Emitter is disposed")}disposeFn(){return this.assertNotDisposed(),this.isDisposed=!0,this.subscriptions=void 0,this.lazyEvent=void 0,Promise.resolve(!0)}}function gu(){return"00-0-4-1-000".replace(/[^-]/g,t=>((Math.random()+~~t)*65536>>t).toString(16).padStart(4,"0"))}function Ce(t){return typeof t=="string"||t instanceof String}function ce(t){return JSON.parse(JSON.stringify(t))}function Du(t,e=300){if(Ce(t))throw new Error("Tried to debounce a string! Could be XSS");let r;return(...u)=>{clearTimeout(r),r=setTimeout(()=>t(...u),e)}}function bu(t,e,r){const u=new Map;return t.forEach(n=>{const i=e(n),o=u.get(i),a=r?r(n,i):n;o?o.push(a):u.set(i,[a])}),u}function vu(t){return typeof t=="object"&&t!==null&&"message"in t&&typeof t.message=="string"}function Eu(t){if(vu(t))return t;try{return new Error(JSON.stringify(t))}catch{return new Error(String(t))}}function Au(t){return Eu(t).message}function er(t){return new Promise(e=>setTimeout(e,t))}function yu(t,e){const r=er(e).then(()=>{});return Promise.any([r,t()])}function Nu(t,e="obj"){const r=new Set;Object.getOwnPropertyNames(t).forEach(n=>{try{typeof t[n]=="function"&&r.add(n)}catch{}});let u=Object.getPrototypeOf(t);for(;u&&Object.getPrototypeOf(u);)Object.getOwnPropertyNames(u).forEach(n=>{try{typeof t[n]=="function"&&r.add(n)}catch{}}),u=Object.getPrototypeOf(u);return r}function Cu(t,e={}){return new Proxy(e,{get(r,u){return u in r?r[u]:async(...n)=>(await t())[u](...n)}})}class tr{constructor(e,r){E(this,"baseDocument");E(this,"contributions",new Map);E(this,"latestOutput");E(this,"options");E(this,"onDidRebuildEmitter",new Qt);E(this,"onDidRebuild",this.onDidRebuildEmitter.subscribe);this.baseDocument=e,this.options=r,this.updateBaseDocument(e)}updateBaseDocument(e){return this.validateBaseDocument(e),this.baseDocument=this.options.copyDocuments?ce(e):e,this.baseDocument=this.transformBaseDocumentAfterValidation(this.baseDocument),this.rebuild()}addOrUpdateContribution(e,r){this.validateContribution(e,r);const u=this.contributions.get(e);let n=this.options.copyDocuments&&r?ce(r):r;n=this.transformContributionAfterValidation(e,n),this.contributions.set(e,n);try{return this.rebuild()}catch(i){throw u?this.contributions.set(e,u):this.contributions.delete(e),new Error(`Error when setting the document named ${e}: ${i}`)}}deleteContribution(e){const r=this.contributions.get(e);if(!r)throw new Error(`${e} does not exist`);this.contributions.delete(e);try{return this.rebuild()}catch(u){throw this.contributions.set(e,r),new Error(`Error when deleting the document named ${e}: ${u}`)}}deleteAllContributions(){if(this.contributions.size<=0)return this.latestOutput;const e=[...this.contributions.entries()];e.forEach(([r])=>this.contributions.delete(r));try{return this.rebuild()}catch(r){throw e.forEach(([u,n])=>this.contributions.set(u,n)),new Error(`Error when deleting all contributions: ${r}`)}}rebuild(){if(this.contributions.size===0){let r=ce(this.baseDocument);return r=this.transformFinalOutputBeforeValidation(r),this.validateOutput(r),this.latestOutput=r,this.onDidRebuildEmitter.emit(void 0),this.latestOutput}let e=this.baseDocument;return this.contributions.forEach(r=>{e=wu(e,r,this.options.ignoreDuplicateProperties),this.validateOutput(e)}),e=this.transformFinalOutputBeforeValidation(e),this.validateOutput(e),this.latestOutput=e,this.onDidRebuildEmitter.emit(void 0),this.latestOutput}transformBaseDocumentAfterValidation(e){return e}transformContributionAfterValidation(e,r){return r}validateBaseDocument(e){}validateContribution(e,r){}validateOutput(e){}transformFinalOutputBeforeValidation(e){return e}}function Nt(...t){let e=!0;return t.forEach(r=>{(!r||typeof r!="object"||Array.isArray(r))&&(e=!1)}),e}function Ct(...t){let e=!0;return t.forEach(r=>{(!r||typeof r!="object"||!Array.isArray(r))&&(e=!1)}),e}function wu(t,e,r){const u=ce(t);return e?rr(u,ce(e),r):u}function rr(t,e,r){if(!e)return t;if(Nt(t,e)){const u=t,n=e;Object.keys(n).forEach(i=>{if(Object.hasOwn(u,i)){if(Nt(u[i],n[i]))u[i]=rr(u[i],n[i],r);else if(Ct(u[i],n[i]))u[i]=u[i].concat(n[i]);else if(!r)throw new Error(`Cannot merge objects: key "${i}" already exists in the target object`)}else u[i]=n[i]})}else Ct(t,e)&&t.push(...e);return t}class ur extends hu.Mutex{}class Su{constructor(){E(this,"mutexesByID",new Map)}get(e){let r=this.mutexesByID.get(e);return r||(r=new ur,this.mutexesByID.set(e,r),r)}}class Bu extends tr{constructor(e,r){super(e,r)}get output(){return this.latestOutput}}class nr{constructor(e,r){E(this,"numberFormatter");this.numberFormatter=new Intl.NumberFormat(e,r)}format(e){return this.numberFormatter.format(e)}formatRange(e,r){return this.numberFormatter.formatRange(e,r)}formatRangeToParts(e,r){return this.numberFormatter.formatRangeToParts(e,r)}formatToParts(e){return this.numberFormatter.formatToParts(e)}resolvedOptions(){return this.numberFormatter.resolvedOptions()}}class Tu{constructor(e="Anonymous"){E(this,"unsubscribers",new Set);this.name=e}add(...e){e.forEach(r=>{"dispose"in r?this.unsubscribers.add(r.dispose):this.unsubscribers.add(r)})}async runAllUnsubscribers(){const e=[...this.unsubscribers].map(u=>u()),r=await Promise.all(e);return this.unsubscribers.clear(),r.every((u,n)=>(u||console.error(`UnsubscriberAsyncList ${this.name}: Unsubscriber at index ${n} failed!`),u))}}var Ou=Object.defineProperty,xu=(t,e,r)=>e in t?Ou(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d=(t,e,r)=>xu(t,typeof e!="symbol"?e+"":e,r);const te=["GEN","EXO","LEV","NUM","DEU","JOS","JDG","RUT","1SA","2SA","1KI","2KI","1CH","2CH","EZR","NEH","EST","JOB","PSA","PRO","ECC","SNG","ISA","JER","LAM","EZK","DAN","HOS","JOL","AMO","OBA","JON","MIC","NAM","HAB","ZEP","HAG","ZEC","MAL","MAT","MRK","LUK","JHN","ACT","ROM","1CO","2CO","GAL","EPH","PHP","COL","1TH","2TH","1TI","2TI","TIT","PHM","HEB","JAS","1PE","2PE","1JN","2JN","3JN","JUD","REV","TOB","JDT","ESG","WIS","SIR","BAR","LJE","S3Y","SUS","BEL","1MA","2MA","3MA","4MA","1ES","2ES","MAN","PS2","ODA","PSS","JSA","JDB","TBS","SST","DNT","BLT","XXA","XXB","XXC","XXD","XXE","XXF","XXG","FRT","BAK","OTH","3ES","EZA","5EZ","6EZ","INT","CNC","GLO","TDX","NDX","DAG","PS3","2BA","LBA","JUB","ENO","1MQ","2MQ","3MQ","REP","4BA","LAO"],tt=["XXA","XXB","XXC","XXD","XXE","XXF","XXG","FRT","BAK","OTH","INT","CNC","GLO","TDX","NDX"],ir=["Genesis","Exodus","Leviticus","Numbers","Deuteronomy","Joshua","Judges","Ruth","1 Samuel","2 Samuel","1 Kings","2 Kings","1 Chronicles","2 Chronicles","Ezra","Nehemiah","Esther (Hebrew)","Job","Psalms","Proverbs","Ecclesiastes","Song of Songs","Isaiah","Jeremiah","Lamentations","Ezekiel","Daniel (Hebrew)","Hosea","Joel","Amos","Obadiah","Jonah","Micah","Nahum","Habakkuk","Zephaniah","Haggai","Zechariah","Malachi","Matthew","Mark","Luke","John","Acts","Romans","1 Corinthians","2 Corinthians","Galatians","Ephesians","Philippians","Colossians","1 Thessalonians","2 Thessalonians","1 Timothy","2 Timothy","Titus","Philemon","Hebrews","James","1 Peter","2 Peter","1 John","2 John","3 John","Jude","Revelation","Tobit","Judith","Esther Greek","Wisdom of Solomon","Sirach (Ecclesiasticus)","Baruch","Letter of Jeremiah","Song of 3 Young Men","Susanna","Bel and the Dragon","1 Maccabees","2 Maccabees","3 Maccabees","4 Maccabees","1 Esdras (Greek)","2 Esdras (Latin)","Prayer of Manasseh","Psalm 151","Odes","Psalms of Solomon","Joshua A. *obsolete*","Judges B. *obsolete*","Tobit S. *obsolete*","Susanna Th. *obsolete*","Daniel Th. *obsolete*","Bel Th. *obsolete*","Extra A","Extra B","Extra C","Extra D","Extra E","Extra F","Extra G","Front Matter","Back Matter","Other Matter","3 Ezra *obsolete*","Apocalypse of Ezra","5 Ezra (Latin Prologue)","6 Ezra (Latin Epilogue)","Introduction","Concordance ","Glossary ","Topical Index","Names Index","Daniel Greek","Psalms 152-155","2 Baruch (Apocalypse)","Letter of Baruch","Jubilees","Enoch","1 Meqabyan","2 Meqabyan","3 Meqabyan","Reproof (Proverbs 25-31)","4 Baruch (Rest of Baruch)","Laodiceans"],wt=_u();function de(t,e=!0){return e&&(t=t.toUpperCase()),t in wt?wt[t]:0}function rt(t){return de(t)>0}function Iu(t){const e=typeof t=="string"?de(t):t;return e>=40&&e<=66}function Fu(t){return(typeof t=="string"?de(t):t)<=39}function or(t){return t<=66}function Ru(t){const e=typeof t=="string"?de(t):t;return cr(e)&&!or(e)}function*ku(){for(let t=1;t<=te.length;t++)yield t}const qu=1,ar=te.length;function Mu(){return["XXA","XXB","XXC","XXD","XXE","XXF","XXG"]}function ut(t,e="***"){const r=t-1;return r<0||r>=te.length?e:te[r]}function sr(t){return t<=0||t>ar?"******":ir[t-1]}function $u(t){return sr(de(t))}function cr(t){const e=typeof t=="number"?ut(t):t;return rt(e)&&!tt.includes(e)}function Pu(t){const e=typeof t=="number"?ut(t):t;return rt(e)&&tt.includes(e)}function ju(t){return ir[t-1].includes("*obsolete*")}function _u(){const t={};for(let e=0;e(t[t.Unknown=0]="Unknown",t[t.Original=1]="Original",t[t.Septuagint=2]="Septuagint",t[t.Vulgate=3]="Vulgate",t[t.English=4]="English",t[t.RussianProtestant=5]="RussianProtestant",t[t.RussianOrthodox=6]="RussianOrthodox",t))(_||{});const M=class{constructor(e){if(d(this,"name"),d(this,"fullPath"),d(this,"isPresent"),d(this,"hasVerseSegments"),d(this,"isCustomized"),d(this,"baseVersification"),d(this,"scriptureBooks"),d(this,"_type"),e==null)throw new Error("Argument undefined");typeof e=="string"?(this.name=e,this._type=_[e]):(this._type=e,this.name=_[e])}get type(){return this._type}equals(e){return!e.type||!this.type?!1:e.type===this.type}};d(M,"Original",new M(_.Original)),d(M,"Septuagint",new M(_.Septuagint)),d(M,"Vulgate",new M(_.Vulgate)),d(M,"English",new M(_.English)),d(M,"RussianProtestant",new M(_.RussianProtestant)),d(M,"RussianOrthodox",new M(_.RussianOrthodox));let Q=M;function St(t,e){const r=e[0];for(let u=1;u(t[t.Valid=0]="Valid",t[t.UnknownVersification=1]="UnknownVersification",t[t.OutOfRange=2]="OutOfRange",t[t.VerseOutOfOrder=3]="VerseOutOfOrder",t[t.VerseRepeated=4]="VerseRepeated",t))(lr||{});const I=class m{constructor(e,r,u,n){if(d(this,"firstChapter"),d(this,"lastChapter"),d(this,"lastVerse"),d(this,"hasSegmentsDefined"),d(this,"text"),d(this,"BBBCCCVVVS"),d(this,"longHashCode"),d(this,"versification"),d(this,"rtlMark","‏"),d(this,"_bookNum",0),d(this,"_chapterNum",0),d(this,"_verseNum",0),d(this,"_verse"),u==null&&n==null)if(e!=null&&typeof e=="string"){const i=e,o=r!=null&&r instanceof Q?r:void 0;this.setEmpty(o),this.parse(i)}else if(e!=null&&typeof e=="number"){const i=r!=null&&r instanceof Q?r:void 0;this.setEmpty(i),this._verseNum=e%m.chapterDigitShifter,this._chapterNum=Math.floor(e%m.bookDigitShifter/m.chapterDigitShifter),this._bookNum=Math.floor(e/m.bookDigitShifter)}else if(r==null)if(e!=null&&e instanceof m){const i=e;this._bookNum=i.bookNum,this._chapterNum=i.chapterNum,this._verseNum=i.verseNum,this._verse=i.verse,this.versification=i.versification}else{if(e==null)return;const i=e instanceof Q?e:m.defaultVersification;this.setEmpty(i)}else throw new Error("VerseRef constructor not supported.");else if(e!=null&&r!=null&&u!=null)if(typeof e=="string"&&typeof r=="string"&&typeof u=="string")this.setEmpty(n),this.updateInternal(e,r,u);else if(typeof e=="number"&&typeof r=="number"&&typeof u=="number")this._bookNum=e,this._chapterNum=r,this._verseNum=u,this.versification=n??m.defaultVersification;else throw new Error("VerseRef constructor not supported.");else throw new Error("VerseRef constructor not supported.")}static isVerseParseable(e){return e.length>0&&"0123456789".includes(e[0])&&!e.endsWith(this.verseRangeSeparator)&&!e.endsWith(this.verseSequenceIndicator)}static tryParse(e){let r;try{return r=new m(e),{success:!0,verseRef:r}}catch(u){if(u instanceof De)return r=new m,{success:!1,verseRef:r};throw u}}static getBBBCCCVVV(e,r,u){return e%m.bcvMaxValue*m.bookDigitShifter+(r>=0?r%m.bcvMaxValue*m.chapterDigitShifter:0)+(u>=0?u%m.bcvMaxValue:0)}static fromJSON(e){const{book:r,chapterNum:u,verseNum:n,verse:i,versificationStr:o}=e,a=i||n.toString();let s;return o&&(s=new Q(o)),r?new m(r,u.toString(),a,s):new m}static tryGetVerseNum(e){let r;if(!e)return r=-1,{success:!0,vNum:r};r=0;let u;for(let n=0;n"9")return n===0&&(r=-1),{success:!1,vNum:r};if(r=r*10+ +u-0,r>m.bcvMaxValue)return r=-1,{success:!1,vNum:r}}return{success:!0,vNum:r}}get isDefault(){return this.bookNum===0&&this.chapterNum===0&&this.verseNum===0&&this.versification==null}get hasMultiple(){return this._verse!=null&&(this._verse.includes(m.verseRangeSeparator)||this._verse.includes(m.verseSequenceIndicator))}get book(){return j.bookNumberToId(this.bookNum,"")}set book(e){this.bookNum=j.bookIdToNumber(e)}get chapter(){return this.isDefault||this._chapterNum<0?"":this._chapterNum.toString()}set chapter(e){const r=+e;this._chapterNum=Number.isInteger(r)?r:-1}get verse(){return this._verse!=null?this._verse:this.isDefault||this._verseNum<0?"":this._verseNum.toString()}set verse(e){const{success:r,vNum:u}=m.tryGetVerseNum(e);this._verse=r?void 0:e.replace(this.rtlMark,""),this._verseNum=u,!(this._verseNum>=0)&&({vNum:this._verseNum}=m.tryGetVerseNum(this._verse))}get bookNum(){return this._bookNum}set bookNum(e){if(e<=0||e>j.lastBook)throw new De("BookNum must be greater than zero and less than or equal to last book");this._bookNum=e}get chapterNum(){return this._chapterNum}set chapterNum(e){this.chapterNum=e}get verseNum(){return this._verseNum}set verseNum(e){this._verseNum=e}get versificationStr(){var e;return(e=this.versification)==null?void 0:e.name}set versificationStr(e){this.versification=this.versification!=null?new Q(e):void 0}get valid(){return this.validStatus===0}get validStatus(){return this.validateVerse(m.verseRangeSeparators,m.verseSequenceIndicators)}get BBBCCC(){return m.getBBBCCCVVV(this._bookNum,this._chapterNum,0)}get BBBCCCVVV(){return m.getBBBCCCVVV(this._bookNum,this._chapterNum,this._verseNum)}get isExcluded(){return!1}parse(e){if(e=e.replace(this.rtlMark,""),e.includes("/")){const i=e.split("/");if(e=i[0],i.length>1)try{const o=+i[1].trim();this.versification=new Q(_[o])}catch{throw new De("Invalid reference : "+e)}}const r=e.trim().split(" ");if(r.length!==2)throw new De("Invalid reference : "+e);const u=r[1].split(":"),n=+u[0];if(u.length!==2||j.bookIdToNumber(r[0])===0||!Number.isInteger(n)||n<0||!m.isVerseParseable(u[1]))throw new De("Invalid reference : "+e);this.updateInternal(r[0],u[0],u[1])}simplify(){this._verse=void 0}clone(){return new m(this)}toString(){const e=this.book;return e===""?"":`${e} ${this.chapter}:${this.verse}`}toJSON(){let e=this.verse;(e===""||e===this.verseNum.toString())&&(e=void 0);const r={book:this.book,chapterNum:this.chapterNum,verseNum:this.verseNum,verse:e,versificationStr:this.versificationStr};return e||delete r.verse,r}equals(e){return e instanceof m?e._bookNum===this._bookNum&&e._chapterNum===this._chapterNum&&e._verseNum===this._verseNum&&e.verse===this.verse&&(e.versification==null&&this.versification==null||e.versification!=null&&this.versification!=null&&e.versification.equals(this.versification)):!1}allVerses(e=!1,r=m.verseRangeSeparators,u=m.verseSequenceIndicators){if(this._verse==null||this.chapterNum<=0)return[this.clone()];const n=[],i=St(this._verse,u);for(const o of i.map(a=>St(a,r))){const a=this.clone();a.verse=o[0];const s=a.verseNum;if(n.push(a),o.length>1){const l=this.clone();if(l.verse=o[1],!e)for(let c=s+1;co)return 3;if(u===o)return 4;u=o}return 0}get internalValid(){return this.versification==null?1:this._bookNum<=0||this._bookNum>j.lastBook?2:(j.isCanonical(this._bookNum),0)}setEmpty(e=m.defaultVersification){this._bookNum=0,this._chapterNum=-1,this._verse=void 0,this.versification=e}updateInternal(e,r,u){this.bookNum=j.bookIdToNumber(e),this.chapter=r,this.verse=u}};d(I,"defaultVersification",Q.English),d(I,"verseRangeSeparator","-"),d(I,"verseSequenceIndicator",","),d(I,"verseRangeSeparators",[I.verseRangeSeparator]),d(I,"verseSequenceIndicators",[I.verseSequenceIndicator]),d(I,"chapterDigitShifter",1e3),d(I,"bookDigitShifter",I.chapterDigitShifter*I.chapterDigitShifter),d(I,"bcvMaxValue",I.chapterDigitShifter-1),d(I,"ValidStatusType",lr);let fr=I;class De extends Error{}var Bt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ue={},Lu=()=>{const t="\\ud800-\\udfff",o="\\u0300-\\u036f"+"\\ufe20-\\ufe2f"+"\\u20d0-\\u20ff"+"\\u1ab0-\\u1aff"+"\\u1dc0-\\u1dff",a="\\ufe0e\\ufe0f",s="\\uD83D\\uDC69\\uD83C\\uDFFB\\u200D\\uD83C\\uDF93",l=`[${t}]`,c=`[${o}]`,f="\\ud83c[\\udffb-\\udfff]",p=`(?:${c}|${f})`,h=`[^${t}]`,g="(?:\\uD83C[\\uDDE6-\\uDDFF]){2}",b="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",y="(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40(?:\\udc65|\\udc73|\\udc77)\\udb40(?:\\udc6e|\\udc63|\\udc6c)\\udb40(?:\\udc67|\\udc74|\\udc73)\\udb40\\udc7f)",Z=`[${s}]`,A=`${p}?`,O=`[${a}]?`,ge=`(?:${v}(?:${[h,g,b].join("|")})${O+A})*`,Ie=O+A+ge,Fe=`(?:${[`${h}${c}?`,c,g,b,l,Z].join("|")})`;return new RegExp(`${y}|${f}(?=${f})|${Fe+Ie}`,"g")},Vu=Bt&&Bt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ue,"__esModule",{value:!0});var _e=Vu(Lu);function Xe(t){if(typeof t!="string")throw new Error("A string is expected as input");return t.match(_e.default())||[]}var Uu=ue.toArray=Xe;function nt(t){if(typeof t!="string")throw new Error("Input must be a string");var e=t.match(_e.default());return e===null?0:e.length}var zu=ue.length=nt;function pr(t,e,r){if(e===void 0&&(e=0),typeof t!="string")throw new Error("Input must be a string");(typeof e!="number"||e<0)&&(e=0),typeof r=="number"&&r<0&&(r=0);var u=t.match(_e.default());return u?u.slice(e,r).join(""):""}var Gu=ue.substring=pr;function Ju(t,e,r){if(e===void 0&&(e=0),typeof t!="string")throw new Error("Input must be a string");var u=nt(t);if(typeof e!="number"&&(e=parseInt(e,10)),e>=u)return"";e<0&&(e+=u);var n;typeof r>"u"?n=u:(typeof r!="number"&&(r=parseInt(r,10)),n=r>=0?r+e:e);var i=t.match(_e.default());return i?i.slice(e,n).join(""):""}var Hu=ue.substr=Ju;function Xu(t,e,r,u){if(e===void 0&&(e=16),r===void 0&&(r="#"),u===void 0&&(u="right"),typeof t!="string"||typeof e!="number")throw new Error("Invalid arguments specified");if(["left","right"].indexOf(u)===-1)throw new Error("Pad position should be either left or right");typeof r!="string"&&(r=String(r));var n=nt(t);if(n>e)return pr(t,0,e);if(n=u.length)return e===""?u.length:-1;if(e==="")return r;var n=Xe(e),i=!1,o;for(o=r;ow(t)||e<-w(t)))return Le(t,e,1)}function ee(t,e){return e<0||e>w(t)-1?"":Le(t,e,1)}function Zu(t,e){if(!(e<0||e>w(t)-1))return Le(t,e,1).codePointAt(0)}function dr(t,e,r=w(t)){const u=Dr(t,e);return!(u===-1||u+w(e)!==r)}function Qu(t,e,r){if(e<0)return-1;if(r){if(ee(t,e)==="}"&&ee(t,e-1)==="\\")return e;const i=le(t,"\\}",e);return i>=0?i+1:i}let u=e;const n=w(t);for(;u=n?-1:u}function mr(t,e){const r=[];let u=0,n=0;function i(a,s,l){const c=K(t,n,s),f=r.length>0&&Ce(r[r.length-1])?`${r.pop()}${c}`:c;Ce(a)?r.push(`${f}${a}`):(f&&r.push(f),r.push(a)),n=s+l}const o=w(t);for(;u=0){const s=K(t,u+1,a),l=s in e?e[s]:s;i(l,u,a+1-u),u=a,n=a+1}}else i("{",u-1,2);break;case"}":ee(t,u-1)!=="\\"||i("}",u-1,2);break}u+=1}if(n0&&Ce(r[r.length-1])?`${r.pop()}${a}`:a)}return r}function en(t,e){return mr(t,e).map(r=>`${r}`).join("")}function gr(t,e,r=0){const u=K(t,r);return le(u,e)!==-1}function le(t,e,r=0){return Wu(t,e,r)}function Dr(t,e,r){let u=r===void 0?w(t):r;u<0?u=0:u>=w(t)&&(u=w(t)-1);for(let n=u;n>=0;n--)if(Le(t,n,w(e))===e)return n;return-1}function w(t){return zu(t)}function tn(t,e){const r=e.toUpperCase();return r==="NONE"?t:t.normalize(r)}function rn(t,e,r){return t.localeCompare(e,"en",r)}function un(t,e,r=" "){return e<=w(t)?t:hr(t,e,r,"right")}function nn(t,e,r=" "){return e<=w(t)?t:hr(t,e,r,"left")}function Tt(t,e){return e>t?t:e<-t?0:e<0?e+t:e}function on(t,e,r){const u=w(t);if(e>u||r&&(e>r&&!(e>=0&&e-u)||r<-u))return"";const n=Tt(u,e),i=r?Tt(u,r):void 0;return K(t,n,i)}function Ke(t,e,r){const u=[];if(r!==void 0&&r<=0)return[t];if(e==="")return br(t).slice(0,r);let n=e;(typeof e=="string"||e instanceof RegExp&&!gr(e.flags,"g"))&&(n=new RegExp(e,"g"));const i=t.match(n);let o=0;if(!i)return[t];for(let a=0;a<(r?r-1:i.length);a++){const s=le(t,i[a],o),l=w(i[a]);if(u.push(K(t,o,s)),o=s+l,r!==void 0&&u.length===r)break}return u.push(K(t,o)),u}function ot(t,e,r=0){return le(t,e,r)===r}function Le(t,e=0,r=w(t)-e){return Hu(t,e,r)}function K(t,e,r=w(t)){return Gu(t,e,r)}function br(t){return Uu(t)}function an(t){return ot(t,"%")&&dr(t,"%")}function sn(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function cn(t){return t?it(t).map(u=>Array.isArray(u)?u.map(n=>new RegExp(n)):new RegExp(u)):[]}function ln(t){return t?it(t).map(u=>new RegExp(u)):[]}const vr=[{shortName:"ERR",fullNames:["ERROR"],chapters:-1},{shortName:"GEN",fullNames:["Genesis"],chapters:50},{shortName:"EXO",fullNames:["Exodus"],chapters:40},{shortName:"LEV",fullNames:["Leviticus"],chapters:27},{shortName:"NUM",fullNames:["Numbers"],chapters:36},{shortName:"DEU",fullNames:["Deuteronomy"],chapters:34},{shortName:"JOS",fullNames:["Joshua"],chapters:24},{shortName:"JDG",fullNames:["Judges"],chapters:21},{shortName:"RUT",fullNames:["Ruth"],chapters:4},{shortName:"1SA",fullNames:["1 Samuel"],chapters:31},{shortName:"2SA",fullNames:["2 Samuel"],chapters:24},{shortName:"1KI",fullNames:["1 Kings"],chapters:22},{shortName:"2KI",fullNames:["2 Kings"],chapters:25},{shortName:"1CH",fullNames:["1 Chronicles"],chapters:29},{shortName:"2CH",fullNames:["2 Chronicles"],chapters:36},{shortName:"EZR",fullNames:["Ezra"],chapters:10},{shortName:"NEH",fullNames:["Nehemiah"],chapters:13},{shortName:"EST",fullNames:["Esther"],chapters:10},{shortName:"JOB",fullNames:["Job"],chapters:42},{shortName:"PSA",fullNames:["Psalm","Psalms"],chapters:150},{shortName:"PRO",fullNames:["Proverbs"],chapters:31},{shortName:"ECC",fullNames:["Ecclesiastes"],chapters:12},{shortName:"SNG",fullNames:["Song of Solomon","Song of Songs"],chapters:8},{shortName:"ISA",fullNames:["Isaiah"],chapters:66},{shortName:"JER",fullNames:["Jeremiah"],chapters:52},{shortName:"LAM",fullNames:["Lamentations"],chapters:5},{shortName:"EZK",fullNames:["Ezekiel"],chapters:48},{shortName:"DAN",fullNames:["Daniel"],chapters:12},{shortName:"HOS",fullNames:["Hosea"],chapters:14},{shortName:"JOL",fullNames:["Joel"],chapters:3},{shortName:"AMO",fullNames:["Amos"],chapters:9},{shortName:"OBA",fullNames:["Obadiah"],chapters:1},{shortName:"JON",fullNames:["Jonah"],chapters:4},{shortName:"MIC",fullNames:["Micah"],chapters:7},{shortName:"NAM",fullNames:["Nahum"],chapters:3},{shortName:"HAB",fullNames:["Habakkuk"],chapters:3},{shortName:"ZEP",fullNames:["Zephaniah"],chapters:3},{shortName:"HAG",fullNames:["Haggai"],chapters:2},{shortName:"ZEC",fullNames:["Zechariah"],chapters:14},{shortName:"MAL",fullNames:["Malachi"],chapters:4},{shortName:"MAT",fullNames:["Matthew"],chapters:28},{shortName:"MRK",fullNames:["Mark"],chapters:16},{shortName:"LUK",fullNames:["Luke"],chapters:24},{shortName:"JHN",fullNames:["John"],chapters:21},{shortName:"ACT",fullNames:["Acts"],chapters:28},{shortName:"ROM",fullNames:["Romans"],chapters:16},{shortName:"1CO",fullNames:["1 Corinthians"],chapters:16},{shortName:"2CO",fullNames:["2 Corinthians"],chapters:13},{shortName:"GAL",fullNames:["Galatians"],chapters:6},{shortName:"EPH",fullNames:["Ephesians"],chapters:6},{shortName:"PHP",fullNames:["Philippians"],chapters:4},{shortName:"COL",fullNames:["Colossians"],chapters:4},{shortName:"1TH",fullNames:["1 Thessalonians"],chapters:5},{shortName:"2TH",fullNames:["2 Thessalonians"],chapters:3},{shortName:"1TI",fullNames:["1 Timothy"],chapters:6},{shortName:"2TI",fullNames:["2 Timothy"],chapters:4},{shortName:"TIT",fullNames:["Titus"],chapters:3},{shortName:"PHM",fullNames:["Philemon"],chapters:1},{shortName:"HEB",fullNames:["Hebrews"],chapters:13},{shortName:"JAS",fullNames:["James"],chapters:5},{shortName:"1PE",fullNames:["1 Peter"],chapters:5},{shortName:"2PE",fullNames:["2 Peter"],chapters:3},{shortName:"1JN",fullNames:["1 John"],chapters:5},{shortName:"2JN",fullNames:["2 John"],chapters:1},{shortName:"3JN",fullNames:["3 John"],chapters:1},{shortName:"JUD",fullNames:["Jude"],chapters:1},{shortName:"REV",fullNames:["Revelation"],chapters:22}],Er=1,Ar=vr.length-1,yr=1,Nr=1,fn={bookNum:1,chapterNum:1,verseNum:1},Cr=t=>{var e;return((e=vr[t])==null?void 0:e.chapters)??-1},pn=(t,e)=>({bookNum:Math.max(Er,Math.min(t.bookNum+e,Ar)),chapterNum:1,verseNum:1}),hn=(t,e)=>({...t,chapterNum:Math.min(Math.max(yr,t.chapterNum+e),Cr(t.bookNum)),verseNum:1}),dn=(t,e)=>({...t,verseNum:Math.max(Nr,t.verseNum+e)});async function mn(t,e,r){const u=j.bookNumberToId(t);if(!ot(Intl.getCanonicalLocales(e)[0],"zh"))return r({localizeKey:`LocalizedId.${u}`,languagesToSearch:[e]});const n=await r({localizeKey:`Book.${u}`,languagesToSearch:[e]}),i=Ke(n,"-");return Ke(i[0],"ÿ08")[0].trim()}function We(t){return new fr(t.bookNum,t.chapterNum,t.verseNum).BBBCCCVVV}function gn(t,e){return We(t)-We(e)}function wr(t){return`%scrollGroup_${t}%`}function Dn(t){return t.map(e=>wr(e))}function bn(t,e,r,u){let n;switch(e??"id"){case"English":n=j.bookNumberToEnglishName(t.bookNum);break;case"id":n=j.bookNumberToId(t.bookNum);break;default:n=e??"";break}return`${n}${u??" "}${t.chapterNum}${r??":"}${t.verseNum}`}const vn=t=>(...e)=>t.map(u=>u(...e)).every(u=>u),En=t=>async(...e)=>{const r=t.map(async u=>u(...e));return(await Promise.all(r)).every(u=>u)},ye="chapter",Ne="verse";var An=Object.getOwnPropertyNames,yn=Object.getOwnPropertySymbols,Nn=Object.prototype.hasOwnProperty;function Ot(t,e){return function(u,n,i){return t(u,n,i)&&e(u,n,i)}}function Re(t){return function(r,u,n){if(!r||!u||typeof r!="object"||typeof u!="object")return t(r,u,n);var i=n.cache,o=i.get(r),a=i.get(u);if(o&&a)return o===u&&a===r;i.set(r,u),i.set(u,r);var s=t(r,u,n);return i.delete(r),i.delete(u),s}}function xt(t){return An(t).concat(yn(t))}var Sr=Object.hasOwn||function(t,e){return Nn.call(t,e)};function me(t,e){return t||e?t===e:t===e||t!==t&&e!==e}var Br="_owner",It=Object.getOwnPropertyDescriptor,Ft=Object.keys;function Cn(t,e,r){var u=t.length;if(e.length!==u)return!1;for(;u-- >0;)if(!r.equals(t[u],e[u],u,u,t,e,r))return!1;return!0}function wn(t,e){return me(t.getTime(),e.getTime())}function Rt(t,e,r){if(t.size!==e.size)return!1;for(var u={},n=t.entries(),i=0,o,a;(o=n.next())&&!o.done;){for(var s=e.entries(),l=!1,c=0;(a=s.next())&&!a.done;){var f=o.value,p=f[0],h=f[1],g=a.value,b=g[0],v=g[1];!l&&!u[c]&&(l=r.equals(p,b,i,c,t,e,r)&&r.equals(h,v,p,b,t,e,r))&&(u[c]=!0),c++}if(!l)return!1;i++}return!0}function Sn(t,e,r){var u=Ft(t),n=u.length;if(Ft(e).length!==n)return!1;for(var i;n-- >0;)if(i=u[n],i===Br&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!Sr(e,i)||!r.equals(t[i],e[i],i,i,t,e,r))return!1;return!0}function be(t,e,r){var u=xt(t),n=u.length;if(xt(e).length!==n)return!1;for(var i,o,a;n-- >0;)if(i=u[n],i===Br&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!Sr(e,i)||!r.equals(t[i],e[i],i,i,t,e,r)||(o=It(t,i),a=It(e,i),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function Bn(t,e){return me(t.valueOf(),e.valueOf())}function Tn(t,e){return t.source===e.source&&t.flags===e.flags}function kt(t,e,r){if(t.size!==e.size)return!1;for(var u={},n=t.values(),i,o;(i=n.next())&&!i.done;){for(var a=e.values(),s=!1,l=0;(o=a.next())&&!o.done;)!s&&!u[l]&&(s=r.equals(i.value,o.value,i.value,o.value,t,e,r))&&(u[l]=!0),l++;if(!s)return!1}return!0}function On(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}var xn="[object Arguments]",In="[object Boolean]",Fn="[object Date]",Rn="[object Map]",kn="[object Number]",qn="[object Object]",Mn="[object RegExp]",$n="[object Set]",Pn="[object String]",jn=Array.isArray,qt=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,Mt=Object.assign,_n=Object.prototype.toString.call.bind(Object.prototype.toString);function Ln(t){var e=t.areArraysEqual,r=t.areDatesEqual,u=t.areMapsEqual,n=t.areObjectsEqual,i=t.arePrimitiveWrappersEqual,o=t.areRegExpsEqual,a=t.areSetsEqual,s=t.areTypedArraysEqual;return function(c,f,p){if(c===f)return!0;if(c==null||f==null||typeof c!="object"||typeof f!="object")return c!==c&&f!==f;var h=c.constructor;if(h!==f.constructor)return!1;if(h===Object)return n(c,f,p);if(jn(c))return e(c,f,p);if(qt!=null&&qt(c))return s(c,f,p);if(h===Date)return r(c,f,p);if(h===RegExp)return o(c,f,p);if(h===Map)return u(c,f,p);if(h===Set)return a(c,f,p);var g=_n(c);return g===Fn?r(c,f,p):g===Mn?o(c,f,p):g===Rn?u(c,f,p):g===$n?a(c,f,p):g===qn?typeof c.then!="function"&&typeof f.then!="function"&&n(c,f,p):g===xn?n(c,f,p):g===In||g===kn||g===Pn?i(c,f,p):!1}}function Vn(t){var e=t.circular,r=t.createCustomConfig,u=t.strict,n={areArraysEqual:u?be:Cn,areDatesEqual:wn,areMapsEqual:u?Ot(Rt,be):Rt,areObjectsEqual:u?be:Sn,arePrimitiveWrappersEqual:Bn,areRegExpsEqual:Tn,areSetsEqual:u?Ot(kt,be):kt,areTypedArraysEqual:u?be:On};if(r&&(n=Mt({},n,r(n))),e){var i=Re(n.areArraysEqual),o=Re(n.areMapsEqual),a=Re(n.areObjectsEqual),s=Re(n.areSetsEqual);n=Mt({},n,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:s})}return n}function Un(t){return function(e,r,u,n,i,o,a){return t(e,r,a)}}function zn(t){var e=t.circular,r=t.comparator,u=t.createState,n=t.equals,i=t.strict;if(u)return function(s,l){var c=u(),f=c.cache,p=f===void 0?e?new WeakMap:void 0:f,h=c.meta;return r(s,l,{cache:p,equals:n,meta:h,strict:i})};if(e)return function(s,l){return r(s,l,{cache:new WeakMap,equals:n,meta:void 0,strict:i})};var o={cache:void 0,equals:n,meta:void 0,strict:i};return function(s,l){return r(s,l,o)}}var Gn=W();W({strict:!0});W({circular:!0});W({circular:!0,strict:!0});W({createInternalComparator:function(){return me}});W({strict:!0,createInternalComparator:function(){return me}});W({circular:!0,createInternalComparator:function(){return me}});W({circular:!0,createInternalComparator:function(){return me},strict:!0});function W(t){t===void 0&&(t={});var e=t.circular,r=e===void 0?!1:e,u=t.createInternalComparator,n=t.createState,i=t.strict,o=i===void 0?!1:i,a=Vn(t),s=Ln(a),l=u?u(s):Un(s);return zn({circular:r,comparator:s,createState:n,equals:l,strict:o})}function Tr(t,e){return Gn(t,e)}function Or(t,e){if(typeof t!=typeof e)return!1;if(!t&&!e)return!0;if(Array.isArray(t)){const i=e,o=t;return i.length===0?!0:i.every(a=>o.includes(a))}if(typeof t!="object")return Tr(t,e);const r=e,u=t;let n=!0;return Object.keys(r).forEach(i=>{n&&(Object.hasOwn(u,i)&&Or(u[i],r[i])||(n=!1))}),n}function Ye(t,e,r){return JSON.stringify(t,(n,i)=>{let o=i;return e&&(o=e(n,o)),o===void 0&&(o=null),o},r)}function xr(t,e){function r(n){return Object.keys(n).forEach(i=>{n[i]===null?n[i]=void 0:typeof n[i]=="object"&&(n[i]=r(n[i]))}),n}const u=JSON.parse(t,e);if(u!==null)return typeof u=="object"?r(u):u}function Jn(t){try{const e=Ye(t);return e===Ye(xr(e))}catch{return!1}}const Hn=t=>t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/");function Xn(){return typeof navigator<"u"&&navigator.languages?navigator.languages[0]:new Zt().resolvedOptions().locale}function Kn(t,e=2){if(t===0)return"0 Bytes";const r=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],u=Math.floor(Math.log(t)/Math.log(1024)),n=r[u];return`${new nr("en",{style:"decimal",maximumFractionDigits:e,minimumFractionDigits:0}).format(t/1024**u)} ${n}`}const at={projectSettingsContribution:{description:"The data an extension provides to inform Platform.Bible of the project settings it provides",anyOf:[{$ref:"#/$defs/projectSettingsGroup"},{type:"array",items:{$ref:"#/$defs/projectSettingsGroup"}}]},projectSettingsGroup:{description:"Group of related settings definitions",type:"object",properties:{label:{description:"localizeKey that displays in the project settings dialog as the group name",$ref:"#/$defs/localizeKey"},description:{description:"localizeKey that displays in the project settings dialog to describe the group",$ref:"#/$defs/localizeKey"},properties:{$ref:"#/$defs/projectSettingProperties"}},required:["label","properties"]},projectSettingProperties:{description:"Object whose keys are setting IDs and whose values are settings objects",type:"object",patternProperties:{"^[\\w\\-]+\\.[\\w\\-]+$":{$ref:"#/$defs/projectSetting"}},additionalProperties:!1},projectSetting:{description:"A description of an extension's setting entry",anyOf:[{$ref:"#/$defs/extensionControlledProjectSetting"}]},extensionControlledProjectSetting:{description:"Setting definition that is validated by the extension.",allOf:[{$ref:"#/$defs/projectSettingBase"},{$ref:"#/$defs/modifierExtensionControlled"}]},projectSettingBase:{description:"Base information needed to describe a project setting entry",allOf:[{$ref:"#/$defs/settingBase"},{$ref:"#/$defs/modifierProject"}]},modifierProject:{description:"Modifies setting type to be project setting",type:"object",properties:{includeProjectInterfaces:{description:"String representation of `RegExp` pattern(s) to match against projects' `projectInterface`s (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if they should be included.\n\nIf this is one string, it will be matched against `projectInterface`s. If this is an array, each entry is handled based on its type (at least one entry must match for this filter condition to pass):\n\n- If the entry is a string, it will be matched against each `projectInterface`. If any match, the project will pass this filter condition\n- If the entry is an array of strings, each will be matched against each `projectInterface`. If every string matches against at least one `projectInterface`, the project will pass this filter condition\n\nIn other words, each entry in the first-level array is `OR`'ed together. Each entry in second-level arrays (arrays within the first-level array) are `AND`'ed together.\n\nDefaults to all {@link ProjectInterfaces}, so all projects that do not match `excludeProjectInterfaces` will be included\n\n@example\n\n```typescript\nincludeProjectInterfaces: ['one', ['two', 'three']];\n```\n\nThis filter condition will succeed on projects whose `projectInterface`s fulfill at least one of the following conditions (At least one entry in the array must match):\n\n- Include `one`\n- Include both `two` and `three`.",anyOf:[{type:"null"},{type:"string"},{type:"array",items:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}}]},excludeProjectInterfaces:{description:"String representation of `RegExp` pattern(s) to match against projects' `projectInterface`s (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if they should absolutely not be included even if they match with `includeProjectInterfaces`.\n\nIf this is one string, it will be matched against `projectInterface`s. If this is an array, each entry is handled based on its type (at least one entry must match for this filter condition to exclude the project):\n\n- If the entry is a string, it will be matched against each `projectInterface`. If any match, the project will pass this filter condition and exclude the project\n- If the entry is an array of strings, each will be matched against each `projectInterface`. If every string matches against at least one `projectInterface`, the project will pass this filter condition and exclude the project\n\nIn other words, each entry in the first-level array is `OR`'ed together. Each entry in second-level arrays (arrays within the first-level array) are `AND`'ed together.\n\nDefaults to no {@link ProjectInterfaces}, so all projects that match `includeProjectInterfaces` will be included\n\n@example\n\n```typescript\nexcludeProjectInterfaces: ['one', ['two', 'three']];\n```\n\nThis filter condition will succeed and exclude projects whose `projectInterface`s fulfill at least one of the following conditions (At least one entry in the array must match):\n\n- Include `one`\n- Include both `two` and `three`.",anyOf:[{type:"null"},{type:"string"},{type:"array",items:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}}]},includePdpFactoryIds:{description:"String representation of `RegExp` pattern(s) to match against the Project Data Provider Factory Ids that provided each project's metadata (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if the projects should be included.\n\nDefaults to all Project Data Provider Factory Ids, so all projects that do not match `excludePdpFactoryIds` will be included",anyOf:[{type:"null"},{type:"string"},{type:"array",items:{type:"string"}}]},excludePdpFactoryIds:{description:"String representation of `RegExp` pattern(s) to match against the Project Data Provider Factory Ids that provided each project's metadata (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if the projects should absolutely not be included even if they match with `includeProjectInterfaces`.\n\nDefaults to none, so all projects that match `includePdpFactoryIds` will be included",anyOf:[{type:"null"},{type:"string"},{type:"array",items:{type:"string"}}]}}},settingsContribution:{description:"The data an extension provides to inform Platform.Bible of the settings it provides",anyOf:[{$ref:"#/$defs/settingsGroup"},{type:"array",items:{$ref:"#/$defs/settingsGroup"}}]},settingsGroup:{description:"Group of related settings definitions",type:"object",properties:{label:{description:"localizeKey that displays in the settings dialog as the group name",$ref:"#/$defs/localizeKey"},description:{description:"localizeKey that displays in the settings dialog to describe the group",$ref:"#/$defs/localizeKey"},properties:{$ref:"#/$defs/settingProperties"}},required:["label","properties"]},settingProperties:{description:"Object whose keys are setting IDs and whose values are settings objects",type:"object",patternProperties:{"^[\\w-]+\\.[\\w-]+$":{$ref:"#/$defs/setting"}},additionalProperties:!1},setting:{description:"A description of an extension's setting entry",anyOf:[{$ref:"#/$defs/extensionControlledSetting"}]},extensionControlledSetting:{description:"Setting definition that is validated by the extension.",allOf:[{$ref:"#/$defs/settingBase"},{$ref:"#/$defs/modifierExtensionControlled"}]},settingBase:{description:"Base information needed to describe a setting entry",allOf:[{$ref:"#/$defs/stateBase"},{type:"object",properties:{label:{description:"localizeKey that displays in the settings dialog as the setting name",$ref:"#/$defs/localizeKey"},description:{description:"localizeKey that displays in the settings dialog to describe the setting",$ref:"#/$defs/localizeKey"}},required:["label"]}]},projectStateContribution:{description:"The data an extension provides to inform Platform.Bible of the project state it provides",$ref:"#/$defs/userStateProperties"},userStateContribution:{description:"The data an extension provides to inform Platform.Bible of the user state it provides",$ref:"#/$defs/userStateProperties"},userStateProperties:{description:"Object whose keys are state IDs and whose values are state objects",type:"object",patternProperties:{"^[\\w\\-]+\\.[\\w\\-]+$":{$ref:"#/$defs/userState"}},additionalProperties:!1},userState:{description:"A description of an extension's user state entry",anyOf:[{$ref:"#/$defs/extensionControlledState"}]},extensionControlledState:{description:"State definition that is validated by the extension.",allOf:[{$ref:"#/$defs/stateBase"},{$ref:"#/$defs/modifierExtensionControlled"}]},modifierExtensionControlled:{description:'Modifies state/setting type to be extension-controlled. "Extension-controlled" means the extension provides the component and the validator for the state/setting, so the state/setting is controlled by the extension.',not:{anyOf:[{type:"object",required:["platformType"]},{type:"object",required:["type"]}]}},stateBase:{description:"Base information needed to describe a state entry",type:"object",properties:{default:{description:"default value for the state/setting",type:"any"},derivesFrom:{description:"a state/setting ID whose value to set to this state/setting's starting value the first time this state/setting is loaded",$ref:"#/$defs/id"}},required:["default"]},localizeKey:{description:"Identifier for a string that will be localized based on the user's UI language",type:"string",pattern:"^%[\\w\\-\\.]+%$",tsType:"LocalizeKey"},id:{description:"",type:"string",pattern:"^[\\w\\-]+\\.[\\w\\-]+$",tsType:"Id"}};function st(t){t&&Object.values(t).forEach(e=>{if(e.type){if("tsType"in e&&delete e.tsType,e.type==="any"){delete e.type;return}e.type==="object"&&st(e.properties)}})}st(at);const Ir={$schema:"https://json-schema.org/draft/2020-12/schema",title:"Project Settings Contribution",description:"The data an extension provides to inform Platform.Bible of the project settings it provides",anyOf:[{$ref:"#/$defs/projectSettingsGroup"},{type:"array",items:{$ref:"#/$defs/projectSettingsGroup"}}],$defs:at};Object.freeze(Ir);const Fr={$schema:"https://json-schema.org/draft/2020-12/schema",title:"Settings Contribution",description:"The data an extension provides to inform Platform.Bible of the settings it provides",anyOf:[{$ref:"#/$defs/settingsGroup"},{type:"array",items:{$ref:"#/$defs/settingsGroup"}}],$defs:at};Object.freeze(Fr);const Rr={languageStrings:{description:"Map whose keys are localized string keys and whose values provide information about how to localize strings for the localized string key",type:"object",patternProperties:{"^%[\\w\\-\\.]+%$":{$ref:"#/$defs/localizedStringValue"}},additionalProperties:!1},localizedStringValue:{description:"Localized string value associated with this key",type:"string"},stringsMetadata:{description:"Map whose keys are localized string keys and whose values provide additional non-locale-specific information about the localized string key",type:"object",patternProperties:{"^%[\\w\\-\\.]+%$":{$ref:"#/$defs/stringMetadata"}},additionalProperties:!1},stringMetadata:{description:"Additional non-locale-specific information about a localized string key",type:"object",properties:{fallbackKey:{description:"Localized string key from which to get this value if one does not exist in the specified language. If a new key/value pair needs to be made to replace an existing one, this could help smooth over the transition if the meanings are close enough.\nYou can use Paratext 9 Localized String Keys here. Be sure to escape any % signs with a backslash `\\`.",type:"string",pattern:"^%[\\w\\-\\.;&,' (){}#:/\\\\?%⋮|[\\]“”‘’!~* +=•`…​↑↓]+%$",tsType:"LocalizeKey"},notes:{description:"Additional information provided by developers in English to help the translator to know how to translate this localized string accurately",type:"string"}}},localizeKey:{description:"Identifier for a string that will be localized based on the user's UI language",type:"string",pattern:"^%[\\w\\-\\.]+%$",tsType:"LocalizeKey"}};st(Rr);const kr={$schema:"https://json-schema.org/draft/2020-12/schema",title:"Localized String Data Contribution",description:"The data an extension provides to inform Platform.Bible of the localized strings it provides.",type:"object",properties:{metadata:{$ref:"#/$defs/stringsMetadata"},localizedStrings:{type:"object",additionalProperties:{$ref:"#/$defs/languageStrings"}}},$defs:Rr};Object.freeze(kr);const qr={title:"Platform.Bible menus",type:"object",properties:{mainMenu:{description:"Top level menu for the application",$ref:"#/$defs/multiColumnMenu"},defaultWebViewTopMenu:{description:"Default top menu for web views that don't specify their own",$ref:"#/$defs/multiColumnMenu"},defaultWebViewContextMenu:{description:"Default context menu for web views that don't specify their own",$ref:"#/$defs/singleColumnMenu"},webViewMenus:{description:"Menus that apply per web view in the application",type:"object",patternProperties:{"^[\\w\\-]+\\.[\\w\\-]+$":{$ref:"#/$defs/menusForOneWebView"}},additionalProperties:!1}},required:["mainMenu","defaultWebViewTopMenu","defaultWebViewContextMenu","webViewMenus"],additionalProperties:!1,$defs:{localizeKey:{description:"Identifier for a string that will be localized in a menu based on the user's UI language",type:"string",pattern:"^%[\\w\\-\\.]+%$"},referencedItem:{description:"Name of some UI element (i.e., tab, column, group, menu item) or some PAPI object (i.e., command)",type:"string",pattern:"^[\\w\\-]+\\.[\\w\\-]+$"},columnsWithHeaders:{description:"Group of columns that can be combined with other columns to form a multi-column menu",type:"object",patternProperties:{"^[\\w\\-]+\\.[\\w\\-]+$":{description:"Single column with a header string",type:"object",properties:{label:{description:"Header text for this this column in the UI",$ref:"#/$defs/localizeKey"},localizeNotes:{description:"Additional information provided by developers to help people who perform localization",type:"string"},order:{description:"Relative order of this column compared to other columns (sorted ascending)",type:"number"},isExtensible:{description:"Defines whether contributions are allowed to add menu groups to this column",type:"boolean"}},required:["label","order"],additionalProperties:!1}},properties:{isExtensible:{description:"Defines whether contributions are allowed to add columns to this multi-column menu",type:"boolean"}}},menuGroups:{description:"Group of menu items that can be combined with other groups to form a single menu/submenu. Groups are separated using a line within the menu/submenu.",type:"object",patternProperties:{"^[\\w\\-]+\\.[\\w\\-]+$":{description:"Single group that contains menu items",type:"object",oneOf:[{properties:{column:{description:"Column where this group belongs, not required for single column menus",$ref:"#/$defs/referencedItem"},order:{description:"Relative order of this group compared to other groups in the same column or submenu (sorted ascending)",type:"number"},isExtensible:{description:"Defines whether contributions are allowed to add menu items to this menu group",type:"boolean"}},required:["order"],additionalProperties:!1},{properties:{menuItem:{description:"Menu item that anchors the submenu where this group belongs",$ref:"#/$defs/referencedItem"},order:{description:"Relative order of this group compared to other groups in the same column or submenu (sorted ascending)",type:"number"},isExtensible:{description:"Defines whether contributions are allowed to add menu items to this menu group",type:"boolean"}},required:["menuItem","order"],additionalProperties:!1}]}},additionalProperties:!1},menuItem:{description:"Single item in a menu that can be clicked on to take an action or can be the parent of a submenu",type:"object",oneOf:[{properties:{id:{description:"ID for this menu item that holds a submenu",$ref:"#/$defs/referencedItem"}},required:["id"]},{properties:{command:{description:"Name of the PAPI command to run when this menu item is selected.",$ref:"#/$defs/referencedItem"},iconPathBefore:{description:"Uri path to the icon to display before the menu text. Ex: `papi-extension://helloWorld/assets/icon.png`",type:"string"},iconPathAfter:{description:"Uri path to the icon to display after the menu text. Ex: `papi-extension://helloWorld/assets/icon.png`",type:"string"}},required:["command"]}],properties:{label:{description:"Key that represents the text of this menu item to display",$ref:"#/$defs/localizeKey"},tooltip:{description:"Key that represents the text to display if a mouse pointer hovers over the menu item",$ref:"#/$defs/localizeKey"},searchTerms:{description:"Key that represents additional words the platform should reference when users are searching for menu items",$ref:"#/$defs/localizeKey"},localizeNotes:{description:"Additional information provided by developers to help people who perform localization",type:"string"},group:{description:"Group to which this menu item belongs",$ref:"#/$defs/referencedItem"},order:{description:"Relative order of this menu item compared to other menu items in the same group (sorted ascending)",type:"number"}},required:["label","group","order"],unevaluatedProperties:!1},groupsAndItems:{description:"Core schema for a column",type:"object",properties:{groups:{description:"Groups that belong in this menu",$ref:"#/$defs/menuGroups"},items:{description:"List of menu items that belong in this menu",type:"array",items:{$ref:"#/$defs/menuItem"},uniqueItems:!0}},required:["groups","items"]},singleColumnMenu:{description:"Menu that contains a column without a header",type:"object",allOf:[{$ref:"#/$defs/groupsAndItems"}],unevaluatedProperties:!1},multiColumnMenu:{description:"Menu that can contain multiple columns with headers",type:"object",allOf:[{$ref:"#/$defs/groupsAndItems"},{properties:{columns:{description:"Columns that belong in this menu",$ref:"#/$defs/columnsWithHeaders"}},required:["columns"]}],unevaluatedProperties:!1},menusForOneWebView:{description:"Set of menus that are associated with a single tab",type:"object",properties:{includeDefaults:{description:"Indicates whether the platform default menus should be included for this webview",type:"boolean"},topMenu:{description:"Menu that opens when you click on the top left corner of a tab",$ref:"#/$defs/multiColumnMenu"},contextMenu:{description:"Menu that opens when you right click on the main body/area of a tab",$ref:"#/$defs/singleColumnMenu"}},additionalProperties:!1}}};Object.freeze(qr);var Y={},H={};function Wn(t,e,r){if(r===void 0&&(r=Array.prototype),t&&typeof r.find=="function")return r.find.call(t,e);for(var u=0;u=0&&t=0){for(var n=e.length-1;u0},lookupPrefix:function(t){for(var e=this;e;){var r=e._nsMap;if(r){for(var u in r)if(Object.prototype.hasOwnProperty.call(r,u)&&r[u]===t)return u}e=e.nodeType==fe?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var r=e._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,t))return r[t];e=e.nodeType==fe?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){var e=this.lookupPrefix(t);return e==null}};function Xr(t){return t=="<"&&"<"||t==">"&&">"||t=="&"&&"&"||t=='"'&&"""||"&#"+t.charCodeAt()+";"}Te(k,D);Te(k,D.prototype);function Se(t,e){if(e(t))return!0;if(t=t.firstChild)do if(Se(t,e))return!0;while(t=t.nextSibling)}function Oe(){this.ownerDocument=this}function ni(t,e,r){t&&t._inc++;var u=r.namespaceURI;u===we.XMLNS&&(e._nsMap[r.prefix?r.localName:""]=r.value)}function Kr(t,e,r,u){t&&t._inc++;var n=r.namespaceURI;n===we.XMLNS&&delete e._nsMap[r.prefix?r.localName:""]}function ft(t,e,r){if(t&&t._inc){t._inc++;var u=e.childNodes;if(r)u[u.length++]=r;else{for(var n=e.firstChild,i=0;n;)u[i++]=n,n=n.nextSibling;u.length=i,delete u[u.length]}}}function Wr(t,e){var r=e.previousSibling,u=e.nextSibling;return r?r.nextSibling=u:t.firstChild=u,u?u.previousSibling=r:t.lastChild=r,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,ft(t.ownerDocument,t),e}function ii(t){return t&&(t.nodeType===D.DOCUMENT_NODE||t.nodeType===D.DOCUMENT_FRAGMENT_NODE||t.nodeType===D.ELEMENT_NODE)}function oi(t){return t&&(V(t)||pt(t)||J(t)||t.nodeType===D.DOCUMENT_FRAGMENT_NODE||t.nodeType===D.COMMENT_NODE||t.nodeType===D.PROCESSING_INSTRUCTION_NODE)}function J(t){return t&&t.nodeType===D.DOCUMENT_TYPE_NODE}function V(t){return t&&t.nodeType===D.ELEMENT_NODE}function pt(t){return t&&t.nodeType===D.TEXT_NODE}function Lt(t,e){var r=t.childNodes||[];if(L(r,V)||J(e))return!1;var u=L(r,J);return!(e&&u&&r.indexOf(u)>r.indexOf(e))}function Vt(t,e){var r=t.childNodes||[];function u(i){return V(i)&&i!==e}if(L(r,u))return!1;var n=L(r,J);return!(e&&n&&r.indexOf(n)>r.indexOf(e))}function ai(t,e,r){if(!ii(t))throw new C(F,"Unexpected parent node type "+t.nodeType);if(r&&r.parentNode!==t)throw new C(Gr,"child not in parent");if(!oi(e)||J(e)&&t.nodeType!==D.DOCUMENT_NODE)throw new C(F,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function si(t,e,r){var u=t.childNodes||[],n=e.childNodes||[];if(e.nodeType===D.DOCUMENT_FRAGMENT_NODE){var i=n.filter(V);if(i.length>1||L(n,pt))throw new C(F,"More than one element or text in fragment");if(i.length===1&&!Lt(t,r))throw new C(F,"Element in fragment can not be inserted before doctype")}if(V(e)&&!Lt(t,r))throw new C(F,"Only one element can be added and only after doctype");if(J(e)){if(L(u,J))throw new C(F,"Only one doctype is allowed");var o=L(u,V);if(r&&u.indexOf(o)1||L(n,pt))throw new C(F,"More than one element or text in fragment");if(i.length===1&&!Vt(t,r))throw new C(F,"Element in fragment can not be inserted before doctype")}if(V(e)&&!Vt(t,r))throw new C(F,"Only one element can be added and only after doctype");if(J(e)){if(L(u,function(s){return J(s)&&s!==r}))throw new C(F,"Only one doctype is allowed");var o=L(u,V);if(r&&u.indexOf(o)0&&Se(r.documentElement,function(n){if(n!==r&&n.nodeType===P){var i=n.getAttribute("class");if(i){var o=t===i;if(!o){var a=$t(i);o=e.every(ti(a))}o&&u.push(n)}}}),u})},createElement:function(t){var e=new re;e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new z;var r=e.attributes=new $e;return r._ownerElement=e,e},createDocumentFragment:function(){var t=new Ue;return t.ownerDocument=this,t.childNodes=new z,t},createTextNode:function(t){var e=new ht;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new dt;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new mt;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var r=new Dt;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=t,r.nodeValue=r.data=e,r},createAttribute:function(t){var e=new je;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new gt;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var r=new re,u=e.split(":"),n=r.attributes=new $e;return r.childNodes=new z,r.ownerDocument=this,r.nodeName=e,r.tagName=e,r.namespaceURI=t,u.length==2?(r.prefix=u[0],r.localName=u[1]):r.localName=e,n._ownerElement=r,r},createAttributeNS:function(t,e){var r=new je,u=e.split(":");return r.ownerDocument=this,r.nodeName=e,r.name=e,r.namespaceURI=t,r.specified=!0,u.length==2?(r.prefix=u[0],r.localName=u[1]):r.localName=e,r}};R(Oe,D);function re(){this._nsMap={}}re.prototype={nodeType:P,hasAttribute:function(t){return this.getAttributeNode(t)!=null},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var r=this.ownerDocument.createAttribute(t);r.value=r.nodeValue=""+e,this.setAttributeNode(r)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===G?this.insertBefore(t,null):ci(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var r=this.getAttributeNodeNS(t,e);r&&this.removeAttributeNode(r)},hasAttributeNS:function(t,e){return this.getAttributeNodeNS(t,e)!=null},getAttributeNS:function(t,e){var r=this.getAttributeNodeNS(t,e);return r&&r.value||""},setAttributeNS:function(t,e,r){var u=this.ownerDocument.createAttributeNS(t,e);u.value=u.nodeValue=""+r,this.setAttributeNode(u)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new pe(this,function(e){var r=[];return Se(e,function(u){u!==e&&u.nodeType==P&&(t==="*"||u.tagName==t)&&r.push(u)}),r})},getElementsByTagNameNS:function(t,e){return new pe(this,function(r){var u=[];return Se(r,function(n){n!==r&&n.nodeType===P&&(t==="*"||n.namespaceURI===t)&&(e==="*"||n.localName==e)&&u.push(n)}),u})}};Oe.prototype.getElementsByTagName=re.prototype.getElementsByTagName;Oe.prototype.getElementsByTagNameNS=re.prototype.getElementsByTagNameNS;R(re,D);function je(){}je.prototype.nodeType=fe;R(je,D);function xe(){}xe.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(S[F])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,r){var u=this.data.substring(0,t),n=this.data.substring(t+e);r=u+r+n,this.nodeValue=this.data=r,this.length=r.length}};R(xe,D);function ht(){}ht.prototype={nodeName:"#text",nodeType:Me,splitText:function(t){var e=this.data,r=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var u=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(u,this.nextSibling),u}};R(ht,xe);function dt(){}dt.prototype={nodeName:"#comment",nodeType:Vr};R(dt,xe);function mt(){}mt.prototype={nodeName:"#cdata-section",nodeType:jr};R(mt,xe);function Ve(){}Ve.prototype.nodeType=zr;R(Ve,D);function Zr(){}Zr.prototype.nodeType=ui;R(Zr,D);function Qr(){}Qr.prototype.nodeType=ri;R(Qr,D);function gt(){}gt.prototype.nodeType=_r;R(gt,D);function Ue(){}Ue.prototype.nodeName="#document-fragment";Ue.prototype.nodeType=G;R(Ue,D);function Dt(){}Dt.prototype.nodeType=Lr;R(Dt,D);function eu(){}eu.prototype.serializeToString=function(t,e,r){return tu.call(t,e,r)};D.prototype.toString=tu;function tu(t,e){var r=[],u=this.nodeType==9&&this.documentElement||this,n=u.prefix,i=u.namespaceURI;if(i&&n==null){var n=u.lookupPrefix(i);if(n==null)var o=[{namespace:i,prefix:null}]}return se(this,r,t,e,o),r.join("")}function Ut(t,e,r){var u=t.prefix||"",n=t.namespaceURI;if(!n||u==="xml"&&n===we.XML||n===we.XMLNS)return!1;for(var i=r.length;i--;){var o=r[i];if(o.prefix===u)return o.namespace!==n}return!0}function He(t,e,r){t.push(" ",e,'="',r.replace(/[<>&"\t\n\r]/g,Xr),'"')}function se(t,e,r,u,n){if(n||(n=[]),u)if(t=u(t),t){if(typeof t=="string"){e.push(t);return}}else return;switch(t.nodeType){case P:var i=t.attributes,o=i.length,y=t.firstChild,a=t.tagName;r=we.isHTML(t.namespaceURI)||r;var s=a;if(!r&&!t.prefix&&t.namespaceURI){for(var l,c=0;c=0;f--){var p=n[f];if(p.prefix===""&&p.namespace===t.namespaceURI){l=p.namespace;break}}if(l!==t.namespaceURI)for(var f=n.length-1;f>=0;f--){var p=n[f];if(p.namespace===t.namespaceURI){p.prefix&&(s=p.prefix+":"+a);break}}}e.push("<",s);for(var h=0;h"),r&&/^script$/i.test(a))for(;y;)y.data?e.push(y.data):se(y,e,r,u,n.slice()),y=y.nextSibling;else for(;y;)se(y,e,r,u,n.slice()),y=y.nextSibling;e.push("")}else e.push("/>");return;case Ur:case G:for(var y=t.firstChild;y;)se(y,e,r,u,n.slice()),y=y.nextSibling;return;case fe:return He(e,t.name,t.value);case Me:return e.push(t.data.replace(/[<&>]/g,Xr));case jr:return e.push("");case Vr:return e.push("");case zr:var Z=t.publicId,A=t.systemId;if(e.push("");else if(A&&A!=".")e.push(" SYSTEM ",A,">");else{var O=t.internalSubset;O&&e.push(" [",O,"]"),e.push(">")}return;case Lr:return e.push("");case _r:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function ru(t,e,r){var u;switch(e.nodeType){case P:u=e.cloneNode(!1),u.ownerDocument=t;case G:break;case fe:r=!0;break}if(u||(u=e.cloneNode(!1)),u.ownerDocument=t,u.parentNode=null,r)for(var n=e.firstChild;n;)u.appendChild(ru(t,n,r)),n=n.nextSibling;return u}function Ze(t,e,r){var u=new e.constructor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=e[n];typeof i!="object"&&i!=u[n]&&(u[n]=i)}switch(e.childNodes&&(u.childNodes=new z),u.ownerDocument=t,u.nodeType){case P:var o=e.attributes,a=u.attributes=new $e,s=o.length;a._ownerElement=u;for(var l=0;l",lt:"<",quot:'"'}),t.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:` -`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES})(nu);var bt={},Be=H.NAMESPACE,Qe=/[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]/,zt=new RegExp("[\\-\\.0-9"+Qe.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Gt=new RegExp("^"+Qe.source+zt.source+"*(?::"+Qe.source+zt.source+"*)?$"),ve=0,X=1,ne=2,Ee=3,ie=4,oe=5,Ae=6,ke=7;function he(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,he)}he.prototype=new Error;he.prototype.name=he.name;function iu(){}iu.prototype={parse:function(t,e,r){var u=this.domBuilder;u.startDocument(),ou(e,e={}),li(t,e,r,u,this.errorHandler),u.endDocument()}};function li(t,e,r,u,n){function i(N){if(N>65535){N-=65536;var $=55296+(N>>10),lu=56320+(N&1023);return String.fromCharCode($,lu)}else return String.fromCharCode(N)}function o(N){var $=N.slice(1,-1);return Object.hasOwnProperty.call(r,$)?r[$]:$.charAt(0)==="#"?i(parseInt($.substr(1).replace("x","0x"))):(n.error("entity not found:"+N),N)}function a(N){if(N>b){var $=t.substring(b,N).replace(/&#?\w+;/g,o);p&&s(b),u.characters($,0,N-b),b=N}}function s(N,$){for(;N>=c&&($=f.exec(t));)l=$.index,c=l+$[0].length,p.lineNumber++;p.columnNumber=N-l+1}for(var l=0,c=0,f=/.*(?:\r\n?|\n)|.*$/g,p=u.locator,h=[{currentNSMap:e}],g={},b=0;;){try{var v=t.indexOf("<",b);if(v<0){if(!t.substr(b).match(/^\s*$/)){var y=u.doc,Z=y.createTextNode(t.substr(b));y.appendChild(Z),u.currentElement=Z}return}switch(v>b&&a(v),t.charAt(v+1)){case"/":var x=t.indexOf(">",v+3),A=t.substring(v+2,x).replace(/[ \t\n\r]+$/g,""),O=h.pop();x<0?(A=t.substring(v+2).replace(/[\s<].*/,""),n.error("end tag name: "+A+" is not complete:"+O.tagName),x=v+1+A.length):A.match(/\sb?b=x:a(Math.max(v,b)+1)}}function Jt(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function fi(t,e,r,u,n,i){function o(p,h,g){r.attributeNames.hasOwnProperty(p)&&i.fatalError("Attribute "+p+" redefined"),r.addValue(p,h.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,n),g)}for(var a,s,l=++e,c=ve;;){var f=t.charAt(l);switch(f){case"=":if(c===X)a=t.slice(e,l),c=Ee;else if(c===ne)c=Ee;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===Ee||c===X)if(c===X&&(i.warning('attribute value must after "="'),a=t.slice(e,l)),e=l+1,l=t.indexOf(f,e),l>0)s=t.slice(e,l),o(a,s,e-1),c=oe;else throw new Error("attribute value no end '"+f+"' match");else if(c==ie)s=t.slice(e,l),o(a,s,e),i.warning('attribute "'+a+'" missed start quot('+f+")!!"),e=l+1,c=oe;else throw new Error('attribute value must after "="');break;case"/":switch(c){case ve:r.setTagName(t.slice(e,l));case oe:case Ae:case ke:c=ke,r.closed=!0;case ie:case X:break;case ne:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return i.error("unexpected end of input"),c==ve&&r.setTagName(t.slice(e,l)),l;case">":switch(c){case ve:r.setTagName(t.slice(e,l));case oe:case Ae:case ke:break;case ie:case X:s=t.slice(e,l),s.slice(-1)==="/"&&(r.closed=!0,s=s.slice(0,-1));case ne:c===ne&&(s=a),c==ie?(i.warning('attribute "'+s+'" missed quot(")!'),o(a,s,e)):((!Be.isHTML(u[""])||!s.match(/^(?:disabled|checked|selected)$/i))&&i.warning('attribute "'+s+'" missed value!! "'+s+'" instead!!'),o(s,s,e));break;case Ee:throw new Error("attribute value missed!!")}return l;case"€":f=" ";default:if(f<=" ")switch(c){case ve:r.setTagName(t.slice(e,l)),c=Ae;break;case X:a=t.slice(e,l),c=ne;break;case ie:var s=t.slice(e,l);i.warning('attribute "'+s+'" missed quot(")!!'),o(a,s,e);case oe:c=Ae;break}else switch(c){case ne:r.tagName,(!Be.isHTML(u[""])||!a.match(/^(?:disabled|checked|selected)$/i))&&i.warning('attribute "'+a+'" missed value!! "'+a+'" instead2!!'),o(a,a,e),e=l,c=X;break;case oe:i.warning('attribute space is required"'+a+'"!!');case Ae:c=X,e=l;break;case Ee:c=ie,e=l;break;case ke:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function Ht(t,e,r){for(var u=t.tagName,n=null,f=t.length;f--;){var i=t[f],o=i.qName,a=i.value,p=o.indexOf(":");if(p>0)var s=i.prefix=o.slice(0,p),l=o.slice(p+1),c=s==="xmlns"&&l;else l=o,s=null,c=o==="xmlns"&&"";i.localName=l,c!==!1&&(n==null&&(n={},ou(r,r={})),r[c]=n[c]=a,i.uri=Be.XMLNS,e.startPrefixMapping(c,a))}for(var f=t.length;f--;){i=t[f];var s=i.prefix;s&&(s==="xml"&&(i.uri=Be.XML),s!=="xmlns"&&(i.uri=r[s||""]))}var p=u.indexOf(":");p>0?(s=t.prefix=u.slice(0,p),l=t.localName=u.slice(p+1)):(s=null,l=t.localName=u);var h=t.uri=r[s||""];if(e.startElement(h,l,u,t),t.closed){if(e.endElement(h,l,u),n)for(s in n)Object.prototype.hasOwnProperty.call(n,s)&&e.endPrefixMapping(s)}else return t.currentNSMap=r,t.localNSMap=n,!0}function pi(t,e,r,u,n){if(/^(?:script|textarea)$/i.test(r)){var i=t.indexOf("",e),o=t.substring(e+1,i);if(/[&<]/.test(o))return/^script$/i.test(r)?(n.characters(o,0,o.length),i):(o=o.replace(/&#?\w+;/g,u),n.characters(o,0,o.length),i)}return e+1}function hi(t,e,r,u){var n=u[r];return n==null&&(n=t.lastIndexOf(""),n",e+4);return i>e?(r.comment(t,e+4,i-e-4),i+3):(u.error("Unclosed comment"),-1)}else return-1;default:if(t.substr(e+3,6)=="CDATA["){var i=t.indexOf("]]>",e+9);return r.startCDATA(),r.characters(t,e+9,i-e-9),r.endCDATA(),i+3}var o=gi(t,e),a=o.length;if(a>1&&/!doctype/i.test(o[0][0])){var s=o[1][0],l=!1,c=!1;a>3&&(/^public$/i.test(o[2][0])?(l=o[3][0],c=a>4&&o[4][0]):/^system$/i.test(o[2][0])&&(c=o[3][0]));var f=o[a-1];return r.startDTD(s,l,c),r.endDTD(),f.index+f[0].length}}return-1}function mi(t,e,r){var u=t.indexOf("?>",e);if(u){var n=t.substring(e,u).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return n?(n[0].length,r.processingInstruction(n[1],n[2]),u+2):-1}return-1}function au(){this.attributeNames={}}au.prototype={setTagName:function(t){if(!Gt.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,r){if(!Gt.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:r}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}};function gi(t,e){var r,u=[],n=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(n.lastIndex=e,n.exec(t);r=n.exec(t);)if(u.push(r),r[1])return u}bt.XMLReader=iu;bt.ParseError=he;var Di=H,bi=Y,Xt=nu,su=bt,vi=bi.DOMImplementation,Kt=Di.NAMESPACE,Ei=su.ParseError,Ai=su.XMLReader;function yi(t){return t.replace(/\r[\n\u0085]/g,` +"use strict";var Nu=Object.defineProperty;var bu=(e,t,r)=>t in e?Nu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var S=(e,t,r)=>bu(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const yu=require("async-mutex"),mr=require("jsonpath-plus");class Cu{constructor(t,r=1e4){S(this,"variableName");S(this,"promiseToValue");S(this,"resolver");S(this,"rejecter");this.variableName=t,this.promiseToValue=new Promise((n,u)=>{this.resolver=n,this.rejecter=u}),r>0&&setTimeout(()=>{this.rejecter&&(this.rejecter(`Timeout reached when waiting for ${this.variableName} to settle`),this.complete())},r),Object.seal(this)}get promise(){return this.promiseToValue}get hasSettled(){return Object.isFrozen(this)}resolveToValue(t,r=!1){if(this.resolver)console.debug(`${this.variableName} is being resolved now`),this.resolver(t),this.complete();else{if(r)throw Error(`${this.variableName} was already settled`);console.debug(`Ignoring subsequent resolution of ${this.variableName}`)}}rejectWithReason(t,r=!1){if(this.rejecter)console.debug(`${this.variableName} is being rejected now`),this.rejecter(t),this.complete();else{if(r)throw Error(`${this.variableName} was already settled`);console.debug(`Ignoring subsequent rejection of ${this.variableName}`)}}complete(){this.resolver=void 0,this.rejecter=void 0,Object.freeze(this)}}class Tu{constructor(t,r){S(this,"collator");this.collator=new Intl.Collator(t,r)}compare(t,r){return this.collator.compare(t,r)}resolvedOptions(){return this.collator.resolvedOptions()}}class Wr{constructor(t,r){S(this,"dateTimeFormatter");this.dateTimeFormatter=new Intl.DateTimeFormat(t,r)}format(t){return this.dateTimeFormatter.format(t)}formatRange(t,r){return this.dateTimeFormatter.formatRange(t,r)}formatRangeToParts(t,r){return this.dateTimeFormatter.formatRangeToParts(t,r)}formatToParts(t){return this.dateTimeFormatter.formatToParts(t)}resolvedOptions(){return this.dateTimeFormatter.resolvedOptions()}}class Qr{constructor(){S(this,"subscribe",this.event);S(this,"subscriptions");S(this,"lazyEvent");S(this,"isDisposed",!1);S(this,"dispose",()=>this.disposeFn());S(this,"emit",t=>{this.emitFn(t)})}get event(){return this.assertNotDisposed(),this.lazyEvent||(this.lazyEvent=t=>{if(!t||typeof t!="function")throw new Error("Event handler callback must be a function!");return this.subscriptions||(this.subscriptions=[]),this.subscriptions.push(t),()=>{if(!this.subscriptions)return!1;const r=this.subscriptions.indexOf(t);return r<0?!1:(this.subscriptions.splice(r,1),!0)}}),this.lazyEvent}emitFn(t){this.assertNotDisposed(),[...this.subscriptions??[]].forEach(n=>n(t))}assertNotDisposed(){if(this.isDisposed)throw new Error("Emitter is disposed")}disposeFn(){return this.assertNotDisposed(),this.isDisposed=!0,this.subscriptions=void 0,this.lazyEvent=void 0,Promise.resolve(!0)}}function wu(){return"00-0-4-1-000".replace(/[^-]/g,e=>((Math.random()+~~e)*65536>>e).toString(16).padStart(4,"0"))}function We(e){return typeof e=="string"||e instanceof String}function Oe(e){return JSON.parse(JSON.stringify(e))}function Su(e,t=300){if(We(e))throw new Error("Tried to debounce a string! Could be XSS");let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>e(...n),t)}}function Ou(e,t,r){const n=new Map;return e.forEach(u=>{const i=t(u),a=n.get(i),o=r?r(u,i):u;a?a.push(o):n.set(i,[o])}),n}function Iu(e){return typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"}function Ru(e){if(Iu(e))return e;try{return new Error(JSON.stringify(e))}catch{return new Error(String(e))}}function Bu(e){return Ru(e).message}function Zr(e){return new Promise(t=>setTimeout(t,e))}function xu(e,t){const r=Zr(t).then(()=>{});return Promise.any([r,e()])}function Mu(e,t="obj"){const r=new Set;Object.getOwnPropertyNames(e).forEach(u=>{try{typeof e[u]=="function"&&r.add(u)}catch{}});let n=Object.getPrototypeOf(e);for(;n&&Object.getPrototypeOf(n);)Object.getOwnPropertyNames(n).forEach(u=>{try{typeof e[u]=="function"&&r.add(u)}catch{}}),n=Object.getPrototypeOf(n);return r}function _u(e,t={}){return new Proxy(t,{get(r,n){return n in r?r[n]:async(...u)=>(await e())[n](...u)}})}class en{constructor(t,r){S(this,"baseDocument");S(this,"contributions",new Map);S(this,"latestOutput");S(this,"options");S(this,"onDidRebuildEmitter",new Qr);S(this,"onDidRebuild",this.onDidRebuildEmitter.subscribe);this.baseDocument=t,this.options=r,this.updateBaseDocument(t)}updateBaseDocument(t){return this.validateBaseDocument(t),this.baseDocument=this.options.copyDocuments?Oe(t):t,this.baseDocument=this.transformBaseDocumentAfterValidation(this.baseDocument),this.rebuild()}addOrUpdateContribution(t,r){this.validateContribution(t,r);const n=this.contributions.get(t);let u=this.options.copyDocuments&&r?Oe(r):r;u=this.transformContributionAfterValidation(t,u),this.contributions.set(t,u);try{return this.rebuild()}catch(i){throw n?this.contributions.set(t,n):this.contributions.delete(t),new Error(`Error when setting the document named ${t}: ${i}`)}}deleteContribution(t){const r=this.contributions.get(t);if(!r)throw new Error(`${t} does not exist`);this.contributions.delete(t);try{return this.rebuild()}catch(n){throw this.contributions.set(t,r),new Error(`Error when deleting the document named ${t}: ${n}`)}}deleteAllContributions(){if(this.contributions.size<=0)return this.latestOutput;const t=[...this.contributions.entries()];t.forEach(([r])=>this.contributions.delete(r));try{return this.rebuild()}catch(r){throw t.forEach(([n,u])=>this.contributions.set(n,u)),new Error(`Error when deleting all contributions: ${r}`)}}rebuild(){if(this.contributions.size===0){let r=Oe(this.baseDocument);return r=this.transformFinalOutputBeforeValidation(r),this.validateOutput(r),this.latestOutput=r,this.onDidRebuildEmitter.emit(void 0),this.latestOutput}let t=this.baseDocument;return this.contributions.forEach(r=>{t=Fu(t,r,this.options.ignoreDuplicateProperties),this.validateOutput(t)}),t=this.transformFinalOutputBeforeValidation(t),this.validateOutput(t),this.latestOutput=t,this.onDidRebuildEmitter.emit(void 0),this.latestOutput}transformBaseDocumentAfterValidation(t){return t}transformContributionAfterValidation(t,r){return r}validateBaseDocument(t){}validateContribution(t,r){}validateOutput(t){}transformFinalOutputBeforeValidation(t){return t}}function Er(...e){let t=!0;return e.forEach(r=>{(!r||typeof r!="object"||Array.isArray(r))&&(t=!1)}),t}function gr(...e){let t=!0;return e.forEach(r=>{(!r||typeof r!="object"||!Array.isArray(r))&&(t=!1)}),t}function Fu(e,t,r){const n=Oe(e);return t?tn(n,Oe(t),r):n}function tn(e,t,r){if(!t)return e;if(Er(e,t)){const n=e,u=t;Object.keys(u).forEach(i=>{if(Object.hasOwn(n,i)){if(Er(n[i],u[i]))n[i]=tn(n[i],u[i],r);else if(gr(n[i],u[i]))n[i]=n[i].concat(u[i]);else if(!r)throw new Error(`Cannot merge objects: key "${i}" already exists in the target object`)}else n[i]=u[i]})}else gr(e,t)&&e.push(...t);return e}class rn extends yu.Mutex{}class Lu{constructor(){S(this,"mutexesByID",new Map)}get(t){let r=this.mutexesByID.get(t);return r||(r=new rn,this.mutexesByID.set(t,r),r)}}class Pu extends en{constructor(t,r){super(t,r)}get output(){return this.latestOutput}}class nn{constructor(t,r){S(this,"numberFormatter");this.numberFormatter=new Intl.NumberFormat(t,r)}format(t){return this.numberFormatter.format(t)}formatRange(t,r){return this.numberFormatter.formatRange(t,r)}formatRangeToParts(t,r){return this.numberFormatter.formatRangeToParts(t,r)}formatToParts(t){return this.numberFormatter.formatToParts(t)}resolvedOptions(){return this.numberFormatter.resolvedOptions()}}class ku{constructor(t="Anonymous"){S(this,"unsubscribers",new Set);this.name=t}add(...t){t.forEach(r=>{"dispose"in r?this.unsubscribers.add(r.dispose):this.unsubscribers.add(r)})}async runAllUnsubscribers(){const t=[...this.unsubscribers].map(n=>n()),r=await Promise.all(t);return this.unsubscribers.clear(),r.every((n,u)=>(n||console.error(`UnsubscriberAsyncList ${this.name}: Unsubscriber at index ${u} failed!`),n))}}var qu=Object.defineProperty,$u=(e,t,r)=>t in e?qu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,D=(e,t,r)=>$u(e,typeof t!="symbol"?t+"":t,r);const me=["GEN","EXO","LEV","NUM","DEU","JOS","JDG","RUT","1SA","2SA","1KI","2KI","1CH","2CH","EZR","NEH","EST","JOB","PSA","PRO","ECC","SNG","ISA","JER","LAM","EZK","DAN","HOS","JOL","AMO","OBA","JON","MIC","NAM","HAB","ZEP","HAG","ZEC","MAL","MAT","MRK","LUK","JHN","ACT","ROM","1CO","2CO","GAL","EPH","PHP","COL","1TH","2TH","1TI","2TI","TIT","PHM","HEB","JAS","1PE","2PE","1JN","2JN","3JN","JUD","REV","TOB","JDT","ESG","WIS","SIR","BAR","LJE","S3Y","SUS","BEL","1MA","2MA","3MA","4MA","1ES","2ES","MAN","PS2","ODA","PSS","JSA","JDB","TBS","SST","DNT","BLT","XXA","XXB","XXC","XXD","XXE","XXF","XXG","FRT","BAK","OTH","3ES","EZA","5EZ","6EZ","INT","CNC","GLO","TDX","NDX","DAG","PS3","2BA","LBA","JUB","ENO","1MQ","2MQ","3MQ","REP","4BA","LAO"],Jt=["XXA","XXB","XXC","XXD","XXE","XXF","XXG","FRT","BAK","OTH","INT","CNC","GLO","TDX","NDX"],un=["Genesis","Exodus","Leviticus","Numbers","Deuteronomy","Joshua","Judges","Ruth","1 Samuel","2 Samuel","1 Kings","2 Kings","1 Chronicles","2 Chronicles","Ezra","Nehemiah","Esther (Hebrew)","Job","Psalms","Proverbs","Ecclesiastes","Song of Songs","Isaiah","Jeremiah","Lamentations","Ezekiel","Daniel (Hebrew)","Hosea","Joel","Amos","Obadiah","Jonah","Micah","Nahum","Habakkuk","Zephaniah","Haggai","Zechariah","Malachi","Matthew","Mark","Luke","John","Acts","Romans","1 Corinthians","2 Corinthians","Galatians","Ephesians","Philippians","Colossians","1 Thessalonians","2 Thessalonians","1 Timothy","2 Timothy","Titus","Philemon","Hebrews","James","1 Peter","2 Peter","1 John","2 John","3 John","Jude","Revelation","Tobit","Judith","Esther Greek","Wisdom of Solomon","Sirach (Ecclesiasticus)","Baruch","Letter of Jeremiah","Song of 3 Young Men","Susanna","Bel and the Dragon","1 Maccabees","2 Maccabees","3 Maccabees","4 Maccabees","1 Esdras (Greek)","2 Esdras (Latin)","Prayer of Manasseh","Psalm 151","Odes","Psalms of Solomon","Joshua A. *obsolete*","Judges B. *obsolete*","Tobit S. *obsolete*","Susanna Th. *obsolete*","Daniel Th. *obsolete*","Bel Th. *obsolete*","Extra A","Extra B","Extra C","Extra D","Extra E","Extra F","Extra G","Front Matter","Back Matter","Other Matter","3 Ezra *obsolete*","Apocalypse of Ezra","5 Ezra (Latin Prologue)","6 Ezra (Latin Epilogue)","Introduction","Concordance ","Glossary ","Topical Index","Names Index","Daniel Greek","Psalms 152-155","2 Baruch (Apocalypse)","Letter of Baruch","Jubilees","Enoch","1 Meqabyan","2 Meqabyan","3 Meqabyan","Reproof (Proverbs 25-31)","4 Baruch (Rest of Baruch)","Laodiceans"],Dr=Ku();function _e(e,t=!0){return t&&(e=e.toUpperCase()),e in Dr?Dr[e]:0}function Xt(e){return _e(e)>0}function ju(e){const t=typeof e=="string"?_e(e):e;return t>=40&&t<=66}function Uu(e){return(typeof e=="string"?_e(e):e)<=39}function on(e){return e<=66}function Vu(e){const t=typeof e=="string"?_e(e):e;return cn(t)&&!on(t)}function*Hu(){for(let e=1;e<=me.length;e++)yield e}const Gu=1,an=me.length;function zu(){return["XXA","XXB","XXC","XXD","XXE","XXF","XXG"]}function Yt(e,t="***"){const r=e-1;return r<0||r>=me.length?t:me[r]}function sn(e){return e<=0||e>an?"******":un[e-1]}function Ju(e){return sn(_e(e))}function cn(e){const t=typeof e=="number"?Yt(e):e;return Xt(t)&&!Jt.includes(t)}function Xu(e){const t=typeof e=="number"?Yt(e):e;return Xt(t)&&Jt.includes(t)}function Yu(e){return un[e-1].includes("*obsolete*")}function Ku(){const e={};for(let t=0;t(e[e.Unknown=0]="Unknown",e[e.Original=1]="Original",e[e.Septuagint=2]="Septuagint",e[e.Vulgate=3]="Vulgate",e[e.English=4]="English",e[e.RussianProtestant=5]="RussianProtestant",e[e.RussianOrthodox=6]="RussianOrthodox",e))(Z||{});const G=class{constructor(t){if(D(this,"name"),D(this,"fullPath"),D(this,"isPresent"),D(this,"hasVerseSegments"),D(this,"isCustomized"),D(this,"baseVersification"),D(this,"scriptureBooks"),D(this,"_type"),t==null)throw new Error("Argument undefined");typeof t=="string"?(this.name=t,this._type=Z[t]):(this._type=t,this.name=Z[t])}get type(){return this._type}equals(t){return!t.type||!this.type?!1:t.type===this.type}};D(G,"Original",new G(Z.Original)),D(G,"Septuagint",new G(Z.Septuagint)),D(G,"Vulgate",new G(Z.Vulgate)),D(G,"English",new G(Z.English)),D(G,"RussianProtestant",new G(Z.RussianProtestant)),D(G,"RussianOrthodox",new G(Z.RussianOrthodox));let oe=G;function vr(e,t){const r=t[0];for(let n=1;n(e[e.Valid=0]="Valid",e[e.UnknownVersification=1]="UnknownVersification",e[e.OutOfRange=2]="OutOfRange",e[e.VerseOutOfOrder=3]="VerseOutOfOrder",e[e.VerseRepeated=4]="VerseRepeated",e))(ln||{});const P=class N{constructor(t,r,n,u){if(D(this,"firstChapter"),D(this,"lastChapter"),D(this,"lastVerse"),D(this,"hasSegmentsDefined"),D(this,"text"),D(this,"BBBCCCVVVS"),D(this,"longHashCode"),D(this,"versification"),D(this,"rtlMark","‏"),D(this,"_bookNum",0),D(this,"_chapterNum",0),D(this,"_verseNum",0),D(this,"_verse"),n==null&&u==null)if(t!=null&&typeof t=="string"){const i=t,a=r!=null&&r instanceof oe?r:void 0;this.setEmpty(a),this.parse(i)}else if(t!=null&&typeof t=="number"){const i=r!=null&&r instanceof oe?r:void 0;this.setEmpty(i),this._verseNum=t%N.chapterDigitShifter,this._chapterNum=Math.floor(t%N.bookDigitShifter/N.chapterDigitShifter),this._bookNum=Math.floor(t/N.bookDigitShifter)}else if(r==null)if(t!=null&&t instanceof N){const i=t;this._bookNum=i.bookNum,this._chapterNum=i.chapterNum,this._verseNum=i.verseNum,this._verse=i.verse,this.versification=i.versification}else{if(t==null)return;const i=t instanceof oe?t:N.defaultVersification;this.setEmpty(i)}else throw new Error("VerseRef constructor not supported.");else if(t!=null&&r!=null&&n!=null)if(typeof t=="string"&&typeof r=="string"&&typeof n=="string")this.setEmpty(u),this.updateInternal(t,r,n);else if(typeof t=="number"&&typeof r=="number"&&typeof n=="number")this._bookNum=t,this._chapterNum=r,this._verseNum=n,this.versification=u??N.defaultVersification;else throw new Error("VerseRef constructor not supported.");else throw new Error("VerseRef constructor not supported.")}static isVerseParseable(t){return t.length>0&&"0123456789".includes(t[0])&&!t.endsWith(this.verseRangeSeparator)&&!t.endsWith(this.verseSequenceIndicator)}static tryParse(t){let r;try{return r=new N(t),{success:!0,verseRef:r}}catch(n){if(n instanceof Ve)return r=new N,{success:!1,verseRef:r};throw n}}static getBBBCCCVVV(t,r,n){return t%N.bcvMaxValue*N.bookDigitShifter+(r>=0?r%N.bcvMaxValue*N.chapterDigitShifter:0)+(n>=0?n%N.bcvMaxValue:0)}static fromJSON(t){const{book:r,chapterNum:n,verseNum:u,verse:i,versificationStr:a}=t,o=i||u.toString();let s;return a&&(s=new oe(a)),r?new N(r,n.toString(),o,s):new N}static tryGetVerseNum(t){let r;if(!t)return r=-1,{success:!0,vNum:r};r=0;let n;for(let u=0;u"9")return u===0&&(r=-1),{success:!1,vNum:r};if(r=r*10+ +n-0,r>N.bcvMaxValue)return r=-1,{success:!1,vNum:r}}return{success:!0,vNum:r}}get isDefault(){return this.bookNum===0&&this.chapterNum===0&&this.verseNum===0&&this.versification==null}get hasMultiple(){return this._verse!=null&&(this._verse.includes(N.verseRangeSeparator)||this._verse.includes(N.verseSequenceIndicator))}get book(){return W.bookNumberToId(this.bookNum,"")}set book(t){this.bookNum=W.bookIdToNumber(t)}get chapter(){return this.isDefault||this._chapterNum<0?"":this._chapterNum.toString()}set chapter(t){const r=+t;this._chapterNum=Number.isInteger(r)?r:-1}get verse(){return this._verse!=null?this._verse:this.isDefault||this._verseNum<0?"":this._verseNum.toString()}set verse(t){const{success:r,vNum:n}=N.tryGetVerseNum(t);this._verse=r?void 0:t.replace(this.rtlMark,""),this._verseNum=n,!(this._verseNum>=0)&&({vNum:this._verseNum}=N.tryGetVerseNum(this._verse))}get bookNum(){return this._bookNum}set bookNum(t){if(t<=0||t>W.lastBook)throw new Ve("BookNum must be greater than zero and less than or equal to last book");this._bookNum=t}get chapterNum(){return this._chapterNum}set chapterNum(t){this.chapterNum=t}get verseNum(){return this._verseNum}set verseNum(t){this._verseNum=t}get versificationStr(){var t;return(t=this.versification)==null?void 0:t.name}set versificationStr(t){this.versification=this.versification!=null?new oe(t):void 0}get valid(){return this.validStatus===0}get validStatus(){return this.validateVerse(N.verseRangeSeparators,N.verseSequenceIndicators)}get BBBCCC(){return N.getBBBCCCVVV(this._bookNum,this._chapterNum,0)}get BBBCCCVVV(){return N.getBBBCCCVVV(this._bookNum,this._chapterNum,this._verseNum)}get isExcluded(){return!1}parse(t){if(t=t.replace(this.rtlMark,""),t.includes("/")){const i=t.split("/");if(t=i[0],i.length>1)try{const a=+i[1].trim();this.versification=new oe(Z[a])}catch{throw new Ve("Invalid reference : "+t)}}const r=t.trim().split(" ");if(r.length!==2)throw new Ve("Invalid reference : "+t);const n=r[1].split(":"),u=+n[0];if(n.length!==2||W.bookIdToNumber(r[0])===0||!Number.isInteger(u)||u<0||!N.isVerseParseable(n[1]))throw new Ve("Invalid reference : "+t);this.updateInternal(r[0],n[0],n[1])}simplify(){this._verse=void 0}clone(){return new N(this)}toString(){const t=this.book;return t===""?"":`${t} ${this.chapter}:${this.verse}`}toJSON(){let t=this.verse;(t===""||t===this.verseNum.toString())&&(t=void 0);const r={book:this.book,chapterNum:this.chapterNum,verseNum:this.verseNum,verse:t,versificationStr:this.versificationStr};return t||delete r.verse,r}equals(t){return t instanceof N?t._bookNum===this._bookNum&&t._chapterNum===this._chapterNum&&t._verseNum===this._verseNum&&t.verse===this.verse&&(t.versification==null&&this.versification==null||t.versification!=null&&this.versification!=null&&t.versification.equals(this.versification)):!1}allVerses(t=!1,r=N.verseRangeSeparators,n=N.verseSequenceIndicators){if(this._verse==null||this.chapterNum<=0)return[this.clone()];const u=[],i=vr(this._verse,n);for(const a of i.map(o=>vr(o,r))){const o=this.clone();o.verse=a[0];const s=o.verseNum;if(u.push(o),a.length>1){const c=this.clone();if(c.verse=a[1],!t)for(let l=s+1;la)return 3;if(n===a)return 4;n=a}return 0}get internalValid(){return this.versification==null?1:this._bookNum<=0||this._bookNum>W.lastBook?2:(W.isCanonical(this._bookNum),0)}setEmpty(t=N.defaultVersification){this._bookNum=0,this._chapterNum=-1,this._verse=void 0,this.versification=t}updateInternal(t,r,n){this.bookNum=W.bookIdToNumber(t),this.chapter=r,this.verse=n}};D(P,"defaultVersification",oe.English),D(P,"verseRangeSeparator","-"),D(P,"verseSequenceIndicator",","),D(P,"verseRangeSeparators",[P.verseRangeSeparator]),D(P,"verseSequenceIndicators",[P.verseSequenceIndicator]),D(P,"chapterDigitShifter",1e3),D(P,"bookDigitShifter",P.chapterDigitShifter*P.chapterDigitShifter),D(P,"bcvMaxValue",P.chapterDigitShifter-1),D(P,"ValidStatusType",ln);let Kt=P;class Ve extends Error{}var Ar=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ve={},Wu=()=>{const e="\\ud800-\\udfff",a="\\u0300-\\u036f"+"\\ufe20-\\ufe2f"+"\\u20d0-\\u20ff"+"\\u1ab0-\\u1aff"+"\\u1dc0-\\u1dff",o="\\ufe0e\\ufe0f",s="\\uD83D\\uDC69\\uD83C\\uDFFB\\u200D\\uD83C\\uDF93",c=`[${e}]`,l=`[${a}]`,f="\\ud83c[\\udffb-\\udfff]",p=`(?:${l}|${f})`,m=`[^${e}]`,b="(?:\\uD83C[\\uDDE6-\\uDDFF]){2}",T="[\\ud800-\\udbff][\\udc00-\\udfff]",w="\\u200d",I="(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40(?:\\udc65|\\udc73|\\udc77)\\udb40(?:\\udc6e|\\udc63|\\udc6c)\\udb40(?:\\udc67|\\udc74|\\udc73)\\udb40\\udc7f)",re=`[${s}]`,R=`${p}?`,K=`[${o}]?`,U=`(?:${w}(?:${[m,b,T].join("|")})${K+R})*`,je=K+R+U,Mt=`(?:${[`${m}${l}?`,l,b,T,c,re].join("|")})`;return new RegExp(`${I}|${f}(?=${f})|${Mt+je}`,"g")},Qu=Ar&&Ar.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ve,"__esModule",{value:!0});var Nt=Qu(Wu);function jt(e){if(typeof e!="string")throw new Error("A string is expected as input");return e.match(Nt.default())||[]}var Zu=ve.toArray=jt;function Wt(e){if(typeof e!="string")throw new Error("Input must be a string");var t=e.match(Nt.default());return t===null?0:t.length}var ei=ve.length=Wt;function fn(e,t,r){if(t===void 0&&(t=0),typeof e!="string")throw new Error("Input must be a string");(typeof t!="number"||t<0)&&(t=0),typeof r=="number"&&r<0&&(r=0);var n=e.match(Nt.default());return n?n.slice(t,r).join(""):""}var ti=ve.substring=fn;function ri(e,t,r){if(t===void 0&&(t=0),typeof e!="string")throw new Error("Input must be a string");var n=Wt(e);if(typeof t!="number"&&(t=parseInt(t,10)),t>=n)return"";t<0&&(t+=n);var u;typeof r>"u"?u=n:(typeof r!="number"&&(r=parseInt(r,10)),u=r>=0?r+t:t);var i=e.match(Nt.default());return i?i.slice(t,u).join(""):""}var ni=ve.substr=ri;function ui(e,t,r,n){if(t===void 0&&(t=16),r===void 0&&(r="#"),n===void 0&&(n="right"),typeof e!="string"||typeof t!="number")throw new Error("Invalid arguments specified");if(["left","right"].indexOf(n)===-1)throw new Error("Pad position should be either left or right");typeof r!="string"&&(r=String(r));var u=Wt(e);if(u>t)return fn(e,0,t);if(u=n.length)return t===""?n.length:-1;if(t==="")return r;var u=jt(t),i=!1,a;for(a=r;a_(e)||t<-_(e)))return bt(e,t,1)}function he(e,t){return t<0||t>_(e)-1?"":bt(e,t,1)}function si(e,t){if(!(t<0||t>_(e)-1))return bt(e,t,1).codePointAt(0)}function hn(e,t,r=_(e)){const n=En(e,t);return!(n===-1||n+_(t)!==r)}function ci(e,t,r){if(t<0)return-1;if(r){if(he(e,t)==="}"&&he(e,t-1)==="\\")return t;const i=Ie(e,"\\}",t);return i>=0?i+1:i}let n=t;const u=_(e);for(;n=u?-1:n}function dn(e,t){const r=[];let n=0,u=0;function i(o,s,c){const l=ae(e,u,s),f=r.length>0&&We(r[r.length-1])?`${r.pop()}${l}`:l;We(o)?r.push(`${f}${o}`):(f&&r.push(f),r.push(o)),u=s+c}const a=_(e);for(;n=0){const s=ae(e,n+1,o),c=s in t?t[s]:s;i(c,n,o+1-n),n=o,u=o+1}}else i("{",n-1,2);break;case"}":he(e,n-1)!=="\\"||i("}",n-1,2);break}n+=1}if(u0&&We(r[r.length-1])?`${r.pop()}${o}`:o)}return r}function li(e,t){return dn(e,t).map(r=>`${r}`).join("")}function mn(e,t,r=0){const n=ae(e,r);return Ie(n,t)!==-1}function Ie(e,t,r=0){return oi(e,t,r)}function En(e,t,r){let n=r===void 0?_(e):r;n<0?n=0:n>=_(e)&&(n=_(e)-1);for(let u=n;u>=0;u--)if(bt(e,u,_(t))===t)return u;return-1}function _(e){return ei(e)}function fi(e,t){const r=t.toUpperCase();return r==="NONE"?e:e.normalize(r)}function pi(e,t,r){return e.localeCompare(t,"en",r)}function hi(e,t,r=" "){return t<=_(e)?e:pn(e,t,r,"right")}function di(e,t,r=" "){return t<=_(e)?e:pn(e,t,r,"left")}function Nr(e,t){return t>e?e:t<-e?0:t<0?t+e:t}function mi(e,t,r){const n=_(e);if(t>n||r&&(t>r&&!(t>=0&&t-n)||r<-n))return"";const u=Nr(n,t),i=r?Nr(n,r):void 0;return ae(e,u,i)}function Ut(e,t,r){const n=[];if(r!==void 0&&r<=0)return[e];if(t==="")return gn(e).slice(0,r);let u=t;(typeof t=="string"||t instanceof RegExp&&!mn(t.flags,"g"))&&(u=new RegExp(t,"g"));const i=e.match(u);let a=0;if(!i)return[e];for(let o=0;o<(r?r-1:i.length);o++){const s=Ie(e,i[o],a),c=_(i[o]);if(n.push(ae(e,a,s)),a=s+c,r!==void 0&&n.length===r)break}return n.push(ae(e,a)),n}function Zt(e,t,r=0){return Ie(e,t,r)===r}function bt(e,t=0,r=_(e)-t){return ni(e,t,r)}function ae(e,t,r=_(e)){return ti(e,t,r)}function gn(e){return Zu(e)}function Ei(e){return Zt(e,"%")&&hn(e,"%")}function gi(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Di(e){return e?Qt(e).map(n=>Array.isArray(n)?n.map(u=>new RegExp(u)):new RegExp(n)):[]}function vi(e){return e?Qt(e).map(n=>new RegExp(n)):[]}const Dn=[{shortName:"ERR",fullNames:["ERROR"],chapters:-1},{shortName:"GEN",fullNames:["Genesis"],chapters:50},{shortName:"EXO",fullNames:["Exodus"],chapters:40},{shortName:"LEV",fullNames:["Leviticus"],chapters:27},{shortName:"NUM",fullNames:["Numbers"],chapters:36},{shortName:"DEU",fullNames:["Deuteronomy"],chapters:34},{shortName:"JOS",fullNames:["Joshua"],chapters:24},{shortName:"JDG",fullNames:["Judges"],chapters:21},{shortName:"RUT",fullNames:["Ruth"],chapters:4},{shortName:"1SA",fullNames:["1 Samuel"],chapters:31},{shortName:"2SA",fullNames:["2 Samuel"],chapters:24},{shortName:"1KI",fullNames:["1 Kings"],chapters:22},{shortName:"2KI",fullNames:["2 Kings"],chapters:25},{shortName:"1CH",fullNames:["1 Chronicles"],chapters:29},{shortName:"2CH",fullNames:["2 Chronicles"],chapters:36},{shortName:"EZR",fullNames:["Ezra"],chapters:10},{shortName:"NEH",fullNames:["Nehemiah"],chapters:13},{shortName:"EST",fullNames:["Esther"],chapters:10},{shortName:"JOB",fullNames:["Job"],chapters:42},{shortName:"PSA",fullNames:["Psalm","Psalms"],chapters:150},{shortName:"PRO",fullNames:["Proverbs"],chapters:31},{shortName:"ECC",fullNames:["Ecclesiastes"],chapters:12},{shortName:"SNG",fullNames:["Song of Solomon","Song of Songs"],chapters:8},{shortName:"ISA",fullNames:["Isaiah"],chapters:66},{shortName:"JER",fullNames:["Jeremiah"],chapters:52},{shortName:"LAM",fullNames:["Lamentations"],chapters:5},{shortName:"EZK",fullNames:["Ezekiel"],chapters:48},{shortName:"DAN",fullNames:["Daniel"],chapters:12},{shortName:"HOS",fullNames:["Hosea"],chapters:14},{shortName:"JOL",fullNames:["Joel"],chapters:3},{shortName:"AMO",fullNames:["Amos"],chapters:9},{shortName:"OBA",fullNames:["Obadiah"],chapters:1},{shortName:"JON",fullNames:["Jonah"],chapters:4},{shortName:"MIC",fullNames:["Micah"],chapters:7},{shortName:"NAM",fullNames:["Nahum"],chapters:3},{shortName:"HAB",fullNames:["Habakkuk"],chapters:3},{shortName:"ZEP",fullNames:["Zephaniah"],chapters:3},{shortName:"HAG",fullNames:["Haggai"],chapters:2},{shortName:"ZEC",fullNames:["Zechariah"],chapters:14},{shortName:"MAL",fullNames:["Malachi"],chapters:4},{shortName:"MAT",fullNames:["Matthew"],chapters:28},{shortName:"MRK",fullNames:["Mark"],chapters:16},{shortName:"LUK",fullNames:["Luke"],chapters:24},{shortName:"JHN",fullNames:["John"],chapters:21},{shortName:"ACT",fullNames:["Acts"],chapters:28},{shortName:"ROM",fullNames:["Romans"],chapters:16},{shortName:"1CO",fullNames:["1 Corinthians"],chapters:16},{shortName:"2CO",fullNames:["2 Corinthians"],chapters:13},{shortName:"GAL",fullNames:["Galatians"],chapters:6},{shortName:"EPH",fullNames:["Ephesians"],chapters:6},{shortName:"PHP",fullNames:["Philippians"],chapters:4},{shortName:"COL",fullNames:["Colossians"],chapters:4},{shortName:"1TH",fullNames:["1 Thessalonians"],chapters:5},{shortName:"2TH",fullNames:["2 Thessalonians"],chapters:3},{shortName:"1TI",fullNames:["1 Timothy"],chapters:6},{shortName:"2TI",fullNames:["2 Timothy"],chapters:4},{shortName:"TIT",fullNames:["Titus"],chapters:3},{shortName:"PHM",fullNames:["Philemon"],chapters:1},{shortName:"HEB",fullNames:["Hebrews"],chapters:13},{shortName:"JAS",fullNames:["James"],chapters:5},{shortName:"1PE",fullNames:["1 Peter"],chapters:5},{shortName:"2PE",fullNames:["2 Peter"],chapters:3},{shortName:"1JN",fullNames:["1 John"],chapters:5},{shortName:"2JN",fullNames:["2 John"],chapters:1},{shortName:"3JN",fullNames:["3 John"],chapters:1},{shortName:"JUD",fullNames:["Jude"],chapters:1},{shortName:"REV",fullNames:["Revelation"],chapters:22}],vn=1,An=Dn.length-1,Nn=1,bn=1,Ai={bookNum:1,chapterNum:1,verseNum:1},yn=e=>{var t;return((t=Dn[e])==null?void 0:t.chapters)??-1},Ni=(e,t)=>({bookNum:Math.max(vn,Math.min(e.bookNum+t,An)),chapterNum:1,verseNum:1}),bi=(e,t)=>({...e,chapterNum:Math.min(Math.max(Nn,e.chapterNum+t),yn(e.bookNum)),verseNum:1}),yi=(e,t)=>({...e,verseNum:Math.max(bn,e.verseNum+t)});async function Ci(e,t,r){const n=W.bookNumberToId(e);if(!Zt(Intl.getCanonicalLocales(t)[0],"zh"))return r({localizeKey:`LocalizedId.${n}`,languagesToSearch:[t]});const u=await r({localizeKey:`Book.${n}`,languagesToSearch:[t]}),i=Ut(u,"-");return Ut(i[0],"ÿ08")[0].trim()}function Vt(e){return new Kt(e.bookNum,e.chapterNum,e.verseNum).BBBCCCVVV}function Ti(e,t){return Vt(e)-Vt(t)}function Cn(e){return`%scrollGroup_${e}%`}function wi(e){return e.map(t=>Cn(t))}function Si(e,t,r,n){let u;switch(t??"id"){case"English":u=W.bookNumberToEnglishName(e.bookNum);break;case"id":u=W.bookNumberToId(e.bookNum);break;default:u=t??"";break}return`${u}${n??" "}${e.chapterNum}${r??":"}${e.verseNum}`}const Oi=e=>(...t)=>e.map(n=>n(...t)).every(n=>n),Ii=e=>async(...t)=>{const r=e.map(async n=>n(...t));return(await Promise.all(r)).every(n=>n)},Xe="chapter",Ye="verse";var Ri=Object.getOwnPropertyNames,Bi=Object.getOwnPropertySymbols,xi=Object.prototype.hasOwnProperty;function br(e,t){return function(n,u,i){return e(n,u,i)&&t(n,u,i)}}function mt(e){return function(r,n,u){if(!r||!n||typeof r!="object"||typeof n!="object")return e(r,n,u);var i=u.cache,a=i.get(r),o=i.get(n);if(a&&o)return a===n&&o===r;i.set(r,n),i.set(n,r);var s=e(r,n,u);return i.delete(r),i.delete(n),s}}function yr(e){return Ri(e).concat(Bi(e))}var Tn=Object.hasOwn||function(e,t){return xi.call(e,t)};function Fe(e,t){return e||t?e===t:e===t||e!==e&&t!==t}var wn="_owner",Cr=Object.getOwnPropertyDescriptor,Tr=Object.keys;function Mi(e,t,r){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function _i(e,t){return Fe(e.getTime(),t.getTime())}function wr(e,t,r){if(e.size!==t.size)return!1;for(var n={},u=e.entries(),i=0,a,o;(a=u.next())&&!a.done;){for(var s=t.entries(),c=!1,l=0;(o=s.next())&&!o.done;){var f=a.value,p=f[0],m=f[1],b=o.value,T=b[0],w=b[1];!c&&!n[l]&&(c=r.equals(p,T,i,l,e,t,r)&&r.equals(m,w,p,T,e,t,r))&&(n[l]=!0),l++}if(!c)return!1;i++}return!0}function Fi(e,t,r){var n=Tr(e),u=n.length;if(Tr(t).length!==u)return!1;for(var i;u-- >0;)if(i=n[u],i===wn&&(e.$$typeof||t.$$typeof)&&e.$$typeof!==t.$$typeof||!Tn(t,i)||!r.equals(e[i],t[i],i,i,e,t,r))return!1;return!0}function He(e,t,r){var n=yr(e),u=n.length;if(yr(t).length!==u)return!1;for(var i,a,o;u-- >0;)if(i=n[u],i===wn&&(e.$$typeof||t.$$typeof)&&e.$$typeof!==t.$$typeof||!Tn(t,i)||!r.equals(e[i],t[i],i,i,e,t,r)||(a=Cr(e,i),o=Cr(t,i),(a||o)&&(!a||!o||a.configurable!==o.configurable||a.enumerable!==o.enumerable||a.writable!==o.writable)))return!1;return!0}function Li(e,t){return Fe(e.valueOf(),t.valueOf())}function Pi(e,t){return e.source===t.source&&e.flags===t.flags}function Sr(e,t,r){if(e.size!==t.size)return!1;for(var n={},u=e.values(),i,a;(i=u.next())&&!i.done;){for(var o=t.values(),s=!1,c=0;(a=o.next())&&!a.done;)!s&&!n[c]&&(s=r.equals(i.value,a.value,i.value,a.value,e,t,r))&&(n[c]=!0),c++;if(!s)return!1}return!0}function ki(e,t){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}var qi="[object Arguments]",$i="[object Boolean]",ji="[object Date]",Ui="[object Map]",Vi="[object Number]",Hi="[object Object]",Gi="[object RegExp]",zi="[object Set]",Ji="[object String]",Xi=Array.isArray,Or=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,Ir=Object.assign,Yi=Object.prototype.toString.call.bind(Object.prototype.toString);function Ki(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areMapsEqual,u=e.areObjectsEqual,i=e.arePrimitiveWrappersEqual,a=e.areRegExpsEqual,o=e.areSetsEqual,s=e.areTypedArraysEqual;return function(l,f,p){if(l===f)return!0;if(l==null||f==null||typeof l!="object"||typeof f!="object")return l!==l&&f!==f;var m=l.constructor;if(m!==f.constructor)return!1;if(m===Object)return u(l,f,p);if(Xi(l))return t(l,f,p);if(Or!=null&&Or(l))return s(l,f,p);if(m===Date)return r(l,f,p);if(m===RegExp)return a(l,f,p);if(m===Map)return n(l,f,p);if(m===Set)return o(l,f,p);var b=Yi(l);return b===ji?r(l,f,p):b===Gi?a(l,f,p):b===Ui?n(l,f,p):b===zi?o(l,f,p):b===Hi?typeof l.then!="function"&&typeof f.then!="function"&&u(l,f,p):b===qi?u(l,f,p):b===$i||b===Vi||b===Ji?i(l,f,p):!1}}function Wi(e){var t=e.circular,r=e.createCustomConfig,n=e.strict,u={areArraysEqual:n?He:Mi,areDatesEqual:_i,areMapsEqual:n?br(wr,He):wr,areObjectsEqual:n?He:Fi,arePrimitiveWrappersEqual:Li,areRegExpsEqual:Pi,areSetsEqual:n?br(Sr,He):Sr,areTypedArraysEqual:n?He:ki};if(r&&(u=Ir({},u,r(u))),t){var i=mt(u.areArraysEqual),a=mt(u.areMapsEqual),o=mt(u.areObjectsEqual),s=mt(u.areSetsEqual);u=Ir({},u,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:s})}return u}function Qi(e){return function(t,r,n,u,i,a,o){return e(t,r,o)}}function Zi(e){var t=e.circular,r=e.comparator,n=e.createState,u=e.equals,i=e.strict;if(n)return function(s,c){var l=n(),f=l.cache,p=f===void 0?t?new WeakMap:void 0:f,m=l.meta;return r(s,c,{cache:p,equals:u,meta:m,strict:i})};if(t)return function(s,c){return r(s,c,{cache:new WeakMap,equals:u,meta:void 0,strict:i})};var a={cache:void 0,equals:u,meta:void 0,strict:i};return function(s,c){return r(s,c,a)}}var eo=pe();pe({strict:!0});pe({circular:!0});pe({circular:!0,strict:!0});pe({createInternalComparator:function(){return Fe}});pe({strict:!0,createInternalComparator:function(){return Fe}});pe({circular:!0,createInternalComparator:function(){return Fe}});pe({circular:!0,createInternalComparator:function(){return Fe},strict:!0});function pe(e){e===void 0&&(e={});var t=e.circular,r=t===void 0?!1:t,n=e.createInternalComparator,u=e.createState,i=e.strict,a=i===void 0?!1:i,o=Wi(e),s=Ki(o),c=n?n(s):Qi(s);return Zi({circular:r,comparator:s,createState:u,equals:c,strict:a})}function Sn(e,t){return eo(e,t)}function On(e,t){if(typeof e!=typeof t)return!1;if(!e&&!t)return!0;if(Array.isArray(e)){const i=t,a=e;return i.length===0?!0:i.every(o=>a.includes(o))}if(typeof e!="object")return Sn(e,t);const r=t,n=e;let u=!0;return Object.keys(r).forEach(i=>{u&&(Object.hasOwn(n,i)&&On(n[i],r[i])||(u=!1))}),u}function Ht(e,t,r){return JSON.stringify(e,(u,i)=>{let a=i;return t&&(a=t(u,a)),a===void 0&&(a=null),a},r)}function In(e,t){function r(a){return Object.keys(a).forEach(o=>{a[o]===null?a[o]=void 0:typeof a[o]=="object"&&(a[o]=r(a[o]))}),a}function n(a,o){if(o&&typeof o=="object"&&"book"in o&&typeof o.book=="string"&&"chapterNum"in o&&typeof o.chapterNum=="number"&&"verseNum"in o&&typeof o.verseNum=="number"&&Object.keys(o).every(s=>["book","chapterNum","verseNum","verse","versificationStr"].includes(s))){const s=o.chapterNum.toString(10),c="verse"in o&&typeof o.verse=="string"?o.verse:o.verseNum.toString(10),l="versificationStr"in o&&typeof o.versificationStr=="string"?new oe(o.versificationStr):void 0;return new Kt(o.book,s,c,l)}return o}function u(a,o){return n(a,t?t.call(this,a,o):o)}const i=JSON.parse(e,u);if(i!==null)return typeof i=="object"?r(i):i}function to(e){try{const t=Ht(e);return t===Ht(In(t))}catch{return!1}}const ro=e=>e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/");function no(){return typeof navigator<"u"&&navigator.languages?navigator.languages[0]:new Wr().resolvedOptions().locale}function uo(e,t=2){if(e===0)return"0 Bytes";const r=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.floor(Math.log(e)/Math.log(1024)),u=r[n];return`${new nn("en",{style:"decimal",maximumFractionDigits:t,minimumFractionDigits:0}).format(e/1024**n)} ${u}`}const er={projectSettingsContribution:{description:"The data an extension provides to inform Platform.Bible of the project settings it provides",anyOf:[{$ref:"#/$defs/projectSettingsGroup"},{type:"array",items:{$ref:"#/$defs/projectSettingsGroup"}}]},projectSettingsGroup:{description:"Group of related settings definitions",type:"object",properties:{label:{description:"localizeKey that displays in the project settings dialog as the group name",$ref:"#/$defs/localizeKey"},description:{description:"localizeKey that displays in the project settings dialog to describe the group",$ref:"#/$defs/localizeKey"},properties:{$ref:"#/$defs/projectSettingProperties"}},required:["label","properties"]},projectSettingProperties:{description:"Object whose keys are setting IDs and whose values are settings objects",type:"object",patternProperties:{"^[\\w\\-]+\\.[\\w\\-]+$":{$ref:"#/$defs/projectSetting"}},additionalProperties:!1},projectSetting:{description:"A description of an extension's setting entry",anyOf:[{$ref:"#/$defs/extensionControlledProjectSetting"}]},extensionControlledProjectSetting:{description:"Setting definition that is validated by the extension.",allOf:[{$ref:"#/$defs/projectSettingBase"},{$ref:"#/$defs/modifierExtensionControlled"}]},projectSettingBase:{description:"Base information needed to describe a project setting entry",allOf:[{$ref:"#/$defs/settingBase"},{$ref:"#/$defs/modifierProject"}]},modifierProject:{description:"Modifies setting type to be project setting",type:"object",properties:{includeProjectInterfaces:{description:"String representation of `RegExp` pattern(s) to match against projects' `projectInterface`s (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if they should be included.\n\nIf this is one string, it will be matched against `projectInterface`s. If this is an array, each entry is handled based on its type (at least one entry must match for this filter condition to pass):\n\n- If the entry is a string, it will be matched against each `projectInterface`. If any match, the project will pass this filter condition\n- If the entry is an array of strings, each will be matched against each `projectInterface`. If every string matches against at least one `projectInterface`, the project will pass this filter condition\n\nIn other words, each entry in the first-level array is `OR`'ed together. Each entry in second-level arrays (arrays within the first-level array) are `AND`'ed together.\n\nDefaults to all {@link ProjectInterfaces}, so all projects that do not match `excludeProjectInterfaces` will be included\n\n@example\n\n```typescript\nincludeProjectInterfaces: ['one', ['two', 'three']];\n```\n\nThis filter condition will succeed on projects whose `projectInterface`s fulfill at least one of the following conditions (At least one entry in the array must match):\n\n- Include `one`\n- Include both `two` and `three`.",anyOf:[{type:"null"},{type:"string"},{type:"array",items:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}}]},excludeProjectInterfaces:{description:"String representation of `RegExp` pattern(s) to match against projects' `projectInterface`s (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if they should absolutely not be included even if they match with `includeProjectInterfaces`.\n\nIf this is one string, it will be matched against `projectInterface`s. If this is an array, each entry is handled based on its type (at least one entry must match for this filter condition to exclude the project):\n\n- If the entry is a string, it will be matched against each `projectInterface`. If any match, the project will pass this filter condition and exclude the project\n- If the entry is an array of strings, each will be matched against each `projectInterface`. If every string matches against at least one `projectInterface`, the project will pass this filter condition and exclude the project\n\nIn other words, each entry in the first-level array is `OR`'ed together. Each entry in second-level arrays (arrays within the first-level array) are `AND`'ed together.\n\nDefaults to no {@link ProjectInterfaces}, so all projects that match `includeProjectInterfaces` will be included\n\n@example\n\n```typescript\nexcludeProjectInterfaces: ['one', ['two', 'three']];\n```\n\nThis filter condition will succeed and exclude projects whose `projectInterface`s fulfill at least one of the following conditions (At least one entry in the array must match):\n\n- Include `one`\n- Include both `two` and `three`.",anyOf:[{type:"null"},{type:"string"},{type:"array",items:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}}]},includePdpFactoryIds:{description:"String representation of `RegExp` pattern(s) to match against the Project Data Provider Factory Ids that provided each project's metadata (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if the projects should be included.\n\nDefaults to all Project Data Provider Factory Ids, so all projects that do not match `excludePdpFactoryIds` will be included",anyOf:[{type:"null"},{type:"string"},{type:"array",items:{type:"string"}}]},excludePdpFactoryIds:{description:"String representation of `RegExp` pattern(s) to match against the Project Data Provider Factory Ids that provided each project's metadata (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if the projects should absolutely not be included even if they match with `includeProjectInterfaces`.\n\nDefaults to none, so all projects that match `includePdpFactoryIds` will be included",anyOf:[{type:"null"},{type:"string"},{type:"array",items:{type:"string"}}]}}},settingsContribution:{description:"The data an extension provides to inform Platform.Bible of the settings it provides",anyOf:[{$ref:"#/$defs/settingsGroup"},{type:"array",items:{$ref:"#/$defs/settingsGroup"}}]},settingsGroup:{description:"Group of related settings definitions",type:"object",properties:{label:{description:"localizeKey that displays in the settings dialog as the group name",$ref:"#/$defs/localizeKey"},description:{description:"localizeKey that displays in the settings dialog to describe the group",$ref:"#/$defs/localizeKey"},properties:{$ref:"#/$defs/settingProperties"}},required:["label","properties"]},settingProperties:{description:"Object whose keys are setting IDs and whose values are settings objects",type:"object",patternProperties:{"^[\\w-]+\\.[\\w-]+$":{$ref:"#/$defs/setting"}},additionalProperties:!1},setting:{description:"A description of an extension's setting entry",anyOf:[{$ref:"#/$defs/extensionControlledSetting"}]},extensionControlledSetting:{description:"Setting definition that is validated by the extension.",allOf:[{$ref:"#/$defs/settingBase"},{$ref:"#/$defs/modifierExtensionControlled"}]},settingBase:{description:"Base information needed to describe a setting entry",allOf:[{$ref:"#/$defs/stateBase"},{type:"object",properties:{label:{description:"localizeKey that displays in the settings dialog as the setting name",$ref:"#/$defs/localizeKey"},description:{description:"localizeKey that displays in the settings dialog to describe the setting",$ref:"#/$defs/localizeKey"}},required:["label"]}]},projectStateContribution:{description:"The data an extension provides to inform Platform.Bible of the project state it provides",$ref:"#/$defs/userStateProperties"},userStateContribution:{description:"The data an extension provides to inform Platform.Bible of the user state it provides",$ref:"#/$defs/userStateProperties"},userStateProperties:{description:"Object whose keys are state IDs and whose values are state objects",type:"object",patternProperties:{"^[\\w\\-]+\\.[\\w\\-]+$":{$ref:"#/$defs/userState"}},additionalProperties:!1},userState:{description:"A description of an extension's user state entry",anyOf:[{$ref:"#/$defs/extensionControlledState"}]},extensionControlledState:{description:"State definition that is validated by the extension.",allOf:[{$ref:"#/$defs/stateBase"},{$ref:"#/$defs/modifierExtensionControlled"}]},modifierExtensionControlled:{description:'Modifies state/setting type to be extension-controlled. "Extension-controlled" means the extension provides the component and the validator for the state/setting, so the state/setting is controlled by the extension.',not:{anyOf:[{type:"object",required:["platformType"]},{type:"object",required:["type"]}]}},stateBase:{description:"Base information needed to describe a state entry",type:"object",properties:{default:{description:"default value for the state/setting",type:"any"},derivesFrom:{description:"a state/setting ID whose value to set to this state/setting's starting value the first time this state/setting is loaded",$ref:"#/$defs/id"}},required:["default"]},localizeKey:{description:"Identifier for a string that will be localized based on the user's UI language",type:"string",pattern:"^%[\\w\\-\\.]+%$",tsType:"LocalizeKey"},id:{description:"",type:"string",pattern:"^[\\w\\-]+\\.[\\w\\-]+$",tsType:"Id"}};function tr(e){e&&Object.values(e).forEach(t=>{if(t.type){if("tsType"in t&&delete t.tsType,t.type==="any"){delete t.type;return}t.type==="object"&&tr(t.properties)}})}tr(er);const Rn={$schema:"https://json-schema.org/draft/2020-12/schema",title:"Project Settings Contribution",description:"The data an extension provides to inform Platform.Bible of the project settings it provides",anyOf:[{$ref:"#/$defs/projectSettingsGroup"},{type:"array",items:{$ref:"#/$defs/projectSettingsGroup"}}],$defs:er};Object.freeze(Rn);const Bn={$schema:"https://json-schema.org/draft/2020-12/schema",title:"Settings Contribution",description:"The data an extension provides to inform Platform.Bible of the settings it provides",anyOf:[{$ref:"#/$defs/settingsGroup"},{type:"array",items:{$ref:"#/$defs/settingsGroup"}}],$defs:er};Object.freeze(Bn);const xn={languageStrings:{description:"Map whose keys are localized string keys and whose values provide information about how to localize strings for the localized string key",type:"object",patternProperties:{"^%[\\w\\-\\.]+%$":{$ref:"#/$defs/localizedStringValue"}},additionalProperties:!1},localizedStringValue:{description:"Localized string value associated with this key",type:"string"},stringsMetadata:{description:"Map whose keys are localized string keys and whose values provide additional non-locale-specific information about the localized string key",type:"object",patternProperties:{"^%[\\w\\-\\.]+%$":{$ref:"#/$defs/stringMetadata"}},additionalProperties:!1},stringMetadata:{description:"Additional non-locale-specific information about a localized string key",type:"object",properties:{fallbackKey:{description:"Localized string key from which to get this value if one does not exist in the specified language. If a new key/value pair needs to be made to replace an existing one, this could help smooth over the transition if the meanings are close enough.\nYou can use Paratext 9 Localized String Keys here. Be sure to escape any % signs with a backslash `\\`.",type:"string",pattern:"^%[\\w\\-\\.;&,' (){}#:/\\\\?%⋮|[\\]“”‘’!~* +=•`…​↑↓]+%$",tsType:"LocalizeKey"},notes:{description:"Additional information provided by developers in English to help the translator to know how to translate this localized string accurately",type:"string"}}},localizeKey:{description:"Identifier for a string that will be localized based on the user's UI language",type:"string",pattern:"^%[\\w\\-\\.]+%$",tsType:"LocalizeKey"}};tr(xn);const Mn={$schema:"https://json-schema.org/draft/2020-12/schema",title:"Localized String Data Contribution",description:"The data an extension provides to inform Platform.Bible of the localized strings it provides.",type:"object",properties:{metadata:{$ref:"#/$defs/stringsMetadata"},localizedStrings:{type:"object",additionalProperties:{$ref:"#/$defs/languageStrings"}}},$defs:xn};Object.freeze(Mn);const _n={title:"Platform.Bible menus",type:"object",properties:{mainMenu:{description:"Top level menu for the application",$ref:"#/$defs/multiColumnMenu"},defaultWebViewTopMenu:{description:"Default top menu for web views that don't specify their own",$ref:"#/$defs/multiColumnMenu"},defaultWebViewContextMenu:{description:"Default context menu for web views that don't specify their own",$ref:"#/$defs/singleColumnMenu"},webViewMenus:{description:"Menus that apply per web view in the application",type:"object",patternProperties:{"^[\\w\\-]+\\.[\\w\\-]+$":{$ref:"#/$defs/menusForOneWebView"}},additionalProperties:!1}},required:["mainMenu","defaultWebViewTopMenu","defaultWebViewContextMenu","webViewMenus"],additionalProperties:!1,$defs:{localizeKey:{description:"Identifier for a string that will be localized in a menu based on the user's UI language",type:"string",pattern:"^%[\\w\\-\\.]+%$"},referencedItem:{description:"Name of some UI element (i.e., tab, column, group, menu item) or some PAPI object (i.e., command)",type:"string",pattern:"^[\\w\\-]+\\.[\\w\\-]+$"},columnsWithHeaders:{description:"Group of columns that can be combined with other columns to form a multi-column menu",type:"object",patternProperties:{"^[\\w\\-]+\\.[\\w\\-]+$":{description:"Single column with a header string",type:"object",properties:{label:{description:"Header text for this this column in the UI",$ref:"#/$defs/localizeKey"},localizeNotes:{description:"Additional information provided by developers to help people who perform localization",type:"string"},order:{description:"Relative order of this column compared to other columns (sorted ascending)",type:"number"},isExtensible:{description:"Defines whether contributions are allowed to add menu groups to this column",type:"boolean"}},required:["label","order"],additionalProperties:!1}},properties:{isExtensible:{description:"Defines whether contributions are allowed to add columns to this multi-column menu",type:"boolean"}}},menuGroups:{description:"Group of menu items that can be combined with other groups to form a single menu/submenu. Groups are separated using a line within the menu/submenu.",type:"object",patternProperties:{"^[\\w\\-]+\\.[\\w\\-]+$":{description:"Single group that contains menu items",type:"object",oneOf:[{properties:{column:{description:"Column where this group belongs, not required for single column menus",$ref:"#/$defs/referencedItem"},order:{description:"Relative order of this group compared to other groups in the same column or submenu (sorted ascending)",type:"number"},isExtensible:{description:"Defines whether contributions are allowed to add menu items to this menu group",type:"boolean"}},required:["order"],additionalProperties:!1},{properties:{menuItem:{description:"Menu item that anchors the submenu where this group belongs",$ref:"#/$defs/referencedItem"},order:{description:"Relative order of this group compared to other groups in the same column or submenu (sorted ascending)",type:"number"},isExtensible:{description:"Defines whether contributions are allowed to add menu items to this menu group",type:"boolean"}},required:["menuItem","order"],additionalProperties:!1}]}},additionalProperties:!1},menuItem:{description:"Single item in a menu that can be clicked on to take an action or can be the parent of a submenu",type:"object",oneOf:[{properties:{id:{description:"ID for this menu item that holds a submenu",$ref:"#/$defs/referencedItem"}},required:["id"]},{properties:{command:{description:"Name of the PAPI command to run when this menu item is selected.",$ref:"#/$defs/referencedItem"},iconPathBefore:{description:"Uri path to the icon to display before the menu text. Ex: `papi-extension://helloWorld/assets/icon.png`",type:"string"},iconPathAfter:{description:"Uri path to the icon to display after the menu text. Ex: `papi-extension://helloWorld/assets/icon.png`",type:"string"}},required:["command"]}],properties:{label:{description:"Key that represents the text of this menu item to display",$ref:"#/$defs/localizeKey"},tooltip:{description:"Key that represents the text to display if a mouse pointer hovers over the menu item",$ref:"#/$defs/localizeKey"},searchTerms:{description:"Key that represents additional words the platform should reference when users are searching for menu items",$ref:"#/$defs/localizeKey"},localizeNotes:{description:"Additional information provided by developers to help people who perform localization",type:"string"},group:{description:"Group to which this menu item belongs",$ref:"#/$defs/referencedItem"},order:{description:"Relative order of this menu item compared to other menu items in the same group (sorted ascending)",type:"number"}},required:["label","group","order"],unevaluatedProperties:!1},groupsAndItems:{description:"Core schema for a column",type:"object",properties:{groups:{description:"Groups that belong in this menu",$ref:"#/$defs/menuGroups"},items:{description:"List of menu items that belong in this menu",type:"array",items:{$ref:"#/$defs/menuItem"},uniqueItems:!0}},required:["groups","items"]},singleColumnMenu:{description:"Menu that contains a column without a header",type:"object",allOf:[{$ref:"#/$defs/groupsAndItems"}],unevaluatedProperties:!1},multiColumnMenu:{description:"Menu that can contain multiple columns with headers",type:"object",allOf:[{$ref:"#/$defs/groupsAndItems"},{properties:{columns:{description:"Columns that belong in this menu",$ref:"#/$defs/columnsWithHeaders"}},required:["columns"]}],unevaluatedProperties:!1},menusForOneWebView:{description:"Set of menus that are associated with a single tab",type:"object",properties:{includeDefaults:{description:"Indicates whether the platform default menus should be included for this webview",type:"boolean"},topMenu:{description:"Menu that opens when you click on the top left corner of a tab",$ref:"#/$defs/multiColumnMenu"},contextMenu:{description:"Menu that opens when you right click on the main body/area of a tab",$ref:"#/$defs/singleColumnMenu"}},additionalProperties:!1}}};Object.freeze(_n);var B={};function io(e,t,r){if(r===void 0&&(r=Array.prototype),e&&typeof r.find=="function")return r.find.call(e,t);for(var n=0;n-1}var mo=Le({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});B.assign=oo;B.find=io;B.freeze=Le;B.HTML_BOOLEAN_ATTRIBUTES=Fn;B.HTML_RAW_TEXT_ELEMENTS=Ze;B.HTML_VOID_ELEMENTS=Ln;B.hasDefaultHTMLNamespace=fo;B.hasOwn=Ae;B.isHTMLBooleanAttribute=ao;B.isHTMLRawTextElement=co;B.isHTMLEscapableRawTextElement=lo;B.isHTMLMimeType=Pn;B.isHTMLVoidElement=so;B.isValidMimeType=ho;B.MIME_TYPE=et;B.NAMESPACE=mo;var Ne={},Eo=B;function kn(e,t){e.prototype=Object.create(Error.prototype,{constructor:{value:e},name:{value:e.name,enumerable:!0,writable:t}})}var tt=Eo.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),qn=Object.keys(tt);function $n(e){return typeof e=="number"&&e>=1&&e<=25}function go(e){return typeof e=="string"&&e.substring(e.length-tt.Error.length)===tt.Error}function st(e,t){$n(e)?(this.name=qn[e],this.message=t||""):(this.message=e,this.name=go(t)?t:tt.Error),Error.captureStackTrace&&Error.captureStackTrace(this,st)}kn(st,!0);Object.defineProperties(st.prototype,{code:{enumerable:!0,get:function(){var e=qn.indexOf(this.name);return $n(e)?e:0}}});var jn={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},kt=Object.entries(jn);for(var Et=0;Et/),xr=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,yt=d('"',xr,'*"',"|","'",Re(xr,"'"),"*'"),Vn="",Ro=g(Vn,d(Re(ge,"-"),"|",g("-",Re(ge,"-"))),"*",Hn),Mr="#PCDATA",Bo=d(g(/\(/,O,Mr,d(O,/\|/,O,lt),"*",O,/\)\*/),"|",g(/\(/,O,Mr,O,/\)/)),xo=/[?*+]?/,Mo=g(/\([^>]+\)/,xo),_o=d("EMPTY","|","ANY","|",Bo,"|",Mo),Fo=""),Po=g("NOTATION",C,/\(/,O,X,d(O,/\|/,O,X),"*",O,/\)/),ko=g(/\(/,O,Rr,d(O,/\|/,O,Rr),"*",O,/\)/),qo=d(Po,"|",ko),$o=d(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",qo),jo=d(/#REQUIRED|#IMPLIED/,"|",d(d("#FIXED",C),"?",Co)),Uo=d(C,X,C,$o,C,jo),Vo=""),or="SYSTEM",Ct="PUBLIC",Tt=d(d(or,C,it),"|",d(Ct,C,yt,C,it)),Go=g("^",d(d(or,C,"(?",it,")"),"|",d(Ct,C,"(?",yt,")",C,"(?",it,")"))),zo=d(C,"NDATA",C,X),Jo=d(ir,"|",d(Tt,zo,"?")),Gn=""),Yo=d(ir,"|",Tt),Ko=g(Gn,C,"%",C,X,C,Yo,O,">"),Wo=d(Xo,"|",Ko),Qo=g(Ct,C,yt),Zo=g(""),ar=g(O,"=",O),_r=/1[.]\d+/,ea=g(C,"version",ar,d("'",_r,"'","|",'"',_r,'"')),Fr=/[A-Za-z][-A-Za-z0-9._]*/,ta=d(C,"encoding",ar,d('"',Fr,'"',"|","'",Fr,"'")),ra=d(C,"standalone",ar,d("'",d("yes","|","no"),"'","|",'"',d("yes","|","no"),'"')),na=g(/^<\?xml/,ea,ta,"?",ra,"?",O,/\?>/),ua="",aa=//,ca=g(ge,"*?",sa),la=g(aa,ca);E.chars=Ee;E.chars_without=Re;E.detectUnicodeSupport=Un;E.reg=g;E.regg=d;E.AttlistDecl=Ho;E.CDATA_START=ia;E.CDATA_END=oa;E.CDSect=la;E.Char=ge;E.Comment=Ro;E.COMMENT_START=Vn;E.COMMENT_END=Hn;E.DOCTYPE_DECL_START=ua;E.elementdecl=Lo;E.EntityDecl=Wo;E.EntityValue=ir;E.ExternalID=Tt;E.ExternalID_match=Go;E.Name=X;E.NotationDecl=Zo;E.Reference=nt;E.PEReference=ut;E.PI=Io;E.PUBLIC=Ct;E.PubidLiteral=yt;E.QName=lt;E.QName_exact=So;E.QName_group=Oo;E.S=C;E.SChar_s=Ao;E.S_OPT=O;E.SYSTEM=or;E.SystemLiteral=it;E.UNICODE_REPLACEMENT_CHARACTER=vo;E.UNICODE_SUPPORT=ct;E.XMLDecl=na;var J=B,ee=J.find,fa=J.hasDefaultHTMLNamespace,Be=J.hasOwn,pa=J.isHTMLMimeType,ha=J.isHTMLRawTextElement,da=J.isHTMLVoidElement,Ke=J.MIME_TYPE,te=J.NAMESPACE,k=Symbol(),zn=Ne,h=zn.DOMException,ma=zn.DOMExceptionName,Q=E;function q(e){if(e!==k)throw new TypeError("Illegal constructor")}function Ea(e){return e!==""}function ga(e){return e?e.split(/[\t\n\f\r ]+/).filter(Ea):[]}function Da(e,t){return Be(e,t)||(e[t]=!0),e}function Lr(e){if(!e)return[];var t=ga(e);return Object.keys(t.reduce(Da,{}))}function va(e){return function(t){return e&&e.indexOf(t)!==-1}}function Jn(e){if(!Q.QName_exact.test(e))throw new h(h.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+e+'"')}function Gt(e,t){Jn(t),e=e||null;var r=null,n=t;if(t.indexOf(":")>=0){var u=t.split(":");r=u[0],n=u[1]}if(r!==null&&e===null)throw new h(h.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(r==="xml"&&e!==J.NAMESPACE.XML)throw new h(h.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((r==="xmlns"||t==="xmlns")&&e!==J.NAMESPACE.XMLNS)throw new h(h.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(e===J.NAMESPACE.XMLNS&&r!=="xmlns"&&t!=="xmlns")throw new h(h.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[e,r,n]}function Pe(e,t){for(var r in e)Be(e,r)&&(t[r]=e[r])}function $(e,t){var r=e.prototype;if(!(r instanceof t)){let n=function(){};n.prototype=t.prototype,n=new n,Pe(r,n),e.prototype=r=n}r.constructor!=e&&(typeof e!="function"&&console.error("unknown Class:"+e),r.constructor=e)}var j={},Y=j.ELEMENT_NODE=1,xe=j.ATTRIBUTE_NODE=2,vt=j.TEXT_NODE=3,Xn=j.CDATA_SECTION_NODE=4,Yn=j.ENTITY_REFERENCE_NODE=5,Aa=j.ENTITY_NODE=6,Kn=j.PROCESSING_INSTRUCTION_NODE=7,Wn=j.COMMENT_NODE=8,ot=j.DOCUMENT_NODE=9,Qn=j.DOCUMENT_TYPE_NODE=10,se=j.DOCUMENT_FRAGMENT_NODE=11,Na=j.NOTATION_NODE=12,F=J.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function Pr(e){for(var t=[];e.parentNode||e.ownerElement;)e=e.parentNode||e.ownerElement,t.unshift(e);return t}function Zn(e,t){if(t.length=0&&e=0){for(var u=t.length-1;n<=u;)t[n]=t[++n];if(t.length=u,e){var i=e.ownerDocument;i&&nu(i,e,r),r.ownerElement=null}}}Me.prototype={length:0,item:M.prototype.item,getNamedItem:function(e){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());for(var t=0;tkr(t.ownerDocument)?F.DOCUMENT_POSITION_FOLLOWING:F.DOCUMENT_POSITION_PRECEDING);var o=Pr(t),s=Pr(r);if(!n&&s.indexOf(t)>=0||u&&t===r)return F.DOCUMENT_POSITION_CONTAINS+F.DOCUMENT_POSITION_PRECEDING;if(!u&&o.indexOf(r)>=0||n&&t===r)return F.DOCUMENT_POSITION_CONTAINED_BY+F.DOCUMENT_POSITION_FOLLOWING;var c=Zn(s,o);for(var l in c.childNodes){var f=c.childNodes[l];if(f===r)return F.DOCUMENT_POSITION_FOLLOWING;if(f===t)return F.DOCUMENT_POSITION_PRECEDING;if(s.indexOf(f)>=0)return F.DOCUMENT_POSITION_FOLLOWING;if(o.indexOf(f)>=0)return F.DOCUMENT_POSITION_PRECEDING}return 0}};function ru(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}Pe(j,A);Pe(j,A.prototype);Pe(F,A);Pe(F,A.prototype);function Qe(e,t){if(t(e))return!0;if(e=e.firstChild)do if(Qe(e,t))return!0;while(e=e.nextSibling)}function ce(e,t){q(e);var r=t||{};this.ownerDocument=this,this.contentType=r.contentType||Ke.XML_APPLICATION,this.type=pa(this.contentType)?"html":"xml"}function ya(e,t,r){e&&e._inc++;var n=r.namespaceURI;n===te.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}function nu(e,t,r,n){e&&e._inc++;var u=r.namespaceURI;u===te.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function uu(e,t,r){if(e&&e._inc){e._inc++;var n=t.childNodes;if(r&&!r.nextSibling)n[n.length++]=r;else{for(var u=t.firstChild,i=0;u;)n[i++]=u,u=u.nextSibling;n.length=i,delete n[n.length]}}}function iu(e,t){if(e!==t.parentNode)throw new h(h.NOT_FOUND_ERR,"child's parent is not parent");var r=t.previousSibling,n=t.nextSibling;return r?r.nextSibling=n:e.firstChild=n,n?n.previousSibling=r:e.lastChild=r,uu(e.ownerDocument,e),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}function Ca(e){return e&&(e.nodeType===A.DOCUMENT_NODE||e.nodeType===A.DOCUMENT_FRAGMENT_NODE||e.nodeType===A.ELEMENT_NODE)}function Ta(e){return e&&(e.nodeType===A.CDATA_SECTION_NODE||e.nodeType===A.COMMENT_NODE||e.nodeType===A.DOCUMENT_FRAGMENT_NODE||e.nodeType===A.DOCUMENT_TYPE_NODE||e.nodeType===A.ELEMENT_NODE||e.nodeType===A.PROCESSING_INSTRUCTION_NODE||e.nodeType===A.TEXT_NODE)}function le(e){return e&&e.nodeType===A.DOCUMENT_TYPE_NODE}function ue(e){return e&&e.nodeType===A.ELEMENT_NODE}function ou(e){return e&&e.nodeType===A.TEXT_NODE}function $r(e,t){var r=e.childNodes||[];if(ee(r,ue)||le(t))return!1;var n=ee(r,le);return!(t&&n&&r.indexOf(n)>r.indexOf(t))}function jr(e,t){var r=e.childNodes||[];function n(i){return ue(i)&&i!==t}if(ee(r,n))return!1;var u=ee(r,le);return!(t&&u&&r.indexOf(u)>r.indexOf(t))}function wa(e,t,r){if(!Ca(e))throw new h(h.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new h(h.NOT_FOUND_ERR,"child not in parent");if(!Ta(t)||le(t)&&e.nodeType!==A.DOCUMENT_NODE)throw new h(h.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Sa(e,t,r){var n=e.childNodes||[],u=t.childNodes||[];if(t.nodeType===A.DOCUMENT_FRAGMENT_NODE){var i=u.filter(ue);if(i.length>1||ee(u,ou))throw new h(h.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!$r(e,r))throw new h(h.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ue(t)&&!$r(e,r))throw new h(h.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(le(t)){if(ee(n,le))throw new h(h.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=ee(n,ue);if(r&&n.indexOf(a)1||ee(u,ou))throw new h(h.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!jr(e,r))throw new h(h.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ue(t)&&!jr(e,r))throw new h(h.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(le(t)){if(ee(n,function(s){return le(s)&&s!==r}))throw new h(h.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=ee(n,ue);if(r&&n.indexOf(a)0&&Qe(r,function(u){if(u!==r&&u.nodeType===Y){var i=u.getAttribute("class");if(i){var a=e===i;if(!a){var o=Lr(i);a=t.every(va(o))}a&&n.push(u)}}}),n})},getElementsByTagName:function(e){var t=(this.nodeType===ot?this:this.ownerDocument).type==="html",r=e.toLowerCase();return new de(this,function(n){var u=[];return Qe(n,function(i){if(!(i===n||i.nodeType!==Y))if(e==="*")u.push(i);else{var a=i.getQualifiedName(),o=t&&i.namespaceURI===te.HTML?r:e;a===o&&u.push(i)}}),u})},getElementsByTagNameNS:function(e,t){return new de(this,function(r){var n=[];return Qe(r,function(u){u!==r&&u.nodeType===Y&&(e==="*"||u.namespaceURI===e)&&(t==="*"||u.localName==t)&&n.push(u)}),n})}};ce.prototype.getElementsByClassName=fe.prototype.getElementsByClassName;ce.prototype.getElementsByTagName=fe.prototype.getElementsByTagName;ce.prototype.getElementsByTagNameNS=fe.prototype.getElementsByTagNameNS;$(fe,A);function De(e){q(e),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}De.prototype.nodeType=xe;$(De,A);function ke(e){q(e)}ke.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){var n=this.data.substring(0,e),u=this.data.substring(e+t);r=n+r+u,this.nodeValue=this.data=r,this.length=r.length}};$(ke,A);function ft(e){q(e)}ft.prototype={nodeName:"#text",nodeType:vt,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};$(ft,ke);function St(e){q(e)}St.prototype={nodeName:"#comment",nodeType:Wn};$(St,ke);function Ot(e){q(e)}Ot.prototype={nodeName:"#cdata-section",nodeType:Xn};$(Ot,ft);function It(e){q(e)}It.prototype.nodeType=Qn;$(It,A);function sr(e){q(e)}sr.prototype.nodeType=Na;$(sr,A);function cr(e){q(e)}cr.prototype.nodeType=Aa;$(cr,A);function Rt(e){q(e)}Rt.prototype.nodeType=Yn;$(Rt,A);function pt(e){q(e)}pt.prototype.nodeName="#document-fragment";pt.prototype.nodeType=se;$(pt,A);function Bt(e){q(e)}Bt.prototype.nodeType=Kn;$(Bt,ke);function su(){}su.prototype.serializeToString=function(e,t){return cu.call(e,t)};A.prototype.toString=cu;function cu(e){var t=[],r=this.nodeType===ot&&this.documentElement||this,n=r.prefix,u=r.namespaceURI;if(u&&n==null){var n=r.lookupPrefix(u);if(n==null)var i=[{namespace:u,prefix:null}]}return Se(this,t,e,i),t.join("")}function Ur(e,t,r){var n=e.prefix||"",u=e.namespaceURI;if(!u||n==="xml"&&u===te.XML||u===te.XMLNS)return!1;for(var i=r.length;i--;){var a=r[i];if(a.prefix===n)return a.namespace!==u}return!0}function qt(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,ru),'"')}function Se(e,t,r,n){n||(n=[]);var u=e.nodeType===ot?e:e.ownerDocument,i=u.type==="html";if(r)if(e=r(e),e){if(typeof e=="string"){t.push(e);return}}else return;switch(e.nodeType){case Y:var a=e.attributes,o=a.length,R=e.firstChild,s=e.tagName,c=s;if(!i&&!e.prefix&&e.namespaceURI){for(var l,f=0;f=0;p--){var m=n[p];if(m.prefix===""&&m.namespace===e.namespaceURI){l=m.namespace;break}}if(l!==e.namespaceURI)for(var p=n.length-1;p>=0;p--){var m=n[p];if(m.namespace===e.namespaceURI){m.prefix&&(c=m.prefix+":"+s);break}}}t.push("<",c);for(var b=0;b");else{if(t.push(">"),i&&ha(s))for(;R;)R.data?t.push(R.data):Se(R,t,r,n.slice()),R=R.nextSibling;else for(;R;)Se(R,t,r,n.slice()),R=R.nextSibling;t.push("")}return;case ot:case se:for(var R=e.firstChild;R;)Se(R,t,r,n.slice()),R=R.nextSibling;return;case xe:return qt(t,e.name,e.value);case vt:return t.push(e.data.replace(/[<&>]/g,ru));case Xn:return t.push(Q.CDATA_START,e.data,Q.CDATA_END);case Wn:return t.push(Q.COMMENT_START,e.data,Q.COMMENT_END);case Qn:var K=e.publicId,U=e.systemId;t.push(Q.DOCTYPE_DECL_START," ",e.name),K?(t.push(" ",Q.PUBLIC," ",K),U&&U!=="."&&t.push(" ",U)):U&&U!=="."&&t.push(" ",Q.SYSTEM," ",U),e.internalSubset&&t.push(" [",e.internalSubset,"]"),t.push(">");return;case Kn:return t.push("");case Yn:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function lu(e,t,r){var n;switch(t.nodeType){case Y:n=t.cloneNode(!1),n.ownerDocument=e;case se:break;case xe:r=!0;break}if(n||(n=t.cloneNode(!1)),n.ownerDocument=e,n.parentNode=null,r)for(var u=t.firstChild;u;)n.appendChild(lu(e,u,r)),u=u.nextSibling;return n}function zt(e,t,r){var n=new t.constructor(k);for(var u in t)if(Be(t,u)){var i=t[u];typeof i!="object"&&i!=n[u]&&(n[u]=i)}switch(t.childNodes&&(n.childNodes=new M),n.ownerDocument=e,n.nodeType){case Y:var a=t.attributes,o=n.attributes=new Me,s=a.length;o._ownerElement=n;for(var c=0;c",lt:"<",quot:'"'}),e.HTML_ENTITIES=t({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:` +`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),e.entityMap=e.HTML_ENTITIES})(pu);var xt={},qe=B,v=E,hu=Ne,Oa=qe.isHTMLEscapableRawTextElement,Ia=qe.isHTMLMimeType,Ra=qe.isHTMLRawTextElement,at=qe.hasOwn,Vr=qe.NAMESPACE,Hr=hu.ParseError,Ba=hu.DOMException,Ge=0,ie=1,ye=2,ze=3,Ce=4,Te=5,Je=6,gt=7;function du(){}du.prototype={parse:function(e,t,r){var n=this.domBuilder;n.startDocument(),mu(t,t=Object.create(null)),xa(e,t,r,n,this.errorHandler),n.endDocument()}};var lr=/&#?\w+;?/g;function xa(e,t,r,n,u){var i=Ia(n.mimeType);if(e.indexOf(v.UNICODE_REPLACEMENT_CHARACTER)>=0)return u.fatalError("Unicode replacement character detected, source encoding issues?");function a(y){if(y>65535){y-=65536;var z=55296+(y>>10),ht=56320+(y&1023);return String.fromCharCode(z,ht)}else return String.fromCharCode(y)}function o(y){var z=y[y.length-1]===";"?y:y+";";if(!i&&z!==y)return u.error("EntityRef: expecting ;"),y;var ht=v.Reference.exec(z);if(!ht||ht[0].length!==z.length)return u.error("entity not matching Reference production: "+y),y;var dt=z.slice(1,-1);return at(r,dt)?r[dt]:dt.charAt(0)==="#"?a(parseInt(dt.substr(1).replace("x","0x"))):(u.error("entity not found:"+y),y)}function s(y){if(y>w){var z=e.substring(w,y).replace(lr,o);m&&c(w),n.characters(z,0,y-w),w=y}}function c(y,z){for(;y>=f&&(z=p.exec(e));)l=z.index,f=l+z[0].length,m.lineNumber++;m.columnNumber=y-l+1}for(var l=0,f=0,p=/.*(?:\r\n?|\n)|.*$/g,m=n.locator,b=[{currentNSMap:t}],T=[],w=0;;){try{var I=e.indexOf("<",w);if(I<0){if(!i&&T.length>0)return u.fatalError("unclosed xml tag(s): "+T.join(", "));if(!e.substring(w).match(/^\s*$/)){var re=n.doc,R=re.createTextNode(e.substr(w));if(re.documentElement)return u.error("Extra content at the end of the document");re.appendChild(R),n.currentElement=R}return}if(I>w){var K=e.substring(w,I);!i&&T.length===0&&(K=K.replace(new RegExp(v.S_OPT.source,"g"),""),K&&u.error("Unexpected content outside root element: '"+K+"'")),s(I)}switch(e.charAt(I+1)){case"/":var H=e.indexOf(">",I+2),U=e.substring(I+2,H>0?H:void 0);if(!U)return u.fatalError("end tag name missing");var je=H>0&&v.reg("^",v.QName_group,v.S_OPT,"$").exec(U);if(!je)return u.fatalError('end tag name contains invalid characters: "'+U+'"');if(!n.currentElement&&!n.doc.documentElement)return;var Ue=T[T.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(Ue!==je[1]){var Mt=je[1].toLowerCase();if(!i||Ue.toLowerCase()!==Mt)return u.fatalError('Opening and ending tag mismatch: "'+Ue+'" != "'+U+'"')}var _t=b.pop();T.pop();var Ft=_t.localNSMap;if(n.endElement(_t.uri,_t.localName,Ue),Ft)for(var pr in Ft)at(Ft,pr)&&n.endPrefixMapping(pr);H++;break;case"?":m&&c(I),H=La(e,I,n,u);break;case"!":m&&c(I),H=gu(e,I,n,u,i);break;default:m&&c(I);var V=new Du,Lt=b[b.length-1].currentNSMap,H=Ma(e,I,V,Lt,o,u,i),hr=V.length;if(V.closed||(i&&qe.isHTMLVoidElement(V.tagName)?V.closed=!0:T.push(V.tagName)),m&&hr){for(var Au=Gr(m,{}),Pt=0;Ptw?w=H:s(Math.max(I,w)+1)}}function Gr(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Ma(e,t,r,n,u,i,a){function o(m,b,T){if(at(r.attributeNames,m))return i.fatalError("Attribute "+m+" redefined");if(!a&&b.indexOf("<")>=0)return i.fatalError("Unescaped '<' not allowed in attributes values");r.addValue(m,b.replace(/[\t\n\r]/g," ").replace(lr,u),T)}for(var s,c,l=++t,f=Ge;;){var p=e.charAt(l);switch(p){case"=":if(f===ie)s=e.slice(t,l),f=ze;else if(f===ye)f=ze;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(f===ze||f===ie)if(f===ie&&(i.warning('attribute value must after "="'),s=e.slice(t,l)),t=l+1,l=e.indexOf(p,t),l>0)c=e.slice(t,l),o(s,c,t-1),f=Te;else throw new Error("attribute value no end '"+p+"' match");else if(f==Ce)c=e.slice(t,l),o(s,c,t),i.warning('attribute "'+s+'" missed start quot('+p+")!!"),t=l+1,f=Te;else throw new Error('attribute value must after "="');break;case"/":switch(f){case Ge:r.setTagName(e.slice(t,l));case Te:case Je:case gt:f=gt,r.closed=!0;case Ce:case ie:break;case ye:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return i.error("unexpected end of input"),f==Ge&&r.setTagName(e.slice(t,l)),l;case">":switch(f){case Ge:r.setTagName(e.slice(t,l));case Te:case Je:case gt:break;case Ce:case ie:c=e.slice(t,l),c.slice(-1)==="/"&&(r.closed=!0,c=c.slice(0,-1));case ye:f===ye&&(c=s),f==Ce?(i.warning('attribute "'+c+'" missed quot(")!'),o(s,c,t)):(a||i.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),o(c,c,t));break;case ze:if(!a)return i.fatalError(`AttValue: ' or " expected`)}return l;case"€":p=" ";default:if(p<=" ")switch(f){case Ge:r.setTagName(e.slice(t,l)),f=Je;break;case ie:s=e.slice(t,l),f=ye;break;case Ce:var c=e.slice(t,l);i.warning('attribute "'+c+'" missed quot(")!!'),o(s,c,t);case Te:f=Je;break}else switch(f){case ye:a||i.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),o(s,s,t),t=l,f=ie;break;case Te:i.warning('attribute space is required"'+s+'"!!');case Je:f=ie,t=l;break;case ze:f=Ce,t=l;break;case gt:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function zr(e,t,r){for(var n=e.tagName,u=null,f=e.length;f--;){var i=e[f],a=i.qName,o=i.value,p=a.indexOf(":");if(p>0)var s=i.prefix=a.slice(0,p),c=a.slice(p+1),l=s==="xmlns"&&c;else c=a,s=null,l=a==="xmlns"&&"";i.localName=c,l!==!1&&(u==null&&(u=Object.create(null),mu(r,r=Object.create(null))),r[l]=u[l]=o,i.uri=Vr.XMLNS,t.startPrefixMapping(l,o))}for(var f=e.length;f--;)i=e[f],i.prefix&&(i.prefix==="xml"&&(i.uri=Vr.XML),i.prefix!=="xmlns"&&(i.uri=r[i.prefix]));var p=n.indexOf(":");p>0?(s=e.prefix=n.slice(0,p),c=e.localName=n.slice(p+1)):(s=null,c=e.localName=n);var m=e.uri=r[s||""];if(t.startElement(m,c,n,e),e.closed){if(t.endElement(m,c,n),u)for(s in u)at(u,s)&&t.endPrefixMapping(s)}else return e.currentNSMap=r,e.localNSMap=u,!0}function _a(e,t,r,n,u){var i=Oa(r);if(i||Ra(r)){var a=e.indexOf("",t),o=e.substring(t+1,a);return i&&(o=o.replace(lr,n)),u.characters(o,0,o.length),a}return t+1}function mu(e,t){for(var r in e)at(e,r)&&(t[r]=e[r])}function Eu(e,t){var r=t;function n(c){return c=c||0,e.charAt(r+c)}function u(c){c=c||1,r+=c}function i(){for(var c=0;r"?n.fatalError("doctype not terminated with > at position "+i.getIndex()):(i.skip(1),r.startDTD(s.name,s.publicId,s.systemId,s.internalSubset),r.endDTD(),i.getIndex())}default:return n.fatalError('Not well-formed XML starting with "0)return n.fatalError("processing instruction at position "+t+" is an xml declaration which is only at the start of the document");if(!v.XMLDecl.test(e.substring(t)))return n.fatalError("xml declaration is not well-formed")}return r.processingInstruction(u[1],u[2]),t+u[0].length}function Du(){this.attributeNames=Object.create(null)}Du.prototype={setTagName:function(e){if(!v.QName_exact.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!v.QName_exact.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},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}};xt.XMLReader=du;xt.parseUtils=Eu;xt.parseDoctypeCommentOrCData=gu;var be=B,Pa=x,ka=Ne,Jr=pu,qa=xt,$a=Pa.DOMImplementation,ja=be.hasDefaultHTMLNamespace,Ua=be.isHTMLMimeType,Va=be.isValidMimeType,vu=be.MIME_TYPE,$t=be.NAMESPACE,Xr=ka.ParseError,Ha=qa.XMLReader;function Ga(e){return e.replace(/\r[\n\u0085]/g,` `).replace(/[\r\u0085\u2028]/g,` -`)}function Ni(t){this.options=t||{locator:{}}}Ni.prototype.parseFromString=function(t,e){var r=this.options,u=new Ai,n=r.domBuilder||new ze,i=r.errorHandler,o=r.locator,a=r.xmlns||{},s=/\/x?html?$/.test(e),l=s?Xt.HTML_ENTITIES:Xt.XML_ENTITIES;o&&n.setDocumentLocator(o),u.errorHandler=Ci(i,n,o),u.domBuilder=r.domBuilder||n,s&&(a[""]=Kt.HTML),a.xml=a.xml||Kt.XML;var c=r.normalizeLineEndings||yi;return t&&typeof t=="string"?u.parse(c(t),a,l):u.errorHandler.error("invalid doc source"),n.doc};function Ci(t,e,r){if(!t){if(e instanceof ze)return e;t=e}var u={},n=t instanceof Function;r=r||{};function i(o){var a=t[o];!a&&n&&(a=t.length==2?function(s){t(o,s)}:t),u[o]=a&&function(s){a("[xmldom "+o+"] "+s+et(r))}||function(){}}return i("warning"),i("error"),i("fatalError"),u}function ze(){this.cdata=!1}function ae(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}ze.prototype={startDocument:function(){this.doc=new vi().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,r,u){var n=this.doc,i=n.createElementNS(t,r||e),o=u.length;qe(this,i),this.currentElement=i,this.locator&&ae(this.locator,i);for(var a=0;a=e+r||e?new java.lang.String(t,e,r)+"":t}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(t){ze.prototype[t]=function(){return null}});function qe(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}const Yt="USJ",U=["figure","note","sidebar","table"];Object.freeze(U);class B{constructor(e){E(this,"usj");E(this,"parentMapInternal");this.usj=e}usjChanged(){this.parentMapInternal=void 0}findSingleValue(e){const r=yt.JSONPath({path:e,json:this.usj,wrap:!0});if(r===void 0||r.length===0)return;if(!Array.isArray(r[0]))return r[0];const u=yt.JSONPath({path:e,json:this.usj,wrap:!1});return u.length===1&&Array.isArray(u[0])?u[0]:u}findParent(e){return this.findSingleValue(`${e}^`)}findBookId(){return this.findSingleValue('$.content[?(@.type=="book" && @.marker=="id")].code')}findChapterNode(e){const r=`$..content[?(@.type=="chapter" && @.number=="${e}")]`;return this.findSingleValue(r)}static createParentMapInternal(e,r,u){var n;u.set(e,r),e.content&&u.set(e.content,e),(n=e.content)==null||n.forEach(i=>{typeof i=="object"&&B.createParentMapInternal(i,e,u)})}createUsjParentMap(){const e=new Map;return this.usj.content&&e.set(this.usj.content,this.usj),this.usj.content.forEach(r=>{typeof r=="object"&&B.createParentMapInternal(r,this.usj,e)}),e}get parentMap(){return this.parentMapInternal?this.parentMapInternal:(this.parentMapInternal=this.createUsjParentMap(),this.parentMapInternal)}createWorkingStack(e){const r=[],{parentMap:u}=this;let n=e,i=u.get(n);for(;i!==void 0;){if(!i.content)throw new Error("Invalid parentMap: all parents should have content");if(!i.content.find((o,a)=>{if(o!==n)return!1;if(!i)throw new Error('undefined "tempParent" should not be possible');return r.unshift({parent:i,index:a}),!0}))throw new Error(`Unable to find correct parent node of ${JSON.stringify(n)}`);if(i.type===Yt)break;n=i,i=u.get(i)}return r}static convertWorkingStackToJsonPath(e){let r="$";return e.forEach(u=>{r=`${r}.content[${u.index}]`}),r}convertJsonPathToWorkingStack(e){const r=[],u=e.match(/content\[(\d+)\]/g);if(!u)throw new Error(`Malformed or unexpected jsonPath: ${e}`);let n=this.usj;return u.forEach((i,o)=>{const a=/(\d+)/.exec(i);if(!a)throw new Error(`Malformed or unexpected jsonPath: ${e}`);const s=parseInt(a[0],10);if(r.push({parent:n,index:s}),o+1=0;n--){const i=e.content[n];if(typeof i=="object"&&!u.includes(i.type))return i.content?this.findRightMostDescendantMarkerObject(i,e,u):{node:i,parent:e}}return{node:e,parent:r}}static findNextMatchingNodeUsingWorkingStack(e,r,u,n){var o;let i=e;for(;i!==void 0;){const a=typeof i=="object"&&u.includes(i.type);if(!a&&n(i,r))return i;if(!a&&typeof i=="object"&&(((o=i.content)==null?void 0:o.length)??0)>0)r.push({parent:i,index:0}),[i]=i.content;else for(i=void 0;r.length>0;){const s=r.pop();if(s&&s.index+1=0&&typeof r.content[i]!="object";)i-=1;if(i<0){if(r.type===Yt)return u.chapterNum===void 0&&(u.chapterNum=1,u.verseNum=0,u.startingContentNode=void 0),u;const s=r,l=this.parentMap.get(s);if(!l)throw new Error(`No parent found for ${JSON.stringify(r)}`);return this.findVerseRefForNode(s,l,u)}const o=r.content[i],a=B.findRightMostDescendantMarkerObject(o,r,U);return this.findVerseRefForNode(a.node,a.parent,u)}nodeToVerseRefAndOffset(e,r,u){if(typeof r=="string"&&u===void 0)throw new Error('If "node" is a string, then "nodeParent" cannot be undefined');let n;if(u===void 0?n=this.parentMap.get(r):n=Array.isArray(u)?this.parentMap.get(u):u,n===void 0)throw new Error(`Cannot find parent for ${JSON.stringify(u)}`);const i=this.findVerseRefForNode(r,n);if(!i)return;if(!i.chapterNum)throw new Error(`Could not determine chapter number for ${JSON.stringify(r)}`);const o=new fr(e,i.chapterNum.toString(),i.verseNum?i.verseNum.toString():"0");let a=0;return i.startingContentNode!==void 0&&this.findNextMatchingNode(i.startingContentNode,[],(s,l)=>{var c,f;return s===r?!0:l.find(p=>U.includes(p.parent.type))?!1:typeof s=="string"?(a+=s.length,!1):s.type===ye&&s.number!==((c=i.chapterNum)==null?void 0:c.toString())||s.type===Ne&&s.number!==((f=i.verseNum)==null?void 0:f.toString())?(a=0,!0):!1}),{verseRef:o,offset:a}}jsonPathToVerseRefAndOffset(e,r){const u=r??this.findBookId();if(!u)throw new Error("Not able to determine the book ID");const n=this.findSingleValue(e);if(!n)throw new Error(`No result found for JSONPath query: ${e}`);const i=this.findParent(e);if(!i)throw new Error(`Could not determine parent for ${e}`);const o=this.nodeToVerseRefAndOffset(u,n,i);if(!o)throw new Error(`Could not determine VerseRef that corresponds to ${e}`);return o}verseRefToUsjContentLocation(e,r=0){if(r<0)throw new Error("offset must be >= 0");const u=this.findBookId()??e.book;if(!u)throw new Error("Not able to determine the book ID");if(u!==e.book)throw new Error(`Book IDs don't match: USJ=${u}, VerseRef=${e.book}`);const n=this.findChapterNode(e.chapterNum);if(n===void 0)throw new Error(`Could not find ${u} chapter ${e.chapterNum}`);let i=!1,o="";const a=e.verse,s=this.findNextMatchingNode(n,U,(p,h)=>p===n?e.verseNum===0?(o=B.convertWorkingStackToJsonPath(h),!0):!1:typeof p!="object"?!1:p.type===ye?(i=!0,!0):p.type===Ne&&p.number!==void 0&&p.number===a?(o=B.convertWorkingStackToJsonPath(h),!0):!1);if(i||s===void 0||typeof s=="string")throw new Error(`Verse ${a} not found in ${u} ${e.chapterNum}`);if(r===0)return{node:s,offset:0,jsonPath:o};let l=0,c=0,f;return this.findNextMatchingNode(s,U,(p,h)=>{if(p===s)return!1;if(typeof p=="string"){if(l+=p.length,l>r)return o=B.convertWorkingStackToJsonPath(h),c=r-l+p.length,f=p,!0}else if(p.type===ye||p.type===Ne)return!0;return!1}),{node:f??s,offset:c,jsonPath:o}}findNextLocationOfMatchingText(e,r,u=1e3){let n="",i=0,o=0,a=0;if(B.findNextMatchingNodeUsingWorkingStack(e.node,this.convertJsonPathToWorkingStack(e.jsonPath),U,f=>{if(typeof f!="string")return!1;i+=f.length,n=`${n}${f}`;const p=n.indexOf(r);return p<0?(o+=n.length,n.length>r.length&&(n=n.substring(n.length-r.length)),o-=n.length,i>u):(a=o+p,!0)}),a<=0)return;i=0;let s=0,l=[];const c=B.findNextMatchingNodeUsingWorkingStack(e.node,this.convertJsonPathToWorkingStack(e.jsonPath),U,(f,p)=>typeof f!="string"||(i+=f.length,i{if(typeof o!="string")return!1;if(n>=o.length)return n-=o.length,!1;let a=o;if(n>0&&(a=a.substring(n),n=0),i+a.lengthi===r.node&&(typeof i=="object"||r.jsonPath===B.convertWorkingStackToJsonPath(o))?!0:typeof i!="string"?!1:(n=`${n}${i}`,n.length>u&&(n=n.substring(0,u)),n.length>=u)),n}static removeContentNodesFromArray(e,r){let u=0;for(let n=e.length-1;n>=0;n--){const i=e[n];r(i)?(e.splice(n,1),u+=1):typeof i!="string"&&i.content&&(u+=this.removeContentNodesFromArray(i.content,r))}return u}removeContentNodes(e){const r=B.removeContentNodesFromArray(this.usj.content,e);return this.usjChanged(),r}}exports.AsyncVariable=du;exports.CHAPTER_TYPE=ye;exports.Collator=mu;exports.DateTimeFormat=Zt;exports.DocumentCombiner=tr;exports.FIRST_SCR_BOOK_NUM=Er;exports.FIRST_SCR_CHAPTER_NUM=yr;exports.FIRST_SCR_VERSE_NUM=Nr;exports.LAST_SCR_BOOK_NUM=Ar;exports.Mutex=ur;exports.MutexMap=Su;exports.NonValidatingDocumentCombiner=Bu;exports.NumberFormat=nr;exports.PlatformEventEmitter=Qt;exports.UnsubscriberAsyncList=Tu;exports.UsjReaderWriter=B;exports.VERSE_TYPE=Ne;exports.aggregateUnsubscriberAsyncs=En;exports.aggregateUnsubscribers=vn;exports.at=Yu;exports.charAt=ee;exports.codePointAt=Zu;exports.compareScrRefs=gn;exports.createSyncProxyForAsyncObject=Cu;exports.debounce=Du;exports.deepClone=ce;exports.deepEqual=Tr;exports.defaultScrRef=fn;exports.deserialize=xr;exports.endsWith=dr;exports.ensureArray=it;exports.escapeStringRegexp=sn;exports.formatBytes=Kn;exports.formatReplacementString=en;exports.formatReplacementStringToArray=mr;exports.formatScrRef=bn;exports.getAllObjectFunctionNames=Nu;exports.getChaptersForBook=Cr;exports.getCurrentLocale=Xn;exports.getErrorMessage=Au;exports.getLocalizeKeyForScrollGroupId=wr;exports.getLocalizeKeysForScrollGroupIds=Dn;exports.getLocalizedIdFromBookNumber=mn;exports.groupBy=bu;exports.htmlEncode=Hn;exports.includes=gr;exports.indexOf=le;exports.isLocalizeKey=an;exports.isSerializable=Jn;exports.isString=Ce;exports.isSubset=Or;exports.lastIndexOf=Dr;exports.localizedStringsDocumentSchema=kr;exports.menuDocumentSchema=qr;exports.newGuid=gu;exports.normalize=tn;exports.offsetBook=pn;exports.offsetChapter=hn;exports.offsetVerse=dn;exports.ordinalCompare=rn;exports.padEnd=un;exports.padStart=nn;exports.projectSettingsDocumentSchema=Ir;exports.scrRefToBBBCCCVVV=We;exports.serialize=Ye;exports.settingsDocumentSchema=Fr;exports.slice=on;exports.split=Ke;exports.startsWith=ot;exports.stringLength=w;exports.substring=K;exports.toArray=br;exports.transformAndEnsureRegExpArray=ln;exports.transformAndEnsureRegExpRegExpArray=cn;exports.wait=er;exports.waitForDuration=yu; +`)}function za(e){if(e=e||{locator:!0},this.assign=e.assign||be.assign,this.domHandler=e.domHandler||fr,this.onError=e.onError||e.errorHandler,e.errorHandler&&typeof e.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");e.errorHandler&&e.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=e.normalizeLineEndings||Ga,this.locator=!!e.locator,this.xmlns=this.assign(Object.create(null),e.xmlns)}za.prototype.parseFromString=function(e,t){if(!Va(t))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+t+'" is not valid.');var r=this.assign(Object.create(null),this.xmlns),n=Jr.XML_ENTITIES,u=r[""]||null;ja(t)?(n=Jr.HTML_ENTITIES,u=$t.HTML):t===vu.XML_SVG_IMAGE&&(u=$t.SVG),r[""]=u,r.xml=r.xml||$t.XML;var i=new this.domHandler({mimeType:t,defaultNamespace:u,onError:this.onError}),a=this.locator?{}:void 0;this.locator&&i.setDocumentLocator(a);var o=new Ha;o.errorHandler=i,o.domBuilder=i;var s=!be.isHTMLMimeType(t);return s&&typeof e!="string"&&o.errorHandler.fatalError("source is not a string"),o.parse(this.normalizeLineEndings(String(e)),r,n),i.doc.documentElement||o.errorHandler.fatalError("missing root element"),i.doc};function fr(e){var t=e||{};this.mimeType=t.mimeType||vu.XML_APPLICATION,this.defaultNamespace=t.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=t.onError}function we(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}fr.prototype={startDocument:function(){var e=new $a;this.doc=Ua(this.mimeType)?e.createHTMLDocument(!1):e.createDocument(this.defaultNamespace,"")},startElement:function(e,t,r,n){var u=this.doc,i=u.createElementNS(e,r||t),a=n.length;Dt(this,i),this.currentElement=i,this.locator&&we(this.locator,i);for(var o=0;o=t+r||t?new java.lang.String(e,t,r)+"":e}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){fr.prototype[e]=function(){return null}});function Dt(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}var $e=B;$e.assign;$e.hasDefaultHTMLNamespace;$e.isHTMLMimeType;$e.isValidMimeType;$e.MIME_TYPE;$e.NAMESPACE;const Kr="USJ",ne=["figure","note","sidebar","table"];Object.freeze(ne);class L{constructor(t){S(this,"usj");S(this,"parentMapInternal");this.usj=t}usjChanged(){this.parentMapInternal=void 0}findSingleValue(t){const r=mr.JSONPath({path:t,json:this.usj,wrap:!0});if(r===void 0||r.length===0)return;if(!Array.isArray(r[0]))return r[0];const n=mr.JSONPath({path:t,json:this.usj,wrap:!1});return n.length===1&&Array.isArray(n[0])?n[0]:n}findParent(t){return this.findSingleValue(`${t}^`)}findBookId(){return this.findSingleValue('$.content[?(@.type=="book" && @.marker=="id")].code')}findChapterNode(t){const r=`$..content[?(@.type=="chapter" && @.number=="${t}")]`;return this.findSingleValue(r)}static createParentMapInternal(t,r,n){var u;n.set(t,r),t.content&&n.set(t.content,t),(u=t.content)==null||u.forEach(i=>{typeof i=="object"&&L.createParentMapInternal(i,t,n)})}createUsjParentMap(){const t=new Map;return this.usj.content&&t.set(this.usj.content,this.usj),this.usj.content.forEach(r=>{typeof r=="object"&&L.createParentMapInternal(r,this.usj,t)}),t}get parentMap(){return this.parentMapInternal?this.parentMapInternal:(this.parentMapInternal=this.createUsjParentMap(),this.parentMapInternal)}createWorkingStack(t){const r=[],{parentMap:n}=this;let u=t,i=n.get(u);for(;i!==void 0;){if(!i.content)throw new Error("Invalid parentMap: all parents should have content");if(!i.content.find((a,o)=>{if(a!==u)return!1;if(!i)throw new Error('undefined "tempParent" should not be possible');return r.unshift({parent:i,index:o}),!0}))throw new Error(`Unable to find correct parent node of ${JSON.stringify(u)}`);if(i.type===Kr)break;u=i,i=n.get(i)}return r}static convertWorkingStackToJsonPath(t){let r="$";return t.forEach(n=>{r=`${r}.content[${n.index}]`}),r}convertJsonPathToWorkingStack(t){const r=[],n=t.match(/content\[(\d+)\]/g);if(!n)throw new Error(`Malformed or unexpected jsonPath: ${t}`);let u=this.usj;return n.forEach((i,a)=>{const o=/(\d+)/.exec(i);if(!o)throw new Error(`Malformed or unexpected jsonPath: ${t}`);const s=parseInt(o[0],10);if(r.push({parent:u,index:s}),a+1=0;u--){const i=t.content[u];if(typeof i=="object"&&!n.includes(i.type))return i.content?this.findRightMostDescendantMarkerObject(i,t,n):{node:i,parent:t}}return{node:t,parent:r}}static findNextMatchingNodeUsingWorkingStack(t,r,n,u){var a;let i=t;for(;i!==void 0;){const o=typeof i=="object"&&n.includes(i.type);if(!o&&u(i,r))return i;if(!o&&typeof i=="object"&&(((a=i.content)==null?void 0:a.length)??0)>0)r.push({parent:i,index:0}),[i]=i.content;else for(i=void 0;r.length>0;){const s=r.pop();if(s&&s.index+1=0&&typeof r.content[i]!="object";)i-=1;if(i<0){if(r.type===Kr)return n.chapterNum===void 0&&(n.chapterNum=1,n.verseNum=0,n.startingContentNode=void 0),n;const s=r,c=this.parentMap.get(s);if(!c)throw new Error(`No parent found for ${JSON.stringify(r)}`);return this.findVerseRefForNode(s,c,n)}const a=r.content[i],o=L.findRightMostDescendantMarkerObject(a,r,ne);return this.findVerseRefForNode(o.node,o.parent,n)}nodeToVerseRefAndOffset(t,r,n){if(typeof r=="string"&&n===void 0)throw new Error('If "node" is a string, then "nodeParent" cannot be undefined');let u;if(n===void 0?u=this.parentMap.get(r):u=Array.isArray(n)?this.parentMap.get(n):n,u===void 0)throw new Error(`Cannot find parent for ${JSON.stringify(n)}`);const i=this.findVerseRefForNode(r,u);if(!i)return;if(!i.chapterNum)throw new Error(`Could not determine chapter number for ${JSON.stringify(r)}`);const a=new Kt(t,i.chapterNum.toString(),i.verseNum?i.verseNum.toString():"0");let o=0;return i.startingContentNode!==void 0&&this.findNextMatchingNode(i.startingContentNode,[],(s,c)=>{var l,f;return s===r?!0:c.find(p=>ne.includes(p.parent.type))?!1:typeof s=="string"?(o+=s.length,!1):s.type===Xe&&s.number!==((l=i.chapterNum)==null?void 0:l.toString())||s.type===Ye&&s.number!==((f=i.verseNum)==null?void 0:f.toString())?(o=0,!0):!1}),{verseRef:a,offset:o}}jsonPathToVerseRefAndOffset(t,r){const n=r??this.findBookId();if(!n)throw new Error("Not able to determine the book ID");const u=this.findSingleValue(t);if(!u)throw new Error(`No result found for JSONPath query: ${t}`);const i=this.findParent(t);if(!i)throw new Error(`Could not determine parent for ${t}`);const a=this.nodeToVerseRefAndOffset(n,u,i);if(!a)throw new Error(`Could not determine VerseRef that corresponds to ${t}`);return a}verseRefToUsjContentLocation(t,r=0){if(r<0)throw new Error("offset must be >= 0");const n=this.findBookId()??t.book;if(!n)throw new Error("Not able to determine the book ID");if(n!==t.book)throw new Error(`Book IDs don't match: USJ=${n}, VerseRef=${t.book}`);const u=this.findChapterNode(t.chapterNum);if(u===void 0)throw new Error(`Could not find ${n} chapter ${t.chapterNum}`);let i=!1,a="";const o=t.verse,s=this.findNextMatchingNode(u,ne,(p,m)=>p===u?t.verseNum===0?(a=L.convertWorkingStackToJsonPath(m),!0):!1:typeof p!="object"?!1:p.type===Xe?(i=!0,!0):p.type===Ye&&p.number!==void 0&&p.number===o?(a=L.convertWorkingStackToJsonPath(m),!0):!1);if(i||s===void 0||typeof s=="string")throw new Error(`Verse ${o} not found in ${n} ${t.chapterNum}`);if(r===0)return{node:s,offset:0,jsonPath:a};let c=0,l=0,f;return this.findNextMatchingNode(s,ne,(p,m)=>{if(p===s)return!1;if(typeof p=="string"){if(c+=p.length,c>r)return a=L.convertWorkingStackToJsonPath(m),l=r-c+p.length,f=p,!0}else if(p.type===Xe||p.type===Ye)return!0;return!1}),{node:f??s,offset:l,jsonPath:a}}findNextLocationOfMatchingText(t,r,n=1e3){let u="",i=0,a=0,o=0;if(L.findNextMatchingNodeUsingWorkingStack(t.node,this.convertJsonPathToWorkingStack(t.jsonPath),ne,f=>{if(typeof f!="string")return!1;i+=f.length,u=`${u}${f}`;const p=u.indexOf(r);return p<0?(a+=u.length,u.length>r.length&&(u=u.substring(u.length-r.length)),a-=u.length,i>n):(o=a+p,!0)}),o<=0)return;i=0;let s=0,c=[];const l=L.findNextMatchingNodeUsingWorkingStack(t.node,this.convertJsonPathToWorkingStack(t.jsonPath),ne,(f,p)=>typeof f!="string"||(i+=f.length,i{if(typeof a!="string")return!1;if(u>=a.length)return u-=a.length,!1;let o=a;if(u>0&&(o=o.substring(u),u=0),i+o.lengthi===r.node&&(typeof i=="object"||r.jsonPath===L.convertWorkingStackToJsonPath(a))?!0:typeof i!="string"?!1:(u=`${u}${i}`,u.length>n&&(u=u.substring(0,n)),u.length>=n)),u}static removeContentNodesFromArray(t,r){let n=0;for(let u=t.length-1;u>=0;u--){const i=t[u];r(i)?(t.splice(u,1),n+=1):typeof i!="string"&&i.content&&(n+=this.removeContentNodesFromArray(i.content,r))}return n}removeContentNodes(t){const r=L.removeContentNodesFromArray(this.usj.content,t);return this.usjChanged(),r}}exports.AsyncVariable=Cu;exports.CHAPTER_TYPE=Xe;exports.Collator=Tu;exports.DateTimeFormat=Wr;exports.DocumentCombiner=en;exports.FIRST_SCR_BOOK_NUM=vn;exports.FIRST_SCR_CHAPTER_NUM=Nn;exports.FIRST_SCR_VERSE_NUM=bn;exports.LAST_SCR_BOOK_NUM=An;exports.Mutex=rn;exports.MutexMap=Lu;exports.NonValidatingDocumentCombiner=Pu;exports.NumberFormat=nn;exports.PlatformEventEmitter=Qr;exports.UnsubscriberAsyncList=ku;exports.UsjReaderWriter=L;exports.VERSE_TYPE=Ye;exports.aggregateUnsubscriberAsyncs=Ii;exports.aggregateUnsubscribers=Oi;exports.at=ai;exports.charAt=he;exports.codePointAt=si;exports.compareScrRefs=Ti;exports.createSyncProxyForAsyncObject=_u;exports.debounce=Su;exports.deepClone=Oe;exports.deepEqual=Sn;exports.defaultScrRef=Ai;exports.deserialize=In;exports.endsWith=hn;exports.ensureArray=Qt;exports.escapeStringRegexp=gi;exports.formatBytes=uo;exports.formatReplacementString=li;exports.formatReplacementStringToArray=dn;exports.formatScrRef=Si;exports.getAllObjectFunctionNames=Mu;exports.getChaptersForBook=yn;exports.getCurrentLocale=no;exports.getErrorMessage=Bu;exports.getLocalizeKeyForScrollGroupId=Cn;exports.getLocalizeKeysForScrollGroupIds=wi;exports.getLocalizedIdFromBookNumber=Ci;exports.groupBy=Ou;exports.htmlEncode=ro;exports.includes=mn;exports.indexOf=Ie;exports.isLocalizeKey=Ei;exports.isSerializable=to;exports.isString=We;exports.isSubset=On;exports.lastIndexOf=En;exports.localizedStringsDocumentSchema=Mn;exports.menuDocumentSchema=_n;exports.newGuid=wu;exports.normalize=fi;exports.offsetBook=Ni;exports.offsetChapter=bi;exports.offsetVerse=yi;exports.ordinalCompare=pi;exports.padEnd=hi;exports.padStart=di;exports.projectSettingsDocumentSchema=Rn;exports.scrRefToBBBCCCVVV=Vt;exports.serialize=Ht;exports.settingsDocumentSchema=Bn;exports.slice=mi;exports.split=Ut;exports.startsWith=Zt;exports.stringLength=_;exports.substring=ae;exports.toArray=gn;exports.transformAndEnsureRegExpArray=vi;exports.transformAndEnsureRegExpRegExpArray=Di;exports.wait=Zr;exports.waitForDuration=xu; //# sourceMappingURL=index.cjs.map diff --git a/lib/platform-bible-utils/dist/index.cjs.map b/lib/platform-bible-utils/dist/index.cjs.map index 92244419e6..ae9146adb1 100644 --- a/lib/platform-bible-utils/dist/index.cjs.map +++ b/lib/platform-bible-utils/dist/index.cjs.map @@ -1 +1 @@ -{"version":3,"file":"index.cjs","sources":["../src/async-variable.ts","../src/intl-collator.ts","../src/intl-date-time-format.ts","../src/platform-event-emitter.model.ts","../src/util.ts","../src/document-combiner.ts","../src/mutex.ts","../src/mutex-map.ts","../src/non-validating-document-combiner.ts","../src/intl-number-format.ts","../src/unsubscriber-async-list.ts","../../../node_modules/@sillsdev/scripture/dist/index.es.js","../../../node_modules/char-regex/index.js","../../../node_modules/stringz/dist/index.js","../src/array-util.ts","../src/string-util.ts","../src/scripture-util.ts","../src/unsubscriber.ts","../src/usj-reader-writer.model.ts","../../../node_modules/fast-equals/dist/esm/index.mjs","../src/equality-checking.ts","../src/subset-checking.ts","../src/serialization.ts","../src/intl-util.ts","../src/number-utils.ts","../src/settings.model.ts","../src/localized-strings.model.ts","../src/menus.model.ts","../../../node_modules/@xmldom/xmldom/lib/conventions.js","../../../node_modules/@xmldom/xmldom/lib/dom.js","../../../node_modules/@xmldom/xmldom/lib/entities.js","../../../node_modules/@xmldom/xmldom/lib/sax.js","../../../node_modules/@xmldom/xmldom/lib/dom-parser.js","../../../node_modules/@biblionexus-foundation/scripture-utilities/dist/index.js","../src/usj-reader-writer.ts"],"sourcesContent":["/** This class provides a convenient way for one task to wait on a variable that another task sets. */\nexport default class AsyncVariable {\n private readonly variableName: string;\n private readonly promiseToValue: Promise;\n private resolver: ((value: T) => void) | undefined;\n private rejecter: ((reason: string | undefined) => void) | undefined;\n\n /**\n * Creates an instance of the class\n *\n * @param variableName Name to use when logging about this variable\n * @param rejectIfNotSettledWithinMS Milliseconds to wait before verifying if the promise was\n * settled (resolved or rejected); will reject if it has not settled by that time. Use -1 if you\n * do not want a timeout at all. Defaults to 10000 ms\n */\n constructor(variableName: string, rejectIfNotSettledWithinMS: number = 10000) {\n this.variableName = variableName;\n this.promiseToValue = new Promise((resolve, reject) => {\n this.resolver = resolve;\n this.rejecter = reject;\n });\n if (rejectIfNotSettledWithinMS > 0) {\n setTimeout(() => {\n if (this.rejecter) {\n this.rejecter(`Timeout reached when waiting for ${this.variableName} to settle`);\n this.complete();\n }\n }, rejectIfNotSettledWithinMS);\n }\n Object.seal(this);\n }\n\n /**\n * Get this variable's promise to a value. This always returns the same promise even after the\n * value has been resolved or rejected.\n *\n * @returns The promise for the value to be set\n */\n get promise(): Promise {\n return this.promiseToValue;\n }\n\n /**\n * A simple way to see if this variable's promise was resolved or rejected already\n *\n * @returns Whether the variable was already resolved or rejected\n */\n get hasSettled(): boolean {\n return Object.isFrozen(this);\n }\n\n /**\n * Resolve this variable's promise to the given value\n *\n * @param value This variable's promise will resolve to this value\n * @param throwIfAlreadySettled Determines whether to throw if the variable was already resolved\n * or rejected. Defaults to `false`\n */\n resolveToValue(value: T, throwIfAlreadySettled: boolean = false): void {\n if (this.resolver) {\n console.debug(`${this.variableName} is being resolved now`);\n this.resolver(value);\n this.complete();\n } else {\n if (throwIfAlreadySettled) throw Error(`${this.variableName} was already settled`);\n console.debug(`Ignoring subsequent resolution of ${this.variableName}`);\n }\n }\n\n /**\n * Reject this variable's promise for the value with the given reason\n *\n * @param reason This variable's promise will be rejected with this reason\n * @param throwIfAlreadySettled Determines whether to throw if the variable was already resolved\n * or rejected. Defaults to `false`\n */\n rejectWithReason(reason: string, throwIfAlreadySettled: boolean = false): void {\n if (this.rejecter) {\n console.debug(`${this.variableName} is being rejected now`);\n this.rejecter(reason);\n this.complete();\n } else {\n if (throwIfAlreadySettled) throw Error(`${this.variableName} was already settled`);\n console.debug(`Ignoring subsequent rejection of ${this.variableName}`);\n }\n }\n\n /** Prevent any further updates to this variable */\n private complete(): void {\n this.resolver = undefined;\n this.rejecter = undefined;\n Object.freeze(this);\n }\n}\n","/** Enables language-sensitive string comparison. Wraps Intl.Collator */\nexport default class Collator {\n private collator: Intl.Collator;\n\n constructor(locales?: string | string[], options?: Intl.CollatorOptions) {\n this.collator = new Intl.Collator(locales, options);\n }\n\n /**\n * Compares two strings according to the sort order of this Collator object\n *\n * @param string1 String to compare\n * @param string2 String to compare\n * @returns A number indicating how string1 and string2 compare to each other according to the\n * sort order of this Collator object. Negative value if string1 comes before string2. Positive\n * value if string1 comes after string2. 0 if they are considered equal.\n */\n compare(string1: string, string2: string): number {\n return this.collator.compare(string1, string2);\n }\n\n /**\n * Returns a new object with properties reflecting the locale and collation options computed\n * during initialization of this collator object.\n *\n * @returns ResolvedCollatorOptions object\n */\n resolvedOptions(): Intl.ResolvedCollatorOptions {\n return this.collator.resolvedOptions();\n }\n}\n","/** Enables language-sensitive data and time formatting. Wraps Intl.DateTimeFormat */\nexport default class DateTimeFormat {\n private dateTimeFormatter: Intl.DateTimeFormat;\n\n constructor(locales?: string | string[], options?: Intl.DateTimeFormatOptions) {\n this.dateTimeFormatter = new Intl.DateTimeFormat(locales, options);\n }\n\n /**\n * Formats a date according to the locale and formatting option for this DateTimeFormat object\n *\n * @param date The date to format\n * @returns String representing the given date formatted according to the locale and formatting\n * options of this DateTimeFormat object\n */\n format(date: Date): string {\n return this.dateTimeFormatter.format(date);\n }\n\n /**\n * Formats a date range in the most concise way based on the locales and options provided when\n * instantiating this DateTimeFormat object\n *\n * @param startDate Date object representing start of the date range\n * @param endDate Date object representing the end of the date range\n * @returns String representing the given date range formatted according to the locale and\n * formatting options of this DateTimeFormat object\n */\n formatRange(startDate: Date, endDate: Date): string {\n return this.dateTimeFormatter.formatRange(startDate, endDate);\n }\n\n /**\n * Returns an array of locale-specific tokens representing each part of the formatted date range\n * produced by this DateTimeFormat object\n *\n * @param startDate Date object representing start of the date range\n * @param endDate Date object representing the end of the date range\n * @returns Array of DateTimeRangeFormatPart objects\n */\n formatRangeToParts(startDate: Date, endDate: Date): Intl.DateTimeRangeFormatPart[] {\n return this.dateTimeFormatter.formatRangeToParts(startDate, endDate);\n }\n\n /**\n * Allows locale-aware formatting of strings produced by this DateTimeFormat object\n *\n * @param date The date to format\n * @returns Array of DateTimeFormatPart objects\n */\n formatToParts(date: Date): Intl.DateTimeFormatPart[] {\n return this.dateTimeFormatter.formatToParts(date);\n }\n\n /**\n * Returns a new object with properties reflecting the locale and date and time formatting options\n * computed during initialization of this DateTimeFormat object\n *\n * @returns ResolvedDateTimeFormatOptions object\n */\n resolvedOptions(): Intl.ResolvedDateTimeFormatOptions {\n return this.dateTimeFormatter.resolvedOptions();\n }\n}\n","/** Interfaces, classes, and functions related to events and event emitters */\n\nimport { Dispose } from './disposal.model';\nimport { PlatformEvent, PlatformEventHandler } from './platform-event';\n\n/**\n * Event manager - accepts subscriptions to an event and runs the subscription callbacks when the\n * event is emitted Use eventEmitter.event(callback) to subscribe to the event. Use\n * eventEmitter.emit(event) to run the subscriptions. Generally, this EventEmitter should be\n * private, and its event should be public. That way, the emitter is not publicized, but anyone can\n * subscribe to the event.\n */\nexport default class PlatformEventEmitter implements Dispose {\n /**\n * Subscribes a function to run when this event is emitted.\n *\n * @param callback Function to run with the event when it is emitted\n * @returns Unsubscriber function to run to stop calling the passed-in function when the event is\n * emitted\n * @alias event\n */\n subscribe = this.event;\n\n /** All callback functions that will run when this event is emitted. Lazy loaded */\n private subscriptions?: PlatformEventHandler[];\n /** Event for listeners to subscribe to. Lazy loaded */\n private lazyEvent?: PlatformEvent;\n /** Whether this emitter has been disposed */\n private isDisposed = false;\n\n /**\n * Event for listeners to subscribe to. Subscribes a function to run when this event is emitted.\n * Use like `const unsubscriber = event(callback)`\n *\n * @param callback Function to run with the event when it is emitted\n * @returns Unsubscriber function to run to stop calling the passed-in function when the event is\n * emitted\n */\n get event(): PlatformEvent {\n this.assertNotDisposed();\n\n if (!this.lazyEvent) {\n this.lazyEvent = (callback) => {\n if (!callback || typeof callback !== 'function')\n throw new Error(`Event handler callback must be a function!`);\n\n // Initialize this.subscriptions if it does not exist\n if (!this.subscriptions) this.subscriptions = [];\n\n this.subscriptions.push(callback);\n\n return () => {\n if (!this.subscriptions) return false; // Did not find any subscribed callbacks\n\n const callbackIndex = this.subscriptions.indexOf(callback);\n\n if (callbackIndex < 0) return false; // Did not find this callback in the subscriptions\n\n // Remove the callback\n this.subscriptions.splice(callbackIndex, 1);\n\n return true;\n };\n };\n }\n return this.lazyEvent;\n }\n\n /** Disposes of this event, preparing it to release from memory */\n dispose = () => {\n return this.disposeFn();\n };\n\n /**\n * Runs the subscriptions for the event\n *\n * @param event Event data to provide to subscribed callbacks\n */\n emit = (event: T) => {\n // Do not do anything other than emitFn here. This emit is just binding `this` to emitFn\n this.emitFn(event);\n };\n\n /**\n * Function that runs the subscriptions for the event. Added here so children can override emit\n * and still call the base functionality. See NetworkEventEmitter.emit for example\n */\n protected emitFn(event: T) {\n this.assertNotDisposed();\n\n // Clone the subscriptions array before iterating over the callbacks so the callback index\n // doesn't get messed up if someone subscribes or unsubscribes inside one of the callbacks\n const emitCallbacks = [...(this.subscriptions ?? [])];\n emitCallbacks.forEach((callback) => callback(event));\n }\n\n /** Check to make sure this emitter is not disposed. Throw if it is */\n protected assertNotDisposed() {\n if (this.isDisposed) throw new Error('Emitter is disposed');\n }\n\n /**\n * Disposes of this event, preparing it to release from memory. Added here so children can\n * override emit and still call the base functionality.\n */\n protected disposeFn() {\n this.assertNotDisposed();\n\n this.isDisposed = true;\n this.subscriptions = undefined;\n this.lazyEvent = undefined;\n return Promise.resolve(true);\n }\n}\n","/** Collection of functions, objects, and types that are used as helpers in other services. */\n\n// Thanks to blubberdiblub at https://stackoverflow.com/a/68141099/217579\nexport function newGuid(): string {\n return '00-0-4-1-000'.replace(/[^-]/g, (s) =>\n // @ts-expect-error ts(2363) this works fine\n // eslint-disable-next-line no-bitwise\n (((Math.random() + ~~s) * 0x10000) >> s).toString(16).padStart(4, '0'),\n );\n}\n\n// thanks to DRAX at https://stackoverflow.com/a/9436948\n/**\n * Determine whether the object is a string\n *\n * @param o Object to determine if it is a string\n * @returns True if the object is a string; false otherwise\n */\nexport function isString(o: unknown): o is string {\n return typeof o === 'string' || o instanceof String;\n}\n\n/**\n * If deepClone isn't used when copying properties between objects, you may be left with dangling\n * references between the source and target of property copying operations.\n *\n * @param obj Object to clone\n * @returns Duplicate copy of `obj` without any references back to the original one\n */\nexport function deepClone(obj: T): T {\n // Assert the return type matches what is expected\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n return JSON.parse(JSON.stringify(obj)) as T;\n}\n\n/**\n * Get a function that reduces calls to the function passed in\n *\n * @param fn The function to debounce\n * @param delay How much delay in milliseconds after the most recent call to the debounced function\n * to call the function\n * @returns Function that, when called, only calls the function passed in at maximum every delay ms\n */\n// We don't know the parameter types since this function can be anything\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function debounce void>(fn: T, delay = 300): T {\n if (isString(fn)) throw new Error('Tried to debounce a string! Could be XSS');\n let timeout: ReturnType;\n // Ensure the right return type.\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n return ((...args) => {\n clearTimeout(timeout);\n timeout = setTimeout(() => fn(...args), delay);\n }) as T;\n}\n\n/**\n * Groups each item in the array of items into a map according to the keySelector\n *\n * @param items Array of items to group by\n * @param keySelector Function to run on each item to get the key for the group to which it belongs\n * @param valueSelector Function to run on each item to get the value it should have in the group\n * (like map function). If not provided, uses the item itself\n * @returns Map of keys to groups of values corresponding to each item\n */\nexport function groupBy(items: T[], keySelector: (item: T) => K): Map>;\nexport function groupBy(\n items: T[],\n keySelector: (item: T) => K,\n valueSelector: (item: T, key: K) => V,\n): Map>;\nexport function groupBy(\n items: T[],\n keySelector: (item: T) => K,\n valueSelector?: (item: T, key: K) => V,\n): Map> {\n const map = new Map>();\n items.forEach((item) => {\n const key = keySelector(item);\n const group = map.get(key);\n const value = valueSelector ? valueSelector(item, key) : item;\n if (group) group.push(value);\n else map.set(key, [value]);\n });\n return map;\n}\n\n// From https://kentcdodds.com/blog/get-a-catch-block-error-message-with-typescript\ntype ErrorWithMessage = {\n message: string;\n};\n\n// From https://kentcdodds.com/blog/get-a-catch-block-error-message-with-typescript\nfunction isErrorWithMessage(error: unknown): error is ErrorWithMessage {\n return (\n typeof error === 'object' &&\n // We're potentially dealing with objects we didn't create, so they might contain `null`\n // eslint-disable-next-line no-null/no-null\n error !== null &&\n 'message' in error &&\n // Type assert `error` to check it's `message`.\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n typeof (error as Record).message === 'string'\n );\n}\n\n// From https://kentcdodds.com/blog/get-a-catch-block-error-message-with-typescript\n/**\n * Function to get an error from the object (useful for getting an error in a catch block)\n *\n * @param error Error object whose message to get\n * @returns Message of the error - if object has message, returns message. Otherwise tries to\n * stringify\n */\nfunction toErrorWithMessage(maybeError: unknown): ErrorWithMessage {\n if (isErrorWithMessage(maybeError)) return maybeError;\n\n try {\n return new Error(JSON.stringify(maybeError));\n } catch {\n // fallback in case there's an error stringifying the maybeError\n // like with circular references for example.\n return new Error(String(maybeError));\n }\n}\n\n// From https://kentcdodds.com/blog/get-a-catch-block-error-message-with-typescript\n/**\n * Function to get an error message from the object (useful for getting error message in a catch\n * block)\n *\n * @example `try {...} catch (e) { logger.info(getErrorMessage(e)) }`\n *\n * @param error Error object whose message to get\n * @returns Message of the error - if object has message, returns message. Otherwise tries to\n * stringify\n */\nexport function getErrorMessage(error: unknown) {\n return toErrorWithMessage(error).message;\n}\n\n/** Asynchronously waits for the specified number of milliseconds. (wraps setTimeout in a promise) */\nexport function wait(ms: number) {\n // eslint-disable-next-line no-promise-executor-return\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Runs the specified function and will timeout if it takes longer than the specified wait time\n *\n * @param fn The function to run\n * @param maxWaitTimeInMS The maximum amount of time to wait for the function to resolve\n * @returns Promise that resolves to the resolved value of the function or undefined if it ran\n * longer than the specified wait time\n */\nexport function waitForDuration(fn: () => Promise, maxWaitTimeInMS: number) {\n const timeout = wait(maxWaitTimeInMS).then(() => undefined);\n return Promise.any([timeout, fn()]);\n}\n\n/**\n * Get all functions on an object and its prototype chain (so we don't miss any class methods or any\n * object methods). Note that the functions on the final item in the prototype chain (i.e., Object)\n * are skipped to avoid including functions like `__defineGetter__`, `__defineSetter__`, `toString`,\n * etc.\n *\n * @param obj Object whose functions to get\n * @param _objId Optional ID of the object to use for debug logging\n * @returns Array of all function names on an object\n */\n// Note: lodash has something that MIGHT do the same thing as this. Investigate for https://github.com/paranext/paranext-core/issues/134\nexport function getAllObjectFunctionNames(\n obj: { [property: string]: unknown },\n // Leaving it here for debugging\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _objId: string = 'obj',\n): Set {\n const objectFunctionNames = new Set();\n\n // Get all function properties directly defined on the object\n Object.getOwnPropertyNames(obj).forEach((property) => {\n try {\n if (typeof obj[property] === 'function') objectFunctionNames.add(property);\n } catch (error) {\n // Too noisy - only reenable if you need more details\n // console.trace(`Skipping ${property} on ${objId} due to error: ${error}`);\n }\n });\n\n // Walk up the prototype chain and get additional function properties, skipping the functions\n // provided by the final (Object) prototype\n let objectPrototype = Object.getPrototypeOf(obj);\n while (objectPrototype && Object.getPrototypeOf(objectPrototype)) {\n Object.getOwnPropertyNames(objectPrototype).forEach((property) => {\n try {\n if (typeof obj[property] === 'function') objectFunctionNames.add(property);\n } catch (error) {\n // Too noisy - only reenable if you need more details\n // console.trace(`Skipping ${property} on ${objId}'s prototype due to error: ${error}`);\n }\n });\n objectPrototype = Object.getPrototypeOf(objectPrototype);\n }\n\n return objectFunctionNames;\n}\n\n/**\n * Creates a synchronous proxy for an asynchronous object. The proxy allows calling methods on an\n * object that is asynchronously fetched using a provided asynchronous function.\n *\n * @param getObject - A function that returns a promise resolving to the object whose asynchronous\n * methods to call.\n * @param objectToProxy - An optional object that is the object that is proxied. If a property is\n * accessed that does exist on this object, it will be returned. If a property is accessed that\n * does not exist on this object, it will be considered to be an asynchronous method called on the\n * object returned from getObject.\n * @returns A synchronous proxy for the asynchronous object.\n */\nexport function createSyncProxyForAsyncObject(\n getObject: (args?: unknown[]) => Promise,\n objectToProxy: Partial = {},\n): T {\n // objectToProxy will have only the synchronously accessed properties of T on it, and this proxy\n // makes the async methods that do not exist yet available synchronously so we have all of T\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n return new Proxy(objectToProxy as T, {\n get(target, prop) {\n // We don't have any type information for T, so we assume methodName exists on it and will let JavaScript throw if it doesn't exist\n // @ts-expect-error 7053\n if (prop in target) return target[prop];\n return async (...args: unknown[]) => {\n // 7053: We don't have any type information for T, so we assume methodName exists on it and will let JavaScript throw if it doesn't exist\n // 2556: The args here are the parameters for the method specified\n // @ts-expect-error 7053 2556\n return (await getObject())[prop](...args);\n };\n },\n });\n}\n\n/** Within type T, recursively change all properties to be optional */\nexport type DeepPartial = T extends object ? { [P in keyof T]?: DeepPartial } : T;\n\n/** Within type T, recursively change properties that were of type A to be of type B */\nexport type ReplaceType = T extends A\n ? B\n : T extends object\n ? { [K in keyof T]: ReplaceType }\n : T;\n\n// Thanks to jcalz at https://stackoverflow.com/a/50375286\n/**\n * Converts a union type to an intersection type (`|` to `&`).\n *\n * Note: this utility type is for use on object types. It may fail on other types.\n *\n * @example\n *\n * ```typescript\n * type TypeOne = { one: string };\n * type TypeTwo = { two: number };\n * type TypeThree = { three: string };\n *\n * type TypeNums = { one: TypeOne; two: TypeTwo; three: TypeThree };\n * const numNames = ['one', 'two'] as const;\n * type TypeNumNames = typeof numNames;\n *\n * // Same as `TypeOne | TypeTwo`\n * // `{ one: string } | { two: number }`\n * type TypeOneTwoUnion = TypeNums[TypeNumNames[number]];\n *\n * // Same as `TypeOne & TypeTwo`\n * // `{ one: string; two: number }`\n * type TypeOneTwoIntersection = UnionToIntersection;\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (\n x: infer I,\n) => void\n ? I\n : never;\n","import PlatformEventEmitter from './platform-event-emitter.model';\nimport { deepClone } from './util';\n\ntype JsonObjectLike = { [key: string]: unknown };\ntype JsonArrayLike = unknown[];\n\nexport type JsonDocumentLike = JsonObjectLike | JsonArrayLike;\n\n/**\n * Options for DocumentCombiner objects\n *\n * - `copyDocuments`: If true, this instance will perform a deep copy of all provided documents before\n * composing the output. If false, then changes made to provided documents after they are\n * contributed will be reflected in the next time output is composed.\n * - `ignoreDuplicateProperties`: If true, then duplicate properties are skipped if they are seen in\n * contributed documents. If false, then throw when duplicate properties are seen in contributed\n * documents.\n */\nexport type DocumentCombinerOptions = {\n copyDocuments: boolean;\n ignoreDuplicateProperties: boolean;\n};\n\n/**\n * Base class for any code that wants to compose JSON documents (primarily in the form of JS objects\n * or arrays) together into a single output document.\n */\nexport default class DocumentCombiner {\n protected baseDocument: JsonDocumentLike;\n protected readonly contributions = new Map();\n protected latestOutput: JsonDocumentLike | undefined;\n protected readonly options: DocumentCombinerOptions;\n private readonly onDidRebuildEmitter = new PlatformEventEmitter();\n /** Event that emits to announce that the document has been rebuilt and the output has been updated */\n // Need `onDidRebuildEmitter` to be instantiated before this line\n // eslint-disable-next-line @typescript-eslint/member-ordering\n readonly onDidRebuild = this.onDidRebuildEmitter.subscribe;\n\n /**\n * Create a DocumentCombiner instance\n *\n * @param baseDocument This is the first document that will be used when composing the output\n * @param options Options used by this object when combining documents\n */\n protected constructor(baseDocument: JsonDocumentLike, options: DocumentCombinerOptions) {\n // Setting baseDocument redundantly because TS doesn't understand that updateBaseDocument does it\n this.baseDocument = baseDocument;\n this.options = options;\n this.updateBaseDocument(baseDocument);\n }\n\n /**\n * Update the starting document for composition process\n *\n * @param baseDocument Base JSON document/JS object that all other documents are added to\n * @returns Recalculated output document given the new starting state and existing other documents\n */\n updateBaseDocument(baseDocument: JsonDocumentLike): JsonDocumentLike | undefined {\n this.validateBaseDocument(baseDocument);\n this.baseDocument = this.options.copyDocuments ? deepClone(baseDocument) : baseDocument;\n this.baseDocument = this.transformBaseDocumentAfterValidation(this.baseDocument);\n return this.rebuild();\n }\n\n /**\n * Add or update one of the contribution documents for the composition process\n *\n * Note: the order in which contribution documents are added can be considered to be indeterminate\n * as it is currently ordered by however `Map.forEach` provides the contributions. The order\n * matters when merging two arrays into one. Also, when `options.ignoreDuplicateProperties` is\n * `true`, the order also matters when adding the same property to an object that is already\n * provided previously. Please let us know if you have trouble because of indeterminate\n * contribution ordering.\n *\n * @param documentName Name of the contributed document to combine\n * @param document Content of the contributed document to combine\n * @returns Recalculated output document given the new or updated contribution and existing other\n * documents\n */\n addOrUpdateContribution(\n documentName: string,\n document: JsonDocumentLike,\n ): JsonDocumentLike | undefined {\n this.validateContribution(documentName, document);\n const previousDocumentVersion = this.contributions.get(documentName);\n let documentToSet = this.options.copyDocuments && !!document ? deepClone(document) : document;\n documentToSet = this.transformContributionAfterValidation(documentName, documentToSet);\n this.contributions.set(documentName, documentToSet);\n try {\n return this.rebuild();\n } catch (error) {\n // If the output isn't valid after adding/updating the contribution, put it back how it was\n if (previousDocumentVersion) this.contributions.set(documentName, previousDocumentVersion);\n else this.contributions.delete(documentName);\n throw new Error(`Error when setting the document named ${documentName}: ${error}`);\n }\n }\n\n /**\n * Delete one of the contribution documents for the composition process\n *\n * @param documentName Name of the contributed document to delete\n * @returns Recalculated output document given the remaining other documents\n */\n deleteContribution(documentName: string): JsonDocumentLike | undefined {\n const document = this.contributions.get(documentName);\n if (!document) throw new Error(`${documentName} does not exist`);\n this.contributions.delete(documentName);\n try {\n return this.rebuild();\n } catch (error) {\n // If the output isn't valid after deleting the contribution, put it back and rethrow\n this.contributions.set(documentName, document);\n throw new Error(`Error when deleting the document named ${documentName}: ${error}`);\n }\n }\n\n /**\n * Delete all present contribution documents for the composition process and return to the base\n * document\n *\n * @returns Recalculated output document consisting only of the base document\n */\n deleteAllContributions(): JsonDocumentLike | undefined {\n if (this.contributions.size <= 0) return this.latestOutput;\n\n // Save out all contributions\n const contributions = [...this.contributions.entries()];\n\n // Delete all contributions\n contributions.forEach(([contributionName]) => this.contributions.delete(contributionName));\n\n // Rebuild with no contributions\n try {\n return this.rebuild();\n } catch (error) {\n // If the output isn't valid after deleting all contributions, put them back and rethrow\n contributions.forEach(([contributionName, document]) =>\n this.contributions.set(contributionName, document),\n );\n throw new Error(`Error when deleting all contributions: ${error}`);\n }\n }\n\n /**\n * Run the document composition process given the starting document and all contributions. Throws\n * if the output document fails to validate properly.\n *\n * @returns Recalculated output document given the starting and contributed documents\n */\n rebuild(): JsonDocumentLike | undefined {\n // The starting document is the output if there are no other contributions\n if (this.contributions.size === 0) {\n let potentialOutput = deepClone(this.baseDocument);\n potentialOutput = this.transformFinalOutputBeforeValidation(potentialOutput);\n this.validateOutput(potentialOutput);\n this.latestOutput = potentialOutput;\n this.onDidRebuildEmitter.emit(undefined);\n return this.latestOutput;\n }\n\n // Compose the output by validating each document one at a time to pinpoint errors better\n let outputIteration = this.baseDocument;\n this.contributions.forEach((contribution: JsonDocumentLike) => {\n outputIteration = mergeObjects(\n outputIteration,\n contribution,\n this.options.ignoreDuplicateProperties,\n );\n this.validateOutput(outputIteration);\n });\n outputIteration = this.transformFinalOutputBeforeValidation(outputIteration);\n this.validateOutput(outputIteration);\n this.latestOutput = outputIteration;\n this.onDidRebuildEmitter.emit(undefined);\n return this.latestOutput;\n }\n\n /**\n * Transform the starting document that is given to the combiner. This transformation occurs after\n * validating the base document and before combining any contributions.\n *\n * WARNING: If you do not create the combiner with option `copyDocuments: true` or clone inside\n * this method, this method will directly modify the `baseDocument` passed in.\n *\n * @param baseDocument Initial input document. Already validated via `validateBaseDocument`\n * @returns Transformed base document\n */\n // We just don't need `this` here. This is basically a no-op function that is available to child\n // classes to override\n // eslint-disable-next-line @typescript-eslint/class-methods-use-this\n protected transformBaseDocumentAfterValidation(baseDocument: JsonDocumentLike): JsonDocumentLike {\n return baseDocument;\n }\n\n /**\n * Transform the contributed document associated with `documentName`. This transformation occurs\n * after validating the contributed document and before combining with other documents.\n *\n * WARNING: If you do not create the combiner with option `copyDocuments: true` or clone inside\n * this method, this method will directly modify the contributed `document` passed in.\n *\n * @param documentName Name of the contributed document to combine\n * @param document Content of the contributed document to combine. Already validated via\n * `validateContribution`\n * @returns Transformed contributed document\n */\n // We just don't need `this` here. This is basically a no-op function that is available to child\n // classes to override\n // eslint-disable-next-line @typescript-eslint/class-methods-use-this\n protected transformContributionAfterValidation(\n // @ts-expect-error this parameter is unused but may be used in child classes\n documentName: string,\n document: JsonDocumentLike,\n ): JsonDocumentLike {\n return document;\n }\n\n /**\n * Throw an error if the provided document is not a valid starting document.\n *\n * @param baseDocument Base JSON document/JS object that all other documents are added to\n */\n // no-op intended to be overridden by child classes. Can't be static\n // @ts-expect-error ts(6133) parameter doesn't need to be used but still needs the right name\n // eslint-disable-next-line @typescript-eslint/class-methods-use-this, @typescript-eslint/no-unused-vars\n protected validateBaseDocument(baseDocument: JsonDocumentLike): void {}\n\n /**\n * Throw an error if the provided document is not a valid contribution document.\n *\n * @param documentName Name of the contributed document to combine\n * @param document Content of the contributed document to combine\n */\n // no-op intended to be overridden by child classes. Can't be static\n // @ts-expect-error ts(6133) parameter doesn't need to be used but still needs the right name\n // eslint-disable-next-line @typescript-eslint/class-methods-use-this, @typescript-eslint/no-unused-vars\n protected validateContribution(documentName: string, document: JsonDocumentLike): void {}\n\n /**\n * Throw an error if the provided output is not valid.\n *\n * @param output Output document that could potentially be returned to callers\n */\n // no-op intended to be overridden by child classes. Can't be static\n // @ts-expect-error ts(6133) parameter doesn't need to be used but still needs the right name\n // eslint-disable-next-line @typescript-eslint/class-methods-use-this, @typescript-eslint/no-unused-vars\n protected validateOutput(output: JsonDocumentLike): void {}\n\n /**\n * Transform the document that is the composition of the base document and all contribution\n * documents. This is the last step that will be run prior to validation via `validateOutput`\n * before `this.latestOutput` is updated to the new output.\n *\n * @param finalOutput Final output document that could potentially be returned to callers. \"Final\"\n * means no further contribution documents will be merged.\n */\n // no-op intended to be overridden by child classes. Can't be static\n // eslint-disable-next-line @typescript-eslint/class-methods-use-this\n protected transformFinalOutputBeforeValidation(finalOutput: JsonDocumentLike): JsonDocumentLike {\n return finalOutput;\n }\n}\n\n// #region Helper functions\n\n/**\n * Determines if the input values are objects but not arrays\n *\n * @param values Objects to check\n * @returns True if all the values are objects but not arrays\n */\nfunction areNonArrayObjects(...values: unknown[]): boolean {\n let allMatch = true;\n values.forEach((value: unknown) => {\n if (!value || typeof value !== 'object' || Array.isArray(value)) allMatch = false;\n });\n return allMatch;\n}\n\n/**\n * Determines if the input values are arrays\n *\n * @param value Objects to check\n * @returns True if the values are arrays\n */\nfunction areArrayObjects(...values: unknown[]): boolean {\n let allMatch = true;\n values.forEach((value: unknown) => {\n if (!value || typeof value !== 'object' || !Array.isArray(value)) allMatch = false;\n });\n return allMatch;\n}\n\n/**\n * Deep clone and recursively merge the properties of one object (copyFrom) into another\n * (startingPoint). Throws if copyFrom would overwrite values already existing in startingPoint.\n *\n * Does not modify the objects passed in.\n *\n * @param startingPoint Object that is the starting point for the return value\n * @param copyFrom Object whose values are copied into the return value\n * @param ignoreDuplicateProperties Whether to ignore object properties that are present in\n * `copyFrom` that are already present in `startingPoint`. If `false`, throws when an object\n * property in `copyFrom` is already present in `startingPoint`\n * @returns Object that is the combination of the two documents\n */\nfunction mergeObjects(\n startingPoint: JsonDocumentLike,\n copyFrom: JsonDocumentLike,\n ignoreDuplicateProperties: boolean,\n): JsonDocumentLike {\n const retVal = deepClone(startingPoint);\n\n if (!copyFrom) return retVal;\n\n return mergeObjectsInternal(retVal, deepClone(copyFrom), ignoreDuplicateProperties);\n}\n\n/**\n * Recursively merge the properties of one object (copyFrom) into another (startingPoint). Throws if\n * copyFrom would overwrite values already existing in startingPoint.\n *\n * WARNING: Modifies the argument objects in some way. Recommended to use `mergeObjects`\n *\n * @param startingPoint Object that is the starting point for the return value\n * @param copyFrom Object whose values are copied into the return value\n * @param ignoreDuplicateProperties Whether to ignore object properties that are present in\n * `copyFrom` that are already present in `startingPoint`. If `false`, throws when an object\n * property in `copyFrom` is already present in `startingPoint`\n * @returns Object that is the combination of the two documents\n */\nfunction mergeObjectsInternal(\n startingPoint: JsonDocumentLike,\n copyFrom: JsonDocumentLike,\n ignoreDuplicateProperties: boolean,\n): JsonDocumentLike {\n if (!copyFrom) return startingPoint;\n\n if (areNonArrayObjects(startingPoint, copyFrom)) {\n // Merge properties since they are both objects\n\n // We know these are objects from the `if` check\n /* eslint-disable no-type-assertion/no-type-assertion */\n const startingPointObj = startingPoint as JsonObjectLike;\n const copyFromObj = copyFrom as JsonObjectLike;\n /* eslint-enable no-type-assertion/no-type-assertion */\n Object.keys(copyFromObj).forEach((key: string | number) => {\n if (Object.hasOwn(startingPointObj, key)) {\n if (areNonArrayObjects(startingPointObj[key], copyFromObj[key])) {\n startingPointObj[key] = mergeObjectsInternal(\n // We know these are objects from the `if` check\n /* eslint-disable no-type-assertion/no-type-assertion */\n startingPointObj[key] as JsonObjectLike,\n copyFromObj[key] as JsonObjectLike,\n ignoreDuplicateProperties,\n /* eslint-enable no-type-assertion/no-type-assertion */\n );\n } else if (areArrayObjects(startingPointObj[key], copyFromObj[key])) {\n // Concat the arrays since they are both arrays\n\n // We know these are arrays from the `else if` check\n /* eslint-disable no-type-assertion/no-type-assertion */\n startingPointObj[key] = (startingPointObj[key] as JsonArrayLike).concat(\n copyFromObj[key] as JsonArrayLike,\n );\n /* eslint-enable no-type-assertion/no-type-assertion */\n } else if (!ignoreDuplicateProperties)\n throw new Error(`Cannot merge objects: key \"${key}\" already exists in the target object`);\n // Note that the first non-object non-array value that gets placed in a property stays.\n // New values do not override existing ones\n } else {\n startingPointObj[key] = copyFromObj[key];\n }\n });\n } else if (areArrayObjects(startingPoint, copyFrom)) {\n // Concat the arrays since they are both arrays\n\n // Push the contents of copyFrom into startingPoint since it is a const and was already deep cloned\n // We know these are objects from the `else if` check\n /* eslint-disable no-type-assertion/no-type-assertion */\n (startingPoint as JsonArrayLike).push(...(copyFrom as JsonArrayLike));\n /* eslint-enable no-type-assertion/no-type-assertion */\n }\n\n // Note that nothing happens if `startingPoint` is not an object or an array or if `startingPoint`\n // and `copyFrom` are not both object or both arrays. Should we throw? Should we push `copyFrom`'s\n // values into the array? Other? Maybe one day we can add some options to decide what to do in\n // this situation, but YAGNI for now\n\n return startingPoint;\n}\n\n// #endregion\n","import { Mutex as AsyncMutex } from 'async-mutex';\n\n// Extending Mutex from async-mutex so we can add JSDoc\n\n/**\n * Class that allows calling asynchronous functions multiple times at once while only running one at\n * a time.\n *\n * @example\n *\n * ```typescript\n * const mutex = new Mutex();\n *\n * mutex.runExclusive(async () => {\n * // Do some asynchronous stuff\n * console.log('These run one-at-a-time');\n * });\n *\n * mutex.runExclusive(async () => {\n * // Do some asynchronous stuff\n * console.log('These run one-at-a-time');\n * });\n * ```\n *\n * See [`async-mutex`](https://www.npmjs.com/package/async-mutex) for more information.\n */\nclass Mutex extends AsyncMutex {}\n\nexport default Mutex;\n","import Mutex from './mutex';\n\n/** Map of {@link Mutex}es that automatically (lazily) generates a new {@link Mutex} for any new key */\nclass MutexMap {\n private mutexesByID = new Map();\n\n get(mutexID: string): Mutex {\n let retVal = this.mutexesByID.get(mutexID);\n if (retVal) return retVal;\n\n retVal = new Mutex();\n this.mutexesByID.set(mutexID, retVal);\n return retVal;\n }\n}\n\nexport default MutexMap;\n","import DocumentCombiner, { DocumentCombinerOptions, JsonDocumentLike } from './document-combiner';\n\nexport default class NonValidatingDocumentCombiner extends DocumentCombiner {\n // Making the protected base constructor public\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(baseDocument: JsonDocumentLike, options: DocumentCombinerOptions) {\n super(baseDocument, options);\n }\n\n get output(): JsonDocumentLike | undefined {\n return this.latestOutput;\n }\n}\n","/** Enables language-sensitive number formatting. Wraps Intl.NumberFormat */\nexport default class NumberFormat {\n private numberFormatter: Intl.NumberFormat;\n\n constructor(locales?: string | string[], options?: Intl.NumberFormatOptions) {\n this.numberFormatter = new Intl.NumberFormat(locales, options);\n }\n\n /**\n * Formats a number according to the locale and formatting options of this NumberFormat object\n *\n * @param value Number or BigInt to format\n * @returns String representing the given number formatted according to the locale and formatting\n * options of this NumberFormat object\n */\n format(value: number | bigint): string {\n return this.numberFormatter.format(value);\n }\n\n /**\n * Formats a range of numbers according to the locale and formatting options of this NumberFormat\n * object\n *\n * @param startRange Number or bigint representing the start of the range\n * @param endRange Number or bigint representing the end of the range\n * @returns String representing the given range of numbers formatted according to the locale and\n * formatting options of this NumberFormat object\n */\n formatRange(startRange: number | bigint, endRange: number | bigint): string {\n return this.numberFormatter.formatRange(startRange, endRange);\n }\n\n /**\n * Returns an array of objects containing the locale-specific tokens from which it is possible to\n * build custom strings while preserving the locale-specific parts.\n *\n * @param startRange Number or bigint representing start of the range\n * @param endRange Number or bigint representing end of the range\n * @returns Array of NumberRangeFormatPart objects containing the formatted range of numbers in\n * parts\n */\n formatRangeToParts(\n startRange: number | bigint,\n endRange: number | bigint,\n ): Intl.NumberRangeFormatPart[] {\n return this.numberFormatter.formatRangeToParts(startRange, endRange);\n }\n\n /**\n * Allows locale-aware formatting of strings produced by this NumberFormat object\n *\n * @param value Number or bigint to format\n * @returns Array of NumberFormatPart objects containing the formatted number in parts\n */\n formatToParts(value: number | bigint): Intl.NumberFormatPart[] {\n return this.numberFormatter.formatToParts(value);\n }\n\n /**\n * Returns a new object with properties reflecting the locale and number formatting options\n * computed during initialization of this NumberFormat object\n *\n * @returns ResolvedNumberFormatOptions object\n */\n resolvedOptions(): Intl.ResolvedNumberFormatOptions {\n return this.numberFormatter.resolvedOptions();\n }\n}\n","import { Dispose } from './disposal.model';\nimport { Unsubscriber, UnsubscriberAsync } from './unsubscriber';\n\n/** Simple collection for UnsubscriberAsync objects that also provides an easy way to run them. */\nexport default class UnsubscriberAsyncList {\n readonly unsubscribers = new Set();\n\n constructor(private name = 'Anonymous') {}\n\n /**\n * Add unsubscribers to the list. Note that duplicates are not added twice.\n *\n * @param unsubscribers - Objects that were returned from a registration process.\n */\n add(...unsubscribers: (UnsubscriberAsync | Unsubscriber | Dispose)[]) {\n unsubscribers.forEach((unsubscriber) => {\n if ('dispose' in unsubscriber) this.unsubscribers.add(unsubscriber.dispose);\n else this.unsubscribers.add(unsubscriber);\n });\n }\n\n /**\n * Run all unsubscribers added to this list and then clear the list.\n *\n * @returns `true` if all unsubscribers succeeded, `false` otherwise.\n */\n async runAllUnsubscribers(): Promise {\n const unsubs = [...this.unsubscribers].map((unsubscriber) => unsubscriber());\n const results = await Promise.all(unsubs);\n this.unsubscribers.clear();\n return results.every((unsubscriberSucceeded, index) => {\n if (!unsubscriberSucceeded)\n console.error(`UnsubscriberAsyncList ${this.name}: Unsubscriber at index ${index} failed!`);\n\n return unsubscriberSucceeded;\n });\n }\n}\n","var P = Object.defineProperty;\nvar R = (t, e, s) => e in t ? P(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;\nvar n = (t, e, s) => R(t, typeof e != \"symbol\" ? e + \"\" : e, s);\nclass _ {\n constructor() {\n n(this, \"books\");\n n(this, \"firstSelectedBookNum\");\n n(this, \"lastSelectedBookNum\");\n n(this, \"count\");\n n(this, \"selectedBookNumbers\");\n n(this, \"selectedBookIds\");\n }\n}\nconst N = [\n \"GEN\",\n \"EXO\",\n \"LEV\",\n \"NUM\",\n \"DEU\",\n \"JOS\",\n \"JDG\",\n \"RUT\",\n \"1SA\",\n \"2SA\",\n // 10\n \"1KI\",\n \"2KI\",\n \"1CH\",\n \"2CH\",\n \"EZR\",\n \"NEH\",\n \"EST\",\n \"JOB\",\n \"PSA\",\n \"PRO\",\n // 20\n \"ECC\",\n \"SNG\",\n \"ISA\",\n \"JER\",\n \"LAM\",\n \"EZK\",\n \"DAN\",\n \"HOS\",\n \"JOL\",\n \"AMO\",\n // 30\n \"OBA\",\n \"JON\",\n \"MIC\",\n \"NAM\",\n \"HAB\",\n \"ZEP\",\n \"HAG\",\n \"ZEC\",\n \"MAL\",\n \"MAT\",\n // 40\n \"MRK\",\n \"LUK\",\n \"JHN\",\n \"ACT\",\n \"ROM\",\n \"1CO\",\n \"2CO\",\n \"GAL\",\n \"EPH\",\n \"PHP\",\n // 50\n \"COL\",\n \"1TH\",\n \"2TH\",\n \"1TI\",\n \"2TI\",\n \"TIT\",\n \"PHM\",\n \"HEB\",\n \"JAS\",\n \"1PE\",\n // 60\n \"2PE\",\n \"1JN\",\n \"2JN\",\n \"3JN\",\n \"JUD\",\n \"REV\",\n \"TOB\",\n \"JDT\",\n \"ESG\",\n \"WIS\",\n // 70\n \"SIR\",\n \"BAR\",\n \"LJE\",\n \"S3Y\",\n \"SUS\",\n \"BEL\",\n \"1MA\",\n \"2MA\",\n \"3MA\",\n \"4MA\",\n // 80\n \"1ES\",\n \"2ES\",\n \"MAN\",\n \"PS2\",\n \"ODA\",\n \"PSS\",\n \"JSA\",\n // actual variant text for JOS, now in LXA text\n \"JDB\",\n // actual variant text for JDG, now in LXA text\n \"TBS\",\n // actual variant text for TOB, now in LXA text\n \"SST\",\n // actual variant text for SUS, now in LXA text // 90\n \"DNT\",\n // actual variant text for DAN, now in LXA text\n \"BLT\",\n // actual variant text for BEL, now in LXA text\n \"XXA\",\n \"XXB\",\n \"XXC\",\n \"XXD\",\n \"XXE\",\n \"XXF\",\n \"XXG\",\n \"FRT\",\n // 100\n \"BAK\",\n \"OTH\",\n \"3ES\",\n // Used previously but really should be 2ES\n \"EZA\",\n // Used to be called 4ES, but not actually in any known project\n \"5EZ\",\n // Used to be called 5ES, but not actually in any known project\n \"6EZ\",\n // Used to be called 6ES, but not actually in any known project\n \"INT\",\n \"CNC\",\n \"GLO\",\n \"TDX\",\n // 110\n \"NDX\",\n \"DAG\",\n \"PS3\",\n \"2BA\",\n \"LBA\",\n \"JUB\",\n \"ENO\",\n \"1MQ\",\n \"2MQ\",\n \"3MQ\",\n // 120\n \"REP\",\n \"4BA\",\n \"LAO\"\n], B = [\n \"XXA\",\n \"XXB\",\n \"XXC\",\n \"XXD\",\n \"XXE\",\n \"XXF\",\n \"XXG\",\n \"FRT\",\n \"BAK\",\n \"OTH\",\n \"INT\",\n \"CNC\",\n \"GLO\",\n \"TDX\",\n \"NDX\"\n], O = [\n \"Genesis\",\n \"Exodus\",\n \"Leviticus\",\n \"Numbers\",\n \"Deuteronomy\",\n \"Joshua\",\n \"Judges\",\n \"Ruth\",\n \"1 Samuel\",\n \"2 Samuel\",\n \"1 Kings\",\n \"2 Kings\",\n \"1 Chronicles\",\n \"2 Chronicles\",\n \"Ezra\",\n \"Nehemiah\",\n \"Esther (Hebrew)\",\n \"Job\",\n \"Psalms\",\n \"Proverbs\",\n \"Ecclesiastes\",\n \"Song of Songs\",\n \"Isaiah\",\n \"Jeremiah\",\n \"Lamentations\",\n \"Ezekiel\",\n \"Daniel (Hebrew)\",\n \"Hosea\",\n \"Joel\",\n \"Amos\",\n \"Obadiah\",\n \"Jonah\",\n \"Micah\",\n \"Nahum\",\n \"Habakkuk\",\n \"Zephaniah\",\n \"Haggai\",\n \"Zechariah\",\n \"Malachi\",\n \"Matthew\",\n \"Mark\",\n \"Luke\",\n \"John\",\n \"Acts\",\n \"Romans\",\n \"1 Corinthians\",\n \"2 Corinthians\",\n \"Galatians\",\n \"Ephesians\",\n \"Philippians\",\n \"Colossians\",\n \"1 Thessalonians\",\n \"2 Thessalonians\",\n \"1 Timothy\",\n \"2 Timothy\",\n \"Titus\",\n \"Philemon\",\n \"Hebrews\",\n \"James\",\n \"1 Peter\",\n \"2 Peter\",\n \"1 John\",\n \"2 John\",\n \"3 John\",\n \"Jude\",\n \"Revelation\",\n \"Tobit\",\n \"Judith\",\n \"Esther Greek\",\n \"Wisdom of Solomon\",\n \"Sirach (Ecclesiasticus)\",\n \"Baruch\",\n \"Letter of Jeremiah\",\n \"Song of 3 Young Men\",\n \"Susanna\",\n \"Bel and the Dragon\",\n \"1 Maccabees\",\n \"2 Maccabees\",\n \"3 Maccabees\",\n \"4 Maccabees\",\n \"1 Esdras (Greek)\",\n \"2 Esdras (Latin)\",\n \"Prayer of Manasseh\",\n \"Psalm 151\",\n \"Odes\",\n \"Psalms of Solomon\",\n // WARNING, if you change the spelling of the *obsolete* tag be sure to update\n // IsObsolete routine\n \"Joshua A. *obsolete*\",\n \"Judges B. *obsolete*\",\n \"Tobit S. *obsolete*\",\n \"Susanna Th. *obsolete*\",\n \"Daniel Th. *obsolete*\",\n \"Bel Th. *obsolete*\",\n \"Extra A\",\n \"Extra B\",\n \"Extra C\",\n \"Extra D\",\n \"Extra E\",\n \"Extra F\",\n \"Extra G\",\n \"Front Matter\",\n \"Back Matter\",\n \"Other Matter\",\n \"3 Ezra *obsolete*\",\n \"Apocalypse of Ezra\",\n \"5 Ezra (Latin Prologue)\",\n \"6 Ezra (Latin Epilogue)\",\n \"Introduction\",\n \"Concordance \",\n \"Glossary \",\n \"Topical Index\",\n \"Names Index\",\n \"Daniel Greek\",\n \"Psalms 152-155\",\n \"2 Baruch (Apocalypse)\",\n \"Letter of Baruch\",\n \"Jubilees\",\n \"Enoch\",\n \"1 Meqabyan\",\n \"2 Meqabyan\",\n \"3 Meqabyan\",\n \"Reproof (Proverbs 25-31)\",\n \"4 Baruch (Rest of Baruch)\",\n \"Laodiceans\"\n], S = K();\nfunction g(t, e = !0) {\n return e && (t = t.toUpperCase()), t in S ? S[t] : 0;\n}\nfunction k(t) {\n return g(t) > 0;\n}\nfunction x(t) {\n const e = typeof t == \"string\" ? g(t) : t;\n return e >= 40 && e <= 66;\n}\nfunction T(t) {\n return (typeof t == \"string\" ? g(t) : t) <= 39;\n}\nfunction X(t) {\n return t <= 66;\n}\nfunction V(t) {\n const e = typeof t == \"string\" ? g(t) : t;\n return w(e) && !X(e);\n}\nfunction* L() {\n for (let t = 1; t <= N.length; t++) yield t;\n}\nconst G = 1, A = N.length;\nfunction H() {\n return [\"XXA\", \"XXB\", \"XXC\", \"XXD\", \"XXE\", \"XXF\", \"XXG\"];\n}\nfunction C(t, e = \"***\") {\n const s = t - 1;\n return s < 0 || s >= N.length ? e : N[s];\n}\nfunction I(t) {\n return t <= 0 || t > A ? \"******\" : O[t - 1];\n}\nfunction y(t) {\n return I(g(t));\n}\nfunction w(t) {\n const e = typeof t == \"number\" ? C(t) : t;\n return k(e) && !B.includes(e);\n}\nfunction q(t) {\n const e = typeof t == \"number\" ? C(t) : t;\n return k(e) && B.includes(e);\n}\nfunction U(t) {\n return O[t - 1].includes(\"*obsolete*\");\n}\nfunction K() {\n const t = {};\n for (let e = 0; e < N.length; e++)\n t[N[e]] = e + 1;\n return t;\n}\nconst m = {\n allBookIds: N,\n nonCanonicalIds: B,\n bookIdToNumber: g,\n isBookIdValid: k,\n isBookNT: x,\n isBookOT: T,\n isBookOTNT: X,\n isBookDC: V,\n allBookNumbers: L,\n firstBook: G,\n lastBook: A,\n extraBooks: H,\n bookNumberToId: C,\n bookNumberToEnglishName: I,\n bookIdToEnglishName: y,\n isCanonical: w,\n isExtraMaterial: q,\n isObsolete: U\n};\nvar l = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = \"Unknown\", t[t.Original = 1] = \"Original\", t[t.Septuagint = 2] = \"Septuagint\", t[t.Vulgate = 3] = \"Vulgate\", t[t.English = 4] = \"English\", t[t.RussianProtestant = 5] = \"RussianProtestant\", t[t.RussianOrthodox = 6] = \"RussianOrthodox\", t))(l || {});\nconst h = class h {\n // private versInfo: Versification;\n constructor(e) {\n n(this, \"name\");\n n(this, \"fullPath\");\n n(this, \"isPresent\");\n n(this, \"hasVerseSegments\");\n n(this, \"isCustomized\");\n n(this, \"baseVersification\");\n n(this, \"scriptureBooks\");\n n(this, \"_type\");\n if (e == null)\n throw new Error(\"Argument undefined\");\n typeof e == \"string\" ? (this.name = e, this._type = l[e]) : (this._type = e, this.name = l[e]);\n }\n get type() {\n return this._type;\n }\n equals(e) {\n return !e.type || !this.type ? !1 : e.type === this.type;\n }\n};\nn(h, \"Original\", new h(l.Original)), n(h, \"Septuagint\", new h(l.Septuagint)), n(h, \"Vulgate\", new h(l.Vulgate)), n(h, \"English\", new h(l.English)), n(h, \"RussianProtestant\", new h(l.RussianProtestant)), n(h, \"RussianOrthodox\", new h(l.RussianOrthodox));\nlet c = h;\nfunction E(t, e) {\n const s = e[0];\n for (let r = 1; r < e.length; r++)\n t = t.split(e[r]).join(s);\n return t.split(s);\n}\nvar D = /* @__PURE__ */ ((t) => (t[t.Valid = 0] = \"Valid\", t[t.UnknownVersification = 1] = \"UnknownVersification\", t[t.OutOfRange = 2] = \"OutOfRange\", t[t.VerseOutOfOrder = 3] = \"VerseOutOfOrder\", t[t.VerseRepeated = 4] = \"VerseRepeated\", t))(D || {});\nconst i = class i {\n constructor(e, s, r, a) {\n /** Not yet implemented. */\n n(this, \"firstChapter\");\n /** Not yet implemented. */\n n(this, \"lastChapter\");\n /** Not yet implemented. */\n n(this, \"lastVerse\");\n /** Not yet implemented. */\n n(this, \"hasSegmentsDefined\");\n /** Not yet implemented. */\n n(this, \"text\");\n /** Not yet implemented. */\n n(this, \"BBBCCCVVVS\");\n /** Not yet implemented. */\n n(this, \"longHashCode\");\n /** The versification of the reference. */\n n(this, \"versification\");\n n(this, \"rtlMark\", \"‏\");\n n(this, \"_bookNum\", 0);\n n(this, \"_chapterNum\", 0);\n n(this, \"_verseNum\", 0);\n n(this, \"_verse\");\n if (r == null && a == null)\n if (e != null && typeof e == \"string\") {\n const o = e, u = s != null && s instanceof c ? s : void 0;\n this.setEmpty(u), this.parse(o);\n } else if (e != null && typeof e == \"number\") {\n const o = s != null && s instanceof c ? s : void 0;\n this.setEmpty(o), this._verseNum = e % i.chapterDigitShifter, this._chapterNum = Math.floor(\n e % i.bookDigitShifter / i.chapterDigitShifter\n ), this._bookNum = Math.floor(e / i.bookDigitShifter);\n } else if (s == null)\n if (e != null && e instanceof i) {\n const o = e;\n this._bookNum = o.bookNum, this._chapterNum = o.chapterNum, this._verseNum = o.verseNum, this._verse = o.verse, this.versification = o.versification;\n } else {\n if (e == null) return;\n const o = e instanceof c ? e : i.defaultVersification;\n this.setEmpty(o);\n }\n else\n throw new Error(\"VerseRef constructor not supported.\");\n else if (e != null && s != null && r != null)\n if (typeof e == \"string\" && typeof s == \"string\" && typeof r == \"string\")\n this.setEmpty(a), this.updateInternal(e, s, r);\n else if (typeof e == \"number\" && typeof s == \"number\" && typeof r == \"number\")\n this._bookNum = e, this._chapterNum = s, this._verseNum = r, this.versification = a ?? i.defaultVersification;\n else\n throw new Error(\"VerseRef constructor not supported.\");\n else\n throw new Error(\"VerseRef constructor not supported.\");\n }\n /**\n * Determines if the verse string is in a valid format (does not consider versification).\n */\n static isVerseParseable(e) {\n return e.length > 0 && \"0123456789\".includes(e[0]) && !e.endsWith(this.verseRangeSeparator) && !e.endsWith(this.verseSequenceIndicator);\n }\n /**\n * Tries to parse the specified string into a verse reference.\n * @param str - The string to attempt to parse.\n * @returns success: `true` if the specified string was successfully parsed, `false` otherwise.\n * @returns verseRef: The result of the parse if successful, or empty VerseRef if it failed\n */\n static tryParse(e) {\n let s;\n try {\n return s = new i(e), { success: !0, verseRef: s };\n } catch (r) {\n if (r instanceof v)\n return s = new i(), { success: !1, verseRef: s };\n throw r;\n }\n }\n /**\n * Gets the reference as a comparable integer where the book, chapter, and verse each occupy 3\n * digits.\n * @param bookNum - Book number (this is 1-based, not an index).\n * @param chapterNum - Chapter number.\n * @param verseNum - Verse number.\n * @returns The reference as a comparable integer where the book, chapter, and verse each occupy 3\n * digits.\n */\n static getBBBCCCVVV(e, s, r) {\n return e % i.bcvMaxValue * i.bookDigitShifter + (s >= 0 ? s % i.bcvMaxValue * i.chapterDigitShifter : 0) + (r >= 0 ? r % i.bcvMaxValue : 0);\n }\n /**\n * Deserializes a serialized VerseRef.\n * @param serializedVerseRef - Serialized VerseRef to create from.\n * @returns the deserialized VerseRef.\n */\n static fromJSON(e) {\n const { book: s, chapterNum: r, verseNum: a, verse: o, versificationStr: u } = e, f = o || a.toString();\n let d;\n return u && (d = new c(u)), s ? new i(s, r.toString(), f, d) : new i();\n }\n /**\n * Parses a verse string and gets the leading numeric portion as a number.\n * @param verseStr - verse string to parse\n * @returns true if the entire string could be parsed as a single, simple verse number (1-999);\n * false if the verse string represented a verse bridge, contained segment letters, or was invalid\n */\n static tryGetVerseNum(e) {\n let s;\n if (!e)\n return s = -1, { success: !0, vNum: s };\n s = 0;\n let r;\n for (let a = 0; a < e.length; a++) {\n if (r = e[a], r < \"0\" || r > \"9\")\n return a === 0 && (s = -1), { success: !1, vNum: s };\n if (s = s * 10 + +r - 0, s > i.bcvMaxValue)\n return s = -1, { success: !1, vNum: s };\n }\n return { success: !0, vNum: s };\n }\n /**\n * Checks to see if a VerseRef hasn't been set - all values are the default.\n */\n get isDefault() {\n return this.bookNum === 0 && this.chapterNum === 0 && this.verseNum === 0 && this.versification == null;\n }\n /**\n * Gets whether the verse contains multiple verses.\n */\n get hasMultiple() {\n return this._verse != null && (this._verse.includes(i.verseRangeSeparator) || this._verse.includes(i.verseSequenceIndicator));\n }\n /**\n * Gets or sets the book of the reference. Book is the 3-letter abbreviation in capital letters,\n * e.g. `'MAT'`.\n */\n get book() {\n return m.bookNumberToId(this.bookNum, \"\");\n }\n set book(e) {\n this.bookNum = m.bookIdToNumber(e);\n }\n /**\n * Gets or sets the chapter of the reference,. e.g. `'3'`.\n */\n get chapter() {\n return this.isDefault || this._chapterNum < 0 ? \"\" : this._chapterNum.toString();\n }\n set chapter(e) {\n const s = +e;\n this._chapterNum = Number.isInteger(s) ? s : -1;\n }\n /**\n * Gets or sets the verse of the reference, including range, segments, and sequences, e.g. `'4'`,\n * or `'4b-5a, 7'`.\n */\n get verse() {\n return this._verse != null ? this._verse : this.isDefault || this._verseNum < 0 ? \"\" : this._verseNum.toString();\n }\n set verse(e) {\n const { success: s, vNum: r } = i.tryGetVerseNum(e);\n this._verse = s ? void 0 : e.replace(this.rtlMark, \"\"), this._verseNum = r, !(this._verseNum >= 0) && ({ vNum: this._verseNum } = i.tryGetVerseNum(this._verse));\n }\n /**\n * Get or set Book based on book number, e.g. `42`.\n */\n get bookNum() {\n return this._bookNum;\n }\n set bookNum(e) {\n if (e <= 0 || e > m.lastBook)\n throw new v(\n \"BookNum must be greater than zero and less than or equal to last book\"\n );\n this._bookNum = e;\n }\n /**\n * Gets or sets the chapter number, e.g. `3`. `-1` if not valid.\n */\n get chapterNum() {\n return this._chapterNum;\n }\n set chapterNum(e) {\n this.chapterNum = e;\n }\n /**\n * Gets or sets verse start number, e.g. `4`. `-1` if not valid.\n */\n get verseNum() {\n return this._verseNum;\n }\n set verseNum(e) {\n this._verseNum = e;\n }\n /**\n * String representing the versification (should ONLY be used for serialization/deserialization).\n *\n * @remarks This is for backwards compatibility when ScrVers was an enumeration.\n */\n get versificationStr() {\n var e;\n return (e = this.versification) == null ? void 0 : e.name;\n }\n set versificationStr(e) {\n this.versification = this.versification != null ? new c(e) : void 0;\n }\n /**\n * Determines if the reference is valid.\n */\n get valid() {\n return this.validStatus === 0;\n }\n /**\n * Get the valid status for this reference.\n */\n get validStatus() {\n return this.validateVerse(i.verseRangeSeparators, i.verseSequenceIndicators);\n }\n /**\n * Gets the reference as a comparable integer where the book,\n * chapter, and verse each occupy three digits and the verse is 0.\n */\n get BBBCCC() {\n return i.getBBBCCCVVV(this._bookNum, this._chapterNum, 0);\n }\n /**\n * Gets the reference as a comparable integer where the book,\n * chapter, and verse each occupy three digits. If verse is not null\n * (i.e., this reference represents a complex reference with verse\n * segments or bridge) this cannot be used for an exact comparison.\n */\n get BBBCCCVVV() {\n return i.getBBBCCCVVV(this._bookNum, this._chapterNum, this._verseNum);\n }\n /**\n * Gets whether the verse is defined as an excluded verse in the versification.\n * Does not handle verse ranges.\n */\n // eslint-disable-next-line @typescript-eslint/class-literal-property-style\n get isExcluded() {\n return !1;\n }\n /**\n * Parses the reference in the specified string.\n * Optionally versification can follow reference as in GEN 3:11/4\n * Throw an exception if\n * - invalid book name\n * - chapter number is missing or not a number\n * - verse number is missing or does not start with a number\n * - versification is invalid\n * @param verseStr - string to parse e.g. 'MAT 3:11'\n */\n parse(e) {\n if (e = e.replace(this.rtlMark, \"\"), e.includes(\"/\")) {\n const o = e.split(\"/\");\n if (e = o[0], o.length > 1)\n try {\n const u = +o[1].trim();\n this.versification = new c(l[u]);\n } catch {\n throw new v(\"Invalid reference : \" + e);\n }\n }\n const s = e.trim().split(\" \");\n if (s.length !== 2)\n throw new v(\"Invalid reference : \" + e);\n const r = s[1].split(\":\"), a = +r[0];\n if (r.length !== 2 || m.bookIdToNumber(s[0]) === 0 || !Number.isInteger(a) || a < 0 || !i.isVerseParseable(r[1]))\n throw new v(\"Invalid reference : \" + e);\n this.updateInternal(s[0], r[0], r[1]);\n }\n /**\n * Simplifies this verse ref so that it has no bridging of verses or\n * verse segments like `'1a'`.\n */\n simplify() {\n this._verse = void 0;\n }\n /**\n * Makes a clone of the reference.\n *\n * @returns The cloned VerseRef.\n */\n clone() {\n return new i(this);\n }\n toString() {\n const e = this.book;\n return e === \"\" ? \"\" : `${e} ${this.chapter}:${this.verse}`;\n }\n toJSON() {\n let e = this.verse;\n (e === \"\" || e === this.verseNum.toString()) && (e = void 0);\n const s = {\n book: this.book,\n chapterNum: this.chapterNum,\n verseNum: this.verseNum,\n verse: e,\n versificationStr: this.versificationStr\n };\n return e || delete s.verse, s;\n }\n /**\n * Compares this `VerseRef` with supplied one.\n * @param verseRef - object to compare this one to.\n * @returns `true` if this `VerseRef` is equal to the supplied one, `false` otherwise.\n */\n equals(e) {\n return e instanceof i ? e._bookNum === this._bookNum && e._chapterNum === this._chapterNum && e._verseNum === this._verseNum && e.verse === this.verse && (e.versification == null && this.versification == null || e.versification != null && this.versification != null && e.versification.equals(this.versification)) : !1;\n }\n /**\n * Enumerate all individual verses contained in a VerseRef.\n * Verse ranges are indicated by \"-\" and consecutive verses by \",\"s.\n * Examples:\n * GEN 1:2 returns GEN 1:2\n * GEN 1:1a-3b,5 returns GEN 1:1a, GEN 1:2, GEN 1:3b, GEN 1:5\n * GEN 1:2a-2c returns //! ??????\n *\n * @param specifiedVersesOnly - if set to true return only verses that are\n * explicitly specified only, not verses within a range. Defaults to `false`.\n * @param verseRangeSeparators - Verse range separators.\n * Defaults to `VerseRef.verseRangeSeparators`.\n * @param verseSequenceSeparators - Verse sequence separators.\n * Defaults to `VerseRef.verseSequenceIndicators`.\n * @returns An array of all single verse references in this VerseRef.\n */\n allVerses(e = !1, s = i.verseRangeSeparators, r = i.verseSequenceIndicators) {\n if (this._verse == null || this.chapterNum <= 0)\n return [this.clone()];\n const a = [], o = E(this._verse, r);\n for (const u of o.map((f) => E(f, s))) {\n const f = this.clone();\n f.verse = u[0];\n const d = f.verseNum;\n if (a.push(f), u.length > 1) {\n const b = this.clone();\n if (b.verse = u[1], !e)\n for (let p = d + 1; p < b.verseNum; p++) {\n const J = new i(\n this._bookNum,\n this._chapterNum,\n p,\n this.versification\n );\n this.isExcluded || a.push(J);\n }\n a.push(b);\n }\n }\n return a;\n }\n /**\n * Validates a verse number using the supplied separators rather than the defaults.\n */\n validateVerse(e, s) {\n if (!this.verse)\n return this.internalValid;\n let r = 0;\n for (const a of this.allVerses(!0, e, s)) {\n const o = a.internalValid;\n if (o !== 0)\n return o;\n const u = a.BBBCCCVVV;\n if (r > u)\n return 3;\n if (r === u)\n return 4;\n r = u;\n }\n return 0;\n }\n /**\n * Gets whether a single verse reference is valid.\n */\n get internalValid() {\n return this.versification == null ? 1 : this._bookNum <= 0 || this._bookNum > m.lastBook ? 2 : (m.isCanonical(this._bookNum), 0);\n }\n setEmpty(e = i.defaultVersification) {\n this._bookNum = 0, this._chapterNum = -1, this._verse = void 0, this.versification = e;\n }\n updateInternal(e, s, r) {\n this.bookNum = m.bookIdToNumber(e), this.chapter = s, this.verse = r;\n }\n};\nn(i, \"defaultVersification\", c.English), n(i, \"verseRangeSeparator\", \"-\"), n(i, \"verseSequenceIndicator\", \",\"), n(i, \"verseRangeSeparators\", [i.verseRangeSeparator]), n(i, \"verseSequenceIndicators\", [i.verseSequenceIndicator]), n(i, \"chapterDigitShifter\", 1e3), n(i, \"bookDigitShifter\", i.chapterDigitShifter * i.chapterDigitShifter), n(i, \"bcvMaxValue\", i.chapterDigitShifter - 1), /**\n * The valid status of the VerseRef.\n */\nn(i, \"ValidStatusType\", D);\nlet M = i;\nclass v extends Error {\n}\nexport {\n _ as BookSet,\n m as Canon,\n c as ScrVers,\n l as ScrVersType,\n M as VerseRef,\n v as VerseRefException\n};\n//# sourceMappingURL=index.es.js.map\n","\"use strict\"\r\n\r\n// Based on: https://github.com/lodash/lodash/blob/6018350ac10d5ce6a5b7db625140b82aeab804df/.internal/unicodeSize.js\r\n\r\nmodule.exports = () => {\r\n\t// Used to compose unicode character classes.\r\n\tconst astralRange = \"\\\\ud800-\\\\udfff\"\r\n\tconst comboMarksRange = \"\\\\u0300-\\\\u036f\"\r\n\tconst comboHalfMarksRange = \"\\\\ufe20-\\\\ufe2f\"\r\n\tconst comboSymbolsRange = \"\\\\u20d0-\\\\u20ff\"\r\n\tconst comboMarksExtendedRange = \"\\\\u1ab0-\\\\u1aff\"\r\n\tconst comboMarksSupplementRange = \"\\\\u1dc0-\\\\u1dff\"\r\n\tconst comboRange = comboMarksRange + comboHalfMarksRange + comboSymbolsRange + comboMarksExtendedRange + comboMarksSupplementRange\r\n\tconst varRange = \"\\\\ufe0e\\\\ufe0f\"\r\n\tconst familyRange = \"\\\\uD83D\\\\uDC69\\\\uD83C\\\\uDFFB\\\\u200D\\\\uD83C\\\\uDF93\"\r\n\r\n\t// Used to compose unicode capture groups.\r\n\tconst astral = `[${astralRange}]`\r\n\tconst combo = `[${comboRange}]`\r\n\tconst fitz = \"\\\\ud83c[\\\\udffb-\\\\udfff]\"\r\n\tconst modifier = `(?:${combo}|${fitz})`\r\n\tconst nonAstral = `[^${astralRange}]`\r\n\tconst regional = \"(?:\\\\uD83C[\\\\uDDE6-\\\\uDDFF]){2}\"\r\n\tconst surrogatePair = \"[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]\"\r\n\tconst zwj = \"\\\\u200d\"\r\n\tconst blackFlag = \"(?:\\\\ud83c\\\\udff4\\\\udb40\\\\udc67\\\\udb40\\\\udc62\\\\udb40(?:\\\\udc65|\\\\udc73|\\\\udc77)\\\\udb40(?:\\\\udc6e|\\\\udc63|\\\\udc6c)\\\\udb40(?:\\\\udc67|\\\\udc74|\\\\udc73)\\\\udb40\\\\udc7f)\"\r\n\tconst family = `[${familyRange}]`\r\n\r\n\t// Used to compose unicode regexes.\r\n\tconst optModifier = `${modifier}?`\r\n\tconst optVar = `[${varRange}]?`\r\n\tconst optJoin = `(?:${zwj}(?:${[nonAstral, regional, surrogatePair].join(\"|\")})${optVar + optModifier})*`\r\n\tconst seq = optVar + optModifier + optJoin\r\n\tconst nonAstralCombo = `${nonAstral}${combo}?`\r\n\tconst symbol = `(?:${[nonAstralCombo, combo, regional, surrogatePair, astral, family].join(\"|\")})`\r\n\r\n\t// Used to match [String symbols](https://mathiasbynens.be/notes/javascript-unicode).\r\n\treturn new RegExp(`${blackFlag}|${fitz}(?=${fitz})|${symbol + seq}`, \"g\")\r\n}\r\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// @ts-ignore\nvar char_regex_1 = __importDefault(require(\"char-regex\"));\n/**\n * Converts a string to an array of string chars\n * @param {string} str The string to turn into array\n * @returns {string[]}\n */\nfunction toArray(str) {\n if (typeof str !== 'string') {\n throw new Error('A string is expected as input');\n }\n return str.match(char_regex_1.default()) || [];\n}\nexports.toArray = toArray;\n/**\n * Returns the length of a string\n *\n * @export\n * @param {string} str\n * @returns {number}\n */\nfunction length(str) {\n // Check for input\n if (typeof str !== 'string') {\n throw new Error('Input must be a string');\n }\n var match = str.match(char_regex_1.default());\n return match === null ? 0 : match.length;\n}\nexports.length = length;\n/**\n * Returns a substring by providing start and end position\n *\n * @export\n * @param {string} str\n * @param {number} [begin=0] Starting position\n * @param {number} end End position\n * @returns {string}\n */\nfunction substring(str, begin, end) {\n if (begin === void 0) { begin = 0; }\n // Check for input\n if (typeof str !== 'string') {\n throw new Error('Input must be a string');\n }\n // Even though negative numbers work here, theyre not in the spec\n if (typeof begin !== 'number' || begin < 0) {\n begin = 0;\n }\n if (typeof end === 'number' && end < 0) {\n end = 0;\n }\n var match = str.match(char_regex_1.default());\n if (!match)\n return '';\n return match.slice(begin, end).join('');\n}\nexports.substring = substring;\n/**\n * Returns a substring by providing start position and length\n *\n * @export\n * @param {string} str\n * @param {number} [begin=0] Starting position\n * @param {number} len Desired length\n * @returns {string}\n */\nfunction substr(str, begin, len) {\n if (begin === void 0) { begin = 0; }\n // Check for input\n if (typeof str !== 'string') {\n throw new Error('Input must be a string');\n }\n var strLength = length(str);\n // Fix type\n if (typeof begin !== 'number') {\n begin = parseInt(begin, 10);\n }\n // Return zero-length string if got oversize number.\n if (begin >= strLength) {\n return '';\n }\n // Calculating postive version of negative value.\n if (begin < 0) {\n begin += strLength;\n }\n var end;\n if (typeof len === 'undefined') {\n end = strLength;\n }\n else {\n // Fix type\n if (typeof len !== 'number') {\n len = parseInt(len, 10);\n }\n end = len >= 0 ? len + begin : begin;\n }\n var match = str.match(char_regex_1.default());\n if (!match)\n return '';\n return match.slice(begin, end).join('');\n}\nexports.substr = substr;\n/**\n * Enforces a string to be a certain length by\n * adding or removing characters\n *\n * @export\n * @param {string} str\n * @param {number} [limit=16] Limit\n * @param {string} [padString='#'] The Pad String\n * @param {string} [padPosition='right'] The Pad Position\n * @returns {string}\n */\nfunction limit(str, limit, padString, padPosition) {\n if (limit === void 0) { limit = 16; }\n if (padString === void 0) { padString = '#'; }\n if (padPosition === void 0) { padPosition = 'right'; }\n // Input should be a string, limit should be a number\n if (typeof str !== 'string' || typeof limit !== 'number') {\n throw new Error('Invalid arguments specified');\n }\n // Pad position should be either left or right\n if (['left', 'right'].indexOf(padPosition) === -1) {\n throw new Error('Pad position should be either left or right');\n }\n // Pad string can be anything, we convert it to string\n if (typeof padString !== 'string') {\n padString = String(padString);\n }\n // Calculate string length considering astral code points\n var strLength = length(str);\n if (strLength > limit) {\n return substring(str, 0, limit);\n }\n else if (strLength < limit) {\n var padRepeats = padString.repeat(limit - strLength);\n return padPosition === 'left' ? padRepeats + str : str + padRepeats;\n }\n return str;\n}\nexports.limit = limit;\n/**\n * Returns the index of the first occurrence of a given string\n *\n * @export\n * @param {string} str\n * @param {string} [searchStr] the string to search\n * @param {number} [pos] starting position\n * @returns {number}\n */\nfunction indexOf(str, searchStr, pos) {\n if (pos === void 0) { pos = 0; }\n if (typeof str !== 'string') {\n throw new Error('Input must be a string');\n }\n if (str === '') {\n if (searchStr === '') {\n return 0;\n }\n return -1;\n }\n // fix type\n pos = Number(pos);\n pos = isNaN(pos) ? 0 : pos;\n searchStr = String(searchStr);\n var strArr = toArray(str);\n if (pos >= strArr.length) {\n if (searchStr === '') {\n return strArr.length;\n }\n return -1;\n }\n if (searchStr === '') {\n return pos;\n }\n var searchArr = toArray(searchStr);\n var finded = false;\n var index;\n for (index = pos; index < strArr.length; index += 1) {\n var searchIndex = 0;\n while (searchIndex < searchArr.length &&\n searchArr[searchIndex] === strArr[index + searchIndex]) {\n searchIndex += 1;\n }\n if (searchIndex === searchArr.length &&\n searchArr[searchIndex - 1] === strArr[index + searchIndex - 1]) {\n finded = true;\n break;\n }\n }\n return finded ? index : -1;\n}\nexports.indexOf = indexOf;\n","/**\n * Ensures that the given input is returned as an array.\n *\n * This function takes a value that might be a single item, an array, or `undefined` and returns it\n * as an array:\n *\n * - If the input is `undefined`, an empty array is returned.\n * - If the input is already an array, it is returned as-is.\n * - If the input is a single item, it is wrapped in an array.\n *\n * @typeParam T - The type of the elements in the array.\n * @param maybeArray - The value that may be a single item, an array, or `undefined`.\n * @returns An array containing the input value(s). If the input is `undefined`, an empty array is\n * returned.\n */\nexport default function ensureArray(maybeArray: T | T[] | undefined): T[] {\n if (!maybeArray) return [];\n\n return Array.isArray(maybeArray) ? maybeArray : [maybeArray];\n}\n","import { LocalizeKey } from 'menus.model';\nimport {\n indexOf as stringzIndexOf,\n substring as stringzSubstring,\n length as stringzLength,\n toArray as stringzToArray,\n limit as stringzLimit,\n substr as stringzSubstr,\n} from 'stringz';\nimport ensureArray from './array-util';\nimport { isString } from './util';\n\n/**\n * This function mirrors the `at` function from the JavaScript Standard String object. It handles\n * Unicode code points instead of UTF-16 character codes.\n *\n * Finds the Unicode code point at the given index.\n *\n * @param string String to index\n * @param index Position of the character to be returned in range of -length(string) to\n * length(string)\n * @returns New string consisting of the Unicode code point located at the specified offset,\n * undefined if index is out of bounds\n */\nexport function at(string: string, index: number): string | undefined {\n if (index > stringLength(string) || index < -stringLength(string)) return undefined;\n return substr(string, index, 1);\n}\n\n/**\n * This function mirrors the `charAt` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Returns a new string consisting of the single unicode code point at the given index.\n *\n * @param string String to index\n * @param index Position of the string character to be returned, in the range of 0 to\n * length(string)-1\n * @returns New string consisting of the Unicode code point located at the specified offset, empty\n * string if index is out of bounds\n */\nexport function charAt(string: string, index: number): string {\n if (index < 0 || index > stringLength(string) - 1) return '';\n return substr(string, index, 1);\n}\n\n/**\n * This function mirrors the `codePointAt` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Returns a non-negative integer that is the Unicode code point value of the character starting at\n * the given index.\n *\n * @param string String to index\n * @param index Position of the string character to be returned, in the range of 0 to\n * length(string)-1\n * @returns Non-negative integer representing the code point value of the character at the given\n * index, or undefined if there is no element at that position\n */\nexport function codePointAt(string: string, index: number): number | undefined {\n if (index < 0 || index > stringLength(string) - 1) return undefined;\n return substr(string, index, 1).codePointAt(0);\n}\n\n/**\n * This function mirrors the `endsWith` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Determines whether a string ends with the characters of this string.\n *\n * @param string String to search through\n * @param searchString Characters to search for at the end of the string\n * @param endPosition End position where searchString is expected to be found. Default is\n * `length(string)`\n * @returns True if it ends with searchString, false if it does not\n */\nexport function endsWith(\n string: string,\n searchString: string,\n endPosition: number = stringLength(string),\n): boolean {\n const lastIndexOfSearchString = lastIndexOf(string, searchString);\n if (lastIndexOfSearchString === -1) return false;\n if (lastIndexOfSearchString + stringLength(searchString) !== endPosition) return false;\n return true;\n}\n\n/**\n * Get the index of the closest closing curly brace in a string.\n *\n * Note: when escaped, gets the index of the curly brace, not the backslash before it.\n *\n * @param str String to search\n * @param index Index at which to start searching. Inclusive of this index\n * @param escaped Whether to search for an escaped or an unescaped closing curly brace\n * @returns Index of closest closing curly brace or -1 if not found\n */\nfunction indexOfClosestClosingCurlyBrace(str: string, index: number, escaped: boolean) {\n if (index < 0) return -1;\n if (escaped) {\n if (charAt(str, index) === '}' && charAt(str, index - 1) === '\\\\') return index;\n const closeCurlyBraceIndex = indexOf(str, '\\\\}', index);\n return closeCurlyBraceIndex >= 0 ? closeCurlyBraceIndex + 1 : closeCurlyBraceIndex;\n }\n\n let i = index;\n const strLength = stringLength(str);\n while (i < strLength) {\n i = indexOf(str, '}', i);\n\n if (i === -1 || charAt(str, i - 1) !== '\\\\') break;\n\n // Didn't find an un-escaped close brace, so keep looking\n i += 1;\n }\n\n return i >= strLength ? -1 : i;\n}\n\n/**\n * Formats a string into an array of objects (adjacent strings are concatenated in one array entry),\n * replacing `{replacer key}` with the value in the `replacers` at that replacer key (or multiple\n * replacer values if there are multiple in the string). Will also remove \\ before curly braces if\n * curly braces are escaped with a backslash in order to preserve the curly braces. E.g. 'Hi, this\n * is {name}! I like `\\{curly braces\\}`! would become Hi, this is Jim! I like {curly braces}!\n *\n * If the key in unescaped braces is not found, returns the key without the braces. Empty unescaped\n * curly braces will just return a string without the braces e.g. ('I am {Nemo}', { 'name': 'Jim'})\n * would return 'I am Nemo'.\n *\n * Note: React elements can be used as replacer values.\n *\n * @example\n *\n * ```tsx\n *

\n * {formatReplacementStringToArray('Hi {other}! I am {name}.', {\n * other: 'Billy',\n * name: Jim,\n * })}\n *

\n * ```\n *\n * @example\n *\n * ```typescript\n * formatReplacementStringToArray(\n * 'Hi, this is {name}! I like \\{curly braces\\}! I have a {carInfo} car. My favorite food is {food}.',\n * { name: ['Bill'], carInfo: { year: 2015, color: 'blue' } }\n * );\n *\n * =>\n *\n * ['Hi, this is ', ['Bill'], '! I like {curly braces}! I have a ', { year: 2015, color: 'blue' }, ' car. My favorite food is food.']\n * ```\n *\n * @param str String to format and break out into an array of objects\n * @param replacers Object whose keys are replacer keys and whose values are the values with which\n * to replace `{replacer key}`s found in the string to format. If the replacer value is a string,\n * it will be concatenated into existing strings in the array. Otherwise, the replacer value will\n * be added as a new entry in the array\n * @returns Array of formatted strings and replaced objects\n */\nexport function formatReplacementStringToArray(\n str: string,\n replacers: { [key: string | number]: T } | object,\n): (string | T)[] {\n /** The compiled list of contents with replacers replaced appropriately */\n const contents: (string | T)[] = [];\n\n // current index in the string as we go through it\n let i = 0;\n // first index of characters to include in the next plain string added to the content\n let nextIntermediateStartIndex = 0;\n\n /**\n * Adds some content to the array of contents that is being built and also add the intermediate\n * string between the last added content and this added content\n *\n * @param newContent Content to add\n * @param newContentIndex Position in string where newContent starts\n * @param newContentLength Length in the string of the representation of this newContent\n */\n function addToContents(\n newContent: string | T,\n newContentIndex: number,\n newContentLength: number,\n ) {\n // Get the string content between the last new content and this new content\n const intermediateContent = substring(str, nextIntermediateStartIndex, newContentIndex);\n\n // If the last item in contents is a string, pull it out and add intermediateContent to\n // it. Otherwise stick with just intermediateContent\n const baseSubstring =\n contents.length > 0 && isString(contents[contents.length - 1])\n ? `${contents.pop()}${intermediateContent}`\n : intermediateContent;\n\n if (isString(newContent)) {\n // If the new content is a string, add it all together\n contents.push(`${baseSubstring}${newContent}`);\n } else {\n // New content is not a string. Add the base string if it exists (don't add an\n // empty string between added contents), then add the new content separately\n if (baseSubstring) contents.push(baseSubstring);\n contents.push(newContent);\n }\n\n // Set the intermediate start index to right after the new content so whatever\n // string content is between replacers gets added\n nextIntermediateStartIndex = newContentIndex + newContentLength;\n }\n\n const strLength = stringLength(str);\n while (i < strLength) {\n switch (charAt(str, i)) {\n case '{':\n if (charAt(str, i - 1) !== '\\\\') {\n // This character is an un-escaped open curly brace. Try to match and replace\n const closeCurlyBraceIndex = indexOfClosestClosingCurlyBrace(str, i, false);\n if (closeCurlyBraceIndex >= 0) {\n // We have matching open and close indices. Try to replace the contents\n const replacerKey = substring(str, i + 1, closeCurlyBraceIndex);\n\n // Replace with the replacer or just remove the curly braces\n const replacerContent =\n replacerKey in replacers\n ? // Just checked that the key is in the object\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n replacers[replacerKey as keyof typeof replacers]\n : replacerKey;\n\n addToContents(replacerContent, i, closeCurlyBraceIndex + 1 - i);\n\n // Put our index at the closing brace to keep processing the string after it\n i = closeCurlyBraceIndex;\n // Set the intermediate start index to right after our closing curly brace so whatever\n // string content is between replacers gets added\n nextIntermediateStartIndex = closeCurlyBraceIndex + 1;\n } else {\n // This is an unexpected un-escaped open curly brace with no matching closing curly\n // brace. Just ignore, I guess\n }\n } else {\n // This character is an escaped open curly brace. Add the curly brace but skip over the\n // escape backslash\n addToContents('{', i - 1, 2);\n }\n break;\n case '}':\n if (charAt(str, i - 1) !== '\\\\') {\n // This character is an un-escaped closing curly brace with no matching open curly\n // brace. Just ignore, I guess\n } else {\n // This character is an escaped closing curly brace. Add the curly brace but skip over\n // the escape backslash\n addToContents('}', i - 1, 2);\n }\n break;\n default:\n // No need to do anything with other characters at this point\n break;\n }\n\n i += 1;\n }\n\n // Now we are through the whole string and need to add the string content after all replacers if\n // there is anything left\n if (nextIntermediateStartIndex < strLength) {\n // Get the string content between the last new content and this new content\n const endContent = substring(str, nextIntermediateStartIndex);\n\n // If the last item in contents is a string, pull it out and add endContent to\n // it. Then put it in the contents array\n contents.push(\n contents.length > 0 && isString(contents[contents.length - 1])\n ? `${contents.pop()}${endContent}`\n : endContent,\n );\n }\n\n return contents;\n}\n\n/**\n * Formats a string, replacing `{replacer key}` with the value in the `replacers` at that replacer\n * key (or multiple replacer values if there are multiple in the string). Will also remove \\ before\n * curly braces if curly braces are escaped with a backslash in order to preserve the curly braces.\n * E.g. 'Hi, this is {name}! I like `\\{curly braces\\}`! would become Hi, this is Jim! I like {curly\n * braces}!\n *\n * If the key in unescaped braces is not found, returns the key without the braces. Empty unescaped\n * curly braces will just return a string without the braces e.g. ('I am {Nemo}', { 'name': 'Jim'})\n * would return 'I am Nemo'.\n *\n * @example\n *\n * ```typescript\n * formatReplacementString(\n * 'Hi, this is {name}! I like \\{curly braces\\}! I have a {carColor} car. My favorite food is {food}.',\n * { name: 'Bill', carColor: 'blue' }\n * );\n *\n * =>\n *\n * 'Hi, this is Bill! I like {curly braces}! I have a blue car. My favorite food is food.'\n * ```\n *\n * @param str String to format\n * @param replacers Object whose keys are replacer keys and whose values are the values with which\n * to replace `{replacer key}`s found in the string to format. Will be coerced to strings using\n * `${replacerValue}`\n * @returns Formatted string\n */\nexport function formatReplacementString(\n str: string,\n replacers: { [key: string | number]: string | unknown } | object,\n): string {\n return formatReplacementStringToArray(str, replacers)\n .map((content) => `${content}`)\n .join('');\n}\n\n/**\n * This function mirrors the `includes` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Performs a case-sensitive search to determine if searchString is found in string.\n *\n * @param string String to search through\n * @param searchString String to search for\n * @param position Position within the string to start searching for searchString. Default is `0`\n * @returns True if search string is found, false if it is not\n */\nexport function includes(string: string, searchString: string, position: number = 0): boolean {\n const partialString = substring(string, position);\n const indexOfSearchString = indexOf(partialString, searchString);\n if (indexOfSearchString === -1) return false;\n return true;\n}\n\n/**\n * This function mirrors the `indexOf` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Returns the index of the first occurrence of a given string.\n *\n * @param string String to search through\n * @param searchString The string to search for\n * @param position Start of searching. Default is `0`\n * @returns Index of the first occurrence of a given string\n */\nexport function indexOf(\n string: string,\n searchString: string,\n position: number | undefined = 0,\n): number {\n return stringzIndexOf(string, searchString, position);\n}\n\n/**\n * This function mirrors the `lastIndexOf` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Searches this string and returns the index of the last occurrence of the specified substring.\n *\n * @param string String to search through\n * @param searchString Substring to search for\n * @param position The index at which to begin searching. If omitted, the search begins at the end\n * of the string. Default is `undefined`\n * @returns Index of the last occurrence of searchString found, or -1 if not found.\n */\nexport function lastIndexOf(string: string, searchString: string, position?: number): number {\n let validatedPosition = position === undefined ? stringLength(string) : position;\n\n if (validatedPosition < 0) {\n validatedPosition = 0;\n } else if (validatedPosition >= stringLength(string)) {\n validatedPosition = stringLength(string) - 1;\n }\n\n for (let index = validatedPosition; index >= 0; index--) {\n if (substr(string, index, stringLength(searchString)) === searchString) {\n return index;\n }\n }\n\n return -1;\n}\n\n/**\n * This function mirrors the `length` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes. Since `length` appears to be a\n * reserved keyword, the function was renamed to `stringLength`\n *\n * Returns the length of a string.\n *\n * @param string String to return the length for\n * @returns Number that is length of the starting string\n */\nexport function stringLength(string: string): number {\n return stringzLength(string);\n}\n\n/**\n * This function mirrors the `normalize` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Returns the Unicode Normalization Form of this string.\n *\n * @param string The starting string\n * @param form Form specifying the Unicode Normalization Form. Default is `'NFC'`\n * @returns A string containing the Unicode Normalization Form of the given string.\n */\nexport function normalize(string: string, form: 'NFC' | 'NFD' | 'NFKC' | 'NFKD' | 'none'): string {\n const upperCaseForm = form.toUpperCase();\n if (upperCaseForm === 'NONE') {\n return string;\n }\n return string.normalize(upperCaseForm);\n}\n\n/**\n * Compares two strings using an ordinal comparison approach based on the specified collation\n * options. This function uses the built-in `localeCompare` method with the 'en' locale and the\n * provided collation options to compare the strings.\n *\n * @param string1 The first string to compare.\n * @param string2 The second string to compare.\n * @param options Optional. The collation options used for comparison.\n * @returns A number indicating the result of the comparison: - Negative value if string1 precedes\n * string2 in sorting order. - Zero if string1 and string2 are equivalent in sorting order. -\n * Positive value if string1 follows string2 in sorting order.\n */\nexport function ordinalCompare(\n string1: string,\n string2: string,\n options?: Intl.CollatorOptions,\n): number {\n return string1.localeCompare(string2, 'en', options);\n}\n\n/**\n * This function mirrors the `padEnd` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Pads this string with another string (multiple times, if needed) until the resulting string\n * reaches the given length. The padding is applied from the end of this string.\n *\n * @param string String to add padding too\n * @param targetLength The length of the resulting string once the starting string has been padded.\n * If value is less than or equal to length(string), then string is returned as is.\n * @param padString The string to pad the current string with. If padString is too long to stay\n * within targetLength, it will be truncated. Default is `\" \"`\n * @returns String with appropriate padding at the end\n */\n// Note: Limit with padString only works when length(padString) = 1, will be fixed with https://github.com/sallar/stringz/pull/59\nexport function padEnd(string: string, targetLength: number, padString: string = ' '): string {\n if (targetLength <= stringLength(string)) return string;\n return stringzLimit(string, targetLength, padString, 'right');\n}\n\n/**\n * This function mirrors the `padStart` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Pads this string with another string (multiple times, if needed) until the resulting string\n * reaches the given length. The padding is applied from the start of this string.\n *\n * @param string String to add padding too\n * @param targetLength The length of the resulting string once the starting string has been padded.\n * If value is less than or equal to length(string), then string is returned as is.\n * @param padString The string to pad the current string with. If padString is too long to stay\n * within the targetLength, it will be truncated from the end. Default is `\" \"`\n * @returns String with of specified targetLength with padString applied from the start\n */\n// Note: Limit with padString only works when length(padString) = 1, will be fixed with https://github.com/sallar/stringz/pull/59\nexport function padStart(string: string, targetLength: number, padString: string = ' '): string {\n if (targetLength <= stringLength(string)) return string;\n return stringzLimit(string, targetLength, padString, 'left');\n}\n\n// This is a helper function that performs a correction on the slice index to make sure it\n// cannot go out of bounds\nfunction correctSliceIndex(length: number, index: number) {\n if (index > length) return length;\n if (index < -length) return 0;\n if (index < 0) return index + length;\n return index;\n}\n\n/**\n * This function mirrors the `slice` function from the JavaScript Standard String object. It handles\n * Unicode code points instead of UTF-16 character codes.\n *\n * Extracts a section of this string and returns it as a new string, without modifying the original\n * string.\n *\n * @param string The starting string\n * @param indexStart The index of the first character to include in the returned substring.\n * @param indexEnd The index of the first character to exclude from the returned substring.\n * @returns A new string containing the extracted section of the string.\n */\nexport function slice(string: string, indexStart: number, indexEnd?: number): string {\n const length: number = stringLength(string);\n if (\n indexStart > length ||\n (indexEnd &&\n ((indexStart > indexEnd &&\n !(indexStart >= 0 && indexStart < length && indexEnd < 0 && indexEnd > -length)) ||\n indexEnd < -length))\n )\n return '';\n\n const newStart = correctSliceIndex(length, indexStart);\n const newEnd = indexEnd ? correctSliceIndex(length, indexEnd) : undefined;\n\n return substring(string, newStart, newEnd);\n}\n\n/**\n * This function mirrors the `split` function from the JavaScript Standard String object. It handles\n * Unicode code points instead of UTF-16 character codes.\n *\n * Takes a pattern and divides the string into an ordered list of substrings by searching for the\n * pattern, puts these substrings into an array, and returns the array.\n *\n * @param string The string to split\n * @param separator The pattern describing where each split should occur\n * @param splitLimit Limit on the number of substrings to be included in the array. Splits the\n * string at each occurrence of specified separator, but stops when limit entries have been placed\n * in the array.\n * @returns An array of strings, split at each point where separator occurs in the starting string.\n * Returns undefined if separator is not found in string.\n */\nexport function split(string: string, separator: string | RegExp, splitLimit?: number): string[] {\n const result: string[] = [];\n\n if (splitLimit !== undefined && splitLimit <= 0) {\n return [string];\n }\n\n if (separator === '') return toArray(string).slice(0, splitLimit);\n\n let regexSeparator = separator;\n if (\n typeof separator === 'string' ||\n (separator instanceof RegExp && !includes(separator.flags, 'g'))\n ) {\n regexSeparator = new RegExp(separator, 'g');\n }\n\n const matches: RegExpMatchArray | null = string.match(regexSeparator);\n\n let currentIndex = 0;\n\n if (!matches) return [string];\n\n for (let index = 0; index < (splitLimit ? splitLimit - 1 : matches.length); index++) {\n const matchIndex = indexOf(string, matches[index], currentIndex);\n const matchLength = stringLength(matches[index]);\n\n result.push(substring(string, currentIndex, matchIndex));\n currentIndex = matchIndex + matchLength;\n\n if (splitLimit !== undefined && result.length === splitLimit) {\n break;\n }\n }\n\n result.push(substring(string, currentIndex));\n\n return result;\n}\n\n/**\n * This function mirrors the `startsWith` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Determines whether the string begins with the characters of a specified string, returning true or\n * false as appropriate.\n *\n * @param string String to search through\n * @param searchString The characters to be searched for at the start of this string.\n * @param position The start position at which searchString is expected to be found (the index of\n * searchString's first character). Default is `0`\n * @returns True if the given characters are found at the beginning of the string, including when\n * searchString is an empty string; otherwise, false.\n */\nexport function startsWith(string: string, searchString: string, position: number = 0): boolean {\n const indexOfSearchString = indexOf(string, searchString, position);\n if (indexOfSearchString !== position) return false;\n return true;\n}\n\n/**\n * This function mirrors the `substr` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Returns a substring by providing start and length. This function is not exported because it is\n * considered deprecated, however it is still useful as a local helper function.\n *\n * @param string String to be divided\n * @param begin Start position. Default is `Start of string`\n * @param len Length of result. Default is `String length minus start parameter`. Default is `String\n * length minus start parameter`\n * @returns Substring from starting string\n */\nfunction substr(\n string: string,\n begin: number = 0,\n len: number = stringLength(string) - begin,\n): string {\n return stringzSubstr(string, begin, len);\n}\n\n/**\n * This function mirrors the `substring` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Returns a substring by providing start and end position.\n *\n * @param string String to be divided\n * @param begin Start position\n * @param end End position. Default is `End of string`\n * @returns Substring from starting string\n */\nexport function substring(\n string: string,\n begin: number,\n end: number = stringLength(string),\n): string {\n return stringzSubstring(string, begin, end);\n}\n\n/**\n * This function mirrors the `toArray` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Converts a string to an array of string characters.\n *\n * @param string String to convert to array\n * @returns An array of characters from the starting string\n */\nexport function toArray(string: string): string[] {\n return stringzToArray(string);\n}\n\n/** Determine whether the string is a `LocalizeKey` meant to be localized in Platform.Bible. */\nexport function isLocalizeKey(str: string): str is LocalizeKey {\n return startsWith(str, '%') && endsWith(str, '%');\n}\n\n/**\n * Escape RegExp special characters.\n *\n * You can also use this to escape a string that is inserted into the middle of a regex, for\n * example, into a character class.\n *\n * All credit to [`escape-string-regexp`](https://www.npmjs.com/package/escape-string-regexp) - this\n * function is simply copied directly from there to allow a common js export\n *\n * @example\n *\n * import escapeStringRegexp from 'platform-bible-utils';\n *\n * const escapedString = escapeStringRegexp('How much $ for a 🦄?');\n * //=> 'How much \\\\$ for a 🦄\\\\?'\n *\n * new RegExp(escapedString);\n */\nexport function escapeStringRegexp(string: string): string {\n if (typeof string !== 'string') {\n throw new TypeError('Expected a string');\n }\n\n // Escape characters with special meaning either inside or outside character sets.\n // Use a simple backslash escape when it’s always valid, and a `\\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.\n return string.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d');\n}\n\n/**\n * Transforms a string or an array of strings into an array of regular expressions, ensuring that\n * the result is always an array.\n *\n * This function accepts a value that may be a single string, an array of strings, or `undefined`.\n * It then:\n *\n * - Converts each string into a `RegExp` object.\n * - If the input is an array containing nested arrays, it converts each string in the nested arrays\n * into `RegExp` objects.\n * - Ensures that the result is always an array of `RegExp` objects or arrays of `RegExp` objects.\n *\n * @param stringStringMaybeArray - The value to be transformed, which can be a single string, an\n * array of strings or arrays of strings, or `undefined`.\n * @returns An array of `RegExp` objects or arrays of `RegExp` objects. If the input is `undefined`,\n * an empty array is returned.\n */\nexport function transformAndEnsureRegExpRegExpArray(\n stringStringMaybeArray: string | (string | string[])[] | undefined,\n): (RegExp | RegExp[])[] {\n if (!stringStringMaybeArray) return [];\n\n const stringStringArray = ensureArray(stringStringMaybeArray);\n\n const regExpRegExpArray = stringStringArray.map((stringMaybeStringArray: string | string[]) =>\n Array.isArray(stringMaybeStringArray)\n ? stringMaybeStringArray.map((str) => new RegExp(str))\n : new RegExp(stringMaybeStringArray),\n );\n\n return regExpRegExpArray;\n}\n\n/**\n * Transforms a string or an array of strings into an array of regular expressions.\n *\n * This function accepts a value that may be a single string, an array of strings, or `undefined`.\n * It then:\n *\n * - Converts each string into a `RegExp` object.\n * - Ensures that the result is always an array of `RegExp` objects.\n *\n * @param stringMaybeArray - The value to be transformed, which can be a single string, an array of\n * strings, or `undefined`.\n * @returns An array of `RegExp` objects. If the input is `undefined`, an empty array is returned.\n */\nexport function transformAndEnsureRegExpArray(\n stringMaybeArray: string | string[] | undefined,\n): RegExp[] {\n if (!stringMaybeArray) return [];\n\n const stringArray = ensureArray(stringMaybeArray);\n\n const regExpArray = stringArray.map((str: string) => new RegExp(str));\n\n return regExpArray;\n}\n\n/** This is an internal-only export for testing purposes and should not be used in development */\nexport const testingStringUtils = {\n indexOfClosestClosingCurlyBrace,\n};\n","import { Canon, VerseRef } from '@sillsdev/scripture';\nimport { BookInfo, ScriptureReference, ScrollGroupId } from './scripture.model';\nimport { split, startsWith } from './string-util';\nimport { LocalizeKey } from './menus.model';\n\nconst scrBookData: BookInfo[] = [\n { shortName: 'ERR', fullNames: ['ERROR'], chapters: -1 },\n { shortName: 'GEN', fullNames: ['Genesis'], chapters: 50 },\n { shortName: 'EXO', fullNames: ['Exodus'], chapters: 40 },\n { shortName: 'LEV', fullNames: ['Leviticus'], chapters: 27 },\n { shortName: 'NUM', fullNames: ['Numbers'], chapters: 36 },\n { shortName: 'DEU', fullNames: ['Deuteronomy'], chapters: 34 },\n { shortName: 'JOS', fullNames: ['Joshua'], chapters: 24 },\n { shortName: 'JDG', fullNames: ['Judges'], chapters: 21 },\n { shortName: 'RUT', fullNames: ['Ruth'], chapters: 4 },\n { shortName: '1SA', fullNames: ['1 Samuel'], chapters: 31 },\n { shortName: '2SA', fullNames: ['2 Samuel'], chapters: 24 },\n { shortName: '1KI', fullNames: ['1 Kings'], chapters: 22 },\n { shortName: '2KI', fullNames: ['2 Kings'], chapters: 25 },\n { shortName: '1CH', fullNames: ['1 Chronicles'], chapters: 29 },\n { shortName: '2CH', fullNames: ['2 Chronicles'], chapters: 36 },\n { shortName: 'EZR', fullNames: ['Ezra'], chapters: 10 },\n { shortName: 'NEH', fullNames: ['Nehemiah'], chapters: 13 },\n { shortName: 'EST', fullNames: ['Esther'], chapters: 10 },\n { shortName: 'JOB', fullNames: ['Job'], chapters: 42 },\n { shortName: 'PSA', fullNames: ['Psalm', 'Psalms'], chapters: 150 },\n { shortName: 'PRO', fullNames: ['Proverbs'], chapters: 31 },\n { shortName: 'ECC', fullNames: ['Ecclesiastes'], chapters: 12 },\n { shortName: 'SNG', fullNames: ['Song of Solomon', 'Song of Songs'], chapters: 8 },\n { shortName: 'ISA', fullNames: ['Isaiah'], chapters: 66 },\n { shortName: 'JER', fullNames: ['Jeremiah'], chapters: 52 },\n { shortName: 'LAM', fullNames: ['Lamentations'], chapters: 5 },\n { shortName: 'EZK', fullNames: ['Ezekiel'], chapters: 48 },\n { shortName: 'DAN', fullNames: ['Daniel'], chapters: 12 },\n { shortName: 'HOS', fullNames: ['Hosea'], chapters: 14 },\n { shortName: 'JOL', fullNames: ['Joel'], chapters: 3 },\n { shortName: 'AMO', fullNames: ['Amos'], chapters: 9 },\n { shortName: 'OBA', fullNames: ['Obadiah'], chapters: 1 },\n { shortName: 'JON', fullNames: ['Jonah'], chapters: 4 },\n { shortName: 'MIC', fullNames: ['Micah'], chapters: 7 },\n { shortName: 'NAM', fullNames: ['Nahum'], chapters: 3 },\n { shortName: 'HAB', fullNames: ['Habakkuk'], chapters: 3 },\n { shortName: 'ZEP', fullNames: ['Zephaniah'], chapters: 3 },\n { shortName: 'HAG', fullNames: ['Haggai'], chapters: 2 },\n { shortName: 'ZEC', fullNames: ['Zechariah'], chapters: 14 },\n { shortName: 'MAL', fullNames: ['Malachi'], chapters: 4 },\n { shortName: 'MAT', fullNames: ['Matthew'], chapters: 28 },\n { shortName: 'MRK', fullNames: ['Mark'], chapters: 16 },\n { shortName: 'LUK', fullNames: ['Luke'], chapters: 24 },\n { shortName: 'JHN', fullNames: ['John'], chapters: 21 },\n { shortName: 'ACT', fullNames: ['Acts'], chapters: 28 },\n { shortName: 'ROM', fullNames: ['Romans'], chapters: 16 },\n { shortName: '1CO', fullNames: ['1 Corinthians'], chapters: 16 },\n { shortName: '2CO', fullNames: ['2 Corinthians'], chapters: 13 },\n { shortName: 'GAL', fullNames: ['Galatians'], chapters: 6 },\n { shortName: 'EPH', fullNames: ['Ephesians'], chapters: 6 },\n { shortName: 'PHP', fullNames: ['Philippians'], chapters: 4 },\n { shortName: 'COL', fullNames: ['Colossians'], chapters: 4 },\n { shortName: '1TH', fullNames: ['1 Thessalonians'], chapters: 5 },\n { shortName: '2TH', fullNames: ['2 Thessalonians'], chapters: 3 },\n { shortName: '1TI', fullNames: ['1 Timothy'], chapters: 6 },\n { shortName: '2TI', fullNames: ['2 Timothy'], chapters: 4 },\n { shortName: 'TIT', fullNames: ['Titus'], chapters: 3 },\n { shortName: 'PHM', fullNames: ['Philemon'], chapters: 1 },\n { shortName: 'HEB', fullNames: ['Hebrews'], chapters: 13 },\n { shortName: 'JAS', fullNames: ['James'], chapters: 5 },\n { shortName: '1PE', fullNames: ['1 Peter'], chapters: 5 },\n { shortName: '2PE', fullNames: ['2 Peter'], chapters: 3 },\n { shortName: '1JN', fullNames: ['1 John'], chapters: 5 },\n { shortName: '2JN', fullNames: ['2 John'], chapters: 1 },\n { shortName: '3JN', fullNames: ['3 John'], chapters: 1 },\n { shortName: 'JUD', fullNames: ['Jude'], chapters: 1 },\n { shortName: 'REV', fullNames: ['Revelation'], chapters: 22 },\n];\n\nexport const FIRST_SCR_BOOK_NUM = 1;\nexport const LAST_SCR_BOOK_NUM = scrBookData.length - 1;\nexport const FIRST_SCR_CHAPTER_NUM = 1;\nexport const FIRST_SCR_VERSE_NUM = 1;\n\nexport const defaultScrRef: ScriptureReference = {\n bookNum: 1,\n chapterNum: 1,\n verseNum: 1,\n};\n\nexport const getChaptersForBook = (bookNum: number): number => {\n return scrBookData[bookNum]?.chapters ?? -1;\n};\n\nexport const offsetBook = (scrRef: ScriptureReference, offset: number): ScriptureReference => ({\n bookNum: Math.max(FIRST_SCR_BOOK_NUM, Math.min(scrRef.bookNum + offset, LAST_SCR_BOOK_NUM)),\n chapterNum: 1,\n verseNum: 1,\n});\n\nexport const offsetChapter = (scrRef: ScriptureReference, offset: number): ScriptureReference => ({\n ...scrRef,\n chapterNum: Math.min(\n Math.max(FIRST_SCR_CHAPTER_NUM, scrRef.chapterNum + offset),\n getChaptersForBook(scrRef.bookNum),\n ),\n verseNum: 1,\n});\n\nexport const offsetVerse = (scrRef: ScriptureReference, offset: number): ScriptureReference => ({\n ...scrRef,\n verseNum: Math.max(FIRST_SCR_VERSE_NUM, scrRef.verseNum + offset),\n});\n\n/**\n * https://github.com/ubsicap/Paratext/blob/master/ParatextData/SILScriptureExtensions.cs#L72\n *\n * Convert book number to a localized Id (a short description of the book). This should be used\n * whenever a book ID (short code) is shown to the user. It is primarily needed for people who do\n * not read Roman script well and need to have books identified in a alternate script (e.g. Chinese\n * or Russian)\n *\n * @param bookNumber\n * @param localizationLanguage In BCP 47 format\n * @param getLocalizedString Function that provides the localized versions of the book ids and names\n * asynchronously.\n * @returns\n */\nexport async function getLocalizedIdFromBookNumber(\n bookNumber: number,\n localizationLanguage: string,\n getLocalizedString: (item: {\n localizeKey: string;\n languagesToSearch?: string[];\n }) => Promise,\n) {\n const id = Canon.bookNumberToId(bookNumber);\n\n if (!startsWith(Intl.getCanonicalLocales(localizationLanguage)[0], 'zh'))\n return getLocalizedString({\n localizeKey: `LocalizedId.${id}`,\n languagesToSearch: [localizationLanguage],\n });\n\n // For Chinese the normal book name is already fairly short.\n const bookName = await getLocalizedString({\n localizeKey: `Book.${id}`,\n languagesToSearch: [localizationLanguage],\n });\n const parts = split(bookName, '-');\n // some entries had a second name inside ideographic parenthesis\n const parts2 = split(parts[0], '\\xff08');\n const retVal = parts2[0].trim();\n return retVal;\n}\n\n/**\n * Get the Scripture reference as an easily comparable/sortable integer.\n *\n * @param scrRef The Scripture reference.\n * @returns An integer where the first three digits represent the book, the next three represent the\n * chapter and the last three represent the verse.\n */\nexport function scrRefToBBBCCCVVV(scrRef: ScriptureReference): number {\n return new VerseRef(scrRef.bookNum, scrRef.chapterNum, scrRef.verseNum).BBBCCCVVV;\n}\n\n/**\n * Compares two Scripture references canonically.\n *\n * @param scrRef1 The first Scripture reference to compare.\n * @param scrRef2 The second Scripture reference to compare.\n * @returns A number indicating the result of the comparison: - Negative value if scrRef1 precedes\n * scrRef2 in sorting order. - Zero if scrRef1 and scrRef2 are equivalent in sorting order. -\n * Positive value if scrRef1 follows scrRef2 in sorting order.\n */\nexport function compareScrRefs(scrRef1: ScriptureReference, scrRef2: ScriptureReference): number {\n // TODO: consider edge cases for invalid references (current implementation should suffice for\n // all but the most extreme cases)\n return scrRefToBBBCCCVVV(scrRef1) - scrRefToBBBCCCVVV(scrRef2);\n}\n\n/** Get the localized string key for a given scroll group Id (or no scroll group if `undefined`) */\nexport function getLocalizeKeyForScrollGroupId(\n scrollGroupId: ScrollGroupId | undefined | 'undefined',\n): LocalizeKey {\n return `%scrollGroup_${scrollGroupId}%`;\n}\n\n/**\n * Gets a list of localized string keys for provided scroll group Ids. Uses\n * {@link getLocalizeKeyForScrollGroupId} internally\n *\n * @example\n *\n * ```typescript\n * getLocalizeKeysForScrollGroupIds([undefined, 0, 1, 2, 3, 4]);\n * // Gives localized string keys for the provided scroll group ids in an array\n * ```\n *\n * @param scrollGroupIds Scroll group ids to include\n * @returns List of localized string keys for scroll group Ids\n */\nexport function getLocalizeKeysForScrollGroupIds(scrollGroupIds: (ScrollGroupId | undefined)[]) {\n return scrollGroupIds.map((scrollGroupId) => getLocalizeKeyForScrollGroupId(scrollGroupId));\n}\n\n/**\n * Formats a Scripture reference.\n *\n * @param scrRef The Scripture reference to format.\n * @param optionOrLocalizedBookName Either 'id' (the default) to format using the \"standard\" (as\n * defined by SIL/UBS) 3-letter book ID, 'English' to format using the English book name spelled\n * out, or some other string (e.g., a localized book name, vernacular abbreviation, FCBH book id,\n * etc.) to use.\n * @param chapterVerseSeparator The character used to separate the chapter number from the verse\n * number. Default is a colon (:). Note: More than one character is allowed.\n * @param bookChapterSeparator The character used to separate the book from the chapter number.\n * Default is a single space. Note: More than one character is allowed.\n * @returns The formatted reference.\n */\nexport function formatScrRef(\n scrRef: ScriptureReference,\n optionOrLocalizedBookName?: 'id' | 'English' | string,\n chapterVerseSeparator?: string,\n bookChapterSeparator?: string,\n): string {\n let book: string;\n switch (optionOrLocalizedBookName ?? 'id') {\n case 'English':\n book = Canon.bookNumberToEnglishName(scrRef.bookNum);\n break;\n case 'id':\n book = Canon.bookNumberToId(scrRef.bookNum);\n break;\n default:\n // We already dealt with undefined about in the switch, but TS is getting confused.\n book = optionOrLocalizedBookName ?? '';\n break;\n }\n return `${book}${bookChapterSeparator ?? ' '}${scrRef.chapterNum}${chapterVerseSeparator ?? ':'}${scrRef.verseNum}`;\n}\n","/** Function to run to dispose of something. Returns true if successfully unsubscribed */\nexport type Unsubscriber = () => boolean;\n\n/**\n * Returns an Unsubscriber function that combines all the unsubscribers passed in.\n *\n * @param unsubscribers All unsubscribers to aggregate into one unsubscriber\n * @returns Function that unsubscribes from all passed in unsubscribers when run\n */\nexport const aggregateUnsubscribers = (unsubscribers: Unsubscriber[]): Unsubscriber => {\n return (...args) => {\n // Run the unsubscriber for each handler\n const unsubs = unsubscribers.map((unsubscriber) => unsubscriber(...args));\n\n // If all the unsubscribers resolve to truthiness, we succeed\n return unsubs.every((success) => success);\n };\n};\n\n/**\n * Function to run to dispose of something that runs asynchronously. The promise resolves to true if\n * successfully unsubscribed\n */\nexport type UnsubscriberAsync = () => Promise;\n\n/**\n * Returns an UnsubscriberAsync function that combines all the unsubscribers passed in.\n *\n * @param unsubscribers - All unsubscribers to aggregate into one unsubscriber.\n * @returns Function that unsubscribes from all passed in unsubscribers when run\n */\nexport const aggregateUnsubscriberAsyncs = (\n unsubscribers: (UnsubscriberAsync | Unsubscriber)[],\n): UnsubscriberAsync => {\n return async (...args) => {\n // Run the unsubscriber for each handler\n const unsubPromises = unsubscribers.map(async (unsubscriber) => unsubscriber(...args));\n\n // If all the unsubscribers resolve to truthiness, we succeed\n return (await Promise.all(unsubPromises)).every((success) => success);\n };\n};\n","import { type MarkerContent, type MarkerObject } from '@biblionexus-foundation/scripture-utilities';\nimport { VerseRef } from '@sillsdev/scripture';\n\n/** USJ content node type for a chapter */\nexport const CHAPTER_TYPE = 'chapter';\n\n/** USJ content node type for a verse */\nexport const VERSE_TYPE = 'verse';\n\n/** Represents a book, chapter, verse, and offset */\nexport type VerseRefOffset = {\n verseRef: VerseRef;\n offset: number;\n};\n\n/** This could actually have more content clauses at the end, but TS types are limited */\nexport type ContentJsonPath =\n | ''\n | `$`\n | `$.content[${number}]`\n | `$.content[${number}].content[${number}]`\n | `$.content[${number}].content[${number}].content[${number}]`\n | `$.content[${number}].content[${number}].content[${number}].content[${number}]`;\n\n/** Node within a USJ object, an offset within that node, and a JSONPath query to the node */\nexport type UsjContentLocation = {\n node: MarkerContent;\n offset: number;\n jsonPath: ContentJsonPath;\n};\n\n/** Utilities for reading from and writing to `Usj` objects */\nexport interface IUsjReaderWriter {\n /**\n * Return a copy of text following a given starting point\n *\n * @param start Point where text extraction will start\n * @param desiredLength Length of text to extract from this USJ data\n */\n extractText(start: UsjContentLocation, desiredLength: number): string;\n /**\n * Return a copy of text between two points\n *\n * @param start Point where text extraction will start\n * @param end Point where text extraction will end\n * @param maxLength Maximum length of string to return (defaults to 100)\n * @returns Text between the two points, capped at length `maxLength`\n */\n extractTextBetweenPoints(\n start: UsjContentLocation,\n end: UsjContentLocation,\n maxLength: number,\n ): string;\n /**\n * Given a starting point, find the next location in this USJ data that matches the given text\n *\n * @param start Point where the search for `text` will start\n * @param text Text to find\n * @param maxTextLengthToSearch Maximum length of text to search before stopping (default is 1000)\n * @returns Object containing the USJ node where `text` begins (it might be split across nodes),\n * offset within that node that indicates where `text` begins, and a JSONPath string that\n * indicates the location of the of USJ node within `usj`. Note that if the USJ node returned is\n * an object, it is the same object that is within this USJ data. So if you change it, you are\n * changing this USJ data.\n */\n findNextLocationOfMatchingText(\n start: UsjContentLocation,\n text: string,\n maxTextLengthToSearch: number,\n ): UsjContentLocation | undefined;\n /** Find the first value matching the given JSONPath query within this USJ data */\n findSingleValue(jsonPathQuery: string): T | undefined;\n /** Find the parent of the first value matching the given JSONPath query within this USJ data */\n findParent(jsonPathQuery: string): T | undefined;\n /**\n * Convert a JSONPath query into a VerseRef and offset\n *\n * @param jsonPathQuery JSONPath search expression that indicates a node within this USJ data. If\n * the expression matches more than one node, then only the first node found is considered.\n * @param bookId 3 letter ID of the book being searched (must be defined in this USJ data if not\n * provided here)\n * @returns VerseRef and offset that represents the location within this USJ data indicated by\n * `jsonPathQuery`\n */\n jsonPathToVerseRefAndOffset(jsonPathQuery: string, bookId?: string): VerseRefOffset;\n /** Build a JSONPath query that uniquely identifies the given node with this USJ data. */\n nodeToJsonPath(node: MarkerObject): ContentJsonPath;\n /**\n * Determine the VerseRef and offset that correspond to the location of a node somewhere within\n * this USJ data\n *\n * @param bookId ID of the book represented by this USJ data\n * @param node JSON object representing the location of the VerseRef and offset\n * @param nodeParent JSON object that owns the `content` array that includes `node`. If\n * 'undefined' is provided then the `UsjReaderWriter` will attempt to lookup the parent of\n * `node`. The lookup will always fail and throw an error if `node` is a string.\n * @returns VerseRef and offset representing the location of `node`, if one could be found\n */\n nodeToVerseRefAndOffset(\n bookId: string,\n node: MarkerContent,\n nodeParent: MarkerObject | MarkerContent[] | undefined,\n ): { verseRef: VerseRef; offset: number } | undefined;\n /**\n * Remove all nodes from this USJ data that match a given search function.\n *\n * @param searchFunction Function that returns `true` if the given node should be removed\n * @returns Number of nodes removed\n */\n removeContentNodes(searchFunction: (potentiallyMatchingNode: MarkerContent) => boolean): number;\n /**\n * Inform this UsjReaderWriter that the underlying USJ object changed. This is needed to clear\n * caches used when querying.\n */\n usjChanged(): void;\n /**\n * Convert a verse ref + offset into a node + offset within this USJ data and a JSONPath query\n *\n * @param verseRef Indicates the book, chapter, and verse of interest to find\n * @param verseRefOffset Specific location within verse text (defaults to 0)\n * @returns Object containing the USJ node indicated by `verseRef` and `verseRefOffset`, offset\n * within that node that matches the `verseRefOffset`, and a JSONPath string that indicates the\n * location of the of USJ node within this USJ data. Note that if the USJ node returned is an\n * object, it is the same object that is within this USJ data. So if you change it, you are\n * changing this USJ data.\n */\n verseRefToUsjContentLocation(verseRef: VerseRef, verseRefOffset: number): UsjContentLocation;\n}\n","var getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * Combine two comparators into a single comparators.\n */\nfunction combineComparators(comparatorA, comparatorB) {\n return function isEqual(a, b, state) {\n return comparatorA(a, b, state) && comparatorB(a, b, state);\n };\n}\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular state, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n */\nfunction createIsCircular(areItemsEqual) {\n return function isCircular(a, b, state) {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return areItemsEqual(a, b, state);\n }\n var cache = state.cache;\n var cachedA = cache.get(a);\n var cachedB = cache.get(b);\n if (cachedA && cachedB) {\n return cachedA === b && cachedB === a;\n }\n cache.set(a, b);\n cache.set(b, a);\n var result = areItemsEqual(a, b, state);\n cache.delete(a);\n cache.delete(b);\n return result;\n };\n}\n/**\n * Get the properties to strictly examine, which include both own properties that are\n * not enumerable and symbol properties.\n */\nfunction getStrictProperties(object) {\n return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));\n}\n/**\n * Whether the object contains the property passed as an own property.\n */\nvar hasOwn = Object.hasOwn ||\n (function (object, property) {\n return hasOwnProperty.call(object, property);\n });\n/**\n * Whether the values passed are strictly equal or both NaN.\n */\nfunction sameValueZeroEqual(a, b) {\n return a || b ? a === b : a === b || (a !== a && b !== b);\n}\n\nvar OWNER = '_owner';\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, keys = Object.keys;\n/**\n * Whether the arrays are equal in value.\n */\nfunction areArraysEqual(a, b, state) {\n var index = a.length;\n if (b.length !== index) {\n return false;\n }\n while (index-- > 0) {\n if (!state.equals(a[index], b[index], index, index, a, b, state)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the dates passed are equal in value.\n */\nfunction areDatesEqual(a, b) {\n return sameValueZeroEqual(a.getTime(), b.getTime());\n}\n/**\n * Whether the `Map`s are equal in value.\n */\nfunction areMapsEqual(a, b, state) {\n if (a.size !== b.size) {\n return false;\n }\n var matchedIndices = {};\n var aIterable = a.entries();\n var index = 0;\n var aResult;\n var bResult;\n while ((aResult = aIterable.next())) {\n if (aResult.done) {\n break;\n }\n var bIterable = b.entries();\n var hasMatch = false;\n var matchIndex = 0;\n while ((bResult = bIterable.next())) {\n if (bResult.done) {\n break;\n }\n var _a = aResult.value, aKey = _a[0], aValue = _a[1];\n var _b = bResult.value, bKey = _b[0], bValue = _b[1];\n if (!hasMatch &&\n !matchedIndices[matchIndex] &&\n (hasMatch =\n state.equals(aKey, bKey, index, matchIndex, a, b, state) &&\n state.equals(aValue, bValue, aKey, bKey, a, b, state))) {\n matchedIndices[matchIndex] = true;\n }\n matchIndex++;\n }\n if (!hasMatch) {\n return false;\n }\n index++;\n }\n return true;\n}\n/**\n * Whether the objects are equal in value.\n */\nfunction areObjectsEqual(a, b, state) {\n var properties = keys(a);\n var index = properties.length;\n if (keys(b).length !== index) {\n return false;\n }\n var property;\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index];\n if (property === OWNER &&\n (a.$$typeof || b.$$typeof) &&\n a.$$typeof !== b.$$typeof) {\n return false;\n }\n if (!hasOwn(b, property) ||\n !state.equals(a[property], b[property], property, property, a, b, state)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the objects are equal in value with strict property checking.\n */\nfunction areObjectsEqualStrict(a, b, state) {\n var properties = getStrictProperties(a);\n var index = properties.length;\n if (getStrictProperties(b).length !== index) {\n return false;\n }\n var property;\n var descriptorA;\n var descriptorB;\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index];\n if (property === OWNER &&\n (a.$$typeof || b.$$typeof) &&\n a.$$typeof !== b.$$typeof) {\n return false;\n }\n if (!hasOwn(b, property)) {\n return false;\n }\n if (!state.equals(a[property], b[property], property, property, a, b, state)) {\n return false;\n }\n descriptorA = getOwnPropertyDescriptor(a, property);\n descriptorB = getOwnPropertyDescriptor(b, property);\n if ((descriptorA || descriptorB) &&\n (!descriptorA ||\n !descriptorB ||\n descriptorA.configurable !== descriptorB.configurable ||\n descriptorA.enumerable !== descriptorB.enumerable ||\n descriptorA.writable !== descriptorB.writable)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the primitive wrappers passed are equal in value.\n */\nfunction arePrimitiveWrappersEqual(a, b) {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n}\n/**\n * Whether the regexps passed are equal in value.\n */\nfunction areRegExpsEqual(a, b) {\n return a.source === b.source && a.flags === b.flags;\n}\n/**\n * Whether the `Set`s are equal in value.\n */\nfunction areSetsEqual(a, b, state) {\n if (a.size !== b.size) {\n return false;\n }\n var matchedIndices = {};\n var aIterable = a.values();\n var aResult;\n var bResult;\n while ((aResult = aIterable.next())) {\n if (aResult.done) {\n break;\n }\n var bIterable = b.values();\n var hasMatch = false;\n var matchIndex = 0;\n while ((bResult = bIterable.next())) {\n if (bResult.done) {\n break;\n }\n if (!hasMatch &&\n !matchedIndices[matchIndex] &&\n (hasMatch = state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state))) {\n matchedIndices[matchIndex] = true;\n }\n matchIndex++;\n }\n if (!hasMatch) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the TypedArray instances are equal in value.\n */\nfunction areTypedArraysEqual(a, b) {\n var index = a.length;\n if (b.length !== index) {\n return false;\n }\n while (index-- > 0) {\n if (a[index] !== b[index]) {\n return false;\n }\n }\n return true;\n}\n\nvar ARGUMENTS_TAG = '[object Arguments]';\nvar BOOLEAN_TAG = '[object Boolean]';\nvar DATE_TAG = '[object Date]';\nvar MAP_TAG = '[object Map]';\nvar NUMBER_TAG = '[object Number]';\nvar OBJECT_TAG = '[object Object]';\nvar REG_EXP_TAG = '[object RegExp]';\nvar SET_TAG = '[object Set]';\nvar STRING_TAG = '[object String]';\nvar isArray = Array.isArray;\nvar isTypedArray = typeof ArrayBuffer === 'function' && ArrayBuffer.isView\n ? ArrayBuffer.isView\n : null;\nvar assign = Object.assign;\nvar getTag = Object.prototype.toString.call.bind(Object.prototype.toString);\n/**\n * Create a comparator method based on the type-specific equality comparators passed.\n */\nfunction createEqualityComparator(_a) {\n var areArraysEqual = _a.areArraysEqual, areDatesEqual = _a.areDatesEqual, areMapsEqual = _a.areMapsEqual, areObjectsEqual = _a.areObjectsEqual, arePrimitiveWrappersEqual = _a.arePrimitiveWrappersEqual, areRegExpsEqual = _a.areRegExpsEqual, areSetsEqual = _a.areSetsEqual, areTypedArraysEqual = _a.areTypedArraysEqual;\n /**\n * compare the value of the two objects and return true if they are equivalent in values\n */\n return function comparator(a, b, state) {\n // If the items are strictly equal, no need to do a value comparison.\n if (a === b) {\n return true;\n }\n // If the items are not non-nullish objects, then the only possibility\n // of them being equal but not strictly is if they are both `NaN`. Since\n // `NaN` is uniquely not equal to itself, we can use self-comparison of\n // both objects, which is faster than `isNaN()`.\n if (a == null ||\n b == null ||\n typeof a !== 'object' ||\n typeof b !== 'object') {\n return a !== a && b !== b;\n }\n var constructor = a.constructor;\n // Checks are listed in order of commonality of use-case:\n // 1. Common complex object types (plain object, array)\n // 2. Common data values (date, regexp)\n // 3. Less-common complex object types (map, set)\n // 4. Less-common data values (promise, primitive wrappers)\n // Inherently this is both subjective and assumptive, however\n // when reviewing comparable libraries in the wild this order\n // appears to be generally consistent.\n // Constructors should match, otherwise there is potential for false positives\n // between class and subclass or custom object and POJO.\n if (constructor !== b.constructor) {\n return false;\n }\n // `isPlainObject` only checks against the object's own realm. Cross-realm\n // comparisons are rare, and will be handled in the ultimate fallback, so\n // we can avoid capturing the string tag.\n if (constructor === Object) {\n return areObjectsEqual(a, b, state);\n }\n // `isArray()` works on subclasses and is cross-realm, so we can avoid capturing\n // the string tag or doing an `instanceof` check.\n if (isArray(a)) {\n return areArraysEqual(a, b, state);\n }\n // `isTypedArray()` works on all possible TypedArray classes, so we can avoid\n // capturing the string tag or comparing against all possible constructors.\n if (isTypedArray != null && isTypedArray(a)) {\n return areTypedArraysEqual(a, b, state);\n }\n // Try to fast-path equality checks for other complex object types in the\n // same realm to avoid capturing the string tag. Strict equality is used\n // instead of `instanceof` because it is more performant for the common\n // use-case. If someone is subclassing a native class, it will be handled\n // with the string tag comparison.\n if (constructor === Date) {\n return areDatesEqual(a, b, state);\n }\n if (constructor === RegExp) {\n return areRegExpsEqual(a, b, state);\n }\n if (constructor === Map) {\n return areMapsEqual(a, b, state);\n }\n if (constructor === Set) {\n return areSetsEqual(a, b, state);\n }\n // Since this is a custom object, capture the string tag to determing its type.\n // This is reasonably performant in modern environments like v8 and SpiderMonkey.\n var tag = getTag(a);\n if (tag === DATE_TAG) {\n return areDatesEqual(a, b, state);\n }\n if (tag === REG_EXP_TAG) {\n return areRegExpsEqual(a, b, state);\n }\n if (tag === MAP_TAG) {\n return areMapsEqual(a, b, state);\n }\n if (tag === SET_TAG) {\n return areSetsEqual(a, b, state);\n }\n if (tag === OBJECT_TAG) {\n // The exception for value comparison is custom `Promise`-like class instances. These should\n // be treated the same as standard `Promise` objects, which means strict equality, and if\n // it reaches this point then that strict equality comparison has already failed.\n return (typeof a.then !== 'function' &&\n typeof b.then !== 'function' &&\n areObjectsEqual(a, b, state));\n }\n // If an arguments tag, it should be treated as a standard object.\n if (tag === ARGUMENTS_TAG) {\n return areObjectsEqual(a, b, state);\n }\n // As the penultimate fallback, check if the values passed are primitive wrappers. This\n // is very rare in modern JS, which is why it is deprioritized compared to all other object\n // types.\n if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {\n return arePrimitiveWrappersEqual(a, b, state);\n }\n // If not matching any tags that require a specific type of comparison, then we hard-code false because\n // the only thing remaining is strict equality, which has already been compared. This is for a few reasons:\n // - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only\n // comparison that can be made.\n // - For types that can be introspected, but rarely have requirements to be compared\n // (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common\n // use-cases (may be included in a future release, if requested enough).\n // - For types that can be introspected but do not have an objective definition of what\n // equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.\n // In all cases, these decisions should be reevaluated based on changes to the language and\n // common development practices.\n return false;\n };\n}\n/**\n * Create the configuration object used for building comparators.\n */\nfunction createEqualityComparatorConfig(_a) {\n var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;\n var config = {\n areArraysEqual: strict\n ? areObjectsEqualStrict\n : areArraysEqual,\n areDatesEqual: areDatesEqual,\n areMapsEqual: strict\n ? combineComparators(areMapsEqual, areObjectsEqualStrict)\n : areMapsEqual,\n areObjectsEqual: strict\n ? areObjectsEqualStrict\n : areObjectsEqual,\n arePrimitiveWrappersEqual: arePrimitiveWrappersEqual,\n areRegExpsEqual: areRegExpsEqual,\n areSetsEqual: strict\n ? combineComparators(areSetsEqual, areObjectsEqualStrict)\n : areSetsEqual,\n areTypedArraysEqual: strict\n ? areObjectsEqualStrict\n : areTypedArraysEqual,\n };\n if (createCustomConfig) {\n config = assign({}, config, createCustomConfig(config));\n }\n if (circular) {\n var areArraysEqual$1 = createIsCircular(config.areArraysEqual);\n var areMapsEqual$1 = createIsCircular(config.areMapsEqual);\n var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);\n var areSetsEqual$1 = createIsCircular(config.areSetsEqual);\n config = assign({}, config, {\n areArraysEqual: areArraysEqual$1,\n areMapsEqual: areMapsEqual$1,\n areObjectsEqual: areObjectsEqual$1,\n areSetsEqual: areSetsEqual$1,\n });\n }\n return config;\n}\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nfunction createInternalEqualityComparator(compare) {\n return function (a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {\n return compare(a, b, state);\n };\n}\n/**\n * Create the `isEqual` function used by the consuming application.\n */\nfunction createIsEqual(_a) {\n var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;\n if (createState) {\n return function isEqual(a, b) {\n var _a = createState(), _b = _a.cache, cache = _b === void 0 ? circular ? new WeakMap() : undefined : _b, meta = _a.meta;\n return comparator(a, b, {\n cache: cache,\n equals: equals,\n meta: meta,\n strict: strict,\n });\n };\n }\n if (circular) {\n return function isEqual(a, b) {\n return comparator(a, b, {\n cache: new WeakMap(),\n equals: equals,\n meta: undefined,\n strict: strict,\n });\n };\n }\n var state = {\n cache: undefined,\n equals: equals,\n meta: undefined,\n strict: strict,\n };\n return function isEqual(a, b) {\n return comparator(a, b, state);\n };\n}\n\n/**\n * Whether the items passed are deeply-equal in value.\n */\nvar deepEqual = createCustomEqual();\n/**\n * Whether the items passed are deeply-equal in value based on strict comparison.\n */\nvar strictDeepEqual = createCustomEqual({ strict: true });\n/**\n * Whether the items passed are deeply-equal in value, including circular references.\n */\nvar circularDeepEqual = createCustomEqual({ circular: true });\n/**\n * Whether the items passed are deeply-equal in value, including circular references,\n * based on strict comparison.\n */\nvar strictCircularDeepEqual = createCustomEqual({\n circular: true,\n strict: true,\n});\n/**\n * Whether the items passed are shallowly-equal in value.\n */\nvar shallowEqual = createCustomEqual({\n createInternalComparator: function () { return sameValueZeroEqual; },\n});\n/**\n * Whether the items passed are shallowly-equal in value based on strict comparison\n */\nvar strictShallowEqual = createCustomEqual({\n strict: true,\n createInternalComparator: function () { return sameValueZeroEqual; },\n});\n/**\n * Whether the items passed are shallowly-equal in value, including circular references.\n */\nvar circularShallowEqual = createCustomEqual({\n circular: true,\n createInternalComparator: function () { return sameValueZeroEqual; },\n});\n/**\n * Whether the items passed are shallowly-equal in value, including circular references,\n * based on strict comparison.\n */\nvar strictCircularShallowEqual = createCustomEqual({\n circular: true,\n createInternalComparator: function () { return sameValueZeroEqual; },\n strict: true,\n});\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n */\nfunction createCustomEqual(options) {\n if (options === void 0) { options = {}; }\n var _a = options.circular, circular = _a === void 0 ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === void 0 ? false : _b;\n var config = createEqualityComparatorConfig(options);\n var comparator = createEqualityComparator(config);\n var equals = createCustomInternalComparator\n ? createCustomInternalComparator(comparator)\n : createInternalEqualityComparator(comparator);\n return createIsEqual({ circular: circular, comparator: comparator, createState: createState, equals: equals, strict: strict });\n}\n\nexport { circularDeepEqual, circularShallowEqual, createCustomEqual, deepEqual, sameValueZeroEqual, shallowEqual, strictCircularDeepEqual, strictCircularShallowEqual, strictDeepEqual, strictShallowEqual };\n//# sourceMappingURL=index.mjs.map\n","// There is a circular version https://www.npmjs.com/package/fast-equals#circulardeepequal that I\n// think allows comparing React refs (which have circular references in particular places that this\n// library would ignore). Maybe we can change to that version sometime if needed.\nimport { deepEqual as isEqualDeep } from 'fast-equals';\n\n/**\n * Check that two objects are deeply equal, comparing members of each object and such\n *\n * @param a The first object to compare\n * @param b The second object to compare\n *\n * WARNING: Objects like arrays from different iframes have different constructor function\n * references even if they do the same thing, so this deep equality comparison fails objects that\n * look the same but have different constructors because different constructors could produce\n * false positives in [a few specific\n * situations](https://github.com/planttheidea/fast-equals/blob/a41afc0a240ad5a472e47b53791e9be017f52281/src/comparator.ts#L96).\n * This means that two objects like arrays from different iframes that look the same will fail\n * this check. Please use some other means to check deep equality in those situations.\n *\n * Note: This deep equality check considers `undefined` values on keys of objects NOT to be equal to\n * not specifying the key at all. For example, `{ stuff: 3, things: undefined }` and `{ stuff: 3\n * }` are not considered equal in this case\n *\n * - For more information and examples, see [this\n * CodeSandbox](https://codesandbox.io/s/deepequallibrarycomparison-4g4kk4?file=/src/index.mjs).\n *\n * @returns True if a and b are deeply equal; false otherwise\n */\nexport default function deepEqual(a: unknown, b: unknown) {\n return isEqualDeep(a, b);\n}\n","import deepEqual from './equality-checking';\n\n/**\n * Check if one object is a subset of the other object. \"Subset\" means that all properties of one\n * object are present in the other object, and if they are present that all values of those\n * properties are deeply equal. Sub-objects are also checked to be subsets of the corresponding\n * sub-object in the other object.\n *\n * @example ObjB is a subset of objA given these objects:\n *\n * ```ts\n * objA = { name: 'Alice', age: 30, address: { city: 'Seattle', state: 'Washington' } };\n * objB = { name: 'Alice', address: { city: 'Seattle' } };\n * ```\n *\n * It is important to note that only arrays of primitives (i.e., booleans, numbers, strings) are\n * supported. In particular, objects in arrays will not be checked for deep equality. Also, presence\n * in an array is all this checks, not the number of times that an item appears in an array. `[1,\n * 1]` is a subset of `[1]`.\n *\n * @param objectWithAllProperties Object to be checked if it is a superset of\n * `objectWithPartialProperties`\n * @param objectWithPartialProperties Object to be checked if it is a subset of\n * `objectWithAllProperties`\n * @returns True if `objectWithAllProperties` contains all the properties of\n * `objectWithPartialProperties` and all values of those properties are deeply equal\n */\nexport default function isSubset(\n objectWithAllProperties: unknown,\n objectWithPartialProperties: unknown,\n): boolean {\n if (typeof objectWithAllProperties !== typeof objectWithPartialProperties) return false;\n\n // For this function we're saying that all falsy things of the same type are equal to each other\n if (!objectWithAllProperties && !objectWithPartialProperties) return true;\n\n if (Array.isArray(objectWithAllProperties)) {\n // We know these are arrays from the line above\n /* eslint-disable no-type-assertion/no-type-assertion */\n const partialArray = objectWithPartialProperties as Array;\n const allArray = objectWithAllProperties as Array;\n /* eslint-enable no-type-assertion/no-type-assertion */\n\n if (partialArray.length === 0) return true;\n\n // This only works with arrays of primitives.\n // If someone cares about checking arrays of objects this needs updating.\n return partialArray.every((item) => allArray.includes(item));\n }\n\n if (typeof objectWithAllProperties !== 'object')\n return deepEqual(objectWithAllProperties, objectWithPartialProperties);\n\n // We know these are objects that potentially have properties because of the earlier checks\n /* eslint-disable no-type-assertion/no-type-assertion */\n const partialObj = objectWithPartialProperties as Record;\n const allObj = objectWithAllProperties as Record;\n /* eslint-enable no-type-assertion/no-type-assertion */\n\n let retVal = true;\n Object.keys(partialObj).forEach((key) => {\n if (!retVal) return;\n if (!Object.hasOwn(allObj, key)) retVal = false;\n else if (!isSubset(allObj[key], partialObj[key])) retVal = false;\n });\n return retVal;\n}\n","/**\n * Converts a JavaScript value to a JSON string, changing `undefined` properties in the JavaScript\n * object to `null` properties in the JSON string.\n *\n * WARNING: `null` values will become `undefined` values after passing through {@link serialize} then\n * {@link deserialize}. For example, `{ a: 1, b: undefined, c: null }` will become `{ a: 1, b:\n * undefined, c: undefined }`. If you are passing around user data that needs to retain `null`\n * values, you should wrap them yourself in a string before using this function. Alternatively, you\n * can write your own replacer that will preserve `null` in a way that you can recover later.\n *\n * @param value A JavaScript value, usually an object or array, to be converted.\n * @param replacer A function that transforms the results. Note that all `undefined` values returned\n * by the replacer will be further transformed into `null` in the JSON string.\n * @param space Adds indentation, white space, and line break characters to the return-value JSON\n * text to make it easier to read. See the `space` parameter of `JSON.stringify` for more\n * details.\n */\nexport function serialize(\n value: unknown,\n replacer?: (this: unknown, key: string, value: unknown) => unknown,\n space?: string | number,\n): string {\n const undefinedReplacer = (replacerKey: string, replacerValue: unknown) => {\n let newValue = replacerValue;\n if (replacer) newValue = replacer(replacerKey, newValue);\n // All `undefined` values become `null` on the way from JS objects into JSON strings\n // eslint-disable-next-line no-null/no-null\n if (newValue === undefined) newValue = null;\n return newValue;\n };\n return JSON.stringify(value, undefinedReplacer, space);\n}\n\n/**\n * Converts a JSON string into a value, converting all `null` properties from JSON into `undefined`\n * in the returned JavaScript value/object.\n *\n * WARNING: `null` values will become `undefined` values after passing through {@link serialize} then\n * {@link deserialize}. For example, `{ a: 1, b: undefined, c: null }` will become `{ a: 1, b:\n * undefined, c: undefined }`. If you are passing around user data that needs to retain `null`\n * values, you should wrap them yourself in a string before using this function. Alternatively, you\n * can write your own replacer that will preserve `null` in a way that you can recover later.\n *\n * @param value A valid JSON string.\n * @param reviver A function that transforms the results. This function is called for each member of\n * the object. If a member contains nested objects, the nested objects are transformed before the\n * parent object is. Note that `null` values are converted into `undefined` values after the\n * reviver has run.\n */\nexport function deserialize(\n value: string,\n reviver?: (this: unknown, key: string, value: unknown) => unknown,\n // Need to use `any` instead of `unknown` here to match the signature of JSON.parse\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n // Helper function to replace `null` with `undefined` on a per property basis. This can't be done\n // with our own reviver because `JSON.parse` removes `undefined` properties from the return value.\n function replaceNull(obj: Record): Record {\n Object.keys(obj).forEach((key: string | number) => {\n // We only want to replace `null`, not other falsy values\n // eslint-disable-next-line no-null/no-null\n if (obj[key] === null) obj[key] = undefined;\n // If the property is an object, recursively call the helper function on it\n else if (typeof obj[key] === 'object')\n // Since the object came from a string, we know the keys will not be symbols\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n obj[key] = replaceNull(obj[key] as Record);\n });\n return obj;\n }\n\n const parsedObject = JSON.parse(value, reviver);\n // Explicitly convert the value 'null' that isn't stored as a property on an object to 'undefined'\n // eslint-disable-next-line no-null/no-null\n if (parsedObject === null) return undefined;\n if (typeof parsedObject === 'object') return replaceNull(parsedObject);\n return parsedObject;\n}\n\n/**\n * Check to see if the value is serializable without losing information\n *\n * @param value Value to test\n * @returns True if serializable; false otherwise\n *\n * Note: the values `undefined` and `null` are serializable (on their own or in an array), but\n * `null` values get transformed into `undefined` when serializing/deserializing.\n *\n * WARNING: This is inefficient right now as it stringifies, parses, stringifies, and === the value.\n * Please only use this if you need to\n *\n * DISCLAIMER: this does not successfully detect that values are not serializable in some cases:\n *\n * - Losses of removed properties like functions and `Map`s\n * - Class instances (not deserializable into class instances without special code)\n *\n * We intend to improve this in the future if it becomes important to do so. See [`JSON.stringify`\n * documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#description)\n * for more information.\n */\nexport function isSerializable(value: unknown): boolean {\n try {\n const serializedValue = serialize(value);\n return serializedValue === serialize(deserialize(serializedValue));\n } catch (e) {\n return false;\n }\n}\n\n/**\n * HTML Encodes the provided string. Thanks to ChatGPT\n *\n * @param str String to HTML encode\n * @returns HTML-encoded string\n */\nexport const htmlEncode = (str: string): string =>\n str\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n .replace(/\\//g, '/');\n","import DateTimeFormat from './intl-date-time-format';\n\n/**\n * Retrieves the current locale of the user's environment.\n *\n * @returns A string representing the current locale. If the locale cannot be determined, the\n * function returns an empty string.\n */\nexport default function getCurrentLocale(): string {\n // Use navigator when available\n if (typeof navigator !== 'undefined' && navigator.languages) {\n return navigator.languages[0];\n }\n // For Node.js\n return new DateTimeFormat().resolvedOptions().locale;\n}\n","import NumberFormat from './intl-number-format';\n\n/**\n * Formats a number according to the locale and formatting options of this NumberFormat object\n *\n * @example FormatBytes(1024) => \"1 KB\"\n *\n * @example FormatBytes(1024, 0) => \"1 KB\"\n *\n * @param fileSize Number to format\n * @param decimals Number of decimal places to round to\n * @returns String representing the given number formatted according to the locale and formatting\n * options of this NumberFormat object\n */\nexport default function formatBytes(fileSize: number, decimals: number = 2): string {\n if (fileSize === 0) return '0 Bytes';\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n const i = Math.floor(Math.log(fileSize) / Math.log(1024));\n const sizeToUse = sizes[i];\n const formattingFileSize = new NumberFormat('en', {\n style: 'decimal',\n maximumFractionDigits: decimals,\n minimumFractionDigits: 0,\n }).format(fileSize / 1024 ** i);\n return `${formattingFileSize} ${sizeToUse}`;\n}\n","//----------------------------------------------------------------------------------------------\n// NOTE: If you change any of the types, make sure the JSON schema at the end of this file gets\n// changed so they align.\n//----------------------------------------------------------------------------------------------\n\nimport { LocalizeKey, ReferencedItem } from 'menus.model';\n\n/** The data an extension provides to inform Platform.Bible of the settings it provides */\nexport type SettingsContribution = SettingsGroup | SettingsGroup[];\n/** A description of an extension's setting entry */\nexport type Setting = ExtensionControlledSetting;\n/** Setting definition that is validated by the extension. */\nexport type ExtensionControlledSetting = SettingBase & ModifierExtensionControlled;\n/** Base information needed to describe a setting entry */\nexport type SettingBase = StateBase & {\n [k: string]: unknown;\n /** LocalizeKey that displays in the settings dialog as the setting name */\n label: LocalizeKey;\n /** LocalizeKey that displays in the settings dialog to describe the setting */\n description?: LocalizeKey;\n};\n/** The data an extension provides to inform Platform.Bible of the project settings it provides */\nexport type ProjectSettingsContribution = ProjectSettingsGroup | ProjectSettingsGroup[];\n/** A description of an extension's setting entry */\nexport type ProjectSetting = ExtensionControlledProjectSetting;\n/** Setting definition that is validated by the extension. */\nexport type ExtensionControlledProjectSetting = ProjectSettingBase & ModifierExtensionControlled;\n/** Base information needed to describe a project setting entry */\nexport type ProjectSettingBase = SettingBase & ModifierProject;\n/** A description of an extension's user state entry */\nexport type UserState = ExtensionControlledState;\n/** State definition that is validated by the extension. */\nexport type ExtensionControlledState = StateBase & ModifierExtensionControlled;\n/** Group of related settings definitions */\nexport interface SettingsGroup {\n [k: string]: unknown;\n /** LocalizeKey that displays in the settings dialog as the group name */\n label: LocalizeKey;\n /** LocalizeKey that displays in the settings dialog to describe the group */\n description?: LocalizeKey;\n properties: SettingProperties;\n}\n/** Object whose keys are setting IDs and whose values are settings objects */\nexport interface SettingProperties {\n [k: ReferencedItem]: Setting;\n}\n/** Base information needed to describe a state entry */\nexport interface StateBase {\n [k: string]: unknown;\n /** Default value for the state/setting */\n default: unknown;\n /**\n * A state/setting ID whose value to set to this state/setting's starting value the first time\n * this state/setting is loaded\n */\n derivesFrom?: ReferencedItem;\n}\n/**\n * Modifies state/setting type to be extension-controlled. \"Extension-controlled\" means the\n * extension provides the component and the validator for the state/setting, so the state/setting is\n * controlled by the extension.\n */\nexport interface ModifierExtensionControlled {\n [k: string]: unknown;\n platformType?: undefined;\n type?: undefined;\n}\n/** Group of related settings definitions */\nexport interface ProjectSettingsGroup {\n [k: string]: unknown;\n /** LocalizeKey that displays in the project settings dialog as the group name */\n label: LocalizeKey;\n /** LocalizeKey that displays in the project settings dialog to describe the group */\n description?: LocalizeKey;\n properties: ProjectSettingProperties;\n}\n/** Object whose keys are setting IDs and whose values are settings objects */\nexport interface ProjectSettingProperties {\n [k: ReferencedItem]: ProjectSetting;\n}\n\n// Note: we removed the index signature on ModifierProject to avoid having it on\n// `ProjectMetadataFilterOptions`. Unfortunately adding \"additionalProperties\": false on the json\n// schema messes up validation. Please remove the index signature again in the future if you\n// regenerate types\nexport interface ModifierProject {\n /**\n * String representation of `RegExp` pattern(s) to match against projects' `projectInterface`s\n * (using the\n * [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test)\n * function) to determine if they should be included.\n *\n * If this is one string, it will be matched against `projectInterface`s. If this is an array,\n * each entry is handled based on its type (at least one entry must match for this filter\n * condition to pass):\n *\n * - If the entry is a string, it will be matched against each `projectInterface`. If any match, the\n * project will pass this filter condition\n * - If the entry is an array of strings, each will be matched against each `projectInterface`. If\n * every string matches against at least one `projectInterface`, the project will pass this\n * filter condition\n *\n * In other words, each entry in the first-level array is `OR`'ed together. Each entry in\n * second-level arrays (arrays within the first-level array) are `AND`'ed together.\n *\n * Defaults to all {@link ProjectInterfaces}, so all projects that do not match\n * `excludeProjectInterfaces` will be included\n *\n * @example\n *\n * ```typescript\n * includeProjectInterfaces: ['one', ['two', 'three']];\n * ```\n *\n * This filter condition will succeed on projects whose `projectInterface`s fulfill at least one\n * of the following conditions (At least one entry in the array must match):\n *\n * - Include `one`\n * - Include both `two` and `three`.\n */\n includeProjectInterfaces?: undefined | string | (string | string[])[];\n /**\n * String representation of `RegExp` pattern(s) to match against projects' `projectInterface`s\n * (using the\n * [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test)\n * function) to determine if they should absolutely not be included even if they match with\n * `includeProjectInterfaces`.\n *\n * If this is one string, it will be matched against `projectInterface`s. If this is an array,\n * each entry is handled based on its type (at least one entry must match for this filter\n * condition to exclude the project):\n *\n * - If the entry is a string, it will be matched against each `projectInterface`. If any match, the\n * project will pass this filter condition and exclude the project\n * - If the entry is an array of strings, each will be matched against each `projectInterface`. If\n * every string matches against at least one `projectInterface`, the project will pass this\n * filter condition and exclude the project\n *\n * In other words, each entry in the first-level array is `OR`'ed together. Each entry in\n * second-level arrays (arrays within the first-level array) are `AND`'ed together.\n *\n * Defaults to no {@link ProjectInterfaces}, so all projects that match `includeProjectInterfaces`\n * will be included\n *\n * @example\n *\n * ```typescript\n * excludeProjectInterfaces: ['one', ['two', 'three']];\n * ```\n *\n * This filter condition will succeed and exclude projects whose `projectInterface`s fulfill at\n * least one of the following conditions (At least one entry in the array must match):\n *\n * - Include `one`\n * - Include both `two` and `three`.\n */\n excludeProjectInterfaces?: undefined | string | (string | string[])[];\n /**\n * String representation of `RegExp` pattern(s) to match against the Project Data Provider Factory\n * Ids that provided each project's metadata (using the\n * [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test)\n * function) to determine if the projects should be included.\n *\n * Defaults to all Project Data Provider Factory Ids, so all projects that do not match\n * `excludePdpFactoryIds` will be included\n */\n includePdpFactoryIds?: undefined | string | string[];\n /**\n * String representation of `RegExp` pattern(s) to match against the Project Data Provider Factory\n * Ids that provided each project's metadata (using the\n * [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test)\n * function) to determine if the projects should absolutely not be included even if they match\n * with `includeProjectInterfaces`.\n *\n * Defaults to none, so all projects that match `includePdpFactoryIds` will be included\n */\n excludePdpFactoryIds?: undefined | string | string[];\n}\n\n/** The data an extension provides to inform Platform.Bible of the user state it provides */\nexport interface UserStateContribution {\n [k: ReferencedItem]: UserState;\n}\n/** The data an extension provides to inform Platform.Bible of the project state it provides */\nexport interface ProjectStateContribution {\n [k: ReferencedItem]: UserState;\n}\n\n//----------------------------------------------------------------------------------------------\n// NOTE: If you change the schema below, make sure the TS types above get changed so they align.\n//----------------------------------------------------------------------------------------------\nconst settingsDefs = {\n projectSettingsContribution: {\n description:\n 'The data an extension provides to inform Platform.Bible of the project settings it provides',\n anyOf: [\n {\n $ref: '#/$defs/projectSettingsGroup',\n },\n {\n type: 'array',\n items: {\n $ref: '#/$defs/projectSettingsGroup',\n },\n },\n ],\n },\n projectSettingsGroup: {\n description: 'Group of related settings definitions',\n type: 'object',\n properties: {\n label: {\n description: 'localizeKey that displays in the project settings dialog as the group name',\n $ref: '#/$defs/localizeKey',\n },\n description: {\n description:\n 'localizeKey that displays in the project settings dialog to describe the group',\n $ref: '#/$defs/localizeKey',\n },\n properties: {\n $ref: '#/$defs/projectSettingProperties',\n },\n },\n required: ['label', 'properties'],\n },\n projectSettingProperties: {\n description: 'Object whose keys are setting IDs and whose values are settings objects',\n type: 'object',\n patternProperties: {\n '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$': {\n $ref: '#/$defs/projectSetting',\n },\n },\n additionalProperties: false,\n },\n projectSetting: {\n description: \"A description of an extension's setting entry\",\n anyOf: [\n {\n $ref: '#/$defs/extensionControlledProjectSetting',\n },\n ],\n },\n extensionControlledProjectSetting: {\n description: 'Setting definition that is validated by the extension.',\n allOf: [\n {\n $ref: '#/$defs/projectSettingBase',\n },\n {\n $ref: '#/$defs/modifierExtensionControlled',\n },\n ],\n },\n projectSettingBase: {\n description: 'Base information needed to describe a project setting entry',\n allOf: [\n {\n $ref: '#/$defs/settingBase',\n },\n {\n $ref: '#/$defs/modifierProject',\n },\n ],\n },\n modifierProject: {\n description: 'Modifies setting type to be project setting',\n type: 'object',\n properties: {\n includeProjectInterfaces: {\n description:\n \"String representation of `RegExp` pattern(s) to match against projects' `projectInterface`s (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if they should be included.\\n\\nIf this is one string, it will be matched against `projectInterface`s. If this is an array, each entry is handled based on its type (at least one entry must match for this filter condition to pass):\\n\\n- If the entry is a string, it will be matched against each `projectInterface`. If any match, the project will pass this filter condition\\n- If the entry is an array of strings, each will be matched against each `projectInterface`. If every string matches against at least one `projectInterface`, the project will pass this filter condition\\n\\nIn other words, each entry in the first-level array is `OR`'ed together. Each entry in second-level arrays (arrays within the first-level array) are `AND`'ed together.\\n\\nDefaults to all {@link ProjectInterfaces}, so all projects that do not match `excludeProjectInterfaces` will be included\\n\\n@example\\n\\n```typescript\\nincludeProjectInterfaces: ['one', ['two', 'three']];\\n```\\n\\nThis filter condition will succeed on projects whose `projectInterface`s fulfill at least one of the following conditions (At least one entry in the array must match):\\n\\n- Include `one`\\n- Include both `two` and `three`.\",\n anyOf: [\n {\n type: 'null',\n },\n {\n type: 'string',\n },\n {\n type: 'array',\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n type: 'array',\n items: { type: 'string' },\n },\n ],\n },\n },\n ],\n },\n excludeProjectInterfaces: {\n description:\n \"String representation of `RegExp` pattern(s) to match against projects' `projectInterface`s (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if they should absolutely not be included even if they match with `includeProjectInterfaces`.\\n\\nIf this is one string, it will be matched against `projectInterface`s. If this is an array, each entry is handled based on its type (at least one entry must match for this filter condition to exclude the project):\\n\\n- If the entry is a string, it will be matched against each `projectInterface`. If any match, the project will pass this filter condition and exclude the project\\n- If the entry is an array of strings, each will be matched against each `projectInterface`. If every string matches against at least one `projectInterface`, the project will pass this filter condition and exclude the project\\n\\nIn other words, each entry in the first-level array is `OR`'ed together. Each entry in second-level arrays (arrays within the first-level array) are `AND`'ed together.\\n\\nDefaults to no {@link ProjectInterfaces}, so all projects that match `includeProjectInterfaces` will be included\\n\\n@example\\n\\n```typescript\\nexcludeProjectInterfaces: ['one', ['two', 'three']];\\n```\\n\\nThis filter condition will succeed and exclude projects whose `projectInterface`s fulfill at least one of the following conditions (At least one entry in the array must match):\\n\\n- Include `one`\\n- Include both `two` and `three`.\",\n anyOf: [\n {\n type: 'null',\n },\n {\n type: 'string',\n },\n {\n type: 'array',\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n type: 'array',\n items: { type: 'string' },\n },\n ],\n },\n },\n ],\n },\n includePdpFactoryIds: {\n description:\n \"String representation of `RegExp` pattern(s) to match against the Project Data Provider Factory Ids that provided each project's metadata (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if the projects should be included.\\n\\nDefaults to all Project Data Provider Factory Ids, so all projects that do not match `excludePdpFactoryIds` will be included\",\n anyOf: [\n {\n type: 'null',\n },\n {\n type: 'string',\n },\n {\n type: 'array',\n items: { type: 'string' },\n },\n ],\n },\n excludePdpFactoryIds: {\n description:\n \"String representation of `RegExp` pattern(s) to match against the Project Data Provider Factory Ids that provided each project's metadata (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if the projects should absolutely not be included even if they match with `includeProjectInterfaces`.\\n\\nDefaults to none, so all projects that match `includePdpFactoryIds` will be included\",\n anyOf: [\n {\n type: 'null',\n },\n {\n type: 'string',\n },\n {\n type: 'array',\n items: { type: 'string' },\n },\n ],\n },\n },\n },\n settingsContribution: {\n description:\n 'The data an extension provides to inform Platform.Bible of the settings it provides',\n anyOf: [\n {\n $ref: '#/$defs/settingsGroup',\n },\n {\n type: 'array',\n items: {\n $ref: '#/$defs/settingsGroup',\n },\n },\n ],\n },\n settingsGroup: {\n description: 'Group of related settings definitions',\n type: 'object',\n properties: {\n label: {\n description: 'localizeKey that displays in the settings dialog as the group name',\n $ref: '#/$defs/localizeKey',\n },\n description: {\n description: 'localizeKey that displays in the settings dialog to describe the group',\n $ref: '#/$defs/localizeKey',\n },\n properties: {\n $ref: '#/$defs/settingProperties',\n },\n },\n required: ['label', 'properties'],\n },\n settingProperties: {\n description: 'Object whose keys are setting IDs and whose values are settings objects',\n type: 'object',\n patternProperties: {\n '^[\\\\w-]+\\\\.[\\\\w-]+$': {\n $ref: '#/$defs/setting',\n },\n },\n additionalProperties: false,\n },\n setting: {\n description: \"A description of an extension's setting entry\",\n anyOf: [\n {\n $ref: '#/$defs/extensionControlledSetting',\n },\n ],\n },\n extensionControlledSetting: {\n description: 'Setting definition that is validated by the extension.',\n allOf: [\n {\n $ref: '#/$defs/settingBase',\n },\n {\n $ref: '#/$defs/modifierExtensionControlled',\n },\n ],\n },\n settingBase: {\n description: 'Base information needed to describe a setting entry',\n allOf: [\n {\n $ref: '#/$defs/stateBase',\n },\n {\n type: 'object',\n properties: {\n label: {\n description: 'localizeKey that displays in the settings dialog as the setting name',\n $ref: '#/$defs/localizeKey',\n },\n description: {\n description: 'localizeKey that displays in the settings dialog to describe the setting',\n $ref: '#/$defs/localizeKey',\n },\n },\n required: ['label'],\n },\n ],\n },\n projectStateContribution: {\n description:\n 'The data an extension provides to inform Platform.Bible of the project state it provides',\n $ref: '#/$defs/userStateProperties',\n },\n userStateContribution: {\n description:\n 'The data an extension provides to inform Platform.Bible of the user state it provides',\n $ref: '#/$defs/userStateProperties',\n },\n userStateProperties: {\n description: 'Object whose keys are state IDs and whose values are state objects',\n type: 'object',\n patternProperties: {\n '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$': {\n $ref: '#/$defs/userState',\n },\n },\n additionalProperties: false,\n },\n userState: {\n description: \"A description of an extension's user state entry\",\n anyOf: [\n {\n $ref: '#/$defs/extensionControlledState',\n },\n ],\n },\n extensionControlledState: {\n description: 'State definition that is validated by the extension.',\n allOf: [\n {\n $ref: '#/$defs/stateBase',\n },\n {\n $ref: '#/$defs/modifierExtensionControlled',\n },\n ],\n },\n modifierExtensionControlled: {\n description:\n 'Modifies state/setting type to be extension-controlled. \"Extension-controlled\" means the extension provides the component and the validator for the state/setting, so the state/setting is controlled by the extension.',\n not: {\n anyOf: [\n {\n type: 'object',\n required: ['platformType'],\n },\n {\n type: 'object',\n required: ['type'],\n },\n ],\n },\n },\n stateBase: {\n description: 'Base information needed to describe a state entry',\n type: 'object',\n properties: {\n default: {\n description: 'default value for the state/setting',\n type: 'any',\n },\n derivesFrom: {\n description:\n \"a state/setting ID whose value to set to this state/setting's starting value the first time this state/setting is loaded\",\n $ref: '#/$defs/id',\n },\n },\n required: ['default'],\n },\n localizeKey: {\n description: \"Identifier for a string that will be localized based on the user's UI language\",\n type: 'string',\n pattern: '^%[\\\\w\\\\-\\\\.]+%$',\n tsType: 'LocalizeKey',\n },\n id: {\n description: '',\n type: 'string',\n pattern: '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$',\n tsType: 'Id',\n },\n};\n\n/**\n * Json-schema-to-typescript has some added stuff that isn't actually compatible with JSON schema,\n * so we remove them here\n *\n * @param defs The `$defs` property of a JSON schema (will be modified in place)\n */\n// JSON schema types are weird, so we'll just be careful\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function removeJsonToTypeScriptTypesStuff(defs: any) {\n if (!defs) return;\n\n // JSON schema types are weird, so we'll just be careful\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.values(defs).forEach((def: any) => {\n if (!def.type) return;\n\n if ('tsType' in def) delete def.tsType;\n\n if (def.type === 'any') {\n delete def.type;\n return;\n }\n\n if (def.type === 'object') {\n removeJsonToTypeScriptTypesStuff(def.properties);\n }\n });\n}\n\nremoveJsonToTypeScriptTypesStuff(settingsDefs);\n\n/** JSON schema object that aligns with the ProjectSettingsContribution type */\nexport const projectSettingsDocumentSchema = {\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n title: 'Project Settings Contribution',\n description:\n 'The data an extension provides to inform Platform.Bible of the project settings it provides',\n anyOf: [\n {\n $ref: '#/$defs/projectSettingsGroup',\n },\n {\n type: 'array',\n items: {\n $ref: '#/$defs/projectSettingsGroup',\n },\n },\n ],\n\n $defs: settingsDefs,\n};\n\nObject.freeze(projectSettingsDocumentSchema);\n\n/** JSON schema object that aligns with the {@link SettingsContribution} type */\nexport const settingsDocumentSchema = {\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n title: 'Settings Contribution',\n description:\n 'The data an extension provides to inform Platform.Bible of the settings it provides',\n anyOf: [\n {\n $ref: '#/$defs/settingsGroup',\n },\n {\n type: 'array',\n items: {\n $ref: '#/$defs/settingsGroup',\n },\n },\n ],\n\n $defs: settingsDefs,\n};\n\nObject.freeze(settingsDocumentSchema);\n","//----------------------------------------------------------------------------------------------\n// NOTE: If you change any of the types, make sure the JSON schema at the end of this file gets\n// changed so they align.\n//----------------------------------------------------------------------------------------------\n\nimport { LocalizeKey } from 'menus.model';\nimport { removeJsonToTypeScriptTypesStuff } from './settings.model';\n\n/** Localized string value associated with this key */\nexport type LocalizedStringValue = string;\n\n/** The data an extension provides to inform Platform.Bible of the localized strings it provides. */\nexport interface LocalizedStringDataContribution {\n [k: string]: unknown;\n metadata?: StringsMetadata;\n localizedStrings?: {\n [k: string]: LanguageStrings;\n };\n}\n/**\n * Map whose keys are localized string keys and whose values provide additional non-locale-specific\n * information about the localized string key\n */\nexport interface StringsMetadata {\n [k: LocalizeKey]: StringMetadata;\n}\n/** Additional non-locale-specific information about a localized string key */\nexport interface StringMetadata {\n [k: string]: unknown;\n /**\n * Localized string key from which to get this value if one does not exist in the specified\n * language. If a new key/value pair needs to be made to replace an existing one, this could help\n * smooth over the transition if the meanings are close enough\n *\n * You can use Paratext 9 Localized String Keys here. Be sure to escape any % signs with a\n * backslash `\\`.\n */\n fallbackKey?: LocalizeKey;\n /**\n * Additional information provided by developers in English to help the translator to know how to\n * translate this localized string accurately\n */\n notes?: string;\n}\n/**\n * Map whose keys are localized string keys and whose values provide information about how to\n * localize strings for the localized string key\n */\nexport interface LanguageStrings {\n [k: LocalizeKey]: LocalizedStringValue;\n}\n\n//----------------------------------------------------------------------------------------------\n// NOTE: If you change the schema below, make sure the TS types above get changed so they align.\n//----------------------------------------------------------------------------------------------\n\nconst localizedStringsDefs = {\n languageStrings: {\n description:\n 'Map whose keys are localized string keys and whose values provide information about how to localize strings for the localized string key',\n type: 'object',\n patternProperties: {\n '^%[\\\\w\\\\-\\\\.]+%$': {\n $ref: '#/$defs/localizedStringValue',\n },\n },\n additionalProperties: false,\n },\n localizedStringValue: {\n description: 'Localized string value associated with this key',\n type: 'string',\n },\n stringsMetadata: {\n description:\n 'Map whose keys are localized string keys and whose values provide additional non-locale-specific information about the localized string key',\n type: 'object',\n patternProperties: {\n '^%[\\\\w\\\\-\\\\.]+%$': {\n $ref: '#/$defs/stringMetadata',\n },\n },\n additionalProperties: false,\n },\n stringMetadata: {\n description: 'Additional non-locale-specific information about a localized string key',\n type: 'object',\n properties: {\n fallbackKey: {\n description:\n 'Localized string key from which to get this value if one does not exist in the specified language. If a new key/value pair needs to be made to replace an existing one, this could help smooth over the transition if the meanings are close enough.\\nYou can use Paratext 9 Localized String Keys here. Be sure to escape any % signs with a backslash `\\\\`.',\n type: 'string',\n pattern: \"^%[\\\\w\\\\-\\\\.;&,' (){}#:/\\\\\\\\?%⋮|[\\\\]“”‘’!~*\\u00A0+=•`…\\u200B↑↓]+%$\",\n tsType: 'LocalizeKey',\n },\n notes: {\n description:\n 'Additional information provided by developers in English to help the translator to know how to translate this localized string accurately',\n type: 'string',\n },\n },\n },\n localizeKey: {\n description: \"Identifier for a string that will be localized based on the user's UI language\",\n type: 'string',\n pattern: '^%[\\\\w\\\\-\\\\.]+%$',\n tsType: 'LocalizeKey',\n },\n};\n\nremoveJsonToTypeScriptTypesStuff(localizedStringsDefs);\n\n/** JSON schema object that aligns with the LocalizedStringDataContribution type */\nexport const localizedStringsDocumentSchema = {\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n title: 'Localized String Data Contribution',\n description:\n 'The data an extension provides to inform Platform.Bible of the localized strings it provides.',\n type: 'object',\n properties: {\n metadata: {\n $ref: '#/$defs/stringsMetadata',\n },\n localizedStrings: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/languageStrings',\n },\n },\n },\n $defs: localizedStringsDefs,\n};\n\nObject.freeze(localizedStringsDocumentSchema);\n","//----------------------------------------------------------------------------------------------\n// NOTE: If you change any of the types, make sure the JSON schema at the end of this file gets\n// changed so they align.\n//----------------------------------------------------------------------------------------------\n\nimport { ReplaceType } from './util';\n\n/** Identifier for a string that will be localized in a menu based on the user's UI language */\nexport type LocalizeKey = `%${string}%`;\n\n/** Name of some UI element (i.e., tab, column, group, menu item) or some PAPI object (i.e., command) */\nexport type ReferencedItem = `${string}.${string}`;\n\nexport type OrderedItem = {\n /** Relative order of this item compared to other items in the same parent/scope (sorted ascending) */\n order: number;\n};\n\nexport type OrderedExtensibleContainer = OrderedItem & {\n /** Determines whether other items can be added to this after it has been defined */\n isExtensible?: boolean;\n};\n\n/** Group of menu items that belongs in a column */\nexport type MenuGroupDetailsInColumn = OrderedExtensibleContainer & {\n /** ID of column in which this group resides */\n column: ReferencedItem;\n};\n\n/** Group of menu items that belongs in a submenu */\nexport type MenuGroupDetailsInSubMenu = OrderedExtensibleContainer & {\n /** ID of menu item hosting the submenu in which this group resides */\n menuItem: ReferencedItem;\n};\n\n/** Column that includes header text in a menu */\nexport type MenuColumnWithHeader = OrderedExtensibleContainer & {\n /** Key that represents the text of the header text of the column */\n label: LocalizeKey;\n};\n\nexport type MenuItemBase = OrderedItem & {\n /** Menu group to which this menu item belongs */\n group: ReferencedItem;\n /** Key that represents the text of this menu item to display */\n label: LocalizeKey;\n /** Key that represents words the platform should reference when users are searching for menu items */\n searchTerms?: LocalizeKey;\n /** Key that represents the text to display if a mouse pointer hovers over the menu item */\n tooltip?: LocalizeKey;\n /** Additional information provided by developers to help people who perform localization */\n localizeNotes: string;\n};\n\n/** Menu item that hosts a submenu */\nexport type MenuItemContainingSubmenu = MenuItemBase & {\n /** ID for this menu item that holds a submenu */\n id: ReferencedItem;\n};\n\n/** Menu item that runs a command */\nexport type MenuItemContainingCommand = MenuItemBase & {\n /** Name of the PAPI command to run when this menu item is selected. */\n command: ReferencedItem;\n /**\n * Uri path to the icon to display after the menu text. Ex:\n * `papi-extension://helloWorld/assets/icon.png`\n */\n iconPathAfter?: string;\n /**\n * Uri path to the icon to display before the menu text. Ex:\n * `papi-extension://helloWorld/assets/icon.png`\n */\n iconPathBefore?: string;\n};\n\n/**\n * Group of menu items that can be combined with other groups to form a single context menu/submenu.\n * Groups are separated using a line within the menu/submenu.\n */\nexport type GroupsInSingleColumnMenu = {\n /** Named menu group */\n [property: ReferencedItem]: OrderedExtensibleContainer | MenuGroupDetailsInSubMenu;\n};\n\n/**\n * Group of menu items that can be combined with other groups to form a single menu/submenu within a\n * multi-column menu. Groups are separated using a line within the menu/submenu.\n */\nexport type GroupsInMultiColumnMenu = {\n /** Named menu group */\n [property: ReferencedItem]: MenuGroupDetailsInColumn | MenuGroupDetailsInSubMenu;\n};\n\n/** Group of columns that can be combined with other columns to form a multi-column menu */\nexport type ColumnsWithHeaders = {\n /** Named column of a menu */\n [property: ReferencedItem]: MenuColumnWithHeader;\n /** Defines whether columns can be added to this multi-column menu */\n isExtensible?: boolean;\n};\n\n/** Menu that contains a column without a header */\nexport type SingleColumnMenu = {\n /** Groups that belong in this menu */\n groups: GroupsInSingleColumnMenu;\n /** List of menu items that belong in this menu */\n items: (MenuItemContainingCommand | MenuItemContainingSubmenu)[];\n};\n\n/** Menu that contains multiple columns with headers */\nexport type MultiColumnMenu = {\n /** Columns that belong in this menu */\n columns: ColumnsWithHeaders;\n /** Groups that belong in this menu */\n groups: GroupsInMultiColumnMenu;\n /** List of menu items that belong in this menu */\n items: (MenuItemContainingCommand | MenuItemContainingSubmenu)[];\n};\n\n/** Menus for one single web view */\nexport type WebViewMenu = {\n /** Indicates whether the platform default menus should be included for this webview */\n includeDefaults: boolean | undefined;\n /** Menu that opens when you click on the top left corner of a tab */\n topMenu: MultiColumnMenu | undefined;\n /** Menu that opens when you right click on the main body/area of a tab */\n contextMenu: SingleColumnMenu | undefined;\n};\n\n/** Menus for all web views */\nexport type WebViewMenus = {\n /** Named web view */\n [property: ReferencedItem]: WebViewMenu;\n};\n\n/** Platform.Bible menus before they are localized */\nexport type PlatformMenus = {\n /** Top level menu for the application */\n mainMenu: MultiColumnMenu;\n /** Menus that apply per web view in the application */\n webViewMenus: WebViewMenus;\n /** Default context menu for web views that don't specify their own */\n defaultWebViewContextMenu: SingleColumnMenu;\n /** Default top menu for web views that don't specify their own */\n defaultWebViewTopMenu: MultiColumnMenu;\n};\n\n/**\n * Type that converts any menu type before it is localized to what it is after it is localized. This\n * can be applied to any menu type as needed.\n */\nexport type Localized = ReplaceType, ReferencedItem, string>;\n\n//----------------------------------------------------------------------------------------------\n// NOTE: If you change the schema below, make sure the TS types above get changed so they align.\n//----------------------------------------------------------------------------------------------\n/** JSON schema object that aligns with the PlatformMenus type */\nexport const menuDocumentSchema = {\n title: 'Platform.Bible menus',\n type: 'object',\n properties: {\n mainMenu: {\n description: 'Top level menu for the application',\n $ref: '#/$defs/multiColumnMenu',\n },\n defaultWebViewTopMenu: {\n description: \"Default top menu for web views that don't specify their own\",\n $ref: '#/$defs/multiColumnMenu',\n },\n defaultWebViewContextMenu: {\n description: \"Default context menu for web views that don't specify their own\",\n $ref: '#/$defs/singleColumnMenu',\n },\n webViewMenus: {\n description: 'Menus that apply per web view in the application',\n type: 'object',\n patternProperties: {\n '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$': {\n $ref: '#/$defs/menusForOneWebView',\n },\n },\n additionalProperties: false,\n },\n },\n required: ['mainMenu', 'defaultWebViewTopMenu', 'defaultWebViewContextMenu', 'webViewMenus'],\n additionalProperties: false,\n $defs: {\n localizeKey: {\n description:\n \"Identifier for a string that will be localized in a menu based on the user's UI language\",\n type: 'string',\n pattern: '^%[\\\\w\\\\-\\\\.]+%$',\n },\n referencedItem: {\n description:\n 'Name of some UI element (i.e., tab, column, group, menu item) or some PAPI object (i.e., command)',\n type: 'string',\n pattern: '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$',\n },\n columnsWithHeaders: {\n description:\n 'Group of columns that can be combined with other columns to form a multi-column menu',\n type: 'object',\n patternProperties: {\n '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$': {\n description: 'Single column with a header string',\n type: 'object',\n properties: {\n label: {\n description: 'Header text for this this column in the UI',\n $ref: '#/$defs/localizeKey',\n },\n localizeNotes: {\n description:\n 'Additional information provided by developers to help people who perform localization',\n type: 'string',\n },\n order: {\n description:\n 'Relative order of this column compared to other columns (sorted ascending)',\n type: 'number',\n },\n isExtensible: {\n description:\n 'Defines whether contributions are allowed to add menu groups to this column',\n type: 'boolean',\n },\n },\n required: ['label', 'order'],\n additionalProperties: false,\n },\n },\n properties: {\n isExtensible: {\n description:\n 'Defines whether contributions are allowed to add columns to this multi-column menu',\n type: 'boolean',\n },\n },\n },\n menuGroups: {\n description:\n 'Group of menu items that can be combined with other groups to form a single menu/submenu. Groups are separated using a line within the menu/submenu.',\n type: 'object',\n patternProperties: {\n '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$': {\n description: 'Single group that contains menu items',\n type: 'object',\n oneOf: [\n {\n properties: {\n column: {\n description:\n 'Column where this group belongs, not required for single column menus',\n $ref: '#/$defs/referencedItem',\n },\n order: {\n description:\n 'Relative order of this group compared to other groups in the same column or submenu (sorted ascending)',\n type: 'number',\n },\n isExtensible: {\n description:\n 'Defines whether contributions are allowed to add menu items to this menu group',\n type: 'boolean',\n },\n },\n required: ['order'],\n additionalProperties: false,\n },\n {\n properties: {\n menuItem: {\n description: 'Menu item that anchors the submenu where this group belongs',\n $ref: '#/$defs/referencedItem',\n },\n order: {\n description:\n 'Relative order of this group compared to other groups in the same column or submenu (sorted ascending)',\n type: 'number',\n },\n isExtensible: {\n description:\n 'Defines whether contributions are allowed to add menu items to this menu group',\n type: 'boolean',\n },\n },\n required: ['menuItem', 'order'],\n additionalProperties: false,\n },\n ],\n },\n },\n additionalProperties: false,\n },\n menuItem: {\n description:\n 'Single item in a menu that can be clicked on to take an action or can be the parent of a submenu',\n type: 'object',\n oneOf: [\n {\n properties: {\n id: {\n description: 'ID for this menu item that holds a submenu',\n $ref: '#/$defs/referencedItem',\n },\n },\n required: ['id'],\n },\n {\n properties: {\n command: {\n description: 'Name of the PAPI command to run when this menu item is selected.',\n $ref: '#/$defs/referencedItem',\n },\n iconPathBefore: {\n description:\n 'Uri path to the icon to display before the menu text. Ex: `papi-extension://helloWorld/assets/icon.png`',\n type: 'string',\n },\n iconPathAfter: {\n description:\n 'Uri path to the icon to display after the menu text. Ex: `papi-extension://helloWorld/assets/icon.png`',\n type: 'string',\n },\n },\n required: ['command'],\n },\n ],\n properties: {\n label: {\n description: 'Key that represents the text of this menu item to display',\n $ref: '#/$defs/localizeKey',\n },\n tooltip: {\n description:\n 'Key that represents the text to display if a mouse pointer hovers over the menu item',\n $ref: '#/$defs/localizeKey',\n },\n searchTerms: {\n description:\n 'Key that represents additional words the platform should reference when users are searching for menu items',\n $ref: '#/$defs/localizeKey',\n },\n localizeNotes: {\n description:\n 'Additional information provided by developers to help people who perform localization',\n type: 'string',\n },\n group: {\n description: 'Group to which this menu item belongs',\n $ref: '#/$defs/referencedItem',\n },\n order: {\n description:\n 'Relative order of this menu item compared to other menu items in the same group (sorted ascending)',\n type: 'number',\n },\n },\n required: ['label', 'group', 'order'],\n unevaluatedProperties: false,\n },\n groupsAndItems: {\n description: 'Core schema for a column',\n type: 'object',\n properties: {\n groups: {\n description: 'Groups that belong in this menu',\n $ref: '#/$defs/menuGroups',\n },\n items: {\n description: 'List of menu items that belong in this menu',\n type: 'array',\n items: { $ref: '#/$defs/menuItem' },\n uniqueItems: true,\n },\n },\n required: ['groups', 'items'],\n },\n singleColumnMenu: {\n description: 'Menu that contains a column without a header',\n type: 'object',\n allOf: [{ $ref: '#/$defs/groupsAndItems' }],\n unevaluatedProperties: false,\n },\n multiColumnMenu: {\n description: 'Menu that can contain multiple columns with headers',\n type: 'object',\n allOf: [\n { $ref: '#/$defs/groupsAndItems' },\n {\n properties: {\n columns: {\n description: 'Columns that belong in this menu',\n $ref: '#/$defs/columnsWithHeaders',\n },\n },\n required: ['columns'],\n },\n ],\n unevaluatedProperties: false,\n },\n menusForOneWebView: {\n description: 'Set of menus that are associated with a single tab',\n type: 'object',\n properties: {\n includeDefaults: {\n description:\n 'Indicates whether the platform default menus should be included for this webview',\n type: 'boolean',\n },\n topMenu: {\n description: 'Menu that opens when you click on the top left corner of a tab',\n $ref: '#/$defs/multiColumnMenu',\n },\n contextMenu: {\n description: 'Menu that opens when you right click on the main body/area of a tab',\n $ref: '#/$defs/singleColumnMenu',\n },\n },\n additionalProperties: false,\n },\n },\n};\n\nObject.freeze(menuDocumentSchema);\n","'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\");\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 index >= 0 && index < this.length ? 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.nodeName = 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',\n\tlt: '<',\n\tquot: '\"',\n});\n\n/**\n * A map of all 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://html.spec.whatwg.org/entities.json JSON\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\tAacute: '\\u00C1',\n\taacute: '\\u00E1',\n\tAbreve: '\\u0102',\n\tabreve: '\\u0103',\n\tac: '\\u223E',\n\tacd: '\\u223F',\n\tacE: '\\u223E\\u0333',\n\tAcirc: '\\u00C2',\n\tacirc: '\\u00E2',\n\tacute: '\\u00B4',\n\tAcy: '\\u0410',\n\tacy: '\\u0430',\n\tAElig: '\\u00C6',\n\taelig: '\\u00E6',\n\taf: '\\u2061',\n\tAfr: '\\uD835\\uDD04',\n\tafr: '\\uD835\\uDD1E',\n\tAgrave: '\\u00C0',\n\tagrave: '\\u00E0',\n\talefsym: '\\u2135',\n\taleph: '\\u2135',\n\tAlpha: '\\u0391',\n\talpha: '\\u03B1',\n\tAmacr: '\\u0100',\n\tamacr: '\\u0101',\n\tamalg: '\\u2A3F',\n\tAMP: '\\u0026',\n\tamp: '\\u0026',\n\tAnd: '\\u2A53',\n\tand: '\\u2227',\n\tandand: '\\u2A55',\n\tandd: '\\u2A5C',\n\tandslope: '\\u2A58',\n\tandv: '\\u2A5A',\n\tang: '\\u2220',\n\tange: '\\u29A4',\n\tangle: '\\u2220',\n\tangmsd: '\\u2221',\n\tangmsdaa: '\\u29A8',\n\tangmsdab: '\\u29A9',\n\tangmsdac: '\\u29AA',\n\tangmsdad: '\\u29AB',\n\tangmsdae: '\\u29AC',\n\tangmsdaf: '\\u29AD',\n\tangmsdag: '\\u29AE',\n\tangmsdah: '\\u29AF',\n\tangrt: '\\u221F',\n\tangrtvb: '\\u22BE',\n\tangrtvbd: '\\u299D',\n\tangsph: '\\u2222',\n\tangst: '\\u00C5',\n\tangzarr: '\\u237C',\n\tAogon: '\\u0104',\n\taogon: '\\u0105',\n\tAopf: '\\uD835\\uDD38',\n\taopf: '\\uD835\\uDD52',\n\tap: '\\u2248',\n\tapacir: '\\u2A6F',\n\tapE: '\\u2A70',\n\tape: '\\u224A',\n\tapid: '\\u224B',\n\tapos: '\\u0027',\n\tApplyFunction: '\\u2061',\n\tapprox: '\\u2248',\n\tapproxeq: '\\u224A',\n\tAring: '\\u00C5',\n\taring: '\\u00E5',\n\tAscr: '\\uD835\\uDC9C',\n\tascr: '\\uD835\\uDCB6',\n\tAssign: '\\u2254',\n\tast: '\\u002A',\n\tasymp: '\\u2248',\n\tasympeq: '\\u224D',\n\tAtilde: '\\u00C3',\n\tatilde: '\\u00E3',\n\tAuml: '\\u00C4',\n\tauml: '\\u00E4',\n\tawconint: '\\u2233',\n\tawint: '\\u2A11',\n\tbackcong: '\\u224C',\n\tbackepsilon: '\\u03F6',\n\tbackprime: '\\u2035',\n\tbacksim: '\\u223D',\n\tbacksimeq: '\\u22CD',\n\tBackslash: '\\u2216',\n\tBarv: '\\u2AE7',\n\tbarvee: '\\u22BD',\n\tBarwed: '\\u2306',\n\tbarwed: '\\u2305',\n\tbarwedge: '\\u2305',\n\tbbrk: '\\u23B5',\n\tbbrktbrk: '\\u23B6',\n\tbcong: '\\u224C',\n\tBcy: '\\u0411',\n\tbcy: '\\u0431',\n\tbdquo: '\\u201E',\n\tbecaus: '\\u2235',\n\tBecause: '\\u2235',\n\tbecause: '\\u2235',\n\tbemptyv: '\\u29B0',\n\tbepsi: '\\u03F6',\n\tbernou: '\\u212C',\n\tBernoullis: '\\u212C',\n\tBeta: '\\u0392',\n\tbeta: '\\u03B2',\n\tbeth: '\\u2136',\n\tbetween: '\\u226C',\n\tBfr: '\\uD835\\uDD05',\n\tbfr: '\\uD835\\uDD1F',\n\tbigcap: '\\u22C2',\n\tbigcirc: '\\u25EF',\n\tbigcup: '\\u22C3',\n\tbigodot: '\\u2A00',\n\tbigoplus: '\\u2A01',\n\tbigotimes: '\\u2A02',\n\tbigsqcup: '\\u2A06',\n\tbigstar: '\\u2605',\n\tbigtriangledown: '\\u25BD',\n\tbigtriangleup: '\\u25B3',\n\tbiguplus: '\\u2A04',\n\tbigvee: '\\u22C1',\n\tbigwedge: '\\u22C0',\n\tbkarow: '\\u290D',\n\tblacklozenge: '\\u29EB',\n\tblacksquare: '\\u25AA',\n\tblacktriangle: '\\u25B4',\n\tblacktriangledown: '\\u25BE',\n\tblacktriangleleft: '\\u25C2',\n\tblacktriangleright: '\\u25B8',\n\tblank: '\\u2423',\n\tblk12: '\\u2592',\n\tblk14: '\\u2591',\n\tblk34: '\\u2593',\n\tblock: '\\u2588',\n\tbne: '\\u003D\\u20E5',\n\tbnequiv: '\\u2261\\u20E5',\n\tbNot: '\\u2AED',\n\tbnot: '\\u2310',\n\tBopf: '\\uD835\\uDD39',\n\tbopf: '\\uD835\\uDD53',\n\tbot: '\\u22A5',\n\tbottom: '\\u22A5',\n\tbowtie: '\\u22C8',\n\tboxbox: '\\u29C9',\n\tboxDL: '\\u2557',\n\tboxDl: '\\u2556',\n\tboxdL: '\\u2555',\n\tboxdl: '\\u2510',\n\tboxDR: '\\u2554',\n\tboxDr: '\\u2553',\n\tboxdR: '\\u2552',\n\tboxdr: '\\u250C',\n\tboxH: '\\u2550',\n\tboxh: '\\u2500',\n\tboxHD: '\\u2566',\n\tboxHd: '\\u2564',\n\tboxhD: '\\u2565',\n\tboxhd: '\\u252C',\n\tboxHU: '\\u2569',\n\tboxHu: '\\u2567',\n\tboxhU: '\\u2568',\n\tboxhu: '\\u2534',\n\tboxminus: '\\u229F',\n\tboxplus: '\\u229E',\n\tboxtimes: '\\u22A0',\n\tboxUL: '\\u255D',\n\tboxUl: '\\u255C',\n\tboxuL: '\\u255B',\n\tboxul: '\\u2518',\n\tboxUR: '\\u255A',\n\tboxUr: '\\u2559',\n\tboxuR: '\\u2558',\n\tboxur: '\\u2514',\n\tboxV: '\\u2551',\n\tboxv: '\\u2502',\n\tboxVH: '\\u256C',\n\tboxVh: '\\u256B',\n\tboxvH: '\\u256A',\n\tboxvh: '\\u253C',\n\tboxVL: '\\u2563',\n\tboxVl: '\\u2562',\n\tboxvL: '\\u2561',\n\tboxvl: '\\u2524',\n\tboxVR: '\\u2560',\n\tboxVr: '\\u255F',\n\tboxvR: '\\u255E',\n\tboxvr: '\\u251C',\n\tbprime: '\\u2035',\n\tBreve: '\\u02D8',\n\tbreve: '\\u02D8',\n\tbrvbar: '\\u00A6',\n\tBscr: '\\u212C',\n\tbscr: '\\uD835\\uDCB7',\n\tbsemi: '\\u204F',\n\tbsim: '\\u223D',\n\tbsime: '\\u22CD',\n\tbsol: '\\u005C',\n\tbsolb: '\\u29C5',\n\tbsolhsub: '\\u27C8',\n\tbull: '\\u2022',\n\tbullet: '\\u2022',\n\tbump: '\\u224E',\n\tbumpE: '\\u2AAE',\n\tbumpe: '\\u224F',\n\tBumpeq: '\\u224E',\n\tbumpeq: '\\u224F',\n\tCacute: '\\u0106',\n\tcacute: '\\u0107',\n\tCap: '\\u22D2',\n\tcap: '\\u2229',\n\tcapand: '\\u2A44',\n\tcapbrcup: '\\u2A49',\n\tcapcap: '\\u2A4B',\n\tcapcup: '\\u2A47',\n\tcapdot: '\\u2A40',\n\tCapitalDifferentialD: '\\u2145',\n\tcaps: '\\u2229\\uFE00',\n\tcaret: '\\u2041',\n\tcaron: '\\u02C7',\n\tCayleys: '\\u212D',\n\tccaps: '\\u2A4D',\n\tCcaron: '\\u010C',\n\tccaron: '\\u010D',\n\tCcedil: '\\u00C7',\n\tccedil: '\\u00E7',\n\tCcirc: '\\u0108',\n\tccirc: '\\u0109',\n\tCconint: '\\u2230',\n\tccups: '\\u2A4C',\n\tccupssm: '\\u2A50',\n\tCdot: '\\u010A',\n\tcdot: '\\u010B',\n\tcedil: '\\u00B8',\n\tCedilla: '\\u00B8',\n\tcemptyv: '\\u29B2',\n\tcent: '\\u00A2',\n\tCenterDot: '\\u00B7',\n\tcenterdot: '\\u00B7',\n\tCfr: '\\u212D',\n\tcfr: '\\uD835\\uDD20',\n\tCHcy: '\\u0427',\n\tchcy: '\\u0447',\n\tcheck: '\\u2713',\n\tcheckmark: '\\u2713',\n\tChi: '\\u03A7',\n\tchi: '\\u03C7',\n\tcir: '\\u25CB',\n\tcirc: '\\u02C6',\n\tcirceq: '\\u2257',\n\tcirclearrowleft: '\\u21BA',\n\tcirclearrowright: '\\u21BB',\n\tcircledast: '\\u229B',\n\tcircledcirc: '\\u229A',\n\tcircleddash: '\\u229D',\n\tCircleDot: '\\u2299',\n\tcircledR: '\\u00AE',\n\tcircledS: '\\u24C8',\n\tCircleMinus: '\\u2296',\n\tCirclePlus: '\\u2295',\n\tCircleTimes: '\\u2297',\n\tcirE: '\\u29C3',\n\tcire: '\\u2257',\n\tcirfnint: '\\u2A10',\n\tcirmid: '\\u2AEF',\n\tcirscir: '\\u29C2',\n\tClockwiseContourIntegral: '\\u2232',\n\tCloseCurlyDoubleQuote: '\\u201D',\n\tCloseCurlyQuote: '\\u2019',\n\tclubs: '\\u2663',\n\tclubsuit: '\\u2663',\n\tColon: '\\u2237',\n\tcolon: '\\u003A',\n\tColone: '\\u2A74',\n\tcolone: '\\u2254',\n\tcoloneq: '\\u2254',\n\tcomma: '\\u002C',\n\tcommat: '\\u0040',\n\tcomp: '\\u2201',\n\tcompfn: '\\u2218',\n\tcomplement: '\\u2201',\n\tcomplexes: '\\u2102',\n\tcong: '\\u2245',\n\tcongdot: '\\u2A6D',\n\tCongruent: '\\u2261',\n\tConint: '\\u222F',\n\tconint: '\\u222E',\n\tContourIntegral: '\\u222E',\n\tCopf: '\\u2102',\n\tcopf: '\\uD835\\uDD54',\n\tcoprod: '\\u2210',\n\tCoproduct: '\\u2210',\n\tCOPY: '\\u00A9',\n\tcopy: '\\u00A9',\n\tcopysr: '\\u2117',\n\tCounterClockwiseContourIntegral: '\\u2233',\n\tcrarr: '\\u21B5',\n\tCross: '\\u2A2F',\n\tcross: '\\u2717',\n\tCscr: '\\uD835\\uDC9E',\n\tcscr: '\\uD835\\uDCB8',\n\tcsub: '\\u2ACF',\n\tcsube: '\\u2AD1',\n\tcsup: '\\u2AD0',\n\tcsupe: '\\u2AD2',\n\tctdot: '\\u22EF',\n\tcudarrl: '\\u2938',\n\tcudarrr: '\\u2935',\n\tcuepr: '\\u22DE',\n\tcuesc: '\\u22DF',\n\tcularr: '\\u21B6',\n\tcularrp: '\\u293D',\n\tCup: '\\u22D3',\n\tcup: '\\u222A',\n\tcupbrcap: '\\u2A48',\n\tCupCap: '\\u224D',\n\tcupcap: '\\u2A46',\n\tcupcup: '\\u2A4A',\n\tcupdot: '\\u228D',\n\tcupor: '\\u2A45',\n\tcups: '\\u222A\\uFE00',\n\tcurarr: '\\u21B7',\n\tcurarrm: '\\u293C',\n\tcurlyeqprec: '\\u22DE',\n\tcurlyeqsucc: '\\u22DF',\n\tcurlyvee: '\\u22CE',\n\tcurlywedge: '\\u22CF',\n\tcurren: '\\u00A4',\n\tcurvearrowleft: '\\u21B6',\n\tcurvearrowright: '\\u21B7',\n\tcuvee: '\\u22CE',\n\tcuwed: '\\u22CF',\n\tcwconint: '\\u2232',\n\tcwint: '\\u2231',\n\tcylcty: '\\u232D',\n\tDagger: '\\u2021',\n\tdagger: '\\u2020',\n\tdaleth: '\\u2138',\n\tDarr: '\\u21A1',\n\tdArr: '\\u21D3',\n\tdarr: '\\u2193',\n\tdash: '\\u2010',\n\tDashv: '\\u2AE4',\n\tdashv: '\\u22A3',\n\tdbkarow: '\\u290F',\n\tdblac: '\\u02DD',\n\tDcaron: '\\u010E',\n\tdcaron: '\\u010F',\n\tDcy: '\\u0414',\n\tdcy: '\\u0434',\n\tDD: '\\u2145',\n\tdd: '\\u2146',\n\tddagger: '\\u2021',\n\tddarr: '\\u21CA',\n\tDDotrahd: '\\u2911',\n\tddotseq: '\\u2A77',\n\tdeg: '\\u00B0',\n\tDel: '\\u2207',\n\tDelta: '\\u0394',\n\tdelta: '\\u03B4',\n\tdemptyv: '\\u29B1',\n\tdfisht: '\\u297F',\n\tDfr: '\\uD835\\uDD07',\n\tdfr: '\\uD835\\uDD21',\n\tdHar: '\\u2965',\n\tdharl: '\\u21C3',\n\tdharr: '\\u21C2',\n\tDiacriticalAcute: '\\u00B4',\n\tDiacriticalDot: '\\u02D9',\n\tDiacriticalDoubleAcute: '\\u02DD',\n\tDiacriticalGrave: '\\u0060',\n\tDiacriticalTilde: '\\u02DC',\n\tdiam: '\\u22C4',\n\tDiamond: '\\u22C4',\n\tdiamond: '\\u22C4',\n\tdiamondsuit: '\\u2666',\n\tdiams: '\\u2666',\n\tdie: '\\u00A8',\n\tDifferentialD: '\\u2146',\n\tdigamma: '\\u03DD',\n\tdisin: '\\u22F2',\n\tdiv: '\\u00F7',\n\tdivide: '\\u00F7',\n\tdivideontimes: '\\u22C7',\n\tdivonx: '\\u22C7',\n\tDJcy: '\\u0402',\n\tdjcy: '\\u0452',\n\tdlcorn: '\\u231E',\n\tdlcrop: '\\u230D',\n\tdollar: '\\u0024',\n\tDopf: '\\uD835\\uDD3B',\n\tdopf: '\\uD835\\uDD55',\n\tDot: '\\u00A8',\n\tdot: '\\u02D9',\n\tDotDot: '\\u20DC',\n\tdoteq: '\\u2250',\n\tdoteqdot: '\\u2251',\n\tDotEqual: '\\u2250',\n\tdotminus: '\\u2238',\n\tdotplus: '\\u2214',\n\tdotsquare: '\\u22A1',\n\tdoublebarwedge: '\\u2306',\n\tDoubleContourIntegral: '\\u222F',\n\tDoubleDot: '\\u00A8',\n\tDoubleDownArrow: '\\u21D3',\n\tDoubleLeftArrow: '\\u21D0',\n\tDoubleLeftRightArrow: '\\u21D4',\n\tDoubleLeftTee: '\\u2AE4',\n\tDoubleLongLeftArrow: '\\u27F8',\n\tDoubleLongLeftRightArrow: '\\u27FA',\n\tDoubleLongRightArrow: '\\u27F9',\n\tDoubleRightArrow: '\\u21D2',\n\tDoubleRightTee: '\\u22A8',\n\tDoubleUpArrow: '\\u21D1',\n\tDoubleUpDownArrow: '\\u21D5',\n\tDoubleVerticalBar: '\\u2225',\n\tDownArrow: '\\u2193',\n\tDownarrow: '\\u21D3',\n\tdownarrow: '\\u2193',\n\tDownArrowBar: '\\u2913',\n\tDownArrowUpArrow: '\\u21F5',\n\tDownBreve: '\\u0311',\n\tdowndownarrows: '\\u21CA',\n\tdownharpoonleft: '\\u21C3',\n\tdownharpoonright: '\\u21C2',\n\tDownLeftRightVector: '\\u2950',\n\tDownLeftTeeVector: '\\u295E',\n\tDownLeftVector: '\\u21BD',\n\tDownLeftVectorBar: '\\u2956',\n\tDownRightTeeVector: '\\u295F',\n\tDownRightVector: '\\u21C1',\n\tDownRightVectorBar: '\\u2957',\n\tDownTee: '\\u22A4',\n\tDownTeeArrow: '\\u21A7',\n\tdrbkarow: '\\u2910',\n\tdrcorn: '\\u231F',\n\tdrcrop: '\\u230C',\n\tDscr: '\\uD835\\uDC9F',\n\tdscr: '\\uD835\\uDCB9',\n\tDScy: '\\u0405',\n\tdscy: '\\u0455',\n\tdsol: '\\u29F6',\n\tDstrok: '\\u0110',\n\tdstrok: '\\u0111',\n\tdtdot: '\\u22F1',\n\tdtri: '\\u25BF',\n\tdtrif: '\\u25BE',\n\tduarr: '\\u21F5',\n\tduhar: '\\u296F',\n\tdwangle: '\\u29A6',\n\tDZcy: '\\u040F',\n\tdzcy: '\\u045F',\n\tdzigrarr: '\\u27FF',\n\tEacute: '\\u00C9',\n\teacute: '\\u00E9',\n\teaster: '\\u2A6E',\n\tEcaron: '\\u011A',\n\tecaron: '\\u011B',\n\tecir: '\\u2256',\n\tEcirc: '\\u00CA',\n\tecirc: '\\u00EA',\n\tecolon: '\\u2255',\n\tEcy: '\\u042D',\n\tecy: '\\u044D',\n\teDDot: '\\u2A77',\n\tEdot: '\\u0116',\n\teDot: '\\u2251',\n\tedot: '\\u0117',\n\tee: '\\u2147',\n\tefDot: '\\u2252',\n\tEfr: '\\uD835\\uDD08',\n\tefr: '\\uD835\\uDD22',\n\teg: '\\u2A9A',\n\tEgrave: '\\u00C8',\n\tegrave: '\\u00E8',\n\tegs: '\\u2A96',\n\tegsdot: '\\u2A98',\n\tel: '\\u2A99',\n\tElement: '\\u2208',\n\telinters: '\\u23E7',\n\tell: '\\u2113',\n\tels: '\\u2A95',\n\telsdot: '\\u2A97',\n\tEmacr: '\\u0112',\n\temacr: '\\u0113',\n\tempty: '\\u2205',\n\temptyset: '\\u2205',\n\tEmptySmallSquare: '\\u25FB',\n\temptyv: '\\u2205',\n\tEmptyVerySmallSquare: '\\u25AB',\n\temsp: '\\u2003',\n\temsp13: '\\u2004',\n\temsp14: '\\u2005',\n\tENG: '\\u014A',\n\teng: '\\u014B',\n\tensp: '\\u2002',\n\tEogon: '\\u0118',\n\teogon: '\\u0119',\n\tEopf: '\\uD835\\uDD3C',\n\teopf: '\\uD835\\uDD56',\n\tepar: '\\u22D5',\n\teparsl: '\\u29E3',\n\teplus: '\\u2A71',\n\tepsi: '\\u03B5',\n\tEpsilon: '\\u0395',\n\tepsilon: '\\u03B5',\n\tepsiv: '\\u03F5',\n\teqcirc: '\\u2256',\n\teqcolon: '\\u2255',\n\teqsim: '\\u2242',\n\teqslantgtr: '\\u2A96',\n\teqslantless: '\\u2A95',\n\tEqual: '\\u2A75',\n\tequals: '\\u003D',\n\tEqualTilde: '\\u2242',\n\tequest: '\\u225F',\n\tEquilibrium: '\\u21CC',\n\tequiv: '\\u2261',\n\tequivDD: '\\u2A78',\n\teqvparsl: '\\u29E5',\n\terarr: '\\u2971',\n\terDot: '\\u2253',\n\tEscr: '\\u2130',\n\tescr: '\\u212F',\n\tesdot: '\\u2250',\n\tEsim: '\\u2A73',\n\tesim: '\\u2242',\n\tEta: '\\u0397',\n\teta: '\\u03B7',\n\tETH: '\\u00D0',\n\teth: '\\u00F0',\n\tEuml: '\\u00CB',\n\teuml: '\\u00EB',\n\teuro: '\\u20AC',\n\texcl: '\\u0021',\n\texist: '\\u2203',\n\tExists: '\\u2203',\n\texpectation: '\\u2130',\n\tExponentialE: '\\u2147',\n\texponentiale: '\\u2147',\n\tfallingdotseq: '\\u2252',\n\tFcy: '\\u0424',\n\tfcy: '\\u0444',\n\tfemale: '\\u2640',\n\tffilig: '\\uFB03',\n\tfflig: '\\uFB00',\n\tffllig: '\\uFB04',\n\tFfr: '\\uD835\\uDD09',\n\tffr: '\\uD835\\uDD23',\n\tfilig: '\\uFB01',\n\tFilledSmallSquare: '\\u25FC',\n\tFilledVerySmallSquare: '\\u25AA',\n\tfjlig: '\\u0066\\u006A',\n\tflat: '\\u266D',\n\tfllig: '\\uFB02',\n\tfltns: '\\u25B1',\n\tfnof: '\\u0192',\n\tFopf: '\\uD835\\uDD3D',\n\tfopf: '\\uD835\\uDD57',\n\tForAll: '\\u2200',\n\tforall: '\\u2200',\n\tfork: '\\u22D4',\n\tforkv: '\\u2AD9',\n\tFouriertrf: '\\u2131',\n\tfpartint: '\\u2A0D',\n\tfrac12: '\\u00BD',\n\tfrac13: '\\u2153',\n\tfrac14: '\\u00BC',\n\tfrac15: '\\u2155',\n\tfrac16: '\\u2159',\n\tfrac18: '\\u215B',\n\tfrac23: '\\u2154',\n\tfrac25: '\\u2156',\n\tfrac34: '\\u00BE',\n\tfrac35: '\\u2157',\n\tfrac38: '\\u215C',\n\tfrac45: '\\u2158',\n\tfrac56: '\\u215A',\n\tfrac58: '\\u215D',\n\tfrac78: '\\u215E',\n\tfrasl: '\\u2044',\n\tfrown: '\\u2322',\n\tFscr: '\\u2131',\n\tfscr: '\\uD835\\uDCBB',\n\tgacute: '\\u01F5',\n\tGamma: '\\u0393',\n\tgamma: '\\u03B3',\n\tGammad: '\\u03DC',\n\tgammad: '\\u03DD',\n\tgap: '\\u2A86',\n\tGbreve: '\\u011E',\n\tgbreve: '\\u011F',\n\tGcedil: '\\u0122',\n\tGcirc: '\\u011C',\n\tgcirc: '\\u011D',\n\tGcy: '\\u0413',\n\tgcy: '\\u0433',\n\tGdot: '\\u0120',\n\tgdot: '\\u0121',\n\tgE: '\\u2267',\n\tge: '\\u2265',\n\tgEl: '\\u2A8C',\n\tgel: '\\u22DB',\n\tgeq: '\\u2265',\n\tgeqq: '\\u2267',\n\tgeqslant: '\\u2A7E',\n\tges: '\\u2A7E',\n\tgescc: '\\u2AA9',\n\tgesdot: '\\u2A80',\n\tgesdoto: '\\u2A82',\n\tgesdotol: '\\u2A84',\n\tgesl: '\\u22DB\\uFE00',\n\tgesles: '\\u2A94',\n\tGfr: '\\uD835\\uDD0A',\n\tgfr: '\\uD835\\uDD24',\n\tGg: '\\u22D9',\n\tgg: '\\u226B',\n\tggg: '\\u22D9',\n\tgimel: '\\u2137',\n\tGJcy: '\\u0403',\n\tgjcy: '\\u0453',\n\tgl: '\\u2277',\n\tgla: '\\u2AA5',\n\tglE: '\\u2A92',\n\tglj: '\\u2AA4',\n\tgnap: '\\u2A8A',\n\tgnapprox: '\\u2A8A',\n\tgnE: '\\u2269',\n\tgne: '\\u2A88',\n\tgneq: '\\u2A88',\n\tgneqq: '\\u2269',\n\tgnsim: '\\u22E7',\n\tGopf: '\\uD835\\uDD3E',\n\tgopf: '\\uD835\\uDD58',\n\tgrave: '\\u0060',\n\tGreaterEqual: '\\u2265',\n\tGreaterEqualLess: '\\u22DB',\n\tGreaterFullEqual: '\\u2267',\n\tGreaterGreater: '\\u2AA2',\n\tGreaterLess: '\\u2277',\n\tGreaterSlantEqual: '\\u2A7E',\n\tGreaterTilde: '\\u2273',\n\tGscr: '\\uD835\\uDCA2',\n\tgscr: '\\u210A',\n\tgsim: '\\u2273',\n\tgsime: '\\u2A8E',\n\tgsiml: '\\u2A90',\n\tGt: '\\u226B',\n\tGT: '\\u003E',\n\tgt: '\\u003E',\n\tgtcc: '\\u2AA7',\n\tgtcir: '\\u2A7A',\n\tgtdot: '\\u22D7',\n\tgtlPar: '\\u2995',\n\tgtquest: '\\u2A7C',\n\tgtrapprox: '\\u2A86',\n\tgtrarr: '\\u2978',\n\tgtrdot: '\\u22D7',\n\tgtreqless: '\\u22DB',\n\tgtreqqless: '\\u2A8C',\n\tgtrless: '\\u2277',\n\tgtrsim: '\\u2273',\n\tgvertneqq: '\\u2269\\uFE00',\n\tgvnE: '\\u2269\\uFE00',\n\tHacek: '\\u02C7',\n\thairsp: '\\u200A',\n\thalf: '\\u00BD',\n\thamilt: '\\u210B',\n\tHARDcy: '\\u042A',\n\thardcy: '\\u044A',\n\thArr: '\\u21D4',\n\tharr: '\\u2194',\n\tharrcir: '\\u2948',\n\tharrw: '\\u21AD',\n\tHat: '\\u005E',\n\thbar: '\\u210F',\n\tHcirc: '\\u0124',\n\thcirc: '\\u0125',\n\thearts: '\\u2665',\n\theartsuit: '\\u2665',\n\thellip: '\\u2026',\n\thercon: '\\u22B9',\n\tHfr: '\\u210C',\n\thfr: '\\uD835\\uDD25',\n\tHilbertSpace: '\\u210B',\n\thksearow: '\\u2925',\n\thkswarow: '\\u2926',\n\thoarr: '\\u21FF',\n\thomtht: '\\u223B',\n\thookleftarrow: '\\u21A9',\n\thookrightarrow: '\\u21AA',\n\tHopf: '\\u210D',\n\thopf: '\\uD835\\uDD59',\n\thorbar: '\\u2015',\n\tHorizontalLine: '\\u2500',\n\tHscr: '\\u210B',\n\thscr: '\\uD835\\uDCBD',\n\thslash: '\\u210F',\n\tHstrok: '\\u0126',\n\thstrok: '\\u0127',\n\tHumpDownHump: '\\u224E',\n\tHumpEqual: '\\u224F',\n\thybull: '\\u2043',\n\thyphen: '\\u2010',\n\tIacute: '\\u00CD',\n\tiacute: '\\u00ED',\n\tic: '\\u2063',\n\tIcirc: '\\u00CE',\n\ticirc: '\\u00EE',\n\tIcy: '\\u0418',\n\ticy: '\\u0438',\n\tIdot: '\\u0130',\n\tIEcy: '\\u0415',\n\tiecy: '\\u0435',\n\tiexcl: '\\u00A1',\n\tiff: '\\u21D4',\n\tIfr: '\\u2111',\n\tifr: '\\uD835\\uDD26',\n\tIgrave: '\\u00CC',\n\tigrave: '\\u00EC',\n\tii: '\\u2148',\n\tiiiint: '\\u2A0C',\n\tiiint: '\\u222D',\n\tiinfin: '\\u29DC',\n\tiiota: '\\u2129',\n\tIJlig: '\\u0132',\n\tijlig: '\\u0133',\n\tIm: '\\u2111',\n\tImacr: '\\u012A',\n\timacr: '\\u012B',\n\timage: '\\u2111',\n\tImaginaryI: '\\u2148',\n\timagline: '\\u2110',\n\timagpart: '\\u2111',\n\timath: '\\u0131',\n\timof: '\\u22B7',\n\timped: '\\u01B5',\n\tImplies: '\\u21D2',\n\tin: '\\u2208',\n\tincare: '\\u2105',\n\tinfin: '\\u221E',\n\tinfintie: '\\u29DD',\n\tinodot: '\\u0131',\n\tInt: '\\u222C',\n\tint: '\\u222B',\n\tintcal: '\\u22BA',\n\tintegers: '\\u2124',\n\tIntegral: '\\u222B',\n\tintercal: '\\u22BA',\n\tIntersection: '\\u22C2',\n\tintlarhk: '\\u2A17',\n\tintprod: '\\u2A3C',\n\tInvisibleComma: '\\u2063',\n\tInvisibleTimes: '\\u2062',\n\tIOcy: '\\u0401',\n\tiocy: '\\u0451',\n\tIogon: '\\u012E',\n\tiogon: '\\u012F',\n\tIopf: '\\uD835\\uDD40',\n\tiopf: '\\uD835\\uDD5A',\n\tIota: '\\u0399',\n\tiota: '\\u03B9',\n\tiprod: '\\u2A3C',\n\tiquest: '\\u00BF',\n\tIscr: '\\u2110',\n\tiscr: '\\uD835\\uDCBE',\n\tisin: '\\u2208',\n\tisindot: '\\u22F5',\n\tisinE: '\\u22F9',\n\tisins: '\\u22F4',\n\tisinsv: '\\u22F3',\n\tisinv: '\\u2208',\n\tit: '\\u2062',\n\tItilde: '\\u0128',\n\titilde: '\\u0129',\n\tIukcy: '\\u0406',\n\tiukcy: '\\u0456',\n\tIuml: '\\u00CF',\n\tiuml: '\\u00EF',\n\tJcirc: '\\u0134',\n\tjcirc: '\\u0135',\n\tJcy: '\\u0419',\n\tjcy: '\\u0439',\n\tJfr: '\\uD835\\uDD0D',\n\tjfr: '\\uD835\\uDD27',\n\tjmath: '\\u0237',\n\tJopf: '\\uD835\\uDD41',\n\tjopf: '\\uD835\\uDD5B',\n\tJscr: '\\uD835\\uDCA5',\n\tjscr: '\\uD835\\uDCBF',\n\tJsercy: '\\u0408',\n\tjsercy: '\\u0458',\n\tJukcy: '\\u0404',\n\tjukcy: '\\u0454',\n\tKappa: '\\u039A',\n\tkappa: '\\u03BA',\n\tkappav: '\\u03F0',\n\tKcedil: '\\u0136',\n\tkcedil: '\\u0137',\n\tKcy: '\\u041A',\n\tkcy: '\\u043A',\n\tKfr: '\\uD835\\uDD0E',\n\tkfr: '\\uD835\\uDD28',\n\tkgreen: '\\u0138',\n\tKHcy: '\\u0425',\n\tkhcy: '\\u0445',\n\tKJcy: '\\u040C',\n\tkjcy: '\\u045C',\n\tKopf: '\\uD835\\uDD42',\n\tkopf: '\\uD835\\uDD5C',\n\tKscr: '\\uD835\\uDCA6',\n\tkscr: '\\uD835\\uDCC0',\n\tlAarr: '\\u21DA',\n\tLacute: '\\u0139',\n\tlacute: '\\u013A',\n\tlaemptyv: '\\u29B4',\n\tlagran: '\\u2112',\n\tLambda: '\\u039B',\n\tlambda: '\\u03BB',\n\tLang: '\\u27EA',\n\tlang: '\\u27E8',\n\tlangd: '\\u2991',\n\tlangle: '\\u27E8',\n\tlap: '\\u2A85',\n\tLaplacetrf: '\\u2112',\n\tlaquo: '\\u00AB',\n\tLarr: '\\u219E',\n\tlArr: '\\u21D0',\n\tlarr: '\\u2190',\n\tlarrb: '\\u21E4',\n\tlarrbfs: '\\u291F',\n\tlarrfs: '\\u291D',\n\tlarrhk: '\\u21A9',\n\tlarrlp: '\\u21AB',\n\tlarrpl: '\\u2939',\n\tlarrsim: '\\u2973',\n\tlarrtl: '\\u21A2',\n\tlat: '\\u2AAB',\n\tlAtail: '\\u291B',\n\tlatail: '\\u2919',\n\tlate: '\\u2AAD',\n\tlates: '\\u2AAD\\uFE00',\n\tlBarr: '\\u290E',\n\tlbarr: '\\u290C',\n\tlbbrk: '\\u2772',\n\tlbrace: '\\u007B',\n\tlbrack: '\\u005B',\n\tlbrke: '\\u298B',\n\tlbrksld: '\\u298F',\n\tlbrkslu: '\\u298D',\n\tLcaron: '\\u013D',\n\tlcaron: '\\u013E',\n\tLcedil: '\\u013B',\n\tlcedil: '\\u013C',\n\tlceil: '\\u2308',\n\tlcub: '\\u007B',\n\tLcy: '\\u041B',\n\tlcy: '\\u043B',\n\tldca: '\\u2936',\n\tldquo: '\\u201C',\n\tldquor: '\\u201E',\n\tldrdhar: '\\u2967',\n\tldrushar: '\\u294B',\n\tldsh: '\\u21B2',\n\tlE: '\\u2266',\n\tle: '\\u2264',\n\tLeftAngleBracket: '\\u27E8',\n\tLeftArrow: '\\u2190',\n\tLeftarrow: '\\u21D0',\n\tleftarrow: '\\u2190',\n\tLeftArrowBar: '\\u21E4',\n\tLeftArrowRightArrow: '\\u21C6',\n\tleftarrowtail: '\\u21A2',\n\tLeftCeiling: '\\u2308',\n\tLeftDoubleBracket: '\\u27E6',\n\tLeftDownTeeVector: '\\u2961',\n\tLeftDownVector: '\\u21C3',\n\tLeftDownVectorBar: '\\u2959',\n\tLeftFloor: '\\u230A',\n\tleftharpoondown: '\\u21BD',\n\tleftharpoonup: '\\u21BC',\n\tleftleftarrows: '\\u21C7',\n\tLeftRightArrow: '\\u2194',\n\tLeftrightarrow: '\\u21D4',\n\tleftrightarrow: '\\u2194',\n\tleftrightarrows: '\\u21C6',\n\tleftrightharpoons: '\\u21CB',\n\tleftrightsquigarrow: '\\u21AD',\n\tLeftRightVector: '\\u294E',\n\tLeftTee: '\\u22A3',\n\tLeftTeeArrow: '\\u21A4',\n\tLeftTeeVector: '\\u295A',\n\tleftthreetimes: '\\u22CB',\n\tLeftTriangle: '\\u22B2',\n\tLeftTriangleBar: '\\u29CF',\n\tLeftTriangleEqual: '\\u22B4',\n\tLeftUpDownVector: '\\u2951',\n\tLeftUpTeeVector: '\\u2960',\n\tLeftUpVector: '\\u21BF',\n\tLeftUpVectorBar: '\\u2958',\n\tLeftVector: '\\u21BC',\n\tLeftVectorBar: '\\u2952',\n\tlEg: '\\u2A8B',\n\tleg: '\\u22DA',\n\tleq: '\\u2264',\n\tleqq: '\\u2266',\n\tleqslant: '\\u2A7D',\n\tles: '\\u2A7D',\n\tlescc: '\\u2AA8',\n\tlesdot: '\\u2A7F',\n\tlesdoto: '\\u2A81',\n\tlesdotor: '\\u2A83',\n\tlesg: '\\u22DA\\uFE00',\n\tlesges: '\\u2A93',\n\tlessapprox: '\\u2A85',\n\tlessdot: '\\u22D6',\n\tlesseqgtr: '\\u22DA',\n\tlesseqqgtr: '\\u2A8B',\n\tLessEqualGreater: '\\u22DA',\n\tLessFullEqual: '\\u2266',\n\tLessGreater: '\\u2276',\n\tlessgtr: '\\u2276',\n\tLessLess: '\\u2AA1',\n\tlesssim: '\\u2272',\n\tLessSlantEqual: '\\u2A7D',\n\tLessTilde: '\\u2272',\n\tlfisht: '\\u297C',\n\tlfloor: '\\u230A',\n\tLfr: '\\uD835\\uDD0F',\n\tlfr: '\\uD835\\uDD29',\n\tlg: '\\u2276',\n\tlgE: '\\u2A91',\n\tlHar: '\\u2962',\n\tlhard: '\\u21BD',\n\tlharu: '\\u21BC',\n\tlharul: '\\u296A',\n\tlhblk: '\\u2584',\n\tLJcy: '\\u0409',\n\tljcy: '\\u0459',\n\tLl: '\\u22D8',\n\tll: '\\u226A',\n\tllarr: '\\u21C7',\n\tllcorner: '\\u231E',\n\tLleftarrow: '\\u21DA',\n\tllhard: '\\u296B',\n\tlltri: '\\u25FA',\n\tLmidot: '\\u013F',\n\tlmidot: '\\u0140',\n\tlmoust: '\\u23B0',\n\tlmoustache: '\\u23B0',\n\tlnap: '\\u2A89',\n\tlnapprox: '\\u2A89',\n\tlnE: '\\u2268',\n\tlne: '\\u2A87',\n\tlneq: '\\u2A87',\n\tlneqq: '\\u2268',\n\tlnsim: '\\u22E6',\n\tloang: '\\u27EC',\n\tloarr: '\\u21FD',\n\tlobrk: '\\u27E6',\n\tLongLeftArrow: '\\u27F5',\n\tLongleftarrow: '\\u27F8',\n\tlongleftarrow: '\\u27F5',\n\tLongLeftRightArrow: '\\u27F7',\n\tLongleftrightarrow: '\\u27FA',\n\tlongleftrightarrow: '\\u27F7',\n\tlongmapsto: '\\u27FC',\n\tLongRightArrow: '\\u27F6',\n\tLongrightarrow: '\\u27F9',\n\tlongrightarrow: '\\u27F6',\n\tlooparrowleft: '\\u21AB',\n\tlooparrowright: '\\u21AC',\n\tlopar: '\\u2985',\n\tLopf: '\\uD835\\uDD43',\n\tlopf: '\\uD835\\uDD5D',\n\tloplus: '\\u2A2D',\n\tlotimes: '\\u2A34',\n\tlowast: '\\u2217',\n\tlowbar: '\\u005F',\n\tLowerLeftArrow: '\\u2199',\n\tLowerRightArrow: '\\u2198',\n\tloz: '\\u25CA',\n\tlozenge: '\\u25CA',\n\tlozf: '\\u29EB',\n\tlpar: '\\u0028',\n\tlparlt: '\\u2993',\n\tlrarr: '\\u21C6',\n\tlrcorner: '\\u231F',\n\tlrhar: '\\u21CB',\n\tlrhard: '\\u296D',\n\tlrm: '\\u200E',\n\tlrtri: '\\u22BF',\n\tlsaquo: '\\u2039',\n\tLscr: '\\u2112',\n\tlscr: '\\uD835\\uDCC1',\n\tLsh: '\\u21B0',\n\tlsh: '\\u21B0',\n\tlsim: '\\u2272',\n\tlsime: '\\u2A8D',\n\tlsimg: '\\u2A8F',\n\tlsqb: '\\u005B',\n\tlsquo: '\\u2018',\n\tlsquor: '\\u201A',\n\tLstrok: '\\u0141',\n\tlstrok: '\\u0142',\n\tLt: '\\u226A',\n\tLT: '\\u003C',\n\tlt: '\\u003C',\n\tltcc: '\\u2AA6',\n\tltcir: '\\u2A79',\n\tltdot: '\\u22D6',\n\tlthree: '\\u22CB',\n\tltimes: '\\u22C9',\n\tltlarr: '\\u2976',\n\tltquest: '\\u2A7B',\n\tltri: '\\u25C3',\n\tltrie: '\\u22B4',\n\tltrif: '\\u25C2',\n\tltrPar: '\\u2996',\n\tlurdshar: '\\u294A',\n\tluruhar: '\\u2966',\n\tlvertneqq: '\\u2268\\uFE00',\n\tlvnE: '\\u2268\\uFE00',\n\tmacr: '\\u00AF',\n\tmale: '\\u2642',\n\tmalt: '\\u2720',\n\tmaltese: '\\u2720',\n\tMap: '\\u2905',\n\tmap: '\\u21A6',\n\tmapsto: '\\u21A6',\n\tmapstodown: '\\u21A7',\n\tmapstoleft: '\\u21A4',\n\tmapstoup: '\\u21A5',\n\tmarker: '\\u25AE',\n\tmcomma: '\\u2A29',\n\tMcy: '\\u041C',\n\tmcy: '\\u043C',\n\tmdash: '\\u2014',\n\tmDDot: '\\u223A',\n\tmeasuredangle: '\\u2221',\n\tMediumSpace: '\\u205F',\n\tMellintrf: '\\u2133',\n\tMfr: '\\uD835\\uDD10',\n\tmfr: '\\uD835\\uDD2A',\n\tmho: '\\u2127',\n\tmicro: '\\u00B5',\n\tmid: '\\u2223',\n\tmidast: '\\u002A',\n\tmidcir: '\\u2AF0',\n\tmiddot: '\\u00B7',\n\tminus: '\\u2212',\n\tminusb: '\\u229F',\n\tminusd: '\\u2238',\n\tminusdu: '\\u2A2A',\n\tMinusPlus: '\\u2213',\n\tmlcp: '\\u2ADB',\n\tmldr: '\\u2026',\n\tmnplus: '\\u2213',\n\tmodels: '\\u22A7',\n\tMopf: '\\uD835\\uDD44',\n\tmopf: '\\uD835\\uDD5E',\n\tmp: '\\u2213',\n\tMscr: '\\u2133',\n\tmscr: '\\uD835\\uDCC2',\n\tmstpos: '\\u223E',\n\tMu: '\\u039C',\n\tmu: '\\u03BC',\n\tmultimap: '\\u22B8',\n\tmumap: '\\u22B8',\n\tnabla: '\\u2207',\n\tNacute: '\\u0143',\n\tnacute: '\\u0144',\n\tnang: '\\u2220\\u20D2',\n\tnap: '\\u2249',\n\tnapE: '\\u2A70\\u0338',\n\tnapid: '\\u224B\\u0338',\n\tnapos: '\\u0149',\n\tnapprox: '\\u2249',\n\tnatur: '\\u266E',\n\tnatural: '\\u266E',\n\tnaturals: '\\u2115',\n\tnbsp: '\\u00A0',\n\tnbump: '\\u224E\\u0338',\n\tnbumpe: '\\u224F\\u0338',\n\tncap: '\\u2A43',\n\tNcaron: '\\u0147',\n\tncaron: '\\u0148',\n\tNcedil: '\\u0145',\n\tncedil: '\\u0146',\n\tncong: '\\u2247',\n\tncongdot: '\\u2A6D\\u0338',\n\tncup: '\\u2A42',\n\tNcy: '\\u041D',\n\tncy: '\\u043D',\n\tndash: '\\u2013',\n\tne: '\\u2260',\n\tnearhk: '\\u2924',\n\tneArr: '\\u21D7',\n\tnearr: '\\u2197',\n\tnearrow: '\\u2197',\n\tnedot: '\\u2250\\u0338',\n\tNegativeMediumSpace: '\\u200B',\n\tNegativeThickSpace: '\\u200B',\n\tNegativeThinSpace: '\\u200B',\n\tNegativeVeryThinSpace: '\\u200B',\n\tnequiv: '\\u2262',\n\tnesear: '\\u2928',\n\tnesim: '\\u2242\\u0338',\n\tNestedGreaterGreater: '\\u226B',\n\tNestedLessLess: '\\u226A',\n\tNewLine: '\\u000A',\n\tnexist: '\\u2204',\n\tnexists: '\\u2204',\n\tNfr: '\\uD835\\uDD11',\n\tnfr: '\\uD835\\uDD2B',\n\tngE: '\\u2267\\u0338',\n\tnge: '\\u2271',\n\tngeq: '\\u2271',\n\tngeqq: '\\u2267\\u0338',\n\tngeqslant: '\\u2A7E\\u0338',\n\tnges: '\\u2A7E\\u0338',\n\tnGg: '\\u22D9\\u0338',\n\tngsim: '\\u2275',\n\tnGt: '\\u226B\\u20D2',\n\tngt: '\\u226F',\n\tngtr: '\\u226F',\n\tnGtv: '\\u226B\\u0338',\n\tnhArr: '\\u21CE',\n\tnharr: '\\u21AE',\n\tnhpar: '\\u2AF2',\n\tni: '\\u220B',\n\tnis: '\\u22FC',\n\tnisd: '\\u22FA',\n\tniv: '\\u220B',\n\tNJcy: '\\u040A',\n\tnjcy: '\\u045A',\n\tnlArr: '\\u21CD',\n\tnlarr: '\\u219A',\n\tnldr: '\\u2025',\n\tnlE: '\\u2266\\u0338',\n\tnle: '\\u2270',\n\tnLeftarrow: '\\u21CD',\n\tnleftarrow: '\\u219A',\n\tnLeftrightarrow: '\\u21CE',\n\tnleftrightarrow: '\\u21AE',\n\tnleq: '\\u2270',\n\tnleqq: '\\u2266\\u0338',\n\tnleqslant: '\\u2A7D\\u0338',\n\tnles: '\\u2A7D\\u0338',\n\tnless: '\\u226E',\n\tnLl: '\\u22D8\\u0338',\n\tnlsim: '\\u2274',\n\tnLt: '\\u226A\\u20D2',\n\tnlt: '\\u226E',\n\tnltri: '\\u22EA',\n\tnltrie: '\\u22EC',\n\tnLtv: '\\u226A\\u0338',\n\tnmid: '\\u2224',\n\tNoBreak: '\\u2060',\n\tNonBreakingSpace: '\\u00A0',\n\tNopf: '\\u2115',\n\tnopf: '\\uD835\\uDD5F',\n\tNot: '\\u2AEC',\n\tnot: '\\u00AC',\n\tNotCongruent: '\\u2262',\n\tNotCupCap: '\\u226D',\n\tNotDoubleVerticalBar: '\\u2226',\n\tNotElement: '\\u2209',\n\tNotEqual: '\\u2260',\n\tNotEqualTilde: '\\u2242\\u0338',\n\tNotExists: '\\u2204',\n\tNotGreater: '\\u226F',\n\tNotGreaterEqual: '\\u2271',\n\tNotGreaterFullEqual: '\\u2267\\u0338',\n\tNotGreaterGreater: '\\u226B\\u0338',\n\tNotGreaterLess: '\\u2279',\n\tNotGreaterSlantEqual: '\\u2A7E\\u0338',\n\tNotGreaterTilde: '\\u2275',\n\tNotHumpDownHump: '\\u224E\\u0338',\n\tNotHumpEqual: '\\u224F\\u0338',\n\tnotin: '\\u2209',\n\tnotindot: '\\u22F5\\u0338',\n\tnotinE: '\\u22F9\\u0338',\n\tnotinva: '\\u2209',\n\tnotinvb: '\\u22F7',\n\tnotinvc: '\\u22F6',\n\tNotLeftTriangle: '\\u22EA',\n\tNotLeftTriangleBar: '\\u29CF\\u0338',\n\tNotLeftTriangleEqual: '\\u22EC',\n\tNotLess: '\\u226E',\n\tNotLessEqual: '\\u2270',\n\tNotLessGreater: '\\u2278',\n\tNotLessLess: '\\u226A\\u0338',\n\tNotLessSlantEqual: '\\u2A7D\\u0338',\n\tNotLessTilde: '\\u2274',\n\tNotNestedGreaterGreater: '\\u2AA2\\u0338',\n\tNotNestedLessLess: '\\u2AA1\\u0338',\n\tnotni: '\\u220C',\n\tnotniva: '\\u220C',\n\tnotnivb: '\\u22FE',\n\tnotnivc: '\\u22FD',\n\tNotPrecedes: '\\u2280',\n\tNotPrecedesEqual: '\\u2AAF\\u0338',\n\tNotPrecedesSlantEqual: '\\u22E0',\n\tNotReverseElement: '\\u220C',\n\tNotRightTriangle: '\\u22EB',\n\tNotRightTriangleBar: '\\u29D0\\u0338',\n\tNotRightTriangleEqual: '\\u22ED',\n\tNotSquareSubset: '\\u228F\\u0338',\n\tNotSquareSubsetEqual: '\\u22E2',\n\tNotSquareSuperset: '\\u2290\\u0338',\n\tNotSquareSupersetEqual: '\\u22E3',\n\tNotSubset: '\\u2282\\u20D2',\n\tNotSubsetEqual: '\\u2288',\n\tNotSucceeds: '\\u2281',\n\tNotSucceedsEqual: '\\u2AB0\\u0338',\n\tNotSucceedsSlantEqual: '\\u22E1',\n\tNotSucceedsTilde: '\\u227F\\u0338',\n\tNotSuperset: '\\u2283\\u20D2',\n\tNotSupersetEqual: '\\u2289',\n\tNotTilde: '\\u2241',\n\tNotTildeEqual: '\\u2244',\n\tNotTildeFullEqual: '\\u2247',\n\tNotTildeTilde: '\\u2249',\n\tNotVerticalBar: '\\u2224',\n\tnpar: '\\u2226',\n\tnparallel: '\\u2226',\n\tnparsl: '\\u2AFD\\u20E5',\n\tnpart: '\\u2202\\u0338',\n\tnpolint: '\\u2A14',\n\tnpr: '\\u2280',\n\tnprcue: '\\u22E0',\n\tnpre: '\\u2AAF\\u0338',\n\tnprec: '\\u2280',\n\tnpreceq: '\\u2AAF\\u0338',\n\tnrArr: '\\u21CF',\n\tnrarr: '\\u219B',\n\tnrarrc: '\\u2933\\u0338',\n\tnrarrw: '\\u219D\\u0338',\n\tnRightarrow: '\\u21CF',\n\tnrightarrow: '\\u219B',\n\tnrtri: '\\u22EB',\n\tnrtrie: '\\u22ED',\n\tnsc: '\\u2281',\n\tnsccue: '\\u22E1',\n\tnsce: '\\u2AB0\\u0338',\n\tNscr: '\\uD835\\uDCA9',\n\tnscr: '\\uD835\\uDCC3',\n\tnshortmid: '\\u2224',\n\tnshortparallel: '\\u2226',\n\tnsim: '\\u2241',\n\tnsime: '\\u2244',\n\tnsimeq: '\\u2244',\n\tnsmid: '\\u2224',\n\tnspar: '\\u2226',\n\tnsqsube: '\\u22E2',\n\tnsqsupe: '\\u22E3',\n\tnsub: '\\u2284',\n\tnsubE: '\\u2AC5\\u0338',\n\tnsube: '\\u2288',\n\tnsubset: '\\u2282\\u20D2',\n\tnsubseteq: '\\u2288',\n\tnsubseteqq: '\\u2AC5\\u0338',\n\tnsucc: '\\u2281',\n\tnsucceq: '\\u2AB0\\u0338',\n\tnsup: '\\u2285',\n\tnsupE: '\\u2AC6\\u0338',\n\tnsupe: '\\u2289',\n\tnsupset: '\\u2283\\u20D2',\n\tnsupseteq: '\\u2289',\n\tnsupseteqq: '\\u2AC6\\u0338',\n\tntgl: '\\u2279',\n\tNtilde: '\\u00D1',\n\tntilde: '\\u00F1',\n\tntlg: '\\u2278',\n\tntriangleleft: '\\u22EA',\n\tntrianglelefteq: '\\u22EC',\n\tntriangleright: '\\u22EB',\n\tntrianglerighteq: '\\u22ED',\n\tNu: '\\u039D',\n\tnu: '\\u03BD',\n\tnum: '\\u0023',\n\tnumero: '\\u2116',\n\tnumsp: '\\u2007',\n\tnvap: '\\u224D\\u20D2',\n\tnVDash: '\\u22AF',\n\tnVdash: '\\u22AE',\n\tnvDash: '\\u22AD',\n\tnvdash: '\\u22AC',\n\tnvge: '\\u2265\\u20D2',\n\tnvgt: '\\u003E\\u20D2',\n\tnvHarr: '\\u2904',\n\tnvinfin: '\\u29DE',\n\tnvlArr: '\\u2902',\n\tnvle: '\\u2264\\u20D2',\n\tnvlt: '\\u003C\\u20D2',\n\tnvltrie: '\\u22B4\\u20D2',\n\tnvrArr: '\\u2903',\n\tnvrtrie: '\\u22B5\\u20D2',\n\tnvsim: '\\u223C\\u20D2',\n\tnwarhk: '\\u2923',\n\tnwArr: '\\u21D6',\n\tnwarr: '\\u2196',\n\tnwarrow: '\\u2196',\n\tnwnear: '\\u2927',\n\tOacute: '\\u00D3',\n\toacute: '\\u00F3',\n\toast: '\\u229B',\n\tocir: '\\u229A',\n\tOcirc: '\\u00D4',\n\tocirc: '\\u00F4',\n\tOcy: '\\u041E',\n\tocy: '\\u043E',\n\todash: '\\u229D',\n\tOdblac: '\\u0150',\n\todblac: '\\u0151',\n\todiv: '\\u2A38',\n\todot: '\\u2299',\n\todsold: '\\u29BC',\n\tOElig: '\\u0152',\n\toelig: '\\u0153',\n\tofcir: '\\u29BF',\n\tOfr: '\\uD835\\uDD12',\n\tofr: '\\uD835\\uDD2C',\n\togon: '\\u02DB',\n\tOgrave: '\\u00D2',\n\tograve: '\\u00F2',\n\togt: '\\u29C1',\n\tohbar: '\\u29B5',\n\tohm: '\\u03A9',\n\toint: '\\u222E',\n\tolarr: '\\u21BA',\n\tolcir: '\\u29BE',\n\tolcross: '\\u29BB',\n\toline: '\\u203E',\n\tolt: '\\u29C0',\n\tOmacr: '\\u014C',\n\tomacr: '\\u014D',\n\tOmega: '\\u03A9',\n\tomega: '\\u03C9',\n\tOmicron: '\\u039F',\n\tomicron: '\\u03BF',\n\tomid: '\\u29B6',\n\tominus: '\\u2296',\n\tOopf: '\\uD835\\uDD46',\n\toopf: '\\uD835\\uDD60',\n\topar: '\\u29B7',\n\tOpenCurlyDoubleQuote: '\\u201C',\n\tOpenCurlyQuote: '\\u2018',\n\toperp: '\\u29B9',\n\toplus: '\\u2295',\n\tOr: '\\u2A54',\n\tor: '\\u2228',\n\torarr: '\\u21BB',\n\tord: '\\u2A5D',\n\torder: '\\u2134',\n\torderof: '\\u2134',\n\tordf: '\\u00AA',\n\tordm: '\\u00BA',\n\torigof: '\\u22B6',\n\toror: '\\u2A56',\n\torslope: '\\u2A57',\n\torv: '\\u2A5B',\n\toS: '\\u24C8',\n\tOscr: '\\uD835\\uDCAA',\n\toscr: '\\u2134',\n\tOslash: '\\u00D8',\n\toslash: '\\u00F8',\n\tosol: '\\u2298',\n\tOtilde: '\\u00D5',\n\totilde: '\\u00F5',\n\tOtimes: '\\u2A37',\n\totimes: '\\u2297',\n\totimesas: '\\u2A36',\n\tOuml: '\\u00D6',\n\touml: '\\u00F6',\n\tovbar: '\\u233D',\n\tOverBar: '\\u203E',\n\tOverBrace: '\\u23DE',\n\tOverBracket: '\\u23B4',\n\tOverParenthesis: '\\u23DC',\n\tpar: '\\u2225',\n\tpara: '\\u00B6',\n\tparallel: '\\u2225',\n\tparsim: '\\u2AF3',\n\tparsl: '\\u2AFD',\n\tpart: '\\u2202',\n\tPartialD: '\\u2202',\n\tPcy: '\\u041F',\n\tpcy: '\\u043F',\n\tpercnt: '\\u0025',\n\tperiod: '\\u002E',\n\tpermil: '\\u2030',\n\tperp: '\\u22A5',\n\tpertenk: '\\u2031',\n\tPfr: '\\uD835\\uDD13',\n\tpfr: '\\uD835\\uDD2D',\n\tPhi: '\\u03A6',\n\tphi: '\\u03C6',\n\tphiv: '\\u03D5',\n\tphmmat: '\\u2133',\n\tphone: '\\u260E',\n\tPi: '\\u03A0',\n\tpi: '\\u03C0',\n\tpitchfork: '\\u22D4',\n\tpiv: '\\u03D6',\n\tplanck: '\\u210F',\n\tplanckh: '\\u210E',\n\tplankv: '\\u210F',\n\tplus: '\\u002B',\n\tplusacir: '\\u2A23',\n\tplusb: '\\u229E',\n\tpluscir: '\\u2A22',\n\tplusdo: '\\u2214',\n\tplusdu: '\\u2A25',\n\tpluse: '\\u2A72',\n\tPlusMinus: '\\u00B1',\n\tplusmn: '\\u00B1',\n\tplussim: '\\u2A26',\n\tplustwo: '\\u2A27',\n\tpm: '\\u00B1',\n\tPoincareplane: '\\u210C',\n\tpointint: '\\u2A15',\n\tPopf: '\\u2119',\n\tpopf: '\\uD835\\uDD61',\n\tpound: '\\u00A3',\n\tPr: '\\u2ABB',\n\tpr: '\\u227A',\n\tprap: '\\u2AB7',\n\tprcue: '\\u227C',\n\tprE: '\\u2AB3',\n\tpre: '\\u2AAF',\n\tprec: '\\u227A',\n\tprecapprox: '\\u2AB7',\n\tpreccurlyeq: '\\u227C',\n\tPrecedes: '\\u227A',\n\tPrecedesEqual: '\\u2AAF',\n\tPrecedesSlantEqual: '\\u227C',\n\tPrecedesTilde: '\\u227E',\n\tpreceq: '\\u2AAF',\n\tprecnapprox: '\\u2AB9',\n\tprecneqq: '\\u2AB5',\n\tprecnsim: '\\u22E8',\n\tprecsim: '\\u227E',\n\tPrime: '\\u2033',\n\tprime: '\\u2032',\n\tprimes: '\\u2119',\n\tprnap: '\\u2AB9',\n\tprnE: '\\u2AB5',\n\tprnsim: '\\u22E8',\n\tprod: '\\u220F',\n\tProduct: '\\u220F',\n\tprofalar: '\\u232E',\n\tprofline: '\\u2312',\n\tprofsurf: '\\u2313',\n\tprop: '\\u221D',\n\tProportion: '\\u2237',\n\tProportional: '\\u221D',\n\tpropto: '\\u221D',\n\tprsim: '\\u227E',\n\tprurel: '\\u22B0',\n\tPscr: '\\uD835\\uDCAB',\n\tpscr: '\\uD835\\uDCC5',\n\tPsi: '\\u03A8',\n\tpsi: '\\u03C8',\n\tpuncsp: '\\u2008',\n\tQfr: '\\uD835\\uDD14',\n\tqfr: '\\uD835\\uDD2E',\n\tqint: '\\u2A0C',\n\tQopf: '\\u211A',\n\tqopf: '\\uD835\\uDD62',\n\tqprime: '\\u2057',\n\tQscr: '\\uD835\\uDCAC',\n\tqscr: '\\uD835\\uDCC6',\n\tquaternions: '\\u210D',\n\tquatint: '\\u2A16',\n\tquest: '\\u003F',\n\tquesteq: '\\u225F',\n\tQUOT: '\\u0022',\n\tquot: '\\u0022',\n\trAarr: '\\u21DB',\n\trace: '\\u223D\\u0331',\n\tRacute: '\\u0154',\n\tracute: '\\u0155',\n\tradic: '\\u221A',\n\traemptyv: '\\u29B3',\n\tRang: '\\u27EB',\n\trang: '\\u27E9',\n\trangd: '\\u2992',\n\trange: '\\u29A5',\n\trangle: '\\u27E9',\n\traquo: '\\u00BB',\n\tRarr: '\\u21A0',\n\trArr: '\\u21D2',\n\trarr: '\\u2192',\n\trarrap: '\\u2975',\n\trarrb: '\\u21E5',\n\trarrbfs: '\\u2920',\n\trarrc: '\\u2933',\n\trarrfs: '\\u291E',\n\trarrhk: '\\u21AA',\n\trarrlp: '\\u21AC',\n\trarrpl: '\\u2945',\n\trarrsim: '\\u2974',\n\tRarrtl: '\\u2916',\n\trarrtl: '\\u21A3',\n\trarrw: '\\u219D',\n\trAtail: '\\u291C',\n\tratail: '\\u291A',\n\tratio: '\\u2236',\n\trationals: '\\u211A',\n\tRBarr: '\\u2910',\n\trBarr: '\\u290F',\n\trbarr: '\\u290D',\n\trbbrk: '\\u2773',\n\trbrace: '\\u007D',\n\trbrack: '\\u005D',\n\trbrke: '\\u298C',\n\trbrksld: '\\u298E',\n\trbrkslu: '\\u2990',\n\tRcaron: '\\u0158',\n\trcaron: '\\u0159',\n\tRcedil: '\\u0156',\n\trcedil: '\\u0157',\n\trceil: '\\u2309',\n\trcub: '\\u007D',\n\tRcy: '\\u0420',\n\trcy: '\\u0440',\n\trdca: '\\u2937',\n\trdldhar: '\\u2969',\n\trdquo: '\\u201D',\n\trdquor: '\\u201D',\n\trdsh: '\\u21B3',\n\tRe: '\\u211C',\n\treal: '\\u211C',\n\trealine: '\\u211B',\n\trealpart: '\\u211C',\n\treals: '\\u211D',\n\trect: '\\u25AD',\n\tREG: '\\u00AE',\n\treg: '\\u00AE',\n\tReverseElement: '\\u220B',\n\tReverseEquilibrium: '\\u21CB',\n\tReverseUpEquilibrium: '\\u296F',\n\trfisht: '\\u297D',\n\trfloor: '\\u230B',\n\tRfr: '\\u211C',\n\trfr: '\\uD835\\uDD2F',\n\trHar: '\\u2964',\n\trhard: '\\u21C1',\n\trharu: '\\u21C0',\n\trharul: '\\u296C',\n\tRho: '\\u03A1',\n\trho: '\\u03C1',\n\trhov: '\\u03F1',\n\tRightAngleBracket: '\\u27E9',\n\tRightArrow: '\\u2192',\n\tRightarrow: '\\u21D2',\n\trightarrow: '\\u2192',\n\tRightArrowBar: '\\u21E5',\n\tRightArrowLeftArrow: '\\u21C4',\n\trightarrowtail: '\\u21A3',\n\tRightCeiling: '\\u2309',\n\tRightDoubleBracket: '\\u27E7',\n\tRightDownTeeVector: '\\u295D',\n\tRightDownVector: '\\u21C2',\n\tRightDownVectorBar: '\\u2955',\n\tRightFloor: '\\u230B',\n\trightharpoondown: '\\u21C1',\n\trightharpoonup: '\\u21C0',\n\trightleftarrows: '\\u21C4',\n\trightleftharpoons: '\\u21CC',\n\trightrightarrows: '\\u21C9',\n\trightsquigarrow: '\\u219D',\n\tRightTee: '\\u22A2',\n\tRightTeeArrow: '\\u21A6',\n\tRightTeeVector: '\\u295B',\n\trightthreetimes: '\\u22CC',\n\tRightTriangle: '\\u22B3',\n\tRightTriangleBar: '\\u29D0',\n\tRightTriangleEqual: '\\u22B5',\n\tRightUpDownVector: '\\u294F',\n\tRightUpTeeVector: '\\u295C',\n\tRightUpVector: '\\u21BE',\n\tRightUpVectorBar: '\\u2954',\n\tRightVector: '\\u21C0',\n\tRightVectorBar: '\\u2953',\n\tring: '\\u02DA',\n\trisingdotseq: '\\u2253',\n\trlarr: '\\u21C4',\n\trlhar: '\\u21CC',\n\trlm: '\\u200F',\n\trmoust: '\\u23B1',\n\trmoustache: '\\u23B1',\n\trnmid: '\\u2AEE',\n\troang: '\\u27ED',\n\troarr: '\\u21FE',\n\trobrk: '\\u27E7',\n\tropar: '\\u2986',\n\tRopf: '\\u211D',\n\tropf: '\\uD835\\uDD63',\n\troplus: '\\u2A2E',\n\trotimes: '\\u2A35',\n\tRoundImplies: '\\u2970',\n\trpar: '\\u0029',\n\trpargt: '\\u2994',\n\trppolint: '\\u2A12',\n\trrarr: '\\u21C9',\n\tRrightarrow: '\\u21DB',\n\trsaquo: '\\u203A',\n\tRscr: '\\u211B',\n\trscr: '\\uD835\\uDCC7',\n\tRsh: '\\u21B1',\n\trsh: '\\u21B1',\n\trsqb: '\\u005D',\n\trsquo: '\\u2019',\n\trsquor: '\\u2019',\n\trthree: '\\u22CC',\n\trtimes: '\\u22CA',\n\trtri: '\\u25B9',\n\trtrie: '\\u22B5',\n\trtrif: '\\u25B8',\n\trtriltri: '\\u29CE',\n\tRuleDelayed: '\\u29F4',\n\truluhar: '\\u2968',\n\trx: '\\u211E',\n\tSacute: '\\u015A',\n\tsacute: '\\u015B',\n\tsbquo: '\\u201A',\n\tSc: '\\u2ABC',\n\tsc: '\\u227B',\n\tscap: '\\u2AB8',\n\tScaron: '\\u0160',\n\tscaron: '\\u0161',\n\tsccue: '\\u227D',\n\tscE: '\\u2AB4',\n\tsce: '\\u2AB0',\n\tScedil: '\\u015E',\n\tscedil: '\\u015F',\n\tScirc: '\\u015C',\n\tscirc: '\\u015D',\n\tscnap: '\\u2ABA',\n\tscnE: '\\u2AB6',\n\tscnsim: '\\u22E9',\n\tscpolint: '\\u2A13',\n\tscsim: '\\u227F',\n\tScy: '\\u0421',\n\tscy: '\\u0441',\n\tsdot: '\\u22C5',\n\tsdotb: '\\u22A1',\n\tsdote: '\\u2A66',\n\tsearhk: '\\u2925',\n\tseArr: '\\u21D8',\n\tsearr: '\\u2198',\n\tsearrow: '\\u2198',\n\tsect: '\\u00A7',\n\tsemi: '\\u003B',\n\tseswar: '\\u2929',\n\tsetminus: '\\u2216',\n\tsetmn: '\\u2216',\n\tsext: '\\u2736',\n\tSfr: '\\uD835\\uDD16',\n\tsfr: '\\uD835\\uDD30',\n\tsfrown: '\\u2322',\n\tsharp: '\\u266F',\n\tSHCHcy: '\\u0429',\n\tshchcy: '\\u0449',\n\tSHcy: '\\u0428',\n\tshcy: '\\u0448',\n\tShortDownArrow: '\\u2193',\n\tShortLeftArrow: '\\u2190',\n\tshortmid: '\\u2223',\n\tshortparallel: '\\u2225',\n\tShortRightArrow: '\\u2192',\n\tShortUpArrow: '\\u2191',\n\tshy: '\\u00AD',\n\tSigma: '\\u03A3',\n\tsigma: '\\u03C3',\n\tsigmaf: '\\u03C2',\n\tsigmav: '\\u03C2',\n\tsim: '\\u223C',\n\tsimdot: '\\u2A6A',\n\tsime: '\\u2243',\n\tsimeq: '\\u2243',\n\tsimg: '\\u2A9E',\n\tsimgE: '\\u2AA0',\n\tsiml: '\\u2A9D',\n\tsimlE: '\\u2A9F',\n\tsimne: '\\u2246',\n\tsimplus: '\\u2A24',\n\tsimrarr: '\\u2972',\n\tslarr: '\\u2190',\n\tSmallCircle: '\\u2218',\n\tsmallsetminus: '\\u2216',\n\tsmashp: '\\u2A33',\n\tsmeparsl: '\\u29E4',\n\tsmid: '\\u2223',\n\tsmile: '\\u2323',\n\tsmt: '\\u2AAA',\n\tsmte: '\\u2AAC',\n\tsmtes: '\\u2AAC\\uFE00',\n\tSOFTcy: '\\u042C',\n\tsoftcy: '\\u044C',\n\tsol: '\\u002F',\n\tsolb: '\\u29C4',\n\tsolbar: '\\u233F',\n\tSopf: '\\uD835\\uDD4A',\n\tsopf: '\\uD835\\uDD64',\n\tspades: '\\u2660',\n\tspadesuit: '\\u2660',\n\tspar: '\\u2225',\n\tsqcap: '\\u2293',\n\tsqcaps: '\\u2293\\uFE00',\n\tsqcup: '\\u2294',\n\tsqcups: '\\u2294\\uFE00',\n\tSqrt: '\\u221A',\n\tsqsub: '\\u228F',\n\tsqsube: '\\u2291',\n\tsqsubset: '\\u228F',\n\tsqsubseteq: '\\u2291',\n\tsqsup: '\\u2290',\n\tsqsupe: '\\u2292',\n\tsqsupset: '\\u2290',\n\tsqsupseteq: '\\u2292',\n\tsqu: '\\u25A1',\n\tSquare: '\\u25A1',\n\tsquare: '\\u25A1',\n\tSquareIntersection: '\\u2293',\n\tSquareSubset: '\\u228F',\n\tSquareSubsetEqual: '\\u2291',\n\tSquareSuperset: '\\u2290',\n\tSquareSupersetEqual: '\\u2292',\n\tSquareUnion: '\\u2294',\n\tsquarf: '\\u25AA',\n\tsquf: '\\u25AA',\n\tsrarr: '\\u2192',\n\tSscr: '\\uD835\\uDCAE',\n\tsscr: '\\uD835\\uDCC8',\n\tssetmn: '\\u2216',\n\tssmile: '\\u2323',\n\tsstarf: '\\u22C6',\n\tStar: '\\u22C6',\n\tstar: '\\u2606',\n\tstarf: '\\u2605',\n\tstraightepsilon: '\\u03F5',\n\tstraightphi: '\\u03D5',\n\tstrns: '\\u00AF',\n\tSub: '\\u22D0',\n\tsub: '\\u2282',\n\tsubdot: '\\u2ABD',\n\tsubE: '\\u2AC5',\n\tsube: '\\u2286',\n\tsubedot: '\\u2AC3',\n\tsubmult: '\\u2AC1',\n\tsubnE: '\\u2ACB',\n\tsubne: '\\u228A',\n\tsubplus: '\\u2ABF',\n\tsubrarr: '\\u2979',\n\tSubset: '\\u22D0',\n\tsubset: '\\u2282',\n\tsubseteq: '\\u2286',\n\tsubseteqq: '\\u2AC5',\n\tSubsetEqual: '\\u2286',\n\tsubsetneq: '\\u228A',\n\tsubsetneqq: '\\u2ACB',\n\tsubsim: '\\u2AC7',\n\tsubsub: '\\u2AD5',\n\tsubsup: '\\u2AD3',\n\tsucc: '\\u227B',\n\tsuccapprox: '\\u2AB8',\n\tsucccurlyeq: '\\u227D',\n\tSucceeds: '\\u227B',\n\tSucceedsEqual: '\\u2AB0',\n\tSucceedsSlantEqual: '\\u227D',\n\tSucceedsTilde: '\\u227F',\n\tsucceq: '\\u2AB0',\n\tsuccnapprox: '\\u2ABA',\n\tsuccneqq: '\\u2AB6',\n\tsuccnsim: '\\u22E9',\n\tsuccsim: '\\u227F',\n\tSuchThat: '\\u220B',\n\tSum: '\\u2211',\n\tsum: '\\u2211',\n\tsung: '\\u266A',\n\tSup: '\\u22D1',\n\tsup: '\\u2283',\n\tsup1: '\\u00B9',\n\tsup2: '\\u00B2',\n\tsup3: '\\u00B3',\n\tsupdot: '\\u2ABE',\n\tsupdsub: '\\u2AD8',\n\tsupE: '\\u2AC6',\n\tsupe: '\\u2287',\n\tsupedot: '\\u2AC4',\n\tSuperset: '\\u2283',\n\tSupersetEqual: '\\u2287',\n\tsuphsol: '\\u27C9',\n\tsuphsub: '\\u2AD7',\n\tsuplarr: '\\u297B',\n\tsupmult: '\\u2AC2',\n\tsupnE: '\\u2ACC',\n\tsupne: '\\u228B',\n\tsupplus: '\\u2AC0',\n\tSupset: '\\u22D1',\n\tsupset: '\\u2283',\n\tsupseteq: '\\u2287',\n\tsupseteqq: '\\u2AC6',\n\tsupsetneq: '\\u228B',\n\tsupsetneqq: '\\u2ACC',\n\tsupsim: '\\u2AC8',\n\tsupsub: '\\u2AD4',\n\tsupsup: '\\u2AD6',\n\tswarhk: '\\u2926',\n\tswArr: '\\u21D9',\n\tswarr: '\\u2199',\n\tswarrow: '\\u2199',\n\tswnwar: '\\u292A',\n\tszlig: '\\u00DF',\n\tTab: '\\u0009',\n\ttarget: '\\u2316',\n\tTau: '\\u03A4',\n\ttau: '\\u03C4',\n\ttbrk: '\\u23B4',\n\tTcaron: '\\u0164',\n\ttcaron: '\\u0165',\n\tTcedil: '\\u0162',\n\ttcedil: '\\u0163',\n\tTcy: '\\u0422',\n\ttcy: '\\u0442',\n\ttdot: '\\u20DB',\n\ttelrec: '\\u2315',\n\tTfr: '\\uD835\\uDD17',\n\ttfr: '\\uD835\\uDD31',\n\tthere4: '\\u2234',\n\tTherefore: '\\u2234',\n\ttherefore: '\\u2234',\n\tTheta: '\\u0398',\n\ttheta: '\\u03B8',\n\tthetasym: '\\u03D1',\n\tthetav: '\\u03D1',\n\tthickapprox: '\\u2248',\n\tthicksim: '\\u223C',\n\tThickSpace: '\\u205F\\u200A',\n\tthinsp: '\\u2009',\n\tThinSpace: '\\u2009',\n\tthkap: '\\u2248',\n\tthksim: '\\u223C',\n\tTHORN: '\\u00DE',\n\tthorn: '\\u00FE',\n\tTilde: '\\u223C',\n\ttilde: '\\u02DC',\n\tTildeEqual: '\\u2243',\n\tTildeFullEqual: '\\u2245',\n\tTildeTilde: '\\u2248',\n\ttimes: '\\u00D7',\n\ttimesb: '\\u22A0',\n\ttimesbar: '\\u2A31',\n\ttimesd: '\\u2A30',\n\ttint: '\\u222D',\n\ttoea: '\\u2928',\n\ttop: '\\u22A4',\n\ttopbot: '\\u2336',\n\ttopcir: '\\u2AF1',\n\tTopf: '\\uD835\\uDD4B',\n\ttopf: '\\uD835\\uDD65',\n\ttopfork: '\\u2ADA',\n\ttosa: '\\u2929',\n\ttprime: '\\u2034',\n\tTRADE: '\\u2122',\n\ttrade: '\\u2122',\n\ttriangle: '\\u25B5',\n\ttriangledown: '\\u25BF',\n\ttriangleleft: '\\u25C3',\n\ttrianglelefteq: '\\u22B4',\n\ttriangleq: '\\u225C',\n\ttriangleright: '\\u25B9',\n\ttrianglerighteq: '\\u22B5',\n\ttridot: '\\u25EC',\n\ttrie: '\\u225C',\n\ttriminus: '\\u2A3A',\n\tTripleDot: '\\u20DB',\n\ttriplus: '\\u2A39',\n\ttrisb: '\\u29CD',\n\ttritime: '\\u2A3B',\n\ttrpezium: '\\u23E2',\n\tTscr: '\\uD835\\uDCAF',\n\ttscr: '\\uD835\\uDCC9',\n\tTScy: '\\u0426',\n\ttscy: '\\u0446',\n\tTSHcy: '\\u040B',\n\ttshcy: '\\u045B',\n\tTstrok: '\\u0166',\n\ttstrok: '\\u0167',\n\ttwixt: '\\u226C',\n\ttwoheadleftarrow: '\\u219E',\n\ttwoheadrightarrow: '\\u21A0',\n\tUacute: '\\u00DA',\n\tuacute: '\\u00FA',\n\tUarr: '\\u219F',\n\tuArr: '\\u21D1',\n\tuarr: '\\u2191',\n\tUarrocir: '\\u2949',\n\tUbrcy: '\\u040E',\n\tubrcy: '\\u045E',\n\tUbreve: '\\u016C',\n\tubreve: '\\u016D',\n\tUcirc: '\\u00DB',\n\tucirc: '\\u00FB',\n\tUcy: '\\u0423',\n\tucy: '\\u0443',\n\tudarr: '\\u21C5',\n\tUdblac: '\\u0170',\n\tudblac: '\\u0171',\n\tudhar: '\\u296E',\n\tufisht: '\\u297E',\n\tUfr: '\\uD835\\uDD18',\n\tufr: '\\uD835\\uDD32',\n\tUgrave: '\\u00D9',\n\tugrave: '\\u00F9',\n\tuHar: '\\u2963',\n\tuharl: '\\u21BF',\n\tuharr: '\\u21BE',\n\tuhblk: '\\u2580',\n\tulcorn: '\\u231C',\n\tulcorner: '\\u231C',\n\tulcrop: '\\u230F',\n\tultri: '\\u25F8',\n\tUmacr: '\\u016A',\n\tumacr: '\\u016B',\n\tuml: '\\u00A8',\n\tUnderBar: '\\u005F',\n\tUnderBrace: '\\u23DF',\n\tUnderBracket: '\\u23B5',\n\tUnderParenthesis: '\\u23DD',\n\tUnion: '\\u22C3',\n\tUnionPlus: '\\u228E',\n\tUogon: '\\u0172',\n\tuogon: '\\u0173',\n\tUopf: '\\uD835\\uDD4C',\n\tuopf: '\\uD835\\uDD66',\n\tUpArrow: '\\u2191',\n\tUparrow: '\\u21D1',\n\tuparrow: '\\u2191',\n\tUpArrowBar: '\\u2912',\n\tUpArrowDownArrow: '\\u21C5',\n\tUpDownArrow: '\\u2195',\n\tUpdownarrow: '\\u21D5',\n\tupdownarrow: '\\u2195',\n\tUpEquilibrium: '\\u296E',\n\tupharpoonleft: '\\u21BF',\n\tupharpoonright: '\\u21BE',\n\tuplus: '\\u228E',\n\tUpperLeftArrow: '\\u2196',\n\tUpperRightArrow: '\\u2197',\n\tUpsi: '\\u03D2',\n\tupsi: '\\u03C5',\n\tupsih: '\\u03D2',\n\tUpsilon: '\\u03A5',\n\tupsilon: '\\u03C5',\n\tUpTee: '\\u22A5',\n\tUpTeeArrow: '\\u21A5',\n\tupuparrows: '\\u21C8',\n\turcorn: '\\u231D',\n\turcorner: '\\u231D',\n\turcrop: '\\u230E',\n\tUring: '\\u016E',\n\turing: '\\u016F',\n\turtri: '\\u25F9',\n\tUscr: '\\uD835\\uDCB0',\n\tuscr: '\\uD835\\uDCCA',\n\tutdot: '\\u22F0',\n\tUtilde: '\\u0168',\n\tutilde: '\\u0169',\n\tutri: '\\u25B5',\n\tutrif: '\\u25B4',\n\tuuarr: '\\u21C8',\n\tUuml: '\\u00DC',\n\tuuml: '\\u00FC',\n\tuwangle: '\\u29A7',\n\tvangrt: '\\u299C',\n\tvarepsilon: '\\u03F5',\n\tvarkappa: '\\u03F0',\n\tvarnothing: '\\u2205',\n\tvarphi: '\\u03D5',\n\tvarpi: '\\u03D6',\n\tvarpropto: '\\u221D',\n\tvArr: '\\u21D5',\n\tvarr: '\\u2195',\n\tvarrho: '\\u03F1',\n\tvarsigma: '\\u03C2',\n\tvarsubsetneq: '\\u228A\\uFE00',\n\tvarsubsetneqq: '\\u2ACB\\uFE00',\n\tvarsupsetneq: '\\u228B\\uFE00',\n\tvarsupsetneqq: '\\u2ACC\\uFE00',\n\tvartheta: '\\u03D1',\n\tvartriangleleft: '\\u22B2',\n\tvartriangleright: '\\u22B3',\n\tVbar: '\\u2AEB',\n\tvBar: '\\u2AE8',\n\tvBarv: '\\u2AE9',\n\tVcy: '\\u0412',\n\tvcy: '\\u0432',\n\tVDash: '\\u22AB',\n\tVdash: '\\u22A9',\n\tvDash: '\\u22A8',\n\tvdash: '\\u22A2',\n\tVdashl: '\\u2AE6',\n\tVee: '\\u22C1',\n\tvee: '\\u2228',\n\tveebar: '\\u22BB',\n\tveeeq: '\\u225A',\n\tvellip: '\\u22EE',\n\tVerbar: '\\u2016',\n\tverbar: '\\u007C',\n\tVert: '\\u2016',\n\tvert: '\\u007C',\n\tVerticalBar: '\\u2223',\n\tVerticalLine: '\\u007C',\n\tVerticalSeparator: '\\u2758',\n\tVerticalTilde: '\\u2240',\n\tVeryThinSpace: '\\u200A',\n\tVfr: '\\uD835\\uDD19',\n\tvfr: '\\uD835\\uDD33',\n\tvltri: '\\u22B2',\n\tvnsub: '\\u2282\\u20D2',\n\tvnsup: '\\u2283\\u20D2',\n\tVopf: '\\uD835\\uDD4D',\n\tvopf: '\\uD835\\uDD67',\n\tvprop: '\\u221D',\n\tvrtri: '\\u22B3',\n\tVscr: '\\uD835\\uDCB1',\n\tvscr: '\\uD835\\uDCCB',\n\tvsubnE: '\\u2ACB\\uFE00',\n\tvsubne: '\\u228A\\uFE00',\n\tvsupnE: '\\u2ACC\\uFE00',\n\tvsupne: '\\u228B\\uFE00',\n\tVvdash: '\\u22AA',\n\tvzigzag: '\\u299A',\n\tWcirc: '\\u0174',\n\twcirc: '\\u0175',\n\twedbar: '\\u2A5F',\n\tWedge: '\\u22C0',\n\twedge: '\\u2227',\n\twedgeq: '\\u2259',\n\tweierp: '\\u2118',\n\tWfr: '\\uD835\\uDD1A',\n\twfr: '\\uD835\\uDD34',\n\tWopf: '\\uD835\\uDD4E',\n\twopf: '\\uD835\\uDD68',\n\twp: '\\u2118',\n\twr: '\\u2240',\n\twreath: '\\u2240',\n\tWscr: '\\uD835\\uDCB2',\n\twscr: '\\uD835\\uDCCC',\n\txcap: '\\u22C2',\n\txcirc: '\\u25EF',\n\txcup: '\\u22C3',\n\txdtri: '\\u25BD',\n\tXfr: '\\uD835\\uDD1B',\n\txfr: '\\uD835\\uDD35',\n\txhArr: '\\u27FA',\n\txharr: '\\u27F7',\n\tXi: '\\u039E',\n\txi: '\\u03BE',\n\txlArr: '\\u27F8',\n\txlarr: '\\u27F5',\n\txmap: '\\u27FC',\n\txnis: '\\u22FB',\n\txodot: '\\u2A00',\n\tXopf: '\\uD835\\uDD4F',\n\txopf: '\\uD835\\uDD69',\n\txoplus: '\\u2A01',\n\txotime: '\\u2A02',\n\txrArr: '\\u27F9',\n\txrarr: '\\u27F6',\n\tXscr: '\\uD835\\uDCB3',\n\txscr: '\\uD835\\uDCCD',\n\txsqcup: '\\u2A06',\n\txuplus: '\\u2A04',\n\txutri: '\\u25B3',\n\txvee: '\\u22C1',\n\txwedge: '\\u22C0',\n\tYacute: '\\u00DD',\n\tyacute: '\\u00FD',\n\tYAcy: '\\u042F',\n\tyacy: '\\u044F',\n\tYcirc: '\\u0176',\n\tycirc: '\\u0177',\n\tYcy: '\\u042B',\n\tycy: '\\u044B',\n\tyen: '\\u00A5',\n\tYfr: '\\uD835\\uDD1C',\n\tyfr: '\\uD835\\uDD36',\n\tYIcy: '\\u0407',\n\tyicy: '\\u0457',\n\tYopf: '\\uD835\\uDD50',\n\tyopf: '\\uD835\\uDD6A',\n\tYscr: '\\uD835\\uDCB4',\n\tyscr: '\\uD835\\uDCCE',\n\tYUcy: '\\u042E',\n\tyucy: '\\u044E',\n\tYuml: '\\u0178',\n\tyuml: '\\u00FF',\n\tZacute: '\\u0179',\n\tzacute: '\\u017A',\n\tZcaron: '\\u017D',\n\tzcaron: '\\u017E',\n\tZcy: '\\u0417',\n\tzcy: '\\u0437',\n\tZdot: '\\u017B',\n\tzdot: '\\u017C',\n\tzeetrf: '\\u2128',\n\tZeroWidthSpace: '\\u200B',\n\tZeta: '\\u0396',\n\tzeta: '\\u03B6',\n\tZfr: '\\u2128',\n\tzfr: '\\uD835\\uDD37',\n\tZHcy: '\\u0416',\n\tzhcy: '\\u0436',\n\tzigrarr: '\\u21DD',\n\tZopf: '\\u2124',\n\tzopf: '\\uD835\\uDD6B',\n\tZscr: '\\uD835\\uDCB5',\n\tzscr: '\\uD835\\uDCCF',\n\tzwj: '\\u200D',\n\tzwnj: '\\u200C',\n});\n\n/**\n * @deprecated use `HTML_ENTITIES` instead\n * @see HTML_ENTITIES\n */\nexports.entityMap = exports.HTML_ENTITIES;\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\t\tbreak;\n\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\tel.closed = true;\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// https://www.w3.org/TR/xml11/#NT-Comment\n// `[15] Comment ::= ''`\nvar Comment = reg(COMMENT_START, regg(chars_without(Char, '-'), '|', reg('-', chars_without(Char, '-'))), '*', COMMENT_END);\n\nvar PCDATA = '#PCDATA';\n// https://www.w3.org/TR/xml11/#NT-Mixed\n// `[51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')'`\n// https://www.w3.org/TR/xml-names/#NT-Mixed\n// `[51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? QName)* S? ')*' | '(' S? '#PCDATA' S? ')'`\n// [VC: Proper Group/PE Nesting] [VC: No Duplicate Types]\nvar Mixed = regg(\n\treg(/\\(/, S_OPT, PCDATA, regg(S_OPT, /\\|/, S_OPT, QName), '*', S_OPT, /\\)\\*/),\n\t'|',\n\treg(/\\(/, S_OPT, PCDATA, S_OPT, /\\)/)\n);\n\nvar _children_quantity = /[?*+]?/;\n/*\n `[49] choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')'` [VC: Proper Group/PE Nesting]\n `[50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'` [VC: Proper Group/PE Nesting]\n simplification to solve circular referencing, but doesn't check validity constraint \"Proper Group/PE Nesting\"\n var _choice_or_seq = reg('[', NameChar_s, SChar_s, chars(_children_quantity), '()|,]*');\n ```\n [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?\n === (Name | '(' S? cp ( S? '|' S? cp )+ S? ')' | '(' S? cp ( S? ',' S? cp )* S? ')') ('?' | '*' | '+')?\n !== (Name | [_choice_or_seq]*) ('?' | '*' | '+')?\n ```\n simplification to solve circular referencing, but doesn't check validity constraint \"Proper Group/PE Nesting\"\n var cp = reg(regg(Name, '|', _choice_or_seq), _children_quantity);\n*/\n/*\nInefficient regular expression (High)\nThis part of the regular expression may cause exponential backtracking on strings starting with '(|' and containing many repetitions of '|'.\nhttps://github.com/xmldom/xmldom/security/code-scanning/91\nvar choice = regg(/\\(/, S_OPT, cp, regg(S_OPT, /\\|/, S_OPT, cp), '+', S_OPT, /\\)/);\n*/\n/*\nInefficient regular expression (High)\nThis part of the regular expression may cause exponential backtracking on strings starting with '(,' and containing many repetitions of ','.\nhttps://github.com/xmldom/xmldom/security/code-scanning/92\nvar seq = regg(/\\(/, S_OPT, cp, regg(S_OPT, /,/, S_OPT, cp), '*', S_OPT, /\\)/);\n*/\n\n// `[47] children ::= (choice | seq) ('?' | '*' | '+')?`\n// simplification to solve circular referencing, but doesn't check validity constraint \"Proper Group/PE Nesting\"\nvar children = reg(/\\([^>]+\\)/, _children_quantity /*regg(choice, '|', seq), _children_quantity*/);\n\n// https://www.w3.org/TR/xml11/#NT-contentspec\n// `[46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children`\nvar contentspec = regg('EMPTY', '|', 'ANY', '|', Mixed, '|', children);\n\nvar ELEMENTDECL_START = ''`\n// https://www.w3.org/TR/xml-names/#NT-elementdecl\n// `[17] elementdecl ::= ''`\n// because of https://www.w3.org/TR/xml11/#NT-PEReference\n// since xmldom is not supporting replacements of PEReferences in the DTD\n// this also supports PEReference in the possible places\nvar elementdecl = reg(ELEMENTDECL_START, S, regg(QName, '|', PEReference), S, regg(contentspec, '|', PEReference), S_OPT, '>');\n\n// https://www.w3.org/TR/xml11/#NT-NotationType\n// `[58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'`\n// [VC: Notation Attributes] [VC: One Notation Per Element Type] [VC: No Notation on Empty Element] [VC: No Duplicate Tokens]\nvar NotationType = reg('NOTATION', S, /\\(/, S_OPT, Name, regg(S_OPT, /\\|/, S_OPT, Name), '*', S_OPT, /\\)/);\n// https://www.w3.org/TR/xml11/#NT-Enumeration\n// `[59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'`\n// [VC: Enumeration] [VC: No Duplicate Tokens]\nvar Enumeration = reg(/\\(/, S_OPT, Nmtoken, regg(S_OPT, /\\|/, S_OPT, Nmtoken), '*', S_OPT, /\\)/);\n\n// https://www.w3.org/TR/xml11/#NT-EnumeratedType\n// `[57] EnumeratedType ::= NotationType | Enumeration`\nvar EnumeratedType = regg(NotationType, '|', Enumeration);\n\n/*\n```\n[55] StringType ::= 'CDATA'\n[56] TokenizedType ::= 'ID' [VC: ID] [VC: One ID per Element Type] [VC: ID Attribute Default]\n | 'IDREF' [VC: IDREF]\n | 'IDREFS' [VC: IDREF]\n\t | 'ENTITY' [VC: Entity Name]\n\t | 'ENTITIES' [VC: Entity Name]\n\t | 'NMTOKEN' [VC: Name Token]\n\t | 'NMTOKENS' [VC: Name Token]\n [54] AttType ::= StringType | TokenizedType | EnumeratedType\n```*/\nvar AttType = regg(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/, '|', EnumeratedType);\n\n// `[60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)`\n// [WFC: No < in Attribute Values] [WFC: No External Entity References]\n// [VC: Fixed Attribute Default] [VC: Required Attribute] [VC: Attribute Default Value Syntactically Correct]\nvar DefaultDecl = regg(/#REQUIRED|#IMPLIED/, '|', regg(regg('#FIXED', S), '?', AttValue));\n\n// https://www.w3.org/TR/xml11/#NT-AttDef\n// [53] AttDef ::= S Name S AttType S DefaultDecl\n// https://www.w3.org/TR/xml-names/#NT-AttDef\n// [1] NSAttName ::= PrefixedAttName | DefaultAttName\n// [2] PrefixedAttName ::= 'xmlns:' NCName [NSC: Reserved Prefixes and Namespace Names]\n// [3] DefaultAttName ::= 'xmlns'\n// [21] AttDef ::= S (QName | NSAttName) S AttType S DefaultDecl\n// \t\t\t\t\t\t === S Name S AttType S DefaultDecl\n// xmldom is not distinguishing between QName and NSAttName on this level\n// to support XML without namespaces in DTD we can not restrict it to QName\nvar AttDef = regg(S, Name, S, AttType, S, DefaultDecl);\n\nvar ATTLIST_DECL_START = ''`\n// https://www.w3.org/TR/xml-names/#NT-AttlistDecl\n// `[20] AttlistDecl ::= ''`\n// to support XML without namespaces in DTD we can not restrict it to QName\nvar AttlistDecl = reg(ATTLIST_DECL_START, S, Name, AttDef, '*', S_OPT, '>');\n\nvar SYSTEM = 'SYSTEM';\nvar PUBLIC = 'PUBLIC';\n// https://www.w3.org/TR/xml11/#NT-ExternalID\n// `[75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral`\nvar ExternalID = regg(regg(SYSTEM, S, SystemLiteral), '|', regg(PUBLIC, S, PubidLiteral, S, SystemLiteral));\nvar ExternalID_match = reg(\n\t'^',\n\tregg(\n\t\tregg(SYSTEM, S, '(?', SystemLiteral, ')'),\n\t\t'|',\n\t\tregg(PUBLIC, S, '(?', PubidLiteral, ')', S, '(?', SystemLiteral, ')')\n\t)\n);\n\n// https://www.w3.org/TR/xml11/#NT-NDataDecl\n// `[76] NDataDecl ::= S 'NDATA' S Name` [VC: Notation Declared]\nvar NDataDecl = regg(S, 'NDATA', S, Name);\n\n// https://www.w3.org/TR/xml11/#NT-EntityDef\n// `[73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)`\nvar EntityDef = regg(EntityValue, '|', regg(ExternalID, NDataDecl, '?'));\n\nvar ENTITY_DECL_START = ''`\nvar GEDecl = reg(ENTITY_DECL_START, S, Name, S, EntityDef, S_OPT, '>');\n// https://www.w3.org/TR/xml11/#NT-PEDef\n// `[74] PEDef ::= EntityValue | ExternalID`\nvar PEDef = regg(EntityValue, '|', ExternalID);\n// https://www.w3.org/TR/xml11/#NT-PEDecl\n// `[72] PEDecl ::= ''`\nvar PEDecl = reg(ENTITY_DECL_START, S, '%', S, Name, S, PEDef, S_OPT, '>');\n// https://www.w3.org/TR/xml11/#NT-EntityDecl\n// `[70] EntityDecl ::= GEDecl | PEDecl`\nvar EntityDecl = regg(GEDecl, '|', PEDecl);\n\n// https://www.w3.org/TR/xml11/#NT-PublicID\n// `[83] PublicID ::= 'PUBLIC' S PubidLiteral`\nvar PublicID = reg(PUBLIC, S, PubidLiteral);\n// https://www.w3.org/TR/xml11/#NT-NotationDecl\n// `[82] NotationDecl ::= ''` [VC: Unique Notation Name]\nvar NotationDecl = reg('');\n\n// https://www.w3.org/TR/xml11/#NT-Eq\n// `[25] Eq ::= S? '=' S?`\nvar Eq = reg(S_OPT, '=', S_OPT);\n// https://www.w3.org/TR/xml/#NT-VersionNum\n// `[26] VersionNum ::= '1.' [0-9]+`\n// https://www.w3.org/TR/xml11/#NT-VersionNum\n// `[26] VersionNum ::= '1.1'`\nvar VersionNum = /1[.]\\d+/;\n// https://www.w3.org/TR/xml11/#NT-VersionInfo\n// `[24] VersionInfo ::= S 'version' Eq (\"'\" VersionNum \"'\" | '\"' VersionNum '\"')`\nvar VersionInfo = reg(S, 'version', Eq, regg(\"'\", VersionNum, \"'\", '|', '\"', VersionNum, '\"'));\n// https://www.w3.org/TR/xml11/#NT-EncName\n// `[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*`\nvar EncName = /[A-Za-z][-A-Za-z0-9._]*/;\n// https://www.w3.org/TR/xml11/#NT-EncDecl\n// `[80] EncodingDecl ::= S 'encoding' Eq ('\"' EncName '\"' | \"'\" EncName \"'\" )`\nvar EncodingDecl = regg(S, 'encoding', Eq, regg('\"', EncName, '\"', '|', \"'\", EncName, \"'\"));\n// https://www.w3.org/TR/xml11/#NT-SDDecl\n// `[32] SDDecl ::= S 'standalone' Eq ((\"'\" ('yes' | 'no') \"'\") | ('\"' ('yes' | 'no') '\"'))`\nvar SDDecl = regg(S, 'standalone', Eq, regg(\"'\", regg('yes', '|', 'no'), \"'\", '|', '\"', regg('yes', '|', 'no'), '\"'));\n// https://www.w3.org/TR/xml11/#NT-XMLDecl\n// [23] XMLDecl ::= ''\nvar XMLDecl = reg(/^<\\?xml/, VersionInfo, EncodingDecl, '?', SDDecl, '?', S_OPT, /\\?>/);\n\n/*\n https://www.w3.org/TR/xml/#NT-markupdecl\n https://www.w3.org/TR/xml11/#NT-markupdecl\n `[29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment`\n var markupdecl = regg(elementdecl, '|', AttlistDecl, '|', EntityDecl, '|', NotationDecl, '|', PI_unsafe, '|', Comment);\n*/\n/*\n https://www.w3.org/TR/xml-names/#NT-doctypedecl\n`[28a] DeclSep ::= PEReference | S`\n https://www.w3.org/TR/xml11/#NT-intSubset\n```\n [28b] intSubset ::= (markupdecl | DeclSep)*\n === (markupdecl | PEReference | S)*\n```\n [WFC: PE Between Declarations]\n var intSubset = reg(regg(markupdecl, '|', PEReference, '|', S), '*');\n*/\nvar DOCTYPE_DECL_START = ''`\n https://www.afterwardsw3.org/TR/xml-names/#NT-doctypedecl\n `[16] doctypedecl ::= ''`\n var doctypedecl = reg('');\n*/\n\nvar CDATA_START = '';\nvar CDStart = //;\nvar CData = reg(Char, '*?', CDEnd);\n/*\n https://www.w3.org/TR/xml/#dt-cdsection\n `[18] \tCDSect\t ::= \tCDStart CData CDEnd`\n `[19] \tCDStart\t ::= \t'' Char*))`\n `[21] \tCDEnd\t ::= \t']]>'`\n*/\nvar CDSect = reg(CDStart, CData);\n\n// unit tested\nexports.chars = chars;\nexports.chars_without = chars_without;\nexports.detectUnicodeSupport = detectUnicodeSupport;\nexports.reg = reg;\nexports.regg = regg;\nexports.AttlistDecl = AttlistDecl;\nexports.CDATA_START = CDATA_START;\nexports.CDATA_END = CDATA_END;\nexports.CDSect = CDSect;\nexports.Char = Char;\nexports.Comment = Comment;\nexports.COMMENT_START = COMMENT_START;\nexports.COMMENT_END = COMMENT_END;\nexports.DOCTYPE_DECL_START = DOCTYPE_DECL_START;\nexports.elementdecl = elementdecl;\nexports.EntityDecl = EntityDecl;\nexports.EntityValue = EntityValue;\nexports.ExternalID = ExternalID;\nexports.ExternalID_match = ExternalID_match;\nexports.Name = Name;\nexports.NotationDecl = NotationDecl;\nexports.Reference = Reference;\nexports.PEReference = PEReference;\nexports.PI = PI;\nexports.PUBLIC = PUBLIC;\nexports.PubidLiteral = PubidLiteral;\nexports.QName = QName;\nexports.QName_exact = QName_exact;\nexports.QName_group = QName_group;\nexports.S = S;\nexports.SChar_s = SChar_s;\nexports.S_OPT = S_OPT;\nexports.SYSTEM = SYSTEM;\nexports.SystemLiteral = SystemLiteral;\nexports.UNICODE_REPLACEMENT_CHARACTER = UNICODE_REPLACEMENT_CHARACTER;\nexports.UNICODE_SUPPORT = UNICODE_SUPPORT;\nexports.XMLDecl = XMLDecl;\n","'use strict';\n\nvar conventions = require('./conventions');\nvar find = conventions.find;\nvar hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace;\nvar hasOwn = conventions.hasOwn;\nvar isHTMLMimeType = conventions.isHTMLMimeType;\nvar isHTMLRawTextElement = conventions.isHTMLRawTextElement;\nvar isHTMLVoidElement = conventions.isHTMLVoidElement;\nvar MIME_TYPE = conventions.MIME_TYPE;\nvar NAMESPACE = conventions.NAMESPACE;\n\n/**\n * Private DOM Constructor symbol\n *\n * Internal symbol used for construction of all classes whose constructors should be private.\n * Currently used for checks in `Node`, `Document`, `Element`, `Attr`, `CharacterData`, `Text`, `Comment`,\n * `CDATASection`, `DocumentType`, `Notation`, `Entity`, `EntityReference`, `DocumentFragment`, `ProcessingInstruction`\n * so the constructor can't be used from outside the module.\n */\nvar PDC = Symbol();\n\nvar errors = require('./errors');\nvar DOMException = errors.DOMException;\nvar DOMExceptionName = errors.DOMExceptionName;\n\nvar g = require('./grammar');\n\n/**\n * Checks if the given symbol equals the Private DOM Constructor symbol (PDC)\n * and throws an Illegal constructor exception when the symbols don't match.\n * This ensures that the constructor remains private and can't be used outside this module.\n */\nfunction checkSymbol(symbol) {\n\tif (symbol !== PDC) {\n\t\tthrow new TypeError('Illegal constructor');\n\t}\n}\n\n/**\n * A prerequisite for `[].filter`, to drop elements that are empty.\n *\n * @param {string} input\n * The string to be checked.\n * @returns {boolean}\n * Returns `true` if the input string is not empty, `false` otherwise.\n */\nfunction notEmptyString(input) {\n\treturn input !== '';\n}\n/**\n * Splits a string on ASCII whitespace characters (U+0009 TAB, U+000A LF, U+000C FF, U+000D CR,\n * U+0020 SPACE).\n * It follows the definition from the infra specification from WHATWG.\n *\n * @param {string} input\n * The string to be split.\n * @returns {string[]}\n * An array of the split strings. The array can be empty if the input string is empty or only\n * contains whitespace characters.\n * @see {@link https://infra.spec.whatwg.org/#split-on-ascii-whitespace}\n * @see {@link https://infra.spec.whatwg.org/#ascii-whitespace}\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 * The current record object to which the element will be added as a key.\n * The object's keys are string types and values are either boolean or undefined.\n * @param {string} element\n * The string to be added as a key to the current record.\n * @returns {Record}\n * The updated record object after the addition of the new element.\n */\nfunction orderedSetReducer(current, element) {\n\tif (!hasOwn(current, element)) {\n\t\tcurrent[element] = true;\n\t}\n\treturn current;\n}\n\n/**\n * Converts a string into an ordered set by splitting the input on ASCII whitespace and\n * ensuring uniqueness of elements.\n * This follows the definition of an ordered set from the infra specification by WHATWG.\n *\n * @param {string} input\n * The input string to be transformed into an ordered set.\n * @returns {string[]}\n * An array of unique strings obtained from the input, preserving the original order.\n * The array can be empty if the input string is empty or only contains whitespace characters.\n * @see {@link https://infra.spec.whatwg.org/#ordered-set}\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 a function that behaves like `Array.prototype.includes`.\n * This function is used in environments where `Array.prototype.includes` may not be available.\n *\n * @param {any[]} list\n * The array in which to search for the element.\n * @returns {function(any): boolean}\n * A function that accepts an element and returns a boolean indicating whether the element is\n * included in the provided list.\n */\nfunction arrayIncludes(list) {\n\treturn function (element) {\n\t\treturn list && list.indexOf(element) !== -1;\n\t};\n}\n\n/**\n * Validates a qualified name based on the criteria provided in the DOM specification by\n * WHATWG.\n *\n * @param {string} qualifiedName\n * The qualified name to be validated.\n * @throws {DOMException}\n * With code {@link DOMException.INVALID_CHARACTER_ERR} if the qualified name contains an\n * invalid character.\n * @see {@link https://dom.spec.whatwg.org/#validate}\n */\nfunction validateQualifiedName(qualifiedName) {\n\tif (!g.QName_exact.test(qualifiedName)) {\n\t\tthrow new DOMException(DOMException.INVALID_CHARACTER_ERR, 'invalid character in qualified name \"' + qualifiedName + '\"');\n\t}\n}\n\n/**\n * Validates a qualified name and the namespace associated with it,\n * based on the criteria provided in the DOM specification by WHATWG.\n *\n * @param {string | null} namespace\n * The namespace to be validated. It can be a string or null.\n * @param {string} qualifiedName\n * The qualified name to be validated.\n * @returns {[namespace: string | null, prefix: string | null, localName: string]}\n * Returns a tuple with the namespace,\n * prefix and local name of the qualified name.\n * @throws {DOMException}\n * Throws a DOMException if the qualified name or the namespace is not valid.\n * @see {@link https://dom.spec.whatwg.org/#validate-and-extract}\n */\nfunction validateAndExtract(namespace, qualifiedName) {\n\tvalidateQualifiedName(qualifiedName);\n\tnamespace = namespace || null;\n\t/**\n\t * @type {string | null}\n\t */\n\tvar prefix = null;\n\tvar localName = qualifiedName;\n\tif (qualifiedName.indexOf(':') >= 0) {\n\t\tvar splitResult = qualifiedName.split(':');\n\t\tprefix = splitResult[0];\n\t\tlocalName = splitResult[1];\n\t}\n\tif (prefix !== null && namespace === null) {\n\t\tthrow new DOMException(DOMException.NAMESPACE_ERR, 'prefix is non-null and namespace is null');\n\t}\n\tif (prefix === 'xml' && namespace !== conventions.NAMESPACE.XML) {\n\t\tthrow new DOMException(DOMException.NAMESPACE_ERR, 'prefix is \"xml\" and namespace is not the XML namespace');\n\t}\n\tif ((prefix === 'xmlns' || qualifiedName === 'xmlns') && namespace !== conventions.NAMESPACE.XMLNS) {\n\t\tthrow new DOMException(\n\t\t\tDOMException.NAMESPACE_ERR,\n\t\t\t'either qualifiedName or prefix is \"xmlns\" and namespace is not the XMLNS namespace'\n\t\t);\n\t}\n\tif (namespace === conventions.NAMESPACE.XMLNS && prefix !== 'xmlns' && qualifiedName !== 'xmlns') {\n\t\tthrow new DOMException(\n\t\t\tDOMException.NAMESPACE_ERR,\n\t\t\t'namespace is the XMLNS namespace and neither qualifiedName nor prefix is \"xmlns\"'\n\t\t);\n\t}\n\treturn [namespace, prefix, localName];\n}\n\n/**\n * Copies properties from one object to another.\n * It only copies the object's own (not inherited) properties.\n *\n * @param {Object} src\n * The source object from which properties are copied.\n * @param {Object} dest\n * The destination object to which properties are copied.\n */\nfunction copy(src, dest) {\n\tfor (var p in src) {\n\t\tif (hasOwn(src, p)) {\n\t\t\tdest[p] = src[p];\n\t\t}\n\t}\n}\n\n/**\n * Extends a class with the properties and methods of a super class.\n * It uses a form of prototypal inheritance, and establishes the `constructor` property\n * correctly(?).\n *\n * It is not clear to the current maintainers if this implementation is making sense,\n * since it creates an intermediate prototype function,\n * which all properties of `Super` are copied onto using `_copy`.\n *\n * @param {Object} Class\n * The class that is to be extended.\n * @param {Object} Super\n * The super class from which properties and methods are inherited.\n * @private\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\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\nvar DocumentPosition = conventions.freeze({\n\tDOCUMENT_POSITION_DISCONNECTED: 1,\n\tDOCUMENT_POSITION_PRECEDING: 2,\n\tDOCUMENT_POSITION_FOLLOWING: 4,\n\tDOCUMENT_POSITION_CONTAINS: 8,\n\tDOCUMENT_POSITION_CONTAINED_BY: 16,\n\tDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32,\n});\n\n//helper functions for compareDocumentPosition\n/**\n * Constructs a parent chain for a node.\n *\n * @param {Node} node\n * The start node from which the parent chain will be constructed.\n * @returns {Node[]}\n * The array of nodes representing the parent chain from the root to the specified node.\n */\nfunction parentChain(node) {\n\tvar chain = [];\n\twhile (node.parentNode || node.ownerElement) {\n\t\tnode = node.parentNode || node.ownerElement;\n\t\tchain.unshift(node);\n\t}\n\treturn chain;\n}\n\n/**\n * Finds the common ancestor in two parent chains.\n *\n * @param {Node[]} a\n * The first parent chain.\n * @param {Node[]} b\n * The second parent chain.\n * @returns {Node}\n * The common ancestor node if it exists. If there is no common ancestor, the function will\n * return `null`.\n */\nfunction commonAncestor(a, b) {\n\tif (b.length < a.length) return commonAncestor(b, a);\n\tvar c = null;\n\tfor (var n in a) {\n\t\tif (a[n] !== b[n]) return c;\n\t\tc = a[n];\n\t}\n\treturn c;\n}\n\n/**\n * Assigns a unique identifier to a document to ensure consistency while comparing unrelated\n * nodes.\n *\n * @param {Document} doc\n * The document to which a unique identifier is to be assigned.\n * @returns {string}\n * The unique identifier of the document. If the document already had a unique identifier, the\n * function will return the existing one.\n */\nfunction docGUID(doc) {\n\tif (!doc.guid) doc.guid = Math.random();\n\treturn doc.guid;\n}\n//-- end of helper functions\n\n/**\n * The NodeList interface provides the abstraction of an ordered collection of nodes,\n * without defining or constraining how this collection is implemented.\n * NodeList objects in the DOM are live.\n * The items in the NodeList are accessible via an integral index, starting from 0.\n * You can also access the items of the NodeList with a `for...of` loop.\n *\n * @class NodeList\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177\n * @constructs NodeList\n */\nfunction NodeList() {}\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\n\t * inclusive.\n\t *\n\t * @type {number}\n\t */\n\tlength: 0,\n\t/**\n\t * Returns the item at `index`. If index is greater than or equal to the number of nodes in\n\t * the list, this returns null.\n\t *\n\t * @param index\n\t * Unsigned long Index into the collection.\n\t * @returns {Node | null}\n\t * The node at position `index` in the NodeList,\n\t * or null if that is not a valid index.\n\t */\n\titem: function (index) {\n\t\treturn index >= 0 && index < this.length ? this[index] : null;\n\t},\n\t/**\n\t * Returns a string representation of the NodeList.\n\t *\n\t * @param {unknown} nodeFilter\n\t * __A filter function? Not implemented according to the spec?__.\n\t * @returns {string}\n\t * A string representation of the NodeList.\n\t */\n\ttoString: function (nodeFilter) {\n\t\tfor (var buf = [], i = 0; i < this.length; i++) {\n\t\t\tserializeToString(this[i], buf, nodeFilter);\n\t\t}\n\t\treturn buf.join('');\n\t},\n\t/**\n\t * Filters the NodeList based on a predicate.\n\t *\n\t * @param {function(Node): boolean} predicate\n\t * - A predicate function to filter the NodeList.\n\t * @returns {Node[]}\n\t * An array of nodes that satisfy the predicate.\n\t * @private\n\t */\n\tfilter: function (predicate) {\n\t\treturn Array.prototype.filter.call(this, predicate);\n\t},\n\t/**\n\t * Returns the first index at which a given node can be found in the NodeList, or -1 if it is\n\t * not present.\n\t *\n\t * @param {Node} item\n\t * - The Node item to locate in the NodeList.\n\t * @returns {number}\n\t * The first index of the node in the NodeList; -1 if not found.\n\t * @private\n\t */\n\tindexOf: function (item) {\n\t\treturn Array.prototype.indexOf.call(this, item);\n\t},\n};\nNodeList.prototype[Symbol.iterator] = function () {\n\tvar me = this;\n\tvar index = 0;\n\n\treturn {\n\t\tnext: function () {\n\t\t\tif (index < me.length) {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: me[index++],\n\t\t\t\t\tdone: false,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\treturn: function () {\n\t\t\treturn {\n\t\t\t\tdone: true,\n\t\t\t};\n\t\t},\n\t};\n};\n\n/**\n * Represents a live collection of nodes that is automatically updated when its associated\n * document changes.\n *\n * @class LiveNodeList\n * @param {Node} node\n * The associated node.\n * @param {function} refresh\n * The function to refresh the live node list.\n * @augments NodeList\n * @constructs LiveNodeList\n */\nfunction LiveNodeList(node, refresh) {\n\tthis._node = node;\n\tthis._refresh = refresh;\n\t_updateLiveList(this);\n}\n/**\n * Updates the live node list.\n *\n * @param {LiveNodeList} list\n * The live node list to update.\n * @private\n */\nfunction _updateLiveList(list) {\n\tvar inc = list._node._inc || list._node.ownerDocument._inc;\n\tif (list._inc !== inc) {\n\t\tvar ls = list._refresh(list._node);\n\t\t__set__(list, 'length', ls.length);\n\t\tif (!list.$$length || ls.length < list.$$length) {\n\t\t\tfor (var i = ls.length; i in list; i++) {\n\t\t\t\tif (hasOwn(list, i)) {\n\t\t\t\t\tdelete list[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcopy(ls, list);\n\t\tlist._inc = inc;\n\t}\n}\n/**\n * Returns the node at position `index` in the LiveNodeList, or null if that is not a valid\n * index.\n *\n * @param {number} i\n * Index into the collection.\n * @returns {Node | null}\n * The node at position `index` in the LiveNodeList, or null if that is not a valid index.\n */\nLiveNodeList.prototype.item = function (i) {\n\t_updateLiveList(this);\n\treturn this[i] || null;\n};\n\n_extends(LiveNodeList, NodeList);\n\n/**\n * Objects implementing the NamedNodeMap interface are used to represent collections of nodes\n * that can be accessed by name.\n * Note that NamedNodeMap does not inherit from NodeList;\n * NamedNodeMaps are not maintained in any particular order.\n * Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal\n * index,\n * but this is simply to allow convenient enumeration of the contents of a NamedNodeMap,\n * and does not imply that the DOM specifies an order to these Nodes.\n * NamedNodeMap objects in the DOM are live.\n * used for attributes or DocumentType entities\n *\n * This implementation only supports property indices, but does not support named properties,\n * as specified in the living standard.\n *\n * @class NamedNodeMap\n * @see https://dom.spec.whatwg.org/#interface-namednodemap\n * @see https://webidl.spec.whatwg.org/#dfn-supported-property-names\n * @constructs NamedNodeMap\n */\nfunction NamedNodeMap() {}\n/**\n * Returns the index of a node within the list.\n *\n * @param {Array} list\n * The list of nodes.\n * @param {Node} node\n * The node to find.\n * @returns {number}\n * The index of the node within the list, or -1 if not found.\n * @private\n */\nfunction _findNodeIndex(list, node) {\n\tvar i = 0;\n\twhile (i < list.length) {\n\t\tif (list[i] === node) {\n\t\t\treturn i;\n\t\t}\n\t\ti++;\n\t}\n}\n/**\n * Adds a new attribute to the list and updates the owner element of the attribute.\n *\n * @param {Element} el\n * The element which will become the owner of the new attribute.\n * @param {NamedNodeMap} list\n * The list to which the new attribute will be added.\n * @param {Attr} newAttr\n * The new attribute to be added.\n * @param {Attr} oldAttr\n * The old attribute to be replaced, or null if no attribute is to be replaced.\n * @returns {void}\n * @private\n */\nfunction _addNamedNode(el, list, newAttr, oldAttr) {\n\tif (oldAttr) {\n\t\tlist[_findNodeIndex(list, oldAttr)] = newAttr;\n\t} else {\n\t\tlist[list.length] = newAttr;\n\t\tlist.length++;\n\t}\n\tif (el) {\n\t\tnewAttr.ownerElement = el;\n\t\tvar doc = el.ownerDocument;\n\t\tif (doc) {\n\t\t\toldAttr && _onRemoveAttribute(doc, el, oldAttr);\n\t\t\t_onAddAttribute(doc, el, newAttr);\n\t\t}\n\t}\n}\n/**\n * Removes an attribute from the list and updates the owner element of the attribute.\n *\n * @param {Element} el\n * The element which is the current owner of the attribute.\n * @param {NamedNodeMap} list\n * The list from which the attribute will be removed.\n * @param {Attr} attr\n * The attribute to be removed.\n * @returns {void}\n * @private\n */\nfunction _removeNamedNode(el, list, attr) {\n\t//console.log('remove attr:'+attr)\n\tvar i = _findNodeIndex(list, attr);\n\tif (i >= 0) {\n\t\tvar lastIndex = list.length - 1;\n\t\twhile (i <= lastIndex) {\n\t\t\tlist[i] = list[++i];\n\t\t}\n\t\tlist.length = lastIndex;\n\t\tif (el) {\n\t\t\tvar doc = el.ownerDocument;\n\t\t\tif (doc) {\n\t\t\t\t_onRemoveAttribute(doc, el, attr);\n\t\t\t}\n\t\t\tattr.ownerElement = null;\n\t\t}\n\t}\n}\nNamedNodeMap.prototype = {\n\tlength: 0,\n\titem: NodeList.prototype.item,\n\n\t/**\n\t * Get an attribute by name. Note: Name is in lower case in case of HTML namespace and\n\t * document.\n\t *\n\t * @param {string} localName\n\t * The local name of the attribute.\n\t * @returns {Attr | null}\n\t * The attribute with the given local name, or null if no such attribute exists.\n\t * @see https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name\n\t */\n\tgetNamedItem: function (localName) {\n\t\tif (this._ownerElement && this._ownerElement._isInHTMLDocumentAndNamespace()) {\n\t\t\tlocalName = localName.toLowerCase();\n\t\t}\n\t\tvar i = 0;\n\t\twhile (i < this.length) {\n\t\t\tvar attr = this[i];\n\t\t\tif (attr.nodeName === localName) {\n\t\t\t\treturn attr;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\treturn null;\n\t},\n\n\t/**\n\t * Set an attribute.\n\t *\n\t * @param {Attr} attr\n\t * The attribute to set.\n\t * @returns {Attr | null}\n\t * The old attribute with the same local name and namespace URI as the new one, or null if no\n\t * such attribute exists.\n\t * @throws {DOMException}\n\t * With code:\n\t * - {@link INUSE_ATTRIBUTE_ERR} - If the attribute is already an attribute of another\n\t * element.\n\t * @see https://dom.spec.whatwg.org/#concept-element-attributes-set\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(DOMException.INUSE_ATTRIBUTE_ERR);\n\t\t}\n\t\tvar oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);\n\t\tif (oldAttr === attr) {\n\t\t\treturn attr;\n\t\t}\n\t\t_addNamedNode(this._ownerElement, this, attr, oldAttr);\n\t\treturn oldAttr;\n\t},\n\n\t/**\n\t * Set an attribute, replacing an existing attribute with the same local name and namespace\n\t * URI if one exists.\n\t *\n\t * @param {Attr} attr\n\t * The attribute to set.\n\t * @returns {Attr | null}\n\t * The old attribute with the same local name and namespace URI as the new one, or null if no\n\t * such attribute exists.\n\t * @throws {DOMException}\n\t * Throws a DOMException with the name \"InUseAttributeError\" if the attribute is already an\n\t * attribute of another element.\n\t * @see https://dom.spec.whatwg.org/#concept-element-attributes-set\n\t */\n\tsetNamedItemNS: function (attr) {\n\t\treturn this.setNamedItem(attr);\n\t},\n\n\t/**\n\t * Removes an attribute specified by the local name.\n\t *\n\t * @param {string} localName\n\t * The local name of the attribute to be removed.\n\t * @returns {Attr}\n\t * The attribute node that was removed.\n\t * @throws {DOMException}\n\t * With code:\n\t * - {@link DOMException.NOT_FOUND_ERR} if no attribute with the given name is found.\n\t * @see https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem\n\t * @see https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-name\n\t */\n\tremoveNamedItem: function (localName) {\n\t\tvar attr = this.getNamedItem(localName);\n\t\tif (!attr) {\n\t\t\tthrow new DOMException(DOMException.NOT_FOUND_ERR, localName);\n\t\t}\n\t\t_removeNamedNode(this._ownerElement, this, attr);\n\t\treturn attr;\n\t},\n\n\t/**\n\t * Removes an attribute specified by the namespace and local name.\n\t *\n\t * @param {string | null} namespaceURI\n\t * The namespace URI of the attribute to be removed.\n\t * @param {string} localName\n\t * The local name of the attribute to be removed.\n\t * @returns {Attr}\n\t * The attribute node that was removed.\n\t * @throws {DOMException}\n\t * With code:\n\t * - {@link DOMException.NOT_FOUND_ERR} if no attribute with the given namespace URI and local\n\t * name is found.\n\t * @see https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns\n\t * @see https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-namespace\n\t */\n\tremoveNamedItemNS: function (namespaceURI, localName) {\n\t\tvar attr = this.getNamedItemNS(namespaceURI, localName);\n\t\tif (!attr) {\n\t\t\tthrow new DOMException(DOMException.NOT_FOUND_ERR, namespaceURI ? namespaceURI + ' : ' + localName : localName);\n\t\t}\n\t\t_removeNamedNode(this._ownerElement, this, attr);\n\t\treturn attr;\n\t},\n\n\t/**\n\t * Get an attribute by namespace and local name.\n\t *\n\t * @param {string | null} namespaceURI\n\t * The namespace URI of the attribute.\n\t * @param {string} localName\n\t * The local name of the attribute.\n\t * @returns {Attr | null}\n\t * The attribute with the given namespace URI and local name, or null if no such attribute\n\t * exists.\n\t * @see https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace\n\t */\n\tgetNamedItemNS: function (namespaceURI, localName) {\n\t\tif (!namespaceURI) {\n\t\t\tnamespaceURI = null;\n\t\t}\n\t\tvar i = 0;\n\t\twhile (i < this.length) {\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\ti++;\n\t\t}\n\t\treturn null;\n\t},\n};\nNamedNodeMap.prototype[Symbol.iterator] = function () {\n\tvar me = this;\n\tvar index = 0;\n\n\treturn {\n\t\tnext: function () {\n\t\t\tif (index < me.length) {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: me[index++],\n\t\t\t\t\tdone: false,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\treturn: function () {\n\t\t\treturn {\n\t\t\t\tdone: true,\n\t\t\t};\n\t\t},\n\t};\n};\n\n/**\n * The DOMImplementation interface provides a number of methods for performing operations that\n * are independent of any particular instance of the document object model.\n *\n * The DOMImplementation interface represents an object providing methods which are not\n * 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 * @class DOMImplementation\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\n * (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 * @constructs DOMImplementation\n */\nfunction DOMImplementation() {}\n\nDOMImplementation.prototype = {\n\t/**\n\t * Test if the DOM implementation implements a specific feature and version, as specified in\n\t * {@link https://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures DOM Features}.\n\t *\n\t * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given\n\t * feature is supported. The different implementations fairly diverged in what kind of\n\t * features were reported. The latest version of the spec settled to force this method to\n\t * always return true, where the functionality was accurate and in use.\n\t *\n\t * @deprecated\n\t * It is deprecated and modern browsers return true in all cases.\n\t * @function DOMImplementation#hasFeature\n\t * @param {string} feature\n\t * The name of the feature to test.\n\t * @param {string} [version]\n\t * This is the version number of the feature to test.\n\t * @returns {boolean}\n\t * Always returns true.\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 * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-5CED94D7 DOM Level 3 Core\n\t */\n\thasFeature: function (feature, version) {\n\t\treturn true;\n\t},\n\t/**\n\t * Creates a DOM Document object of the specified type with its document element. Note that\n\t * based on the {@link DocumentType}\n\t * given to create the document, the implementation may instantiate specialized\n\t * {@link Document} objects that support additional features than the \"Core\", such as \"HTML\"\n\t * {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#DOM2HTML DOM Level 2 HTML}.\n\t * On the other hand, setting the {@link DocumentType} after the document was created makes\n\t * this very unlikely to happen. Alternatively, specialized {@link Document} creation methods,\n\t * such as createHTMLDocument\n\t * {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#DOM2HTML DOM Level 2 HTML},\n\t * can be used to obtain specific types of {@link Document} objects.\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`\n\t * instance (with it's `type` set to `'xml'`).\n\t * - `encoding`, `mode`, `origin`, `url` fields are currently not declared.\n\t *\n\t * @function DOMImplementation.createDocument\n\t * @param {string | null} namespaceURI\n\t * The\n\t * {@link https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-namespaceURI namespace URI}\n\t * of the document element to create or null.\n\t * @param {string | null} qualifiedName\n\t * The\n\t * {@link https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-qualifiedname qualified name}\n\t * of the document element to be created or null.\n\t * @param {DocumentType | null} [doctype=null]\n\t * The type of document to be created or null. When doctype is not null, its\n\t * {@link Node#ownerDocument} attribute is set to the document being created. Default is\n\t * `null`\n\t * @returns {Document}\n\t * A new {@link Document} object with its document element. If the NamespaceURI,\n\t * qualifiedName, and doctype are null, the returned {@link Document} is empty with no\n\t * document element.\n\t * @throws {DOMException}\n\t * With code:\n\t *\n\t * - `INVALID_CHARACTER_ERR`: Raised if the specified qualified name is not an XML name\n\t * according to {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#XML XML 1.0}.\n\t * - `NAMESPACE_ERR`: Raised if the qualifiedName is malformed, if the qualifiedName has a\n\t * prefix and the namespaceURI is null, or if the qualifiedName is null and the namespaceURI\n\t * is different from null, or if the qualifiedName has a prefix that is \"xml\" and the\n\t * namespaceURI is different from \"{@link http://www.w3.org/XML/1998/namespace}\"\n\t * {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#Namespaces XML Namespaces},\n\t * or if the DOM implementation does not support the \"XML\" feature but a non-null namespace\n\t * URI was provided, since namespaces were defined by XML.\n\t * - `WRONG_DOCUMENT_ERR`: Raised if doctype has already been used with a different document\n\t * or was created from a different implementation.\n\t * - `NOT_SUPPORTED_ERR`: May be raised if the implementation does not support the feature\n\t * \"XML\" and the language exposed through the Document does not support XML Namespaces (such\n\t * as {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#HTML40 HTML 4.01}).\n\t * @since DOM Level 2.\n\t * @see {@link #createHTMLDocument}\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Living Standard\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Level-2-Core-DOM-createDocument DOM\n\t * Level 3 Core\n\t * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM\n\t * Level 2 Core (initial)\n\t */\n\tcreateDocument: function (namespaceURI, qualifiedName, doctype) {\n\t\tvar contentType = MIME_TYPE.XML_APPLICATION;\n\t\tif (namespaceURI === NAMESPACE.HTML) {\n\t\t\tcontentType = MIME_TYPE.XML_XHTML_APPLICATION;\n\t\t} else if (namespaceURI === NAMESPACE.SVG) {\n\t\t\tcontentType = MIME_TYPE.XML_SVG_IMAGE;\n\t\t}\n\t\tvar doc = new Document(PDC, { contentType: contentType });\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 * Creates an empty DocumentType node. Entity declarations and notations are not made\n\t * available. Entity reference expansions and default attribute additions do not occur.\n\t *\n\t * **This behavior is slightly different from the one in the specs**:\n\t * - `encoding`, `mode`, `origin`, `url` fields are currently not declared.\n\t * - `publicId` and `systemId` contain the raw data including any possible quotes,\n\t * so they can always be serialized back to the original value\n\t * - `internalSubset` contains the raw string between `[` and `]` if present,\n\t * but is not parsed or validated in any form.\n\t *\n\t * @function DOMImplementation#createDocumentType\n\t * @param {string} qualifiedName\n\t * The {@link https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-qualifiedname qualified\n\t * name} of the document type to be created.\n\t * @param {string} [publicId]\n\t * The external subset public identifier.\n\t * @param {string} [systemId]\n\t * The external subset system identifier.\n\t * @param {string} [internalSubset]\n\t * the internal subset or an empty string if it is not present\n\t * @returns {DocumentType}\n\t * A new {@link DocumentType} node with {@link Node#ownerDocument} set to null.\n\t * @throws {DOMException}\n\t * With code:\n\t *\n\t * - `INVALID_CHARACTER_ERR`: Raised if the specified qualified name is not an XML name\n\t * according to {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#XML XML 1.0}.\n\t * - `NAMESPACE_ERR`: Raised if the qualifiedName is malformed.\n\t * - `NOT_SUPPORTED_ERR`: May be raised if the implementation does not support the feature\n\t * \"XML\" and the language exposed through the Document does not support XML Namespaces (such\n\t * as {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#HTML40 HTML 4.01}).\n\t * @since DOM Level 2.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType\n\t * MDN\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living\n\t * Standard\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Level-3-Core-DOM-createDocType DOM\n\t * Level 3 Core\n\t * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM\n\t * Level 2 Core\n\t * @see https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md#050\n\t * @see https://www.w3.org/TR/DOM-Level-2-Core/#core-ID-Core-DocType-internalSubset\n\t * @prettierignore\n\t */\n\tcreateDocumentType: function (qualifiedName, publicId, systemId, internalSubset) {\n\t\tvalidateQualifiedName(qualifiedName);\n\t\tvar node = new DocumentType(PDC);\n\t\tnode.name = qualifiedName;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.publicId = publicId || '';\n\t\tnode.systemId = systemId || '';\n\t\tnode.internalSubset = internalSubset || '';\n\t\tnode.childNodes = new NodeList();\n\n\t\treturn node;\n\t},\n\t/**\n\t * Returns an HTML document, that might already have a basic DOM structure.\n\t *\n\t * __It behaves slightly different from the description in the living standard__:\n\t * - If the first argument is `false` no initial nodes are added (steps 3-7 in the specs are\n\t * omitted)\n\t * - `encoding`, `mode`, `origin`, `url` fields are currently not declared.\n\t *\n\t * @param {string | false} [title]\n\t * A string containing the title to give the new HTML document.\n\t * @returns {Document}\n\t * The HTML document.\n\t * @since WHATWG Living Standard.\n\t * @see {@link #createDocument}\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument\n\t * @see https://dom.spec.whatwg.org/#html-document\n\t */\n\tcreateHTMLDocument: function (title) {\n\t\tvar doc = new Document(PDC, { contentType: MIME_TYPE.HTML });\n\t\tdoc.implementation = this;\n\t\tdoc.childNodes = new NodeList();\n\t\tif (title !== false) {\n\t\t\tdoc.doctype = this.createDocumentType('html');\n\t\t\tdoc.doctype.ownerDocument = doc;\n\t\t\tdoc.appendChild(doc.doctype);\n\t\t\tvar htmlNode = doc.createElement('html');\n\t\t\tdoc.appendChild(htmlNode);\n\t\t\tvar headNode = doc.createElement('head');\n\t\t\thtmlNode.appendChild(headNode);\n\t\t\tif (typeof title === 'string') {\n\t\t\t\tvar titleNode = doc.createElement('title');\n\t\t\t\ttitleNode.appendChild(doc.createTextNode(title));\n\t\t\t\theadNode.appendChild(titleNode);\n\t\t\t}\n\t\t\thtmlNode.appendChild(doc.createElement('body'));\n\t\t}\n\t\treturn doc;\n\t},\n};\n\n/**\n * The DOM Node interface is an abstract base class upon which many other DOM API objects are\n * based, thus letting those object types to be used similarly and often interchangeably. As an\n * abstract class, there is no such thing as a plain Node object. All objects that implement\n * Node functionality are based on one of its subclasses. Most notable are Document, Element,\n * and DocumentFragment.\n *\n * In addition, every kind of DOM node is represented by an interface based on Node. These\n * include Attr, CharacterData (which Text, Comment, CDATASection and ProcessingInstruction are\n * all based on), and DocumentType.\n *\n * In some cases, a particular feature of the base Node interface may not apply to one of its\n * child interfaces; in that case, the inheriting node may return null or throw an exception,\n * depending on circumstances. For example, attempting to add children to a node type that\n * cannot have children will throw an exception.\n *\n * **This behavior is slightly different from the in the specs**:\n * - unimplemented interfaces: `EventTarget`\n *\n * @class\n * @abstract\n * @param {Symbol} symbol\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247\n * @see https://dom.spec.whatwg.org/#node\n * @prettierignore\n */\nfunction Node(symbol) {\n\tcheckSymbol(symbol);\n}\n\nNode.prototype = {\n\t/**\n\t * The first child of this node.\n\t *\n\t * @type {Node | null}\n\t */\n\tfirstChild: null,\n\t/**\n\t * The last child of this node.\n\t *\n\t * @type {Node | null}\n\t */\n\tlastChild: null,\n\t/**\n\t * The previous sibling of this node.\n\t *\n\t * @type {Node | null}\n\t */\n\tpreviousSibling: null,\n\t/**\n\t * The next sibling of this node.\n\t *\n\t * @type {Node | null}\n\t */\n\tnextSibling: null,\n\t/**\n\t * The parent node of this node.\n\t *\n\t * @type {Node | null}\n\t */\n\tparentNode: null,\n\t/**\n\t * The parent element of this node.\n\t *\n\t * @type {Element | null}\n\t */\n\tget parentElement() {\n\t\treturn this.parentNode && this.parentNode.nodeType === this.ELEMENT_NODE ? this.parentNode : null;\n\t},\n\t/**\n\t * The child nodes of this node.\n\t *\n\t * @type {NodeList}\n\t */\n\tchildNodes: null,\n\t/**\n\t * The document object associated with this node.\n\t *\n\t * @type {Document | null}\n\t */\n\townerDocument: null,\n\t/**\n\t * The value of this node.\n\t *\n\t * @type {string | null}\n\t */\n\tnodeValue: null,\n\t/**\n\t * The namespace URI of this node.\n\t *\n\t * @type {string | null}\n\t */\n\tnamespaceURI: null,\n\t/**\n\t * The prefix of the namespace for this node.\n\t *\n\t * @type {string | null}\n\t */\n\tprefix: null,\n\t/**\n\t * The local part of the qualified name of this node.\n\t *\n\t * @type {string | null}\n\t */\n\tlocalName: null,\n\t/**\n\t * The baseURI is currently always `about:blank`,\n\t * since that's what happens when you create a document from scratch.\n\t *\n\t * @type {'about:blank'}\n\t */\n\tbaseURI: 'about:blank',\n\t/**\n\t * Is true if this node is part of a document.\n\t *\n\t * @type {boolean}\n\t */\n\tget isConnected() {\n\t\tvar rootNode = this.getRootNode();\n\t\treturn rootNode && rootNode.nodeType === rootNode.DOCUMENT_NODE;\n\t},\n\t/**\n\t * Checks whether `other` is an inclusive descendant of this node.\n\t *\n\t * @param {Node | null | undefined} other\n\t * The node to check.\n\t * @returns {boolean}\n\t * True if `other` is an inclusive descendant of this node; false otherwise.\n\t * @see https://dom.spec.whatwg.org/#dom-node-contains\n\t */\n\tcontains: function (other) {\n\t\tif (!other) return false;\n\t\tvar parent = other;\n\t\tdo {\n\t\t\tif (this === parent) return true;\n\t\t\tparent = other.parentNode;\n\t\t} while (parent);\n\t\treturn false;\n\t},\n\t/**\n\t * @typedef GetRootNodeOptions\n\t * @property {boolean} [composed=false]\n\t */\n\t/**\n\t * Searches for the root node of this node.\n\t *\n\t * **This behavior is slightly different from the in the specs**:\n\t * - ignores `options.composed`, since `ShadowRoot`s are unsupported, always returns root.\n\t *\n\t * @param {GetRootNodeOptions} [options]\n\t * @returns {Node}\n\t * Root node.\n\t * @see https://dom.spec.whatwg.org/#dom-node-getrootnode\n\t * @see https://dom.spec.whatwg.org/#concept-shadow-including-root\n\t */\n\tgetRootNode: function (options) {\n\t\tvar parent = this;\n\t\tdo {\n\t\t\tif (!parent.parentNode) {\n\t\t\t\treturn parent;\n\t\t\t}\n\t\t\tparent = parent.parentNode;\n\t\t} while (parent);\n\t},\n\t/**\n\t * Checks whether the given node is equal to this node.\n\t *\n\t * @param {Node} [otherNode]\n\t * @see https://dom.spec.whatwg.org/#concept-node-equals\n\t */\n\tisEqualNode: function (otherNode) {\n\t\tif (!otherNode) return false;\n\n\t\tif (this.nodeType !== otherNode.nodeType) return false;\n\n\t\tswitch (this.nodeType) {\n\t\t\tcase this.DOCUMENT_TYPE_NODE:\n\t\t\t\tif (this.name !== otherNode.name) return false;\n\t\t\t\tif (this.publicId !== otherNode.publicId) return false;\n\t\t\t\tif (this.systemId !== otherNode.systemId) return false;\n\t\t\t\tbreak;\n\t\t\tcase this.ELEMENT_NODE:\n\t\t\t\tif (this.namespaceURI !== otherNode.namespaceURI) return false;\n\t\t\t\tif (this.prefix !== otherNode.prefix) return false;\n\t\t\t\tif (this.localName !== otherNode.localName) return false;\n\t\t\t\tif (this.attributes.length !== otherNode.attributes.length) return false;\n\t\t\t\tfor (var i = 0; i < this.attributes.length; i++) {\n\t\t\t\t\tvar attr = this.attributes.item(i);\n\t\t\t\t\tif (!attr.isEqualNode(otherNode.getAttributeNodeNS(attr.namespaceURI, attr.localName))) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase this.ATTRIBUTE_NODE:\n\t\t\t\tif (this.namespaceURI !== otherNode.namespaceURI) return false;\n\t\t\t\tif (this.localName !== otherNode.localName) return false;\n\t\t\t\tif (this.value !== otherNode.value) return false;\n\n\t\t\t\tbreak;\n\t\t\tcase this.PROCESSING_INSTRUCTION_NODE:\n\t\t\t\tif (this.target !== otherNode.target || this.data !== otherNode.data) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase this.TEXT_NODE:\n\t\t\tcase this.COMMENT_NODE:\n\t\t\t\tif (this.data !== otherNode.data) return false;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (this.childNodes.length !== otherNode.childNodes.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (var i = 0; i < this.childNodes.length; i++) {\n\t\t\tif (!this.childNodes[i].isEqualNode(otherNode.childNodes[i])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t},\n\t/**\n\t * Checks whether or not the given node is this node.\n\t *\n\t * @param {Node} [otherNode]\n\t */\n\tisSameNode: function (otherNode) {\n\t\treturn this === otherNode;\n\t},\n\t/**\n\t * Inserts a node before a reference node as a child of this node.\n\t *\n\t * @param {Node} newChild\n\t * The new child node to be inserted.\n\t * @param {Node | null} refChild\n\t * The reference node before which newChild will be inserted.\n\t * @returns {Node}\n\t * The new child node successfully inserted.\n\t * @throws {DOMException}\n\t * Throws a DOMException if inserting the node would result in a DOM tree that is not\n\t * well-formed, or if `child` is provided but is not a child of `parent`.\n\t * See {@link _insertBefore} for more details.\n\t * @since Modified in DOM L2\n\t */\n\tinsertBefore: function (newChild, refChild) {\n\t\treturn _insertBefore(this, newChild, refChild);\n\t},\n\t/**\n\t * Replaces an old child node with a new child node within this node.\n\t *\n\t * @param {Node} newChild\n\t * The new node that is to replace the old node.\n\t * If it already exists in the DOM, it is removed from its original position.\n\t * @param {Node} oldChild\n\t * The existing child node to be replaced.\n\t * @returns {Node}\n\t * Returns the replaced child node.\n\t * @throws {DOMException}\n\t * Throws a DOMException if replacing the node would result in a DOM tree that is not\n\t * well-formed, or if `oldChild` is not a child of `this`.\n\t * This can also occur if the pre-replacement validity assertion fails.\n\t * See {@link _insertBefore}, {@link Node.removeChild}, and\n\t * {@link assertPreReplacementValidityInDocument} for more details.\n\t * @see https://dom.spec.whatwg.org/#concept-node-replace\n\t */\n\treplaceChild: function (newChild, oldChild) {\n\t\t_insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);\n\t\tif (oldChild) {\n\t\t\tthis.removeChild(oldChild);\n\t\t}\n\t},\n\t/**\n\t * Removes an existing child node from this node.\n\t *\n\t * @param {Node} oldChild\n\t * The child node to be removed.\n\t * @returns {Node}\n\t * Returns the removed child node.\n\t * @throws {DOMException}\n\t * Throws a DOMException if `oldChild` is not a child of `this`.\n\t * See {@link _removeChild} for more details.\n\t */\n\tremoveChild: function (oldChild) {\n\t\treturn _removeChild(this, oldChild);\n\t},\n\t/**\n\t * Appends a child node to this node.\n\t *\n\t * @param {Node} newChild\n\t * The child node to be appended to this node.\n\t * If it already exists in the DOM, it is removed from its original position.\n\t * @returns {Node}\n\t * Returns the appended child node.\n\t * @throws {DOMException}\n\t * Throws a DOMException if appending the node would result in a DOM tree that is not\n\t * well-formed, or if `newChild` is not a valid Node.\n\t * See {@link insertBefore} for more details.\n\t */\n\tappendChild: function (newChild) {\n\t\treturn this.insertBefore(newChild, null);\n\t},\n\t/**\n\t * Determines whether this node has any child nodes.\n\t *\n\t * @returns {boolean}\n\t * Returns true if this node has any child nodes, and false otherwise.\n\t */\n\thasChildNodes: function () {\n\t\treturn this.firstChild != null;\n\t},\n\t/**\n\t * Creates a copy of the calling node.\n\t *\n\t * @param {boolean} deep\n\t * If true, the contents of the node are recursively copied.\n\t * If false, only the node itself (and its attributes, if it is an element) are copied.\n\t * @returns {Node}\n\t * Returns the newly created copy of the node.\n\t * @throws {DOMException}\n\t * May throw a DOMException if operations within {@link Element#setAttributeNode} or\n\t * {@link Node#appendChild} (which are potentially invoked in this method) do not meet their\n\t * specific constraints.\n\t * @see {@link cloneNode}\n\t */\n\tcloneNode: function (deep) {\n\t\treturn cloneNode(this.ownerDocument || this, this, deep);\n\t},\n\t/**\n\t * Puts the specified node and all of its subtree into a \"normalized\" form. In a normalized\n\t * subtree, no text nodes in the subtree are empty and there are no adjacent text nodes.\n\t *\n\t * Specifically, this method merges any adjacent text nodes (i.e., nodes for which `nodeType`\n\t * is `TEXT_NODE`) into a single node with the combined data. It also removes any empty text\n\t * nodes.\n\t *\n\t * This method operates recursively, so it also normalizes any and all descendent nodes within\n\t * the subtree.\n\t *\n\t * @throws {DOMException}\n\t * May throw a DOMException if operations within removeChild or appendData (which are\n\t * potentially invoked in this method) do not meet their specific constraints.\n\t * @since Modified in DOM Level 2\n\t * @see {@link Node.removeChild}\n\t * @see {@link CharacterData.appendData}\n\t */\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/**\n\t * Checks whether the DOM implementation implements a specific feature and its version.\n\t *\n\t * @deprecated\n\t * Since `DOMImplementation.hasFeature` is deprecated and always returns true.\n\t * @param {string} feature\n\t * The package name of the feature to test. This is the same name that can be passed to the\n\t * method `hasFeature` on `DOMImplementation`.\n\t * @param {string} version\n\t * This is the version number of the package name to test.\n\t * @returns {boolean}\n\t * Returns true in all cases in the current implementation.\n\t * @since Introduced in DOM Level 2\n\t * @see {@link DOMImplementation.hasFeature}\n\t */\n\tisSupported: function (feature, version) {\n\t\treturn this.ownerDocument.implementation.hasFeature(feature, version);\n\t},\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 * **This behavior is different from the in the specs**:\n\t * - no node type specific handling\n\t * - uses the internal attribute _nsMap for resolving namespaces that is updated when changing attributes\n\t *\n\t * @param {string | null} namespaceURI\n\t * The namespace URI for which to find the associated prefix.\n\t * @returns {string | null}\n\t * The associated prefix, if found; otherwise, 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 * @prettierignore\n\t */\n\tlookupPrefix: function (namespaceURI) {\n\t\tvar el = this;\n\t\twhile (el) {\n\t\t\tvar map = el._nsMap;\n\t\t\t//console.dir(map)\n\t\t\tif (map) {\n\t\t\t\tfor (var n in map) {\n\t\t\t\t\tif (hasOwn(map, n) && map[n] === namespaceURI) {\n\t\t\t\t\t\treturn n;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tel = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;\n\t\t}\n\t\treturn null;\n\t},\n\t/**\n\t * This function is used to look up the namespace URI associated with the given prefix,\n\t * starting from this node.\n\t *\n\t * **This behavior is different from the in the specs**:\n\t * - no node type specific handling\n\t * - uses the internal attribute _nsMap for resolving namespaces that is updated when changing attributes\n\t *\n\t * @param {string | null} prefix\n\t * The prefix for which to find the associated namespace URI.\n\t * @returns {string | null}\n\t * The associated namespace URI, if found; otherwise, null.\n\t * @since DOM Level 3\n\t * @see https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI\n\t * @prettierignore\n\t */\n\tlookupNamespaceURI: function (prefix) {\n\t\tvar el = this;\n\t\twhile (el) {\n\t\t\tvar map = el._nsMap;\n\t\t\t//console.dir(map)\n\t\t\tif (map) {\n\t\t\t\tif (hasOwn(map, prefix)) {\n\t\t\t\t\treturn map[prefix];\n\t\t\t\t}\n\t\t\t}\n\t\t\tel = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;\n\t\t}\n\t\treturn null;\n\t},\n\t/**\n\t * Determines whether the given namespace URI is the default namespace.\n\t *\n\t * The function works by looking up the prefix associated with the given namespace URI. If no\n\t * prefix is found (i.e., the namespace URI is not registered in the namespace map of this\n\t * node or any of its ancestors), it returns `true`, implying the namespace URI is considered\n\t * the default.\n\t *\n\t * **This behavior is different from the in the specs**:\n\t * - no node type specific handling\n\t * - uses the internal attribute _nsMap for resolving namespaces that is updated when changing attributes\n\t *\n\t * @param {string | null} namespaceURI\n\t * The namespace URI to be checked.\n\t * @returns {boolean}\n\t * Returns true if the given namespace URI is the default namespace, false otherwise.\n\t * @since DOM Level 3\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isDefaultNamespace\n\t * @see https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace\n\t * @prettierignore\n\t */\n\tisDefaultNamespace: function (namespaceURI) {\n\t\tvar prefix = this.lookupPrefix(namespaceURI);\n\t\treturn prefix == null;\n\t},\n\t/**\n\t * Compares the reference node with a node with regard to their position in the document and\n\t * according to the document order.\n\t *\n\t * @param {Node} other\n\t * The node to compare the reference node to.\n\t * @returns {number}\n\t * Returns how the node is positioned relatively to the reference node according to the\n\t * bitmask. 0 if reference node and given node are the same.\n\t * @since DOM Level 3\n\t * @see https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-compare\n\t * @see https://dom.spec.whatwg.org/#dom-node-comparedocumentposition\n\t */\n\tcompareDocumentPosition: function (other) {\n\t\tif (this === other) return 0;\n\t\tvar node1 = other;\n\t\tvar node2 = this;\n\t\tvar attr1 = null;\n\t\tvar attr2 = null;\n\t\tif (node1 instanceof Attr) {\n\t\t\tattr1 = node1;\n\t\t\tnode1 = attr1.ownerElement;\n\t\t}\n\t\tif (node2 instanceof Attr) {\n\t\t\tattr2 = node2;\n\t\t\tnode2 = attr2.ownerElement;\n\t\t\tif (attr1 && node1 && node2 === node1) {\n\t\t\t\tfor (var i = 0, attr; (attr = node2.attributes[i]); i++) {\n\t\t\t\t\tif (attr === attr1)\n\t\t\t\t\t\treturn DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + DocumentPosition.DOCUMENT_POSITION_PRECEDING;\n\t\t\t\t\tif (attr === attr2)\n\t\t\t\t\t\treturn DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + DocumentPosition.DOCUMENT_POSITION_FOLLOWING;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!node1 || !node2 || node2.ownerDocument !== node1.ownerDocument) {\n\t\t\treturn (\n\t\t\t\tDocumentPosition.DOCUMENT_POSITION_DISCONNECTED +\n\t\t\t\tDocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC +\n\t\t\t\t(docGUID(node2.ownerDocument) > docGUID(node1.ownerDocument)\n\t\t\t\t\t? DocumentPosition.DOCUMENT_POSITION_FOLLOWING\n\t\t\t\t\t: DocumentPosition.DOCUMENT_POSITION_PRECEDING)\n\t\t\t);\n\t\t}\n\t\tvar chain1 = parentChain(node1);\n\t\tvar chain2 = parentChain(node2);\n\t\tif ((!attr1 && chain2.indexOf(node1) >= 0) || (attr2 && node1 === node2)) {\n\t\t\treturn DocumentPosition.DOCUMENT_POSITION_CONTAINS + DocumentPosition.DOCUMENT_POSITION_PRECEDING;\n\t\t}\n\t\tif ((!attr2 && chain1.indexOf(node2) >= 0) || (attr1 && node1 === node2)) {\n\t\t\treturn DocumentPosition.DOCUMENT_POSITION_CONTAINED_BY + DocumentPosition.DOCUMENT_POSITION_FOLLOWING;\n\t\t}\n\t\tvar ca = commonAncestor(chain2, chain1);\n\t\tfor (var n in ca.childNodes) {\n\t\t\tvar child = ca.childNodes[n];\n\t\t\tif (child === node2) return DocumentPosition.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tif (child === node1) return DocumentPosition.DOCUMENT_POSITION_PRECEDING;\n\t\t\tif (chain2.indexOf(child) >= 0) return DocumentPosition.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tif (chain1.indexOf(child) >= 0) return DocumentPosition.DOCUMENT_POSITION_PRECEDING;\n\t\t}\n\t\treturn 0;\n\t},\n};\n\n/**\n * Encodes special XML characters to their corresponding entities.\n *\n * @param {string} c\n * The character to be encoded.\n * @returns {string}\n * The encoded character.\n * @private\n */\nfunction _xmlEncoder(c) {\n\treturn (\n\t\t(c == '<' && '<') || (c == '>' && '>') || (c == '&' && '&') || (c == '\"' && '"') || '&#' + c.charCodeAt() + ';'\n\t);\n}\n\ncopy(NodeType, Node);\ncopy(NodeType, Node.prototype);\ncopy(DocumentPosition, Node);\ncopy(DocumentPosition, Node.prototype);\n\n/**\n * @param callback\n * Return true for continue,false for break.\n * @returns\n * 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)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} while ((node = node.nextSibling));\n\t}\n}\n\n/**\n * @typedef DocumentOptions\n * @property {string} [contentType=MIME_TYPE.XML_APPLICATION]\n */\n/**\n * The Document interface describes the common properties and methods for any kind of document.\n *\n * It should usually be created using `new DOMImplementation().createDocument(...)`\n * or `new DOMImplementation().createHTMLDocument(...)`.\n *\n * The constructor is considered a private API and offers to initially set the `contentType`\n * property via it's options parameter.\n *\n * @class\n * @param {Symbol} symbol\n * @param {DocumentOptions} [options]\n * @augments Node\n * @private\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Document\n * @see https://dom.spec.whatwg.org/#interface-document\n */\nfunction Document(symbol, options) {\n\tcheckSymbol(symbol);\n\n\tvar opt = options || {};\n\tthis.ownerDocument = this;\n\t/**\n\t * The mime type of the document is determined at creation time and can not be modified.\n\t *\n\t * @type {string}\n\t * @see https://dom.spec.whatwg.org/#concept-document-content-type\n\t * @see {@link DOMImplementation}\n\t * @see {@link MIME_TYPE}\n\t * @readonly\n\t */\n\tthis.contentType = opt.contentType || MIME_TYPE.XML_APPLICATION;\n\t/**\n\t * @type {'html' | 'xml'}\n\t * @see https://dom.spec.whatwg.org/#concept-document-type\n\t * @see {@link DOMImplementation}\n\t * @readonly\n\t */\n\tthis.type = isHTMLMimeType(this.contentType) ? 'html' : 'xml';\n}\n\n/**\n * Updates the namespace mapping of an element when a new attribute is added.\n *\n * @param {Document} doc\n * The document that the element belongs to.\n * @param {Element} el\n * The element to which the attribute is being added.\n * @param {Attr} newAttr\n * The new attribute being added.\n * @private\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\n/**\n * Updates the namespace mapping of an element when an attribute is removed.\n *\n * @param {Document} doc\n * The document that the element belongs to.\n * @param {Element} el\n * The element from which the attribute is being removed.\n * @param {Attr} newAttr\n * The attribute being removed.\n * @param {boolean} remove\n * Indicates whether the attribute is to be removed.\n * @private\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 `parent.childNodes`, adjusting the indexed items and its `length`.\n * If `newChild` is provided and has no nextSibling, it will be appended.\n * Otherwise, it's assumed that an item has been removed or inserted,\n * and `parent.firstNode` and its `.nextSibling` to re-indexing all child nodes of `parent`.\n *\n * @param {Document} doc\n * The parent document of `el`.\n * @param {Node} parent\n * The parent node whose childNodes list needs to be updated.\n * @param {Node} [newChild]\n * The new child node to be appended. If not provided, the function assumes a node has been\n * removed.\n * @private\n */\nfunction _onUpdateChild(doc, parent, newChild) {\n\tif (doc && doc._inc) {\n\t\tdoc._inc++;\n\t\tvar childNodes = parent.childNodes;\n\t\t// assumes nextSibling and previousSibling were already configured upfront\n\t\tif (newChild && !newChild.nextSibling) {\n\t\t\t// if an item has been appended, we only need to update the last index and the length\n\t\t\tchildNodes[childNodes.length++] = newChild;\n\t\t} else {\n\t\t\t// otherwise we need to reindex all items,\n\t\t\t// which can take a while when processing nodes with a lot of children\n\t\t\tvar child = parent.firstChild;\n\t\t\tvar i = 0;\n\t\t\twhile (child) {\n\t\t\t\tchildNodes[i++] = child;\n\t\t\t\tchild = child.nextSibling;\n\t\t\t}\n\t\t\tchildNodes.length = i;\n\t\t\tdelete childNodes[childNodes.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 * @param {Node} parentNode\n * The parent node from which the child node is to be removed.\n * @param {Node} child\n * The child node to be removed from the parentNode.\n * @returns {Node}\n * Returns the child node that was removed.\n * @throws {DOMException}\n * With code:\n * - {@link DOMException.NOT_FOUND_ERR} If the parentNode is not the parent of the child node.\n * @private\n * @see https://github.com/xmldom/xmldom/issues/135\n * @see https://github.com/xmldom/xmldom/issues/145\n */\nfunction _removeChild(parentNode, child) {\n\tif (parentNode !== child.parentNode) {\n\t\tthrow new DOMException(DOMException.NOT_FOUND_ERR, \"child's parent is not parent\");\n\t}\n\tvar oldPreviousSibling = child.previousSibling;\n\tvar oldNextSibling = child.nextSibling;\n\tif (oldPreviousSibling) {\n\t\toldPreviousSibling.nextSibling = oldNextSibling;\n\t} else {\n\t\tparentNode.firstChild = oldNextSibling;\n\t}\n\tif (oldNextSibling) {\n\t\toldNextSibling.previousSibling = oldPreviousSibling;\n\t} else {\n\t\tparentNode.lastChild = oldPreviousSibling;\n\t}\n\t_onUpdateChild(parentNode.ownerDocument, parentNode);\n\tchild.parentNode = null;\n\tchild.previousSibling = null;\n\tchild.nextSibling = null;\n\treturn child;\n}\n\n/**\n * Returns `true` if `node` can be a parent for insertion.\n *\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 *\n * @param {Node} node\n * @returns {boolean}\n */\nfunction hasInsertableNodeType(node) {\n\treturn (\n\t\tnode &&\n\t\t(node.nodeType === Node.CDATA_SECTION_NODE ||\n\t\t\tnode.nodeType === Node.COMMENT_NODE ||\n\t\t\tnode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ||\n\t\t\tnode.nodeType === Node.DOCUMENT_TYPE_NODE ||\n\t\t\tnode.nodeType === Node.ELEMENT_NODE ||\n\t\t\tnode.nodeType === Node.PROCESSING_INSTRUCTION_NODE ||\n\t\t\tnode.nodeType === Node.TEXT_NODE)\n\t);\n}\n\n/**\n * Returns true if `node` is a DOCTYPE node.\n *\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 *\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 *\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\n * The document node.\n * @param {Node} child\n * The node that would become the nextSibling if the element would be inserted.\n * @returns {boolean}\n * `true` if an element can be inserted before child.\n * @private\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\n * The document node.\n * @param {Node} child\n * The node that would become the nextSibling if the element would be inserted.\n * @returns {boolean}\n * `true` if an element can be inserted before child.\n * @private\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 * Asserts pre-insertion validity of a node into a parent before a child.\n * Throws errors for invalid node combinations that would result in an ill-formed DOM.\n *\n * @param {Node} parent\n * The parent node to insert `node` into.\n * @param {Node} node\n * The node to insert.\n * @param {Node | null} child\n * The node that should become the `nextSibling` of `node`. If null, no sibling is considered.\n * @throws {DOMException}\n * With code:\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `parent` is not a Document,\n * DocumentFragment, or Element node.\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is a host-including inclusive\n * ancestor of `parent`. (Currently not implemented)\n * - {@link DOMException.NOT_FOUND_ERR} If `child` is non-null and its `parent` is not\n * `parent`.\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is not a DocumentFragment,\n * DocumentType, Element, or CharacterData node.\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If either `node` is a Text node and `parent` is\n * a document, or if `node` is a doctype and `parent` is not a document.\n * @private\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(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(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\tDOMException.HIERARCHY_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 * Asserts pre-insertion validity of a node into a document before a child.\n * Throws errors for invalid node combinations that would result in an ill-formed DOM.\n *\n * @param {Document} parent\n * The parent node to insert `node` into.\n * @param {Node} node\n * The node to insert.\n * @param {Node | undefined} child\n * The node that should become the `nextSibling` of `node`. If undefined, no sibling is\n * considered.\n * @returns {Node}\n * @throws {DOMException}\n * With code:\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is a DocumentFragment with more than\n * one element child or has a Text node child.\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is a DocumentFragment with one\n * element child and either `parent` has an element child, `child` is a doctype, or `child` is\n * non-null and a doctype is following `child`.\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is an Element and `parent` has an\n * element child, `child` is a doctype, or `child` is non-null and a doctype is following\n * `child`.\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is a DocumentType and `parent` has a\n * doctype child, `child` is non-null and an element is preceding `child`, or `child` is null\n * and `parent` has an element child.\n * @private\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(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(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(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(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(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(DOMException.HIERARCHY_REQUEST_ERR, 'Doctype can not be appended since element is present');\n\t\t}\n\t}\n}\n\n/**\n * @param {Document} parent\n * The parent node to insert `node` into.\n * @param {Node} node\n * The node to insert.\n * @param {Node | undefined} child\n * the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws {DOMException}\n * For several node combinations that would create a DOM that is not well-formed.\n * @throws {DOMException}\n * If `child` is provided but is not a child of `parent`.\n * @private\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(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(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(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(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(DOMException.HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');\n\t\t}\n\t}\n}\n\n/**\n * Inserts a node into a parent node before a child node.\n *\n * @param {Node} parent\n * The parent node to insert the node into.\n * @param {Node} node\n * The node to insert into the parent.\n * @param {Node | null} child\n * The node that should become the next sibling of the node.\n * If null, the function inserts the node at the end of the children of the parent node.\n * @param {Function} [_inDocumentAssertion]\n * An optional function to check pre-insertion validity if parent is a document node.\n * Defaults to {@link assertPreInsertionValidityInDocument}\n * @returns {Node}\n * Returns the inserted node.\n * @throws {DOMException}\n * Throws a DOMException if inserting the node would result in a DOM tree that is not\n * well-formed. See {@link assertPreInsertionValidity1to5},\n * {@link assertPreInsertionValidityInDocument}.\n * @throws {DOMException}\n * Throws a DOMException if child is provided but is not a child of the parent. See\n * {@link Node.removeChild}\n * @private\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\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, node);\n\tif (node.nodeType == DOCUMENT_FRAGMENT_NODE) {\n\t\tnode.firstChild = node.lastChild = null;\n\t}\n\n\treturn node;\n}\n\nDocument.prototype = {\n\t/**\n\t * The implementation that created this document.\n\t *\n\t * @type DOMImplementation\n\t * @readonly\n\t */\n\timplementation: null,\n\tnodeName: '#document',\n\tnodeType: DOCUMENT_NODE,\n\t/**\n\t * The DocumentType node of the document.\n\t *\n\t * @type DocumentType\n\t * @readonly\n\t */\n\tdoctype: null,\n\tdocumentElement: null,\n\t_inc: 1,\n\n\tinsertBefore: function (newChild, refChild) {\n\t\t//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\tvar removed = _removeChild(this, oldChild);\n\t\tif (removed === this.documentElement) {\n\t\t\tthis.documentElement = null;\n\t\t}\n\t\treturn removed;\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: function (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 * Creates a new `Element` that is owned by this `Document`.\n\t * In HTML Documents `localName` is the lower cased `tagName`,\n\t * otherwise no transformation is being applied.\n\t * When `contentType` implies the HTML namespace, it will be set as `namespaceURI`.\n\t *\n\t * __This implementation differs from the specification:__ - The provided name is not checked\n\t * against the `Name` production,\n\t * so no related error will be thrown.\n\t * - There is no interface `HTMLElement`, it is always an `Element`.\n\t * - There is no support for a second argument to indicate using custom elements.\n\t *\n\t * @param {string} tagName\n\t * @returns {Element}\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement\n\t * @see https://dom.spec.whatwg.org/#dom-document-createelement\n\t * @see https://dom.spec.whatwg.org/#concept-create-element\n\t */\n\tcreateElement: function (tagName) {\n\t\tvar node = new Element(PDC);\n\t\tnode.ownerDocument = this;\n\t\tif (this.type === 'html') {\n\t\t\ttagName = tagName.toLowerCase();\n\t\t}\n\t\tif (hasDefaultHTMLNamespace(this.contentType)) {\n\t\t\tnode.namespaceURI = NAMESPACE.HTML;\n\t\t}\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 = (node.attributes = new NamedNodeMap());\n\t\tattrs._ownerElement = node;\n\t\treturn node;\n\t},\n\t/**\n\t * @returns {DocumentFragment}\n\t */\n\tcreateDocumentFragment: function () {\n\t\tvar node = new DocumentFragment(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\treturn node;\n\t},\n\t/**\n\t * @param {string} data\n\t * @returns {Text}\n\t */\n\tcreateTextNode: function (data) {\n\t\tvar node = new Text(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.appendData(data);\n\t\treturn node;\n\t},\n\t/**\n\t * @param {string} data\n\t * @returns {Comment}\n\t */\n\tcreateComment: function (data) {\n\t\tvar node = new Comment(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.appendData(data);\n\t\treturn node;\n\t},\n\t/**\n\t * @param {string} data\n\t * @returns {CDATASection}\n\t */\n\tcreateCDATASection: function (data) {\n\t\tvar node = new CDATASection(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.appendData(data);\n\t\treturn node;\n\t},\n\t/**\n\t * @param {string} target\n\t * @param {string} data\n\t * @returns {ProcessingInstruction}\n\t */\n\tcreateProcessingInstruction: function (target, data) {\n\t\tvar node = new ProcessingInstruction(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.nodeName = node.target = target;\n\t\tnode.nodeValue = node.data = data;\n\t\treturn node;\n\t},\n\t/**\n\t * Creates an `Attr` node that is owned by this document.\n\t * In HTML Documents `localName` is the lower cased `name`,\n\t * otherwise no transformation is being applied.\n\t *\n\t * __This implementation differs from the specification:__ - The provided name is not checked\n\t * against the `Name` production,\n\t * so no related error will be thrown.\n\t *\n\t * @param {string} name\n\t * @returns {Attr}\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createAttribute\n\t * @see https://dom.spec.whatwg.org/#dom-document-createattribute\n\t */\n\tcreateAttribute: function (name) {\n\t\tif (!g.QName_exact.test(name)) {\n\t\t\tthrow new DOMException(DOMException.INVALID_CHARACTER_ERR, 'invalid character in name \"' + name + '\"');\n\t\t}\n\t\tif (this.type === 'html') {\n\t\t\tname = name.toLowerCase();\n\t\t}\n\t\treturn this._createAttribute(name);\n\t},\n\t_createAttribute: function (name) {\n\t\tvar node = new Attr(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.name = name;\n\t\tnode.nodeName = name;\n\t\tnode.localName = name;\n\t\tnode.specified = true;\n\t\treturn node;\n\t},\n\t/**\n\t * Creates an EntityReference object.\n\t * The current implementation does not fill the `childNodes` with those of the corresponding\n\t * `Entity`\n\t *\n\t * @deprecated\n\t * In DOM Level 4.\n\t * @param {string} name\n\t * The name of the entity to reference. No namespace well-formedness checks are performed.\n\t * @returns {EntityReference}\n\t * @throws {DOMException}\n\t * With code `INVALID_CHARACTER_ERR` when `name` is not valid.\n\t * @throws {DOMException}\n\t * with code `NOT_SUPPORTED_ERR` when the document is of type `html`\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE\n\t */\n\tcreateEntityReference: function (name) {\n\t\tif (!g.Name.test(name)) {\n\t\t\tthrow new DOMException(DOMException.INVALID_CHARACTER_ERR, 'not a valid xml name \"' + name + '\"');\n\t\t}\n\t\tif (this.type === 'html') {\n\t\t\tthrow new DOMException('document is an html document', DOMExceptionName.NotSupportedError);\n\t\t}\n\n\t\tvar node = new EntityReference(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.nodeName = name;\n\t\treturn node;\n\t},\n\t// Introduced in DOM Level 2:\n\t/**\n\t * @param {string} namespaceURI\n\t * @param {string} qualifiedName\n\t * @returns {Element}\n\t */\n\tcreateElementNS: function (namespaceURI, qualifiedName) {\n\t\tvar validated = validateAndExtract(namespaceURI, qualifiedName);\n\t\tvar node = new Element(PDC);\n\t\tvar attrs = (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 = validated[0];\n\t\tnode.prefix = validated[1];\n\t\tnode.localName = validated[2];\n\t\tattrs._ownerElement = node;\n\t\treturn node;\n\t},\n\t// Introduced in DOM Level 2:\n\t/**\n\t * @param {string} namespaceURI\n\t * @param {string} qualifiedName\n\t * @returns {Attr}\n\t */\n\tcreateAttributeNS: function (namespaceURI, qualifiedName) {\n\t\tvar validated = validateAndExtract(namespaceURI, qualifiedName);\n\t\tvar node = new Attr(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.name = qualifiedName;\n\t\tnode.specified = true;\n\t\tnode.namespaceURI = validated[0];\n\t\tnode.prefix = validated[1];\n\t\tnode.localName = validated[2];\n\t\treturn node;\n\t},\n};\n_extends(Document, Node);\n\nfunction Element(symbol) {\n\tcheckSymbol(symbol);\n\n\tthis._nsMap = Object.create(null);\n}\nElement.prototype = {\n\tnodeType: ELEMENT_NODE,\n\t/**\n\t * The attributes of this element.\n\t *\n\t * @type {NamedNodeMap | null}\n\t */\n\tattributes: null,\n\tgetQualifiedName: function () {\n\t\treturn this.prefix ? this.prefix + ':' + this.localName : this.localName;\n\t},\n\t_isInHTMLDocumentAndNamespace: function () {\n\t\treturn this.ownerDocument.type === 'html' && this.namespaceURI === NAMESPACE.HTML;\n\t},\n\thasAttribute: function (name) {\n\t\treturn !!this.getAttributeNode(name);\n\t},\n\t/**\n\t * Returns element’s first attribute whose qualified name is `name`, and `null`\n\t * if there is no such attribute.\n\t *\n\t * @param {string} name\n\t * @returns {string | null}\n\t */\n\tgetAttribute: function (name) {\n\t\tvar attr = this.getAttributeNode(name);\n\t\treturn attr ? attr.value : null;\n\t},\n\tgetAttributeNode: function (name) {\n\t\tif (this._isInHTMLDocumentAndNamespace()) {\n\t\t\tname = name.toLowerCase();\n\t\t}\n\t\treturn this.attributes.getNamedItem(name);\n\t},\n\t/**\n\t * Sets the value of element’s first attribute whose qualified name is qualifiedName to value.\n\t *\n\t * @param {string} name\n\t * @param {string} value\n\t */\n\tsetAttribute: function (name, value) {\n\t\tif (this._isInHTMLDocumentAndNamespace()) {\n\t\t\tname = name.toLowerCase();\n\t\t}\n\t\tvar attr = this.getAttributeNode(name);\n\t\tif (attr) {\n\t\t\tattr.value = attr.nodeValue = '' + value;\n\t\t} else {\n\t\t\tattr = this.ownerDocument._createAttribute(name);\n\t\t\tattr.value = attr.nodeValue = '' + value;\n\t\t\tthis.setAttributeNode(attr);\n\t\t}\n\t},\n\tremoveAttribute: function (name) {\n\t\tvar attr = this.getAttributeNode(name);\n\t\tattr && this.removeAttributeNode(attr);\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\t/**\n\t * Returns element’s attribute whose namespace is `namespaceURI` and local name is\n\t * `localName`,\n\t * or `null` if there is no such attribute.\n\t *\n\t * @param {string} namespaceURI\n\t * @param {string} localName\n\t * @returns {string | null}\n\t */\n\tgetAttributeNS: function (namespaceURI, localName) {\n\t\tvar attr = this.getAttributeNodeNS(namespaceURI, localName);\n\t\treturn attr ? attr.value : null;\n\t},\n\t/**\n\t * Sets the value of element’s attribute whose namespace is `namespaceURI` and local name is\n\t * `localName` to value.\n\t *\n\t * @param {string} namespaceURI\n\t * @param {string} qualifiedName\n\t * @param {string} value\n\t * @see https://dom.spec.whatwg.org/#dom-element-setattributens\n\t */\n\tsetAttributeNS: function (namespaceURI, qualifiedName, value) {\n\t\tvar validated = validateAndExtract(namespaceURI, qualifiedName);\n\t\tvar localName = validated[2];\n\t\tvar attr = this.getAttributeNodeNS(namespaceURI, localName);\n\t\tif (attr) {\n\t\t\tattr.value = attr.nodeValue = '' + value;\n\t\t} else {\n\t\t\tattr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);\n\t\t\tattr.value = attr.nodeValue = '' + value;\n\t\t\tthis.setAttributeNode(attr);\n\t\t}\n\t},\n\tgetAttributeNodeNS: function (namespaceURI, localName) {\n\t\treturn this.attributes.getNamedItemNS(namespaceURI, localName);\n\t},\n\n\t/**\n\t * Returns a LiveNodeList of all child elements which have **all** of the given class name(s).\n\t *\n\t * Returns an empty list if `classNames` is an empty string or only contains HTML white space\n\t * characters.\n\t *\n\t * Warning: This returns 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\n\t * Is a string representing the class name(s) to match; multiple class names are separated by\n\t * (ASCII-)whitespace.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName\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, 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/**\n\t * Returns a LiveNodeList of elements with the given qualifiedName.\n\t * Searching for all descendants can be done by passing `*` as `qualifiedName`.\n\t *\n\t * All descendants of the specified element are searched, but not the element itself.\n\t * The returned list is live, which means it updates itself with the DOM tree automatically.\n\t * Therefore, there is no need to call `Element.getElementsByTagName()`\n\t * with the same element and arguments repeatedly if the DOM changes in between calls.\n\t *\n\t * When called on an HTML element in an HTML document,\n\t * `getElementsByTagName` lower-cases the argument before searching for it.\n\t * This is undesirable when trying to match camel-cased SVG elements (such as\n\t * ``) in an HTML document.\n\t * Instead, use `Element.getElementsByTagNameNS()`,\n\t * which preserves the capitalization of the tag name.\n\t *\n\t * `Element.getElementsByTagName` is similar to `Document.getElementsByTagName()`,\n\t * except that it only searches for elements that are descendants of the specified element.\n\t *\n\t * @param {string} qualifiedName\n\t * @returns {LiveNodeList}\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName\n\t * @see https://dom.spec.whatwg.org/#concept-getelementsbytagname\n\t */\n\tgetElementsByTagName: function (qualifiedName) {\n\t\tvar isHTMLDocument = (this.nodeType === DOCUMENT_NODE ? this : this.ownerDocument).type === 'html';\n\t\tvar lowerQualifiedName = qualifiedName.toLowerCase();\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) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (qualifiedName === '*') {\n\t\t\t\t\tls.push(node);\n\t\t\t\t} else {\n\t\t\t\t\tvar nodeQualifiedName = node.getQualifiedName();\n\t\t\t\t\tvar matchingQName = isHTMLDocument && node.namespaceURI === NAMESPACE.HTML ? lowerQualifiedName : qualifiedName;\n\t\t\t\t\tif (nodeQualifiedName === matchingQName) {\n\t\t\t\t\t\tls.push(node);\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\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 (\n\t\t\t\t\tnode !== base &&\n\t\t\t\t\tnode.nodeType === ELEMENT_NODE &&\n\t\t\t\t\t(namespaceURI === '*' || node.namespaceURI === namespaceURI) &&\n\t\t\t\t\t(localName === '*' || node.localName == localName)\n\t\t\t\t) {\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};\nDocument.prototype.getElementsByClassName = Element.prototype.getElementsByClassName;\nDocument.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;\nDocument.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;\n\n_extends(Element, Node);\nfunction Attr(symbol) {\n\tcheckSymbol(symbol);\n\n\tthis.namespaceURI = null;\n\tthis.prefix = null;\n\tthis.ownerElement = null;\n}\nAttr.prototype.nodeType = ATTRIBUTE_NODE;\n_extends(Attr, Node);\n\nfunction CharacterData(symbol) {\n\tcheckSymbol(symbol);\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\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(symbol) {\n\tcheckSymbol(symbol);\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(symbol) {\n\tcheckSymbol(symbol);\n}\nComment.prototype = {\n\tnodeName: '#comment',\n\tnodeType: COMMENT_NODE,\n};\n_extends(Comment, CharacterData);\n\nfunction CDATASection(symbol) {\n\tcheckSymbol(symbol);\n}\nCDATASection.prototype = {\n\tnodeName: '#cdata-section',\n\tnodeType: CDATA_SECTION_NODE,\n};\n_extends(CDATASection, Text);\n\nfunction DocumentType(symbol) {\n\tcheckSymbol(symbol);\n}\nDocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;\n_extends(DocumentType, Node);\n\nfunction Notation(symbol) {\n\tcheckSymbol(symbol);\n}\nNotation.prototype.nodeType = NOTATION_NODE;\n_extends(Notation, Node);\n\nfunction Entity(symbol) {\n\tcheckSymbol(symbol);\n}\nEntity.prototype.nodeType = ENTITY_NODE;\n_extends(Entity, Node);\n\nfunction EntityReference(symbol) {\n\tcheckSymbol(symbol);\n}\nEntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;\n_extends(EntityReference, Node);\n\nfunction DocumentFragment(symbol) {\n\tcheckSymbol(symbol);\n}\nDocumentFragment.prototype.nodeName = '#document-fragment';\nDocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;\n_extends(DocumentFragment, Node);\n\nfunction ProcessingInstruction(symbol) {\n\tcheckSymbol(symbol);\n}\nProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;\n_extends(ProcessingInstruction, CharacterData);\nfunction XMLSerializer() {}\nXMLSerializer.prototype.serializeToString = function (node, nodeFilter) {\n\treturn nodeSerializeToString.call(node, nodeFilter);\n};\nNode.prototype.toString = nodeSerializeToString;\nfunction nodeSerializeToString(nodeFilter) {\n\tvar buf = [];\n\tvar refNode = (this.nodeType === DOCUMENT_NODE && this.documentElement) || this;\n\tvar prefix = refNode.prefix;\n\tvar uri = refNode.namespaceURI;\n\n\tif (uri && prefix == null) {\n\t\tvar prefix = refNode.lookupPrefix(uri);\n\t\tif (prefix == null) {\n\t\t\tvar visibleNamespaces = [\n\t\t\t\t{ namespace: uri, prefix: null },\n\t\t\t\t//{namespace:uri,prefix:''}\n\t\t\t];\n\t\t}\n\t}\n\tserializeToString(this, buf, nodeFilter, visibleNamespaces);\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 * Literal whitespace other than space that appear in attribute values are serialized as\n * their entity references, so they will be preserved.\n * (In contrast to whitespace literals in the input which are normalized to spaces).\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 *\n * @see https://www.w3.org/TR/xml11/#CleanAttrVals\n * @see https://www.w3.org/TR/xml11/#NT-AttValue\n * @see https://www.w3.org/TR/xml11/#AVNormalize\n * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes\n * @prettierignore\n */\nfunction addSerializedAttribute(buf, qualifiedName, value) {\n\tbuf.push(' ', qualifiedName, '=\"', value.replace(/[<>&\"\\t\\n\\r]/g, _xmlEncoder), '\"');\n}\n\nfunction serializeToString(node, buf, nodeFilter, visibleNamespaces) {\n\tif (!visibleNamespaces) {\n\t\tvisibleNamespaces = [];\n\t}\n\tvar doc = node.nodeType === DOCUMENT_NODE ? node : node.ownerDocument;\n\tvar isHTML = doc.type === 'html';\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\t\tcase ELEMENT_NODE:\n\t\t\tvar attrs = node.attributes;\n\t\t\tvar len = attrs.length;\n\t\t\tvar child = node.firstChild;\n\t\t\tvar nodeName = node.tagName;\n\n\t\t\tvar prefixedNodeName = nodeName;\n\t\t\tif (!isHTML && !node.prefix && node.namespaceURI) {\n\t\t\t\tvar defaultNS;\n\t\t\t\t// lookup current default ns from `xmlns` attribute\n\t\t\t\tfor (var ai = 0; ai < attrs.length; ai++) {\n\t\t\t\t\tif (attrs.item(ai).name === 'xmlns') {\n\t\t\t\t\t\tdefaultNS = attrs.item(ai).value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!defaultNS) {\n\t\t\t\t\t// lookup current default ns in visibleNamespaces\n\t\t\t\t\tfor (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {\n\t\t\t\t\t\tvar namespace = visibleNamespaces[nsi];\n\t\t\t\t\t\tif (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {\n\t\t\t\t\t\t\tdefaultNS = namespace.namespace;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (defaultNS !== node.namespaceURI) {\n\t\t\t\t\tfor (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {\n\t\t\t\t\t\tvar namespace = visibleNamespaces[nsi];\n\t\t\t\t\t\tif (namespace.namespace === node.namespaceURI) {\n\t\t\t\t\t\t\tif (namespace.prefix) {\n\t\t\t\t\t\t\t\tprefixedNodeName = namespace.prefix + ':' + nodeName;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbuf.push('<', prefixedNodeName);\n\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\t// add namespaces for attributes\n\t\t\t\tvar attr = attrs.item(i);\n\t\t\t\tif (attr.prefix == 'xmlns') {\n\t\t\t\t\tvisibleNamespaces.push({\n\t\t\t\t\t\tprefix: attr.localName,\n\t\t\t\t\t\tnamespace: attr.value,\n\t\t\t\t\t});\n\t\t\t\t} else if (attr.nodeName == 'xmlns') {\n\t\t\t\t\tvisibleNamespaces.push({ prefix: '', namespace: attr.value });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tvar attr = attrs.item(i);\n\t\t\t\tif (needNamespaceDefine(attr, isHTML, visibleNamespaces)) {\n\t\t\t\t\tvar prefix = attr.prefix || '';\n\t\t\t\t\tvar uri = attr.namespaceURI;\n\t\t\t\t\taddSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : 'xmlns', uri);\n\t\t\t\t\tvisibleNamespaces.push({ prefix: prefix, namespace: uri });\n\t\t\t\t}\n\t\t\t\tserializeToString(attr, buf, nodeFilter, visibleNamespaces);\n\t\t\t}\n\n\t\t\t// add namespace for current node\n\t\t\tif (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {\n\t\t\t\tvar prefix = node.prefix || '';\n\t\t\t\tvar uri = node.namespaceURI;\n\t\t\t\taddSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : 'xmlns', uri);\n\t\t\t\tvisibleNamespaces.push({ prefix: prefix, namespace: uri });\n\t\t\t}\n\t\t\t// in XML elements can be closed when they have no children\n\t\t\tvar canCloseTag = !child;\n\t\t\tif (canCloseTag && (isHTML || node.namespaceURI === NAMESPACE.HTML)) {\n\t\t\t\t// in HTML (doc or ns) only void elements can be closed right away\n\t\t\t\tcanCloseTag = isHTMLVoidElement(nodeName);\n\t\t\t}\n\t\t\tif (canCloseTag) {\n\t\t\t\tbuf.push('/>');\n\t\t\t} else {\n\t\t\t\tbuf.push('>');\n\t\t\t\t//if is cdata child node\n\t\t\t\tif (isHTML && isHTMLRawTextElement(nodeName)) {\n\t\t\t\t\twhile (child) {\n\t\t\t\t\t\tif (child.data) {\n\t\t\t\t\t\t\tbuf.push(child.data);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tserializeToString(child, buf, nodeFilter, visibleNamespaces.slice());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchild = child.nextSibling;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\twhile (child) {\n\t\t\t\t\t\tserializeToString(child, buf, nodeFilter, visibleNamespaces.slice());\n\t\t\t\t\t\tchild = child.nextSibling;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbuf.push('');\n\t\t\t}\n\t\t\t// remove added visible namespaces\n\t\t\t//visibleNamespaces.length = startVisibleNamespaces;\n\t\t\treturn;\n\t\tcase DOCUMENT_NODE:\n\t\tcase DOCUMENT_FRAGMENT_NODE:\n\t\t\tvar child = node.firstChild;\n\t\t\twhile (child) {\n\t\t\t\tserializeToString(child, buf, nodeFilter, visibleNamespaces.slice());\n\t\t\t\tchild = child.nextSibling;\n\t\t\t}\n\t\t\treturn;\n\t\tcase ATTRIBUTE_NODE:\n\t\t\treturn addSerializedAttribute(buf, node.name, node.value);\n\t\tcase TEXT_NODE:\n\t\t\t/*\n\t\t\t * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,\n\t\t\t * except when used as markup delimiters, or within a comment, a processing instruction,\n\t\t\t * or a CDATA section.\n\t\t\t * If they are needed elsewhere, they must be escaped using either numeric character\n\t\t\t * references or the strings `&` and `<` respectively.\n\t\t\t * The right angle bracket (>) may be represented using the string \" > \",\n\t\t\t * and must, for compatibility, be escaped using either `>`,\n\t\t\t * or a character reference when it appears in the string `]]>` in content,\n\t\t\t * when that string is not marking the end of a CDATA section.\n\t\t\t *\n\t\t\t * In the content of elements, character data is any string of characters which does not\n\t\t\t * contain the start-delimiter of any markup and does not include the CDATA-section-close\n\t\t\t * delimiter, `]]>`.\n\t\t\t *\n\t\t\t * @see https://www.w3.org/TR/xml/#NT-CharData\n\t\t\t * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node\n\t\t\t */\n\t\t\treturn buf.push(node.data.replace(/[<&>]/g, _xmlEncoder));\n\t\tcase CDATA_SECTION_NODE:\n\t\t\treturn buf.push(g.CDATA_START, node.data, g.CDATA_END);\n\t\tcase COMMENT_NODE:\n\t\t\treturn buf.push(g.COMMENT_START, node.data, g.COMMENT_END);\n\t\tcase DOCUMENT_TYPE_NODE:\n\t\t\tvar pubid = node.publicId;\n\t\t\tvar sysid = node.systemId;\n\t\t\tbuf.push(g.DOCTYPE_DECL_START, ' ', node.name);\n\t\t\tif (pubid) {\n\t\t\t\tbuf.push(' ', g.PUBLIC, ' ', pubid);\n\t\t\t\tif (sysid && sysid !== '.') {\n\t\t\t\t\tbuf.push(' ', sysid);\n\t\t\t\t}\n\t\t\t} else if (sysid && sysid !== '.') {\n\t\t\t\tbuf.push(' ', g.SYSTEM, ' ', sysid);\n\t\t\t}\n\t\t\tif (node.internalSubset) {\n\t\t\t\tbuf.push(' [', node.internalSubset, ']');\n\t\t\t}\n\t\t\tbuf.push('>');\n\t\t\treturn;\n\t\tcase PROCESSING_INSTRUCTION_NODE:\n\t\t\treturn buf.push('');\n\t\tcase ENTITY_REFERENCE_NODE:\n\t\t\treturn buf.push('&', node.nodeName, ';');\n\t\t//case ENTITY_NODE:\n\t\t//case NOTATION_NODE:\n\t\tdefault:\n\t\t\tbuf.push('??', node.nodeName);\n\t}\n}\nfunction importNode(doc, node, deep) {\n\tvar node2;\n\tswitch (node.nodeType) {\n\t\tcase ELEMENT_NODE:\n\t\t\tnode2 = node.cloneNode(false);\n\t\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',\n\tlt: '<',\n\tquot: '\"',\n});\n\n/**\n * A map of all entities that are detected in an HTML document.\n * They contain all entries from `XML_ENTITIES`.\n *\n * @see {@link XML_ENTITIES}\n * @see {@link DOMParser.parseFromString}\n * @see {@link DOMImplementation.prototype.createHTMLDocument}\n * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5)\n * Spec\n * @see https://html.spec.whatwg.org/entities.json JSON\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\n * Wikipedia (HTML)\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML\n * Wikpedia (XHTML)\n */\nexports.HTML_ENTITIES = freeze({\n\tAacute: '\\u00C1',\n\taacute: '\\u00E1',\n\tAbreve: '\\u0102',\n\tabreve: '\\u0103',\n\tac: '\\u223E',\n\tacd: '\\u223F',\n\tacE: '\\u223E\\u0333',\n\tAcirc: '\\u00C2',\n\tacirc: '\\u00E2',\n\tacute: '\\u00B4',\n\tAcy: '\\u0410',\n\tacy: '\\u0430',\n\tAElig: '\\u00C6',\n\taelig: '\\u00E6',\n\taf: '\\u2061',\n\tAfr: '\\uD835\\uDD04',\n\tafr: '\\uD835\\uDD1E',\n\tAgrave: '\\u00C0',\n\tagrave: '\\u00E0',\n\talefsym: '\\u2135',\n\taleph: '\\u2135',\n\tAlpha: '\\u0391',\n\talpha: '\\u03B1',\n\tAmacr: '\\u0100',\n\tamacr: '\\u0101',\n\tamalg: '\\u2A3F',\n\tAMP: '\\u0026',\n\tamp: '\\u0026',\n\tAnd: '\\u2A53',\n\tand: '\\u2227',\n\tandand: '\\u2A55',\n\tandd: '\\u2A5C',\n\tandslope: '\\u2A58',\n\tandv: '\\u2A5A',\n\tang: '\\u2220',\n\tange: '\\u29A4',\n\tangle: '\\u2220',\n\tangmsd: '\\u2221',\n\tangmsdaa: '\\u29A8',\n\tangmsdab: '\\u29A9',\n\tangmsdac: '\\u29AA',\n\tangmsdad: '\\u29AB',\n\tangmsdae: '\\u29AC',\n\tangmsdaf: '\\u29AD',\n\tangmsdag: '\\u29AE',\n\tangmsdah: '\\u29AF',\n\tangrt: '\\u221F',\n\tangrtvb: '\\u22BE',\n\tangrtvbd: '\\u299D',\n\tangsph: '\\u2222',\n\tangst: '\\u00C5',\n\tangzarr: '\\u237C',\n\tAogon: '\\u0104',\n\taogon: '\\u0105',\n\tAopf: '\\uD835\\uDD38',\n\taopf: '\\uD835\\uDD52',\n\tap: '\\u2248',\n\tapacir: '\\u2A6F',\n\tapE: '\\u2A70',\n\tape: '\\u224A',\n\tapid: '\\u224B',\n\tapos: '\\u0027',\n\tApplyFunction: '\\u2061',\n\tapprox: '\\u2248',\n\tapproxeq: '\\u224A',\n\tAring: '\\u00C5',\n\taring: '\\u00E5',\n\tAscr: '\\uD835\\uDC9C',\n\tascr: '\\uD835\\uDCB6',\n\tAssign: '\\u2254',\n\tast: '\\u002A',\n\tasymp: '\\u2248',\n\tasympeq: '\\u224D',\n\tAtilde: '\\u00C3',\n\tatilde: '\\u00E3',\n\tAuml: '\\u00C4',\n\tauml: '\\u00E4',\n\tawconint: '\\u2233',\n\tawint: '\\u2A11',\n\tbackcong: '\\u224C',\n\tbackepsilon: '\\u03F6',\n\tbackprime: '\\u2035',\n\tbacksim: '\\u223D',\n\tbacksimeq: '\\u22CD',\n\tBackslash: '\\u2216',\n\tBarv: '\\u2AE7',\n\tbarvee: '\\u22BD',\n\tBarwed: '\\u2306',\n\tbarwed: '\\u2305',\n\tbarwedge: '\\u2305',\n\tbbrk: '\\u23B5',\n\tbbrktbrk: '\\u23B6',\n\tbcong: '\\u224C',\n\tBcy: '\\u0411',\n\tbcy: '\\u0431',\n\tbdquo: '\\u201E',\n\tbecaus: '\\u2235',\n\tBecause: '\\u2235',\n\tbecause: '\\u2235',\n\tbemptyv: '\\u29B0',\n\tbepsi: '\\u03F6',\n\tbernou: '\\u212C',\n\tBernoullis: '\\u212C',\n\tBeta: '\\u0392',\n\tbeta: '\\u03B2',\n\tbeth: '\\u2136',\n\tbetween: '\\u226C',\n\tBfr: '\\uD835\\uDD05',\n\tbfr: '\\uD835\\uDD1F',\n\tbigcap: '\\u22C2',\n\tbigcirc: '\\u25EF',\n\tbigcup: '\\u22C3',\n\tbigodot: '\\u2A00',\n\tbigoplus: '\\u2A01',\n\tbigotimes: '\\u2A02',\n\tbigsqcup: '\\u2A06',\n\tbigstar: '\\u2605',\n\tbigtriangledown: '\\u25BD',\n\tbigtriangleup: '\\u25B3',\n\tbiguplus: '\\u2A04',\n\tbigvee: '\\u22C1',\n\tbigwedge: '\\u22C0',\n\tbkarow: '\\u290D',\n\tblacklozenge: '\\u29EB',\n\tblacksquare: '\\u25AA',\n\tblacktriangle: '\\u25B4',\n\tblacktriangledown: '\\u25BE',\n\tblacktriangleleft: '\\u25C2',\n\tblacktriangleright: '\\u25B8',\n\tblank: '\\u2423',\n\tblk12: '\\u2592',\n\tblk14: '\\u2591',\n\tblk34: '\\u2593',\n\tblock: '\\u2588',\n\tbne: '\\u003D\\u20E5',\n\tbnequiv: '\\u2261\\u20E5',\n\tbNot: '\\u2AED',\n\tbnot: '\\u2310',\n\tBopf: '\\uD835\\uDD39',\n\tbopf: '\\uD835\\uDD53',\n\tbot: '\\u22A5',\n\tbottom: '\\u22A5',\n\tbowtie: '\\u22C8',\n\tboxbox: '\\u29C9',\n\tboxDL: '\\u2557',\n\tboxDl: '\\u2556',\n\tboxdL: '\\u2555',\n\tboxdl: '\\u2510',\n\tboxDR: '\\u2554',\n\tboxDr: '\\u2553',\n\tboxdR: '\\u2552',\n\tboxdr: '\\u250C',\n\tboxH: '\\u2550',\n\tboxh: '\\u2500',\n\tboxHD: '\\u2566',\n\tboxHd: '\\u2564',\n\tboxhD: '\\u2565',\n\tboxhd: '\\u252C',\n\tboxHU: '\\u2569',\n\tboxHu: '\\u2567',\n\tboxhU: '\\u2568',\n\tboxhu: '\\u2534',\n\tboxminus: '\\u229F',\n\tboxplus: '\\u229E',\n\tboxtimes: '\\u22A0',\n\tboxUL: '\\u255D',\n\tboxUl: '\\u255C',\n\tboxuL: '\\u255B',\n\tboxul: '\\u2518',\n\tboxUR: '\\u255A',\n\tboxUr: '\\u2559',\n\tboxuR: '\\u2558',\n\tboxur: '\\u2514',\n\tboxV: '\\u2551',\n\tboxv: '\\u2502',\n\tboxVH: '\\u256C',\n\tboxVh: '\\u256B',\n\tboxvH: '\\u256A',\n\tboxvh: '\\u253C',\n\tboxVL: '\\u2563',\n\tboxVl: '\\u2562',\n\tboxvL: '\\u2561',\n\tboxvl: '\\u2524',\n\tboxVR: '\\u2560',\n\tboxVr: '\\u255F',\n\tboxvR: '\\u255E',\n\tboxvr: '\\u251C',\n\tbprime: '\\u2035',\n\tBreve: '\\u02D8',\n\tbreve: '\\u02D8',\n\tbrvbar: '\\u00A6',\n\tBscr: '\\u212C',\n\tbscr: '\\uD835\\uDCB7',\n\tbsemi: '\\u204F',\n\tbsim: '\\u223D',\n\tbsime: '\\u22CD',\n\tbsol: '\\u005C',\n\tbsolb: '\\u29C5',\n\tbsolhsub: '\\u27C8',\n\tbull: '\\u2022',\n\tbullet: '\\u2022',\n\tbump: '\\u224E',\n\tbumpE: '\\u2AAE',\n\tbumpe: '\\u224F',\n\tBumpeq: '\\u224E',\n\tbumpeq: '\\u224F',\n\tCacute: '\\u0106',\n\tcacute: '\\u0107',\n\tCap: '\\u22D2',\n\tcap: '\\u2229',\n\tcapand: '\\u2A44',\n\tcapbrcup: '\\u2A49',\n\tcapcap: '\\u2A4B',\n\tcapcup: '\\u2A47',\n\tcapdot: '\\u2A40',\n\tCapitalDifferentialD: '\\u2145',\n\tcaps: '\\u2229\\uFE00',\n\tcaret: '\\u2041',\n\tcaron: '\\u02C7',\n\tCayleys: '\\u212D',\n\tccaps: '\\u2A4D',\n\tCcaron: '\\u010C',\n\tccaron: '\\u010D',\n\tCcedil: '\\u00C7',\n\tccedil: '\\u00E7',\n\tCcirc: '\\u0108',\n\tccirc: '\\u0109',\n\tCconint: '\\u2230',\n\tccups: '\\u2A4C',\n\tccupssm: '\\u2A50',\n\tCdot: '\\u010A',\n\tcdot: '\\u010B',\n\tcedil: '\\u00B8',\n\tCedilla: '\\u00B8',\n\tcemptyv: '\\u29B2',\n\tcent: '\\u00A2',\n\tCenterDot: '\\u00B7',\n\tcenterdot: '\\u00B7',\n\tCfr: '\\u212D',\n\tcfr: '\\uD835\\uDD20',\n\tCHcy: '\\u0427',\n\tchcy: '\\u0447',\n\tcheck: '\\u2713',\n\tcheckmark: '\\u2713',\n\tChi: '\\u03A7',\n\tchi: '\\u03C7',\n\tcir: '\\u25CB',\n\tcirc: '\\u02C6',\n\tcirceq: '\\u2257',\n\tcirclearrowleft: '\\u21BA',\n\tcirclearrowright: '\\u21BB',\n\tcircledast: '\\u229B',\n\tcircledcirc: '\\u229A',\n\tcircleddash: '\\u229D',\n\tCircleDot: '\\u2299',\n\tcircledR: '\\u00AE',\n\tcircledS: '\\u24C8',\n\tCircleMinus: '\\u2296',\n\tCirclePlus: '\\u2295',\n\tCircleTimes: '\\u2297',\n\tcirE: '\\u29C3',\n\tcire: '\\u2257',\n\tcirfnint: '\\u2A10',\n\tcirmid: '\\u2AEF',\n\tcirscir: '\\u29C2',\n\tClockwiseContourIntegral: '\\u2232',\n\tCloseCurlyDoubleQuote: '\\u201D',\n\tCloseCurlyQuote: '\\u2019',\n\tclubs: '\\u2663',\n\tclubsuit: '\\u2663',\n\tColon: '\\u2237',\n\tcolon: '\\u003A',\n\tColone: '\\u2A74',\n\tcolone: '\\u2254',\n\tcoloneq: '\\u2254',\n\tcomma: '\\u002C',\n\tcommat: '\\u0040',\n\tcomp: '\\u2201',\n\tcompfn: '\\u2218',\n\tcomplement: '\\u2201',\n\tcomplexes: '\\u2102',\n\tcong: '\\u2245',\n\tcongdot: '\\u2A6D',\n\tCongruent: '\\u2261',\n\tConint: '\\u222F',\n\tconint: '\\u222E',\n\tContourIntegral: '\\u222E',\n\tCopf: '\\u2102',\n\tcopf: '\\uD835\\uDD54',\n\tcoprod: '\\u2210',\n\tCoproduct: '\\u2210',\n\tCOPY: '\\u00A9',\n\tcopy: '\\u00A9',\n\tcopysr: '\\u2117',\n\tCounterClockwiseContourIntegral: '\\u2233',\n\tcrarr: '\\u21B5',\n\tCross: '\\u2A2F',\n\tcross: '\\u2717',\n\tCscr: '\\uD835\\uDC9E',\n\tcscr: '\\uD835\\uDCB8',\n\tcsub: '\\u2ACF',\n\tcsube: '\\u2AD1',\n\tcsup: '\\u2AD0',\n\tcsupe: '\\u2AD2',\n\tctdot: '\\u22EF',\n\tcudarrl: '\\u2938',\n\tcudarrr: '\\u2935',\n\tcuepr: '\\u22DE',\n\tcuesc: '\\u22DF',\n\tcularr: '\\u21B6',\n\tcularrp: '\\u293D',\n\tCup: '\\u22D3',\n\tcup: '\\u222A',\n\tcupbrcap: '\\u2A48',\n\tCupCap: '\\u224D',\n\tcupcap: '\\u2A46',\n\tcupcup: '\\u2A4A',\n\tcupdot: '\\u228D',\n\tcupor: '\\u2A45',\n\tcups: '\\u222A\\uFE00',\n\tcurarr: '\\u21B7',\n\tcurarrm: '\\u293C',\n\tcurlyeqprec: '\\u22DE',\n\tcurlyeqsucc: '\\u22DF',\n\tcurlyvee: '\\u22CE',\n\tcurlywedge: '\\u22CF',\n\tcurren: '\\u00A4',\n\tcurvearrowleft: '\\u21B6',\n\tcurvearrowright: '\\u21B7',\n\tcuvee: '\\u22CE',\n\tcuwed: '\\u22CF',\n\tcwconint: '\\u2232',\n\tcwint: '\\u2231',\n\tcylcty: '\\u232D',\n\tDagger: '\\u2021',\n\tdagger: '\\u2020',\n\tdaleth: '\\u2138',\n\tDarr: '\\u21A1',\n\tdArr: '\\u21D3',\n\tdarr: '\\u2193',\n\tdash: '\\u2010',\n\tDashv: '\\u2AE4',\n\tdashv: '\\u22A3',\n\tdbkarow: '\\u290F',\n\tdblac: '\\u02DD',\n\tDcaron: '\\u010E',\n\tdcaron: '\\u010F',\n\tDcy: '\\u0414',\n\tdcy: '\\u0434',\n\tDD: '\\u2145',\n\tdd: '\\u2146',\n\tddagger: '\\u2021',\n\tddarr: '\\u21CA',\n\tDDotrahd: '\\u2911',\n\tddotseq: '\\u2A77',\n\tdeg: '\\u00B0',\n\tDel: '\\u2207',\n\tDelta: '\\u0394',\n\tdelta: '\\u03B4',\n\tdemptyv: '\\u29B1',\n\tdfisht: '\\u297F',\n\tDfr: '\\uD835\\uDD07',\n\tdfr: '\\uD835\\uDD21',\n\tdHar: '\\u2965',\n\tdharl: '\\u21C3',\n\tdharr: '\\u21C2',\n\tDiacriticalAcute: '\\u00B4',\n\tDiacriticalDot: '\\u02D9',\n\tDiacriticalDoubleAcute: '\\u02DD',\n\tDiacriticalGrave: '\\u0060',\n\tDiacriticalTilde: '\\u02DC',\n\tdiam: '\\u22C4',\n\tDiamond: '\\u22C4',\n\tdiamond: '\\u22C4',\n\tdiamondsuit: '\\u2666',\n\tdiams: '\\u2666',\n\tdie: '\\u00A8',\n\tDifferentialD: '\\u2146',\n\tdigamma: '\\u03DD',\n\tdisin: '\\u22F2',\n\tdiv: '\\u00F7',\n\tdivide: '\\u00F7',\n\tdivideontimes: '\\u22C7',\n\tdivonx: '\\u22C7',\n\tDJcy: '\\u0402',\n\tdjcy: '\\u0452',\n\tdlcorn: '\\u231E',\n\tdlcrop: '\\u230D',\n\tdollar: '\\u0024',\n\tDopf: '\\uD835\\uDD3B',\n\tdopf: '\\uD835\\uDD55',\n\tDot: '\\u00A8',\n\tdot: '\\u02D9',\n\tDotDot: '\\u20DC',\n\tdoteq: '\\u2250',\n\tdoteqdot: '\\u2251',\n\tDotEqual: '\\u2250',\n\tdotminus: '\\u2238',\n\tdotplus: '\\u2214',\n\tdotsquare: '\\u22A1',\n\tdoublebarwedge: '\\u2306',\n\tDoubleContourIntegral: '\\u222F',\n\tDoubleDot: '\\u00A8',\n\tDoubleDownArrow: '\\u21D3',\n\tDoubleLeftArrow: '\\u21D0',\n\tDoubleLeftRightArrow: '\\u21D4',\n\tDoubleLeftTee: '\\u2AE4',\n\tDoubleLongLeftArrow: '\\u27F8',\n\tDoubleLongLeftRightArrow: '\\u27FA',\n\tDoubleLongRightArrow: '\\u27F9',\n\tDoubleRightArrow: '\\u21D2',\n\tDoubleRightTee: '\\u22A8',\n\tDoubleUpArrow: '\\u21D1',\n\tDoubleUpDownArrow: '\\u21D5',\n\tDoubleVerticalBar: '\\u2225',\n\tDownArrow: '\\u2193',\n\tDownarrow: '\\u21D3',\n\tdownarrow: '\\u2193',\n\tDownArrowBar: '\\u2913',\n\tDownArrowUpArrow: '\\u21F5',\n\tDownBreve: '\\u0311',\n\tdowndownarrows: '\\u21CA',\n\tdownharpoonleft: '\\u21C3',\n\tdownharpoonright: '\\u21C2',\n\tDownLeftRightVector: '\\u2950',\n\tDownLeftTeeVector: '\\u295E',\n\tDownLeftVector: '\\u21BD',\n\tDownLeftVectorBar: '\\u2956',\n\tDownRightTeeVector: '\\u295F',\n\tDownRightVector: '\\u21C1',\n\tDownRightVectorBar: '\\u2957',\n\tDownTee: '\\u22A4',\n\tDownTeeArrow: '\\u21A7',\n\tdrbkarow: '\\u2910',\n\tdrcorn: '\\u231F',\n\tdrcrop: '\\u230C',\n\tDscr: '\\uD835\\uDC9F',\n\tdscr: '\\uD835\\uDCB9',\n\tDScy: '\\u0405',\n\tdscy: '\\u0455',\n\tdsol: '\\u29F6',\n\tDstrok: '\\u0110',\n\tdstrok: '\\u0111',\n\tdtdot: '\\u22F1',\n\tdtri: '\\u25BF',\n\tdtrif: '\\u25BE',\n\tduarr: '\\u21F5',\n\tduhar: '\\u296F',\n\tdwangle: '\\u29A6',\n\tDZcy: '\\u040F',\n\tdzcy: '\\u045F',\n\tdzigrarr: '\\u27FF',\n\tEacute: '\\u00C9',\n\teacute: '\\u00E9',\n\teaster: '\\u2A6E',\n\tEcaron: '\\u011A',\n\tecaron: '\\u011B',\n\tecir: '\\u2256',\n\tEcirc: '\\u00CA',\n\tecirc: '\\u00EA',\n\tecolon: '\\u2255',\n\tEcy: '\\u042D',\n\tecy: '\\u044D',\n\teDDot: '\\u2A77',\n\tEdot: '\\u0116',\n\teDot: '\\u2251',\n\tedot: '\\u0117',\n\tee: '\\u2147',\n\tefDot: '\\u2252',\n\tEfr: '\\uD835\\uDD08',\n\tefr: '\\uD835\\uDD22',\n\teg: '\\u2A9A',\n\tEgrave: '\\u00C8',\n\tegrave: '\\u00E8',\n\tegs: '\\u2A96',\n\tegsdot: '\\u2A98',\n\tel: '\\u2A99',\n\tElement: '\\u2208',\n\telinters: '\\u23E7',\n\tell: '\\u2113',\n\tels: '\\u2A95',\n\telsdot: '\\u2A97',\n\tEmacr: '\\u0112',\n\temacr: '\\u0113',\n\tempty: '\\u2205',\n\temptyset: '\\u2205',\n\tEmptySmallSquare: '\\u25FB',\n\temptyv: '\\u2205',\n\tEmptyVerySmallSquare: '\\u25AB',\n\temsp: '\\u2003',\n\temsp13: '\\u2004',\n\temsp14: '\\u2005',\n\tENG: '\\u014A',\n\teng: '\\u014B',\n\tensp: '\\u2002',\n\tEogon: '\\u0118',\n\teogon: '\\u0119',\n\tEopf: '\\uD835\\uDD3C',\n\teopf: '\\uD835\\uDD56',\n\tepar: '\\u22D5',\n\teparsl: '\\u29E3',\n\teplus: '\\u2A71',\n\tepsi: '\\u03B5',\n\tEpsilon: '\\u0395',\n\tepsilon: '\\u03B5',\n\tepsiv: '\\u03F5',\n\teqcirc: '\\u2256',\n\teqcolon: '\\u2255',\n\teqsim: '\\u2242',\n\teqslantgtr: '\\u2A96',\n\teqslantless: '\\u2A95',\n\tEqual: '\\u2A75',\n\tequals: '\\u003D',\n\tEqualTilde: '\\u2242',\n\tequest: '\\u225F',\n\tEquilibrium: '\\u21CC',\n\tequiv: '\\u2261',\n\tequivDD: '\\u2A78',\n\teqvparsl: '\\u29E5',\n\terarr: '\\u2971',\n\terDot: '\\u2253',\n\tEscr: '\\u2130',\n\tescr: '\\u212F',\n\tesdot: '\\u2250',\n\tEsim: '\\u2A73',\n\tesim: '\\u2242',\n\tEta: '\\u0397',\n\teta: '\\u03B7',\n\tETH: '\\u00D0',\n\teth: '\\u00F0',\n\tEuml: '\\u00CB',\n\teuml: '\\u00EB',\n\teuro: '\\u20AC',\n\texcl: '\\u0021',\n\texist: '\\u2203',\n\tExists: '\\u2203',\n\texpectation: '\\u2130',\n\tExponentialE: '\\u2147',\n\texponentiale: '\\u2147',\n\tfallingdotseq: '\\u2252',\n\tFcy: '\\u0424',\n\tfcy: '\\u0444',\n\tfemale: '\\u2640',\n\tffilig: '\\uFB03',\n\tfflig: '\\uFB00',\n\tffllig: '\\uFB04',\n\tFfr: '\\uD835\\uDD09',\n\tffr: '\\uD835\\uDD23',\n\tfilig: '\\uFB01',\n\tFilledSmallSquare: '\\u25FC',\n\tFilledVerySmallSquare: '\\u25AA',\n\tfjlig: '\\u0066\\u006A',\n\tflat: '\\u266D',\n\tfllig: '\\uFB02',\n\tfltns: '\\u25B1',\n\tfnof: '\\u0192',\n\tFopf: '\\uD835\\uDD3D',\n\tfopf: '\\uD835\\uDD57',\n\tForAll: '\\u2200',\n\tforall: '\\u2200',\n\tfork: '\\u22D4',\n\tforkv: '\\u2AD9',\n\tFouriertrf: '\\u2131',\n\tfpartint: '\\u2A0D',\n\tfrac12: '\\u00BD',\n\tfrac13: '\\u2153',\n\tfrac14: '\\u00BC',\n\tfrac15: '\\u2155',\n\tfrac16: '\\u2159',\n\tfrac18: '\\u215B',\n\tfrac23: '\\u2154',\n\tfrac25: '\\u2156',\n\tfrac34: '\\u00BE',\n\tfrac35: '\\u2157',\n\tfrac38: '\\u215C',\n\tfrac45: '\\u2158',\n\tfrac56: '\\u215A',\n\tfrac58: '\\u215D',\n\tfrac78: '\\u215E',\n\tfrasl: '\\u2044',\n\tfrown: '\\u2322',\n\tFscr: '\\u2131',\n\tfscr: '\\uD835\\uDCBB',\n\tgacute: '\\u01F5',\n\tGamma: '\\u0393',\n\tgamma: '\\u03B3',\n\tGammad: '\\u03DC',\n\tgammad: '\\u03DD',\n\tgap: '\\u2A86',\n\tGbreve: '\\u011E',\n\tgbreve: '\\u011F',\n\tGcedil: '\\u0122',\n\tGcirc: '\\u011C',\n\tgcirc: '\\u011D',\n\tGcy: '\\u0413',\n\tgcy: '\\u0433',\n\tGdot: '\\u0120',\n\tgdot: '\\u0121',\n\tgE: '\\u2267',\n\tge: '\\u2265',\n\tgEl: '\\u2A8C',\n\tgel: '\\u22DB',\n\tgeq: '\\u2265',\n\tgeqq: '\\u2267',\n\tgeqslant: '\\u2A7E',\n\tges: '\\u2A7E',\n\tgescc: '\\u2AA9',\n\tgesdot: '\\u2A80',\n\tgesdoto: '\\u2A82',\n\tgesdotol: '\\u2A84',\n\tgesl: '\\u22DB\\uFE00',\n\tgesles: '\\u2A94',\n\tGfr: '\\uD835\\uDD0A',\n\tgfr: '\\uD835\\uDD24',\n\tGg: '\\u22D9',\n\tgg: '\\u226B',\n\tggg: '\\u22D9',\n\tgimel: '\\u2137',\n\tGJcy: '\\u0403',\n\tgjcy: '\\u0453',\n\tgl: '\\u2277',\n\tgla: '\\u2AA5',\n\tglE: '\\u2A92',\n\tglj: '\\u2AA4',\n\tgnap: '\\u2A8A',\n\tgnapprox: '\\u2A8A',\n\tgnE: '\\u2269',\n\tgne: '\\u2A88',\n\tgneq: '\\u2A88',\n\tgneqq: '\\u2269',\n\tgnsim: '\\u22E7',\n\tGopf: '\\uD835\\uDD3E',\n\tgopf: '\\uD835\\uDD58',\n\tgrave: '\\u0060',\n\tGreaterEqual: '\\u2265',\n\tGreaterEqualLess: '\\u22DB',\n\tGreaterFullEqual: '\\u2267',\n\tGreaterGreater: '\\u2AA2',\n\tGreaterLess: '\\u2277',\n\tGreaterSlantEqual: '\\u2A7E',\n\tGreaterTilde: '\\u2273',\n\tGscr: '\\uD835\\uDCA2',\n\tgscr: '\\u210A',\n\tgsim: '\\u2273',\n\tgsime: '\\u2A8E',\n\tgsiml: '\\u2A90',\n\tGt: '\\u226B',\n\tGT: '\\u003E',\n\tgt: '\\u003E',\n\tgtcc: '\\u2AA7',\n\tgtcir: '\\u2A7A',\n\tgtdot: '\\u22D7',\n\tgtlPar: '\\u2995',\n\tgtquest: '\\u2A7C',\n\tgtrapprox: '\\u2A86',\n\tgtrarr: '\\u2978',\n\tgtrdot: '\\u22D7',\n\tgtreqless: '\\u22DB',\n\tgtreqqless: '\\u2A8C',\n\tgtrless: '\\u2277',\n\tgtrsim: '\\u2273',\n\tgvertneqq: '\\u2269\\uFE00',\n\tgvnE: '\\u2269\\uFE00',\n\tHacek: '\\u02C7',\n\thairsp: '\\u200A',\n\thalf: '\\u00BD',\n\thamilt: '\\u210B',\n\tHARDcy: '\\u042A',\n\thardcy: '\\u044A',\n\thArr: '\\u21D4',\n\tharr: '\\u2194',\n\tharrcir: '\\u2948',\n\tharrw: '\\u21AD',\n\tHat: '\\u005E',\n\thbar: '\\u210F',\n\tHcirc: '\\u0124',\n\thcirc: '\\u0125',\n\thearts: '\\u2665',\n\theartsuit: '\\u2665',\n\thellip: '\\u2026',\n\thercon: '\\u22B9',\n\tHfr: '\\u210C',\n\thfr: '\\uD835\\uDD25',\n\tHilbertSpace: '\\u210B',\n\thksearow: '\\u2925',\n\thkswarow: '\\u2926',\n\thoarr: '\\u21FF',\n\thomtht: '\\u223B',\n\thookleftarrow: '\\u21A9',\n\thookrightarrow: '\\u21AA',\n\tHopf: '\\u210D',\n\thopf: '\\uD835\\uDD59',\n\thorbar: '\\u2015',\n\tHorizontalLine: '\\u2500',\n\tHscr: '\\u210B',\n\thscr: '\\uD835\\uDCBD',\n\thslash: '\\u210F',\n\tHstrok: '\\u0126',\n\thstrok: '\\u0127',\n\tHumpDownHump: '\\u224E',\n\tHumpEqual: '\\u224F',\n\thybull: '\\u2043',\n\thyphen: '\\u2010',\n\tIacute: '\\u00CD',\n\tiacute: '\\u00ED',\n\tic: '\\u2063',\n\tIcirc: '\\u00CE',\n\ticirc: '\\u00EE',\n\tIcy: '\\u0418',\n\ticy: '\\u0438',\n\tIdot: '\\u0130',\n\tIEcy: '\\u0415',\n\tiecy: '\\u0435',\n\tiexcl: '\\u00A1',\n\tiff: '\\u21D4',\n\tIfr: '\\u2111',\n\tifr: '\\uD835\\uDD26',\n\tIgrave: '\\u00CC',\n\tigrave: '\\u00EC',\n\tii: '\\u2148',\n\tiiiint: '\\u2A0C',\n\tiiint: '\\u222D',\n\tiinfin: '\\u29DC',\n\tiiota: '\\u2129',\n\tIJlig: '\\u0132',\n\tijlig: '\\u0133',\n\tIm: '\\u2111',\n\tImacr: '\\u012A',\n\timacr: '\\u012B',\n\timage: '\\u2111',\n\tImaginaryI: '\\u2148',\n\timagline: '\\u2110',\n\timagpart: '\\u2111',\n\timath: '\\u0131',\n\timof: '\\u22B7',\n\timped: '\\u01B5',\n\tImplies: '\\u21D2',\n\tin: '\\u2208',\n\tincare: '\\u2105',\n\tinfin: '\\u221E',\n\tinfintie: '\\u29DD',\n\tinodot: '\\u0131',\n\tInt: '\\u222C',\n\tint: '\\u222B',\n\tintcal: '\\u22BA',\n\tintegers: '\\u2124',\n\tIntegral: '\\u222B',\n\tintercal: '\\u22BA',\n\tIntersection: '\\u22C2',\n\tintlarhk: '\\u2A17',\n\tintprod: '\\u2A3C',\n\tInvisibleComma: '\\u2063',\n\tInvisibleTimes: '\\u2062',\n\tIOcy: '\\u0401',\n\tiocy: '\\u0451',\n\tIogon: '\\u012E',\n\tiogon: '\\u012F',\n\tIopf: '\\uD835\\uDD40',\n\tiopf: '\\uD835\\uDD5A',\n\tIota: '\\u0399',\n\tiota: '\\u03B9',\n\tiprod: '\\u2A3C',\n\tiquest: '\\u00BF',\n\tIscr: '\\u2110',\n\tiscr: '\\uD835\\uDCBE',\n\tisin: '\\u2208',\n\tisindot: '\\u22F5',\n\tisinE: '\\u22F9',\n\tisins: '\\u22F4',\n\tisinsv: '\\u22F3',\n\tisinv: '\\u2208',\n\tit: '\\u2062',\n\tItilde: '\\u0128',\n\titilde: '\\u0129',\n\tIukcy: '\\u0406',\n\tiukcy: '\\u0456',\n\tIuml: '\\u00CF',\n\tiuml: '\\u00EF',\n\tJcirc: '\\u0134',\n\tjcirc: '\\u0135',\n\tJcy: '\\u0419',\n\tjcy: '\\u0439',\n\tJfr: '\\uD835\\uDD0D',\n\tjfr: '\\uD835\\uDD27',\n\tjmath: '\\u0237',\n\tJopf: '\\uD835\\uDD41',\n\tjopf: '\\uD835\\uDD5B',\n\tJscr: '\\uD835\\uDCA5',\n\tjscr: '\\uD835\\uDCBF',\n\tJsercy: '\\u0408',\n\tjsercy: '\\u0458',\n\tJukcy: '\\u0404',\n\tjukcy: '\\u0454',\n\tKappa: '\\u039A',\n\tkappa: '\\u03BA',\n\tkappav: '\\u03F0',\n\tKcedil: '\\u0136',\n\tkcedil: '\\u0137',\n\tKcy: '\\u041A',\n\tkcy: '\\u043A',\n\tKfr: '\\uD835\\uDD0E',\n\tkfr: '\\uD835\\uDD28',\n\tkgreen: '\\u0138',\n\tKHcy: '\\u0425',\n\tkhcy: '\\u0445',\n\tKJcy: '\\u040C',\n\tkjcy: '\\u045C',\n\tKopf: '\\uD835\\uDD42',\n\tkopf: '\\uD835\\uDD5C',\n\tKscr: '\\uD835\\uDCA6',\n\tkscr: '\\uD835\\uDCC0',\n\tlAarr: '\\u21DA',\n\tLacute: '\\u0139',\n\tlacute: '\\u013A',\n\tlaemptyv: '\\u29B4',\n\tlagran: '\\u2112',\n\tLambda: '\\u039B',\n\tlambda: '\\u03BB',\n\tLang: '\\u27EA',\n\tlang: '\\u27E8',\n\tlangd: '\\u2991',\n\tlangle: '\\u27E8',\n\tlap: '\\u2A85',\n\tLaplacetrf: '\\u2112',\n\tlaquo: '\\u00AB',\n\tLarr: '\\u219E',\n\tlArr: '\\u21D0',\n\tlarr: '\\u2190',\n\tlarrb: '\\u21E4',\n\tlarrbfs: '\\u291F',\n\tlarrfs: '\\u291D',\n\tlarrhk: '\\u21A9',\n\tlarrlp: '\\u21AB',\n\tlarrpl: '\\u2939',\n\tlarrsim: '\\u2973',\n\tlarrtl: '\\u21A2',\n\tlat: '\\u2AAB',\n\tlAtail: '\\u291B',\n\tlatail: '\\u2919',\n\tlate: '\\u2AAD',\n\tlates: '\\u2AAD\\uFE00',\n\tlBarr: '\\u290E',\n\tlbarr: '\\u290C',\n\tlbbrk: '\\u2772',\n\tlbrace: '\\u007B',\n\tlbrack: '\\u005B',\n\tlbrke: '\\u298B',\n\tlbrksld: '\\u298F',\n\tlbrkslu: '\\u298D',\n\tLcaron: '\\u013D',\n\tlcaron: '\\u013E',\n\tLcedil: '\\u013B',\n\tlcedil: '\\u013C',\n\tlceil: '\\u2308',\n\tlcub: '\\u007B',\n\tLcy: '\\u041B',\n\tlcy: '\\u043B',\n\tldca: '\\u2936',\n\tldquo: '\\u201C',\n\tldquor: '\\u201E',\n\tldrdhar: '\\u2967',\n\tldrushar: '\\u294B',\n\tldsh: '\\u21B2',\n\tlE: '\\u2266',\n\tle: '\\u2264',\n\tLeftAngleBracket: '\\u27E8',\n\tLeftArrow: '\\u2190',\n\tLeftarrow: '\\u21D0',\n\tleftarrow: '\\u2190',\n\tLeftArrowBar: '\\u21E4',\n\tLeftArrowRightArrow: '\\u21C6',\n\tleftarrowtail: '\\u21A2',\n\tLeftCeiling: '\\u2308',\n\tLeftDoubleBracket: '\\u27E6',\n\tLeftDownTeeVector: '\\u2961',\n\tLeftDownVector: '\\u21C3',\n\tLeftDownVectorBar: '\\u2959',\n\tLeftFloor: '\\u230A',\n\tleftharpoondown: '\\u21BD',\n\tleftharpoonup: '\\u21BC',\n\tleftleftarrows: '\\u21C7',\n\tLeftRightArrow: '\\u2194',\n\tLeftrightarrow: '\\u21D4',\n\tleftrightarrow: '\\u2194',\n\tleftrightarrows: '\\u21C6',\n\tleftrightharpoons: '\\u21CB',\n\tleftrightsquigarrow: '\\u21AD',\n\tLeftRightVector: '\\u294E',\n\tLeftTee: '\\u22A3',\n\tLeftTeeArrow: '\\u21A4',\n\tLeftTeeVector: '\\u295A',\n\tleftthreetimes: '\\u22CB',\n\tLeftTriangle: '\\u22B2',\n\tLeftTriangleBar: '\\u29CF',\n\tLeftTriangleEqual: '\\u22B4',\n\tLeftUpDownVector: '\\u2951',\n\tLeftUpTeeVector: '\\u2960',\n\tLeftUpVector: '\\u21BF',\n\tLeftUpVectorBar: '\\u2958',\n\tLeftVector: '\\u21BC',\n\tLeftVectorBar: '\\u2952',\n\tlEg: '\\u2A8B',\n\tleg: '\\u22DA',\n\tleq: '\\u2264',\n\tleqq: '\\u2266',\n\tleqslant: '\\u2A7D',\n\tles: '\\u2A7D',\n\tlescc: '\\u2AA8',\n\tlesdot: '\\u2A7F',\n\tlesdoto: '\\u2A81',\n\tlesdotor: '\\u2A83',\n\tlesg: '\\u22DA\\uFE00',\n\tlesges: '\\u2A93',\n\tlessapprox: '\\u2A85',\n\tlessdot: '\\u22D6',\n\tlesseqgtr: '\\u22DA',\n\tlesseqqgtr: '\\u2A8B',\n\tLessEqualGreater: '\\u22DA',\n\tLessFullEqual: '\\u2266',\n\tLessGreater: '\\u2276',\n\tlessgtr: '\\u2276',\n\tLessLess: '\\u2AA1',\n\tlesssim: '\\u2272',\n\tLessSlantEqual: '\\u2A7D',\n\tLessTilde: '\\u2272',\n\tlfisht: '\\u297C',\n\tlfloor: '\\u230A',\n\tLfr: '\\uD835\\uDD0F',\n\tlfr: '\\uD835\\uDD29',\n\tlg: '\\u2276',\n\tlgE: '\\u2A91',\n\tlHar: '\\u2962',\n\tlhard: '\\u21BD',\n\tlharu: '\\u21BC',\n\tlharul: '\\u296A',\n\tlhblk: '\\u2584',\n\tLJcy: '\\u0409',\n\tljcy: '\\u0459',\n\tLl: '\\u22D8',\n\tll: '\\u226A',\n\tllarr: '\\u21C7',\n\tllcorner: '\\u231E',\n\tLleftarrow: '\\u21DA',\n\tllhard: '\\u296B',\n\tlltri: '\\u25FA',\n\tLmidot: '\\u013F',\n\tlmidot: '\\u0140',\n\tlmoust: '\\u23B0',\n\tlmoustache: '\\u23B0',\n\tlnap: '\\u2A89',\n\tlnapprox: '\\u2A89',\n\tlnE: '\\u2268',\n\tlne: '\\u2A87',\n\tlneq: '\\u2A87',\n\tlneqq: '\\u2268',\n\tlnsim: '\\u22E6',\n\tloang: '\\u27EC',\n\tloarr: '\\u21FD',\n\tlobrk: '\\u27E6',\n\tLongLeftArrow: '\\u27F5',\n\tLongleftarrow: '\\u27F8',\n\tlongleftarrow: '\\u27F5',\n\tLongLeftRightArrow: '\\u27F7',\n\tLongleftrightarrow: '\\u27FA',\n\tlongleftrightarrow: '\\u27F7',\n\tlongmapsto: '\\u27FC',\n\tLongRightArrow: '\\u27F6',\n\tLongrightarrow: '\\u27F9',\n\tlongrightarrow: '\\u27F6',\n\tlooparrowleft: '\\u21AB',\n\tlooparrowright: '\\u21AC',\n\tlopar: '\\u2985',\n\tLopf: '\\uD835\\uDD43',\n\tlopf: '\\uD835\\uDD5D',\n\tloplus: '\\u2A2D',\n\tlotimes: '\\u2A34',\n\tlowast: '\\u2217',\n\tlowbar: '\\u005F',\n\tLowerLeftArrow: '\\u2199',\n\tLowerRightArrow: '\\u2198',\n\tloz: '\\u25CA',\n\tlozenge: '\\u25CA',\n\tlozf: '\\u29EB',\n\tlpar: '\\u0028',\n\tlparlt: '\\u2993',\n\tlrarr: '\\u21C6',\n\tlrcorner: '\\u231F',\n\tlrhar: '\\u21CB',\n\tlrhard: '\\u296D',\n\tlrm: '\\u200E',\n\tlrtri: '\\u22BF',\n\tlsaquo: '\\u2039',\n\tLscr: '\\u2112',\n\tlscr: '\\uD835\\uDCC1',\n\tLsh: '\\u21B0',\n\tlsh: '\\u21B0',\n\tlsim: '\\u2272',\n\tlsime: '\\u2A8D',\n\tlsimg: '\\u2A8F',\n\tlsqb: '\\u005B',\n\tlsquo: '\\u2018',\n\tlsquor: '\\u201A',\n\tLstrok: '\\u0141',\n\tlstrok: '\\u0142',\n\tLt: '\\u226A',\n\tLT: '\\u003C',\n\tlt: '\\u003C',\n\tltcc: '\\u2AA6',\n\tltcir: '\\u2A79',\n\tltdot: '\\u22D6',\n\tlthree: '\\u22CB',\n\tltimes: '\\u22C9',\n\tltlarr: '\\u2976',\n\tltquest: '\\u2A7B',\n\tltri: '\\u25C3',\n\tltrie: '\\u22B4',\n\tltrif: '\\u25C2',\n\tltrPar: '\\u2996',\n\tlurdshar: '\\u294A',\n\tluruhar: '\\u2966',\n\tlvertneqq: '\\u2268\\uFE00',\n\tlvnE: '\\u2268\\uFE00',\n\tmacr: '\\u00AF',\n\tmale: '\\u2642',\n\tmalt: '\\u2720',\n\tmaltese: '\\u2720',\n\tMap: '\\u2905',\n\tmap: '\\u21A6',\n\tmapsto: '\\u21A6',\n\tmapstodown: '\\u21A7',\n\tmapstoleft: '\\u21A4',\n\tmapstoup: '\\u21A5',\n\tmarker: '\\u25AE',\n\tmcomma: '\\u2A29',\n\tMcy: '\\u041C',\n\tmcy: '\\u043C',\n\tmdash: '\\u2014',\n\tmDDot: '\\u223A',\n\tmeasuredangle: '\\u2221',\n\tMediumSpace: '\\u205F',\n\tMellintrf: '\\u2133',\n\tMfr: '\\uD835\\uDD10',\n\tmfr: '\\uD835\\uDD2A',\n\tmho: '\\u2127',\n\tmicro: '\\u00B5',\n\tmid: '\\u2223',\n\tmidast: '\\u002A',\n\tmidcir: '\\u2AF0',\n\tmiddot: '\\u00B7',\n\tminus: '\\u2212',\n\tminusb: '\\u229F',\n\tminusd: '\\u2238',\n\tminusdu: '\\u2A2A',\n\tMinusPlus: '\\u2213',\n\tmlcp: '\\u2ADB',\n\tmldr: '\\u2026',\n\tmnplus: '\\u2213',\n\tmodels: '\\u22A7',\n\tMopf: '\\uD835\\uDD44',\n\tmopf: '\\uD835\\uDD5E',\n\tmp: '\\u2213',\n\tMscr: '\\u2133',\n\tmscr: '\\uD835\\uDCC2',\n\tmstpos: '\\u223E',\n\tMu: '\\u039C',\n\tmu: '\\u03BC',\n\tmultimap: '\\u22B8',\n\tmumap: '\\u22B8',\n\tnabla: '\\u2207',\n\tNacute: '\\u0143',\n\tnacute: '\\u0144',\n\tnang: '\\u2220\\u20D2',\n\tnap: '\\u2249',\n\tnapE: '\\u2A70\\u0338',\n\tnapid: '\\u224B\\u0338',\n\tnapos: '\\u0149',\n\tnapprox: '\\u2249',\n\tnatur: '\\u266E',\n\tnatural: '\\u266E',\n\tnaturals: '\\u2115',\n\tnbsp: '\\u00A0',\n\tnbump: '\\u224E\\u0338',\n\tnbumpe: '\\u224F\\u0338',\n\tncap: '\\u2A43',\n\tNcaron: '\\u0147',\n\tncaron: '\\u0148',\n\tNcedil: '\\u0145',\n\tncedil: '\\u0146',\n\tncong: '\\u2247',\n\tncongdot: '\\u2A6D\\u0338',\n\tncup: '\\u2A42',\n\tNcy: '\\u041D',\n\tncy: '\\u043D',\n\tndash: '\\u2013',\n\tne: '\\u2260',\n\tnearhk: '\\u2924',\n\tneArr: '\\u21D7',\n\tnearr: '\\u2197',\n\tnearrow: '\\u2197',\n\tnedot: '\\u2250\\u0338',\n\tNegativeMediumSpace: '\\u200B',\n\tNegativeThickSpace: '\\u200B',\n\tNegativeThinSpace: '\\u200B',\n\tNegativeVeryThinSpace: '\\u200B',\n\tnequiv: '\\u2262',\n\tnesear: '\\u2928',\n\tnesim: '\\u2242\\u0338',\n\tNestedGreaterGreater: '\\u226B',\n\tNestedLessLess: '\\u226A',\n\tNewLine: '\\u000A',\n\tnexist: '\\u2204',\n\tnexists: '\\u2204',\n\tNfr: '\\uD835\\uDD11',\n\tnfr: '\\uD835\\uDD2B',\n\tngE: '\\u2267\\u0338',\n\tnge: '\\u2271',\n\tngeq: '\\u2271',\n\tngeqq: '\\u2267\\u0338',\n\tngeqslant: '\\u2A7E\\u0338',\n\tnges: '\\u2A7E\\u0338',\n\tnGg: '\\u22D9\\u0338',\n\tngsim: '\\u2275',\n\tnGt: '\\u226B\\u20D2',\n\tngt: '\\u226F',\n\tngtr: '\\u226F',\n\tnGtv: '\\u226B\\u0338',\n\tnhArr: '\\u21CE',\n\tnharr: '\\u21AE',\n\tnhpar: '\\u2AF2',\n\tni: '\\u220B',\n\tnis: '\\u22FC',\n\tnisd: '\\u22FA',\n\tniv: '\\u220B',\n\tNJcy: '\\u040A',\n\tnjcy: '\\u045A',\n\tnlArr: '\\u21CD',\n\tnlarr: '\\u219A',\n\tnldr: '\\u2025',\n\tnlE: '\\u2266\\u0338',\n\tnle: '\\u2270',\n\tnLeftarrow: '\\u21CD',\n\tnleftarrow: '\\u219A',\n\tnLeftrightarrow: '\\u21CE',\n\tnleftrightarrow: '\\u21AE',\n\tnleq: '\\u2270',\n\tnleqq: '\\u2266\\u0338',\n\tnleqslant: '\\u2A7D\\u0338',\n\tnles: '\\u2A7D\\u0338',\n\tnless: '\\u226E',\n\tnLl: '\\u22D8\\u0338',\n\tnlsim: '\\u2274',\n\tnLt: '\\u226A\\u20D2',\n\tnlt: '\\u226E',\n\tnltri: '\\u22EA',\n\tnltrie: '\\u22EC',\n\tnLtv: '\\u226A\\u0338',\n\tnmid: '\\u2224',\n\tNoBreak: '\\u2060',\n\tNonBreakingSpace: '\\u00A0',\n\tNopf: '\\u2115',\n\tnopf: '\\uD835\\uDD5F',\n\tNot: '\\u2AEC',\n\tnot: '\\u00AC',\n\tNotCongruent: '\\u2262',\n\tNotCupCap: '\\u226D',\n\tNotDoubleVerticalBar: '\\u2226',\n\tNotElement: '\\u2209',\n\tNotEqual: '\\u2260',\n\tNotEqualTilde: '\\u2242\\u0338',\n\tNotExists: '\\u2204',\n\tNotGreater: '\\u226F',\n\tNotGreaterEqual: '\\u2271',\n\tNotGreaterFullEqual: '\\u2267\\u0338',\n\tNotGreaterGreater: '\\u226B\\u0338',\n\tNotGreaterLess: '\\u2279',\n\tNotGreaterSlantEqual: '\\u2A7E\\u0338',\n\tNotGreaterTilde: '\\u2275',\n\tNotHumpDownHump: '\\u224E\\u0338',\n\tNotHumpEqual: '\\u224F\\u0338',\n\tnotin: '\\u2209',\n\tnotindot: '\\u22F5\\u0338',\n\tnotinE: '\\u22F9\\u0338',\n\tnotinva: '\\u2209',\n\tnotinvb: '\\u22F7',\n\tnotinvc: '\\u22F6',\n\tNotLeftTriangle: '\\u22EA',\n\tNotLeftTriangleBar: '\\u29CF\\u0338',\n\tNotLeftTriangleEqual: '\\u22EC',\n\tNotLess: '\\u226E',\n\tNotLessEqual: '\\u2270',\n\tNotLessGreater: '\\u2278',\n\tNotLessLess: '\\u226A\\u0338',\n\tNotLessSlantEqual: '\\u2A7D\\u0338',\n\tNotLessTilde: '\\u2274',\n\tNotNestedGreaterGreater: '\\u2AA2\\u0338',\n\tNotNestedLessLess: '\\u2AA1\\u0338',\n\tnotni: '\\u220C',\n\tnotniva: '\\u220C',\n\tnotnivb: '\\u22FE',\n\tnotnivc: '\\u22FD',\n\tNotPrecedes: '\\u2280',\n\tNotPrecedesEqual: '\\u2AAF\\u0338',\n\tNotPrecedesSlantEqual: '\\u22E0',\n\tNotReverseElement: '\\u220C',\n\tNotRightTriangle: '\\u22EB',\n\tNotRightTriangleBar: '\\u29D0\\u0338',\n\tNotRightTriangleEqual: '\\u22ED',\n\tNotSquareSubset: '\\u228F\\u0338',\n\tNotSquareSubsetEqual: '\\u22E2',\n\tNotSquareSuperset: '\\u2290\\u0338',\n\tNotSquareSupersetEqual: '\\u22E3',\n\tNotSubset: '\\u2282\\u20D2',\n\tNotSubsetEqual: '\\u2288',\n\tNotSucceeds: '\\u2281',\n\tNotSucceedsEqual: '\\u2AB0\\u0338',\n\tNotSucceedsSlantEqual: '\\u22E1',\n\tNotSucceedsTilde: '\\u227F\\u0338',\n\tNotSuperset: '\\u2283\\u20D2',\n\tNotSupersetEqual: '\\u2289',\n\tNotTilde: '\\u2241',\n\tNotTildeEqual: '\\u2244',\n\tNotTildeFullEqual: '\\u2247',\n\tNotTildeTilde: '\\u2249',\n\tNotVerticalBar: '\\u2224',\n\tnpar: '\\u2226',\n\tnparallel: '\\u2226',\n\tnparsl: '\\u2AFD\\u20E5',\n\tnpart: '\\u2202\\u0338',\n\tnpolint: '\\u2A14',\n\tnpr: '\\u2280',\n\tnprcue: '\\u22E0',\n\tnpre: '\\u2AAF\\u0338',\n\tnprec: '\\u2280',\n\tnpreceq: '\\u2AAF\\u0338',\n\tnrArr: '\\u21CF',\n\tnrarr: '\\u219B',\n\tnrarrc: '\\u2933\\u0338',\n\tnrarrw: '\\u219D\\u0338',\n\tnRightarrow: '\\u21CF',\n\tnrightarrow: '\\u219B',\n\tnrtri: '\\u22EB',\n\tnrtrie: '\\u22ED',\n\tnsc: '\\u2281',\n\tnsccue: '\\u22E1',\n\tnsce: '\\u2AB0\\u0338',\n\tNscr: '\\uD835\\uDCA9',\n\tnscr: '\\uD835\\uDCC3',\n\tnshortmid: '\\u2224',\n\tnshortparallel: '\\u2226',\n\tnsim: '\\u2241',\n\tnsime: '\\u2244',\n\tnsimeq: '\\u2244',\n\tnsmid: '\\u2224',\n\tnspar: '\\u2226',\n\tnsqsube: '\\u22E2',\n\tnsqsupe: '\\u22E3',\n\tnsub: '\\u2284',\n\tnsubE: '\\u2AC5\\u0338',\n\tnsube: '\\u2288',\n\tnsubset: '\\u2282\\u20D2',\n\tnsubseteq: '\\u2288',\n\tnsubseteqq: '\\u2AC5\\u0338',\n\tnsucc: '\\u2281',\n\tnsucceq: '\\u2AB0\\u0338',\n\tnsup: '\\u2285',\n\tnsupE: '\\u2AC6\\u0338',\n\tnsupe: '\\u2289',\n\tnsupset: '\\u2283\\u20D2',\n\tnsupseteq: '\\u2289',\n\tnsupseteqq: '\\u2AC6\\u0338',\n\tntgl: '\\u2279',\n\tNtilde: '\\u00D1',\n\tntilde: '\\u00F1',\n\tntlg: '\\u2278',\n\tntriangleleft: '\\u22EA',\n\tntrianglelefteq: '\\u22EC',\n\tntriangleright: '\\u22EB',\n\tntrianglerighteq: '\\u22ED',\n\tNu: '\\u039D',\n\tnu: '\\u03BD',\n\tnum: '\\u0023',\n\tnumero: '\\u2116',\n\tnumsp: '\\u2007',\n\tnvap: '\\u224D\\u20D2',\n\tnVDash: '\\u22AF',\n\tnVdash: '\\u22AE',\n\tnvDash: '\\u22AD',\n\tnvdash: '\\u22AC',\n\tnvge: '\\u2265\\u20D2',\n\tnvgt: '\\u003E\\u20D2',\n\tnvHarr: '\\u2904',\n\tnvinfin: '\\u29DE',\n\tnvlArr: '\\u2902',\n\tnvle: '\\u2264\\u20D2',\n\tnvlt: '\\u003C\\u20D2',\n\tnvltrie: '\\u22B4\\u20D2',\n\tnvrArr: '\\u2903',\n\tnvrtrie: '\\u22B5\\u20D2',\n\tnvsim: '\\u223C\\u20D2',\n\tnwarhk: '\\u2923',\n\tnwArr: '\\u21D6',\n\tnwarr: '\\u2196',\n\tnwarrow: '\\u2196',\n\tnwnear: '\\u2927',\n\tOacute: '\\u00D3',\n\toacute: '\\u00F3',\n\toast: '\\u229B',\n\tocir: '\\u229A',\n\tOcirc: '\\u00D4',\n\tocirc: '\\u00F4',\n\tOcy: '\\u041E',\n\tocy: '\\u043E',\n\todash: '\\u229D',\n\tOdblac: '\\u0150',\n\todblac: '\\u0151',\n\todiv: '\\u2A38',\n\todot: '\\u2299',\n\todsold: '\\u29BC',\n\tOElig: '\\u0152',\n\toelig: '\\u0153',\n\tofcir: '\\u29BF',\n\tOfr: '\\uD835\\uDD12',\n\tofr: '\\uD835\\uDD2C',\n\togon: '\\u02DB',\n\tOgrave: '\\u00D2',\n\tograve: '\\u00F2',\n\togt: '\\u29C1',\n\tohbar: '\\u29B5',\n\tohm: '\\u03A9',\n\toint: '\\u222E',\n\tolarr: '\\u21BA',\n\tolcir: '\\u29BE',\n\tolcross: '\\u29BB',\n\toline: '\\u203E',\n\tolt: '\\u29C0',\n\tOmacr: '\\u014C',\n\tomacr: '\\u014D',\n\tOmega: '\\u03A9',\n\tomega: '\\u03C9',\n\tOmicron: '\\u039F',\n\tomicron: '\\u03BF',\n\tomid: '\\u29B6',\n\tominus: '\\u2296',\n\tOopf: '\\uD835\\uDD46',\n\toopf: '\\uD835\\uDD60',\n\topar: '\\u29B7',\n\tOpenCurlyDoubleQuote: '\\u201C',\n\tOpenCurlyQuote: '\\u2018',\n\toperp: '\\u29B9',\n\toplus: '\\u2295',\n\tOr: '\\u2A54',\n\tor: '\\u2228',\n\torarr: '\\u21BB',\n\tord: '\\u2A5D',\n\torder: '\\u2134',\n\torderof: '\\u2134',\n\tordf: '\\u00AA',\n\tordm: '\\u00BA',\n\torigof: '\\u22B6',\n\toror: '\\u2A56',\n\torslope: '\\u2A57',\n\torv: '\\u2A5B',\n\toS: '\\u24C8',\n\tOscr: '\\uD835\\uDCAA',\n\toscr: '\\u2134',\n\tOslash: '\\u00D8',\n\toslash: '\\u00F8',\n\tosol: '\\u2298',\n\tOtilde: '\\u00D5',\n\totilde: '\\u00F5',\n\tOtimes: '\\u2A37',\n\totimes: '\\u2297',\n\totimesas: '\\u2A36',\n\tOuml: '\\u00D6',\n\touml: '\\u00F6',\n\tovbar: '\\u233D',\n\tOverBar: '\\u203E',\n\tOverBrace: '\\u23DE',\n\tOverBracket: '\\u23B4',\n\tOverParenthesis: '\\u23DC',\n\tpar: '\\u2225',\n\tpara: '\\u00B6',\n\tparallel: '\\u2225',\n\tparsim: '\\u2AF3',\n\tparsl: '\\u2AFD',\n\tpart: '\\u2202',\n\tPartialD: '\\u2202',\n\tPcy: '\\u041F',\n\tpcy: '\\u043F',\n\tpercnt: '\\u0025',\n\tperiod: '\\u002E',\n\tpermil: '\\u2030',\n\tperp: '\\u22A5',\n\tpertenk: '\\u2031',\n\tPfr: '\\uD835\\uDD13',\n\tpfr: '\\uD835\\uDD2D',\n\tPhi: '\\u03A6',\n\tphi: '\\u03C6',\n\tphiv: '\\u03D5',\n\tphmmat: '\\u2133',\n\tphone: '\\u260E',\n\tPi: '\\u03A0',\n\tpi: '\\u03C0',\n\tpitchfork: '\\u22D4',\n\tpiv: '\\u03D6',\n\tplanck: '\\u210F',\n\tplanckh: '\\u210E',\n\tplankv: '\\u210F',\n\tplus: '\\u002B',\n\tplusacir: '\\u2A23',\n\tplusb: '\\u229E',\n\tpluscir: '\\u2A22',\n\tplusdo: '\\u2214',\n\tplusdu: '\\u2A25',\n\tpluse: '\\u2A72',\n\tPlusMinus: '\\u00B1',\n\tplusmn: '\\u00B1',\n\tplussim: '\\u2A26',\n\tplustwo: '\\u2A27',\n\tpm: '\\u00B1',\n\tPoincareplane: '\\u210C',\n\tpointint: '\\u2A15',\n\tPopf: '\\u2119',\n\tpopf: '\\uD835\\uDD61',\n\tpound: '\\u00A3',\n\tPr: '\\u2ABB',\n\tpr: '\\u227A',\n\tprap: '\\u2AB7',\n\tprcue: '\\u227C',\n\tprE: '\\u2AB3',\n\tpre: '\\u2AAF',\n\tprec: '\\u227A',\n\tprecapprox: '\\u2AB7',\n\tpreccurlyeq: '\\u227C',\n\tPrecedes: '\\u227A',\n\tPrecedesEqual: '\\u2AAF',\n\tPrecedesSlantEqual: '\\u227C',\n\tPrecedesTilde: '\\u227E',\n\tpreceq: '\\u2AAF',\n\tprecnapprox: '\\u2AB9',\n\tprecneqq: '\\u2AB5',\n\tprecnsim: '\\u22E8',\n\tprecsim: '\\u227E',\n\tPrime: '\\u2033',\n\tprime: '\\u2032',\n\tprimes: '\\u2119',\n\tprnap: '\\u2AB9',\n\tprnE: '\\u2AB5',\n\tprnsim: '\\u22E8',\n\tprod: '\\u220F',\n\tProduct: '\\u220F',\n\tprofalar: '\\u232E',\n\tprofline: '\\u2312',\n\tprofsurf: '\\u2313',\n\tprop: '\\u221D',\n\tProportion: '\\u2237',\n\tProportional: '\\u221D',\n\tpropto: '\\u221D',\n\tprsim: '\\u227E',\n\tprurel: '\\u22B0',\n\tPscr: '\\uD835\\uDCAB',\n\tpscr: '\\uD835\\uDCC5',\n\tPsi: '\\u03A8',\n\tpsi: '\\u03C8',\n\tpuncsp: '\\u2008',\n\tQfr: '\\uD835\\uDD14',\n\tqfr: '\\uD835\\uDD2E',\n\tqint: '\\u2A0C',\n\tQopf: '\\u211A',\n\tqopf: '\\uD835\\uDD62',\n\tqprime: '\\u2057',\n\tQscr: '\\uD835\\uDCAC',\n\tqscr: '\\uD835\\uDCC6',\n\tquaternions: '\\u210D',\n\tquatint: '\\u2A16',\n\tquest: '\\u003F',\n\tquesteq: '\\u225F',\n\tQUOT: '\\u0022',\n\tquot: '\\u0022',\n\trAarr: '\\u21DB',\n\trace: '\\u223D\\u0331',\n\tRacute: '\\u0154',\n\tracute: '\\u0155',\n\tradic: '\\u221A',\n\traemptyv: '\\u29B3',\n\tRang: '\\u27EB',\n\trang: '\\u27E9',\n\trangd: '\\u2992',\n\trange: '\\u29A5',\n\trangle: '\\u27E9',\n\traquo: '\\u00BB',\n\tRarr: '\\u21A0',\n\trArr: '\\u21D2',\n\trarr: '\\u2192',\n\trarrap: '\\u2975',\n\trarrb: '\\u21E5',\n\trarrbfs: '\\u2920',\n\trarrc: '\\u2933',\n\trarrfs: '\\u291E',\n\trarrhk: '\\u21AA',\n\trarrlp: '\\u21AC',\n\trarrpl: '\\u2945',\n\trarrsim: '\\u2974',\n\tRarrtl: '\\u2916',\n\trarrtl: '\\u21A3',\n\trarrw: '\\u219D',\n\trAtail: '\\u291C',\n\tratail: '\\u291A',\n\tratio: '\\u2236',\n\trationals: '\\u211A',\n\tRBarr: '\\u2910',\n\trBarr: '\\u290F',\n\trbarr: '\\u290D',\n\trbbrk: '\\u2773',\n\trbrace: '\\u007D',\n\trbrack: '\\u005D',\n\trbrke: '\\u298C',\n\trbrksld: '\\u298E',\n\trbrkslu: '\\u2990',\n\tRcaron: '\\u0158',\n\trcaron: '\\u0159',\n\tRcedil: '\\u0156',\n\trcedil: '\\u0157',\n\trceil: '\\u2309',\n\trcub: '\\u007D',\n\tRcy: '\\u0420',\n\trcy: '\\u0440',\n\trdca: '\\u2937',\n\trdldhar: '\\u2969',\n\trdquo: '\\u201D',\n\trdquor: '\\u201D',\n\trdsh: '\\u21B3',\n\tRe: '\\u211C',\n\treal: '\\u211C',\n\trealine: '\\u211B',\n\trealpart: '\\u211C',\n\treals: '\\u211D',\n\trect: '\\u25AD',\n\tREG: '\\u00AE',\n\treg: '\\u00AE',\n\tReverseElement: '\\u220B',\n\tReverseEquilibrium: '\\u21CB',\n\tReverseUpEquilibrium: '\\u296F',\n\trfisht: '\\u297D',\n\trfloor: '\\u230B',\n\tRfr: '\\u211C',\n\trfr: '\\uD835\\uDD2F',\n\trHar: '\\u2964',\n\trhard: '\\u21C1',\n\trharu: '\\u21C0',\n\trharul: '\\u296C',\n\tRho: '\\u03A1',\n\trho: '\\u03C1',\n\trhov: '\\u03F1',\n\tRightAngleBracket: '\\u27E9',\n\tRightArrow: '\\u2192',\n\tRightarrow: '\\u21D2',\n\trightarrow: '\\u2192',\n\tRightArrowBar: '\\u21E5',\n\tRightArrowLeftArrow: '\\u21C4',\n\trightarrowtail: '\\u21A3',\n\tRightCeiling: '\\u2309',\n\tRightDoubleBracket: '\\u27E7',\n\tRightDownTeeVector: '\\u295D',\n\tRightDownVector: '\\u21C2',\n\tRightDownVectorBar: '\\u2955',\n\tRightFloor: '\\u230B',\n\trightharpoondown: '\\u21C1',\n\trightharpoonup: '\\u21C0',\n\trightleftarrows: '\\u21C4',\n\trightleftharpoons: '\\u21CC',\n\trightrightarrows: '\\u21C9',\n\trightsquigarrow: '\\u219D',\n\tRightTee: '\\u22A2',\n\tRightTeeArrow: '\\u21A6',\n\tRightTeeVector: '\\u295B',\n\trightthreetimes: '\\u22CC',\n\tRightTriangle: '\\u22B3',\n\tRightTriangleBar: '\\u29D0',\n\tRightTriangleEqual: '\\u22B5',\n\tRightUpDownVector: '\\u294F',\n\tRightUpTeeVector: '\\u295C',\n\tRightUpVector: '\\u21BE',\n\tRightUpVectorBar: '\\u2954',\n\tRightVector: '\\u21C0',\n\tRightVectorBar: '\\u2953',\n\tring: '\\u02DA',\n\trisingdotseq: '\\u2253',\n\trlarr: '\\u21C4',\n\trlhar: '\\u21CC',\n\trlm: '\\u200F',\n\trmoust: '\\u23B1',\n\trmoustache: '\\u23B1',\n\trnmid: '\\u2AEE',\n\troang: '\\u27ED',\n\troarr: '\\u21FE',\n\trobrk: '\\u27E7',\n\tropar: '\\u2986',\n\tRopf: '\\u211D',\n\tropf: '\\uD835\\uDD63',\n\troplus: '\\u2A2E',\n\trotimes: '\\u2A35',\n\tRoundImplies: '\\u2970',\n\trpar: '\\u0029',\n\trpargt: '\\u2994',\n\trppolint: '\\u2A12',\n\trrarr: '\\u21C9',\n\tRrightarrow: '\\u21DB',\n\trsaquo: '\\u203A',\n\tRscr: '\\u211B',\n\trscr: '\\uD835\\uDCC7',\n\tRsh: '\\u21B1',\n\trsh: '\\u21B1',\n\trsqb: '\\u005D',\n\trsquo: '\\u2019',\n\trsquor: '\\u2019',\n\trthree: '\\u22CC',\n\trtimes: '\\u22CA',\n\trtri: '\\u25B9',\n\trtrie: '\\u22B5',\n\trtrif: '\\u25B8',\n\trtriltri: '\\u29CE',\n\tRuleDelayed: '\\u29F4',\n\truluhar: '\\u2968',\n\trx: '\\u211E',\n\tSacute: '\\u015A',\n\tsacute: '\\u015B',\n\tsbquo: '\\u201A',\n\tSc: '\\u2ABC',\n\tsc: '\\u227B',\n\tscap: '\\u2AB8',\n\tScaron: '\\u0160',\n\tscaron: '\\u0161',\n\tsccue: '\\u227D',\n\tscE: '\\u2AB4',\n\tsce: '\\u2AB0',\n\tScedil: '\\u015E',\n\tscedil: '\\u015F',\n\tScirc: '\\u015C',\n\tscirc: '\\u015D',\n\tscnap: '\\u2ABA',\n\tscnE: '\\u2AB6',\n\tscnsim: '\\u22E9',\n\tscpolint: '\\u2A13',\n\tscsim: '\\u227F',\n\tScy: '\\u0421',\n\tscy: '\\u0441',\n\tsdot: '\\u22C5',\n\tsdotb: '\\u22A1',\n\tsdote: '\\u2A66',\n\tsearhk: '\\u2925',\n\tseArr: '\\u21D8',\n\tsearr: '\\u2198',\n\tsearrow: '\\u2198',\n\tsect: '\\u00A7',\n\tsemi: '\\u003B',\n\tseswar: '\\u2929',\n\tsetminus: '\\u2216',\n\tsetmn: '\\u2216',\n\tsext: '\\u2736',\n\tSfr: '\\uD835\\uDD16',\n\tsfr: '\\uD835\\uDD30',\n\tsfrown: '\\u2322',\n\tsharp: '\\u266F',\n\tSHCHcy: '\\u0429',\n\tshchcy: '\\u0449',\n\tSHcy: '\\u0428',\n\tshcy: '\\u0448',\n\tShortDownArrow: '\\u2193',\n\tShortLeftArrow: '\\u2190',\n\tshortmid: '\\u2223',\n\tshortparallel: '\\u2225',\n\tShortRightArrow: '\\u2192',\n\tShortUpArrow: '\\u2191',\n\tshy: '\\u00AD',\n\tSigma: '\\u03A3',\n\tsigma: '\\u03C3',\n\tsigmaf: '\\u03C2',\n\tsigmav: '\\u03C2',\n\tsim: '\\u223C',\n\tsimdot: '\\u2A6A',\n\tsime: '\\u2243',\n\tsimeq: '\\u2243',\n\tsimg: '\\u2A9E',\n\tsimgE: '\\u2AA0',\n\tsiml: '\\u2A9D',\n\tsimlE: '\\u2A9F',\n\tsimne: '\\u2246',\n\tsimplus: '\\u2A24',\n\tsimrarr: '\\u2972',\n\tslarr: '\\u2190',\n\tSmallCircle: '\\u2218',\n\tsmallsetminus: '\\u2216',\n\tsmashp: '\\u2A33',\n\tsmeparsl: '\\u29E4',\n\tsmid: '\\u2223',\n\tsmile: '\\u2323',\n\tsmt: '\\u2AAA',\n\tsmte: '\\u2AAC',\n\tsmtes: '\\u2AAC\\uFE00',\n\tSOFTcy: '\\u042C',\n\tsoftcy: '\\u044C',\n\tsol: '\\u002F',\n\tsolb: '\\u29C4',\n\tsolbar: '\\u233F',\n\tSopf: '\\uD835\\uDD4A',\n\tsopf: '\\uD835\\uDD64',\n\tspades: '\\u2660',\n\tspadesuit: '\\u2660',\n\tspar: '\\u2225',\n\tsqcap: '\\u2293',\n\tsqcaps: '\\u2293\\uFE00',\n\tsqcup: '\\u2294',\n\tsqcups: '\\u2294\\uFE00',\n\tSqrt: '\\u221A',\n\tsqsub: '\\u228F',\n\tsqsube: '\\u2291',\n\tsqsubset: '\\u228F',\n\tsqsubseteq: '\\u2291',\n\tsqsup: '\\u2290',\n\tsqsupe: '\\u2292',\n\tsqsupset: '\\u2290',\n\tsqsupseteq: '\\u2292',\n\tsqu: '\\u25A1',\n\tSquare: '\\u25A1',\n\tsquare: '\\u25A1',\n\tSquareIntersection: '\\u2293',\n\tSquareSubset: '\\u228F',\n\tSquareSubsetEqual: '\\u2291',\n\tSquareSuperset: '\\u2290',\n\tSquareSupersetEqual: '\\u2292',\n\tSquareUnion: '\\u2294',\n\tsquarf: '\\u25AA',\n\tsquf: '\\u25AA',\n\tsrarr: '\\u2192',\n\tSscr: '\\uD835\\uDCAE',\n\tsscr: '\\uD835\\uDCC8',\n\tssetmn: '\\u2216',\n\tssmile: '\\u2323',\n\tsstarf: '\\u22C6',\n\tStar: '\\u22C6',\n\tstar: '\\u2606',\n\tstarf: '\\u2605',\n\tstraightepsilon: '\\u03F5',\n\tstraightphi: '\\u03D5',\n\tstrns: '\\u00AF',\n\tSub: '\\u22D0',\n\tsub: '\\u2282',\n\tsubdot: '\\u2ABD',\n\tsubE: '\\u2AC5',\n\tsube: '\\u2286',\n\tsubedot: '\\u2AC3',\n\tsubmult: '\\u2AC1',\n\tsubnE: '\\u2ACB',\n\tsubne: '\\u228A',\n\tsubplus: '\\u2ABF',\n\tsubrarr: '\\u2979',\n\tSubset: '\\u22D0',\n\tsubset: '\\u2282',\n\tsubseteq: '\\u2286',\n\tsubseteqq: '\\u2AC5',\n\tSubsetEqual: '\\u2286',\n\tsubsetneq: '\\u228A',\n\tsubsetneqq: '\\u2ACB',\n\tsubsim: '\\u2AC7',\n\tsubsub: '\\u2AD5',\n\tsubsup: '\\u2AD3',\n\tsucc: '\\u227B',\n\tsuccapprox: '\\u2AB8',\n\tsucccurlyeq: '\\u227D',\n\tSucceeds: '\\u227B',\n\tSucceedsEqual: '\\u2AB0',\n\tSucceedsSlantEqual: '\\u227D',\n\tSucceedsTilde: '\\u227F',\n\tsucceq: '\\u2AB0',\n\tsuccnapprox: '\\u2ABA',\n\tsuccneqq: '\\u2AB6',\n\tsuccnsim: '\\u22E9',\n\tsuccsim: '\\u227F',\n\tSuchThat: '\\u220B',\n\tSum: '\\u2211',\n\tsum: '\\u2211',\n\tsung: '\\u266A',\n\tSup: '\\u22D1',\n\tsup: '\\u2283',\n\tsup1: '\\u00B9',\n\tsup2: '\\u00B2',\n\tsup3: '\\u00B3',\n\tsupdot: '\\u2ABE',\n\tsupdsub: '\\u2AD8',\n\tsupE: '\\u2AC6',\n\tsupe: '\\u2287',\n\tsupedot: '\\u2AC4',\n\tSuperset: '\\u2283',\n\tSupersetEqual: '\\u2287',\n\tsuphsol: '\\u27C9',\n\tsuphsub: '\\u2AD7',\n\tsuplarr: '\\u297B',\n\tsupmult: '\\u2AC2',\n\tsupnE: '\\u2ACC',\n\tsupne: '\\u228B',\n\tsupplus: '\\u2AC0',\n\tSupset: '\\u22D1',\n\tsupset: '\\u2283',\n\tsupseteq: '\\u2287',\n\tsupseteqq: '\\u2AC6',\n\tsupsetneq: '\\u228B',\n\tsupsetneqq: '\\u2ACC',\n\tsupsim: '\\u2AC8',\n\tsupsub: '\\u2AD4',\n\tsupsup: '\\u2AD6',\n\tswarhk: '\\u2926',\n\tswArr: '\\u21D9',\n\tswarr: '\\u2199',\n\tswarrow: '\\u2199',\n\tswnwar: '\\u292A',\n\tszlig: '\\u00DF',\n\tTab: '\\u0009',\n\ttarget: '\\u2316',\n\tTau: '\\u03A4',\n\ttau: '\\u03C4',\n\ttbrk: '\\u23B4',\n\tTcaron: '\\u0164',\n\ttcaron: '\\u0165',\n\tTcedil: '\\u0162',\n\ttcedil: '\\u0163',\n\tTcy: '\\u0422',\n\ttcy: '\\u0442',\n\ttdot: '\\u20DB',\n\ttelrec: '\\u2315',\n\tTfr: '\\uD835\\uDD17',\n\ttfr: '\\uD835\\uDD31',\n\tthere4: '\\u2234',\n\tTherefore: '\\u2234',\n\ttherefore: '\\u2234',\n\tTheta: '\\u0398',\n\ttheta: '\\u03B8',\n\tthetasym: '\\u03D1',\n\tthetav: '\\u03D1',\n\tthickapprox: '\\u2248',\n\tthicksim: '\\u223C',\n\tThickSpace: '\\u205F\\u200A',\n\tthinsp: '\\u2009',\n\tThinSpace: '\\u2009',\n\tthkap: '\\u2248',\n\tthksim: '\\u223C',\n\tTHORN: '\\u00DE',\n\tthorn: '\\u00FE',\n\tTilde: '\\u223C',\n\ttilde: '\\u02DC',\n\tTildeEqual: '\\u2243',\n\tTildeFullEqual: '\\u2245',\n\tTildeTilde: '\\u2248',\n\ttimes: '\\u00D7',\n\ttimesb: '\\u22A0',\n\ttimesbar: '\\u2A31',\n\ttimesd: '\\u2A30',\n\ttint: '\\u222D',\n\ttoea: '\\u2928',\n\ttop: '\\u22A4',\n\ttopbot: '\\u2336',\n\ttopcir: '\\u2AF1',\n\tTopf: '\\uD835\\uDD4B',\n\ttopf: '\\uD835\\uDD65',\n\ttopfork: '\\u2ADA',\n\ttosa: '\\u2929',\n\ttprime: '\\u2034',\n\tTRADE: '\\u2122',\n\ttrade: '\\u2122',\n\ttriangle: '\\u25B5',\n\ttriangledown: '\\u25BF',\n\ttriangleleft: '\\u25C3',\n\ttrianglelefteq: '\\u22B4',\n\ttriangleq: '\\u225C',\n\ttriangleright: '\\u25B9',\n\ttrianglerighteq: '\\u22B5',\n\ttridot: '\\u25EC',\n\ttrie: '\\u225C',\n\ttriminus: '\\u2A3A',\n\tTripleDot: '\\u20DB',\n\ttriplus: '\\u2A39',\n\ttrisb: '\\u29CD',\n\ttritime: '\\u2A3B',\n\ttrpezium: '\\u23E2',\n\tTscr: '\\uD835\\uDCAF',\n\ttscr: '\\uD835\\uDCC9',\n\tTScy: '\\u0426',\n\ttscy: '\\u0446',\n\tTSHcy: '\\u040B',\n\ttshcy: '\\u045B',\n\tTstrok: '\\u0166',\n\ttstrok: '\\u0167',\n\ttwixt: '\\u226C',\n\ttwoheadleftarrow: '\\u219E',\n\ttwoheadrightarrow: '\\u21A0',\n\tUacute: '\\u00DA',\n\tuacute: '\\u00FA',\n\tUarr: '\\u219F',\n\tuArr: '\\u21D1',\n\tuarr: '\\u2191',\n\tUarrocir: '\\u2949',\n\tUbrcy: '\\u040E',\n\tubrcy: '\\u045E',\n\tUbreve: '\\u016C',\n\tubreve: '\\u016D',\n\tUcirc: '\\u00DB',\n\tucirc: '\\u00FB',\n\tUcy: '\\u0423',\n\tucy: '\\u0443',\n\tudarr: '\\u21C5',\n\tUdblac: '\\u0170',\n\tudblac: '\\u0171',\n\tudhar: '\\u296E',\n\tufisht: '\\u297E',\n\tUfr: '\\uD835\\uDD18',\n\tufr: '\\uD835\\uDD32',\n\tUgrave: '\\u00D9',\n\tugrave: '\\u00F9',\n\tuHar: '\\u2963',\n\tuharl: '\\u21BF',\n\tuharr: '\\u21BE',\n\tuhblk: '\\u2580',\n\tulcorn: '\\u231C',\n\tulcorner: '\\u231C',\n\tulcrop: '\\u230F',\n\tultri: '\\u25F8',\n\tUmacr: '\\u016A',\n\tumacr: '\\u016B',\n\tuml: '\\u00A8',\n\tUnderBar: '\\u005F',\n\tUnderBrace: '\\u23DF',\n\tUnderBracket: '\\u23B5',\n\tUnderParenthesis: '\\u23DD',\n\tUnion: '\\u22C3',\n\tUnionPlus: '\\u228E',\n\tUogon: '\\u0172',\n\tuogon: '\\u0173',\n\tUopf: '\\uD835\\uDD4C',\n\tuopf: '\\uD835\\uDD66',\n\tUpArrow: '\\u2191',\n\tUparrow: '\\u21D1',\n\tuparrow: '\\u2191',\n\tUpArrowBar: '\\u2912',\n\tUpArrowDownArrow: '\\u21C5',\n\tUpDownArrow: '\\u2195',\n\tUpdownarrow: '\\u21D5',\n\tupdownarrow: '\\u2195',\n\tUpEquilibrium: '\\u296E',\n\tupharpoonleft: '\\u21BF',\n\tupharpoonright: '\\u21BE',\n\tuplus: '\\u228E',\n\tUpperLeftArrow: '\\u2196',\n\tUpperRightArrow: '\\u2197',\n\tUpsi: '\\u03D2',\n\tupsi: '\\u03C5',\n\tupsih: '\\u03D2',\n\tUpsilon: '\\u03A5',\n\tupsilon: '\\u03C5',\n\tUpTee: '\\u22A5',\n\tUpTeeArrow: '\\u21A5',\n\tupuparrows: '\\u21C8',\n\turcorn: '\\u231D',\n\turcorner: '\\u231D',\n\turcrop: '\\u230E',\n\tUring: '\\u016E',\n\turing: '\\u016F',\n\turtri: '\\u25F9',\n\tUscr: '\\uD835\\uDCB0',\n\tuscr: '\\uD835\\uDCCA',\n\tutdot: '\\u22F0',\n\tUtilde: '\\u0168',\n\tutilde: '\\u0169',\n\tutri: '\\u25B5',\n\tutrif: '\\u25B4',\n\tuuarr: '\\u21C8',\n\tUuml: '\\u00DC',\n\tuuml: '\\u00FC',\n\tuwangle: '\\u29A7',\n\tvangrt: '\\u299C',\n\tvarepsilon: '\\u03F5',\n\tvarkappa: '\\u03F0',\n\tvarnothing: '\\u2205',\n\tvarphi: '\\u03D5',\n\tvarpi: '\\u03D6',\n\tvarpropto: '\\u221D',\n\tvArr: '\\u21D5',\n\tvarr: '\\u2195',\n\tvarrho: '\\u03F1',\n\tvarsigma: '\\u03C2',\n\tvarsubsetneq: '\\u228A\\uFE00',\n\tvarsubsetneqq: '\\u2ACB\\uFE00',\n\tvarsupsetneq: '\\u228B\\uFE00',\n\tvarsupsetneqq: '\\u2ACC\\uFE00',\n\tvartheta: '\\u03D1',\n\tvartriangleleft: '\\u22B2',\n\tvartriangleright: '\\u22B3',\n\tVbar: '\\u2AEB',\n\tvBar: '\\u2AE8',\n\tvBarv: '\\u2AE9',\n\tVcy: '\\u0412',\n\tvcy: '\\u0432',\n\tVDash: '\\u22AB',\n\tVdash: '\\u22A9',\n\tvDash: '\\u22A8',\n\tvdash: '\\u22A2',\n\tVdashl: '\\u2AE6',\n\tVee: '\\u22C1',\n\tvee: '\\u2228',\n\tveebar: '\\u22BB',\n\tveeeq: '\\u225A',\n\tvellip: '\\u22EE',\n\tVerbar: '\\u2016',\n\tverbar: '\\u007C',\n\tVert: '\\u2016',\n\tvert: '\\u007C',\n\tVerticalBar: '\\u2223',\n\tVerticalLine: '\\u007C',\n\tVerticalSeparator: '\\u2758',\n\tVerticalTilde: '\\u2240',\n\tVeryThinSpace: '\\u200A',\n\tVfr: '\\uD835\\uDD19',\n\tvfr: '\\uD835\\uDD33',\n\tvltri: '\\u22B2',\n\tvnsub: '\\u2282\\u20D2',\n\tvnsup: '\\u2283\\u20D2',\n\tVopf: '\\uD835\\uDD4D',\n\tvopf: '\\uD835\\uDD67',\n\tvprop: '\\u221D',\n\tvrtri: '\\u22B3',\n\tVscr: '\\uD835\\uDCB1',\n\tvscr: '\\uD835\\uDCCB',\n\tvsubnE: '\\u2ACB\\uFE00',\n\tvsubne: '\\u228A\\uFE00',\n\tvsupnE: '\\u2ACC\\uFE00',\n\tvsupne: '\\u228B\\uFE00',\n\tVvdash: '\\u22AA',\n\tvzigzag: '\\u299A',\n\tWcirc: '\\u0174',\n\twcirc: '\\u0175',\n\twedbar: '\\u2A5F',\n\tWedge: '\\u22C0',\n\twedge: '\\u2227',\n\twedgeq: '\\u2259',\n\tweierp: '\\u2118',\n\tWfr: '\\uD835\\uDD1A',\n\twfr: '\\uD835\\uDD34',\n\tWopf: '\\uD835\\uDD4E',\n\twopf: '\\uD835\\uDD68',\n\twp: '\\u2118',\n\twr: '\\u2240',\n\twreath: '\\u2240',\n\tWscr: '\\uD835\\uDCB2',\n\twscr: '\\uD835\\uDCCC',\n\txcap: '\\u22C2',\n\txcirc: '\\u25EF',\n\txcup: '\\u22C3',\n\txdtri: '\\u25BD',\n\tXfr: '\\uD835\\uDD1B',\n\txfr: '\\uD835\\uDD35',\n\txhArr: '\\u27FA',\n\txharr: '\\u27F7',\n\tXi: '\\u039E',\n\txi: '\\u03BE',\n\txlArr: '\\u27F8',\n\txlarr: '\\u27F5',\n\txmap: '\\u27FC',\n\txnis: '\\u22FB',\n\txodot: '\\u2A00',\n\tXopf: '\\uD835\\uDD4F',\n\txopf: '\\uD835\\uDD69',\n\txoplus: '\\u2A01',\n\txotime: '\\u2A02',\n\txrArr: '\\u27F9',\n\txrarr: '\\u27F6',\n\tXscr: '\\uD835\\uDCB3',\n\txscr: '\\uD835\\uDCCD',\n\txsqcup: '\\u2A06',\n\txuplus: '\\u2A04',\n\txutri: '\\u25B3',\n\txvee: '\\u22C1',\n\txwedge: '\\u22C0',\n\tYacute: '\\u00DD',\n\tyacute: '\\u00FD',\n\tYAcy: '\\u042F',\n\tyacy: '\\u044F',\n\tYcirc: '\\u0176',\n\tycirc: '\\u0177',\n\tYcy: '\\u042B',\n\tycy: '\\u044B',\n\tyen: '\\u00A5',\n\tYfr: '\\uD835\\uDD1C',\n\tyfr: '\\uD835\\uDD36',\n\tYIcy: '\\u0407',\n\tyicy: '\\u0457',\n\tYopf: '\\uD835\\uDD50',\n\tyopf: '\\uD835\\uDD6A',\n\tYscr: '\\uD835\\uDCB4',\n\tyscr: '\\uD835\\uDCCE',\n\tYUcy: '\\u042E',\n\tyucy: '\\u044E',\n\tYuml: '\\u0178',\n\tyuml: '\\u00FF',\n\tZacute: '\\u0179',\n\tzacute: '\\u017A',\n\tZcaron: '\\u017D',\n\tzcaron: '\\u017E',\n\tZcy: '\\u0417',\n\tzcy: '\\u0437',\n\tZdot: '\\u017B',\n\tzdot: '\\u017C',\n\tzeetrf: '\\u2128',\n\tZeroWidthSpace: '\\u200B',\n\tZeta: '\\u0396',\n\tzeta: '\\u03B6',\n\tZfr: '\\u2128',\n\tzfr: '\\uD835\\uDD37',\n\tZHcy: '\\u0416',\n\tzhcy: '\\u0436',\n\tzigrarr: '\\u21DD',\n\tZopf: '\\u2124',\n\tzopf: '\\uD835\\uDD6B',\n\tZscr: '\\uD835\\uDCB5',\n\tzscr: '\\uD835\\uDCCF',\n\tzwj: '\\u200D',\n\tzwnj: '\\u200C',\n});\n\n/**\n * @deprecated\n * Use `HTML_ENTITIES` instead.\n * @see {@link HTML_ENTITIES}\n */\nexports.entityMap = exports.HTML_ENTITIES;\n","'use strict';\n\nvar conventions = require('./conventions');\nvar g = require('./grammar');\nvar errors = require('./errors');\n\nvar isHTMLEscapableRawTextElement = conventions.isHTMLEscapableRawTextElement;\nvar isHTMLMimeType = conventions.isHTMLMimeType;\nvar isHTMLRawTextElement = conventions.isHTMLRawTextElement;\nvar hasOwn = conventions.hasOwn;\nvar NAMESPACE = conventions.NAMESPACE;\nvar ParseError = errors.ParseError;\nvar DOMException = errors.DOMException;\n\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\nfunction XMLReader() {}\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 = Object.create(null)));\n\t\tparse(source, defaultNSMap, entityMap, domBuilder, this.errorHandler);\n\t\tdomBuilder.endDocument();\n\t},\n};\n\n/**\n * Detecting everything that might be a reference,\n * including those without ending `;`, since those are allowed in HTML.\n * The entityReplacer takes care of verifying and transforming each occurrence,\n * and reports to the errorHandler on those that are not OK,\n * depending on the context.\n */\nvar ENTITY_REG = /&#?\\w+;?/g;\n\nfunction parse(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {\n\tvar isHTML = isHTMLMimeType(domBuilder.mimeType);\n\tif (source.indexOf(g.UNICODE_REPLACEMENT_CHARACTER) >= 0) {\n\t\treturn errorHandler.fatalError('Unicode replacement character detected, source encoding issues?');\n\t}\n\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\tsurrogate2 = 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\n\tfunction entityReplacer(a) {\n\t\tvar complete = a[a.length - 1] === ';' ? a : a + ';';\n\t\tif (!isHTML && complete !== a) {\n\t\t\terrorHandler.error('EntityRef: expecting ;');\n\t\t\treturn a;\n\t\t}\n\t\tvar match = g.Reference.exec(complete);\n\t\tif (!match || match[0].length !== complete.length) {\n\t\t\terrorHandler.error('entity not matching Reference production: ' + a);\n\t\t\treturn a;\n\t\t}\n\t\tvar k = complete.slice(1, -1);\n\t\tif (hasOwn(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\n\tfunction appendText(end) {\n\t\t//has some bugs\n\t\tif (end > start) {\n\t\t\tvar xt = source.substring(start, end).replace(ENTITY_REG, 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\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}\n\t\tlocator.columnNumber = p - lineStart + 1;\n\t}\n\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 unclosedTags = [];\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 (!isHTML && unclosedTags.length > 0) {\n\t\t\t\t\treturn errorHandler.fatalError('unclosed xml tag(s): ' + unclosedTags.join(', '));\n\t\t\t\t}\n\t\t\t\tif (!source.substring(start).match(/^\\s*$/)) {\n\t\t\t\t\tvar doc = domBuilder.doc;\n\t\t\t\t\tvar text = doc.createTextNode(source.substr(start));\n\t\t\t\t\tif (doc.documentElement) {\n\t\t\t\t\t\treturn errorHandler.error('Extra content at the end of the document');\n\t\t\t\t\t}\n\t\t\t\t\tdoc.appendChild(text);\n\t\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\tvar fromSource = source.substring(start, tagStart);\n\t\t\t\tif (!isHTML && unclosedTags.length === 0) {\n\t\t\t\t\tfromSource = fromSource.replace(new RegExp(g.S_OPT.source, 'g'), '');\n\t\t\t\t\tfromSource && errorHandler.error(\"Unexpected content outside root element: '\" + fromSource + \"'\");\n\t\t\t\t}\n\t\t\t\tappendText(tagStart);\n\t\t\t}\n\t\t\tswitch (source.charAt(tagStart + 1)) {\n\t\t\t\tcase '/':\n\t\t\t\t\tvar end = source.indexOf('>', tagStart + 2);\n\t\t\t\t\tvar tagNameRaw = source.substring(tagStart + 2, end > 0 ? end : undefined);\n\t\t\t\t\tif (!tagNameRaw) {\n\t\t\t\t\t\treturn errorHandler.fatalError('end tag name missing');\n\t\t\t\t\t}\n\t\t\t\t\tvar tagNameMatch = end > 0 && g.reg('^', g.QName_group, g.S_OPT, '$').exec(tagNameRaw);\n\t\t\t\t\tif (!tagNameMatch) {\n\t\t\t\t\t\treturn errorHandler.fatalError('end tag name contains invalid characters: \"' + tagNameRaw + '\"');\n\t\t\t\t\t}\n\t\t\t\t\tif (!domBuilder.currentElement && !domBuilder.doc.documentElement) {\n\t\t\t\t\t\t// not enough information to provide a helpful error message,\n\t\t\t\t\t\t// but parsing will throw since there is no root element\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tvar currentTagName =\n\t\t\t\t\t\tunclosedTags[unclosedTags.length - 1] ||\n\t\t\t\t\t\tdomBuilder.currentElement.tagName ||\n\t\t\t\t\t\tdomBuilder.doc.documentElement.tagName ||\n\t\t\t\t\t\t'';\n\t\t\t\t\tif (currentTagName !== tagNameMatch[1]) {\n\t\t\t\t\t\tvar tagNameLower = tagNameMatch[1].toLowerCase();\n\t\t\t\t\t\tif (!isHTML || currentTagName.toLowerCase() !== tagNameLower) {\n\t\t\t\t\t\t\treturn errorHandler.fatalError('Opening and ending tag mismatch: \"' + currentTagName + '\" != \"' + tagNameRaw + '\"');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tvar config = parseStack.pop();\n\t\t\t\t\tunclosedTags.pop();\n\t\t\t\t\tvar localNSMap = config.localNSMap;\n\t\t\t\t\tdomBuilder.endElement(config.uri, config.localName, currentTagName);\n\t\t\t\t\tif (localNSMap) {\n\t\t\t\t\t\tfor (var prefix in localNSMap) {\n\t\t\t\t\t\t\tif (hasOwn(localNSMap, prefix)) {\n\t\t\t\t\t\t\t\tdomBuilder.endPrefixMapping(prefix);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tend++;\n\t\t\t\t\tbreak;\n\t\t\t\t// end element\n\t\t\t\tcase '?': // \n\t\t\t\t\tlocator && position(tagStart);\n\t\t\t\t\tend = parseProcessingInstruction(source, tagStart, domBuilder, errorHandler);\n\t\t\t\t\tbreak;\n\t\t\t\tcase '!': // start) {\n\t\t\tstart = end;\n\t\t} else {\n\t\t\t//Possible sax fallback here, risk of positional error\n\t\t\tappendText(Math.max(tagStart, start) + 1);\n\t\t}\n\t}\n}\n\nfunction copyLocator(f, t) {\n\tt.lineNumber = f.lineNumber;\n\tt.columnNumber = f.columnNumber;\n\treturn t;\n}\n\n/**\n * @returns\n * end of the elementStartPart(end of elementEndPart for selfClosed el)\n * @see {@link #appendElement}\n */\nfunction parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler, isHTML) {\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 (hasOwn(el.attributeNames, qname)) {\n\t\t\treturn errorHandler.fatalError('Attribute ' + qname + ' redefined');\n\t\t}\n\t\tif (!isHTML && value.indexOf('<') >= 0) {\n\t\t\treturn errorHandler.fatalError(\"Unescaped '<' not allowed in attributes values\");\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(ENTITY_REG, entityReplacer),\n\t\t\tstartIndex\n\t\t);\n\t}\n\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\t\tcase '=':\n\t\t\t\tif (s === S_ATTR) {\n\t\t\t\t\t//attrName\n\t\t\t\t\tattrName = source.slice(start, p);\n\t\t\t\t\ts = S_EQ;\n\t\t\t\t} else if (s === S_ATTR_SPACE) {\n\t\t\t\t\ts = S_EQ;\n\t\t\t\t} else {\n\t\t\t\t\t//fatalError: equal must after attrName or space after attrName\n\t\t\t\t\tthrow new Error('attribute equal must after attrName'); // No known test case\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"'\":\n\t\t\tcase '\"':\n\t\t\t\tif (\n\t\t\t\t\ts === S_EQ ||\n\t\t\t\t\ts === S_ATTR //|| s == S_ATTR_SPACE\n\t\t\t\t) {\n\t\t\t\t\t//equal\n\t\t\t\t\tif (s === S_ATTR) {\n\t\t\t\t\t\terrorHandler.warning('attribute value must after \"=\"');\n\t\t\t\t\t\tattrName = source.slice(start, p);\n\t\t\t\t\t}\n\t\t\t\t\tstart = p + 1;\n\t\t\t\t\tp = source.indexOf(c, start);\n\t\t\t\t\tif (p > 0) {\n\t\t\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\t\t\taddAttribute(attrName, value, start - 1);\n\t\t\t\t\t\ts = S_ATTR_END;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//fatalError: no end quot match\n\t\t\t\t\t\tthrow new Error(\"attribute value no end '\" + c + \"' match\");\n\t\t\t\t\t}\n\t\t\t\t} else if (s == S_ATTR_NOQUOT_VALUE) {\n\t\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\t\taddAttribute(attrName, value, start);\n\t\t\t\t\terrorHandler.warning('attribute \"' + attrName + '\" missed start quot(' + c + ')!!');\n\t\t\t\t\tstart = p + 1;\n\t\t\t\t\ts = S_ATTR_END;\n\t\t\t\t} else {\n\t\t\t\t\t//fatalError: no equal before\n\t\t\t\t\tthrow new Error('attribute value must after \"=\"'); // No known test case\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase '/':\n\t\t\t\tswitch (s) {\n\t\t\t\t\tcase S_TAG:\n\t\t\t\t\t\tel.setTagName(source.slice(start, p));\n\t\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\tcase S_TAG_SPACE:\n\t\t\t\t\tcase S_TAG_CLOSE:\n\t\t\t\t\t\ts = S_TAG_CLOSE;\n\t\t\t\t\t\tel.closed = true;\n\t\t\t\t\tcase S_ATTR_NOQUOT_VALUE:\n\t\t\t\t\tcase S_ATTR:\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\t\tel.closed = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t//case S_EQ:\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Error(\"attribute invalid close char('/')\"); // No known test case\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase '': //end document\n\t\t\t\terrorHandler.error('unexpected end of input');\n\t\t\t\tif (s == S_TAG) {\n\t\t\t\t\tel.setTagName(source.slice(start, p));\n\t\t\t\t}\n\t\t\t\treturn p;\n\t\t\tcase '>':\n\t\t\t\tswitch (s) {\n\t\t\t\t\tcase S_TAG:\n\t\t\t\t\t\tel.setTagName(source.slice(start, p));\n\t\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\tcase S_TAG_SPACE:\n\t\t\t\t\tcase S_TAG_CLOSE:\n\t\t\t\t\t\tbreak; //normal\n\t\t\t\t\tcase S_ATTR_NOQUOT_VALUE: //Compatible state\n\t\t\t\t\tcase S_ATTR:\n\t\t\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\t\t\tif (value.slice(-1) === '/') {\n\t\t\t\t\t\t\tel.closed = true;\n\t\t\t\t\t\t\tvalue = value.slice(0, -1);\n\t\t\t\t\t\t}\n\t\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\t\tif (s === S_ATTR_SPACE) {\n\t\t\t\t\t\t\tvalue = attrName;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (s == S_ATTR_NOQUOT_VALUE) {\n\t\t\t\t\t\t\terrorHandler.warning('attribute \"' + value + '\" missed quot(\")!');\n\t\t\t\t\t\t\taddAttribute(attrName, value, start);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (!isHTML) {\n\t\t\t\t\t\t\t\terrorHandler.warning('attribute \"' + value + '\" missed value!! \"' + value + '\" instead!!');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taddAttribute(value, value, start);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase S_EQ:\n\t\t\t\t\t\tif (!isHTML) {\n\t\t\t\t\t\t\treturn errorHandler.fatalError('AttValue: \\' or \" expected');\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn p;\n\t\t\t/*xml space '\\x20' | #x9 | #xD | #xA; */\n\t\t\tcase '\\u0080':\n\t\t\t\tc = ' ';\n\t\t\tdefault:\n\t\t\t\tif (c <= ' ') {\n\t\t\t\t\t//space\n\t\t\t\t\tswitch (s) {\n\t\t\t\t\t\tcase S_TAG:\n\t\t\t\t\t\t\tel.setTagName(source.slice(start, p)); //tagName\n\t\t\t\t\t\t\ts = S_TAG_SPACE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase S_ATTR:\n\t\t\t\t\t\t\tattrName = source.slice(start, p);\n\t\t\t\t\t\t\ts = S_ATTR_SPACE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase S_ATTR_NOQUOT_VALUE:\n\t\t\t\t\t\t\tvar value = source.slice(start, p);\n\t\t\t\t\t\t\terrorHandler.warning('attribute \"' + value + '\" missed quot(\")!!');\n\t\t\t\t\t\t\taddAttribute(attrName, value, start);\n\t\t\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\t\t\ts = S_TAG_SPACE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t//case S_TAG_SPACE:\n\t\t\t\t\t\t//case S_EQ:\n\t\t\t\t\t\t//case S_ATTR_SPACE:\n\t\t\t\t\t\t//\tvoid();break;\n\t\t\t\t\t\t//case S_TAG_CLOSE:\n\t\t\t\t\t\t//ignore warning\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//not space\n\t\t\t\t\t//S_TAG,\tS_ATTR,\tS_EQ,\tS_ATTR_NOQUOT_VALUE\n\t\t\t\t\t//S_ATTR_SPACE,\tS_ATTR_END,\tS_TAG_SPACE, S_TAG_CLOSE\n\t\t\t\t\tswitch (s) {\n\t\t\t\t\t\t//case S_TAG:void();break;\n\t\t\t\t\t\t//case S_ATTR:void();break;\n\t\t\t\t\t\t//case S_ATTR_NOQUOT_VALUE:void();break;\n\t\t\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\t\t\tif (!isHTML) {\n\t\t\t\t\t\t\t\terrorHandler.warning('attribute \"' + attrName + '\" missed value!! \"' + attrName + '\" instead2!!');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taddAttribute(attrName, attrName, start);\n\t\t\t\t\t\t\tstart = p;\n\t\t\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\t\t\terrorHandler.warning('attribute space is required\"' + attrName + '\"!!');\n\t\t\t\t\t\tcase S_TAG_SPACE:\n\t\t\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\t\t\tstart = p;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase S_EQ:\n\t\t\t\t\t\t\ts = S_ATTR_NOQUOT_VALUE;\n\t\t\t\t\t\t\tstart = p;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase S_TAG_CLOSE:\n\t\t\t\t\t\t\tthrow new Error(\"elements closed character '/' and '>' must be connected to\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t} //end outer switch\n\t\tp++;\n\t}\n}\n\n/**\n * @returns\n * `true` if a new namespace has been defined.\n */\nfunction appendElement(el, domBuilder, currentNSMap) {\n\tvar tagName = el.tagName;\n\tvar localNSMap = null;\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) {\n\t\t\t//hack!!\n\t\t\tif (localNSMap == null) {\n\t\t\t\tlocalNSMap = Object.create(null);\n\t\t\t\t_copy(currentNSMap, (currentNSMap = Object.create(null)));\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\tif (a.prefix) {\n\t\t\t//no prefix attribute has no namespace\n\t\t\tif (a.prefix === 'xml') {\n\t\t\t\ta.uri = NAMESPACE.XML;\n\t\t\t}\n\t\t\tif (a.prefix !== 'xmlns') {\n\t\t\t\ta.uri = currentNSMap[a.prefix];\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 (hasOwn(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}\n\nfunction parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {\n\t// https://html.spec.whatwg.org/#raw-text-elements\n\t// https://html.spec.whatwg.org/#escapable-raw-text-elements\n\t// https://html.spec.whatwg.org/#cdata-rcdata-restrictions:raw-text-elements\n\t// TODO: https://html.spec.whatwg.org/#cdata-rcdata-restrictions\n\tvar isEscapableRaw = isHTMLEscapableRawTextElement(tagName);\n\tif (isEscapableRaw || isHTMLRawTextElement(tagName)) {\n\t\tvar elEndStart = source.indexOf('', elStartEnd);\n\t\tvar text = source.substring(elStartEnd + 1, elEndStart);\n\n\t\tif (isEscapableRaw) {\n\t\t\ttext = text.replace(ENTITY_REG, entityReplacer);\n\t\t}\n\t\tdomBuilder.characters(text, 0, text.length);\n\t\treturn elEndStart;\n\t}\n\treturn elStartEnd + 1;\n}\n\nfunction _copy(source, target) {\n\tfor (var n in source) {\n\t\tif (hasOwn(source, n)) {\n\t\t\ttarget[n] = source[n];\n\t\t}\n\t}\n}\n\n/**\n * @typedef ParseUtils\n * @property {function(relativeIndex: number?): string | undefined} char\n * Provides look ahead access to a singe character relative to the current index.\n * @property {function(): number} getIndex\n * Provides read-only access to the current index.\n * @property {function(reg: RegExp): string | null} getMatch\n * Applies the provided regular expression enforcing that it starts at the current index and\n * returns the complete matching string,\n * and moves the current index by the length of the matching string.\n * @property {function(): string} getSource\n * Provides read-only access to the complete source.\n * @property {function(places: number?): void} skip\n * moves the current index by places (defaults to 1)\n * @property {function(): number} skipBlanks\n * Moves the current index by the amount of white space that directly follows the current index\n * and returns the amount of whitespace chars skipped (0..n),\n * or -1 if the end of the source was reached.\n * @property {function(): string} substringFromIndex\n * creates a substring from the current index to the end of `source`\n * @property {function(compareWith: string): boolean} substringStartsWith\n * Checks if source contains `compareWith`,\n * starting from the current index.\n * @see {@link parseUtils}\n */\n\n/**\n * A temporary scope for parsing and look ahead operations in `source`,\n * starting from index `start`.\n *\n * Some operations move the current index by a number of positions,\n * after which `getIndex` returns the new index.\n *\n * @param {string} source\n * @param {number} start\n * @returns {ParseUtils}\n */\nfunction parseUtils(source, start) {\n\tvar index = start;\n\n\tfunction char(n) {\n\t\tn = n || 0;\n\t\treturn source.charAt(index + n);\n\t}\n\n\tfunction skip(n) {\n\t\tn = n || 1;\n\t\tindex += n;\n\t}\n\n\tfunction skipBlanks() {\n\t\tvar blanks = 0;\n\t\twhile (index < source.length) {\n\t\t\tvar c = char();\n\t\t\tif (c !== ' ' && c !== '\\n' && c !== '\\t' && c !== '\\r') {\n\t\t\t\treturn blanks;\n\t\t\t}\n\t\t\tblanks++;\n\t\t\tskip();\n\t\t}\n\t\treturn -1;\n\t}\n\tfunction substringFromIndex() {\n\t\treturn source.substring(index);\n\t}\n\tfunction substringStartsWith(text) {\n\t\treturn source.substring(index, index + text.length) === text;\n\t}\n\n\tfunction getMatch(args) {\n\t\tvar expr = g.reg('^', args);\n\t\tvar match = expr.exec(substringFromIndex());\n\t\tif (match) {\n\t\t\tskip(match[0].length);\n\t\t\treturn match[0];\n\t\t}\n\t\treturn null;\n\t}\n\treturn {\n\t\tchar: char,\n\t\tgetIndex: function () {\n\t\t\treturn index;\n\t\t},\n\t\tgetMatch: getMatch,\n\t\tgetSource: function () {\n\t\t\treturn source;\n\t\t},\n\t\tskip: skip,\n\t\tskipBlanks: skipBlanks,\n\t\tsubstringFromIndex: substringFromIndex,\n\t\tsubstringStartsWith: substringStartsWith,\n\t};\n}\n\n/**\n * @param {ParseUtils} p\n * @param {DOMHandler} errorHandler\n * @returns {string}\n */\nfunction parseDoctypeInternalSubset(p, errorHandler) {\n\t/**\n\t * @param {ParseUtils} p\n\t * @param {DOMHandler} errorHandler\n\t * @returns {string}\n\t */\n\tfunction parsePI(p, errorHandler) {\n\t\tvar match = g.PI.exec(p.substringFromIndex());\n\t\tif (!match) {\n\t\t\treturn errorHandler.fatalError('processing instruction is not well-formed at position ' + p.getIndex());\n\t\t}\n\t\tif (match[1].toLowerCase() === 'xml') {\n\t\t\treturn errorHandler.fatalError(\n\t\t\t\t'xml declaration is only allowed at the start of the document, but found at position ' + p.getIndex()\n\t\t\t);\n\t\t}\n\t\tp.skip(match[0].length);\n\t\treturn match[0];\n\t}\n\t// Parse internal subset\n\tvar source = p.getSource();\n\tif (p.char() === '[') {\n\t\tp.skip(1);\n\t\tvar intSubsetStart = p.getIndex();\n\t\twhile (p.getIndex() < source.length) {\n\t\t\tp.skipBlanks();\n\t\t\tif (p.char() === ']') {\n\t\t\t\tvar internalSubset = source.substring(intSubsetStart, p.getIndex());\n\t\t\t\tp.skip(1);\n\t\t\t\treturn internalSubset;\n\t\t\t}\n\t\t\tvar current = null;\n\t\t\t// Only in external subset\n\t\t\t// if (char() === '<' && char(1) === '!' && char(2) === '[') {\n\t\t\t// \tparseConditionalSections(p, errorHandler);\n\t\t\t// } else\n\t\t\tif (p.char() === '<' && p.char(1) === '!') {\n\t\t\t\tswitch (p.char(2)) {\n\t\t\t\t\tcase 'E': // ELEMENT | ENTITY\n\t\t\t\t\t\tif (p.char(3) === 'L') {\n\t\t\t\t\t\t\tcurrent = p.getMatch(g.elementdecl);\n\t\t\t\t\t\t} else if (p.char(3) === 'N') {\n\t\t\t\t\t\t\tcurrent = p.getMatch(g.EntityDecl);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'A': // ATTRIBUTE\n\t\t\t\t\t\tcurrent = p.getMatch(g.AttlistDecl);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'N': // NOTATION\n\t\t\t\t\t\tcurrent = p.getMatch(g.NotationDecl);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '-': // COMMENT\n\t\t\t\t\t\tcurrent = p.getMatch(g.Comment);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (p.char() === '<' && p.char(1) === '?') {\n\t\t\t\tcurrent = parsePI(p, errorHandler);\n\t\t\t} else if (p.char() === '%') {\n\t\t\t\tcurrent = p.getMatch(g.PEReference);\n\t\t\t} else {\n\t\t\t\treturn errorHandler.fatalError('Error detected in Markup declaration');\n\t\t\t}\n\t\t\tif (!current) {\n\t\t\t\treturn errorHandler.fatalError('Error in internal subset at position ' + p.getIndex());\n\t\t\t}\n\t\t}\n\t\treturn errorHandler.fatalError('doctype internal subset is not well-formed, missing ]');\n\t}\n}\n\n/**\n * Called when the parser encounters an element starting with '') {\n\t\t\t\treturn errorHandler.fatalError('doctype not terminated with > at position ' + p.getIndex());\n\t\t\t}\n\t\t\tp.skip(1);\n\t\t\tdomBuilder.startDTD(doctype.name, doctype.publicId, doctype.systemId, doctype.internalSubset);\n\t\t\tdomBuilder.endDTD();\n\t\t\treturn p.getIndex();\n\t\t}\n\t\tdefault:\n\t\t\treturn errorHandler.fatalError('Not well-formed XML starting with \" 0) {\n\t\t\treturn errorHandler.fatalError(\n\t\t\t\t'processing instruction at position ' + start + ' is an xml declaration which is only at the start of the document'\n\t\t\t);\n\t\t}\n\t\tif (!g.XMLDecl.test(source.substring(start))) {\n\t\t\treturn errorHandler.fatalError('xml declaration is not well-formed');\n\t\t}\n\t}\n\tdomBuilder.processingInstruction(match[1], match[2]);\n\treturn start + match[0].length;\n}\n\nfunction ElementAttributes() {\n\tthis.attributeNames = Object.create(null);\n}\n\nElementAttributes.prototype = {\n\tsetTagName: function (tagName) {\n\t\tif (!g.QName_exact.test(tagName)) {\n\t\t\tthrow new Error('invalid tagName:' + tagName);\n\t\t}\n\t\tthis.tagName = tagName;\n\t},\n\taddValue: function (qName, value, offset) {\n\t\tif (!g.QName_exact.test(qName)) {\n\t\t\tthrow new Error('invalid attribute:' + qName);\n\t\t}\n\t\tthis.attributeNames[qName] = this.length;\n\t\tthis[this.length++] = { qName: qName, value: value, offset: offset };\n\t},\n\tlength: 0,\n\tgetLocalName: function (i) {\n\t\treturn this[i].localName;\n\t},\n\tgetLocator: function (i) {\n\t\treturn this[i].locator;\n\t},\n\tgetQName: function (i) {\n\t\treturn this[i].qName;\n\t},\n\tgetURI: function (i) {\n\t\treturn this[i].uri;\n\t},\n\tgetValue: function (i) {\n\t\treturn this[i].value;\n\t},\n\t//\t,getIndex:function(uri, localName)){\n\t//\t\tif(localName){\n\t//\n\t//\t\t}else{\n\t//\t\t\tvar qName = uri\n\t//\t\t}\n\t//\t},\n\t//\tgetValue:function(){return this.getValue(this.getIndex.apply(this,arguments))},\n\t//\tgetType:function(uri,localName){}\n\t//\tgetType:function(i){},\n};\n\nexports.XMLReader = XMLReader;\nexports.parseUtils = parseUtils;\nexports.parseDoctypeCommentOrCData = parseDoctypeCommentOrCData;\n","'use strict';\n\nvar conventions = require('./conventions');\nvar dom = require('./dom');\nvar errors = require('./errors');\nvar entities = require('./entities');\nvar sax = require('./sax');\n\nvar DOMImplementation = dom.DOMImplementation;\n\nvar hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace;\nvar isHTMLMimeType = conventions.isHTMLMimeType;\nvar isValidMimeType = conventions.isValidMimeType;\nvar MIME_TYPE = conventions.MIME_TYPE;\nvar NAMESPACE = conventions.NAMESPACE;\nvar ParseError = errors.ParseError;\n\nvar XMLReader = sax.XMLReader;\n\n/**\n * Normalizes line ending according to :\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 * @prettierignore\n */\nfunction normalizeLineEndings(input) {\n\treturn input.replace(/\\r[\\n\\u0085]/g, '\\n').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 {typeof assign} [assign]\n * The method to use instead of `conventions.assign`, which is used to copy values from\n * `options` before they are used for parsing.\n * @property {typeof DOMHandler} [domHandler]\n * For internal testing: The class for creating an instance for handling events from the SAX\n * parser.\n * *****Warning: By configuring a faulty implementation, the specified behavior can completely\n * be broken.*****.\n * @property {Function} [errorHandler]\n * DEPRECATED! use `onError` instead.\n * @property {function(level:ErrorLevel, message:string, context: DOMHandler):void}\n * [onError]\n * A function that is invoked for every error that occurs during parsing.\n *\n * If it is not provided, all errors are reported to `console.error`\n * and only `fatalError`s are thrown as a `ParseError`,\n * which prevents any further processing.\n * If the provided method throws, a `ParserError` is thrown,\n * which prevents any further processing.\n *\n * Be aware that many `warning`s are considered an error that prevents further processing in\n * most implementations.\n * @property {boolean} [locator=true]\n * Configures if the nodes created during parsing will have a `lineNumber` and a `columnNumber`\n * attribute describing their location in the XML string.\n * Default is true.\n * @property {(string) => string} [normalizeLineEndings]\n * used to replace line endings before parsing, defaults to `normalizeLineEndings`\n * @property {Object} [xmlns]\n * The XML namespaces that should be assumed when parsing.\n * The default namespace can be provided by the key that is the empty string.\n * When the `mimeType` for HTML, XHTML or SVG are passed to `parseFromString`,\n * the default namespace that will be used,\n * will be overridden according to the specification.\n * @see {@link normalizeLineEndings}\n */\n\n/**\n * The DOMParser interface provides the ability to parse XML or HTML source code from a string\n * into a DOM `Document`.\n *\n * ***xmldom is different from the spec in that it allows an `options` parameter,\n * to control the behavior***.\n *\n * @class\n * @param {DOMParserOptions} [options]\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\toptions = options || { locator: true };\n\n\t/**\n\t * The method to use instead of `conventions.assign`, which is used to copy values from\n\t * `options`\n\t * before they are used for parsing.\n\t *\n\t * @type {conventions.assign}\n\t * @private\n\t * @see {@link conventions.assign}\n\t * @readonly\n\t */\n\tthis.assign = options.assign || conventions.assign;\n\n\t/**\n\t * For internal testing: The class for creating an instance for handling events from the SAX\n\t * parser.\n\t * *****Warning: By configuring a faulty implementation, the specified behavior can completely\n\t * be broken*****.\n\t *\n\t * @type {typeof DOMHandler}\n\t * @private\n\t * @readonly\n\t */\n\tthis.domHandler = options.domHandler || DOMHandler;\n\n\t/**\n\t * A function that is invoked for every error that occurs during parsing.\n\t *\n\t * If it is not provided, all errors are reported to `console.error`\n\t * and only `fatalError`s are thrown as a `ParseError`,\n\t * which prevents any further processing.\n\t * If the provided method throws, a `ParserError` is thrown,\n\t * which prevents any further processing.\n\t *\n\t * Be aware that many `warning`s are considered an error that prevents further processing in\n\t * most implementations.\n\t *\n\t * @type {function(level:ErrorLevel, message:string, context: DOMHandler):void}\n\t * @see {@link onErrorStopParsing}\n\t * @see {@link onWarningStopParsing}\n\t */\n\tthis.onError = options.onError || options.errorHandler;\n\tif (options.errorHandler && typeof options.errorHandler !== 'function') {\n\t\tthrow new TypeError('errorHandler object is no longer supported, switch to onError!');\n\t} else if (options.errorHandler) {\n\t\toptions.errorHandler('warning', 'The `errorHandler` option has been deprecated, use `onError` instead!', this);\n\t}\n\n\t/**\n\t * used to replace line endings before parsing, defaults to `normalizeLineEndings`\n\t *\n\t * @type {(string) => string}\n\t * @readonly\n\t */\n\tthis.normalizeLineEndings = options.normalizeLineEndings || normalizeLineEndings;\n\n\t/**\n\t * Configures if the nodes created during parsing will have a `lineNumber` and a\n\t * `columnNumber`\n\t * attribute describing their location in the XML string.\n\t * Default is true.\n\t *\n\t * @type {boolean}\n\t * @readonly\n\t */\n\tthis.locator = !!options.locator;\n\n\t/**\n\t * The default namespace can be provided by the key that is the empty string.\n\t * When the `mimeType` for HTML, XHTML or SVG are passed to `parseFromString`,\n\t * the default namespace that will be used,\n\t * will be overridden according to the specification.\n\t *\n\t * @type {Readonly}\n\t * @readonly\n\t */\n\tthis.xmlns = this.assign(Object.create(null), options.xmlns);\n}\n\n/**\n * Parses `source` using the options in the way configured by the `DOMParserOptions` of `this`\n * `DOMParser`. If `mimeType` is `text/html` an HTML `Document` is created,\n * otherwise an XML `Document` is created.\n *\n * __It behaves different from the description in the living standard__:\n * - Uses the `options` passed to the `DOMParser` constructor to modify the behavior.\n * - Any unexpected input is reported to `onError` with either a `warning`,\n * `error` or `fatalError` level.\n * - Any `fatalError` throws a `ParseError` which prevents further processing.\n * - Any error thrown by `onError` is converted to a `ParseError` which prevents further\n * processing - If no `Document` was created during parsing it is reported as a `fatalError`.\n * *****Warning: By configuring a faulty DOMHandler implementation,\n * the specified behavior can completely be broken*****.\n *\n * @param {string} source\n * The XML mime type only allows string input!\n * @param {string} [mimeType='application/xml']\n * the mimeType or contentType of the document to be created determines the `type` of document\n * created (XML or HTML)\n * @returns {Document}\n * The `Document` node.\n * @throws {ParseError}\n * for any `fatalError` or anything that is thrown by `onError`\n * @throws {TypeError}\n * for any invalid `mimeType`\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString\n * @see https://html.spec.whatwg.org/#dom-domparser-parsefromstring-dev\n */\nDOMParser.prototype.parseFromString = function (source, mimeType) {\n\tif (!isValidMimeType(mimeType)) {\n\t\tthrow new TypeError('DOMParser.parseFromString: the provided mimeType \"' + mimeType + '\" is not valid.');\n\t}\n\tvar defaultNSMap = this.assign(Object.create(null), this.xmlns);\n\tvar entityMap = entities.XML_ENTITIES;\n\tvar defaultNamespace = defaultNSMap[''] || null;\n\tif (hasDefaultHTMLNamespace(mimeType)) {\n\t\tentityMap = entities.HTML_ENTITIES;\n\t\tdefaultNamespace = NAMESPACE.HTML;\n\t} else if (mimeType === MIME_TYPE.XML_SVG_IMAGE) {\n\t\tdefaultNamespace = NAMESPACE.SVG;\n\t}\n\tdefaultNSMap[''] = defaultNamespace;\n\tdefaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;\n\n\tvar domBuilder = new this.domHandler({\n\t\tmimeType: mimeType,\n\t\tdefaultNamespace: defaultNamespace,\n\t\tonError: this.onError,\n\t});\n\tvar locator = this.locator ? {} : undefined;\n\tif (this.locator) {\n\t\tdomBuilder.setDocumentLocator(locator);\n\t}\n\n\tvar sax = new XMLReader();\n\tsax.errorHandler = domBuilder;\n\tsax.domBuilder = domBuilder;\n\tvar isXml = !conventions.isHTMLMimeType(mimeType);\n\tif (isXml && typeof source !== 'string') {\n\t\tsax.errorHandler.fatalError('source is not a string');\n\t}\n\tsax.parse(this.normalizeLineEndings(String(source)), defaultNSMap, entityMap);\n\tif (!domBuilder.doc.documentElement) {\n\t\tsax.errorHandler.fatalError('missing root element');\n\t}\n\treturn domBuilder.doc;\n};\n\n/**\n * @typedef DOMHandlerOptions\n * @property {string} [mimeType=MIME_TYPE.XML_APPLICATION]\n * @property {string | null} [defaultNamespace=null]\n */\n/**\n * The class that is used to handle events from the SAX parser to create the related DOM\n * elements.\n *\n * Some methods are only implemented as an empty function,\n * since they are (at least currently) not relevant for xmldom.\n *\n * @class\n * @param {DOMHandlerOptions} [options]\n * @see http://www.saxproject.org/apidoc/org/xml/sax/ext/DefaultHandler2.html\n */\nfunction DOMHandler(options) {\n\tvar opt = options || {};\n\t/**\n\t * The mime type is used to determine if the DOM handler will create an XML or HTML document.\n\t * Only if it is set to `text/html` it will create an HTML document.\n\t * It defaults to MIME_TYPE.XML_APPLICATION.\n\t *\n\t * @type {string}\n\t * @see {@link MIME_TYPE}\n\t * @readonly\n\t */\n\tthis.mimeType = opt.mimeType || MIME_TYPE.XML_APPLICATION;\n\n\t/**\n\t * The namespace to use to create an XML document.\n\t * For the following reasons this is required:\n\t * - The SAX API for `startDocument` doesn't offer any way to pass a namespace,\n\t * since at that point there is no way for the parser to know what the default namespace from\n\t * the document will be.\n\t * - When creating using `DOMImplementation.createDocument` it is required to pass a\n\t * namespace,\n\t * to determine the correct `Document.contentType`, which should match `this.mimeType`.\n\t * - When parsing an XML document with the `application/xhtml+xml` mimeType,\n\t * the HTML namespace needs to be the default namespace.\n\t *\n\t * @type {string | null}\n\t * @private\n\t * @readonly\n\t */\n\tthis.defaultNamespace = opt.defaultNamespace || null;\n\n\t/**\n\t * @type {boolean}\n\t * @private\n\t */\n\tthis.cdata = false;\n\n\t/**\n\t * The last `Element` that was created by `startElement`.\n\t * `endElement` sets it to the `currentElement.parentNode`.\n\t *\n\t * Note: The sax parser currently sets it to white space text nodes between tags.\n\t *\n\t * @type {Element | Node | undefined}\n\t * @private\n\t */\n\tthis.currentElement = undefined;\n\n\t/**\n\t * The Document that is created as part of `startDocument`,\n\t * and returned by `DOMParser.parseFromString`.\n\t *\n\t * @type {Document | undefined}\n\t * @readonly\n\t */\n\tthis.doc = undefined;\n\n\t/**\n\t * The locator is stored as part of setDocumentLocator.\n\t * It is controlled and mutated by the SAX parser to store the current parsing position.\n\t * It is used by DOMHandler to set `columnNumber` and `lineNumber`\n\t * on the DOM nodes.\n\t *\n\t * @type {Readonly | undefined}\n\t * @private\n\t * @readonly (the\n\t * sax parser currently sometimes set's it)\n\t */\n\tthis.locator = undefined;\n\t/**\n\t * @type {function (level:ErrorLevel ,message:string, context:DOMHandler):void}\n\t * @readonly\n\t */\n\tthis.onError = opt.onError;\n}\n\nfunction position(locator, node) {\n\tnode.lineNumber = locator.lineNumber;\n\tnode.columnNumber = locator.columnNumber;\n}\n\nDOMHandler.prototype = {\n\t/**\n\t * Either creates an XML or an HTML document and stores it under `this.doc`.\n\t * If it is an XML document, `this.defaultNamespace` is used to create it,\n\t * and it will not contain any `childNodes`.\n\t * If it is an HTML document, it will be created without any `childNodes`.\n\t *\n\t * @see http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html\n\t */\n\tstartDocument: function () {\n\t\tvar impl = new DOMImplementation();\n\t\tthis.doc = isHTMLMimeType(this.mimeType) ? impl.createHTMLDocument(false) : impl.createDocument(this.defaultNamespace, '');\n\t},\n\tstartElement: function (namespaceURI, localName, qName, attrs) {\n\t\tvar doc = this.doc;\n\t\tvar el = doc.createElementNS(namespaceURI, qName || localName);\n\t\tvar len = attrs.length;\n\t\tappendElement(this, el);\n\t\tthis.currentElement = el;\n\n\t\tthis.locator && position(this.locator, el);\n\t\tfor (var i = 0; i < len; i++) {\n\t\t\tvar namespaceURI = attrs.getURI(i);\n\t\t\tvar value = attrs.getValue(i);\n\t\t\tvar 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\t}\n\t},\n\tendElement: function (namespaceURI, localName, qName) {\n\t\tthis.currentElement = this.currentElement.parentNode;\n\t},\n\tstartPrefixMapping: function (prefix, uri) {},\n\tendPrefixMapping: function (prefix) {},\n\tprocessingInstruction: function (target, data) {\n\t\tvar ins = this.doc.createProcessingInstruction(target, data);\n\t\tthis.locator && position(this.locator, ins);\n\t\tappendElement(this, ins);\n\t},\n\tignorableWhitespace: function (ch, start, length) {},\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\tendDocument: function () {\n\t\tthis.doc.normalize();\n\t},\n\t/**\n\t * Stores the locator to be able to set the `columnNumber` and `lineNumber`\n\t * on the created DOM nodes.\n\t *\n\t * @param {Locator} locator\n\t */\n\tsetDocumentLocator: function (locator) {\n\t\tif (locator) {\n\t\t\tlocator.lineNumber = 0;\n\t\t}\n\t\tthis.locator = locator;\n\t},\n\t//LexicalHandler\n\tcomment: function (chars, start, length) {\n\t\tchars = _toString.apply(this, arguments);\n\t\tvar comm = this.doc.createComment(chars);\n\t\tthis.locator && position(this.locator, comm);\n\t\tappendElement(this, comm);\n\t},\n\n\tstartCDATA: function () {\n\t\t//used in characters() methods\n\t\tthis.cdata = true;\n\t},\n\tendCDATA: function () {\n\t\tthis.cdata = false;\n\t},\n\n\tstartDTD: function (name, publicId, systemId, internalSubset) {\n\t\tvar impl = this.doc.implementation;\n\t\tif (impl && impl.createDocumentType) {\n\t\t\tvar dt = impl.createDocumentType(name, publicId, systemId, internalSubset);\n\t\t\tthis.locator && position(this.locator, dt);\n\t\t\tappendElement(this, dt);\n\t\t\tthis.doc.doctype = dt;\n\t\t}\n\t},\n\treportError: function (level, message) {\n\t\tif (typeof this.onError === 'function') {\n\t\t\ttry {\n\t\t\t\tthis.onError(level, message, this);\n\t\t\t} catch (e) {\n\t\t\t\tthrow new ParseError('Reporting ' + level + ' \"' + message + '\" caused ' + e, this.locator);\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.error('[xmldom ' + level + ']\\t' + message, _locator(this.locator));\n\t\t}\n\t},\n\t/**\n\t * @see http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html\n\t */\n\twarning: function (message) {\n\t\tthis.reportError('warning', message);\n\t},\n\terror: function (message) {\n\t\tthis.reportError('error', message);\n\t},\n\t/**\n\t * This function reports a fatal error and throws a ParseError.\n\t *\n\t * @param {string} message\n\t * - The message to be used for reporting and throwing the error.\n\t * @returns {never}\n\t * This function always throws an error and never returns a value.\n\t * @throws {ParseError}\n\t * Always throws a ParseError with the provided message.\n\t */\n\tfatalError: function (message) {\n\t\tthis.reportError('fatalError', message);\n\t\tthrow new ParseError(message, this.locator);\n\t},\n};\n\nfunction _locator(l) {\n\tif (l) {\n\t\treturn '\\n@#[line:' + l.lineNumber + ',col:' + l.columnNumber + ']';\n\t}\n}\n\nfunction _toString(chars, start, length) {\n\tif (typeof chars == 'string') {\n\t\treturn chars.substr(start, length);\n\t} else {\n\t\t//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(\n\t/\\w+/g,\n\tfunction (key) {\n\t\tDOMHandler.prototype[key] = function () {\n\t\t\treturn null;\n\t\t};\n\t}\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(handler, node) {\n\tif (!handler.currentElement) {\n\t\thandler.doc.appendChild(node);\n\t} else {\n\t\thandler.currentElement.appendChild(node);\n\t}\n}\n\n/**\n * A method that prevents any further parsing when an `error`\n * with level `error` is reported during parsing.\n *\n * @see {@link DOMParserOptions.onError}\n * @see {@link onWarningStopParsing}\n */\nfunction onErrorStopParsing(level) {\n\tif (level === 'error') throw 'onErrorStopParsing';\n}\n\n/**\n * A method that prevents any further parsing when any `error` is reported during parsing.\n *\n * @see {@link DOMParserOptions.onError}\n * @see {@link onErrorStopParsing}\n */\nfunction onWarningStopParsing() {\n\tthrow 'onWarningStopParsing';\n}\n\nexports.__DOMHandler = DOMHandler;\nexports.DOMParser = DOMParser;\nexports.normalizeLineEndings = normalizeLineEndings;\nexports.onErrorStopParsing = onErrorStopParsing;\nexports.onWarningStopParsing = onWarningStopParsing;\n","'use strict';\nvar conventions = require('./conventions');\nexports.assign = conventions.assign;\nexports.hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace;\nexports.isHTMLMimeType = conventions.isHTMLMimeType;\nexports.isValidMimeType = conventions.isValidMimeType;\nexports.MIME_TYPE = conventions.MIME_TYPE;\nexports.NAMESPACE = conventions.NAMESPACE;\n\nvar errors = require('./errors');\nexports.DOMException = errors.DOMException;\nexports.DOMExceptionName = errors.DOMExceptionName;\nexports.ExceptionCode = errors.ExceptionCode;\nexports.ParseError = errors.ParseError;\n\nvar dom = require('./dom');\nexports.Attr = dom.Attr;\nexports.CDATASection = dom.CDATASection;\nexports.CharacterData = dom.CharacterData;\nexports.Comment = dom.Comment;\nexports.Document = dom.Document;\nexports.DocumentFragment = dom.DocumentFragment;\nexports.DocumentType = dom.DocumentType;\nexports.DOMImplementation = dom.DOMImplementation;\nexports.Element = dom.Element;\nexports.Entity = dom.Entity;\nexports.EntityReference = dom.EntityReference;\nexports.LiveNodeList = dom.LiveNodeList;\nexports.NamedNodeMap = dom.NamedNodeMap;\nexports.Node = dom.Node;\nexports.NodeList = dom.NodeList;\nexports.Notation = dom.Notation;\nexports.ProcessingInstruction = dom.ProcessingInstruction;\nexports.Text = dom.Text;\nexports.XMLSerializer = dom.XMLSerializer;\n\nvar domParser = require('./dom-parser');\nexports.DOMParser = domParser.DOMParser;\nexports.onErrorStopParsing = domParser.onErrorStopParsing;\nexports.onWarningStopParsing = domParser.onWarningStopParsing;\n","import { DOMParser as O, DOMImplementation as T } from \"@xmldom/xmldom\";\nconst b = \"USJ\", N = \"3.1\", m = [\n \"type\",\n \"marker\",\n \"content\",\n \"sid\",\n \"eid\",\n \"number\",\n \"code\",\n \"altnumber\",\n \"pubnumber\",\n \"caller\",\n \"align\",\n \"category\"\n];\nfunction P(e) {\n return g.includes(e);\n}\nconst g = [\n // Old Testament\n \"GEN\",\n \"EXO\",\n \"LEV\",\n \"NUM\",\n \"DEU\",\n \"JOS\",\n \"JDG\",\n \"RUT\",\n \"1SA\",\n \"2SA\",\n \"1KI\",\n \"2KI\",\n \"1CH\",\n \"2CH\",\n \"EZR\",\n \"NEH\",\n \"EST\",\n \"JOB\",\n \"PSA\",\n \"PRO\",\n \"ECC\",\n \"SNG\",\n \"ISA\",\n \"JER\",\n \"LAM\",\n \"EZK\",\n \"DAN\",\n \"HOS\",\n \"JOL\",\n \"AMO\",\n \"OBA\",\n \"JON\",\n \"MIC\",\n \"NAM\",\n \"HAB\",\n \"ZEP\",\n \"HAG\",\n \"ZEC\",\n \"MAL\",\n // New Testament\n \"MAT\",\n \"MRK\",\n \"LUK\",\n \"JHN\",\n \"ACT\",\n \"ROM\",\n \"1CO\",\n \"2CO\",\n \"GAL\",\n \"EPH\",\n \"PHP\",\n \"COL\",\n \"1TH\",\n \"2TH\",\n \"1TI\",\n \"2TI\",\n \"TIT\",\n \"PHM\",\n \"HEB\",\n \"JAS\",\n \"1PE\",\n \"2PE\",\n \"1JN\",\n \"2JN\",\n \"3JN\",\n \"JUD\",\n \"REV\",\n // Deuterocanon\n \"TOB\",\n \"JDT\",\n \"ESG\",\n \"WIS\",\n \"SIR\",\n \"BAR\",\n \"LJE\",\n \"S3Y\",\n \"SUS\",\n \"BEL\",\n \"1MA\",\n \"2MA\",\n \"3MA\",\n \"4MA\",\n \"1ES\",\n \"2ES\",\n \"MAN\",\n \"PS2\",\n \"ODA\",\n \"PSS\",\n \"EZA\",\n \"5EZ\",\n \"6EZ\",\n \"DAG\",\n \"PS3\",\n \"2BA\",\n \"LBA\",\n \"JUB\",\n \"ENO\",\n \"1MQ\",\n \"2MQ\",\n \"3MQ\",\n \"REP\",\n \"4BA\",\n \"LAO\",\n // Non scripture\n \"FRT\",\n \"BAK\",\n \"OTH\",\n \"INT\",\n \"CNC\",\n \"GLO\",\n \"TDX\",\n \"NDX\",\n \"XXA\",\n \"XXB\",\n \"XXC\",\n \"XXD\",\n \"XXE\",\n \"XXF\",\n \"XXG\"\n], u = \"usx\", v = \"3.1\";\nfunction S(e) {\n const t = {};\n let i = e.tagName, o, r, d = \"append\";\n if ([\"row\", \"cell\"].includes(i) && (i = \"table:\" + i), e.attributes)\n for (let c = 0; c < e.attributes.length; c++) {\n const s = e.attributes[c];\n t[s.name] = s.value;\n }\n t.style && (o = t.style, delete t.style), t.vid && delete t.vid, t.closed && delete t.closed, t.status && delete t.status;\n let n = { type: i };\n o && (n.marker = o), n = { ...n, ...t }, e.firstChild && e.firstChild.nodeType === e.firstChild.TEXT_NODE && e.firstChild.nodeValue && e.firstChild.nodeValue.trim() !== \"\" && (r = e.firstChild.nodeValue);\n const f = Array.from(e.childNodes);\n n.content = [], r && n.content.push(r);\n for (const c of f) {\n if (c.tagName === void 0)\n continue;\n const [s, h] = S(c);\n switch (h) {\n case \"append\":\n n.content.push(s);\n break;\n case \"merge\":\n n.content = n.content.concat(s);\n break;\n }\n c.nextSibling && c.nextSibling.nodeType === c.nextSibling.TEXT_NODE && c.nextSibling.nodeValue && (c.nextSibling.nodeValue.trim() !== \"\" || c.nextSibling.nodeValue === \" \") && n.content.push(c.nextSibling.nodeValue);\n }\n return (n.content.length === 0 && n.type !== u || [\"chapter\", \"verse\", \"optbreak\", \"ms\"].includes(i) || o && [\"va\", \"ca\", \"b\"].includes(o)) && delete n.content, \"eid\" in n && [\"verse\", \"chapter\"].includes(i) && (d = \"ignore\"), [n, d];\n}\nfunction M(e) {\n const [t] = e ? S(e) : [{ content: [] }];\n return t.type = b, t.version = N, t;\n}\nfunction R(e) {\n const i = new O().parseFromString(e, \"text/xml\");\n return M(i.documentElement);\n}\nlet l, a;\nfunction A(e, t) {\n const i = e.createElement(\"verse\");\n return i.setAttribute(\"eid\", t), i;\n}\nfunction E(e, t) {\n const i = e.createElement(\"chapter\");\n return i.setAttribute(\"eid\", t), i;\n}\nfunction X(e, t) {\n t.type === \"unmatched\" ? e.setAttribute(\"marker\", t.marker) : e.setAttribute(\"style\", t.marker);\n for (const [i, o] of Object.entries(t))\n o && ![\"type\", \"marker\", \"content\"].includes(i) && e.setAttribute(i, o);\n}\nfunction p(e, t, i, o) {\n let r, d, n;\n if (typeof e == \"string\") r = i.createTextNode(e);\n else if (d = e.type.replace(\"table:\", \"\"), r = i.createElement(d), X(r, e), e.content)\n for (const [f, c] of e.content.entries()) {\n const s = f === e.content.length - 1;\n p(c, r, i, s);\n }\n a && (d === \"verse\" || t.tagName === \"para\" && o) && (n = A(i, a), a = void 0), d === \"verse\" && typeof e != \"string\" && e.sid !== void 0 && (a = e.sid), l && (d === \"chapter\" || d === \"para\" && o) && (n = E(i, l), l = void 0), d === \"chapter\" && typeof e != \"string\" && e.sid !== void 0 && (l = e.sid), n && !o && t.appendChild(n), t.appendChild(r), n && o && t.appendChild(n), o && t.nodeName === u && (a && t.appendChild(A(i, a)), l && t.appendChild(E(i, l)), a = void 0, l = void 0);\n}\nfunction y(e, t) {\n if (t.documentElement) {\n for (const [i, o] of e.content.entries()) {\n const r = i === e.content.length - 1;\n p(o, t.documentElement, t, r);\n }\n return t.documentElement ?? void 0;\n }\n}\nfunction B(e) {\n const t = new T().createDocument(\"\", u);\n return t.documentElement && (t.documentElement.setAttribute(\"version\", v), y(e, t)), t.toString();\n}\nexport {\n m as MARKER_OBJECT_PROPS,\n b as USJ_TYPE,\n N as USJ_VERSION,\n P as isValidBookCode,\n B as usjToUsxString,\n R as usxStringToUsj\n};\n//# sourceMappingURL=index.js.map\n","// This was disabled so class functions that are similar in purpose can be grouped together\n/* eslint-disable @typescript-eslint/member-ordering */\nimport {\n USJ_TYPE,\n type MarkerContent,\n type MarkerObject,\n type Usj,\n} from '@biblionexus-foundation/scripture-utilities';\nimport { VerseRef } from '@sillsdev/scripture';\nimport { JSONPath } from 'jsonpath-plus';\nimport {\n CHAPTER_TYPE,\n ContentJsonPath,\n IUsjReaderWriter,\n UsjContentLocation,\n VERSE_TYPE,\n VerseRefOffset,\n} from './usj-reader-writer.model';\n\nconst NODE_TYPES_NOT_CONTAINING_VERSE_TEXT = ['figure', 'note', 'sidebar', 'table'];\nObject.freeze(NODE_TYPES_NOT_CONTAINING_VERSE_TEXT);\n\n/** Map of USJ content arrays and objects inside content arrays to the content array owner */\ntype UsjParentMap = Map;\n\n/**\n * Represents information about where a USJ node resides in the `content` array of its parent.\n * `parent` is a reference to the node's parent, and `index` represents the numeric index inside of\n * `parent`'s content array.\n */\ntype StackItem = { parent: MarkerObject | Usj; index: number };\n\n/**\n * Stack of levels inside a USJ tree relative to a specific node. The top of the stack should always\n * be the root Usj object.\n */\ntype WorkingStack = StackItem[];\n\n/**\n * Chapter and verse numbers along with the node within a USJ object that represents the start of\n * that chapter + verse\n */\ntype ChapterVerseNode = {\n chapterNum: number | undefined;\n verseNum: number | undefined;\n /**\n * All text following this node belongs to the given chapter and verse until another chapter or\n * verse node is found\n */\n startingContentNode: MarkerObject | undefined;\n};\n\n/** Represents USJ formatted scripture with helpful utilities for working with it */\nexport default class UsjReaderWriter implements IUsjReaderWriter {\n private readonly usj: Usj;\n private parentMapInternal: UsjParentMap | undefined;\n\n constructor(usj: Usj) {\n this.usj = usj;\n }\n\n // If new variables are created to speed up queries, they should be reset here\n usjChanged(): void {\n this.parentMapInternal = undefined;\n }\n\n // #region Directly using the JSONPath package to perform JSONPath query -> USJ node\n\n findSingleValue(jsonPathQuery: string): T | undefined {\n const wrappedResults = JSONPath({ path: jsonPathQuery, json: this.usj, wrap: true });\n if (wrappedResults === undefined || wrappedResults.length === 0) return undefined;\n if (!Array.isArray(wrappedResults[0])) return wrappedResults[0];\n\n // There is no way to tell the difference between a query that returns a single result that is an\n // array and a query that returns multiple results wrapped in an array when `wrap` is false.\n // However, if `wrap` is true then a single result that is an array will be a different array\n // object than the array object within `usj`. So we need to run with `wrap` as true and false to\n // get the original array object back for a query that returns a single array.\n const unwrappedResults = JSONPath({ path: jsonPathQuery, json: this.usj, wrap: false });\n if (unwrappedResults.length === 1 && Array.isArray(unwrappedResults[0]))\n // I have no idea why eslint is mad about casting from `any` to `T`, but it doesn't like it\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n return unwrappedResults[0] as T;\n return unwrappedResults;\n }\n\n findParent(jsonPathQuery: string): T | undefined {\n // Note that \"resultType: 'parent'\" does not work for queries\n // The \"jsonpath-plus\" package allows putting a carat at the end of a query to get a parent\n return this.findSingleValue(`${jsonPathQuery}^`);\n }\n\n private findBookId(): string | undefined {\n return this.findSingleValue('$.content[?(@.type==\"book\" && @.marker==\"id\")].code');\n }\n\n private findChapterNode(chapterNumber: number): MarkerObject | undefined {\n const chapterQuery = `$..content[?(@.type==\"chapter\" && @.number==\"${chapterNumber}\")]`;\n return this.findSingleValue(chapterQuery);\n }\n\n // #endregion\n\n // #region Parent Maps\n\n private static createParentMapInternal(\n obj: MarkerObject,\n parent: MarkerObject | Usj,\n parentMap: UsjParentMap,\n ): void {\n parentMap.set(obj, parent);\n // USJ queries may return pointers to content arrays, not just objects\n if (obj.content) parentMap.set(obj.content, obj);\n obj.content?.forEach((child) => {\n if (typeof child === 'object') UsjReaderWriter.createParentMapInternal(child, obj, parentMap);\n });\n }\n\n /** Viewing a Usj object as a tree, build a map to walk up the tree */\n private createUsjParentMap(): UsjParentMap {\n const parentMap = new Map();\n if (this.usj.content) parentMap.set(this.usj.content, this.usj);\n this.usj.content.forEach((content) => {\n if (typeof content === 'object')\n UsjReaderWriter.createParentMapInternal(content, this.usj, parentMap);\n });\n return parentMap;\n }\n\n /** Create the parent map if it doesn't already exist and return it */\n private get parentMap(): UsjParentMap {\n if (this.parentMapInternal) return this.parentMapInternal;\n this.parentMapInternal = this.createUsjParentMap();\n return this.parentMapInternal;\n }\n\n // #endregion\n\n // #region Working Stacks\n\n /** Return the working stack applicable to the given node */\n private createWorkingStack(node: MarkerObject): WorkingStack {\n // Represents levels in the USJ node tree that are above the current node (i.e., ancestors)\n // Levels in the tree are represented as a stack, so the last item in the stack is node's parent\n const workingStack: WorkingStack = [];\n\n // Grab a reference so we don't keep checking if it exists\n const { parentMap } = this;\n\n // `node` might be in the middle of the USJ tree, so build up the stack before walking the tree\n let tempNode: MarkerObject | Usj = node;\n let tempParent = parentMap.get(tempNode);\n while (tempParent !== undefined) {\n if (!tempParent.content)\n throw new Error('Invalid parentMap: all parents should have content');\n\n if (\n // Referencing tempNode and tempParent is OK in the loop since 'let' is used instead of 'var'\n // eslint-disable-next-line no-loop-func\n !tempParent.content.find((tempChild, index) => {\n if (tempChild !== tempNode) return false;\n if (!tempParent) throw new Error('undefined \"tempParent\" should not be possible');\n workingStack.unshift({ parent: tempParent, index });\n return true;\n })\n )\n throw new Error(`Unable to find correct parent node of ${JSON.stringify(tempNode)}`);\n\n if (tempParent.type === USJ_TYPE) break;\n tempNode = tempParent;\n // TS doesn't understand that only Usj objects have type == USJ_TYPE\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n tempParent = parentMap.get(tempParent as MarkerObject);\n }\n\n return workingStack;\n }\n\n private static convertWorkingStackToJsonPath(stack: WorkingStack): ContentJsonPath {\n let jsonPath = '$';\n stack.forEach((stackLevel) => {\n jsonPath = `${jsonPath}.content[${stackLevel.index}]`;\n });\n // The JSONPath string construction above conforms to the ContentJsonPath type\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n return jsonPath as ContentJsonPath;\n }\n\n private convertJsonPathToWorkingStack(jsonPath: ContentJsonPath): WorkingStack {\n const retVal: WorkingStack = [];\n\n const levels = jsonPath.match(/content\\[(\\d+)\\]/g);\n if (!levels) throw new Error(`Malformed or unexpected jsonPath: ${jsonPath}`);\n\n let onNode: Usj | MarkerObject = this.usj;\n\n levels.forEach((level, onLevel) => {\n const indexString = /(\\d+)/.exec(level);\n if (!indexString) throw new Error(`Malformed or unexpected jsonPath: ${jsonPath}`);\n const index = parseInt(indexString[0], 10);\n retVal.push({ parent: onNode, index });\n if (onLevel + 1 < levels.length) {\n if (typeof onNode === 'string' || !onNode.content)\n throw new Error(`jsonPath points to node without children: ${JSON.stringify(onNode)}`);\n const nextNode = onNode.content[index];\n if (typeof nextNode === 'string')\n throw new Error(`jsonPath points to node without children: ${JSON.stringify(nextNode)}`);\n onNode = nextNode;\n }\n });\n\n return retVal;\n }\n\n // #endregion\n\n // #region Walk the node tree\n\n /**\n * Given the starting point of a tree to consider (`node`), find the rightmost MarkerObject from\n * the array of `content`. In the following example, this would be \"J\".\n *\n * A <- Consider \"A\" to be `node`\n * / / | \\ \\\n * B C D E F <- Consider these to be MarkerObjects inside the `content` array owned by \"A\"\n * | / \\ |\n * G H I J <- Consider these to be MarkerObjects inside their parents `content` arrays\n *\n * If \"F\" did not exist in this example, then \"E\" would be returned. If \"E\" and \"F\" didn't exist,\n * then \"I\" would be returned.\n *\n * The general idea here is that we are looking for the MarkerObject in Usj that is immediately\n * adjacent to whatever `node`'s next sibling is in `parent`'s `content` array.\n */\n private static findRightMostDescendantMarkerObject(\n node: MarkerObject,\n parent: MarkerObject | Usj,\n skipTypes: string[] = [],\n ): { node: MarkerObject; parent: MarkerObject | Usj } {\n // There are no descendants, so this is as deep as it goes\n if (!node.content) return { node, parent };\n\n for (let index = node.content.length - 1; index >= 0; index--) {\n const candidate = node.content[index];\n if (typeof candidate === 'object' && !skipTypes.includes(candidate.type)) {\n if (candidate.content)\n return this.findRightMostDescendantMarkerObject(candidate, node, skipTypes);\n return { node: candidate, parent: node };\n }\n }\n\n // All descendants were strings which aren't MarkerObjects\n return { node, parent };\n }\n\n private static findNextMatchingNodeUsingWorkingStack(\n node: MarkerContent,\n workingStack: WorkingStack,\n skipTypes: string[],\n searchFunction: (potentiallyMatchingNode: MarkerContent, workingStack: WorkingStack) => boolean,\n ): MarkerContent | undefined {\n // Walk the nodes in a depth-first, left-to-right manner until the search function returns true\n let nextNode: MarkerContent | undefined = node;\n while (nextNode !== undefined) {\n const skipNextNode = typeof nextNode === 'object' && skipTypes.includes(nextNode.type);\n\n // If we found the node we're looking for, we're done\n if (!skipNextNode && searchFunction(nextNode, workingStack)) return nextNode;\n\n // Look at the node's children\n if (!skipNextNode && typeof nextNode === 'object' && (nextNode.content?.length ?? 0) > 0) {\n workingStack.push({ parent: nextNode, index: 0 });\n // Same as `nextNode = nextNode.content[0];` without triggering 2 different eslint errors\n [nextNode] = nextNode.content;\n }\n // The node has no children, so look at the next sibling, or the parent's next sibling, etc. up the stack\n else {\n nextNode = undefined;\n while (workingStack.length > 0) {\n const nextLevel = workingStack.pop();\n // We know that `content` exists due to its presence in this data structure\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n if (nextLevel && nextLevel.index + 1 < nextLevel.parent.content!.length) {\n nextLevel.index += 1;\n workingStack.push(nextLevel);\n // We know that `content` exists due to its presence in this data structure\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n nextNode = nextLevel.parent.content![nextLevel.index];\n break;\n }\n }\n }\n }\n\n // We've looked everywhere, so there must not be an appropriate node anywhere\n return undefined;\n }\n\n /**\n * Walk through a USJ node tree depth-first, left-to-right to find the first node that matches\n * criteria specified by `searchFunction` (i.e., the first node where `searchFunction` returns\n * `true`)\n */\n private findNextMatchingNode(\n node: MarkerObject,\n skipTypes: string[],\n searchFunction: (potentiallyMatchingNode: MarkerContent, workingStack: WorkingStack) => boolean,\n ): MarkerContent | undefined {\n // Represents levels in the USJ node tree that are above the current node (i.e., ancestors)\n // Levels in the tree are represented as a stack, so the last item is the current node's parent\n const workingStack = this.createWorkingStack(node);\n\n return UsjReaderWriter.findNextMatchingNodeUsingWorkingStack(\n node,\n workingStack,\n skipTypes,\n searchFunction,\n );\n }\n\n // #endregion\n\n // #region Node -> JSONPath\n\n nodeToJsonPath(node: MarkerObject): ContentJsonPath {\n return UsjReaderWriter.convertWorkingStackToJsonPath(this.createWorkingStack(node));\n }\n\n // #endregion\n\n // #region USJ + node -> VerseRef + offset\n\n /** Find the chapter and verse that apply to a given USJ node */\n private findVerseRefForNode(\n node: MarkerContent,\n nodeParent: MarkerObject | Usj,\n retVal: ChapterVerseNode = {\n chapterNum: undefined,\n verseNum: undefined,\n startingContentNode: undefined,\n },\n ): ChapterVerseNode {\n // If we already have the data, we're done\n if (retVal.verseNum !== undefined && retVal.chapterNum !== undefined) return retVal;\n\n // See if this node gives us the data\n if (typeof node === 'object' && node.number !== undefined) {\n const nodeNumber = Number.parseInt(node.number, 10);\n if (node.type === CHAPTER_TYPE) {\n retVal.chapterNum = nodeNumber;\n retVal.verseNum = retVal.verseNum ?? 0;\n retVal.startingContentNode = retVal.startingContentNode ?? node;\n return retVal;\n }\n if (node.type === VERSE_TYPE && !retVal.verseNum) {\n retVal.verseNum = nodeNumber;\n retVal.startingContentNode = node;\n }\n }\n\n // Prepare to look for siblings of this node in the parent\n if (!nodeParent.content)\n throw new Error(`\"content\" array not found: ${JSON.stringify(nodeParent)}`);\n\n // Find the position of this node in the parent's content\n let nodeIndex = 0;\n for (let index = 0; index < nodeParent.content.length; index++) {\n if (nodeParent.content[index] === node) {\n nodeIndex = index;\n break;\n }\n }\n\n // Find the first, previous sibling of this node that is an object\n let previousNodeIndex = nodeIndex - 1;\n while (previousNodeIndex >= 0 && typeof nodeParent.content[previousNodeIndex] !== 'object')\n previousNodeIndex -= 1;\n\n // There are no more siblings to inspect from this parent, so walk up a level\n if (previousNodeIndex < 0) {\n // We can't walk up a level if we're at the top level Usj node, so we're done\n if (nodeParent.type === USJ_TYPE) {\n if (retVal.chapterNum === undefined) {\n retVal.chapterNum = 1;\n retVal.verseNum = 0;\n retVal.startingContentNode = undefined;\n }\n return retVal;\n }\n\n // TS doesn't understand that only Usj objects have type == USJ_TYPE\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n const nodeParentMarkerObject = nodeParent as MarkerObject;\n\n const grandparent = this.parentMap.get(nodeParentMarkerObject);\n if (!grandparent) throw new Error(`No parent found for ${JSON.stringify(nodeParent)}`);\n return this.findVerseRefForNode(nodeParentMarkerObject, grandparent, retVal);\n }\n\n // Walk down the sibling's children as far as we can\n // This is a MarkerObject based on the while loop a few lines above\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n const previousNode = nodeParent.content[previousNodeIndex] as MarkerObject;\n const descendant = UsjReaderWriter.findRightMostDescendantMarkerObject(\n previousNode,\n nodeParent,\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n );\n return this.findVerseRefForNode(descendant.node, descendant.parent, retVal);\n }\n\n nodeToVerseRefAndOffset(\n bookId: string,\n node: MarkerContent,\n nodeParent: MarkerObject | MarkerContent[] | undefined,\n ): { verseRef: VerseRef; offset: number } | undefined {\n if (typeof node === 'string' && nodeParent === undefined)\n throw new Error(`If \"node\" is a string, then \"nodeParent\" cannot be undefined`);\n\n let realParent: MarkerObject | Usj | undefined;\n // \"node\" cannot be a string if \"nodeParent\" is undefined\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n if (nodeParent === undefined) realParent = this.parentMap.get(node as MarkerObject);\n else realParent = Array.isArray(nodeParent) ? this.parentMap.get(nodeParent) : nodeParent;\n if (realParent === undefined)\n throw new Error(`Cannot find parent for ${JSON.stringify(nodeParent)}`);\n\n const chapterVerseContent = this.findVerseRefForNode(node, realParent);\n if (!chapterVerseContent) return undefined;\n\n if (!chapterVerseContent.chapterNum)\n throw new Error(`Could not determine chapter number for ${JSON.stringify(node)}`);\n\n const verseRef = new VerseRef(\n bookId,\n chapterVerseContent.chapterNum.toString(),\n chapterVerseContent.verseNum ? chapterVerseContent.verseNum.toString() : '0',\n );\n\n let offset = 0;\n // Walk forward through the USJ nodes until `node` is found, incrementing `offset` along the way\n if (chapterVerseContent.startingContentNode !== undefined) {\n this.findNextMatchingNode(chapterVerseContent.startingContentNode, [], (n, stack) => {\n if (n === node) return true;\n if (stack.find((level) => NODE_TYPES_NOT_CONTAINING_VERSE_TEXT.includes(level.parent.type)))\n return false;\n if (typeof n === 'string') {\n offset += n.length;\n return false;\n }\n if (\n (n.type === CHAPTER_TYPE && n.number !== chapterVerseContent.chapterNum?.toString()) ||\n (n.type === VERSE_TYPE && n.number !== chapterVerseContent.verseNum?.toString())\n ) {\n offset = 0;\n return true;\n }\n return false;\n });\n }\n\n return { verseRef, offset };\n }\n\n // #endregion\n\n // #region JSONPath -> VerseRef + offset\n\n jsonPathToVerseRefAndOffset(jsonPathQuery: string, bookId?: string): VerseRefOffset {\n const effectiveBookId = bookId ?? this.findBookId();\n if (!effectiveBookId) throw new Error('Not able to determine the book ID');\n\n const target: MarkerContent | undefined = this.findSingleValue(jsonPathQuery);\n if (!target) throw new Error(`No result found for JSONPath query: ${jsonPathQuery}`);\n\n const parent: MarkerObject | MarkerContent[] | undefined = this.findParent(jsonPathQuery);\n if (!parent) throw new Error(`Could not determine parent for ${jsonPathQuery}`);\n\n const verseRefAndOffset = this.nodeToVerseRefAndOffset(effectiveBookId, target, parent);\n if (!verseRefAndOffset)\n throw new Error(`Could not determine VerseRef that corresponds to ${jsonPathQuery}`);\n\n return verseRefAndOffset;\n }\n\n // #endregion\n\n // #region VerseRef + offset -> Node + JSONPath + offset\n\n verseRefToUsjContentLocation(verseRef: VerseRef, verseRefOffset: number = 0): UsjContentLocation {\n if (verseRefOffset < 0) throw new Error('offset must be >= 0');\n\n // Prefer getting the book ID from the USJ itself, but it might not be available\n const bookId = this.findBookId() ?? verseRef.book;\n if (!bookId) throw new Error('Not able to determine the book ID');\n if (bookId !== verseRef.book)\n throw new Error(`Book IDs don't match: USJ=${bookId}, VerseRef=${verseRef.book}`);\n\n const chapterNode = this.findChapterNode(verseRef.chapterNum);\n if (chapterNode === undefined)\n throw new Error(`Could not find ${bookId} chapter ${verseRef.chapterNum}`);\n\n let foundAnotherChapter = false;\n let jsonPath: ContentJsonPath = '';\n const expectedVerse = verseRef.verse;\n const verseNode: MarkerContent | undefined = this.findNextMatchingNode(\n chapterNode,\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n (node, workingStack) => {\n if (node === chapterNode) {\n if (verseRef.verseNum === 0) {\n jsonPath = UsjReaderWriter.convertWorkingStackToJsonPath(workingStack);\n return true;\n }\n return false;\n }\n if (typeof node !== 'object') return false;\n if (node.type === CHAPTER_TYPE) {\n foundAnotherChapter = true;\n return true;\n }\n if (\n node.type === VERSE_TYPE &&\n node.number !== undefined &&\n node.number === expectedVerse\n ) {\n jsonPath = UsjReaderWriter.convertWorkingStackToJsonPath(workingStack);\n return true;\n }\n return false;\n },\n );\n\n if (foundAnotherChapter || verseNode === undefined || typeof verseNode === 'string')\n throw new Error(`Verse ${expectedVerse} not found in ${bookId} ${verseRef.chapterNum}`);\n\n if (verseRefOffset === 0) return { node: verseNode, offset: 0, jsonPath };\n\n let cumulativeVerseLengthSeen = 0;\n let usjNodeOffset = 0;\n let foundNode: MarkerContent | undefined;\n this.findNextMatchingNode(\n verseNode,\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n (node, workingStack) => {\n if (node === verseNode) return false;\n if (typeof node === 'string') {\n cumulativeVerseLengthSeen += node.length;\n if (cumulativeVerseLengthSeen > verseRefOffset) {\n jsonPath = UsjReaderWriter.convertWorkingStackToJsonPath(workingStack);\n usjNodeOffset = verseRefOffset - cumulativeVerseLengthSeen + node.length;\n foundNode = node;\n return true;\n }\n }\n // If we found another verse or chapter, then the offset was larger than the verse length\n // Just return the original verse node in that case\n else if (node.type === CHAPTER_TYPE || node.type === VERSE_TYPE) return true;\n return false;\n },\n );\n\n return { node: foundNode ?? verseNode, offset: usjNodeOffset, jsonPath };\n }\n\n // #endregion\n\n // #region Search for text from a node + JSONPath + offset\n\n findNextLocationOfMatchingText(\n startingPoint: UsjContentLocation,\n text: string,\n maxTextLengthToSearch: number = 1000,\n ): UsjContentLocation | undefined {\n let textScanned = '';\n let lengthScanned = 0;\n let lengthTrimmed = 0;\n let foundStartingAtOffset = 0;\n UsjReaderWriter.findNextMatchingNodeUsingWorkingStack(\n startingPoint.node,\n this.convertJsonPathToWorkingStack(startingPoint.jsonPath),\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n (node) => {\n if (typeof node !== 'string') return false;\n\n lengthScanned += node.length;\n textScanned = `${textScanned}${node}`;\n const textIndex = textScanned.indexOf(text);\n if (textIndex < 0) {\n // Keep the string we're keeping around from going too large\n lengthTrimmed += textScanned.length;\n if (textScanned.length > text.length)\n textScanned = textScanned.substring(textScanned.length - text.length);\n lengthTrimmed -= textScanned.length;\n\n // Stop looking if we haven't found it after scanning a lot of text\n return lengthScanned > maxTextLengthToSearch;\n }\n\n // We found it!\n foundStartingAtOffset = lengthTrimmed + textIndex;\n return true;\n },\n );\n\n // We never found what we wanted\n if (foundStartingAtOffset <= 0) return undefined;\n\n // The text might have been split between nodes, so we have to go through it one more time\n lengthScanned = 0;\n let finalOffset = 0;\n let finalStack: WorkingStack = [];\n const finalNode = UsjReaderWriter.findNextMatchingNodeUsingWorkingStack(\n startingPoint.node,\n this.convertJsonPathToWorkingStack(startingPoint.jsonPath),\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n (node, stack) => {\n if (typeof node !== 'string') return false;\n\n lengthScanned += node.length;\n if (lengthScanned < foundStartingAtOffset + 1) return false;\n\n finalOffset = foundStartingAtOffset - lengthScanned + node.length;\n finalStack = stack;\n return true;\n },\n );\n if (!finalNode) throw new Error('Internal error: inconsistent search results');\n\n return {\n node: finalNode,\n offset: finalOffset,\n jsonPath: UsjReaderWriter.convertWorkingStackToJsonPath(finalStack),\n };\n }\n\n // #endregion\n\n // #region Extract text from a node + JSONPath + offset\n\n extractText(start: UsjContentLocation, desiredLength: number): string {\n let retVal = '';\n let offsetRemaining = start.offset;\n let lengthRecorded = 0;\n UsjReaderWriter.findNextMatchingNodeUsingWorkingStack(\n start.node,\n this.convertJsonPathToWorkingStack(start.jsonPath),\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n (node) => {\n if (typeof node !== 'string') return false;\n if (offsetRemaining >= node.length) {\n offsetRemaining -= node.length;\n return false;\n }\n let remainingNode = node;\n if (offsetRemaining > 0) {\n remainingNode = remainingNode.substring(offsetRemaining);\n offsetRemaining = 0;\n }\n if (lengthRecorded + remainingNode.length < desiredLength) {\n lengthRecorded += remainingNode.length;\n retVal = `${retVal}${remainingNode}`;\n return false;\n }\n const lengthToCopy = desiredLength - lengthRecorded;\n retVal = `${retVal}${remainingNode.substring(0, lengthToCopy - 1)}`;\n return true;\n },\n );\n return retVal;\n }\n\n extractTextBetweenPoints(\n start: UsjContentLocation,\n end: UsjContentLocation,\n maxLength: number = 100,\n ): string {\n let retVal = '';\n UsjReaderWriter.findNextMatchingNodeUsingWorkingStack(\n start.node,\n this.convertJsonPathToWorkingStack(start.jsonPath),\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n (node, currentStack) => {\n // `node` and `end.node` are both `MarkerContent` which might be strings or objects\n if (node === end.node) {\n // If both objects are the same, then we definitely found `end`\n if (typeof node === 'object') return true;\n\n // If both strings are the same, we need to verify that we're at the same place in `usj`\n if (end.jsonPath === UsjReaderWriter.convertWorkingStackToJsonPath(currentStack))\n return true;\n }\n if (typeof node !== 'string') return false;\n retVal = `${retVal}${node}`;\n if (retVal.length > maxLength) retVal = retVal.substring(0, maxLength);\n return retVal.length >= maxLength;\n },\n );\n return retVal;\n }\n\n // #endregion\n\n // #region Edit this USJ data\n\n private static removeContentNodesFromArray(\n contentArray: MarkerContent[],\n searchFunction: (potentiallyMatchingNode: MarkerContent) => boolean,\n ) {\n let removedCount = 0;\n for (let i = contentArray.length - 1; i >= 0; i--) {\n const node = contentArray[i];\n if (searchFunction(node)) {\n contentArray.splice(i, 1);\n removedCount += 1;\n } else if (typeof node !== 'string' && node.content)\n removedCount += this.removeContentNodesFromArray(node.content, searchFunction);\n }\n return removedCount;\n }\n\n removeContentNodes(searchFunction: (potentiallyMatchingNode: MarkerContent) => boolean): number {\n const retVal = UsjReaderWriter.removeContentNodesFromArray(this.usj.content, searchFunction);\n this.usjChanged();\n return retVal;\n }\n\n // #endregion\n}\n"],"names":["AsyncVariable","variableName","rejectIfNotSettledWithinMS","__publicField","resolve","reject","value","throwIfAlreadySettled","reason","Collator","locales","options","string1","string2","DateTimeFormat","date","startDate","endDate","PlatformEventEmitter","event","callback","callbackIndex","newGuid","s","isString","o","deepClone","obj","debounce","fn","delay","timeout","args","groupBy","items","keySelector","valueSelector","map","item","key","group","isErrorWithMessage","error","toErrorWithMessage","maybeError","getErrorMessage","wait","ms","waitForDuration","maxWaitTimeInMS","getAllObjectFunctionNames","_objId","objectFunctionNames","property","objectPrototype","createSyncProxyForAsyncObject","getObject","objectToProxy","target","prop","DocumentCombiner","baseDocument","documentName","document","previousDocumentVersion","documentToSet","contributions","contributionName","potentialOutput","outputIteration","contribution","mergeObjects","output","finalOutput","areNonArrayObjects","values","allMatch","areArrayObjects","startingPoint","copyFrom","ignoreDuplicateProperties","retVal","mergeObjectsInternal","startingPointObj","copyFromObj","Mutex","AsyncMutex","MutexMap","mutexID","NonValidatingDocumentCombiner","NumberFormat","startRange","endRange","UnsubscriberAsyncList","name","unsubscribers","unsubscriber","unsubs","results","unsubscriberSucceeded","index","P","R","t","e","n","N","B","O","S","K","g","k","x","T","X","V","w","L","G","A","H","C","I","y","q","U","m","l","h","c","E","r","D","i","a","u","v","f","d","b","p","J","M","charRegex","astralRange","comboRange","varRange","familyRange","astral","combo","fitz","modifier","nonAstral","regional","surrogatePair","zwj","blackFlag","family","optModifier","optVar","optJoin","seq","symbol","__importDefault","this","mod","dist","char_regex_1","require$$0","toArray","str","toArray_1","length","match","length_1","substring","begin","end","substring_1","substr","len","strLength","substr_1","limit","padString","padPosition","padRepeats","limit_1","indexOf","searchStr","pos","strArr","searchArr","finded","searchIndex","indexOf_1","ensureArray","maybeArray","at","string","stringLength","charAt","codePointAt","endsWith","searchString","endPosition","lastIndexOfSearchString","lastIndexOf","indexOfClosestClosingCurlyBrace","escaped","closeCurlyBraceIndex","formatReplacementStringToArray","replacers","contents","nextIntermediateStartIndex","addToContents","newContent","newContentIndex","newContentLength","intermediateContent","baseSubstring","replacerKey","replacerContent","endContent","formatReplacementString","content","includes","position","partialString","stringzIndexOf","validatedPosition","stringzLength","normalize","form","upperCaseForm","ordinalCompare","padEnd","targetLength","stringzLimit","padStart","correctSliceIndex","slice","indexStart","indexEnd","newStart","newEnd","split","separator","splitLimit","result","regexSeparator","matches","currentIndex","matchIndex","matchLength","startsWith","stringzSubstr","stringzSubstring","stringzToArray","isLocalizeKey","escapeStringRegexp","transformAndEnsureRegExpRegExpArray","stringStringMaybeArray","stringMaybeStringArray","transformAndEnsureRegExpArray","stringMaybeArray","scrBookData","FIRST_SCR_BOOK_NUM","LAST_SCR_BOOK_NUM","FIRST_SCR_CHAPTER_NUM","FIRST_SCR_VERSE_NUM","defaultScrRef","getChaptersForBook","bookNum","_a","offsetBook","scrRef","offset","offsetChapter","offsetVerse","getLocalizedIdFromBookNumber","bookNumber","localizationLanguage","getLocalizedString","id","Canon","bookName","parts","scrRefToBBBCCCVVV","VerseRef","compareScrRefs","scrRef1","scrRef2","getLocalizeKeyForScrollGroupId","scrollGroupId","getLocalizeKeysForScrollGroupIds","scrollGroupIds","formatScrRef","optionOrLocalizedBookName","chapterVerseSeparator","bookChapterSeparator","book","aggregateUnsubscribers","success","aggregateUnsubscriberAsyncs","unsubPromises","CHAPTER_TYPE","VERSE_TYPE","getOwnPropertyNames","getOwnPropertySymbols","hasOwnProperty","combineComparators","comparatorA","comparatorB","state","createIsCircular","areItemsEqual","cache","cachedA","cachedB","getStrictProperties","object","hasOwn","sameValueZeroEqual","OWNER","getOwnPropertyDescriptor","keys","areArraysEqual","areDatesEqual","areMapsEqual","matchedIndices","aIterable","aResult","bResult","bIterable","hasMatch","aKey","aValue","_b","bKey","bValue","areObjectsEqual","properties","areObjectsEqualStrict","descriptorA","descriptorB","arePrimitiveWrappersEqual","areRegExpsEqual","areSetsEqual","areTypedArraysEqual","ARGUMENTS_TAG","BOOLEAN_TAG","DATE_TAG","MAP_TAG","NUMBER_TAG","OBJECT_TAG","REG_EXP_TAG","SET_TAG","STRING_TAG","isArray","isTypedArray","assign","getTag","createEqualityComparator","constructor","tag","createEqualityComparatorConfig","circular","createCustomConfig","strict","config","areArraysEqual$1","areMapsEqual$1","areObjectsEqual$1","areSetsEqual$1","createInternalEqualityComparator","compare","_indexOrKeyA","_indexOrKeyB","_parentA","_parentB","createIsEqual","comparator","createState","equals","meta","deepEqual","createCustomEqual","createCustomInternalComparator","isEqualDeep","isSubset","objectWithAllProperties","objectWithPartialProperties","partialArray","allArray","partialObj","allObj","serialize","replacer","space","replacerValue","newValue","deserialize","reviver","replaceNull","verseRefReviver","_vrefKey","vrefValue","chapter","verse","versification","ScrVers","combinedReviver","reviverKey","reviverVal","parsedObject","isSerializable","serializedValue","htmlEncode","getCurrentLocale","formatBytes","fileSize","decimals","sizes","sizeToUse","settingsDefs","removeJsonToTypeScriptTypesStuff","defs","def","projectSettingsDocumentSchema","settingsDocumentSchema","localizedStringsDefs","localizedStringsDocumentSchema","menuDocumentSchema","find","list","predicate","ac","freeze","oc","source","HTML_BOOLEAN_ATTRIBUTES","isHTMLBooleanAttribute","HTML_VOID_ELEMENTS","isHTMLVoidElement","tagName","HTML_RAW_TEXT_ELEMENTS","isHTMLRawTextElement","isHTMLEscapableRawTextElement","isHTMLMimeType","mimeType","MIME_TYPE","hasDefaultHTMLNamespace","_MIME_TYPES","isValidMimeType","NAMESPACE","conventions","extendError","writableName","DOMExceptionName","DOMExceptionNames","isValidDomExceptionCode","endsWithError","DOMException","messageOrCode","nameOrMessage","code","ExceptionCode","entries","ParseError","message","locator","errors","detectUnicodeSupport","RegExpImpl","UNICODE_SUPPORT","chars","regexp","chars_without","search","reg","self","part","isStr","regg","UNICODE_REPLACEMENT_CHARACTER","Char","_SChar","SChar_s","S_OPT","NameStartChar","NameStartChar_s","NameChar","Name","Nmtoken","EntityRef","CharRef","Reference","PEReference","EntityValue","AttValue","NCNameStartChar","NCNameChar","NCName","QName","QName_exact","QName_group","SystemLiteral","PI","PubidChar","PubidLiteral","COMMENT_START","COMMENT_END","Comment","PCDATA","Mixed","_children_quantity","children","contentspec","ELEMENTDECL_START","elementdecl","NotationType","Enumeration","EnumeratedType","AttType","DefaultDecl","AttDef","ATTLIST_DECL_START","AttlistDecl","SYSTEM","PUBLIC","ExternalID","ExternalID_match","NDataDecl","EntityDef","ENTITY_DECL_START","GEDecl","PEDef","PEDecl","EntityDecl","PublicID","NotationDecl","Eq","VersionNum","VersionInfo","EncName","EncodingDecl","SDDecl","XMLDecl","DOCTYPE_DECL_START","CDATA_START","CDATA_END","CDStart","CDEnd","CData","CDSect","grammar","PDC","require$$1","require$$2","checkSymbol","notEmptyString","input","splitOnASCIIWhitespace","orderedSetReducer","current","element","toOrderedSet","arrayIncludes","validateQualifiedName","qualifiedName","validateAndExtract","namespace","prefix","localName","splitResult","copy","src","dest","_extends","Class","Super","pt","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","DocumentPosition","parentChain","node","chain","commonAncestor","docGUID","doc","NodeList","nodeFilter","buf","serializeToString","me","LiveNodeList","refresh","_updateLiveList","inc","ls","__set__","NamedNodeMap","_findNodeIndex","_addNamedNode","el","newAttr","oldAttr","_onRemoveAttribute","_onAddAttribute","_removeNamedNode","attr","lastIndex","namespaceURI","DOMImplementation","feature","version","doctype","contentType","Document","root","publicId","systemId","internalSubset","DocumentType","title","htmlNode","headNode","titleNode","Node","rootNode","other","parent","otherNode","newChild","refChild","_insertBefore","oldChild","assertPreReplacementValidityInDocument","_removeChild","deep","cloneNode","child","next","node1","node2","attr1","attr2","Attr","chain1","chain2","ca","_xmlEncoder","_visitNode","opt","ns","remove","_onUpdateChild","childNodes","parentNode","oldPreviousSibling","oldNextSibling","hasValidParentNodeType","hasInsertableNodeType","isDocTypeNode","isElementNode","isTextNode","isElementInsertionPossible","parentChildNodes","docTypeNode","isElementReplacementPossible","hasElementChildThatIsNotChild","assertPreInsertionValidity1to5","assertPreInsertionValidityInDocument","nodeChildNodes","nodeChildElements","parentElementChild","_inDocumentAssertion","cp","newFirst","newLast","pre","removed","importedNode","importNode","rtv","Element","attrs","DocumentFragment","data","Text","CDATASection","ProcessingInstruction","EntityReference","validated","old","classNames","classNamesSet","base","nodeClassNames","nodeClassNamesSet","isHTMLDocument","lowerQualifiedName","nodeQualifiedName","matchingQName","CharacterData","count","text","start","newText","newNode","Notation","Entity","XMLSerializer","nodeSerializeToString","refNode","uri","visibleNamespaces","needNamespaceDefine","isHTML","addSerializedAttribute","nodeName","prefixedNodeName","defaultNS","ai","nsi","canCloseTag","pubid","sysid","attrs2","getTextContent","dom","exports","S_TAG","S_ATTR","S_ATTR_SPACE","S_EQ","S_ATTR_NOQUOT_VALUE","S_ATTR_END","S_TAG_SPACE","S_TAG_CLOSE","XMLReader","defaultNSMap","entityMap","domBuilder","_copy","parse","ENTITY_REG","defaultNSMapCopy","errorHandler","fixedFromCharCode","surrogate1","surrogate2","entityReplacer","complete","appendText","xt","lineEnd","linePattern","lineStart","parseStack","unclosedTags","tagStart","fromSource","tagNameRaw","tagNameMatch","currentTagName","tagNameLower","localNSMap","parseProcessingInstruction","parseDoctypeCommentOrCData","ElementAttributes","currentNSMap","parseElementStartPart","locator2","copyLocator","appendElement","parseHtmlSpecialContent","addAttribute","qname","startIndex","attrName","qName","nsp","nsPrefix","elStartEnd","isEscapableRaw","elEndStart","parseUtils","char","skip","skipBlanks","blanks","substringFromIndex","substringStartsWith","getMatch","expr","parseDoctypeInternalSubset","parsePI","intSubsetStart","comment","cdata","sax","entities","require$$3","require$$4","normalizeLineEndings","DOMParser","DOMHandler","defaultNamespace","isXml","impl","ins","ch","_toString","charNode","comm","dt","level","_locator","handler","NODE_TYPES_NOT_CONTAINING_VERSE_TEXT","UsjReaderWriter","usj","jsonPathQuery","wrappedResults","JSONPath","unwrappedResults","chapterNumber","chapterQuery","parentMap","workingStack","tempNode","tempParent","tempChild","USJ_TYPE","stack","jsonPath","stackLevel","levels","onNode","onLevel","indexString","nextNode","skipTypes","candidate","searchFunction","skipNextNode","nextLevel","nodeParent","nodeNumber","nodeIndex","previousNodeIndex","nodeParentMarkerObject","grandparent","previousNode","descendant","bookId","realParent","chapterVerseContent","verseRef","effectiveBookId","verseRefAndOffset","verseRefOffset","chapterNode","foundAnotherChapter","expectedVerse","verseNode","cumulativeVerseLengthSeen","usjNodeOffset","foundNode","maxTextLengthToSearch","textScanned","lengthScanned","lengthTrimmed","foundStartingAtOffset","textIndex","finalOffset","finalStack","finalNode","desiredLength","offsetRemaining","lengthRecorded","remainingNode","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CAAc,EACrEE,EAAU,MAAM,QAAQ,IAAID,CAAM,EACxC,YAAK,cAAc,QACZC,EAAQ,MAAM,CAACC,EAAuBC,KACtCD,GACH,QAAQ,MAAM,yBAAyB,KAAK,IAAI,2BAA2BC,CAAK,UAAU,EAErFD,EACR,CACH,CACF,CCrCA,IAAIE,GAAI,OAAO,eACXC,GAAI,CAACC,EAAGC,EAAGjF,IAAMiF,KAAKD,EAAIF,GAAEE,EAAGC,EAAG,CAAE,WAAY,GAAI,aAAc,GAAI,SAAU,GAAI,MAAOjF,CAAC,CAAE,EAAIgF,EAAEC,CAAC,EAAIjF,EACzGkF,EAAI,CAACF,EAAGC,EAAGjF,IAAM+E,GAAEC,EAAG,OAAOC,GAAK,SAAWA,EAAI,GAAKA,EAAGjF,CAAC,EAW9D,MAAMmF,GAAI,CACR,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MAEA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MAEA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MAEA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MAEA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MAEA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MAEA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MAEA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MAEA,MACA,MACA,MACA,MACA,MACA,MACA,MAEA,MAEA,MAEA,MAEA,MAEA,MAEA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MAEA,MACA,MACA,MAEA,MAEA,MAEA,MAEA,MACA,MACA,MACA,MAEA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MAEA,MACA,MACA,KACF,EAAGC,GAAI,CACL,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,KACF,EAAGC,GAAI,CACL,UACA,SACA,YACA,UACA,cACA,SACA,SACA,OACA,WACA,WACA,UACA,UACA,eACA,eACA,OACA,WACA,kBACA,MACA,SACA,WACA,eACA,gBACA,SACA,WACA,eACA,UACA,kBACA,QACA,OACA,OACA,UACA,QACA,QACA,QACA,WACA,YACA,SACA,YACA,UACA,UACA,OACA,OACA,OACA,OACA,SACA,gBACA,gBACA,YACA,YACA,cACA,aACA,kBACA,kBACA,YACA,YACA,QACA,WACA,UACA,QACA,UACA,UACA,SACA,SACA,SACA,OACA,aACA,QACA,SACA,eACA,oBACA,0BACA,SACA,qBACA,sBACA,UACA,qBACA,cACA,cACA,cACA,cACA,mBACA,mBACA,qBACA,YACA,OACA,oBAGA,uBACA,uBACA,sBACA,yBACA,wBACA,qBACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,eACA,cACA,eACA,oBACA,qBACA,0BACA,0BACA,eACA,eACA,YACA,gBACA,cACA,eACA,iBACA,wBACA,mBACA,WACA,QACA,aACA,aACA,aACA,2BACA,4BACA,YACF,EAAGC,GAAIC,KACP,SAASC,GAAER,EAAGC,EAAI,GAAI,CACpB,OAAOA,IAAMD,EAAIA,EAAE,YAAa,GAAGA,KAAKM,GAAIA,GAAEN,CAAC,EAAI,CACrD,CACA,SAASS,GAAET,EAAG,CACZ,OAAOQ,GAAER,CAAC,EAAI,CAChB,CACA,SAASU,GAAEV,EAAG,CACZ,MAAMC,EAAI,OAAOD,GAAK,SAAWQ,GAAER,CAAC,EAAIA,EACxC,OAAOC,GAAK,IAAMA,GAAK,EACzB,CACA,SAASU,GAAEX,EAAG,CACZ,OAAQ,OAAOA,GAAK,SAAWQ,GAAER,CAAC,EAAIA,IAAM,EAC9C,CACA,SAASY,GAAEZ,EAAG,CACZ,OAAOA,GAAK,EACd,CACA,SAASa,GAAEb,EAAG,CACZ,MAAMC,EAAI,OAAOD,GAAK,SAAWQ,GAAER,CAAC,EAAIA,EACxC,OAAOc,GAAEb,CAAC,GAAK,CAACW,GAAEX,C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QACR,EACA,CACE,KAAM,QACN,MAAO,CAAE,KAAM,QAAS,CAC1B,CACF,CACF,CACF,CACF,CACF,EACA,yBAA0B,CACxB,YACE,ugDACF,MAAO,CACL,CACE,KAAM,MACR,EACA,CACE,KAAM,QACR,EACA,CACE,KAAM,QACN,MAAO,CACL,MAAO,CACL,CACE,KAAM,QACR,EACA,CACE,KAAM,QACN,MAAO,CAAE,KAAM,QAAS,CAC1B,CACF,CACF,CACF,CACF,CACF,EACA,qBAAsB,CACpB,YACE,ybACF,MAAO,CACL,CACE,KAAM,MACR,EACA,CACE,KAAM,QACR,EACA,CACE,KAAM,QACN,MAAO,CAAE,KAAM,QAAS,CAC1B,CACF,CACF,EACA,qBAAsB,CACpB,YACE,mdACF,MAAO,CACL,CACE,KAAM,MACR,EACA,CACE,KAAM,QACR,EACA,CACE,KAAM,QACN,MAAO,CAAE,KAAM,QAAS,CAC1B,CACF,CACF,CACF,CACF,EACA,qBAAsB,CACpB,YACE,sFACF,MAAO,CACL,CACE,KAAM,uBACR,EACA,CACE,KAAM,QACN,MAAO,CACL,KAAM,uBACR,CACF,CACF,CACF,EACA,cAAe,CACb,YAAa,wCACb,KAAM,SACN,WAAY,CACV,MAAO,CACL,YAAa,qEACb,KAAM,qBACR,EACA,YAAa,CACX,YAAa,yEACb,KAAM,qBACR,EACA,WAAY,CACV,KAAM,2BACR,CACF,EACA,SAAU,CAAC,QAAS,YAAY,CAClC,EACA,kBAAmB,CACjB,YAAa,0EACb,KAAM,SACN,kBAAmB,CACjB,sBAAuB,CACrB,KAAM,iBACR,CACF,EACA,qBAAsB,EACxB,EACA,QAAS,CACP,YAAa,gDACb,MAAO,CACL,CACE,KAAM,oCACR,CACF,CACF,EACA,2BAA4B,CAC1B,YAAa,yDACb,MAAO,CACL,CACE,KAAM,qBACR,EACA,CACE,KAAM,qCACR,CACF,CACF,EACA,YAAa,CACX,YAAa,sDACb,MAAO,CACL,CACE,KAAM,mBACR,EACA,CACE,KAAM,SACN,WAAY,CACV,MAAO,CACL,YAAa,uEACb,KAAM,qBACR,EACA,YAAa,CACX,YAAa,2EACb,KAAM,qBACR,CACF,EACA,SAAU,CAAC,OAAO,CACpB,CACF,CACF,EACA,yBAA0B,CACxB,YACE,2FACF,KAAM,6BACR,EACA,sBAAuB,CACrB,YACE,wFACF,KAAM,6BACR,EACA,oBAAqB,CACnB,YAAa,qEACb,KAAM,SACN,kBAAmB,CACjB,0BAA2B,CACzB,KAAM,mBACR,CACF,EACA,qBAAsB,EACxB,EACA,UAAW,CACT,YAAa,mDACb,MAAO,CACL,CACE,KAAM,kCACR,CACF,CACF,EACA,yBAA0B,CACxB,YAAa,uDACb,MAAO,CACL,CACE,KAAM,mBACR,EACA,CACE,KAAM,qCACR,CACF,CACF,EACA,4BAA6B,CAC3B,YACE,0NACF,IAAK,CACH,MAAO,CACL,CACE,KAAM,SACN,SAAU,CAAC,cAAc,CAC3B,EACA,CACE,KAAM,SACN,SAAU,CAAC,MAAM,CACnB,CACF,CACF,CACF,EACA,UAAW,CACT,YAAa,oDACb,KAAM,SACN,WAAY,CACV,QAAS,CACP,YAAa,sCACb,KAAM,KACR,EACA,YAAa,CACX,YACE,2HACF,KAAM,YACR,CACF,EACA,SAAU,CAAC,SAAS,CACtB,EACA,YAAa,CACX,YAAa,iFACb,KAAM,SACN,QAAS,mBACT,OAAQ,aACV,EACA,GAAI,CACF,YAAa,GACb,KAAM,SACN,QAAS,0BACT,OAAQ,IACV,CACF,EAUO,SAASC,GAAiCC,EAAW,CACrDA,GAIL,OAAO,OAAOA,CAAI,EAAE,QAASC,GAAa,CACpC,GAACA,EAAI,KAIL,IAFA,WAAYA,GAAK,OAAOA,EAAI,OAE5BA,EAAI,OAAS,MAAO,CACtB,OAAOA,EAAI,KACX,MACF,CAEIA,EAAI,OAAS,UACfF,GAAiCE,EAAI,UAAU,EACjD,CACD,CACH,CAEAF,GAAiCD,EAAY,EAGtC,MAAMI,GAAgC,CAC3C,QAAS,+CACT,MAAO,gCACP,YACE,8FACF,MAAO,CACL,CACE,KAAM,8BACR,EACA,CACE,KAAM,QACN,MAAO,CACL,KAAM,8BACR,CACF,CACF,EAEA,MAAOJ,EACT,EAEA,OAAO,OAAOI,EAA6B,EAGpC,MAAMC,GAAyB,CACpC,QAAS,+CACT,MAAO,wBACP,YACE,sFACF,MAAO,CACL,CACE,KAAM,uBACR,EACA,CACE,KAAM,QACN,MAAO,CACL,KAAM,uBACR,CACF,CACF,EAEA,MAAOL,EACT,EAEA,OAAO,OAAOK,EAAsB,EChiBpC,MAAMC,GAAuB,CAC3B,gBAAiB,CACf,YACE,2IACF,KAAM,SACN,kBAAmB,CACjB,mBAAoB,CAClB,KAAM,8BACR,CACF,EACA,qBAAsB,EACxB,EACA,qBAAsB,CACpB,YAAa,kDACb,KAAM,QACR,EACA,gBAAiB,CACf,YACE,8IACF,KAAM,SACN,kBAAmB,CACjB,mBAAoB,CAClB,KAAM,wBACR,CACF,EACA,qBAAsB,EACxB,EACA,eAAgB,CACd,YAAa,0EACb,KAAM,SACN,WAAY,CACV,YAAa,CACX,YACE,gWACF,KAAM,SACN,QAAS,2DACT,OAAQ,aACV,EACA,MAAO,CACL,YACE,4IACF,KAAM,QACR,CACF,CACF,EACA,YAAa,CACX,YAAa,iFACb,KAAM,SACN,QAAS,mBACT,OAAQ,aACV,CACF,EAEAL,GAAiCK,EAAoB,EAG9C,MAAMC,GAAiC,CAC5C,QAAS,+CACT,MAAO,qCACP,YACE,gGACF,KAAM,SACN,WAAY,CACV,SAAU,CACR,KAAM,yBACR,EACA,iBAAkB,CAChB,KAAM,SACN,qBAAsB,CACpB,KAAM,yBACR,CACF,CACF,EACA,MAAOD,EACT,EAEA,OAAO,OAAOC,EAA8B,EC0BrC,MAAMC,GAAqB,CAChC,MAAO,uBACP,KAAM,SACN,WAAY,CACV,SAAU,CACR,YAAa,qCACb,KAAM,yBACR,EACA,sBAAuB,CACrB,YAAa,8DACb,KAAM,yBACR,EACA,0BAA2B,CACzB,YAAa,kEACb,KAAM,0BACR,EACA,aAAc,CACZ,YAAa,mDACb,KAAM,SACN,kBAAmB,CACjB,0BAA2B,CACzB,KAAM,4BACR,CACF,EACA,qBAAsB,EACxB,CACF,EACA,SAAU,CAAC,WAAY,wBAAyB,4BAA6B,cAAc,EAC3F,qBAAsB,GACtB,MAAO,CACL,YAAa,CACX,YACE,2FACF,KAAM,SACN,QAAS,kBACX,EACA,eAAgB,CACd,YACE,oGACF,KAAM,SACN,QAAS,yBACX,EACA,mBAAoB,CAClB,YACE,uFACF,KAAM,SACN,kBAAmB,CACjB,0BAA2B,CACzB,YAAa,qCACb,KAAM,SACN,WAAY,CACV,MAAO,CACL,YAAa,6CACb,KAAM,qBACR,EACA,cAAe,CACb,YACE,wFACF,KAAM,QACR,EACA,MAAO,CACL,YACE,6EACF,KAAM,QACR,EACA,aAAc,CACZ,YACE,8EACF,KAAM,SACR,CACF,EACA,SAAU,CAAC,QAAS,OAAO,EAC3B,qBAAsB,EACxB,CACF,EACA,WAAY,CACV,aAAc,CACZ,YACE,qFACF,KAAM,SACR,CACF,CACF,EACA,WAAY,CACV,YACE,uJACF,KAAM,SACN,kBAAmB,CACjB,0BAA2B,CACzB,YAAa,wCACb,KAAM,SACN,MAAO,CACL,CACE,WAAY,CACV,OAAQ,CACN,YACE,wEACF,KAAM,wBACR,EACA,MAAO,CACL,YACE,yGACF,KAAM,QACR,EACA,aAAc,CACZ,YACE,iFACF,KAAM,SACR,CACF,EACA,SAAU,CAAC,OAAO,EAClB,qBAAsB,EACxB,EACA,CACE,WAAY,CACV,SAAU,CACR,YAAa,8DACb,KAAM,wBACR,EACA,MAAO,CACL,YACE,yGACF,KAAM,QACR,EACA,aAAc,CACZ,YACE,iFACF,KAAM,SACR,CACF,EACA,SAAU,CAAC,WAAY,OAAO,EAC9B,qBAAsB,EACxB,CACF,CACF,CACF,EACA,qBAAsB,EACxB,EACA,SAAU,CACR,YACE,mGACF,KAAM,SACN,MAAO,CACL,CACE,WAAY,CACV,GAAI,CACF,YAAa,6CACb,KAAM,wBACR,CACF,EACA,SAAU,CAAC,IAAI,CACjB,EACA,CACE,WAAY,CACV,QAAS,CACP,YAAa,mEACb,KAAM,wBACR,EACA,eAAgB,CACd,YACE,0GACF,KAAM,QACR,EACA,cAAe,CACb,YACE,yGACF,KAAM,QACR,CACF,EACA,SAAU,CAAC,SAAS,CACtB,CACF,EACA,WAAY,CACV,MAAO,CACL,YAAa,4DACb,KAAM,qBACR,EACA,QAAS,CACP,YACE,uFACF,KAAM,qBACR,EACA,YAAa,CACX,YACE,6GACF,KAAM,qBACR,EACA,cAAe,CACb,YACE,wFACF,KAAM,QACR,EACA,MAAO,CACL,YAAa,wCACb,KAAM,wBACR,EACA,MAAO,CACL,YACE,qGACF,KAAM,QACR,CACF,EACA,SAAU,CAAC,QAAS,QAAS,OAAO,EACpC,sBAAuB,EACzB,EACA,eAAgB,CACd,YAAa,2BACb,KAAM,SACN,WAAY,CACV,OAAQ,CACN,YAAa,kCACb,KAAM,oBACR,EACA,MAAO,CACL,YAAa,8CACb,KAAM,QACN,MAAO,CAAE,KAAM,kBAAmB,EAClC,YAAa,EACf,CACF,EACA,SAAU,CAAC,SAAU,OAAO,CAC9B,EACA,iBAAkB,CAChB,YAAa,+CACb,KAAM,SACN,MAAO,CAAC,CAAE,KAAM,yBAA0B,EAC1C,sBAAuB,EACzB,EACA,gBAAiB,CACf,YAAa,sDACb,KAAM,SACN,MAAO,CACL,CAAE,KAAM,wBAAyB,EACjC,CACE,WAAY,CACV,QAAS,CACP,YAAa,mCACb,KAAM,4BACR,CACF,EACA,SAAU,CAAC,SAAS,CACtB,CACF,EACA,sBAAuB,EACzB,EACA,mBAAoB,CAClB,YAAa,qDACb,KAAM,SACN,WAAY,CACV,gBAAiB,CACf,YACE,mFACF,KAAM,SACR,EACA,QAAS,CACP,YAAa,iEACb,KAAM,yBACR,EACA,YAAa,CACX,YAAa,sEACb,KAAM,0BACR,CACF,EACA,qBAAsB,EACxB,CACF,CACF,EAEA,O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6E,CAC9F,MAAM1wB,EAASkvB,EAAgB,4BAA4B,KAAK,IAAI,QAASwB,CAAc,EAC3F,YAAK,WAAW,EACT1wB,CACT,CAGF","x_google_ignoreList":[11,12,13,19,28,29,30,31,32,33,34,35,36]} \ No newline at end of file diff --git a/lib/platform-bible-utils/dist/index.js b/lib/platform-bible-utils/dist/index.js index 3184206bcf..6ed9e5b5f4 100644 --- a/lib/platform-bible-utils/dist/index.js +++ b/lib/platform-bible-utils/dist/index.js @@ -1,9 +1,9 @@ -var Lr = Object.defineProperty; -var Vr = (t, e, r) => e in t ? Lr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r; -var E = (t, e, r) => Vr(t, typeof e != "symbol" ? e + "" : e, r); -import { Mutex as Ur } from "async-mutex"; -import { JSONPath as Dt } from "jsonpath-plus"; -class zn { +var Wn = Object.defineProperty; +var Qn = (e, t, r) => t in e ? Wn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r; +var S = (e, t, r) => Qn(e, typeof t != "symbol" ? t + "" : t, r); +import { Mutex as Zn } from "async-mutex"; +import { JSONPath as lr } from "jsonpath-plus"; +class ha { /** * Creates an instance of the class * @@ -12,13 +12,13 @@ class zn { * settled (resolved or rejected); will reject if it has not settled by that time. Use -1 if you * do not want a timeout at all. Defaults to 10000 ms */ - constructor(e, r = 1e4) { - E(this, "variableName"); - E(this, "promiseToValue"); - E(this, "resolver"); - E(this, "rejecter"); - this.variableName = e, this.promiseToValue = new Promise((u, n) => { - this.resolver = u, this.rejecter = n; + constructor(t, r = 1e4) { + S(this, "variableName"); + S(this, "promiseToValue"); + S(this, "resolver"); + S(this, "rejecter"); + this.variableName = t, this.promiseToValue = new Promise((n, u) => { + this.resolver = n, this.rejecter = u; }), r > 0 && setTimeout(() => { this.rejecter && (this.rejecter(`Timeout reached when waiting for ${this.variableName} to settle`), this.complete()); }, r), Object.seal(this); @@ -47,9 +47,9 @@ class zn { * @param throwIfAlreadySettled Determines whether to throw if the variable was already resolved * or rejected. Defaults to `false` */ - resolveToValue(e, r = !1) { + resolveToValue(t, r = !1) { if (this.resolver) - console.debug(`${this.variableName} is being resolved now`), this.resolver(e), this.complete(); + console.debug(`${this.variableName} is being resolved now`), this.resolver(t), this.complete(); else { if (r) throw Error(`${this.variableName} was already settled`); console.debug(`Ignoring subsequent resolution of ${this.variableName}`); @@ -62,9 +62,9 @@ class zn { * @param throwIfAlreadySettled Determines whether to throw if the variable was already resolved * or rejected. Defaults to `false` */ - rejectWithReason(e, r = !1) { + rejectWithReason(t, r = !1) { if (this.rejecter) - console.debug(`${this.variableName} is being rejected now`), this.rejecter(e), this.complete(); + console.debug(`${this.variableName} is being rejected now`), this.rejecter(t), this.complete(); else { if (r) throw Error(`${this.variableName} was already settled`); console.debug(`Ignoring subsequent rejection of ${this.variableName}`); @@ -75,10 +75,10 @@ class zn { this.resolver = void 0, this.rejecter = void 0, Object.freeze(this); } } -class Gn { - constructor(e, r) { - E(this, "collator"); - this.collator = new Intl.Collator(e, r); +class da { + constructor(t, r) { + S(this, "collator"); + this.collator = new Intl.Collator(t, r); } /** * Compares two strings according to the sort order of this Collator object @@ -89,8 +89,8 @@ class Gn { * sort order of this Collator object. Negative value if string1 comes before string2. Positive * value if string1 comes after string2. 0 if they are considered equal. */ - compare(e, r) { - return this.collator.compare(e, r); + compare(t, r) { + return this.collator.compare(t, r); } /** * Returns a new object with properties reflecting the locale and collation options computed @@ -102,10 +102,10 @@ class Gn { return this.collator.resolvedOptions(); } } -class zr { - constructor(e, r) { - E(this, "dateTimeFormatter"); - this.dateTimeFormatter = new Intl.DateTimeFormat(e, r); +class eu { + constructor(t, r) { + S(this, "dateTimeFormatter"); + this.dateTimeFormatter = new Intl.DateTimeFormat(t, r); } /** * Formats a date according to the locale and formatting option for this DateTimeFormat object @@ -114,8 +114,8 @@ class zr { * @returns String representing the given date formatted according to the locale and formatting * options of this DateTimeFormat object */ - format(e) { - return this.dateTimeFormatter.format(e); + format(t) { + return this.dateTimeFormatter.format(t); } /** * Formats a date range in the most concise way based on the locales and options provided when @@ -126,8 +126,8 @@ class zr { * @returns String representing the given date range formatted according to the locale and * formatting options of this DateTimeFormat object */ - formatRange(e, r) { - return this.dateTimeFormatter.formatRange(e, r); + formatRange(t, r) { + return this.dateTimeFormatter.formatRange(t, r); } /** * Returns an array of locale-specific tokens representing each part of the formatted date range @@ -137,8 +137,8 @@ class zr { * @param endDate Date object representing the end of the date range * @returns Array of DateTimeRangeFormatPart objects */ - formatRangeToParts(e, r) { - return this.dateTimeFormatter.formatRangeToParts(e, r); + formatRangeToParts(t, r) { + return this.dateTimeFormatter.formatRangeToParts(t, r); } /** * Allows locale-aware formatting of strings produced by this DateTimeFormat object @@ -146,8 +146,8 @@ class zr { * @param date The date to format * @returns Array of DateTimeFormatPart objects */ - formatToParts(e) { - return this.dateTimeFormatter.formatToParts(e); + formatToParts(t) { + return this.dateTimeFormatter.formatToParts(t); } /** * Returns a new object with properties reflecting the locale and date and time formatting options @@ -159,7 +159,7 @@ class zr { return this.dateTimeFormatter.resolvedOptions(); } } -class Gr { +class tu { constructor() { /** * Subscribes a function to run when this event is emitted. @@ -169,22 +169,22 @@ class Gr { * emitted * @alias event */ - E(this, "subscribe", this.event); + S(this, "subscribe", this.event); /** All callback functions that will run when this event is emitted. Lazy loaded */ - E(this, "subscriptions"); + S(this, "subscriptions"); /** Event for listeners to subscribe to. Lazy loaded */ - E(this, "lazyEvent"); + S(this, "lazyEvent"); /** Whether this emitter has been disposed */ - E(this, "isDisposed", !1); + S(this, "isDisposed", !1); /** Disposes of this event, preparing it to release from memory */ - E(this, "dispose", () => this.disposeFn()); + S(this, "dispose", () => this.disposeFn()); /** * Runs the subscriptions for the event * * @param event Event data to provide to subscribed callbacks */ - E(this, "emit", (e) => { - this.emitFn(e); + S(this, "emit", (t) => { + this.emitFn(t); }); } /** @@ -196,12 +196,12 @@ class Gr { * emitted */ get event() { - return this.assertNotDisposed(), this.lazyEvent || (this.lazyEvent = (e) => { - if (!e || typeof e != "function") + return this.assertNotDisposed(), this.lazyEvent || (this.lazyEvent = (t) => { + if (!t || typeof t != "function") throw new Error("Event handler callback must be a function!"); - return this.subscriptions || (this.subscriptions = []), this.subscriptions.push(e), () => { + return this.subscriptions || (this.subscriptions = []), this.subscriptions.push(t), () => { if (!this.subscriptions) return !1; - const r = this.subscriptions.indexOf(e); + const r = this.subscriptions.indexOf(t); return r < 0 ? !1 : (this.subscriptions.splice(r, 1), !0); }; }), this.lazyEvent; @@ -210,8 +210,8 @@ class Gr { * Function that runs the subscriptions for the event. Added here so children can override emit * and still call the base functionality. See NetworkEventEmitter.emit for example */ - emitFn(e) { - this.assertNotDisposed(), [...this.subscriptions ?? []].forEach((u) => u(e)); + emitFn(t) { + this.assertNotDisposed(), [...this.subscriptions ?? []].forEach((n) => n(t)); } /** Check to make sure this emitter is not disposed. Throw if it is */ assertNotDisposed() { @@ -225,105 +225,105 @@ class Gr { return this.assertNotDisposed(), this.isDisposed = !0, this.subscriptions = void 0, this.lazyEvent = void 0, Promise.resolve(!0); } } -function Jn() { +function ma() { return "00-0-4-1-000".replace( /[^-]/g, - (t) => ( + (e) => ( // @ts-expect-error ts(2363) this works fine // eslint-disable-next-line no-bitwise - ((Math.random() + ~~t) * 65536 >> t).toString(16).padStart(4, "0") + ((Math.random() + ~~e) * 65536 >> e).toString(16).padStart(4, "0") ) ); } -function qe(t) { - return typeof t == "string" || t instanceof String; +function Dt(e) { + return typeof e == "string" || e instanceof String; } -function Ee(t) { - return JSON.parse(JSON.stringify(t)); +function Je(e) { + return JSON.parse(JSON.stringify(e)); } -function Hn(t, e = 300) { - if (qe(t)) throw new Error("Tried to debounce a string! Could be XSS"); +function Ea(e, t = 300) { + if (Dt(e)) throw new Error("Tried to debounce a string! Could be XSS"); let r; - return (...u) => { - clearTimeout(r), r = setTimeout(() => t(...u), e); + return (...n) => { + clearTimeout(r), r = setTimeout(() => e(...n), t); }; } -function Xn(t, e, r) { - const u = /* @__PURE__ */ new Map(); - return t.forEach((n) => { - const i = e(n), o = u.get(i), a = r ? r(n, i) : n; - o ? o.push(a) : u.set(i, [a]); - }), u; +function ga(e, t, r) { + const n = /* @__PURE__ */ new Map(); + return e.forEach((u) => { + const i = t(u), a = n.get(i), o = r ? r(u, i) : u; + a ? a.push(o) : n.set(i, [o]); + }), n; } -function Jr(t) { - return typeof t == "object" && // We're potentially dealing with objects we didn't create, so they might contain `null` +function ru(e) { + return typeof e == "object" && // We're potentially dealing with objects we didn't create, so they might contain `null` // eslint-disable-next-line no-null/no-null - t !== null && "message" in t && // Type assert `error` to check it's `message`. + e !== null && "message" in e && // Type assert `error` to check it's `message`. // eslint-disable-next-line no-type-assertion/no-type-assertion - typeof t.message == "string"; + typeof e.message == "string"; } -function Hr(t) { - if (Jr(t)) return t; +function nu(e) { + if (ru(e)) return e; try { - return new Error(JSON.stringify(t)); + return new Error(JSON.stringify(e)); } catch { - return new Error(String(t)); + return new Error(String(e)); } } -function Kn(t) { - return Hr(t).message; +function Da(e) { + return nu(e).message; } -function Xr(t) { - return new Promise((e) => setTimeout(e, t)); +function uu(e) { + return new Promise((t) => setTimeout(t, e)); } -function Wn(t, e) { - const r = Xr(e).then(() => { +function va(e, t) { + const r = uu(t).then(() => { }); - return Promise.any([r, t()]); + return Promise.any([r, e()]); } -function Yn(t, e = "obj") { +function Aa(e, t = "obj") { const r = /* @__PURE__ */ new Set(); - Object.getOwnPropertyNames(t).forEach((n) => { + Object.getOwnPropertyNames(e).forEach((u) => { try { - typeof t[n] == "function" && r.add(n); + typeof e[u] == "function" && r.add(u); } catch { } }); - let u = Object.getPrototypeOf(t); - for (; u && Object.getPrototypeOf(u); ) - Object.getOwnPropertyNames(u).forEach((n) => { + let n = Object.getPrototypeOf(e); + for (; n && Object.getPrototypeOf(n); ) + Object.getOwnPropertyNames(n).forEach((u) => { try { - typeof t[n] == "function" && r.add(n); + typeof e[u] == "function" && r.add(u); } catch { } - }), u = Object.getPrototypeOf(u); + }), n = Object.getPrototypeOf(n); return r; } -function Zn(t, e = {}) { - return new Proxy(e, { - get(r, u) { - return u in r ? r[u] : async (...n) => (await t())[u](...n); +function Na(e, t = {}) { + return new Proxy(t, { + get(r, n) { + return n in r ? r[n] : async (...u) => (await e())[n](...u); } }); } -class Kr { +class iu { /** * Create a DocumentCombiner instance * * @param baseDocument This is the first document that will be used when composing the output * @param options Options used by this object when combining documents */ - constructor(e, r) { - E(this, "baseDocument"); - E(this, "contributions", /* @__PURE__ */ new Map()); - E(this, "latestOutput"); - E(this, "options"); - E(this, "onDidRebuildEmitter", new Gr()); + constructor(t, r) { + S(this, "baseDocument"); + S(this, "contributions", /* @__PURE__ */ new Map()); + S(this, "latestOutput"); + S(this, "options"); + S(this, "onDidRebuildEmitter", new tu()); /** Event that emits to announce that the document has been rebuilt and the output has been updated */ // Need `onDidRebuildEmitter` to be instantiated before this line // eslint-disable-next-line @typescript-eslint/member-ordering - E(this, "onDidRebuild", this.onDidRebuildEmitter.subscribe); - this.baseDocument = e, this.options = r, this.updateBaseDocument(e); + S(this, "onDidRebuild", this.onDidRebuildEmitter.subscribe); + this.baseDocument = t, this.options = r, this.updateBaseDocument(t); } /** * Update the starting document for composition process @@ -331,8 +331,8 @@ class Kr { * @param baseDocument Base JSON document/JS object that all other documents are added to * @returns Recalculated output document given the new starting state and existing other documents */ - updateBaseDocument(e) { - return this.validateBaseDocument(e), this.baseDocument = this.options.copyDocuments ? Ee(e) : e, this.baseDocument = this.transformBaseDocumentAfterValidation(this.baseDocument), this.rebuild(); + updateBaseDocument(t) { + return this.validateBaseDocument(t), this.baseDocument = this.options.copyDocuments ? Je(t) : t, this.baseDocument = this.transformBaseDocumentAfterValidation(this.baseDocument), this.rebuild(); } /** * Add or update one of the contribution documents for the composition process @@ -349,15 +349,15 @@ class Kr { * @returns Recalculated output document given the new or updated contribution and existing other * documents */ - addOrUpdateContribution(e, r) { - this.validateContribution(e, r); - const u = this.contributions.get(e); - let n = this.options.copyDocuments && r ? Ee(r) : r; - n = this.transformContributionAfterValidation(e, n), this.contributions.set(e, n); + addOrUpdateContribution(t, r) { + this.validateContribution(t, r); + const n = this.contributions.get(t); + let u = this.options.copyDocuments && r ? Je(r) : r; + u = this.transformContributionAfterValidation(t, u), this.contributions.set(t, u); try { return this.rebuild(); } catch (i) { - throw u ? this.contributions.set(e, u) : this.contributions.delete(e), new Error(`Error when setting the document named ${e}: ${i}`); + throw n ? this.contributions.set(t, n) : this.contributions.delete(t), new Error(`Error when setting the document named ${t}: ${i}`); } } /** @@ -366,14 +366,14 @@ class Kr { * @param documentName Name of the contributed document to delete * @returns Recalculated output document given the remaining other documents */ - deleteContribution(e) { - const r = this.contributions.get(e); - if (!r) throw new Error(`${e} does not exist`); - this.contributions.delete(e); + deleteContribution(t) { + const r = this.contributions.get(t); + if (!r) throw new Error(`${t} does not exist`); + this.contributions.delete(t); try { return this.rebuild(); - } catch (u) { - throw this.contributions.set(e, r), new Error(`Error when deleting the document named ${e}: ${u}`); + } catch (n) { + throw this.contributions.set(t, r), new Error(`Error when deleting the document named ${t}: ${n}`); } } /** @@ -384,13 +384,13 @@ class Kr { */ deleteAllContributions() { if (this.contributions.size <= 0) return this.latestOutput; - const e = [...this.contributions.entries()]; - e.forEach(([r]) => this.contributions.delete(r)); + const t = [...this.contributions.entries()]; + t.forEach(([r]) => this.contributions.delete(r)); try { return this.rebuild(); } catch (r) { - throw e.forEach( - ([u, n]) => this.contributions.set(u, n) + throw t.forEach( + ([n, u]) => this.contributions.set(n, u) ), new Error(`Error when deleting all contributions: ${r}`); } } @@ -402,17 +402,17 @@ class Kr { */ rebuild() { if (this.contributions.size === 0) { - let r = Ee(this.baseDocument); + let r = Je(this.baseDocument); return r = this.transformFinalOutputBeforeValidation(r), this.validateOutput(r), this.latestOutput = r, this.onDidRebuildEmitter.emit(void 0), this.latestOutput; } - let e = this.baseDocument; + let t = this.baseDocument; return this.contributions.forEach((r) => { - e = Wr( - e, + t = ou( + t, r, this.options.ignoreDuplicateProperties - ), this.validateOutput(e); - }), e = this.transformFinalOutputBeforeValidation(e), this.validateOutput(e), this.latestOutput = e, this.onDidRebuildEmitter.emit(void 0), this.latestOutput; + ), this.validateOutput(t); + }), t = this.transformFinalOutputBeforeValidation(t), this.validateOutput(t), this.latestOutput = t, this.onDidRebuildEmitter.emit(void 0), this.latestOutput; } /** * Transform the starting document that is given to the combiner. This transformation occurs after @@ -427,8 +427,8 @@ class Kr { // We just don't need `this` here. This is basically a no-op function that is available to child // classes to override // eslint-disable-next-line @typescript-eslint/class-methods-use-this - transformBaseDocumentAfterValidation(e) { - return e; + transformBaseDocumentAfterValidation(t) { + return t; } /** * Transform the contributed document associated with `documentName`. This transformation occurs @@ -445,7 +445,7 @@ class Kr { // We just don't need `this` here. This is basically a no-op function that is available to child // classes to override // eslint-disable-next-line @typescript-eslint/class-methods-use-this - transformContributionAfterValidation(e, r) { + transformContributionAfterValidation(t, r) { return r; } /** @@ -456,7 +456,7 @@ class Kr { // no-op intended to be overridden by child classes. Can't be static // @ts-expect-error ts(6133) parameter doesn't need to be used but still needs the right name // eslint-disable-next-line @typescript-eslint/class-methods-use-this, @typescript-eslint/no-unused-vars - validateBaseDocument(e) { + validateBaseDocument(t) { } /** * Throw an error if the provided document is not a valid contribution document. @@ -467,7 +467,7 @@ class Kr { // no-op intended to be overridden by child classes. Can't be static // @ts-expect-error ts(6133) parameter doesn't need to be used but still needs the right name // eslint-disable-next-line @typescript-eslint/class-methods-use-this, @typescript-eslint/no-unused-vars - validateContribution(e, r) { + validateContribution(t, r) { } /** * Throw an error if the provided output is not valid. @@ -477,7 +477,7 @@ class Kr { // no-op intended to be overridden by child classes. Can't be static // @ts-expect-error ts(6133) parameter doesn't need to be used but still needs the right name // eslint-disable-next-line @typescript-eslint/class-methods-use-this, @typescript-eslint/no-unused-vars - validateOutput(e) { + validateOutput(t) { } /** * Transform the document that is the composition of the base document and all contribution @@ -489,78 +489,78 @@ class Kr { */ // no-op intended to be overridden by child classes. Can't be static // eslint-disable-next-line @typescript-eslint/class-methods-use-this - transformFinalOutputBeforeValidation(e) { - return e; - } -} -function vt(...t) { - let e = !0; - return t.forEach((r) => { - (!r || typeof r != "object" || Array.isArray(r)) && (e = !1); - }), e; -} -function bt(...t) { - let e = !0; - return t.forEach((r) => { - (!r || typeof r != "object" || !Array.isArray(r)) && (e = !1); - }), e; -} -function Wr(t, e, r) { - const u = Ee(t); - return e ? Wt(u, Ee(e), r) : u; -} -function Wt(t, e, r) { - if (!e) return t; - if (vt(t, e)) { - const u = t, n = e; - Object.keys(n).forEach((i) => { - if (Object.hasOwn(u, i)) { - if (vt(u[i], n[i])) - u[i] = Wt( + transformFinalOutputBeforeValidation(t) { + return t; + } +} +function fr(...e) { + let t = !0; + return e.forEach((r) => { + (!r || typeof r != "object" || Array.isArray(r)) && (t = !1); + }), t; +} +function pr(...e) { + let t = !0; + return e.forEach((r) => { + (!r || typeof r != "object" || !Array.isArray(r)) && (t = !1); + }), t; +} +function ou(e, t, r) { + const n = Je(e); + return t ? Yr(n, Je(t), r) : n; +} +function Yr(e, t, r) { + if (!t) return e; + if (fr(e, t)) { + const n = e, u = t; + Object.keys(u).forEach((i) => { + if (Object.hasOwn(n, i)) { + if (fr(n[i], u[i])) + n[i] = Yr( // We know these are objects from the `if` check /* eslint-disable no-type-assertion/no-type-assertion */ - u[i], n[i], + u[i], r /* eslint-enable no-type-assertion/no-type-assertion */ ); - else if (bt(u[i], n[i])) - u[i] = u[i].concat( - n[i] + else if (pr(n[i], u[i])) + n[i] = n[i].concat( + u[i] ); else if (!r) throw new Error(`Cannot merge objects: key "${i}" already exists in the target object`); } else - u[i] = n[i]; + n[i] = u[i]; }); - } else bt(t, e) && t.push(...e); - return t; + } else pr(e, t) && e.push(...t); + return e; } -class Yr extends Ur { +class au extends Zn { } -class Qn { +class ba { constructor() { - E(this, "mutexesByID", /* @__PURE__ */ new Map()); + S(this, "mutexesByID", /* @__PURE__ */ new Map()); } - get(e) { - let r = this.mutexesByID.get(e); - return r || (r = new Yr(), this.mutexesByID.set(e, r), r); + get(t) { + let r = this.mutexesByID.get(t); + return r || (r = new au(), this.mutexesByID.set(t, r), r); } } -class ei extends Kr { +class ya extends iu { // Making the protected base constructor public // eslint-disable-next-line @typescript-eslint/no-useless-constructor - constructor(e, r) { - super(e, r); + constructor(t, r) { + super(t, r); } get output() { return this.latestOutput; } } -class Zr { - constructor(e, r) { - E(this, "numberFormatter"); - this.numberFormatter = new Intl.NumberFormat(e, r); +class su { + constructor(t, r) { + S(this, "numberFormatter"); + this.numberFormatter = new Intl.NumberFormat(t, r); } /** * Formats a number according to the locale and formatting options of this NumberFormat object @@ -569,8 +569,8 @@ class Zr { * @returns String representing the given number formatted according to the locale and formatting * options of this NumberFormat object */ - format(e) { - return this.numberFormatter.format(e); + format(t) { + return this.numberFormatter.format(t); } /** * Formats a range of numbers according to the locale and formatting options of this NumberFormat @@ -581,8 +581,8 @@ class Zr { * @returns String representing the given range of numbers formatted according to the locale and * formatting options of this NumberFormat object */ - formatRange(e, r) { - return this.numberFormatter.formatRange(e, r); + formatRange(t, r) { + return this.numberFormatter.formatRange(t, r); } /** * Returns an array of objects containing the locale-specific tokens from which it is possible to @@ -593,8 +593,8 @@ class Zr { * @returns Array of NumberRangeFormatPart objects containing the formatted range of numbers in * parts */ - formatRangeToParts(e, r) { - return this.numberFormatter.formatRangeToParts(e, r); + formatRangeToParts(t, r) { + return this.numberFormatter.formatRangeToParts(t, r); } /** * Allows locale-aware formatting of strings produced by this NumberFormat object @@ -602,8 +602,8 @@ class Zr { * @param value Number or bigint to format * @returns Array of NumberFormatPart objects containing the formatted number in parts */ - formatToParts(e) { - return this.numberFormatter.formatToParts(e); + formatToParts(t) { + return this.numberFormatter.formatToParts(t); } /** * Returns a new object with properties reflecting the locale and number formatting options @@ -615,18 +615,18 @@ class Zr { return this.numberFormatter.resolvedOptions(); } } -class ti { - constructor(e = "Anonymous") { - E(this, "unsubscribers", /* @__PURE__ */ new Set()); - this.name = e; +class Ca { + constructor(t = "Anonymous") { + S(this, "unsubscribers", /* @__PURE__ */ new Set()); + this.name = t; } /** * Add unsubscribers to the list. Note that duplicates are not added twice. * * @param unsubscribers - Objects that were returned from a registration process. */ - add(...e) { - e.forEach((r) => { + add(...t) { + t.forEach((r) => { "dispose" in r ? this.unsubscribers.add(r.dispose) : this.unsubscribers.add(r); }); } @@ -636,12 +636,12 @@ class ti { * @returns `true` if all unsubscribers succeeded, `false` otherwise. */ async runAllUnsubscribers() { - const e = [...this.unsubscribers].map((u) => u()), r = await Promise.all(e); - return this.unsubscribers.clear(), r.every((u, n) => (u || console.error(`UnsubscriberAsyncList ${this.name}: Unsubscriber at index ${n} failed!`), u)); + const t = [...this.unsubscribers].map((n) => n()), r = await Promise.all(t); + return this.unsubscribers.clear(), r.every((n, u) => (n || console.error(`UnsubscriberAsyncList ${this.name}: Unsubscriber at index ${u} failed!`), n)); } } -var Qr = Object.defineProperty, eu = (t, e, r) => e in t ? Qr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, d = (t, e, r) => eu(t, typeof e != "symbol" ? e + "" : e, r); -const ee = [ +var cu = Object.defineProperty, lu = (e, t, r) => t in e ? cu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, D = (e, t, r) => lu(e, typeof t != "symbol" ? t + "" : t, r); +const de = [ "GEN", "EXO", "LEV", @@ -786,7 +786,7 @@ const ee = [ "REP", "4BA", "LAO" -], Ze = [ +], Ht = [ "XXA", "XXB", "XXC", @@ -802,7 +802,7 @@ const ee = [ "GLO", "TDX", "NDX" -], Yt = [ +], Kr = [ "Genesis", "Exodus", "Leviticus", @@ -928,132 +928,132 @@ const ee = [ "Reproof (Proverbs 25-31)", "4 Baruch (Rest of Baruch)", "Laodiceans" -], Et = lu(); -function pe(t, e = !0) { - return e && (t = t.toUpperCase()), t in Et ? Et[t] : 0; +], hr = Au(); +function Re(e, t = !0) { + return t && (e = e.toUpperCase()), e in hr ? hr[e] : 0; } -function Qe(t) { - return pe(t) > 0; +function Gt(e) { + return Re(e) > 0; } -function tu(t) { - const e = typeof t == "string" ? pe(t) : t; - return e >= 40 && e <= 66; +function fu(e) { + const t = typeof e == "string" ? Re(e) : e; + return t >= 40 && t <= 66; } -function ru(t) { - return (typeof t == "string" ? pe(t) : t) <= 39; +function pu(e) { + return (typeof e == "string" ? Re(e) : e) <= 39; } -function Zt(t) { - return t <= 66; +function Wr(e) { + return e <= 66; } -function uu(t) { - const e = typeof t == "string" ? pe(t) : t; - return tr(e) && !Zt(e); +function hu(e) { + const t = typeof e == "string" ? Re(e) : e; + return en(t) && !Wr(t); } -function* nu() { - for (let t = 1; t <= ee.length; t++) yield t; +function* du() { + for (let e = 1; e <= de.length; e++) yield e; } -const iu = 1, Qt = ee.length; -function ou() { +const mu = 1, Qr = de.length; +function Eu() { return ["XXA", "XXB", "XXC", "XXD", "XXE", "XXF", "XXG"]; } -function et(t, e = "***") { - const r = t - 1; - return r < 0 || r >= ee.length ? e : ee[r]; -} -function er(t) { - return t <= 0 || t > Qt ? "******" : Yt[t - 1]; -} -function au(t) { - return er(pe(t)); -} -function tr(t) { - const e = typeof t == "number" ? et(t) : t; - return Qe(e) && !Ze.includes(e); -} -function su(t) { - const e = typeof t == "number" ? et(t) : t; - return Qe(e) && Ze.includes(e); -} -function cu(t) { - return Yt[t - 1].includes("*obsolete*"); -} -function lu() { - const t = {}; - for (let e = 0; e < ee.length; e++) - t[ee[e]] = e + 1; - return t; -} -const j = { - allBookIds: ee, - nonCanonicalIds: Ze, - bookIdToNumber: pe, - isBookIdValid: Qe, - isBookNT: tu, - isBookOT: ru, - isBookOTNT: Zt, - isBookDC: uu, - allBookNumbers: nu, - firstBook: iu, - lastBook: Qt, - extraBooks: ou, - bookNumberToId: et, - bookNumberToEnglishName: er, - bookIdToEnglishName: au, - isCanonical: tr, - isExtraMaterial: su, - isObsolete: cu +function zt(e, t = "***") { + const r = e - 1; + return r < 0 || r >= de.length ? t : de[r]; +} +function Zr(e) { + return e <= 0 || e > Qr ? "******" : Kr[e - 1]; +} +function gu(e) { + return Zr(Re(e)); +} +function en(e) { + const t = typeof e == "number" ? zt(e) : e; + return Gt(t) && !Ht.includes(t); +} +function Du(e) { + const t = typeof e == "number" ? zt(e) : e; + return Gt(t) && Ht.includes(t); +} +function vu(e) { + return Kr[e - 1].includes("*obsolete*"); +} +function Au() { + const e = {}; + for (let t = 0; t < de.length; t++) + e[de[t]] = t + 1; + return e; +} +const W = { + allBookIds: de, + nonCanonicalIds: Ht, + bookIdToNumber: Re, + isBookIdValid: Gt, + isBookNT: fu, + isBookOT: pu, + isBookOTNT: Wr, + isBookDC: hu, + allBookNumbers: du, + firstBook: mu, + lastBook: Qr, + extraBooks: Eu, + bookNumberToId: zt, + bookNumberToEnglishName: Zr, + bookIdToEnglishName: gu, + isCanonical: en, + isExtraMaterial: Du, + isObsolete: vu }; -var _ = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.Original = 1] = "Original", t[t.Septuagint = 2] = "Septuagint", t[t.Vulgate = 3] = "Vulgate", t[t.English = 4] = "English", t[t.RussianProtestant = 5] = "RussianProtestant", t[t.RussianOrthodox = 6] = "RussianOrthodox", t))(_ || {}); -const $ = class { +var Z = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.Original = 1] = "Original", e[e.Septuagint = 2] = "Septuagint", e[e.Vulgate = 3] = "Vulgate", e[e.English = 4] = "English", e[e.RussianProtestant = 5] = "RussianProtestant", e[e.RussianOrthodox = 6] = "RussianOrthodox", e))(Z || {}); +const G = class { // private versInfo: Versification; - constructor(e) { - if (d(this, "name"), d(this, "fullPath"), d(this, "isPresent"), d(this, "hasVerseSegments"), d(this, "isCustomized"), d(this, "baseVersification"), d(this, "scriptureBooks"), d(this, "_type"), e == null) + constructor(t) { + if (D(this, "name"), D(this, "fullPath"), D(this, "isPresent"), D(this, "hasVerseSegments"), D(this, "isCustomized"), D(this, "baseVersification"), D(this, "scriptureBooks"), D(this, "_type"), t == null) throw new Error("Argument undefined"); - typeof e == "string" ? (this.name = e, this._type = _[e]) : (this._type = e, this.name = _[e]); + typeof t == "string" ? (this.name = t, this._type = Z[t]) : (this._type = t, this.name = Z[t]); } get type() { return this._type; } - equals(e) { - return !e.type || !this.type ? !1 : e.type === this.type; + equals(t) { + return !t.type || !this.type ? !1 : t.type === this.type; } }; -d($, "Original", new $(_.Original)), d($, "Septuagint", new $(_.Septuagint)), d($, "Vulgate", new $(_.Vulgate)), d($, "English", new $(_.English)), d($, "RussianProtestant", new $(_.RussianProtestant)), d($, "RussianOrthodox", new $(_.RussianOrthodox)); -let Z = $; -function At(t, e) { - const r = e[0]; - for (let u = 1; u < e.length; u++) - t = t.split(e[u]).join(r); - return t.split(r); -} -var rr = /* @__PURE__ */ ((t) => (t[t.Valid = 0] = "Valid", t[t.UnknownVersification = 1] = "UnknownVersification", t[t.OutOfRange = 2] = "OutOfRange", t[t.VerseOutOfOrder = 3] = "VerseOutOfOrder", t[t.VerseRepeated = 4] = "VerseRepeated", t))(rr || {}); -const I = class m { - constructor(e, r, u, n) { - if (d(this, "firstChapter"), d(this, "lastChapter"), d(this, "lastVerse"), d(this, "hasSegmentsDefined"), d(this, "text"), d(this, "BBBCCCVVVS"), d(this, "longHashCode"), d(this, "versification"), d(this, "rtlMark", "‏"), d(this, "_bookNum", 0), d(this, "_chapterNum", 0), d(this, "_verseNum", 0), d(this, "_verse"), u == null && n == null) - if (e != null && typeof e == "string") { - const i = e, o = r != null && r instanceof Z ? r : void 0; - this.setEmpty(o), this.parse(i); - } else if (e != null && typeof e == "number") { - const i = r != null && r instanceof Z ? r : void 0; - this.setEmpty(i), this._verseNum = e % m.chapterDigitShifter, this._chapterNum = Math.floor( - e % m.bookDigitShifter / m.chapterDigitShifter - ), this._bookNum = Math.floor(e / m.bookDigitShifter); +D(G, "Original", new G(Z.Original)), D(G, "Septuagint", new G(Z.Septuagint)), D(G, "Vulgate", new G(Z.Vulgate)), D(G, "English", new G(Z.English)), D(G, "RussianProtestant", new G(Z.RussianProtestant)), D(G, "RussianOrthodox", new G(Z.RussianOrthodox)); +let oe = G; +function dr(e, t) { + const r = t[0]; + for (let n = 1; n < t.length; n++) + e = e.split(t[n]).join(r); + return e.split(r); +} +var tn = /* @__PURE__ */ ((e) => (e[e.Valid = 0] = "Valid", e[e.UnknownVersification = 1] = "UnknownVersification", e[e.OutOfRange = 2] = "OutOfRange", e[e.VerseOutOfOrder = 3] = "VerseOutOfOrder", e[e.VerseRepeated = 4] = "VerseRepeated", e))(tn || {}); +const k = class N { + constructor(t, r, n, u) { + if (D(this, "firstChapter"), D(this, "lastChapter"), D(this, "lastVerse"), D(this, "hasSegmentsDefined"), D(this, "text"), D(this, "BBBCCCVVVS"), D(this, "longHashCode"), D(this, "versification"), D(this, "rtlMark", "‏"), D(this, "_bookNum", 0), D(this, "_chapterNum", 0), D(this, "_verseNum", 0), D(this, "_verse"), n == null && u == null) + if (t != null && typeof t == "string") { + const i = t, a = r != null && r instanceof oe ? r : void 0; + this.setEmpty(a), this.parse(i); + } else if (t != null && typeof t == "number") { + const i = r != null && r instanceof oe ? r : void 0; + this.setEmpty(i), this._verseNum = t % N.chapterDigitShifter, this._chapterNum = Math.floor( + t % N.bookDigitShifter / N.chapterDigitShifter + ), this._bookNum = Math.floor(t / N.bookDigitShifter); } else if (r == null) - if (e != null && e instanceof m) { - const i = e; + if (t != null && t instanceof N) { + const i = t; this._bookNum = i.bookNum, this._chapterNum = i.chapterNum, this._verseNum = i.verseNum, this._verse = i.verse, this.versification = i.versification; } else { - if (e == null) return; - const i = e instanceof Z ? e : m.defaultVersification; + if (t == null) return; + const i = t instanceof oe ? t : N.defaultVersification; this.setEmpty(i); } else throw new Error("VerseRef constructor not supported."); - else if (e != null && r != null && u != null) - if (typeof e == "string" && typeof r == "string" && typeof u == "string") - this.setEmpty(n), this.updateInternal(e, r, u); - else if (typeof e == "number" && typeof r == "number" && typeof u == "number") - this._bookNum = e, this._chapterNum = r, this._verseNum = u, this.versification = n ?? m.defaultVersification; + else if (t != null && r != null && n != null) + if (typeof t == "string" && typeof r == "string" && typeof n == "string") + this.setEmpty(u), this.updateInternal(t, r, n); + else if (typeof t == "number" && typeof r == "number" && typeof n == "number") + this._bookNum = t, this._chapterNum = r, this._verseNum = n, this.versification = u ?? N.defaultVersification; else throw new Error("VerseRef constructor not supported."); else @@ -1062,8 +1062,8 @@ const I = class m { /** * Determines if the verse string is in a valid format (does not consider versification). */ - static isVerseParseable(e) { - return e.length > 0 && "0123456789".includes(e[0]) && !e.endsWith(this.verseRangeSeparator) && !e.endsWith(this.verseSequenceIndicator); + static isVerseParseable(t) { + return t.length > 0 && "0123456789".includes(t[0]) && !t.endsWith(this.verseRangeSeparator) && !t.endsWith(this.verseSequenceIndicator); } /** * Tries to parse the specified string into a verse reference. @@ -1071,14 +1071,14 @@ const I = class m { * @returns success: `true` if the specified string was successfully parsed, `false` otherwise. * @returns verseRef: The result of the parse if successful, or empty VerseRef if it failed */ - static tryParse(e) { + static tryParse(t) { let r; try { - return r = new m(e), { success: !0, verseRef: r }; - } catch (u) { - if (u instanceof me) - return r = new m(), { success: !1, verseRef: r }; - throw u; + return r = new N(t), { success: !0, verseRef: r }; + } catch (n) { + if (n instanceof je) + return r = new N(), { success: !1, verseRef: r }; + throw n; } } /** @@ -1090,18 +1090,18 @@ const I = class m { * @returns The reference as a comparable integer where the book, chapter, and verse each occupy 3 * digits. */ - static getBBBCCCVVV(e, r, u) { - return e % m.bcvMaxValue * m.bookDigitShifter + (r >= 0 ? r % m.bcvMaxValue * m.chapterDigitShifter : 0) + (u >= 0 ? u % m.bcvMaxValue : 0); + static getBBBCCCVVV(t, r, n) { + return t % N.bcvMaxValue * N.bookDigitShifter + (r >= 0 ? r % N.bcvMaxValue * N.chapterDigitShifter : 0) + (n >= 0 ? n % N.bcvMaxValue : 0); } /** * Deserializes a serialized VerseRef. * @param serializedVerseRef - Serialized VerseRef to create from. * @returns the deserialized VerseRef. */ - static fromJSON(e) { - const { book: r, chapterNum: u, verseNum: n, verse: i, versificationStr: o } = e, a = i || n.toString(); + static fromJSON(t) { + const { book: r, chapterNum: n, verseNum: u, verse: i, versificationStr: a } = t, o = i || u.toString(); let s; - return o && (s = new Z(o)), r ? new m(r, u.toString(), a, s) : new m(); + return a && (s = new oe(a)), r ? new N(r, n.toString(), o, s) : new N(); } /** * Parses a verse string and gets the leading numeric portion as a number. @@ -1109,16 +1109,16 @@ const I = class m { * @returns true if the entire string could be parsed as a single, simple verse number (1-999); * false if the verse string represented a verse bridge, contained segment letters, or was invalid */ - static tryGetVerseNum(e) { + static tryGetVerseNum(t) { let r; - if (!e) + if (!t) return r = -1, { success: !0, vNum: r }; r = 0; - let u; - for (let n = 0; n < e.length; n++) { - if (u = e[n], u < "0" || u > "9") - return n === 0 && (r = -1), { success: !1, vNum: r }; - if (r = r * 10 + +u - 0, r > m.bcvMaxValue) + let n; + for (let u = 0; u < t.length; u++) { + if (n = t[u], n < "0" || n > "9") + return u === 0 && (r = -1), { success: !1, vNum: r }; + if (r = r * 10 + +n - 0, r > N.bcvMaxValue) return r = -1, { success: !1, vNum: r }; } return { success: !0, vNum: r }; @@ -1133,17 +1133,17 @@ const I = class m { * Gets whether the verse contains multiple verses. */ get hasMultiple() { - return this._verse != null && (this._verse.includes(m.verseRangeSeparator) || this._verse.includes(m.verseSequenceIndicator)); + return this._verse != null && (this._verse.includes(N.verseRangeSeparator) || this._verse.includes(N.verseSequenceIndicator)); } /** * Gets or sets the book of the reference. Book is the 3-letter abbreviation in capital letters, * e.g. `'MAT'`. */ get book() { - return j.bookNumberToId(this.bookNum, ""); + return W.bookNumberToId(this.bookNum, ""); } - set book(e) { - this.bookNum = j.bookIdToNumber(e); + set book(t) { + this.bookNum = W.bookIdToNumber(t); } /** * Gets or sets the chapter of the reference,. e.g. `'3'`. @@ -1151,8 +1151,8 @@ const I = class m { get chapter() { return this.isDefault || this._chapterNum < 0 ? "" : this._chapterNum.toString(); } - set chapter(e) { - const r = +e; + set chapter(t) { + const r = +t; this._chapterNum = Number.isInteger(r) ? r : -1; } /** @@ -1162,9 +1162,9 @@ const I = class m { get verse() { return this._verse != null ? this._verse : this.isDefault || this._verseNum < 0 ? "" : this._verseNum.toString(); } - set verse(e) { - const { success: r, vNum: u } = m.tryGetVerseNum(e); - this._verse = r ? void 0 : e.replace(this.rtlMark, ""), this._verseNum = u, !(this._verseNum >= 0) && ({ vNum: this._verseNum } = m.tryGetVerseNum(this._verse)); + set verse(t) { + const { success: r, vNum: n } = N.tryGetVerseNum(t); + this._verse = r ? void 0 : t.replace(this.rtlMark, ""), this._verseNum = n, !(this._verseNum >= 0) && ({ vNum: this._verseNum } = N.tryGetVerseNum(this._verse)); } /** * Get or set Book based on book number, e.g. `42`. @@ -1172,12 +1172,12 @@ const I = class m { get bookNum() { return this._bookNum; } - set bookNum(e) { - if (e <= 0 || e > j.lastBook) - throw new me( + set bookNum(t) { + if (t <= 0 || t > W.lastBook) + throw new je( "BookNum must be greater than zero and less than or equal to last book" ); - this._bookNum = e; + this._bookNum = t; } /** * Gets or sets the chapter number, e.g. `3`. `-1` if not valid. @@ -1185,8 +1185,8 @@ const I = class m { get chapterNum() { return this._chapterNum; } - set chapterNum(e) { - this.chapterNum = e; + set chapterNum(t) { + this.chapterNum = t; } /** * Gets or sets verse start number, e.g. `4`. `-1` if not valid. @@ -1194,8 +1194,8 @@ const I = class m { get verseNum() { return this._verseNum; } - set verseNum(e) { - this._verseNum = e; + set verseNum(t) { + this._verseNum = t; } /** * String representing the versification (should ONLY be used for serialization/deserialization). @@ -1203,11 +1203,11 @@ const I = class m { * @remarks This is for backwards compatibility when ScrVers was an enumeration. */ get versificationStr() { - var e; - return (e = this.versification) == null ? void 0 : e.name; + var t; + return (t = this.versification) == null ? void 0 : t.name; } - set versificationStr(e) { - this.versification = this.versification != null ? new Z(e) : void 0; + set versificationStr(t) { + this.versification = this.versification != null ? new oe(t) : void 0; } /** * Determines if the reference is valid. @@ -1219,14 +1219,14 @@ const I = class m { * Get the valid status for this reference. */ get validStatus() { - return this.validateVerse(m.verseRangeSeparators, m.verseSequenceIndicators); + return this.validateVerse(N.verseRangeSeparators, N.verseSequenceIndicators); } /** * Gets the reference as a comparable integer where the book, * chapter, and verse each occupy three digits and the verse is 0. */ get BBBCCC() { - return m.getBBBCCCVVV(this._bookNum, this._chapterNum, 0); + return N.getBBBCCCVVV(this._bookNum, this._chapterNum, 0); } /** * Gets the reference as a comparable integer where the book, @@ -1235,7 +1235,7 @@ const I = class m { * segments or bridge) this cannot be used for an exact comparison. */ get BBBCCCVVV() { - return m.getBBBCCCVVV(this._bookNum, this._chapterNum, this._verseNum); + return N.getBBBCCCVVV(this._bookNum, this._chapterNum, this._verseNum); } /** * Gets whether the verse is defined as an excluded verse in the versification. @@ -1255,24 +1255,24 @@ const I = class m { * - versification is invalid * @param verseStr - string to parse e.g. 'MAT 3:11' */ - parse(e) { - if (e = e.replace(this.rtlMark, ""), e.includes("/")) { - const i = e.split("/"); - if (e = i[0], i.length > 1) + parse(t) { + if (t = t.replace(this.rtlMark, ""), t.includes("/")) { + const i = t.split("/"); + if (t = i[0], i.length > 1) try { - const o = +i[1].trim(); - this.versification = new Z(_[o]); + const a = +i[1].trim(); + this.versification = new oe(Z[a]); } catch { - throw new me("Invalid reference : " + e); + throw new je("Invalid reference : " + t); } } - const r = e.trim().split(" "); + const r = t.trim().split(" "); if (r.length !== 2) - throw new me("Invalid reference : " + e); - const u = r[1].split(":"), n = +u[0]; - if (u.length !== 2 || j.bookIdToNumber(r[0]) === 0 || !Number.isInteger(n) || n < 0 || !m.isVerseParseable(u[1])) - throw new me("Invalid reference : " + e); - this.updateInternal(r[0], u[0], u[1]); + throw new je("Invalid reference : " + t); + const n = r[1].split(":"), u = +n[0]; + if (n.length !== 2 || W.bookIdToNumber(r[0]) === 0 || !Number.isInteger(u) || u < 0 || !N.isVerseParseable(n[1])) + throw new je("Invalid reference : " + t); + this.updateInternal(r[0], n[0], n[1]); } /** * Simplifies this verse ref so that it has no bridging of verses or @@ -1287,31 +1287,31 @@ const I = class m { * @returns The cloned VerseRef. */ clone() { - return new m(this); + return new N(this); } toString() { - const e = this.book; - return e === "" ? "" : `${e} ${this.chapter}:${this.verse}`; + const t = this.book; + return t === "" ? "" : `${t} ${this.chapter}:${this.verse}`; } toJSON() { - let e = this.verse; - (e === "" || e === this.verseNum.toString()) && (e = void 0); + let t = this.verse; + (t === "" || t === this.verseNum.toString()) && (t = void 0); const r = { book: this.book, chapterNum: this.chapterNum, verseNum: this.verseNum, - verse: e, + verse: t, versificationStr: this.versificationStr }; - return e || delete r.verse, r; + return t || delete r.verse, r; } /** * Compares this `VerseRef` with supplied one. * @param verseRef - object to compare this one to. * @returns `true` if this `VerseRef` is equal to the supplied one, `false` otherwise. */ - equals(e) { - return e instanceof m ? e._bookNum === this._bookNum && e._chapterNum === this._chapterNum && e._verseNum === this._verseNum && e.verse === this.verse && (e.versification == null && this.versification == null || e.versification != null && this.versification != null && e.versification.equals(this.versification)) : !1; + equals(t) { + return t instanceof N ? t._bookNum === this._bookNum && t._chapterNum === this._chapterNum && t._verseNum === this._verseNum && t.verse === this.verse && (t.versification == null && this.versification == null || t.versification != null && this.versification != null && t.versification.equals(this.versification)) : !1; } /** * Enumerate all individual verses contained in a VerseRef. @@ -1329,48 +1329,48 @@ const I = class m { * Defaults to `VerseRef.verseSequenceIndicators`. * @returns An array of all single verse references in this VerseRef. */ - allVerses(e = !1, r = m.verseRangeSeparators, u = m.verseSequenceIndicators) { + allVerses(t = !1, r = N.verseRangeSeparators, n = N.verseSequenceIndicators) { if (this._verse == null || this.chapterNum <= 0) return [this.clone()]; - const n = [], i = At(this._verse, u); - for (const o of i.map((a) => At(a, r))) { - const a = this.clone(); - a.verse = o[0]; - const s = a.verseNum; - if (n.push(a), o.length > 1) { - const l = this.clone(); - if (l.verse = o[1], !e) - for (let c = s + 1; c < l.verseNum; c++) { - const f = new m( + const u = [], i = dr(this._verse, n); + for (const a of i.map((o) => dr(o, r))) { + const o = this.clone(); + o.verse = a[0]; + const s = o.verseNum; + if (u.push(o), a.length > 1) { + const c = this.clone(); + if (c.verse = a[1], !t) + for (let l = s + 1; l < c.verseNum; l++) { + const f = new N( this._bookNum, this._chapterNum, - c, + l, this.versification ); - this.isExcluded || n.push(f); + this.isExcluded || u.push(f); } - n.push(l); + u.push(c); } } - return n; + return u; } /** * Validates a verse number using the supplied separators rather than the defaults. */ - validateVerse(e, r) { + validateVerse(t, r) { if (!this.verse) return this.internalValid; - let u = 0; - for (const n of this.allVerses(!0, e, r)) { - const i = n.internalValid; + let n = 0; + for (const u of this.allVerses(!0, t, r)) { + const i = u.internalValid; if (i !== 0) return i; - const o = n.BBBCCCVVV; - if (u > o) + const a = u.BBBCCCVVV; + if (n > a) return 3; - if (u === o) + if (n === a) return 4; - u = o; + n = a; } return 0; } @@ -1378,262 +1378,262 @@ const I = class m { * Gets whether a single verse reference is valid. */ get internalValid() { - return this.versification == null ? 1 : this._bookNum <= 0 || this._bookNum > j.lastBook ? 2 : (j.isCanonical(this._bookNum), 0); + return this.versification == null ? 1 : this._bookNum <= 0 || this._bookNum > W.lastBook ? 2 : (W.isCanonical(this._bookNum), 0); } - setEmpty(e = m.defaultVersification) { - this._bookNum = 0, this._chapterNum = -1, this._verse = void 0, this.versification = e; + setEmpty(t = N.defaultVersification) { + this._bookNum = 0, this._chapterNum = -1, this._verse = void 0, this.versification = t; } - updateInternal(e, r, u) { - this.bookNum = j.bookIdToNumber(e), this.chapter = r, this.verse = u; + updateInternal(t, r, n) { + this.bookNum = W.bookIdToNumber(t), this.chapter = r, this.verse = n; } }; -d(I, "defaultVersification", Z.English), d(I, "verseRangeSeparator", "-"), d(I, "verseSequenceIndicator", ","), d(I, "verseRangeSeparators", [I.verseRangeSeparator]), d(I, "verseSequenceIndicators", [I.verseSequenceIndicator]), d(I, "chapterDigitShifter", 1e3), d(I, "bookDigitShifter", I.chapterDigitShifter * I.chapterDigitShifter), d(I, "bcvMaxValue", I.chapterDigitShifter - 1), /** +D(k, "defaultVersification", oe.English), D(k, "verseRangeSeparator", "-"), D(k, "verseSequenceIndicator", ","), D(k, "verseRangeSeparators", [k.verseRangeSeparator]), D(k, "verseSequenceIndicators", [k.verseSequenceIndicator]), D(k, "chapterDigitShifter", 1e3), D(k, "bookDigitShifter", k.chapterDigitShifter * k.chapterDigitShifter), D(k, "bcvMaxValue", k.chapterDigitShifter - 1), /** * The valid status of the VerseRef. */ -d(I, "ValidStatusType", rr); -let ur = I; -class me extends Error { -} -var yt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, re = {}, fu = () => { - const t = "\\ud800-\\udfff", o = "\\u0300-\\u036f" + "\\ufe20-\\ufe2f" + "\\u20d0-\\u20ff" + "\\u1ab0-\\u1aff" + "\\u1dc0-\\u1dff", a = "\\ufe0e\\ufe0f", s = "\\uD83D\\uDC69\\uD83C\\uDFFB\\u200D\\uD83C\\uDF93", l = `[${t}]`, c = `[${o}]`, f = "\\ud83c[\\udffb-\\udfff]", p = `(?:${c}|${f})`, h = `[^${t}]`, g = "(?:\\uD83C[\\uDDE6-\\uDDFF]){2}", v = "[\\ud800-\\udbff][\\udc00-\\udfff]", b = "\\u200d", y = "(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40(?:\\udc65|\\udc73|\\udc77)\\udb40(?:\\udc6e|\\udc63|\\udc6c)\\udb40(?:\\udc67|\\udc74|\\udc73)\\udb40\\udc7f)", Y = `[${s}]`, A = `${p}?`, O = `[${a}]?`, de = `(?:${b}(?:${[h, g, v].join("|")})${O + A})*`, Se = O + A + de, Oe = `(?:${[`${h}${c}?`, c, g, v, l, Y].join("|")})`; - return new RegExp(`${y}|${f}(?=${f})|${Oe + Se}`, "g"); -}, pu = yt && yt.__importDefault || function(t) { - return t && t.__esModule ? t : { default: t }; +D(k, "ValidStatusType", tn); +let Jt = k; +class je extends Error { +} +var mr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, De = {}, Nu = () => { + const e = "\\ud800-\\udfff", a = "\\u0300-\\u036f" + "\\ufe20-\\ufe2f" + "\\u20d0-\\u20ff" + "\\u1ab0-\\u1aff" + "\\u1dc0-\\u1dff", o = "\\ufe0e\\ufe0f", s = "\\uD83D\\uDC69\\uD83C\\uDFFB\\u200D\\uD83C\\uDF93", c = `[${e}]`, l = `[${a}]`, f = "\\ud83c[\\udffb-\\udfff]", p = `(?:${l}|${f})`, m = `[^${e}]`, b = "(?:\\uD83C[\\uDDE6-\\uDDFF]){2}", T = "[\\ud800-\\udbff][\\udc00-\\udfff]", w = "\\u200d", I = "(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40(?:\\udc65|\\udc73|\\udc77)\\udb40(?:\\udc6e|\\udc63|\\udc6c)\\udb40(?:\\udc67|\\udc74|\\udc73)\\udb40\\udc7f)", re = `[${s}]`, B = `${p}?`, K = `[${o}]?`, U = `(?:${w}(?:${[m, b, T].join("|")})${K + B})*`, qe = K + B + U, Mt = `(?:${[`${m}${l}?`, l, b, T, c, re].join("|")})`; + return new RegExp(`${I}|${f}(?=${f})|${Mt + qe}`, "g"); +}, bu = mr && mr.__importDefault || function(e) { + return e && e.__esModule ? e : { default: e }; }; -Object.defineProperty(re, "__esModule", { value: !0 }); -var _e = pu(fu); -function Xe(t) { - if (typeof t != "string") +Object.defineProperty(De, "__esModule", { value: !0 }); +var Nt = bu(Nu); +function jt(e) { + if (typeof e != "string") throw new Error("A string is expected as input"); - return t.match(_e.default()) || []; + return e.match(Nt.default()) || []; } -var hu = re.toArray = Xe; -function tt(t) { - if (typeof t != "string") +var yu = De.toArray = jt; +function Xt(e) { + if (typeof e != "string") throw new Error("Input must be a string"); - var e = t.match(_e.default()); - return e === null ? 0 : e.length; + var t = e.match(Nt.default()); + return t === null ? 0 : t.length; } -var du = re.length = tt; -function nr(t, e, r) { - if (e === void 0 && (e = 0), typeof t != "string") +var Cu = De.length = Xt; +function rn(e, t, r) { + if (t === void 0 && (t = 0), typeof e != "string") throw new Error("Input must be a string"); - (typeof e != "number" || e < 0) && (e = 0), typeof r == "number" && r < 0 && (r = 0); - var u = t.match(_e.default()); - return u ? u.slice(e, r).join("") : ""; + (typeof t != "number" || t < 0) && (t = 0), typeof r == "number" && r < 0 && (r = 0); + var n = e.match(Nt.default()); + return n ? n.slice(t, r).join("") : ""; } -var mu = re.substring = nr; -function gu(t, e, r) { - if (e === void 0 && (e = 0), typeof t != "string") +var Tu = De.substring = rn; +function wu(e, t, r) { + if (t === void 0 && (t = 0), typeof e != "string") throw new Error("Input must be a string"); - var u = tt(t); - if (typeof e != "number" && (e = parseInt(e, 10)), e >= u) + var n = Xt(e); + if (typeof t != "number" && (t = parseInt(t, 10)), t >= n) return ""; - e < 0 && (e += u); - var n; - typeof r > "u" ? n = u : (typeof r != "number" && (r = parseInt(r, 10)), n = r >= 0 ? r + e : e); - var i = t.match(_e.default()); - return i ? i.slice(e, n).join("") : ""; + t < 0 && (t += n); + var u; + typeof r > "u" ? u = n : (typeof r != "number" && (r = parseInt(r, 10)), u = r >= 0 ? r + t : t); + var i = e.match(Nt.default()); + return i ? i.slice(t, u).join("") : ""; } -var Du = re.substr = gu; -function vu(t, e, r, u) { - if (e === void 0 && (e = 16), r === void 0 && (r = "#"), u === void 0 && (u = "right"), typeof t != "string" || typeof e != "number") +var Su = De.substr = wu; +function Ou(e, t, r, n) { + if (t === void 0 && (t = 16), r === void 0 && (r = "#"), n === void 0 && (n = "right"), typeof e != "string" || typeof t != "number") throw new Error("Invalid arguments specified"); - if (["left", "right"].indexOf(u) === -1) + if (["left", "right"].indexOf(n) === -1) throw new Error("Pad position should be either left or right"); typeof r != "string" && (r = String(r)); - var n = tt(t); - if (n > e) - return nr(t, 0, e); - if (n < e) { - var i = r.repeat(e - n); - return u === "left" ? i + t : t + i; - } - return t; -} -var ir = re.limit = vu; -function bu(t, e, r) { - if (r === void 0 && (r = 0), typeof t != "string") + var u = Xt(e); + if (u > t) + return rn(e, 0, t); + if (u < t) { + var i = r.repeat(t - u); + return n === "left" ? i + e : e + i; + } + return e; +} +var nn = De.limit = Ou; +function Iu(e, t, r) { + if (r === void 0 && (r = 0), typeof e != "string") throw new Error("Input must be a string"); - if (t === "") - return e === "" ? 0 : -1; - r = Number(r), r = isNaN(r) ? 0 : r, e = String(e); - var u = Xe(t); - if (r >= u.length) - return e === "" ? u.length : -1; if (e === "") + return t === "" ? 0 : -1; + r = Number(r), r = isNaN(r) ? 0 : r, t = String(t); + var n = jt(e); + if (r >= n.length) + return t === "" ? n.length : -1; + if (t === "") return r; - var n = Xe(e), i = !1, o; - for (o = r; o < u.length; o += 1) { - for (var a = 0; a < n.length && n[a] === u[o + a]; ) - a += 1; - if (a === n.length && n[a - 1] === u[o + a - 1]) { + var u = jt(t), i = !1, a; + for (a = r; a < n.length; a += 1) { + for (var o = 0; o < u.length && u[o] === n[a + o]; ) + o += 1; + if (o === u.length && u[o - 1] === n[a + o - 1]) { i = !0; break; } } - return i ? o : -1; + return i ? a : -1; } -var Eu = re.indexOf = bu; -function or(t) { - return t ? Array.isArray(t) ? t : [t] : []; +var Bu = De.indexOf = Iu; +function un(e) { + return e ? Array.isArray(e) ? e : [e] : []; } -function ui(t, e) { - if (!(e > C(t) || e < -C(t))) - return Le(t, e, 1); +function wa(e, t) { + if (!(t > F(e) || t < -F(e))) + return bt(e, t, 1); } -function se(t, e) { - return e < 0 || e > C(t) - 1 ? "" : Le(t, e, 1); +function Se(e, t) { + return t < 0 || t > F(e) - 1 ? "" : bt(e, t, 1); } -function ni(t, e) { - if (!(e < 0 || e > C(t) - 1)) - return Le(t, e, 1).codePointAt(0); +function Sa(e, t) { + if (!(t < 0 || t > F(e) - 1)) + return bt(e, t, 1).codePointAt(0); } -function Au(t, e, r = C(t)) { - const u = Cu(t, e); - return !(u === -1 || u + C(e) !== r); +function xu(e, t, r = F(e)) { + const n = Fu(e, t); + return !(n === -1 || n + F(t) !== r); } -function yu(t, e, r) { - if (e < 0) return -1; +function Ru(e, t, r) { + if (t < 0) return -1; if (r) { - if (se(t, e) === "}" && se(t, e - 1) === "\\") return e; - const i = Ae(t, "\\}", e); + if (Se(e, t) === "}" && Se(e, t - 1) === "\\") return t; + const i = Ye(e, "\\}", t); return i >= 0 ? i + 1 : i; } - let u = e; - const n = C(t); - for (; u < n && (u = Ae(t, "}", u), !(u === -1 || se(t, u - 1) !== "\\")); ) - u += 1; - return u >= n ? -1 : u; + let n = t; + const u = F(e); + for (; n < u && (n = Ye(e, "}", n), !(n === -1 || Se(e, n - 1) !== "\\")); ) + n += 1; + return n >= u ? -1 : n; } -function Nu(t, e) { +function Mu(e, t) { const r = []; - let u = 0, n = 0; - function i(a, s, l) { - const c = Q(t, n, s), f = r.length > 0 && qe(r[r.length - 1]) ? `${r.pop()}${c}` : c; - qe(a) ? r.push(`${f}${a}`) : (f && r.push(f), r.push(a)), n = s + l; - } - const o = C(t); - for (; u < o; ) { - switch (se(t, u)) { + let n = 0, u = 0; + function i(o, s, c) { + const l = pe(e, u, s), f = r.length > 0 && Dt(r[r.length - 1]) ? `${r.pop()}${l}` : l; + Dt(o) ? r.push(`${f}${o}`) : (f && r.push(f), r.push(o)), u = s + c; + } + const a = F(e); + for (; n < a; ) { + switch (Se(e, n)) { case "{": - if (se(t, u - 1) !== "\\") { - const a = yu(t, u, !1); - if (a >= 0) { - const s = Q(t, u + 1, a), l = s in e ? ( + if (Se(e, n - 1) !== "\\") { + const o = Ru(e, n, !1); + if (o >= 0) { + const s = pe(e, n + 1, o), c = s in t ? ( // Just checked that the key is in the object // eslint-disable-next-line no-type-assertion/no-type-assertion - e[s] + t[s] ) : s; - i(l, u, a + 1 - u), u = a, n = a + 1; + i(c, n, o + 1 - n), n = o, u = o + 1; } } else - i("{", u - 1, 2); + i("{", n - 1, 2); break; case "}": - se(t, u - 1) !== "\\" || i("}", u - 1, 2); + Se(e, n - 1) !== "\\" || i("}", n - 1, 2); break; } - u += 1; + n += 1; } - if (n < o) { - const a = Q(t, n); + if (u < a) { + const o = pe(e, u); r.push( - r.length > 0 && qe(r[r.length - 1]) ? `${r.pop()}${a}` : a + r.length > 0 && Dt(r[r.length - 1]) ? `${r.pop()}${o}` : o ); } return r; } -function ii(t, e) { - return Nu(t, e).map((r) => `${r}`).join(""); +function Oa(e, t) { + return Mu(e, t).map((r) => `${r}`).join(""); } -function wu(t, e, r = 0) { - const u = Q(t, r); - return Ae(u, e) !== -1; +function _u(e, t, r = 0) { + const n = pe(e, r); + return Ye(n, t) !== -1; } -function Ae(t, e, r = 0) { - return Eu(t, e, r); +function Ye(e, t, r = 0) { + return Bu(e, t, r); } -function Cu(t, e, r) { - let u = r === void 0 ? C(t) : r; - u < 0 ? u = 0 : u >= C(t) && (u = C(t) - 1); - for (let n = u; n >= 0; n--) - if (Le(t, n, C(e)) === e) - return n; +function Fu(e, t, r) { + let n = r === void 0 ? F(e) : r; + n < 0 ? n = 0 : n >= F(e) && (n = F(e) - 1); + for (let u = n; u >= 0; u--) + if (bt(e, u, F(t)) === t) + return u; return -1; } -function C(t) { - return du(t); +function F(e) { + return Cu(e); } -function oi(t, e) { - const r = e.toUpperCase(); - return r === "NONE" ? t : t.normalize(r); +function Ia(e, t) { + const r = t.toUpperCase(); + return r === "NONE" ? e : e.normalize(r); } -function ai(t, e, r) { - return t.localeCompare(e, "en", r); +function Ba(e, t, r) { + return e.localeCompare(t, "en", r); } -function si(t, e, r = " ") { - return e <= C(t) ? t : ir(t, e, r, "right"); +function xa(e, t, r = " ") { + return t <= F(e) ? e : nn(e, t, r, "right"); } -function ci(t, e, r = " ") { - return e <= C(t) ? t : ir(t, e, r, "left"); +function Ra(e, t, r = " ") { + return t <= F(e) ? e : nn(e, t, r, "left"); } -function Nt(t, e) { - return e > t ? t : e < -t ? 0 : e < 0 ? e + t : e; +function Er(e, t) { + return t > e ? e : t < -e ? 0 : t < 0 ? t + e : t; } -function li(t, e, r) { - const u = C(t); - if (e > u || r && (e > r && !(e >= 0 && e < u && r < 0 && r > -u) || r < -u)) +function Ma(e, t, r) { + const n = F(e); + if (t > n || r && (t > r && !(t >= 0 && t < n && r < 0 && r > -n) || r < -n)) return ""; - const n = Nt(u, e), i = r ? Nt(u, r) : void 0; - return Q(t, n, i); + const u = Er(n, t), i = r ? Er(n, r) : void 0; + return pe(e, u, i); } -function wt(t, e, r) { - const u = []; +function gr(e, t, r) { + const n = []; if (r !== void 0 && r <= 0) - return [t]; - if (e === "") return Bu(t).slice(0, r); - let n = e; - (typeof e == "string" || e instanceof RegExp && !wu(e.flags, "g")) && (n = new RegExp(e, "g")); - const i = t.match(n); - let o = 0; - if (!i) return [t]; - for (let a = 0; a < (r ? r - 1 : i.length); a++) { - const s = Ae(t, i[a], o), l = C(i[a]); - if (u.push(Q(t, o, s)), o = s + l, r !== void 0 && u.length === r) + return [e]; + if (t === "") return Lu(e).slice(0, r); + let u = t; + (typeof t == "string" || t instanceof RegExp && !_u(t.flags, "g")) && (u = new RegExp(t, "g")); + const i = e.match(u); + let a = 0; + if (!i) return [e]; + for (let o = 0; o < (r ? r - 1 : i.length); o++) { + const s = Ye(e, i[o], a), c = F(i[o]); + if (n.push(pe(e, a, s)), a = s + c, r !== void 0 && n.length === r) break; } - return u.push(Q(t, o)), u; + return n.push(pe(e, a)), n; } -function ar(t, e, r = 0) { - return Ae(t, e, r) === r; +function on(e, t, r = 0) { + return Ye(e, t, r) === r; } -function Le(t, e = 0, r = C(t) - e) { - return Du(t, e, r); +function bt(e, t = 0, r = F(e) - t) { + return Su(e, t, r); } -function Q(t, e, r = C(t)) { - return mu(t, e, r); +function pe(e, t, r = F(e)) { + return Tu(e, t, r); } -function Bu(t) { - return hu(t); +function Lu(e) { + return yu(e); } -function fi(t) { - return ar(t, "%") && Au(t, "%"); +function _a(e) { + return on(e, "%") && xu(e, "%"); } -function pi(t) { - if (typeof t != "string") +function Fa(e) { + if (typeof e != "string") throw new TypeError("Expected a string"); - return t.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); + return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); } -function hi(t) { - return t ? or(t).map( - (u) => Array.isArray(u) ? u.map((n) => new RegExp(n)) : new RegExp(u) +function La(e) { + return e ? un(e).map( + (n) => Array.isArray(n) ? n.map((u) => new RegExp(u)) : new RegExp(n) ) : []; } -function di(t) { - return t ? or(t).map((u) => new RegExp(u)) : []; +function ka(e) { + return e ? un(e).map((n) => new RegExp(n)) : []; } -const sr = [ +const an = [ { shortName: "ERR", fullNames: ["ERROR"], chapters: -1 }, { shortName: "GEN", fullNames: ["Genesis"], chapters: 50 }, { shortName: "EXO", fullNames: ["Exodus"], chapters: 40 }, @@ -1701,349 +1701,364 @@ const sr = [ { shortName: "3JN", fullNames: ["3 John"], chapters: 1 }, { shortName: "JUD", fullNames: ["Jude"], chapters: 1 }, { shortName: "REV", fullNames: ["Revelation"], chapters: 22 } -], Tu = 1, Su = sr.length - 1, Ou = 1, xu = 1, mi = { +], ku = 1, Pu = an.length - 1, qu = 1, $u = 1, Pa = { bookNum: 1, chapterNum: 1, verseNum: 1 -}, Iu = (t) => { - var e; - return ((e = sr[t]) == null ? void 0 : e.chapters) ?? -1; -}, gi = (t, e) => ({ - bookNum: Math.max(Tu, Math.min(t.bookNum + e, Su)), +}, ju = (e) => { + var t; + return ((t = an[e]) == null ? void 0 : t.chapters) ?? -1; +}, qa = (e, t) => ({ + bookNum: Math.max(ku, Math.min(e.bookNum + t, Pu)), chapterNum: 1, verseNum: 1 -}), Di = (t, e) => ({ - ...t, +}), $a = (e, t) => ({ + ...e, chapterNum: Math.min( - Math.max(Ou, t.chapterNum + e), - Iu(t.bookNum) + Math.max(qu, e.chapterNum + t), + ju(e.bookNum) ), verseNum: 1 -}), vi = (t, e) => ({ - ...t, - verseNum: Math.max(xu, t.verseNum + e) +}), ja = (e, t) => ({ + ...e, + verseNum: Math.max($u, e.verseNum + t) }); -async function bi(t, e, r) { - const u = j.bookNumberToId(t); - if (!ar(Intl.getCanonicalLocales(e)[0], "zh")) +async function Ua(e, t, r) { + const n = W.bookNumberToId(e); + if (!on(Intl.getCanonicalLocales(t)[0], "zh")) return r({ - localizeKey: `LocalizedId.${u}`, - languagesToSearch: [e] + localizeKey: `LocalizedId.${n}`, + languagesToSearch: [t] }); - const n = await r({ - localizeKey: `Book.${u}`, - languagesToSearch: [e] - }), i = wt(n, "-"); - return wt(i[0], "ÿ08")[0].trim(); + const u = await r({ + localizeKey: `Book.${n}`, + languagesToSearch: [t] + }), i = gr(u, "-"); + return gr(i[0], "ÿ08")[0].trim(); } -function Ct(t) { - return new ur(t.bookNum, t.chapterNum, t.verseNum).BBBCCCVVV; +function Dr(e) { + return new Jt(e.bookNum, e.chapterNum, e.verseNum).BBBCCCVVV; } -function Ei(t, e) { - return Ct(t) - Ct(e); +function Va(e, t) { + return Dr(e) - Dr(t); } -function Fu(t) { - return `%scrollGroup_${t}%`; +function Uu(e) { + return `%scrollGroup_${e}%`; } -function Ai(t) { - return t.map((e) => Fu(e)); +function Ha(e) { + return e.map((t) => Uu(t)); } -function yi(t, e, r, u) { - let n; - switch (e ?? "id") { +function Ga(e, t, r, n) { + let u; + switch (t ?? "id") { case "English": - n = j.bookNumberToEnglishName(t.bookNum); + u = W.bookNumberToEnglishName(e.bookNum); break; case "id": - n = j.bookNumberToId(t.bookNum); + u = W.bookNumberToId(e.bookNum); break; default: - n = e ?? ""; + u = t ?? ""; break; } - return `${n}${u ?? " "}${t.chapterNum}${r ?? ":"}${t.verseNum}`; + return `${u}${n ?? " "}${e.chapterNum}${r ?? ":"}${e.verseNum}`; } -const Ni = (t) => (...e) => t.map((u) => u(...e)).every((u) => u), wi = (t) => async (...e) => { - const r = t.map(async (u) => u(...e)); - return (await Promise.all(r)).every((u) => u); -}, xe = "chapter", Ie = "verse"; -var ku = Object.getOwnPropertyNames, Ru = Object.getOwnPropertySymbols, qu = Object.prototype.hasOwnProperty; -function Bt(t, e) { - return function(u, n, i) { - return t(u, n, i) && e(u, n, i); +const za = (e) => (...t) => e.map((n) => n(...t)).every((n) => n), Ja = (e) => async (...t) => { + const r = e.map(async (n) => n(...t)); + return (await Promise.all(r)).every((n) => n); +}, pt = "chapter", ht = "verse"; +var Vu = Object.getOwnPropertyNames, Hu = Object.getOwnPropertySymbols, Gu = Object.prototype.hasOwnProperty; +function vr(e, t) { + return function(n, u, i) { + return e(n, u, i) && t(n, u, i); }; } -function Fe(t) { - return function(r, u, n) { - if (!r || !u || typeof r != "object" || typeof u != "object") - return t(r, u, n); - var i = n.cache, o = i.get(r), a = i.get(u); - if (o && a) - return o === u && a === r; - i.set(r, u), i.set(u, r); - var s = t(r, u, n); - return i.delete(r), i.delete(u), s; +function dt(e) { + return function(r, n, u) { + if (!r || !n || typeof r != "object" || typeof n != "object") + return e(r, n, u); + var i = u.cache, a = i.get(r), o = i.get(n); + if (a && o) + return a === n && o === r; + i.set(r, n), i.set(n, r); + var s = e(r, n, u); + return i.delete(r), i.delete(n), s; }; } -function Tt(t) { - return ku(t).concat(Ru(t)); +function Ar(e) { + return Vu(e).concat(Hu(e)); } -var cr = Object.hasOwn || function(t, e) { - return qu.call(t, e); +var sn = Object.hasOwn || function(e, t) { + return Gu.call(e, t); }; -function he(t, e) { - return t || e ? t === e : t === e || t !== t && e !== e; +function Me(e, t) { + return e || t ? e === t : e === t || e !== e && t !== t; } -var lr = "_owner", St = Object.getOwnPropertyDescriptor, Ot = Object.keys; -function $u(t, e, r) { - var u = t.length; - if (e.length !== u) +var cn = "_owner", Nr = Object.getOwnPropertyDescriptor, br = Object.keys; +function zu(e, t, r) { + var n = e.length; + if (t.length !== n) return !1; - for (; u-- > 0; ) - if (!r.equals(t[u], e[u], u, u, t, e, r)) + for (; n-- > 0; ) + if (!r.equals(e[n], t[n], n, n, e, t, r)) return !1; return !0; } -function Mu(t, e) { - return he(t.getTime(), e.getTime()); +function Ju(e, t) { + return Me(e.getTime(), t.getTime()); } -function xt(t, e, r) { - if (t.size !== e.size) +function yr(e, t, r) { + if (e.size !== t.size) return !1; - for (var u = {}, n = t.entries(), i = 0, o, a; (o = n.next()) && !o.done; ) { - for (var s = e.entries(), l = !1, c = 0; (a = s.next()) && !a.done; ) { - var f = o.value, p = f[0], h = f[1], g = a.value, v = g[0], b = g[1]; - !l && !u[c] && (l = r.equals(p, v, i, c, t, e, r) && r.equals(h, b, p, v, t, e, r)) && (u[c] = !0), c++; + for (var n = {}, u = e.entries(), i = 0, a, o; (a = u.next()) && !a.done; ) { + for (var s = t.entries(), c = !1, l = 0; (o = s.next()) && !o.done; ) { + var f = a.value, p = f[0], m = f[1], b = o.value, T = b[0], w = b[1]; + !c && !n[l] && (c = r.equals(p, T, i, l, e, t, r) && r.equals(m, w, p, T, e, t, r)) && (n[l] = !0), l++; } - if (!l) + if (!c) return !1; i++; } return !0; } -function Pu(t, e, r) { - var u = Ot(t), n = u.length; - if (Ot(e).length !== n) +function Xu(e, t, r) { + var n = br(e), u = n.length; + if (br(t).length !== u) return !1; - for (var i; n-- > 0; ) - if (i = u[n], i === lr && (t.$$typeof || e.$$typeof) && t.$$typeof !== e.$$typeof || !cr(e, i) || !r.equals(t[i], e[i], i, i, t, e, r)) + for (var i; u-- > 0; ) + if (i = n[u], i === cn && (e.$$typeof || t.$$typeof) && e.$$typeof !== t.$$typeof || !sn(t, i) || !r.equals(e[i], t[i], i, i, e, t, r)) return !1; return !0; } -function ge(t, e, r) { - var u = Tt(t), n = u.length; - if (Tt(e).length !== n) +function Ue(e, t, r) { + var n = Ar(e), u = n.length; + if (Ar(t).length !== u) return !1; - for (var i, o, a; n-- > 0; ) - if (i = u[n], i === lr && (t.$$typeof || e.$$typeof) && t.$$typeof !== e.$$typeof || !cr(e, i) || !r.equals(t[i], e[i], i, i, t, e, r) || (o = St(t, i), a = St(e, i), (o || a) && (!o || !a || o.configurable !== a.configurable || o.enumerable !== a.enumerable || o.writable !== a.writable))) + for (var i, a, o; u-- > 0; ) + if (i = n[u], i === cn && (e.$$typeof || t.$$typeof) && e.$$typeof !== t.$$typeof || !sn(t, i) || !r.equals(e[i], t[i], i, i, e, t, r) || (a = Nr(e, i), o = Nr(t, i), (a || o) && (!a || !o || a.configurable !== o.configurable || a.enumerable !== o.enumerable || a.writable !== o.writable))) return !1; return !0; } -function ju(t, e) { - return he(t.valueOf(), e.valueOf()); +function Yu(e, t) { + return Me(e.valueOf(), t.valueOf()); } -function _u(t, e) { - return t.source === e.source && t.flags === e.flags; +function Ku(e, t) { + return e.source === t.source && e.flags === t.flags; } -function It(t, e, r) { - if (t.size !== e.size) +function Cr(e, t, r) { + if (e.size !== t.size) return !1; - for (var u = {}, n = t.values(), i, o; (i = n.next()) && !i.done; ) { - for (var a = e.values(), s = !1, l = 0; (o = a.next()) && !o.done; ) - !s && !u[l] && (s = r.equals(i.value, o.value, i.value, o.value, t, e, r)) && (u[l] = !0), l++; + for (var n = {}, u = e.values(), i, a; (i = u.next()) && !i.done; ) { + for (var o = t.values(), s = !1, c = 0; (a = o.next()) && !a.done; ) + !s && !n[c] && (s = r.equals(i.value, a.value, i.value, a.value, e, t, r)) && (n[c] = !0), c++; if (!s) return !1; } return !0; } -function Lu(t, e) { - var r = t.length; - if (e.length !== r) +function Wu(e, t) { + var r = e.length; + if (t.length !== r) return !1; for (; r-- > 0; ) - if (t[r] !== e[r]) + if (e[r] !== t[r]) return !1; return !0; } -var Vu = "[object Arguments]", Uu = "[object Boolean]", zu = "[object Date]", Gu = "[object Map]", Ju = "[object Number]", Hu = "[object Object]", Xu = "[object RegExp]", Ku = "[object Set]", Wu = "[object String]", Yu = Array.isArray, Ft = typeof ArrayBuffer == "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null, kt = Object.assign, Zu = Object.prototype.toString.call.bind(Object.prototype.toString); -function Qu(t) { - var e = t.areArraysEqual, r = t.areDatesEqual, u = t.areMapsEqual, n = t.areObjectsEqual, i = t.arePrimitiveWrappersEqual, o = t.areRegExpsEqual, a = t.areSetsEqual, s = t.areTypedArraysEqual; - return function(c, f, p) { - if (c === f) +var Qu = "[object Arguments]", Zu = "[object Boolean]", ei = "[object Date]", ti = "[object Map]", ri = "[object Number]", ni = "[object Object]", ui = "[object RegExp]", ii = "[object Set]", oi = "[object String]", ai = Array.isArray, Tr = typeof ArrayBuffer == "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null, wr = Object.assign, si = Object.prototype.toString.call.bind(Object.prototype.toString); +function ci(e) { + var t = e.areArraysEqual, r = e.areDatesEqual, n = e.areMapsEqual, u = e.areObjectsEqual, i = e.arePrimitiveWrappersEqual, a = e.areRegExpsEqual, o = e.areSetsEqual, s = e.areTypedArraysEqual; + return function(l, f, p) { + if (l === f) return !0; - if (c == null || f == null || typeof c != "object" || typeof f != "object") - return c !== c && f !== f; - var h = c.constructor; - if (h !== f.constructor) + if (l == null || f == null || typeof l != "object" || typeof f != "object") + return l !== l && f !== f; + var m = l.constructor; + if (m !== f.constructor) return !1; - if (h === Object) - return n(c, f, p); - if (Yu(c)) - return e(c, f, p); - if (Ft != null && Ft(c)) - return s(c, f, p); - if (h === Date) - return r(c, f, p); - if (h === RegExp) - return o(c, f, p); - if (h === Map) - return u(c, f, p); - if (h === Set) - return a(c, f, p); - var g = Zu(c); - return g === zu ? r(c, f, p) : g === Xu ? o(c, f, p) : g === Gu ? u(c, f, p) : g === Ku ? a(c, f, p) : g === Hu ? typeof c.then != "function" && typeof f.then != "function" && n(c, f, p) : g === Vu ? n(c, f, p) : g === Uu || g === Ju || g === Wu ? i(c, f, p) : !1; + if (m === Object) + return u(l, f, p); + if (ai(l)) + return t(l, f, p); + if (Tr != null && Tr(l)) + return s(l, f, p); + if (m === Date) + return r(l, f, p); + if (m === RegExp) + return a(l, f, p); + if (m === Map) + return n(l, f, p); + if (m === Set) + return o(l, f, p); + var b = si(l); + return b === ei ? r(l, f, p) : b === ui ? a(l, f, p) : b === ti ? n(l, f, p) : b === ii ? o(l, f, p) : b === ni ? typeof l.then != "function" && typeof f.then != "function" && u(l, f, p) : b === Qu ? u(l, f, p) : b === Zu || b === ri || b === oi ? i(l, f, p) : !1; }; } -function en(t) { - var e = t.circular, r = t.createCustomConfig, u = t.strict, n = { - areArraysEqual: u ? ge : $u, - areDatesEqual: Mu, - areMapsEqual: u ? Bt(xt, ge) : xt, - areObjectsEqual: u ? ge : Pu, - arePrimitiveWrappersEqual: ju, - areRegExpsEqual: _u, - areSetsEqual: u ? Bt(It, ge) : It, - areTypedArraysEqual: u ? ge : Lu +function li(e) { + var t = e.circular, r = e.createCustomConfig, n = e.strict, u = { + areArraysEqual: n ? Ue : zu, + areDatesEqual: Ju, + areMapsEqual: n ? vr(yr, Ue) : yr, + areObjectsEqual: n ? Ue : Xu, + arePrimitiveWrappersEqual: Yu, + areRegExpsEqual: Ku, + areSetsEqual: n ? vr(Cr, Ue) : Cr, + areTypedArraysEqual: n ? Ue : Wu }; - if (r && (n = kt({}, n, r(n))), e) { - var i = Fe(n.areArraysEqual), o = Fe(n.areMapsEqual), a = Fe(n.areObjectsEqual), s = Fe(n.areSetsEqual); - n = kt({}, n, { + if (r && (u = wr({}, u, r(u))), t) { + var i = dt(u.areArraysEqual), a = dt(u.areMapsEqual), o = dt(u.areObjectsEqual), s = dt(u.areSetsEqual); + u = wr({}, u, { areArraysEqual: i, - areMapsEqual: o, - areObjectsEqual: a, + areMapsEqual: a, + areObjectsEqual: o, areSetsEqual: s }); } - return n; + return u; } -function tn(t) { - return function(e, r, u, n, i, o, a) { - return t(e, r, a); +function fi(e) { + return function(t, r, n, u, i, a, o) { + return e(t, r, o); }; } -function rn(t) { - var e = t.circular, r = t.comparator, u = t.createState, n = t.equals, i = t.strict; - if (u) - return function(s, l) { - var c = u(), f = c.cache, p = f === void 0 ? e ? /* @__PURE__ */ new WeakMap() : void 0 : f, h = c.meta; - return r(s, l, { +function pi(e) { + var t = e.circular, r = e.comparator, n = e.createState, u = e.equals, i = e.strict; + if (n) + return function(s, c) { + var l = n(), f = l.cache, p = f === void 0 ? t ? /* @__PURE__ */ new WeakMap() : void 0 : f, m = l.meta; + return r(s, c, { cache: p, - equals: n, - meta: h, + equals: u, + meta: m, strict: i }); }; - if (e) - return function(s, l) { - return r(s, l, { + if (t) + return function(s, c) { + return r(s, c, { cache: /* @__PURE__ */ new WeakMap(), - equals: n, + equals: u, meta: void 0, strict: i }); }; - var o = { + var a = { cache: void 0, - equals: n, + equals: u, meta: void 0, strict: i }; - return function(s, l) { - return r(s, l, o); + return function(s, c) { + return r(s, c, a); }; } -var un = K(); -K({ strict: !0 }); -K({ circular: !0 }); -K({ +var hi = fe(); +fe({ strict: !0 }); +fe({ circular: !0 }); +fe({ circular: !0, strict: !0 }); -K({ +fe({ createInternalComparator: function() { - return he; + return Me; } }); -K({ +fe({ strict: !0, createInternalComparator: function() { - return he; + return Me; } }); -K({ +fe({ circular: !0, createInternalComparator: function() { - return he; + return Me; } }); -K({ +fe({ circular: !0, createInternalComparator: function() { - return he; + return Me; }, strict: !0 }); -function K(t) { - t === void 0 && (t = {}); - var e = t.circular, r = e === void 0 ? !1 : e, u = t.createInternalComparator, n = t.createState, i = t.strict, o = i === void 0 ? !1 : i, a = en(t), s = Qu(a), l = u ? u(s) : tn(s); - return rn({ circular: r, comparator: s, createState: n, equals: l, strict: o }); -} -function nn(t, e) { - return un(t, e); -} -function on(t, e) { - if (typeof t != typeof e) return !1; - if (!t && !e) return !0; - if (Array.isArray(t)) { - const i = e, o = t; - return i.length === 0 ? !0 : i.every((a) => o.includes(a)); - } - if (typeof t != "object") - return nn(t, e); - const r = e, u = t; - let n = !0; +function fe(e) { + e === void 0 && (e = {}); + var t = e.circular, r = t === void 0 ? !1 : t, n = e.createInternalComparator, u = e.createState, i = e.strict, a = i === void 0 ? !1 : i, o = li(e), s = ci(o), c = n ? n(s) : fi(s); + return pi({ circular: r, comparator: s, createState: u, equals: c, strict: a }); +} +function di(e, t) { + return hi(e, t); +} +function mi(e, t) { + if (typeof e != typeof t) return !1; + if (!e && !t) return !0; + if (Array.isArray(e)) { + const i = t, a = e; + return i.length === 0 ? !0 : i.every((o) => a.includes(o)); + } + if (typeof e != "object") + return di(e, t); + const r = t, n = e; + let u = !0; return Object.keys(r).forEach((i) => { - n && (Object.hasOwn(u, i) && on(u[i], r[i]) || (n = !1)); - }), n; + u && (Object.hasOwn(n, i) && mi(n[i], r[i]) || (u = !1)); + }), u; } -function Rt(t, e, r) { - return JSON.stringify(t, (n, i) => { - let o = i; - return e && (o = e(n, o)), o === void 0 && (o = null), o; +function Sr(e, t, r) { + return JSON.stringify(e, (u, i) => { + let a = i; + return t && (a = t(u, a)), a === void 0 && (a = null), a; }, r); } -function an(t, e) { - function r(n) { - return Object.keys(n).forEach((i) => { - n[i] === null ? n[i] = void 0 : typeof n[i] == "object" && (n[i] = r(n[i])); - }), n; +function Ei(e, t) { + function r(a) { + return Object.keys(a).forEach((o) => { + a[o] === null ? a[o] = void 0 : typeof a[o] == "object" && (a[o] = r(a[o])); + }), a; + } + function n(a, o) { + if (o && typeof o == "object" && "book" in o && typeof o.book == "string" && "chapterNum" in o && typeof o.chapterNum == "number" && "verseNum" in o && typeof o.verseNum == "number" && Object.keys(o).every( + (s) => ["book", "chapterNum", "verseNum", "verse", "versificationStr"].includes(s) + )) { + const s = o.chapterNum.toString(10), c = "verse" in o && typeof o.verse == "string" ? o.verse : o.verseNum.toString(10), l = "versificationStr" in o && typeof o.versificationStr == "string" ? new oe(o.versificationStr) : void 0; + return new Jt(o.book, s, c, l); + } + return o; + } + function u(a, o) { + return n( + a, + t ? t.call(this, a, o) : o + ); } - const u = JSON.parse(t, e); - if (u !== null) - return typeof u == "object" ? r(u) : u; + const i = JSON.parse(e, u); + if (i !== null) + return typeof i == "object" ? r(i) : i; } -function Ci(t) { +function Xa(e) { try { - const e = Rt(t); - return e === Rt(an(e)); + const t = Sr(e); + return t === Sr(Ei(t)); } catch { return !1; } } -const Bi = (t) => t.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/\//g, "/"); -function Ti() { - return typeof navigator < "u" && navigator.languages ? navigator.languages[0] : new zr().resolvedOptions().locale; +const Ya = (e) => e.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/\//g, "/"); +function Ka() { + return typeof navigator < "u" && navigator.languages ? navigator.languages[0] : new eu().resolvedOptions().locale; } -function Si(t, e = 2) { - if (t === 0) return "0 Bytes"; - const r = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], u = Math.floor(Math.log(t) / Math.log(1024)), n = r[u]; - return `${new Zr("en", { +function Wa(e, t = 2) { + if (e === 0) return "0 Bytes"; + const r = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], n = Math.floor(Math.log(e) / Math.log(1024)), u = r[n]; + return `${new su("en", { style: "decimal", - maximumFractionDigits: e, + maximumFractionDigits: t, minimumFractionDigits: 0 - }).format(t / 1024 ** u)} ${n}`; + }).format(e / 1024 ** n)} ${u}`; } -const rt = { +const Yt = { projectSettingsContribution: { description: "The data an extension provides to inform Platform.Bible of the project settings it provides", anyOf: [ @@ -2365,19 +2380,19 @@ const rt = { tsType: "Id" } }; -function ut(t) { - t && Object.values(t).forEach((e) => { - if (e.type) { - if ("tsType" in e && delete e.tsType, e.type === "any") { - delete e.type; +function Kt(e) { + e && Object.values(e).forEach((t) => { + if (t.type) { + if ("tsType" in t && delete t.tsType, t.type === "any") { + delete t.type; return; } - e.type === "object" && ut(e.properties); + t.type === "object" && Kt(t.properties); } }); } -ut(rt); -const sn = { +Kt(Yt); +const gi = { $schema: "https://json-schema.org/draft/2020-12/schema", title: "Project Settings Contribution", description: "The data an extension provides to inform Platform.Bible of the project settings it provides", @@ -2392,10 +2407,10 @@ const sn = { } } ], - $defs: rt + $defs: Yt }; -Object.freeze(sn); -const cn = { +Object.freeze(gi); +const Di = { $schema: "https://json-schema.org/draft/2020-12/schema", title: "Settings Contribution", description: "The data an extension provides to inform Platform.Bible of the settings it provides", @@ -2410,10 +2425,10 @@ const cn = { } } ], - $defs: rt + $defs: Yt }; -Object.freeze(cn); -const fr = { +Object.freeze(Di); +const ln = { languageStrings: { description: "Map whose keys are localized string keys and whose values provide information about how to localize strings for the localized string key", type: "object", @@ -2461,8 +2476,8 @@ const fr = { tsType: "LocalizeKey" } }; -ut(fr); -const ln = { +Kt(ln); +const vi = { $schema: "https://json-schema.org/draft/2020-12/schema", title: "Localized String Data Contribution", description: "The data an extension provides to inform Platform.Bible of the localized strings it provides.", @@ -2478,10 +2493,10 @@ const ln = { } } }, - $defs: fr + $defs: ln }; -Object.freeze(ln); -const fn = { +Object.freeze(vi); +const Ai = { title: "Platform.Bible menus", type: "object", properties: { @@ -2727,56 +2742,115 @@ const fn = { } } }; -Object.freeze(fn); -var W = {}, H = {}; -function pn(t, e, r) { - if (r === void 0 && (r = Array.prototype), t && typeof r.find == "function") - return r.find.call(t, e); - for (var u = 0; u < t.length; u++) - if (Object.prototype.hasOwnProperty.call(t, u)) { - var n = t[u]; - if (e.call(void 0, n, u, t)) - return n; +Object.freeze(Ai); +var x = {}; +function Ni(e, t, r) { + if (r === void 0 && (r = Array.prototype), e && typeof r.find == "function") + return r.find.call(e, t); + for (var n = 0; n < e.length; n++) + if (ve(e, n)) { + var u = e[n]; + if (t.call(void 0, u, n, e)) + return u; } } -function nt(t, e) { - return e === void 0 && (e = Object), e && typeof e.freeze == "function" ? e.freeze(t) : t; +function _e(e, t) { + return t === void 0 && (t = Object), t && typeof t.getOwnPropertyDescriptors == "function" && (e = t.create(null, t.getOwnPropertyDescriptors(e))), t && typeof t.freeze == "function" ? t.freeze(e) : e; } -function hn(t, e) { - if (t === null || typeof t != "object") +function ve(e, t) { + return Object.prototype.hasOwnProperty.call(e, t); +} +function bi(e, t) { + if (e === null || typeof e != "object") throw new TypeError("target is not an object"); - for (var r in e) - Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); - return t; + for (var r in t) + ve(t, r) && (e[r] = t[r]); + return e; +} +var fn = _e({ + allowfullscreen: !0, + async: !0, + autofocus: !0, + autoplay: !0, + checked: !0, + controls: !0, + default: !0, + defer: !0, + disabled: !0, + formnovalidate: !0, + hidden: !0, + ismap: !0, + itemscope: !0, + loop: !0, + multiple: !0, + muted: !0, + nomodule: !0, + novalidate: !0, + open: !0, + playsinline: !0, + readonly: !0, + required: !0, + reversed: !0, + selected: !0 +}); +function yi(e) { + return ve(fn, e.toLowerCase()); +} +var pn = _e({ + area: !0, + base: !0, + br: !0, + col: !0, + embed: !0, + hr: !0, + img: !0, + input: !0, + link: !0, + meta: !0, + param: !0, + source: !0, + track: !0, + wbr: !0 +}); +function Ci(e) { + return ve(pn, e.toLowerCase()); +} +var Ke = _e({ + script: !1, + style: !1, + textarea: !0, + title: !0 +}); +function Ti(e) { + var t = e.toLowerCase(); + return ve(Ke, t) && !Ke[t]; +} +function wi(e) { + var t = e.toLowerCase(); + return ve(Ke, t) && Ke[t]; +} +function hn(e) { + return e === We.HTML; +} +function Si(e) { + return hn(e) || e === We.XML_XHTML_APPLICATION; } -var pr = nt({ +var We = _e({ /** * `text/html`, the only mime type that triggers treating an XML document as HTML. * - * @see DOMParser.SupportedType.isHTML * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration * @see https://en.wikipedia.org/wiki/HTML Wikipedia * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN - * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec + * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring + * WHATWG HTML Spec */ HTML: "text/html", - /** - * Helper method to check a mime type if it indicates an HTML document - * - * @param {string} [value] - * @returns {boolean} - * - * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration - * @see https://en.wikipedia.org/wiki/HTML Wikipedia - * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN - * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */ - isHTML: function(t) { - return t === pr.HTML; - }, /** * `application/xml`, the standard mime type for XML documents. * - * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration + * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType + * registration * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303 * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia */ @@ -2793,7 +2867,8 @@ var pr = nt({ * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace, * but is parsed as an XML document. * - * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration + * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType + * registration * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec * @see https://en.wikipedia.org/wiki/XHTML Wikipedia */ @@ -2806,23 +2881,19 @@ var pr = nt({ * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia */ XML_SVG_IMAGE: "image/svg+xml" -}), hr = nt({ +}), Oi = Object.keys(We).map(function(e) { + return We[e]; +}); +function Ii(e) { + return Oi.indexOf(e) > -1; +} +var Bi = _e({ /** * The XHTML namespace. * * @see http://www.w3.org/1999/xhtml */ HTML: "http://www.w3.org/1999/xhtml", - /** - * Checks if `uri` equals `NAMESPACE.HTML`. - * - * @param {string} [uri] - * - * @see NAMESPACE.HTML - */ - isHTML: function(t) { - return t === hr.HTML; - }, /** * The SVG namespace. * @@ -2836,1036 +2907,2102 @@ var pr = nt({ */ XML: "http://www.w3.org/XML/1998/namespace", /** - * The `xmlns:` namespace + * The `xmlns:` namespace. * * @see https://www.w3.org/2000/xmlns/ */ XMLNS: "http://www.w3.org/2000/xmlns/" }); -H.assign = hn; -H.find = pn; -H.freeze = nt; -H.MIME_TYPE = pr; -H.NAMESPACE = hr; -var dr = H, L = dr.find, ye = dr.NAMESPACE; -function dn(t) { - return t !== ""; -} -function mn(t) { - return t ? t.split(/[\t\n\f\r ]+/).filter(dn) : []; -} -function gn(t, e) { - return t.hasOwnProperty(e) || (t[e] = !0), t; -} -function qt(t) { - if (!t) return []; - var e = mn(t); - return Object.keys(e.reduce(gn, {})); -} -function Dn(t) { - return function(e) { - return t && t.indexOf(e) !== -1; +x.assign = bi; +x.find = Ni; +x.freeze = _e; +x.HTML_BOOLEAN_ATTRIBUTES = fn; +x.HTML_RAW_TEXT_ELEMENTS = Ke; +x.HTML_VOID_ELEMENTS = pn; +x.hasDefaultHTMLNamespace = Si; +x.hasOwn = ve; +x.isHTMLBooleanAttribute = yi; +x.isHTMLRawTextElement = Ti; +x.isHTMLEscapableRawTextElement = wi; +x.isHTMLMimeType = hn; +x.isHTMLVoidElement = Ci; +x.isValidMimeType = Ii; +x.MIME_TYPE = We; +x.NAMESPACE = Bi; +var Ae = {}, xi = x; +function dn(e, t) { + e.prototype = Object.create(Error.prototype, { + constructor: { value: e }, + name: { value: e.name, enumerable: !0, writable: t } + }); +} +var Qe = xi.freeze({ + /** + * the default value as defined by the spec + */ + Error: "Error", + /** + * @deprecated + * Use RangeError instead. + */ + IndexSizeError: "IndexSizeError", + /** + * @deprecated + * Just to match the related static code, not part of the spec. + */ + DomstringSizeError: "DomstringSizeError", + HierarchyRequestError: "HierarchyRequestError", + WrongDocumentError: "WrongDocumentError", + InvalidCharacterError: "InvalidCharacterError", + /** + * @deprecated + * Just to match the related static code, not part of the spec. + */ + NoDataAllowedError: "NoDataAllowedError", + NoModificationAllowedError: "NoModificationAllowedError", + NotFoundError: "NotFoundError", + NotSupportedError: "NotSupportedError", + InUseAttributeError: "InUseAttributeError", + InvalidStateError: "InvalidStateError", + SyntaxError: "SyntaxError", + InvalidModificationError: "InvalidModificationError", + NamespaceError: "NamespaceError", + /** + * @deprecated + * Use TypeError for invalid arguments, + * "NotSupportedError" DOMException for unsupported operations, + * and "NotAllowedError" DOMException for denied requests instead. + */ + InvalidAccessError: "InvalidAccessError", + /** + * @deprecated + * Just to match the related static code, not part of the spec. + */ + ValidationError: "ValidationError", + /** + * @deprecated + * Use TypeError instead. + */ + TypeMismatchError: "TypeMismatchError", + SecurityError: "SecurityError", + NetworkError: "NetworkError", + AbortError: "AbortError", + /** + * @deprecated + * Just to match the related static code, not part of the spec. + */ + URLMismatchError: "URLMismatchError", + QuotaExceededError: "QuotaExceededError", + TimeoutError: "TimeoutError", + InvalidNodeTypeError: "InvalidNodeTypeError", + DataCloneError: "DataCloneError", + EncodingError: "EncodingError", + NotReadableError: "NotReadableError", + UnknownError: "UnknownError", + ConstraintError: "ConstraintError", + DataError: "DataError", + TransactionInactiveError: "TransactionInactiveError", + ReadOnlyError: "ReadOnlyError", + VersionError: "VersionError", + OperationError: "OperationError", + NotAllowedError: "NotAllowedError", + OptOutError: "OptOutError" +}), mn = Object.keys(Qe); +function En(e) { + return typeof e == "number" && e >= 1 && e <= 25; +} +function Ri(e) { + return typeof e == "string" && e.substring(e.length - Qe.Error.length) === Qe.Error; +} +function it(e, t) { + En(e) ? (this.name = mn[e], this.message = t || "") : (this.message = e, this.name = Ri(t) ? t : Qe.Error), Error.captureStackTrace && Error.captureStackTrace(this, it); +} +dn(it, !0); +Object.defineProperties(it.prototype, { + code: { + enumerable: !0, + get: function() { + var e = mn.indexOf(this.name); + return En(e) ? e : 0; + } + } +}); +var gn = { + INDEX_SIZE_ERR: 1, + DOMSTRING_SIZE_ERR: 2, + HIERARCHY_REQUEST_ERR: 3, + WRONG_DOCUMENT_ERR: 4, + INVALID_CHARACTER_ERR: 5, + NO_DATA_ALLOWED_ERR: 6, + NO_MODIFICATION_ALLOWED_ERR: 7, + NOT_FOUND_ERR: 8, + NOT_SUPPORTED_ERR: 9, + INUSE_ATTRIBUTE_ERR: 10, + INVALID_STATE_ERR: 11, + SYNTAX_ERR: 12, + INVALID_MODIFICATION_ERR: 13, + NAMESPACE_ERR: 14, + INVALID_ACCESS_ERR: 15, + VALIDATION_ERR: 16, + TYPE_MISMATCH_ERR: 17, + SECURITY_ERR: 18, + NETWORK_ERR: 19, + ABORT_ERR: 20, + URL_MISMATCH_ERR: 21, + QUOTA_EXCEEDED_ERR: 22, + TIMEOUT_ERR: 23, + INVALID_NODE_TYPE_ERR: 24, + DATA_CLONE_ERR: 25 +}, Pt = Object.entries(gn); +for (var mt = 0; mt < Pt.length; mt++) { + var Mi = Pt[mt][0]; + it[Mi] = Pt[mt][1]; +} +function Wt(e, t) { + this.message = e, this.locator = t, Error.captureStackTrace && Error.captureStackTrace(this, Wt); +} +dn(Wt); +Ae.DOMException = it; +Ae.DOMExceptionName = Qe; +Ae.ExceptionCode = gn; +Ae.ParseError = Wt; +var R = {}, E = {}; +function Dn(e) { + try { + typeof e != "function" && (e = RegExp); + var t = new e("𝌆", "u").exec("𝌆"); + return !!t && t[0].length === 2; + } catch { + } + return !1; +} +var ot = Dn(); +function me(e) { + if (e.source[0] !== "[") + throw new Error(e + " can not be used with chars"); + return e.source.slice(1, e.source.lastIndexOf("]")); +} +function Oe(e, t) { + if (e.source[0] !== "[") + throw new Error("/" + e.source + "/ can not be used with chars_without"); + if (!t || typeof t != "string") + throw new Error(JSON.stringify(t) + " is not a valid search"); + if (e.source.indexOf(t) === -1) + throw new Error('"' + t + '" is not is /' + e.source + "/"); + if (t === "-" && e.source.indexOf(t) !== 1) + throw new Error('"' + t + '" is not at the first postion of /' + e.source + "/"); + return new RegExp(e.source.replace(t, ""), ot ? "u" : ""); +} +function g(e) { + var t = this; + return new RegExp( + Array.prototype.slice.call(arguments).map(function(r) { + var n = typeof r == "string"; + if (n && t === void 0 && r === "|") + throw new Error("use regg instead of reg to wrap expressions with `|`!"); + return n ? r : r.source; + }).join(""), + ot ? "mu" : "m" + ); +} +function d(e) { + if (arguments.length === 0) + throw new Error("no parameters provided"); + return g.apply(d, ["(?:"].concat(Array.prototype.slice.call(arguments), [")"])); +} +var _i = "�", Ee = /[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/; +ot && (Ee = g("[", me(Ee), "\\u{10000}-\\u{10FFFF}", "]")); +var Qt = /[\x20\x09\x0D\x0A]/, Fi = me(Qt), C = g(Qt, "+"), O = g(Qt, "*"), Ze = /[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/; +ot && (Ze = g("[", me(Ze), "\\u{10000}-\\u{10FFFF}", "]")); +var Li = me(Ze), Zt = g("[", Li, me(/[-.0-9\xB7]/), me(/[\u0300-\u036F\u203F-\u2040]/), "]"), X = g(Ze, Zt, "*"), Or = g(Zt, "+"), ki = g("&", X, ";"), Pi = d(/&#[0-9]+;|&#x[0-9a-fA-F]+;/), et = d(ki, "|", Pi), tt = g("%", X, ";"), er = d( + g('"', d(/[^%&"]/, "|", tt, "|", et), "*", '"'), + "|", + g("'", d(/[^%&']/, "|", tt, "|", et), "*", "'") +), qi = d('"', d(/[^<&"]/, "|", et), "*", '"', "|", "'", d(/[^<&']/, "|", et), "*", "'"), $i = Oe(Ze, ":"), ji = Oe(Zt, ":"), Ir = g($i, ji, "*"), at = g(Ir, d(":", Ir), "?"), Ui = g("^", at, "$"), Vi = g("(", at, ")"), rt = d(/"[^"]*"|'[^']*'/), Hi = g(/^<\?/, "(", X, ")", d(C, "(", Ee, "*?)"), "?", /\?>/), Br = /[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/, yt = d('"', Br, '*"', "|", "'", Oe(Br, "'"), "*'"), vn = "", Gi = g(vn, d(Oe(Ee, "-"), "|", g("-", Oe(Ee, "-"))), "*", An), xr = "#PCDATA", zi = d( + g(/\(/, O, xr, d(O, /\|/, O, at), "*", O, /\)\*/), + "|", + g(/\(/, O, xr, O, /\)/) +), Ji = /[?*+]?/, Xi = g( + /\([^>]+\)/, + Ji + /*regg(choice, '|', seq), _children_quantity*/ +), Yi = d("EMPTY", "|", "ANY", "|", zi, "|", Xi), Ki = ""), Qi = g("NOTATION", C, /\(/, O, X, d(O, /\|/, O, X), "*", O, /\)/), Zi = g(/\(/, O, Or, d(O, /\|/, O, Or), "*", O, /\)/), eo = d(Qi, "|", Zi), to = d(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/, "|", eo), ro = d(/#REQUIRED|#IMPLIED/, "|", d(d("#FIXED", C), "?", qi)), no = d(C, X, C, to, C, ro), uo = ""), tr = "SYSTEM", Ct = "PUBLIC", Tt = d(d(tr, C, rt), "|", d(Ct, C, yt, C, rt)), oo = g( + "^", + d( + d(tr, C, "(?", rt, ")"), + "|", + d(Ct, C, "(?", yt, ")", C, "(?", rt, ")") + ) +), ao = d(C, "NDATA", C, X), so = d(er, "|", d(Tt, ao, "?")), Nn = ""), lo = d(er, "|", Tt), fo = g(Nn, C, "%", C, X, C, lo, O, ">"), po = d(co, "|", fo), ho = g(Ct, C, yt), mo = g(""), rr = g(O, "=", O), Rr = /1[.]\d+/, Eo = g(C, "version", rr, d("'", Rr, "'", "|", '"', Rr, '"')), Mr = /[A-Za-z][-A-Za-z0-9._]*/, go = d(C, "encoding", rr, d('"', Mr, '"', "|", "'", Mr, "'")), Do = d(C, "standalone", rr, d("'", d("yes", "|", "no"), "'", "|", '"', d("yes", "|", "no"), '"')), vo = g(/^<\?xml/, Eo, go, "?", Do, "?", O, /\?>/), Ao = "", yo = //, To = g(Ee, "*?", Co), wo = g(yo, To); +E.chars = me; +E.chars_without = Oe; +E.detectUnicodeSupport = Dn; +E.reg = g; +E.regg = d; +E.AttlistDecl = io; +E.CDATA_START = No; +E.CDATA_END = bo; +E.CDSect = wo; +E.Char = Ee; +E.Comment = Gi; +E.COMMENT_START = vn; +E.COMMENT_END = An; +E.DOCTYPE_DECL_START = Ao; +E.elementdecl = Wi; +E.EntityDecl = po; +E.EntityValue = er; +E.ExternalID = Tt; +E.ExternalID_match = oo; +E.Name = X; +E.NotationDecl = mo; +E.Reference = et; +E.PEReference = tt; +E.PI = Hi; +E.PUBLIC = Ct; +E.PubidLiteral = yt; +E.QName = at; +E.QName_exact = Ui; +E.QName_group = Vi; +E.S = C; +E.SChar_s = Fi; +E.S_OPT = O; +E.SYSTEM = tr; +E.SystemLiteral = rt; +E.UNICODE_REPLACEMENT_CHARACTER = _i; +E.UNICODE_SUPPORT = ot; +E.XMLDecl = vo; +var J = x, ee = J.find, So = J.hasDefaultHTMLNamespace, Ie = J.hasOwn, Oo = J.isHTMLMimeType, Io = J.isHTMLRawTextElement, Bo = J.isHTMLVoidElement, ze = J.MIME_TYPE, te = J.NAMESPACE, P = Symbol(), bn = Ae, h = bn.DOMException, xo = bn.DOMExceptionName, Q = E; +function q(e) { + if (e !== P) + throw new TypeError("Illegal constructor"); +} +function Ro(e) { + return e !== ""; +} +function Mo(e) { + return e ? e.split(/[\t\n\f\r ]+/).filter(Ro) : []; +} +function _o(e, t) { + return Ie(e, t) || (e[t] = !0), e; +} +function _r(e) { + if (!e) return []; + var t = Mo(e); + return Object.keys(t.reduce(_o, {})); +} +function Fo(e) { + return function(t) { + return e && e.indexOf(t) !== -1; }; } -function Ce(t, e) { - for (var r in t) - Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]); +function yn(e) { + if (!Q.QName_exact.test(e)) + throw new h(h.INVALID_CHARACTER_ERR, 'invalid character in qualified name "' + e + '"'); +} +function Ut(e, t) { + yn(t), e = e || null; + var r = null, n = t; + if (t.indexOf(":") >= 0) { + var u = t.split(":"); + r = u[0], n = u[1]; + } + if (r !== null && e === null) + throw new h(h.NAMESPACE_ERR, "prefix is non-null and namespace is null"); + if (r === "xml" && e !== J.NAMESPACE.XML) + throw new h(h.NAMESPACE_ERR, 'prefix is "xml" and namespace is not the XML namespace'); + if ((r === "xmlns" || t === "xmlns") && e !== J.NAMESPACE.XMLNS) + throw new h( + h.NAMESPACE_ERR, + 'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace' + ); + if (e === J.NAMESPACE.XMLNS && r !== "xmlns" && t !== "xmlns") + throw new h( + h.NAMESPACE_ERR, + 'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"' + ); + return [e, r, n]; } -function k(t, e) { - var r = t.prototype; - if (!(r instanceof e)) { - let u = function() { +function Fe(e, t) { + for (var r in e) + Ie(e, r) && (t[r] = e[r]); +} +function $(e, t) { + var r = e.prototype; + if (!(r instanceof t)) { + let n = function() { }; - u.prototype = e.prototype, u = new u(), Ce(r, u), t.prototype = r = u; - } - r.constructor != t && (typeof t != "function" && console.error("unknown Class:" + t), r.constructor = t); -} -var R = {}, P = R.ELEMENT_NODE = 1, ce = R.ATTRIBUTE_NODE = 2, $e = R.TEXT_NODE = 3, mr = R.CDATA_SECTION_NODE = 4, gr = R.ENTITY_REFERENCE_NODE = 5, vn = R.ENTITY_NODE = 6, Dr = R.PROCESSING_INSTRUCTION_NODE = 7, vr = R.COMMENT_NODE = 8, br = R.DOCUMENT_NODE = 9, Er = R.DOCUMENT_TYPE_NODE = 10, G = R.DOCUMENT_FRAGMENT_NODE = 11, bn = R.NOTATION_NODE = 12, S = {}, B = {}; -S.INDEX_SIZE_ERR = (B[1] = "Index size error", 1); -S.DOMSTRING_SIZE_ERR = (B[2] = "DOMString size error", 2); -var F = S.HIERARCHY_REQUEST_ERR = (B[3] = "Hierarchy request error", 3); -S.WRONG_DOCUMENT_ERR = (B[4] = "Wrong document", 4); -S.INVALID_CHARACTER_ERR = (B[5] = "Invalid character", 5); -S.NO_DATA_ALLOWED_ERR = (B[6] = "No data allowed", 6); -S.NO_MODIFICATION_ALLOWED_ERR = (B[7] = "No modification allowed", 7); -var Ar = S.NOT_FOUND_ERR = (B[8] = "Not found", 8); -S.NOT_SUPPORTED_ERR = (B[9] = "Not supported", 9); -var $t = S.INUSE_ATTRIBUTE_ERR = (B[10] = "Attribute in use", 10); -S.INVALID_STATE_ERR = (B[11] = "Invalid state", 11); -S.SYNTAX_ERR = (B[12] = "Syntax error", 12); -S.INVALID_MODIFICATION_ERR = (B[13] = "Invalid modification", 13); -S.NAMESPACE_ERR = (B[14] = "Invalid namespace", 14); -S.INVALID_ACCESS_ERR = (B[15] = "Invalid access", 15); -function w(t, e) { - if (e instanceof Error) - var r = e; - else - r = this, Error.call(this, B[t]), this.message = B[t], Error.captureStackTrace && Error.captureStackTrace(this, w); - return r.code = t, e && (this.message = this.message + ": " + e), r; -} -w.prototype = Error.prototype; -Ce(S, w); -function z() { -} -z.prototype = { - /** - * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive. - * @standard level1 + n.prototype = t.prototype, n = new n(), Fe(r, n), e.prototype = r = n; + } + r.constructor != e && (typeof e != "function" && console.error("unknown Class:" + e), r.constructor = e); +} +var j = {}, Y = j.ELEMENT_NODE = 1, Be = j.ATTRIBUTE_NODE = 2, vt = j.TEXT_NODE = 3, Cn = j.CDATA_SECTION_NODE = 4, Tn = j.ENTITY_REFERENCE_NODE = 5, Lo = j.ENTITY_NODE = 6, wn = j.PROCESSING_INSTRUCTION_NODE = 7, Sn = j.COMMENT_NODE = 8, nt = j.DOCUMENT_NODE = 9, On = j.DOCUMENT_TYPE_NODE = 10, ae = j.DOCUMENT_FRAGMENT_NODE = 11, ko = j.NOTATION_NODE = 12, _ = J.freeze({ + DOCUMENT_POSITION_DISCONNECTED: 1, + DOCUMENT_POSITION_PRECEDING: 2, + DOCUMENT_POSITION_FOLLOWING: 4, + DOCUMENT_POSITION_CONTAINS: 8, + DOCUMENT_POSITION_CONTAINED_BY: 16, + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32 +}); +function Fr(e) { + for (var t = []; e.parentNode || e.ownerElement; ) + e = e.parentNode || e.ownerElement, t.unshift(e); + return t; +} +function In(e, t) { + if (t.length < e.length) return In(t, e); + var r = null; + for (var n in e) { + if (e[n] !== t[n]) return r; + r = e[n]; + } + return r; +} +function Lr(e) { + return e.guid || (e.guid = Math.random()), e.guid; +} +function M() { +} +M.prototype = { + /** + * The number of nodes in the list. The range of valid child node indices is 0 to length-1 + * inclusive. + * + * @type {number} */ length: 0, /** - * 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. - * @standard level1 - * @param index unsigned long - * Index into the collection. - * @return Node - * The node at the indexth position in the NodeList, or null if that is not a valid index. + * Returns the item at `index`. If index is greater than or equal to the number of nodes in + * the list, this returns null. + * + * @param index + * Unsigned long Index into the collection. + * @returns {Node | null} + * The node at position `index` in the NodeList, + * or null if that is not a valid index. */ - item: function(t) { - return t >= 0 && t < this.length ? this[t] : null; + item: function(e) { + return e >= 0 && e < this.length ? this[e] : null; }, - toString: function(t, e) { - for (var r = [], u = 0; u < this.length; u++) - ae(this[u], r, t, e); - return r.join(""); + /** + * Returns a string representation of the NodeList. + * + * @param {unknown} nodeFilter + * __A filter function? Not implemented according to the spec?__. + * @returns {string} + * A string representation of the NodeList. + */ + toString: function(e) { + for (var t = [], r = 0; r < this.length; r++) + we(this[r], t, e); + return t.join(""); }, /** - * @private - * @param {function (Node):boolean} predicate + * Filters the NodeList based on a predicate. + * + * @param {function(Node): boolean} predicate + * - A predicate function to filter the NodeList. * @returns {Node[]} + * An array of nodes that satisfy the predicate. + * @private */ - filter: function(t) { - return Array.prototype.filter.call(this, t); + filter: function(e) { + return Array.prototype.filter.call(this, e); }, /** - * @private + * Returns the first index at which a given node can be found in the NodeList, or -1 if it is + * not present. + * * @param {Node} item + * - The Node item to locate in the NodeList. * @returns {number} + * The first index of the node in the NodeList; -1 if not found. + * @private */ - indexOf: function(t) { - return Array.prototype.indexOf.call(this, t); + indexOf: function(e) { + return Array.prototype.indexOf.call(this, e); } }; -function le(t, e) { - this._node = t, this._refresh = e, it(this); +M.prototype[Symbol.iterator] = function() { + var e = this, t = 0; + return { + next: function() { + return t < e.length ? { + value: e[t++], + done: !1 + } : { + done: !0 + }; + }, + return: function() { + return { + done: !0 + }; + } + }; +}; +function he(e, t) { + this._node = e, this._refresh = t, wt(this); } -function it(t) { - var e = t._node._inc || t._node.ownerDocument._inc; - if (t._inc !== e) { - var r = t._refresh(t._node); - if (kr(t, "length", r.length), !t.$$length || r.length < t.$$length) - for (var u = r.length; u in t; u++) - Object.prototype.hasOwnProperty.call(t, u) && delete t[u]; - Ce(r, t), t._inc = e; +function wt(e) { + var t = e._node._inc || e._node.ownerDocument._inc; + if (e._inc !== t) { + var r = e._refresh(e._node); + if (jn(e, "length", r.length), !e.$$length || r.length < e.$$length) + for (var n = r.length; n in e; n++) + Ie(e, n) && delete e[n]; + Fe(r, e), e._inc = t; } } -le.prototype.item = function(t) { - return it(this), this[t] || null; +he.prototype.item = function(e) { + return wt(this), this[e] || null; }; -k(le, z); -function Me() { +$(he, M); +function xe() { } -function yr(t, e) { - for (var r = t.length; r--; ) - if (t[r] === e) +function Bn(e, t) { + for (var r = 0; r < e.length; ) { + if (e[r] === t) return r; + r++; + } +} +function Po(e, t, r, n) { + if (n ? t[Bn(t, n)] = r : (t[t.length] = r, t.length++), e) { + r.ownerElement = e; + var u = e.ownerDocument; + u && (n && Mn(u, e, n), qo(u, e, r)); + } } -function Mt(t, e, r, u) { - if (u ? e[yr(e, u)] = r : e[e.length++] = r, t) { - r.ownerElement = t; - var n = t.ownerDocument; - n && (u && Cr(n, t, u), En(n, t, r)); - } -} -function Pt(t, e, r) { - var u = yr(e, r); - if (u >= 0) { - for (var n = e.length - 1; u < n; ) - e[u] = e[++u]; - if (e.length = n, t) { - var i = t.ownerDocument; - i && (Cr(i, t, r), r.ownerElement = null); +function kr(e, t, r) { + var n = Bn(t, r); + if (n >= 0) { + for (var u = t.length - 1; n <= u; ) + t[n] = t[++n]; + if (t.length = u, e) { + var i = e.ownerDocument; + i && Mn(i, e, r), r.ownerElement = null; } - } else - throw new w(Ar, new Error(t.tagName + "@" + r)); + } } -Me.prototype = { +xe.prototype = { length: 0, - item: z.prototype.item, - getNamedItem: function(t) { - for (var e = this.length; e--; ) { - var r = this[e]; - if (r.nodeName == t) + item: M.prototype.item, + /** + * Get an attribute by name. Note: Name is in lower case in case of HTML namespace and + * document. + * + * @param {string} localName + * The local name of the attribute. + * @returns {Attr | null} + * The attribute with the given local name, or null if no such attribute exists. + * @see https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name + */ + getNamedItem: function(e) { + this._ownerElement && this._ownerElement._isInHTMLDocumentAndNamespace() && (e = e.toLowerCase()); + for (var t = 0; t < this.length; ) { + var r = this[t]; + if (r.nodeName === e) return r; + t++; } + return null; }, - setNamedItem: function(t) { - var e = t.ownerElement; - if (e && e != this._ownerElement) - throw new w($t); - var r = this.getNamedItem(t.nodeName); - return Mt(this._ownerElement, this, t, r), r; + /** + * Set an attribute. + * + * @param {Attr} attr + * The attribute to set. + * @returns {Attr | null} + * The old attribute with the same local name and namespace URI as the new one, or null if no + * such attribute exists. + * @throws {DOMException} + * With code: + * - {@link INUSE_ATTRIBUTE_ERR} - If the attribute is already an attribute of another + * element. + * @see https://dom.spec.whatwg.org/#concept-element-attributes-set + */ + setNamedItem: function(e) { + var t = e.ownerElement; + if (t && t !== this._ownerElement) + throw new h(h.INUSE_ATTRIBUTE_ERR); + var r = this.getNamedItemNS(e.namespaceURI, e.localName); + return r === e ? e : (Po(this._ownerElement, this, e, r), r); }, - /* returns Node */ - setNamedItemNS: function(t) { - var e = t.ownerElement, r; - if (e && e != this._ownerElement) - throw new w($t); - return r = this.getNamedItemNS(t.namespaceURI, t.localName), Mt(this._ownerElement, this, t, r), r; + /** + * Set an attribute, replacing an existing attribute with the same local name and namespace + * URI if one exists. + * + * @param {Attr} attr + * The attribute to set. + * @returns {Attr | null} + * The old attribute with the same local name and namespace URI as the new one, or null if no + * such attribute exists. + * @throws {DOMException} + * Throws a DOMException with the name "InUseAttributeError" if the attribute is already an + * attribute of another element. + * @see https://dom.spec.whatwg.org/#concept-element-attributes-set + */ + setNamedItemNS: function(e) { + return this.setNamedItem(e); }, - /* returns Node */ - removeNamedItem: function(t) { - var e = this.getNamedItem(t); - return Pt(this._ownerElement, this, e), e; + /** + * Removes an attribute specified by the local name. + * + * @param {string} localName + * The local name of the attribute to be removed. + * @returns {Attr} + * The attribute node that was removed. + * @throws {DOMException} + * With code: + * - {@link DOMException.NOT_FOUND_ERR} if no attribute with the given name is found. + * @see https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem + * @see https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-name + */ + removeNamedItem: function(e) { + var t = this.getNamedItem(e); + if (!t) + throw new h(h.NOT_FOUND_ERR, e); + return kr(this._ownerElement, this, t), t; }, - // raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR - //for level2 - removeNamedItemNS: function(t, e) { - var r = this.getNamedItemNS(t, e); - return Pt(this._ownerElement, this, r), r; + /** + * Removes an attribute specified by the namespace and local name. + * + * @param {string | null} namespaceURI + * The namespace URI of the attribute to be removed. + * @param {string} localName + * The local name of the attribute to be removed. + * @returns {Attr} + * The attribute node that was removed. + * @throws {DOMException} + * With code: + * - {@link DOMException.NOT_FOUND_ERR} if no attribute with the given namespace URI and local + * name is found. + * @see https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns + * @see https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-namespace + */ + removeNamedItemNS: function(e, t) { + var r = this.getNamedItemNS(e, t); + if (!r) + throw new h(h.NOT_FOUND_ERR, e ? e + " : " + t : t); + return kr(this._ownerElement, this, r), r; }, - getNamedItemNS: function(t, e) { - for (var r = this.length; r--; ) { - var u = this[r]; - if (u.localName == e && u.namespaceURI == t) - return u; + /** + * Get an attribute by namespace and local name. + * + * @param {string | null} namespaceURI + * The namespace URI of the attribute. + * @param {string} localName + * The local name of the attribute. + * @returns {Attr | null} + * The attribute with the given namespace URI and local name, or null if no such attribute + * exists. + * @see https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace + */ + getNamedItemNS: function(e, t) { + e || (e = null); + for (var r = 0; r < this.length; ) { + var n = this[r]; + if (n.localName === t && n.namespaceURI === e) + return n; + r++; } return null; } }; -function Nr() { +xe.prototype[Symbol.iterator] = function() { + var e = this, t = 0; + return { + next: function() { + return t < e.length ? { + value: e[t++], + done: !1 + } : { + done: !0 + }; + }, + return: function() { + return { + done: !0 + }; + } + }; +}; +function xn() { } -Nr.prototype = { +xn.prototype = { /** - * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported. - * The different implementations fairly diverged in what kind of features were reported. - * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use. + * Test if the DOM implementation implements a specific feature and version, as specified in + * {@link https://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures DOM Features}. * - * @deprecated It is deprecated and modern browsers return true in all cases. + * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given + * feature is supported. The different implementations fairly diverged in what kind of + * features were reported. The latest version of the spec settled to force this method to + * always return true, where the functionality was accurate and in use. * + * @deprecated + * It is deprecated and modern browsers return true in all cases. + * @function DOMImplementation#hasFeature * @param {string} feature + * The name of the feature to test. * @param {string} [version] - * @returns {boolean} always true - * + * This is the version number of the feature to test. + * @returns {boolean} + * Always returns true. * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-5CED94D7 DOM Level 3 Core */ - hasFeature: function(t, e) { + hasFeature: function(e, t) { return !0; }, /** - * Creates an XML Document object of the specified type with its document element. + * Creates a DOM Document object of the specified type with its document element. Note that + * based on the {@link DocumentType} + * given to create the document, the implementation may instantiate specialized + * {@link Document} objects that support additional features than the "Core", such as "HTML" + * {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#DOM2HTML DOM Level 2 HTML}. + * On the other hand, setting the {@link DocumentType} after the document was created makes + * this very unlikely to happen. Alternatively, specialized {@link Document} creation methods, + * such as createHTMLDocument + * {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#DOM2HTML DOM Level 2 HTML}, + * can be used to obtain specific types of {@link Document} objects. * * __It behaves slightly different from the description in the living standard__: - * - There is no interface/class `XMLDocument`, it returns a `Document` instance. - * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared. - * - this implementation is not validating names or qualified names - * (when parsing XML strings, the SAX parser takes care of that) + * - There is no interface/class `XMLDocument`, it returns a `Document` + * instance (with it's `type` set to `'xml'`). + * - `encoding`, `mode`, `origin`, `url` fields are currently not declared. * - * @param {string|null} namespaceURI - * @param {string} qualifiedName - * @param {DocumentType=null} doctype + * @function DOMImplementation.createDocument + * @param {string | null} namespaceURI + * The + * {@link https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-namespaceURI namespace URI} + * of the document element to create or null. + * @param {string | null} qualifiedName + * The + * {@link https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-qualifiedname qualified name} + * of the document element to be created or null. + * @param {DocumentType | null} [doctype=null] + * The type of document to be created or null. When doctype is not null, its + * {@link Node#ownerDocument} attribute is set to the document being created. Default is + * `null` * @returns {Document} + * A new {@link Document} object with its document element. If the NamespaceURI, + * qualifiedName, and doctype are null, the returned {@link Document} is empty with no + * document element. + * @throws {DOMException} + * With code: * + * - `INVALID_CHARACTER_ERR`: Raised if the specified qualified name is not an XML name + * according to {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#XML XML 1.0}. + * - `NAMESPACE_ERR`: Raised if the qualifiedName is malformed, if the qualifiedName has a + * prefix and the namespaceURI is null, or if the qualifiedName is null and the namespaceURI + * is different from null, or if the qualifiedName has a prefix that is "xml" and the + * namespaceURI is different from "{@link http://www.w3.org/XML/1998/namespace}" + * {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#Namespaces XML Namespaces}, + * or if the DOM implementation does not support the "XML" feature but a non-null namespace + * URI was provided, since namespaces were defined by XML. + * - `WRONG_DOCUMENT_ERR`: Raised if doctype has already been used with a different document + * or was created from a different implementation. + * - `NOT_SUPPORTED_ERR`: May be raised if the implementation does not support the feature + * "XML" and the language exposed through the Document does not support XML Namespaces (such + * as {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#HTML40 HTML 4.01}). + * @since DOM Level 2. + * @see {@link #createHTMLDocument} * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN - * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial) - * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core - * - * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract - * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names - * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names - */ - createDocument: function(t, e, r) { - var u = new Be(); - if (u.implementation = this, u.childNodes = new z(), u.doctype = r || null, r && u.appendChild(r), e) { - var n = u.createElementNS(t, e); - u.appendChild(n); + * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Living Standard + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Level-2-Core-DOM-createDocument DOM + * Level 3 Core + * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM + * Level 2 Core (initial) + */ + createDocument: function(e, t, r) { + var n = ze.XML_APPLICATION; + e === te.HTML ? n = ze.XML_XHTML_APPLICATION : e === te.SVG && (n = ze.XML_SVG_IMAGE); + var u = new se(P, { contentType: n }); + if (u.implementation = this, u.childNodes = new M(), u.doctype = r || null, r && u.appendChild(r), t) { + var i = u.createElementNS(e, t); + u.appendChild(i); } return u; }, /** - * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`. + * Creates an empty DocumentType node. Entity declarations and notations are not made + * available. Entity reference expansions and default attribute additions do not occur. * - * __This behavior is slightly different from the in the specs__: - * - this implementation is not validating names or qualified names - * (when parsing XML strings, the SAX parser takes care of that) + * **This behavior is slightly different from the one in the specs**: + * - `encoding`, `mode`, `origin`, `url` fields are currently not declared. + * - `publicId` and `systemId` contain the raw data including any possible quotes, + * so they can always be serialized back to the original value + * - `internalSubset` contains the raw string between `[` and `]` if present, + * but is not parsed or validated in any form. * + * @function DOMImplementation#createDocumentType * @param {string} qualifiedName + * The {@link https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-qualifiedname qualified + * name} of the document type to be created. * @param {string} [publicId] + * The external subset public identifier. * @param {string} [systemId] - * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation - * or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()` + * The external subset system identifier. + * @param {string} [internalSubset] + * the internal subset or an empty string if it is not present + * @returns {DocumentType} + * A new {@link DocumentType} node with {@link Node#ownerDocument} set to null. + * @throws {DOMException} + * With code: * - * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN - * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core - * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard + * - `INVALID_CHARACTER_ERR`: Raised if the specified qualified name is not an XML name + * according to {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#XML XML 1.0}. + * - `NAMESPACE_ERR`: Raised if the qualifiedName is malformed. + * - `NOT_SUPPORTED_ERR`: May be raised if the implementation does not support the feature + * "XML" and the language exposed through the Document does not support XML Namespaces (such + * as {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#HTML40 HTML 4.01}). + * @since DOM Level 2. + * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType + * MDN + * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living + * Standard + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Level-3-Core-DOM-createDocType DOM + * Level 3 Core + * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM + * Level 2 Core + * @see https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md#050 + * @see https://www.w3.org/TR/DOM-Level-2-Core/#core-ID-Core-DocType-internalSubset + * @prettierignore + */ + createDocumentType: function(e, t, r, n) { + yn(e); + var u = new It(P); + return u.name = e, u.nodeName = e, u.publicId = t || "", u.systemId = r || "", u.internalSubset = n || "", u.childNodes = new M(), u; + }, + /** + * Returns an HTML document, that might already have a basic DOM structure. + * + * __It behaves slightly different from the description in the living standard__: + * - If the first argument is `false` no initial nodes are added (steps 3-7 in the specs are + * omitted) + * - `encoding`, `mode`, `origin`, `url` fields are currently not declared. * - * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract - * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names - * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names + * @param {string | false} [title] + * A string containing the title to give the new HTML document. + * @returns {Document} + * The HTML document. + * @since WHATWG Living Standard. + * @see {@link #createDocument} + * @see https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument + * @see https://dom.spec.whatwg.org/#html-document */ - createDocumentType: function(t, e, r) { - var u = new Ve(); - return u.name = t, u.nodeName = t, u.publicId = e || "", u.systemId = r || "", u; + createHTMLDocument: function(e) { + var t = new se(P, { contentType: ze.HTML }); + if (t.implementation = this, t.childNodes = new M(), e !== !1) { + t.doctype = this.createDocumentType("html"), t.doctype.ownerDocument = t, t.appendChild(t.doctype); + var r = t.createElement("html"); + t.appendChild(r); + var n = t.createElement("head"); + if (r.appendChild(n), typeof e == "string") { + var u = t.createElement("title"); + u.appendChild(t.createTextNode(e)), n.appendChild(u); + } + r.appendChild(t.createElement("body")); + } + return t; } }; -function D() { +function A(e) { + q(e); } -D.prototype = { +A.prototype = { + /** + * The first child of this node. + * + * @type {Node | null} + */ firstChild: null, + /** + * The last child of this node. + * + * @type {Node | null} + */ lastChild: null, + /** + * The previous sibling of this node. + * + * @type {Node | null} + */ previousSibling: null, + /** + * The next sibling of this node. + * + * @type {Node | null} + */ nextSibling: null, - attributes: null, + /** + * The parent node of this node. + * + * @type {Node | null} + */ parentNode: null, + /** + * The parent element of this node. + * + * @type {Element | null} + */ + get parentElement() { + return this.parentNode && this.parentNode.nodeType === this.ELEMENT_NODE ? this.parentNode : null; + }, + /** + * The child nodes of this node. + * + * @type {NodeList} + */ childNodes: null, + /** + * The document object associated with this node. + * + * @type {Document | null} + */ ownerDocument: null, + /** + * The value of this node. + * + * @type {string | null} + */ nodeValue: null, + /** + * The namespace URI of this node. + * + * @type {string | null} + */ namespaceURI: null, + /** + * The prefix of the namespace for this node. + * + * @type {string | null} + */ prefix: null, + /** + * The local part of the qualified name of this node. + * + * @type {string | null} + */ localName: null, - // Modified in DOM Level 2: - insertBefore: function(t, e) { - return Pe(this, t, e); + /** + * The baseURI is currently always `about:blank`, + * since that's what happens when you create a document from scratch. + * + * @type {'about:blank'} + */ + baseURI: "about:blank", + /** + * Is true if this node is part of a document. + * + * @type {boolean} + */ + get isConnected() { + var e = this.getRootNode(); + return e && e.nodeType === e.DOCUMENT_NODE; }, - replaceChild: function(t, e) { - Pe(this, t, e, Tr), e && this.removeChild(e); + /** + * Checks whether `other` is an inclusive descendant of this node. + * + * @param {Node | null | undefined} other + * The node to check. + * @returns {boolean} + * True if `other` is an inclusive descendant of this node; false otherwise. + * @see https://dom.spec.whatwg.org/#dom-node-contains + */ + contains: function(e) { + if (!e) return !1; + var t = e; + do { + if (this === t) return !0; + t = e.parentNode; + } while (t); + return !1; }, - removeChild: function(t) { - return Br(this, t); + /** + * @typedef GetRootNodeOptions + * @property {boolean} [composed=false] + */ + /** + * Searches for the root node of this node. + * + * **This behavior is slightly different from the in the specs**: + * - ignores `options.composed`, since `ShadowRoot`s are unsupported, always returns root. + * + * @param {GetRootNodeOptions} [options] + * @returns {Node} + * Root node. + * @see https://dom.spec.whatwg.org/#dom-node-getrootnode + * @see https://dom.spec.whatwg.org/#concept-shadow-including-root + */ + getRootNode: function(e) { + var t = this; + do { + if (!t.parentNode) + return t; + t = t.parentNode; + } while (t); }, - appendChild: function(t) { - return this.insertBefore(t, null); + /** + * Checks whether the given node is equal to this node. + * + * @param {Node} [otherNode] + * @see https://dom.spec.whatwg.org/#concept-node-equals + */ + isEqualNode: function(e) { + if (!e || this.nodeType !== e.nodeType) return !1; + switch (this.nodeType) { + case this.DOCUMENT_TYPE_NODE: + if (this.name !== e.name || this.publicId !== e.publicId || this.systemId !== e.systemId) return !1; + break; + case this.ELEMENT_NODE: + if (this.namespaceURI !== e.namespaceURI || this.prefix !== e.prefix || this.localName !== e.localName || this.attributes.length !== e.attributes.length) return !1; + for (var t = 0; t < this.attributes.length; t++) { + var r = this.attributes.item(t); + if (!r.isEqualNode(e.getAttributeNodeNS(r.namespaceURI, r.localName))) + return !1; + } + break; + case this.ATTRIBUTE_NODE: + if (this.namespaceURI !== e.namespaceURI || this.localName !== e.localName || this.value !== e.value) return !1; + break; + case this.PROCESSING_INSTRUCTION_NODE: + if (this.target !== e.target || this.data !== e.data) + return !1; + break; + case this.TEXT_NODE: + case this.COMMENT_NODE: + if (this.data !== e.data) return !1; + break; + } + if (this.childNodes.length !== e.childNodes.length) + return !1; + for (var t = 0; t < this.childNodes.length; t++) + if (!this.childNodes[t].isEqualNode(e.childNodes[t])) + return !1; + return !0; + }, + /** + * Checks whether or not the given node is this node. + * + * @param {Node} [otherNode] + */ + isSameNode: function(e) { + return this === e; + }, + /** + * Inserts a node before a reference node as a child of this node. + * + * @param {Node} newChild + * The new child node to be inserted. + * @param {Node | null} refChild + * The reference node before which newChild will be inserted. + * @returns {Node} + * The new child node successfully inserted. + * @throws {DOMException} + * Throws a DOMException if inserting the node would result in a DOM tree that is not + * well-formed, or if `child` is provided but is not a child of `parent`. + * See {@link _insertBefore} for more details. + * @since Modified in DOM L2 + */ + insertBefore: function(e, t) { + return At(this, e, t); + }, + /** + * Replaces an old child node with a new child node within this node. + * + * @param {Node} newChild + * The new node that is to replace the old node. + * If it already exists in the DOM, it is removed from its original position. + * @param {Node} oldChild + * The existing child node to be replaced. + * @returns {Node} + * Returns the replaced child node. + * @throws {DOMException} + * Throws a DOMException if replacing the node would result in a DOM tree that is not + * well-formed, or if `oldChild` is not a child of `this`. + * This can also occur if the pre-replacement validity assertion fails. + * See {@link _insertBefore}, {@link Node.removeChild}, and + * {@link assertPreReplacementValidityInDocument} for more details. + * @see https://dom.spec.whatwg.org/#concept-node-replace + */ + replaceChild: function(e, t) { + At(this, e, t, kn), t && this.removeChild(t); + }, + /** + * Removes an existing child node from this node. + * + * @param {Node} oldChild + * The child node to be removed. + * @returns {Node} + * Returns the removed child node. + * @throws {DOMException} + * Throws a DOMException if `oldChild` is not a child of `this`. + * See {@link _removeChild} for more details. + */ + removeChild: function(e) { + return Fn(this, e); + }, + /** + * Appends a child node to this node. + * + * @param {Node} newChild + * The child node to be appended to this node. + * If it already exists in the DOM, it is removed from its original position. + * @returns {Node} + * Returns the appended child node. + * @throws {DOMException} + * Throws a DOMException if appending the node would result in a DOM tree that is not + * well-formed, or if `newChild` is not a valid Node. + * See {@link insertBefore} for more details. + */ + appendChild: function(e) { + return this.insertBefore(e, null); }, + /** + * Determines whether this node has any child nodes. + * + * @returns {boolean} + * Returns true if this node has any child nodes, and false otherwise. + */ hasChildNodes: function() { return this.firstChild != null; }, - cloneNode: function(t) { - return Ke(this.ownerDocument || this, this, t); + /** + * Creates a copy of the calling node. + * + * @param {boolean} deep + * If true, the contents of the node are recursively copied. + * If false, only the node itself (and its attributes, if it is an element) are copied. + * @returns {Node} + * Returns the newly created copy of the node. + * @throws {DOMException} + * May throw a DOMException if operations within {@link Element#setAttributeNode} or + * {@link Node#appendChild} (which are potentially invoked in this method) do not meet their + * specific constraints. + * @see {@link cloneNode} + */ + cloneNode: function(e) { + return Vt(this.ownerDocument || this, this, e); }, - // Modified in DOM Level 2: + /** + * Puts the specified node and all of its subtree into a "normalized" form. In a normalized + * subtree, no text nodes in the subtree are empty and there are no adjacent text nodes. + * + * Specifically, this method merges any adjacent text nodes (i.e., nodes for which `nodeType` + * is `TEXT_NODE`) into a single node with the combined data. It also removes any empty text + * nodes. + * + * This method operates recursively, so it also normalizes any and all descendent nodes within + * the subtree. + * + * @throws {DOMException} + * May throw a DOMException if operations within removeChild or appendData (which are + * potentially invoked in this method) do not meet their specific constraints. + * @since Modified in DOM Level 2 + * @see {@link Node.removeChild} + * @see {@link CharacterData.appendData} + */ normalize: function() { - for (var t = this.firstChild; t; ) { - var e = t.nextSibling; - e && e.nodeType == $e && t.nodeType == $e ? (this.removeChild(e), t.appendData(e.data)) : (t.normalize(), t = e); + for (var e = this.firstChild; e; ) { + var t = e.nextSibling; + t && t.nodeType == vt && e.nodeType == vt ? (this.removeChild(t), e.appendData(t.data)) : (e.normalize(), e = t); } }, - // Introduced in DOM Level 2: - isSupported: function(t, e) { - return this.ownerDocument.implementation.hasFeature(t, e); - }, - // Introduced in DOM Level 2: - hasAttributes: function() { - return this.attributes.length > 0; + /** + * Checks whether the DOM implementation implements a specific feature and its version. + * + * @deprecated + * Since `DOMImplementation.hasFeature` is deprecated and always returns true. + * @param {string} feature + * The package name of the feature to test. This is the same name that can be passed to the + * method `hasFeature` on `DOMImplementation`. + * @param {string} version + * This is the version number of the package name to test. + * @returns {boolean} + * Returns true in all cases in the current implementation. + * @since Introduced in DOM Level 2 + * @see {@link DOMImplementation.hasFeature} + */ + isSupported: function(e, t) { + return this.ownerDocument.implementation.hasFeature(e, t); }, /** * Look up the prefix associated to the given namespace URI, starting from this node. * **The default namespace declarations are ignored by this method.** * See Namespace Prefix Lookup for details on the algorithm used by this method. * - * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._ + * **This behavior is different from the in the specs**: + * - no node type specific handling + * - uses the internal attribute _nsMap for resolving namespaces that is updated when changing attributes * * @param {string | null} namespaceURI + * The namespace URI for which to find the associated prefix. * @returns {string | null} + * The associated prefix, if found; otherwise, null. * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix * @see https://github.com/xmldom/xmldom/issues/322 + * @prettierignore */ - lookupPrefix: function(t) { - for (var e = this; e; ) { - var r = e._nsMap; + lookupPrefix: function(e) { + for (var t = this; t; ) { + var r = t._nsMap; if (r) { - for (var u in r) - if (Object.prototype.hasOwnProperty.call(r, u) && r[u] === t) - return u; + for (var n in r) + if (Ie(r, n) && r[n] === e) + return n; } - e = e.nodeType == ce ? e.ownerDocument : e.parentNode; + t = t.nodeType == Be ? t.ownerDocument : t.parentNode; } return null; }, - // Introduced in DOM Level 3: - lookupNamespaceURI: function(t) { - for (var e = this; e; ) { - var r = e._nsMap; - if (r && Object.prototype.hasOwnProperty.call(r, t)) - return r[t]; - e = e.nodeType == ce ? e.ownerDocument : e.parentNode; + /** + * This function is used to look up the namespace URI associated with the given prefix, + * starting from this node. + * + * **This behavior is different from the in the specs**: + * - no node type specific handling + * - uses the internal attribute _nsMap for resolving namespaces that is updated when changing attributes + * + * @param {string | null} prefix + * The prefix for which to find the associated namespace URI. + * @returns {string | null} + * The associated namespace URI, if found; otherwise, null. + * @since DOM Level 3 + * @see https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI + * @prettierignore + */ + lookupNamespaceURI: function(e) { + for (var t = this; t; ) { + var r = t._nsMap; + if (r && Ie(r, e)) + return r[e]; + t = t.nodeType == Be ? t.ownerDocument : t.parentNode; } return null; }, - // Introduced in DOM Level 3: - isDefaultNamespace: function(t) { - var e = this.lookupPrefix(t); - return e == null; + /** + * Determines whether the given namespace URI is the default namespace. + * + * The function works by looking up the prefix associated with the given namespace URI. If no + * prefix is found (i.e., the namespace URI is not registered in the namespace map of this + * node or any of its ancestors), it returns `true`, implying the namespace URI is considered + * the default. + * + * **This behavior is different from the in the specs**: + * - no node type specific handling + * - uses the internal attribute _nsMap for resolving namespaces that is updated when changing attributes + * + * @param {string | null} namespaceURI + * The namespace URI to be checked. + * @returns {boolean} + * Returns true if the given namespace URI is the default namespace, false otherwise. + * @since DOM Level 3 + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isDefaultNamespace + * @see https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace + * @prettierignore + */ + isDefaultNamespace: function(e) { + var t = this.lookupPrefix(e); + return t == null; + }, + /** + * Compares the reference node with a node with regard to their position in the document and + * according to the document order. + * + * @param {Node} other + * The node to compare the reference node to. + * @returns {number} + * Returns how the node is positioned relatively to the reference node according to the + * bitmask. 0 if reference node and given node are the same. + * @since DOM Level 3 + * @see https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-compare + * @see https://dom.spec.whatwg.org/#dom-node-comparedocumentposition + */ + compareDocumentPosition: function(e) { + if (this === e) return 0; + var t = e, r = this, n = null, u = null; + if (t instanceof ge && (n = t, t = n.ownerElement), r instanceof ge && (u = r, r = u.ownerElement, n && t && r === t)) + for (var i = 0, a; a = r.attributes[i]; i++) { + if (a === n) + return _.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + _.DOCUMENT_POSITION_PRECEDING; + if (a === u) + return _.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + _.DOCUMENT_POSITION_FOLLOWING; + } + if (!t || !r || r.ownerDocument !== t.ownerDocument) + return _.DOCUMENT_POSITION_DISCONNECTED + _.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + (Lr(r.ownerDocument) > Lr(t.ownerDocument) ? _.DOCUMENT_POSITION_FOLLOWING : _.DOCUMENT_POSITION_PRECEDING); + var o = Fr(t), s = Fr(r); + if (!n && s.indexOf(t) >= 0 || u && t === r) + return _.DOCUMENT_POSITION_CONTAINS + _.DOCUMENT_POSITION_PRECEDING; + if (!u && o.indexOf(r) >= 0 || n && t === r) + return _.DOCUMENT_POSITION_CONTAINED_BY + _.DOCUMENT_POSITION_FOLLOWING; + var c = In(s, o); + for (var l in c.childNodes) { + var f = c.childNodes[l]; + if (f === r) return _.DOCUMENT_POSITION_FOLLOWING; + if (f === t) return _.DOCUMENT_POSITION_PRECEDING; + if (s.indexOf(f) >= 0) return _.DOCUMENT_POSITION_FOLLOWING; + if (o.indexOf(f) >= 0) return _.DOCUMENT_POSITION_PRECEDING; + } + return 0; } }; -function wr(t) { - return t == "<" && "<" || t == ">" && ">" || t == "&" && "&" || t == '"' && """ || "&#" + t.charCodeAt() + ";"; -} -Ce(R, D); -Ce(R, D.prototype); -function Ne(t, e) { - if (e(t)) +function Rn(e) { + return e == "<" && "<" || e == ">" && ">" || e == "&" && "&" || e == '"' && """ || "&#" + e.charCodeAt() + ";"; +} +Fe(j, A); +Fe(j, A.prototype); +Fe(_, A); +Fe(_, A.prototype); +function Xe(e, t) { + if (t(e)) return !0; - if (t = t.firstChild) + if (e = e.firstChild) do - if (Ne(t, e)) + if (Xe(e, t)) return !0; - while (t = t.nextSibling); -} -function Be() { - this.ownerDocument = this; + while (e = e.nextSibling); } -function En(t, e, r) { - t && t._inc++; - var u = r.namespaceURI; - u === ye.XMLNS && (e._nsMap[r.prefix ? r.localName : ""] = r.value); +function se(e, t) { + q(e); + var r = t || {}; + this.ownerDocument = this, this.contentType = r.contentType || ze.XML_APPLICATION, this.type = Oo(this.contentType) ? "html" : "xml"; } -function Cr(t, e, r, u) { - t && t._inc++; +function qo(e, t, r) { + e && e._inc++; var n = r.namespaceURI; - n === ye.XMLNS && delete e._nsMap[r.prefix ? r.localName : ""]; -} -function ot(t, e, r) { - if (t && t._inc) { - t._inc++; - var u = e.childNodes; - if (r) - u[u.length++] = r; + n === te.XMLNS && (t._nsMap[r.prefix ? r.localName : ""] = r.value); +} +function Mn(e, t, r, n) { + e && e._inc++; + var u = r.namespaceURI; + u === te.XMLNS && delete t._nsMap[r.prefix ? r.localName : ""]; +} +function _n(e, t, r) { + if (e && e._inc) { + e._inc++; + var n = t.childNodes; + if (r && !r.nextSibling) + n[n.length++] = r; else { - for (var n = e.firstChild, i = 0; n; ) - u[i++] = n, n = n.nextSibling; - u.length = i, delete u[u.length]; + for (var u = t.firstChild, i = 0; u; ) + n[i++] = u, u = u.nextSibling; + n.length = i, delete n[n.length]; } } } -function Br(t, e) { - var r = e.previousSibling, u = e.nextSibling; - return r ? r.nextSibling = u : t.firstChild = u, u ? u.previousSibling = r : t.lastChild = r, e.parentNode = null, e.previousSibling = null, e.nextSibling = null, ot(t.ownerDocument, t), e; +function Fn(e, t) { + if (e !== t.parentNode) + throw new h(h.NOT_FOUND_ERR, "child's parent is not parent"); + var r = t.previousSibling, n = t.nextSibling; + return r ? r.nextSibling = n : e.firstChild = n, n ? n.previousSibling = r : e.lastChild = r, _n(e.ownerDocument, e), t.parentNode = null, t.previousSibling = null, t.nextSibling = null, t; } -function An(t) { - return t && (t.nodeType === D.DOCUMENT_NODE || t.nodeType === D.DOCUMENT_FRAGMENT_NODE || t.nodeType === D.ELEMENT_NODE); +function $o(e) { + return e && (e.nodeType === A.DOCUMENT_NODE || e.nodeType === A.DOCUMENT_FRAGMENT_NODE || e.nodeType === A.ELEMENT_NODE); } -function yn(t) { - return t && (V(t) || at(t) || J(t) || t.nodeType === D.DOCUMENT_FRAGMENT_NODE || t.nodeType === D.COMMENT_NODE || t.nodeType === D.PROCESSING_INSTRUCTION_NODE); +function jo(e) { + return e && (e.nodeType === A.CDATA_SECTION_NODE || e.nodeType === A.COMMENT_NODE || e.nodeType === A.DOCUMENT_FRAGMENT_NODE || e.nodeType === A.DOCUMENT_TYPE_NODE || e.nodeType === A.ELEMENT_NODE || e.nodeType === A.PROCESSING_INSTRUCTION_NODE || e.nodeType === A.TEXT_NODE); } -function J(t) { - return t && t.nodeType === D.DOCUMENT_TYPE_NODE; +function ce(e) { + return e && e.nodeType === A.DOCUMENT_TYPE_NODE; } -function V(t) { - return t && t.nodeType === D.ELEMENT_NODE; +function ue(e) { + return e && e.nodeType === A.ELEMENT_NODE; } -function at(t) { - return t && t.nodeType === D.TEXT_NODE; +function Ln(e) { + return e && e.nodeType === A.TEXT_NODE; } -function jt(t, e) { - var r = t.childNodes || []; - if (L(r, V) || J(e)) +function Pr(e, t) { + var r = e.childNodes || []; + if (ee(r, ue) || ce(t)) return !1; - var u = L(r, J); - return !(e && u && r.indexOf(u) > r.indexOf(e)); + var n = ee(r, ce); + return !(t && n && r.indexOf(n) > r.indexOf(t)); } -function _t(t, e) { - var r = t.childNodes || []; - function u(i) { - return V(i) && i !== e; +function qr(e, t) { + var r = e.childNodes || []; + function n(i) { + return ue(i) && i !== t; } - if (L(r, u)) + if (ee(r, n)) return !1; - var n = L(r, J); - return !(e && n && r.indexOf(n) > r.indexOf(e)); -} -function Nn(t, e, r) { - if (!An(t)) - throw new w(F, "Unexpected parent node type " + t.nodeType); - if (r && r.parentNode !== t) - throw new w(Ar, "child not in parent"); + var u = ee(r, ce); + return !(t && u && r.indexOf(u) > r.indexOf(t)); +} +function Uo(e, t, r) { + if (!$o(e)) + throw new h(h.HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + e.nodeType); + if (r && r.parentNode !== e) + throw new h(h.NOT_FOUND_ERR, "child not in parent"); if ( // 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a "HierarchyRequestError" DOMException. - !yn(e) || // 5. If either `node` is a Text node and `parent` is a document, + !jo(t) || // 5. If either `node` is a Text node and `parent` is a document, // the sax parser currently adds top level text nodes, this will be fixed in 0.9.0 // || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE) // or `node` is a doctype and `parent` is not a document, then throw a "HierarchyRequestError" DOMException. - J(e) && t.nodeType !== D.DOCUMENT_NODE + ce(t) && e.nodeType !== A.DOCUMENT_NODE ) - throw new w( - F, - "Unexpected node type " + e.nodeType + " for parent node type " + t.nodeType + throw new h( + h.HIERARCHY_REQUEST_ERR, + "Unexpected node type " + t.nodeType + " for parent node type " + e.nodeType ); } -function wn(t, e, r) { - var u = t.childNodes || [], n = e.childNodes || []; - if (e.nodeType === D.DOCUMENT_FRAGMENT_NODE) { - var i = n.filter(V); - if (i.length > 1 || L(n, at)) - throw new w(F, "More than one element or text in fragment"); - if (i.length === 1 && !jt(t, r)) - throw new w(F, "Element in fragment can not be inserted before doctype"); - } - if (V(e) && !jt(t, r)) - throw new w(F, "Only one element can be added and only after doctype"); - if (J(e)) { - if (L(u, J)) - throw new w(F, "Only one doctype is allowed"); - var o = L(u, V); - if (r && u.indexOf(o) < u.indexOf(r)) - throw new w(F, "Doctype can only be inserted before an element"); - if (!r && o) - throw new w(F, "Doctype can not be appended since element is present"); - } -} -function Tr(t, e, r) { - var u = t.childNodes || [], n = e.childNodes || []; - if (e.nodeType === D.DOCUMENT_FRAGMENT_NODE) { - var i = n.filter(V); - if (i.length > 1 || L(n, at)) - throw new w(F, "More than one element or text in fragment"); - if (i.length === 1 && !_t(t, r)) - throw new w(F, "Element in fragment can not be inserted before doctype"); - } - if (V(e) && !_t(t, r)) - throw new w(F, "Only one element can be added and only after doctype"); - if (J(e)) { - if (L(u, function(s) { - return J(s) && s !== r; +function Vo(e, t, r) { + var n = e.childNodes || [], u = t.childNodes || []; + if (t.nodeType === A.DOCUMENT_FRAGMENT_NODE) { + var i = u.filter(ue); + if (i.length > 1 || ee(u, Ln)) + throw new h(h.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment"); + if (i.length === 1 && !Pr(e, r)) + throw new h(h.HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype"); + } + if (ue(t) && !Pr(e, r)) + throw new h(h.HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype"); + if (ce(t)) { + if (ee(n, ce)) + throw new h(h.HIERARCHY_REQUEST_ERR, "Only one doctype is allowed"); + var a = ee(n, ue); + if (r && n.indexOf(a) < n.indexOf(r)) + throw new h(h.HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element"); + if (!r && a) + throw new h(h.HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present"); + } +} +function kn(e, t, r) { + var n = e.childNodes || [], u = t.childNodes || []; + if (t.nodeType === A.DOCUMENT_FRAGMENT_NODE) { + var i = u.filter(ue); + if (i.length > 1 || ee(u, Ln)) + throw new h(h.HIERARCHY_REQUEST_ERR, "More than one element or text in fragment"); + if (i.length === 1 && !qr(e, r)) + throw new h(h.HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype"); + } + if (ue(t) && !qr(e, r)) + throw new h(h.HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype"); + if (ce(t)) { + if (ee(n, function(s) { + return ce(s) && s !== r; })) - throw new w(F, "Only one doctype is allowed"); - var o = L(u, V); - if (r && u.indexOf(o) < u.indexOf(r)) - throw new w(F, "Doctype can only be inserted before an element"); + throw new h(h.HIERARCHY_REQUEST_ERR, "Only one doctype is allowed"); + var a = ee(n, ue); + if (r && n.indexOf(a) < n.indexOf(r)) + throw new h(h.HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element"); } } -function Pe(t, e, r, u) { - Nn(t, e, r), t.nodeType === D.DOCUMENT_NODE && (u || wn)(t, e, r); - var n = e.parentNode; - if (n && n.removeChild(e), e.nodeType === G) { - var i = e.firstChild; +function At(e, t, r, n) { + Uo(e, t, r), e.nodeType === A.DOCUMENT_NODE && (n || Vo)(e, t, r); + var u = t.parentNode; + if (u && u.removeChild(t), t.nodeType === ae) { + var i = t.firstChild; if (i == null) - return e; - var o = e.lastChild; + return t; + var a = t.lastChild; } else - i = o = e; - var a = r ? r.previousSibling : t.lastChild; - i.previousSibling = a, o.nextSibling = r, a ? a.nextSibling = i : t.firstChild = i, r == null ? t.lastChild = o : r.previousSibling = o; + i = a = t; + var o = r ? r.previousSibling : e.lastChild; + i.previousSibling = o, a.nextSibling = r, o ? o.nextSibling = i : e.firstChild = i, r == null ? e.lastChild = a : r.previousSibling = a; do - i.parentNode = t; - while (i !== o && (i = i.nextSibling)); - return ot(t.ownerDocument || t, t), e.nodeType == G && (e.firstChild = e.lastChild = null), e; -} -function Cn(t, e) { - return e.parentNode && e.parentNode.removeChild(e), e.parentNode = t, e.previousSibling = t.lastChild, e.nextSibling = null, e.previousSibling ? e.previousSibling.nextSibling = e : t.firstChild = e, t.lastChild = e, ot(t.ownerDocument, t, e), e; + i.parentNode = e; + while (i !== a && (i = i.nextSibling)); + return _n(e.ownerDocument || e, e, t), t.nodeType == ae && (t.firstChild = t.lastChild = null), t; } -Be.prototype = { - //implementation : null, +se.prototype = { + /** + * The implementation that created this document. + * + * @type DOMImplementation + * @readonly + */ + implementation: null, nodeName: "#document", - nodeType: br, + nodeType: nt, /** * The DocumentType node of the document. * - * @readonly * @type DocumentType + * @readonly */ doctype: null, documentElement: null, _inc: 1, - insertBefore: function(t, e) { - if (t.nodeType == G) { - for (var r = t.firstChild; r; ) { - var u = r.nextSibling; - this.insertBefore(r, e), r = u; + insertBefore: function(e, t) { + if (e.nodeType === ae) { + for (var r = e.firstChild; r; ) { + var n = r.nextSibling; + this.insertBefore(r, t), r = n; } - return t; + return e; } - return Pe(this, t, e), t.ownerDocument = this, this.documentElement === null && t.nodeType === P && (this.documentElement = t), t; + return At(this, e, t), e.ownerDocument = this, this.documentElement === null && e.nodeType === Y && (this.documentElement = e), e; }, - removeChild: function(t) { - return this.documentElement == t && (this.documentElement = null), Br(this, t); + removeChild: function(e) { + var t = Fn(this, e); + return t === this.documentElement && (this.documentElement = null), t; }, - replaceChild: function(t, e) { - Pe(this, t, e, Tr), t.ownerDocument = this, e && this.removeChild(e), V(t) && (this.documentElement = t); + replaceChild: function(e, t) { + At(this, e, t, kn), e.ownerDocument = this, t && this.removeChild(t), ue(e) && (this.documentElement = e); }, // Introduced in DOM Level 2: - importNode: function(t, e) { - return Fr(this, t, e); + importNode: function(e, t) { + return $n(this, e, t); }, // Introduced in DOM Level 2: - getElementById: function(t) { - var e = null; - return Ne(this.documentElement, function(r) { - if (r.nodeType == P && r.getAttribute("id") == t) - return e = r, !0; - }), e; + getElementById: function(e) { + var t = null; + return Xe(this.documentElement, function(r) { + if (r.nodeType == Y && r.getAttribute("id") == e) + return t = r, !0; + }), t; }, /** - * The `getElementsByClassName` method of `Document` interface returns an array-like object - * of all child elements which have **all** of the given class name(s). - * - * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters. - * + * Creates a new `Element` that is owned by this `Document`. + * In HTML Documents `localName` is the lower cased `tagName`, + * otherwise no transformation is being applied. + * When `contentType` implies the HTML namespace, it will be set as `namespaceURI`. * - * Warning: This is a live LiveNodeList. - * Changes in the DOM will reflect in the array as the changes occur. - * If an element selected by this array no longer qualifies for the selector, - * it will automatically be removed. Be aware of this for iteration purposes. - * - * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace + * __This implementation differs from the specification:__ - The provided name is not checked + * against the `Name` production, + * so no related error will be thrown. + * - There is no interface `HTMLElement`, it is always an `Element`. + * - There is no support for a second argument to indicate using custom elements. * - * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName - * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname + * @param {string} tagName + * @returns {Element} + * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement + * @see https://dom.spec.whatwg.org/#dom-document-createelement + * @see https://dom.spec.whatwg.org/#concept-create-element */ - getElementsByClassName: function(t) { - var e = qt(t); - return new le(this, function(r) { - var u = []; - return e.length > 0 && Ne(r.documentElement, function(n) { - if (n !== r && n.nodeType === P) { - var i = n.getAttribute("class"); - if (i) { - var o = t === i; - if (!o) { - var a = qt(i); - o = e.every(Dn(a)); - } - o && u.push(n); - } - } - }), u; - }); - }, - //document factory method: - createElement: function(t) { - var e = new te(); - e.ownerDocument = this, e.nodeName = t, e.tagName = t, e.localName = t, e.childNodes = new z(); - var r = e.attributes = new Me(); - return r._ownerElement = e, e; + createElement: function(e) { + var t = new le(P); + t.ownerDocument = this, this.type === "html" && (e = e.toLowerCase()), So(this.contentType) && (t.namespaceURI = te.HTML), t.nodeName = e, t.tagName = e, t.localName = e, t.childNodes = new M(); + var r = t.attributes = new xe(); + return r._ownerElement = t, t; }, + /** + * @returns {DocumentFragment} + */ createDocumentFragment: function() { - var t = new Ue(); - return t.ownerDocument = this, t.childNodes = new z(), t; + var e = new ct(P); + return e.ownerDocument = this, e.childNodes = new M(), e; }, - createTextNode: function(t) { - var e = new st(); - return e.ownerDocument = this, e.appendData(t), e; + /** + * @param {string} data + * @returns {Text} + */ + createTextNode: function(e) { + var t = new st(P); + return t.ownerDocument = this, t.childNodes = new M(), t.appendData(e), t; + }, + /** + * @param {string} data + * @returns {Comment} + */ + createComment: function(e) { + var t = new St(P); + return t.ownerDocument = this, t.childNodes = new M(), t.appendData(e), t; }, - createComment: function(t) { - var e = new ct(); - return e.ownerDocument = this, e.appendData(t), e; + /** + * @param {string} data + * @returns {CDATASection} + */ + createCDATASection: function(e) { + var t = new Ot(P); + return t.ownerDocument = this, t.childNodes = new M(), t.appendData(e), t; }, - createCDATASection: function(t) { - var e = new lt(); - return e.ownerDocument = this, e.appendData(t), e; + /** + * @param {string} target + * @param {string} data + * @returns {ProcessingInstruction} + */ + createProcessingInstruction: function(e, t) { + var r = new xt(P); + return r.ownerDocument = this, r.childNodes = new M(), r.nodeName = r.target = e, r.nodeValue = r.data = t, r; }, - createProcessingInstruction: function(t, e) { - var r = new pt(); - return r.ownerDocument = this, r.tagName = r.nodeName = r.target = t, r.nodeValue = r.data = e, r; + /** + * Creates an `Attr` node that is owned by this document. + * In HTML Documents `localName` is the lower cased `name`, + * otherwise no transformation is being applied. + * + * __This implementation differs from the specification:__ - The provided name is not checked + * against the `Name` production, + * so no related error will be thrown. + * + * @param {string} name + * @returns {Attr} + * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createAttribute + * @see https://dom.spec.whatwg.org/#dom-document-createattribute + */ + createAttribute: function(e) { + if (!Q.QName_exact.test(e)) + throw new h(h.INVALID_CHARACTER_ERR, 'invalid character in name "' + e + '"'); + return this.type === "html" && (e = e.toLowerCase()), this._createAttribute(e); }, - createAttribute: function(t) { - var e = new je(); - return e.ownerDocument = this, e.name = t, e.nodeName = t, e.localName = t, e.specified = !0, e; + _createAttribute: function(e) { + var t = new ge(P); + return t.ownerDocument = this, t.childNodes = new M(), t.name = e, t.nodeName = e, t.localName = e, t.specified = !0, t; }, - createEntityReference: function(t) { - var e = new ft(); - return e.ownerDocument = this, e.nodeName = t, e; + /** + * Creates an EntityReference object. + * The current implementation does not fill the `childNodes` with those of the corresponding + * `Entity` + * + * @deprecated + * In DOM Level 4. + * @param {string} name + * The name of the entity to reference. No namespace well-formedness checks are performed. + * @returns {EntityReference} + * @throws {DOMException} + * With code `INVALID_CHARACTER_ERR` when `name` is not valid. + * @throws {DOMException} + * with code `NOT_SUPPORTED_ERR` when the document is of type `html` + * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE + */ + createEntityReference: function(e) { + if (!Q.Name.test(e)) + throw new h(h.INVALID_CHARACTER_ERR, 'not a valid xml name "' + e + '"'); + if (this.type === "html") + throw new h("document is an html document", xo.NotSupportedError); + var t = new Bt(P); + return t.ownerDocument = this, t.childNodes = new M(), t.nodeName = e, t; }, // Introduced in DOM Level 2: - createElementNS: function(t, e) { - var r = new te(), u = e.split(":"), n = r.attributes = new Me(); - return r.childNodes = new z(), r.ownerDocument = this, r.nodeName = e, r.tagName = e, r.namespaceURI = t, u.length == 2 ? (r.prefix = u[0], r.localName = u[1]) : r.localName = e, n._ownerElement = r, r; + /** + * @param {string} namespaceURI + * @param {string} qualifiedName + * @returns {Element} + */ + createElementNS: function(e, t) { + var r = Ut(e, t), n = new le(P), u = n.attributes = new xe(); + return n.childNodes = new M(), n.ownerDocument = this, n.nodeName = t, n.tagName = t, n.namespaceURI = r[0], n.prefix = r[1], n.localName = r[2], u._ownerElement = n, n; }, // Introduced in DOM Level 2: - createAttributeNS: function(t, e) { - var r = new je(), u = e.split(":"); - return r.ownerDocument = this, r.nodeName = e, r.name = e, r.namespaceURI = t, r.specified = !0, u.length == 2 ? (r.prefix = u[0], r.localName = u[1]) : r.localName = e, r; + /** + * @param {string} namespaceURI + * @param {string} qualifiedName + * @returns {Attr} + */ + createAttributeNS: function(e, t) { + var r = Ut(e, t), n = new ge(P); + return n.ownerDocument = this, n.childNodes = new M(), n.nodeName = t, n.name = t, n.specified = !0, n.namespaceURI = r[0], n.prefix = r[1], n.localName = r[2], n; } }; -k(Be, D); -function te() { - this._nsMap = {}; -} -te.prototype = { - nodeType: P, - hasAttribute: function(t) { - return this.getAttributeNode(t) != null; +$(se, A); +function le(e) { + q(e), this._nsMap = /* @__PURE__ */ Object.create(null); +} +le.prototype = { + nodeType: Y, + /** + * The attributes of this element. + * + * @type {NamedNodeMap | null} + */ + attributes: null, + getQualifiedName: function() { + return this.prefix ? this.prefix + ":" + this.localName : this.localName; + }, + _isInHTMLDocumentAndNamespace: function() { + return this.ownerDocument.type === "html" && this.namespaceURI === te.HTML; }, - getAttribute: function(t) { - var e = this.getAttributeNode(t); - return e && e.value || ""; + hasAttribute: function(e) { + return !!this.getAttributeNode(e); }, - getAttributeNode: function(t) { - return this.attributes.getNamedItem(t); + /** + * Returns element’s first attribute whose qualified name is `name`, and `null` + * if there is no such attribute. + * + * @param {string} name + * @returns {string | null} + */ + getAttribute: function(e) { + var t = this.getAttributeNode(e); + return t ? t.value : null; }, - setAttribute: function(t, e) { - var r = this.ownerDocument.createAttribute(t); - r.value = r.nodeValue = "" + e, this.setAttributeNode(r); + getAttributeNode: function(e) { + return this._isInHTMLDocumentAndNamespace() && (e = e.toLowerCase()), this.attributes.getNamedItem(e); }, - removeAttribute: function(t) { - var e = this.getAttributeNode(t); - e && this.removeAttributeNode(e); + /** + * Sets the value of element’s first attribute whose qualified name is qualifiedName to value. + * + * @param {string} name + * @param {string} value + */ + setAttribute: function(e, t) { + this._isInHTMLDocumentAndNamespace() && (e = e.toLowerCase()); + var r = this.getAttributeNode(e); + r ? r.value = r.nodeValue = "" + t : (r = this.ownerDocument._createAttribute(e), r.value = r.nodeValue = "" + t, this.setAttributeNode(r)); }, - //four real opeartion method - appendChild: function(t) { - return t.nodeType === G ? this.insertBefore(t, null) : Cn(this, t); + removeAttribute: function(e) { + var t = this.getAttributeNode(e); + t && this.removeAttributeNode(t); }, - setAttributeNode: function(t) { - return this.attributes.setNamedItem(t); + setAttributeNode: function(e) { + return this.attributes.setNamedItem(e); }, - setAttributeNodeNS: function(t) { - return this.attributes.setNamedItemNS(t); + setAttributeNodeNS: function(e) { + return this.attributes.setNamedItemNS(e); }, - removeAttributeNode: function(t) { - return this.attributes.removeNamedItem(t.nodeName); + removeAttributeNode: function(e) { + return this.attributes.removeNamedItem(e.nodeName); }, //get real attribute name,and remove it by removeAttributeNode - removeAttributeNS: function(t, e) { - var r = this.getAttributeNodeNS(t, e); + removeAttributeNS: function(e, t) { + var r = this.getAttributeNodeNS(e, t); r && this.removeAttributeNode(r); }, - hasAttributeNS: function(t, e) { - return this.getAttributeNodeNS(t, e) != null; + hasAttributeNS: function(e, t) { + return this.getAttributeNodeNS(e, t) != null; }, - getAttributeNS: function(t, e) { - var r = this.getAttributeNodeNS(t, e); - return r && r.value || ""; + /** + * Returns element’s attribute whose namespace is `namespaceURI` and local name is + * `localName`, + * or `null` if there is no such attribute. + * + * @param {string} namespaceURI + * @param {string} localName + * @returns {string | null} + */ + getAttributeNS: function(e, t) { + var r = this.getAttributeNodeNS(e, t); + return r ? r.value : null; }, - setAttributeNS: function(t, e, r) { - var u = this.ownerDocument.createAttributeNS(t, e); - u.value = u.nodeValue = "" + r, this.setAttributeNode(u); + /** + * Sets the value of element’s attribute whose namespace is `namespaceURI` and local name is + * `localName` to value. + * + * @param {string} namespaceURI + * @param {string} qualifiedName + * @param {string} value + * @see https://dom.spec.whatwg.org/#dom-element-setattributens + */ + setAttributeNS: function(e, t, r) { + var n = Ut(e, t), u = n[2], i = this.getAttributeNodeNS(e, u); + i ? i.value = i.nodeValue = "" + r : (i = this.ownerDocument.createAttributeNS(e, t), i.value = i.nodeValue = "" + r, this.setAttributeNode(i)); }, - getAttributeNodeNS: function(t, e) { - return this.attributes.getNamedItemNS(t, e); + getAttributeNodeNS: function(e, t) { + return this.attributes.getNamedItemNS(e, t); }, - getElementsByTagName: function(t) { - return new le(this, function(e) { - var r = []; - return Ne(e, function(u) { - u !== e && u.nodeType == P && (t === "*" || u.tagName == t) && r.push(u); - }), r; + /** + * Returns a LiveNodeList of all child elements which have **all** of the given class name(s). + * + * Returns an empty list if `classNames` is an empty string or only contains HTML white space + * characters. + * + * Warning: This returns a live LiveNodeList. + * Changes in the DOM will reflect in the array as the changes occur. + * If an element selected by this array no longer qualifies for the selector, + * it will automatically be removed. Be aware of this for iteration purposes. + * + * @param {string} classNames + * Is a string representing the class name(s) to match; multiple class names are separated by + * (ASCII-)whitespace. + * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName + * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName + * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname + */ + getElementsByClassName: function(e) { + var t = _r(e); + return new he(this, function(r) { + var n = []; + return t.length > 0 && Xe(r, function(u) { + if (u !== r && u.nodeType === Y) { + var i = u.getAttribute("class"); + if (i) { + var a = e === i; + if (!a) { + var o = _r(i); + a = t.every(Fo(o)); + } + a && n.push(u); + } + } + }), n; }); }, - getElementsByTagNameNS: function(t, e) { - return new le(this, function(r) { + /** + * Returns a LiveNodeList of elements with the given qualifiedName. + * Searching for all descendants can be done by passing `*` as `qualifiedName`. + * + * All descendants of the specified element are searched, but not the element itself. + * The returned list is live, which means it updates itself with the DOM tree automatically. + * Therefore, there is no need to call `Element.getElementsByTagName()` + * with the same element and arguments repeatedly if the DOM changes in between calls. + * + * When called on an HTML element in an HTML document, + * `getElementsByTagName` lower-cases the argument before searching for it. + * This is undesirable when trying to match camel-cased SVG elements (such as + * ``) in an HTML document. + * Instead, use `Element.getElementsByTagNameNS()`, + * which preserves the capitalization of the tag name. + * + * `Element.getElementsByTagName` is similar to `Document.getElementsByTagName()`, + * except that it only searches for elements that are descendants of the specified element. + * + * @param {string} qualifiedName + * @returns {LiveNodeList} + * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName + * @see https://dom.spec.whatwg.org/#concept-getelementsbytagname + */ + getElementsByTagName: function(e) { + var t = (this.nodeType === nt ? this : this.ownerDocument).type === "html", r = e.toLowerCase(); + return new he(this, function(n) { var u = []; - return Ne(r, function(n) { - n !== r && n.nodeType === P && (t === "*" || n.namespaceURI === t) && (e === "*" || n.localName == e) && u.push(n); + return Xe(n, function(i) { + if (!(i === n || i.nodeType !== Y)) + if (e === "*") + u.push(i); + else { + var a = i.getQualifiedName(), o = t && i.namespaceURI === te.HTML ? r : e; + a === o && u.push(i); + } }), u; }); + }, + getElementsByTagNameNS: function(e, t) { + return new he(this, function(r) { + var n = []; + return Xe(r, function(u) { + u !== r && u.nodeType === Y && (e === "*" || u.namespaceURI === e) && (t === "*" || u.localName == t) && n.push(u); + }), n; + }); } }; -Be.prototype.getElementsByTagName = te.prototype.getElementsByTagName; -Be.prototype.getElementsByTagNameNS = te.prototype.getElementsByTagNameNS; -k(te, D); -function je() { -} -je.prototype.nodeType = ce; -k(je, D); -function Te() { -} -Te.prototype = { +se.prototype.getElementsByClassName = le.prototype.getElementsByClassName; +se.prototype.getElementsByTagName = le.prototype.getElementsByTagName; +se.prototype.getElementsByTagNameNS = le.prototype.getElementsByTagNameNS; +$(le, A); +function ge(e) { + q(e), this.namespaceURI = null, this.prefix = null, this.ownerElement = null; +} +ge.prototype.nodeType = Be; +$(ge, A); +function Le(e) { + q(e); +} +Le.prototype = { data: "", - substringData: function(t, e) { - return this.data.substring(t, t + e); - }, - appendData: function(t) { - t = this.data + t, this.nodeValue = this.data = t, this.length = t.length; + substringData: function(e, t) { + return this.data.substring(e, e + t); }, - insertData: function(t, e) { - this.replaceData(t, 0, e); + appendData: function(e) { + e = this.data + e, this.nodeValue = this.data = e, this.length = e.length; }, - appendChild: function(t) { - throw new Error(B[F]); + insertData: function(e, t) { + this.replaceData(e, 0, t); }, - deleteData: function(t, e) { - this.replaceData(t, e, ""); + deleteData: function(e, t) { + this.replaceData(e, t, ""); }, - replaceData: function(t, e, r) { - var u = this.data.substring(0, t), n = this.data.substring(t + e); - r = u + r + n, this.nodeValue = this.data = r, this.length = r.length; + replaceData: function(e, t, r) { + var n = this.data.substring(0, e), u = this.data.substring(e + t); + r = n + r + u, this.nodeValue = this.data = r, this.length = r.length; } }; -k(Te, D); -function st() { +$(Le, A); +function st(e) { + q(e); } st.prototype = { nodeName: "#text", - nodeType: $e, - splitText: function(t) { - var e = this.data, r = e.substring(t); - e = e.substring(0, t), this.data = this.nodeValue = e, this.length = e.length; - var u = this.ownerDocument.createTextNode(r); - return this.parentNode && this.parentNode.insertBefore(u, this.nextSibling), u; + nodeType: vt, + splitText: function(e) { + var t = this.data, r = t.substring(e); + t = t.substring(0, e), this.data = this.nodeValue = t, this.length = t.length; + var n = this.ownerDocument.createTextNode(r); + return this.parentNode && this.parentNode.insertBefore(n, this.nextSibling), n; } }; -k(st, Te); -function ct() { +$(st, Le); +function St(e) { + q(e); } -ct.prototype = { +St.prototype = { nodeName: "#comment", - nodeType: vr + nodeType: Sn }; -k(ct, Te); -function lt() { +$(St, Le); +function Ot(e) { + q(e); } -lt.prototype = { +Ot.prototype = { nodeName: "#cdata-section", - nodeType: mr + nodeType: Cn }; -k(lt, Te); -function Ve() { -} -Ve.prototype.nodeType = Er; -k(Ve, D); -function Sr() { -} -Sr.prototype.nodeType = bn; -k(Sr, D); -function Or() { -} -Or.prototype.nodeType = vn; -k(Or, D); -function ft() { -} -ft.prototype.nodeType = gr; -k(ft, D); -function Ue() { -} -Ue.prototype.nodeName = "#document-fragment"; -Ue.prototype.nodeType = G; -k(Ue, D); -function pt() { -} -pt.prototype.nodeType = Dr; -k(pt, D); -function xr() { -} -xr.prototype.serializeToString = function(t, e, r) { - return Ir.call(t, e, r); +$(Ot, st); +function It(e) { + q(e); +} +It.prototype.nodeType = On; +$(It, A); +function nr(e) { + q(e); +} +nr.prototype.nodeType = ko; +$(nr, A); +function ur(e) { + q(e); +} +ur.prototype.nodeType = Lo; +$(ur, A); +function Bt(e) { + q(e); +} +Bt.prototype.nodeType = Tn; +$(Bt, A); +function ct(e) { + q(e); +} +ct.prototype.nodeName = "#document-fragment"; +ct.prototype.nodeType = ae; +$(ct, A); +function xt(e) { + q(e); +} +xt.prototype.nodeType = wn; +$(xt, Le); +function Pn() { +} +Pn.prototype.serializeToString = function(e, t) { + return qn.call(e, t); }; -D.prototype.toString = Ir; -function Ir(t, e) { - var r = [], u = this.nodeType == 9 && this.documentElement || this, n = u.prefix, i = u.namespaceURI; - if (i && n == null) { - var n = u.lookupPrefix(i); +A.prototype.toString = qn; +function qn(e) { + var t = [], r = this.nodeType === nt && this.documentElement || this, n = r.prefix, u = r.namespaceURI; + if (u && n == null) { + var n = r.lookupPrefix(u); if (n == null) - var o = [ - { namespace: i, prefix: null } + var i = [ + { namespace: u, prefix: null } //{namespace:uri,prefix:''} ]; } - return ae(this, r, t, e, o), r.join(""); + return we(this, t, e, i), t.join(""); } -function Lt(t, e, r) { - var u = t.prefix || "", n = t.namespaceURI; - if (!n || u === "xml" && n === ye.XML || n === ye.XMLNS) +function $r(e, t, r) { + var n = e.prefix || "", u = e.namespaceURI; + if (!u || n === "xml" && u === te.XML || u === te.XMLNS) return !1; for (var i = r.length; i--; ) { - var o = r[i]; - if (o.prefix === u) - return o.namespace !== n; + var a = r[i]; + if (a.prefix === n) + return a.namespace !== u; } return !0; } -function He(t, e, r) { - t.push(" ", e, '="', r.replace(/[<>&"\t\n\r]/g, wr), '"'); +function qt(e, t, r) { + e.push(" ", t, '="', r.replace(/[<>&"\t\n\r]/g, Rn), '"'); } -function ae(t, e, r, u, n) { - if (n || (n = []), u) - if (t = u(t), t) { - if (typeof t == "string") { - e.push(t); +function we(e, t, r, n) { + n || (n = []); + var u = e.nodeType === nt ? e : e.ownerDocument, i = u.type === "html"; + if (r) + if (e = r(e), e) { + if (typeof e == "string") { + t.push(e); return; } } else return; - switch (t.nodeType) { - case P: - var i = t.attributes, o = i.length, y = t.firstChild, a = t.tagName; - r = ye.isHTML(t.namespaceURI) || r; - var s = a; - if (!r && !t.prefix && t.namespaceURI) { - for (var l, c = 0; c < i.length; c++) - if (i.item(c).name === "xmlns") { - l = i.item(c).value; + switch (e.nodeType) { + case Y: + var a = e.attributes, o = a.length, B = e.firstChild, s = e.tagName, c = s; + if (!i && !e.prefix && e.namespaceURI) { + for (var l, f = 0; f < a.length; f++) + if (a.item(f).name === "xmlns") { + l = a.item(f).value; break; } if (!l) - for (var f = n.length - 1; f >= 0; f--) { - var p = n[f]; - if (p.prefix === "" && p.namespace === t.namespaceURI) { - l = p.namespace; + for (var p = n.length - 1; p >= 0; p--) { + var m = n[p]; + if (m.prefix === "" && m.namespace === e.namespaceURI) { + l = m.namespace; break; } } - if (l !== t.namespaceURI) - for (var f = n.length - 1; f >= 0; f--) { - var p = n[f]; - if (p.namespace === t.namespaceURI) { - p.prefix && (s = p.prefix + ":" + a); + if (l !== e.namespaceURI) + for (var p = n.length - 1; p >= 0; p--) { + var m = n[p]; + if (m.namespace === e.namespaceURI) { + m.prefix && (c = m.prefix + ":" + s); break; } } } - e.push("<", s); - for (var h = 0; h < o; h++) { - var g = i.item(h); - g.prefix == "xmlns" ? n.push({ prefix: g.localName, namespace: g.value }) : g.nodeName == "xmlns" && n.push({ prefix: "", namespace: g.value }); + t.push("<", c); + for (var b = 0; b < o; b++) { + var T = a.item(b); + T.prefix == "xmlns" ? n.push({ + prefix: T.localName, + namespace: T.value + }) : T.nodeName == "xmlns" && n.push({ prefix: "", namespace: T.value }); } - for (var h = 0; h < o; h++) { - var g = i.item(h); - if (Lt(g, r, n)) { - var v = g.prefix || "", b = g.namespaceURI; - He(e, v ? "xmlns:" + v : "xmlns", b), n.push({ prefix: v, namespace: b }); + for (var b = 0; b < o; b++) { + var T = a.item(b); + if ($r(T, i, n)) { + var w = T.prefix || "", I = T.namespaceURI; + qt(t, w ? "xmlns:" + w : "xmlns", I), n.push({ prefix: w, namespace: I }); } - ae(g, e, r, u, n); + we(T, t, r, n); } - if (a === s && Lt(t, r, n)) { - var v = t.prefix || "", b = t.namespaceURI; - He(e, v ? "xmlns:" + v : "xmlns", b), n.push({ prefix: v, namespace: b }); + if (s === c && $r(e, i, n)) { + var w = e.prefix || "", I = e.namespaceURI; + qt(t, w ? "xmlns:" + w : "xmlns", I), n.push({ prefix: w, namespace: I }); } - if (y || r && !/^(?:meta|link|img|br|hr|input)$/i.test(a)) { - if (e.push(">"), r && /^script$/i.test(a)) - for (; y; ) - y.data ? e.push(y.data) : ae(y, e, r, u, n.slice()), y = y.nextSibling; + var re = !B; + if (re && (i || e.namespaceURI === te.HTML) && (re = Bo(s)), re) + t.push("/>"); + else { + if (t.push(">"), i && Io(s)) + for (; B; ) + B.data ? t.push(B.data) : we(B, t, r, n.slice()), B = B.nextSibling; else - for (; y; ) - ae(y, e, r, u, n.slice()), y = y.nextSibling; - e.push(""); - } else - e.push("/>"); + for (; B; ) + we(B, t, r, n.slice()), B = B.nextSibling; + t.push(""); + } return; - case br: - case G: - for (var y = t.firstChild; y; ) - ae(y, e, r, u, n.slice()), y = y.nextSibling; + case nt: + case ae: + for (var B = e.firstChild; B; ) + we(B, t, r, n.slice()), B = B.nextSibling; return; - case ce: - return He(e, t.name, t.value); - case $e: - return e.push( - t.data.replace(/[<&>]/g, wr) - ); - case mr: - return e.push(""); - case vr: - return e.push(""); - case Er: - var Y = t.publicId, A = t.systemId; - if (e.push(""); - else if (A && A != ".") - e.push(" SYSTEM ", A, ">"); - else { - var O = t.internalSubset; - O && e.push(" [", O, "]"), e.push(">"); - } + case Be: + return qt(t, e.name, e.value); + case vt: + return t.push(e.data.replace(/[<&>]/g, Rn)); + case Cn: + return t.push(Q.CDATA_START, e.data, Q.CDATA_END); + case Sn: + return t.push(Q.COMMENT_START, e.data, Q.COMMENT_END); + case On: + var K = e.publicId, U = e.systemId; + t.push(Q.DOCTYPE_DECL_START, " ", e.name), K ? (t.push(" ", Q.PUBLIC, " ", K), U && U !== "." && t.push(" ", U)) : U && U !== "." && t.push(" ", Q.SYSTEM, " ", U), e.internalSubset && t.push(" [", e.internalSubset, "]"), t.push(">"); return; - case Dr: - return e.push(""); - case gr: - return e.push("&", t.nodeName, ";"); + case wn: + return t.push(""); + case Tn: + return t.push("&", e.nodeName, ";"); default: - e.push("??", t.nodeName); + t.push("??", e.nodeName); } } -function Fr(t, e, r) { - var u; - switch (e.nodeType) { - case P: - u = e.cloneNode(!1), u.ownerDocument = t; - case G: +function $n(e, t, r) { + var n; + switch (t.nodeType) { + case Y: + n = t.cloneNode(!1), n.ownerDocument = e; + case ae: break; - case ce: + case Be: r = !0; break; } - if (u || (u = e.cloneNode(!1)), u.ownerDocument = t, u.parentNode = null, r) - for (var n = e.firstChild; n; ) - u.appendChild(Fr(t, n, r)), n = n.nextSibling; - return u; + if (n || (n = t.cloneNode(!1)), n.ownerDocument = e, n.parentNode = null, r) + for (var u = t.firstChild; u; ) + n.appendChild($n(e, u, r)), u = u.nextSibling; + return n; } -function Ke(t, e, r) { - var u = new e.constructor(); - for (var n in e) - if (Object.prototype.hasOwnProperty.call(e, n)) { - var i = e[n]; - typeof i != "object" && i != u[n] && (u[n] = i); +function Vt(e, t, r) { + var n = new t.constructor(P); + for (var u in t) + if (Ie(t, u)) { + var i = t[u]; + typeof i != "object" && i != n[u] && (n[u] = i); } - switch (e.childNodes && (u.childNodes = new z()), u.ownerDocument = t, u.nodeType) { - case P: - var o = e.attributes, a = u.attributes = new Me(), s = o.length; - a._ownerElement = u; - for (var l = 0; l < s; l++) - u.setAttributeNode(Ke(t, o.item(l), !0)); + switch (t.childNodes && (n.childNodes = new M()), n.ownerDocument = e, n.nodeType) { + case Y: + var a = t.attributes, o = n.attributes = new xe(), s = a.length; + o._ownerElement = n; + for (var c = 0; c < s; c++) + n.setAttributeNode(Vt(e, a.item(c), !0)); break; - case ce: + case Be: r = !0; } if (r) - for (var c = e.firstChild; c; ) - u.appendChild(Ke(t, c, r)), c = c.nextSibling; - return u; + for (var l = t.firstChild; l; ) + n.appendChild(Vt(e, l, r)), l = l.nextSibling; + return n; } -function kr(t, e, r) { - t[e] = r; +function jn(e, t, r) { + e[t] = r; } try { if (Object.defineProperty) { - let t = function(e) { - switch (e.nodeType) { - case P: - case G: + let e = function(t) { + switch (t.nodeType) { + case Y: + case ae: var r = []; - for (e = e.firstChild; e; ) - e.nodeType !== 7 && e.nodeType !== 8 && r.push(t(e)), e = e.nextSibling; + for (t = t.firstChild; t; ) + t.nodeType !== 7 && t.nodeType !== 8 && r.push(e(t)), t = t.nextSibling; return r.join(""); default: - return e.nodeValue; + return t.nodeValue; } }; - Object.defineProperty(le.prototype, "length", { + Object.defineProperty(he.prototype, "length", { get: function() { - return it(this), this.$$length; + return wt(this), this.$$length; } - }), Object.defineProperty(D.prototype, "textContent", { + }), Object.defineProperty(A.prototype, "textContent", { get: function() { - return t(this); + return e(this); }, - set: function(e) { + set: function(t) { switch (this.nodeType) { - case P: - case G: + case Y: + case ae: for (; this.firstChild; ) this.removeChild(this.firstChild); - (e || String(e)) && this.appendChild(this.ownerDocument.createTextNode(e)); + (t || String(t)) && this.appendChild(this.ownerDocument.createTextNode(t)); break; default: - this.data = e, this.value = e, this.nodeValue = e; + this.data = t, this.value = t, this.nodeValue = t; } } - }), kr = function(e, r, u) { - e["$$" + r] = u; + }), jn = function(t, r, n) { + t["$$" + r] = n; }; } } catch { } -W.DocumentType = Ve; -W.DOMException = w; -W.DOMImplementation = Nr; -W.Element = te; -W.Node = D; -W.NodeList = z; -W.XMLSerializer = xr; -var Rr = {}; -(function(t) { - var e = H.freeze; - t.XML_ENTITIES = e({ +R._updateLiveList = wt; +R.Attr = ge; +R.CDATASection = Ot; +R.CharacterData = Le; +R.Comment = St; +R.Document = se; +R.DocumentFragment = ct; +R.DocumentType = It; +R.DOMImplementation = xn; +R.Element = le; +R.Entity = ur; +R.EntityReference = Bt; +R.LiveNodeList = he; +R.NamedNodeMap = xe; +R.Node = A; +R.NodeList = M; +R.Notation = nr; +R.Text = st; +R.ProcessingInstruction = xt; +R.XMLSerializer = Pn; +var Un = {}; +(function(e) { + var t = x.freeze; + e.XML_ENTITIES = t({ amp: "&", apos: "'", gt: ">", lt: "<", quot: '"' - }), t.HTML_ENTITIES = e({ + }), e.HTML_ENTITIES = t({ Aacute: "Á", aacute: "á", Abreve: "Ă", @@ -5992,153 +7129,176 @@ var Rr = {}; zscr: "𝓏", zwj: "‍", zwnj: "‌" - }), t.entityMap = t.HTML_ENTITIES; -})(Rr); -var ht = {}, we = H.NAMESPACE, We = /[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]/, Vt = new RegExp("[\\-\\.0-9" + We.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"), Ut = new RegExp("^" + We.source + Vt.source + "*(?::" + We.source + Vt.source + "*)?$"), De = 0, X = 1, ue = 2, ve = 3, ne = 4, ie = 5, be = 6, ke = 7; -function fe(t, e) { - this.message = t, this.locator = e, Error.captureStackTrace && Error.captureStackTrace(this, fe); -} -fe.prototype = new Error(); -fe.prototype.name = fe.name; -function qr() { -} -qr.prototype = { - parse: function(t, e, r) { - var u = this.domBuilder; - u.startDocument(), $r(e, e = {}), Bn( - t, - e, - r, - u, - this.errorHandler - ), u.endDocument(); + }), e.entityMap = e.HTML_ENTITIES; +})(Un); +var Rt = {}, ke = x, v = E, Vn = Ae, Ho = ke.isHTMLEscapableRawTextElement, Go = ke.isHTMLMimeType, zo = ke.isHTMLRawTextElement, ut = ke.hasOwn, jr = ke.NAMESPACE, Ur = Vn.ParseError, Jo = Vn.DOMException, Ve = 0, ie = 1, be = 2, He = 3, ye = 4, Ce = 5, Ge = 6, Et = 7; +function Hn() { +} +Hn.prototype = { + parse: function(e, t, r) { + var n = this.domBuilder; + n.startDocument(), Gn(t, t = /* @__PURE__ */ Object.create(null)), Xo(e, t, r, n, this.errorHandler), n.endDocument(); } }; -function Bn(t, e, r, u, n) { - function i(N) { - if (N > 65535) { - N -= 65536; - var M = 55296 + (N >> 10), _r = 56320 + (N & 1023); - return String.fromCharCode(M, _r); +var ir = /&#?\w+;?/g; +function Xo(e, t, r, n, u) { + var i = Go(n.mimeType); + if (e.indexOf(v.UNICODE_REPLACEMENT_CHARACTER) >= 0) + return u.fatalError("Unicode replacement character detected, source encoding issues?"); + function a(y) { + if (y > 65535) { + y -= 65536; + var z = 55296 + (y >> 10), lt = 56320 + (y & 1023); + return String.fromCharCode(z, lt); } else - return String.fromCharCode(N); - } - function o(N) { - var M = N.slice(1, -1); - return Object.hasOwnProperty.call(r, M) ? r[M] : M.charAt(0) === "#" ? i(parseInt(M.substr(1).replace("x", "0x"))) : (n.error("entity not found:" + N), N); - } - function a(N) { - if (N > v) { - var M = t.substring(v, N).replace(/&#?\w+;/g, o); - p && s(v), u.characters(M, 0, N - v), v = N; + return String.fromCharCode(y); + } + function o(y) { + var z = y[y.length - 1] === ";" ? y : y + ";"; + if (!i && z !== y) + return u.error("EntityRef: expecting ;"), y; + var lt = v.Reference.exec(z); + if (!lt || lt[0].length !== z.length) + return u.error("entity not matching Reference production: " + y), y; + var ft = z.slice(1, -1); + return ut(r, ft) ? r[ft] : ft.charAt(0) === "#" ? a(parseInt(ft.substr(1).replace("x", "0x"))) : (u.error("entity not found:" + y), y); + } + function s(y) { + if (y > w) { + var z = e.substring(w, y).replace(ir, o); + m && c(w), n.characters(z, 0, y - w), w = y; } } - function s(N, M) { - for (; N >= c && (M = f.exec(t)); ) - l = M.index, c = l + M[0].length, p.lineNumber++; - p.columnNumber = N - l + 1; + function c(y, z) { + for (; y >= f && (z = p.exec(e)); ) + l = z.index, f = l + z[0].length, m.lineNumber++; + m.columnNumber = y - l + 1; } - for (var l = 0, c = 0, f = /.*(?:\r\n?|\n)|.*$/g, p = u.locator, h = [{ currentNSMap: e }], g = {}, v = 0; ; ) { + for (var l = 0, f = 0, p = /.*(?:\r\n?|\n)|.*$/g, m = n.locator, b = [{ currentNSMap: t }], T = [], w = 0; ; ) { try { - var b = t.indexOf("<", v); - if (b < 0) { - if (!t.substr(v).match(/^\s*$/)) { - var y = u.doc, Y = y.createTextNode(t.substr(v)); - y.appendChild(Y), u.currentElement = Y; + var I = e.indexOf("<", w); + if (I < 0) { + if (!i && T.length > 0) + return u.fatalError("unclosed xml tag(s): " + T.join(", ")); + if (!e.substring(w).match(/^\s*$/)) { + var re = n.doc, B = re.createTextNode(e.substr(w)); + if (re.documentElement) + return u.error("Extra content at the end of the document"); + re.appendChild(B), n.currentElement = B; } return; } - switch (b > v && a(b), t.charAt(b + 1)) { + if (I > w) { + var K = e.substring(w, I); + !i && T.length === 0 && (K = K.replace(new RegExp(v.S_OPT.source, "g"), ""), K && u.error("Unexpected content outside root element: '" + K + "'")), s(I); + } + switch (e.charAt(I + 1)) { case "/": - var x = t.indexOf(">", b + 3), A = t.substring(b + 2, x).replace(/[ \t\n\r]+$/g, ""), O = h.pop(); - x < 0 ? (A = t.substring(b + 2).replace(/[\s<].*/, ""), n.error("end tag name: " + A + " is not complete:" + O.tagName), x = b + 1 + A.length) : A.match(/\s", I + 2), U = e.substring(I + 2, H > 0 ? H : void 0); + if (!U) + return u.fatalError("end tag name missing"); + var qe = H > 0 && v.reg("^", v.QName_group, v.S_OPT, "$").exec(U); + if (!qe) + return u.fatalError('end tag name contains invalid characters: "' + U + '"'); + if (!n.currentElement && !n.doc.documentElement) + return; + var $e = T[T.length - 1] || n.currentElement.tagName || n.doc.documentElement.tagName || ""; + if ($e !== qe[1]) { + var Mt = qe[1].toLowerCase(); + if (!i || $e.toLowerCase() !== Mt) + return u.fatalError('Opening and ending tag mismatch: "' + $e + '" != "' + U + '"'); + } + var _t = b.pop(); + T.pop(); + var Ft = _t.localNSMap; + if (n.endElement(_t.uri, _t.localName, $e), Ft) + for (var ar in Ft) + ut(Ft, ar) && n.endPrefixMapping(ar); + H++; break; case "?": - p && s(b), x = In(t, b, u); + m && c(I), H = Qo(e, I, n, u); break; case "!": - p && s(b), x = xn(t, b, u, n); + m && c(I), H = Jn(e, I, n, u, i); break; default: - p && s(b); - var q = new Mr(), Ge = h[h.length - 1].currentNSMap, x = Tn(t, b, q, Ge, o, n), mt = q.length; - if (!q.closed && On(t, x, q.tagName, g) && (q.closed = !0, r.nbsp || n.warning("unclosed xml attribute")), p && mt) { - for (var jr = zt(p, {}), Je = 0; Je < mt; Je++) { - var gt = q[Je]; - s(gt.offset), gt.locator = zt(p, {}); + m && c(I); + var V = new Xn(), Lt = b[b.length - 1].currentNSMap, H = Yo(e, I, V, Lt, o, u, i), sr = V.length; + if (V.closed || (i && ke.isHTMLVoidElement(V.tagName) ? V.closed = !0 : T.push(V.tagName)), m && sr) { + for (var Kn = Vr(m, {}), kt = 0; kt < sr; kt++) { + var cr = V[kt]; + c(cr.offset), cr.locator = Vr(m, {}); } - u.locator = jr, Gt(q, u, Ge) && h.push(q), u.locator = p; + n.locator = Kn, Hr(V, n, Lt) && b.push(V), n.locator = m; } else - Gt(q, u, Ge) && h.push(q); - we.isHTML(q.uri) && !q.closed ? x = Sn(t, x, q.tagName, o, u) : x++; + Hr(V, n, Lt) && b.push(V); + i && !V.closed ? H = Ko(e, H, V.tagName, o, n) : H++; } - } catch (N) { - if (N instanceof fe) - throw N; - n.error("element parse error: " + N), x = -1; + } catch (y) { + if (y instanceof Ur) + throw y; + if (y instanceof Jo) + throw new Ur(y.name + ": " + y.message, n.locator, y); + u.error("element parse error: " + y), H = -1; } - x > v ? v = x : a(Math.max(b, v) + 1); + H > w ? w = H : s(Math.max(I, w) + 1); } } -function zt(t, e) { - return e.lineNumber = t.lineNumber, e.columnNumber = t.columnNumber, e; +function Vr(e, t) { + return t.lineNumber = e.lineNumber, t.columnNumber = e.columnNumber, t; } -function Tn(t, e, r, u, n, i) { - function o(p, h, g) { - r.attributeNames.hasOwnProperty(p) && i.fatalError("Attribute " + p + " redefined"), r.addValue( - p, +function Yo(e, t, r, n, u, i, a) { + function o(m, b, T) { + if (ut(r.attributeNames, m)) + return i.fatalError("Attribute " + m + " redefined"); + if (!a && b.indexOf("<") >= 0) + return i.fatalError("Unescaped '<' not allowed in attributes values"); + r.addValue( + m, // @see https://www.w3.org/TR/xml/#AVNormalize // since the xmldom sax parser does not "interpret" DTD the following is not implemented: // - recursive replacement of (DTD) entity references // - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA - h.replace(/[\t\n\r]/g, " ").replace(/&#?\w+;/g, n), - g + b.replace(/[\t\n\r]/g, " ").replace(ir, u), + T ); } - for (var a, s, l = ++e, c = De; ; ) { - var f = t.charAt(l); - switch (f) { + for (var s, c, l = ++t, f = Ve; ; ) { + var p = e.charAt(l); + switch (p) { case "=": - if (c === X) - a = t.slice(e, l), c = ve; - else if (c === ue) - c = ve; + if (f === ie) + s = e.slice(t, l), f = He; + else if (f === be) + f = He; else throw new Error("attribute equal must after attrName"); break; case "'": case '"': - if (c === ve || c === X) - if (c === X && (i.warning('attribute value must after "="'), a = t.slice(e, l)), e = l + 1, l = t.indexOf(f, e), l > 0) - s = t.slice(e, l), o(a, s, e - 1), c = ie; + if (f === He || f === ie) + if (f === ie && (i.warning('attribute value must after "="'), s = e.slice(t, l)), t = l + 1, l = e.indexOf(p, t), l > 0) + c = e.slice(t, l), o(s, c, t - 1), f = Ce; else - throw new Error("attribute value no end '" + f + "' match"); - else if (c == ne) - s = t.slice(e, l), o(a, s, e), i.warning('attribute "' + a + '" missed start quot(' + f + ")!!"), e = l + 1, c = ie; + throw new Error("attribute value no end '" + p + "' match"); + else if (f == ye) + c = e.slice(t, l), o(s, c, t), i.warning('attribute "' + s + '" missed start quot(' + p + ")!!"), t = l + 1, f = Ce; else throw new Error('attribute value must after "="'); break; case "/": - switch (c) { - case De: - r.setTagName(t.slice(e, l)); + switch (f) { + case Ve: + r.setTagName(e.slice(t, l)); + case Ce: + case Ge: + case Et: + f = Et, r.closed = !0; + case ye: case ie: - case be: - case ke: - c = ke, r.closed = !0; - case ne: - case X: break; - case ue: + case be: r.closed = !0; break; default: @@ -6146,164 +7306,262 @@ function Tn(t, e, r, u, n, i) { } break; case "": - return i.error("unexpected end of input"), c == De && r.setTagName(t.slice(e, l)), l; + return i.error("unexpected end of input"), f == Ve && r.setTagName(e.slice(t, l)), l; case ">": - switch (c) { - case De: - r.setTagName(t.slice(e, l)); + switch (f) { + case Ve: + r.setTagName(e.slice(t, l)); + case Ce: + case Ge: + case Et: + break; + case ye: case ie: + c = e.slice(t, l), c.slice(-1) === "/" && (r.closed = !0, c = c.slice(0, -1)); case be: - case ke: + f === be && (c = s), f == ye ? (i.warning('attribute "' + c + '" missed quot(")!'), o(s, c, t)) : (a || i.warning('attribute "' + c + '" missed value!! "' + c + '" instead!!'), o(c, c, t)); break; - case ne: - case X: - s = t.slice(e, l), s.slice(-1) === "/" && (r.closed = !0, s = s.slice(0, -1)); - case ue: - c === ue && (s = a), c == ne ? (i.warning('attribute "' + s + '" missed quot(")!'), o(a, s, e)) : ((!we.isHTML(u[""]) || !s.match(/^(?:disabled|checked|selected)$/i)) && i.warning('attribute "' + s + '" missed value!! "' + s + '" instead!!'), o(s, s, e)); - break; - case ve: - throw new Error("attribute value missed!!"); + case He: + if (!a) + return i.fatalError(`AttValue: ' or " expected`); } return l; case "€": - f = " "; + p = " "; default: - if (f <= " ") - switch (c) { - case De: - r.setTagName(t.slice(e, l)), c = be; - break; - case X: - a = t.slice(e, l), c = ue; + if (p <= " ") + switch (f) { + case Ve: + r.setTagName(e.slice(t, l)), f = Ge; break; - case ne: - var s = t.slice(e, l); - i.warning('attribute "' + s + '" missed quot(")!!'), o(a, s, e); case ie: - c = be; + s = e.slice(t, l), f = be; + break; + case ye: + var c = e.slice(t, l); + i.warning('attribute "' + c + '" missed quot(")!!'), o(s, c, t); + case Ce: + f = Ge; break; } else - switch (c) { - case ue: - r.tagName, (!we.isHTML(u[""]) || !a.match(/^(?:disabled|checked|selected)$/i)) && i.warning('attribute "' + a + '" missed value!! "' + a + '" instead2!!'), o(a, a, e), e = l, c = X; - break; - case ie: - i.warning('attribute space is required"' + a + '"!!'); + switch (f) { case be: - c = X, e = l; + a || i.warning('attribute "' + s + '" missed value!! "' + s + '" instead2!!'), o(s, s, t), t = l, f = ie; + break; + case Ce: + i.warning('attribute space is required"' + s + '"!!'); + case Ge: + f = ie, t = l; break; - case ve: - c = ne, e = l; + case He: + f = ye, t = l; break; - case ke: + case Et: throw new Error("elements closed character '/' and '>' must be connected to"); } } l++; } } -function Gt(t, e, r) { - for (var u = t.tagName, n = null, f = t.length; f--; ) { - var i = t[f], o = i.qName, a = i.value, p = o.indexOf(":"); +function Hr(e, t, r) { + for (var n = e.tagName, u = null, f = e.length; f--; ) { + var i = e[f], a = i.qName, o = i.value, p = a.indexOf(":"); if (p > 0) - var s = i.prefix = o.slice(0, p), l = o.slice(p + 1), c = s === "xmlns" && l; + var s = i.prefix = a.slice(0, p), c = a.slice(p + 1), l = s === "xmlns" && c; else - l = o, s = null, c = o === "xmlns" && ""; - i.localName = l, c !== !1 && (n == null && (n = {}, $r(r, r = {})), r[c] = n[c] = a, i.uri = we.XMLNS, e.startPrefixMapping(c, a)); - } - for (var f = t.length; f--; ) { - i = t[f]; - var s = i.prefix; - s && (s === "xml" && (i.uri = we.XML), s !== "xmlns" && (i.uri = r[s || ""])); - } - var p = u.indexOf(":"); - p > 0 ? (s = t.prefix = u.slice(0, p), l = t.localName = u.slice(p + 1)) : (s = null, l = t.localName = u); - var h = t.uri = r[s || ""]; - if (e.startElement(h, l, u, t), t.closed) { - if (e.endElement(h, l, u), n) - for (s in n) - Object.prototype.hasOwnProperty.call(n, s) && e.endPrefixMapping(s); + c = a, s = null, l = a === "xmlns" && ""; + i.localName = c, l !== !1 && (u == null && (u = /* @__PURE__ */ Object.create(null), Gn(r, r = /* @__PURE__ */ Object.create(null))), r[l] = u[l] = o, i.uri = jr.XMLNS, t.startPrefixMapping(l, o)); + } + for (var f = e.length; f--; ) + i = e[f], i.prefix && (i.prefix === "xml" && (i.uri = jr.XML), i.prefix !== "xmlns" && (i.uri = r[i.prefix])); + var p = n.indexOf(":"); + p > 0 ? (s = e.prefix = n.slice(0, p), c = e.localName = n.slice(p + 1)) : (s = null, c = e.localName = n); + var m = e.uri = r[s || ""]; + if (t.startElement(m, c, n, e), e.closed) { + if (t.endElement(m, c, n), u) + for (s in u) + ut(u, s) && t.endPrefixMapping(s); } else - return t.currentNSMap = r, t.localNSMap = n, !0; + return e.currentNSMap = r, e.localNSMap = u, !0; } -function Sn(t, e, r, u, n) { - if (/^(?:script|textarea)$/i.test(r)) { - var i = t.indexOf("", e), o = t.substring(e + 1, i); - if (/[&<]/.test(o)) - return /^script$/i.test(r) ? (n.characters(o, 0, o.length), i) : (o = o.replace(/&#?\w+;/g, u), n.characters(o, 0, o.length), i); +function Ko(e, t, r, n, u) { + var i = Ho(r); + if (i || zo(r)) { + var a = e.indexOf("", t), o = e.substring(t + 1, a); + return i && (o = o.replace(ir, n)), u.characters(o, 0, o.length), a; } - return e + 1; + return t + 1; } -function On(t, e, r, u) { - var n = u[r]; - return n == null && (n = t.lastIndexOf(""), n < e && (n = t.lastIndexOf("", e + 4); - return i > e ? (r.comment(t, e + 4, i - e - 4), i + 3) : (u.error("Unclosed comment"), -1); - } else - return -1; - default: - if (t.substr(e + 3, 6) == "CDATA[") { - var i = t.indexOf("]]>", e + 9); - return r.startCDATA(), r.characters(t, e + 9, i - e - 9), r.endCDATA(), i + 3; - } - var o = Fn(t, e), a = o.length; - if (a > 1 && /!doctype/i.test(o[0][0])) { - var s = o[1][0], l = !1, c = !1; - a > 3 && (/^public$/i.test(o[2][0]) ? (l = o[3][0], c = a > 4 && o[4][0]) : /^system$/i.test(o[2][0]) && (c = o[3][0])); - var f = o[a - 1]; - return r.startDTD(s, l, c), r.endDTD(), f.index + f[0].length; + var a = i.getMatch(v.Comment); + return a ? (r.comment(a, v.COMMENT_START.length, a.length - v.COMMENT_START.length - v.COMMENT_END.length), i.getIndex()) : n.fatalError("comment is not well-formed at position " + i.getIndex()); + case "[": + var o = i.getMatch(v.CDSect); + return o ? !u && !r.currentElement ? n.fatalError("CDATA outside of element") : (r.startCDATA(), r.characters(o, v.CDATA_START.length, o.length - v.CDATA_START.length - v.CDATA_END.length), r.endCDATA(), i.getIndex()) : n.fatalError("Invalid CDATA starting at position " + t); + case "D": { + if (r.doc && r.doc.documentElement) + return n.fatalError("Doctype not allowed inside or after documentElement at position " + i.getIndex()); + if (!i.substringStartsWith(v.DOCTYPE_DECL_START)) + return n.fatalError("Expected " + v.DOCTYPE_DECL_START + " at position " + i.getIndex()); + if (i.skip(v.DOCTYPE_DECL_START.length), i.skipBlanks() < 1) + return n.fatalError("Expected whitespace after " + v.DOCTYPE_DECL_START + " at position " + i.getIndex()); + var s = { + name: void 0, + publicId: void 0, + systemId: void 0, + internalSubset: void 0 + }; + if (s.name = i.getMatch(v.Name), !s.name) + return n.fatalError("doctype name missing or contains unexpected characters at position " + i.getIndex()); + if (i.skipBlanks(), i.substringStartsWith(v.PUBLIC) || i.substringStartsWith(v.SYSTEM)) { + var c = v.ExternalID_match.exec(i.substringFromIndex()); + if (!c) + return n.fatalError("doctype external id is not well-formed at position " + i.getIndex()); + c.groups.SystemLiteralOnly !== void 0 ? s.systemId = c.groups.SystemLiteralOnly : (s.systemId = c.groups.SystemLiteral, s.publicId = c.groups.PubidLiteral), i.skip(c[0].length); } + return i.skipBlanks(), s.internalSubset = Wo(i, n), i.skipBlanks(), i.char() !== ">" ? n.fatalError("doctype not terminated with > at position " + i.getIndex()) : (i.skip(1), r.startDTD(s.name, s.publicId, s.systemId, s.internalSubset), r.endDTD(), i.getIndex()); + } + default: + return n.fatalError('Not well-formed XML starting with "", e); - if (u) { - var n = t.substring(e, u).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/); - return n ? (n[0].length, r.processingInstruction(n[1], n[2]), u + 2) : -1; +function Qo(e, t, r, n) { + var u = e.substring(t).match(v.PI); + if (!u) + return n.fatalError("Invalid processing instruction starting at position " + t); + if (u[1].toLowerCase() === "xml") { + if (t > 0) + return n.fatalError( + "processing instruction at position " + t + " is an xml declaration which is only at the start of the document" + ); + if (!v.XMLDecl.test(e.substring(t))) + return n.fatalError("xml declaration is not well-formed"); } - return -1; + return r.processingInstruction(u[1], u[2]), t + u[0].length; } -function Mr() { - this.attributeNames = {}; +function Xn() { + this.attributeNames = /* @__PURE__ */ Object.create(null); } -Mr.prototype = { - setTagName: function(t) { - if (!Ut.test(t)) - throw new Error("invalid tagName:" + t); - this.tagName = t; +Xn.prototype = { + setTagName: function(e) { + if (!v.QName_exact.test(e)) + throw new Error("invalid tagName:" + e); + this.tagName = e; }, - addValue: function(t, e, r) { - if (!Ut.test(t)) - throw new Error("invalid attribute:" + t); - this.attributeNames[t] = this.length, this[this.length++] = { qName: t, value: e, offset: r }; + addValue: function(e, t, r) { + if (!v.QName_exact.test(e)) + throw new Error("invalid attribute:" + e); + this.attributeNames[e] = this.length, this[this.length++] = { qName: e, value: t, offset: r }; }, length: 0, - getLocalName: function(t) { - return this[t].localName; + getLocalName: function(e) { + return this[e].localName; }, - getLocator: function(t) { - return this[t].locator; + getLocator: function(e) { + return this[e].locator; }, - getQName: function(t) { - return this[t].qName; + getQName: function(e) { + return this[e].qName; }, - getURI: function(t) { - return this[t].uri; + getURI: function(e) { + return this[e].uri; }, - getValue: function(t) { - return this[t].value; + getValue: function(e) { + return this[e].value; } // ,getIndex:function(uri, localName)){ // if(localName){ @@ -6316,105 +7574,105 @@ Mr.prototype = { // getType:function(uri,localName){} // getType:function(i){}, }; -function Fn(t, e) { - var r, u = [], n = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g; - for (n.lastIndex = e, n.exec(t); r = n.exec(t); ) - if (u.push(r), r[1]) return u; -} -ht.XMLReader = qr; -ht.ParseError = fe; -var kn = H, Rn = W, Jt = Rr, Pr = ht, qn = Rn.DOMImplementation, Ht = kn.NAMESPACE, $n = Pr.ParseError, Mn = Pr.XMLReader; -function Pn(t) { - return t.replace(/\r[\n\u0085]/g, ` +Rt.XMLReader = Hn; +Rt.parseUtils = zn; +Rt.parseDoctypeCommentOrCData = Jn; +var Ne = x, Zo = R, ea = Ae, Gr = Un, ta = Rt, ra = Zo.DOMImplementation, na = Ne.hasDefaultHTMLNamespace, ua = Ne.isHTMLMimeType, ia = Ne.isValidMimeType, Yn = Ne.MIME_TYPE, $t = Ne.NAMESPACE, zr = ea.ParseError, oa = ta.XMLReader; +function aa(e) { + return e.replace(/\r[\n\u0085]/g, ` `).replace(/[\r\u0085\u2028]/g, ` `); } -function jn(t) { - this.options = t || { locator: {} }; -} -jn.prototype.parseFromString = function(t, e) { - var r = this.options, u = new Mn(), n = r.domBuilder || new ze(), i = r.errorHandler, o = r.locator, a = r.xmlns || {}, s = /\/x?html?$/.test(e), l = s ? Jt.HTML_ENTITIES : Jt.XML_ENTITIES; - o && n.setDocumentLocator(o), u.errorHandler = _n(i, n, o), u.domBuilder = r.domBuilder || n, s && (a[""] = Ht.HTML), a.xml = a.xml || Ht.XML; - var c = r.normalizeLineEndings || Pn; - return t && typeof t == "string" ? u.parse( - c(t), - a, - l - ) : u.errorHandler.error("invalid doc source"), n.doc; +function sa(e) { + if (e = e || { locator: !0 }, this.assign = e.assign || Ne.assign, this.domHandler = e.domHandler || or, this.onError = e.onError || e.errorHandler, e.errorHandler && typeof e.errorHandler != "function") + throw new TypeError("errorHandler object is no longer supported, switch to onError!"); + e.errorHandler && e.errorHandler("warning", "The `errorHandler` option has been deprecated, use `onError` instead!", this), this.normalizeLineEndings = e.normalizeLineEndings || aa, this.locator = !!e.locator, this.xmlns = this.assign(/* @__PURE__ */ Object.create(null), e.xmlns); +} +sa.prototype.parseFromString = function(e, t) { + if (!ia(t)) + throw new TypeError('DOMParser.parseFromString: the provided mimeType "' + t + '" is not valid.'); + var r = this.assign(/* @__PURE__ */ Object.create(null), this.xmlns), n = Gr.XML_ENTITIES, u = r[""] || null; + na(t) ? (n = Gr.HTML_ENTITIES, u = $t.HTML) : t === Yn.XML_SVG_IMAGE && (u = $t.SVG), r[""] = u, r.xml = r.xml || $t.XML; + var i = new this.domHandler({ + mimeType: t, + defaultNamespace: u, + onError: this.onError + }), a = this.locator ? {} : void 0; + this.locator && i.setDocumentLocator(a); + var o = new oa(); + o.errorHandler = i, o.domBuilder = i; + var s = !Ne.isHTMLMimeType(t); + return s && typeof e != "string" && o.errorHandler.fatalError("source is not a string"), o.parse(this.normalizeLineEndings(String(e)), r, n), i.doc.documentElement || o.errorHandler.fatalError("missing root element"), i.doc; }; -function _n(t, e, r) { - if (!t) { - if (e instanceof ze) - return e; - t = e; - } - var u = {}, n = t instanceof Function; - r = r || {}; - function i(o) { - var a = t[o]; - !a && n && (a = t.length == 2 ? function(s) { - t(o, s); - } : t), u[o] = a && function(s) { - a("[xmldom " + o + "] " + s + Ye(r)); - } || function() { - }; - } - return i("warning"), i("error"), i("fatalError"), u; -} -function ze() { - this.cdata = !1; +function or(e) { + var t = e || {}; + this.mimeType = t.mimeType || Yn.XML_APPLICATION, this.defaultNamespace = t.defaultNamespace || null, this.cdata = !1, this.currentElement = void 0, this.doc = void 0, this.locator = void 0, this.onError = t.onError; } -function oe(t, e) { - e.lineNumber = t.lineNumber, e.columnNumber = t.columnNumber; +function Te(e, t) { + t.lineNumber = e.lineNumber, t.columnNumber = e.columnNumber; } -ze.prototype = { +or.prototype = { + /** + * Either creates an XML or an HTML document and stores it under `this.doc`. + * If it is an XML document, `this.defaultNamespace` is used to create it, + * and it will not contain any `childNodes`. + * If it is an HTML document, it will be created without any `childNodes`. + * + * @see http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html + */ startDocument: function() { - this.doc = new qn().createDocument(null, null, null), this.locator && (this.doc.documentURI = this.locator.systemId); + var e = new ra(); + this.doc = ua(this.mimeType) ? e.createHTMLDocument(!1) : e.createDocument(this.defaultNamespace, ""); }, - startElement: function(t, e, r, u) { - var n = this.doc, i = n.createElementNS(t, r || e), o = u.length; - Re(this, i), this.currentElement = i, this.locator && oe(this.locator, i); - for (var a = 0; a < o; a++) { - var t = u.getURI(a), s = u.getValue(a), r = u.getQName(a), l = n.createAttributeNS(t, r); - this.locator && oe(u.getLocator(a), l), l.value = l.nodeValue = s, i.setAttributeNode(l); + startElement: function(e, t, r, n) { + var u = this.doc, i = u.createElementNS(e, r || t), a = n.length; + gt(this, i), this.currentElement = i, this.locator && Te(this.locator, i); + for (var o = 0; o < a; o++) { + var e = n.getURI(o), s = n.getValue(o), r = n.getQName(o), c = u.createAttributeNS(e, r); + this.locator && Te(n.getLocator(o), c), c.value = c.nodeValue = s, i.setAttributeNode(c); } }, - endElement: function(t, e, r) { - var u = this.currentElement; - u.tagName, this.currentElement = u.parentNode; + endElement: function(e, t, r) { + this.currentElement = this.currentElement.parentNode; }, - startPrefixMapping: function(t, e) { + startPrefixMapping: function(e, t) { }, - endPrefixMapping: function(t) { + endPrefixMapping: function(e) { }, - processingInstruction: function(t, e) { - var r = this.doc.createProcessingInstruction(t, e); - this.locator && oe(this.locator, r), Re(this, r); + processingInstruction: function(e, t) { + var r = this.doc.createProcessingInstruction(e, t); + this.locator && Te(this.locator, r), gt(this, r); }, - ignorableWhitespace: function(t, e, r) { + ignorableWhitespace: function(e, t, r) { }, - characters: function(t, e, r) { - if (t = Xt.apply(this, arguments), t) { + characters: function(e, t, r) { + if (e = Jr.apply(this, arguments), e) { if (this.cdata) - var u = this.doc.createCDATASection(t); + var n = this.doc.createCDATASection(e); else - var u = this.doc.createTextNode(t); - this.currentElement ? this.currentElement.appendChild(u) : /^\s*$/.test(t) && this.doc.appendChild(u), this.locator && oe(this.locator, u); + var n = this.doc.createTextNode(e); + this.currentElement ? this.currentElement.appendChild(n) : /^\s*$/.test(e) && this.doc.appendChild(n), this.locator && Te(this.locator, n); } }, - skippedEntity: function(t) { + skippedEntity: function(e) { }, endDocument: function() { this.doc.normalize(); }, - setDocumentLocator: function(t) { - (this.locator = t) && (t.lineNumber = 0); + /** + * Stores the locator to be able to set the `columnNumber` and `lineNumber` + * on the created DOM nodes. + * + * @param {Locator} locator + */ + setDocumentLocator: function(e) { + e && (e.lineNumber = 0), this.locator = e; }, //LexicalHandler - comment: function(t, e, r) { - t = Xt.apply(this, arguments); - var u = this.doc.createComment(t); - this.locator && oe(this.locator, u), Re(this, u); + comment: function(e, t, r) { + e = Jr.apply(this, arguments); + var n = this.doc.createComment(e); + this.locator && Te(this.locator, n), gt(this, n); }, startCDATA: function() { this.cdata = !0; @@ -6422,87 +7680,116 @@ ze.prototype = { endCDATA: function() { this.cdata = !1; }, - startDTD: function(t, e, r) { + startDTD: function(e, t, r, n) { var u = this.doc.implementation; if (u && u.createDocumentType) { - var n = u.createDocumentType(t, e, r); - this.locator && oe(this.locator, n), Re(this, n), this.doc.doctype = n; + var i = u.createDocumentType(e, t, r, n); + this.locator && Te(this.locator, i), gt(this, i), this.doc.doctype = i; } }, + reportError: function(e, t) { + if (typeof this.onError == "function") + try { + this.onError(e, t, this); + } catch (r) { + throw new zr("Reporting " + e + ' "' + t + '" caused ' + r, this.locator); + } + else + console.error("[xmldom " + e + "] " + t, ca(this.locator)); + }, /** - * @see org.xml.sax.ErrorHandler - * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html + * @see http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html */ - warning: function(t) { - console.warn("[xmldom warning] " + t, Ye(this.locator)); + warning: function(e) { + this.reportError("warning", e); }, - error: function(t) { - console.error("[xmldom error] " + t, Ye(this.locator)); + error: function(e) { + this.reportError("error", e); }, - fatalError: function(t) { - throw new $n(t, this.locator); + /** + * This function reports a fatal error and throws a ParseError. + * + * @param {string} message + * - The message to be used for reporting and throwing the error. + * @returns {never} + * This function always throws an error and never returns a value. + * @throws {ParseError} + * Always throws a ParseError with the provided message. + */ + fatalError: function(e) { + throw this.reportError("fatalError", e), new zr(e, this.locator); } }; -function Ye(t) { - if (t) +function ca(e) { + if (e) return ` -@` + (t.systemId || "") + "#[line:" + t.lineNumber + ",col:" + t.columnNumber + "]"; -} -function Xt(t, e, r) { - return typeof t == "string" ? t.substr(e, r) : t.length >= e + r || e ? new java.lang.String(t, e, r) + "" : t; +@#[line:` + e.lineNumber + ",col:" + e.columnNumber + "]"; } -"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(t) { - ze.prototype[t] = function() { - return null; - }; -}); -function Re(t, e) { - t.currentElement ? t.currentElement.appendChild(e) : t.doc.appendChild(e); +function Jr(e, t, r) { + return typeof e == "string" ? e.substr(t, r) : e.length >= t + r || t ? new java.lang.String(e, t, r) + "" : e; } -const Kt = "USJ", U = ["figure", "note", "sidebar", "table"]; -Object.freeze(U); -class T { - constructor(e) { - E(this, "usj"); - E(this, "parentMapInternal"); - this.usj = e; +"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace( + /\w+/g, + function(e) { + or.prototype[e] = function() { + return null; + }; + } +); +function gt(e, t) { + e.currentElement ? e.currentElement.appendChild(t) : e.doc.appendChild(t); +} +var Pe = x; +Pe.assign; +Pe.hasDefaultHTMLNamespace; +Pe.isHTMLMimeType; +Pe.isValidMimeType; +Pe.MIME_TYPE; +Pe.NAMESPACE; +const Xr = "USJ", ne = ["figure", "note", "sidebar", "table"]; +Object.freeze(ne); +class L { + constructor(t) { + S(this, "usj"); + S(this, "parentMapInternal"); + this.usj = t; } // If new variables are created to speed up queries, they should be reset here usjChanged() { this.parentMapInternal = void 0; } // #region Directly using the JSONPath package to perform JSONPath query -> USJ node - findSingleValue(e) { - const r = Dt({ path: e, json: this.usj, wrap: !0 }); + findSingleValue(t) { + const r = lr({ path: t, json: this.usj, wrap: !0 }); if (r === void 0 || r.length === 0) return; if (!Array.isArray(r[0])) return r[0]; - const u = Dt({ path: e, json: this.usj, wrap: !1 }); - return u.length === 1 && Array.isArray(u[0]) ? u[0] : u; + const n = lr({ path: t, json: this.usj, wrap: !1 }); + return n.length === 1 && Array.isArray(n[0]) ? n[0] : n; } - findParent(e) { - return this.findSingleValue(`${e}^`); + findParent(t) { + return this.findSingleValue(`${t}^`); } findBookId() { return this.findSingleValue('$.content[?(@.type=="book" && @.marker=="id")].code'); } - findChapterNode(e) { - const r = `$..content[?(@.type=="chapter" && @.number=="${e}")]`; + findChapterNode(t) { + const r = `$..content[?(@.type=="chapter" && @.number=="${t}")]`; return this.findSingleValue(r); } // #endregion // #region Parent Maps - static createParentMapInternal(e, r, u) { - var n; - u.set(e, r), e.content && u.set(e.content, e), (n = e.content) == null || n.forEach((i) => { - typeof i == "object" && T.createParentMapInternal(i, e, u); + static createParentMapInternal(t, r, n) { + var u; + n.set(t, r), t.content && n.set(t.content, t), (u = t.content) == null || u.forEach((i) => { + typeof i == "object" && L.createParentMapInternal(i, t, n); }); } /** Viewing a Usj object as a tree, build a map to walk up the tree */ createUsjParentMap() { - const e = /* @__PURE__ */ new Map(); - return this.usj.content && e.set(this.usj.content, this.usj), this.usj.content.forEach((r) => { - typeof r == "object" && T.createParentMapInternal(r, this.usj, e); - }), e; + const t = /* @__PURE__ */ new Map(); + return this.usj.content && t.set(this.usj.content, this.usj), this.usj.content.forEach((r) => { + typeof r == "object" && L.createParentMapInternal(r, this.usj, t); + }), t; } /** Create the parent map if it doesn't already exist and return it */ get parentMap() { @@ -6511,48 +7798,48 @@ class T { // #endregion // #region Working Stacks /** Return the working stack applicable to the given node */ - createWorkingStack(e) { - const r = [], { parentMap: u } = this; - let n = e, i = u.get(n); + createWorkingStack(t) { + const r = [], { parentMap: n } = this; + let u = t, i = n.get(u); for (; i !== void 0; ) { if (!i.content) throw new Error("Invalid parentMap: all parents should have content"); if ( // Referencing tempNode and tempParent is OK in the loop since 'let' is used instead of 'var' // eslint-disable-next-line no-loop-func - !i.content.find((o, a) => { - if (o !== n) return !1; + !i.content.find((a, o) => { + if (a !== u) return !1; if (!i) throw new Error('undefined "tempParent" should not be possible'); - return r.unshift({ parent: i, index: a }), !0; + return r.unshift({ parent: i, index: o }), !0; }) ) - throw new Error(`Unable to find correct parent node of ${JSON.stringify(n)}`); - if (i.type === Kt) break; - n = i, i = u.get(i); + throw new Error(`Unable to find correct parent node of ${JSON.stringify(u)}`); + if (i.type === Xr) break; + u = i, i = n.get(i); } return r; } - static convertWorkingStackToJsonPath(e) { + static convertWorkingStackToJsonPath(t) { let r = "$"; - return e.forEach((u) => { - r = `${r}.content[${u.index}]`; + return t.forEach((n) => { + r = `${r}.content[${n.index}]`; }), r; } - convertJsonPathToWorkingStack(e) { - const r = [], u = e.match(/content\[(\d+)\]/g); - if (!u) throw new Error(`Malformed or unexpected jsonPath: ${e}`); - let n = this.usj; - return u.forEach((i, o) => { - const a = /(\d+)/.exec(i); - if (!a) throw new Error(`Malformed or unexpected jsonPath: ${e}`); - const s = parseInt(a[0], 10); - if (r.push({ parent: n, index: s }), o + 1 < u.length) { - if (typeof n == "string" || !n.content) - throw new Error(`jsonPath points to node without children: ${JSON.stringify(n)}`); - const l = n.content[s]; - if (typeof l == "string") - throw new Error(`jsonPath points to node without children: ${JSON.stringify(l)}`); - n = l; + convertJsonPathToWorkingStack(t) { + const r = [], n = t.match(/content\[(\d+)\]/g); + if (!n) throw new Error(`Malformed or unexpected jsonPath: ${t}`); + let u = this.usj; + return n.forEach((i, a) => { + const o = /(\d+)/.exec(i); + if (!o) throw new Error(`Malformed or unexpected jsonPath: ${t}`); + const s = parseInt(o[0], 10); + if (r.push({ parent: u, index: s }), a + 1 < n.length) { + if (typeof u == "string" || !u.content) + throw new Error(`jsonPath points to node without children: ${JSON.stringify(u)}`); + const c = u.content[s]; + if (typeof c == "string") + throw new Error(`jsonPath points to node without children: ${JSON.stringify(c)}`); + u = c; } }), r; } @@ -6574,22 +7861,22 @@ class T { * The general idea here is that we are looking for the MarkerObject in Usj that is immediately * adjacent to whatever `node`'s next sibling is in `parent`'s `content` array. */ - static findRightMostDescendantMarkerObject(e, r, u = []) { - if (!e.content) return { node: e, parent: r }; - for (let n = e.content.length - 1; n >= 0; n--) { - const i = e.content[n]; - if (typeof i == "object" && !u.includes(i.type)) - return i.content ? this.findRightMostDescendantMarkerObject(i, e, u) : { node: i, parent: e }; + static findRightMostDescendantMarkerObject(t, r, n = []) { + if (!t.content) return { node: t, parent: r }; + for (let u = t.content.length - 1; u >= 0; u--) { + const i = t.content[u]; + if (typeof i == "object" && !n.includes(i.type)) + return i.content ? this.findRightMostDescendantMarkerObject(i, t, n) : { node: i, parent: t }; } - return { node: e, parent: r }; + return { node: t, parent: r }; } - static findNextMatchingNodeUsingWorkingStack(e, r, u, n) { - var o; - let i = e; + static findNextMatchingNodeUsingWorkingStack(t, r, n, u) { + var a; + let i = t; for (; i !== void 0; ) { - const a = typeof i == "object" && u.includes(i.type); - if (!a && n(i, r)) return i; - if (!a && typeof i == "object" && (((o = i.content) == null ? void 0 : o.length) ?? 0) > 0) + const o = typeof i == "object" && n.includes(i.type); + if (!o && u(i, r)) return i; + if (!o && typeof i == "object" && (((a = i.content) == null ? void 0 : a.length) ?? 0) > 0) r.push({ parent: i, index: 0 }), [i] = i.content; else for (i = void 0; r.length > 0; ) { @@ -6606,280 +7893,280 @@ class T { * criteria specified by `searchFunction` (i.e., the first node where `searchFunction` returns * `true`) */ - findNextMatchingNode(e, r, u) { - const n = this.createWorkingStack(e); - return T.findNextMatchingNodeUsingWorkingStack( - e, - n, + findNextMatchingNode(t, r, n) { + const u = this.createWorkingStack(t); + return L.findNextMatchingNodeUsingWorkingStack( + t, + u, r, - u + n ); } // #endregion // #region Node -> JSONPath - nodeToJsonPath(e) { - return T.convertWorkingStackToJsonPath(this.createWorkingStack(e)); + nodeToJsonPath(t) { + return L.convertWorkingStackToJsonPath(this.createWorkingStack(t)); } // #endregion // #region USJ + node -> VerseRef + offset /** Find the chapter and verse that apply to a given USJ node */ - findVerseRefForNode(e, r, u = { + findVerseRefForNode(t, r, n = { chapterNum: void 0, verseNum: void 0, startingContentNode: void 0 }) { - if (u.verseNum !== void 0 && u.chapterNum !== void 0) return u; - if (typeof e == "object" && e.number !== void 0) { - const s = Number.parseInt(e.number, 10); - if (e.type === xe) - return u.chapterNum = s, u.verseNum = u.verseNum ?? 0, u.startingContentNode = u.startingContentNode ?? e, u; - e.type === Ie && !u.verseNum && (u.verseNum = s, u.startingContentNode = e); + if (n.verseNum !== void 0 && n.chapterNum !== void 0) return n; + if (typeof t == "object" && t.number !== void 0) { + const s = Number.parseInt(t.number, 10); + if (t.type === pt) + return n.chapterNum = s, n.verseNum = n.verseNum ?? 0, n.startingContentNode = n.startingContentNode ?? t, n; + t.type === ht && !n.verseNum && (n.verseNum = s, n.startingContentNode = t); } if (!r.content) throw new Error(`"content" array not found: ${JSON.stringify(r)}`); - let n = 0; + let u = 0; for (let s = 0; s < r.content.length; s++) - if (r.content[s] === e) { - n = s; + if (r.content[s] === t) { + u = s; break; } - let i = n - 1; + let i = u - 1; for (; i >= 0 && typeof r.content[i] != "object"; ) i -= 1; if (i < 0) { - if (r.type === Kt) - return u.chapterNum === void 0 && (u.chapterNum = 1, u.verseNum = 0, u.startingContentNode = void 0), u; - const s = r, l = this.parentMap.get(s); - if (!l) throw new Error(`No parent found for ${JSON.stringify(r)}`); - return this.findVerseRefForNode(s, l, u); + if (r.type === Xr) + return n.chapterNum === void 0 && (n.chapterNum = 1, n.verseNum = 0, n.startingContentNode = void 0), n; + const s = r, c = this.parentMap.get(s); + if (!c) throw new Error(`No parent found for ${JSON.stringify(r)}`); + return this.findVerseRefForNode(s, c, n); } - const o = r.content[i], a = T.findRightMostDescendantMarkerObject( - o, + const a = r.content[i], o = L.findRightMostDescendantMarkerObject( + a, r, - U + ne ); - return this.findVerseRefForNode(a.node, a.parent, u); + return this.findVerseRefForNode(o.node, o.parent, n); } - nodeToVerseRefAndOffset(e, r, u) { - if (typeof r == "string" && u === void 0) + nodeToVerseRefAndOffset(t, r, n) { + if (typeof r == "string" && n === void 0) throw new Error('If "node" is a string, then "nodeParent" cannot be undefined'); - let n; - if (u === void 0 ? n = this.parentMap.get(r) : n = Array.isArray(u) ? this.parentMap.get(u) : u, n === void 0) - throw new Error(`Cannot find parent for ${JSON.stringify(u)}`); - const i = this.findVerseRefForNode(r, n); + let u; + if (n === void 0 ? u = this.parentMap.get(r) : u = Array.isArray(n) ? this.parentMap.get(n) : n, u === void 0) + throw new Error(`Cannot find parent for ${JSON.stringify(n)}`); + const i = this.findVerseRefForNode(r, u); if (!i) return; if (!i.chapterNum) throw new Error(`Could not determine chapter number for ${JSON.stringify(r)}`); - const o = new ur( - e, + const a = new Jt( + t, i.chapterNum.toString(), i.verseNum ? i.verseNum.toString() : "0" ); - let a = 0; - return i.startingContentNode !== void 0 && this.findNextMatchingNode(i.startingContentNode, [], (s, l) => { - var c, f; - return s === r ? !0 : l.find((p) => U.includes(p.parent.type)) ? !1 : typeof s == "string" ? (a += s.length, !1) : s.type === xe && s.number !== ((c = i.chapterNum) == null ? void 0 : c.toString()) || s.type === Ie && s.number !== ((f = i.verseNum) == null ? void 0 : f.toString()) ? (a = 0, !0) : !1; - }), { verseRef: o, offset: a }; + let o = 0; + return i.startingContentNode !== void 0 && this.findNextMatchingNode(i.startingContentNode, [], (s, c) => { + var l, f; + return s === r ? !0 : c.find((p) => ne.includes(p.parent.type)) ? !1 : typeof s == "string" ? (o += s.length, !1) : s.type === pt && s.number !== ((l = i.chapterNum) == null ? void 0 : l.toString()) || s.type === ht && s.number !== ((f = i.verseNum) == null ? void 0 : f.toString()) ? (o = 0, !0) : !1; + }), { verseRef: a, offset: o }; } // #endregion // #region JSONPath -> VerseRef + offset - jsonPathToVerseRefAndOffset(e, r) { - const u = r ?? this.findBookId(); - if (!u) throw new Error("Not able to determine the book ID"); - const n = this.findSingleValue(e); - if (!n) throw new Error(`No result found for JSONPath query: ${e}`); - const i = this.findParent(e); - if (!i) throw new Error(`Could not determine parent for ${e}`); - const o = this.nodeToVerseRefAndOffset(u, n, i); - if (!o) - throw new Error(`Could not determine VerseRef that corresponds to ${e}`); - return o; + jsonPathToVerseRefAndOffset(t, r) { + const n = r ?? this.findBookId(); + if (!n) throw new Error("Not able to determine the book ID"); + const u = this.findSingleValue(t); + if (!u) throw new Error(`No result found for JSONPath query: ${t}`); + const i = this.findParent(t); + if (!i) throw new Error(`Could not determine parent for ${t}`); + const a = this.nodeToVerseRefAndOffset(n, u, i); + if (!a) + throw new Error(`Could not determine VerseRef that corresponds to ${t}`); + return a; } // #endregion // #region VerseRef + offset -> Node + JSONPath + offset - verseRefToUsjContentLocation(e, r = 0) { + verseRefToUsjContentLocation(t, r = 0) { if (r < 0) throw new Error("offset must be >= 0"); - const u = this.findBookId() ?? e.book; - if (!u) throw new Error("Not able to determine the book ID"); - if (u !== e.book) - throw new Error(`Book IDs don't match: USJ=${u}, VerseRef=${e.book}`); - const n = this.findChapterNode(e.chapterNum); - if (n === void 0) - throw new Error(`Could not find ${u} chapter ${e.chapterNum}`); - let i = !1, o = ""; - const a = e.verse, s = this.findNextMatchingNode( - n, - U, - (p, h) => p === n ? e.verseNum === 0 ? (o = T.convertWorkingStackToJsonPath(h), !0) : !1 : typeof p != "object" ? !1 : p.type === xe ? (i = !0, !0) : p.type === Ie && p.number !== void 0 && p.number === a ? (o = T.convertWorkingStackToJsonPath(h), !0) : !1 + const n = this.findBookId() ?? t.book; + if (!n) throw new Error("Not able to determine the book ID"); + if (n !== t.book) + throw new Error(`Book IDs don't match: USJ=${n}, VerseRef=${t.book}`); + const u = this.findChapterNode(t.chapterNum); + if (u === void 0) + throw new Error(`Could not find ${n} chapter ${t.chapterNum}`); + let i = !1, a = ""; + const o = t.verse, s = this.findNextMatchingNode( + u, + ne, + (p, m) => p === u ? t.verseNum === 0 ? (a = L.convertWorkingStackToJsonPath(m), !0) : !1 : typeof p != "object" ? !1 : p.type === pt ? (i = !0, !0) : p.type === ht && p.number !== void 0 && p.number === o ? (a = L.convertWorkingStackToJsonPath(m), !0) : !1 ); if (i || s === void 0 || typeof s == "string") - throw new Error(`Verse ${a} not found in ${u} ${e.chapterNum}`); - if (r === 0) return { node: s, offset: 0, jsonPath: o }; - let l = 0, c = 0, f; + throw new Error(`Verse ${o} not found in ${n} ${t.chapterNum}`); + if (r === 0) return { node: s, offset: 0, jsonPath: a }; + let c = 0, l = 0, f; return this.findNextMatchingNode( s, - U, - (p, h) => { + ne, + (p, m) => { if (p === s) return !1; if (typeof p == "string") { - if (l += p.length, l > r) - return o = T.convertWorkingStackToJsonPath(h), c = r - l + p.length, f = p, !0; - } else if (p.type === xe || p.type === Ie) return !0; + if (c += p.length, c > r) + return a = L.convertWorkingStackToJsonPath(m), l = r - c + p.length, f = p, !0; + } else if (p.type === pt || p.type === ht) return !0; return !1; } - ), { node: f ?? s, offset: c, jsonPath: o }; + ), { node: f ?? s, offset: l, jsonPath: a }; } // #endregion // #region Search for text from a node + JSONPath + offset - findNextLocationOfMatchingText(e, r, u = 1e3) { - let n = "", i = 0, o = 0, a = 0; - if (T.findNextMatchingNodeUsingWorkingStack( - e.node, - this.convertJsonPathToWorkingStack(e.jsonPath), - U, + findNextLocationOfMatchingText(t, r, n = 1e3) { + let u = "", i = 0, a = 0, o = 0; + if (L.findNextMatchingNodeUsingWorkingStack( + t.node, + this.convertJsonPathToWorkingStack(t.jsonPath), + ne, (f) => { if (typeof f != "string") return !1; - i += f.length, n = `${n}${f}`; - const p = n.indexOf(r); - return p < 0 ? (o += n.length, n.length > r.length && (n = n.substring(n.length - r.length)), o -= n.length, i > u) : (a = o + p, !0); + i += f.length, u = `${u}${f}`; + const p = u.indexOf(r); + return p < 0 ? (a += u.length, u.length > r.length && (u = u.substring(u.length - r.length)), a -= u.length, i > n) : (o = a + p, !0); } - ), a <= 0) return; + ), o <= 0) return; i = 0; - let s = 0, l = []; - const c = T.findNextMatchingNodeUsingWorkingStack( - e.node, - this.convertJsonPathToWorkingStack(e.jsonPath), - U, - (f, p) => typeof f != "string" || (i += f.length, i < a + 1) ? !1 : (s = a - i + f.length, l = p, !0) + let s = 0, c = []; + const l = L.findNextMatchingNodeUsingWorkingStack( + t.node, + this.convertJsonPathToWorkingStack(t.jsonPath), + ne, + (f, p) => typeof f != "string" || (i += f.length, i < o + 1) ? !1 : (s = o - i + f.length, c = p, !0) ); - if (!c) throw new Error("Internal error: inconsistent search results"); + if (!l) throw new Error("Internal error: inconsistent search results"); return { - node: c, + node: l, offset: s, - jsonPath: T.convertWorkingStackToJsonPath(l) + jsonPath: L.convertWorkingStackToJsonPath(c) }; } // #endregion // #region Extract text from a node + JSONPath + offset - extractText(e, r) { - let u = "", n = e.offset, i = 0; - return T.findNextMatchingNodeUsingWorkingStack( - e.node, - this.convertJsonPathToWorkingStack(e.jsonPath), - U, - (o) => { - if (typeof o != "string") return !1; - if (n >= o.length) - return n -= o.length, !1; - let a = o; - if (n > 0 && (a = a.substring(n), n = 0), i + a.length < r) - return i += a.length, u = `${u}${a}`, !1; + extractText(t, r) { + let n = "", u = t.offset, i = 0; + return L.findNextMatchingNodeUsingWorkingStack( + t.node, + this.convertJsonPathToWorkingStack(t.jsonPath), + ne, + (a) => { + if (typeof a != "string") return !1; + if (u >= a.length) + return u -= a.length, !1; + let o = a; + if (u > 0 && (o = o.substring(u), u = 0), i + o.length < r) + return i += o.length, n = `${n}${o}`, !1; const s = r - i; - return u = `${u}${a.substring(0, s - 1)}`, !0; + return n = `${n}${o.substring(0, s - 1)}`, !0; } - ), u; - } - extractTextBetweenPoints(e, r, u = 100) { - let n = ""; - return T.findNextMatchingNodeUsingWorkingStack( - e.node, - this.convertJsonPathToWorkingStack(e.jsonPath), - U, - (i, o) => i === r.node && (typeof i == "object" || r.jsonPath === T.convertWorkingStackToJsonPath(o)) ? !0 : typeof i != "string" ? !1 : (n = `${n}${i}`, n.length > u && (n = n.substring(0, u)), n.length >= u) ), n; } + extractTextBetweenPoints(t, r, n = 100) { + let u = ""; + return L.findNextMatchingNodeUsingWorkingStack( + t.node, + this.convertJsonPathToWorkingStack(t.jsonPath), + ne, + (i, a) => i === r.node && (typeof i == "object" || r.jsonPath === L.convertWorkingStackToJsonPath(a)) ? !0 : typeof i != "string" ? !1 : (u = `${u}${i}`, u.length > n && (u = u.substring(0, n)), u.length >= n) + ), u; + } // #endregion // #region Edit this USJ data - static removeContentNodesFromArray(e, r) { - let u = 0; - for (let n = e.length - 1; n >= 0; n--) { - const i = e[n]; - r(i) ? (e.splice(n, 1), u += 1) : typeof i != "string" && i.content && (u += this.removeContentNodesFromArray(i.content, r)); + static removeContentNodesFromArray(t, r) { + let n = 0; + for (let u = t.length - 1; u >= 0; u--) { + const i = t[u]; + r(i) ? (t.splice(u, 1), n += 1) : typeof i != "string" && i.content && (n += this.removeContentNodesFromArray(i.content, r)); } - return u; + return n; } - removeContentNodes(e) { - const r = T.removeContentNodesFromArray(this.usj.content, e); + removeContentNodes(t) { + const r = L.removeContentNodesFromArray(this.usj.content, t); return this.usjChanged(), r; } // #endregion } export { - zn as AsyncVariable, - xe as CHAPTER_TYPE, - Gn as Collator, - zr as DateTimeFormat, - Kr as DocumentCombiner, - Tu as FIRST_SCR_BOOK_NUM, - Ou as FIRST_SCR_CHAPTER_NUM, - xu as FIRST_SCR_VERSE_NUM, - Su as LAST_SCR_BOOK_NUM, - Yr as Mutex, - Qn as MutexMap, - ei as NonValidatingDocumentCombiner, - Zr as NumberFormat, - Gr as PlatformEventEmitter, - ti as UnsubscriberAsyncList, - T as UsjReaderWriter, - Ie as VERSE_TYPE, - wi as aggregateUnsubscriberAsyncs, - Ni as aggregateUnsubscribers, - ui as at, - se as charAt, - ni as codePointAt, - Ei as compareScrRefs, - Zn as createSyncProxyForAsyncObject, - Hn as debounce, - Ee as deepClone, - nn as deepEqual, - mi as defaultScrRef, - an as deserialize, - Au as endsWith, - or as ensureArray, - pi as escapeStringRegexp, - Si as formatBytes, - ii as formatReplacementString, - Nu as formatReplacementStringToArray, - yi as formatScrRef, - Yn as getAllObjectFunctionNames, - Iu as getChaptersForBook, - Ti as getCurrentLocale, - Kn as getErrorMessage, - Fu as getLocalizeKeyForScrollGroupId, - Ai as getLocalizeKeysForScrollGroupIds, - bi as getLocalizedIdFromBookNumber, - Xn as groupBy, - Bi as htmlEncode, - wu as includes, - Ae as indexOf, - fi as isLocalizeKey, - Ci as isSerializable, - qe as isString, - on as isSubset, - Cu as lastIndexOf, - ln as localizedStringsDocumentSchema, - fn as menuDocumentSchema, - Jn as newGuid, - oi as normalize, - gi as offsetBook, - Di as offsetChapter, - vi as offsetVerse, - ai as ordinalCompare, - si as padEnd, - ci as padStart, - sn as projectSettingsDocumentSchema, - Ct as scrRefToBBBCCCVVV, - Rt as serialize, - cn as settingsDocumentSchema, - li as slice, - wt as split, - ar as startsWith, - C as stringLength, - Q as substring, - Bu as toArray, - di as transformAndEnsureRegExpArray, - hi as transformAndEnsureRegExpRegExpArray, - Xr as wait, - Wn as waitForDuration + ha as AsyncVariable, + pt as CHAPTER_TYPE, + da as Collator, + eu as DateTimeFormat, + iu as DocumentCombiner, + ku as FIRST_SCR_BOOK_NUM, + qu as FIRST_SCR_CHAPTER_NUM, + $u as FIRST_SCR_VERSE_NUM, + Pu as LAST_SCR_BOOK_NUM, + au as Mutex, + ba as MutexMap, + ya as NonValidatingDocumentCombiner, + su as NumberFormat, + tu as PlatformEventEmitter, + Ca as UnsubscriberAsyncList, + L as UsjReaderWriter, + ht as VERSE_TYPE, + Ja as aggregateUnsubscriberAsyncs, + za as aggregateUnsubscribers, + wa as at, + Se as charAt, + Sa as codePointAt, + Va as compareScrRefs, + Na as createSyncProxyForAsyncObject, + Ea as debounce, + Je as deepClone, + di as deepEqual, + Pa as defaultScrRef, + Ei as deserialize, + xu as endsWith, + un as ensureArray, + Fa as escapeStringRegexp, + Wa as formatBytes, + Oa as formatReplacementString, + Mu as formatReplacementStringToArray, + Ga as formatScrRef, + Aa as getAllObjectFunctionNames, + ju as getChaptersForBook, + Ka as getCurrentLocale, + Da as getErrorMessage, + Uu as getLocalizeKeyForScrollGroupId, + Ha as getLocalizeKeysForScrollGroupIds, + Ua as getLocalizedIdFromBookNumber, + ga as groupBy, + Ya as htmlEncode, + _u as includes, + Ye as indexOf, + _a as isLocalizeKey, + Xa as isSerializable, + Dt as isString, + mi as isSubset, + Fu as lastIndexOf, + vi as localizedStringsDocumentSchema, + Ai as menuDocumentSchema, + ma as newGuid, + Ia as normalize, + qa as offsetBook, + $a as offsetChapter, + ja as offsetVerse, + Ba as ordinalCompare, + xa as padEnd, + Ra as padStart, + gi as projectSettingsDocumentSchema, + Dr as scrRefToBBBCCCVVV, + Sr as serialize, + Di as settingsDocumentSchema, + Ma as slice, + gr as split, + on as startsWith, + F as stringLength, + pe as substring, + Lu as toArray, + ka as transformAndEnsureRegExpArray, + La as transformAndEnsureRegExpRegExpArray, + uu as wait, + va as waitForDuration }; //# sourceMappingURL=index.js.map diff --git a/lib/platform-bible-utils/dist/index.js.map b/lib/platform-bible-utils/dist/index.js.map index 568e611f4c..936e0bec91 100644 --- a/lib/platform-bible-utils/dist/index.js.map +++ b/lib/platform-bible-utils/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../src/async-variable.ts","../src/intl-collator.ts","../src/intl-date-time-format.ts","../src/platform-event-emitter.model.ts","../src/util.ts","../src/document-combiner.ts","../src/mutex.ts","../src/mutex-map.ts","../src/non-validating-document-combiner.ts","../src/intl-number-format.ts","../src/unsubscriber-async-list.ts","../../../node_modules/@sillsdev/scripture/dist/index.es.js","../../../node_modules/char-regex/index.js","../../../node_modules/stringz/dist/index.js","../src/array-util.ts","../src/string-util.ts","../src/scripture-util.ts","../src/unsubscriber.ts","../src/usj-reader-writer.model.ts","../../../node_modules/fast-equals/dist/esm/index.mjs","../src/equality-checking.ts","../src/subset-checking.ts","../src/serialization.ts","../src/intl-util.ts","../src/number-utils.ts","../src/settings.model.ts","../src/localized-strings.model.ts","../src/menus.model.ts","../../../node_modules/@xmldom/xmldom/lib/conventions.js","../../../node_modules/@xmldom/xmldom/lib/dom.js","../../../node_modules/@xmldom/xmldom/lib/entities.js","../../../node_modules/@xmldom/xmldom/lib/sax.js","../../../node_modules/@xmldom/xmldom/lib/dom-parser.js","../../../node_modules/@biblionexus-foundation/scripture-utilities/dist/index.js","../src/usj-reader-writer.ts"],"sourcesContent":["/** This class provides a convenient way for one task to wait on a variable that another task sets. */\nexport default class AsyncVariable {\n private readonly variableName: string;\n private readonly promiseToValue: Promise;\n private resolver: ((value: T) => void) | undefined;\n private rejecter: ((reason: string | undefined) => void) | undefined;\n\n /**\n * Creates an instance of the class\n *\n * @param variableName Name to use when logging about this variable\n * @param rejectIfNotSettledWithinMS Milliseconds to wait before verifying if the promise was\n * settled (resolved or rejected); will reject if it has not settled by that time. Use -1 if you\n * do not want a timeout at all. Defaults to 10000 ms\n */\n constructor(variableName: string, rejectIfNotSettledWithinMS: number = 10000) {\n this.variableName = variableName;\n this.promiseToValue = new Promise((resolve, reject) => {\n this.resolver = resolve;\n this.rejecter = reject;\n });\n if (rejectIfNotSettledWithinMS > 0) {\n setTimeout(() => {\n if (this.rejecter) {\n this.rejecter(`Timeout reached when waiting for ${this.variableName} to settle`);\n this.complete();\n }\n }, rejectIfNotSettledWithinMS);\n }\n Object.seal(this);\n }\n\n /**\n * Get this variable's promise to a value. This always returns the same promise even after the\n * value has been resolved or rejected.\n *\n * @returns The promise for the value to be set\n */\n get promise(): Promise {\n return this.promiseToValue;\n }\n\n /**\n * A simple way to see if this variable's promise was resolved or rejected already\n *\n * @returns Whether the variable was already resolved or rejected\n */\n get hasSettled(): boolean {\n return Object.isFrozen(this);\n }\n\n /**\n * Resolve this variable's promise to the given value\n *\n * @param value This variable's promise will resolve to this value\n * @param throwIfAlreadySettled Determines whether to throw if the variable was already resolved\n * or rejected. Defaults to `false`\n */\n resolveToValue(value: T, throwIfAlreadySettled: boolean = false): void {\n if (this.resolver) {\n console.debug(`${this.variableName} is being resolved now`);\n this.resolver(value);\n this.complete();\n } else {\n if (throwIfAlreadySettled) throw Error(`${this.variableName} was already settled`);\n console.debug(`Ignoring subsequent resolution of ${this.variableName}`);\n }\n }\n\n /**\n * Reject this variable's promise for the value with the given reason\n *\n * @param reason This variable's promise will be rejected with this reason\n * @param throwIfAlreadySettled Determines whether to throw if the variable was already resolved\n * or rejected. Defaults to `false`\n */\n rejectWithReason(reason: string, throwIfAlreadySettled: boolean = false): void {\n if (this.rejecter) {\n console.debug(`${this.variableName} is being rejected now`);\n this.rejecter(reason);\n this.complete();\n } else {\n if (throwIfAlreadySettled) throw Error(`${this.variableName} was already settled`);\n console.debug(`Ignoring subsequent rejection of ${this.variableName}`);\n }\n }\n\n /** Prevent any further updates to this variable */\n private complete(): void {\n this.resolver = undefined;\n this.rejecter = undefined;\n Object.freeze(this);\n }\n}\n","/** Enables language-sensitive string comparison. Wraps Intl.Collator */\nexport default class Collator {\n private collator: Intl.Collator;\n\n constructor(locales?: string | string[], options?: Intl.CollatorOptions) {\n this.collator = new Intl.Collator(locales, options);\n }\n\n /**\n * Compares two strings according to the sort order of this Collator object\n *\n * @param string1 String to compare\n * @param string2 String to compare\n * @returns A number indicating how string1 and string2 compare to each other according to the\n * sort order of this Collator object. Negative value if string1 comes before string2. Positive\n * value if string1 comes after string2. 0 if they are considered equal.\n */\n compare(string1: string, string2: string): number {\n return this.collator.compare(string1, string2);\n }\n\n /**\n * Returns a new object with properties reflecting the locale and collation options computed\n * during initialization of this collator object.\n *\n * @returns ResolvedCollatorOptions object\n */\n resolvedOptions(): Intl.ResolvedCollatorOptions {\n return this.collator.resolvedOptions();\n }\n}\n","/** Enables language-sensitive data and time formatting. Wraps Intl.DateTimeFormat */\nexport default class DateTimeFormat {\n private dateTimeFormatter: Intl.DateTimeFormat;\n\n constructor(locales?: string | string[], options?: Intl.DateTimeFormatOptions) {\n this.dateTimeFormatter = new Intl.DateTimeFormat(locales, options);\n }\n\n /**\n * Formats a date according to the locale and formatting option for this DateTimeFormat object\n *\n * @param date The date to format\n * @returns String representing the given date formatted according to the locale and formatting\n * options of this DateTimeFormat object\n */\n format(date: Date): string {\n return this.dateTimeFormatter.format(date);\n }\n\n /**\n * Formats a date range in the most concise way based on the locales and options provided when\n * instantiating this DateTimeFormat object\n *\n * @param startDate Date object representing start of the date range\n * @param endDate Date object representing the end of the date range\n * @returns String representing the given date range formatted according to the locale and\n * formatting options of this DateTimeFormat object\n */\n formatRange(startDate: Date, endDate: Date): string {\n return this.dateTimeFormatter.formatRange(startDate, endDate);\n }\n\n /**\n * Returns an array of locale-specific tokens representing each part of the formatted date range\n * produced by this DateTimeFormat object\n *\n * @param startDate Date object representing start of the date range\n * @param endDate Date object representing the end of the date range\n * @returns Array of DateTimeRangeFormatPart objects\n */\n formatRangeToParts(startDate: Date, endDate: Date): Intl.DateTimeRangeFormatPart[] {\n return this.dateTimeFormatter.formatRangeToParts(startDate, endDate);\n }\n\n /**\n * Allows locale-aware formatting of strings produced by this DateTimeFormat object\n *\n * @param date The date to format\n * @returns Array of DateTimeFormatPart objects\n */\n formatToParts(date: Date): Intl.DateTimeFormatPart[] {\n return this.dateTimeFormatter.formatToParts(date);\n }\n\n /**\n * Returns a new object with properties reflecting the locale and date and time formatting options\n * computed during initialization of this DateTimeFormat object\n *\n * @returns ResolvedDateTimeFormatOptions object\n */\n resolvedOptions(): Intl.ResolvedDateTimeFormatOptions {\n return this.dateTimeFormatter.resolvedOptions();\n }\n}\n","/** Interfaces, classes, and functions related to events and event emitters */\n\nimport { Dispose } from './disposal.model';\nimport { PlatformEvent, PlatformEventHandler } from './platform-event';\n\n/**\n * Event manager - accepts subscriptions to an event and runs the subscription callbacks when the\n * event is emitted Use eventEmitter.event(callback) to subscribe to the event. Use\n * eventEmitter.emit(event) to run the subscriptions. Generally, this EventEmitter should be\n * private, and its event should be public. That way, the emitter is not publicized, but anyone can\n * subscribe to the event.\n */\nexport default class PlatformEventEmitter implements Dispose {\n /**\n * Subscribes a function to run when this event is emitted.\n *\n * @param callback Function to run with the event when it is emitted\n * @returns Unsubscriber function to run to stop calling the passed-in function when the event is\n * emitted\n * @alias event\n */\n subscribe = this.event;\n\n /** All callback functions that will run when this event is emitted. Lazy loaded */\n private subscriptions?: PlatformEventHandler[];\n /** Event for listeners to subscribe to. Lazy loaded */\n private lazyEvent?: PlatformEvent;\n /** Whether this emitter has been disposed */\n private isDisposed = false;\n\n /**\n * Event for listeners to subscribe to. Subscribes a function to run when this event is emitted.\n * Use like `const unsubscriber = event(callback)`\n *\n * @param callback Function to run with the event when it is emitted\n * @returns Unsubscriber function to run to stop calling the passed-in function when the event is\n * emitted\n */\n get event(): PlatformEvent {\n this.assertNotDisposed();\n\n if (!this.lazyEvent) {\n this.lazyEvent = (callback) => {\n if (!callback || typeof callback !== 'function')\n throw new Error(`Event handler callback must be a function!`);\n\n // Initialize this.subscriptions if it does not exist\n if (!this.subscriptions) this.subscriptions = [];\n\n this.subscriptions.push(callback);\n\n return () => {\n if (!this.subscriptions) return false; // Did not find any subscribed callbacks\n\n const callbackIndex = this.subscriptions.indexOf(callback);\n\n if (callbackIndex < 0) return false; // Did not find this callback in the subscriptions\n\n // Remove the callback\n this.subscriptions.splice(callbackIndex, 1);\n\n return true;\n };\n };\n }\n return this.lazyEvent;\n }\n\n /** Disposes of this event, preparing it to release from memory */\n dispose = () => {\n return this.disposeFn();\n };\n\n /**\n * Runs the subscriptions for the event\n *\n * @param event Event data to provide to subscribed callbacks\n */\n emit = (event: T) => {\n // Do not do anything other than emitFn here. This emit is just binding `this` to emitFn\n this.emitFn(event);\n };\n\n /**\n * Function that runs the subscriptions for the event. Added here so children can override emit\n * and still call the base functionality. See NetworkEventEmitter.emit for example\n */\n protected emitFn(event: T) {\n this.assertNotDisposed();\n\n // Clone the subscriptions array before iterating over the callbacks so the callback index\n // doesn't get messed up if someone subscribes or unsubscribes inside one of the callbacks\n const emitCallbacks = [...(this.subscriptions ?? [])];\n emitCallbacks.forEach((callback) => callback(event));\n }\n\n /** Check to make sure this emitter is not disposed. Throw if it is */\n protected assertNotDisposed() {\n if (this.isDisposed) throw new Error('Emitter is disposed');\n }\n\n /**\n * Disposes of this event, preparing it to release from memory. Added here so children can\n * override emit and still call the base functionality.\n */\n protected disposeFn() {\n this.assertNotDisposed();\n\n this.isDisposed = true;\n this.subscriptions = undefined;\n this.lazyEvent = undefined;\n return Promise.resolve(true);\n }\n}\n","/** Collection of functions, objects, and types that are used as helpers in other services. */\n\n// Thanks to blubberdiblub at https://stackoverflow.com/a/68141099/217579\nexport function newGuid(): string {\n return '00-0-4-1-000'.replace(/[^-]/g, (s) =>\n // @ts-expect-error ts(2363) this works fine\n // eslint-disable-next-line no-bitwise\n (((Math.random() + ~~s) * 0x10000) >> s).toString(16).padStart(4, '0'),\n );\n}\n\n// thanks to DRAX at https://stackoverflow.com/a/9436948\n/**\n * Determine whether the object is a string\n *\n * @param o Object to determine if it is a string\n * @returns True if the object is a string; false otherwise\n */\nexport function isString(o: unknown): o is string {\n return typeof o === 'string' || o instanceof String;\n}\n\n/**\n * If deepClone isn't used when copying properties between objects, you may be left with dangling\n * references between the source and target of property copying operations.\n *\n * @param obj Object to clone\n * @returns Duplicate copy of `obj` without any references back to the original one\n */\nexport function deepClone(obj: T): T {\n // Assert the return type matches what is expected\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n return JSON.parse(JSON.stringify(obj)) as T;\n}\n\n/**\n * Get a function that reduces calls to the function passed in\n *\n * @param fn The function to debounce\n * @param delay How much delay in milliseconds after the most recent call to the debounced function\n * to call the function\n * @returns Function that, when called, only calls the function passed in at maximum every delay ms\n */\n// We don't know the parameter types since this function can be anything\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function debounce void>(fn: T, delay = 300): T {\n if (isString(fn)) throw new Error('Tried to debounce a string! Could be XSS');\n let timeout: ReturnType;\n // Ensure the right return type.\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n return ((...args) => {\n clearTimeout(timeout);\n timeout = setTimeout(() => fn(...args), delay);\n }) as T;\n}\n\n/**\n * Groups each item in the array of items into a map according to the keySelector\n *\n * @param items Array of items to group by\n * @param keySelector Function to run on each item to get the key for the group to which it belongs\n * @param valueSelector Function to run on each item to get the value it should have in the group\n * (like map function). If not provided, uses the item itself\n * @returns Map of keys to groups of values corresponding to each item\n */\nexport function groupBy(items: T[], keySelector: (item: T) => K): Map>;\nexport function groupBy(\n items: T[],\n keySelector: (item: T) => K,\n valueSelector: (item: T, key: K) => V,\n): Map>;\nexport function groupBy(\n items: T[],\n keySelector: (item: T) => K,\n valueSelector?: (item: T, key: K) => V,\n): Map> {\n const map = new Map>();\n items.forEach((item) => {\n const key = keySelector(item);\n const group = map.get(key);\n const value = valueSelector ? valueSelector(item, key) : item;\n if (group) group.push(value);\n else map.set(key, [value]);\n });\n return map;\n}\n\n// From https://kentcdodds.com/blog/get-a-catch-block-error-message-with-typescript\ntype ErrorWithMessage = {\n message: string;\n};\n\n// From https://kentcdodds.com/blog/get-a-catch-block-error-message-with-typescript\nfunction isErrorWithMessage(error: unknown): error is ErrorWithMessage {\n return (\n typeof error === 'object' &&\n // We're potentially dealing with objects we didn't create, so they might contain `null`\n // eslint-disable-next-line no-null/no-null\n error !== null &&\n 'message' in error &&\n // Type assert `error` to check it's `message`.\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n typeof (error as Record).message === 'string'\n );\n}\n\n// From https://kentcdodds.com/blog/get-a-catch-block-error-message-with-typescript\n/**\n * Function to get an error from the object (useful for getting an error in a catch block)\n *\n * @param error Error object whose message to get\n * @returns Message of the error - if object has message, returns message. Otherwise tries to\n * stringify\n */\nfunction toErrorWithMessage(maybeError: unknown): ErrorWithMessage {\n if (isErrorWithMessage(maybeError)) return maybeError;\n\n try {\n return new Error(JSON.stringify(maybeError));\n } catch {\n // fallback in case there's an error stringifying the maybeError\n // like with circular references for example.\n return new Error(String(maybeError));\n }\n}\n\n// From https://kentcdodds.com/blog/get-a-catch-block-error-message-with-typescript\n/**\n * Function to get an error message from the object (useful for getting error message in a catch\n * block)\n *\n * @example `try {...} catch (e) { logger.info(getErrorMessage(e)) }`\n *\n * @param error Error object whose message to get\n * @returns Message of the error - if object has message, returns message. Otherwise tries to\n * stringify\n */\nexport function getErrorMessage(error: unknown) {\n return toErrorWithMessage(error).message;\n}\n\n/** Asynchronously waits for the specified number of milliseconds. (wraps setTimeout in a promise) */\nexport function wait(ms: number) {\n // eslint-disable-next-line no-promise-executor-return\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Runs the specified function and will timeout if it takes longer than the specified wait time\n *\n * @param fn The function to run\n * @param maxWaitTimeInMS The maximum amount of time to wait for the function to resolve\n * @returns Promise that resolves to the resolved value of the function or undefined if it ran\n * longer than the specified wait time\n */\nexport function waitForDuration(fn: () => Promise, maxWaitTimeInMS: number) {\n const timeout = wait(maxWaitTimeInMS).then(() => undefined);\n return Promise.any([timeout, fn()]);\n}\n\n/**\n * Get all functions on an object and its prototype chain (so we don't miss any class methods or any\n * object methods). Note that the functions on the final item in the prototype chain (i.e., Object)\n * are skipped to avoid including functions like `__defineGetter__`, `__defineSetter__`, `toString`,\n * etc.\n *\n * @param obj Object whose functions to get\n * @param _objId Optional ID of the object to use for debug logging\n * @returns Array of all function names on an object\n */\n// Note: lodash has something that MIGHT do the same thing as this. Investigate for https://github.com/paranext/paranext-core/issues/134\nexport function getAllObjectFunctionNames(\n obj: { [property: string]: unknown },\n // Leaving it here for debugging\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _objId: string = 'obj',\n): Set {\n const objectFunctionNames = new Set();\n\n // Get all function properties directly defined on the object\n Object.getOwnPropertyNames(obj).forEach((property) => {\n try {\n if (typeof obj[property] === 'function') objectFunctionNames.add(property);\n } catch (error) {\n // Too noisy - only reenable if you need more details\n // console.trace(`Skipping ${property} on ${objId} due to error: ${error}`);\n }\n });\n\n // Walk up the prototype chain and get additional function properties, skipping the functions\n // provided by the final (Object) prototype\n let objectPrototype = Object.getPrototypeOf(obj);\n while (objectPrototype && Object.getPrototypeOf(objectPrototype)) {\n Object.getOwnPropertyNames(objectPrototype).forEach((property) => {\n try {\n if (typeof obj[property] === 'function') objectFunctionNames.add(property);\n } catch (error) {\n // Too noisy - only reenable if you need more details\n // console.trace(`Skipping ${property} on ${objId}'s prototype due to error: ${error}`);\n }\n });\n objectPrototype = Object.getPrototypeOf(objectPrototype);\n }\n\n return objectFunctionNames;\n}\n\n/**\n * Creates a synchronous proxy for an asynchronous object. The proxy allows calling methods on an\n * object that is asynchronously fetched using a provided asynchronous function.\n *\n * @param getObject - A function that returns a promise resolving to the object whose asynchronous\n * methods to call.\n * @param objectToProxy - An optional object that is the object that is proxied. If a property is\n * accessed that does exist on this object, it will be returned. If a property is accessed that\n * does not exist on this object, it will be considered to be an asynchronous method called on the\n * object returned from getObject.\n * @returns A synchronous proxy for the asynchronous object.\n */\nexport function createSyncProxyForAsyncObject(\n getObject: (args?: unknown[]) => Promise,\n objectToProxy: Partial = {},\n): T {\n // objectToProxy will have only the synchronously accessed properties of T on it, and this proxy\n // makes the async methods that do not exist yet available synchronously so we have all of T\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n return new Proxy(objectToProxy as T, {\n get(target, prop) {\n // We don't have any type information for T, so we assume methodName exists on it and will let JavaScript throw if it doesn't exist\n // @ts-expect-error 7053\n if (prop in target) return target[prop];\n return async (...args: unknown[]) => {\n // 7053: We don't have any type information for T, so we assume methodName exists on it and will let JavaScript throw if it doesn't exist\n // 2556: The args here are the parameters for the method specified\n // @ts-expect-error 7053 2556\n return (await getObject())[prop](...args);\n };\n },\n });\n}\n\n/** Within type T, recursively change all properties to be optional */\nexport type DeepPartial = T extends object ? { [P in keyof T]?: DeepPartial } : T;\n\n/** Within type T, recursively change properties that were of type A to be of type B */\nexport type ReplaceType = T extends A\n ? B\n : T extends object\n ? { [K in keyof T]: ReplaceType }\n : T;\n\n// Thanks to jcalz at https://stackoverflow.com/a/50375286\n/**\n * Converts a union type to an intersection type (`|` to `&`).\n *\n * Note: this utility type is for use on object types. It may fail on other types.\n *\n * @example\n *\n * ```typescript\n * type TypeOne = { one: string };\n * type TypeTwo = { two: number };\n * type TypeThree = { three: string };\n *\n * type TypeNums = { one: TypeOne; two: TypeTwo; three: TypeThree };\n * const numNames = ['one', 'two'] as const;\n * type TypeNumNames = typeof numNames;\n *\n * // Same as `TypeOne | TypeTwo`\n * // `{ one: string } | { two: number }`\n * type TypeOneTwoUnion = TypeNums[TypeNumNames[number]];\n *\n * // Same as `TypeOne & TypeTwo`\n * // `{ one: string; two: number }`\n * type TypeOneTwoIntersection = UnionToIntersection;\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (\n x: infer I,\n) => void\n ? I\n : never;\n","import PlatformEventEmitter from './platform-event-emitter.model';\nimport { deepClone } from './util';\n\ntype JsonObjectLike = { [key: string]: unknown };\ntype JsonArrayLike = unknown[];\n\nexport type JsonDocumentLike = JsonObjectLike | JsonArrayLike;\n\n/**\n * Options for DocumentCombiner objects\n *\n * - `copyDocuments`: If true, this instance will perform a deep copy of all provided documents before\n * composing the output. If false, then changes made to provided documents after they are\n * contributed will be reflected in the next time output is composed.\n * - `ignoreDuplicateProperties`: If true, then duplicate properties are skipped if they are seen in\n * contributed documents. If false, then throw when duplicate properties are seen in contributed\n * documents.\n */\nexport type DocumentCombinerOptions = {\n copyDocuments: boolean;\n ignoreDuplicateProperties: boolean;\n};\n\n/**\n * Base class for any code that wants to compose JSON documents (primarily in the form of JS objects\n * or arrays) together into a single output document.\n */\nexport default class DocumentCombiner {\n protected baseDocument: JsonDocumentLike;\n protected readonly contributions = new Map();\n protected latestOutput: JsonDocumentLike | undefined;\n protected readonly options: DocumentCombinerOptions;\n private readonly onDidRebuildEmitter = new PlatformEventEmitter();\n /** Event that emits to announce that the document has been rebuilt and the output has been updated */\n // Need `onDidRebuildEmitter` to be instantiated before this line\n // eslint-disable-next-line @typescript-eslint/member-ordering\n readonly onDidRebuild = this.onDidRebuildEmitter.subscribe;\n\n /**\n * Create a DocumentCombiner instance\n *\n * @param baseDocument This is the first document that will be used when composing the output\n * @param options Options used by this object when combining documents\n */\n protected constructor(baseDocument: JsonDocumentLike, options: DocumentCombinerOptions) {\n // Setting baseDocument redundantly because TS doesn't understand that updateBaseDocument does it\n this.baseDocument = baseDocument;\n this.options = options;\n this.updateBaseDocument(baseDocument);\n }\n\n /**\n * Update the starting document for composition process\n *\n * @param baseDocument Base JSON document/JS object that all other documents are added to\n * @returns Recalculated output document given the new starting state and existing other documents\n */\n updateBaseDocument(baseDocument: JsonDocumentLike): JsonDocumentLike | undefined {\n this.validateBaseDocument(baseDocument);\n this.baseDocument = this.options.copyDocuments ? deepClone(baseDocument) : baseDocument;\n this.baseDocument = this.transformBaseDocumentAfterValidation(this.baseDocument);\n return this.rebuild();\n }\n\n /**\n * Add or update one of the contribution documents for the composition process\n *\n * Note: the order in which contribution documents are added can be considered to be indeterminate\n * as it is currently ordered by however `Map.forEach` provides the contributions. The order\n * matters when merging two arrays into one. Also, when `options.ignoreDuplicateProperties` is\n * `true`, the order also matters when adding the same property to an object that is already\n * provided previously. Please let us know if you have trouble because of indeterminate\n * contribution ordering.\n *\n * @param documentName Name of the contributed document to combine\n * @param document Content of the contributed document to combine\n * @returns Recalculated output document given the new or updated contribution and existing other\n * documents\n */\n addOrUpdateContribution(\n documentName: string,\n document: JsonDocumentLike,\n ): JsonDocumentLike | undefined {\n this.validateContribution(documentName, document);\n const previousDocumentVersion = this.contributions.get(documentName);\n let documentToSet = this.options.copyDocuments && !!document ? deepClone(document) : document;\n documentToSet = this.transformContributionAfterValidation(documentName, documentToSet);\n this.contributions.set(documentName, documentToSet);\n try {\n return this.rebuild();\n } catch (error) {\n // If the output isn't valid after adding/updating the contribution, put it back how it was\n if (previousDocumentVersion) this.contributions.set(documentName, previousDocumentVersion);\n else this.contributions.delete(documentName);\n throw new Error(`Error when setting the document named ${documentName}: ${error}`);\n }\n }\n\n /**\n * Delete one of the contribution documents for the composition process\n *\n * @param documentName Name of the contributed document to delete\n * @returns Recalculated output document given the remaining other documents\n */\n deleteContribution(documentName: string): JsonDocumentLike | undefined {\n const document = this.contributions.get(documentName);\n if (!document) throw new Error(`${documentName} does not exist`);\n this.contributions.delete(documentName);\n try {\n return this.rebuild();\n } catch (error) {\n // If the output isn't valid after deleting the contribution, put it back and rethrow\n this.contributions.set(documentName, document);\n throw new Error(`Error when deleting the document named ${documentName}: ${error}`);\n }\n }\n\n /**\n * Delete all present contribution documents for the composition process and return to the base\n * document\n *\n * @returns Recalculated output document consisting only of the base document\n */\n deleteAllContributions(): JsonDocumentLike | undefined {\n if (this.contributions.size <= 0) return this.latestOutput;\n\n // Save out all contributions\n const contributions = [...this.contributions.entries()];\n\n // Delete all contributions\n contributions.forEach(([contributionName]) => this.contributions.delete(contributionName));\n\n // Rebuild with no contributions\n try {\n return this.rebuild();\n } catch (error) {\n // If the output isn't valid after deleting all contributions, put them back and rethrow\n contributions.forEach(([contributionName, document]) =>\n this.contributions.set(contributionName, document),\n );\n throw new Error(`Error when deleting all contributions: ${error}`);\n }\n }\n\n /**\n * Run the document composition process given the starting document and all contributions. Throws\n * if the output document fails to validate properly.\n *\n * @returns Recalculated output document given the starting and contributed documents\n */\n rebuild(): JsonDocumentLike | undefined {\n // The starting document is the output if there are no other contributions\n if (this.contributions.size === 0) {\n let potentialOutput = deepClone(this.baseDocument);\n potentialOutput = this.transformFinalOutputBeforeValidation(potentialOutput);\n this.validateOutput(potentialOutput);\n this.latestOutput = potentialOutput;\n this.onDidRebuildEmitter.emit(undefined);\n return this.latestOutput;\n }\n\n // Compose the output by validating each document one at a time to pinpoint errors better\n let outputIteration = this.baseDocument;\n this.contributions.forEach((contribution: JsonDocumentLike) => {\n outputIteration = mergeObjects(\n outputIteration,\n contribution,\n this.options.ignoreDuplicateProperties,\n );\n this.validateOutput(outputIteration);\n });\n outputIteration = this.transformFinalOutputBeforeValidation(outputIteration);\n this.validateOutput(outputIteration);\n this.latestOutput = outputIteration;\n this.onDidRebuildEmitter.emit(undefined);\n return this.latestOutput;\n }\n\n /**\n * Transform the starting document that is given to the combiner. This transformation occurs after\n * validating the base document and before combining any contributions.\n *\n * WARNING: If you do not create the combiner with option `copyDocuments: true` or clone inside\n * this method, this method will directly modify the `baseDocument` passed in.\n *\n * @param baseDocument Initial input document. Already validated via `validateBaseDocument`\n * @returns Transformed base document\n */\n // We just don't need `this` here. This is basically a no-op function that is available to child\n // classes to override\n // eslint-disable-next-line @typescript-eslint/class-methods-use-this\n protected transformBaseDocumentAfterValidation(baseDocument: JsonDocumentLike): JsonDocumentLike {\n return baseDocument;\n }\n\n /**\n * Transform the contributed document associated with `documentName`. This transformation occurs\n * after validating the contributed document and before combining with other documents.\n *\n * WARNING: If you do not create the combiner with option `copyDocuments: true` or clone inside\n * this method, this method will directly modify the contributed `document` passed in.\n *\n * @param documentName Name of the contributed document to combine\n * @param document Content of the contributed document to combine. Already validated via\n * `validateContribution`\n * @returns Transformed contributed document\n */\n // We just don't need `this` here. This is basically a no-op function that is available to child\n // classes to override\n // eslint-disable-next-line @typescript-eslint/class-methods-use-this\n protected transformContributionAfterValidation(\n // @ts-expect-error this parameter is unused but may be used in child classes\n documentName: string,\n document: JsonDocumentLike,\n ): JsonDocumentLike {\n return document;\n }\n\n /**\n * Throw an error if the provided document is not a valid starting document.\n *\n * @param baseDocument Base JSON document/JS object that all other documents are added to\n */\n // no-op intended to be overridden by child classes. Can't be static\n // @ts-expect-error ts(6133) parameter doesn't need to be used but still needs the right name\n // eslint-disable-next-line @typescript-eslint/class-methods-use-this, @typescript-eslint/no-unused-vars\n protected validateBaseDocument(baseDocument: JsonDocumentLike): void {}\n\n /**\n * Throw an error if the provided document is not a valid contribution document.\n *\n * @param documentName Name of the contributed document to combine\n * @param document Content of the contributed document to combine\n */\n // no-op intended to be overridden by child classes. Can't be static\n // @ts-expect-error ts(6133) parameter doesn't need to be used but still needs the right name\n // eslint-disable-next-line @typescript-eslint/class-methods-use-this, @typescript-eslint/no-unused-vars\n protected validateContribution(documentName: string, document: JsonDocumentLike): void {}\n\n /**\n * Throw an error if the provided output is not valid.\n *\n * @param output Output document that could potentially be returned to callers\n */\n // no-op intended to be overridden by child classes. Can't be static\n // @ts-expect-error ts(6133) parameter doesn't need to be used but still needs the right name\n // eslint-disable-next-line @typescript-eslint/class-methods-use-this, @typescript-eslint/no-unused-vars\n protected validateOutput(output: JsonDocumentLike): void {}\n\n /**\n * Transform the document that is the composition of the base document and all contribution\n * documents. This is the last step that will be run prior to validation via `validateOutput`\n * before `this.latestOutput` is updated to the new output.\n *\n * @param finalOutput Final output document that could potentially be returned to callers. \"Final\"\n * means no further contribution documents will be merged.\n */\n // no-op intended to be overridden by child classes. Can't be static\n // eslint-disable-next-line @typescript-eslint/class-methods-use-this\n protected transformFinalOutputBeforeValidation(finalOutput: JsonDocumentLike): JsonDocumentLike {\n return finalOutput;\n }\n}\n\n// #region Helper functions\n\n/**\n * Determines if the input values are objects but not arrays\n *\n * @param values Objects to check\n * @returns True if all the values are objects but not arrays\n */\nfunction areNonArrayObjects(...values: unknown[]): boolean {\n let allMatch = true;\n values.forEach((value: unknown) => {\n if (!value || typeof value !== 'object' || Array.isArray(value)) allMatch = false;\n });\n return allMatch;\n}\n\n/**\n * Determines if the input values are arrays\n *\n * @param value Objects to check\n * @returns True if the values are arrays\n */\nfunction areArrayObjects(...values: unknown[]): boolean {\n let allMatch = true;\n values.forEach((value: unknown) => {\n if (!value || typeof value !== 'object' || !Array.isArray(value)) allMatch = false;\n });\n return allMatch;\n}\n\n/**\n * Deep clone and recursively merge the properties of one object (copyFrom) into another\n * (startingPoint). Throws if copyFrom would overwrite values already existing in startingPoint.\n *\n * Does not modify the objects passed in.\n *\n * @param startingPoint Object that is the starting point for the return value\n * @param copyFrom Object whose values are copied into the return value\n * @param ignoreDuplicateProperties Whether to ignore object properties that are present in\n * `copyFrom` that are already present in `startingPoint`. If `false`, throws when an object\n * property in `copyFrom` is already present in `startingPoint`\n * @returns Object that is the combination of the two documents\n */\nfunction mergeObjects(\n startingPoint: JsonDocumentLike,\n copyFrom: JsonDocumentLike,\n ignoreDuplicateProperties: boolean,\n): JsonDocumentLike {\n const retVal = deepClone(startingPoint);\n\n if (!copyFrom) return retVal;\n\n return mergeObjectsInternal(retVal, deepClone(copyFrom), ignoreDuplicateProperties);\n}\n\n/**\n * Recursively merge the properties of one object (copyFrom) into another (startingPoint). Throws if\n * copyFrom would overwrite values already existing in startingPoint.\n *\n * WARNING: Modifies the argument objects in some way. Recommended to use `mergeObjects`\n *\n * @param startingPoint Object that is the starting point for the return value\n * @param copyFrom Object whose values are copied into the return value\n * @param ignoreDuplicateProperties Whether to ignore object properties that are present in\n * `copyFrom` that are already present in `startingPoint`. If `false`, throws when an object\n * property in `copyFrom` is already present in `startingPoint`\n * @returns Object that is the combination of the two documents\n */\nfunction mergeObjectsInternal(\n startingPoint: JsonDocumentLike,\n copyFrom: JsonDocumentLike,\n ignoreDuplicateProperties: boolean,\n): JsonDocumentLike {\n if (!copyFrom) return startingPoint;\n\n if (areNonArrayObjects(startingPoint, copyFrom)) {\n // Merge properties since they are both objects\n\n // We know these are objects from the `if` check\n /* eslint-disable no-type-assertion/no-type-assertion */\n const startingPointObj = startingPoint as JsonObjectLike;\n const copyFromObj = copyFrom as JsonObjectLike;\n /* eslint-enable no-type-assertion/no-type-assertion */\n Object.keys(copyFromObj).forEach((key: string | number) => {\n if (Object.hasOwn(startingPointObj, key)) {\n if (areNonArrayObjects(startingPointObj[key], copyFromObj[key])) {\n startingPointObj[key] = mergeObjectsInternal(\n // We know these are objects from the `if` check\n /* eslint-disable no-type-assertion/no-type-assertion */\n startingPointObj[key] as JsonObjectLike,\n copyFromObj[key] as JsonObjectLike,\n ignoreDuplicateProperties,\n /* eslint-enable no-type-assertion/no-type-assertion */\n );\n } else if (areArrayObjects(startingPointObj[key], copyFromObj[key])) {\n // Concat the arrays since they are both arrays\n\n // We know these are arrays from the `else if` check\n /* eslint-disable no-type-assertion/no-type-assertion */\n startingPointObj[key] = (startingPointObj[key] as JsonArrayLike).concat(\n copyFromObj[key] as JsonArrayLike,\n );\n /* eslint-enable no-type-assertion/no-type-assertion */\n } else if (!ignoreDuplicateProperties)\n throw new Error(`Cannot merge objects: key \"${key}\" already exists in the target object`);\n // Note that the first non-object non-array value that gets placed in a property stays.\n // New values do not override existing ones\n } else {\n startingPointObj[key] = copyFromObj[key];\n }\n });\n } else if (areArrayObjects(startingPoint, copyFrom)) {\n // Concat the arrays since they are both arrays\n\n // Push the contents of copyFrom into startingPoint since it is a const and was already deep cloned\n // We know these are objects from the `else if` check\n /* eslint-disable no-type-assertion/no-type-assertion */\n (startingPoint as JsonArrayLike).push(...(copyFrom as JsonArrayLike));\n /* eslint-enable no-type-assertion/no-type-assertion */\n }\n\n // Note that nothing happens if `startingPoint` is not an object or an array or if `startingPoint`\n // and `copyFrom` are not both object or both arrays. Should we throw? Should we push `copyFrom`'s\n // values into the array? Other? Maybe one day we can add some options to decide what to do in\n // this situation, but YAGNI for now\n\n return startingPoint;\n}\n\n// #endregion\n","import { Mutex as AsyncMutex } from 'async-mutex';\n\n// Extending Mutex from async-mutex so we can add JSDoc\n\n/**\n * Class that allows calling asynchronous functions multiple times at once while only running one at\n * a time.\n *\n * @example\n *\n * ```typescript\n * const mutex = new Mutex();\n *\n * mutex.runExclusive(async () => {\n * // Do some asynchronous stuff\n * console.log('These run one-at-a-time');\n * });\n *\n * mutex.runExclusive(async () => {\n * // Do some asynchronous stuff\n * console.log('These run one-at-a-time');\n * });\n * ```\n *\n * See [`async-mutex`](https://www.npmjs.com/package/async-mutex) for more information.\n */\nclass Mutex extends AsyncMutex {}\n\nexport default Mutex;\n","import Mutex from './mutex';\n\n/** Map of {@link Mutex}es that automatically (lazily) generates a new {@link Mutex} for any new key */\nclass MutexMap {\n private mutexesByID = new Map();\n\n get(mutexID: string): Mutex {\n let retVal = this.mutexesByID.get(mutexID);\n if (retVal) return retVal;\n\n retVal = new Mutex();\n this.mutexesByID.set(mutexID, retVal);\n return retVal;\n }\n}\n\nexport default MutexMap;\n","import DocumentCombiner, { DocumentCombinerOptions, JsonDocumentLike } from './document-combiner';\n\nexport default class NonValidatingDocumentCombiner extends DocumentCombiner {\n // Making the protected base constructor public\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(baseDocument: JsonDocumentLike, options: DocumentCombinerOptions) {\n super(baseDocument, options);\n }\n\n get output(): JsonDocumentLike | undefined {\n return this.latestOutput;\n }\n}\n","/** Enables language-sensitive number formatting. Wraps Intl.NumberFormat */\nexport default class NumberFormat {\n private numberFormatter: Intl.NumberFormat;\n\n constructor(locales?: string | string[], options?: Intl.NumberFormatOptions) {\n this.numberFormatter = new Intl.NumberFormat(locales, options);\n }\n\n /**\n * Formats a number according to the locale and formatting options of this NumberFormat object\n *\n * @param value Number or BigInt to format\n * @returns String representing the given number formatted according to the locale and formatting\n * options of this NumberFormat object\n */\n format(value: number | bigint): string {\n return this.numberFormatter.format(value);\n }\n\n /**\n * Formats a range of numbers according to the locale and formatting options of this NumberFormat\n * object\n *\n * @param startRange Number or bigint representing the start of the range\n * @param endRange Number or bigint representing the end of the range\n * @returns String representing the given range of numbers formatted according to the locale and\n * formatting options of this NumberFormat object\n */\n formatRange(startRange: number | bigint, endRange: number | bigint): string {\n return this.numberFormatter.formatRange(startRange, endRange);\n }\n\n /**\n * Returns an array of objects containing the locale-specific tokens from which it is possible to\n * build custom strings while preserving the locale-specific parts.\n *\n * @param startRange Number or bigint representing start of the range\n * @param endRange Number or bigint representing end of the range\n * @returns Array of NumberRangeFormatPart objects containing the formatted range of numbers in\n * parts\n */\n formatRangeToParts(\n startRange: number | bigint,\n endRange: number | bigint,\n ): Intl.NumberRangeFormatPart[] {\n return this.numberFormatter.formatRangeToParts(startRange, endRange);\n }\n\n /**\n * Allows locale-aware formatting of strings produced by this NumberFormat object\n *\n * @param value Number or bigint to format\n * @returns Array of NumberFormatPart objects containing the formatted number in parts\n */\n formatToParts(value: number | bigint): Intl.NumberFormatPart[] {\n return this.numberFormatter.formatToParts(value);\n }\n\n /**\n * Returns a new object with properties reflecting the locale and number formatting options\n * computed during initialization of this NumberFormat object\n *\n * @returns ResolvedNumberFormatOptions object\n */\n resolvedOptions(): Intl.ResolvedNumberFormatOptions {\n return this.numberFormatter.resolvedOptions();\n }\n}\n","import { Dispose } from './disposal.model';\nimport { Unsubscriber, UnsubscriberAsync } from './unsubscriber';\n\n/** Simple collection for UnsubscriberAsync objects that also provides an easy way to run them. */\nexport default class UnsubscriberAsyncList {\n readonly unsubscribers = new Set();\n\n constructor(private name = 'Anonymous') {}\n\n /**\n * Add unsubscribers to the list. Note that duplicates are not added twice.\n *\n * @param unsubscribers - Objects that were returned from a registration process.\n */\n add(...unsubscribers: (UnsubscriberAsync | Unsubscriber | Dispose)[]) {\n unsubscribers.forEach((unsubscriber) => {\n if ('dispose' in unsubscriber) this.unsubscribers.add(unsubscriber.dispose);\n else this.unsubscribers.add(unsubscriber);\n });\n }\n\n /**\n * Run all unsubscribers added to this list and then clear the list.\n *\n * @returns `true` if all unsubscribers succeeded, `false` otherwise.\n */\n async runAllUnsubscribers(): Promise {\n const unsubs = [...this.unsubscribers].map((unsubscriber) => unsubscriber());\n const results = await Promise.all(unsubs);\n this.unsubscribers.clear();\n return results.every((unsubscriberSucceeded, index) => {\n if (!unsubscriberSucceeded)\n console.error(`UnsubscriberAsyncList ${this.name}: Unsubscriber at index ${index} failed!`);\n\n return unsubscriberSucceeded;\n });\n }\n}\n","var P = Object.defineProperty;\nvar R = (t, e, s) => e in t ? P(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;\nvar n = (t, e, s) => R(t, typeof e != \"symbol\" ? e + \"\" : e, s);\nclass _ {\n constructor() {\n n(this, \"books\");\n n(this, \"firstSelectedBookNum\");\n n(this, \"lastSelectedBookNum\");\n n(this, \"count\");\n n(this, \"selectedBookNumbers\");\n n(this, \"selectedBookIds\");\n }\n}\nconst N = [\n \"GEN\",\n \"EXO\",\n \"LEV\",\n \"NUM\",\n \"DEU\",\n \"JOS\",\n \"JDG\",\n \"RUT\",\n \"1SA\",\n \"2SA\",\n // 10\n \"1KI\",\n \"2KI\",\n \"1CH\",\n \"2CH\",\n \"EZR\",\n \"NEH\",\n \"EST\",\n \"JOB\",\n \"PSA\",\n \"PRO\",\n // 20\n \"ECC\",\n \"SNG\",\n \"ISA\",\n \"JER\",\n \"LAM\",\n \"EZK\",\n \"DAN\",\n \"HOS\",\n \"JOL\",\n \"AMO\",\n // 30\n \"OBA\",\n \"JON\",\n \"MIC\",\n \"NAM\",\n \"HAB\",\n \"ZEP\",\n \"HAG\",\n \"ZEC\",\n \"MAL\",\n \"MAT\",\n // 40\n \"MRK\",\n \"LUK\",\n \"JHN\",\n \"ACT\",\n \"ROM\",\n \"1CO\",\n \"2CO\",\n \"GAL\",\n \"EPH\",\n \"PHP\",\n // 50\n \"COL\",\n \"1TH\",\n \"2TH\",\n \"1TI\",\n \"2TI\",\n \"TIT\",\n \"PHM\",\n \"HEB\",\n \"JAS\",\n \"1PE\",\n // 60\n \"2PE\",\n \"1JN\",\n \"2JN\",\n \"3JN\",\n \"JUD\",\n \"REV\",\n \"TOB\",\n \"JDT\",\n \"ESG\",\n \"WIS\",\n // 70\n \"SIR\",\n \"BAR\",\n \"LJE\",\n \"S3Y\",\n \"SUS\",\n \"BEL\",\n \"1MA\",\n \"2MA\",\n \"3MA\",\n \"4MA\",\n // 80\n \"1ES\",\n \"2ES\",\n \"MAN\",\n \"PS2\",\n \"ODA\",\n \"PSS\",\n \"JSA\",\n // actual variant text for JOS, now in LXA text\n \"JDB\",\n // actual variant text for JDG, now in LXA text\n \"TBS\",\n // actual variant text for TOB, now in LXA text\n \"SST\",\n // actual variant text for SUS, now in LXA text // 90\n \"DNT\",\n // actual variant text for DAN, now in LXA text\n \"BLT\",\n // actual variant text for BEL, now in LXA text\n \"XXA\",\n \"XXB\",\n \"XXC\",\n \"XXD\",\n \"XXE\",\n \"XXF\",\n \"XXG\",\n \"FRT\",\n // 100\n \"BAK\",\n \"OTH\",\n \"3ES\",\n // Used previously but really should be 2ES\n \"EZA\",\n // Used to be called 4ES, but not actually in any known project\n \"5EZ\",\n // Used to be called 5ES, but not actually in any known project\n \"6EZ\",\n // Used to be called 6ES, but not actually in any known project\n \"INT\",\n \"CNC\",\n \"GLO\",\n \"TDX\",\n // 110\n \"NDX\",\n \"DAG\",\n \"PS3\",\n \"2BA\",\n \"LBA\",\n \"JUB\",\n \"ENO\",\n \"1MQ\",\n \"2MQ\",\n \"3MQ\",\n // 120\n \"REP\",\n \"4BA\",\n \"LAO\"\n], B = [\n \"XXA\",\n \"XXB\",\n \"XXC\",\n \"XXD\",\n \"XXE\",\n \"XXF\",\n \"XXG\",\n \"FRT\",\n \"BAK\",\n \"OTH\",\n \"INT\",\n \"CNC\",\n \"GLO\",\n \"TDX\",\n \"NDX\"\n], O = [\n \"Genesis\",\n \"Exodus\",\n \"Leviticus\",\n \"Numbers\",\n \"Deuteronomy\",\n \"Joshua\",\n \"Judges\",\n \"Ruth\",\n \"1 Samuel\",\n \"2 Samuel\",\n \"1 Kings\",\n \"2 Kings\",\n \"1 Chronicles\",\n \"2 Chronicles\",\n \"Ezra\",\n \"Nehemiah\",\n \"Esther (Hebrew)\",\n \"Job\",\n \"Psalms\",\n \"Proverbs\",\n \"Ecclesiastes\",\n \"Song of Songs\",\n \"Isaiah\",\n \"Jeremiah\",\n \"Lamentations\",\n \"Ezekiel\",\n \"Daniel (Hebrew)\",\n \"Hosea\",\n \"Joel\",\n \"Amos\",\n \"Obadiah\",\n \"Jonah\",\n \"Micah\",\n \"Nahum\",\n \"Habakkuk\",\n \"Zephaniah\",\n \"Haggai\",\n \"Zechariah\",\n \"Malachi\",\n \"Matthew\",\n \"Mark\",\n \"Luke\",\n \"John\",\n \"Acts\",\n \"Romans\",\n \"1 Corinthians\",\n \"2 Corinthians\",\n \"Galatians\",\n \"Ephesians\",\n \"Philippians\",\n \"Colossians\",\n \"1 Thessalonians\",\n \"2 Thessalonians\",\n \"1 Timothy\",\n \"2 Timothy\",\n \"Titus\",\n \"Philemon\",\n \"Hebrews\",\n \"James\",\n \"1 Peter\",\n \"2 Peter\",\n \"1 John\",\n \"2 John\",\n \"3 John\",\n \"Jude\",\n \"Revelation\",\n \"Tobit\",\n \"Judith\",\n \"Esther Greek\",\n \"Wisdom of Solomon\",\n \"Sirach (Ecclesiasticus)\",\n \"Baruch\",\n \"Letter of Jeremiah\",\n \"Song of 3 Young Men\",\n \"Susanna\",\n \"Bel and the Dragon\",\n \"1 Maccabees\",\n \"2 Maccabees\",\n \"3 Maccabees\",\n \"4 Maccabees\",\n \"1 Esdras (Greek)\",\n \"2 Esdras (Latin)\",\n \"Prayer of Manasseh\",\n \"Psalm 151\",\n \"Odes\",\n \"Psalms of Solomon\",\n // WARNING, if you change the spelling of the *obsolete* tag be sure to update\n // IsObsolete routine\n \"Joshua A. *obsolete*\",\n \"Judges B. *obsolete*\",\n \"Tobit S. *obsolete*\",\n \"Susanna Th. *obsolete*\",\n \"Daniel Th. *obsolete*\",\n \"Bel Th. *obsolete*\",\n \"Extra A\",\n \"Extra B\",\n \"Extra C\",\n \"Extra D\",\n \"Extra E\",\n \"Extra F\",\n \"Extra G\",\n \"Front Matter\",\n \"Back Matter\",\n \"Other Matter\",\n \"3 Ezra *obsolete*\",\n \"Apocalypse of Ezra\",\n \"5 Ezra (Latin Prologue)\",\n \"6 Ezra (Latin Epilogue)\",\n \"Introduction\",\n \"Concordance \",\n \"Glossary \",\n \"Topical Index\",\n \"Names Index\",\n \"Daniel Greek\",\n \"Psalms 152-155\",\n \"2 Baruch (Apocalypse)\",\n \"Letter of Baruch\",\n \"Jubilees\",\n \"Enoch\",\n \"1 Meqabyan\",\n \"2 Meqabyan\",\n \"3 Meqabyan\",\n \"Reproof (Proverbs 25-31)\",\n \"4 Baruch (Rest of Baruch)\",\n \"Laodiceans\"\n], S = K();\nfunction g(t, e = !0) {\n return e && (t = t.toUpperCase()), t in S ? S[t] : 0;\n}\nfunction k(t) {\n return g(t) > 0;\n}\nfunction x(t) {\n const e = typeof t == \"string\" ? g(t) : t;\n return e >= 40 && e <= 66;\n}\nfunction T(t) {\n return (typeof t == \"string\" ? g(t) : t) <= 39;\n}\nfunction X(t) {\n return t <= 66;\n}\nfunction V(t) {\n const e = typeof t == \"string\" ? g(t) : t;\n return w(e) && !X(e);\n}\nfunction* L() {\n for (let t = 1; t <= N.length; t++) yield t;\n}\nconst G = 1, A = N.length;\nfunction H() {\n return [\"XXA\", \"XXB\", \"XXC\", \"XXD\", \"XXE\", \"XXF\", \"XXG\"];\n}\nfunction C(t, e = \"***\") {\n const s = t - 1;\n return s < 0 || s >= N.length ? e : N[s];\n}\nfunction I(t) {\n return t <= 0 || t > A ? \"******\" : O[t - 1];\n}\nfunction y(t) {\n return I(g(t));\n}\nfunction w(t) {\n const e = typeof t == \"number\" ? C(t) : t;\n return k(e) && !B.includes(e);\n}\nfunction q(t) {\n const e = typeof t == \"number\" ? C(t) : t;\n return k(e) && B.includes(e);\n}\nfunction U(t) {\n return O[t - 1].includes(\"*obsolete*\");\n}\nfunction K() {\n const t = {};\n for (let e = 0; e < N.length; e++)\n t[N[e]] = e + 1;\n return t;\n}\nconst m = {\n allBookIds: N,\n nonCanonicalIds: B,\n bookIdToNumber: g,\n isBookIdValid: k,\n isBookNT: x,\n isBookOT: T,\n isBookOTNT: X,\n isBookDC: V,\n allBookNumbers: L,\n firstBook: G,\n lastBook: A,\n extraBooks: H,\n bookNumberToId: C,\n bookNumberToEnglishName: I,\n bookIdToEnglishName: y,\n isCanonical: w,\n isExtraMaterial: q,\n isObsolete: U\n};\nvar l = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = \"Unknown\", t[t.Original = 1] = \"Original\", t[t.Septuagint = 2] = \"Septuagint\", t[t.Vulgate = 3] = \"Vulgate\", t[t.English = 4] = \"English\", t[t.RussianProtestant = 5] = \"RussianProtestant\", t[t.RussianOrthodox = 6] = \"RussianOrthodox\", t))(l || {});\nconst h = class h {\n // private versInfo: Versification;\n constructor(e) {\n n(this, \"name\");\n n(this, \"fullPath\");\n n(this, \"isPresent\");\n n(this, \"hasVerseSegments\");\n n(this, \"isCustomized\");\n n(this, \"baseVersification\");\n n(this, \"scriptureBooks\");\n n(this, \"_type\");\n if (e == null)\n throw new Error(\"Argument undefined\");\n typeof e == \"string\" ? (this.name = e, this._type = l[e]) : (this._type = e, this.name = l[e]);\n }\n get type() {\n return this._type;\n }\n equals(e) {\n return !e.type || !this.type ? !1 : e.type === this.type;\n }\n};\nn(h, \"Original\", new h(l.Original)), n(h, \"Septuagint\", new h(l.Septuagint)), n(h, \"Vulgate\", new h(l.Vulgate)), n(h, \"English\", new h(l.English)), n(h, \"RussianProtestant\", new h(l.RussianProtestant)), n(h, \"RussianOrthodox\", new h(l.RussianOrthodox));\nlet c = h;\nfunction E(t, e) {\n const s = e[0];\n for (let r = 1; r < e.length; r++)\n t = t.split(e[r]).join(s);\n return t.split(s);\n}\nvar D = /* @__PURE__ */ ((t) => (t[t.Valid = 0] = \"Valid\", t[t.UnknownVersification = 1] = \"UnknownVersification\", t[t.OutOfRange = 2] = \"OutOfRange\", t[t.VerseOutOfOrder = 3] = \"VerseOutOfOrder\", t[t.VerseRepeated = 4] = \"VerseRepeated\", t))(D || {});\nconst i = class i {\n constructor(e, s, r, a) {\n /** Not yet implemented. */\n n(this, \"firstChapter\");\n /** Not yet implemented. */\n n(this, \"lastChapter\");\n /** Not yet implemented. */\n n(this, \"lastVerse\");\n /** Not yet implemented. */\n n(this, \"hasSegmentsDefined\");\n /** Not yet implemented. */\n n(this, \"text\");\n /** Not yet implemented. */\n n(this, \"BBBCCCVVVS\");\n /** Not yet implemented. */\n n(this, \"longHashCode\");\n /** The versification of the reference. */\n n(this, \"versification\");\n n(this, \"rtlMark\", \"‏\");\n n(this, \"_bookNum\", 0);\n n(this, \"_chapterNum\", 0);\n n(this, \"_verseNum\", 0);\n n(this, \"_verse\");\n if (r == null && a == null)\n if (e != null && typeof e == \"string\") {\n const o = e, u = s != null && s instanceof c ? s : void 0;\n this.setEmpty(u), this.parse(o);\n } else if (e != null && typeof e == \"number\") {\n const o = s != null && s instanceof c ? s : void 0;\n this.setEmpty(o), this._verseNum = e % i.chapterDigitShifter, this._chapterNum = Math.floor(\n e % i.bookDigitShifter / i.chapterDigitShifter\n ), this._bookNum = Math.floor(e / i.bookDigitShifter);\n } else if (s == null)\n if (e != null && e instanceof i) {\n const o = e;\n this._bookNum = o.bookNum, this._chapterNum = o.chapterNum, this._verseNum = o.verseNum, this._verse = o.verse, this.versification = o.versification;\n } else {\n if (e == null) return;\n const o = e instanceof c ? e : i.defaultVersification;\n this.setEmpty(o);\n }\n else\n throw new Error(\"VerseRef constructor not supported.\");\n else if (e != null && s != null && r != null)\n if (typeof e == \"string\" && typeof s == \"string\" && typeof r == \"string\")\n this.setEmpty(a), this.updateInternal(e, s, r);\n else if (typeof e == \"number\" && typeof s == \"number\" && typeof r == \"number\")\n this._bookNum = e, this._chapterNum = s, this._verseNum = r, this.versification = a ?? i.defaultVersification;\n else\n throw new Error(\"VerseRef constructor not supported.\");\n else\n throw new Error(\"VerseRef constructor not supported.\");\n }\n /**\n * Determines if the verse string is in a valid format (does not consider versification).\n */\n static isVerseParseable(e) {\n return e.length > 0 && \"0123456789\".includes(e[0]) && !e.endsWith(this.verseRangeSeparator) && !e.endsWith(this.verseSequenceIndicator);\n }\n /**\n * Tries to parse the specified string into a verse reference.\n * @param str - The string to attempt to parse.\n * @returns success: `true` if the specified string was successfully parsed, `false` otherwise.\n * @returns verseRef: The result of the parse if successful, or empty VerseRef if it failed\n */\n static tryParse(e) {\n let s;\n try {\n return s = new i(e), { success: !0, verseRef: s };\n } catch (r) {\n if (r instanceof v)\n return s = new i(), { success: !1, verseRef: s };\n throw r;\n }\n }\n /**\n * Gets the reference as a comparable integer where the book, chapter, and verse each occupy 3\n * digits.\n * @param bookNum - Book number (this is 1-based, not an index).\n * @param chapterNum - Chapter number.\n * @param verseNum - Verse number.\n * @returns The reference as a comparable integer where the book, chapter, and verse each occupy 3\n * digits.\n */\n static getBBBCCCVVV(e, s, r) {\n return e % i.bcvMaxValue * i.bookDigitShifter + (s >= 0 ? s % i.bcvMaxValue * i.chapterDigitShifter : 0) + (r >= 0 ? r % i.bcvMaxValue : 0);\n }\n /**\n * Deserializes a serialized VerseRef.\n * @param serializedVerseRef - Serialized VerseRef to create from.\n * @returns the deserialized VerseRef.\n */\n static fromJSON(e) {\n const { book: s, chapterNum: r, verseNum: a, verse: o, versificationStr: u } = e, f = o || a.toString();\n let d;\n return u && (d = new c(u)), s ? new i(s, r.toString(), f, d) : new i();\n }\n /**\n * Parses a verse string and gets the leading numeric portion as a number.\n * @param verseStr - verse string to parse\n * @returns true if the entire string could be parsed as a single, simple verse number (1-999);\n * false if the verse string represented a verse bridge, contained segment letters, or was invalid\n */\n static tryGetVerseNum(e) {\n let s;\n if (!e)\n return s = -1, { success: !0, vNum: s };\n s = 0;\n let r;\n for (let a = 0; a < e.length; a++) {\n if (r = e[a], r < \"0\" || r > \"9\")\n return a === 0 && (s = -1), { success: !1, vNum: s };\n if (s = s * 10 + +r - 0, s > i.bcvMaxValue)\n return s = -1, { success: !1, vNum: s };\n }\n return { success: !0, vNum: s };\n }\n /**\n * Checks to see if a VerseRef hasn't been set - all values are the default.\n */\n get isDefault() {\n return this.bookNum === 0 && this.chapterNum === 0 && this.verseNum === 0 && this.versification == null;\n }\n /**\n * Gets whether the verse contains multiple verses.\n */\n get hasMultiple() {\n return this._verse != null && (this._verse.includes(i.verseRangeSeparator) || this._verse.includes(i.verseSequenceIndicator));\n }\n /**\n * Gets or sets the book of the reference. Book is the 3-letter abbreviation in capital letters,\n * e.g. `'MAT'`.\n */\n get book() {\n return m.bookNumberToId(this.bookNum, \"\");\n }\n set book(e) {\n this.bookNum = m.bookIdToNumber(e);\n }\n /**\n * Gets or sets the chapter of the reference,. e.g. `'3'`.\n */\n get chapter() {\n return this.isDefault || this._chapterNum < 0 ? \"\" : this._chapterNum.toString();\n }\n set chapter(e) {\n const s = +e;\n this._chapterNum = Number.isInteger(s) ? s : -1;\n }\n /**\n * Gets or sets the verse of the reference, including range, segments, and sequences, e.g. `'4'`,\n * or `'4b-5a, 7'`.\n */\n get verse() {\n return this._verse != null ? this._verse : this.isDefault || this._verseNum < 0 ? \"\" : this._verseNum.toString();\n }\n set verse(e) {\n const { success: s, vNum: r } = i.tryGetVerseNum(e);\n this._verse = s ? void 0 : e.replace(this.rtlMark, \"\"), this._verseNum = r, !(this._verseNum >= 0) && ({ vNum: this._verseNum } = i.tryGetVerseNum(this._verse));\n }\n /**\n * Get or set Book based on book number, e.g. `42`.\n */\n get bookNum() {\n return this._bookNum;\n }\n set bookNum(e) {\n if (e <= 0 || e > m.lastBook)\n throw new v(\n \"BookNum must be greater than zero and less than or equal to last book\"\n );\n this._bookNum = e;\n }\n /**\n * Gets or sets the chapter number, e.g. `3`. `-1` if not valid.\n */\n get chapterNum() {\n return this._chapterNum;\n }\n set chapterNum(e) {\n this.chapterNum = e;\n }\n /**\n * Gets or sets verse start number, e.g. `4`. `-1` if not valid.\n */\n get verseNum() {\n return this._verseNum;\n }\n set verseNum(e) {\n this._verseNum = e;\n }\n /**\n * String representing the versification (should ONLY be used for serialization/deserialization).\n *\n * @remarks This is for backwards compatibility when ScrVers was an enumeration.\n */\n get versificationStr() {\n var e;\n return (e = this.versification) == null ? void 0 : e.name;\n }\n set versificationStr(e) {\n this.versification = this.versification != null ? new c(e) : void 0;\n }\n /**\n * Determines if the reference is valid.\n */\n get valid() {\n return this.validStatus === 0;\n }\n /**\n * Get the valid status for this reference.\n */\n get validStatus() {\n return this.validateVerse(i.verseRangeSeparators, i.verseSequenceIndicators);\n }\n /**\n * Gets the reference as a comparable integer where the book,\n * chapter, and verse each occupy three digits and the verse is 0.\n */\n get BBBCCC() {\n return i.getBBBCCCVVV(this._bookNum, this._chapterNum, 0);\n }\n /**\n * Gets the reference as a comparable integer where the book,\n * chapter, and verse each occupy three digits. If verse is not null\n * (i.e., this reference represents a complex reference with verse\n * segments or bridge) this cannot be used for an exact comparison.\n */\n get BBBCCCVVV() {\n return i.getBBBCCCVVV(this._bookNum, this._chapterNum, this._verseNum);\n }\n /**\n * Gets whether the verse is defined as an excluded verse in the versification.\n * Does not handle verse ranges.\n */\n // eslint-disable-next-line @typescript-eslint/class-literal-property-style\n get isExcluded() {\n return !1;\n }\n /**\n * Parses the reference in the specified string.\n * Optionally versification can follow reference as in GEN 3:11/4\n * Throw an exception if\n * - invalid book name\n * - chapter number is missing or not a number\n * - verse number is missing or does not start with a number\n * - versification is invalid\n * @param verseStr - string to parse e.g. 'MAT 3:11'\n */\n parse(e) {\n if (e = e.replace(this.rtlMark, \"\"), e.includes(\"/\")) {\n const o = e.split(\"/\");\n if (e = o[0], o.length > 1)\n try {\n const u = +o[1].trim();\n this.versification = new c(l[u]);\n } catch {\n throw new v(\"Invalid reference : \" + e);\n }\n }\n const s = e.trim().split(\" \");\n if (s.length !== 2)\n throw new v(\"Invalid reference : \" + e);\n const r = s[1].split(\":\"), a = +r[0];\n if (r.length !== 2 || m.bookIdToNumber(s[0]) === 0 || !Number.isInteger(a) || a < 0 || !i.isVerseParseable(r[1]))\n throw new v(\"Invalid reference : \" + e);\n this.updateInternal(s[0], r[0], r[1]);\n }\n /**\n * Simplifies this verse ref so that it has no bridging of verses or\n * verse segments like `'1a'`.\n */\n simplify() {\n this._verse = void 0;\n }\n /**\n * Makes a clone of the reference.\n *\n * @returns The cloned VerseRef.\n */\n clone() {\n return new i(this);\n }\n toString() {\n const e = this.book;\n return e === \"\" ? \"\" : `${e} ${this.chapter}:${this.verse}`;\n }\n toJSON() {\n let e = this.verse;\n (e === \"\" || e === this.verseNum.toString()) && (e = void 0);\n const s = {\n book: this.book,\n chapterNum: this.chapterNum,\n verseNum: this.verseNum,\n verse: e,\n versificationStr: this.versificationStr\n };\n return e || delete s.verse, s;\n }\n /**\n * Compares this `VerseRef` with supplied one.\n * @param verseRef - object to compare this one to.\n * @returns `true` if this `VerseRef` is equal to the supplied one, `false` otherwise.\n */\n equals(e) {\n return e instanceof i ? e._bookNum === this._bookNum && e._chapterNum === this._chapterNum && e._verseNum === this._verseNum && e.verse === this.verse && (e.versification == null && this.versification == null || e.versification != null && this.versification != null && e.versification.equals(this.versification)) : !1;\n }\n /**\n * Enumerate all individual verses contained in a VerseRef.\n * Verse ranges are indicated by \"-\" and consecutive verses by \",\"s.\n * Examples:\n * GEN 1:2 returns GEN 1:2\n * GEN 1:1a-3b,5 returns GEN 1:1a, GEN 1:2, GEN 1:3b, GEN 1:5\n * GEN 1:2a-2c returns //! ??????\n *\n * @param specifiedVersesOnly - if set to true return only verses that are\n * explicitly specified only, not verses within a range. Defaults to `false`.\n * @param verseRangeSeparators - Verse range separators.\n * Defaults to `VerseRef.verseRangeSeparators`.\n * @param verseSequenceSeparators - Verse sequence separators.\n * Defaults to `VerseRef.verseSequenceIndicators`.\n * @returns An array of all single verse references in this VerseRef.\n */\n allVerses(e = !1, s = i.verseRangeSeparators, r = i.verseSequenceIndicators) {\n if (this._verse == null || this.chapterNum <= 0)\n return [this.clone()];\n const a = [], o = E(this._verse, r);\n for (const u of o.map((f) => E(f, s))) {\n const f = this.clone();\n f.verse = u[0];\n const d = f.verseNum;\n if (a.push(f), u.length > 1) {\n const b = this.clone();\n if (b.verse = u[1], !e)\n for (let p = d + 1; p < b.verseNum; p++) {\n const J = new i(\n this._bookNum,\n this._chapterNum,\n p,\n this.versification\n );\n this.isExcluded || a.push(J);\n }\n a.push(b);\n }\n }\n return a;\n }\n /**\n * Validates a verse number using the supplied separators rather than the defaults.\n */\n validateVerse(e, s) {\n if (!this.verse)\n return this.internalValid;\n let r = 0;\n for (const a of this.allVerses(!0, e, s)) {\n const o = a.internalValid;\n if (o !== 0)\n return o;\n const u = a.BBBCCCVVV;\n if (r > u)\n return 3;\n if (r === u)\n return 4;\n r = u;\n }\n return 0;\n }\n /**\n * Gets whether a single verse reference is valid.\n */\n get internalValid() {\n return this.versification == null ? 1 : this._bookNum <= 0 || this._bookNum > m.lastBook ? 2 : (m.isCanonical(this._bookNum), 0);\n }\n setEmpty(e = i.defaultVersification) {\n this._bookNum = 0, this._chapterNum = -1, this._verse = void 0, this.versification = e;\n }\n updateInternal(e, s, r) {\n this.bookNum = m.bookIdToNumber(e), this.chapter = s, this.verse = r;\n }\n};\nn(i, \"defaultVersification\", c.English), n(i, \"verseRangeSeparator\", \"-\"), n(i, \"verseSequenceIndicator\", \",\"), n(i, \"verseRangeSeparators\", [i.verseRangeSeparator]), n(i, \"verseSequenceIndicators\", [i.verseSequenceIndicator]), n(i, \"chapterDigitShifter\", 1e3), n(i, \"bookDigitShifter\", i.chapterDigitShifter * i.chapterDigitShifter), n(i, \"bcvMaxValue\", i.chapterDigitShifter - 1), /**\n * The valid status of the VerseRef.\n */\nn(i, \"ValidStatusType\", D);\nlet M = i;\nclass v extends Error {\n}\nexport {\n _ as BookSet,\n m as Canon,\n c as ScrVers,\n l as ScrVersType,\n M as VerseRef,\n v as VerseRefException\n};\n//# sourceMappingURL=index.es.js.map\n","\"use strict\"\r\n\r\n// Based on: https://github.com/lodash/lodash/blob/6018350ac10d5ce6a5b7db625140b82aeab804df/.internal/unicodeSize.js\r\n\r\nmodule.exports = () => {\r\n\t// Used to compose unicode character classes.\r\n\tconst astralRange = \"\\\\ud800-\\\\udfff\"\r\n\tconst comboMarksRange = \"\\\\u0300-\\\\u036f\"\r\n\tconst comboHalfMarksRange = \"\\\\ufe20-\\\\ufe2f\"\r\n\tconst comboSymbolsRange = \"\\\\u20d0-\\\\u20ff\"\r\n\tconst comboMarksExtendedRange = \"\\\\u1ab0-\\\\u1aff\"\r\n\tconst comboMarksSupplementRange = \"\\\\u1dc0-\\\\u1dff\"\r\n\tconst comboRange = comboMarksRange + comboHalfMarksRange + comboSymbolsRange + comboMarksExtendedRange + comboMarksSupplementRange\r\n\tconst varRange = \"\\\\ufe0e\\\\ufe0f\"\r\n\tconst familyRange = \"\\\\uD83D\\\\uDC69\\\\uD83C\\\\uDFFB\\\\u200D\\\\uD83C\\\\uDF93\"\r\n\r\n\t// Used to compose unicode capture groups.\r\n\tconst astral = `[${astralRange}]`\r\n\tconst combo = `[${comboRange}]`\r\n\tconst fitz = \"\\\\ud83c[\\\\udffb-\\\\udfff]\"\r\n\tconst modifier = `(?:${combo}|${fitz})`\r\n\tconst nonAstral = `[^${astralRange}]`\r\n\tconst regional = \"(?:\\\\uD83C[\\\\uDDE6-\\\\uDDFF]){2}\"\r\n\tconst surrogatePair = \"[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]\"\r\n\tconst zwj = \"\\\\u200d\"\r\n\tconst blackFlag = \"(?:\\\\ud83c\\\\udff4\\\\udb40\\\\udc67\\\\udb40\\\\udc62\\\\udb40(?:\\\\udc65|\\\\udc73|\\\\udc77)\\\\udb40(?:\\\\udc6e|\\\\udc63|\\\\udc6c)\\\\udb40(?:\\\\udc67|\\\\udc74|\\\\udc73)\\\\udb40\\\\udc7f)\"\r\n\tconst family = `[${familyRange}]`\r\n\r\n\t// Used to compose unicode regexes.\r\n\tconst optModifier = `${modifier}?`\r\n\tconst optVar = `[${varRange}]?`\r\n\tconst optJoin = `(?:${zwj}(?:${[nonAstral, regional, surrogatePair].join(\"|\")})${optVar + optModifier})*`\r\n\tconst seq = optVar + optModifier + optJoin\r\n\tconst nonAstralCombo = `${nonAstral}${combo}?`\r\n\tconst symbol = `(?:${[nonAstralCombo, combo, regional, surrogatePair, astral, family].join(\"|\")})`\r\n\r\n\t// Used to match [String symbols](https://mathiasbynens.be/notes/javascript-unicode).\r\n\treturn new RegExp(`${blackFlag}|${fitz}(?=${fitz})|${symbol + seq}`, \"g\")\r\n}\r\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// @ts-ignore\nvar char_regex_1 = __importDefault(require(\"char-regex\"));\n/**\n * Converts a string to an array of string chars\n * @param {string} str The string to turn into array\n * @returns {string[]}\n */\nfunction toArray(str) {\n if (typeof str !== 'string') {\n throw new Error('A string is expected as input');\n }\n return str.match(char_regex_1.default()) || [];\n}\nexports.toArray = toArray;\n/**\n * Returns the length of a string\n *\n * @export\n * @param {string} str\n * @returns {number}\n */\nfunction length(str) {\n // Check for input\n if (typeof str !== 'string') {\n throw new Error('Input must be a string');\n }\n var match = str.match(char_regex_1.default());\n return match === null ? 0 : match.length;\n}\nexports.length = length;\n/**\n * Returns a substring by providing start and end position\n *\n * @export\n * @param {string} str\n * @param {number} [begin=0] Starting position\n * @param {number} end End position\n * @returns {string}\n */\nfunction substring(str, begin, end) {\n if (begin === void 0) { begin = 0; }\n // Check for input\n if (typeof str !== 'string') {\n throw new Error('Input must be a string');\n }\n // Even though negative numbers work here, theyre not in the spec\n if (typeof begin !== 'number' || begin < 0) {\n begin = 0;\n }\n if (typeof end === 'number' && end < 0) {\n end = 0;\n }\n var match = str.match(char_regex_1.default());\n if (!match)\n return '';\n return match.slice(begin, end).join('');\n}\nexports.substring = substring;\n/**\n * Returns a substring by providing start position and length\n *\n * @export\n * @param {string} str\n * @param {number} [begin=0] Starting position\n * @param {number} len Desired length\n * @returns {string}\n */\nfunction substr(str, begin, len) {\n if (begin === void 0) { begin = 0; }\n // Check for input\n if (typeof str !== 'string') {\n throw new Error('Input must be a string');\n }\n var strLength = length(str);\n // Fix type\n if (typeof begin !== 'number') {\n begin = parseInt(begin, 10);\n }\n // Return zero-length string if got oversize number.\n if (begin >= strLength) {\n return '';\n }\n // Calculating postive version of negative value.\n if (begin < 0) {\n begin += strLength;\n }\n var end;\n if (typeof len === 'undefined') {\n end = strLength;\n }\n else {\n // Fix type\n if (typeof len !== 'number') {\n len = parseInt(len, 10);\n }\n end = len >= 0 ? len + begin : begin;\n }\n var match = str.match(char_regex_1.default());\n if (!match)\n return '';\n return match.slice(begin, end).join('');\n}\nexports.substr = substr;\n/**\n * Enforces a string to be a certain length by\n * adding or removing characters\n *\n * @export\n * @param {string} str\n * @param {number} [limit=16] Limit\n * @param {string} [padString='#'] The Pad String\n * @param {string} [padPosition='right'] The Pad Position\n * @returns {string}\n */\nfunction limit(str, limit, padString, padPosition) {\n if (limit === void 0) { limit = 16; }\n if (padString === void 0) { padString = '#'; }\n if (padPosition === void 0) { padPosition = 'right'; }\n // Input should be a string, limit should be a number\n if (typeof str !== 'string' || typeof limit !== 'number') {\n throw new Error('Invalid arguments specified');\n }\n // Pad position should be either left or right\n if (['left', 'right'].indexOf(padPosition) === -1) {\n throw new Error('Pad position should be either left or right');\n }\n // Pad string can be anything, we convert it to string\n if (typeof padString !== 'string') {\n padString = String(padString);\n }\n // Calculate string length considering astral code points\n var strLength = length(str);\n if (strLength > limit) {\n return substring(str, 0, limit);\n }\n else if (strLength < limit) {\n var padRepeats = padString.repeat(limit - strLength);\n return padPosition === 'left' ? padRepeats + str : str + padRepeats;\n }\n return str;\n}\nexports.limit = limit;\n/**\n * Returns the index of the first occurrence of a given string\n *\n * @export\n * @param {string} str\n * @param {string} [searchStr] the string to search\n * @param {number} [pos] starting position\n * @returns {number}\n */\nfunction indexOf(str, searchStr, pos) {\n if (pos === void 0) { pos = 0; }\n if (typeof str !== 'string') {\n throw new Error('Input must be a string');\n }\n if (str === '') {\n if (searchStr === '') {\n return 0;\n }\n return -1;\n }\n // fix type\n pos = Number(pos);\n pos = isNaN(pos) ? 0 : pos;\n searchStr = String(searchStr);\n var strArr = toArray(str);\n if (pos >= strArr.length) {\n if (searchStr === '') {\n return strArr.length;\n }\n return -1;\n }\n if (searchStr === '') {\n return pos;\n }\n var searchArr = toArray(searchStr);\n var finded = false;\n var index;\n for (index = pos; index < strArr.length; index += 1) {\n var searchIndex = 0;\n while (searchIndex < searchArr.length &&\n searchArr[searchIndex] === strArr[index + searchIndex]) {\n searchIndex += 1;\n }\n if (searchIndex === searchArr.length &&\n searchArr[searchIndex - 1] === strArr[index + searchIndex - 1]) {\n finded = true;\n break;\n }\n }\n return finded ? index : -1;\n}\nexports.indexOf = indexOf;\n","/**\n * Ensures that the given input is returned as an array.\n *\n * This function takes a value that might be a single item, an array, or `undefined` and returns it\n * as an array:\n *\n * - If the input is `undefined`, an empty array is returned.\n * - If the input is already an array, it is returned as-is.\n * - If the input is a single item, it is wrapped in an array.\n *\n * @typeParam T - The type of the elements in the array.\n * @param maybeArray - The value that may be a single item, an array, or `undefined`.\n * @returns An array containing the input value(s). If the input is `undefined`, an empty array is\n * returned.\n */\nexport default function ensureArray(maybeArray: T | T[] | undefined): T[] {\n if (!maybeArray) return [];\n\n return Array.isArray(maybeArray) ? maybeArray : [maybeArray];\n}\n","import { LocalizeKey } from 'menus.model';\nimport {\n indexOf as stringzIndexOf,\n substring as stringzSubstring,\n length as stringzLength,\n toArray as stringzToArray,\n limit as stringzLimit,\n substr as stringzSubstr,\n} from 'stringz';\nimport ensureArray from './array-util';\nimport { isString } from './util';\n\n/**\n * This function mirrors the `at` function from the JavaScript Standard String object. It handles\n * Unicode code points instead of UTF-16 character codes.\n *\n * Finds the Unicode code point at the given index.\n *\n * @param string String to index\n * @param index Position of the character to be returned in range of -length(string) to\n * length(string)\n * @returns New string consisting of the Unicode code point located at the specified offset,\n * undefined if index is out of bounds\n */\nexport function at(string: string, index: number): string | undefined {\n if (index > stringLength(string) || index < -stringLength(string)) return undefined;\n return substr(string, index, 1);\n}\n\n/**\n * This function mirrors the `charAt` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Returns a new string consisting of the single unicode code point at the given index.\n *\n * @param string String to index\n * @param index Position of the string character to be returned, in the range of 0 to\n * length(string)-1\n * @returns New string consisting of the Unicode code point located at the specified offset, empty\n * string if index is out of bounds\n */\nexport function charAt(string: string, index: number): string {\n if (index < 0 || index > stringLength(string) - 1) return '';\n return substr(string, index, 1);\n}\n\n/**\n * This function mirrors the `codePointAt` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Returns a non-negative integer that is the Unicode code point value of the character starting at\n * the given index.\n *\n * @param string String to index\n * @param index Position of the string character to be returned, in the range of 0 to\n * length(string)-1\n * @returns Non-negative integer representing the code point value of the character at the given\n * index, or undefined if there is no element at that position\n */\nexport function codePointAt(string: string, index: number): number | undefined {\n if (index < 0 || index > stringLength(string) - 1) return undefined;\n return substr(string, index, 1).codePointAt(0);\n}\n\n/**\n * This function mirrors the `endsWith` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Determines whether a string ends with the characters of this string.\n *\n * @param string String to search through\n * @param searchString Characters to search for at the end of the string\n * @param endPosition End position where searchString is expected to be found. Default is\n * `length(string)`\n * @returns True if it ends with searchString, false if it does not\n */\nexport function endsWith(\n string: string,\n searchString: string,\n endPosition: number = stringLength(string),\n): boolean {\n const lastIndexOfSearchString = lastIndexOf(string, searchString);\n if (lastIndexOfSearchString === -1) return false;\n if (lastIndexOfSearchString + stringLength(searchString) !== endPosition) return false;\n return true;\n}\n\n/**\n * Get the index of the closest closing curly brace in a string.\n *\n * Note: when escaped, gets the index of the curly brace, not the backslash before it.\n *\n * @param str String to search\n * @param index Index at which to start searching. Inclusive of this index\n * @param escaped Whether to search for an escaped or an unescaped closing curly brace\n * @returns Index of closest closing curly brace or -1 if not found\n */\nfunction indexOfClosestClosingCurlyBrace(str: string, index: number, escaped: boolean) {\n if (index < 0) return -1;\n if (escaped) {\n if (charAt(str, index) === '}' && charAt(str, index - 1) === '\\\\') return index;\n const closeCurlyBraceIndex = indexOf(str, '\\\\}', index);\n return closeCurlyBraceIndex >= 0 ? closeCurlyBraceIndex + 1 : closeCurlyBraceIndex;\n }\n\n let i = index;\n const strLength = stringLength(str);\n while (i < strLength) {\n i = indexOf(str, '}', i);\n\n if (i === -1 || charAt(str, i - 1) !== '\\\\') break;\n\n // Didn't find an un-escaped close brace, so keep looking\n i += 1;\n }\n\n return i >= strLength ? -1 : i;\n}\n\n/**\n * Formats a string into an array of objects (adjacent strings are concatenated in one array entry),\n * replacing `{replacer key}` with the value in the `replacers` at that replacer key (or multiple\n * replacer values if there are multiple in the string). Will also remove \\ before curly braces if\n * curly braces are escaped with a backslash in order to preserve the curly braces. E.g. 'Hi, this\n * is {name}! I like `\\{curly braces\\}`! would become Hi, this is Jim! I like {curly braces}!\n *\n * If the key in unescaped braces is not found, returns the key without the braces. Empty unescaped\n * curly braces will just return a string without the braces e.g. ('I am {Nemo}', { 'name': 'Jim'})\n * would return 'I am Nemo'.\n *\n * Note: React elements can be used as replacer values.\n *\n * @example\n *\n * ```tsx\n *

\n * {formatReplacementStringToArray('Hi {other}! I am {name}.', {\n * other: 'Billy',\n * name: Jim,\n * })}\n *

\n * ```\n *\n * @example\n *\n * ```typescript\n * formatReplacementStringToArray(\n * 'Hi, this is {name}! I like \\{curly braces\\}! I have a {carInfo} car. My favorite food is {food}.',\n * { name: ['Bill'], carInfo: { year: 2015, color: 'blue' } }\n * );\n *\n * =>\n *\n * ['Hi, this is ', ['Bill'], '! I like {curly braces}! I have a ', { year: 2015, color: 'blue' }, ' car. My favorite food is food.']\n * ```\n *\n * @param str String to format and break out into an array of objects\n * @param replacers Object whose keys are replacer keys and whose values are the values with which\n * to replace `{replacer key}`s found in the string to format. If the replacer value is a string,\n * it will be concatenated into existing strings in the array. Otherwise, the replacer value will\n * be added as a new entry in the array\n * @returns Array of formatted strings and replaced objects\n */\nexport function formatReplacementStringToArray(\n str: string,\n replacers: { [key: string | number]: T } | object,\n): (string | T)[] {\n /** The compiled list of contents with replacers replaced appropriately */\n const contents: (string | T)[] = [];\n\n // current index in the string as we go through it\n let i = 0;\n // first index of characters to include in the next plain string added to the content\n let nextIntermediateStartIndex = 0;\n\n /**\n * Adds some content to the array of contents that is being built and also add the intermediate\n * string between the last added content and this added content\n *\n * @param newContent Content to add\n * @param newContentIndex Position in string where newContent starts\n * @param newContentLength Length in the string of the representation of this newContent\n */\n function addToContents(\n newContent: string | T,\n newContentIndex: number,\n newContentLength: number,\n ) {\n // Get the string content between the last new content and this new content\n const intermediateContent = substring(str, nextIntermediateStartIndex, newContentIndex);\n\n // If the last item in contents is a string, pull it out and add intermediateContent to\n // it. Otherwise stick with just intermediateContent\n const baseSubstring =\n contents.length > 0 && isString(contents[contents.length - 1])\n ? `${contents.pop()}${intermediateContent}`\n : intermediateContent;\n\n if (isString(newContent)) {\n // If the new content is a string, add it all together\n contents.push(`${baseSubstring}${newContent}`);\n } else {\n // New content is not a string. Add the base string if it exists (don't add an\n // empty string between added contents), then add the new content separately\n if (baseSubstring) contents.push(baseSubstring);\n contents.push(newContent);\n }\n\n // Set the intermediate start index to right after the new content so whatever\n // string content is between replacers gets added\n nextIntermediateStartIndex = newContentIndex + newContentLength;\n }\n\n const strLength = stringLength(str);\n while (i < strLength) {\n switch (charAt(str, i)) {\n case '{':\n if (charAt(str, i - 1) !== '\\\\') {\n // This character is an un-escaped open curly brace. Try to match and replace\n const closeCurlyBraceIndex = indexOfClosestClosingCurlyBrace(str, i, false);\n if (closeCurlyBraceIndex >= 0) {\n // We have matching open and close indices. Try to replace the contents\n const replacerKey = substring(str, i + 1, closeCurlyBraceIndex);\n\n // Replace with the replacer or just remove the curly braces\n const replacerContent =\n replacerKey in replacers\n ? // Just checked that the key is in the object\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n replacers[replacerKey as keyof typeof replacers]\n : replacerKey;\n\n addToContents(replacerContent, i, closeCurlyBraceIndex + 1 - i);\n\n // Put our index at the closing brace to keep processing the string after it\n i = closeCurlyBraceIndex;\n // Set the intermediate start index to right after our closing curly brace so whatever\n // string content is between replacers gets added\n nextIntermediateStartIndex = closeCurlyBraceIndex + 1;\n } else {\n // This is an unexpected un-escaped open curly brace with no matching closing curly\n // brace. Just ignore, I guess\n }\n } else {\n // This character is an escaped open curly brace. Add the curly brace but skip over the\n // escape backslash\n addToContents('{', i - 1, 2);\n }\n break;\n case '}':\n if (charAt(str, i - 1) !== '\\\\') {\n // This character is an un-escaped closing curly brace with no matching open curly\n // brace. Just ignore, I guess\n } else {\n // This character is an escaped closing curly brace. Add the curly brace but skip over\n // the escape backslash\n addToContents('}', i - 1, 2);\n }\n break;\n default:\n // No need to do anything with other characters at this point\n break;\n }\n\n i += 1;\n }\n\n // Now we are through the whole string and need to add the string content after all replacers if\n // there is anything left\n if (nextIntermediateStartIndex < strLength) {\n // Get the string content between the last new content and this new content\n const endContent = substring(str, nextIntermediateStartIndex);\n\n // If the last item in contents is a string, pull it out and add endContent to\n // it. Then put it in the contents array\n contents.push(\n contents.length > 0 && isString(contents[contents.length - 1])\n ? `${contents.pop()}${endContent}`\n : endContent,\n );\n }\n\n return contents;\n}\n\n/**\n * Formats a string, replacing `{replacer key}` with the value in the `replacers` at that replacer\n * key (or multiple replacer values if there are multiple in the string). Will also remove \\ before\n * curly braces if curly braces are escaped with a backslash in order to preserve the curly braces.\n * E.g. 'Hi, this is {name}! I like `\\{curly braces\\}`! would become Hi, this is Jim! I like {curly\n * braces}!\n *\n * If the key in unescaped braces is not found, returns the key without the braces. Empty unescaped\n * curly braces will just return a string without the braces e.g. ('I am {Nemo}', { 'name': 'Jim'})\n * would return 'I am Nemo'.\n *\n * @example\n *\n * ```typescript\n * formatReplacementString(\n * 'Hi, this is {name}! I like \\{curly braces\\}! I have a {carColor} car. My favorite food is {food}.',\n * { name: 'Bill', carColor: 'blue' }\n * );\n *\n * =>\n *\n * 'Hi, this is Bill! I like {curly braces}! I have a blue car. My favorite food is food.'\n * ```\n *\n * @param str String to format\n * @param replacers Object whose keys are replacer keys and whose values are the values with which\n * to replace `{replacer key}`s found in the string to format. Will be coerced to strings using\n * `${replacerValue}`\n * @returns Formatted string\n */\nexport function formatReplacementString(\n str: string,\n replacers: { [key: string | number]: string | unknown } | object,\n): string {\n return formatReplacementStringToArray(str, replacers)\n .map((content) => `${content}`)\n .join('');\n}\n\n/**\n * This function mirrors the `includes` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Performs a case-sensitive search to determine if searchString is found in string.\n *\n * @param string String to search through\n * @param searchString String to search for\n * @param position Position within the string to start searching for searchString. Default is `0`\n * @returns True if search string is found, false if it is not\n */\nexport function includes(string: string, searchString: string, position: number = 0): boolean {\n const partialString = substring(string, position);\n const indexOfSearchString = indexOf(partialString, searchString);\n if (indexOfSearchString === -1) return false;\n return true;\n}\n\n/**\n * This function mirrors the `indexOf` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Returns the index of the first occurrence of a given string.\n *\n * @param string String to search through\n * @param searchString The string to search for\n * @param position Start of searching. Default is `0`\n * @returns Index of the first occurrence of a given string\n */\nexport function indexOf(\n string: string,\n searchString: string,\n position: number | undefined = 0,\n): number {\n return stringzIndexOf(string, searchString, position);\n}\n\n/**\n * This function mirrors the `lastIndexOf` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Searches this string and returns the index of the last occurrence of the specified substring.\n *\n * @param string String to search through\n * @param searchString Substring to search for\n * @param position The index at which to begin searching. If omitted, the search begins at the end\n * of the string. Default is `undefined`\n * @returns Index of the last occurrence of searchString found, or -1 if not found.\n */\nexport function lastIndexOf(string: string, searchString: string, position?: number): number {\n let validatedPosition = position === undefined ? stringLength(string) : position;\n\n if (validatedPosition < 0) {\n validatedPosition = 0;\n } else if (validatedPosition >= stringLength(string)) {\n validatedPosition = stringLength(string) - 1;\n }\n\n for (let index = validatedPosition; index >= 0; index--) {\n if (substr(string, index, stringLength(searchString)) === searchString) {\n return index;\n }\n }\n\n return -1;\n}\n\n/**\n * This function mirrors the `length` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes. Since `length` appears to be a\n * reserved keyword, the function was renamed to `stringLength`\n *\n * Returns the length of a string.\n *\n * @param string String to return the length for\n * @returns Number that is length of the starting string\n */\nexport function stringLength(string: string): number {\n return stringzLength(string);\n}\n\n/**\n * This function mirrors the `normalize` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Returns the Unicode Normalization Form of this string.\n *\n * @param string The starting string\n * @param form Form specifying the Unicode Normalization Form. Default is `'NFC'`\n * @returns A string containing the Unicode Normalization Form of the given string.\n */\nexport function normalize(string: string, form: 'NFC' | 'NFD' | 'NFKC' | 'NFKD' | 'none'): string {\n const upperCaseForm = form.toUpperCase();\n if (upperCaseForm === 'NONE') {\n return string;\n }\n return string.normalize(upperCaseForm);\n}\n\n/**\n * Compares two strings using an ordinal comparison approach based on the specified collation\n * options. This function uses the built-in `localeCompare` method with the 'en' locale and the\n * provided collation options to compare the strings.\n *\n * @param string1 The first string to compare.\n * @param string2 The second string to compare.\n * @param options Optional. The collation options used for comparison.\n * @returns A number indicating the result of the comparison: - Negative value if string1 precedes\n * string2 in sorting order. - Zero if string1 and string2 are equivalent in sorting order. -\n * Positive value if string1 follows string2 in sorting order.\n */\nexport function ordinalCompare(\n string1: string,\n string2: string,\n options?: Intl.CollatorOptions,\n): number {\n return string1.localeCompare(string2, 'en', options);\n}\n\n/**\n * This function mirrors the `padEnd` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Pads this string with another string (multiple times, if needed) until the resulting string\n * reaches the given length. The padding is applied from the end of this string.\n *\n * @param string String to add padding too\n * @param targetLength The length of the resulting string once the starting string has been padded.\n * If value is less than or equal to length(string), then string is returned as is.\n * @param padString The string to pad the current string with. If padString is too long to stay\n * within targetLength, it will be truncated. Default is `\" \"`\n * @returns String with appropriate padding at the end\n */\n// Note: Limit with padString only works when length(padString) = 1, will be fixed with https://github.com/sallar/stringz/pull/59\nexport function padEnd(string: string, targetLength: number, padString: string = ' '): string {\n if (targetLength <= stringLength(string)) return string;\n return stringzLimit(string, targetLength, padString, 'right');\n}\n\n/**\n * This function mirrors the `padStart` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Pads this string with another string (multiple times, if needed) until the resulting string\n * reaches the given length. The padding is applied from the start of this string.\n *\n * @param string String to add padding too\n * @param targetLength The length of the resulting string once the starting string has been padded.\n * If value is less than or equal to length(string), then string is returned as is.\n * @param padString The string to pad the current string with. If padString is too long to stay\n * within the targetLength, it will be truncated from the end. Default is `\" \"`\n * @returns String with of specified targetLength with padString applied from the start\n */\n// Note: Limit with padString only works when length(padString) = 1, will be fixed with https://github.com/sallar/stringz/pull/59\nexport function padStart(string: string, targetLength: number, padString: string = ' '): string {\n if (targetLength <= stringLength(string)) return string;\n return stringzLimit(string, targetLength, padString, 'left');\n}\n\n// This is a helper function that performs a correction on the slice index to make sure it\n// cannot go out of bounds\nfunction correctSliceIndex(length: number, index: number) {\n if (index > length) return length;\n if (index < -length) return 0;\n if (index < 0) return index + length;\n return index;\n}\n\n/**\n * This function mirrors the `slice` function from the JavaScript Standard String object. It handles\n * Unicode code points instead of UTF-16 character codes.\n *\n * Extracts a section of this string and returns it as a new string, without modifying the original\n * string.\n *\n * @param string The starting string\n * @param indexStart The index of the first character to include in the returned substring.\n * @param indexEnd The index of the first character to exclude from the returned substring.\n * @returns A new string containing the extracted section of the string.\n */\nexport function slice(string: string, indexStart: number, indexEnd?: number): string {\n const length: number = stringLength(string);\n if (\n indexStart > length ||\n (indexEnd &&\n ((indexStart > indexEnd &&\n !(indexStart >= 0 && indexStart < length && indexEnd < 0 && indexEnd > -length)) ||\n indexEnd < -length))\n )\n return '';\n\n const newStart = correctSliceIndex(length, indexStart);\n const newEnd = indexEnd ? correctSliceIndex(length, indexEnd) : undefined;\n\n return substring(string, newStart, newEnd);\n}\n\n/**\n * This function mirrors the `split` function from the JavaScript Standard String object. It handles\n * Unicode code points instead of UTF-16 character codes.\n *\n * Takes a pattern and divides the string into an ordered list of substrings by searching for the\n * pattern, puts these substrings into an array, and returns the array.\n *\n * @param string The string to split\n * @param separator The pattern describing where each split should occur\n * @param splitLimit Limit on the number of substrings to be included in the array. Splits the\n * string at each occurrence of specified separator, but stops when limit entries have been placed\n * in the array.\n * @returns An array of strings, split at each point where separator occurs in the starting string.\n * Returns undefined if separator is not found in string.\n */\nexport function split(string: string, separator: string | RegExp, splitLimit?: number): string[] {\n const result: string[] = [];\n\n if (splitLimit !== undefined && splitLimit <= 0) {\n return [string];\n }\n\n if (separator === '') return toArray(string).slice(0, splitLimit);\n\n let regexSeparator = separator;\n if (\n typeof separator === 'string' ||\n (separator instanceof RegExp && !includes(separator.flags, 'g'))\n ) {\n regexSeparator = new RegExp(separator, 'g');\n }\n\n const matches: RegExpMatchArray | null = string.match(regexSeparator);\n\n let currentIndex = 0;\n\n if (!matches) return [string];\n\n for (let index = 0; index < (splitLimit ? splitLimit - 1 : matches.length); index++) {\n const matchIndex = indexOf(string, matches[index], currentIndex);\n const matchLength = stringLength(matches[index]);\n\n result.push(substring(string, currentIndex, matchIndex));\n currentIndex = matchIndex + matchLength;\n\n if (splitLimit !== undefined && result.length === splitLimit) {\n break;\n }\n }\n\n result.push(substring(string, currentIndex));\n\n return result;\n}\n\n/**\n * This function mirrors the `startsWith` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Determines whether the string begins with the characters of a specified string, returning true or\n * false as appropriate.\n *\n * @param string String to search through\n * @param searchString The characters to be searched for at the start of this string.\n * @param position The start position at which searchString is expected to be found (the index of\n * searchString's first character). Default is `0`\n * @returns True if the given characters are found at the beginning of the string, including when\n * searchString is an empty string; otherwise, false.\n */\nexport function startsWith(string: string, searchString: string, position: number = 0): boolean {\n const indexOfSearchString = indexOf(string, searchString, position);\n if (indexOfSearchString !== position) return false;\n return true;\n}\n\n/**\n * This function mirrors the `substr` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Returns a substring by providing start and length. This function is not exported because it is\n * considered deprecated, however it is still useful as a local helper function.\n *\n * @param string String to be divided\n * @param begin Start position. Default is `Start of string`\n * @param len Length of result. Default is `String length minus start parameter`. Default is `String\n * length minus start parameter`\n * @returns Substring from starting string\n */\nfunction substr(\n string: string,\n begin: number = 0,\n len: number = stringLength(string) - begin,\n): string {\n return stringzSubstr(string, begin, len);\n}\n\n/**\n * This function mirrors the `substring` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Returns a substring by providing start and end position.\n *\n * @param string String to be divided\n * @param begin Start position\n * @param end End position. Default is `End of string`\n * @returns Substring from starting string\n */\nexport function substring(\n string: string,\n begin: number,\n end: number = stringLength(string),\n): string {\n return stringzSubstring(string, begin, end);\n}\n\n/**\n * This function mirrors the `toArray` function from the JavaScript Standard String object. It\n * handles Unicode code points instead of UTF-16 character codes.\n *\n * Converts a string to an array of string characters.\n *\n * @param string String to convert to array\n * @returns An array of characters from the starting string\n */\nexport function toArray(string: string): string[] {\n return stringzToArray(string);\n}\n\n/** Determine whether the string is a `LocalizeKey` meant to be localized in Platform.Bible. */\nexport function isLocalizeKey(str: string): str is LocalizeKey {\n return startsWith(str, '%') && endsWith(str, '%');\n}\n\n/**\n * Escape RegExp special characters.\n *\n * You can also use this to escape a string that is inserted into the middle of a regex, for\n * example, into a character class.\n *\n * All credit to [`escape-string-regexp`](https://www.npmjs.com/package/escape-string-regexp) - this\n * function is simply copied directly from there to allow a common js export\n *\n * @example\n *\n * import escapeStringRegexp from 'platform-bible-utils';\n *\n * const escapedString = escapeStringRegexp('How much $ for a 🦄?');\n * //=> 'How much \\\\$ for a 🦄\\\\?'\n *\n * new RegExp(escapedString);\n */\nexport function escapeStringRegexp(string: string): string {\n if (typeof string !== 'string') {\n throw new TypeError('Expected a string');\n }\n\n // Escape characters with special meaning either inside or outside character sets.\n // Use a simple backslash escape when it’s always valid, and a `\\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.\n return string.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&').replace(/-/g, '\\\\x2d');\n}\n\n/**\n * Transforms a string or an array of strings into an array of regular expressions, ensuring that\n * the result is always an array.\n *\n * This function accepts a value that may be a single string, an array of strings, or `undefined`.\n * It then:\n *\n * - Converts each string into a `RegExp` object.\n * - If the input is an array containing nested arrays, it converts each string in the nested arrays\n * into `RegExp` objects.\n * - Ensures that the result is always an array of `RegExp` objects or arrays of `RegExp` objects.\n *\n * @param stringStringMaybeArray - The value to be transformed, which can be a single string, an\n * array of strings or arrays of strings, or `undefined`.\n * @returns An array of `RegExp` objects or arrays of `RegExp` objects. If the input is `undefined`,\n * an empty array is returned.\n */\nexport function transformAndEnsureRegExpRegExpArray(\n stringStringMaybeArray: string | (string | string[])[] | undefined,\n): (RegExp | RegExp[])[] {\n if (!stringStringMaybeArray) return [];\n\n const stringStringArray = ensureArray(stringStringMaybeArray);\n\n const regExpRegExpArray = stringStringArray.map((stringMaybeStringArray: string | string[]) =>\n Array.isArray(stringMaybeStringArray)\n ? stringMaybeStringArray.map((str) => new RegExp(str))\n : new RegExp(stringMaybeStringArray),\n );\n\n return regExpRegExpArray;\n}\n\n/**\n * Transforms a string or an array of strings into an array of regular expressions.\n *\n * This function accepts a value that may be a single string, an array of strings, or `undefined`.\n * It then:\n *\n * - Converts each string into a `RegExp` object.\n * - Ensures that the result is always an array of `RegExp` objects.\n *\n * @param stringMaybeArray - The value to be transformed, which can be a single string, an array of\n * strings, or `undefined`.\n * @returns An array of `RegExp` objects. If the input is `undefined`, an empty array is returned.\n */\nexport function transformAndEnsureRegExpArray(\n stringMaybeArray: string | string[] | undefined,\n): RegExp[] {\n if (!stringMaybeArray) return [];\n\n const stringArray = ensureArray(stringMaybeArray);\n\n const regExpArray = stringArray.map((str: string) => new RegExp(str));\n\n return regExpArray;\n}\n\n/** This is an internal-only export for testing purposes and should not be used in development */\nexport const testingStringUtils = {\n indexOfClosestClosingCurlyBrace,\n};\n","import { Canon, VerseRef } from '@sillsdev/scripture';\nimport { BookInfo, ScriptureReference, ScrollGroupId } from './scripture.model';\nimport { split, startsWith } from './string-util';\nimport { LocalizeKey } from './menus.model';\n\nconst scrBookData: BookInfo[] = [\n { shortName: 'ERR', fullNames: ['ERROR'], chapters: -1 },\n { shortName: 'GEN', fullNames: ['Genesis'], chapters: 50 },\n { shortName: 'EXO', fullNames: ['Exodus'], chapters: 40 },\n { shortName: 'LEV', fullNames: ['Leviticus'], chapters: 27 },\n { shortName: 'NUM', fullNames: ['Numbers'], chapters: 36 },\n { shortName: 'DEU', fullNames: ['Deuteronomy'], chapters: 34 },\n { shortName: 'JOS', fullNames: ['Joshua'], chapters: 24 },\n { shortName: 'JDG', fullNames: ['Judges'], chapters: 21 },\n { shortName: 'RUT', fullNames: ['Ruth'], chapters: 4 },\n { shortName: '1SA', fullNames: ['1 Samuel'], chapters: 31 },\n { shortName: '2SA', fullNames: ['2 Samuel'], chapters: 24 },\n { shortName: '1KI', fullNames: ['1 Kings'], chapters: 22 },\n { shortName: '2KI', fullNames: ['2 Kings'], chapters: 25 },\n { shortName: '1CH', fullNames: ['1 Chronicles'], chapters: 29 },\n { shortName: '2CH', fullNames: ['2 Chronicles'], chapters: 36 },\n { shortName: 'EZR', fullNames: ['Ezra'], chapters: 10 },\n { shortName: 'NEH', fullNames: ['Nehemiah'], chapters: 13 },\n { shortName: 'EST', fullNames: ['Esther'], chapters: 10 },\n { shortName: 'JOB', fullNames: ['Job'], chapters: 42 },\n { shortName: 'PSA', fullNames: ['Psalm', 'Psalms'], chapters: 150 },\n { shortName: 'PRO', fullNames: ['Proverbs'], chapters: 31 },\n { shortName: 'ECC', fullNames: ['Ecclesiastes'], chapters: 12 },\n { shortName: 'SNG', fullNames: ['Song of Solomon', 'Song of Songs'], chapters: 8 },\n { shortName: 'ISA', fullNames: ['Isaiah'], chapters: 66 },\n { shortName: 'JER', fullNames: ['Jeremiah'], chapters: 52 },\n { shortName: 'LAM', fullNames: ['Lamentations'], chapters: 5 },\n { shortName: 'EZK', fullNames: ['Ezekiel'], chapters: 48 },\n { shortName: 'DAN', fullNames: ['Daniel'], chapters: 12 },\n { shortName: 'HOS', fullNames: ['Hosea'], chapters: 14 },\n { shortName: 'JOL', fullNames: ['Joel'], chapters: 3 },\n { shortName: 'AMO', fullNames: ['Amos'], chapters: 9 },\n { shortName: 'OBA', fullNames: ['Obadiah'], chapters: 1 },\n { shortName: 'JON', fullNames: ['Jonah'], chapters: 4 },\n { shortName: 'MIC', fullNames: ['Micah'], chapters: 7 },\n { shortName: 'NAM', fullNames: ['Nahum'], chapters: 3 },\n { shortName: 'HAB', fullNames: ['Habakkuk'], chapters: 3 },\n { shortName: 'ZEP', fullNames: ['Zephaniah'], chapters: 3 },\n { shortName: 'HAG', fullNames: ['Haggai'], chapters: 2 },\n { shortName: 'ZEC', fullNames: ['Zechariah'], chapters: 14 },\n { shortName: 'MAL', fullNames: ['Malachi'], chapters: 4 },\n { shortName: 'MAT', fullNames: ['Matthew'], chapters: 28 },\n { shortName: 'MRK', fullNames: ['Mark'], chapters: 16 },\n { shortName: 'LUK', fullNames: ['Luke'], chapters: 24 },\n { shortName: 'JHN', fullNames: ['John'], chapters: 21 },\n { shortName: 'ACT', fullNames: ['Acts'], chapters: 28 },\n { shortName: 'ROM', fullNames: ['Romans'], chapters: 16 },\n { shortName: '1CO', fullNames: ['1 Corinthians'], chapters: 16 },\n { shortName: '2CO', fullNames: ['2 Corinthians'], chapters: 13 },\n { shortName: 'GAL', fullNames: ['Galatians'], chapters: 6 },\n { shortName: 'EPH', fullNames: ['Ephesians'], chapters: 6 },\n { shortName: 'PHP', fullNames: ['Philippians'], chapters: 4 },\n { shortName: 'COL', fullNames: ['Colossians'], chapters: 4 },\n { shortName: '1TH', fullNames: ['1 Thessalonians'], chapters: 5 },\n { shortName: '2TH', fullNames: ['2 Thessalonians'], chapters: 3 },\n { shortName: '1TI', fullNames: ['1 Timothy'], chapters: 6 },\n { shortName: '2TI', fullNames: ['2 Timothy'], chapters: 4 },\n { shortName: 'TIT', fullNames: ['Titus'], chapters: 3 },\n { shortName: 'PHM', fullNames: ['Philemon'], chapters: 1 },\n { shortName: 'HEB', fullNames: ['Hebrews'], chapters: 13 },\n { shortName: 'JAS', fullNames: ['James'], chapters: 5 },\n { shortName: '1PE', fullNames: ['1 Peter'], chapters: 5 },\n { shortName: '2PE', fullNames: ['2 Peter'], chapters: 3 },\n { shortName: '1JN', fullNames: ['1 John'], chapters: 5 },\n { shortName: '2JN', fullNames: ['2 John'], chapters: 1 },\n { shortName: '3JN', fullNames: ['3 John'], chapters: 1 },\n { shortName: 'JUD', fullNames: ['Jude'], chapters: 1 },\n { shortName: 'REV', fullNames: ['Revelation'], chapters: 22 },\n];\n\nexport const FIRST_SCR_BOOK_NUM = 1;\nexport const LAST_SCR_BOOK_NUM = scrBookData.length - 1;\nexport const FIRST_SCR_CHAPTER_NUM = 1;\nexport const FIRST_SCR_VERSE_NUM = 1;\n\nexport const defaultScrRef: ScriptureReference = {\n bookNum: 1,\n chapterNum: 1,\n verseNum: 1,\n};\n\nexport const getChaptersForBook = (bookNum: number): number => {\n return scrBookData[bookNum]?.chapters ?? -1;\n};\n\nexport const offsetBook = (scrRef: ScriptureReference, offset: number): ScriptureReference => ({\n bookNum: Math.max(FIRST_SCR_BOOK_NUM, Math.min(scrRef.bookNum + offset, LAST_SCR_BOOK_NUM)),\n chapterNum: 1,\n verseNum: 1,\n});\n\nexport const offsetChapter = (scrRef: ScriptureReference, offset: number): ScriptureReference => ({\n ...scrRef,\n chapterNum: Math.min(\n Math.max(FIRST_SCR_CHAPTER_NUM, scrRef.chapterNum + offset),\n getChaptersForBook(scrRef.bookNum),\n ),\n verseNum: 1,\n});\n\nexport const offsetVerse = (scrRef: ScriptureReference, offset: number): ScriptureReference => ({\n ...scrRef,\n verseNum: Math.max(FIRST_SCR_VERSE_NUM, scrRef.verseNum + offset),\n});\n\n/**\n * https://github.com/ubsicap/Paratext/blob/master/ParatextData/SILScriptureExtensions.cs#L72\n *\n * Convert book number to a localized Id (a short description of the book). This should be used\n * whenever a book ID (short code) is shown to the user. It is primarily needed for people who do\n * not read Roman script well and need to have books identified in a alternate script (e.g. Chinese\n * or Russian)\n *\n * @param bookNumber\n * @param localizationLanguage In BCP 47 format\n * @param getLocalizedString Function that provides the localized versions of the book ids and names\n * asynchronously.\n * @returns\n */\nexport async function getLocalizedIdFromBookNumber(\n bookNumber: number,\n localizationLanguage: string,\n getLocalizedString: (item: {\n localizeKey: string;\n languagesToSearch?: string[];\n }) => Promise,\n) {\n const id = Canon.bookNumberToId(bookNumber);\n\n if (!startsWith(Intl.getCanonicalLocales(localizationLanguage)[0], 'zh'))\n return getLocalizedString({\n localizeKey: `LocalizedId.${id}`,\n languagesToSearch: [localizationLanguage],\n });\n\n // For Chinese the normal book name is already fairly short.\n const bookName = await getLocalizedString({\n localizeKey: `Book.${id}`,\n languagesToSearch: [localizationLanguage],\n });\n const parts = split(bookName, '-');\n // some entries had a second name inside ideographic parenthesis\n const parts2 = split(parts[0], '\\xff08');\n const retVal = parts2[0].trim();\n return retVal;\n}\n\n/**\n * Get the Scripture reference as an easily comparable/sortable integer.\n *\n * @param scrRef The Scripture reference.\n * @returns An integer where the first three digits represent the book, the next three represent the\n * chapter and the last three represent the verse.\n */\nexport function scrRefToBBBCCCVVV(scrRef: ScriptureReference): number {\n return new VerseRef(scrRef.bookNum, scrRef.chapterNum, scrRef.verseNum).BBBCCCVVV;\n}\n\n/**\n * Compares two Scripture references canonically.\n *\n * @param scrRef1 The first Scripture reference to compare.\n * @param scrRef2 The second Scripture reference to compare.\n * @returns A number indicating the result of the comparison: - Negative value if scrRef1 precedes\n * scrRef2 in sorting order. - Zero if scrRef1 and scrRef2 are equivalent in sorting order. -\n * Positive value if scrRef1 follows scrRef2 in sorting order.\n */\nexport function compareScrRefs(scrRef1: ScriptureReference, scrRef2: ScriptureReference): number {\n // TODO: consider edge cases for invalid references (current implementation should suffice for\n // all but the most extreme cases)\n return scrRefToBBBCCCVVV(scrRef1) - scrRefToBBBCCCVVV(scrRef2);\n}\n\n/** Get the localized string key for a given scroll group Id (or no scroll group if `undefined`) */\nexport function getLocalizeKeyForScrollGroupId(\n scrollGroupId: ScrollGroupId | undefined | 'undefined',\n): LocalizeKey {\n return `%scrollGroup_${scrollGroupId}%`;\n}\n\n/**\n * Gets a list of localized string keys for provided scroll group Ids. Uses\n * {@link getLocalizeKeyForScrollGroupId} internally\n *\n * @example\n *\n * ```typescript\n * getLocalizeKeysForScrollGroupIds([undefined, 0, 1, 2, 3, 4]);\n * // Gives localized string keys for the provided scroll group ids in an array\n * ```\n *\n * @param scrollGroupIds Scroll group ids to include\n * @returns List of localized string keys for scroll group Ids\n */\nexport function getLocalizeKeysForScrollGroupIds(scrollGroupIds: (ScrollGroupId | undefined)[]) {\n return scrollGroupIds.map((scrollGroupId) => getLocalizeKeyForScrollGroupId(scrollGroupId));\n}\n\n/**\n * Formats a Scripture reference.\n *\n * @param scrRef The Scripture reference to format.\n * @param optionOrLocalizedBookName Either 'id' (the default) to format using the \"standard\" (as\n * defined by SIL/UBS) 3-letter book ID, 'English' to format using the English book name spelled\n * out, or some other string (e.g., a localized book name, vernacular abbreviation, FCBH book id,\n * etc.) to use.\n * @param chapterVerseSeparator The character used to separate the chapter number from the verse\n * number. Default is a colon (:). Note: More than one character is allowed.\n * @param bookChapterSeparator The character used to separate the book from the chapter number.\n * Default is a single space. Note: More than one character is allowed.\n * @returns The formatted reference.\n */\nexport function formatScrRef(\n scrRef: ScriptureReference,\n optionOrLocalizedBookName?: 'id' | 'English' | string,\n chapterVerseSeparator?: string,\n bookChapterSeparator?: string,\n): string {\n let book: string;\n switch (optionOrLocalizedBookName ?? 'id') {\n case 'English':\n book = Canon.bookNumberToEnglishName(scrRef.bookNum);\n break;\n case 'id':\n book = Canon.bookNumberToId(scrRef.bookNum);\n break;\n default:\n // We already dealt with undefined about in the switch, but TS is getting confused.\n book = optionOrLocalizedBookName ?? '';\n break;\n }\n return `${book}${bookChapterSeparator ?? ' '}${scrRef.chapterNum}${chapterVerseSeparator ?? ':'}${scrRef.verseNum}`;\n}\n","/** Function to run to dispose of something. Returns true if successfully unsubscribed */\nexport type Unsubscriber = () => boolean;\n\n/**\n * Returns an Unsubscriber function that combines all the unsubscribers passed in.\n *\n * @param unsubscribers All unsubscribers to aggregate into one unsubscriber\n * @returns Function that unsubscribes from all passed in unsubscribers when run\n */\nexport const aggregateUnsubscribers = (unsubscribers: Unsubscriber[]): Unsubscriber => {\n return (...args) => {\n // Run the unsubscriber for each handler\n const unsubs = unsubscribers.map((unsubscriber) => unsubscriber(...args));\n\n // If all the unsubscribers resolve to truthiness, we succeed\n return unsubs.every((success) => success);\n };\n};\n\n/**\n * Function to run to dispose of something that runs asynchronously. The promise resolves to true if\n * successfully unsubscribed\n */\nexport type UnsubscriberAsync = () => Promise;\n\n/**\n * Returns an UnsubscriberAsync function that combines all the unsubscribers passed in.\n *\n * @param unsubscribers - All unsubscribers to aggregate into one unsubscriber.\n * @returns Function that unsubscribes from all passed in unsubscribers when run\n */\nexport const aggregateUnsubscriberAsyncs = (\n unsubscribers: (UnsubscriberAsync | Unsubscriber)[],\n): UnsubscriberAsync => {\n return async (...args) => {\n // Run the unsubscriber for each handler\n const unsubPromises = unsubscribers.map(async (unsubscriber) => unsubscriber(...args));\n\n // If all the unsubscribers resolve to truthiness, we succeed\n return (await Promise.all(unsubPromises)).every((success) => success);\n };\n};\n","import { type MarkerContent, type MarkerObject } from '@biblionexus-foundation/scripture-utilities';\nimport { VerseRef } from '@sillsdev/scripture';\n\n/** USJ content node type for a chapter */\nexport const CHAPTER_TYPE = 'chapter';\n\n/** USJ content node type for a verse */\nexport const VERSE_TYPE = 'verse';\n\n/** Represents a book, chapter, verse, and offset */\nexport type VerseRefOffset = {\n verseRef: VerseRef;\n offset: number;\n};\n\n/** This could actually have more content clauses at the end, but TS types are limited */\nexport type ContentJsonPath =\n | ''\n | `$`\n | `$.content[${number}]`\n | `$.content[${number}].content[${number}]`\n | `$.content[${number}].content[${number}].content[${number}]`\n | `$.content[${number}].content[${number}].content[${number}].content[${number}]`;\n\n/** Node within a USJ object, an offset within that node, and a JSONPath query to the node */\nexport type UsjContentLocation = {\n node: MarkerContent;\n offset: number;\n jsonPath: ContentJsonPath;\n};\n\n/** Utilities for reading from and writing to `Usj` objects */\nexport interface IUsjReaderWriter {\n /**\n * Return a copy of text following a given starting point\n *\n * @param start Point where text extraction will start\n * @param desiredLength Length of text to extract from this USJ data\n */\n extractText(start: UsjContentLocation, desiredLength: number): string;\n /**\n * Return a copy of text between two points\n *\n * @param start Point where text extraction will start\n * @param end Point where text extraction will end\n * @param maxLength Maximum length of string to return (defaults to 100)\n * @returns Text between the two points, capped at length `maxLength`\n */\n extractTextBetweenPoints(\n start: UsjContentLocation,\n end: UsjContentLocation,\n maxLength: number,\n ): string;\n /**\n * Given a starting point, find the next location in this USJ data that matches the given text\n *\n * @param start Point where the search for `text` will start\n * @param text Text to find\n * @param maxTextLengthToSearch Maximum length of text to search before stopping (default is 1000)\n * @returns Object containing the USJ node where `text` begins (it might be split across nodes),\n * offset within that node that indicates where `text` begins, and a JSONPath string that\n * indicates the location of the of USJ node within `usj`. Note that if the USJ node returned is\n * an object, it is the same object that is within this USJ data. So if you change it, you are\n * changing this USJ data.\n */\n findNextLocationOfMatchingText(\n start: UsjContentLocation,\n text: string,\n maxTextLengthToSearch: number,\n ): UsjContentLocation | undefined;\n /** Find the first value matching the given JSONPath query within this USJ data */\n findSingleValue(jsonPathQuery: string): T | undefined;\n /** Find the parent of the first value matching the given JSONPath query within this USJ data */\n findParent(jsonPathQuery: string): T | undefined;\n /**\n * Convert a JSONPath query into a VerseRef and offset\n *\n * @param jsonPathQuery JSONPath search expression that indicates a node within this USJ data. If\n * the expression matches more than one node, then only the first node found is considered.\n * @param bookId 3 letter ID of the book being searched (must be defined in this USJ data if not\n * provided here)\n * @returns VerseRef and offset that represents the location within this USJ data indicated by\n * `jsonPathQuery`\n */\n jsonPathToVerseRefAndOffset(jsonPathQuery: string, bookId?: string): VerseRefOffset;\n /** Build a JSONPath query that uniquely identifies the given node with this USJ data. */\n nodeToJsonPath(node: MarkerObject): ContentJsonPath;\n /**\n * Determine the VerseRef and offset that correspond to the location of a node somewhere within\n * this USJ data\n *\n * @param bookId ID of the book represented by this USJ data\n * @param node JSON object representing the location of the VerseRef and offset\n * @param nodeParent JSON object that owns the `content` array that includes `node`. If\n * 'undefined' is provided then the `UsjReaderWriter` will attempt to lookup the parent of\n * `node`. The lookup will always fail and throw an error if `node` is a string.\n * @returns VerseRef and offset representing the location of `node`, if one could be found\n */\n nodeToVerseRefAndOffset(\n bookId: string,\n node: MarkerContent,\n nodeParent: MarkerObject | MarkerContent[] | undefined,\n ): { verseRef: VerseRef; offset: number } | undefined;\n /**\n * Remove all nodes from this USJ data that match a given search function.\n *\n * @param searchFunction Function that returns `true` if the given node should be removed\n * @returns Number of nodes removed\n */\n removeContentNodes(searchFunction: (potentiallyMatchingNode: MarkerContent) => boolean): number;\n /**\n * Inform this UsjReaderWriter that the underlying USJ object changed. This is needed to clear\n * caches used when querying.\n */\n usjChanged(): void;\n /**\n * Convert a verse ref + offset into a node + offset within this USJ data and a JSONPath query\n *\n * @param verseRef Indicates the book, chapter, and verse of interest to find\n * @param verseRefOffset Specific location within verse text (defaults to 0)\n * @returns Object containing the USJ node indicated by `verseRef` and `verseRefOffset`, offset\n * within that node that matches the `verseRefOffset`, and a JSONPath string that indicates the\n * location of the of USJ node within this USJ data. Note that if the USJ node returned is an\n * object, it is the same object that is within this USJ data. So if you change it, you are\n * changing this USJ data.\n */\n verseRefToUsjContentLocation(verseRef: VerseRef, verseRefOffset: number): UsjContentLocation;\n}\n","var getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * Combine two comparators into a single comparators.\n */\nfunction combineComparators(comparatorA, comparatorB) {\n return function isEqual(a, b, state) {\n return comparatorA(a, b, state) && comparatorB(a, b, state);\n };\n}\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular state, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n */\nfunction createIsCircular(areItemsEqual) {\n return function isCircular(a, b, state) {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return areItemsEqual(a, b, state);\n }\n var cache = state.cache;\n var cachedA = cache.get(a);\n var cachedB = cache.get(b);\n if (cachedA && cachedB) {\n return cachedA === b && cachedB === a;\n }\n cache.set(a, b);\n cache.set(b, a);\n var result = areItemsEqual(a, b, state);\n cache.delete(a);\n cache.delete(b);\n return result;\n };\n}\n/**\n * Get the properties to strictly examine, which include both own properties that are\n * not enumerable and symbol properties.\n */\nfunction getStrictProperties(object) {\n return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));\n}\n/**\n * Whether the object contains the property passed as an own property.\n */\nvar hasOwn = Object.hasOwn ||\n (function (object, property) {\n return hasOwnProperty.call(object, property);\n });\n/**\n * Whether the values passed are strictly equal or both NaN.\n */\nfunction sameValueZeroEqual(a, b) {\n return a || b ? a === b : a === b || (a !== a && b !== b);\n}\n\nvar OWNER = '_owner';\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, keys = Object.keys;\n/**\n * Whether the arrays are equal in value.\n */\nfunction areArraysEqual(a, b, state) {\n var index = a.length;\n if (b.length !== index) {\n return false;\n }\n while (index-- > 0) {\n if (!state.equals(a[index], b[index], index, index, a, b, state)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the dates passed are equal in value.\n */\nfunction areDatesEqual(a, b) {\n return sameValueZeroEqual(a.getTime(), b.getTime());\n}\n/**\n * Whether the `Map`s are equal in value.\n */\nfunction areMapsEqual(a, b, state) {\n if (a.size !== b.size) {\n return false;\n }\n var matchedIndices = {};\n var aIterable = a.entries();\n var index = 0;\n var aResult;\n var bResult;\n while ((aResult = aIterable.next())) {\n if (aResult.done) {\n break;\n }\n var bIterable = b.entries();\n var hasMatch = false;\n var matchIndex = 0;\n while ((bResult = bIterable.next())) {\n if (bResult.done) {\n break;\n }\n var _a = aResult.value, aKey = _a[0], aValue = _a[1];\n var _b = bResult.value, bKey = _b[0], bValue = _b[1];\n if (!hasMatch &&\n !matchedIndices[matchIndex] &&\n (hasMatch =\n state.equals(aKey, bKey, index, matchIndex, a, b, state) &&\n state.equals(aValue, bValue, aKey, bKey, a, b, state))) {\n matchedIndices[matchIndex] = true;\n }\n matchIndex++;\n }\n if (!hasMatch) {\n return false;\n }\n index++;\n }\n return true;\n}\n/**\n * Whether the objects are equal in value.\n */\nfunction areObjectsEqual(a, b, state) {\n var properties = keys(a);\n var index = properties.length;\n if (keys(b).length !== index) {\n return false;\n }\n var property;\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index];\n if (property === OWNER &&\n (a.$$typeof || b.$$typeof) &&\n a.$$typeof !== b.$$typeof) {\n return false;\n }\n if (!hasOwn(b, property) ||\n !state.equals(a[property], b[property], property, property, a, b, state)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the objects are equal in value with strict property checking.\n */\nfunction areObjectsEqualStrict(a, b, state) {\n var properties = getStrictProperties(a);\n var index = properties.length;\n if (getStrictProperties(b).length !== index) {\n return false;\n }\n var property;\n var descriptorA;\n var descriptorB;\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index];\n if (property === OWNER &&\n (a.$$typeof || b.$$typeof) &&\n a.$$typeof !== b.$$typeof) {\n return false;\n }\n if (!hasOwn(b, property)) {\n return false;\n }\n if (!state.equals(a[property], b[property], property, property, a, b, state)) {\n return false;\n }\n descriptorA = getOwnPropertyDescriptor(a, property);\n descriptorB = getOwnPropertyDescriptor(b, property);\n if ((descriptorA || descriptorB) &&\n (!descriptorA ||\n !descriptorB ||\n descriptorA.configurable !== descriptorB.configurable ||\n descriptorA.enumerable !== descriptorB.enumerable ||\n descriptorA.writable !== descriptorB.writable)) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the primitive wrappers passed are equal in value.\n */\nfunction arePrimitiveWrappersEqual(a, b) {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n}\n/**\n * Whether the regexps passed are equal in value.\n */\nfunction areRegExpsEqual(a, b) {\n return a.source === b.source && a.flags === b.flags;\n}\n/**\n * Whether the `Set`s are equal in value.\n */\nfunction areSetsEqual(a, b, state) {\n if (a.size !== b.size) {\n return false;\n }\n var matchedIndices = {};\n var aIterable = a.values();\n var aResult;\n var bResult;\n while ((aResult = aIterable.next())) {\n if (aResult.done) {\n break;\n }\n var bIterable = b.values();\n var hasMatch = false;\n var matchIndex = 0;\n while ((bResult = bIterable.next())) {\n if (bResult.done) {\n break;\n }\n if (!hasMatch &&\n !matchedIndices[matchIndex] &&\n (hasMatch = state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state))) {\n matchedIndices[matchIndex] = true;\n }\n matchIndex++;\n }\n if (!hasMatch) {\n return false;\n }\n }\n return true;\n}\n/**\n * Whether the TypedArray instances are equal in value.\n */\nfunction areTypedArraysEqual(a, b) {\n var index = a.length;\n if (b.length !== index) {\n return false;\n }\n while (index-- > 0) {\n if (a[index] !== b[index]) {\n return false;\n }\n }\n return true;\n}\n\nvar ARGUMENTS_TAG = '[object Arguments]';\nvar BOOLEAN_TAG = '[object Boolean]';\nvar DATE_TAG = '[object Date]';\nvar MAP_TAG = '[object Map]';\nvar NUMBER_TAG = '[object Number]';\nvar OBJECT_TAG = '[object Object]';\nvar REG_EXP_TAG = '[object RegExp]';\nvar SET_TAG = '[object Set]';\nvar STRING_TAG = '[object String]';\nvar isArray = Array.isArray;\nvar isTypedArray = typeof ArrayBuffer === 'function' && ArrayBuffer.isView\n ? ArrayBuffer.isView\n : null;\nvar assign = Object.assign;\nvar getTag = Object.prototype.toString.call.bind(Object.prototype.toString);\n/**\n * Create a comparator method based on the type-specific equality comparators passed.\n */\nfunction createEqualityComparator(_a) {\n var areArraysEqual = _a.areArraysEqual, areDatesEqual = _a.areDatesEqual, areMapsEqual = _a.areMapsEqual, areObjectsEqual = _a.areObjectsEqual, arePrimitiveWrappersEqual = _a.arePrimitiveWrappersEqual, areRegExpsEqual = _a.areRegExpsEqual, areSetsEqual = _a.areSetsEqual, areTypedArraysEqual = _a.areTypedArraysEqual;\n /**\n * compare the value of the two objects and return true if they are equivalent in values\n */\n return function comparator(a, b, state) {\n // If the items are strictly equal, no need to do a value comparison.\n if (a === b) {\n return true;\n }\n // If the items are not non-nullish objects, then the only possibility\n // of them being equal but not strictly is if they are both `NaN`. Since\n // `NaN` is uniquely not equal to itself, we can use self-comparison of\n // both objects, which is faster than `isNaN()`.\n if (a == null ||\n b == null ||\n typeof a !== 'object' ||\n typeof b !== 'object') {\n return a !== a && b !== b;\n }\n var constructor = a.constructor;\n // Checks are listed in order of commonality of use-case:\n // 1. Common complex object types (plain object, array)\n // 2. Common data values (date, regexp)\n // 3. Less-common complex object types (map, set)\n // 4. Less-common data values (promise, primitive wrappers)\n // Inherently this is both subjective and assumptive, however\n // when reviewing comparable libraries in the wild this order\n // appears to be generally consistent.\n // Constructors should match, otherwise there is potential for false positives\n // between class and subclass or custom object and POJO.\n if (constructor !== b.constructor) {\n return false;\n }\n // `isPlainObject` only checks against the object's own realm. Cross-realm\n // comparisons are rare, and will be handled in the ultimate fallback, so\n // we can avoid capturing the string tag.\n if (constructor === Object) {\n return areObjectsEqual(a, b, state);\n }\n // `isArray()` works on subclasses and is cross-realm, so we can avoid capturing\n // the string tag or doing an `instanceof` check.\n if (isArray(a)) {\n return areArraysEqual(a, b, state);\n }\n // `isTypedArray()` works on all possible TypedArray classes, so we can avoid\n // capturing the string tag or comparing against all possible constructors.\n if (isTypedArray != null && isTypedArray(a)) {\n return areTypedArraysEqual(a, b, state);\n }\n // Try to fast-path equality checks for other complex object types in the\n // same realm to avoid capturing the string tag. Strict equality is used\n // instead of `instanceof` because it is more performant for the common\n // use-case. If someone is subclassing a native class, it will be handled\n // with the string tag comparison.\n if (constructor === Date) {\n return areDatesEqual(a, b, state);\n }\n if (constructor === RegExp) {\n return areRegExpsEqual(a, b, state);\n }\n if (constructor === Map) {\n return areMapsEqual(a, b, state);\n }\n if (constructor === Set) {\n return areSetsEqual(a, b, state);\n }\n // Since this is a custom object, capture the string tag to determing its type.\n // This is reasonably performant in modern environments like v8 and SpiderMonkey.\n var tag = getTag(a);\n if (tag === DATE_TAG) {\n return areDatesEqual(a, b, state);\n }\n if (tag === REG_EXP_TAG) {\n return areRegExpsEqual(a, b, state);\n }\n if (tag === MAP_TAG) {\n return areMapsEqual(a, b, state);\n }\n if (tag === SET_TAG) {\n return areSetsEqual(a, b, state);\n }\n if (tag === OBJECT_TAG) {\n // The exception for value comparison is custom `Promise`-like class instances. These should\n // be treated the same as standard `Promise` objects, which means strict equality, and if\n // it reaches this point then that strict equality comparison has already failed.\n return (typeof a.then !== 'function' &&\n typeof b.then !== 'function' &&\n areObjectsEqual(a, b, state));\n }\n // If an arguments tag, it should be treated as a standard object.\n if (tag === ARGUMENTS_TAG) {\n return areObjectsEqual(a, b, state);\n }\n // As the penultimate fallback, check if the values passed are primitive wrappers. This\n // is very rare in modern JS, which is why it is deprioritized compared to all other object\n // types.\n if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {\n return arePrimitiveWrappersEqual(a, b, state);\n }\n // If not matching any tags that require a specific type of comparison, then we hard-code false because\n // the only thing remaining is strict equality, which has already been compared. This is for a few reasons:\n // - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only\n // comparison that can be made.\n // - For types that can be introspected, but rarely have requirements to be compared\n // (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common\n // use-cases (may be included in a future release, if requested enough).\n // - For types that can be introspected but do not have an objective definition of what\n // equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.\n // In all cases, these decisions should be reevaluated based on changes to the language and\n // common development practices.\n return false;\n };\n}\n/**\n * Create the configuration object used for building comparators.\n */\nfunction createEqualityComparatorConfig(_a) {\n var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict;\n var config = {\n areArraysEqual: strict\n ? areObjectsEqualStrict\n : areArraysEqual,\n areDatesEqual: areDatesEqual,\n areMapsEqual: strict\n ? combineComparators(areMapsEqual, areObjectsEqualStrict)\n : areMapsEqual,\n areObjectsEqual: strict\n ? areObjectsEqualStrict\n : areObjectsEqual,\n arePrimitiveWrappersEqual: arePrimitiveWrappersEqual,\n areRegExpsEqual: areRegExpsEqual,\n areSetsEqual: strict\n ? combineComparators(areSetsEqual, areObjectsEqualStrict)\n : areSetsEqual,\n areTypedArraysEqual: strict\n ? areObjectsEqualStrict\n : areTypedArraysEqual,\n };\n if (createCustomConfig) {\n config = assign({}, config, createCustomConfig(config));\n }\n if (circular) {\n var areArraysEqual$1 = createIsCircular(config.areArraysEqual);\n var areMapsEqual$1 = createIsCircular(config.areMapsEqual);\n var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual);\n var areSetsEqual$1 = createIsCircular(config.areSetsEqual);\n config = assign({}, config, {\n areArraysEqual: areArraysEqual$1,\n areMapsEqual: areMapsEqual$1,\n areObjectsEqual: areObjectsEqual$1,\n areSetsEqual: areSetsEqual$1,\n });\n }\n return config;\n}\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nfunction createInternalEqualityComparator(compare) {\n return function (a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {\n return compare(a, b, state);\n };\n}\n/**\n * Create the `isEqual` function used by the consuming application.\n */\nfunction createIsEqual(_a) {\n var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict;\n if (createState) {\n return function isEqual(a, b) {\n var _a = createState(), _b = _a.cache, cache = _b === void 0 ? circular ? new WeakMap() : undefined : _b, meta = _a.meta;\n return comparator(a, b, {\n cache: cache,\n equals: equals,\n meta: meta,\n strict: strict,\n });\n };\n }\n if (circular) {\n return function isEqual(a, b) {\n return comparator(a, b, {\n cache: new WeakMap(),\n equals: equals,\n meta: undefined,\n strict: strict,\n });\n };\n }\n var state = {\n cache: undefined,\n equals: equals,\n meta: undefined,\n strict: strict,\n };\n return function isEqual(a, b) {\n return comparator(a, b, state);\n };\n}\n\n/**\n * Whether the items passed are deeply-equal in value.\n */\nvar deepEqual = createCustomEqual();\n/**\n * Whether the items passed are deeply-equal in value based on strict comparison.\n */\nvar strictDeepEqual = createCustomEqual({ strict: true });\n/**\n * Whether the items passed are deeply-equal in value, including circular references.\n */\nvar circularDeepEqual = createCustomEqual({ circular: true });\n/**\n * Whether the items passed are deeply-equal in value, including circular references,\n * based on strict comparison.\n */\nvar strictCircularDeepEqual = createCustomEqual({\n circular: true,\n strict: true,\n});\n/**\n * Whether the items passed are shallowly-equal in value.\n */\nvar shallowEqual = createCustomEqual({\n createInternalComparator: function () { return sameValueZeroEqual; },\n});\n/**\n * Whether the items passed are shallowly-equal in value based on strict comparison\n */\nvar strictShallowEqual = createCustomEqual({\n strict: true,\n createInternalComparator: function () { return sameValueZeroEqual; },\n});\n/**\n * Whether the items passed are shallowly-equal in value, including circular references.\n */\nvar circularShallowEqual = createCustomEqual({\n circular: true,\n createInternalComparator: function () { return sameValueZeroEqual; },\n});\n/**\n * Whether the items passed are shallowly-equal in value, including circular references,\n * based on strict comparison.\n */\nvar strictCircularShallowEqual = createCustomEqual({\n circular: true,\n createInternalComparator: function () { return sameValueZeroEqual; },\n strict: true,\n});\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n */\nfunction createCustomEqual(options) {\n if (options === void 0) { options = {}; }\n var _a = options.circular, circular = _a === void 0 ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === void 0 ? false : _b;\n var config = createEqualityComparatorConfig(options);\n var comparator = createEqualityComparator(config);\n var equals = createCustomInternalComparator\n ? createCustomInternalComparator(comparator)\n : createInternalEqualityComparator(comparator);\n return createIsEqual({ circular: circular, comparator: comparator, createState: createState, equals: equals, strict: strict });\n}\n\nexport { circularDeepEqual, circularShallowEqual, createCustomEqual, deepEqual, sameValueZeroEqual, shallowEqual, strictCircularDeepEqual, strictCircularShallowEqual, strictDeepEqual, strictShallowEqual };\n//# sourceMappingURL=index.mjs.map\n","// There is a circular version https://www.npmjs.com/package/fast-equals#circulardeepequal that I\n// think allows comparing React refs (which have circular references in particular places that this\n// library would ignore). Maybe we can change to that version sometime if needed.\nimport { deepEqual as isEqualDeep } from 'fast-equals';\n\n/**\n * Check that two objects are deeply equal, comparing members of each object and such\n *\n * @param a The first object to compare\n * @param b The second object to compare\n *\n * WARNING: Objects like arrays from different iframes have different constructor function\n * references even if they do the same thing, so this deep equality comparison fails objects that\n * look the same but have different constructors because different constructors could produce\n * false positives in [a few specific\n * situations](https://github.com/planttheidea/fast-equals/blob/a41afc0a240ad5a472e47b53791e9be017f52281/src/comparator.ts#L96).\n * This means that two objects like arrays from different iframes that look the same will fail\n * this check. Please use some other means to check deep equality in those situations.\n *\n * Note: This deep equality check considers `undefined` values on keys of objects NOT to be equal to\n * not specifying the key at all. For example, `{ stuff: 3, things: undefined }` and `{ stuff: 3\n * }` are not considered equal in this case\n *\n * - For more information and examples, see [this\n * CodeSandbox](https://codesandbox.io/s/deepequallibrarycomparison-4g4kk4?file=/src/index.mjs).\n *\n * @returns True if a and b are deeply equal; false otherwise\n */\nexport default function deepEqual(a: unknown, b: unknown) {\n return isEqualDeep(a, b);\n}\n","import deepEqual from './equality-checking';\n\n/**\n * Check if one object is a subset of the other object. \"Subset\" means that all properties of one\n * object are present in the other object, and if they are present that all values of those\n * properties are deeply equal. Sub-objects are also checked to be subsets of the corresponding\n * sub-object in the other object.\n *\n * @example ObjB is a subset of objA given these objects:\n *\n * ```ts\n * objA = { name: 'Alice', age: 30, address: { city: 'Seattle', state: 'Washington' } };\n * objB = { name: 'Alice', address: { city: 'Seattle' } };\n * ```\n *\n * It is important to note that only arrays of primitives (i.e., booleans, numbers, strings) are\n * supported. In particular, objects in arrays will not be checked for deep equality. Also, presence\n * in an array is all this checks, not the number of times that an item appears in an array. `[1,\n * 1]` is a subset of `[1]`.\n *\n * @param objectWithAllProperties Object to be checked if it is a superset of\n * `objectWithPartialProperties`\n * @param objectWithPartialProperties Object to be checked if it is a subset of\n * `objectWithAllProperties`\n * @returns True if `objectWithAllProperties` contains all the properties of\n * `objectWithPartialProperties` and all values of those properties are deeply equal\n */\nexport default function isSubset(\n objectWithAllProperties: unknown,\n objectWithPartialProperties: unknown,\n): boolean {\n if (typeof objectWithAllProperties !== typeof objectWithPartialProperties) return false;\n\n // For this function we're saying that all falsy things of the same type are equal to each other\n if (!objectWithAllProperties && !objectWithPartialProperties) return true;\n\n if (Array.isArray(objectWithAllProperties)) {\n // We know these are arrays from the line above\n /* eslint-disable no-type-assertion/no-type-assertion */\n const partialArray = objectWithPartialProperties as Array;\n const allArray = objectWithAllProperties as Array;\n /* eslint-enable no-type-assertion/no-type-assertion */\n\n if (partialArray.length === 0) return true;\n\n // This only works with arrays of primitives.\n // If someone cares about checking arrays of objects this needs updating.\n return partialArray.every((item) => allArray.includes(item));\n }\n\n if (typeof objectWithAllProperties !== 'object')\n return deepEqual(objectWithAllProperties, objectWithPartialProperties);\n\n // We know these are objects that potentially have properties because of the earlier checks\n /* eslint-disable no-type-assertion/no-type-assertion */\n const partialObj = objectWithPartialProperties as Record;\n const allObj = objectWithAllProperties as Record;\n /* eslint-enable no-type-assertion/no-type-assertion */\n\n let retVal = true;\n Object.keys(partialObj).forEach((key) => {\n if (!retVal) return;\n if (!Object.hasOwn(allObj, key)) retVal = false;\n else if (!isSubset(allObj[key], partialObj[key])) retVal = false;\n });\n return retVal;\n}\n","/**\n * Converts a JavaScript value to a JSON string, changing `undefined` properties in the JavaScript\n * object to `null` properties in the JSON string.\n *\n * WARNING: `null` values will become `undefined` values after passing through {@link serialize} then\n * {@link deserialize}. For example, `{ a: 1, b: undefined, c: null }` will become `{ a: 1, b:\n * undefined, c: undefined }`. If you are passing around user data that needs to retain `null`\n * values, you should wrap them yourself in a string before using this function. Alternatively, you\n * can write your own replacer that will preserve `null` in a way that you can recover later.\n *\n * @param value A JavaScript value, usually an object or array, to be converted.\n * @param replacer A function that transforms the results. Note that all `undefined` values returned\n * by the replacer will be further transformed into `null` in the JSON string.\n * @param space Adds indentation, white space, and line break characters to the return-value JSON\n * text to make it easier to read. See the `space` parameter of `JSON.stringify` for more\n * details.\n */\nexport function serialize(\n value: unknown,\n replacer?: (this: unknown, key: string, value: unknown) => unknown,\n space?: string | number,\n): string {\n const undefinedReplacer = (replacerKey: string, replacerValue: unknown) => {\n let newValue = replacerValue;\n if (replacer) newValue = replacer(replacerKey, newValue);\n // All `undefined` values become `null` on the way from JS objects into JSON strings\n // eslint-disable-next-line no-null/no-null\n if (newValue === undefined) newValue = null;\n return newValue;\n };\n return JSON.stringify(value, undefinedReplacer, space);\n}\n\n/**\n * Converts a JSON string into a value, converting all `null` properties from JSON into `undefined`\n * in the returned JavaScript value/object.\n *\n * WARNING: `null` values will become `undefined` values after passing through {@link serialize} then\n * {@link deserialize}. For example, `{ a: 1, b: undefined, c: null }` will become `{ a: 1, b:\n * undefined, c: undefined }`. If you are passing around user data that needs to retain `null`\n * values, you should wrap them yourself in a string before using this function. Alternatively, you\n * can write your own replacer that will preserve `null` in a way that you can recover later.\n *\n * @param value A valid JSON string.\n * @param reviver A function that transforms the results. This function is called for each member of\n * the object. If a member contains nested objects, the nested objects are transformed before the\n * parent object is. Note that `null` values are converted into `undefined` values after the\n * reviver has run.\n */\nexport function deserialize(\n value: string,\n reviver?: (this: unknown, key: string, value: unknown) => unknown,\n // Need to use `any` instead of `unknown` here to match the signature of JSON.parse\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n // Helper function to replace `null` with `undefined` on a per property basis. This can't be done\n // with our own reviver because `JSON.parse` removes `undefined` properties from the return value.\n function replaceNull(obj: Record): Record {\n Object.keys(obj).forEach((key: string | number) => {\n // We only want to replace `null`, not other falsy values\n // eslint-disable-next-line no-null/no-null\n if (obj[key] === null) obj[key] = undefined;\n // If the property is an object, recursively call the helper function on it\n else if (typeof obj[key] === 'object')\n // Since the object came from a string, we know the keys will not be symbols\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n obj[key] = replaceNull(obj[key] as Record);\n });\n return obj;\n }\n\n const parsedObject = JSON.parse(value, reviver);\n // Explicitly convert the value 'null' that isn't stored as a property on an object to 'undefined'\n // eslint-disable-next-line no-null/no-null\n if (parsedObject === null) return undefined;\n if (typeof parsedObject === 'object') return replaceNull(parsedObject);\n return parsedObject;\n}\n\n/**\n * Check to see if the value is serializable without losing information\n *\n * @param value Value to test\n * @returns True if serializable; false otherwise\n *\n * Note: the values `undefined` and `null` are serializable (on their own or in an array), but\n * `null` values get transformed into `undefined` when serializing/deserializing.\n *\n * WARNING: This is inefficient right now as it stringifies, parses, stringifies, and === the value.\n * Please only use this if you need to\n *\n * DISCLAIMER: this does not successfully detect that values are not serializable in some cases:\n *\n * - Losses of removed properties like functions and `Map`s\n * - Class instances (not deserializable into class instances without special code)\n *\n * We intend to improve this in the future if it becomes important to do so. See [`JSON.stringify`\n * documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#description)\n * for more information.\n */\nexport function isSerializable(value: unknown): boolean {\n try {\n const serializedValue = serialize(value);\n return serializedValue === serialize(deserialize(serializedValue));\n } catch (e) {\n return false;\n }\n}\n\n/**\n * HTML Encodes the provided string. Thanks to ChatGPT\n *\n * @param str String to HTML encode\n * @returns HTML-encoded string\n */\nexport const htmlEncode = (str: string): string =>\n str\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n .replace(/\\//g, '/');\n","import DateTimeFormat from './intl-date-time-format';\n\n/**\n * Retrieves the current locale of the user's environment.\n *\n * @returns A string representing the current locale. If the locale cannot be determined, the\n * function returns an empty string.\n */\nexport default function getCurrentLocale(): string {\n // Use navigator when available\n if (typeof navigator !== 'undefined' && navigator.languages) {\n return navigator.languages[0];\n }\n // For Node.js\n return new DateTimeFormat().resolvedOptions().locale;\n}\n","import NumberFormat from './intl-number-format';\n\n/**\n * Formats a number according to the locale and formatting options of this NumberFormat object\n *\n * @example FormatBytes(1024) => \"1 KB\"\n *\n * @example FormatBytes(1024, 0) => \"1 KB\"\n *\n * @param fileSize Number to format\n * @param decimals Number of decimal places to round to\n * @returns String representing the given number formatted according to the locale and formatting\n * options of this NumberFormat object\n */\nexport default function formatBytes(fileSize: number, decimals: number = 2): string {\n if (fileSize === 0) return '0 Bytes';\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n const i = Math.floor(Math.log(fileSize) / Math.log(1024));\n const sizeToUse = sizes[i];\n const formattingFileSize = new NumberFormat('en', {\n style: 'decimal',\n maximumFractionDigits: decimals,\n minimumFractionDigits: 0,\n }).format(fileSize / 1024 ** i);\n return `${formattingFileSize} ${sizeToUse}`;\n}\n","//----------------------------------------------------------------------------------------------\n// NOTE: If you change any of the types, make sure the JSON schema at the end of this file gets\n// changed so they align.\n//----------------------------------------------------------------------------------------------\n\nimport { LocalizeKey, ReferencedItem } from 'menus.model';\n\n/** The data an extension provides to inform Platform.Bible of the settings it provides */\nexport type SettingsContribution = SettingsGroup | SettingsGroup[];\n/** A description of an extension's setting entry */\nexport type Setting = ExtensionControlledSetting;\n/** Setting definition that is validated by the extension. */\nexport type ExtensionControlledSetting = SettingBase & ModifierExtensionControlled;\n/** Base information needed to describe a setting entry */\nexport type SettingBase = StateBase & {\n [k: string]: unknown;\n /** LocalizeKey that displays in the settings dialog as the setting name */\n label: LocalizeKey;\n /** LocalizeKey that displays in the settings dialog to describe the setting */\n description?: LocalizeKey;\n};\n/** The data an extension provides to inform Platform.Bible of the project settings it provides */\nexport type ProjectSettingsContribution = ProjectSettingsGroup | ProjectSettingsGroup[];\n/** A description of an extension's setting entry */\nexport type ProjectSetting = ExtensionControlledProjectSetting;\n/** Setting definition that is validated by the extension. */\nexport type ExtensionControlledProjectSetting = ProjectSettingBase & ModifierExtensionControlled;\n/** Base information needed to describe a project setting entry */\nexport type ProjectSettingBase = SettingBase & ModifierProject;\n/** A description of an extension's user state entry */\nexport type UserState = ExtensionControlledState;\n/** State definition that is validated by the extension. */\nexport type ExtensionControlledState = StateBase & ModifierExtensionControlled;\n/** Group of related settings definitions */\nexport interface SettingsGroup {\n [k: string]: unknown;\n /** LocalizeKey that displays in the settings dialog as the group name */\n label: LocalizeKey;\n /** LocalizeKey that displays in the settings dialog to describe the group */\n description?: LocalizeKey;\n properties: SettingProperties;\n}\n/** Object whose keys are setting IDs and whose values are settings objects */\nexport interface SettingProperties {\n [k: ReferencedItem]: Setting;\n}\n/** Base information needed to describe a state entry */\nexport interface StateBase {\n [k: string]: unknown;\n /** Default value for the state/setting */\n default: unknown;\n /**\n * A state/setting ID whose value to set to this state/setting's starting value the first time\n * this state/setting is loaded\n */\n derivesFrom?: ReferencedItem;\n}\n/**\n * Modifies state/setting type to be extension-controlled. \"Extension-controlled\" means the\n * extension provides the component and the validator for the state/setting, so the state/setting is\n * controlled by the extension.\n */\nexport interface ModifierExtensionControlled {\n [k: string]: unknown;\n platformType?: undefined;\n type?: undefined;\n}\n/** Group of related settings definitions */\nexport interface ProjectSettingsGroup {\n [k: string]: unknown;\n /** LocalizeKey that displays in the project settings dialog as the group name */\n label: LocalizeKey;\n /** LocalizeKey that displays in the project settings dialog to describe the group */\n description?: LocalizeKey;\n properties: ProjectSettingProperties;\n}\n/** Object whose keys are setting IDs and whose values are settings objects */\nexport interface ProjectSettingProperties {\n [k: ReferencedItem]: ProjectSetting;\n}\n\n// Note: we removed the index signature on ModifierProject to avoid having it on\n// `ProjectMetadataFilterOptions`. Unfortunately adding \"additionalProperties\": false on the json\n// schema messes up validation. Please remove the index signature again in the future if you\n// regenerate types\nexport interface ModifierProject {\n /**\n * String representation of `RegExp` pattern(s) to match against projects' `projectInterface`s\n * (using the\n * [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test)\n * function) to determine if they should be included.\n *\n * If this is one string, it will be matched against `projectInterface`s. If this is an array,\n * each entry is handled based on its type (at least one entry must match for this filter\n * condition to pass):\n *\n * - If the entry is a string, it will be matched against each `projectInterface`. If any match, the\n * project will pass this filter condition\n * - If the entry is an array of strings, each will be matched against each `projectInterface`. If\n * every string matches against at least one `projectInterface`, the project will pass this\n * filter condition\n *\n * In other words, each entry in the first-level array is `OR`'ed together. Each entry in\n * second-level arrays (arrays within the first-level array) are `AND`'ed together.\n *\n * Defaults to all {@link ProjectInterfaces}, so all projects that do not match\n * `excludeProjectInterfaces` will be included\n *\n * @example\n *\n * ```typescript\n * includeProjectInterfaces: ['one', ['two', 'three']];\n * ```\n *\n * This filter condition will succeed on projects whose `projectInterface`s fulfill at least one\n * of the following conditions (At least one entry in the array must match):\n *\n * - Include `one`\n * - Include both `two` and `three`.\n */\n includeProjectInterfaces?: undefined | string | (string | string[])[];\n /**\n * String representation of `RegExp` pattern(s) to match against projects' `projectInterface`s\n * (using the\n * [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test)\n * function) to determine if they should absolutely not be included even if they match with\n * `includeProjectInterfaces`.\n *\n * If this is one string, it will be matched against `projectInterface`s. If this is an array,\n * each entry is handled based on its type (at least one entry must match for this filter\n * condition to exclude the project):\n *\n * - If the entry is a string, it will be matched against each `projectInterface`. If any match, the\n * project will pass this filter condition and exclude the project\n * - If the entry is an array of strings, each will be matched against each `projectInterface`. If\n * every string matches against at least one `projectInterface`, the project will pass this\n * filter condition and exclude the project\n *\n * In other words, each entry in the first-level array is `OR`'ed together. Each entry in\n * second-level arrays (arrays within the first-level array) are `AND`'ed together.\n *\n * Defaults to no {@link ProjectInterfaces}, so all projects that match `includeProjectInterfaces`\n * will be included\n *\n * @example\n *\n * ```typescript\n * excludeProjectInterfaces: ['one', ['two', 'three']];\n * ```\n *\n * This filter condition will succeed and exclude projects whose `projectInterface`s fulfill at\n * least one of the following conditions (At least one entry in the array must match):\n *\n * - Include `one`\n * - Include both `two` and `three`.\n */\n excludeProjectInterfaces?: undefined | string | (string | string[])[];\n /**\n * String representation of `RegExp` pattern(s) to match against the Project Data Provider Factory\n * Ids that provided each project's metadata (using the\n * [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test)\n * function) to determine if the projects should be included.\n *\n * Defaults to all Project Data Provider Factory Ids, so all projects that do not match\n * `excludePdpFactoryIds` will be included\n */\n includePdpFactoryIds?: undefined | string | string[];\n /**\n * String representation of `RegExp` pattern(s) to match against the Project Data Provider Factory\n * Ids that provided each project's metadata (using the\n * [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test)\n * function) to determine if the projects should absolutely not be included even if they match\n * with `includeProjectInterfaces`.\n *\n * Defaults to none, so all projects that match `includePdpFactoryIds` will be included\n */\n excludePdpFactoryIds?: undefined | string | string[];\n}\n\n/** The data an extension provides to inform Platform.Bible of the user state it provides */\nexport interface UserStateContribution {\n [k: ReferencedItem]: UserState;\n}\n/** The data an extension provides to inform Platform.Bible of the project state it provides */\nexport interface ProjectStateContribution {\n [k: ReferencedItem]: UserState;\n}\n\n//----------------------------------------------------------------------------------------------\n// NOTE: If you change the schema below, make sure the TS types above get changed so they align.\n//----------------------------------------------------------------------------------------------\nconst settingsDefs = {\n projectSettingsContribution: {\n description:\n 'The data an extension provides to inform Platform.Bible of the project settings it provides',\n anyOf: [\n {\n $ref: '#/$defs/projectSettingsGroup',\n },\n {\n type: 'array',\n items: {\n $ref: '#/$defs/projectSettingsGroup',\n },\n },\n ],\n },\n projectSettingsGroup: {\n description: 'Group of related settings definitions',\n type: 'object',\n properties: {\n label: {\n description: 'localizeKey that displays in the project settings dialog as the group name',\n $ref: '#/$defs/localizeKey',\n },\n description: {\n description:\n 'localizeKey that displays in the project settings dialog to describe the group',\n $ref: '#/$defs/localizeKey',\n },\n properties: {\n $ref: '#/$defs/projectSettingProperties',\n },\n },\n required: ['label', 'properties'],\n },\n projectSettingProperties: {\n description: 'Object whose keys are setting IDs and whose values are settings objects',\n type: 'object',\n patternProperties: {\n '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$': {\n $ref: '#/$defs/projectSetting',\n },\n },\n additionalProperties: false,\n },\n projectSetting: {\n description: \"A description of an extension's setting entry\",\n anyOf: [\n {\n $ref: '#/$defs/extensionControlledProjectSetting',\n },\n ],\n },\n extensionControlledProjectSetting: {\n description: 'Setting definition that is validated by the extension.',\n allOf: [\n {\n $ref: '#/$defs/projectSettingBase',\n },\n {\n $ref: '#/$defs/modifierExtensionControlled',\n },\n ],\n },\n projectSettingBase: {\n description: 'Base information needed to describe a project setting entry',\n allOf: [\n {\n $ref: '#/$defs/settingBase',\n },\n {\n $ref: '#/$defs/modifierProject',\n },\n ],\n },\n modifierProject: {\n description: 'Modifies setting type to be project setting',\n type: 'object',\n properties: {\n includeProjectInterfaces: {\n description:\n \"String representation of `RegExp` pattern(s) to match against projects' `projectInterface`s (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if they should be included.\\n\\nIf this is one string, it will be matched against `projectInterface`s. If this is an array, each entry is handled based on its type (at least one entry must match for this filter condition to pass):\\n\\n- If the entry is a string, it will be matched against each `projectInterface`. If any match, the project will pass this filter condition\\n- If the entry is an array of strings, each will be matched against each `projectInterface`. If every string matches against at least one `projectInterface`, the project will pass this filter condition\\n\\nIn other words, each entry in the first-level array is `OR`'ed together. Each entry in second-level arrays (arrays within the first-level array) are `AND`'ed together.\\n\\nDefaults to all {@link ProjectInterfaces}, so all projects that do not match `excludeProjectInterfaces` will be included\\n\\n@example\\n\\n```typescript\\nincludeProjectInterfaces: ['one', ['two', 'three']];\\n```\\n\\nThis filter condition will succeed on projects whose `projectInterface`s fulfill at least one of the following conditions (At least one entry in the array must match):\\n\\n- Include `one`\\n- Include both `two` and `three`.\",\n anyOf: [\n {\n type: 'null',\n },\n {\n type: 'string',\n },\n {\n type: 'array',\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n type: 'array',\n items: { type: 'string' },\n },\n ],\n },\n },\n ],\n },\n excludeProjectInterfaces: {\n description:\n \"String representation of `RegExp` pattern(s) to match against projects' `projectInterface`s (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if they should absolutely not be included even if they match with `includeProjectInterfaces`.\\n\\nIf this is one string, it will be matched against `projectInterface`s. If this is an array, each entry is handled based on its type (at least one entry must match for this filter condition to exclude the project):\\n\\n- If the entry is a string, it will be matched against each `projectInterface`. If any match, the project will pass this filter condition and exclude the project\\n- If the entry is an array of strings, each will be matched against each `projectInterface`. If every string matches against at least one `projectInterface`, the project will pass this filter condition and exclude the project\\n\\nIn other words, each entry in the first-level array is `OR`'ed together. Each entry in second-level arrays (arrays within the first-level array) are `AND`'ed together.\\n\\nDefaults to no {@link ProjectInterfaces}, so all projects that match `includeProjectInterfaces` will be included\\n\\n@example\\n\\n```typescript\\nexcludeProjectInterfaces: ['one', ['two', 'three']];\\n```\\n\\nThis filter condition will succeed and exclude projects whose `projectInterface`s fulfill at least one of the following conditions (At least one entry in the array must match):\\n\\n- Include `one`\\n- Include both `two` and `three`.\",\n anyOf: [\n {\n type: 'null',\n },\n {\n type: 'string',\n },\n {\n type: 'array',\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n type: 'array',\n items: { type: 'string' },\n },\n ],\n },\n },\n ],\n },\n includePdpFactoryIds: {\n description:\n \"String representation of `RegExp` pattern(s) to match against the Project Data Provider Factory Ids that provided each project's metadata (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if the projects should be included.\\n\\nDefaults to all Project Data Provider Factory Ids, so all projects that do not match `excludePdpFactoryIds` will be included\",\n anyOf: [\n {\n type: 'null',\n },\n {\n type: 'string',\n },\n {\n type: 'array',\n items: { type: 'string' },\n },\n ],\n },\n excludePdpFactoryIds: {\n description:\n \"String representation of `RegExp` pattern(s) to match against the Project Data Provider Factory Ids that provided each project's metadata (using the [`test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) function) to determine if the projects should absolutely not be included even if they match with `includeProjectInterfaces`.\\n\\nDefaults to none, so all projects that match `includePdpFactoryIds` will be included\",\n anyOf: [\n {\n type: 'null',\n },\n {\n type: 'string',\n },\n {\n type: 'array',\n items: { type: 'string' },\n },\n ],\n },\n },\n },\n settingsContribution: {\n description:\n 'The data an extension provides to inform Platform.Bible of the settings it provides',\n anyOf: [\n {\n $ref: '#/$defs/settingsGroup',\n },\n {\n type: 'array',\n items: {\n $ref: '#/$defs/settingsGroup',\n },\n },\n ],\n },\n settingsGroup: {\n description: 'Group of related settings definitions',\n type: 'object',\n properties: {\n label: {\n description: 'localizeKey that displays in the settings dialog as the group name',\n $ref: '#/$defs/localizeKey',\n },\n description: {\n description: 'localizeKey that displays in the settings dialog to describe the group',\n $ref: '#/$defs/localizeKey',\n },\n properties: {\n $ref: '#/$defs/settingProperties',\n },\n },\n required: ['label', 'properties'],\n },\n settingProperties: {\n description: 'Object whose keys are setting IDs and whose values are settings objects',\n type: 'object',\n patternProperties: {\n '^[\\\\w-]+\\\\.[\\\\w-]+$': {\n $ref: '#/$defs/setting',\n },\n },\n additionalProperties: false,\n },\n setting: {\n description: \"A description of an extension's setting entry\",\n anyOf: [\n {\n $ref: '#/$defs/extensionControlledSetting',\n },\n ],\n },\n extensionControlledSetting: {\n description: 'Setting definition that is validated by the extension.',\n allOf: [\n {\n $ref: '#/$defs/settingBase',\n },\n {\n $ref: '#/$defs/modifierExtensionControlled',\n },\n ],\n },\n settingBase: {\n description: 'Base information needed to describe a setting entry',\n allOf: [\n {\n $ref: '#/$defs/stateBase',\n },\n {\n type: 'object',\n properties: {\n label: {\n description: 'localizeKey that displays in the settings dialog as the setting name',\n $ref: '#/$defs/localizeKey',\n },\n description: {\n description: 'localizeKey that displays in the settings dialog to describe the setting',\n $ref: '#/$defs/localizeKey',\n },\n },\n required: ['label'],\n },\n ],\n },\n projectStateContribution: {\n description:\n 'The data an extension provides to inform Platform.Bible of the project state it provides',\n $ref: '#/$defs/userStateProperties',\n },\n userStateContribution: {\n description:\n 'The data an extension provides to inform Platform.Bible of the user state it provides',\n $ref: '#/$defs/userStateProperties',\n },\n userStateProperties: {\n description: 'Object whose keys are state IDs and whose values are state objects',\n type: 'object',\n patternProperties: {\n '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$': {\n $ref: '#/$defs/userState',\n },\n },\n additionalProperties: false,\n },\n userState: {\n description: \"A description of an extension's user state entry\",\n anyOf: [\n {\n $ref: '#/$defs/extensionControlledState',\n },\n ],\n },\n extensionControlledState: {\n description: 'State definition that is validated by the extension.',\n allOf: [\n {\n $ref: '#/$defs/stateBase',\n },\n {\n $ref: '#/$defs/modifierExtensionControlled',\n },\n ],\n },\n modifierExtensionControlled: {\n description:\n 'Modifies state/setting type to be extension-controlled. \"Extension-controlled\" means the extension provides the component and the validator for the state/setting, so the state/setting is controlled by the extension.',\n not: {\n anyOf: [\n {\n type: 'object',\n required: ['platformType'],\n },\n {\n type: 'object',\n required: ['type'],\n },\n ],\n },\n },\n stateBase: {\n description: 'Base information needed to describe a state entry',\n type: 'object',\n properties: {\n default: {\n description: 'default value for the state/setting',\n type: 'any',\n },\n derivesFrom: {\n description:\n \"a state/setting ID whose value to set to this state/setting's starting value the first time this state/setting is loaded\",\n $ref: '#/$defs/id',\n },\n },\n required: ['default'],\n },\n localizeKey: {\n description: \"Identifier for a string that will be localized based on the user's UI language\",\n type: 'string',\n pattern: '^%[\\\\w\\\\-\\\\.]+%$',\n tsType: 'LocalizeKey',\n },\n id: {\n description: '',\n type: 'string',\n pattern: '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$',\n tsType: 'Id',\n },\n};\n\n/**\n * Json-schema-to-typescript has some added stuff that isn't actually compatible with JSON schema,\n * so we remove them here\n *\n * @param defs The `$defs` property of a JSON schema (will be modified in place)\n */\n// JSON schema types are weird, so we'll just be careful\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function removeJsonToTypeScriptTypesStuff(defs: any) {\n if (!defs) return;\n\n // JSON schema types are weird, so we'll just be careful\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.values(defs).forEach((def: any) => {\n if (!def.type) return;\n\n if ('tsType' in def) delete def.tsType;\n\n if (def.type === 'any') {\n delete def.type;\n return;\n }\n\n if (def.type === 'object') {\n removeJsonToTypeScriptTypesStuff(def.properties);\n }\n });\n}\n\nremoveJsonToTypeScriptTypesStuff(settingsDefs);\n\n/** JSON schema object that aligns with the ProjectSettingsContribution type */\nexport const projectSettingsDocumentSchema = {\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n title: 'Project Settings Contribution',\n description:\n 'The data an extension provides to inform Platform.Bible of the project settings it provides',\n anyOf: [\n {\n $ref: '#/$defs/projectSettingsGroup',\n },\n {\n type: 'array',\n items: {\n $ref: '#/$defs/projectSettingsGroup',\n },\n },\n ],\n\n $defs: settingsDefs,\n};\n\nObject.freeze(projectSettingsDocumentSchema);\n\n/** JSON schema object that aligns with the {@link SettingsContribution} type */\nexport const settingsDocumentSchema = {\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n title: 'Settings Contribution',\n description:\n 'The data an extension provides to inform Platform.Bible of the settings it provides',\n anyOf: [\n {\n $ref: '#/$defs/settingsGroup',\n },\n {\n type: 'array',\n items: {\n $ref: '#/$defs/settingsGroup',\n },\n },\n ],\n\n $defs: settingsDefs,\n};\n\nObject.freeze(settingsDocumentSchema);\n","//----------------------------------------------------------------------------------------------\n// NOTE: If you change any of the types, make sure the JSON schema at the end of this file gets\n// changed so they align.\n//----------------------------------------------------------------------------------------------\n\nimport { LocalizeKey } from 'menus.model';\nimport { removeJsonToTypeScriptTypesStuff } from './settings.model';\n\n/** Localized string value associated with this key */\nexport type LocalizedStringValue = string;\n\n/** The data an extension provides to inform Platform.Bible of the localized strings it provides. */\nexport interface LocalizedStringDataContribution {\n [k: string]: unknown;\n metadata?: StringsMetadata;\n localizedStrings?: {\n [k: string]: LanguageStrings;\n };\n}\n/**\n * Map whose keys are localized string keys and whose values provide additional non-locale-specific\n * information about the localized string key\n */\nexport interface StringsMetadata {\n [k: LocalizeKey]: StringMetadata;\n}\n/** Additional non-locale-specific information about a localized string key */\nexport interface StringMetadata {\n [k: string]: unknown;\n /**\n * Localized string key from which to get this value if one does not exist in the specified\n * language. If a new key/value pair needs to be made to replace an existing one, this could help\n * smooth over the transition if the meanings are close enough\n *\n * You can use Paratext 9 Localized String Keys here. Be sure to escape any % signs with a\n * backslash `\\`.\n */\n fallbackKey?: LocalizeKey;\n /**\n * Additional information provided by developers in English to help the translator to know how to\n * translate this localized string accurately\n */\n notes?: string;\n}\n/**\n * Map whose keys are localized string keys and whose values provide information about how to\n * localize strings for the localized string key\n */\nexport interface LanguageStrings {\n [k: LocalizeKey]: LocalizedStringValue;\n}\n\n//----------------------------------------------------------------------------------------------\n// NOTE: If you change the schema below, make sure the TS types above get changed so they align.\n//----------------------------------------------------------------------------------------------\n\nconst localizedStringsDefs = {\n languageStrings: {\n description:\n 'Map whose keys are localized string keys and whose values provide information about how to localize strings for the localized string key',\n type: 'object',\n patternProperties: {\n '^%[\\\\w\\\\-\\\\.]+%$': {\n $ref: '#/$defs/localizedStringValue',\n },\n },\n additionalProperties: false,\n },\n localizedStringValue: {\n description: 'Localized string value associated with this key',\n type: 'string',\n },\n stringsMetadata: {\n description:\n 'Map whose keys are localized string keys and whose values provide additional non-locale-specific information about the localized string key',\n type: 'object',\n patternProperties: {\n '^%[\\\\w\\\\-\\\\.]+%$': {\n $ref: '#/$defs/stringMetadata',\n },\n },\n additionalProperties: false,\n },\n stringMetadata: {\n description: 'Additional non-locale-specific information about a localized string key',\n type: 'object',\n properties: {\n fallbackKey: {\n description:\n 'Localized string key from which to get this value if one does not exist in the specified language. If a new key/value pair needs to be made to replace an existing one, this could help smooth over the transition if the meanings are close enough.\\nYou can use Paratext 9 Localized String Keys here. Be sure to escape any % signs with a backslash `\\\\`.',\n type: 'string',\n pattern: \"^%[\\\\w\\\\-\\\\.;&,' (){}#:/\\\\\\\\?%⋮|[\\\\]“”‘’!~*\\u00A0+=•`…\\u200B↑↓]+%$\",\n tsType: 'LocalizeKey',\n },\n notes: {\n description:\n 'Additional information provided by developers in English to help the translator to know how to translate this localized string accurately',\n type: 'string',\n },\n },\n },\n localizeKey: {\n description: \"Identifier for a string that will be localized based on the user's UI language\",\n type: 'string',\n pattern: '^%[\\\\w\\\\-\\\\.]+%$',\n tsType: 'LocalizeKey',\n },\n};\n\nremoveJsonToTypeScriptTypesStuff(localizedStringsDefs);\n\n/** JSON schema object that aligns with the LocalizedStringDataContribution type */\nexport const localizedStringsDocumentSchema = {\n $schema: 'https://json-schema.org/draft/2020-12/schema',\n title: 'Localized String Data Contribution',\n description:\n 'The data an extension provides to inform Platform.Bible of the localized strings it provides.',\n type: 'object',\n properties: {\n metadata: {\n $ref: '#/$defs/stringsMetadata',\n },\n localizedStrings: {\n type: 'object',\n additionalProperties: {\n $ref: '#/$defs/languageStrings',\n },\n },\n },\n $defs: localizedStringsDefs,\n};\n\nObject.freeze(localizedStringsDocumentSchema);\n","//----------------------------------------------------------------------------------------------\n// NOTE: If you change any of the types, make sure the JSON schema at the end of this file gets\n// changed so they align.\n//----------------------------------------------------------------------------------------------\n\nimport { ReplaceType } from './util';\n\n/** Identifier for a string that will be localized in a menu based on the user's UI language */\nexport type LocalizeKey = `%${string}%`;\n\n/** Name of some UI element (i.e., tab, column, group, menu item) or some PAPI object (i.e., command) */\nexport type ReferencedItem = `${string}.${string}`;\n\nexport type OrderedItem = {\n /** Relative order of this item compared to other items in the same parent/scope (sorted ascending) */\n order: number;\n};\n\nexport type OrderedExtensibleContainer = OrderedItem & {\n /** Determines whether other items can be added to this after it has been defined */\n isExtensible?: boolean;\n};\n\n/** Group of menu items that belongs in a column */\nexport type MenuGroupDetailsInColumn = OrderedExtensibleContainer & {\n /** ID of column in which this group resides */\n column: ReferencedItem;\n};\n\n/** Group of menu items that belongs in a submenu */\nexport type MenuGroupDetailsInSubMenu = OrderedExtensibleContainer & {\n /** ID of menu item hosting the submenu in which this group resides */\n menuItem: ReferencedItem;\n};\n\n/** Column that includes header text in a menu */\nexport type MenuColumnWithHeader = OrderedExtensibleContainer & {\n /** Key that represents the text of the header text of the column */\n label: LocalizeKey;\n};\n\nexport type MenuItemBase = OrderedItem & {\n /** Menu group to which this menu item belongs */\n group: ReferencedItem;\n /** Key that represents the text of this menu item to display */\n label: LocalizeKey;\n /** Key that represents words the platform should reference when users are searching for menu items */\n searchTerms?: LocalizeKey;\n /** Key that represents the text to display if a mouse pointer hovers over the menu item */\n tooltip?: LocalizeKey;\n /** Additional information provided by developers to help people who perform localization */\n localizeNotes: string;\n};\n\n/** Menu item that hosts a submenu */\nexport type MenuItemContainingSubmenu = MenuItemBase & {\n /** ID for this menu item that holds a submenu */\n id: ReferencedItem;\n};\n\n/** Menu item that runs a command */\nexport type MenuItemContainingCommand = MenuItemBase & {\n /** Name of the PAPI command to run when this menu item is selected. */\n command: ReferencedItem;\n /**\n * Uri path to the icon to display after the menu text. Ex:\n * `papi-extension://helloWorld/assets/icon.png`\n */\n iconPathAfter?: string;\n /**\n * Uri path to the icon to display before the menu text. Ex:\n * `papi-extension://helloWorld/assets/icon.png`\n */\n iconPathBefore?: string;\n};\n\n/**\n * Group of menu items that can be combined with other groups to form a single context menu/submenu.\n * Groups are separated using a line within the menu/submenu.\n */\nexport type GroupsInSingleColumnMenu = {\n /** Named menu group */\n [property: ReferencedItem]: OrderedExtensibleContainer | MenuGroupDetailsInSubMenu;\n};\n\n/**\n * Group of menu items that can be combined with other groups to form a single menu/submenu within a\n * multi-column menu. Groups are separated using a line within the menu/submenu.\n */\nexport type GroupsInMultiColumnMenu = {\n /** Named menu group */\n [property: ReferencedItem]: MenuGroupDetailsInColumn | MenuGroupDetailsInSubMenu;\n};\n\n/** Group of columns that can be combined with other columns to form a multi-column menu */\nexport type ColumnsWithHeaders = {\n /** Named column of a menu */\n [property: ReferencedItem]: MenuColumnWithHeader;\n /** Defines whether columns can be added to this multi-column menu */\n isExtensible?: boolean;\n};\n\n/** Menu that contains a column without a header */\nexport type SingleColumnMenu = {\n /** Groups that belong in this menu */\n groups: GroupsInSingleColumnMenu;\n /** List of menu items that belong in this menu */\n items: (MenuItemContainingCommand | MenuItemContainingSubmenu)[];\n};\n\n/** Menu that contains multiple columns with headers */\nexport type MultiColumnMenu = {\n /** Columns that belong in this menu */\n columns: ColumnsWithHeaders;\n /** Groups that belong in this menu */\n groups: GroupsInMultiColumnMenu;\n /** List of menu items that belong in this menu */\n items: (MenuItemContainingCommand | MenuItemContainingSubmenu)[];\n};\n\n/** Menus for one single web view */\nexport type WebViewMenu = {\n /** Indicates whether the platform default menus should be included for this webview */\n includeDefaults: boolean | undefined;\n /** Menu that opens when you click on the top left corner of a tab */\n topMenu: MultiColumnMenu | undefined;\n /** Menu that opens when you right click on the main body/area of a tab */\n contextMenu: SingleColumnMenu | undefined;\n};\n\n/** Menus for all web views */\nexport type WebViewMenus = {\n /** Named web view */\n [property: ReferencedItem]: WebViewMenu;\n};\n\n/** Platform.Bible menus before they are localized */\nexport type PlatformMenus = {\n /** Top level menu for the application */\n mainMenu: MultiColumnMenu;\n /** Menus that apply per web view in the application */\n webViewMenus: WebViewMenus;\n /** Default context menu for web views that don't specify their own */\n defaultWebViewContextMenu: SingleColumnMenu;\n /** Default top menu for web views that don't specify their own */\n defaultWebViewTopMenu: MultiColumnMenu;\n};\n\n/**\n * Type that converts any menu type before it is localized to what it is after it is localized. This\n * can be applied to any menu type as needed.\n */\nexport type Localized = ReplaceType, ReferencedItem, string>;\n\n//----------------------------------------------------------------------------------------------\n// NOTE: If you change the schema below, make sure the TS types above get changed so they align.\n//----------------------------------------------------------------------------------------------\n/** JSON schema object that aligns with the PlatformMenus type */\nexport const menuDocumentSchema = {\n title: 'Platform.Bible menus',\n type: 'object',\n properties: {\n mainMenu: {\n description: 'Top level menu for the application',\n $ref: '#/$defs/multiColumnMenu',\n },\n defaultWebViewTopMenu: {\n description: \"Default top menu for web views that don't specify their own\",\n $ref: '#/$defs/multiColumnMenu',\n },\n defaultWebViewContextMenu: {\n description: \"Default context menu for web views that don't specify their own\",\n $ref: '#/$defs/singleColumnMenu',\n },\n webViewMenus: {\n description: 'Menus that apply per web view in the application',\n type: 'object',\n patternProperties: {\n '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$': {\n $ref: '#/$defs/menusForOneWebView',\n },\n },\n additionalProperties: false,\n },\n },\n required: ['mainMenu', 'defaultWebViewTopMenu', 'defaultWebViewContextMenu', 'webViewMenus'],\n additionalProperties: false,\n $defs: {\n localizeKey: {\n description:\n \"Identifier for a string that will be localized in a menu based on the user's UI language\",\n type: 'string',\n pattern: '^%[\\\\w\\\\-\\\\.]+%$',\n },\n referencedItem: {\n description:\n 'Name of some UI element (i.e., tab, column, group, menu item) or some PAPI object (i.e., command)',\n type: 'string',\n pattern: '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$',\n },\n columnsWithHeaders: {\n description:\n 'Group of columns that can be combined with other columns to form a multi-column menu',\n type: 'object',\n patternProperties: {\n '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$': {\n description: 'Single column with a header string',\n type: 'object',\n properties: {\n label: {\n description: 'Header text for this this column in the UI',\n $ref: '#/$defs/localizeKey',\n },\n localizeNotes: {\n description:\n 'Additional information provided by developers to help people who perform localization',\n type: 'string',\n },\n order: {\n description:\n 'Relative order of this column compared to other columns (sorted ascending)',\n type: 'number',\n },\n isExtensible: {\n description:\n 'Defines whether contributions are allowed to add menu groups to this column',\n type: 'boolean',\n },\n },\n required: ['label', 'order'],\n additionalProperties: false,\n },\n },\n properties: {\n isExtensible: {\n description:\n 'Defines whether contributions are allowed to add columns to this multi-column menu',\n type: 'boolean',\n },\n },\n },\n menuGroups: {\n description:\n 'Group of menu items that can be combined with other groups to form a single menu/submenu. Groups are separated using a line within the menu/submenu.',\n type: 'object',\n patternProperties: {\n '^[\\\\w\\\\-]+\\\\.[\\\\w\\\\-]+$': {\n description: 'Single group that contains menu items',\n type: 'object',\n oneOf: [\n {\n properties: {\n column: {\n description:\n 'Column where this group belongs, not required for single column menus',\n $ref: '#/$defs/referencedItem',\n },\n order: {\n description:\n 'Relative order of this group compared to other groups in the same column or submenu (sorted ascending)',\n type: 'number',\n },\n isExtensible: {\n description:\n 'Defines whether contributions are allowed to add menu items to this menu group',\n type: 'boolean',\n },\n },\n required: ['order'],\n additionalProperties: false,\n },\n {\n properties: {\n menuItem: {\n description: 'Menu item that anchors the submenu where this group belongs',\n $ref: '#/$defs/referencedItem',\n },\n order: {\n description:\n 'Relative order of this group compared to other groups in the same column or submenu (sorted ascending)',\n type: 'number',\n },\n isExtensible: {\n description:\n 'Defines whether contributions are allowed to add menu items to this menu group',\n type: 'boolean',\n },\n },\n required: ['menuItem', 'order'],\n additionalProperties: false,\n },\n ],\n },\n },\n additionalProperties: false,\n },\n menuItem: {\n description:\n 'Single item in a menu that can be clicked on to take an action or can be the parent of a submenu',\n type: 'object',\n oneOf: [\n {\n properties: {\n id: {\n description: 'ID for this menu item that holds a submenu',\n $ref: '#/$defs/referencedItem',\n },\n },\n required: ['id'],\n },\n {\n properties: {\n command: {\n description: 'Name of the PAPI command to run when this menu item is selected.',\n $ref: '#/$defs/referencedItem',\n },\n iconPathBefore: {\n description:\n 'Uri path to the icon to display before the menu text. Ex: `papi-extension://helloWorld/assets/icon.png`',\n type: 'string',\n },\n iconPathAfter: {\n description:\n 'Uri path to the icon to display after the menu text. Ex: `papi-extension://helloWorld/assets/icon.png`',\n type: 'string',\n },\n },\n required: ['command'],\n },\n ],\n properties: {\n label: {\n description: 'Key that represents the text of this menu item to display',\n $ref: '#/$defs/localizeKey',\n },\n tooltip: {\n description:\n 'Key that represents the text to display if a mouse pointer hovers over the menu item',\n $ref: '#/$defs/localizeKey',\n },\n searchTerms: {\n description:\n 'Key that represents additional words the platform should reference when users are searching for menu items',\n $ref: '#/$defs/localizeKey',\n },\n localizeNotes: {\n description:\n 'Additional information provided by developers to help people who perform localization',\n type: 'string',\n },\n group: {\n description: 'Group to which this menu item belongs',\n $ref: '#/$defs/referencedItem',\n },\n order: {\n description:\n 'Relative order of this menu item compared to other menu items in the same group (sorted ascending)',\n type: 'number',\n },\n },\n required: ['label', 'group', 'order'],\n unevaluatedProperties: false,\n },\n groupsAndItems: {\n description: 'Core schema for a column',\n type: 'object',\n properties: {\n groups: {\n description: 'Groups that belong in this menu',\n $ref: '#/$defs/menuGroups',\n },\n items: {\n description: 'List of menu items that belong in this menu',\n type: 'array',\n items: { $ref: '#/$defs/menuItem' },\n uniqueItems: true,\n },\n },\n required: ['groups', 'items'],\n },\n singleColumnMenu: {\n description: 'Menu that contains a column without a header',\n type: 'object',\n allOf: [{ $ref: '#/$defs/groupsAndItems' }],\n unevaluatedProperties: false,\n },\n multiColumnMenu: {\n description: 'Menu that can contain multiple columns with headers',\n type: 'object',\n allOf: [\n { $ref: '#/$defs/groupsAndItems' },\n {\n properties: {\n columns: {\n description: 'Columns that belong in this menu',\n $ref: '#/$defs/columnsWithHeaders',\n },\n },\n required: ['columns'],\n },\n ],\n unevaluatedProperties: false,\n },\n menusForOneWebView: {\n description: 'Set of menus that are associated with a single tab',\n type: 'object',\n properties: {\n includeDefaults: {\n description:\n 'Indicates whether the platform default menus should be included for this webview',\n type: 'boolean',\n },\n topMenu: {\n description: 'Menu that opens when you click on the top left corner of a tab',\n $ref: '#/$defs/multiColumnMenu',\n },\n contextMenu: {\n description: 'Menu that opens when you right click on the main body/area of a tab',\n $ref: '#/$defs/singleColumnMenu',\n },\n },\n additionalProperties: false,\n },\n },\n};\n\nObject.freeze(menuDocumentSchema);\n","'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\");\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 index >= 0 && index < this.length ? 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.nodeName = 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',\n\tlt: '<',\n\tquot: '\"',\n});\n\n/**\n * A map of all 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://html.spec.whatwg.org/entities.json JSON\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\tAacute: '\\u00C1',\n\taacute: '\\u00E1',\n\tAbreve: '\\u0102',\n\tabreve: '\\u0103',\n\tac: '\\u223E',\n\tacd: '\\u223F',\n\tacE: '\\u223E\\u0333',\n\tAcirc: '\\u00C2',\n\tacirc: '\\u00E2',\n\tacute: '\\u00B4',\n\tAcy: '\\u0410',\n\tacy: '\\u0430',\n\tAElig: '\\u00C6',\n\taelig: '\\u00E6',\n\taf: '\\u2061',\n\tAfr: '\\uD835\\uDD04',\n\tafr: '\\uD835\\uDD1E',\n\tAgrave: '\\u00C0',\n\tagrave: '\\u00E0',\n\talefsym: '\\u2135',\n\taleph: '\\u2135',\n\tAlpha: '\\u0391',\n\talpha: '\\u03B1',\n\tAmacr: '\\u0100',\n\tamacr: '\\u0101',\n\tamalg: '\\u2A3F',\n\tAMP: '\\u0026',\n\tamp: '\\u0026',\n\tAnd: '\\u2A53',\n\tand: '\\u2227',\n\tandand: '\\u2A55',\n\tandd: '\\u2A5C',\n\tandslope: '\\u2A58',\n\tandv: '\\u2A5A',\n\tang: '\\u2220',\n\tange: '\\u29A4',\n\tangle: '\\u2220',\n\tangmsd: '\\u2221',\n\tangmsdaa: '\\u29A8',\n\tangmsdab: '\\u29A9',\n\tangmsdac: '\\u29AA',\n\tangmsdad: '\\u29AB',\n\tangmsdae: '\\u29AC',\n\tangmsdaf: '\\u29AD',\n\tangmsdag: '\\u29AE',\n\tangmsdah: '\\u29AF',\n\tangrt: '\\u221F',\n\tangrtvb: '\\u22BE',\n\tangrtvbd: '\\u299D',\n\tangsph: '\\u2222',\n\tangst: '\\u00C5',\n\tangzarr: '\\u237C',\n\tAogon: '\\u0104',\n\taogon: '\\u0105',\n\tAopf: '\\uD835\\uDD38',\n\taopf: '\\uD835\\uDD52',\n\tap: '\\u2248',\n\tapacir: '\\u2A6F',\n\tapE: '\\u2A70',\n\tape: '\\u224A',\n\tapid: '\\u224B',\n\tapos: '\\u0027',\n\tApplyFunction: '\\u2061',\n\tapprox: '\\u2248',\n\tapproxeq: '\\u224A',\n\tAring: '\\u00C5',\n\taring: '\\u00E5',\n\tAscr: '\\uD835\\uDC9C',\n\tascr: '\\uD835\\uDCB6',\n\tAssign: '\\u2254',\n\tast: '\\u002A',\n\tasymp: '\\u2248',\n\tasympeq: '\\u224D',\n\tAtilde: '\\u00C3',\n\tatilde: '\\u00E3',\n\tAuml: '\\u00C4',\n\tauml: '\\u00E4',\n\tawconint: '\\u2233',\n\tawint: '\\u2A11',\n\tbackcong: '\\u224C',\n\tbackepsilon: '\\u03F6',\n\tbackprime: '\\u2035',\n\tbacksim: '\\u223D',\n\tbacksimeq: '\\u22CD',\n\tBackslash: '\\u2216',\n\tBarv: '\\u2AE7',\n\tbarvee: '\\u22BD',\n\tBarwed: '\\u2306',\n\tbarwed: '\\u2305',\n\tbarwedge: '\\u2305',\n\tbbrk: '\\u23B5',\n\tbbrktbrk: '\\u23B6',\n\tbcong: '\\u224C',\n\tBcy: '\\u0411',\n\tbcy: '\\u0431',\n\tbdquo: '\\u201E',\n\tbecaus: '\\u2235',\n\tBecause: '\\u2235',\n\tbecause: '\\u2235',\n\tbemptyv: '\\u29B0',\n\tbepsi: '\\u03F6',\n\tbernou: '\\u212C',\n\tBernoullis: '\\u212C',\n\tBeta: '\\u0392',\n\tbeta: '\\u03B2',\n\tbeth: '\\u2136',\n\tbetween: '\\u226C',\n\tBfr: '\\uD835\\uDD05',\n\tbfr: '\\uD835\\uDD1F',\n\tbigcap: '\\u22C2',\n\tbigcirc: '\\u25EF',\n\tbigcup: '\\u22C3',\n\tbigodot: '\\u2A00',\n\tbigoplus: '\\u2A01',\n\tbigotimes: '\\u2A02',\n\tbigsqcup: '\\u2A06',\n\tbigstar: '\\u2605',\n\tbigtriangledown: '\\u25BD',\n\tbigtriangleup: '\\u25B3',\n\tbiguplus: '\\u2A04',\n\tbigvee: '\\u22C1',\n\tbigwedge: '\\u22C0',\n\tbkarow: '\\u290D',\n\tblacklozenge: '\\u29EB',\n\tblacksquare: '\\u25AA',\n\tblacktriangle: '\\u25B4',\n\tblacktriangledown: '\\u25BE',\n\tblacktriangleleft: '\\u25C2',\n\tblacktriangleright: '\\u25B8',\n\tblank: '\\u2423',\n\tblk12: '\\u2592',\n\tblk14: '\\u2591',\n\tblk34: '\\u2593',\n\tblock: '\\u2588',\n\tbne: '\\u003D\\u20E5',\n\tbnequiv: '\\u2261\\u20E5',\n\tbNot: '\\u2AED',\n\tbnot: '\\u2310',\n\tBopf: '\\uD835\\uDD39',\n\tbopf: '\\uD835\\uDD53',\n\tbot: '\\u22A5',\n\tbottom: '\\u22A5',\n\tbowtie: '\\u22C8',\n\tboxbox: '\\u29C9',\n\tboxDL: '\\u2557',\n\tboxDl: '\\u2556',\n\tboxdL: '\\u2555',\n\tboxdl: '\\u2510',\n\tboxDR: '\\u2554',\n\tboxDr: '\\u2553',\n\tboxdR: '\\u2552',\n\tboxdr: '\\u250C',\n\tboxH: '\\u2550',\n\tboxh: '\\u2500',\n\tboxHD: '\\u2566',\n\tboxHd: '\\u2564',\n\tboxhD: '\\u2565',\n\tboxhd: '\\u252C',\n\tboxHU: '\\u2569',\n\tboxHu: '\\u2567',\n\tboxhU: '\\u2568',\n\tboxhu: '\\u2534',\n\tboxminus: '\\u229F',\n\tboxplus: '\\u229E',\n\tboxtimes: '\\u22A0',\n\tboxUL: '\\u255D',\n\tboxUl: '\\u255C',\n\tboxuL: '\\u255B',\n\tboxul: '\\u2518',\n\tboxUR: '\\u255A',\n\tboxUr: '\\u2559',\n\tboxuR: '\\u2558',\n\tboxur: '\\u2514',\n\tboxV: '\\u2551',\n\tboxv: '\\u2502',\n\tboxVH: '\\u256C',\n\tboxVh: '\\u256B',\n\tboxvH: '\\u256A',\n\tboxvh: '\\u253C',\n\tboxVL: '\\u2563',\n\tboxVl: '\\u2562',\n\tboxvL: '\\u2561',\n\tboxvl: '\\u2524',\n\tboxVR: '\\u2560',\n\tboxVr: '\\u255F',\n\tboxvR: '\\u255E',\n\tboxvr: '\\u251C',\n\tbprime: '\\u2035',\n\tBreve: '\\u02D8',\n\tbreve: '\\u02D8',\n\tbrvbar: '\\u00A6',\n\tBscr: '\\u212C',\n\tbscr: '\\uD835\\uDCB7',\n\tbsemi: '\\u204F',\n\tbsim: '\\u223D',\n\tbsime: '\\u22CD',\n\tbsol: '\\u005C',\n\tbsolb: '\\u29C5',\n\tbsolhsub: '\\u27C8',\n\tbull: '\\u2022',\n\tbullet: '\\u2022',\n\tbump: '\\u224E',\n\tbumpE: '\\u2AAE',\n\tbumpe: '\\u224F',\n\tBumpeq: '\\u224E',\n\tbumpeq: '\\u224F',\n\tCacute: '\\u0106',\n\tcacute: '\\u0107',\n\tCap: '\\u22D2',\n\tcap: '\\u2229',\n\tcapand: '\\u2A44',\n\tcapbrcup: '\\u2A49',\n\tcapcap: '\\u2A4B',\n\tcapcup: '\\u2A47',\n\tcapdot: '\\u2A40',\n\tCapitalDifferentialD: '\\u2145',\n\tcaps: '\\u2229\\uFE00',\n\tcaret: '\\u2041',\n\tcaron: '\\u02C7',\n\tCayleys: '\\u212D',\n\tccaps: '\\u2A4D',\n\tCcaron: '\\u010C',\n\tccaron: '\\u010D',\n\tCcedil: '\\u00C7',\n\tccedil: '\\u00E7',\n\tCcirc: '\\u0108',\n\tccirc: '\\u0109',\n\tCconint: '\\u2230',\n\tccups: '\\u2A4C',\n\tccupssm: '\\u2A50',\n\tCdot: '\\u010A',\n\tcdot: '\\u010B',\n\tcedil: '\\u00B8',\n\tCedilla: '\\u00B8',\n\tcemptyv: '\\u29B2',\n\tcent: '\\u00A2',\n\tCenterDot: '\\u00B7',\n\tcenterdot: '\\u00B7',\n\tCfr: '\\u212D',\n\tcfr: '\\uD835\\uDD20',\n\tCHcy: '\\u0427',\n\tchcy: '\\u0447',\n\tcheck: '\\u2713',\n\tcheckmark: '\\u2713',\n\tChi: '\\u03A7',\n\tchi: '\\u03C7',\n\tcir: '\\u25CB',\n\tcirc: '\\u02C6',\n\tcirceq: '\\u2257',\n\tcirclearrowleft: '\\u21BA',\n\tcirclearrowright: '\\u21BB',\n\tcircledast: '\\u229B',\n\tcircledcirc: '\\u229A',\n\tcircleddash: '\\u229D',\n\tCircleDot: '\\u2299',\n\tcircledR: '\\u00AE',\n\tcircledS: '\\u24C8',\n\tCircleMinus: '\\u2296',\n\tCirclePlus: '\\u2295',\n\tCircleTimes: '\\u2297',\n\tcirE: '\\u29C3',\n\tcire: '\\u2257',\n\tcirfnint: '\\u2A10',\n\tcirmid: '\\u2AEF',\n\tcirscir: '\\u29C2',\n\tClockwiseContourIntegral: '\\u2232',\n\tCloseCurlyDoubleQuote: '\\u201D',\n\tCloseCurlyQuote: '\\u2019',\n\tclubs: '\\u2663',\n\tclubsuit: '\\u2663',\n\tColon: '\\u2237',\n\tcolon: '\\u003A',\n\tColone: '\\u2A74',\n\tcolone: '\\u2254',\n\tcoloneq: '\\u2254',\n\tcomma: '\\u002C',\n\tcommat: '\\u0040',\n\tcomp: '\\u2201',\n\tcompfn: '\\u2218',\n\tcomplement: '\\u2201',\n\tcomplexes: '\\u2102',\n\tcong: '\\u2245',\n\tcongdot: '\\u2A6D',\n\tCongruent: '\\u2261',\n\tConint: '\\u222F',\n\tconint: '\\u222E',\n\tContourIntegral: '\\u222E',\n\tCopf: '\\u2102',\n\tcopf: '\\uD835\\uDD54',\n\tcoprod: '\\u2210',\n\tCoproduct: '\\u2210',\n\tCOPY: '\\u00A9',\n\tcopy: '\\u00A9',\n\tcopysr: '\\u2117',\n\tCounterClockwiseContourIntegral: '\\u2233',\n\tcrarr: '\\u21B5',\n\tCross: '\\u2A2F',\n\tcross: '\\u2717',\n\tCscr: '\\uD835\\uDC9E',\n\tcscr: '\\uD835\\uDCB8',\n\tcsub: '\\u2ACF',\n\tcsube: '\\u2AD1',\n\tcsup: '\\u2AD0',\n\tcsupe: '\\u2AD2',\n\tctdot: '\\u22EF',\n\tcudarrl: '\\u2938',\n\tcudarrr: '\\u2935',\n\tcuepr: '\\u22DE',\n\tcuesc: '\\u22DF',\n\tcularr: '\\u21B6',\n\tcularrp: '\\u293D',\n\tCup: '\\u22D3',\n\tcup: '\\u222A',\n\tcupbrcap: '\\u2A48',\n\tCupCap: '\\u224D',\n\tcupcap: '\\u2A46',\n\tcupcup: '\\u2A4A',\n\tcupdot: '\\u228D',\n\tcupor: '\\u2A45',\n\tcups: '\\u222A\\uFE00',\n\tcurarr: '\\u21B7',\n\tcurarrm: '\\u293C',\n\tcurlyeqprec: '\\u22DE',\n\tcurlyeqsucc: '\\u22DF',\n\tcurlyvee: '\\u22CE',\n\tcurlywedge: '\\u22CF',\n\tcurren: '\\u00A4',\n\tcurvearrowleft: '\\u21B6',\n\tcurvearrowright: '\\u21B7',\n\tcuvee: '\\u22CE',\n\tcuwed: '\\u22CF',\n\tcwconint: '\\u2232',\n\tcwint: '\\u2231',\n\tcylcty: '\\u232D',\n\tDagger: '\\u2021',\n\tdagger: '\\u2020',\n\tdaleth: '\\u2138',\n\tDarr: '\\u21A1',\n\tdArr: '\\u21D3',\n\tdarr: '\\u2193',\n\tdash: '\\u2010',\n\tDashv: '\\u2AE4',\n\tdashv: '\\u22A3',\n\tdbkarow: '\\u290F',\n\tdblac: '\\u02DD',\n\tDcaron: '\\u010E',\n\tdcaron: '\\u010F',\n\tDcy: '\\u0414',\n\tdcy: '\\u0434',\n\tDD: '\\u2145',\n\tdd: '\\u2146',\n\tddagger: '\\u2021',\n\tddarr: '\\u21CA',\n\tDDotrahd: '\\u2911',\n\tddotseq: '\\u2A77',\n\tdeg: '\\u00B0',\n\tDel: '\\u2207',\n\tDelta: '\\u0394',\n\tdelta: '\\u03B4',\n\tdemptyv: '\\u29B1',\n\tdfisht: '\\u297F',\n\tDfr: '\\uD835\\uDD07',\n\tdfr: '\\uD835\\uDD21',\n\tdHar: '\\u2965',\n\tdharl: '\\u21C3',\n\tdharr: '\\u21C2',\n\tDiacriticalAcute: '\\u00B4',\n\tDiacriticalDot: '\\u02D9',\n\tDiacriticalDoubleAcute: '\\u02DD',\n\tDiacriticalGrave: '\\u0060',\n\tDiacriticalTilde: '\\u02DC',\n\tdiam: '\\u22C4',\n\tDiamond: '\\u22C4',\n\tdiamond: '\\u22C4',\n\tdiamondsuit: '\\u2666',\n\tdiams: '\\u2666',\n\tdie: '\\u00A8',\n\tDifferentialD: '\\u2146',\n\tdigamma: '\\u03DD',\n\tdisin: '\\u22F2',\n\tdiv: '\\u00F7',\n\tdivide: '\\u00F7',\n\tdivideontimes: '\\u22C7',\n\tdivonx: '\\u22C7',\n\tDJcy: '\\u0402',\n\tdjcy: '\\u0452',\n\tdlcorn: '\\u231E',\n\tdlcrop: '\\u230D',\n\tdollar: '\\u0024',\n\tDopf: '\\uD835\\uDD3B',\n\tdopf: '\\uD835\\uDD55',\n\tDot: '\\u00A8',\n\tdot: '\\u02D9',\n\tDotDot: '\\u20DC',\n\tdoteq: '\\u2250',\n\tdoteqdot: '\\u2251',\n\tDotEqual: '\\u2250',\n\tdotminus: '\\u2238',\n\tdotplus: '\\u2214',\n\tdotsquare: '\\u22A1',\n\tdoublebarwedge: '\\u2306',\n\tDoubleContourIntegral: '\\u222F',\n\tDoubleDot: '\\u00A8',\n\tDoubleDownArrow: '\\u21D3',\n\tDoubleLeftArrow: '\\u21D0',\n\tDoubleLeftRightArrow: '\\u21D4',\n\tDoubleLeftTee: '\\u2AE4',\n\tDoubleLongLeftArrow: '\\u27F8',\n\tDoubleLongLeftRightArrow: '\\u27FA',\n\tDoubleLongRightArrow: '\\u27F9',\n\tDoubleRightArrow: '\\u21D2',\n\tDoubleRightTee: '\\u22A8',\n\tDoubleUpArrow: '\\u21D1',\n\tDoubleUpDownArrow: '\\u21D5',\n\tDoubleVerticalBar: '\\u2225',\n\tDownArrow: '\\u2193',\n\tDownarrow: '\\u21D3',\n\tdownarrow: '\\u2193',\n\tDownArrowBar: '\\u2913',\n\tDownArrowUpArrow: '\\u21F5',\n\tDownBreve: '\\u0311',\n\tdowndownarrows: '\\u21CA',\n\tdownharpoonleft: '\\u21C3',\n\tdownharpoonright: '\\u21C2',\n\tDownLeftRightVector: '\\u2950',\n\tDownLeftTeeVector: '\\u295E',\n\tDownLeftVector: '\\u21BD',\n\tDownLeftVectorBar: '\\u2956',\n\tDownRightTeeVector: '\\u295F',\n\tDownRightVector: '\\u21C1',\n\tDownRightVectorBar: '\\u2957',\n\tDownTee: '\\u22A4',\n\tDownTeeArrow: '\\u21A7',\n\tdrbkarow: '\\u2910',\n\tdrcorn: '\\u231F',\n\tdrcrop: '\\u230C',\n\tDscr: '\\uD835\\uDC9F',\n\tdscr: '\\uD835\\uDCB9',\n\tDScy: '\\u0405',\n\tdscy: '\\u0455',\n\tdsol: '\\u29F6',\n\tDstrok: '\\u0110',\n\tdstrok: '\\u0111',\n\tdtdot: '\\u22F1',\n\tdtri: '\\u25BF',\n\tdtrif: '\\u25BE',\n\tduarr: '\\u21F5',\n\tduhar: '\\u296F',\n\tdwangle: '\\u29A6',\n\tDZcy: '\\u040F',\n\tdzcy: '\\u045F',\n\tdzigrarr: '\\u27FF',\n\tEacute: '\\u00C9',\n\teacute: '\\u00E9',\n\teaster: '\\u2A6E',\n\tEcaron: '\\u011A',\n\tecaron: '\\u011B',\n\tecir: '\\u2256',\n\tEcirc: '\\u00CA',\n\tecirc: '\\u00EA',\n\tecolon: '\\u2255',\n\tEcy: '\\u042D',\n\tecy: '\\u044D',\n\teDDot: '\\u2A77',\n\tEdot: '\\u0116',\n\teDot: '\\u2251',\n\tedot: '\\u0117',\n\tee: '\\u2147',\n\tefDot: '\\u2252',\n\tEfr: '\\uD835\\uDD08',\n\tefr: '\\uD835\\uDD22',\n\teg: '\\u2A9A',\n\tEgrave: '\\u00C8',\n\tegrave: '\\u00E8',\n\tegs: '\\u2A96',\n\tegsdot: '\\u2A98',\n\tel: '\\u2A99',\n\tElement: '\\u2208',\n\telinters: '\\u23E7',\n\tell: '\\u2113',\n\tels: '\\u2A95',\n\telsdot: '\\u2A97',\n\tEmacr: '\\u0112',\n\temacr: '\\u0113',\n\tempty: '\\u2205',\n\temptyset: '\\u2205',\n\tEmptySmallSquare: '\\u25FB',\n\temptyv: '\\u2205',\n\tEmptyVerySmallSquare: '\\u25AB',\n\temsp: '\\u2003',\n\temsp13: '\\u2004',\n\temsp14: '\\u2005',\n\tENG: '\\u014A',\n\teng: '\\u014B',\n\tensp: '\\u2002',\n\tEogon: '\\u0118',\n\teogon: '\\u0119',\n\tEopf: '\\uD835\\uDD3C',\n\teopf: '\\uD835\\uDD56',\n\tepar: '\\u22D5',\n\teparsl: '\\u29E3',\n\teplus: '\\u2A71',\n\tepsi: '\\u03B5',\n\tEpsilon: '\\u0395',\n\tepsilon: '\\u03B5',\n\tepsiv: '\\u03F5',\n\teqcirc: '\\u2256',\n\teqcolon: '\\u2255',\n\teqsim: '\\u2242',\n\teqslantgtr: '\\u2A96',\n\teqslantless: '\\u2A95',\n\tEqual: '\\u2A75',\n\tequals: '\\u003D',\n\tEqualTilde: '\\u2242',\n\tequest: '\\u225F',\n\tEquilibrium: '\\u21CC',\n\tequiv: '\\u2261',\n\tequivDD: '\\u2A78',\n\teqvparsl: '\\u29E5',\n\terarr: '\\u2971',\n\terDot: '\\u2253',\n\tEscr: '\\u2130',\n\tescr: '\\u212F',\n\tesdot: '\\u2250',\n\tEsim: '\\u2A73',\n\tesim: '\\u2242',\n\tEta: '\\u0397',\n\teta: '\\u03B7',\n\tETH: '\\u00D0',\n\teth: '\\u00F0',\n\tEuml: '\\u00CB',\n\teuml: '\\u00EB',\n\teuro: '\\u20AC',\n\texcl: '\\u0021',\n\texist: '\\u2203',\n\tExists: '\\u2203',\n\texpectation: '\\u2130',\n\tExponentialE: '\\u2147',\n\texponentiale: '\\u2147',\n\tfallingdotseq: '\\u2252',\n\tFcy: '\\u0424',\n\tfcy: '\\u0444',\n\tfemale: '\\u2640',\n\tffilig: '\\uFB03',\n\tfflig: '\\uFB00',\n\tffllig: '\\uFB04',\n\tFfr: '\\uD835\\uDD09',\n\tffr: '\\uD835\\uDD23',\n\tfilig: '\\uFB01',\n\tFilledSmallSquare: '\\u25FC',\n\tFilledVerySmallSquare: '\\u25AA',\n\tfjlig: '\\u0066\\u006A',\n\tflat: '\\u266D',\n\tfllig: '\\uFB02',\n\tfltns: '\\u25B1',\n\tfnof: '\\u0192',\n\tFopf: '\\uD835\\uDD3D',\n\tfopf: '\\uD835\\uDD57',\n\tForAll: '\\u2200',\n\tforall: '\\u2200',\n\tfork: '\\u22D4',\n\tforkv: '\\u2AD9',\n\tFouriertrf: '\\u2131',\n\tfpartint: '\\u2A0D',\n\tfrac12: '\\u00BD',\n\tfrac13: '\\u2153',\n\tfrac14: '\\u00BC',\n\tfrac15: '\\u2155',\n\tfrac16: '\\u2159',\n\tfrac18: '\\u215B',\n\tfrac23: '\\u2154',\n\tfrac25: '\\u2156',\n\tfrac34: '\\u00BE',\n\tfrac35: '\\u2157',\n\tfrac38: '\\u215C',\n\tfrac45: '\\u2158',\n\tfrac56: '\\u215A',\n\tfrac58: '\\u215D',\n\tfrac78: '\\u215E',\n\tfrasl: '\\u2044',\n\tfrown: '\\u2322',\n\tFscr: '\\u2131',\n\tfscr: '\\uD835\\uDCBB',\n\tgacute: '\\u01F5',\n\tGamma: '\\u0393',\n\tgamma: '\\u03B3',\n\tGammad: '\\u03DC',\n\tgammad: '\\u03DD',\n\tgap: '\\u2A86',\n\tGbreve: '\\u011E',\n\tgbreve: '\\u011F',\n\tGcedil: '\\u0122',\n\tGcirc: '\\u011C',\n\tgcirc: '\\u011D',\n\tGcy: '\\u0413',\n\tgcy: '\\u0433',\n\tGdot: '\\u0120',\n\tgdot: '\\u0121',\n\tgE: '\\u2267',\n\tge: '\\u2265',\n\tgEl: '\\u2A8C',\n\tgel: '\\u22DB',\n\tgeq: '\\u2265',\n\tgeqq: '\\u2267',\n\tgeqslant: '\\u2A7E',\n\tges: '\\u2A7E',\n\tgescc: '\\u2AA9',\n\tgesdot: '\\u2A80',\n\tgesdoto: '\\u2A82',\n\tgesdotol: '\\u2A84',\n\tgesl: '\\u22DB\\uFE00',\n\tgesles: '\\u2A94',\n\tGfr: '\\uD835\\uDD0A',\n\tgfr: '\\uD835\\uDD24',\n\tGg: '\\u22D9',\n\tgg: '\\u226B',\n\tggg: '\\u22D9',\n\tgimel: '\\u2137',\n\tGJcy: '\\u0403',\n\tgjcy: '\\u0453',\n\tgl: '\\u2277',\n\tgla: '\\u2AA5',\n\tglE: '\\u2A92',\n\tglj: '\\u2AA4',\n\tgnap: '\\u2A8A',\n\tgnapprox: '\\u2A8A',\n\tgnE: '\\u2269',\n\tgne: '\\u2A88',\n\tgneq: '\\u2A88',\n\tgneqq: '\\u2269',\n\tgnsim: '\\u22E7',\n\tGopf: '\\uD835\\uDD3E',\n\tgopf: '\\uD835\\uDD58',\n\tgrave: '\\u0060',\n\tGreaterEqual: '\\u2265',\n\tGreaterEqualLess: '\\u22DB',\n\tGreaterFullEqual: '\\u2267',\n\tGreaterGreater: '\\u2AA2',\n\tGreaterLess: '\\u2277',\n\tGreaterSlantEqual: '\\u2A7E',\n\tGreaterTilde: '\\u2273',\n\tGscr: '\\uD835\\uDCA2',\n\tgscr: '\\u210A',\n\tgsim: '\\u2273',\n\tgsime: '\\u2A8E',\n\tgsiml: '\\u2A90',\n\tGt: '\\u226B',\n\tGT: '\\u003E',\n\tgt: '\\u003E',\n\tgtcc: '\\u2AA7',\n\tgtcir: '\\u2A7A',\n\tgtdot: '\\u22D7',\n\tgtlPar: '\\u2995',\n\tgtquest: '\\u2A7C',\n\tgtrapprox: '\\u2A86',\n\tgtrarr: '\\u2978',\n\tgtrdot: '\\u22D7',\n\tgtreqless: '\\u22DB',\n\tgtreqqless: '\\u2A8C',\n\tgtrless: '\\u2277',\n\tgtrsim: '\\u2273',\n\tgvertneqq: '\\u2269\\uFE00',\n\tgvnE: '\\u2269\\uFE00',\n\tHacek: '\\u02C7',\n\thairsp: '\\u200A',\n\thalf: '\\u00BD',\n\thamilt: '\\u210B',\n\tHARDcy: '\\u042A',\n\thardcy: '\\u044A',\n\thArr: '\\u21D4',\n\tharr: '\\u2194',\n\tharrcir: '\\u2948',\n\tharrw: '\\u21AD',\n\tHat: '\\u005E',\n\thbar: '\\u210F',\n\tHcirc: '\\u0124',\n\thcirc: '\\u0125',\n\thearts: '\\u2665',\n\theartsuit: '\\u2665',\n\thellip: '\\u2026',\n\thercon: '\\u22B9',\n\tHfr: '\\u210C',\n\thfr: '\\uD835\\uDD25',\n\tHilbertSpace: '\\u210B',\n\thksearow: '\\u2925',\n\thkswarow: '\\u2926',\n\thoarr: '\\u21FF',\n\thomtht: '\\u223B',\n\thookleftarrow: '\\u21A9',\n\thookrightarrow: '\\u21AA',\n\tHopf: '\\u210D',\n\thopf: '\\uD835\\uDD59',\n\thorbar: '\\u2015',\n\tHorizontalLine: '\\u2500',\n\tHscr: '\\u210B',\n\thscr: '\\uD835\\uDCBD',\n\thslash: '\\u210F',\n\tHstrok: '\\u0126',\n\thstrok: '\\u0127',\n\tHumpDownHump: '\\u224E',\n\tHumpEqual: '\\u224F',\n\thybull: '\\u2043',\n\thyphen: '\\u2010',\n\tIacute: '\\u00CD',\n\tiacute: '\\u00ED',\n\tic: '\\u2063',\n\tIcirc: '\\u00CE',\n\ticirc: '\\u00EE',\n\tIcy: '\\u0418',\n\ticy: '\\u0438',\n\tIdot: '\\u0130',\n\tIEcy: '\\u0415',\n\tiecy: '\\u0435',\n\tiexcl: '\\u00A1',\n\tiff: '\\u21D4',\n\tIfr: '\\u2111',\n\tifr: '\\uD835\\uDD26',\n\tIgrave: '\\u00CC',\n\tigrave: '\\u00EC',\n\tii: '\\u2148',\n\tiiiint: '\\u2A0C',\n\tiiint: '\\u222D',\n\tiinfin: '\\u29DC',\n\tiiota: '\\u2129',\n\tIJlig: '\\u0132',\n\tijlig: '\\u0133',\n\tIm: '\\u2111',\n\tImacr: '\\u012A',\n\timacr: '\\u012B',\n\timage: '\\u2111',\n\tImaginaryI: '\\u2148',\n\timagline: '\\u2110',\n\timagpart: '\\u2111',\n\timath: '\\u0131',\n\timof: '\\u22B7',\n\timped: '\\u01B5',\n\tImplies: '\\u21D2',\n\tin: '\\u2208',\n\tincare: '\\u2105',\n\tinfin: '\\u221E',\n\tinfintie: '\\u29DD',\n\tinodot: '\\u0131',\n\tInt: '\\u222C',\n\tint: '\\u222B',\n\tintcal: '\\u22BA',\n\tintegers: '\\u2124',\n\tIntegral: '\\u222B',\n\tintercal: '\\u22BA',\n\tIntersection: '\\u22C2',\n\tintlarhk: '\\u2A17',\n\tintprod: '\\u2A3C',\n\tInvisibleComma: '\\u2063',\n\tInvisibleTimes: '\\u2062',\n\tIOcy: '\\u0401',\n\tiocy: '\\u0451',\n\tIogon: '\\u012E',\n\tiogon: '\\u012F',\n\tIopf: '\\uD835\\uDD40',\n\tiopf: '\\uD835\\uDD5A',\n\tIota: '\\u0399',\n\tiota: '\\u03B9',\n\tiprod: '\\u2A3C',\n\tiquest: '\\u00BF',\n\tIscr: '\\u2110',\n\tiscr: '\\uD835\\uDCBE',\n\tisin: '\\u2208',\n\tisindot: '\\u22F5',\n\tisinE: '\\u22F9',\n\tisins: '\\u22F4',\n\tisinsv: '\\u22F3',\n\tisinv: '\\u2208',\n\tit: '\\u2062',\n\tItilde: '\\u0128',\n\titilde: '\\u0129',\n\tIukcy: '\\u0406',\n\tiukcy: '\\u0456',\n\tIuml: '\\u00CF',\n\tiuml: '\\u00EF',\n\tJcirc: '\\u0134',\n\tjcirc: '\\u0135',\n\tJcy: '\\u0419',\n\tjcy: '\\u0439',\n\tJfr: '\\uD835\\uDD0D',\n\tjfr: '\\uD835\\uDD27',\n\tjmath: '\\u0237',\n\tJopf: '\\uD835\\uDD41',\n\tjopf: '\\uD835\\uDD5B',\n\tJscr: '\\uD835\\uDCA5',\n\tjscr: '\\uD835\\uDCBF',\n\tJsercy: '\\u0408',\n\tjsercy: '\\u0458',\n\tJukcy: '\\u0404',\n\tjukcy: '\\u0454',\n\tKappa: '\\u039A',\n\tkappa: '\\u03BA',\n\tkappav: '\\u03F0',\n\tKcedil: '\\u0136',\n\tkcedil: '\\u0137',\n\tKcy: '\\u041A',\n\tkcy: '\\u043A',\n\tKfr: '\\uD835\\uDD0E',\n\tkfr: '\\uD835\\uDD28',\n\tkgreen: '\\u0138',\n\tKHcy: '\\u0425',\n\tkhcy: '\\u0445',\n\tKJcy: '\\u040C',\n\tkjcy: '\\u045C',\n\tKopf: '\\uD835\\uDD42',\n\tkopf: '\\uD835\\uDD5C',\n\tKscr: '\\uD835\\uDCA6',\n\tkscr: '\\uD835\\uDCC0',\n\tlAarr: '\\u21DA',\n\tLacute: '\\u0139',\n\tlacute: '\\u013A',\n\tlaemptyv: '\\u29B4',\n\tlagran: '\\u2112',\n\tLambda: '\\u039B',\n\tlambda: '\\u03BB',\n\tLang: '\\u27EA',\n\tlang: '\\u27E8',\n\tlangd: '\\u2991',\n\tlangle: '\\u27E8',\n\tlap: '\\u2A85',\n\tLaplacetrf: '\\u2112',\n\tlaquo: '\\u00AB',\n\tLarr: '\\u219E',\n\tlArr: '\\u21D0',\n\tlarr: '\\u2190',\n\tlarrb: '\\u21E4',\n\tlarrbfs: '\\u291F',\n\tlarrfs: '\\u291D',\n\tlarrhk: '\\u21A9',\n\tlarrlp: '\\u21AB',\n\tlarrpl: '\\u2939',\n\tlarrsim: '\\u2973',\n\tlarrtl: '\\u21A2',\n\tlat: '\\u2AAB',\n\tlAtail: '\\u291B',\n\tlatail: '\\u2919',\n\tlate: '\\u2AAD',\n\tlates: '\\u2AAD\\uFE00',\n\tlBarr: '\\u290E',\n\tlbarr: '\\u290C',\n\tlbbrk: '\\u2772',\n\tlbrace: '\\u007B',\n\tlbrack: '\\u005B',\n\tlbrke: '\\u298B',\n\tlbrksld: '\\u298F',\n\tlbrkslu: '\\u298D',\n\tLcaron: '\\u013D',\n\tlcaron: '\\u013E',\n\tLcedil: '\\u013B',\n\tlcedil: '\\u013C',\n\tlceil: '\\u2308',\n\tlcub: '\\u007B',\n\tLcy: '\\u041B',\n\tlcy: '\\u043B',\n\tldca: '\\u2936',\n\tldquo: '\\u201C',\n\tldquor: '\\u201E',\n\tldrdhar: '\\u2967',\n\tldrushar: '\\u294B',\n\tldsh: '\\u21B2',\n\tlE: '\\u2266',\n\tle: '\\u2264',\n\tLeftAngleBracket: '\\u27E8',\n\tLeftArrow: '\\u2190',\n\tLeftarrow: '\\u21D0',\n\tleftarrow: '\\u2190',\n\tLeftArrowBar: '\\u21E4',\n\tLeftArrowRightArrow: '\\u21C6',\n\tleftarrowtail: '\\u21A2',\n\tLeftCeiling: '\\u2308',\n\tLeftDoubleBracket: '\\u27E6',\n\tLeftDownTeeVector: '\\u2961',\n\tLeftDownVector: '\\u21C3',\n\tLeftDownVectorBar: '\\u2959',\n\tLeftFloor: '\\u230A',\n\tleftharpoondown: '\\u21BD',\n\tleftharpoonup: '\\u21BC',\n\tleftleftarrows: '\\u21C7',\n\tLeftRightArrow: '\\u2194',\n\tLeftrightarrow: '\\u21D4',\n\tleftrightarrow: '\\u2194',\n\tleftrightarrows: '\\u21C6',\n\tleftrightharpoons: '\\u21CB',\n\tleftrightsquigarrow: '\\u21AD',\n\tLeftRightVector: '\\u294E',\n\tLeftTee: '\\u22A3',\n\tLeftTeeArrow: '\\u21A4',\n\tLeftTeeVector: '\\u295A',\n\tleftthreetimes: '\\u22CB',\n\tLeftTriangle: '\\u22B2',\n\tLeftTriangleBar: '\\u29CF',\n\tLeftTriangleEqual: '\\u22B4',\n\tLeftUpDownVector: '\\u2951',\n\tLeftUpTeeVector: '\\u2960',\n\tLeftUpVector: '\\u21BF',\n\tLeftUpVectorBar: '\\u2958',\n\tLeftVector: '\\u21BC',\n\tLeftVectorBar: '\\u2952',\n\tlEg: '\\u2A8B',\n\tleg: '\\u22DA',\n\tleq: '\\u2264',\n\tleqq: '\\u2266',\n\tleqslant: '\\u2A7D',\n\tles: '\\u2A7D',\n\tlescc: '\\u2AA8',\n\tlesdot: '\\u2A7F',\n\tlesdoto: '\\u2A81',\n\tlesdotor: '\\u2A83',\n\tlesg: '\\u22DA\\uFE00',\n\tlesges: '\\u2A93',\n\tlessapprox: '\\u2A85',\n\tlessdot: '\\u22D6',\n\tlesseqgtr: '\\u22DA',\n\tlesseqqgtr: '\\u2A8B',\n\tLessEqualGreater: '\\u22DA',\n\tLessFullEqual: '\\u2266',\n\tLessGreater: '\\u2276',\n\tlessgtr: '\\u2276',\n\tLessLess: '\\u2AA1',\n\tlesssim: '\\u2272',\n\tLessSlantEqual: '\\u2A7D',\n\tLessTilde: '\\u2272',\n\tlfisht: '\\u297C',\n\tlfloor: '\\u230A',\n\tLfr: '\\uD835\\uDD0F',\n\tlfr: '\\uD835\\uDD29',\n\tlg: '\\u2276',\n\tlgE: '\\u2A91',\n\tlHar: '\\u2962',\n\tlhard: '\\u21BD',\n\tlharu: '\\u21BC',\n\tlharul: '\\u296A',\n\tlhblk: '\\u2584',\n\tLJcy: '\\u0409',\n\tljcy: '\\u0459',\n\tLl: '\\u22D8',\n\tll: '\\u226A',\n\tllarr: '\\u21C7',\n\tllcorner: '\\u231E',\n\tLleftarrow: '\\u21DA',\n\tllhard: '\\u296B',\n\tlltri: '\\u25FA',\n\tLmidot: '\\u013F',\n\tlmidot: '\\u0140',\n\tlmoust: '\\u23B0',\n\tlmoustache: '\\u23B0',\n\tlnap: '\\u2A89',\n\tlnapprox: '\\u2A89',\n\tlnE: '\\u2268',\n\tlne: '\\u2A87',\n\tlneq: '\\u2A87',\n\tlneqq: '\\u2268',\n\tlnsim: '\\u22E6',\n\tloang: '\\u27EC',\n\tloarr: '\\u21FD',\n\tlobrk: '\\u27E6',\n\tLongLeftArrow: '\\u27F5',\n\tLongleftarrow: '\\u27F8',\n\tlongleftarrow: '\\u27F5',\n\tLongLeftRightArrow: '\\u27F7',\n\tLongleftrightarrow: '\\u27FA',\n\tlongleftrightarrow: '\\u27F7',\n\tlongmapsto: '\\u27FC',\n\tLongRightArrow: '\\u27F6',\n\tLongrightarrow: '\\u27F9',\n\tlongrightarrow: '\\u27F6',\n\tlooparrowleft: '\\u21AB',\n\tlooparrowright: '\\u21AC',\n\tlopar: '\\u2985',\n\tLopf: '\\uD835\\uDD43',\n\tlopf: '\\uD835\\uDD5D',\n\tloplus: '\\u2A2D',\n\tlotimes: '\\u2A34',\n\tlowast: '\\u2217',\n\tlowbar: '\\u005F',\n\tLowerLeftArrow: '\\u2199',\n\tLowerRightArrow: '\\u2198',\n\tloz: '\\u25CA',\n\tlozenge: '\\u25CA',\n\tlozf: '\\u29EB',\n\tlpar: '\\u0028',\n\tlparlt: '\\u2993',\n\tlrarr: '\\u21C6',\n\tlrcorner: '\\u231F',\n\tlrhar: '\\u21CB',\n\tlrhard: '\\u296D',\n\tlrm: '\\u200E',\n\tlrtri: '\\u22BF',\n\tlsaquo: '\\u2039',\n\tLscr: '\\u2112',\n\tlscr: '\\uD835\\uDCC1',\n\tLsh: '\\u21B0',\n\tlsh: '\\u21B0',\n\tlsim: '\\u2272',\n\tlsime: '\\u2A8D',\n\tlsimg: '\\u2A8F',\n\tlsqb: '\\u005B',\n\tlsquo: '\\u2018',\n\tlsquor: '\\u201A',\n\tLstrok: '\\u0141',\n\tlstrok: '\\u0142',\n\tLt: '\\u226A',\n\tLT: '\\u003C',\n\tlt: '\\u003C',\n\tltcc: '\\u2AA6',\n\tltcir: '\\u2A79',\n\tltdot: '\\u22D6',\n\tlthree: '\\u22CB',\n\tltimes: '\\u22C9',\n\tltlarr: '\\u2976',\n\tltquest: '\\u2A7B',\n\tltri: '\\u25C3',\n\tltrie: '\\u22B4',\n\tltrif: '\\u25C2',\n\tltrPar: '\\u2996',\n\tlurdshar: '\\u294A',\n\tluruhar: '\\u2966',\n\tlvertneqq: '\\u2268\\uFE00',\n\tlvnE: '\\u2268\\uFE00',\n\tmacr: '\\u00AF',\n\tmale: '\\u2642',\n\tmalt: '\\u2720',\n\tmaltese: '\\u2720',\n\tMap: '\\u2905',\n\tmap: '\\u21A6',\n\tmapsto: '\\u21A6',\n\tmapstodown: '\\u21A7',\n\tmapstoleft: '\\u21A4',\n\tmapstoup: '\\u21A5',\n\tmarker: '\\u25AE',\n\tmcomma: '\\u2A29',\n\tMcy: '\\u041C',\n\tmcy: '\\u043C',\n\tmdash: '\\u2014',\n\tmDDot: '\\u223A',\n\tmeasuredangle: '\\u2221',\n\tMediumSpace: '\\u205F',\n\tMellintrf: '\\u2133',\n\tMfr: '\\uD835\\uDD10',\n\tmfr: '\\uD835\\uDD2A',\n\tmho: '\\u2127',\n\tmicro: '\\u00B5',\n\tmid: '\\u2223',\n\tmidast: '\\u002A',\n\tmidcir: '\\u2AF0',\n\tmiddot: '\\u00B7',\n\tminus: '\\u2212',\n\tminusb: '\\u229F',\n\tminusd: '\\u2238',\n\tminusdu: '\\u2A2A',\n\tMinusPlus: '\\u2213',\n\tmlcp: '\\u2ADB',\n\tmldr: '\\u2026',\n\tmnplus: '\\u2213',\n\tmodels: '\\u22A7',\n\tMopf: '\\uD835\\uDD44',\n\tmopf: '\\uD835\\uDD5E',\n\tmp: '\\u2213',\n\tMscr: '\\u2133',\n\tmscr: '\\uD835\\uDCC2',\n\tmstpos: '\\u223E',\n\tMu: '\\u039C',\n\tmu: '\\u03BC',\n\tmultimap: '\\u22B8',\n\tmumap: '\\u22B8',\n\tnabla: '\\u2207',\n\tNacute: '\\u0143',\n\tnacute: '\\u0144',\n\tnang: '\\u2220\\u20D2',\n\tnap: '\\u2249',\n\tnapE: '\\u2A70\\u0338',\n\tnapid: '\\u224B\\u0338',\n\tnapos: '\\u0149',\n\tnapprox: '\\u2249',\n\tnatur: '\\u266E',\n\tnatural: '\\u266E',\n\tnaturals: '\\u2115',\n\tnbsp: '\\u00A0',\n\tnbump: '\\u224E\\u0338',\n\tnbumpe: '\\u224F\\u0338',\n\tncap: '\\u2A43',\n\tNcaron: '\\u0147',\n\tncaron: '\\u0148',\n\tNcedil: '\\u0145',\n\tncedil: '\\u0146',\n\tncong: '\\u2247',\n\tncongdot: '\\u2A6D\\u0338',\n\tncup: '\\u2A42',\n\tNcy: '\\u041D',\n\tncy: '\\u043D',\n\tndash: '\\u2013',\n\tne: '\\u2260',\n\tnearhk: '\\u2924',\n\tneArr: '\\u21D7',\n\tnearr: '\\u2197',\n\tnearrow: '\\u2197',\n\tnedot: '\\u2250\\u0338',\n\tNegativeMediumSpace: '\\u200B',\n\tNegativeThickSpace: '\\u200B',\n\tNegativeThinSpace: '\\u200B',\n\tNegativeVeryThinSpace: '\\u200B',\n\tnequiv: '\\u2262',\n\tnesear: '\\u2928',\n\tnesim: '\\u2242\\u0338',\n\tNestedGreaterGreater: '\\u226B',\n\tNestedLessLess: '\\u226A',\n\tNewLine: '\\u000A',\n\tnexist: '\\u2204',\n\tnexists: '\\u2204',\n\tNfr: '\\uD835\\uDD11',\n\tnfr: '\\uD835\\uDD2B',\n\tngE: '\\u2267\\u0338',\n\tnge: '\\u2271',\n\tngeq: '\\u2271',\n\tngeqq: '\\u2267\\u0338',\n\tngeqslant: '\\u2A7E\\u0338',\n\tnges: '\\u2A7E\\u0338',\n\tnGg: '\\u22D9\\u0338',\n\tngsim: '\\u2275',\n\tnGt: '\\u226B\\u20D2',\n\tngt: '\\u226F',\n\tngtr: '\\u226F',\n\tnGtv: '\\u226B\\u0338',\n\tnhArr: '\\u21CE',\n\tnharr: '\\u21AE',\n\tnhpar: '\\u2AF2',\n\tni: '\\u220B',\n\tnis: '\\u22FC',\n\tnisd: '\\u22FA',\n\tniv: '\\u220B',\n\tNJcy: '\\u040A',\n\tnjcy: '\\u045A',\n\tnlArr: '\\u21CD',\n\tnlarr: '\\u219A',\n\tnldr: '\\u2025',\n\tnlE: '\\u2266\\u0338',\n\tnle: '\\u2270',\n\tnLeftarrow: '\\u21CD',\n\tnleftarrow: '\\u219A',\n\tnLeftrightarrow: '\\u21CE',\n\tnleftrightarrow: '\\u21AE',\n\tnleq: '\\u2270',\n\tnleqq: '\\u2266\\u0338',\n\tnleqslant: '\\u2A7D\\u0338',\n\tnles: '\\u2A7D\\u0338',\n\tnless: '\\u226E',\n\tnLl: '\\u22D8\\u0338',\n\tnlsim: '\\u2274',\n\tnLt: '\\u226A\\u20D2',\n\tnlt: '\\u226E',\n\tnltri: '\\u22EA',\n\tnltrie: '\\u22EC',\n\tnLtv: '\\u226A\\u0338',\n\tnmid: '\\u2224',\n\tNoBreak: '\\u2060',\n\tNonBreakingSpace: '\\u00A0',\n\tNopf: '\\u2115',\n\tnopf: '\\uD835\\uDD5F',\n\tNot: '\\u2AEC',\n\tnot: '\\u00AC',\n\tNotCongruent: '\\u2262',\n\tNotCupCap: '\\u226D',\n\tNotDoubleVerticalBar: '\\u2226',\n\tNotElement: '\\u2209',\n\tNotEqual: '\\u2260',\n\tNotEqualTilde: '\\u2242\\u0338',\n\tNotExists: '\\u2204',\n\tNotGreater: '\\u226F',\n\tNotGreaterEqual: '\\u2271',\n\tNotGreaterFullEqual: '\\u2267\\u0338',\n\tNotGreaterGreater: '\\u226B\\u0338',\n\tNotGreaterLess: '\\u2279',\n\tNotGreaterSlantEqual: '\\u2A7E\\u0338',\n\tNotGreaterTilde: '\\u2275',\n\tNotHumpDownHump: '\\u224E\\u0338',\n\tNotHumpEqual: '\\u224F\\u0338',\n\tnotin: '\\u2209',\n\tnotindot: '\\u22F5\\u0338',\n\tnotinE: '\\u22F9\\u0338',\n\tnotinva: '\\u2209',\n\tnotinvb: '\\u22F7',\n\tnotinvc: '\\u22F6',\n\tNotLeftTriangle: '\\u22EA',\n\tNotLeftTriangleBar: '\\u29CF\\u0338',\n\tNotLeftTriangleEqual: '\\u22EC',\n\tNotLess: '\\u226E',\n\tNotLessEqual: '\\u2270',\n\tNotLessGreater: '\\u2278',\n\tNotLessLess: '\\u226A\\u0338',\n\tNotLessSlantEqual: '\\u2A7D\\u0338',\n\tNotLessTilde: '\\u2274',\n\tNotNestedGreaterGreater: '\\u2AA2\\u0338',\n\tNotNestedLessLess: '\\u2AA1\\u0338',\n\tnotni: '\\u220C',\n\tnotniva: '\\u220C',\n\tnotnivb: '\\u22FE',\n\tnotnivc: '\\u22FD',\n\tNotPrecedes: '\\u2280',\n\tNotPrecedesEqual: '\\u2AAF\\u0338',\n\tNotPrecedesSlantEqual: '\\u22E0',\n\tNotReverseElement: '\\u220C',\n\tNotRightTriangle: '\\u22EB',\n\tNotRightTriangleBar: '\\u29D0\\u0338',\n\tNotRightTriangleEqual: '\\u22ED',\n\tNotSquareSubset: '\\u228F\\u0338',\n\tNotSquareSubsetEqual: '\\u22E2',\n\tNotSquareSuperset: '\\u2290\\u0338',\n\tNotSquareSupersetEqual: '\\u22E3',\n\tNotSubset: '\\u2282\\u20D2',\n\tNotSubsetEqual: '\\u2288',\n\tNotSucceeds: '\\u2281',\n\tNotSucceedsEqual: '\\u2AB0\\u0338',\n\tNotSucceedsSlantEqual: '\\u22E1',\n\tNotSucceedsTilde: '\\u227F\\u0338',\n\tNotSuperset: '\\u2283\\u20D2',\n\tNotSupersetEqual: '\\u2289',\n\tNotTilde: '\\u2241',\n\tNotTildeEqual: '\\u2244',\n\tNotTildeFullEqual: '\\u2247',\n\tNotTildeTilde: '\\u2249',\n\tNotVerticalBar: '\\u2224',\n\tnpar: '\\u2226',\n\tnparallel: '\\u2226',\n\tnparsl: '\\u2AFD\\u20E5',\n\tnpart: '\\u2202\\u0338',\n\tnpolint: '\\u2A14',\n\tnpr: '\\u2280',\n\tnprcue: '\\u22E0',\n\tnpre: '\\u2AAF\\u0338',\n\tnprec: '\\u2280',\n\tnpreceq: '\\u2AAF\\u0338',\n\tnrArr: '\\u21CF',\n\tnrarr: '\\u219B',\n\tnrarrc: '\\u2933\\u0338',\n\tnrarrw: '\\u219D\\u0338',\n\tnRightarrow: '\\u21CF',\n\tnrightarrow: '\\u219B',\n\tnrtri: '\\u22EB',\n\tnrtrie: '\\u22ED',\n\tnsc: '\\u2281',\n\tnsccue: '\\u22E1',\n\tnsce: '\\u2AB0\\u0338',\n\tNscr: '\\uD835\\uDCA9',\n\tnscr: '\\uD835\\uDCC3',\n\tnshortmid: '\\u2224',\n\tnshortparallel: '\\u2226',\n\tnsim: '\\u2241',\n\tnsime: '\\u2244',\n\tnsimeq: '\\u2244',\n\tnsmid: '\\u2224',\n\tnspar: '\\u2226',\n\tnsqsube: '\\u22E2',\n\tnsqsupe: '\\u22E3',\n\tnsub: '\\u2284',\n\tnsubE: '\\u2AC5\\u0338',\n\tnsube: '\\u2288',\n\tnsubset: '\\u2282\\u20D2',\n\tnsubseteq: '\\u2288',\n\tnsubseteqq: '\\u2AC5\\u0338',\n\tnsucc: '\\u2281',\n\tnsucceq: '\\u2AB0\\u0338',\n\tnsup: '\\u2285',\n\tnsupE: '\\u2AC6\\u0338',\n\tnsupe: '\\u2289',\n\tnsupset: '\\u2283\\u20D2',\n\tnsupseteq: '\\u2289',\n\tnsupseteqq: '\\u2AC6\\u0338',\n\tntgl: '\\u2279',\n\tNtilde: '\\u00D1',\n\tntilde: '\\u00F1',\n\tntlg: '\\u2278',\n\tntriangleleft: '\\u22EA',\n\tntrianglelefteq: '\\u22EC',\n\tntriangleright: '\\u22EB',\n\tntrianglerighteq: '\\u22ED',\n\tNu: '\\u039D',\n\tnu: '\\u03BD',\n\tnum: '\\u0023',\n\tnumero: '\\u2116',\n\tnumsp: '\\u2007',\n\tnvap: '\\u224D\\u20D2',\n\tnVDash: '\\u22AF',\n\tnVdash: '\\u22AE',\n\tnvDash: '\\u22AD',\n\tnvdash: '\\u22AC',\n\tnvge: '\\u2265\\u20D2',\n\tnvgt: '\\u003E\\u20D2',\n\tnvHarr: '\\u2904',\n\tnvinfin: '\\u29DE',\n\tnvlArr: '\\u2902',\n\tnvle: '\\u2264\\u20D2',\n\tnvlt: '\\u003C\\u20D2',\n\tnvltrie: '\\u22B4\\u20D2',\n\tnvrArr: '\\u2903',\n\tnvrtrie: '\\u22B5\\u20D2',\n\tnvsim: '\\u223C\\u20D2',\n\tnwarhk: '\\u2923',\n\tnwArr: '\\u21D6',\n\tnwarr: '\\u2196',\n\tnwarrow: '\\u2196',\n\tnwnear: '\\u2927',\n\tOacute: '\\u00D3',\n\toacute: '\\u00F3',\n\toast: '\\u229B',\n\tocir: '\\u229A',\n\tOcirc: '\\u00D4',\n\tocirc: '\\u00F4',\n\tOcy: '\\u041E',\n\tocy: '\\u043E',\n\todash: '\\u229D',\n\tOdblac: '\\u0150',\n\todblac: '\\u0151',\n\todiv: '\\u2A38',\n\todot: '\\u2299',\n\todsold: '\\u29BC',\n\tOElig: '\\u0152',\n\toelig: '\\u0153',\n\tofcir: '\\u29BF',\n\tOfr: '\\uD835\\uDD12',\n\tofr: '\\uD835\\uDD2C',\n\togon: '\\u02DB',\n\tOgrave: '\\u00D2',\n\tograve: '\\u00F2',\n\togt: '\\u29C1',\n\tohbar: '\\u29B5',\n\tohm: '\\u03A9',\n\toint: '\\u222E',\n\tolarr: '\\u21BA',\n\tolcir: '\\u29BE',\n\tolcross: '\\u29BB',\n\toline: '\\u203E',\n\tolt: '\\u29C0',\n\tOmacr: '\\u014C',\n\tomacr: '\\u014D',\n\tOmega: '\\u03A9',\n\tomega: '\\u03C9',\n\tOmicron: '\\u039F',\n\tomicron: '\\u03BF',\n\tomid: '\\u29B6',\n\tominus: '\\u2296',\n\tOopf: '\\uD835\\uDD46',\n\toopf: '\\uD835\\uDD60',\n\topar: '\\u29B7',\n\tOpenCurlyDoubleQuote: '\\u201C',\n\tOpenCurlyQuote: '\\u2018',\n\toperp: '\\u29B9',\n\toplus: '\\u2295',\n\tOr: '\\u2A54',\n\tor: '\\u2228',\n\torarr: '\\u21BB',\n\tord: '\\u2A5D',\n\torder: '\\u2134',\n\torderof: '\\u2134',\n\tordf: '\\u00AA',\n\tordm: '\\u00BA',\n\torigof: '\\u22B6',\n\toror: '\\u2A56',\n\torslope: '\\u2A57',\n\torv: '\\u2A5B',\n\toS: '\\u24C8',\n\tOscr: '\\uD835\\uDCAA',\n\toscr: '\\u2134',\n\tOslash: '\\u00D8',\n\toslash: '\\u00F8',\n\tosol: '\\u2298',\n\tOtilde: '\\u00D5',\n\totilde: '\\u00F5',\n\tOtimes: '\\u2A37',\n\totimes: '\\u2297',\n\totimesas: '\\u2A36',\n\tOuml: '\\u00D6',\n\touml: '\\u00F6',\n\tovbar: '\\u233D',\n\tOverBar: '\\u203E',\n\tOverBrace: '\\u23DE',\n\tOverBracket: '\\u23B4',\n\tOverParenthesis: '\\u23DC',\n\tpar: '\\u2225',\n\tpara: '\\u00B6',\n\tparallel: '\\u2225',\n\tparsim: '\\u2AF3',\n\tparsl: '\\u2AFD',\n\tpart: '\\u2202',\n\tPartialD: '\\u2202',\n\tPcy: '\\u041F',\n\tpcy: '\\u043F',\n\tpercnt: '\\u0025',\n\tperiod: '\\u002E',\n\tpermil: '\\u2030',\n\tperp: '\\u22A5',\n\tpertenk: '\\u2031',\n\tPfr: '\\uD835\\uDD13',\n\tpfr: '\\uD835\\uDD2D',\n\tPhi: '\\u03A6',\n\tphi: '\\u03C6',\n\tphiv: '\\u03D5',\n\tphmmat: '\\u2133',\n\tphone: '\\u260E',\n\tPi: '\\u03A0',\n\tpi: '\\u03C0',\n\tpitchfork: '\\u22D4',\n\tpiv: '\\u03D6',\n\tplanck: '\\u210F',\n\tplanckh: '\\u210E',\n\tplankv: '\\u210F',\n\tplus: '\\u002B',\n\tplusacir: '\\u2A23',\n\tplusb: '\\u229E',\n\tpluscir: '\\u2A22',\n\tplusdo: '\\u2214',\n\tplusdu: '\\u2A25',\n\tpluse: '\\u2A72',\n\tPlusMinus: '\\u00B1',\n\tplusmn: '\\u00B1',\n\tplussim: '\\u2A26',\n\tplustwo: '\\u2A27',\n\tpm: '\\u00B1',\n\tPoincareplane: '\\u210C',\n\tpointint: '\\u2A15',\n\tPopf: '\\u2119',\n\tpopf: '\\uD835\\uDD61',\n\tpound: '\\u00A3',\n\tPr: '\\u2ABB',\n\tpr: '\\u227A',\n\tprap: '\\u2AB7',\n\tprcue: '\\u227C',\n\tprE: '\\u2AB3',\n\tpre: '\\u2AAF',\n\tprec: '\\u227A',\n\tprecapprox: '\\u2AB7',\n\tpreccurlyeq: '\\u227C',\n\tPrecedes: '\\u227A',\n\tPrecedesEqual: '\\u2AAF',\n\tPrecedesSlantEqual: '\\u227C',\n\tPrecedesTilde: '\\u227E',\n\tpreceq: '\\u2AAF',\n\tprecnapprox: '\\u2AB9',\n\tprecneqq: '\\u2AB5',\n\tprecnsim: '\\u22E8',\n\tprecsim: '\\u227E',\n\tPrime: '\\u2033',\n\tprime: '\\u2032',\n\tprimes: '\\u2119',\n\tprnap: '\\u2AB9',\n\tprnE: '\\u2AB5',\n\tprnsim: '\\u22E8',\n\tprod: '\\u220F',\n\tProduct: '\\u220F',\n\tprofalar: '\\u232E',\n\tprofline: '\\u2312',\n\tprofsurf: '\\u2313',\n\tprop: '\\u221D',\n\tProportion: '\\u2237',\n\tProportional: '\\u221D',\n\tpropto: '\\u221D',\n\tprsim: '\\u227E',\n\tprurel: '\\u22B0',\n\tPscr: '\\uD835\\uDCAB',\n\tpscr: '\\uD835\\uDCC5',\n\tPsi: '\\u03A8',\n\tpsi: '\\u03C8',\n\tpuncsp: '\\u2008',\n\tQfr: '\\uD835\\uDD14',\n\tqfr: '\\uD835\\uDD2E',\n\tqint: '\\u2A0C',\n\tQopf: '\\u211A',\n\tqopf: '\\uD835\\uDD62',\n\tqprime: '\\u2057',\n\tQscr: '\\uD835\\uDCAC',\n\tqscr: '\\uD835\\uDCC6',\n\tquaternions: '\\u210D',\n\tquatint: '\\u2A16',\n\tquest: '\\u003F',\n\tquesteq: '\\u225F',\n\tQUOT: '\\u0022',\n\tquot: '\\u0022',\n\trAarr: '\\u21DB',\n\trace: '\\u223D\\u0331',\n\tRacute: '\\u0154',\n\tracute: '\\u0155',\n\tradic: '\\u221A',\n\traemptyv: '\\u29B3',\n\tRang: '\\u27EB',\n\trang: '\\u27E9',\n\trangd: '\\u2992',\n\trange: '\\u29A5',\n\trangle: '\\u27E9',\n\traquo: '\\u00BB',\n\tRarr: '\\u21A0',\n\trArr: '\\u21D2',\n\trarr: '\\u2192',\n\trarrap: '\\u2975',\n\trarrb: '\\u21E5',\n\trarrbfs: '\\u2920',\n\trarrc: '\\u2933',\n\trarrfs: '\\u291E',\n\trarrhk: '\\u21AA',\n\trarrlp: '\\u21AC',\n\trarrpl: '\\u2945',\n\trarrsim: '\\u2974',\n\tRarrtl: '\\u2916',\n\trarrtl: '\\u21A3',\n\trarrw: '\\u219D',\n\trAtail: '\\u291C',\n\tratail: '\\u291A',\n\tratio: '\\u2236',\n\trationals: '\\u211A',\n\tRBarr: '\\u2910',\n\trBarr: '\\u290F',\n\trbarr: '\\u290D',\n\trbbrk: '\\u2773',\n\trbrace: '\\u007D',\n\trbrack: '\\u005D',\n\trbrke: '\\u298C',\n\trbrksld: '\\u298E',\n\trbrkslu: '\\u2990',\n\tRcaron: '\\u0158',\n\trcaron: '\\u0159',\n\tRcedil: '\\u0156',\n\trcedil: '\\u0157',\n\trceil: '\\u2309',\n\trcub: '\\u007D',\n\tRcy: '\\u0420',\n\trcy: '\\u0440',\n\trdca: '\\u2937',\n\trdldhar: '\\u2969',\n\trdquo: '\\u201D',\n\trdquor: '\\u201D',\n\trdsh: '\\u21B3',\n\tRe: '\\u211C',\n\treal: '\\u211C',\n\trealine: '\\u211B',\n\trealpart: '\\u211C',\n\treals: '\\u211D',\n\trect: '\\u25AD',\n\tREG: '\\u00AE',\n\treg: '\\u00AE',\n\tReverseElement: '\\u220B',\n\tReverseEquilibrium: '\\u21CB',\n\tReverseUpEquilibrium: '\\u296F',\n\trfisht: '\\u297D',\n\trfloor: '\\u230B',\n\tRfr: '\\u211C',\n\trfr: '\\uD835\\uDD2F',\n\trHar: '\\u2964',\n\trhard: '\\u21C1',\n\trharu: '\\u21C0',\n\trharul: '\\u296C',\n\tRho: '\\u03A1',\n\trho: '\\u03C1',\n\trhov: '\\u03F1',\n\tRightAngleBracket: '\\u27E9',\n\tRightArrow: '\\u2192',\n\tRightarrow: '\\u21D2',\n\trightarrow: '\\u2192',\n\tRightArrowBar: '\\u21E5',\n\tRightArrowLeftArrow: '\\u21C4',\n\trightarrowtail: '\\u21A3',\n\tRightCeiling: '\\u2309',\n\tRightDoubleBracket: '\\u27E7',\n\tRightDownTeeVector: '\\u295D',\n\tRightDownVector: '\\u21C2',\n\tRightDownVectorBar: '\\u2955',\n\tRightFloor: '\\u230B',\n\trightharpoondown: '\\u21C1',\n\trightharpoonup: '\\u21C0',\n\trightleftarrows: '\\u21C4',\n\trightleftharpoons: '\\u21CC',\n\trightrightarrows: '\\u21C9',\n\trightsquigarrow: '\\u219D',\n\tRightTee: '\\u22A2',\n\tRightTeeArrow: '\\u21A6',\n\tRightTeeVector: '\\u295B',\n\trightthreetimes: '\\u22CC',\n\tRightTriangle: '\\u22B3',\n\tRightTriangleBar: '\\u29D0',\n\tRightTriangleEqual: '\\u22B5',\n\tRightUpDownVector: '\\u294F',\n\tRightUpTeeVector: '\\u295C',\n\tRightUpVector: '\\u21BE',\n\tRightUpVectorBar: '\\u2954',\n\tRightVector: '\\u21C0',\n\tRightVectorBar: '\\u2953',\n\tring: '\\u02DA',\n\trisingdotseq: '\\u2253',\n\trlarr: '\\u21C4',\n\trlhar: '\\u21CC',\n\trlm: '\\u200F',\n\trmoust: '\\u23B1',\n\trmoustache: '\\u23B1',\n\trnmid: '\\u2AEE',\n\troang: '\\u27ED',\n\troarr: '\\u21FE',\n\trobrk: '\\u27E7',\n\tropar: '\\u2986',\n\tRopf: '\\u211D',\n\tropf: '\\uD835\\uDD63',\n\troplus: '\\u2A2E',\n\trotimes: '\\u2A35',\n\tRoundImplies: '\\u2970',\n\trpar: '\\u0029',\n\trpargt: '\\u2994',\n\trppolint: '\\u2A12',\n\trrarr: '\\u21C9',\n\tRrightarrow: '\\u21DB',\n\trsaquo: '\\u203A',\n\tRscr: '\\u211B',\n\trscr: '\\uD835\\uDCC7',\n\tRsh: '\\u21B1',\n\trsh: '\\u21B1',\n\trsqb: '\\u005D',\n\trsquo: '\\u2019',\n\trsquor: '\\u2019',\n\trthree: '\\u22CC',\n\trtimes: '\\u22CA',\n\trtri: '\\u25B9',\n\trtrie: '\\u22B5',\n\trtrif: '\\u25B8',\n\trtriltri: '\\u29CE',\n\tRuleDelayed: '\\u29F4',\n\truluhar: '\\u2968',\n\trx: '\\u211E',\n\tSacute: '\\u015A',\n\tsacute: '\\u015B',\n\tsbquo: '\\u201A',\n\tSc: '\\u2ABC',\n\tsc: '\\u227B',\n\tscap: '\\u2AB8',\n\tScaron: '\\u0160',\n\tscaron: '\\u0161',\n\tsccue: '\\u227D',\n\tscE: '\\u2AB4',\n\tsce: '\\u2AB0',\n\tScedil: '\\u015E',\n\tscedil: '\\u015F',\n\tScirc: '\\u015C',\n\tscirc: '\\u015D',\n\tscnap: '\\u2ABA',\n\tscnE: '\\u2AB6',\n\tscnsim: '\\u22E9',\n\tscpolint: '\\u2A13',\n\tscsim: '\\u227F',\n\tScy: '\\u0421',\n\tscy: '\\u0441',\n\tsdot: '\\u22C5',\n\tsdotb: '\\u22A1',\n\tsdote: '\\u2A66',\n\tsearhk: '\\u2925',\n\tseArr: '\\u21D8',\n\tsearr: '\\u2198',\n\tsearrow: '\\u2198',\n\tsect: '\\u00A7',\n\tsemi: '\\u003B',\n\tseswar: '\\u2929',\n\tsetminus: '\\u2216',\n\tsetmn: '\\u2216',\n\tsext: '\\u2736',\n\tSfr: '\\uD835\\uDD16',\n\tsfr: '\\uD835\\uDD30',\n\tsfrown: '\\u2322',\n\tsharp: '\\u266F',\n\tSHCHcy: '\\u0429',\n\tshchcy: '\\u0449',\n\tSHcy: '\\u0428',\n\tshcy: '\\u0448',\n\tShortDownArrow: '\\u2193',\n\tShortLeftArrow: '\\u2190',\n\tshortmid: '\\u2223',\n\tshortparallel: '\\u2225',\n\tShortRightArrow: '\\u2192',\n\tShortUpArrow: '\\u2191',\n\tshy: '\\u00AD',\n\tSigma: '\\u03A3',\n\tsigma: '\\u03C3',\n\tsigmaf: '\\u03C2',\n\tsigmav: '\\u03C2',\n\tsim: '\\u223C',\n\tsimdot: '\\u2A6A',\n\tsime: '\\u2243',\n\tsimeq: '\\u2243',\n\tsimg: '\\u2A9E',\n\tsimgE: '\\u2AA0',\n\tsiml: '\\u2A9D',\n\tsimlE: '\\u2A9F',\n\tsimne: '\\u2246',\n\tsimplus: '\\u2A24',\n\tsimrarr: '\\u2972',\n\tslarr: '\\u2190',\n\tSmallCircle: '\\u2218',\n\tsmallsetminus: '\\u2216',\n\tsmashp: '\\u2A33',\n\tsmeparsl: '\\u29E4',\n\tsmid: '\\u2223',\n\tsmile: '\\u2323',\n\tsmt: '\\u2AAA',\n\tsmte: '\\u2AAC',\n\tsmtes: '\\u2AAC\\uFE00',\n\tSOFTcy: '\\u042C',\n\tsoftcy: '\\u044C',\n\tsol: '\\u002F',\n\tsolb: '\\u29C4',\n\tsolbar: '\\u233F',\n\tSopf: '\\uD835\\uDD4A',\n\tsopf: '\\uD835\\uDD64',\n\tspades: '\\u2660',\n\tspadesuit: '\\u2660',\n\tspar: '\\u2225',\n\tsqcap: '\\u2293',\n\tsqcaps: '\\u2293\\uFE00',\n\tsqcup: '\\u2294',\n\tsqcups: '\\u2294\\uFE00',\n\tSqrt: '\\u221A',\n\tsqsub: '\\u228F',\n\tsqsube: '\\u2291',\n\tsqsubset: '\\u228F',\n\tsqsubseteq: '\\u2291',\n\tsqsup: '\\u2290',\n\tsqsupe: '\\u2292',\n\tsqsupset: '\\u2290',\n\tsqsupseteq: '\\u2292',\n\tsqu: '\\u25A1',\n\tSquare: '\\u25A1',\n\tsquare: '\\u25A1',\n\tSquareIntersection: '\\u2293',\n\tSquareSubset: '\\u228F',\n\tSquareSubsetEqual: '\\u2291',\n\tSquareSuperset: '\\u2290',\n\tSquareSupersetEqual: '\\u2292',\n\tSquareUnion: '\\u2294',\n\tsquarf: '\\u25AA',\n\tsquf: '\\u25AA',\n\tsrarr: '\\u2192',\n\tSscr: '\\uD835\\uDCAE',\n\tsscr: '\\uD835\\uDCC8',\n\tssetmn: '\\u2216',\n\tssmile: '\\u2323',\n\tsstarf: '\\u22C6',\n\tStar: '\\u22C6',\n\tstar: '\\u2606',\n\tstarf: '\\u2605',\n\tstraightepsilon: '\\u03F5',\n\tstraightphi: '\\u03D5',\n\tstrns: '\\u00AF',\n\tSub: '\\u22D0',\n\tsub: '\\u2282',\n\tsubdot: '\\u2ABD',\n\tsubE: '\\u2AC5',\n\tsube: '\\u2286',\n\tsubedot: '\\u2AC3',\n\tsubmult: '\\u2AC1',\n\tsubnE: '\\u2ACB',\n\tsubne: '\\u228A',\n\tsubplus: '\\u2ABF',\n\tsubrarr: '\\u2979',\n\tSubset: '\\u22D0',\n\tsubset: '\\u2282',\n\tsubseteq: '\\u2286',\n\tsubseteqq: '\\u2AC5',\n\tSubsetEqual: '\\u2286',\n\tsubsetneq: '\\u228A',\n\tsubsetneqq: '\\u2ACB',\n\tsubsim: '\\u2AC7',\n\tsubsub: '\\u2AD5',\n\tsubsup: '\\u2AD3',\n\tsucc: '\\u227B',\n\tsuccapprox: '\\u2AB8',\n\tsucccurlyeq: '\\u227D',\n\tSucceeds: '\\u227B',\n\tSucceedsEqual: '\\u2AB0',\n\tSucceedsSlantEqual: '\\u227D',\n\tSucceedsTilde: '\\u227F',\n\tsucceq: '\\u2AB0',\n\tsuccnapprox: '\\u2ABA',\n\tsuccneqq: '\\u2AB6',\n\tsuccnsim: '\\u22E9',\n\tsuccsim: '\\u227F',\n\tSuchThat: '\\u220B',\n\tSum: '\\u2211',\n\tsum: '\\u2211',\n\tsung: '\\u266A',\n\tSup: '\\u22D1',\n\tsup: '\\u2283',\n\tsup1: '\\u00B9',\n\tsup2: '\\u00B2',\n\tsup3: '\\u00B3',\n\tsupdot: '\\u2ABE',\n\tsupdsub: '\\u2AD8',\n\tsupE: '\\u2AC6',\n\tsupe: '\\u2287',\n\tsupedot: '\\u2AC4',\n\tSuperset: '\\u2283',\n\tSupersetEqual: '\\u2287',\n\tsuphsol: '\\u27C9',\n\tsuphsub: '\\u2AD7',\n\tsuplarr: '\\u297B',\n\tsupmult: '\\u2AC2',\n\tsupnE: '\\u2ACC',\n\tsupne: '\\u228B',\n\tsupplus: '\\u2AC0',\n\tSupset: '\\u22D1',\n\tsupset: '\\u2283',\n\tsupseteq: '\\u2287',\n\tsupseteqq: '\\u2AC6',\n\tsupsetneq: '\\u228B',\n\tsupsetneqq: '\\u2ACC',\n\tsupsim: '\\u2AC8',\n\tsupsub: '\\u2AD4',\n\tsupsup: '\\u2AD6',\n\tswarhk: '\\u2926',\n\tswArr: '\\u21D9',\n\tswarr: '\\u2199',\n\tswarrow: '\\u2199',\n\tswnwar: '\\u292A',\n\tszlig: '\\u00DF',\n\tTab: '\\u0009',\n\ttarget: '\\u2316',\n\tTau: '\\u03A4',\n\ttau: '\\u03C4',\n\ttbrk: '\\u23B4',\n\tTcaron: '\\u0164',\n\ttcaron: '\\u0165',\n\tTcedil: '\\u0162',\n\ttcedil: '\\u0163',\n\tTcy: '\\u0422',\n\ttcy: '\\u0442',\n\ttdot: '\\u20DB',\n\ttelrec: '\\u2315',\n\tTfr: '\\uD835\\uDD17',\n\ttfr: '\\uD835\\uDD31',\n\tthere4: '\\u2234',\n\tTherefore: '\\u2234',\n\ttherefore: '\\u2234',\n\tTheta: '\\u0398',\n\ttheta: '\\u03B8',\n\tthetasym: '\\u03D1',\n\tthetav: '\\u03D1',\n\tthickapprox: '\\u2248',\n\tthicksim: '\\u223C',\n\tThickSpace: '\\u205F\\u200A',\n\tthinsp: '\\u2009',\n\tThinSpace: '\\u2009',\n\tthkap: '\\u2248',\n\tthksim: '\\u223C',\n\tTHORN: '\\u00DE',\n\tthorn: '\\u00FE',\n\tTilde: '\\u223C',\n\ttilde: '\\u02DC',\n\tTildeEqual: '\\u2243',\n\tTildeFullEqual: '\\u2245',\n\tTildeTilde: '\\u2248',\n\ttimes: '\\u00D7',\n\ttimesb: '\\u22A0',\n\ttimesbar: '\\u2A31',\n\ttimesd: '\\u2A30',\n\ttint: '\\u222D',\n\ttoea: '\\u2928',\n\ttop: '\\u22A4',\n\ttopbot: '\\u2336',\n\ttopcir: '\\u2AF1',\n\tTopf: '\\uD835\\uDD4B',\n\ttopf: '\\uD835\\uDD65',\n\ttopfork: '\\u2ADA',\n\ttosa: '\\u2929',\n\ttprime: '\\u2034',\n\tTRADE: '\\u2122',\n\ttrade: '\\u2122',\n\ttriangle: '\\u25B5',\n\ttriangledown: '\\u25BF',\n\ttriangleleft: '\\u25C3',\n\ttrianglelefteq: '\\u22B4',\n\ttriangleq: '\\u225C',\n\ttriangleright: '\\u25B9',\n\ttrianglerighteq: '\\u22B5',\n\ttridot: '\\u25EC',\n\ttrie: '\\u225C',\n\ttriminus: '\\u2A3A',\n\tTripleDot: '\\u20DB',\n\ttriplus: '\\u2A39',\n\ttrisb: '\\u29CD',\n\ttritime: '\\u2A3B',\n\ttrpezium: '\\u23E2',\n\tTscr: '\\uD835\\uDCAF',\n\ttscr: '\\uD835\\uDCC9',\n\tTScy: '\\u0426',\n\ttscy: '\\u0446',\n\tTSHcy: '\\u040B',\n\ttshcy: '\\u045B',\n\tTstrok: '\\u0166',\n\ttstrok: '\\u0167',\n\ttwixt: '\\u226C',\n\ttwoheadleftarrow: '\\u219E',\n\ttwoheadrightarrow: '\\u21A0',\n\tUacute: '\\u00DA',\n\tuacute: '\\u00FA',\n\tUarr: '\\u219F',\n\tuArr: '\\u21D1',\n\tuarr: '\\u2191',\n\tUarrocir: '\\u2949',\n\tUbrcy: '\\u040E',\n\tubrcy: '\\u045E',\n\tUbreve: '\\u016C',\n\tubreve: '\\u016D',\n\tUcirc: '\\u00DB',\n\tucirc: '\\u00FB',\n\tUcy: '\\u0423',\n\tucy: '\\u0443',\n\tudarr: '\\u21C5',\n\tUdblac: '\\u0170',\n\tudblac: '\\u0171',\n\tudhar: '\\u296E',\n\tufisht: '\\u297E',\n\tUfr: '\\uD835\\uDD18',\n\tufr: '\\uD835\\uDD32',\n\tUgrave: '\\u00D9',\n\tugrave: '\\u00F9',\n\tuHar: '\\u2963',\n\tuharl: '\\u21BF',\n\tuharr: '\\u21BE',\n\tuhblk: '\\u2580',\n\tulcorn: '\\u231C',\n\tulcorner: '\\u231C',\n\tulcrop: '\\u230F',\n\tultri: '\\u25F8',\n\tUmacr: '\\u016A',\n\tumacr: '\\u016B',\n\tuml: '\\u00A8',\n\tUnderBar: '\\u005F',\n\tUnderBrace: '\\u23DF',\n\tUnderBracket: '\\u23B5',\n\tUnderParenthesis: '\\u23DD',\n\tUnion: '\\u22C3',\n\tUnionPlus: '\\u228E',\n\tUogon: '\\u0172',\n\tuogon: '\\u0173',\n\tUopf: '\\uD835\\uDD4C',\n\tuopf: '\\uD835\\uDD66',\n\tUpArrow: '\\u2191',\n\tUparrow: '\\u21D1',\n\tuparrow: '\\u2191',\n\tUpArrowBar: '\\u2912',\n\tUpArrowDownArrow: '\\u21C5',\n\tUpDownArrow: '\\u2195',\n\tUpdownarrow: '\\u21D5',\n\tupdownarrow: '\\u2195',\n\tUpEquilibrium: '\\u296E',\n\tupharpoonleft: '\\u21BF',\n\tupharpoonright: '\\u21BE',\n\tuplus: '\\u228E',\n\tUpperLeftArrow: '\\u2196',\n\tUpperRightArrow: '\\u2197',\n\tUpsi: '\\u03D2',\n\tupsi: '\\u03C5',\n\tupsih: '\\u03D2',\n\tUpsilon: '\\u03A5',\n\tupsilon: '\\u03C5',\n\tUpTee: '\\u22A5',\n\tUpTeeArrow: '\\u21A5',\n\tupuparrows: '\\u21C8',\n\turcorn: '\\u231D',\n\turcorner: '\\u231D',\n\turcrop: '\\u230E',\n\tUring: '\\u016E',\n\turing: '\\u016F',\n\turtri: '\\u25F9',\n\tUscr: '\\uD835\\uDCB0',\n\tuscr: '\\uD835\\uDCCA',\n\tutdot: '\\u22F0',\n\tUtilde: '\\u0168',\n\tutilde: '\\u0169',\n\tutri: '\\u25B5',\n\tutrif: '\\u25B4',\n\tuuarr: '\\u21C8',\n\tUuml: '\\u00DC',\n\tuuml: '\\u00FC',\n\tuwangle: '\\u29A7',\n\tvangrt: '\\u299C',\n\tvarepsilon: '\\u03F5',\n\tvarkappa: '\\u03F0',\n\tvarnothing: '\\u2205',\n\tvarphi: '\\u03D5',\n\tvarpi: '\\u03D6',\n\tvarpropto: '\\u221D',\n\tvArr: '\\u21D5',\n\tvarr: '\\u2195',\n\tvarrho: '\\u03F1',\n\tvarsigma: '\\u03C2',\n\tvarsubsetneq: '\\u228A\\uFE00',\n\tvarsubsetneqq: '\\u2ACB\\uFE00',\n\tvarsupsetneq: '\\u228B\\uFE00',\n\tvarsupsetneqq: '\\u2ACC\\uFE00',\n\tvartheta: '\\u03D1',\n\tvartriangleleft: '\\u22B2',\n\tvartriangleright: '\\u22B3',\n\tVbar: '\\u2AEB',\n\tvBar: '\\u2AE8',\n\tvBarv: '\\u2AE9',\n\tVcy: '\\u0412',\n\tvcy: '\\u0432',\n\tVDash: '\\u22AB',\n\tVdash: '\\u22A9',\n\tvDash: '\\u22A8',\n\tvdash: '\\u22A2',\n\tVdashl: '\\u2AE6',\n\tVee: '\\u22C1',\n\tvee: '\\u2228',\n\tveebar: '\\u22BB',\n\tveeeq: '\\u225A',\n\tvellip: '\\u22EE',\n\tVerbar: '\\u2016',\n\tverbar: '\\u007C',\n\tVert: '\\u2016',\n\tvert: '\\u007C',\n\tVerticalBar: '\\u2223',\n\tVerticalLine: '\\u007C',\n\tVerticalSeparator: '\\u2758',\n\tVerticalTilde: '\\u2240',\n\tVeryThinSpace: '\\u200A',\n\tVfr: '\\uD835\\uDD19',\n\tvfr: '\\uD835\\uDD33',\n\tvltri: '\\u22B2',\n\tvnsub: '\\u2282\\u20D2',\n\tvnsup: '\\u2283\\u20D2',\n\tVopf: '\\uD835\\uDD4D',\n\tvopf: '\\uD835\\uDD67',\n\tvprop: '\\u221D',\n\tvrtri: '\\u22B3',\n\tVscr: '\\uD835\\uDCB1',\n\tvscr: '\\uD835\\uDCCB',\n\tvsubnE: '\\u2ACB\\uFE00',\n\tvsubne: '\\u228A\\uFE00',\n\tvsupnE: '\\u2ACC\\uFE00',\n\tvsupne: '\\u228B\\uFE00',\n\tVvdash: '\\u22AA',\n\tvzigzag: '\\u299A',\n\tWcirc: '\\u0174',\n\twcirc: '\\u0175',\n\twedbar: '\\u2A5F',\n\tWedge: '\\u22C0',\n\twedge: '\\u2227',\n\twedgeq: '\\u2259',\n\tweierp: '\\u2118',\n\tWfr: '\\uD835\\uDD1A',\n\twfr: '\\uD835\\uDD34',\n\tWopf: '\\uD835\\uDD4E',\n\twopf: '\\uD835\\uDD68',\n\twp: '\\u2118',\n\twr: '\\u2240',\n\twreath: '\\u2240',\n\tWscr: '\\uD835\\uDCB2',\n\twscr: '\\uD835\\uDCCC',\n\txcap: '\\u22C2',\n\txcirc: '\\u25EF',\n\txcup: '\\u22C3',\n\txdtri: '\\u25BD',\n\tXfr: '\\uD835\\uDD1B',\n\txfr: '\\uD835\\uDD35',\n\txhArr: '\\u27FA',\n\txharr: '\\u27F7',\n\tXi: '\\u039E',\n\txi: '\\u03BE',\n\txlArr: '\\u27F8',\n\txlarr: '\\u27F5',\n\txmap: '\\u27FC',\n\txnis: '\\u22FB',\n\txodot: '\\u2A00',\n\tXopf: '\\uD835\\uDD4F',\n\txopf: '\\uD835\\uDD69',\n\txoplus: '\\u2A01',\n\txotime: '\\u2A02',\n\txrArr: '\\u27F9',\n\txrarr: '\\u27F6',\n\tXscr: '\\uD835\\uDCB3',\n\txscr: '\\uD835\\uDCCD',\n\txsqcup: '\\u2A06',\n\txuplus: '\\u2A04',\n\txutri: '\\u25B3',\n\txvee: '\\u22C1',\n\txwedge: '\\u22C0',\n\tYacute: '\\u00DD',\n\tyacute: '\\u00FD',\n\tYAcy: '\\u042F',\n\tyacy: '\\u044F',\n\tYcirc: '\\u0176',\n\tycirc: '\\u0177',\n\tYcy: '\\u042B',\n\tycy: '\\u044B',\n\tyen: '\\u00A5',\n\tYfr: '\\uD835\\uDD1C',\n\tyfr: '\\uD835\\uDD36',\n\tYIcy: '\\u0407',\n\tyicy: '\\u0457',\n\tYopf: '\\uD835\\uDD50',\n\tyopf: '\\uD835\\uDD6A',\n\tYscr: '\\uD835\\uDCB4',\n\tyscr: '\\uD835\\uDCCE',\n\tYUcy: '\\u042E',\n\tyucy: '\\u044E',\n\tYuml: '\\u0178',\n\tyuml: '\\u00FF',\n\tZacute: '\\u0179',\n\tzacute: '\\u017A',\n\tZcaron: '\\u017D',\n\tzcaron: '\\u017E',\n\tZcy: '\\u0417',\n\tzcy: '\\u0437',\n\tZdot: '\\u017B',\n\tzdot: '\\u017C',\n\tzeetrf: '\\u2128',\n\tZeroWidthSpace: '\\u200B',\n\tZeta: '\\u0396',\n\tzeta: '\\u03B6',\n\tZfr: '\\u2128',\n\tzfr: '\\uD835\\uDD37',\n\tZHcy: '\\u0416',\n\tzhcy: '\\u0436',\n\tzigrarr: '\\u21DD',\n\tZopf: '\\u2124',\n\tzopf: '\\uD835\\uDD6B',\n\tZscr: '\\uD835\\uDCB5',\n\tzscr: '\\uD835\\uDCCF',\n\tzwj: '\\u200D',\n\tzwnj: '\\u200C',\n});\n\n/**\n * @deprecated use `HTML_ENTITIES` instead\n * @see HTML_ENTITIES\n */\nexports.entityMap = exports.HTML_ENTITIES;\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\t\tbreak;\n\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\tel.closed = true;\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// https://www.w3.org/TR/xml11/#NT-Comment\n// `[15] Comment ::= ''`\nvar Comment = reg(COMMENT_START, regg(chars_without(Char, '-'), '|', reg('-', chars_without(Char, '-'))), '*', COMMENT_END);\n\nvar PCDATA = '#PCDATA';\n// https://www.w3.org/TR/xml11/#NT-Mixed\n// `[51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')'`\n// https://www.w3.org/TR/xml-names/#NT-Mixed\n// `[51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? QName)* S? ')*' | '(' S? '#PCDATA' S? ')'`\n// [VC: Proper Group/PE Nesting] [VC: No Duplicate Types]\nvar Mixed = regg(\n\treg(/\\(/, S_OPT, PCDATA, regg(S_OPT, /\\|/, S_OPT, QName), '*', S_OPT, /\\)\\*/),\n\t'|',\n\treg(/\\(/, S_OPT, PCDATA, S_OPT, /\\)/)\n);\n\nvar _children_quantity = /[?*+]?/;\n/*\n `[49] choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')'` [VC: Proper Group/PE Nesting]\n `[50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'` [VC: Proper Group/PE Nesting]\n simplification to solve circular referencing, but doesn't check validity constraint \"Proper Group/PE Nesting\"\n var _choice_or_seq = reg('[', NameChar_s, SChar_s, chars(_children_quantity), '()|,]*');\n ```\n [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?\n === (Name | '(' S? cp ( S? '|' S? cp )+ S? ')' | '(' S? cp ( S? ',' S? cp )* S? ')') ('?' | '*' | '+')?\n !== (Name | [_choice_or_seq]*) ('?' | '*' | '+')?\n ```\n simplification to solve circular referencing, but doesn't check validity constraint \"Proper Group/PE Nesting\"\n var cp = reg(regg(Name, '|', _choice_or_seq), _children_quantity);\n*/\n/*\nInefficient regular expression (High)\nThis part of the regular expression may cause exponential backtracking on strings starting with '(|' and containing many repetitions of '|'.\nhttps://github.com/xmldom/xmldom/security/code-scanning/91\nvar choice = regg(/\\(/, S_OPT, cp, regg(S_OPT, /\\|/, S_OPT, cp), '+', S_OPT, /\\)/);\n*/\n/*\nInefficient regular expression (High)\nThis part of the regular expression may cause exponential backtracking on strings starting with '(,' and containing many repetitions of ','.\nhttps://github.com/xmldom/xmldom/security/code-scanning/92\nvar seq = regg(/\\(/, S_OPT, cp, regg(S_OPT, /,/, S_OPT, cp), '*', S_OPT, /\\)/);\n*/\n\n// `[47] children ::= (choice | seq) ('?' | '*' | '+')?`\n// simplification to solve circular referencing, but doesn't check validity constraint \"Proper Group/PE Nesting\"\nvar children = reg(/\\([^>]+\\)/, _children_quantity /*regg(choice, '|', seq), _children_quantity*/);\n\n// https://www.w3.org/TR/xml11/#NT-contentspec\n// `[46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children`\nvar contentspec = regg('EMPTY', '|', 'ANY', '|', Mixed, '|', children);\n\nvar ELEMENTDECL_START = ''`\n// https://www.w3.org/TR/xml-names/#NT-elementdecl\n// `[17] elementdecl ::= ''`\n// because of https://www.w3.org/TR/xml11/#NT-PEReference\n// since xmldom is not supporting replacements of PEReferences in the DTD\n// this also supports PEReference in the possible places\nvar elementdecl = reg(ELEMENTDECL_START, S, regg(QName, '|', PEReference), S, regg(contentspec, '|', PEReference), S_OPT, '>');\n\n// https://www.w3.org/TR/xml11/#NT-NotationType\n// `[58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'`\n// [VC: Notation Attributes] [VC: One Notation Per Element Type] [VC: No Notation on Empty Element] [VC: No Duplicate Tokens]\nvar NotationType = reg('NOTATION', S, /\\(/, S_OPT, Name, regg(S_OPT, /\\|/, S_OPT, Name), '*', S_OPT, /\\)/);\n// https://www.w3.org/TR/xml11/#NT-Enumeration\n// `[59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'`\n// [VC: Enumeration] [VC: No Duplicate Tokens]\nvar Enumeration = reg(/\\(/, S_OPT, Nmtoken, regg(S_OPT, /\\|/, S_OPT, Nmtoken), '*', S_OPT, /\\)/);\n\n// https://www.w3.org/TR/xml11/#NT-EnumeratedType\n// `[57] EnumeratedType ::= NotationType | Enumeration`\nvar EnumeratedType = regg(NotationType, '|', Enumeration);\n\n/*\n```\n[55] StringType ::= 'CDATA'\n[56] TokenizedType ::= 'ID' [VC: ID] [VC: One ID per Element Type] [VC: ID Attribute Default]\n | 'IDREF' [VC: IDREF]\n | 'IDREFS' [VC: IDREF]\n\t | 'ENTITY' [VC: Entity Name]\n\t | 'ENTITIES' [VC: Entity Name]\n\t | 'NMTOKEN' [VC: Name Token]\n\t | 'NMTOKENS' [VC: Name Token]\n [54] AttType ::= StringType | TokenizedType | EnumeratedType\n```*/\nvar AttType = regg(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/, '|', EnumeratedType);\n\n// `[60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)`\n// [WFC: No < in Attribute Values] [WFC: No External Entity References]\n// [VC: Fixed Attribute Default] [VC: Required Attribute] [VC: Attribute Default Value Syntactically Correct]\nvar DefaultDecl = regg(/#REQUIRED|#IMPLIED/, '|', regg(regg('#FIXED', S), '?', AttValue));\n\n// https://www.w3.org/TR/xml11/#NT-AttDef\n// [53] AttDef ::= S Name S AttType S DefaultDecl\n// https://www.w3.org/TR/xml-names/#NT-AttDef\n// [1] NSAttName ::= PrefixedAttName | DefaultAttName\n// [2] PrefixedAttName ::= 'xmlns:' NCName [NSC: Reserved Prefixes and Namespace Names]\n// [3] DefaultAttName ::= 'xmlns'\n// [21] AttDef ::= S (QName | NSAttName) S AttType S DefaultDecl\n// \t\t\t\t\t\t === S Name S AttType S DefaultDecl\n// xmldom is not distinguishing between QName and NSAttName on this level\n// to support XML without namespaces in DTD we can not restrict it to QName\nvar AttDef = regg(S, Name, S, AttType, S, DefaultDecl);\n\nvar ATTLIST_DECL_START = ''`\n// https://www.w3.org/TR/xml-names/#NT-AttlistDecl\n// `[20] AttlistDecl ::= ''`\n// to support XML without namespaces in DTD we can not restrict it to QName\nvar AttlistDecl = reg(ATTLIST_DECL_START, S, Name, AttDef, '*', S_OPT, '>');\n\nvar SYSTEM = 'SYSTEM';\nvar PUBLIC = 'PUBLIC';\n// https://www.w3.org/TR/xml11/#NT-ExternalID\n// `[75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral`\nvar ExternalID = regg(regg(SYSTEM, S, SystemLiteral), '|', regg(PUBLIC, S, PubidLiteral, S, SystemLiteral));\nvar ExternalID_match = reg(\n\t'^',\n\tregg(\n\t\tregg(SYSTEM, S, '(?', SystemLiteral, ')'),\n\t\t'|',\n\t\tregg(PUBLIC, S, '(?', PubidLiteral, ')', S, '(?', SystemLiteral, ')')\n\t)\n);\n\n// https://www.w3.org/TR/xml11/#NT-NDataDecl\n// `[76] NDataDecl ::= S 'NDATA' S Name` [VC: Notation Declared]\nvar NDataDecl = regg(S, 'NDATA', S, Name);\n\n// https://www.w3.org/TR/xml11/#NT-EntityDef\n// `[73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)`\nvar EntityDef = regg(EntityValue, '|', regg(ExternalID, NDataDecl, '?'));\n\nvar ENTITY_DECL_START = ''`\nvar GEDecl = reg(ENTITY_DECL_START, S, Name, S, EntityDef, S_OPT, '>');\n// https://www.w3.org/TR/xml11/#NT-PEDef\n// `[74] PEDef ::= EntityValue | ExternalID`\nvar PEDef = regg(EntityValue, '|', ExternalID);\n// https://www.w3.org/TR/xml11/#NT-PEDecl\n// `[72] PEDecl ::= ''`\nvar PEDecl = reg(ENTITY_DECL_START, S, '%', S, Name, S, PEDef, S_OPT, '>');\n// https://www.w3.org/TR/xml11/#NT-EntityDecl\n// `[70] EntityDecl ::= GEDecl | PEDecl`\nvar EntityDecl = regg(GEDecl, '|', PEDecl);\n\n// https://www.w3.org/TR/xml11/#NT-PublicID\n// `[83] PublicID ::= 'PUBLIC' S PubidLiteral`\nvar PublicID = reg(PUBLIC, S, PubidLiteral);\n// https://www.w3.org/TR/xml11/#NT-NotationDecl\n// `[82] NotationDecl ::= ''` [VC: Unique Notation Name]\nvar NotationDecl = reg('');\n\n// https://www.w3.org/TR/xml11/#NT-Eq\n// `[25] Eq ::= S? '=' S?`\nvar Eq = reg(S_OPT, '=', S_OPT);\n// https://www.w3.org/TR/xml/#NT-VersionNum\n// `[26] VersionNum ::= '1.' [0-9]+`\n// https://www.w3.org/TR/xml11/#NT-VersionNum\n// `[26] VersionNum ::= '1.1'`\nvar VersionNum = /1[.]\\d+/;\n// https://www.w3.org/TR/xml11/#NT-VersionInfo\n// `[24] VersionInfo ::= S 'version' Eq (\"'\" VersionNum \"'\" | '\"' VersionNum '\"')`\nvar VersionInfo = reg(S, 'version', Eq, regg(\"'\", VersionNum, \"'\", '|', '\"', VersionNum, '\"'));\n// https://www.w3.org/TR/xml11/#NT-EncName\n// `[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*`\nvar EncName = /[A-Za-z][-A-Za-z0-9._]*/;\n// https://www.w3.org/TR/xml11/#NT-EncDecl\n// `[80] EncodingDecl ::= S 'encoding' Eq ('\"' EncName '\"' | \"'\" EncName \"'\" )`\nvar EncodingDecl = regg(S, 'encoding', Eq, regg('\"', EncName, '\"', '|', \"'\", EncName, \"'\"));\n// https://www.w3.org/TR/xml11/#NT-SDDecl\n// `[32] SDDecl ::= S 'standalone' Eq ((\"'\" ('yes' | 'no') \"'\") | ('\"' ('yes' | 'no') '\"'))`\nvar SDDecl = regg(S, 'standalone', Eq, regg(\"'\", regg('yes', '|', 'no'), \"'\", '|', '\"', regg('yes', '|', 'no'), '\"'));\n// https://www.w3.org/TR/xml11/#NT-XMLDecl\n// [23] XMLDecl ::= ''\nvar XMLDecl = reg(/^<\\?xml/, VersionInfo, EncodingDecl, '?', SDDecl, '?', S_OPT, /\\?>/);\n\n/*\n https://www.w3.org/TR/xml/#NT-markupdecl\n https://www.w3.org/TR/xml11/#NT-markupdecl\n `[29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment`\n var markupdecl = regg(elementdecl, '|', AttlistDecl, '|', EntityDecl, '|', NotationDecl, '|', PI_unsafe, '|', Comment);\n*/\n/*\n https://www.w3.org/TR/xml-names/#NT-doctypedecl\n`[28a] DeclSep ::= PEReference | S`\n https://www.w3.org/TR/xml11/#NT-intSubset\n```\n [28b] intSubset ::= (markupdecl | DeclSep)*\n === (markupdecl | PEReference | S)*\n```\n [WFC: PE Between Declarations]\n var intSubset = reg(regg(markupdecl, '|', PEReference, '|', S), '*');\n*/\nvar DOCTYPE_DECL_START = ''`\n https://www.afterwardsw3.org/TR/xml-names/#NT-doctypedecl\n `[16] doctypedecl ::= ''`\n var doctypedecl = reg('');\n*/\n\nvar CDATA_START = '';\nvar CDStart = //;\nvar CData = reg(Char, '*?', CDEnd);\n/*\n https://www.w3.org/TR/xml/#dt-cdsection\n `[18] \tCDSect\t ::= \tCDStart CData CDEnd`\n `[19] \tCDStart\t ::= \t'' Char*))`\n `[21] \tCDEnd\t ::= \t']]>'`\n*/\nvar CDSect = reg(CDStart, CData);\n\n// unit tested\nexports.chars = chars;\nexports.chars_without = chars_without;\nexports.detectUnicodeSupport = detectUnicodeSupport;\nexports.reg = reg;\nexports.regg = regg;\nexports.AttlistDecl = AttlistDecl;\nexports.CDATA_START = CDATA_START;\nexports.CDATA_END = CDATA_END;\nexports.CDSect = CDSect;\nexports.Char = Char;\nexports.Comment = Comment;\nexports.COMMENT_START = COMMENT_START;\nexports.COMMENT_END = COMMENT_END;\nexports.DOCTYPE_DECL_START = DOCTYPE_DECL_START;\nexports.elementdecl = elementdecl;\nexports.EntityDecl = EntityDecl;\nexports.EntityValue = EntityValue;\nexports.ExternalID = ExternalID;\nexports.ExternalID_match = ExternalID_match;\nexports.Name = Name;\nexports.NotationDecl = NotationDecl;\nexports.Reference = Reference;\nexports.PEReference = PEReference;\nexports.PI = PI;\nexports.PUBLIC = PUBLIC;\nexports.PubidLiteral = PubidLiteral;\nexports.QName = QName;\nexports.QName_exact = QName_exact;\nexports.QName_group = QName_group;\nexports.S = S;\nexports.SChar_s = SChar_s;\nexports.S_OPT = S_OPT;\nexports.SYSTEM = SYSTEM;\nexports.SystemLiteral = SystemLiteral;\nexports.UNICODE_REPLACEMENT_CHARACTER = UNICODE_REPLACEMENT_CHARACTER;\nexports.UNICODE_SUPPORT = UNICODE_SUPPORT;\nexports.XMLDecl = XMLDecl;\n","'use strict';\n\nvar conventions = require('./conventions');\nvar find = conventions.find;\nvar hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace;\nvar hasOwn = conventions.hasOwn;\nvar isHTMLMimeType = conventions.isHTMLMimeType;\nvar isHTMLRawTextElement = conventions.isHTMLRawTextElement;\nvar isHTMLVoidElement = conventions.isHTMLVoidElement;\nvar MIME_TYPE = conventions.MIME_TYPE;\nvar NAMESPACE = conventions.NAMESPACE;\n\n/**\n * Private DOM Constructor symbol\n *\n * Internal symbol used for construction of all classes whose constructors should be private.\n * Currently used for checks in `Node`, `Document`, `Element`, `Attr`, `CharacterData`, `Text`, `Comment`,\n * `CDATASection`, `DocumentType`, `Notation`, `Entity`, `EntityReference`, `DocumentFragment`, `ProcessingInstruction`\n * so the constructor can't be used from outside the module.\n */\nvar PDC = Symbol();\n\nvar errors = require('./errors');\nvar DOMException = errors.DOMException;\nvar DOMExceptionName = errors.DOMExceptionName;\n\nvar g = require('./grammar');\n\n/**\n * Checks if the given symbol equals the Private DOM Constructor symbol (PDC)\n * and throws an Illegal constructor exception when the symbols don't match.\n * This ensures that the constructor remains private and can't be used outside this module.\n */\nfunction checkSymbol(symbol) {\n\tif (symbol !== PDC) {\n\t\tthrow new TypeError('Illegal constructor');\n\t}\n}\n\n/**\n * A prerequisite for `[].filter`, to drop elements that are empty.\n *\n * @param {string} input\n * The string to be checked.\n * @returns {boolean}\n * Returns `true` if the input string is not empty, `false` otherwise.\n */\nfunction notEmptyString(input) {\n\treturn input !== '';\n}\n/**\n * Splits a string on ASCII whitespace characters (U+0009 TAB, U+000A LF, U+000C FF, U+000D CR,\n * U+0020 SPACE).\n * It follows the definition from the infra specification from WHATWG.\n *\n * @param {string} input\n * The string to be split.\n * @returns {string[]}\n * An array of the split strings. The array can be empty if the input string is empty or only\n * contains whitespace characters.\n * @see {@link https://infra.spec.whatwg.org/#split-on-ascii-whitespace}\n * @see {@link https://infra.spec.whatwg.org/#ascii-whitespace}\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 * The current record object to which the element will be added as a key.\n * The object's keys are string types and values are either boolean or undefined.\n * @param {string} element\n * The string to be added as a key to the current record.\n * @returns {Record}\n * The updated record object after the addition of the new element.\n */\nfunction orderedSetReducer(current, element) {\n\tif (!hasOwn(current, element)) {\n\t\tcurrent[element] = true;\n\t}\n\treturn current;\n}\n\n/**\n * Converts a string into an ordered set by splitting the input on ASCII whitespace and\n * ensuring uniqueness of elements.\n * This follows the definition of an ordered set from the infra specification by WHATWG.\n *\n * @param {string} input\n * The input string to be transformed into an ordered set.\n * @returns {string[]}\n * An array of unique strings obtained from the input, preserving the original order.\n * The array can be empty if the input string is empty or only contains whitespace characters.\n * @see {@link https://infra.spec.whatwg.org/#ordered-set}\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 a function that behaves like `Array.prototype.includes`.\n * This function is used in environments where `Array.prototype.includes` may not be available.\n *\n * @param {any[]} list\n * The array in which to search for the element.\n * @returns {function(any): boolean}\n * A function that accepts an element and returns a boolean indicating whether the element is\n * included in the provided list.\n */\nfunction arrayIncludes(list) {\n\treturn function (element) {\n\t\treturn list && list.indexOf(element) !== -1;\n\t};\n}\n\n/**\n * Validates a qualified name based on the criteria provided in the DOM specification by\n * WHATWG.\n *\n * @param {string} qualifiedName\n * The qualified name to be validated.\n * @throws {DOMException}\n * With code {@link DOMException.INVALID_CHARACTER_ERR} if the qualified name contains an\n * invalid character.\n * @see {@link https://dom.spec.whatwg.org/#validate}\n */\nfunction validateQualifiedName(qualifiedName) {\n\tif (!g.QName_exact.test(qualifiedName)) {\n\t\tthrow new DOMException(DOMException.INVALID_CHARACTER_ERR, 'invalid character in qualified name \"' + qualifiedName + '\"');\n\t}\n}\n\n/**\n * Validates a qualified name and the namespace associated with it,\n * based on the criteria provided in the DOM specification by WHATWG.\n *\n * @param {string | null} namespace\n * The namespace to be validated. It can be a string or null.\n * @param {string} qualifiedName\n * The qualified name to be validated.\n * @returns {[namespace: string | null, prefix: string | null, localName: string]}\n * Returns a tuple with the namespace,\n * prefix and local name of the qualified name.\n * @throws {DOMException}\n * Throws a DOMException if the qualified name or the namespace is not valid.\n * @see {@link https://dom.spec.whatwg.org/#validate-and-extract}\n */\nfunction validateAndExtract(namespace, qualifiedName) {\n\tvalidateQualifiedName(qualifiedName);\n\tnamespace = namespace || null;\n\t/**\n\t * @type {string | null}\n\t */\n\tvar prefix = null;\n\tvar localName = qualifiedName;\n\tif (qualifiedName.indexOf(':') >= 0) {\n\t\tvar splitResult = qualifiedName.split(':');\n\t\tprefix = splitResult[0];\n\t\tlocalName = splitResult[1];\n\t}\n\tif (prefix !== null && namespace === null) {\n\t\tthrow new DOMException(DOMException.NAMESPACE_ERR, 'prefix is non-null and namespace is null');\n\t}\n\tif (prefix === 'xml' && namespace !== conventions.NAMESPACE.XML) {\n\t\tthrow new DOMException(DOMException.NAMESPACE_ERR, 'prefix is \"xml\" and namespace is not the XML namespace');\n\t}\n\tif ((prefix === 'xmlns' || qualifiedName === 'xmlns') && namespace !== conventions.NAMESPACE.XMLNS) {\n\t\tthrow new DOMException(\n\t\t\tDOMException.NAMESPACE_ERR,\n\t\t\t'either qualifiedName or prefix is \"xmlns\" and namespace is not the XMLNS namespace'\n\t\t);\n\t}\n\tif (namespace === conventions.NAMESPACE.XMLNS && prefix !== 'xmlns' && qualifiedName !== 'xmlns') {\n\t\tthrow new DOMException(\n\t\t\tDOMException.NAMESPACE_ERR,\n\t\t\t'namespace is the XMLNS namespace and neither qualifiedName nor prefix is \"xmlns\"'\n\t\t);\n\t}\n\treturn [namespace, prefix, localName];\n}\n\n/**\n * Copies properties from one object to another.\n * It only copies the object's own (not inherited) properties.\n *\n * @param {Object} src\n * The source object from which properties are copied.\n * @param {Object} dest\n * The destination object to which properties are copied.\n */\nfunction copy(src, dest) {\n\tfor (var p in src) {\n\t\tif (hasOwn(src, p)) {\n\t\t\tdest[p] = src[p];\n\t\t}\n\t}\n}\n\n/**\n * Extends a class with the properties and methods of a super class.\n * It uses a form of prototypal inheritance, and establishes the `constructor` property\n * correctly(?).\n *\n * It is not clear to the current maintainers if this implementation is making sense,\n * since it creates an intermediate prototype function,\n * which all properties of `Super` are copied onto using `_copy`.\n *\n * @param {Object} Class\n * The class that is to be extended.\n * @param {Object} Super\n * The super class from which properties and methods are inherited.\n * @private\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\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\nvar DocumentPosition = conventions.freeze({\n\tDOCUMENT_POSITION_DISCONNECTED: 1,\n\tDOCUMENT_POSITION_PRECEDING: 2,\n\tDOCUMENT_POSITION_FOLLOWING: 4,\n\tDOCUMENT_POSITION_CONTAINS: 8,\n\tDOCUMENT_POSITION_CONTAINED_BY: 16,\n\tDOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32,\n});\n\n//helper functions for compareDocumentPosition\n/**\n * Constructs a parent chain for a node.\n *\n * @param {Node} node\n * The start node from which the parent chain will be constructed.\n * @returns {Node[]}\n * The array of nodes representing the parent chain from the root to the specified node.\n */\nfunction parentChain(node) {\n\tvar chain = [];\n\twhile (node.parentNode || node.ownerElement) {\n\t\tnode = node.parentNode || node.ownerElement;\n\t\tchain.unshift(node);\n\t}\n\treturn chain;\n}\n\n/**\n * Finds the common ancestor in two parent chains.\n *\n * @param {Node[]} a\n * The first parent chain.\n * @param {Node[]} b\n * The second parent chain.\n * @returns {Node}\n * The common ancestor node if it exists. If there is no common ancestor, the function will\n * return `null`.\n */\nfunction commonAncestor(a, b) {\n\tif (b.length < a.length) return commonAncestor(b, a);\n\tvar c = null;\n\tfor (var n in a) {\n\t\tif (a[n] !== b[n]) return c;\n\t\tc = a[n];\n\t}\n\treturn c;\n}\n\n/**\n * Assigns a unique identifier to a document to ensure consistency while comparing unrelated\n * nodes.\n *\n * @param {Document} doc\n * The document to which a unique identifier is to be assigned.\n * @returns {string}\n * The unique identifier of the document. If the document already had a unique identifier, the\n * function will return the existing one.\n */\nfunction docGUID(doc) {\n\tif (!doc.guid) doc.guid = Math.random();\n\treturn doc.guid;\n}\n//-- end of helper functions\n\n/**\n * The NodeList interface provides the abstraction of an ordered collection of nodes,\n * without defining or constraining how this collection is implemented.\n * NodeList objects in the DOM are live.\n * The items in the NodeList are accessible via an integral index, starting from 0.\n * You can also access the items of the NodeList with a `for...of` loop.\n *\n * @class NodeList\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177\n * @constructs NodeList\n */\nfunction NodeList() {}\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\n\t * inclusive.\n\t *\n\t * @type {number}\n\t */\n\tlength: 0,\n\t/**\n\t * Returns the item at `index`. If index is greater than or equal to the number of nodes in\n\t * the list, this returns null.\n\t *\n\t * @param index\n\t * Unsigned long Index into the collection.\n\t * @returns {Node | null}\n\t * The node at position `index` in the NodeList,\n\t * or null if that is not a valid index.\n\t */\n\titem: function (index) {\n\t\treturn index >= 0 && index < this.length ? this[index] : null;\n\t},\n\t/**\n\t * Returns a string representation of the NodeList.\n\t *\n\t * @param {unknown} nodeFilter\n\t * __A filter function? Not implemented according to the spec?__.\n\t * @returns {string}\n\t * A string representation of the NodeList.\n\t */\n\ttoString: function (nodeFilter) {\n\t\tfor (var buf = [], i = 0; i < this.length; i++) {\n\t\t\tserializeToString(this[i], buf, nodeFilter);\n\t\t}\n\t\treturn buf.join('');\n\t},\n\t/**\n\t * Filters the NodeList based on a predicate.\n\t *\n\t * @param {function(Node): boolean} predicate\n\t * - A predicate function to filter the NodeList.\n\t * @returns {Node[]}\n\t * An array of nodes that satisfy the predicate.\n\t * @private\n\t */\n\tfilter: function (predicate) {\n\t\treturn Array.prototype.filter.call(this, predicate);\n\t},\n\t/**\n\t * Returns the first index at which a given node can be found in the NodeList, or -1 if it is\n\t * not present.\n\t *\n\t * @param {Node} item\n\t * - The Node item to locate in the NodeList.\n\t * @returns {number}\n\t * The first index of the node in the NodeList; -1 if not found.\n\t * @private\n\t */\n\tindexOf: function (item) {\n\t\treturn Array.prototype.indexOf.call(this, item);\n\t},\n};\nNodeList.prototype[Symbol.iterator] = function () {\n\tvar me = this;\n\tvar index = 0;\n\n\treturn {\n\t\tnext: function () {\n\t\t\tif (index < me.length) {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: me[index++],\n\t\t\t\t\tdone: false,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\treturn: function () {\n\t\t\treturn {\n\t\t\t\tdone: true,\n\t\t\t};\n\t\t},\n\t};\n};\n\n/**\n * Represents a live collection of nodes that is automatically updated when its associated\n * document changes.\n *\n * @class LiveNodeList\n * @param {Node} node\n * The associated node.\n * @param {function} refresh\n * The function to refresh the live node list.\n * @augments NodeList\n * @constructs LiveNodeList\n */\nfunction LiveNodeList(node, refresh) {\n\tthis._node = node;\n\tthis._refresh = refresh;\n\t_updateLiveList(this);\n}\n/**\n * Updates the live node list.\n *\n * @param {LiveNodeList} list\n * The live node list to update.\n * @private\n */\nfunction _updateLiveList(list) {\n\tvar inc = list._node._inc || list._node.ownerDocument._inc;\n\tif (list._inc !== inc) {\n\t\tvar ls = list._refresh(list._node);\n\t\t__set__(list, 'length', ls.length);\n\t\tif (!list.$$length || ls.length < list.$$length) {\n\t\t\tfor (var i = ls.length; i in list; i++) {\n\t\t\t\tif (hasOwn(list, i)) {\n\t\t\t\t\tdelete list[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcopy(ls, list);\n\t\tlist._inc = inc;\n\t}\n}\n/**\n * Returns the node at position `index` in the LiveNodeList, or null if that is not a valid\n * index.\n *\n * @param {number} i\n * Index into the collection.\n * @returns {Node | null}\n * The node at position `index` in the LiveNodeList, or null if that is not a valid index.\n */\nLiveNodeList.prototype.item = function (i) {\n\t_updateLiveList(this);\n\treturn this[i] || null;\n};\n\n_extends(LiveNodeList, NodeList);\n\n/**\n * Objects implementing the NamedNodeMap interface are used to represent collections of nodes\n * that can be accessed by name.\n * Note that NamedNodeMap does not inherit from NodeList;\n * NamedNodeMaps are not maintained in any particular order.\n * Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal\n * index,\n * but this is simply to allow convenient enumeration of the contents of a NamedNodeMap,\n * and does not imply that the DOM specifies an order to these Nodes.\n * NamedNodeMap objects in the DOM are live.\n * used for attributes or DocumentType entities\n *\n * This implementation only supports property indices, but does not support named properties,\n * as specified in the living standard.\n *\n * @class NamedNodeMap\n * @see https://dom.spec.whatwg.org/#interface-namednodemap\n * @see https://webidl.spec.whatwg.org/#dfn-supported-property-names\n * @constructs NamedNodeMap\n */\nfunction NamedNodeMap() {}\n/**\n * Returns the index of a node within the list.\n *\n * @param {Array} list\n * The list of nodes.\n * @param {Node} node\n * The node to find.\n * @returns {number}\n * The index of the node within the list, or -1 if not found.\n * @private\n */\nfunction _findNodeIndex(list, node) {\n\tvar i = 0;\n\twhile (i < list.length) {\n\t\tif (list[i] === node) {\n\t\t\treturn i;\n\t\t}\n\t\ti++;\n\t}\n}\n/**\n * Adds a new attribute to the list and updates the owner element of the attribute.\n *\n * @param {Element} el\n * The element which will become the owner of the new attribute.\n * @param {NamedNodeMap} list\n * The list to which the new attribute will be added.\n * @param {Attr} newAttr\n * The new attribute to be added.\n * @param {Attr} oldAttr\n * The old attribute to be replaced, or null if no attribute is to be replaced.\n * @returns {void}\n * @private\n */\nfunction _addNamedNode(el, list, newAttr, oldAttr) {\n\tif (oldAttr) {\n\t\tlist[_findNodeIndex(list, oldAttr)] = newAttr;\n\t} else {\n\t\tlist[list.length] = newAttr;\n\t\tlist.length++;\n\t}\n\tif (el) {\n\t\tnewAttr.ownerElement = el;\n\t\tvar doc = el.ownerDocument;\n\t\tif (doc) {\n\t\t\toldAttr && _onRemoveAttribute(doc, el, oldAttr);\n\t\t\t_onAddAttribute(doc, el, newAttr);\n\t\t}\n\t}\n}\n/**\n * Removes an attribute from the list and updates the owner element of the attribute.\n *\n * @param {Element} el\n * The element which is the current owner of the attribute.\n * @param {NamedNodeMap} list\n * The list from which the attribute will be removed.\n * @param {Attr} attr\n * The attribute to be removed.\n * @returns {void}\n * @private\n */\nfunction _removeNamedNode(el, list, attr) {\n\t//console.log('remove attr:'+attr)\n\tvar i = _findNodeIndex(list, attr);\n\tif (i >= 0) {\n\t\tvar lastIndex = list.length - 1;\n\t\twhile (i <= lastIndex) {\n\t\t\tlist[i] = list[++i];\n\t\t}\n\t\tlist.length = lastIndex;\n\t\tif (el) {\n\t\t\tvar doc = el.ownerDocument;\n\t\t\tif (doc) {\n\t\t\t\t_onRemoveAttribute(doc, el, attr);\n\t\t\t}\n\t\t\tattr.ownerElement = null;\n\t\t}\n\t}\n}\nNamedNodeMap.prototype = {\n\tlength: 0,\n\titem: NodeList.prototype.item,\n\n\t/**\n\t * Get an attribute by name. Note: Name is in lower case in case of HTML namespace and\n\t * document.\n\t *\n\t * @param {string} localName\n\t * The local name of the attribute.\n\t * @returns {Attr | null}\n\t * The attribute with the given local name, or null if no such attribute exists.\n\t * @see https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name\n\t */\n\tgetNamedItem: function (localName) {\n\t\tif (this._ownerElement && this._ownerElement._isInHTMLDocumentAndNamespace()) {\n\t\t\tlocalName = localName.toLowerCase();\n\t\t}\n\t\tvar i = 0;\n\t\twhile (i < this.length) {\n\t\t\tvar attr = this[i];\n\t\t\tif (attr.nodeName === localName) {\n\t\t\t\treturn attr;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\treturn null;\n\t},\n\n\t/**\n\t * Set an attribute.\n\t *\n\t * @param {Attr} attr\n\t * The attribute to set.\n\t * @returns {Attr | null}\n\t * The old attribute with the same local name and namespace URI as the new one, or null if no\n\t * such attribute exists.\n\t * @throws {DOMException}\n\t * With code:\n\t * - {@link INUSE_ATTRIBUTE_ERR} - If the attribute is already an attribute of another\n\t * element.\n\t * @see https://dom.spec.whatwg.org/#concept-element-attributes-set\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(DOMException.INUSE_ATTRIBUTE_ERR);\n\t\t}\n\t\tvar oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);\n\t\tif (oldAttr === attr) {\n\t\t\treturn attr;\n\t\t}\n\t\t_addNamedNode(this._ownerElement, this, attr, oldAttr);\n\t\treturn oldAttr;\n\t},\n\n\t/**\n\t * Set an attribute, replacing an existing attribute with the same local name and namespace\n\t * URI if one exists.\n\t *\n\t * @param {Attr} attr\n\t * The attribute to set.\n\t * @returns {Attr | null}\n\t * The old attribute with the same local name and namespace URI as the new one, or null if no\n\t * such attribute exists.\n\t * @throws {DOMException}\n\t * Throws a DOMException with the name \"InUseAttributeError\" if the attribute is already an\n\t * attribute of another element.\n\t * @see https://dom.spec.whatwg.org/#concept-element-attributes-set\n\t */\n\tsetNamedItemNS: function (attr) {\n\t\treturn this.setNamedItem(attr);\n\t},\n\n\t/**\n\t * Removes an attribute specified by the local name.\n\t *\n\t * @param {string} localName\n\t * The local name of the attribute to be removed.\n\t * @returns {Attr}\n\t * The attribute node that was removed.\n\t * @throws {DOMException}\n\t * With code:\n\t * - {@link DOMException.NOT_FOUND_ERR} if no attribute with the given name is found.\n\t * @see https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem\n\t * @see https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-name\n\t */\n\tremoveNamedItem: function (localName) {\n\t\tvar attr = this.getNamedItem(localName);\n\t\tif (!attr) {\n\t\t\tthrow new DOMException(DOMException.NOT_FOUND_ERR, localName);\n\t\t}\n\t\t_removeNamedNode(this._ownerElement, this, attr);\n\t\treturn attr;\n\t},\n\n\t/**\n\t * Removes an attribute specified by the namespace and local name.\n\t *\n\t * @param {string | null} namespaceURI\n\t * The namespace URI of the attribute to be removed.\n\t * @param {string} localName\n\t * The local name of the attribute to be removed.\n\t * @returns {Attr}\n\t * The attribute node that was removed.\n\t * @throws {DOMException}\n\t * With code:\n\t * - {@link DOMException.NOT_FOUND_ERR} if no attribute with the given namespace URI and local\n\t * name is found.\n\t * @see https://dom.spec.whatwg.org/#dom-namednodemap-removenameditemns\n\t * @see https://dom.spec.whatwg.org/#concept-element-attributes-remove-by-namespace\n\t */\n\tremoveNamedItemNS: function (namespaceURI, localName) {\n\t\tvar attr = this.getNamedItemNS(namespaceURI, localName);\n\t\tif (!attr) {\n\t\t\tthrow new DOMException(DOMException.NOT_FOUND_ERR, namespaceURI ? namespaceURI + ' : ' + localName : localName);\n\t\t}\n\t\t_removeNamedNode(this._ownerElement, this, attr);\n\t\treturn attr;\n\t},\n\n\t/**\n\t * Get an attribute by namespace and local name.\n\t *\n\t * @param {string | null} namespaceURI\n\t * The namespace URI of the attribute.\n\t * @param {string} localName\n\t * The local name of the attribute.\n\t * @returns {Attr | null}\n\t * The attribute with the given namespace URI and local name, or null if no such attribute\n\t * exists.\n\t * @see https://dom.spec.whatwg.org/#concept-element-attributes-get-by-namespace\n\t */\n\tgetNamedItemNS: function (namespaceURI, localName) {\n\t\tif (!namespaceURI) {\n\t\t\tnamespaceURI = null;\n\t\t}\n\t\tvar i = 0;\n\t\twhile (i < this.length) {\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\ti++;\n\t\t}\n\t\treturn null;\n\t},\n};\nNamedNodeMap.prototype[Symbol.iterator] = function () {\n\tvar me = this;\n\tvar index = 0;\n\n\treturn {\n\t\tnext: function () {\n\t\t\tif (index < me.length) {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: me[index++],\n\t\t\t\t\tdone: false,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tdone: true,\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\treturn: function () {\n\t\t\treturn {\n\t\t\t\tdone: true,\n\t\t\t};\n\t\t},\n\t};\n};\n\n/**\n * The DOMImplementation interface provides a number of methods for performing operations that\n * are independent of any particular instance of the document object model.\n *\n * The DOMImplementation interface represents an object providing methods which are not\n * 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 * @class DOMImplementation\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\n * (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 * @constructs DOMImplementation\n */\nfunction DOMImplementation() {}\n\nDOMImplementation.prototype = {\n\t/**\n\t * Test if the DOM implementation implements a specific feature and version, as specified in\n\t * {@link https://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures DOM Features}.\n\t *\n\t * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given\n\t * feature is supported. The different implementations fairly diverged in what kind of\n\t * features were reported. The latest version of the spec settled to force this method to\n\t * always return true, where the functionality was accurate and in use.\n\t *\n\t * @deprecated\n\t * It is deprecated and modern browsers return true in all cases.\n\t * @function DOMImplementation#hasFeature\n\t * @param {string} feature\n\t * The name of the feature to test.\n\t * @param {string} [version]\n\t * This is the version number of the feature to test.\n\t * @returns {boolean}\n\t * Always returns true.\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 * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-5CED94D7 DOM Level 3 Core\n\t */\n\thasFeature: function (feature, version) {\n\t\treturn true;\n\t},\n\t/**\n\t * Creates a DOM Document object of the specified type with its document element. Note that\n\t * based on the {@link DocumentType}\n\t * given to create the document, the implementation may instantiate specialized\n\t * {@link Document} objects that support additional features than the \"Core\", such as \"HTML\"\n\t * {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#DOM2HTML DOM Level 2 HTML}.\n\t * On the other hand, setting the {@link DocumentType} after the document was created makes\n\t * this very unlikely to happen. Alternatively, specialized {@link Document} creation methods,\n\t * such as createHTMLDocument\n\t * {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#DOM2HTML DOM Level 2 HTML},\n\t * can be used to obtain specific types of {@link Document} objects.\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`\n\t * instance (with it's `type` set to `'xml'`).\n\t * - `encoding`, `mode`, `origin`, `url` fields are currently not declared.\n\t *\n\t * @function DOMImplementation.createDocument\n\t * @param {string | null} namespaceURI\n\t * The\n\t * {@link https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-namespaceURI namespace URI}\n\t * of the document element to create or null.\n\t * @param {string | null} qualifiedName\n\t * The\n\t * {@link https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-qualifiedname qualified name}\n\t * of the document element to be created or null.\n\t * @param {DocumentType | null} [doctype=null]\n\t * The type of document to be created or null. When doctype is not null, its\n\t * {@link Node#ownerDocument} attribute is set to the document being created. Default is\n\t * `null`\n\t * @returns {Document}\n\t * A new {@link Document} object with its document element. If the NamespaceURI,\n\t * qualifiedName, and doctype are null, the returned {@link Document} is empty with no\n\t * document element.\n\t * @throws {DOMException}\n\t * With code:\n\t *\n\t * - `INVALID_CHARACTER_ERR`: Raised if the specified qualified name is not an XML name\n\t * according to {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#XML XML 1.0}.\n\t * - `NAMESPACE_ERR`: Raised if the qualifiedName is malformed, if the qualifiedName has a\n\t * prefix and the namespaceURI is null, or if the qualifiedName is null and the namespaceURI\n\t * is different from null, or if the qualifiedName has a prefix that is \"xml\" and the\n\t * namespaceURI is different from \"{@link http://www.w3.org/XML/1998/namespace}\"\n\t * {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#Namespaces XML Namespaces},\n\t * or if the DOM implementation does not support the \"XML\" feature but a non-null namespace\n\t * URI was provided, since namespaces were defined by XML.\n\t * - `WRONG_DOCUMENT_ERR`: Raised if doctype has already been used with a different document\n\t * or was created from a different implementation.\n\t * - `NOT_SUPPORTED_ERR`: May be raised if the implementation does not support the feature\n\t * \"XML\" and the language exposed through the Document does not support XML Namespaces (such\n\t * as {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#HTML40 HTML 4.01}).\n\t * @since DOM Level 2.\n\t * @see {@link #createHTMLDocument}\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Living Standard\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Level-2-Core-DOM-createDocument DOM\n\t * Level 3 Core\n\t * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM\n\t * Level 2 Core (initial)\n\t */\n\tcreateDocument: function (namespaceURI, qualifiedName, doctype) {\n\t\tvar contentType = MIME_TYPE.XML_APPLICATION;\n\t\tif (namespaceURI === NAMESPACE.HTML) {\n\t\t\tcontentType = MIME_TYPE.XML_XHTML_APPLICATION;\n\t\t} else if (namespaceURI === NAMESPACE.SVG) {\n\t\t\tcontentType = MIME_TYPE.XML_SVG_IMAGE;\n\t\t}\n\t\tvar doc = new Document(PDC, { contentType: contentType });\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 * Creates an empty DocumentType node. Entity declarations and notations are not made\n\t * available. Entity reference expansions and default attribute additions do not occur.\n\t *\n\t * **This behavior is slightly different from the one in the specs**:\n\t * - `encoding`, `mode`, `origin`, `url` fields are currently not declared.\n\t * - `publicId` and `systemId` contain the raw data including any possible quotes,\n\t * so they can always be serialized back to the original value\n\t * - `internalSubset` contains the raw string between `[` and `]` if present,\n\t * but is not parsed or validated in any form.\n\t *\n\t * @function DOMImplementation#createDocumentType\n\t * @param {string} qualifiedName\n\t * The {@link https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-qualifiedname qualified\n\t * name} of the document type to be created.\n\t * @param {string} [publicId]\n\t * The external subset public identifier.\n\t * @param {string} [systemId]\n\t * The external subset system identifier.\n\t * @param {string} [internalSubset]\n\t * the internal subset or an empty string if it is not present\n\t * @returns {DocumentType}\n\t * A new {@link DocumentType} node with {@link Node#ownerDocument} set to null.\n\t * @throws {DOMException}\n\t * With code:\n\t *\n\t * - `INVALID_CHARACTER_ERR`: Raised if the specified qualified name is not an XML name\n\t * according to {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#XML XML 1.0}.\n\t * - `NAMESPACE_ERR`: Raised if the qualifiedName is malformed.\n\t * - `NOT_SUPPORTED_ERR`: May be raised if the implementation does not support the feature\n\t * \"XML\" and the language exposed through the Document does not support XML Namespaces (such\n\t * as {@link https://www.w3.org/TR/DOM-Level-3-Core/references.html#HTML40 HTML 4.01}).\n\t * @since DOM Level 2.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType\n\t * MDN\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living\n\t * Standard\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Level-3-Core-DOM-createDocType DOM\n\t * Level 3 Core\n\t * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM\n\t * Level 2 Core\n\t * @see https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md#050\n\t * @see https://www.w3.org/TR/DOM-Level-2-Core/#core-ID-Core-DocType-internalSubset\n\t * @prettierignore\n\t */\n\tcreateDocumentType: function (qualifiedName, publicId, systemId, internalSubset) {\n\t\tvalidateQualifiedName(qualifiedName);\n\t\tvar node = new DocumentType(PDC);\n\t\tnode.name = qualifiedName;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.publicId = publicId || '';\n\t\tnode.systemId = systemId || '';\n\t\tnode.internalSubset = internalSubset || '';\n\t\tnode.childNodes = new NodeList();\n\n\t\treturn node;\n\t},\n\t/**\n\t * Returns an HTML document, that might already have a basic DOM structure.\n\t *\n\t * __It behaves slightly different from the description in the living standard__:\n\t * - If the first argument is `false` no initial nodes are added (steps 3-7 in the specs are\n\t * omitted)\n\t * - `encoding`, `mode`, `origin`, `url` fields are currently not declared.\n\t *\n\t * @param {string | false} [title]\n\t * A string containing the title to give the new HTML document.\n\t * @returns {Document}\n\t * The HTML document.\n\t * @since WHATWG Living Standard.\n\t * @see {@link #createDocument}\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument\n\t * @see https://dom.spec.whatwg.org/#html-document\n\t */\n\tcreateHTMLDocument: function (title) {\n\t\tvar doc = new Document(PDC, { contentType: MIME_TYPE.HTML });\n\t\tdoc.implementation = this;\n\t\tdoc.childNodes = new NodeList();\n\t\tif (title !== false) {\n\t\t\tdoc.doctype = this.createDocumentType('html');\n\t\t\tdoc.doctype.ownerDocument = doc;\n\t\t\tdoc.appendChild(doc.doctype);\n\t\t\tvar htmlNode = doc.createElement('html');\n\t\t\tdoc.appendChild(htmlNode);\n\t\t\tvar headNode = doc.createElement('head');\n\t\t\thtmlNode.appendChild(headNode);\n\t\t\tif (typeof title === 'string') {\n\t\t\t\tvar titleNode = doc.createElement('title');\n\t\t\t\ttitleNode.appendChild(doc.createTextNode(title));\n\t\t\t\theadNode.appendChild(titleNode);\n\t\t\t}\n\t\t\thtmlNode.appendChild(doc.createElement('body'));\n\t\t}\n\t\treturn doc;\n\t},\n};\n\n/**\n * The DOM Node interface is an abstract base class upon which many other DOM API objects are\n * based, thus letting those object types to be used similarly and often interchangeably. As an\n * abstract class, there is no such thing as a plain Node object. All objects that implement\n * Node functionality are based on one of its subclasses. Most notable are Document, Element,\n * and DocumentFragment.\n *\n * In addition, every kind of DOM node is represented by an interface based on Node. These\n * include Attr, CharacterData (which Text, Comment, CDATASection and ProcessingInstruction are\n * all based on), and DocumentType.\n *\n * In some cases, a particular feature of the base Node interface may not apply to one of its\n * child interfaces; in that case, the inheriting node may return null or throw an exception,\n * depending on circumstances. For example, attempting to add children to a node type that\n * cannot have children will throw an exception.\n *\n * **This behavior is slightly different from the in the specs**:\n * - unimplemented interfaces: `EventTarget`\n *\n * @class\n * @abstract\n * @param {Symbol} symbol\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247\n * @see https://dom.spec.whatwg.org/#node\n * @prettierignore\n */\nfunction Node(symbol) {\n\tcheckSymbol(symbol);\n}\n\nNode.prototype = {\n\t/**\n\t * The first child of this node.\n\t *\n\t * @type {Node | null}\n\t */\n\tfirstChild: null,\n\t/**\n\t * The last child of this node.\n\t *\n\t * @type {Node | null}\n\t */\n\tlastChild: null,\n\t/**\n\t * The previous sibling of this node.\n\t *\n\t * @type {Node | null}\n\t */\n\tpreviousSibling: null,\n\t/**\n\t * The next sibling of this node.\n\t *\n\t * @type {Node | null}\n\t */\n\tnextSibling: null,\n\t/**\n\t * The parent node of this node.\n\t *\n\t * @type {Node | null}\n\t */\n\tparentNode: null,\n\t/**\n\t * The parent element of this node.\n\t *\n\t * @type {Element | null}\n\t */\n\tget parentElement() {\n\t\treturn this.parentNode && this.parentNode.nodeType === this.ELEMENT_NODE ? this.parentNode : null;\n\t},\n\t/**\n\t * The child nodes of this node.\n\t *\n\t * @type {NodeList}\n\t */\n\tchildNodes: null,\n\t/**\n\t * The document object associated with this node.\n\t *\n\t * @type {Document | null}\n\t */\n\townerDocument: null,\n\t/**\n\t * The value of this node.\n\t *\n\t * @type {string | null}\n\t */\n\tnodeValue: null,\n\t/**\n\t * The namespace URI of this node.\n\t *\n\t * @type {string | null}\n\t */\n\tnamespaceURI: null,\n\t/**\n\t * The prefix of the namespace for this node.\n\t *\n\t * @type {string | null}\n\t */\n\tprefix: null,\n\t/**\n\t * The local part of the qualified name of this node.\n\t *\n\t * @type {string | null}\n\t */\n\tlocalName: null,\n\t/**\n\t * The baseURI is currently always `about:blank`,\n\t * since that's what happens when you create a document from scratch.\n\t *\n\t * @type {'about:blank'}\n\t */\n\tbaseURI: 'about:blank',\n\t/**\n\t * Is true if this node is part of a document.\n\t *\n\t * @type {boolean}\n\t */\n\tget isConnected() {\n\t\tvar rootNode = this.getRootNode();\n\t\treturn rootNode && rootNode.nodeType === rootNode.DOCUMENT_NODE;\n\t},\n\t/**\n\t * Checks whether `other` is an inclusive descendant of this node.\n\t *\n\t * @param {Node | null | undefined} other\n\t * The node to check.\n\t * @returns {boolean}\n\t * True if `other` is an inclusive descendant of this node; false otherwise.\n\t * @see https://dom.spec.whatwg.org/#dom-node-contains\n\t */\n\tcontains: function (other) {\n\t\tif (!other) return false;\n\t\tvar parent = other;\n\t\tdo {\n\t\t\tif (this === parent) return true;\n\t\t\tparent = other.parentNode;\n\t\t} while (parent);\n\t\treturn false;\n\t},\n\t/**\n\t * @typedef GetRootNodeOptions\n\t * @property {boolean} [composed=false]\n\t */\n\t/**\n\t * Searches for the root node of this node.\n\t *\n\t * **This behavior is slightly different from the in the specs**:\n\t * - ignores `options.composed`, since `ShadowRoot`s are unsupported, always returns root.\n\t *\n\t * @param {GetRootNodeOptions} [options]\n\t * @returns {Node}\n\t * Root node.\n\t * @see https://dom.spec.whatwg.org/#dom-node-getrootnode\n\t * @see https://dom.spec.whatwg.org/#concept-shadow-including-root\n\t */\n\tgetRootNode: function (options) {\n\t\tvar parent = this;\n\t\tdo {\n\t\t\tif (!parent.parentNode) {\n\t\t\t\treturn parent;\n\t\t\t}\n\t\t\tparent = parent.parentNode;\n\t\t} while (parent);\n\t},\n\t/**\n\t * Checks whether the given node is equal to this node.\n\t *\n\t * @param {Node} [otherNode]\n\t * @see https://dom.spec.whatwg.org/#concept-node-equals\n\t */\n\tisEqualNode: function (otherNode) {\n\t\tif (!otherNode) return false;\n\n\t\tif (this.nodeType !== otherNode.nodeType) return false;\n\n\t\tswitch (this.nodeType) {\n\t\t\tcase this.DOCUMENT_TYPE_NODE:\n\t\t\t\tif (this.name !== otherNode.name) return false;\n\t\t\t\tif (this.publicId !== otherNode.publicId) return false;\n\t\t\t\tif (this.systemId !== otherNode.systemId) return false;\n\t\t\t\tbreak;\n\t\t\tcase this.ELEMENT_NODE:\n\t\t\t\tif (this.namespaceURI !== otherNode.namespaceURI) return false;\n\t\t\t\tif (this.prefix !== otherNode.prefix) return false;\n\t\t\t\tif (this.localName !== otherNode.localName) return false;\n\t\t\t\tif (this.attributes.length !== otherNode.attributes.length) return false;\n\t\t\t\tfor (var i = 0; i < this.attributes.length; i++) {\n\t\t\t\t\tvar attr = this.attributes.item(i);\n\t\t\t\t\tif (!attr.isEqualNode(otherNode.getAttributeNodeNS(attr.namespaceURI, attr.localName))) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase this.ATTRIBUTE_NODE:\n\t\t\t\tif (this.namespaceURI !== otherNode.namespaceURI) return false;\n\t\t\t\tif (this.localName !== otherNode.localName) return false;\n\t\t\t\tif (this.value !== otherNode.value) return false;\n\n\t\t\t\tbreak;\n\t\t\tcase this.PROCESSING_INSTRUCTION_NODE:\n\t\t\t\tif (this.target !== otherNode.target || this.data !== otherNode.data) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase this.TEXT_NODE:\n\t\t\tcase this.COMMENT_NODE:\n\t\t\t\tif (this.data !== otherNode.data) return false;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (this.childNodes.length !== otherNode.childNodes.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (var i = 0; i < this.childNodes.length; i++) {\n\t\t\tif (!this.childNodes[i].isEqualNode(otherNode.childNodes[i])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t},\n\t/**\n\t * Checks whether or not the given node is this node.\n\t *\n\t * @param {Node} [otherNode]\n\t */\n\tisSameNode: function (otherNode) {\n\t\treturn this === otherNode;\n\t},\n\t/**\n\t * Inserts a node before a reference node as a child of this node.\n\t *\n\t * @param {Node} newChild\n\t * The new child node to be inserted.\n\t * @param {Node | null} refChild\n\t * The reference node before which newChild will be inserted.\n\t * @returns {Node}\n\t * The new child node successfully inserted.\n\t * @throws {DOMException}\n\t * Throws a DOMException if inserting the node would result in a DOM tree that is not\n\t * well-formed, or if `child` is provided but is not a child of `parent`.\n\t * See {@link _insertBefore} for more details.\n\t * @since Modified in DOM L2\n\t */\n\tinsertBefore: function (newChild, refChild) {\n\t\treturn _insertBefore(this, newChild, refChild);\n\t},\n\t/**\n\t * Replaces an old child node with a new child node within this node.\n\t *\n\t * @param {Node} newChild\n\t * The new node that is to replace the old node.\n\t * If it already exists in the DOM, it is removed from its original position.\n\t * @param {Node} oldChild\n\t * The existing child node to be replaced.\n\t * @returns {Node}\n\t * Returns the replaced child node.\n\t * @throws {DOMException}\n\t * Throws a DOMException if replacing the node would result in a DOM tree that is not\n\t * well-formed, or if `oldChild` is not a child of `this`.\n\t * This can also occur if the pre-replacement validity assertion fails.\n\t * See {@link _insertBefore}, {@link Node.removeChild}, and\n\t * {@link assertPreReplacementValidityInDocument} for more details.\n\t * @see https://dom.spec.whatwg.org/#concept-node-replace\n\t */\n\treplaceChild: function (newChild, oldChild) {\n\t\t_insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);\n\t\tif (oldChild) {\n\t\t\tthis.removeChild(oldChild);\n\t\t}\n\t},\n\t/**\n\t * Removes an existing child node from this node.\n\t *\n\t * @param {Node} oldChild\n\t * The child node to be removed.\n\t * @returns {Node}\n\t * Returns the removed child node.\n\t * @throws {DOMException}\n\t * Throws a DOMException if `oldChild` is not a child of `this`.\n\t * See {@link _removeChild} for more details.\n\t */\n\tremoveChild: function (oldChild) {\n\t\treturn _removeChild(this, oldChild);\n\t},\n\t/**\n\t * Appends a child node to this node.\n\t *\n\t * @param {Node} newChild\n\t * The child node to be appended to this node.\n\t * If it already exists in the DOM, it is removed from its original position.\n\t * @returns {Node}\n\t * Returns the appended child node.\n\t * @throws {DOMException}\n\t * Throws a DOMException if appending the node would result in a DOM tree that is not\n\t * well-formed, or if `newChild` is not a valid Node.\n\t * See {@link insertBefore} for more details.\n\t */\n\tappendChild: function (newChild) {\n\t\treturn this.insertBefore(newChild, null);\n\t},\n\t/**\n\t * Determines whether this node has any child nodes.\n\t *\n\t * @returns {boolean}\n\t * Returns true if this node has any child nodes, and false otherwise.\n\t */\n\thasChildNodes: function () {\n\t\treturn this.firstChild != null;\n\t},\n\t/**\n\t * Creates a copy of the calling node.\n\t *\n\t * @param {boolean} deep\n\t * If true, the contents of the node are recursively copied.\n\t * If false, only the node itself (and its attributes, if it is an element) are copied.\n\t * @returns {Node}\n\t * Returns the newly created copy of the node.\n\t * @throws {DOMException}\n\t * May throw a DOMException if operations within {@link Element#setAttributeNode} or\n\t * {@link Node#appendChild} (which are potentially invoked in this method) do not meet their\n\t * specific constraints.\n\t * @see {@link cloneNode}\n\t */\n\tcloneNode: function (deep) {\n\t\treturn cloneNode(this.ownerDocument || this, this, deep);\n\t},\n\t/**\n\t * Puts the specified node and all of its subtree into a \"normalized\" form. In a normalized\n\t * subtree, no text nodes in the subtree are empty and there are no adjacent text nodes.\n\t *\n\t * Specifically, this method merges any adjacent text nodes (i.e., nodes for which `nodeType`\n\t * is `TEXT_NODE`) into a single node with the combined data. It also removes any empty text\n\t * nodes.\n\t *\n\t * This method operates recursively, so it also normalizes any and all descendent nodes within\n\t * the subtree.\n\t *\n\t * @throws {DOMException}\n\t * May throw a DOMException if operations within removeChild or appendData (which are\n\t * potentially invoked in this method) do not meet their specific constraints.\n\t * @since Modified in DOM Level 2\n\t * @see {@link Node.removeChild}\n\t * @see {@link CharacterData.appendData}\n\t */\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/**\n\t * Checks whether the DOM implementation implements a specific feature and its version.\n\t *\n\t * @deprecated\n\t * Since `DOMImplementation.hasFeature` is deprecated and always returns true.\n\t * @param {string} feature\n\t * The package name of the feature to test. This is the same name that can be passed to the\n\t * method `hasFeature` on `DOMImplementation`.\n\t * @param {string} version\n\t * This is the version number of the package name to test.\n\t * @returns {boolean}\n\t * Returns true in all cases in the current implementation.\n\t * @since Introduced in DOM Level 2\n\t * @see {@link DOMImplementation.hasFeature}\n\t */\n\tisSupported: function (feature, version) {\n\t\treturn this.ownerDocument.implementation.hasFeature(feature, version);\n\t},\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 * **This behavior is different from the in the specs**:\n\t * - no node type specific handling\n\t * - uses the internal attribute _nsMap for resolving namespaces that is updated when changing attributes\n\t *\n\t * @param {string | null} namespaceURI\n\t * The namespace URI for which to find the associated prefix.\n\t * @returns {string | null}\n\t * The associated prefix, if found; otherwise, 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 * @prettierignore\n\t */\n\tlookupPrefix: function (namespaceURI) {\n\t\tvar el = this;\n\t\twhile (el) {\n\t\t\tvar map = el._nsMap;\n\t\t\t//console.dir(map)\n\t\t\tif (map) {\n\t\t\t\tfor (var n in map) {\n\t\t\t\t\tif (hasOwn(map, n) && map[n] === namespaceURI) {\n\t\t\t\t\t\treturn n;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tel = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;\n\t\t}\n\t\treturn null;\n\t},\n\t/**\n\t * This function is used to look up the namespace URI associated with the given prefix,\n\t * starting from this node.\n\t *\n\t * **This behavior is different from the in the specs**:\n\t * - no node type specific handling\n\t * - uses the internal attribute _nsMap for resolving namespaces that is updated when changing attributes\n\t *\n\t * @param {string | null} prefix\n\t * The prefix for which to find the associated namespace URI.\n\t * @returns {string | null}\n\t * The associated namespace URI, if found; otherwise, null.\n\t * @since DOM Level 3\n\t * @see https://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI\n\t * @prettierignore\n\t */\n\tlookupNamespaceURI: function (prefix) {\n\t\tvar el = this;\n\t\twhile (el) {\n\t\t\tvar map = el._nsMap;\n\t\t\t//console.dir(map)\n\t\t\tif (map) {\n\t\t\t\tif (hasOwn(map, prefix)) {\n\t\t\t\t\treturn map[prefix];\n\t\t\t\t}\n\t\t\t}\n\t\t\tel = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;\n\t\t}\n\t\treturn null;\n\t},\n\t/**\n\t * Determines whether the given namespace URI is the default namespace.\n\t *\n\t * The function works by looking up the prefix associated with the given namespace URI. If no\n\t * prefix is found (i.e., the namespace URI is not registered in the namespace map of this\n\t * node or any of its ancestors), it returns `true`, implying the namespace URI is considered\n\t * the default.\n\t *\n\t * **This behavior is different from the in the specs**:\n\t * - no node type specific handling\n\t * - uses the internal attribute _nsMap for resolving namespaces that is updated when changing attributes\n\t *\n\t * @param {string | null} namespaceURI\n\t * The namespace URI to be checked.\n\t * @returns {boolean}\n\t * Returns true if the given namespace URI is the default namespace, false otherwise.\n\t * @since DOM Level 3\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isDefaultNamespace\n\t * @see https://dom.spec.whatwg.org/#dom-node-isdefaultnamespace\n\t * @prettierignore\n\t */\n\tisDefaultNamespace: function (namespaceURI) {\n\t\tvar prefix = this.lookupPrefix(namespaceURI);\n\t\treturn prefix == null;\n\t},\n\t/**\n\t * Compares the reference node with a node with regard to their position in the document and\n\t * according to the document order.\n\t *\n\t * @param {Node} other\n\t * The node to compare the reference node to.\n\t * @returns {number}\n\t * Returns how the node is positioned relatively to the reference node according to the\n\t * bitmask. 0 if reference node and given node are the same.\n\t * @since DOM Level 3\n\t * @see https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-compare\n\t * @see https://dom.spec.whatwg.org/#dom-node-comparedocumentposition\n\t */\n\tcompareDocumentPosition: function (other) {\n\t\tif (this === other) return 0;\n\t\tvar node1 = other;\n\t\tvar node2 = this;\n\t\tvar attr1 = null;\n\t\tvar attr2 = null;\n\t\tif (node1 instanceof Attr) {\n\t\t\tattr1 = node1;\n\t\t\tnode1 = attr1.ownerElement;\n\t\t}\n\t\tif (node2 instanceof Attr) {\n\t\t\tattr2 = node2;\n\t\t\tnode2 = attr2.ownerElement;\n\t\t\tif (attr1 && node1 && node2 === node1) {\n\t\t\t\tfor (var i = 0, attr; (attr = node2.attributes[i]); i++) {\n\t\t\t\t\tif (attr === attr1)\n\t\t\t\t\t\treturn DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + DocumentPosition.DOCUMENT_POSITION_PRECEDING;\n\t\t\t\t\tif (attr === attr2)\n\t\t\t\t\t\treturn DocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + DocumentPosition.DOCUMENT_POSITION_FOLLOWING;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!node1 || !node2 || node2.ownerDocument !== node1.ownerDocument) {\n\t\t\treturn (\n\t\t\t\tDocumentPosition.DOCUMENT_POSITION_DISCONNECTED +\n\t\t\t\tDocumentPosition.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC +\n\t\t\t\t(docGUID(node2.ownerDocument) > docGUID(node1.ownerDocument)\n\t\t\t\t\t? DocumentPosition.DOCUMENT_POSITION_FOLLOWING\n\t\t\t\t\t: DocumentPosition.DOCUMENT_POSITION_PRECEDING)\n\t\t\t);\n\t\t}\n\t\tvar chain1 = parentChain(node1);\n\t\tvar chain2 = parentChain(node2);\n\t\tif ((!attr1 && chain2.indexOf(node1) >= 0) || (attr2 && node1 === node2)) {\n\t\t\treturn DocumentPosition.DOCUMENT_POSITION_CONTAINS + DocumentPosition.DOCUMENT_POSITION_PRECEDING;\n\t\t}\n\t\tif ((!attr2 && chain1.indexOf(node2) >= 0) || (attr1 && node1 === node2)) {\n\t\t\treturn DocumentPosition.DOCUMENT_POSITION_CONTAINED_BY + DocumentPosition.DOCUMENT_POSITION_FOLLOWING;\n\t\t}\n\t\tvar ca = commonAncestor(chain2, chain1);\n\t\tfor (var n in ca.childNodes) {\n\t\t\tvar child = ca.childNodes[n];\n\t\t\tif (child === node2) return DocumentPosition.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tif (child === node1) return DocumentPosition.DOCUMENT_POSITION_PRECEDING;\n\t\t\tif (chain2.indexOf(child) >= 0) return DocumentPosition.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tif (chain1.indexOf(child) >= 0) return DocumentPosition.DOCUMENT_POSITION_PRECEDING;\n\t\t}\n\t\treturn 0;\n\t},\n};\n\n/**\n * Encodes special XML characters to their corresponding entities.\n *\n * @param {string} c\n * The character to be encoded.\n * @returns {string}\n * The encoded character.\n * @private\n */\nfunction _xmlEncoder(c) {\n\treturn (\n\t\t(c == '<' && '<') || (c == '>' && '>') || (c == '&' && '&') || (c == '\"' && '"') || '&#' + c.charCodeAt() + ';'\n\t);\n}\n\ncopy(NodeType, Node);\ncopy(NodeType, Node.prototype);\ncopy(DocumentPosition, Node);\ncopy(DocumentPosition, Node.prototype);\n\n/**\n * @param callback\n * Return true for continue,false for break.\n * @returns\n * 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)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} while ((node = node.nextSibling));\n\t}\n}\n\n/**\n * @typedef DocumentOptions\n * @property {string} [contentType=MIME_TYPE.XML_APPLICATION]\n */\n/**\n * The Document interface describes the common properties and methods for any kind of document.\n *\n * It should usually be created using `new DOMImplementation().createDocument(...)`\n * or `new DOMImplementation().createHTMLDocument(...)`.\n *\n * The constructor is considered a private API and offers to initially set the `contentType`\n * property via it's options parameter.\n *\n * @class\n * @param {Symbol} symbol\n * @param {DocumentOptions} [options]\n * @augments Node\n * @private\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Document\n * @see https://dom.spec.whatwg.org/#interface-document\n */\nfunction Document(symbol, options) {\n\tcheckSymbol(symbol);\n\n\tvar opt = options || {};\n\tthis.ownerDocument = this;\n\t/**\n\t * The mime type of the document is determined at creation time and can not be modified.\n\t *\n\t * @type {string}\n\t * @see https://dom.spec.whatwg.org/#concept-document-content-type\n\t * @see {@link DOMImplementation}\n\t * @see {@link MIME_TYPE}\n\t * @readonly\n\t */\n\tthis.contentType = opt.contentType || MIME_TYPE.XML_APPLICATION;\n\t/**\n\t * @type {'html' | 'xml'}\n\t * @see https://dom.spec.whatwg.org/#concept-document-type\n\t * @see {@link DOMImplementation}\n\t * @readonly\n\t */\n\tthis.type = isHTMLMimeType(this.contentType) ? 'html' : 'xml';\n}\n\n/**\n * Updates the namespace mapping of an element when a new attribute is added.\n *\n * @param {Document} doc\n * The document that the element belongs to.\n * @param {Element} el\n * The element to which the attribute is being added.\n * @param {Attr} newAttr\n * The new attribute being added.\n * @private\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\n/**\n * Updates the namespace mapping of an element when an attribute is removed.\n *\n * @param {Document} doc\n * The document that the element belongs to.\n * @param {Element} el\n * The element from which the attribute is being removed.\n * @param {Attr} newAttr\n * The attribute being removed.\n * @param {boolean} remove\n * Indicates whether the attribute is to be removed.\n * @private\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 `parent.childNodes`, adjusting the indexed items and its `length`.\n * If `newChild` is provided and has no nextSibling, it will be appended.\n * Otherwise, it's assumed that an item has been removed or inserted,\n * and `parent.firstNode` and its `.nextSibling` to re-indexing all child nodes of `parent`.\n *\n * @param {Document} doc\n * The parent document of `el`.\n * @param {Node} parent\n * The parent node whose childNodes list needs to be updated.\n * @param {Node} [newChild]\n * The new child node to be appended. If not provided, the function assumes a node has been\n * removed.\n * @private\n */\nfunction _onUpdateChild(doc, parent, newChild) {\n\tif (doc && doc._inc) {\n\t\tdoc._inc++;\n\t\tvar childNodes = parent.childNodes;\n\t\t// assumes nextSibling and previousSibling were already configured upfront\n\t\tif (newChild && !newChild.nextSibling) {\n\t\t\t// if an item has been appended, we only need to update the last index and the length\n\t\t\tchildNodes[childNodes.length++] = newChild;\n\t\t} else {\n\t\t\t// otherwise we need to reindex all items,\n\t\t\t// which can take a while when processing nodes with a lot of children\n\t\t\tvar child = parent.firstChild;\n\t\t\tvar i = 0;\n\t\t\twhile (child) {\n\t\t\t\tchildNodes[i++] = child;\n\t\t\t\tchild = child.nextSibling;\n\t\t\t}\n\t\t\tchildNodes.length = i;\n\t\t\tdelete childNodes[childNodes.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 * @param {Node} parentNode\n * The parent node from which the child node is to be removed.\n * @param {Node} child\n * The child node to be removed from the parentNode.\n * @returns {Node}\n * Returns the child node that was removed.\n * @throws {DOMException}\n * With code:\n * - {@link DOMException.NOT_FOUND_ERR} If the parentNode is not the parent of the child node.\n * @private\n * @see https://github.com/xmldom/xmldom/issues/135\n * @see https://github.com/xmldom/xmldom/issues/145\n */\nfunction _removeChild(parentNode, child) {\n\tif (parentNode !== child.parentNode) {\n\t\tthrow new DOMException(DOMException.NOT_FOUND_ERR, \"child's parent is not parent\");\n\t}\n\tvar oldPreviousSibling = child.previousSibling;\n\tvar oldNextSibling = child.nextSibling;\n\tif (oldPreviousSibling) {\n\t\toldPreviousSibling.nextSibling = oldNextSibling;\n\t} else {\n\t\tparentNode.firstChild = oldNextSibling;\n\t}\n\tif (oldNextSibling) {\n\t\toldNextSibling.previousSibling = oldPreviousSibling;\n\t} else {\n\t\tparentNode.lastChild = oldPreviousSibling;\n\t}\n\t_onUpdateChild(parentNode.ownerDocument, parentNode);\n\tchild.parentNode = null;\n\tchild.previousSibling = null;\n\tchild.nextSibling = null;\n\treturn child;\n}\n\n/**\n * Returns `true` if `node` can be a parent for insertion.\n *\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 *\n * @param {Node} node\n * @returns {boolean}\n */\nfunction hasInsertableNodeType(node) {\n\treturn (\n\t\tnode &&\n\t\t(node.nodeType === Node.CDATA_SECTION_NODE ||\n\t\t\tnode.nodeType === Node.COMMENT_NODE ||\n\t\t\tnode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ||\n\t\t\tnode.nodeType === Node.DOCUMENT_TYPE_NODE ||\n\t\t\tnode.nodeType === Node.ELEMENT_NODE ||\n\t\t\tnode.nodeType === Node.PROCESSING_INSTRUCTION_NODE ||\n\t\t\tnode.nodeType === Node.TEXT_NODE)\n\t);\n}\n\n/**\n * Returns true if `node` is a DOCTYPE node.\n *\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 *\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 *\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\n * The document node.\n * @param {Node} child\n * The node that would become the nextSibling if the element would be inserted.\n * @returns {boolean}\n * `true` if an element can be inserted before child.\n * @private\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\n * The document node.\n * @param {Node} child\n * The node that would become the nextSibling if the element would be inserted.\n * @returns {boolean}\n * `true` if an element can be inserted before child.\n * @private\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 * Asserts pre-insertion validity of a node into a parent before a child.\n * Throws errors for invalid node combinations that would result in an ill-formed DOM.\n *\n * @param {Node} parent\n * The parent node to insert `node` into.\n * @param {Node} node\n * The node to insert.\n * @param {Node | null} child\n * The node that should become the `nextSibling` of `node`. If null, no sibling is considered.\n * @throws {DOMException}\n * With code:\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `parent` is not a Document,\n * DocumentFragment, or Element node.\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is a host-including inclusive\n * ancestor of `parent`. (Currently not implemented)\n * - {@link DOMException.NOT_FOUND_ERR} If `child` is non-null and its `parent` is not\n * `parent`.\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is not a DocumentFragment,\n * DocumentType, Element, or CharacterData node.\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If either `node` is a Text node and `parent` is\n * a document, or if `node` is a doctype and `parent` is not a document.\n * @private\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(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(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\tDOMException.HIERARCHY_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 * Asserts pre-insertion validity of a node into a document before a child.\n * Throws errors for invalid node combinations that would result in an ill-formed DOM.\n *\n * @param {Document} parent\n * The parent node to insert `node` into.\n * @param {Node} node\n * The node to insert.\n * @param {Node | undefined} child\n * The node that should become the `nextSibling` of `node`. If undefined, no sibling is\n * considered.\n * @returns {Node}\n * @throws {DOMException}\n * With code:\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is a DocumentFragment with more than\n * one element child or has a Text node child.\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is a DocumentFragment with one\n * element child and either `parent` has an element child, `child` is a doctype, or `child` is\n * non-null and a doctype is following `child`.\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is an Element and `parent` has an\n * element child, `child` is a doctype, or `child` is non-null and a doctype is following\n * `child`.\n * - {@link DOMException.HIERARCHY_REQUEST_ERR} If `node` is a DocumentType and `parent` has a\n * doctype child, `child` is non-null and an element is preceding `child`, or `child` is null\n * and `parent` has an element child.\n * @private\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(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(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(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(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(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(DOMException.HIERARCHY_REQUEST_ERR, 'Doctype can not be appended since element is present');\n\t\t}\n\t}\n}\n\n/**\n * @param {Document} parent\n * The parent node to insert `node` into.\n * @param {Node} node\n * The node to insert.\n * @param {Node | undefined} child\n * the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws {DOMException}\n * For several node combinations that would create a DOM that is not well-formed.\n * @throws {DOMException}\n * If `child` is provided but is not a child of `parent`.\n * @private\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(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(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(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(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(DOMException.HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');\n\t\t}\n\t}\n}\n\n/**\n * Inserts a node into a parent node before a child node.\n *\n * @param {Node} parent\n * The parent node to insert the node into.\n * @param {Node} node\n * The node to insert into the parent.\n * @param {Node | null} child\n * The node that should become the next sibling of the node.\n * If null, the function inserts the node at the end of the children of the parent node.\n * @param {Function} [_inDocumentAssertion]\n * An optional function to check pre-insertion validity if parent is a document node.\n * Defaults to {@link assertPreInsertionValidityInDocument}\n * @returns {Node}\n * Returns the inserted node.\n * @throws {DOMException}\n * Throws a DOMException if inserting the node would result in a DOM tree that is not\n * well-formed. See {@link assertPreInsertionValidity1to5},\n * {@link assertPreInsertionValidityInDocument}.\n * @throws {DOMException}\n * Throws a DOMException if child is provided but is not a child of the parent. See\n * {@link Node.removeChild}\n * @private\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\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, node);\n\tif (node.nodeType == DOCUMENT_FRAGMENT_NODE) {\n\t\tnode.firstChild = node.lastChild = null;\n\t}\n\n\treturn node;\n}\n\nDocument.prototype = {\n\t/**\n\t * The implementation that created this document.\n\t *\n\t * @type DOMImplementation\n\t * @readonly\n\t */\n\timplementation: null,\n\tnodeName: '#document',\n\tnodeType: DOCUMENT_NODE,\n\t/**\n\t * The DocumentType node of the document.\n\t *\n\t * @type DocumentType\n\t * @readonly\n\t */\n\tdoctype: null,\n\tdocumentElement: null,\n\t_inc: 1,\n\n\tinsertBefore: function (newChild, refChild) {\n\t\t//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\tvar removed = _removeChild(this, oldChild);\n\t\tif (removed === this.documentElement) {\n\t\t\tthis.documentElement = null;\n\t\t}\n\t\treturn removed;\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: function (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 * Creates a new `Element` that is owned by this `Document`.\n\t * In HTML Documents `localName` is the lower cased `tagName`,\n\t * otherwise no transformation is being applied.\n\t * When `contentType` implies the HTML namespace, it will be set as `namespaceURI`.\n\t *\n\t * __This implementation differs from the specification:__ - The provided name is not checked\n\t * against the `Name` production,\n\t * so no related error will be thrown.\n\t * - There is no interface `HTMLElement`, it is always an `Element`.\n\t * - There is no support for a second argument to indicate using custom elements.\n\t *\n\t * @param {string} tagName\n\t * @returns {Element}\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement\n\t * @see https://dom.spec.whatwg.org/#dom-document-createelement\n\t * @see https://dom.spec.whatwg.org/#concept-create-element\n\t */\n\tcreateElement: function (tagName) {\n\t\tvar node = new Element(PDC);\n\t\tnode.ownerDocument = this;\n\t\tif (this.type === 'html') {\n\t\t\ttagName = tagName.toLowerCase();\n\t\t}\n\t\tif (hasDefaultHTMLNamespace(this.contentType)) {\n\t\t\tnode.namespaceURI = NAMESPACE.HTML;\n\t\t}\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 = (node.attributes = new NamedNodeMap());\n\t\tattrs._ownerElement = node;\n\t\treturn node;\n\t},\n\t/**\n\t * @returns {DocumentFragment}\n\t */\n\tcreateDocumentFragment: function () {\n\t\tvar node = new DocumentFragment(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\treturn node;\n\t},\n\t/**\n\t * @param {string} data\n\t * @returns {Text}\n\t */\n\tcreateTextNode: function (data) {\n\t\tvar node = new Text(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.appendData(data);\n\t\treturn node;\n\t},\n\t/**\n\t * @param {string} data\n\t * @returns {Comment}\n\t */\n\tcreateComment: function (data) {\n\t\tvar node = new Comment(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.appendData(data);\n\t\treturn node;\n\t},\n\t/**\n\t * @param {string} data\n\t * @returns {CDATASection}\n\t */\n\tcreateCDATASection: function (data) {\n\t\tvar node = new CDATASection(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.appendData(data);\n\t\treturn node;\n\t},\n\t/**\n\t * @param {string} target\n\t * @param {string} data\n\t * @returns {ProcessingInstruction}\n\t */\n\tcreateProcessingInstruction: function (target, data) {\n\t\tvar node = new ProcessingInstruction(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.nodeName = node.target = target;\n\t\tnode.nodeValue = node.data = data;\n\t\treturn node;\n\t},\n\t/**\n\t * Creates an `Attr` node that is owned by this document.\n\t * In HTML Documents `localName` is the lower cased `name`,\n\t * otherwise no transformation is being applied.\n\t *\n\t * __This implementation differs from the specification:__ - The provided name is not checked\n\t * against the `Name` production,\n\t * so no related error will be thrown.\n\t *\n\t * @param {string} name\n\t * @returns {Attr}\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createAttribute\n\t * @see https://dom.spec.whatwg.org/#dom-document-createattribute\n\t */\n\tcreateAttribute: function (name) {\n\t\tif (!g.QName_exact.test(name)) {\n\t\t\tthrow new DOMException(DOMException.INVALID_CHARACTER_ERR, 'invalid character in name \"' + name + '\"');\n\t\t}\n\t\tif (this.type === 'html') {\n\t\t\tname = name.toLowerCase();\n\t\t}\n\t\treturn this._createAttribute(name);\n\t},\n\t_createAttribute: function (name) {\n\t\tvar node = new Attr(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.name = name;\n\t\tnode.nodeName = name;\n\t\tnode.localName = name;\n\t\tnode.specified = true;\n\t\treturn node;\n\t},\n\t/**\n\t * Creates an EntityReference object.\n\t * The current implementation does not fill the `childNodes` with those of the corresponding\n\t * `Entity`\n\t *\n\t * @deprecated\n\t * In DOM Level 4.\n\t * @param {string} name\n\t * The name of the entity to reference. No namespace well-formedness checks are performed.\n\t * @returns {EntityReference}\n\t * @throws {DOMException}\n\t * With code `INVALID_CHARACTER_ERR` when `name` is not valid.\n\t * @throws {DOMException}\n\t * with code `NOT_SUPPORTED_ERR` when the document is of type `html`\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-392B75AE\n\t */\n\tcreateEntityReference: function (name) {\n\t\tif (!g.Name.test(name)) {\n\t\t\tthrow new DOMException(DOMException.INVALID_CHARACTER_ERR, 'not a valid xml name \"' + name + '\"');\n\t\t}\n\t\tif (this.type === 'html') {\n\t\t\tthrow new DOMException('document is an html document', DOMExceptionName.NotSupportedError);\n\t\t}\n\n\t\tvar node = new EntityReference(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.nodeName = name;\n\t\treturn node;\n\t},\n\t// Introduced in DOM Level 2:\n\t/**\n\t * @param {string} namespaceURI\n\t * @param {string} qualifiedName\n\t * @returns {Element}\n\t */\n\tcreateElementNS: function (namespaceURI, qualifiedName) {\n\t\tvar validated = validateAndExtract(namespaceURI, qualifiedName);\n\t\tvar node = new Element(PDC);\n\t\tvar attrs = (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 = validated[0];\n\t\tnode.prefix = validated[1];\n\t\tnode.localName = validated[2];\n\t\tattrs._ownerElement = node;\n\t\treturn node;\n\t},\n\t// Introduced in DOM Level 2:\n\t/**\n\t * @param {string} namespaceURI\n\t * @param {string} qualifiedName\n\t * @returns {Attr}\n\t */\n\tcreateAttributeNS: function (namespaceURI, qualifiedName) {\n\t\tvar validated = validateAndExtract(namespaceURI, qualifiedName);\n\t\tvar node = new Attr(PDC);\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.name = qualifiedName;\n\t\tnode.specified = true;\n\t\tnode.namespaceURI = validated[0];\n\t\tnode.prefix = validated[1];\n\t\tnode.localName = validated[2];\n\t\treturn node;\n\t},\n};\n_extends(Document, Node);\n\nfunction Element(symbol) {\n\tcheckSymbol(symbol);\n\n\tthis._nsMap = Object.create(null);\n}\nElement.prototype = {\n\tnodeType: ELEMENT_NODE,\n\t/**\n\t * The attributes of this element.\n\t *\n\t * @type {NamedNodeMap | null}\n\t */\n\tattributes: null,\n\tgetQualifiedName: function () {\n\t\treturn this.prefix ? this.prefix + ':' + this.localName : this.localName;\n\t},\n\t_isInHTMLDocumentAndNamespace: function () {\n\t\treturn this.ownerDocument.type === 'html' && this.namespaceURI === NAMESPACE.HTML;\n\t},\n\thasAttribute: function (name) {\n\t\treturn !!this.getAttributeNode(name);\n\t},\n\t/**\n\t * Returns element’s first attribute whose qualified name is `name`, and `null`\n\t * if there is no such attribute.\n\t *\n\t * @param {string} name\n\t * @returns {string | null}\n\t */\n\tgetAttribute: function (name) {\n\t\tvar attr = this.getAttributeNode(name);\n\t\treturn attr ? attr.value : null;\n\t},\n\tgetAttributeNode: function (name) {\n\t\tif (this._isInHTMLDocumentAndNamespace()) {\n\t\t\tname = name.toLowerCase();\n\t\t}\n\t\treturn this.attributes.getNamedItem(name);\n\t},\n\t/**\n\t * Sets the value of element’s first attribute whose qualified name is qualifiedName to value.\n\t *\n\t * @param {string} name\n\t * @param {string} value\n\t */\n\tsetAttribute: function (name, value) {\n\t\tif (this._isInHTMLDocumentAndNamespace()) {\n\t\t\tname = name.toLowerCase();\n\t\t}\n\t\tvar attr = this.getAttributeNode(name);\n\t\tif (attr) {\n\t\t\tattr.value = attr.nodeValue = '' + value;\n\t\t} else {\n\t\t\tattr = this.ownerDocument._createAttribute(name);\n\t\t\tattr.value = attr.nodeValue = '' + value;\n\t\t\tthis.setAttributeNode(attr);\n\t\t}\n\t},\n\tremoveAttribute: function (name) {\n\t\tvar attr = this.getAttributeNode(name);\n\t\tattr && this.removeAttributeNode(attr);\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\t/**\n\t * Returns element’s attribute whose namespace is `namespaceURI` and local name is\n\t * `localName`,\n\t * or `null` if there is no such attribute.\n\t *\n\t * @param {string} namespaceURI\n\t * @param {string} localName\n\t * @returns {string | null}\n\t */\n\tgetAttributeNS: function (namespaceURI, localName) {\n\t\tvar attr = this.getAttributeNodeNS(namespaceURI, localName);\n\t\treturn attr ? attr.value : null;\n\t},\n\t/**\n\t * Sets the value of element’s attribute whose namespace is `namespaceURI` and local name is\n\t * `localName` to value.\n\t *\n\t * @param {string} namespaceURI\n\t * @param {string} qualifiedName\n\t * @param {string} value\n\t * @see https://dom.spec.whatwg.org/#dom-element-setattributens\n\t */\n\tsetAttributeNS: function (namespaceURI, qualifiedName, value) {\n\t\tvar validated = validateAndExtract(namespaceURI, qualifiedName);\n\t\tvar localName = validated[2];\n\t\tvar attr = this.getAttributeNodeNS(namespaceURI, localName);\n\t\tif (attr) {\n\t\t\tattr.value = attr.nodeValue = '' + value;\n\t\t} else {\n\t\t\tattr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);\n\t\t\tattr.value = attr.nodeValue = '' + value;\n\t\t\tthis.setAttributeNode(attr);\n\t\t}\n\t},\n\tgetAttributeNodeNS: function (namespaceURI, localName) {\n\t\treturn this.attributes.getNamedItemNS(namespaceURI, localName);\n\t},\n\n\t/**\n\t * Returns a LiveNodeList of all child elements which have **all** of the given class name(s).\n\t *\n\t * Returns an empty list if `classNames` is an empty string or only contains HTML white space\n\t * characters.\n\t *\n\t * Warning: This returns 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\n\t * Is a string representing the class name(s) to match; multiple class names are separated by\n\t * (ASCII-)whitespace.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName\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, 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/**\n\t * Returns a LiveNodeList of elements with the given qualifiedName.\n\t * Searching for all descendants can be done by passing `*` as `qualifiedName`.\n\t *\n\t * All descendants of the specified element are searched, but not the element itself.\n\t * The returned list is live, which means it updates itself with the DOM tree automatically.\n\t * Therefore, there is no need to call `Element.getElementsByTagName()`\n\t * with the same element and arguments repeatedly if the DOM changes in between calls.\n\t *\n\t * When called on an HTML element in an HTML document,\n\t * `getElementsByTagName` lower-cases the argument before searching for it.\n\t * This is undesirable when trying to match camel-cased SVG elements (such as\n\t * ``) in an HTML document.\n\t * Instead, use `Element.getElementsByTagNameNS()`,\n\t * which preserves the capitalization of the tag name.\n\t *\n\t * `Element.getElementsByTagName` is similar to `Document.getElementsByTagName()`,\n\t * except that it only searches for elements that are descendants of the specified element.\n\t *\n\t * @param {string} qualifiedName\n\t * @returns {LiveNodeList}\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName\n\t * @see https://dom.spec.whatwg.org/#concept-getelementsbytagname\n\t */\n\tgetElementsByTagName: function (qualifiedName) {\n\t\tvar isHTMLDocument = (this.nodeType === DOCUMENT_NODE ? this : this.ownerDocument).type === 'html';\n\t\tvar lowerQualifiedName = qualifiedName.toLowerCase();\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) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (qualifiedName === '*') {\n\t\t\t\t\tls.push(node);\n\t\t\t\t} else {\n\t\t\t\t\tvar nodeQualifiedName = node.getQualifiedName();\n\t\t\t\t\tvar matchingQName = isHTMLDocument && node.namespaceURI === NAMESPACE.HTML ? lowerQualifiedName : qualifiedName;\n\t\t\t\t\tif (nodeQualifiedName === matchingQName) {\n\t\t\t\t\t\tls.push(node);\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\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 (\n\t\t\t\t\tnode !== base &&\n\t\t\t\t\tnode.nodeType === ELEMENT_NODE &&\n\t\t\t\t\t(namespaceURI === '*' || node.namespaceURI === namespaceURI) &&\n\t\t\t\t\t(localName === '*' || node.localName == localName)\n\t\t\t\t) {\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};\nDocument.prototype.getElementsByClassName = Element.prototype.getElementsByClassName;\nDocument.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;\nDocument.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;\n\n_extends(Element, Node);\nfunction Attr(symbol) {\n\tcheckSymbol(symbol);\n\n\tthis.namespaceURI = null;\n\tthis.prefix = null;\n\tthis.ownerElement = null;\n}\nAttr.prototype.nodeType = ATTRIBUTE_NODE;\n_extends(Attr, Node);\n\nfunction CharacterData(symbol) {\n\tcheckSymbol(symbol);\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\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(symbol) {\n\tcheckSymbol(symbol);\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(symbol) {\n\tcheckSymbol(symbol);\n}\nComment.prototype = {\n\tnodeName: '#comment',\n\tnodeType: COMMENT_NODE,\n};\n_extends(Comment, CharacterData);\n\nfunction CDATASection(symbol) {\n\tcheckSymbol(symbol);\n}\nCDATASection.prototype = {\n\tnodeName: '#cdata-section',\n\tnodeType: CDATA_SECTION_NODE,\n};\n_extends(CDATASection, Text);\n\nfunction DocumentType(symbol) {\n\tcheckSymbol(symbol);\n}\nDocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;\n_extends(DocumentType, Node);\n\nfunction Notation(symbol) {\n\tcheckSymbol(symbol);\n}\nNotation.prototype.nodeType = NOTATION_NODE;\n_extends(Notation, Node);\n\nfunction Entity(symbol) {\n\tcheckSymbol(symbol);\n}\nEntity.prototype.nodeType = ENTITY_NODE;\n_extends(Entity, Node);\n\nfunction EntityReference(symbol) {\n\tcheckSymbol(symbol);\n}\nEntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;\n_extends(EntityReference, Node);\n\nfunction DocumentFragment(symbol) {\n\tcheckSymbol(symbol);\n}\nDocumentFragment.prototype.nodeName = '#document-fragment';\nDocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;\n_extends(DocumentFragment, Node);\n\nfunction ProcessingInstruction(symbol) {\n\tcheckSymbol(symbol);\n}\nProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;\n_extends(ProcessingInstruction, CharacterData);\nfunction XMLSerializer() {}\nXMLSerializer.prototype.serializeToString = function (node, nodeFilter) {\n\treturn nodeSerializeToString.call(node, nodeFilter);\n};\nNode.prototype.toString = nodeSerializeToString;\nfunction nodeSerializeToString(nodeFilter) {\n\tvar buf = [];\n\tvar refNode = (this.nodeType === DOCUMENT_NODE && this.documentElement) || this;\n\tvar prefix = refNode.prefix;\n\tvar uri = refNode.namespaceURI;\n\n\tif (uri && prefix == null) {\n\t\tvar prefix = refNode.lookupPrefix(uri);\n\t\tif (prefix == null) {\n\t\t\tvar visibleNamespaces = [\n\t\t\t\t{ namespace: uri, prefix: null },\n\t\t\t\t//{namespace:uri,prefix:''}\n\t\t\t];\n\t\t}\n\t}\n\tserializeToString(this, buf, nodeFilter, visibleNamespaces);\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 * Literal whitespace other than space that appear in attribute values are serialized as\n * their entity references, so they will be preserved.\n * (In contrast to whitespace literals in the input which are normalized to spaces).\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 *\n * @see https://www.w3.org/TR/xml11/#CleanAttrVals\n * @see https://www.w3.org/TR/xml11/#NT-AttValue\n * @see https://www.w3.org/TR/xml11/#AVNormalize\n * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes\n * @prettierignore\n */\nfunction addSerializedAttribute(buf, qualifiedName, value) {\n\tbuf.push(' ', qualifiedName, '=\"', value.replace(/[<>&\"\\t\\n\\r]/g, _xmlEncoder), '\"');\n}\n\nfunction serializeToString(node, buf, nodeFilter, visibleNamespaces) {\n\tif (!visibleNamespaces) {\n\t\tvisibleNamespaces = [];\n\t}\n\tvar doc = node.nodeType === DOCUMENT_NODE ? node : node.ownerDocument;\n\tvar isHTML = doc.type === 'html';\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\t\tcase ELEMENT_NODE:\n\t\t\tvar attrs = node.attributes;\n\t\t\tvar len = attrs.length;\n\t\t\tvar child = node.firstChild;\n\t\t\tvar nodeName = node.tagName;\n\n\t\t\tvar prefixedNodeName = nodeName;\n\t\t\tif (!isHTML && !node.prefix && node.namespaceURI) {\n\t\t\t\tvar defaultNS;\n\t\t\t\t// lookup current default ns from `xmlns` attribute\n\t\t\t\tfor (var ai = 0; ai < attrs.length; ai++) {\n\t\t\t\t\tif (attrs.item(ai).name === 'xmlns') {\n\t\t\t\t\t\tdefaultNS = attrs.item(ai).value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!defaultNS) {\n\t\t\t\t\t// lookup current default ns in visibleNamespaces\n\t\t\t\t\tfor (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {\n\t\t\t\t\t\tvar namespace = visibleNamespaces[nsi];\n\t\t\t\t\t\tif (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {\n\t\t\t\t\t\t\tdefaultNS = namespace.namespace;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (defaultNS !== node.namespaceURI) {\n\t\t\t\t\tfor (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {\n\t\t\t\t\t\tvar namespace = visibleNamespaces[nsi];\n\t\t\t\t\t\tif (namespace.namespace === node.namespaceURI) {\n\t\t\t\t\t\t\tif (namespace.prefix) {\n\t\t\t\t\t\t\t\tprefixedNodeName = namespace.prefix + ':' + nodeName;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbuf.push('<', prefixedNodeName);\n\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\t// add namespaces for attributes\n\t\t\t\tvar attr = attrs.item(i);\n\t\t\t\tif (attr.prefix == 'xmlns') {\n\t\t\t\t\tvisibleNamespaces.push({\n\t\t\t\t\t\tprefix: attr.localName,\n\t\t\t\t\t\tnamespace: attr.value,\n\t\t\t\t\t});\n\t\t\t\t} else if (attr.nodeName == 'xmlns') {\n\t\t\t\t\tvisibleNamespaces.push({ prefix: '', namespace: attr.value });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tvar attr = attrs.item(i);\n\t\t\t\tif (needNamespaceDefine(attr, isHTML, visibleNamespaces)) {\n\t\t\t\t\tvar prefix = attr.prefix || '';\n\t\t\t\t\tvar uri = attr.namespaceURI;\n\t\t\t\t\taddSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : 'xmlns', uri);\n\t\t\t\t\tvisibleNamespaces.push({ prefix: prefix, namespace: uri });\n\t\t\t\t}\n\t\t\t\tserializeToString(attr, buf, nodeFilter, visibleNamespaces);\n\t\t\t}\n\n\t\t\t// add namespace for current node\n\t\t\tif (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {\n\t\t\t\tvar prefix = node.prefix || '';\n\t\t\t\tvar uri = node.namespaceURI;\n\t\t\t\taddSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : 'xmlns', uri);\n\t\t\t\tvisibleNamespaces.push({ prefix: prefix, namespace: uri });\n\t\t\t}\n\t\t\t// in XML elements can be closed when they have no children\n\t\t\tvar canCloseTag = !child;\n\t\t\tif (canCloseTag && (isHTML || node.namespaceURI === NAMESPACE.HTML)) {\n\t\t\t\t// in HTML (doc or ns) only void elements can be closed right away\n\t\t\t\tcanCloseTag = isHTMLVoidElement(nodeName);\n\t\t\t}\n\t\t\tif (canCloseTag) {\n\t\t\t\tbuf.push('/>');\n\t\t\t} else {\n\t\t\t\tbuf.push('>');\n\t\t\t\t//if is cdata child node\n\t\t\t\tif (isHTML && isHTMLRawTextElement(nodeName)) {\n\t\t\t\t\twhile (child) {\n\t\t\t\t\t\tif (child.data) {\n\t\t\t\t\t\t\tbuf.push(child.data);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tserializeToString(child, buf, nodeFilter, visibleNamespaces.slice());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchild = child.nextSibling;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\twhile (child) {\n\t\t\t\t\t\tserializeToString(child, buf, nodeFilter, visibleNamespaces.slice());\n\t\t\t\t\t\tchild = child.nextSibling;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbuf.push('');\n\t\t\t}\n\t\t\t// remove added visible namespaces\n\t\t\t//visibleNamespaces.length = startVisibleNamespaces;\n\t\t\treturn;\n\t\tcase DOCUMENT_NODE:\n\t\tcase DOCUMENT_FRAGMENT_NODE:\n\t\t\tvar child = node.firstChild;\n\t\t\twhile (child) {\n\t\t\t\tserializeToString(child, buf, nodeFilter, visibleNamespaces.slice());\n\t\t\t\tchild = child.nextSibling;\n\t\t\t}\n\t\t\treturn;\n\t\tcase ATTRIBUTE_NODE:\n\t\t\treturn addSerializedAttribute(buf, node.name, node.value);\n\t\tcase TEXT_NODE:\n\t\t\t/*\n\t\t\t * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,\n\t\t\t * except when used as markup delimiters, or within a comment, a processing instruction,\n\t\t\t * or a CDATA section.\n\t\t\t * If they are needed elsewhere, they must be escaped using either numeric character\n\t\t\t * references or the strings `&` and `<` respectively.\n\t\t\t * The right angle bracket (>) may be represented using the string \" > \",\n\t\t\t * and must, for compatibility, be escaped using either `>`,\n\t\t\t * or a character reference when it appears in the string `]]>` in content,\n\t\t\t * when that string is not marking the end of a CDATA section.\n\t\t\t *\n\t\t\t * In the content of elements, character data is any string of characters which does not\n\t\t\t * contain the start-delimiter of any markup and does not include the CDATA-section-close\n\t\t\t * delimiter, `]]>`.\n\t\t\t *\n\t\t\t * @see https://www.w3.org/TR/xml/#NT-CharData\n\t\t\t * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node\n\t\t\t */\n\t\t\treturn buf.push(node.data.replace(/[<&>]/g, _xmlEncoder));\n\t\tcase CDATA_SECTION_NODE:\n\t\t\treturn buf.push(g.CDATA_START, node.data, g.CDATA_END);\n\t\tcase COMMENT_NODE:\n\t\t\treturn buf.push(g.COMMENT_START, node.data, g.COMMENT_END);\n\t\tcase DOCUMENT_TYPE_NODE:\n\t\t\tvar pubid = node.publicId;\n\t\t\tvar sysid = node.systemId;\n\t\t\tbuf.push(g.DOCTYPE_DECL_START, ' ', node.name);\n\t\t\tif (pubid) {\n\t\t\t\tbuf.push(' ', g.PUBLIC, ' ', pubid);\n\t\t\t\tif (sysid && sysid !== '.') {\n\t\t\t\t\tbuf.push(' ', sysid);\n\t\t\t\t}\n\t\t\t} else if (sysid && sysid !== '.') {\n\t\t\t\tbuf.push(' ', g.SYSTEM, ' ', sysid);\n\t\t\t}\n\t\t\tif (node.internalSubset) {\n\t\t\t\tbuf.push(' [', node.internalSubset, ']');\n\t\t\t}\n\t\t\tbuf.push('>');\n\t\t\treturn;\n\t\tcase PROCESSING_INSTRUCTION_NODE:\n\t\t\treturn buf.push('');\n\t\tcase ENTITY_REFERENCE_NODE:\n\t\t\treturn buf.push('&', node.nodeName, ';');\n\t\t//case ENTITY_NODE:\n\t\t//case NOTATION_NODE:\n\t\tdefault:\n\t\t\tbuf.push('??', node.nodeName);\n\t}\n}\nfunction importNode(doc, node, deep) {\n\tvar node2;\n\tswitch (node.nodeType) {\n\t\tcase ELEMENT_NODE:\n\t\t\tnode2 = node.cloneNode(false);\n\t\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',\n\tlt: '<',\n\tquot: '\"',\n});\n\n/**\n * A map of all entities that are detected in an HTML document.\n * They contain all entries from `XML_ENTITIES`.\n *\n * @see {@link XML_ENTITIES}\n * @see {@link DOMParser.parseFromString}\n * @see {@link DOMImplementation.prototype.createHTMLDocument}\n * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5)\n * Spec\n * @see https://html.spec.whatwg.org/entities.json JSON\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\n * Wikipedia (HTML)\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML\n * Wikpedia (XHTML)\n */\nexports.HTML_ENTITIES = freeze({\n\tAacute: '\\u00C1',\n\taacute: '\\u00E1',\n\tAbreve: '\\u0102',\n\tabreve: '\\u0103',\n\tac: '\\u223E',\n\tacd: '\\u223F',\n\tacE: '\\u223E\\u0333',\n\tAcirc: '\\u00C2',\n\tacirc: '\\u00E2',\n\tacute: '\\u00B4',\n\tAcy: '\\u0410',\n\tacy: '\\u0430',\n\tAElig: '\\u00C6',\n\taelig: '\\u00E6',\n\taf: '\\u2061',\n\tAfr: '\\uD835\\uDD04',\n\tafr: '\\uD835\\uDD1E',\n\tAgrave: '\\u00C0',\n\tagrave: '\\u00E0',\n\talefsym: '\\u2135',\n\taleph: '\\u2135',\n\tAlpha: '\\u0391',\n\talpha: '\\u03B1',\n\tAmacr: '\\u0100',\n\tamacr: '\\u0101',\n\tamalg: '\\u2A3F',\n\tAMP: '\\u0026',\n\tamp: '\\u0026',\n\tAnd: '\\u2A53',\n\tand: '\\u2227',\n\tandand: '\\u2A55',\n\tandd: '\\u2A5C',\n\tandslope: '\\u2A58',\n\tandv: '\\u2A5A',\n\tang: '\\u2220',\n\tange: '\\u29A4',\n\tangle: '\\u2220',\n\tangmsd: '\\u2221',\n\tangmsdaa: '\\u29A8',\n\tangmsdab: '\\u29A9',\n\tangmsdac: '\\u29AA',\n\tangmsdad: '\\u29AB',\n\tangmsdae: '\\u29AC',\n\tangmsdaf: '\\u29AD',\n\tangmsdag: '\\u29AE',\n\tangmsdah: '\\u29AF',\n\tangrt: '\\u221F',\n\tangrtvb: '\\u22BE',\n\tangrtvbd: '\\u299D',\n\tangsph: '\\u2222',\n\tangst: '\\u00C5',\n\tangzarr: '\\u237C',\n\tAogon: '\\u0104',\n\taogon: '\\u0105',\n\tAopf: '\\uD835\\uDD38',\n\taopf: '\\uD835\\uDD52',\n\tap: '\\u2248',\n\tapacir: '\\u2A6F',\n\tapE: '\\u2A70',\n\tape: '\\u224A',\n\tapid: '\\u224B',\n\tapos: '\\u0027',\n\tApplyFunction: '\\u2061',\n\tapprox: '\\u2248',\n\tapproxeq: '\\u224A',\n\tAring: '\\u00C5',\n\taring: '\\u00E5',\n\tAscr: '\\uD835\\uDC9C',\n\tascr: '\\uD835\\uDCB6',\n\tAssign: '\\u2254',\n\tast: '\\u002A',\n\tasymp: '\\u2248',\n\tasympeq: '\\u224D',\n\tAtilde: '\\u00C3',\n\tatilde: '\\u00E3',\n\tAuml: '\\u00C4',\n\tauml: '\\u00E4',\n\tawconint: '\\u2233',\n\tawint: '\\u2A11',\n\tbackcong: '\\u224C',\n\tbackepsilon: '\\u03F6',\n\tbackprime: '\\u2035',\n\tbacksim: '\\u223D',\n\tbacksimeq: '\\u22CD',\n\tBackslash: '\\u2216',\n\tBarv: '\\u2AE7',\n\tbarvee: '\\u22BD',\n\tBarwed: '\\u2306',\n\tbarwed: '\\u2305',\n\tbarwedge: '\\u2305',\n\tbbrk: '\\u23B5',\n\tbbrktbrk: '\\u23B6',\n\tbcong: '\\u224C',\n\tBcy: '\\u0411',\n\tbcy: '\\u0431',\n\tbdquo: '\\u201E',\n\tbecaus: '\\u2235',\n\tBecause: '\\u2235',\n\tbecause: '\\u2235',\n\tbemptyv: '\\u29B0',\n\tbepsi: '\\u03F6',\n\tbernou: '\\u212C',\n\tBernoullis: '\\u212C',\n\tBeta: '\\u0392',\n\tbeta: '\\u03B2',\n\tbeth: '\\u2136',\n\tbetween: '\\u226C',\n\tBfr: '\\uD835\\uDD05',\n\tbfr: '\\uD835\\uDD1F',\n\tbigcap: '\\u22C2',\n\tbigcirc: '\\u25EF',\n\tbigcup: '\\u22C3',\n\tbigodot: '\\u2A00',\n\tbigoplus: '\\u2A01',\n\tbigotimes: '\\u2A02',\n\tbigsqcup: '\\u2A06',\n\tbigstar: '\\u2605',\n\tbigtriangledown: '\\u25BD',\n\tbigtriangleup: '\\u25B3',\n\tbiguplus: '\\u2A04',\n\tbigvee: '\\u22C1',\n\tbigwedge: '\\u22C0',\n\tbkarow: '\\u290D',\n\tblacklozenge: '\\u29EB',\n\tblacksquare: '\\u25AA',\n\tblacktriangle: '\\u25B4',\n\tblacktriangledown: '\\u25BE',\n\tblacktriangleleft: '\\u25C2',\n\tblacktriangleright: '\\u25B8',\n\tblank: '\\u2423',\n\tblk12: '\\u2592',\n\tblk14: '\\u2591',\n\tblk34: '\\u2593',\n\tblock: '\\u2588',\n\tbne: '\\u003D\\u20E5',\n\tbnequiv: '\\u2261\\u20E5',\n\tbNot: '\\u2AED',\n\tbnot: '\\u2310',\n\tBopf: '\\uD835\\uDD39',\n\tbopf: '\\uD835\\uDD53',\n\tbot: '\\u22A5',\n\tbottom: '\\u22A5',\n\tbowtie: '\\u22C8',\n\tboxbox: '\\u29C9',\n\tboxDL: '\\u2557',\n\tboxDl: '\\u2556',\n\tboxdL: '\\u2555',\n\tboxdl: '\\u2510',\n\tboxDR: '\\u2554',\n\tboxDr: '\\u2553',\n\tboxdR: '\\u2552',\n\tboxdr: '\\u250C',\n\tboxH: '\\u2550',\n\tboxh: '\\u2500',\n\tboxHD: '\\u2566',\n\tboxHd: '\\u2564',\n\tboxhD: '\\u2565',\n\tboxhd: '\\u252C',\n\tboxHU: '\\u2569',\n\tboxHu: '\\u2567',\n\tboxhU: '\\u2568',\n\tboxhu: '\\u2534',\n\tboxminus: '\\u229F',\n\tboxplus: '\\u229E',\n\tboxtimes: '\\u22A0',\n\tboxUL: '\\u255D',\n\tboxUl: '\\u255C',\n\tboxuL: '\\u255B',\n\tboxul: '\\u2518',\n\tboxUR: '\\u255A',\n\tboxUr: '\\u2559',\n\tboxuR: '\\u2558',\n\tboxur: '\\u2514',\n\tboxV: '\\u2551',\n\tboxv: '\\u2502',\n\tboxVH: '\\u256C',\n\tboxVh: '\\u256B',\n\tboxvH: '\\u256A',\n\tboxvh: '\\u253C',\n\tboxVL: '\\u2563',\n\tboxVl: '\\u2562',\n\tboxvL: '\\u2561',\n\tboxvl: '\\u2524',\n\tboxVR: '\\u2560',\n\tboxVr: '\\u255F',\n\tboxvR: '\\u255E',\n\tboxvr: '\\u251C',\n\tbprime: '\\u2035',\n\tBreve: '\\u02D8',\n\tbreve: '\\u02D8',\n\tbrvbar: '\\u00A6',\n\tBscr: '\\u212C',\n\tbscr: '\\uD835\\uDCB7',\n\tbsemi: '\\u204F',\n\tbsim: '\\u223D',\n\tbsime: '\\u22CD',\n\tbsol: '\\u005C',\n\tbsolb: '\\u29C5',\n\tbsolhsub: '\\u27C8',\n\tbull: '\\u2022',\n\tbullet: '\\u2022',\n\tbump: '\\u224E',\n\tbumpE: '\\u2AAE',\n\tbumpe: '\\u224F',\n\tBumpeq: '\\u224E',\n\tbumpeq: '\\u224F',\n\tCacute: '\\u0106',\n\tcacute: '\\u0107',\n\tCap: '\\u22D2',\n\tcap: '\\u2229',\n\tcapand: '\\u2A44',\n\tcapbrcup: '\\u2A49',\n\tcapcap: '\\u2A4B',\n\tcapcup: '\\u2A47',\n\tcapdot: '\\u2A40',\n\tCapitalDifferentialD: '\\u2145',\n\tcaps: '\\u2229\\uFE00',\n\tcaret: '\\u2041',\n\tcaron: '\\u02C7',\n\tCayleys: '\\u212D',\n\tccaps: '\\u2A4D',\n\tCcaron: '\\u010C',\n\tccaron: '\\u010D',\n\tCcedil: '\\u00C7',\n\tccedil: '\\u00E7',\n\tCcirc: '\\u0108',\n\tccirc: '\\u0109',\n\tCconint: '\\u2230',\n\tccups: '\\u2A4C',\n\tccupssm: '\\u2A50',\n\tCdot: '\\u010A',\n\tcdot: '\\u010B',\n\tcedil: '\\u00B8',\n\tCedilla: '\\u00B8',\n\tcemptyv: '\\u29B2',\n\tcent: '\\u00A2',\n\tCenterDot: '\\u00B7',\n\tcenterdot: '\\u00B7',\n\tCfr: '\\u212D',\n\tcfr: '\\uD835\\uDD20',\n\tCHcy: '\\u0427',\n\tchcy: '\\u0447',\n\tcheck: '\\u2713',\n\tcheckmark: '\\u2713',\n\tChi: '\\u03A7',\n\tchi: '\\u03C7',\n\tcir: '\\u25CB',\n\tcirc: '\\u02C6',\n\tcirceq: '\\u2257',\n\tcirclearrowleft: '\\u21BA',\n\tcirclearrowright: '\\u21BB',\n\tcircledast: '\\u229B',\n\tcircledcirc: '\\u229A',\n\tcircleddash: '\\u229D',\n\tCircleDot: '\\u2299',\n\tcircledR: '\\u00AE',\n\tcircledS: '\\u24C8',\n\tCircleMinus: '\\u2296',\n\tCirclePlus: '\\u2295',\n\tCircleTimes: '\\u2297',\n\tcirE: '\\u29C3',\n\tcire: '\\u2257',\n\tcirfnint: '\\u2A10',\n\tcirmid: '\\u2AEF',\n\tcirscir: '\\u29C2',\n\tClockwiseContourIntegral: '\\u2232',\n\tCloseCurlyDoubleQuote: '\\u201D',\n\tCloseCurlyQuote: '\\u2019',\n\tclubs: '\\u2663',\n\tclubsuit: '\\u2663',\n\tColon: '\\u2237',\n\tcolon: '\\u003A',\n\tColone: '\\u2A74',\n\tcolone: '\\u2254',\n\tcoloneq: '\\u2254',\n\tcomma: '\\u002C',\n\tcommat: '\\u0040',\n\tcomp: '\\u2201',\n\tcompfn: '\\u2218',\n\tcomplement: '\\u2201',\n\tcomplexes: '\\u2102',\n\tcong: '\\u2245',\n\tcongdot: '\\u2A6D',\n\tCongruent: '\\u2261',\n\tConint: '\\u222F',\n\tconint: '\\u222E',\n\tContourIntegral: '\\u222E',\n\tCopf: '\\u2102',\n\tcopf: '\\uD835\\uDD54',\n\tcoprod: '\\u2210',\n\tCoproduct: '\\u2210',\n\tCOPY: '\\u00A9',\n\tcopy: '\\u00A9',\n\tcopysr: '\\u2117',\n\tCounterClockwiseContourIntegral: '\\u2233',\n\tcrarr: '\\u21B5',\n\tCross: '\\u2A2F',\n\tcross: '\\u2717',\n\tCscr: '\\uD835\\uDC9E',\n\tcscr: '\\uD835\\uDCB8',\n\tcsub: '\\u2ACF',\n\tcsube: '\\u2AD1',\n\tcsup: '\\u2AD0',\n\tcsupe: '\\u2AD2',\n\tctdot: '\\u22EF',\n\tcudarrl: '\\u2938',\n\tcudarrr: '\\u2935',\n\tcuepr: '\\u22DE',\n\tcuesc: '\\u22DF',\n\tcularr: '\\u21B6',\n\tcularrp: '\\u293D',\n\tCup: '\\u22D3',\n\tcup: '\\u222A',\n\tcupbrcap: '\\u2A48',\n\tCupCap: '\\u224D',\n\tcupcap: '\\u2A46',\n\tcupcup: '\\u2A4A',\n\tcupdot: '\\u228D',\n\tcupor: '\\u2A45',\n\tcups: '\\u222A\\uFE00',\n\tcurarr: '\\u21B7',\n\tcurarrm: '\\u293C',\n\tcurlyeqprec: '\\u22DE',\n\tcurlyeqsucc: '\\u22DF',\n\tcurlyvee: '\\u22CE',\n\tcurlywedge: '\\u22CF',\n\tcurren: '\\u00A4',\n\tcurvearrowleft: '\\u21B6',\n\tcurvearrowright: '\\u21B7',\n\tcuvee: '\\u22CE',\n\tcuwed: '\\u22CF',\n\tcwconint: '\\u2232',\n\tcwint: '\\u2231',\n\tcylcty: '\\u232D',\n\tDagger: '\\u2021',\n\tdagger: '\\u2020',\n\tdaleth: '\\u2138',\n\tDarr: '\\u21A1',\n\tdArr: '\\u21D3',\n\tdarr: '\\u2193',\n\tdash: '\\u2010',\n\tDashv: '\\u2AE4',\n\tdashv: '\\u22A3',\n\tdbkarow: '\\u290F',\n\tdblac: '\\u02DD',\n\tDcaron: '\\u010E',\n\tdcaron: '\\u010F',\n\tDcy: '\\u0414',\n\tdcy: '\\u0434',\n\tDD: '\\u2145',\n\tdd: '\\u2146',\n\tddagger: '\\u2021',\n\tddarr: '\\u21CA',\n\tDDotrahd: '\\u2911',\n\tddotseq: '\\u2A77',\n\tdeg: '\\u00B0',\n\tDel: '\\u2207',\n\tDelta: '\\u0394',\n\tdelta: '\\u03B4',\n\tdemptyv: '\\u29B1',\n\tdfisht: '\\u297F',\n\tDfr: '\\uD835\\uDD07',\n\tdfr: '\\uD835\\uDD21',\n\tdHar: '\\u2965',\n\tdharl: '\\u21C3',\n\tdharr: '\\u21C2',\n\tDiacriticalAcute: '\\u00B4',\n\tDiacriticalDot: '\\u02D9',\n\tDiacriticalDoubleAcute: '\\u02DD',\n\tDiacriticalGrave: '\\u0060',\n\tDiacriticalTilde: '\\u02DC',\n\tdiam: '\\u22C4',\n\tDiamond: '\\u22C4',\n\tdiamond: '\\u22C4',\n\tdiamondsuit: '\\u2666',\n\tdiams: '\\u2666',\n\tdie: '\\u00A8',\n\tDifferentialD: '\\u2146',\n\tdigamma: '\\u03DD',\n\tdisin: '\\u22F2',\n\tdiv: '\\u00F7',\n\tdivide: '\\u00F7',\n\tdivideontimes: '\\u22C7',\n\tdivonx: '\\u22C7',\n\tDJcy: '\\u0402',\n\tdjcy: '\\u0452',\n\tdlcorn: '\\u231E',\n\tdlcrop: '\\u230D',\n\tdollar: '\\u0024',\n\tDopf: '\\uD835\\uDD3B',\n\tdopf: '\\uD835\\uDD55',\n\tDot: '\\u00A8',\n\tdot: '\\u02D9',\n\tDotDot: '\\u20DC',\n\tdoteq: '\\u2250',\n\tdoteqdot: '\\u2251',\n\tDotEqual: '\\u2250',\n\tdotminus: '\\u2238',\n\tdotplus: '\\u2214',\n\tdotsquare: '\\u22A1',\n\tdoublebarwedge: '\\u2306',\n\tDoubleContourIntegral: '\\u222F',\n\tDoubleDot: '\\u00A8',\n\tDoubleDownArrow: '\\u21D3',\n\tDoubleLeftArrow: '\\u21D0',\n\tDoubleLeftRightArrow: '\\u21D4',\n\tDoubleLeftTee: '\\u2AE4',\n\tDoubleLongLeftArrow: '\\u27F8',\n\tDoubleLongLeftRightArrow: '\\u27FA',\n\tDoubleLongRightArrow: '\\u27F9',\n\tDoubleRightArrow: '\\u21D2',\n\tDoubleRightTee: '\\u22A8',\n\tDoubleUpArrow: '\\u21D1',\n\tDoubleUpDownArrow: '\\u21D5',\n\tDoubleVerticalBar: '\\u2225',\n\tDownArrow: '\\u2193',\n\tDownarrow: '\\u21D3',\n\tdownarrow: '\\u2193',\n\tDownArrowBar: '\\u2913',\n\tDownArrowUpArrow: '\\u21F5',\n\tDownBreve: '\\u0311',\n\tdowndownarrows: '\\u21CA',\n\tdownharpoonleft: '\\u21C3',\n\tdownharpoonright: '\\u21C2',\n\tDownLeftRightVector: '\\u2950',\n\tDownLeftTeeVector: '\\u295E',\n\tDownLeftVector: '\\u21BD',\n\tDownLeftVectorBar: '\\u2956',\n\tDownRightTeeVector: '\\u295F',\n\tDownRightVector: '\\u21C1',\n\tDownRightVectorBar: '\\u2957',\n\tDownTee: '\\u22A4',\n\tDownTeeArrow: '\\u21A7',\n\tdrbkarow: '\\u2910',\n\tdrcorn: '\\u231F',\n\tdrcrop: '\\u230C',\n\tDscr: '\\uD835\\uDC9F',\n\tdscr: '\\uD835\\uDCB9',\n\tDScy: '\\u0405',\n\tdscy: '\\u0455',\n\tdsol: '\\u29F6',\n\tDstrok: '\\u0110',\n\tdstrok: '\\u0111',\n\tdtdot: '\\u22F1',\n\tdtri: '\\u25BF',\n\tdtrif: '\\u25BE',\n\tduarr: '\\u21F5',\n\tduhar: '\\u296F',\n\tdwangle: '\\u29A6',\n\tDZcy: '\\u040F',\n\tdzcy: '\\u045F',\n\tdzigrarr: '\\u27FF',\n\tEacute: '\\u00C9',\n\teacute: '\\u00E9',\n\teaster: '\\u2A6E',\n\tEcaron: '\\u011A',\n\tecaron: '\\u011B',\n\tecir: '\\u2256',\n\tEcirc: '\\u00CA',\n\tecirc: '\\u00EA',\n\tecolon: '\\u2255',\n\tEcy: '\\u042D',\n\tecy: '\\u044D',\n\teDDot: '\\u2A77',\n\tEdot: '\\u0116',\n\teDot: '\\u2251',\n\tedot: '\\u0117',\n\tee: '\\u2147',\n\tefDot: '\\u2252',\n\tEfr: '\\uD835\\uDD08',\n\tefr: '\\uD835\\uDD22',\n\teg: '\\u2A9A',\n\tEgrave: '\\u00C8',\n\tegrave: '\\u00E8',\n\tegs: '\\u2A96',\n\tegsdot: '\\u2A98',\n\tel: '\\u2A99',\n\tElement: '\\u2208',\n\telinters: '\\u23E7',\n\tell: '\\u2113',\n\tels: '\\u2A95',\n\telsdot: '\\u2A97',\n\tEmacr: '\\u0112',\n\temacr: '\\u0113',\n\tempty: '\\u2205',\n\temptyset: '\\u2205',\n\tEmptySmallSquare: '\\u25FB',\n\temptyv: '\\u2205',\n\tEmptyVerySmallSquare: '\\u25AB',\n\temsp: '\\u2003',\n\temsp13: '\\u2004',\n\temsp14: '\\u2005',\n\tENG: '\\u014A',\n\teng: '\\u014B',\n\tensp: '\\u2002',\n\tEogon: '\\u0118',\n\teogon: '\\u0119',\n\tEopf: '\\uD835\\uDD3C',\n\teopf: '\\uD835\\uDD56',\n\tepar: '\\u22D5',\n\teparsl: '\\u29E3',\n\teplus: '\\u2A71',\n\tepsi: '\\u03B5',\n\tEpsilon: '\\u0395',\n\tepsilon: '\\u03B5',\n\tepsiv: '\\u03F5',\n\teqcirc: '\\u2256',\n\teqcolon: '\\u2255',\n\teqsim: '\\u2242',\n\teqslantgtr: '\\u2A96',\n\teqslantless: '\\u2A95',\n\tEqual: '\\u2A75',\n\tequals: '\\u003D',\n\tEqualTilde: '\\u2242',\n\tequest: '\\u225F',\n\tEquilibrium: '\\u21CC',\n\tequiv: '\\u2261',\n\tequivDD: '\\u2A78',\n\teqvparsl: '\\u29E5',\n\terarr: '\\u2971',\n\terDot: '\\u2253',\n\tEscr: '\\u2130',\n\tescr: '\\u212F',\n\tesdot: '\\u2250',\n\tEsim: '\\u2A73',\n\tesim: '\\u2242',\n\tEta: '\\u0397',\n\teta: '\\u03B7',\n\tETH: '\\u00D0',\n\teth: '\\u00F0',\n\tEuml: '\\u00CB',\n\teuml: '\\u00EB',\n\teuro: '\\u20AC',\n\texcl: '\\u0021',\n\texist: '\\u2203',\n\tExists: '\\u2203',\n\texpectation: '\\u2130',\n\tExponentialE: '\\u2147',\n\texponentiale: '\\u2147',\n\tfallingdotseq: '\\u2252',\n\tFcy: '\\u0424',\n\tfcy: '\\u0444',\n\tfemale: '\\u2640',\n\tffilig: '\\uFB03',\n\tfflig: '\\uFB00',\n\tffllig: '\\uFB04',\n\tFfr: '\\uD835\\uDD09',\n\tffr: '\\uD835\\uDD23',\n\tfilig: '\\uFB01',\n\tFilledSmallSquare: '\\u25FC',\n\tFilledVerySmallSquare: '\\u25AA',\n\tfjlig: '\\u0066\\u006A',\n\tflat: '\\u266D',\n\tfllig: '\\uFB02',\n\tfltns: '\\u25B1',\n\tfnof: '\\u0192',\n\tFopf: '\\uD835\\uDD3D',\n\tfopf: '\\uD835\\uDD57',\n\tForAll: '\\u2200',\n\tforall: '\\u2200',\n\tfork: '\\u22D4',\n\tforkv: '\\u2AD9',\n\tFouriertrf: '\\u2131',\n\tfpartint: '\\u2A0D',\n\tfrac12: '\\u00BD',\n\tfrac13: '\\u2153',\n\tfrac14: '\\u00BC',\n\tfrac15: '\\u2155',\n\tfrac16: '\\u2159',\n\tfrac18: '\\u215B',\n\tfrac23: '\\u2154',\n\tfrac25: '\\u2156',\n\tfrac34: '\\u00BE',\n\tfrac35: '\\u2157',\n\tfrac38: '\\u215C',\n\tfrac45: '\\u2158',\n\tfrac56: '\\u215A',\n\tfrac58: '\\u215D',\n\tfrac78: '\\u215E',\n\tfrasl: '\\u2044',\n\tfrown: '\\u2322',\n\tFscr: '\\u2131',\n\tfscr: '\\uD835\\uDCBB',\n\tgacute: '\\u01F5',\n\tGamma: '\\u0393',\n\tgamma: '\\u03B3',\n\tGammad: '\\u03DC',\n\tgammad: '\\u03DD',\n\tgap: '\\u2A86',\n\tGbreve: '\\u011E',\n\tgbreve: '\\u011F',\n\tGcedil: '\\u0122',\n\tGcirc: '\\u011C',\n\tgcirc: '\\u011D',\n\tGcy: '\\u0413',\n\tgcy: '\\u0433',\n\tGdot: '\\u0120',\n\tgdot: '\\u0121',\n\tgE: '\\u2267',\n\tge: '\\u2265',\n\tgEl: '\\u2A8C',\n\tgel: '\\u22DB',\n\tgeq: '\\u2265',\n\tgeqq: '\\u2267',\n\tgeqslant: '\\u2A7E',\n\tges: '\\u2A7E',\n\tgescc: '\\u2AA9',\n\tgesdot: '\\u2A80',\n\tgesdoto: '\\u2A82',\n\tgesdotol: '\\u2A84',\n\tgesl: '\\u22DB\\uFE00',\n\tgesles: '\\u2A94',\n\tGfr: '\\uD835\\uDD0A',\n\tgfr: '\\uD835\\uDD24',\n\tGg: '\\u22D9',\n\tgg: '\\u226B',\n\tggg: '\\u22D9',\n\tgimel: '\\u2137',\n\tGJcy: '\\u0403',\n\tgjcy: '\\u0453',\n\tgl: '\\u2277',\n\tgla: '\\u2AA5',\n\tglE: '\\u2A92',\n\tglj: '\\u2AA4',\n\tgnap: '\\u2A8A',\n\tgnapprox: '\\u2A8A',\n\tgnE: '\\u2269',\n\tgne: '\\u2A88',\n\tgneq: '\\u2A88',\n\tgneqq: '\\u2269',\n\tgnsim: '\\u22E7',\n\tGopf: '\\uD835\\uDD3E',\n\tgopf: '\\uD835\\uDD58',\n\tgrave: '\\u0060',\n\tGreaterEqual: '\\u2265',\n\tGreaterEqualLess: '\\u22DB',\n\tGreaterFullEqual: '\\u2267',\n\tGreaterGreater: '\\u2AA2',\n\tGreaterLess: '\\u2277',\n\tGreaterSlantEqual: '\\u2A7E',\n\tGreaterTilde: '\\u2273',\n\tGscr: '\\uD835\\uDCA2',\n\tgscr: '\\u210A',\n\tgsim: '\\u2273',\n\tgsime: '\\u2A8E',\n\tgsiml: '\\u2A90',\n\tGt: '\\u226B',\n\tGT: '\\u003E',\n\tgt: '\\u003E',\n\tgtcc: '\\u2AA7',\n\tgtcir: '\\u2A7A',\n\tgtdot: '\\u22D7',\n\tgtlPar: '\\u2995',\n\tgtquest: '\\u2A7C',\n\tgtrapprox: '\\u2A86',\n\tgtrarr: '\\u2978',\n\tgtrdot: '\\u22D7',\n\tgtreqless: '\\u22DB',\n\tgtreqqless: '\\u2A8C',\n\tgtrless: '\\u2277',\n\tgtrsim: '\\u2273',\n\tgvertneqq: '\\u2269\\uFE00',\n\tgvnE: '\\u2269\\uFE00',\n\tHacek: '\\u02C7',\n\thairsp: '\\u200A',\n\thalf: '\\u00BD',\n\thamilt: '\\u210B',\n\tHARDcy: '\\u042A',\n\thardcy: '\\u044A',\n\thArr: '\\u21D4',\n\tharr: '\\u2194',\n\tharrcir: '\\u2948',\n\tharrw: '\\u21AD',\n\tHat: '\\u005E',\n\thbar: '\\u210F',\n\tHcirc: '\\u0124',\n\thcirc: '\\u0125',\n\thearts: '\\u2665',\n\theartsuit: '\\u2665',\n\thellip: '\\u2026',\n\thercon: '\\u22B9',\n\tHfr: '\\u210C',\n\thfr: '\\uD835\\uDD25',\n\tHilbertSpace: '\\u210B',\n\thksearow: '\\u2925',\n\thkswarow: '\\u2926',\n\thoarr: '\\u21FF',\n\thomtht: '\\u223B',\n\thookleftarrow: '\\u21A9',\n\thookrightarrow: '\\u21AA',\n\tHopf: '\\u210D',\n\thopf: '\\uD835\\uDD59',\n\thorbar: '\\u2015',\n\tHorizontalLine: '\\u2500',\n\tHscr: '\\u210B',\n\thscr: '\\uD835\\uDCBD',\n\thslash: '\\u210F',\n\tHstrok: '\\u0126',\n\thstrok: '\\u0127',\n\tHumpDownHump: '\\u224E',\n\tHumpEqual: '\\u224F',\n\thybull: '\\u2043',\n\thyphen: '\\u2010',\n\tIacute: '\\u00CD',\n\tiacute: '\\u00ED',\n\tic: '\\u2063',\n\tIcirc: '\\u00CE',\n\ticirc: '\\u00EE',\n\tIcy: '\\u0418',\n\ticy: '\\u0438',\n\tIdot: '\\u0130',\n\tIEcy: '\\u0415',\n\tiecy: '\\u0435',\n\tiexcl: '\\u00A1',\n\tiff: '\\u21D4',\n\tIfr: '\\u2111',\n\tifr: '\\uD835\\uDD26',\n\tIgrave: '\\u00CC',\n\tigrave: '\\u00EC',\n\tii: '\\u2148',\n\tiiiint: '\\u2A0C',\n\tiiint: '\\u222D',\n\tiinfin: '\\u29DC',\n\tiiota: '\\u2129',\n\tIJlig: '\\u0132',\n\tijlig: '\\u0133',\n\tIm: '\\u2111',\n\tImacr: '\\u012A',\n\timacr: '\\u012B',\n\timage: '\\u2111',\n\tImaginaryI: '\\u2148',\n\timagline: '\\u2110',\n\timagpart: '\\u2111',\n\timath: '\\u0131',\n\timof: '\\u22B7',\n\timped: '\\u01B5',\n\tImplies: '\\u21D2',\n\tin: '\\u2208',\n\tincare: '\\u2105',\n\tinfin: '\\u221E',\n\tinfintie: '\\u29DD',\n\tinodot: '\\u0131',\n\tInt: '\\u222C',\n\tint: '\\u222B',\n\tintcal: '\\u22BA',\n\tintegers: '\\u2124',\n\tIntegral: '\\u222B',\n\tintercal: '\\u22BA',\n\tIntersection: '\\u22C2',\n\tintlarhk: '\\u2A17',\n\tintprod: '\\u2A3C',\n\tInvisibleComma: '\\u2063',\n\tInvisibleTimes: '\\u2062',\n\tIOcy: '\\u0401',\n\tiocy: '\\u0451',\n\tIogon: '\\u012E',\n\tiogon: '\\u012F',\n\tIopf: '\\uD835\\uDD40',\n\tiopf: '\\uD835\\uDD5A',\n\tIota: '\\u0399',\n\tiota: '\\u03B9',\n\tiprod: '\\u2A3C',\n\tiquest: '\\u00BF',\n\tIscr: '\\u2110',\n\tiscr: '\\uD835\\uDCBE',\n\tisin: '\\u2208',\n\tisindot: '\\u22F5',\n\tisinE: '\\u22F9',\n\tisins: '\\u22F4',\n\tisinsv: '\\u22F3',\n\tisinv: '\\u2208',\n\tit: '\\u2062',\n\tItilde: '\\u0128',\n\titilde: '\\u0129',\n\tIukcy: '\\u0406',\n\tiukcy: '\\u0456',\n\tIuml: '\\u00CF',\n\tiuml: '\\u00EF',\n\tJcirc: '\\u0134',\n\tjcirc: '\\u0135',\n\tJcy: '\\u0419',\n\tjcy: '\\u0439',\n\tJfr: '\\uD835\\uDD0D',\n\tjfr: '\\uD835\\uDD27',\n\tjmath: '\\u0237',\n\tJopf: '\\uD835\\uDD41',\n\tjopf: '\\uD835\\uDD5B',\n\tJscr: '\\uD835\\uDCA5',\n\tjscr: '\\uD835\\uDCBF',\n\tJsercy: '\\u0408',\n\tjsercy: '\\u0458',\n\tJukcy: '\\u0404',\n\tjukcy: '\\u0454',\n\tKappa: '\\u039A',\n\tkappa: '\\u03BA',\n\tkappav: '\\u03F0',\n\tKcedil: '\\u0136',\n\tkcedil: '\\u0137',\n\tKcy: '\\u041A',\n\tkcy: '\\u043A',\n\tKfr: '\\uD835\\uDD0E',\n\tkfr: '\\uD835\\uDD28',\n\tkgreen: '\\u0138',\n\tKHcy: '\\u0425',\n\tkhcy: '\\u0445',\n\tKJcy: '\\u040C',\n\tkjcy: '\\u045C',\n\tKopf: '\\uD835\\uDD42',\n\tkopf: '\\uD835\\uDD5C',\n\tKscr: '\\uD835\\uDCA6',\n\tkscr: '\\uD835\\uDCC0',\n\tlAarr: '\\u21DA',\n\tLacute: '\\u0139',\n\tlacute: '\\u013A',\n\tlaemptyv: '\\u29B4',\n\tlagran: '\\u2112',\n\tLambda: '\\u039B',\n\tlambda: '\\u03BB',\n\tLang: '\\u27EA',\n\tlang: '\\u27E8',\n\tlangd: '\\u2991',\n\tlangle: '\\u27E8',\n\tlap: '\\u2A85',\n\tLaplacetrf: '\\u2112',\n\tlaquo: '\\u00AB',\n\tLarr: '\\u219E',\n\tlArr: '\\u21D0',\n\tlarr: '\\u2190',\n\tlarrb: '\\u21E4',\n\tlarrbfs: '\\u291F',\n\tlarrfs: '\\u291D',\n\tlarrhk: '\\u21A9',\n\tlarrlp: '\\u21AB',\n\tlarrpl: '\\u2939',\n\tlarrsim: '\\u2973',\n\tlarrtl: '\\u21A2',\n\tlat: '\\u2AAB',\n\tlAtail: '\\u291B',\n\tlatail: '\\u2919',\n\tlate: '\\u2AAD',\n\tlates: '\\u2AAD\\uFE00',\n\tlBarr: '\\u290E',\n\tlbarr: '\\u290C',\n\tlbbrk: '\\u2772',\n\tlbrace: '\\u007B',\n\tlbrack: '\\u005B',\n\tlbrke: '\\u298B',\n\tlbrksld: '\\u298F',\n\tlbrkslu: '\\u298D',\n\tLcaron: '\\u013D',\n\tlcaron: '\\u013E',\n\tLcedil: '\\u013B',\n\tlcedil: '\\u013C',\n\tlceil: '\\u2308',\n\tlcub: '\\u007B',\n\tLcy: '\\u041B',\n\tlcy: '\\u043B',\n\tldca: '\\u2936',\n\tldquo: '\\u201C',\n\tldquor: '\\u201E',\n\tldrdhar: '\\u2967',\n\tldrushar: '\\u294B',\n\tldsh: '\\u21B2',\n\tlE: '\\u2266',\n\tle: '\\u2264',\n\tLeftAngleBracket: '\\u27E8',\n\tLeftArrow: '\\u2190',\n\tLeftarrow: '\\u21D0',\n\tleftarrow: '\\u2190',\n\tLeftArrowBar: '\\u21E4',\n\tLeftArrowRightArrow: '\\u21C6',\n\tleftarrowtail: '\\u21A2',\n\tLeftCeiling: '\\u2308',\n\tLeftDoubleBracket: '\\u27E6',\n\tLeftDownTeeVector: '\\u2961',\n\tLeftDownVector: '\\u21C3',\n\tLeftDownVectorBar: '\\u2959',\n\tLeftFloor: '\\u230A',\n\tleftharpoondown: '\\u21BD',\n\tleftharpoonup: '\\u21BC',\n\tleftleftarrows: '\\u21C7',\n\tLeftRightArrow: '\\u2194',\n\tLeftrightarrow: '\\u21D4',\n\tleftrightarrow: '\\u2194',\n\tleftrightarrows: '\\u21C6',\n\tleftrightharpoons: '\\u21CB',\n\tleftrightsquigarrow: '\\u21AD',\n\tLeftRightVector: '\\u294E',\n\tLeftTee: '\\u22A3',\n\tLeftTeeArrow: '\\u21A4',\n\tLeftTeeVector: '\\u295A',\n\tleftthreetimes: '\\u22CB',\n\tLeftTriangle: '\\u22B2',\n\tLeftTriangleBar: '\\u29CF',\n\tLeftTriangleEqual: '\\u22B4',\n\tLeftUpDownVector: '\\u2951',\n\tLeftUpTeeVector: '\\u2960',\n\tLeftUpVector: '\\u21BF',\n\tLeftUpVectorBar: '\\u2958',\n\tLeftVector: '\\u21BC',\n\tLeftVectorBar: '\\u2952',\n\tlEg: '\\u2A8B',\n\tleg: '\\u22DA',\n\tleq: '\\u2264',\n\tleqq: '\\u2266',\n\tleqslant: '\\u2A7D',\n\tles: '\\u2A7D',\n\tlescc: '\\u2AA8',\n\tlesdot: '\\u2A7F',\n\tlesdoto: '\\u2A81',\n\tlesdotor: '\\u2A83',\n\tlesg: '\\u22DA\\uFE00',\n\tlesges: '\\u2A93',\n\tlessapprox: '\\u2A85',\n\tlessdot: '\\u22D6',\n\tlesseqgtr: '\\u22DA',\n\tlesseqqgtr: '\\u2A8B',\n\tLessEqualGreater: '\\u22DA',\n\tLessFullEqual: '\\u2266',\n\tLessGreater: '\\u2276',\n\tlessgtr: '\\u2276',\n\tLessLess: '\\u2AA1',\n\tlesssim: '\\u2272',\n\tLessSlantEqual: '\\u2A7D',\n\tLessTilde: '\\u2272',\n\tlfisht: '\\u297C',\n\tlfloor: '\\u230A',\n\tLfr: '\\uD835\\uDD0F',\n\tlfr: '\\uD835\\uDD29',\n\tlg: '\\u2276',\n\tlgE: '\\u2A91',\n\tlHar: '\\u2962',\n\tlhard: '\\u21BD',\n\tlharu: '\\u21BC',\n\tlharul: '\\u296A',\n\tlhblk: '\\u2584',\n\tLJcy: '\\u0409',\n\tljcy: '\\u0459',\n\tLl: '\\u22D8',\n\tll: '\\u226A',\n\tllarr: '\\u21C7',\n\tllcorner: '\\u231E',\n\tLleftarrow: '\\u21DA',\n\tllhard: '\\u296B',\n\tlltri: '\\u25FA',\n\tLmidot: '\\u013F',\n\tlmidot: '\\u0140',\n\tlmoust: '\\u23B0',\n\tlmoustache: '\\u23B0',\n\tlnap: '\\u2A89',\n\tlnapprox: '\\u2A89',\n\tlnE: '\\u2268',\n\tlne: '\\u2A87',\n\tlneq: '\\u2A87',\n\tlneqq: '\\u2268',\n\tlnsim: '\\u22E6',\n\tloang: '\\u27EC',\n\tloarr: '\\u21FD',\n\tlobrk: '\\u27E6',\n\tLongLeftArrow: '\\u27F5',\n\tLongleftarrow: '\\u27F8',\n\tlongleftarrow: '\\u27F5',\n\tLongLeftRightArrow: '\\u27F7',\n\tLongleftrightarrow: '\\u27FA',\n\tlongleftrightarrow: '\\u27F7',\n\tlongmapsto: '\\u27FC',\n\tLongRightArrow: '\\u27F6',\n\tLongrightarrow: '\\u27F9',\n\tlongrightarrow: '\\u27F6',\n\tlooparrowleft: '\\u21AB',\n\tlooparrowright: '\\u21AC',\n\tlopar: '\\u2985',\n\tLopf: '\\uD835\\uDD43',\n\tlopf: '\\uD835\\uDD5D',\n\tloplus: '\\u2A2D',\n\tlotimes: '\\u2A34',\n\tlowast: '\\u2217',\n\tlowbar: '\\u005F',\n\tLowerLeftArrow: '\\u2199',\n\tLowerRightArrow: '\\u2198',\n\tloz: '\\u25CA',\n\tlozenge: '\\u25CA',\n\tlozf: '\\u29EB',\n\tlpar: '\\u0028',\n\tlparlt: '\\u2993',\n\tlrarr: '\\u21C6',\n\tlrcorner: '\\u231F',\n\tlrhar: '\\u21CB',\n\tlrhard: '\\u296D',\n\tlrm: '\\u200E',\n\tlrtri: '\\u22BF',\n\tlsaquo: '\\u2039',\n\tLscr: '\\u2112',\n\tlscr: '\\uD835\\uDCC1',\n\tLsh: '\\u21B0',\n\tlsh: '\\u21B0',\n\tlsim: '\\u2272',\n\tlsime: '\\u2A8D',\n\tlsimg: '\\u2A8F',\n\tlsqb: '\\u005B',\n\tlsquo: '\\u2018',\n\tlsquor: '\\u201A',\n\tLstrok: '\\u0141',\n\tlstrok: '\\u0142',\n\tLt: '\\u226A',\n\tLT: '\\u003C',\n\tlt: '\\u003C',\n\tltcc: '\\u2AA6',\n\tltcir: '\\u2A79',\n\tltdot: '\\u22D6',\n\tlthree: '\\u22CB',\n\tltimes: '\\u22C9',\n\tltlarr: '\\u2976',\n\tltquest: '\\u2A7B',\n\tltri: '\\u25C3',\n\tltrie: '\\u22B4',\n\tltrif: '\\u25C2',\n\tltrPar: '\\u2996',\n\tlurdshar: '\\u294A',\n\tluruhar: '\\u2966',\n\tlvertneqq: '\\u2268\\uFE00',\n\tlvnE: '\\u2268\\uFE00',\n\tmacr: '\\u00AF',\n\tmale: '\\u2642',\n\tmalt: '\\u2720',\n\tmaltese: '\\u2720',\n\tMap: '\\u2905',\n\tmap: '\\u21A6',\n\tmapsto: '\\u21A6',\n\tmapstodown: '\\u21A7',\n\tmapstoleft: '\\u21A4',\n\tmapstoup: '\\u21A5',\n\tmarker: '\\u25AE',\n\tmcomma: '\\u2A29',\n\tMcy: '\\u041C',\n\tmcy: '\\u043C',\n\tmdash: '\\u2014',\n\tmDDot: '\\u223A',\n\tmeasuredangle: '\\u2221',\n\tMediumSpace: '\\u205F',\n\tMellintrf: '\\u2133',\n\tMfr: '\\uD835\\uDD10',\n\tmfr: '\\uD835\\uDD2A',\n\tmho: '\\u2127',\n\tmicro: '\\u00B5',\n\tmid: '\\u2223',\n\tmidast: '\\u002A',\n\tmidcir: '\\u2AF0',\n\tmiddot: '\\u00B7',\n\tminus: '\\u2212',\n\tminusb: '\\u229F',\n\tminusd: '\\u2238',\n\tminusdu: '\\u2A2A',\n\tMinusPlus: '\\u2213',\n\tmlcp: '\\u2ADB',\n\tmldr: '\\u2026',\n\tmnplus: '\\u2213',\n\tmodels: '\\u22A7',\n\tMopf: '\\uD835\\uDD44',\n\tmopf: '\\uD835\\uDD5E',\n\tmp: '\\u2213',\n\tMscr: '\\u2133',\n\tmscr: '\\uD835\\uDCC2',\n\tmstpos: '\\u223E',\n\tMu: '\\u039C',\n\tmu: '\\u03BC',\n\tmultimap: '\\u22B8',\n\tmumap: '\\u22B8',\n\tnabla: '\\u2207',\n\tNacute: '\\u0143',\n\tnacute: '\\u0144',\n\tnang: '\\u2220\\u20D2',\n\tnap: '\\u2249',\n\tnapE: '\\u2A70\\u0338',\n\tnapid: '\\u224B\\u0338',\n\tnapos: '\\u0149',\n\tnapprox: '\\u2249',\n\tnatur: '\\u266E',\n\tnatural: '\\u266E',\n\tnaturals: '\\u2115',\n\tnbsp: '\\u00A0',\n\tnbump: '\\u224E\\u0338',\n\tnbumpe: '\\u224F\\u0338',\n\tncap: '\\u2A43',\n\tNcaron: '\\u0147',\n\tncaron: '\\u0148',\n\tNcedil: '\\u0145',\n\tncedil: '\\u0146',\n\tncong: '\\u2247',\n\tncongdot: '\\u2A6D\\u0338',\n\tncup: '\\u2A42',\n\tNcy: '\\u041D',\n\tncy: '\\u043D',\n\tndash: '\\u2013',\n\tne: '\\u2260',\n\tnearhk: '\\u2924',\n\tneArr: '\\u21D7',\n\tnearr: '\\u2197',\n\tnearrow: '\\u2197',\n\tnedot: '\\u2250\\u0338',\n\tNegativeMediumSpace: '\\u200B',\n\tNegativeThickSpace: '\\u200B',\n\tNegativeThinSpace: '\\u200B',\n\tNegativeVeryThinSpace: '\\u200B',\n\tnequiv: '\\u2262',\n\tnesear: '\\u2928',\n\tnesim: '\\u2242\\u0338',\n\tNestedGreaterGreater: '\\u226B',\n\tNestedLessLess: '\\u226A',\n\tNewLine: '\\u000A',\n\tnexist: '\\u2204',\n\tnexists: '\\u2204',\n\tNfr: '\\uD835\\uDD11',\n\tnfr: '\\uD835\\uDD2B',\n\tngE: '\\u2267\\u0338',\n\tnge: '\\u2271',\n\tngeq: '\\u2271',\n\tngeqq: '\\u2267\\u0338',\n\tngeqslant: '\\u2A7E\\u0338',\n\tnges: '\\u2A7E\\u0338',\n\tnGg: '\\u22D9\\u0338',\n\tngsim: '\\u2275',\n\tnGt: '\\u226B\\u20D2',\n\tngt: '\\u226F',\n\tngtr: '\\u226F',\n\tnGtv: '\\u226B\\u0338',\n\tnhArr: '\\u21CE',\n\tnharr: '\\u21AE',\n\tnhpar: '\\u2AF2',\n\tni: '\\u220B',\n\tnis: '\\u22FC',\n\tnisd: '\\u22FA',\n\tniv: '\\u220B',\n\tNJcy: '\\u040A',\n\tnjcy: '\\u045A',\n\tnlArr: '\\u21CD',\n\tnlarr: '\\u219A',\n\tnldr: '\\u2025',\n\tnlE: '\\u2266\\u0338',\n\tnle: '\\u2270',\n\tnLeftarrow: '\\u21CD',\n\tnleftarrow: '\\u219A',\n\tnLeftrightarrow: '\\u21CE',\n\tnleftrightarrow: '\\u21AE',\n\tnleq: '\\u2270',\n\tnleqq: '\\u2266\\u0338',\n\tnleqslant: '\\u2A7D\\u0338',\n\tnles: '\\u2A7D\\u0338',\n\tnless: '\\u226E',\n\tnLl: '\\u22D8\\u0338',\n\tnlsim: '\\u2274',\n\tnLt: '\\u226A\\u20D2',\n\tnlt: '\\u226E',\n\tnltri: '\\u22EA',\n\tnltrie: '\\u22EC',\n\tnLtv: '\\u226A\\u0338',\n\tnmid: '\\u2224',\n\tNoBreak: '\\u2060',\n\tNonBreakingSpace: '\\u00A0',\n\tNopf: '\\u2115',\n\tnopf: '\\uD835\\uDD5F',\n\tNot: '\\u2AEC',\n\tnot: '\\u00AC',\n\tNotCongruent: '\\u2262',\n\tNotCupCap: '\\u226D',\n\tNotDoubleVerticalBar: '\\u2226',\n\tNotElement: '\\u2209',\n\tNotEqual: '\\u2260',\n\tNotEqualTilde: '\\u2242\\u0338',\n\tNotExists: '\\u2204',\n\tNotGreater: '\\u226F',\n\tNotGreaterEqual: '\\u2271',\n\tNotGreaterFullEqual: '\\u2267\\u0338',\n\tNotGreaterGreater: '\\u226B\\u0338',\n\tNotGreaterLess: '\\u2279',\n\tNotGreaterSlantEqual: '\\u2A7E\\u0338',\n\tNotGreaterTilde: '\\u2275',\n\tNotHumpDownHump: '\\u224E\\u0338',\n\tNotHumpEqual: '\\u224F\\u0338',\n\tnotin: '\\u2209',\n\tnotindot: '\\u22F5\\u0338',\n\tnotinE: '\\u22F9\\u0338',\n\tnotinva: '\\u2209',\n\tnotinvb: '\\u22F7',\n\tnotinvc: '\\u22F6',\n\tNotLeftTriangle: '\\u22EA',\n\tNotLeftTriangleBar: '\\u29CF\\u0338',\n\tNotLeftTriangleEqual: '\\u22EC',\n\tNotLess: '\\u226E',\n\tNotLessEqual: '\\u2270',\n\tNotLessGreater: '\\u2278',\n\tNotLessLess: '\\u226A\\u0338',\n\tNotLessSlantEqual: '\\u2A7D\\u0338',\n\tNotLessTilde: '\\u2274',\n\tNotNestedGreaterGreater: '\\u2AA2\\u0338',\n\tNotNestedLessLess: '\\u2AA1\\u0338',\n\tnotni: '\\u220C',\n\tnotniva: '\\u220C',\n\tnotnivb: '\\u22FE',\n\tnotnivc: '\\u22FD',\n\tNotPrecedes: '\\u2280',\n\tNotPrecedesEqual: '\\u2AAF\\u0338',\n\tNotPrecedesSlantEqual: '\\u22E0',\n\tNotReverseElement: '\\u220C',\n\tNotRightTriangle: '\\u22EB',\n\tNotRightTriangleBar: '\\u29D0\\u0338',\n\tNotRightTriangleEqual: '\\u22ED',\n\tNotSquareSubset: '\\u228F\\u0338',\n\tNotSquareSubsetEqual: '\\u22E2',\n\tNotSquareSuperset: '\\u2290\\u0338',\n\tNotSquareSupersetEqual: '\\u22E3',\n\tNotSubset: '\\u2282\\u20D2',\n\tNotSubsetEqual: '\\u2288',\n\tNotSucceeds: '\\u2281',\n\tNotSucceedsEqual: '\\u2AB0\\u0338',\n\tNotSucceedsSlantEqual: '\\u22E1',\n\tNotSucceedsTilde: '\\u227F\\u0338',\n\tNotSuperset: '\\u2283\\u20D2',\n\tNotSupersetEqual: '\\u2289',\n\tNotTilde: '\\u2241',\n\tNotTildeEqual: '\\u2244',\n\tNotTildeFullEqual: '\\u2247',\n\tNotTildeTilde: '\\u2249',\n\tNotVerticalBar: '\\u2224',\n\tnpar: '\\u2226',\n\tnparallel: '\\u2226',\n\tnparsl: '\\u2AFD\\u20E5',\n\tnpart: '\\u2202\\u0338',\n\tnpolint: '\\u2A14',\n\tnpr: '\\u2280',\n\tnprcue: '\\u22E0',\n\tnpre: '\\u2AAF\\u0338',\n\tnprec: '\\u2280',\n\tnpreceq: '\\u2AAF\\u0338',\n\tnrArr: '\\u21CF',\n\tnrarr: '\\u219B',\n\tnrarrc: '\\u2933\\u0338',\n\tnrarrw: '\\u219D\\u0338',\n\tnRightarrow: '\\u21CF',\n\tnrightarrow: '\\u219B',\n\tnrtri: '\\u22EB',\n\tnrtrie: '\\u22ED',\n\tnsc: '\\u2281',\n\tnsccue: '\\u22E1',\n\tnsce: '\\u2AB0\\u0338',\n\tNscr: '\\uD835\\uDCA9',\n\tnscr: '\\uD835\\uDCC3',\n\tnshortmid: '\\u2224',\n\tnshortparallel: '\\u2226',\n\tnsim: '\\u2241',\n\tnsime: '\\u2244',\n\tnsimeq: '\\u2244',\n\tnsmid: '\\u2224',\n\tnspar: '\\u2226',\n\tnsqsube: '\\u22E2',\n\tnsqsupe: '\\u22E3',\n\tnsub: '\\u2284',\n\tnsubE: '\\u2AC5\\u0338',\n\tnsube: '\\u2288',\n\tnsubset: '\\u2282\\u20D2',\n\tnsubseteq: '\\u2288',\n\tnsubseteqq: '\\u2AC5\\u0338',\n\tnsucc: '\\u2281',\n\tnsucceq: '\\u2AB0\\u0338',\n\tnsup: '\\u2285',\n\tnsupE: '\\u2AC6\\u0338',\n\tnsupe: '\\u2289',\n\tnsupset: '\\u2283\\u20D2',\n\tnsupseteq: '\\u2289',\n\tnsupseteqq: '\\u2AC6\\u0338',\n\tntgl: '\\u2279',\n\tNtilde: '\\u00D1',\n\tntilde: '\\u00F1',\n\tntlg: '\\u2278',\n\tntriangleleft: '\\u22EA',\n\tntrianglelefteq: '\\u22EC',\n\tntriangleright: '\\u22EB',\n\tntrianglerighteq: '\\u22ED',\n\tNu: '\\u039D',\n\tnu: '\\u03BD',\n\tnum: '\\u0023',\n\tnumero: '\\u2116',\n\tnumsp: '\\u2007',\n\tnvap: '\\u224D\\u20D2',\n\tnVDash: '\\u22AF',\n\tnVdash: '\\u22AE',\n\tnvDash: '\\u22AD',\n\tnvdash: '\\u22AC',\n\tnvge: '\\u2265\\u20D2',\n\tnvgt: '\\u003E\\u20D2',\n\tnvHarr: '\\u2904',\n\tnvinfin: '\\u29DE',\n\tnvlArr: '\\u2902',\n\tnvle: '\\u2264\\u20D2',\n\tnvlt: '\\u003C\\u20D2',\n\tnvltrie: '\\u22B4\\u20D2',\n\tnvrArr: '\\u2903',\n\tnvrtrie: '\\u22B5\\u20D2',\n\tnvsim: '\\u223C\\u20D2',\n\tnwarhk: '\\u2923',\n\tnwArr: '\\u21D6',\n\tnwarr: '\\u2196',\n\tnwarrow: '\\u2196',\n\tnwnear: '\\u2927',\n\tOacute: '\\u00D3',\n\toacute: '\\u00F3',\n\toast: '\\u229B',\n\tocir: '\\u229A',\n\tOcirc: '\\u00D4',\n\tocirc: '\\u00F4',\n\tOcy: '\\u041E',\n\tocy: '\\u043E',\n\todash: '\\u229D',\n\tOdblac: '\\u0150',\n\todblac: '\\u0151',\n\todiv: '\\u2A38',\n\todot: '\\u2299',\n\todsold: '\\u29BC',\n\tOElig: '\\u0152',\n\toelig: '\\u0153',\n\tofcir: '\\u29BF',\n\tOfr: '\\uD835\\uDD12',\n\tofr: '\\uD835\\uDD2C',\n\togon: '\\u02DB',\n\tOgrave: '\\u00D2',\n\tograve: '\\u00F2',\n\togt: '\\u29C1',\n\tohbar: '\\u29B5',\n\tohm: '\\u03A9',\n\toint: '\\u222E',\n\tolarr: '\\u21BA',\n\tolcir: '\\u29BE',\n\tolcross: '\\u29BB',\n\toline: '\\u203E',\n\tolt: '\\u29C0',\n\tOmacr: '\\u014C',\n\tomacr: '\\u014D',\n\tOmega: '\\u03A9',\n\tomega: '\\u03C9',\n\tOmicron: '\\u039F',\n\tomicron: '\\u03BF',\n\tomid: '\\u29B6',\n\tominus: '\\u2296',\n\tOopf: '\\uD835\\uDD46',\n\toopf: '\\uD835\\uDD60',\n\topar: '\\u29B7',\n\tOpenCurlyDoubleQuote: '\\u201C',\n\tOpenCurlyQuote: '\\u2018',\n\toperp: '\\u29B9',\n\toplus: '\\u2295',\n\tOr: '\\u2A54',\n\tor: '\\u2228',\n\torarr: '\\u21BB',\n\tord: '\\u2A5D',\n\torder: '\\u2134',\n\torderof: '\\u2134',\n\tordf: '\\u00AA',\n\tordm: '\\u00BA',\n\torigof: '\\u22B6',\n\toror: '\\u2A56',\n\torslope: '\\u2A57',\n\torv: '\\u2A5B',\n\toS: '\\u24C8',\n\tOscr: '\\uD835\\uDCAA',\n\toscr: '\\u2134',\n\tOslash: '\\u00D8',\n\toslash: '\\u00F8',\n\tosol: '\\u2298',\n\tOtilde: '\\u00D5',\n\totilde: '\\u00F5',\n\tOtimes: '\\u2A37',\n\totimes: '\\u2297',\n\totimesas: '\\u2A36',\n\tOuml: '\\u00D6',\n\touml: '\\u00F6',\n\tovbar: '\\u233D',\n\tOverBar: '\\u203E',\n\tOverBrace: '\\u23DE',\n\tOverBracket: '\\u23B4',\n\tOverParenthesis: '\\u23DC',\n\tpar: '\\u2225',\n\tpara: '\\u00B6',\n\tparallel: '\\u2225',\n\tparsim: '\\u2AF3',\n\tparsl: '\\u2AFD',\n\tpart: '\\u2202',\n\tPartialD: '\\u2202',\n\tPcy: '\\u041F',\n\tpcy: '\\u043F',\n\tpercnt: '\\u0025',\n\tperiod: '\\u002E',\n\tpermil: '\\u2030',\n\tperp: '\\u22A5',\n\tpertenk: '\\u2031',\n\tPfr: '\\uD835\\uDD13',\n\tpfr: '\\uD835\\uDD2D',\n\tPhi: '\\u03A6',\n\tphi: '\\u03C6',\n\tphiv: '\\u03D5',\n\tphmmat: '\\u2133',\n\tphone: '\\u260E',\n\tPi: '\\u03A0',\n\tpi: '\\u03C0',\n\tpitchfork: '\\u22D4',\n\tpiv: '\\u03D6',\n\tplanck: '\\u210F',\n\tplanckh: '\\u210E',\n\tplankv: '\\u210F',\n\tplus: '\\u002B',\n\tplusacir: '\\u2A23',\n\tplusb: '\\u229E',\n\tpluscir: '\\u2A22',\n\tplusdo: '\\u2214',\n\tplusdu: '\\u2A25',\n\tpluse: '\\u2A72',\n\tPlusMinus: '\\u00B1',\n\tplusmn: '\\u00B1',\n\tplussim: '\\u2A26',\n\tplustwo: '\\u2A27',\n\tpm: '\\u00B1',\n\tPoincareplane: '\\u210C',\n\tpointint: '\\u2A15',\n\tPopf: '\\u2119',\n\tpopf: '\\uD835\\uDD61',\n\tpound: '\\u00A3',\n\tPr: '\\u2ABB',\n\tpr: '\\u227A',\n\tprap: '\\u2AB7',\n\tprcue: '\\u227C',\n\tprE: '\\u2AB3',\n\tpre: '\\u2AAF',\n\tprec: '\\u227A',\n\tprecapprox: '\\u2AB7',\n\tpreccurlyeq: '\\u227C',\n\tPrecedes: '\\u227A',\n\tPrecedesEqual: '\\u2AAF',\n\tPrecedesSlantEqual: '\\u227C',\n\tPrecedesTilde: '\\u227E',\n\tpreceq: '\\u2AAF',\n\tprecnapprox: '\\u2AB9',\n\tprecneqq: '\\u2AB5',\n\tprecnsim: '\\u22E8',\n\tprecsim: '\\u227E',\n\tPrime: '\\u2033',\n\tprime: '\\u2032',\n\tprimes: '\\u2119',\n\tprnap: '\\u2AB9',\n\tprnE: '\\u2AB5',\n\tprnsim: '\\u22E8',\n\tprod: '\\u220F',\n\tProduct: '\\u220F',\n\tprofalar: '\\u232E',\n\tprofline: '\\u2312',\n\tprofsurf: '\\u2313',\n\tprop: '\\u221D',\n\tProportion: '\\u2237',\n\tProportional: '\\u221D',\n\tpropto: '\\u221D',\n\tprsim: '\\u227E',\n\tprurel: '\\u22B0',\n\tPscr: '\\uD835\\uDCAB',\n\tpscr: '\\uD835\\uDCC5',\n\tPsi: '\\u03A8',\n\tpsi: '\\u03C8',\n\tpuncsp: '\\u2008',\n\tQfr: '\\uD835\\uDD14',\n\tqfr: '\\uD835\\uDD2E',\n\tqint: '\\u2A0C',\n\tQopf: '\\u211A',\n\tqopf: '\\uD835\\uDD62',\n\tqprime: '\\u2057',\n\tQscr: '\\uD835\\uDCAC',\n\tqscr: '\\uD835\\uDCC6',\n\tquaternions: '\\u210D',\n\tquatint: '\\u2A16',\n\tquest: '\\u003F',\n\tquesteq: '\\u225F',\n\tQUOT: '\\u0022',\n\tquot: '\\u0022',\n\trAarr: '\\u21DB',\n\trace: '\\u223D\\u0331',\n\tRacute: '\\u0154',\n\tracute: '\\u0155',\n\tradic: '\\u221A',\n\traemptyv: '\\u29B3',\n\tRang: '\\u27EB',\n\trang: '\\u27E9',\n\trangd: '\\u2992',\n\trange: '\\u29A5',\n\trangle: '\\u27E9',\n\traquo: '\\u00BB',\n\tRarr: '\\u21A0',\n\trArr: '\\u21D2',\n\trarr: '\\u2192',\n\trarrap: '\\u2975',\n\trarrb: '\\u21E5',\n\trarrbfs: '\\u2920',\n\trarrc: '\\u2933',\n\trarrfs: '\\u291E',\n\trarrhk: '\\u21AA',\n\trarrlp: '\\u21AC',\n\trarrpl: '\\u2945',\n\trarrsim: '\\u2974',\n\tRarrtl: '\\u2916',\n\trarrtl: '\\u21A3',\n\trarrw: '\\u219D',\n\trAtail: '\\u291C',\n\tratail: '\\u291A',\n\tratio: '\\u2236',\n\trationals: '\\u211A',\n\tRBarr: '\\u2910',\n\trBarr: '\\u290F',\n\trbarr: '\\u290D',\n\trbbrk: '\\u2773',\n\trbrace: '\\u007D',\n\trbrack: '\\u005D',\n\trbrke: '\\u298C',\n\trbrksld: '\\u298E',\n\trbrkslu: '\\u2990',\n\tRcaron: '\\u0158',\n\trcaron: '\\u0159',\n\tRcedil: '\\u0156',\n\trcedil: '\\u0157',\n\trceil: '\\u2309',\n\trcub: '\\u007D',\n\tRcy: '\\u0420',\n\trcy: '\\u0440',\n\trdca: '\\u2937',\n\trdldhar: '\\u2969',\n\trdquo: '\\u201D',\n\trdquor: '\\u201D',\n\trdsh: '\\u21B3',\n\tRe: '\\u211C',\n\treal: '\\u211C',\n\trealine: '\\u211B',\n\trealpart: '\\u211C',\n\treals: '\\u211D',\n\trect: '\\u25AD',\n\tREG: '\\u00AE',\n\treg: '\\u00AE',\n\tReverseElement: '\\u220B',\n\tReverseEquilibrium: '\\u21CB',\n\tReverseUpEquilibrium: '\\u296F',\n\trfisht: '\\u297D',\n\trfloor: '\\u230B',\n\tRfr: '\\u211C',\n\trfr: '\\uD835\\uDD2F',\n\trHar: '\\u2964',\n\trhard: '\\u21C1',\n\trharu: '\\u21C0',\n\trharul: '\\u296C',\n\tRho: '\\u03A1',\n\trho: '\\u03C1',\n\trhov: '\\u03F1',\n\tRightAngleBracket: '\\u27E9',\n\tRightArrow: '\\u2192',\n\tRightarrow: '\\u21D2',\n\trightarrow: '\\u2192',\n\tRightArrowBar: '\\u21E5',\n\tRightArrowLeftArrow: '\\u21C4',\n\trightarrowtail: '\\u21A3',\n\tRightCeiling: '\\u2309',\n\tRightDoubleBracket: '\\u27E7',\n\tRightDownTeeVector: '\\u295D',\n\tRightDownVector: '\\u21C2',\n\tRightDownVectorBar: '\\u2955',\n\tRightFloor: '\\u230B',\n\trightharpoondown: '\\u21C1',\n\trightharpoonup: '\\u21C0',\n\trightleftarrows: '\\u21C4',\n\trightleftharpoons: '\\u21CC',\n\trightrightarrows: '\\u21C9',\n\trightsquigarrow: '\\u219D',\n\tRightTee: '\\u22A2',\n\tRightTeeArrow: '\\u21A6',\n\tRightTeeVector: '\\u295B',\n\trightthreetimes: '\\u22CC',\n\tRightTriangle: '\\u22B3',\n\tRightTriangleBar: '\\u29D0',\n\tRightTriangleEqual: '\\u22B5',\n\tRightUpDownVector: '\\u294F',\n\tRightUpTeeVector: '\\u295C',\n\tRightUpVector: '\\u21BE',\n\tRightUpVectorBar: '\\u2954',\n\tRightVector: '\\u21C0',\n\tRightVectorBar: '\\u2953',\n\tring: '\\u02DA',\n\trisingdotseq: '\\u2253',\n\trlarr: '\\u21C4',\n\trlhar: '\\u21CC',\n\trlm: '\\u200F',\n\trmoust: '\\u23B1',\n\trmoustache: '\\u23B1',\n\trnmid: '\\u2AEE',\n\troang: '\\u27ED',\n\troarr: '\\u21FE',\n\trobrk: '\\u27E7',\n\tropar: '\\u2986',\n\tRopf: '\\u211D',\n\tropf: '\\uD835\\uDD63',\n\troplus: '\\u2A2E',\n\trotimes: '\\u2A35',\n\tRoundImplies: '\\u2970',\n\trpar: '\\u0029',\n\trpargt: '\\u2994',\n\trppolint: '\\u2A12',\n\trrarr: '\\u21C9',\n\tRrightarrow: '\\u21DB',\n\trsaquo: '\\u203A',\n\tRscr: '\\u211B',\n\trscr: '\\uD835\\uDCC7',\n\tRsh: '\\u21B1',\n\trsh: '\\u21B1',\n\trsqb: '\\u005D',\n\trsquo: '\\u2019',\n\trsquor: '\\u2019',\n\trthree: '\\u22CC',\n\trtimes: '\\u22CA',\n\trtri: '\\u25B9',\n\trtrie: '\\u22B5',\n\trtrif: '\\u25B8',\n\trtriltri: '\\u29CE',\n\tRuleDelayed: '\\u29F4',\n\truluhar: '\\u2968',\n\trx: '\\u211E',\n\tSacute: '\\u015A',\n\tsacute: '\\u015B',\n\tsbquo: '\\u201A',\n\tSc: '\\u2ABC',\n\tsc: '\\u227B',\n\tscap: '\\u2AB8',\n\tScaron: '\\u0160',\n\tscaron: '\\u0161',\n\tsccue: '\\u227D',\n\tscE: '\\u2AB4',\n\tsce: '\\u2AB0',\n\tScedil: '\\u015E',\n\tscedil: '\\u015F',\n\tScirc: '\\u015C',\n\tscirc: '\\u015D',\n\tscnap: '\\u2ABA',\n\tscnE: '\\u2AB6',\n\tscnsim: '\\u22E9',\n\tscpolint: '\\u2A13',\n\tscsim: '\\u227F',\n\tScy: '\\u0421',\n\tscy: '\\u0441',\n\tsdot: '\\u22C5',\n\tsdotb: '\\u22A1',\n\tsdote: '\\u2A66',\n\tsearhk: '\\u2925',\n\tseArr: '\\u21D8',\n\tsearr: '\\u2198',\n\tsearrow: '\\u2198',\n\tsect: '\\u00A7',\n\tsemi: '\\u003B',\n\tseswar: '\\u2929',\n\tsetminus: '\\u2216',\n\tsetmn: '\\u2216',\n\tsext: '\\u2736',\n\tSfr: '\\uD835\\uDD16',\n\tsfr: '\\uD835\\uDD30',\n\tsfrown: '\\u2322',\n\tsharp: '\\u266F',\n\tSHCHcy: '\\u0429',\n\tshchcy: '\\u0449',\n\tSHcy: '\\u0428',\n\tshcy: '\\u0448',\n\tShortDownArrow: '\\u2193',\n\tShortLeftArrow: '\\u2190',\n\tshortmid: '\\u2223',\n\tshortparallel: '\\u2225',\n\tShortRightArrow: '\\u2192',\n\tShortUpArrow: '\\u2191',\n\tshy: '\\u00AD',\n\tSigma: '\\u03A3',\n\tsigma: '\\u03C3',\n\tsigmaf: '\\u03C2',\n\tsigmav: '\\u03C2',\n\tsim: '\\u223C',\n\tsimdot: '\\u2A6A',\n\tsime: '\\u2243',\n\tsimeq: '\\u2243',\n\tsimg: '\\u2A9E',\n\tsimgE: '\\u2AA0',\n\tsiml: '\\u2A9D',\n\tsimlE: '\\u2A9F',\n\tsimne: '\\u2246',\n\tsimplus: '\\u2A24',\n\tsimrarr: '\\u2972',\n\tslarr: '\\u2190',\n\tSmallCircle: '\\u2218',\n\tsmallsetminus: '\\u2216',\n\tsmashp: '\\u2A33',\n\tsmeparsl: '\\u29E4',\n\tsmid: '\\u2223',\n\tsmile: '\\u2323',\n\tsmt: '\\u2AAA',\n\tsmte: '\\u2AAC',\n\tsmtes: '\\u2AAC\\uFE00',\n\tSOFTcy: '\\u042C',\n\tsoftcy: '\\u044C',\n\tsol: '\\u002F',\n\tsolb: '\\u29C4',\n\tsolbar: '\\u233F',\n\tSopf: '\\uD835\\uDD4A',\n\tsopf: '\\uD835\\uDD64',\n\tspades: '\\u2660',\n\tspadesuit: '\\u2660',\n\tspar: '\\u2225',\n\tsqcap: '\\u2293',\n\tsqcaps: '\\u2293\\uFE00',\n\tsqcup: '\\u2294',\n\tsqcups: '\\u2294\\uFE00',\n\tSqrt: '\\u221A',\n\tsqsub: '\\u228F',\n\tsqsube: '\\u2291',\n\tsqsubset: '\\u228F',\n\tsqsubseteq: '\\u2291',\n\tsqsup: '\\u2290',\n\tsqsupe: '\\u2292',\n\tsqsupset: '\\u2290',\n\tsqsupseteq: '\\u2292',\n\tsqu: '\\u25A1',\n\tSquare: '\\u25A1',\n\tsquare: '\\u25A1',\n\tSquareIntersection: '\\u2293',\n\tSquareSubset: '\\u228F',\n\tSquareSubsetEqual: '\\u2291',\n\tSquareSuperset: '\\u2290',\n\tSquareSupersetEqual: '\\u2292',\n\tSquareUnion: '\\u2294',\n\tsquarf: '\\u25AA',\n\tsquf: '\\u25AA',\n\tsrarr: '\\u2192',\n\tSscr: '\\uD835\\uDCAE',\n\tsscr: '\\uD835\\uDCC8',\n\tssetmn: '\\u2216',\n\tssmile: '\\u2323',\n\tsstarf: '\\u22C6',\n\tStar: '\\u22C6',\n\tstar: '\\u2606',\n\tstarf: '\\u2605',\n\tstraightepsilon: '\\u03F5',\n\tstraightphi: '\\u03D5',\n\tstrns: '\\u00AF',\n\tSub: '\\u22D0',\n\tsub: '\\u2282',\n\tsubdot: '\\u2ABD',\n\tsubE: '\\u2AC5',\n\tsube: '\\u2286',\n\tsubedot: '\\u2AC3',\n\tsubmult: '\\u2AC1',\n\tsubnE: '\\u2ACB',\n\tsubne: '\\u228A',\n\tsubplus: '\\u2ABF',\n\tsubrarr: '\\u2979',\n\tSubset: '\\u22D0',\n\tsubset: '\\u2282',\n\tsubseteq: '\\u2286',\n\tsubseteqq: '\\u2AC5',\n\tSubsetEqual: '\\u2286',\n\tsubsetneq: '\\u228A',\n\tsubsetneqq: '\\u2ACB',\n\tsubsim: '\\u2AC7',\n\tsubsub: '\\u2AD5',\n\tsubsup: '\\u2AD3',\n\tsucc: '\\u227B',\n\tsuccapprox: '\\u2AB8',\n\tsucccurlyeq: '\\u227D',\n\tSucceeds: '\\u227B',\n\tSucceedsEqual: '\\u2AB0',\n\tSucceedsSlantEqual: '\\u227D',\n\tSucceedsTilde: '\\u227F',\n\tsucceq: '\\u2AB0',\n\tsuccnapprox: '\\u2ABA',\n\tsuccneqq: '\\u2AB6',\n\tsuccnsim: '\\u22E9',\n\tsuccsim: '\\u227F',\n\tSuchThat: '\\u220B',\n\tSum: '\\u2211',\n\tsum: '\\u2211',\n\tsung: '\\u266A',\n\tSup: '\\u22D1',\n\tsup: '\\u2283',\n\tsup1: '\\u00B9',\n\tsup2: '\\u00B2',\n\tsup3: '\\u00B3',\n\tsupdot: '\\u2ABE',\n\tsupdsub: '\\u2AD8',\n\tsupE: '\\u2AC6',\n\tsupe: '\\u2287',\n\tsupedot: '\\u2AC4',\n\tSuperset: '\\u2283',\n\tSupersetEqual: '\\u2287',\n\tsuphsol: '\\u27C9',\n\tsuphsub: '\\u2AD7',\n\tsuplarr: '\\u297B',\n\tsupmult: '\\u2AC2',\n\tsupnE: '\\u2ACC',\n\tsupne: '\\u228B',\n\tsupplus: '\\u2AC0',\n\tSupset: '\\u22D1',\n\tsupset: '\\u2283',\n\tsupseteq: '\\u2287',\n\tsupseteqq: '\\u2AC6',\n\tsupsetneq: '\\u228B',\n\tsupsetneqq: '\\u2ACC',\n\tsupsim: '\\u2AC8',\n\tsupsub: '\\u2AD4',\n\tsupsup: '\\u2AD6',\n\tswarhk: '\\u2926',\n\tswArr: '\\u21D9',\n\tswarr: '\\u2199',\n\tswarrow: '\\u2199',\n\tswnwar: '\\u292A',\n\tszlig: '\\u00DF',\n\tTab: '\\u0009',\n\ttarget: '\\u2316',\n\tTau: '\\u03A4',\n\ttau: '\\u03C4',\n\ttbrk: '\\u23B4',\n\tTcaron: '\\u0164',\n\ttcaron: '\\u0165',\n\tTcedil: '\\u0162',\n\ttcedil: '\\u0163',\n\tTcy: '\\u0422',\n\ttcy: '\\u0442',\n\ttdot: '\\u20DB',\n\ttelrec: '\\u2315',\n\tTfr: '\\uD835\\uDD17',\n\ttfr: '\\uD835\\uDD31',\n\tthere4: '\\u2234',\n\tTherefore: '\\u2234',\n\ttherefore: '\\u2234',\n\tTheta: '\\u0398',\n\ttheta: '\\u03B8',\n\tthetasym: '\\u03D1',\n\tthetav: '\\u03D1',\n\tthickapprox: '\\u2248',\n\tthicksim: '\\u223C',\n\tThickSpace: '\\u205F\\u200A',\n\tthinsp: '\\u2009',\n\tThinSpace: '\\u2009',\n\tthkap: '\\u2248',\n\tthksim: '\\u223C',\n\tTHORN: '\\u00DE',\n\tthorn: '\\u00FE',\n\tTilde: '\\u223C',\n\ttilde: '\\u02DC',\n\tTildeEqual: '\\u2243',\n\tTildeFullEqual: '\\u2245',\n\tTildeTilde: '\\u2248',\n\ttimes: '\\u00D7',\n\ttimesb: '\\u22A0',\n\ttimesbar: '\\u2A31',\n\ttimesd: '\\u2A30',\n\ttint: '\\u222D',\n\ttoea: '\\u2928',\n\ttop: '\\u22A4',\n\ttopbot: '\\u2336',\n\ttopcir: '\\u2AF1',\n\tTopf: '\\uD835\\uDD4B',\n\ttopf: '\\uD835\\uDD65',\n\ttopfork: '\\u2ADA',\n\ttosa: '\\u2929',\n\ttprime: '\\u2034',\n\tTRADE: '\\u2122',\n\ttrade: '\\u2122',\n\ttriangle: '\\u25B5',\n\ttriangledown: '\\u25BF',\n\ttriangleleft: '\\u25C3',\n\ttrianglelefteq: '\\u22B4',\n\ttriangleq: '\\u225C',\n\ttriangleright: '\\u25B9',\n\ttrianglerighteq: '\\u22B5',\n\ttridot: '\\u25EC',\n\ttrie: '\\u225C',\n\ttriminus: '\\u2A3A',\n\tTripleDot: '\\u20DB',\n\ttriplus: '\\u2A39',\n\ttrisb: '\\u29CD',\n\ttritime: '\\u2A3B',\n\ttrpezium: '\\u23E2',\n\tTscr: '\\uD835\\uDCAF',\n\ttscr: '\\uD835\\uDCC9',\n\tTScy: '\\u0426',\n\ttscy: '\\u0446',\n\tTSHcy: '\\u040B',\n\ttshcy: '\\u045B',\n\tTstrok: '\\u0166',\n\ttstrok: '\\u0167',\n\ttwixt: '\\u226C',\n\ttwoheadleftarrow: '\\u219E',\n\ttwoheadrightarrow: '\\u21A0',\n\tUacute: '\\u00DA',\n\tuacute: '\\u00FA',\n\tUarr: '\\u219F',\n\tuArr: '\\u21D1',\n\tuarr: '\\u2191',\n\tUarrocir: '\\u2949',\n\tUbrcy: '\\u040E',\n\tubrcy: '\\u045E',\n\tUbreve: '\\u016C',\n\tubreve: '\\u016D',\n\tUcirc: '\\u00DB',\n\tucirc: '\\u00FB',\n\tUcy: '\\u0423',\n\tucy: '\\u0443',\n\tudarr: '\\u21C5',\n\tUdblac: '\\u0170',\n\tudblac: '\\u0171',\n\tudhar: '\\u296E',\n\tufisht: '\\u297E',\n\tUfr: '\\uD835\\uDD18',\n\tufr: '\\uD835\\uDD32',\n\tUgrave: '\\u00D9',\n\tugrave: '\\u00F9',\n\tuHar: '\\u2963',\n\tuharl: '\\u21BF',\n\tuharr: '\\u21BE',\n\tuhblk: '\\u2580',\n\tulcorn: '\\u231C',\n\tulcorner: '\\u231C',\n\tulcrop: '\\u230F',\n\tultri: '\\u25F8',\n\tUmacr: '\\u016A',\n\tumacr: '\\u016B',\n\tuml: '\\u00A8',\n\tUnderBar: '\\u005F',\n\tUnderBrace: '\\u23DF',\n\tUnderBracket: '\\u23B5',\n\tUnderParenthesis: '\\u23DD',\n\tUnion: '\\u22C3',\n\tUnionPlus: '\\u228E',\n\tUogon: '\\u0172',\n\tuogon: '\\u0173',\n\tUopf: '\\uD835\\uDD4C',\n\tuopf: '\\uD835\\uDD66',\n\tUpArrow: '\\u2191',\n\tUparrow: '\\u21D1',\n\tuparrow: '\\u2191',\n\tUpArrowBar: '\\u2912',\n\tUpArrowDownArrow: '\\u21C5',\n\tUpDownArrow: '\\u2195',\n\tUpdownarrow: '\\u21D5',\n\tupdownarrow: '\\u2195',\n\tUpEquilibrium: '\\u296E',\n\tupharpoonleft: '\\u21BF',\n\tupharpoonright: '\\u21BE',\n\tuplus: '\\u228E',\n\tUpperLeftArrow: '\\u2196',\n\tUpperRightArrow: '\\u2197',\n\tUpsi: '\\u03D2',\n\tupsi: '\\u03C5',\n\tupsih: '\\u03D2',\n\tUpsilon: '\\u03A5',\n\tupsilon: '\\u03C5',\n\tUpTee: '\\u22A5',\n\tUpTeeArrow: '\\u21A5',\n\tupuparrows: '\\u21C8',\n\turcorn: '\\u231D',\n\turcorner: '\\u231D',\n\turcrop: '\\u230E',\n\tUring: '\\u016E',\n\turing: '\\u016F',\n\turtri: '\\u25F9',\n\tUscr: '\\uD835\\uDCB0',\n\tuscr: '\\uD835\\uDCCA',\n\tutdot: '\\u22F0',\n\tUtilde: '\\u0168',\n\tutilde: '\\u0169',\n\tutri: '\\u25B5',\n\tutrif: '\\u25B4',\n\tuuarr: '\\u21C8',\n\tUuml: '\\u00DC',\n\tuuml: '\\u00FC',\n\tuwangle: '\\u29A7',\n\tvangrt: '\\u299C',\n\tvarepsilon: '\\u03F5',\n\tvarkappa: '\\u03F0',\n\tvarnothing: '\\u2205',\n\tvarphi: '\\u03D5',\n\tvarpi: '\\u03D6',\n\tvarpropto: '\\u221D',\n\tvArr: '\\u21D5',\n\tvarr: '\\u2195',\n\tvarrho: '\\u03F1',\n\tvarsigma: '\\u03C2',\n\tvarsubsetneq: '\\u228A\\uFE00',\n\tvarsubsetneqq: '\\u2ACB\\uFE00',\n\tvarsupsetneq: '\\u228B\\uFE00',\n\tvarsupsetneqq: '\\u2ACC\\uFE00',\n\tvartheta: '\\u03D1',\n\tvartriangleleft: '\\u22B2',\n\tvartriangleright: '\\u22B3',\n\tVbar: '\\u2AEB',\n\tvBar: '\\u2AE8',\n\tvBarv: '\\u2AE9',\n\tVcy: '\\u0412',\n\tvcy: '\\u0432',\n\tVDash: '\\u22AB',\n\tVdash: '\\u22A9',\n\tvDash: '\\u22A8',\n\tvdash: '\\u22A2',\n\tVdashl: '\\u2AE6',\n\tVee: '\\u22C1',\n\tvee: '\\u2228',\n\tveebar: '\\u22BB',\n\tveeeq: '\\u225A',\n\tvellip: '\\u22EE',\n\tVerbar: '\\u2016',\n\tverbar: '\\u007C',\n\tVert: '\\u2016',\n\tvert: '\\u007C',\n\tVerticalBar: '\\u2223',\n\tVerticalLine: '\\u007C',\n\tVerticalSeparator: '\\u2758',\n\tVerticalTilde: '\\u2240',\n\tVeryThinSpace: '\\u200A',\n\tVfr: '\\uD835\\uDD19',\n\tvfr: '\\uD835\\uDD33',\n\tvltri: '\\u22B2',\n\tvnsub: '\\u2282\\u20D2',\n\tvnsup: '\\u2283\\u20D2',\n\tVopf: '\\uD835\\uDD4D',\n\tvopf: '\\uD835\\uDD67',\n\tvprop: '\\u221D',\n\tvrtri: '\\u22B3',\n\tVscr: '\\uD835\\uDCB1',\n\tvscr: '\\uD835\\uDCCB',\n\tvsubnE: '\\u2ACB\\uFE00',\n\tvsubne: '\\u228A\\uFE00',\n\tvsupnE: '\\u2ACC\\uFE00',\n\tvsupne: '\\u228B\\uFE00',\n\tVvdash: '\\u22AA',\n\tvzigzag: '\\u299A',\n\tWcirc: '\\u0174',\n\twcirc: '\\u0175',\n\twedbar: '\\u2A5F',\n\tWedge: '\\u22C0',\n\twedge: '\\u2227',\n\twedgeq: '\\u2259',\n\tweierp: '\\u2118',\n\tWfr: '\\uD835\\uDD1A',\n\twfr: '\\uD835\\uDD34',\n\tWopf: '\\uD835\\uDD4E',\n\twopf: '\\uD835\\uDD68',\n\twp: '\\u2118',\n\twr: '\\u2240',\n\twreath: '\\u2240',\n\tWscr: '\\uD835\\uDCB2',\n\twscr: '\\uD835\\uDCCC',\n\txcap: '\\u22C2',\n\txcirc: '\\u25EF',\n\txcup: '\\u22C3',\n\txdtri: '\\u25BD',\n\tXfr: '\\uD835\\uDD1B',\n\txfr: '\\uD835\\uDD35',\n\txhArr: '\\u27FA',\n\txharr: '\\u27F7',\n\tXi: '\\u039E',\n\txi: '\\u03BE',\n\txlArr: '\\u27F8',\n\txlarr: '\\u27F5',\n\txmap: '\\u27FC',\n\txnis: '\\u22FB',\n\txodot: '\\u2A00',\n\tXopf: '\\uD835\\uDD4F',\n\txopf: '\\uD835\\uDD69',\n\txoplus: '\\u2A01',\n\txotime: '\\u2A02',\n\txrArr: '\\u27F9',\n\txrarr: '\\u27F6',\n\tXscr: '\\uD835\\uDCB3',\n\txscr: '\\uD835\\uDCCD',\n\txsqcup: '\\u2A06',\n\txuplus: '\\u2A04',\n\txutri: '\\u25B3',\n\txvee: '\\u22C1',\n\txwedge: '\\u22C0',\n\tYacute: '\\u00DD',\n\tyacute: '\\u00FD',\n\tYAcy: '\\u042F',\n\tyacy: '\\u044F',\n\tYcirc: '\\u0176',\n\tycirc: '\\u0177',\n\tYcy: '\\u042B',\n\tycy: '\\u044B',\n\tyen: '\\u00A5',\n\tYfr: '\\uD835\\uDD1C',\n\tyfr: '\\uD835\\uDD36',\n\tYIcy: '\\u0407',\n\tyicy: '\\u0457',\n\tYopf: '\\uD835\\uDD50',\n\tyopf: '\\uD835\\uDD6A',\n\tYscr: '\\uD835\\uDCB4',\n\tyscr: '\\uD835\\uDCCE',\n\tYUcy: '\\u042E',\n\tyucy: '\\u044E',\n\tYuml: '\\u0178',\n\tyuml: '\\u00FF',\n\tZacute: '\\u0179',\n\tzacute: '\\u017A',\n\tZcaron: '\\u017D',\n\tzcaron: '\\u017E',\n\tZcy: '\\u0417',\n\tzcy: '\\u0437',\n\tZdot: '\\u017B',\n\tzdot: '\\u017C',\n\tzeetrf: '\\u2128',\n\tZeroWidthSpace: '\\u200B',\n\tZeta: '\\u0396',\n\tzeta: '\\u03B6',\n\tZfr: '\\u2128',\n\tzfr: '\\uD835\\uDD37',\n\tZHcy: '\\u0416',\n\tzhcy: '\\u0436',\n\tzigrarr: '\\u21DD',\n\tZopf: '\\u2124',\n\tzopf: '\\uD835\\uDD6B',\n\tZscr: '\\uD835\\uDCB5',\n\tzscr: '\\uD835\\uDCCF',\n\tzwj: '\\u200D',\n\tzwnj: '\\u200C',\n});\n\n/**\n * @deprecated\n * Use `HTML_ENTITIES` instead.\n * @see {@link HTML_ENTITIES}\n */\nexports.entityMap = exports.HTML_ENTITIES;\n","'use strict';\n\nvar conventions = require('./conventions');\nvar g = require('./grammar');\nvar errors = require('./errors');\n\nvar isHTMLEscapableRawTextElement = conventions.isHTMLEscapableRawTextElement;\nvar isHTMLMimeType = conventions.isHTMLMimeType;\nvar isHTMLRawTextElement = conventions.isHTMLRawTextElement;\nvar hasOwn = conventions.hasOwn;\nvar NAMESPACE = conventions.NAMESPACE;\nvar ParseError = errors.ParseError;\nvar DOMException = errors.DOMException;\n\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\nfunction XMLReader() {}\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 = Object.create(null)));\n\t\tparse(source, defaultNSMap, entityMap, domBuilder, this.errorHandler);\n\t\tdomBuilder.endDocument();\n\t},\n};\n\n/**\n * Detecting everything that might be a reference,\n * including those without ending `;`, since those are allowed in HTML.\n * The entityReplacer takes care of verifying and transforming each occurrence,\n * and reports to the errorHandler on those that are not OK,\n * depending on the context.\n */\nvar ENTITY_REG = /&#?\\w+;?/g;\n\nfunction parse(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {\n\tvar isHTML = isHTMLMimeType(domBuilder.mimeType);\n\tif (source.indexOf(g.UNICODE_REPLACEMENT_CHARACTER) >= 0) {\n\t\treturn errorHandler.fatalError('Unicode replacement character detected, source encoding issues?');\n\t}\n\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\tsurrogate2 = 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\n\tfunction entityReplacer(a) {\n\t\tvar complete = a[a.length - 1] === ';' ? a : a + ';';\n\t\tif (!isHTML && complete !== a) {\n\t\t\terrorHandler.error('EntityRef: expecting ;');\n\t\t\treturn a;\n\t\t}\n\t\tvar match = g.Reference.exec(complete);\n\t\tif (!match || match[0].length !== complete.length) {\n\t\t\terrorHandler.error('entity not matching Reference production: ' + a);\n\t\t\treturn a;\n\t\t}\n\t\tvar k = complete.slice(1, -1);\n\t\tif (hasOwn(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\n\tfunction appendText(end) {\n\t\t//has some bugs\n\t\tif (end > start) {\n\t\t\tvar xt = source.substring(start, end).replace(ENTITY_REG, 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\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}\n\t\tlocator.columnNumber = p - lineStart + 1;\n\t}\n\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 unclosedTags = [];\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 (!isHTML && unclosedTags.length > 0) {\n\t\t\t\t\treturn errorHandler.fatalError('unclosed xml tag(s): ' + unclosedTags.join(', '));\n\t\t\t\t}\n\t\t\t\tif (!source.substring(start).match(/^\\s*$/)) {\n\t\t\t\t\tvar doc = domBuilder.doc;\n\t\t\t\t\tvar text = doc.createTextNode(source.substr(start));\n\t\t\t\t\tif (doc.documentElement) {\n\t\t\t\t\t\treturn errorHandler.error('Extra content at the end of the document');\n\t\t\t\t\t}\n\t\t\t\t\tdoc.appendChild(text);\n\t\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\tvar fromSource = source.substring(start, tagStart);\n\t\t\t\tif (!isHTML && unclosedTags.length === 0) {\n\t\t\t\t\tfromSource = fromSource.replace(new RegExp(g.S_OPT.source, 'g'), '');\n\t\t\t\t\tfromSource && errorHandler.error(\"Unexpected content outside root element: '\" + fromSource + \"'\");\n\t\t\t\t}\n\t\t\t\tappendText(tagStart);\n\t\t\t}\n\t\t\tswitch (source.charAt(tagStart + 1)) {\n\t\t\t\tcase '/':\n\t\t\t\t\tvar end = source.indexOf('>', tagStart + 2);\n\t\t\t\t\tvar tagNameRaw = source.substring(tagStart + 2, end > 0 ? end : undefined);\n\t\t\t\t\tif (!tagNameRaw) {\n\t\t\t\t\t\treturn errorHandler.fatalError('end tag name missing');\n\t\t\t\t\t}\n\t\t\t\t\tvar tagNameMatch = end > 0 && g.reg('^', g.QName_group, g.S_OPT, '$').exec(tagNameRaw);\n\t\t\t\t\tif (!tagNameMatch) {\n\t\t\t\t\t\treturn errorHandler.fatalError('end tag name contains invalid characters: \"' + tagNameRaw + '\"');\n\t\t\t\t\t}\n\t\t\t\t\tif (!domBuilder.currentElement && !domBuilder.doc.documentElement) {\n\t\t\t\t\t\t// not enough information to provide a helpful error message,\n\t\t\t\t\t\t// but parsing will throw since there is no root element\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tvar currentTagName =\n\t\t\t\t\t\tunclosedTags[unclosedTags.length - 1] ||\n\t\t\t\t\t\tdomBuilder.currentElement.tagName ||\n\t\t\t\t\t\tdomBuilder.doc.documentElement.tagName ||\n\t\t\t\t\t\t'';\n\t\t\t\t\tif (currentTagName !== tagNameMatch[1]) {\n\t\t\t\t\t\tvar tagNameLower = tagNameMatch[1].toLowerCase();\n\t\t\t\t\t\tif (!isHTML || currentTagName.toLowerCase() !== tagNameLower) {\n\t\t\t\t\t\t\treturn errorHandler.fatalError('Opening and ending tag mismatch: \"' + currentTagName + '\" != \"' + tagNameRaw + '\"');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tvar config = parseStack.pop();\n\t\t\t\t\tunclosedTags.pop();\n\t\t\t\t\tvar localNSMap = config.localNSMap;\n\t\t\t\t\tdomBuilder.endElement(config.uri, config.localName, currentTagName);\n\t\t\t\t\tif (localNSMap) {\n\t\t\t\t\t\tfor (var prefix in localNSMap) {\n\t\t\t\t\t\t\tif (hasOwn(localNSMap, prefix)) {\n\t\t\t\t\t\t\t\tdomBuilder.endPrefixMapping(prefix);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tend++;\n\t\t\t\t\tbreak;\n\t\t\t\t// end element\n\t\t\t\tcase '?': // \n\t\t\t\t\tlocator && position(tagStart);\n\t\t\t\t\tend = parseProcessingInstruction(source, tagStart, domBuilder, errorHandler);\n\t\t\t\t\tbreak;\n\t\t\t\tcase '!': // start) {\n\t\t\tstart = end;\n\t\t} else {\n\t\t\t//Possible sax fallback here, risk of positional error\n\t\t\tappendText(Math.max(tagStart, start) + 1);\n\t\t}\n\t}\n}\n\nfunction copyLocator(f, t) {\n\tt.lineNumber = f.lineNumber;\n\tt.columnNumber = f.columnNumber;\n\treturn t;\n}\n\n/**\n * @returns\n * end of the elementStartPart(end of elementEndPart for selfClosed el)\n * @see {@link #appendElement}\n */\nfunction parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler, isHTML) {\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 (hasOwn(el.attributeNames, qname)) {\n\t\t\treturn errorHandler.fatalError('Attribute ' + qname + ' redefined');\n\t\t}\n\t\tif (!isHTML && value.indexOf('<') >= 0) {\n\t\t\treturn errorHandler.fatalError(\"Unescaped '<' not allowed in attributes values\");\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(ENTITY_REG, entityReplacer),\n\t\t\tstartIndex\n\t\t);\n\t}\n\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\t\tcase '=':\n\t\t\t\tif (s === S_ATTR) {\n\t\t\t\t\t//attrName\n\t\t\t\t\tattrName = source.slice(start, p);\n\t\t\t\t\ts = S_EQ;\n\t\t\t\t} else if (s === S_ATTR_SPACE) {\n\t\t\t\t\ts = S_EQ;\n\t\t\t\t} else {\n\t\t\t\t\t//fatalError: equal must after attrName or space after attrName\n\t\t\t\t\tthrow new Error('attribute equal must after attrName'); // No known test case\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"'\":\n\t\t\tcase '\"':\n\t\t\t\tif (\n\t\t\t\t\ts === S_EQ ||\n\t\t\t\t\ts === S_ATTR //|| s == S_ATTR_SPACE\n\t\t\t\t) {\n\t\t\t\t\t//equal\n\t\t\t\t\tif (s === S_ATTR) {\n\t\t\t\t\t\terrorHandler.warning('attribute value must after \"=\"');\n\t\t\t\t\t\tattrName = source.slice(start, p);\n\t\t\t\t\t}\n\t\t\t\t\tstart = p + 1;\n\t\t\t\t\tp = source.indexOf(c, start);\n\t\t\t\t\tif (p > 0) {\n\t\t\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\t\t\taddAttribute(attrName, value, start - 1);\n\t\t\t\t\t\ts = S_ATTR_END;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//fatalError: no end quot match\n\t\t\t\t\t\tthrow new Error(\"attribute value no end '\" + c + \"' match\");\n\t\t\t\t\t}\n\t\t\t\t} else if (s == S_ATTR_NOQUOT_VALUE) {\n\t\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\t\taddAttribute(attrName, value, start);\n\t\t\t\t\terrorHandler.warning('attribute \"' + attrName + '\" missed start quot(' + c + ')!!');\n\t\t\t\t\tstart = p + 1;\n\t\t\t\t\ts = S_ATTR_END;\n\t\t\t\t} else {\n\t\t\t\t\t//fatalError: no equal before\n\t\t\t\t\tthrow new Error('attribute value must after \"=\"'); // No known test case\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase '/':\n\t\t\t\tswitch (s) {\n\t\t\t\t\tcase S_TAG:\n\t\t\t\t\t\tel.setTagName(source.slice(start, p));\n\t\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\tcase S_TAG_SPACE:\n\t\t\t\t\tcase S_TAG_CLOSE:\n\t\t\t\t\t\ts = S_TAG_CLOSE;\n\t\t\t\t\t\tel.closed = true;\n\t\t\t\t\tcase S_ATTR_NOQUOT_VALUE:\n\t\t\t\t\tcase S_ATTR:\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\t\tel.closed = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t//case S_EQ:\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Error(\"attribute invalid close char('/')\"); // No known test case\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase '': //end document\n\t\t\t\terrorHandler.error('unexpected end of input');\n\t\t\t\tif (s == S_TAG) {\n\t\t\t\t\tel.setTagName(source.slice(start, p));\n\t\t\t\t}\n\t\t\t\treturn p;\n\t\t\tcase '>':\n\t\t\t\tswitch (s) {\n\t\t\t\t\tcase S_TAG:\n\t\t\t\t\t\tel.setTagName(source.slice(start, p));\n\t\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\tcase S_TAG_SPACE:\n\t\t\t\t\tcase S_TAG_CLOSE:\n\t\t\t\t\t\tbreak; //normal\n\t\t\t\t\tcase S_ATTR_NOQUOT_VALUE: //Compatible state\n\t\t\t\t\tcase S_ATTR:\n\t\t\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\t\t\tif (value.slice(-1) === '/') {\n\t\t\t\t\t\t\tel.closed = true;\n\t\t\t\t\t\t\tvalue = value.slice(0, -1);\n\t\t\t\t\t\t}\n\t\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\t\tif (s === S_ATTR_SPACE) {\n\t\t\t\t\t\t\tvalue = attrName;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (s == S_ATTR_NOQUOT_VALUE) {\n\t\t\t\t\t\t\terrorHandler.warning('attribute \"' + value + '\" missed quot(\")!');\n\t\t\t\t\t\t\taddAttribute(attrName, value, start);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (!isHTML) {\n\t\t\t\t\t\t\t\terrorHandler.warning('attribute \"' + value + '\" missed value!! \"' + value + '\" instead!!');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taddAttribute(value, value, start);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase S_EQ:\n\t\t\t\t\t\tif (!isHTML) {\n\t\t\t\t\t\t\treturn errorHandler.fatalError('AttValue: \\' or \" expected');\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn p;\n\t\t\t/*xml space '\\x20' | #x9 | #xD | #xA; */\n\t\t\tcase '\\u0080':\n\t\t\t\tc = ' ';\n\t\t\tdefault:\n\t\t\t\tif (c <= ' ') {\n\t\t\t\t\t//space\n\t\t\t\t\tswitch (s) {\n\t\t\t\t\t\tcase S_TAG:\n\t\t\t\t\t\t\tel.setTagName(source.slice(start, p)); //tagName\n\t\t\t\t\t\t\ts = S_TAG_SPACE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase S_ATTR:\n\t\t\t\t\t\t\tattrName = source.slice(start, p);\n\t\t\t\t\t\t\ts = S_ATTR_SPACE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase S_ATTR_NOQUOT_VALUE:\n\t\t\t\t\t\t\tvar value = source.slice(start, p);\n\t\t\t\t\t\t\terrorHandler.warning('attribute \"' + value + '\" missed quot(\")!!');\n\t\t\t\t\t\t\taddAttribute(attrName, value, start);\n\t\t\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\t\t\ts = S_TAG_SPACE;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t//case S_TAG_SPACE:\n\t\t\t\t\t\t//case S_EQ:\n\t\t\t\t\t\t//case S_ATTR_SPACE:\n\t\t\t\t\t\t//\tvoid();break;\n\t\t\t\t\t\t//case S_TAG_CLOSE:\n\t\t\t\t\t\t//ignore warning\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//not space\n\t\t\t\t\t//S_TAG,\tS_ATTR,\tS_EQ,\tS_ATTR_NOQUOT_VALUE\n\t\t\t\t\t//S_ATTR_SPACE,\tS_ATTR_END,\tS_TAG_SPACE, S_TAG_CLOSE\n\t\t\t\t\tswitch (s) {\n\t\t\t\t\t\t//case S_TAG:void();break;\n\t\t\t\t\t\t//case S_ATTR:void();break;\n\t\t\t\t\t\t//case S_ATTR_NOQUOT_VALUE:void();break;\n\t\t\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\t\t\tif (!isHTML) {\n\t\t\t\t\t\t\t\terrorHandler.warning('attribute \"' + attrName + '\" missed value!! \"' + attrName + '\" instead2!!');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taddAttribute(attrName, attrName, start);\n\t\t\t\t\t\t\tstart = p;\n\t\t\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\t\t\terrorHandler.warning('attribute space is required\"' + attrName + '\"!!');\n\t\t\t\t\t\tcase S_TAG_SPACE:\n\t\t\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\t\t\tstart = p;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase S_EQ:\n\t\t\t\t\t\t\ts = S_ATTR_NOQUOT_VALUE;\n\t\t\t\t\t\t\tstart = p;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase S_TAG_CLOSE:\n\t\t\t\t\t\t\tthrow new Error(\"elements closed character '/' and '>' must be connected to\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t} //end outer switch\n\t\tp++;\n\t}\n}\n\n/**\n * @returns\n * `true` if a new namespace has been defined.\n */\nfunction appendElement(el, domBuilder, currentNSMap) {\n\tvar tagName = el.tagName;\n\tvar localNSMap = null;\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) {\n\t\t\t//hack!!\n\t\t\tif (localNSMap == null) {\n\t\t\t\tlocalNSMap = Object.create(null);\n\t\t\t\t_copy(currentNSMap, (currentNSMap = Object.create(null)));\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\tif (a.prefix) {\n\t\t\t//no prefix attribute has no namespace\n\t\t\tif (a.prefix === 'xml') {\n\t\t\t\ta.uri = NAMESPACE.XML;\n\t\t\t}\n\t\t\tif (a.prefix !== 'xmlns') {\n\t\t\t\ta.uri = currentNSMap[a.prefix];\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 (hasOwn(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}\n\nfunction parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {\n\t// https://html.spec.whatwg.org/#raw-text-elements\n\t// https://html.spec.whatwg.org/#escapable-raw-text-elements\n\t// https://html.spec.whatwg.org/#cdata-rcdata-restrictions:raw-text-elements\n\t// TODO: https://html.spec.whatwg.org/#cdata-rcdata-restrictions\n\tvar isEscapableRaw = isHTMLEscapableRawTextElement(tagName);\n\tif (isEscapableRaw || isHTMLRawTextElement(tagName)) {\n\t\tvar elEndStart = source.indexOf('', elStartEnd);\n\t\tvar text = source.substring(elStartEnd + 1, elEndStart);\n\n\t\tif (isEscapableRaw) {\n\t\t\ttext = text.replace(ENTITY_REG, entityReplacer);\n\t\t}\n\t\tdomBuilder.characters(text, 0, text.length);\n\t\treturn elEndStart;\n\t}\n\treturn elStartEnd + 1;\n}\n\nfunction _copy(source, target) {\n\tfor (var n in source) {\n\t\tif (hasOwn(source, n)) {\n\t\t\ttarget[n] = source[n];\n\t\t}\n\t}\n}\n\n/**\n * @typedef ParseUtils\n * @property {function(relativeIndex: number?): string | undefined} char\n * Provides look ahead access to a singe character relative to the current index.\n * @property {function(): number} getIndex\n * Provides read-only access to the current index.\n * @property {function(reg: RegExp): string | null} getMatch\n * Applies the provided regular expression enforcing that it starts at the current index and\n * returns the complete matching string,\n * and moves the current index by the length of the matching string.\n * @property {function(): string} getSource\n * Provides read-only access to the complete source.\n * @property {function(places: number?): void} skip\n * moves the current index by places (defaults to 1)\n * @property {function(): number} skipBlanks\n * Moves the current index by the amount of white space that directly follows the current index\n * and returns the amount of whitespace chars skipped (0..n),\n * or -1 if the end of the source was reached.\n * @property {function(): string} substringFromIndex\n * creates a substring from the current index to the end of `source`\n * @property {function(compareWith: string): boolean} substringStartsWith\n * Checks if source contains `compareWith`,\n * starting from the current index.\n * @see {@link parseUtils}\n */\n\n/**\n * A temporary scope for parsing and look ahead operations in `source`,\n * starting from index `start`.\n *\n * Some operations move the current index by a number of positions,\n * after which `getIndex` returns the new index.\n *\n * @param {string} source\n * @param {number} start\n * @returns {ParseUtils}\n */\nfunction parseUtils(source, start) {\n\tvar index = start;\n\n\tfunction char(n) {\n\t\tn = n || 0;\n\t\treturn source.charAt(index + n);\n\t}\n\n\tfunction skip(n) {\n\t\tn = n || 1;\n\t\tindex += n;\n\t}\n\n\tfunction skipBlanks() {\n\t\tvar blanks = 0;\n\t\twhile (index < source.length) {\n\t\t\tvar c = char();\n\t\t\tif (c !== ' ' && c !== '\\n' && c !== '\\t' && c !== '\\r') {\n\t\t\t\treturn blanks;\n\t\t\t}\n\t\t\tblanks++;\n\t\t\tskip();\n\t\t}\n\t\treturn -1;\n\t}\n\tfunction substringFromIndex() {\n\t\treturn source.substring(index);\n\t}\n\tfunction substringStartsWith(text) {\n\t\treturn source.substring(index, index + text.length) === text;\n\t}\n\n\tfunction getMatch(args) {\n\t\tvar expr = g.reg('^', args);\n\t\tvar match = expr.exec(substringFromIndex());\n\t\tif (match) {\n\t\t\tskip(match[0].length);\n\t\t\treturn match[0];\n\t\t}\n\t\treturn null;\n\t}\n\treturn {\n\t\tchar: char,\n\t\tgetIndex: function () {\n\t\t\treturn index;\n\t\t},\n\t\tgetMatch: getMatch,\n\t\tgetSource: function () {\n\t\t\treturn source;\n\t\t},\n\t\tskip: skip,\n\t\tskipBlanks: skipBlanks,\n\t\tsubstringFromIndex: substringFromIndex,\n\t\tsubstringStartsWith: substringStartsWith,\n\t};\n}\n\n/**\n * @param {ParseUtils} p\n * @param {DOMHandler} errorHandler\n * @returns {string}\n */\nfunction parseDoctypeInternalSubset(p, errorHandler) {\n\t/**\n\t * @param {ParseUtils} p\n\t * @param {DOMHandler} errorHandler\n\t * @returns {string}\n\t */\n\tfunction parsePI(p, errorHandler) {\n\t\tvar match = g.PI.exec(p.substringFromIndex());\n\t\tif (!match) {\n\t\t\treturn errorHandler.fatalError('processing instruction is not well-formed at position ' + p.getIndex());\n\t\t}\n\t\tif (match[1].toLowerCase() === 'xml') {\n\t\t\treturn errorHandler.fatalError(\n\t\t\t\t'xml declaration is only allowed at the start of the document, but found at position ' + p.getIndex()\n\t\t\t);\n\t\t}\n\t\tp.skip(match[0].length);\n\t\treturn match[0];\n\t}\n\t// Parse internal subset\n\tvar source = p.getSource();\n\tif (p.char() === '[') {\n\t\tp.skip(1);\n\t\tvar intSubsetStart = p.getIndex();\n\t\twhile (p.getIndex() < source.length) {\n\t\t\tp.skipBlanks();\n\t\t\tif (p.char() === ']') {\n\t\t\t\tvar internalSubset = source.substring(intSubsetStart, p.getIndex());\n\t\t\t\tp.skip(1);\n\t\t\t\treturn internalSubset;\n\t\t\t}\n\t\t\tvar current = null;\n\t\t\t// Only in external subset\n\t\t\t// if (char() === '<' && char(1) === '!' && char(2) === '[') {\n\t\t\t// \tparseConditionalSections(p, errorHandler);\n\t\t\t// } else\n\t\t\tif (p.char() === '<' && p.char(1) === '!') {\n\t\t\t\tswitch (p.char(2)) {\n\t\t\t\t\tcase 'E': // ELEMENT | ENTITY\n\t\t\t\t\t\tif (p.char(3) === 'L') {\n\t\t\t\t\t\t\tcurrent = p.getMatch(g.elementdecl);\n\t\t\t\t\t\t} else if (p.char(3) === 'N') {\n\t\t\t\t\t\t\tcurrent = p.getMatch(g.EntityDecl);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'A': // ATTRIBUTE\n\t\t\t\t\t\tcurrent = p.getMatch(g.AttlistDecl);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'N': // NOTATION\n\t\t\t\t\t\tcurrent = p.getMatch(g.NotationDecl);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '-': // COMMENT\n\t\t\t\t\t\tcurrent = p.getMatch(g.Comment);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else if (p.char() === '<' && p.char(1) === '?') {\n\t\t\t\tcurrent = parsePI(p, errorHandler);\n\t\t\t} else if (p.char() === '%') {\n\t\t\t\tcurrent = p.getMatch(g.PEReference);\n\t\t\t} else {\n\t\t\t\treturn errorHandler.fatalError('Error detected in Markup declaration');\n\t\t\t}\n\t\t\tif (!current) {\n\t\t\t\treturn errorHandler.fatalError('Error in internal subset at position ' + p.getIndex());\n\t\t\t}\n\t\t}\n\t\treturn errorHandler.fatalError('doctype internal subset is not well-formed, missing ]');\n\t}\n}\n\n/**\n * Called when the parser encounters an element starting with '') {\n\t\t\t\treturn errorHandler.fatalError('doctype not terminated with > at position ' + p.getIndex());\n\t\t\t}\n\t\t\tp.skip(1);\n\t\t\tdomBuilder.startDTD(doctype.name, doctype.publicId, doctype.systemId, doctype.internalSubset);\n\t\t\tdomBuilder.endDTD();\n\t\t\treturn p.getIndex();\n\t\t}\n\t\tdefault:\n\t\t\treturn errorHandler.fatalError('Not well-formed XML starting with \" 0) {\n\t\t\treturn errorHandler.fatalError(\n\t\t\t\t'processing instruction at position ' + start + ' is an xml declaration which is only at the start of the document'\n\t\t\t);\n\t\t}\n\t\tif (!g.XMLDecl.test(source.substring(start))) {\n\t\t\treturn errorHandler.fatalError('xml declaration is not well-formed');\n\t\t}\n\t}\n\tdomBuilder.processingInstruction(match[1], match[2]);\n\treturn start + match[0].length;\n}\n\nfunction ElementAttributes() {\n\tthis.attributeNames = Object.create(null);\n}\n\nElementAttributes.prototype = {\n\tsetTagName: function (tagName) {\n\t\tif (!g.QName_exact.test(tagName)) {\n\t\t\tthrow new Error('invalid tagName:' + tagName);\n\t\t}\n\t\tthis.tagName = tagName;\n\t},\n\taddValue: function (qName, value, offset) {\n\t\tif (!g.QName_exact.test(qName)) {\n\t\t\tthrow new Error('invalid attribute:' + qName);\n\t\t}\n\t\tthis.attributeNames[qName] = this.length;\n\t\tthis[this.length++] = { qName: qName, value: value, offset: offset };\n\t},\n\tlength: 0,\n\tgetLocalName: function (i) {\n\t\treturn this[i].localName;\n\t},\n\tgetLocator: function (i) {\n\t\treturn this[i].locator;\n\t},\n\tgetQName: function (i) {\n\t\treturn this[i].qName;\n\t},\n\tgetURI: function (i) {\n\t\treturn this[i].uri;\n\t},\n\tgetValue: function (i) {\n\t\treturn this[i].value;\n\t},\n\t//\t,getIndex:function(uri, localName)){\n\t//\t\tif(localName){\n\t//\n\t//\t\t}else{\n\t//\t\t\tvar qName = uri\n\t//\t\t}\n\t//\t},\n\t//\tgetValue:function(){return this.getValue(this.getIndex.apply(this,arguments))},\n\t//\tgetType:function(uri,localName){}\n\t//\tgetType:function(i){},\n};\n\nexports.XMLReader = XMLReader;\nexports.parseUtils = parseUtils;\nexports.parseDoctypeCommentOrCData = parseDoctypeCommentOrCData;\n","'use strict';\n\nvar conventions = require('./conventions');\nvar dom = require('./dom');\nvar errors = require('./errors');\nvar entities = require('./entities');\nvar sax = require('./sax');\n\nvar DOMImplementation = dom.DOMImplementation;\n\nvar hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace;\nvar isHTMLMimeType = conventions.isHTMLMimeType;\nvar isValidMimeType = conventions.isValidMimeType;\nvar MIME_TYPE = conventions.MIME_TYPE;\nvar NAMESPACE = conventions.NAMESPACE;\nvar ParseError = errors.ParseError;\n\nvar XMLReader = sax.XMLReader;\n\n/**\n * Normalizes line ending according to :\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 * @prettierignore\n */\nfunction normalizeLineEndings(input) {\n\treturn input.replace(/\\r[\\n\\u0085]/g, '\\n').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 {typeof assign} [assign]\n * The method to use instead of `conventions.assign`, which is used to copy values from\n * `options` before they are used for parsing.\n * @property {typeof DOMHandler} [domHandler]\n * For internal testing: The class for creating an instance for handling events from the SAX\n * parser.\n * *****Warning: By configuring a faulty implementation, the specified behavior can completely\n * be broken.*****.\n * @property {Function} [errorHandler]\n * DEPRECATED! use `onError` instead.\n * @property {function(level:ErrorLevel, message:string, context: DOMHandler):void}\n * [onError]\n * A function that is invoked for every error that occurs during parsing.\n *\n * If it is not provided, all errors are reported to `console.error`\n * and only `fatalError`s are thrown as a `ParseError`,\n * which prevents any further processing.\n * If the provided method throws, a `ParserError` is thrown,\n * which prevents any further processing.\n *\n * Be aware that many `warning`s are considered an error that prevents further processing in\n * most implementations.\n * @property {boolean} [locator=true]\n * Configures if the nodes created during parsing will have a `lineNumber` and a `columnNumber`\n * attribute describing their location in the XML string.\n * Default is true.\n * @property {(string) => string} [normalizeLineEndings]\n * used to replace line endings before parsing, defaults to `normalizeLineEndings`\n * @property {Object} [xmlns]\n * The XML namespaces that should be assumed when parsing.\n * The default namespace can be provided by the key that is the empty string.\n * When the `mimeType` for HTML, XHTML or SVG are passed to `parseFromString`,\n * the default namespace that will be used,\n * will be overridden according to the specification.\n * @see {@link normalizeLineEndings}\n */\n\n/**\n * The DOMParser interface provides the ability to parse XML or HTML source code from a string\n * into a DOM `Document`.\n *\n * ***xmldom is different from the spec in that it allows an `options` parameter,\n * to control the behavior***.\n *\n * @class\n * @param {DOMParserOptions} [options]\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\toptions = options || { locator: true };\n\n\t/**\n\t * The method to use instead of `conventions.assign`, which is used to copy values from\n\t * `options`\n\t * before they are used for parsing.\n\t *\n\t * @type {conventions.assign}\n\t * @private\n\t * @see {@link conventions.assign}\n\t * @readonly\n\t */\n\tthis.assign = options.assign || conventions.assign;\n\n\t/**\n\t * For internal testing: The class for creating an instance for handling events from the SAX\n\t * parser.\n\t * *****Warning: By configuring a faulty implementation, the specified behavior can completely\n\t * be broken*****.\n\t *\n\t * @type {typeof DOMHandler}\n\t * @private\n\t * @readonly\n\t */\n\tthis.domHandler = options.domHandler || DOMHandler;\n\n\t/**\n\t * A function that is invoked for every error that occurs during parsing.\n\t *\n\t * If it is not provided, all errors are reported to `console.error`\n\t * and only `fatalError`s are thrown as a `ParseError`,\n\t * which prevents any further processing.\n\t * If the provided method throws, a `ParserError` is thrown,\n\t * which prevents any further processing.\n\t *\n\t * Be aware that many `warning`s are considered an error that prevents further processing in\n\t * most implementations.\n\t *\n\t * @type {function(level:ErrorLevel, message:string, context: DOMHandler):void}\n\t * @see {@link onErrorStopParsing}\n\t * @see {@link onWarningStopParsing}\n\t */\n\tthis.onError = options.onError || options.errorHandler;\n\tif (options.errorHandler && typeof options.errorHandler !== 'function') {\n\t\tthrow new TypeError('errorHandler object is no longer supported, switch to onError!');\n\t} else if (options.errorHandler) {\n\t\toptions.errorHandler('warning', 'The `errorHandler` option has been deprecated, use `onError` instead!', this);\n\t}\n\n\t/**\n\t * used to replace line endings before parsing, defaults to `normalizeLineEndings`\n\t *\n\t * @type {(string) => string}\n\t * @readonly\n\t */\n\tthis.normalizeLineEndings = options.normalizeLineEndings || normalizeLineEndings;\n\n\t/**\n\t * Configures if the nodes created during parsing will have a `lineNumber` and a\n\t * `columnNumber`\n\t * attribute describing their location in the XML string.\n\t * Default is true.\n\t *\n\t * @type {boolean}\n\t * @readonly\n\t */\n\tthis.locator = !!options.locator;\n\n\t/**\n\t * The default namespace can be provided by the key that is the empty string.\n\t * When the `mimeType` for HTML, XHTML or SVG are passed to `parseFromString`,\n\t * the default namespace that will be used,\n\t * will be overridden according to the specification.\n\t *\n\t * @type {Readonly}\n\t * @readonly\n\t */\n\tthis.xmlns = this.assign(Object.create(null), options.xmlns);\n}\n\n/**\n * Parses `source` using the options in the way configured by the `DOMParserOptions` of `this`\n * `DOMParser`. If `mimeType` is `text/html` an HTML `Document` is created,\n * otherwise an XML `Document` is created.\n *\n * __It behaves different from the description in the living standard__:\n * - Uses the `options` passed to the `DOMParser` constructor to modify the behavior.\n * - Any unexpected input is reported to `onError` with either a `warning`,\n * `error` or `fatalError` level.\n * - Any `fatalError` throws a `ParseError` which prevents further processing.\n * - Any error thrown by `onError` is converted to a `ParseError` which prevents further\n * processing - If no `Document` was created during parsing it is reported as a `fatalError`.\n * *****Warning: By configuring a faulty DOMHandler implementation,\n * the specified behavior can completely be broken*****.\n *\n * @param {string} source\n * The XML mime type only allows string input!\n * @param {string} [mimeType='application/xml']\n * the mimeType or contentType of the document to be created determines the `type` of document\n * created (XML or HTML)\n * @returns {Document}\n * The `Document` node.\n * @throws {ParseError}\n * for any `fatalError` or anything that is thrown by `onError`\n * @throws {TypeError}\n * for any invalid `mimeType`\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString\n * @see https://html.spec.whatwg.org/#dom-domparser-parsefromstring-dev\n */\nDOMParser.prototype.parseFromString = function (source, mimeType) {\n\tif (!isValidMimeType(mimeType)) {\n\t\tthrow new TypeError('DOMParser.parseFromString: the provided mimeType \"' + mimeType + '\" is not valid.');\n\t}\n\tvar defaultNSMap = this.assign(Object.create(null), this.xmlns);\n\tvar entityMap = entities.XML_ENTITIES;\n\tvar defaultNamespace = defaultNSMap[''] || null;\n\tif (hasDefaultHTMLNamespace(mimeType)) {\n\t\tentityMap = entities.HTML_ENTITIES;\n\t\tdefaultNamespace = NAMESPACE.HTML;\n\t} else if (mimeType === MIME_TYPE.XML_SVG_IMAGE) {\n\t\tdefaultNamespace = NAMESPACE.SVG;\n\t}\n\tdefaultNSMap[''] = defaultNamespace;\n\tdefaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;\n\n\tvar domBuilder = new this.domHandler({\n\t\tmimeType: mimeType,\n\t\tdefaultNamespace: defaultNamespace,\n\t\tonError: this.onError,\n\t});\n\tvar locator = this.locator ? {} : undefined;\n\tif (this.locator) {\n\t\tdomBuilder.setDocumentLocator(locator);\n\t}\n\n\tvar sax = new XMLReader();\n\tsax.errorHandler = domBuilder;\n\tsax.domBuilder = domBuilder;\n\tvar isXml = !conventions.isHTMLMimeType(mimeType);\n\tif (isXml && typeof source !== 'string') {\n\t\tsax.errorHandler.fatalError('source is not a string');\n\t}\n\tsax.parse(this.normalizeLineEndings(String(source)), defaultNSMap, entityMap);\n\tif (!domBuilder.doc.documentElement) {\n\t\tsax.errorHandler.fatalError('missing root element');\n\t}\n\treturn domBuilder.doc;\n};\n\n/**\n * @typedef DOMHandlerOptions\n * @property {string} [mimeType=MIME_TYPE.XML_APPLICATION]\n * @property {string | null} [defaultNamespace=null]\n */\n/**\n * The class that is used to handle events from the SAX parser to create the related DOM\n * elements.\n *\n * Some methods are only implemented as an empty function,\n * since they are (at least currently) not relevant for xmldom.\n *\n * @class\n * @param {DOMHandlerOptions} [options]\n * @see http://www.saxproject.org/apidoc/org/xml/sax/ext/DefaultHandler2.html\n */\nfunction DOMHandler(options) {\n\tvar opt = options || {};\n\t/**\n\t * The mime type is used to determine if the DOM handler will create an XML or HTML document.\n\t * Only if it is set to `text/html` it will create an HTML document.\n\t * It defaults to MIME_TYPE.XML_APPLICATION.\n\t *\n\t * @type {string}\n\t * @see {@link MIME_TYPE}\n\t * @readonly\n\t */\n\tthis.mimeType = opt.mimeType || MIME_TYPE.XML_APPLICATION;\n\n\t/**\n\t * The namespace to use to create an XML document.\n\t * For the following reasons this is required:\n\t * - The SAX API for `startDocument` doesn't offer any way to pass a namespace,\n\t * since at that point there is no way for the parser to know what the default namespace from\n\t * the document will be.\n\t * - When creating using `DOMImplementation.createDocument` it is required to pass a\n\t * namespace,\n\t * to determine the correct `Document.contentType`, which should match `this.mimeType`.\n\t * - When parsing an XML document with the `application/xhtml+xml` mimeType,\n\t * the HTML namespace needs to be the default namespace.\n\t *\n\t * @type {string | null}\n\t * @private\n\t * @readonly\n\t */\n\tthis.defaultNamespace = opt.defaultNamespace || null;\n\n\t/**\n\t * @type {boolean}\n\t * @private\n\t */\n\tthis.cdata = false;\n\n\t/**\n\t * The last `Element` that was created by `startElement`.\n\t * `endElement` sets it to the `currentElement.parentNode`.\n\t *\n\t * Note: The sax parser currently sets it to white space text nodes between tags.\n\t *\n\t * @type {Element | Node | undefined}\n\t * @private\n\t */\n\tthis.currentElement = undefined;\n\n\t/**\n\t * The Document that is created as part of `startDocument`,\n\t * and returned by `DOMParser.parseFromString`.\n\t *\n\t * @type {Document | undefined}\n\t * @readonly\n\t */\n\tthis.doc = undefined;\n\n\t/**\n\t * The locator is stored as part of setDocumentLocator.\n\t * It is controlled and mutated by the SAX parser to store the current parsing position.\n\t * It is used by DOMHandler to set `columnNumber` and `lineNumber`\n\t * on the DOM nodes.\n\t *\n\t * @type {Readonly | undefined}\n\t * @private\n\t * @readonly (the\n\t * sax parser currently sometimes set's it)\n\t */\n\tthis.locator = undefined;\n\t/**\n\t * @type {function (level:ErrorLevel ,message:string, context:DOMHandler):void}\n\t * @readonly\n\t */\n\tthis.onError = opt.onError;\n}\n\nfunction position(locator, node) {\n\tnode.lineNumber = locator.lineNumber;\n\tnode.columnNumber = locator.columnNumber;\n}\n\nDOMHandler.prototype = {\n\t/**\n\t * Either creates an XML or an HTML document and stores it under `this.doc`.\n\t * If it is an XML document, `this.defaultNamespace` is used to create it,\n\t * and it will not contain any `childNodes`.\n\t * If it is an HTML document, it will be created without any `childNodes`.\n\t *\n\t * @see http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html\n\t */\n\tstartDocument: function () {\n\t\tvar impl = new DOMImplementation();\n\t\tthis.doc = isHTMLMimeType(this.mimeType) ? impl.createHTMLDocument(false) : impl.createDocument(this.defaultNamespace, '');\n\t},\n\tstartElement: function (namespaceURI, localName, qName, attrs) {\n\t\tvar doc = this.doc;\n\t\tvar el = doc.createElementNS(namespaceURI, qName || localName);\n\t\tvar len = attrs.length;\n\t\tappendElement(this, el);\n\t\tthis.currentElement = el;\n\n\t\tthis.locator && position(this.locator, el);\n\t\tfor (var i = 0; i < len; i++) {\n\t\t\tvar namespaceURI = attrs.getURI(i);\n\t\t\tvar value = attrs.getValue(i);\n\t\t\tvar 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\t}\n\t},\n\tendElement: function (namespaceURI, localName, qName) {\n\t\tthis.currentElement = this.currentElement.parentNode;\n\t},\n\tstartPrefixMapping: function (prefix, uri) {},\n\tendPrefixMapping: function (prefix) {},\n\tprocessingInstruction: function (target, data) {\n\t\tvar ins = this.doc.createProcessingInstruction(target, data);\n\t\tthis.locator && position(this.locator, ins);\n\t\tappendElement(this, ins);\n\t},\n\tignorableWhitespace: function (ch, start, length) {},\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\tendDocument: function () {\n\t\tthis.doc.normalize();\n\t},\n\t/**\n\t * Stores the locator to be able to set the `columnNumber` and `lineNumber`\n\t * on the created DOM nodes.\n\t *\n\t * @param {Locator} locator\n\t */\n\tsetDocumentLocator: function (locator) {\n\t\tif (locator) {\n\t\t\tlocator.lineNumber = 0;\n\t\t}\n\t\tthis.locator = locator;\n\t},\n\t//LexicalHandler\n\tcomment: function (chars, start, length) {\n\t\tchars = _toString.apply(this, arguments);\n\t\tvar comm = this.doc.createComment(chars);\n\t\tthis.locator && position(this.locator, comm);\n\t\tappendElement(this, comm);\n\t},\n\n\tstartCDATA: function () {\n\t\t//used in characters() methods\n\t\tthis.cdata = true;\n\t},\n\tendCDATA: function () {\n\t\tthis.cdata = false;\n\t},\n\n\tstartDTD: function (name, publicId, systemId, internalSubset) {\n\t\tvar impl = this.doc.implementation;\n\t\tif (impl && impl.createDocumentType) {\n\t\t\tvar dt = impl.createDocumentType(name, publicId, systemId, internalSubset);\n\t\t\tthis.locator && position(this.locator, dt);\n\t\t\tappendElement(this, dt);\n\t\t\tthis.doc.doctype = dt;\n\t\t}\n\t},\n\treportError: function (level, message) {\n\t\tif (typeof this.onError === 'function') {\n\t\t\ttry {\n\t\t\t\tthis.onError(level, message, this);\n\t\t\t} catch (e) {\n\t\t\t\tthrow new ParseError('Reporting ' + level + ' \"' + message + '\" caused ' + e, this.locator);\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.error('[xmldom ' + level + ']\\t' + message, _locator(this.locator));\n\t\t}\n\t},\n\t/**\n\t * @see http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html\n\t */\n\twarning: function (message) {\n\t\tthis.reportError('warning', message);\n\t},\n\terror: function (message) {\n\t\tthis.reportError('error', message);\n\t},\n\t/**\n\t * This function reports a fatal error and throws a ParseError.\n\t *\n\t * @param {string} message\n\t * - The message to be used for reporting and throwing the error.\n\t * @returns {never}\n\t * This function always throws an error and never returns a value.\n\t * @throws {ParseError}\n\t * Always throws a ParseError with the provided message.\n\t */\n\tfatalError: function (message) {\n\t\tthis.reportError('fatalError', message);\n\t\tthrow new ParseError(message, this.locator);\n\t},\n};\n\nfunction _locator(l) {\n\tif (l) {\n\t\treturn '\\n@#[line:' + l.lineNumber + ',col:' + l.columnNumber + ']';\n\t}\n}\n\nfunction _toString(chars, start, length) {\n\tif (typeof chars == 'string') {\n\t\treturn chars.substr(start, length);\n\t} else {\n\t\t//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(\n\t/\\w+/g,\n\tfunction (key) {\n\t\tDOMHandler.prototype[key] = function () {\n\t\t\treturn null;\n\t\t};\n\t}\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(handler, node) {\n\tif (!handler.currentElement) {\n\t\thandler.doc.appendChild(node);\n\t} else {\n\t\thandler.currentElement.appendChild(node);\n\t}\n}\n\n/**\n * A method that prevents any further parsing when an `error`\n * with level `error` is reported during parsing.\n *\n * @see {@link DOMParserOptions.onError}\n * @see {@link onWarningStopParsing}\n */\nfunction onErrorStopParsing(level) {\n\tif (level === 'error') throw 'onErrorStopParsing';\n}\n\n/**\n * A method that prevents any further parsing when any `error` is reported during parsing.\n *\n * @see {@link DOMParserOptions.onError}\n * @see {@link onErrorStopParsing}\n */\nfunction onWarningStopParsing() {\n\tthrow 'onWarningStopParsing';\n}\n\nexports.__DOMHandler = DOMHandler;\nexports.DOMParser = DOMParser;\nexports.normalizeLineEndings = normalizeLineEndings;\nexports.onErrorStopParsing = onErrorStopParsing;\nexports.onWarningStopParsing = onWarningStopParsing;\n","'use strict';\nvar conventions = require('./conventions');\nexports.assign = conventions.assign;\nexports.hasDefaultHTMLNamespace = conventions.hasDefaultHTMLNamespace;\nexports.isHTMLMimeType = conventions.isHTMLMimeType;\nexports.isValidMimeType = conventions.isValidMimeType;\nexports.MIME_TYPE = conventions.MIME_TYPE;\nexports.NAMESPACE = conventions.NAMESPACE;\n\nvar errors = require('./errors');\nexports.DOMException = errors.DOMException;\nexports.DOMExceptionName = errors.DOMExceptionName;\nexports.ExceptionCode = errors.ExceptionCode;\nexports.ParseError = errors.ParseError;\n\nvar dom = require('./dom');\nexports.Attr = dom.Attr;\nexports.CDATASection = dom.CDATASection;\nexports.CharacterData = dom.CharacterData;\nexports.Comment = dom.Comment;\nexports.Document = dom.Document;\nexports.DocumentFragment = dom.DocumentFragment;\nexports.DocumentType = dom.DocumentType;\nexports.DOMImplementation = dom.DOMImplementation;\nexports.Element = dom.Element;\nexports.Entity = dom.Entity;\nexports.EntityReference = dom.EntityReference;\nexports.LiveNodeList = dom.LiveNodeList;\nexports.NamedNodeMap = dom.NamedNodeMap;\nexports.Node = dom.Node;\nexports.NodeList = dom.NodeList;\nexports.Notation = dom.Notation;\nexports.ProcessingInstruction = dom.ProcessingInstruction;\nexports.Text = dom.Text;\nexports.XMLSerializer = dom.XMLSerializer;\n\nvar domParser = require('./dom-parser');\nexports.DOMParser = domParser.DOMParser;\nexports.onErrorStopParsing = domParser.onErrorStopParsing;\nexports.onWarningStopParsing = domParser.onWarningStopParsing;\n","import { DOMParser as O, DOMImplementation as T } from \"@xmldom/xmldom\";\nconst b = \"USJ\", N = \"3.1\", m = [\n \"type\",\n \"marker\",\n \"content\",\n \"sid\",\n \"eid\",\n \"number\",\n \"code\",\n \"altnumber\",\n \"pubnumber\",\n \"caller\",\n \"align\",\n \"category\"\n];\nfunction P(e) {\n return g.includes(e);\n}\nconst g = [\n // Old Testament\n \"GEN\",\n \"EXO\",\n \"LEV\",\n \"NUM\",\n \"DEU\",\n \"JOS\",\n \"JDG\",\n \"RUT\",\n \"1SA\",\n \"2SA\",\n \"1KI\",\n \"2KI\",\n \"1CH\",\n \"2CH\",\n \"EZR\",\n \"NEH\",\n \"EST\",\n \"JOB\",\n \"PSA\",\n \"PRO\",\n \"ECC\",\n \"SNG\",\n \"ISA\",\n \"JER\",\n \"LAM\",\n \"EZK\",\n \"DAN\",\n \"HOS\",\n \"JOL\",\n \"AMO\",\n \"OBA\",\n \"JON\",\n \"MIC\",\n \"NAM\",\n \"HAB\",\n \"ZEP\",\n \"HAG\",\n \"ZEC\",\n \"MAL\",\n // New Testament\n \"MAT\",\n \"MRK\",\n \"LUK\",\n \"JHN\",\n \"ACT\",\n \"ROM\",\n \"1CO\",\n \"2CO\",\n \"GAL\",\n \"EPH\",\n \"PHP\",\n \"COL\",\n \"1TH\",\n \"2TH\",\n \"1TI\",\n \"2TI\",\n \"TIT\",\n \"PHM\",\n \"HEB\",\n \"JAS\",\n \"1PE\",\n \"2PE\",\n \"1JN\",\n \"2JN\",\n \"3JN\",\n \"JUD\",\n \"REV\",\n // Deuterocanon\n \"TOB\",\n \"JDT\",\n \"ESG\",\n \"WIS\",\n \"SIR\",\n \"BAR\",\n \"LJE\",\n \"S3Y\",\n \"SUS\",\n \"BEL\",\n \"1MA\",\n \"2MA\",\n \"3MA\",\n \"4MA\",\n \"1ES\",\n \"2ES\",\n \"MAN\",\n \"PS2\",\n \"ODA\",\n \"PSS\",\n \"EZA\",\n \"5EZ\",\n \"6EZ\",\n \"DAG\",\n \"PS3\",\n \"2BA\",\n \"LBA\",\n \"JUB\",\n \"ENO\",\n \"1MQ\",\n \"2MQ\",\n \"3MQ\",\n \"REP\",\n \"4BA\",\n \"LAO\",\n // Non scripture\n \"FRT\",\n \"BAK\",\n \"OTH\",\n \"INT\",\n \"CNC\",\n \"GLO\",\n \"TDX\",\n \"NDX\",\n \"XXA\",\n \"XXB\",\n \"XXC\",\n \"XXD\",\n \"XXE\",\n \"XXF\",\n \"XXG\"\n], u = \"usx\", v = \"3.1\";\nfunction S(e) {\n const t = {};\n let i = e.tagName, o, r, d = \"append\";\n if ([\"row\", \"cell\"].includes(i) && (i = \"table:\" + i), e.attributes)\n for (let c = 0; c < e.attributes.length; c++) {\n const s = e.attributes[c];\n t[s.name] = s.value;\n }\n t.style && (o = t.style, delete t.style), t.vid && delete t.vid, t.closed && delete t.closed, t.status && delete t.status;\n let n = { type: i };\n o && (n.marker = o), n = { ...n, ...t }, e.firstChild && e.firstChild.nodeType === e.firstChild.TEXT_NODE && e.firstChild.nodeValue && e.firstChild.nodeValue.trim() !== \"\" && (r = e.firstChild.nodeValue);\n const f = Array.from(e.childNodes);\n n.content = [], r && n.content.push(r);\n for (const c of f) {\n if (c.tagName === void 0)\n continue;\n const [s, h] = S(c);\n switch (h) {\n case \"append\":\n n.content.push(s);\n break;\n case \"merge\":\n n.content = n.content.concat(s);\n break;\n }\n c.nextSibling && c.nextSibling.nodeType === c.nextSibling.TEXT_NODE && c.nextSibling.nodeValue && (c.nextSibling.nodeValue.trim() !== \"\" || c.nextSibling.nodeValue === \" \") && n.content.push(c.nextSibling.nodeValue);\n }\n return (n.content.length === 0 && n.type !== u || [\"chapter\", \"verse\", \"optbreak\", \"ms\"].includes(i) || o && [\"va\", \"ca\", \"b\"].includes(o)) && delete n.content, \"eid\" in n && [\"verse\", \"chapter\"].includes(i) && (d = \"ignore\"), [n, d];\n}\nfunction M(e) {\n const [t] = e ? S(e) : [{ content: [] }];\n return t.type = b, t.version = N, t;\n}\nfunction R(e) {\n const i = new O().parseFromString(e, \"text/xml\");\n return M(i.documentElement);\n}\nlet l, a;\nfunction A(e, t) {\n const i = e.createElement(\"verse\");\n return i.setAttribute(\"eid\", t), i;\n}\nfunction E(e, t) {\n const i = e.createElement(\"chapter\");\n return i.setAttribute(\"eid\", t), i;\n}\nfunction X(e, t) {\n t.type === \"unmatched\" ? e.setAttribute(\"marker\", t.marker) : e.setAttribute(\"style\", t.marker);\n for (const [i, o] of Object.entries(t))\n o && ![\"type\", \"marker\", \"content\"].includes(i) && e.setAttribute(i, o);\n}\nfunction p(e, t, i, o) {\n let r, d, n;\n if (typeof e == \"string\") r = i.createTextNode(e);\n else if (d = e.type.replace(\"table:\", \"\"), r = i.createElement(d), X(r, e), e.content)\n for (const [f, c] of e.content.entries()) {\n const s = f === e.content.length - 1;\n p(c, r, i, s);\n }\n a && (d === \"verse\" || t.tagName === \"para\" && o) && (n = A(i, a), a = void 0), d === \"verse\" && typeof e != \"string\" && e.sid !== void 0 && (a = e.sid), l && (d === \"chapter\" || d === \"para\" && o) && (n = E(i, l), l = void 0), d === \"chapter\" && typeof e != \"string\" && e.sid !== void 0 && (l = e.sid), n && !o && t.appendChild(n), t.appendChild(r), n && o && t.appendChild(n), o && t.nodeName === u && (a && t.appendChild(A(i, a)), l && t.appendChild(E(i, l)), a = void 0, l = void 0);\n}\nfunction y(e, t) {\n if (t.documentElement) {\n for (const [i, o] of e.content.entries()) {\n const r = i === e.content.length - 1;\n p(o, t.documentElement, t, r);\n }\n return t.documentElement ?? void 0;\n }\n}\nfunction B(e) {\n const t = new T().createDocument(\"\", u);\n return t.documentElement && (t.documentElement.setAttribute(\"version\", v), y(e, t)), t.toString();\n}\nexport {\n m as MARKER_OBJECT_PROPS,\n b as USJ_TYPE,\n N as USJ_VERSION,\n P as isValidBookCode,\n B as usjToUsxString,\n R as usxStringToUsj\n};\n//# sourceMappingURL=index.js.map\n","// This was disabled so class functions that are similar in purpose can be grouped together\n/* eslint-disable @typescript-eslint/member-ordering */\nimport {\n USJ_TYPE,\n type MarkerContent,\n type MarkerObject,\n type Usj,\n} from '@biblionexus-foundation/scripture-utilities';\nimport { VerseRef } from '@sillsdev/scripture';\nimport { JSONPath } from 'jsonpath-plus';\nimport {\n CHAPTER_TYPE,\n ContentJsonPath,\n IUsjReaderWriter,\n UsjContentLocation,\n VERSE_TYPE,\n VerseRefOffset,\n} from './usj-reader-writer.model';\n\nconst NODE_TYPES_NOT_CONTAINING_VERSE_TEXT = ['figure', 'note', 'sidebar', 'table'];\nObject.freeze(NODE_TYPES_NOT_CONTAINING_VERSE_TEXT);\n\n/** Map of USJ content arrays and objects inside content arrays to the content array owner */\ntype UsjParentMap = Map;\n\n/**\n * Represents information about where a USJ node resides in the `content` array of its parent.\n * `parent` is a reference to the node's parent, and `index` represents the numeric index inside of\n * `parent`'s content array.\n */\ntype StackItem = { parent: MarkerObject | Usj; index: number };\n\n/**\n * Stack of levels inside a USJ tree relative to a specific node. The top of the stack should always\n * be the root Usj object.\n */\ntype WorkingStack = StackItem[];\n\n/**\n * Chapter and verse numbers along with the node within a USJ object that represents the start of\n * that chapter + verse\n */\ntype ChapterVerseNode = {\n chapterNum: number | undefined;\n verseNum: number | undefined;\n /**\n * All text following this node belongs to the given chapter and verse until another chapter or\n * verse node is found\n */\n startingContentNode: MarkerObject | undefined;\n};\n\n/** Represents USJ formatted scripture with helpful utilities for working with it */\nexport default class UsjReaderWriter implements IUsjReaderWriter {\n private readonly usj: Usj;\n private parentMapInternal: UsjParentMap | undefined;\n\n constructor(usj: Usj) {\n this.usj = usj;\n }\n\n // If new variables are created to speed up queries, they should be reset here\n usjChanged(): void {\n this.parentMapInternal = undefined;\n }\n\n // #region Directly using the JSONPath package to perform JSONPath query -> USJ node\n\n findSingleValue(jsonPathQuery: string): T | undefined {\n const wrappedResults = JSONPath({ path: jsonPathQuery, json: this.usj, wrap: true });\n if (wrappedResults === undefined || wrappedResults.length === 0) return undefined;\n if (!Array.isArray(wrappedResults[0])) return wrappedResults[0];\n\n // There is no way to tell the difference between a query that returns a single result that is an\n // array and a query that returns multiple results wrapped in an array when `wrap` is false.\n // However, if `wrap` is true then a single result that is an array will be a different array\n // object than the array object within `usj`. So we need to run with `wrap` as true and false to\n // get the original array object back for a query that returns a single array.\n const unwrappedResults = JSONPath({ path: jsonPathQuery, json: this.usj, wrap: false });\n if (unwrappedResults.length === 1 && Array.isArray(unwrappedResults[0]))\n // I have no idea why eslint is mad about casting from `any` to `T`, but it doesn't like it\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n return unwrappedResults[0] as T;\n return unwrappedResults;\n }\n\n findParent(jsonPathQuery: string): T | undefined {\n // Note that \"resultType: 'parent'\" does not work for queries\n // The \"jsonpath-plus\" package allows putting a carat at the end of a query to get a parent\n return this.findSingleValue(`${jsonPathQuery}^`);\n }\n\n private findBookId(): string | undefined {\n return this.findSingleValue('$.content[?(@.type==\"book\" && @.marker==\"id\")].code');\n }\n\n private findChapterNode(chapterNumber: number): MarkerObject | undefined {\n const chapterQuery = `$..content[?(@.type==\"chapter\" && @.number==\"${chapterNumber}\")]`;\n return this.findSingleValue(chapterQuery);\n }\n\n // #endregion\n\n // #region Parent Maps\n\n private static createParentMapInternal(\n obj: MarkerObject,\n parent: MarkerObject | Usj,\n parentMap: UsjParentMap,\n ): void {\n parentMap.set(obj, parent);\n // USJ queries may return pointers to content arrays, not just objects\n if (obj.content) parentMap.set(obj.content, obj);\n obj.content?.forEach((child) => {\n if (typeof child === 'object') UsjReaderWriter.createParentMapInternal(child, obj, parentMap);\n });\n }\n\n /** Viewing a Usj object as a tree, build a map to walk up the tree */\n private createUsjParentMap(): UsjParentMap {\n const parentMap = new Map();\n if (this.usj.content) parentMap.set(this.usj.content, this.usj);\n this.usj.content.forEach((content) => {\n if (typeof content === 'object')\n UsjReaderWriter.createParentMapInternal(content, this.usj, parentMap);\n });\n return parentMap;\n }\n\n /** Create the parent map if it doesn't already exist and return it */\n private get parentMap(): UsjParentMap {\n if (this.parentMapInternal) return this.parentMapInternal;\n this.parentMapInternal = this.createUsjParentMap();\n return this.parentMapInternal;\n }\n\n // #endregion\n\n // #region Working Stacks\n\n /** Return the working stack applicable to the given node */\n private createWorkingStack(node: MarkerObject): WorkingStack {\n // Represents levels in the USJ node tree that are above the current node (i.e., ancestors)\n // Levels in the tree are represented as a stack, so the last item in the stack is node's parent\n const workingStack: WorkingStack = [];\n\n // Grab a reference so we don't keep checking if it exists\n const { parentMap } = this;\n\n // `node` might be in the middle of the USJ tree, so build up the stack before walking the tree\n let tempNode: MarkerObject | Usj = node;\n let tempParent = parentMap.get(tempNode);\n while (tempParent !== undefined) {\n if (!tempParent.content)\n throw new Error('Invalid parentMap: all parents should have content');\n\n if (\n // Referencing tempNode and tempParent is OK in the loop since 'let' is used instead of 'var'\n // eslint-disable-next-line no-loop-func\n !tempParent.content.find((tempChild, index) => {\n if (tempChild !== tempNode) return false;\n if (!tempParent) throw new Error('undefined \"tempParent\" should not be possible');\n workingStack.unshift({ parent: tempParent, index });\n return true;\n })\n )\n throw new Error(`Unable to find correct parent node of ${JSON.stringify(tempNode)}`);\n\n if (tempParent.type === USJ_TYPE) break;\n tempNode = tempParent;\n // TS doesn't understand that only Usj objects have type == USJ_TYPE\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n tempParent = parentMap.get(tempParent as MarkerObject);\n }\n\n return workingStack;\n }\n\n private static convertWorkingStackToJsonPath(stack: WorkingStack): ContentJsonPath {\n let jsonPath = '$';\n stack.forEach((stackLevel) => {\n jsonPath = `${jsonPath}.content[${stackLevel.index}]`;\n });\n // The JSONPath string construction above conforms to the ContentJsonPath type\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n return jsonPath as ContentJsonPath;\n }\n\n private convertJsonPathToWorkingStack(jsonPath: ContentJsonPath): WorkingStack {\n const retVal: WorkingStack = [];\n\n const levels = jsonPath.match(/content\\[(\\d+)\\]/g);\n if (!levels) throw new Error(`Malformed or unexpected jsonPath: ${jsonPath}`);\n\n let onNode: Usj | MarkerObject = this.usj;\n\n levels.forEach((level, onLevel) => {\n const indexString = /(\\d+)/.exec(level);\n if (!indexString) throw new Error(`Malformed or unexpected jsonPath: ${jsonPath}`);\n const index = parseInt(indexString[0], 10);\n retVal.push({ parent: onNode, index });\n if (onLevel + 1 < levels.length) {\n if (typeof onNode === 'string' || !onNode.content)\n throw new Error(`jsonPath points to node without children: ${JSON.stringify(onNode)}`);\n const nextNode = onNode.content[index];\n if (typeof nextNode === 'string')\n throw new Error(`jsonPath points to node without children: ${JSON.stringify(nextNode)}`);\n onNode = nextNode;\n }\n });\n\n return retVal;\n }\n\n // #endregion\n\n // #region Walk the node tree\n\n /**\n * Given the starting point of a tree to consider (`node`), find the rightmost MarkerObject from\n * the array of `content`. In the following example, this would be \"J\".\n *\n * A <- Consider \"A\" to be `node`\n * / / | \\ \\\n * B C D E F <- Consider these to be MarkerObjects inside the `content` array owned by \"A\"\n * | / \\ |\n * G H I J <- Consider these to be MarkerObjects inside their parents `content` arrays\n *\n * If \"F\" did not exist in this example, then \"E\" would be returned. If \"E\" and \"F\" didn't exist,\n * then \"I\" would be returned.\n *\n * The general idea here is that we are looking for the MarkerObject in Usj that is immediately\n * adjacent to whatever `node`'s next sibling is in `parent`'s `content` array.\n */\n private static findRightMostDescendantMarkerObject(\n node: MarkerObject,\n parent: MarkerObject | Usj,\n skipTypes: string[] = [],\n ): { node: MarkerObject; parent: MarkerObject | Usj } {\n // There are no descendants, so this is as deep as it goes\n if (!node.content) return { node, parent };\n\n for (let index = node.content.length - 1; index >= 0; index--) {\n const candidate = node.content[index];\n if (typeof candidate === 'object' && !skipTypes.includes(candidate.type)) {\n if (candidate.content)\n return this.findRightMostDescendantMarkerObject(candidate, node, skipTypes);\n return { node: candidate, parent: node };\n }\n }\n\n // All descendants were strings which aren't MarkerObjects\n return { node, parent };\n }\n\n private static findNextMatchingNodeUsingWorkingStack(\n node: MarkerContent,\n workingStack: WorkingStack,\n skipTypes: string[],\n searchFunction: (potentiallyMatchingNode: MarkerContent, workingStack: WorkingStack) => boolean,\n ): MarkerContent | undefined {\n // Walk the nodes in a depth-first, left-to-right manner until the search function returns true\n let nextNode: MarkerContent | undefined = node;\n while (nextNode !== undefined) {\n const skipNextNode = typeof nextNode === 'object' && skipTypes.includes(nextNode.type);\n\n // If we found the node we're looking for, we're done\n if (!skipNextNode && searchFunction(nextNode, workingStack)) return nextNode;\n\n // Look at the node's children\n if (!skipNextNode && typeof nextNode === 'object' && (nextNode.content?.length ?? 0) > 0) {\n workingStack.push({ parent: nextNode, index: 0 });\n // Same as `nextNode = nextNode.content[0];` without triggering 2 different eslint errors\n [nextNode] = nextNode.content;\n }\n // The node has no children, so look at the next sibling, or the parent's next sibling, etc. up the stack\n else {\n nextNode = undefined;\n while (workingStack.length > 0) {\n const nextLevel = workingStack.pop();\n // We know that `content` exists due to its presence in this data structure\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n if (nextLevel && nextLevel.index + 1 < nextLevel.parent.content!.length) {\n nextLevel.index += 1;\n workingStack.push(nextLevel);\n // We know that `content` exists due to its presence in this data structure\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n nextNode = nextLevel.parent.content![nextLevel.index];\n break;\n }\n }\n }\n }\n\n // We've looked everywhere, so there must not be an appropriate node anywhere\n return undefined;\n }\n\n /**\n * Walk through a USJ node tree depth-first, left-to-right to find the first node that matches\n * criteria specified by `searchFunction` (i.e., the first node where `searchFunction` returns\n * `true`)\n */\n private findNextMatchingNode(\n node: MarkerObject,\n skipTypes: string[],\n searchFunction: (potentiallyMatchingNode: MarkerContent, workingStack: WorkingStack) => boolean,\n ): MarkerContent | undefined {\n // Represents levels in the USJ node tree that are above the current node (i.e., ancestors)\n // Levels in the tree are represented as a stack, so the last item is the current node's parent\n const workingStack = this.createWorkingStack(node);\n\n return UsjReaderWriter.findNextMatchingNodeUsingWorkingStack(\n node,\n workingStack,\n skipTypes,\n searchFunction,\n );\n }\n\n // #endregion\n\n // #region Node -> JSONPath\n\n nodeToJsonPath(node: MarkerObject): ContentJsonPath {\n return UsjReaderWriter.convertWorkingStackToJsonPath(this.createWorkingStack(node));\n }\n\n // #endregion\n\n // #region USJ + node -> VerseRef + offset\n\n /** Find the chapter and verse that apply to a given USJ node */\n private findVerseRefForNode(\n node: MarkerContent,\n nodeParent: MarkerObject | Usj,\n retVal: ChapterVerseNode = {\n chapterNum: undefined,\n verseNum: undefined,\n startingContentNode: undefined,\n },\n ): ChapterVerseNode {\n // If we already have the data, we're done\n if (retVal.verseNum !== undefined && retVal.chapterNum !== undefined) return retVal;\n\n // See if this node gives us the data\n if (typeof node === 'object' && node.number !== undefined) {\n const nodeNumber = Number.parseInt(node.number, 10);\n if (node.type === CHAPTER_TYPE) {\n retVal.chapterNum = nodeNumber;\n retVal.verseNum = retVal.verseNum ?? 0;\n retVal.startingContentNode = retVal.startingContentNode ?? node;\n return retVal;\n }\n if (node.type === VERSE_TYPE && !retVal.verseNum) {\n retVal.verseNum = nodeNumber;\n retVal.startingContentNode = node;\n }\n }\n\n // Prepare to look for siblings of this node in the parent\n if (!nodeParent.content)\n throw new Error(`\"content\" array not found: ${JSON.stringify(nodeParent)}`);\n\n // Find the position of this node in the parent's content\n let nodeIndex = 0;\n for (let index = 0; index < nodeParent.content.length; index++) {\n if (nodeParent.content[index] === node) {\n nodeIndex = index;\n break;\n }\n }\n\n // Find the first, previous sibling of this node that is an object\n let previousNodeIndex = nodeIndex - 1;\n while (previousNodeIndex >= 0 && typeof nodeParent.content[previousNodeIndex] !== 'object')\n previousNodeIndex -= 1;\n\n // There are no more siblings to inspect from this parent, so walk up a level\n if (previousNodeIndex < 0) {\n // We can't walk up a level if we're at the top level Usj node, so we're done\n if (nodeParent.type === USJ_TYPE) {\n if (retVal.chapterNum === undefined) {\n retVal.chapterNum = 1;\n retVal.verseNum = 0;\n retVal.startingContentNode = undefined;\n }\n return retVal;\n }\n\n // TS doesn't understand that only Usj objects have type == USJ_TYPE\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n const nodeParentMarkerObject = nodeParent as MarkerObject;\n\n const grandparent = this.parentMap.get(nodeParentMarkerObject);\n if (!grandparent) throw new Error(`No parent found for ${JSON.stringify(nodeParent)}`);\n return this.findVerseRefForNode(nodeParentMarkerObject, grandparent, retVal);\n }\n\n // Walk down the sibling's children as far as we can\n // This is a MarkerObject based on the while loop a few lines above\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n const previousNode = nodeParent.content[previousNodeIndex] as MarkerObject;\n const descendant = UsjReaderWriter.findRightMostDescendantMarkerObject(\n previousNode,\n nodeParent,\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n );\n return this.findVerseRefForNode(descendant.node, descendant.parent, retVal);\n }\n\n nodeToVerseRefAndOffset(\n bookId: string,\n node: MarkerContent,\n nodeParent: MarkerObject | MarkerContent[] | undefined,\n ): { verseRef: VerseRef; offset: number } | undefined {\n if (typeof node === 'string' && nodeParent === undefined)\n throw new Error(`If \"node\" is a string, then \"nodeParent\" cannot be undefined`);\n\n let realParent: MarkerObject | Usj | undefined;\n // \"node\" cannot be a string if \"nodeParent\" is undefined\n // eslint-disable-next-line no-type-assertion/no-type-assertion\n if (nodeParent === undefined) realParent = this.parentMap.get(node as MarkerObject);\n else realParent = Array.isArray(nodeParent) ? this.parentMap.get(nodeParent) : nodeParent;\n if (realParent === undefined)\n throw new Error(`Cannot find parent for ${JSON.stringify(nodeParent)}`);\n\n const chapterVerseContent = this.findVerseRefForNode(node, realParent);\n if (!chapterVerseContent) return undefined;\n\n if (!chapterVerseContent.chapterNum)\n throw new Error(`Could not determine chapter number for ${JSON.stringify(node)}`);\n\n const verseRef = new VerseRef(\n bookId,\n chapterVerseContent.chapterNum.toString(),\n chapterVerseContent.verseNum ? chapterVerseContent.verseNum.toString() : '0',\n );\n\n let offset = 0;\n // Walk forward through the USJ nodes until `node` is found, incrementing `offset` along the way\n if (chapterVerseContent.startingContentNode !== undefined) {\n this.findNextMatchingNode(chapterVerseContent.startingContentNode, [], (n, stack) => {\n if (n === node) return true;\n if (stack.find((level) => NODE_TYPES_NOT_CONTAINING_VERSE_TEXT.includes(level.parent.type)))\n return false;\n if (typeof n === 'string') {\n offset += n.length;\n return false;\n }\n if (\n (n.type === CHAPTER_TYPE && n.number !== chapterVerseContent.chapterNum?.toString()) ||\n (n.type === VERSE_TYPE && n.number !== chapterVerseContent.verseNum?.toString())\n ) {\n offset = 0;\n return true;\n }\n return false;\n });\n }\n\n return { verseRef, offset };\n }\n\n // #endregion\n\n // #region JSONPath -> VerseRef + offset\n\n jsonPathToVerseRefAndOffset(jsonPathQuery: string, bookId?: string): VerseRefOffset {\n const effectiveBookId = bookId ?? this.findBookId();\n if (!effectiveBookId) throw new Error('Not able to determine the book ID');\n\n const target: MarkerContent | undefined = this.findSingleValue(jsonPathQuery);\n if (!target) throw new Error(`No result found for JSONPath query: ${jsonPathQuery}`);\n\n const parent: MarkerObject | MarkerContent[] | undefined = this.findParent(jsonPathQuery);\n if (!parent) throw new Error(`Could not determine parent for ${jsonPathQuery}`);\n\n const verseRefAndOffset = this.nodeToVerseRefAndOffset(effectiveBookId, target, parent);\n if (!verseRefAndOffset)\n throw new Error(`Could not determine VerseRef that corresponds to ${jsonPathQuery}`);\n\n return verseRefAndOffset;\n }\n\n // #endregion\n\n // #region VerseRef + offset -> Node + JSONPath + offset\n\n verseRefToUsjContentLocation(verseRef: VerseRef, verseRefOffset: number = 0): UsjContentLocation {\n if (verseRefOffset < 0) throw new Error('offset must be >= 0');\n\n // Prefer getting the book ID from the USJ itself, but it might not be available\n const bookId = this.findBookId() ?? verseRef.book;\n if (!bookId) throw new Error('Not able to determine the book ID');\n if (bookId !== verseRef.book)\n throw new Error(`Book IDs don't match: USJ=${bookId}, VerseRef=${verseRef.book}`);\n\n const chapterNode = this.findChapterNode(verseRef.chapterNum);\n if (chapterNode === undefined)\n throw new Error(`Could not find ${bookId} chapter ${verseRef.chapterNum}`);\n\n let foundAnotherChapter = false;\n let jsonPath: ContentJsonPath = '';\n const expectedVerse = verseRef.verse;\n const verseNode: MarkerContent | undefined = this.findNextMatchingNode(\n chapterNode,\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n (node, workingStack) => {\n if (node === chapterNode) {\n if (verseRef.verseNum === 0) {\n jsonPath = UsjReaderWriter.convertWorkingStackToJsonPath(workingStack);\n return true;\n }\n return false;\n }\n if (typeof node !== 'object') return false;\n if (node.type === CHAPTER_TYPE) {\n foundAnotherChapter = true;\n return true;\n }\n if (\n node.type === VERSE_TYPE &&\n node.number !== undefined &&\n node.number === expectedVerse\n ) {\n jsonPath = UsjReaderWriter.convertWorkingStackToJsonPath(workingStack);\n return true;\n }\n return false;\n },\n );\n\n if (foundAnotherChapter || verseNode === undefined || typeof verseNode === 'string')\n throw new Error(`Verse ${expectedVerse} not found in ${bookId} ${verseRef.chapterNum}`);\n\n if (verseRefOffset === 0) return { node: verseNode, offset: 0, jsonPath };\n\n let cumulativeVerseLengthSeen = 0;\n let usjNodeOffset = 0;\n let foundNode: MarkerContent | undefined;\n this.findNextMatchingNode(\n verseNode,\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n (node, workingStack) => {\n if (node === verseNode) return false;\n if (typeof node === 'string') {\n cumulativeVerseLengthSeen += node.length;\n if (cumulativeVerseLengthSeen > verseRefOffset) {\n jsonPath = UsjReaderWriter.convertWorkingStackToJsonPath(workingStack);\n usjNodeOffset = verseRefOffset - cumulativeVerseLengthSeen + node.length;\n foundNode = node;\n return true;\n }\n }\n // If we found another verse or chapter, then the offset was larger than the verse length\n // Just return the original verse node in that case\n else if (node.type === CHAPTER_TYPE || node.type === VERSE_TYPE) return true;\n return false;\n },\n );\n\n return { node: foundNode ?? verseNode, offset: usjNodeOffset, jsonPath };\n }\n\n // #endregion\n\n // #region Search for text from a node + JSONPath + offset\n\n findNextLocationOfMatchingText(\n startingPoint: UsjContentLocation,\n text: string,\n maxTextLengthToSearch: number = 1000,\n ): UsjContentLocation | undefined {\n let textScanned = '';\n let lengthScanned = 0;\n let lengthTrimmed = 0;\n let foundStartingAtOffset = 0;\n UsjReaderWriter.findNextMatchingNodeUsingWorkingStack(\n startingPoint.node,\n this.convertJsonPathToWorkingStack(startingPoint.jsonPath),\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n (node) => {\n if (typeof node !== 'string') return false;\n\n lengthScanned += node.length;\n textScanned = `${textScanned}${node}`;\n const textIndex = textScanned.indexOf(text);\n if (textIndex < 0) {\n // Keep the string we're keeping around from going too large\n lengthTrimmed += textScanned.length;\n if (textScanned.length > text.length)\n textScanned = textScanned.substring(textScanned.length - text.length);\n lengthTrimmed -= textScanned.length;\n\n // Stop looking if we haven't found it after scanning a lot of text\n return lengthScanned > maxTextLengthToSearch;\n }\n\n // We found it!\n foundStartingAtOffset = lengthTrimmed + textIndex;\n return true;\n },\n );\n\n // We never found what we wanted\n if (foundStartingAtOffset <= 0) return undefined;\n\n // The text might have been split between nodes, so we have to go through it one more time\n lengthScanned = 0;\n let finalOffset = 0;\n let finalStack: WorkingStack = [];\n const finalNode = UsjReaderWriter.findNextMatchingNodeUsingWorkingStack(\n startingPoint.node,\n this.convertJsonPathToWorkingStack(startingPoint.jsonPath),\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n (node, stack) => {\n if (typeof node !== 'string') return false;\n\n lengthScanned += node.length;\n if (lengthScanned < foundStartingAtOffset + 1) return false;\n\n finalOffset = foundStartingAtOffset - lengthScanned + node.length;\n finalStack = stack;\n return true;\n },\n );\n if (!finalNode) throw new Error('Internal error: inconsistent search results');\n\n return {\n node: finalNode,\n offset: finalOffset,\n jsonPath: UsjReaderWriter.convertWorkingStackToJsonPath(finalStack),\n };\n }\n\n // #endregion\n\n // #region Extract text from a node + JSONPath + offset\n\n extractText(start: UsjContentLocation, desiredLength: number): string {\n let retVal = '';\n let offsetRemaining = start.offset;\n let lengthRecorded = 0;\n UsjReaderWriter.findNextMatchingNodeUsingWorkingStack(\n start.node,\n this.convertJsonPathToWorkingStack(start.jsonPath),\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n (node) => {\n if (typeof node !== 'string') return false;\n if (offsetRemaining >= node.length) {\n offsetRemaining -= node.length;\n return false;\n }\n let remainingNode = node;\n if (offsetRemaining > 0) {\n remainingNode = remainingNode.substring(offsetRemaining);\n offsetRemaining = 0;\n }\n if (lengthRecorded + remainingNode.length < desiredLength) {\n lengthRecorded += remainingNode.length;\n retVal = `${retVal}${remainingNode}`;\n return false;\n }\n const lengthToCopy = desiredLength - lengthRecorded;\n retVal = `${retVal}${remainingNode.substring(0, lengthToCopy - 1)}`;\n return true;\n },\n );\n return retVal;\n }\n\n extractTextBetweenPoints(\n start: UsjContentLocation,\n end: UsjContentLocation,\n maxLength: number = 100,\n ): string {\n let retVal = '';\n UsjReaderWriter.findNextMatchingNodeUsingWorkingStack(\n start.node,\n this.convertJsonPathToWorkingStack(start.jsonPath),\n NODE_TYPES_NOT_CONTAINING_VERSE_TEXT,\n (node, currentStack) => {\n // `node` and `end.node` are both `MarkerContent` which might be strings or objects\n if (node === end.node) {\n // If both objects are the same, then we definitely found `end`\n if (typeof node === 'object') return true;\n\n // If both strings are the same, we need to verify that we're at the same place in `usj`\n if (end.jsonPath === UsjReaderWriter.convertWorkingStackToJsonPath(currentStack))\n return true;\n }\n if (typeof node !== 'string') return false;\n retVal = `${retVal}${node}`;\n if (retVal.length > maxLength) retVal = retVal.substring(0, maxLength);\n return retVal.length >= maxLength;\n },\n );\n return retVal;\n }\n\n // #endregion\n\n // #region Edit this USJ data\n\n private static removeContentNodesFromArray(\n contentArray: MarkerContent[],\n searchFunction: (potentiallyMatchingNode: MarkerContent) => boolean,\n ) {\n let removedCount = 0;\n for (let i = contentArray.length - 1; i >= 0; i--) {\n const node = contentArray[i];\n if (searchFunction(node)) {\n contentArray.splice(i, 1);\n removedCount += 1;\n } else if (typeof node !== 'string' && node.content)\n removedCount += this.removeContentNodesFromArray(node.content, searchFunction);\n }\n return removedCount;\n }\n\n removeContentNodes(searchFunction: (potentiallyMatchingNode: MarkerContent) => boolean): number {\n const retVal = UsjReaderWriter.removeContentNodesFromArray(this.usj.content, searchFunction);\n this.usjChanged();\n return retVal;\n }\n\n // #endregion\n}\n"],"names":["AsyncVariable","variableName","rejectIfNotSettledWithinMS","__publicField","resolve","reject","value","throwIfAlreadySettled","reason","Collator","locales","options","string1","string2","DateTimeFormat","date","startDate","endDate","PlatformEventEmitter","event","callback","callbackIndex","newGuid","s","isString","o","deepClone","obj","debounce","fn","delay","timeout","args","groupBy","items","keySelector","valueSelector","map","item","key","group","isErrorWithMessage","error","toErrorWithMessage","maybeError","getErrorMessage","wait","ms","waitForDuration","maxWaitTimeInMS","getAllObjectFunctionNames","_objId","objectFunctionNames","property","objectPrototype","createSyncProxyForAsyncObject","getObject","objectToProxy","target","prop","DocumentCombiner","baseDocument","documentName","document","previousDocumentVersion","documentToSet","contributions","contributionName","potentialOutput","outputIteration","contribution","mergeObjects","output","finalOutput","areNonArrayObjects","values","allMatch","areArrayObjects","startingPoint","copyFrom","ignoreDuplicateProperties","retVal","mergeObjectsInternal","startingPointObj","copyFromObj","Mutex","AsyncMutex","MutexMap","mutexID","NonValidatingDocumentCombiner","NumberFormat","startRange","endRange","UnsubscriberAsyncList","name","unsubscribers","unsubscriber","unsubs","results","unsubscriberSucceeded","index","P","R","t","e","n","N","B","O","S","K","g","k","x","T","X","V","w","L","G","A","H","C","I","y","q","U","m","l","h","c","E","r","D","i","a","u","v","f","d","b","p","J","M","charRegex","astralRange","comboRange","varRange","familyRange","astral","combo","fitz","modifier","nonAstral","regional","surrogatePair","zwj","blackFlag","family","optModifier","optVar","optJoin","seq","symbol","__importDefault","this","mod","dist","char_regex_1","require$$0","toArray","str","toArray_1","length","match","length_1","substring","begin","end","substring_1","substr","len","strLength","substr_1","limit","padString","padPosition","padRepeats","limit_1","indexOf","searchStr","pos","strArr","searchArr","finded","searchIndex","indexOf_1","ensureArray","maybeArray","at","string","stringLength","charAt","codePointAt","endsWith","searchString","endPosition","lastIndexOfSearchString","lastIndexOf","indexOfClosestClosingCurlyBrace","escaped","closeCurlyBraceIndex","formatReplacementStringToArray","replacers","contents","nextIntermediateStartIndex","addToContents","newContent","newContentIndex","newContentLength","intermediateContent","baseSubstring","replacerKey","replacerContent","endContent","formatReplacementString","content","includes","position","partialString","stringzIndexOf","validatedPosition","stringzLength","normalize","form","upperCaseForm","ordinalCompare","padEnd","targetLength","stringzLimit","padStart","correctSliceIndex","slice","indexStart","indexEnd","newStart","newEnd","split","separator","splitLimit","result","regexSeparator","matches","currentIndex","matchIndex","matchLength","startsWith","stringzSubstr","stringzSubstring","stringzToArray","isLocalizeKey","escapeStringRegexp","transformAndEnsureRegExpRegExpArray","stringStringMaybeArray","stringMaybeStringArray","transformAndEnsureRegExpArray","stringMaybeArray","scrBookData","FIRST_SCR_BOOK_NUM","LAST_SCR_BOOK_NUM","FIRST_SCR_CHAPTER_NUM","FIRST_SCR_VERSE_NUM","defaultScrRef","getChaptersForBook","bookNum","_a","offsetBook","scrRef","offset","offsetChapter","offsetVerse","getLocalizedIdFromBookNumber","bookNumber","localizationLanguage","getLocalizedString","id","Canon","bookName","parts","scrRefToBBBCCCVVV","VerseRef","compareScrRefs","scrRef1","scrRef2","getLocalizeKeyForScrollGroupId","scrollGroupId","getLocalizeKeysForScrollGroupIds","scrollGroupIds","formatScrRef","optionOrLocalizedBookName","chapterVerseSeparator","bookChapterSeparator","book","aggregateUnsubscribers","success","aggregateUnsubscriberAsyncs","unsubPromises","CHAPTER_TYPE","VERSE_TYPE","getOwnPropertyNames","getOwnPropertySymbols","hasOwnProperty","combineComparators","comparatorA","comparatorB","state","createIsCircular","areItemsEqual","cache","cachedA","cachedB","getStrictProperties","object","hasOwn","sameValueZeroEqual","OWNER","getOwnPropertyDescriptor","keys","areArraysEqual","areDatesEqual","areMapsEqual","matchedIndices","aIterable","aResult","bResult","bIterable","hasMatch","aKey","aValue","_b","bKey","bValue","areObjectsEqual","properties","areObjectsEqualStrict","descriptorA","descriptorB","arePrimitiveWrappersEqual","areRegExpsEqual","areSetsEqual","areTypedArraysEqual","ARGUMENTS_TAG","BOOLEAN_TAG","DATE_TAG","MAP_TAG","NUMBER_TAG","OBJECT_TAG","REG_EXP_TAG","SET_TAG","STRING_TAG","isArray","isTypedArray","assign","getTag","createEqualityComparator","constructor","tag","createEqualityComparatorConfig","circular","createCustomConfig","strict","config","areArraysEqual$1","areMapsEqual$1","areObjectsEqual$1","areSetsEqual$1","createInternalEqualityComparator","compare","_indexOrKeyA","_indexOrKeyB","_parentA","_parentB","createIsEqual","comparator","createState","equals","meta","deepEqual","createCustomEqual","createCustomInternalComparator","isEqualDeep","isSubset","objectWithAllProperties","objectWithPartialProperties","partialArray","allArray","partialObj","allObj","serialize","replacer","space","replacerValue","newValue","deserialize","reviver","replaceNull","verseRefReviver","_vrefKey","vrefValue","chapter","verse","versification","ScrVers","combinedReviver","reviverKey","reviverVal","parsedObject","isSerializable","serializedValue","htmlEncode","getCurrentLocale","formatBytes","fileSize","decimals","sizes","sizeToUse","settingsDefs","removeJsonToTypeScriptTypesStuff","defs","def","projectSettingsDocumentSchema","settingsDocumentSchema","localizedStringsDefs","localizedStringsDocumentSchema","menuDocumentSchema","find","list","predicate","ac","freeze","oc","source","HTML_BOOLEAN_ATTRIBUTES","isHTMLBooleanAttribute","HTML_VOID_ELEMENTS","isHTMLVoidElement","tagName","HTML_RAW_TEXT_ELEMENTS","isHTMLRawTextElement","isHTMLEscapableRawTextElement","isHTMLMimeType","mimeType","MIME_TYPE","hasDefaultHTMLNamespace","_MIME_TYPES","isValidMimeType","NAMESPACE","conventions","extendError","writableName","DOMExceptionName","DOMExceptionNames","isValidDomExceptionCode","endsWithError","DOMException","messageOrCode","nameOrMessage","code","ExceptionCode","entries","ParseError","message","locator","errors","detectUnicodeSupport","RegExpImpl","UNICODE_SUPPORT","chars","regexp","chars_without","search","reg","self","part","isStr","regg","UNICODE_REPLACEMENT_CHARACTER","Char","_SChar","SChar_s","S_OPT","NameStartChar","NameStartChar_s","NameChar","Name","Nmtoken","EntityRef","CharRef","Reference","PEReference","EntityValue","AttValue","NCNameStartChar","NCNameChar","NCName","QName","QName_exact","QName_group","SystemLiteral","PI","PubidChar","PubidLiteral","COMMENT_START","COMMENT_END","Comment","PCDATA","Mixed","_children_quantity","children","contentspec","ELEMENTDECL_START","elementdecl","NotationType","Enumeration","EnumeratedType","AttType","DefaultDecl","AttDef","ATTLIST_DECL_START","AttlistDecl","SYSTEM","PUBLIC","ExternalID","ExternalID_match","NDataDecl","EntityDef","ENTITY_DECL_START","GEDecl","PEDef","PEDecl","EntityDecl","PublicID","NotationDecl","Eq","VersionNum","VersionInfo","EncName","EncodingDecl","SDDecl","XMLDecl","DOCTYPE_DECL_START","CDATA_START","CDATA_END","CDStart","CDEnd","CData","CDSect","grammar","PDC","require$$1","require$$2","checkSymbol","notEmptyString","input","splitOnASCIIWhitespace","orderedSetReducer","current","element","toOrderedSet","arrayIncludes","validateQualifiedName","qualifiedName","validateAndExtract","namespace","prefix","localName","splitResult","copy","src","dest","_extends","Class","Super","pt","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","DocumentPosition","parentChain","node","chain","commonAncestor","docGUID","doc","NodeList","nodeFilter","buf","serializeToString","me","LiveNodeList","refresh","_updateLiveList","inc","ls","__set__","NamedNodeMap","_findNodeIndex","_addNamedNode","el","newAttr","oldAttr","_onRemoveAttribute","_onAddAttribute","_removeNamedNode","attr","lastIndex","namespaceURI","DOMImplementation","feature","version","doctype","contentType","Document","root","publicId","systemId","internalSubset","DocumentType","title","htmlNode","headNode","titleNode","Node","rootNode","other","parent","otherNode","newChild","refChild","_insertBefore","oldChild","assertPreReplacementValidityInDocument","_removeChild","deep","cloneNode","child","next","node1","node2","attr1","attr2","Attr","chain1","chain2","ca","_xmlEncoder","_visitNode","opt","ns","remove","_onUpdateChild","childNodes","parentNode","oldPreviousSibling","oldNextSibling","hasValidParentNodeType","hasInsertableNodeType","isDocTypeNode","isElementNode","isTextNode","isElementInsertionPossible","parentChildNodes","docTypeNode","isElementReplacementPossible","hasElementChildThatIsNotChild","assertPreInsertionValidity1to5","assertPreInsertionValidityInDocument","nodeChildNodes","nodeChildElements","parentElementChild","_inDocumentAssertion","cp","newFirst","newLast","pre","removed","importedNode","importNode","rtv","Element","attrs","DocumentFragment","data","Text","CDATASection","ProcessingInstruction","EntityReference","validated","old","classNames","classNamesSet","base","nodeClassNames","nodeClassNamesSet","isHTMLDocument","lowerQualifiedName","nodeQualifiedName","matchingQName","CharacterData","count","text","start","newText","newNode","Notation","Entity","XMLSerializer","nodeSerializeToString","refNode","uri","visibleNamespaces","needNamespaceDefine","isHTML","addSerializedAttribute","nodeName","prefixedNodeName","defaultNS","ai","nsi","canCloseTag","pubid","sysid","attrs2","getTextContent","dom","exports","S_TAG","S_ATTR","S_ATTR_SPACE","S_EQ","S_ATTR_NOQUOT_VALUE","S_ATTR_END","S_TAG_SPACE","S_TAG_CLOSE","XMLReader","defaultNSMap","entityMap","domBuilder","_copy","parse","ENTITY_REG","defaultNSMapCopy","errorHandler","fixedFromCharCode","surrogate1","surrogate2","entityReplacer","complete","appendText","xt","lineEnd","linePattern","lineStart","parseStack","unclosedTags","tagStart","fromSource","tagNameRaw","tagNameMatch","currentTagName","tagNameLower","localNSMap","parseProcessingInstruction","parseDoctypeCommentOrCData","ElementAttributes","currentNSMap","parseElementStartPart","locator2","copyLocator","appendElement","parseHtmlSpecialContent","addAttribute","qname","startIndex","attrName","qName","nsp","nsPrefix","elStartEnd","isEscapableRaw","elEndStart","parseUtils","char","skip","skipBlanks","blanks","substringFromIndex","substringStartsWith","getMatch","expr","parseDoctypeInternalSubset","parsePI","intSubsetStart","comment","cdata","sax","entities","require$$3","require$$4","normalizeLineEndings","DOMParser","DOMHandler","defaultNamespace","isXml","impl","ins","ch","_toString","charNode","comm","dt","level","_locator","handler","NODE_TYPES_NOT_CONTAINING_VERSE_TEXT","UsjReaderWriter","usj","jsonPathQuery","wrappedResults","JSONPath","unwrappedResults","chapterNumber","chapterQuery","parentMap","workingStack","tempNode","tempParent","tempChild","USJ_TYPE","stack","jsonPath","stackLevel","levels","onNode","onLevel","indexString","nextNode","skipTypes","candidate","searchFunction","skipNextNode","nextLevel","nodeParent","nodeNumber","nodeIndex","previousNodeIndex","nodeParentMarkerObject","grandparent","previousNode","descendant","bookId","realParent","chapterVerseContent","verseRef","effectiveBookId","verseRefAndOffset","verseRefOffset","chapterNode","foundAnotherChapter","expectedVerse","verseNode","cumulativeVerseLengthSeen","usjNodeOffset","foundNode","maxTextLengthToSearch","textScanned","lengthScanned","lengthTrimmed","foundStartingAtOffset","textIndex","finalOffset","finalStack","finalNode","desiredLength","offsetRemaining","lengthRecorded","remainingNode","lengthToCopy","maxLength","currentStack","contentArray","removedCount"],"mappings":";;;;;AACA,MAAqBA,GAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcpC,YAAYC,GAAsBC,IAAqC,KAAO;AAb7D,IAAAC,EAAA;AACA,IAAAA,EAAA;AACT,IAAAA,EAAA;AACA,IAAAA,EAAA;AAWN,SAAK,eAAeF,GACpB,KAAK,iBAAiB,IAAI,QAAW,CAACG,GAASC,MAAW;AACxD,WAAK,WAAWD,GAChB,KAAK,WAAWC;AAAA,IAAA,CACjB,GACGH,IAA6B,KAC/B,WAAW,MAAM;AACf,MAAI,KAAK,aACP,KAAK,SAAS,oCAAoC,KAAK,YAAY,YAAY,GAC/E,KAAK,SAAS;AAAA,OAEfA,CAA0B,GAE/B,OAAO,KAAK,IAAI;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,UAAsB;AACxB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,aAAsB;AACjB,WAAA,OAAO,SAAS,IAAI;AAAA,EAC7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,eAAeI,GAAUC,IAAiC,IAAa;AACrE,QAAI,KAAK;AACP,cAAQ,MAAM,GAAG,KAAK,YAAY,wBAAwB,GAC1D,KAAK,SAASD,CAAK,GACnB,KAAK,SAAS;AAAA,SACT;AACL,UAAIC,EAA6B,OAAA,MAAM,GAAG,KAAK,YAAY,sBAAsB;AACjF,cAAQ,MAAM,qCAAqC,KAAK,YAAY,EAAE;AAAA,IACxE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA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A,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AACF,GAAGC,KAAI;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAGC,KAAI;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA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A,KAAK;AAC3C,YAAAid,IAAO6S,EAAa9vB,CAAC;AACvB,MAAAqtB,EAAepQ,CAAI,KACR6S,EAAA,OAAO9vB,GAAG,CAAC,GACR+vB,KAAA,KACP,OAAO9S,KAAS,YAAYA,EAAK,YAC1C8S,KAAgB,KAAK,4BAA4B9S,EAAK,SAASoQ,CAAc;AAAA,IACjF;AACO,WAAA0C;AAAA,EACT;AAAA,EAEA,mBAAmB1C,GAA6E;AAC9F,UAAM1wB,IAASkvB,EAAgB,4BAA4B,KAAK,IAAI,SAASwB,CAAc;AAC3F,gBAAK,WAAW,GACT1wB;AAAA,EACT;AAAA;AAGF;","x_google_ignoreList":[11,12,13,19,28,29,30,31,32,33,34,35,36]} \ No newline at end of file diff --git a/lib/platform-bible-utils/src/serialization.test.ts b/lib/platform-bible-utils/src/serialization.test.ts new file mode 100644 index 0000000000..e0c1fc14f2 --- /dev/null +++ b/lib/platform-bible-utils/src/serialization.test.ts @@ -0,0 +1,64 @@ +// Many tests must use null +/* eslint-disable no-null/no-null */ +import { VerseRef, ScrVers } from '@sillsdev/scripture'; +import { serialize, deserialize } from './serialization'; + +describe('serialize', () => { + it('should convert undefined properties to null in JSON string', () => { + const obj = { a: 1, b: undefined, c: null }; + const result = serialize(obj); + expect(result).toBe('{"a":1,"b":null,"c":null}'); + }); + + it('should use the replacer function if provided', () => { + const obj = { a: 1, b: 2 }; + const replacer = (key: string, value: unknown) => (key === 'b' ? undefined : value); + const result = serialize(obj, replacer); + expect(result).toBe('{"a":1,"b":null}'); + }); + + it('should add indentation if space parameter is provided', () => { + const obj = { a: 1, b: 2 }; + const result = serialize(obj, undefined, 2); + expect(result).toBe('{\n "a": 1,\n "b": 2\n}'); + }); +}); + +describe('deserialize', () => { + it('should convert null properties to undefined in JavaScript object', () => { + const json = '{"a":1,"b":null,"c":null}'; + const result = deserialize(json); + expect(result).toEqual({ a: 1, b: undefined, c: undefined }); + }); + + it('should use the reviver function if provided', () => { + const json = '{"a":1,"b":2}'; + const reviver = (key: string, value: unknown) => (key === 'b' ? null : value); + const result = deserialize(json, reviver); + expect(result).toEqual({ a: 1, b: undefined }); + }); + + it('should handle nested objects correctly', () => { + const json = '{"a":1,"b":{"c":null}}'; + const result = deserialize(json); + expect(result).toEqual({ a: 1, b: { c: undefined } }); + }); + + it('should convert SerializedVerseRef to VerseRef', () => { + const json = '{"book":"GEN","chapterNum":1,"verseNum":1}'; + const result = deserialize(json); + expect(result).toEqual(new VerseRef('GEN', '1', '1')); + }); + + it('should handle SerializedVerseRef with versification', () => { + const json = '{"book":"GEN","chapterNum":1,"verseNum":1,"versificationStr":"English"}'; + const result = deserialize(json); + expect(result).toEqual(new VerseRef('GEN', '1', '1', new ScrVers('English'))); + }); + + it('should handle nested SerializedVerseRef objects', () => { + const json = '{"a":1,"b":{"book":"GEN","chapterNum":1,"verseNum":1}}'; + const result = deserialize(json); + expect(result).toEqual({ a: 1, b: new VerseRef('GEN', '1', '1') }); + }); +}); diff --git a/lib/platform-bible-utils/src/serialization.ts b/lib/platform-bible-utils/src/serialization.ts index 8d7fb7699b..8b927f680f 100644 --- a/lib/platform-bible-utils/src/serialization.ts +++ b/lib/platform-bible-utils/src/serialization.ts @@ -1,3 +1,5 @@ +import { ScrVers, VerseRef } from '@sillsdev/scripture'; + /** * Converts a JavaScript value to a JSON string, changing `undefined` properties in the JavaScript * object to `null` properties in the JSON string. @@ -69,7 +71,44 @@ export function deserialize( return obj; } - const parsedObject = JSON.parse(value, reviver); + // Helper function to create a VerseRef from a SerializedVerseRef object + function verseRefReviver(_vrefKey: string, vrefValue: unknown): unknown { + if ( + vrefValue && + typeof vrefValue === 'object' && + 'book' in vrefValue && + typeof vrefValue.book === 'string' && + 'chapterNum' in vrefValue && + typeof vrefValue.chapterNum === 'number' && + 'verseNum' in vrefValue && + typeof vrefValue.verseNum === 'number' && + Object.keys(vrefValue).every((key) => + ['book', 'chapterNum', 'verseNum', 'verse', 'versificationStr'].includes(key), + ) + ) { + const chapter = vrefValue.chapterNum.toString(10); + const verse = + 'verse' in vrefValue && typeof vrefValue.verse === 'string' + ? vrefValue.verse + : vrefValue.verseNum.toString(10); + const versification = + 'versificationStr' in vrefValue && typeof vrefValue.versificationStr === 'string' + ? new ScrVers(vrefValue.versificationStr) + : undefined; + return new VerseRef(vrefValue.book, chapter, verse, versification); + } + return vrefValue; + } + + // Helper function to call the provided reviver and the VerseRef reviver + function combinedReviver(this: unknown, reviverKey: string, reviverVal: unknown) { + return verseRefReviver( + reviverKey, + reviver ? reviver.call(this, reviverKey, reviverVal) : reviverVal, + ); + } + + const parsedObject = JSON.parse(value, combinedReviver); // Explicitly convert the value 'null' that isn't stored as a property on an object to 'undefined' // eslint-disable-next-line no-null/no-null if (parsedObject === null) return undefined;