diff --git a/README.md b/README.md index b4a717d..e046bb7 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Synchronizes your data collection with GitHub and GitLab. ## Current restrictions -In version 1.0.2 not implemented: +In version 1.1.0 not implemented: - webhooks are not fully implemented. ## Building and Installation @@ -96,15 +96,18 @@ tba ## Dashboard The dashboard can trigger a full deployment or an incremental update. -Full deployment clones the repository from git and overwrites the database collection. +Full deployment clones the repository from git and install it as a xar. With incremental update only the changes to the database collection are applied. ### Lets start -1) install xar of the data collection +1) customize the configuration (modules/config.xql) 2) click on 'full' to trigger a full deployment from git to existdb 3) now you can update your collection with a click on 'incremental' +**REMARK: A valid expath-pkg.xml and repo.xml must be present** +**REMARK: Only use it with data collections** + ## API The page below is reachable via [api.html](api.html) in your installed tuttle app. diff --git a/gulpfile.js b/gulpfile.js index 69ac83e..af7605e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -54,7 +54,7 @@ function watchTemplates () { exports["watch:tmpl"] = watchTemplates -const static = 'src/**/*.{xml,html,xq,xquery,xql,xqm,xsl,xconf,json,svg,js,css,png,jpg}' +const static = 'src/**/*.{xml,html,xq,xquery,xql,xqm,xsl,xconf,json,svg,js,css,png,jpg,map}' /** * copy html templates, XSL stylesheet, XMLs and XQueries to 'build' diff --git a/package.json b/package.json index 4ab64cc..57d65cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tuttle", - "version": "1.0.2", + "version": "1.1.0", "description": "tuttle - a Git-integration for eXist-db", "scripts": { "test": "gulp install && mocha --exit", diff --git a/src/api.json b/src/api.json index 9f287fb..1042836 100644 --- a/src/api.json +++ b/src/api.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.0.2", + "version": "1.1.0", "title": "Tuttle API", "description": "API for Tuttle Git integration" }, @@ -75,15 +75,6 @@ }, "operationId": "api:git-deploy", "parameters": [ - { - "name": "pre-install", - "description": "Run pre install function", - "in": "query", - "schema":{ - "type": "boolean", - "default": false - } - }, { "name": "collection", "in": "path", @@ -152,18 +143,7 @@ "x-constraints": { "user": "admin" }, - "operationId": "api:git-deploy", - "parameters": [ - { - "name": "pre-install", - "description": "Run pre install function", - "in": "query", - "schema":{ - "type": "boolean", - "default": false - } - } - ], + "operationId": "api:git-deploy", "responses": { "200":{ "description": "JSON dump of request", @@ -735,4 +715,4 @@ "basicAuth": [] } ] -} \ No newline at end of file +} diff --git a/src/controller.xql b/src/controller.xql index 3a3f0a8..7a7280b 100644 --- a/src/controller.xql +++ b/src/controller.xql @@ -63,6 +63,10 @@ else if (matches($exist:resource, "\.(js)$", "s")) then +else if (matches($exist:resource, "\.(js.map)$", "s")) then + + + else if (matches($exist:resource, "\.(png)$", "s")) then diff --git a/src/expath-pkg.xml b/src/expath-pkg.xml index d0efed7..ff514c7 100644 --- a/src/expath-pkg.xml +++ b/src/expath-pkg.xml @@ -2,7 +2,7 @@ + abbrev="tuttle" version="1.1.0" spec="1.0"> Tuttle - Git for eXist-db diff --git a/src/index.html b/src/index.html index 8c96956..474fe17 100644 --- a/src/index.html +++ b/src/index.html @@ -108,7 +108,8 @@

serialization="none"> - Data deployed to database + Data deployed to database + No expath-pkg.xml or repo.xml in repo @@ -203,7 +204,7 @@

Git Repositories

- + diff --git a/src/js/fore-all.js b/src/js/fore-all.js new file mode 100644 index 0000000..f3487c9 --- /dev/null +++ b/src/js/fore-all.js @@ -0,0 +1,140 @@ +function e(e,t,n,r){const a={op:t,func:n,data:r};return e.push(a),a}function t(e,t){return e}class n{constructor(){this.program=[]}test(t,n){return e(this.program,5,t,void 0===n?null:n)}jump(t){return e(this.program,3,null,t)}record(n,r){return e(this.program,4,void 0===r?t:r,n)}bad(t=1){return e(this.program,1,null,t)}accept(){return e(this.program,0,null,null)}fail(t){return e(this.program,2,t||null,null)}}class r{constructor(e,t,n){this.programLength=e,this.maxFromByPc=t,this.maxSurvivorFromByPc=n}static fromProgram(e){const t=e.length,n=[],a=[];return e.forEach(e=>{n.push(0),a.push(0)}),e.forEach((e,r)=>{switch(e.op){case 2:if(null===e.func)return;if(r+1>=t)throw new Error("Invalid program: program could run past end");n[r+1]+=1;break;case 1:case 4:if(r+1>=t)throw new Error("Invalid program: program could run past end");n[r+1]+=1;break;case 3:e.data.forEach(e=>{if(e<0||e>=t)throw new Error("Invalid program: program could run past end");n[e]+=1});break;case 5:if(r+1>=t)throw new Error("Invalid program: program could run past end");a[r+1]+=1;break;case 0:a[r]+=1}}),new r(t,n,a)}static createStub(e){const t=[],n=[];for(let r=0;r0}}class o{constructor(e){this.t=0,this.i=0,this.h=new Uint16Array(e),this.l=new Uint8Array(e)}getBadness(e){return this.l[e]}add(e,t){this.l[e]=t>255?255:t;const n=function(e,t,n,r,a){let o=r,i=a;for(;o>>1;n255?255:t);if(this.l[e]!==n){const t=this.h.indexOf(e,this.i);if(t<0||t>=this.t)return void(this.l[e]=n);this.h.copyWithin(t,t+1,this.t),this.t-=1,this.add(e,n)}}getNextPc(){return this.i>=this.t?null:this.h[this.i++]}reset(){this.t=0,this.i=0,this.l.fill(0)}}class i{constructor(e){this.o=[];let t=e.length;e.forEach(e=>{this.o.push(e>0?t:-1),t+=e}),this.u=new Uint16Array(t)}clear(){this.u.fill(0,0,this.o.length)}add(e,t){const n=this.u[t],r=this.o[t];this.u[t]+=1,this.u[r+n]=e}has(e){return this.u[e]>0}forEach(e,t){const n=this.u[e],r=this.o[e];for(let e=r;e{const n=this.trace(t,r,a,o);var u,c,l;c=n,l=i,e=null===(u=e)?c:null===c?u:Array.isArray(c)?c.reduce((e,t)=>s(e,t,e===c),u):s(u,c,l),i=e===n}),e}trace(e,t,n,r){switch(this.p[e]){case 2:return this.v[e];case 1:return null}this.p[e]=1;let a=null;const o=t[e];if(null!==o)a=o;else if(!n.has(e))throw new Error("Trace without source at pc "+e);if(a=this.mergeTraces(a,e,n,t,n,r),null!==a){const t=r[e];null!==t&&(a=c(a,t))}return this.v[e]=a,this.p[e]=2,a}buildSurvivorTraces(e,t,n,r,a){for(let o=0,i=e.length;os(e,this.k[t]),null);return null===t?[]:Array.isArray(t)?t:[t]}}class h{constructor(e){this.I=[],this.N=new o(e.programLength),this.M=new o(e.programLength),this.P=new p(e)}reset(){this.N.reset(),this.N.add(0,0),this.I.length=0,this.P.reset(!0)}getNextThreadPc(){return this.N.getNextPc()}step(e,t,n){const r=this.P.has(t);this.P.add(e,t);const a=this.N.getBadness(e)+n;r?this.N.reschedule(t,a):this.N.add(t,a)}stepToNextGeneration(e,t){const n=this.P.hasSurvivor(t);this.P.addSurvivor(e,t);const r=this.N.getBadness(e);n?this.M.reschedule(t,r):this.M.add(t,r)}accept(e){this.I.push(e),this.P.addSurvivor(e,e)}fail(e){}record(e,t){this.P.record(e,t)}nextGeneration(){this.P.buildSurvivorTraces(),this.P.reset(!1);const e=this.N;e.reset(),this.N=this.M,this.M=e}getAcceptingTraces(){return this.P.getTraces(this.I)}}class f{constructor(e){this.U=[],this.G=e,this.V=r.fromProgram(e),this.U.push(new h(this.V))}execute(e,t){const n=this.U.pop()||new h(this.V);n.reset();const r=e.length;let o,i=-1;do{let a=n.getNextThreadPc();if(null===a)break;for(++i,o=i>=r?null:e[i];null!==a;){const e=this.G[a];switch(e.op){case 0:null===o?n.accept(a):n.fail(a);break;case 2:{const r=e.func;if(null===r||r(t)){n.fail(a);break}n.step(a,a+1,0);break}case 1:n.step(a,a+1,e.data);break;case 5:if(null===o){n.fail(a);break}if(!(0,e.func)(o,e.data,t)){n.fail(a);break}n.stepToNextGeneration(a,a+1);break;case 3:{const t=e.data,r=t.length;if(0===r){n.fail(a);break}for(let e=0;et===e}function m(e,t){if(null===e||null===t)throw new Error("unescaped hyphen may not be used as a range endpoint");if(te<=n&&n<=t}function g(e){return!0}function y(){return!1}function v(e,t){return n=>e(n)||t(n)}function w(e,t){switch(t.kind){case"predicate":return void e.test(t.value);case"regexp":return void x(e,t.value,!1)}}function x(e,t,n){const r=e.program.length,a=e.jump([]);n&&(a.data.push(e.program.length),e.test(()=>!0),e.jump([r]));const o=[];if(t.forEach(t=>{a.data.push(e.program.length),function(e,t){t.forEach(t=>{!function(e,t){const[n,{min:r,max:a}]=t;if(null!==a){for(let t=0;t0){for(let t=0;t{t.data.push(e.program.length)}),n){const t=e.program.length,n=e.jump([]);n.data.push(e.program.length),e.test(()=>!0),e.jump([t]),n.data.push(e.program.length)}}function A(e,t){return{success:!0,offset:e,value:t}}function b(e){return A(e,void 0)}function E(e,t,n=!1){return{success:!1,offset:e,expected:t,fatal:n}}function N(e){return(t,n)=>{const r=n+e.length;return t.slice(n,r)===e?A(r,e):E(n,[e])}}function B(e,t){return(n,r)=>{const a=e(n,r);return a.success?A(a.offset,t(a.value)):a}}function T(e,t,n){return(r,a)=>{const o=e(r,a);return o.success?t(o.value)?o:E(a,n):o.offset===a?E(a,n):o}}function I(e){return(t,n)=>{let r=null;for(const a of e){const e=a(t,n);if(e.success)return e;if(null===r||e.offset>r.offset?r=e:e.offset===r.offset&&(r.expected=r.expected.concat(e.expected)),e.fatal)break}return r||E(n,[])}}function C(e){return(t,n)=>{const r=e(t,n);return r.success||r.fatal?r:A(n,null)}}function S(e){return(t,n)=>{let r=[],a=n;for(;;){const n=e(t,a);if(!n.success){if(n.fatal)return n;break}r.push(n.value),a=n.offset}return A(a,r)}}function O(e,t,n){return(r,a)=>{const o=e(r,a);if(!o.success)return o;const i=t(r,o.offset);return i.success?A(i.offset,n(o.value,i.value)):i}}function R(e){return O(e,S(e),(e,t)=>[e].concat(t))}function D(e,t){return e}function U(e,t){return t}function M(e,t){return O(e,t,U)}function G(e,t){return O(e,t,D)}function k(e,t,n,r=!1){return M(e,r?P(G(t,n)):G(t,n))}function F(e,t){return(n,r)=>e(n,r).success?E(r,t):b(r)}function P(e){return(t,n)=>{const r=e(t,n);return r.success?r:E(r.offset,r.expected,!0)}}const H=(e,t)=>e.length===t?b(t):E(t,["end of input"]),j=["Lu","Ll","Lt","Lm","Lo","Mn","Mc","Me","Nd","Nl","No","Pc","Pd","Ps","Pe","Pi","Pf","Po","Zs","Zl","Zp","Sm","Sc","Sk","So","Cc","Cf","Co","Cn"],X={};function _(e){return e.codePointAt(0)}"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach((e,t)=>{X[e]=t});const L=e=>-1===e||-2===e;function V(e){return t=>!L(t)&&!e(t)}function Y(e,t){return null===t?e:n=>e(n)&&!t(n)}const q=function(e,t){const n=new Map;let r=0;return["BasicLatin","Latin-1Supplement","LatinExtended-A","LatinExtended-B","IPAExtensions","SpacingModifierLetters","CombiningDiacriticalMarks","GreekandCoptic|Greek","Cyrillic","CyrillicSupplement","Armenian","Hebrew","Arabic","Syriac","ArabicSupplement","Thaana","NKo","Samaritan","Mandaic","SyriacSupplement",null,"ArabicExtended-A","Devanagari","Bengali","Gurmukhi","Gujarati","Oriya","Tamil","Telugu","Kannada","Malayalam","Sinhala","Thai","Lao","Tibetan","Myanmar","Georgian","HangulJamo","Ethiopic","EthiopicSupplement","Cherokee","UnifiedCanadianAboriginalSyllabics","Ogham","Runic","Tagalog","Hanunoo","Buhid","Tagbanwa","Khmer","Mongolian","UnifiedCanadianAboriginalSyllabicsExtended","Limbu","TaiLe","NewTaiLue","KhmerSymbols","Buginese","TaiTham","CombiningDiacriticalMarksExtended","Balinese","Sundanese","Batak","Lepcha","OlChiki","CyrillicExtended-C","GeorgianExtended","SundaneseSupplement","VedicExtensions","PhoneticExtensions","PhoneticExtensionsSupplement","CombiningDiacriticalMarksSupplement","LatinExtendedAdditional","GreekExtended","GeneralPunctuation","SuperscriptsandSubscripts","CurrencySymbols","CombiningDiacriticalMarksforSymbols|CombiningMarksforSymbols","LetterlikeSymbols","NumberForms","Arrows","MathematicalOperators","MiscellaneousTechnical","ControlPictures","OpticalCharacterRecognition","EnclosedAlphanumerics","BoxDrawing","BlockElements","GeometricShapes","MiscellaneousSymbols","Dingbats","MiscellaneousMathematicalSymbols-A","SupplementalArrows-A","BraillePatterns","SupplementalArrows-B","MiscellaneousMathematicalSymbols-B","SupplementalMathematicalOperators","MiscellaneousSymbolsandArrows","Glagolitic","LatinExtended-C","Coptic","GeorgianSupplement","Tifinagh","EthiopicExtended","CyrillicExtended-A","SupplementalPunctuation","CJKRadicalsSupplement","KangxiRadicals",null,"IdeographicDescriptionCharacters","CJKSymbolsandPunctuation","Hiragana","Katakana","Bopomofo","HangulCompatibilityJamo","Kanbun","BopomofoExtended","CJKStrokes","KatakanaPhoneticExtensions","EnclosedCJKLettersandMonths","CJKCompatibility","CJKUnifiedIdeographsExtensionA","YijingHexagramSymbols","CJKUnifiedIdeographs","YiSyllables","YiRadicals","Lisu","Vai","CyrillicExtended-B","Bamum","ModifierToneLetters","LatinExtended-D","SylotiNagri","CommonIndicNumberForms","Phags-pa","Saurashtra","DevanagariExtended","KayahLi","Rejang","HangulJamoExtended-A","Javanese","MyanmarExtended-B","Cham","MyanmarExtended-A","TaiViet","MeeteiMayekExtensions","EthiopicExtended-A","LatinExtended-E","CherokeeSupplement","MeeteiMayek","HangulSyllables","HangulJamoExtended-B","HighSurrogates","HighPrivateUseSurrogates","LowSurrogates","PrivateUseArea|PrivateUse","CJKCompatibilityIdeographs","AlphabeticPresentationForms","ArabicPresentationForms-A","VariationSelectors","VerticalForms","CombiningHalfMarks","CJKCompatibilityForms","SmallFormVariants","ArabicPresentationForms-B","HalfwidthandFullwidthForms","Specials","LinearBSyllabary","LinearBIdeograms","AegeanNumbers","AncientGreekNumbers","AncientSymbols","PhaistosDisc",null,"Lycian","Carian","CopticEpactNumbers","OldItalic","Gothic","OldPermic","Ugaritic","OldPersian",null,"Deseret","Shavian","Osmanya","Osage","Elbasan","CaucasianAlbanian",null,"LinearA",null,"CypriotSyllabary","ImperialAramaic","Palmyrene","Nabataean",null,"Hatran","Phoenician","Lydian",null,"MeroiticHieroglyphs","MeroiticCursive","Kharoshthi","OldSouthArabian","OldNorthArabian",null,"Manichaean","Avestan","InscriptionalParthian","InscriptionalPahlavi","PsalterPahlavi",null,"OldTurkic",null,"OldHungarian","HanifiRohingya",null,"RumiNumeralSymbols",null,"OldSogdian","Sogdian",null,"Elymaic","Brahmi","Kaithi","SoraSompeng","Chakma","Mahajani","Sharada","SinhalaArchaicNumbers","Khojki",null,"Multani","Khudawadi","Grantha",null,"Newa","Tirhuta",null,"Siddham","Modi","MongolianSupplement","Takri",null,"Ahom",null,"Dogra",null,"WarangCiti",null,"Nandinagari","ZanabazarSquare","Soyombo",null,"PauCinHau",null,"Bhaiksuki","Marchen",null,"MasaramGondi","GunjalaGondi",null,"Makasar",null,"TamilSupplement","Cuneiform","CuneiformNumbersandPunctuation","EarlyDynasticCuneiform",null,"EgyptianHieroglyphs","EgyptianHieroglyphFormatControls",null,"AnatolianHieroglyphs",null,"BamumSupplement","Mro",null,"BassaVah","PahawhHmong",null,"Medefaidrin",null,"Miao",null,"IdeographicSymbolsandPunctuation","Tangut","TangutComponents",null,"KanaSupplement","KanaExtended-A","SmallKanaExtension","Nushu",null,"Duployan","ShorthandFormatControls",null,"ByzantineMusicalSymbols","MusicalSymbols","AncientGreekMusicalNotation",null,"MayanNumerals","TaiXuanJingSymbols","CountingRodNumerals",null,"MathematicalAlphanumericSymbols","SuttonSignWriting",null,"GlagoliticSupplement",null,"NyiakengPuachueHmong",null,"Wancho",null,"MendeKikakui",null,"Adlam",null,"IndicSiyaqNumbers",null,"OttomanSiyaqNumbers",null,"ArabicMathematicalAlphabeticSymbols",null,"MahjongTiles","DominoTiles","PlayingCards","EnclosedAlphanumericSupplement","EnclosedIdeographicSupplement","MiscellaneousSymbolsandPictographs","Emoticons","OrnamentalDingbats","TransportandMapSymbols","AlchemicalSymbols","GeometricShapesExtended","SupplementalArrows-C","SupplementalSymbolsandPictographs","ChessSymbols","SymbolsandPictographsExtended-A",null,"CJKUnifiedIdeographsExtensionB",null,"CJKUnifiedIdeographsExtensionC","CJKUnifiedIdeographsExtensionD","CJKUnifiedIdeographsExtensionE","CJKUnifiedIdeographsExtensionF",null,"CJKCompatibilityIdeographsSupplement",null,"Tags",null,"VariationSelectorsSupplement",null,"SupplementaryPrivateUseArea-A|PrivateUse","SupplementaryPrivateUseArea-B|PrivateUse"].forEach((e,a)=>{const o=t[a];null!==e&&e.split("|").forEach(e=>{const t=n.get(e),a=m(r,r+o-1);n.set(e,t?v(t,a):a)}),r+=o}),n}(0,[128,128,128,208,96,80,112,144,256,48,96,112,256,80,48,64,64,64,32,16,48,96,128,128,128,128,128,128,128,128,128,128,128,128,256,160,96,256,384,32,96,640,32,96,32,32,32,32,128,176,80,80,48,96,32,32,144,80,128,64,64,80,48,16,48,16,48,128,64,64,256,256,112,48,48,48,80,64,112,256,256,64,32,160,128,32,96,256,192,48,16,256,128,128,256,256,96,32,128,48,80,96,32,128,128,224,16,16,64,96,96,48,96,16,32,48,16,256,256,6592,64,20992,1168,64,48,320,96,96,32,224,48,16,64,96,32,48,48,32,96,32,96,32,96,32,48,64,80,64,11184,80,896,128,1024,6400,512,80,688,16,16,16,32,32,144,240,16,128,128,64,80,64,48,128,32,64,32,48,32,48,32,64,32,80,48,48,80,48,64,144,384,128,64,32,32,48,48,32,32,32,64,32,96,96,32,32,32,64,64,32,32,48,80,80,48,128,64,288,32,128,48,64,112,32,128,80,48,80,48,96,32,80,48,48,80,128,128,128,96,160,128,96,32,80,48,64,192,80,80,96,160,96,80,96,16,64,256,112,80,64,96,80,304,32,192,64,1024,128,208,2736,1072,16,4032,640,8576,576,48,96,48,144,688,96,96,160,64,32,6144,768,9472,256,48,64,400,2304,160,16,4944,256,256,80,144,32,96,32,128,1024,688,1360,48,208,80,368,64,1280,224,32,96,784,80,64,80,176,256,256,48,112,96,256,256,768,80,48,128,128,128,256,256,112,144,1280,42720,32,4160,224,5776,7488,3088,544,722400,128,128,240,65040,65536,65536]),Q=function(e){const t=new Map,n="bfUATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAbgUATAYDaATAZAaAGARAXAcAaAZAaAXAMBZADATBZAMAGASAMCTACWXACGDXXADHA3DAAPDAAtCAAFDBCAADCAABCCDBCCABCAABCCDCCAABCAAFCAADDAABCAABCBADCBDBGACADCGDCAEADACAEADACAEADAAPDAARDACAEADAABCBA7DFCAABCBDBABCCAJjDBAAGADaFRZDFLZNFEZGFAZAFAZQnvBAAADFAZACADABBFADCTACABDZBCATACCBACABACAABCQBACIDiCADBCCDCAXDDCADAXAABCBDBCyDvAhaAHEJBA1CAANDAgfBAABAClBBFATFDoTAOABBaBYABAHsOAHATAHBTAHBTAHABHGaBDGDTBBKcFXCTBYATBaBHKTAcABATBGfFAGJHUKJTDGBHAmiBAATAGAHGcAaAHFFBHBaAHDGBKJGCaBGATNBAcAGAHAGdHaBBmYBAAHKGABNKJGgHIFBaATCFABBHAYBGVHDFAHIFAHCFAHEBBTOBAGYHCBBTABAGKB0GUBAGHBUHOcAHfIAG1HAIAHAGAICHHIDHAIBGAHGGJHBTBKJTAFAGOHAIBBAGHBBGBBBGVBAGGBAGABCGDBBHAGAICHDBBIBBBIBHAGABHIABDGBBAGCHBBBKJGBYBMFaAYAGATAHABBHBIABAGFBDGBBBGVBAGGBAGBBAGBBAGBBBHABAICHBBDHBBBHCBCHABGGDBAGABGKJHBGCHATABJHBIABAGIBAGCBAGVBAGGBAGBBAGEBBHAGAICHEBAHBIABAIBHABBGABOGBHBBBKJTAYABGGAHFBAHAIBBAGHBBGBBBGVBAGGBAGBBAGEBBHAGAIAHAIAHDBBIBBBIBHABHHAIABDGBBAGCHBBBKJaAGAMFBJHAGABAGFBCGCBAGDBCGBBAGABAGBBCGBBCGCBCGLBDIBHAIBBCICBAICHABBGABFIABNKJMCaFYAaABEHAICHAGHBAGCBAGWBAGPBCGAHCIDBAHCBAHDBGHBBAGCBEGBHBBBKJBGTAMGaAGAHAIBTAGHBAGCBAGWBAGJBAGEBBHAGAIAHAIEBAHAIBBAIBHBBGIBBGGABAGBHBBBKJBAGBBMHBIBBAGHBAGCBAGoHBGAICHDBAICBAICHAGAaABDGCIAMGGCHBBBKJMIaAGFBBIBBAGRBCGXBAGIBAGABBGGBCHABDICHCBAHABAIHBFKJBBIBTABLGvHAGBHGBDYAGFFAHHTAKJTBBkGBBAGABAGEBAGXBAGABAGJHAGBHIGABBGEBAFABAHFBBKJBBGDBfGAaCTOaATAaCHBaFKJMJaAHAaAHAaAHAPAQAPAQAIBGHBAGjBDHNIAHETAHBGEHKBAHjBAaHHAaFBAaBTEaDTBBkGqIBHDIAHFIAHBIBHBGAKJTFGFIBHBGDHCGAICGBIGGCHDGMHAIBHBIFHAGAIAKJICHAaBClBACABECABBDqTAFADCmIFAABAGDBBGGBAGABAGDBBGoBAGDBBGgBAGDBBGGBAGABAGDBBGOBAG4BAGDBBmCBAABBHCTIMTBCGPaJBFiVBAABBDFBBOAmrJAAaATAGQUAGZPAQABCmKBAATCLCGHBGGMBAGDHCBKGRHCTBBIGRHBBLGMBAGCBAHBBLGzHBIAHGIHHAIBHKTCFATCYAGAHABBKJBFMJBFTFOATDHCcABAKJBFGiFAG0BGGEHBGhHAGABEmFBAABJGeBAHCIDHBICBDIBHAIFHCBDaABCTBKJGdBBGEBKGrBDGZBFKJMABCahGWHBIBHABBTBG0IAHAIAHGBAHAIAHAIBHHIFHJBBHAKJBFKJBFTGFATFBBHNJAhABAAHDIAGuHAIAHEIAHAIEHAIBGGBDKJTGaJHIaIBCHBIAGdIAHDIBHBIAHCGBKJGrHAIAHBICHAIAHCIBBHTDGjIHHHIBHBBCTEKJBCGCKJGdFFTBDIBGCqBBCCTHBHHCTAHMIAHGGDHAGFHAGBIAHBGABEDrF+DMFADhFkH5BAHEgVCAADHghBAADHCHDFBBCFBBDHCHDHCHDFBBCFBBDHBACABACABACABACADHCHDNBBDHEHDHEHDHEHDEBADBCDEAZADAZCDCBADBCDEAZCDDBBDBCDBAZCDHCEZCBBDCBADBCDEAZBBAUKcEOFTBRASAPARBSAPARATHVAWAcEUATIRASATDNBTCXAPAQATKXATANATJUAcEBAcJMAFABBMFXCPAQAFAMJXCPAQABAFMBCYfBPHMJDHAJCHLBOaBCAaDCAaBDACCDBCCDAaACAaBXACEaFCAaACAaACAaACDaADACDDAGDDAaBDBCBXECADDaAXAaBDAaAMPLiCADALDMAaBBDXEaEXBaDXAaBXAaBXAaGXAaeXBaBXAaAXAae3LEAAaHPAQAPAQAaTXBaGPAQA6QBAAXAadXYanXF6EBAABYaKBUM76NBAAMV62CAAXAaIXAa1XH6uBAAXA63DAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAMdarXEPAQAXePAQAPAQAPAQAPAQAPAQAXP6/DAA3CCAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAX+PAQAPAQAXfPAQA3BEAAavXUaBXFamBBafBB6nBAACuBADuBAABCCDBAFCCADDACADFFBCBgjBAADAaFADHCCADABETDMATBDlBADABEDABBG3BGFATABNHAGWBIGGBAGGBAGGBAGGBAGGBAGGBAGGBAGGBAHfTBRASARASATCRASATARASATIOATBOATARASATBRASAPAQAPAQAPAQAPAQATEFATJOBTDOATAPATMBvaZBA6YBAABL6VDAABZaLBDUATCaAFAGALAPAQAPAQAPAQAPAQAPAQAaBPAQAPAQAPAQAPAQAOAPAQBaALIHDIBOAFEaBLCFAGATAaBBAmVBAABBHBZBFBGAOAmZBAATAFCGABEGqBAmdBAABAaBMDaJGaBEajBLGPaeBAMJadMHaAMOafMJamMO6/EAAm1mBABJa/mvHFABPGUFAm2RAABCa2BIGnFFTBmLEAAFATCGPKJGBBTAtGAHAJCTAHJTAFAAbFBHBmFBAALJHBTFBHZWFIZBANDBA9FADHADCAAJFAZBADGAADDBATCDABCDALBBABCCBvGAFBDAGGHAGCHAGDHAGWIBHBIAaDBDMFaBYAaABFGzTDBHIBGxIPHBBHTBKJBFHRGFTCGATAGBHAKJGbHHTBGWHKIBBKTAGcBCHCIAGuHAIBHDIBHBICTMBAFAKJBDTBGEHAFAGIKJGEBAGoHFIBHBIBHBBIGCHAGHHAIABBKJBBTDGPFAGFaCGAIAHAIAGxHAGAHCGBHBGEHBGAHAGABXGBFATBGKIAHBIBTBGAFBIAHABJGFBBGFBBGFBIGGBAGGBADqZAFDDHBHjPBAAGiIBHAIBHAIBTAIAHABBKJBFmjuCABLGWBDGwhDgAA9/jBAmtFAABBmpBAABlDGBLDEBEGAHAGJXAGMBAGEBAGABAGBBAGBBAmrBAAZPBQmqFAAQAPABPG/BBG1BnGLYAaABBHPTGPAQATABFHPTAOBNBPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQATBPAQATDNCTCBATDOAPAQAPAQAPAQATCXAOAXCBATAYATBBDGEBAmGCAABBcABATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAPAQATAPAQATBGJFAGsFBGeBCGFBBGFBBGFBBGCBCYBXAZAaAYBBAaAXDaBBJcCaBBBGLBAGZBAGSBAGBBAGOBBGNBhm6BAABETCBDMsBCaIL0MDaQMBaCBAaLBDaABuasHAhBCAAGcBCGwBOHAMaBDGfMDBIGTLAGHLABEGlHEBEGdBATAGjBDGHTALEBpCnDnmNBAABBKJBFCjBDDjBDGnBHGzBKTAhPCAAm2EAABIGVBJGHhXCAAGFBBGABAGrBAGBBCGABBGWBATAMHGWaBMGGeBHMIBvGSBAGBBEMEGVMFBCTAGZBETAB/G3BDMBGBMPBBMtGAHCBAHBBEHDGDBAGCBAGcBBHCBDHAMIBGTIBGGcMBTAGcMCBfGHaAGbHBBDMETGBIG1BCTGGVBBMHGSBEMHGRBGTDBLMGhPBAAmIBAAB2CyBMDyBGMFGjHDBHKJhlEAAMehACAAGcMJGABHGVHKMDTEhFCAAGWBIIAHAIAG0HOTGBDMTKJBOHCIAGsICHDIBHBTBcATDBKcABBGYBGKJBFHCGjHEIAHHBAKJTDGAIBBIGiHATBGABIHBIAGvICHIIBGDTDHDTABBKJGATAGATCBAMTBKGRBAGYICHCIBHAIAHBTFHAhABAAGGBAGABAGDBAGOBAGJTABFGuHAICHHBEKJBFHBIBBAGHBBGBBBGVBAGGBAGBBAGEBAHBGAIBHAIDBBIBBBICBBGABFIABEGEIBBBHGBCHEhKCAAG0ICHHIBHCIAHAGDTEKJBATABATAHAGABfGvICHFIAHAIDHBIAHBGBTAGABHKJhlCAAGuICHDBBIDHBIAHBTWGDHBBhGvICHHIBHAIAHBTCGABKKJBFTMBSGqHAIAHAIBHFIAHAGABGKJB1GaBBHCIBHDIAHEBDKJMBTCaAh/CAAGrICHIIAHBTAhjBAACfDfKJMIBLGAhfCAAGHBBGmICHDBBHBIDHAGATAGAIABaGAHJGnHFIAGAHDTHHABHGAHFIBHCGtHMIAHBTCGATEBcG4hGEAAGIBAGkIAHGBAHFIAHAGATEBJKJMSBCTBGdBBHVBAIAHGIAHBIAHBhIBAAGGBAGBBAGlHFBCHABAHBBAHGGAHABHKJBFGFBAGBBAGfIEBAHBBAIBHAIAHAGABGKJh1EAAGSHBIBTBhGDAAMUaHYDaQBMTAmZOAAhlBAAruBAABATEBKmDDAAh7qAAmuQAABAcIhG/AAmGJAAh4GCAm4IAABGGeBAKJBDTBhfBAAGdBBHETABJGvHGTEaDFDTAaABJKJBAMGBAGUBEGShvKAACfDfMWTDhkBAAmKBAABDHAGAI2BGHDFMB/FBTAFABbm3fBABHmyLAAhMUCAmeEAABwGCBQGDBHmLGAAhDkAAmqBAABEGMBCGIBGGJBBaAHBTAcDhbNBA61DAABJamBBa7IBHCaCIFcHHHaBHGadHDa6BW6BBAAHCaAhZCAAMTBL6WBAABIMYhGCAACZDZCZDGBADRCZDZCABACBBBCABBCBBBCDBACHDDBADABADGBADKCZDZCBBACDBBCHBACGBADZCBBACDBACEBACABCCGBADZCZDZCZDZCZDZCZDZCZDZCZDbBBCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCADABBKx6/HAAH2aDHxaHHAaNHAaBTEBOHEBAHOhPVAAHGBAHQBBHGBAHBBAHEhUDAAGsBCHGFGBBKJBDGAaAhvFAAGrHDKJBEYAh/TAAmEDAABBMIHGBoChDhHGFABDKJBDTBhQMAAM6aAMCYAMDhLBAAMsaAMOhBDAAGDBAGaBAGBBAGABBGABAGJBAGDBAGABAGABFGABDGABAGABAGABAGCBAGBBAGABBGABAGABAGABAGABAGABAGBBAGABBGDBAGGBAGDBAGDBAGABAGJBAGQBEGCBAGEBAGQBzXBhNEAAarBD6jBAABLaOBBaOBAaOBAakBJMMBC6cBAABCa8B4acBMarBDaIBGaBBNaFhZCAA66DAAZE6VLAABJaMBCaKBE6zBAABL6YBAABGaLBTaLBDa3BHaJBFanBHadhRBAAaLBA6kBAABAaDBCaoBBaFBCacBB6GCAABLaNBBaDBDaCBEaCBMaFhpVAAmWbKABom0ABABKmdDAABBmBaBABNmw0BAhewAAmdIAAhiXwCcABd8fBAAh/BAAnvDAAhP4PA99/PABB99/PA".split(""),r=j.map(()=>[]);let a=0,o=0;for(;o{const a=r[n].reduce(v,y);t.set(e,a);const o=e.charAt(0),s=i.get(o)||[];i.set(o,s),s.push(a)}),i.forEach((e,n)=>{t.set(n,e.reduce(v,y))}),t}();function J(e){return 32===e||9===e||10===e||13===e}const K=[d(_(":")),m(_("A"),_("Z")),d(_("_")),m(_("a"),_("z")),m(192,214),m(216,246),m(192,214),m(216,246),m(248,767),m(880,893),m(895,8191),m(8204,8205),m(8304,8591),m(11264,12271),m(12289,55295),m(63744,64975),m(65008,65533),m(65536,983039)].reduce(v),z=[K,d(_("-")),d(_(".")),m(_("0"),_("9")),d(183),m(768,879),m(8255,8256)].reduce(v),W=Q.get("Nd"),$=V(W),Z=Y(m(0,1114111),[Q.get("P"),Q.get("Z"),Q.get("C")].reduce(v)),ee=V(Z);function te(e){return 10!==e&&13!==e&&!L(e)}const ne={s:J,S:V(J),i:K,I:V(K),c:z,C:V(z),d:W,D:$,w:Z,W:ee},re=N("*"),ae=N("\\"),oe=N("{"),ie=N("}"),se=N("["),ue=N("]"),ce=N("^"),le=N("$"),pe=N(","),he=N("-"),fe=N("("),de=N(")"),me=N("."),ge=N("|"),ye=N("+"),ve=N("?"),we=N("-["),xe=_("0");function Ae(e){function t(e){return new Set(e.split("").map(e=>_(e)))}function n(e,t){const n=e.codePointAt(t);return void 0===n?E(t,["any character"]):A(t+String.fromCodePoint(n).length,n)}const r="xpath"===e.language?M(ae,I([B(N("n"),()=>10),B(N("r"),()=>13),B(N("t"),()=>9),B(I([ae,ge,me,he,ce,ve,re,ye,oe,ie,le,fe,de,se,ue]),e=>_(e))])):M(ae,I([B(N("n"),()=>10),B(N("r"),()=>13),B(N("t"),()=>9),B(I([ae,ge,me,he,ce,ve,re,ye,oe,ie,fe,de,se,ue]),e=>_(e))]));function a(e,r){const a=t(r);return O(N(e),C(T(n,e=>a.has(e),r.split(""))),(e,t)=>function(e){const t=Q.get(e);if(null==t)throw new Error(e+" is not a valid unicode category");return t}(null===t?e:e+String.fromCodePoint(t)))}const o=I([a("L","ultmo"),a("M","nce"),a("N","dlo"),a("P","cdseifo"),a("Z","slp"),a("S","mcko"),a("C","cfon")]),i=[m(_("a"),_("z")),m(_("A"),_("Z")),m(_("0"),_("9")),d(45)].reduce(v),s=I([o,B(M(N("Is"),function(e){return(t,n)=>{const r=e(t,n);return r.success?A(r.offset,t.slice(n,r.offset)):r}}(R(T(n,i,["block identifier"])))),t=>function(e,t){const n=q.get(e);if(void 0===n){if(t)return g;throw new Error(`The unicode block identifier "${e}" is not known.`)}return n}(t,"xpath"!==e.language))]),u=k(N("\\p{"),s,ie,!0),c=B(k(N("\\P{"),s,ie,!0),V),l=M(ae,B(I("sSiIcCdDwW".split("").map(e=>N(e))),e=>ne[e])),p=B(me,()=>te),h=I([l,u,c]),f=t("\\[]"),y=I([r,T(n,e=>!f.has(e),["unescaped character"])]),w=I([B(he,()=>null),y]),x=O(w,M(he,w),m);function b(e,t){return[e].concat(t||[])}const U=B(function(e){return(t,n)=>{const r=e(t,n);return r.success?A(n,r.value):r}}(I([ue,we])),()=>null),j=_("-"),X=I([B(G(G(he,F(se,["not ["])),U),()=>j),M(F(he,["not -"]),y)]),L=I([O(B(X,d),I([function(e,t){return L(e,t)},U]),b),O(I([x,h]),I([K,U]),b)]),J=I([O(B(y,d),I([L,U]),b),O(I([x,h]),I([K,U]),b)]);function K(e,t){return J(e,t)}const z=B(J,e=>e.reduce(v)),W=B(M(ce,z),V),$=O(I([M(F(ce,["not ^"]),z),W]),C(M(he,(function(e,t){return Z(e,t)}))),Y),Z=k(se,$,ue,!0),ee="xpath"===e.language?I([B(r,d),h,Z,p,B(ce,()=>e=>-1===e),B(le,()=>e=>-2===e)]):I([B(r,d),h,Z,p]),Ae="xpath"===e.language?t(".\\?*+{}()|^$[]"):t(".\\?*+{}()|[]"),be=T(n,e=>!Ae.has(e),["NormalChar"]),Ee=B(M(ae,O(B(T(n,m(_("1"),_("9")),["digit"]),e=>e-xe),S(B(T(n,m(xe,_("9")),["digit"]),e=>e-xe)),(e,t)=>{t.reduce((e,t)=>10*e+t,e)})),e=>{throw new Error("Backreferences in XPath patterns are not yet implemented.")}),Ne="xpath"===e.language?I([B(be,e=>({kind:"predicate",value:d(e)})),B(ee,e=>({kind:"predicate",value:e})),B(k(fe,M(C(N("?:")),Oe),de,!0),e=>({kind:"regexp",value:e})),Ee]):I([B(be,e=>({kind:"predicate",value:d(e)})),B(ee,e=>({kind:"predicate",value:e})),B(k(fe,Oe,de,!0),e=>({kind:"regexp",value:e}))]),Be=B(R(B(T(n,m(xe,_("9")),["digit"]),e=>e-xe)),e=>e.reduce((e,t)=>10*e+t)),Te=I([O(Be,M(pe,Be),(e,t)=>{if(t({min:e,max:null})),B(Be,e=>({min:e,max:e}))]),Ie="xpath"===e.language?O(I([B(ve,()=>({min:0,max:1})),B(re,()=>({min:0,max:null})),B(ye,()=>({min:1,max:null})),k(oe,Te,ie,!0)]),C(ve),(e,t)=>e):I([B(ve,()=>({min:0,max:1})),B(re,()=>({min:0,max:null})),B(ye,()=>({min:1,max:null})),k(oe,Te,ie,!0)]),Ce=S(O(Ne,B(C(Ie),e=>null===e?{min:1,max:1}:e),(e,t)=>[e,t])),Se=O(Ce,S(M(ge,P(Ce))),(e,t)=>[e].concat(t));function Oe(e,t){return Se(e,t)}const Re=function(e){return O(e,H,D)}(Se);return function(e){let t;try{t=Re(e,0)}catch(t){throw new Error(`Error parsing pattern "${e}": ${t.message}`)}return t.success?t.value:function(e,t,n){const r=n.map(e=>`"${e}"`);throw new Error(`Error parsing pattern "${e}" at offset ${t}: expected ${r.length>1?"one of "+r.join(", "):r[0]} but found "${e.slice(t,t+1)}"`)}(e,t.offset,t.expected)}}function be(e){return[...e].map(e=>e.codePointAt(0))}function Ee(e,t){return{success:!0,offset:e,value:t}}function Ne(e){return Ee(e,void 0)}function Be(e,t,n=!1){return{success:!1,offset:e,expected:t,fatal:n}}function Te(e){return(t,n)=>{let r=[],a=n;for(;;){const n=e(t,a);if(!n.success){if(n.fatal)return n;break}r.push(n.value),a=n.offset}return Ee(a,r)}}function Ie(e,t,n){return(r,a)=>{const o=e(r,a);if(!o.success)return o;const i=t(r,o.offset);return i.success?Ee(i.offset,n(o.value,i.value)):i}}function Ce(e,t){return e}function Se(e,t){return t}function Oe(e,t){return Ie(e,t,Se)}function Re(e,t){return Ie(e,t,Ce)}function De(e){return(t,n)=>{const r=e(t,n);return r.success?r:Be(r.offset,r.expected,!0)}}const Ue=(e,t)=>e.length===t?Ne(t):Be(t,["end of input"]);const Me=function(e,t){const n={};var r;function a(e){var t=0;return function(){return t>>0)+"_",r=0;return function e(a){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new t(n+(a||"")+"_"+r++,a)}})),s("Symbol.iterator",(function(e){if(e)return e;e=Symbol("Symbol.iterator");for(var t="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),n=0;nn.length?a?1:-1:t.lengthn?a?1:-1:t(t=r.padEnd(t,"0"))?a?1:-1:nD(e,t)},Kc:function(e,t){return 0>D(e,t)},sa:function(e,t){return-1e||1342177279>>=1)&&(t+=t);return n}})),s("String.prototype.padEnd",(function(e){return e||function(e,t){var n=I(this,null,"padStart");return n+C(t,e-n.length)}})),s("WeakMap",(function(e){function t(e){if(this.h=(u+=Math.random()+1).toString(),e){e=c(e);for(var t;!(t=e.next()).done;)t=t.value,this.set(t[0],t[1])}}function n(){}function r(e){var t=typeof e;return"object"===t&&null!==e||"function"===t}function a(e){if(!B(e,s)){var t=new n;o(e,s,{value:t})}}function i(e){var t=Object[e];t&&(Object[e]=function(e){return e instanceof n?e:(Object.isExtensible(e)&&a(e),t(e))})}if(function(){if(!e||!Object.seal)return!1;try{var t=Object.seal({}),n=Object.seal({}),r=new e([[t,2],[n,3]]);return 2==r.get(t)&&3==r.get(n)&&(r.delete(t),r.set(n,4),!r.has(t)&&4==r.get(n))}catch(e){return!1}}())return e;var s="$jscomp_hidden_"+Math.random();i("freeze"),i("preventExtensions"),i("seal");var u=0;return t.prototype.set=function(e,t){if(!r(e))throw Error("Invalid WeakMap key");if(a(e),!B(e,s))throw Error("WeakMap key fail: "+e);return e[s][this.h]=t,this},t.prototype.get=function(e){return r(e)&&B(e,s)?e[s][this.h]:void 0},t.prototype.has=function(e){return r(e)&&B(e,s)&&B(e[s],this.h)},t.prototype.delete=function(e){return!!(r(e)&&B(e,s)&&B(e[s],this.h))&&delete e[s][this.h]},t})),s("Map",(function(e){function t(){var e={};return e.Ba=e.next=e.head=e}function n(e,t){var n=e.h;return u((function(){if(n){for(;n.head!=e.h;)n=n.Ba;for(;n.next!=n.head;)return n=n.next,{done:!1,value:t(n)};n=null}return{done:!0,value:void 0}}))}function r(e,t){var n=t&&typeof t;"object"==n||"function"==n?o.has(t)?n=o.get(t):(n=""+ ++i,o.set(t,n)):n="p_"+t;var r=e.s[n];if(r&&B(e.s,n))for(e=0;e=a}})),s("Array.prototype.fill",(function(e){return e||function(e,t,n){var r=this.length||0;for(0>t&&(t=Math.max(0,r+t)),(null==n||n>r)&&(n=r),0>(n=Number(n))&&(n=Math.max(0,r+n)),t=Number(t||0);t(t=t||0)&&(t=Math.max(t+r,0));te?-t:t}})),s("Number.isFinite",(function(e){return e||function(e){return"number"==typeof e&&(!isNaN(e)&&1/0!==e&&-1/0!==e)}})),s("String.prototype.padStart",(function(e){return e||function(e,t){var n=I(this,null,"padStart");return C(t,e-n.length)+n}})),s("Array.prototype.keys",(function(e){return e||function(){return R(this,(function(e){return e}))}})),s("Number.isInteger",(function(e){return e||function(e){return!!Number.isFinite(e)&&e===Math.floor(e)}})),s("Number.isSafeInteger",(function(e){return e||function(e){return Number.isInteger(e)&&Math.abs(e)<=Number.MAX_SAFE_INTEGER}})),s("Array.prototype.findIndex",(function(e){return e||function(e,t){return S(this,e,t).Fb}})),s("String.prototype.endsWith",(function(e){return e||function(e,t){var n=I(this,e,"endsWith");void 0===t&&(t=n.length),t=Math.max(0,Math.min(0|t,n.length));for(var r=e.length;0=r}})),s("String.fromCodePoint",(function(e){return e||function(e){for(var t="",n=0;nr||1114111=r?t+=String.fromCharCode(r):(r-=65536,t+=String.fromCharCode(r>>>10&1023|55296),t+=String.fromCharCode(1023&r|56320))}return t}})),s("String.prototype.codePointAt",(function(e){return e||function(e){var t=I(this,null,"codePointAt"),n=t.length;if(0<=(e=Number(e)||0)&&er||56319(e=t.charCodeAt(e+1))||57343=e.length?W:$(e[t])}}}function te(){this.value={next:function(){return W}}}function ne(e){var t=e.value;if(Z(e.type,53))return!0;if(Z(e.type,0))return t;if(Z(e.type,1)||Z(e.type,20)||Z(e.type,19))return 0!==t.length;if(Z(e.type,2))return!isNaN(t)&&0!==t;throw K()}function re(e,t){var n=this;this.j=ue,this.value={next:function(t){return null!==n.s&&n.h>=n.s?W:void 0!==n.A[n.h]?$(n.A[n.h++]):(t=e.next(t)).done?(n.s=n.h,t):((n.u||2>n.h)&&(n.A[n.h]=t.value),n.h++,t)}},this.u=!1,this.A=[],this.h=0,this.s=void 0===t?null:t}function ae(e,t){e.h=void 0===t?0:t}function oe(e){this.A=ue,this.h=e;var t=!1;this.value={next:function(){return t?W:(t=!0,$(e))}},this.s=null}(r=ee.prototype).ob=function(){return this},r.filter=function(e){var t=this,n=-1;return this.s.create({next:function(){for(n++;n=t.h.length?W:$(t.h[n])}})},r.first=function(){return this.h[0]},r.N=function(){return this.h},r.getEffectiveBooleanValue=function(){if(Z(this.h[0].type,53))return!0;throw K()},r.Na=function(){return this.h.length},r.G=function(){return!1},r.ya=function(){return!1},r.map=function(e){var t=this,n=-1;return this.s.create({next:function(){return++n>=t.h.length?W:$(e(t.h[n],n,t))}},this.h.length)},r.L=function(e){return e(this.h)},r.$=function(e){return e.multiple?e.multiple(this):e.default(this)},(r=te.prototype).ob=function(){return this},r.filter=function(){return this},r.first=function(){return null},r.N=function(){return[]},r.getEffectiveBooleanValue=function(){return!1},r.Na=function(){return 0},r.G=function(){return!0},r.ya=function(){return!1},r.map=function(){return this},r.L=function(e){return e([])},r.$=function(e){return e.empty?e.empty(this):e.default(this)},(r=re.prototype).ob=function(){return this.j.create(this.N())},r.filter=function(e){var t=this,n=-1,r=this.value;return this.j.create({next:function(a){for(n++,a=r.next(a);!a.done&&!e(a.value,n,t);)n++,a=r.next(0);return a}})},r.first=function(){if(void 0!==this.A[0])return this.A[0];var e=this.value.next(0);return ae(this),e.done?null:e.value},r.N=function(){if(this.h>this.A.length&&this.s!==this.A.length)throw Error("Implementation error: Sequence Iterator has progressed.");var e=this.value;this.u=!0;for(var t=e.next(0);!t.done;)t=e.next(0);return this.A},r.getEffectiveBooleanValue=function(){var e=this.value,t=this.h;ae(this);var n=e.next(0);if(n.done)return ae(this,t),!1;if(Z((n=n.value).type,53))return ae(this,t),!0;if(!e.next(0).done)throw K();return ae(this,t),ne(n)},r.Na=function(e){if(null!==this.s)return this.s;if(void 0!==e&&e)return-1;e=this.h;var t=this.N().length;return ae(this,e),t},r.G=function(){return 0===this.s||null===this.first()},r.ya=function(){if(null!==this.s)return 1===this.s;var e=this.value,t=this.h;return ae(this),e.next(0).done?(ae(this,t),!1):(e=e.next(0),ae(this,t),e.done)},r.map=function(e){var t=this,n=0,r=this.value;return this.j.create({next:function(a){return(a=r.next(a)).done?W:$(e(a.value,n++,t))}},this.s)},r.L=function(e,t){var n,r=this.value,a=[],o=!0;return function(){for(var i=r.next(o?0:t);!i.done;i=r.next(t))o=!1,a.push(i.value);n=e(a).value}(),this.j.create({next:function(){return n.next(0)}})},r.$=function(e){function t(e){r=e.value,-1!==(e=e.Na(!0))&&(n.s=e)}var n=this,r=null;return this.j.create({next:function(a){return r?r.next(a):n.G()?(t(e.empty?e.empty(n):e.default(n)),r.next(a)):n.ya()?(t(e.o?e.o(n):e.default(n)),r.next(a)):(t(e.multiple?e.multiple(n):e.default(n)),r.next(a))}})},(r=oe.prototype).ob=function(){return this},r.filter=function(e){return e(this.h,0,this)?this:this.A.create()},r.first=function(){return this.h},r.N=function(){return[this.h]},r.getEffectiveBooleanValue=function(){return null===this.s&&(this.s=ne(this.h)),this.s},r.Na=function(){return 1},r.G=function(){return!1},r.ya=function(){return!0},r.map=function(e){return this.A.create(e(this.h,0,this))},r.L=function(e){return e([this.h])},r.$=function(e){return e.o?e.o(this):e.default(this)};var ie=new te;function se(e,t){if(null===(e=void 0===e?null:e))return ie;if(Array.isArray(e))switch(e.length){case 0:return ie;case 1:return new oe(e[0]);default:return new ee(e)}return e.next?new re(e,void 0===t?null:t):new oe(e)}var ue={create:se,o:function(e){return new oe(e)},empty:function(){return se()},ca:function(){return se(Q)},X:function(){return se(J)}};function ce(e){var t=[],n=e.value;return function(){var e=0;return ue.create({next:function(){if(void 0!==t[e])return t[e++];var r=n.next(0);return r.done?r:t[e++]=r}})}}function le(e,t){this.type=e,this.value=t}var pe={},he=(pe[0]="xs:boolean",pe[1]="xs:string",pe[2]="xs:numeric",pe[3]="xs:double",pe[4]="xs:decimal",pe[5]="xs:integer",pe[6]="xs:float",pe[7]="xs:date",pe[8]="xs:time",pe[9]="xs:dateTime",pe[10]="xs:dateTimeStamp",pe[11]="xs:gYearMonth",pe[12]="xs:gYear",pe[13]="xs:gMonthDay",pe[14]="xs:gMonth",pe[15]="xs:gDay",pe[16]="xs:yearMonthDuration",pe[17]="xs:dayTimeDuration",pe[18]="xs:duration",pe[19]="xs:untypedAtomic",pe[20]="xs:anyURI",pe[21]="xs:base64Binary",pe[22]="xs:hexBinary",pe[23]="xs:QName",pe[24]="xs:NCName",pe[25]="xs:Name",pe[26]="xs:ENTITY",pe[27]="xs:nonPositiveInteger",pe[28]="xs:negativeInteger",pe[29]="xs:positiveInteger",pe[30]="xs:nonNegativeInteger",pe[31]="xs:long",pe[32]="xs:int",pe[33]="xs:short",pe[34]="xs:byte",pe[35]="xs:unsignedInt",pe[36]="xs:unsignedLong",pe[37]="xs:unsignedByte",pe[38]="xs:unsignedShort",pe[39]="xs:error",pe[40]="xs:ENTITIES",pe[41]="xs:IDREF",pe[42]="xs:ID",pe[43]="xs:IDREFS",pe[44]="xs:NOTATION",pe[45]="xs:anySimpleType",pe[46]="xs:anyAtomicType",pe[47]="attribute()",pe[48]="xs:normalizedString",pe[49]="xs:NMTOKENS",pe[50]="xs:NMTOKEN",pe[51]="xs:language",pe[52]="xs:token",pe[53]="node()",pe[54]="element()",pe[55]="document-node()",pe[56]="text()",pe[57]="processing-instruction()",pe[58]="comment()",pe[59]="item()",pe[60]="function(*)",pe[61]="map(*)",pe[62]="array(*)",pe[63]="none",pe),fe={"xs:boolean":0,"xs:string":1,"xs:numeric":2,"xs:double":3,"xs:decimal":4,"xs:integer":5,"xs:float":6,"xs:date":7,"xs:time":8,"xs:dateTime":9,"xs:dateTimeStamp":10,"xs:gYearMonth":11,"xs:gYear":12,"xs:gMonthDay":13,"xs:gMonth":14,"xs:gDay":15,"xs:yearMonthDuration":16,"xs:dayTimeDuration":17,"xs:duration":18,"xs:untypedAtomic":19,"xs:anyURI":20,"xs:base64Binary":21,"xs:hexBinary":22,"xs:QName":23,"xs:NCName":24,"xs:Name":25,"xs:ENTITY":26,"xs:nonPositiveInteger":27,"xs:negativeInteger":28,"xs:positiveInteger":29,"xs:nonNegativeInteger":30,"xs:long":31,"xs:int":32,"xs:short":33,"xs:byte":34,"xs:unsignedInt":35,"xs:unsignedLong":36,"xs:unsignedByte":37,"xs:unsignedShort":38,"xs:error":39,"xs:ENTITIES":40,"xs:IDREF":41,"xs:ID":42,"xs:IDREFS":43,"xs:NOTATION":44,"xs:anySimpleType":45,"xs:anyAtomicType":46,"attribute()":47,"xs:normalizedString":48,"xs:NMTOKENS":49,"xs:NMTOKEN":50,"xs:language":51,"xs:token":52,"node()":53,"element()":54,"document-node()":55,"text()":56,"processing-instruction()":57,"comment()":58,"item()":59,"function(*)":60,"map(*)":61,"array(*)":62};function de(e){return 2===e.g?he[e.type]+"*":1===e.g?he[e.type]+"+":0===e.g?he[e.type]+"?":he[e.type]}function me(e){if("none"===e)throw Error('XPST0051: The type "none" could not be found');if(!e.startsWith("xs:")&&0<=e.indexOf(":"))throw Error("XPST0081: Invalid prefix for input "+e);var t=fe[e];if(void 0===t)throw Error('XPST0051: The type "'+e+'" could not be found');return t}function ge(e){switch(e[e.length-1]){case"*":return{type:me(e.substr(0,e.length-1)),g:2};case"?":return{type:me(e.substr(0,e.length-1)),g:0};case"+":return{type:me(e.substr(0,e.length-1)),g:1};default:return{type:me(e),g:3}}}function ye(e,t,n){this.namespaceURI=t||null,this.prefix=e||"",this.localName=n}function ve(e){var t=e.l,n=e.arity,r=void 0!==e.Pa&&e.Pa,a=void 0!==e.I&&e.I,o=e.localName,i=e.namespaceURI,s=e.i;for(e=e.value,le.call(this,60,null),this.value=e,this.I=a,a=-1,e=0;e=n||n>e.R.length)throw Error("FOAY0001: array position out of bounds.");return e.R[n-1]()}))}))}function He(e){ve.call(this,{value:function(e,n,r,a){return Pe(0,0,0,ue.o(t),a)},localName:"get",namespaceURI:"http://www.w3.org/2005/xpath-functions/array",l:[{type:5,g:3}],arity:1,i:{type:59,g:2}});var t=this;this.type=62,this.R=e}function je(e){switch(e.node.nodeType){case 2:return 47;case 1:return 54;case 3:case 4:return 56;case 7:return 57;case 8:return 58;case 9:return 55;default:return 53}}function Xe(e){return{type:je(e),value:e}}function _e(e,t){return t(e=e.map((function(e){return e.first()})))}function Le(e,t){var n=Z(e.type,1)||Z(e.type,20)||Z(e.type,19),r=Z(t.type,1)||Z(t.type,20)||Z(t.type,19);return n&&r?e.value===t.value:(n=Z(e.type,4)||Z(e.type,3)||Z(e.type,6),r=Z(t.type,4)||Z(t.type,3)||Z(t.type,6),n&&r?!(!isNaN(e.value)||!isNaN(t.value))||e.value===t.value:(n=Z(e.type,0)||Z(e.type,22)||Z(e.type,18)||Z(e.type,23)||Z(e.type,44),r=Z(t.type,0)||Z(t.type,22)||Z(t.type,18)||Z(t.type,23)||Z(t.type,44),!(!n||!r)&&e.value===t.value))}function Ve(e,t,n,r,a){return _e([r,a],(function(e){var t=(e=c(e)).next().value,n=e.next().value;return(e=t.h.find((function(e){return Le(e.key,n)})))?e.value():ue.empty()}))}function Ye(e){ve.call(this,{l:[{type:59,g:3}],arity:1,localName:"get",namespaceURI:"http://www.w3.org/2005/xpath-functions/map",value:function(e,n,r,a){return Ve(0,0,0,ue.o(t),a)},i:{type:59,g:2}});var t=this;this.type=61,this.h=e}function qe(){}function Qe(e,t){return e.ab()===t.ab()&&e.bb()===t.bb()}function Je(e){if(e>Number.MAX_SAFE_INTEGER||eNumber.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while multiplying xs:dayTimeDuration");return new Je(ee||273860t.pa?1:-1:r>n?1:-1}function lt(e,t,n){return 0===ct(e,t,n)}function pt(e,t,n){return new Je(e=(st(e,n).getTime()-st(t,n).getTime())/1e3)}function ht(e){throw Error("Not implemented: adding durations to "+he[e.type])}function ft(e){throw Error("Not implemented: subtracting durations from "+he[e.type])}function dt(e,t){if("number"!=typeof e&&("string"!=typeof e||!V.get(t)(e)))throw Error("Cannot convert JavaScript value '"+e+"' to the XPath type "+he[t]+" since it is not valid.")}function mt(e,t,n){if(null===t)return null;switch(e){case 0:return t?Q:J;case 1:return q(t+"",1);case 3:case 2:return dt(t,3),q(+t,3);case 4:return dt(t,e),q(+t,4);case 5:return dt(t,e),q(0|t,5);case 6:return dt(t,e),q(+t,6);case 7:case 8:case 9:case 11:case 12:case 13:case 14:case 15:if(!(t instanceof Date))throw Error("The JavaScript value "+t+" with type "+typeof t+" is not a valid type to be converted to an XPath "+he[e]+".");return q(it(ut(t.toISOString()),e),e);case 53:case 47:case 55:case 54:case 56:case 57:case 58:if("object"!=typeof t||!("nodeType"in t))throw Error("The JavaScript value "+t+" with type "+typeof t+" is not a valid type to be converted to an XPath "+he[e]+".");return Xe({node:t,F:null});case 59:return function e(t,n){if(null===t)return null;switch(typeof t){case"boolean":return t?Q:J;case"number":return q(t,3);case"string":return q(t,1);case"object":return"nodeType"in t?Xe({node:t,F:null}):Array.isArray(t)?new He(t.map((function(t){return void 0===t?function(){return ue.empty()}:ce(t=null===(t=e(t))?ue.empty():ue.o(t))}))):new Ye(Object.keys(t).filter((function(e){return void 0!==t[e]})).map((function(n){var r=e(t[n]);return r=null===r?ue.empty():ue.o(r),{key:q(n,1),value:ce(r)}})))}throw Error("Value "+String(t)+' of type "'+typeof t+'" is not adaptable to an XPath value.')}(t);default:throw Error('Values of the type "'+e+'" can not be adapted to equivalent XPath values.')}}function gt(e,t,n){if(0===n.g)return null===(t=mt(n.type,t))?[]:[t];if(2===n.g||1===n.g){if(!Array.isArray(t))throw Error("The JavaScript value "+t+" should be an array if it is to be converted to "+de(n)+".");return t.map((function(e){return mt(n.type,e)})).filter((function(e){return null!==e}))}var r=mt(n.type,t);if(null===r)throw Error("The JavaScript value "+t+" should be a single entry if it is to be converted to "+de(n)+".");return[r]}function yt(e,t,n){return n=void 0===n?{type:59,g:0}:n,ue.create(gt(0,t,n))}function vt(e,t){this.h=t=void 0===t?{vb:null,Ab:null,pb:!1}:t,this.Ja=e.Ja,this.Ga=e.Ga,this.M=e.M,this.Ea=e.Ea||Object.create(null)}function wt(e,t){var n=0,r=t.value;return{next:function(a){return(a=r.next(a)).done?W:$(bt(e,n++,a.value,t))}}}function xt(e){return e.h.pb||(e.h.pb=!0,e.h.vb=ut((new Date).toISOString()),e.h.Ab=We("PT0S")),e.h.vb}function At(e){return e.h.pb||(e.h.pb=!0,e.h.vb=ut((new Date).toISOString()),e.h.Ab=We("PT0S")),e.h.Ab}function bt(e,t,n,r){return new vt({M:n,Ja:t,Ga:r||e.Ga,Ea:e.Ea},e.h)}function Et(e,t){return new vt({M:e.M,Ja:e.Ja,Ga:e.Ga,Ea:Object.assign(Object.create(null),e.Ea,t)},e.h)}function Nt(e,t,n,r,a,o,i,s){var u=new Map;this.debug=e,this.Ha=t,this.h=n,this.s=r,this.A=a,this.u=o,this.ha=u,this.O=i,this.j=s}function Bt(e){var t=0,n=null,r=!0;return ue.create({next:function(a){for(;tNumber.MAX_SAFE_INTEGER||eNumber.MAX_SAFE_INTEGER||!Number.isFinite(t))throw Error("FODT0002: Value overflow while constructing xs:yearMonthDuration");e=new Ft(e||0===t?t:-t)}else e=null;return e}function jt(e,t){if(isNaN(t))throw Error("FOCA0005: Cannot multiply xs:yearMonthDuration by NaN");if((e=Math.round(e.ga*t))>Number.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while constructing xs:yearMonthDuration");return new Ft(ee?"-":"")+"INF"}}}return e(9)||e(7)||e(8)||e(15)||e(14)||e(13)||e(12)||e(11)||e(16)||e(17)||e(18)?function(e){return{v:!0,value:e.toString()}}:e(22)?function(e){return{v:!0,value:e.toUpperCase()}}:function(e){return{v:!0,value:e+""}}}var Vt=[2,5,17,16];function Yt(e,t){function n(t){return Z(e,t)}if(39===t)return function(){return{v:!1,error:Error("FORG0001: Casting to xs:error is always invalid.")}};switch(t){case 19:return function(e){var t=Lt(e);return function(e){return(e=t(e)).v?{v:!0,value:q(e.value,19)}:e}}(n);case 1:return function(e){var t=Lt(e);return function(e){return(e=t(e)).v?{v:!0,value:q(e.value,1)}:e}}(n);case 6:return function(e){var t=kt(e,6);return function(e){return(e=t(e)).v?{v:!0,value:q(e.value,6)}:e}}(n);case 3:return function(e){var t=kt(e,3);return function(e){return(e=t(e)).v?{v:!0,value:q(e.value,3)}:e}}(n);case 4:return function(e){return e(5)?function(e){return{v:!0,value:q(e,4)}}:e(6)||e(3)?function(e){return isNaN(e)||!isFinite(e)?{v:!1,error:Error("FOCA0002: Can not cast "+e+" to xs:decimal")}:Math.abs(e)>Number.MAX_VALUE?{v:!1,error:Error("FOAR0002: Can not cast "+e+" to xs:decimal, it is out of bounds for JavaScript numbers")}:{v:!0,value:q(e,4)}}:e(0)?function(e){return{v:!0,value:q(e?1:0,4)}}:e(1)||e(19)?function(e){var t=parseFloat(e);return!isNaN(t)||isFinite(t)?{v:!0,value:q(t,4)}:{v:!1,error:Error("FORG0001: Can not cast "+e+" to xs:decimal")}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:decimal or any of its derived types.")}}}(n);case 5:return function(e){return e(0)?function(e){return{v:!0,value:q(e?1:0,5)}}:e(2)?function(e){var t=Math.trunc(e);return!isFinite(t)||isNaN(t)?{v:!1,error:Error("FOCA0002: can not cast "+e+" to xs:integer")}:Number.isSafeInteger(t)?{v:!0,value:q(t,5)}:{v:!1,error:Error("FOAR0002: can not cast "+e+" to xs:integer, it is out of bounds for JavaScript numbers.")}}:e(1)||e(19)?function(e){var t=parseInt(e,10);return isNaN(t)?{v:!1,error:Tt(e,5)}:Number.isSafeInteger(t)?{v:!0,value:q(t,5)}:{v:!1,error:Error("FOCA0003: can not cast "+e+" to xs:integer, it is out of bounds for JavaScript numbers.")}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:integer or any of its derived types.")}}}(n);case 2:return function(e){var t=Yt;return function(n){for(var r=c(_t),a=r.next();!a.done;a=r.next())if((a=t(e,a.value)(n)).v)return a;return{v:!1,error:Error('XPTY0004: Casting not supported from "'+n+'" given type to xs:numeric or any of its derived types.')}}}(e);case 18:return function(e){return e(16)?function(e){return{v:!0,value:q(new Xt(e,new Je(e.oa()?0:-0)),18)}}:e(17)?function(e){return{v:!0,value:q(e=new Xt(new Ft(e.oa()?0:-0),e),18)}}:e(18)?function(e){return{v:!0,value:q(e,18)}}:e(19)||e(1)?function(e){return{v:!0,value:q(new Xt(Ht(e),We(e)),18)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:duration or any of its derived types.")}}}(n);case 16:return function(e){return e(18)&&!e(17)?function(e){return{v:!0,value:q(e.Sa,16)}}:e(17)?function(){return{v:!0,value:q(Ht("P0M"),16)}}:e(19)||e(1)?function(e){var t=Ht(e);return t?{v:!0,value:q(t,16)}:{v:!1,error:Tt(e,16)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:yearMonthDuration or any of its derived types.")}}}(n);case 17:return function(e){return e(18)&&!e(16)?function(e){return{v:!0,value:q(e.Fa,17)}}:e(16)?function(){return{v:!0,value:q(We("PT0.0S"),17)}}:e(19)||e(1)?function(e){var t=We(e);return t?{v:!0,value:q(t,17)}:{v:!1,error:Error("FORG0001: Can not cast "+e+" to xs:dayTimeDuration")}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:dayTimeDuration or any of its derived types.")}}}(n);case 9:return function(e){return e(7)?function(e){return{v:!0,value:q(it(e,9),9)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),9)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:dateTime or any of its derived types.")}}}(n);case 8:return function(e){return e(9)?function(e){return{v:!0,value:q(it(e,8),8)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),8)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:time or any of its derived types.")}}}(n);case 7:return function(e){return e(9)?function(e){return{v:!0,value:q(it(e,7),7)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),7)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:date or any of its derived types.")}}}(n);case 11:return function(e){return e(7)||e(9)?function(e){return{v:!0,value:q(it(e,11),11)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),11)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gYearMonth or any of its derived types.")}}}(n);case 12:return function(e){return e(7)||e(9)?function(e){return{v:!0,value:q(it(e,12),12)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),12)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gYear or any of its derived types.")}}}(n);case 13:return function(e){return e(7)||e(9)?function(e){return{v:!0,value:q(it(e,13),13)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),13)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gMonthDay or any of its derived types.")}}}(n);case 15:return function(e){return e(7)||e(9)?function(e){return{v:!0,value:q(it(e,15),15)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),15)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gDay or any of its derived types.")}}}(n);case 14:return function(e){return e(7)||e(9)?function(e){return{v:!0,value:q(it(e,14),14)}}:e(19)||e(1)?function(e){return{v:!0,value:q(ut(e),14)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gMonth or any of its derived types.")}}}(n);case 0:return function(e){return e(2)?function(e){return{v:!0,value:0===e||isNaN(e)?J:Q}}:e(1)||e(19)?function(e){switch(e){case"true":case"1":return{v:!0,value:Q};case"false":case"0":return{v:!0,value:J};default:return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:boolean or any of its derived types.")}}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:boolean or any of its derived types.")}}}(n);case 21:return function(e){return e(22)?function(e){for(var t="",n=0;nr.value.node.localName?1:-1;n=ke(t,n.value),r=ke(t,r.value)}else n=n.value,r=r.value;return en(e,t,n,r)}function nn(e,t,n){return tn(e.s,e,t,n)}function rn(e,t){return function e(t,n){if(n=void 0===n?an:n,1>=t.length)return t;var r=Math.floor(t.length/2),a=e(t.slice(0,r),n);for(t=e(t.slice(r),n),r=[];a.length&&t.length;)0>n(a[0],t[0])?r.push(a.shift()):r.push(t.shift());return r.concat(a.concat(t))}(t,(function(t,n){return tn(e.s,e,t,n)})).filter((function(e,t,n){return 0===t||!Wt(e.value,n[t-1].value)}))}function an(e,t){return e(e=t-parseInt(e[3],10))?0:e:t}(n.value)(a=a.first().value)?ue.o(q(1,5)):e=e||57344<=e&&65533>=e||65536<=e&&1114111>=e)return String.fromCodePoint(e);throw Error("FOCH0001")})).join(""),ue.o(q(e,1))}))},localName:"codepoints-to-string",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:1,g:0}],m:function(e,t,n,r){return _e([r],(function(e){return 0===(e=(e=c(e).next().value)?e.value.split(""):[]).length?ue.empty():ue.create(e.map((function(e){return q(e.codePointAt(0),5)})))}))},localName:"string-to-codepoints",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:5,g:2}},{l:[{type:1,g:0}],m:function(e,t,n,r){return _e([r],(function(e){return null===(e=c(e).next().value)||0===e.value.length?ue.create(q("",1)):ue.create(q(encodeURIComponent(e.value).replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})),1))}))},localName:"encode-for-uri",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:1,g:0}],m:function(e,t,n,r){return _e([r],(function(e){return null===(e=c(e).next().value)||0===e.value.length?ue.create(q("",1)):ue.create(q(e.value.replace(/([\u00A0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFEF "<>{}|\\^`/\n\u007f\u0080-\u009f]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,(function(e){return encodeURI(e)})),1))}))},localName:"iri-to-uri",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:1,g:0},{type:1,g:0}],m:function(e,t,n,r,a){return _e([r,a],(function(e){var t=c(e);if(e=t.next().value,t=t.next().value,null===e||null===t)return ue.empty();if(e=e.value,t=t.value,e.length!==t.length)return ue.X();e=e.split(""),t=t.split("");for(var n=0;nt.node.nodeName?1:-1})).map((function(e){return Xe(e)})),a=Se(t.h,a.value).filter((function(e){return"http://www.w3.org/2000/xmlns/"!==e.node.namespaceURI})).sort((function(e,t){return e.node.nodeName>t.node.nodeName?1:-1})).map((function(e){return Xe(e)}));var s=Ln(e,t,n,ue.create(r),ue.create(a)),u=!1;return{next:function(){if(u)return W;var e=o.next(0);return(e.done||!1!==e.value)&&((e=s.next(0)).done||!1!==e.value)?(e=i.next(0),u=!0,e):(u=!0,e)}}}(e,t,n,r,a);if(Z(r.type,47)&&Z(a.type,47)||Z(r.type,57)&&Z(a.type,57)||Z(r.type,58)&&Z(a.type,58))return function(e,t,n,r,a){var o=Ln(e,t,n,Cn(0,0,0,ue.o(r)),Cn(0,0,0,ue.o(a))),i=!1;return{next:function(){if(i)return W;var e=o.next(0);return e.done||!1!==e.value?$(jn(Ot(r,t).first(),Ot(a,t).first())):(i=!0,e)}}}(e,t,n,r,a)}return zt(!1)}function qn(e){return Error("XUST0001: "+(void 0===e?"Can not execute an updating expression in a non-updating context.":e))}function Qn(e){return Error("XUTY0004: The attribute "+e.name+'="'+e.value+'" follows a node that is not an attribute node.')}function Jn(){return Error("XUTY0005: The target of a insert expression with into must be a single element or document node.")}function Kn(){return Error("XUTY0006: The target of a insert expression with before or after must be a single element, text, comment, or processing instruction node.")}function zn(){return Error("XUTY0008: The target of a replace expression must be a single element, attribute, text, comment, or processing instruction node.")}function Wn(){return Error("XUTY0012: The target of a rename expression must be a single element, attribute, or processing instruction node.")}function $n(e){return Error("XUDY0017: The target "+e.outerHTML+" is used in more than one replace value of expression.")}function Zn(e){return Error("XUDY0021: Applying the updates will result in the XDM instance violating constraint: '"+e+"'")}function er(e){return Error("XUDY0023: The namespace binding "+e+" is conflicting.")}function tr(e){return Error("XUDY0024: The namespace binding "+e+" is conflicting.")}function nr(){return Error("XUDY0027: The target for an insert, replace, or rename expression expression should not be empty.")}function rr(e,t,n,r,a){n=void 0===n?{C:!1,Y:!1,S:"unsorted",subtree:!1}:n,this.s=e,this.O=n.S||"unsorted",this.subtree=!!n.subtree,this.Y=!!n.Y,this.C=!!n.C,this.ha=t,this.I=!1,this.Ya=null,this.bc=void 0!==r&&r,this.type=a}function ar(e,t,n){return t&&null!==t.M&&e.C?(null===e.Ya&&(e.Ya=ce(e.h(null,n).ob())),e=e.Ya()):e=e.h(t,n),e}function or(e,t){this.H=e,this.fa=t}function ir(e){e&&"object"==typeof e&&"nodeType"in e&&("function"==typeof(e=e.ownerDocument||e).createElementNS&&"function"==typeof e.createProcessingInstruction&&"function"==typeof e.createTextNode&&"function"==typeof e.createComment&&(this.h=e)),this.h||(this.h=null)}function sr(e,t,n){t.forEach((function(t){n.insertBefore(e.node,t.node,null)}))}function ur(e,t,n,r){var a=ke(n,e),o=e.node.nodeType;if(2===o){if(t.some((function(e){return 2!==e.node.nodeType})))throw Error('Constraint "If $target is an attribute node, $replacement must consist of zero or more attribute nodes." failed.');var i=a?a.node:null;r.removeAttributeNS(i,e.node.namespaceURI,e.node.nodeName),t.forEach((function(e){var t=e.node.nodeName;if(Oe(n,a,t))throw Zn("An attribute "+t+" already exists.");r.setAttributeNS(i,e.node.namespaceURI,t,De(n,e))}))}if(1===o||3===o||8===o||7===o){var s=(o=Ge(n,e))?o.node:null;r.removeChild(a.node,e.node),t.forEach((function(e){r.insertBefore(a.node,e.node,s)}))}}function cr(e,t,n,r){if(function(e,t){function n(e){return new ye(e.node.prefix,e.node.namespaceURI,e.node.localName)}function r(t,n){var r=new Set;e.filter((function(e){return e.type===t})).map((function(e){return e.target})).forEach((function(e){e=e?e.node:null,r.has(e)&&n(e),r.add(e)}))}r("rename",(function(e){throw Error("XUDY0015: The target "+e.outerHTML+" is used in more than one rename expression.")})),r("replaceNode",(function(e){throw Error("XUDY0016: The target "+e.outerHTML+" is used in more than one replace expression.")})),r("replaceValue",(function(e){throw $n(e)})),r("replaceElementContent",(function(e){throw $n(e)}));var a=new Map;e.filter((function(e){return"replaceNode"===e.type&&2===e.target.node.nodeType})).forEach((function(e){var r=ke(t,e.target);r=r?r.node:null;var o=a.get(r);o?o.push.apply(o,p(e.s.map(n))):a.set(r,e.s.map(n))})),e.filter((function(e){return"rename"===e.type&&2===e.target.node.nodeType})).forEach((function(e){var n=ke(t,e.target);if(n){n=n.node;var r=a.get(n);r?r.push(e.s):a.set(n,[e.s])}})),a.forEach((function(e){var t={};e.forEach((function(e){if(t[e.prefix]||(t[e.prefix]=e.namespaceURI),t[e.prefix]!==e.namespaceURI)throw tr(e.namespaceURI)}))}))}(e,t),e.filter((function(e){return-1!==["insertInto","insertAttributes","replaceValue","rename"].indexOf(e.type)})).forEach((function(e){switch(e.type){case"insertInto":sr(e.target,e.content,r);break;case"insertAttributes":!function(e,t,n,r){t.forEach((function(t){var a=t.node.nodeName;if(Oe(n,e,a))throw Zn("An attribute "+a+" already exists.");r.setAttributeNS(e.node,t.node.namespaceURI,a,De(n,t))}))}(e.target,e.content,t,r);break;case"rename":!function(e,t,n,r,a){switch(r||(r=new ir(e?e.node:null)),e.node.nodeType){case 1:var o=n.getAllAttributes(e.node),i=n.getChildNodes(e.node),s=r.createElementNS(t.namespaceURI,t.va()),u={node:s,F:null};o.forEach((function(e){a.setAttributeNS(s,e.namespaceURI,e.nodeName,e.value)})),i.forEach((function(e){a.insertBefore(s,e,null)}));break;case 2:(t=r.createAttributeNS(t.namespaceURI,t.va())).value=De(n,e),u={node:t,F:null};break;case 7:u={node:r.createProcessingInstruction(t.va(),De(n,e)),F:null}}if(!ke(n,e))throw Error("Not supported: renaming detached nodes.");ur(e,[u],n,a)}(e.target,e.s,t,n,r);break;case"replaceValue":var a=e.target;if(e=e.s,2===a.node.nodeType){var o=ke(t,a);o?r.setAttributeNS(o.node,a.node.namespaceURI,a.node.nodeName,e):a.node.value=e}else r.setData(a.node,e)}})),e.filter((function(e){return-1!==["insertBefore","insertAfter","insertIntoAsFirst","insertIntoAsLast"].indexOf(e.type)})).forEach((function(e){switch(e.type){case"insertAfter":!function(e,t,n,r){var a=ke(n,e).node,o=(e=Ge(n,e))?e.node:null;t.forEach((function(e){r.insertBefore(a,e.node,o)}))}(e.target,e.content,t,r);break;case"insertBefore":!function(e,t,n,r){var a=ke(n,e).node;t.forEach((function(t){r.insertBefore(a,t.node,e.node)}))}(e.target,e.content,t,r);break;case"insertIntoAsFirst":!function(e,t,n,r){var a=(n=Ue(n,e))?n.node:null;t.forEach((function(t){r.insertBefore(e.node,t.node,a)}))}(e.target,e.content,t,r);break;case"insertIntoAsLast":sr(e.target,e.content,r)}})),e.filter((function(e){return"replaceNode"===e.type})).forEach((function(e){ur(e.target,e.s,t,r)})),e.filter((function(e){return"replaceElementContent"===e.type})).forEach((function(e){!function(e,t,n,r){n.getChildNodes(e.node).forEach((function(t){return r.removeChild(e.node,t)})),t&&r.insertBefore(e.node,t.node,null)}(e.target,e.text,t,r)})),e.filter((function(e){return"delete"===e.type})).forEach((function(e){e=e.target;var n=ke(t,e);(n=n?n.node:null)&&(2===e.node.nodeType?r.removeAttributeNS(n,e.node.namespaceURI,e.node.nodeName):r.removeChild(n,e.node))})),e.some((function(e){return"put"===e.type})))throw Error('Not implemented: the execution for pendingUpdate "put" is not yet implemented.')}function lr(e,t){for(var n=[],r=1;re.h[n])return-1}return 0}function wr(){return It("Expected base expression of a function call to evaluate to a sequence of single function item")}function xr(e,t,n,r){for(var a=[],o=0;oe.R.length||0>=n)throw Error("FOAY0001: subarray start out of bounds.");if(0>t)throw Error("FOAY0002: subarray length out of bounds.");if(n+t>e.R.length+1)throw Error("FOAY0001: subarray start + length out of bounds.");return ue.o(new He(e.R.slice(n-1,t+n-1)))}))}function Br(e,t,n,r,a){return _e([r],(function(e){var t=c(e).next().value;return a.L((function(e){e=e.map((function(e){return e.value})).sort((function(e,t){return t-e})).filter((function(e,t,n){return n[t-1]!==e}));for(var n=t.R.concat(),r=0,a=e.length;rt.R.length||0>=o)throw Error("FOAY0001: subarray position out of bounds.");n.splice(o-1,1)}return ue.o(new He(n))}))}))}function Tr(e){return Z(e,1)||Z(e,20)||Z(e,19)}function Ir(e,t,n,r){return r.sort((function(r,a){return Ln(e,t,n,ue.create(r),ue.create(a)).next(0).value?0:function e(t,n,r,a,o){return 0===a.length?0!==o.length:0!==o.length&&Yn(t,n,r,a[0],o[0]).next(0).value?e(t,n,r,a.slice(1),o.slice(1)):a[0].value!=a[0].value||(Tr(a[0].type)&&0!==o.length&&Tr(o[0].type)||0!==o.length)&&a[0].value=(e=e.value)||e>t.R.length)throw Error("FOAY0001: array position out of bounds.");return(t=t.R.concat()).splice(e-1,1,ce(o)),ue.o(new He(t))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"append",l:[{type:62,g:3},{type:59,g:2}],i:{type:62,g:3},m:function(e,t,n,r,a){return _e([r],(function(e){return e=c(e).next().value.R.concat([ce(a)]),ue.o(new He(e))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"subarray",l:[{type:62,g:3},{type:5,g:3},{type:5,g:3}],i:{type:62,g:3},m:Nr},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"subarray",l:[{type:62,g:3},{type:5,g:3}],i:{type:62,g:3},m:function(e,t,n,r,a){var o=ue.o(q(r.first().value.length-a.first().value+1,5));return Nr(0,0,0,r,a,o)}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"remove",l:[{type:62,g:3},{type:5,g:2}],i:{type:62,g:3},m:Br},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"insert-before",l:[{type:62,g:3},{type:5,g:3},{type:59,g:2}],i:{type:62,g:3},m:function(e,t,n,r,a,o){return _e([r,a],(function(e){var t=c(e);if(e=t.next().value,(t=t.next().value.value)>e.R.length+1||0>=t)throw Error("FOAY0001: subarray position out of bounds.");return(e=e.R.concat()).splice(t-1,0,ce(o)),ue.o(new He(e))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"head",l:[{type:62,g:3}],i:{type:59,g:2},m:function(e,t,n,r){return Pe(0,0,0,r,ue.o(q(1,5)))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"tail",l:[{type:62,g:3}],i:{type:59,g:2},m:function(e,t,n,r){return Br(0,0,0,r,ue.o(q(1,5)))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"reverse",l:[{type:62,g:3}],i:{type:62,g:3},m:function(e,t,n,r){return _e([r],(function(e){return e=c(e).next().value,ue.o(new He(e.R.concat().reverse()))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"join",l:[{type:62,g:2}],i:{type:62,g:3},m:function(e,t,n,r){return r.L((function(e){return e=e.reduce((function(e,t){return e.concat(t.R)}),[]),ue.o(new He(e))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"for-each",l:[{type:62,g:3},{type:60,g:3}],i:{type:62,g:3},m:function(e,t,n,r,a){return _e([r,a],(function(r){var a=(r=c(r)).next().value,o=r.next().value;if(1!==o.A)throw It("The callback passed into array:for-each has a wrong arity.");return r=a.R.map((function(r){return ce(o.value.call(void 0,e,t,n,xr(o.s,[r()],t,"array:for-each")[0]))})),ue.o(new He(r))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"filter",l:[{type:62,g:3},{type:60,g:3}],i:{type:62,g:3},m:function(e,t,n,r,a){return _e([r,a],(function(r){var a=(r=c(r)).next().value,o=r.next().value;if(1!==o.A)throw It("The callback passed into array:filter has a wrong arity.");var i=a.R.map((function(r){return r=xr(o.s,[r()],t,"array:filter")[0],(0,o.value)(e,t,n,r)})),s=[],u=!1;return ue.create({next:function(){if(u)return W;for(var e=0,t=a.R.length;e=n.start.line&&o<=n.end.line){var i=on.start.line?a.length:n.start.la-1+a.length,e.push(Array(a.length+t.length).fill(" ",0,o).fill("^",o,i).join(""))}return e}),[]),t=function e(t){var n=t.h instanceof Yr?["Inner error:",t.h.message]:t.h instanceof Error?[t.h.toString()]:e(t.h);return n.push(" at <"+t.s+">:"+t.location.start.line+":"+t.location.start.la+" - "+t.location.end.line+":"+t.location.end.la),n}(t).join("\n"),new Yr(e.join("\n")+"\n\n"+t,n)}y(Yr,Error);var Qr=Object.create(null);function Jr(e,t){for(var n=[],r=0;re.length?"":"object"==typeof e[1]?e[2]||"":e[1]||""}function Aa(e,t){return Array.isArray(e)?"object"!=typeof(e=e[1])||Array.isArray(e)?null:t in e?e[t]:null:null}function ba(e,t){return t.reduce(wa,e)}function Ea(e,t){for(var n=[],r=1;rNumber.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while dividing xs:yearMonthDuration");return new Ft(eNumber.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while dividing xs:dayTimeDuration");return new Je(ea;a++)if(i=ja(r[a],t,n[o]))return 59!==i.type&&Ta(e,"type",i),i;default:return{type:59,g:2}}}return 59!==r.type&&Ta(e,"type",r),r}(e,_a(wa(e,"argExpr")[1],t),Ea(e,"typeswitchExprCaseClause").map((function(e){return _a(ba(e,["resultExpr"])[1],t)})),_a(ba(e,["typeswitchExprDefaultClause","resultExpr"])[1],t))}],["quantifiedExpr",function(e,t){return Ea(e,"*").map((function(e){return _a(e,t)})),function(e){var t={type:0,g:3};return Ta(e,"type",t),t}(e)}],["x:stackTrace",function(e,t){return _a((e=Ea(e,"*"))[0],t)}],["queryBody",function(e,t){return _a(e[1],t)}],["flworExpr",function(e,t){return function(e,t){for(var n=_a,r=!1,a=1;ae.W.value};case"geOp":return function(e,n){return(e=t(e,n)).V.value>=e.W.value}}}(e,r);if(void 0!==u)return u}if(a(16)&&void 0!==(u=function(e,t){switch(e){case"ltOp":return function(e,n){return(e=t(e,n)).V.value.gae.W.value.ga};case"geOp":return function(e,n){return e=(n=t(e,n)).V,n=n.W,Qe(e.value,n.value)||e.value.ga>n.value.ga}}}(e,r))||a(17)&&void 0!==(u=function(e,t){switch(e){case"eqOp":return function(e,n){return Qe((e=t(e,n)).V.value,e.W.value)};case"ltOp":return function(e,n){return(e=t(e,n)).V.value.eae.W.value.ea};case"geOp":return function(e,n){return e=(n=t(e,n)).V,n=n.W,Qe(e.value,n.value)||e.value.ea>n.value.ea}}}(e,r))||a(18)&&void 0!==(u=function(e,t){switch(e){case"eqOp":return function(e,n){return Qe((e=t(e,n)).V.value,e.W.value)};case"neOp":return function(e,n){return!Qe((e=t(e,n)).V.value,e.W.value)}}}(e,r)))return u;if((a(9)||a(7)||a(8))&&void 0!==(u=function(e,t){switch(e){case"eqOp":return function(e,n,r){return lt((e=t(e,n)).V.value,e.W.value,At(r))};case"neOp":return function(e,n,r){return!lt((e=t(e,n)).V.value,e.W.value,At(r))};case"ltOp":return function(e,n,r){return e=t(e,n),r=At(r),0>ct(e.V.value,e.W.value,r)};case"leOp":return function(e,n,r){var a;return e=(n=t(e,n)).V,n=n.W,(a=lt(e.value,n.value,At(r)))||(r=At(r),a=0>ct(e.value,n.value,r)),a};case"gtOp":return function(e,n,r){return e=t(e,n),r=At(r),0nn(t,e.first(),n.first())}:void 0;case"nodeAfterOp":return t?function(e,n){return 0=r)throw Error("FOAY0001: Array index out of bounds");n.push(e.R[r-1]())}else{if(!Z(e.type,61))throw ea("The provided context item is not a map or an array.");"*"===t?n.push.apply(n,p(e.h.map((function(e){return e.value()})))):(e=e.h.find((function(e){return Le(e.key,t)})))&&n.push(e.value())}return Bt(n)}function ui(e,t,n,r,a){return"*"===t?si(e,t,n):Bt([n,t=ce(t=ar(t,r,a))().L((function(t){return t.reduce((function(t,n){return si(e,n,t)}),new te)}))])}function ci(e,t){rr.call(this,e.s,[e].concat("*"===t?[]:[t]),{C:e.C,S:e.O,subtree:e.subtree}),this.j=e,this.u=t}function li(e,t){var n={};rr.call(this,new yr((n.external=1,n)),"*"===e?[]:[e],{C:!1},!1,t),this.j=e}function pi(e,t,n,r){var a=t.map((function(e){return e.eb}));t=t.map((function(e){return e.name}));var o=a.reduce((function(e,t){return e.add(t.s)}),n.s);rr.call(this,o,a.concat(n),{C:!1},!1,r),this.u=e,this.B=t,this.J=a,this.T=n,this.j=null}function hi(e){rr.call(this,e,[],{C:!1})}function fi(e){var t={};hi.call(this,new yr((t.nodeType=1,t))),this.u=e}function di(e,t){t=void 0===t?{kind:null}:t;var n=e.prefix,r=e.namespaceURI,a={};"*"!==(e=e.localName)&&(a.nodeName=1),a.nodeType=1,hi.call(this,new yr(a)),this.u=e,this.J=r,this.B=n,this.T=t.kind}function mi(e){var t={};hi.call(this,new yr((t.nodeName=1,t))),this.u=e}function gi(e){hi.call(this,new yr({})),this.u=e}function yi(e,t,n){rr.call(this,new yr({}),[],{C:!1,S:"unsorted"}),this.B=n,this.u=t,this.J=e,this.j=null}function vi(e,t){var n=new yr({});Ao.call(this,n,[e,t],{C:!1,Y:!1,S:"unsorted",subtree:!1},t),this.B=e}function wi(e,t){var n=t.h,r=t.s,a=t.A;switch(e.node.nodeType){case 1:var o=r.createElementNS(e.node.namespaceURI,e.node.nodeName);for(n.getAllAttributes(e.node).forEach((function(e){return a.setAttributeNS(o,e.namespaceURI,e.nodeName,e.value)})),e=(r=c(Re(n,e))).next();!e.done;e=r.next())e=wi(e.value,t),a.insertBefore(o,e.node,null);return{node:o,F:null};case 2:return(t=r.createAttributeNS(e.node.namespaceURI,e.node.nodeName)).value=De(n,e),{node:t,F:null};case 4:return{node:r.createCDATASection(De(n,e)),F:null};case 8:return{node:r.createComment(De(n,e)),F:null};case 9:for(r=r.createDocument(),e=(n=c(Re(n,e))).next();!e.done;e=n.next())e=wi(e.value,t),a.insertBefore(r,e.node,null);return{node:r,F:null};case 7:return{node:r.createProcessingInstruction(e.node.target,De(n,e)),F:null};case 3:return{node:r.createTextNode(De(n,e)),F:null}}}function xi(e,t){var n=t.A,r=t.s,a=t.h;if(!Te(e.node))return wi(e,t).node;switch(e.node.nodeType){case 2:return(r=r.createAttributeNS(e.node.namespaceURI,e.node.nodeName)).value=De(a,e),r;case 8:return r.createComment(De(a,e));case 1:var o=e.node.prefix,i=e.node.localName,s=r.createElementNS(e.node.namespaceURI,o?o+":"+i:i);return Re(a,e).forEach((function(e){e=xi(e,t),n.insertBefore(s,e,null)})),Se(a,e).forEach((function(e){n.setAttributeNS(s,e.node.namespaceURI,e.node.nodeName,De(a,e))})),s.normalize(),s;case 7:return r.createProcessingInstruction(e.node.target,De(a,e));case 3:return r.createTextNode(De(a,e))}}function Ai(e,t,n){var r=e.node;if(!(Te(r)||n||e.F))return r;r=t.ha;var a=[];return n?xi(e,t):(e=function(e,t,n){var r=e;for(e=ke(n,r);null!==e;){if(2===r.node.nodeType)t.push(r.node.nodeName);else{var a=Re(n,e);t.push(a.findIndex((function(e){return Wt(e,r)})))}e=ke(n,r=e)}return r}(e,a,t.h),(n=r.get(e.node))||(n={node:xi(e,t),F:null},r.set(e.node,n)),function(e,t,n){for(var r={};0nn(t.h,i,s)){if(e=$(i),i=null,"exceptOp"===n.j)return e}else s=null}return"exceptOp"===n.j?null!==i?(e=$(i),i=null,e):a.next(0):(u=!0,W)}})},y(Yo,dr),Yo.prototype.B=function(e,t,n){return n.length?Bt(n.map((function(t){return t(e)}))):ue.empty()},y(qo,rr),qo.prototype.h=function(e,t){var n=this,r=wt(e,ar(this.j,e,t)),a=null,o=null,i=!1;return ue.create({next:function(e){for(;!i;){if(!a&&(a=r.next(e)).done)return i=!0,W;o||(o=ar(n.u,a.value,t));var s=o.value.next(e);if(!s.done)return s;a=o=null}}})},y(Qo,rr),Qo.prototype.h=function(e,t){var n=this,r=Rt(ar(this.B,e,t),t);return r.$({empty:function(){return n.u?ue.ca():ue.X()},o:function(){return r.map((function(e){return Jt(e,n.j).v?Q:J}))},multiple:function(){return ue.X()}})},y(Jo,rr),Jo.prototype.h=function(e,t){var n=this,r=Rt(ar(this.B,e,t),t);return r.$({empty:function(){if(!n.u)throw Error("XPTY0004: Sequence to cast is empty while target type is singleton.");return ue.empty()},o:function(){return r.map((function(e){return Kt(e,n.j)}))},multiple:function(){throw Error("XPTY0004: Sequence to cast is not singleton or empty.")}})},y(zo,rr),zo.prototype.h=function(e,t){var n=this,r=ar(this.B,e,t);return r.$({empty:function(){return"?"===n.j||"*"===n.j?ue.ca():ue.X()},multiple:function(){return"+"===n.j||"*"===n.j?Ko(r,(function(r){var a=ue.o(r);return r=bt(e,0,r,a),ar(n.u,r,t)})):ue.X()},o:function(){return Ko(r,(function(r){var a=ue.o(r);return r=bt(e,0,r,a),ar(n.u,r,t)}))}})},y(ei,rr),ei.prototype.h=function(e,t){var n=this;if(this.j.every((function(e){return"sorted"===e.O}))){var r=0;return Zo(t.h,{next:function(){return r>=n.j.length?W:$(ar(n.j[r++],e,t))}}).map((function(e){if(!Z(e.type,53))throw Error("XPTY0004: The sequences to union are not of type node()*");return e}))}return Bt(this.j.map((function(n){return ar(n,e,t)}))).L((function(e){if(e.some((function(e){return!Z(e.type,53)})))throw Error("XPTY0004: The sequences to union are not of type node()*");return e=rn(t.h,e),ue.create(e)}))},y(ni,Ao),ni.prototype.J=function(e,t,n,r){if(this.B[1])throw Error("More than one order spec is not supported for the order by clause.");var a,o,i=[],s=!1,u=null,l=this.B[0];return ue.create({next:function(){if(!s){for(var p=t.next(0);!p.done;)i.push(p.value),p=t.next(0);if((p=i.map((function(e){return l.da.h(e,n)})).map((function(e){return Rt(e,n)}))).find((function(e){return!e.G()&&!e.ya()})))throw ea("Order by only accepts empty or singleton sequences");if(function(e){return(e=e.find((function(e){return!!e})))?Dt(e.type):null}(a=(a=p.map((function(e){return e.first()}))).map((function(e){return null===e?e:Z(19,e.type)?Kt(e,1):e})))&&!(a=ti(a)))throw ea("Could not cast values");p=a.length,o=a.map((function(e,t){return t}));for(var h=0;h=a.length?W:$(i[o[v++]]):0>v?W:$(i[o[v--]])}}).value,s=!0}return u.next(0)}})},y(ri,rr),ri.prototype.h=function(e,t){if(null===e.M)throw Error("XPDY0002: context is absent, it needs to be present to use paths.");for(var n=t.h,r=e.M.value;9!==r.node.nodeType;)if(null===(r=ke(n,r)))throw Error("XPDY0050: the root node of the context node is not a document node.");return n=ue.o(Xe(r)),this.j?ar(this.j,bt(e,0,n.first(),n),t):n},y(ai,rr),ai.prototype.h=function(e){if(null===e.M)throw Error('XPDY0002: context is absent, it needs to be present to use the "." operator');return ue.o(e.M)},y(oi,rr),oi.prototype.h=function(e,t){var n=this,r=!0;return this.j.reduce((function(a,o,i){var s=null===a?zt(e):wt(e,a);if(a={next:function(e){if((e=s.next(e)).done)return W;if(null!==e.value.M&&!Z(e.value.M.type,53)&&0c.length-1)){for(i=Object.create(null),s={},u=0;u"))throw Error('XQDY0026: The content "'+u+'" for a processing instruction node contains "?>".');return s=!0,$({H:[],fa:lr([new Mi(r.value,u)],i,a)})}}}}(t,n,e):function(e,t,n){var r,a,o;return{next:function(){if(!r){var i=n.next(0),s=Fi([i.value.H],e,tr);r={attributes:s.attributes.map((function(e){return{node:e,F:null}})),Ta:s.Ta.map((function(e){return{node:e,F:null}}))},a=i.value.fa}if(0===(s=t.next(0)).value.H.length)throw nr();if(1!==s.value.H.length)throw zn();if(!(Z(s.value.H[0].type,54)||Z(s.value.H[0].type,47)||Z(s.value.H[0].type,56)||Z(s.value.H[0].type,58)||Z(s.value.H[0].type,57)))throw zn();if(null===(o=ke(e.h,s.value.H[0].value,null)))throw Error("XUDY0009: The target "+s.value.H[0].value.outerHTML+" for replacing a node must have a parent.");if(i=s.value.H[0],s=s.value.fa,Z(i.type,47)){if(r.Ta.length)throw Error("XUTY0011: When replacing an attribute the new value must be zero or more attribute nodes.");r.attributes.reduce((function(e,t){var n=t.node.prefix||"";t=t.node.namespaceURI;var r=o.node.lookupNamespaceURI(n);if(r&&r!==t)throw er(t);if((r=e[n])&&t!==r)throw tr(t);return e[n]=t,e}),{})}else if(r.attributes.length)throw Error("XUTY0010: When replacing an an element, text, comment, or processing instruction node the new value must be a single node.");return $({H:[],fa:lr([Gi(i.value,[].concat(r.attributes,r.Ta))],a,s)})}}}(t,n,e)},y(Ki,pr),Ki.prototype.h=function(e,t){return fr(e=this.u(e,t),(function(){}))},Ki.prototype.u=function(e,t){var n,r,a,o=this,i=t.h,s=t.s,u=t.A,c=[],l=[],h=[];return{next:function(){if(l.length!==o.j.length)for(var f={},d=l.length;d"))throw Error('XQDY0026: The contents of the data of a processing instruction may not include "?>"');if(null!==n.j.Jb)return es(r=n.j.Jb),ue.o(Xe(ts(r,a)));r=ar(n.j.Cb,e,t);var o=Vi(t,r);return ue.create({next:function(){var e=o.next(0);return e.done?e:(es(e=e.value.value),$(Xe(ts(e,a))))}})}))},y(rs,rr),rs.prototype.h=function(e,t){return this.j?Rt(e=ar(this.j,e,t),t).L((function(e){return 0===e.length?ue.empty():(e={node:{data:e.map((function(e){return Kt(e,1).value})).join(" "),Qa:!0,nodeType:3},F:null},ue.o(Xe(e)))})):ue.empty()},y(as,dr),as.prototype.B=function(e,t,n){var r=this;return n[0](e).L((function(a){for(var o=0;oa.length)return!1;break;default:if(1!==a.length)return!1}var r=ue.create(a);return a.every((function(a,o){return a=bt(e,o,a,r),ar(n.Kb,a,t).getEffectiveBooleanValue()}))})))return n[o+1](e);return n[r.j+1](e)}))},as.prototype.P=function(e){if(dr.prototype.P.call(this,e),this.J.I)throw qn()};var os={aa:!1,qa:!1},is={aa:!0,qa:!1},ss={aa:!0,qa:!0};function us(e){return e.aa?e.qa?ss:is:os}function cs(e,t){switch(e[0]){case"andOp":var n=Aa(e,"type");return new Ro(ps("andOp",e,us(t)),n);case"orOp":return n=Aa(e,"type"),new Do(ps("orOp",e,us(t)),n);case"unaryPlusOp":return n=wa(wa(e,"operand"),"*"),e=Aa(e,"type"),new Oo("+",cs(n,t),e);case"unaryMinusOp":return n=wa(wa(e,"operand"),"*"),e=Aa(e,"type"),new Oo("-",cs(n,t),e);case"addOp":case"subtractOp":case"multiplyOp":case"divOp":case"idivOp":case"modOp":var r=e[0],a=cs(ba(e,["firstOperand","*"]),us(t));t=cs(ba(e,["secondOperand","*"]),us(t));var o=Aa(e,"type"),i=Aa(ba(e,["firstOperand","*"]),"type"),s=Aa(ba(e,["secondOperand","*"]),"type");return i&&s&&Aa(e,"type")&&(n=Ma(r,i.type,s.type)),new Fa(r,a,t,o,n);case"sequenceExpr":return function(e,t){var n=Ea(e,"*").map((function(e){return cs(e,t)}));return 1===n.length?n[0]:(n=Aa(e,"type"),new Yo(Ea(e,"*").map((function(e){return cs(e,t)})),n))}(e,t);case"unionOp":return n=Aa(e,"type"),new ei([cs(ba(e,["firstOperand","*"]),us(t)),cs(ba(e,["secondOperand","*"]),us(t))],n);case"exceptOp":case"intersectOp":return n=Aa(e,"type"),new Vo(e[0],cs(ba(e,["firstOperand","*"]),us(t)),cs(ba(e,["secondOperand","*"]),us(t)),n);case"stringConcatenateOp":return function(e,t){var n=Aa(e,"type");return new Er(new Io({localName:"concat",namespaceURI:"http://www.w3.org/2005/xpath-functions",prefix:""},(e=[ba(e,["firstOperand","*"]),ba(e,["secondOperand","*"])]).length,n),e.map((function(e){return cs(e,us(t))})),n)}(e,t);case"rangeSequenceExpr":return function(e,t){var n=Aa(e,"type");return new Er(new Io({localName:"to",namespaceURI:"http://fontoxpath/operators",prefix:""},(e=[wa(wa(e,"startExpr"),"*"),wa(wa(e,"endExpr"),"*")]).length,n),e.map((function(e){return cs(e,us(t))})),n)}(e,t);case"equalOp":case"notEqualOp":case"lessThanOrEqualOp":case"lessThanOp":case"greaterThanOrEqualOp":case"greaterThanOp":return fs("generalCompare",e,t);case"eqOp":case"neOp":case"ltOp":case"leOp":case"gtOp":case"geOp":return fs("valueCompare",e,t);case"isOp":case"nodeBeforeOp":case"nodeAfterOp":return fs("nodeCompare",e,t);case"pathExpr":return function(e,t){var n=Aa(e,"type"),r=Ea(e,"stepExpr"),a=!1,o=r.map((function(e){for(var r=wa(e,"xpathAxis"),o=Ea(e,"*"),i=[],s=null,u=(o=c(o)).next();!u.done;u=o.next())switch(u=u.value,u[0]){case"lookup":i.push(["lookup",hs(u,t)]);break;case"predicate":case"predicates":for(var l=(u=c(Ea(u,"*"))).next();!l.done;l=u.next())s=ao(s,(l=cs(l.value,us(t))).A()),i.push(["predicate",l])}if(r)switch(a=!0,e=wa(e,"attributeTest anyElementTest piTest documentTest elementTest commentTest namespaceTest anyKindTest textTest anyFunctionTest typedFunctionTest schemaAttributeTest atomicType anyItemType parenthesizedItemType typedMapTest typedArrayTest nameTest Wildcard".split(" ")),e=ls(e),xa(r)){case"ancestor":var p=new no(e,{Oa:!1});break;case"ancestor-or-self":p=new no(e,{Oa:!0});break;case"attribute":p=new oo(e,s);break;case"child":p=new io(e,s);break;case"descendant":p=new uo(e,{Oa:!1});break;case"descendant-or-self":p=new uo(e,{Oa:!0});break;case"parent":p=new fo(e,s);break;case"following-sibling":p=new ho(e,s);break;case"preceding-sibling":p=new go(e,s);break;case"following":p=new po(e);break;case"preceding":p=new mo(e);break;case"self":p=new yo(e,s)}else p=cs(p=ba(e,["filterExpr","*"]),us(t));for(r=(i=c(i)).next();!r.done;r=i.next())switch(r=r.value,r[0]){case"lookup":p=new ci(p,r[1]);break;case"predicate":p=new ii(p,r[1])}return p.type=n,p}));return e=wa(e,"rootExpr"),!(r=a||null!==e||1"),Ws=Es.token("/>"),$s=Es.token(""),ru=Es.token("&#x"),au=Es.token("&#"),ou=Es.token(":*"),iu=Es.token("*:"),su=Es.token(":="),uu=Es.token("&"),cu=Es.token(":"),lu=Es.token(";"),pu=Es.token("*"),hu=Es.token("@"),fu=Es.token("$"),du=Es.token("#"),mu=Es.token("%"),gu=Es.token("?"),yu=Es.token("!"),vu=Es.token("|"),wu=Es.token("||"),xu=Es.token("="),Au=Es.token("!="),bu=Es.token("<"),Eu=Es.token("<<"),Nu=Es.token("<="),Bu=Es.token(">"),Tu=Es.token(">>"),Iu=Es.token(">="),Cu=Es.token(","),Su=Es.token("."),Ou=Es.token(".."),Ru=Es.token("+"),Du=Es.token("-"),Uu=Es.token("/"),Mu=Es.token("//"),Gu=Es.token("=>"),ku=Es.token("e"),Fu=Es.token("E"),Pu=Es.token("l"),Hu=Es.token("L"),ju=Es.token("m"),Xu=Es.token("M"),_u=Es.token("Q"),Lu=Es.token("x"),Vu=Es.token("X"),Yu=Es.token("as"),qu=Es.token("cast"),Qu=Es.token("castable"),Ju=Es.token("treat"),Ku=Es.token("instance"),zu=Es.token("of"),Wu=Es.token("node"),$u=Es.token("nodes"),Zu=Es.token("delete"),ec=Es.token("value"),tc=Es.token("function"),nc=Es.token("map"),rc=Es.token("element"),ac=Es.token("attribute"),oc=Es.token("schema-element"),ic=Es.token("intersect"),sc=Es.token("except"),uc=Es.token("union"),cc=Es.token("to"),lc=Es.token("is"),pc=Es.token("or"),hc=Es.token("and"),fc=Es.token("div"),dc=Es.token("idiv"),mc=Es.token("mod"),gc=Es.token("eq"),yc=Es.token("ne"),vc=Es.token("lt"),wc=Es.token("le"),xc=Es.token("gt"),Ac=Es.token("ge"),bc=Es.token("amp"),Ec=Es.token("quot"),Nc=Es.token("apos"),Bc=Es.token("if"),Tc=Es.token("then"),Ic=Es.token("else"),Cc=Es.token("allowing"),Sc=Es.token("empty"),Oc=Es.token("at"),Rc=Es.token("in"),Dc=Es.token("for"),Uc=Es.token("let"),Mc=Es.token("where"),Gc=Es.token("collation"),kc=Es.token("group"),Fc=Es.token("by"),Pc=Es.token("order"),Hc=Es.token("stable"),jc=Es.token("return"),Xc=Es.token("array"),_c=Es.token("document"),Lc=Es.token("namespace"),Vc=Es.token("text"),Yc=Es.token("comment"),qc=Es.token("processing-instruction"),Qc=Es.token("lax"),Jc=Es.token("strict"),Kc=Es.token("validate"),zc=Es.token("type"),Wc=Es.token("declare"),$c=Es.token("default"),Zc=Es.token("boundary-space"),el=Es.token("strip"),tl=Es.token("preserve"),nl=Es.token("no-preserve"),rl=Es.token("inherit"),al=Es.token("no-inherit"),ol=Es.token("greatest"),il=Es.token("least"),sl=Es.token("copy-namespaces"),ul=Es.token("decimal-format"),cl=Es.token("case"),ll=Es.token("typeswitch"),pl=Es.token("some"),hl=Es.token("every"),fl=Es.token("satisfies"),dl=Es.token("replace"),ml=Es.token("with"),gl=Es.token("copy"),yl=Es.token("modify"),vl=Es.token("first"),wl=Es.token("last"),xl=Es.token("before"),Al=Es.token("after"),bl=Es.token("into"),El=Es.token("insert"),Nl=Es.token("rename"),Bl=Es.token("switch"),Tl=Es.token("variable"),Il=Es.token("external"),Cl=Es.token("updating"),Sl=Es.token("import"),Ol=Es.token("schema"),Rl=Es.token("module"),Dl=Es.token("base-uri"),Ul=Es.token("construction"),Ml=Es.token("ordering"),Gl=Es.token("ordered"),kl=Es.token("unordered"),Fl=Es.token("option"),Pl=Es.token("context"),Hl=Es.token("item"),jl=Es.token("xquery"),Xl=Es.token("version"),_l=Es.token("encoding"),Ll=Es.token("document-node"),Vl=Es.token("namespace-node"),Yl=Es.token("schema-attribute"),ql=Es.token("ascending"),Ql=Es.token("descending"),Jl=Es.token("empty-sequence"),Kl=Es.token("child::"),zl=Es.token("descendant::"),Wl=Es.token("attribute::"),$l=Es.token("self::"),Zl=Es.token("descendant-or-self::"),ep=Es.token("following-sibling::"),tp=Es.token("following::"),np=Es.token("parent::"),rp=Es.token("ancestor::"),ap=Es.token("preceding-sibling::"),op=Es.token("preceding::"),ip=Es.token("ancestor-or-self::"),sp=Es.token("decimal-separator"),up=Es.token("grouping-separator"),cp=Es.token("infinity"),lp=Es.token("minus-sign"),pp=Es.token("NaN"),hp=Es.token("per-mille"),fp=Es.token("zero-digit"),dp=Es.token("digit"),mp=Es.token("pattern-separator"),gp=Es.token("exponent-separator"),yp=Es.token("schema-attribute("),vp=Es.token("document-node("),wp=Es.token("processing-instruction("),xp=Es.token("processing-instruction()"),Ap=Es.token("comment()"),bp=Es.token("text()"),Ep=Es.token("namespace-node()"),Np=Es.token("node()"),Bp=Es.token("item()"),Tp=Es.token("empty-sequence()"),Ip=new Map,Cp=new Map,Sp=Es.or([Rs(/[\t\n\r -\uD7FF\uE000\uFFFD]/),Rs(/[\uD800-\uDBFF][\uDC00-\uDFFF]/)]),Op=Es.preceded(Es.peek(Es.not(Es.or([Us,Ms]),['comment contents cannot contain "(:" or ":)"'])),Sp),Rp=Es.map(Es.delimited(Us,Es.star(Es.or([Op,function(e,t){return Rp(e,t)}])),Ms),(function(e){return e.join("")})),Dp=Es.or([Ds,Rp]),Up=Es.map(Es.plus(Ds),(function(e){return e.join("")})),Mp=Ns(Es.map(Es.star(Dp),(function(e){return e.join("")})),Ip),Gp=Ns(Es.map(Es.plus(Dp),(function(e){return e.join("")})),Cp),kp=Es.or([Rs(/[A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/),Es.then(Rs(/[\uD800-\uDB7F]/),Rs(/[\uDC00-\uDFFF]/),(function(e,t){return e+t}))]),Fp=Es.or([kp,Rs(/[\-\.0-9\xB7\u0300-\u036F\u203F\u2040]/)]),Pp=Es.then(kp,Es.star(Fp),(function(e,t){return e+t.join("")})),Hp=Es.map(Pp,(function(e){return["prefix",e]})),jp=Es.or([kp,cu]),Xp=Es.or([Fp,cu]),_p=Es.then(jp,Es.star(Xp),(function(e,t){return e+t.join("")})),Lp=Es.map(Pp,(function(e){var t={};return[(t.prefix="",t.URI=null,t),e]})),Vp=Es.then(Pp,Es.preceded(cu,Pp),(function(e,t){var n={};return[(n.prefix=e,n.URI=null,n),t]})),Yp=Es.or([Vp,Lp]),qp=Es.followed(Ts([_u,Mp,Xs],Es.map(Es.star(Rs(/[^{}]/)),(function(e){return e.join("").replace(/\s+/g," ").trim()}))),_s),Qp=Es.then(qp,Pp,(function(e,t){return[e,t]})),Jp=Es.or([Es.map(Qp,(function(e){var t={};return[(t.prefix=null,t.URI=e[0],t),e[1]]})),Yp]),Kp=Es.or([Es.map(Jp,(function(e){return["QName"].concat(p(e))})),Es.map(pu,(function(){return["star"]}))]),zp=Es.map(Es.preceded(fu,Jp),(function(e){return["varRef",["name"].concat(p(e))]})),Wp=Es.peek(Es.or([Fs,Qs,Ys,Dp])),$p=Es.map(Es.or([Kl,zl,Wl,$l,Zl,ep,tp]),(function(e){return e.substring(0,e.length-2)})),Zp=Es.map(Es.or([np,rp,ap,op,ip]),(function(e){return e.substring(0,e.length-2)})),eh=Is(uu,Es.or([vc,xc,bc,Ec,Nc]),lu,(function(e,t,n){return e+t+n})),th=Es.or([Is(ru,Rs(/[0-9a-fA-F]+/),lu,(function(e,t,n){return e+t+n})),Is(au,Rs(/[0-9]+/),lu,(function(e,t,n){return e+t+n}))]),nh=Os([Js],'"'),rh=Os([qs],"'"),ah=Ss(Os([Ap],"commentTest")),oh=Ss(Os([bp],"textTest")),ih=Ss(Os([Ep],"namespaceTest")),sh=Ss(Os([Np],"anyKindTest")),uh=Rs(/[0-9]+/),ch=Es.then(Es.or([Es.then(Su,uh,(function(e,t){return e+t})),Es.then(uh,Es.optional(Es.preceded(Su,Rs(/[0-9]*/))),(function(e,t){return e+(null!==t?"."+t:"")}))]),Is(Es.or([ku,Fu]),Es.optional(Es.or([Ru,Du])),uh,(function(e,t,n){return e+(t||"")+n})),(function(e,t){return["doubleConstantExpr",["value",e+t]]})),lh=Es.or([Es.map(Es.preceded(Su,uh),(function(e){return["decimalConstantExpr",["value","."+e]]})),Es.then(Es.followed(uh,Su),Es.optional(uh),(function(e,t){return["decimalConstantExpr",["value",e+"."+(null!==t?t:"")]]}))]),ph=Es.map(uh,(function(e){return["integerConstantExpr",["value",e]]})),hh=Es.followed(Es.or([ch,lh,ph]),Es.peek(Es.not(Rs(/[a-zA-Z]/),["no alphabetical characters after numeric literal"]))),fh=Es.map(Es.followed(Su,Es.peek(Es.not(Su,["context item should not be followed by another ."]))),(function(){return["contextItemExpr"]})),dh=Es.or([Xc,ac,Yc,Ll,rc,Jl,tc,Bc,Hl,nc,Vl,Wu,qc,Yl,oc,Bl,Vc,ll]),mh=Ss(Os([gu],"argumentPlaceholder")),gh=Es.or([gu,pu,Ru]),yh=Es.preceded(Es.peek(Es.not(Rs(/[{}<&]/),["elementContentChar cannot be {, }, <, or &"])),Sp),vh=Es.map(Es.delimited(Ks,Es.star(Es.preceded(Es.peek(Es.not(zs,['CDataSection content may not contain "]]>"'])),Sp)),zs),(function(e){return["CDataSection",e.join("")]})),wh=Es.preceded(Es.peek(Es.not(Rs(/["{}<&]/),['quotAttrValueContentChar cannot be ", {, }, <, or &'])),Sp),xh=Es.preceded(Es.peek(Es.not(Rs(/['{}<&]/),["aposAttrValueContentChar cannot be ', {, }, <, or &"])),Sp),Ah=Es.map(Es.star(Es.or([Es.preceded(Es.peek(Es.not(Du,[])),Sp),Es.map(Ts([Du,Es.peek(Es.not(Du,[]))],Sp),(function(e){return"-"+e}))])),(function(e){return e.join("")})),bh=Es.map(Es.delimited(Zs,Ah,eu),(function(e){return["computedCommentConstructor",["argExpr",["stringConstantExpr",["value",e]]]]})),Eh=Es.preceded(Es.peek(Es.not(Is(Es.or([Vu,Lu]),Es.or([Xu,ju]),Es.or([Hu,Pu]),(function(){return[]})),[])),_p),Nh=Es.map(Es.star(Es.preceded(Es.peek(Es.not(nu,[])),Sp)),(function(e){return e.join("")})),Bh=Es.then(Es.preceded(tu,Eh),Es.followed(Es.optional(Es.preceded(Up,Nh)),nu),(function(e,t){return["computedPIConstructor",["piTarget",e],["piValueExpr",["stringConstantExpr",["value",t]]]]})),Th=Es.map(Mu,(function(){return["stepExpr",["xpathAxis","descendant-or-self"],["anyKindTest"]]})),Ih=Es.or([Qc,Jc]),Ch=Es.map(Es.star(Es.followed(Sp,Es.peek(Es.not(ks,["Pragma contents should not contain '#)'"])))),(function(e){return e.join("")})),Sh=Es.map(Es.followed(Es.or([gc,yc,vc,wc,xc,Ac]),Wp),(function(e){return e+"Op"})),Oh=Es.or([Es.followed(Os([lc],"isOp"),Wp),Os([Eu],"nodeBeforeOp"),Os([Tu],"nodeAfterOp")]),Rh=Es.or([Os([xu],"equalOp"),Os([Au],"notEqualOp"),Os([Nu],"lessThanOrEqualOp"),Os([bu],"lessThanOp"),Os([Iu],"greaterThanOrEqualOp"),Os([Bu],"greaterThanOp")]),Dh=Es.map(Cl,(function(){return["annotation",["annotationName","updating"]]})),Uh=Es.or([tl,nl]),Mh=Es.or([rl,al]),Gh=Es.or([sp,up,cp,lp,pp,mu,hp,fp,dp,mp,gp]),kh=Es.map(Ts([Wc,Gp,Zc,Gp],Es.or([tl,el])),(function(e){return["boundarySpaceDecl",e]})),Fh=Es.map(Ts([Wc,Gp,Ul,Gp],Es.or([tl,el])),(function(e){return["constructionDecl",e]})),Ph=Es.map(Ts([Wc,Gp,Ml,Gp],Es.or([Gl,kl])),(function(e){return["orderingModeDecl",e]})),Hh=Es.map(Ts([Wc,Gp,$c,Gp,Pc,Gp,Sc,Gp],Es.or([ol,il])),(function(e){return["emptyOrderDecl",e]})),jh=Es.then(Ts([Wc,Gp,sl,Gp],Uh),Ts([Mp,Cu,Mp],Mh),(function(e,t){return["copyNamespacesDecl",["preserveMode",e],["inheritMode",t]]}));function Xh(e){switch(e[0]){case"constantExpr":case"varRef":case"contextItemExpr":case"functionCallExpr":case"sequenceExpr":case"elementConstructor":case"computedElementConstructor":case"computedAttributeConstructor":case"computedDocumentConstructor":case"computedTextConstructor":case"computedCommentConstructor":case"computedNamespaceConstructor":case"computedPIConstructor":case"orderedExpr":case"unorderedExpr":case"namedFunctionRef":case"inlineFunctionExpr":case"dynamicFunctionInvocationExpr":case"mapConstructor":case"arrayConstructor":case"stringConstructor":case"unaryLookup":return e}return["sequenceExpr",e]}function _h(e){if(!(1<=e&&55295>=e||57344<=e&&65533>=e||65536<=e&&1114111>=e))throw Error("XQST0090: The character reference "+e+" ("+e.toString(16)+") does not reference a valid codePoint.")}function Lh(e){return e.replace(/(&[^;]+);/g,(function(e){if(/^&#x/.test(e))return _h(e=parseInt(e.slice(3,-1),16)),String.fromCodePoint(e);if(/^&#/.test(e))return _h(e=parseInt(e.slice(2,-1),10)),String.fromCodePoint(e);switch(e){case"<":return"<";case">":return">";case"&":return"&";case""":return String.fromCharCode(34);case"'":return String.fromCharCode(39)}throw Error('XPST0003: Unknown character reference: "'+e+'"')}))}function Vh(e,t,n){if(!e.length)return[];for(var r=[e[0]],a=1;a=t+n?W:(e=a.next(e),r++,e)}},o)}function pf(e){return e.map((function(e){return Z(e.type,19)?Kt(e,3):e}))}function hf(e){if((e=pf(e)).some((function(e){return Number.isNaN(e.value)})))return[q(NaN,3)];if(!(e=ti(e)))throw Error("FORG0006: Incompatible types to be converted to a common type");return e}function ff(e,t,n,r,a,o){return _e([a,o],(function(e){var t=c(e);if(e=t.next().value,t=t.next().value,1/0===e.value)return ue.empty();if(-1/0===e.value)return t&&1/0===t.value?ue.empty():r;if(t){if(isNaN(t.value))return ue.empty();1/0===t.value&&(t=null)}return isNaN(e.value)?ue.empty():lf(r,Math.round(e.value),t?Math.round(t.value):null)}))}function df(e,t,n,r,a){if(r.G())return a;if(!(e=ti(e=pf(r.N()))))throw Error("FORG0006: Incompatible types to be converted to a common type");if(!e.every((function(e){return Z(e.type,2)})))throw Error("FORG0006: items passed to fn:sum are not all numeric.");return t=e.reduce((function(e,t){return e+t.value}),0),e.every((function(e){return Z(e.type,5)}))?ue.o(q(t,5)):e.every((function(e){return Z(e.type,3)}))?ue.o(q(t,3)):e.every((function(e){return Z(e.type,4)}))?ue.o(q(t,4)):ue.o(q(t,6))}var mf=[].concat(Sr,[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"boolean",l:[{type:59,g:2}],i:{type:0,g:3},m:function(e,t,n,r){return r.getEffectiveBooleanValue()?ue.ca():ue.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"true",l:[],i:{type:0,g:3},m:function(){return ue.ca()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"not",l:[{type:59,g:2}],i:{type:0,g:3},m:function(e,t,n,r){return!1===r.getEffectiveBooleanValue()?ue.ca():ue.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"false",l:[],i:{type:0,g:3},m:function(){return ue.X()}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"last",l:[],i:{type:5,g:3},m:function(e){if(null===e.M)throw Error("XPDY0002: The fn:last() function depends on dynamic context, which is absent.");var t=!1;return ue.create({next:function(){if(t)return W;var n=e.Ga.Na();return t=!0,$(q(n,5))}},1)}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"position",l:[],i:{type:5,g:3},m:function(e){if(null===e.M)throw Error("XPDY0002: The fn:position() function depends on dynamic context, which is absent.");return ue.o(q(e.Ja+1,5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-dateTime",l:[],i:{type:10,g:3},m:function(e){return ue.o(q(xt(e),10))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-date",l:[],i:{type:7,g:3},m:function(e){return ue.o(q(it(xt(e),7),7))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-time",l:[],i:{type:8,g:3},m:function(e){return ue.o(q(it(xt(e),8),8))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"implicit-timezone",l:[],i:{type:17,g:3},m:function(e){return ue.o(q(At(e),17))}}],Rr,Hr,Xr,[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"years-from-duration",l:[{type:18,g:0}],i:{type:5,g:0},m:function(e,t,n,r){return r.G()?r:ue.o(q(r.first().value.cb(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"months-from-duration",l:[{type:18,g:0}],i:{type:5,g:0},m:function(e,t,n,r){return r.G()?r:ue.o(q(r.first().value.$a(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"days-from-duration",l:[{type:18,g:0}],i:{type:5,g:0},m:function(e,t,n,r){return r.G()?r:ue.o(q(r.first().value.Za(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"hours-from-duration",l:[{type:18,g:0}],i:{type:5,g:0},m:function(e,t,n,r){return r.G()?r:ue.o(q(r.first().value.getHours(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"minutes-from-duration",l:[{type:18,g:0}],i:{type:5,g:0},m:function(e,t,n,r){return r.G()?r:ue.o(q(r.first().value.getMinutes(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"seconds-from-duration",l:[{type:18,g:0}],i:{type:4,g:0},m:function(e,t,n,r){return r.G()?r:ue.o(q(r.first().value.getSeconds(),4))}}],Lr,[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"id",l:[{type:1,g:2},{type:53,g:3}],i:{type:54,g:2},m:sf},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"id",l:[{type:1,g:2}],i:{type:54,g:2},m:function(e,t,n,r){return sf(e,t,0,r,ue.o(e.M))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"idref",l:[{type:1,g:2},{type:53,g:3}],i:{type:53,g:2},m:uf},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"idref",l:[{type:1,g:2}],i:{type:53,g:2},m:function(e,t,n,r){return uf(e,t,0,r,ue.o(e.M))}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"parse-json",l:[{type:1,g:3}],i:{type:59,g:0},m:function(e,t,n,r){try{var a=JSON.parse(r.first().value)}catch(e){throw Error("FOJS0001: parsed JSON string contains illegal JSON.")}return function e(t){switch(typeof t){case"object":return Array.isArray(t)?ue.o(new He(t.map((function(t){return ce(e(t))})))):null===t?ue.empty():ue.o(new Ye(Object.keys(t).map((function(n){return{key:q(n,1),value:ce(e(t[n]))}}))));case"number":return ue.o(q(t,3));case"string":return ue.o(q(t,1));case"boolean":return t?ue.ca():ue.X();default:throw Error("Unexpected type in JSON parse")}}(a)}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"contains",l:[{type:61,g:3},{type:46,g:3}],i:{type:0,g:3},m:function(e,t,n,r,a){return _e([r,a],(function(e){var t=(e=c(e)).next().value,n=e.next().value;return t.h.some((function(e){return Le(e.key,n)}))?ue.ca():ue.X()}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"entry",l:[{type:46,g:3},{type:59,g:2}],i:{type:61,g:3},m:function(e,t,n,r,a){return r.map((function(e){return new Ye([{key:e,value:ce(a)}])}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"for-each",l:[{type:61,g:3},{type:59,g:2}],i:{type:59,g:2},m:function(e,t,n,r,a){return _e([r,a],(function(r){var a=(r=c(r)).next().value,o=r.next().value;return Bt(a.h.map((function(r){return o.value.call(void 0,e,t,n,ue.o(r.key),r.value())})))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"get",l:[{type:61,g:3},{type:46,g:3}],i:{type:59,g:2},m:Ve},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"keys",l:[{type:61,g:3}],i:{type:46,g:2},m:function(e,t,n,r){return _e([r],(function(e){return e=c(e).next().value,ue.create(e.h.map((function(e){return e.key})))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"merge",l:[{type:61,g:2},{type:61,g:3}],i:{type:61,g:3},m:cf},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"merge",l:[{type:61,g:2}],i:{type:61,g:3},m:function(e,t,n,r){return cf(e,0,0,r,ue.o(new Ye([{key:q("duplicates",1),value:function(){return ue.o(q("use-first",1))}}])))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"put",l:[{type:61,g:3},{type:46,g:3},{type:59,g:2}],i:{type:61,g:3},m:function(e,t,n,r,a,o){return _e([r,a],(function(e){var t=(e=c(e)).next().value,n=e.next().value;return e=t.h.concat(),0<=(t=e.findIndex((function(e){return Le(e.key,n)})))?e.splice(t,1,{key:n,value:ce(o)}):e.push({key:n,value:ce(o)}),ue.o(new Ye(e))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"remove",l:[{type:61,g:3},{type:46,g:2}],i:{type:61,g:3},m:function(e,t,n,r,a){return _e([r],(function(e){var t=c(e).next().value.h.concat();return a.L((function(e){return e.forEach((function(e){var n=t.findIndex((function(t){return Le(t.key,e)}));0<=n&&t.splice(n,1)})),ue.o(new Ye(t))}))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"size",l:[{type:61,g:3}],i:{type:5,g:3},m:function(e,t,n,r){return r.map((function(e){return q(e.h.length,5)}))}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"pi",l:[],i:{type:3,g:3},m:function(){return ue.o(q(Math.PI,3))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"exp",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.pow(Math.E,e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"exp10",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.pow(10,e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"log",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.log(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"log10",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.log10(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"pow",l:[{type:3,g:0},{type:2,g:3}],i:{type:3,g:0},m:function(e,t,n,r,a){return a.L((function(e){var t=c(e).next().value;return r.map((function(e){return 1!==Math.abs(e.value)||Number.isFinite(t.value)?q(Math.pow(e.value,t.value),3):q(1,3)}))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"sqrt",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.sqrt(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"sin",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.sin(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"cos",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.cos(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"tan",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.tan(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"asin",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.asin(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"acos",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.acos(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"atan",l:[{type:3,g:0}],i:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.atan(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"atan2",l:[{type:3,g:0},{type:3,g:3}],i:{type:3,g:0},m:function(e,t,n,r,a){return a.L((function(e){var t=c(e).next().value;return r.map((function(e){return q(Math.atan2(e.value,t.value),3)}))}))}}],Fn,dn,[{namespaceURI:"http://fontoxpath/operators",localName:"to",l:[{type:5,g:0},{type:5,g:0}],i:{type:5,g:2},m:function(e,t,n,r,a){if(e=r.first(),a=a.first(),null===e||null===a)return ue.empty();var o=e.value;return a=a.value,o>a?ue.empty():ue.create({next:function(){return $(q(o++,5))}},a-o+1)}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"QName",l:[{type:1,g:0},{type:1,g:3}],i:{type:23,g:3},m:function(e,t,n,r,a){return _e([r,a],(function(e){var t=c(e);if(e=t.next().value,!Mt(t=t.next().value.value,23))throw Error("FOCA0002: The provided QName is invalid.");if(null===(e=e&&e.value||null)&&t.includes(":"))throw Error("FOCA0002: The URI of a QName may not be empty if a prefix is provided.");if(r.G())return ue.o(q(new ye("",null,t),23));if(!t.includes(":"))return ue.o(q(new ye("",e,t),23));var n=c(t.split(":"));return t=n.next().value,n=n.next().value,ue.o(q(new ye(t,e,n),23))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"prefix-from-QName",l:[{type:23,g:0}],i:{type:24,g:0},m:function(e,t,n,r){return _e([r],(function(e){return null===(e=c(e).next().value)?ue.empty():(e=e.value).prefix?ue.o(q(e.prefix,24)):ue.empty()}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"local-name-from-QName",l:[{type:23,g:0}],i:{type:24,g:0},m:function(e,t,n,r){return r.map((function(e){return q(e.value.localName,24)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"namespace-uri-from-QName",l:[{type:23,g:0}],i:{type:20,g:0},m:function(e,t,n,r){return r.map((function(e){return q(e.value.namespaceURI||"",20)}))}}],[{l:[{type:59,g:2}],m:function(e,t,n,r){return r.$({empty:function(){return ue.ca()},multiple:function(){return ue.X()},o:function(){return ue.X()}})},localName:"empty",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[{type:59,g:2}],m:function(e,t,n,r){return r.$({empty:function(){return ue.X()},multiple:function(){return ue.ca()},o:function(){return ue.ca()}})},localName:"exists",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[{type:59,g:2}],m:function(e,t,n,r){return lf(r,1,1)},localName:"head",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:0}},{l:[{type:59,g:2}],m:function(e,t,n,r){return lf(r,2,null)},localName:"tail",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:5,g:3},{type:59,g:2}],m:function(e,t,n,r,a,o){return r.G()?o:o.G()?r:(e=r.N(),0>(a=a.first().value-1)?a=0:a>e.length&&(a=e.length),t=e.slice(a),ue.create(e.slice(0,a).concat(o.N(),t)))},localName:"insert-before",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:5,g:3}],m:function(e,t,n,r,a){return e=a.first().value,!(r=r.N()).length||1>e||e>r.length||r.splice(e-1,1),ue.create(r)},localName:"remove",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2}],m:function(e,t,n,r){return r.L((function(e){return ue.create(e.reverse())}))},localName:"reverse",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:3,g:3}],m:function(e,t,n,r,a){return ff(0,0,0,r,a,ue.empty())},localName:"subsequence",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:3,g:3},{type:3,g:3}],m:ff,localName:"subsequence",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2}],m:function(e,t,n,r){return r},localName:"unordered",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:46,g:2}],m:function(e,t,n,r){var a=Rt(r,t).N();return ue.create(a).filter((function(e,t){return a.slice(0,t).every((function(t){return!jn(e,t)}))}))},localName:"distinct-values",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:2}},{l:[{type:46,g:2},{type:1,g:3}],m:function(){throw Error("FOCH0002: No collations are supported")},localName:"distinct-values",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:2}},{l:[{type:46,g:2},{type:46,g:3}],m:function(e,t,n,r,a){return a.L((function(n){var a=c(n).next().value;return Rt(r,t).map((function(t,n){return ko("eqOp",t.type,a.type)(t,a,e)?q(n+1,5):q(-1,5)})).filter((function(e){return-1!==e.value}))}))},localName:"index-of",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:5,g:2}},{l:[{type:46,g:2},{type:46,g:3},{type:1,g:3}],m:function(){throw Error("FOCH0002: No collations are supported")},localName:"index-of",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:5,g:2}},{l:[{type:59,g:2},{type:59,g:2}],m:function(e,t,n,r,a){var o=!1,i=Ln(e,t,n,r,a);return ue.create({next:function(){if(o)return W;var e=i.next(0);return e.done?e:(o=!0,$(q(e.value,0)))}})},localName:"deep-equal",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[{type:59,g:2},{type:59,g:2},{type:1,g:3}],m:function(){throw Error("FOCH0002: No collations are supported")},localName:"deep-equal",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[{type:59,g:2}],m:function(e,t,n,r){var a=!1;return ue.create({next:function(){if(a)return W;var e=r.Na();return a=!0,$(q(e,5))}})},localName:"count",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:5,g:3}},{l:[{type:46,g:2}],m:function(e,t,n,r){if(r.G())return r;if(!(e=ti(e=pf(r.N()))))throw Error("FORG0006: Incompatible types to be converted to a common type");if(!e.every((function(e){return Z(e.type,2)})))throw Error("FORG0006: items passed to fn:avg are not all numeric.");return t=e.reduce((function(e,t){return e+t.value}),0)/e.length,e.every((function(e){return Z(e.type,5)||Z(e.type,3)}))?ue.o(q(t,3)):e.every((function(e){return Z(e.type,4)}))?ue.o(q(t,4)):ue.o(q(t,6))},localName:"avg",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:0}},{l:[{type:46,g:2}],m:function(e,t,n,r){return r.G()?r:(e=hf(r.N()),ue.o(e.reduce((function(e,t){return e.valuet.value?t:e}))))},localName:"min",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:0}},{l:[{type:46,g:2},{type:1,g:3}],m:function(){throw Error("FOCH0002: No collations are supported")},localName:"min",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:0}},{l:[{type:46,g:2}],m:function(e,t,n,r){return df(e,t,0,r,ue.o(q(0,5)))},localName:"sum",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:3}},{l:[{type:46,g:2},{type:46,g:0}],m:df,localName:"sum",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:0}},{l:[{type:59,g:2}],m:function(e,t,n,r){if(!r.G()&&!r.ya())throw Error("FORG0003: The argument passed to fn:zero-or-one contained more than one item.");return r},localName:"zero-or-one",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:0}},{l:[{type:59,g:2}],m:function(e,t,n,r){if(r.G())throw Error("FORG0004: The argument passed to fn:one-or-more was empty.");return r},localName:"one-or-more",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:1}},{l:[{type:59,g:2}],m:function(e,t,n,r){if(!r.ya())throw Error("FORG0005: The argument passed to fn:exactly-one is empty or contained more than one item.");return r},localName:"exactly-one",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:3}},{l:[{type:59,g:2},{type:60,g:3}],m:function(e,t,n,r,a){if(r.G())return r;var o=a.first(),i=o.s;if(1!==i.length)throw Error("XPTY0004: signature of function passed to fn:filter is incompatible.");return r.filter((function(r){if(r=cn(i[0],ue.o(r),t,"fn:filter",!1),!(r=o.value.call(void 0,e,t,n,r)).ya()||!Z(r.first().type,0))throw Error("XPTY0004: signature of function passed to fn:filter is incompatible.");return r.first().value}))},localName:"filter",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:60,g:3}],m:function(e,t,n,r,a){if(r.G())return r;var o=a.first(),i=o.s;if(1!==i.length)throw Error("XPTY0004: signature of function passed to fn:for-each is incompatible.");var s,u=r.value;return ue.create({next:function(r){for(;;){if(!s){var a=u.next(0);if(a.done)return a;a=cn(i[0],ue.o(a.value),t,"fn:for-each",!1),s=o.value.call(void 0,e,t,n,a).value}if(!(a=s.next(r)).done)return a;s=null}}})},localName:"for-each",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:59,g:2},{type:60,g:3}],m:function(e,t,n,r,a,o){if(r.G())return r;var i=o.first(),s=i.s;if(2!==s.length)throw Error("XPTY0004: signature of function passed to fn:fold-left is incompatible.");return r.L((function(r){return r.reduce((function(r,a){return r=cn(s[0],r,t,"fn:fold-left",!1),a=cn(s[1],ue.o(a),t,"fn:fold-left",!1),i.value.call(void 0,e,t,n,r,a)}),a)}))},localName:"fold-left",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:59,g:2},{type:60,g:3}],m:function(e,t,n,r,a,o){if(r.G())return r;var i=o.first(),s=i.s;if(2!==s.length)throw Error("XPTY0004: signature of function passed to fn:fold-right is incompatible.");return r.L((function(r){return r.reduceRight((function(r,a){return r=cn(s[0],r,t,"fn:fold-right",!1),a=cn(s[1],ue.o(a),t,"fn:fold-right",!1),i.value.call(void 0,e,t,n,a,r)}),a)}))},localName:"fold-right",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2}],m:function(e,t,n,r){if(!t.j)throw Error("serialize() called but no xmlSerializer set in execution parameters.");if(!(e=r.N()).every((function(e){return Z(e.type,53)})))throw Error("Expected argument to fn:serialize to resolve to a sequence of Nodes.");return ue.o(q(e.map((function(e){return t.j.serializeToString(Ai(e.value,t,!1))})),1))},localName:"serialize",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}}],Tn,[{l:[{type:59,g:3},{type:61,g:3}],m:function(e,t,n,r,a){var o,i;return ue.create({next:function(){if(!o){var e=function(e,t,n,r){e=e.first();var a=t.first().h.reduce((function(e,t){return e[t.key.value]=ce(t.value()),e}),Object.create(null));t=a["."]?a["."]():ue.empty(),delete a["."];try{if(Z(e.type,1))var o=e.value;else{if(!Z(e.type,54))throw It("Unable to convert selector argument of type "+he[e.type]+" to either an "+he[1]+" or an "+he[54]+" representing an XQueryX program while calling 'fontoxpath:evaluate'");o=e.value.node}var i=af(o,{qa:!1,aa:!0,debug:r.debug,Ha:r.Ha},(function(e){return n.ba(e)}),Object.keys(a).reduce((function(e,t){return e[t]=t,e}),{}),{},"http://www.w3.org/2005/xpath-functions",(function(e,t){return n.Ra(e,t)})),s=i.da,u=i.ia,c=!t.G(),l=new vt({M:c?t.first():null,Ja:c?0:-1,Ga:t,Ea:Object.keys(a).reduce((function(e,t){return e[u.qb(null,t)]=a[t],e}),Object.create(null))});return{Gc:s.h(l,r).value,Dc:e}}catch(t){qr(e.value,t)}}(r,a,n,t);o=e.Gc,i=e.Dc}try{return o.next(0)}catch(e){qr(i.value,e)}}})},localName:"evaluate",namespaceURI:"http://fontoxml.com/fontoxpath",i:{type:59,g:2}},{l:[],m:function(){return ue.o(q("3.25.1",1))},localName:"version",namespaceURI:"http://fontoxml.com/fontoxpath",i:{type:1,g:3}}],[{l:[{type:23,g:3},{type:5,g:3}],m:function(e,t,n,r,a){return _e([r,a],(function(e){var t=c(e);e=t.next().value,t=t.next().value;var r=n.za(e.value.namespaceURI,e.value.localName,t.value);return null===r?ue.empty():(e=new ve({l:r.l,arity:t.value,localName:e.value.localName,namespaceURI:e.value.namespaceURI,i:r.i,value:r.m}),ue.o(e))}))},localName:"function-lookup",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{g:0,type:60}},{l:[{type:60,g:3}],m:function(e,t,n,r){return _e([r],(function(e){return(e=c(e).next().value).Pa()?ue.empty():ue.o(q(new ye("",e.u,e.j),23))}))},localName:"function-name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:23,g:0}},{l:[{type:60,g:3}],m:function(e,t,n,r){return _e([r],(function(e){return e=c(e).next().value,ue.o(q(e.A,5))}))},localName:"function-arity",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:5,g:3}}]);function gf(e){this.h=e}(r=gf.prototype).createAttributeNS=function(e,t){return this.h.createAttributeNS(e,t)},r.createCDATASection=function(e){return this.h.createCDATASection(e)},r.createComment=function(e){return this.h.createComment(e)},r.createDocument=function(){return this.h.createDocument()},r.createElementNS=function(e,t){return this.h.createElementNS(e,t)},r.createProcessingInstruction=function(e,t){return this.h.createProcessingInstruction(e,t)},r.createTextNode=function(e){return this.h.createTextNode(e)};var yf=Symbol("IS_XPATH_VALUE_SYMBOL");function vf(e){return e&&"object"==typeof e&&"lookupNamespaceURI"in e?function(t){return e.lookupNamespaceURI(t||null)}:function(){return null}}function wf(e){return function(t){var n=t.localName;return t.prefix?null:{namespaceURI:e,localName:n}}}function xf(e,t,n,r,a,o){var i,s,u,l,p,h,f;null==r&&(r=r||{}),a?(i=a.logger||{trace:console.log.bind(console)},s=a.documentWriter,u=a.moduleImports,l=a.namespaceResolver,p=a.functionNameResolver,h=a.nodesFactory,f=a.xmlSerializer):(i={trace:console.log.bind(console)},u={},l=null,h=null,s=null,f=null,p=void 0);var d=new Ce(null===n?new be:n);n=u||Object.create(null),u=void 0===a.defaultFunctionNamespaceURI?"http://www.w3.org/2005/xpath-functions":a.defaultFunctionNamespaceURI;var m=af(e,o,l||vf(t),r,n,u,p||wf(u));for(e=t?yt(0,t):ue.empty(),t=!h&&o.aa?new ir(t):new gf(h),s=s?new Be(s):Ne,h=Object.keys(r).reduce((function(e,t){var n=r[t];return e["Q{}"+t+"[0]"]=n&&"object"==typeof n&&yf in n?function(){return ue.create(n.Db)}:function(){return yt(0,r[t])},e}),Object.create(null)),l={},n=(p=c(Object.keys(m.ia.Da))).next();!n.done;l={Wa:l.Wa},n=p.next())l.Wa=n.value,h[l.Wa]||(h[l.Wa]=function(e){return function(){return(0,m.ia.Da[e.Wa])(g,y)}}(l));var g=new vt({M:e.first(),Ja:0,Ga:e,Ea:h}),y=new Nt(o.debug,o.Ha,d,t,s,a.currentContext,i,f);return{xb:g,zb:y,da:m.da}}function Af(e,t){var n={},r=0,a=!1,o=null;return{next:function(){if(a)return W;for(var i={};r {\n\t\t\t\t\tconst result = "+e+".next();\n\t\t\t\t\treturn result.done ? false : !!result.value;\n\t\t\t\t})()",{type:0});case 5:throw Error("Trying to get value of generated code with type None");default:throw Error("Unreachable! Trying to get compiled value of unsupported GeneratedCodeType.")}}Object.assign(Of,(Rf.ANY_TYPE=0,Rf.NUMBER_TYPE=1,Rf.STRING_TYPE=2,Rf.BOOLEAN_TYPE=3,Rf.NODES_TYPE=7,Rf.FIRST_NODE_TYPE=9,Rf.STRINGS_TYPE=10,Rf.MAP_TYPE=11,Rf.ARRAY_TYPE=12,Rf.ASYNC_ITERATOR_TYPE=99,Rf.NUMBERS_TYPE=13,Rf.XQUERY_UPDATE_3_1_LANGUAGE="XQueryUpdate3.1",Rf.XQUERY_3_1_LANGUAGE="XQuery3.1",Rf.XPATH_3_1_LANGUAGE="XPath3.1",Rf));var Pf={DONE_TOKEN:W,getEffectiveBooleanValue:ne,isSubtypeOf:Z,ready:$},Hf={qc:"pathExpr",Ob:"andOp",pc:"orOp",sc:"stringConstantExpr",Sb:"equalOp",nc:"notEqualOp",dc:"lessThanOrEqualOp",cc:"lessThanOp",Yb:"greaterThanOrEqualOp",Xb:"greaterThanOp",Tb:"eqOp",jc:"neOp",fc:"ltOp",ec:"leOp",Zb:"gtOp",Wb:"geOp",ac:"isOp",mc:"nodeBeforeOp",lc:"nodeAfterOp",Vb:"functionCallExpr"},jf=Object.values(Hf);function Xf(e,t,n,r,a){return e=wa(e,n),(e=wa(e,jf))?(t+=n,n=c(r.yb(e,t,r)),r=n.next().value,n=n.next().value,r.isAstAccepted?0===a?[Ff(t,r.code,r.xa),null]:[Gf(t,r.xa,[r.code]),n]:[r,null]):[kf("Unsupported: a base expression used with an operand."),null]}function _f(e,t,n){return 4===t&&(e+=".next().value"),47===n&&(e="(function () { const attr = "+e+"; return attr ? domFacade.getData(attr) : null})()"),e}function Lf(e,t,n,r,a){var o=Aa(wa(e,"firstOperand")[1],"type");if(e=Aa(wa(e,"secondOperand")[1],"type"),!o||!e)return kf("Left or right type of compare are not found, annotation failed.");var i=[47,1];if(!i.includes(o.type)||!i.includes(e.type))return kf("Unsupported types in compare: ["+he[o.type]+", "+he[e.type]+"]");if(!n.isAstAccepted)return n;if(!r.isAstAccepted)return r;if(!o||!e)return kf("Operands in compare weren't annotated");if(!(i=new Map([["eqOp","==="],["neOp","!=="]])).has(t))return kf(t+" not yet implemented");t=i.get(t),i=Mf(n.code,n.xa);var s=Mf(r.code,r.xa);return Gf("function "+a+"(contextItem) {\n\t\t\t\t"+n.ta.join("\n")+"\n\t\t\t \t"+r.ta.join("\n")+"\n\t \t \treturn "+_f(i[0],i[1].type,o.type)+" "+t+" "+_f(s[0],s[1].type,e.type)+";\n\t\t}",{type:3,i:{type:0}})}var Vf={},Yf=(Vf.equalOp="eqOp",Vf.notEqualOp="neOp",Vf.lessThanOrEqualOp="leOp",Vf.lessThanOp="ltOp",Vf.greaterThanOrEqualOp="geOp",Vf.greaterThanOp="gtOp",Vf),qf={"local-name":function(e,t,n){return Kf(e,t,n,Qf,"local-name()")},name:function(e,t,n){return Kf(e,t,n,Jf,"name()")}};function Qf(e){return"("+e+".localName || "+e+".target || '')"}function Jf(e){return"((("+e+".prefix || '').length !== 0 ? "+e+".prefix + ':' : '')\n\t\t+ ("+e+".localName || "+e+".target || ''))"}function Kf(e,t,n,r,a){if(1===(e=wa(e,"arguments")).length)t="function "+t+"(contextItem) {\n\t\t\tif (contextItem === undefined || contextItem === null) {\n\tthrow new Error('XPDY0002: The function which was called depends on dynamic context, which is absent.');\n}\n\t\t\treturn "+r("contextItem")+";\n\t\t}";else{if(2!==e.length)return kf("Incorrect arg count for "+a+" function");if(a=e[1],e=(n=c(n.yb(a,"arg",n))).next().value,n.next(),n=e.isAstAccepted?Gf("arg",e.xa,[e.code]):e,"contextItemExpr"===a[0])t="function "+t+"(contextItem) {\n\t\t\t\tif (contextItem === undefined || contextItem === null) {\n\tthrow new Error('XPDY0002: The function which was called depends on dynamic context, which is absent.');\n}\n\t\t\t\treturn "+r("contextItem")+";\n\t\t\t}";else{if(!n.isAstAccepted)return n;t="function "+t+"(contextItem) {\n\t\t\t\t"+n.ta+"\n\t\t\t\tconst value = "+Mf(n.code,n.xa)[0]+';\n\t\t\t\tconst childElement = value.next().value;\n\t\t\t\treturn (value.done ? "" : '+r("childElement")+");\n\t\t\t}"}}return Gf(t,{type:3,i:{type:0}})}function zf(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Wf(e,t,n,r){var a=c(Xf(e,t,"firstOperand",n,0)),o=a.next().value;return a=a.next().value,o.isAstAccepted?(e=(n=c(Xf(e,t,"secondOperand",n,0))).next().value,n=n.next().value,e.isAstAccepted?[Gf("\n\tfunction "+t+"(contextItem) {\n\t\t"+o.ta.join("\n")+"\n\t\t"+e.ta.join("\n")+"\n\t\treturn "+o.code+" "+r+" "+e.code+";\n\t}\n\t",{type:3,i:{type:0}}),"&&"===r?ao(a,n):a||n]:[e,null]):[o,null]}function $f(e){for(var t=[],n=0;n {\n\t\t\t"+e.code+"\n\t\t\treturn DONE_TOKEN;\n\t\t};\n\t\treturn {\n\t\t\tnext,\n\t\t\t[Symbol.iterator]() { return this; }\n\t\t};\n\t}\n\t",{type:3,i:{type:4}}),a]:[e,null];case Hf.Ob:return Wf(e,t,n,"&&");case Hf.pc:return Wf(e,t,n,"||");case Hf.sc:return[Gf("const "+t+" = "+(e=zf(e=wa(e,"value")[1]||""))+";",{type:1}),null];case Hf.Sb:case Hf.nc:case Hf.dc:case Hf.cc:case Hf.Yb:case Hf.Xb:case Hf.Tb:case Hf.jc:case Hf.fc:case Hf.ec:case Hf.Zb:case Hf.Wb:case Hf.ac:case Hf.mc:case Hf.lc:e:{var o=c(Xf(e,t,"firstOperand",n));if(a=o.next().value,o.next(),a.isAstAccepted)if(n=(o=c(Xf(e,t,"secondOperand",n))).next().value,o.next(),n.isAstAccepted)switch(r){case"eqOp":case"neOp":case"ltOp":case"leOp":case"gtOp":case"geOp":case"isOp":t=Lf(e,r,a,n,t);break e;case"equalOp":case"notEqualOp":case"lessThanOrEqualOp":case"lessThanOp":case"greaterThanOrEqualOp":case"greaterThanOp":o=Aa(e,"type");var i=Aa(e,"type");t=o&&i?3===o.g&&3===i.g?Lf(e,Yf[r],a,n,t):kf("generalCompare with sequences is still in development"):kf("types of compare are not known");break e;default:t=kf("Unsupported compare type")}else t=n;else t=a}return[t,null];case Hf.Vb:return r=xa(wa(e,"functionName")),[void 0!==qf[r]?qf[r](e,t,n):kf("Unsupported function: "+r),null];default:return[kf("Unsupported: the base expression '"+r+"'."),null]}}function id(e,t,n){var r=wa(e,"mainModule");if(!r)return kf("Unsupported: Can not execute a library module.");if(wa(r,"prolog"))return kf("Unsupported: XQuery.");r=ba(r,["queryBody","*"]),n.yb=od;var a=c(od(r,"compiledXPathExpression",n));return n=a.next().value,a.next(),!1===n.isAstAccepted?n:(a=n.ta?n.ta.join("\n"):"",r=Aa(r,"type"),!1===(t=function(e,t,n){switch(e){case 9:if(e=(n=c(Mf("compiledXPathExpression",t))).next().value,4!==n.next().value.type)throw Error("Trying access generated code as an iterator while this is not the case.");return Gf("\n\tconst firstResult = "+e+".next();\n\tif (!firstResult.done) {\n\t\treturn firstResult.value\n\t}\n\treturn null;\n\t",{type:2});case 7:return e=(n=c(Mf("compiledXPathExpression",t))).next().value,4!==n.next().value.type?kf("Return type was not an iterator"):Gf("\n\tconst nodes = [];\n\tfor (const node of "+e+") {\n\t\tnodes.push(node);\n\t}\n\treturn nodes;\n\t",{type:2});case 3:return(n=Ff("compiledXPathExpression","",t)).isAstAccepted?Gf("return "+n.code+";",{type:2}):n;case 2:return void 0===n?n=kf("Full AST wasn't annotated so we cannot correctly emit a string return"):Z(n,1)||Z(n,47)?n=Gf("return "+_f(e=(t=c(Mf("compiledXPathExpression",t))).next().value,(t=t.next().value).type,n)+" || '';",{type:2}):n=kf("Not implemented: returning anything but strings and attributes from codegen"),n;default:return kf("Unsupported: the return type '"+e+"'.")}}(t,n.xa,r?r.type:void 0)).isAstAccepted?t:(t=a+n.code+t.code,n="\n\treturn (contextItem, domFacade, runtimeLib) => {\n\t\tconst {\n\t\t\tDONE_TOKEN,\n\t\t\tValueType,\n\t\t\tXPDY0002,\n\t\t\tdeterminePredicateTruthValue,\n\t\t\tisSubtypeOf,\n\t\t\tready,\n\t\t\tatomize,\n\t\t} = runtimeLib;",function e(t){var n=Ea(t,"*");if("pathExpr"===t[0])return!0;for(t=c(n),n=t.next();!n.done;n=t.next())if(e(n.value))return!0;return!1}(e)&&(n+='\n\t\tif (!contextItem) {\n\t\t\tthrow XPDY0002("Context is needed to evaluate the given path expression.");\n\t\t}\n\n\t\tif (!contextItem.nodeType) {\n\t\t\tthrow new Error("Context item must be subtype of node().");\n\t\t}\n\t\t'),{code:n+(t+"}\n//# sourceURL=generated.js"),isAstAccepted:!0}))}var sd={},ud=(sd["http://www.w3.org/2005/XQueryX"]="xqx",sd["http://www.w3.org/2007/xquery-update-10"]="xquf",sd["http://fontoxml.com/fontoxpath"]="x",sd);function cd(e,t,n){var r=e.stack;r&&(r.includes(e.message)&&(r=r.substr(r.indexOf(e.message)+e.message.length).trim()),(r=r.split("\n")).splice(10),r=(r=r.map((function(e){return e.startsWith(" ")||e.startsWith("\t")?e:" "+e}))).join("\n")),e=Error.call(this,"Custom XPath function Q{"+n+"}"+t+" raised:\n"+e.message+"\n"+r),this.message=e.message,"stack"in e&&(this.stack=e.stack)}function ld(e,t,n){return 0===t.g?e.G()?null:Ef(e.first(),n).next(0).value:2===t.g||1===t.g?e.N().map((function(e){if(Z(e.type,47))throw Error("Cannot pass attribute nodes to custom functions");return Ef(e,n).next(0).value})):Ef(e.first(),n).next(0).value}y(cd,Error);var pd=new Map;function hd(e){var t;e:{if(t=ms.get(e))for(var n=c(Object.keys(t)),r=n.next();!r.done;r=n.next())if(t[r=r.value]&&t[r].length){t=t[r][0].h;break e}t=null}if(t)return t;if(pd.has(e))return pd.get(e);if(null===(t=ba(t="string"==typeof e?ef(e,{aa:!1}):vs(e),["mainModule","queryBody","*"])))throw Error("Library modules do not have a specificity");return t=ds(t,{qa:!1,aa:!1}),pd.set(e,t),t}var fd=new be;return void 0!==n&&(n.compareSpecificity=function(e,t){return vr(hd(e).s,hd(t).s)},n.compileXPathToJavaScript=function(e,t,n){n=n||{},t=t||0,"string"==typeof e?e=ef(e=bs(e),{aa:"XQuery3.1"===n.language||"XQueryUpdate3.1"===n.language,debug:!1}):e=vs(e);var r=wa(e,"mainModule");return r?wa(r,"prolog")?kf("Unsupported: XQuery Prologs are not supported."):(_a(e,n=new za(new pa(new Zr((r={ba:n.namespaceResolver||vf(null)}).ba,{},void 0===n.defaultFunctionNamespaceURI?"http://www.w3.org/2005/xpath-functions":n.defaultFunctionNamespaceURI,n.functionNameResolver||wf("http://www.w3.org/2005/xpath-functions"))))),id(e,t,r)):kf("Unsupported: XQuery Library modules are not supported.")},n.domFacade=fd,n.evaluateXPath=Of,n.evaluateXPathToArray=function(e,t,n,r,a){return Of(e,t,n,r,Of.Pb,a)},n.evaluateXPathToAsyncIterator=Df,n.evaluateXPathToBoolean=function(e,t,n,r,a){return Of(e,t,n,r,Of.BOOLEAN_TYPE,a)},n.evaluateXPathToFirstNode=function(e,t,n,r,a){return Of(e,t,n,r,Of.Ub,a)},n.evaluateXPathToMap=function(e,t,n,r,a){return Of(e,t,n,r,Of.hc,a)},n.evaluateXPathToNodes=function(e,t,n,r,a){return Of(e,t,n,r,Of.kc,a)},n.evaluateXPathToNumber=function(e,t,n,r,a){return Of(e,t,n,r,Of.NUMBER_TYPE,a)},n.evaluateXPathToNumbers=function(e,t,n,r,a){return Of(e,t,n,r,Of.oc,a)},n.evaluateXPathToString=function(e,t,n,r,a){return Of(e,t,n,r,Of.STRING_TYPE,a)},n.evaluateXPathToStrings=function(e,t,n,r,a){return Of(e,t,n,r,Of.rc,a)},n.evaluateUpdatingExpression=function(e,t,n,r,a){var o,i,s,u,c,l,p,h,f,d;return function(e){function t(t){return e.next(t)}function n(t){return e.throw(t)}return new Promise((function(r,a){!function e(o){o.done?r(o.value):Promise.resolve(o.value).then(t,n).then(e,a)}(e.next())}))}(new N(new A((function(m){switch(m.h){case 1:a=a||{};try{u=xf(e,t,n||null,r||{},a||{},{qa:!0,aa:!0,debug:!!a.debug,Ha:!!a.disableCache}),o=u.xb,i=u.zb,s=u.da}catch(t){qr(e,t)}if(s.I){m.h=2;break}c=[];var g=(l=Df(e,t,n,r,Object.assign(Object.assign({},a),{language:"XQueryUpdate3.1"}))).next();return m.h=3,{value:g};case 3:p=m.u;case 4:if(p.done){m.h=6;break}return c.push(p.value),g=l.next(),m.h=7,{value:g};case 7:p=m.u,m.h=4;break;case 6:return h={},m.return(Promise.resolve((h.pendingUpdateList=[],h.xdmValue=c,h)));case 2:try{d=s.u(o,i),f=d.next(0)}catch(t){qr(e,t)}return m.return(Uf(f.value,e,a.returnType,i))}}))))},n.evaluateUpdatingExpressionSync=function(e,t,n,r,a){a=a||{};try{var o=xf(e,t,n||null,r||{},a||{},{qa:!0,aa:!0,debug:!!a.debug,Ha:!!a.disableCache}),i=o.xb,s=o.zb,u=o.da}catch(t){qr(e,t)}if(!u.I)return i={},(s={}).pendingUpdateList=[],s.xdmValue=Of(e,t,n,r,a.i,Object.assign(Object.assign({},a),(i.language=Of.vc,i))),s;try{var c=u.u(i,s).next(0)}catch(t){qr(e,t)}return Uf(c.value,e,a.returnType,s)},n.executeJavaScriptCompiledXPath=function(e,t,n){return n=n||new be,e()(t,n,Pf)},n.executePendingUpdateList=function(e,t,n,r){t=new Ce(t||new be),r=r?new Be(r):Ne,n=n?n=new gf(n):null,cr(e=e.map(Ji),t,n,r)},n.getBucketForSelector=function(e){return hd(e).A()},n.getBucketsForNode=Ae,n.precompileXPath=function(e){return Promise.resolve(e)},n.registerXQueryModule=function(e,t){if(Xa(t=ef(e,{aa:!0,debug:(t=void 0===t?{debug:!1}:t).debug}),new za(void 0)),!(t=wa(t,"libraryModule")))throw Error("XQuery module must be declared in a library module.");var n=wa(t,"moduleDecl"),r=wa(n,"uri"),a=xa(r);if(r=xa(n=wa(n,"prefix")),ma(n=new pa(new Zr((function(){return null}),Object.create(null),"http://www.w3.org/2005/xpath-functions",wf("http://www.w3.org/2005/xpath-functions"))),r,a),null!==(t=wa(t,"prolog"))){try{var o=nf(t,n)}catch(t){qr(e,t)}o.Ma.forEach((function(e){if(a!==e.namespaceURI)throw Error("XQST0048: Functions and variables declared in a module must reside in the module target namespace.")})),xs(a,o)}else xs(a,{Ma:[],Ua:[]});return a},n.registerCustomXPathFunction=function(e,t,n,r){var a=(e=function(e){if("object"==typeof e)return e;if(2!==(e=e.split(":")).length)throw Error("Do not register custom functions in the default function namespace");var t=c(e);e=t.next().value,t=t.next().value;var n=$r[e];if(!n){if(n="generated_namespace_uri_"+e,$r[e])throw Error("Prefix already registered: Do not register the same prefix twice.");$r[e]=n}return{localName:t,namespaceURI:n}}(e)).namespaceURI,o=e.localName;if(!a)throw aa();var i=t.map((function(e){return ge(e)})),s=ge(n);zr(a,o,i,s,(function(e,t,n){var u=Array.from(arguments);u.splice(0,3),u=u.map((function(e,n){return ld(e,i[n],t)}));var c={};c.currentContext=t.u,c.domFacade=t.h.h,c=c;try{var l=r.apply(void 0,[c].concat(p(u)))}catch(e){throw new cd(e,o,a)}return l&&"object"==typeof l&&Object.getOwnPropertySymbols(l).includes(yf)?ue.create(l.Db):yt(t.h,l,s)}))},n.parseScript=function(e,t,n,r){r=void 0===r?Ne:r;var a=ef(e=bs(e),{aa:"XQuery3.1"===t.language||"XQueryUpdate3.1"===t.language,debug:t.debug}),o=new Zr(t.namespaceResolver||function(){return null},{},void 0===t.defaultFunctionNamespaceURI?"http://www.w3.org/2005/xpath-functions":t.defaultFunctionNamespaceURI,t.functionNameResolver||function(){return null});o=new pa(o);var i=wa(a,["mainModule","libraryModule"]),s=wa(i,"moduleDecl");return s&&ma(o,xa(wa(s,"prefix")),s=xa(wa(s,"uri"))),(i=wa(i,"prolog"))&&nf(i,o,!1),!1!==t.annotateAst&&Xa(a,new za(o)),o=new be,t=function e(t,n,r,a,o){if("string"==typeof r)return 0===r.length?null:n.createTextNode(r);if(!Array.isArray(r))throw new TypeError("JsonML element should be an array or string");var i=function(e,t){switch(e){case"copySource":case"insertAfter":case"insertAsFirst":case"insertAsLast":case"insertBefore":case"insertInto":case"modifyExpr":case"newNameExpr":case"replacementExpr":case"replaceValue":case"returnExpr":case"sourceExpr":case"targetExpr":case"transformCopies":case"transformCopy":return{localName:e,rb:t||"http://www.w3.org/2005/XQueryX"};case"deleteExpr":case"insertExpr":case"renameExpr":case"replaceExpr":case"transformExpr":return{localName:e,rb:"http://www.w3.org/2007/xquery-update-10"};case"x:stackTrace":return{localName:"stackTrace",rb:"http://fontoxml.com/fontoxpath"};default:return{localName:e,rb:"http://www.w3.org/2005/XQueryX"}}}(r[0],a);a=i.rb,i=n.createElementNS(a,ud[a]+":"+i.localName);var s=r[1],u=1;if("object"==typeof s&&!Array.isArray(s)){if(null!==s)for(var l=(u=c(Object.keys(s))).next();!l.done;l=u.next()){var p=s[l=l.value];null!==p&&("type"===l?void 0!==p&&t.setAttributeNS(i,a,"fontoxpath:"+l,de(p)):o&&"prefix"===l&&""===p||t.setAttributeNS(i,a,ud[a]+":"+l,p))}u=2}for(s=u,u=r.length;s{x(e,r,"xpath"===t.language),e.accept()});return function(e){const n="xpath"===t.language?[-1,...be(e),-2]:be(e);return a.execute(n).success}}}),Object.freeze({__proto__:null,complete:function(e){return Ie(e,Ue,Ce)},cut:De,delimited:function(e,t,n,r=!1){return Oe(e,r?De(Re(t,n)):Re(t,n))},end:Ue,error:Be,filter:function(e,t,n){return(r,a)=>{const o=e(r,a);return o.success?t(o.value)?o:Be(a,n):o.offset===a?Be(a,n):o}},first:Ce,followed:Re,map:function(e,t){return(n,r)=>{const a=e(n,r);return a.success?Ee(a.offset,t(a.value)):a}},not:function(e,t){return(n,r)=>e(n,r).success?Be(r,t):Ne(r)},ok:Ne,okWithValue:Ee,optional:function(e){return(t,n)=>{const r=e(t,n);return r.success||r.fatal?r:Ee(n,null)}},or:function(e){return(t,n)=>{let r=null;for(const a of e){const e=a(t,n);if(e.success)return e;if(null===r||e.offset>r.offset?r=e:e.offset===r.offset&&(r.expected=r.expected.concat(e.expected)),e.fatal)break}return r||Be(n,[])}},peek:function(e){return(t,n)=>{const r=e(t,n);return r.success?Ee(n,r.value):r}},plus:function(e){return Ie(e,Te(e),(e,t)=>[e].concat(t))},preceded:Oe,recognize:function(e){return(t,n)=>{const r=e(t,n);return r.success?Ee(r.offset,t.slice(n,r.offset)):r}},second:Se,star:Te,start:(e,t)=>0===t?Ne(t):Be(t,["start of input"]),then:Ie,token:function(e){return(t,n)=>{const r=n+e.length;return t.slice(n,r)===e?Ee(r,e):Be(n,[e])}}})),Ge=(Me.compareSpecificity,Me.compileXPathToJavaScript,Me.createTypedValueFactory,Me.domFacade,Me.evaluateUpdatingExpression,Me.evaluateUpdatingExpressionSync,Me.evaluateXPath),ke=(Me.evaluateXPathToArray,Me.evaluateXPathToAsyncIterator,Me.evaluateXPathToBoolean),Fe=Me.evaluateXPathToFirstNode,Pe=(Me.evaluateXPathToMap,Me.evaluateXPathToNodes),He=Me.evaluateXPathToNumber,je=(Me.evaluateXPathToNumbers,Me.evaluateXPathToString),Xe=Me.evaluateXPathToStrings,_e=(Me.executeJavaScriptCompiledXPath,Me.executePendingUpdateList,Me.getBucketForSelector,Me.getBucketsForNode),Le=(Me.Language,Me.parseScript),Ve=(Me.precompileXPath,Me.profiler,Me.registerCustomXPathFunction),Ye=Me.registerXQueryModule;Me.ReturnType;class qe{constructor(e){this._onNodeTouched=e}getAllAttributes(e){return Array.from(e.attributes)}getAttribute(e,t){return e.getAttribute(t)}getChildNodes(e,t){const n=Array.from(e.childNodes).filter(e=>!t||_e(e).includes(t));return n.forEach(e=>this._onNodeTouched(e)),n}getData(e){return e.nodeType===Node.ATTRIBUTE_NODE?(this._onNodeTouched(e),e.value):(this._onNodeTouched(e.parentNode),e.data)}getFirstChild(e,t){for(const n of e.childNodes)if(!t||_e(n).includes(t))return this._onNodeTouched(e),n;return null}getLastChild(e,t){const n=e.getChildNodes().filter(e=>!t||_e(e).includes(t)),r=n[n.length-1];return r||null}getNextSibling(e,t){for(let{nextSibling:n}=e;n;n=n.nextSibling)if(_e(n).includes(t))return n;return null}getParentNode(e){return e.parentNode}getPreviousSibling(e,t){for(let{previousSibling:n}=e;n;n=n.previousSibling)if(_e(n).includes(t))return n;return null}}class Qe{static getParentBindingElement(e){if(e.parentNode&&e.parentNode.nodeType!==Node.DOCUMENT_NODE){if(e.parentNode.hasAttribute("ref"))return e.parentNode;Qe.getParentBindingElement(e.parentNode)}return null}static isAbsolutePath(e){return null!=e&&(e.startsWith("/")||e.startsWith("instance("))}static isRepeated(e){return e.parentElement.closest("fx-repeatitem")}static isSelfReference(e){return"."===e||"./text()"===e||"text()"===e||""===e||null===e}static getDefaultInstance(e){const t=Qe.getForeElement(e).querySelector("fx-instance");if(!t)throw new Error("no default instance present");return t}static getForeElement(e){if("FX-FORE"===e.nodeName)return e;if(e.parentNode)return Qe.getForeElement(e.parentNode);throw new Error("no Fore element present")}static getInstanceId(e){if(!e)return"default";if(e.startsWith("instance()"))return"default";if(e.startsWith("instance(")){const t=e.substring(e.indexOf("(")+1);return t.substring(1,t.indexOf(")")-1)}return null}static getPath(e){const t=Ge("path()",e);return Qe.shortenPath(t)}static shortenPath(e){const t=e.replaceAll(/(Q{(.*?)\})/g,""),n=t.substring(1,t.length);return n.substring(n.indexOf("/"),t.length)}static getBasePath(e){return e.split(":")[0]}}function Je(e,t,n,r){const a={};return function(o){if(a[o])return;const i={},s=[],u=[];for(u.push({node:o,processed:!1});u.length>0;){const o=u[u.length-1],{processed:c}=o,{node:l}=o;if(c)u.pop(),s.pop(),i[l]=!1,a[l]=!0,t&&0!==e[l].length||n.push(l);else{if(a[l]){u.pop();continue}if(i[l]){if(r){u.pop();continue}throw s.push(l),window.dispatchEvent(new CustomEvent("compute-exception",{composed:!0,bubbles:!0,detail:{path:s,message:"cyclic graph"}})),new Error("Cyclic at "+s)}i[l]=!0,s.push(l);const t=e[l];for(let e=t.length-1;e>=0;e-=1)u.push({node:t[e],processed:!1});o.processed=!0}}}}function Ke(e){this.nodes={},this.outgoingEdges={},this.incomingEdges={},this.circular=e&&!!e.circular}Ke.prototype={size(){return Object.keys(this.nodes).length},addNode(e,t){this.hasNode(e)||(this.nodes[e]=2===arguments.length?t:e,this.outgoingEdges[e]=[],this.incomingEdges[e]=[])},removeNode(e){this.hasNode(e)&&(delete this.nodes[e],delete this.outgoingEdges[e],delete this.incomingEdges[e],[this.incomingEdges,this.outgoingEdges].forEach(t=>{Object.keys(t).forEach(n=>{const r=t[n].indexOf(e);r>=0&&t[n].splice(r,1)},this)}))},hasNode(e){return Object.prototype.hasOwnProperty.call(this.nodes,e)},getNodeData(e){if(this.hasNode(e))return this.nodes[e];throw new Error("Node does not exist: "+e)},setNodeData(e,t){if(!this.hasNode(e))throw new Error("Node does not exist: "+e);this.nodes[e]=t},addDependency(e,t){if(!this.hasNode(e))throw new Error("Node does not exist: "+e);if(!this.hasNode(t))throw new Error("Node does not exist: "+t);return-1===this.outgoingEdges[e].indexOf(t)&&this.outgoingEdges[e].push(t),-1===this.incomingEdges[t].indexOf(e)&&this.incomingEdges[t].push(e),!0},removeDependency(e,t){let n;this.hasNode(e)&&(n=this.outgoingEdges[e].indexOf(t),n>=0&&this.outgoingEdges[e].splice(n,1)),this.hasNode(t)&&(n=this.incomingEdges[t].indexOf(e),n>=0&&this.incomingEdges[t].splice(n,1))},clone(){const e=this,t=new Ke;return Object.keys(e.nodes).forEach(n=>{t.nodes[n]=e.nodes[n],t.outgoingEdges[n]=e.outgoingEdges[n].slice(0),t.incomingEdges[n]=e.incomingEdges[n].slice(0)}),t},directDependenciesOf(e){if(this.hasNode(e))return this.outgoingEdges[e].slice(0);throw new Error("Node does not exist: "+e)},directDependantsOf(e){if(this.hasNode(e))return this.incomingEdges[e].slice(0);throw new Error("Node does not exist: "+e)},dependenciesOf(e,t){if(this.hasNode(e)){const n=[];Je(this.outgoingEdges,t,n,this.circular)(e);const r=n.indexOf(e);return r>=0&&n.splice(r,1),n}throw new Error("Node does not exist: "+e)},dependantsOf(e,t){if(this.hasNode(e)){const n=[];Je(this.incomingEdges,t,n,this.circular)(e);const r=n.indexOf(e);return r>=0&&n.splice(r,1),n}throw new Error("Node does not exist: "+e)},entryNodes(){const e=this;return Object.keys(this.nodes).filter(t=>0===e.incomingEdges[t].length)},overallOrder(e){const t=this,n=[],r=Object.keys(this.nodes);if(0===r.length)return n;if(!this.circular){const e=Je(this.outgoingEdges,!1,[],this.circular);r.forEach(t=>{e(t)})}const a=Je(this.outgoingEdges,e,n,this.circular);return r.filter(e=>0===t.incomingEdges[e].length).forEach(e=>{a(e)}),this.circular&&r.filter(e=>-1===n.indexOf(e)).forEach(e=>a(e)),n}},Ke.prototype.directDependentsOf=Ke.prototype.directDependantsOf,Ke.prototype.dependentsOf=Ke.prototype.dependantsOf;class ze{static get ACTION_ELEMENTS(){return["FX-DELETE","FX-DISPATCH","FX-HIDE","FX-INSERT","FX-LOAD","FX-MESSAGE","FX-REBUILD","FX-RECALCULATE","FX-REFRESH","FX-RENEW","FX-REPLACE","FX-RESET","FX-RETAIN","FX-RETURN","FX-REVALIDATE","FX-SEND","FX-SETFOCUS","FX-SETINDEX","FX-SETVALUE","FX-SHOW","FX-TOGGLE","FX-UPDATE"]}static createUUID(){const e=[];for(let t=0;t<36;t+=1)e[t]="0123456789abcdef".substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]="0123456789abcdef".substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("")}static get XFORMS_NAMESPACE_URI(){return"http://www.w3.org/2002/xforms"}static isActionElement(e){return ze.ACTION_ELEMENTS.includes(e)}static get UI_ELEMENTS(){return["FX-ALERT","FX-CONTROL","FX-BUTTON","FX-CONTROL","FX-DIALOG","FX-FILENAME","FX-MEDIATYPE","FX-GROUP","FX-HINT","FX-INPUT","FX-ITEMS","FX-LABEL","FX-OUTPUT","FX-RANGE","FX-REPEAT","FX-REPEATITEM","FX-SWITCH","FX-SECRET","FX-SELECT","FX-SUBMIT","FX-TEXTAREA","FX-TRIGGER","FX-UPLOAD","FX-VAR"]}static isUiElement(e){ze.UI_ELEMENTS.includes(e);return ze.UI_ELEMENTS.includes(e)}static async refreshChildren(e,t){return new Promise(n=>{const{children:r}=e;r&&Array.from(r).forEach(e=>{ze.isUiElement(e.nodeName)&&"function"==typeof e.refresh?e.refresh():"FX-MODEL"!==e.nodeName.toUpperCase()&&ze.refreshChildren(e,t)}),n("done")})}static isRepeated(e){return null!==e.closest("fx-repeatitem")}static getRepeatTarget(e,t){return e.closest("fx-repeatitem").querySelector("#"+t)}static getContentType(e,t){return"urlencoded-post"===t?"application/x-www-form-urlencoded; charset=UTF-8":"xml"===e.type?"application/xml; charset=UTF-8":"json"===e.type?"application/json":null}static fadeInElement(e){let t=()=>(e.getAnimations&&e.getAnimations().map(e=>e.finish()),t=e.animate({opacity:[0,1]},600),t.finished);return t()}static fadeOutElement(e,t){let n=()=>(e.getAnimations&&e.getAnimations().map(e=>e.finish()),n=e.animate({opacity:[1,0]},t),n.finished);return n()}static dispatch(e,t,n){const r=new CustomEvent(t,{composed:!0,bubbles:!0,detail:n});e.dispatchEvent(r)}static prettifyXml(e){const t=(new DOMParser).parseFromString(e,"application/xml"),n=(new DOMParser).parseFromString(['',' ',' ',' '," ",' ',' '," ",' ',""].join("\n"),"application/xml"),r=new XSLTProcessor;r.importStylesheet(n);const a=r.transformToDocument(t);return(new XMLSerializer).serializeToString(a)}}ze.READONLY_DEFAULT=!1,ze.REQUIRED_DEFAULT=!1,ze.RELEVANT_DEFAULT=!0,ze.CONSTRAINT_DEFAULT=!0,ze.TYPE_DEFAULT="xs:string";const We="http://www.w3.org/2002/xforms",$e=new Map;function Ze(e,t,n){return $e.has(e)?$e.get(e).set(t,n):$e.set(e,new Map)}const et=e=>{if(!e)return"http://www.w3.org/1999/xhtml"};function tt(e,t){const n=(r=e,a=t,$e.has(r)&&$e.get(r).get(a)||null);var r,a;if(n)return n;const o=(new DOMParser).parseFromString("","text/xml"),i=Le(e,{},o);let s=Xe('descendant::xqx:functionCallExpr\n\t\t\t\t[xqx:functionName = "instance"]\n\t\t\t\t/xqx:arguments\n\t\t\t\t/xqx:stringConstantExpr\n\t\t\t\t/xqx:value',i,null,{},{namespaceResolver:e=>"xqx"===e?"http://www.w3.org/2005/XQueryX":void 0});if(0===s.length){const n=Fe("ancestor::*[@ref][1]",t);if(n){const r=tt(n.getAttribute("ref"),n);return Ze(e,t,r),r}s=["default"]}if(1===s.length){let n;if("default"===s[0]){const e=Fe("ancestor-or-self::fx-fore",t,null,null,{namespaceResolver:et});n=e&&e.querySelector("fx-instance")}else n=pt(s[0],t,"fx-instance");if(n&&n.hasAttribute("xpath-default-namespace")){const r=n.getAttribute("xpath-default-namespace"),a=e=>{if(!e)return r};return Ze(e,t,a),a}}s.length;const u=je("ancestor-or-self::*/@xpath-default-namespace[last()]",t)||"",c=function(e){return""===e?u:je('ancestor-or-self::*/@*[name() = "xmlns:" || $prefix][last()]',t,null,{prefix:e})};return Ze(e,t,c),c}function nt(e,t,n){return(t&&t.ownerDocument||t)===window.document?et:tt(e,n)}function rt({prefix:e,localName:t},n){switch(t){case"context":case"base64encode":case"boolean-from-string":case"current":case"depends":case"event":case"index":case"instance":case"log":case"logtree":return{namespaceURI:We,localName:t};default:return""===e||"fn"===e?{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:t}:"local"===e?{namespaceURI:"http://www.w3.org/2005/xquery-local-functions",localName:t}:null}}function at(e){let t=e;for(;t&&!("inScopeVariables"in t);)t=t.parentNode;if(!t)return{};const n={};if(t.inScopeVariables)for(const e of t.inScopeVariables.keys()){const r=t.inScopeVariables.get(e);n[e]=r.value}return n}function ot(e,t,n,r={}){const a=nt(e,t,n),o=at(n);return Ge(e,t,null,{...o,...r},"xs:anyType",{currentContext:{formElement:n,variables:r},moduleImports:{xf:We},functionNameResolver:rt,namespaceResolver:a})}function it(e,t,n){const r=nt(e,t,n),a=at(n);return Fe(e,t,null,a,{defaultFunctionNamespaceURI:We,moduleImports:{xf:We},currentContext:{formElement:n},namespaceResolver:r})}function st(e,t,n){const r=nt(e,t,n),a=at(n);return Pe(e,t,null,a,{currentContext:{formElement:n},functionNameResolver:rt,moduleImports:{xf:We},namespaceResolver:r})}function ut(e,t,n){const r=nt(e,t,n),a=at(n);return ke(e,t,null,a,{currentContext:{formElement:n},functionNameResolver:rt,moduleImports:{xf:We},namespaceResolver:r})}function ct(e,t,n,r=null,a=n){const o=nt(e,t,n),i=at(n);return je(e,t,r,i,{currentContext:{formElement:n},functionNameResolver:rt,moduleImports:{xf:We},namespaceResolver:o})}function lt(e,t,n,r=null,a=n){const o=nt(e,t,n),i=at(n);return He(e,t,r,i,{currentContext:{formElement:n},functionNameResolver:rt,moduleImports:{xf:We},namespaceResolver:o})}function pt(e,t,n=null){const r=Pe("outermost(ancestor-or-self::fx-fore[1]/(descendant::xf-fore|descendant::*[@id = $id]))[not(self::fx-fore)]",t,null,{id:e},{namespaceResolver:et});if(0===r.length)return null;if(1===r.length&&ke("(ancestor::fx-fore | ancestor::fx-repeat)[last()]/self::fx-fore",r[0],null,null,{namespaceResolver:et})){const e=r[0];return n&&e.localName!==n?null:e}for(const e of Pe("ancestor::fx-repeatitem => reverse()",t,null,null,{namespaceResolver:et})){const t=r.filter(t=>e.contains(t));switch(t.length){case 0:break;case 1:{const e=t[0];return n&&e.localName!==n?null:e}default:{const e=t.find(e=>Pe("every $ancestor of ancestor::fx-repeatitem satisfies $ancestor is $ancestor/../child::fx-repeatitem[../@repeat-index]",e,null,{}));return e?n&&e.localName!==n?null:e:null}}}return null}const ht=(e,t)=>{const n=e.currentContext.formElement;if(t){const e=pt(t,n);if(e){if("FX-REPEAT"===e.nodeName){const{nodeset:t}=e;for(let r=n;r;r=r.parentNode)if(r.parentNode===e){return t[Array.from(r.parentNode.children).indexOf(r)]}}return e.nodeset}}const r=Qe.getParentBindingElement(n);n.nodeName;return r||n.getInScopeContext()};Ve({namespaceURI:We,localName:"context"},[],"item()?",ht),Ve({namespaceURI:We,localName:"context"},["xs:string"],"item()?",ht),Ve({namespaceURI:We,localName:"log"},["xs:string?"],"xs:string?",(e,t)=>{const{formElement:n}=e.currentContext,r=pt(t,n,"fx-instance");if(r&&"json"!==r.getAttribute("type")){const e=(new XMLSerializer).serializeToString(r.getDefaultContext());return ze.prettifyXml(e)}return null}),Ve({namespaceURI:We,localName:"logtree"},["xs:string?"],"element()?",(e,t)=>{const{formElement:n}=e.currentContext,r=pt(t,n,"fx-instance");if(r){const t=document.createElement("div");t.setAttribute("class","logtree");const n=e.currentContext.formElement,a=n.querySelector(".logtree");a&&a.parentNode.removeChild(a);const o=function e(t,n){if(n&&n.nodeType===Node.ELEMENT_NODE&&n.children){const r=document.createElement("details");r.setAttribute("data-path",n.nodeName);const a=document.createElement("summary");let o,i=" <"+n.nodeName;Array.from(n.attributes).forEach(e=>{i+=` ${e.nodeName}="${e.nodeValue}"`}),n.firstChild&&n.firstChild.nodeType===Node.TEXT_NODE&&""!==n.firstChild.data.trim()?(o=n.firstChild.nodeValue,i+=`>${o}`):i+=">",a.textContent=i,r.appendChild(a),0!==n.childElementCount?r.setAttribute("open","open"):a.setAttribute("style","list-style:none;"),t.appendChild(r),Array.from(n.children).forEach(t=>{e(r,t)})}}(t,r.getDefaultContext());o&&n.appendChild(o)}return null});const ft=(e,t)=>{const n=Fe("ancestor-or-self::fx-fore",e.currentContext.formElement,null,null,{namespaceResolver:et}),r=t?pt(t,n,"fx-instance"):n.querySelector("fx-instance");if(r){return r.getDefaultContext()}return null};Ve({namespaceURI:We,localName:"index"},["xs:string?"],"xs:integer?",(e,t)=>{const{formElement:n}=e.currentContext;if(null===t)return 1;const r=pt(t,n,"fx-repeat");return r?r.getAttribute("index"):Number(1)}),Ve({namespaceURI:We,localName:"instance"},[],"item()?",e=>ft(e,null)),Ve({namespaceURI:We,localName:"instance"},["xs:string?"],"item()?",ft),Ve({namespaceURI:We,localName:"depends"},["node()*"],"item()?",(e,t)=>t[0]),Ve({namespaceURI:We,localName:"event"},["xs:string?"],"item()?",(e,t)=>(e.currentContext.variables[t].nodeType,e.currentContext.variables[t])),Ye(`\n module namespace xf="${We}";\n\n declare %public function xf:boolean-from-string($str as xs:string) as xs:boolean {\n lower-case($str) = "true" or $str = "1"\n };\n`),Ve({namespaceURI:We,localName:"base64encode"},["xs:string?"],"xs:string?",(e,t)=>btoa(t));class dt extends HTMLElement{constructor(){super(),this.model=this.parentNode,this.attachShadow({mode:"open"})}connectedCallback(){this.hasAttribute("src")&&(this.src=this.getAttribute("src")),this.hasAttribute("id")?this.id=this.getAttribute("id"):this.id="default",this.hasAttribute("type")?this.type=this.getAttribute("type"):this.type="xml";this.shadowRoot.innerHTML="\n \n \n \n "}async init(){await this._initInstance().then(()=>(this.dispatchEvent(new CustomEvent("instance-loaded",{composed:!0,bubbles:!0,detail:{instance:this}})),this))}evalXPath(e){const t=this.parentElement.parentElement;return it(e,this.getDefaultContext(),t)}getInstanceData(){return this.instanceData||this._createInstanceData(),this.instanceData}setInstanceData(e){e?this.instanceData=e:this._createInstanceData()}getDefaultContext(){return"xml"===this.type?this.instanceData.firstElementChild:this.instanceData}async _initInstance(){if("#querystring"===this.src){const e=new URLSearchParams(location.search),t=(new DOMParser).parseFromString("","application/xml"),n=t.firstElementChild;for(const r of e){const e=t.createElement(r[0]);e.appendChild(t.createTextNode(r[1])),n.appendChild(e)}this.instanceData=t}else this.src?await this._loadData():0!==this.childNodes.length&&this._useInlineData()}_createInstanceData(){if("xml"===this.type){const e=(new DOMParser).parseFromString("","application/xml");this.instanceData=e}"json"===this.type&&(this.instanceData={})}async _loadData(){const e=""+this.src,t=ze.getContentType(this,"get");await fetch(e,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":t}}).then(e=>{const t=e.status;if(t>=400)throw alert(`response status: ${t} - failed to load data for '${this.src}' - stopping.`),new Error("failed to load data - status: "+t);const n=e.headers.get("content-type").toLowerCase();return n.startsWith("text/html")?e.text().then(e=>(new DOMParser).parseFromString(e,"text/html")):n.startsWith("text/plain")||n.startsWith("text/markdown")?e.text():n.startsWith("application/json")?e.json():n.startsWith("application/xml")?e.text().then(e=>(new DOMParser).parseFromString(e,"application/xml")):"done"}).then(e=>{e.nodeType,this.instanceData=e}).catch(e=>{throw new Error("failed loading data "+e)})}_getContentType(){return"xml"===this.type?"application/xml":"json"===this.type?"application/json":null}_useInlineData(){if("xml"===this.type){const e=(new DOMParser).parseFromString(this.innerHTML,"application/xml");this.instanceData=e}else"json"===this.type?this.instanceData=JSON.parse(this.textContent):"html"===this.type?this.instanceData=this.firstElementChild.children:"text"===this.type&&(this.instanceData=this.textContent)}_handleResponse(){const e=this.shadowRoot.getElementById("loader"),t=(new DOMParser).parseFromString(e.lastResponse,"application/xml");this.instanceData=t}_handleError(){this.shadowRoot.getElementById("loader")}}customElements.define("fx-instance",dt);class mt{constructor(e,t,n,r,a,o,i,s,u){this.path=e,this.ref=t,this.constraint=o,this.readonly=n,this.relevant=r,this.required=a,this.type=i,this.node=s,this.bind=u,this.changed=!1,this.alerts=[],this.boundControls=[]}get value(){return this.node.nodeType?this.node.nodeType===Node.ATTRIBUTE_NODE?this.node.nodeValue:this.node.textContent:this.node}set value(e){e.nodeType===Node.DOCUMENT_NODE?this.node.appendChild(e.firstElementChild):e.nodeType===Node.ELEMENT_NODE?this.node.appendChild(e):this.node.nodeType===Node.ATTRIBUTE_NODE?this.node.nodeValue=e:this.node.textContent=e}addAlert(e){this.alerts.push(e)}cleanAlerts(){this.alerts=[]}}class gt extends HTMLElement{constructor(){super(),this.instances=[],this.modelItems=[],this.defaultContext={},this.changed=[],this.inited=!1,this.modelConstructed=!1,this.attachShadow({mode:"open"}),this.computes=0}get formElement(){return this.parentElement}connectedCallback(){this.shadowRoot.innerHTML="\n \n ",this.addEventListener("model-construct-done",e=>{this.modelConstructed=!0}),this.skipUpdate=!1}static lazyCreateModelItem(e,t,n){let r,a={};if(null==n)return null;a=n.nodeType===n.TEXT_NODE?n.parentNode:n,n.nodeType?r=Qe.getPath(n):(r=null,a=n);const o=new mt(r,t,ze.READONLY_DEFAULT,ze.RELEVANT_DEFAULT,ze.REQUIRED_DEFAULT,ze.CONSTRAINT_DEFAULT,ze.TYPE_DEFAULT,a,this);return e.registerModelItem(o),o}modelConstruct(){this.dispatchEvent(new CustomEvent("model-construct",{detail:this}));const e=this.querySelectorAll("fx-instance");if(e.length>0){const t=[];e.forEach(e=>{t.push(e.init())}),Promise.all(t).then(()=>{this.instances=Array.from(e),this.updateModel(),this.inited=!0,this.dispatchEvent(new CustomEvent("model-construct-done",{composed:!0,bubbles:!0,detail:{model:this}}))})}else this.dispatchEvent(new CustomEvent("model-construct-done",{composed:!0,bubbles:!0,detail:{model:this}}));this.inited=!0}registerModelItem(e){this.modelItems.push(e)}updateModel(){this.rebuild(),this.skipUpdate||(this.recalculate(),this.revalidate())}rebuild(){this.mainGraph=new Ke(!1),this.modelItems=[];const e=this.querySelectorAll("fx-model > fx-bind");0!==e.length?(e.forEach(e=>{e.init(this)}),this.dispatchEvent(new CustomEvent("rebuild-done",{detail:{maingraph:this.mainGraph}}))):this.skipUpdate=!0}recalculate(){if(this.computes=0,this.subgraph=new Ke(!1),0!==this.changed.length){this.changed.forEach(e=>{if(this.subgraph.addNode(e.path,e.node),this.mainGraph.hasNode(e.path)){const t=this.mainGraph.dependantsOf(e.path,!1).reverse();0!==t.length&&t.forEach(t=>{const n=this.mainGraph.getNodeData(t);if(this.subgraph.addNode(t,n),t.includes(":")){const r=t.substring(0,t.indexOf(":"));this.subgraph.addNode(r,n);0!==this.mainGraph.dependentsOf(e.path,!1).indexOf(t)&&this.subgraph.addDependency(t,e.path)}})}});this.subgraph.overallOrder(!1).forEach(e=>{if(this.mainGraph.hasNode(e)){const t=this.mainGraph.getNodeData(e);this.compute(t,e)}});const e=[...this.changed];this.formElement.toRefresh=e,this.changed=[],this.dispatchEvent(new CustomEvent("recalculate-done",{detail:{subgraph:this.subgraph}}))}else{this.mainGraph.overallOrder(!1).forEach(e=>{const t=this.mainGraph.getNodeData(e);this.compute(t,e)})}}compute(e,t){const n=this.getModelItem(e);if(n&&t.includes(":")){const e=t.split(":")[1];if(e)if("calculate"===e){const t=ot(n.bind[e],n.node,this);n.value=t,n.readonly=!0}else if("constraint"!==e&&"type"!==e){const t=n.bind[e];if(t){const r=ut(t,n.node,this);n[e]=r}}this.computes+=1}}revalidate(){let e=!0;return this.modelItems.forEach(t=>{const{bind:n}=t;if(n&&"function"==typeof n.hasAttribute&&n.hasAttribute("constraint")){const r=n.getAttribute("constraint");if(r){const a=ut(r,t.node,this);if(t.constraint=a,this.formElement.addToRefresh(t),a||(e=!1),!this.modelConstructed){const e=n.getAlert();e&&t.addAlert(e)}}}}),e}getModelItem(e){return this.modelItems.find(t=>t.node===e)}getDefaultContext(){return this.instances[0].getDefaultContext()}getDefaultInstance(){return this.instances[0]}getDefaultInstanceData(){return this.instances[0].instanceData}getInstance(e){return Array.from(this.instances).find(t=>t.id===e)}evalBinding(e){return this.instances[0].evalXPath(e)}}function yt(e){return e.closest("fx-fore")}function vt(e,t){const n=e.closest("[ref]");if(null!==n)return n.nodeset;const r=function(e){return yt(e).getModel()}(e);if(Qe.isAbsolutePath(t)){const e=Qe.getInstanceId(t);return e?r.getInstance(e).getDefaultContext():r.getDefaultInstance().getDefaultContext()}return null!==r.getDefaultInstance()&&r.inited?r.getDefaultInstance().getDefaultContext():[]}function wt(e,t){const n=function(e){return e&&e.nodeType&&e.nodeType===Node.ATTRIBUTE_NODE?e.ownerElement:e.nodeType===Node.ELEMENT_NODE?e:e.parentNode}(e),r=n.closest("fx-repeatitem");if(r)return"context"===e.nodeName?it(e.nodeValue,r.nodeset,yt(n)):r.nodeset;if(n.hasAttribute("context")){const r=vt(e.ownerElement.parentNode,t);return it(e.ownerElement.getAttribute("context"),r,yt(n))}if(e.nodeType===Node.ATTRIBUTE_NODE&&"context"===e.nodeName){const r=vt(e.ownerElement.parentNode,t);return it(e.ownerElement.getAttribute("context"),r,yt(n))}if(e.nodeType===Node.ATTRIBUTE_NODE&&"ref"===e.nodeName){if(e.ownerElement.hasAttribute("context")){const r=vt(e.ownerElement.parentNode,t);return it(e.ownerElement.getAttribute("context"),r,yt(n))}return vt(n.parentNode,t)}return vt(n,t)}customElements.define("fx-model",gt);const xt=e=>class extends e{static get properties(){return{context:{type:Object},model:{type:Object},modelItem:{type:Object},nodeset:{type:Object},ref:{type:String},inScopeVariables:{type:Map}}}constructor(){super(),this.context=null,this.model=null,this.modelItem={},this.ref=this.hasAttribute("ref")?this.getAttribute("ref"):"",this.inScopeVariables=null}getModel(){if(this.model)return this.model;return this.getOwnerForm().querySelector("fx-model")}getOwnerForm(){let e=this;for(;e&&e.parentNode;){if("FX-FORE"===e.nodeName.toUpperCase())return e;e=e.parentNode instanceof DocumentFragment?e.parentNode.host:e.parentNode}return e}evalInContext(){let e;if(this.hasAttribute("context")&&(e=wt(this.getAttributeNode("context")||this,this.context)),this.hasAttribute("ref")&&(e=wt(this.getAttributeNode("ref")||this,this.ref)),e||(e=this.getModel().getDefaultInstance().getDefaultContext()),""===this.ref)this.nodeset=e;else if(Array.isArray(e))this.nodeset=it(this.ref,e[0],this);else{const{nodeType:t}=e;this.nodeset=t?it(this.ref,e,this):ot(this.ref,e,this)}}isNotBound(){return!this.hasAttribute("ref")}isBound(){return this.hasAttribute("ref")}getBindingExpr(){if(this.hasAttribute("ref"))return this.getAttribute("ref");const e=this.parentNode.closest("[ref]");return e?e.getAttribute("ref"):"instance()"}getInstance(){if(this.ref.startsWith("instance(")){const e=Qe.getInstanceId(this.ref);return this.getModel().getInstance(e)}return this.getModel().getInstance("default")}_getParentBindingElement(e){if(e.parentNode.host){const{host:t}=e.parentNode;if(t.hasAttribute("ref"))return t}else if(e.parentNode){if(e.parentNode.hasAttribute("ref"))return this.parentNode;this._getParentBindingElement(this.parentNode)}return null}getModelItem(){const e=this.getModel().getModelItem(this.nodeset);e&&(this.modelItem=e);let t;if(this.closest("fx-repeatitem")){const{index:e}=this.closest("fx-repeatitem");t=Array.isArray(this.nodeset)?this.getModel().getModelItem(this.nodeset[e-1]):this.getModel().getModelItem(this.nodeset)}else t=this.getModel().getModelItem(this.nodeset);return t||gt.lazyCreateModelItem(this.getModel(),this.ref,this.nodeset)}getValue(){if(this.hasAttribute("value")){const e=this.getAttribute("value");try{return ct(e,wt(this,e),this.getOwnerForm())}catch(e){this.dispatch("error",{message:e})}}return this.textContent?this.textContent:null}getInScopeContext(){return wt(this.getAttributeNode("ref")||this,this.ref)}setInScopeVariables(e){this.inScopeVariables=e}dispatch(e,t){const n=new CustomEvent(e,{composed:!0,bubbles:!0,detail:t});this.dispatchEvent(n)}};class At extends(xt(HTMLElement)){constructor(){super(),this.nodeset=[],this.model={},this.contextNode={},this.inited=!1}connectedCallback(){this.ref=this.getAttribute("ref"),this.readonly=this.getAttribute("readonly"),this.required=this.getAttribute("required"),this.relevant=this.getAttribute("relevant"),this.type=this.hasAttribute("type")?this.getAttribute("type"):At.TYPE_DEFAULT,this.calculate=this.getAttribute("calculate")}init(e){this.model=e,this.instanceId=this._getInstanceId(),this.bindType=this.getModel().getInstance(this.instanceId).type,"xml"===this.bindType&&(this._evalInContext(),this._buildBindGraph(),this._createModelItems()),this._processChildren(e)}_buildBindGraph(){"xml"===this.bindType&&this.nodeset.forEach(e=>{const t=Qe.getPath(e);this.model.mainGraph.addNode(t,e),this.calculate&&(this.model.mainGraph.addNode(t+":calculate",e),this.model.mainGraph.addDependency(t,t+":calculate"));const n=this._getReferencesForProperty(this.calculate,e);if(0!==n.length&&this._addDependencies(n,e,t,"calculate"),!this.calculate){const n=this._getReferencesForProperty(this.readonly,e);0!==n.length?this._addDependencies(n,e,t,"readonly"):this.readonly&&this.model.mainGraph.addNode(t+":readonly",e)}const r=this._getReferencesForProperty(this.required,e);0!==r.length?this._addDependencies(r,e,t,"required"):this.required&&this.model.mainGraph.addNode(t+":required",e);const a=this._getReferencesForProperty(this.relevant,e);0!==a.length?this._addDependencies(a,e,t,"relevant"):this.relevant&&this.model.mainGraph.addNode(t+":relevant",e);const o=this._getReferencesForProperty(this.constraint,e);0!==o.length?this._addDependencies(o,e,t,"constraint"):this.constraint&&this.model.mainGraph.addNode(t+":constraint",e)})}_addDependencies(e,t,n,r){const a=`${n}:${r}`;0!==e.length?(this.model.mainGraph.hasNode(a)||this.model.mainGraph.addNode(a,t),e.forEach(e=>{const t=Qe.getPath(e);t.endsWith("text()[1]")||(this.model.mainGraph.hasNode(t)||this.model.mainGraph.addNode(t,e),this.model.mainGraph.addDependency(a,t))})):this.model.mainGraph.addNode(a,t)}_processChildren(e){const t=this.querySelectorAll(":scope > fx-bind");Array.from(t).forEach(t=>{t.init(e)})}getAlert(){if(this.hasAttribute("alert"))return this.getAttribute("alert");const e=this.querySelector("fx-alert");return e?e.innerHTML:null}_evalInContext(){const e=wt(this.getAttributeNode("ref")||this,this.ref);if(this.nodeset=[],""===this.ref||null===this.ref)this.nodeset=e;else if(Array.isArray(e))e.forEach(t=>{if(Qe.isSelfReference(this.ref))this.nodeset=e;else if(this.ref){st(this.ref,t,this).forEach(e=>{this.nodeset.push(e)})}});else{"xml"===this.getModel().getInstance(this.instanceId).type?this.nodeset=st(this.ref,e,this):this.nodeset=this.ref}}_createModelItems(){Array.isArray(this.nodeset)?Array.from(this.nodeset).forEach(e=>{this._createModelItem(e)}):this._createModelItem(this.nodeset)}static lazyCreateModelitems(e,t,n){Array.isArray(n)?Array.from(n).forEach(n=>{At.lazyCreateModelItem(e,t,n)}):At.lazyCreateModelItem(e,t,n)}_createModelItem(e){if(Qe.isSelfReference(this.ref)){const e=this.parentElement.closest("fx-bind[ref]");return void(e&&(e.required=this.required))}const t=e,n=Qe.getPath(e),r=new mt(n,this.getBindingExpr(),At.READONLY_DEFAULT,At.RELEVANT_DEFAULT,At.REQUIRED_DEFAULT,At.CONSTRAINT_DEFAULT,this.type,t,this);this.getModel().registerModelItem(r)}_getReferencesForProperty(e){if(e){const t=new Set,n=new qe(e=>t.add(e));return this.nodeset.forEach(t=>{ct(e,t,this,n)}),Array.from(t.values())}return[]}_initBooleanModelItemProperty(e,t){return ut(this[e],t,this)}static shortenPath(e){const t=e.split("/");let n="";for(let e=2;e0&&(this.toastElement.timeOutValue=window.setTimeout(()=>{this._removeElement(this.toastElement)},this.options.duration)),this}hideToast(){this.toastElement.timeOutValue&&clearTimeout(this.toastElement.timeOutValue),this._removeElement(this.toastElement)}_init(e){this.options=Object.assign(this.defaults,e),this.options.backgroundColor,this.toastElement=null,this.options.gravity="bottom"===e.gravity?"toastify-bottom":"toastify-top",this.options.stopOnFocus=void 0===e.stopOnFocus||e.stopOnFocus,this.options.style.background=this.options.style.background||e.backgroundColor}_buildToast(){if(!this.options)throw"Toastify is not initialized";let e=document.createElement("div");e.className="toastify on "+this.options.className,e.className+=" toastify-"+this.options.position,e.className+=" "+this.options.gravity;for(const t in this.options.style)e.style[t]=this.options.style[t];if(this.options.node&&this.options.node.nodeType===Node.ELEMENT_NODE)e.appendChild(this.options.node);else if(this.options.escapeMarkup?e.innerText=this.options.text:e.innerHTML=this.options.text,""!==this.options.avatar){let t=document.createElement("img");t.src=this.options.avatar,t.className="toastify-avatar","left"==this.options.position?e.appendChild(t):e.insertAdjacentElement("afterbegin",t)}if(!0===this.options.close){let t=document.createElement("span");t.innerHTML="✖",t.className="toast-close",t.addEventListener("click",e=>{e.stopPropagation(),this._removeElement(this.toastElement),window.clearTimeout(this.toastElement.timeOutValue)});const n=window.innerWidth>0?window.innerWidth:screen.width;"left"==this.options.position&&n>360?e.insertAdjacentElement("afterbegin",t):e.appendChild(t)}if(this.options.stopOnFocus&&this.options.duration>0&&(e.addEventListener("mouseover",t=>{window.clearTimeout(e.timeOutValue)}),e.addEventListener("mouseleave",()=>{e.timeOutValue=window.setTimeout(()=>{this._removeElement(e)},this.options.duration)})),void 0!==this.options.destination&&e.addEventListener("click",e=>{e.stopPropagation(),!0===this.options.newWindow?window.open(this.options.destination,"_blank"):window.location=this.options.destination}),"function"==typeof this.options.onClick&&void 0===this.options.destination&&e.addEventListener("click",e=>{e.stopPropagation(),this.options.onClick()}),"object"==typeof this.options.offset){const t=this._getAxisOffsetAValue("x",this.options),n=this._getAxisOffsetAValue("y",this.options),r="left"==this.options.position?t:"-"+t,a="toastify-top"==this.options.gravity?n:"-"+n;e.style.transform=`translate(${r},${a})`}return e}_removeElement(e){e.className=e.className.replace(" on",""),window.setTimeout(()=>{this.options.node&&this.options.node.parentNode&&this.options.node.parentNode.removeChild(this.options.node),e.parentNode&&e.parentNode.removeChild(e),this.options.callback.call(e),this._reposition()},400)}_reposition(){let e,t={top:15,bottom:15},n={top:15,bottom:15},r={top:15,bottom:15},a=this._rootElement.querySelectorAll(".toastify");for(let o=0;o0?window.innerWidth:screen.width)<=360?(a[o].style[e]=r[e]+"px",r[e]+=i+s):!0===a[o].classList.contains("toastify-left")?(a[o].style[e]=t[e]+"px",t[e]+=i+s):(a[o].style[e]=n[e]+"px",n[e]+=i+s)}}_getAxisOffsetAValue(e,t){return t.offset[e]?isNaN(t.offset[e])?t.offset[e]:t.offset[e]+"px":"0px"}}function Et(e){return new bt(e)}class Nt extends HTMLElement{static get properties(){return{avatar:{type:String},backgroundColor:{type:String},callback:{type:String},classProp:{type:String},close:{type:Boolean},destination:{type:String},duration:{type:Number},escapeMarkup:{type:Boolean},gravity:{type:String},newWindow:{type:Boolean},oldestFirst:{type:Boolean},position:{type:String},selector:{type:String},stopOnFocus:{type:Boolean},text:{type:String}}}constructor(){super(),this.attachShadow({mode:"open"})}_initVar(e,t){return this.hasAttribute(e)?this.getAttribute(e):t}connectedCallback(){this.avatar=this._initVar("avatar",""),this.backgroundColor=this._initVar("backgroundColor",""),this.callback=this._initVar("callback",{}),this.classProp=this._initVar("data-class",""),this.close="true"===this._initVar("close",!1),this.destination=this._initVar("destination",void 0),this.duration=Number(this._initVar("duration",3e3)),this.escapeMarkup="true"===this._initVar("escapeMarkup",!0),this.gravity=this._initVar("gravity","top"),this.newWindow="true"===this._initVar("newWindow",!1),this.offSet=this._initVar("offSet",{}),this.oldestFirst="true"===this._initVar("oldestFirst",!0),this.position=this._initVar("position","right"),this.stopOnFocus=this._initVar("stopOnFocus",!0),this.text=this._initVar("text","");this.shadowRoot.innerHTML=`\n \n ${this.renderHTML}\n `,this.addEventListener("jinn-toast",e=>{this.showToast(e.detail.text)})}showToast(e){new Et({avatar:this.avatar,className:this.classProp,close:this.close,destination:this.destination,duration:this.duration,escapeMarkup:this.escapeMarkup,gravity:this.gravity,newWindow:!1,offset:this.offset,oldestFirst:this.oldestFirst,position:this.position,node:this.shadowRoot,stopOnFocus:this.stopOnFocus,text:e}).showToast()}renderHTML(){return"\n \n "}}window.customElements.define("jinn-toast",Nt);class Bt extends HTMLElement{static get properties(){return{lazyRefresh:{type:Boolean},model:{type:Object},ready:{type:Boolean}}}constructor(){super(),this.model={},this.addEventListener("model-construct-done",this._handleModelConstructDone),this.addEventListener("message",this._displayMessage),this.addEventListener("error",this._displayError),window.addEventListener("compute-exception",e=>{}),this.ready=!1,this.storedTemplateExpressionByNode=new Map;this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML='\n \n \n \n \n \n \n
\n \n
\n \n ',this.toRefresh=[],this.initialRun=!0,this.someInstanceDataStructureChanged=!1}connectedCallback(){if(this.lazyRefresh=this.hasAttribute("refresh-on-view"),this.lazyRefresh){const e={root:null,rootMargin:"0px",threshold:.3};this.intersectionObserver=new IntersectionObserver(this.handleIntersect,e)}if(this.src=this.hasAttribute("src")?this.getAttribute("src"):null,this.src)return void this._loadFromSrc();this.shadowRoot.querySelector("slot").addEventListener("slotchange",e=>{let t=e.target.assignedElements().find(e=>"FX-MODEL"===e.nodeName.toUpperCase());if(!t){const e=document.createElement("FX-model");this.appendChild(e),t=e}t.inited||(this.src,t.modelConstruct()),this.model=t}),this.addEventListener("path-mutated",e=>{this.someInstanceDataStructureChanged=!0})}addToRefresh(e){this.toRefresh.find(t=>t.path===e.path)||this.toRefresh.push(e)}_loadFromSrc(){fetch(this.src,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":"text/html"}}).then(e=>e.headers.get("content-type").toLowerCase().startsWith("text/html")?e.text().then(e=>(new DOMParser).parseFromString(e,"text/html")):"done").then(e=>{const t=e.querySelector("fx-fore");t||this.dispatchEvent(new CustomEvent("error",{detail:{message:`Fore element not found in '${this.src}'. Maybe wrapped within 'template' element?`}})),t.setAttribute("from-src",this.src),this.replaceWith(t)}).catch(e=>{this.dispatchEvent(new CustomEvent("error",{detail:{message:`'${this.src}' not found or does not contain Fore element.`}}))})}handleIntersect(e,t){e.forEach(e=>{const{target:t}=e;e.isIntersecting&&(t.classList.add("loaded"),"function"==typeof t.refresh?t.refresh(t,!0):ze.refreshChildren(t,!0))}),e[0].target.getOwnerForm().dispatchEvent(new CustomEvent("refresh-done"))}evaluateToNodes(e,t){return st(e,t,this)}disconnectedCallback(){}async refresh(e){this.initialRun||0===this.toRefresh.length?ze.refreshChildren(this,!0):(this.toRefresh.forEach(e=>{const t=e.boundControls;t&&t.forEach(e=>{e.refresh()});const n=this.getModel().mainGraph;if(n&&n.hasNode(e.path)){const t=this.getModel().mainGraph.dependentsOf(e.path,!1);0!==t.length&&t.forEach(e=>{const t=Qe.getBasePath(e);this.getModel().modelItems.find(e=>e.path===t).boundControls.forEach(e=>{e.refresh()})})}}),this.toRefresh=[]),(this.initialRun||this.someInstanceDataStructureChanged)&&(this._updateTemplateExpressions(),this.someInstanceDataStructureChanged=!1),this._processTemplateExpressions(),this.dispatchEvent(new CustomEvent("refresh-done"))}_updateTemplateExpressions(){const e=st("(descendant-or-self::*/(text(), @*))[matches(.,'\\{.*\\}')] except descendant-or-self::fx-model/descendant-or-self::node()/(., @*)",this,this);this.storedTemplateExpressions||(this.storedTemplateExpressions=[]),Array.from(e).forEach(e=>{if(this.storedTemplateExpressionByNode.has(e))return;const t=this._getTemplateExpression(e);this.storedTemplateExpressionByNode.set(e,t)}),this._processTemplateExpressions()}_processTemplateExpressions(){for(const e of this.storedTemplateExpressionByNode.keys())this._processTemplateExpression({node:e,expr:this.storedTemplateExpressionByNode.get(e)})}_processTemplateExpression(e){const{expr:t}=e,{node:n}=e;this.evaluateTemplateExpression(t,n,this)}evaluateTemplateExpression(e,t){if("{}"===e)return;const n=e.match(/{[^}]*}/g);t.nodeType===t.TEXT_NODE?t.parentNode:t.ownerElement;n&&n.forEach(n=>{let r=n.substring(1,n.length-1);const a=wt(t,r);if(!a){(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ATTRIBUTE_NODE)&&t.parentNode;return}const o=Qe.getInstanceId(r),i=this.getModel().getInstance(o);try{const o=ct(r,a,t,null,i),s=e.replaceAll(n,o);if(t.nodeType===Node.ATTRIBUTE_NODE){t.ownerElement.setAttribute(t.nodeName,s)}else t.nodeType===Node.TEXT_NODE&&(t.textContent=s);s.includes("{")&&(r=s.substring(1,s.length),this.evaluateTemplateExpression(s,t))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:e}))}})}_getTemplateExpression(e){return e.nodeType===Node.ATTRIBUTE_NODE?e.value:e.nodeType===Node.TEXT_NODE?e.textContent.trim():null}_handleModelConstructDone(){this._initUI()}async _lazyCreateInstance(){const e=this.querySelector("fx-model");if(0===e.instances.length){const t=document.createElement("fx-instance");e.appendChild(t);const n=document.implementation.createDocument(null,"data",null);this._generateInstance(this,n.firstElementChild),t.instanceData=n,e.instances.push(t)}}_generateInstance(e,t){if(e.hasAttribute("ref")&&!ze.isActionElement(e.nodeName)){const n=e.getAttribute("ref");if(n.includes("/")){n.split("/").forEach(n=>{t=this._generateNode(t,n,e)})}else t=this._generateNode(t,n,e)}if(e.hasChildNodes()){const n=e.children;for(let e=0;e\n "}async submit(){await this.dispatch("submit",{submission:this}),this._submit()}async _submit(){this.evalInContext();const e=this.getModel();if(e.recalculate(),this.validate){if(!e.revalidate())return this.dispatch("submit-error",{}),void this.getModel().parentNode.refresh()}await this._serializeAndSend()}_evaluateAttributeTemplateExpression(e,t){const n=e.match(/{[^}]*}/g);return n&&n.forEach(n=>{const r=n.substring(1,n.length-1),a=ct(r,wt(t,r),this.getOwnerForm()),o=e.replaceAll(n,a);e=o}),e}async _serializeAndSend(){const e=this._evaluateAttributeTemplateExpression(this.url,this),t=this.getInstance();let n;if("none"===this.serialization)n=void 0;else{const e=this.selectRelevant(t.type);n=this._serialize(t.type,e)}if("get"===this.method.toLowerCase()&&(n=void 0),"#echo"===e){let e=null;return n&&"xml"===t.type&&(e=(new DOMParser).parseFromString(n,"application/xml")),n&&"json"===t.type&&(e=JSON.parse(n)),this._handleResponse(e),void this.dispatch("submit-done",{})}const r=this._getHeaders();if("urlencoded-post"===this.method&&(this.method="post"),!this.methods.includes(this.method.toLowerCase()))return void this.dispatch("error",{message:"Unknown method "+this.method});const a=await fetch(e,{method:this.method,mode:"cors",credentials:"include",headers:r,body:n});if(!a.ok||a.status>400)return void this.dispatch("submit-error",{message:"Error while submitting "+this.id});const o=a.headers.get("content-type").toLowerCase();if(o.startsWith("text/plain")||o.startsWith("text/html")||o.startsWith("text/markdown")){const e=await a.text();this._handleResponse(e)}else if(o.startsWith("application/json")){const e=await a.json();this._handleResponse(e)}else if(o.startsWith("application/xml")){const e=await a.text(),t=(new DOMParser).parseFromString(e,"application/xml");this._handleResponse(t)}else{const e=await a.blob();this._handleResponse(e)}this.dispatch("submit-done",{})}_serialize(e,t){if("urlencoded-post"===this.method){const e=new URLSearchParams;return Array.from(t.children).forEach(t=>{e.append(t.nodeName,t.textContent)}),e}if("xml"===e){return(new XMLSerializer).serializeToString(t)}if("json"===e)return JSON.stringify(t);throw new Error("unknown instance type ",e)}_getHeaders(){const e=new Headers,t=this.getInstance(),n=ze.getContentType(t,this.method);e.append("Content-Type",n),e.has("Accept")&&e.delete("Accept");const r=this.querySelectorAll("fx-header");return Array.from(r).forEach(t=>{const{name:n}=t,r=t.getValue();e.append(n,r)}),e}_getUrlExpr(){return this.storedTemplateExpressions.find(e=>"url"===e.node.nodeName)}_getTargetInstance(){let e;if(e=this.instance?this.model.getInstance(this.instance):this.model.getInstance("default"),!e)throw new Error("target instance not found: "+e);return e}_handleResponse(e){if("instance"===this.replace){const t=this._getTargetInstance();if(!t)throw new Error("target instance not found: "+t);if(this.targetref){const n=ot(this.targetref,t.instanceData.firstElementChild,this),r=e.firstElementChild;n.parentNode.replaceChild(r,n)}else if(this.into){ot(this.into,t.instanceData.firstElementChild,this).innerHTML=e}else{const n=e;t.instanceData=n}this.model.updateModel(),this.getOwnerForm().refresh()}if("all"===this.replace&&(document.getElementsByTagName("html")[0].innerHTML=e),"target"===this.replace){const t=this.getAttribute("target");document.querySelector(t).innerHTML=e}"redirect"===this.replace&&(window.location.href=e)}selectRelevant(e){switch(e){case"xml":return this._relevantXmlNodes();default:return this.nodeset}}_relevantXmlNodes(){if("keep"===this.nonrelevant)return this.nodeset;const e=this.getModel().getModelItem(this.nodeset);if(e&&!e.relevant)return null;const t=(new DOMParser).parseFromString("","application/xml").firstElementChild;return 0===this.nodeset.children.length&&this._isRelevant(this.nodeset)?this.nodeset:this._filterRelevant(this.nodeset,t)}_filterRelevant(e,t){const{childNodes:n}=e;return Array.from(n).forEach(e=>{if(this._isRelevant(e)){const n=e.cloneNode(!1);t.appendChild(n);const{attributes:r}=e;return r&&Array.from(r).forEach(e=>{this._isRelevant(e)?n.setAttribute(e.nodeName,e.value):"empty"===this.nonrelevant?n.setAttribute(e.nodeName,""):n.removeAttribute(e.nodeName)}),this._filterRelevant(e,n)}return null}),t}_isRelevant(e){const t=this.getModel().getModelItem(e);return!(t&&!t.relevant)}_handleError(){this.dispatch("submit-error",{})}}customElements.define("fx-submission",Tt);class It extends(xt(HTMLElement)){constructor(){if(super(),this.style.display="none",this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML="",!this.hasAttribute("name"))throw new Error('required attribute "name" missing');this.name=this.getAttribute("name")}connectedCallback(){this.shadowRoot.innerHTML=""}}customElements.define("fx-header",It);class Ct extends(xt(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"}),this.name="",this.valueQuery="",this.value=null}connectedCallback(){this.name=this.getAttribute("name"),this.valueQuery=this.getAttribute("value")}refresh(){const e=wt(this,this.valueQuery);this.value=ot(this.valueQuery,e,this,this.precedingVariables)}setInScopeVariables(e){e.has(this.name)?this.dispatch("xforms-binding-error"):(e.set(this.name,this),this.inScopeVariables=new Map(e))}}customElements.define("fx-var",Ct);class St extends(xt(HTMLElement)){constructor(){super(),this.value="",this.display=this.style.display,this.required=!1,this.readonly=!1,this.widget=null}getWidget(){throw new Error("You have to implement the method getWidget!")}async refresh(e){const t=this.value;if(!this.isNotBound()&&(this.evalInContext(),this.isBound())){if(null===this.nodeset)return void(this.style.display="none");if(this.modelItem=this.getModelItem(),this.modelItem instanceof mt){if(this.value=this.modelItem.value,this.modelItem.boundControls.includes(this)||this.modelItem.boundControls.push(this),await this.updateWidgetValue(),this.handleModelItemProperties(),!this.getOwnerForm().ready)return;t!==this.value&&ze.dispatch(this,"value-changed",{path:this.modelItem.path})}}}async updateWidgetValue(){throw new Error("You have to implement the method updateWidgetValue!")}handleModelItemProperties(){this.handleRequired(),this.handleReadonly(),this.getOwnerForm().ready&&this.handleValid(),this.handleRelevant()}_getForm(){return this.getModel().parentNode}_dispatchEvent(e){this.getOwnerForm().ready&&this.dispatch(e,{})}handleRequired(){this.widget=this.getWidget(),this.isRequired()!==this.modelItem.required&&(this.modelItem.required?(this.widget.setAttribute("required","required"),this.classList.add("required"),this._dispatchEvent("required")):(this.widget.removeAttribute("required"),this.required=!1,this.classList.toggle("required"),this._dispatchEvent("optional")))}handleReadonly(){this.isReadonly()!==this.modelItem.readonly&&(this.modelItem.readonly&&(this.widget.setAttribute("readonly","readonly"),this.classList.toggle("readonly"),this._dispatchEvent("readonly")),this.modelItem.readonly||(this.widget.removeAttribute("readonly"),this.classList.toggle("readonly"),this._dispatchEvent("readwrite")))}handleValid(){const e=this.querySelector("fx-alert");if(this.isValid()!==this.modelItem.constraint)if(this.modelItem.constraint)this.classList.remove("invalid"),e&&(e.style.display="none"),this._dispatchEvent("valid");else{if(this.classList.add("invalid"),e&&(e.style.display="block"),0!==this.modelItem.alerts.length){const{alerts:e}=this.modelItem;this.querySelector("fx-alert")||e.forEach(e=>{const t=document.createElement("fx-alert");t.innerHTML=e,this.appendChild(t),t.style.display="block"})}this._dispatchEvent("invalid")}}handleRelevant(){this.isEnabled()!==this.modelItem.relevant&&(this.modelItem.relevant?(this._dispatchEvent("relevant"),this.style.display=this.display):(this._dispatchEvent("nonrelevant"),this.style.display="none"))}isRequired(){return!!this.widget.hasAttribute("required")}isValid(){return!this.classList.contains("invalid")}isReadonly(){return!!this.widget.hasAttribute("readonly")}isEnabled(){return"none"!==this.style.display}_fadeOut(e){e.style.opacity=1,function t(){(e.style.opacity-=.1)<0?e.style.display="none":requestAnimationFrame(t)}()}_fadeIn(e,t){e.style.opacity=0,e.style.display=t||"block",function t(){let n=parseFloat(e.style.opacity);(n+=.1)>1||(e.style.opacity=n,requestAnimationFrame(t))}()}}window.customElements.define("fx-abstract-control",St);customElements.define("fx-alert",class extends St{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML="\n \n \n \n \n "}async updateWidgetValue(){this.innerHTML=this.value}});class Ot extends St{constructor(){super(),this.inited=!1,this.attachShadow({mode:"open"})}connectedCallback(){this.updateEvent=this.hasAttribute("update-event")?this.getAttribute("update-event"):"blur",this.valueProp=this.hasAttribute("value-prop")?this.getAttribute("value-prop"):"value",this.label=this.hasAttribute("label")?this.getAttribute("label"):null;this.shadowRoot.innerHTML=`\n \n ${this.renderHTML(this.ref)}\n `,this.widget=this.getWidget(),"enter"===this.updateEvent&&(this.widget.addEventListener("keyup",e=>{13===e.keyCode&&(e.preventDefault(),this.setValue(this.widget[this.valueProp]))}),this.updateEvent="blur"),this.widget.addEventListener(this.updateEvent,()=>{this.setValue(this.widget[this.valueProp])});this.shadowRoot.querySelector("slot");this.template=this.querySelector("template")}setValue(e){const t=this.getModelItem(),n=this.shadowRoot.getElementById("setvalue");n.setValue(t,e),n.actionPerformed()}renderHTML(e){return`\n ${this.label?""+this.label:""}\n \n \n `}getWidget(){if(this.widget)return this.widget;let e=this.querySelector(".widget");if(e||(e=this.querySelector("input")),!e){const e=document.createElement("input");return e.classList.add("widget"),e.setAttribute("type","text"),this.appendChild(e),e}return e}async updateWidgetValue(){if("checked"===this.valueProp)"true"===this.value?this.widget.checked=!0:this.widget.checked=!1;else{let{widget:e}=this;if(e||(e=this),this.hasAttribute("as")){if("text"===this.getAttribute("as")){const t=new XMLSerializer,n=ze.prettifyXml(t.serializeToString(this.nodeset));e.value=n}}else e.value=this.value}}getTemplate(){return this.querySelector("template")}async refresh(e){super.refresh();const t=this.getWidget();if(t.hasAttribute("ref")){const e=t.getAttribute("ref"),n=ot(e,wt(this,e),this),{children:r}=t;if(Array.from(r).forEach(e=>{"template"!==e.nodeName.toLowerCase()&&e.parentNode.removeChild(e)}),this.template)if(n.length)Array.from(n).forEach(e=>{const t=this.createEntry();this.updateEntry(t,e)});else{const e=this.createEntry();this.updateEntry(e,n)}}ze.refreshChildren(this,e)}updateEntry(e,t){if("SELECT"!==this.widget.nodeName)return;const n=this._getValueAttribute(e),r=n.value,a=ot(r.substring(1,r.length-1),t,e);n.value=a,this.value===a&&e.setAttribute("selected","selected");const o=e.textContent,i=ct(o.substring(1,o.length-1),t,e);e.textContent=i}createEntry(){const e=this.template.content.firstElementChild.cloneNode(!0),t=document.importNode(e,!0);return this.template.parentNode.appendChild(t),t}_getValueAttribute(e){let t;return Array.from(e.attributes).forEach(e=>{-1!==e.value.indexOf("{")&&(t=e)}),t}}window.customElements.define("fx-control",Ot);class Rt extends(xt(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML="\n \n \n \n \n ",this.getOwnerForm().registerLazyElement(this)}refresh(e){!e&&this.hasAttribute("refresh-on-view")||(this.isBound()&&(this.evalInContext(),this.modelItem=this.getModelItem(),this.modelItem.boundControls.includes(this)||this.modelItem.boundControls.push(this)),this._getForm().ready&&this.handleModelItemProperties(),ze.refreshChildren(this,e))}handleModelItemProperties(){this.handleReadonly(),this.handleRelevant()}_getForm(){return this.getModel().parentNode}handleReadonly(){this.isReadonly()!==this.modelItem.readonly&&(this.modelItem.readonly&&(this.setAttribute("readonly","readonly"),this.dispatchEvent(new CustomEvent("readonly",{}))),this.modelItem.readonly||(this.removeAttribute("readonly"),this.dispatchEvent(new CustomEvent("readwrite",{}))))}handleRelevant(){this.modelItem&&this.isEnabled()!==this.modelItem.enabled&&(this.modelItem.enabled?this.dispatchEvent(new CustomEvent("enabled",{})):this.dispatchEvent(new CustomEvent("disabled",{})))}isReadonly(){return!!this.hasAttribute("readonly")}isEnabled(){return"none"!==this.style.display}}window.customElements.define("fx-container",Rt); +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +const Dt="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,Ut=`{{lit-${String(Math.random()).slice(2)}}}`,Mt=`\x3c!--${Ut}--\x3e`,Gt=e=>-1!==e.index,kt=()=>document.createComment(""),Ft=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/,Pt=new WeakMap,Ht=e=>"function"==typeof e&&Pt.has(e),jt={},Xt={}; +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +class _t{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this.options=n}update(e){let t=0;for(const n of this.__parts)void 0!==n&&n.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=Dt?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],n=this.template.parts,r=document.createTreeWalker(e,133,null,!1);let a,o=0,i=0,s=r.nextNode();for(;oe}),Vt=` ${Ut} `;class Yt{constructor(e,t,n,r){this.strings=e,this.values=t,this.type=n,this.processor=r}getHTML(){const e=this.strings.length-1;let t="",n=!1;for(let r=0;r-1||n)&&-1===e.indexOf("--\x3e",a+1);const o=Ft.exec(e);t+=null===o?e+(n?Vt:Mt):e.substr(0,o.index)+o[1]+o[2]+"$lit$"+o[3]+Ut}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==Lt&&(t=Lt.createHTML(t)),e.innerHTML=t,e}} +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */const qt=e=>null===e||!("object"==typeof e||"function"==typeof e),Qt=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class Jt{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e{for(;t!==n;){const n=t.nextSibling;e.removeChild(t),t=n}})(this.startNode.parentNode,e.nextSibling,this.endNode)}}class Wt{constructor(e,t,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=n}setValue(e){this.__pendingValue=e}commit(){for(;Ht(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=jt,e(this)}if(this.__pendingValue===jt)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=jt}}class $t extends Jt{constructor(e,t,n){super(e,t,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new Zt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class Zt extends Kt{}let en=!1;(()=>{try{const e={get capture(){return en=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class tn{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;Ht(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=jt,e(this)}if(this.__pendingValue===jt)return;const e=this.__pendingValue,t=this.value,n=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),r=null!=e&&(null==t||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),r&&(this.__options=nn(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=jt}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const nn=e=>e&&(en?{capture:e.capture,passive:e.passive,once:e.once}:e.capture) +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */;const rn=new class{handleAttributeExpressions(e,t,n,r){const a=t[0];if("."===a){return new $t(e,t.slice(1),n).parts}if("@"===a)return[new tn(e,t.slice(1),r.eventContext)];if("?"===a)return[new Wt(e,t.slice(1),n)];return new Jt(e,t,n).parts}handleTextExpression(e){return new zt(e)}}; +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const an=(e,...t)=>new Yt(e,t,"html",rn) +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */;void 0===window.ShadyCSS||window.ShadyCSS.prepareTemplateDom +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */,window.JSCompiler_renameProperty=(e,t)=>e +/** +@license +Copyright (c) 2019 The Polymer Project Authors. All rights reserved. +This code may only be used under the BSD style license found at +http://polymer.github.io/LICENSE.txt The complete set of authors may be found at +http://polymer.github.io/AUTHORS.txt The complete set of contributors may be +found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as +part of the polymer project is also subject to an additional IP rights grant +found at http://polymer.github.io/PATENTS.txt +*/;const on=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,sn=Symbol();class un{constructor(e,t){if(t!==sn)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(on?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const cn=(e,...t)=>{const n=t.reduce((t,n,r)=>t+(e=>{if(e instanceof un)return e.cssText;if("number"==typeof e)return e;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(n)+e[r+1],e[0]);return new un(n,sn)}; +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");window.customElements.define("fx-group",class extends Rt{static get properties(){return{...super.properties,collapse:{type:Boolean,reflect:!0}}}constructor(){super(),this.collapse=!1}render(){return an``}handleModelItemProperties(){this.handleRelevant()}initializeChildren(e){Array.from(e.children).forEach(e=>{if(ze.isUiElement(e.nodeName))e.init(this.model);else if(0!==e.children.length){Array.from(e.children).forEach(e=>{this.initializeChildren(e)})}})}});customElements.define("fx-hint",class extends St{static get styles(){return cn`:host{display:block;height:auto;font-size:.8em;font-weight:400;font-style:italic}`}static get properties(){return{...super.properties}}render(){return an``}});customElements.define("fx-output",class extends St{static get properties(){return{...super.properties,valueAttr:{type:String}}}constructor(){super(),this.attachShadow({mode:"open"}),this.valueAttr=this.hasAttribute("value")?this.getAttribute("value"):null}connectedCallback(){this.shadowRoot.innerHTML='\n \n \n \n \n \n \n \n ',this.mediatype=this.hasAttribute("mediatype")?this.getAttribute("mediatype"):null,this.addEventListener("slotchange",e=>{})}async refresh(){this.ref&&await super.refresh(),this.valueAttr&&(this.value=this.getValue(),await this.updateWidgetValue())}getValue(){try{const e=wt(this,this.valueAttr);return this.hasAttribute("html")?ot(this.valueAttr,e,this):function(e,t,n,r=null,a=n){const o=nt(e,t,n);return Xe(e,t,r,{},{currentContext:{formElement:n},functionNameResolver:rt,moduleImports:{xf:We},namespaceResolver:o})}(this.valueAttr,e,this)[0]}catch(e){this.dispatch("error",{message:e})}return null}getWidget(){return this.shadowRoot.getElementById("value")}async updateWidgetValue(){const e=this.shadowRoot.getElementById("value");if("markdown"===this.mediatype){const e=markdown(this.nodeset);this.innerHtml=e}if("html"!==this.mediatype)e.innerHTML=this.value;else{if(this.modelItem.node){const{node:e}=this.modelItem;return e.nodeType?void this.appendChild(e):void Object.entries(e).map(e=>{this.appendChild(e[1])})}e.innerHTML=this.value.outerHTML}}isReadonly(){return this.readonly=!0,this.readonly}});class ln extends(xt(HTMLElement)){static get properties(){return{inited:{type:Boolean}}}constructor(){super(),this.inited=!1,this.addEventListener("click",this._dispatchIndexChange),this.addEventListener("focusin",this._dispatchIndexChange),this.attachShadow({mode:"open",delegatesFocus:!0})}_handleFocus(){this.parentNode.setIndex(this.index)}_dispatchIndexChange(){this.parentNode&&this.parentNode.dispatchEvent(new CustomEvent("item-changed",{composed:!0,bubbles:!0,detail:{item:this}}))}connectedCallback(){this.display=this.style.display;this.shadowRoot.innerHTML="\n \n \n \n ",this.getOwnerForm().registerLazyElement(this)}disconnectedCallback(){this.removeEventListener("click",this._dispatchIndexChange()),this.removeEventListener("focusin",this._handleFocus)}init(){this.inited=!0}getModelItem(){return super.getModelItem(),this.getModelItem()[this.index]}refresh(e){this.modelItem=this.getModel().getModelItem(this.nodeset),this.modelItem&&!this.modelItem.relevant?this.style.display="none":this.style.display=this.display,ze.refreshChildren(this,e)}}window.customElements.define("fx-repeatitem",ln);class pn extends(xt(HTMLElement)){static get properties(){return{...super.properties,index:{type:Number},template:{type:Object},focusOnCreate:{type:String},initDone:{type:Boolean},repeatIndex:{type:Number},nodeset:{type:Array}}}constructor(){super(),this.ref="",this.dataTemplate=[],this.focusOnCreate="",this.initDone=!1,this.repeatIndex=1,this.nodeset=[],this.inited=!1,this.index=1,this.repeatSize=0,this.attachShadow({mode:"open",delegatesFocus:!0})}get repeatSize(){return this.querySelectorAll(":scope > fx-repeatitem").length}set repeatSize(e){this.size=e}setIndex(e){this.index=e;const t=this.querySelectorAll(":scope > fx-repeatitem");this.applyIndex(t[this.index-1])}applyIndex(e){this._removeIndexMarker(),e&&e.setAttribute("repeat-index","")}get index(){return this.getAttribute("index")}set index(e){this.setAttribute("index",e)}connectedCallback(){this.ref=this.getAttribute("ref"),this.addEventListener("item-changed",e=>{const{item:t}=e.detail,n=Array.from(this.children).indexOf(t);this.applyIndex(this.children[n]),this.index=n+1}),document.addEventListener("index-changed",e=>{if(e.stopPropagation(),!e.target===this)return;const{index:t}=e.detail;this.index=Number(t),this.applyIndex(this.children[t-1])}),this.mutationObserver=new MutationObserver(e=>{if("childList"===e[0].type){const t=e[0].addedNodes[0];if(t){const e=Qe.getPath(t);this.dispatch("path-mutated",{path:e,index:this.index})}}}),this.getOwnerForm().registerLazyElement(this);this.shadowRoot.innerHTML='\n \n \n \n \n \n '}init(){this._evalNodeset(),this._initTemplate(),this._initRepeatItems(),this.setAttribute("index",this.index),this.inited=!0}_evalNodeset(){const e=wt(this.getAttributeNode("ref")||this,this.ref);this.mutationObserver&&e.nodeName&&this.mutationObserver.observe(e,{childList:!0,subtree:!0});const t=ot(this.ref,e,this);if(null!==t){if("object"==typeof t){if("nodeType"in t)return void(this.nodeset=[t]);if(Array.isArray(t))return void(this.nodeset=t)}throw new Error("Unexpected result of repeat nodeset: "+t)}this.nodeset=[]}async refresh(e){this.inited||this.init(),this._evalNodeset();const t=this.querySelectorAll(":scope > fx-repeatitem"),n=t.length;let r=1;Array.isArray(this.nodeset)&&(r=this.nodeset.length);const a=r;if(aa;e-=1){const n=t[e-1];n.parentNode.removeChild(n),this.getOwnerForm().unRegisterLazyElement(n)}if(a>n)for(let e=n+1;e<=a;e+=1){const t=document.createElement("fx-repeatitem"),n=this._clone();t.appendChild(n),this.appendChild(t),this._initVariables(t),t.nodeset=this.nodeset[e-1],t.index=e,this.getOwnerForm().someInstanceDataStructureChanged=!0}for(let e=0;e1||(e.style.opacity=n,requestAnimationFrame(t))}())}_initTemplate(){this.template=this.querySelector("template"),null===this.template&&this.dispatchEvent(new CustomEvent("no-template-error",{composed:!0,bubbles:!0,detail:{message:"no template found for repeat:"+this.id}})),this.shadowRoot.appendChild(this.template)}_initRepeatItems(){this.nodeset.forEach((e,t)=>{const n=document.createElement("fx-repeatitem");n.nodeset=this.nodeset[t],n.index=t+1;const r=this._clone();n.appendChild(r),this.appendChild(n),1===n.index&&this.applyIndex(n),this._initVariables(n)})}_initVariables(e){const t=new Map(this.inScopeVariables);e.setInScopeVariables(t),function e(n){for(const r of n.children)"setInScopeVariables"in r&&r.setInScopeVariables(t),e(r)}(e)}_clone(){this.template=this.shadowRoot.querySelector("template");const e=this.template.content.cloneNode(!0);return document.importNode(e,!0)}_removeIndexMarker(){Array.from(this.children).forEach(e=>{e.removeAttribute("repeat-index")})}setInScopeVariables(e){this.inScopeVariables=new Map(e)}}window.customElements.define("fx-repeat",pn);window.customElements.define("fx-switch",class extends Rt{connectedCallback(){super.connectedCallback&&super.connectedCallback();this.shadowRoot.innerHTML="\n \n \n \n \n "}refresh(){super.refresh();const e=this.querySelectorAll("fx-case");if(this.isBound())Array.from(e).forEach(e=>{e.getAttribute("name")===this.modelItem.value?e.classList.add("selected-case"):e.classList.remove("selected-case")});else{this.querySelector(".selected-case")||e[0].classList.add("selected-case")}ze.refreshChildren(this)}toggle(e){const t=this.querySelectorAll("fx-case");Array.from(t).forEach(t=>{e===t?t.classList.add("selected-case"):t.classList.remove("selected-case")})}});customElements.define("fx-trigger",class extends St{connectedCallback(){this.attachShadow({mode:"open"}),this.ref=this.hasAttribute("ref")?this.getAttribute("ref"):null;this.shadowRoot.innerHTML=`\n \n ${this.renderHTML()}\n `;const e=this.shadowRoot.querySelector("slot");e.addEventListener("slotchange",()=>{const t=e.assignedElements({flatten:!0});t[0].setAttribute("tabindex","0"),t[0].setAttribute("role","button");const n=t[0];n.addEventListener("click",e=>this.performActions(e)),this.widget=n,"BUTTON"!==n.nodeName&&n.addEventListener("keypress",e=>{"Space"!==e.code&&"Enter"!==e.code||this.performActions(e)})})}renderHTML(){return"\n \n "}getWidget(){return this.widget}async updateWidgetValue(){return null}handleReadonly(){super.handleReadonly(),this.widget.hasAttribute("readonly")?this.widget.setAttribute("disabled","disabled"):this.widget.removeAttribute("disabled")}async performActions(e){const t=this.closest("fx-repeatitem");t&&t.click(),this.querySelectorAll("fx-var").forEach(e=>e.refresh());(async()=>{for(let t=0;t${this.label}`:""}\n \n `;this.shadowRoot.innerHTML=`\n \n ${e}\n `,this.style.display="none"}}window.customElements.define("fx-case",hn);class fn extends HTMLElement{connectedCallback(){const e=Array.from(document.querySelectorAll("fx-instance"));this.innerHTML=`\n \n \n ${e.map((e,t)=>`\n
\n ${e.id}\n
{log('${e.id}')}
\n
\n `).join("")}\n `,this.addEventListener("slotchange",e=>{})}}customElements.define("fx-inspector",fn);class dn extends HTMLElement{static get properties(){return{id:String}}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML=this.render("\n :host {\n display:none;\n height: 100vh;\n width:100vw;\n position:fixed;\n left:0;\n top:0;\n right:0;\n bottom:0;\n transition:opacity 0.4s linear;\n }\n\n "),this.id=this.getAttribute("id");const e=this.querySelector(".close-dialog");e&&e.addEventListener("click",e=>{document.getElementById(this.id).classList.remove("show")}),this.addEventListener("transitionend",()=>{}),this.focus()}render(e){return`\n \n \n `}open(){window.addEventListener("keyup",e=>{"Escape"===e.key&&this.hide()},{once:!0}),this.classList.add("show")}async hide(){await ze.fadeOutElement(this,400),this.classList.remove("show")}}customElements.define("fx-dialog",dn);async function mn(e){return new Promise(t=>setTimeout(()=>t(),e))}customElements.define("fx-items",class extends Ot{static get properties(){return{...super.properties,valueAttr:{type:String}}}constructor(){super(),this.valueAttr=this.hasAttribute("value")?this.getAttribute("value"):null}connectedCallback(){super.connectedCallback(),this.addEventListener("click",e=>{const t=this.querySelectorAll("[value]");let n;"LABEL"===e.target.nodeName&&(n=document.getElementById(e.target.getAttribute("for")),n.checked=!n.checked);let r="";Array.from(t).forEach(e=>{e.checked&&(r+=" "+e.getAttribute("value"))}),this.setAttribute("value",r.trim());const a=this.parentNode.closest("[ref]");if(!a)return;const o=a.getModelItem(),i=this.shadowRoot.getElementById("setvalue");i.setValue(o,r.trim()),i.actionPerformed()})}getWidget(){return this}async updateWidgetValue(){const e=this.parentNode.closest("[ref]");e&&(this.value=e.value),this.setAttribute("value",this.value)}updateEntry(e,t){const n=e.querySelector("label");n.textContent=t.textContent;const r=ze.createUUID();n.setAttribute("for",r);const a=e.querySelector("[value]"),o=a.value,i=ct(o.substring(1,o.length-1),t,e),s=` ${i} `,u=` ${this.getAttribute("value")} `;a.value=i,a.setAttribute("id",r),-1!==u.indexOf(s)&&(a.checked=!0)}});class gn extends(xt(HTMLElement)){static get properties(){return{...super.properties,detail:{type:Object},needsUpdate:{type:Boolean},event:{type:Object},target:{type:String},ifExpr:{type:String},whileExpr:{type:String},delay:{type:Number}}}constructor(){super(),this.detail={},this.needsUpdate=!1}connectedCallback(){this.style.display="none",this.repeatContext=void 0,this.hasAttribute("event")?this.event=this.getAttribute("event"):this.event="activate",this.target=this.getAttribute("target"),this.target?"#window"===this.target?window.addEventListener(this.event,e=>this.execute(e)):"#document"===this.target?document.addEventListener(this.event,e=>this.execute(e)):(this.targetElement=document.getElementById(this.target),this.targetElement.addEventListener(this.event,e=>this.execute(e))):(this.targetElement=this.parentNode,this.targetElement.addEventListener(this.event,e=>this.execute(e))),this.ifExpr=this.hasAttribute("if")?this.getAttribute("if"):null,this.whileExpr=this.hasAttribute("while")?this.getAttribute("while"):null,this.delay=this.hasAttribute("delay")?Number(this.getAttribute("delay")):0}async execute(e){if(e&&e.detail&&(this.detail=e.detail),this.needsUpdate=!1,this.evalInContext(),this.targetElement&&this.targetElement.nodeset&&(this.nodeset=this.targetElement.nodeset),!this.ifExpr||ut(this.ifExpr,wt(this),this)){if(this.whileExpr){const e=async()=>{await mn(this.delay||0),this.ownerDocument.contains(this)&&ut(this.whileExpr,wt(this),this)&&(this.perform(),await e())};return await e(),void this.actionPerformed()}!this.delay||(await mn(this.delay),this.ownerDocument.contains(this))?(this.perform(),this.actionPerformed()):this.actionPerformed()}}perform(){(this.isBound()||"FX-ACTION"===this.nodeName)&&this.evalInContext()}actionPerformed(){if(this.needsUpdate){const e=this.getModel();e.recalculate(),e.revalidate(),e.parentNode.refresh(!0),this.dispatchActionPerformed()}}dispatchActionPerformed(){this.dispatchEvent(new CustomEvent("action-performed",{composed:!0,bubbles:!0,detail:{}}))}}window.customElements.define("abstract-action",gn);window.customElements.define("fx-append",class extends gn{static get properties(){return{ref:{type:String},repeat:{type:String},clear:{type:String}}}constructor(){super(),this.repeat=""}connectedCallback(){super.connectedCallback(),this.ref=this.getAttribute("ref"),this.repeat=this.getAttribute("repeat")}perform(){super.perform(),this._dataFromTemplate(),this.needsUpdate=!0}actionPerformed(){super.actionPerformed(),this.dispatch()}_dataFromTemplate(){const e=this.getInScopeContext(),t=this.getOwnerForm().querySelector("#"+this.repeat),n=t.shadowRoot.querySelector("template"),r=e.ownerDocument.createElement(t.ref),a=this._generateInstance(n.content,r);e.appendChild(a)}dispatch(){let e;e=ze.isRepeated(this)?ze.getRepeatTarget(this,this.repeat):document.getElementById(this.repeat),e.dispatchEvent(new CustomEvent("index-changed",{composed:!0,bubbles:!0,detail:{index:e.nodeset.length}}))}_clear(e){let t=e.firstChild;const n=e.attributes;for(let e=0;ea?n.setIndex(a):n.setIndex(t)}this.needsUpdate=!0}actionPerformed(){this.getModel().rebuild(),super.actionPerformed()}});window.customElements.define("fx-insert",class extends gn{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback&&super.connectedCallback();this.shadowRoot.innerHTML="\n \n \n ",this.at=Number(this.hasAttribute("at")?this.getAttribute("at"):0),this.position=this.hasAttribute("position")?this.getAttribute("position"):"after",this.origin=this.hasAttribute("origin")?this.getAttribute("origin"):null,this.keepValues=!!this.hasAttribute("keep-values")}_cloneOriginSequence(e,t){let n;if(this.origin){let t;try{t=it(this.origin,e,this.getOwnerForm()),Array.isArray(t)&&0===t.length&&(n=null),n=t.cloneNode(!0)}catch(e){}}else t&&(n=this._cloneTargetSequence(t),n&&!this.keepValues&&this._clear(n));return n}_getInsertIndex(e,t){return 0===t.length?null:this.hasAttribute("at")?lt(this.getAttribute("at"),e,this.getOwnerForm()):t.length}perform(){let e,t;this.hasAttribute("context")&&(e=wt(this.getAttributeNode("context"),this.getAttribute("context")),t=st(this.getAttribute("context"),e,this.getOwnerForm())),this.hasAttribute("ref")&&(e||(e=wt(this.getAttributeNode("ref"),this.ref)),t=st(this.ref,e,this.getOwnerForm()));const n=this._cloneOriginSequence(e,t);if(!n)return;let r,a;if(0===t.length)r=e,e.appendChild(n),a=1;else{if(this.hasAttribute("at")?(a=lt(this.getAttribute("at"),e,this.getOwnerForm()),r=t[a-1]):(a=t.length,r=t[t.length-1]),!r){a=1,r=t;a=ot("count(preceding::*)",t,this.getOwnerForm())+1}if(this.position&&"before"===this.position&&r.parentNode.insertBefore(n,r),this.position&&"after"===this.position)if(a+=1,this.hasAttribute("context")&&this.hasAttribute("ref"))e.append(n);else if(this.hasAttribute("context")){this.getAttribute("context");a=1,r.prepend(n)}else r.insertAdjacentElement("afterend",n)}document.dispatchEvent(new CustomEvent("index-changed",{composed:!0,bubbles:!0,detail:{insertedNodes:n,index:a}})),this.needsUpdate=!0}_cloneTargetSequence(e){return Array.isArray(e)&&0!==e.length?e[e.length-1].cloneNode(!0):!Array.isArray(e)&&e?e.cloneNode(!0):null}actionPerformed(){this.getModel().rebuild(),super.actionPerformed()}_clear(e){const t=e.attributes;for(let e=0;e\n \n :host{\n display:none;\n }\n \n \n ${this.renderHTML()}\n `}disconnectedCallback(){this.targetElement.removeEventListener(this.event,e=>this.execute(e))}renderHTML(){return"\n \n "}perform(){let e;super.perform(),e=this.hasAttribute("value")?this.getValue():this.textContent,this.dispatchEvent(new CustomEvent("message",{composed:!0,bubbles:!0,detail:{level:this.level,message:e}}))}});window.customElements.define("fx-setvalue",class extends gn{static get properties(){return{...super.properties,ref:{type:String},valueAttr:{type:String}}}constructor(){super(),this.ref="",this.valueAttr=""}connectedCallback(){if(super.connectedCallback&&super.connectedCallback(),!this.hasAttribute("ref"))throw new Error('fx-setvalue must specify a "ref" attribute');this.ref=this.getAttribute("ref"),this.valueAttr=this.getAttribute("value")}perform(){super.perform();let{value:e}=this;e=null!==this.valueAttr?ot(this.valueAttr,this.nodeset,this,this.detail):""!==this.textContent?this.textContent:"";const t=this.getModelItem();this.setValue(t,e)}setValue(e,t){const n=e;n&&n.value!==t&&(n.value=t,this.getModel().changed.push(e),this.needsUpdate=!0)}});window.customElements.define("fx-send",class extends gn{constructor(){super(),this.value=""}connectedCallback(){super.connectedCallback(),this.submission=this.getAttribute("submission")}perform(){super.perform();const e=this.getModel().querySelector("#"+this.submission);if(null===e)throw this.dispatchEvent(new CustomEvent("error",{composed:!0,bubbles:!0,detail:{message:`fx-submission element with id: '${this.submission}' not found`}})),new Error(`submission with id: ${this.submission} not found`);e.submit()}});window.customElements.define("fx-toggle",class extends gn{connectedCallback(){super.connectedCallback(),this.hasAttribute("case")&&(this.case=this.getAttribute("case"))}perform(){if(super.perform(),this.case){const e=this.getOwnerForm().querySelector("#"+this.case);e.parentNode.toggle(e)}}});window.customElements.define("fx-dispatch",class extends gn{constructor(){super(),this.name=null,this.targetid=null,this.details=null,this.attachShadow({mode:"open"})}connectedCallback(){if(super.connectedCallback(),this.name=this.getAttribute("name"),!this.name)throw new Error("no event specified for dispatch",this);this.targetid=this.hasAttribute("targetid")?this.getAttribute("targetid"):null}perform(){const e=this.querySelectorAll("fx-property"),t={};if(Array.from(e).forEach(e=>{const n=e.getAttribute("name"),r=e.getAttribute("value"),a=e.getAttribute("expr");if(a){if(r)throw new Error('if "expr" is given there must not be a "value" attribute');const e=ot(a,this.getInScopeContext(),this.getOwnerForm());let o=null;if(e.nodeName){o=(new XMLSerializer).serializeToString(e)}t[n]=o||e}r&&(t[n]=r)}),this.targetid){let e;if(e=Qe.isRepeated(this)?pt(this.targetid,this.parentNode,null):document.getElementById(this.targetid),!e)throw new Error(`targetid ${this.targetid} does not exist in document`);e.dispatchEvent(new CustomEvent(this.name,{composed:!0,bubbles:!0,detail:t}))}else document.dispatchEvent(new CustomEvent(this.name,{composed:!0,bubbles:!0,detail:t}))}});window.customElements.define("fx-update",class extends gn{perform(){this.getModel().updateModel()}});window.customElements.define("fx-refresh",class extends gn{perform(){this.getOwnerForm().refresh()}});class yn extends gn{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.src=this.hasAttribute("src")?this.getAttribute("src"):null;this.shadowRoot.innerHTML="\n \n \n "}perform(){const{children:e}=this;if(this.src){this.innerHTML="";const e=document.createElement("script");e.src=this.src,this.appendChild(e)}else Array.from(e).forEach(e=>{if("fx-var"===e.localName)return;const t=e;t.detail=this.detail,t.execute()}),this.dispatchActionPerformed()}}window.customElements.define("fx-action",yn);window.customElements.define("fx-confirm",class extends yn{connectedCallback(){this.message=this.hasAttribute("message")?this.getAttribute("message"):null}perform(){window.confirm(this.message)&&super.perform()}});window.customElements.define("fx-show",class extends yn{connectedCallback(){this.dialog=this.getAttribute("dialog"),this.dialog||this.dispatch("error",{message:"dialog does not exist"})}perform(){document.getElementById(this.dialog).open()}});window.customElements.define("fx-hide",class extends gn{connectedCallback(){this.dialog=this.getAttribute("dialog"),this.dialog||this.dispatch("error",{message:"dialog does not exist"})}perform(){document.getElementById(this.dialog).hide()}});class vn extends(xt(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.style.display="none",this.signature=this.hasAttribute("signature")?this.getAttribute("signature"):null,this.signature,this.type=this.hasAttribute("type")?this.getAttribute("type"):null,this.shadowRoot.innerHTML="",this.override=this.hasAttribute("override")?this.getAttribute("override"):"true",this.functionBody=this.innerText;const e=this.getAttribute("type")||"text/xpath",t=this.signature.match(/(?:(?[^:]*):)?(?[^(]+)\((?(?:\(\)|[^)])*)\)(?: as (?.*))?/);if(!t)throw new Error(`Function signature ${this.signature} could not be parsed`);const{prefix:n,localName:r,params:a,returnType:o}=t.groups,i="local"===n?{namespaceURI:"http://www.w3.org/2005/xquery-local-functions",localName:r}:`${n}:${r}`,s=a?a.split(",").map(e=>{const t=e.match(/(?\$[^\s]+)(?:\sas\s(?.+))/);if(!t)throw new Error(`Param ${e} could not be parsed`);const{variableName:n,varType:r}=t.groups;return{variableName:n,variableType:r||"item()*"}}):[];switch(e){case"text/javascript":{const e=new Function("_domFacade",...s.map(e=>e.variableName),"form",this.functionBody);Ve(i,s.map(e=>e.variableType),o||"item()*",(...t)=>e.apply(this.getInScopeContext(),[...t,this.getOwnerForm()]));break}case"text/xpath":{const e=(e,...t)=>ot(this.functionBody,this.getInScopeContext(),this.getOwnerForm(),s.reduce((e,n,r)=>(e[n.variableName.replace("$","")]=t[r],e),{}));Ve(i,s.map(e=>e.variableType),o||"item()*",e);break}default:throw new Error(`Unexpected mimetype ${e} for function`)}}}customElements.define("fx-function",vn); +//# sourceMappingURL=fore-all.js.map diff --git a/src/js/fore-debug.js b/src/js/fore-debug.js deleted file mode 100644 index 28d616b..0000000 --- a/src/js/fore-debug.js +++ /dev/null @@ -1,140 +0,0 @@ -function e(e,t,n,r){const a={op:t,func:n,data:r};return e.push(a),a}function t(e,t){return e}class n{constructor(){this.program=[]}test(t,n){return e(this.program,5,t,void 0===n?null:n)}jump(t){return e(this.program,3,null,t)}record(n,r){return e(this.program,4,void 0===r?t:r,n)}bad(t=1){return e(this.program,1,null,t)}accept(){return e(this.program,0,null,null)}fail(t){return e(this.program,2,t||null,null)}}class r{constructor(e,t,n){this.programLength=e,this.maxFromByPc=t,this.maxSurvivorFromByPc=n}static fromProgram(e){const t=e.length,n=[],a=[];return e.forEach(e=>{n.push(0),a.push(0)}),e.forEach((e,r)=>{switch(e.op){case 2:if(null===e.func)return;if(r+1>=t)throw new Error("Invalid program: program could run past end");n[r+1]+=1;break;case 1:case 4:if(r+1>=t)throw new Error("Invalid program: program could run past end");n[r+1]+=1;break;case 3:e.data.forEach(e=>{if(e<0||e>=t)throw new Error("Invalid program: program could run past end");n[e]+=1});break;case 5:if(r+1>=t)throw new Error("Invalid program: program could run past end");a[r+1]+=1;break;case 0:a[r]+=1}}),new r(t,n,a)}static createStub(e){const t=[],n=[];for(let r=0;r0}}class i{constructor(e){this.t=0,this.i=0,this.h=new Uint16Array(e),this.l=new Uint8Array(e)}getBadness(e){return this.l[e]}add(e,t){this.l[e]=t>255?255:t;const n=function(e,t,n,r,a){let i=r,o=a;for(;i>>1;n255?255:t);if(this.l[e]!==n){const t=this.h.indexOf(e,this.i);if(t<0||t>=this.t)return void(this.l[e]=n);this.h.copyWithin(t,t+1,this.t),this.t-=1,this.add(e,n)}}getNextPc(){return this.i>=this.t?null:this.h[this.i++]}reset(){this.t=0,this.i=0,this.l.fill(0)}}class o{constructor(e){this.o=[];let t=e.length;e.forEach(e=>{this.o.push(e>0?t:-1),t+=e}),this.u=new Uint16Array(t)}clear(){this.u.fill(0,0,this.o.length)}add(e,t){const n=this.u[t],r=this.o[t];this.u[t]+=1,this.u[r+n]=e}has(e){return this.u[e]>0}forEach(e,t){const n=this.u[e],r=this.o[e];for(let e=r;e{const n=this.trace(t,r,a,i);var u,l,c;l=n,c=o,e=null===(u=e)?l:null===l?u:Array.isArray(l)?l.reduce((e,t)=>s(e,t,e===l),u):s(u,l,c),o=e===n}),e}trace(e,t,n,r){switch(this.p[e]){case 2:return this.v[e];case 1:return null}this.p[e]=1;let a=null;const i=t[e];if(null!==i)a=i;else if(!n.has(e))throw new Error("Trace without source at pc "+e);if(a=this.mergeTraces(a,e,n,t,n,r),null!==a){const t=r[e];null!==t&&(a=l(a,t))}return this.v[e]=a,this.p[e]=2,a}buildSurvivorTraces(e,t,n,r,a){for(let i=0,o=e.length;is(e,this.k[t]),null);return null===t?[]:Array.isArray(t)?t:[t]}}class h{constructor(e){this.I=[],this.N=new i(e.programLength),this.M=new i(e.programLength),this.P=new p(e)}reset(){this.N.reset(),this.N.add(0,0),this.I.length=0,this.P.reset(!0)}getNextThreadPc(){return this.N.getNextPc()}step(e,t,n){const r=this.P.has(t);this.P.add(e,t);const a=this.N.getBadness(e)+n;r?this.N.reschedule(t,a):this.N.add(t,a)}stepToNextGeneration(e,t){const n=this.P.hasSurvivor(t);this.P.addSurvivor(e,t);const r=this.N.getBadness(e);n?this.M.reschedule(t,r):this.M.add(t,r)}accept(e){this.I.push(e),this.P.addSurvivor(e,e)}fail(e){}record(e,t){this.P.record(e,t)}nextGeneration(){this.P.buildSurvivorTraces(),this.P.reset(!1);const e=this.N;e.reset(),this.N=this.M,this.M=e}getAcceptingTraces(){return this.P.getTraces(this.I)}}class f{constructor(e){this.U=[],this.G=e,this.V=r.fromProgram(e),this.U.push(new h(this.V))}execute(e,t){const n=this.U.pop()||new h(this.V);n.reset();const r=e.length;let i,o=-1;do{let a=n.getNextThreadPc();if(null===a)break;for(++o,i=o>=r?null:e[o];null!==a;){const e=this.G[a];switch(e.op){case 0:null===i?n.accept(a):n.fail(a);break;case 2:{const r=e.func;if(null===r||r(t)){n.fail(a);break}n.step(a,a+1,0);break}case 1:n.step(a,a+1,e.data);break;case 5:if(null===i){n.fail(a);break}if(!(0,e.func)(i,e.data,t)){n.fail(a);break}n.stepToNextGeneration(a,a+1);break;case 3:{const t=e.data,r=t.length;if(0===r){n.fail(a);break}for(let e=0;et===e}function m(e,t){if(null===e||null===t)throw new Error("unescaped hyphen may not be used as a range endpoint");if(te<=n&&n<=t}function v(e){return!0}function g(){return!1}function y(e,t){return n=>e(n)||t(n)}function w(e,t){switch(t.kind){case"predicate":return void e.test(t.value);case"regexp":return void A(e,t.value,!1)}}function A(e,t,n){const r=e.program.length,a=e.jump([]);n&&(a.data.push(e.program.length),e.test(()=>!0),e.jump([r]));const i=[];if(t.forEach(t=>{a.data.push(e.program.length),function(e,t){t.forEach(t=>{!function(e,t){const[n,{min:r,max:a}]=t;if(null!==a){for(let t=0;t0){for(let t=0;t{t.data.push(e.program.length)}),n){const t=e.program.length,n=e.jump([]);n.data.push(e.program.length),e.test(()=>!0),e.jump([t]),n.data.push(e.program.length)}}function x(e,t){return{success:!0,offset:e,value:t}}function b(e){return x(e,void 0)}function E(e,t,n=!1){return{success:!1,offset:e,expected:t,fatal:n}}function B(e){return(t,n)=>{const r=n+e.length;return t.slice(n,r)===e?x(r,e):E(n,[e])}}function N(e,t){return(n,r)=>{const a=e(n,r);return a.success?x(a.offset,t(a.value)):a}}function C(e,t,n){return(r,a)=>{const i=e(r,a);return i.success?t(i.value)?i:E(a,n):i.offset===a?E(a,n):i}}function T(e){return(t,n)=>{let r=null;for(const a of e){const e=a(t,n);if(e.success)return e;if(null===r||e.offset>r.offset?r=e:e.offset===r.offset&&(r.expected=r.expected.concat(e.expected)),e.fatal)break}return r||E(n,[])}}function I(e){return(t,n)=>{const r=e(t,n);return r.success||r.fatal?r:x(n,null)}}function O(e){return(t,n)=>{let r=[],a=n;for(;;){const n=e(t,a);if(!n.success){if(n.fatal)return n;break}r.push(n.value),a=n.offset}return x(a,r)}}function S(e,t,n){return(r,a)=>{const i=e(r,a);if(!i.success)return i;const o=t(r,i.offset);return o.success?x(o.offset,n(i.value,o.value)):o}}function D(e){return S(e,O(e),(e,t)=>[e].concat(t))}function R(e,t){return e}function G(e,t){return t}function M(e,t){return S(e,t,G)}function U(e,t){return S(e,t,R)}function F(e,t,n,r=!1){return M(e,r?H(U(t,n)):U(t,n))}function P(e,t){return(n,r)=>e(n,r).success?E(r,t):b(r)}function H(e){return(t,n)=>{const r=e(t,n);return r.success?r:E(r.offset,r.expected,!0)}}const j=(e,t)=>e.length===t?b(t):E(t,["end of input"]),X=["Lu","Ll","Lt","Lm","Lo","Mn","Mc","Me","Nd","Nl","No","Pc","Pd","Ps","Pe","Pi","Pf","Po","Zs","Zl","Zp","Sm","Sc","Sk","So","Cc","Cf","Co","Cn"],_={};function L(e){return e.codePointAt(0)}"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach((e,t)=>{_[e]=t});const k=e=>-1===e||-2===e;function Y(e){return t=>!k(t)&&!e(t)}function q(e,t){return null===t?e:n=>e(n)&&!t(n)}const V=function(e,t){const n=new Map;let r=0;return["BasicLatin","Latin-1Supplement","LatinExtended-A","LatinExtended-B","IPAExtensions","SpacingModifierLetters","CombiningDiacriticalMarks","GreekandCoptic|Greek","Cyrillic","CyrillicSupplement","Armenian","Hebrew","Arabic","Syriac","ArabicSupplement","Thaana","NKo","Samaritan","Mandaic","SyriacSupplement",null,"ArabicExtended-A","Devanagari","Bengali","Gurmukhi","Gujarati","Oriya","Tamil","Telugu","Kannada","Malayalam","Sinhala","Thai","Lao","Tibetan","Myanmar","Georgian","HangulJamo","Ethiopic","EthiopicSupplement","Cherokee","UnifiedCanadianAboriginalSyllabics","Ogham","Runic","Tagalog","Hanunoo","Buhid","Tagbanwa","Khmer","Mongolian","UnifiedCanadianAboriginalSyllabicsExtended","Limbu","TaiLe","NewTaiLue","KhmerSymbols","Buginese","TaiTham","CombiningDiacriticalMarksExtended","Balinese","Sundanese","Batak","Lepcha","OlChiki","CyrillicExtended-C","GeorgianExtended","SundaneseSupplement","VedicExtensions","PhoneticExtensions","PhoneticExtensionsSupplement","CombiningDiacriticalMarksSupplement","LatinExtendedAdditional","GreekExtended","GeneralPunctuation","SuperscriptsandSubscripts","CurrencySymbols","CombiningDiacriticalMarksforSymbols|CombiningMarksforSymbols","LetterlikeSymbols","NumberForms","Arrows","MathematicalOperators","MiscellaneousTechnical","ControlPictures","OpticalCharacterRecognition","EnclosedAlphanumerics","BoxDrawing","BlockElements","GeometricShapes","MiscellaneousSymbols","Dingbats","MiscellaneousMathematicalSymbols-A","SupplementalArrows-A","BraillePatterns","SupplementalArrows-B","MiscellaneousMathematicalSymbols-B","SupplementalMathematicalOperators","MiscellaneousSymbolsandArrows","Glagolitic","LatinExtended-C","Coptic","GeorgianSupplement","Tifinagh","EthiopicExtended","CyrillicExtended-A","SupplementalPunctuation","CJKRadicalsSupplement","KangxiRadicals",null,"IdeographicDescriptionCharacters","CJKSymbolsandPunctuation","Hiragana","Katakana","Bopomofo","HangulCompatibilityJamo","Kanbun","BopomofoExtended","CJKStrokes","KatakanaPhoneticExtensions","EnclosedCJKLettersandMonths","CJKCompatibility","CJKUnifiedIdeographsExtensionA","YijingHexagramSymbols","CJKUnifiedIdeographs","YiSyllables","YiRadicals","Lisu","Vai","CyrillicExtended-B","Bamum","ModifierToneLetters","LatinExtended-D","SylotiNagri","CommonIndicNumberForms","Phags-pa","Saurashtra","DevanagariExtended","KayahLi","Rejang","HangulJamoExtended-A","Javanese","MyanmarExtended-B","Cham","MyanmarExtended-A","TaiViet","MeeteiMayekExtensions","EthiopicExtended-A","LatinExtended-E","CherokeeSupplement","MeeteiMayek","HangulSyllables","HangulJamoExtended-B","HighSurrogates","HighPrivateUseSurrogates","LowSurrogates","PrivateUseArea|PrivateUse","CJKCompatibilityIdeographs","AlphabeticPresentationForms","ArabicPresentationForms-A","VariationSelectors","VerticalForms","CombiningHalfMarks","CJKCompatibilityForms","SmallFormVariants","ArabicPresentationForms-B","HalfwidthandFullwidthForms","Specials","LinearBSyllabary","LinearBIdeograms","AegeanNumbers","AncientGreekNumbers","AncientSymbols","PhaistosDisc",null,"Lycian","Carian","CopticEpactNumbers","OldItalic","Gothic","OldPermic","Ugaritic","OldPersian",null,"Deseret","Shavian","Osmanya","Osage","Elbasan","CaucasianAlbanian",null,"LinearA",null,"CypriotSyllabary","ImperialAramaic","Palmyrene","Nabataean",null,"Hatran","Phoenician","Lydian",null,"MeroiticHieroglyphs","MeroiticCursive","Kharoshthi","OldSouthArabian","OldNorthArabian",null,"Manichaean","Avestan","InscriptionalParthian","InscriptionalPahlavi","PsalterPahlavi",null,"OldTurkic",null,"OldHungarian","HanifiRohingya",null,"RumiNumeralSymbols",null,"OldSogdian","Sogdian",null,"Elymaic","Brahmi","Kaithi","SoraSompeng","Chakma","Mahajani","Sharada","SinhalaArchaicNumbers","Khojki",null,"Multani","Khudawadi","Grantha",null,"Newa","Tirhuta",null,"Siddham","Modi","MongolianSupplement","Takri",null,"Ahom",null,"Dogra",null,"WarangCiti",null,"Nandinagari","ZanabazarSquare","Soyombo",null,"PauCinHau",null,"Bhaiksuki","Marchen",null,"MasaramGondi","GunjalaGondi",null,"Makasar",null,"TamilSupplement","Cuneiform","CuneiformNumbersandPunctuation","EarlyDynasticCuneiform",null,"EgyptianHieroglyphs","EgyptianHieroglyphFormatControls",null,"AnatolianHieroglyphs",null,"BamumSupplement","Mro",null,"BassaVah","PahawhHmong",null,"Medefaidrin",null,"Miao",null,"IdeographicSymbolsandPunctuation","Tangut","TangutComponents",null,"KanaSupplement","KanaExtended-A","SmallKanaExtension","Nushu",null,"Duployan","ShorthandFormatControls",null,"ByzantineMusicalSymbols","MusicalSymbols","AncientGreekMusicalNotation",null,"MayanNumerals","TaiXuanJingSymbols","CountingRodNumerals",null,"MathematicalAlphanumericSymbols","SuttonSignWriting",null,"GlagoliticSupplement",null,"NyiakengPuachueHmong",null,"Wancho",null,"MendeKikakui",null,"Adlam",null,"IndicSiyaqNumbers",null,"OttomanSiyaqNumbers",null,"ArabicMathematicalAlphabeticSymbols",null,"MahjongTiles","DominoTiles","PlayingCards","EnclosedAlphanumericSupplement","EnclosedIdeographicSupplement","MiscellaneousSymbolsandPictographs","Emoticons","OrnamentalDingbats","TransportandMapSymbols","AlchemicalSymbols","GeometricShapesExtended","SupplementalArrows-C","SupplementalSymbolsandPictographs","ChessSymbols","SymbolsandPictographsExtended-A",null,"CJKUnifiedIdeographsExtensionB",null,"CJKUnifiedIdeographsExtensionC","CJKUnifiedIdeographsExtensionD","CJKUnifiedIdeographsExtensionE","CJKUnifiedIdeographsExtensionF",null,"CJKCompatibilityIdeographsSupplement",null,"Tags",null,"VariationSelectorsSupplement",null,"SupplementaryPrivateUseArea-A|PrivateUse","SupplementaryPrivateUseArea-B|PrivateUse"].forEach((e,a)=>{const i=t[a];null!==e&&e.split("|").forEach(e=>{const t=n.get(e),a=m(r,r+i-1);n.set(e,t?y(t,a):a)}),r+=i}),n}(0,[128,128,128,208,96,80,112,144,256,48,96,112,256,80,48,64,64,64,32,16,48,96,128,128,128,128,128,128,128,128,128,128,128,128,256,160,96,256,384,32,96,640,32,96,32,32,32,32,128,176,80,80,48,96,32,32,144,80,128,64,64,80,48,16,48,16,48,128,64,64,256,256,112,48,48,48,80,64,112,256,256,64,32,160,128,32,96,256,192,48,16,256,128,128,256,256,96,32,128,48,80,96,32,128,128,224,16,16,64,96,96,48,96,16,32,48,16,256,256,6592,64,20992,1168,64,48,320,96,96,32,224,48,16,64,96,32,48,48,32,96,32,96,32,96,32,48,64,80,64,11184,80,896,128,1024,6400,512,80,688,16,16,16,32,32,144,240,16,128,128,64,80,64,48,128,32,64,32,48,32,48,32,64,32,80,48,48,80,48,64,144,384,128,64,32,32,48,48,32,32,32,64,32,96,96,32,32,32,64,64,32,32,48,80,80,48,128,64,288,32,128,48,64,112,32,128,80,48,80,48,96,32,80,48,48,80,128,128,128,96,160,128,96,32,80,48,64,192,80,80,96,160,96,80,96,16,64,256,112,80,64,96,80,304,32,192,64,1024,128,208,2736,1072,16,4032,640,8576,576,48,96,48,144,688,96,96,160,64,32,6144,768,9472,256,48,64,400,2304,160,16,4944,256,256,80,144,32,96,32,128,1024,688,1360,48,208,80,368,64,1280,224,32,96,784,80,64,80,176,256,256,48,112,96,256,256,768,80,48,128,128,128,256,256,112,144,1280,42720,32,4160,224,5776,7488,3088,544,722400,128,128,240,65040,65536,65536]),J=function(e){const t=new Map,n="bfUATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAbgUATAYDaATAZAaAGARAXAcAaAZAaAXAMBZADATBZAMAGASAMCTACWXACGDXXADHA3DAAPDAAtCAAFDBCAADCAABCCDBCCABCAABCCDCCAABCAAFCAADDAABCAABCBADCBDBGACADCGDCAEADACAEADACAEADAAPDAARDACAEADAABCBA7DFCAABCBDBABCCAJjDBAAGADaFRZDFLZNFEZGFAZAFAZQnvBAAADFAZACADABBFADCTACABDZBCATACCBACABACAABCQBACIDiCADBCCDCAXDDCADAXAABCBDBCyDvAhaAHEJBA1CAANDAgfBAABAClBBFATFDoTAOABBaBYABAHsOAHATAHBTAHBTAHABHGaBDGDTBBKcFXCTBYATBaBHKTAcABATBGfFAGJHUKJTDGBHAmiBAATAGAHGcAaAHFFBHBaAHDGBKJGCaBGATNBAcAGAHAGdHaBBmYBAAHKGABNKJGgHIFBaATCFABBHAYBGVHDFAHIFAHCFAHEBBTOBAGYHCBBTABAGKB0GUBAGHBUHOcAHfIAG1HAIAHAGAICHHIDHAIBGAHGGJHBTBKJTAFAGOHAIBBAGHBBGBBBGVBAGGBAGABCGDBBHAGAICHDBBIBBBIBHAGABHIABDGBBAGCHBBBKJGBYBMFaAYAGATAHABBHBIABAGFBDGBBBGVBAGGBAGBBAGBBAGBBBHABAICHBBDHBBBHCBCHABGGDBAGABGKJHBGCHATABJHBIABAGIBAGCBAGVBAGGBAGBBAGEBBHAGAICHEBAHBIABAIBHABBGABOGBHBBBKJTAYABGGAHFBAHAIBBAGHBBGBBBGVBAGGBAGBBAGEBBHAGAIAHAIAHDBBIBBBIBHABHHAIABDGBBAGCHBBBKJaAGAMFBJHAGABAGFBCGCBAGDBCGBBAGABAGBBCGBBCGCBCGLBDIBHAIBBCICBAICHABBGABFIABNKJMCaFYAaABEHAICHAGHBAGCBAGWBAGPBCGAHCIDBAHCBAHDBGHBBAGCBEGBHBBBKJBGTAMGaAGAHAIBTAGHBAGCBAGWBAGJBAGEBBHAGAIAHAIEBAHAIBBAIBHBBGIBBGGABAGBHBBBKJBAGBBMHBIBBAGHBAGCBAGoHBGAICHDBAICBAICHAGAaABDGCIAMGGCHBBBKJMIaAGFBBIBBAGRBCGXBAGIBAGABBGGBCHABDICHCBAHABAIHBFKJBBIBTABLGvHAGBHGBDYAGFFAHHTAKJTBBkGBBAGABAGEBAGXBAGABAGJHAGBHIGABBGEBAFABAHFBBKJBBGDBfGAaCTOaATAaCHBaFKJMJaAHAaAHAaAHAPAQAPAQAIBGHBAGjBDHNIAHETAHBGEHKBAHjBAaHHAaFBAaBTEaDTBBkGqIBHDIAHFIAHBIBHBGAKJTFGFIBHBGDHCGAICGBIGGCHDGMHAIBHBIFHAGAIAKJICHAaBClBACABECABBDqTAFADCmIFAABAGDBBGGBAGABAGDBBGoBAGDBBGgBAGDBBGGBAGABAGDBBGOBAG4BAGDBBmCBAABBHCTIMTBCGPaJBFiVBAABBDFBBOAmrJAAaATAGQUAGZPAQABCmKBAATCLCGHBGGMBAGDHCBKGRHCTBBIGRHBBLGMBAGCBAHBBLGzHBIAHGIHHAIBHKTCFATCYAGAHABBKJBFMJBFTFOATDHCcABAKJBFGiFAG0BGGEHBGhHAGABEmFBAABJGeBAHCIDHBICBDIBHAIFHCBDaABCTBKJGdBBGEBKGrBDGZBFKJMABCahGWHBIBHABBTBG0IAHAIAHGBAHAIAHAIBHHIFHJBBHAKJBFKJBFTGFATFBBHNJAhABAAHDIAGuHAIAHEIAHAIEHAIBGGBDKJTGaJHIaIBCHBIAGdIAHDIBHBIAHCGBKJGrHAIAHBICHAIAHCIBBHTDGjIHHHIBHBBCTEKJBCGCKJGdFFTBDIBGCqBBCCTHBHHCTAHMIAHGGDHAGFHAGBIAHBGABEDrF+DMFADhFkH5BAHEgVCAADHghBAADHCHDFBBCFBBDHCHDHCHDFBBCFBBDHBACABACABACABACADHCHDNBBDHEHDHEHDHEHDEBADBCDEAZADAZCDCBADBCDEAZCDDBBDBCDBAZCDHCEZCBBDCBADBCDEAZBBAUKcEOFTBRASAPARBSAPARATHVAWAcEUATIRASATDNBTCXAPAQATKXATANATJUAcEBAcJMAFABBMFXCPAQAFAMJXCPAQABAFMBCYfBPHMJDHAJCHLBOaBCAaDCAaBDACCDBCCDAaACAaBXACEaFCAaACAaACAaACDaADACDDAGDDAaBDBCBXECADDaAXAaBDAaAMPLiCADALDMAaBBDXEaEXBaDXAaBXAaBXAaGXAaeXBaBXAaAXAae3LEAAaHPAQAPAQAaTXBaGPAQA6QBAAXAadXYanXF6EBAABYaKBUM76NBAAMV62CAAXAaIXAa1XH6uBAAXA63DAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAMdarXEPAQAXePAQAPAQAPAQAPAQAPAQAXP6/DAA3CCAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAX+PAQAPAQAXfPAQA3BEAAavXUaBXFamBBafBB6nBAACuBADuBAABCCDBAFCCADDACADFFBCBgjBAADAaFADHCCADABETDMATBDlBADABEDABBG3BGFATABNHAGWBIGGBAGGBAGGBAGGBAGGBAGGBAGGBAGGBAHfTBRASARASATCRASATARASATIOATBOATARASATBRASAPAQAPAQAPAQAPAQATEFATJOBTDOATAPATMBvaZBA6YBAABL6VDAABZaLBDUATCaAFAGALAPAQAPAQAPAQAPAQAPAQAaBPAQAPAQAPAQAPAQAOAPAQBaALIHDIBOAFEaBLCFAGATAaBBAmVBAABBHBZBFBGAOAmZBAATAFCGABEGqBAmdBAABAaBMDaJGaBEajBLGPaeBAMJadMHaAMOafMJamMO6/EAAm1mBABJa/mvHFABPGUFAm2RAABCa2BIGnFFTBmLEAAFATCGPKJGBBTAtGAHAJCTAHJTAFAAbFBHBmFBAALJHBTFBHZWFIZBANDBA9FADHADCAAJFAZBADGAADDBATCDABCDALBBABCCBvGAFBDAGGHAGCHAGDHAGWIBHBIAaDBDMFaBYAaABFGzTDBHIBGxIPHBBHTBKJBFHRGFTCGATAGBHAKJGbHHTBGWHKIBBKTAGcBCHCIAGuHAIBHDIBHBICTMBAFAKJBDTBGEHAFAGIKJGEBAGoHFIBHBIBHBBIGCHAGHHAIABBKJBBTDGPFAGFaCGAIAHAIAGxHAGAHCGBHBGEHBGAHAGABXGBFATBGKIAHBIBTBGAFBIAHABJGFBBGFBBGFBIGGBAGGBADqZAFDDHBHjPBAAGiIBHAIBHAIBTAIAHABBKJBFmjuCABLGWBDGwhDgAA9/jBAmtFAABBmpBAABlDGBLDEBEGAHAGJXAGMBAGEBAGABAGBBAGBBAmrBAAZPBQmqFAAQAPABPG/BBG1BnGLYAaABBHPTGPAQATABFHPTAOBNBPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQATBPAQATDNCTCBATDOAPAQAPAQAPAQATCXAOAXCBATAYATBBDGEBAmGCAABBcABATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAPAQATAPAQATBGJFAGsFBGeBCGFBBGFBBGFBBGCBCYBXAZAaAYBBAaAXDaBBJcCaBBBGLBAGZBAGSBAGBBAGOBBGNBhm6BAABETCBDMsBCaIL0MDaQMBaCBAaLBDaABuasHAhBCAAGcBCGwBOHAMaBDGfMDBIGTLAGHLABEGlHEBEGdBATAGjBDGHTALEBpCnDnmNBAABBKJBFCjBDDjBDGnBHGzBKTAhPCAAm2EAABIGVBJGHhXCAAGFBBGABAGrBAGBBCGABBGWBATAMHGWaBMGGeBHMIBvGSBAGBBEMEGVMFBCTAGZBETAB/G3BDMBGBMPBBMtGAHCBAHBBEHDGDBAGCBAGcBBHCBDHAMIBGTIBGGcMBTAGcMCBfGHaAGbHBBDMETGBIG1BCTGGVBBMHGSBEMHGRBGTDBLMGhPBAAmIBAAB2CyBMDyBGMFGjHDBHKJhlEAAMehACAAGcMJGABHGVHKMDTEhFCAAGWBIIAHAIAG0HOTGBDMTKJBOHCIAGsICHDIBHBTBcATDBKcABBGYBGKJBFHCGjHEIAHHBAKJTDGAIBBIGiHATBGABIHBIAGvICHIIBGDTDHDTABBKJGATAGATCBAMTBKGRBAGYICHCIBHAIAHBTFHAhABAAGGBAGABAGDBAGOBAGJTABFGuHAICHHBEKJBFHBIBBAGHBBGBBBGVBAGGBAGBBAGEBAHBGAIBHAIDBBIBBBICBBGABFIABEGEIBBBHGBCHEhKCAAG0ICHHIBHCIAHAGDTEKJBATABATAHAGABfGvICHFIAHAIDHBIAHBGBTAGABHKJhlCAAGuICHDBBIDHBIAHBTWGDHBBhGvICHHIBHAIAHBTCGABKKJBFTMBSGqHAIAHAIBHFIAHAGABGKJB1GaBBHCIBHDIAHEBDKJMBTCaAh/CAAGrICHIIAHBTAhjBAACfDfKJMIBLGAhfCAAGHBBGmICHDBBHBIDHAGATAGAIABaGAHJGnHFIAGAHDTHHABHGAHFIBHCGtHMIAHBTCGATEBcG4hGEAAGIBAGkIAHGBAHFIAHAGATEBJKJMSBCTBGdBBHVBAIAHGIAHBIAHBhIBAAGGBAGBBAGlHFBCHABAHBBAHGGAHABHKJBFGFBAGBBAGfIEBAHBBAIBHAIAHAGABGKJh1EAAGSHBIBTBhGDAAMUaHYDaQBMTAmZOAAhlBAAruBAABATEBKmDDAAh7qAAmuQAABAcIhG/AAmGJAAh4GCAm4IAABGGeBAKJBDTBhfBAAGdBBHETABJGvHGTEaDFDTAaABJKJBAMGBAGUBEGShvKAACfDfMWTDhkBAAmKBAABDHAGAI2BGHDFMB/FBTAFABbm3fBABHmyLAAhMUCAmeEAABwGCBQGDBHmLGAAhDkAAmqBAABEGMBCGIBGGJBBaAHBTAcDhbNBA61DAABJamBBa7IBHCaCIFcHHHaBHGadHDa6BW6BBAAHCaAhZCAAMTBL6WBAABIMYhGCAACZDZCZDGBADRCZDZCABACBBBCABBCBBBCDBACHDDBADABADGBADKCZDZCBBACDBBCHBACGBADZCBBACDBACEBACABCCGBADZCZDZCZDZCZDZCZDZCZDZCZDbBBCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCADABBKx6/HAAH2aDHxaHHAaNHAaBTEBOHEBAHOhPVAAHGBAHQBBHGBAHBBAHEhUDAAGsBCHGFGBBKJBDGAaAhvFAAGrHDKJBEYAh/TAAmEDAABBMIHGBoChDhHGFABDKJBDTBhQMAAM6aAMCYAMDhLBAAMsaAMOhBDAAGDBAGaBAGBBAGABBGABAGJBAGDBAGABAGABFGABDGABAGABAGABAGCBAGBBAGABBGABAGABAGABAGABAGABAGBBAGABBGDBAGGBAGDBAGDBAGABAGJBAGQBEGCBAGEBAGQBzXBhNEAAarBD6jBAABLaOBBaOBAaOBAakBJMMBC6cBAABCa8B4acBMarBDaIBGaBBNaFhZCAA66DAAZE6VLAABJaMBCaKBE6zBAABL6YBAABGaLBTaLBDa3BHaJBFanBHadhRBAAaLBA6kBAABAaDBCaoBBaFBCacBB6GCAABLaNBBaDBDaCBEaCBMaFhpVAAmWbKABom0ABABKmdDAABBmBaBABNmw0BAhewAAmdIAAhiXwCcABd8fBAAh/BAAnvDAAhP4PA99/PABB99/PA".split(""),r=X.map(()=>[]);let a=0,i=0;for(;i{const a=r[n].reduce(y,g);t.set(e,a);const i=e.charAt(0),s=o.get(i)||[];o.set(i,s),s.push(a)}),o.forEach((e,n)=>{t.set(n,e.reduce(y,g))}),t}();function Q(e){return 32===e||9===e||10===e||13===e}const K=[d(L(":")),m(L("A"),L("Z")),d(L("_")),m(L("a"),L("z")),m(192,214),m(216,246),m(192,214),m(216,246),m(248,767),m(880,893),m(895,8191),m(8204,8205),m(8304,8591),m(11264,12271),m(12289,55295),m(63744,64975),m(65008,65533),m(65536,983039)].reduce(y),Z=[K,d(L("-")),d(L(".")),m(L("0"),L("9")),d(183),m(768,879),m(8255,8256)].reduce(y),z=J.get("Nd"),W=Y(z),$=q(m(0,1114111),[J.get("P"),J.get("Z"),J.get("C")].reduce(y)),ee=Y($);function te(e){return 10!==e&&13!==e&&!k(e)}const ne={s:Q,S:Y(Q),i:K,I:Y(K),c:Z,C:Y(Z),d:z,D:W,w:$,W:ee},re=B("*"),ae=B("\\"),ie=B("{"),oe=B("}"),se=B("["),ue=B("]"),le=B("^"),ce=B("$"),pe=B(","),he=B("-"),fe=B("("),de=B(")"),me=B("."),ve=B("|"),ge=B("+"),ye=B("?"),we=B("-["),Ae=L("0");function xe(e){function t(e){return new Set(e.split("").map(e=>L(e)))}function n(e,t){const n=e.codePointAt(t);return void 0===n?E(t,["any character"]):x(t+String.fromCodePoint(n).length,n)}const r="xpath"===e.language?M(ae,T([N(B("n"),()=>10),N(B("r"),()=>13),N(B("t"),()=>9),N(T([ae,ve,me,he,le,ye,re,ge,ie,oe,ce,fe,de,se,ue]),e=>L(e))])):M(ae,T([N(B("n"),()=>10),N(B("r"),()=>13),N(B("t"),()=>9),N(T([ae,ve,me,he,le,ye,re,ge,ie,oe,fe,de,se,ue]),e=>L(e))]));function a(e,r){const a=t(r);return S(B(e),I(C(n,e=>a.has(e),r.split(""))),(e,t)=>function(e){const t=J.get(e);if(null==t)throw new Error(e+" is not a valid unicode category");return t}(null===t?e:e+String.fromCodePoint(t)))}const i=T([a("L","ultmo"),a("M","nce"),a("N","dlo"),a("P","cdseifo"),a("Z","slp"),a("S","mcko"),a("C","cfon")]),o=[m(L("a"),L("z")),m(L("A"),L("Z")),m(L("0"),L("9")),d(45)].reduce(y),s=T([i,N(M(B("Is"),function(e){return(t,n)=>{const r=e(t,n);return r.success?x(r.offset,t.slice(n,r.offset)):r}}(D(C(n,o,["block identifier"])))),t=>function(e,t){const n=V.get(e);if(void 0===n){if(t)return v;throw new Error(`The unicode block identifier "${e}" is not known.`)}return n}(t,"xpath"!==e.language))]),u=F(B("\\p{"),s,oe,!0),l=N(F(B("\\P{"),s,oe,!0),Y),c=M(ae,N(T("sSiIcCdDwW".split("").map(e=>B(e))),e=>ne[e])),p=N(me,()=>te),h=T([c,u,l]),f=t("\\[]"),g=T([r,C(n,e=>!f.has(e),["unescaped character"])]),w=T([N(he,()=>null),g]),A=S(w,M(he,w),m);function b(e,t){return[e].concat(t||[])}const G=N(function(e){return(t,n)=>{const r=e(t,n);return r.success?x(n,r.value):r}}(T([ue,we])),()=>null),X=L("-"),_=T([N(U(U(he,P(se,["not ["])),G),()=>X),M(P(he,["not -"]),g)]),k=T([S(N(_,d),T([function(e,t){return k(e,t)},G]),b),S(T([A,h]),T([K,G]),b)]),Q=T([S(N(g,d),T([k,G]),b),S(T([A,h]),T([K,G]),b)]);function K(e,t){return Q(e,t)}const Z=N(Q,e=>e.reduce(y)),z=N(M(le,Z),Y),W=S(T([M(P(le,["not ^"]),Z),z]),I(M(he,(function(e,t){return $(e,t)}))),q),$=F(se,W,ue,!0),ee="xpath"===e.language?T([N(r,d),h,$,p,N(le,()=>e=>-1===e),N(ce,()=>e=>-2===e)]):T([N(r,d),h,$,p]),xe="xpath"===e.language?t(".\\?*+{}()|^$[]"):t(".\\?*+{}()|[]"),be=C(n,e=>!xe.has(e),["NormalChar"]),Ee=N(M(ae,S(N(C(n,m(L("1"),L("9")),["digit"]),e=>e-Ae),O(N(C(n,m(Ae,L("9")),["digit"]),e=>e-Ae)),(e,t)=>{t.reduce((e,t)=>10*e+t,e)})),e=>{throw new Error("Backreferences in XPath patterns are not yet implemented.")}),Be="xpath"===e.language?T([N(be,e=>({kind:"predicate",value:d(e)})),N(ee,e=>({kind:"predicate",value:e})),N(F(fe,M(I(B("?:")),Se),de,!0),e=>({kind:"regexp",value:e})),Ee]):T([N(be,e=>({kind:"predicate",value:d(e)})),N(ee,e=>({kind:"predicate",value:e})),N(F(fe,Se,de,!0),e=>({kind:"regexp",value:e}))]),Ne=N(D(N(C(n,m(Ae,L("9")),["digit"]),e=>e-Ae)),e=>e.reduce((e,t)=>10*e+t)),Ce=T([S(Ne,M(pe,Ne),(e,t)=>{if(t({min:e,max:null})),N(Ne,e=>({min:e,max:e}))]),Te="xpath"===e.language?S(T([N(ye,()=>({min:0,max:1})),N(re,()=>({min:0,max:null})),N(ge,()=>({min:1,max:null})),F(ie,Ce,oe,!0)]),I(ye),(e,t)=>e):T([N(ye,()=>({min:0,max:1})),N(re,()=>({min:0,max:null})),N(ge,()=>({min:1,max:null})),F(ie,Ce,oe,!0)]),Ie=O(S(Be,N(I(Te),e=>null===e?{min:1,max:1}:e),(e,t)=>[e,t])),Oe=S(Ie,O(M(ve,H(Ie))),(e,t)=>[e].concat(t));function Se(e,t){return Oe(e,t)}const De=function(e){return S(e,j,R)}(Oe);return function(e){let t;try{t=De(e,0)}catch(t){throw new Error(`Error parsing pattern "${e}": ${t.message}`)}return t.success?t.value:function(e,t,n){const r=n.map(e=>`"${e}"`);throw new Error(`Error parsing pattern "${e}" at offset ${t}: expected ${r.length>1?"one of "+r.join(", "):r[0]} but found "${e.slice(t,t+1)}"`)}(e,t.offset,t.expected)}}function be(e){return[...e].map(e=>e.codePointAt(0))}const Ee=function(e){const t={};var n;function r(e){var t=0;return function(){return tn.length?a?1:-1:t.lengthn?a?1:-1:t(t=r.padEnd(t,"0"))?a?1:-1:nD(e,t)},zc:function(e,t){return 0>D(e,t)},sa:function(e,t){return-1e||1342177279>>=1)&&(t+=t);return n}})),o("String.prototype.padEnd",(function(e){return e||function(e,t){var n=C(this,null,"padStart");return n+T(t,e-n.length)}})),o("WeakMap",(function(e){function t(e){if(this.h=(l+=Math.random()+1).toString(),e){e=u(e);for(var t;!(t=e.next()).done;)t=t.value,this.set(t[0],t[1])}}function n(){}function r(e){var t=typeof e;return"object"===t&&null!==e||"function"===t}function i(e){if(!B(e,s)){var t=new n;a(e,s,{value:t})}}function o(e){var t=Object[e];t&&(Object[e]=function(e){return e instanceof n?e:(Object.isExtensible(e)&&i(e),t(e))})}if(function(){if(!e||!Object.seal)return!1;try{var t=Object.seal({}),n=Object.seal({}),r=new e([[t,2],[n,3]]);return 2==r.get(t)&&3==r.get(n)&&(r.delete(t),r.set(n,4),!r.has(t)&&4==r.get(n))}catch(e){return!1}}())return e;var s="$jscomp_hidden_"+Math.random();o("freeze"),o("preventExtensions"),o("seal");var l=0;return t.prototype.set=function(e,t){if(!r(e))throw Error("Invalid WeakMap key");if(i(e),!B(e,s))throw Error("WeakMap key fail: "+e);return e[s][this.h]=t,this},t.prototype.get=function(e){return r(e)&&B(e,s)?e[s][this.h]:void 0},t.prototype.has=function(e){return r(e)&&B(e,s)&&B(e[s],this.h)},t.prototype.delete=function(e){return!!(r(e)&&B(e,s)&&B(e[s],this.h))&&delete e[s][this.h]},t})),o("Map",(function(e){function t(){var e={};return e.Ba=e.next=e.head=e}function n(e,t){var n=e.h;return s((function(){if(n){for(;n.head!=e.h;)n=n.Ba;for(;n.next!=n.head;)return n=n.next,{done:!1,value:t(n)};n=null}return{done:!0,value:void 0}}))}function r(e,t){var n=t&&typeof t;"object"==n||"function"==n?i.has(t)?n=i.get(t):(n=""+ ++o,i.set(t,n)):n="p_"+t;var r=e.o[n];if(r&&B(e.o,n))for(e=0;e=a}})),o("Array.prototype.fill",(function(e){return e||function(e,t,n){var r=this.length||0;for(0>t&&(t=Math.max(0,r+t)),(null==n||n>r)&&(n=r),0>(n=Number(n))&&(n=Math.max(0,r+n)),t=Number(t||0);t(t=t||0)&&(t=Math.max(t+r,0));te?-t:t}})),o("Number.isFinite",(function(e){return e||function(e){return"number"==typeof e&&(!isNaN(e)&&1/0!==e&&-1/0!==e)}})),o("String.prototype.padStart",(function(e){return e||function(e,t){var n=C(this,null,"padStart");return T(t,e-n.length)+n}})),o("Array.prototype.keys",(function(e){return e||function(){return S(this,(function(e){return e}))}})),o("Number.isInteger",(function(e){return e||function(e){return!!Number.isFinite(e)&&e===Math.floor(e)}})),o("Number.isSafeInteger",(function(e){return e||function(e){return Number.isInteger(e)&&Math.abs(e)<=Number.MAX_SAFE_INTEGER}})),o("Array.prototype.findIndex",(function(e){return e||function(e,t){return I(this,e,t).Hb}})),o("String.prototype.endsWith",(function(e){return e||function(e,t){var n=C(this,e,"endsWith");void 0===t&&(t=n.length),t=Math.max(0,Math.min(0|t,n.length));for(var r=e.length;0=r}})),o("String.fromCodePoint",(function(e){return e||function(e){for(var t="",n=0;nr||1114111=r?t+=String.fromCharCode(r):(r-=65536,t+=String.fromCharCode(r>>>10&1023|55296),t+=String.fromCharCode(1023&r|56320))}return t}})),o("String.prototype.codePointAt",(function(e){return e||function(e){var t=C(this,null,"codePointAt"),n=t.length;if(0<=(e=Number(e)||0)&&er||56319(e=t.charCodeAt(e+1))||57343=e.length?Z:z(e[t])}}}function ee(){this.value={next:function(){return Z}}}function te(e){var t=e.value;if(W(e.type,53))return!0;if(W(e.type,0))return t;if(W(e.type,1)||W(e.type,20)||W(e.type,19))return 0!==t.length;if(W(e.type,2))return!isNaN(t)&&0!==t;throw Q()}function ne(e,t){var n=this;this.J=se,this.value={next:function(t){return null!==n.o&&n.h>=n.o?Z:void 0!==n.B[n.h]?z(n.B[n.h++]):(t=e.next(t)).done?(n.o=n.h,t):((n.v||2>n.h)&&(n.B[n.h]=t.value),n.h++,t)}},this.v=!1,this.B=[],this.h=0,this.o=void 0===t?null:t}function re(e,t){e.h=void 0===t?0:t}function ae(e){this.B=se,this.h=e;var t=!1;this.value={next:function(){return t?Z:(t=!0,z(e))}},this.o=null}(n=$.prototype).pb=function(){return this},n.filter=function(e){var t=this,n=-1;return this.o.create({next:function(){for(n++;n=t.h.length?Z:z(t.h[n])}})},n.first=function(){return this.h[0]},n.S=function(){return this.h},n.getEffectiveBooleanValue=function(){if(W(this.h[0].type,53))return!0;throw Q()},n.ya=function(){return this.h.length},n.F=function(){return!1},n.za=function(){return!1},n.map=function(e){var t=this,n=-1;return this.o.create({next:function(){return++n>=t.h.length?Z:z(e(t.h[n],n,t))}},this.h.length)},n.M=function(e){return e(this.h)},n.aa=function(e){return e.multiple?e.multiple(this):e.default(this)},(n=ee.prototype).pb=function(){return this},n.filter=function(){return this},n.first=function(){return null},n.S=function(){return[]},n.getEffectiveBooleanValue=function(){return!1},n.ya=function(){return 0},n.F=function(){return!0},n.za=function(){return!1},n.map=function(){return this},n.M=function(e){return e([])},n.aa=function(e){return e.empty?e.empty(this):e.default(this)},(n=ne.prototype).pb=function(){return this.J.create(this.S())},n.filter=function(e){var t=this,n=-1,r=this.value;return this.J.create({next:function(a){n++;for(var i=r.next(a);!i.done&&!e(i.value,n,t);)n++,i=r.next(a);return i}})},n.first=function(){if(void 0!==this.B[0])return this.B[0];var e=this.value.next(0);return re(this),e.done?null:e.value},n.S=function(){if(this.h>this.B.length&&this.o!==this.B.length)throw Error("Implementation error: Sequence Iterator has progressed.");var e=this.value;this.v=!0;for(var t=e.next(0);!t.done;)t=e.next(0);return this.B},n.getEffectiveBooleanValue=function(){var e=this.value,t=this.h;re(this);var n=e.next(0);if(n.done)return re(this,t),!1;if(W((n=n.value).type,53))return re(this,t),!0;if(!e.next(0).done)throw Q();return re(this,t),te(n)},n.ya=function(e){if(null!==this.o)return this.o;if(void 0!==e&&e)return-1;e=this.h;var t=this.S().length;return re(this,e),t},n.F=function(){return 0===this.o||null===this.first()},n.za=function(){if(null!==this.o)return 1===this.o;var e=this.value,t=this.h;return re(this),e.next(0).done?(re(this,t),!1):(e=e.next(0),re(this,t),e.done)},n.map=function(e){var t=this,n=0,r=this.value;return this.J.create({next:function(a){return(a=r.next(a)).done?Z:z(e(a.value,n++,t))}},this.o)},n.M=function(e,t){var n,r=this.value,a=[],i=!0;return function(){for(var o=r.next(i?0:t);!o.done;o=r.next(t))i=!1,a.push(o.value);n=e(a).value}(),this.J.create({next:function(){return n.next(0)}})},n.aa=function(e){function t(e){r=e.value,-1!==(e=e.ya(!0))&&(n.o=e)}var n=this,r=null;return this.J.create({next:function(a){return r?r.next(a):n.F()?(t(e.empty?e.empty(n):e.default(n)),r.next(a)):n.za()?(t(e.s?e.s(n):e.default(n)),r.next(a)):(t(e.multiple?e.multiple(n):e.default(n)),r.next(a))}})},(n=ae.prototype).pb=function(){return this},n.filter=function(e){return e(this.h,0,this)?this:this.B.create()},n.first=function(){return this.h},n.S=function(){return[this.h]},n.getEffectiveBooleanValue=function(){return null===this.o&&(this.o=te(this.h)),this.o},n.ya=function(){return 1},n.F=function(){return!1},n.za=function(){return!0},n.map=function(e){return this.B.create(e(this.h,0,this))},n.M=function(e){return e([this.h])},n.aa=function(e){return e.s?e.s(this):e.default(this)};var ie=new ee;function oe(e,t){if(null===(e=void 0===e?null:e))return ie;if(Array.isArray(e))switch(e.length){case 0:return ie;case 1:return new ae(e[0]);default:return new $(e)}return e.next?new ne(e,void 0===t?null:t):new ae(e)}var se={create:oe,s:function(e){return new ae(e)},empty:function(){return oe()},$:function(){return oe(V)},U:function(){return oe(J)}};function ue(e){var t=[],n=e.value;return function(){var e=0;return se.create({next:function(){if(void 0!==t[e])return t[e++];var r=n.next(0);return r.done?r:t[e++]=r}})}}function le(e,t){this.type=e,this.value=t}var ce={},pe=(ce[0]="xs:boolean",ce[1]="xs:string",ce[2]="xs:numeric",ce[3]="xs:double",ce[4]="xs:decimal",ce[5]="xs:integer",ce[6]="xs:float",ce[7]="xs:date",ce[8]="xs:time",ce[9]="xs:dateTime",ce[10]="xs:dateTimeStamp",ce[11]="xs:gYearMonth",ce[12]="xs:gYear",ce[13]="xs:gMonthDay",ce[14]="xs:gMonth",ce[15]="xs:gDay",ce[16]="xs:yearMonthDuration",ce[17]="xs:dayTimeDuration",ce[18]="xs:duration",ce[19]="xs:untypedAtomic",ce[20]="xs:anyURI",ce[21]="xs:base64Binary",ce[22]="xs:hexBinary",ce[23]="xs:QName",ce[24]="xs:NCName",ce[25]="xs:Name",ce[26]="xs:ENTITY",ce[27]="xs:nonPositiveInteger",ce[28]="xs:negativeInteger",ce[29]="xs:positiveInteger",ce[30]="xs:nonNegativeInteger",ce[31]="xs:long",ce[32]="xs:int",ce[33]="xs:short",ce[34]="xs:byte",ce[35]="xs:unsignedInt",ce[36]="xs:unsignedLong",ce[37]="xs:unsignedByte",ce[38]="xs:unsignedShort",ce[39]="xs:error",ce[40]="xs:ENTITIES",ce[41]="xs:IDREF",ce[42]="xs:ID",ce[43]="xs:IDFREFS",ce[44]="xs:NOTATION",ce[45]="xs:anySimpleType",ce[46]="xs:anyAtomicType",ce[47]="attribute()",ce[48]="xs:normalizedString",ce[49]="xs:NMTOKENS",ce[50]="xs:NMTOKEN",ce[51]="xs:language",ce[52]="xs:token",ce[53]="node()",ce[54]="element()",ce[55]="document-node()",ce[56]="text()",ce[57]="processing-instruction()",ce[58]="comment()",ce[59]="item()",ce[60]="function(*)",ce[61]="map(*)",ce[62]="array(*)",ce),he={"xs:boolean":0,"xs:string":1,"xs:numeric":2,"xs:double":3,"xs:decimal":4,"xs:integer":5,"xs:float":6,"xs:date":7,"xs:time":8,"xs:dateTime":9,"xs:dateTimeStamp":10,"xs:gYearMonth":11,"xs:gYear":12,"xs:gMonthDay":13,"xs:gMonth":14,"xs:gDay":15,"xs:yearMonthDuration":16,"xs:dayTimeDuration":17,"xs:duration":18,"xs:untypedAtomic":19,"xs:anyURI":20,"xs:base64Binary":21,"xs:hexBinary":22,"xs:QName":23,"xs:NCName":24,"xs:Name":25,"xs:ENTITY":26,"xs:nonPositiveInteger":27,"xs:negativeInteger":28,"xs:positiveInteger":29,"xs:nonNegativeInteger":30,"xs:long":31,"xs:int":32,"xs:short":33,"xs:byte":34,"xs:unsignedInt":35,"xs:unsignedLong":36,"xs:unsignedByte":37,"xs:unsignedShort":38,"xs:error":39,"xs:ENTITIES":40,"xs:IDREF":41,"xs:ID":42,"xs:IDREFS":43,"xs:NOTATION":44,"xs:anySimpleType":45,"xs:anyAtomicType":46,"attribute()":47,"xs:normalizedString":48,"xs:NMTOKENS":49,"xs:NMTOKEN":50,"xs:language":51,"xs:token":52,"node()":53,"element()":54,"document-node()":55,"text()":56,"processing-instruction()":57,"comment()":58,"item()":59,"function(*)":60,"map(*)":61,"array(*)":62};function fe(e){return 2===e.g?pe[e.type]+"*":1===e.g?pe[e.type]+"+":0===e.g?pe[e.type]+"?":pe[e.type]}function de(e){if(!e.startsWith("xs:")&&0<=e.indexOf(":"))throw Error("XPST0081: Invalid prefix for input "+e);var t=he[e];if(void 0===t)throw Error('XPST0051: The type "'+e+'" could not be found');return t}function me(e){switch(e[e.length-1]){case"*":return{type:de(e.substr(0,e.length-1)),g:2};case"?":return{type:de(e.substr(0,e.length-1)),g:0};case"+":return{type:de(e.substr(0,e.length-1)),g:1};default:return{type:de(e),g:3}}}function ve(e,t,n){this.namespaceURI=t||null,this.prefix=e||"",this.localName=n}function ge(e){var t=e.l,n=e.arity,r=void 0!==e.Oa&&e.Oa,a=void 0!==e.I&&e.I,i=e.localName,o=e.namespaceURI,s=e.j;for(e=e.value,le.call(this,60,null),this.value=e,this.I=a,a=-1,e=0;e=n||n>e.R.length)throw Error("FOAY0001: array position out of bounds.");return e.R[n-1]()}))}))}function He(e){ge.call(this,{value:function(e,n,r,a){return Pe(0,0,0,se.s(t),a)},localName:"get",namespaceURI:"http://www.w3.org/2005/xpath-functions/array",l:[{type:5,g:3}],arity:1,j:{type:59,g:2}});var t=this;this.type=62,this.R=e}function je(e){switch(e.node.nodeType){case 2:return 47;case 1:return 54;case 3:case 4:return 56;case 7:return 57;case 8:return 58;case 9:return 55;default:return 53}}function Xe(e){return{type:je(e),value:e}}function _e(e,t){return t(e=e.map((function(e){return e.first()})))}function Le(e,t){var n=W(e.type,1)||W(e.type,20)||W(e.type,19),r=W(t.type,1)||W(t.type,20)||W(t.type,19);return n&&r?e.value===t.value:(n=W(e.type,4)||W(e.type,3)||W(e.type,6),r=W(t.type,4)||W(t.type,3)||W(t.type,6),n&&r?!(!isNaN(e.value)||!isNaN(t.value))||e.value===t.value:(n=W(e.type,0)||W(e.type,22)||W(e.type,18)||W(e.type,23)||W(e.type,44),r=W(t.type,0)||W(t.type,22)||W(t.type,18)||W(t.type,23)||W(t.type,44),!(!n||!r)&&e.value===t.value))}function ke(e,t,n,r,a){return _e([r,a],(function(e){var t=(e=u(e)).next().value,n=e.next().value;return(e=t.h.find((function(e){return Le(e.key,n)})))?e.value():se.empty()}))}function Ye(e){ge.call(this,{l:[{type:59,g:3}],arity:1,localName:"get",namespaceURI:"http://www.w3.org/2005/xpath-functions/map",value:function(e,n,r,a){return ke(0,0,0,se.s(t),a)},j:{type:59,g:2}});var t=this;this.type=61,this.h=e}function qe(){}function Ve(e,t){return e.ab()===t.ab()&&e.bb()===t.bb()}function Je(e){if(e>Number.MAX_SAFE_INTEGER||eNumber.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while multiplying xs:dayTimeDuration");return new Je(ee||273860t.pa?1:-1:r>n?1:-1}function lt(e,t,n){return 0===ut(e,t,n)}function ct(e,t,n){return new Je(e=(ot(e,n).getTime()-ot(t,n).getTime())/1e3)}function pt(e){throw Error("Not implemented: adding durations to "+pe[e.type])}function ht(e){throw Error("Not implemented: subtracting durations from "+pe[e.type])}function ft(e,t){if("number"!=typeof e&&("string"!=typeof e||!k.get(t)(e)))throw Error("Cannot convert JavaScript value '"+e+"' to the XPath type "+pe[t]+" since it is not valid.")}function dt(e,t,n){if(null===t)return null;switch(e){case 0:return t?V:J;case 1:return q(t+"",1);case 3:case 2:return ft(t,3),q(+t,3);case 4:return ft(t,e),q(+t,4);case 5:return ft(t,e),q(0|t,5);case 6:return ft(t,e),q(+t,6);case 7:case 8:case 9:case 11:case 12:case 13:case 14:case 15:if(!(t instanceof Date))throw Error("The JavaScript value "+t+" with type "+typeof t+" is not a valid type to be converted to an XPath "+pe[e]+".");return q(it(st(t.toISOString()),e),e);case 53:case 47:case 55:case 54:case 56:case 57:case 58:if("object"!=typeof t||!("nodeType"in t))throw Error("The JavaScript value "+t+" with type "+typeof t+" is not a valid type to be converted to an XPath "+pe[e]+".");return Xe({node:t,G:null});case 59:return function e(t,n){if(null===t)return null;switch(typeof t){case"boolean":return t?V:J;case"number":return q(t,3);case"string":return q(t,1);case"object":return"nodeType"in t?Xe({node:t,G:null}):Array.isArray(t)?new He(t.map((function(t){return void 0===t?function(){return se.empty()}:ue(t=null===(t=e(t))?se.empty():se.s(t))}))):new Ye(Object.keys(t).filter((function(e){return void 0!==t[e]})).map((function(n){var r=e(t[n]);return r=null===r?se.empty():se.s(r),{key:q(n,1),value:ue(r)}})))}throw Error("Value "+String(t)+' of type "'+typeof t+'" is not adaptable to an XPath value.')}(t);default:throw Error('Values of the type "'+e+'" can not be adapted to equivalent XPath values.')}}function mt(e,t,n){if(0===n.g)return null===(t=dt(n.type,t))?[]:[t];if(2===n.g||1===n.g){if(!Array.isArray(t))throw Error("The JavaScript value "+t+" should be an array if it is to be converted to "+fe(n)+".");return t.map((function(e){return dt(n.type,e)})).filter((function(e){return null!==e}))}var r=dt(n.type,t);if(null===r)throw Error("The JavaScript value "+t+" should be a single entry if it is to be converted to "+fe(n)+".");return[r]}function vt(e,t,n){return n=void 0===n?{type:59,g:0}:n,se.create(mt(0,t,n))}function gt(e,t){this.h=t=void 0===t?{xb:null,Bb:null,qb:!1}:t,this.Ga=e.Ga,this.wa=e.wa,this.O=e.O,this.ta=e.ta||Object.create(null)}function yt(e,t){var n=0,r=t.value;return{next:function(a){return(a=r.next(a)).done?Z:z(xt(e,n++,a.value,t))}}}function wt(e){return e.h.qb||(e.h.qb=!0,e.h.xb=st((new Date).toISOString()),e.h.Bb=Ze("PT0S")),e.h.xb}function At(e){return e.h.qb||(e.h.qb=!0,e.h.xb=st((new Date).toISOString()),e.h.Bb=Ze("PT0S")),e.h.Bb}function xt(e,t,n,r){return new gt({O:n,Ga:t,wa:r||e.wa,ta:e.ta},e.h)}function bt(e,t){return new gt({O:e.O,Ga:e.Ga,wa:e.wa,ta:Object.assign(Object.create(null),e.ta,t)},e.h)}function Et(e,t,n,r,a,i){var o=new Map;this.debug=e,this.h=t,this.o=n,this.B=r,this.J=a,this.C=o,this.v=i,this.Ta=!0}function Bt(e){var t=0,n=null,r=!0;return se.create({next:function(a){for(;tNumber.MAX_SAFE_INTEGER||eNumber.MAX_SAFE_INTEGER||!Number.isFinite(t))throw Error("FODT0002: Value overflow while constructing xs:yearMonthDuration");e=new Ft(e||0===t?t:-t)}else e=null;return e}function jt(e,t){if(isNaN(t))throw Error("FOCA0005: Cannot multiply xs:yearMonthDuration by NaN");if((e=Math.round(e.ha*t))>Number.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while constructing xs:yearMonthDuration");return new Ft(ee?"-":"")+"INF"}}}return e(9)||e(7)||e(8)||e(15)||e(14)||e(13)||e(12)||e(11)||e(16)||e(17)||e(18)?function(e){return{u:!0,value:e.toString()}}:e(22)?function(e){return{u:!0,value:e.toUpperCase()}}:function(e){return{u:!0,value:e+""}}}var kt=[2,5,17,16];function Yt(e,t){function n(t){return W(e,t)}if(39===t)return function(){return{u:!1,error:Error("FORG0001: Casting to xs:error is always invalid.")}};switch(t){case 19:return function(e){var t=Lt(e);return function(e){return(e=t(e)).u?{u:!0,value:q(e.value,19)}:e}}(n);case 1:return function(e){var t=Lt(e);return function(e){return(e=t(e)).u?{u:!0,value:q(e.value,1)}:e}}(n);case 6:return function(e){var t=Ut(e,6);return function(e){return(e=t(e)).u?{u:!0,value:q(e.value,6)}:e}}(n);case 3:return function(e){var t=Ut(e,3);return function(e){return(e=t(e)).u?{u:!0,value:q(e.value,3)}:e}}(n);case 4:return function(e){return e(5)?function(e){return{u:!0,value:q(e,4)}}:e(6)||e(3)?function(e){return isNaN(e)||!isFinite(e)?{u:!1,error:Error("FOCA0002: Can not cast "+e+" to xs:decimal")}:Math.abs(e)>Number.MAX_VALUE?{u:!1,error:Error("FOAR0002: Can not cast "+e+" to xs:decimal, it is out of bounds for JavaScript numbers")}:{u:!0,value:q(e,4)}}:e(0)?function(e){return{u:!0,value:q(e?1:0,4)}}:e(1)||e(19)?function(e){var t=parseFloat(e);return!isNaN(t)||isFinite(t)?{u:!0,value:q(t,4)}:{u:!1,error:Error("FORG0001: Can not cast "+e+" to xs:decimal")}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:decimal or any of its derived types.")}}}(n);case 5:return function(e){return e(0)?function(e){return{u:!0,value:q(e?1:0,5)}}:e(2)?function(e){var t=Math.trunc(e);return!isFinite(t)||isNaN(t)?{u:!1,error:Error("FOCA0002: can not cast "+e+" to xs:integer")}:Number.isSafeInteger(t)?{u:!0,value:q(t,5)}:{u:!1,error:Error("FOAR0002: can not cast "+e+" to xs:integer, it is out of bounds for JavaScript numbers.")}}:e(1)||e(19)?function(e){var t=parseInt(e,10);return isNaN(t)?{u:!1,error:Nt(e,5)}:Number.isSafeInteger(t)?{u:!0,value:q(t,5)}:{u:!1,error:Error("FOCA0003: can not cast "+e+" to xs:integer, it is out of bounds for JavaScript numbers.")}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:integer or any of its derived types.")}}}(n);case 2:return function(e){var t=Yt;return function(n){for(var r=u(_t),a=r.next();!a.done;a=r.next())if((a=t(e,a.value)(n)).u)return a;return{u:!1,error:Error('XPTY0004: Casting not supported from "'+n+'" given type to xs:numeric or any of its derived types.')}}}(e);case 18:return function(e){return e(16)?function(e){return{u:!0,value:q(new Xt(e,new Je(e.oa()?0:-0)),18)}}:e(17)?function(e){return{u:!0,value:q(e=new Xt(new Ft(e.oa()?0:-0),e),18)}}:e(18)?function(e){return{u:!0,value:q(e,18)}}:e(19)||e(1)?function(e){return{u:!0,value:q(new Xt(Ht(e),Ze(e)),18)}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:duration or any of its derived types.")}}}(n);case 16:return function(e){return e(18)&&!e(17)?function(e){return{u:!0,value:q(e.Sa,16)}}:e(17)?function(){return{u:!0,value:q(Ht("P0M"),16)}}:e(19)||e(1)?function(e){var t=Ht(e);return t?{u:!0,value:q(t,16)}:{u:!1,error:Nt(e,16)}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:yearMonthDuration or any of its derived types.")}}}(n);case 17:return function(e){return e(18)&&!e(16)?function(e){return{u:!0,value:q(e.Fa,17)}}:e(16)?function(){return{u:!0,value:q(Ze("PT0.0S"),17)}}:e(19)||e(1)?function(e){var t=Ze(e);return t?{u:!0,value:q(t,17)}:{u:!1,error:Error("FORG0001: Can not cast "+e+" to xs:dayTimeDuration")}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:dayTimeDuration or any of its derived types.")}}}(n);case 9:return function(e){return e(7)?function(e){return{u:!0,value:q(it(e,9),9)}}:e(19)||e(1)?function(e){return{u:!0,value:q(st(e),9)}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:dateTime or any of its derived types.")}}}(n);case 8:return function(e){return e(9)?function(e){return{u:!0,value:q(it(e,8),8)}}:e(19)||e(1)?function(e){return{u:!0,value:q(st(e),8)}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:time or any of its derived types.")}}}(n);case 7:return function(e){return e(9)?function(e){return{u:!0,value:q(it(e,7),7)}}:e(19)||e(1)?function(e){return{u:!0,value:q(st(e),7)}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:date or any of its derived types.")}}}(n);case 11:return function(e){return e(7)||e(9)?function(e){return{u:!0,value:q(it(e,11),11)}}:e(19)||e(1)?function(e){return{u:!0,value:q(st(e),11)}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gYearMonth or any of its derived types.")}}}(n);case 12:return function(e){return e(7)||e(9)?function(e){return{u:!0,value:q(it(e,12),12)}}:e(19)||e(1)?function(e){return{u:!0,value:q(st(e),12)}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gYear or any of its derived types.")}}}(n);case 13:return function(e){return e(7)||e(9)?function(e){return{u:!0,value:q(it(e,13),13)}}:e(19)||e(1)?function(e){return{u:!0,value:q(st(e),13)}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gMonthDay or any of its derived types.")}}}(n);case 15:return function(e){return e(7)||e(9)?function(e){return{u:!0,value:q(it(e,15),15)}}:e(19)||e(1)?function(e){return{u:!0,value:q(st(e),15)}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gDay or any of its derived types.")}}}(n);case 14:return function(e){return e(7)||e(9)?function(e){return{u:!0,value:q(it(e,14),14)}}:e(19)||e(1)?function(e){return{u:!0,value:q(st(e),14)}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:gMonth or any of its derived types.")}}}(n);case 0:return function(e){return e(2)?function(e){return{u:!0,value:0===e||isNaN(e)?J:V}}:e(1)||e(19)?function(e){switch(e){case"true":case"1":return{u:!0,value:V};case"false":case"0":return{u:!0,value:J};default:return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:boolean or any of its derived types.")}}}:function(){return{u:!1,error:Error("XPTY0004: Casting not supported from given type to xs:boolean or any of its derived types.")}}}(n);case 21:return function(e){return e(22)?function(e){for(var t="",n=0;nr.value.node.localName?1:-1;n=Ue(t,n.value),r=Ue(t,r.value)}else n=n.value,r=r.value;return $t(e,t,n,r)}function tn(e,t,n){return en(e.o,e,t,n)}function nn(e,t){return function e(t,n){if(n=void 0===n?rn:n,1>=t.length)return t;var r=Math.floor(t.length/2),a=e(t.slice(0,r),n);for(t=e(t.slice(r),n),r=[];a.length&&t.length;)0>n(a[0],t[0])?r.push(a.shift()):r.push(t.shift());return r.concat(a.concat(t))}(t,(function(t,n){return en(e.o,e,t,n)})).filter((function(e,t,n){return 0===t||!Zt(e.value,n[t-1].value)}))}function rn(e,t){return e(e=t-parseInt(e[3],10))?0:e:t}(n.value)(a=a.first().value)?se.s(q(1,5)):e=e||57344<=e&&65533>=e||65536<=e&&1114111>=e)return String.fromCodePoint(e);throw Error("FOCH0001")})).join(""),se.s(q(e,1))}))},localName:"codepoints-to-string",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:1,g:3}},{l:[{type:1,g:0}],m:function(e,t,n,r){return _e([r],(function(e){return 0===(e=(e=u(e).next().value)?e.value.split(""):[]).length?se.empty():se.create(e.map((function(e){return q(e.codePointAt(0),5)})))}))},localName:"string-to-codepoints",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:5,g:2}},{l:[{type:1,g:0}],m:function(e,t,n,r){return _e([r],(function(e){return null===(e=u(e).next().value)||0===e.value.length?se.create(q("",1)):se.create(q(encodeURIComponent(e.value).replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})),1))}))},localName:"encode-for-uri",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:1,g:3}},{l:[{type:1,g:0}],m:function(e,t,n,r){return _e([r],(function(e){return null===(e=u(e).next().value)||0===e.value.length?se.create(q("",1)):se.create(q(e.value.replace(/([\u00A0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFEF "<>{}|\\^`/\n\u007f\u0080-\u009f]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,(function(e){return encodeURI(e)})),1))}))},localName:"iri-to-uri",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:1,g:3}},{l:[{type:1,g:0},{type:1,g:0}],m:function(e,t,n,r,a){return _e([r,a],(function(e){var t=u(e);if(e=t.next().value,t=t.next().value,null===e||null===t)return se.empty();if(e=e.value,t=t.value,e.length!==t.length)return se.U();e=e.split(""),t=t.split("");for(var n=0;nt.node.nodeName?1:-1})).map((function(e){return Xe(e)})),a=Ie(t.h,a.value).filter((function(e){return"http://www.w3.org/2000/xmlns/"!==e.node.namespaceURI})).sort((function(e,t){return e.node.nodeName>t.node.nodeName?1:-1})).map((function(e){return Xe(e)}));var s=jn(e,t,n,se.create(r),se.create(a)),u=!1;return{next:function(){if(u)return Z;var e=i.next(0);return(e.done||!1!==e.value)&&((e=s.next(0)).done||!1!==e.value)?(e=o.next(0),u=!0,e):(u=!0,e)}}}(e,t,n,r,a);if(W(r.type,47)&&W(a.type,47)||W(r.type,57)&&W(a.type,57)||W(r.type,58)&&W(a.type,58))return function(e,t,n,r,a){var i=jn(e,t,n,Bn(0,0,0,se.s(r)),Bn(0,0,0,se.s(a))),o=!1;return{next:function(){if(o)return Z;var e=i.next(0);return e.done||!1!==e.value?z(Fn(Ot(r,t).first(),Ot(a,t).first())):(o=!0,e)}}}(e,t,n,r,a)}return Kt(!1)}function Ln(e){return Error("XUST0001: "+(void 0===e?"Can not execute an updating expression in a non-updating context.":e))}function kn(e){return Error("XUTY0004: The attribute "+e.name+'="'+e.value+'" follows a node that is not an attribute node.')}function Yn(){return Error("XUTY0005: The target of a insert expression with into must be a single element or document node.")}function qn(){return Error("XUTY0006: The target of a insert expression with before or after must be a single element, text, comment, or processing instruction node.")}function Vn(){return Error("XUTY0008: The target of a replace expression must be a single element, attribute, text, comment, or processing instruction node.")}function Jn(){return Error("XUTY0012: The target of a rename expression must be a single element, attribute, or processing instruction node.")}function Qn(e){return Error("XUDY0017: The target "+e.outerHTML+" is used in more than one replace value of expression.")}function Kn(e){return Error("XUDY0021: Applying the updates will result in the XDM instance violating constraint: '"+e+"'")}function Zn(e){return Error("XUDY0023: The namespace binding "+e+" is conflicting.")}function zn(e){return Error("XUDY0024: The namespace binding "+e+" is conflicting.")}function Wn(){return Error("XUDY0027: The target for an insert, replace, or rename expression expression should not be empty.")}function $n(e,t,n,r,a){n=void 0===n?{A:!1,Z:!1,T:"unsorted",subtree:!1}:n,this.K=e,this.B=n.T||"unsorted",this.subtree=!!n.subtree,this.Z=!!n.Z,this.A=!!n.A,this.J=t,this.I=!1,this.Ya=null,this.wb=void 0!==r&&r,this.type=a}function er(e,t,n){return t&&null!==t.O&&e.A?(null===e.Ya&&(e.Ya=ue(e.evaluate(null,n).pb())),e=e.Ya()):e=e.evaluate(t,n),e}function tr(e,t){this.H=e,this.fa=t}function nr(e){e&&"nodeType"in e&&("function"==typeof(e=e.ownerDocument||e).createElementNS&&"function"==typeof e.createProcessingInstruction&&"function"==typeof e.createTextNode&&"function"==typeof e.createComment&&(this.h=e)),this.h||(this.h=null)}function rr(e,t,n){t.forEach((function(t){n.insertBefore(e.node,t.node,null)}))}function ar(e,t,n,r){var a=Ue(n,e),i=e.node.nodeType;if(2===i){if(t.some((function(e){return 2!==e.node.nodeType})))throw Error('Constraint "If $target is an attribute node, $replacement must consist of zero or more attribute nodes." failed.');var o=a?a.node:null;r.removeAttributeNS(o,e.node.namespaceURI,e.node.nodeName),t.forEach((function(e){var t=e.node.nodeName;if(Oe(n,a,t))throw Kn("An attribute "+t+" already exists.");r.setAttributeNS(o,e.node.namespaceURI,t,De(n,e))}))}if(1===i||3===i||8===i||7===i){var s=(i=Me(n,e))?i.node:null;r.removeChild(a.node,e.node),t.forEach((function(e){r.insertBefore(a.node,e.node,s)}))}}function ir(e,t,n,r){if(function(e,t){function n(e){return new ve(e.node.prefix,e.node.namespaceURI,e.node.localName)}function r(t,n){var r=new Set;e.filter((function(e){return e.type===t})).map((function(e){return e.target})).forEach((function(e){e=e?e.node:null,r.has(e)&&n(e),r.add(e)}))}r("rename",(function(e){throw Error("XUDY0015: The target "+e.outerHTML+" is used in more than one rename expression.")})),r("replaceNode",(function(e){throw Error("XUDY0016: The target "+e.outerHTML+" is used in more than one replace expression.")})),r("replaceValue",(function(e){throw Qn(e)})),r("replaceElementContent",(function(e){throw Qn(e)}));var a=new Map;e.filter((function(e){return"replaceNode"===e.type&&2===e.target.node.nodeType})).forEach((function(e){var r=Ue(t,e.target);r=r?r.node:null;var i=a.get(r);i?i.push.apply(i,c(e.o.map(n))):a.set(r,e.o.map(n))})),e.filter((function(e){return"rename"===e.type&&2===e.target.node.nodeType})).forEach((function(e){var n=Ue(t,e.target);if(n){n=n.node;var r=a.get(n);r?r.push(e.o):a.set(n,[e.o])}})),a.forEach((function(e){var t={};e.forEach((function(e){if(t[e.prefix]||(t[e.prefix]=e.namespaceURI),t[e.prefix]!==e.namespaceURI)throw zn(e.namespaceURI)}))}))}(e,t),e.filter((function(e){return-1!==["insertInto","insertAttributes","replaceValue","rename"].indexOf(e.type)})).forEach((function(e){switch(e.type){case"insertInto":rr(e.target,e.content,r);break;case"insertAttributes":!function(e,t,n,r){t.forEach((function(t){var a=t.node.nodeName;if(Oe(n,e,a))throw Kn("An attribute "+a+" already exists.");r.setAttributeNS(e.node,t.node.namespaceURI,a,De(n,t))}))}(e.target,e.content,t,r);break;case"rename":!function(e,t,n,r,a){switch(r||(r=new nr(e?e.node:null)),e.node.nodeType){case 1:var i=n.getAllAttributes(e.node),o=n.getChildNodes(e.node),s=r.createElementNS(t.namespaceURI,t.va()),u={node:s,G:null};i.forEach((function(e){a.setAttributeNS(s,e.namespaceURI,e.nodeName,e.value)})),o.forEach((function(e){a.insertBefore(s,e,null)}));break;case 2:(t=r.createAttributeNS(t.namespaceURI,t.va())).value=De(n,e),u={node:t,G:null};break;case 7:u={node:r.createProcessingInstruction(t.va(),De(n,e)),G:null}}if(!Ue(n,e))throw Error("Not supported: renaming detached nodes.");ar(e,[u],n,a)}(e.target,e.o,t,n,r);break;case"replaceValue":var a=e.target;if(e=e.o,2===a.node.nodeType){var i=Ue(t,a);i?r.setAttributeNS(i.node,a.node.namespaceURI,a.node.nodeName,e):a.node.value=e}else r.setData(a.node,e)}})),e.filter((function(e){return-1!==["insertBefore","insertAfter","insertIntoAsFirst","insertIntoAsLast"].indexOf(e.type)})).forEach((function(e){switch(e.type){case"insertAfter":!function(e,t,n,r){var a=Ue(n,e).node,i=(e=Me(n,e))?e.node:null;t.forEach((function(e){r.insertBefore(a,e.node,i)}))}(e.target,e.content,t,r);break;case"insertBefore":!function(e,t,n,r){var a=Ue(n,e).node;t.forEach((function(t){r.insertBefore(a,t.node,e.node)}))}(e.target,e.content,t,r);break;case"insertIntoAsFirst":!function(e,t,n,r){var a=(n=Re(n,e))?n.node:null;t.forEach((function(t){r.insertBefore(e.node,t.node,a)}))}(e.target,e.content,t,r);break;case"insertIntoAsLast":rr(e.target,e.content,r)}})),e.filter((function(e){return"replaceNode"===e.type})).forEach((function(e){ar(e.target,e.o,t,r)})),e.filter((function(e){return"replaceElementContent"===e.type})).forEach((function(e){!function(e,t,n,r){n.getChildNodes(e.node).forEach((function(t){return r.removeChild(e.node,t)})),t&&r.insertBefore(e.node,t.node,null)}(e.target,e.text,t,r)})),e.filter((function(e){return"delete"===e.type})).forEach((function(e){e=e.target;var n=Ue(t,e);(n=n?n.node:null)&&(2===e.node.nodeType?r.removeAttributeNS(n,e.node.namespaceURI,e.node.nodeName):r.removeChild(n,e.node))})),e.some((function(e){return"put"===e.type})))throw Error('Not implemented: the execution for pendingUpdate "put" is not yet implemented.')}function or(e,t){for(var n=[],r=1;re.h[n])return-1}return 0}function mr(){return Ct("Expected base expression of a function call to evaluate to a sequence of single function item")}function vr(e,t,n,r){for(var a=[],i=0;ie.R.length||0>=n)throw Error("FOAY0001: subarray start out of bounds.");if(0>t)throw Error("FOAY0002: subarray length out of bounds.");if(n+t>e.R.length+1)throw Error("FOAY0001: subarray start + length out of bounds.");return se.s(new He(e.R.slice(n-1,t+n-1)))}))}function xr(e,t,n,r,a){return _e([r],(function(e){var t=u(e).next().value;return a.M((function(e){e=e.map((function(e){return e.value})).sort((function(e,t){return t-e})).filter((function(e,t,n){return n[t-1]!==e}));for(var n=t.R.concat(),r=0,a=e.length;rt.R.length||0>=i)throw Error("FOAY0001: subarray position out of bounds.");n.splice(i-1,1)}return se.s(new He(n))}))}))}function br(e){return W(e,1)||W(e,20)||W(e,19)}function Er(e,t,n,r){return r.sort((function(r,a){return jn(e,t,n,se.create(r),se.create(a)).next(0).value?0:function e(t,n,r,a,i){return 0===a.length?0!==i.length:0!==i.length&&_n(t,n,r,a[0],i[0]).next(0).value?e(t,n,r,a.slice(1),i.slice(1)):a[0].value!=a[0].value||(br(a[0].type)&&0!==i.length&&br(i[0].type)||0!==i.length)&&a[0].value=(e=e.value)||e>t.R.length)throw Error("FOAY0001: array position out of bounds.");return(t=t.R.concat()).splice(e-1,1,ue(i)),se.s(new He(t))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"append",l:[{type:62,g:3},{type:59,g:2}],j:{type:62,g:3},m:function(e,t,n,r,a){return _e([r],(function(e){return e=u(e).next().value.R.concat([ue(a)]),se.s(new He(e))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"subarray",l:[{type:62,g:3},{type:5,g:3},{type:5,g:3}],j:{type:62,g:3},m:Ar},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"subarray",l:[{type:62,g:3},{type:5,g:3}],j:{type:62,g:3},m:function(e,t,n,r,a){var i=se.s(q(r.first().value.length-a.first().value+1,5));return Ar(0,0,0,r,a,i)}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"remove",l:[{type:62,g:3},{type:5,g:2}],j:{type:62,g:3},m:xr},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"insert-before",l:[{type:62,g:3},{type:5,g:3},{type:59,g:2}],j:{type:62,g:3},m:function(e,t,n,r,a,i){return _e([r,a],(function(e){var t=u(e);if(e=t.next().value,(t=t.next().value.value)>e.R.length+1||0>=t)throw Error("FOAY0001: subarray position out of bounds.");return(e=e.R.concat()).splice(t-1,0,ue(i)),se.s(new He(e))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"head",l:[{type:62,g:3}],j:{type:59,g:2},m:function(e,t,n,r){return Pe(0,0,0,r,se.s(q(1,5)))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"tail",l:[{type:62,g:3}],j:{type:59,g:2},m:function(e,t,n,r){return xr(0,0,0,r,se.s(q(1,5)))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"reverse",l:[{type:62,g:3}],j:{type:62,g:3},m:function(e,t,n,r){return _e([r],(function(e){return e=u(e).next().value,se.s(new He(e.R.concat().reverse()))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"join",l:[{type:62,g:2}],j:{type:62,g:3},m:function(e,t,n,r){return r.M((function(e){return e=e.reduce((function(e,t){return e.concat(t.R)}),[]),se.s(new He(e))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"for-each",l:[{type:62,g:3},{type:60,g:3}],j:{type:62,g:3},m:function(e,t,n,r,a){return _e([r,a],(function(r){var a=(r=u(r)).next().value,i=r.next().value;if(1!==i.B)throw Ct("The callback passed into array:for-each has a wrong arity.");return r=a.R.map((function(r){return ue(i.value.call(void 0,e,t,n,vr(i.o,[r()],t,"array:for-each")[0]))})),se.s(new He(r))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"filter",l:[{type:62,g:3},{type:60,g:3}],j:{type:62,g:3},m:function(e,t,n,r,a){return _e([r,a],(function(r){var a=(r=u(r)).next().value,i=r.next().value;if(1!==i.B)throw Ct("The callback passed into array:filter has a wrong arity.");var o=a.R.map((function(r){return r=vr(i.o,[r()],t,"array:filter")[0],(0,i.value)(e,t,n,r)})),s=[],l=!1;return se.create({next:function(){if(l)return Z;for(var e=0,t=a.R.length;e=n.start.line&&i<=n.end.line){var o=in.start.line?a.length:n.start.da-1+a.length,e.push(Array(a.length+t.length).fill(" ",0,i).fill("^",i,o).join(""))}return e}),[]),t=function e(t){var n=t.h instanceof Hr?["Inner error:",t.h.message]:t.h instanceof Error?[t.h.toString()]:e(t.h);return n.push(" at <"+t.o+">:"+t.location.start.line+":"+t.location.start.da+" - "+t.location.end.line+":"+t.location.end.da),n}(t).join("\n"),new Hr(e.join("\n")+"\n\n"+t,n)}function Xr(e,t){"*"===t||Array.isArray(t)||(t=[t]);for(var n=1;ne.length?"":"object"==typeof e[1]?e[2]||"":e[1]||""}function Lr(e,t){return Array.isArray(e)?"object"!=typeof(e=e[1])||Array.isArray(e)?null:t in e?e[t]:null:null}function kr(e,t){return t.reduce(Xr,e)}function Yr(e,t){for(var n=[],r=1;rNumber.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while dividing xs:yearMonthDuration");return new Ft(eNumber.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while dividing xs:dayTimeDuration");return new Je(ee.X.value};case"geOp":return function(e,n){return(e=t(e,n)).W.value>=e.X.value}}}(e,r);if(void 0!==u)return u}if(a(16)&&void 0!==(u=function(e,t){switch(e){case"ltOp":return function(e,n){return(e=t(e,n)).W.value.hae.X.value.ha};case"geOp":return function(e,n){return e=(n=t(e,n)).W,n=n.X,Ve(e.value,n.value)||e.value.ha>n.value.ha}}}(e,r))||a(17)&&void 0!==(u=function(e,t){switch(e){case"eqOp":return function(e,n){return Ve((e=t(e,n)).W.value,e.X.value)};case"ltOp":return function(e,n){return(e=t(e,n)).W.value.eae.X.value.ea};case"geOp":return function(e,n){return e=(n=t(e,n)).W,n=n.X,Ve(e.value,n.value)||e.value.ea>n.value.ea}}}(e,r))||a(18)&&void 0!==(u=function(e,t){switch(e){case"eqOp":return function(e,n){return Ve((e=t(e,n)).W.value,e.X.value)};case"neOp":return function(e,n){return!Ve((e=t(e,n)).W.value,e.X.value)}}}(e,r)))return u;if((a(9)||a(7)||a(8))&&void 0!==(u=function(e,t){switch(e){case"eqOp":return function(e,n,r){return lt((e=t(e,n)).W.value,e.X.value,At(r))};case"neOp":return function(e,n,r){return!lt((e=t(e,n)).W.value,e.X.value,At(r))};case"ltOp":return function(e,n,r){return e=t(e,n),r=At(r),0>ut(e.W.value,e.X.value,r)};case"leOp":return function(e,n,r){var a;return e=(n=t(e,n)).W,n=n.X,(a=lt(e.value,n.value,At(r)))||(r=At(r),a=0>ut(e.value,n.value,r)),a};case"gtOp":return function(e,n,r){return e=t(e,n),r=At(r),0tn(t,e.first(),n.first())}:void 0;case"nodeAfterOp":return t?function(e,n){return 0=r)throw Error("FOAY0001: Array index out of bounds");n.push(e.R[r-1]())}else{if(!W(e.type,61))throw ui("The provided context item is not a map or an array.");"*"===t?n.push.apply(n,c(e.h.map((function(e){return e.value()})))):(e=e.h.find((function(e){return Le(e.key,t)})))&&n.push(e.value())}return Bt(n)}function xi(e,t,n,r,a){return"*"===t?Ai(e,t,n):Bt([n,t=ue(t=er(t,r,a))().M((function(t){return t.reduce((function(t,n){return Ai(e,n,t)}),new ee)}))])}function bi(e,t){$n.call(this,e.K,[e].concat("*"===t?[]:[t]),{A:e.A,T:e.B,subtree:e.subtree}),this.h=e,this.o=t}function Ei(e,t){var n={};$n.call(this,new fr((n.external=1,n)),"*"===e?[]:[e],{A:!1},!1,t),this.h=e}function Bi(e,t,n,r){var a=t.map((function(e){return e.eb}));t=t.map((function(e){return e.name}));var i=a.reduce((function(e,t){return e.add(t.K)}),n.K);$n.call(this,i,a.concat(n),{A:!1},!1,r),this.o=e,this.v=t,this.C=a,this.N=n,this.h=null}function Ni(e){$n.call(this,e,[],{A:!1})}function Ci(e){var t={};Ni.call(this,new fr((t.nodeType=1,t))),this.o=e}function Ti(e,t){t=void 0===t?{kind:null}:t;var n=e.prefix,r=e.namespaceURI,a={};"*"!==(e=e.localName)&&(a.nodeName=1),a.nodeType=1,Ni.call(this,new fr(a)),this.o=e,this.C=r,this.v=n||(r?null:""),this.N=t.kind}function Ii(e){var t={};Ni.call(this,new fr((t.nodeName=1,t))),this.o=e}function Oi(e){Ni.call(this,new fr({})),this.o=e}function Si(e,t,n){$n.call(this,new fr({}),[],{A:!1,T:"unsorted"}),this.o=n,this.v=t||void 0,this.C=e,this.h=null}function Di(e,t){var n=new fr({});fa.call(this,n,[e,t],{A:!1,Z:!1,T:"unsorted",subtree:!1},t),this.v=e}function Ri(e,t){var n=t.h,r=t.o,a=t.B;switch(e.node.nodeType){case 1:var i=r.createElementNS(e.node.namespaceURI,e.node.nodeName);for(n.getAllAttributes(e.node).forEach((function(e){return a.setAttributeNS(i,e.namespaceURI,e.nodeName,e.value)})),e=(r=u(Se(n,e))).next();!e.done;e=r.next())e=Ri(e.value,t),a.insertBefore(i,e.node,null);return{node:i,G:null};case 2:return(t=r.createAttributeNS(e.node.namespaceURI,e.node.nodeName)).value=De(n,e),{node:t,G:null};case 4:return{node:r.createCDATASection(De(n,e)),G:null};case 8:return{node:r.createComment(De(n,e)),G:null};case 9:for(r=r.createDocument(),e=(n=u(Se(n,e))).next();!e.done;e=n.next())e=Ri(e.value,t),a.insertBefore(r,e.node,null);return{node:r,G:null};case 7:return{node:r.createProcessingInstruction(e.node.target,De(n,e)),G:null};case 3:return{node:r.createTextNode(De(n,e)),G:null}}}function Gi(e,t){var n=t.B,r=t.o,a=t.h;if(!Ne(e.node))return Ri(e,t).node;switch(e.node.nodeType){case 2:return(r=r.createAttributeNS(e.node.namespaceURI,e.node.nodeName)).value=De(a,e),r;case 8:return r.createComment(De(a,e));case 1:var i=e.node.prefix,o=e.node.localName,s=r.createElementNS(e.node.namespaceURI,i?i+":"+o:o);return Se(a,e).forEach((function(e){e=Gi(e,t),n.insertBefore(s,e,null)})),Ie(a,e).forEach((function(e){n.setAttributeNS(s,e.node.namespaceURI,e.node.nodeName,De(a,e))})),s.normalize(),s;case 7:return r.createProcessingInstruction(e.node.target,De(a,e));case 3:return r.createTextNode(De(a,e))}}function Mi(e,t,n){var r=e.node;if(!(Ne(r)||n||e.G))return r;n=t.C,e=function(e,t,n){var r=e;for(e=Ue(n,r);null!==e;){if(2===r.node.nodeType)t.push(r.node.nodeName);else{var a=Se(n,e);t.push(a.findIndex((function(e){return Zt(e,r)})))}e=Ue(n,r=e)}return r}(e,r=[],t.h);var a=n.get(e.node);return a||(a={node:Gi(e,t),G:null},n.set(e.node,a)),function(e,t,n){for(var r={};0tn(t.h,o,s)){if(e=z(o),o=null,"exceptOp"===n.h)return e}else s=null}return"exceptOp"===n.h?null!==o?(e=z(o),o=null,e):a.next(0):(u=!0,Z)}})},v(za,cr),za.prototype.v=function(e,t,n){return n.length?Bt(n.map((function(t){return t(e)}))):se.empty()},v(Wa,$n),Wa.prototype.evaluate=function(e,t){var n=this,r=yt(e,er(this.h,e,t)),a=null,i=null,o=!1;return se.create({next:function(e){for(;!o;){if(!a&&(a=r.next(e)).done)return o=!0,Z;i||(i=er(n.o,a.value,t));var s=i.value.next(e);if(!s.done)return s;a=i=null}}})},v($a,$n),$a.prototype.evaluate=function(e,t){var n=this,r=St(er(this.v,e,t),t);return r.aa({empty:function(){return n.o?se.$():se.U()},s:function(){return r.map((function(e){return Jt(e,n.h).u?V:J}))},multiple:function(){return se.U()}})},v(ei,$n),ei.prototype.evaluate=function(e,t){var n=this,r=St(er(this.v,e,t),t);return r.aa({empty:function(){if(!n.o)throw Error("XPTY0004: Sequence to cast is empty while target type is singleton.");return se.empty()},s:function(){return r.map((function(e){return Qt(e,n.h)}))},multiple:function(){throw Error("XPTY0004: Sequence to cast is not singleton or empty.")}})},v(ni,$n),ni.prototype.evaluate=function(e,t){var n=this,r=er(this.v,e,t);return r.aa({empty:function(){return"?"===n.h||"*"===n.h?se.$():se.U()},multiple:function(){return"+"===n.h||"*"===n.h?ti(r,(function(r){var a=se.s(r);return r=xt(e,0,r,a),er(n.o,r,t)})):se.U()},s:function(){return ti(r,(function(r){var a=se.s(r);return r=xt(e,0,r,a),er(n.o,r,t)}))}})},v(oi,$n),oi.prototype.evaluate=function(e,t){var n=this;if(this.h.every((function(e){return"sorted"===e.B}))){var r=0;return ii(t.h,{next:function(){return r>=n.h.length?Z:z(er(n.h[r++],e,t))}}).map((function(e){if(!W(e.type,53))throw Error("XPTY0004: The sequences to union are not of type node()*");return e}))}return Bt(this.h.map((function(n){return er(n,e,t)}))).M((function(e){if(e.some((function(e){return!W(e.type,53)})))throw Error("XPTY0004: The sequences to union are not of type node()*");return e=nn(t.h,e),se.create(e)}))},v(mi,fa),mi.prototype.C=function(e,t,n,r){if(this.v[1])throw Error("More than one order spec is not supported for the order by clause.");var a,i,o=[],s=!1,l=null,c=this.v[0];return se.create({next:function(){if(!s){for(var p=t.next(0);!p.done;)o.push(p.value),p=t.next(0);if((p=o.map((function(e){return c.ia.evaluate(e,n)})).map((function(e){return St(e,n)}))).find((function(e){return!e.F()&&!e.za()})))throw ui("Order by only accepts empty or singleton sequences");if(function(e){return(e=e.find((function(e){return!!e})))?Dt(e.type):null}(a=(a=p.map((function(e){return e.first()}))).map((function(e){return null===e?e:W(19,e.type)?Qt(e,1):e})))&&!(a=si(a)))throw ui("Could not cast values");p=a.length,i=a.map((function(e,t){return t}));for(var h=0;h=a.length?Z:z(o[i[y++]]):0>y?Z:z(o[i[y--]])}}).value,s=!0}return l.next(0)}})},v(vi,$n),vi.prototype.evaluate=function(e,t){if(null===e.O)throw Error("XPDY0002: context is absent, it needs to be present to use paths.");for(var n=t.h,r=e.O.value;9!==r.node.nodeType;)if(null===(r=Ue(n,r)))throw Error("XPDY0050: the root node of the context node is not a document node.");return n=se.s(Xe(r)),this.h?er(this.h,xt(e,0,n.first(),n),t):n},v(gi,$n),gi.prototype.evaluate=function(e){if(null===e.O)throw Error('XPDY0002: context is absent, it needs to be present to use the "." operator');return se.s(e.O)},v(yi,$n),yi.prototype.evaluate=function(e,t){var n=this,r=!0;return this.h.reduce((function(a,i,o){var s=null===a?Kt(e):yt(e,a);if(a={next:function(e){if((e=s.next(e)).done)return Z;if(null!==e.value.O&&!W(e.value.O.type,53)&&0l.length-1)){for(o=Object.create(null),s={},u=0;u"))throw Error('XQDY0026: The content "'+u+'" for a processing instruction node contains "?>".');return s=!0,z({H:[],fa:or([new Ji(r.value,u)],o,a)})}}}}(t,n,e):function(e,t,n){var r,a,i;return{next:function(){if(!r){var o=n.next(0),s=Zi([o.value.H],e,zn);r={attributes:s.attributes.map((function(e){return{node:e,G:null}})),Ua:s.Ua.map((function(e){return{node:e,G:null}}))},a=o.value.fa}if(0===(s=t.next(0)).value.H.length)throw Wn();if(1!==s.value.H.length)throw Vn();if(!(W(s.value.H[0].type,54)||W(s.value.H[0].type,47)||W(s.value.H[0].type,56)||W(s.value.H[0].type,58)||W(s.value.H[0].type,57)))throw Vn();if(null===(i=Ue(e.h,s.value.H[0].value,null)))throw Error("XUDY0009: The target "+s.value.H[0].value.outerHTML+" for replacing a node must have a parent.");if(o=s.value.H[0],s=s.value.fa,W(o.type,47)){if(r.Ua.length)throw Error("XUTY0011: When replacing an attribute the new value must be zero or more attribute nodes.");r.attributes.reduce((function(e,t){var n=t.node.prefix||"";t=t.node.namespaceURI;var r=i.node.lookupNamespaceURI(n);if(r&&r!==t)throw Zn(t);if((r=e[n])&&t!==r)throw zn(t);return e[n]=t,e}),{})}else if(r.attributes.length)throw Error("XUTY0010: When replacing an an element, text, comment, or processing instruction node the new value must be a single node.");return z({H:[],fa:or([Qi(o.value,[].concat(r.attributes,r.Ua))],a,s)})}}}(t,n,e)},v(uo,sr),uo.prototype.evaluate=function(e,t){return lr(e=this.o(e,t),(function(){}))},uo.prototype.o=function(e,t){var n,r,a,i=this,o=t.h,s=t.o,u=t.B,l=[],p=[],h=[];return{next:function(){if(p.length!==i.h.length)for(var f={},d=p.length;d"))throw Error('XQDY0026: The contents of the data of a processing instruction may not include "?>"');if(null!==n.h.Mb)return fo(r=n.h.Mb),se.s(Xe(mo(r,a)));r=er(n.h.Db,e,t);var i=ro(t,r);return se.create({next:function(){var e=i.next(0);return e.done?e:(fo(e=e.value.value),z(Xe(mo(e,a))))}})}))},v(go,$n),go.prototype.evaluate=function(e,t){return this.h?St(e=er(this.h,e,t),t).M((function(e){return 0===e.length?se.empty():(e={node:{data:e.map((function(e){return Qt(e,1).value})).join(" "),Pa:!0,nodeType:3},G:null},se.s(Xe(e)))})):se.empty()},v(yo,cr),yo.prototype.v=function(e,t,n){var r=this;return n[0](e).M((function(a){for(var i=0;ia.length)return!1;break;default:if(1!==a.length)return!1}var r=se.create(a);return a.every((function(a,i){return a=xt(e,i,a,r),er(n.Nb,a,t).getEffectiveBooleanValue()}))})))return n[i+1](e);return n[r.h+1](e)}))},yo.prototype.P=function(e){if(cr.prototype.P.call(this,e),this.C.I)throw Ln()};var wo={ca:!1,qa:!1},Ao={ca:!0,qa:!1},xo={ca:!0,qa:!0};function bo(e){return e.ca?e.qa?xo:Ao:wo}function Eo(e,t){switch(e[0]){case"andOp":var n=Lr(e,"type");return new Ha(No("andOp",e,bo(t)),n);case"orOp":return n=Lr(e,"type"),new ja(No("orOp",e,bo(t)),n);case"unaryPlusOp":return n=Xr(Xr(e,"operand"),"*"),e=Lr(e,"type"),new Pa("+",Eo(n,t),e);case"unaryMinusOp":return n=Xr(Xr(e,"operand"),"*"),e=Lr(e,"type"),new Pa("-",Eo(n,t),e);case"addOp":case"subtractOp":case"multiplyOp":case"divOp":case"idivOp":case"modOp":var r=e[0],a=Eo(kr(e,["firstOperand","*"]),bo(t));t=Eo(kr(e,["secondOperand","*"]),bo(t));var i=Lr(e,"type"),o=Lr(kr(e,["firstOperand","*"]),"type"),s=Lr(kr(e,["secondOperand","*"]),"type");return o&&s&&Lr(e,"type")&&(n=Da(r,o.type,s.type)),new Ma(r,a,t,i,n);case"sequenceExpr":return function(e,t){var n=Yr(e,"*").map((function(e){return Eo(e,t)}));return 1===n.length?n[0]:(n=Lr(e,"type"),new za(Yr(e,"*").map((function(e){return Eo(e,t)})),n))}(e,t);case"unionOp":return n=Lr(e,"type"),new oi([Eo(kr(e,["firstOperand","*"]),bo(t)),Eo(kr(e,["secondOperand","*"]),bo(t))],n);case"exceptOp":case"intersectOp":return n=Lr(e,"type"),new Za(e[0],Eo(kr(e,["firstOperand","*"]),bo(t)),Eo(kr(e,["secondOperand","*"]),bo(t)),n);case"stringConcatenateOp":return function(e,t){var n=Lr(e,"type");return new wr(new Ea({localName:"concat",namespaceURI:"http://www.w3.org/2005/xpath-functions",prefix:""},(e=[Xr(e,"firstOperand")[1],Xr(e,"secondOperand")[1]]).length,n),e.map((function(e){return Eo(e,bo(t))})),n)}(e,t);case"rangeSequenceExpr":return function(e,t){var n=Lr(e,"type");return new wr(new Ea({localName:"to",namespaceURI:"http://fontoxpath/operators",prefix:""},(e=[Xr(e,"startExpr")[1],Xr(e,"endExpr")[1]]).length,n),e.map((function(e){return Eo(e,bo(t))})),n)}(e,t);case"equalOp":case"notEqualOp":case"lessThanOrEqualOp":case"lessThanOp":case"greaterThanOrEqualOp":case"greaterThanOp":case"eqOp":case"neOp":case"ltOp":case"leOp":case"gtOp":case"geOp":case"isOp":case"nodeBeforeOp":case"nodeAfterOp":return n=kr(e,["firstOperand","*"]),r=kr(e,["secondOperand","*"]),a=Lr(n,"type"),i=Lr(r,"type"),new Qa(e[0],Eo(n,bo(t)),Eo(r,bo(t)),a,i);case"pathExpr":return function(e,t){var n=Lr(e,"type"),r=Yr(e,"stepExpr"),a=!1,i=r.map((function(e){var r=Xr(e,"xpathAxis");if(r){a=!0;var i=Xr(e,"attributeTest anyElementTest piTest documentTest elementTest commentTest namespaceTest anyKindTest textTest anyFunctionTest typedFunctionTest schemaAttributeTest atomicType anyItemType parenthesizedItemType typedMapTest typedArrayTest nameTest Wildcard".split(" "));switch(i=Bo(i),_r(r)){case"ancestor":var o=new zr(i,{Na:!1});break;case"ancestor-or-self":o=new zr(i,{Na:!0});break;case"attribute":o=new Wr(i);break;case"child":o=new $r(i);break;case"descendant":o=new ta(i,{Na:!1});break;case"descendant-or-self":o=new ta(i,{Na:!0});break;case"parent":o=new oa(i);break;case"following-sibling":o=new ia(i);break;case"preceding-sibling":o=new ua(i);break;case"following":o=new aa(i);break;case"preceding":o=new sa(i);break;case"self":o=new la(i)}}else o=Eo(o=kr(e,["filterExpr","*"]),bo(t));for(r=(e=u(e=Yr(e,"*"))).next();!r.done;r=e.next())switch(r=r.value,r[0]){case"lookup":o=new bi(o,Co(r,t));break;case"predicate":case"predicates":o=Yr(r,"*").reduce((function(e,n){return new wi(e,Eo(n,bo(t)))}),o)}return o.type=n,o}));return e=Xr(e,"rootExpr"),!(r=a||null!==e||1t?e:(t-=e.length,e+(n+=n.repeat(t)).slice(0,t))}!function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}(t,Error),t.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var r,a=null;for(r=0;rKl&&(Kl=Vl,Zl=[]),Zl.push(e))}function l(){var t,n,r=233*Vl;if(t=Wl[r])return Vl=t.i,t.result;t=Vl,He();var a=233*Vl+2;if(n=Wl[a])Vl=n.i,a=n.result;else{if(n=Vl,e.substr(Vl,6)===at){var i=at;Vl+=6}else i=et,0===zl&&u(Ni);if(i!==et){if(He(),i=Vl,e.substr(Vl,8)===it){var o=it;Vl+=8}else o=et,0===zl&&u(Ci);if(o!==et?(o=je())!==et?(o=Ce())!==et?(Jl=i,i=["encoding",o]):(Vl=i,i=et):(Vl=i,i=et):(Vl=i,i=et),i===et)if(i=Vl,e.substr(Vl,7)===ot?(o=ot,Vl+=7):(o=et,0===zl&&u(Ti)),o!==et)if((o=je())!==et)if((o=Ce())!==et){var s=Vl,l=je();l!==et?(e.substr(Vl,8)===it?(l=it,Vl+=8):(l=et,0===zl&&u(Ci)),l!==et?(l=je())!==et?(l=Ce())!==et?(Jl=s,s=l):(Vl=s,s=et):(Vl=s,s=et):(Vl=s,s=et)):(Vl=s,s=et),s===et&&(s=null),Jl=i,i=[["version",o]].concat(s?[["encoding",s]]:[])}else Vl=i,i=et;else Vl=i,i=et;else Vl=i,i=et;i!==et?(He(),(o=p())!==et?(Jl=n,n=["versionDecl"].concat(i)):(Vl=n,n=et)):(Vl=n,n=et)}else Vl=n,n=et;Wl[a]={i:Vl,result:n},a=n}if(a===et&&(a=null),He(),i=Wl[n=233*Vl+3])Vl=i.i,n=i.result;else{if(i=Vl,s=Wl[o=233*Vl+4])Vl=s.i,o=s.result;else{if(s=Vl,e.substr(Vl,6)===st?(l=st,Vl+=6):(l=et,0===zl&&u(Ii)),l!==et)if((l=je())!==et)if(e.substr(Vl,9)===ut?(l=ut,Vl+=9):(l=et,0===zl&&u(Oi)),l!==et)if((l=je())!==et){l=Vl;var h=Ge();if((l=h!==et?e.substring(l,Vl):h)!==et)if(He(),61===e.charCodeAt(Vl)?(h=lt,Vl++):(h=et,0===zl&&u(Si)),h!==et)if(He(),(h=Ce())!==et)He(),p()!==et?(Jl=s,s=["moduleDecl",["prefix",l],["uri",h]]):(Vl=s,s=et);else Vl=s,s=et;else Vl=s,s=et;else Vl=s,s=et}else Vl=s,s=et;else Vl=s,s=et;else Vl=s,s=et;else Vl=s,s=et;Wl[o]={i:Vl,result:s},o=s}o!==et?(He(),s=c(),Jl=i,i=["libraryModule",o].concat(s?[s]:[])):(Vl=i,i=et),Wl[n]={i:Vl,result:i},n=i}return n===et&&((i=Wl[n=233*Vl+1])?(Vl=i.i,n=i.result):(i=Vl,o=c(),He(),(l=Wl[s=233*Vl+36])?(Vl=l.i,s=l.result):(l=Vl,(h=C())!==et&&(Jl=l,h=["queryBody",h]),l=h,Wl[s]={i:Vl,result:l},s=l),s!==et?(Jl=i,i=["mainModule"].concat(o?[o]:[],[s])):(Vl=i,i=et),Wl[n]={i:Vl,result:i},n=i)),n!==et?(He(),Jl=t,t=["module"].concat(a?[a]:[],[n])):(Vl=t,t=et),Wl[r]={i:Vl,result:t},t}function c(){var e,t=233*Vl+5;if(e=Wl[t])return Vl=e.i,e.result;e=Vl;var n=[],r=Vl,a=v();if(a===et&&((a=h())===et&&((a=m())===et&&(a=d()))),a!==et){He();var i=p();i!==et?(He(),Jl=r,r=a):(Vl=r,r=et)}else Vl=r,r=et;for(;r!==et;)n.push(r),r=Vl,(a=v())===et&&((a=h())===et&&((a=m())===et&&(a=d()))),a!==et?(He(),(i=p())!==et?(He(),Jl=r,r=a):(Vl=r,r=et)):(Vl=r,r=et);if(r=[],a=Vl,(i=A())===et&&((i=g())===et&&(i=N())),i!==et){He();var o=p();o!==et?(He(),Jl=a,a=i):(Vl=a,a=et)}else Vl=a,a=et;for(;a!==et;)r.push(a),a=Vl,(i=A())===et&&((i=g())===et&&(i=N())),i!==et?(He(),(o=p())!==et?(He(),Jl=a,a=i):(Vl=a,a=et)):(Vl=a,a=et);return Jl=e,e=0===n.length&&0===r.length?null:["prolog"].concat(n,r),Wl[t]={i:Vl,result:e},e}function p(){var t,n=233*Vl+6;return(t=Wl[n])?(Vl=t.i,t.result):(59===e.charCodeAt(Vl)?(t=ct,Vl++):(t=et,0===zl&&u(Di)),Wl[n]={i:Vl,result:t},t)}function h(){var t,n,a=233*Vl+7;if(t=Wl[a])return Vl=t.i,t.result;if(n=Wl[t=233*Vl+8])Vl=n.i,t=n.result;else{if(n=Vl,e.substr(Vl,7)===pt){var i=pt;Vl+=7}else i=et,0===zl&&u(Ri);i!==et?(i=je())!==et?(e.substr(Vl,14)===ht?(i=ht,Vl+=14):(i=et,0===zl&&u(Gi)),i!==et?(i=je())!==et?(e.substr(Vl,8)===ft?(i=ft,Vl+=8):(i=et,0===zl&&u(Mi)),i===et&&(e.substr(Vl,5)===dt?(i=dt,Vl+=5):(i=et,0===zl&&u(Ui))),i!==et?(Jl=n,n=["boundarySpaceDecl",i]):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et),Wl[t]={i:Vl,result:n},t=n}if(t===et&&((n=Wl[t=233*Vl+9])?(Vl=n.i,t=n.result):(n=Vl,e.substr(Vl,7)===pt?(i=pt,Vl+=7):(i=et,0===zl&&u(Ri)),i!==et?(i=je())!==et?(e.substr(Vl,7)===mt?(i=mt,Vl+=7):(i=et,0===zl&&u(Fi)),i!==et?(i=je())!==et?(e.substr(Vl,9)===vt?(i=vt,Vl+=9):(i=et,0===zl&&u(Pi)),i!==et?(i=je())!==et?(i=Ce())!==et?(Jl=n,n=["defaultCollationDecl",i]):(Vl=n,n=et):(Vl=n,n=et):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et),Wl[t]={i:Vl,result:n},t=n),t===et&&((n=Wl[t=233*Vl+10])?(Vl=n.i,t=n.result):(n=Vl,e.substr(Vl,7)===pt?(i=pt,Vl+=7):(i=et,0===zl&&u(Ri)),i!==et?(i=je())!==et?(e.substr(Vl,8)===gt?(i=gt,Vl+=8):(i=et,0===zl&&u(Hi)),i!==et?(i=je())!==et?(i=Ce())!==et?(Jl=n,n=["baseUriDecl",i]):(Vl=n,n=et):(Vl=n,n=et):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et),Wl[t]={i:Vl,result:n},t=n),t===et&&((n=Wl[t=233*Vl+11])?(Vl=n.i,t=n.result):(n=Vl,e.substr(Vl,7)===pt?(i=pt,Vl+=7):(i=et,0===zl&&u(Ri)),i!==et?(i=je())!==et?(e.substr(Vl,12)===yt?(i=yt,Vl+=12):(i=et,0===zl&&u(ji)),i!==et?(i=je())!==et?(e.substr(Vl,5)===dt?(i=dt,Vl+=5):(i=et,0===zl&&u(Ui)),i===et&&(e.substr(Vl,8)===ft?(i=ft,Vl+=8):(i=et,0===zl&&u(Mi))),i!==et?(Jl=n,n=["constructionDecl",i]):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et),Wl[t]={i:Vl,result:n},t=n),t===et&&((n=Wl[t=233*Vl+12])?(Vl=n.i,t=n.result):(n=Vl,e.substr(Vl,7)===pt?(i=pt,Vl+=7):(i=et,0===zl&&u(Ri)),i!==et?(i=je())!==et?(e.substr(Vl,8)===wt?(i=wt,Vl+=8):(i=et,0===zl&&u(Xi)),i!==et?(i=je())!==et?(e.substr(Vl,7)===At?(i=At,Vl+=7):(i=et,0===zl&&u(_i)),i===et&&(e.substr(Vl,9)===xt?(i=xt,Vl+=9):(i=et,0===zl&&u(Li))),i!==et?(Jl=n,n=["orderingModeDecl",i]):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et),Wl[t]={i:Vl,result:n},t=n),t===et&&((n=Wl[t=233*Vl+13])?(Vl=n.i,t=n.result):(n=Vl,e.substr(Vl,7)===pt?(i=pt,Vl+=7):(i=et,0===zl&&u(Ri)),i!==et?(i=je())!==et?(e.substr(Vl,7)===mt?(i=mt,Vl+=7):(i=et,0===zl&&u(Fi)),i!==et?(i=je())!==et?(e.substr(Vl,5)===bt?(i=bt,Vl+=5):(i=et,0===zl&&u(ki)),i!==et?(i=je())!==et?(e.substr(Vl,5)===Et?(i=Et,Vl+=5):(i=et,0===zl&&u(Yi)),i!==et?(i=je())!==et?(e.substr(Vl,8)===Bt?(i=Bt,Vl+=8):(i=et,0===zl&&u(qi)),i===et&&(e.substr(Vl,5)===Nt?(i=Nt,Vl+=5):(i=et,0===zl&&u(Vi))),i!==et?(Jl=n,n=["emptyOrderDecl",i]):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et),Wl[t]={i:Vl,result:n},t=n),t===et)))))){var o;if(n=Wl[t=233*Vl+14])Vl=n.i,t=n.result;else{var s;if(n=Vl,e.substr(Vl,7)===pt?(i=pt,Vl+=7):(i=et,0===zl&&u(Ri)),i!==et)if((i=je())!==et)if(e.substr(Vl,15)===Ct?(i=Ct,Vl+=15):(i=et,0===zl&&u(Ji)),i!==et)if((i=je())!==et)if((o=Wl[i=233*Vl+15])?(Vl=o.i,i=o.result):(e.substr(Vl,8)===ft?(o=ft,Vl+=8):(o=et,0===zl&&u(Mi)),o===et&&(e.substr(Vl,11)===It?(o=It,Vl+=11):(o=et,0===zl&&u(Ki))),Wl[i]={i:Vl,result:o},i=o),i!==et)if(He(),44===e.charCodeAt(Vl)?(o=Tt,Vl++):(o=et,0===zl&&u(Qi)),o!==et)He(),(s=Wl[o=233*Vl+16])?(Vl=s.i,o=s.result):(e.substr(Vl,7)===Ot?(s=Ot,Vl+=7):(s=et,0===zl&&u(Zi)),s===et&&(e.substr(Vl,10)===St?(s=St,Vl+=10):(s=et,0===zl&&u(zi))),Wl[o]={i:Vl,result:s},o=s),o!==et?(Jl=n,n=["copyNamespacesDecl",["preserveMode",i],["inheritMode",o]]):(Vl=n,n=et);else Vl=n,n=et;else Vl=n,n=et;else Vl=n,n=et;else Vl=n,n=et;else Vl=n,n=et;else Vl=n,n=et;Wl[t]={i:Vl,result:n},t=n}if(t===et)if(n=Wl[t=233*Vl+17])Vl=n.i,t=n.result;else{if(n=Vl,e.substr(Vl,7)===pt?(i=pt,Vl+=7):(i=et,0===zl&&u(Ri)),i!==et)if((i=je())!==et){if(i=Vl,e.substr(Vl,14)===Dt?(o=Dt,Vl+=14):(o=et,0===zl&&u(Wi)),o!==et)if((s=je())!==et){var l=Be();l!==et?(Jl=i,i=["decimalFormatName"].concat(l)):(Vl=i,i=et)}else Vl=i,i=et;else Vl=i,i=et;if(i===et&&(i=Vl,e.substr(Vl,7)===mt?(o=mt,Vl+=7):(o=et,0===zl&&u(Fi)),o!==et?(s=je())!==et?(e.substr(Vl,14)===Dt?(l=Dt,Vl+=14):(l=et,0===zl&&u(Wi)),l!==et?(Jl=i,i=null):(Vl=i,i=et)):(Vl=i,i=et):(Vl=i,i=et)),i!==et){if(o=[],s=Vl,(l=je())!==et)if((l=f())!==et){var c=je();c!==et?(61===e.charCodeAt(Vl)?(c=lt,Vl++):(c=et,0===zl&&u(Si)),c!==et?(c=je())!==et?(c=Ce())!==et?(Jl=s,s=r(0,l,c)):(Vl=s,s=et):(Vl=s,s=et):(Vl=s,s=et)):(Vl=s,s=et)}else Vl=s,s=et;else Vl=s,s=et;for(;s!==et;)o.push(s),s=Vl,(l=je())!==et?(l=f())!==et?(c=je())!==et?(61===e.charCodeAt(Vl)?(c=lt,Vl++):(c=et,0===zl&&u(Si)),c!==et?(c=je())!==et?(c=Ce())!==et?(Jl=s,s=r(0,l,c)):(Vl=s,s=et):(Vl=s,s=et):(Vl=s,s=et)):(Vl=s,s=et):(Vl=s,s=et):(Vl=s,s=et);Jl=n,n=["decimalFormatDecl"].concat(i?[i]:[],o)}else Vl=n,n=et}else Vl=n,n=et;else Vl=n,n=et;Wl[t]={i:Vl,result:n},t=n}}return Wl[a]={i:Vl,result:t},t}function f(){var t,n=233*Vl+18;return(t=Wl[n])?(Vl=t.i,t.result):(e.substr(Vl,17)===Rt?(t=Rt,Vl+=17):(t=et,0===zl&&u($i)),t===et&&(e.substr(Vl,18)===Gt?(t=Gt,Vl+=18):(t=et,0===zl&&u(eo)),t===et&&(e.substr(Vl,8)===Mt?(t=Mt,Vl+=8):(t=et,0===zl&&u(to)),t===et&&(e.substr(Vl,10)===Ut?(t=Ut,Vl+=10):(t=et,0===zl&&u(no)),t===et&&(e.substr(Vl,3)===Ft?(t=Ft,Vl+=3):(t=et,0===zl&&u(ro)),t===et&&(e.substr(Vl,7)===Pt?(t=Pt,Vl+=7):(t=et,0===zl&&u(ao)),t===et&&(e.substr(Vl,9)===Ht?(t=Ht,Vl+=9):(t=et,0===zl&&u(io)),t===et&&(e.substr(Vl,10)===jt?(t=jt,Vl+=10):(t=et,0===zl&&u(oo)),t===et&&(e.substr(Vl,5)===Xt?(t=Xt,Vl+=5):(t=et,0===zl&&u(so)),t===et&&(e.substr(Vl,17)===_t?(t=_t,Vl+=17):(t=et,0===zl&&u(uo)),t===et&&(e.substr(Vl,18)===Lt?(t=Lt,Vl+=18):(t=et,0===zl&&u(lo)))))))))))),Wl[n]={i:Vl,result:t},t)}function d(){var t,n,r,a=233*Vl+19;if(t=Wl[a])return Vl=t.i,t.result;if(n=Wl[t=233*Vl+20])Vl=n.i,t=n.result;else{if(n=Vl,e.substr(Vl,6)===kt){var i=kt;Vl+=6}else i=et,0===zl&&u(co);if(i!==et)if((i=je())!==et)if(e.substr(Vl,6)===Yt?(i=Yt,Vl+=6):(i=et,0===zl&&u(po)),i!==et){i=Vl;var o=je();if(o!==et){if(r=Wl[o=233*Vl+21])Vl=r.i,o=r.result;else{if(r=Vl,e.substr(Vl,9)===ut){var s=ut;Vl+=9}else s=et,0===zl&&u(Oi);if(s!==et){var l=je();if(l!==et){var c=Ge();if(c!==et){if(He(),61===e.charCodeAt(Vl)){var p=lt;Vl++}else p=et,0===zl&&u(Si);p!==et?(Jl=r,r=["namespacePrefix",c]):(Vl=r,r=et)}else Vl=r,r=et}else Vl=r,r=et}else Vl=r,r=et;if(r===et){if(s=r=Vl,e.substr(Vl,7)===mt?(l=mt,Vl+=7):(l=et,0===zl&&u(Fi)),l!==et)if((c=je())!==et){if(e.substr(Vl,7)===Vt){var h=Vt;Vl+=7}else h=et,0===zl&&u(fo);if(h!==et)if((p=je())!==et){if(e.substr(Vl,9)===ut){var f=ut;Vl+=9}else f=et,0===zl&&u(Oi);if(f!==et){var d=Ve();d!==et?s=l=[l,c,h,p,f,d]:(Vl=s,s=et)}else Vl=s,s=et}else Vl=s,s=et;else Vl=s,s=et}else Vl=s,s=et;else Vl=s,s=et;s!==et&&(Jl=r,s=["defaultElementNamespace"]),r=s}Wl[o]={i:Vl,result:r},o=r}o!==et?(Jl=i,i=o):(Vl=i,i=et)}else Vl=i,i=et;if(i===et&&(i=null),He(),(o=Ce())!==et){if(r=Vl,(s=je())!==et)if(e.substr(Vl,2)===qt?(s=qt,Vl+=2):(s=et,0===zl&&u(ho)),s!==et)if((s=je())!==et)if((s=Ce())!==et){for(l=[],c=Vl,(h=je())!==et?(44===e.charCodeAt(Vl)?(h=Tt,Vl++):(h=et,0===zl&&u(Qi)),h!==et?(h=je())!==et?(h=Ce())!==et?(Jl=c,c=h):(Vl=c,c=et):(Vl=c,c=et):(Vl=c,c=et)):(Vl=c,c=et);c!==et;)l.push(c),c=Vl,(h=je())!==et?(44===e.charCodeAt(Vl)?(h=Tt,Vl++):(h=et,0===zl&&u(Qi)),h!==et?(h=je())!==et?(h=Ce())!==et?(Jl=c,c=h):(Vl=c,c=et):(Vl=c,c=et):(Vl=c,c=et)):(Vl=c,c=et);Jl=r,r=[s].concat(l)}else Vl=r,r=et;else Vl=r,r=et;else Vl=r,r=et;else Vl=r,r=et;r===et&&(r=null),Jl=n,n=["schemaImport"].concat(i?[i]:[],[["targetNamespace",o]],r?[r]:[])}else Vl=n,n=et}else Vl=n,n=et;else Vl=n,n=et;else Vl=n,n=et;Wl[t]={i:Vl,result:n},t=n}if(t===et)if(n=Wl[t=233*Vl+22])Vl=n.i,t=n.result;else{if(n=Vl,e.substr(Vl,6)===kt?(i=kt,Vl+=6):(i=et,0===zl&&u(co)),i!==et)if((i=je())!==et)if(e.substr(Vl,6)===st?(i=st,Vl+=6):(i=et,0===zl&&u(Ii)),i!==et)if(i=Vl,(o=je())!==et?(e.substr(Vl,9)===ut?(o=ut,Vl+=9):(o=et,0===zl&&u(Oi)),o!==et?(r=je())!==et?(s=Vl,(s=(l=Ge())!==et?e.substring(s,Vl):l)!==et?(He(),61===e.charCodeAt(Vl)?(l=lt,Vl++):(l=et,0===zl&&u(Si)),l!==et?(Jl=i,i=s):(Vl=i,i=et)):(Vl=i,i=et)):(Vl=i,i=et):(Vl=i,i=et)):(Vl=i,i=et),i===et&&(i=null),He(),(o=Ce())!==et){if(r=Vl,(s=je())!==et)if(e.substr(Vl,2)===qt?(l=qt,Vl+=2):(l=et,0===zl&&u(ho)),l!==et)if((l=je())!==et)if((s=Ce())!==et)for(r=[],s=Vl,l=He(),44===e.charCodeAt(Vl)?(c=Tt,Vl++):(c=et,0===zl&&u(Qi)),c!==et?(h=He(),(p=Ce())!==et?s=l=[l,c,h,p]:(Vl=s,s=et)):(Vl=s,s=et);s!==et;)r.push(s),s=Vl,l=He(),44===e.charCodeAt(Vl)?(c=Tt,Vl++):(c=et,0===zl&&u(Qi)),c!==et?(h=He(),(p=Ce())!==et?s=l=[l,c,h,p]:(Vl=s,s=et)):(Vl=s,s=et);else Vl=r;else Vl=r;else Vl=r;else Vl=r;Jl=n,n=["moduleImport",["namespacePrefix",i],["targetNamespace",o]]}else Vl=n,n=et;else Vl=n,n=et;else Vl=n,n=et;else Vl=n,n=et;Wl[t]={i:Vl,result:n},t=n}return Wl[a]={i:Vl,result:t},t}function m(){var t,n=233*Vl+23;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,e.substr(Vl,7)===pt){var r=pt;Vl+=7}else r=et,0===zl&&u(Ri);if(r!==et)if((r=je())!==et)if(e.substr(Vl,9)===ut?(r=ut,Vl+=9):(r=et,0===zl&&u(Oi)),r!==et)if((r=je())!==et)if((r=Ge())!==et){if(He(),61===e.charCodeAt(Vl)){var a=lt;Vl++}else a=et,0===zl&&u(Si);a!==et?(He(),(a=Ce())!==et?(Jl=t,t=["namespaceDecl",["prefix",r],["uri",a]]):(Vl=t,t=et)):(Vl=t,t=et)}else Vl=t,t=et;else Vl=t,t=et;else Vl=t,t=et;else Vl=t,t=et;else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function v(){var t,n=233*Vl+24;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,e.substr(Vl,7)===pt){var r=pt;Vl+=7}else r=et,0===zl&&u(Ri);if(r!==et)if((r=je())!==et)if(e.substr(Vl,7)===mt?(r=mt,Vl+=7):(r=et,0===zl&&u(Fi)),r!==et)if((r=je())!==et)if(e.substr(Vl,7)===Vt?(r=Vt,Vl+=7):(r=et,0===zl&&u(fo)),r===et&&(e.substr(Vl,8)===Jt?(r=Jt,Vl+=8):(r=et,0===zl&&u(mo))),r!==et){var a=je();a!==et?(e.substr(Vl,9)===ut?(a=ut,Vl+=9):(a=et,0===zl&&u(Oi)),a!==et?(a=je())!==et?(a=Ce())!==et?(Jl=t,t=["defaultNamespaceDecl",["defaultNamespaceCategory",r],["uri",a]]):(Vl=t,t=et):(Vl=t,t=et):(Vl=t,t=et)):(Vl=t,t=et)}else Vl=t,t=et;else Vl=t,t=et;else Vl=t,t=et;else Vl=t,t=et;else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function g(){var t,n=233*Vl+25;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,e.substr(Vl,7)===pt){var r=pt;Vl+=7}else r=et,0===zl&&u(Ri);if(r!==et)if((r=je())!==et){r=[];var a=Vl,i=w();if(i===et&&(i=y()),i!==et){var o=je();o!==et?(Jl=a,a=i):(Vl=a,a=et)}else Vl=a,a=et;for(;a!==et;)r.push(a),a=Vl,(i=w())===et&&(i=y()),i!==et?(o=je())!==et?(Jl=a,a=i):(Vl=a,a=et):(Vl=a,a=et);if(i=Wl[a=233*Vl+28])Vl=i.i,a=i.result;else{if(i=Vl,e.substr(Vl,8)===Wt?(o=Wt,Vl+=8):(o=et,0===zl&&u(Ao)),o!==et)if((o=je())!==et)if(36===e.charCodeAt(Vl)?(o=$t,Vl++):(o=et,0===zl&&u(xo)),o!==et)if(He(),(o=Be())!==et){var s=Vl;He();var l=me();l!==et?(Jl=s,s=l):(Vl=s,s=et),s===et&&(s=null);var c=Vl;if(He(),e.substr(Vl,2)===en?(l=en,Vl+=2):(l=et,0===zl&&u(bo)),l!==et?(He(),(l=T())!==et?(Jl=c,c=["varValue",l]):(Vl=c,c=et)):(Vl=c,c=et),c===et)if(c=Vl,(l=je())!==et)if(e.substr(Vl,8)===tn?(l=tn,Vl+=8):(l=et,0===zl&&u(Eo)),l!==et){if(l=Vl,He(),e.substr(Vl,2)===en){var p=en;Vl+=2}else p=et,0===zl&&u(bo);p!==et?(He(),(p=T())!==et?(Jl=l,l=["varValue",p]):(Vl=l,l=et)):(Vl=l,l=et),l===et&&(l=null),Jl=c,c=["external"].concat(l?[l]:[])}else Vl=c,c=et;else Vl=c,c=et;c!==et?(Jl=i,i=["varDecl",["varName"].concat(o)].concat(s?[s]:[],[c])):(Vl=i,i=et)}else Vl=i,i=et;else Vl=i,i=et;else Vl=i,i=et;else Vl=i,i=et;Wl[a]={i:Vl,result:i},a=i}a===et&&((i=Wl[a=233*Vl+30])?(Vl=i.i,a=i.result):(i=Vl,e.substr(Vl,8)===Jt?(o=Jt,Vl+=8):(o=et,0===zl&&u(mo)),o!==et?(o=je())!==et?(s=Vl,zl++,o=qe(),zl--,o===et?s=void 0:(Vl=s,s=et),s!==et?(o=Be())!==et?(He(),40===e.charCodeAt(Vl)?(s=Zt,Vl++):(s=et,0===zl&&u(yo)),s!==et?(He(),(s=x())===et&&(s=null),He(),41===e.charCodeAt(Vl)?(c=zt,Vl++):(c=et,0===zl&&u(wo)),c!==et?(c=Vl,(l=je())!==et?(e.substr(Vl,2)===an?(l=an,Vl+=2):(l=et,0===zl&&u(Co)),l!==et?(p=je())!==et?(l=ve())!==et?(Jl=c,c=l):(Vl=c,c=et):(Vl=c,c=et):(Vl=c,c=et)):(Vl=c,c=et),c===et&&(c=null),He(),l=Vl,(p=E())!==et&&(Jl=l,p=["functionBody",p]),(l=p)===et&&(l=Vl,e.substr(Vl,8)===tn?(p=tn,Vl+=8):(p=et,0===zl&&u(Eo)),p!==et&&(Jl=l,p=["externalDefinition"]),l=p),l!==et?(Jl=i,i=["functionDecl",["functionName"].concat(o),["paramList"].concat(s||[])].concat(c?[["typeDeclaration"].concat(c)]:[],[l])):(Vl=i,i=et)):(Vl=i,i=et)):(Vl=i,i=et)):(Vl=i,i=et):(Vl=i,i=et)):(Vl=i,i=et):(Vl=i,i=et),Wl[a]={i:Vl,result:i},a=i)),a!==et?(Jl=t,t=[a[0]].concat(r,a.slice(1))):(Vl=t,t=et)}else Vl=t,t=et;else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function y(){var t,n=233*Vl+26;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,e.substr(Vl,8)===Qt){var r=Qt;Vl+=8}else r=et,0===zl&&u(vo);return r!==et&&(Jl=t,r=["annotation",["annotationName","updating"]]),t=r,Wl[n]={i:Vl,result:t},t}function w(){var t,n=233*Vl+27;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,37===e.charCodeAt(Vl)){var r=Kt;Vl++}else r=et,0===zl&&u(go);if(r!==et)if(He(),(r=Be())!==et){var a=Vl;if(He(),40===e.charCodeAt(Vl)){var i=Zt;Vl++}else i=et,0===zl&&u(yo);if(i!==et)if(He(),(i=re())!==et){var o=[],s=Vl;if(He(),44===e.charCodeAt(Vl)){var l=Tt;Vl++}else l=et,0===zl&&u(Qi);for(l!==et?(He(),(l=re())!==et?(Jl=s,s=l):(Vl=s,s=et)):(Vl=s,s=et);s!==et;)o.push(s),s=Vl,He(),44===e.charCodeAt(Vl)?(l=Tt,Vl++):(l=et,0===zl&&u(Qi)),l!==et?(He(),(l=re())!==et?(Jl=s,s=l):(Vl=s,s=et)):(Vl=s,s=et);He(),41===e.charCodeAt(Vl)?(s=zt,Vl++):(s=et,0===zl&&u(wo)),s!==et?(Jl=a,a=i.concat(o)):(Vl=a,a=et)}else Vl=a,a=et;else Vl=a,a=et;a===et&&(a=null),Jl=t,t=["annotation",["annotationName"].concat(r)].concat(a?["arguments",a]:[])}else Vl=t,t=et;else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function A(){var t,n=233*Vl+29;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,e.substr(Vl,7)===pt){var r=pt;Vl+=7}else r=et,0===zl&&u(Ri);if(r!==et)if((r=je())!==et)if(e.substr(Vl,7)===nn?(r=nn,Vl+=7):(r=et,0===zl&&u(Bo)),r!==et)if((r=je())!==et)if(e.substr(Vl,4)===rn?(r=rn,Vl+=4):(r=et,0===zl&&u(No)),r!==et){var a=Vl,i=je();if(i!==et)if(e.substr(Vl,2)===an?(r=an,Vl+=2):(r=et,0===zl&&u(Co)),r!==et){var o=ge();o!==et||(Vl=a)}else Vl=a;else Vl=a;if(i=Vl,r=He(),e.substr(Vl,2)===en?(o=en,Vl+=2):(o=et,0===zl&&u(bo)),o!==et){a=He();var s=T();s!==et?i=r=[r,o,a,s]:(Vl=i,i=et)}else Vl=i,i=et;if(i===et)if(i=Vl,(r=je())!==et)if(e.substr(Vl,8)===tn?(o=tn,Vl+=8):(o=et,0===zl&&u(Eo)),o!==et){if(a=Vl,s=He(),e.substr(Vl,2)===en?(i=en,Vl+=2):(i=et,0===zl&&u(bo)),i!==et){var l=He(),c=T();c!==et?a=s=[s,i,l,c]:(Vl=a,a=et)}else Vl=a,a=et;a===et&&(a=null),i=r=[r,o,a]}else Vl=i,i=et;else Vl=i,i=et;i!==et?(Jl=t,t={type:"contextItemDecl"}):(Vl=t,t=et)}else Vl=t,t=et;else Vl=t,t=et;else Vl=t,t=et;else Vl=t,t=et;else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function x(){var t,n=233*Vl+31;if(t=Wl[n])return Vl=t.i,t.result;t=Vl;var r=b();if(r!==et){var a=[],i=Vl;if(He(),44===e.charCodeAt(Vl)){var o=Tt;Vl++}else o=et,0===zl&&u(Qi);for(o!==et?(He(),(o=b())!==et?(Jl=i,i=o):(Vl=i,i=et)):(Vl=i,i=et);i!==et;)a.push(i),i=Vl,He(),44===e.charCodeAt(Vl)?(o=Tt,Vl++):(o=et,0===zl&&u(Qi)),o!==et?(He(),(o=b())!==et?(Jl=i,i=o):(Vl=i,i=et)):(Vl=i,i=et);Jl=t,t=[r].concat(a)}else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function b(){var t,n=233*Vl+32;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,36===e.charCodeAt(Vl)){var r=$t;Vl++}else r=et,0===zl&&u(xo);if(r!==et)if((r=Be())!==et){var a=Vl,i=je();i!==et?(i=me())!==et?(Jl=a,a=i):(Vl=a,a=et):(Vl=a,a=et),a===et&&(a=null),Jl=t,t=["param",["varName"].concat(r)].concat(a?[a]:[])}else Vl=t,t=et;else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function E(){var e,t=233*Vl+33;if(e=Wl[t])return Vl=e.i,e.result;e=Vl;var n=B();return n!==et&&(Jl=e,n=n||["sequenceExpr"]),e=n,Wl[t]={i:Vl,result:e},e}function B(){var t,n=233*Vl+34;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,123===e.charCodeAt(Vl)){var r=on;Vl++}else r=et,0===zl&&u(To);if(r!==et){if(He(),(r=C())===et&&(r=null),He(),125===e.charCodeAt(Vl)){var a=sn;Vl++}else a=et,0===zl&&u(Io);a!==et?(Jl=t,t=r||null):(Vl=t,t=et)}else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function N(){var t,n=233*Vl+35;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,e.substr(Vl,7)===pt){var r=pt;Vl+=7}else r=et,0===zl&&u(Ri);return r!==et?(r=je())!==et?(e.substr(Vl,6)===un?(r=un,Vl+=6):(r=et,0===zl&&u(Oo)),r!==et?(r=je())!==et?(r=Be())!==et?(r=je())!==et?(r=Ce())!==et?(Jl=t,t={type:"optionDecl"}):(Vl=t,t=et):(Vl=t,t=et):(Vl=t,t=et):(Vl=t,t=et):(Vl=t,t=et)):(Vl=t,t=et):(Vl=t,t=et),Wl[n]={i:Vl,result:t},t}function C(){var t,n=233*Vl+37;if(t=Wl[n])return Vl=t.i,t.result;t=Vl;var r=T();if(r!==et){var a=[],i=Vl;if(He(),44===e.charCodeAt(Vl)){var o=Tt;Vl++}else o=et,0===zl&&u(Qi);for(o!==et?(He(),(o=T())!==et?(Jl=i,i=o):(Vl=i,i=et)):(Vl=i,i=et);i!==et;)a.push(i),i=Vl,He(),44===e.charCodeAt(Vl)?(o=Tt,Vl++):(o=et,0===zl&&u(Qi)),o!==et?(He(),(o=T())!==et?(Jl=i,i=o):(Vl=i,i=et)):(Vl=i,i=et);Jl=t,t=0===a.length?r:["sequenceExpr",r].concat(a)}else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function T(){var t=233*Vl+38,n=Wl[t];if(n)return Vl=n.i,n.result;var r=Vl,a=233*Vl+39,i=Wl[a];if(i){Vl=i.i;var o=i.result}else{var s=Vl,l=I();if(l!==et){var c=[],p=Vl,h=He(),f=O();for(f!==et?(Jl=p,p=f):(Vl=p,p=et);p!==et;)c.push(p),p=Vl,h=He(),(f=O())!==et?(Jl=p,p=f):(Vl=p,p=et);p=He();var d=233*Vl+58,m=Wl[d];if(m)Vl=m.i,h=m.result;else{var v=Vl;if(e.substr(Vl,6)===wn){var g=wn;Vl+=6}else g=et,0===zl&&u(Xo);if(g!==et){He();var y=T();y!==et?(Jl=v,v=["returnClause",y]):(Vl=v,v=et)}else Vl=v,v=et;Wl[d]={i:Vl,result:v},h=v}h!==et?(Jl=s,s=["flworExpr",l].concat(c,[h])):(Vl=s,s=et)}else Vl=s,s=et;Wl[a]={i:Vl,result:s},o=s}if(o!==et&&(Jl=r,o=$e(o)),(r=o)===et){r=Vl;var w=233*Vl+59,A=Wl[w];if(A)Vl=A.i,o=A.result;else{var x=Vl;if(e.substr(Vl,4)===An){var b=An;Vl+=4}else b=et,0===zl&&u(_o);if(b===et&&(e.substr(Vl,5)===xn?(b=xn,Vl+=5):(b=et,0===zl&&u(Lo))),b!==et)if(je()!==et){var E=233*Vl+60,B=Wl[E];if(B){Vl=B.i;var N=B.result}else{var S=Vl,D=M();if(D!==et){var R=[],G=Vl;if(He(),44===e.charCodeAt(Vl)){var P=Tt;Vl++}else P=et,0===zl&&u(Qi);if(P!==et){He();var H=M();H!==et?(Jl=G,G=H):(Vl=G,G=et)}else Vl=G,G=et;for(;G!==et;)R.push(G),G=Vl,He(),44===e.charCodeAt(Vl)?(P=Tt,Vl++):(P=et,0===zl&&u(Qi)),P!==et?(He(),(H=M())!==et?(Jl=G,G=H):(Vl=G,G=et)):(Vl=G,G=et);Jl=S,S=[D].concat(R)}else Vl=S,S=et;Wl[E]={i:Vl,result:S},N=S}if(N!==et)if(je()!==et){if(e.substr(Vl,9)===bn){var j=bn;Vl+=9}else j=et,0===zl&&u(ko);if(j!==et)if(je()!==et){var X=T();X!==et?(Jl=x,x=["quantifiedExpr",["quantifier",b]].concat(N,[["predicateExpr",X]])):(Vl=x,x=et)}else Vl=x,x=et;else Vl=x,x=et}else Vl=x,x=et;else Vl=x,x=et}else Vl=x,x=et;else Vl=x,x=et;Wl[w]={i:Vl,result:x},o=x}if(o!==et&&(Jl=r,o=$e(o)),(r=o)===et){r=Vl;var _=233*Vl+62,L=Wl[_];if(L)Vl=L.i,o=L.result;else{var k=Vl;if(e.substr(Vl,10)===En){var Y=En;Vl+=10}else Y=et,0===zl&&u(Yo);if(Y!==et){if(He(),40===e.charCodeAt(Vl)){var q=Zt;Vl++}else q=et,0===zl&&u(yo);if(q!==et){var V=C();if(V!==et){if(41===e.charCodeAt(Vl)){var J=zt;Vl++}else J=et,0===zl&&u(wo);if(J!==et){He();var Q=[],K=Vl,Z=U();if(Z!==et){var z=He();Jl=K,K=Z}else Vl=K,K=et;if(K!==et)for(;K!==et;)Q.push(K),K=Vl,(Z=U())!==et?(z=He(),Jl=K,K=Z):(Vl=K,K=et);else Q=et;if(Q!==et)if(e.substr(Vl,7)===mt?(K=mt,Vl+=7):(K=et,0===zl&&u(Fi)),K!==et)if((Z=je())!==et){if(z=Vl,36===e.charCodeAt(Vl)){var W=$t;Vl++}else W=et,0===zl&&u(xo);if(W!==et){var $=Be();if($!==et){var ee=je();ee!==et?(Jl=z,z=$):(Vl=z,z=et)}else Vl=z,z=et}else Vl=z,z=et;z===et&&(z=null),e.substr(Vl,6)===wn?(W=wn,Vl+=6):(W=et,0===zl&&u(Xo)),W!==et?($=je())!==et?(ee=T())!==et?(Jl=k,k=["typeswitchExpr",["argExpr",V]].concat(Q,[["typeswitchExprDefaultClause"].concat(z||[],[["resultExpr",ee]])])):(Vl=k,k=et):(Vl=k,k=et):(Vl=k,k=et)}else Vl=k,k=et;else Vl=k,k=et;else Vl=k,k=et}else Vl=k,k=et}else Vl=k,k=et}else Vl=k,k=et}else Vl=k,k=et;Wl[_]={i:Vl,result:k},o=k}if(o!==et&&(Jl=r,o=$e(o)),(r=o)===et){r=Vl;var te=233*Vl+65,ne=Wl[te];if(ne)Vl=ne.i,o=ne.result;else{var re=Vl;if(e.substr(Vl,2)===Cn){var ae=Cn;Vl+=2}else ae=et,0===zl&&u(Jo);if(ae!==et){if(He(),40===e.charCodeAt(Vl)){var ie=Zt;Vl++}else ie=et,0===zl&&u(yo);if(ie!==et){He();var oe=C();if(oe!==et){if(He(),41===e.charCodeAt(Vl)){var se=zt;Vl++}else se=et,0===zl&&u(wo);if(se!==et){if(He(),e.substr(Vl,4)===Tn){var ue=Tn;Vl+=4}else ue=et,0===zl&&u(Qo);if(ue!==et)if(Ve()!==et){He();var le=T();if(le!==et){if(He(),e.substr(Vl,4)===In){var ce=In;Vl+=4}else ce=et,0===zl&&u(Ko);if(ce!==et)if(Ve()!==et){He();var pe=T();pe!==et?(Jl=re,re=["ifThenElseExpr",["ifClause",oe],["thenClause",le],["elseClause",pe]]):(Vl=re,re=et)}else Vl=re,re=et;else Vl=re,re=et}else Vl=re,re=et}else Vl=re,re=et;else Vl=re,re=et}else Vl=re,re=et}else Vl=re,re=et}else Vl=re,re=et}else Vl=re,re=et;Wl[te]={i:Vl,result:re},o=re}if(o!==et&&(Jl=r,o=$e(o)),(r=o)===et){r=Vl;var he=233*Vl+214,fe=Wl[he];if(fe)Vl=fe.i,o=fe.result;else{var de=Vl;if(e.substr(Vl,6)===ja){var me=ja;Vl+=6}else me=et,0===zl&&u(Bl);if(me!==et)if(je()!==et){if(e.substr(Vl,5)===Xa){var ve=Xa;Vl+=5}else ve=et,0===zl&&u(Nl);if(ve===et&&(e.substr(Vl,4)===_a?(ve=_a,Vl+=4):(ve=et,0===zl&&u(Cl))),ve!==et)if(je()!==et){var ge=T();if(ge!==et)if(je()!==et){var ye,we=233*Vl+213,Ae=Wl[we];if(Ae){Vl=Ae.i;var xe=Ae.result}else{var be=ye=Vl;if(e.substr(Vl,2)===an){var Ee=an;Vl+=2}else Ee=et,0===zl&&u(Co);if(Ee!==et)if(je()!==et){var Ne=Vl;if(e.substr(Vl,5)===Ma){var Ce=Ma;Vl+=5}else Ce=et,0===zl&&u(wl);Ce!==et&&(Jl=Ne,Ce=["insertAsFirst"]),(Ne=Ce)===et&&(Ne=Vl,e.substr(Vl,4)===Ua?(Ce=Ua,Vl+=4):(Ce=et,0===zl&&u(Al)),Ce!==et&&(Jl=Ne,Ce=["insertAsLast"]),Ne=Ce),Ne!==et?(Ce=je())!==et?(Jl=be,be=Ne):(Vl=be,be=et):(Vl=be,be=et)}else Vl=be,be=et;else Vl=be,be=et;be===et&&(be=null),e.substr(Vl,4)===Fa?(Ee=Fa,Vl+=4):(Ee=et,0===zl&&u(xl)),Ee!==et?(Jl=ye,ye=be?["insertInto",be]:["insertInto"]):(Vl=ye,ye=et),ye===et&&(ye=Vl,e.substr(Vl,5)===Pa?(be=Pa,Vl+=5):(be=et,0===zl&&u(bl)),be!==et&&(Jl=ye,be=["insertAfter"]),(ye=be)===et&&(ye=Vl,e.substr(Vl,6)===Ha?(be=Ha,Vl+=6):(be=et,0===zl&&u(El)),be!==et&&(Jl=ye,be=["insertBefore"]),ye=be)),Wl[we]={i:Vl,result:ye},xe=ye}if(xe!==et)if(je()!==et){var Te=T();Te!==et?(Jl=de,de=["insertExpr",["sourceExpr",ge],xe,["targetExpr",Te]]):(Vl=de,de=et)}else Vl=de,de=et;else Vl=de,de=et}else Vl=de,de=et;else Vl=de,de=et}else Vl=de,de=et;else Vl=de,de=et}else Vl=de,de=et;else Vl=de,de=et;Wl[he]={i:Vl,result:de},o=de}if(o!==et&&(Jl=r,o=$e(o)),(r=o)===et){r=Vl;var Ie=233*Vl+215,Oe=Wl[Ie];if(Oe)Vl=Oe.i,o=Oe.result;else{var Se=Vl;if(e.substr(Vl,6)===La){var De=La;Vl+=6}else De=et,0===zl&&u(Tl);if(De!==et)if(je()!==et){if(e.substr(Vl,5)===Xa){var Re=Xa;Vl+=5}else Re=et,0===zl&&u(Nl);if(Re===et&&(e.substr(Vl,4)===_a?(Re=_a,Vl+=4):(Re=et,0===zl&&u(Cl))),Re!==et)if(je()!==et){var Ge=T();Ge!==et?(Jl=Se,Se=["deleteExpr",["targetExpr",Ge]]):(Vl=Se,Se=et)}else Vl=Se,Se=et;else Vl=Se,Se=et}else Vl=Se,Se=et;else Vl=Se,Se=et;Wl[Ie]={i:Vl,result:Se},o=Se}if(o!==et&&(Jl=r,o=$e(o)),(r=o)===et){r=Vl;var Me=233*Vl+217,Ue=Wl[Me];if(Ue)Vl=Ue.i,o=Ue.result;else{var Fe=Vl;if(e.substr(Vl,6)===Va){var Xe=Va;Vl+=6}else Xe=et,0===zl&&u(Dl);if(Xe!==et)if(je()!==et){if(e.substr(Vl,4)===_a){var _e=_a;Vl+=4}else _e=et,0===zl&&u(Cl);if(_e!==et){He();var Le=T();if(Le!==et)if(je()!==et){if(e.substr(Vl,2)===an){var ke=an;Vl+=2}else ke=et,0===zl&&u(Co);if(ke!==et)if(je()!==et){var Ye=T();Ye!==et?(Jl=Fe,Fe=["renameExpr",["targetExpr",Le],["newNameExpr",Ye]]):(Vl=Fe,Fe=et)}else Vl=Fe,Fe=et;else Vl=Fe,Fe=et}else Vl=Fe,Fe=et;else Vl=Fe,Fe=et}else Vl=Fe,Fe=et}else Vl=Fe,Fe=et;else Vl=Fe,Fe=et;Wl[Me]={i:Vl,result:Fe},o=Fe}if(o!==et&&(Jl=r,o=$e(o)),(r=o)===et){r=Vl;var qe=233*Vl+216,Qe=Wl[qe];if(Qe)Vl=Qe.i,o=Qe.result;else{var Ke=Vl;if(e.substr(Vl,7)===ka){var Ze=ka;Vl+=7}else Ze=et,0===zl&&u(Il);if(Ze!==et)if(je()!==et){var ze=Vl;if(e.substr(Vl,5)===Ya){var We=Ya;Vl+=5}else We=et,0===zl&&u(Ol);if(We!==et){var tt=je();if(tt!==et){if(e.substr(Vl,2)===kn){var nt=kn;Vl+=2}else nt=et,0===zl&&u(cs);if(nt!==et){var rt=je();rt!==et?ze=We=[We,tt,nt,rt]:(Vl=ze,ze=et)}else Vl=ze,ze=et}else Vl=ze,ze=et}else Vl=ze,ze=et;if(ze===et&&(ze=null),e.substr(Vl,4)===_a?(We=_a,Vl+=4):(We=et,0===zl&&u(Cl)),We!==et)if((tt=je())!==et)if((nt=T())!==et)if((rt=je())!==et){if(e.substr(Vl,4)===qa){var at=qa;Vl+=4}else at=et,0===zl&&u(Sl);if(at!==et)if(je()!==et){var it=T();it!==et?(Jl=Ke,Ke=ze?["replaceExpr",["replaceValue"],["targetExpr",nt],["replacementExpr",it]]:["replaceExpr",["targetExpr",nt],["replacementExpr",it]]):(Vl=Ke,Ke=et)}else Vl=Ke,Ke=et;else Vl=Ke,Ke=et}else Vl=Ke,Ke=et;else Vl=Ke,Ke=et;else Vl=Ke,Ke=et;else Vl=Ke,Ke=et}else Vl=Ke,Ke=et;else Vl=Ke,Ke=et;Wl[qe]={i:Vl,result:Ke},o=Ke}if(o!==et&&(Jl=r,o=$e(o)),(r=o)===et){r=Vl;var ot=233*Vl+218,st=Wl[ot];if(st)Vl=st.i,o=st.result;else{var ut=Vl;if(e.substr(Vl,4)===Ja){var lt=Ja;Vl+=4}else lt=et,0===zl&&u(Rl);if(lt!==et)if(je()!==et){var ct=Pe();if(ct!==et){var pt=[],ht=Vl,ft=He();if(44===e.charCodeAt(Vl)){var dt=Tt;Vl++}else dt=et,0===zl&&u(Qi);if(dt!==et){var vt=He(),gt=Pe();gt!==et?(Jl=ht,ht=gt):(Vl=ht,ht=et)}else Vl=ht,ht=et;for(;ht!==et;)pt.push(ht),ht=Vl,ft=He(),44===e.charCodeAt(Vl)?(dt=Tt,Vl++):(dt=et,0===zl&&u(Qi)),dt!==et?(vt=He(),(gt=Pe())!==et?(Jl=ht,ht=gt):(Vl=ht,ht=et)):(Vl=ht,ht=et);if(ht=He(),e.substr(Vl,6)===Qa?(ft=Qa,Vl+=6):(ft=et,0===zl&&u(Gl)),ft!==et)if((dt=je())!==et)if((vt=T())!==et)if((gt=je())!==et){if(e.substr(Vl,6)===wn){var yt=wn;Vl+=6}else yt=et,0===zl&&u(Xo);if(yt!==et)if(je()!==et){var wt=T();wt!==et?(Jl=ut,ut=["transformExpr",["transformCopies",ct].concat(pt),["modifyExpr",vt],["returnExpr",wt]]):(Vl=ut,ut=et)}else Vl=ut,ut=et;else Vl=ut,ut=et}else Vl=ut,ut=et;else Vl=ut,ut=et;else Vl=ut,ut=et;else Vl=ut,ut=et}else Vl=ut,ut=et}else Vl=ut,ut=et;else Vl=ut,ut=et;Wl[ot]={i:Vl,result:ut},o=ut}if(o!==et&&(Jl=r,o=$e(o)),(r=o)===et){r=Vl;var At=233*Vl+66,xt=Wl[At];if(xt)Vl=xt.i,o=xt.result;else{var bt=Vl,Et=F();if(Et!==et){var Bt=[],Nt=Vl;if(He(),e.substr(Vl,2)===On){var Ct=On;Vl+=2}else Ct=et,0===zl&&u(Zo);if(Ct!==et){var It=Ve();if(It!==et){He();var Ot=F();Ot!==et?(Jl=Nt,Nt=Ot):(Vl=Nt,Nt=et)}else Vl=Nt,Nt=et}else Vl=Nt,Nt=et;for(;Nt!==et;)Bt.push(Nt),Nt=Vl,He(),e.substr(Vl,2)===On?(Ct=On,Vl+=2):(Ct=et,0===zl&&u(Zo)),Ct!==et?(It=Ve())!==et?(He(),(Ot=F())!==et?(Jl=Nt,Nt=Ot):(Vl=Nt,Nt=et)):(Vl=Nt,Nt=et):(Vl=Nt,Nt=et);Jl=bt,bt=Je("orOp",Et,Bt)}else Vl=bt,bt=et;Wl[At]={i:Vl,result:bt},o=bt}o!==et&&(Jl=r,o=$e(o)),r=o}}}}}}}}}return Wl[t]={i:Vl,result:r},r}function I(){var t,n,r=233*Vl+40;if(t=Wl[r])return Vl=t.i,t.result;if(n=Wl[t=233*Vl+42])Vl=n.i,t=n.result;else{if(n=Vl,e.substr(Vl,3)===ln){var a=ln;Vl+=3}else a=et,0===zl&&u(So);if(a!==et)if((a=je())!==et)if((a=S())!==et){var i=[],o=Vl;if(He(),44===e.charCodeAt(Vl)){var s=Tt;Vl++}else s=et,0===zl&&u(Qi);for(s!==et?(He(),(s=S())!==et?(Jl=o,o=s):(Vl=o,o=et)):(Vl=o,o=et);o!==et;)i.push(o),o=Vl,He(),44===e.charCodeAt(Vl)?(s=Tt,Vl++):(s=et,0===zl&&u(Qi)),s!==et?(He(),(s=S())!==et?(Jl=o,o=s):(Vl=o,o=et)):(Vl=o,o=et);Jl=n,n=["forClause",a].concat(i)}else Vl=n,n=et;else Vl=n,n=et;else Vl=n,n=et;Wl[t]={i:Vl,result:n},t=n}if(t===et)if(n=Wl[t=233*Vl+46])Vl=n.i,t=n.result;else{if(n=Vl,e.substr(Vl,3)===hn?(a=hn,Vl+=3):(a=et,0===zl&&u(Go)),a!==et)if(He(),(a=D())!==et){for(He(),i=[],o=Vl,44===e.charCodeAt(Vl)?(s=Tt,Vl++):(s=et,0===zl&&u(Qi)),s!==et?(He(),(s=D())!==et?(Jl=o,o=s):(Vl=o,o=et)):(Vl=o,o=et);o!==et;)i.push(o),o=Vl,44===e.charCodeAt(Vl)?(s=Tt,Vl++):(s=et,0===zl&&u(Qi)),s!==et?(He(),(s=D())!==et?(Jl=o,o=s):(Vl=o,o=et)):(Vl=o,o=et);Jl=n,n=["letClause",a].concat(i)}else Vl=n,n=et;else Vl=n,n=et;Wl[t]={i:Vl,result:n},t=n}return Wl[r]={i:Vl,result:t},t}function O(){var t,n=233*Vl+41;if(t=Wl[n])return Vl=t.i,t.result;if((t=I())===et){var r;if(r=Wl[t=233*Vl+48])Vl=r.i,t=r.result;else{if(r=Vl,e.substr(Vl,5)===fn){var a=fn;Vl+=5}else a=et,0===zl&&u(Mo);a!==et?(a=Ve())!==et?(He(),(a=T())!==et?(Jl=r,r=["whereClause",a]):(Vl=r,r=et)):(Vl=r,r=et):(Vl=r,r=et),Wl[t]={i:Vl,result:r},t=r}if(t===et){if(r=Wl[t=233*Vl+49])Vl=r.i,t=r.result;else{if(r=Vl,e.substr(Vl,5)===dn?(a=dn,Vl+=5):(a=et,0===zl&&u(Uo)),a!==et)if((a=je())!==et)if(e.substr(Vl,2)===mn?(a=mn,Vl+=2):(a=et,0===zl&&u(Fo)),a!==et){var i;if(He(),i=Wl[a=233*Vl+50])Vl=i.i,a=i.result;else{i=Vl;var o=R();if(o!==et){var s=[],l=Vl;if(He(),44===e.charCodeAt(Vl)){var c=Tt;Vl++}else c=et,0===zl&&u(Qi);for(c!==et?(He(),(c=R())!==et?(Jl=l,l=c):(Vl=l,l=et)):(Vl=l,l=et);l!==et;)s.push(l),l=Vl,He(),44===e.charCodeAt(Vl)?(c=Tt,Vl++):(c=et,0===zl&&u(Qi)),c!==et?(He(),(c=R())!==et?(Jl=l,l=c):(Vl=l,l=et)):(Vl=l,l=et);Jl=i,i=[o].concat(s)}else Vl=i,i=et;Wl[a]={i:Vl,result:i},a=i}a!==et?(Jl=r,r=["groupByClause"].concat(a)):(Vl=r,r=et)}else Vl=r,r=et;else Vl=r,r=et;else Vl=r,r=et;Wl[t]={i:Vl,result:r},t=r}if(t===et)if(r=Wl[t=233*Vl+54])Vl=r.i,t=r.result;else{if(a=r=Vl,e.substr(Vl,5)===bt?(i=bt,Vl+=5):(i=et,0===zl&&u(ki)),i!==et?(i=je())!==et?(e.substr(Vl,2)===mn?(i=mn,Vl+=2):(i=et,0===zl&&u(Fo)),i!==et?(Jl=a,a=!1):(Vl=a,a=et)):(Vl=a,a=et):(Vl=a,a=et),a===et&&(a=Vl,e.substr(Vl,6)===vn?(i=vn,Vl+=6):(i=et,0===zl&&u(Po)),i!==et?(i=je())!==et?(e.substr(Vl,5)===bt?(i=bt,Vl+=5):(i=et,0===zl&&u(ki)),i!==et?(i=je())!==et?(e.substr(Vl,2)===mn?(i=mn,Vl+=2):(i=et,0===zl&&u(Fo)),i!==et?(Jl=a,a=!0):(Vl=a,a=et)):(Vl=a,a=et):(Vl=a,a=et)):(Vl=a,a=et):(Vl=a,a=et)),a!==et){if(He(),o=Wl[i=233*Vl+55])Vl=o.i,i=o.result;else{if(o=Vl,(s=G())!==et){if(l=[],c=Vl,He(),44===e.charCodeAt(Vl)){var p=Tt;Vl++}else p=et,0===zl&&u(Qi);for(p!==et?(He(),(p=G())!==et?(Jl=c,c=p):(Vl=c,c=et)):(Vl=c,c=et);c!==et;)l.push(c),c=Vl,He(),44===e.charCodeAt(Vl)?(p=Tt,Vl++):(p=et,0===zl&&u(Qi)),p!==et?(He(),(p=G())!==et?(Jl=c,c=p):(Vl=c,c=et)):(Vl=c,c=et);Jl=o,o=[s].concat(l)}else Vl=o,o=et;Wl[i]={i:Vl,result:o},i=o}i!==et?(Jl=r,r=["orderByClause"].concat(a?[["stable"]]:[],i)):(Vl=r,r=et)}else Vl=r,r=et;Wl[t]={i:Vl,result:r},t=r}}}return Wl[n]={i:Vl,result:t},t}function S(){var t,n,r=233*Vl+43;if(t=Wl[r])return Vl=t.i,t.result;if(t=Vl,36===e.charCodeAt(Vl)){var a=$t;Vl++}else a=et,0===zl&&u(xo);if(a!==et)if((a=Be())!==et){He();var i=me();i===et&&(i=null),He();var o=233*Vl+44;if(n=Wl[o])Vl=n.i,o=n.result;else{if(n=Vl,e.substr(Vl,8)===pn){var s=pn;Vl+=8}else s=et,0===zl&&u(Ro);if(s!==et){var l=je();if(l!==et){if(e.substr(Vl,5)===Et){var c=Et;Vl+=5}else c=et,0===zl&&u(Yi);c!==et?n=s=[s,l,c]:(Vl=n,n=et)}else Vl=n,n=et}else Vl=n,n=et;Wl[o]={i:Vl,result:n},o=n}o===et&&(o=null),He(),(s=Wl[n=233*Vl+45])?(Vl=s.i,n=s.result):(s=Vl,e.substr(Vl,2)===qt?(l=qt,Vl+=2):(l=et,0===zl&&u(ho)),l!==et?(l=je())!==et?(36===e.charCodeAt(Vl)?(l=$t,Vl++):(l=et,0===zl&&u(xo)),l!==et?(l=Be())!==et?(Jl=s,s=["positionalVariableBinding"].concat(l)):(Vl=s,s=et):(Vl=s,s=et)):(Vl=s,s=et):(Vl=s,s=et),Wl[n]={i:Vl,result:s},n=s),n===et&&(n=null),He(),e.substr(Vl,2)===cn?(s=cn,Vl+=2):(s=et,0===zl&&u(Do)),s!==et?(He(),(s=T())!==et?(Jl=t,t=["forClauseItem",["typedVariableBinding",["varName"].concat(a,i?[i]:[])]].concat(o?[["allowingEmpty"]]:[],n?[n]:[],[["forExpr",s]])):(Vl=t,t=et)):(Vl=t,t=et)}else Vl=t,t=et;else Vl=t,t=et;return Wl[r]={i:Vl,result:t},t}function D(){var t,n=233*Vl+47;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,36===e.charCodeAt(Vl)){var r=$t;Vl++}else r=et,0===zl&&u(xo);if(r!==et)if((r=Be())!==et){He();var a=me();if(a===et&&(a=null),He(),e.substr(Vl,2)===en){var i=en;Vl+=2}else i=et,0===zl&&u(bo);i!==et?(He(),(i=T())!==et?(Jl=t,t=["letClauseItem",["typedVariableBinding",["varName"].concat(r)].concat(a?[a]:[]),["letExpr",i]]):(Vl=t,t=et)):(Vl=t,t=et)}else Vl=t,t=et;else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function R(){var t,n,r=233*Vl+51;if(t=Wl[r])return Vl=t.i,t.result;t=Vl;var a=233*Vl+53;if(n=Wl[a])Vl=n.i,a=n.result;else{if(n=Vl,36===e.charCodeAt(Vl)){var i=$t;Vl++}else i=et,0===zl&&u(xo);i!==et?(i=Be())!==et?(Jl=n,n=["varName"].concat(i)):(Vl=n,n=et):(Vl=n,n=et),Wl[a]={i:Vl,result:n},a=n}if(a!==et){if(i=Wl[n=233*Vl+52])Vl=i.i,n=i.result;else{i=Vl,He();var o=me();if(o===et&&(o=null),He(),e.substr(Vl,2)===en){var s=en;Vl+=2}else s=et,0===zl&&u(bo);s!==et?(He(),(s=T())!==et?(Jl=i,i=["groupVarInitialize"].concat(o?[["typeDeclaration"].concat(o)]:[],[["varValue",s]])):(Vl=i,i=et)):(Vl=i,i=et),Wl[n]={i:Vl,result:i},n=i}n===et&&(n=null),i=Vl,He(),e.substr(Vl,9)===vt?(o=vt,Vl+=9):(o=et,0===zl&&u(Pi)),o!==et?(He(),(o=Ce())!==et?(Jl=i,i=["collation",o]):(Vl=i,i=et)):(Vl=i,i=et),i===et&&(i=null),Jl=t,t=["groupingSpec",a].concat(n?[n]:[],i?[i]:[])}else Vl=t,t=et;return Wl[r]={i:Vl,result:t},t}function G(){var t,n=233*Vl+56;if(t=Wl[n])return Vl=t.i,t.result;t=Vl;var r=T();if(r!==et){var a;He();var i=233*Vl+57;if(a=Wl[i])Vl=a.i,i=a.result;else{if(a=Vl,e.substr(Vl,9)===gn){var o=gn;Vl+=9}else o=et,0===zl&&u(Ho);o===et&&(e.substr(Vl,10)===yn?(o=yn,Vl+=10):(o=et,0===zl&&u(jo))),o===et&&(o=null),He();var s=Vl;if(e.substr(Vl,5)===Et){var l=Et;Vl+=5}else l=et,0===zl&&u(Yi);if(l!==et){He();var c=Vl;if(e.substr(Vl,8)===Bt){var p=Bt;Vl+=8}else p=et,0===zl&&u(qi);p!==et&&(Jl=c,p="empty greatest"),(c=p)===et&&(c=Vl,e.substr(Vl,5)===Nt?(p=Nt,Vl+=5):(p=et,0===zl&&u(Vi)),p!==et&&(Jl=c,p="empty least"),c=p),c!==et?(Jl=s,s=c):(Vl=s,s=et)}else Vl=s,s=et;if(s===et&&(s=null),He(),l=Vl,e.substr(Vl,9)===vt?(c=vt,Vl+=9):(c=et,0===zl&&u(Pi)),c!==et){p=He();var h=Ce();h!==et?l=c=[c,p,h]:(Vl=l,l=et)}else Vl=l,l=et;l===et&&(l=null),Jl=a,a=o||s||l?["orderModifier"].concat(o?[["orderingKind",o]]:[],s?[["emptyOrderingMode",s]]:[],l?[["collation",l]]:[]):null,Wl[i]={i:Vl,result:a},i=a}Jl=t,t=["orderBySpec",["orderByExpr",r]].concat(i?[i]:[])}else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function M(){var t,n=233*Vl+61;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,36===e.charCodeAt(Vl)){var r=$t;Vl++}else r=et,0===zl&&u(xo);if(r!==et)if((r=Be())!==et){var a=Vl,i=je();i!==et?(i=me())!==et?(Jl=a,a=i):(Vl=a,a=et):(Vl=a,a=et),a===et&&(a=null),(i=je())!==et?(e.substr(Vl,2)===cn?(i=cn,Vl+=2):(i=et,0===zl&&u(Do)),i!==et?(i=je())!==et?(i=T())!==et?(Jl=t,t=["quantifiedExprInClause",["typedVariableBinding",["varName"].concat(r)].concat(a?[a]:[]),["sourceExpr",i]]):(Vl=t,t=et):(Vl=t,t=et):(Vl=t,t=et)):(Vl=t,t=et)}else Vl=t,t=et;else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function U(){var t,n=233*Vl+63;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,e.substr(Vl,4)===Bn){var r=Bn;Vl+=4}else r=et,0===zl&&u(qo);if(r!==et){if(He(),r=Vl,36===e.charCodeAt(Vl)){var a=$t;Vl++}else a=et,0===zl&&u(xo);if(a!==et)if((a=Be())!==et){var i=je();i!==et?(e.substr(Vl,2)===an?(i=an,Vl+=2):(i=et,0===zl&&u(Co)),i!==et?(Jl=r,r=a):(Vl=r,r=et)):(Vl=r,r=et)}else Vl=r,r=et;else Vl=r,r=et;if(r===et&&(r=null),He(),i=Wl[a=233*Vl+64])Vl=i.i,a=i.result;else{i=Vl;var o=ve();if(o!==et){var s=[],l=Vl;if(He(),124===e.charCodeAt(Vl)){var c=Nn;Vl++}else c=et,0===zl&&u(Vo);for(c!==et?(He(),(c=ve())!==et?(Jl=l,l=c):(Vl=l,l=et)):(Vl=l,l=et);l!==et;)s.push(l),l=Vl,He(),124===e.charCodeAt(Vl)?(c=Nn,Vl++):(c=et,0===zl&&u(Vo)),c!==et?(He(),(c=ve())!==et?(Jl=l,l=c):(Vl=l,l=et)):(Vl=l,l=et);Jl=i,i=function(e,t){return t.length?[["sequenceTypeUnion",["sequenceType"].concat(e)].concat(t.map((function(e){return["sequenceType"].concat(e)})))]:[["sequenceType"].concat(e)]}(o,s)}else Vl=i,i=et;Wl[a]={i:Vl,result:i},a=i}a!==et?(i=je())!==et?(e.substr(Vl,6)===wn?(i=wn,Vl+=6):(i=et,0===zl&&u(Xo)),i!==et?(i=je())!==et?(i=T())!==et?(Jl=t,t=["typeswitchExprCaseClause"].concat(r?[["variableBinding"].concat(r)]:[],a,[["resultExpr",i]])):(Vl=t,t=et):(Vl=t,t=et):(Vl=t,t=et)):(Vl=t,t=et):(Vl=t,t=et)}else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function F(){var t,n=233*Vl+67;if(t=Wl[n])return Vl=t.i,t.result;t=Vl;var r=P();if(r!==et){var a=[],i=Vl;if(He(),e.substr(Vl,3)===Sn){var o=Sn;Vl+=3}else o=et,0===zl&&u(zo);for(o!==et?(o=Ve())!==et?(He(),(o=P())!==et?(Jl=i,i=o):(Vl=i,i=et)):(Vl=i,i=et):(Vl=i,i=et);i!==et;)a.push(i),i=Vl,He(),e.substr(Vl,3)===Sn?(o=Sn,Vl+=3):(o=et,0===zl&&u(zo)),o!==et?(o=Ve())!==et?(He(),(o=P())!==et?(Jl=i,i=o):(Vl=i,i=et)):(Vl=i,i=et):(Vl=i,i=et);Jl=t,t=Je("andOp",r,a)}else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function P(){var t,n,r=233*Vl+68;if(t=Wl[r])return Vl=t.i,t.result;t=Vl;var a=H();if(a!==et){var i=Vl;He();var o=233*Vl+83;if(n=Wl[o])Vl=n.i,o=n.result;else{if(n=Vl,e.substr(Vl,2)===$n){var s=$n;Vl+=2}else s=et,0===zl&&u(As);s!==et?(s=Ve())!==et?(Jl=n,n="eqOp"):(Vl=n,n=et):(Vl=n,n=et),n===et&&(n=Vl,e.substr(Vl,2)===er?(s=er,Vl+=2):(s=et,0===zl&&u(xs)),s!==et?(s=Ve())!==et?(Jl=n,n="neOp"):(Vl=n,n=et):(Vl=n,n=et),n===et&&(n=Vl,e.substr(Vl,2)===tr?(s=tr,Vl+=2):(s=et,0===zl&&u(bs)),s!==et?(s=Ve())!==et?(Jl=n,n="ltOp"):(Vl=n,n=et):(Vl=n,n=et),n===et&&(n=Vl,e.substr(Vl,2)===nr?(s=nr,Vl+=2):(s=et,0===zl&&u(Es)),s!==et?(s=Ve())!==et?(Jl=n,n="leOp"):(Vl=n,n=et):(Vl=n,n=et),n===et&&(n=Vl,e.substr(Vl,2)===rr?(s=rr,Vl+=2):(s=et,0===zl&&u(Bs)),s!==et?(s=Ve())!==et?(Jl=n,n="gtOp"):(Vl=n,n=et):(Vl=n,n=et),n===et&&(n=Vl,e.substr(Vl,2)===ar?(s=ar,Vl+=2):(s=et,0===zl&&u(Ns)),s!==et?(s=Ve())!==et?(Jl=n,n="geOp"):(Vl=n,n=et):(Vl=n,n=et)))))),Wl[o]={i:Vl,result:n},o=n}o===et&&((n=Wl[o=233*Vl+84])?(Vl=n.i,o=n.result):(n=Vl,e.substr(Vl,2)===ir?(s=ir,Vl+=2):(s=et,0===zl&&u(Cs)),s!==et?(s=Ve())!==et?(Jl=n,n="isOp"):(Vl=n,n=et):(Vl=n,n=et),n===et&&(n=Vl,e.substr(Vl,2)===or?(s=or,Vl+=2):(s=et,0===zl&&u(Ts)),s!==et&&(Jl=n,s="nodeBeforeOp"),(n=s)===et&&(n=Vl,e.substr(Vl,2)===sr?(s=sr,Vl+=2):(s=et,0===zl&&u(Is)),s!==et&&(Jl=n,s="nodeAfterOp"),n=s)),Wl[o]={i:Vl,result:n},o=n),o===et&&((n=Wl[o=233*Vl+82])?(Vl=n.i,o=n.result):(n=Vl,61===e.charCodeAt(Vl)?(s=lt,Vl++):(s=et,0===zl&&u(Si)),s!==et&&(Jl=n,s="equalOp"),(n=s)===et&&(n=Vl,e.substr(Vl,2)===Qn?(s=Qn,Vl+=2):(s=et,0===zl&&u(ms)),s!==et&&(Jl=n,s="notEqualOp"),(n=s)===et&&(n=Vl,e.substr(Vl,2)===Kn?(s=Kn,Vl+=2):(s=et,0===zl&&u(vs)),s!==et&&(Jl=n,s="lessThanOrEqualOp"),(n=s)===et&&(n=Vl,60===e.charCodeAt(Vl)?(s=Zn,Vl++):(s=et,0===zl&&u(gs)),s!==et&&(Jl=n,s="lessThanOp"),(n=s)===et&&(n=Vl,e.substr(Vl,2)===zn?(s=zn,Vl+=2):(s=et,0===zl&&u(ys)),s!==et&&(Jl=n,s="greaterThanOrEqualOp"),(n=s)===et&&(n=Vl,62===e.charCodeAt(Vl)?(s=Wn,Vl++):(s=et,0===zl&&u(ws)),s!==et&&(Jl=n,s="greaterThanOp"),n=s))))),Wl[o]={i:Vl,result:n},o=n))),o!==et?(He(),(n=H())!==et?(Jl=i,i=[o,n]):(Vl=i,i=et)):(Vl=i,i=et),i===et&&(i=null),Jl=t,t=i?[i[0],["firstOperand",a],["secondOperand",i[1]]]:a}else Vl=t,t=et;return Wl[r]={i:Vl,result:t},t}function H(){var t,n=233*Vl+69;if(t=Wl[n])return Vl=t.i,t.result;t=Vl;var r=j();if(r!==et){var a=[],i=Vl;if(He(),e.substr(Vl,2)===Dn){var o=Dn;Vl+=2}else o=et,0===zl&&u(Wo);for(o!==et?(He(),(o=j())!==et?(Jl=i,i=o):(Vl=i,i=et)):(Vl=i,i=et);i!==et;)a.push(i),i=Vl,He(),e.substr(Vl,2)===Dn?(o=Dn,Vl+=2):(o=et,0===zl&&u(Wo)),o!==et?(He(),(o=j())!==et?(Jl=i,i=o):(Vl=i,i=et)):(Vl=i,i=et);Jl=t,t=Je("stringConcatenateOp",r,a)}else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function j(){var t,n=233*Vl+70;if(t=Wl[n])return Vl=t.i,t.result;t=Vl;var r=X();if(r!==et){var a=Vl;if(He(),e.substr(Vl,2)===Rn){var i=Rn;Vl+=2}else i=et,0===zl&&u($o);i!==et?(i=Ve())!==et?(He(),(i=X())!==et?(Jl=a,a=i):(Vl=a,a=et)):(Vl=a,a=et):(Vl=a,a=et),a===et&&(a=null),Jl=t,t=null===a?r:["rangeSequenceExpr",["startExpr",r],["endExpr",a]]}else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function X(){var t,n=233*Vl+71;if(t=Wl[n])return Vl=t.i,t.result;t=Vl;var r=_();if(r!==et){var a=[],i=Vl;He();var o=Vl;if(45===e.charCodeAt(Vl)){var s=Gn;Vl++}else s=et,0===zl&&u(es);for(s!==et&&(Jl=o,s="subtractOp"),(o=s)===et&&(o=Vl,43===e.charCodeAt(Vl)?(s=Mn,Vl++):(s=et,0===zl&&u(ts)),s!==et&&(Jl=o,s="addOp"),o=s),o!==et?(He(),(s=_())!==et?(Jl=i,i=[o,s]):(Vl=i,i=et)):(Vl=i,i=et);i!==et;)a.push(i),i=Vl,He(),o=Vl,45===e.charCodeAt(Vl)?(s=Gn,Vl++):(s=et,0===zl&&u(es)),s!==et&&(Jl=o,s="subtractOp"),(o=s)===et&&(o=Vl,43===e.charCodeAt(Vl)?(s=Mn,Vl++):(s=et,0===zl&&u(ts)),s!==et&&(Jl=o,s="addOp"),o=s),o!==et?(He(),(s=_())!==et?(Jl=i,i=[o,s]):(Vl=i,i=et)):(Vl=i,i=et);Jl=t,t=function(e,t){return t.reduce((function(e,t){return[t[0],["firstOperand",e],["secondOperand",t[1]]]}),e)}(r,a)}else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function _(){var t,n=233*Vl+72;if(t=Wl[n])return Vl=t.i,t.result;t=Vl;var r=L();if(r!==et){var a=[],i=Vl;He();var o=Vl;if(42===e.charCodeAt(Vl)){var s=Un;Vl++}else s=et,0===zl&&u(ns);for(s!==et&&(Jl=o,s="multiplyOp"),(o=s)===et&&(o=Vl,e.substr(Vl,3)===Fn?(s=Fn,Vl+=3):(s=et,0===zl&&u(rs)),s!==et?(s=Ve())!==et?(Jl=o,o="divOp"):(Vl=o,o=et):(Vl=o,o=et),o===et&&(o=Vl,e.substr(Vl,4)===Pn?(s=Pn,Vl+=4):(s=et,0===zl&&u(as)),s!==et?(s=Ve())!==et?(Jl=o,o="idivOp"):(Vl=o,o=et):(Vl=o,o=et),o===et&&(o=Vl,e.substr(Vl,3)===Hn?(s=Hn,Vl+=3):(s=et,0===zl&&u(is)),s!==et?(s=Ve())!==et?(Jl=o,o="modOp"):(Vl=o,o=et):(Vl=o,o=et)))),o!==et?(He(),(s=L())!==et?(Jl=i,i=[o,s]):(Vl=i,i=et)):(Vl=i,i=et);i!==et;)a.push(i),i=Vl,He(),o=Vl,42===e.charCodeAt(Vl)?(s=Un,Vl++):(s=et,0===zl&&u(ns)),s!==et&&(Jl=o,s="multiplyOp"),(o=s)===et&&(o=Vl,e.substr(Vl,3)===Fn?(s=Fn,Vl+=3):(s=et,0===zl&&u(rs)),s!==et?(s=Ve())!==et?(Jl=o,o="divOp"):(Vl=o,o=et):(Vl=o,o=et),o===et&&(o=Vl,e.substr(Vl,4)===Pn?(s=Pn,Vl+=4):(s=et,0===zl&&u(as)),s!==et?(s=Ve())!==et?(Jl=o,o="idivOp"):(Vl=o,o=et):(Vl=o,o=et),o===et&&(o=Vl,e.substr(Vl,3)===Hn?(s=Hn,Vl+=3):(s=et,0===zl&&u(is)),s!==et?(s=Ve())!==et?(Jl=o,o="modOp"):(Vl=o,o=et):(Vl=o,o=et)))),o!==et?(He(),(s=L())!==et?(Jl=i,i=[o,s]):(Vl=i,i=et)):(Vl=i,i=et);Jl=t,t=function(e,t){return t.reduce((function(e,t){return[t[0],["firstOperand",e],["secondOperand",t[1]]]}),e)}(r,a)}else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function L(){var t,n=233*Vl+73;if(t=Wl[n])return Vl=t.i,t.result;t=Vl;var r=k();if(r!==et){var a=[],i=Vl;if(He(),124===e.charCodeAt(Vl)){var o=Nn;Vl++}else o=et,0===zl&&u(Vo);if(o===et){if(o=Vl,e.substr(Vl,5)===jn){var s=jn;Vl+=5}else s=et,0===zl&&u(os);if(s!==et){var l=Ve();l!==et?o=s=[s,l]:(Vl=o,o=et)}else Vl=o,o=et}for(o!==et?(He(),(l=k())!==et?(Jl=i,i=l):(Vl=i,i=et)):(Vl=i,i=et);i!==et;)a.push(i),i=Vl,He(),124===e.charCodeAt(Vl)?(o=Nn,Vl++):(o=et,0===zl&&u(Vo)),o===et&&(o=Vl,e.substr(Vl,5)===jn?(s=jn,Vl+=5):(s=et,0===zl&&u(os)),s!==et?(l=Ve())!==et?o=s=[s,l]:(Vl=o,o=et):(Vl=o,o=et)),o!==et?(He(),(l=k())!==et?(Jl=i,i=l):(Vl=i,i=et)):(Vl=i,i=et);Jl=t,t=Je("unionOp",r,a)}else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function k(){var t,n,r=233*Vl+74;if(t=Wl[r])return Vl=t.i,t.result;t=Vl;var a=233*Vl+75;if(n=Wl[a])Vl=n.i,a=n.result;else{n=Vl;var i=Y();if(i!==et){var o=Vl;if(He(),e.substr(Vl,8)===Ln){var s=Ln;Vl+=8}else s=et,0===zl&&u(ls);s!==et?(s=je())!==et?(e.substr(Vl,2)===kn?(s=kn,Vl+=2):(s=et,0===zl&&u(cs)),s!==et?(s=Ve())!==et?(He(),(s=ve())!==et?(Jl=o,o=s):(Vl=o,o=et)):(Vl=o,o=et):(Vl=o,o=et)):(Vl=o,o=et):(Vl=o,o=et),o===et&&(o=null),Jl=n,n=o?["instanceOfExpr",["argExpr",i],["sequenceType"].concat(o)]:i}else Vl=n,n=et;n===et&&(n=Y()),Wl[a]={i:Vl,result:n},a=n}if(a!==et){for(n=[],i=Vl,He(),o=Vl,e.substr(Vl,9)===Xn?(s=Xn,Vl+=9):(s=et,0===zl&&u(ss)),s!==et&&(Jl=o,s="intersectOp"),(o=s)===et&&(o=Vl,e.substr(Vl,6)===_n?(s=_n,Vl+=6):(s=et,0===zl&&u(us)),s!==et&&(Jl=o,s="exceptOp"),o=s),o!==et?(s=Ve())!==et?(He(),(s=k())!==et?(Jl=i,i=[o,s]):(Vl=i,i=et)):(Vl=i,i=et):(Vl=i,i=et);i!==et;)n.push(i),i=Vl,He(),o=Vl,e.substr(Vl,9)===Xn?(s=Xn,Vl+=9):(s=et,0===zl&&u(ss)),s!==et&&(Jl=o,s="intersectOp"),(o=s)===et&&(o=Vl,e.substr(Vl,6)===_n?(s=_n,Vl+=6):(s=et,0===zl&&u(us)),s!==et&&(Jl=o,s="exceptOp"),o=s),o!==et?(s=Ve())!==et?(He(),(s=k())!==et?(Jl=i,i=[o,s]):(Vl=i,i=et)):(Vl=i,i=et):(Vl=i,i=et);Jl=t,t=function(e,t){return t.reduce((function(e,t){return[t[0],["firstOperand",e],["secondOperand",t[1]]]}),e)}(a,n)}else Vl=t,t=et;return Wl[r]={i:Vl,result:t},t}function Y(){var t,n,r,a=233*Vl+76;if(t=Wl[a])return Vl=t.i,t.result;t=Vl;var i=233*Vl+77;if(n=Wl[i])Vl=n.i,i=n.result;else{var o;n=Vl;var s=233*Vl+78;if(r=Wl[s])Vl=r.i,s=r.result;else{r=Vl;var l=233*Vl+79;if(o=Wl[l])Vl=o.i,l=o.result;else{o=Vl;var c=function t(){var n,r=233*Vl+80;if(n=Wl[r])return Vl=n.i,n.result;if(n=Vl,45===e.charCodeAt(Vl)){var a=Gn;Vl++}else a=et,0===zl&&u(es);if(a!==et?(He(),(a=t())!==et?(Jl=n,n=["unaryMinusOp",["operand",a]]):(Vl=n,n=et)):(Vl=n,n=et),n===et&&(n=Vl,43===e.charCodeAt(Vl)?(a=Mn,Vl++):(a=et,0===zl&&u(ts)),a!==et?(He(),(a=t())!==et?(Jl=n,n=["unaryPlusOp",["operand",a]]):(Vl=n,n=et)):(Vl=n,n=et),n===et))if(a=Wl[n=233*Vl+81])Vl=a.i,n=a.result;else{var i,o;if(i=Wl[a=233*Vl+85])Vl=i.i,a=i.result;else{if(i=Vl,e.substr(Vl,8)===ur){var s=ur;Vl+=8}else s=et,0===zl&&u(Os);if(s!==et){s=Vl,He();var l=233*Vl+86;(o=Wl[l])?(Vl=o.i,l=o.result):(e.substr(Vl,3)===cr?(o=cr,Vl+=3):(o=et,0===zl&&u(Ds)),o===et&&(e.substr(Vl,6)===pr?(o=pr,Vl+=6):(o=et,0===zl&&u(Rs))),Wl[l]={i:Vl,result:o},l=o),l!==et?(Jl=s,s=["validationMode",l]):(Vl=s,s=et),s===et&&(s=Vl,He(),e.substr(Vl,4)===lr?(l=lr,Vl+=4):(l=et,0===zl&&u(Ss)),l!==et?(He(),(l=Be())!==et?(Jl=s,s=["type"].concat(l)):(Vl=s,s=et)):(Vl=s,s=et)),s===et&&(s=null),He(),123===e.charCodeAt(Vl)?(l=on,Vl++):(l=et,0===zl&&u(To)),l!==et?(He(),(l=C())!==et?(He(),125===e.charCodeAt(Vl)?(o=sn,Vl++):(o=et,0===zl&&u(Io)),o!==et?(Jl=i,i=["validateExpr"].concat(s?[s]:[],[["argExpr",l]])):(Vl=i,i=et)):(Vl=i,i=et)):(Vl=i,i=et)}else Vl=i,i=et;Wl[a]={i:Vl,result:i},a=i}if(a===et){if(i=Wl[a=233*Vl+87])Vl=i.i,a=i.result;else{if(i=Vl,s=[],(l=q())!==et)for(;l!==et;)s.push(l),l=q();else s=et;s!==et?(He(),123===e.charCodeAt(Vl)?(l=on,Vl++):(l=et,0===zl&&u(To)),l!==et?(He(),C(),He(),125===e.charCodeAt(Vl)?(l=sn,Vl++):(l=et,0===zl&&u(Io)),l!==et?(Jl=i,i=["extensionExpr"].concat(s)):(Vl=i,i=et)):(Vl=i,i=et)):(Vl=i,i=et),Wl[a]={i:Vl,result:i},a=i}if(a===et)if(i=Wl[a=233*Vl+90])Vl=i.i,a=i.result;else{if(i=Vl,(s=V())!==et){if(l=[],o=Vl,He(),33===e.charCodeAt(Vl)){var c=dr;Vl++}else c=et,0===zl&&u(Us);for(c!==et?(He(),(c=V())!==et?(Jl=o,o=c):(Vl=o,o=et)):(Vl=o,o=et);o!==et;)l.push(o),o=Vl,He(),33===e.charCodeAt(Vl)?(c=dr,Vl++):(c=et,0===zl&&u(Us)),c!==et?(He(),(c=V())!==et?(Jl=o,o=c):(Vl=o,o=et)):(Vl=o,o=et);Jl=i,i=function(e,t){return 0===t.length?$e(e):$e(["simpleMapExpr","pathExpr"===e[0]?e:["pathExpr",["stepExpr",["filterExpr",ze(e)]]]].concat(t.map((function(e){return"pathExpr"===e[0]?e:["pathExpr",["stepExpr",["filterExpr",ze(e)]]]}))))}(s,l)}else Vl=i,i=et;Wl[a]={i:Vl,result:i},a=i}}Wl[n]={i:Vl,result:a},n=a}return Wl[r]={i:Vl,result:n},n}();if(c!==et){var p=[],h=Vl;if(He(),e.substr(Vl,2)===Jn){var f=Jn;Vl+=2}else f=et,0===zl&&u(ds);if(f!==et)if(He(),(f=te())!==et){He();var d=z();d!==et?(Jl=h,h=[f,d]):(Vl=h,h=et)}else Vl=h,h=et;else Vl=h,h=et;for(;h!==et;)p.push(h),h=Vl,He(),e.substr(Vl,2)===Jn?(f=Jn,Vl+=2):(f=et,0===zl&&u(ds)),f!==et?(He(),(f=te())!==et?(He(),(d=z())!==et?(Jl=h,h=[f,d]):(Vl=h,h=et)):(Vl=h,h=et)):(Vl=h,h=et);Jl=o,o=function(e,t){return t.reduce((function(e,t){return["arrowExpr",["argExpr",e],t[0],["arguments"].concat(t[1])]}),e)}(c,p)}else Vl=o,o=et;Wl[l]={i:Vl,result:o},l=o}l!==et?(o=Vl,He(),e.substr(Vl,4)===Vn?(c=Vn,Vl+=4):(c=et,0===zl&&u(fs)),c!==et?(c=je())!==et?(e.substr(Vl,2)===an?(c=an,Vl+=2):(c=et,0===zl&&u(Co)),c!==et?(c=Ve())!==et?(He(),(c=de())!==et?(Jl=o,o=c):(Vl=o,o=et)):(Vl=o,o=et):(Vl=o,o=et)):(Vl=o,o=et):(Vl=o,o=et),o===et&&(o=null),Jl=r,r=o?["castExpr",["argExpr",l],o]:l):(Vl=r,r=et),Wl[s]={i:Vl,result:r},s=r}s!==et?(r=Vl,He(),e.substr(Vl,8)===qn?(l=qn,Vl+=8):(l=et,0===zl&&u(hs)),l!==et?(l=je())!==et?(e.substr(Vl,2)===an?(l=an,Vl+=2):(l=et,0===zl&&u(Co)),l!==et?(l=Ve())!==et?(He(),(l=de())!==et?(Jl=r,r=l):(Vl=r,r=et)):(Vl=r,r=et):(Vl=r,r=et)):(Vl=r,r=et):(Vl=r,r=et),r===et&&(r=null),Jl=n,n=r?["castableExpr",["argExpr",s],r]:s):(Vl=n,n=et),Wl[i]={i:Vl,result:n},i=n}return i!==et?(n=Vl,He(),e.substr(Vl,5)===Yn?(s=Yn,Vl+=5):(s=et,0===zl&&u(ps)),s!==et?(s=je())!==et?(e.substr(Vl,2)===an?(s=an,Vl+=2):(s=et,0===zl&&u(Co)),s!==et?(s=Ve())!==et?(He(),(s=ve())!==et?(Jl=n,n=s):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et)):(Vl=n,n=et):(Vl=n,n=et),n===et&&(n=null),Jl=t,t=n?["treatExpr",["argExpr",i],["sequenceType"].concat(n)]:i):(Vl=t,t=et),Wl[a]={i:Vl,result:t},t}function q(){var t,n=233*Vl+88;if(t=Wl[n])return Vl=t.i,t.result;if(t=Vl,e.substr(Vl,2)===hr){var r=hr;Vl+=2}else r=et,0===zl&&u(Gs);if(r!==et)if(je(),(r=Be())!==et){var a=Vl,i=je();if(i!==et){var o;if(o=Wl[i=233*Vl+89])Vl=o.i,i=o.result;else{o=Vl;var s=[],l=Vl,c=Me();if(c!==et){var p=Vl;if(zl++,e.substr(Vl,2)===fr){var h=fr;Vl+=2}else h=et,0===zl&&u(Ms);zl--,h===et?p=void 0:(Vl=p,p=et),p!==et?(Jl=l,l=c):(Vl=l,l=et)}else Vl=l,l=et;for(;l!==et;)s.push(l),l=Vl,(c=Me())!==et?(p=Vl,zl++,e.substr(Vl,2)===fr?(h=fr,Vl+=2):(h=et,0===zl&&u(Ms)),zl--,h===et?p=void 0:(Vl=p,p=et),p!==et?(Jl=l,l=c):(Vl=l,l=et)):(Vl=l,l=et);Jl=o,o=s=s.join(""),Wl[i]={i:Vl,result:o},i=o}Jl=a,a=i}else Vl=a,a=et;a===et&&(a=null),He(),e.substr(Vl,2)===fr?(i=fr,Vl+=2):(i=et,0===zl&&u(Ms)),i!==et?(Jl=t,t=a?["pragma",["pragmaName",r],["pragmaContents",a]]:["pragma",["pragmaName",r]]):(Vl=t,t=et)}else Vl=t,t=et;else Vl=t,t=et;return Wl[n]={i:Vl,result:t},t}function V(){var t,r,a=233*Vl+91;if(t=Wl[a])return Vl=t.i,t.result;if(r=Wl[t=233*Vl+92])Vl=r.i,t=r.result;else{r=Vl;var i=Q();if(i!==et){He();var o=K();if(o!==et){He();var s=J();s!==et?(Jl=r,r=["pathExpr",i,o].concat(s)):(Vl=r,r=et)}else Vl=r,r=et}else Vl=r,r=et;if(r===et&&(r=Vl,(i=Q())!==et?(He(),47===e.charCodeAt(Vl)?(o=mr,Vl++):(o=et,0===zl&&u(Fs)),o!==et?(He(),(s=J())!==et?(Jl=r,r=["pathExpr",i].concat(s)):(Vl=r,r=et)):(Vl=r,r=et)):(Vl=r,r=et),r===et)){if(i=Wl[r=233*Vl+98])Vl=i.i,r=i.result;else{if(i=Vl,(o=ne())!==et){s=Vl,zl++;var l=Vl,c=He(),p=W();p!==et?l=c=[c,p]:(Vl=l,l=et),l===et&&(l=Vl,c=He(),(p=z())!==et?l=c=[c,p]:(Vl=l,l=et),l===et&&(l=Vl,c=He(),(p=$())!==et?l=c=[c,p]:(Vl=l,l=et))),zl--,l===et?s=void 0:(Vl=s,s=et),s!==et?(Jl=i,i=o):(Vl=i,i=et)}else Vl=i,i=et;Wl[r]={i:Vl,result:i},r=i}r===et&&(r=Vl,(i=Q())!==et&&(Jl=r,i=["pathExpr",i]),r=i)}Wl[t]={i:Vl,result:r},t=r}return t===et&&((r=Wl[t=233*Vl+95])?(Vl=r.i,t=r.result):(r=Vl,47===e.charCodeAt(Vl)?(o=mr,Vl++):(o=et,0===zl&&u(Fs)),o!==et?(He(),(i=J())!==et?(Jl=r,r=["pathExpr",["rootExpr"]].concat(i)):(Vl=r,r=et)):(Vl=r,r=et),r===et&&(r=Vl,(o=K())!==et?(He(),(i=J())!==et?(Jl=r,r=["pathExpr",["rootExpr"],o].concat(i)):(Vl=r,r=et)):(Vl=r,r=et),r===et&&(r=Vl,47===e.charCodeAt(Vl)?(o=mr,Vl++):(o=et,0===zl&&u(Fs)),o!==et?(o=Vl,zl++,i=Vl,s=He(),Jl=l=Vl,(c=(c=n.Ra)?void 0:et)!==et?(ai.test(e.charAt(Vl))?(p=e.charAt(Vl),Vl++):(p=et,0===zl&&u(Ps)),p!==et?l=c=[c,p]:(Vl=l,l=et)):(Vl=l,l=et),l!==et?i=s=[s,l]:(Vl=i,i=et),i===et&&(Jl=i=Vl,(s=(s=!n.Ra)?void 0:et)!==et?(ii.test(e.charAt(Vl))?(l=e.charAt(Vl),Vl++):(l=et,0===zl&&u(Hs)),l!==et?i=s=[s,l]:(Vl=i,i=et)):(Vl=i,i=et)),zl--,i===et?o=void 0:(Vl=o,o=et),o!==et?(Jl=r,r=["pathExpr",["rootExpr"]]):(Vl=r,r=et)):(Vl=r,r=et))),Wl[t]={i:Vl,result:r},t=r)),Wl[a]={i:Vl,result:t},t}function J(){var t,n=233*Vl+93;if(t=Wl[n])return Vl=t.i,t.result;t=Vl;var r=Q();if(r!==et){He();var a=K();if(a!==et){He();var i=J();i!==et?(Jl=t,t=[r,a].concat(i)):(Vl=t,t=et)}else Vl=t,t=et}else Vl=t,t=et;return t===et&&(t=Vl,(r=Q())!==et?(He(),47===e.charCodeAt(Vl)?(a=mr,Vl++):(a=et,0===zl&&u(Fs)),a!==et?(He(),(i=J())!==et?(Jl=t,t=[r].concat(i)):(Vl=t,t=et)):(Vl=t,t=et)):(Vl=t,t=et),t===et&&(t=Vl,(r=Q())!==et&&(Jl=t,r=[r]),t=r)),Wl[n]={i:Vl,result:t},t}function Q(){var t,n,r=233*Vl+94;if(t=Wl[r])return Vl=t.i,t.result;t=Vl;var a=233*Vl+97;if(n=Wl[a])Vl=n.i,a=n.result;else{var i=n=Vl,o=ne();if(o!==et&&(Jl=i,o=ze(o)),(i=o)!==et){o=[];var s=Vl;He();var l=W();for(l!==et?(Jl=s,s=["predicate",l]):(Vl=s,s=et),s===et&&(s=Vl,He(),(l=z())!==et?(Jl=s,s=["argumentList",l]):(Vl=s,s=et),s===et&&(s=Vl,He(),(l=$())!==et?(Jl=s,s=l):(Vl=s,s=et)));s!==et;)o.push(s),s=Vl,He(),(l=W())!==et?(Jl=s,s=["predicate",l]):(Vl=s,s=et),s===et&&(s=Vl,He(),(l=z())!==et?(Jl=s,s=["argumentList",l]):(Vl=s,s=et),s===et&&(s=Vl,He(),(l=$())!==et?(Jl=s,s=l):(Vl=s,s=et)));Jl=n,n=function(e,t){function n(){s&&1===i.length?o.push(["predicate",i[0]]):0!==i.length&&o.push(["predicates"].concat(i)),i.length=0}function r(e){n(),0!==o.length?("sequenceExpr"===a[0]&&2=e||57344<=e&&65533>=e||65536<=e&&1114111>=e||We("XQST0090","The character reference "+e+" ("+e.toString(16)+") does not reference a valid codePoint.")}function Ke(e){return n.Ra?e.replace(/(&[^;]+);/g,(function(e){if(/^&#x/.test(e))return Qe(e=parseInt(e.slice(3,-1),16)),String.fromCodePoint(e);if(/^&#/.test(e))return Qe(e=parseInt(e.slice(2,-1),10)),String.fromCodePoint(e);switch(e){case"<":return"<";case">":return">";case"&":return"&";case""":return String.fromCharCode(34);case"'":return String.fromCharCode(39)}We("XPST0003",'Unknown character reference: "'+e+'"')})):e}function Ze(e,t,n){if(!e.length)return[];for(var r=[e[0]],a=1;a",Qn="!=",Kn="<=",Zn="<",zn=">=",Wn=">",$n="eq",er="ne",tr="lt",nr="le",rr="gt",ar="ge",ir="is",or="<<",sr=">>",ur="validate",lr="type",cr="lax",pr="strict",hr="(#",fr="#)",dr="!",mr="/",vr="//",gr="child",yr="::",wr="descendant",Ar="attribute",xr="self",br="descendant-or-self",Er="following-sibling",Br="following",Nr="@",Cr="parent",Tr="ancestor",Ir="preceding-sibling",Or="preceding",Sr="ancestor-or-self",Dr="..",Rr="*:",Gr=":*",Mr="[",Ur="]",Fr="?",Pr=".",Hr="/>",jr="",Qr="",Zr="document",zr="text",Wr="comment",$r="processing-instruction",ea="#",ta="map",na=":",ra="array",aa="empty-sequence()",ia="item()",oa="node()",sa="document-node(",ua="text()",la="comment()",ca="namespace-node()",pa="processing-instruction(",ha="processing-instruction()",fa="attribute(",da="attribute()",ma="schema-attribute(",va="schema-element",ga="Q",ya="&",wa="amp",Aa="quot",xa="apos",ba='""',Ea="''",Ba="(:",Na=":)",Ca="X",Ta="x",Ia="M",Oa="m",Sa="L",Da="l",Ra="&#x",Ga="&#",Ma="first",Ua="last",Fa="into",Pa="after",Ha="before",ja="insert",Xa="nodes",_a="node",La="delete",ka="replace",Ya="value",qa="with",Va="rename",Ja="copy",Qa="modify",Ka=" ",Za="\t",za="\r",Wa="\n",$a="document-node",ei="empty-sequence",ti="namespace-node",ni="schema-attribute",ri="switch",ai=/^[*",!1),ms=a("!=",!1),vs=a("<=",!1),gs=a("<",!1),ys=a(">=",!1),ws=a(">",!1),As=a("eq",!1),xs=a("ne",!1),bs=a("lt",!1),Es=a("le",!1),Bs=a("gt",!1),Ns=a("ge",!1),Cs=a("is",!1),Ts=a("<<",!1),Is=a(">>",!1),Os=a("validate",!1),Ss=a("type",!1),Ds=a("lax",!1),Rs=a("strict",!1),Gs=a("(#",!1),Ms=a("#)",!1),Us=a("!",!1),Fs=a("/",!1),Ps=i(["*","<",["a","z"],["A","Z"]],!1,!1),Hs=i(["*",["a","z"],["A","Z"]],!1,!1),js=a("//",!1),Xs=a("child",!1),_s=a("::",!1),Ls=a("descendant",!1),ks=a("attribute",!1),Ys=a("self",!1),qs=a("descendant-or-self",!1),Vs=a("following-sibling",!1),Js=a("following",!1),Qs=a("@",!1),Ks=a("parent",!1),Zs=a("ancestor",!1),zs=a("preceding-sibling",!1),Ws=a("preceding",!1),$s=a("ancestor-or-self",!1),eu=a("..",!1),tu=a("*:",!1),nu=a(":*",!1),ru=a("[",!1),au=a("]",!1),iu=a("?",!1),ou=i([["a","z"],["A","Z"]],!1,!1),su=a(".",!1),uu=a("/>",!1),lu=a("",!1),yu=a("",!1),Au=a("document",!1),xu=a("text",!1),bu=a("comment",!1),Eu=a("processing-instruction",!1),Bu=a("#",!1),Nu=a("map",!1),Cu=a(":",!1),Tu=a("array",!1),Iu=a("empty-sequence()",!1),Ou=a("item()",!1),Su=a("node()",!1),Du=a("document-node(",!1),Ru=a("text()",!1),Gu=a("comment()",!1),Mu=a("namespace-node()",!1),Uu=a("processing-instruction(",!1),Fu=a("processing-instruction()",!1),Pu=a("attribute(",!1),Hu=a("attribute()",!1),ju=a("schema-attribute(",!1),Xu=a("schema-element",!1),_u=i([["0","9"]],!1,!1),Lu=i(["e","E"],!1,!1),ku=i(["+","-"],!1,!1),Yu=i(['"',"&"],!0,!1),qu=i(["'","&"],!0,!1),Vu=i(['"'],!0,!1),Ju=i(["'"],!0,!1),Qu=a("Q",!1),Ku=i(["{","}"],!0,!1),Zu=a("&",!1),zu=a("amp",!1),Wu=a("quot",!1),$u=a("apos",!1),el=a('""',!1),tl=a("''",!1),nl=i(["{","}","<","&"],!1,!1),rl=i(['"',"{","}","<","&"],!1,!1),al=i(["'","{","}","<","&"],!1,!1),il=a("(:",!1),ol=a(":)",!1),sl=a("X",!1),ul=a("x",!1),ll=a("M",!1),cl=a("m",!1),pl=a("L",!1),hl=a("l",!1),fl=a("&#x",!1),dl=i([["0","9"],["a","f"],["A","F"]],!1,!1),ml=a("&#",!1),vl=i(["\t","\n","\r",[" ","퟿"],"","�"],!1,!1),gl=i([["\ud800","\udbff"]],!1,!1),yl=i([["\udc00","\udfff"]],!1,!1),wl=a("first",!1),Al=a("last",!1),xl=a("into",!1),bl=a("after",!1),El=a("before",!1),Bl=a("insert",!1),Nl=a("nodes",!1),Cl=a("node",!1),Tl=a("delete",!1),Il=a("replace",!1),Ol=a("value",!1),Sl=a("with",!1),Dl=a("rename",!1),Rl=a("copy",!1),Gl=a("modify",!1),Ml=a(" ",!1),Ul=a("\t",!1),Fl=a("\r",!1),Pl=a("\n",!1),Hl=i([["A","Z"],"_",["a","z"],["À","Ö"],["Ø","ö"],["ø","˿"],["Ͱ","ͽ"],["Ϳ","῿"],"‌","‍",["⁰","↏"],["Ⰰ","⿯"],["、","퟿"],["豈","﷏"],["ﷰ","�"]],!1,!1),jl=i([["\ud800","\udb7f"]],!1,!1),Xl=i(["-",".",["0","9"],"·",["̀","ͯ"],"‿","⁀"],!1,!1),_l=a("document-node",!1),Ll=a("empty-sequence",!1),kl=a("namespace-node",!1),Yl=a("schema-attribute",!1),ql=a("switch",!1),Vl=0,Jl=0,Ql=[{line:1,da:1}],Kl=0,Zl=[],zl=0,Wl={};if("startRule"in n){if(!(n.Kb in nt))throw Error("Can't start parsing from rule \""+n.Kb+'".');rt=nt[n.Kb]}var $l=rt();if($l!==et&&Vl===e.length)return $l;throw $l!==et&&Vla;a++)if(o=Zo(r[a],t,n[i]))return 59!==o.type&&Jr(e,o),o;default:return{type:59,g:2}}}return 59!==r.type&&Jr(e,r),r}(e,Wo(Xr(e,"argExpr")[1],t),Yr(e,"typeswitchExprCaseClause").map((function(e){return Wo(kr(e,["resultExpr"])[1],t)})),Wo(kr(e,["typeswitchExprDefaultClause","resultExpr"])[1],t))}],["quantifiedExpr",function(e,t){return Yr(e,"*").map((function(e){return Wo(e,t)})),function(e){var t={type:0,g:3};return Jr(e,t),t}(e)}],["x:stackTrace",function(e,t){return Wo((e=Yr(e,"*"))[0],t)}],["queryBody",function(e,t){return Wo(e[1],t)}],["flworExpr",function(e,t){return function(e,t){for(var n=Wo,r=!1,a=1;a=t+n?Z:(e=a.next(e),r++,e)}},i)}function gs(e){return e.map((function(e){return W(e.type,19)?Qt(e,3):e}))}function ys(e){if((e=gs(e)).some((function(e){return Number.isNaN(e.value)})))return[q(NaN,3)];if(!(e=si(e)))throw Error("FORG0006: Incompatible types to be converted to a common type");return e}function ws(e,t,n,r,a,i){return _e([a,i],(function(e){var t=u(e);if(e=t.next().value,t=t.next().value,1/0===e.value)return se.empty();if(-1/0===e.value)return t&&1/0===t.value?se.empty():r;if(t){if(isNaN(t.value))return se.empty();1/0===t.value&&(t=null)}return isNaN(e.value)?se.empty():vs(r,Math.round(e.value),t?Math.round(t.value):null)}))}function As(e,t,n,r,a){if(r.F())return a;if(!(e=si(e=gs(r.S()))))throw Error("FORG0006: Incompatible types to be converted to a common type");if(!e.every((function(e){return W(e.type,2)})))throw Error("FORG0006: items passed to fn:sum are not all numeric.");return t=e.reduce((function(e,t){return e+t.value}),0),e.every((function(e){return W(e.type,5)}))?se.s(q(t,5)):e.every((function(e){return W(e.type,3)}))?se.s(q(t,3)):e.every((function(e){return W(e.type,4)}))?se.s(q(t,4)):se.s(q(t,6))}ps.prototype.Aa=function(e,t,n){return function(e,t,n){var r=wa[e+":"+t];return r&&(r=r.find((function(e){return e.l.some((function(e){return 4===e}))?e.l.length-1<=n:e.l.length===n})))?{l:r.l,arity:n,m:r.m,I:r.I,localName:t,namespaceURI:e,j:r.j}:null}(e,t,n)},ps.prototype.rb=function(e,t){return e?null:(e=this.C[t],this.o[t]||(this.o[t]={name:t}),e)},ps.prototype.Qa=function(e,t){var n=this.J(e,t);if(n)this.B.push({oc:e,arity:t,Jb:n});else if(t=this.ga(e.prefix,!0))return{namespaceURI:t,localName:e.localName};return n},ps.prototype.ga=function(e,t){return void 0===t||t?cs[e]?cs[e]:(t=this.v(e),this.h[e]||(this.h[e]={namespaceURI:t,prefix:e}),void 0!==t||e?t:null):null};var xs=[].concat(Nr,[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"boolean",l:[{type:59,g:2}],j:{type:0,g:3},m:function(e,t,n,r){return r.getEffectiveBooleanValue()?se.$():se.U()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"true",l:[],j:{type:0,g:3},m:function(){return se.$()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"not",l:[{type:59,g:2}],j:{type:0,g:3},m:function(e,t,n,r){return!1===r.getEffectiveBooleanValue()?se.$():se.U()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"false",l:[],j:{type:0,g:3},m:function(){return se.U()}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"last",l:[],j:{type:5,g:3},m:function(e){if(null===e.O)throw Error("XPDY0002: The fn:last() function depends on dynamic context, which is absent.");var t=!1;return se.create({next:function(){if(t)return Z;var n=e.wa.ya();return t=!0,z(q(n,5))}},1)}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"position",l:[],j:{type:5,g:3},m:function(e){if(null===e.O)throw Error("XPDY0002: The fn:position() function depends on dynamic context, which is absent.");return se.s(q(e.Ga+1,5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-dateTime",l:[],j:{type:10,g:3},m:function(e){return se.s(q(wt(e),10))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-date",l:[],j:{type:7,g:3},m:function(e){return se.s(q(it(wt(e),7),7))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-time",l:[],j:{type:8,g:3},m:function(e){return se.s(q(it(wt(e),8),8))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"implicit-timezone",l:[],j:{type:17,g:3},m:function(e){return se.s(q(At(e),17))}}],Tr,Ur,Pr,[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"years-from-duration",l:[{type:18,g:0}],j:{type:5,g:0},m:function(e,t,n,r){return r.F()?r:se.s(q(r.first().value.cb(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"months-from-duration",l:[{type:18,g:0}],j:{type:5,g:0},m:function(e,t,n,r){return r.F()?r:se.s(q(r.first().value.$a(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"days-from-duration",l:[{type:18,g:0}],j:{type:5,g:0},m:function(e,t,n,r){return r.F()?r:se.s(q(r.first().value.Za(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"hours-from-duration",l:[{type:18,g:0}],j:{type:5,g:0},m:function(e,t,n,r){return r.F()?r:se.s(q(r.first().value.getHours(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"minutes-from-duration",l:[{type:18,g:0}],j:{type:5,g:0},m:function(e,t,n,r){return r.F()?r:se.s(q(r.first().value.getMinutes(),5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"seconds-from-duration",l:[{type:18,g:0}],j:{type:4,g:0},m:function(e,t,n,r){return r.F()?r:se.s(q(r.first().value.getSeconds(),4))}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"id",l:[{type:1,g:2},{type:53,g:3}],j:{type:54,g:2},m:fs},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"id",l:[{type:1,g:2}],j:{type:54,g:2},m:function(e,t,n,r){return fs(e,t,0,r,se.s(e.O))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"idref",l:[{type:1,g:2},{type:53,g:3}],j:{type:53,g:2},m:ds},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"idref",l:[{type:1,g:2}],j:{type:53,g:2},m:function(e,t,n,r){return ds(e,t,0,r,se.s(e.O))}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"parse-json",l:[{type:1,g:3}],j:{type:59,g:0},m:function(e,t,n,r){try{var a=JSON.parse(r.first().value)}catch(e){throw Error("FOJS0001: parsed JSON string contains illegal JSON.")}return function e(t){switch(typeof t){case"object":return Array.isArray(t)?se.s(new He(t.map((function(t){return ue(e(t))})))):null===t?se.empty():se.s(new Ye(Object.keys(t).map((function(n){return{key:q(n,1),value:ue(e(t[n]))}}))));case"number":return se.s(q(t,3));case"string":return se.s(q(t,1));case"boolean":return t?se.$():se.U();default:throw Error("Unexpected type in JSON parse")}}(a)}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"contains",l:[{type:61,g:3},{type:46,g:3}],j:{type:0,g:3},m:function(e,t,n,r,a){return _e([r,a],(function(e){var t=(e=u(e)).next().value,n=e.next().value;return t.h.some((function(e){return Le(e.key,n)}))?se.$():se.U()}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"entry",l:[{type:46,g:3},{type:59,g:2}],j:{type:61,g:3},m:function(e,t,n,r,a){return r.map((function(e){return new Ye([{key:e,value:ue(a)}])}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"for-each",l:[{type:61,g:3},{type:59,g:2}],j:{type:59,g:2},m:function(e,t,n,r,a){return _e([r,a],(function(r){var a=(r=u(r)).next().value,i=r.next().value;return Bt(a.h.map((function(r){return i.value.call(void 0,e,t,n,se.s(r.key),r.value())})))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"get",l:[{type:61,g:3},{type:46,g:3}],j:{type:59,g:2},m:ke},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"keys",l:[{type:61,g:3}],j:{type:46,g:2},m:function(e,t,n,r){return _e([r],(function(e){return e=u(e).next().value,se.create(e.h.map((function(e){return e.key})))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"merge",l:[{type:61,g:2},{type:61,g:3}],j:{type:61,g:3},m:ms},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"merge",l:[{type:61,g:2}],j:{type:61,g:3},m:function(e,t,n,r){return ms(e,0,0,r,se.s(new Ye([{key:q("duplicates",1),value:function(){return se.s(q("use-first",1))}}])))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"put",l:[{type:61,g:3},{type:46,g:3},{type:59,g:2}],j:{type:61,g:3},m:function(e,t,n,r,a,i){return _e([r,a],(function(e){var t=(e=u(e)).next().value,n=e.next().value;return e=t.h.concat(),0<=(t=e.findIndex((function(e){return Le(e.key,n)})))?e.splice(t,1,{key:n,value:ue(i)}):e.push({key:n,value:ue(i)}),se.s(new Ye(e))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"remove",l:[{type:61,g:3},{type:46,g:2}],j:{type:61,g:3},m:function(e,t,n,r,a){return _e([r],(function(e){var t=u(e).next().value.h.concat();return a.M((function(e){return e.forEach((function(e){var n=t.findIndex((function(t){return Le(t.key,e)}));0<=n&&t.splice(n,1)})),se.s(new Ye(t))}))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/map",localName:"size",l:[{type:61,g:3}],j:{type:5,g:3},m:function(e,t,n,r){return r.map((function(e){return q(e.h.length,5)}))}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"pi",l:[],j:{type:3,g:3},m:function(){return se.s(q(Math.PI,3))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"exp",l:[{type:3,g:0}],j:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.pow(Math.E,e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"exp10",l:[{type:3,g:0}],j:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.pow(10,e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"log",l:[{type:3,g:0}],j:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.log(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"log10",l:[{type:3,g:0}],j:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.log10(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"pow",l:[{type:3,g:0},{type:2,g:3}],j:{type:3,g:0},m:function(e,t,n,r,a){return a.M((function(e){var t=u(e).next().value;return r.map((function(e){return 1!==Math.abs(e.value)||Number.isFinite(t.value)?q(Math.pow(e.value,t.value),3):q(1,3)}))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"sqrt",l:[{type:3,g:0}],j:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.sqrt(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"sin",l:[{type:3,g:0}],j:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.sin(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"cos",l:[{type:3,g:0}],j:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.cos(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"tan",l:[{type:3,g:0}],j:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.tan(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"asin",l:[{type:3,g:0}],j:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.asin(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"acos",l:[{type:3,g:0}],j:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.acos(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"atan",l:[{type:3,g:0}],j:{type:3,g:0},m:function(e,t,n,r){return r.map((function(e){return q(Math.atan(e.value),3)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"atan2",l:[{type:3,g:0},{type:3,g:3}],j:{type:3,g:0},m:function(e,t,n,r,a){return a.M((function(e){var t=u(e).next().value;return r.map((function(e){return q(Math.atan2(e.value,t.value),3)}))}))}}],Gn,hn,[{namespaceURI:"http://fontoxpath/operators",localName:"to",l:[{type:5,g:0},{type:5,g:0}],j:{type:5,g:2},m:function(e,t,n,r,a){if(e=r.first(),a=a.first(),null===e||null===a)return se.empty();var i=e.value;return a=a.value,i>a?se.empty():se.create({next:function(){return z(q(i++,5))}},a-i+1)}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"QName",l:[{type:1,g:0},{type:1,g:3}],j:{type:23,g:3},m:function(e,t,n,r,a){return _e([r,a],(function(e){var t=u(e);if(e=t.next().value,!Gt(t=t.next().value.value,23))throw Error("FOCA0002: The provided QName is invalid.");if(null===(e=e&&e.value||null)&&t.includes(":"))throw Error("FOCA0002: The URI of a QName may not be empty if a prefix is provided.");if(r.F())return se.s(q(new ve("",null,t),23));if(!t.includes(":"))return se.s(q(new ve("",e,t),23));var n=u(t.split(":"));return t=n.next().value,n=n.next().value,se.s(q(new ve(t,e,n),23))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"prefix-from-QName",l:[{type:23,g:0}],j:{type:24,g:0},m:function(e,t,n,r){return _e([r],(function(e){return null===(e=u(e).next().value)?se.empty():(e=e.value).prefix?se.s(q(e.prefix,24)):se.empty()}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"local-name-from-QName",l:[{type:23,g:0}],j:{type:24,g:0},m:function(e,t,n,r){return r.map((function(e){return q(e.value.localName,24)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"namespace-uri-from-QName",l:[{type:23,g:0}],j:{type:20,g:0},m:function(e,t,n,r){return r.map((function(e){return q(e.value.namespaceURI||"",20)}))}}],[{l:[{type:59,g:2}],m:function(e,t,n,r){return r.aa({empty:function(){return se.$()},multiple:function(){return se.U()},s:function(){return se.U()}})},localName:"empty",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:0,g:3}},{l:[{type:59,g:2}],m:function(e,t,n,r){return r.aa({empty:function(){return se.U()},multiple:function(){return se.$()},s:function(){return se.$()}})},localName:"exists",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:0,g:3}},{l:[{type:59,g:2}],m:function(e,t,n,r){return vs(r,1,1)},localName:"head",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:0}},{l:[{type:59,g:2}],m:function(e,t,n,r){return vs(r,2,null)},localName:"tail",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:2}},{l:[{type:59,g:2},{type:5,g:3},{type:59,g:2}],m:function(e,t,n,r,a,i){return r.F()?i:i.F()?r:(e=r.S(),0>(a=a.first().value-1)?a=0:a>e.length&&(a=e.length),t=e.slice(a),se.create(e.slice(0,a).concat(i.S(),t)))},localName:"insert-before",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:2}},{l:[{type:59,g:2},{type:5,g:3}],m:function(e,t,n,r,a){return e=a.first().value,!(r=r.S()).length||1>e||e>r.length||r.splice(e-1,1),se.create(r)},localName:"remove",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:2}},{l:[{type:59,g:2}],m:function(e,t,n,r){return r.M((function(e){return se.create(e.reverse())}))},localName:"reverse",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:2}},{l:[{type:59,g:2},{type:3,g:3}],m:function(e,t,n,r,a){return ws(0,0,0,r,a,se.empty())},localName:"subsequence",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:2}},{l:[{type:59,g:2},{type:3,g:3},{type:3,g:3}],m:ws,localName:"subsequence",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:2}},{l:[{type:59,g:2}],m:function(e,t,n,r){return r},localName:"unordered",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:2}},{l:[{type:46,g:2},{type:46,g:3}],m:function(e,t,n,r,a){return a.M((function(n){var a=u(n).next().value;return St(r,t).map((function(t,n){return La("eqOp",t.type,a.type)(t,a,e)?q(n+1,5):q(-1,5)})).filter((function(e){return-1!==e.value}))}))},localName:"index-of",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:5,g:2}},{l:[{type:46,g:2},{type:46,g:3},{type:1,g:3}],m:function(){throw Error("FOCH0002: No collations are supported")},localName:"index-of",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:5,g:2}},{l:[{type:59,g:2},{type:59,g:2}],m:function(e,t,n,r,a){var i=!1,o=jn(e,t,n,r,a);return se.create({next:function(){if(i)return Z;var e=o.next(0);return e.done?e:(i=!0,z(q(e.value,0)))}})},localName:"deep-equal",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:0,g:3}},{l:[{type:59,g:2},{type:59,g:2},{type:1,g:3}],m:function(){throw Error("FOCH0002: No collations are supported")},localName:"deep-equal",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:0,g:3}},{l:[{type:59,g:2}],m:function(e,t,n,r){var a=!1;return se.create({next:function(){if(a)return Z;var e=r.ya();return a=!0,z(q(e,5))}})},localName:"count",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:5,g:3}},{l:[{type:46,g:2}],m:function(e,t,n,r){if(r.F())return r;if(!(e=si(e=gs(r.S()))))throw Error("FORG0006: Incompatible types to be converted to a common type");if(!e.every((function(e){return W(e.type,2)})))throw Error("FORG0006: items passed to fn:avg are not all numeric.");return t=e.reduce((function(e,t){return e+t.value}),0)/e.length,e.every((function(e){return W(e.type,5)||W(e.type,3)}))?se.s(q(t,3)):e.every((function(e){return W(e.type,4)}))?se.s(q(t,4)):se.s(q(t,6))},localName:"avg",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:46,g:0}},{l:[{type:46,g:2}],m:function(e,t,n,r){return r.F()?r:(e=ys(r.S()),se.s(e.reduce((function(e,t){return e.valuet.value?t:e}))))},localName:"min",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:46,g:0}},{l:[{type:46,g:2},{type:1,g:3}],m:function(){throw Error("FOCH0002: No collations are supported")},localName:"min",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:46,g:0}},{l:[{type:46,g:2}],m:function(e,t,n,r){return As(e,t,0,r,se.s(q(0,5)))},localName:"sum",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:46,g:3}},{l:[{type:46,g:2},{type:46,g:0}],m:As,localName:"sum",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:46,g:0}},{l:[{type:59,g:2}],m:function(e,t,n,r){if(!r.F()&&!r.za())throw Error("FORG0003: The argument passed to fn:zero-or-one contained more than one item.");return r},localName:"zero-or-one",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:0}},{l:[{type:59,g:2}],m:function(e,t,n,r){if(r.F())throw Error("FORG0004: The argument passed to fn:one-or-more was empty.");return r},localName:"one-or-more",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:1}},{l:[{type:59,g:2}],m:function(e,t,n,r){if(!r.za())throw Error("FORG0005: The argument passed to fn:exactly-one is empty or contained more than one item.");return r},localName:"exactly-one",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:3}},{l:[{type:59,g:2},{type:60,g:3}],m:function(e,t,n,r,a){if(r.F())return r;var i=a.first(),o=i.o;if(1!==o.length)throw Error("XPTY0004: signature of function passed to fn:filter is incompatible.");return r.filter((function(r){if(r=sn(o[0],se.s(r),t,"fn:filter",!1),!(r=i.value.call(void 0,e,t,n,r)).za()||!W(r.first().type,0))throw Error("XPTY0004: signature of function passed to fn:filter is incompatible.");return r.first().value}))},localName:"filter",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:2}},{l:[{type:59,g:2},{type:60,g:3}],m:function(e,t,n,r,a){if(r.F())return r;var i=a.first(),o=i.o;if(1!==o.length)throw Error("XPTY0004: signature of function passed to fn:for-each is incompatible.");var s,u=r.value;return se.create({next:function(r){for(;;){if(!s){var a=u.next(0);if(a.done)return a;a=sn(o[0],se.s(a.value),t,"fn:for-each",!1),s=i.value.call(void 0,e,t,n,a).value}if(!(a=s.next(r)).done)return a;s=null}}})},localName:"for-each",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:2}},{l:[{type:59,g:2},{type:59,g:2},{type:60,g:3}],m:function(e,t,n,r,a,i){if(r.F())return r;var o=i.first(),s=o.o;if(2!==s.length)throw Error("XPTY0004: signature of function passed to fn:fold-left is incompatible.");return r.M((function(r){return r.reduce((function(r,a){return r=sn(s[0],r,t,"fn:fold-left",!1),a=sn(s[1],se.s(a),t,"fn:fold-left",!1),o.value.call(void 0,e,t,n,r,a)}),a)}))},localName:"fold-left",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:2}},{l:[{type:59,g:2},{type:59,g:2},{type:60,g:3}],m:function(e,t,n,r,a,i){if(r.F())return r;var o=i.first(),s=o.o;if(2!==s.length)throw Error("XPTY0004: signature of function passed to fn:fold-right is incompatible.");return r.M((function(r){return r.reduceRight((function(r,a){return r=sn(s[0],r,t,"fn:fold-right",!1),a=sn(s[1],se.s(a),t,"fn:fold-right",!1),o.value.call(void 0,e,t,n,a,r)}),a)}))},localName:"fold-right",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:59,g:2}}],bn,[{l:[{type:1,g:3},{type:61,g:3}],m:function(e,t,n,r,a){var i,o;return se.create({next:function(){if(!i){o=r.value.next(0).value.value;var e=a.first().h.reduce((function(e,t){return e[t.key.value]=ue(t.value()),e}),Object.create(null)),s=e["."]?e["."]():se.empty();delete e["."];var u=new ps((function(e){return n.ga(e)}),Object.keys(e).reduce((function(e,t){return e[t]=t,e}),{}),(function(e,t){return n.Qa(e,t)})),l=new Fo(u),c=Go(o,{ca:!1,debug:t.debug});t.Ta&&zo(c,new os(l));var p=kr(c,["mainModule","prolog"]);p&&Jo(p,l),c=To(c=kr(c,["mainModule","queryBody","*"]),{qa:!1,ca:!0});try{c.P(l)}catch(e){jr(o,e)}l=Object.keys(e).reduce((function(t,n){return t[u.rb(null,n)]=e[n],t}),Object.create(null)),s=new gt(s=s.F()?{O:null,Ga:-1,wa:s,ta:l}:{O:s.first(),Ga:0,wa:s,ta:l});try{i=c.evaluate(s,t).value}catch(e){jr(o,e)}}try{return i.next(0)}catch(e){jr(o,e)}}})},localName:"evaluate",namespaceURI:"http://fontoxml.com/fontoxpath",j:{type:59,g:2}},{l:[],m:function(){return se.s(q("3.20.4",1))},localName:"version",namespaceURI:"http://fontoxml.com/fontoxpath",j:{type:1,g:3}}],[{l:[{type:23,g:3},{type:5,g:3}],m:function(e,t,n,r,a){return _e([r,a],(function(e){var t=u(e);e=t.next().value,t=t.next().value;var r=n.Aa(e.value.namespaceURI,e.value.localName,t.value);return null===r?se.empty():(e=new ge({l:r.l,arity:t.value,localName:e.value.localName,namespaceURI:e.value.namespaceURI,j:r.j,value:r.m}),se.s(e))}))},localName:"function-lookup",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{g:0,type:60}},{l:[{type:60,g:3}],m:function(e,t,n,r){return _e([r],(function(e){return(e=u(e).next().value).Oa()?se.empty():se.s(q(new ve("",e.v,e.J),23))}))},localName:"function-name",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:23,g:0}},{l:[{type:60,g:3}],m:function(e,t,n,r){return _e([r],(function(e){return e=u(e).next().value,se.s(q(e.B,5))}))},localName:"function-arity",namespaceURI:"http://www.w3.org/2005/xpath-functions",j:{type:5,g:3}}]);function bs(e){this.h=e}(n=bs.prototype).createAttributeNS=function(e,t){return this.h.createAttributeNS(e,t)},n.createCDATASection=function(e){return this.h.createCDATASection(e)},n.createComment=function(e){return this.h.createComment(e)},n.createDocument=function(){return this.h.createDocument()},n.createElementNS=function(e,t){return this.h.createElementNS(e,t)},n.createProcessingInstruction=function(e,t){return this.h.createProcessingInstruction(e,t)},n.createTextNode=function(e){return this.h.createTextNode(e)};var Es=Object.create(null),Bs=Object.create(null);function Ns(e,t,n,r,a,i){this.J=e,this.v=t,this.h=n,this.B=r,this.o=a,this.C=i}function Cs(e,t){return e+(t?"_DEBUG":"")}function Ts(e,t,n){return t=Cs(t,n),(n=Bs[e])?n[t]||null:(e=Es[e])&&(e=e[t])&&0!==e.length?e[0].h:null}function Is(e,t,n,r,a,i,o){!function(e,t,n,r){t=Cs(t,n),(e=Bs[e])&&(n=e[t])&&n===r&&delete e[t]}(e,t,i,a);var s=Es[e];s||(s=Es[e]=Object.create(null)),(t=s[e=Cs(t,i)])||(t=s[e]=[]),t.push(new Ns(Object.values(n.h),Object.values(n.o),a,Object.keys(r).map((function(e){return{namespaceURI:r[e],prefix:e}})),o,n.B))}function Os(e,t,n,r,a,i,o){var s=t.ca?"XQuery":"XPath",u=t.ob?null:function(e,t,n,r,a,i,o,s){var u=Es[e];return u?(u=u[t=Cs(t,i)])&&(u=u.find((function(e){return e.o===o&&e.J.every((function(e){return n(e.prefix)===e.namespaceURI}))&&e.v.every((function(e){return void 0!==r[e.name]}))&&e.B.every((function(e){return a[e.prefix]===e.namespaceURI}))&&e.C.every((function(e){var t=s(e.oc,e.arity);return t&&t.namespaceURI===e.Jb.namespaceURI&&t.localName===e.Jb.localName}))})))?{ia:u.h,sb:!1}:(e=Bs[e]&&Bs[e][t])?{ia:e,sb:!0}:null:(e=Ts(e,t,i))?{ia:e,sb:!0}:null}(e,s,n,r,a,t.debug,i,o),l=new Fo(n=new ps(n,r,o));if(null!==u)r=u.ia;else{if(r=Go(e,t),o=new os(l),t.Ta&&Wo(r,o),!(o=Xr(r,"mainModule")))throw Error("Can not execute a library module.");if(r=Xr(o,"prolog"),o=kr(o,["queryBody","*"]),r){if(!t.ca)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");Jo(r,l)}r=Eo(o,t)}return(null===u||u.sb)&&(Object.keys(a).forEach((function(e){var t=a[e];qo(l,t),l.o[l.h][e]=t})),r.P(l),t.ob||Is(e,s,n,a,r,t.debug,i)),{ia:r,ma:l}}var Ss=Symbol("IS_XPATH_VALUE_SYMBOL");function Ds(e){return e&&"object"==typeof e&&"lookupNamespaceURI"in e?function(t){return e.lookupNamespaceURI(t||null)}:function(){return null}}function Rs(e){return e.replace(/(\x0D\x0A)|(\x0D(?!\x0A))/g,String.fromCharCode(10))}function Gs(e){return function(t){var n=t.localName;return t.prefix?null:{namespaceURI:e,localName:n}}}function Ms(e,t,n,r,a,i){var o,s,l,c,p,h;null==r&&(r=r||{}),a?(o=a.logger||{trace:console.log.bind(console)},s=a.documentWriter,l=a.moduleImports,c=a.namespaceResolver,p=a.functionNameResolver,h=a.nodesFactory):(o={trace:console.log.bind(console)},l={},c=null,h=null,s=null,p=void 0);var f=new Te(null===n?new xe:n);e=Rs(e),n=l||Object.create(null),l=a.defaultFunctionNamespaceURI||"http://www.w3.org/2005/xpath-functions";var d=Os(e,i,c||Ds(t),r,n,l,p||Gs(l));for(e=t?vt(0,t):se.empty(),t=!h&&i.ca?new nr(t):new bs(h),s=s?new Be(s):Ee,h=Object.keys(r).reduce((function(e,t){var n=r[t];return e["Q{}"+t+"[0]"]=n&&"object"==typeof n&&Ss in n?function(){return se.create(n.Eb)}:function(){return vt(0,r[t])},e}),Object.create(null)),c={},n=(p=u(Object.keys(d.ma.Da))).next();!n.done;c={Wa:c.Wa},n=p.next())c.Wa=n.value,h[c.Wa]||(h[c.Wa]=function(e){return function(){return(0,d.ma.Da[e.Wa])(m,v)}}(c));var m=new gt({O:e.first(),Ga:0,wa:e,ta:h}),v=new Et(i.debug,f,t,s,a.currentContext,o);return{zb:m,Ab:v,ia:d.ia}}function Us(e,t){var n={},r=0,a=!1,i=null;return{next:function(){if(a)return Z;for(var o={};r {\n\t\t\t\t\tconst result = "+e+".next();\n\t\t\t\t\treturn result.done ? false : !!result.value; \n\t\t\t\t})()",{type:0});case 5:throw Error("Trying to get value of generated code with type None");default:throw Error("Unreachable! Trying to get compiled value of unsupported GeneratedCodeType.")}}Object.assign(Ys,(qs.ANY_TYPE=0,qs.NUMBER_TYPE=1,qs.STRING_TYPE=2,qs.BOOLEAN_TYPE=3,qs.NODES_TYPE=7,qs.FIRST_NODE_TYPE=9,qs.STRINGS_TYPE=10,qs.MAP_TYPE=11,qs.ARRAY_TYPE=12,qs.ASYNC_ITERATOR_TYPE=99,qs.NUMBERS_TYPE=13,qs.XQUERY_UPDATE_3_1_LANGUAGE="XQueryUpdate3.1",qs.XQUERY_3_1_LANGUAGE="XQuery3.1",qs.XPATH_3_1_LANGUAGE="XPath3.1",qs));var Ws={DONE_TOKEN:Z,getEffectiveBooleanValue:te,isSubtypeOf:W,ready:z},$s={bc:"pathExpr",Rb:"andOp",ac:"orOp",dc:"stringConstantExpr"},eu=Object.values($s);function tu(e,t,n,r,a){return e=Xr(e,n),(e=Xr(e,eu))?(t+=n,(r=r.Fb(e,t,r)).isAstAccepted?0===a?zs(t,r.code,r.Ma):Ks(t,r.Ma,[r.code]):r):Zs("Unsupported: a base expression used with an operand.")}function nu(e,t,n){return 4===t&&(e+=".next().value"),47===n&&(e="(function () { const attr = "+e+"; return attr ? domFacade.getData(attr) : null})()"),e}function ru(e,t,n,r,a){var i=Lr(Xr(e,"firstOperand")[1],"type");if(e=Lr(Xr(e,"secondOperand")[1],"type"),!i||!e)return Zs("Left or right type of compare are not found, annotation failed.");var o=[47,1];if(!o.includes(i.type)||!o.includes(e.type))return Zs("Unsupported types in compare: ["+pe[i.type]+", "+pe[e.type]+"]");if(!n.isAstAccepted)return n;if(!r.isAstAccepted)return r;if(!i||!e)return Zs("Operands in compare weren't annotated");if(!(o=new Map([["eqOp","==="],["neOp","!=="]])).has(t))return Zs(t+" not yet implemented");t=o.get(t),o=Qs(n.code,n.Ma);var s=Qs(r.code,r.Ma);return Ks("function "+a+"(contextItem) {\n\t\t\t\t"+n.Ea.join("\n")+"\n\t\t\t \t"+r.Ea.join("\n")+"\n\t \t \treturn "+nu(o[0],o[1].type,i.type)+" "+t+" "+nu(s[0],s[1].type,e.type)+";\n\t\t}",{type:3,j:{type:0}})}var au={},iu=(au.equalOp="eqOp",au.notEqualOp="neOp",au.lessThanOrEqualOp="leOp",au.lessThanOp="ltOp",au.greaterThanOrEqualOp="geOp",au.greaterThanOp="gtOp",au);function ou(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function su(e,t,n,r){var a=tu(e,t,"firstOperand",n,0);return a.isAstAccepted?(e=tu(e,t,"secondOperand",n,0)).isAstAccepted?Ks("\n\tfunction "+t+"(contextItem) {\n\t\t"+a.Ea.join("\n")+"\n\t\t"+e.Ea.join("\n")+"\n\t\treturn "+a.code+" "+r+" "+e.code+";\n\t}\n\t",{type:3,j:{type:0}}):e:a}function uu(e){for(var t=[],n=0;n {\n\t\t\t"+e.code+"\n\t\t\treturn DONE_TOKEN;\n\t\t};\n\t\treturn {\n\t\t\tnext,\n\t\t\t[Symbol.iterator]() { return this; }\n\t\t};\n\t}\n\t",{type:3,j:{type:4}}):e;case $s.Rb:return su(e,t,n,"&&");case $s.ac:return su(e,t,n,"||");case $s.dc:return Ks("const "+t+" = "+(e=ou(e=Xr(e,"value")[1]))+";",{type:1});case"equalOp":case"notEqualOp":case"lessThanOrEqualOp":case"lessThanOp":case"greaterThanOrEqualOp":case"greaterThanOp":case"eqOp":case"neOp":case"ltOp":case"leOp":case"gtOp":case"geOp":case"isOp":case"nodeBeforeOp":case"nodeAfterOp":e:{var a=tu(e,t,"firstOperand",n);if(a.isAstAccepted)if((n=tu(e,t,"secondOperand",n)).isAstAccepted)switch(r){case"eqOp":case"neOp":case"ltOp":case"leOp":case"gtOp":case"geOp":case"isOp":t=ru(e,r,a,n,t);break e;case"equalOp":case"notEqualOp":case"lessThanOrEqualOp":case"lessThanOp":case"greaterThanOrEqualOp":case"greaterThanOp":Xr(e,"firstOperand");var i=Lr(e,"type");Xr(e,"secondOperand");var o=Lr(e,"type");t=i&&o?3===i.g&&3===o.g?ru(e,iu[r],a,n,t):Zs("generalCompare with sequences is still in development"):Zs("types of compare are not known");break e;default:t=Zs("Unsupported compare type")}else t=n;else t=a}return t;default:return Zs("Unsupported: the base expression '"+r+"'.")}}function vu(e,t,n){var r=Xr(e,"mainModule");if(!r)return Zs("Unsupported: Can not execute a library module.");if(Xr(r,"prolog"))return Zs("Unsupported: XQuery.");var a=kr(r,["queryBody","*"]);return n.Fb=mu,!1===(n=mu(a,"compiledXPathExpression",n)).isAstAccepted?n:(r=n.Ea?n.Ea.join("\n"):"",a=Lr(a,"type"),!1===(t=function(e,t,n){switch(e){case 9:if(e=(n=u(Qs("compiledXPathExpression",t))).next().value,4!==n.next().value.type)throw Error("Trying access generated code as an iterator while this is not the case.");return Ks("\n\tconst firstResult = "+e+".next();\n\tif (!firstResult.done) {\n\t\treturn firstResult.value\n\t}\n\treturn null;\n\t",{type:2});case 7:return e=(n=u(Qs("compiledXPathExpression",t))).next().value,4!==n.next().value.type?Ks("return [];",{type:2}):Ks("\n\tconst nodes = [];\n\tfor (const node of "+e+") {\n\t\tnodes.push(node);\n\t}\n\treturn nodes;\n\t",{type:2});case 3:return(n=zs("compiledXPathExpression","",t)).isAstAccepted?Ks("return "+n.code+";",{type:2}):n;case 2:return void 0===n?n=Zs("Full AST wasn't annotated so we cannot correctly emit a string return"):W(n,1)||W(n,47)?n=Ks("return "+nu(e=(t=u(Qs("compiledXPathExpression",t))).next().value,(t=t.next().value).type,n)+" || '';",{type:2}):n=Zs("Not implemented: returning anything but strings and attributes from codegen"),n;default:return Zs("Unsupported: the return type '"+e+"'.")}}(t,n.Ma,a?a.type:void 0)).isAstAccepted?t:(t=r+n.code+t.code,n="\n\treturn (contextItem, domFacade, runtimeLib) => {\n\t\tconst {\n\t\t\tDONE_TOKEN,\n\t\t\tValueType,\n\t\t\tXPDY0002,\n\t\t\tdeterminePredicateTruthValue,\n\t\t\tisSubtypeOf,\n\t\t\tready,\n\t\t\tatomize,\n\t\t} = runtimeLib;",function e(t){var n=Yr(t,"*");if("pathExpr"===t[0])return!0;for(t=u(n),n=t.next();!n.done;n=t.next())if(e(n.value))return!0;return!1}(e)&&(n+='\n\t\tif (!contextItem) {\n\t\t\tthrow XPDY0002("Context is needed to evaluate the given path expression.");\n\t\t}\n\n\t\tif (!contextItem.nodeType) {\n\t\t\tthrow new Error("Context item must be subtype of node().");\n\t\t}\n\t\t'),{code:n+(t+"}\n//# sourceURL=generated.js"),isAstAccepted:!0}))}var gu={},yu=(gu["http://www.w3.org/2005/XQueryX"]="xqx",gu["http://www.w3.org/2007/xquery-update-10"]="xquf",gu);function wu(e,t,n){var r=e.stack;r&&(r.includes(e.message)&&(r=r.substr(r.indexOf(e.message)+e.message.length).trim()),(r=r.split("\n")).splice(10),r=(r=r.map((function(e){return e.startsWith(" ")||e.startsWith("\t")?e:" "+e}))).join("\n")),e=Error.call(this,"Custom XPath function Q{"+n+"}"+t+" raised:\n"+e.message+"\n"+r),this.message=e.message,"stack"in e&&(this.stack=e.stack)}function Au(e,t,n){return 0===t.g?e.F()?null:Ps(e.first(),n).next(0).value:2===t.g||1===t.g?e.S().map((function(e){if(W(e.type,47))throw Error("Cannot pass attribute nodes to custom functions");return Ps(e,n).next(0).value})):Ps(e.first(),n).next(0).value}function xu(e){var t=Ts(e,"XPath",!1);if(t)return t;if(Wo(t=Go(e,{ca:!1}),new os(void 0)),null===(t=kr(t,["mainModule","queryBody","*"])))throw Error("Library modules do not have a specificity");t=To(t,{qa:!1,ca:!1});var n=Cs("XPath",!1);if(Bs[e])Bs[e][n]=t;else{var r={};Bs[e]=(r[n]=t,r)}return t}v(wu,Error);var bu=new xe;return void 0!==t&&(t.compareSpecificity=function(e,t){return dr(xu(e).K,xu(t).K)},t.compileXPathToJavaScript=function(e,t,n){return n=n||{},t=t||0,Wo(e=Go(e=Rs(e),{ca:"XQuery3.1"===n.language||"XQueryUpdate3.1"===n.language,debug:!1}),new os(new Fo(new ps((n={ga:n.namespaceResolver||Ds(null)}).ga,{},Gs("http://www.w3.org/2005/xpath-functions"))))),vu(e,t,n)},t.domFacade=bu,t.evaluateXPath=Ys,t.evaluateXPathToArray=function(e,t,n,r,a){return Ys(e,t,n,r,Ys.Sb,a)},t.evaluateXPathToAsyncIterator=Vs,t.evaluateXPathToBoolean=function(e,t,n,r,a){return Ys(e,t,n,r,Ys.BOOLEAN_TYPE,a)},t.evaluateXPathToFirstNode=function(e,t,n,r,a){return Ys(e,t,n,r,Ys.Vb,a)},t.evaluateXPathToMap=function(e,t,n,r,a){return Ys(e,t,n,r,Ys.Xb,a)},t.evaluateXPathToNodes=function(e,t,n,r,a){return Ys(e,t,n,r,Ys.Zb,a)},t.evaluateXPathToNumber=function(e,t,n,r,a){return Ys(e,t,n,r,Ys.NUMBER_TYPE,a)},t.evaluateXPathToNumbers=function(e,t,n,r,a){return Ys(e,t,n,r,Ys.$b,a)},t.evaluateXPathToString=function(e,t,n,r,a){return Ys(e,t,n,r,Ys.STRING_TYPE,a)},t.evaluateXPathToStrings=function(e,t,n,r,a){return Ys(e,t,n,r,Ys.cc,a)},t.evaluateUpdatingExpression=function(e,t,n,r,a){var i,o,s,u,l,c,p,h,f,d;return function(e){function t(t){return e.next(t)}function n(t){return e.throw(t)}return new Promise((function(r,a){!function e(i){i.done?r(i.value):Promise.resolve(i.value).then(t,n).then(e,a)}(e.next())}))}(new E(new A((function(m){switch(m.h){case 1:a=a||{};try{u=Ms(e,t,n||null,r||{},a||{},{qa:!0,ca:!0,debug:!!a.debug,ob:!!a.disableCache,Ta:!!a.annotateAst}),i=u.zb,o=u.Ab,s=u.ia}catch(t){jr(e,t)}if(s.I){m.h=2;break}l=[];var v=(c=Vs(e,t,n,r,Object.assign(Object.assign({},a),{language:"XQueryUpdate3.1"}))).next();return m.h=3,{value:v};case 3:p=m.v;case 4:if(p.done){m.h=6;break}return l.push(p.value),v=c.next(),m.h=7,{value:v};case 7:p=m.v,m.h=4;break;case 6:return h={},m.return(Promise.resolve((h.pendingUpdateList=[],h.xdmValue=l,h)));case 2:try{d=s.o(i,o),f=d.next(0)}catch(t){jr(e,t)}return m.return(Js(f.value,e,a.returnType,o))}}))))},t.evaluateUpdatingExpressionSync=function(e,t,n,r,a){a=a||{};try{var i=Ms(e,t,n||null,r||{},a||{},{qa:!0,ca:!0,debug:!!a.debug,ob:!!a.disableCache,Ta:!!a.annotateAst}),o=i.zb,s=i.Ab,u=i.ia}catch(t){jr(e,t)}if(!u.I)return o={},(s={}).pendingUpdateList=[],s.xdmValue=Ys(e,t,n,r,a.j,Object.assign(Object.assign({},a),(o.language=Ys.hc,o))),s;try{var l=u.o(o,s).next(0)}catch(t){jr(e,t)}return Js(l.value,e,a.returnType,s)},t.executeJavaScriptCompiledXPath=function(e,t,n){return n=n||new xe,e()(t,n,Ws)},t.executePendingUpdateList=function(e,t,n,r){t=new Te(t||new xe),r=r?new Be(r):Ee,n=n?n=new bs(n):null,ir(e=e.map(so),t,n,r)},t.getBucketForSelector=function(e){return xu(e).Y()},t.getBucketsForNode=Ae,t.precompileXPath=function(e){return Promise.resolve(e)},t.registerXQueryModule=function(e,t){if(zo(t=Go(e,{ca:!0,debug:(t=void 0===t?{debug:!1}:t).debug}),new os(void 0)),!(t=Xr(t,"libraryModule")))throw Error("XQuery module must be declared in a library module.");var n=Xr(t,"moduleDecl"),r=Xr(n,"uri"),a=_r(r);if(r=_r(n=Xr(n,"prefix")),(n=new Fo(new ps((function(){return null}),Object.create(null),Gs("http://www.w3.org/2005/xpath-functions")))).o[n.h][r]=a,null!==(t=Xr(t,"prolog"))){try{var i=Jo(t,n)}catch(t){jr(e,t)}i.La.forEach((function(e){if(a!==e.namespaceURI)throw Error("XQST0048: Functions and variables declared in a module must reside in the module target namespace.")})),Yo(a,i)}else Yo(a,{La:[],Va:[]});return a},t.registerCustomXPathFunction=function(e,t,n,r){var a=(e=function(e){if("object"==typeof e)return e;if(2!==(e=e.split(":")).length)throw Error("Do not register custom functions in the default function namespace");var t=u(e);e=t.next().value,t=t.next().value;var n=cs[e];if(!n){if(n="generated_namespace_uri_"+e,cs[e])throw Error("Prefix already registered: Do not register the same prefix twice.");cs[e]=n}return{localName:t,namespaceURI:n}}(e)).namespaceURI,i=e.localName;if(!a)throw pi();var o=t.map((function(e){return me(e)})),s=me(n);ba(a,i,o,s,(function(e,t,n){var u=Array.from(arguments);u.splice(0,3),u=u.map((function(e,n){return Au(e,o[n],t)}));var l={};l.currentContext=t.J,l.domFacade=t.h.h,l=l;try{var p=r.apply(void 0,[l].concat(c(u)))}catch(e){throw new wu(e,i,a)}return p&&"object"==typeof p&&Object.getOwnPropertySymbols(p).includes(Ss)?se.create(p.Eb):vt(t.h,p,s)}))},t.parseScript=function(e,t,n,r){return r=void 0===r?Ee:r,e=Go(e,{ca:"XQueryUpdate3.1"===t.language,debug:t.debug}),t.Ta&&Wo(e,new os(void 0)),function e(t,n,r,a){if("string"==typeof r)return 0===r.length?null:n.createTextNode(r);if(!Array.isArray(r))throw new TypeError("JsonML element should be an array or string");var i=r[0];switch(i){case"copySource":case"insertAfter":case"insertAsFirst":case"insertAsLast":case"insertBefore":case"insertInto":case"modifyExpr":case"newNameExpr":case"replacementExpr":case"replaceValue":case"returnExpr":case"sourceExpr":case"targetExpr":case"transformCopies":case"transformCopy":a=a||"http://www.w3.org/2005/XQueryX";break;case"deleteExpr":case"insertExpr":case"renameExpr":case"replaceExpr":case"transformExpr":a="http://www.w3.org/2007/xquery-update-10";break;default:a="http://www.w3.org/2005/XQueryX"}i=n.createElementNS(a,yu[a]+":"+i);var o=r[1],s=1;if("object"==typeof o&&!Array.isArray(o)){for(var u in o)null!==o[u]&&("type"===u?t.setAttributeNS(i,a,"fontoxpath:"+u,fe(o[u])):t.setAttributeNS(i,a,yu[a]+":"+u,o[u]));s=2}for(u=s,o=r.length;u{A(e,r,"xpath"===t.language),e.accept()});return function(e){const n="xpath"===t.language?[-1,...be(e),-2]:be(e);return a.execute(n).success}}})),Be=(Ee.compareSpecificity,Ee.compileXPathToJavaScript,Ee.createTypedValueFactory,Ee.domFacade,Ee.evaluateUpdatingExpression,Ee.evaluateUpdatingExpressionSync,Ee.evaluateXPath),Ne=(Ee.evaluateXPathToArray,Ee.evaluateXPathToAsyncIterator,Ee.evaluateXPathToBoolean),Ce=Ee.evaluateXPathToFirstNode,Te=(Ee.evaluateXPathToMap,Ee.evaluateXPathToNodes),Ie=Ee.evaluateXPathToNumber,Oe=(Ee.evaluateXPathToNumbers,Ee.evaluateXPathToString),Se=(Ee.evaluateXPathToStrings,Ee.executeJavaScriptCompiledXPath,Ee.executePendingUpdateList,Ee.getBucketForSelector,Ee.getBucketsForNode),De=(Ee.Language,Ee.parseScript,Ee.precompileXPath,Ee.profiler,Ee.registerCustomXPathFunction),Re=Ee.registerXQueryModule;Ee.ReturnType;class Ge{constructor(e){this._onNodeTouched=e}getAllAttributes(e){return Array.from(e.attributes)}getAttribute(e,t){return e.getAttribute(t)}getChildNodes(e,t){return Array.from(e.childNodes).filter(e=>!t||Se(e).includes(t))}getData(e){return e.nodeType===Node.ATTRIBUTE_NODE?(this._onNodeTouched(e),e.value):(this._onNodeTouched(e.parentNode),e.data)}getFirstChild(e,t){const n=Array.from(this.getChildNodes()).filter(e=>!t||Se(e).includes(t))[0];return n||null}getLastChild(e,t){const n=e.getChildNodes().filter(e=>!t||Se(e).includes(t)),r=n[n.length-1];return r||null}getNextSibling(e,t){for(let{nextSibling:n}=e;n;n=n.nextSibling)if(Se(n).includes(t))return n;return null}getParentNode(e){return e.parentNode}getPreviousSibling(e,t){for(let{previousSibling:n}=e;n;n=n.previousSibling)if(Se(n).includes(t))return n;return null}}class Me{static isAbsolutePath(e){return null!=e&&(e.startsWith("/")||e.startsWith("instance("))}static isSelfReference(e){return"."===e||"./text()"===e||"text()"===e||""===e||null===e}static getInstanceId(e){if(!e)return"default";if(e.startsWith("instance(")){const t=e.substring(e.indexOf("(")+1);return t.substring(1,t.indexOf(")")-1)}return"default"}static getPath(e){const t=Be("path()",e),n=e.ownerDocument.firstElementChild.getAttribute("id");return null!==n&&"default"!==n?`#${n}${Me.shortenPath(t)}`:Me.shortenPath(t)}static shortenPath(e){const t=e.split("/");let n="";for(let e=2;e0;){const i=u[u.length-1],{processed:l}=i,{node:c}=i;if(l)u.pop(),s.pop(),o[c]=!1,a[c]=!0,t&&0!==e[c].length||n.push(c);else{if(a[c]){u.pop();continue}if(o[c]){if(r){u.pop();continue}s.push(c),window.dispatchEvent(new CustomEvent("compute-exception",{composed:!0,bubbles:!0,detail:{path:s,message:"cyclic graph"}}))}o[c]=!0,s.push(c);const t=e[c];for(let e=t.length-1;e>=0;e-=1)u.push({node:t[e],processed:!1});i.processed=!0}}}}function Fe(e){this.nodes={},this.outgoingEdges={},this.incomingEdges={},this.circular=e&&!!e.circular}Fe.prototype={size(){return Object.keys(this.nodes).length},addNode(e,t){this.hasNode(e)||(this.nodes[e]=2===arguments.length?t:e,this.outgoingEdges[e]=[],this.incomingEdges[e]=[])},removeNode(e){this.hasNode(e)&&(delete this.nodes[e],delete this.outgoingEdges[e],delete this.incomingEdges[e],[this.incomingEdges,this.outgoingEdges].forEach(t=>{Object.keys(t).forEach(n=>{const r=t[n].indexOf(e);r>=0&&t[n].splice(r,1)},this)}))},hasNode(e){return Object.prototype.hasOwnProperty.call(this.nodes,e)},getNodeData(e){if(this.hasNode(e))return this.nodes[e];throw new Error("Node does not exist: "+e)},setNodeData(e,t){if(!this.hasNode(e))throw new Error("Node does not exist: "+e);this.nodes[e]=t},addDependency(e,t){if(!this.hasNode(e))throw new Error("Node does not exist: "+e);if(!this.hasNode(t))throw new Error("Node does not exist: "+t);return-1===this.outgoingEdges[e].indexOf(t)&&this.outgoingEdges[e].push(t),-1===this.incomingEdges[t].indexOf(e)&&this.incomingEdges[t].push(e),!0},removeDependency(e,t){let n;this.hasNode(e)&&(n=this.outgoingEdges[e].indexOf(t),n>=0&&this.outgoingEdges[e].splice(n,1)),this.hasNode(t)&&(n=this.incomingEdges[t].indexOf(e),n>=0&&this.incomingEdges[t].splice(n,1))},clone(){const e=this,t=new Fe;return Object.keys(e.nodes).forEach(n=>{t.nodes[n]=e.nodes[n],t.outgoingEdges[n]=e.outgoingEdges[n].slice(0),t.incomingEdges[n]=e.incomingEdges[n].slice(0)}),t},directDependenciesOf(e){if(this.hasNode(e))return this.outgoingEdges[e].slice(0);throw new Error("Node does not exist: "+e)},directDependantsOf(e){if(this.hasNode(e))return this.incomingEdges[e].slice(0);throw new Error("Node does not exist: "+e)},dependenciesOf(e,t){if(this.hasNode(e)){const n=[];Ue(this.outgoingEdges,t,n,this.circular)(e);const r=n.indexOf(e);return r>=0&&n.splice(r,1),n}throw new Error("Node does not exist: "+e)},dependantsOf(e,t){if(this.hasNode(e)){const n=[];Ue(this.incomingEdges,t,n,this.circular)(e);const r=n.indexOf(e);return r>=0&&n.splice(r,1),n}throw new Error("Node does not exist: "+e)},overallOrder(e){const t=this,n=[],r=Object.keys(this.nodes);if(0===r.length)return n;if(!this.circular){const e=Ue(this.outgoingEdges,!1,[],this.circular);r.forEach(t=>{e(t)})}const a=Ue(this.outgoingEdges,e,n,this.circular);return r.filter(e=>0===t.incomingEdges[e].length).forEach(e=>{a(e)}),this.circular&&r.filter(e=>-1===n.indexOf(e)).forEach(e=>a(e)),n}},Fe.prototype.directDependentsOf=Fe.prototype.directDependantsOf,Fe.prototype.dependentsOf=Fe.prototype.dependantsOf;class Pe{static get ACTION_ELEMENTS(){return["FX-DELETE","FX-DISPATCH","FX-INSERT","FX-LOAD","FX-MESSAGE","FX-REBUILD","FX-RECALCULATE","FX-REFRESH","FX-RENEW","FX-REPLACE","FX-RESET","FX-RETAIN","FX-RETURN","FX-REVALIDATE","FX-SEND","FX-SETFOCUS","FX-SETINDEX","FX-SETVALUE","FX-TOGGLE","FX-UPDATE"]}static get XFORMS_NAMESPACE_URI(){return"http://www.w3.org/2002/xforms"}static isActionElement(e){return Pe.ACTION_ELEMENTS.includes(e)}static get UI_ELEMENTS(){return["FX-ALERT","FX-CONTROL","FX-BUTTON","FX-CONTROL","FX-DIALOG","FX-FILENAME","FX-MEDIATYPE","FX-GROUP","FX-HINT","FX-INPUT","FX-ITEMSET","FX-LABEL","FX-OUTPUT","FX-RANGE","FX-REPEAT","FX-REPEATITEM","FX-SWITCH","FX-SECRET","FX-SELECT","FX-SUBMIT","FX-TEXTAREA","FX-TRIGGER","FX-UPLOAD"]}static isUiElement(e){Pe.UI_ELEMENTS.includes(e);return Pe.UI_ELEMENTS.includes(e)}static async refreshChildren(e){return new Promise(t=>{const{children:n}=e;n&&Array.from(n).forEach(e=>{Pe.isUiElement(e.nodeName)&&"function"==typeof e.refresh?e.refresh():"FX-MODEL"!==e.nodeName.toUpperCase()&&Pe.refreshChildren(e)}),t("done")})}static isRepeated(e){return null!==e.closest("fx-repeatitem")}static getRepeatTarget(e,t){return e.closest("fx-repeatitem").querySelector("#"+t)}static getContentType(e,t){return"urlencoded-post"===t?"application/x-www-form-urlencoded; charset=UTF-8":"xml"===e.type?"application/xml; charset=UTF-8":"json"===e.type?"application/json":(console.warn("content-type unknown ",e.type),null)}static fadeInElement(e){let t=()=>(e.getAnimations&&e.getAnimations().map(e=>e.finish()),t=e.animate({opacity:[0,1]},600),t.finished);return t()}static fadeOutElement(e){let t=()=>(e.getAnimations&&e.getAnimations().map(e=>e.finish()),t=e.animate({opacity:[1,0]},2600),t.finished);return t()}}Pe.READONLY_DEFAULT=!1,Pe.REQUIRED_DEFAULT=!1,Pe.RELEVANT_DEFAULT=!0,Pe.CONSTRAINT_DEFAULT=!0,Pe.TYPE_DEFAULT="xs:string";const He="http://www.w3.org/2002/xforms";function je(e,t){if("xhtml"===t)return"http://www.w3.org/1999/xhtml";if(""===t)return Oe("ancestor-or-self::*/@xpath-default-namespace[last()]",e)||null;const n=Oe('ancestor-or-self::*/@*[name() = "xmlns:" || $prefix][last()]',e,null,{prefix:t});return console.log("result",n),n}function Xe({prefix:e,localName:t},n){switch(t){case"base64encode":case"boolean-from-string":case"current":case"depends":case"event":case"index":case"instance":case"log":case"logtree":return{namespaceURI:He,localName:t};default:return""===e||"fn"===e?{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:t}:"local"===e?{namespaceURI:"http://www.w3.org/2005/xquery-local-functions",localName:t}:null}}function _e(e,t,n,r={}){return Be(e,t,null,r,"xs:anyType",{currentContext:{formElement:n,variables:r},moduleImports:{xf:He},functionNameResolver:Xe,namespaceResolver:e=>je(n,e)})}function Le(e,t,n){return Ce(e,t,null,{},{namespaceResolver:e=>je(n,e),defaultFunctionNamespaceURI:He,moduleImports:{xf:He},currentContext:{formElement:n}})}function ke(e,t,n){return Te(e,t,null,{},{currentContext:{formElement:n},functionNameResolver:Xe,moduleImports:{xf:He},namespaceResolver:e=>je(n,e)})}function Ye(e,t,n){return Ne(e,t,null,{},{currentContext:{formElement:n},functionNameResolver:Xe,moduleImports:{xf:He},namespaceResolver:e=>je(n,e)})}function qe(e,t,n,r=null,a=n){return Oe(e,t,r,{},{currentContext:{formElement:n},functionNameResolver:Xe,moduleImports:{xf:He},namespaceResolver:e=>je(a,e)})}function Ve(e,t,n,r=null,a=n){return Ie(e,t,r,{},{currentContext:{formElement:n},functionNameResolver:Xe,moduleImports:{xf:He},namespaceResolver:e=>je(a,e)})}const Je=e=>{if(!e)return"http://www.w3.org/1999/xhtml"};function Qe(e,t,n=null){const r=Te("outermost(ancestor-or-self::fx-fore[1]/(descendant::xf-fore|descendant::*[@id = $id]))[not(self::fx-fore)]",t,null,{id:e},{namespaceResolver:Je});if(0===r.length)return null;if(1===r.length&&Ne("(ancestor::fx-fore | ancestor::fx-repeat)[last()]/self::fx-fore",r[0],null,null,{namespaceResolver:Je})){const e=r[0];return n&&e.localName!==n?null:e}for(const e of Te("ancestor::fx-repeatitem => reverse()",t,null,null,{namespaceResolver:Je})){const t=r.filter(t=>e.contains(t));switch(t.length){case 0:break;case 1:{const e=t[0];return n&&e.localName!==n?null:e}default:{const e=t.find(e=>Te("every $ancestor of ancestor::fx-repeatitem satisfies $ancestor is $ancestor/../child::fx-repeatitem[../@repeat-index]",e,null,{}));return e?n&&e.localName!==n?null:e:null}}}return null}De({namespaceURI:He,localName:"log"},["xs:string?"],"xs:string?",(e,t)=>{const{formElement:n}=e.currentContext,r=Qe(t,n,"fx-instance");if(r){return(new XMLSerializer).serializeToString(r.getDefaultContext())}return null}),De({namespaceURI:He,localName:"logtree"},["xs:string?"],"element()?",(e,t)=>{const{formElement:n}=e.currentContext,r=Qe(t,n,"fx-instance");if(r){const t=document.createElement("div");t.setAttribute("class","logtree");const n=e.currentContext.formElement,a=n.querySelector(".logtree");a&&a.parentNode.removeChild(a);const i=function e(t,n){if(n&&n.nodeType===Node.ELEMENT_NODE&&n.children){const r=document.createElement("details");r.setAttribute("data-path",n.nodeName);const a=document.createElement("summary");let i,o=" <"+n.nodeName;Array.from(n.attributes).forEach(e=>{o+=` ${e.nodeName}="${e.nodeValue}"`}),n.firstChild&&n.firstChild.nodeType===Node.TEXT_NODE&&""!==n.firstChild.data.trim()?(i=n.firstChild.nodeValue,o+=`>${i}`):o+=">",a.textContent=o,r.appendChild(a),0!==n.childElementCount?r.setAttribute("open","open"):a.setAttribute("style","list-style:none;"),t.appendChild(r),Array.from(n.children).forEach(t=>{e(r,t)})}}(t,r.getDefaultContext());i&&n.appendChild(i)}return null});const Ke=(e,t)=>{const n=Ce("ancestor-or-self::fx-fore",e.currentContext.formElement,null,null,{namespaceResolver:Je}),r=t?Qe(t,n,"fx-instance"):n.querySelector("fx-instance");if(r){return r.getDefaultContext()}return null};De({namespaceURI:He,localName:"index"},["xs:string?"],"xs:integer?",(e,t)=>{const{formElement:n}=e.currentContext;if(null===t)return 1;const r=Qe(t,n,"fx-repeat");return r?r.getAttribute("index"):1}),De({namespaceURI:He,localName:"instance"},[],"item()?",e=>Ke(e,null)),De({namespaceURI:He,localName:"instance"},["xs:string?"],"item()?",Ke),De({namespaceURI:He,localName:"depends"},["node()*"],"item()?",(e,t)=>t[0]),De({namespaceURI:He,localName:"event"},["xs:string?"],"item()?",(e,t)=>(e.currentContext.variables[t].nodeType&&console.log("got some node as js object"),e.currentContext.variables[t])),Re(`\n module namespace xf="${He}";\n\n declare %public function xf:boolean-from-string($str as xs:string) as xs:boolean {\n lower-case($str) = "true" or $str = "1"\n };\n`),De({namespaceURI:He,localName:"base64encode"},["xs:string?"],"xs:string?",(e,t)=>btoa(t));class Ze extends HTMLElement{constructor(){super(),this.model=this.parentNode,this.attachShadow({mode:"open"})}connectedCallback(){this.hasAttribute("src")&&(this.src=this.getAttribute("src")),this.hasAttribute("id")?this.id=this.getAttribute("id"):this.id="default",this.hasAttribute("type")?this.type=this.getAttribute("type"):this.type="xml";this.shadowRoot.innerHTML="\n \n \n \n "}async init(){await this._initInstance().then(()=>(this.dispatchEvent(new CustomEvent("instance-loaded",{composed:!0,bubbles:!0,detail:{instance:this}})),this))}evalXPath(e){const t=this.parentElement.parentElement;return Le(e,this.getDefaultContext(),t)}getInstanceData(){return this.instanceData||this._createInstanceData(),this.instanceData}setInstanceData(e){e?this.instanceData=e:this._createInstanceData()}getDefaultContext(){return"xml"===this.type?this.instanceData.firstElementChild:this.instanceData}async _initInstance(){if("#querystring"===this.src){const e=new URLSearchParams(location.search),t=(new DOMParser).parseFromString("","application/xml"),n=t.firstElementChild;for(const r of e){const e=t.createElement(r[0]);e.appendChild(t.createTextNode(r[1])),n.appendChild(e)}this.instanceData=t}else this.src?await this._loadData():0!==this.childNodes.length&&this._useInlineData()}_createInstanceData(){if("xml"===this.type){const e=(new DOMParser).parseFromString("","application/xml");this.instanceData=e}"json"===this.type&&(this.instanceData={})}async _loadData(){const e=""+this.src,t=Pe.getContentType(this,"get");await fetch(e,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":t}}).then(e=>{const t=e.headers.get("content-type").toLowerCase();return console.log("********** responseContentType *********",t),t.startsWith("text/plain")?e.text():t.startsWith("application/json")?e.json():t.startsWith("application/xml")?e.text().then(e=>(console.log("xml ********",e),(new DOMParser).parseFromString(e,"application/xml"))):"done"}).then(e=>{this.instanceData=e,console.log("instanceData loaded: ",this.instanceData)}).catch(e=>{throw new Error("failed loading data "+e)})}_getContentType(){return"xml"===this.type?"application/xml":"json"===this.type?"application/json":(console.warn("content-type unknown ",this.type),null)}_useInlineData(){if("xml"===this.type){const e=(new DOMParser).parseFromString(this.innerHTML,"application/xml");console.log("fx-instance init id:",this.id),this.instanceData=e,console.log("fx-instance data: ",this.instanceData)}else"json"===this.type?this.instanceData=JSON.parse(this.textContent):console.warn("unknow type for data ",this.type)}_handleResponse(){console.log("_handleResponse ");const e=this.shadowRoot.getElementById("loader"),t=(new DOMParser).parseFromString(e.lastResponse,"application/xml");this.instanceData=t,console.log("data: ",this.instanceData)}_handleError(){const e=this.shadowRoot.getElementById("loader");console.log("_handleResponse ",e.lastError)}}customElements.define("fx-instance",Ze);class ze{constructor(e,t,n,r,a,i,o,s,u){this.path=e,this.ref=t,this.constraint=i,this.readonly=n,this.relevant=r,this.required=a,this.type=o,this.node=s,this.bind=u,this.changed=!1,this.alerts=[]}get value(){return this.node.nodeType?this.node.nodeType===Node.ATTRIBUTE_NODE?this.node.nodeValue:this.node.textContent:this.node}set value(e){console.log("modelitem.setvalue oldVal",this.value),console.log("modelitem.setvalue newVal",e),e.nodeType===Node.DOCUMENT_NODE?this.node.appendChild(e.firstElementChild):e.nodeType===Node.ELEMENT_NODE?this.node.appendChild(e):this.node.nodeType===Node.ATTRIBUTE_NODE?this.node.nodeValue=e:this.node.textContent=e}addAlert(e){this.alerts.push(e)}cleanAlerts(){this.alerts=[]}}class We extends HTMLElement{constructor(){super(),this.instances=[],this.modelItems=[],this.defaultContext={},this.inited=!1,this.modelConstructed=!1,this.attachShadow({mode:"open"})}get formElement(){return this.parentElement}connectedCallback(){this.shadowRoot.innerHTML="\n \n ",this.addEventListener("model-construct-done",e=>{this.modelConstructed=!0,console.log("model-construct-done fired ",e.detail.model.instances)})}static lazyCreateModelItem(e,t,n){let r,a={};if(null==n)return null;a=n.nodeType===n.TEXT_NODE?n.parentNode:n,n.nodeType?r=Me.getPath(n):(r=null,a=n);const i=new ze(r,t,Pe.READONLY_DEFAULT,Pe.RELEVANT_DEFAULT,Pe.REQUIRED_DEFAULT,Pe.CONSTRAINT_DEFAULT,Pe.TYPE_DEFAULT,a,this);return e.registerModelItem(i),i}modelConstruct(){console.log("### <<<<< dispatching model-construct >>>>>"),this.dispatchEvent(new CustomEvent("model-construct",{detail:this}));const e=this.querySelectorAll("fx-instance");if(e.length>0){console.group("init instances");const t=[];e.forEach(e=>{t.push(e.init())}),Promise.all(t).then(()=>{this.instances=Array.from(e),console.log("_modelConstruct this.instances ",this.instances),this.updateModel(),this.inited=!0,console.log("### <<<<< dispatching model-construct-done >>>>>"),this.dispatchEvent(new CustomEvent("model-construct-done",{composed:!0,bubbles:!0,detail:{model:this}}))}),console.groupEnd()}else this.dispatchEvent(new CustomEvent("model-construct-done",{composed:!0,bubbles:!0,detail:{model:this}}));this.inited=!0}registerModelItem(e){this.modelItems.push(e)}updateModel(){this.rebuild(),this.recalculate(),this.revalidate()}rebuild(){console.group("### rebuild"),this.mainGraph=new Fe(!1),this.modelItems=[];this.querySelectorAll("fx-model > fx-bind").forEach(e=>{e.init(this)}),console.log("rebuild mainGraph",this.mainGraph),console.log("rebuild mainGraph calc order",this.mainGraph.overallOrder()),console.groupEnd()}recalculate(){console.group("### recalculate"),console.log("recalculate instances ",this.instances);this.mainGraph.overallOrder().forEach(e=>{const t=this.mainGraph.getNodeData(e),n=this.getModelItem(t);if(n&&e.includes(":")){const t=e.split(":")[1];if(t)if("calculate"===t){const e=_e(n.bind[t],n.node,this);n.value=e}else if("constraint"!==t&&"type"!==t){const r=n.bind[t];if(r){const a=Ye(r,n.node,this);n[t]=a,console.log(`recalculating path ${e} - Expr:'${r}' computed`,n[t])}}}}),console.log(`recalculate finished with modelItems ${this.modelItems.length} item(s)`,this.modelItems),console.groupEnd()}revalidate(){console.group("### revalidate");let e=!0;return this.modelItems.forEach(t=>{const{bind:n}=t;if(n&&"function"==typeof n.hasAttribute&&n.hasAttribute("constraint")){const r=n.getAttribute("constraint");if(r){const a=Ye(r,t.node,this);if(console.log("modelItem validity computed: ",a),t.constraint=a,a||(e=!1),!this.modelConstructed){const e=n.getAlert();e&&t.addAlert(e)}}}}),console.log("modelItems after revalidate: ",this.modelItems),console.groupEnd(),e}getModelItem(e){return this.modelItems.find(t=>t.node===e)}getDefaultContext(){return this.instances[0].getDefaultContext()}getDefaultInstance(){return this.instances[0]}getDefaultInstanceData(){return console.log("default instance data ",this.instances[0].instanceData),this.instances[0].instanceData}getInstance(e){return Array.from(this.instances).find(t=>t.id===e)}evalBinding(e){return this.instances[0].evalXPath(e)}}function $e(e){return e.closest("fx-fore")}function et(e,t){const n=e.closest("[ref]");if(null!==n)return n.nodeset;const r=function(e){return $e(e).getModel()}(e);if(Me.isAbsolutePath(t)){const e=Me.getInstanceId(t);return r.getInstance(e).getDefaultContext()}return null!==r.getDefaultInstance()?r.getDefaultInstance().getDefaultContext():[]}function tt(e,t){const n=function(e){return e.nodeType===Node.ATTRIBUTE_NODE?e.ownerElement:e.parentNode}(e),r=n.closest("fx-repeatitem");if(r)return r.nodeset;if(e.nodeType===Node.ELEMENT_NODE&&e.hasAttribute("context")){const r=et(e.parentNode,t);return Le(e.getAttribute("context"),r,$e(n))}return et(n,t)}customElements.define("fx-model",We);const nt=e=>class extends e{static get properties(){return{context:{type:Object},model:{type:Object},ref:{type:String},modelItem:{type:Object},nodeset:{type:Object}}}constructor(){super(),this.context=null,this.model=null,this.modelItem={},this.ref=this.hasAttribute("ref")?this.getAttribute("ref"):""}getModel(){if(this.model)return this.model;return this.getOwnerForm().querySelector("fx-model")}getOwnerForm(){let e=this;for(;e&&e.parentNode;){if("FX-FORE"===e.nodeName.toUpperCase())return e;e=e.parentNode instanceof DocumentFragment?e.parentNode.host:e.parentNode}return e}evalInContext(){const e=tt(this,this.ref);if(e)if(""===this.ref)this.nodeset=e;else if(Array.isArray(e))e.forEach(t=>{if(Me.isSelfReference(this.ref))this.nodeset=e;else{const e=Le(this.ref,t,null);this.nodeset.push(e)}});else{const t=this.getOwnerForm();e.nodeType?this.nodeset=Le(this.ref,e,t):this.nodeset=_e(this.ref,e,t)}else console.warn("no in scopeContext for ",this)}isNotBound(){return!this.hasAttribute("ref")}isBound(){return this.hasAttribute("ref")}getBindingExpr(){if(this.hasAttribute("ref"))return this.getAttribute("ref");const e=this.parentNode.closest("[ref]");return e?e.getAttribute("ref"):"instance()"}getInstance(){if(this.ref.startsWith("instance(")){const e=Me.getInstanceId(this.ref);return this.getModel().getInstance(e)}return this.getModel().getInstance("default")}_getParentBindingElement(e){if(e.parentNode.host){const{host:t}=e.parentNode;if(t.hasAttribute("ref"))return t}else if(e.parentNode){if(e.parentNode.hasAttribute("ref"))return this.parentNode;this._getParentBindingElement(this.parentNode)}return null}getModelItem(){const e=this.getModel().getModelItem(this.nodeset);e&&(this.modelItem=e);let t;if(this.closest("fx-repeatitem")){const{index:e}=this.closest("fx-repeatitem");t=Array.isArray(this.nodeset)?this.getModel().getModelItem(this.nodeset[e-1]):this.getModel().getModelItem(this.nodeset)}else t=this.getModel().getModelItem(this.nodeset);return t||We.lazyCreateModelItem(this.getModel(),this.ref,this.nodeset)}getValue(){if(this.hasAttribute("value")){const e=this.getAttribute("value");try{return qe(e,tt(this,e),this.getOwnerForm())}catch(e){console.error(e),this.dispatch("error",{message:e})}}return this.textContent?this.textContent:null}getInScopeContext(){return tt(this,this.ref)}dispatch(e,t){const n=new CustomEvent(e,{composed:!0,bubbles:!0,detail:t});console.log("firing",n),this.dispatchEvent(n)}};class rt extends(nt(HTMLElement)){constructor(){super(),this.nodeset=[],this.model={},this.contextNode={},this.inited=!1}connectedCallback(){this.ref=this.getAttribute("ref"),this.readonly=this.getAttribute("readonly"),this.required=this.getAttribute("required"),this.relevant=this.getAttribute("relevant"),this.type=this.hasAttribute("type")?this.getAttribute("type"):rt.TYPE_DEFAULT,this.calculate=this.getAttribute("calculate")}init(e){this.model=e,console.log("init binding ",this),this.instanceId=this._getInstanceId(),this.bindType=this.getModel().getInstance(this.instanceId).type,"xml"===this.bindType&&(this._evalInContext(),this._buildBindGraph(),this._createModelItems()),this._processChildren(e)}_buildBindGraph(){"xml"===this.bindType&&this.nodeset.forEach(e=>{const t=Me.getPath(e);this.calculate&&(this.model.mainGraph.addNode(t+":calculate",e),this.model.mainGraph.addNode(t,e),this.model.mainGraph.addDependency(t,t+":calculate"));const n=this._getReferencesForProperty(this.calculate,e);0!==n.length&&this._addDependencies(n,e,t,"calculate");const r=this._getReferencesForProperty(this.readonly,e);0!==r.length?this._addDependencies(r,e,t,"readonly"):this.readonly&&this.model.mainGraph.addNode(t+":readonly",e);const a=this._getReferencesForProperty(this.required,e);0!==a.length?this._addDependencies(a,e,t,"required"):this.required&&this.model.mainGraph.addNode(t+":required",e);const i=this._getReferencesForProperty(this.relevant,e);0!==i.length?this._addDependencies(i,e,t,"relevant"):this.relevant&&this.model.mainGraph.addNode(t+":relevant",e);const o=this._getReferencesForProperty(this.constraint,e);0!==o.length?this._addDependencies(o,e,t,"constraint"):this.constraint&&this.model.mainGraph.addNode(t+":constraint",e)})}_addNode(e,t){this.model.mainGraph.hasNode(e)||this.model.mainGraph.addNode(e,{node:t})}_addDependencies(e,t,n,r){const a=`${n}:${r}`;0!==e.length?(this.model.mainGraph.hasNode(a)||this.model.mainGraph.addNode(a,t),e.forEach(e=>{const t=Me.getPath(e);this.model.mainGraph.hasNode(t)||this.model.mainGraph.addNode(t,e),this.model.mainGraph.addDependency(a,t)})):this.model.mainGraph.addNode(a,t)}_processChildren(e){const t=this.querySelectorAll(":scope > fx-bind");Array.from(t).forEach(t=>{t.init(e)})}getAlert(){if(this.hasAttribute("alert"))return this.getAttribute("alert");const e=this.querySelector("fx-alert");return e?e.innerHTML:null}_evalInContext(){const e=this.getInScopeContext();if(this.nodeset=[],""===this.ref||null===this.ref)this.nodeset=e;else if(Array.isArray(e))e.forEach(t=>{if(Me.isSelfReference(this.ref))this.nodeset=e;else if(this.ref){ke(this.ref,t,this.getOwnerForm()).forEach(e=>{this.nodeset.push(e)})}});else{"xml"===this.getModel().getInstance(this.instanceId).type?this.nodeset=ke(this.ref,e,this.getOwnerForm()):this.nodeset=this.ref}}_createModelItems(){Array.isArray(this.nodeset)?Array.from(this.nodeset).forEach(e=>{this._createModelItem(e)}):this._createModelItem(this.nodeset)}static lazyCreateModelitems(e,t,n){Array.isArray(n)?Array.from(n).forEach(n=>{rt.lazyCreateModelItem(e,t,n)}):rt.lazyCreateModelItem(e,t,n)}_createModelItem(e){if(Me.isSelfReference(this.ref)){const e=this.parentElement.closest("fx-bind[ref]");return console.log("parent bound element ",e),void(e?e.required=this.required:console.error("no parent bound element"))}const t=e,n=Me.getPath(e),r=new ze(n,this.getBindingExpr(),rt.READONLY_DEFAULT,rt.RELEVANT_DEFAULT,rt.REQUIRED_DEFAULT,rt.CONSTRAINT_DEFAULT,this.type,t,this);this.getModel().registerModelItem(r)}_getReferencesForProperty(e){if(e){const t=new Set,n=new Ge(e=>t.add(e));return this.nodeset.forEach(t=>{qe(e,t,this.getOwnerForm(),n)}),Array.from(t.values())}return[]}_initBooleanModelItemProperty(e,t){return Ye(this[e],t,this)}static shortenPath(e){const t=e.split("/");let n="";for(let e=2;e0&&(this.toastElement.timeOutValue=window.setTimeout(()=>{this._removeElement(this.toastElement)},this.options.duration)),this}hideToast(){this.toastElement.timeOutValue&&clearTimeout(this.toastElement.timeOutValue),this._removeElement(this.toastElement)}_init(e){this.options=Object.assign(this.defaults,e),this.options.backgroundColor&&console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.'),this.toastElement=null,this.options.gravity="bottom"===e.gravity?"toastify-bottom":"toastify-top",this.options.stopOnFocus=void 0===e.stopOnFocus||e.stopOnFocus,this.options.style.background=this.options.style.background||e.backgroundColor}_buildToast(){if(!this.options)throw"Toastify is not initialized";let e=document.createElement("div");e.className="toastify on "+this.options.className,e.className+=" toastify-"+this.options.position,e.className+=" "+this.options.gravity;for(const t in this.options.style)e.style[t]=this.options.style[t];if(this.options.node&&this.options.node.nodeType===Node.ELEMENT_NODE)e.appendChild(this.options.node);else if(this.options.escapeMarkup?e.innerText=this.options.text:e.innerHTML=this.options.text,""!==this.options.avatar){let t=document.createElement("img");t.src=this.options.avatar,t.className="toastify-avatar","left"==this.options.position?e.appendChild(t):e.insertAdjacentElement("afterbegin",t)}if(!0===this.options.close){let t=document.createElement("span");t.innerHTML="✖",t.className="toast-close",t.addEventListener("click",e=>{e.stopPropagation(),this._removeElement(this.toastElement),window.clearTimeout(this.toastElement.timeOutValue)});const n=window.innerWidth>0?window.innerWidth:screen.width;"left"==this.options.position&&n>360?e.insertAdjacentElement("afterbegin",t):e.appendChild(t)}if(this.options.stopOnFocus&&this.options.duration>0&&(e.addEventListener("mouseover",t=>{window.clearTimeout(e.timeOutValue)}),e.addEventListener("mouseleave",()=>{e.timeOutValue=window.setTimeout(()=>{this._removeElement(e)},this.options.duration)})),void 0!==this.options.destination&&e.addEventListener("click",e=>{e.stopPropagation(),!0===this.options.newWindow?window.open(this.options.destination,"_blank"):window.location=this.options.destination}),"function"==typeof this.options.onClick&&void 0===this.options.destination&&e.addEventListener("click",e=>{e.stopPropagation(),this.options.onClick()}),"object"==typeof this.options.offset){const t=this._getAxisOffsetAValue("x",this.options),n=this._getAxisOffsetAValue("y",this.options),r="left"==this.options.position?t:"-"+t,a="toastify-top"==this.options.gravity?n:"-"+n;e.style.transform=`translate(${r},${a})`}return e}_removeElement(e){e.className=e.className.replace(" on",""),window.setTimeout(()=>{this.options.node&&this.options.node.parentNode&&this.options.node.parentNode.removeChild(this.options.node),e.parentNode&&e.parentNode.removeChild(e),this.options.callback.call(e),this._reposition()},400)}_reposition(){let e,t={top:15,bottom:15},n={top:15,bottom:15},r={top:15,bottom:15},a=this._rootElement.querySelectorAll(".toastify");for(let i=0;i0?window.innerWidth:screen.width)<=360?(a[i].style[e]=r[e]+"px",r[e]+=o+s):!0===a[i].classList.contains("toastify-left")?(a[i].style[e]=t[e]+"px",t[e]+=o+s):(a[i].style[e]=n[e]+"px",n[e]+=o+s)}}_getAxisOffsetAValue(e,t){return t.offset[e]?isNaN(t.offset[e])?t.offset[e]:t.offset[e]+"px":"0px"}}function it(e){return new at(e)}class ot extends HTMLElement{static get properties(){return{avatar:{type:String},backgroundColor:{type:String},callback:{type:String},classProp:{type:String},close:{type:Boolean},destination:{type:String},duration:{type:Number},escapeMarkup:{type:Boolean},gravity:{type:String},newWindow:{type:Boolean},oldestFirst:{type:Boolean},position:{type:String},selector:{type:String},stopOnFocus:{type:Boolean},text:{type:String}}}constructor(){super(),this.attachShadow({mode:"open"})}_initVar(e,t){return this.hasAttribute(e)?this.getAttribute(e):t}connectedCallback(){this.avatar=this._initVar("avatar",""),this.backgroundColor=this._initVar("backgroundColor",""),this.callback=this._initVar("callback",{}),this.classProp=this._initVar("data-class",""),this.close="true"===this._initVar("close",!1),this.destination=this._initVar("destination",""),this.duration=Number(this._initVar("duration",3e3)),this.escapeMarkup="true"===this._initVar("escapeMarkup",!0),this.gravity=this._initVar("gravity","top"),this.newWindow="true"===this._initVar("newWindow",!1),this.oldestFirst="true"===this._initVar("oldestFirst",!0),this.position=this._initVar("position","right"),this.stopOnFocus=this._initVar("stopOnFocus",!0),this.text=this._initVar("text","");this.shadowRoot.innerHTML=`\n \n ${this.renderHTML}\n `,this.addEventListener("jinn-toast",e=>{this.showToast(e.detail.text)})}showToast(e){new it({avatar:this.avatar,className:this.classProp,close:this.close,destination:this.destination,duration:this.duration,escapeMarkup:this.escapeMarkup,gravity:this.gravity,newWindow:this.newWindow,oldestFirst:this.oldestFirst,position:this.position,node:this.shadowRoot,stopOnFocus:this.stopOnFocus,text:e}).showToast()}renderHTML(){return"\n \n "}}window.customElements.define("jinn-toast",ot);class st extends HTMLElement{static get properties(){return{model:{type:Object},ready:{type:Boolean}}}constructor(){super(),this.model={},this.addEventListener("model-construct-done",this._handleModelConstructDone),this.addEventListener("message",this._displayMessage),this.addEventListener("error",this._displayError),window.addEventListener("compute-exception",e=>{console.error("circular dependency: ",e)}),this.ready=!1,this.storedTemplateExpressionByNode=new Map;this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML='\n \n \n \n \n \n
\n \n
\n \n '}connectedCallback(){this.shadowRoot.querySelector("slot").addEventListener("slotchange",e=>{let t=e.target.assignedElements().find(e=>"FX-MODEL"===e.nodeName.toUpperCase());if(!t){const e=document.createElement("FX-model");this.appendChild(e),t=e}t.inited||(console.log("########## FORE: kick off processing... ##########"),t.modelConstruct()),this.model=t})}evaluateToNodes(e,t){return ke(e,t,this)}disconnectedCallback(){}async refresh(){console.group("### refresh"),Pe.refreshChildren(this),this._updateTemplateExpressions(),console.groupEnd(),console.log("### <<<<< dispatching refresh-done - end of UI update cycle >>>>>"),this.dispatchEvent(new CustomEvent("refresh-done"))}_updateTemplateExpressions(){const e=ke("(descendant-or-self::*/(text(), @*))[matches(.,'\\{.*\\}')] except descendant-or-self::xhtml:fx-model/descendant-or-self::node()/(., @*)",this,this);console.log("template expressions found ",e),Array.from(e).forEach(e=>{if(this.storedTemplateExpressionByNode.has(e))return;const t=this._getTemplateExpression(e);this.storedTemplateExpressionByNode.set(e,t)});for(const e of this.storedTemplateExpressionByNode.keys())this._processTemplateExpression({node:e,expr:this.storedTemplateExpressionByNode.get(e)});console.log("stored template expressions ",this.storedTemplateExpressionByNode)}_processTemplateExpression(e){const{expr:t}=e,{node:n}=e;this.evaluateTemplateExpression(t,n,this)}evaluateTemplateExpression(e,t){if("{}"===e)return;const n=e.match(/{[^}]*}/g),r=t.nodeType===t.TEXT_NODE?t.parentNode:t.ownerElement;n&&n.forEach(n=>{let a=n.substring(1,n.length-1);const i=tt(t,a);if(i)try{const o=qe(a,i,t,null,r),s=e.replaceAll(n,o);if(console.log("result of replacing ",s),t.nodeType===Node.ATTRIBUTE_NODE){t.ownerElement.setAttribute(t.nodeName,s)}else t.nodeType===Node.TEXT_NODE&&(t.textContent=s);s.includes("{")&&(console.log("need to go next round"),a=s.substring(1,s.length),this.evaluateTemplateExpression(s,t))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:e}))}else{const e=t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ATTRIBUTE_NODE?t.parentNode:t;console.warn("no inscope context for ",e)}})}_getTemplateExpression(e){return e.nodeType===Node.ATTRIBUTE_NODE?e.value:e.nodeType===Node.TEXT_NODE?e.textContent:null}_refreshChildren(){this.querySelectorAll("*").forEach(e=>{Pe.isUiElement(e.nodeName)&&"function"==typeof e.refresh&&e.refresh()})}_handleModelConstructDone(){this._initUI()}async _lazyCreateInstance(){const e=this.querySelector("fx-model");if(0===e.instances.length){console.log("### lazy creation of instance");const t=document.createElement("fx-instance");e.appendChild(t);const n=document.implementation.createDocument(null,"data",null);this._generateInstance(this,n.firstElementChild),t.instanceData=n,e.instances.push(t),console.log("generatedInstance ",this.getModel().getDefaultInstanceData())}}_generateInstance(e,t){if(e.hasAttribute("ref")&&!Pe.isActionElement(e.nodeName)){const n=e.getAttribute("ref");if(n.includes("/")){console.log("complex path to create ",n);n.split("/").forEach(n=>{console.log("step ",n),t=this._generateNode(t,n,e)})}else t=this._generateNode(t,n,e)}if(e.hasChildNodes()){const n=e.children;for(let e=0;e>>>>"),console.log("########## modelItems: ",this.getModel().modelItems),console.log("########## FORE: form fully initialized... ##########"),this.dispatchEvent(new CustomEvent("ready",{}))}getModel(){return this.querySelector("fx-model")}_displayMessage(e){const{level:t}=e.detail,n=e.detail.message;this._showMessage(t,n)}_displayError(e){const t=e.detail.message;this.shadowRoot.querySelector("#error").showToast(t)}_showMessage(e,t){if("modal"===e)this.shadowRoot.getElementById("messageContent").innerText=t,this.shadowRoot.getElementById("modalMessage").classList.add("show");else if("modeless"===e)this.shadowRoot.querySelector("#message").showToast(t);else{this.shadowRoot.querySelector("#message").showToast(t)}}}customElements.define("fx-fore",st);class ut extends(nt(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.methods=["get","put","post","delete","head","urlencoded-post"],this.model=this.parentNode,this.hasAttribute("id")||console.warn("id is required"),this.id=this.getAttribute("id"),this.instance=this.hasAttribute("instance")?this.getAttribute("instance"):null,this.method=this.hasAttribute("method")?this.getAttribute("method"):"get",this.nonrelevant=this.hasAttribute("nonrelevant")?this.getAttribute("nonrelevant"):"remove",this.replace=this.hasAttribute("replace")?this.getAttribute("replace"):"all",this.serialization=this.hasAttribute("serialization")?this.getAttribute("serialization"):"xml",this.hasAttribute("url")||console.warn("url is required for submission: "+this.id),this.url=this.getAttribute("url"),this.targetref=this.hasAttribute("targetref")?this.getAttribute("targetref"):null,this.mediatype=this.hasAttribute("mediatype")?this.getAttribute("mediatype"):"application/xml",this.validate=this.getAttribute("validate")?this.getAttribute("validate"):"true",this.shadowRoot.innerHTML=this.renderHTML()}renderHTML(){return"\n \n "}async submit(){await this.dispatch("submit",{submission:this}),this._submit()}async _submit(){console.log("submitting...."),this.evalInContext();const e=this.getModel();if(e.recalculate(),this.validate){if(!e.revalidate())return void console.log("validation failed. Bubmission stopped")}console.log("model updated...."),await this._serializeAndSend()}_evaluateAttributeTemplateExpression(e,t){const n=e.match(/{[^}]*}/g);return n&&n.forEach(n=>{console.log("match ",n);const r=n.substring(1,n.length-1),a=qe(r,tt(t,r),this.getOwnerForm()),i=e.replaceAll(n,a);console.log("replacing ",e," with ",i),e=i}),e}async _serializeAndSend(){const e=this._evaluateAttributeTemplateExpression(this.url,this),t=this.getInstance();if("xml"!==t.type)return void console.error("JSON serialization is not supported yet");let n;if("none"===this.serialization)n=void 0;else{const e=this.selectRelevant();n=this._serialize(t.type,e)}if("get"===this.method.toLowerCase()&&(n=void 0),"#echo"===e){let e;return e=n?(new DOMParser).parseFromString(n,"application/xml"):void 0,this._handleResponse(e),void this.dispatch("submit-done",{})}const r=this._getHeaders();if(console.log("headers",r),"urlencoded-post"===this.method&&(this.method="post"),!this.methods.includes(this.method.toLowerCase()))return void this.dispatch("error",{message:"Unknown method "+this.method});const a=await fetch(e,{method:this.method,mode:"cors",credentials:"include",headers:r,body:n});if(!a.ok||a.status>400)return void this.dispatch("submit-error",{message:"Error while submitting "+this.id});const i=a.headers.get("content-type").toLowerCase();if(i.startsWith("text/plain")||i.startsWith("text/html")){const e=await a.text();this._handleResponse(e)}else if(i.startsWith("application/json")){const e=await a.json();this._handleResponse(e)}else if(i.startsWith("application/xml")){const e=await a.text(),t=(new DOMParser).parseFromString(e,"application/xml");this._handleResponse(t)}else{const e=await a.blob();this._handleResponse(e)}this.dispatch("submit-done",{})}_serialize(e,t){if("urlencoded-post"===this.method){const e=new URLSearchParams;return Array.from(t.children).forEach(t=>{e.append(t.nodeName,t.textContent)}),e}if("xml"===e){return(new XMLSerializer).serializeToString(t)}throw new Error("unknown instance type ",e)}_getHeaders(){const e=new Headers,t=this.getInstance(),n=Pe.getContentType(t,this.method);e.append("Content-Type",n),e.has("Accept")&&e.delete("Accept");const r=this.querySelectorAll("fx-header");return Array.from(r).forEach(t=>{const{name:n}=t,r=t.getValue();e.append(n,r)}),e}_getUrlExpr(){return this.storedTemplateExpressions.find(e=>"url"===e.node.nodeName)}_getTargetInstance(){let e;if(e=this.instance?this.model.getInstance(this.instance):this.model.getInstance("default"),!e)throw new Error("target instance not found: "+e);return e}_handleResponse(e){if(console.log("_handleResponse ",e),"instance"===this.replace){const t=this._getTargetInstance();if(!t)throw new Error("target instance not found: "+t);if(this.targetref){const n=_e(this.targetref,t,this.getOwnerForm());console.log("theTarget",n);const r=e.firstElementChild,a=n.parentNode;a.replaceChild(r,n),console.log("finally ",a)}else{const n=e;t.instanceData=n,console.log("### replaced instance ",t.instanceData)}this.model.updateModel(),this.getOwnerForm().refresh()}if("all"===this.replace&&(document.getElementsByTagName("html")[0].innerHTML=e),"target"===this.replace){const t=this.getAttribute("target");document.querySelector(t).innerHTML=e}"redirect"===this.replace&&(window.location.href=e)}selectRelevant(){if("keep"===this.nonrelevant)return this.nodeset;const e=this.getModel().getModelItem(this.nodeset);if(e&&!e.relevant)return null;const t=(new DOMParser).parseFromString("","application/xml").firstElementChild;if(0===this.nodeset.children.length&&this._isRelevant(this.nodeset))return this.nodeset;return this._filterRelevant(this.nodeset,t)}_filterRelevant(e,t){const{childNodes:n}=e;return Array.from(n).forEach(e=>{if(this._isRelevant(e)){const n=e.cloneNode(!1);t.appendChild(n);const{attributes:r}=e;return r&&Array.from(r).forEach(e=>{this._isRelevant(e)?n.setAttribute(e.nodeName,e.value):"empty"===this.nonrelevant?n.setAttribute(e.nodeName,""):n.removeAttribute(e.nodeName)}),this._filterRelevant(e,n)}return null}),t}_isRelevant(e){const t=this.getModel().getModelItem(e);return!(t&&!t.relevant)}_handleError(){this.dispatch("submit-error",{})}}customElements.define("fx-submission",ut);class lt extends(nt(HTMLElement)){constructor(){if(super(),this.style.display="none",this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML="",!this.hasAttribute("name"))throw new Error('required attribute "name" missing');this.name=this.getAttribute("name")}connectedCallback(){this.shadowRoot.innerHTML=""}}customElements.define("fx-header",lt); -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -const ct="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,pt=`{{lit-${String(Math.random()).slice(2)}}}`,ht=`\x3c!--${pt}--\x3e`,ft=e=>-1!==e.index,dt=()=>document.createComment(""),mt=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/,vt=new WeakMap,gt=e=>"function"==typeof e&&vt.has(e),yt={},wt={}; -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -class At{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this.options=n}update(e){let t=0;for(const n of this.__parts)void 0!==n&&n.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=ct?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],n=this.template.parts,r=document.createTreeWalker(e,133,null,!1);let a,i=0,o=0,s=r.nextNode();for(;ie}),bt=` ${pt} `;class Et{constructor(e,t,n,r){this.strings=e,this.values=t,this.type=n,this.processor=r}getHTML(){const e=this.strings.length-1;let t="",n=!1;for(let r=0;r-1||n)&&-1===e.indexOf("--\x3e",a+1);const i=mt.exec(e);t+=null===i?e+(n?bt:ht):e.substr(0,i.index)+i[1]+i[2]+"$lit$"+i[3]+pt}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==xt&&(t=xt.createHTML(t)),e.innerHTML=t,e}} -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */const Bt=e=>null===e||!("object"==typeof e||"function"==typeof e),Nt=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class Ct{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e{for(;t!==n;){const n=t.nextSibling;e.removeChild(t),t=n}})(this.startNode.parentNode,e.nextSibling,this.endNode)}}class Ot{constructor(e,t,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=n}setValue(e){this.__pendingValue=e}commit(){for(;gt(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=yt,e(this)}if(this.__pendingValue===yt)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=yt}}class St extends Ct{constructor(e,t,n){super(e,t,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new Dt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class Dt extends Tt{}let Rt=!1;(()=>{try{const e={get capture(){return Rt=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class Gt{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;gt(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=yt,e(this)}if(this.__pendingValue===yt)return;const e=this.__pendingValue,t=this.value,n=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),r=null!=e&&(null==t||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),r&&(this.__options=Mt(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=yt}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const Mt=e=>e&&(Rt?{capture:e.capture,passive:e.passive,once:e.once}:e.capture) -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */;const Ut=new class{handleAttributeExpressions(e,t,n,r){const a=t[0];if("."===a){return new St(e,t.slice(1),n).parts}if("@"===a)return[new Gt(e,t.slice(1),r.eventContext)];if("?"===a)return[new Ot(e,t.slice(1),n)];return new Ct(e,t,n).parts}handleTextExpression(e){return new It(e)}}; -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const Ft=(e,...t)=>new Et(e,t,"html",Ut) -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */;void 0===window.ShadyCSS||void 0===window.ShadyCSS.prepareTemplateDom&&console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1.") -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */,window.JSCompiler_renameProperty=(e,t)=>e -/** -@license -Copyright (c) 2019 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at -http://polymer.github.io/LICENSE.txt The complete set of authors may be found at -http://polymer.github.io/AUTHORS.txt The complete set of contributors may be -found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as -part of the polymer project is also subject to an additional IP rights grant -found at http://polymer.github.io/PATENTS.txt -*/;const Pt=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ht=Symbol();class jt{constructor(e,t){if(t!==Ht)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(Pt?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const Xt=(e,...t)=>{const n=t.reduce((t,n,r)=>t+(e=>{if(e instanceof jt)return e.cssText;if("number"==typeof e)return e;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(n)+e[r+1],e[0]);return new jt(n,Ht)}; -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");class _t extends(nt(HTMLElement)){constructor(){super(),this.value="",this.display=this.style.display,this.required=!1,this.readonly=!1,this.widget=null}getWidget(){throw new Error("You have to implement the method getWidget!")}async refresh(){console.log("### AbstractControl.refresh on : ",this);const e=this.value;if(!this.isNotBound()&&(this.evalInContext(),this.isBound())){if(null===this.nodeset)return void(this.style.display="none");if(this.modelItem=this.getModelItem(),this.modelItem instanceof ze){if(this.value=this.modelItem.value,await this.updateWidgetValue(),this.handleModelItemProperties(),!this.getOwnerForm().ready)return;e!==this.value&&this.dispatch("value-changed",{path:this.modelItem.path})}}}async updateWidgetValue(){throw new Error("You have to implement the method updateWidgetValue!")}handleModelItemProperties(){console.log("form ready",this.getOwnerForm().ready),this.handleRequired(),this.handleReadonly(),this.getOwnerForm().ready&&this.handleValid(),this.handleRelevant()}_getForm(){return this.getModel().parentNode}_dispatchEvent(e){this.getOwnerForm().ready&&this.dispatch(e,{})}handleRequired(){this.widget=this.getWidget(),this.isRequired()!==this.modelItem.required&&(this.modelItem.required?(this.widget.setAttribute("required","required"),this.classList.add("required"),this._dispatchEvent("required")):(this.widget.removeAttribute("required"),this.required=!1,this.classList.toggle("required"),this._dispatchEvent("optional")))}handleReadonly(){this.isReadonly()!==this.modelItem.readonly&&(this.modelItem.readonly&&(this.widget.setAttribute("readonly","readonly"),this.classList.toggle("readonly"),this._dispatchEvent("readonly")),this.modelItem.readonly||(this.widget.removeAttribute("readonly"),this.classList.toggle("readonly"),this._dispatchEvent("readwrite")))}handleValid(){const e=this.querySelector("fx-alert");if(this.isValid()!==this.modelItem.constraint)if(this.modelItem.constraint)this.classList.remove("invalid"),e&&(e.style.display="none"),this._dispatchEvent("valid");else{if(this.classList.add("invalid"),e&&(e.style.display="block"),0!==this.modelItem.alerts.length){const{alerts:e}=this.modelItem;console.log("alerts from bind: ",e);this.querySelector("fx-alert")||e.forEach(e=>{const t=document.createElement("fx-alert");t.innerHTML=e,this.appendChild(t),t.style.display="block"})}this._dispatchEvent("invalid")}}handleRelevant(){this.isEnabled()!==this.modelItem.relevant&&(this.modelItem.relevant?(this._dispatchEvent("relevant"),this.style.display=this.display):(this._dispatchEvent("nonrelevant"),this.style.display="none"))}isRequired(){return!!this.widget.hasAttribute("required")}isValid(){return!this.classList.contains("invalid")}isReadonly(){return!!this.widget.hasAttribute("readonly")}isEnabled(){return"none"!==this.style.display}_fadeOut(e){e.style.opacity=1,function t(){(e.style.opacity-=.1)<0?e.style.display="none":requestAnimationFrame(t)}()}_fadeIn(e,t){e.style.opacity=0,e.style.display=t||"block",function t(){let n=parseFloat(e.style.opacity);(n+=.1)>1||(e.style.opacity=n,requestAnimationFrame(t))}()}}window.customElements.define("fx-abstract-control",_t);customElements.define("fx-alert",class extends _t{static get styles(){return Xt`:host{display:block;height:auto;font-size:.8em;font-weight:400;color:red;display:none}`}constructor(){super(),this.style.display="none"}static get properties(){return{...super.properties}}render(){return Ft``}async updateWidgetValue(){console.log("alert update",this),this.innerHTML=this.value}});window.customElements.define("fx-control",class extends _t{constructor(){super(),this.inited=!1,this.attachShadow({mode:"open"})}connectedCallback(){this.updateEvent=this.hasAttribute("update-event")?this.getAttribute("update-event"):"blur",this.valueProp=this.hasAttribute("value-prop")?this.getAttribute("value-prop"):"value",this.label=this.hasAttribute("label")?this.getAttribute("label"):null;this.shadowRoot.innerHTML=`\n \n ${this.renderHTML(this.ref)}\n `,this.widget=this.getWidget(),console.log("widget ",this.widget),"enter"===this.updateEvent&&(this.widget.addEventListener("keyup",e=>{13===e.keyCode&&(e.preventDefault(),this.setValue(this.widget[this.valueProp]))}),this.updateEvent="blur"),this.widget.addEventListener(this.updateEvent,()=>{console.log("eventlistener ",this.updateEvent),this.setValue(this.widget[this.valueProp])})}setValue(e){const t=this.getModelItem(),n=this.shadowRoot.getElementById("setvalue");n.setValue(t,e),n.actionPerformed()}renderHTML(e){return`\n ${this.label?""+this.label:""}\n \n \n `}getWidget(){let e=this.querySelector(".widget");if(e||(e=this.querySelector("input")),!e){const e=document.createElement("input");return e.classList.add("widget"),e.setAttribute("type","text"),this.appendChild(e),e}return e}async updateWidgetValue(){if("checked"===this.valueProp)"true"===this.value?this.widget.checked=!0:this.widget.checked=!1;else{let{widget:e}=this;e||(e=this),e.value=this.value}}async refresh(){if(super.refresh(),this.widget.hasAttribute("ref")){const e=this.widget.querySelector("template"),t=this.widget.getAttribute("ref"),n=this.getInScopeContext(),r=this.closest("fx-fore"),a=_e(t,n,r),{children:i}=this.widget;Array.from(i).forEach(e=>{"template"!==e.nodeName.toLowerCase()&&e.parentNode.removeChild(e)}),Array.from(a).forEach(t=>{console.log("#### node",t);const n=e.content.firstElementChild.cloneNode(!0),a=document.importNode(n,!0);this.widget.appendChild(a);const i=this._getValueAttribute(a),o=i.value,s=_e(o.substring(1,o.length-1),t,r);i.value=s,this.value===s&&a.setAttribute("selected","selected");const u=a.textContent,l=qe(u.substring(1,u.length-1),t,r);a.textContent=l})}}_getValueAttribute(e){let t;return Array.from(e.attributes).forEach(e=>{-1!==e.value.indexOf("{")&&(t=e)}),t}});class Lt extends(nt(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML="\n \n \n \n \n "}refresh(){console.log("### FxContainer.refresh on : ",this),this.isBound()&&(this.evalInContext(),this.modelItem=this.getModelItem(),this.value=this.modelItem.value),this._getForm().ready&&this.handleModelItemProperties(),Pe.refreshChildren(this)}handleModelItemProperties(){this.handleReadonly(),this.handleRelevant()}_getForm(){return this.getModel().parentNode}handleReadonly(){this.isReadonly()!==this.modelItem.readonly&&(this.modelItem.readonly&&(this.setAttribute("readonly","readonly"),this.dispatchEvent(new CustomEvent("readonly",{}))),this.modelItem.readonly||(this.removeAttribute("readonly"),this.dispatchEvent(new CustomEvent("readwrite",{}))))}handleRelevant(){this.isEnabled()!==this.modelItem.enabled&&(this.modelItem.enabled?this.dispatchEvent(new CustomEvent("enabled",{})):this.dispatchEvent(new CustomEvent("disabled",{})))}isReadonly(){return!!this.hasAttribute("readonly")}isEnabled(){return"none"!==this.style.display}}window.customElements.define("fx-container",Lt);window.customElements.define("fx-group",class extends Lt{static get properties(){return{...super.properties,collapse:{type:Boolean,reflect:!0}}}constructor(){super(),this.collapse=!1}render(){return Ft``}handleModelItemProperties(){this.handleRelevant()}initializeChildren(e){const t=Array.from(e.children);console.log("_initializeChildren ",t),t.forEach(e=>{if(console.log("child ",e),Pe.isUiElement(e.nodeName))e.init(this.model);else if(0!==e.children.length){Array.from(e.children).forEach(e=>{this.initializeChildren(e)})}}),console.groupEnd()}});customElements.define("fx-hint",class extends _t{static get styles(){return Xt`:host{display:block;height:auto;font-size:.8em;font-weight:400;font-style:italic}`}static get properties(){return{...super.properties}}render(){return Ft``}});customElements.define("fx-output",class extends _t{static get properties(){return{...super.properties,valueAttr:{type:String}}}constructor(){super(),this.attachShadow({mode:"open"}),this.valueAttr=this.hasAttribute("value")?this.getAttribute("value"):null}connectedCallback(){this.shadowRoot.innerHTML='\n \n \n \n \n \n \n \n ',this.addEventListener("slotchange",e=>{console.log("slotchange ",e)})}async refresh(){if(this.valueAttr)return this.value=this.getValue(),void await this.updateWidgetValue();this.ref&&super.refresh()}getValue(){try{const e=tt(this,this.valueAttr);return this.hasAttribute("html")?_e(this.valueAttr,e,this):qe(this.valueAttr,e,this)}catch(e){console.error(e),this.dispatch("error",{message:e})}return null}getWidget(){return this.shadowRoot.getElementById("value")}async updateWidgetValue(){const e=this.shadowRoot.getElementById("value");if(this.hasAttribute("html"))return this.modelItem.node?void(e.innerHTML=this.modelItem.node.outerHTML):void(e.innerHTML=this.value.outerHTML);e.innerHTML=this.value}isReadonly(){return this.readonly=!0,this.readonly}});class kt extends(nt(HTMLElement)){static get properties(){return{inited:{type:Boolean}}}constructor(){super(),this.inited=!1,this.addEventListener("click",this._dispatchIndexChange),this.addEventListener("focusin",this._handleFocus),this.attachShadow({mode:"open",delegatesFocus:!0})}_handleFocus(){this.parentNode.setIndex(this.index),this.closest("fx-fore").refresh()}_dispatchIndexChange(){this.parentNode&&this.parentNode.dispatchEvent(new CustomEvent("item-changed",{composed:!0,bubbles:!0,detail:{item:this}}))}connectedCallback(){this.display=this.style.display;this.shadowRoot.innerHTML="\n \n \n \n "}disconnectedCallback(){this.removeEventListener("click",this._dispatchIndexChange()),this.removeEventListener("focusin",this._handleFocus)}init(){this.inited=!0}getModelItem(){return super.getModelItem(),this.getModelItem()[this.index]}refresh(){this.modelItem=this.getModel().getModelItem(this.nodeset),this.modelItem&&!this.modelItem.relevant?this.style.display="none":this.style.display=this.display,Pe.refreshChildren(this)}}window.customElements.define("fx-repeatitem",kt);class Yt extends(nt(HTMLElement)){static get properties(){return{...super.properties,index:{type:Number},template:{type:Object},focusOnCreate:{type:String},initDone:{type:Boolean},repeatIndex:{type:Number},nodeset:{type:Array}}}constructor(){super(),this.ref="",this.dataTemplate=[],this.focusOnCreate="",this.initDone=!1,this.repeatIndex=1,this.nodeset=[],this.inited=!1,this.index=1,this.repeatSize=0,this.attachShadow({mode:"open",delegatesFocus:!0})}get repeatSize(){return this.querySelectorAll(":scope > fx-repeatitem").length}set repeatSize(e){this.size=e}setIndex(e){this.index=e;const t=this.querySelectorAll(":scope > fx-repeatitem");this.applyIndex(t[this.index-1])}applyIndex(e){this._removeIndexMarker(),e&&e.setAttribute("repeat-index","")}get index(){return this.getAttribute("index")}set index(e){this.setAttribute("index",e)}connectedCallback(){this.ref=this.getAttribute("ref"),this.addEventListener("item-changed",e=>{console.log("handle index event ",e);const{item:t}=e.detail,n=Array.from(this.children).indexOf(t);this.applyIndex(this.children[n]),this.index=n+1}),this.addEventListener("index-changed",e=>{if(e.stopPropagation(),!e.target===this)return;console.log("handle index event ",e);const{index:t}=e.detail;this.index=t,this.applyIndex(this.children[t-1])}),document.addEventListener("insert",e=>{const t=e.detail.insertedNodes;this.index=e.detail.position,console.log("insert catched",t,this.index)});this.shadowRoot.innerHTML='\n \n \n \n \n \n '}init(){this._evalNodeset(),this._initTemplate(),this._initRepeatItems(),this.setAttribute("index",this.index),this.inited=!0}_evalNodeset(){const e=tt(this,this.ref),t=_e(this.ref,e,this.getOwnerForm());if(null!==t){if("object"==typeof t){if("nodeType"in t)return void(this.nodeset=[t]);if(Array.isArray(t))return void(this.nodeset=t)}throw new Error("Unexpected result of repeat nodeset: "+t)}this.nodeset=[]}async refresh(){console.group("fx-repeat.refresh on",this.id),this.inited||this.init(),this._evalNodeset(),console.log("repeat refresh nodeset ",this.nodeset);const e=this.querySelectorAll(":scope > fx-repeatitem"),t=e.length;let n=1;Array.isArray(this.nodeset)&&(n=this.nodeset.length);const r=n;if(rr;n-=1){const t=e[n-1];t.parentNode.removeChild(t)}if(r>t)for(let e=t+1;e<=r;e+=1){const t=document.createElement("fx-repeatitem"),n=this._clone();t.appendChild(n),this.appendChild(t),t.nodeset=this.nodeset[e-1],t.index=e}for(let n=0;n1||(e.style.opacity=n,requestAnimationFrame(t))}())}_initTemplate(){this.template=this.querySelector("template"),console.log("### init template for repeat ",this.id,this.template),null===this.template&&this.dispatchEvent(new CustomEvent("no-template-error",{composed:!0,bubbles:!0,detail:{message:"no template found for repeat:"+this.id}})),this.shadowRoot.appendChild(this.template)}_initRepeatItems(){this.nodeset.forEach((e,t)=>{const n=document.createElement("fx-repeatitem");n.nodeset=this.nodeset[t],n.index=t+1;const r=this._clone();n.appendChild(r),this.appendChild(n),1===n.index&&this.applyIndex(n)})}_clone(){this.template=this.shadowRoot.querySelector("template");const e=this.template.content.cloneNode(!0);return document.importNode(e,!0)}_removeIndexMarker(){Array.from(this.children).forEach(e=>{e.removeAttribute("repeat-index")})}}window.customElements.define("fx-repeat",Yt);window.customElements.define("fx-switch",class extends Lt{connectedCallback(){super.connectedCallback&&super.connectedCallback();this.shadowRoot.innerHTML="\n \n \n \n \n "}refresh(){super.refresh(),console.log("refresh on switch ");const e=this.querySelectorAll("fx-case");if(this.isBound())Array.from(e).forEach(e=>{e.getAttribute("name")===this.modelItem.value?e.classList.add("selected-case"):e.classList.remove("selected-case")});else{this.querySelector(".selected-case")||e[0].classList.add("selected-case")}Pe.refreshChildren(this)}toggle(e){const t=this.querySelectorAll("fx-case");Array.from(t).forEach(t=>{e===t?t.classList.add("selected-case"):t.classList.remove("selected-case")})}});customElements.define("fx-trigger",class extends _t{connectedCallback(){this.attachShadow({mode:"open"}),this.ref=this.hasAttribute("ref")?this.getAttribute("ref"):null;this.shadowRoot.innerHTML=`\n \n ${this.renderHTML()}\n `;const e=this.shadowRoot.querySelector("slot");e.addEventListener("slotchange",()=>{const t=e.assignedElements({flatten:!0});t[0].setAttribute("tabindex","0"),t[0].setAttribute("role","button");const n=t[0];n.addEventListener("click",e=>this.performActions(e)),this.widget=n,"BUTTON"!==n.nodeName&&n.addEventListener("keypress",e=>{"Space"!==e.code&&"Enter"!==e.code||this.performActions(e)})})}renderHTML(){return"\n \n "}getWidget(){return this.widget}async updateWidgetValue(){return console.log("trigger update",this),null}handleReadonly(){super.handleReadonly(),this.widget.hasAttribute("readonly")?this.widget.setAttribute("disabled","disabled"):this.widget.removeAttribute("disabled")}async performActions(e){const t=this.closest("fx-repeatitem");t&&(console.log("repeated click"),t.click());(async()=>{for(let t=0;t${this.label}`:""}\n \n `;this.shadowRoot.innerHTML=`\n \n ${e}\n `,this.style.display="none"}}async function Vt(e){return new Promise(t=>setTimeout(()=>t(),e))}window.customElements.define("fx-case",qt);class Jt extends(nt(HTMLElement)){static get properties(){return{...super.properties,detail:{type:Object},needsUpdate:{type:Boolean},event:{type:Object},target:{type:String},ifExpr:{type:String},whileExpr:{type:String},delay:{type:Number}}}constructor(){super(),this.detail={},this.needsUpdate=!1}connectedCallback(){this.style.display="none",this.repeatContext=void 0,this.hasAttribute("event")?this.event=this.getAttribute("event"):this.event="activate",this.target=this.getAttribute("target"),this.target?"#window"===this.target?window.addEventListener(this.event,e=>this.execute(e)):"#document"===this.target?document.addEventListener(this.event,e=>this.execute(e)):(this.targetElement=document.getElementById(this.target),this.targetElement.addEventListener(this.event,e=>this.execute(e))):(this.targetElement=this.parentNode,this.targetElement.addEventListener(this.event,e=>this.execute(e))),this.ifExpr=this.hasAttribute("if")?this.getAttribute("if"):null,this.whileExpr=this.hasAttribute("while")?this.getAttribute("while"):null,this.delay=this.hasAttribute("delay")?Number(this.getAttribute("delay")):0}async execute(e){if(console.log("executing",this),e&&e.detail&&(this.detail=e.detail),this.needsUpdate=!1,this.evalInContext(),this.targetElement&&this.targetElement.nodeset&&(this.nodeset=this.targetElement.nodeset),!this.ifExpr||Ye(this.ifExpr,this.nodeset,this.getOwnerForm())){if(this.whileExpr){const e=async()=>{await Vt(this.delay||0),this.ownerDocument.contains(this)&&Ye(this.whileExpr,this.nodeset,this.getOwnerForm())&&(this.perform(),await e())};return await e(),void this.actionPerformed()}!this.delay||(await Vt(this.delay),this.ownerDocument.contains(this))?(this.perform(),this.actionPerformed()):this.actionPerformed()}}perform(){(this.isBound()||"FX-ACTION"===this.nodeName)&&this.evalInContext()}actionPerformed(){if(this.needsUpdate){const e=this.getModel();e.recalculate(),e.revalidate(),e.parentNode.refresh(),this._dispatchActionPerformed()}}_dispatchActionPerformed(){console.log("action-performed ",this),this.dispatchEvent(new CustomEvent("action-performed",{composed:!0,bubbles:!0,detail:{}}))}}window.customElements.define("abstract-action",Jt);window.customElements.define("fx-append",class extends Jt{static get properties(){return{ref:{type:String},repeat:{type:String},clear:{type:String}}}constructor(){super(),this.repeat=""}connectedCallback(){super.connectedCallback(),console.log("connectedCallback ",this),this.ref=this.getAttribute("ref"),this.repeat=this.getAttribute("repeat")}perform(){super.perform(),this._dataFromTemplate(),this.needsUpdate=!0}actionPerformed(){super.actionPerformed(),this.dispatch()}_dataFromTemplate(){const e=this.getInScopeContext(),t=this.getOwnerForm().querySelector("#"+this.repeat),n=t.shadowRoot.querySelector("template"),r=e.ownerDocument.createElement(t.ref),a=this._generateInstance(n.content,r);e.appendChild(a)}dispatch(){let e;Pe.isRepeated(this)?(console.log("append repeated ",this.repeatContext),e=Pe.getRepeatTarget(this,this.repeat)):e=document.getElementById(this.repeat),console.log("dispatching index change ",e.nodeset.length),e.dispatchEvent(new CustomEvent("index-changed",{composed:!0,bubbles:!0,detail:{index:e.nodeset.length}}))}_clear(e){let t=e.firstChild;const n=e.attributes;for(let e=0;ea?n.setIndex(a):n.setIndex(t)}this.needsUpdate=!0}actionPerformed(){this.getModel().rebuild(),super.actionPerformed()}});window.customElements.define("fx-insert",class extends Jt{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback&&super.connectedCallback();this.shadowRoot.innerHTML="\n \n \n ",this.at=Number(this.hasAttribute("at")?this.getAttribute("at"):0),this.position=this.hasAttribute("position")?this.getAttribute("position"):"after",this.origin=this.hasAttribute("origin")?this.getAttribute("origin"):null,this.keepValues=!!this.hasAttribute("keep-values")}_cloneOriginSequence(e,t){let n;if(this.origin){let t;try{t=Le(this.origin,e,this.getOwnerForm()),Array.isArray(t)&&0===t.length&&(console.warn("invalid origin for this insert action - ignoring...",this),n=null),n=t.cloneNode(!0)}catch(e){console.warn("invalid origin for this insert action - ignoring...",this)}}else t&&(n=this._cloneTargetSequence(t),n&&!this.keepValues&&this._clear(n));return n}_getInsertIndex(e,t){return 0===t.length?null:this.hasAttribute("at")?Ve(this.getAttribute("at"),e,this.getOwnerForm()):t.length}perform(){super.perform();const e=tt(this,this.ref),t=ke(this.ref,e,this.getOwnerForm());console.log("insert nodeset ",t);const n=this._cloneOriginSequence(e,t);if(!n)return;let r,a;const i=this._getInsertIndex(e,t);if(console.log("insert index",i),0===t.length)r=e,e.appendChild(n),a=1,console.log("appended",e);else{if(this.hasAttribute("at")?(a=Ve(this.getAttribute("at"),e,this.getOwnerForm()),r=t[a-1]):(a=t.length,r=t[t.length-1]),!r){a=1,r=t;const e=_e("count(preceding::*)",t,this.getOwnerForm());console.log("context",e),a=e+1}this.position&&"before"===this.position&&r.parentNode.insertBefore(n,r),this.position&&"after"===this.position&&(a+=1,r.insertAdjacentElement("afterend",n))}console.log("instance ",this.getModel().getDefaultContext()),console.log("<<<<<<< at",this.at),console.log("<<<<<<< index",a),document.dispatchEvent(new CustomEvent("insert",{composed:!0,bubbles:!0,detail:{insertedNodes:n,position:a}})),this.needsUpdate=!0}_cloneTargetSequence(e){return Array.isArray(e)&&0!==e.length?e[e.length-1].cloneNode(!0):!Array.isArray(e)&&e?e.cloneNode(!0):null}actionPerformed(){this.getModel().rebuild(),super.actionPerformed()}_clear(e){const t=e.attributes;for(let e=0;e\n \n :host{\n display:none;\n }\n \n \n ${this.renderHTML()}\n `}disconnectedCallback(){this.targetElement.removeEventListener(this.event,e=>this.execute(e))}renderHTML(){return"\n \n "}perform(){let e;super.perform(),e=this.hasAttribute("value")?this.getValue():this.textContent,this.dispatchEvent(new CustomEvent("message",{composed:!0,bubbles:!0,detail:{level:this.level,message:e}}))}});window.customElements.define("fx-setvalue",class extends Jt{static get properties(){return{...super.properties,ref:{type:String},valueAttr:{type:String}}}constructor(){super(),this.ref="",this.valueAttr=""}connectedCallback(){if(super.connectedCallback&&super.connectedCallback(),!this.hasAttribute("ref"))throw new Error('fx-setvalue must specify a "ref" attribute');this.ref=this.getAttribute("ref"),this.valueAttr=this.getAttribute("value")}perform(){super.perform();let{value:e}=this;e=null!==this.valueAttr?_e(this.valueAttr,this.nodeset,this.getOwnerForm(),this.detail):""!==this.textContent?this.textContent:"";const t=this.getModelItem();this.setValue(t,e)}setValue(e,t){console.log("setvalue[1] ",e,t);const n=e;n&&n.value!==t&&(n.value=t,n.changed=!0,this.needsUpdate=!0,console.log("setvalue[2] ",n,t))}});window.customElements.define("fx-send",class extends Jt{constructor(){super(),this.value=""}connectedCallback(){super.connectedCallback(),console.log("connectedCallback ",this),this.submission=this.getAttribute("submission")}perform(){super.perform(),console.log("submitting ",this.submission),console.log("submitting model",this.getModel());const e=this.getModel().querySelector("#"+this.submission);if(null===e)throw this.dispatchEvent(new CustomEvent("error",{composed:!0,bubbles:!0,detail:{message:`fx-submission element with id: '${this.submission}' not found`}})),new Error(`submission with id: ${this.submission} not found`);console.log("submission",e),e.submit()}});class Qt extends Jt{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.src=this.hasAttribute("src")?this.getAttribute("src"):null;this.shadowRoot.innerHTML="\n \n \n "}perform(){const{children:e}=this;if(this.src){this.innerHTML="",console.log("### fx-script.perform ");const e=document.createElement("script");e.src=this.src,this.appendChild(e)}else Array.from(e).forEach(e=>{e.detail=this.detail,e.execute()})}}window.customElements.define("fx-action",Qt);window.customElements.define("fx-toggle",class extends Qt{connectedCallback(){this.hasAttribute("case")&&(this.case=this.getAttribute("case"))}execute(){if(console.log("### fx-toggle.execute "),this.case){const e=this.getOwnerForm().querySelector("#"+this.case);e.parentNode.toggle(e)}}});window.customElements.define("fx-dispatch",class extends Jt{constructor(){super(),this.name=null,this.targetid=null,this.details=null,this.attachShadow({mode:"open"})}connectedCallback(){if(super.connectedCallback(),this.name=this.getAttribute("name"),!this.name)throw new Error("no event specified for dispatch",this);this.targetid=this.hasAttribute("targetid")?this.getAttribute("targetid"):null}perform(){console.log("### fx-dispatch.perform ",this);const e=this.querySelectorAll("fx-property"),t={};if(Array.from(e).forEach(e=>{console.log("prop ",e);const n=e.getAttribute("name"),r=e.getAttribute("value"),a=e.getAttribute("expr");if(a){if(r)throw new Error('if "expr" is given there must not be a "value" attribute');const e=_e(a,this.getInScopeContext(),this.getOwnerForm());let i=null;if(e.nodeName){i=(new XMLSerializer).serializeToString(e)}t[n]=i||e}r&&(t[n]=r)}),console.log("details ",t),this.targetid){const e=document.getElementById(this.targetid);if(!e)throw new Error(`targetid ${this.targetid} does not exist in document`);e.dispatchEvent(new CustomEvent(this.name,{composed:!0,bubbles:!0,detail:t}))}else document.dispatchEvent(new CustomEvent(this.name,{composed:!0,bubbles:!0,detail:t}))}});window.customElements.define("fx-update",class extends Jt{perform(){this.getModel().updateModel()}});window.customElements.define("fx-refresh",class extends Jt{perform(){this.getOwnerForm().refresh()}});window.customElements.define("fx-confirm",class extends Qt{connectedCallback(){this.message=this.hasAttribute("message")?this.getAttribute("message"):null}perform(){window.confirm(this.message)&&super.perform()}});class Kt extends(nt(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.style.display="none",this.signature=this.hasAttribute("signature")?this.getAttribute("signature"):null,null===this.signature&&console.error("signature is a required attribute"),this.type=this.hasAttribute("type")?this.getAttribute("type"):null,this.shadowRoot.innerHTML="",this.override=this.hasAttribute("override")?this.getAttribute("override"):"true",this.functionBody=this.innerText;const e=this.getAttribute("type")||"text/xpath",t=this.signature.match(/(?:(?[^:]*):)?(?[^(]+)\((?(?:\(\)|[^)])*)\)(?: as (?.*))?/);if(!t)throw new Error(`Function signature ${this.signature} could not be parsed`);const{prefix:n,localName:r,params:a,returnType:i}=t.groups,o="local"===n?{namespaceURI:"http://www.w3.org/2005/xquery-local-functions",localName:r}:`${n}:${r}`,s=a?a.split(",").map(e=>{const t=e.match(/(?\$[^\s]+)(?:\sas\s(?.+))/);if(!t)throw new Error(`Param ${e} could not be parsed`);const{variableName:n,varType:r}=t.groups;return{variableName:n,variableType:r||"item()*"}}):[];switch(e){case"text/javascript":{const e=new Function("_domFacade",...s.map(e=>e.variableName),"form",this.functionBody);De(o,s.map(e=>e.variableType),i||"item()*",(...t)=>e.apply(this.getInScopeContext(),[...t,this.getOwnerForm()]));break}case"text/xpath":{const e=(e,...t)=>_e(this.functionBody,this.getInScopeContext(),this.getOwnerForm(),s.reduce((e,n,r)=>(e[n.variableName.replace("$","")]=t[r],e),{}));De(o,s.map(e=>e.variableType),i||"item()*",e);break}default:throw new Error(`Unexpected mimetype ${e} for function`)}}}customElements.define("fx-function",Kt); -//# sourceMappingURL=fore-debug.js.map diff --git a/src/js/fore-debug.js.map b/src/js/fore-debug.js.map deleted file mode 100644 index d56cde0..0000000 --- a/src/js/fore-debug.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fore-debug.js","sources":["../node_modules/whynot/dist/whynot.esm.js","../node_modules/xspattern/dist/xspattern.esm.js","../node_modules/fontoxpath/dist/fontoxpath.esm.js","../src/DependencyNotifyingDomFacade.js","../src/xpath-util.js","../src/dep_graph.js","../src/fore.js","../src/xpath-evaluation.js","../src/fx-instance.js","../src/modelitem.js","../src/fx-model.js","../src/getInScopeContext.js","../src/ForeElementMixin.js","../src/fx-bind.js","../node_modules/toastify-js/src/toastify-es.js","../node_modules/@jinntec/jinn-toast/src/JinnToast.js","../src/fx-fore.js","../src/fx-submission.js","../src/fx-header.js","../node_modules/lit-html/lib/dom.js","../node_modules/lit-html/lib/template.js","../node_modules/lit-html/lib/directive.js","../node_modules/lit-html/lib/part.js","../node_modules/lit-html/lib/template-instance.js","../node_modules/lit-html/lib/template-result.js","../node_modules/lit-html/lib/parts.js","../node_modules/lit-html/lib/default-template-processor.js","../node_modules/lit-html/lit-html.js","../node_modules/lit-html/lib/shady-render.js","../node_modules/lit-element/lib/updating-element.js","../node_modules/lit-element/lib/css-tag.js","../node_modules/lit-element/lit-element.js","../src/ui/abstract-control.js","../src/ui/fx-alert.js","../src/ui/fx-control.js","../src/ui/fx-container.js","../src/ui/fx-group.js","../src/ui/fx-hint.js","../src/ui/fx-output.js","../src/ui/fx-repeatitem.js","../src/ui/fx-repeat.js","../src/ui/fx-switch.js","../src/ui/fx-trigger.js","../src/ui/fx-case.js","../src/actions/abstract-action.js","../src/actions/fx-append.js","../src/actions/fx-delete.js","../src/actions/fx-insert.js","../src/actions/fx-message.js","../src/actions/fx-setvalue.js","../src/actions/fx-send.js","../src/actions/fx-action.js","../src/actions/fx-toggle.js","../src/actions/fx-dispatch.js","../src/actions/fx-update.js","../src/actions/fx-refresh.js","../src/actions/fx-confirm.js","../src/functions/fx-function.js"],"sourcesContent":["function t(t,s,r,i){const n={op:s,func:r,data:i};return t.push(n),n}function s(t,s){return t}class r{constructor(){this.program=[]}test(s,r){return t(this.program,5,s,void 0===r?null:r)}jump(s){return t(this.program,3,null,s)}record(r,i){return t(this.program,4,void 0===i?s:i,r)}bad(s=1){return t(this.program,1,null,s)}accept(){return t(this.program,0,null,null)}fail(s){return t(this.program,2,s||null,null)}}class i{constructor(t,s,r){this.programLength=t,this.maxFromByPc=s,this.maxSurvivorFromByPc=r}static fromProgram(t){const s=t.length,r=[],n=[];return t.forEach((t=>{r.push(0),n.push(0)})),t.forEach(((t,i)=>{switch(t.op){case 2:if(null===t.func)return;if(i+1>=s)throw new Error(\"Invalid program: program could run past end\");r[i+1]+=1;break;case 1:case 4:if(i+1>=s)throw new Error(\"Invalid program: program could run past end\");r[i+1]+=1;break;case 3:t.data.forEach((t=>{if(t<0||t>=s)throw new Error(\"Invalid program: program could run past end\");r[t]+=1}));break;case 5:if(i+1>=s)throw new Error(\"Invalid program: program could run past end\");n[i+1]+=1;break;case 0:n[i]+=1}})),new i(s,r,n)}static createStub(t){const s=[],r=[];for(let i=0;i0}}class h{constructor(t){this.t=0,this.i=0,this.h=new Uint16Array(t),this.l=new Uint8Array(t)}getBadness(t){return this.l[t]}add(t,s){this.l[t]=s>255?255:s;const r=function(t,s,r,i,n){let h=i,e=n;for(;h>>1;r255?255:s);if(this.l[t]!==r){const s=this.h.indexOf(t,this.i);if(s<0||s>=this.t)return void(this.l[t]=r);this.h.copyWithin(s,s+1,this.t),this.t-=1,this.add(t,r)}}getNextPc(){return this.i>=this.t?null:this.h[this.i++]}reset(){this.t=0,this.i=0,this.l.fill(0)}}class e{constructor(t){this.o=[];let s=t.length;t.forEach((t=>{this.o.push(t>0?s:-1),s+=t})),this.u=new Uint16Array(s)}clear(){this.u.fill(0,0,this.o.length)}add(t,s){const r=this.u[s],i=this.o[s];this.u[s]+=1,this.u[i+r]=t}has(t){return this.u[t]>0}forEach(t,s){const r=this.u[t],i=this.o[t];for(let t=i;t{const r=this.trace(s,i,n,h);var c,o,u;o=r,u=e,t=null===(c=t)?o:null===o?c:Array.isArray(o)?o.reduce(((t,s)=>l(t,s,t===o)),c):l(c,o,u),e=t===r})),t}trace(t,s,r,i){switch(this.p[t]){case 2:return this.v[t];case 1:return null}this.p[t]=1;let n=null;const h=s[t];if(null!==h)n=h;else if(!r.has(t))throw new Error(`Trace without source at pc ${t}`);if(n=this.mergeTraces(n,t,r,s,r,i),null!==n){const s=i[t];null!==s&&(n=o(n,s))}return this.v[t]=n,this.p[t]=2,n}buildSurvivorTraces(t,s,r,i,n){for(let h=0,e=t.length;hl(t,this.k[s])),null);return null===s?[]:Array.isArray(s)?s:[s]}}class f{constructor(t){this.I=[],this.N=new h(t.programLength),this.M=new h(t.programLength),this.P=new a(t)}reset(){this.N.reset(),this.N.add(0,0),this.I.length=0,this.P.reset(!0)}getNextThreadPc(){return this.N.getNextPc()}step(t,s,r){const i=this.P.has(s);this.P.add(t,s);const n=this.N.getBadness(t)+r;i?this.N.reschedule(s,n):this.N.add(s,n)}stepToNextGeneration(t,s){const r=this.P.hasSurvivor(s);this.P.addSurvivor(t,s);const i=this.N.getBadness(t);r?this.M.reschedule(s,i):this.M.add(s,i)}accept(t){this.I.push(t),this.P.addSurvivor(t,t)}fail(t){}record(t,s){this.P.record(t,s)}nextGeneration(){this.P.buildSurvivorTraces(),this.P.reset(!1);const t=this.N;t.reset(),this.N=this.M,this.M=t}getAcceptingTraces(){return this.P.getTraces(this.I)}}class d{constructor(t){this.U=[],this.G=t,this.V=i.fromProgram(t),this.U.push(new f(this.V))}execute(t,s){const r=this.U.pop()||new f(this.V);r.reset();const i=t.length;let h,e=-1;do{let n=r.getNextThreadPc();if(null===n)break;for(++e,h=e>=i?null:t[e];null!==n;){const t=this.G[n];switch(t.op){case 0:null===h?r.accept(n):r.fail(n);break;case 2:{const i=t.func;if(null===i||i(s)){r.fail(n);break}r.step(n,n+1,0);break}case 1:r.step(n,n+1,t.data);break;case 5:if(null===h){r.fail(n);break}if(!(0,t.func)(h,t.data,s)){r.fail(n);break}r.stepToNextGeneration(n,n+1);break;case 3:{const s=t.data,i=s.length;if(0===i){r.fail(n);break}for(let t=0;tB===A}function a(A,B){if(null===A||null===B)throw new Error(\"unescaped hyphen may not be used as a range endpoint\");if(BA<=a&&a<=B}function n(A){return!0}function e(){return!1}function t(A,B){return a=>A(a)||B(a)}function G(A,B){switch(B.kind){case\"predicate\":return void A.test(B.value);case\"regexp\":return void r(A,B.value,!1)}}function i(A,B){B.forEach((B=>{!function(A,B){const[a,{min:n,max:e}]=B;if(null!==e){for(let B=0;B0){for(let B=0;B!0)),A.jump([n]));const t=[];if(B.forEach((B=>{e.data.push(A.program.length),i(A,B),t.push(A.jump([]))})),t.forEach((B=>{B.data.push(A.program.length)})),a){const B=A.program.length,a=A.jump([]);a.data.push(A.program.length),A.test((()=>!0)),A.jump([B]),a.data.push(A.program.length)}}function o(A,B){return{success:!0,offset:A,value:B}}function l(A){return o(A,void 0)}function H(A,B,a=!1){return{success:!1,offset:A,expected:B,fatal:a}}function u(A){return(B,a)=>{const n=a+A.length;return B.slice(a,n)===A?o(n,A):H(a,[A])}}function C(A,B){return(a,n)=>{const e=A(a,n);return e.success?o(e.offset,B(e.value)):e}}function s(A,B,a){return(n,e)=>{const t=A(n,e);return t.success?B(t.value)?t:H(e,a):t.offset===e?H(e,a):t}}function c(A){return(B,a)=>{let n=null;for(const e of A){const A=e(B,a);if(A.success)return A;if(null===n||A.offset>n.offset?n=A:A.offset===n.offset&&(n.expected=n.expected.concat(A.expected)),A.fatal)break}return n||H(a,[])}}function D(A){return(B,a)=>{const n=A(B,a);return n.success||n.fatal?n:o(a,null)}}function m(A){return(B,a)=>{let n=[],e=a;for(;;){const a=A(B,e);if(!a.success){if(a.fatal)return a;break}n.push(a.value),e=a.offset}return o(e,n)}}function h(A,B,a){return(n,e)=>{const t=A(n,e);if(!t.success)return t;const G=B(n,t.offset);return G.success?o(G.offset,a(t.value,G.value)):G}}function I(A){return h(A,m(A),((A,B)=>[A].concat(B)))}function d(A,B){return A}function T(A,B){return B}function p(A,B){return h(A,B,T)}function E(A,B){return h(A,B,d)}function f(A,B,a,n=!1){return p(A,n?F(E(B,a)):E(B,a))}function g(A,B){return(a,n)=>A(a,n).success?H(n,B):l(n)}function F(A){return(B,a)=>{const n=A(B,a);return n.success?n:H(n.offset,n.expected,!0)}}const P=(A,B)=>A.length===B?l(B):H(B,[\"end of input\"]);const M=[\"Lu\",\"Ll\",\"Lt\",\"Lm\",\"Lo\",\"Mn\",\"Mc\",\"Me\",\"Nd\",\"Nl\",\"No\",\"Pc\",\"Pd\",\"Ps\",\"Pe\",\"Pi\",\"Pf\",\"Po\",\"Zs\",\"Zl\",\"Zp\",\"Sm\",\"Sc\",\"Sk\",\"So\",\"Cc\",\"Cf\",\"Co\",\"Cn\"],J={};function S(A){return A.codePointAt(0)}\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\".split(\"\").forEach(((A,B)=>{J[A]=B}));const K=A=>-1===A||-2===A;function b(A){return B=>!K(B)&&!A(B)}function y(A,B){return null===B?A:a=>A(a)&&!B(a)}const Q=function(A,B){const n=new Map;let e=0;return A.forEach(((A,G)=>{const i=B[G];null!==A&&A.split(\"|\").forEach((A=>{const B=n.get(A),G=a(e,e+i-1);n.set(A,B?t(B,G):G)})),e+=i})),n}([\"BasicLatin\",\"Latin-1Supplement\",\"LatinExtended-A\",\"LatinExtended-B\",\"IPAExtensions\",\"SpacingModifierLetters\",\"CombiningDiacriticalMarks\",\"GreekandCoptic|Greek\",\"Cyrillic\",\"CyrillicSupplement\",\"Armenian\",\"Hebrew\",\"Arabic\",\"Syriac\",\"ArabicSupplement\",\"Thaana\",\"NKo\",\"Samaritan\",\"Mandaic\",\"SyriacSupplement\",null,\"ArabicExtended-A\",\"Devanagari\",\"Bengali\",\"Gurmukhi\",\"Gujarati\",\"Oriya\",\"Tamil\",\"Telugu\",\"Kannada\",\"Malayalam\",\"Sinhala\",\"Thai\",\"Lao\",\"Tibetan\",\"Myanmar\",\"Georgian\",\"HangulJamo\",\"Ethiopic\",\"EthiopicSupplement\",\"Cherokee\",\"UnifiedCanadianAboriginalSyllabics\",\"Ogham\",\"Runic\",\"Tagalog\",\"Hanunoo\",\"Buhid\",\"Tagbanwa\",\"Khmer\",\"Mongolian\",\"UnifiedCanadianAboriginalSyllabicsExtended\",\"Limbu\",\"TaiLe\",\"NewTaiLue\",\"KhmerSymbols\",\"Buginese\",\"TaiTham\",\"CombiningDiacriticalMarksExtended\",\"Balinese\",\"Sundanese\",\"Batak\",\"Lepcha\",\"OlChiki\",\"CyrillicExtended-C\",\"GeorgianExtended\",\"SundaneseSupplement\",\"VedicExtensions\",\"PhoneticExtensions\",\"PhoneticExtensionsSupplement\",\"CombiningDiacriticalMarksSupplement\",\"LatinExtendedAdditional\",\"GreekExtended\",\"GeneralPunctuation\",\"SuperscriptsandSubscripts\",\"CurrencySymbols\",\"CombiningDiacriticalMarksforSymbols|CombiningMarksforSymbols\",\"LetterlikeSymbols\",\"NumberForms\",\"Arrows\",\"MathematicalOperators\",\"MiscellaneousTechnical\",\"ControlPictures\",\"OpticalCharacterRecognition\",\"EnclosedAlphanumerics\",\"BoxDrawing\",\"BlockElements\",\"GeometricShapes\",\"MiscellaneousSymbols\",\"Dingbats\",\"MiscellaneousMathematicalSymbols-A\",\"SupplementalArrows-A\",\"BraillePatterns\",\"SupplementalArrows-B\",\"MiscellaneousMathematicalSymbols-B\",\"SupplementalMathematicalOperators\",\"MiscellaneousSymbolsandArrows\",\"Glagolitic\",\"LatinExtended-C\",\"Coptic\",\"GeorgianSupplement\",\"Tifinagh\",\"EthiopicExtended\",\"CyrillicExtended-A\",\"SupplementalPunctuation\",\"CJKRadicalsSupplement\",\"KangxiRadicals\",null,\"IdeographicDescriptionCharacters\",\"CJKSymbolsandPunctuation\",\"Hiragana\",\"Katakana\",\"Bopomofo\",\"HangulCompatibilityJamo\",\"Kanbun\",\"BopomofoExtended\",\"CJKStrokes\",\"KatakanaPhoneticExtensions\",\"EnclosedCJKLettersandMonths\",\"CJKCompatibility\",\"CJKUnifiedIdeographsExtensionA\",\"YijingHexagramSymbols\",\"CJKUnifiedIdeographs\",\"YiSyllables\",\"YiRadicals\",\"Lisu\",\"Vai\",\"CyrillicExtended-B\",\"Bamum\",\"ModifierToneLetters\",\"LatinExtended-D\",\"SylotiNagri\",\"CommonIndicNumberForms\",\"Phags-pa\",\"Saurashtra\",\"DevanagariExtended\",\"KayahLi\",\"Rejang\",\"HangulJamoExtended-A\",\"Javanese\",\"MyanmarExtended-B\",\"Cham\",\"MyanmarExtended-A\",\"TaiViet\",\"MeeteiMayekExtensions\",\"EthiopicExtended-A\",\"LatinExtended-E\",\"CherokeeSupplement\",\"MeeteiMayek\",\"HangulSyllables\",\"HangulJamoExtended-B\",\"HighSurrogates\",\"HighPrivateUseSurrogates\",\"LowSurrogates\",\"PrivateUseArea|PrivateUse\",\"CJKCompatibilityIdeographs\",\"AlphabeticPresentationForms\",\"ArabicPresentationForms-A\",\"VariationSelectors\",\"VerticalForms\",\"CombiningHalfMarks\",\"CJKCompatibilityForms\",\"SmallFormVariants\",\"ArabicPresentationForms-B\",\"HalfwidthandFullwidthForms\",\"Specials\",\"LinearBSyllabary\",\"LinearBIdeograms\",\"AegeanNumbers\",\"AncientGreekNumbers\",\"AncientSymbols\",\"PhaistosDisc\",null,\"Lycian\",\"Carian\",\"CopticEpactNumbers\",\"OldItalic\",\"Gothic\",\"OldPermic\",\"Ugaritic\",\"OldPersian\",null,\"Deseret\",\"Shavian\",\"Osmanya\",\"Osage\",\"Elbasan\",\"CaucasianAlbanian\",null,\"LinearA\",null,\"CypriotSyllabary\",\"ImperialAramaic\",\"Palmyrene\",\"Nabataean\",null,\"Hatran\",\"Phoenician\",\"Lydian\",null,\"MeroiticHieroglyphs\",\"MeroiticCursive\",\"Kharoshthi\",\"OldSouthArabian\",\"OldNorthArabian\",null,\"Manichaean\",\"Avestan\",\"InscriptionalParthian\",\"InscriptionalPahlavi\",\"PsalterPahlavi\",null,\"OldTurkic\",null,\"OldHungarian\",\"HanifiRohingya\",null,\"RumiNumeralSymbols\",null,\"OldSogdian\",\"Sogdian\",null,\"Elymaic\",\"Brahmi\",\"Kaithi\",\"SoraSompeng\",\"Chakma\",\"Mahajani\",\"Sharada\",\"SinhalaArchaicNumbers\",\"Khojki\",null,\"Multani\",\"Khudawadi\",\"Grantha\",null,\"Newa\",\"Tirhuta\",null,\"Siddham\",\"Modi\",\"MongolianSupplement\",\"Takri\",null,\"Ahom\",null,\"Dogra\",null,\"WarangCiti\",null,\"Nandinagari\",\"ZanabazarSquare\",\"Soyombo\",null,\"PauCinHau\",null,\"Bhaiksuki\",\"Marchen\",null,\"MasaramGondi\",\"GunjalaGondi\",null,\"Makasar\",null,\"TamilSupplement\",\"Cuneiform\",\"CuneiformNumbersandPunctuation\",\"EarlyDynasticCuneiform\",null,\"EgyptianHieroglyphs\",\"EgyptianHieroglyphFormatControls\",null,\"AnatolianHieroglyphs\",null,\"BamumSupplement\",\"Mro\",null,\"BassaVah\",\"PahawhHmong\",null,\"Medefaidrin\",null,\"Miao\",null,\"IdeographicSymbolsandPunctuation\",\"Tangut\",\"TangutComponents\",null,\"KanaSupplement\",\"KanaExtended-A\",\"SmallKanaExtension\",\"Nushu\",null,\"Duployan\",\"ShorthandFormatControls\",null,\"ByzantineMusicalSymbols\",\"MusicalSymbols\",\"AncientGreekMusicalNotation\",null,\"MayanNumerals\",\"TaiXuanJingSymbols\",\"CountingRodNumerals\",null,\"MathematicalAlphanumericSymbols\",\"SuttonSignWriting\",null,\"GlagoliticSupplement\",null,\"NyiakengPuachueHmong\",null,\"Wancho\",null,\"MendeKikakui\",null,\"Adlam\",null,\"IndicSiyaqNumbers\",null,\"OttomanSiyaqNumbers\",null,\"ArabicMathematicalAlphabeticSymbols\",null,\"MahjongTiles\",\"DominoTiles\",\"PlayingCards\",\"EnclosedAlphanumericSupplement\",\"EnclosedIdeographicSupplement\",\"MiscellaneousSymbolsandPictographs\",\"Emoticons\",\"OrnamentalDingbats\",\"TransportandMapSymbols\",\"AlchemicalSymbols\",\"GeometricShapesExtended\",\"SupplementalArrows-C\",\"SupplementalSymbolsandPictographs\",\"ChessSymbols\",\"SymbolsandPictographsExtended-A\",null,\"CJKUnifiedIdeographsExtensionB\",null,\"CJKUnifiedIdeographsExtensionC\",\"CJKUnifiedIdeographsExtensionD\",\"CJKUnifiedIdeographsExtensionE\",\"CJKUnifiedIdeographsExtensionF\",null,\"CJKCompatibilityIdeographsSupplement\",null,\"Tags\",null,\"VariationSelectorsSupplement\",null,\"SupplementaryPrivateUseArea-A|PrivateUse\",\"SupplementaryPrivateUseArea-B|PrivateUse\"],[128,128,128,208,96,80,112,144,256,48,96,112,256,80,48,64,64,64,32,16,48,96,128,128,128,128,128,128,128,128,128,128,128,128,256,160,96,256,384,32,96,640,32,96,32,32,32,32,128,176,80,80,48,96,32,32,144,80,128,64,64,80,48,16,48,16,48,128,64,64,256,256,112,48,48,48,80,64,112,256,256,64,32,160,128,32,96,256,192,48,16,256,128,128,256,256,96,32,128,48,80,96,32,128,128,224,16,16,64,96,96,48,96,16,32,48,16,256,256,6592,64,20992,1168,64,48,320,96,96,32,224,48,16,64,96,32,48,48,32,96,32,96,32,96,32,48,64,80,64,11184,80,896,128,1024,6400,512,80,688,16,16,16,32,32,144,240,16,128,128,64,80,64,48,128,32,64,32,48,32,48,32,64,32,80,48,48,80,48,64,144,384,128,64,32,32,48,48,32,32,32,64,32,96,96,32,32,32,64,64,32,32,48,80,80,48,128,64,288,32,128,48,64,112,32,128,80,48,80,48,96,32,80,48,48,80,128,128,128,96,160,128,96,32,80,48,64,192,80,80,96,160,96,80,96,16,64,256,112,80,64,96,80,304,32,192,64,1024,128,208,2736,1072,16,4032,640,8576,576,48,96,48,144,688,96,96,160,64,32,6144,768,9472,256,48,64,400,2304,160,16,4944,256,256,80,144,32,96,32,128,1024,688,1360,48,208,80,368,64,1280,224,32,96,784,80,64,80,176,256,256,48,112,96,256,256,768,80,48,128,128,128,256,256,112,144,1280,42720,32,4160,224,5776,7488,3088,544,722400,128,128,240,65040,65536,65536]),x=function(A){const n=new Map,G=A.split(\"\"),i=M.map((()=>[]));let r=0,o=0;for(;o{const a=i[B].reduce(t,e);n.set(A,a);const G=A.charAt(0),r=l.get(G)||[];l.set(G,r),r.push(a)})),l.forEach(((A,B)=>{n.set(B,A.reduce(t,e))})),n}(\"bfUATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAbgUATAYDaATAZAaAGARAXAcAaAZAaAXAMBZADATBZAMAGASAMCTACWXACGDXXADHA3DAAPDAAtCAAFDBCAADCAABCCDBCCABCAABCCDCCAABCAAFCAADDAABCAABCBADCBDBGACADCGDCAEADACAEADACAEADAAPDAARDACAEADAABCBA7DFCAABCBDBABCCAJjDBAAGADaFRZDFLZNFEZGFAZAFAZQnvBAAADFAZACADABBFADCTACABDZBCATACCBACABACAABCQBACIDiCADBCCDCAXDDCADAXAABCBDBCyDvAhaAHEJBA1CAANDAgfBAABAClBBFATFDoTAOABBaBYABAHsOAHATAHBTAHBTAHABHGaBDGDTBBKcFXCTBYATBaBHKTAcABATBGfFAGJHUKJTDGBHAmiBAATAGAHGcAaAHFFBHBaAHDGBKJGCaBGATNBAcAGAHAGdHaBBmYBAAHKGABNKJGgHIFBaATCFABBHAYBGVHDFAHIFAHCFAHEBBTOBAGYHCBBTABAGKB0GUBAGHBUHOcAHfIAG1HAIAHAGAICHHIDHAIBGAHGGJHBTBKJTAFAGOHAIBBAGHBBGBBBGVBAGGBAGABCGDBBHAGAICHDBBIBBBIBHAGABHIABDGBBAGCHBBBKJGBYBMFaAYAGATAHABBHBIABAGFBDGBBBGVBAGGBAGBBAGBBAGBBBHABAICHBBDHBBBHCBCHABGGDBAGABGKJHBGCHATABJHBIABAGIBAGCBAGVBAGGBAGBBAGEBBHAGAICHEBAHBIABAIBHABBGABOGBHBBBKJTAYABGGAHFBAHAIBBAGHBBGBBBGVBAGGBAGBBAGEBBHAGAIAHAIAHDBBIBBBIBHABHHAIABDGBBAGCHBBBKJaAGAMFBJHAGABAGFBCGCBAGDBCGBBAGABAGBBCGBBCGCBCGLBDIBHAIBBCICBAICHABBGABFIABNKJMCaFYAaABEHAICHAGHBAGCBAGWBAGPBCGAHCIDBAHCBAHDBGHBBAGCBEGBHBBBKJBGTAMGaAGAHAIBTAGHBAGCBAGWBAGJBAGEBBHAGAIAHAIEBAHAIBBAIBHBBGIBBGGABAGBHBBBKJBAGBBMHBIBBAGHBAGCBAGoHBGAICHDBAICBAICHAGAaABDGCIAMGGCHBBBKJMIaAGFBBIBBAGRBCGXBAGIBAGABBGGBCHABDICHCBAHABAIHBFKJBBIBTABLGvHAGBHGBDYAGFFAHHTAKJTBBkGBBAGABAGEBAGXBAGABAGJHAGBHIGABBGEBAFABAHFBBKJBBGDBfGAaCTOaATAaCHBaFKJMJaAHAaAHAaAHAPAQAPAQAIBGHBAGjBDHNIAHETAHBGEHKBAHjBAaHHAaFBAaBTEaDTBBkGqIBHDIAHFIAHBIBHBGAKJTFGFIBHBGDHCGAICGBIGGCHDGMHAIBHBIFHAGAIAKJICHAaBClBACABECABBDqTAFADCmIFAABAGDBBGGBAGABAGDBBGoBAGDBBGgBAGDBBGGBAGABAGDBBGOBAG4BAGDBBmCBAABBHCTIMTBCGPaJBFiVBAABBDFBBOAmrJAAaATAGQUAGZPAQABCmKBAATCLCGHBGGMBAGDHCBKGRHCTBBIGRHBBLGMBAGCBAHBBLGzHBIAHGIHHAIBHKTCFATCYAGAHABBKJBFMJBFTFOATDHCcABAKJBFGiFAG0BGGEHBGhHAGABEmFBAABJGeBAHCIDHBICBDIBHAIFHCBDaABCTBKJGdBBGEBKGrBDGZBFKJMABCahGWHBIBHABBTBG0IAHAIAHGBAHAIAHAIBHHIFHJBBHAKJBFKJBFTGFATFBBHNJAhABAAHDIAGuHAIAHEIAHAIEHAIBGGBDKJTGaJHIaIBCHBIAGdIAHDIBHBIAHCGBKJGrHAIAHBICHAIAHCIBBHTDGjIHHHIBHBBCTEKJBCGCKJGdFFTBDIBGCqBBCCTHBHHCTAHMIAHGGDHAGFHAGBIAHBGABEDrF+DMFADhFkH5BAHEgVCAADHghBAADHCHDFBBCFBBDHCHDHCHDFBBCFBBDHBACABACABACABACADHCHDNBBDHEHDHEHDHEHDEBADBCDEAZADAZCDCBADBCDEAZCDDBBDBCDBAZCDHCEZCBBDCBADBCDEAZBBAUKcEOFTBRASAPARBSAPARATHVAWAcEUATIRASATDNBTCXAPAQATKXATANATJUAcEBAcJMAFABBMFXCPAQAFAMJXCPAQABAFMBCYfBPHMJDHAJCHLBOaBCAaDCAaBDACCDBCCDAaACAaBXACEaFCAaACAaACAaACDaADACDDAGDDAaBDBCBXECADDaAXAaBDAaAMPLiCADALDMAaBBDXEaEXBaDXAaBXAaBXAaGXAaeXBaBXAaAXAae3LEAAaHPAQAPAQAaTXBaGPAQA6QBAAXAadXYanXF6EBAABYaKBUM76NBAAMV62CAAXAaIXAa1XH6uBAAXA63DAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAMdarXEPAQAXePAQAPAQAPAQAPAQAPAQAXP6/DAA3CCAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAX+PAQAPAQAXfPAQA3BEAAavXUaBXFamBBafBB6nBAACuBADuBAABCCDBAFCCADDACADFFBCBgjBAADAaFADHCCADABETDMATBDlBADABEDABBG3BGFATABNHAGWBIGGBAGGBAGGBAGGBAGGBAGGBAGGBAGGBAHfTBRASARASATCRASATARASATIOATBOATARASATBRASAPAQAPAQAPAQAPAQATEFATJOBTDOATAPATMBvaZBA6YBAABL6VDAABZaLBDUATCaAFAGALAPAQAPAQAPAQAPAQAPAQAaBPAQAPAQAPAQAPAQAOAPAQBaALIHDIBOAFEaBLCFAGATAaBBAmVBAABBHBZBFBGAOAmZBAATAFCGABEGqBAmdBAABAaBMDaJGaBEajBLGPaeBAMJadMHaAMOafMJamMO6/EAAm1mBABJa/mvHFABPGUFAm2RAABCa2BIGnFFTBmLEAAFATCGPKJGBBTAtGAHAJCTAHJTAFAAbFBHBmFBAALJHBTFBHZWFIZBANDBA9FADHADCAAJFAZBADGAADDBATCDABCDALBBABCCBvGAFBDAGGHAGCHAGDHAGWIBHBIAaDBDMFaBYAaABFGzTDBHIBGxIPHBBHTBKJBFHRGFTCGATAGBHAKJGbHHTBGWHKIBBKTAGcBCHCIAGuHAIBHDIBHBICTMBAFAKJBDTBGEHAFAGIKJGEBAGoHFIBHBIBHBBIGCHAGHHAIABBKJBBTDGPFAGFaCGAIAHAIAGxHAGAHCGBHBGEHBGAHAGABXGBFATBGKIAHBIBTBGAFBIAHABJGFBBGFBBGFBIGGBAGGBADqZAFDDHBHjPBAAGiIBHAIBHAIBTAIAHABBKJBFmjuCABLGWBDGwhDgAA9/jBAmtFAABBmpBAABlDGBLDEBEGAHAGJXAGMBAGEBAGABAGBBAGBBAmrBAAZPBQmqFAAQAPABPG/BBG1BnGLYAaABBHPTGPAQATABFHPTAOBNBPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQATBPAQATDNCTCBATDOAPAQAPAQAPAQATCXAOAXCBATAYATBBDGEBAmGCAABBcABATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAPAQATAPAQATBGJFAGsFBGeBCGFBBGFBBGFBBGCBCYBXAZAaAYBBAaAXDaBBJcCaBBBGLBAGZBAGSBAGBBAGOBBGNBhm6BAABETCBDMsBCaIL0MDaQMBaCBAaLBDaABuasHAhBCAAGcBCGwBOHAMaBDGfMDBIGTLAGHLABEGlHEBEGdBATAGjBDGHTALEBpCnDnmNBAABBKJBFCjBDDjBDGnBHGzBKTAhPCAAm2EAABIGVBJGHhXCAAGFBBGABAGrBAGBBCGABBGWBATAMHGWaBMGGeBHMIBvGSBAGBBEMEGVMFBCTAGZBETAB/G3BDMBGBMPBBMtGAHCBAHBBEHDGDBAGCBAGcBBHCBDHAMIBGTIBGGcMBTAGcMCBfGHaAGbHBBDMETGBIG1BCTGGVBBMHGSBEMHGRBGTDBLMGhPBAAmIBAAB2CyBMDyBGMFGjHDBHKJhlEAAMehACAAGcMJGABHGVHKMDTEhFCAAGWBIIAHAIAG0HOTGBDMTKJBOHCIAGsICHDIBHBTBcATDBKcABBGYBGKJBFHCGjHEIAHHBAKJTDGAIBBIGiHATBGABIHBIAGvICHIIBGDTDHDTABBKJGATAGATCBAMTBKGRBAGYICHCIBHAIAHBTFHAhABAAGGBAGABAGDBAGOBAGJTABFGuHAICHHBEKJBFHBIBBAGHBBGBBBGVBAGGBAGBBAGEBAHBGAIBHAIDBBIBBBICBBGABFIABEGEIBBBHGBCHEhKCAAG0ICHHIBHCIAHAGDTEKJBATABATAHAGABfGvICHFIAHAIDHBIAHBGBTAGABHKJhlCAAGuICHDBBIDHBIAHBTWGDHBBhGvICHHIBHAIAHBTCGABKKJBFTMBSGqHAIAHAIBHFIAHAGABGKJB1GaBBHCIBHDIAHEBDKJMBTCaAh/CAAGrICHIIAHBTAhjBAACfDfKJMIBLGAhfCAAGHBBGmICHDBBHBIDHAGATAGAIABaGAHJGnHFIAGAHDTHHABHGAHFIBHCGtHMIAHBTCGATEBcG4hGEAAGIBAGkIAHGBAHFIAHAGATEBJKJMSBCTBGdBBHVBAIAHGIAHBIAHBhIBAAGGBAGBBAGlHFBCHABAHBBAHGGAHABHKJBFGFBAGBBAGfIEBAHBBAIBHAIAHAGABGKJh1EAAGSHBIBTBhGDAAMUaHYDaQBMTAmZOAAhlBAAruBAABATEBKmDDAAh7qAAmuQAABAcIhG/AAmGJAAh4GCAm4IAABGGeBAKJBDTBhfBAAGdBBHETABJGvHGTEaDFDTAaABJKJBAMGBAGUBEGShvKAACfDfMWTDhkBAAmKBAABDHAGAI2BGHDFMB/FBTAFABbm3fBABHmyLAAhMUCAmeEAABwGCBQGDBHmLGAAhDkAAmqBAABEGMBCGIBGGJBBaAHBTAcDhbNBA61DAABJamBBa7IBHCaCIFcHHHaBHGadHDa6BW6BBAAHCaAhZCAAMTBL6WBAABIMYhGCAACZDZCZDGBADRCZDZCABACBBBCABBCBBBCDBACHDDBADABADGBADKCZDZCBBACDBBCHBACGBADZCBBACDBACEBACABCCGBADZCZDZCZDZCZDZCZDZCZDZCZDbBBCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCADABBKx6/HAAH2aDHxaHHAaNHAaBTEBOHEBAHOhPVAAHGBAHQBBHGBAHBBAHEhUDAAGsBCHGFGBBKJBDGAaAhvFAAGrHDKJBEYAh/TAAmEDAABBMIHGBoChDhHGFABDKJBDTBhQMAAM6aAMCYAMDhLBAAMsaAMOhBDAAGDBAGaBAGBBAGABBGABAGJBAGDBAGABAGABFGABDGABAGABAGABAGCBAGBBAGABBGABAGABAGABAGABAGABAGBBAGABBGDBAGGBAGDBAGDBAGABAGJBAGQBEGCBAGEBAGQBzXBhNEAAarBD6jBAABLaOBBaOBAaOBAakBJMMBC6cBAABCa8B4acBMarBDaIBGaBBNaFhZCAA66DAAZE6VLAABJaMBCaKBE6zBAABL6YBAABGaLBTaLBDa3BHaJBFanBHadhRBAAaLBA6kBAABAaDBCaoBBaFBCacBB6GCAABLaNBBaDBDaCBEaCBMaFhpVAAmWbKABom0ABABKmdDAABBmBaBABNmw0BAhewAAmdIAAhiXwCcABd8fBAAh/BAAnvDAAhP4PA99/PABB99/PA\");function L(A){return 32===A||9===A||10===A||13===A}const Z=[B(S(\":\")),a(S(\"A\"),S(\"Z\")),B(S(\"_\")),a(S(\"a\"),S(\"z\")),a(192,214),a(216,246),a(192,214),a(216,246),a(248,767),a(880,893),a(895,8191),a(8204,8205),a(8304,8591),a(11264,12271),a(12289,55295),a(63744,64975),a(65008,65533),a(65536,983039)].reduce(t),X=[Z,B(S(\"-\")),B(S(\".\")),a(S(\"0\"),S(\"9\")),B(183),a(768,879),a(8255,8256)].reduce(t),k=x.get(\"Nd\"),O=b(k),N=y(a(0,1114111),[x.get(\"P\"),x.get(\"Z\"),x.get(\"C\")].reduce(t)),v=b(N);function w(A){return 10!==A&&13!==A&&!K(A)}const Y={s:L,S:b(L),i:Z,I:b(Z),c:X,C:b(X),d:k,D:O,w:N,W:v},U=u(\"*\"),j=u(\"\\\\\"),R=u(\"{\"),V=u(\"}\"),W=u(\"[\"),q=u(\"]\"),$=u(\"^\"),z=u(\"$\"),_=u(\",\"),AA=u(\"-\"),BA=u(\"(\"),aA=u(\")\"),nA=u(\".\"),eA=u(\"|\"),tA=u(\"+\"),GA=u(\"?\"),iA=u(\"-[\"),rA=S(\"0\");function oA(A){function e(A){return new Set(A.split(\"\").map((A=>S(A))))}function G(A,B){const a=A.codePointAt(B);return void 0===a?H(B,[\"any character\"]):o(B+String.fromCodePoint(a).length,a)}const i=\"xpath\"===A.language?p(j,c([C(u(\"n\"),(()=>10)),C(u(\"r\"),(()=>13)),C(u(\"t\"),(()=>9)),C(c([j,eA,nA,AA,$,GA,U,tA,R,V,z,BA,aA,W,q]),(A=>S(A)))])):p(j,c([C(u(\"n\"),(()=>10)),C(u(\"r\"),(()=>13)),C(u(\"t\"),(()=>9)),C(c([j,eA,nA,AA,$,GA,U,tA,R,V,BA,aA,W,q]),(A=>S(A)))]));function r(A,B){const a=e(B);return h(u(A),D(s(G,(A=>a.has(A)),B.split(\"\"))),((A,B)=>function(A){const B=x.get(A);if(null==B)throw new Error(`${A} is not a valid unicode category`);return B}(null===B?A:A+String.fromCodePoint(B))))}const l=c([r(\"L\",\"ultmo\"),r(\"M\",\"nce\"),r(\"N\",\"dlo\"),r(\"P\",\"cdseifo\"),r(\"Z\",\"slp\"),r(\"S\",\"mcko\"),r(\"C\",\"cfon\")]),T=[a(S(\"a\"),S(\"z\")),a(S(\"A\"),S(\"Z\")),a(S(\"0\"),S(\"9\")),B(45)].reduce(t),M=c([l,C(p(u(\"Is\"),function(A){return(B,a)=>{const n=A(B,a);return n.success?o(n.offset,B.slice(a,n.offset)):n}}(I(s(G,T,[\"block identifier\"])))),(B=>function(A,B){const a=Q.get(A);if(void 0===a){if(B)return n;throw new Error(`The unicode block identifier \"${A}\" is not known.`)}return a}(B,\"xpath\"!==A.language)))]),J=f(u(\"\\\\p{\"),M,V,!0),K=C(f(u(\"\\\\P{\"),M,V,!0),b),L=p(j,C(c(\"sSiIcCdDwW\".split(\"\").map((A=>u(A)))),(A=>Y[A]))),Z=C(nA,(()=>w)),X=c([L,J,K]),k=e(\"\\\\[]\"),O=c([i,s(G,(A=>!k.has(A)),[\"unescaped character\"])]),N=c([C(AA,(()=>null)),O]),v=h(N,p(AA,N),a);function oA(A,B){return[A].concat(B||[])}const lA=C(function(A){return(B,a)=>{const n=A(B,a);return n.success?o(a,n.value):n}}(c([q,iA])),(()=>null)),HA=S(\"-\"),uA=c([C(E(E(AA,g(W,[\"not [\"])),lA),(()=>HA)),p(g(AA,[\"not -\"]),O)]),CA=c([h(C(uA,B),c([function(A,B){return CA(A,B)},lA]),oA),h(c([v,X]),c([cA,lA]),oA)]);const sA=c([h(C(O,B),c([CA,lA]),oA),h(c([v,X]),c([cA,lA]),oA)]);function cA(A,B){return sA(A,B)}const DA=C(sA,(A=>A.reduce(t))),mA=C(p($,DA),b),hA=h(c([p(g($,[\"not ^\"]),DA),mA]),D(p(AA,(function(A,B){return IA(A,B)}))),y),IA=f(W,hA,q,!0);const dA=\"xpath\"===A.language?c([C(i,B),X,IA,Z,C($,(()=>A=>-1===A)),C(z,(()=>A=>-2===A))]):c([C(i,B),X,IA,Z]),TA=\"xpath\"===A.language?e(\".\\\\?*+{}()|^$[]\"):e(\".\\\\?*+{}()|[]\"),pA=s(G,(A=>!TA.has(A)),[\"NormalChar\"]),EA=C(p(j,h(C(s(G,a(S(\"1\"),S(\"9\")),[\"digit\"]),(A=>A-rA)),m(C(s(G,a(rA,S(\"9\")),[\"digit\"]),(A=>A-rA))),((A,B)=>{B.reduce(((A,B)=>10*A+B),A)}))),(A=>{throw new Error(\"Backreferences in XPath patterns are not yet implemented.\")})),fA=\"xpath\"===A.language?c([C(pA,(A=>({kind:\"predicate\",value:B(A)}))),C(dA,(A=>({kind:\"predicate\",value:A}))),C(f(BA,p(D(u(\"?:\")),SA),aA,!0),(A=>({kind:\"regexp\",value:A}))),EA]):c([C(pA,(A=>({kind:\"predicate\",value:B(A)}))),C(dA,(A=>({kind:\"predicate\",value:A}))),C(f(BA,SA,aA,!0),(A=>({kind:\"regexp\",value:A})))]),gA=C(I(C(s(G,a(rA,S(\"9\")),[\"digit\"]),(A=>A-rA))),(A=>A.reduce(((A,B)=>10*A+B)))),FA=c([h(gA,p(_,gA),((A,B)=>{if(B({min:A,max:null}))),C(gA,(A=>({min:A,max:A})))]),PA=\"xpath\"===A.language?h(c([C(GA,(()=>({min:0,max:1}))),C(U,(()=>({min:0,max:null}))),C(tA,(()=>({min:1,max:null}))),f(R,FA,V,!0)]),D(GA),((A,B)=>A)):c([C(GA,(()=>({min:0,max:1}))),C(U,(()=>({min:0,max:null}))),C(tA,(()=>({min:1,max:null}))),f(R,FA,V,!0)]),MA=m(h(fA,C(D(PA),(A=>null===A?{min:1,max:1}:A)),((A,B)=>[A,B]))),JA=h(MA,m(p(eA,F(MA))),((A,B)=>[A].concat(B)));function SA(A,B){return JA(A,B)}const KA=function(A){return h(A,P,d)}(JA);return function(A){let B;try{B=KA(A,0)}catch(B){throw new Error(`Error parsing pattern \"${A}\": ${B.message}`)}return B.success?B.value:function(A,B,a){const n=a.map((A=>`\"${A}\"`));throw new Error(`Error parsing pattern \"${A}\" at offset ${B}: expected ${n.length>1?\"one of \"+n.join(\", \"):n[0]} but found \"${A.slice(B,B+1)}\"`)}(A,B.offset,B.expected)}}function lA(A){return[...A].map((A=>A.codePointAt(0)))}function HA(B,a={language:\"xsd\"}){const n=oA(a)(B),e=A((A=>{r(A,n,\"xpath\"===a.language),A.accept()}));return function(A){const B=\"xpath\"===a.language?[-1,...lA(A),-2]:lA(A);return e.execute(B).success}}export{HA as compile};\n//# sourceMappingURL=xspattern.esm.js.map\n","import * as xspattern from 'xspattern';\nconst fontoxpath = (function (xspattern) {\nconst VERSION='3.20.4';\nconst fontoxpathGlobal = {};\nvar D;function aa(a){var c=0;return function(){return cc||1342177279>>=1)e+=e;return g}});\nfunction hb(a,c){a=void 0!==a?String(a):\" \";return 0=m}});ea(\"Array.prototype.fill\",function(a){return a?a:function(c,e,g){var f=this.length||0;0>e&&(e=Math.max(0,f+e));if(null==g||g>f)g=f;g=Number(g);0>g&&(g=Math.max(0,f+g));for(e=Number(e||0);ee&&(e=Math.max(e+f,0));ec?-e:e}});ea(\"Number.isFinite\",function(a){return a?a:function(c){return\"number\"!==typeof c?!1:!isNaN(c)&&Infinity!==c&&-Infinity!==c}});ea(\"String.prototype.padStart\",function(a){return a?a:function(c,e){var g=cb(this,null,\"padStart\");return hb(e,c-g.length)+g}});\nfunction lb(a,c){a instanceof String&&(a+=\"\");var e=0,g=!1,f={next:function(){if(!g&&e=f}});\nea(\"String.fromCodePoint\",function(a){return a?a:function(c){for(var e=\"\",g=0;gf||1114111=f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(f>>>10&1023|55296),e+=String.fromCharCode(f&1023|56320))}return e}});\nea(\"String.prototype.codePointAt\",function(a){return a?a:function(c){var e=cb(this,null,\"codePointAt\"),g=e.length;c=Number(c)||0;if(0<=c&&cf||56319c||57343e.length)return f?1:-1;if(c.lengthe)return f?1:-1;if(cc?f?1:-1:epb(a,c)}}function ub(){return function(a,c){return 0>pb(a,c)}}function vb(){return function(a,c){return-1=a.length?Q:S(a[c])}}}D=zc.prototype;D.pb=function(){return this};D.filter=function(a){var c=this,e=-1;return this.o.create({next:function(){for(e++;e=c.h.length?Q:S(c.h[e])}})};D.first=function(){return this.h[0]};D.S=function(){return this.h};D.getEffectiveBooleanValue=function(){if(T(this.h[0].type,53))return!0;throw oc();};D.ya=function(){return this.h.length};D.F=function(){return!1};\nD.za=function(){return!1};D.map=function(a){var c=this,e=-1;return this.o.create({next:function(){return++e>=c.h.length?Q:S(a(c.h[e],e,c))}},this.h.length)};D.M=function(a){return a(this.h)};D.aa=function(a){return a.multiple?a.multiple(this):a.default(this)};function Ac(){this.value={next:function(){return Q}}}D=Ac.prototype;D.pb=function(){return this};D.filter=function(){return this};D.first=function(){return null};D.S=function(){return[]};D.getEffectiveBooleanValue=function(){return!1};D.ya=function(){return 0};D.F=function(){return!0};D.za=function(){return!1};D.map=function(){return this};D.M=function(a){return a([])};D.aa=function(a){return a.empty?a.empty(this):a.default(this)};function Bc(a){var c=a.value;if(T(a.type,53))return!0;if(T(a.type,0))return c;if(T(a.type,1)||T(a.type,20)||T(a.type,19))return 0!==c.length;if(T(a.type,2))return!isNaN(c)&&0!==c;throw oc();};function Cc(a,c){var e=this;this.J=U;this.value={next:function(g){if(null!==e.o&&e.h>=e.o)return Q;if(void 0!==e.B[e.h])return S(e.B[e.h++]);g=a.next(g);if(g.done)return e.o=e.h,g;if(e.v||2>e.h)e.B[e.h]=g.value;e.h++;return g}};this.v=!1;this.B=[];this.h=0;this.o=void 0===c?null:c}D=Cc.prototype;D.pb=function(){return this.J.create(this.S())};D.filter=function(a){var c=this,e=-1,g=this.value;return this.J.create({next:function(f){e++;for(var m=g.next(f);!m.done&&!a(m.value,e,c);)e++,m=g.next(f);return m}})};\nD.first=function(){if(void 0!==this.B[0])return this.B[0];var a=this.value.next(0);Dc(this);return a.done?null:a.value};D.S=function(){if(this.h>this.B.length&&this.o!==this.B.length)throw Error(\"Implementation error: Sequence Iterator has progressed.\");var a=this.value;this.v=!0;for(var c=a.next(0);!c.done;)c=a.next(0);return this.B};\nD.getEffectiveBooleanValue=function(){var a=this.value,c=this.h;Dc(this);var e=a.next(0);if(e.done)return Dc(this,c),!1;e=e.value;if(T(e.type,53))return Dc(this,c),!0;if(!a.next(0).done)throw oc();Dc(this,c);return Bc(e)};D.ya=function(a){if(null!==this.o)return this.o;if(void 0===a?0:a)return-1;a=this.h;var c=this.S().length;Dc(this,a);return c};D.F=function(){return 0===this.o?!0:null===this.first()};\nD.za=function(){if(null!==this.o)return 1===this.o;var a=this.value,c=this.h;Dc(this);if(a.next(0).done)return Dc(this,c),!1;a=a.next(0);Dc(this,c);return a.done};D.map=function(a){var c=this,e=0,g=this.value;return this.J.create({next:function(f){f=g.next(f);return f.done?Q:S(a(f.value,e++,c))}},this.o)};D.M=function(a,c){var e=this.value,g,f=[],m=!0;(function(){for(var p=e.next(m?0:c);!p.done;p=e.next(c))m=!1,f.push(p.value);g=a(f).value})();return this.J.create({next:function(){return g.next(0)}})};\nD.aa=function(a){function c(f){g=f.value;f=f.ya(!0);-1!==f&&(e.o=f)}var e=this,g=null;return this.J.create({next:function(f){if(g)return g.next(f);if(e.F())return c(a.empty?a.empty(e):a.default(e)),g.next(f);if(e.za())return c(a.s?a.s(e):a.default(e)),g.next(f);c(a.multiple?a.multiple(e):a.default(e));return g.next(f)}})};function Dc(a,c){a.h=void 0===c?0:c};function Ec(a){this.B=U;this.h=a;var c=!1;this.value={next:function(){if(c)return Q;c=!0;return S(a)}};this.o=null}D=Ec.prototype;D.pb=function(){return this};D.filter=function(a){return a(this.h,0,this)?this:this.B.create()};D.first=function(){return this.h};D.S=function(){return[this.h]};D.getEffectiveBooleanValue=function(){null===this.o&&(this.o=Bc(this.h));return this.o};D.ya=function(){return 1};D.F=function(){return!1};D.za=function(){return!0};\nD.map=function(a){return this.B.create(a(this.h,0,this))};D.M=function(a){return a([this.h])};D.aa=function(a){return a.s?a.s(this):a.default(this)};var Fc=new Ac;function Gc(a,c){a=void 0===a?null:a;if(null===a)return Fc;if(Array.isArray(a))switch(a.length){case 0:return Fc;case 1:return new Ec(a[0]);default:return new zc(a)}return a.next?new Cc(a,void 0===c?null:c):new Ec(a)}var U={create:Gc,s:function(a){return new Ec(a)},empty:function(){return Gc()},$:function(){return Gc(mc)},U:function(){return Gc(nc)}};function Rc(a){var c=[],e=a.value;return function(){var g=0;return U.create({next:function(){if(void 0!==c[g])return c[g++];var f=e.next(0);return f.done?f:c[g++]=f}})}};function Sc(a,c){this.type=a;this.value=c}\nvar Tc={},Uc=(Tc[0]=\"xs:boolean\",Tc[1]=\"xs:string\",Tc[2]=\"xs:numeric\",Tc[3]=\"xs:double\",Tc[4]=\"xs:decimal\",Tc[5]=\"xs:integer\",Tc[6]=\"xs:float\",Tc[7]=\"xs:date\",Tc[8]=\"xs:time\",Tc[9]=\"xs:dateTime\",Tc[10]=\"xs:dateTimeStamp\",Tc[11]=\"xs:gYearMonth\",Tc[12]=\"xs:gYear\",Tc[13]=\"xs:gMonthDay\",Tc[14]=\"xs:gMonth\",Tc[15]=\"xs:gDay\",Tc[16]=\"xs:yearMonthDuration\",Tc[17]=\"xs:dayTimeDuration\",Tc[18]=\"xs:duration\",Tc[19]=\"xs:untypedAtomic\",Tc[20]=\"xs:anyURI\",Tc[21]=\"xs:base64Binary\",Tc[22]=\"xs:hexBinary\",Tc[23]=\"xs:QName\",\nTc[24]=\"xs:NCName\",Tc[25]=\"xs:Name\",Tc[26]=\"xs:ENTITY\",Tc[27]=\"xs:nonPositiveInteger\",Tc[28]=\"xs:negativeInteger\",Tc[29]=\"xs:positiveInteger\",Tc[30]=\"xs:nonNegativeInteger\",Tc[31]=\"xs:long\",Tc[32]=\"xs:int\",Tc[33]=\"xs:short\",Tc[34]=\"xs:byte\",Tc[35]=\"xs:unsignedInt\",Tc[36]=\"xs:unsignedLong\",Tc[37]=\"xs:unsignedByte\",Tc[38]=\"xs:unsignedShort\",Tc[39]=\"xs:error\",Tc[40]=\"xs:ENTITIES\",Tc[41]=\"xs:IDREF\",Tc[42]=\"xs:ID\",Tc[43]=\"xs:IDFREFS\",Tc[44]=\"xs:NOTATION\",Tc[45]=\"xs:anySimpleType\",Tc[46]=\"xs:anyAtomicType\",\nTc[47]=\"attribute()\",Tc[48]=\"xs:normalizedString\",Tc[49]=\"xs:NMTOKENS\",Tc[50]=\"xs:NMTOKEN\",Tc[51]=\"xs:language\",Tc[52]=\"xs:token\",Tc[53]=\"node()\",Tc[54]=\"element()\",Tc[55]=\"document-node()\",Tc[56]=\"text()\",Tc[57]=\"processing-instruction()\",Tc[58]=\"comment()\",Tc[59]=\"item()\",Tc[60]=\"function(*)\",Tc[61]=\"map(*)\",Tc[62]=\"array(*)\",Tc),Vc={\"xs:boolean\":0,\"xs:string\":1,\"xs:numeric\":2,\"xs:double\":3,\"xs:decimal\":4,\"xs:integer\":5,\"xs:float\":6,\"xs:date\":7,\"xs:time\":8,\"xs:dateTime\":9,\"xs:dateTimeStamp\":10,\n\"xs:gYearMonth\":11,\"xs:gYear\":12,\"xs:gMonthDay\":13,\"xs:gMonth\":14,\"xs:gDay\":15,\"xs:yearMonthDuration\":16,\"xs:dayTimeDuration\":17,\"xs:duration\":18,\"xs:untypedAtomic\":19,\"xs:anyURI\":20,\"xs:base64Binary\":21,\"xs:hexBinary\":22,\"xs:QName\":23,\"xs:NCName\":24,\"xs:Name\":25,\"xs:ENTITY\":26,\"xs:nonPositiveInteger\":27,\"xs:negativeInteger\":28,\"xs:positiveInteger\":29,\"xs:nonNegativeInteger\":30,\"xs:long\":31,\"xs:int\":32,\"xs:short\":33,\"xs:byte\":34,\"xs:unsignedInt\":35,\"xs:unsignedLong\":36,\"xs:unsignedByte\":37,\"xs:unsignedShort\":38,\n\"xs:error\":39,\"xs:ENTITIES\":40,\"xs:IDREF\":41,\"xs:ID\":42,\"xs:IDREFS\":43,\"xs:NOTATION\":44,\"xs:anySimpleType\":45,\"xs:anyAtomicType\":46,\"attribute()\":47,\"xs:normalizedString\":48,\"xs:NMTOKENS\":49,\"xs:NMTOKEN\":50,\"xs:language\":51,\"xs:token\":52,\"node()\":53,\"element()\":54,\"document-node()\":55,\"text()\":56,\"processing-instruction()\":57,\"comment()\":58,\"item()\":59,\"function(*)\":60,\"map(*)\":61,\"array(*)\":62};\nfunction Wc(a){return 2===a.g?Uc[a.type]+\"*\":1===a.g?Uc[a.type]+\"+\":0===a.g?Uc[a.type]+\"?\":Uc[a.type]}function Xc(a){if(!a.startsWith(\"xs:\")&&0<=a.indexOf(\":\"))throw Error(\"XPST0081: Invalid prefix for input \"+a);var c=Vc[a];if(void 0===c)throw Error('XPST0051: The type \"'+a+'\" could not be found');return c}\nfunction Yc(a){switch(a[a.length-1]){case \"*\":return{type:Xc(a.substr(0,a.length-1)),g:2};case \"?\":return{type:Xc(a.substr(0,a.length-1)),g:0};case \"+\":return{type:Xc(a.substr(0,a.length-1)),g:1};default:return{type:Xc(a),g:3}}}function Zc(a){switch(a){case \"*\":return 2;case \"?\":return 0;case \"+\":return 1;default:return 3}};function $c(a,c,e){this.namespaceURI=c||null;this.prefix=a||\"\";this.localName=e}$c.prototype.va=function(){return this.prefix?this.prefix+\":\"+this.localName:this.localName};function ad(a){var c=a.l,e=a.arity,g=void 0===a.Oa?!1:a.Oa,f=void 0===a.I?!1:a.I,m=a.localName,p=a.namespaceURI,t=a.j;a=a.value;Sc.call(this,60,null);this.value=a;this.I=f;f=-1;for(a=0;a=v||v>t.R.length)throw Error(\"FOAY0001: array position out of bounds.\");return t.R[v-1]()})})};function $d(a){ad.call(this,{value:function(e,g,f,m){return Zd(e,g,f,U.s(c),m)},localName:\"get\",namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",l:[{type:5,g:3}],arity:1,j:{type:59,g:2}});var c=this;this.type=62;this.R=a}K($d,ad);function ae(a){switch(a.node.nodeType){case 2:return 47;case 1:return 54;case 3:case 4:return 56;case 7:return 57;case 8:return 58;case 9:return 55;default:return 53}}function be(a){return{type:ae(a),value:a}};function ce(a,c){a=a.map(function(e){return e.first()});return c(a)};function de(a,c){var e=T(a.type,1)||T(a.type,20)||T(a.type,19),g=T(c.type,1)||T(c.type,20)||T(c.type,19);if(e&&g)return a.value===c.value;e=T(a.type,4)||T(a.type,3)||T(a.type,6);g=T(c.type,4)||T(c.type,3)||T(c.type,6);if(e&&g)return isNaN(a.value)&&isNaN(c.value)?!0:a.value===c.value;e=T(a.type,0)||T(a.type,22)||T(a.type,18)||T(a.type,23)||T(a.type,44);g=T(c.type,0)||T(c.type,22)||T(c.type,18)||T(c.type,23)||T(c.type,44);return e&&g?a.value===c.value:!1};function ee(a,c,e,g,f){return ce([g,f],function(m){m=H(m);var p=m.next().value,t=m.next().value;return(m=p.h.find(function(v){return de(v.key,t)}))?m.value():U.empty()})};function fe(a){ad.call(this,{l:[{type:59,g:3}],arity:1,localName:\"get\",namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",value:function(e,g,f,m){return ee(e,g,f,U.s(c),m)},j:{type:59,g:2}});var c=this;this.type=61;this.h=a}K(fe,ad);function Ce(){}function De(a,c){return a.ab()===c.ab()&&a.bb()===c.bb()}D=Ce.prototype;D.Za=function(){return 0};D.getHours=function(){return 0};D.getMinutes=function(){return 0};D.$a=function(){return 0};D.ab=function(){return 0};D.bb=function(){return 0};D.getSeconds=function(){return 0};D.cb=function(){return 0};D.oa=function(){return!0};function Ee(a){if(a>Number.MAX_SAFE_INTEGER||aNumber.MAX_SAFE_INTEGER||!Number.isFinite(a))throw Error(\"FODT0002: Value overflow while multiplying xs:dayTimeDuration\");return new Ee(aa||273860c.pa?1:-1:g>e?1:-1}function Nf(a,c,e){return 0===Mf(a,c,e)}function Of(a,c,e){a=(Kf(a,e).getTime()-Kf(c,e).getTime())/1E3;return new Ee(a)}\nfunction Pf(a){throw Error(\"Not implemented: adding durations to \"+Uc[a.type]);}function Qf(a){throw Error(\"Not implemented: subtracting durations from \"+Uc[a.type]);};function Rf(a,c){if(null===a)return null;switch(typeof a){case \"boolean\":return a?mc:nc;case \"number\":return L(a,3);case \"string\":return L(a,1);case \"object\":return\"nodeType\"in a?be({node:a,G:null}):Array.isArray(a)?new $d(a.map(function(e){if(void 0===e)return function(){return U.empty()};e=Rf(e,c);e=null===e?U.empty():U.s(e);return Rc(e)})):new fe(Object.keys(a).filter(function(e){return void 0!==a[e]}).map(function(e){var g=Rf(a[e],c);g=null===g?U.empty():U.s(g);return{key:L(e,1),value:Rc(g)}}))}throw Error(\"Value \"+\nString(a)+' of type \"'+typeof a+'\" is not adaptable to an XPath value.');}function Sf(a,c){if(\"number\"!==typeof a&&(\"string\"!==typeof a||!kc.get(c)(a)))throw Error(\"Cannot convert JavaScript value '\"+a+\"' to the XPath type \"+Uc[c]+\" since it is not valid.\");}\nfunction Tf(a,c,e){if(null===c)return null;switch(a){case 0:return c?mc:nc;case 1:return L(c+\"\",1);case 3:case 2:return Sf(c,3),L(+c,3);case 4:return Sf(c,a),L(+c,4);case 5:return Sf(c,a),L(c|0,5);case 6:return Sf(c,a),L(+c,6);case 7:case 8:case 9:case 11:case 12:case 13:case 14:case 15:if(!(c instanceof Date))throw Error(\"The JavaScript value \"+c+\" with type \"+typeof c+\" is not a valid type to be converted to an XPath \"+Uc[a]+\".\");return L(Jf(Lf(c.toISOString()),a),a);case 53:case 47:case 55:case 54:case 56:case 57:case 58:if(\"object\"!==\ntypeof c||!(\"nodeType\"in c))throw Error(\"The JavaScript value \"+c+\" with type \"+typeof c+\" is not a valid type to be converted to an XPath \"+Uc[a]+\".\");return be({node:c,G:null});case 59:return Rf(c,e);default:throw Error('Values of the type \"'+a+'\" can not be adapted to equivalent XPath values.');}}\nfunction Uf(a,c,e){if(0===e.g)return c=Tf(e.type,c,a),null===c?[]:[c];if(2===e.g||1===e.g){if(!Array.isArray(c))throw Error(\"The JavaScript value \"+c+\" should be an array if it is to be converted to \"+Wc(e)+\".\");return c.map(function(f){return Tf(e.type,f,a)}).filter(function(f){return null!==f})}var g=Tf(e.type,c,a);if(null===g)throw Error(\"The JavaScript value \"+c+\" should be a single entry if it is to be converted to \"+Wc(e)+\".\");return[g]}\nfunction Vf(a,c,e){e=void 0===e?{type:59,g:0}:e;return U.create(Uf(a,c,e))};function Wf(a,c){this.h=c=void 0===c?{xb:null,Bb:null,qb:!1}:c;this.Ga=a.Ga;this.wa=a.wa;this.O=a.O;this.ta=a.ta||Object.create(null)}function Xf(a,c){var e=0,g=c.value;return{next:function(f){f=g.next(f);return f.done?Q:S(Yf(a,e++,f.value,c))}}}function Zf(a){a.h.qb||(a.h.qb=!0,a.h.xb=Lf((new Date).toISOString()),a.h.Bb=He(\"PT0S\"));return a.h.xb}function $f(a){a.h.qb||(a.h.qb=!0,a.h.xb=Lf((new Date).toISOString()),a.h.Bb=He(\"PT0S\"));return a.h.Bb}\nfunction Yf(a,c,e,g){return new Wf({O:e,Ga:c,wa:g||a.wa,ta:a.ta},a.h)}function ag(a,c){return new Wf({O:a.O,Ga:a.Ga,wa:a.wa,ta:Object.assign(Object.create(null),a.ta,c)},a.h)};function bg(a,c,e,g,f,m){var p=new Map;this.debug=a;this.h=c;this.o=e;this.B=g;this.J=f;this.C=p;this.v=m;this.Ta=!0};function cg(a){var c=0,e=null,g=!0;return U.create({next:function(f){for(;cNumber.MAX_VALUE?{u:!1,error:Error(\"FOAR0002: Can not cast \"+c+\" to xs:decimal, it is out of bounds for JavaScript numbers\")}:{u:!0,value:L(c,4)}}:a(0)?function(c){return{u:!0,value:L(c?1:0,4)}}:a(1)||a(19)?function(c){var e=parseFloat(c);return!isNaN(e)||isFinite(e)?{u:!0,value:L(e,4)}:{u:!1,error:Error(\"FORG0001: Can not cast \"+\nc+\" to xs:decimal\")}}:function(){return{u:!1,error:Error(\"XPTY0004: Casting not supported from given type to xs:decimal or any of its derived types.\")}}};function eh(a,c){return a(2)?function(e){return{u:!0,value:e}}:a(0)?function(e){return{u:!0,value:e?1:0}}:a(1)||a(19)?function(e){switch(e){case \"NaN\":return{u:!0,value:NaN};case \"INF\":case \"+INF\":return{u:!0,value:Infinity};case \"-INF\":return{u:!0,value:-Infinity};case \"0\":case \"+0\":return{u:!0,value:0};case \"-0\":return{u:!0,value:-0}}var g=parseFloat(e);return isNaN(g)?{u:!1,error:dg(e,c)}:{u:!0,value:g}}:function(){return{u:!1,error:Error(\"XPTY0004: Casting not supported from given type to \"+c+\n\" or any of its derived types.\")}}};function fh(a){var c=eh(a,3);return function(e){e=c(e);return e.u?{u:!0,value:L(e.value,3)}:e}};function gh(a){if(a>Number.MAX_SAFE_INTEGER||aNumber.MAX_SAFE_INTEGER||!Number.isFinite(c))throw Error(\"FODT0002: Value overflow while constructing xs:yearMonthDuration\");a=new gh(a||0===c?c:-c)}else a=null;return a}\nfunction jh(a,c){if(isNaN(c))throw Error(\"FOCA0005: Cannot multiply xs:yearMonthDuration by NaN\");a=Math.round(a.ha*c);if(a>Number.MAX_SAFE_INTEGER||!Number.isFinite(a))throw Error(\"FODT0002: Value overflow while constructing xs:yearMonthDuration\");return new gh(ac?\"-\":\"\")+\"INF\"}}}return a(9)||a(7)||a(8)||a(15)||a(14)||a(13)||a(12)||a(11)?function(c){return{u:!0,value:c.toString()}}:a(16)?function(c){return{u:!0,value:c.toString()}}:a(17)?function(c){return{u:!0,value:c.toString()}}:a(18)?function(c){return{u:!0,value:c.toString()}}:a(22)?function(c){return{u:!0,value:c.toUpperCase()}}:function(c){return{u:!0,value:c+\"\"}}};function yh(a){var c=xh(a);return function(e){e=c(e);return e.u?{u:!0,value:L(e.value,1)}:e}};function zh(a){return a(9)?function(c){return{u:!0,value:L(Jf(c,8),8)}}:a(19)||a(1)?function(c){return{u:!0,value:L(Lf(c),8)}}:function(){return{u:!1,error:Error(\"XPTY0004: Casting not supported from given type to xs:time or any of its derived types.\")}}};function Ah(a){var c=xh(a);return function(e){e=c(e);return e.u?{u:!0,value:L(e.value,19)}:e}};function Bh(a){return a(18)&&!a(17)?function(c){return{u:!0,value:L(c.Sa,16)}}:a(17)?function(){return{u:!0,value:L(ih(\"P0M\"),16)}}:a(19)||a(1)?function(c){var e=ih(c);return e?{u:!0,value:L(e,16)}:{u:!1,error:dg(c,16)}}:function(){return{u:!1,error:Error(\"XPTY0004: Casting not supported from given type to xs:yearMonthDuration or any of its derived types.\")}}};var Ch=[2,5,17,16];\nfunction wh(a,c){function e(g){return T(a,g)}if(39===c)return function(){return{u:!1,error:Error(\"FORG0001: Casting to xs:error is always invalid.\")}};switch(c){case 19:return Ah(e);case 1:return yh(e);case 6:return mh(e);case 3:return fh(e);case 4:return dh(e);case 5:return th(e);case 2:return vh(a);case 18:return lh(e);case 16:return Bh(e);case 17:return ch(e);case 9:return bh(e);case 8:return zh(e);case 7:return ah(e);case 11:return rh(e);case 12:return qh(e);case 13:return ph(e);case 15:return nh(e);\ncase 14:return oh(e);case 0:return $g(e);case 21:return Zg(e);case 22:return sh(e);case 20:return Yg(e);case 23:throw Error(\"Casting to xs:QName is not implemented.\");}return function(){return{u:!1,error:Error(\"XPTY0004: Casting not supported from \"+a+\" to \"+c+\".\")}}}var Dh=Object.create(null);\nfunction Eh(a,c){if(19===a&&1===c)return function(m){return{u:!0,value:L(m,1)}};if(44===c)return function(){return{u:!1,error:Error(\"XPST0080: Casting to xs:NOTATION is not permitted.\")}};if(39===c)return function(){return{u:!1,error:Error(\"FORG0001: Casting to xs:error is not permitted.\")}};if(45===a||45===c)return function(){return{u:!1,error:Error(\"XPST0080: Casting from or to xs:anySimpleType is not permitted.\")}};if(46===a||46===c)return function(){return{u:!1,error:Error(\"XPST0080: Casting from or to xs:anyAtomicType is not permitted.\")}};\nif(T(a,60)&&1===c)return function(){return{u:!1,error:Error(\"FOTY0014: Casting from function item to xs:string is not permitted.\")}};if(a===c)return function(m){return{u:!0,value:{type:c,value:m}}};var e=Ch.includes(a)?a:Tg(a),g=Ch.includes(c)?c:Tg(c);if(null===g||null===e)return function(){return{u:!1,error:Error(\"XPST0081: Can not cast: type \"+(g?Uc[a]:Uc[c])+\" is unknown.\")}};var f=[];1!==e&&19!==e||f.push(function(m){var p=Ug(m,c);return Vg(p,c)?{u:!0,value:p}:{u:!1,error:dg(m,c,\"pattern validation failed.\")}});\ne!==g&&(f.push(wh(e,g)),f.push(function(m){return{u:!0,value:m.value}}));19!==g&&1!==g||f.push(function(m){return Vg(m,c)?{u:!0,value:m}:{u:!1,error:dg(m,c,\"pattern validation failed.\")}});f.push(function(m){return Xg(m,c)?{u:!0,value:m}:{u:!1,error:dg(m,c,\"pattern validation failed.\")}});f.push(function(m){return{u:!0,value:{type:c,value:m}}});return function(m){m={u:!0,value:m};for(var p=0,t=f.length;pg.value.node.localName?1:-1;e=Xd(c,e.value);g=Xd(c,g.value)}else e=e.value,g=g.value;return Nh(a,c,e,g)}function Ph(a,c,e){return Oh(a.o,a,c,e)}\nfunction Qh(a,c){return Rh(c,function(e,g){return Oh(a.o,a,e,g)}).filter(function(e,g,f){return 0===g?!0:!Jh(e.value,f[g-1].value)})}function Sh(a,c){return a=a.length)return a;var e=Math.floor(a.length/2),g=Rh(a.slice(0,e),c);a=Rh(a.slice(e),c);for(e=[];g.length&&a.length;)0>c(g[0],a[0])?e.push(g.shift()):e.push(a.shift());return e.concat(g.concat(a))};var Th=xspattern;function Uh(a,c){if(T(a.type,2)){if(T(a.type,6))return 3===c?L(a.value,3):null;if(T(a.type,4)){if(6===c)return L(a.value,6);if(3===c)return L(a.value,3)}return null}return T(a.type,20)&&1===c?L(a.value,1):null};function Vh(a,c,e,g,f){if(T(a.type,c.type))return a;T(c.type,46)&&T(a.type,53)&&(a=Rg(a,e).first());if(T(a.type,c.type)||46===c.type)return a;if(T(a.type,19)){e=Gh(a,c.type);if(!e)throw Error(\"XPTY0004 Unable to convert \"+(f?\"return\":\"argument\")+\" of type \"+Uc[a.type]+\" to type \"+Wc(c)+\" while calling \"+g);return e}e=Uh(a,c.type);if(!e)throw Error(\"XPTY0004 Unable to cast \"+(f?\"return\":\"argument\")+\" of type \"+Uc[a.type]+\" to type \"+Wc(c)+\" while calling \"+g);return e}\nfunction Wh(a,c,e,g,f){return 0===a.g?c.aa({default:function(){return c.map(function(m){return Vh(m,a,e,g,f)})},multiple:function(){throw Error(\"XPTY0004: Multiplicity of \"+(f?\"function return value\":\"function argument\")+\" of type \"+Uc[a.type]+(a.type||\"\")+\" for \"+g+' is incorrect. Expected \"?\", but got \"+\".');}}):1===a.g?c.aa({empty:function(){throw Error(\"XPTY0004: Multiplicity of \"+(f?\"function return value\":\"function argument\")+\" of type \"+Uc[a.type]+(a.type||\"\")+\" for \"+g+' is incorrect. Expected \"+\", but got \"empty-sequence()\"');\n},default:function(){return c.map(function(m){return Vh(m,a,e,g,f)})}}):2===a.g?c.map(function(m){return Vh(m,a,e,g,f)}):c.aa({s:function(){return c.map(function(m){return Vh(m,a,e,g,f)})},default:function(){throw Error(\"XPTY0004: Multiplicity of \"+(f?\"function return value\":\"function argument\")+\" of type \"+Uc[a.type]+(a.type||\"\")+\" for \"+g+\" is incorrect. Expected exactly one\");}})};function bj(a,c){return T(a,5)?L(c,5):T(a,6)?L(c,6):T(a,3)?L(c,3):L(c,4)}function cj(a){if(Math.floor(a)===a||isNaN(a))return 0;a=/\\d+(?:\\.(\\d*))?(?:[Ee](-)?(\\d+))*/.exec(a+\"\");var c=a[1]?a[1].length:0;if(a[3]){if(a[2])return c+parseInt(a[3],10);a=c-parseInt(a[3],10);return 0>a?0:a}return c}function dj(a,c,e){return c&&0===a*e%1%.5?0===Math.floor(a*e)%2?Math.floor(a*e)/e:Math.ceil(a*e)/e:Math.round(a*e)/e}\nfunction ej(a,c,e,g,f,m){var p=!1;return U.create({next:function(){if(p)return Q;var t=f.first();if(!t)return p=!0,Q;if((T(t.type,6)||T(t.type,3))&&(0===t.value||isNaN(t.value)||Infinity===t.value||-Infinity===t.value))return p=!0,S(t);var v;m?v=m.first().value:v=0;p=!0;if(cj(t.value)f?U.s(L(1,5)):a=m||57344<=m&&65533>=m||65536<=\nm&&1114111>=m)return String.fromCodePoint(m);throw Error(\"FOCH0001\");}).join(\"\");return U.s(L(f,1))})},localName:\"codepoints-to-string\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:1,g:3}},{l:[{type:1,g:0}],m:function(a,c,e,g){return ce([g],function(f){f=(f=H(f).next().value)?f.value.split(\"\"):[];return 0===f.length?U.empty():U.create(f.map(function(m){return L(m.codePointAt(0),5)}))})},localName:\"string-to-codepoints\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:5,\ng:2}},{l:[{type:1,g:0}],m:function(a,c,e,g){return ce([g],function(f){f=H(f).next().value;return null===f||0===f.value.length?U.create(L(\"\",1)):U.create(L(encodeURIComponent(f.value).replace(/[!'()*]/g,function(m){return\"%\"+m.charCodeAt(0).toString(16).toUpperCase()}),1))})},localName:\"encode-for-uri\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:1,g:3}},{l:[{type:1,g:0}],m:function(a,c,e,g){return ce([g],function(f){f=H(f).next().value;return null===f||0===f.value.length?U.create(L(\"\",\n1)):U.create(L(f.value.replace(/([\\u00A0-\\uD7FF\\uE000-\\uFDCF\\uFDF0-\\uFFEF \"<>{}|\\\\^`/\\n\\u007f\\u0080-\\u009f]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g,function(m){return encodeURI(m)}),1))})},localName:\"iri-to-uri\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:1,g:3}},{l:[{type:1,g:0},{type:1,g:0}],m:function(a,c,e,g,f){return ce([g,f],function(m){var p=H(m);m=p.next().value;p=p.next().value;if(null===m||null===p)return U.empty();m=m.value;p=p.value;if(m.length!==p.length)return U.U();m=m.split(\"\");\np=p.split(\"\");for(var t=0;tE.node.nodeName?1:-1}).map(function(A){return be(A)});f=vd(c.h,f.value).filter(function(A){return\"http://www.w3.org/2000/xmlns/\"!==A.node.namespaceURI}).sort(function(A,E){return A.node.nodeName>E.node.nodeName?1:-1}).map(function(A){return be(A)});var t=Jj(a,c,e,U.create(g),\nU.create(f)),v=!1;return{next:function(){if(v)return Q;var A=m.next(0);if(!A.done&&!1===A.value)return v=!0,A;A=t.next(0);if(!A.done&&!1===A.value)return v=!0,A;A=p.next(0);v=!0;return A}}}function Pj(a,c,e,g,f){var m=Jj(a,c,e,uj(a,c,e,U.s(g)),uj(a,c,e,U.s(f))),p=!1;return{next:function(){if(p)return Q;var t=m.next(0);return t.done||!1!==t.value?S(Gj(Rg(g,c).first(),Rg(f,c).first())):(p=!0,t)}}}\nfunction Kj(a,c,e,g,f){if(T(g.type,46)&&T(f.type,46))return Hh(Gj(g,f));if(T(g.type,61)&&T(f.type,61))return Lj(a,c,e,g,f);if(T(g.type,62)&&T(f.type,62))return Mj(a,c,e,g,f);if(T(g.type,53)&&T(f.type,53)){if(T(g.type,55)&&T(f.type,55))return Nj(a,c,e,g,f);if(T(g.type,54)&&T(f.type,54))return Oj(a,c,e,g,f);if(T(g.type,47)&&T(f.type,47)||T(g.type,57)&&T(f.type,57)||T(g.type,58)&&T(f.type,58))return Pj(a,c,e,g,f)}return Hh(!1)};function Qj(a){return Error(\"XUST0001: \"+(void 0===a?\"Can not execute an updating expression in a non-updating context.\":a))}function Rj(a){return Error(\"XUTY0004: The attribute \"+a.name+'=\"'+a.value+'\" follows a node that is not an attribute node.')}function Sj(){return Error(\"XUTY0005: The target of a insert expression with into must be a single element or document node.\")}\nfunction Tj(){return Error(\"XUTY0006: The target of a insert expression with before or after must be a single element, text, comment, or processing instruction node.\")}function Uj(){return Error(\"XUTY0008: The target of a replace expression must be a single element, attribute, text, comment, or processing instruction node.\")}function Vj(){return Error(\"XUTY0012: The target of a rename expression must be a single element, attribute, or processing instruction node.\")}\nfunction Wj(a){return Error(\"XUDY0017: The target \"+a.outerHTML+\" is used in more than one replace value of expression.\")}function Xj(a){return Error(\"XUDY0021: Applying the updates will result in the XDM instance violating constraint: '\"+a+\"'\")}function Yj(a){return Error(\"XUDY0023: The namespace binding \"+a+\" is conflicting.\")}function Zj(a){return Error(\"XUDY0024: The namespace binding \"+a+\" is conflicting.\")}\nfunction ak(){return Error(\"XUDY0027: The target for an insert, replace, or rename expression expression should not be empty.\")};function V(a,c,e,g,f){e=void 0===e?{A:!1,Z:!1,T:\"unsorted\",subtree:!1}:e;this.K=a;this.B=e.T||\"unsorted\";this.subtree=!!e.subtree;this.Z=!!e.Z;this.A=!!e.A;this.J=c;this.I=!1;this.Ya=null;this.wb=void 0===g?!1:g;this.type=f}function bk(a,c,e){c&&null!==c.O?a.A?(null===a.Ya&&(a.Ya=Rc(a.evaluate(null,e).pb())),a=a.Ya()):a=a.evaluate(c,e):a=a.evaluate(c,e);return a}V.prototype.Y=function(){return null};\nV.prototype.P=function(a){this.J.forEach(function(c){return c.P(a)});if(!this.wb&&this.J.some(function(c){return c.I}))throw Qj();};function ck(a,c){this.H=a;this.fa=c};function dk(a){a&&\"nodeType\"in a&&(a=a.ownerDocument||a,\"function\"===typeof a.createElementNS&&\"function\"===typeof a.createProcessingInstruction&&\"function\"===typeof a.createTextNode&&\"function\"===typeof a.createComment&&(this.h=a));this.h||(this.h=null)}D=dk.prototype;D.createAttributeNS=function(a,c){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createAttributeNS(a,c)};\nD.createCDATASection=function(a){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createCDATASection(a)};D.createComment=function(a){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createComment(a)};D.createDocument=function(){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.implementation.createDocument(null,null,null)};\nD.createElementNS=function(a,c){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createElementNS(a,c)};D.createProcessingInstruction=function(a,c){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createProcessingInstruction(a,c)};D.createTextNode=function(a){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createTextNode(a)};function ek(a,c,e,g){var f=Xd(e,a).node,m=(a=Bd(e,a))?a.node:null;c.forEach(function(p){g.insertBefore(f,p.node,m)})}function fk(a,c,e,g){var f=Xd(e,a).node;c.forEach(function(m){g.insertBefore(f,m.node,a.node)})}function gk(a,c,e,g){var f=(e=zd(e,a))?e.node:null;c.forEach(function(m){g.insertBefore(a.node,m.node,f)})}function hk(a,c,e){c.forEach(function(g){e.insertBefore(a.node,g.node,null)})}\nfunction ik(a,c,e,g){c.forEach(function(f){var m=f.node.nodeName;if(wd(e,a,m))throw Xj(\"An attribute \"+m+\" already exists.\");g.setAttributeNS(a.node,f.node.namespaceURI,m,yd(e,f))})}\nfunction jk(a,c,e,g,f){g||(g=new dk(a?a.node:null));switch(a.node.nodeType){case 1:var m=e.getAllAttributes(a.node),p=e.getChildNodes(a.node),t=g.createElementNS(c.namespaceURI,c.va());var v={node:t,G:null};m.forEach(function(A){f.setAttributeNS(t,A.namespaceURI,A.nodeName,A.value)});p.forEach(function(A){f.insertBefore(t,A,null)});break;case 2:c=g.createAttributeNS(c.namespaceURI,c.va());c.value=yd(e,a);v={node:c,G:null};break;case 7:v={node:g.createProcessingInstruction(c.va(),yd(e,a)),G:null}}if(!Xd(e,\na))throw Error(\"Not supported: renaming detached nodes.\");kk(a,[v],e,f)}function lk(a,c,e,g){e.getChildNodes(a.node).forEach(function(f){return g.removeChild(a.node,f)});c&&g.insertBefore(a.node,c.node,null)}\nfunction kk(a,c,e,g){var f=Xd(e,a),m=a.node.nodeType;if(2===m){if(c.some(function(v){return 2!==v.node.nodeType}))throw Error('Constraint \"If $target is an attribute node, $replacement must consist of zero or more attribute nodes.\" failed.');var p=f?f.node:null;g.removeAttributeNS(p,a.node.namespaceURI,a.node.nodeName);c.forEach(function(v){var A=v.node.nodeName;if(wd(e,f,A))throw Xj(\"An attribute \"+A+\" already exists.\");g.setAttributeNS(p,v.node.namespaceURI,A,yd(e,v))})}if(1===m||3===m||8===m||\n7===m){var t=(m=Bd(e,a))?m.node:null;g.removeChild(f.node,a.node);c.forEach(function(v){g.insertBefore(f.node,v.node,t)})}};function mk(a,c,e,g){nk(a,c);a.filter(function(f){return-1!==[\"insertInto\",\"insertAttributes\",\"replaceValue\",\"rename\"].indexOf(f.type)}).forEach(function(f){switch(f.type){case \"insertInto\":hk(f.target,f.content,g);break;case \"insertAttributes\":ik(f.target,f.content,c,g);break;case \"rename\":jk(f.target,f.o,c,e,g);break;case \"replaceValue\":var m=f.target;f=f.o;if(2===m.node.nodeType){var p=Xd(c,m);p?g.setAttributeNS(p.node,m.node.namespaceURI,m.node.nodeName,f):m.node.value=f}else g.setData(m.node,\nf)}});a.filter(function(f){return-1!==[\"insertBefore\",\"insertAfter\",\"insertIntoAsFirst\",\"insertIntoAsLast\"].indexOf(f.type)}).forEach(function(f){switch(f.type){case \"insertAfter\":ek(f.target,f.content,c,g);break;case \"insertBefore\":fk(f.target,f.content,c,g);break;case \"insertIntoAsFirst\":gk(f.target,f.content,c,g);break;case \"insertIntoAsLast\":hk(f.target,f.content,g)}});a.filter(function(f){return\"replaceNode\"===f.type}).forEach(function(f){kk(f.target,f.o,c,g)});a.filter(function(f){return\"replaceElementContent\"===\nf.type}).forEach(function(f){lk(f.target,f.text,c,g)});a.filter(function(f){return\"delete\"===f.type}).forEach(function(f){f=f.target;var m=Xd(c,f);(m=m?m.node:null)&&(2===f.node.nodeType?g.removeAttributeNS(m,f.node.namespaceURI,f.node.nodeName):g.removeChild(m,f.node))});if(a.some(function(f){return\"put\"===f.type}))throw Error('Not implemented: the execution for pendingUpdate \"put\" is not yet implemented.');}\nfunction nk(a,c){function e(m){return new $c(m.node.prefix,m.node.namespaceURI,m.node.localName)}function g(m,p){var t=new Set;a.filter(function(v){return v.type===m}).map(function(v){return v.target}).forEach(function(v){v=v?v.node:null;t.has(v)&&p(v);t.add(v)})}g(\"rename\",function(m){throw Error(\"XUDY0015: The target \"+m.outerHTML+\" is used in more than one rename expression.\");});g(\"replaceNode\",function(m){throw Error(\"XUDY0016: The target \"+m.outerHTML+\" is used in more than one replace expression.\");\n});g(\"replaceValue\",function(m){throw Wj(m);});g(\"replaceElementContent\",function(m){throw Wj(m);});var f=new Map;a.filter(function(m){return\"replaceNode\"===m.type&&2===m.target.node.nodeType}).forEach(function(m){var p=Xd(c,m.target);p=p?p.node:null;var t=f.get(p);t?t.push.apply(t,ia(m.o.map(e))):f.set(p,m.o.map(e))});a.filter(function(m){return\"rename\"===m.type&&2===m.target.node.nodeType}).forEach(function(m){var p=Xd(c,m.target);if(p){p=p.node;var t=f.get(p);t?t.push(m.o):f.set(p,[m.o])}});f.forEach(function(m){var p=\n{};m.forEach(function(t){p[t.prefix]||(p[t.prefix]=t.namespaceURI);if(p[t.prefix]!==t.namespaceURI)throw Zj(t.namespaceURI);})})}function ok(a,c){for(var e=[],g=1;ga.h[e])return-1}return 0};function yk(){return eg(\"Expected base expression of a function call to evaluate to a sequence of single function item\")}function zk(a,c,e,g){for(var f=[],m=0;mp.R.length||0>=v)throw Error(\"FOAY0001: subarray start out of bounds.\");if(0>t)throw Error(\"FOAY0002: subarray length out of bounds.\");if(v+t>p.R.length+1)throw Error(\"FOAY0001: subarray start + length out of bounds.\");return U.s(new $d(p.R.slice(v-1,t+v-1)))})}\nfunction Gl(a,c,e,g,f){return ce([g],function(m){var p=H(m).next().value;return f.M(function(t){t=t.map(function(M){return M.value}).sort(function(M,O){return O-M}).filter(function(M,O,R){return R[O-1]!==M});for(var v=p.R.concat(),A=0,E=t.length;Ap.R.length||0>=I)throw Error(\"FOAY0001: subarray position out of bounds.\");v.splice(I-1,1)}return U.s(new $d(v))})})}function Hl(a){return T(a,1)||T(a,20)||T(a,19)}\nfunction Il(a,c,e,g,f){return 0===g.length?0!==f.length:0!==f.length&&Kj(a,c,e,g[0],f[0]).next(0).value?Il(a,c,e,g.slice(1),f.slice(1)):g[0].value!==g[0].value?!0:Hl(g[0].type)&&0!==f.length&&Hl(f[0].type)?g[0].value=p||p>t.R.length)throw Error(\"FOAY0001: array position out of bounds.\");t=t.R.concat();t.splice(p-1,1,Rc(m));return U.s(new $d(t))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"append\",l:[{type:62,g:3},{type:59,g:2}],j:{type:62,g:3},m:function(a,c,e,g,f){return ce([g],function(m){m=H(m).next().value.R.concat([Rc(f)]);return U.s(new $d(m))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",\nlocalName:\"subarray\",l:[{type:62,g:3},{type:5,g:3},{type:5,g:3}],j:{type:62,g:3},m:Fl},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"subarray\",l:[{type:62,g:3},{type:5,g:3}],j:{type:62,g:3},m:function(a,c,e,g,f){var m=U.s(L(g.first().value.length-f.first().value+1,5));return Fl(a,c,e,g,f,m)}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"remove\",l:[{type:62,g:3},{type:5,g:2}],j:{type:62,g:3},m:Gl},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",\nlocalName:\"insert-before\",l:[{type:62,g:3},{type:5,g:3},{type:59,g:2}],j:{type:62,g:3},m:function(a,c,e,g,f,m){return ce([g,f],function(p){var t=H(p);p=t.next().value;t=t.next().value.value;if(t>p.R.length+1||0>=t)throw Error(\"FOAY0001: subarray position out of bounds.\");p=p.R.concat();p.splice(t-1,0,Rc(m));return U.s(new $d(p))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"head\",l:[{type:62,g:3}],j:{type:59,g:2},m:function(a,c,e,g){return Zd(a,c,e,g,U.s(L(1,5)))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",\nlocalName:\"tail\",l:[{type:62,g:3}],j:{type:59,g:2},m:function(a,c,e,g){return Gl(a,c,e,g,U.s(L(1,5)))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"reverse\",l:[{type:62,g:3}],j:{type:62,g:3},m:function(a,c,e,g){return ce([g],function(f){f=H(f).next().value;return U.s(new $d(f.R.concat().reverse()))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"join\",l:[{type:62,g:2}],j:{type:62,g:3},m:function(a,c,e,g){return g.M(function(f){f=f.reduce(function(m,\np){return m.concat(p.R)},[]);return U.s(new $d(f))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"for-each\",l:[{type:62,g:3},{type:60,g:3}],j:{type:62,g:3},m:function(a,c,e,g,f){return ce([g,f],function(m){m=H(m);var p=m.next().value,t=m.next().value;if(1!==t.B)throw eg(\"The callback passed into array:for-each has a wrong arity.\");m=p.R.map(function(v){return Rc(t.value.call(void 0,a,c,e,zk(t.o,[v()],c,\"array:for-each\")[0]))});return U.s(new $d(m))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",\nlocalName:\"filter\",l:[{type:62,g:3},{type:60,g:3}],j:{type:62,g:3},m:function(a,c,e,g,f){return ce([g,f],function(m){m=H(m);var p=m.next().value,t=m.next().value;if(1!==t.B)throw eg(\"The callback passed into array:filter has a wrong arity.\");var v=p.R.map(function(I){I=zk(t.o,[I()],c,\"array:filter\")[0];var M=t.value;return M(a,c,e,I)}),A=[],E=!1;return U.create({next:function(){if(E)return Q;for(var I=0,M=p.R.length;I=e.start.line&&t<=e.end.line){var v=te.start.line?p.length:e.start.da-1+p.length;f.push(Array(p.length+m.length).fill(\" \",0,\nt).fill(\"^\",t,v).join(\"\"))}return f},[]);c=am(c).join(\"\\n\");throw new Yl(a.join(\"\\n\")+\"\\n\\n\"+c,e);};function W(a,c){\"*\"===c||Array.isArray(c)||(c=[c]);for(var e=1;ea.length?\"\":\"object\"===typeof a[1]?a[2]||\"\":a[1]||\"\"}function cm(a,c){if(!Array.isArray(a))return null;a=a[1];return\"object\"!==typeof a||Array.isArray(a)?null:c in a?a[c]:null}function dm(a,c){return c.reduce(W,a)}\nfunction em(a,c){for(var e=[],g=1;g:\"+a.location.start.line+\":\"+a.location.start.da+\" - \"+a.location.end.line+\":\"+a.location.end.da);return c};function Gm(a,c,e){sk.call(this,e.K,[e],{A:e.A,Z:e.Z,T:e.B,subtree:e.subtree});this.h=c;this.C={end:{da:a.end.da,line:a.end.line,offset:a.end.offset},start:{da:a.start.da,line:a.start.line,offset:a.start.offset}}}K(Gm,sk);Gm.prototype.v=function(a,c,e){var g=this;c=H(e).next().value;try{var f=c(a)}catch(m){throw new Fm(this.C,this.h,m);}return U.create({next:function(m){try{return f.value.next(m)}catch(p){throw new Fm(g.C,g.h,p);}}})};\nGm.prototype.P=function(a){try{sk.prototype.P.call(this,a)}catch(c){throw new Fm(this.C,this.h,c);}};function Hm(a,c,e,g){V.call(this,a,c,e,!0);this.h=g;this.I=this.h.I}K(Hm,V);function Im(a,c,e,g){var f=[],m=a.C(c,e,g,function(t){if(a.h instanceof Hm){var v=Im(a.h,c,t,g);return rk(v,function(E){return f=E})}var A=null;return U.create({next:function(){for(;;){if(!A){var E=t.next(0);if(E.done)return Q;E=a.h.o(E.value,g);A=rk(E,function(I){return f=ok(f,I)}).value}E=A.next(0);if(E.done)A=null;else return E}}})}),p=!1;return{next:function(){if(p)return Q;var t=m.S();p=!0;return S(new ck(t,f))}}}\nHm.prototype.evaluate=function(a,c){var e=this;return this.C(a,Hh(a),c,function(g){if(e.h instanceof Hm)return Jm(e.h,a,g,c);var f=null;return U.create({next:function(m){for(;;){if(!f){var p=g.next(0);if(p.done)return Q;f=bk(e.h,p.value,c).value}p=f.next(m);if(p.done)f=null;else return p}}})})};Hm.prototype.o=function(a,c){return Im(this,a,Hh(a),c)};\nHm.prototype.P=function(a){V.prototype.P.call(this,a);this.I=this.h.I;a=H(this.J);for(var c=a.next();!c.done;c=a.next())if(c=c.value,c!==this.h&&c.I)throw Qj();};function Jm(a,c,e,g){return a.C(c,e,g,function(f){if(a.h instanceof Hm)return Jm(a.h,c,f,g);var m=null;return U.create({next:function(){for(;;){if(!m){var p=f.next(0);if(p.done)return Q;m=bk(a.h,p.value,g).value}p=m.next(0);if(p.done)m=null;else return p}}})})};function Km(a,c,e,g){Hm.call(this,c.K.add(g.K),[c,g],{A:!1},g);this.N=a.prefix;this.ka=a.namespaceURI;this.vb=a.localName;this.mb=null;this.v=e;this.ua=null;this.na=c}K(Km,Hm);\nKm.prototype.C=function(a,c,e,g){var f=this,m=null,p=null,t=0;return g({next:function(){for(var v={};;){if(!m){var A=c.next(0);if(A.done)return Q;p=A.value;t=0;m=bk(f.na,p,e).value}v.hb=m.next(0);if(v.hb.done)m=null;else return t++,A={},v=(A[f.mb]=function(E){return function(){return U.s(E.hb.value)}}(v),A),f.ua&&(v[f.ua]=function(){return U.s(new Sc(5,t))}),S(ag(p,v));v={hb:v.hb}}}})};\nKm.prototype.P=function(a){if(this.N&&(this.ka=a.ga(this.N),!this.ka&&this.N))throw Error(\"XPST0081: Could not resolve namespace for prefix \"+this.N+\" in a for expression\");this.na.P(a);Lm(a);this.mb=Mm(a,this.ka,this.vb);if(this.v){if(this.v.prefix&&(this.v.namespaceURI=a.ga(this.v.prefix),!this.v.namespaceURI&&this.v.prefix))throw Error(\"XPST0081: Could not resolve namespace for prefix \"+this.N+\" in the positionalVariableBinding in a for expression\");this.ua=Mm(a,this.v.namespaceURI,this.v.localName)}this.h.P(a);\nNm(a);if(this.na.I)throw Qj();this.h.I&&(this.I=!0)};function Om(a,c,e){var g={};V.call(this,new wk((g.external=1,g)),[e],{A:!1,T:\"unsorted\"});this.N=a.map(function(f){return f.name});this.v=a.map(function(f){return f.type});this.o=null;this.C=c;this.h=e}K(Om,V);\nOm.prototype.evaluate=function(a,c){var e=this,g=new ad({l:this.v,arity:this.v.length,Oa:!0,I:this.h.I,localName:\"dynamic-function\",namespaceURI:\"\",j:this.C,value:function(f,m,p,t){for(var v=[],A=3;ANumber.MAX_SAFE_INTEGER||!Number.isFinite(a))throw Error(\"FODT0002: Value overflow while dividing xs:yearMonthDuration\");return new gh(aNumber.MAX_SAFE_INTEGER||!Number.isFinite(a))throw Error(\"FODT0002: Value overflow while dividing xs:dayTimeDuration\");return new Ee(ae.X.value};case \"geOp\":return function(e,g){e=c(e,g);return e.W.value>=e.X.value}}}\nfunction qn(a,c){switch(a){case \"ltOp\":return function(e,g){e=c(e,g);return e.W.value.hae.X.value.ha};case \"geOp\":return function(e,g){g=c(e,g);e=g.W;g=g.X;return De(e.value,g.value)||e.value.ha>g.value.ha}}}\nfunction rn(a,c){switch(a){case \"eqOp\":return function(e,g){e=c(e,g);return De(e.W.value,e.X.value)};case \"ltOp\":return function(e,g){e=c(e,g);return e.W.value.eae.X.value.ea};case \"geOp\":return function(e,g){g=c(e,g);e=g.W;g=g.X;return De(e.value,g.value)||e.value.ea>g.value.ea}}}\nfunction sn(a,c){switch(a){case \"eqOp\":return function(e,g){e=c(e,g);return De(e.W.value,e.X.value)};case \"neOp\":return function(e,g){e=c(e,g);return!De(e.W.value,e.X.value)}}}\nfunction tn(a,c){switch(a){case \"eqOp\":return function(e,g,f){e=c(e,g);return Nf(e.W.value,e.X.value,$f(f))};case \"neOp\":return function(e,g,f){e=c(e,g);return!Nf(e.W.value,e.X.value,$f(f))};case \"ltOp\":return function(e,g,f){e=c(e,g);f=$f(f);return 0>Mf(e.W.value,e.X.value,f)};case \"leOp\":return function(e,g,f){g=c(e,g);e=g.W;g=g.X;var m;(m=Nf(e.value,g.value,$f(f)))||(f=$f(f),m=0>Mf(e.value,g.value,f));return m};case \"gtOp\":return function(e,g,f){e=c(e,g);f=$f(f);return 0Ph(c,f.first(),m.first())}:void 0;case \"nodeAfterOp\":return c?function(f,m){return 0Ph(c.h,p,t)){if(E=S(p),p=null,\"exceptOp\"===e.h)return E}else t=null}if(\"exceptOp\"===\ne.h)return null!==p?(E=S(p),p=null,E):f.next(0);v=!0;return Q}})};function Ln(a,c){sk.call(this,a.reduce(function(e,g){return e.add(g.K)},new wk({})),a,{T:\"unsorted\",A:a.every(function(e){return e.A})},c)}K(Ln,sk);Ln.prototype.v=function(a,c,e){return e.length?cg(e.map(function(g){return g(a)})):U.empty()};function Mn(a,c,e){V.call(this,(new wk({})).add(a.K),[a,c],{A:a.A&&c.A},!1,e);this.h=a;this.o=c}K(Mn,V);Mn.prototype.evaluate=function(a,c){var e=this,g=bk(this.h,a,c),f=Xf(a,g),m=null,p=null,t=!1;return U.create({next:function(v){for(;!t;){if(!m&&(m=f.next(v),m.done))return t=!0,Q;p||(p=bk(e.o,m.value,c));var A=p.value.next(v);if(A.done)m=p=null;else return A}}})};function Nn(a,c,e){V.call(this,a.K,[a],{A:!1});this.h=Xc(c.prefix?c.prefix+\":\"+c.localName:c.localName);if(46===this.h||45===this.h||44===this.h)throw Error(\"XPST0080: Casting to xs:anyAtomicType, xs:anySimpleType or xs:NOTATION is not permitted.\");if(c.namespaceURI)throw Error(\"Not implemented: castable as expressions with a namespace URI.\");this.v=a;this.o=e}K(Nn,V);\nNn.prototype.evaluate=function(a,c){var e=this,g=Sg(bk(this.v,a,c),c);return g.aa({empty:function(){return e.o?U.$():U.U()},s:function(){return g.map(function(f){return Fh(f,e.h).u?mc:nc})},multiple:function(){return U.U()}})};function On(a,c,e){V.call(this,a.K,[a],{A:!1});this.h=Xc(c.prefix?c.prefix+\":\"+c.localName:c.localName);if(46===this.h||45===this.h||44===this.h)throw Error(\"XPST0080: Casting to xs:anyAtomicType, xs:anySimpleType or xs:NOTATION is not permitted.\");if(c.namespaceURI)throw Error(\"Not implemented: casting expressions with a namespace URI.\");this.v=a;this.o=e}K(On,V);\nOn.prototype.evaluate=function(a,c){var e=this,g=Sg(bk(this.v,a,c),c);return g.aa({empty:function(){if(!e.o)throw Error(\"XPTY0004: Sequence to cast is empty while target type is singleton.\");return U.empty()},s:function(){return g.map(function(f){return Gh(f,e.h)})},multiple:function(){throw Error(\"XPTY0004: Sequence to cast is not singleton or empty.\");}})};function Pn(a,c){var e=a.value,g=null,f=!1;return U.create({next:function(){for(;!f;){if(!g){var m=e.next(0);if(m.done)return f=!0,S(mc);g=c(m.value)}m=g.getEffectiveBooleanValue();g=null;if(!1===m)return f=!0,S(nc)}return Q}})};function Qn(a,c,e,g){V.call(this,a.K,[a],{A:!1},!1,g);this.v=a;this.o=c;this.h=e}K(Qn,V);Qn.prototype.evaluate=function(a,c){var e=this,g=bk(this.v,a,c);return g.aa({empty:function(){return\"?\"===e.h||\"*\"===e.h?U.$():U.U()},multiple:function(){return\"+\"===e.h||\"*\"===e.h?Pn(g,function(f){var m=U.s(f);f=Yf(a,0,f,m);return bk(e.o,f,c)}):U.U()},s:function(){return Pn(g,function(f){var m=U.s(f);f=Yf(a,0,f,m);return bk(e.o,f,c)})}})};function Rn(a,c){return null!==a&&null!==c&&T(a.type,53)&&T(c.type,53)?Jh(a.value,c.value):!1}function Sn(a){var c=a.next(0);if(c.done)return U.empty();var e=null,g=null;return U.create({next:function(f){if(c.done)return Q;e||(e=c.value.value);do{var m=e.next(f);if(m.done){c=a.next(0);if(c.done)return m;e=c.value.value}}while(m.done||Rn(m.value,g));g=m.value;return m}})}\nfunction Tn(a,c){var e=[];(function(){for(var p=c.next(0),t={};!p.done;)t.jb=p.value.value,p={current:t.jb.next(0),next:function(v){return function(A){return v.jb.next(A)}}(t)},p.current.done||e.push(p),p=c.next(0),t={jb:t.jb}})();var g=null,f=!1,m={};return U.create((m[Symbol.iterator]=function(){return this},m.next=function(){f||(f=!0,e.every(function(M){return T(M.current.value.type,53)})&&e.sort(function(M,O){return Ph(a,M.current.value,O.current.value)}));do{if(!e.length)return Q;var p=e.shift();\nvar t=p.current;p.current=p.next(0);if(!T(t.value.type,53))return t;if(!p.current.done){for(var v=0,A=e.length-1,E=0;v<=A;){E=Math.floor((v+A)/2);var I=Ph(a,p.current.value,e[E].current.value);if(0===I){v=E;break}0=e.h.length?Q:S(bk(e.h[g++],a,c))}}).map(function(f){if(!T(f.type,53))throw Error(\"XPTY0004: The sequences to union are not of type node()*\");return f})}return cg(this.h.map(function(f){return bk(f,a,c)})).M(function(f){if(f.some(function(m){return!T(m.type,53)}))throw Error(\"XPTY0004: The sequences to union are not of type node()*\");f=Qh(c.h,f);return U.create(f)})};function Vn(a){return a.every(function(c){return null===c||T(c.type,5)||T(c.type,4)})||null!==a.map(function(c){return c?Tg(c.type):null}).reduce(function(c,e){return null===e?c:e===c?c:null})?a:a.every(function(c){return null===c||T(c.type,1)||T(c.type,20)})?a.map(function(c){return c?Gh(c,1):null}):a.every(function(c){return null===c||T(c.type,4)||T(c.type,6)})?a.map(function(c){return c?Gh(c,6):c}):a.every(function(c){return null===c||T(c.type,4)||T(c.type,6)||T(c.type,3)})?a.map(function(c){return c?\nGh(c,3):c}):null};function Wn(a){return Error(\"XPTY0004: \"+a)}function Xn(a,c){a=2===a.node.nodeType?a.node.nodeName+'=\"'+yd(c,a)+'\"':a.node.outerHTML;return Error(\"XQTY0024: The node \"+a+\" follows a node that is not an attribute node or a namespace node.\")}function Yn(){return Error(\"XQST0045: Functions and variables may not be declared in one of the reserved namespace URIs.\")}function Zn(){return Error(\"XQST0060: Functions declared in a module or as an external function must reside in a namespace.\")}\nfunction $n(){return Error(\"XQST0070: The prefixes xml and xmlns may not be used in a namespace declaration or be bound to another namespaceURI.\")}function ao(a){return Error('XQDY0074: The value \"'+a+'\" of a name expressions cannot be converted to an expanded QName.')}function bo(a){return Error('XPST0081: The prefix \"'+a+'\" could not be resolved')};function co(a){return(a=a.find(function(c){return!!c}))?Tg(a.type):null}function eo(a,c){var e=new wk({});Hm.call(this,e,[c].concat(ia(a.map(function(g){return g.ia}))),{A:!1,Z:!1,T:\"unsorted\",subtree:!1},c);this.v=a}K(eo,Hm);\neo.prototype.C=function(a,c,e,g){if(this.v[1])throw Error(\"More than one order spec is not supported for the order by clause.\");var f=[],m=!1,p,t,v=null,A=this.v[0];return U.create({next:function(){if(!m){for(var E=c.next(0);!E.done;)f.push(E.value),E=c.next(0);E=f.map(function(xa){return A.ia.evaluate(xa,e)}).map(function(xa){return Sg(xa,e)});if(E.find(function(xa){return!xa.F()&&!xa.za()}))throw Wn(\"Order by only accepts empty or singleton sequences\");p=E.map(function(xa){return xa.first()});p=\np.map(function(xa){return null===xa?xa:T(19,xa.type)?Gh(xa,1):xa});if(co(p)&&(p=Vn(p),!p))throw Wn(\"Could not cast values\");E=p.length;t=p.map(function(xa,x){return x});for(var I=0;I=p.length?Q:S(f[t[Ba++]]):0>Ba?Q:S(f[t[Ba--]])}}).value;m=!0}return v.next(0)}})};function fo(a){V.call(this,a?a.K:new wk({}),a?[a]:[],{T:\"sorted\",subtree:!1,Z:!1,A:!1});this.h=a}K(fo,V);fo.prototype.evaluate=function(a,c){if(null===a.O)throw Error(\"XPDY0002: context is absent, it needs to be present to use paths.\");for(var e=c.h,g=a.O.value;9!==g.node.nodeType;)if(g=Xd(e,g),null===g)throw Error(\"XPDY0050: the root node of the context node is not a document node.\");e=U.s(be(g));return this.h?bk(this.h,Yf(a,0,e.first(),e),c):e};function go(a){V.call(this,new wk({}),[],{T:\"sorted\"},!1,a)}K(go,V);go.prototype.evaluate=function(a){if(null===a.O)throw Error('XPDY0002: context is absent, it needs to be present to use the \".\" operator');return U.s(a.O)};function ho(a,c){var e=!1,g=!1;c.forEach(function(f){T(f.type,53)?e=!0:g=!0});if(g&&e)throw Error(\"XPTY0018: The path operator should either return nodes or non-nodes. Mixed sequences are not allowed.\");return e?Qh(a,c):c}function io(a,c){var e=a.every(function(f){return f.Z}),g=a.every(function(f){return f.subtree});V.call(this,a.reduce(function(f,m){return f.add(m.K)},new wk({})),a,{A:!1,Z:e,T:c?\"sorted\":\"unsorted\",subtree:g});this.h=a;this.o=c}K(io,V);\nio.prototype.evaluate=function(a,c){var e=this,g=!0;return this.h.reduce(function(f,m,p){var t=null===f?Hh(a):Xf(a,f);f={next:function(E){E=t.next(E);if(E.done)return Q;if(null!==E.value.O&&!T(E.value.O.type,53)&&0=g)throw Error(\"FOAY0001: Array index out of bounds\");e.push(a.R[g-1]())}else throw Wn(\"The key specifier is not an integer.\");else if(T(a.type,61))\"*\"===c?e.push.apply(e,ia(a.h.map(function(f){return f.value()}))):(a=a.h.find(function(f){return de(f.key,c)}))&&e.push(a.value());else throw Wn(\"The provided context item is not a map or an array.\");\nreturn cg(e)}function lo(a,c,e,g,f){if(\"*\"===c)return ko(a,c,e);c=bk(c,g,f);c=Rc(c)().M(function(m){return m.reduce(function(p,t){return ko(a,t,p)},new Ac)});return cg([e,c])};function ns(a,c){V.call(this,a.K,[a].concat(\"*\"===c?[]:[c]),{A:a.A,T:a.B,subtree:a.subtree});this.h=a;this.o=c}K(ns,V);ns.prototype.evaluate=function(a,c){var e=this;return bk(this.h,a,c).M(function(g){return g.reduce(function(f,m){return lo(m,e.o,f,a,c)},new Ac)})};ns.prototype.Y=function(){return this.h.Y()};function os(a,c){var e={};V.call(this,new wk((e.external=1,e)),\"*\"===a?[]:[a],{A:!1},!1,c);this.h=a}K(os,V);os.prototype.evaluate=function(a,c){return lo(a.O,this.h,new Ac,a,c)};function ps(a,c,e,g){var f=c.map(function(p){return p.eb});c=c.map(function(p){return p.name});var m=f.reduce(function(p,t){return p.add(t.K)},e.K);V.call(this,m,f.concat(e),{A:!1},!1,g);this.o=a;this.v=c;this.C=f;this.N=e;this.h=null}K(ps,V);\nps.prototype.evaluate=function(a,c){var e=this,g=a,f=this.h.map(function(E,I){var M=bk(e.C[I],g,c).S();I={};g=ag(a,(I[E]=function(){return U.create(M)},I));return M});if(f.some(function(E){return 0===E.length}))return\"every\"===this.o?U.$():U.U();var m=Array(f.length).fill(0);m[0]=-1;for(var p=!0;p;){p=!1;for(var t=0,v=m.length;tA.length-1)m[t]=0;else{p=Object.create(null);t={};for(v=0;v\"))throw Error('XQDY0026: The content \"'+v+'\" for a processing instruction node contains \"?>\".');t=!0;return S({H:[],fa:ok([new Os(g.value,\nv)],p,f)})}}}}function dt(a,c,e){pk.call(this,new wk({}),[c,e],{A:!1,T:\"unsorted\"});this.C=a;this.h=c;this.v=e}K(dt,pk);dt.prototype.o=function(a,c){var e=qk(this.h)(a,c);a=qk(this.v)(a,c);return this.C?ct(c,e,a):bt(c,e,a)};function et(a){switch(a.type){case \"delete\":return new Ds({node:a.target,G:null});case \"insertAfter\":return new Fs({node:a.target,G:null},a.content.map(function(c){return{node:c,G:null}}));case \"insertBefore\":return new Hs({node:a.target,G:null},a.content.map(function(c){return{node:c,G:null}}));case \"insertInto\":return new Ks({node:a.target,G:null},a.content.map(function(c){return{node:c,G:null}}));case \"insertIntoAsFirst\":return new Is({node:a.target,G:null},a.content.map(function(c){return{node:c,\nG:null}}));case \"insertIntoAsLast\":return new Js({node:a.target,G:null},a.content.map(function(c){return{node:c,G:null}}));case \"insertAttributes\":return new Gs({node:a.target,G:null},a.content.map(function(c){return{node:c,G:null}}));case \"rename\":return new Ls({node:a.target,G:null},a.newName);case \"replaceNode\":return new Ns({node:a.target,G:null},a.replacement.map(function(c){return{node:c,G:null}}));case \"replaceValue\":return new Os({node:a.target,G:null},a[\"string-value\"]);case \"replaceElementContent\":return new Ms({node:a.target,\nG:null},a.text?{node:a.text,G:null}:null);default:throw Error('Unexpected type \"'+a.type+'\" when parsing a transferable pending update.');}};function ft(a,c,e){if(c.find(function(f){return Jh(f,a)}))return!0;var g=Xd(e,a);return g?ft(g,c,e):!1}function gt(a,c,e){pk.call(this,new wk({}),a.reduce(function(g,f){g.push(f.eb);return g},[c,e]),{A:!1,T:\"unsorted\"});this.h=a;this.C=c;this.v=e;this.I=null}K(gt,pk);gt.prototype.evaluate=function(a,c){a=this.o(a,c);return rk(a,function(){})};\ngt.prototype.o=function(a,c){var e=this,g=c.h,f=c.o,m=c.B,p=[],t,v,A,E=[],I=[];return{next:function(){if(E.length!==e.h.length)for(var M={},O=E.length;O\"))throw Error('XQDY0026: The contents of the data of a processing instruction may not include \"?>\"');if(null!==e.h.Mb)return f=e.h.Mb,lt(f),U.s(be(mt(f,m)));f=bk(e.h.Db,a,c);var p=Zs(c,f);return U.create({next:function(){var t=p.next(0);if(t.done)return t;t=t.value.value;lt(t);return S(be(mt(t,m)))}})})};function ot(a){V.call(this,a?a.K:new wk({}),a?[a]:[],{A:!1,T:\"unsorted\"});this.h=a}K(ot,V);ot.prototype.evaluate=function(a,c){if(!this.h)return U.empty();a=bk(this.h,a,c);return Sg(a,c).M(function(e){if(0===e.length)return U.empty();e={node:{data:e.map(function(g){return Gh(g,1).value}).join(\" \"),Pa:!0,nodeType:3},G:null};return U.s(be(e))})};function pt(a,c,e,g){var f=new wk({}),m;sk.call(this,f,(m=[a].concat(ia(c.map(function(p){return p.jc})),[e])).concat.apply(m,ia(c.map(function(p){return p.Ob.map(function(t){return t.Nb})}))),{A:!1,Z:!1,T:\"unsorted\",subtree:!1},g);this.C=a;this.h=c.length;this.N=c.map(function(p){return p.Ob})}K(pt,sk);\npt.prototype.v=function(a,c,e){var g=this;return e[0](a).M(function(f){for(var m=0;mf.length)return!1;break;default:if(1!==f.length)return!1}var t=U.create(f);return f.every(function(v,A){v=Yf(a,A,v,t);return bk(p.Nb,v,c).getEffectiveBooleanValue()})}))return e[m+1](a);return e[g.h+1](a)})};pt.prototype.P=function(a){sk.prototype.P.call(this,a);if(this.C.I)throw Qj();};var qt={ca:!1,qa:!1},rt={ca:!0,qa:!1},st={ca:!0,qa:!0};function tt(a){return a.ca?a.qa?st:rt:qt}\nfunction Z(a,c){switch(a[0]){case \"andOp\":var e=cm(a,\"type\");return new mn(ut(\"andOp\",a,tt(c)),e);case \"orOp\":return e=cm(a,\"type\"),new nn(ut(\"orOp\",a,tt(c)),e);case \"unaryPlusOp\":return e=W(W(a,\"operand\"),\"*\"),a=cm(a,\"type\"),new ln(\"+\",Z(e,c),a);case \"unaryMinusOp\":return e=W(W(a,\"operand\"),\"*\"),a=cm(a,\"type\"),new ln(\"-\",Z(e,c),a);case \"addOp\":case \"subtractOp\":case \"multiplyOp\":case \"divOp\":case \"idivOp\":case \"modOp\":var g=a[0],f=Z(dm(a,[\"firstOperand\",\"*\"]),tt(c));c=Z(dm(a,[\"secondOperand\",\"*\"]),\ntt(c));var m=cm(a,\"type\"),p=cm(dm(a,[\"firstOperand\",\"*\"]),\"type\"),t=cm(dm(a,[\"secondOperand\",\"*\"]),\"type\");p&&t&&cm(a,\"type\")&&(e=dn(g,p.type,t.type));return new hn(g,f,c,m,e);case \"sequenceExpr\":return vt(a,c);case \"unionOp\":return e=cm(a,\"type\"),new Un([Z(dm(a,[\"firstOperand\",\"*\"]),tt(c)),Z(dm(a,[\"secondOperand\",\"*\"]),tt(c))],e);case \"exceptOp\":case \"intersectOp\":return e=cm(a,\"type\"),new Kn(a[0],Z(dm(a,[\"firstOperand\",\"*\"]),tt(c)),Z(dm(a,[\"secondOperand\",\"*\"]),tt(c)),e);case \"stringConcatenateOp\":return wt(a,\nc);case \"rangeSequenceExpr\":return xt(a,c);case \"equalOp\":case \"notEqualOp\":case \"lessThanOrEqualOp\":case \"lessThanOp\":case \"greaterThanOrEqualOp\":case \"greaterThanOp\":case \"eqOp\":case \"neOp\":case \"ltOp\":case \"leOp\":case \"gtOp\":case \"geOp\":case \"isOp\":case \"nodeBeforeOp\":case \"nodeAfterOp\":return e=dm(a,[\"firstOperand\",\"*\"]),g=dm(a,[\"secondOperand\",\"*\"]),f=cm(e,\"type\"),m=cm(g,\"type\"),new Hn(a[0],Z(e,tt(c)),Z(g,tt(c)),f,m);case \"pathExpr\":return yt(a,c);case \"contextItemExpr\":return a=cm(a,\"type\"),\nnew go(a);case \"functionCallExpr\":return zt(a,c);case \"inlineFunctionExpr\":return At(a,c);case \"arrowExpr\":return Bt(a,c);case \"dynamicFunctionInvocationExpr\":return Ct(a,c);case \"namedFunctionRef\":return c=W(a,\"functionName\"),e=cm(a,\"type\"),a=bm(dm(a,[\"integerConstantExpr\",\"value\"])),new Xm(fm(c),parseInt(a,10),e);case \"integerConstantExpr\":return new Qm(bm(W(a,\"value\")),{type:5,g:3});case \"stringConstantExpr\":return new Qm(bm(W(a,\"value\")),{type:1,g:3});case \"decimalConstantExpr\":return new Qm(bm(W(a,\n\"value\")),{type:4,g:3});case \"doubleConstantExpr\":return new Qm(bm(W(a,\"value\")),{type:3,g:3});case \"varRef\":return a=fm(W(a,\"name\")),new vs(a.prefix,a.namespaceURI,a.localName);case \"flworExpr\":return Dt(a,c);case \"quantifiedExpr\":return Et(a,c);case \"ifThenElseExpr\":return e=cm(a,\"type\"),new Em(Z(W(W(a,\"ifClause\"),\"*\"),tt(c)),Z(W(W(a,\"thenClause\"),\"*\"),c),Z(W(W(a,\"elseClause\"),\"*\"),c),e);case \"instanceOfExpr\":return e=Z(dm(a,[\"argExpr\",\"*\"]),c),g=dm(a,[\"sequenceType\",\"*\"]),f=dm(a,[\"sequenceType\",\n\"occurrenceIndicator\"]),a=cm(a,\"type\"),new Qn(e,Z(g,tt(c)),f?bm(f):\"\",a);case \"castExpr\":return c=Z(W(W(a,\"argExpr\"),\"*\"),tt(c)),e=W(a,\"singleType\"),a=fm(W(e,\"atomicType\")),e=null!==W(e,\"optional\"),new On(c,a,e);case \"castableExpr\":return c=Z(W(W(a,\"argExpr\"),\"*\"),tt(c)),e=W(a,\"singleType\"),a=fm(W(e,\"atomicType\")),e=null!==W(e,\"optional\"),new Nn(c,a,e);case \"simpleMapExpr\":return Ft(a,c);case \"mapConstructor\":return Gt(a,c);case \"arrayConstructor\":return Ht(a,c);case \"unaryLookup\":return e=cm(a,\"type\"),\nnew os(It(a,c),e);case \"typeswitchExpr\":return Jt(a,c);case \"elementConstructor\":return Kt(a,c);case \"attributeConstructor\":return Lt(a,c);case \"computedAttributeConstructor\":return(e=W(a,\"tagName\"))?e=fm(e):(e=W(a,\"tagNameExpr\"),e={Ja:Z(W(e,\"*\"),tt(c))}),a=Z(W(W(a,\"valueExpr\"),\"*\"),tt(c)),new it(e,{tb:[a]});case \"computedCommentConstructor\":if(!c.ca)throw Error(\"XPST0003: Use of XQuery functionality is not allowed in XPath context\");a=(a=W(a,\"argExpr\"))?Z(W(a,\"*\"),tt(c)):null;return new jt(a);case \"computedTextConstructor\":if(!c.ca)throw Error(\"XPST0003: Use of XQuery functionality is not allowed in XPath context\");\na=(a=W(a,\"argExpr\"))?Z(W(a,\"*\"),tt(c)):null;return new ot(a);case \"computedElementConstructor\":return Mt(a,c);case \"computedPIConstructor\":if(!c.ca)throw Error(\"XPST0003: Use of XQuery functionality is not allowed in XPath context\");e=W(a,\"piTargetExpr\");g=W(a,\"piTarget\");f=W(a,\"piValueExpr\");a=cm(a,\"type\");return new nt({Db:e?Z(W(e,\"*\"),tt(c)):null,Mb:g?bm(g):null},f?Z(W(f,\"*\"),tt(c)):new Ln([],a));case \"CDataSection\":return new Qm(bm(a),{type:1,g:3});case \"deleteExpr\":return a=Z(dm(a,[\"targetExpr\",\n\"*\"]),c),new Qs(a);case \"insertExpr\":e=Z(dm(a,[\"sourceExpr\",\"*\"]),c);f=em(a,\"*\")[1];switch(f[0]){case \"insertAfter\":g=1;break;case \"insertBefore\":g=2;break;case \"insertInto\":g=(g=W(f,\"*\"))?\"insertAsFirst\"===g[0]?4:5:3}a=Z(dm(a,[\"targetExpr\",\"*\"]),c);return new Us(e,g,a);case \"renameExpr\":return e=Z(dm(a,[\"targetExpr\",\"*\"]),c),a=Z(dm(a,[\"newNameExpr\",\"*\"]),c),new at(e,a);case \"replaceExpr\":return e=!!W(a,\"replaceValue\"),g=Z(dm(a,[\"targetExpr\",\"*\"]),c),a=Z(dm(a,[\"replacementExpr\",\"*\"]),c),new dt(e,\ng,a);case \"transformExpr\":return Nt(a,c);case \"x:stackTrace\":e=a[1];for(a=a[2];\"x:stackTrace\"===a[0];)a=a[2];return new Gm(e,a[0],Z(a,c));default:return Ot(a)}}\nfunction Ot(a){switch(a[0]){case \"nameTest\":return new ss(fm(a));case \"piTest\":return(a=W(a,\"piTarget\"))?new ts(bm(a)):new rs(7);case \"commentTest\":return new rs(8);case \"textTest\":return new rs(3);case \"documentTest\":return new rs(9);case \"attributeTest\":var c=(a=W(a,\"attributeName\"))&&W(a,\"star\");return!a||c?new rs(2):new ss(fm(W(a,\"QName\")),{kind:2});case \"elementTest\":return c=(a=W(a,\"elementName\"))&&W(a,\"star\"),!a||c?new rs(1):new ss(fm(W(a,\"QName\")),{kind:1});case \"anyKindTest\":return new us({prefix:\"\",\nnamespaceURI:null,localName:\"node()\"});case \"anyMapTest\":return new us({prefix:\"\",namespaceURI:null,localName:\"map(*)\"});case \"anyArrayTest\":return new us({prefix:\"\",namespaceURI:null,localName:\"array(*)\"});case \"Wildcard\":return W(a,\"star\")?(c=W(a,\"uri\"))?a=new ss({localName:\"*\",namespaceURI:bm(c),prefix:\"\"}):(c=W(a,\"NCName\"),a=\"star\"===W(a,\"*\")[0]?new ss({localName:bm(c),namespaceURI:null,prefix:\"*\"}):new ss({localName:\"*\",namespaceURI:null,prefix:bm(c)})):a=new ss({localName:\"*\",namespaceURI:null,\nprefix:\"*\"}),a;case \"atomicType\":return a=fm(a),new us(a);case \"anyItemType\":return new us({prefix:\"\",namespaceURI:null,localName:\"item()\"});default:throw Error(\"No selector counterpart for: \"+a[0]+\".\");}}function Ht(a,c){var e=cm(a,\"type\");a=W(a,\"*\");var g=em(a,\"arrayElem\").map(function(f){return Z(W(f,\"*\"),tt(c))});switch(a[0]){case \"curlyArray\":return new im(g,e);case \"squareArray\":return new jm(g,e);default:throw Error(\"Unrecognized arrayType: \"+a[0]);}}\nfunction Gt(a,c){var e=cm(a,\"type\");return new Rm(em(a,\"mapConstructorEntry\").map(function(g){return{key:Z(dm(g,[\"mapKeyExpr\",\"*\"]),tt(c)),value:Z(dm(g,[\"mapValueExpr\",\"*\"]),tt(c))}}),e)}function ut(a,c,e){function g(m){var p=W(m,\"firstOperand\")[1];m=W(m,\"secondOperand\")[1];p[0]===a?g(p):f.push(Z(p,e));m[0]===a?g(m):f.push(Z(m,e))}var f=[];g(c);return f}function It(a,c){a=W(a,\"*\");switch(a[0]){case \"NCName\":return new Qm(bm(a),{type:1,g:3});case \"star\":return\"*\";default:return Z(a,tt(c))}}\nfunction Pt(a,c,e){a=em(a,\"*\");return new eo(a.filter(function(g){return\"stable\"!==g[0]}).map(function(g){var f=W(g,\"orderModifier\"),m=f?W(f,\"orderingKind\"):null;f=f?W(f,\"emptyOrderingMode\"):null;m=m?\"ascending\"===bm(m):!0;f=f?\"empty least\"===bm(f):!0;return{ia:Z(dm(g,[\"orderByExpr\",\"*\"]),c),Ib:m,mc:f}}),e)}\nfunction Dt(a,c){var e=em(a,\"*\");a=W(e[e.length-1],\"*\");e=e.slice(0,-1);if(1m)return f;m-=f.length;p+=p.repeat(m);return f+p.slice(0,m)}(function(f,m){function p(){this.constructor=f}p.prototype=m.prototype;f.prototype=new p})(e,Error);e.prototype.format=function(f){var m=\"Error: \"+this.message;if(this.location){var p=null,t;for(t=0;tHc&&(Hc=b,Dk=[]),Dk.push(h))}function Ka(){var h,u,k=233*b;if(h=z[k])return b=h.i,h.result;h=b;F();var l=233*b+2;if(u=z[l])b=u.i,l=u.result;else{u=b;if(f.substr(b,6)===mo){var n=mo;b+=6}else n=d,0===w&&x(xv);if(n!==d){F();n=b;if(f.substr(b,8)===Yh){var q=Yh;b+=8}else q=d,0===w&&x(no);q!==d?(q=P(),q!==d?(q=\nbb(),q!==d?(B=n,n=[\"encoding\",q]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d);if(n===d)if(n=b,f.substr(b,7)===oo?(q=oo,b+=7):(q=d,0===w&&x(yv)),q!==d)if(q=P(),q!==d)if(q=bb(),q!==d){var r=b;var y=P();y!==d?(f.substr(b,8)===Yh?(y=Yh,b+=8):(y=d,0===w&&x(no)),y!==d?(y=P(),y!==d?(y=bb(),y!==d?(B=r,r=y):(b=r,r=d)):(b=r,r=d)):(b=r,r=d)):(b=r,r=d);r===d&&(r=null);B=n;n=[[\"version\",q]].concat(r?[[\"encoding\",r]]:[])}else b=n,n=d;else b=n,n=d;else b=n,n=d;n!==d?(F(),q=Ib(),q!==d?(B=u,u=[\"versionDecl\"].concat(n)):(b=u,\nu=d)):(b=u,u=d)}else b=u,u=d;z[l]={i:b,result:u};l=u}l===d&&(l=null);F();u=233*b+3;if(n=z[u])b=n.i,u=n.result;else{n=b;q=233*b+4;if(r=z[q])b=r.i,q=r.result;else{r=b;f.substr(b,6)===Zh?(y=Zh,b+=6):(y=d,0===w&&x(po));if(y!==d)if(y=P(),y!==d)if(f.substr(b,9)===Jb?(y=Jb,b+=9):(y=d,0===w&&x(ge)),y!==d)if(y=P(),y!==d){y=b;var C=Kb();y=C!==d?f.substring(y,b):C;if(y!==d)if(F(),61===f.charCodeAt(b)?(C=Cd,b++):(C=d,0===w&&x(Dd)),C!==d)if(F(),C=bb(),C!==d){F();var J=Ib();J!==d?(B=r,r=[\"moduleDecl\",[\"prefix\",\ny],[\"uri\",C]]):(b=r,r=d)}else b=r,r=d;else b=r,r=d;else b=r,r=d}else b=r,r=d;else b=r,r=d;else b=r,r=d;else b=r,r=d;z[q]={i:b,result:r};q=r}q!==d?(F(),r=ac(),B=n,n=[\"libraryModule\",q].concat(r?[r]:[])):(b=n,n=d);z[u]={i:b,result:n};u=n}u===d&&(u=233*b+1,(n=z[u])?(b=n.i,u=n.result):(n=b,q=ac(),F(),r=233*b+36,(y=z[r])?(b=y.i,r=y.result):(y=b,C=pc(),C!==d&&(B=y,C=[\"queryBody\",C]),y=C,z[r]={i:b,result:y},r=y),r!==d?(B=n,n=[\"mainModule\"].concat(q?[q]:[],[r])):(b=n,n=d),z[u]={i:b,result:n},u=n));u!==d?\n(F(),B=h,h=[\"module\"].concat(l?[l]:[],[u])):(b=h,h=d);z[k]={i:b,result:h};return h}function ac(){var h,u=233*b+5;if(h=z[u])return b=h.i,h.result;h=b;var k=[];var l=b;var n=Ed();n===d&&(n=fg(),n===d&&(n=Ic(),n===d&&(n=Fa())));if(n!==d){F();var q=Ib();q!==d?(F(),B=l,l=n):(b=l,l=d)}else b=l,l=d;for(;l!==d;)k.push(l),l=b,n=Ed(),n===d&&(n=fg(),n===d&&(n=Ic(),n===d&&(n=Fa()))),n!==d?(F(),q=Ib(),q!==d?(F(),B=l,l=n):(b=l,l=d)):(b=l,l=d);l=[];n=b;q=qo();q===d&&(q=Ne(),q===d&&(q=ro()));if(q!==d){F();var r=\nIb();r!==d?(F(),B=n,n=q):(b=n,n=d)}else b=n,n=d;for(;n!==d;)l.push(n),n=b,q=qo(),q===d&&(q=Ne(),q===d&&(q=ro())),q!==d?(F(),r=Ib(),r!==d?(F(),B=n,n=q):(b=n,n=d)):(b=n,n=d);B=h;h=0===k.length&&0===l.length?null:[\"prolog\"].concat(k,l);z[u]={i:b,result:h};return h}function Ib(){var h,u=233*b+6;if(h=z[u])return b=h.i,h.result;59===f.charCodeAt(b)?(h=$h,b++):(h=d,0===w&&x(ai));z[u]={i:b,result:h};return h}function fg(){var h,u=233*b+7;if(h=z[u])return b=h.i,h.result;var k;h=233*b+8;if(k=z[h])b=k.i,h=k.result;\nelse{k=b;if(f.substr(b,7)===La){var l=La;b+=7}else l=d,0===w&&x(Sb);l!==d?(l=P(),l!==d?(f.substr(b,14)===so?(l=so,b+=14):(l=d,0===w&&x(zv)),l!==d?(l=P(),l!==d?(f.substr(b,8)===Oe?(l=Oe,b+=8):(l=d,0===w&&x(Ek)),l===d&&(f.substr(b,5)===bi?(l=bi,b+=5):(l=d,0===w&&x(to))),l!==d?(B=k,k=[\"boundarySpaceDecl\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d);z[h]={i:b,result:k};h=k}if(h===d&&(h=233*b+9,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,7)===La?(l=La,b+=7):(l=d,0===w&&x(Sb)),l!==d?(l=P(),\nl!==d?(f.substr(b,7)===bc?(l=bc,b+=7):(l=d,0===w&&x(Pe)),l!==d?(l=P(),l!==d?(f.substr(b,9)===Qe?(l=Qe,b+=9):(l=d,0===w&&x(Fk)),l!==d?(l=P(),l!==d?(l=bb(),l!==d?(B=k,k=[\"defaultCollationDecl\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),z[h]={i:b,result:k},h=k),h===d&&(h=233*b+10,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,7)===La?(l=La,b+=7):(l=d,0===w&&x(Sb)),l!==d?(l=P(),l!==d?(f.substr(b,8)===uo?(l=uo,b+=8):(l=d,0===w&&x(Av)),l!==d?(l=P(),l!==d?(l=bb(),l!==d?\n(B=k,k=[\"baseUriDecl\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),z[h]={i:b,result:k},h=k),h===d&&(h=233*b+11,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,7)===La?(l=La,b+=7):(l=d,0===w&&x(Sb)),l!==d?(l=P(),l!==d?(f.substr(b,12)===vo?(l=vo,b+=12):(l=d,0===w&&x(Bv)),l!==d?(l=P(),l!==d?(f.substr(b,5)===bi?(l=bi,b+=5):(l=d,0===w&&x(to)),l===d&&(f.substr(b,8)===Oe?(l=Oe,b+=8):(l=d,0===w&&x(Ek))),l!==d?(B=k,k=[\"constructionDecl\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),z[h]=\n{i:b,result:k},h=k),h===d&&(h=233*b+12,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,7)===La?(l=La,b+=7):(l=d,0===w&&x(Sb)),l!==d?(l=P(),l!==d?(f.substr(b,8)===wo?(l=wo,b+=8):(l=d,0===w&&x(Cv)),l!==d?(l=P(),l!==d?(f.substr(b,7)===xo?(l=xo,b+=7):(l=d,0===w&&x(Dv)),l===d&&(f.substr(b,9)===yo?(l=yo,b+=9):(l=d,0===w&&x(Ev))),l!==d?(B=k,k=[\"orderingModeDecl\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),z[h]={i:b,result:k},h=k),h===d&&(h=233*b+13,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,7)===\nLa?(l=La,b+=7):(l=d,0===w&&x(Sb)),l!==d?(l=P(),l!==d?(f.substr(b,7)===bc?(l=bc,b+=7):(l=d,0===w&&x(Pe)),l!==d?(l=P(),l!==d?(f.substr(b,5)===Re?(l=Re,b+=5):(l=d,0===w&&x(Gk)),l!==d?(l=P(),l!==d?(f.substr(b,5)===Se?(l=Se,b+=5):(l=d,0===w&&x(Hk)),l!==d?(l=P(),l!==d?(f.substr(b,8)===ci?(l=ci,b+=8):(l=d,0===w&&x(zo)),l===d&&(f.substr(b,5)===di?(l=di,b+=5):(l=d,0===w&&x(Ao))),l!==d?(B=k,k=[\"emptyOrderDecl\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,\nk=d),z[h]={i:b,result:k},h=k),h===d)))))){var n;h=233*b+14;if(k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,7)===La?(l=La,b+=7):(l=d,0===w&&x(Sb));if(l!==d)if(l=P(),l!==d)if(f.substr(b,15)===Bo?(l=Bo,b+=15):(l=d,0===w&&x(Fv)),l!==d)if(l=P(),l!==d)if(l=233*b+15,(n=z[l])?(b=n.i,l=n.result):(f.substr(b,8)===Oe?(n=Oe,b+=8):(n=d,0===w&&x(Ek)),n===d&&(f.substr(b,11)===Co?(n=Co,b+=11):(n=d,0===w&&x(Gv))),z[l]={i:b,result:n},l=n),l!==d)if(F(),44===f.charCodeAt(b)?(n=ua,b++):(n=d,0===w&&x(va)),n!==d){F();var q;\nn=233*b+16;(q=z[n])?(b=q.i,n=q.result):(f.substr(b,7)===Do?(q=Do,b+=7):(q=d,0===w&&x(Hv)),q===d&&(f.substr(b,10)===Eo?(q=Eo,b+=10):(q=d,0===w&&x(Iv))),z[n]={i:b,result:q},n=q);n!==d?(B=k,k=[\"copyNamespacesDecl\",[\"preserveMode\",l],[\"inheritMode\",n]]):(b=k,k=d)}else b=k,k=d;else b=k,k=d;else b=k,k=d;else b=k,k=d;else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}if(h===d)if(h=233*b+17,k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,7)===La?(l=La,b+=7):(l=d,0===w&&x(Sb));if(l!==d)if(l=P(),l!==d){l=b;f.substr(b,\n14)===ei?(n=ei,b+=14):(n=d,0===w&&x(Fo));if(n!==d)if(q=P(),q!==d){var r=Aa();r!==d?(B=l,l=[\"decimalFormatName\"].concat(r)):(b=l,l=d)}else b=l,l=d;else b=l,l=d;l===d&&(l=b,f.substr(b,7)===bc?(n=bc,b+=7):(n=d,0===w&&x(Pe)),n!==d?(q=P(),q!==d?(f.substr(b,14)===ei?(r=ei,b+=14):(r=d,0===w&&x(Fo)),r!==d?(B=l,l=null):(b=l,l=d)):(b=l,l=d)):(b=l,l=d));if(l!==d){n=[];q=b;r=P();if(r!==d)if(r=qc(),r!==d){var y=P();y!==d?(61===f.charCodeAt(b)?(y=Cd,b++):(y=d,0===w&&x(Dd)),y!==d?(y=P(),y!==d?(y=bb(),y!==d?(B=q,\nq=R(l,r,y)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)}else b=q,q=d;else b=q,q=d;for(;q!==d;)n.push(q),q=b,r=P(),r!==d?(r=qc(),r!==d?(y=P(),y!==d?(61===f.charCodeAt(b)?(y=Cd,b++):(y=d,0===w&&x(Dd)),y!==d?(y=P(),y!==d?(y=bb(),y!==d?(B=q,q=R(l,r,y)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d);B=k;k=[\"decimalFormatDecl\"].concat(l?[l]:[],n)}else b=k,k=d}else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}}z[u]={i:b,result:h};return h}function qc(){var h,u=233*b+18;if(h=z[u])return b=\nh.i,h.result;f.substr(b,17)===Go?(h=Go,b+=17):(h=d,0===w&&x(Jv));h===d&&(f.substr(b,18)===Ho?(h=Ho,b+=18):(h=d,0===w&&x(Kv)),h===d&&(f.substr(b,8)===Io?(h=Io,b+=8):(h=d,0===w&&x(Lv)),h===d&&(f.substr(b,10)===Jo?(h=Jo,b+=10):(h=d,0===w&&x(Mv)),h===d&&(f.substr(b,3)===Ko?(h=Ko,b+=3):(h=d,0===w&&x(Nv)),h===d&&(f.substr(b,7)===Lo?(h=Lo,b+=7):(h=d,0===w&&x(Ov)),h===d&&(f.substr(b,9)===Mo?(h=Mo,b+=9):(h=d,0===w&&x(Pv)),h===d&&(f.substr(b,10)===No?(h=No,b+=10):(h=d,0===w&&x(Qv)),h===d&&(f.substr(b,5)===\nOo?(h=Oo,b+=5):(h=d,0===w&&x(Rv)),h===d&&(f.substr(b,17)===Po?(h=Po,b+=17):(h=d,0===w&&x(Sv)),h===d&&(f.substr(b,18)===Qo?(h=Qo,b+=18):(h=d,0===w&&x(Tv))))))))))));z[u]={i:b,result:h};return h}function Fa(){var h,u=233*b+19;if(h=z[u])return b=h.i,h.result;var k,l;h=233*b+20;if(k=z[h])b=k.i,h=k.result;else{k=b;if(f.substr(b,6)===fi){var n=fi;b+=6}else n=d,0===w&&x(Ro);if(n!==d)if(n=P(),n!==d)if(f.substr(b,6)===So?(n=So,b+=6):(n=d,0===w&&x(Uv)),n!==d){n=b;var q=P();if(q!==d){q=233*b+21;if(l=z[q])b=\nl.i,q=l.result;else{l=b;if(f.substr(b,9)===Jb){var r=Jb;b+=9}else r=d,0===w&&x(ge);if(r!==d){var y=P();if(y!==d){var C=Kb();if(C!==d){F();if(61===f.charCodeAt(b)){var J=Cd;b++}else J=d,0===w&&x(Dd);J!==d?(B=l,l=[\"namespacePrefix\",C]):(b=l,l=d)}else b=l,l=d}else b=l,l=d}else b=l,l=d;if(l===d){r=l=b;f.substr(b,7)===bc?(y=bc,b+=7):(y=d,0===w&&x(Pe));if(y!==d)if(C=P(),C!==d){if(f.substr(b,7)===Lb){var N=Lb;b+=7}else N=d,0===w&&x(he);if(N!==d)if(J=P(),J!==d){if(f.substr(b,9)===Jb){var oa=Jb;b+=9}else oa=\nd,0===w&&x(ge);if(oa!==d){var wb=za();wb!==d?r=y=[y,C,N,J,oa,wb]:(b=r,r=d)}else b=r,r=d}else b=r,r=d;else b=r,r=d}else b=r,r=d;else b=r,r=d;r!==d&&(B=l,r=[\"defaultElementNamespace\"]);l=r}z[q]={i:b,result:l};q=l}q!==d?(B=n,n=q):(b=n,n=d)}else b=n,n=d;n===d&&(n=null);F();q=bb();if(q!==d){l=b;r=P();if(r!==d)if(f.substr(b,2)===Te?(r=Te,b+=2):(r=d,0===w&&x(Ik)),r!==d)if(r=P(),r!==d)if(r=bb(),r!==d){y=[];C=b;N=P();N!==d?(44===f.charCodeAt(b)?(N=ua,b++):(N=d,0===w&&x(va)),N!==d?(N=P(),N!==d?(N=bb(),N!==\nd?(B=C,C=N):(b=C,C=d)):(b=C,C=d)):(b=C,C=d)):(b=C,C=d);for(;C!==d;)y.push(C),C=b,N=P(),N!==d?(44===f.charCodeAt(b)?(N=ua,b++):(N=d,0===w&&x(va)),N!==d?(N=P(),N!==d?(N=bb(),N!==d?(B=C,C=N):(b=C,C=d)):(b=C,C=d)):(b=C,C=d)):(b=C,C=d);B=l;l=[r].concat(y)}else b=l,l=d;else b=l,l=d;else b=l,l=d;else b=l,l=d;l===d&&(l=null);B=k;k=[\"schemaImport\"].concat(n?[n]:[],[[\"targetNamespace\",q]],l?[l]:[])}else b=k,k=d}else b=k,k=d;else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}if(h===d)if(h=233*b+22,k=z[h])b=k.i,\nh=k.result;else{k=b;f.substr(b,6)===fi?(n=fi,b+=6):(n=d,0===w&&x(Ro));if(n!==d)if(n=P(),n!==d)if(f.substr(b,6)===Zh?(n=Zh,b+=6):(n=d,0===w&&x(po)),n!==d)if(n=b,q=P(),q!==d?(f.substr(b,9)===Jb?(q=Jb,b+=9):(q=d,0===w&&x(ge)),q!==d?(l=P(),l!==d?(r=b,y=Kb(),r=y!==d?f.substring(r,b):y,r!==d?(F(),61===f.charCodeAt(b)?(y=Cd,b++):(y=d,0===w&&x(Dd)),y!==d?(B=n,n=r):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d),n===d&&(n=null),F(),q=bb(),q!==d){l=b;r=P();if(r!==d)if(f.substr(b,2)===Te?(y=Te,b+=2):(y=\nd,0===w&&x(Ik)),y!==d)if(y=P(),y!==d)if(r=bb(),r!==d)for(l=[],r=b,y=F(),44===f.charCodeAt(b)?(C=ua,b++):(C=d,0===w&&x(va)),C!==d?(N=F(),J=bb(),J!==d?r=y=[y,C,N,J]:(b=r,r=d)):(b=r,r=d);r!==d;)l.push(r),r=b,y=F(),44===f.charCodeAt(b)?(C=ua,b++):(C=d,0===w&&x(va)),C!==d?(N=F(),J=bb(),J!==d?r=y=[y,C,N,J]:(b=r,r=d)):(b=r,r=d);else b=l;else b=l;else b=l;else b=l;B=k;k=[\"moduleImport\",[\"namespacePrefix\",n],[\"targetNamespace\",q]]}else b=k,k=d;else b=k,k=d;else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}z[u]=\n{i:b,result:h};return h}function Ic(){var h,u=233*b+23;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,7)===La){var k=La;b+=7}else k=d,0===w&&x(Sb);if(k!==d)if(k=P(),k!==d)if(f.substr(b,9)===Jb?(k=Jb,b+=9):(k=d,0===w&&x(ge)),k!==d)if(k=P(),k!==d)if(k=Kb(),k!==d){F();if(61===f.charCodeAt(b)){var l=Cd;b++}else l=d,0===w&&x(Dd);l!==d?(F(),l=bb(),l!==d?(B=h,h=[\"namespaceDecl\",[\"prefix\",k],[\"uri\",l]]):(b=h,h=d)):(b=h,h=d)}else b=h,h=d;else b=h,h=d;else b=h,h=d;else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};\nreturn h}function Ed(){var h,u=233*b+24;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,7)===La){var k=La;b+=7}else k=d,0===w&&x(Sb);if(k!==d)if(k=P(),k!==d)if(f.substr(b,7)===bc?(k=bc,b+=7):(k=d,0===w&&x(Pe)),k!==d)if(k=P(),k!==d)if(f.substr(b,7)===Lb?(k=Lb,b+=7):(k=d,0===w&&x(he)),k===d&&(f.substr(b,8)===cc?(k=cc,b+=8):(k=d,0===w&&x(Ue))),k!==d){var l=P();l!==d?(f.substr(b,9)===Jb?(l=Jb,b+=9):(l=d,0===w&&x(ge)),l!==d?(l=P(),l!==d?(l=bb(),l!==d?(B=h,h=[\"defaultNamespaceDecl\",[\"defaultNamespaceCategory\",\nk],[\"uri\",l]]):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)}else b=h,h=d;else b=h,h=d;else b=h,h=d;else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function Ne(){var h,u=233*b+25;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,7)===La){var k=La;b+=7}else k=d,0===w&&x(Sb);if(k!==d)if(k=P(),k!==d){k=[];var l=b;var n=Ve();n===d&&(n=To());if(n!==d){var q=P();q!==d?(B=l,l=n):(b=l,l=d)}else b=l,l=d;for(;l!==d;)k.push(l),l=b,n=Ve(),n===d&&(n=To()),n!==d?(q=P(),q!==d?(B=l,l=n):(b=l,l=d)):(b=l,l=d);\nl=233*b+28;if(n=z[l])b=n.i,l=n.result;else{n=b;f.substr(b,8)===Uo?(q=Uo,b+=8):(q=d,0===w&&x(Vv));if(q!==d)if(q=P(),q!==d)if(36===f.charCodeAt(b)?(q=Jc,b++):(q=d,0===w&&x(Kc)),q!==d)if(F(),q=Aa(),q!==d){var r=b;F();var y=We();y!==d?(B=r,r=y):(b=r,r=d);r===d&&(r=null);var C=b;F();f.substr(b,2)===Mb?(y=Mb,b+=2):(y=d,0===w&&x(ie));y!==d?(F(),y=ta(),y!==d?(B=C,C=[\"varValue\",y]):(b=C,C=d)):(b=C,C=d);if(C===d)if(C=b,y=P(),y!==d)if(f.substr(b,8)===Xe?(y=Xe,b+=8):(y=d,0===w&&x(Jk)),y!==d){y=b;F();if(f.substr(b,\n2)===Mb){var J=Mb;b+=2}else J=d,0===w&&x(ie);J!==d?(F(),J=ta(),J!==d?(B=y,y=[\"varValue\",J]):(b=y,y=d)):(b=y,y=d);y===d&&(y=null);B=C;C=[\"external\"].concat(y?[y]:[])}else b=C,C=d;else b=C,C=d;C!==d?(B=n,n=[\"varDecl\",[\"varName\"].concat(q)].concat(r?[r]:[],[C])):(b=n,n=d)}else b=n,n=d;else b=n,n=d;else b=n,n=d;else b=n,n=d;z[l]={i:b,result:n};l=n}l===d&&(l=233*b+30,(n=z[l])?(b=n.i,l=n.result):(n=b,f.substr(b,8)===cc?(q=cc,b+=8):(q=d,0===w&&x(Ue)),q!==d?(q=P(),q!==d?(r=b,w++,q=Vo(),w--,q===d?r=void 0:\n(b=r,r=d),r!==d?(q=Aa(),q!==d?(F(),40===f.charCodeAt(b)?(r=fb,b++):(r=d,0===w&&x(gb)),r!==d?(F(),r=Wo(),r===d&&(r=null),F(),41===f.charCodeAt(b)?(C=Oa,b++):(C=d,0===w&&x(Pa)),C!==d?(C=b,y=P(),y!==d?(f.substr(b,2)===db?(y=db,b+=2):(y=d,0===w&&x(rc)),y!==d?(J=P(),J!==d?(y=Nb(),y!==d?(B=C,C=y):(b=C,C=d)):(b=C,C=d)):(b=C,C=d)):(b=C,C=d),C===d&&(C=null),F(),y=b,J=Xo(),J!==d&&(B=y,J=[\"functionBody\",J]),y=J,y===d&&(y=b,f.substr(b,8)===Xe?(J=Xe,b+=8):(J=d,0===w&&x(Jk)),J!==d&&(B=y,J=[\"externalDefinition\"]),\ny=J),y!==d?(B=n,n=[\"functionDecl\",[\"functionName\"].concat(q),[\"paramList\"].concat(r||[])].concat(C?[[\"typeDeclaration\"].concat(C)]:[],[y])):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d),z[l]={i:b,result:n},l=n));l!==d?(B=h,h=[l[0]].concat(k,l.slice(1))):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function To(){var h,u=233*b+26;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,8)===Yo){var k=Yo;b+=8}else k=d,0===w&&x(Wv);k!==d&&(B=h,k=[\"annotation\",\n[\"annotationName\",\"updating\"]]);h=k;z[u]={i:b,result:h};return h}function Ve(){var h,u=233*b+27;if(h=z[u])return b=h.i,h.result;h=b;if(37===f.charCodeAt(b)){var k=Xv;b++}else k=d,0===w&&x(Yv);if(k!==d)if(F(),k=Aa(),k!==d){var l=b;F();if(40===f.charCodeAt(b)){var n=fb;b++}else n=d,0===w&&x(gb);if(n!==d)if(F(),n=gi(),n!==d){var q=[];var r=b;F();if(44===f.charCodeAt(b)){var y=ua;b++}else y=d,0===w&&x(va);y!==d?(F(),y=gi(),y!==d?(B=r,r=y):(b=r,r=d)):(b=r,r=d);for(;r!==d;)q.push(r),r=b,F(),44===f.charCodeAt(b)?\n(y=ua,b++):(y=d,0===w&&x(va)),y!==d?(F(),y=gi(),y!==d?(B=r,r=y):(b=r,r=d)):(b=r,r=d);F();41===f.charCodeAt(b)?(r=Oa,b++):(r=d,0===w&&x(Pa));r!==d?(B=l,l=n.concat(q)):(b=l,l=d)}else b=l,l=d;else b=l,l=d;l===d&&(l=null);B=h;h=[\"annotation\",[\"annotationName\"].concat(k)].concat(l?[\"arguments\",l]:[])}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function qo(){var h,u=233*b+29;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,7)===La){var k=La;b+=7}else k=d,0===w&&x(Sb);if(k!==d)if(k=P(),k!==d)if(f.substr(b,\n7)===Zo?(k=Zo,b+=7):(k=d,0===w&&x(Zv)),k!==d)if(k=P(),k!==d)if(f.substr(b,4)===hi?(k=hi,b+=4):(k=d,0===w&&x($o)),k!==d){var l=b;var n=P();if(n!==d)if(f.substr(b,2)===db?(k=db,b+=2):(k=d,0===w&&x(rc)),k!==d){var q=Kk();q!==d||(b=l)}else b=l;else b=l;n=b;k=F();f.substr(b,2)===Mb?(q=Mb,b+=2):(q=d,0===w&&x(ie));if(q!==d){l=F();var r=ta();r!==d?n=k=[k,q,l,r]:(b=n,n=d)}else b=n,n=d;if(n===d)if(n=b,k=P(),k!==d)if(f.substr(b,8)===Xe?(q=Xe,b+=8):(q=d,0===w&&x(Jk)),q!==d){l=b;r=F();f.substr(b,2)===Mb?(n=Mb,\nb+=2):(n=d,0===w&&x(ie));if(n!==d){var y=F();var C=ta();C!==d?l=r=[r,n,y,C]:(b=l,l=d)}else b=l,l=d;l===d&&(l=null);n=k=[k,q,l]}else b=n,n=d;else b=n,n=d;n!==d?(B=h,h={type:\"contextItemDecl\"}):(b=h,h=d)}else b=h,h=d;else b=h,h=d;else b=h,h=d;else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function Wo(){var h,u=233*b+31;if(h=z[u])return b=h.i,h.result;h=b;var k=Lk();if(k!==d){var l=[];var n=b;F();if(44===f.charCodeAt(b)){var q=ua;b++}else q=d,0===w&&x(va);q!==d?(F(),q=Lk(),q!==d?(B=n,n=q):(b=\nn,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),44===f.charCodeAt(b)?(q=ua,b++):(q=d,0===w&&x(va)),q!==d?(F(),q=Lk(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d);B=h;h=[k].concat(l)}else b=h,h=d;z[u]={i:b,result:h};return h}function Lk(){var h,u=233*b+32;if(h=z[u])return b=h.i,h.result;h=b;if(36===f.charCodeAt(b)){var k=Jc;b++}else k=d,0===w&&x(Kc);if(k!==d)if(k=Aa(),k!==d){var l=b;var n=P();n!==d?(n=We(),n!==d?(B=l,l=n):(b=l,l=d)):(b=l,l=d);l===d&&(l=null);B=h;h=[\"param\",[\"varName\"].concat(k)].concat(l?\n[l]:[])}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function Xo(){var h,u=233*b+33;if(h=z[u])return b=h.i,h.result;h=b;var k=sc();k!==d&&(B=h,k=k?k:[\"sequenceExpr\"]);h=k;z[u]={i:b,result:h};return h}function sc(){var h,u=233*b+34;if(h=z[u])return b=h.i,h.result;h=b;if(123===f.charCodeAt(b)){var k=Fd;b++}else k=d,0===w&&x(Gd);if(k!==d){F();k=pc();k===d&&(k=null);F();if(125===f.charCodeAt(b)){var l=Hd;b++}else l=d,0===w&&x(Id);l!==d?(B=h,h=k||null):(b=h,h=d)}else b=h,h=d;z[u]={i:b,result:h};\nreturn h}function ro(){var h,u=233*b+35;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,7)===La){var k=La;b+=7}else k=d,0===w&&x(Sb);k!==d?(k=P(),k!==d?(f.substr(b,6)===ap?(k=ap,b+=6):(k=d,0===w&&x($v)),k!==d?(k=P(),k!==d?(k=Aa(),k!==d?(k=P(),k!==d?(k=bb(),k!==d?(B=h,h={type:\"optionDecl\"}):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d);z[u]={i:b,result:h};return h}function pc(){var h,u=233*b+37;if(h=z[u])return b=h.i,h.result;h=b;var k=ta();if(k!==d){var l=[];var n=\nb;F();if(44===f.charCodeAt(b)){var q=ua;b++}else q=d,0===w&&x(va);q!==d?(F(),q=ta(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),44===f.charCodeAt(b)?(q=ua,b++):(q=d,0===w&&x(va)),q!==d?(F(),q=ta(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d);B=h;h=0===l.length?k:[\"sequenceExpr\",k].concat(l)}else b=h,h=d;z[u]={i:b,result:h};return h}function ta(){var h=233*b+38,u=z[h];if(u)return b=u.i,u.result;var k=b;var l=233*b+39,n=z[l];if(n){b=n.i;var q=n.result}else{var r=b;var y=bp();if(y!==d){var C=\n[];var J=b;var N=F();var oa=cp();oa!==d?(B=J,J=oa):(b=J,J=d);for(;J!==d;)C.push(J),J=b,N=F(),oa=cp(),oa!==d?(B=J,J=oa):(b=J,J=d);J=F();var wb=233*b+58,Tb=z[wb];if(Tb)b=Tb.i,N=Tb.result;else{var dc=b;if(f.substr(b,6)===Jd){var je=Jd;b+=6}else je=d,0===w&&x(ii);if(je!==d){F();var Ye=ta();Ye!==d?(B=dc,dc=[\"returnClause\",Ye]):(b=dc,dc=d)}else b=dc,dc=d;z[wb]={i:b,result:dc};N=dc}N!==d?(B=r,r=[\"flworExpr\",y].concat(C,[N])):(b=r,r=d)}else b=r,r=d;z[l]={i:b,result:r};q=r}q!==d&&(B=k,q=$b(q));k=q;if(k===\nd){k=b;var gg=233*b+59,ke=z[gg];if(ke)b=ke.i,q=ke.result;else{var Xa=b;if(f.substr(b,4)===dp){var dd=dp;b+=4}else dd=d,0===w&&x(aw);dd===d&&(f.substr(b,5)===ep?(dd=ep,b+=5):(dd=d,0===w&&x(bw)));if(dd!==d){var hg=P();if(hg!==d){var ig=233*b+60,le=z[ig];if(le){b=le.i;var Qa=le.result}else{var Eb=b;var jg=Mk();if(jg!==d){var Ze=[];var mb=b;F();if(44===f.charCodeAt(b)){var ed=ua;b++}else ed=d,0===w&&x(va);if(ed!==d){F();var xb=Mk();xb!==d?(B=mb,mb=xb):(b=mb,mb=d)}else b=mb,mb=d;for(;mb!==d;)Ze.push(mb),\nmb=b,F(),44===f.charCodeAt(b)?(ed=ua,b++):(ed=d,0===w&&x(va)),ed!==d?(F(),xb=Mk(),xb!==d?(B=mb,mb=xb):(b=mb,mb=d)):(b=mb,mb=d);B=Eb;Eb=[jg].concat(Ze)}else b=Eb,Eb=d;z[ig]={i:b,result:Eb};Qa=Eb}if(Qa!==d){var ji=P();if(ji!==d){if(f.substr(b,9)===fp){var sb=fp;b+=9}else sb=d,0===w&&x(cw);if(sb!==d){var fd=P();if(fd!==d){var kg=ta();kg!==d?(B=Xa,Xa=[\"quantifiedExpr\",[\"quantifier\",dd]].concat(Qa,[[\"predicateExpr\",kg]])):(b=Xa,Xa=d)}else b=Xa,Xa=d}else b=Xa,Xa=d}else b=Xa,Xa=d}else b=Xa,Xa=d}else b=Xa,\nXa=d}else b=Xa,Xa=d;z[gg]={i:b,result:Xa};q=Xa}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var lg=233*b+62,$e=z[lg];if($e)b=$e.i,q=$e.result;else{var Da=b;if(f.substr(b,10)===ki){var af=ki;b+=10}else af=d,0===w&&x(gp);if(af!==d){F();if(40===f.charCodeAt(b)){var me=fb;b++}else me=d,0===w&&x(gb);if(me!==d){var Kd=pc();if(Kd!==d){if(41===f.charCodeAt(b)){var mg=Oa;b++}else mg=d,0===w&&x(Pa);if(mg!==d){F();var Ld=[];var Ma=b;var Lc=hp();if(Lc!==d){var ya=F();B=Ma;Ma=Lc}else b=Ma,Ma=d;if(Ma!==d)for(;Ma!==d;)Ld.push(Ma),\nMa=b,Lc=hp(),Lc!==d?(ya=F(),B=Ma,Ma=Lc):(b=Ma,Ma=d);else Ld=d;if(Ld!==d)if(f.substr(b,7)===bc?(Ma=bc,b+=7):(Ma=d,0===w&&x(Pe)),Ma!==d)if(Lc=P(),Lc!==d){ya=b;if(36===f.charCodeAt(b)){var ne=Jc;b++}else ne=d,0===w&&x(Kc);if(ne!==d){var oe=Aa();if(oe!==d){var tc=P();tc!==d?(B=ya,ya=oe):(b=ya,ya=d)}else b=ya,ya=d}else b=ya,ya=d;ya===d&&(ya=null);f.substr(b,6)===Jd?(ne=Jd,b+=6):(ne=d,0===w&&x(ii));ne!==d?(oe=P(),oe!==d?(tc=ta(),tc!==d?(B=Da,Da=[\"typeswitchExpr\",[\"argExpr\",Kd]].concat(Ld,[[\"typeswitchExprDefaultClause\"].concat(ya||\n[],[[\"resultExpr\",tc]])])):(b=Da,Da=d)):(b=Da,Da=d)):(b=Da,Da=d)}else b=Da,Da=d;else b=Da,Da=d;else b=Da,Da=d}else b=Da,Da=d}else b=Da,Da=d}else b=Da,Da=d}else b=Da,Da=d;z[lg]={i:b,result:Da};q=Da}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var ng=233*b+65,bf=z[ng];if(bf)b=bf.i,q=bf.result;else{var Ga=b;if(f.substr(b,2)===li){var cf=li;b+=2}else cf=d,0===w&&x(ip);if(cf!==d){F();if(40===f.charCodeAt(b)){var Ub=fb;b++}else Ub=d,0===w&&x(gb);if(Ub!==d){F();var og=pc();if(og!==d){F();if(41===f.charCodeAt(b)){var pg=\nOa;b++}else pg=d,0===w&&x(Pa);if(pg!==d){F();if(f.substr(b,4)===jp){var df=jp;b+=4}else df=d,0===w&&x(dw);if(df!==d){var Md=za();if(Md!==d){F();var pe=ta();if(pe!==d){F();if(f.substr(b,4)===kp){var qe=kp;b+=4}else qe=d,0===w&&x(ew);if(qe!==d){var mi=za();if(mi!==d){F();var ef=ta();ef!==d?(B=Ga,Ga=[\"ifThenElseExpr\",[\"ifClause\",og],[\"thenClause\",pe],[\"elseClause\",ef]]):(b=Ga,Ga=d)}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=\nGa,Ga=d;z[ng]={i:b,result:Ga};q=Ga}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var re=233*b+214,gd=z[re];if(gd)b=gd.i,q=gd.result;else{var Ra=b;if(f.substr(b,6)===lp){var ff=lp;b+=6}else ff=d,0===w&&x(fw);if(ff!==d){var qg=P();if(qg!==d){if(f.substr(b,5)===ni){var Mc=ni;b+=5}else Mc=d,0===w&&x(mp);Mc===d&&(f.substr(b,4)===Nc?(Mc=Nc,b+=4):(Mc=d,0===w&&x(rg)));if(Mc!==d){var se=P();if(se!==d){var sg=ta();if(sg!==d){var tg=P();if(tg!==d){var Ya,ug=233*b+213,te=z[ug];if(te){b=te.i;var gf=te.result}else{var Ea=\nYa=b;if(f.substr(b,2)===db){var Ob=db;b+=2}else Ob=d,0===w&&x(rc);if(Ob!==d){var oi=P();if(oi!==d){var ec=b;if(f.substr(b,5)===np){var Pb=np;b+=5}else Pb=d,0===w&&x(gw);Pb!==d&&(B=ec,Pb=[\"insertAsFirst\"]);ec=Pb;ec===d&&(ec=b,f.substr(b,4)===op?(Pb=op,b+=4):(Pb=d,0===w&&x(hw)),Pb!==d&&(B=ec,Pb=[\"insertAsLast\"]),ec=Pb);ec!==d?(Pb=P(),Pb!==d?(B=Ea,Ea=ec):(b=Ea,Ea=d)):(b=Ea,Ea=d)}else b=Ea,Ea=d}else b=Ea,Ea=d;Ea===d&&(Ea=null);f.substr(b,4)===pp?(Ob=pp,b+=4):(Ob=d,0===w&&x(iw));Ob!==d?(B=Ya,Ya=Ea?[\"insertInto\",\nEa]:[\"insertInto\"]):(b=Ya,Ya=d);Ya===d&&(Ya=b,f.substr(b,5)===qp?(Ea=qp,b+=5):(Ea=d,0===w&&x(jw)),Ea!==d&&(B=Ya,Ea=[\"insertAfter\"]),Ya=Ea,Ya===d&&(Ya=b,f.substr(b,6)===rp?(Ea=rp,b+=6):(Ea=d,0===w&&x(kw)),Ea!==d&&(B=Ya,Ea=[\"insertBefore\"]),Ya=Ea));z[ug]={i:b,result:Ya};gf=Ya}if(gf!==d){var vg=P();if(vg!==d){var Vb=ta();Vb!==d?(B=Ra,Ra=[\"insertExpr\",[\"sourceExpr\",sg],gf,[\"targetExpr\",Vb]]):(b=Ra,Ra=d)}else b=Ra,Ra=d}else b=Ra,Ra=d}else b=Ra,Ra=d}else b=Ra,Ra=d}else b=Ra,Ra=d}else b=Ra,Ra=d}else b=Ra,\nRa=d}else b=Ra,Ra=d;z[re]={i:b,result:Ra};q=Ra}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var wg=233*b+215,nb=z[wg];if(nb)b=nb.i,q=nb.result;else{var eb=b;if(f.substr(b,6)===sp){var xg=sp;b+=6}else xg=d,0===w&&x(lw);if(xg!==d){var pi=P();if(pi!==d){if(f.substr(b,5)===ni){var hd=ni;b+=5}else hd=d,0===w&&x(mp);hd===d&&(f.substr(b,4)===Nc?(hd=Nc,b+=4):(hd=d,0===w&&x(rg)));if(hd!==d){var qi=P();if(qi!==d){var hf=ta();hf!==d?(B=eb,eb=[\"deleteExpr\",[\"targetExpr\",hf]]):(b=eb,eb=d)}else b=eb,eb=d}else b=eb,eb=\nd}else b=eb,eb=d}else b=eb,eb=d;z[wg]={i:b,result:eb};q=eb}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var yg=233*b+217,ue=z[yg];if(ue)b=ue.i,q=ue.result;else{var Ha=b;if(f.substr(b,6)===tp){var Wb=tp;b+=6}else Wb=d,0===w&&x(mw);if(Wb!==d){var ri=P();if(ri!==d){if(f.substr(b,4)===Nc){var zg=Nc;b+=4}else zg=d,0===w&&x(rg);if(zg!==d){F();var Ag=ta();if(Ag!==d){var jf=P();if(jf!==d){if(f.substr(b,2)===db){var Bg=db;b+=2}else Bg=d,0===w&&x(rc);if(Bg!==d){var Cg=P();if(Cg!==d){var Fb=ta();Fb!==d?(B=Ha,Ha=[\"renameExpr\",\n[\"targetExpr\",Ag],[\"newNameExpr\",Fb]]):(b=Ha,Ha=d)}else b=Ha,Ha=d}else b=Ha,Ha=d}else b=Ha,Ha=d}else b=Ha,Ha=d}else b=Ha,Ha=d}else b=Ha,Ha=d}else b=Ha,Ha=d;z[yg]={i:b,result:Ha};q=Ha}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var Dg=233*b+216,kf=z[Dg];if(kf)b=kf.i,q=kf.result;else{var Sa=b;if(f.substr(b,7)===up){var lf=up;b+=7}else lf=d,0===w&&x(nw);if(lf!==d){var si=P();if(si!==d){var Ta=b;if(f.substr(b,5)===vp){var Xb=vp;b+=5}else Xb=d,0===w&&x(ow);if(Xb!==d){var mf=P();if(mf!==d){if(f.substr(b,2)===\nti){var Oc=ti;b+=2}else Oc=d,0===w&&x(wp);if(Oc!==d){var ve=P();ve!==d?Ta=Xb=[Xb,mf,Oc,ve]:(b=Ta,Ta=d)}else b=Ta,Ta=d}else b=Ta,Ta=d}else b=Ta,Ta=d;Ta===d&&(Ta=null);f.substr(b,4)===Nc?(Xb=Nc,b+=4):(Xb=d,0===w&&x(rg));if(Xb!==d)if(mf=P(),mf!==d)if(Oc=ta(),Oc!==d)if(ve=P(),ve!==d){if(f.substr(b,4)===xp){var nf=xp;b+=4}else nf=d,0===w&&x(pw);if(nf!==d){var fc=P();if(fc!==d){var of=ta();of!==d?(B=Sa,Sa=Ta?[\"replaceExpr\",[\"replaceValue\"],[\"targetExpr\",Oc],[\"replacementExpr\",of]]:[\"replaceExpr\",[\"targetExpr\",\nOc],[\"replacementExpr\",of]]):(b=Sa,Sa=d)}else b=Sa,Sa=d}else b=Sa,Sa=d}else b=Sa,Sa=d;else b=Sa,Sa=d;else b=Sa,Sa=d;else b=Sa,Sa=d}else b=Sa,Sa=d}else b=Sa,Sa=d;z[Dg]={i:b,result:Sa};q=Sa}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var Eg=233*b+218,gc=z[Eg];if(gc)b=gc.i,q=gc.result;else{var Ia=b;if(f.substr(b,4)===yp){var Nd=yp;b+=4}else Nd=d,0===w&&x(qw);if(Nd!==d){var tb=P();if(tb!==d){var Od=Nk();if(Od!==d){var Pd=[];var jb=b;var Qd=F();if(44===f.charCodeAt(b)){var yb=ua;b++}else yb=d,0===w&&x(va);\nif(yb!==d){var we=F();var uc=Nk();uc!==d?(B=jb,jb=uc):(b=jb,jb=d)}else b=jb,jb=d;for(;jb!==d;)Pd.push(jb),jb=b,Qd=F(),44===f.charCodeAt(b)?(yb=ua,b++):(yb=d,0===w&&x(va)),yb!==d?(we=F(),uc=Nk(),uc!==d?(B=jb,jb=uc):(b=jb,jb=d)):(b=jb,jb=d);jb=F();f.substr(b,6)===zp?(Qd=zp,b+=6):(Qd=d,0===w&&x(rw));if(Qd!==d)if(yb=P(),yb!==d)if(we=ta(),we!==d)if(uc=P(),uc!==d){if(f.substr(b,6)===Jd){var Qb=Jd;b+=6}else Qb=d,0===w&&x(ii);if(Qb!==d){var Pc=P();if(Pc!==d){var Fg=ta();Fg!==d?(B=Ia,Ia=[\"transformExpr\",[\"transformCopies\",\nOd].concat(Pd),[\"modifyExpr\",we],[\"returnExpr\",Fg]]):(b=Ia,Ia=d)}else b=Ia,Ia=d}else b=Ia,Ia=d}else b=Ia,Ia=d;else b=Ia,Ia=d;else b=Ia,Ia=d;else b=Ia,Ia=d}else b=Ia,Ia=d}else b=Ia,Ia=d}else b=Ia,Ia=d;z[Eg]={i:b,result:Ia};q=Ia}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var Qc=233*b+66,pf=z[Qc];if(pf)b=pf.i,q=pf.result;else{var id=b;var ob=Ok();if(ob!==d){var Rd=[];var Ua=b;F();if(f.substr(b,2)===ui){var Sd=ui;b+=2}else Sd=d,0===w&&x(Ap);if(Sd!==d){var qf=za();if(qf!==d){F();var jd=Ok();jd!==d?(B=Ua,Ua=\njd):(b=Ua,Ua=d)}else b=Ua,Ua=d}else b=Ua,Ua=d;for(;Ua!==d;)Rd.push(Ua),Ua=b,F(),f.substr(b,2)===ui?(Sd=ui,b+=2):(Sd=d,0===w&&x(Ap)),Sd!==d?(qf=za(),qf!==d?(F(),jd=Ok(),jd!==d?(B=Ua,Ua=jd):(b=Ua,Ua=d)):(b=Ua,Ua=d)):(b=Ua,Ua=d);B=id;id=vi(\"orOp\",ob,Rd)}else b=id,id=d;z[Qc]={i:b,result:id};q=id}q!==d&&(B=k,q=$b(q));k=q}}}}}}}}}z[h]={i:b,result:k};return k}function bp(){var h,u=233*b+40;if(h=z[u])return b=h.i,h.result;var k;h=233*b+42;if(k=z[h])b=k.i,h=k.result;else{k=b;if(f.substr(b,3)===Bp){var l=Bp;\nb+=3}else l=d,0===w&&x(sw);if(l!==d)if(l=P(),l!==d)if(l=Pk(),l!==d){var n=[];var q=b;F();if(44===f.charCodeAt(b)){var r=ua;b++}else r=d,0===w&&x(va);r!==d?(F(),r=Pk(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d);for(;q!==d;)n.push(q),q=b,F(),44===f.charCodeAt(b)?(r=ua,b++):(r=d,0===w&&x(va)),r!==d?(F(),r=Pk(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d);B=k;k=[\"forClause\",l].concat(n)}else b=k,k=d;else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}if(h===d)if(h=233*b+46,k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,\n3)===Cp?(l=Cp,b+=3):(l=d,0===w&&x(tw));if(l!==d)if(F(),l=Qk(),l!==d){F();n=[];q=b;44===f.charCodeAt(b)?(r=ua,b++):(r=d,0===w&&x(va));r!==d?(F(),r=Qk(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d);for(;q!==d;)n.push(q),q=b,44===f.charCodeAt(b)?(r=ua,b++):(r=d,0===w&&x(va)),r!==d?(F(),r=Qk(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d);B=k;k=[\"letClause\",l].concat(n)}else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}z[u]={i:b,result:h};return h}function cp(){var h,u=233*b+41;if(h=z[u])return b=h.i,h.result;h=bp();\nif(h===d){var k;h=233*b+48;if(k=z[h])b=k.i,h=k.result;else{k=b;if(f.substr(b,5)===Dp){var l=Dp;b+=5}else l=d,0===w&&x(uw);l!==d?(l=za(),l!==d?(F(),l=ta(),l!==d?(B=k,k=[\"whereClause\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d);z[h]={i:b,result:k};h=k}if(h===d){h=233*b+49;if(k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,5)===Ep?(l=Ep,b+=5):(l=d,0===w&&x(vw));if(l!==d)if(l=P(),l!==d)if(f.substr(b,2)===rf?(l=rf,b+=2):(l=d,0===w&&x(Rk)),l!==d){F();var n;l=233*b+50;if(n=z[l])b=n.i,l=n.result;else{n=b;var q=Sk();\nif(q!==d){var r=[];var y=b;F();if(44===f.charCodeAt(b)){var C=ua;b++}else C=d,0===w&&x(va);C!==d?(F(),C=Sk(),C!==d?(B=y,y=C):(b=y,y=d)):(b=y,y=d);for(;y!==d;)r.push(y),y=b,F(),44===f.charCodeAt(b)?(C=ua,b++):(C=d,0===w&&x(va)),C!==d?(F(),C=Sk(),C!==d?(B=y,y=C):(b=y,y=d)):(b=y,y=d);B=n;n=[q].concat(r)}else b=n,n=d;z[l]={i:b,result:n};l=n}l!==d?(B=k,k=[\"groupByClause\"].concat(l)):(b=k,k=d)}else b=k,k=d;else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}if(h===d)if(h=233*b+54,k=z[h])b=k.i,h=k.result;\nelse{l=k=b;f.substr(b,5)===Re?(n=Re,b+=5):(n=d,0===w&&x(Gk));n!==d?(n=P(),n!==d?(f.substr(b,2)===rf?(n=rf,b+=2):(n=d,0===w&&x(Rk)),n!==d?(B=l,l=!1):(b=l,l=d)):(b=l,l=d)):(b=l,l=d);l===d&&(l=b,f.substr(b,6)===Fp?(n=Fp,b+=6):(n=d,0===w&&x(ww)),n!==d?(n=P(),n!==d?(f.substr(b,5)===Re?(n=Re,b+=5):(n=d,0===w&&x(Gk)),n!==d?(n=P(),n!==d?(f.substr(b,2)===rf?(n=rf,b+=2):(n=d,0===w&&x(Rk)),n!==d?(B=l,l=!0):(b=l,l=d)):(b=l,l=d)):(b=l,l=d)):(b=l,l=d)):(b=l,l=d));if(l!==d){F();n=233*b+55;if(q=z[n])b=q.i,n=q.result;\nelse{q=b;r=Tk();if(r!==d){y=[];C=b;F();if(44===f.charCodeAt(b)){var J=ua;b++}else J=d,0===w&&x(va);J!==d?(F(),J=Tk(),J!==d?(B=C,C=J):(b=C,C=d)):(b=C,C=d);for(;C!==d;)y.push(C),C=b,F(),44===f.charCodeAt(b)?(J=ua,b++):(J=d,0===w&&x(va)),J!==d?(F(),J=Tk(),J!==d?(B=C,C=J):(b=C,C=d)):(b=C,C=d);B=q;q=[r].concat(y)}else b=q,q=d;z[n]={i:b,result:q};n=q}n!==d?(B=k,k=[\"orderByClause\"].concat(l?[[\"stable\"]]:[],n)):(b=k,k=d)}else b=k,k=d;z[h]={i:b,result:k};h=k}}}z[u]={i:b,result:h};return h}function Pk(){var h,\nu,k=233*b+43;if(h=z[k])return b=h.i,h.result;h=b;if(36===f.charCodeAt(b)){var l=Jc;b++}else l=d,0===w&&x(Kc);if(l!==d)if(l=Aa(),l!==d){F();var n=We();n===d&&(n=null);F();var q=233*b+44;if(u=z[q])b=u.i,q=u.result;else{u=b;if(f.substr(b,8)===Gp){var r=Gp;b+=8}else r=d,0===w&&x(xw);if(r!==d){var y=P();if(y!==d){if(f.substr(b,5)===Se){var C=Se;b+=5}else C=d,0===w&&x(Hk);C!==d?u=r=[r,y,C]:(b=u,u=d)}else b=u,u=d}else b=u,u=d;z[q]={i:b,result:u};q=u}q===d&&(q=null);F();u=233*b+45;(r=z[u])?(b=r.i,u=r.result):\n(r=b,f.substr(b,2)===Te?(y=Te,b+=2):(y=d,0===w&&x(Ik)),y!==d?(y=P(),y!==d?(36===f.charCodeAt(b)?(y=Jc,b++):(y=d,0===w&&x(Kc)),y!==d?(y=Aa(),y!==d?(B=r,r=[\"positionalVariableBinding\"].concat(y)):(b=r,r=d)):(b=r,r=d)):(b=r,r=d)):(b=r,r=d),z[u]={i:b,result:r},u=r);u===d&&(u=null);F();f.substr(b,2)===wi?(r=wi,b+=2):(r=d,0===w&&x(Hp));r!==d?(F(),r=ta(),r!==d?(B=h,h=[\"forClauseItem\",[\"typedVariableBinding\",[\"varName\"].concat(l,n?[n]:[])]].concat(q?[[\"allowingEmpty\"]]:[],u?[u]:[],[[\"forExpr\",r]])):(b=h,\nh=d)):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[k]={i:b,result:h};return h}function Qk(){var h,u=233*b+47;if(h=z[u])return b=h.i,h.result;h=b;if(36===f.charCodeAt(b)){var k=Jc;b++}else k=d,0===w&&x(Kc);if(k!==d)if(k=Aa(),k!==d){F();var l=We();l===d&&(l=null);F();if(f.substr(b,2)===Mb){var n=Mb;b+=2}else n=d,0===w&&x(ie);n!==d?(F(),n=ta(),n!==d?(B=h,h=[\"letClauseItem\",[\"typedVariableBinding\",[\"varName\"].concat(k)].concat(l?[l]:[]),[\"letExpr\",n]]):(b=h,h=d)):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[u]={i:b,\nresult:h};return h}function Sk(){var h,u,k=233*b+51;if(h=z[k])return b=h.i,h.result;h=b;var l=233*b+53;if(u=z[l])b=u.i,l=u.result;else{u=b;if(36===f.charCodeAt(b)){var n=Jc;b++}else n=d,0===w&&x(Kc);n!==d?(n=Aa(),n!==d?(B=u,u=[\"varName\"].concat(n)):(b=u,u=d)):(b=u,u=d);z[l]={i:b,result:u};l=u}if(l!==d){u=233*b+52;if(n=z[u])b=n.i,u=n.result;else{n=b;F();var q=We();q===d&&(q=null);F();if(f.substr(b,2)===Mb){var r=Mb;b+=2}else r=d,0===w&&x(ie);r!==d?(F(),r=ta(),r!==d?(B=n,n=[\"groupVarInitialize\"].concat(q?\n[[\"typeDeclaration\"].concat(q)]:[],[[\"varValue\",r]])):(b=n,n=d)):(b=n,n=d);z[u]={i:b,result:n};u=n}u===d&&(u=null);n=b;F();f.substr(b,9)===Qe?(q=Qe,b+=9):(q=d,0===w&&x(Fk));q!==d?(F(),q=bb(),q!==d?(B=n,n=[\"collation\",q]):(b=n,n=d)):(b=n,n=d);n===d&&(n=null);B=h;h=[\"groupingSpec\",l].concat(u?[u]:[],n?[n]:[])}else b=h,h=d;z[k]={i:b,result:h};return h}function Tk(){var h,u=233*b+56;if(h=z[u])return b=h.i,h.result;h=b;var k=ta();if(k!==d){F();var l;var n=233*b+57;if(l=z[n])b=l.i,n=l.result;else{l=b;if(f.substr(b,\n9)===Ip){var q=Ip;b+=9}else q=d,0===w&&x(yw);q===d&&(f.substr(b,10)===Jp?(q=Jp,b+=10):(q=d,0===w&&x(zw)));q===d&&(q=null);F();var r=b;if(f.substr(b,5)===Se){var y=Se;b+=5}else y=d,0===w&&x(Hk);if(y!==d){F();var C=b;if(f.substr(b,8)===ci){var J=ci;b+=8}else J=d,0===w&&x(zo);J!==d&&(B=C,J=\"empty greatest\");C=J;C===d&&(C=b,f.substr(b,5)===di?(J=di,b+=5):(J=d,0===w&&x(Ao)),J!==d&&(B=C,J=\"empty least\"),C=J);C!==d?(B=r,r=C):(b=r,r=d)}else b=r,r=d;r===d&&(r=null);F();y=b;f.substr(b,9)===Qe?(C=Qe,b+=9):(C=\nd,0===w&&x(Fk));if(C!==d){J=F();var N=bb();N!==d?y=C=[C,J,N]:(b=y,y=d)}else b=y,y=d;y===d&&(y=null);B=l;l=q||r||y?[\"orderModifier\"].concat(q?[[\"orderingKind\",q]]:[],r?[[\"emptyOrderingMode\",r]]:[],y?[[\"collation\",y]]:[]):null;z[n]={i:b,result:l};n=l}B=h;h=[\"orderBySpec\",[\"orderByExpr\",k]].concat(n?[n]:[])}else b=h,h=d;z[u]={i:b,result:h};return h}function Mk(){var h,u=233*b+61;if(h=z[u])return b=h.i,h.result;h=b;if(36===f.charCodeAt(b)){var k=Jc;b++}else k=d,0===w&&x(Kc);if(k!==d)if(k=Aa(),k!==d){var l=\nb;var n=P();n!==d?(n=We(),n!==d?(B=l,l=n):(b=l,l=d)):(b=l,l=d);l===d&&(l=null);n=P();n!==d?(f.substr(b,2)===wi?(n=wi,b+=2):(n=d,0===w&&x(Hp)),n!==d?(n=P(),n!==d?(n=ta(),n!==d?(B=h,h=[\"quantifiedExprInClause\",[\"typedVariableBinding\",[\"varName\"].concat(k)].concat(l?[l]:[]),[\"sourceExpr\",n]]):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function hp(){var h,u=233*b+63;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,4)===Kp){var k=Kp;b+=4}else k=d,\n0===w&&x(Aw);if(k!==d){F();k=b;if(36===f.charCodeAt(b)){var l=Jc;b++}else l=d,0===w&&x(Kc);if(l!==d)if(l=Aa(),l!==d){var n=P();n!==d?(f.substr(b,2)===db?(n=db,b+=2):(n=d,0===w&&x(rc)),n!==d?(B=k,k=l):(b=k,k=d)):(b=k,k=d)}else b=k,k=d;else b=k,k=d;k===d&&(k=null);F();l=233*b+64;if(n=z[l])b=n.i,l=n.result;else{n=b;var q=Nb();if(q!==d){var r=[];var y=b;F();if(124===f.charCodeAt(b)){var C=xi;b++}else C=d,0===w&&x(yi);C!==d?(F(),C=Nb(),C!==d?(B=y,y=C):(b=y,y=d)):(b=y,y=d);for(;y!==d;)r.push(y),y=b,F(),\n124===f.charCodeAt(b)?(C=xi,b++):(C=d,0===w&&x(yi)),C!==d?(F(),C=Nb(),C!==d?(B=y,y=C):(b=y,y=d)):(b=y,y=d);B=n;n=O(q,r)}else b=n,n=d;z[l]={i:b,result:n};l=n}l!==d?(n=P(),n!==d?(f.substr(b,6)===Jd?(n=Jd,b+=6):(n=d,0===w&&x(ii)),n!==d?(n=P(),n!==d?(n=ta(),n!==d?(B=h,h=[\"typeswitchExprCaseClause\"].concat(k?[[\"variableBinding\"].concat(k)]:[],l,[[\"resultExpr\",n]])):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)}else b=h,h=d;z[u]={i:b,result:h};return h}function Ok(){var h,u=233*b+67;if(h=z[u])return b=\nh.i,h.result;h=b;var k=Uk();if(k!==d){var l=[];var n=b;F();if(f.substr(b,3)===zi){var q=zi;b+=3}else q=d,0===w&&x(Lp);q!==d?(q=za(),q!==d?(F(),q=Uk(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),f.substr(b,3)===zi?(q=zi,b+=3):(q=d,0===w&&x(Lp)),q!==d?(q=za(),q!==d?(F(),q=Uk(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d)):(b=n,n=d);B=h;h=vi(\"andOp\",k,l)}else b=h,h=d;z[u]={i:b,result:h};return h}function Uk(){var h,u,k=233*b+68;if(h=z[k])return b=h.i,h.result;h=b;var l=Mp();\nif(l!==d){var n=b;F();var q=233*b+83;if(u=z[q])b=u.i,q=u.result;else{u=b;if(f.substr(b,2)===Np){var r=Np;b+=2}else r=d,0===w&&x(Bw);r!==d?(r=za(),r!==d?(B=u,u=\"eqOp\"):(b=u,u=d)):(b=u,u=d);u===d&&(u=b,f.substr(b,2)===Op?(r=Op,b+=2):(r=d,0===w&&x(Cw)),r!==d?(r=za(),r!==d?(B=u,u=\"neOp\"):(b=u,u=d)):(b=u,u=d),u===d&&(u=b,f.substr(b,2)===Ai?(r=Ai,b+=2):(r=d,0===w&&x(Pp)),r!==d?(r=za(),r!==d?(B=u,u=\"ltOp\"):(b=u,u=d)):(b=u,u=d),u===d&&(u=b,f.substr(b,2)===Qp?(r=Qp,b+=2):(r=d,0===w&&x(Dw)),r!==d?(r=za(),r!==\nd?(B=u,u=\"leOp\"):(b=u,u=d)):(b=u,u=d),u===d&&(u=b,f.substr(b,2)===Bi?(r=Bi,b+=2):(r=d,0===w&&x(Rp)),r!==d?(r=za(),r!==d?(B=u,u=\"gtOp\"):(b=u,u=d)):(b=u,u=d),u===d&&(u=b,f.substr(b,2)===Sp?(r=Sp,b+=2):(r=d,0===w&&x(Ew)),r!==d?(r=za(),r!==d?(B=u,u=\"geOp\"):(b=u,u=d)):(b=u,u=d))))));z[q]={i:b,result:u};q=u}q===d&&(q=233*b+84,(u=z[q])?(b=u.i,q=u.result):(u=b,f.substr(b,2)===Tp?(r=Tp,b+=2):(r=d,0===w&&x(Fw)),r!==d?(r=za(),r!==d?(B=u,u=\"isOp\"):(b=u,u=d)):(b=u,u=d),u===d&&(u=b,f.substr(b,2)===Up?(r=Up,b+=\n2):(r=d,0===w&&x(Gw)),r!==d&&(B=u,r=\"nodeBeforeOp\"),u=r,u===d&&(u=b,f.substr(b,2)===Vp?(r=Vp,b+=2):(r=d,0===w&&x(Hw)),r!==d&&(B=u,r=\"nodeAfterOp\"),u=r)),z[q]={i:b,result:u},q=u),q===d&&(q=233*b+82,(u=z[q])?(b=u.i,q=u.result):(u=b,61===f.charCodeAt(b)?(r=Cd,b++):(r=d,0===w&&x(Dd)),r!==d&&(B=u,r=\"equalOp\"),u=r,u===d&&(u=b,f.substr(b,2)===Wp?(r=Wp,b+=2):(r=d,0===w&&x(Iw)),r!==d&&(B=u,r=\"notEqualOp\"),u=r,u===d&&(u=b,f.substr(b,2)===Xp?(r=Xp,b+=2):(r=d,0===w&&x(Jw)),r!==d&&(B=u,r=\"lessThanOrEqualOp\"),\nu=r,u===d&&(u=b,60===f.charCodeAt(b)?(r=Yp,b++):(r=d,0===w&&x(Zp)),r!==d&&(B=u,r=\"lessThanOp\"),u=r,u===d&&(u=b,f.substr(b,2)===$p?(r=$p,b+=2):(r=d,0===w&&x(Kw)),r!==d&&(B=u,r=\"greaterThanOrEqualOp\"),u=r,u===d&&(u=b,62===f.charCodeAt(b)?(r=Vk,b++):(r=d,0===w&&x(Wk)),r!==d&&(B=u,r=\"greaterThanOp\"),u=r))))),z[q]={i:b,result:u},q=u)));q!==d?(F(),u=Mp(),u!==d?(B=n,n=[q,u]):(b=n,n=d)):(b=n,n=d);n===d&&(n=null);B=h;h=n?[n[0],[\"firstOperand\",l],[\"secondOperand\",n[1]]]:l}else b=h,h=d;z[k]={i:b,result:h};return h}\nfunction Mp(){var h,u=233*b+69;if(h=z[u])return b=h.i,h.result;h=b;var k=Xk();if(k!==d){var l=[];var n=b;F();if(f.substr(b,2)===Ci){var q=Ci;b+=2}else q=d,0===w&&x(aq);q!==d?(F(),q=Xk(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),f.substr(b,2)===Ci?(q=Ci,b+=2):(q=d,0===w&&x(aq)),q!==d?(F(),q=Xk(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d);B=h;h=vi(\"stringConcatenateOp\",k,l)}else b=h,h=d;z[u]={i:b,result:h};return h}function Xk(){var h,u=233*b+70;if(h=z[u])return b=h.i,h.result;h=\nb;var k=bq();if(k!==d){var l=b;F();if(f.substr(b,2)===cq){var n=cq;b+=2}else n=d,0===w&&x(Lw);n!==d?(n=za(),n!==d?(F(),n=bq(),n!==d?(B=l,l=n):(b=l,l=d)):(b=l,l=d)):(b=l,l=d);l===d&&(l=null);B=h;h=null===l?k:[\"rangeSequenceExpr\",[\"startExpr\",k],[\"endExpr\",l]]}else b=h,h=d;z[u]={i:b,result:h};return h}function bq(){var h,u=233*b+71;if(h=z[u])return b=h.i,h.result;h=b;var k=Yk();if(k!==d){var l=[];var n=b;F();var q=b;if(45===f.charCodeAt(b)){var r=kd;b++}else r=d,0===w&&x(ld);r!==d&&(B=q,r=\"subtractOp\");\nq=r;q===d&&(q=b,43===f.charCodeAt(b)?(r=Di,b++):(r=d,0===w&&x(Ei)),r!==d&&(B=q,r=\"addOp\"),q=r);q!==d?(F(),r=Yk(),r!==d?(B=n,n=[q,r]):(b=n,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),q=b,45===f.charCodeAt(b)?(r=kd,b++):(r=d,0===w&&x(ld)),r!==d&&(B=q,r=\"subtractOp\"),q=r,q===d&&(q=b,43===f.charCodeAt(b)?(r=Di,b++):(r=d,0===w&&x(Ei)),r!==d&&(B=q,r=\"addOp\"),q=r),q!==d?(F(),r=Yk(),r!==d?(B=n,n=[q,r]):(b=n,n=d)):(b=n,n=d);B=h;h=M(k,l)}else b=h,h=d;z[u]={i:b,result:h};return h}function Yk(){var h,u=233*\nb+72;if(h=z[u])return b=h.i,h.result;h=b;var k=Zk();if(k!==d){var l=[];var n=b;F();var q=b;if(42===f.charCodeAt(b)){var r=vc;b++}else r=d,0===w&&x(wc);r!==d&&(B=q,r=\"multiplyOp\");q=r;q===d&&(q=b,f.substr(b,3)===Fi?(r=Fi,b+=3):(r=d,0===w&&x(dq)),r!==d?(r=za(),r!==d?(B=q,q=\"divOp\"):(b=q,q=d)):(b=q,q=d),q===d&&(q=b,f.substr(b,4)===Gi?(r=Gi,b+=4):(r=d,0===w&&x(eq)),r!==d?(r=za(),r!==d?(B=q,q=\"idivOp\"):(b=q,q=d)):(b=q,q=d),q===d&&(q=b,f.substr(b,3)===Hi?(r=Hi,b+=3):(r=d,0===w&&x(fq)),r!==d?(r=za(),r!==\nd?(B=q,q=\"modOp\"):(b=q,q=d)):(b=q,q=d))));q!==d?(F(),r=Zk(),r!==d?(B=n,n=[q,r]):(b=n,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),q=b,42===f.charCodeAt(b)?(r=vc,b++):(r=d,0===w&&x(wc)),r!==d&&(B=q,r=\"multiplyOp\"),q=r,q===d&&(q=b,f.substr(b,3)===Fi?(r=Fi,b+=3):(r=d,0===w&&x(dq)),r!==d?(r=za(),r!==d?(B=q,q=\"divOp\"):(b=q,q=d)):(b=q,q=d),q===d&&(q=b,f.substr(b,4)===Gi?(r=Gi,b+=4):(r=d,0===w&&x(eq)),r!==d?(r=za(),r!==d?(B=q,q=\"idivOp\"):(b=q,q=d)):(b=q,q=d),q===d&&(q=b,f.substr(b,3)===Hi?(r=Hi,b+=3):(r=\nd,0===w&&x(fq)),r!==d?(r=za(),r!==d?(B=q,q=\"modOp\"):(b=q,q=d)):(b=q,q=d)))),q!==d?(F(),r=Zk(),r!==d?(B=n,n=[q,r]):(b=n,n=d)):(b=n,n=d);B=h;h=I(k,l)}else b=h,h=d;z[u]={i:b,result:h};return h}function Zk(){var h,u=233*b+73;if(h=z[u])return b=h.i,h.result;h=b;var k=Gg();if(k!==d){var l=[];var n=b;F();if(124===f.charCodeAt(b)){var q=xi;b++}else q=d,0===w&&x(yi);if(q===d){q=b;if(f.substr(b,5)===Ii){var r=Ii;b+=5}else r=d,0===w&&x(gq);if(r!==d){var y=za();y!==d?q=r=[r,y]:(b=q,q=d)}else b=q,q=d}q!==d?(F(),\ny=Gg(),y!==d?(B=n,n=y):(b=n,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),124===f.charCodeAt(b)?(q=xi,b++):(q=d,0===w&&x(yi)),q===d&&(q=b,f.substr(b,5)===Ii?(r=Ii,b+=5):(r=d,0===w&&x(gq)),r!==d?(y=za(),y!==d?q=r=[r,y]:(b=q,q=d)):(b=q,q=d)),q!==d?(F(),y=Gg(),y!==d?(B=n,n=y):(b=n,n=d)):(b=n,n=d);B=h;h=vi(\"unionOp\",k,l)}else b=h,h=d;z[u]={i:b,result:h};return h}function Gg(){var h,u,k=233*b+74;if(h=z[k])return b=h.i,h.result;h=b;var l=233*b+75;if(u=z[l])b=u.i,l=u.result;else{u=b;var n=hq();if(n!==d){var q=\nb;F();if(f.substr(b,8)===iq){var r=iq;b+=8}else r=d,0===w&&x(Mw);r!==d?(r=P(),r!==d?(f.substr(b,2)===ti?(r=ti,b+=2):(r=d,0===w&&x(wp)),r!==d?(r=za(),r!==d?(F(),r=Nb(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d);q===d&&(q=null);B=u;u=q?[\"instanceOfExpr\",[\"argExpr\",n],[\"sequenceType\"].concat(q)]:n}else b=u,u=d;u===d&&(u=hq());z[l]={i:b,result:u};l=u}if(l!==d){u=[];n=b;F();q=b;f.substr(b,9)===Ji?(r=Ji,b+=9):(r=d,0===w&&x(jq));r!==d&&(B=q,r=\"intersectOp\");q=r;q===d&&(q=b,f.substr(b,\n6)===Ki?(r=Ki,b+=6):(r=d,0===w&&x(kq)),r!==d&&(B=q,r=\"exceptOp\"),q=r);q!==d?(r=za(),r!==d?(F(),r=Gg(),r!==d?(B=n,n=[q,r]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d);for(;n!==d;)u.push(n),n=b,F(),q=b,f.substr(b,9)===Ji?(r=Ji,b+=9):(r=d,0===w&&x(jq)),r!==d&&(B=q,r=\"intersectOp\"),q=r,q===d&&(q=b,f.substr(b,6)===Ki?(r=Ki,b+=6):(r=d,0===w&&x(kq)),r!==d&&(B=q,r=\"exceptOp\"),q=r),q!==d?(r=za(),r!==d?(F(),r=Gg(),r!==d?(B=n,n=[q,r]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d);B=h;h=E(l,u)}else b=h,h=d;z[k]={i:b,result:h};return h}\nfunction hq(){var h,u,k=233*b+76;if(h=z[k])return b=h.i,h.result;h=b;var l;var n=233*b+77;if(u=z[n])b=u.i,n=u.result;else{u=b;var q;var r=233*b+78;if(l=z[r])b=l.i,r=l.result;else{l=b;var y=233*b+79;if(q=z[y])b=q.i,y=q.result;else{q=b;var C=$k();if(C!==d){var J=[];var N=b;F();if(f.substr(b,2)===Li){var oa=Li;b+=2}else oa=d,0===w&&x(lq);if(oa!==d)if(F(),oa=mq(),oa!==d){F();var wb=sf();wb!==d?(B=N,N=[oa,wb]):(b=N,N=d)}else b=N,N=d;else b=N,N=d;for(;N!==d;)J.push(N),N=b,F(),f.substr(b,2)===Li?(oa=Li,\nb+=2):(oa=d,0===w&&x(lq)),oa!==d?(F(),oa=mq(),oa!==d?(F(),wb=sf(),wb!==d?(B=N,N=[oa,wb]):(b=N,N=d)):(b=N,N=d)):(b=N,N=d);B=q;q=A(C,J)}else b=q,q=d;z[y]={i:b,result:q};y=q}y!==d?(q=b,F(),f.substr(b,4)===nq?(C=nq,b+=4):(C=d,0===w&&x(Nw)),C!==d?(C=P(),C!==d?(f.substr(b,2)===db?(C=db,b+=2):(C=d,0===w&&x(rc)),C!==d?(C=za(),C!==d?(F(),C=oq(),C!==d?(B=q,q=C):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d),q===d&&(q=null),B=l,l=q?[\"castExpr\",[\"argExpr\",y],q]:y):(b=l,l=d);z[r]={i:b,result:l};r=l}r!==\nd?(l=b,F(),f.substr(b,8)===pq?(y=pq,b+=8):(y=d,0===w&&x(Ow)),y!==d?(y=P(),y!==d?(f.substr(b,2)===db?(y=db,b+=2):(y=d,0===w&&x(rc)),y!==d?(y=za(),y!==d?(F(),y=oq(),y!==d?(B=l,l=y):(b=l,l=d)):(b=l,l=d)):(b=l,l=d)):(b=l,l=d)):(b=l,l=d),l===d&&(l=null),B=u,u=l?[\"castableExpr\",[\"argExpr\",r],l]:r):(b=u,u=d);z[n]={i:b,result:u};n=u}n!==d?(u=b,F(),f.substr(b,5)===qq?(r=qq,b+=5):(r=d,0===w&&x(Pw)),r!==d?(r=P(),r!==d?(f.substr(b,2)===db?(r=db,b+=2):(r=d,0===w&&x(rc)),r!==d?(r=za(),r!==d?(F(),r=Nb(),r!==d?(B=\nu,u=r):(b=u,u=d)):(b=u,u=d)):(b=u,u=d)):(b=u,u=d)):(b=u,u=d),u===d&&(u=null),B=h,h=u?[\"treatExpr\",[\"argExpr\",n],[\"sequenceType\"].concat(u)]:n):(b=h,h=d);z[k]={i:b,result:h};return h}function $k(){var h,u=233*b+80;if(h=z[u])return b=h.i,h.result;h=b;if(45===f.charCodeAt(b)){var k=kd;b++}else k=d,0===w&&x(ld);k!==d?(F(),k=$k(),k!==d?(B=h,h=[\"unaryMinusOp\",[\"operand\",k]]):(b=h,h=d)):(b=h,h=d);if(h===d&&(h=b,43===f.charCodeAt(b)?(k=Di,b++):(k=d,0===w&&x(Ei)),k!==d?(F(),k=$k(),k!==d?(B=h,h=[\"unaryPlusOp\",\n[\"operand\",k]]):(b=h,h=d)):(b=h,h=d),h===d))if(h=233*b+81,k=z[h])b=k.i,h=k.result;else{var l,n;k=233*b+85;if(l=z[k])b=l.i,k=l.result;else{l=b;if(f.substr(b,8)===rq){var q=rq;b+=8}else q=d,0===w&&x(Qw);if(q!==d){q=b;F();var r=233*b+86;(n=z[r])?(b=n.i,r=n.result):(f.substr(b,3)===sq?(n=sq,b+=3):(n=d,0===w&&x(Rw)),n===d&&(f.substr(b,6)===tq?(n=tq,b+=6):(n=d,0===w&&x(Sw))),z[r]={i:b,result:n},r=n);r!==d?(B=q,q=[\"validationMode\",r]):(b=q,q=d);q===d&&(q=b,F(),f.substr(b,4)===uq?(r=uq,b+=4):(r=d,0===w&&\nx(Tw)),r!==d?(F(),r=Aa(),r!==d?(B=q,q=[\"type\"].concat(r)):(b=q,q=d)):(b=q,q=d));q===d&&(q=null);F();123===f.charCodeAt(b)?(r=Fd,b++):(r=d,0===w&&x(Gd));r!==d?(F(),r=pc(),r!==d?(F(),125===f.charCodeAt(b)?(n=Hd,b++):(n=d,0===w&&x(Id)),n!==d?(B=l,l=[\"validateExpr\"].concat(q?[q]:[],[[\"argExpr\",r]])):(b=l,l=d)):(b=l,l=d)):(b=l,l=d)}else b=l,l=d;z[k]={i:b,result:l};k=l}if(k===d){k=233*b+87;if(l=z[k])b=l.i,k=l.result;else{l=b;q=[];r=vq();if(r!==d)for(;r!==d;)q.push(r),r=vq();else q=d;q!==d?(F(),123===f.charCodeAt(b)?\n(r=Fd,b++):(r=d,0===w&&x(Gd)),r!==d?(F(),pc(),F(),125===f.charCodeAt(b)?(r=Hd,b++):(r=d,0===w&&x(Id)),r!==d?(B=l,l=[\"extensionExpr\"].concat(q)):(b=l,l=d)):(b=l,l=d)):(b=l,l=d);z[k]={i:b,result:l};k=l}if(k===d)if(k=233*b+90,l=z[k])b=l.i,k=l.result;else{l=b;q=al();if(q!==d){r=[];n=b;F();if(33===f.charCodeAt(b)){var y=wq;b++}else y=d,0===w&&x(xq);y!==d?(F(),y=al(),y!==d?(B=n,n=y):(b=n,n=d)):(b=n,n=d);for(;n!==d;)r.push(n),n=b,F(),33===f.charCodeAt(b)?(y=wq,b++):(y=d,0===w&&x(xq)),y!==d?(F(),y=al(),y!==\nd?(B=n,n=y):(b=n,n=d)):(b=n,n=d);B=l;l=v(q,r)}else b=l,l=d;z[k]={i:b,result:l};k=l}}z[h]={i:b,result:k};h=k}z[u]={i:b,result:h};return h}function vq(){var h,u=233*b+88;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,2)===yq){var k=yq;b+=2}else k=d,0===w&&x(Uw);if(k!==d)if(P(),k=Aa(),k!==d){var l=b;var n=P();if(n!==d){var q;n=233*b+89;if(q=z[n])b=q.i,n=q.result;else{q=b;var r=[];var y=b;var C=Rb();if(C!==d){var J=b;w++;if(f.substr(b,2)===tf){var N=tf;b+=2}else N=d,0===w&&x(bl);w--;N===d?J=void 0:\n(b=J,J=d);J!==d?(B=y,y=C):(b=y,y=d)}else b=y,y=d;for(;y!==d;)r.push(y),y=b,C=Rb(),C!==d?(J=b,w++,f.substr(b,2)===tf?(N=tf,b+=2):(N=d,0===w&&x(bl)),w--,N===d?J=void 0:(b=J,J=d),J!==d?(B=y,y=C):(b=y,y=d)):(b=y,y=d);B=q;q=r=r.join(\"\");z[n]={i:b,result:q};n=q}B=l;l=n}else b=l,l=d;l===d&&(l=null);F();f.substr(b,2)===tf?(n=tf,b+=2):(n=d,0===w&&x(bl));n!==d?(B=h,h=l?[\"pragma\",[\"pragmaName\",k],[\"pragmaContents\",l]]:[\"pragma\",[\"pragmaName\",k]]):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}\nfunction al(){var h,u=233*b+91;if(h=z[u])return b=h.i,h.result;var k;h=233*b+92;if(k=z[h])b=k.i,h=k.result;else{k=b;var l=uf();if(l!==d){F();var n=cl();if(n!==d){F();var q=vf();q!==d?(B=k,k=[\"pathExpr\",l,n].concat(q)):(b=k,k=d)}else b=k,k=d}else b=k,k=d;if(k===d&&(k=b,l=uf(),l!==d?(F(),47===f.charCodeAt(b)?(n=Mi,b++):(n=d,0===w&&x(Ni)),n!==d?(F(),q=vf(),q!==d?(B=k,k=[\"pathExpr\",l].concat(q)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),k===d)){k=233*b+98;if(l=z[k])b=l.i,k=l.result;else{l=b;n=zq();if(n!==d){q=\nb;w++;var r=b;var y=F();var C=Hg();C!==d?r=y=[y,C]:(b=r,r=d);r===d&&(r=b,y=F(),C=sf(),C!==d?r=y=[y,C]:(b=r,r=d),r===d&&(r=b,y=F(),C=dl(),C!==d?r=y=[y,C]:(b=r,r=d)));w--;r===d?q=void 0:(b=q,q=d);q!==d?(B=l,l=n):(b=l,l=d)}else b=l,l=d;z[k]={i:b,result:l};k=l}k===d&&(k=b,l=uf(),l!==d&&(B=k,l=[\"pathExpr\",l]),k=l)}z[h]={i:b,result:k};h=k}h===d&&(h=233*b+95,(k=z[h])?(b=k.i,h=k.result):(k=b,47===f.charCodeAt(b)?(n=Mi,b++):(n=d,0===w&&x(Ni)),n!==d?(F(),l=vf(),l!==d?(B=k,k=[\"pathExpr\",[\"rootExpr\"]].concat(l)):\n(b=k,k=d)):(b=k,k=d),k===d&&(k=b,n=cl(),n!==d?(F(),l=vf(),l!==d?(B=k,k=[\"pathExpr\",[\"rootExpr\"],n].concat(l)):(b=k,k=d)):(b=k,k=d),k===d&&(k=b,47===f.charCodeAt(b)?(n=Mi,b++):(n=d,0===w&&x(Ni)),n!==d?(n=b,w++,l=b,q=F(),B=r=b,(y=m.Ra)?y=void 0:y=d,y!==d?(Vw.test(f.charAt(b))?(C=f.charAt(b),b++):(C=d,0===w&&x(Ww)),C!==d?r=y=[y,C]:(b=r,r=d)):(b=r,r=d),r!==d?l=q=[q,r]:(b=l,l=d),l===d&&(B=l=b,(q=!m.Ra)?q=void 0:q=d,q!==d?(Xw.test(f.charAt(b))?(r=f.charAt(b),b++):(r=d,0===w&&x(Yw)),r!==d?l=q=[q,r]:(b=l,\nl=d)):(b=l,l=d)),w--,l===d?n=void 0:(b=n,n=d),n!==d?(B=k,k=[\"pathExpr\",[\"rootExpr\"]]):(b=k,k=d)):(b=k,k=d))),z[h]={i:b,result:k},h=k));z[u]={i:b,result:h};return h}function vf(){var h,u=233*b+93;if(h=z[u])return b=h.i,h.result;h=b;var k=uf();if(k!==d){F();var l=cl();if(l!==d){F();var n=vf();n!==d?(B=h,h=[k,l].concat(n)):(b=h,h=d)}else b=h,h=d}else b=h,h=d;h===d&&(h=b,k=uf(),k!==d?(F(),47===f.charCodeAt(b)?(l=Mi,b++):(l=d,0===w&&x(Ni)),l!==d?(F(),n=vf(),n!==d?(B=h,h=[k].concat(n)):(b=h,h=d)):(b=h,\nh=d)):(b=h,h=d),h===d&&(h=b,k=uf(),k!==d&&(B=h,k=[k]),h=k));z[u]={i:b,result:h};return h}function uf(){var h,u=233*b+94;if(h=z[u])return b=h.i,h.result;h=b;var k;var l=233*b+97;if(k=z[l])b=k.i,l=k.result;else{var n=k=b;var q=zq();q!==d&&(B=n,q=Ck(q));n=q;if(n!==d){q=[];var r=b;F();var y=Hg();y!==d?(B=r,r=[\"predicate\",y]):(b=r,r=d);r===d&&(r=b,F(),y=sf(),y!==d?(B=r,r=[\"argumentList\",y]):(b=r,r=d),r===d&&(r=b,F(),y=dl(),y!==d?(B=r,r=y):(b=r,r=d)));for(;r!==d;)q.push(r),r=b,F(),y=Hg(),y!==d?(B=r,r=[\"predicate\",\ny]):(b=r,r=d),r===d&&(r=b,F(),y=sf(),y!==d?(B=r,r=[\"argumentList\",y]):(b=r,r=d),r===d&&(r=b,F(),y=dl(),y!==d?(B=r,r=y):(b=r,r=d)));B=k;k=t(n,q)}else b=k,k=d;z[l]={i:b,result:k};l=k}l!==d&&(B=h,l=[\"stepExpr\"].concat(l));h=l;if(h===d)if(h=233*b+99,l=z[h])b=l.i,h=l.result;else{l=b;k=233*b+103;if(n=z[k])b=n.i,k=n.result;else{n=b;q=233*b+104;if(r=z[q])b=r.i,q=r.result;else{y=r=b;if(f.substr(b,6)===Aq){var C=Aq;b+=6}else C=d,0===w&&x(Zw);if(C!==d){if(f.substr(b,2)===Za){var J=Za;b+=2}else J=d,0===w&&x(hc);\nJ!==d?y=C=[C,J]:(b=y,y=d)}else b=y,y=d;y!==d&&(B=r,y=\"parent\");r=y;r===d&&(y=r=b,f.substr(b,8)===Bq?(C=Bq,b+=8):(C=d,0===w&&x($w)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"ancestor\"),r=y,r===d&&(y=r=b,f.substr(b,17)===Cq?(C=Cq,b+=17):(C=d,0===w&&x(ax)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"preceding-sibling\"),r=y,r===d&&(y=r=b,f.substr(b,9)===Dq?(C=Dq,b+=9):(C=\nd,0===w&&x(bx)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"preceding\"),r=y,r===d&&(y=r=b,f.substr(b,16)===Eq?(C=Eq,b+=16):(C=d,0===w&&x(cx)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"ancestor-or-self\"),r=y))));z[q]={i:b,result:r};q=r}q!==d?(r=el(),r!==d?(B=n,n=[\"stepExpr\",[\"xpathAxis\",q],r]):(b=n,n=d)):(b=n,n=d);n===d&&(n=b,q=233*b+105,(r=z[q])?(b=r.i,q=r.result):(r=\nb,f.substr(b,2)===Fq?(y=Fq,b+=2):(y=d,0===w&&x(dx)),y!==d&&(B=r,y=[\"stepExpr\",[\"xpathAxis\",\"parent\"],[\"anyKindTest\"]]),r=y,z[q]={i:b,result:r},q=r),q!==d&&(B=n),n=q);z[k]={i:b,result:n};k=n}k===d&&(k=233*b+100,(n=z[k])?(b=n.i,k=n.result):(n=b,q=233*b+101,(r=z[q])?(b=r.i,q=r.result):(y=r=b,f.substr(b,5)===Gq?(C=Gq,b+=5):(C=d,0===w&&x(ex)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"child\"),r=y,r===d&&(y=r=b,f.substr(b,10)===Hq?(C=Hq,\nb+=10):(C=d,0===w&&x(fx)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"descendant\"),r=y,r===d&&(y=r=b,f.substr(b,9)===wf?(C=wf,b+=9):(C=d,0===w&&x(fl)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"attribute\"),r=y,r===d&&(y=r=b,f.substr(b,4)===Iq?(C=Iq,b+=4):(C=d,0===w&&x(gx)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==\nd&&(B=r,y=\"self\"),r=y,r===d&&(y=r=b,f.substr(b,18)===Jq?(C=Jq,b+=18):(C=d,0===w&&x(hx)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"descendant-or-self\"),r=y,r===d&&(y=r=b,f.substr(b,17)===Kq?(C=Kq,b+=17):(C=d,0===w&&x(ix)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"following-sibling\"),r=y,r===d&&(y=r=b,f.substr(b,9)===Lq?(C=Lq,b+=9):(C=d,0===w&&x(jx)),C!==d?(f.substr(b,\n2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"following\"),r=y)))))),z[q]={i:b,result:r},q=r),q!==d?(r=el(),r!==d?(B=n,n=[\"stepExpr\",[\"xpathAxis\",q],r]):(b=n,n=d)):(b=n,n=d),n===d&&(n=233*b+102,(q=z[n])?(b=q.i,n=q.result):(q=b,64===f.charCodeAt(b)?(r=kx,b++):(r=d,0===w&&x(lx)),r===d&&(r=null),y=el(),y!==d?(B=q,q=r||\"attributeTest\"===y[0]||\"schemaAttributeTest\"===y[0]?[\"stepExpr\",[\"xpathAxis\",\"attribute\"],y]:[\"stepExpr\",[\"xpathAxis\",\"child\"],y]):(b=q,q=d),\nz[n]={i:b,result:q},n=q)),z[k]={i:b,result:n},k=n));if(k!==d){n=233*b+110;if(q=z[n])b=q.i,n=q.result;else{q=b;r=[];y=b;F();C=Hg();C!==d?(B=y,y=C):(b=y,y=d);for(;y!==d;)r.push(y),y=b,F(),C=Hg(),C!==d?(B=y,y=C):(b=y,y=d);B=q;q=r=r.length?[\"predicates\"].concat(r):[];z[n]={i:b,result:q};n=q}B=l;l=0===n.length?k:k.concat([n])}else b=l,l=d;z[h]={i:b,result:l};h=l}z[u]={i:b,result:h};return h}function cl(){var h,u=233*b+96;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,2)===Mq){var k=Mq;b+=2}else k=d,\n0===w&&x(mx);k!==d&&(B=h,k=[\"stepExpr\",[\"xpathAxis\",\"descendant-or-self\"],[\"anyKindTest\"]]);h=k;z[u]={i:b,result:h};return h}function el(){var h,u=233*b+106;if(h=z[u])return b=h.i,h.result;h=Nq();if(h===d){var k,l;h=233*b+107;if(k=z[h])b=k.i,h=k.result;else{k=233*b+108;if(l=z[k])b=l.i,k=l.result;else{l=b;if(f.substr(b,2)===Oq){var n=Oq;b+=2}else n=d,0===w&&x(nx);if(n!==d){var q=Kb();q!==d?(B=l,l=[\"Wildcard\",[\"star\"],[\"NCName\",q]]):(b=l,l=d)}else b=l,l=d;l===d&&(l=b,42===f.charCodeAt(b)?(n=vc,b++):\n(n=d,0===w&&x(wc)),n!==d&&(B=l,n=[\"Wildcard\"]),l=n,l===d&&(l=b,n=Pq(),n!==d?(42===f.charCodeAt(b)?(q=vc,b++):(q=d,0===w&&x(wc)),q!==d?(B=l,l=[\"Wildcard\",[\"uri\",n],[\"star\"]]):(b=l,l=d)):(b=l,l=d),l===d&&(l=b,n=Kb(),n!==d?(f.substr(b,2)===Qq?(q=Qq,b+=2):(q=d,0===w&&x(ox)),q!==d?(B=l,l=[\"Wildcard\",[\"NCName\",n],[\"star\"]]):(b=l,l=d)):(b=l,l=d))));z[k]={i:b,result:l};k=l}k===d&&(k=b,l=Aa(),l!==d&&(B=k,l=[\"nameTest\"].concat(l)),k=l);z[h]={i:b,result:k};h=k}}z[u]={i:b,result:h};return h}function sf(){var h,\nu=233*b+109;if(h=z[u])return b=h.i,h.result;h=b;if(40===f.charCodeAt(b)){var k=fb;b++}else k=d,0===w&&x(gb);if(k!==d){F();k=b;var l=gl();if(l!==d){var n=[];var q=b;F();if(44===f.charCodeAt(b)){var r=ua;b++}else r=d,0===w&&x(va);r!==d?(F(),r=gl(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d);for(;q!==d;)n.push(q),q=b,F(),44===f.charCodeAt(b)?(r=ua,b++):(r=d,0===w&&x(va)),r!==d?(F(),r=gl(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d);B=k;k=[l].concat(n)}else b=k,k=d;k===d&&(k=null);F();41===f.charCodeAt(b)?(n=Oa,b++):\n(n=d,0===w&&x(Pa));n!==d?(B=h,h=k||[]):(b=h,h=d)}else b=h,h=d;z[u]={i:b,result:h};return h}function Hg(){var h,u=233*b+111;if(h=z[u])return b=h.i,h.result;h=b;if(91===f.charCodeAt(b)){var k=Rq;b++}else k=d,0===w&&x(Sq);if(k!==d)if(F(),k=pc(),k!==d){F();if(93===f.charCodeAt(b)){var l=Tq;b++}else l=d,0===w&&x(Uq);l!==d?(B=h,h=k):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function dl(){var h,u=233*b+112;if(h=z[u])return b=h.i,h.result;h=b;if(63===f.charCodeAt(b)){var k=Ig;b++}else k=\nd,0===w&&x(Jg);k!==d?(F(),k=Vq(),k!==d?(B=h,h=\"*\"===k?[\"lookup\",[\"star\"]]:\"string\"===typeof k?[\"lookup\",[\"NCName\",k]]:[\"lookup\",k]):(b=h,h=d)):(b=h,h=d);z[u]={i:b,result:h};return h}function Vq(){var h,u=233*b+113;if(h=z[u])return b=h.i,h.result;h=Kb();h===d&&(h=hl(),h===d&&(h=il(),h===d&&(42===f.charCodeAt(b)?(h=vc,b++):(h=d,0===w&&x(wc)))));z[u]={i:b,result:h};return h}function mq(){var h,u=233*b+114;if(h=z[u])return b=h.i,h.result;h=b;var k=Aa();k!==d&&(B=h,k=[\"EQName\"].concat(k));h=k;h===d&&(h=\njl(),h===d&&(h=il()));z[u]={i:b,result:h};return h}function zq(){var h=233*b+115,u=z[h];if(u)return b=u.i,u.result;var k=gi();if(k===d&&(k=jl(),k===d&&(k=il(),k===d))){var l=233*b+120,n=z[l];if(n)b=n.i,k=n.result;else{var q=b;if(46===f.charCodeAt(b)){var r=xf;b++}else r=d,0===w&&x(yf);if(r!==d){var y=b;w++;if(46===f.charCodeAt(b)){var C=xf;b++}else C=d,0===w&&x(yf);w--;C===d?y=void 0:(b=y,y=d);y!==d?(B=q,q=[\"contextItemExpr\"]):(b=q,q=d)}else b=q,q=d;z[l]={i:b,result:q};k=q}if(k===d){var J,N=233*b+\n121,oa=z[N];if(oa)b=oa.i,k=oa.result;else{var wb=J=b;w++;var Tb=b;var dc=Vo();if(dc!==d){var je=F();if(40===f.charCodeAt(b)){var Ye=fb;b++}else Ye=d,0===w&&x(gb);Ye!==d?Tb=dc=[dc,je,Ye]:(b=Tb,Tb=d)}else b=Tb,Tb=d;w--;Tb===d?wb=void 0:(b=wb,wb=d);wb!==d?(Tb=Aa(),Tb!==d?(F(),je=sf(),je!==d?(B=J,J=[\"functionCallExpr\",[\"functionName\"].concat(Tb),[\"arguments\"].concat(je)]):(b=J,J=d)):(b=J,J=d)):(b=J,J=d);z[N]={i:b,result:J};k=J}if(k===d){var gg=233*b+124,ke=z[gg];if(ke)b=ke.i,k=ke.result;else{var Xa=Wq();\nif(Xa===d){var dd=233*b+140,hg=z[dd];if(hg)b=hg.i,Xa=hg.result;else{var ig=233*b+141,le=z[ig];if(le){b=le.i;var Qa=le.result}else{var Eb=b;if(f.substr(b,8)===Xq){var jg=Xq;b+=8}else jg=d,0===w&&x(px);if(jg!==d){F();var Ze=sc();Ze!==d?(B=Eb,Eb=Ze?[\"computedDocumentConstructor\",[\"argExpr\",Ze]]:[\"computedDocumentConstructor\"]):(b=Eb,Eb=d)}else b=Eb,Eb=d;z[ig]={i:b,result:Eb};Qa=Eb}if(Qa===d){var mb=233*b+142,ed=z[mb];if(ed)b=ed.i,Qa=ed.result;else{var xb=b;if(f.substr(b,7)===Lb){var ji=Lb;b+=7}else ji=\nd,0===w&&x(he);if(ji!==d){F();var sb=b;var fd=Aa();fd!==d&&(B=sb,fd=[\"tagName\"].concat(fd));sb=fd;if(sb===d)if(sb=b,123===f.charCodeAt(b)?(fd=Fd,b++):(fd=d,0===w&&x(Gd)),fd!==d){F();var kg=pc();if(kg!==d){F();if(125===f.charCodeAt(b)){var lg=Hd;b++}else lg=d,0===w&&x(Id);lg!==d?(B=sb,sb=[\"tagNameExpr\",kg]):(b=sb,sb=d)}else b=sb,sb=d}else b=sb,sb=d;if(sb!==d){F();var $e=233*b+143,Da=z[$e];if(Da){b=Da.i;var af=Da.result}else{var me=b;var Kd=sc();Kd!==d&&(B=me,Kd=Kd?[[\"contentExpr\",Kd]]:[]);me=Kd;z[$e]=\n{i:b,result:me};af=me}af!==d?(B=xb,xb=[\"computedElementConstructor\",sb].concat(af)):(b=xb,xb=d)}else b=xb,xb=d}else b=xb,xb=d;z[mb]={i:b,result:xb};Qa=xb}if(Qa===d){var mg=233*b+144,Ld=z[mg];if(Ld)b=Ld.i,Qa=Ld.result;else{var Ma=b;if(f.substr(b,9)===wf){var Lc=wf;b+=9}else Lc=d,0===w&&x(fl);if(Lc!==d){var ya=b;var ne=za();if(ne!==d){F();var oe=Aa();oe!==d?(B=ya,ya=[\"tagName\"].concat(oe)):(b=ya,ya=d)}else b=ya,ya=d;if(ya===d){ya=b;F();if(123===f.charCodeAt(b)){var tc=Fd;b++}else tc=d,0===w&&x(Gd);\nif(tc!==d){F();var ng=pc();if(ng!==d){F();if(125===f.charCodeAt(b)){var bf=Hd;b++}else bf=d,0===w&&x(Id);bf!==d?(B=ya,ya=[\"tagNameExpr\",ng]):(b=ya,ya=d)}else b=ya,ya=d}else b=ya,ya=d}ya!==d?(F(),tc=sc(),tc!==d?(B=Ma,Ma=[\"computedAttributeConstructor\",ya].concat([[\"valueExpr\",tc?tc:[\"sequenceExpr\"]]])):(b=Ma,Ma=d)):(b=Ma,Ma=d)}else b=Ma,Ma=d;z[mg]={i:b,result:Ma};Qa=Ma}if(Qa===d){var Ga=233*b+145,cf=z[Ga];if(cf)b=cf.i,Qa=cf.result;else{var Ub=b;if(f.substr(b,9)===Jb){var og=Jb;b+=9}else og=d,0===w&&\nx(ge);if(og!==d){F();var pg=233*b+146,df=z[pg];if(df){b=df.i;var Md=df.result}else{var pe=b;var qe=Kb();qe!==d&&(B=pe,qe=[\"prefix\",qe]);pe=qe;z[pg]={i:b,result:pe};Md=pe}if(Md===d){var mi=233*b+147,ef=z[mi];if(ef)b=ef.i,Md=ef.result;else{var re=b;var gd=sc();gd!==d&&(B=re,gd=gd?[[\"prefixExpr\",gd]]:[]);re=gd;z[mi]={i:b,result:re};Md=re}}if(Md!==d){F();var Ra=233*b+148,ff=z[Ra];if(ff){b=ff.i;var qg=ff.result}else{var Mc=b;var se=sc();se!==d&&(B=Mc,se=se?[[\"URIExpr\",se]]:[]);Mc=se;z[Ra]={i:b,result:Mc};\nqg=Mc}qg!==d?(B=Ub,Ub=[\"computedNamespaceConstructor\"].concat(Md,qg)):(b=Ub,Ub=d)}else b=Ub,Ub=d}else b=Ub,Ub=d;z[Ga]={i:b,result:Ub};Qa=Ub}if(Qa===d){var sg=233*b+149,tg=z[sg];if(tg)b=tg.i,Qa=tg.result;else{var Ya=b;if(f.substr(b,4)===Oi){var ug=Oi;b+=4}else ug=d,0===w&&x(Yq);if(ug!==d){F();var te=sc();te!==d?(B=Ya,Ya=[\"computedTextConstructor\"].concat(te?[[\"argExpr\",te]]:[])):(b=Ya,Ya=d)}else b=Ya,Ya=d;z[sg]={i:b,result:Ya};Qa=Ya}if(Qa===d){var gf=233*b+150,Ea=z[gf];if(Ea)b=Ea.i,Qa=Ea.result;else{var Ob=\nb;if(f.substr(b,7)===Pi){var oi=Pi;b+=7}else oi=d,0===w&&x(Zq);if(oi!==d){F();var ec=sc();ec!==d?(B=Ob,Ob=[\"computedCommentConstructor\"].concat(ec?[[\"argExpr\",ec]]:[])):(b=Ob,Ob=d)}else b=Ob,Ob=d;z[gf]={i:b,result:Ob};Qa=Ob}if(Qa===d){var Pb=233*b+151,vg=z[Pb];if(vg)b=vg.i,Qa=vg.result;else{var Vb=b;if(f.substr(b,22)===Qi){var wg=Qi;b+=22}else wg=d,0===w&&x($q);if(wg!==d){F();var nb=b;var eb=Kb();eb!==d&&(B=nb,eb=[\"piTarget\",eb]);nb=eb;if(nb===d)if(nb=b,123===f.charCodeAt(b)?(eb=Fd,b++):(eb=d,0===\nw&&x(Gd)),eb!==d){F();var xg=pc();if(xg!==d){F();if(125===f.charCodeAt(b)){var pi=Hd;b++}else pi=d,0===w&&x(Id);pi!==d?(B=nb,nb=[\"piTargetExpr\",xg]):(b=nb,nb=d)}else b=nb,nb=d}else b=nb,nb=d;if(nb!==d){F();var hd=sc();hd!==d?(B=Vb,Vb=[\"computedPIConstructor\",nb].concat(hd?[[\"piValueExpr\",hd]]:[])):(b=Vb,Vb=d)}else b=Vb,Vb=d}else b=Vb,Vb=d;z[Pb]={i:b,result:Vb};Qa=Vb}}}}}}}z[dd]={i:b,result:Qa};Xa=Qa}}z[gg]={i:b,result:Xa};k=Xa}if(k===d){var qi=233*b+152,hf=z[qi];if(hf)b=hf.i,k=hf.result;else{var yg=\n233*b+153,ue=z[yg];if(ue){b=ue.i;var Ha=ue.result}else{var Wb=b;var ri=Aa();if(ri!==d){if(35===f.charCodeAt(b)){var zg=qx;b++}else zg=d,0===w&&x(rx);if(zg!==d){var Ag=hl();Ag!==d?(B=Wb,Wb=[\"namedFunctionRef\",[\"functionName\"].concat(ri),Ag]):(b=Wb,Wb=d)}else b=Wb,Wb=d}else b=Wb,Wb=d;z[yg]={i:b,result:Wb};Ha=Wb}if(Ha===d){var jf,Bg=233*b+154,Cg=z[Bg];if(Cg)b=Cg.i,Ha=Cg.result;else{var Fb=b;var Dg=[];for(jf=Ve();jf!==d;)Dg.push(jf),jf=Ve();F();if(f.substr(b,8)===cc){var kf=cc;b+=8}else kf=d,0===w&&x(Ue);\nif(kf!==d){F();if(40===f.charCodeAt(b)){var Sa=fb;b++}else Sa=d,0===w&&x(gb);if(Sa!==d){F();var lf=Wo();lf===d&&(lf=null);F();if(41===f.charCodeAt(b)){var si=Oa;b++}else si=d,0===w&&x(Pa);if(si!==d){F();var Ta=b;if(f.substr(b,2)===db){var Xb=db;b+=2}else Xb=d,0===w&&x(rc);if(Xb!==d){var mf=P();if(mf!==d){var Oc=Nb();Oc!==d?(F(),B=Ta,Ta=[\"typeDeclaration\"].concat(Oc)):(b=Ta,Ta=d)}else b=Ta,Ta=d}else b=Ta,Ta=d;Ta===d&&(Ta=null);Xb=Xo();Xb!==d?(B=Fb,Fb=[\"inlineFunctionExpr\"].concat(Dg,[[\"paramList\"].concat(lf||\n[])],Ta?[Ta]:[],[[\"functionBody\",Xb]])):(b=Fb,Fb=d)}else b=Fb,Fb=d}else b=Fb,Fb=d}else b=Fb,Fb=d;z[Bg]={i:b,result:Fb};Ha=Fb}}z[qi]={i:b,result:Ha};k=Ha}if(k===d){var ve=233*b+155,nf=z[ve];if(nf)b=nf.i,k=nf.result;else{var fc=b;if(f.substr(b,3)===Td){var of=Td;b+=3}else of=d,0===w&&x(Ri);if(of!==d){F();if(123===f.charCodeAt(b)){var Eg=Fd;b++}else Eg=d,0===w&&x(Gd);if(Eg!==d){F();var gc=b;var Ia=kl();if(Ia!==d){var Nd=[];var tb=b;F();if(44===f.charCodeAt(b)){var Od=ua;b++}else Od=d,0===w&&x(va);if(Od!==\nd){F();var Pd=kl();Pd!==d?(B=tb,tb=Pd):(b=tb,tb=d)}else b=tb,tb=d;for(;tb!==d;)Nd.push(tb),tb=b,F(),44===f.charCodeAt(b)?(Od=ua,b++):(Od=d,0===w&&x(va)),Od!==d?(F(),Pd=kl(),Pd!==d?(B=tb,tb=Pd):(b=tb,tb=d)):(b=tb,tb=d);B=gc;gc=[Ia].concat(Nd)}else b=gc,gc=d;gc===d&&(gc=null);F();125===f.charCodeAt(b)?(Nd=Hd,b++):(Nd=d,0===w&&x(Id));Nd!==d?(B=fc,fc=gc?[\"mapConstructor\"].concat(gc):[\"mapConstructor\"]):(b=fc,fc=d)}else b=fc,fc=d}else b=fc,fc=d;z[ve]={i:b,result:fc};k=fc}if(k===d){var jb=233*b+159,Qd=\nz[jb];if(Qd)b=Qd.i,k=Qd.result;else{var yb=b;var we=233*b+160,uc=z[we];if(uc){b=uc.i;var Qb=uc.result}else{var Pc=b;if(91===f.charCodeAt(b)){var Fg=Rq;b++}else Fg=d,0===w&&x(Sq);if(Fg!==d){F();var Qc=b;var pf=ta();if(pf!==d){F();var id=[];var ob=b;if(44===f.charCodeAt(b)){var Rd=ua;b++}else Rd=d,0===w&&x(va);if(Rd!==d){F();var Ua=ta();Ua!==d?(B=ob,ob=Ua):(b=ob,ob=d)}else b=ob,ob=d;for(;ob!==d;)id.push(ob),ob=b,44===f.charCodeAt(b)?(Rd=ua,b++):(Rd=d,0===w&&x(va)),Rd!==d?(F(),Ua=ta(),Ua!==d?(B=ob,ob=\nUa):(b=ob,ob=d)):(b=ob,ob=d);B=Qc;Qc=p(pf,id)}else b=Qc,Qc=d;Qc===d&&(Qc=null);F();if(93===f.charCodeAt(b)){var Sd=Tq;b++}else Sd=d,0===w&&x(Uq);Sd!==d?(B=Pc,Pc=[\"squareArray\"].concat(Qc)):(b=Pc,Pc=d)}else b=Pc,Pc=d;z[we]={i:b,result:Pc};Qb=Pc}Qb!==d&&(B=yb,Qb=[\"arrayConstructor\",Qb]);yb=Qb;if(yb===d){yb=b;var qf=233*b+161,jd=z[qf];if(jd)b=jd.i,Qb=jd.result;else{var Ud=b;if(f.substr(b,5)===Vd){var ar=Vd;b+=5}else ar=d,0===w&&x(Si);if(ar!==d){F();var ll=sc();ll!==d?(B=Ud,Ud=[\"curlyArray\"].concat(ll?\n[[\"arrayElem\",ll]]:[])):(b=Ud,Ud=d)}else b=Ud,Ud=d;z[qf]={i:b,result:Ud};Qb=Ud}Qb!==d&&(B=yb,Qb=[\"arrayConstructor\",Qb]);yb=Qb}z[jb]={i:b,result:yb};k=yb}if(k===d){var br=233*b+162,ml=z[br];if(ml)b=ml.i,k=ml.result;else{var Wd=b;if(63===f.charCodeAt(b)){var cr=Ig;b++}else cr=d,0===w&&x(Jg);if(cr!==d){F();var Kg=Vq();Kg!==d?(B=Wd,Wd=\"*\"===Kg?[\"unaryLookup\",[\"star\"]]:\"string\"===typeof Kg?[\"unaryLookup\",[\"NCName\",Kg]]:[\"unaryLookup\",Kg]):(b=Wd,Wd=d)}else b=Wd,Wd=d;z[br]={i:b,result:Wd};k=Wd}}}}}}}}z[h]=\n{i:b,result:k};return k}function gi(){var h,u,k=233*b+116;if(h=z[k])return b=h.i,h.result;var l,n;h=233*b+117;if(u=z[h])b=u.i,h=u.result;else{u=b;var q;var r=233*b+195;if(l=z[r])b=l.i,r=l.result;else{var y=q=n=l=b;if(46===f.charCodeAt(b)){var C=xf;b++}else C=d,0===w&&x(yf);if(C!==d){var J=xe();J!==d?y=C=[C,J]:(b=y,y=d)}else b=y,y=d;if(y===d)if(y=b,C=xe(),C!==d){J=b;if(46===f.charCodeAt(b)){var N=xf;b++}else N=d,0===w&&x(yf);if(N!==d){y=[];zf.test(f.charAt(b))?(J=f.charAt(b),b++):(J=d,0===w&&x(Af));\nfor(;J!==d;)y.push(J),zf.test(f.charAt(b))?(J=f.charAt(b),b++):(J=d,0===w&&x(Af));J=N=[N,y]}else b=J,J=d;J===d&&(J=null);y=C=[C,J]}else b=y,y=d;y!==d?(sx.test(f.charAt(b))?(C=f.charAt(b),b++):(C=d,0===w&&x(tx)),C!==d?(ux.test(f.charAt(b))?(J=f.charAt(b),b++):(J=d,0===w&&x(vx)),J===d&&(J=null),N=xe(),N!==d?q=y=[y,C,J,N]:(b=q,q=d)):(b=q,q=d)):(b=q,q=d);n=q!==d?f.substring(n,b):q;n!==d&&(B=l,n=[\"doubleConstantExpr\",[\"value\",n]]);l=n;z[r]={i:b,result:l};r=l}r===d&&(r=233*b+194,(l=z[r])?(b=l.i,r=l.result):\n(N=n=l=b,46===f.charCodeAt(b)?(q=xf,b++):(q=d,0===w&&x(yf)),q!==d?(C=xe(),C!==d?N=q=[q,C]:(b=N,N=d)):(b=N,N=d),n=N!==d?f.substring(n,b):N,n!==d&&(B=l,n=[\"decimalConstantExpr\",[\"value\",n]]),l=n,l===d&&(N=n=l=b,q=xe(),q!==d?(46===f.charCodeAt(b)?(C=xf,b++):(C=d,0===w&&x(yf)),C!==d?(N=xe(),N===d&&(N=null),N=q=[q,C,N]):(b=N,N=d)):(b=N,N=d),n=N!==d?f.substring(n,b):N,n!==d&&(B=l,n=[\"decimalConstantExpr\",[\"value\",n]]),l=n),z[r]={i:b,result:l},r=l),r===d&&(r=hl()));r!==d?(l=b,w++,wx.test(f.charAt(b))?(n=\nf.charAt(b),b++):(n=d,0===w&&x(xx)),w--,n===d?l=void 0:(b=l,l=d),l!==d?(B=u,u=r):(b=u,u=d)):(b=u,u=d);z[h]={i:b,result:u};h=u}h===d&&(h=b,u=bb(),u!==d&&(B=h,u=[\"stringConstantExpr\",[\"value\",Ti(u)]]),h=u);z[k]={i:b,result:h};return h}function jl(){var h,u=233*b+118;if(h=z[u])return b=h.i,h.result;h=b;if(36===f.charCodeAt(b)){var k=Jc;b++}else k=d,0===w&&x(Kc);k!==d?(k=Aa(),k!==d?(B=h,h=[\"varRef\",[\"name\"].concat(k)]):(b=h,h=d)):(b=h,h=d);z[u]={i:b,result:h};return h}function il(){var h,u=233*b+119;\nif(h=z[u])return b=h.i,h.result;h=b;if(40===f.charCodeAt(b)){var k=fb;b++}else k=d,0===w&&x(gb);if(k!==d)if(F(),k=pc(),k!==d){F();if(41===f.charCodeAt(b)){var l=Oa;b++}else l=d,0===w&&x(Pa);l!==d?(B=h,h=k):(b=h,h=d)}else b=h,h=d;else b=h,h=d;h===d&&(h=b,40===f.charCodeAt(b)?(k=fb,b++):(k=d,0===w&&x(gb)),k!==d?(F(),41===f.charCodeAt(b)?(k=Oa,b++):(k=d,0===w&&x(Pa)),k!==d?(B=h,h=[\"sequenceExpr\"]):(b=h,h=d)):(b=h,h=d));z[u]={i:b,result:h};return h}function gl(){var h,u=233*b+122;if(h=z[u])return b=h.i,\nh.result;h=ta();if(h===d){var k;h=233*b+123;if(k=z[h])b=k.i,h=k.result;else{k=b;if(63===f.charCodeAt(b)){var l=Ig;b++}else l=d,0===w&&x(Jg);l!==d&&(B=k,l=[\"argumentPlaceholder\"]);k=l;z[h]={i:b,result:k};h=k}}z[u]={i:b,result:h};return h}function Wq(){var h,u=233*b+125;if(h=z[u])return b=h.i,h.result;var k,l;h=233*b+126;if(k=z[h])b=k.i,h=k.result;else{k=b;if(60===f.charCodeAt(b)){var n=Yp;b++}else n=d,0===w&&x(Zp);if(n!==d)if(n=Ui(),n!==d){var q=233*b+127;if(l=z[q])b=l.i,q=l.result;else{l=b;var r=\n[];var y=b;var C=Bf();C!==d?(C=dr(),C===d&&(C=null),B=y,y=C):(b=y,y=d);for(;y!==d;)r.push(y),y=b,C=Bf(),C!==d?(C=dr(),C===d&&(C=null),B=y,y=C):(b=y,y=d);B=l;l=r=r.filter(Boolean);z[q]={i:b,result:l};q=l}r=b;f.substr(b,2)===er?(l=er,b+=2):(l=d,0===w&&x(yx));l!==d&&(B=r,l=null);r=l;if(r===d)if(r=b,62===f.charCodeAt(b)?(l=Vk,b++):(l=d,0===w&&x(Wk)),l!==d){l=[];for(y=fr();y!==d;)l.push(y),y=fr();F();f.substr(b,2)===gr?(y=gr,b+=2):(y=d,0===w&&x(zx));y!==d?(y=Ui(),y!==d?(Bf(),62===f.charCodeAt(b)?(C=Vk,\nb++):(C=d,0===w&&x(Wk)),C!==d?(B=r,r=1===n.length?n[0]:n[0].prefix+\":\"+n[1],y=1===y.length?y[0]:y[0].prefix+\":\"+y[1],r!==y&&Lg(\"XQST0118\",'The start and the end tag of an element constructor must be equal. \"'+r+'\" does not match \"'+y+'\"'),r=nl(l,!0,!0)):(b=r,r=d)):(b=r,r=d)):(b=r,r=d)}else b=r,r=d;r!==d?(B=k,k=[\"elementConstructor\",[\"tagName\"].concat(n)].concat(q.length?[[\"attributeList\"].concat(q)]:[],r&&r.length?[[\"elementContent\"].concat(r)]:[])):(b=k,k=d)}else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};\nh=k}if(h===d){h=233*b+134;if(k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,4)===hr?(n=hr,b+=4):(n=d,0===w&&x(Ax));if(n!==d){n=b;q=233*b+135;if(l=z[q])b=l.i;else{l=[];y=r=b;w++;45===f.charCodeAt(b)?(C=kd,b++):(C=d,0===w&&x(ld));w--;C===d?y=void 0:(b=y,y=d);y!==d?(C=Rb(),C!==d?r=y=[y,C]:(b=r,r=d)):(b=r,r=d);if(r===d)if(r=b,45===f.charCodeAt(b)?(y=kd,b++):(y=d,0===w&&x(ld)),y!==d){var J=C=b;w++;if(45===f.charCodeAt(b)){var N=kd;b++}else N=d,0===w&&x(ld);w--;N===d?J=void 0:(b=J,J=d);J!==d?(N=Rb(),N!==d?\nC=J=[J,N]:(b=C,C=d)):(b=C,C=d);C!==d?r=y=[y,C]:(b=r,r=d)}else b=r,r=d;for(;r!==d;)l.push(r),y=r=b,w++,45===f.charCodeAt(b)?(C=kd,b++):(C=d,0===w&&x(ld)),w--,C===d?y=void 0:(b=y,y=d),y!==d?(C=Rb(),C!==d?r=y=[y,C]:(b=r,r=d)):(b=r,r=d),r===d&&(r=b,45===f.charCodeAt(b)?(y=kd,b++):(y=d,0===w&&x(ld)),y!==d?(J=C=b,w++,45===f.charCodeAt(b)?(N=kd,b++):(N=d,0===w&&x(ld)),w--,N===d?J=void 0:(b=J,J=d),J!==d?(N=Rb(),N!==d?C=J=[J,N]:(b=C,C=d)):(b=C,C=d),C!==d?r=y=[y,C]:(b=r,r=d)):(b=r,r=d));z[q]={i:b,result:l}}n=\nf.substring(n,b);f.substr(b,3)===ir?(q=ir,b+=3):(q=d,0===w&&x(Bx));q!==d?(B=k,k=[\"computedCommentConstructor\",[\"argExpr\",[\"stringConstantExpr\",[\"value\",n]]]]):(b=k,k=d)}else b=k,k=d;z[h]={i:b,result:k};h=k}if(h===d)if(h=233*b+136,k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,2)===jr?(n=jr,b+=2):(n=d,0===w&&x(Cx));if(n!==d){n=b;q=233*b+206;if(l=z[q])b=l.i,q=l.result;else{r=l=b;w++;y=b;88===f.charCodeAt(b)?(C=Dx,b++):(C=d,0===w&&x(Ex));C===d&&(120===f.charCodeAt(b)?(C=Fx,b++):(C=d,0===w&&x(Gx)));C!==\nd?(77===f.charCodeAt(b)?(J=Hx,b++):(J=d,0===w&&x(Ix)),J===d&&(109===f.charCodeAt(b)?(J=Jx,b++):(J=d,0===w&&x(Kx))),J!==d?(76===f.charCodeAt(b)?(N=Lx,b++):(N=d,0===w&&x(Mx)),N===d&&(108===f.charCodeAt(b)?(N=Nx,b++):(N=d,0===w&&x(Ox))),N!==d?y=C=[C,J,N]:(b=y,y=d)):(b=y,y=d)):(b=y,y=d);w--;y===d?r=void 0:(b=r,r=d);if(r!==d){var oa;y=233*b+230;if(C=z[y])b=C.i,y=C.result;else{J=C=b;N=233*b+229;(oa=z[N])?(b=oa.i,N=oa.result):(oa=ol(),oa===d&&(58===f.charCodeAt(b)?(oa=Vi,b++):(oa=d,0===w&&x(Wi))),z[N]={i:b,\nresult:oa},N=oa);if(N!==d){J=[];for(oa=kr();oa!==d;)J.push(oa),oa=kr();J=N=[N,J]}else b=J,J=d;C=J!==d?f.substring(C,b):J;z[y]={i:b,result:C};y=C}y!==d?l=r=[r,y]:(b=l,l=d)}else b=l,l=d;z[q]={i:b,result:l};q=l}n=q!==d?f.substring(n,b):q;if(n!==d){q=b;l=Bf();if(l!==d){l=b;r=233*b+137;if(y=z[r])b=y.i;else{y=[];J=C=b;w++;f.substr(b,2)===Cf?(N=Cf,b+=2):(N=d,0===w&&x(pl));w--;N===d?J=void 0:(b=J,J=d);J!==d?(N=Rb(),N!==d?C=J=[J,N]:(b=C,C=d)):(b=C,C=d);for(;C!==d;)y.push(C),J=C=b,w++,f.substr(b,2)===Cf?(N=\nCf,b+=2):(N=d,0===w&&x(pl)),w--,N===d?J=void 0:(b=J,J=d),J!==d?(N=Rb(),N!==d?C=J=[J,N]:(b=C,C=d)):(b=C,C=d);z[r]={i:b,result:y}}l=f.substring(l,b);B=q;q=l}else b=q,q=d;q===d&&(q=null);f.substr(b,2)===Cf?(l=Cf,b+=2):(l=d,0===w&&x(pl));l!==d?(B=k,k=[\"computedPIConstructor\",[\"piTarget\",n],[\"piValueExpr\",[\"stringConstantExpr\",[\"value\",q]]]]):(b=k,k=d)}else b=k,k=d}else b=k,k=d;z[h]={i:b,result:k};h=k}}z[u]={i:b,result:h};return h}function dr(){var h,u=233*b+128;if(h=z[u])return b=h.i,h.result;var k=b;\nh=Ui();if(h!==d){Bf();if(61===f.charCodeAt(b)){var l=Cd;b++}else l=d,0===w&&x(Dd);if(l!==d){Bf();var n;l=233*b+129;if(n=z[l])b=n.i,l=n.result;else{n=b;if(34===f.charCodeAt(b)){var q=ye;b++}else q=d,0===w&&x(ze);if(q!==d){q=[];var r=Df();for(r===d&&(r=lr());r!==d;)q.push(r),r=Df(),r===d&&(r=lr());34===f.charCodeAt(b)?(r=ye,b++):(r=d,0===w&&x(ze));r!==d?(B=n,n=nl(q,!1,!1)):(b=n,n=d)}else b=n,n=d;if(n===d)if(n=b,39===f.charCodeAt(b)?(q=Ae,b++):(q=d,0===w&&x(Be)),q!==d){q=[];r=Ef();for(r===d&&(r=mr());r!==\nd;)q.push(r),r=Ef(),r===d&&(r=mr());39===f.charCodeAt(b)?(r=Ae,b++):(r=d,0===w&&x(Be));r!==d?(B=n,n=nl(q,!1,!1)):(b=n,n=d)}else b=n,n=d;z[l]={i:b,result:n};l=n}l!==d?(B=k,k=l,1===h.length&&\"xmlns\"===h[0]?(k.length&&\"string\"!==typeof k[0]&&Lg(\"XQST0022\",\"A namespace declaration may not contain enclosed expressions\"),k=[\"namespaceDeclaration\",k.length?[\"uri\",k[0]]:[\"uri\"]]):\"xmlns\"===h[0].prefix?(k.length&&\"string\"!==typeof k[0]&&Lg(\"XQST0022\",\"The namespace declaration for 'xmlns:\"+h[1]+\"' may not contain enclosed expressions\"),\nk=[\"namespaceDeclaration\",[\"prefix\",h[1]],k.length?[\"uri\",k[0]]:[\"uri\"]]):k=[\"attributeConstructor\",[\"attributeName\"].concat(h),0===k.length?[\"attributeValue\"]:1===k.length&&\"string\"===typeof k[0]?[\"attributeValue\",k[0]]:[\"attributeValueExpr\"].concat(k)]):(b=k,k=d)}else b=k,k=d}else b=k,k=d;z[u]={i:b,result:k};return k}function lr(){var h,u=233*b+130;if(h=z[u])return b=h.i,h.result;h=b;var k;var l=233*b+203;if(k=z[l])b=k.i,l=k.result;else{var n=k=b;w++;if(Px.test(f.charAt(b))){var q=f.charAt(b);b++}else q=\nd,0===w&&x(Qx);w--;q===d?n=void 0:(b=n,n=d);n!==d?(q=Rb(),q!==d?(B=k,k=q):(b=k,k=d)):(b=k,k=d);z[l]={i:b,result:k};l=k}l!==d&&(B=h,l=l.replace(/[\\x20\\x0D\\x0A\\x09]/g,\" \"));h=l;h===d&&(h=ql());z[u]={i:b,result:h};return h}function mr(){var h,u=233*b+131;if(h=z[u])return b=h.i,h.result;h=b;var k;var l=233*b+204;if(k=z[l])b=k.i,l=k.result;else{var n=k=b;w++;if(Rx.test(f.charAt(b))){var q=f.charAt(b);b++}else q=d,0===w&&x(Sx);w--;q===d?n=void 0:(b=n,n=d);n!==d?(q=Rb(),q!==d?(B=k,k=q):(b=k,k=d)):(b=k,k=\nd);z[l]={i:b,result:k};l=k}l!==d&&(B=h,l=l.replace(/[\\x20\\x0D\\x0A\\x09]/g,\" \"));h=l;h===d&&(h=ql());z[u]={i:b,result:h};return h}function fr(){var h,u,k=233*b+132;if(h=z[k])return b=h.i,h.result;h=b;var l=233*b+138;if(u=z[l])b=u.i,l=u.result;else{u=b;if(f.substr(b,9)===nr){var n=nr;b+=9}else n=d,0===w&&x(Tx);if(n!==d){n=b;var q,r;var y=233*b+139;if(q=z[y])b=q.i;else{q=[];var C=r=b;w++;if(f.substr(b,3)===Ff){var J=Ff;b+=3}else J=d,0===w&&x(rl);w--;J===d?C=void 0:(b=C,C=d);C!==d?(J=Rb(),J!==d?r=C=[C,\nJ]:(b=r,r=d)):(b=r,r=d);for(;r!==d;)q.push(r),C=r=b,w++,f.substr(b,3)===Ff?(J=Ff,b+=3):(J=d,0===w&&x(rl)),w--,J===d?C=void 0:(b=C,C=d),C!==d?(J=Rb(),J!==d?r=C=[C,J]:(b=r,r=d)):(b=r,r=d);z[y]={i:b,result:q}}n=f.substring(n,b);f.substr(b,3)===Ff?(y=Ff,b+=3):(y=d,0===w&&x(rl));y!==d?(B=u,u=[\"CDataSection\",n]):(b=u,u=d)}else b=u,u=d;z[l]={i:b,result:u};l=u}l!==d&&(B=h);h=l;h===d&&(h=b,l=Wq(),l!==d&&(B=h),h=l,h===d&&(h=b,l=ql(),l!==d&&(B=h),h=l,h===d&&(l=h=b,u=233*b+202,(n=z[u])?(b=n.i,u=n.result):(y=\nn=b,w++,Ux.test(f.charAt(b))?(q=f.charAt(b),b++):(q=d,0===w&&x(Vx)),w--,q===d?y=void 0:(b=y,y=d),y!==d?(q=Rb(),q!==d?n=y=[y,q]:(b=n,n=d)):(b=n,n=d),z[u]={i:b,result:n},u=n),l=u!==d?f.substring(l,b):u,l!==d&&(B=h),h=l)));z[k]={i:b,result:h};return h}function ql(){var h,u=233*b+133;if(h=z[u])return b=h.i,h.result;h=Mg();if(h===d&&(h=Ng(),h===d)){h=b;if(f.substr(b,2)===or){var k=or;b+=2}else k=d,0===w&&x(Wx);k!==d&&(B=h,k=\"{\");h=k;h===d&&(h=b,f.substr(b,2)===pr?(k=pr,b+=2):(k=d,0===w&&x(Xx)),k!==d&&\n(B=h,k=\"}\"),h=k,h===d&&(h=b,k=sc(),k!==d&&(B=h,k=k||[\"sequenceExpr\"]),h=k))}z[u]={i:b,result:h};return h}function kl(){var h,u,k=233*b+156;if(h=z[k])return b=h.i,h.result;h=b;var l=233*b+157;if(u=z[l])b=u.i,l=u.result;else{u=b;var n=ta();n!==d&&(B=u,n=[\"mapKeyExpr\",n]);u=n;z[l]={i:b,result:u};l=u}if(l!==d)if(F(),58===f.charCodeAt(b)?(u=Vi,b++):(u=d,0===w&&x(Wi)),u!==d){F();u=233*b+158;if(n=z[u])b=n.i,u=n.result;else{n=b;var q=ta();q!==d&&(B=n,q=[\"mapValueExpr\",q]);n=q;z[u]={i:b,result:n};u=n}u!==\nd?(B=h,h=[\"mapConstructorEntry\",l,u]):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[k]={i:b,result:h};return h}function oq(){var h,u=233*b+163;if(h=z[u])return b=h.i,h.result;h=b;var k=Aa();if(k!==d){if(63===f.charCodeAt(b)){var l=Ig;b++}else l=d,0===w&&x(Jg);l===d&&(l=null);B=h;h=l?[\"singleType\",[\"atomicType\"].concat(k),[\"optional\"]]:[\"singleType\",[\"atomicType\"].concat(k)]}else b=h,h=d;z[u]={i:b,result:h};return h}function We(){var h,u=233*b+164;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,2)===db){var k=\ndb;b+=2}else k=d,0===w&&x(rc);k!==d?(k=P(),k!==d?(k=Nb(),k!==d?(B=h,h=[\"typeDeclaration\"].concat(k)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d);z[u]={i:b,result:h};return h}function Nb(){var h,u=233*b+165;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,16)===qr){var k=qr;b+=16}else k=d,0===w&&x(Yx);k!==d&&(B=h,k=[[\"voidSequenceType\"]]);h=k;if(h===d)if(h=b,k=Kk(),k!==d){var l=b;F();var n;var q=233*b+166;(n=z[q])?(b=n.i,q=n.result):(63===f.charCodeAt(b)?(n=Ig,b++):(n=d,0===w&&x(Jg)),n===d&&(42===f.charCodeAt(b)?\n(n=vc,b++):(n=d,0===w&&x(wc)),n===d&&(43===f.charCodeAt(b)?(n=Di,b++):(n=d,0===w&&x(Ei)))),z[q]={i:b,result:n},q=n);q!==d?(B=l,l=q):(b=l,l=d);l===d&&(l=null);B=h;h=[k].concat(l?[[\"occurrenceIndicator\",l]]:[])}else b=h,h=d;z[u]={i:b,result:h};return h}function Kk(){var h,u=233*b+167;if(h=z[u])return b=h.i,h.result;h=Nq();if(h===d){h=b;if(f.substr(b,6)===rr){var k=rr;b+=6}else k=d,0===w&&x(Zx);k!==d&&(B=h,k=[\"anyItemType\"]);h=k;if(h===d){var l;h=233*b+182;if(k=z[h])b=k.i,h=k.result;else{k=b;var n=[];\nfor(l=Ve();l!==d;)n.push(l),l=Ve();var q;l=233*b+183;if(q=z[l])b=q.i,l=q.result;else{q=b;if(f.substr(b,8)===cc){var r=cc;b+=8}else r=d,0===w&&x(Ue);r!==d?(F(),40===f.charCodeAt(b)?(r=fb,b++):(r=d,0===w&&x(gb)),r!==d?(F(),42===f.charCodeAt(b)?(r=vc,b++):(r=d,0===w&&x(wc)),r!==d?(F(),41===f.charCodeAt(b)?(r=Oa,b++):(r=d,0===w&&x(Pa)),r!==d?(B=q,q=[\"anyFunctionTest\"]):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d);z[l]={i:b,result:q};l=q}if(l===d)if(l=233*b+184,q=z[l])b=q.i,l=q.result;else{q=b;f.substr(b,\n8)===cc?(r=cc,b+=8):(r=d,0===w&&x(Ue));if(r!==d)if(F(),40===f.charCodeAt(b)?(r=fb,b++):(r=d,0===w&&x(gb)),r!==d){F();r=b;var y=Nb();if(y!==d){var C=[];var J=b;if(44===f.charCodeAt(b)){var N=ua;b++}else N=d,0===w&&x(va);N!==d?(F(),N=Nb(),N!==d?(B=J,J=N):(b=J,J=d)):(b=J,J=d);for(;J!==d;)C.push(J),J=b,44===f.charCodeAt(b)?(N=ua,b++):(N=d,0===w&&x(va)),N!==d?(F(),N=Nb(),N!==d?(B=J,J=N):(b=J,J=d)):(b=J,J=d);B=r;r=y.concat.apply(y,C)}else b=r,r=d;r===d&&(r=null);F();41===f.charCodeAt(b)?(C=Oa,b++):(C=d,\n0===w&&x(Pa));C!==d?(J=P(),J!==d?(f.substr(b,2)===db?(N=db,b+=2):(N=d,0===w&&x(rc)),N!==d?(y=P(),y!==d?(N=Nb(),N!==d?(B=q,q=[\"typedFunctionTest\",[\"paramTypeList\",[\"sequenceType\"].concat(r)],[\"sequenceType\"].concat(N)]):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)}else b=q,q=d;else b=q,q=d;z[l]={i:b,result:q};l=q}l!==d?(B=k,k=[l[0]].concat(n,l.slice(1))):(b=k,k=d);z[h]={i:b,result:k};h=k}h===d&&(h=233*b+185,(k=z[h])?(b=k.i,h=k.result):(k=233*b+186,(n=z[k])?(b=n.i,k=n.result):(n=b,f.substr(b,\n3)===Td?(l=Td,b+=3):(l=d,0===w&&x(Ri)),l!==d?(F(),40===f.charCodeAt(b)?(l=fb,b++):(l=d,0===w&&x(gb)),l!==d?(F(),42===f.charCodeAt(b)?(l=vc,b++):(l=d,0===w&&x(wc)),l!==d?(F(),41===f.charCodeAt(b)?(l=Oa,b++):(l=d,0===w&&x(Pa)),l!==d?(B=n,n=[\"anyMapTest\"]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d),z[k]={i:b,result:n},k=n),k===d&&(k=233*b+187,(n=z[k])?(b=n.i,k=n.result):(n=b,f.substr(b,3)===Td?(l=Td,b+=3):(l=d,0===w&&x(Ri)),l!==d?(F(),40===f.charCodeAt(b)?(l=fb,b++):(l=d,0===w&&x(gb)),l!==d?(F(),l=sr(),\nl!==d?(F(),44===f.charCodeAt(b)?(q=ua,b++):(q=d,0===w&&x(va)),q!==d?(F(),q=Nb(),q!==d?(F(),41===f.charCodeAt(b)?(r=Oa,b++):(r=d,0===w&&x(Pa)),r!==d?(B=n,n=[\"typedMapTest\",l,[\"sequenceType\"].concat(q)]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d),z[k]={i:b,result:n},k=n)),z[h]={i:b,result:k},h=k),h===d&&(h=233*b+188,(k=z[h])?(b=k.i,h=k.result):(k=233*b+189,(n=z[k])?(b=n.i,k=n.result):(n=b,f.substr(b,5)===Vd?(l=Vd,b+=5):(l=d,0===w&&x(Si)),l!==d?(F(),40===f.charCodeAt(b)?(l=fb,b++):\n(l=d,0===w&&x(gb)),l!==d?(F(),42===f.charCodeAt(b)?(l=vc,b++):(l=d,0===w&&x(wc)),l!==d?(F(),41===f.charCodeAt(b)?(l=Oa,b++):(l=d,0===w&&x(Pa)),l!==d?(B=n,n=[\"anyArrayTest\"]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d),z[k]={i:b,result:n},k=n),k===d&&(k=233*b+190,(n=z[k])?(b=n.i,k=n.result):(n=b,f.substr(b,5)===Vd?(l=Vd,b+=5):(l=d,0===w&&x(Si)),l!==d?(F(),40===f.charCodeAt(b)?(l=fb,b++):(l=d,0===w&&x(gb)),l!==d?(F(),l=Nb(),l!==d?(F(),41===f.charCodeAt(b)?(q=Oa,b++):(q=d,0===w&&x(Pa)),q!==d?(B=n,n=[\"typedArrayTest\",\n[\"sequenceType\"].concat(l)]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d),z[k]={i:b,result:n},k=n)),z[h]={i:b,result:k},h=k),h===d&&(h=sr(),h===d&&(h=233*b+191,(k=z[h])?(b=k.i,h=k.result):(k=b,40===f.charCodeAt(b)?(n=fb,b++):(n=d,0===w&&x(gb)),n!==d?(F(),n=Kk(),n!==d?(F(),41===f.charCodeAt(b)?(l=Oa,b++):(l=d,0===w&&x(Pa)),l!==d?(B=k,k=[\"parenthesizedItemType\",n]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),z[h]={i:b,result:k},h=k)))))}}z[u]={i:b,result:h};return h}function sr(){var h,u=233*b+168;if(h=z[u])return b=\nh.i,h.result;h=b;var k=Aa();k!==d&&(B=h,k=[\"atomicType\"].concat(k));h=k;z[u]={i:b,result:h};return h}function Nq(){var h,u=233*b+169;if(h=z[u])return b=h.i,h.result;var k;h=233*b+171;if(k=z[h])b=k.i,h=k.result;else{k=b;if(f.substr(b,14)===tr){var l=tr;b+=14}else l=d,0===w&&x($x);if(l!==d){F();l=ur();l===d&&(l=vr());l===d&&(l=null);F();if(41===f.charCodeAt(b)){var n=Oa;b++}else n=d,0===w&&x(Pa);n!==d?(B=k,k=[\"documentTest\"].concat(l?[l]:[])):(b=k,k=d)}else b=k,k=d;z[h]={i:b,result:k};h=k}if(h===d&&\n(h=ur(),h===d)){h=233*b+176;if(k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,10)===Xi?(l=Xi,b+=10):(l=d,0===w&&x(wr));if(l!==d)if(F(),l=xr(),l!==d)if(F(),44===f.charCodeAt(b)?(n=ua,b++):(n=d,0===w&&x(va)),n!==d)if(F(),n=Aa(),n!==d){F();if(41===f.charCodeAt(b)){var q=Oa;b++}else q=d,0===w&&x(Pa);q!==d?(B=k,k=[\"attributeTest\",[\"attributeName\",l],[\"typeName\"].concat(n)]):(b=k,k=d)}else b=k,k=d;else b=k,k=d;else b=k,k=d;else b=k,k=d;k===d&&(k=b,f.substr(b,10)===Xi?(l=Xi,b+=10):(l=d,0===w&&x(wr)),l!==d?\n(F(),l=xr(),l!==d?(F(),41===f.charCodeAt(b)?(n=Oa,b++):(n=d,0===w&&x(Pa)),n!==d?(B=k,k=[\"attributeTest\",[\"attributeName\",l]]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),k===d&&(k=b,f.substr(b,11)===yr?(l=yr,b+=11):(l=d,0===w&&x(ay)),l!==d&&(B=k,l=[\"attributeTest\"]),k=l));z[h]={i:b,result:k};h=k}h===d&&(h=vr(),h===d&&(h=233*b+178,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,17)===zr?(l=zr,b+=17):(l=d,0===w&&x(by)),l!==d?(F(),l=Aa(),l!==d?(F(),41===f.charCodeAt(b)?(n=Oa,b++):(n=d,0===w&&x(Pa)),n!==d?(B=k,k=[\"schemaAttributeTest\"].concat(l)):\n(b=k,k=d)):(b=k,k=d)):(b=k,k=d),z[h]={i:b,result:k},h=k),h===d&&(h=233*b+175,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,23)===Yi?(l=Yi,b+=23):(l=d,0===w&&x(Ar)),l!==d?(F(),l=Kb(),l!==d?(F(),41===f.charCodeAt(b)?(n=Oa,b++):(n=d,0===w&&x(Pa)),n!==d?(B=k,k=[\"piTest\",[\"piTarget\",l]]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),k===d&&(k=b,f.substr(b,23)===Yi?(l=Yi,b+=23):(l=d,0===w&&x(Ar)),l!==d?(F(),l=bb(),l!==d?(F(),41===f.charCodeAt(b)?(n=Oa,b++):(n=d,0===w&&x(Pa)),n!==d?(B=k,k=[\"piTest\",[\"piTarget\",l]]):(b=\nk,k=d)):(b=k,k=d)):(b=k,k=d),k===d&&(k=b,f.substr(b,24)===Br?(l=Br,b+=24):(l=d,0===w&&x(cy)),l!==d&&(B=k,l=[\"piTest\"]),k=l)),z[h]={i:b,result:k},h=k),h===d&&(h=233*b+173,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,9)===Cr?(l=Cr,b+=9):(l=d,0===w&&x(dy)),l!==d&&(B=k,l=[\"commentTest\"]),k=l,z[h]={i:b,result:k},h=k),h===d&&(h=233*b+172,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,6)===Dr?(l=Dr,b+=6):(l=d,0===w&&x(ey)),l!==d&&(B=k,l=[\"textTest\"]),k=l,z[h]={i:b,result:k},h=k),h===d&&(h=233*b+174,(k=z[h])?\n(b=k.i,h=k.result):(k=b,f.substr(b,16)===Er?(l=Er,b+=16):(l=d,0===w&&x(fy)),l!==d&&(B=k,l=[\"namespaceTest\"]),k=l,z[h]={i:b,result:k},h=k),h===d&&(h=233*b+170,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,6)===Fr?(l=Fr,b+=6):(l=d,0===w&&x(gy)),l!==d&&(B=k,l=[\"anyKindTest\"]),k=l,z[h]={i:b,result:k},h=k))))))))}z[u]={i:b,result:h};return h}function xr(){var h,u=233*b+177;if(h=z[u])return b=h.i,h.result;h=b;var k=Aa();k!==d&&(B=h,k=[\"QName\"].concat(k));h=k;h===d&&(h=b,42===f.charCodeAt(b)?(k=vc,b++):(k=\nd,0===w&&x(wc)),k!==d&&(B=h,k=[\"star\"]),h=k);z[u]={i:b,result:h};return h}function ur(){var h,u=233*b+179;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,7)===Lb){var k=Lb;b+=7}else k=d,0===w&&x(he);if(k!==d)if(F(),40===f.charCodeAt(b)?(k=fb,b++):(k=d,0===w&&x(gb)),k!==d)if(F(),k=Gr(),k!==d){F();if(44===f.charCodeAt(b)){var l=ua;b++}else l=d,0===w&&x(va);if(l!==d)if(F(),l=Aa(),l!==d){F();if(41===f.charCodeAt(b)){var n=Oa;b++}else n=d,0===w&&x(Pa);n!==d?(B=h,h=[\"elementTest\",[\"elementName\",k],[\"typeName\"].concat(l)]):\n(b=h,h=d)}else b=h,h=d;else b=h,h=d}else b=h,h=d;else b=h,h=d;else b=h,h=d;h===d&&(h=b,f.substr(b,7)===Lb?(k=Lb,b+=7):(k=d,0===w&&x(he)),k!==d?(F(),40===f.charCodeAt(b)?(k=fb,b++):(k=d,0===w&&x(gb)),k!==d?(F(),k=Gr(),k!==d?(F(),41===f.charCodeAt(b)?(l=Oa,b++):(l=d,0===w&&x(Pa)),l!==d?(B=h,h=[\"elementTest\",[\"elementName\",k]]):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d),h===d&&(h=b,f.substr(b,7)===Lb?(k=Lb,b+=7):(k=d,0===w&&x(he)),k!==d?(F(),40===f.charCodeAt(b)?(k=fb,b++):(k=d,0===w&&x(gb)),k!==d?(F(),\n41===f.charCodeAt(b)?(k=Oa,b++):(k=d,0===w&&x(Pa)),k!==d?(B=h,h=[\"elementTest\"]):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)));z[u]={i:b,result:h};return h}function Gr(){var h,u=233*b+180;if(h=z[u])return b=h.i,h.result;h=b;var k=Aa();k!==d&&(B=h,k=[\"QName\"].concat(k));h=k;h===d&&(h=b,42===f.charCodeAt(b)?(k=vc,b++):(k=d,0===w&&x(wc)),k!==d&&(B=h,k=[\"star\"]),h=k);z[u]={i:b,result:h};return h}function vr(){var h,u=233*b+181;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,14)===Zi){var k=Zi;b+=14}else k=d,0===\nw&&x(Hr);if(k!==d)if(F(),40===f.charCodeAt(b)?(k=fb,b++):(k=d,0===w&&x(gb)),k!==d)if(k=Aa(),k!==d){if(41===f.charCodeAt(b)){var l=Oa;b++}else l=d,0===w&&x(Pa);l!==d?(B=h,h=[\"schemaElementTest\"].concat(k)):(b=h,h=d)}else b=h,h=d;else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function Aa(){var h,u=233*b+192;if(h=z[u])return b=h.i,h.result;h=b;var k;var l=233*b+197;if(k=z[l])b=k.i,l=k.result;else{k=b;var n=Pq();if(n!==d){var q=Kb();q!==d?(B=k,k=[n,q]):(b=k,k=d)}else b=k,k=d;z[l]={i:b,result:k};\nl=k}l!==d&&(B=h,h=l,l={},l=[(l.prefix=null,l.URI=h[0],l),h[1]]);h=l;h===d&&(h=Ui());z[u]={i:b,result:h};return h}function hl(){var h,u=233*b+193;if(h=z[u])return b=h.i,h.result;h=b;var k=xe();k!==d&&(B=h,k=[\"integerConstantExpr\",[\"value\",k]]);h=k;z[u]={i:b,result:h};return h}function bb(){var h,u,k=233*b+196;if(h=z[k])return b=h.i,h.result;B=h=b;(u=m.Ra)?u=void 0:u=d;if(u!==d)if(34===f.charCodeAt(b)?(u=ye,b++):(u=d,0===w&&x(ze)),u!==d){u=[];var l=Mg();l===d&&(l=Ng(),l===d&&(l=Df(),l===d&&(Ir.test(f.charAt(b))?\n(l=f.charAt(b),b++):(l=d,0===w&&x(Jr)))));for(;l!==d;)u.push(l),l=Mg(),l===d&&(l=Ng(),l===d&&(l=Df(),l===d&&(Ir.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Jr)))));34===f.charCodeAt(b)?(l=ye,b++):(l=d,0===w&&x(ze));l!==d?(B=h,h=u.join(\"\")):(b=h,h=d)}else b=h,h=d;else b=h,h=d;if(h===d){B=h=b;(u=m.Ra)?u=void 0:u=d;if(u!==d)if(39===f.charCodeAt(b)?(u=Ae,b++):(u=d,0===w&&x(Be)),u!==d){u=[];l=Mg();l===d&&(l=Ng(),l===d&&(l=Ef(),l===d&&(Kr.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Lr)))));\nfor(;l!==d;)u.push(l),l=Mg(),l===d&&(l=Ng(),l===d&&(l=Ef(),l===d&&(Kr.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Lr)))));39===f.charCodeAt(b)?(l=Ae,b++):(l=d,0===w&&x(Be));l!==d?(B=h,h=u.join(\"\")):(b=h,h=d)}else b=h,h=d;else b=h,h=d;if(h===d){B=h=b;(u=!m.Ra)?u=void 0:u=d;if(u!==d)if(34===f.charCodeAt(b)?(u=ye,b++):(u=d,0===w&&x(ze)),u!==d){u=[];l=Df();l===d&&(Mr.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Nr)));for(;l!==d;)u.push(l),l=Df(),l===d&&(Mr.test(f.charAt(b))?(l=f.charAt(b),\nb++):(l=d,0===w&&x(Nr)));34===f.charCodeAt(b)?(l=ye,b++):(l=d,0===w&&x(ze));l!==d?(B=h,h=u.join(\"\")):(b=h,h=d)}else b=h,h=d;else b=h,h=d;if(h===d)if(B=h=b,(u=!m.Ra)?u=void 0:u=d,u!==d)if(39===f.charCodeAt(b)?(u=Ae,b++):(u=d,0===w&&x(Be)),u!==d){u=[];l=Ef();l===d&&(Or.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Pr)));for(;l!==d;)u.push(l),l=Ef(),l===d&&(Or.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Pr)));39===f.charCodeAt(b)?(l=Ae,b++):(l=d,0===w&&x(Be));l!==d?(B=h,h=u.join(\"\")):(b=\nh,h=d)}else b=h,h=d;else b=h,h=d}}z[k]={i:b,result:h};return h}function Pq(){var h,u=233*b+198;if(h=z[u])return b=h.i,h.result;h=b;if(81===f.charCodeAt(b)){var k=hy;b++}else k=d,0===w&&x(iy);if(k!==d)if(F(),123===f.charCodeAt(b)?(k=Fd,b++):(k=d,0===w&&x(Gd)),k!==d){k=[];if(Qr.test(f.charAt(b))){var l=f.charAt(b);b++}else l=d,0===w&&x(Rr);for(;l!==d;)k.push(l),Qr.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Rr));125===f.charCodeAt(b)?(l=Hd,b++):(l=d,0===w&&x(Id));l!==d?(B=h,h=k.join(\"\").replace(/\\s+/g,\n\" \").trim()):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function Mg(){var h,u=233*b+199;if(h=z[u])return b=h.i,h.result;var k=h=b;if(38===f.charCodeAt(b)){var l=jy;b++}else l=d,0===w&&x(ky);if(l!==d){if(f.substr(b,2)===Ai){var n=Ai;b+=2}else n=d,0===w&&x(Pp);n===d&&(f.substr(b,2)===Bi?(n=Bi,b+=2):(n=d,0===w&&x(Rp)),n===d&&(f.substr(b,3)===Sr?(n=Sr,b+=3):(n=d,0===w&&x(ly)),n===d&&(f.substr(b,4)===Tr?(n=Tr,b+=4):(n=d,0===w&&x(my)),n===d&&(f.substr(b,4)===Ur?(n=Ur,b+=4):(n=d,0===\nw&&x(ny))))));if(n!==d){if(59===f.charCodeAt(b)){var q=$h;b++}else q=d,0===w&&x(ai);q!==d?k=l=[l,n,q]:(b=k,k=d)}else b=k,k=d}else b=k,k=d;h=k!==d?f.substring(h,b):k;z[u]={i:b,result:h};return h}function Df(){var h,u=233*b+200;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,2)===Vr){var k=Vr;b+=2}else k=d,0===w&&x(oy);k!==d&&(B=h,k='\"');h=k;z[u]={i:b,result:h};return h}function Ef(){var h,u=233*b+201;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,2)===Wr){var k=Wr;b+=2}else k=d,0===w&&x(py);k!==\nd&&(B=h,k=\"'\");h=k;z[u]={i:b,result:h};return h}function sl(){var h,u=233*b+205;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,2)===$i){var k=$i;b+=2}else k=d,0===w&&x(Xr);if(k!==d){var l=[];var n=Yr();for(n===d&&(n=sl());n!==d;)l.push(n),n=Yr(),n===d&&(n=sl());f.substr(b,2)===aj?(n=aj,b+=2):(n=d,0===w&&x(Zr));n!==d?h=k=[k,l,n]:(b=h,h=d)}else b=h,h=d;z[u]={i:b,result:h};return h}function Ng(){var h,u=233*b+207;if(h=z[u])return b=h.i,h.result;var k=h=b;if(f.substr(b,3)===$r){var l=$r;b+=3}else l=\nd,0===w&&x(qy);if(l!==d){var n=[];if(as.test(f.charAt(b))){var q=f.charAt(b);b++}else q=d,0===w&&x(bs);if(q!==d)for(;q!==d;)n.push(q),as.test(f.charAt(b))?(q=f.charAt(b),b++):(q=d,0===w&&x(bs));else n=d;n!==d?(59===f.charCodeAt(b)?(q=$h,b++):(q=d,0===w&&x(ai)),q!==d?k=l=[l,n,q]:(b=k,k=d)):(b=k,k=d)}else b=k,k=d;h=k!==d?f.substring(h,b):k;if(h===d){k=h=b;f.substr(b,2)===cs?(l=cs,b+=2):(l=d,0===w&&x(ry));if(l!==d){n=[];zf.test(f.charAt(b))?(q=f.charAt(b),b++):(q=d,0===w&&x(Af));if(q!==d)for(;q!==d;)n.push(q),\nzf.test(f.charAt(b))?(q=f.charAt(b),b++):(q=d,0===w&&x(Af));else n=d;n!==d?(59===f.charCodeAt(b)?(q=$h,b++):(q=d,0===w&&x(ai)),q!==d?k=l=[l,n,q]:(b=k,k=d)):(b=k,k=d)}else b=k,k=d;h=k!==d?f.substring(h,b):k}z[u]={i:b,result:h};return h}function Ui(){var h,u=233*b+208;if(h=z[u])return b=h.i,h.result;var k;h=233*b+224;if(k=z[h])b=k.i,h=k.result;else{var l=b;k=Kb();if(k!==d){if(58===f.charCodeAt(b)){var n=Vi;b++}else n=d,0===w&&x(Wi);n!==d?(n=Kb(),n!==d?(B=l,l={},l=[(l.prefix=k,l),n]):(b=l,l=d)):(b=l,\nl=d)}else b=l,l=d;z[h]={i:b,result:l};h=l}h===d&&(h=233*b+225,(k=z[h])?(b=k.i,h=k.result):(k=b,l=Kb(),l!==d&&(B=k,l=[l]),k=l,z[h]={i:b,result:k},h=k));z[u]={i:b,result:h};return h}function Kb(){var h,u,k=233*b+209;if(h=z[k])return b=h.i,h.result;h=b;var l=ol();if(l!==d){var n=[];for(u=tl();u!==d;)n.push(u),u=tl();B=h;h=l+n.join(\"\")}else b=h,h=d;z[k]={i:b,result:h};return h}function Rb(){var h,u=233*b+210;if(h=z[u])return b=h.i,h.result;sy.test(f.charAt(b))?(h=f.charAt(b),b++):(h=d,0===w&&x(ty));if(h===\nd){h=b;if(uy.test(f.charAt(b))){var k=f.charAt(b);b++}else k=d,0===w&&x(vy);if(k!==d){if(ds.test(f.charAt(b))){var l=f.charAt(b);b++}else l=d,0===w&&x(es);l!==d?h=k=[k,l]:(b=h,h=d)}else b=h,h=d}z[u]={i:b,result:h};return h}function xe(){var h,u=233*b+211;if(h=z[u])return b=h.i,h.result;h=b;var k=[];if(zf.test(f.charAt(b))){var l=f.charAt(b);b++}else l=d,0===w&&x(Af);if(l!==d)for(;l!==d;)k.push(l),zf.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Af));else k=d;k!==d&&(B=h,k=k.join(\"\"));h=k;z[u]=\n{i:b,result:h};return h}function Yr(){var h,u=233*b+212;if(h=z[u])return b=h.i,h.result;var k=h=b;w++;if(f.substr(b,2)===$i){var l=$i;b+=2}else l=d,0===w&&x(Xr);w--;l===d?k=void 0:(b=k,k=d);if(k!==d){l=b;w++;if(f.substr(b,2)===aj){var n=aj;b+=2}else n=d,0===w&&x(Zr);w--;n===d?l=void 0:(b=l,l=d);l!==d?(n=Rb(),n!==d?h=k=[k,l,n]:(b=h,h=d)):(b=h,h=d)}else b=h,h=d;z[u]={i:b,result:h};return h}function Nk(){var h,u=233*b+219;if(h=z[u])return b=h.i,h.result;h=b;var k=jl();if(k!==d){F();if(f.substr(b,2)===\nMb){var l=Mb;b+=2}else l=d,0===w&&x(ie);l!==d?(F(),l=ta(),l!==d?(B=h,h=[\"transformCopy\",k,[\"copySource\",l]]):(b=h,h=d)):(b=h,h=d)}else b=h,h=d;z[u]={i:b,result:h};return h}function F(){var h,u,k=233*b+220;if(h=z[k])return b=h.i,h.result;h=[];for(u=Og();u!==d;)h.push(u),u=Og();z[k]={i:b,result:h};return h}function P(){var h,u=233*b+221;if(h=z[u])return b=h.i,h.result;h=[];var k=Og();if(k!==d)for(;k!==d;)h.push(k),k=Og();else h=d;z[u]={i:b,result:h};return h}function Bf(){var h,u=233*b+222;if(h=z[u])return b=\nh.i,h.result;h=[];if(32===f.charCodeAt(b)){var k=ul;b++}else k=d,0===w&&x(vl);k===d&&(9===f.charCodeAt(b)?(k=wl,b++):(k=d,0===w&&x(xl)),k===d&&(13===f.charCodeAt(b)?(k=yl,b++):(k=d,0===w&&x(zl)),k===d&&(10===f.charCodeAt(b)?(k=Al,b++):(k=d,0===w&&x(Bl)))));if(k!==d)for(;k!==d;)h.push(k),32===f.charCodeAt(b)?(k=ul,b++):(k=d,0===w&&x(vl)),k===d&&(9===f.charCodeAt(b)?(k=wl,b++):(k=d,0===w&&x(xl)),k===d&&(13===f.charCodeAt(b)?(k=yl,b++):(k=d,0===w&&x(zl)),k===d&&(10===f.charCodeAt(b)?(k=Al,b++):(k=d,\n0===w&&x(Bl)))));else h=d;z[u]={i:b,result:h};return h}function Og(){var h,u=233*b+223;if(h=z[u])return b=h.i,h.result;32===f.charCodeAt(b)?(h=ul,b++):(h=d,0===w&&x(vl));h===d&&(9===f.charCodeAt(b)?(h=wl,b++):(h=d,0===w&&x(xl)),h===d&&(13===f.charCodeAt(b)?(h=yl,b++):(h=d,0===w&&x(zl)),h===d&&(10===f.charCodeAt(b)?(h=Al,b++):(h=d,0===w&&x(Bl)),h===d&&(h=sl()))));z[u]={i:b,result:h};return h}function ol(){var h,u=233*b+226;if(h=z[u])return b=h.i,h.result;wy.test(f.charAt(b))?(h=f.charAt(b),b++):(h=\nd,0===w&&x(xy));if(h===d){h=b;if(yy.test(f.charAt(b))){var k=f.charAt(b);b++}else k=d,0===w&&x(zy);if(k!==d){if(ds.test(f.charAt(b))){var l=f.charAt(b);b++}else l=d,0===w&&x(es);l!==d?h=k=[k,l]:(b=h,h=d)}else b=h,h=d}z[u]={i:b,result:h};return h}function tl(){var h,u=233*b+227;if(h=z[u])return b=h.i,h.result;h=ol();h===d&&(Ay.test(f.charAt(b))?(h=f.charAt(b),b++):(h=d,0===w&&x(By)));z[u]={i:b,result:h};return h}function kr(){var h,u=233*b+228;if(h=z[u])return b=h.i,h.result;h=tl();h===d&&(58===f.charCodeAt(b)?\n(h=Vi,b++):(h=d,0===w&&x(Wi)));z[u]={i:b,result:h};return h}function Vo(){var h,u=233*b+231;if(h=z[u])return b=h.i,h.result;f.substr(b,5)===Vd?(h=Vd,b+=5):(h=d,0===w&&x(Si));h===d&&(f.substr(b,9)===wf?(h=wf,b+=9):(h=d,0===w&&x(fl)),h===d&&(f.substr(b,7)===Pi?(h=Pi,b+=7):(h=d,0===w&&x(Zq)),h===d&&(f.substr(b,13)===fs?(h=fs,b+=13):(h=d,0===w&&x(Cy)),h===d&&(f.substr(b,7)===Lb?(h=Lb,b+=7):(h=d,0===w&&x(he)),h===d&&(f.substr(b,14)===gs?(h=gs,b+=14):(h=d,0===w&&x(Dy)),h===d&&(f.substr(b,8)===cc?(h=cc,\nb+=8):(h=d,0===w&&x(Ue)),h===d&&(f.substr(b,2)===li?(h=li,b+=2):(h=d,0===w&&x(ip)),h===d&&(f.substr(b,4)===hi?(h=hi,b+=4):(h=d,0===w&&x($o)),h===d&&(f.substr(b,3)===Td?(h=Td,b+=3):(h=d,0===w&&x(Ri)),h===d&&(f.substr(b,14)===hs?(h=hs,b+=14):(h=d,0===w&&x(Ey)),h===d&&(f.substr(b,4)===Nc?(h=Nc,b+=4):(h=d,0===w&&x(rg)),h===d&&(f.substr(b,22)===Qi?(h=Qi,b+=22):(h=d,0===w&&x($q)),h===d&&(f.substr(b,16)===is?(h=is,b+=16):(h=d,0===w&&x(Fy)),h===d&&(f.substr(b,14)===Zi?(h=Zi,b+=14):(h=d,0===w&&x(Hr)),h===\nd&&(f.substr(b,6)===js?(h=js,b+=6):(h=d,0===w&&x(Gy)),h===d&&(f.substr(b,4)===Oi?(h=Oi,b+=4):(h=d,0===w&&x(Yq)),h===d&&(f.substr(b,10)===ki?(h=ki,b+=10):(h=d,0===w&&x(gp)))))))))))))))))));z[u]={i:b,result:h};return h}function za(){var h,u=233*b+232;if(h=z[u])return b=h.i,h.result;h=b;w++;if(40===f.charCodeAt(b)){var k=fb;b++}else k=d,0===w&&x(gb);k===d&&(34===f.charCodeAt(b)?(k=ye,b++):(k=d,0===w&&x(ze)),k===d&&(39===f.charCodeAt(b)?(k=Ae,b++):(k=d,0===w&&x(Be)),k===d&&(k=Og())));w--;k!==d?(b=h,\nh=void 0):h=d;z[u]={i:b,result:h};return h}function vi(h,u,k){return k.reduce(function(l,n){return[h,[\"firstOperand\",l],[\"secondOperand\",n]]},u)}function ks(h){1<=h&&55295>=h||57344<=h&&65533>=h||65536<=h&&1114111>=h||Lg(\"XQST0090\",\"The character reference \"+h+\" (\"+h.toString(16)+\") does not reference a valid codePoint.\")}function Ti(h){return m.Ra?h.replace(/(&[^;]+);/g,function(u){if(/^&#x/.test(u))return u=parseInt(u.slice(3,-1),16),ks(u),String.fromCodePoint(u);if(/^&#/.test(u))return u=parseInt(u.slice(2,\n-1),10),ks(u),String.fromCodePoint(u);switch(u){case \"<\":return\"<\";case \">\":return\">\";case \"&\":return\"&\";case \""\":return String.fromCharCode(34);case \"'\":return String.fromCharCode(39)}Lg(\"XPST0003\",'Unknown character reference: \"'+u+'\"')}):h}function nl(h,u,k){if(!h.length)return[];for(var l=[h[0]],n=1;n\",Wp=\"!=\",Xp=\"<=\",Yp=\"<\",$p=\">=\",Vk=\">\",Np=\"eq\",Op=\"ne\",Ai=\"lt\",Qp=\"le\",Bi=\"gt\",Sp=\"ge\",Tp=\"is\",Up=\"<<\",Vp=\">>\",rq=\"validate\",uq=\"type\",sq=\"lax\",tq=\"strict\",yq=\"(#\",tf=\"#)\",wq=\"!\",Mi=\"/\",Mq=\"//\",\nGq=\"child\",Za=\"::\",Hq=\"descendant\",wf=\"attribute\",Iq=\"self\",Jq=\"descendant-or-self\",Kq=\"following-sibling\",Lq=\"following\",kx=\"@\",Aq=\"parent\",Bq=\"ancestor\",Cq=\"preceding-sibling\",Dq=\"preceding\",Eq=\"ancestor-or-self\",Fq=\"..\",Oq=\"*:\",Qq=\":*\",Rq=\"[\",Tq=\"]\",Ig=\"?\",xf=\".\",er=\"/>\",gr=\"\",nr=\"\",!1),Iw=G(\"!=\",!1),Jw=G(\"<=\",!1),Zp=G(\"<\",!1),Kw=G(\">=\",!1),Wk=G(\">\",!1),Bw=G(\"eq\",!1),Cw=G(\"ne\",!1),Pp=G(\"lt\",!1),Dw=G(\"le\",!1),Rp=G(\"gt\",!1),Ew=G(\"ge\",!1),Fw=G(\"is\",!1),Gw=G(\"<<\",!1),Hw=G(\">>\",!1),Qw=G(\"validate\",\n!1),Tw=G(\"type\",!1),Rw=G(\"lax\",!1),Sw=G(\"strict\",!1),Uw=G(\"(#\",!1),bl=G(\"#)\",!1),xq=G(\"!\",!1),Ni=G(\"/\",!1),Ww=X([\"*\",\"<\",[\"a\",\"z\"],[\"A\",\"Z\"]],!1,!1),Yw=X([\"*\",[\"a\",\"z\"],[\"A\",\"Z\"]],!1,!1),mx=G(\"//\",!1),ex=G(\"child\",!1),hc=G(\"::\",!1),fx=G(\"descendant\",!1),fl=G(\"attribute\",!1),gx=G(\"self\",!1),hx=G(\"descendant-or-self\",!1),ix=G(\"following-sibling\",!1),jx=G(\"following\",!1),lx=G(\"@\",!1),Zw=G(\"parent\",!1),$w=G(\"ancestor\",!1),ax=G(\"preceding-sibling\",!1),bx=G(\"preceding\",!1),cx=G(\"ancestor-or-self\",!1),dx=\nG(\"..\",!1),nx=G(\"*:\",!1),ox=G(\":*\",!1),Sq=G(\"[\",!1),Uq=G(\"]\",!1),Jg=G(\"?\",!1),xx=X([[\"a\",\"z\"],[\"A\",\"Z\"]],!1,!1),yf=G(\".\",!1),yx=G(\"/>\",!1),zx=G(\"\",!1),Tx=G(\"f;f++)if(p=wu(g[f],c,e[m]))return 59!==p.type&&hm(a,p),p;default:return{type:59,g:2}}}59!==g.type&&hm(a,g);return g}\nfunction wu(a,c,e){var g=em(a,\"*\"),f=W(a,\"atomicType\");if(!f)return{type:59,g:2};if(Xc(cm(f,\"prefix\")+\":\"+f[2])===c.type)if(1===g.length){if(3===c.g)return e}else if(a=W(a,\"occurrenceIndicator\")[1],c.g===Zc(a))return e};function xu(a,c){ku(a,c)}function ku(a,c){var e=yu.get(a[0]);if(e)return e(a,c);for(e=1;e=c+e)return Q;t=f.next(t);g++;return t}},m)}function Pu(a){return a.map(function(c){return T(c.type,19)?Gh(c,3):c})}\nfunction Qu(a){a=Pu(a);if(a.some(function(c){return Number.isNaN(c.value)}))return[L(NaN,3)];a=Vn(a);if(!a)throw Error(\"FORG0006: Incompatible types to be converted to a common type\");return a}\nfunction Ru(a,c,e,g,f,m){return ce([f,m],function(p){var t=H(p);p=t.next().value;t=t.next().value;if(Infinity===p.value)return U.empty();if(-Infinity===p.value)return t&&Infinity===t.value?U.empty():g;if(t){if(isNaN(t.value))return U.empty();Infinity===t.value&&(t=null)}return isNaN(p.value)?U.empty():Ou(g,Math.round(p.value),t?Math.round(t.value):null)})}\nfunction Su(a,c,e,g,f){if(g.F())return f;a=Pu(g.S());a=Vn(a);if(!a)throw Error(\"FORG0006: Incompatible types to be converted to a common type\");if(!a.every(function(m){return T(m.type,2)}))throw Error(\"FORG0006: items passed to fn:sum are not all numeric.\");c=a.reduce(function(m,p){return m+p.value},0);return a.every(function(m){return T(m.type,5)})?U.s(L(c,5)):a.every(function(m){return T(m.type,3)})?U.s(L(c,3)):a.every(function(m){return T(m.type,4)})?U.s(L(c,4)):U.s(L(c,6))};var Tu=[].concat(Ll,[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"boolean\",l:[{type:59,g:2}],j:{type:0,g:3},m:function(a,c,e,g){return g.getEffectiveBooleanValue()?U.$():U.U()}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"true\",l:[],j:{type:0,g:3},m:function(){return U.$()}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"not\",l:[{type:59,g:2}],j:{type:0,g:3},m:function(a,c,e,g){return!1===g.getEffectiveBooleanValue()?U.$():U.U()}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nlocalName:\"false\",l:[],j:{type:0,g:3},m:function(){return U.U()}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"last\",l:[],j:{type:5,g:3},m:function(a){if(null===a.O)throw Error(\"XPDY0002: The fn:last() function depends on dynamic context, which is absent.\");var c=!1;return U.create({next:function(){if(c)return Q;var e=a.wa.ya();c=!0;return S(L(e,5))}},1)}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"position\",l:[],j:{type:5,g:3},m:function(a){if(null===\na.O)throw Error(\"XPDY0002: The fn:position() function depends on dynamic context, which is absent.\");return U.s(L(a.Ga+1,5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"current-dateTime\",l:[],j:{type:10,g:3},m:function(a){return U.s(L(Zf(a),10))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"current-date\",l:[],j:{type:7,g:3},m:function(a){return U.s(L(Jf(Zf(a),7),7))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"current-time\",l:[],\nj:{type:8,g:3},m:function(a){return U.s(L(Jf(Zf(a),8),8))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"implicit-timezone\",l:[],j:{type:17,g:3},m:function(a){return U.s(L($f(a),17))}}],Nl,Vl,Xl,[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"years-from-duration\",l:[{type:18,g:0}],j:{type:5,g:0},m:function(a,c,e,g){return g.F()?g:U.s(L(g.first().value.cb(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"months-from-duration\",l:[{type:18,\ng:0}],j:{type:5,g:0},m:function(a,c,e,g){return g.F()?g:U.s(L(g.first().value.$a(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"days-from-duration\",l:[{type:18,g:0}],j:{type:5,g:0},m:function(a,c,e,g){return g.F()?g:U.s(L(g.first().value.Za(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"hours-from-duration\",l:[{type:18,g:0}],j:{type:5,g:0},m:function(a,c,e,g){return g.F()?g:U.s(L(g.first().value.getHours(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nlocalName:\"minutes-from-duration\",l:[{type:18,g:0}],j:{type:5,g:0},m:function(a,c,e,g){return g.F()?g:U.s(L(g.first().value.getMinutes(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"seconds-from-duration\",l:[{type:18,g:0}],j:{type:4,g:0},m:function(a,c,e,g){return g.F()?g:U.s(L(g.first().value.getSeconds(),4))}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"id\",l:[{type:1,g:2},{type:53,g:3}],j:{type:54,g:2},m:Ku},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nlocalName:\"id\",l:[{type:1,g:2}],j:{type:54,g:2},m:function(a,c,e,g){return Ku(a,c,e,g,U.s(a.O))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"idref\",l:[{type:1,g:2},{type:53,g:3}],j:{type:53,g:2},m:Lu},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"idref\",l:[{type:1,g:2}],j:{type:53,g:2},m:function(a,c,e,g){return Lu(a,c,e,g,U.s(a.O))}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"parse-json\",l:[{type:1,g:3}],j:{type:59,g:0},m:function(a,\nc,e,g){try{var f=JSON.parse(g.first().value)}catch(m){throw Error(\"FOJS0001: parsed JSON string contains illegal JSON.\");}return Mu(f)}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"contains\",l:[{type:61,g:3},{type:46,g:3}],j:{type:0,g:3},m:function(a,c,e,g,f){return ce([g,f],function(m){m=H(m);var p=m.next().value,t=m.next().value;return p.h.some(function(v){return de(v.key,t)})?U.$():U.U()})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"entry\",\nl:[{type:46,g:3},{type:59,g:2}],j:{type:61,g:3},m:function(a,c,e,g,f){return g.map(function(m){return new fe([{key:m,value:Rc(f)}])})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"for-each\",l:[{type:61,g:3},{type:59,g:2}],j:{type:59,g:2},m:function(a,c,e,g,f){return ce([g,f],function(m){m=H(m);var p=m.next().value,t=m.next().value;return cg(p.h.map(function(v){return t.value.call(void 0,a,c,e,U.s(v.key),v.value())}))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",\nlocalName:\"get\",l:[{type:61,g:3},{type:46,g:3}],j:{type:59,g:2},m:ee},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"keys\",l:[{type:61,g:3}],j:{type:46,g:2},m:function(a,c,e,g){return ce([g],function(f){f=H(f).next().value;return U.create(f.h.map(function(m){return m.key}))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"merge\",l:[{type:61,g:2},{type:61,g:3}],j:{type:61,g:3},m:Nu},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"merge\",\nl:[{type:61,g:2}],j:{type:61,g:3},m:function(a,c,e,g){return Nu(a,c,e,g,U.s(new fe([{key:L(\"duplicates\",1),value:function(){return U.s(L(\"use-first\",1))}}])))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"put\",l:[{type:61,g:3},{type:46,g:3},{type:59,g:2}],j:{type:61,g:3},m:function(a,c,e,g,f,m){return ce([g,f],function(p){p=H(p);var t=p.next().value,v=p.next().value;p=t.h.concat();t=p.findIndex(function(A){return de(A.key,v)});0<=t?p.splice(t,1,{key:v,value:Rc(m)}):p.push({key:v,\nvalue:Rc(m)});return U.s(new fe(p))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"remove\",l:[{type:61,g:3},{type:46,g:2}],j:{type:61,g:3},m:function(a,c,e,g,f){return ce([g],function(m){var p=H(m).next().value.h.concat();return f.M(function(t){t.forEach(function(v){var A=p.findIndex(function(E){return de(E.key,v)});0<=A&&p.splice(A,1)});return U.s(new fe(p))})})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"size\",l:[{type:61,g:3}],j:{type:5,g:3},\nm:function(a,c,e,g){return g.map(function(f){return L(f.h.length,5)})}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"pi\",l:[],j:{type:3,g:3},m:function(){return U.s(L(Math.PI,3))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"exp\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.pow(Math.E,f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"exp10\",l:[{type:3,g:0}],j:{type:3,\ng:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.pow(10,f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"log\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.log(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"log10\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.log10(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",\nlocalName:\"pow\",l:[{type:3,g:0},{type:2,g:3}],j:{type:3,g:0},m:function(a,c,e,g,f){return f.M(function(m){var p=H(m).next().value;return g.map(function(t){return 1!==Math.abs(t.value)||Number.isFinite(p.value)?L(Math.pow(t.value,p.value),3):L(1,3)})})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"sqrt\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.sqrt(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",\nlocalName:\"sin\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.sin(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"cos\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.cos(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"tan\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.tan(f.value),3)})}},\n{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"asin\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.asin(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"acos\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.acos(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"atan\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,\ne,g){return g.map(function(f){return L(Math.atan(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"atan2\",l:[{type:3,g:0},{type:3,g:3}],j:{type:3,g:0},m:function(a,c,e,g,f){return f.M(function(m){var p=H(m).next().value;return g.map(function(t){return L(Math.atan2(t.value,p.value),3)})})}}],Dj,ij,[{namespaceURI:\"http://fontoxpath/operators\",localName:\"to\",l:[{type:5,g:0},{type:5,g:0}],j:{type:5,g:2},m:function(a,c,e,g,f){a=g.first();f=f.first();if(null===a||null===\nf)return U.empty();var m=a.value;f=f.value;return m>f?U.empty():U.create({next:function(){return S(L(m++,5))}},f-m+1)}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"QName\",l:[{type:1,g:0},{type:1,g:3}],j:{type:23,g:3},m:function(a,c,e,g,f){return ce([g,f],function(m){var p=H(m);m=p.next().value;p=p.next().value.value;if(!Vg(p,23))throw Error(\"FOCA0002: The provided QName is invalid.\");m=m?m.value||null:null;if(null===m&&p.includes(\":\"))throw Error(\"FOCA0002: The URI of a QName may not be empty if a prefix is provided.\");\nif(g.F())return U.s(L(new $c(\"\",null,p),23));if(!p.includes(\":\"))return U.s(L(new $c(\"\",m,p),23));var t=H(p.split(\":\"));p=t.next().value;t=t.next().value;return U.s(L(new $c(p,m,t),23))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"prefix-from-QName\",l:[{type:23,g:0}],j:{type:24,g:0},m:function(a,c,e,g){return ce([g],function(f){f=H(f).next().value;if(null===f)return U.empty();f=f.value;return f.prefix?U.s(L(f.prefix,24)):U.empty()})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nlocalName:\"local-name-from-QName\",l:[{type:23,g:0}],j:{type:24,g:0},m:function(a,c,e,g){return g.map(function(f){return L(f.value.localName,24)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"namespace-uri-from-QName\",l:[{type:23,g:0}],j:{type:20,g:0},m:function(a,c,e,g){return g.map(function(f){return L(f.value.namespaceURI||\"\",20)})}}],[{l:[{type:59,g:2}],m:function(a,c,e,g){return g.aa({empty:function(){return U.$()},multiple:function(){return U.U()},s:function(){return U.U()}})},\nlocalName:\"empty\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:0,g:3}},{l:[{type:59,g:2}],m:function(a,c,e,g){return g.aa({empty:function(){return U.U()},multiple:function(){return U.$()},s:function(){return U.$()}})},localName:\"exists\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:0,g:3}},{l:[{type:59,g:2}],m:function(a,c,e,g){return Ou(g,1,1)},localName:\"head\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:0}},{l:[{type:59,g:2}],m:function(a,\nc,e,g){return Ou(g,2,null)},localName:\"tail\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2},{type:5,g:3},{type:59,g:2}],m:function(a,c,e,g,f,m){if(g.F())return m;if(m.F())return g;a=g.S();f=f.first().value-1;0>f?f=0:f>a.length&&(f=a.length);c=a.slice(f);return U.create(a.slice(0,f).concat(m.S(),c))},localName:\"insert-before\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2},{type:5,g:3}],m:function(a,c,e,g,f){a=f.first().value;\ng=g.S();if(!g.length||1>a||a>g.length)return U.create(g);g.splice(a-1,1);return U.create(g)},localName:\"remove\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2}],m:function(a,c,e,g){return g.M(function(f){return U.create(f.reverse())})},localName:\"reverse\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2},{type:3,g:3}],m:function(a,c,e,g,f){return Ru(a,c,e,g,f,U.empty())},localName:\"subsequence\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nj:{type:59,g:2}},{l:[{type:59,g:2},{type:3,g:3},{type:3,g:3}],m:Ru,localName:\"subsequence\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2}],m:function(a,c,e,g){return g},localName:\"unordered\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:46,g:2},{type:46,g:3}],m:function(a,c,e,g,f){return f.M(function(m){var p=H(m).next().value;return Sg(g,c).map(function(t,v){return xn(\"eqOp\",t.type,p.type)(t,p,a)?L(v+1,5):L(-1,5)}).filter(function(t){return-1!==\nt.value})})},localName:\"index-of\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:5,g:2}},{l:[{type:46,g:2},{type:46,g:3},{type:1,g:3}],m:function(){throw Error(\"FOCH0002: No collations are supported\");},localName:\"index-of\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:5,g:2}},{l:[{type:59,g:2},{type:59,g:2}],m:function(a,c,e,g,f){var m=!1,p=Jj(a,c,e,g,f);return U.create({next:function(){if(m)return Q;var t=p.next(0);if(t.done)return t;m=!0;return S(L(t.value,0))}})},\nlocalName:\"deep-equal\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:0,g:3}},{l:[{type:59,g:2},{type:59,g:2},{type:1,g:3}],m:function(){throw Error(\"FOCH0002: No collations are supported\");},localName:\"deep-equal\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:0,g:3}},{l:[{type:59,g:2}],m:function(a,c,e,g){var f=!1;return U.create({next:function(){if(f)return Q;var m=g.ya();f=!0;return S(L(m,5))}})},localName:\"count\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nj:{type:5,g:3}},{l:[{type:46,g:2}],m:function(a,c,e,g){if(g.F())return g;a=Pu(g.S());a=Vn(a);if(!a)throw Error(\"FORG0006: Incompatible types to be converted to a common type\");if(!a.every(function(f){return T(f.type,2)}))throw Error(\"FORG0006: items passed to fn:avg are not all numeric.\");c=a.reduce(function(f,m){return f+m.value},0)/a.length;return a.every(function(f){return T(f.type,5)||T(f.type,3)})?U.s(L(c,3)):a.every(function(f){return T(f.type,4)})?U.s(L(c,4)):U.s(L(c,6))},localName:\"avg\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nj:{type:46,g:0}},{l:[{type:46,g:2}],m:function(a,c,e,g){if(g.F())return g;a=Qu(g.S());return U.s(a.reduce(function(f,m){return f.valuem.value?m:f}))},localName:\"min\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:46,g:0}},{l:[{type:46,g:2},{type:1,g:3}],m:function(){throw Error(\"FOCH0002: No collations are supported\");},localName:\"min\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:46,g:0}},{l:[{type:46,g:2}],m:function(a,c,e,g){return Su(a,c,e,g,U.s(L(0,5)))},localName:\"sum\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:46,g:3}},{l:[{type:46,g:2},{type:46,g:0}],m:Su,\nlocalName:\"sum\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:46,g:0}},{l:[{type:59,g:2}],m:function(a,c,e,g){if(!g.F()&&!g.za())throw Error(\"FORG0003: The argument passed to fn:zero-or-one contained more than one item.\");return g},localName:\"zero-or-one\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:0}},{l:[{type:59,g:2}],m:function(a,c,e,g){if(g.F())throw Error(\"FORG0004: The argument passed to fn:one-or-more was empty.\");return g},localName:\"one-or-more\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nj:{type:59,g:1}},{l:[{type:59,g:2}],m:function(a,c,e,g){if(!g.za())throw Error(\"FORG0005: The argument passed to fn:exactly-one is empty or contained more than one item.\");return g},localName:\"exactly-one\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:3}},{l:[{type:59,g:2},{type:60,g:3}],m:function(a,c,e,g,f){if(g.F())return g;var m=f.first(),p=m.o;if(1!==p.length)throw Error(\"XPTY0004: signature of function passed to fn:filter is incompatible.\");return g.filter(function(t){t=\nWh(p[0],U.s(t),c,\"fn:filter\",!1);t=m.value.call(void 0,a,c,e,t);if(!t.za()||!T(t.first().type,0))throw Error(\"XPTY0004: signature of function passed to fn:filter is incompatible.\");return t.first().value})},localName:\"filter\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2},{type:60,g:3}],m:function(a,c,e,g,f){if(g.F())return g;var m=f.first(),p=m.o;if(1!==p.length)throw Error(\"XPTY0004: signature of function passed to fn:for-each is incompatible.\");var t=g.value,\nv;return U.create({next:function(A){for(;;){if(!v){var E=t.next(0);if(E.done)return E;E=Wh(p[0],U.s(E.value),c,\"fn:for-each\",!1);v=m.value.call(void 0,a,c,e,E).value}E=v.next(A);if(!E.done)return E;v=null}}})},localName:\"for-each\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2},{type:59,g:2},{type:60,g:3}],m:function(a,c,e,g,f,m){if(g.F())return g;var p=m.first(),t=p.o;if(2!==t.length)throw Error(\"XPTY0004: signature of function passed to fn:fold-left is incompatible.\");\nreturn g.M(function(v){return v.reduce(function(A,E){A=Wh(t[0],A,c,\"fn:fold-left\",!1);E=Wh(t[1],U.s(E),c,\"fn:fold-left\",!1);return p.value.call(void 0,a,c,e,A,E)},f)})},localName:\"fold-left\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2},{type:59,g:2},{type:60,g:3}],m:function(a,c,e,g,f,m){if(g.F())return g;var p=m.first(),t=p.o;if(2!==t.length)throw Error(\"XPTY0004: signature of function passed to fn:fold-right is incompatible.\");return g.M(function(v){return v.reduceRight(function(A,\nE){A=Wh(t[0],A,c,\"fn:fold-right\",!1);E=Wh(t[1],U.s(E),c,\"fn:fold-right\",!1);return p.value.call(void 0,a,c,e,E,A)},f)})},localName:\"fold-right\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}}],sj,[{l:[{type:1,g:3},{type:61,g:3}],m:function(a,c,e,g,f){var m,p;return U.create({next:function(){if(!m){p=g.value.next(0).value.value;var t=f.first().h.reduce(function(O,R){O[R.key.value]=Rc(R.value());return O},Object.create(null)),v=t[\".\"]?t[\".\"]():U.empty();delete t[\".\"];var A=new Iu(function(O){return e.ga(O)},\nObject.keys(t).reduce(function(O,R){O[R]=R;return O},{}),function(O,R){return e.Qa(O,R)}),E=new Zt(A),I=Wt(p,{ca:!1,debug:c.debug});c.Ta&&xu(I,new Fu(E));var M=dm(I,[\"mainModule\",\"prolog\"]);M&&gu(M,E);I=dm(I,[\"mainModule\",\"queryBody\",\"*\"]);I=Qt(I,{qa:!1,ca:!0});try{I.P(E)}catch(O){Zl(p,O)}E=Object.keys(t).reduce(function(O,R){O[A.rb(null,R)]=t[R];return O},Object.create(null));v=v.F()?{O:null,Ga:-1,wa:v,ta:E}:{O:v.first(),Ga:0,wa:v,ta:E};v=new Wf(v);try{m=I.evaluate(v,c).value}catch(O){Zl(p,O)}}try{return m.next(0)}catch(O){Zl(p,\nO)}}})},localName:\"evaluate\",namespaceURI:\"http://fontoxml.com/fontoxpath\",j:{type:59,g:2}},{l:[],m:function(){return U.s(L(\"undefined\"===typeof VERSION?\"devbuild\":VERSION,1))},localName:\"version\",namespaceURI:\"http://fontoxml.com/fontoxpath\",j:{type:1,g:3}}],[{l:[{type:23,g:3},{type:5,g:3}],m:function(a,c,e,g,f){return ce([g,f],function(m){var p=H(m);m=p.next().value;p=p.next().value;var t=e.Aa(m.value.namespaceURI,m.value.localName,p.value);if(null===t)return U.empty();m=new ad({l:t.l,arity:p.value,\nlocalName:m.value.localName,namespaceURI:m.value.namespaceURI,j:t.j,value:t.m});return U.s(m)})},localName:\"function-lookup\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{g:0,type:60}},{l:[{type:60,g:3}],m:function(a,c,e,g){return ce([g],function(f){f=H(f).next().value;return f.Oa()?U.empty():U.s(L(new $c(\"\",f.v,f.J),23))})},localName:\"function-name\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:23,g:0}},{l:[{type:60,g:3}],m:function(a,c,e,g){return ce([g],function(f){f=\nH(f).next().value;return U.s(L(f.B,5))})},localName:\"function-arity\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:5,g:3}}]);function Uu(a){this.h=a}D=Uu.prototype;D.createAttributeNS=function(a,c){return this.h.createAttributeNS(a,c)};D.createCDATASection=function(a){return this.h.createCDATASection(a)};D.createComment=function(a){return this.h.createComment(a)};D.createDocument=function(){return this.h.createDocument()};D.createElementNS=function(a,c){return this.h.createElementNS(a,c)};D.createProcessingInstruction=function(a,c){return this.h.createProcessingInstruction(a,c)};D.createTextNode=function(a){return this.h.createTextNode(a)};var Vu=Object.create(null),Wu=Object.create(null);function Xu(a,c,e,g,f,m){this.J=a;this.v=c;this.h=e;this.B=g;this.o=f;this.C=m}function Yu(a,c){return a+(c?\"_DEBUG\":\"\")}function Zu(a,c,e){c=Yu(c,e);if(e=Wu[a])return e[c]||null;a=Vu[a];return a?(a=a[c])&&0!==a.length?a[0].h:null:null}\nfunction $u(a,c,e,g,f,m,p,t){var v=Vu[a];if(!v)return(a=Zu(a,c,m))?{ia:a,sb:!0}:null;c=Yu(c,m);v=v[c];if(!v)return(a=Wu[a]&&Wu[a][c])?{ia:a,sb:!0}:null;v=v.find(function(A){return A.o===p&&A.J.every(function(E){return e(E.prefix)===E.namespaceURI})&&A.v.every(function(E){return void 0!==g[E.name]})&&A.B.every(function(E){return f[E.prefix]===E.namespaceURI})&&A.C.every(function(E){var I=t(E.oc,E.arity);return I&&I.namespaceURI===E.Jb.namespaceURI&&I.localName===E.Jb.localName})});return v?{ia:v.h,\nsb:!1}:(a=Wu[a]&&Wu[a][c])?{ia:a,sb:!0}:null}function av(a,c,e,g){c=Yu(c,e);(a=Wu[a])&&(e=a[c])&&e===g&&delete a[c]}function bv(a,c,e,g,f,m,p){av(a,c,m,f);var t=Vu[a];t||(t=Vu[a]=Object.create(null));a=Yu(c,m);(c=t[a])||(c=t[a]=[]);c.push(new Xu(Object.values(e.h),Object.values(e.o),f,Object.keys(g).map(function(v){return{namespaceURI:g[v],prefix:v}}),p,e.B))};function cv(a,c,e,g,f,m,p){var t=c.ca?\"XQuery\":\"XPath\",v=c.ob?null:$u(a,t,e,g,f,c.debug,m,p);e=new Iu(e,g,p);var A=new Zt(e);if(null!==v)g=v.ia;else{g=Wt(a,c);p=new Fu(A);c.Ta&&ku(g,p);p=W(g,\"mainModule\");if(!p)throw Error(\"Can not execute a library module.\");g=W(p,\"prolog\");p=dm(p,[\"queryBody\",\"*\"]);if(g){if(!c.ca)throw Error(\"XPST0003: Use of XQuery functionality is not allowed in XPath context\");gu(g,A)}g=Z(p,c)}if(null===v||v.sb)Object.keys(f).forEach(function(E){var I=f[E];eu(A,I);A.o[A.h][E]=\nI}),g.P(A),c.ob||bv(a,t,e,f,g,c.debug,m);return{ia:g,ma:A}};var dv=Symbol(\"IS_XPATH_VALUE_SYMBOL\");function ev(a){return function(c,e){c=Uf(new ud(null===e?new od:e),c,Yc(a));e={};return e[dv]=!0,e.Eb=c,e}};Tu.forEach(function(a){Wm(a.namespaceURI,a.localName,a.l,a.j,a.m)});function fv(a){return a&&\"object\"===typeof a&&\"lookupNamespaceURI\"in a?function(c){return a.lookupNamespaceURI(c||null)}:function(){return null}}function gv(a){return a.replace(/(\\x0D\\x0A)|(\\x0D(?!\\x0A))/g,String.fromCharCode(10))}function hv(a){return function(c){var e=c.localName;return c.prefix?null:{namespaceURI:a,localName:e}}}\nfunction iv(a,c,e,g,f,m){var p,t,v,A,E,I;if(null===g||void 0===g)g=g||{};f?(p=f.logger||{trace:console.log.bind(console)},t=f.documentWriter,v=f.moduleImports,A=f.namespaceResolver,E=f.functionNameResolver,I=f.nodesFactory):(p={trace:console.log.bind(console)},v={},A=null,I=null,t=null,E=void 0);var M=new ud(null===e?new od:e);a=gv(a);e=v||Object.create(null);v=f.defaultFunctionNamespaceURI||\"http://www.w3.org/2005/xpath-functions\";var O=cv(a,m,A||fv(c),g,e,v,E||hv(v));a=c?Vf(M,c):U.empty();c=!I&&\nm.ca?new dk(c):new Uu(I);t=t?new rd(t):qd;I=Object.keys(g).reduce(function(X,Ba){var xa=g[Ba];X[\"Q{}\"+Ba+\"[0]\"]=xa&&\"object\"===typeof xa&&dv in xa?function(){return U.create(xa.Eb)}:function(){return Vf(M,g[Ba])};return X},Object.create(null));A={};E=H(Object.keys(O.ma.Da));for(e=E.next();!e.done;A={Wa:A.Wa},e=E.next())A.Wa=e.value,I[A.Wa]||(I[A.Wa]=function(X){return function(){return(0,O.ma.Da[X.Wa])(R,G)}}(A));var R=new Wf({O:a.first(),Ga:0,wa:a,ta:I});var G=new bg(m.debug,M,c,t,f.currentContext,\np);return{zb:R,Ab:G,ia:O.ia}};function jv(a,c){var e={},g=0,f=!1,m=null;return{next:function(){if(f)return Q;for(var p={};g {\\n\\t\\t\\t\\t\\tconst result = \"+a+\".next();\\n\\t\\t\\t\\t\\treturn result.done ? false : !!result.value; \\n\\t\\t\\t\\t})()\",{type:0});case 5:throw Error(\"Trying to get value of generated code with type None\");default:throw Error(\"Unreachable! Trying to get compiled value of unsupported GeneratedCodeType.\");\n}}var Yy={DONE_TOKEN:Q,getEffectiveBooleanValue:Bc,isSubtypeOf:T,ready:S};var Zy={bc:\"pathExpr\",Rb:\"andOp\",ac:\"orOp\",dc:\"stringConstantExpr\"},$y=Object.values(Zy);function az(a,c,e,g,f){a=W(a,e);a=W(a,$y);if(!a)return Wy(\"Unsupported: a base expression used with an operand.\");c+=e;g=g.Fb(a,c,g);return g.isAstAccepted?0===f?Xy(c,g.code,g.Ma):Vy(c,g.Ma,[g.code]):g};function bz(a,c,e){4===c&&(a+=\".next().value\");47===e&&(a=\"(function () { const attr = \"+a+\"; return attr ? domFacade.getData(attr) : null})()\");return a}\nfunction cz(a,c,e,g,f){var m=cm(W(a,\"firstOperand\")[1],\"type\");a=cm(W(a,\"secondOperand\")[1],\"type\");if(!m||!a)return Wy(\"Left or right type of compare are not found, annotation failed.\");var p=[47,1];if(!p.includes(m.type)||!p.includes(a.type))return Wy(\"Unsupported types in compare: [\"+Uc[m.type]+\", \"+Uc[a.type]+\"]\");if(!e.isAstAccepted)return e;if(!g.isAstAccepted)return g;if(!m||!a)return Wy(\"Operands in compare weren't annotated\");p=new Map([[\"eqOp\",\"===\"],[\"neOp\",\"!==\"]]);if(!p.has(c))return Wy(c+\n\" not yet implemented\");c=p.get(c);p=Uy(e.code,e.Ma);var t=Uy(g.code,g.Ma);return Vy(\"function \"+f+\"(contextItem) {\\n\\t\\t\\t\\t\"+e.Ea.join(\"\\n\")+\"\\n\\t\\t\\t \\t\"+g.Ea.join(\"\\n\")+\"\\n\\t \\t \\treturn \"+bz(p[0],p[1].type,m.type)+\" \"+c+\" \"+bz(t[0],t[1].type,a.type)+\";\\n\\t\\t}\",{type:3,j:{type:0}})}var dz={},ez=(dz.equalOp=\"eqOp\",dz.notEqualOp=\"neOp\",dz.lessThanOrEqualOp=\"leOp\",dz.lessThanOp=\"ltOp\",dz.greaterThanOrEqualOp=\"geOp\",dz.greaterThanOp=\"gtOp\",dz);function fz(a){return JSON.stringify(a).replace(/\\u2028/g,\"\\\\u2028\").replace(/\\u2029/g,\"\\\\u2029\")};function gz(a,c,e,g){var f=az(a,c,\"firstOperand\",e,0);if(!f.isAstAccepted)return f;a=az(a,c,\"secondOperand\",e,0);return a.isAstAccepted?Vy(\"\\n\\tfunction \"+c+\"(contextItem) {\\n\\t\\t\"+f.Ea.join(\"\\n\")+\"\\n\\t\\t\"+a.Ea.join(\"\\n\")+\"\\n\\t\\treturn \"+f.code+\" \"+g+\" \"+a.code+\";\\n\\t}\\n\\t\",{type:3,j:{type:0}}):a};function hz(a){for(var c=[],e=0;e {\\n\\t\\t\\t\"+a.code+\"\\n\\t\\t\\treturn DONE_TOKEN;\\n\\t\\t};\\n\\t\\treturn {\\n\\t\\t\\tnext,\\n\\t\\t\\t[Symbol.iterator]() { return this; }\\n\\t\\t};\\n\\t}\\n\\t\",{type:3,j:{type:4}}):a;case Zy.Rb:return gz(a,c,e,\"&&\");case Zy.ac:return gz(a,c,e,\"||\");case Zy.dc:return a=W(a,\"value\")[1],a=fz(a),Vy(\"const \"+c+\" = \"+a+\";\",{type:1});case \"equalOp\":case \"notEqualOp\":case \"lessThanOrEqualOp\":case \"lessThanOp\":case \"greaterThanOrEqualOp\":case \"greaterThanOp\":case \"eqOp\":case \"neOp\":case \"ltOp\":case \"leOp\":case \"gtOp\":case \"geOp\":case \"isOp\":case \"nodeBeforeOp\":case \"nodeAfterOp\":a:{var f=\naz(a,c,\"firstOperand\",e);if(f.isAstAccepted)if(e=az(a,c,\"secondOperand\",e),e.isAstAccepted)switch(g){case \"eqOp\":case \"neOp\":case \"ltOp\":case \"leOp\":case \"gtOp\":case \"geOp\":case \"isOp\":c=cz(a,g,f,e,c);break a;case \"equalOp\":case \"notEqualOp\":case \"lessThanOrEqualOp\":case \"lessThanOp\":case \"greaterThanOrEqualOp\":case \"greaterThanOp\":W(a,\"firstOperand\");var m=cm(a,\"type\");W(a,\"secondOperand\");var p=cm(a,\"type\");c=m&&p?3===m.g&&3===p.g?cz(a,ez[g],f,e,c):Wy(\"generalCompare with sequences is still in development\"):\nWy(\"types of compare are not known\");break a;default:c=Wy(\"Unsupported compare type\")}else c=e;else c=f}return c;default:return Wy(\"Unsupported: the base expression '\"+g+\"'.\")}};function qz(a,c,e){switch(a){case 9:e=H(Uy(\"compiledXPathExpression\",c));a=e.next().value;if(4!==e.next().value.type)throw Error(\"Trying access generated code as an iterator while this is not the case.\");return Vy(\"\\n\\tconst firstResult = \"+a+\".next();\\n\\tif (!firstResult.done) {\\n\\t\\treturn firstResult.value\\n\\t}\\n\\treturn null;\\n\\t\",{type:2});case 7:return e=H(Uy(\"compiledXPathExpression\",c)),a=e.next().value,4!==e.next().value.type?Vy(\"return [];\",{type:2}):Vy(\"\\n\\tconst nodes = [];\\n\\tfor (const node of \"+\na+\") {\\n\\t\\tnodes.push(node);\\n\\t}\\n\\treturn nodes;\\n\\t\",{type:2});case 3:return e=Xy(\"compiledXPathExpression\",\"\",c),e.isAstAccepted?Vy(\"return \"+e.code+\";\",{type:2}):e;case 2:return void 0===e?e=Wy(\"Full AST wasn't annotated so we cannot correctly emit a string return\"):T(e,1)||T(e,47)?(c=H(Uy(\"compiledXPathExpression\",c)),a=c.next().value,c=c.next().value,e=Vy(\"return \"+bz(a,c.type,e)+\" || '';\",{type:2})):e=Wy(\"Not implemented: returning anything but strings and attributes from codegen\"),e;default:return Wy(\"Unsupported: the return type '\"+\na+\"'.\")}}\nfunction rz(a,c,e){var g=W(a,\"mainModule\");if(!g)return Wy(\"Unsupported: Can not execute a library module.\");if(W(g,\"prolog\"))return Wy(\"Unsupported: XQuery.\");var f=dm(g,[\"queryBody\",\"*\"]);e.Fb=pz;e=pz(f,\"compiledXPathExpression\",e);if(!1===e.isAstAccepted)return e;g=e.Ea?e.Ea.join(\"\\n\"):\"\";f=cm(f,\"type\");c=qz(c,e.Ma,f?f.type:void 0);if(!1===c.isAstAccepted)return c;c=g+e.code+c.code;e=\"\\n\\treturn (contextItem, domFacade, runtimeLib) => {\\n\\t\\tconst {\\n\\t\\t\\tDONE_TOKEN,\\n\\t\\t\\tValueType,\\n\\t\\t\\tXPDY0002,\\n\\t\\t\\tdeterminePredicateTruthValue,\\n\\t\\t\\tisSubtypeOf,\\n\\t\\t\\tready,\\n\\t\\t\\tatomize,\\n\\t\\t} = runtimeLib;\";sz(a)&&\n(e+='\\n\\t\\tif (!contextItem) {\\n\\t\\t\\tthrow XPDY0002(\"Context is needed to evaluate the given path expression.\");\\n\\t\\t}\\n\\n\\t\\tif (!contextItem.nodeType) {\\n\\t\\t\\tthrow new Error(\"Context item must be subtype of node().\");\\n\\t\\t}\\n\\t\\t');return{code:e+(c+\"}\\n//# sourceURL=generated.js\"),isAstAccepted:!0}}function sz(a){var c=em(a,\"*\");if(\"pathExpr\"===a[0])return!0;a=H(c);for(c=a.next();!c.done;c=a.next())if(sz(c.value))return!0;return!1};function tz(a,c,e){e=e||{};c=c||0;a=gv(a);a=Wt(a,{ca:\"XQuery3.1\"===e.language||\"XQueryUpdate3.1\"===e.language,debug:!1});e={ga:e.namespaceResolver||fv(null)};var g=new Fu(new Zt(new Iu(e.ga,{},hv(\"http://www.w3.org/2005/xpath-functions\"))));ku(a,g);return rz(a,c,e)};function uz(a,c,e){e=e?e:new od;return a()(c,e,Yy)};var vz={},wz=(vz[\"http://www.w3.org/2005/XQueryX\"]=\"xqx\",vz[\"http://www.w3.org/2007/xquery-update-10\"]=\"xquf\",vz);\nfunction xz(a,c,e,g){if(\"string\"===typeof e)return 0===e.length?null:c.createTextNode(e);if(!Array.isArray(e))throw new TypeError(\"JsonML element should be an array or string\");var f=e[0];switch(f){case \"copySource\":case \"insertAfter\":case \"insertAsFirst\":case \"insertAsLast\":case \"insertBefore\":case \"insertInto\":case \"modifyExpr\":case \"newNameExpr\":case \"replacementExpr\":case \"replaceValue\":case \"returnExpr\":case \"sourceExpr\":case \"targetExpr\":case \"transformCopies\":case \"transformCopy\":g=g||\"http://www.w3.org/2005/XQueryX\";\nbreak;case \"deleteExpr\":case \"insertExpr\":case \"renameExpr\":case \"replaceExpr\":case \"transformExpr\":g=\"http://www.w3.org/2007/xquery-update-10\";break;default:g=\"http://www.w3.org/2005/XQueryX\"}f=c.createElementNS(g,wz[g]+\":\"+f);var m=e[1],p=1;if(\"object\"===typeof m&&!Array.isArray(m)){for(var t in m)null!==m[t]&&(\"type\"===t?a.setAttributeNS(f,g,\"fontoxpath:\"+t,Wc(m[t])):a.setAttributeNS(f,g,wz[g]+\":\"+t,m[t]));p=2}t=p;for(m=e.length;t !bucket || getBucketsForNode(childNode).includes(bucket),\n );\n return matchingNodes;\n }\n\n /**\n * Get the data of this node.\n *\n * @param node -\n */\n getData(node) {\n if (node.nodeType === Node.ATTRIBUTE_NODE) {\n this._onNodeTouched(node);\n return node.value;\n }\n // Text node\n this._onNodeTouched(node.parentNode);\n return node.data;\n }\n\n /**\n * Get the first child of this element.\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the attribute that will be used.\n */\n getFirstChild(node, bucket) {\n const matchingNode = Array.from(this.getChildNodes()).filter(\n childNode => !bucket || getBucketsForNode(childNode).includes(bucket),\n )[0];\n if (matchingNode) {\n return matchingNode;\n }\n return null;\n }\n\n /**\n * Get the last child of this element.\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the attribute that will be used.\n */\n // eslint-disable-next-line class-methods-use-this\n getLastChild(node, bucket) {\n const matchingNodes = node\n .getChildNodes()\n .filter(childNode => !bucket || getBucketsForNode(childNode).includes(bucket));\n const matchNode = matchingNodes[matchingNodes.length - 1];\n if (matchNode) {\n return matchNode;\n }\n return null;\n }\n\n /**\n * Get the next sibling of this node\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the nextSibling that is requested.\n */\n // eslint-disable-next-line class-methods-use-this\n getNextSibling(node, bucket) {\n for (let { nextSibling } = node; nextSibling; nextSibling = nextSibling.nextSibling) {\n if (!getBucketsForNode(nextSibling).includes(bucket)) {\n // eslint-disable-next-line no-continue\n continue;\n }\n return nextSibling;\n }\n return null;\n }\n\n /**\n * Get the parent of this element.\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the attribute that will be used.\n */\n // eslint-disable-next-line class-methods-use-this\n getParentNode(node) {\n return node.parentNode;\n }\n\n /**\n * Get the previous sibling of this element.\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the attribute that will be used.\n */\n // eslint-disable-next-line class-methods-use-this\n getPreviousSibling(node, bucket) {\n for (\n let { previousSibling } = node;\n previousSibling;\n previousSibling = previousSibling.previousSibling\n ) {\n if (!getBucketsForNode(previousSibling).includes(bucket)) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n return previousSibling;\n }\n return null;\n }\n}\n","import * as fx from 'fontoxpath';\n\n/**\n * Checks wether the specified path expression is an absolute path.\n *\n * @param path the path expression.\n * @return true if specified path expression is an absolute\n * path, otherwise false.\n */\n\nexport class XPathUtil {\n static isAbsolutePath(path) {\n return path != null && (path.startsWith('/') || path.startsWith('instance('));\n }\n\n static isSelfReference(ref) {\n return ref === '.' || ref === './text()' || ref === 'text()' || ref === '' || ref === null;\n }\n\n // todo: this will need more work to look upward for instance() expr.\n static getInstanceId(ref) {\n if (!ref) {\n return 'default';\n }\n if (ref.startsWith('instance(')) {\n const result = ref.substring(ref.indexOf('(') + 1);\n return result.substring(1, result.indexOf(')') - 1);\n }\n return 'default';\n }\n\n // todo: certainly not ideal to rely on duplicating instance id on instance document - better way later ;)\n static getPath(node) {\n const path = fx.evaluateXPath('path()', node);\n const instanceId = node.ownerDocument.firstElementChild.getAttribute('id');\n if (instanceId !== null && instanceId !== 'default') {\n return `#${instanceId}${XPathUtil.shortenPath(path)}`;\n }\n return XPathUtil.shortenPath(path);\n }\n\n static shortenPath(path) {\n const steps = path.split('/');\n let result = '';\n for (let i = 2; i < steps.length; i += 1) {\n const step = steps[i];\n if (step.indexOf('{}') !== -1) {\n const q = step.split('{}');\n result += `/${q[1]}`;\n } else {\n result += `/${step}`;\n }\n }\n return result;\n }\n}\n","/**\n * A simple dependency graph\n *\n * based on the work of https://github.com/jriecken/dependency-graph but working on ES6.\n *\n * Furthermore instead of the DepGraphCycleError a compute-exception event is dispatched.\n *\n *\n */\n\n/**\n * Cycle error, including the path of the cycle.\n */\n// const DepGraphCycleError = (exports.DepGraphCycleError = function (cyclePath) {\n\n/*\nexport function DepGraphCycleError(cyclePath) {\n const message = \"Dependency Cycle Found: \" + cyclePath.join(\" -> \");\n const instance = new Error(message);\n instance.cyclePath = cyclePath;\n Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n if (Error.captureStackTrace) {\n Error.captureStackTrace(instance, DepGraphCycleError);\n }\n return instance;\n};\n\nDepGraphCycleError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: Error,\n enumerable: false,\n writable: true,\n configurable: true\n }\n});\nObject.setPrototypeOf(DepGraphCycleError, Error);\n*/\n\n/**\n * Helper for creating a Topological Sort using Depth-First-Search on a set of edges.\n *\n * Detects cycles and throws an Error if one is detected (unless the \"circular\"\n * parameter is \"true\" in which case it ignores them).\n *\n * @param edges The set of edges to DFS through\n * @param leavesOnly Whether to only return \"leaf\" nodes (ones who have no edges)\n * @param result An array in which the results will be populated\n * @param circular A boolean to allow circular dependencies\n */\nfunction createDFS(edges, leavesOnly, result, circular) {\n const visited = {};\n // eslint-disable-next-line func-names\n return function(start) {\n // console.log('start ', start);\n if (visited[start]) {\n return;\n }\n const inCurrentPath = {};\n const currentPath = [];\n const todo = []; // used as a stack\n todo.push({ node: start, processed: false });\n while (todo.length > 0) {\n const current = todo[todo.length - 1]; // peek at the todo stack\n const { processed } = current;\n const { node } = current;\n if (!processed) {\n // Haven't visited edges yet (visiting phase)\n if (visited[node]) {\n todo.pop();\n // eslint-disable-next-line no-continue\n continue;\n } else if (inCurrentPath[node]) {\n // It's not a DAG\n if (circular) {\n todo.pop();\n // If we're tolerating cycles, don't revisit the node\n // eslint-disable-next-line no-continue\n continue;\n }\n currentPath.push(node);\n window.dispatchEvent(\n new CustomEvent('compute-exception', {\n composed: true,\n bubbles: true,\n detail: {\n path: currentPath,\n message: 'cyclic graph',\n },\n }),\n );\n // return;\n // console.log('‘circular path: ' + currentPath);\n // throw new DepGraphCycleError(currentPath);\n // throw new Error(currentPath);\n }\n\n inCurrentPath[node] = true;\n currentPath.push(node);\n const nodeEdges = edges[node];\n // (push edges onto the todo stack in reverse order to be order-compatible with the old DFS implementation)\n for (let i = nodeEdges.length - 1; i >= 0; i -= 1) {\n todo.push({ node: nodeEdges[i], processed: false });\n }\n current.processed = true;\n } else {\n // Have visited edges (stack unrolling phase)\n todo.pop();\n currentPath.pop();\n inCurrentPath[node] = false;\n visited[node] = true;\n if (!leavesOnly || edges[node].length === 0) {\n result.push(node);\n }\n }\n }\n };\n}\n\n/**\n * Simple Dependency Graph\n */\n\n/*\nvar DepGraph = (exports.DepGraph = function DepGraph(opts) {\n this.nodes = {}; // Node -> Node/Data (treated like a Set)\n this.outgoingEdges = {}; // Node -> [Dependency Node]\n this.incomingEdges = {}; // Node -> [Dependant Node]\n this.circular = opts && !!opts.circular; // Allows circular deps\n});\n*/\n\nexport function DepGraph(opts) {\n this.nodes = {}; // Node -> Node/Data (treated like a Set)\n this.outgoingEdges = {}; // Node -> [Dependency Node]\n this.incomingEdges = {}; // Node -> [Dependant Node]\n this.circular = opts && !!opts.circular; // Allows circular deps\n}\n\nDepGraph.prototype = {\n /**\n * The number of nodes in the graph.\n */\n size() {\n return Object.keys(this.nodes).length;\n },\n /**\n * Add a node to the dependency graph. If a node already exists, this method will do nothing.\n */\n addNode(node, data) {\n if (!this.hasNode(node)) {\n // Checking the arguments length allows the user to add a node with undefined data\n if (arguments.length === 2) {\n this.nodes[node] = data;\n } else {\n this.nodes[node] = node;\n }\n this.outgoingEdges[node] = [];\n this.incomingEdges[node] = [];\n }\n },\n /**\n * Remove a node from the dependency graph. If a node does not exist, this method will do nothing.\n */\n removeNode(node) {\n if (this.hasNode(node)) {\n delete this.nodes[node];\n delete this.outgoingEdges[node];\n delete this.incomingEdges[node];\n // [this.incomingEdges, this.outgoingEdges].forEach(function (edgeList) {\n [this.incomingEdges, this.outgoingEdges].forEach(edgeList => {\n Object.keys(edgeList).forEach(key => {\n const idx = edgeList[key].indexOf(node);\n if (idx >= 0) {\n edgeList[key].splice(idx, 1);\n }\n }, this);\n });\n }\n },\n /**\n * Check if a node exists in the graph\n */\n hasNode(node) {\n // return this.nodes.hasOwnProperty(node);\n\n return Object.prototype.hasOwnProperty.call(this.nodes, node);\n },\n /**\n * Get the data associated with a node name\n */\n getNodeData(node) {\n if (this.hasNode(node)) {\n return this.nodes[node];\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * Set the associated data for a given node name. If the node does not exist, this method will throw an error\n */\n setNodeData(node, data) {\n if (this.hasNode(node)) {\n this.nodes[node] = data;\n } else {\n throw new Error(`Node does not exist: ${node}`);\n }\n },\n /**\n * Add a dependency between two nodes. If either of the nodes does not exist,\n * an Error will be thrown.\n */\n addDependency(from, to) {\n if (!this.hasNode(from)) {\n throw new Error(`Node does not exist: ${from}`);\n }\n if (!this.hasNode(to)) {\n throw new Error(`Node does not exist: ${to}`);\n }\n if (this.outgoingEdges[from].indexOf(to) === -1) {\n this.outgoingEdges[from].push(to);\n }\n if (this.incomingEdges[to].indexOf(from) === -1) {\n this.incomingEdges[to].push(from);\n }\n return true;\n },\n /**\n * Remove a dependency between two nodes.\n */\n removeDependency(from, to) {\n let idx;\n if (this.hasNode(from)) {\n idx = this.outgoingEdges[from].indexOf(to);\n if (idx >= 0) {\n this.outgoingEdges[from].splice(idx, 1);\n }\n }\n\n if (this.hasNode(to)) {\n idx = this.incomingEdges[to].indexOf(from);\n if (idx >= 0) {\n this.incomingEdges[to].splice(idx, 1);\n }\n }\n },\n /**\n * Return a clone of the dependency graph. If any custom data is attached\n * to the nodes, it will only be shallow copied.\n */\n clone() {\n const source = this;\n const result = new DepGraph();\n const keys = Object.keys(source.nodes);\n keys.forEach(n => {\n result.nodes[n] = source.nodes[n];\n result.outgoingEdges[n] = source.outgoingEdges[n].slice(0);\n result.incomingEdges[n] = source.incomingEdges[n].slice(0);\n });\n return result;\n },\n /**\n * Get an array containing the direct dependencies of the specified node.\n *\n * Throws an Error if the specified node does not exist.\n */\n directDependenciesOf(node) {\n if (this.hasNode(node)) {\n return this.outgoingEdges[node].slice(0);\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * Get an array containing the nodes that directly depend on the specified node.\n *\n * Throws an Error if the specified node does not exist.\n */\n directDependantsOf(node) {\n if (this.hasNode(node)) {\n return this.incomingEdges[node].slice(0);\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * Get an array containing the nodes that the specified node depends on (transitively).\n *\n * Throws an Error if the graph has a cycle, or the specified node does not exist.\n *\n * If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned\n * in the array.\n */\n dependenciesOf(node, leavesOnly) {\n if (this.hasNode(node)) {\n const result = [];\n const DFS = createDFS(this.outgoingEdges, leavesOnly, result, this.circular);\n DFS(node);\n const idx = result.indexOf(node);\n if (idx >= 0) {\n result.splice(idx, 1);\n }\n return result;\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * get an array containing the nodes that depend on the specified node (transitively).\n *\n * Throws an Error if the graph has a cycle, or the specified node does not exist.\n *\n * If `leavesOnly` is true, only nodes that do not have any dependants will be returned in the array.\n */\n dependantsOf(node, leavesOnly) {\n if (this.hasNode(node)) {\n const result = [];\n const DFS = createDFS(this.incomingEdges, leavesOnly, result, this.circular);\n DFS(node);\n const idx = result.indexOf(node);\n if (idx >= 0) {\n result.splice(idx, 1);\n }\n return result;\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * Construct the overall processing order for the dependency graph.\n *\n * Throws an Error if the graph has a cycle.\n *\n * If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned.\n */\n overallOrder(leavesOnly) {\n const self = this;\n const result = [];\n const keys = Object.keys(this.nodes);\n if (keys.length === 0) {\n return result; // Empty graph\n }\n if (!this.circular) {\n // Look for cycles - we run the DFS starting at all the nodes in case there\n // are several disconnected subgraphs inside this dependency graph.\n const CycleDFS = createDFS(this.outgoingEdges, false, [], this.circular);\n keys.forEach(n => {\n CycleDFS(n);\n });\n }\n\n const DFS = createDFS(this.outgoingEdges, leavesOnly, result, this.circular);\n // Find all potential starting points (nodes with nothing depending on them) an\n // run a DFS starting at these points to get the order\n keys\n .filter(node => self.incomingEdges[node].length === 0)\n .forEach(n => {\n DFS(n);\n });\n\n // If we're allowing cycles - we need to run the DFS against any remaining\n // nodes that did not end up in the initial result (as they are part of a\n // subgraph that does not have a clear starting point)\n if (this.circular) {\n keys.filter(node => result.indexOf(node) === -1).forEach(n => DFS(n));\n }\n\n return result;\n },\n};\n\n// Create some aliases\nDepGraph.prototype.directDependentsOf = DepGraph.prototype.directDependantsOf;\nDepGraph.prototype.dependentsOf = DepGraph.prototype.dependantsOf;\n","export class Fore {\n static READONLY_DEFAULT = false;\n\n static REQUIRED_DEFAULT = false;\n\n static RELEVANT_DEFAULT = true;\n\n static CONSTRAINT_DEFAULT = true;\n\n static TYPE_DEFAULT = 'xs:string';\n\n static get ACTION_ELEMENTS() {\n return [\n 'FX-DELETE',\n 'FX-DISPATCH',\n 'FX-INSERT',\n 'FX-LOAD',\n 'FX-MESSAGE',\n 'FX-REBUILD',\n 'FX-RECALCULATE',\n 'FX-REFRESH',\n 'FX-RENEW',\n 'FX-REPLACE',\n 'FX-RESET',\n 'FX-RETAIN',\n 'FX-RETURN',\n 'FX-REVALIDATE',\n 'FX-SEND',\n 'FX-SETFOCUS',\n 'FX-SETINDEX',\n 'FX-SETVALUE',\n 'FX-TOGGLE',\n 'FX-UPDATE',\n ];\n }\n\n static get XFORMS_NAMESPACE_URI() {\n // todo: should be centralized somewhere as constant. Exists in several? places\n return 'http://www.w3.org/2002/xforms';\n }\n\n static isActionElement(elementName) {\n return Fore.ACTION_ELEMENTS.includes(elementName);\n }\n\n static get UI_ELEMENTS() {\n return [\n 'FX-ALERT',\n 'FX-CONTROL',\n 'FX-BUTTON',\n 'FX-CONTROL',\n 'FX-DIALOG',\n 'FX-FILENAME',\n 'FX-MEDIATYPE',\n 'FX-GROUP',\n 'FX-HINT',\n 'FX-INPUT',\n 'FX-ITEMSET',\n 'FX-LABEL',\n 'FX-OUTPUT',\n 'FX-RANGE',\n 'FX-REPEAT',\n 'FX-REPEATITEM',\n 'FX-SWITCH',\n 'FX-SECRET',\n 'FX-SELECT',\n 'FX-SUBMIT',\n 'FX-TEXTAREA',\n 'FX-TRIGGER',\n 'FX-UPLOAD',\n ];\n }\n\n static isUiElement(elementName) {\n const found = Fore.UI_ELEMENTS.includes(elementName);\n if (found) {\n // console.log('_isUiElement ', found);\n }\n return Fore.UI_ELEMENTS.includes(elementName);\n }\n\n static async refreshChildren(startElement) {\n const refreshed = new Promise(resolve => {\n const { children } = startElement;\n if (children) {\n Array.from(children).forEach(element => {\n if (Fore.isUiElement(element.nodeName) && typeof element.refresh === 'function') {\n element.refresh();\n } else if (element.nodeName.toUpperCase() !== 'FX-MODEL') {\n Fore.refreshChildren(element);\n }\n });\n }\n resolve('done');\n });\n\n return refreshed;\n }\n\n static isRepeated(element) {\n return element.closest('fx-repeatitem') !== null;\n }\n\n static getRepeatTarget(element, id) {\n const repeatContextItem = element.closest('fx-repeatitem');\n const target = repeatContextItem.querySelector(`#${id}`);\n return target;\n }\n\n /**\n * returns the proper content-type for instance.\n *\n * @param instance an fx-instance element\n * @returns {string|null}\n */\n static getContentType(instance, method) {\n if (method === 'urlencoded-post') {\n return 'application/x-www-form-urlencoded; charset=UTF-8';\n }\n if (instance.type === 'xml') {\n return 'application/xml; charset=UTF-8';\n }\n if (instance.type === 'json') {\n return 'application/json';\n }\n console.warn('content-type unknown ', instance.type);\n return null;\n }\n\n static fadeInElement(element) {\n const duration = 600;\n let fadeIn = () => {\n // Stop all current animations\n if (element.getAnimations) {\n element.getAnimations().map(anim => anim.finish());\n }\n\n // Play the animation with the newly specified duration\n fadeIn = element.animate(\n {\n opacity: [0, 1],\n },\n duration,\n );\n return fadeIn.finished;\n };\n return fadeIn();\n }\n\n static fadeOutElement(element) {\n const duration = 2600;\n let fadeOut = () => {\n // Stop all current animations\n if (element.getAnimations) {\n element.getAnimations().map(anim => anim.finish());\n }\n\n // Play the animation with the newly specified duration\n fadeOut = element.animate(\n {\n opacity: [1, 0],\n },\n duration,\n );\n return fadeOut.finished;\n };\n return fadeOut();\n }\n\n /**\n * clear all text nodes and attribute values to get a 'clean' template.\n * @param n\n * @private\n */\n /*\n static clear(n) {\n n.textContent = '';\n if (n.hasAttributes()) {\n const attrs = n.attributes;\n for (let i = 0; i < attrs.length; i+= 1) {\n attrs[i].value = '';\n }\n }\n const { children } = n;\n for (let i = 0; i < children.length; i+= 1) {\n Fore.clear(children[i]);\n }\n }\n */\n}\n","import {\n evaluateXPath as fxEvaluateXPath,\n evaluateXPathToFirstNode as fxEvaluateXPathToFirstNode,\n evaluateXPathToNodes as fxEvaluateXPathToNodes,\n evaluateXPathToBoolean as fxEvaluateXPathToBoolean,\n evaluateXPathToString as fxEvaluateXPathToString,\n evaluateXPathToNumber as fxEvaluateXPathToNumber,\n registerCustomXPathFunction,\n registerXQueryModule,\n} from 'fontoxpath';\n\nconst XFORMS_NAMESPACE_URI = 'http://www.w3.org/2002/xforms';\n\n/**\n * Resolve a namespace. Needs a namespace prefix and the element that is most closely related to the\n * XPath in which the namespace is being resolved. The prefix will be resolved by using the\n * ancestry of said element.\n *\n * It has two ways of doing so:\n *\n * - If the prefix is defined in an `xmlns:XXX=\"YYY\"` namespace declaration, it will return 'YYY'.\n * - If the prefix is the empty prefix and there is an `xpath-default-namespace=\"YYY\"` attribute in the\n * - ancestry, that attribute will be used and 'YYY' will be returned\n *\n * @param {Node} contextElement The element that is most closely related with the XPath in which this prefix is resolved.\n * @param {string} prefix The prefix to resolve\n */\nfunction resolveNamespacePrefix(contextElement, prefix) {\n if (prefix === 'xhtml') {\n return 'http://www.w3.org/1999/xhtml';\n }\n\n if (prefix === '') {\n return (\n fxEvaluateXPathToString(\n 'ancestor-or-self::*/@xpath-default-namespace[last()]',\n contextElement,\n ) || null\n );\n }\n\n // Note: ideally we should use Node#lookupNamespaceURI. However, the nodes we are passed are\n // XML. The best we can do is emulate the `xmlns:xxx` namespace declarations by regarding them as\n // attributes. Which they technically ARE NOT!\n\n const result = fxEvaluateXPathToString(\n 'ancestor-or-self::*/@*[name() = \"xmlns:\" || $prefix][last()]',\n contextElement,\n null,\n { prefix },\n );\n\n console.log('result', result);\n return result;\n}\n\n/**\n * Implementation of the functionNameResolver passed to FontoXPath to\n * redirect function resolving for unprefixed functions to either the fn or the xf namespace\n */\n// eslint-disable-next-line no-unused-vars\nfunction functionNameResolver({ prefix, localName }, _arity) {\n switch (localName) {\n // TODO: put the full XForms library functions set here\n case 'base64encode':\n case 'boolean-from-string':\n case 'current':\n case 'depends':\n case 'event':\n case 'index':\n case 'instance':\n case 'log':\n case 'logtree':\n return { namespaceURI: XFORMS_NAMESPACE_URI, localName };\n default:\n if (prefix === '' || prefix === 'fn') {\n return { namespaceURI: 'http://www.w3.org/2005/xpath-functions', localName };\n }\n if (prefix === 'local') {\n return { namespaceURI: 'http://www.w3.org/2005/xquery-local-functions', localName };\n }\n return null;\n }\n}\n\n/**\n * Evaluate an XPath to _any_ type. When possible, prefer to use any other function to ensure the\n * type of the output is more predictable.\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {{parentNode}|ForeElementMixin} formElement The form element associated to the XPath\n */\nexport function evaluateXPath(xpath, contextNode, formElement, variables = {}) {\n return fxEvaluateXPath(xpath, contextNode, null, variables, 'xs:anyType', {\n currentContext: { formElement, variables },\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n functionNameResolver,\n namespaceResolver: prefix => resolveNamespacePrefix(formElement, prefix),\n });\n}\n\n/**\n * Evaluate an XPath to the first Node\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @return {Node} The first node found by the XPath\n */\nexport function evaluateXPathToFirstNode(xpath, contextNode, formElement) {\n return fxEvaluateXPathToFirstNode(\n xpath,\n contextNode,\n null,\n {},\n {\n namespaceResolver: prefix => resolveNamespacePrefix(formElement, prefix),\n defaultFunctionNamespaceURI: XFORMS_NAMESPACE_URI,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n currentContext: { formElement },\n },\n );\n}\n\n/**\n * Evaluate an XPath to all nodes\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @return {Node[]} All nodes\n */\nexport function evaluateXPathToNodes(xpath, contextNode, formElement) {\n return fxEvaluateXPathToNodes(\n xpath,\n contextNode,\n null,\n {},\n {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver: prefix => resolveNamespacePrefix(formElement, prefix),\n },\n );\n}\n\n/**\n * Evaluate an XPath to a boolean\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @return {boolean}\n */\nexport function evaluateXPathToBoolean(xpath, contextNode, formElement) {\n return fxEvaluateXPathToBoolean(\n xpath,\n contextNode,\n null,\n {},\n {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver: prefix => resolveNamespacePrefix(formElement, prefix),\n },\n );\n}\n\n/**\n * Evaluate an XPath to a string\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @param {DomFacade} [domFacade=null] A DomFacade is used in bindings to intercept DOM\n * access. This is used to determine dependencies between bind elements.\n * @param {Node} formElement The element where the XPath is defined: used for namespace resolving\n * @return {string}\n */\nexport function evaluateXPathToString(\n xpath,\n contextNode,\n formElement,\n domFacade = null,\n namespaceReferenceNode = formElement,\n) {\n return fxEvaluateXPathToString(\n xpath,\n contextNode,\n domFacade,\n {},\n\n {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver: prefix => resolveNamespacePrefix(namespaceReferenceNode, prefix),\n },\n );\n}\n\n/**\n * Evaluate an XPath to a number\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @param {DomFacade} [domFacade=null] A DomFacade is used in bindings to intercept DOM\n * @param {Node} formElement The element where the XPath is defined: used for namespace resolving\n * access. This is used to determine dependencies between bind elements.\n * @return {Number}\n */\nexport function evaluateXPathToNumber(\n xpath,\n contextNode,\n formElement,\n domFacade = null,\n namespaceReferenceNode = formElement,\n) {\n return fxEvaluateXPathToNumber(\n xpath,\n contextNode,\n domFacade,\n {},\n {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver: prefix => resolveNamespacePrefix(namespaceReferenceNode, prefix),\n },\n );\n}\n\nconst xhtmlNamespaceResolver = prefix => {\n if (!prefix) {\n return 'http://www.w3.org/1999/xhtml';\n }\n return undefined;\n};\n\n/**\n * Resolve an id in scope. Behaves like the algorithm defined on https://www.w3.org/community/xformsusers/wiki/XForms_2.0#idref-resolve\n */\nfunction resolveId(id, sourceObject, nodeName = null) {\n const allMatchingTargetObjects = fxEvaluateXPathToNodes(\n 'outermost(ancestor-or-self::fx-fore[1]/(descendant::xf-fore|descendant::*[@id = $id]))[not(self::fx-fore)]',\n sourceObject,\n null,\n { id },\n { namespaceResolver: xhtmlNamespaceResolver },\n );\n\n if (allMatchingTargetObjects.length === 0) {\n return null;\n }\n\n if (\n allMatchingTargetObjects.length === 1 &&\n fxEvaluateXPathToBoolean(\n '(ancestor::fx-fore | ancestor::fx-repeat)[last()]/self::fx-fore',\n allMatchingTargetObjects[0],\n null,\n null,\n { namespaceResolver: xhtmlNamespaceResolver },\n )\n ) {\n // If the target element is not repeated, then the search for the target object is trivial since\n // there is only one associated with the target element that bears the matching ID. This is true\n // regardless of whether or not the source object is repeated. However, if the target element is\n // repeated, then additional information must be used to help select a target object from among\n // those associated with the identified target element.\n const targetObject = allMatchingTargetObjects[0];\n if (nodeName && targetObject.localName !== nodeName) {\n return null;\n }\n return targetObject;\n }\n\n // SPEC:\n\n // 12.2.1 References to Elements within a repeat Element\n\n // When the target element that is identified by the IDREF of a source object has one or more\n // repeat elements as ancestors, then the set of ancestor repeats are partitioned into two\n // subsets, those in common with the source element and those that are not in common. Any ancestor\n // repeat elements of the target element not in common with the source element are descendants of\n // the repeat elements that the source and target element have in common, if any.\n\n // For the repeat elements that are in common, the desired target object exists in the same set of\n // run-time objects that contains the source object. Then, for each ancestor repeat of the target\n // element that is not in common with the source element, the current index of the repeat\n // determines the set of run-time objects that contains the desired target object.\n for (const ancestorRepeatItem of fxEvaluateXPathToNodes(\n 'ancestor::fx-repeatitem => reverse()',\n sourceObject,\n null,\n null,\n { namespaceResolver: xhtmlNamespaceResolver },\n )) {\n const foundTargetObjects = allMatchingTargetObjects.filter(to =>\n ancestorRepeatItem.contains(to),\n );\n switch (foundTargetObjects.length) {\n case 0:\n // Nothing found: ignore\n break;\n case 1: {\n // A single one is found: the target object is directly in a common repeat\n const targetObject = foundTargetObjects[0];\n if (nodeName && targetObject.localName !== nodeName) {\n return null;\n }\n return targetObject;\n }\n default: {\n // Multiple target objects are found: they are in a repeat that is not common with the source object\n // We found a target object in a common repeat! We now need to find the one that is in the repeatitem identified at the current index\n const targetObject = foundTargetObjects.find(to =>\n fxEvaluateXPathToNodes(\n 'every $ancestor of ancestor::fx-repeatitem satisfies $ancestor is $ancestor/../child::fx-repeatitem[../@repeat-index]',\n to,\n null,\n {},\n ),\n );\n if (!targetObject) {\n // Nothing valid found for whatever reason. This might be something dynamic?\n return null;\n }\n if (nodeName && targetObject.localName !== nodeName) {\n return null;\n }\n return targetObject;\n }\n }\n }\n // We found no target objects in common repeats. The id is unresolvable\n return null;\n}\n\n/**\n * @param id as string\n * @return instance data for given id serialized to string.\n */\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'log' },\n ['xs:string?'],\n 'xs:string?',\n (dynamicContext, string) => {\n const { formElement } = dynamicContext.currentContext;\n const instance = resolveId(string, formElement, 'fx-instance');\n if (instance) {\n const def = new XMLSerializer().serializeToString(instance.getDefaultContext());\n return def;\n }\n return null;\n },\n);\n\nfunction buildTree(tree, data) {\n if (!data) return;\n if (data.nodeType === Node.ELEMENT_NODE) {\n if (data.children) {\n const details = document.createElement('details');\n details.setAttribute('data-path', data.nodeName);\n const summary = document.createElement('summary');\n\n let display = ` <${data.nodeName}`;\n Array.from(data.attributes).forEach(attr => {\n display += ` ${attr.nodeName}=\"${attr.nodeValue}\"`;\n });\n\n let contents;\n if (\n data.firstChild &&\n data.firstChild.nodeType === Node.TEXT_NODE &&\n data.firstChild.data.trim() !== ''\n ) {\n // console.log('whoooooooooopp');\n contents = data.firstChild.nodeValue;\n display += `>${contents}`;\n } else {\n display += '>';\n }\n summary.textContent = display;\n\n details.appendChild(summary);\n if (data.childElementCount !== 0) {\n details.setAttribute('open', 'open');\n } else {\n summary.setAttribute('style', 'list-style:none;');\n }\n tree.appendChild(details);\n\n Array.from(data.children).forEach(child => {\n // if(child.nodeType === Node.ELEMENT_NODE){\n // child.parentNode.appendChild(buildTree(child));\n buildTree(details, child);\n // }\n });\n }\n } /* else if(data.nodeType === Node.ATTRIBUTE_NODE){\n //create span for now\n // const span = document.createElement('span');\n // span.style.background = 'grey';\n // span.textContent = data.value;\n // tree.appendChild(span);\n tree.setAttribute(data.nodeName,data.value);\n }else {\n tree.textContent = data;\n } */\n\n // return tree;\n}\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'logtree' },\n ['xs:string?'],\n 'element()?',\n (dynamicContext, string) => {\n const { formElement } = dynamicContext.currentContext;\n const instance = resolveId(string, formElement, 'fx-instance');\n\n if (instance) {\n // const def = new XMLSerializer().serializeToString(instance.getDefaultContext());\n // const def = JSON.stringify(instance.getDefaultContext());\n\n const treeDiv = document.createElement('div');\n treeDiv.setAttribute('class', 'logtree');\n // const datatree = buildTree(tree,instance.getDefaultContext());\n // return tree.appendChild(datatree);\n // return buildTree(root,instance.getDefaultContext());;\n const form = dynamicContext.currentContext.formElement;\n const logtree = form.querySelector('.logtree');\n if (logtree) {\n logtree.parentNode.removeChild(logtree);\n }\n const tree = buildTree(treeDiv, instance.getDefaultContext());\n if (tree) {\n form.appendChild(tree);\n }\n }\n return null;\n },\n);\n\nconst instance = (dynamicContext, string) => {\n // Spec: https://www.w3.org/TR/xforms-xpath/#The_XForms_Function_Library#The_instance.28.29_Function\n // TODO: handle no string passed (null will be passed instead)\n\n const formElement = fxEvaluateXPathToFirstNode(\n 'ancestor-or-self::fx-fore',\n dynamicContext.currentContext.formElement,\n null,\n null,\n { namespaceResolver: xhtmlNamespaceResolver },\n );\n\n // console.log('fnInstance dynamicContext: ', dynamicContext);\n // console.log('fnInstance string: ', string);\n\n const inst = string\n ? resolveId(string, formElement, 'fx-instance')\n : formElement.querySelector(`fx-instance`);\n\n // const def = instance.getInstanceData();\n if (inst) {\n const def = inst.getDefaultContext();\n // console.log('target instance root node: ', def);\n\n return def;\n }\n return null;\n};\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'index' },\n ['xs:string?'],\n 'xs:integer?',\n (dynamicContext, string) => {\n const { formElement } = dynamicContext.currentContext;\n if (string === null) {\n return 1;\n }\n const repeat = resolveId(string, formElement, 'fx-repeat');\n\n // const def = instance.getInstanceData();\n if (repeat) {\n return repeat.getAttribute('index');\n }\n return 1;\n },\n);\n\n// Note that this is not to spec. The spec enforces elements to be returned from the\n// instance. However, we allow instances to actually be JSON!\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'instance' },\n [],\n 'item()?',\n domFacade => instance(domFacade, null),\n);\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'instance' },\n ['xs:string?'],\n 'item()?',\n instance,\n);\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'depends' },\n ['node()*'],\n 'item()?',\n (dynamicContext, nodes) =>\n // console.log('depends on : ', nodes[0]);\n nodes[0],\n);\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'event' },\n ['xs:string?'],\n 'item()?',\n (dynamicContext, arg) => {\n const payload = dynamicContext.currentContext.variables[arg];\n if (payload.nodeType) {\n console.log('got some node as js object');\n }\n\n return dynamicContext.currentContext.variables[arg];\n },\n);\n\n// Implement the XForms standard functions here.\nregisterXQueryModule(`\n module namespace xf=\"${XFORMS_NAMESPACE_URI}\";\n\n declare %public function xf:boolean-from-string($str as xs:string) as xs:boolean {\n lower-case($str) = \"true\" or $str = \"1\"\n };\n`);\n\n// How to run XQUERY:\n/**\n registerXQueryModule(`\n module namespace my-custom-namespace = \"my-custom-uri\";\n (:~\n Insert attribute somewhere\n ~:)\n declare %public %updating function my-custom-namespace:do-something ($ele as element()) as xs:boolean {\n\tif ($ele/@done) then false() else\n\t(insert node\n\tattribute done {\"true\"}\n\tinto $ele, true())\n};\n `)\n // At some point:\n const contextNode = null;\n const pendingUpdatesAndXdmValue = evaluateUpdatingExpressionSync('ns:do-something(.)', contextNode, null, null, {moduleImports: {'ns': 'my-custom-uri'}})\n\n console.log(pendingUpdatesAndXdmValue.xdmValue); // this is true or false, see function\n\n executePendingUpdateList(pendingUpdatesAndXdmValue.pendingUpdateList, null, null, null);\n */\n\n/**\n * @param input as string\n * @return {string}\n */\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'base64encode' },\n ['xs:string?'],\n 'xs:string?',\n (dynamicContext, string) => btoa(string),\n);\n","import { Fore } from './fore.js';\nimport { evaluateXPathToFirstNode } from './xpath-evaluation.js';\n\n/**\n * Container for data instances.\n *\n * Offers several ways of loading data from either inline content or via 'src' attribute which will use the fetch\n * API to resolve data.\n */\nexport class FxInstance extends HTMLElement {\n constructor() {\n super();\n this.model = this.parentNode;\n this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback() {\n // console.log('connectedCallback ', this);\n if (this.hasAttribute('src')) {\n this.src = this.getAttribute('src');\n }\n\n if (this.hasAttribute('id')) {\n this.id = this.getAttribute('id');\n } else {\n this.id = 'default';\n }\n\n if (this.hasAttribute('type')) {\n this.type = this.getAttribute('type');\n } else {\n this.type = 'xml';\n }\n const style = `\n :host {\n display: none;\n }\n :host * {\n display:none;\n }\n ::slotted(*){\n display:none;\n }\n `;\n\n const html = `\n `;\n this.shadowRoot.innerHTML = `\n \n ${html}\n `;\n }\n\n /**\n * Is called by fx-model during initialization phase (model-construct)\n * @returns {Promise}\n */\n async init() {\n // console.log('fx-instance init');\n await this._initInstance().then(() => {\n this.dispatchEvent(\n new CustomEvent('instance-loaded', {\n composed: true,\n bubbles: true,\n detail: { instance: this },\n }),\n );\n return this;\n });\n }\n\n evalXPath(xpath) {\n const formElement = this.parentElement.parentElement;\n const result = evaluateXPathToFirstNode(xpath, this.getDefaultContext(), formElement);\n return result;\n }\n\n /**\n * returns the current instance data\n *\n * @returns {Document | T | any}\n */\n getInstanceData() {\n if (!this.instanceData) {\n this._createInstanceData();\n }\n return this.instanceData;\n }\n\n setInstanceData(data) {\n if (!data) {\n this._createInstanceData();\n return;\n }\n this.instanceData = data;\n }\n\n /**\n * return the default context (root node of respective instance) for XPath evalution.\n *\n * @returns {Document|T|any|Element}\n */\n getDefaultContext() {\n // console.log('getDefaultContext ', this.instanceData.firstElementChild);\n if (this.type === 'xml') {\n return this.instanceData.firstElementChild;\n }\n return this.instanceData;\n }\n\n /**\n * does the actual loading of data. Handles inline data, data loaded via fetch() or data constructed from\n * querystring.\n *\n * @returns {Promise}\n * @private\n */\n async _initInstance() {\n if (this.src === '#querystring') {\n /*\n * generate XML data from URL querystring\n * todo: there's no variant to generate JSON yet\n */\n // eslint-disable-next-line no-restricted-globals\n const query = new URLSearchParams(location.search);\n const doc = new DOMParser().parseFromString('', 'application/xml');\n const root = doc.firstElementChild;\n for (const p of query) {\n const newNode = doc.createElement(p[0]);\n newNode.appendChild(doc.createTextNode(p[1]));\n root.appendChild(newNode);\n }\n this.instanceData = doc;\n // this.instanceData.firstElementChild.setAttribute('id', this.id);\n // resolve('done');\n } else if (this.src) {\n await this._loadData();\n } else if (this.childNodes.length !== 0) {\n this._useInlineData();\n }\n }\n\n _createInstanceData() {\n if (this.type === 'xml') {\n const doc = new DOMParser().parseFromString('', 'application/xml');\n this.instanceData = doc;\n }\n if (this.type === 'json') {\n this.instanceData = {};\n }\n }\n\n async _loadData() {\n const url = `${this.src}`;\n const contentType = Fore.getContentType(this, 'get');\n\n await fetch(url, {\n method: 'GET',\n mode: 'cors',\n credentials: 'include',\n headers: {\n 'Content-Type': contentType,\n },\n })\n .then(response => {\n const responseContentType = response.headers.get('content-type').toLowerCase();\n console.log('********** responseContentType *********', responseContentType);\n if (responseContentType.startsWith('text/plain')) {\n // console.log(\"********** inside res plain *********\");\n return response.text();\n }\n if (responseContentType.startsWith('application/json')) {\n // console.log(\"********** inside res json *********\");\n return response.json();\n }\n if (responseContentType.startsWith('application/xml')) {\n return response.text().then(result => {\n console.log('xml ********', result);\n return new DOMParser().parseFromString(result, 'application/xml');\n });\n }\n return 'done';\n })\n .then(data => {\n this.instanceData = data;\n console.log('instanceData loaded: ', this.instanceData);\n })\n .catch(error => {\n throw new Error(`failed loading data ${error}`);\n });\n }\n\n _getContentType() {\n if (this.type === 'xml') {\n return 'application/xml';\n }\n if (this.type === 'json') {\n return 'application/json';\n }\n console.warn('content-type unknown ', this.type);\n return null;\n }\n\n _useInlineData() {\n if (this.type === 'xml') {\n // console.log('innerHTML ', this.innerHTML);\n const instanceData = new DOMParser().parseFromString(this.innerHTML, 'application/xml');\n\n console.log('fx-instance init id:', this.id);\n this.instanceData = instanceData;\n // console.log('instanceData ', this.instanceData);\n // console.log('instanceData ', this.instanceData.firstElementChild);\n\n console.log('fx-instance data: ', this.instanceData);\n // this.instanceData.firstElementChild.setAttribute('id', this.id);\n // todo: move innerHTML out to shadowDOM (for later reset)\n } else if (this.type === 'json') {\n this.instanceData = JSON.parse(this.textContent);\n } else {\n console.warn('unknow type for data ', this.type);\n }\n }\n\n _handleResponse() {\n console.log('_handleResponse ');\n const ajax = this.shadowRoot.getElementById('loader');\n const instanceData = new DOMParser().parseFromString(ajax.lastResponse, 'application/xml');\n this.instanceData = instanceData;\n console.log('data: ', this.instanceData);\n }\n\n _handleError() {\n const loader = this.shadowRoot.getElementById('loader');\n console.log('_handleResponse ', loader.lastError);\n }\n}\ncustomElements.define('fx-instance', FxInstance);\n","/**\n * Class for holding ModelItem facets.\n *\n * A ModelItem annotates nodes that are referred by a fx-bind element with facets for calculation and validation.\n *\n * Each bound node in an instance has exactly one ModelItem associated with it.\n */\nexport class ModelItem {\n /**\n *\n * @param {path} calculated normalized path expression linking to data\n * @param {ref} ref relative binding expression\n * @param {*} isReadonly - boolean to signal readonly/readwrite state\n * @param {*} relevant - boolean to signal relevant/non-relevant state\n * @param {*} required - boolean to signal required/optional state\n * @param {*} required - boolean boolean to signal valid/invalid state\n * @param {*} type - string expression to set a datatype\n * @param {*} node - the node the 'ref' expression is referring to\n * @param {*} bind - the fx-bind element having created this modelItem\n */\n constructor(path, ref, readonly, relevant, required, constraint, type, node, bind) {\n this.path = path;\n this.ref = ref;\n this.constraint = constraint;\n this.readonly = readonly;\n this.relevant = relevant;\n this.required = required;\n this.type = type;\n this.node = node;\n this.bind = bind;\n this.changed = false;\n this.alerts = [];\n // this.value = this._getValue();\n }\n\n /*\n get ref(){\n return this.bind.ref;\n }\n*/\n\n get value() {\n if (!this.node.nodeType) return this.node;\n\n if (this.node.nodeType === Node.ATTRIBUTE_NODE) {\n return this.node.nodeValue;\n }\n return this.node.textContent;\n }\n\n set value(newVal) {\n console.log('modelitem.setvalue oldVal', this.value);\n console.log('modelitem.setvalue newVal', newVal);\n\n if (newVal.nodeType === Node.DOCUMENT_NODE) {\n // this.node.replaceWith(newVal.firstElementChild);\n this.node.appendChild(newVal.firstElementChild);\n } else if (newVal.nodeType === Node.ELEMENT_NODE) {\n // this.node.replaceWith(newVal);\n this.node.appendChild(newVal);\n } else if (this.node.nodeType === Node.ATTRIBUTE_NODE) {\n this.node.nodeValue = newVal;\n } else {\n this.node.textContent = newVal;\n }\n }\n\n addAlert(alert) {\n this.alerts.push(alert);\n }\n\n cleanAlerts() {\n this.alerts = [];\n }\n}\n","import { DepGraph } from './dep_graph.js';\nimport { Fore } from './fore.js';\nimport './fx-instance.js';\nimport { ModelItem } from './modelitem.js';\nimport { evaluateXPath, evaluateXPathToBoolean } from './xpath-evaluation.js';\nimport { XPathUtil } from './xpath-util.js';\n\n/**\n * @ts-check\n */\nexport class FxModel extends HTMLElement {\n constructor() {\n super();\n // this.id = '';\n\n this.instances = [];\n this.modelItems = [];\n this.defaultContext = {};\n\n // this.mainGraph = new DepGraph(false);\n this.inited = false;\n this.modelConstructed = false;\n this.attachShadow({ mode: 'open' });\n }\n\n get formElement() {\n return this.parentElement;\n }\n\n connectedCallback() {\n // console.log('connectedCallback ', this);\n this.shadowRoot.innerHTML = `\n \n `;\n\n this.addEventListener('model-construct-done', e => {\n this.modelConstructed = true;\n // console.log('model-construct-done fired ', this.modelConstructed);\n console.log('model-construct-done fired ', e.detail.model.instances);\n });\n\n // logging\n }\n\n static lazyCreateModelItem(model, ref, node) {\n // console.log('lazyCreateModelItem ', node);\n\n let targetNode = {};\n if (node === null || node === undefined) return null;\n if (node.nodeType === node.TEXT_NODE) {\n // const parent = node.parentNode;\n // console.log('PARENT ', parent);\n targetNode = node.parentNode;\n } else {\n targetNode = node;\n }\n\n // const path = fx.evaluateXPath('path()',node);\n let path;\n if (node.nodeType) {\n path = XPathUtil.getPath(node);\n } else {\n path = null;\n targetNode = node;\n }\n // const path = XPathUtil.getPath(node);\n\n // ### intializing ModelItem with default values (as there is no matching for given ref)\n const mi = new ModelItem(\n path,\n ref,\n Fore.READONLY_DEFAULT,\n Fore.RELEVANT_DEFAULT,\n Fore.REQUIRED_DEFAULT,\n Fore.CONSTRAINT_DEFAULT,\n Fore.TYPE_DEFAULT,\n targetNode,\n this,\n );\n\n // console.log('new ModelItem is instanceof ModelItem ', mi instanceof ModelItem);\n model.registerModelItem(mi);\n return mi;\n }\n\n modelConstruct() {\n console.log('### <<<<< dispatching model-construct >>>>>');\n this.dispatchEvent(new CustomEvent('model-construct', { detail: this }));\n\n const instances = this.querySelectorAll('fx-instance');\n if (instances.length > 0) {\n console.group('init instances');\n const promises = [];\n instances.forEach(instance => {\n promises.push(instance.init());\n });\n\n Promise.all(promises).then(() => {\n this.instances = Array.from(instances);\n console.log('_modelConstruct this.instances ', this.instances);\n this.updateModel();\n this.inited = true;\n\n console.log('### <<<<< dispatching model-construct-done >>>>>');\n this.dispatchEvent(\n new CustomEvent('model-construct-done', {\n composed: true,\n bubbles: true,\n detail: { model: this },\n }),\n );\n });\n console.groupEnd();\n } else {\n // ### if there's no instance one will created\n this.dispatchEvent(\n new CustomEvent('model-construct-done', {\n composed: true,\n bubbles: true,\n detail: { model: this },\n }),\n );\n }\n this.inited = true;\n }\n\n registerModelItem(modelItem) {\n // console.log('ModelItem registered ', modelItem);\n this.modelItems.push(modelItem);\n }\n\n /**\n * update action triggering the update cycle\n */\n updateModel() {\n this.rebuild();\n this.recalculate();\n this.revalidate();\n }\n\n rebuild() {\n console.group('### rebuild');\n\n this.mainGraph = new DepGraph(false);\n this.modelItems = [];\n\n // trigger recursive initialization of the fx-bind elements\n const binds = this.querySelectorAll('fx-model > fx-bind');\n binds.forEach(bind => {\n bind.init(this);\n });\n\n // console.log(`dependencies of a `, this.mainGraph.dependenciesOf(\"/Q{}data[1]/Q{}a[1]:required\"));\n // console.log(`dependencies of b `, this.mainGraph.dependenciesOf(\"/Q{}data[1]/Q{}b[1]:required\"));\n console.log(`rebuild mainGraph`, this.mainGraph);\n console.log(`rebuild mainGraph calc order`, this.mainGraph.overallOrder());\n /*\n console.log(\n `rebuild finished with modelItems ${this.modelItems.length} item(s)`,\n this.modelItems,\n );\n*/\n console.groupEnd();\n }\n\n /**\n * recalculation of all modelItems. Uses dependency graph to determine order of computation.\n *\n * todo: use 'changed' flag on modelItems to determine subgraph for recalculation. Flag already exists but is not used.\n */\n recalculate() {\n console.group('### recalculate');\n console.log('recalculate instances ', this.instances);\n\n const v = this.mainGraph.overallOrder();\n v.forEach(path => {\n const node = this.mainGraph.getNodeData(path);\n const modelItem = this.getModelItem(node);\n\n if (modelItem && path.includes(':')) {\n const property = path.split(':')[1];\n if (property) {\n if (property === 'calculate') {\n const expr = modelItem.bind[property];\n const compute = evaluateXPath(expr, modelItem.node, this);\n modelItem.value = compute;\n } else if (property !== 'constraint' && property !== 'type') {\n const expr = modelItem.bind[property];\n if (expr) {\n const compute = evaluateXPathToBoolean(expr, modelItem.node, this);\n modelItem[property] = compute;\n console.log(\n `recalculating path ${path} - Expr:'${expr}' computed`,\n modelItem[property],\n );\n }\n }\n }\n }\n });\n console.log(\n `recalculate finished with modelItems ${this.modelItems.length} item(s)`,\n this.modelItems,\n );\n console.groupEnd();\n }\n\n /**\n * Iterates all modelItems to calculate the validation status.\n *\n * Model alerts are given on 'fx-bind' elements as either attribute `alert` or as `fx-alert` child elements.\n *\n * During model-construct all model alerts are added to the modelItem if any\n *\n * to revalidate:\n * Gets the `constraint` attribute declaration from modelItem.bind\n * Computes the XPath to a Boolean\n * Updates the modelItem.constraint property\n *\n * todo: type checking\n * todo: run browser validation API\n *\n */\n revalidate() {\n console.group('### revalidate');\n\n let valid = true;\n this.modelItems.forEach(modelItem => {\n // console.log('validating node ', modelItem.node);\n\n const { bind } = modelItem;\n if (bind) {\n /*\n todo: investigate why bind is an element when created in fx-bind.init() and an fx-bind object when\n created lazily.\n */\n if (typeof bind.hasAttribute === 'function' && bind.hasAttribute('constraint')) {\n const constraint = bind.getAttribute('constraint');\n if (constraint) {\n const compute = evaluateXPathToBoolean(constraint, modelItem.node, this);\n console.log('modelItem validity computed: ', compute);\n modelItem.constraint = compute;\n if (!compute) valid = false;\n // ### alerts are added only once during model-construct. Otherwise they would add up in each run of revalidate()\n if (!this.modelConstructed) {\n // todo: get alert from attribute or child element\n const alert = bind.getAlert();\n if (alert) {\n modelItem.addAlert(alert);\n }\n }\n }\n }\n }\n });\n console.log('modelItems after revalidate: ', this.modelItems);\n console.groupEnd();\n return valid;\n }\n\n /**\n *\n * @param node\n * @returns {ModelItem}\n */\n getModelItem(node) {\n return this.modelItems.find(m => m.node === node);\n }\n\n /**\n * get the default evaluation context for this model.\n * @returns {Element} the\n */\n getDefaultContext() {\n return this.instances[0].getDefaultContext();\n }\n\n getDefaultInstance() {\n return this.instances[0];\n }\n\n getDefaultInstanceData() {\n console.log('default instance data ', this.instances[0].instanceData);\n return this.instances[0].instanceData;\n }\n\n getInstance(id) {\n // console.log('getInstance ', id);\n // console.log('instances ', this.instances);\n // console.log('instances array ',Array.from(this.instances));\n\n const instArray = Array.from(this.instances);\n return instArray.find(inst => inst.id === id);\n }\n\n evalBinding(bindingExpr) {\n // console.log('MODEL.evalBinding ', bindingExpr);\n // default context of evaluation is always the default instance\n const result = this.instances[0].evalXPath(bindingExpr);\n return result;\n }\n}\n\ncustomElements.define('fx-model', FxModel);\n","import { evaluateXPathToFirstNode } from './xpath-evaluation.js';\n\nimport { XPathUtil } from './xpath-util.js';\n\nfunction _getParentElement(node) {\n if (node.nodeType === Node.ATTRIBUTE_NODE) {\n return node.ownerElement;\n }\n return node.parentNode;\n}\n\nfunction _getForeContext(node) {\n return node.closest('fx-fore');\n}\n\nfunction _getModelInContext(node) {\n // const ownerForm = node.closest('fx-fore');\n const ownerForm = _getForeContext(node);\n return ownerForm.getModel();\n}\n\nfunction _getInitialContext(node, ref) {\n const parentBind = node.closest('[ref]');\n\n if (parentBind !== null) {\n return parentBind.nodeset;\n }\n\n const model = _getModelInContext(node);\n if (XPathUtil.isAbsolutePath(ref)) {\n const instanceId = XPathUtil.getInstanceId(ref);\n return model.getInstance(instanceId).getDefaultContext();\n }\n if (model.getDefaultInstance() !== null) {\n return model.getDefaultInstance().getDefaultContext();\n }\n return [];\n}\n\nexport default function getInScopeContext(node, ref) {\n const parentElement = _getParentElement(node);\n /*\n if(parentElement.nodeName.toUpperCase() === 'FX-REPEATITEM'){\n return parentElement.nodeset;\n }\n*/\n\n const repeatItem = parentElement.closest('fx-repeatitem');\n if (repeatItem) {\n return repeatItem.nodeset;\n }\n\n if (node.nodeType === Node.ELEMENT_NODE && node.hasAttribute('context')) {\n const initialContext = _getInitialContext(node.parentNode, ref);\n const contextAttr = node.getAttribute('context');\n return evaluateXPathToFirstNode(contextAttr, initialContext, _getForeContext(parentElement));\n }\n return _getInitialContext(parentElement, ref);\n}\n","import { XPathUtil } from './xpath-util.js';\nimport { FxModel } from './fx-model.js';\nimport {\n evaluateXPath,\n evaluateXPathToFirstNode,\n evaluateXPathToString,\n} from './xpath-evaluation.js';\nimport getInScopeContext from './getInScopeContext.js';\n\nexport const foreElementMixin = superclass =>\n class ForeElementMixin extends superclass {\n static get properties() {\n return {\n /**\n * context object for evaluation\n */\n context: {\n type: Object,\n },\n /**\n * the model of this element\n */\n model: {\n type: Object,\n },\n /**\n * XPath binding expression pointing to bound node\n */\n ref: {\n type: String,\n },\n /**\n * The modelitem object associated to the bound node holding the evaluated state.\n */\n modelItem: {\n type: Object,\n },\n /**\n * the node(s) bound by this element\n */\n nodeset: {\n type: Object,\n },\n };\n }\n\n constructor() {\n super();\n this.context = null;\n this.model = null;\n this.modelItem = {};\n this.ref = this.hasAttribute('ref') ? this.getAttribute('ref') : '';\n }\n\n getModel() {\n // console.log('getModel this ', this);\n if (this.model) {\n return this.model;\n }\n // const ownerForm = this.closest('fx-fore');\n // const ownerForm = this.getOwnerForm(this);\n const ownerForm = this.getOwnerForm();\n return ownerForm.querySelector('fx-model');\n }\n\n /**\n *\n * @returns {{parentNode}|ForeElementMixin}\n */\n getOwnerForm() {\n let currentElement = this;\n while (currentElement && currentElement.parentNode) {\n // console.log('current ', currentElement);\n\n if (currentElement.nodeName.toUpperCase() === 'FX-FORE') {\n return currentElement;\n }\n\n if (currentElement.parentNode instanceof DocumentFragment) {\n currentElement = currentElement.parentNode.host;\n } else {\n currentElement = currentElement.parentNode;\n }\n }\n return currentElement;\n }\n\n /**\n * evaluation of fx-bind and UiElements differ in details so that each class needs it's own implementation.\n */\n evalInContext() {\n // const inscopeContext = this.getInScopeContext();\n const inscopeContext = getInScopeContext(this, this.ref);\n if (!inscopeContext) {\n console.warn('no in scopeContext for ', this);\n return;\n }\n if (this.ref === '') {\n this.nodeset = inscopeContext;\n } else if (Array.isArray(inscopeContext)) {\n inscopeContext.forEach(n => {\n if (XPathUtil.isSelfReference(this.ref)) {\n this.nodeset = inscopeContext;\n } else {\n const localResult = evaluateXPathToFirstNode(this.ref, n, null);\n // console.log('local result: ', localResult);\n this.nodeset.push(localResult);\n }\n });\n } else {\n // this.nodeset = fx.evaluateXPathToFirstNode(this.ref, inscopeContext, null, {namespaceResolver: this.namespaceResolver});\n\n // todo: code below fails - why?\n const formElement = this.getOwnerForm();\n if (inscopeContext.nodeType) {\n this.nodeset = evaluateXPathToFirstNode(this.ref, inscopeContext, formElement);\n } else {\n this.nodeset = evaluateXPath(this.ref, inscopeContext, formElement);\n }\n // this.nodeset = evaluateXPath(this.ref,inscopeContext,formElement)\n }\n // console.log('UiElement evaluated to nodeset: ', this.nodeset);\n }\n\n isNotBound() {\n return !this.hasAttribute('ref');\n }\n\n isBound() {\n return this.hasAttribute('ref');\n }\n\n getBindingExpr() {\n if (this.hasAttribute('ref')) {\n return this.getAttribute('ref');\n }\n // try to get closest parent bind\n const parent = this.parentNode.closest('[ref]');\n if (!parent) {\n return 'instance()'; // the default instance\n }\n return parent.getAttribute('ref');\n }\n\n getInstance() {\n if (this.ref.startsWith('instance(')) {\n const instId = XPathUtil.getInstanceId(this.ref);\n return this.getModel().getInstance(instId);\n }\n return this.getModel().getInstance('default');\n }\n\n _getParentBindingElement(start) {\n if (start.parentNode.host) {\n const { host } = start.parentNode;\n if (host.hasAttribute('ref')) {\n return host;\n }\n } else if (start.parentNode) {\n if (start.parentNode.hasAttribute('ref')) {\n return this.parentNode;\n }\n this._getParentBindingElement(this.parentNode);\n }\n return null;\n }\n\n getModelItem() {\n // return this.model.bindingMap.find(m => m.refnode === this.nodeset);\n // return this.getModel().bindingMap.find(m => m.refnode === this.nodeset);\n\n const mi = this.getModel().getModelItem(this.nodeset);\n if (mi) {\n this.modelItem = mi;\n }\n\n const repeated = this.closest('fx-repeatitem');\n let existed;\n if (repeated) {\n const { index } = this.closest('fx-repeatitem');\n if (Array.isArray(this.nodeset)) {\n existed = this.getModel().getModelItem(this.nodeset[index - 1]);\n } else {\n existed = this.getModel().getModelItem(this.nodeset);\n }\n } else {\n existed = this.getModel().getModelItem(this.nodeset);\n }\n\n if (!existed) {\n return FxModel.lazyCreateModelItem(this.getModel(), this.ref, this.nodeset);\n }\n return existed;\n }\n\n /**\n * Returns the effective value for the element.\n * a: look for 'value' attribute and if present evaluate it and return the resulting value\n * b: look for textContent and return the value if present\n * c: return null\n */\n getValue() {\n if (this.hasAttribute('value')) {\n const valAttr = this.getAttribute('value');\n try {\n const inscopeContext = getInScopeContext(this, valAttr);\n return evaluateXPathToString(valAttr, inscopeContext, this.getOwnerForm());\n } catch (error) {\n console.error(error);\n this.dispatch('error', { message: error });\n }\n }\n if (this.textContent) {\n return this.textContent;\n }\n return null;\n }\n\n getInScopeContext() {\n return getInScopeContext(this, this.ref);\n }\n\n dispatch(eventName, detail) {\n const event = new CustomEvent(eventName, {\n composed: true,\n bubbles: true,\n detail,\n });\n console.log('firing', event);\n this.dispatchEvent(event);\n }\n };\n","import { DependencyNotifyingDomFacade } from './DependencyNotifyingDomFacade.js';\nimport { foreElementMixin } from './ForeElementMixin.js';\nimport { ModelItem } from './modelitem.js';\nimport {\n evaluateXPathToBoolean,\n evaluateXPathToNodes,\n evaluateXPathToString,\n} from './xpath-evaluation.js';\nimport { XPathUtil } from './xpath-util.js';\n\n/**\n * FxBind declaratively attaches constraints to nodes in the data (instances).\n *\n * It's major task is to create ModelItem Objects for each Node in the data their ref is pointing to.\n *\n * References and constraint attributes use XPath statements to point to the nodes they are attributing.\n *\n * Note: why is fx-bind not extending BoundElement? Though fx-bind has a 'ref' attr it is not bound in the sense of\n * getting updates about changes of the bound nodes. Instead it acts as a factory for modelItems that are used by\n * BoundElements to track their state.\n */\n// export class FxBind extends HTMLElement {\nexport class FxBind extends foreElementMixin(HTMLElement) {\n static READONLY_DEFAULT = false;\n\n static REQUIRED_DEFAULT = false;\n\n static RELEVANT_DEFAULT = true;\n\n static CONSTRAINT_DEFAULT = true;\n\n static TYPE_DEFAULT = 'xs:string';\n\n /*\n static get styles() {\n return css`\n :host {\n display: none;\n }\n `;\n }\n*/\n\n /*\n static get properties() {\n return {\n ...super.properties,\n\n /!**\n * allows to calculate a value. This value will become readonly.\n *!/\n calculate: {\n type: String\n },\n contextNode:{\n type:Object\n },\n /!**\n * arbitrary XPath resolving to xs:boolean - defaults to 'true()'\n *!/\n constraint: {\n type: String\n },\n /!**\n * id of this bind\n *!/\n id:{\n type:String\n },\n /!**\n * the nodeset the bind is referring to by it's binding expression (ref attribute)\n *!/\n nodeset: {\n type: Array\n },\n /!**\n * the owning model of this bind\n *!/\n model:{\n type:Object\n },\n /!**\n * XPath statement resolving to xs:boolean to switch between readonly and readwrite mode - defaults to 'false()'\n *!/\n readonly: {\n type: String\n },\n /!**\n * the XPath binding expression of this bind\n *!/\n ref: {\n type: String\n },\n /!**\n * XPath statement resolving to xs:boolean to switch between relevant and non-relevant mode - defaults to 'true()'\n *!/\n relevant: {\n type: String\n },\n /!**\n * XPath statement resolving to xs:boolean to switch between required and optional - defaults to 'false'.\n *!/\n required: {\n type: String\n },\n /!**\n * XPath statement\n *!/\n type: {\n type: String\n }\n };\n }\n*/\n\n constructor() {\n super();\n // this.id='';\n // this.ref = '';\n // this.readonly = 'false()';\n // this.required = 'false()';\n // this.relevant = 'true()';\n // this.constraint = 'true()';\n // this.type = 'xs:string';\n // this.calculate = '';\n this.nodeset = [];\n this.model = {};\n this.contextNode = {};\n this.inited = false;\n }\n\n connectedCallback() {\n // console.log('connectedCallback ', this);\n // this.id = this.hasAttribute('id')?this.getAttribute('id'):;\n this.ref = this.getAttribute('ref');\n this.readonly = this.getAttribute('readonly');\n this.required = this.getAttribute('required');\n this.relevant = this.getAttribute('relevant');\n this.type = this.hasAttribute('type') ? this.getAttribute('type') : FxBind.TYPE_DEFAULT;\n this.calculate = this.getAttribute('calculate');\n }\n\n /**\n * initializes the bind element by evaluating the binding expression.\n *\n * For each node referred to by the binding expr a ModelItem object is created.\n *\n * @param model\n */\n init(model) {\n this.model = model;\n console.log('init binding ', this);\n this.instanceId = this._getInstanceId();\n this.bindType = this.getModel().getInstance(this.instanceId).type;\n // console.log('binding type ', this.bindType);\n\n if (this.bindType === 'xml') {\n this._evalInContext();\n this._buildBindGraph();\n this._createModelItems();\n }\n\n // ### process child bindings\n this._processChildren(model);\n }\n\n /*\n //todo: certainly not ideal to rely on duplicating instance id on instance document - better way later ;)\n static getPath(node){\n let path = fx.evaluateXPath('path()',node);\n const instanceId = node.ownerDocument.firstElementChild.getAttribute('id');\n if(instanceId !== 'default'){\n return '#' + instanceId + FxBind.shortenPath(path);\n }else {\n return FxBind.shortenPath(path);\n }\n\n }\n*/\n\n _buildBindGraph() {\n if (this.bindType === 'xml') {\n this.nodeset.forEach(node => {\n const path = XPathUtil.getPath(node);\n\n if (this.calculate) {\n this.model.mainGraph.addNode(`${path}:calculate`, node);\n // Calculated values are a dependency of the model item.\n // Make `model1` depend on `model1:calculate`\n this.model.mainGraph.addNode(path, node);\n this.model.mainGraph.addDependency(path, `${path}:calculate`);\n }\n\n const calculateRefs = this._getReferencesForProperty(this.calculate, node);\n if (calculateRefs.length !== 0) {\n this._addDependencies(calculateRefs, node, path, 'calculate');\n }\n\n const readonlyRefs = this._getReferencesForProperty(this.readonly, node);\n if (readonlyRefs.length !== 0) {\n this._addDependencies(readonlyRefs, node, path, 'readonly');\n } else if (this.readonly) {\n this.model.mainGraph.addNode(`${path}:readonly`, node);\n }\n\n // const requiredRefs = this.requiredReferences;\n const requiredRefs = this._getReferencesForProperty(this.required, node);\n if (requiredRefs.length !== 0) {\n this._addDependencies(requiredRefs, node, path, 'required');\n } else if (this.required) {\n this.model.mainGraph.addNode(`${path}:required`, node);\n }\n\n const relevantRefs = this._getReferencesForProperty(this.relevant, node);\n if (relevantRefs.length !== 0) {\n this._addDependencies(relevantRefs, node, path, 'relevant');\n } else if (this.relevant) {\n this.model.mainGraph.addNode(`${path}:relevant`, node);\n }\n\n const constraintRefs = this._getReferencesForProperty(this.constraint, node);\n if (constraintRefs.length !== 0) {\n this._addDependencies(constraintRefs, node, path, 'constraint');\n } else if (this.constraint) {\n this.model.mainGraph.addNode(`${path}:constraint`, node);\n }\n });\n }\n }\n\n _addNode(path, node) {\n if (!this.model.mainGraph.hasNode(path)) {\n this.model.mainGraph.addNode(path, { node });\n }\n }\n\n /**\n * Add the dependencies of this bind\n *\n * @param {Node[]} refs The nodes that are referenced by this bind. these need to be resolved before\n * this bind can be resolved.\n * @param {Node} node The start of the reference\n * @param {string} path The path to the start of the reference\n * @param {string} property The property with this dependency\n */\n _addDependencies(refs, node, path, property) {\n const nodeHash = `${path}:${property}`;\n if (refs.length !== 0) {\n if (!this.model.mainGraph.hasNode(nodeHash)) {\n this.model.mainGraph.addNode(nodeHash, node);\n }\n refs.forEach(ref => {\n const otherPath = XPathUtil.getPath(ref);\n\n if (!this.model.mainGraph.hasNode(otherPath)) {\n this.model.mainGraph.addNode(otherPath, ref);\n }\n this.model.mainGraph.addDependency(nodeHash, otherPath);\n });\n } else {\n this.model.mainGraph.addNode(nodeHash, node);\n }\n }\n\n _processChildren(model) {\n const childbinds = this.querySelectorAll(':scope > fx-bind');\n Array.from(childbinds).forEach(bind => {\n // console.log('init child bind ', bind);\n bind.init(model);\n });\n }\n\n /*\n render() {\n return html`\n \n `;\n }\n*/\n\n getAlert() {\n if (this.hasAttribute('alert')) {\n return this.getAttribute('alert');\n }\n const alertChild = this.querySelector('fx-alert');\n if (alertChild) {\n return alertChild.innerHTML;\n }\n return null;\n }\n\n /*\n firstUpdated(_changedProperties) {\n super.firstUpdated(_changedProperties);\n }\n */\n\n /*\n namespaceResolver(prefix) {\n // TODO: Do proper namespace resolving. Look at the ancestry / namespacesInScope of the declaration\n\n /!**\n * for (let ancestor = this; ancestor; ancestor = ancestor.parentNode) {\n * \tif (ancestor.getAttribute(`xmlns:${prefix}`)) {\n * // Return value\n * }\n * }\n *!/\n\n // console.log('namespaceResolver prefix', prefix);\n const ns = {\n xhtml: 'http://www.w3.org/1999/xhtml',\n // '' : Fore.XFORMS_NAMESPACE_URI\n };\n return ns[prefix] || null;\n }\n*/\n\n /**\n * overwrites\n */\n _evalInContext() {\n const inscopeContext = this.getInScopeContext();\n\n // reset nodeset\n this.nodeset = [];\n\n if (this.ref === '' || this.ref === null) {\n this.nodeset = inscopeContext;\n } else if (Array.isArray(inscopeContext)) {\n inscopeContext.forEach(n => {\n if (XPathUtil.isSelfReference(this.ref)) {\n this.nodeset = inscopeContext;\n } else {\n // eslint-disable-next-line no-lonely-if\n if (this.ref) {\n const localResult = evaluateXPathToNodes(this.ref, n, this.getOwnerForm());\n localResult.forEach(item => {\n this.nodeset.push(item);\n });\n /*\n const localResult = fx.evaluateXPathToFirstNode(this.ref, n, null, {namespaceResolver: this.namespaceResolver});\n this.nodeset.push(localResult);\n */\n }\n // console.log('local result: ', localResult);\n // this.nodeset.push(localResult);\n }\n });\n } else {\n const inst = this.getModel().getInstance(this.instanceId);\n if (inst.type === 'xml') {\n this.nodeset = evaluateXPathToNodes(this.ref, inscopeContext, this.getOwnerForm());\n } else {\n this.nodeset = this.ref;\n }\n }\n }\n\n _createModelItems() {\n // console.log('#### ', thi+s.nodeset);\n\n /*\n if(XPathUtil.isSelfReference(this.ref)){\n return;\n }\n */\n if (Array.isArray(this.nodeset)) {\n // todo - iterate and create\n // console.log('################################################ ', this.nodeset);\n // Array.from(this.nodeset).forEach((n, index) => {\n Array.from(this.nodeset).forEach(n => {\n // console.log('node ',n);\n // this._createModelItem(n, index);\n this._createModelItem(n);\n });\n } else {\n this._createModelItem(this.nodeset);\n }\n }\n\n static lazyCreateModelitems(model, ref, nodeset) {\n if (Array.isArray(nodeset)) {\n Array.from(nodeset).forEach(n => {\n FxBind.lazyCreateModelItem(model, ref, n);\n });\n } else {\n FxBind.lazyCreateModelItem(model, ref, nodeset);\n }\n }\n\n /*\n static lazyCreateModelItem(model,ref,node){\n console.log('lazyCreateModelItem ', node);\n\n let mItem = {};\n let targetNode = {};\n if(node === null) return null;\n if(node.nodeType === node.TEXT_NODE){\n // const parent = node.parentNode;\n // console.log('PARENT ', parent);\n targetNode = node.parentNode;\n }else {\n targetNode = node;\n }\n\n // const path = fx.evaluateXPath('path()',node);\n const path = FxBind.getPath(node);\n\n // const path = Fore.evaluateXPath ('path()', node, this, Fore.namespaceResolver) ;\n\n // ### intializing ModelItem with default values (as there is no matching for given ref)\n const mi = new ModelItem(path,\n ref,\n FxBind.READONLY_DEFAULT,\n FxBind.RELEVANT_DEFAULT,\n FxBind.REQUIRED_DEFAULT,\n FxBind.CONSTRAINT_DEFAULT,\n FxBind.TYPE_DEFAULT,\n targetNode,\n this);\n\n\n // console.log('new ModelItem is instanceof ModelItem ', mi instanceof ModelItem);\n model.registerModelItem(mi);\n return mi;\n }\n*/\n\n /**\n * creates a ModelItem for given instance node.\n *\n * Please note that for textnode no ModelItem is created but instead the one of its parent is used which either\n * must exist and be initialized already when we hit the textnode.\n * @param node\n * @private\n */\n // _createModelItem(node, index) {\n _createModelItem(node) {\n // console.log('_createModelItem node', node, index);\n\n /*\n this.calculateReferences = this._getReferencesForProperty(this.calculate,node);\n this.readOnlyReferences = this._getReferencesForProperty(this.readonly,node);\n this.requiredReferences = this._getReferencesForProperty(this.required,node);\n this.relevantReferences = this._getReferencesForProperty(this.relevant,node);\n this.constraintReferences = this._getReferencesForProperty(this.constraint,node);\n */\n\n /*\n if bind is the dot expression we use the modelitem of the parent\n */\n if (XPathUtil.isSelfReference(this.ref)) {\n const parentBoundElement = this.parentElement.closest('fx-bind[ref]');\n console.log('parent bound element ', parentBoundElement);\n\n if (parentBoundElement) {\n // todo: Could be fancier by combining them\n parentBoundElement.required = this.required; // overwrite parent property!\n } else {\n console.error('no parent bound element');\n }\n\n return;\n }\n\n // let value = null;\n // const mItem = {};\n /*\n let targetNode = {};\n if (node.nodeType === node.TEXT_NODE) {\n // const parent = node.parentNode;\n // console.log('PARENT ', parent);\n targetNode = node.parentNode;\n } else {\n targetNode = node;\n }\n*/\n const targetNode = node;\n\n // const path = fx.evaluateXPath('path()',node);\n // const path = this.getPath(node);\n const path = XPathUtil.getPath(node);\n // const shortPath = this.shortenPath(path);\n\n // ### constructiong default modelitem - will get evaluated during reaalculate()\n // ### constructiong default modelitem - will get evaluated during reaalculate()\n // ### constructiong default modelitem - will get evaluated during reaalculate()\n // const newItem = new ModelItem(shortPath,\n const newItem = new ModelItem(\n path,\n this.getBindingExpr(),\n FxBind.READONLY_DEFAULT,\n FxBind.RELEVANT_DEFAULT,\n FxBind.REQUIRED_DEFAULT,\n FxBind.CONSTRAINT_DEFAULT,\n this.type,\n targetNode,\n this,\n );\n\n this.getModel().registerModelItem(newItem);\n }\n\n /**\n * Get the nodes that are referred by the given XPath expression\n *\n * @param {string} propertyExpr The XPath to get the referenced nodes from\n *\n * @return {Node[]} The nodes that are referenced by the XPath\n */\n _getReferencesForProperty(propertyExpr) {\n if (propertyExpr) {\n const touchedNodes = new Set();\n const domFacade = new DependencyNotifyingDomFacade(otherNode => touchedNodes.add(otherNode));\n this.nodeset.forEach(node => {\n evaluateXPathToString(propertyExpr, node, this.getOwnerForm(), domFacade);\n });\n\n return Array.from(touchedNodes.values());\n }\n return [];\n }\n\n _initBooleanModelItemProperty(property, node) {\n // evaluate expression to boolean\n const propertyExpr = this[property];\n // console.log('####### ', propertyExpr);\n const result = evaluateXPathToBoolean(propertyExpr, node, this);\n return result;\n }\n\n static shortenPath(path) {\n const steps = path.split('/');\n let result = '';\n for (let i = 2; i < steps.length; i += 1) {\n const step = steps[i];\n if (step.indexOf('{}') !== -1) {\n const q = step.split('{}');\n result += `/${q[1]}`;\n } else {\n result += `/${step}`;\n }\n }\n return result;\n }\n\n // todo: more elaborated implementation ;)\n _getInstanceId() {\n const bindExpr = this.getBindingExpr();\n // console.log('_getInstanceId bindExpr ', bindExpr);\n if (bindExpr.startsWith('instance(')) {\n this.instanceId = XPathUtil.getInstanceId(bindExpr);\n return this.instanceId;\n }\n if (this.instanceId) {\n return this.instanceId;\n }\n return 'default';\n }\n}\ncustomElements.define('fx-bind', FxBind);\n","/*!\n * Toastify js 1.11.0\n * https://github.com/apvarun/toastify-js\n * @license MIT licensed\n *\n * Copyright (C) 2018 Varun A P\n */\n\n/**\n * Options used for Toastify\n * @typedef {Object} ToastifyConfigurationObject\n * @property {string} text - Message to be displayed in the toast\n * @property {Element} node - Provide a node to be mounted inside the toast. node takes higher precedence over text\n * @property {number} duration - Duration for which the toast should be displayed. -1 for permanent toast\n * @property {string|Element} selector - CSS ID Selector on which the toast should be added\n * @property {url} destination - URL to which the browser should be navigated on click of the toast\n * @property {boolean} newWindow - Decides whether the destination should be opened in a new window or not\n * @property {boolean} close - To show the close icon or not\n * @property {string} gravity - To show the toast from top or bottom\n * @property {string} position - To show the toast on left or right\n * @property {string} backgroundColor - Deprecated: Sets the background color of the toast\n * @property {url} avatar - Image/icon to be shown before text\n * @property {string} className - Ability to provide custom class name for further customization\n * @property {boolean} stopOnFocus - To stop timer when hovered over the toast (Only if duration is set)\n * @property {Function} callback - Invoked when the toast is dismissed\n * @property {Function} onClick - Invoked when the toast is clicked\n * @property {Object} offset - Ability to add some offset to axis\n * @property {boolean} escapeMarkup - Toggle the default behavior of escaping HTML markup\n * @property {Object} style - Use the HTML DOM style property to add styles to toast\n */\n\n\nclass Toastify {\n\n defaults = {\n oldestFirst: true,\n text: \"Toastify is awesome!\",\n node: undefined,\n duration: 3000,\n selector: undefined,\n callback: function() {},\n destination: undefined,\n newWindow: false,\n close: false,\n gravity: \"toastify-top\",\n positionLeft: false,\n position: \"\",\n backgroundColor: \"\",\n avatar: \"\",\n className: \"\",\n stopOnFocus: true,\n onClick: function() {},\n offset: { x: 0, y: 0 },\n escapeMarkup: true,\n style: { background: \"\" },\n };\n\n constructor(options) {\n /**\n * The version of Toastify\n * @type {string}\n * @public\n */\n this.version = \"1.11.0\";\n\n /**\n * The configuration object to configure Toastify\n * @type {ToastifyConfigurationObject}\n * @public\n */\n this.options = {};\n\n /**\n * The element that is the Toast\n * @type {Element}\n * @public\n */\n this.toastElement = null;\n\n /**\n * The root element that contains all the toasts\n * @type {Element}\n * @private\n */\n this._rootElement = document.body;\n\n this._init(options);\n }\n\n /**\n * Display the toast\n * @public\n */\n showToast() {\n // Creating the DOM object for the toast\n this.toastElement = this._buildToast();\n\n // Getting the root element to with the toast needs to be added\n if (typeof this.options.selector === \"string\") {\n this._rootElement = document.getElementById(this.options.selector);\n } else if (this.options.selector instanceof HTMLElement || this.options.selector instanceof ShadowRoot) {\n this._rootElement = this.options.selector;\n } else {\n this._rootElement = document.body;\n }\n\n // Validating if root element is present in DOM\n if (!this._rootElement) {\n throw \"Root element is not defined\";\n }\n\n // Adding the DOM element\n this._rootElement.insertBefore(this.toastElement, this._rootElement.firstChild);\n\n // Repositioning the toasts in case multiple toasts are present\n this._reposition();\n\n if (this.options.duration > 0) {\n this.toastElement.timeOutValue = window.setTimeout(\n () => {\n // Remove the toast from DOM\n this._removeElement(this.toastElement);\n },\n this.options.duration\n ); // Binding `this` for function invocation\n }\n\n // Supporting function chaining\n return this;\n }\n\n /**\n * Hide the toast\n * @public\n */\n hideToast() {\n if (this.toastElement.timeOutValue) {\n clearTimeout(this.toastElement.timeOutValue);\n }\n this._removeElement(this.toastElement);\n }\n\n /**\n * Init the Toastify class\n * @param {ToastifyConfigurationObject} options - The configuration object to configure Toastify\n * @param {string} [options.text=Hi there!] - Message to be displayed in the toast\n * @param {Element} [options.node] - Provide a node to be mounted inside the toast. node takes higher precedence over text\n * @param {number} [options.duration=3000] - Duration for which the toast should be displayed. -1 for permanent toast\n * @param {string} [options.selector] - CSS Selector on which the toast should be added\n * @param {url} [options.destination] - URL to which the browser should be navigated on click of the toast\n * @param {boolean} [options.newWindow=false] - Decides whether the destination should be opened in a new window or not\n * @param {boolean} [options.close=false] - To show the close icon or not\n * @param {string} [options.gravity=toastify-top] - To show the toast from top or bottom\n * @param {string} [options.position=right] - To show the toast on left or right\n * @param {string} [options.backgroundColor] - Sets the background color of the toast (To be deprecated)\n * @param {url} [options.avatar] - Image/icon to be shown before text\n * @param {string} [options.className] - Ability to provide custom class name for further customization\n * @param {boolean} [options.stopOnFocus] - To stop timer when hovered over the toast (Only if duration is set)\n * @param {Function} [options.callback] - Invoked when the toast is dismissed\n * @param {Function} [options.onClick] - Invoked when the toast is clicked\n * @param {Object} [options.offset] - Ability to add some offset to axis\n * @param {boolean} [options.escapeMarkup=true] - Toggle the default behavior of escaping HTML markup\n * @param {Object} [options.style] - Use the HTML DOM style property to add styles to toast\n * @private\n */\n _init(options) {\n\n // Setting defaults\n this.options = Object.assign(this.defaults, options);\n\n if (this.options.backgroundColor) {\n // This is being deprecated in favor of using the style HTML DOM property\n console.warn('DEPRECATION NOTICE: \"backgroundColor\" is being deprecated. Please use the \"style.background\" property.');\n }\n\n this.toastElement = null;\n\n this.options.gravity = options.gravity === \"bottom\" ? \"toastify-bottom\" : \"toastify-top\"; // toast position - top or bottom\n this.options.stopOnFocus = options.stopOnFocus === undefined ? true : options.stopOnFocus; // stop timeout on focus\n\n this.options.style.background = this.options.style.background || options.backgroundColor;\n }\n\n /**\n * Build the Toastify element\n * @returns {Element}\n * @private\n */\n _buildToast() {\n // Validating if the options are defined\n if (!this.options) {\n throw \"Toastify is not initialized\";\n }\n\n // Creating the DOM object\n let divElement = document.createElement(\"div\");\n divElement.className = `toastify on ${this.options.className}`;\n\n // Positioning toast to left or right or center (default right)\n divElement.className += ` toastify-${this.options.position}`;\n\n // Assigning gravity of element\n divElement.className += ` ${this.options.gravity}`;\n\n // Loop through our style object and apply styles to divElement\n for (const property in this.options.style) {\n divElement.style[property] = this.options.style[property];\n }\n\n // Adding the toast message/node\n if (this.options.node && this.options.node.nodeType === Node.ELEMENT_NODE) {\n // If we have a valid node, we insert it\n divElement.appendChild(this.options.node)\n } else {\n if (this.options.escapeMarkup) {\n divElement.innerText = this.options.text;\n } else {\n divElement.innerHTML = this.options.text;\n }\n\n if (this.options.avatar !== \"\") {\n let avatarElement = document.createElement(\"img\");\n avatarElement.src = this.options.avatar;\n\n avatarElement.className = \"toastify-avatar\";\n\n if (this.options.position == \"left\") {\n // Adding close icon on the left of content\n divElement.appendChild(avatarElement);\n } else {\n // Adding close icon on the right of content\n divElement.insertAdjacentElement(\"afterbegin\", avatarElement);\n }\n }\n }\n\n // Adding a close icon to the toast\n if (this.options.close === true) {\n // Create a span for close element\n let closeElement = document.createElement(\"span\");\n closeElement.innerHTML = \"✖\";\n\n closeElement.className = \"toast-close\";\n\n // Triggering the removal of toast from DOM on close click\n closeElement.addEventListener(\n \"click\",\n (event) => {\n event.stopPropagation();\n this._removeElement(this.toastElement);\n window.clearTimeout(this.toastElement.timeOutValue);\n }\n );\n\n //Calculating screen width\n const width = window.innerWidth > 0 ? window.innerWidth : screen.width;\n\n // Adding the close icon to the toast element\n // Display on the right if screen width is less than or equal to 360px\n if ((this.options.position == \"left\") && width > 360) {\n // Adding close icon on the left of content\n divElement.insertAdjacentElement(\"afterbegin\", closeElement);\n } else {\n // Adding close icon on the right of content\n divElement.appendChild(closeElement);\n }\n }\n\n // Clear timeout while toast is focused\n if (this.options.stopOnFocus && this.options.duration > 0) {\n // stop countdown\n divElement.addEventListener(\n \"mouseover\",\n (event) => {\n window.clearTimeout(divElement.timeOutValue);\n }\n )\n // add back the timeout\n divElement.addEventListener(\n \"mouseleave\",\n () => {\n divElement.timeOutValue = window.setTimeout(\n () => {\n // Remove the toast from DOM\n this._removeElement(divElement);\n },\n this.options.duration\n )\n }\n )\n }\n\n // Adding an on-click destination path\n if (typeof this.options.destination !== \"undefined\") {\n divElement.addEventListener(\n \"click\",\n (event) => {\n event.stopPropagation();\n if (this.options.newWindow === true) {\n window.open(this.options.destination, \"_blank\");\n } else {\n window.location = this.options.destination;\n }\n }\n );\n }\n\n if (typeof this.options.onClick === \"function\" && typeof this.options.destination === \"undefined\") {\n divElement.addEventListener(\n \"click\",\n (event) => {\n event.stopPropagation();\n this.options.onClick();\n }\n );\n }\n\n // Adding offset\n if (typeof this.options.offset === \"object\") {\n\n const x = this._getAxisOffsetAValue(\"x\", this.options);\n const y = this._getAxisOffsetAValue(\"y\", this.options);\n\n const xOffset = this.options.position == \"left\" ? x : `-${x}`;\n const yOffset = this.options.gravity == \"toastify-top\" ? y : `-${y}`;\n\n divElement.style.transform = `translate(${xOffset},${yOffset})`;\n\n }\n\n // Returning the generated element\n return divElement;\n }\n\n /**\n * Remove the toast from the DOM\n * @param {Element} toastElement\n */\n _removeElement(toastElement) {\n // Hiding the element\n toastElement.className = toastElement.className.replace(\" on\", \"\");\n\n // Removing the element from DOM after transition end\n window.setTimeout(\n () => {\n // remove options node if any\n if (this.options.node && this.options.node.parentNode) {\n this.options.node.parentNode.removeChild(this.options.node);\n }\n\n // Remove the element from the DOM, only when the parent node was not removed before.\n if (toastElement.parentNode) {\n toastElement.parentNode.removeChild(toastElement);\n }\n\n // Calling the callback function\n this.options.callback.call(toastElement);\n\n // Repositioning the toasts again\n this._reposition();\n },\n 400\n ); // Binding `this` for function invocation\n }\n\n /**\n * Position the toast on the DOM\n * @private\n */\n _reposition() {\n\n // Top margins with gravity\n let topLeftOffsetSize = {\n top: 15,\n bottom: 15,\n };\n let topRightOffsetSize = {\n top: 15,\n bottom: 15,\n };\n let offsetSize = {\n top: 15,\n bottom: 15,\n };\n\n // Get all toast messages that have been added to the container (selector)\n let allToasts = this._rootElement.querySelectorAll(\".toastify\");\n\n let classUsed;\n\n // Modifying the position of each toast element\n for (let i = 0; i < allToasts.length; i++) {\n // Getting the applied gravity\n if (allToasts[i].classList.contains(\"toastify-top\") === true) {\n classUsed = \"toastify-top\";\n } else {\n classUsed = \"toastify-bottom\";\n }\n\n let height = allToasts[i].offsetHeight;\n classUsed = classUsed.substr(9, classUsed.length - 1)\n // Spacing between toasts\n let offset = 15;\n\n let width = window.innerWidth > 0 ? window.innerWidth : screen.width;\n\n // Show toast in center if screen with less than or equal to 360px\n if (width <= 360) {\n // Setting the position\n allToasts[i].style[classUsed] = `${offsetSize[classUsed]}px`;\n\n offsetSize[classUsed] += height + offset;\n } else {\n if (allToasts[i].classList.contains(\"toastify-left\") === true) {\n // Setting the position\n allToasts[i].style[classUsed] = `${topLeftOffsetSize[classUsed]}px`;\n\n topLeftOffsetSize[classUsed] += height + offset;\n } else {\n // Setting the position\n allToasts[i].style[classUsed] = `${topRightOffsetSize[classUsed]}px`;\n\n topRightOffsetSize[classUsed] += height + offset;\n }\n }\n }\n }\n\n /**\n * Helper function to get offset\n * @param {string} axis - 'x' or 'y'\n * @param {ToastifyConfigurationObject} options - The options object containing the offset object\n */\n _getAxisOffsetAValue(axis, options) {\n\n if (options.offset[axis]) {\n if (isNaN(options.offset[axis])) {\n return options.offset[axis];\n } else {\n return `${options.offset[axis]}px`;\n }\n }\n\n return '0px';\n\n }\n\n }\n\n\n // Returning the Toastify function to be assigned to the window object/module\n function StartToastifyInstance(options) {\n return new Toastify(options);\n }\n\n export default StartToastifyInstance;\n","import Toastify from 'toastify-js/src/toastify-es';\n\n/**\n *\n * Wrapper component for toastify-js - https://github.com/apvarun/toastify-js\n *\n * @event jinn-toast - will show the toast with text passed in event\n */\nexport class JinnToast extends HTMLElement {\n\n static get properties() {\n return {\n avatar: {type: String},\n backgroundColor: {type: String},\n callback: {type: String},\n classProp: {type: String},\n close: {type: Boolean},\n destination: {type: String},\n duration: {type: Number},\n escapeMarkup: {type: Boolean},\n gravity: {type: String},\n newWindow: {type: Boolean},\n oldestFirst: {type: Boolean},\n position: {type: String},\n selector: {type: String},\n stopOnFocus: {type: Boolean},\n text: {type: String}\n };\n }\n\n constructor() {\n super();\n this.attachShadow({mode: 'open'});\n }\n\n _initVar(name, defaultVal) {\n return this.hasAttribute(name) ? this.getAttribute(name) : defaultVal;\n }\n\n connectedCallback() {\n this.avatar = this._initVar('avatar', '');\n this.backgroundColor = this._initVar('backgroundColor', '');\n this.callback = this._initVar('callback', {});\n this.classProp = this._initVar('data-class', '');\n this.close = (this._initVar('close', false)) === 'true';\n this.destination = this._initVar('destination', '');\n this.duration = Number(this._initVar('duration', 3000));\n this.escapeMarkup = (this._initVar('escapeMarkup', true)) === 'true';\n this.gravity = this._initVar('gravity', 'top');\n this.newWindow = (this._initVar('newWindow', false)) === 'true';\n // this.offSet = this._initVar('offSet', {});\n this.oldestFirst = (this._initVar('oldestFirst', true)) === 'true';\n this.position = this._initVar('position', 'right');\n // this.selector = this._initVar('selector','');\n this.stopOnFocus = this._initVar('stopOnFocus', true);\n this.text = this._initVar('text', '');\n\n const style = `\n :host{\n display:none;\n }\n `;\n this.shadowRoot.innerHTML = `\n \n ${this.renderHTML}\n `;\n\n /**\n * trigger toast via @jinn-toast events\n */\n this.addEventListener('jinn-toast', (ev) =>{\n this.showToast(ev.detail.text);\n });\n\n }\n\n showToast(text){\n new Toastify({\n avatar: this.avatar,\n // backgroundColor:this.backgroundColor,\n // callback: this.callback,\n className:this.classProp,\n close: this.close,\n destination: this.destination,\n duration: this.duration,\n escapeMarkup: this.escapeMarkup,\n gravity: this.gravity,\n newWindow: this.newWindow,\n // offset:this.offset,\n oldestFirst: this.oldestFirst,\n position: this.position,\n node: this.shadowRoot,\n stopOnFocus: this.stopOnFocus,\n text,\n }).showToast();\n\n }\n\n renderHTML() {\n return `\n \n `;\n }\n\n}\nwindow.customElements.define('jinn-toast', JinnToast);\n","import { Fore } from './fore.js';\nimport './fx-instance.js';\nimport './fx-model.js';\nimport '@jinntec/jinn-toast';\nimport { evaluateXPathToNodes, evaluateXPathToString } from './xpath-evaluation.js';\nimport getInScopeContext from './getInScopeContext.js';\n\n/**\n * Main class for Fore.Outermost container element for each Fore application.\n *\n *\n *\n * Root element for Fore. Kicks off initialization and displays messages.\n *\n * fx-fore is the outermost container for each form. A form can have exactly one model\n * with arbitrary number of instances.\n *\n * Main responsiblities are initialization of model, update of UI (refresh) and global messaging\n *\n * @ts-check\n */\nexport class FxFore extends HTMLElement {\n static get properties() {\n return {\n model: {\n type: Object,\n },\n ready: {\n type: Boolean,\n },\n };\n }\n\n constructor() {\n super();\n this.model = {};\n this.addEventListener('model-construct-done', this._handleModelConstructDone);\n this.addEventListener('message', this._displayMessage);\n this.addEventListener('error', this._displayError);\n window.addEventListener('compute-exception', e => {\n console.error('circular dependency: ', e);\n });\n\n this.ready = false;\n\n this.storedTemplateExpressionByNode = new Map();\n\n const style = `\n :host {\n display: block;\n height:auto;\n padding:var(--model-element-padding);\n font-family:Roboto, sans-serif;\n color:var(--paper-grey-900);\n }\n :host ::slotted(fx-model){\n display:none;\n }\n #modalMessage .dialogActions{\n text-align:center;\n }\n .overlay {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, 0.7);\n transition: all 500ms;\n visibility: hidden;\n opacity: 0;\n z-index:10;\n }\n .overlay.show {\n visibility: visible;\n opacity: 1;\n }\n\n .popup {\n margin: 70px auto;\n background: #fff;\n border-radius: 5px;\n width: 30%;\n position: relative;\n transition: all 5s ease-in-out;\n padding: 20px;\n\n }\n .popup h2 {\n margin-top: 0;\n width:100%;\n background:#eee;\n position:absolute;\n top:0;\n right:0;\n left:0;\n height:40px;\n border-radius: 5px;\n\n }\n .popup .close {\n position: absolute;\n top: 3px;\n right: 10px;\n transition: all 200ms;\n font-size: 30px;\n font-weight: bold;\n text-decoration: none;\n color: #333;\n }\n .popup .close:focus{\n outline:none;\n }\n\n .popup .close:hover {\n color: #06D85F;\n }\n #messageContent{\n margin-top:40px;\n }\n `;\n\n const html = `\n \n \n \n
\n
\n

\n ×\n
\n
\n
\n `;\n\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.innerHTML = `\n \n ${html}\n `;\n }\n\n connectedCallback() {\n const slot = this.shadowRoot.querySelector('slot');\n slot.addEventListener('slotchange', event => {\n const children = event.target.assignedElements();\n let modelElement = children.find(\n modelElem => modelElem.nodeName.toUpperCase() === 'FX-MODEL',\n );\n if (!modelElement) {\n const generatedModel = document.createElement('FX-model');\n this.appendChild(generatedModel);\n modelElement = generatedModel;\n }\n if (!modelElement.inited) {\n console.log('########## FORE: kick off processing... ##########');\n modelElement.modelConstruct();\n }\n this.model = modelElement;\n });\n }\n\n evaluateToNodes(xpath, context) {\n return evaluateXPathToNodes(xpath, context, this);\n }\n\n disconnectedCallback() {}\n\n /**\n * refreshes the whole UI by visiting each bound element (having a 'ref' attribute) and applying the state of\n * the bound modelItem to the bound element.\n *\n *\n * AVT:\n *\n */\n async refresh() {\n // refresh () {\n console.group('### refresh');\n // await this.updateComplete;\n\n Fore.refreshChildren(this);\n // this.dispatchEvent(new CustomEvent('refresh-done', {detail:'foo'}));\n\n // ### refresh template expressions\n this._updateTemplateExpressions();\n\n console.groupEnd();\n console.log('### <<<<< dispatching refresh-done - end of UI update cycle >>>>>');\n this.dispatchEvent(new CustomEvent('refresh-done'));\n }\n\n /**\n * entry point for processing of template expression enclosed in '{}' brackets.\n *\n * Expressions are found with an XPath search. For each node an entry is added to the storedTemplateExpressionByNode map.\n *\n *\n * @private\n */\n _updateTemplateExpressions() {\n // Note the fact we're going over HTML here: therefore the `html` prefix.\n const search =\n \"(descendant-or-self::*/(text(), @*))[matches(.,'\\\\{.*\\\\}')] except descendant-or-self::xhtml:fx-model/descendant-or-self::node()/(., @*)\";\n\n const tmplExpressions = evaluateXPathToNodes(search, this, this);\n console.log('template expressions found ', tmplExpressions);\n\n /*\n storing expressions and their nodes for re-evaluation\n */\n Array.from(tmplExpressions).forEach(node => {\n if (this.storedTemplateExpressionByNode.has(node)) {\n // If the node is already known, do not process it twice\n return;\n }\n const expr = this._getTemplateExpression(node);\n\n this.storedTemplateExpressionByNode.set(node, expr);\n });\n\n // TODO: Should we clean up nodes that existed but are now gone?\n for (const node of this.storedTemplateExpressionByNode.keys()) {\n this._processTemplateExpression({\n node,\n expr: this.storedTemplateExpressionByNode.get(node),\n });\n }\n\n console.log('stored template expressions ', this.storedTemplateExpressionByNode);\n }\n\n // eslint-disable-next-line class-methods-use-this\n _processTemplateExpression(exprObj) {\n // console.log('processing template expression ', exprObj);\n\n const { expr } = exprObj;\n const { node } = exprObj;\n // console.log('expr ', expr);\n this.evaluateTemplateExpression(expr, node, this);\n }\n\n /**\n * evaluate a template expression (some expression in {} brackets) on a node (either text- or attribute node.\n * @param expr the XPath to evaluate\n * @param node the node which will get updated with evaluation result\n * @param form the form element\n */\n evaluateTemplateExpression(expr, node) {\n if (expr === '{}') return;\n const matches = expr.match(/{[^}]*}/g);\n const namespaceContextNode =\n node.nodeType === node.TEXT_NODE ? node.parentNode : node.ownerElement;\n if (matches) {\n matches.forEach(match => {\n // console.log('match ', match);\n let naked = match.substring(1, match.length - 1);\n const inscope = getInScopeContext(node, naked);\n if (!inscope) {\n const errNode =\n node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ATTRIBUTE_NODE\n ? node.parentNode\n : node;\n console.warn('no inscope context for ', errNode);\n return;\n }\n // Templates are special: they use the namespace configuration from the place where they are\n // being defined\n\n try {\n const result = evaluateXPathToString(naked, inscope, node, null, namespaceContextNode);\n\n // console.log('result of eval ', result);\n const replaced = expr.replaceAll(match, result);\n console.log('result of replacing ', replaced);\n\n if (node.nodeType === Node.ATTRIBUTE_NODE) {\n const parent = node.ownerElement;\n\n // parent.setAttribute(name, replaced);\n parent.setAttribute(node.nodeName, replaced);\n } else if (node.nodeType === Node.TEXT_NODE) {\n node.textContent = replaced;\n }\n\n if (replaced.includes('{')) {\n console.log('need to go next round');\n\n // todo: duplicated code here - see above\n naked = replaced.substring(1, replaced.length);\n this.evaluateTemplateExpression(replaced, node);\n }\n } catch (error) {\n this.dispatchEvent(new CustomEvent('error', { detail: error }));\n }\n });\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n _getTemplateExpression(node) {\n if (node.nodeType === Node.ATTRIBUTE_NODE) {\n return node.value;\n }\n if (node.nodeType === Node.TEXT_NODE) {\n return node.textContent;\n }\n return null;\n }\n\n _refreshChildren() {\n const uiElements = this.querySelectorAll('*');\n\n uiElements.forEach(element => {\n if (Fore.isUiElement(element.nodeName) && typeof element.refresh === 'function') {\n element.refresh();\n }\n });\n }\n\n _handleModelConstructDone() {\n this._initUI();\n }\n\n async _lazyCreateInstance() {\n const model = this.querySelector('fx-model');\n if (model.instances.length === 0) {\n console.log('### lazy creation of instance');\n const generatedInstance = document.createElement('fx-instance');\n model.appendChild(generatedInstance);\n\n const generated = document.implementation.createDocument(null, 'data', null);\n // const newData = this._generateInstance(this, generated.firstElementChild);\n this._generateInstance(this, generated.firstElementChild);\n generatedInstance.instanceData = generated;\n model.instances.push(generatedInstance);\n console.log('generatedInstance ', this.getModel().getDefaultInstanceData());\n }\n }\n\n /**\n * @param {Element} start\n * @param {Element} parent\n */\n _generateInstance(start, parent) {\n if (start.hasAttribute('ref') && !Fore.isActionElement(start.nodeName)) {\n const ref = start.getAttribute('ref');\n\n if (ref.includes('/')) {\n console.log('complex path to create ', ref);\n const steps = ref.split('/');\n steps.forEach(step => {\n console.log('step ', step);\n\n // const generated = document.createElement(ref);\n parent = this._generateNode(parent, step, start);\n });\n } else {\n parent = this._generateNode(parent, ref, start);\n }\n }\n\n if (start.hasChildNodes()) {\n const list = start.children;\n for (let i = 0; i < list.length; i += 1) {\n this._generateInstance(list[i], parent);\n }\n }\n return parent;\n }\n\n // eslint-disable-next-line class-methods-use-this\n _generateNode(parent, step, start) {\n const generated = parent.ownerDocument.createElement(step);\n if (start.children.length === 0) {\n generated.textContent = start.textContent;\n }\n parent.appendChild(generated);\n parent = generated;\n return parent;\n }\n\n /*\n _createStep(){\n\n }\n */\n\n /*\n _generateInstance(start, parent) {\n if (start.hasAttribute('ref')) {\n const ref = start.getAttribute('ref');\n\n if(ref.includes('/')){\n console.log('complex path to create ', ref);\n const steps = ref.split('/');\n steps.forEach(step => {\n console.log('step ', step);\n\n\n });\n }\n\n // const generated = document.createElement(ref);\n const generated = parent.ownerDocument.createElement(ref);\n if (start.children.length === 0) {\n generated.textContent = start.textContent;\n }\n parent.appendChild(generated);\n parent = generated;\n }\n\n if (start.hasChildNodes()) {\n const list = start.children;\n for (let i = 0; i < list.length; i += 1) {\n this._generateInstance(list[i], parent);\n }\n }\n return parent;\n }\n */\n\n async _initUI() {\n console.log('### _initUI()');\n\n await this._lazyCreateInstance();\n await this.refresh();\n this.ready = true;\n console.log('### <<<<< dispatching ready >>>>>');\n console.log('########## modelItems: ', this.getModel().modelItems);\n console.log('########## FORE: form fully initialized... ##########');\n this.dispatchEvent(new CustomEvent('ready', {}));\n }\n\n /**\n *\n * @returns {FxModel}\n */\n getModel() {\n return this.querySelector('fx-model');\n }\n\n _displayMessage(e) {\n const { level } = e.detail;\n const msg = e.detail.message;\n this._showMessage(level, msg);\n }\n\n _displayError(e) {\n // const { error } = e.detail;\n const msg = e.detail.message;\n // this._showMessage('modal', msg);\n const toast = this.shadowRoot.querySelector('#error');\n toast.showToast(msg);\n }\n\n _showMessage(level, msg) {\n if (level === 'modal') {\n // this.$.messageContent.innerText = msg;\n // this.$.modalMessage.open();\n\n this.shadowRoot.getElementById('messageContent').innerText = msg;\n // this.shadowRoot.getElementById('modalMessage').open();\n this.shadowRoot.getElementById('modalMessage').classList.add('show');\n } else if (level === 'modeless') {\n // const notification = this.$.modeless;\n this.shadowRoot.querySelector('#message').showToast(msg);\n } else {\n const toast = this.shadowRoot.querySelector('#message');\n toast.showToast(msg);\n }\n }\n}\n\ncustomElements.define('fx-fore', FxFore);\n","import { Fore } from './fore.js';\nimport { foreElementMixin } from './ForeElementMixin.js';\nimport { evaluateXPathToString, evaluateXPath } from './xpath-evaluation.js';\nimport getInScopeContext from './getInScopeContext.js';\n\n/**\n * todo: validate='false'\n */\nexport class FxSubmission extends foreElementMixin(HTMLElement) {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback() {\n // this.style.display = 'none';\n this.methods = ['get', 'put', 'post', 'delete', 'head', 'urlencoded-post'];\n\n this.model = this.parentNode;\n\n // ### initialize properties with defaults\n // if (!this.hasAttribute('id')) throw new Error('id is required');\n if (!this.hasAttribute('id')) console.warn('id is required');\n this.id = this.getAttribute('id');\n\n /** if present should be a existing instance id */\n this.instance = this.hasAttribute('instance') ? this.getAttribute('instance') : null;\n\n /** http method */\n this.method = this.hasAttribute('method') ? this.getAttribute('method') : 'get';\n\n /** relevance processing - one of 'remove, keep or empty' */\n this.nonrelevant = this.hasAttribute('nonrelevant')\n ? this.getAttribute('nonrelevant')\n : 'remove';\n\n /** replace might be 'all', 'instance' or 'none' */\n this.replace = this.hasAttribute('replace') ? this.getAttribute('replace') : 'all';\n\n this.serialization = this.hasAttribute('serialization')\n ? this.getAttribute('serialization')\n : 'xml';\n\n // if (!this.hasAttribute('url')) throw new Error(`url is required for submission: ${this.id}`);\n if (!this.hasAttribute('url')) console.warn(`url is required for submission: ${this.id}`);\n this.url = this.getAttribute('url');\n\n this.targetref = this.hasAttribute('targetref') ? this.getAttribute('targetref') : null;\n\n this.mediatype = this.hasAttribute('mediatype')\n ? this.getAttribute('mediatype')\n : 'application/xml';\n\n this.validate = this.getAttribute('validate') ? this.getAttribute('validate') : 'true';\n this.shadowRoot.innerHTML = this.renderHTML();\n }\n\n // eslint-disable-next-line class-methods-use-this\n renderHTML() {\n return `\n \n `;\n }\n\n async submit() {\n await this.dispatch('submit', { submission: this });\n this._submit();\n }\n\n async _submit() {\n console.log('submitting....');\n this.evalInContext();\n const model = this.getModel();\n\n model.recalculate();\n\n if (this.validate) {\n const valid = model.revalidate();\n if (!valid) {\n console.log('validation failed. Bubmission stopped');\n return;\n }\n }\n console.log('model updated....');\n await this._serializeAndSend();\n }\n\n /**\n * resolves template expressions for a single attribute\n * @param expr the attribute value to evaluate\n * @param node the attribute node used for scoped resolution\n * @returns {*}\n * @private\n */\n _evaluateAttributeTemplateExpression(expr, node) {\n const matches = expr.match(/{[^}]*}/g);\n if (matches) {\n matches.forEach(match => {\n console.log('match ', match);\n const naked = match.substring(1, match.length - 1);\n const inscope = getInScopeContext(node, naked);\n const result = evaluateXPathToString(naked, inscope, this.getOwnerForm());\n const replaced = expr.replaceAll(match, result);\n console.log('replacing ', expr, ' with ', replaced);\n expr = replaced;\n });\n }\n return expr;\n }\n\n /**\n * sends the data after evaluating\n *\n * todo: can send only XML at the moment\n * @private\n */\n async _serializeAndSend() {\n const resolvedUrl = this._evaluateAttributeTemplateExpression(this.url, this);\n\n const instance = this.getInstance();\n if (instance.type !== 'xml') {\n console.error('JSON serialization is not supported yet');\n return;\n }\n\n // let serialized = serializer.serializeToString(this.nodeset);\n let serialized;\n if (this.serialization === 'none') {\n serialized = undefined;\n } else {\n const relevant = this.selectRelevant();\n serialized = this._serialize(instance.type, relevant);\n }\n\n // let serialized = serializer.serializeToString(relevant);\n if (this.method.toLowerCase() === 'get') {\n serialized = undefined;\n }\n // console.log('data being send', serialized);\n // console.log('submitting data',serialized);\n\n if (resolvedUrl === '#echo') {\n let doc;\n if (serialized) {\n doc = new DOMParser().parseFromString(serialized, 'application/xml');\n } else {\n doc = undefined;\n }\n // const doc = new DOMParser().parseFromString(serialized, 'application/xml');\n // const newDoc = doc.replaceChild(relevant, doc.firstElementChild);\n this._handleResponse(doc);\n this.dispatch('submit-done', {});\n return;\n }\n // ### setting headers\n const headers = this._getHeaders();\n console.log('headers', headers);\n\n // ### map urlencoded-post to post for fetch\n if (this.method === 'urlencoded-post') {\n this.method = 'post';\n }\n\n if (!this.methods.includes(this.method.toLowerCase())) {\n this.dispatch('error', { message: `Unknown method ${this.method}` });\n return;\n }\n const response = await fetch(resolvedUrl, {\n method: this.method,\n mode: 'cors',\n credentials: 'include',\n headers,\n body: serialized,\n });\n\n if (!response.ok || response.status > 400) {\n this.dispatch('submit-error', { message: `Error while submitting ${this.id}` });\n return;\n }\n\n const contentType = response.headers.get('content-type').toLowerCase();\n if (contentType.startsWith('text/plain') || contentType.startsWith('text/html')) {\n const text = await response.text();\n this._handleResponse(text);\n } else if (contentType.startsWith('application/json')) {\n const json = await response.json();\n this._handleResponse(json);\n } else if (contentType.startsWith('application/xml')) {\n const text = await response.text();\n const xml = new DOMParser().parseFromString(text, 'application/xml');\n this._handleResponse(xml);\n } else {\n const blob = await response.blob();\n this._handleResponse(blob);\n }\n\n this.dispatch('submit-done', {});\n }\n\n _serialize(instanceType, relevantNodes) {\n if (this.method === 'urlencoded-post') {\n // this.method = 'post';\n const params = new URLSearchParams();\n // console.log('nodes to serialize', relevantNodes);\n Array.from(relevantNodes.children).forEach(child => {\n params.append(child.nodeName, child.textContent);\n });\n return params;\n }\n if (instanceType === 'xml') {\n const serializer = new XMLSerializer();\n return serializer.serializeToString(relevantNodes);\n }\n /*\n if(instanceType === 'json'){\n console.warn('JSON serialization is not yet supported')\n }\n */\n throw new Error('unknown instance type ', instanceType);\n }\n\n _getHeaders() {\n const headers = new Headers();\n\n // ### set content-type header according to type of instance\n const instance = this.getInstance();\n const contentType = Fore.getContentType(instance, this.method);\n headers.append('Content-Type', contentType);\n // ### needed to overwrite browsers' setting of 'Accept' header\n if (headers.has('Accept')) {\n headers.delete('Accept');\n }\n // headers.append('Accept', 'application/xml');\n\n // ### add header defined by fx-header elements\n const headerElems = this.querySelectorAll('fx-header');\n Array.from(headerElems).forEach(header => {\n const { name } = header;\n const val = header.getValue();\n headers.append(name, val);\n });\n return headers;\n }\n\n _getUrlExpr() {\n return this.storedTemplateExpressions.find(stored => stored.node.nodeName === 'url');\n }\n\n _getTargetInstance() {\n let targetInstance;\n if (this.instance) {\n targetInstance = this.model.getInstance(this.instance);\n } else {\n targetInstance = this.model.getInstance('default');\n }\n if (!targetInstance) {\n throw new Error(`target instance not found: ${targetInstance}`);\n }\n return targetInstance;\n }\n\n _handleResponse(data) {\n console.log('_handleResponse ', data);\n if (this.replace === 'instance') {\n const targetInstance = this._getTargetInstance();\n if (targetInstance) {\n if (this.targetref) {\n const theTarget = evaluateXPath(this.targetref, targetInstance, this.getOwnerForm());\n console.log('theTarget', theTarget);\n const clone = data.firstElementChild;\n const parent = theTarget.parentNode;\n parent.replaceChild(clone, theTarget);\n console.log('finally ', parent);\n } else {\n const instanceData = data;\n targetInstance.instanceData = instanceData;\n console.log('### replaced instance ', targetInstance.instanceData);\n }\n\n this.model.updateModel(); // force update\n // this.model.formElement.refresh();\n this.getOwnerForm().refresh();\n } else {\n throw new Error(`target instance not found: ${targetInstance}`);\n }\n }\n\n if (this.replace === 'all') {\n document.getElementsByTagName('html')[0].innerHTML = data;\n }\n if (this.replace === 'target') {\n const target = this.getAttribute('target');\n const targetNode = document.querySelector(target);\n targetNode.innerHTML = data;\n }\n if (this.replace === 'redirect') {\n window.location.href = data;\n }\n\n /*\n const event = new CustomEvent('submit-done', {\n composed: true,\n bubbles: true,\n detail: {},\n });\n console.log('firing',event);\n this.dispatchEvent(event);\n */\n // this.dispatch('submit-done', {});\n }\n\n /**\n * select relevant nodes\n *\n * todo: support for 'empty'\n * @returns {*}\n */\n selectRelevant() {\n // ### no relevance selection - current nodeset is used 'as-is'\n if (this.nonrelevant === 'keep') {\n return this.nodeset;\n }\n\n // first check if nodeset of submission is relevant - otherwise bail out\n const mi = this.getModel().getModelItem(this.nodeset);\n if (mi && !mi.relevant) return null;\n\n const doc = new DOMParser().parseFromString('', 'application/xml');\n const root = doc.firstElementChild;\n\n if (this.nodeset.children.length === 0 && this._isRelevant(this.nodeset)) {\n return this.nodeset;\n }\n const result = this._filterRelevant(this.nodeset, root);\n return result;\n }\n\n _filterRelevant(node, result) {\n const { childNodes } = node;\n Array.from(childNodes).forEach(n => {\n if (this._isRelevant(n)) {\n const clone = n.cloneNode(false);\n result.appendChild(clone);\n const { attributes } = n;\n if (attributes) {\n Array.from(attributes).forEach(attr => {\n if (this._isRelevant(attr)) {\n clone.setAttribute(attr.nodeName, attr.value);\n } else if (this.nonrelevant === 'empty') {\n clone.setAttribute(attr.nodeName, '');\n } else {\n clone.removeAttribute(attr.nodeName);\n }\n });\n }\n return this._filterRelevant(n, clone);\n }\n return null;\n });\n return result;\n }\n\n _isRelevant(node) {\n const mi = this.getModel().getModelItem(node);\n if (!mi || mi.relevant) {\n return true;\n }\n return false;\n }\n\n _handleError() {\n this.dispatch('submit-error', {});\n /*\n console.log('ERRRORRRRR');\n this.dispatchEvent(\n new CustomEvent('submit-error', {\n composed: true,\n bubbles: true,\n detail: {},\n }),\n );\n */\n }\n}\n\ncustomElements.define('fx-submission', FxSubmission);\n","import { foreElementMixin } from './ForeElementMixin.js';\n\nexport class FxHeader extends foreElementMixin(HTMLElement) {\n constructor() {\n super();\n this.style.display = 'none';\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.innerHTML = ``;\n\n if (!this.hasAttribute('name')) {\n throw new Error('required attribute \"name\" missing');\n }\n this.name = this.getAttribute('name');\n }\n\n connectedCallback() {\n this.shadowRoot.innerHTML = ``;\n }\n}\ncustomElements.define('fx-header', FxHeader);\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n window.customElements.polyfillWrapFlushCallback !==\n undefined;\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes = (container, start, end = null, before = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.insertBefore(start, before);\n start = n;\n }\n};\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes = (container, start, end = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.removeChild(start);\n start = n;\n }\n};\n//# sourceMappingURL=dom.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = ``;\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n constructor(result, element) {\n this.parts = [];\n this.element = element;\n const nodesToRemove = [];\n const stack = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(element.content, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const { strings, values: { length } } = result;\n while (partIndex < length) {\n const node = walker.nextNode();\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n continue;\n }\n index++;\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if (node.hasAttributes()) {\n const attributes = node.attributes;\n const { length } = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)[2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName = name.toLowerCase() + boundAttributeSuffix;\n const attributeValue = node.getAttribute(attributeLookupName);\n node.removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({ type: 'attribute', index, name, strings: statics });\n partIndex += statics.length - 1;\n }\n }\n if (node.tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n }\n else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = node.data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n }\n else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({ type: 'node', index: ++index });\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n }\n else {\n node.data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n }\n else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if (node.data === marker) {\n const parent = node.parentNode;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({ type: 'node', index });\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n node.data = '';\n }\n else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n }\n else {\n let i = -1;\n while ((i = node.data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({ type: 'node', index: -1 });\n partIndex++;\n }\n }\n }\n }\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode.removeChild(n);\n }\n }\n}\nconst endsWith = (str, suffix) => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\nexport const isTemplatePartActive = (part) => part.index !== -1;\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex = \n// eslint-disable-next-line no-control-regex\n/([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n//# sourceMappingURL=template.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nconst directives = new WeakMap();\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`
    <${repeat(items, (item) => html`
  • ${item}
  • `)}
`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = (f) => ((...args) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n});\nexport const isDirective = (o) => {\n return typeof o === 'function' && directives.has(o);\n};\n//# sourceMappingURL=directive.js.map","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n//# sourceMappingURL=part.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { isCEPolyfill } from './dom.js';\nimport { isTemplatePartActive } from './template.js';\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n constructor(template, processor, options) {\n this.__parts = [];\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n update(values) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n _clone() {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) :\n document.importNode(this.template.element.content, true);\n const stack = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(fragment, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node.nodeName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n node = walker.nextNode();\n }\n }\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node.previousSibling);\n this.__parts.push(part);\n }\n else {\n this.__parts.push(...this.processor.handleAttributeExpressions(node, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n//# sourceMappingURL=template-instance.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * @module lit-html\n */\nimport { reparentNodes } from './dom.js';\nimport { boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker } from './template.js';\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes.createPolicy('lit-html', { createHTML: (s) => s });\nconst commentMarker = ` ${marker} `;\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n constructor(strings, values, type, processor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n /**\n * Returns a string of HTML used to create a `