@jinntec/fore 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fore-dev.js +3 -3
- package/dist/fore-dev.js.map +1 -1
- package/dist/fore.js +3 -3
- package/dist/fore.js.map +1 -1
- package/package.json +1 -1
- package/src/ForeElementMixin.js +1 -1
- package/src/actions/abstract-action.js +9 -3
- package/src/actions/fx-action.js +1 -0
- package/src/actions/fx-refresh.js +9 -0
- package/src/actions/fx-replace.js +1 -0
- package/src/fx-bind.js +1 -1
- package/src/fx-fore.js +7 -7
- package/src/fx-model.js +1 -4
- package/src/fx-submission.js +2 -3
- package/src/ui/abstract-control.js +7 -6
- package/src/ui/fx-container.js +1 -1
- package/src/ui/fx-control.js +6 -0
- package/src/ui/fx-inspector.js +0 -2
- package/src/ui/fx-output.js +3 -1
- package/src/xpath-evaluation.js +3 -1
package/dist/fore-dev.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
function e(e,t,n,r){const o={op:t,func:n,data:r};return e.push(o),o}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=[],o=[];return e.forEach((e=>{n.push(0),o.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");o[r+1]+=1;break;case 0:o[r]+=1}})),new r(t,n,o)}static createStub(e){const t=[],n=[];for(let r=0;r<e;++r)t.push(e),n.push(e);return new r(e,t,n)}}class o{constructor(e){this.acceptingTraces=e,this.success=e.length>0}}class a{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,o){let a=r,i=o;for(;a<i;){const r=a+i>>>1;n<t[e[r]]?i=r:a=r+1}return a}(this.h,this.l,t,this.i,this.t);this.h.copyWithin(n+1,n,this.t),this.h[n]=e,this.t+=1}reschedule(e,t){const n=Math.max(this.l[e],t>255?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<r+n;++e)t(this.u[e])}}function s(e,t,n=!1){return null===e?t:Array.isArray(e)?(-1===e.indexOf(t)&&(n&&(e=e.slice()),e.push(t)),e):e===t?e:[e,t]}class u{constructor(e,t){this.prefixes=e,this.record=t}}function c(e,t){let n;if(null===t){if(!Array.isArray(e))return e;n=e}else n=e===u.EMPTY?[]:Array.isArray(e)?e:[e];return new u(n,t)}u.EMPTY=new u([],null);class l{constructor(e){this.p=[],this.v=[];for(let t=0;t<e;++t)this.p.push(0),this.v.push(null)}mergeTraces(e,t,n,r,o,a){let i=!1;return n.forEach(t,(t=>{const n=this.trace(t,r,o,a);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 o=null;const a=t[e];if(null!==a)o=a;else if(!n.has(e))throw new Error(`Trace without source at pc ${e}`);if(o=this.mergeTraces(o,e,n,t,n,r),null!==o){const t=r[e];null!==t&&(o=c(o,t))}return this.v[e]=o,this.p[e]=2,o}buildSurvivorTraces(e,t,n,r,o){for(let a=0,i=e.length;a<i;++a){if(!n.has(a)){t[a]=null;continue}this.v.fill(null),this.p.fill(0);const i=this.mergeTraces(null,a,n,e,r,o);if(null===i)throw new Error(`No non-cyclic paths found to survivor ${a}`);t[a]=c(i,null)}this.v.fill(null)}}class p{constructor(e){this.g=[],this.k=[],this.m=[],this.A=new i(e.maxFromByPc),this.T=new i(e.maxSurvivorFromByPc),this.S=new l(e.programLength);for(let t=0;t<e.programLength;++t)this.g.push(null),this.k.push(null),this.m.push(null);this.k[0]=u.EMPTY}reset(e){this.A.clear(),this.T.clear(),this.g.fill(null),e&&(this.k.fill(null),this.m.fill(null),this.k[0]=u.EMPTY)}record(e,t){this.g[e]=t}has(e){return this.A.has(e)||null!==this.k[e]}add(e,t){this.A.add(e,t)}hasSurvivor(e){return this.T.has(e)}addSurvivor(e,t){this.T.add(e,t)}buildSurvivorTraces(){const e=this.k;this.S.buildSurvivorTraces(e,this.m,this.T,this.A,this.g),this.k=this.m,this.m=e}getTraces(e){const t=e.reduce(((e,t)=>s(e,this.k[t])),null);return null===t?[]:Array.isArray(t)?t:[t]}}class h{constructor(e){this.I=[],this.N=new a(e.programLength),this.M=new a(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 o=this.N.getBadness(e)+n;r?this.N.reschedule(t,o):this.N.add(t,o)}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 a,i=-1;do{let o=n.getNextThreadPc();if(null===o)break;for(++i,a=i>=r?null:e[i];null!==o;){const e=this.G[o];switch(e.op){case 0:null===a?n.accept(o):n.fail(o);break;case 2:{const r=e.func;if(null===r||r(t)){n.fail(o);break}n.step(o,o+1,0);break}case 1:n.step(o,o+1,e.data);break;case 5:if(null===a){n.fail(o);break}if(!(0,e.func)(a,e.data,t)){n.fail(o);break}n.stepToNextGeneration(o,o+1);break;case 3:{const t=e.data,r=t.length;if(0===r){n.fail(o);break}for(let e=0;e<r;++e)n.step(o,t[e],0);break}case 4:{const r=(0,e.func)(e.data,i,t);null!=r&&n.record(o,r),n.step(o,o+1,0);break}}o=n.getNextThreadPc()}n.nextGeneration()}while(null!==a);const s=new o(n.getAcceptingTraces());return n.reset(),this.U.push(n),s}}function d(e){return t=>t===e}function m(e,t){if(null===e||null===t)throw new Error("unescaped hyphen may not be used as a range endpoint");if(t<e)throw new Error("character range is in the wrong order");return n=>e<=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 A(e,t.value,!1)}}function A(e,t,n){const r=e.program.length,o=e.jump([]);n&&(o.data.push(e.program.length),e.test((()=>!0)),e.jump([r]));const a=[];if(t.forEach((t=>{o.data.push(e.program.length),function(e,t){t.forEach((t=>{!function(e,t){const[n,{min:r,max:o}]=t;if(null!==o){for(let t=0;t<r;++t)w(e,n);for(let t=r;t<o;++t){const t=e.jump([]);t.data.push(e.program.length),w(e,n),t.data.push(e.program.length)}}else if(r>0){for(let t=0;t<r-1;++t)w(e,n);const t=e.program.length;w(e,n),e.jump([t]).data.push(e.program.length)}else{const t=e.program.length,r=e.jump([]);r.data.push(e.program.length),w(e,n),e.jump([t]),r.data.push(e.program.length)}}(e,t)}))}(e,t),a.push(e.jump([]))})),a.forEach((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 N(e){return(t,n)=>{const r=n+e.length;return t.slice(n,r)===e?x(r,e):E(n,[e])}}function B(e,t){return(n,r)=>{const o=e(n,r);return o.success?x(o.offset,t(o.value)):o}}function T(e,t,n){return(r,o)=>{const a=e(r,o);return a.success?t(a.value)?a:E(o,n):a.offset===o?E(o,n):a}}function I(e){return(t,n)=>{let r=null;for(const o of e){const e=o(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:x(n,null)}}function S(e){return(t,n)=>{let r=[],o=n;for(;;){const n=e(t,o);if(!n.success){if(n.fatal)return n;break}r.push(n.value),o=n.offset}return x(o,r)}}function O(e,t,n){return(r,o)=>{const a=e(r,o);if(!a.success)return a;const i=t(r,a.offset);return i.success?x(i.offset,n(a.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 k(e,t){return O(e,t,D)}function G(e,t,n,r=!1){return M(e,r?P(k(t,n)):k(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"]),_=["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 X(e){return e.codePointAt(0)}"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(((e,t)=>{j[e]=t}));const L=e=>-1===e||-2===e;function $(e){return t=>!L(t)&&!e(t)}function q(e,t){return null===t?e:n=>e(n)&&!t(n)}const Y=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,o)=>{const a=t[o];null!==e&&e.split("|").forEach((e=>{const t=n.get(e),o=m(r,r+a-1);n.set(e,t?v(t,o):o)})),r+=a})),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]),V=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=_.map((()=>[]));let o=0,a=0;for(;a<n.length;){const e=j[n[a]],t=(31&e)-2;let i=1+j[n[a+1]];switch(32&e?(i+=j[n[a+2]]<<6,i+=j[n[a+3]]<<12,i+=j[n[a+4]]<<18,a+=5):a+=2,t){case-2:{let e=0;for(let t=o;t<o+i;++t)r[e].push(d(t)),e=(e+1)%2;break}case-1:break;default:{const e=r[t];1===i?e.push(d(o)):e.push(m(o,o+i-1));break}}o+=i}const i=new Map;return _.forEach(((e,n)=>{const o=r[n].reduce(v,y);t.set(e,o);const a=e.charAt(0),s=i.get(a)||[];i.set(a,s),s.push(o)})),i.forEach(((e,n)=>{t.set(n,e.reduce(v,y))})),t}();function Q(e){return 32===e||9===e||10===e||13===e}const J=[d(X(":")),m(X("A"),X("Z")),d(X("_")),m(X("a"),X("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),K=[J,d(X("-")),d(X(".")),m(X("0"),X("9")),d(183),m(768,879),m(8255,8256)].reduce(v),z=V.get("Nd"),W=$(z),Z=q(m(0,1114111),[V.get("P"),V.get("Z"),V.get("C")].reduce(v)),ee=$(Z);function te(e){return 10!==e&&13!==e&&!L(e)}const ne={s:Q,S:$(Q),i:J,I:$(J),c:K,C:$(K),d:z,D:W,w:Z,W:ee},re=N("*"),oe=N("\\"),ae=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("-["),Ae=X("0");function xe(e){return[...e].map((e=>e.codePointAt(0)))}var be=Object.freeze({__proto__:null,compile:function(e,t={language:"xsd"}){const r=function(e){function t(e){return new Set(e.split("").map((e=>X(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(oe,I([B(N("n"),(()=>10)),B(N("r"),(()=>13)),B(N("t"),(()=>9)),B(I([oe,ge,me,he,ce,ve,re,ye,ae,ie,le,fe,de,se,ue]),(e=>X(e)))])):M(oe,I([B(N("n"),(()=>10)),B(N("r"),(()=>13)),B(N("t"),(()=>9)),B(I([oe,ge,me,he,ce,ve,re,ye,ae,ie,fe,de,se,ue]),(e=>X(e)))]));function o(e,r){const o=t(r);return O(N(e),C(T(n,(e=>o.has(e)),r.split(""))),((e,t)=>function(e){const t=V.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 a=I([o("L","ultmo"),o("M","nce"),o("N","dlo"),o("P","cdseifo"),o("Z","slp"),o("S","mcko"),o("C","cfon")]),i=[m(X("a"),X("z")),m(X("A"),X("Z")),m(X("0"),X("9")),d(45)].reduce(v),s=I([a,B(M(N("Is"),function(e){return(t,n)=>{const r=e(t,n);return r.success?x(r.offset,t.slice(n,r.offset)):r}}(R(T(n,i,["block identifier"])))),(t=>function(e,t){const n=Y.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=G(N("\\p{"),s,ie,!0),c=B(G(N("\\P{"),s,ie,!0),$),l=M(oe,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]),A=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?x(n,r.value):r}}(I([ue,we])),(()=>null)),_=X("-"),j=I([B(k(k(he,F(se,["not ["])),U),(()=>_)),M(F(he,["not -"]),y)]),L=I([O(B(j,d),I([function(e,t){return L(e,t)},U]),b),O(I([A,h]),I([J,U]),b)]),Q=I([O(B(y,d),I([L,U]),b),O(I([A,h]),I([J,U]),b)]);function J(e,t){return Q(e,t)}const K=B(Q,(e=>e.reduce(v))),z=B(M(ce,K),$),W=O(I([M(F(ce,["not ^"]),K),z]),C(M(he,(function(e,t){return Z(e,t)}))),q),Z=G(se,W,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]),xe="xpath"===e.language?t(".\\?*+{}()|^$[]"):t(".\\?*+{}()|[]"),be=T(n,(e=>!xe.has(e)),["NormalChar"]),Ee=B(M(oe,O(B(T(n,m(X("1"),X("9")),["digit"]),(e=>e-Ae)),S(B(T(n,m(Ae,X("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.")})),Ne="xpath"===e.language?I([B(be,(e=>({kind:"predicate",value:d(e)}))),B(ee,(e=>({kind:"predicate",value:e}))),B(G(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(G(fe,Oe,de,!0),(e=>({kind:"regexp",value:e})))]),Be=B(R(B(T(n,m(Ae,X("9")),["digit"]),(e=>e-Ae))),(e=>e.reduce(((e,t)=>10*e+t)))),Te=I([O(Be,M(pe,Be),((e,t)=>{if(t<e)throw new Error("quantifier range is in the wrong order");return{min:e,max:t}})),O(Be,pe,(e=>({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}))),G(ae,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}))),G(ae,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)}}(t)(e),o=function(e){const t=new n;return e(t),new f(t.program)}((e=>{A(e,r,"xpath"===t.language),e.accept()}));return function(e){const n="xpath"===t.language?[-1,...xe(e),-2]:xe(e);return o.execute(n).success}}});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 e>65535?2:1}function Ie(e,t){return(n,r)=>{const o=n.codePointAt(r);return void 0!==o&&e(o)?Ne(r+Te(o)):Be(r,t)}}function Ce(e,t){return(n,r)=>{const o=e(n,r);return o.success?Ee(o.offset,t(o.value)):o}}function Se(e){return(t,n)=>{let r=[],o=n;for(;;){const n=e(t,o);if(!n.success){if(n.fatal)return n;break}if(r.push(n.value),n.offset===o)break;o=n.offset}return Ee(o,r)}}function Oe(e){return(t,n)=>{let r=n;for(;;){const n=e(t,r);if(!n.success){if(n.fatal)return n;break}if(n.offset===r)break;r=n.offset}return Ne(r)}}function Re(e,t,n){return(r,o)=>{const a=e(r,o);if(!a.success)return a;const i=t(r,a.offset);return i.success?Ee(i.offset,n(a.value,i.value)):i}}function De(e,t){return e}function Ue(e,t){return t}function Me(e,t){return Re(e,t,Ue)}function ke(e,t){return Re(e,t,De)}function Ge(e,t){return(n,r)=>e(n,r).success?Be(r,t):Ne(r)}function Fe(e){return(t,n)=>{const r=e(t,n);return r.success?r:Be(r.offset,r.expected,!0)}}const Pe=(e,t)=>e.length===t?Ne(t):Be(t,["end of input"]);function He(e){const t=[];let n=e.next();for(;!n.done;)t.push(n.value),n=e.next();return[t,n.value]}var _e=Object.freeze({__proto__:null,codepoint:Ie,codepoints:function(e,t){return(n,r)=>{const o=r;for(;;){const t=n.codePointAt(r);if(void 0===t)break;if(!e(t))break;r+=t>65535?2:1}return void 0!==t&&r===o?Be(r,t):Ne(r)}},collect:He,complete:function(e){return Re(e,Pe,De)},consume:function(e){return Ce(e,(()=>{}))},cut:Fe,delimited:function(e,t,n,r=!1){return Me(e,r?Fe(ke(t,n)):ke(t,n))},end:Pe,error:Be,except:function(e,t,n){return Me(Ge(t,n),e)},filter:function(e,t,n){return(r,o)=>{const a=e(r,o);return a.success?t(a.value)?a:Be(o,n):a}},filterUndefined:function(e){return Ce(e,(e=>e.filter((e=>void 0!==e))))},first:De,followed:ke,map:Ce,not:Ge,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,t){return(n,r)=>{let o=null;for(const a of e){const e=a(n,r);if(e.success)return e;if(null===o||e.offset>o.offset?o=e:e.offset===o.offset&&void 0===t&&(o.expected=o.expected.concat(e.expected)),e.fatal)return e}return t=t||(null==o?void 0:o.expected)||[],o&&(o.expected=t),o||Be(r,t)}},peek:function(e){return(t,n)=>{const r=e(t,n);return r.success?Ee(n,r.value):r}},plus:function(e){return Re(e,Se(e),((e,t)=>[e].concat(t)))},plusConsumed:function(e){return Re(e,Oe(e),Ue)},preceded:Me,range:function(e,t,n){return Ie((n=>e<=n&&n<=t),n||[`${String.fromCodePoint(e)}-${String.fromCodePoint(t)}`])},recognize:function(e){return(t,n)=>{const r=e(t,n);return r.success?Ee(r.offset,t.slice(n,r.offset)):r}},second:Ue,skipChars:function(e){return(t,n)=>{let r=e;for(;r>0;){const e=t.codePointAt(n);if(void 0===e)return Be(n,["any character"]);n+=Te(e),r-=1}return Ne(n)}},star:Se,starConsumed:Oe,start:(e,t)=>0===t?Ne(t):Be(t,["start of input"]),streaming:function(e){return function*(t,n){const r=e(t,n);return r.success&&(yield r.value),r}},streamingComplete:function(e){return function*(t,n){const r=yield*e(t,n);return r.success?Pe(t,r.offset):r}},streamingFilterUndefined:function(e){return function*(t,n){const r=e(t,n);let o=r.next();for(;!o.done;){const e=o.value;void 0!==e&&(yield e),o=r.next()}return o.value}},streamingOptional:function(e){return function*(t,n){const[r,o]=He(e(t,n));return o.success?(yield*r,o):o.fatal?o:Ne(n)}},streamingStar:function(e){return function*(t,n){for(;;){const[r,o]=He(e(t,n));if(!o.success)return o.fatal?o:Ne(n);if(yield*r,n===o.offset)return Ne(n);n=o.offset}}},streamingThen:function(e,t){return function*(n,r){const o=yield*e(n,r);return o.success?yield*t(n,o.offset):o}},then:Re,token:function(e){return(t,n)=>{const r=n+e.length;return t.slice(n,r)===e?Ee(r,e):Be(n,[e])}}});const je=function(e,t){const n={};var r;function o(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}var a="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e};var i=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function s(e,t){if(t)e:{var n=i;e=e.split(".");for(var r=0;r<e.length-1;r++){var o=e[r];if(!(o in n))break e;n=n[o]}(t=t(r=n[e=e[e.length-1]]))!=r&&null!=t&&a(n,e,{configurable:!0,writable:!0,value:t})}}function u(e){return(e={next:e})[Symbol.iterator]=function(){return this},e}function c(e){var t="undefined"!=typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];return t?t.call(e):{next:o(e)}}function l(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function p(e){return e instanceof Array?e:l(c(e))}s("Symbol",(function(e){function t(e,t){this.h=e,a(this,"description",{configurable:!0,writable:!0,value:t})}if(e)return e;t.prototype.toString=function(){return this.h};var n="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",r=0;return function e(o){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new t(n+(o||"")+"_"+r++,o)}})),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;n<t.length;n++){var r=i[t[n]];"function"==typeof r&&"function"!=typeof r.prototype[e]&&a(r.prototype,e,{configurable:!0,writable:!0,value:function(){return u(o(this))}})}return e})),s("Symbol.asyncIterator",(function(e){return e||Symbol("Symbol.asyncIterator")}));var h,f="function"==typeof Object.create?Object.create:function(e){function t(){}return t.prototype=e,new t};if("function"==typeof Object.setPrototypeOf)h=Object.setPrototypeOf;else{var d;e:{var m={};try{m.__proto__={a:!0},d=m.a;break e}catch(e){}d=!1}h=d?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw new TypeError(e+" is not extensible");return e}:null}var g=h;function y(e,t){if(e.prototype=f(t.prototype),e.prototype.constructor=e,g)g(e,t);else for(var n in t)if("prototype"!=n)if(Object.defineProperties){var r=Object.getOwnPropertyDescriptor(t,n);r&&Object.defineProperty(e,n,r)}else e[n]=t[n];e.Nc=t.prototype}function v(){this.j=!1,this.s=null,this.u=void 0,this.h=1,this.ha=0,this.A=null}function w(e){if(e.j)throw new TypeError("Generator is already running");e.j=!0}function A(e,t){e.A={yc:t,Ac:!0},e.h=e.ha}function x(e){this.h=new v,this.s=e}function b(e,t,n,r){try{var o=t.call(e.h.s,n);if(!(o instanceof Object))throw new TypeError("Iterator result "+o+" is not an object");if(!o.done)return e.h.j=!1,o;var a=o.value}catch(t){return e.h.s=null,A(e.h,t),E(e)}return e.h.s=null,r.call(e.h,a),E(e)}function E(e){for(;e.h.h;)try{var t=e.s(e.h);if(t)return e.h.j=!1,{value:t.value,done:!1}}catch(t){e.h.u=void 0,A(e.h,t)}if(e.h.j=!1,e.h.A){if(t=e.h.A,e.h.A=null,t.Ac)throw t.yc;return{value:t.return,done:!0}}return{value:void 0,done:!0}}function N(e){this.next=function(t){return w(e.h),e.h.s?t=b(e,e.h.s.next,t,e.h.O):(e.h.O(t),t=E(e)),t},this.throw=function(t){return w(e.h),e.h.s?t=b(e,e.h.s.throw,t,e.h.O):(A(e.h,t),t=E(e)),t},this.return=function(t){return function(e,t){w(e.h);var n=e.h.s;return n?b(e,"return"in n?n.return:function(e){return{value:e,done:!0}},t,e.h.return):(e.h.return(t),E(e))}(e,t)},this[Symbol.iterator]=function(){return this}}function B(e,t){return Object.prototype.hasOwnProperty.call(e,t)}v.prototype.O=function(e){this.u=e},v.prototype.return=function(e){this.A={return:e},this.h=this.ha},s("Promise",(function(e){function t(e){this.s=0,this.A=void 0,this.h=[],this.ha=!1;var t=this.j();try{e(t.resolve,t.reject)}catch(e){t.reject(e)}}function n(){this.h=null}function r(e){return e instanceof t?e:new t((function(t){t(e)}))}if(e)return e;n.prototype.s=function(e){if(null==this.h){this.h=[];var t=this;this.A((function(){t.u()}))}this.h.push(e)};var o=i.setTimeout;n.prototype.A=function(e){o(e,0)},n.prototype.u=function(){for(;this.h&&this.h.length;){var e=this.h;this.h=[];for(var t=0;t<e.length;++t){var n=e[t];e[t]=null;try{n()}catch(e){this.j(e)}}}this.h=null},n.prototype.j=function(e){this.A((function(){throw e}))},t.prototype.j=function(){function e(e){return function(r){n||(n=!0,e.call(t,r))}}var t=this,n=!1;return{resolve:e(this.na),reject:e(this.u)}},t.prototype.na=function(e){if(e===this)this.u(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof t)this.ua(e);else{e:switch(typeof e){case"object":var n=null!=e;break e;case"function":n=!0;break e;default:n=!1}n?this.ka(e):this.O(e)}},t.prototype.ka=function(e){var t=void 0;try{t=e.then}catch(e){return void this.u(e)}"function"==typeof t?this.mb(t,e):this.O(e)},t.prototype.u=function(e){this.B(2,e)},t.prototype.O=function(e){this.B(1,e)},t.prototype.B=function(e,t){if(0!=this.s)throw Error("Cannot settle("+e+", "+t+"): Promise already settled in state"+this.s);this.s=e,this.A=t,2===this.s&&this.Ya(),this.J()},t.prototype.Ya=function(){var e=this;o((function(){if(e.T()){var t=i.console;void 0!==t&&t.error(e.A)}}),1)},t.prototype.T=function(){if(this.ha)return!1;var e=i.CustomEvent,t=i.Event,n=i.dispatchEvent;return void 0===n||("function"==typeof e?e=new e("unhandledrejection",{cancelable:!0}):"function"==typeof t?e=new t("unhandledrejection",{cancelable:!0}):(e=i.document.createEvent("CustomEvent")).initCustomEvent("unhandledrejection",!1,!0,e),e.promise=this,e.reason=this.A,n(e))},t.prototype.J=function(){if(null!=this.h){for(var e=0;e<this.h.length;++e)a.s(this.h[e]);this.h=null}};var a=new n;return t.prototype.ua=function(e){var t=this.j();e.nb(t.resolve,t.reject)},t.prototype.mb=function(e,t){var n=this.j();try{e.call(t,n.resolve,n.reject)}catch(e){n.reject(e)}},t.prototype.then=function(e,n){function r(e,t){return"function"==typeof e?function(t){try{o(e(t))}catch(e){a(e)}}:t}var o,a,i=new t((function(e,t){o=e,a=t}));return this.nb(r(e,o),r(n,a)),i},t.prototype.catch=function(e){return this.then(void 0,e)},t.prototype.nb=function(e,t){function n(){switch(r.s){case 1:e(r.A);break;case 2:t(r.A);break;default:throw Error("Unexpected state: "+r.s)}}var r=this;null==this.h?a.s(n):this.h.push(n),this.ha=!0},t.resolve=r,t.reject=function(e){return new t((function(t,n){n(e)}))},t.race=function(e){return new t((function(t,n){for(var o=c(e),a=o.next();!a.done;a=o.next())r(a.value).nb(t,n)}))},t.all=function(e){var n=c(e),o=n.next();return o.done?r([]):new t((function(e,t){function a(t){return function(n){i[t]=n,0==--s&&e(i)}}var i=[],s=0;do{i.push(void 0),s++,r(o.value).nb(a(i.length-1),t),o=n.next()}while(!o.done)}))},t}));var T="function"==typeof Object.assign?Object.assign:function(e,t){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r)for(var o in r)B(r,o)&&(e[o]=r[o])}return e};function I(e,t,n){if(null==e)throw new TypeError("The 'this' value for String.prototype."+n+" must not be null or undefined");if(t instanceof RegExp)throw new TypeError("First argument to String.prototype."+n+" must not be a regular expression");return e+""}function C(e,t){return e=void 0!==e?String(e):" ",0<t&&e?e.repeat(Math.ceil(t/e.length)).substring(0,t):""}function S(e,t,n){e instanceof String&&(e=String(e));for(var r=e.length,o=0;o<r;o++){var a=e[o];if(t.call(n,a,o,e))return{Fb:o,Mb:a}}return{Fb:-1,Mb:void 0}}function O(e){return e||Array.prototype.fill}function R(e,t){e instanceof String&&(e+="");var n=0,r=!1,o={next:function(){if(!r&&n<e.length){var o=n++;return{value:t(o,e[o]),done:!1}}return r=!0,{done:!0,value:void 0}}};return o[Symbol.iterator]=function(){return o},o}function D(e,t){if(!("0"!==e&&"-0"!==e||"0"!==t&&"-0"!==t))return 0;var n=/(?:\+|(-))?(\d+)?(?:\.(\d+))?/;e=n.exec(e+"");var r=n.exec(t+""),o=!e[1],a=!r[1];return t=(e[2]||"").replace(/^0*/,""),n=(r[2]||"").replace(/^0*/,""),e=e[3]||"",r=r[3]||"",o&&!a?1:!o&&a?-1:(o=o&&a,t.length>n.length?o?1:-1:t.length<n.length?o?-1:1:t>n?o?1:-1:t<n?o?-1:1:(t=Math.max(e.length,r.length),(n=e.padEnd(t,"0"))>(t=r.padEnd(t,"0"))?o?1:-1:n<t?o?-1:1:0))}function U(e,t){return!(-1<(e=e.toString()).indexOf(".")&&0===t)&&(!(e=/^[-+]?0*([1-9]\d*)?(?:\.((?:\d*[1-9])*)0*)?$/.exec(e))[2]||e[2].length<=t)}function M(e,t){switch(t){case"required":return/(Z)|([+-])([01]\d):([0-5]\d)$/.test(e.toString());case"prohibited":return!/(Z)|([+-])([01]\d):([0-5]\d)$/.test(e.toString());case"optional":return!0}}function k(e){switch(e){case 1:case 0:case 6:case 3:case 18:case 22:case 21:case 20:case 23:case 44:return{};case 4:return{ma:U,ra:function(e,t){return 1>D(e,t)},Lc:function(e,t){return 0>D(e,t)},sa:function(e,t){return-1<D(e,t)},Mc:function(e,t){return 0<D(e,t)}};case 9:case 8:case 7:case 11:case 12:case 13:case 15:case 14:return{wa:M};default:return null}}s("Object.assign",(function(e){return e||T})),s("String.prototype.repeat",(function(e){return e||function(e){var t=I(this,null,"repeat");if(0>e||1342177279<e)throw new RangeError("Invalid count value");e|=0;for(var n="";e;)1&e&&(n+=t),(e>>>=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 o(e){if(!B(e,s)){var t=new n;a(e,s,{value:t})}}function i(e){var t=Object[e];t&&(Object[e]=function(e){return e instanceof n?e:(Object.isExtensible(e)&&o(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(o(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?a.has(t)?n=a.get(t):(n=""+ ++i,a.set(t,n)):n="p_"+t;var r=e.s[n];if(r&&B(e.s,n))for(e=0;e<r.length;e++){var o=r[e];if(t!=t&&o.key!=o.key||t===o.key)return{id:n,list:r,index:e,ja:o}}return{id:n,list:r,index:-1,ja:void 0}}function o(e){if(this.s={},this.h=t(),this.size=0,e){e=c(e);for(var n;!(n=e.next()).done;)n=n.value,this.set(n[0],n[1])}}if(function(){if(!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var t=Object.seal({x:4}),n=new e(c([[t,"s"]]));if("s"!=n.get(t)||1!=n.size||n.get({x:4})||n.set({x:4},"t")!=n||2!=n.size)return!1;var r=n.entries(),o=r.next();return!o.done&&o.value[0]==t&&"s"==o.value[1]&&!((o=r.next()).done||4!=o.value[0].x||"t"!=o.value[1]||!r.next().done)}catch(e){return!1}}())return e;var a=new WeakMap;o.prototype.set=function(e,t){var n=r(this,e=0===e?0:e);return n.list||(n.list=this.s[n.id]=[]),n.ja?n.ja.value=t:(n.ja={next:this.h,Ba:this.h.Ba,head:this.h,key:e,value:t},n.list.push(n.ja),this.h.Ba.next=n.ja,this.h.Ba=n.ja,this.size++),this},o.prototype.delete=function(e){return!(!(e=r(this,e)).ja||!e.list)&&(e.list.splice(e.index,1),e.list.length||delete this.s[e.id],e.ja.Ba.next=e.ja.next,e.ja.next.Ba=e.ja.Ba,e.ja.head=null,this.size--,!0)},o.prototype.clear=function(){this.s={},this.h=this.h.Ba=t(),this.size=0},o.prototype.has=function(e){return!!r(this,e).ja},o.prototype.get=function(e){return(e=r(this,e).ja)&&e.value},o.prototype.entries=function(){return n(this,(function(e){return[e.key,e.value]}))},o.prototype.keys=function(){return n(this,(function(e){return e.key}))},o.prototype.values=function(){return n(this,(function(e){return e.value}))},o.prototype.forEach=function(e,t){for(var n,r=this.entries();!(n=r.next()).done;)n=n.value,e.call(t,n[1],n[0],this)},o.prototype[Symbol.iterator]=o.prototype.entries;var i=0;return o})),s("Array.prototype.find",(function(e){return e||function(e,t){return S(this,e,t).Mb}})),s("String.prototype.startsWith",(function(e){return e||function(e,t){var n=I(this,e,"startsWith"),r=n.length,o=e.length;t=Math.max(0,Math.min(0|t,n.length));for(var a=0;a<o&&t<r;)if(n[t++]!=e[a++])return!1;return a>=o}})),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<n;t++)this[t]=e;return this}})),s("Int8Array.prototype.fill",O),s("Uint8Array.prototype.fill",O),s("Uint8ClampedArray.prototype.fill",O),s("Int16Array.prototype.fill",O),s("Uint16Array.prototype.fill",O),s("Int32Array.prototype.fill",O),s("Uint32Array.prototype.fill",O),s("Float32Array.prototype.fill",O),s("Float64Array.prototype.fill",O),s("Array.from",(function(e){return e||function(e,t,n){t=null!=t?t:function(e){return e};var r=[],o="undefined"!=typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];if("function"==typeof o){e=o.call(e);for(var a=0;!(o=e.next()).done;)r.push(t.call(n,o.value,a++))}else for(o=e.length,a=0;a<o;a++)r.push(t.call(n,e[a],a));return r}})),s("Object.is",(function(e){return e||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}})),s("Array.prototype.includes",(function(e){return e||function(e,t){var n=this;n instanceof String&&(n=String(n));var r=n.length;for(0>(t=t||0)&&(t=Math.max(t+r,0));t<r;t++){var o=n[t];if(o===e||Object.is(o,e))return!0}return!1}})),s("String.prototype.includes",(function(e){return e||function(e,t){return-1!==I(this,e,"includes").indexOf(e,t||0)}})),s("Number.MAX_SAFE_INTEGER",(function(){return 9007199254740991})),s("Number.MIN_SAFE_INTEGER",(function(){return-9007199254740991})),s("Math.trunc",(function(e){return e||function(e){if(e=Number(e),isNaN(e)||1/0===e||-1/0===e||0===e)return e;var t=Math.floor(Math.abs(e));return 0>e?-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&&0<t;)if(n[--t]!=e[--r])return!1;return 0>=r}})),s("String.fromCodePoint",(function(e){return e||function(e){for(var t="",n=0;n<arguments.length;n++){var r=Number(arguments[n]);if(0>r||1114111<r||r!==Math.floor(r))throw new RangeError("invalid_code_point "+r);65535>=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)&&e<n){e|=0;var r=t.charCodeAt(e);return 55296>r||56319<r||e+1===n||(56320>(e=t.charCodeAt(e+1))||57343<e)?r:1024*(r-55296)+e+9216}}})),s("Set",(function(e){function t(e){if(this.h=new Map,e){e=c(e);for(var t;!(t=e.next()).done;)this.add(t.value)}this.size=this.h.size}return function(){if(!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var t=Object.seal({x:4}),n=new e(c([t]));if(!n.has(t)||1!=n.size||n.add(t)!=n||1!=n.size||n.add({x:4})!=n||2!=n.size)return!1;var r=n.entries(),o=r.next();return!o.done&&o.value[0]==t&&o.value[1]==t&&(!(o=r.next()).done&&o.value[0]!=t&&4==o.value[0].x&&o.value[1]==o.value[0]&&r.next().done)}catch(e){return!1}}()?e:(t.prototype.add=function(e){return e=0===e?0:e,this.h.set(e,e),this.size=this.h.size,this},t.prototype.delete=function(e){return e=this.h.delete(e),this.size=this.h.size,e},t.prototype.clear=function(){this.h.clear(),this.size=0},t.prototype.has=function(e){return this.h.has(e)},t.prototype.entries=function(){return this.h.entries()},t.prototype.values=function(){return this.h.values()},t.prototype.keys=t.prototype.values,t.prototype[Symbol.iterator]=t.prototype.values,t.prototype.forEach=function(e,t){var n=this;this.h.forEach((function(r){return e.call(t,r,r,n)}))},t)})),s("Math.log10",(function(e){return e||function(e){return Math.log(e)/Math.LN10}})),s("Object.values",(function(e){return e||function(e){var t,n=[];for(t in e)B(e,t)&&n.push(e[t]);return n}})),s("Number.isNaN",(function(e){return e||function(e){return"number"==typeof e&&isNaN(e)}})),s("Array.prototype.values",(function(e){return e||function(){return R(this,(function(e,t){return t}))}})),s("Object.getOwnPropertySymbols",(function(e){return e||function(){return[]}}));var G={},F={};function P(e){return/^([+-]?(\d*(\.\d*)?([eE][+-]?\d*)?|INF)|NaN)$/.test(e)}function H(e){return/^[_:A-Za-z][-._:A-Za-z0-9]*$/.test(e)}function _(e){return H(e)&&/^[_A-Za-z]([-._A-Za-z0-9])*$/.test(e)}function j(e){return 1===(e=e.split(":")).length?_(e[0]):2===e.length&&(_(e[0])&&_(e[1]))}function X(e){return!/[\u0009\u000A\u000D]/.test(e)}function L(e){return _(e)}var $=new Map([[45,function(){return!0}],[46,function(){return!0}],[1,function(){return!0}],[0,function(e){return/^(0|1|true|false)$/.test(e)}],[6,function(e){return P(e)}],[3,P],[4,function(e){return/^[+-]?\d*(\.\d*)?$/.test(e)}],[18,function(e){return/^(-)?P(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+(\.\d*)?S)?)?$/.test(e)}],[9,function(e){return/^-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[8,function(e){return/^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[7,function(e){return/^-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[11,function(e){return/^-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[12,function(e){return/^-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[13,function(e){return/^--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[15,function(e){return/^---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[14,function(e){return/^--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[22,function(e){return/^([0-9A-Fa-f]{2})*$/.test(e)}],[21,function(e){return new RegExp(/^((([A-Za-z0-9+/] ?){4})*((([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/])|(([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=)|(([A-Za-z0-9+/] ?)[AQgw] ?= ?=)))?$/).test(e)}],[20,function(){return!0}],[44,j],[48,X],[52,function(e){return X(e)&&!/^ | {2,}| $/.test(e)}],[51,function(e){return/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/.test(e)}],[50,function(e){return/^[-._:A-Za-z0-9]+$/.test(e)}],[25,H],[23,j],[24,_],[42,L],[41,L],[26,function(e){return _(e)}],[5,function(e){return/^[+-]?\d+$/.test(e)}],[16,function(e){return/^-?P[0-9]+(Y([0-9]+M)?|M)$/.test(e)}],[17,function(e){return/^-?P([0-9]+D)?(T([0-9]+H)?([0-9]+M)?([0-9]+(\.[0-9]+)?S)?)?$/.test(e)}]]),q=Object.create(null);function Y(e,t){if(!q[t])throw Error("Unknown type");return{type:t,value:e}}[{D:0,name:59},{D:0,name:46,parent:59,K:{whiteSpace:"preserve"}},{D:0,name:19,parent:46},{D:0,name:1,parent:46},{D:0,name:0,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:4,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:6,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:3,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:18,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:9,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:8,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:7,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:11,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:12,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:13,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:15,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:14,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:22,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:21,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:20,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:23,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:44,parent:46,K:{whiteSpace:"collapse"}},{D:1,name:10,U:9,K:{whiteSpace:"collapse",wa:"required"}},{D:1,name:48,U:1,K:{whiteSpace:"replace"}},{D:1,name:52,U:48,K:{whiteSpace:"collapse"}},{D:1,name:51,U:52,K:{whiteSpace:"collapse"}},{D:1,name:50,U:52,K:{whiteSpace:"collapse"}},{D:2,name:49,type:50,K:{minLength:1,whiteSpace:"collapse"}},{D:1,name:25,U:52,K:{whiteSpace:"collapse"}},{D:1,name:24,U:25,K:{whiteSpace:"collapse"}},{D:1,name:42,U:24,K:{whiteSpace:"collapse"}},{D:1,name:41,U:24,K:{whiteSpace:"collapse"}},{D:2,name:43,type:41,K:{minLength:1,whiteSpace:"collapse"}},{D:1,name:26,U:24,K:{whiteSpace:"collapse"}},{D:2,name:40,type:26,K:{minLength:1,whiteSpace:"collapse"}},{D:0,name:5,parent:4,K:{ma:0,whiteSpace:"collapse"}},{D:1,name:27,U:5,K:{ma:0,ra:"0",whiteSpace:"collapse"}},{D:1,name:28,U:27,K:{ma:0,ra:"-1",whiteSpace:"collapse"}},{D:1,name:31,U:5,K:{ma:0,ra:"9223372036854775807",sa:"-9223372036854775808",whiteSpace:"collapse"}},{D:1,name:32,U:31,K:{ma:0,ra:"2147483647",sa:"-2147483648",whiteSpace:"collapse"}},{D:1,name:33,U:32,K:{ma:0,ra:"32767",sa:"-32768",whiteSpace:"collapse"}},{D:1,name:34,U:33,K:{ma:0,ra:"127",sa:"-128",whiteSpace:"collapse"}},{D:1,name:30,U:5,K:{ma:0,sa:"0",whiteSpace:"collapse"}},{D:1,name:36,U:30,K:{ma:0,ra:"18446744073709551615",sa:"0",whiteSpace:"collapse"}},{D:1,name:35,U:36,K:{ma:0,ra:"4294967295",sa:"0",whiteSpace:"collapse"}},{D:1,name:38,U:35,K:{ma:0,ra:"65535",sa:"0",whiteSpace:"collapse"}},{D:1,name:37,U:38,K:{ma:0,ra:"255",sa:"0",whiteSpace:"collapse"}},{D:1,name:29,U:30,K:{ma:0,sa:"1",whiteSpace:"collapse"}},{D:1,name:16,U:18,K:{whiteSpace:"collapse"}},{D:1,name:17,U:18,K:{whiteSpace:"collapse"}},{D:1,name:60,U:59},{D:3,name:39,Aa:[]},{D:1,name:61,U:60},{D:1,name:62,U:60},{D:0,name:53,parent:59},{D:1,name:54,U:53},{D:1,name:58,U:53},{D:1,name:47,U:53},{D:1,name:56,U:53},{D:1,name:57,U:53},{D:1,name:55,U:53},{D:3,name:2,Aa:[4,5,6,3]},{D:3,name:63,Aa:[]}].forEach((function(e){var t=e.name,n=e.K||{};switch(e.D){case 0:e=e.parent?q[e.parent]:null;var r=$.get(t)||null;q[t]={D:0,type:t,Ia:n,parent:e,fb:r,La:k(t),Aa:[]};break;case 1:e=q[e.U],r=$.get(t)||null,q[t]={D:1,type:t,Ia:n,parent:e,fb:r,La:e.La,Aa:[]};break;case 2:q[t]={D:2,type:t,Ia:n,parent:q[e.type],fb:null,La:G,Aa:[]};break;case 3:e=e.Aa.map((function(e){return q[e]})),q[t]={D:3,type:t,Ia:n,parent:null,fb:null,La:F,Aa:e}}}));var V=Y(!0,0),Q=Y(!1,0);function J(){return Error("FORG0006: A wrong argument type was specified in a function call.")}function K(e,t){this.done=e,this.value=t}var z=new K(!0,void 0);function W(e){return new K(!1,e)}function Z(e,t){if(3===t.D)return!!t.Aa.find((function(t){return Z(e,t)}));for(;e;){if(e.type===t.type)return!0;if(3===e.D)return!!e.Aa.find((function(e){return ee(e.type,t.type)}));e=e.parent}return!1}function ee(e,t){return e===t||Z(q[e],q[t])}function te(e){this.s=ce,this.h=e;var t=-1;this.value={next:function(){return++t>=e.length?z:W(e[t])}}}function ne(){this.value={next:function(){return z}}}function re(e){var t=e.value;if(ee(e.type,53))return!0;if(ee(e.type,0))return t;if(ee(e.type,1)||ee(e.type,20)||ee(e.type,19))return 0!==t.length;if(ee(e.type,2))return!isNaN(t)&&0!==t;throw J()}function oe(e,t){var n=this;this.j=ce,this.value={next:function(t){return null!==n.s&&n.h>=n.s?z:void 0!==n.A[n.h]?W(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 ie(e){this.A=ce,this.h=e;var t=!1;this.value={next:function(){return t?z:(t=!0,W(e))}},this.s=null}(r=te.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&&!e(t.h[n],n,t);)n++;return n>=t.h.length?z:W(t.h[n])}})},r.first=function(){return this.h[0]},r.M=function(){return this.h},r.getEffectiveBooleanValue=function(){if(ee(this.h[0].type,53))return!0;throw J()},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?z: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=ne.prototype).ob=function(){return this},r.filter=function(){return this},r.first=function(){return null},r.M=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=oe.prototype).ob=function(){return this.j.create(this.M())},r.filter=function(e){var t=this,n=-1,r=this.value;return this.j.create({next:function(o){for(n++,o=r.next(o);!o.done&&!e(o.value,n,t);)n++,o=r.next(0);return o}})},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.M=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(ee((n=n.value).type,53))return ae(this,t),!0;if(!e.next(0).done)throw J();return ae(this,t),re(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.M().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(o){return(o=r.next(o)).done?z:W(e(o.value,n++,t))}},this.s)},r.L=function(e,t){var n,r=this.value,o=[],a=!0;return function(){for(var i=r.next(a?0:t);!i.done;i=r.next(t))a=!1,o.push(i.value);n=e(o).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(o){return r?r.next(o):n.G()?(t(e.empty?e.empty(n):e.default(n)),r.next(o)):n.ya()?(t(e.o?e.o(n):e.default(n)),r.next(o)):(t(e.multiple?e.multiple(n):e.default(n)),r.next(o))}})},(r=ie.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.M=function(){return[this.h]},r.getEffectiveBooleanValue=function(){return null===this.s&&(this.s=re(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 se=new ne;function ue(e,t){if(null===(e=void 0===e?null:e))return se;if(Array.isArray(e))switch(e.length){case 0:return se;case 1:return new ie(e[0]);default:return new te(e)}return e.next?new oe(e,void 0===t?null:t):new ie(e)}var ce={create:ue,o:function(e){return new ie(e)},empty:function(){return ue()},ca:function(){return ue(V)},X:function(){return ue(Q)}};function le(e){var t=[],n=e.value;return function(){var e=0;return ce.create({next:function(){if(void 0!==t[e])return t[e++];var r=n.next(0);return r.done?r:t[e++]=r}})}}function pe(e,t){this.type=e,this.value=t}var he={},fe=(he[0]="xs:boolean",he[1]="xs:string",he[2]="xs:numeric",he[3]="xs:double",he[4]="xs:decimal",he[5]="xs:integer",he[6]="xs:float",he[7]="xs:date",he[8]="xs:time",he[9]="xs:dateTime",he[10]="xs:dateTimeStamp",he[11]="xs:gYearMonth",he[12]="xs:gYear",he[13]="xs:gMonthDay",he[14]="xs:gMonth",he[15]="xs:gDay",he[16]="xs:yearMonthDuration",he[17]="xs:dayTimeDuration",he[18]="xs:duration",he[19]="xs:untypedAtomic",he[20]="xs:anyURI",he[21]="xs:base64Binary",he[22]="xs:hexBinary",he[23]="xs:QName",he[24]="xs:NCName",he[25]="xs:Name",he[26]="xs:ENTITY",he[27]="xs:nonPositiveInteger",he[28]="xs:negativeInteger",he[29]="xs:positiveInteger",he[30]="xs:nonNegativeInteger",he[31]="xs:long",he[32]="xs:int",he[33]="xs:short",he[34]="xs:byte",he[35]="xs:unsignedInt",he[36]="xs:unsignedLong",he[37]="xs:unsignedByte",he[38]="xs:unsignedShort",he[39]="xs:error",he[40]="xs:ENTITIES",he[41]="xs:IDREF",he[42]="xs:ID",he[43]="xs:IDREFS",he[44]="xs:NOTATION",he[45]="xs:anySimpleType",he[46]="xs:anyAtomicType",he[47]="attribute()",he[48]="xs:normalizedString",he[49]="xs:NMTOKENS",he[50]="xs:NMTOKEN",he[51]="xs:language",he[52]="xs:token",he[53]="node()",he[54]="element()",he[55]="document-node()",he[56]="text()",he[57]="processing-instruction()",he[58]="comment()",he[59]="item()",he[60]="function(*)",he[61]="map(*)",he[62]="array(*)",he[63]="none",he),de={"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 me(e){return 2===e.g?fe[e.type]+"*":1===e.g?fe[e.type]+"+":0===e.g?fe[e.type]+"?":fe[e.type]}function ge(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=de[e];if(void 0===t)throw Error('XPST0051: The type "'+e+'" could not be found');return t}function ye(e){switch(e[e.length-1]){case"*":return{type:ge(e.substr(0,e.length-1)),g:2};case"?":return{type:ge(e.substr(0,e.length-1)),g:0};case"+":return{type:ge(e.substr(0,e.length-1)),g:1};default:return{type:ge(e),g:3}}}function ve(e,t,n){this.namespaceURI=t||null,this.prefix=e||"",this.localName=n}function we(e){var t=e.l,n=e.arity,r=void 0!==e.Pa&&e.Pa,o=void 0!==e.I&&e.I,a=e.localName,i=e.namespaceURI,s=e.i;for(e=e.value,pe.call(this,60,null),this.value=e,this.I=o,o=-1,e=0;e<t.length;e++)4===t[e]&&(o=e);-1<o&&(e=Array(n-(t.length-1)).fill(t[o-1]),t=t.slice(0,o).concat(e)),this.s=t,this.A=n,this.ha=r,this.j=a,this.u=i,this.O=s}function Ae(e,t){var n=[];return 2!==e&&1!==e||n.push("type-1-or-type-2"),n.push("type-"+e),t&&n.push("name-"+t),n}function xe(e){var t=e.node.nodeType;if(2===t||1===t)var n=e.node.localName;return Ae(t,n)}function be(e){var t=e.nodeType;if(2===t||1===t)var n=e.localName;return Ae(t,n)}function Ee(){}function Ne(){}ve.prototype.va=function(){return this.prefix?this.prefix+":"+this.localName:this.localName},y(we,pe),we.prototype.Pa=function(){return this.ha},Ee.prototype.getAllAttributes=function(e,t){return t=void 0===t?null:t,1!==e.nodeType?[]:(e=Array.from(e.attributes),null===t?e:e.filter((function(e){return be(e).includes(t)})))},Ee.prototype.getAttribute=function(e,t){return 1!==e.nodeType?null:e.getAttribute(t)},Ee.prototype.getChildNodes=function(e,t){return t=void 0===t?null:t,e=Array.from(e.childNodes),null===t?e:e.filter((function(e){return be(e).includes(t)}))},Ee.prototype.getData=function(e){return 2===e.nodeType?e.value:e.data},Ee.prototype.getFirstChild=function(e,t){for(t=void 0===t?null:t,e=e.firstChild;e;e=e.nextSibling)if(null===t||be(e).includes(t))return e;return null},Ee.prototype.getLastChild=function(e,t){for(t=void 0===t?null:t,e=e.lastChild;e;e=e.previousSibling)if(null===t||be(e).includes(t))return e;return null},Ee.prototype.getNextSibling=function(e,t){for(t=void 0===t?null:t,e=e.nextSibling;e;e=e.nextSibling)if(null===t||be(e).includes(t))return e;return null},Ee.prototype.getParentNode=function(e,t){return t=void 0===t?null:t,(e=2===e.nodeType?e.ownerElement:e.parentNode)&&(null===t||be(e).includes(t))?e:null},Ee.prototype.getPreviousSibling=function(e,t){for(t=void 0===t?null:t,e=e.previousSibling;e;e=e.previousSibling)if(null===t||be(e).includes(t))return e;return null},(r=Ne.prototype).insertBefore=function(e,t,n){return e.insertBefore(t,n)},r.removeAttributeNS=function(e,t,n){return e.removeAttributeNS(t,n)},r.removeChild=function(e,t){return e.removeChild(t)},r.setAttributeNS=function(e,t,n,r){e.setAttributeNS(t,n,r)},r.setData=function(e,t){e.data=t};var Be=new Ne;function Te(e){this.h=e}function Ie(e){return void 0!==e.Qa}function Ce(e,t,n){var r=null;return t&&(Ie(t.node)?r={F:t.F,offset:n,parent:t.node}:t.F&&(r=t.F)),{node:e,F:r}}function Se(e){this.h=e,this.s=[]}function Oe(e,t,n){return e.getAllAttributes(t.node,void 0===n?null:n).map((function(e){return Ce(e,t,e.nodeName)}))}function Re(e,t,n){return Ie(t=t.node)?(e=t.attributes.find((function(e){return n===e.name})))?e.value:null:(e=e.h.getAttribute(t,n))?e:null}function De(e,t,n){return e.getChildNodes(t.node,void 0===n?null:n).map((function(e,n){return Ce(e,t,n)}))}function Ue(e,t){return e.getData(t.node)}function Me(e,t,n){var r=t.node;return Ie(r)?e=r.childNodes[0]:((n=e.h.getFirstChild(r,void 0===n?null:n))&&10===n.nodeType&&(n=e.h.getNextSibling(n)),e=n),e?Ce(e,t,0):null}function ke(e,t,n){n=void 0===n?null:n;var r=t.node;return Ie(r)?(e=r.childNodes.length-1,r=r.childNodes[e]):((r=e.h.getLastChild(r,n))&&10===r.nodeType&&(r=e.h.getPreviousSibling(r)),e=e.getChildNodes(t.node,n).length-1),r?Ce(r,t,e):null}function Ge(e,t,n){n=void 0===n?null:n;var r=t.node,o=t.F;if(Ie(r)){if(o)var a=o.offset+1,i=o.parent.childNodes[a]}else{if(!o){for(i=r;i&&(!(i=e.h.getNextSibling(i,n))||10===i.nodeType););return i?{node:i,F:null}:null}a=o.offset+1;var s=Fe(e,t,null);i=e.getChildNodes(s.node,n)[a]}return i?Ce(i,s||Fe(e,t,n),a):null}function Fe(e,t,n){n=void 0===n?null:n;var r=t.node,o=t.F;if(o)"number"==typeof o.offset&&r===o.parent.childNodes[o.offset]||"string"==typeof o.offset&&r===o.parent.attributes.find((function(e){return o.offset===e.nodeName}))?(e=o.parent,t=o.F):(e=e.getParentNode(r,n),t=o);else{if(Ie(r))return null;e=e.getParentNode(r,n),t=null}return e?{node:e,F:t}:null}function Pe(e,t,n){n=void 0===n?null:n;var r=t.node,o=t.F;if(Ie(r)){if(o)var a=o.offset-1,i=o.parent.childNodes[a]}else{if(!o){for(i=r;i&&(!(i=e.h.getPreviousSibling(i,n))||10===i.nodeType););return i?{node:i,F:null}:null}a=o.offset-1;var s=Fe(e,t,null);i=e.getChildNodes(s.node,n)[a]}return i?Ce(i,s||Fe(e,t,n),a):null}function He(e,t,n,r,o){return o.L((function(e){var t=c(e).next().value;return r.L((function(e){e=c(e).next().value;var n=t.value;if(0>=n||n>e.R.length)throw Error("FOAY0001: array position out of bounds.");return e.R[n-1]()}))}))}function _e(e){we.call(this,{value:function(e,n,r,o){return He(0,0,0,ce.o(t),o)},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 Le(e,t){return e=e.map((function(e){return e.first()})),t(e)}function $e(e,t){var n=ee(e.type,1)||ee(e.type,20)||ee(e.type,19),r=ee(t.type,1)||ee(t.type,20)||ee(t.type,19);return n&&r?e.value===t.value:(n=ee(e.type,4)||ee(e.type,3)||ee(e.type,6),r=ee(t.type,4)||ee(t.type,3)||ee(t.type,6),n&&r?!(!isNaN(e.value)||!isNaN(t.value))||e.value===t.value:(n=ee(e.type,0)||ee(e.type,22)||ee(e.type,18)||ee(e.type,23)||ee(e.type,44),r=ee(t.type,0)||ee(t.type,22)||ee(t.type,18)||ee(t.type,23)||ee(t.type,44),!(!n||!r)&&e.value===t.value))}function qe(e,t,n,r,o){return Le([r,o],(function(e){var t=(e=c(e)).next().value,n=e.next().value;return(e=t.h.find((function(e){return $e(e.key,n)})))?e.value():ce.empty()}))}function Ye(e){we.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,o){return qe(0,0,0,ce.o(t),o)},i:{type:59,g:2}});var t=this;this.type=61,this.h=e}function Ve(){}function Qe(e,t){return e.ab()===t.ab()&&e.bb()===t.bb()}function Je(e){if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)throw Error("FODT0002: Number of seconds given to construct DayTimeDuration overflows MAX_SAFE_INTEGER or MIN_SAFE_INTEGER");this.ea=e}function Ke(e){var t=Math.abs(e.Za()),n=Math.abs(e.getHours()),r=Math.abs(e.getMinutes());return n=(n?n+"H":"")+(r?r+"M":"")+((e=Math.abs(e.getSeconds()))?e+"S":""),(t=t?t+"D":"")&&n?t+"T"+n:t||(n?"T"+n:"T0S")}function ze(e,t,n,r,o,a){return e=86400*e+3600*t+60*n+r+o,new Je(a||0===e?e:-e)}function We(e){return(e=/^(-)?P(\d+Y)?(\d+M)?(\d+D)?(?:T(\d+H)?(\d+M)?(\d+(\.\d*)?S)?)?$/.exec(e))?ze(e[4]?parseInt(e[4],10):0,e[5]?parseInt(e[5],10):0,e[6]?parseInt(e[6],10):0,e[7]?parseInt(e[7],10):0,e[8]?parseFloat(e[8]):0,!e[1]):null}function Ze(e){return"Z"===(e=/^(Z)|([+-])([01]\d):([0-5]\d)$/.exec(e))[1]?ze(0,0,0,0,0,!0):ze(0,e[3]?parseInt(e[3],10):0,e[4]?parseInt(e[4],10):0,0,0,"+"===e[2])}function et(e,t){if(isNaN(t))throw Error("FOCA0005: Cannot multiply xs:dayTimeDuration by NaN");if((e=e.ea*t)>Number.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while multiplying xs:dayTimeDuration");return new Je(e<Number.MIN_SAFE_INTEGER||Object.is(-0,e)?0:e)}function tt(e){return e?parseInt(e,10):null}function nt(e){var t=(e+="").startsWith("-");return t&&(e=e.substring(1)),(t?"-":"")+e.padStart(4,"0")}function rt(e){return(e+"").padStart(2,"0")}function ot(e){return 1===(e+="").split(".")[0].length&&(e=e.padStart(e.length+1,"0")),e}function at(e){return 0===e.getHours()&&0===e.getMinutes()?"Z":(e.oa()?"+":"-")+rt(Math.abs(e.getHours()))+":"+rt(Math.abs(e.getMinutes()))}function it(e,t,n,r,o,a,i,s,u){this.A=e,this.h=t,this.s=n+(24===r?1:0),this.u=24===r?0:r,this.O=o,this.j=a,this.pa=i,this.Z=s,this.type=void 0===u?9:u}function st(e){var t=/^(?:(-?\d{4,}))?(?:--?(\d\d))?(?:-{1,3}(\d\d))?(T)?(?:(\d\d):(\d\d):(\d\d))?(\.\d+)?(Z|(?:[+-]\d\d:\d\d))?$/.exec(e);e=t[1]?parseInt(t[1],10):null;var n=tt(t[2]),r=tt(t[3]),o=t[4],a=tt(t[5]),i=tt(t[6]),s=tt(t[7]),u=t[8]?parseFloat(t[8]):0;if(t=t[9]?Ze(t[9]):null,e&&(-271821>e||273860<e))throw Error("FODT0001: Datetime year is out of bounds");return o?new it(e,n,r,a,i,s,u,t,9):null!==a&&null!==i&&null!==s?new it(1972,12,31,a,i,s,u,t,8):null!==e&&null!==n&&null!==r?new it(e,n,r,0,0,0,0,t,7):null!==e&&null!==n?new it(e,n,1,0,0,0,0,t,11):null!==n&&null!==r?new it(1972,n,r,0,0,0,0,t,13):null!==e?new it(e,1,1,0,0,0,0,t,12):null!==n?new it(1972,n,1,0,0,0,0,t,14):new it(1972,12,r,0,0,0,0,t,15)}function ut(e,t){switch(t){case 15:return new it(1972,12,e.s,0,0,0,0,e.Z,15);case 14:return new it(1972,e.h,1,0,0,0,0,e.Z,14);case 12:return new it(e.A,1,1,0,0,0,0,e.Z,12);case 13:return new it(1972,e.h,e.s,0,0,0,0,e.Z,13);case 11:return new it(e.A,e.h,1,0,0,0,0,e.Z,11);case 8:return new it(1972,12,31,e.u,e.O,e.j,e.pa,e.Z,8);case 7:return new it(e.A,e.h,e.s,0,0,0,0,e.Z,7);default:return new it(e.A,e.h,e.s,e.u,e.O,e.j,e.pa,e.Z,9)}}function ct(e,t){return t=e.Z||t||Ze("Z"),new Date(Date.UTC(e.A,e.h-1,e.s,e.u-t.getHours(),e.O-t.getMinutes(),e.j,1e3*e.pa))}function lt(e,t,n){var r=ct(e,n).getTime();return r===(n=ct(t,n).getTime())?e.pa===t.pa?0:e.pa>t.pa?1:-1:r>n?1:-1}function pt(e,t,n){return 0===lt(e,t,n)}function ht(e,t,n){return new Je(e=(ct(e,n).getTime()-ct(t,n).getTime())/1e3)}function ft(e){throw Error("Not implemented: adding durations to "+fe[e.type])}function dt(e){throw Error("Not implemented: subtracting durations from "+fe[e.type])}function mt(e,t){if(null===e)return null;switch(typeof e){case"boolean":return e?V:Q;case"number":return Y(e,3);case"string":return Y(e,1);case"object":if("nodeType"in e)return Xe({node:e,F:null});if(Array.isArray(e))return new _e(e.map((function(e){return void 0===e?function(){return ce.empty()}:le(e=null===(e=mt(e))?ce.empty():ce.o(e))})));if(e instanceof Date){var n=st(e.toISOString());return Y(n,n.type)}return new Ye(Object.keys(e).filter((function(t){return void 0!==e[t]})).map((function(t){var n=mt(e[t]);return n=null===n?ce.empty():ce.o(n),{key:Y(t,1),value:le(n)}})))}throw Error("Value "+String(e)+' of type "'+typeof e+'" is not adaptable to an XPath value.')}function gt(e,t){if("number"!=typeof e&&("string"!=typeof e||!$.get(t)(e)))throw Error("Cannot convert JavaScript value '"+e+"' to the XPath type "+fe[t]+" since it is not valid.")}function yt(e,t,n){if(null===t)return null;switch(e){case 0:return t?V:Q;case 1:return Y(t+"",1);case 3:case 2:return gt(t,3),Y(+t,3);case 4:return gt(t,e),Y(+t,4);case 5:return gt(t,e),Y(0|t,5);case 6:return gt(t,e),Y(+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 "+fe[e]+".");return Y(ut(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 "+fe[e]+".");return Xe({node:t,F:null});case 59:case 61:return mt(t);default:throw Error('Values of the type "'+fe[e]+'" can not be adapted from JavaScript to equivalent XPath values.')}}function vt(e,t,n){if(0===n.g)return null===(t=yt(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 "+me(n)+".");return t.map((function(e){return yt(n.type,e)})).filter((function(e){return null!==e}))}var r=yt(n.type,t);if(null===r)throw Error("The JavaScript value "+t+" should be a single entry if it is to be converted to "+me(n)+".");return[r]}function wt(e,t,n){return n=void 0===n?{type:59,g:0}:n,ce.create(vt(0,t,n))}function At(e,t){this.h=t=void 0===t?{vb:null,Ab:null,pb:!1}:t,this.Ja=e.Ja,this.Ga=e.Ga,this.N=e.N,this.Ea=e.Ea||Object.create(null)}function xt(e,t){var n=0,r=t.value;return{next:function(o){return(o=r.next(o)).done?z:W(Nt(e,n++,o.value,t))}}}function bt(e){return e.h.pb||(e.h.pb=!0,e.h.vb=st((new Date).toISOString()),e.h.Ab=We("PT0S")),e.h.vb}function Et(e){return e.h.pb||(e.h.pb=!0,e.h.vb=st((new Date).toISOString()),e.h.Ab=We("PT0S")),e.h.Ab}function Nt(e,t,n,r){return new At({N:n,Ja:t,Ga:r||e.Ga,Ea:e.Ea},e.h)}function Bt(e,t){return new At({N:e.N,Ja:e.Ja,Ga:e.Ga,Ea:Object.assign(Object.create(null),e.Ea,t)},e.h)}function Tt(e,t,n,r,o,a,i,s){var u=new Map;this.debug=e,this.Ha=t,this.h=n,this.s=r,this.A=o,this.u=a,this.ha=u,this.O=i,this.j=s}function It(e){var t=0,n=null,r=!0;return ce.create({next:function(o){for(;t<e.length;){n||(n=e[t].value,r=!0);var a=n.next(r?0:o);if(r=!1,!a.done)return a;t++,n=null}return z}})}function Ct(e,t,n){return Error("FORG0001: Cannot cast "+e+" to "+fe[t]+(n?", "+n:""))}function St(e){return Error("XPTY0004: "+e)}function Ot(e){return Error("FOTY0013: Atomization is not supported for "+fe[e]+".")}function Rt(e){return Error("XPST0081: The prefix "+e+" could not be resolved.")}function Dt(e,t){if(ee(e.type,46)||ee(e.type,19)||ee(e.type,0)||ee(e.type,4)||ee(e.type,3)||ee(e.type,6)||ee(e.type,5)||ee(e.type,2)||ee(e.type,23)||ee(e.type,1))return ce.create(e);var n=t.h;if(ee(e.type,53)){var r=e.value;if(2===r.node.nodeType||3===r.node.nodeType)return ce.create(Y(Ue(n,r),19));if(8===r.node.nodeType||7===r.node.nodeType)return ce.create(Y(Ue(n,r),1));var o=[];return function e(t){if(8!==r.node.nodeType&&7!==r.node.nodeType){var a=t.nodeType;3===a||4===a?o.push(n.getData(t)):1!==a&&9!==a||n.getChildNodes(t).forEach((function(t){e(t)}))}}(r.node),ce.create(Y(o.join(""),19))}if(ee(e.type,60)&&!ee(e.type,62))throw Ot(e.type);if(ee(e.type,62))return It(e.R.map((function(e){return Ut(e(),t)})));throw Error("Atomizing "+e.type+" is not implemented.")}function Ut(e,t){var n=!1,r=e.value,o=null;return ce.create({next:function(){for(;!n;){if(!o){var e=r.next(0);if(e.done){n=!0;break}o=Dt(e.value,t).value}if(!(e=o.next(0)).done)return e;o=null}return z}})}function Mt(e){for(e=q[e];e&&0!==e.D;)e=e.parent;return e?e.type:null}function kt(e,t){var n=(t=q[t]).Ia;if(!n||!n.whiteSpace)return t.parent?kt(e,t.parent.type):e;switch(t.Ia.whiteSpace){case"replace":return e.replace(/[\u0009\u000A\u000D]/g," ");case"collapse":return e.replace(/[\u0009\u000A\u000D]/g," ").replace(/ {2,}/g," ").replace(/^ | $/g,"")}return e}function Gt(e,t){for(t=q[t];t&&null===t.fb;){if(2===t.D||3===t.D)return!0;t=t.parent}return!t||t.fb(e)}function Ft(e,t){for(;e;){if(e.La&&e.La[t])return e.La[t];e=e.parent}return function(){return!0}}function Pt(e,t){return e(2)?function(e){return{v:!0,value:e}}:e(0)?function(e){return{v:!0,value:e?1:0}}:e(1)||e(19)?function(e){switch(e){case"NaN":return{v:!0,value:NaN};case"INF":case"+INF":return{v:!0,value:1/0};case"-INF":return{v:!0,value:-1/0};case"0":case"+0":return{v:!0,value:0};case"-0":return{v:!0,value:-0}}var n=parseFloat(e);return isNaN(n)?{v:!1,error:Ct(e,t)}:{v:!0,value:n}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to "+t+" or any of its derived types.")}}}function Ht(e){if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)throw Error("FODT0002: Number of months given to construct YearMonthDuration overflows MAX_SAFE_INTEGER or MIN_SAFE_INTEGER");this.ga=e}function _t(e){var t=Math.abs(e.cb());return(t?t+"Y":"")+((e=Math.abs(e.$a()))?e+"M":"")||"0M"}function jt(e){var t=/^(-)?P(\d+Y)?(\d+M)?(\d+D)?(?:T(\d+H)?(\d+M)?(\d+(\.\d*)?S)?)?$/.exec(e);if(t){if(e=!t[1],(t=12*(t[2]?parseInt(t[2],10):0)+(t[3]?parseInt(t[3],10):0))>Number.MAX_SAFE_INTEGER||!Number.isFinite(t))throw Error("FODT0002: Value overflow while constructing xs:yearMonthDuration");e=new Ht(e||0===t?t:-t)}else e=null;return e}function Xt(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 Ht(e<Number.MIN_SAFE_INTEGER||0===e?0:e)}function Lt(e,t){this.Sa=e,this.Fa=t}(r=Te.prototype).insertBefore=function(e,t,n){return this.h.insertBefore(e,t,n)},r.removeAttributeNS=function(e,t,n){return this.h.removeAttributeNS(e,t,n)},r.removeChild=function(e,t){return this.h.removeChild(e,t)},r.setAttributeNS=function(e,t,n,r){this.h.setAttributeNS(e,t,n,r)},r.setData=function(e,t){this.h.setData(e,t)},Se.prototype.getAllAttributes=function(e,t){return Ie(e)?e.attributes:this.h.getAllAttributes(e,void 0===t?null:t)},Se.prototype.getChildNodes=function(e,t){return t=Ie(e)?e.childNodes:this.h.getChildNodes(e,void 0===t?null:t),9===e.nodeType?t.filter((function(e){return 10!==e.nodeType})):t},Se.prototype.getData=function(e){return Ie(e)?2===e.nodeType?e.value:e.data:this.h.getData(e)||""},Se.prototype.getParentNode=function(e,t){return this.h.getParentNode(e,void 0===t?null:t)},y(_e,we),y(Ye,we),(r=Ve.prototype).Za=function(){return 0},r.getHours=function(){return 0},r.getMinutes=function(){return 0},r.$a=function(){return 0},r.ab=function(){return 0},r.bb=function(){return 0},r.getSeconds=function(){return 0},r.cb=function(){return 0},r.oa=function(){return!0},y(Je,Ve),(r=Je.prototype).Za=function(){return Math.trunc(this.ea/86400)},r.getHours=function(){return Math.trunc(this.ea%86400/3600)},r.getMinutes=function(){return Math.trunc(this.ea%3600/60)},r.bb=function(){return this.ea},r.getSeconds=function(){var e=this.ea%60;return Object.is(-0,e)?0:e},r.oa=function(){return!Object.is(-0,this.ea)&&0<=this.ea},r.toString=function(){return(this.oa()?"P":"-P")+Ke(this)},(r=it.prototype).getDay=function(){return this.s},r.getHours=function(){return this.u},r.getMinutes=function(){return this.O},r.getMonth=function(){return this.h},r.getSeconds=function(){return this.j},r.getYear=function(){return this.A},r.toString=function(){switch(this.type){case 9:return nt(this.A)+"-"+rt(this.h)+"-"+rt(this.s)+"T"+rt(this.u)+":"+rt(this.O)+":"+ot(this.j+this.pa)+(this.Z?at(this.Z):"");case 7:return nt(this.A)+"-"+rt(this.h)+"-"+rt(this.s)+(this.Z?at(this.Z):"");case 8:return rt(this.u)+":"+rt(this.O)+":"+ot(this.j+this.pa)+(this.Z?at(this.Z):"");case 15:return"---"+rt(this.s)+(this.Z?at(this.Z):"");case 14:return"--"+rt(this.h)+(this.Z?at(this.Z):"");case 13:return"--"+rt(this.h)+"-"+rt(this.s)+(this.Z?at(this.Z):"");case 12:return nt(this.A)+(this.Z?at(this.Z):"");case 11:return nt(this.A)+"-"+rt(this.h)+(this.Z?at(this.Z):"")}throw Error("Unexpected subType")},y(Ht,Ve),(r=Ht.prototype).$a=function(){var e=this.ga%12;return 0===e?0:e},r.ab=function(){return this.ga},r.cb=function(){return Math.trunc(this.ga/12)},r.oa=function(){return!Object.is(-0,this.ga)&&0<=this.ga},r.toString=function(){return(this.oa()?"P":"-P")+_t(this)},y(Lt,Ve),(r=Lt.prototype).Za=function(){return this.Fa.Za()},r.getHours=function(){return this.Fa.getHours()},r.getMinutes=function(){return this.Fa.getMinutes()},r.$a=function(){return this.Sa.$a()},r.ab=function(){return this.Sa.ab()},r.bb=function(){return this.Fa.bb()},r.getSeconds=function(){return this.Fa.getSeconds()},r.cb=function(){return this.Sa.cb()},r.oa=function(){return this.Sa.oa()&&this.Fa.oa()},r.toString=function(){var e=this.oa()?"P":"-P",t=_t(this.Sa),n=Ke(this.Fa);return"0M"===t?e+n:"T0S"===n?e+t:e+t+n};var $t=[3,6,4,5];function qt(e){if(e(1)||e(19))return function(e){return{v:!0,value:e+""}};if(e(20))return function(e){return{v:!0,value:e}};if(e(23))return function(e){return{v:!0,value:e.prefix?e.prefix+":"+e.localName:e.localName}};if(e(44))return function(e){return{v:!0,value:e.toString()}};if(e(2)){if(e(5)||e(4))return function(e){return{v:!0,value:(e+"").replace("e","E")}};if(e(6)||e(3))return function(e){return isNaN(e)?{v:!0,value:"NaN"}:isFinite(e)?Object.is(e,-0)?{v:!0,value:"-0"}:{v:!0,value:(e+"").replace("e","E").replace("E+","E")}:{v:!0,value:(0>e?"-":"")+"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 Yt=[2,5,17,16];function Vt(e,t){function n(t){return ee(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=qt(e);return function(e){return(e=t(e)).v?{v:!0,value:Y(e.value,19)}:e}}(n);case 1:return function(e){var t=qt(e);return function(e){return(e=t(e)).v?{v:!0,value:Y(e.value,1)}:e}}(n);case 6:return function(e){var t=Pt(e,6);return function(e){return(e=t(e)).v?{v:!0,value:Y(e.value,6)}:e}}(n);case 3:return function(e){var t=Pt(e,3);return function(e){return(e=t(e)).v?{v:!0,value:Y(e.value,3)}:e}}(n);case 4:return function(e){return e(5)?function(e){return{v:!0,value:Y(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:Y(e,4)}}:e(0)?function(e){return{v:!0,value:Y(e?1:0,4)}}:e(1)||e(19)?function(e){var t=parseFloat(e);return!isNaN(t)||isFinite(t)?{v:!0,value:Y(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:Y(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:Y(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:Ct(e,5)}:Number.isSafeInteger(t)?{v:!0,value:Y(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=Vt;return function(n){for(var r=c($t),o=r.next();!o.done;o=r.next())if((o=t(e,o.value)(n)).v)return o;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:Y(new Lt(e,new Je(e.oa()?0:-0)),18)}}:e(17)?function(e){return{v:!0,value:Y(e=new Lt(new Ht(e.oa()?0:-0),e),18)}}:e(18)?function(e){return{v:!0,value:Y(e,18)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(new Lt(jt(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:Y(e.Sa,16)}}:e(17)?function(){return{v:!0,value:Y(jt("P0M"),16)}}:e(19)||e(1)?function(e){var t=jt(e);return t?{v:!0,value:Y(t,16)}:{v:!1,error:Ct(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:Y(e.Fa,17)}}:e(16)?function(){return{v:!0,value:Y(We("PT0.0S"),17)}}:e(19)||e(1)?function(e){var t=We(e);return t?{v:!0,value:Y(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:Y(ut(e,9),9)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,8),8)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,7),7)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,11),11)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,12),12)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,13),13)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,15),15)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,14),14)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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)?Q:V}}:e(1)||e(19)?function(e){switch(e){case"true":case"1":return{v:!0,value:V};case"false":case"0":return{v:!0,value:Q};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;n<e.length;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return{v:!0,value:Y(btoa(t),21)}}:e(1)||e(19)?function(e){return{v:!0,value:Y(e,21)}}:function(){return{error:Error("XPTY0004: Casting not supported from given type to xs:base64Binary or any of its derived types."),v:!1}}}(n);case 22:return function(e){return e(21)?function(e){for(var t="",n=0,r=(e=atob(e)).length;n<r;n++)t+=Number(e.charCodeAt(n)).toString(16);return{v:!0,value:Y(t.toUpperCase(),22)}}:e(1)||e(19)?function(e){return{v:!0,value:Y(e,22)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:hexBinary or any of its derived types.")}}}(n);case 20:return function(e){return e(1)||e(19)?function(e){return{v:!0,value:Y(e,20)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:anyURI or any of its derived types.")}}}(n);case 23:throw Error("Casting to xs:QName is not implemented.")}return function(){return{v:!1,error:Error("XPTY0004: Casting not supported from "+e+" to "+t+".")}}}var Qt=Object.create(null);function Jt(e,t){if(19===e&&1===t)return function(e){return{v:!0,value:Y(e,1)}};if(44===t)return function(){return{v:!1,error:Error("XPST0080: Casting to xs:NOTATION is not permitted.")}};if(39===t)return function(){return{v:!1,error:Error("FORG0001: Casting to xs:error is not permitted.")}};if(45===e||45===t)return function(){return{v:!1,error:Error("XPST0080: Casting from or to xs:anySimpleType is not permitted.")}};if(46===e||46===t)return function(){return{v:!1,error:Error("XPST0080: Casting from or to xs:anyAtomicType is not permitted.")}};if(ee(e,60)&&1===t)return function(){return{v:!1,error:Error("FOTY0014: Casting from function item to xs:string is not permitted.")}};if(e===t)return function(e){return{v:!0,value:{type:t,value:e}}};var n=Yt.includes(e)?e:Mt(e),r=Yt.includes(t)?t:Mt(t);if(null===r||null===n)return function(){return{v:!1,error:Error("XPST0081: Can not cast: type "+(r?fe[e]:fe[t])+" is unknown.")}};var o=[];return 1!==n&&19!==n||o.push((function(e){var n=kt(e,t);return Gt(n,t)?{v:!0,value:n}:{v:!1,error:Ct(e,t,"pattern validation failed.")}})),n!==r&&(o.push(Vt(n,r)),o.push((function(e){return{v:!0,value:e.value}}))),19!==r&&1!==r||o.push((function(e){return Gt(e,t)?{v:!0,value:e}:{v:!1,error:Ct(e,t,"pattern validation failed.")}})),o.push((function(e){return function(e,t){for(var n=q[t];n;){if(n.Ia&&!Object.keys(n.Ia).every((function(t){if("whiteSpace"===t)return!0;var r=Ft(n,t);return!r||r(e,n.Ia[t])})))return!1;n=n.parent}return!0}(e,t)?{v:!0,value:e}:{v:!1,error:Ct(e,t,"pattern validation failed.")}})),o.push((function(e){return{v:!0,value:{type:t,value:e}}})),function(e){e={v:!0,value:e};for(var t=0,n=o.length;t<n&&!1!==(e=o[t](e.value)).v;++t);return e}}function Kt(e,t){var n=e.type+1e4*t,r=Qt[n];return r||(r=Qt[n]=Jt(e.type,t)),r.call(void 0,e.value,t)}function zt(e,t){if(!0===(e=Kt(e,t)).v)return e.value;throw e.error}function Wt(e){var t=!1;return{next:function(){return t?z:(t=!0,W(e))}}}function Zt(e,t){return e===t||!(!e||!t||e.offset!==t.offset||e.parent!==t.parent)&&Zt(e.F,t.F)}function en(e,t){return!!(e===t||e.node===t.node&&Zt(e.F,t.F))}function tn(e,t){for(var n=[];t;t=Fe(e,t,null))n.unshift(t);return n}function nn(e,t){for(var n=[];t;t=e.getParentNode(t,null))n.unshift(t);return n}function rn(e,t,n,r){if(n.F||r.F||Ie(n.node)||Ie(r.node)){if(en(n,r))return 0;n=tn(t,n),r=tn(t,r);var o=n[0],a=r[0];if(!en(o,a))return t=e.findIndex((function(e){return en(e,o)})),n=e.findIndex((function(e){return en(e,a)})),-1===t&&(t=e.push(o)),-1===n&&(n=e.push(a)),t-n;e=1;for(var i=Math.min(n.length,r.length);e<i&&en(n[e],r[e]);++e);return n[e]?r[e]?function(e,t,n){var r=Fe(e,t,null);e=De(e,r,null),r=0;for(var o=e.length;r<o;++r){var a=e[r];if(en(a,t))return-1;if(en(a,n))return 1}}(t,n[e],r[e]):1:-1}if((n=n.node)===(r=r.node))return 0;if(n=nn(t,n),r=nn(t,r),n[0]!==r[0]){var s={node:n[0],F:null},u={node:r[0],F:null};return t=e.findIndex((function(e){return en(e,s)})),n=e.findIndex((function(e){return en(e,u)})),-1===t&&(t=e.push(s)),-1===n&&(n=e.push(u)),t-n}for(i=1,e=Math.min(n.length,r.length);i<e&&n[i]===r[i];++i);if(e=n[i],n=r[i],!e)return-1;if(!n)return 1;for(t=t.getChildNodes(r[i-1],null),r=0,i=t.length;r<i;++r){var c=t[r];if(c===e)return-1;if(c===n)return 1}}function on(e,t,n,r){var o=ee(n.type,47),a=ee(r.type,47);if(o&&!a){if(en(n=Fe(t,n.value),r=r.value))return 1}else if(a&&!o){if(en(n=n.value,r=Fe(t,r.value)))return-1}else if(o&&a){if(en(Fe(t,r.value),Fe(t,n.value)))return n.value.node.localName>r.value.node.localName?1:-1;n=Fe(t,n.value),r=Fe(t,r.value)}else n=n.value,r=r.value;return rn(e,t,n,r)}function an(e,t,n){return on(e.s,e,t,n)}function sn(e,t){return cn(t,(function(t,n){return on(e.s,e,t,n)})).filter((function(e,t,n){return 0===t||!en(e.value,n[t-1].value)}))}function un(e,t){return e<t?-1:0}function cn(e,t){if(t=void 0===t?un:t,1>=e.length)return e;var n=Math.floor(e.length/2),r=cn(e.slice(0,n),t);for(e=cn(e.slice(n),t),n=[];r.length&&e.length;)0>t(r[0],e[0])?n.push(r.shift()):n.push(e.shift());return n.concat(r.concat(e))}var ln=e;function pn(e,t,n,r,o){if(ee(e.type,t.type))return e;if(ee(t.type,46)&&ee(e.type,53)&&(e=Dt(e,n).first()),ee(e.type,t.type)||46===t.type)return e;if(ee(e.type,19)){if(!(n=zt(e,t.type)))throw Error("XPTY0004 Unable to convert "+(o?"return":"argument")+" of type "+fe[e.type]+" to type "+me(t)+" while calling "+r);return n}if(n=function(e,t){if(ee(e.type,2)){if(ee(e.type,6))return 3===t?Y(e.value,3):null;if(ee(e.type,4)){if(6===t)return Y(e.value,6);if(3===t)return Y(e.value,3)}return null}return ee(e.type,20)&&1===t?Y(e.value,1):null}(e,t.type),!n)throw Error("XPTY0004 Unable to cast "+(o?"return":"argument")+" of type "+fe[e.type]+" to type "+me(t)+" while calling "+r);return n}function hn(e){switch(e){case 2:return"*";case 1:return"+";case 0:return"?";case 3:return""}}function fn(e,t,n,r,o){return 0===e.g?t.$({default:function(){return t.map((function(t){return pn(t,e,n,r,o)}))},multiple:function(){throw Error("XPTY0004: Multiplicity of "+(o?"function return value":"function argument")+" of type "+fe[e.type]+hn(e.g)+" for "+r+' is incorrect. Expected "?", but got "+".')}}):1===e.g?t.$({empty:function(){throw Error("XPTY0004: Multiplicity of "+(o?"function return value":"function argument")+" of type "+fe[e.type]+hn(e.g)+" for "+r+' is incorrect. Expected "+", but got "empty-sequence()"')},default:function(){return t.map((function(t){return pn(t,e,n,r,o)}))}}):2===e.g?t.map((function(t){return pn(t,e,n,r,o)})):t.$({o:function(){return t.map((function(t){return pn(t,e,n,r,o)}))},default:function(){throw Error("XPTY0004: Multiplicity of "+(o?"function return value":"function argument")+" of type "+fe[e.type]+hn(e.g)+" for "+r+" is incorrect. Expected exactly one")}})}function dn(e,t){return ee(e,5)?Y(t,5):ee(e,6)?Y(t,6):ee(e,3)?Y(t,3):Y(t,4)}function mn(e,t,n,r,o,a){var i=!1;return ce.create({next:function(){if(i)return z;var t,n=o.first();if(!n)return i=!0,z;if((ee(n.type,6)||ee(n.type,3))&&(0===n.value||isNaN(n.value)||1/0===n.value||-1/0===n.value))return i=!0,W(n);if(t=a?a.first().value:0,i=!0,function(e){if(Math.floor(e)===e||isNaN(e))return 0;var t=(e=/\d+(?:\.(\d*))?(?:[Ee](-)?(\d+))*/.exec(e+""))[1]?e[1].length:0;return e[3]?e[2]?t+parseInt(e[3],10):0>(e=t-parseInt(e[3],10))?0:e:t}(n.value)<t)return W(n);var r=[5,4,3,6].find((function(e){return ee(n.type,e)}));switch(t=function(e,t,n){return t&&0==e*n%1%.5?0==Math.floor(e*n)%2?Math.floor(e*n)/n:Math.ceil(e*n)/n:Math.round(e*n)/n}(zt(n,4).value,e,Math.pow(10,t)),r){case 4:return W(Y(t,4));case 3:return W(Y(t,3));case 6:return W(Y(t,6));case 5:return W(Y(t,5))}}})}function gn(e,t,n,r){return Ut(r,t).$({empty:function(){return ce.o(Y(NaN,3))},o:function(){var e=Kt(r.first(),3);return e.v?ce.o(e.value):ce.o(Y(NaN,3))},multiple:function(){throw Error("fn:number may only be called with zero or one values")}})}function yn(e,t,n,r){return r.G()?r:(e=r.M(),ce.o(e[Math.floor(Math.random()*e.length)]))}var vn=[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"abs",l:[{type:2,g:0}],i:{type:2,g:0},m:function(e,t,n,r){return r.map((function(e){return dn(e.type,Math.abs(e.value))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"ceiling",l:[{type:2,g:0}],i:{type:2,g:0},m:function(e,t,n,r){return r.map((function(e){return dn(e.type,Math.ceil(e.value))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"floor",l:[{type:2,g:0}],i:{type:2,g:0},m:function(e,t,n,r){return r.map((function(e){return dn(e.type,Math.floor(e.value))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"round",l:[{type:2,g:0}],i:{type:2,g:0},m:mn.bind(null,!1)},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"round",l:[{type:2,g:0},{type:5,g:3}],i:{type:2,g:0},m:mn.bind(null,!1)},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"round-half-to-even",l:[{type:2,g:0}],i:{type:2,g:0},m:mn.bind(null,!0)},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"round-half-to-even",l:[{type:2,g:0},{type:5,g:3}],i:{type:2,g:0},m:mn.bind(null,!0)},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"number",l:[{type:46,g:0}],i:{type:3,g:3},m:gn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"number",l:[],i:{type:3,g:3},m:function(e,t,n){var r=e.N&&fn({type:46,g:0},ce.o(e.N),t,"fn:number",!1);if(!r)throw Error("XPDY0002: fn:number needs an atomizable context item.");return gn(0,t,0,r)}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"random-number-generator",l:[],i:{type:61,g:3},m:function e(){return ce.o(new Ye([{key:Y("number",1),value:function(){return ce.o(Y(Math.random(),3))}},{key:Y("next",1),value:function(){return ce.o(new we({value:e,Pa:!0,localName:"",namespaceURI:"",l:[],arity:0,i:{type:61,g:3}}))}},{key:Y("permute",1),value:function(){return ce.o(new we({value:yn,Pa:!0,localName:"",namespaceURI:"",l:[{type:59,g:2}],arity:1,i:{type:59,g:2}}))}}]))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"random-number-generator",l:[{type:46,g:0}],i:{type:61,g:3},m:function(){throw Error("Not implemented: Specifying a seed is not supported")}}];function wn(){throw Error("FOCH0002: No collations are supported")}function An(e,t,n,r){if(null===t.N)throw Error("XPDY0002: The function which was called depends on dynamic context, which is absent.");return e(t,n,r,ce.o(t.N))}function xn(e,t,n,r){return r.$({empty:function(){return ce.o(Y("",1))},default:function(){return r.map((function(e){if(ee(e.type,53)){var n=Dt(e,t).first();return ee(e.type,47)?zt(n,1):n}return zt(e,1)}))}})}function bn(e,t,n,r,o){return Le([o],(function(e){var n=c(e).next().value;return Ut(r,t).L((function(e){return e=e.map((function(e){return zt(e,1).value})).join(n.value),ce.o(Y(e,1))}))}))}function En(e,t,n,r){return r.G()?ce.o(Y(0,5)):(e=r.first().value,ce.o(Y(Array.from(e).length,5)))}function Nn(e,t,n,r,o,a){var i=mn(!1,0,0,0,o,null),s=null!==a?mn(!1,0,0,0,a,null):null,u=!1,c=null,l=null,p=null;return ce.create({next:function(){return u?z:c||null!==(c=r.first())?(l||(l=i.first()),!p&&a&&(p=null,p=s.first()),u=!0,W(Y(Array.from(c.value).slice(Math.max(l.value-1,0),a?l.value+p.value-1:void 0).join(""),1))):(u=!0,W(Y("",1)))}})}function Bn(e,t,n,r,o){return r.G()||0===r.first().value.length?ce.empty():(e=r.first().value,o=Sn(o=o.first().value),ce.create(e.split(o).map((function(e){return Y(e,1)}))))}function Tn(e,t,n,r){return r.G()?ce.o(Y("",1)):(e=r.first().value.trim(),ce.o(Y(e.replace(/\s+/g," "),1)))}var In=new Map,Cn=new Map;function Sn(e){if(Cn.has(e))return Cn.get(e);try{var t=new RegExp(e,"g")}catch(e){throw Error("FORX0002: "+e)}if(t.test(""))throw Error("FORX0003: the pattern "+e+" matches the zero length string");return Cn.set(e,t),t}var On=[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"compare",l:[{type:1,g:0},{type:1,g:0}],i:{type:5,g:0},m:function(e,t,n,r,o){return r.G()||o.G()?ce.empty():(e=r.first().value)>(o=o.first().value)?ce.o(Y(1,5)):e<o?ce.o(Y(-1,5)):ce.o(Y(0,5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"compare",l:[{type:1,g:0},{type:1,g:0},{type:1,g:3}],i:{type:5,g:0},m:wn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"concat",l:[{type:46,g:0},{type:46,g:0},4],i:{type:1,g:3},m:function(e,t,n,r){for(var o=[],a=3;a<arguments.length;++a)o[a-3]=arguments[a];return o=o.map((function(e){return Ut(e,t).L((function(e){return ce.o(Y(e.map((function(e){return null===e?"":zt(e,1).value})).join(""),1))}))})),Le(o,(function(e){return ce.o(Y(e.map((function(e){return e.value})).join(""),1))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"contains",l:[{type:1,g:0},{type:1,g:0},{type:1,g:0}],i:{type:0,g:3},m:wn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"contains",l:[{type:1,g:0},{type:1,g:0}],i:{type:0,g:3},m:function(e,t,n,r,o){return e=r.G()?"":r.first().value,0===(o=o.G()?"":o.first().value).length?ce.ca():0===e.length?ce.X():e.includes(o)?ce.ca():ce.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"ends-with",l:[{type:1,g:0},{type:1,g:0}],i:{type:0,g:3},m:function(e,t,n,r,o){return 0===(e=o.G()?"":o.first().value).length?ce.ca():0===(r=r.G()?"":r.first().value).length?ce.X():r.endsWith(e)?ce.ca():ce.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"ends-with",l:[{type:1,g:0},{type:1,g:0},{type:1,g:3}],i:{type:0,g:3},m:wn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"normalize-space",l:[{type:1,g:0}],i:{type:1,g:3},m:Tn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"normalize-space",l:[],i:{type:1,g:3},m:An.bind(null,(function(e,t,n,r){return Tn(e,0,0,xn(0,t,0,r))}))},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"starts-with",l:[{type:1,g:0},{type:1,g:0}],i:{type:0,g:3},m:function(e,t,n,r,o){return 0===(e=o.G()?"":o.first().value).length?ce.ca():0===(r=r.G()?"":r.first().value).length?ce.X():r.startsWith(e)?ce.ca():ce.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"starts-with",l:[{type:1,g:0},{type:1,g:0},{type:1,g:3}],i:{type:0,g:3},m:wn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"string",l:[{type:59,g:0}],i:{type:1,g:3},m:xn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"string",l:[],i:{type:1,g:3},m:An.bind(null,xn)},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"substring-before",l:[{type:1,g:0},{type:1,g:0}],i:{type:1,g:3},m:function(e,t,n,r,o){return e=r.G()?"":r.first().value,""===(o=o.G()?"":o.first().value)||-1===(o=e.indexOf(o))?ce.o(Y("",1)):ce.o(Y(e.substring(0,o),1))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"substring-after",l:[{type:1,g:0},{type:1,g:0}],i:{type:1,g:3},m:function(e,t,n,r,o){return e=r.G()?"":r.first().value,""===(o=o.G()?"":o.first().value)?ce.o(Y(e,1)):-1===(t=e.indexOf(o))?ce.o(Y("",1)):ce.o(Y(e.substring(t+o.length),1))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"substring",l:[{type:1,g:0},{type:3,g:3}],i:{type:1,g:3},m:Nn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"substring",l:[{type:1,g:0},{type:3,g:3},{type:3,g:3}],i:{type:1,g:3},m:Nn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"upper-case",l:[{type:1,g:0}],i:{type:1,g:3},m:function(e,t,n,r){return r.G()?ce.o(Y("",1)):r.map((function(e){return Y(e.value.toUpperCase(),1)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"lower-case",l:[{type:1,g:0}],i:{type:1,g:3},m:function(e,t,n,r){return r.G()?ce.o(Y("",1)):r.map((function(e){return Y(e.value.toLowerCase(),1)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"string-join",l:[{type:46,g:2},{type:1,g:3}],i:{type:1,g:3},m:bn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"string-join",l:[{type:46,g:2}],i:{type:1,g:3},m:function(e,t,n,r){return bn(0,t,0,r,ce.o(Y("",1)))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"string-length",l:[{type:1,g:0}],i:{type:5,g:3},m:En},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"string-length",l:[],i:{type:5,g:3},m:An.bind(null,(function(e,t,n,r){return En(e,0,0,xn(0,t,0,r))}))},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"tokenize",l:[{type:1,g:0},{type:1,g:3},{type:1,g:3}],i:{type:1,g:2},m:function(){throw Error("Not implemented: Using flags in tokenize is not supported")}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"tokenize",l:[{type:1,g:0},{type:1,g:3}],i:{type:1,g:2},m:Bn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"tokenize",l:[{type:1,g:0}],i:{type:1,g:2},m:function(e,t,n,r){return Bn(e,0,0,Tn(e,0,0,r),ce.o(Y(" ",1)))}},{l:[{type:1,g:0},{type:1,g:3},{type:1,g:3}],m:function(e,t,n,r,o,a){return Le([r,o,a],(function(e){var t=c(e),n=t.next().value;e=t.next().value,t=t.next().value,n=Array.from(n?n.value:"");var r=Array.from(e.value),o=Array.from(t.value);return e=n.map((function(e){return r.includes(e)?(e=r.indexOf(e))<=o.length?o[e]:void 0:e})),ce.o(Y(e.join(""),1))}))},localName:"translate",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:5,g:2}],m:function(e,t,n,r){return r.L((function(e){return e=e.map((function(e){if(9===(e=e.value)||10===e||13===e||32<=e&&55295>=e||57344<=e&&65533>=e||65536<=e&&1114111>=e)return String.fromCodePoint(e);throw Error("FOCH0001")})).join(""),ce.o(Y(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 Le([r],(function(e){return 0===(e=(e=c(e).next().value)?e.value.split(""):[]).length?ce.empty():ce.create(e.map((function(e){return Y(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 Le([r],(function(e){return null===(e=c(e).next().value)||0===e.value.length?ce.create(Y("",1)):ce.create(Y(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 Le([r],(function(e){return null===(e=c(e).next().value)||0===e.value.length?ce.create(Y("",1)):ce.create(Y(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,o){return Le([r,o],(function(e){var t=c(e);if(e=t.next().value,t=t.next().value,null===e||null===t)return ce.empty();if(e=e.value,t=t.value,e.length!==t.length)return ce.X();e=e.split(""),t=t.split("");for(var n=0;n<e.length;n++)if(e[n].codePointAt(0)!==t[n].codePointAt(0))return ce.X();return ce.ca()}))},localName:"codepoint-equal",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:0}},{l:[{type:1,g:0},{type:1,g:3}],m:function(e,t,n,r,o){return Le([r,o],(function(e){var t=c(e);e=t.next().value,t=t.next().value,e=e?e.value:"",t=t.value;var n=In.get(t);if(!n){try{n=ln.compile(t,{language:"xpath"})}catch(e){throw Error("FORX0002: "+e)}In.set(t,n)}return n(e)?ce.ca():ce.X()}))},localName:"matches",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[{type:1,g:0},{type:1,g:3},{type:1,g:3}],m:function(e,t,n,r,o,a){return Le([r,o,a],(function(e){var t=c(e);e=t.next().value;var n=t.next().value;if(t=t.next().value,e=e?e.value:"",n=n.value,(t=t.value).includes("$0"))throw Error("Using $0 in fn:replace to replace substrings with full matches is not supported.");return t=t.split(/((?:\$\$)|(?:\\\$)|(?:\\\\))/).map((function(e){switch(e){case"\\$":return"$$";case"\\\\":return"\\";case"$$":throw Error('FORX0004: invalid replacement: "$$"');default:return e}})).join(""),n=Sn(n),e=e.replace(n,t),ce.o(Y(e,1))}))},localName:"replace",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:1,g:0},{type:1,g:3},{type:1,g:3},{type:1,g:3}],localName:"replace",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3},m:function(){throw Error("Not implemented: Using flags in replace is not supported")}}];function Rn(e,t,n,r){if(null===t.N)throw Error("XPDY0002: The function which was called depends on dynamic context, which is absent.");return e(t,n,r,ce.o(t.N))}function Dn(e,t,n,r){return Le([r],(function(e){if(null===(e=c(e).next().value))return ce.empty();switch((e=e.value).node.nodeType){case 1:case 2:return ce.o(Y(new ve(e.node.prefix,e.node.namespaceURI,e.node.localName),23));case 7:return ce.o(Y(new ve("","",e.node.target),23));default:return ce.empty()}}))}function Un(e,t,n,r){return r.$({default:function(){return xn(0,t,0,Dn(0,0,0,r))},empty:function(){return ce.empty()}})}function Mn(e,t,n,r){return Ut(r,t)}function kn(e,t,n,r){return Le([r],(function(e){return null!==(e=(e=c(e).next().value)?e.value:null)&&Me(t.h,e,null)?ce.ca():ce.X()}))}function Gn(e,t,n,r){return Le([r],(function(e){function n(e){for(var t=0,n=e;null!==n;)(e.node.nodeType!==n.node.nodeType?0:1===n.node.nodeType?n.node.localName===e.node.localName&&n.node.namespaceURI===e.node.namespaceURI:7===n.node.nodeType?n.node.target===e.node.target:1)&&t++,n=Pe(o,n,null);return t}var r=c(e).next().value;if(null===r)return ce.empty();var o=t.h;for(e="",r=r.value;null!==Fe(t.h,r,null);r=Fe(t.h,r,null))switch(r.node.nodeType){case 1:var a=r;e="/Q{"+(a.node.namespaceURI||"")+"}"+a.node.localName+"["+n(a)+"]"+e;break;case 2:e="/@"+((a=r).node.namespaceURI?"Q{"+a.node.namespaceURI+"}":"")+a.node.localName+e;break;case 3:e="/text()["+n(r)+"]"+e;break;case 7:e="/processing-instruction("+(a=r).node.target+")["+n(a)+"]"+e;break;case 8:e="/comment()["+n(r)+"]"+e}return 9===r.node.nodeType?ce.create(Y(e||"/",1)):ce.create(Y("Q{http://www.w3.org/2005/xpath-functions}root()"+e,1))}))}function Fn(e,t,n,r){return r.map((function(e){return Y(e.value.node.namespaceURI||"",20)}))}function Pn(e,t,n,r){return r.$({default:function(){return r.map((function(e){return 7===e.value.node.nodeType?Y(e.value.node.target,1):Y(e.value.node.localName||"",1)}))},empty:function(){return ce.o(Y("",1))}})}function Hn(e,t,n){if(2===t.node.nodeType)return en(t,n);for(;n;){if(en(t,n))return!0;if(9===n.node.nodeType)break;n=Fe(e,n,null)}return!1}function _n(e,t,n,r){return r.map((function(e){if(!ee(e.type,53))throw Error("XPTY0004 Argument passed to fn:root() should be of the type node()");for(e=e.value;e;){var n=e;e=Fe(t.h,n,null)}return Xe(n)}))}var jn=[{l:[{type:53,g:0}],m:Un,localName:"name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:0}},{l:[],m:Rn.bind(null,Un),localName:"name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:53,g:3}],m:Fn,localName:"namespace-uri",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:20,g:3}},{l:[],m:Rn.bind(null,Fn),localName:"namespace-uri",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:20,g:3}},{l:[{type:53,g:2}],m:function(e,t,n,r){return r.L((function(e){return e.length?(e=sn(t.h,e).reduceRight((function(e,n,r,o){return r===o.length-1?(e.push(n),e):(Hn(t.h,n.value,e[0].value)||e.unshift(n),e)}),[]),ce.create(e)):ce.empty()}))},localName:"innermost",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:53,g:2}},{l:[{type:53,g:2}],m:function(e,t,n,r){return r.L((function(e){return e.length?(e=sn(t.h,e).reduce((function(e,n,r){return 0===r?(e.push(n),e):(Hn(t.h,e[e.length-1].value,n.value)||e.push(n),e)}),[]),ce.create(e)):ce.empty()}),1)},localName:"outermost",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:53,g:2}},{l:[{type:53,g:0}],m:kn,localName:"has-children",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[],m:Rn.bind(null,kn),localName:"has-children",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[{type:53,g:0}],m:Gn,localName:"path",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:0}},{l:[],m:Rn.bind(null,Gn),localName:"path",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:0}},{l:[{type:53,g:0}],m:Dn,localName:"node-name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:23,g:0}},{l:[],m:Rn.bind(null,Dn),localName:"node-name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:23,g:0}},{l:[{type:53,g:0}],m:Pn,localName:"local-name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[],m:Rn.bind(null,Pn),localName:"local-name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:53,g:0}],m:_n,localName:"root",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:53,g:0}},{l:[],m:Rn.bind(null,_n),localName:"root",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:53,g:0}},{l:[],m:Rn.bind(null,Mn),localName:"data",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:2}},{l:[{type:59,g:2}],m:Mn,localName:"data",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:2}}];function Xn(e,t){var n=0,r=e.length,o=!1,a=null;return{next:function(){if(!o){for(;n<r;){a||(a=t(e[n],n,e));var i=a.next(0);if(a=null,!i.value)return W(!1);n++}return o=!0,W(!0)}return z}}}function Ln(e){return 1===(e=e.node.nodeType)||3===e}function $n(e,t){if((ee(e.type,4)||ee(e.type,6))&&(ee(t.type,4)||ee(t.type,6))){var n=zt(e,6),r=zt(t,6);return n.value===r.value||isNaN(e.value)&&isNaN(t.value)}return(ee(e.type,4)||ee(e.type,6)||ee(e.type,3))&&(ee(t.type,4)||ee(t.type,6)||ee(t.type,3))?(n=zt(e,3),r=zt(t,3),n.value===r.value||isNaN(e.value)&&isNaN(t.value)):ee(e.type,23)&&ee(t.type,23)?e.value.namespaceURI===t.value.namespaceURI&&e.value.localName===t.value.localName:(ee(e.type,9)||ee(e.type,7)||ee(e.type,8)||ee(e.type,11)||ee(e.type,12)||ee(e.type,13)||ee(e.type,14)||ee(e.type,15))&&(ee(t.type,9)||ee(t.type,7)||ee(t.type,8)||ee(t.type,11)||ee(t.type,12)||ee(t.type,13)||ee(t.type,14)||ee(t.type,15))?pt(e.value,t.value):(ee(e.type,16)||ee(e.type,17)||ee(e.type,18))&&(ee(t.type,16)||ee(t.type,17)||ee(t.type,17))?Qe(e.value,t.value):e.value===t.value}function qn(e,t,n){return n=c([t,n].map((function(t){return{type:1,value:t.reduce((function(t,n){return t+Dt(n,e).first().value}),"")}}))),W($n(t=n.next().value,n=n.next().value))}function Yn(e,t,n,r){for(;e.value&&ee(e.value.type,56);){t.push(e.value);var o=Ge(r,e.value.value);if(e=n.next(0),o&&3!==o.node.nodeType)break}return e}function Vn(e,t,n,r,o){var a,i=t.h,s=r.value,u=o.value,c=null,l=null,p=null,h=[],f=[];return{next:function(){for(;!a;)if(c||(c=s.next(0)),c=Yn(c,h,s,i),l||(l=u.next(0)),l=Yn(l,f,u,i),h.length||f.length){var r=qn(t,h,f);if(h.length=0,f.length=0,!1===r.value)return a=!0,r}else{if(c.done||l.done)return a=!0,W(c.done===l.done);if(p||(p=Jn(e,t,n,c.value,l.value)),r=p.next(0),p=null,!1===r.value)return a=!0,r;l=c=null}return z}}}function Qn(e,t,n,r,o){return r=De(t.h,r.value),o=De(t.h,o.value),r=r.filter((function(e){return Ln(e)})),o=o.filter((function(e){return Ln(e)})),r=ce.create(r.map((function(e){return Xe(e)}))),o=ce.create(o.map((function(e){return Xe(e)}))),Vn(e,t,n,r,o)}function Jn(e,t,n,r,o){if(ee(r.type,46)&&ee(o.type,46))return Wt($n(r,o));if(ee(r.type,61)&&ee(o.type,61))return function(e,t,n,r,o){return r.h.length!==o.h.length?Wt(!1):Xn(r.h,(function(r){var a=o.h.find((function(e){return $n(e.key,r.key)}));return a?Vn(e,t,n,r.value(),a.value()):Wt(!1)}))}(e,t,n,r,o);if(ee(r.type,62)&&ee(o.type,62))return function(e,t,n,r,o){return r.R.length!==o.R.length?Wt(!1):Xn(r.R,(function(r,a){return a=o.R[a],Vn(e,t,n,r(),a())}))}(e,t,n,r,o);if(ee(r.type,53)&&ee(o.type,53)){if(ee(r.type,55)&&ee(o.type,55))return Qn(e,t,n,r,o);if(ee(r.type,54)&&ee(o.type,54))return function(e,t,n,r,o){var a=Vn(e,t,n,Dn(0,0,0,ce.o(r)),Dn(0,0,0,ce.o(o))),i=Qn(e,t,n,r,o);r=Oe(t.h,r.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)})),o=Oe(t.h,o.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=Vn(e,t,n,ce.create(r),ce.create(o)),u=!1;return{next:function(){if(u)return z;var e=a.next(0);return!e.done&&!1===e.value||!(e=s.next(0)).done&&!1===e.value?(u=!0,e):(e=i.next(0),u=!0,e)}}}(e,t,n,r,o);if(ee(r.type,47)&&ee(o.type,47)||ee(r.type,57)&&ee(o.type,57)||ee(r.type,58)&&ee(o.type,58))return function(e,t,n,r,o){var a=Vn(e,t,n,Dn(0,0,0,ce.o(r)),Dn(0,0,0,ce.o(o))),i=!1;return{next:function(){if(i)return z;var e=a.next(0);return e.done||!1!==e.value?W($n(Dt(r,t).first(),Dt(o,t).first())):(i=!0,e)}}}(e,t,n,r,o)}return Wt(!1)}function Kn(e){return Error("XUST0001: "+(void 0===e?"Can not execute an updating expression in a non-updating context.":e))}function zn(e){return Error("XUTY0004: The attribute "+e.name+'="'+e.value+'" follows a node that is not an attribute node.')}function Wn(){return Error("XUTY0005: The target of a insert expression with into must be a single element or document node.")}function Zn(){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 er(){return Error("XUTY0008: The target of a replace expression must be a single element, attribute, text, comment, or processing instruction node.")}function tr(){return Error("XUTY0012: The target of a rename expression must be a single element, attribute, or processing instruction node.")}function nr(e){return Error("XUDY0017: The target "+e.outerHTML+" is used in more than one replace value of expression.")}function rr(e){return Error("XUDY0021: Applying the updates will result in the XDM instance violating constraint: '"+e+"'")}function or(e){return Error("XUDY0023: The namespace binding "+e+" is conflicting.")}function ar(e){return Error("XUDY0024: The namespace binding "+e+" is conflicting.")}function ir(){return Error("XUDY0027: The target for an insert, replace, or rename expression expression should not be empty.")}function sr(e,t,n,r,o){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=o}function ur(e,t,n){return t&&null!==t.N&&e.C?(null===e.Ya&&(e.Ya=le(e.h(null,n).ob())),e=e.Ya()):e=e.h(t,n),e}function cr(e,t){this.H=e,this.fa=t}function lr(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 pr(e,t,n){t.forEach((function(t){n.insertBefore(e.node,t.node,null)}))}function hr(e,t,n,r){var o=Fe(n,e),a=e.node.nodeType;if(2===a){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=o?o.node:null;r.removeAttributeNS(i,e.node.namespaceURI,e.node.nodeName),t.forEach((function(e){var t=e.node.nodeName;if(Re(n,o,t))throw rr("An attribute "+t+" already exists.");r.setAttributeNS(i,e.node.namespaceURI,t,Ue(n,e))}))}if(1===a||3===a||8===a||7===a){var s=(a=Ge(n,e))?a.node:null;r.removeChild(o.node,e.node),t.forEach((function(e){r.insertBefore(o.node,e.node,s)}))}}function fr(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 nr(e)})),r("replaceElementContent",(function(e){throw nr(e)}));var o=new Map;e.filter((function(e){return"replaceNode"===e.type&&2===e.target.node.nodeType})).forEach((function(e){var r=Fe(t,e.target);r=r?r.node:null;var a=o.get(r);a?a.push.apply(a,p(e.s.map(n))):o.set(r,e.s.map(n))})),e.filter((function(e){return"rename"===e.type&&2===e.target.node.nodeType})).forEach((function(e){var n=Fe(t,e.target);if(n){n=n.node;var r=o.get(n);r?r.push(e.s):o.set(n,[e.s])}})),o.forEach((function(e){var t={};e.forEach((function(e){if(t[e.prefix]||(t[e.prefix]=e.namespaceURI),t[e.prefix]!==e.namespaceURI)throw ar(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":pr(e.target,e.content,r);break;case"insertAttributes":!function(e,t,n,r){t.forEach((function(t){var o=t.node.nodeName;if(Re(n,e,o))throw rr("An attribute "+o+" already exists.");r.setAttributeNS(e.node,t.node.namespaceURI,o,Ue(n,t))}))}(e.target,e.content,t,r);break;case"rename":!function(e,t,n,r,o){switch(r||(r=new lr(e?e.node:null)),e.node.nodeType){case 1:var a=n.getAllAttributes(e.node),i=n.getChildNodes(e.node),s=r.createElementNS(t.namespaceURI,t.va()),u={node:s,F:null};a.forEach((function(e){o.setAttributeNS(s,e.namespaceURI,e.nodeName,e.value)})),i.forEach((function(e){o.insertBefore(s,e,null)}));break;case 2:(t=r.createAttributeNS(t.namespaceURI,t.va())).value=Ue(n,e),u={node:t,F:null};break;case 7:u={node:r.createProcessingInstruction(t.va(),Ue(n,e)),F:null}}if(!Fe(n,e))throw Error("Not supported: renaming detached nodes.");hr(e,[u],n,o)}(e.target,e.s,t,n,r);break;case"replaceValue":var o=e.target;if(e=e.s,2===o.node.nodeType){var a=Fe(t,o);a?r.setAttributeNS(a.node,o.node.namespaceURI,o.node.nodeName,e):o.node.value=e}else r.setData(o.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 o=Fe(n,e).node,a=(e=Ge(n,e))?e.node:null;t.forEach((function(e){r.insertBefore(o,e.node,a)}))}(e.target,e.content,t,r);break;case"insertBefore":!function(e,t,n,r){var o=Fe(n,e).node;t.forEach((function(t){r.insertBefore(o,t.node,e.node)}))}(e.target,e.content,t,r);break;case"insertIntoAsFirst":!function(e,t,n,r){var o=(n=Me(n,e))?n.node:null;t.forEach((function(t){r.insertBefore(e.node,t.node,o)}))}(e.target,e.content,t,r);break;case"insertIntoAsLast":pr(e.target,e.content,r)}})),e.filter((function(e){return"replaceNode"===e.type})).forEach((function(e){hr(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=Fe(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 dr(e,t){for(var n=[],r=1;r<arguments.length;++r)n[r-1]=arguments[r];return e.concat.apply(e,p(n.filter(Boolean)))}function mr(e,t,n,r){sr.call(this,e,t,n,!0,r),this.I=!0}function gr(e){return e.I?function(t,n){return e.u(t,n)}:function(t,n){var r=e.h(t,n);return{next:function(){return W({fa:[],H:r.M()})}}}}function yr(e,t){return t((e=e.next(0)).value.fa),ce.create(e.value.H)}function vr(e,t,n,r){mr.call(this,e,t,n,r),this.I=this.ha.some((function(e){return e.I}))}sr.prototype.A=function(){return null},sr.prototype.P=function(e){if(this.ha.forEach((function(t){return t.P(e)})),!this.bc&&this.ha.some((function(e){return e.I})))throw Kn()},(r=lr.prototype).createAttributeNS=function(e,t){if(!this.h)throw Error("Please pass a node factory if an XQuery script uses node constructors");return this.h.createAttributeNS(e,t)},r.createCDATASection=function(e){if(!this.h)throw Error("Please pass a node factory if an XQuery script uses node constructors");return this.h.createCDATASection(e)},r.createComment=function(e){if(!this.h)throw Error("Please pass a node factory if an XQuery script uses node constructors");return this.h.createComment(e)},r.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)},r.createElementNS=function(e,t){if(!this.h)throw Error("Please pass a node factory if an XQuery script uses node constructors");return this.h.createElementNS(e,t)},r.createProcessingInstruction=function(e,t){if(!this.h)throw Error("Please pass a node factory if an XQuery script uses node constructors");return this.h.createProcessingInstruction(e,t)},r.createTextNode=function(e){if(!this.h)throw Error("Please pass a node factory if an XQuery script uses node constructors");return this.h.createTextNode(e)},y(mr,sr),mr.prototype.h=function(){throw Kn()},y(vr,mr),vr.prototype.h=function(e,t){return this.B(e,t,this.ha.map((function(e){return function(n){return e.h(n,t)}})))},vr.prototype.u=function(e,t){var n=[],r=this.B(e,t,this.ha.map((function(e){return e.I?function(r){return yr(r=e.u(r,t),(function(e){return n=dr(n,e)}))}:function(n){return e.h(n,t)}}))),o=!1;return{next:function(){if(o)return z;var e=r.M();return o=!0,W(new cr(e,n))}}},vr.prototype.P=function(e){mr.prototype.P.call(this,e),function(e){e.ha.some((function(e){return e.I}))&&(e.I=!0)}(this)};var wr=["external","attribute","nodeName","nodeType","universal"],Ar=wr.length;function xr(e){if(this.h=wr.map((function(t){return e[t]||0})),Object.keys(e).some((function(e){return!wr.includes(e)})))throw Error("Invalid specificity kind passed")}function br(e,t){for(var n=0;n<Ar;++n){if(t.h[n]<e.h[n])return 1;if(t.h[n]>e.h[n])return-1}return 0}function Er(){return St("Expected base expression of a function call to evaluate to a sequence of single function item")}function Nr(e,t,n,r){for(var o=[],a=0;a<t.length;++a)if(null===t[a])o.push(null);else{var i=fn(e[a],t[a],n,r,!1);o.push(i)}return o}function Br(e,t){if(!ee(e.type,60))throw St("Expected base expression to evaluate to a function item");if(e.A!==t)throw Er();return e}function Tr(e,t,n,r,o,a,i){var s=0;return o=o.map((function(e){return e?null:a[s++](n)})),0<=(o=Nr(e.s,o,r,e.j)).indexOf(null)?function(e,t){var n=e.value,r=t.map((function(e){return null===e?null:le(e)}));return t=t.reduce((function(t,n,r){return null===n&&t.push(e.s[r]),t}),[]),t=new we({l:t,arity:t.length,Pa:!0,I:e.I,localName:"boundFunction",namespaceURI:e.u,i:e.O,value:function(e,t,o){var a=Array.from(arguments).slice(3),i=r.map((function(e){return null===e?a.shift():e()}));return n.apply(void 0,[e,t,o].concat(i))}}),ce.o(t)}(e,o):(t=t.apply(void 0,[n,r,i].concat(p(o))),fn(e.O,t,r,e.j,!0))}function Ir(e,t,n){var r={};vr.call(this,new xr((r.external=1,r)),[e].concat(t.filter((function(e){return!!e}))),{S:"unsorted",Y:!1,subtree:!1,C:!1},n),this.ka=t.length,this.T=t.map((function(e){return null===e})),this.J=null,this.na=e,this.ua=t}function Cr(e,t,n,r,o,a){return Le([r,o,a],(function(e){var t=c(e);e=t.next().value;var n=t.next().value;if(t=t.next().value,n=n.value,t=t.value,n>e.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 ce.o(new _e(e.R.slice(n-1,t+n-1)))}))}function Sr(e,t,n,r,o){return Le([r],(function(e){var t=c(e).next().value;return o.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,o=e.length;r<o;++r){var a=e[r];if(a>t.R.length||0>=a)throw Error("FOAY0001: subarray position out of bounds.");n.splice(a-1,1)}return ce.o(new _e(n))}))}))}function Or(e){return ee(e,1)||ee(e,20)||ee(e,19)}function Rr(e,t,n,r,o){return 0===r.length?0!==o.length:0!==o.length&&Jn(e,t,n,r[0],o[0]).next(0).value?Rr(e,t,n,r.slice(1),o.slice(1)):r[0].value!=r[0].value||(Or(r[0].type)&&0!==o.length&&Or(o[0].type)||0!==o.length)&&r[0].value<o[0].value}function Dr(e,t,n,r){return r.sort((function(r,o){return Vn(e,t,n,ce.create(r),ce.create(o)).next(0).value?0:Rr(e,t,n,r,o)?-1:1})),ce.o(new _e(r.map((function(e){return function(){return ce.create(e)}}))))}function Ur(e,t){return ee(t.type,62)?t.R.reduce((function(e,t){return t().L((function(t){return t.reduce(Ur,e)}))}),e):It([e,ce.o(t)])}xr.prototype.add=function(e){var t=this,n=wr.reduce((function(n,r,o){return n[r]=t.h[o]+e.h[o],n}),Object.create(null));return new xr(n)},y(Ir,vr),Ir.prototype.u=function(e,t){var n=this;if(!this.j||!this.j.I)return vr.prototype.u.call(this,e,t);var r=[],o=Tr(this.j,(function(e,t,o,a){for(var i=[],s=3;s<arguments.length;++s)i[s-3]=arguments[s];return yr(n.j.value.apply(n.j,[e,t,o].concat(p(i))),(function(e){r=dr(r,e)}))}),e,t,this.T,this.ua.map((function(n){return function(){return n.I?yr(n.u(e,t),(function(e){r=dr(r,e)})):ur(n,e,t)}})),this.J),a=!1;return{next:function(){if(a)return z;var e=o.M();return a=!0,W({fa:r,H:e})}}},Ir.prototype.B=function(e,t,n){var r=this,o=(n=c(n)).next().value,a=l(n);if(this.j)return Tr(this.j,(function(e,t,n,o){for(var a=[],i=3;i<arguments.length;++i)a[i-3]=arguments[i];return r.j.value.apply(r.j,[e,t,n].concat(p(a)))}),e,t,this.T,a,this.J);var i=o(e);return i.$({default:function(){throw Er()},o:function(){return i.L((function(n){if((n=Br(n=c(n).next().value,r.ka)).I)throw Error("XUDY0038: The function returned by the PrimaryExpr of a dynamic function invocation can not be an updating function");return Tr(n,n.value,e,t,r.T,a,r.J)}))}})},Ir.prototype.P=function(e){if(this.J=vo(e),vr.prototype.P.call(this,e),this.na.C){if(!(e=ur(this.na,null,null)).ya())throw Er();this.j=Br(e.first(),this.ka),this.j.I&&(this.I=!0)}};var Mr=[{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"size",l:[{type:62,g:3}],i:{type:5,g:3},m:function(e,t,n,r){return Le([r],(function(e){return e=c(e).next().value,ce.o(Y(e.R.length,5))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"get",l:[{type:62,g:3},{type:5,g:3}],i:{type:59,g:2},m:He},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"put",l:[{type:62,g:3},{type:5,g:3},{type:59,g:2}],i:{type:62,g:3},m:function(e,t,n,r,o,a){return Le([o,r],(function(e){var t=c(e);if(e=t.next().value,t=t.next().value,0>=(e=e.value)||e>t.R.length)throw Error("FOAY0001: array position out of bounds.");return(t=t.R.concat()).splice(e-1,1,le(a)),ce.o(new _e(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,o){return Le([r],(function(e){return e=c(e).next().value.R.concat([le(o)]),ce.o(new _e(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:Cr},{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,o){var a=ce.o(Y(r.first().value.length-o.first().value+1,5));return Cr(0,0,0,r,o,a)}},{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:Sr},{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,o,a){return Le([r,o],(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,le(a)),ce.o(new _e(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 He(0,0,0,r,ce.o(Y(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 Sr(0,0,0,r,ce.o(Y(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 Le([r],(function(e){return e=c(e).next().value,ce.o(new _e(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)}),[]),ce.o(new _e(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,o){return Le([r,o],(function(r){var o=(r=c(r)).next().value,a=r.next().value;if(1!==a.A)throw St("The callback passed into array:for-each has a wrong arity.");return r=o.R.map((function(r){return le(a.value.call(void 0,e,t,n,Nr(a.s,[r()],t,"array:for-each")[0]))})),ce.o(new _e(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,o){return Le([r,o],(function(r){var o=(r=c(r)).next().value,a=r.next().value;if(1!==a.A)throw St("The callback passed into array:filter has a wrong arity.");var i=o.R.map((function(r){return r=Nr(a.s,[r()],t,"array:filter")[0],(0,a.value)(e,t,n,r)})),s=[],u=!1;return ce.create({next:function(){if(u)return z;for(var e=0,t=o.R.length;e<t;++e){var n=i[e].getEffectiveBooleanValue();s[e]=n}return e=o.R.filter((function(e,t){return s[t]})),u=!0,W(new _e(e))}})}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"fold-left",l:[{type:62,g:3},{type:59,g:2},{type:60,g:3}],i:{type:59,g:2},m:function(e,t,n,r,o,a){return Le([r,a],(function(r){var a=(r=c(r)).next().value,i=r.next().value;if(2!==i.A)throw St("The callback passed into array:fold-left has a wrong arity.");return a.R.reduce((function(r,o){return o=Nr(i.s,[o()],t,"array:fold-left")[0],i.value.call(void 0,e,t,n,r,o)}),o)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"fold-right",l:[{type:62,g:3},{type:59,g:2},{type:60,g:3}],i:{type:59,g:2},m:function(e,t,n,r,o,a){return Le([r,a],(function(r){var a=(r=c(r)).next().value,i=r.next().value;if(2!==i.A)throw St("The callback passed into array:fold-right has a wrong arity.");return a.R.reduceRight((function(r,o){return o=Nr(i.s,[o()],t,"array:fold-right")[0],i.value.call(void 0,e,t,n,r,o)}),o)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"for-each-pair",l:[{type:62,g:3},{type:62,g:3},{type:60,g:3}],i:{type:62,g:3},m:function(e,t,n,r,o,a){return Le([r,o,a],(function(r){var o=c(r);r=o.next().value;var a=o.next().value;if(2!==(o=o.next().value).A)throw St("The callback passed into array:for-each-pair has a wrong arity.");for(var i=[],s=0,u=Math.min(r.R.length,a.R.length);s<u;++s){var l=c(Nr(o.s,[r.R[s](),a.R[s]()],t,"array:for-each-pair")),p=l.next().value;l=l.next().value,i[s]=le(o.value.call(void 0,e,t,n,p,l))}return ce.o(new _e(i))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"sort",l:[{type:62,g:3}],i:{type:62,g:3},m:function(e,t,n,r){return Le([r],(function(r){return r=c(r).next().value.R.map((function(e){return e().M()})),Dr(e,t,n,r)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"flatten",l:[{type:59,g:2}],i:{type:59,g:2},m:function(e,t,n,r){return r.L((function(e){return e.reduce(Ur,ce.empty())}))}}];function kr(e,t,n,r,o){return o.G()?o:ce.o(zt(o.first(),e))}var Gr=[{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"untypedAtomic",l:[{type:46,g:0}],i:{type:19,g:0},m:kr.bind(null,19)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"error",l:[{type:46,g:0}],i:{type:39,g:0},m:kr.bind(null,39)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"string",l:[{type:46,g:0}],i:{type:1,g:0},m:kr.bind(null,1)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"boolean",l:[{type:46,g:0}],i:{type:0,g:0},m:kr.bind(null,0)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"decimal",l:[{type:46,g:0}],i:{type:4,g:0},m:kr.bind(null,4)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"float",l:[{type:46,g:0}],i:{type:6,g:0},m:kr.bind(null,6)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"double",l:[{type:46,g:0}],i:{type:3,g:0},m:kr.bind(null,3)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"duration",l:[{type:46,g:0}],i:{type:18,g:0},m:kr.bind(null,18)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"dateTime",l:[{type:46,g:0}],i:{type:9,g:0},m:kr.bind(null,9)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"dateTimeStamp",l:[{type:46,g:0}],i:{type:10,g:0},m:kr.bind(null,10)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"time",l:[{type:46,g:0}],i:{type:8,g:0},m:kr.bind(null,8)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"date",l:[{type:46,g:0}],i:{type:7,g:0},m:kr.bind(null,7)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"gYearMonth",l:[{type:46,g:0}],i:{type:11,g:0},m:kr.bind(null,11)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"gYear",l:[{type:46,g:0}],i:{type:12,g:0},m:kr.bind(null,12)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"gMonthDay",l:[{type:46,g:0}],i:{type:13,g:0},m:kr.bind(null,13)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"gDay",l:[{type:46,g:0}],i:{type:15,g:0},m:kr.bind(null,15)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"gMonth",l:[{type:46,g:0}],i:{type:14,g:0},m:kr.bind(null,14)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"hexBinary",l:[{type:46,g:0}],i:{type:22,g:0},m:kr.bind(null,22)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"base64Binary",l:[{type:46,g:0}],i:{type:21,g:0},m:kr.bind(null,21)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"QName",l:[{type:46,g:0}],i:{type:23,g:0},m:function(e,t,n,r){if(r.G())return r;if(ee((e=r.first()).type,2))throw Error("XPTY0004: The provided QName is not a string-like value.");if(!Gt(e=kt(e=zt(e,1).value,23),23))throw Error("FORG0001: The provided QName is invalid.");if(!e.includes(":"))return n=n.ba(""),ce.o(Y(new ve("",n,e),23));if(t=(r=c(e.split(":"))).next().value,r=r.next().value,!(n=n.ba(t)))throw Error("FONS0004: The value "+e+" can not be cast to a QName. Did you mean to use fn:QName?");return ce.o(Y(new ve(t,n,r),23))}},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"anyURI",l:[{type:46,g:0}],i:{type:20,g:0},m:kr.bind(null,20)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"normalizedString",l:[{type:46,g:0}],i:{type:48,g:0},m:kr.bind(null,48)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"token",l:[{type:46,g:0}],i:{type:52,g:0},m:kr.bind(null,52)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"language",l:[{type:46,g:0}],i:{type:51,g:0},m:kr.bind(null,51)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"NMTOKEN",l:[{type:46,g:0}],i:{type:50,g:0},m:kr.bind(null,50)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"NMTOKENS",l:[{type:46,g:0}],i:{type:49,g:2},m:kr.bind(null,49)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"Name",l:[{type:46,g:0}],i:{type:25,g:0},m:kr.bind(null,25)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"NCName",l:[{type:46,g:0}],i:{type:24,g:0},m:kr.bind(null,24)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"ID",l:[{type:46,g:0}],i:{type:42,g:0},m:kr.bind(null,42)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"IDREF",l:[{type:46,g:0}],i:{type:41,g:0},m:kr.bind(null,41)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"IDREFS",l:[{type:46,g:0}],i:{type:43,g:2},m:kr.bind(null,43)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"ENTITY",l:[{type:46,g:0}],i:{type:26,g:0},m:kr.bind(null,26)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"ENTITIES",l:[{type:46,g:0}],i:{type:40,g:2},m:kr.bind(null,40)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"integer",l:[{type:46,g:0}],i:{type:5,g:0},m:kr.bind(null,5)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"nonPositiveInteger",l:[{type:46,g:0}],i:{type:27,g:0},m:kr.bind(null,27)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"negativeInteger",l:[{type:46,g:0}],i:{type:28,g:0},m:kr.bind(null,28)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"long",l:[{type:46,g:0}],i:{type:31,g:0},m:kr.bind(null,31)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"int",l:[{type:46,g:0}],i:{type:32,g:0},m:kr.bind(null,32)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"short",l:[{type:46,g:0}],i:{type:33,g:0},m:kr.bind(null,33)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"byte",l:[{type:46,g:0}],i:{type:34,g:0},m:kr.bind(null,34)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"nonNegativeInteger",l:[{type:46,g:0}],i:{type:30,g:0},m:kr.bind(null,30)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"unsignedLong",l:[{type:46,g:0}],i:{type:36,g:0},m:kr.bind(null,36)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"unsignedInt",l:[{type:46,g:0}],i:{type:35,g:0},m:kr.bind(null,35)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"unsignedShort",l:[{type:46,g:0}],i:{type:38,g:0},m:kr.bind(null,38)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"unsignedByte",l:[{type:46,g:0}],i:{type:37,g:0},m:kr.bind(null,37)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"positiveInteger",l:[{type:46,g:0}],i:{type:29,g:0},m:kr.bind(null,29)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"yearMonthDuration",l:[{type:46,g:0}],i:{type:16,g:0},m:kr.bind(null,16)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"dayTimeDuration",l:[{type:46,g:0}],i:{type:17,g:0},m:kr.bind(null,17)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"dateTimeStamp",l:[{type:46,g:0}],i:{type:10,g:0},m:kr.bind(null,10)}];function Fr(e,t,n,r){return r.G()?r:ce.o(Y(r.first().value.getYear(),5))}function Pr(e,t,n,r){return r.G()?r:ce.o(Y(r.first().value.getMonth(),5))}function Hr(e,t,n,r){return r.G()?r:ce.o(Y(r.first().value.getDay(),5))}function _r(e,t,n,r){return r.G()?r:ce.o(Y(r.first().value.getHours(),5))}function jr(e,t,n,r){return r.G()?r:ce.o(Y(r.first().value.getMinutes(),5))}function Xr(e,t,n,r){return r.G()||(t=(e=ce).o,r=r.first().value,r=t.call(e,Y(r.j+r.pa,4))),r}function Lr(e,t,n,r){return r.G()?r:(e=r.first().value.Z)?ce.o(Y(e,17)):ce.empty()}var $r=[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"dateTime",l:[{type:7,g:0},{type:8,g:0}],i:{type:9,g:0},m:function(e,t,n,r,o){if(r.G())return r;if(o.G())return o;if(e=r.first().value,o=o.first().value,t=e.Z,n=o.Z,t||n){if(!t||n)if(!t&&n)t=n;else if(!Qe(t,n))throw Error("FORG0008: fn:dateTime: got a date and time value with different timezones.")}else t=null;return ce.o(Y(new it(e.getYear(),e.getMonth(),e.getDay(),o.getHours(),o.getMinutes(),o.getSeconds(),o.pa,t),9))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"year-from-dateTime",l:[{type:9,g:0}],i:{type:5,g:0},m:Fr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"month-from-dateTime",l:[{type:9,g:0}],i:{type:5,g:0},m:Pr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"day-from-dateTime",l:[{type:9,g:0}],i:{type:5,g:0},m:Hr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"hours-from-dateTime",l:[{type:9,g:0}],i:{type:5,g:0},m:_r},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"minutes-from-dateTime",l:[{type:9,g:0}],i:{type:5,g:0},m:jr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"seconds-from-dateTime",l:[{type:9,g:0}],i:{type:4,g:0},m:Xr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"timezone-from-dateTime",l:[{type:9,g:0}],i:{type:17,g:0},m:Lr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"year-from-date",l:[{type:7,g:0}],i:{type:5,g:0},m:Fr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"month-from-date",l:[{type:7,g:0}],i:{type:5,g:0},m:Pr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"day-from-date",l:[{type:7,g:0}],i:{type:5,g:0},m:Hr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"timezone-from-date",l:[{type:7,g:0}],i:{type:17,g:0},m:Lr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"hours-from-time",l:[{type:8,g:0}],i:{type:5,g:0},m:_r},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"minutes-from-time",l:[{type:8,g:0}],i:{type:5,g:0},m:jr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"seconds-from-time",l:[{type:8,g:0}],i:{type:4,g:0},m:Xr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"timezone-from-time",l:[{type:8,g:0}],i:{type:17,g:0},m:Lr}];function qr(e,t,n,r,o){return r.L((function(e){for(var n=Ut(ce.create(e),t).map((function(e){return zt(e,1)})).M(),r="",a=0;a<n.length;a++)r+="{type: "+n[a].type+", value: "+n[a].value+"}\n";return void 0!==o&&(r+=o.first().value),t.O.trace(r),ce.create(e)}))}var Yr=[{l:[{type:59,g:2}],m:qr,localName:"trace",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:1,g:3}],m:qr,localName:"trace",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}}];function Vr(e,t,n,r,o){throw e=void 0===r||r.G()?new ve("err","http://www.w3.org/2005/xqt-errors","FOER0000"):r.first().value,t="",void 0===o||o.G()||(t=": "+o.first().value),Error(""+e.localName+t)}var Qr=[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"error",l:[],i:{type:63,g:3},m:Vr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"error",l:[{type:23,g:0}],i:{type:63,g:3},m:Vr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"error",l:[{type:23,g:0},{type:1,g:3}],i:{type:63,g:3},m:Vr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"error",l:[{type:23,g:0},{type:1,g:3},{type:59,g:2}],i:{type:63,g:3},m:function(){throw Error("Not implemented: Using an error object in error is not supported")}}];function Jr(e){return"string"==typeof e?e:(e=(new Ee).getChildNodes(e).find((function(e){return 8===e.nodeType})))?e.data:"some expression"}function Kr(e,t){e=Error.call(this,e),this.message=e.message,"stack"in e&&(this.stack=e.stack),this.position={end:{la:t.end.la,line:t.end.line,offset:t.end.offset},start:{la:t.start.la,line:t.start.line,offset:t.start.offset}}}function zr(e,t){if(t instanceof Error)throw t;"string"!=typeof e&&(e=Jr(e));var n=Ba(t);e=e.replace("\r","").split("\n");var r=Math.floor(Math.log10(Math.min(n.end.line+2,e.length)))+1;throw e=e.reduce((function(e,t,o){var a=o+1;if(2<n.start.line-a||2<a-n.end.line)return e;if(o=Array(r).fill(" ",0,Math.floor(Math.log10(a))+1-r).join("")+a+": ",e.push(o+t),a>=n.start.line&&a<=n.end.line){var i=a<n.end.line?t.length+o.length:n.end.la-1+o.length;a=a>n.start.line?o.length:n.start.la-1+o.length,e.push(Array(o.length+t.length).fill(" ",0,a).fill("^",a,i).join(""))}return e}),[]),t=Ta(t).join("\n"),new Kr(e.join("\n")+"\n\n"+t,n)}y(Kr,Error);var Wr=Object.create(null);function Zr(e,t){for(var n=[],r=0;r<e.length+1;++r)n[r]=[];return function r(o,a){if(0===o)return a;if(0===a)return o;if(void 0!==n[o][a])return n[o][a];var i=0;return e[o-1]!==t[a-1]&&(i=1),i=Math.min(r(o-1,a)+1,r(o,a-1)+1,r(o-1,a-1)+i),n[o][a]=i}(e.length,t.length)}function eo(e){var t=Wr[e]?Wr[e]:Object.keys(Wr).map((function(t){return{name:t,wb:Zr(e,t.slice(t.lastIndexOf(":")+1))}})).sort((function(e,t){return e.wb-t.wb})).slice(0,5).filter((function(t){return t.wb<e.length/2})).reduce((function(e,t){return e.concat(Wr[t.name])}),[]).slice(0,5);return t.length?t.map((function(e){return'"Q{'+e.namespaceURI+"}"+e.localName+" ("+e.l.map((function(e){return 4===e?"...":me(e)})).join(", ")+')"'})).reduce((function(e,t,n,r){return 0===n?e+t:e+(n!==r.length-1?", ":" or ")+t}),"Did you mean ")+"?":"No similar functions found."}function to(e,t,n,r,o){Wr[e+":"+t]||(Wr[e+":"+t]=[]),Wr[e+":"+t].push({l:n,arity:n.length,m:o,I:!1,localName:t,namespaceURI:e,i:r})}var no={},ro=(no.xml="http://www.w3.org/XML/1998/namespace",no.xs="http://www.w3.org/2001/XMLSchema",no.fn="http://www.w3.org/2005/xpath-functions",no.map="http://www.w3.org/2005/xpath-functions/map",no.array="http://www.w3.org/2005/xpath-functions/array",no.math="http://www.w3.org/2005/xpath-functions/math",no.fontoxpath="http://fontoxml.com/fontoxpath",no.local="http://www.w3.org/2005/xquery-local-functions",no);function oo(e,t,n,r){this.Ca=[Object.create(null)],this.Da=Object.create(null),this.O=e,this.ha=Object.keys(t).reduce((function(e,n){return void 0===t[n]||(e[n]="Q{}"+n+"[0]"),e}),Object.create(null)),this.s=Object.create(null),this.h=Object.create(null),this.A=n,this.u=r,this.j=[]}function ao(e){return Error("XPTY0004: "+e)}function io(e,t){return e=2===e.node.nodeType?e.node.nodeName+'="'+Ue(t,e)+'"':e.node.outerHTML,Error("XQTY0024: The node "+e+" follows a node that is not an attribute node or a namespace node.")}function so(e){return Error('XQDY0044: The node name "'+e.va()+'" is invalid for a computed attribute constructor.')}function uo(){return Error("XQST0045: Functions and variables may not be declared in one of the reserved namespace URIs.")}function co(){return Error("XQST0060: Functions declared in a module or as an external function must reside in a namespace.")}function lo(){return Error("XQST0066: A Prolog may contain at most one default function namespace declaration.")}function po(){return Error("XQST0070: The prefixes xml and xmlns may not be used in a namespace declaration or be bound to another namespaceURI.")}function ho(e){return Error('XQDY0074: The value "'+e+'" of a name expressions cannot be converted to an expanded QName.')}function fo(e){return Error('XPST0081: The prefix "'+e+'" could not be resolved')}function mo(e,t){return"Q{"+(e||"")+"}"+t}function go(e,t){for(var n=e.length-1;0<=n;--n)if(t in e[n])return e[n][t]}function yo(e){this.s=e,this.O=this.h=0,this.j=[Object.create(null)],this.u=Object.create(null),this.A=null,this.Da=e&&e.Da,this.Ca=e&&e.Ca}function vo(e){for(var t=new yo(e.s),n=0;n<e.h+1;++n)t.j=[Object.assign(Object.create(null),t.j[0],e.j[n])],t.Ca=[Object.assign(Object.create(null),t.Ca[0],e.Ca[n])],t.u=Object.assign(Object.create(null),e.u),t.Da=e.Da,t.A=e.A;return t}function wo(e){e.O++,e.h++,e.j[e.h]=Object.create(null),e.Ca[e.h]=Object.create(null)}function Ao(e,t,n,r,o){if(r=mo(t,n)+"~"+r,e.u[r])throw Error('XQST0049: The function or variable "Q{'+t+"}"+n+'" is declared more than once.');e.u[r]=o}function xo(e,t,n){e.j[e.h][t]=n}function bo(e,t,n){return t=mo(t||"",n),e.Ca[e.h][t]=t+"["+e.O+"]"}function Eo(e,t,n,r){e.Da[mo(t||"",n)+"["+e.O+"]"]=r}function No(e){e.j.length=e.h,e.Ca.length=e.h,e.h--}function Bo(e,t){"*"===t||Array.isArray(t)||(t=[t]);for(var n=1;n<e.length;++n)if(Array.isArray(e[n])){var r=e[n];if("*"===t||t.includes(r[0]))return r}return null}function To(e){return 2>e.length?"":"object"==typeof e[1]?e[2]||"":e[1]||""}function Io(e,t){return Array.isArray(e)?"object"!=typeof(e=e[1])||Array.isArray(e)?null:t in e?e[t]:null:null}function Co(e,t){return t.reduce(Bo,e)}function So(e,t){for(var n=[],r=1;r<e.length;++r)if(Array.isArray(e[r])){var o=e[r];"*"!==t&&o[0]!==t||n.push(o)}return n}function Oo(e){return{localName:To(e),namespaceURI:Io(e,"URI"),prefix:Io(e,"prefix")}}function Ro(e){var t=Bo(e,"typeDeclaration");if(!t||Bo(t,"voidSequenceType"))return{type:59,g:2};e={type:function e(n){switch(n[0]){case"documentTest":return 55;case"elementTest":return 54;case"attributeTest":return 47;case"piTest":return 57;case"commentTest":return 58;case"textTest":return 56;case"anyKindTest":return 53;case"anyItemType":return 59;case"anyFunctionTest":case"functionTest":case"typedFunctionTest":return 60;case"anyMapTest":case"typedMapTest":return 61;case"anyArrayTest":case"typedArrayTest":return 62;case"atomicType":return ge([Io(n,"prefix"),To(n)].join(":"));case"parenthesizedItemType":return e(Bo(n,"*"));default:throw Error('Type declaration "'+Bo(t,"*")[0]+'" is not supported.')}}(Bo(t,"*")),g:3};var n=null,r=Bo(t,"occurrenceIndicator");switch(r&&(n=To(r)),n){case"*":return e.g=2,e;case"?":return e.g=0,e;case"+":return e.g=1,e;case"":case null:return e}}function Do(e,t,n){if("object"!=typeof e[1]||Array.isArray(e[1])){var r={};r[t]=n,e.splice(1,0,r)}else e[1][t]=n}function Uo(e,t,n){return(e<<20)+(t<<12)+(n.charCodeAt(0)<<8)+n.charCodeAt(1)}oo.prototype.za=function(e,t,n){return function(e,t,n){var r=Wr[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,i:r.i}:null}(e,t,n)},oo.prototype.qb=function(e,t){return e?null:(e=this.ha[t],this.s[t]||(this.s[t]={name:t}),e)},oo.prototype.Ra=function(e,t){var n=this.u(e,t);if(n)this.j.push({Bc:e,arity:t,Hb:n});else if(""===e.prefix){if(this.A)return{namespaceURI:this.A,localName:e.localName}}else if(t=this.ba(e.prefix,!0))return{namespaceURI:t,localName:e.localName};return n},oo.prototype.ba=function(e,t){return void 0===t||t?ro[e]?ro[e]:(t=this.O(e),this.h[e]||(this.h[e]={namespaceURI:t,prefix:e}),void 0!==t||e?t:null):null},yo.prototype.za=function(e,t,n,r){r=void 0!==r&&r;var o=this.u[mo(e,t)+"~"+n];return!o||r&&o.Bb?null===this.s?null:this.s.za(e,t,n,r):o},yo.prototype.qb=function(e,t){var n=go(this.Ca,mo(e,t));return n||(null===this.s?null:this.s.qb(e,t))},yo.prototype.Ra=function(e,t){var n=e.prefix,r=e.localName;return""===n&&this.A?{localName:r,namespaceURI:this.A}:n&&(n=this.ba(n,!1))?{localName:r,namespaceURI:n}:null===this.s?null:this.s.Ra(e,t)},yo.prototype.ba=function(e,t){var n=go(this.j,e||"");return void 0===n?null===this.s?void 0:this.s.ba(e||"",void 0===t||t):n};var Mo={},ko=(Mo[Uo(2,2,"idivOp")]=5,Mo[Uo(16,16,"addOp")]=16,Mo[Uo(16,16,"subtractOp")]=16,Mo[Uo(16,16,"divOp")]=4,Mo[Uo(16,2,"multiplyOp")]=16,Mo[Uo(16,2,"divOp")]=16,Mo[Uo(2,16,"multiplyOp")]=16,Mo[Uo(17,17,"addOp")]=17,Mo[Uo(17,17,"subtractOp")]=17,Mo[Uo(17,17,"divOp")]=4,Mo[Uo(17,2,"multiplyOp")]=17,Mo[Uo(17,2,"divOp")]=17,Mo[Uo(2,17,"multiplyOp")]=17,Mo[Uo(9,9,"subtractOp")]=17,Mo[Uo(7,7,"subtractOp")]=17,Mo[Uo(8,8,"subtractOp")]=17,Mo[Uo(9,16,"addOp")]=9,Mo[Uo(9,16,"subtractOp")]=9,Mo[Uo(9,17,"addOp")]=9,Mo[Uo(9,17,"subtractOp")]=9,Mo[Uo(7,16,"addOp")]=7,Mo[Uo(7,16,"subtractOp")]=7,Mo[Uo(7,17,"addOp")]=7,Mo[Uo(7,17,"subtractOp")]=7,Mo[Uo(8,17,"addOp")]=8,Mo[Uo(8,17,"subtractOp")]=8,Mo[Uo(9,16,"addOp")]=9,Mo[Uo(9,16,"subtractOp")]=9,Mo[Uo(9,17,"addOp")]=9,Mo[Uo(9,17,"subtractOp")]=9,Mo[Uo(7,17,"addOp")]=7,Mo[Uo(7,17,"subtractOp")]=7,Mo[Uo(7,16,"addOp")]=7,Mo[Uo(7,16,"subtractOp")]=7,Mo[Uo(8,17,"addOp")]=8,Mo[Uo(8,17,"subtractOp")]=8,Mo),Go={},Fo=(Go[Uo(2,2,"addOp")]=function(e,t){return e+t},Go[Uo(2,2,"subtractOp")]=function(e,t){return e-t},Go[Uo(2,2,"multiplyOp")]=function(e,t){return e*t},Go[Uo(2,2,"divOp")]=function(e,t){return e/t},Go[Uo(2,2,"modOp")]=function(e,t){return e%t},Go[Uo(2,2,"idivOp")]=function(e,t){return Math.trunc(e/t)},Go[Uo(16,16,"addOp")]=function(e,t){return new Ht(e.ga+t.ga)},Go[Uo(16,16,"subtractOp")]=function(e,t){return new Ht(e.ga-t.ga)},Go[Uo(16,16,"divOp")]=function(e,t){return e.ga/t.ga},Go[Uo(16,2,"multiplyOp")]=Xt,Go[Uo(16,2,"divOp")]=function(e,t){if(isNaN(t))throw Error("FOCA0005: Cannot divide xs:yearMonthDuration by NaN");if((e=Math.round(e.ga/t))>Number.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while dividing xs:yearMonthDuration");return new Ht(e<Number.MIN_SAFE_INTEGER||0===e?0:e)},Go[Uo(2,16,"multiplyOp")]=function(e,t){return Xt(t,e)},Go[Uo(17,17,"addOp")]=function(e,t){return new Je(e.ea+t.ea)},Go[Uo(17,17,"subtractOp")]=function(e,t){return new Je(e.ea-t.ea)},Go[Uo(17,17,"divOp")]=function(e,t){if(0===t.ea)throw Error("FOAR0001: Division by 0");return e.ea/t.ea},Go[Uo(17,2,"multiplyOp")]=et,Go[Uo(17,2,"divOp")]=function(e,t){if(isNaN(t))throw Error("FOCA0005: Cannot divide xs:dayTimeDuration by NaN");if((e=e.ea/t)>Number.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while dividing xs:dayTimeDuration");return new Je(e<Number.MIN_SAFE_INTEGER||Object.is(-0,e)?0:e)},Go[Uo(2,17,"multiplyOp")]=function(e,t){return et(t,e)},Go[Uo(9,9,"subtractOp")]=ht,Go[Uo(7,7,"subtractOp")]=ht,Go[Uo(8,8,"subtractOp")]=ht,Go[Uo(9,16,"addOp")]=ft,Go[Uo(9,16,"subtractOp")]=dt,Go[Uo(9,17,"addOp")]=ft,Go[Uo(9,17,"subtractOp")]=dt,Go[Uo(7,16,"addOp")]=ft,Go[Uo(7,16,"subtractOp")]=dt,Go[Uo(7,17,"addOp")]=ft,Go[Uo(7,17,"subtractOp")]=dt,Go[Uo(8,17,"addOp")]=ft,Go[Uo(8,17,"subtractOp")]=dt,Go[Uo(9,16,"addOp")]=ft,Go[Uo(9,16,"subtractOp")]=dt,Go[Uo(9,17,"addOp")]=ft,Go[Uo(9,17,"subtractOp")]=dt,Go[Uo(7,17,"addOp")]=ft,Go[Uo(7,17,"subtractOp")]=dt,Go[Uo(7,16,"addOp")]=ft,Go[Uo(7,16,"subtractOp")]=dt,Go[Uo(8,17,"addOp")]=ft,Go[Uo(8,17,"subtractOp")]=dt,Go);function Po(e,t){return ee(e,5)&&ee(t,5)?5:ee(e,4)&&ee(t,4)?4:ee(e,6)&&ee(t,6)?6:3}var Ho=[2,16,17,9,7,8];function _o(e,t,n){function r(e,t){return{V:o?o(e):e,W:a?a(t):t}}var o=null,a=null;ee(t,19)&&(o=function(e){return zt(e,3)},t=3),ee(n,19)&&(a=function(e){return zt(e,3)},n=3);var i=Ho.filter((function(e){return ee(t,e)})),s=Ho.filter((function(e){return ee(n,e)}));if(i.includes(2)&&s.includes(2)){var u=Fo[Uo(2,2,e)],l=ko[Uo(2,2,e)];return l||(l=Po(t,n)),"divOp"===e&&5===l&&(l=4),"idivOp"===e?jo(r,u)[0]:function(e,t){return e=r(e,t),Y(u(e.V.value,e.W.value),l)}}for(var p=(i=c(i)).next();!p.done;p=i.next()){p=p.value;for(var h={},f=c(s),d=f.next();!d.done;h={ib:h.ib,lb:h.lb},d=f.next())if(d=d.value,h.ib=Fo[Uo(p,d,e)],h.lb=ko[Uo(p,d,e)],h.ib&&void 0!==h.lb)return function(e){return function(t,n){return t=r(t,n),Y(e.ib(t.V.value,t.W.value),e.lb)}}(h)}}function jo(e,t){return[function(n,r){if(n=(r=e(n,r)).V,0===(r=r.W).value)throw Error("FOAR0001: Divisor of idiv operator cannot be (-)0");if(Number.isNaN(n.value)||Number.isNaN(r.value)||!Number.isFinite(n.value))throw Error("FOAR0002: One of the operands of idiv is NaN or the first operand is (-)INF");return Number.isFinite(n.value)&&!Number.isFinite(r.value)?Y(0,5):Y(t(n.value,r.value),5)},5]}var Xo=Object.create(null);function Lo(e,t,n,r,o){sr.call(this,t.s.add(n.s),[t,n],{C:!1},!1,r),this.B=t,this.J=n,this.j=e,this.u=o}function $o(e,t,n){var r=Oo(Co(e,["forClauseItem","typedVariableBinding","varName"]));(e=Co(e,["forClauseItem","forExpr","sequenceExpr"]))&&(e=So(e,"*").map((function(e){return n(e,t)})),e.includes(void 0)||e.includes(null)||1===(e=qo(e)).length&&ra(t,r.localName,e[0]))}function qo(e){return e.filter((function(e,t,n){return n.findIndex((function(t){return t.type===e.type&&t.g===e.g}))===t}))}function Yo(e,t,n){var r=So(e,"*"),o=Bo(e,"atomicType");if(!o)return{type:59,g:2};if(ge(Io(o,"prefix")+":"+o[2])===t.type)if(1===r.length){if(3===t.g)return n}else if(e=Bo(e,"occurrenceIndicator")[1],t.g===function(e){switch(e){case"*":return 2;case"?":return 0;case"+":return 1;default:return 3}}(e))return n}function Vo(e,t){Qo(e,t)}function Qo(e,t){var n=ta.get(e[0]);if(n)return n(e,t);for(n=1;n<e.length;n++)e[n]&&Qo(e[n],t)}function Jo(e,t){var n=Qo(Bo(e,"firstOperand")[1],t),r=Qo(Bo(e,"secondOperand")[1],t),o=e[0];if(n&&r){if(!(t=function(e,t,n){var r=[2,53,59,46,47];if(r.includes(t)||r.includes(n))return 2;var o=null,a=null;ee(t,19)&&(o=function(e){return zt(e,3)},t=3),ee(n,19)&&(a=function(e){return zt(e,3)},n=3);var i=Ho.filter((function(e){return ee(t,e)}));if(r=Ho.filter((function(e){return ee(n,e)})),i.includes(2)&&r.includes(2))return void 0===(r=ko[Uo(2,2,e)])&&(r=Po(t,n)),"divOp"===e&&5===r&&(r=4),"idivOp"===e?jo((function(e,t){return{V:o?o(e):e,W:a?a(t):t}}),(function(e,t){return Math.trunc(e/t)}))[1]:r;for(var s=(i=c(i)).next();!s.done;s=i.next()){s=s.value;for(var u=c(r),l=u.next();!l.done;l=u.next())if(void 0!==(l=ko[Uo(s,l.value,e)]))return l}}(o,n.type,r.type)))throw Error("XPTY0004: "+o+" not available for types "+me(n)+" and "+me(r));n={type:t,g:n.g},2!==t&&59!==t&&Do(e,"type",n),e=n}else e={type:2,g:3};return e}function Ko(e,t){Qo(Bo(e,"firstOperand")[1],t),Qo(Bo(e,"secondOperand")[1],t);e:{switch(e[0]){case"orOp":case"andOp":Do(e,"type",t={type:0,g:3}),e=t;break e}e=void 0}return e}function zo(e,t){Qo(Bo(e,"firstOperand")[1],t),Qo(Bo(e,"secondOperand")[1],t);e:{switch(e[0]){case"unionOp":case"intersectOp":case"exceptOp":Do(e,"type",t={type:53,g:2}),e=t;break e}e=void 0}return e}function Wo(e,t){return Qo(Bo(e,"firstOperand")[1],t),Qo(Bo(e,"secondOperand")[1],t),Do(e,"type",t={type:0,g:3}),t}function Zo(e,t){return Qo(Bo(e,"firstOperand")[1],t),Qo(Bo(e,"secondOperand")[1],t),Do(e,"type",t={type:0,g:3}),t}function ea(e,t){return Qo(Bo(e,"firstOperand")[1],t),Qo(Bo(e,"secondOperand")[1],t),Do(e,"type",t={type:0,g:3}),t}y(Lo,sr),Lo.prototype.h=function(e,t){var n=this;return Ut(ur(this.B,e,t),t).L((function(r){return 0===r.length?ce.empty():Ut(ur(n.J,e,t),t).L((function(e){if(0===e.length)return ce.empty();if(1<r.length||1<e.length)throw Error('XPTY0004: the operands of the "'+n.j+'" operator should be empty or singleton.');var t=r[0];if(e=e[0],n.u&&n.type)return ce.o(n.u(t,e));var o=t.type,a=e.type,i=n.j,s=o+"~"+a+"~"+i,u=Xo[s];if(u||(u=Xo[s]=_o(i,o,a)),!(o=u))throw Error("XPTY0004: "+n.j+" not available for types "+fe[t.type]+" and "+fe[e.type]);return ce.o(o(t,e))}))}))};var ta=new Map([["unaryMinusOp",function(e,t){return(t=Qo(Bo(e,"operand")[1],t))?ee(t.type,2)?(Do(e,"type",t={type:t.type,g:t.g}),e=t):(Do(e,"type",t={type:3,g:3}),e=t):(Do(e,"type",t={type:2,g:2}),e=t),e}],["unaryPlusOp",function(e,t){return(t=Qo(Bo(e,"operand")[1],t))?ee(t.type,2)?(Do(e,"type",t={type:t.type,g:t.g}),e=t):(Do(e,"type",t={type:3,g:3}),e=t):(Do(e,"type",t={type:2,g:2}),e=t),e}],["addOp",Jo],["subtractOp",Jo],["divOp",Jo],["idivOp",Jo],["modOp",Jo],["multiplyOp",Jo],["andOp",Ko],["orOp",Ko],["sequenceExpr",function(e,t){var n=So(e,"*"),r=n.map((function(e){return Qo(e,t)}));return function(e,t,n){return t=0===t?{type:53,g:2}:n.includes(void 0)||n.includes(null)||1<(t=qo(n)).length?{type:59,g:2}:{type:t[0].type,g:2},t&&59!==t.type&&Do(e,"type",t),t}(e,n.length,r)}],["unionOp",zo],["intersectOp",zo],["exceptOp",zo],["stringConcatenateOp",function(e,t){return Qo(Bo(e,"firstOperand")[1],t),Qo(Bo(e,"secondOperand")[1],t),Do(e,"type",t={type:1,g:3}),t}],["rangeSequenceExpr",function(e,t){return Qo(Bo(e,"startExpr")[1],t),Qo(Bo(e,"endExpr")[1],t),Do(e,"type",t={type:5,g:1}),t}],["equalOp",Wo],["notEqualOp",Wo],["lessThanOrEqualOp",Wo],["lessThanOp",Wo],["greaterThanOrEqualOp",Wo],["greaterThanOp",Wo],["eqOp",Zo],["neOp",Zo],["ltOp",Zo],["leOp",Zo],["gtOp",Zo],["geOp",Zo],["isOp",ea],["nodeBeforeOp",ea],["nodeAfterOp",ea],["pathExpr",function(e,t){var n=Bo(e,"rootExpr");return n&&n[1]&&Qo(n[1],t),So(e,"stepExpr").map((function(e){return Qo(e,t)})),function(e,t){var n=So(e,"stepExpr");if(!n)return{type:59,g:2};for(var r=(n=c(n)).next();!r.done;r=n.next()){var o=r.value;r=void 0;var a=t;if(o){for(var i=So(o,"*"),s="",u=(i=c(i)).next();!u.done;u=i.next())switch(u=u.value,u[0]){case"filterExpr":r=Io(Co(u,["*"]),"type");break;case"xpathAxis":e:{switch(s=u[1]){case"attribute":r={type:47,g:2};break e;case"child":case"decendant":case"self":case"descendant-or-self":case"following-sibling":case"following":case"namespace":case"parent":case"ancestor":case"preceding-sibling":case"preceding":case"ancestor-or-self":r={type:53,g:2};break e}r=void 0}break;case"nameTest":var l=Oo(u);null!==l.namespaceURI||"attribute"===s&&!l.prefix||void 0!==(l=a.ba(l.prefix||""))&&Do(u,"URI",l)}r&&59!==r.type&&Do(o,"type",r)}o=Io(o,"type")}return o&&59!==o.type&&Do(e,"type",o),o}(e,t)}],["contextItemExpr",function(){return{type:59,g:2}}],["ifThenElseExpr",function(e,t){Qo(Bo(Bo(e,"ifClause"),"*"),t);var n=Qo(Bo(Bo(e,"thenClause"),"*"),t);return t=Qo(Bo(Bo(e,"elseClause"),"*"),t),n&&t&&n.type===t.type&&n.g===t.g?(59!==n.type&&Do(e,"type",n),e=n):e={type:59,g:2},e}],["instanceOfExpr",function(e,t){return Qo(Bo(e,"argExpr"),t),Qo(Bo(e,"sequenceType"),t),Do(e,"type",t={type:0,g:3}),t}],["integerConstantExpr",function(e){var t={type:5,g:3};return Do(e,"type",t),t}],["doubleConstantExpr",function(e){var t={type:3,g:3};return Do(e,"type",t),t}],["decimalConstantExpr",function(e){var t={type:4,g:3};return Do(e,"type",t),t}],["stringConstantExpr",function(e){var t={type:1,g:3};return Do(e,"type",t),t}],["functionCallExpr",function(e,t){return So(Bo(e,"arguments"),"*").map((function(e){return Qo(e,t)})),function(e,t){if(!t||!t.ia)return{type:59,g:2};var n=Bo(e,"functionName"),r=Oo(n),o=r.localName,a=r.prefix,i=r.namespaceURI;if(r=So(Bo(e,"arguments"),"*"),null===i){if(!(a=t.ia.Ra({localName:o,prefix:a},r.length)))return{type:59,g:2};o=a.localName,Do(n,"URI",i=a.namespaceURI),n[2]=o}return(t=t.ia.za(i,o,r.length))&&63!==t.i.type?(59!==t.i.type&&Do(e,"type",t.i),t.i):{type:59,g:2}}(e,t)}],["arrowExpr",function(e,t){return Qo(Bo(e,"argExpr")[1],t),function(e,t){if(!t||!t.ia)return{type:59,g:2};var n=Bo(e,"EQName");if(!n)return{type:59,g:2};var r=Oo(n);n=r.localName;var o=r.prefix;return r=So(Bo(e,"arguments"),"*"),(n=t.ia.Ra({localName:n,prefix:o},r.length))&&(t=t.ia.za(n.namespaceURI,n.localName,r.length+1))?(59!==t.i.type&&Do(e,"type",t.i),t.i):{type:59,g:2}}(e,t)}],["dynamicFunctionInvocationExpr",function(e,t){return Qo(Co(e,["functionItem","*"]),t),(e=Bo(e,"arguments"))&&Qo(e,t),{type:59,g:2}}],["namedFunctionRef",function(e,t){return function(e,t){if(!t||!t.ia)return{type:59,g:2};var n=Bo(e,"functionName"),r=Oo(n),o=r.localName,a=r.namespaceURI,i=r.prefix;if(r=Number(Co(e,["integerConstantExpr","value"])[1]),!a){if(!(a=t.ia.Ra({localName:o,prefix:i},r)))return{type:59,g:2};o=a.localName,Do(n,"URI",a=a.namespaceURI)}return(t=t.ia.za(a,o,r)||null)?(59!==t.i.type&&63!==t.i.type&&Do(e,"type",t.i),t.i):{type:59,g:2}}(e,t)}],["inlineFunctionExpr",function(e,t){return Qo(Bo(e,"functionBody")[1],t),Do(e,"type",t={type:60,g:3}),t}],["castExpr",function(e){var t=Co(e,["singleType","atomicType"]);return 59!==(t={type:ge(Io(t,"prefix")+":"+t[2]),g:3}).type&&Do(e,"type",t),t}],["castableExpr",function(e){var t={type:0,g:3};return Do(e,"type",t),t}],["simpleMapExpr",function(e,t){for(var n,r=So(e,"pathExpr"),o=0;o<r.length;o++)n=Qo(r[o],t);return null!=n?(59!==(t={type:n.type,g:2}).type&&Do(e,"type",t),e=t):e={type:59,g:2},e}],["mapConstructor",function(e,t){return So(e,"mapConstructorEntry").map((function(e){return{key:Qo(Co(e,["mapKeyExpr","*"]),t),value:Qo(Co(e,["mapValueExpr","*"]),t)}})),function(e){var t={type:61,g:3};return Do(e,"type",t),t}(e)}],["arrayConstructor",function(e,t){return So(Bo(e,"*"),"arrayElem").map((function(e){return Qo(e,t)})),function(e){var t={type:62,g:3};return Do(e,"type",t),t}(e)}],["unaryLookup",function(e){return Bo(e,"NCName"),{type:59,g:2}}],["typeswitchExpr",function(e,t){var n=Qo(Bo(e,"argExpr")[1],t),r=So(e,"typeswitchExprCaseClause").map((function(e){return Qo(Co(e,["resultExpr"])[1],t)}));return function(e,t,n,r){if(!t||n.includes(void 0))return{type:59,g:2};for(var o=So(e,"typeswitchExprCaseClause"),a=0;a<n.length;a++){var i=Bo(o[a],"*");switch(i[0]){case"sequenceType":if(i=Yo(i,t,n[a]))return 59!==i.type&&Do(e,"type",i),i;continue;case"sequenceTypeUnion":for(r=So(i,"*"),o=0;2>o;o++)if(i=Yo(r[o],t,n[a]))return 59!==i.type&&Do(e,"type",i),i;default:return{type:59,g:2}}}return 59!==r.type&&Do(e,"type",r),r}(e,n,r,Qo(Co(e,["typeswitchExprDefaultClause","resultExpr"])[1],t))}],["quantifiedExpr",function(e,t){return So(e,"*").map((function(e){return Qo(e,t)})),function(e){var t={type:0,g:3};return Do(e,"type",t),t}(e)}],["x:stackTrace",function(e,t){return Qo((e=So(e,"*"))[0],t)}],["queryBody",function(e,t){return Qo(e[1],t)}],["flworExpr",function(e,t){return function(e,t){for(var n=Qo,r=!1,o=1;o<e.length;o++)switch(e[o][0]){case"letClause":oa(t);var a=e[o],i=t,s=n,u=Co(a,["letClauseItem","typedVariableBinding","varName"]);u=Oo(u),s=s((a=Co(a,["letClauseItem","letExpr"]))[1],i),ra(i,u.localName,s);break;case"forClause":r=!0,oa(t),$o(e[o],t,n);break;case"whereClause":oa(t),n(i=e[o],t),Do(i,"type",{type:0,g:3});break;case"orderByClause":oa(t);break;case"returnClause":return i=n,Do(n=Co(o=e[o],["*"]),"type",t=i(n,t)),Do(o,"type",t),(n=t)?(r&&(n={type:n.type,g:2}),59!==n.type&&Do(e,"type",n),n):{type:59,g:2};default:return(n=n(e[o],t))?(r&&(n={type:n.type,g:2}),59!==n.type&&Do(e,"type",n),n):{type:59,g:2}}if(!(0<t.h))throw Error("Variable scope out of bound");t.h--,t.s.pop(),t.A.pop()}(e,t)}],["varRef",function(e,t){var n,r=Oo(Bo(e,"name"));e:{for(n=t.h;0<=n;n--){var o=t.s[n][r.localName];if(o){n=o;break e}}n=void 0}return n&&59!==n.type&&Do(e,"type",n),null===r.namespaceURI&&(void 0!==(t=t.ba(r.prefix))&&Do(e,"URI",t)),n}]]);function na(e){this.h=0,this.ia=e,this.s=[{}],this.A=[{}]}function ra(e,t,n){if(e.s[e.h][t])throw Error("Another variable of in the scope "+e.h+" with the same name "+t+" already exists");e.s[e.h][t]=n}function oa(e){e.h++,e.s.push({}),e.A.push({})}function aa(e,t){var n={};sr.call(this,new xr((n.external=1,n)),e,{C:e.every((function(e){return e.C}))},!1,t),this.j=e}function ia(e,t){var n={};sr.call(this,new xr((n.external=1,n)),e,{C:e.every((function(e){return e.C}))},!1,t),this.j=e}function sa(e){if(null===e)throw Error("XPDY0002: context is absent, it needs to be present to use axes.");if(!ee(e.type,53))throw Error("XPTY0020: Axes can only be applied to nodes.");return e.value}function ua(e,t){t=t||{Oa:!1},sr.call(this,e.s,[e],{S:"reverse-sorted",Y:!1,subtree:!1,C:!1}),this.j=e,this.u=!!t.Oa}na.prototype.ba=function(e){for(var t=this.h;0<=t;t--){var n=this.A[t][e];if(void 0!==n)return n}return this.ia?this.ia.ba(e):void 0},y(aa,sr),aa.prototype.h=function(e,t){return 0===this.j.length?ce.o(new _e([])):ur(this.j[0],e,t).L((function(e){return ce.o(new _e(e.map((function(e){return le(ce.o(e))}))))}))},y(ia,sr),ia.prototype.h=function(e,t){return ce.o(new _e(this.j.map((function(n){return le(ur(n,e,t))}))))},y(ua,sr),ua.prototype.h=function(e,t){var n=this;t=t.h,e=sa(e.N);var r=this.j.A();return r=r&&(r.startsWith("name-")||"type-1"===r)?"type-1":null,ce.create(function(e,t,n){var r=t;return{next:function(){if(!r)return z;var t=r;return r=Fe(e,t,n),W(Xe(t))}}}(t,this.u?e:Fe(t,e,r),r)).filter((function(e){return n.j.j(e)}))};var ca=new Map([["type-1-or-type-2",["name","type-1","type-2"]],["type-1",["name"]],["type-2",["name"]]]);function la(e,t){if(null===e)return t;if(null===t||e===t)return e;var n=e.startsWith("name-")?"name":e,r=t.startsWith("name-")?"name":t,o=ca.get(n);return void 0!==o&&o.includes(r)?t:void 0!==(t=ca.get(r))&&t.includes(n)?e:"empty"}function pa(e,t){var n={};sr.call(this,new xr((n.attribute=1,n)),[e],{S:"unsorted",subtree:!0,Y:!0,C:!1}),this.j=e,this.u=la(this.j.A(),t)}function ha(e,t){sr.call(this,e.s,[e],{S:"sorted",subtree:!0,Y:!0,C:!1}),this.u=e,this.j=la(t,e.A())}function fa(e,t,n){var r=t.node.nodeType;if(1!==r&&9!==r)return{next:function(){return z}};var o=Me(e,t,n);return{next:function(){if(!o)return z;var t=o;return o=Ge(e,o,n),W(t)}}}function da(e,t){t=t||{Oa:!1},sr.call(this,e.s,[e],{C:!1,Y:!1,S:"sorted",subtree:!0}),this.j=e,this.u=!!t.Oa,this.B=(e=this.j.A())&&(e.startsWith("name-")||"type-1"===e)?"type-1":null}function ma(e,t,n){var r=e.node.nodeType;if(1!==r&&9!==r)return e;for(r=ke(t,e,n);null!==r;){if(1!==r.node.nodeType)return r;r=ke(t,e=r,n)}return e}function ga(e,t,n,r){if(void 0!==n&&n){var o=t,a=!1;return{next:function(){if(a)return z;if(en(o,t))return en(o=ma(t,e,r),t)?(a=!0,z):W(Xe(o));var n=o.node.nodeType,i=9===n||2===n?null:Pe(e,o,r);return null!==i?W(Xe(o=ma(i,e,r))):en(o=9===n?null:Fe(e,o,r),t)?(a=!0,z):W(Xe(o))}}}var i=[fa(e,t,r)];return{next:function(){if(!i.length)return z;for(var t=i[0].next(0);t.done;){if(i.shift(),!i.length)return z;t=i[0].next(0)}return i.unshift(fa(e,t.value,r)),W(Xe(t.value))}}}function ya(e){sr.call(this,e.s,[e],{S:"sorted",Y:!0,subtree:!1,C:!1}),this.j=e,this.u=(e=this.j.A())&&(e.startsWith("name-")||"type-1"===e)?"type-1":null}function va(e,t){sr.call(this,e.s,[e],{S:"sorted",Y:!0,subtree:!1,C:!1}),this.j=e,this.u=la(this.j.A(),t)}function wa(e,t){sr.call(this,e.s,[e],{S:"reverse-sorted",Y:!0,subtree:!0,C:!1}),this.j=e,this.u=la(t,this.j.A())}function Aa(e){sr.call(this,e.s,[e],{C:!1,Y:!0,S:"reverse-sorted",subtree:!1}),this.j=e,this.u=(e=this.j.A())&&(e.startsWith("name-")||"type-1"===e)?"type-1":null}function xa(e,t){sr.call(this,e.s,[e],{C:!1,Y:!0,S:"reverse-sorted",subtree:!1}),this.j=e,this.u=la(this.j.A(),t)}function ba(e,t){sr.call(this,e.s,[e],{S:"sorted",subtree:!0,Y:!0,C:!1}),this.j=e,this.u=la(this.j.A(),t)}function Ea(e,t,n,r){var o=e.s.add(t.s).add(n.s);vr.call(this,o,[e,t,n],{C:e.C&&t.C&&n.C,Y:t.Y===n.Y&&t.Y,S:t.O===n.O?t.O:"unsorted",subtree:t.subtree===n.subtree&&t.subtree},r),this.j=e}function Na(e,t,n){this.location=e,this.s=t,this.h=n}function Ba(e){return e.h instanceof Error?e.location:Ba(e.h)}function Ta(e){var t=e.h instanceof Kr?["Inner error:",e.h.message]:e.h instanceof Error?[e.h.toString()]:Ta(e.h);return t.push(" at <"+e.s+">:"+e.location.start.line+":"+e.location.start.la+" - "+e.location.end.line+":"+e.location.end.la),t}function Ia(e,t,n){vr.call(this,n.s,[n],{C:n.C,Y:n.Y,S:n.O,subtree:n.subtree}),this.j=t,this.J={end:{la:e.end.la,line:e.end.line,offset:e.end.offset},start:{la:e.start.la,line:e.start.line,offset:e.start.offset}}}function Ca(e,t,n,r){sr.call(this,e,t,n,!0),this.j=r,this.I=this.j.I}function Sa(e,t,n,r){var o=[],a=e.J(t,n,r,(function(n){if(e.j instanceof Ca)return yr(Sa(e.j,t,n,r),(function(e){return o=e}));var a=null;return ce.create({next:function(){for(;;){if(!a){var t=n.next(0);if(t.done)return z;t=e.j.u(t.value,r),a=yr(t,(function(e){return o=dr(o,e)})).value}if(!(t=a.next(0)).done)return t;a=null}}})})),i=!1;return{next:function(){if(i)return z;var e=a.M();return i=!0,W(new cr(e,o))}}}function Oa(e,t,n,r){return e.J(t,n,r,(function(n){if(e.j instanceof Ca)return Oa(e.j,t,n,r);var o=null;return ce.create({next:function(){for(;;){if(!o){var t=n.next(0);if(t.done)return z;o=ur(e.j,t.value,r).value}if(!(t=o.next(0)).done)return t;o=null}}})}))}function Ra(e,t,n,r){Ca.call(this,t.s.add(r.s),[t,r],{C:!1},r),this.T=e.prefix,this.ka=e.namespaceURI,this.$b=e.localName,this.mb=null,this.B=n,this.ua=null,this.na=t}function Da(e,t,n){var r={};sr.call(this,new xr((r.external=1,r)),[n],{C:!1,S:"unsorted"}),this.T=e.map((function(e){return e.name})),this.B=e.map((function(e){return e.type})),this.u=null,this.J=t,this.j=n}function Ua(e,t,n){if(Ca.call(this,t.s.add(n.s),[t,n],{C:!1,Y:n.Y,S:n.O,subtree:n.subtree},n),e.prefix||e.namespaceURI)throw Error("Not implemented: let expressions with namespace usage.");this.B=e.prefix,this.T=e.namespaceURI,this.ua=e.localName,this.ka=t,this.na=null}function Ma(e,t){switch(sr.call(this,new xr({}),[],{C:!0,S:"sorted"},!1,t),t.type){case 5:var n=Y(parseInt(e,10),t.type);break;case 1:n=Y(e,t.type);break;case 4:case 3:n=Y(parseFloat(e),t.type);break;default:throw new TypeError("Type "+t+" not expected in a literal")}this.j=function(){return ce.o(n)}}function ka(e,t){var n={};sr.call(this,new xr((n.external=1,n)),e.reduce((function(e,t){return e.concat(t.key,t.value)}),[]),{C:!1},!1,t),this.j=e}function Ga(e,t,n){var r={};sr.call(this,new xr((r.external=1,r)),[],{C:!0},!1,n),this.u=t,this.B=e,this.j=null}y(pa,sr),pa.prototype.h=function(e,t){var n=this;return t=t.h,1!==(e=sa(e.N)).node.nodeType?ce.empty():(e=Oe(t,e,this.u).filter((function(e){return"http://www.w3.org/2000/xmlns/"!==e.node.namespaceURI})).map((function(e){return Xe(e)})).filter((function(e){return n.j.j(e)})),ce.create(e))},pa.prototype.A=function(){return"type-1"},y(ha,sr),ha.prototype.h=function(e,t){var n=this,r=t.h,o=sa(e.N);if(1!==(e=o.node.nodeType)&&9!==e)return ce.empty();var a=null,i=!1;return ce.create({next:function(){for(;!i;){if(!a){if(!(a=Me(r,o,n.j))){i=!0;continue}return W(Xe(a))}if(a=Ge(r,a,n.j))return W(Xe(a));i=!0}return z}}).filter((function(e){return n.u.j(e)}))},y(da,sr),da.prototype.h=function(e,t){var n=this;return e=function(e,t,n){var r=[Wt(t)];return{next:function(t){if(0<r.length&&0!=(1&t)&&r.shift(),!r.length)return z;for(t=r[0].next(0);t.done;){if(r.shift(),!r.length)return z;t=r[0].next(0)}return r.unshift(fa(e,t.value,n)),W(Xe(t.value))}}}(t=t.h,e=sa(e.N),this.B),this.u||e.next(0),ce.create(e).filter((function(e){return n.j.j(e)}))},y(ya,sr),ya.prototype.h=function(e,t){var n=this;return t=t.h,e=sa(e.N),ce.create(function(e,t,n){for(var r=[];t&&9!==t.node.nodeType;t=Fe(e,t,null)){var o=Ge(e,t,n);o&&r.push(o)}var a=null;return{next:function(){for(;a||r.length;){if(!a){a=ga(e,r[0],!1,n);var t=W(Xe(r[0])),o=Ge(e,r[0],n);return o?r[0]=o:r.shift(),t}if(!(t=a.next(0)).done)return t;a=null}return z}}}(t,e,this.u)).filter((function(e){return n.j.j(e)}))},y(va,sr),va.prototype.h=function(e,t){var n=this;return t=t.h,e=sa(e.N),ce.create(function(e,t,n){return{next:function(){return(t=t&&Ge(e,t,n))?W(Xe(t)):z}}}(t,e,this.u)).filter((function(e){return n.j.j(e)}))},y(wa,sr),wa.prototype.h=function(e,t){return(e=Fe(t=t.h,e=sa(e.N),this.u))?(e=Xe(e),this.j.j(e)?ce.o(e):ce.empty()):ce.empty()},y(Aa,sr),Aa.prototype.h=function(e,t){var n=this;return t=t.h,e=sa(e.N),ce.create(function(e,t,n){for(var r=[];t&&9!==t.node.nodeType;t=Fe(e,t,null)){var o=Pe(e,t,n);null!==o&&r.push(o)}var a=null;return{next:function(){for(;a||r.length;){a||(a=ga(e,r[0],!0,n));var t=a.next(0);if(t.done){a=null,t=Pe(e,r[0],n);var o=W(Xe(r[0]));return null===t?r.shift():r[0]=t,o}return t}return z}}}(t,e,this.u)).filter((function(e){return n.j.j(e)}))},y(xa,sr),xa.prototype.h=function(e,t){var n=this;return t=t.h,e=sa(e.N),ce.create(function(e,t,n){return{next:function(){return(t=t&&Pe(e,t,n))?W(Xe(t)):z}}}(t,e,this.u)).filter((function(e){return n.j.j(e)}))},y(ba,sr),ba.prototype.h=function(e){return sa(e.N),this.j.j(e.N)?ce.o(e.N):ce.empty()},ba.prototype.A=function(){return this.u},y(Ea,vr),Ea.prototype.B=function(e,t,n){var r=null,o=n[0](e);return ce.create({next:function(t){return r||(r=(o.getEffectiveBooleanValue()?n[1](e):n[2](e)).value),r.next(t)}})},Ea.prototype.P=function(e){if(vr.prototype.P.call(this,e),this.j.I)throw Kn()},y(Ia,vr),Ia.prototype.B=function(e,t,n){var r=this;t=c(n).next().value;try{var o=t(e)}catch(e){throw new Na(this.J,this.j,e)}return ce.create({next:function(e){try{return o.value.next(e)}catch(e){throw new Na(r.J,r.j,e)}}})},Ia.prototype.P=function(e){try{vr.prototype.P.call(this,e)}catch(e){throw new Na(this.J,this.j,e)}},y(Ca,sr),Ca.prototype.h=function(e,t){var n=this;return this.J(e,Wt(e),t,(function(r){if(n.j instanceof Ca)return Oa(n.j,e,r,t);var o=null;return ce.create({next:function(e){for(;;){if(!o){var a=r.next(0);if(a.done)return z;o=ur(n.j,a.value,t).value}if(!(a=o.next(e)).done)return a;o=null}}})}))},Ca.prototype.u=function(e,t){return Sa(this,e,Wt(e),t)},Ca.prototype.P=function(e){sr.prototype.P.call(this,e),this.I=this.j.I;for(var t=(e=c(this.ha)).next();!t.done;t=e.next())if((t=t.value)!==this.j&&t.I)throw Kn()},y(Ra,Ca),Ra.prototype.J=function(e,t,n,r){var o=this,a=null,i=null,s=0;return r({next:function(){for(var e={};;){if(!a){var r=t.next(0);if(r.done)return z;i=r.value,s=0,a=ur(o.na,i,n).value}if(e.hb=a.next(0),!e.hb.done)return s++,(r={})[o.mb]=function(e){return function(){return ce.o(e.hb.value)}}(e),e=r,o.ua&&(e[o.ua]=function(){return ce.o(new pe(5,s))}),W(Bt(i,e));a=null,e={hb:e.hb}}}})},Ra.prototype.P=function(e){if(this.T&&(this.ka=e.ba(this.T),!this.ka&&this.T))throw Error("XPST0081: Could not resolve namespace for prefix "+this.T+" in a for expression");if(this.na.P(e),wo(e),this.mb=bo(e,this.ka,this.$b),this.B){if(this.B.prefix&&(this.B.namespaceURI=e.ba(this.B.prefix),!this.B.namespaceURI&&this.B.prefix))throw Error("XPST0081: Could not resolve namespace for prefix "+this.T+" in the positionalVariableBinding in a for expression");this.ua=bo(e,this.B.namespaceURI,this.B.localName)}if(this.j.P(e),No(e),this.na.I)throw Kn();this.j.I&&(this.I=!0)},y(Da,sr),Da.prototype.h=function(e,t){var n=this,r=new we({l:this.B,arity:this.B.length,Pa:!0,I:this.j.I,localName:"dynamic-function",namespaceURI:"",i:this.J,value:function(r,o,a,i){for(var s=[],u=3;u<arguments.length;++u)s[u-3]=arguments[u];return u=Bt(Nt(e,-1,null,ce.empty()),n.u.reduce((function(e,t,n){return e[t]=le(s[n]),e}),Object.create(null))),ur(n.j,u,t)}});return ce.o(r)},Da.prototype.P=function(e){if(wo(e),this.u=this.T.map((function(t){return bo(e,t.namespaceURI,t.localName)})),this.j.P(e),No(e),this.j.I)throw Error("Not implemented: inline functions can not yet be updating.")},y(Ua,Ca),Ua.prototype.J=function(e,t,n,r){var o=this;return r({next:function(){var e=t.next(0);if(e.done)return z;var r={};return W(e=Bt(e=e.value,(r[o.na]=le(ur(o.ka,e,n)),r)))}})},Ua.prototype.P=function(e){if(this.B&&(this.T=e.ba(this.B),!this.T&&this.B))throw Error("XPST0081: Could not resolve namespace for prefix "+this.B+" using in a for expression");if(this.ka.P(e),wo(e),this.na=bo(e,this.T,this.ua),this.j.P(e),No(e),this.I=this.j.I,this.ka.I)throw Kn()},y(Ma,sr),Ma.prototype.h=function(){return this.j()},y(ka,sr),ka.prototype.h=function(e,t){var n=this,r=this.j.map((function(n){return Ut(ur(n.key,e,t),t).$({default:function(){throw Error("XPTY0004: A key of a map should be a single atomizable value.")},o:function(e){return e}})}));return Le(r,(function(r){return ce.o(new Ye(r.map((function(r,o){return{key:r,value:le(ur(n.j[o].value,e,t))}}))))}))},y(Ga,sr),Ga.prototype.h=function(){var e=new we({l:this.j.l,I:this.j.I,arity:this.u,localName:this.j.localName,namespaceURI:this.j.namespaceURI,i:this.j.i,value:this.j.m});return ce.o(e)},Ga.prototype.P=function(e){var t=this.B.namespaceURI,n=this.B.localName,r=this.B.prefix;if(null===t){var o=e.Ra({localName:n,prefix:r},this.u);if(!o)throw Error("XPST0017: The function "+(r?r+":":"")+n+" with arity "+this.u+" could not be resolved. "+eo(n));t=o.namespaceURI,n=o.localName}if(this.j=e.za(t,n,this.u)||null,!this.j)throw e=this.B,Error("XPST0017: Function "+(e.namespaceURI?"Q{"+e.namespaceURI+"}":e.prefix?e.prefix+":":"")+e.localName+" with arity of "+this.u+" not registered. "+eo(n));sr.prototype.P.call(this,e)};var Fa={},Pa=(Fa[5]=5,Fa[27]=5,Fa[28]=5,Fa[31]=5,Fa[32]=5,Fa[33]=5,Fa[34]=5,Fa[30]=5,Fa[36]=5,Fa[35]=5,Fa[38]=5,Fa[37]=5,Fa[29]=5,Fa[4]=4,Fa[6]=6,Fa[3]=3,Fa);function Ha(e,t,n){sr.call(this,t.s,[t],{C:!1},!1,n),this.u=t,this.j=e}function _a(e,t){sr.call(this,e.reduce((function(e,t){return e.add(t.s)}),new xr({})),e,{C:e.every((function(e){return e.C}))},!1,t),this.j=e,this.u=e.reduce((function(e,t){return la(e,t.A())}),null)}function ja(e,t){var n,r=e.reduce((function(e,t){return 0<br(e,t.s)?e:t.s}),new xr({}));for(sr.call(this,r,e,{C:e.every((function(e){return e.C}))},!1,t),t=0;t<e.length&&(void 0===n&&(n=e[t].A()),null!==n);++t)if(n!==e[t].A()){n=null;break}this.u=n,this.j=e}function Xa(e,t){var n;return ce.create({next:function(r){for(;;){if(!n){var o=e.value.next(r);if(o.done)return z;n=Dt(o.value,t)}if(!(o=n.value.next(r)).done)return o;n=null}}})}function La(e,t,n){function r(e,t){return{V:i?i(e):e,W:s?s(t):t}}function o(e){return ee(t,e)&&ee(n,e)}function a(e){return 0<e.filter((function(e){return ee(t,e)})).length&&0<e.filter((function(e){return ee(n,e)})).length}var i=null,s=null;if(ee(t,19)&&ee(n,19)?t=n=1:ee(t,19)?(i=function(e){return zt(e,n)},t=n):ee(n,19)&&(s=function(e){return zt(e,t)},n=t),ee(t,23)&&ee(n,23))return function(e,t){if("eqOp"===e)return function(e,n){return e=(n=t(e,n)).V,n=n.W,e.value.namespaceURI===n.value.namespaceURI&&e.value.localName===n.value.localName};if("neOp"===e)return function(e,n){return e=(n=t(e,n)).V,n=n.W,e.value.namespaceURI!==n.value.namespaceURI||e.value.localName!==n.value.localName};throw Error('XPTY0004: Only the "eq" and "ne" comparison is defined for xs:QName')}(e,r);if(o(0)||a([1,47,61])||a([2,47,61])||o(20)||o(22)||o(21)||a([1,20])){var u=function(e,t){switch(e){case"eqOp":return function(e,n){return(e=t(e,n)).V.value===e.W.value};case"neOp":return function(e,n){return(e=t(e,n)).V.value!==e.W.value};case"ltOp":return function(e,n){return(e=t(e,n)).V.value<e.W.value};case"leOp":return function(e,n){return(e=t(e,n)).V.value<=e.W.value};case"gtOp":return function(e,n){return(e=t(e,n)).V.value>e.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(o(16)&&(u=function(e,t){switch(e){case"ltOp":return function(e,n){return(e=t(e,n)).V.value.ga<e.W.value.ga};case"leOp":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};case"gtOp":return function(e,n){return(e=t(e,n)).V.value.ga>e.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),void 0!==u)||o(17)&&(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.ea<e.W.value.ea};case"leOp":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};case"gtOp":return function(e,n){return(e=t(e,n)).V.value.ea>e.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),void 0!==u)||o(18)&&(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),void 0!==u))return u;if((o(9)||o(7)||o(8))&&(u=function(e,t){switch(e){case"eqOp":return function(e,n,r){return pt((e=t(e,n)).V.value,e.W.value,Et(r))};case"neOp":return function(e,n,r){return!pt((e=t(e,n)).V.value,e.W.value,Et(r))};case"ltOp":return function(e,n,r){return e=t(e,n),r=Et(r),0>lt(e.V.value,e.W.value,r)};case"leOp":return function(e,n,r){var o;return e=(n=t(e,n)).V,n=n.W,(o=pt(e.value,n.value,Et(r)))||(r=Et(r),o=0>lt(e.value,n.value,r)),o};case"gtOp":return function(e,n,r){return e=t(e,n),r=Et(r),0<lt(e.V.value,e.W.value,r)};case"geOp":return function(e,n,r){var o;return e=(n=t(e,n)).V,n=n.W,(o=pt(e.value,n.value,Et(r)))||(r=Et(r),o=0<lt(e.value,n.value,r)),o}}}(e,r),void 0!==u))return u;if((o(11)||o(12)||o(13)||o(14)||o(15))&&(u=function(e,t){switch(e){case"eqOp":return function(e,n,r){return pt((e=t(e,n)).V.value,e.W.value,Et(r))};case"neOp":return function(e,n,r){return!pt((e=t(e,n)).V.value,e.W.value,Et(r))}}}(e,r),void 0!==u))return u;throw Error("XPTY0004: "+e+" not available for "+fe[t]+" and "+fe[n])}y(Ha,sr),Ha.prototype.h=function(e,t){var n=this;return Ut(ur(this.u,e,t),t).L((function(e){if(0===e.length)return ce.empty();var t=e[0];if(n.type)return e="+"===n.j?+t.value:-t.value,0===t.type&&(e=Number.NaN),ce.o(Y(e,n.type.type));if(1<e.length)throw Error("XPTY0004: The operand to a unary operator must be a sequence with a length less than one");return ee(t.type,19)?(t=zt(t,3).value,ce.o(Y("+"===n.j?t:-t,3))):ee(t.type,2)?"+"===n.j?ce.o(t):ce.o(Y(-1*t.value,Pa[t.type])):ce.o(Y(Number.NaN,3))}))},y(_a,sr),_a.prototype.h=function(e,t){var n=this,r=0,o=null,a=!1,i=null;if(null!==e){var s=e.N;null!==s&&ee(s.type,53)&&(i=xe(s.value))}return ce.create({next:function(){if(!a){for(;r<n.j.length;){if(!o){var s=n.j[r];if(null!==i&&null!==s.A()&&!i.includes(s.A()))return r++,a=!0,W(Q);o=ur(s,e,t)}if(!1===o.getEffectiveBooleanValue())return a=!0,W(Q);o=null,r++}return a=!0,W(V)}return z}})},_a.prototype.A=function(){return this.u},y(ja,sr),ja.prototype.h=function(e,t){var n=this,r=0,o=null,a=!1,i=null;if(null!==e){var s=e.N;null!==s&&ee(s.type,53)&&(i=xe(s.value))}return ce.create({next:function(){if(!a){for(;r<n.j.length;){if(!o){var s=n.j[r];if(null!==i&&null!==s.A()&&!i.includes(s.A())){r++;continue}o=ur(s,e,t)}if(!0===o.getEffectiveBooleanValue())return a=!0,W(V);o=null,r++}return a=!0,W(Q)}return z}})},ja.prototype.A=function(){return this.u};var $a=Object.create(null);function qa(e,t,n){var r=t+"~"+n+"~"+e,o=$a[r];return o||(o=$a[r]=La(e,t,n)),o}function Ya(e,t,n){sr.call(this,t.s.add(n.s),[t,n],{C:!1}),this.j=t,this.B=n,this.u=e}y(Ya,sr),Ya.prototype.h=function(e,t){var n=this,r=ur(this.j,e,t),o=ur(this.B,e,t),a=Xa(r,t),i=Xa(o,t);return a.$({empty:function(){return ce.empty()},o:function(){return i.$({empty:function(){return ce.empty()},o:function(){var t=a.first(),r=i.first();return qa(n.u,t.type,r.type)(t,r,e)?ce.ca():ce.X()},multiple:function(){throw Error("XPTY0004: Sequences to compare are not singleton.")}})},multiple:function(){throw Error("XPTY0004: Sequences to compare are not singleton.")}})};var Va={},Qa=(Va.equalOp="eqOp",Va.notEqualOp="neOp",Va.lessThanOrEqualOp="leOp",Va.lessThanOp="ltOp",Va.greaterThanOrEqualOp="geOp",Va.greaterThanOp="gtOp",Va);function Ja(e,t,n){sr.call(this,t.s.add(n.s),[t,n],{C:!1}),this.j=t,this.B=n,this.u=e}function Ka(e,t,n,r){if(!ee(n,53)||!ee(r,53))throw Error("XPTY0004: Sequences to compare are not nodes");switch(e){case"isOp":return function(e,t){return e!==t||47!==e&&53!==e&&54!==e&&55!==e&&56!==e&&57!==e&&58!==e?function(){return!1}:function(e,t){return en(e.first().value,t.first().value)}}(n,r);case"nodeBeforeOp":return t?function(e,n){return 0>an(t,e.first(),n.first())}:void 0;case"nodeAfterOp":return t?function(e,n){return 0<an(t,e.first(),n.first())}:void 0;default:throw Error("Unexpected operator")}}function za(e,t,n){sr.call(this,t.s.add(n.s),[t,n],{C:!1}),this.j=t,this.B=n,this.u=e}function Wa(e,t,n,r){return n.L((function(n){if(n.some((function(e){return!ee(e.type,53)})))throw Error("XPTY0004: Sequences given to "+e+" should only contain nodes.");return"sorted"===r?ce.create(n):"reverse-sorted"===r?ce.create(n.reverse()):ce.create(sn(t,n))}))}function Za(e,t,n,r){sr.call(this,0<br(t.s,n.s)?t.s:n.s,[t,n],{C:t.C&&n.C},!1,r),this.j=e,this.u=t,this.B=n}function ei(e,t){vr.call(this,e.reduce((function(e,t){return e.add(t.s)}),new xr({})),e,{S:"unsorted",C:e.every((function(e){return e.C}))},t)}function ti(e,t,n){sr.call(this,new xr({}).add(e.s),[e,t],{C:e.C&&t.C},!1,n),this.j=e,this.u=t}function ni(e,t,n){if(sr.call(this,e.s,[e],{C:!1}),this.j=ge(t.prefix?t.prefix+":"+t.localName:t.localName),46===this.j||45===this.j||44===this.j)throw Error("XPST0080: Casting to xs:anyAtomicType, xs:anySimpleType or xs:NOTATION is not permitted.");if(t.namespaceURI)throw Error("Not implemented: castable as expressions with a namespace URI.");this.B=e,this.u=n}function ri(e,t,n){if(sr.call(this,e.s,[e],{C:!1}),this.j=ge(t.prefix?t.prefix+":"+t.localName:t.localName),46===this.j||45===this.j||44===this.j)throw Error("XPST0080: Casting to xs:anyAtomicType, xs:anySimpleType or xs:NOTATION is not permitted.");if(t.namespaceURI)throw Error("Not implemented: casting expressions with a namespace URI.");this.B=e,this.u=n}function oi(e,t){var n=e.value,r=null,o=!1;return ce.create({next:function(){for(;!o;){if(!r){var e=n.next(0);if(e.done)return o=!0,W(V);r=t(e.value)}if(e=r.getEffectiveBooleanValue(),r=null,!1===e)return o=!0,W(Q)}return z}})}function ai(e,t,n,r){sr.call(this,e.s,[e],{C:!1},!1,r),this.B=e,this.u=t,this.j=n}function ii(e,t){return!(null===e||null===t||!ee(e.type,53)||!ee(t.type,53))&&en(e.value,t.value)}function si(e){var t=e.next(0);if(t.done)return ce.empty();var n=null,r=null;return ce.create({next:function(o){if(t.done)return z;n||(n=t.value.value);do{var a=n.next(o);if(a.done){if((t=e.next(0)).done)return a;n=t.value.value}}while(a.done||ii(a.value,r));return r=a.value,a}})}function ui(e,t){var n=[];!function(){for(var e=t.next(0),r={};!e.done;)r.jb=e.value.value,e={current:r.jb.next(0),next:function(e){return function(t){return e.jb.next(t)}}(r)},e.current.done||n.push(e),e=t.next(0),r={jb:r.jb}}();var r=null,o=!1,a={};return ce.create((a[Symbol.iterator]=function(){return this},a.next=function(){o||(o=!0,n.every((function(e){return ee(e.current.value.type,53)}))&&n.sort((function(t,n){return an(e,t.current.value,n.current.value)})));do{if(!n.length)return z;var t=n.shift(),a=t.current;if(t.current=t.next(0),!ee(a.value.type,53))return a;if(!t.current.done){for(var i=0,s=n.length-1,u=0;i<=s;){u=Math.floor((i+s)/2);var c=an(e,t.current.value,n[u].current.value);if(0===c){i=u;break}0<c?i=u+1:s=u-1}n.splice(i,0,t)}}while(ii(a.value,r));return r=a.value,a},a))}function ci(e,t){var n=e.reduce((function(e,t){return 0<br(e,t.s)?e:t.s}),new xr({}));sr.call(this,n,e,{C:e.every((function(e){return e.C}))},!1,t),this.j=e}function li(e){return e.every((function(e){return null===e||ee(e.type,5)||ee(e.type,4)}))||null!==e.map((function(e){return e?Mt(e.type):null})).reduce((function(e,t){return null===t||t===e?e:null}))?e:e.every((function(e){return null===e||ee(e.type,1)||ee(e.type,20)}))?e.map((function(e){return e?zt(e,1):null})):e.every((function(e){return null===e||ee(e.type,4)||ee(e.type,6)}))?e.map((function(e){return e?zt(e,6):e})):e.every((function(e){return null===e||ee(e.type,4)||ee(e.type,6)||ee(e.type,3)}))?e.map((function(e){return e?zt(e,3):e})):null}function pi(e,t){var n=new xr({});Ca.call(this,n,[t].concat(p(e.map((function(e){return e.da})))),{C:!1,Y:!1,S:"unsorted",subtree:!1},t),this.B=e}function hi(e){sr.call(this,e?e.s:new xr({}),e?[e]:[],{S:"sorted",subtree:!1,Y:!1,C:!1}),this.j=e}function fi(e){sr.call(this,new xr({}),[],{S:"sorted"},!1,e)}function di(e,t){var n=e.every((function(e){return e.Y})),r=e.every((function(e){return e.subtree}));sr.call(this,e.reduce((function(e,t){return e.add(t.s)}),new xr({})),e,{C:!1,Y:n,S:t?"sorted":"unsorted",subtree:r}),this.j=e,this.u=t}function mi(e,t){sr.call(this,e.s.add(t.s),[e,t],{C:e.C&&t.C,Y:e.Y,S:e.O,subtree:e.subtree}),this.u=e,this.j=t}function gi(e,t,n){if(n=[n],ee(e.type,62))if("*"===t)n.push.apply(n,p(e.R.map((function(e){return e()}))));else{if(!ee(t.type,5))throw ao("The key specifier is not an integer.");var r=t.value;if(e.R.length<r||0>=r)throw Error("FOAY0001: Array index out of bounds");n.push(e.R[r-1]())}else{if(!ee(e.type,61))throw ao("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 $e(e.key,t)})))&&n.push(e.value())}return It(n)}function yi(e,t,n,r,o){return"*"===t?gi(e,t,n):(t=le(t=ur(t,r,o))().L((function(t){return t.reduce((function(t,n){return gi(e,n,t)}),new ne)})),It([n,t]))}function vi(e,t){sr.call(this,e.s,[e].concat("*"===t?[]:[t]),{C:e.C,S:e.O,subtree:e.subtree}),this.j=e,this.u=t}function wi(e,t){var n={};sr.call(this,new xr((n.external=1,n)),"*"===e?[]:[e],{C:!1},!1,t),this.j=e}function Ai(e,t,n,r){var o=t.map((function(e){return e.eb}));t=t.map((function(e){return e.name}));var a=o.reduce((function(e,t){return e.add(t.s)}),n.s);sr.call(this,a,o.concat(n),{C:!1},!1,r),this.u=e,this.B=t,this.J=o,this.T=n,this.j=null}function xi(e){sr.call(this,e,[],{C:!1})}function bi(e){var t={};xi.call(this,new xr((t.nodeType=1,t))),this.u=e}function Ei(e,t){t=void 0===t?{kind:null}:t;var n=e.prefix,r=e.namespaceURI,o={};"*"!==(e=e.localName)&&(o.nodeName=1),o.nodeType=1,xi.call(this,new xr(o)),this.u=e,this.J=r,this.B=n,this.T=t.kind}function Ni(e){var t={};xi.call(this,new xr((t.nodeName=1,t))),this.u=e}function Bi(e){xi.call(this,new xr({})),this.u=e}function Ti(e,t,n){sr.call(this,new xr({}),[],{C:!1,S:"unsorted"}),this.B=n,this.u=t,this.J=e,this.j=null}function Ii(e,t){var n=new xr({});Ca.call(this,n,[e,t],{C:!1,Y:!1,S:"unsorted",subtree:!1},t),this.B=e}function Ci(e,t){var n=t.h,r=t.s,o=t.A;switch(e.node.nodeType){case 1:var a=r.createElementNS(e.node.namespaceURI,e.node.nodeName);for(n.getAllAttributes(e.node).forEach((function(e){return o.setAttributeNS(a,e.namespaceURI,e.nodeName,e.value)})),e=(r=c(De(n,e))).next();!e.done;e=r.next())e=Ci(e.value,t),o.insertBefore(a,e.node,null);return{node:a,F:null};case 2:return(t=r.createAttributeNS(e.node.namespaceURI,e.node.nodeName)).value=Ue(n,e),{node:t,F:null};case 4:return{node:r.createCDATASection(Ue(n,e)),F:null};case 8:return{node:r.createComment(Ue(n,e)),F:null};case 9:for(r=r.createDocument(),e=(n=c(De(n,e))).next();!e.done;e=n.next())e=Ci(e.value,t),o.insertBefore(r,e.node,null);return{node:r,F:null};case 7:return{node:r.createProcessingInstruction(e.node.target,Ue(n,e)),F:null};case 3:return{node:r.createTextNode(Ue(n,e)),F:null}}}function Si(e,t){var n=t.A,r=t.s,o=t.h;if(!Ie(e.node))return Ci(e,t).node;switch(e.node.nodeType){case 2:return(r=r.createAttributeNS(e.node.namespaceURI,e.node.nodeName)).value=Ue(o,e),r;case 8:return r.createComment(Ue(o,e));case 1:var a=e.node.prefix,i=e.node.localName,s=r.createElementNS(e.node.namespaceURI,a?a+":"+i:i);return De(o,e).forEach((function(e){e=Si(e,t),n.insertBefore(s,e,null)})),Oe(o,e).forEach((function(e){n.setAttributeNS(s,e.node.namespaceURI,e.node.nodeName,Ue(o,e))})),s.normalize(),s;case 7:return r.createProcessingInstruction(e.node.target,Ue(o,e));case 3:return r.createTextNode(Ue(o,e))}}function Oi(e,t,n){var r=e.node;if(!(Ie(r)||n||e.F))return r;r=t.ha;var o=[];return n?Si(e,t):(e=function(e,t,n){var r=e;for(e=Fe(n,r);null!==e;){if(2===r.node.nodeType)t.push(r.node.nodeName);else{var o=De(n,e);t.push(o.findIndex((function(e){return en(e,r)})))}e=Fe(n,r=e)}return r}(e,o,t.h),(n=r.get(e.node))||(n={node:Si(e,t),F:null},r.set(e.node,n)),function(e,t,n){for(var r={};0<t.length;)r.Xa=t.pop(),e="string"==typeof r.Xa?Oe(n,e).find(function(e){return function(t){return t.node.nodeName===e.Xa}}(r)):De(n,e)[r.Xa],r={Xa:r.Xa};return e.node}(n,o,t.h))}function Ri(e){this.type=e}function Di(e){this.type="delete",this.target=e}function Ui(e,t,n){this.type=n,this.target=e,this.content=t}function Mi(e,t){Ui.call(this,e,t,"insertAfter")}function ki(e,t){this.type="insertAttributes",this.target=e,this.content=t}function Gi(e,t){Ui.call(this,e,t,"insertBefore")}function Fi(e,t){Ui.call(this,e,t,"insertIntoAsFirst")}function Pi(e,t){Ui.call(this,e,t,"insertIntoAsLast")}function Hi(e,t){Ui.call(this,e,t,"insertInto")}function _i(e,t){this.type="rename",this.target=e,this.s=t.va?t:new ve(t.prefix,t.namespaceURI,t.localName)}function ji(e,t){this.type="replaceElementContent",this.target=e,this.text=t}function Xi(e,t){this.type="replaceNode",this.target=e,this.s=t}function Li(e,t){this.type="replaceValue",this.target=e,this.s=t}function $i(e,t){return new Xi(e,t)}function qi(e){mr.call(this,new xr({}),[e],{C:!1,S:"unsorted"}),this.j=e}function Yi(e,t,n,r,o,a){var i=t.h;return e.reduce((function e(t,n){return ee(n.type,62)?(n.R.forEach((function(n){return n().M().forEach((function(n){return e(t,n)}))})),t):(t.push(n),t)}),[]).forEach((function(e,s,u){if(ee(e.type,47)){if(o)throw a(e.value,i);n.push(e.value.node)}else if(ee(e.type,46)||ee(e.type,53)&&3===e.value.node.nodeType){var c=ee(e.type,46)?zt(Dt(e,t).first(),1).value:Ue(i,e.value);0!==s&&ee(u[s-1].type,46)&&ee(e.type,46)?(r.push({data:" "+c,Qa:!0,nodeType:3}),o=!0):c&&(r.push({data:""+c,Qa:!0,nodeType:3}),o=!0)}else if(ee(e.type,55)){var l=[];De(i,e.value).forEach((function(e){return l.push(Xe(e))})),o=Yi(l,t,n,r,o,a)}else{if(!ee(e.type,53)){if(ee(e.type,60))throw Ot(e.type);throw Error("Atomizing "+e.type+" is not implemented.")}r.push(e.value.node),o=!0}})),o}function Vi(e,t,n){var r=[],o=[],a=!1;return e.forEach((function(e){a=Yi(e,t,r,o,a,n)})),{attributes:r,Ta:o}}function Qi(e,t,n,r,o){var a=[];switch(e){case 4:r.length&&a.push(new ki(t,r)),o.length&&a.push(new Fi(t,o));break;case 5:r.length&&a.push(new ki(t,r)),o.length&&a.push(new Pi(t,o));break;case 3:r.length&&a.push(new ki(t,r)),o.length&&a.push(new Hi(t,o));break;case 2:r.length&&a.push(new ki(n,r)),o.length&&a.push(new Gi(t,o));break;case 1:r.length&&a.push(new ki(n,r)),o.length&&a.push(new Mi(t,o))}return a}function Ji(e,t,n){mr.call(this,new xr({}),[e,n],{C:!1,S:"unsorted"}),this.J=e,this.j=t,this.B=n}function Ki(){return St("Casting not supported from given type to a single xs:string or xs:untypedAtomic or any of its derived types.")}y(Ja,sr),Ja.prototype.h=function(e,t){var n=this,r=ur(this.j,e,t),o=ur(this.B,e,t);return r.$({empty:function(){return ce.X()},default:function(){return o.$({empty:function(){return ce.X()},default:function(){var a=Xa(r,t),i=Xa(o,t);return function(e,t,n,r){return e=Qa[e],n.L((function(n){return t.filter((function(t){for(var o=0,a=n.length;o<a;++o){var i=n[o],s=void 0,u=void 0,l=t.type,p=i.type;if((ee(l,19)||ee(p,19))&&(ee(l,2)?s=3:ee(p,2)?u=3:ee(l,17)?s=17:ee(p,17)?u=17:ee(l,16)?s=16:ee(p,16)?u=16:ee(l,19)?u=p:ee(p,19)&&(s=l)),s=(u=c([u,s])).next().value,u=u.next().value,s?t=zt(t,s):u&&(i=zt(i,u)),qa(e,t.type,i.type)(t,i,r))return!0}return!1})).$({default:function(){return ce.ca()},empty:function(){return ce.X()}})}))}(n.u,a,i,e)}})}})},y(za,sr),za.prototype.h=function(e,t){var n=this,r=ur(this.j,e,t),o=ur(this.B,e,t);return r.$({empty:function(){return ce.empty()},multiple:function(){throw Error("XPTY0004: Sequences to compare are not singleton")},o:function(){return o.$({empty:function(){return ce.empty()},multiple:function(){throw Error("XPTY0004: Sequences to compare are not singleton")},o:function(){var a=r.first(),i=o.first();return Ka(n.u,t.h,a.type,i.type)(r,o,e)?ce.ca():ce.X()}})}})},y(Za,sr),Za.prototype.h=function(e,t){var n=this,r=Wa(this.j,t.h,ur(this.u,e,t),this.u.O);e=Wa(this.j,t.h,ur(this.B,e,t),this.B.O);var o=r.value,a=e.value,i=null,s=null,u=!1,c=!1;return ce.create({next:function(){if(u)return z;for(;!c;){if(!i){var e=o.next(0);if(e.done)return u=!0,z;i=e.value}if(!s){if((e=a.next(0)).done){c=!0;break}s=e.value}if(en(i.value,s.value)){if(e=W(i),s=i=null,"intersectOp"===n.j)return e}else if(0>an(t.h,i,s)){if(e=W(i),i=null,"exceptOp"===n.j)return e}else s=null}return"exceptOp"===n.j?null!==i?(e=W(i),i=null,e):o.next(0):(u=!0,z)}})},y(ei,vr),ei.prototype.B=function(e,t,n){return n.length?It(n.map((function(t){return t(e)}))):ce.empty()},y(ti,sr),ti.prototype.h=function(e,t){var n=this,r=xt(e,ur(this.j,e,t)),o=null,a=null,i=!1;return ce.create({next:function(e){for(;!i;){if(!o&&(o=r.next(e)).done)return i=!0,z;a||(a=ur(n.u,o.value,t));var s=a.value.next(e);if(!s.done)return s;o=a=null}}})},y(ni,sr),ni.prototype.h=function(e,t){var n=this,r=Ut(ur(this.B,e,t),t);return r.$({empty:function(){return n.u?ce.ca():ce.X()},o:function(){return r.map((function(e){return Kt(e,n.j).v?V:Q}))},multiple:function(){return ce.X()}})},y(ri,sr),ri.prototype.h=function(e,t){var n=this,r=Ut(ur(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 ce.empty()},o:function(){return r.map((function(e){return zt(e,n.j)}))},multiple:function(){throw Error("XPTY0004: Sequence to cast is not singleton or empty.")}})},y(ai,sr),ai.prototype.h=function(e,t){var n=this,r=ur(this.B,e,t);return r.$({empty:function(){return"?"===n.j||"*"===n.j?ce.ca():ce.X()},multiple:function(){return"+"===n.j||"*"===n.j?oi(r,(function(r){var o=ce.o(r);return r=Nt(e,0,r,o),ur(n.u,r,t)})):ce.X()},o:function(){return oi(r,(function(r){var o=ce.o(r);return r=Nt(e,0,r,o),ur(n.u,r,t)}))}})},y(ci,sr),ci.prototype.h=function(e,t){var n=this;if(this.j.every((function(e){return"sorted"===e.O}))){var r=0;return ui(t.h,{next:function(){return r>=n.j.length?z:W(ur(n.j[r++],e,t))}}).map((function(e){if(!ee(e.type,53))throw Error("XPTY0004: The sequences to union are not of type node()*");return e}))}return It(this.j.map((function(n){return ur(n,e,t)}))).L((function(e){if(e.some((function(e){return!ee(e.type,53)})))throw Error("XPTY0004: The sequences to union are not of type node()*");return e=sn(t.h,e),ce.create(e)}))},y(pi,Ca),pi.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 o,a,i=[],s=!1,u=null,l=this.B[0];return ce.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 Ut(e,n)}))).find((function(e){return!e.G()&&!e.ya()})))throw ao("Order by only accepts empty or singleton sequences");if(function(e){return(e=e.find((function(e){return!!e})))?Mt(e.type):null}(o=(o=p.map((function(e){return e.first()}))).map((function(e){return null===e?e:ee(19,e.type)?zt(e,1):e})))&&!(o=li(o)))throw ao("Could not cast values");p=o.length,a=o.map((function(e,t){return t}));for(var h=0;h<p;h++)if(h+1!==p)for(var f=h;0<=f;f--){var d=f,m=f+1;if(m!==p){var g=o[a[d]],y=o[a[m]];if(null!==y||null!==g){if(l.zc){if(null===g)continue;if(null===y&&null!==g){g=c([a[m],a[d]]),a[d]=g.next().value,a[m]=g.next().value;continue}if(isNaN(y.value)&&null!==g&&!isNaN(g.value)){g=c([a[m],a[d]]),a[d]=g.next().value,a[m]=g.next().value;continue}}else{if(null===y)continue;if(null===g&&null!==y){g=c([a[m],a[d]]),a[d]=g.next().value,a[m]=g.next().value;continue}if(isNaN(g.value)&&null!==y&&!isNaN(y.value)){g=c([a[m],a[d]]),a[d]=g.next().value,a[m]=g.next().value;continue}}qa("gtOp",g.type,y.type)(g,y,e)&&(g=c([a[m],a[d]]),a[d]=g.next().value,a[m]=g.next().value)}}}var v=l.Gb?0:o.length-1;u=r({next:function(){return l.Gb?v>=o.length?z:W(i[a[v++]]):0>v?z:W(i[a[v--]])}}).value,s=!0}return u.next(0)}})},y(hi,sr),hi.prototype.h=function(e,t){if(null===e.N)throw Error("XPDY0002: context is absent, it needs to be present to use paths.");for(var n=t.h,r=e.N.value;9!==r.node.nodeType;)if(null===(r=Fe(n,r)))throw Error("XPDY0050: the root node of the context node is not a document node.");return n=ce.o(Xe(r)),this.j?ur(this.j,Nt(e,0,n.first(),n),t):n},y(fi,sr),fi.prototype.h=function(e){if(null===e.N)throw Error('XPDY0002: context is absent, it needs to be present to use the "." operator');return ce.o(e.N)},y(di,sr),di.prototype.h=function(e,t){var n=this,r=!0;return this.j.reduce((function(o,a,i){var s=null===o?Wt(e):xt(e,o);if(o={next:function(e){if((e=s.next(e)).done)return z;if(null!==e.value.N&&!ee(e.value.N.type,53)&&0<i)throw Error("XPTY0019: The result of E1 in a path expression E1/E2 should not evaluate to a sequence of nodes.");return W(ur(a,e.value,t))}},n.u)switch(a.O){case"reverse-sorted":var u=o;o={next:function(e){return(e=u.next(e)).done?e:W(e.value.L((function(e){return ce.create(e.reverse())})))}};case"sorted":if(a.subtree&&r){var c=si(o);break}c=ui(t.h,o);break;case"unsorted":return si(o).L((function(e){return ce.create(function(e,t){var n=!1,r=!1;if(t.forEach((function(e){ee(e.type,53)?n=!0:r=!0})),r&&n)throw Error("XPTY0018: The path operator should either return nodes or non-nodes. Mixed sequences are not allowed.");return n?sn(e,t):t}(t.h,e))}))}else c=si(o);return r=r&&a.Y,c}),null)},di.prototype.A=function(){return this.j[0].A()},y(mi,sr),mi.prototype.h=function(e,t){var n=this,r=ur(this.u,e,t);if(this.j.C){var o=ur(this.j,e,t);if(o.G())return o;var a=o.first();if(ee(a.type,2)){var i=a.value;if(!Number.isInteger(i))return ce.empty();var s=r.value,u=!1;return ce.create({next:function(){if(!u){for(var e=s.next(0);!e.done;e=s.next(0))if(1==i--)return u=!0,e;u=!0}return z}})}return o.getEffectiveBooleanValue()?r:ce.empty()}var c=r.value,l=null,p=0,h=null;return ce.create({next:function(o){for(var a=!1;(!l||!l.done)&&(l||(l=c.next(a?0:o),a=!0),!l.done);){h||(h=ur(n.j,Nt(e,p,l.value,r),t));var i=h.first();i=null!==i&&(ee(i.type,2)?i.value===p+1:h.getEffectiveBooleanValue()),h=null;var s=l.value;if(l=null,p++,i)return W(s)}return l}})},mi.prototype.A=function(){return this.u.A()},y(vi,sr),vi.prototype.h=function(e,t){var n=this;return ur(this.j,e,t).L((function(r){return r.reduce((function(r,o){return yi(o,n.u,r,e,t)}),new ne)}))},vi.prototype.A=function(){return this.j.A()},y(wi,sr),wi.prototype.h=function(e,t){return yi(e.N,this.j,new ne,e,t)},y(Ai,sr),Ai.prototype.h=function(e,t){var n=this,r=e,o=this.j.map((function(o,a){var i=ur(n.J[a],r,t).M();return r=Bt(e,((a={})[o]=function(){return ce.create(i)},a)),i}));if(o.some((function(e){return 0===e.length})))return"every"===this.u?ce.ca():ce.X();var a=Array(o.length).fill(0);a[0]=-1;for(var i=!0;i;){i=!1;for(var s=0,u=a.length;s<u;++s){var c=o[s];if(!(++a[s]>c.length-1)){for(i=Object.create(null),s={},u=0;u<a.length;s={ub:s.ub},u++)s.ub=o[u][a[u]],i[this.j[u]]=function(e){return function(){return ce.o(e.ub)}}(s);if(i=Bt(e,i),(i=ur(this.T,i,t)).getEffectiveBooleanValue()&&"some"===this.u)return ce.ca();if(!i.getEffectiveBooleanValue()&&"every"===this.u)return ce.X();i=!0;break}a[s]=0}}return"every"===this.u?ce.ca():ce.X()},Ai.prototype.P=function(e){this.j=[];for(var t=0,n=this.B.length;t<n;++t){this.J[t].P(e),wo(e);var r=this.B[t],o=r.prefix?e.ba(r.prefix):null;r=bo(e,o,r.localName),this.j[t]=r}for(this.T.P(e),t=0,n=this.B.length;t<n;++t)No(e)},y(xi,sr),xi.prototype.h=function(e){return this.j(e.N)?ce.ca():ce.X()},y(bi,xi),bi.prototype.j=function(e){return!!ee(e.type,53)&&(e=e.value.node.nodeType,3===this.u&&4===e||this.u===e)},bi.prototype.A=function(){return"type-"+this.u},y(Ei,xi),Ei.prototype.j=function(e){var t=ee(e.type,54),n=ee(e.type,47);return!(!t&&!n)&&(e=e.value,!(null!==this.T&&(1===this.T&&!t||2===this.T&&!n))&&(null===this.B&&""!==this.J&&"*"===this.u||("*"===this.B?"*"===this.u||this.u===e.node.localName:("*"===this.u||this.u===e.node.localName)&&(e.node.namespaceURI||null)===((""===this.B?t?this.J:null:this.J)||null))))},Ei.prototype.A=function(){return"*"===this.u?null===this.T?"type-1-or-type-2":"type-"+this.T:"name-"+this.u},Ei.prototype.P=function(e){if(null===this.J&&"*"!==this.B&&(this.J=e.ba(this.B||"")||null,!this.J&&this.B))throw Error("XPST0081: The prefix "+this.B+" could not be resolved.")},y(Ni,xi),Ni.prototype.j=function(e){return ee(e.type,57)&&e.value.node.target===this.u},Ni.prototype.A=function(){return"type-7"},y(Bi,xi),Bi.prototype.j=function(e){return ee(e.type,ge(this.u.prefix?this.u.prefix+":"+this.u.localName:this.u.localName))},y(Ti,sr),Ti.prototype.h=function(e,t){if(!e.Ea[this.j]){if(this.T)return this.T(e,t);throw Error("XQDY0054: The variable "+this.B+" is declared but not in scope.")}return e.Ea[this.j]()},Ti.prototype.P=function(e){if(null===this.u&&this.J&&(this.u=e.ba(this.J)),this.j=e.qb(this.u||"",this.B),!this.j)throw Error("XPST0008, The variable "+this.B+" is not in scope.");(e=e.Da[this.j])&&(this.T=e)},y(Ii,Ca),Ii.prototype.J=function(e,t,n,r){var o=this,a=null,i=null;return r({next:function(){for(;;){if(!i){var e=t.next(0);if(e.done)return z;a=e.value,i=ur(o.B,a,n)}e=i.getEffectiveBooleanValue();var r=a;if(i=a=null,e)return W(r)}}})},y(Di,Ri),Di.prototype.h=function(e){var t={};return t.type=this.type,t.target=Oi(this.target,e,!1),t},y(Ui,Ri),Ui.prototype.h=function(e){var t={};return t.type=this.type,t.target=Oi(this.target,e,!1),t.content=this.content.map((function(t){return Oi(t,e,!0)})),t},y(Mi,Ui),y(ki,Ri),ki.prototype.h=function(e){var t={};return t.type=this.type,t.target=Oi(this.target,e,!1),t.content=this.content.map((function(t){return Oi(t,e,!0)})),t},y(Gi,Ui),y(Fi,Ui),y(Pi,Ui),y(Hi,Ui),y(_i,Ri),_i.prototype.h=function(e){var t={},n={};return n.type=this.type,n.target=Oi(this.target,e,!1),n.newName=(t.prefix=this.s.prefix,t.namespaceURI=this.s.namespaceURI,t.localName=this.s.localName,t),n},y(ji,Ri),ji.prototype.h=function(e){var t={};return t.type=this.type,t.target=Oi(this.target,e,!1),t.text=this.text?Oi(this.text,e,!0):null,t},y(Xi,Ri),Xi.prototype.h=function(e){var t={};return t.type=this.type,t.target=Oi(this.target,e,!1),t.replacement=this.s.map((function(t){return Oi(t,e,!0)})),t},y(Li,Ri),Li.prototype.h=function(e){var t={};return t.type=this.type,t.target=Oi(this.target,e,!1),t["string-value"]=this.s,t},y(qi,mr),qi.prototype.u=function(e,t){var n,r,o=gr(this.j)(e,t),a=t.h;return{next:function(){if(!n){var e=o.next(0);if(e.value.H.some((function(e){return!ee(e.type,53)})))throw Error("XUTY0007: The target of a delete expression must be a sequence of zero or more nodes.");n=e.value.H,r=e.value.fa}return n=n.filter((function(e){return Fe(a,e.value)})),W({fa:dr(n.map((function(e){return new Di(e.value)})),r),H:[]})}}},y(Ji,mr),Ji.prototype.u=function(e,t){var n,r,o,a,i,s,u=this,c=gr(this.J)(e,t),l=gr(this.B)(e,t),p=t.h;return{next:function(){if(!n){var e=c.next(0),h=Vi([e.value.H],t,zn);n=h.attributes.map((function(e){return{node:e,F:null}})),r=h.Ta.map((function(e){return{node:e,F:null}})),o=e.value.fa}if(!a){if(0===(e=l.next(0)).value.H.length)throw ir();if(3<=u.j){if(1!==e.value.H.length)throw Wn();if(!ee(e.value.H[0].type,54)&&!ee(e.value.H[0].type,55))throw Wn()}else{if(1!==e.value.H.length)throw Zn();if(!(ee(e.value.H[0].type,54)||ee(e.value.H[0].type,56)||ee(e.value.H[0].type,58)||ee(e.value.H[0].type,57)))throw Zn();if(null===(s=Fe(p,e.value.H[0].value,null)))throw Error("XUDY0029: The target "+e.value.H[0].value.outerHTML+" for inserting a node before or after must have a parent.")}a=e.value.H[0],i=e.value.fa}if(n.length){if(3<=u.j){if(!ee(a.type,54))throw Error("XUTY0022: An insert expression specifies the insertion of an attribute node into a document node.")}else if(1!==s.node.nodeType)throw Error("XUDY0030: An insert expression specifies the insertion of an attribute node before or after a child of a document node.");n.reduce((function(e,t){var n=t.node.prefix||"",r=t.node.prefix||"",o=t.node.namespaceURI,i=r?a.value.node.lookupNamespaceURI(r):null;if(i&&i!==o)throw or(o);if((r=e[r])&&o!==r)throw ar(o);return e[n]=t.node.namespaceURI,e}),{})}return W({H:[],fa:dr(Qi(u.j,a.value,s||null,n,r),o,i)})}}};var zi=/([A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])/,Wi=new RegExp(zi.source+new RegExp("("+zi.source+"|[-.0-9·̀-ͯ‿⁀])").source+"*","g");function Zi(e){return!!(e=e.match(Wi))&&1===e.length}function es(e,t){return Ut(t,e).$({o:function(e){if(ee((e=e.first()).type,1)||ee(e.type,19)){if(!Zi(e.value))throw Error('XQDY0041: The value "'+e.value+'" of a name expressions cannot be converted to a NCName.');return ce.o(e)}throw Ki()},default:function(){throw Ki()}}).value}function ts(e,t,n){return Ut(n,t).$({o:function(t){if(ee((t=t.first()).type,23))return ce.o(t);if(ee(t.type,1)||ee(t.type,19)){if(1===(t=t.value.split(":")).length)t=t[0];else{var n=t[0],r=e.ba(n);t=t[1]}if(!Zi(t)||n&&!Zi(n))throw ho(n?n+":"+t:t);if(n&&!r)throw ho(n+":"+t);return ce.o({type:23,value:new ve(n,r,t)})}throw Ki()},default:function(){throw Ki()}}).value}function ns(e,t){mr.call(this,new xr({}),[e,t],{C:!1,S:"unsorted"}),this.B=e,this.J=t,this.j=void 0}function rs(e,t,n){mr.call(this,new xr({}),[t,n],{C:!1,S:"unsorted"}),this.J=e,this.j=t,this.B=n}function os(e){switch(e.type){case"delete":return new Di({node:e.target,F:null});case"insertAfter":return new Mi({node:e.target,F:null},e.content.map((function(e){return{node:e,F:null}})));case"insertBefore":return new Gi({node:e.target,F:null},e.content.map((function(e){return{node:e,F:null}})));case"insertInto":return new Hi({node:e.target,F:null},e.content.map((function(e){return{node:e,F:null}})));case"insertIntoAsFirst":return new Fi({node:e.target,F:null},e.content.map((function(e){return{node:e,F:null}})));case"insertIntoAsLast":return new Pi({node:e.target,F:null},e.content.map((function(e){return{node:e,F:null}})));case"insertAttributes":return new ki({node:e.target,F:null},e.content.map((function(e){return{node:e,F:null}})));case"rename":return new _i({node:e.target,F:null},e.newName);case"replaceNode":return new Xi({node:e.target,F:null},e.replacement.map((function(e){return{node:e,F:null}})));case"replaceValue":return new Li({node:e.target,F:null},e["string-value"]);case"replaceElementContent":return new ji({node:e.target,F:null},e.text?{node:e.text,F:null}:null);default:throw Error('Unexpected type "'+e.type+'" when parsing a transferable pending update.')}}function as(e,t,n){if(t.find((function(t){return en(t,e)})))return!0;var r=Fe(n,e);return!!r&&as(r,t,n)}function is(e,t,n){mr.call(this,new xr({}),e.reduce((function(e,t){return e.push(t.eb),e}),[t,n]),{C:!1,S:"unsorted"}),this.j=e,this.J=t,this.B=n,this.I=null}function ss(e,t){return{node:{nodeType:2,Qa:!0,nodeName:e.va(),namespaceURI:e.namespaceURI,prefix:e.prefix,localName:e.localName,name:e.va(),value:t},F:null}}function us(e,t){var n=t.tb||[];n=n.concat(e.Ka||[]),sr.call(this,new xr({}),n,{C:!1,S:"unsorted"}),e.Ka?this.u=e.Ka:this.name=new ve(e.prefix,e.namespaceURI,e.localName),this.j=t,this.B=void 0}function cs(e){sr.call(this,e?e.s:new xr({}),e?[e]:[],{C:!1,S:"unsorted"}),this.j=e}function ls(e,t,n,r){sr.call(this,new xr({}),r.concat(t).concat(e.Ka||[]),{C:!1,S:"unsorted"}),e.Ka?this.u=e.Ka:this.j=new ve(e.prefix,e.namespaceURI,e.localName),this.T=n.reduce((function(e,t){if(t.prefix in e)throw Error("XQST0071: The namespace declaration with the prefix "+t.prefix+" has already been declared on the constructed element.");return e[t.prefix||""]=t.uri,e}),{}),this.J=t,this.ka=r,this.B=void 0}function ps(e){if(/^xml$/i.test(e))throw Error('XQDY0064: The target of a created PI may not be "'+e+'"')}function hs(e,t){return{node:{data:t,Qa:!0,nodeName:e,nodeType:7,target:e},F:null}}function fs(e,t){var n=e.Cb?[e.Cb].concat(t):[t];sr.call(this,n.reduce((function(e,t){return e.add(t.s)}),new xr({})),n,{C:!1,S:"unsorted"}),this.j=e,this.u=t}function ds(e){sr.call(this,e?e.s:new xr({}),e?[e]:[],{C:!1,S:"unsorted"}),this.j=e}function ms(e,t,n,r){var o,a=new xr({});vr.call(this,a,(o=[e].concat(p(t.map((function(e){return e.xc}))),[n])).concat.apply(o,p(t.map((function(e){return e.Lb.map((function(e){return e.Kb}))})))),{C:!1,Y:!1,S:"unsorted",subtree:!1},r),this.J=e,this.j=t.length,this.T=t.map((function(e){return e.Lb}))}y(ns,mr),ns.prototype.u=function(e,t){var n=this,r=gr(this.B)(e,t),o=gr(this.J)(e,t);return{next:function(){var e=r.next(0),a=e.value.H;if(0===a.length)throw ir();if(1!==a.length)throw tr();if(!ee(a[0].type,54)&&!ee(a[0].type,47)&&!ee(a[0].type,57))throw tr();a=a[0];var i=o.next(0);e:{var s=n.j,u=ce.create(i.value.H);switch(a.type){case 54:if(s=ts(s,t,u).next(0).value.value,(u=a.value.node.lookupNamespaceURI(s.prefix))&&u!==s.namespaceURI)throw or(s.namespaceURI);break e;case 47:if((s=ts(s,t,u).next(0).value.value).namespaceURI&&(u=a.value.node.lookupNamespaceURI(s.prefix))&&u!==s.namespaceURI)throw or(s.namespaceURI);break e;case 57:s=new ve("",null,s=es(t,u).next(0).value.value);break e}s=void 0}return W({H:[],fa:dr([new _i(a.value,s)],e.value.fa,i.value.fa)})}}},ns.prototype.P=function(e){this.j=vo(e),mr.prototype.P.call(this,e)},y(rs,mr),rs.prototype.u=function(e,t){var n=gr(this.j)(e,t);return e=gr(this.B)(e,t),this.J?function(e,t,n){var r,o,a,i,s=!1;return{next:function(){if(s)return z;if(!a){var u=n.next(0),c=Ut(ce.create(u.value.H),e).map((function(e){return zt(e,1)})).M().map((function(e){return e.value})).join(" ");a=0===c.length?null:{node:e.s.createTextNode(c),F:null},i=u.value.fa}if(!r){if(0===(u=t.next(0)).value.H.length)throw ir();if(1!==u.value.H.length)throw er();if(!(ee(u.value.H[0].type,54)||ee(u.value.H[0].type,47)||ee(u.value.H[0].type,56)||ee(u.value.H[0].type,58)||ee(u.value.H[0].type,57)))throw er();r=u.value.H[0],o=u.value.fa}if(ee(r.type,54))return s=!0,W({H:[],fa:dr([new ji(r.value,a)],i,o)});if(ee(r.type,47)||ee(r.type,56)||ee(r.type,58)||ee(r.type,57)){if(u=a?Ue(e.h,a):"",ee(r.type,58)&&(u.includes("--")||u.endsWith("-")))throw Error('XQDY0072: The content "'+u+'" for a comment node contains two adjacent hyphens or ends with a hyphen.');if(ee(r.type,57)&&u.includes("?>"))throw Error('XQDY0026: The content "'+u+'" for a processing instruction node contains "?>".');return s=!0,W({H:[],fa:dr([new Li(r.value,u)],i,o)})}}}}(t,n,e):function(e,t,n){var r,o,a;return{next:function(){if(!r){var i=n.next(0),s=Vi([i.value.H],e,ar);r={attributes:s.attributes.map((function(e){return{node:e,F:null}})),Ta:s.Ta.map((function(e){return{node:e,F:null}}))},o=i.value.fa}if(0===(s=t.next(0)).value.H.length)throw ir();if(1!==s.value.H.length)throw er();if(!(ee(s.value.H[0].type,54)||ee(s.value.H[0].type,47)||ee(s.value.H[0].type,56)||ee(s.value.H[0].type,58)||ee(s.value.H[0].type,57)))throw er();if(null===(a=Fe(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,ee(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=a.node.lookupNamespaceURI(n);if(r&&r!==t)throw or(t);if((r=e[n])&&t!==r)throw ar(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 W({H:[],fa:dr([$i(i.value,[].concat(r.attributes,r.Ta))],o,s)})}}}(t,n,e)},y(is,mr),is.prototype.h=function(e,t){return yr(e=this.u(e,t),(function(){}))},is.prototype.u=function(e,t){var n,r,o,a=this,i=t.h,s=t.s,u=t.A,c=[],l=[],h=[];return{next:function(){if(l.length!==a.j.length)for(var f={},d=l.length;d<a.j.length;f={gb:f.gb},d++){var m=a.j[d],g=c[d];if(g||(c[d]=g=gr(m.eb)(e,t)),1!==(g=g.next(0)).value.H.length||!ee(g.value.H[0].type,53))throw Error("XUTY0013: The source expression of a copy modify expression must return a single node.");f.gb=Xe(Ci(g.value.H[0].value,t)),l.push(f.gb.value),h.push(g.value.fa),e=Bt(e,((g={})[m.Ec]=function(e){return function(){return ce.o(e.gb)}}(f),g))}return o||(n||(n=gr(a.J)(e,t)),o=n.next(0).value.fa),o.forEach((function(e){if(e.target&&!as(e.target,l,i))throw Error("XUDY0014: The target "+e.target.node.outerHTML+" must be a node created by the copy clause.");if("put"===e.type)throw Error("XUDY0037: The modify expression of a copy modify expression can not contain a fn:put.")})),f=o.map((function(e){return os(e=e.h(t))})),fr(f,i,s,u),r||(r=gr(a.B)(e,t)),W({H:(f=r.next(0)).value.H,fa:dr.apply(null,[f.value.fa].concat(p(h)))})}}},is.prototype.P=function(e){wo(e),this.j.forEach((function(t){return t.Ec=bo(e,t.Nb.namespaceURI,t.Nb.localName)})),mr.prototype.P.call(this,e),No(e),this.I=this.j.some((function(e){return e.eb.I}))||this.B.I},y(us,sr),us.prototype.h=function(e,t){var n,r,o,a=this,i=!1;return ce.create({next:function(){if(i)return z;if(!r){if(a.u){if(!n){var s=a.u.h(e,t);n=ts(a.B,t,s)}r=n.next(0).value.value}else r=a.name;if(r){if("xmlns"===r.prefix)throw so(r);if(""===r.prefix&&"xmlns"===r.localName)throw so(r);if("http://www.w3.org/2000/xmlns/"===r.namespaceURI)throw so(r);if("xml"===r.prefix&&"http://www.w3.org/XML/1998/namespace"!==r.namespaceURI)throw so(r);if(""!==r.prefix&&"xml"!==r.prefix&&"http://www.w3.org/XML/1998/namespace"===r.namespaceURI)throw so(r)}}return a.j.tb?(s=a.j.tb,o||(o=It(s.map((function(n){return Ut(n.h(e,t),t).L((function(e){return ce.o(Y(e.map((function(e){return e.value})).join(" "),1))}))}))).L((function(e){return ce.o(Xe(ss(r,e.map((function(e){return e.value})).join(""))))})).value),o.next(0)):(i=!0,W(Xe(ss(r,a.j.value))))}})},us.prototype.P=function(e){if(this.B=vo(e),this.name&&this.name.prefix&&!this.name.namespaceURI){var t=e.ba(this.name.prefix);if(void 0===t&&this.name.prefix)throw Rt(this.name.prefix);this.name.namespaceURI=t||null}sr.prototype.P.call(this,e)},y(cs,sr),cs.prototype.h=function(e,t){var n={data:"",Qa:!0,nodeType:8},r={node:n,F:null};return this.j?Ut(e=ur(this.j,e,t),t).L((function(e){if(e=e.map((function(e){return zt(e,1).value})).join(" "),-1!==e.indexOf("--\x3e"))throw Error('XQDY0072: The contents of the data of a comment may not include "--\x3e"');return n.data=e,ce.o(Xe(r))})):ce.o(Xe(r))},y(ls,sr),ls.prototype.h=function(e,t){var n,r,o,a,i,s=this,u=!1,c=!1,l=!1;return ce.create({next:function(){if(l)return z;if(u||(n||(n=It(s.J.map((function(n){return ur(n,e,t)})))),r=n.M(),u=!0),!c){o||(o=s.ka.map((function(n){return ur(n,e,t)})));for(var p=[],h=0;h<o.length;h++){var f=o[h].M();p.push(f)}a=p,c=!0}if(s.u&&(i||(p=s.u.h(e,t),i=ts(s.B,t,p)),p=i.next(0),s.j=p.value.value),"xmlns"===s.j.prefix||"http://www.w3.org/2000/xmlns/"===s.j.namespaceURI||"xml"===s.j.prefix&&"http://www.w3.org/XML/1998/namespace"!==s.j.namespaceURI||s.j.prefix&&"xml"!==s.j.prefix&&"http://www.w3.org/XML/1998/namespace"===s.j.namespaceURI)throw Error('XQDY0096: The node name "'+s.j.va()+'" is invalid for a computed element constructor.');var d={nodeType:1,Qa:!0,attributes:[],childNodes:[],nodeName:s.j.va(),namespaceURI:s.j.namespaceURI,prefix:s.j.prefix,localName:s.j.localName};for(p={node:d,F:null},r.forEach((function(e){d.attributes.push(e.value.node)})),(h=Vi(a,t,io)).attributes.forEach((function(e){if(d.attributes.find((function(t){return t.namespaceURI===e.namespaceURI&&t.localName===e.localName})))throw Error("XQDY0025: The attribute "+e.name+" does not have an unique name in the constructed element.");d.attributes.push(e)})),h.Ta.forEach((function(e){d.childNodes.push(e)})),h=0;h<d.childNodes.length;h++)if(Ie(f=d.childNodes[h])&&3===f.nodeType){var m=d.childNodes[h-1];m&&Ie(m)&&3===m.nodeType&&(m.data+=f.data,d.childNodes.splice(h,1),h--)}return l=!0,W(Xe(p))}})},ls.prototype.P=function(e){var t=this;if(wo(e),Object.keys(this.T).forEach((function(n){return xo(e,n,t.T[n])})),this.ha.forEach((function(t){return t.P(e)})),this.J.reduce((function(t,n){if(n.name){if(n="Q{"+(null===n.name.namespaceURI?e.ba(n.name.prefix):n.name.namespaceURI)+"}"+n.name.localName,t.includes(n))throw Error("XQST0040: The attribute "+n+" does not have an unique name in the constructed element.");t.push(n)}return t}),[]),this.j&&null===this.j.namespaceURI){var n=e.ba(this.j.prefix);if(void 0===n&&this.j.prefix)throw Rt(this.j.prefix);this.j.namespaceURI=n}this.B=vo(e),No(e)},y(fs,sr),fs.prototype.h=function(e,t){var n=this;return Ut(ur(this.u,e,t),t).L((function(r){var o=r.map((function(e){return zt(e,1).value})).join(" ");if(-1!==o.indexOf("?>"))throw Error('XQDY0026: The contents of the data of a processing instruction may not include "?>"');if(null!==n.j.Jb)return ps(r=n.j.Jb),ce.o(Xe(hs(r,o)));r=ur(n.j.Cb,e,t);var a=es(t,r);return ce.create({next:function(){var e=a.next(0);return e.done?e:(ps(e=e.value.value),W(Xe(hs(e,o))))}})}))},y(ds,sr),ds.prototype.h=function(e,t){return this.j?Ut(e=ur(this.j,e,t),t).L((function(e){return 0===e.length?ce.empty():(e={node:{data:e.map((function(e){return zt(e,1).value})).join(" "),Qa:!0,nodeType:3},F:null},ce.o(Xe(e)))})):ce.empty()},y(ms,vr),ms.prototype.B=function(e,t,n){var r=this;return n[0](e).L((function(o){for(var a=0;a<r.j;a++)if(r.T[a].some((function(n){switch(n.Cc){case"?":if(1<o.length)return!1;break;case"*":break;case"+":if(1>o.length)return!1;break;default:if(1!==o.length)return!1}var r=ce.create(o);return o.every((function(o,a){return o=Nt(e,a,o,r),ur(n.Kb,o,t).getEffectiveBooleanValue()}))})))return n[a+1](e);return n[r.j+1](e)}))},ms.prototype.P=function(e){if(vr.prototype.P.call(this,e),this.J.I)throw Kn()};var gs={aa:!1,qa:!1},ys={aa:!0,qa:!1},vs={aa:!0,qa:!0};function ws(e){return e.aa?e.qa?vs:ys:gs}function As(e,t){switch(e[0]){case"andOp":var n=Io(e,"type");return new _a(bs("andOp",e,ws(t)),n);case"orOp":return n=Io(e,"type"),new ja(bs("orOp",e,ws(t)),n);case"unaryPlusOp":return n=Bo(Bo(e,"operand"),"*"),e=Io(e,"type"),new Ha("+",As(n,t),e);case"unaryMinusOp":return n=Bo(Bo(e,"operand"),"*"),e=Io(e,"type"),new Ha("-",As(n,t),e);case"addOp":case"subtractOp":case"multiplyOp":case"divOp":case"idivOp":case"modOp":var r=e[0],o=As(Co(e,["firstOperand","*"]),ws(t));t=As(Co(e,["secondOperand","*"]),ws(t));var a=Io(e,"type"),i=Io(Co(e,["firstOperand","*"]),"type"),s=Io(Co(e,["secondOperand","*"]),"type");return i&&s&&Io(e,"type")&&(n=_o(r,i.type,s.type)),new Lo(r,o,t,a,n);case"sequenceExpr":return function(e,t){var n=So(e,"*").map((function(e){return As(e,t)}));return 1===n.length?n[0]:(n=Io(e,"type"),new ei(So(e,"*").map((function(e){return As(e,t)})),n))}(e,t);case"unionOp":return n=Io(e,"type"),new ci([As(Co(e,["firstOperand","*"]),ws(t)),As(Co(e,["secondOperand","*"]),ws(t))],n);case"exceptOp":case"intersectOp":return n=Io(e,"type"),new Za(e[0],As(Co(e,["firstOperand","*"]),ws(t)),As(Co(e,["secondOperand","*"]),ws(t)),n);case"stringConcatenateOp":return function(e,t){var n=Io(e,"type");return new Ir(new Ga({localName:"concat",namespaceURI:"http://www.w3.org/2005/xpath-functions",prefix:""},(e=[Co(e,["firstOperand","*"]),Co(e,["secondOperand","*"])]).length,n),e.map((function(e){return As(e,ws(t))})),n)}(e,t);case"rangeSequenceExpr":return function(e,t){var n=Io(e,"type");return new Ir(new Ga({localName:"to",namespaceURI:"http://fontoxpath/operators",prefix:""},(e=[Bo(Bo(e,"startExpr"),"*"),Bo(Bo(e,"endExpr"),"*")]).length,n),e.map((function(e){return As(e,ws(t))})),n)}(e,t);case"equalOp":case"notEqualOp":case"lessThanOrEqualOp":case"lessThanOp":case"greaterThanOrEqualOp":case"greaterThanOp":return Ns("generalCompare",e,t);case"eqOp":case"neOp":case"ltOp":case"leOp":case"gtOp":case"geOp":return Ns("valueCompare",e,t);case"isOp":case"nodeBeforeOp":case"nodeAfterOp":return Ns("nodeCompare",e,t);case"pathExpr":return function(e,t){var n=Io(e,"type"),r=So(e,"stepExpr"),o=!1,a=r.map((function(e){for(var r=Bo(e,"xpathAxis"),a=So(e,"*"),i=[],s=null,u=(a=c(a)).next();!u.done;u=a.next())switch(u=u.value,u[0]){case"lookup":i.push(["lookup",Es(u,t)]);break;case"predicate":case"predicates":for(var l=(u=c(So(u,"*"))).next();!l.done;l=u.next())s=la(s,(l=As(l.value,ws(t))).A()),i.push(["predicate",l])}if(r)switch(o=!0,e=Bo(e,"attributeTest anyElementTest piTest documentTest elementTest commentTest namespaceTest anyKindTest textTest anyFunctionTest typedFunctionTest schemaAttributeTest atomicType anyItemType parenthesizedItemType typedMapTest typedArrayTest nameTest Wildcard".split(" ")),e=xs(e),To(r)){case"ancestor":var p=new ua(e,{Oa:!1});break;case"ancestor-or-self":p=new ua(e,{Oa:!0});break;case"attribute":p=new pa(e,s);break;case"child":p=new ha(e,s);break;case"descendant":p=new da(e,{Oa:!1});break;case"descendant-or-self":p=new da(e,{Oa:!0});break;case"parent":p=new wa(e,s);break;case"following-sibling":p=new va(e,s);break;case"preceding-sibling":p=new xa(e,s);break;case"following":p=new ya(e);break;case"preceding":p=new Aa(e);break;case"self":p=new ba(e,s)}else p=As(p=Co(e,["filterExpr","*"]),ws(t));for(r=(i=c(i)).next();!r.done;r=i.next())switch(r=r.value,r[0]){case"lookup":p=new vi(p,r[1]);break;case"predicate":p=new mi(p,r[1])}return p.type=n,p}));return e=Bo(e,"rootExpr"),!(r=o||null!==e||1<r.length)&&1===a.length||!e&&1===a.length&&"sorted"===a[0].O?a[0]:e&&0===a.length?new hi(null):(a=new di(a,r),e?new hi(a):a)}(e,t);case"contextItemExpr":return new fi(Io(e,"type"));case"functionCallExpr":return function(e,t){var n=Bo(e,"functionName"),r=So(Bo(e,"arguments"),"*");return e=Io(e,"type"),new Ir(new Ga(Oo(n),r.length,e),r.map((function(e){return"argumentPlaceholder"===e[0]?null:As(e,t)})),e)}(e,t);case"inlineFunctionExpr":return function(e,t){var n=So(Bo(e,"paramList"),"*"),r=Co(e,["functionBody","*"]),o=Io(e,"type");return new Da(n.map((function(e){return{name:Oo(Bo(e,"varName")),type:Ro(e)}})),Ro(e),r?As(r,t):new ei([],o))}(e,t);case"arrowExpr":return function(e,t){var n=Io(e,"type"),r=Co(e,["argExpr","*"]);e=So(e,"*").slice(1),r=[As(r,t)];for(var o=0;o<e.length;o++)if("arguments"!==e[o][0]){if("arguments"===e[o+1][0]){var a=So(e[o+1],"*");r=r.concat(a.map((function(e){return"argumentPlaceholder"===e[0]?null:As(e,t)})))}r=[new Ir(a="EQName"===e[o][0]?new Ga(Oo(e[o]),r.length,n):As(e[o],ws(t)),r,n)]}return r[0]}(e,t);case"dynamicFunctionInvocationExpr":return function(e,t){var n=Co(e,["functionItem","*"]),r=Io(e,"type");e=Bo(e,"arguments");var o=[];return e&&(o=So(e,"*").map((function(e){return"argumentPlaceholder"===e[0]?null:As(e,t)}))),new Ir(As(n,t),o,r)}(e,t);case"namedFunctionRef":return t=Bo(e,"functionName"),n=Io(e,"type"),e=To(Co(e,["integerConstantExpr","value"])),new Ga(Oo(t),parseInt(e,10),n);case"integerConstantExpr":return new Ma(To(Bo(e,"value")),{type:5,g:3});case"stringConstantExpr":return new Ma(To(Bo(e,"value")),{type:1,g:3});case"decimalConstantExpr":return new Ma(To(Bo(e,"value")),{type:4,g:3});case"doubleConstantExpr":return new Ma(To(Bo(e,"value")),{type:3,g:3});case"varRef":return new Ti((e=Oo(Bo(e,"name"))).prefix,e.namespaceURI,e.localName);case"flworExpr":return function(e,t){var n=So(e,"*");if(e=Bo(n[n.length-1],"*"),1<(n=n.slice(0,-1)).length&&!t.aa)throw Error("XPST0003: Use of XQuery FLWOR expressions in XPath is no allowed");return n.reduceRight((function(e,n){switch(n[0]){case"forClause":for(var r=(n=So(n,"*")).length-1;0<=r;--r){var o=n[r],a=Co(o,["forExpr","*"]),i=Bo(o,"positionalVariableBinding");e=new Ra(Oo(Co(o,["typedVariableBinding","varName"])),As(a,ws(t)),i?Oo(i):null,e)}return e;case"letClause":for(r=(n=So(n,"*")).length-1;0<=r;--r)a=Co(o=n[r],["letExpr","*"]),e=new Ua(Oo(Co(o,["typedVariableBinding","varName"])),As(a,ws(t)),e);return e;case"whereClause":for(r=(n=So(n,"*")).length-1;0<=r;--r)e=new Ii(As(n[r],t),e);return e;case"windowClause":case"groupByClause":case"countClause":throw Error("Not implemented: "+n[0]+" is not implemented yet.");case"orderByClause":return function(e,t,n){return new pi((e=So(e,"*")).filter((function(e){return"stable"!==e[0]})).map((function(e){var n=Bo(e,"orderModifier"),r=n?Bo(n,"orderingKind"):null;return n=n?Bo(n,"emptyOrderingMode"):null,r=!r||"ascending"===To(r),n=!n||"empty least"===To(n),{da:As(Co(e,["orderByExpr","*"]),t),Gb:r,zc:n}})),n)}(n,t,e);default:throw Error("Not implemented: "+n[0]+" is not supported in a flwor expression")}}),As(e,t))}(e,t);case"quantifiedExpr":return function(e,t){var n=Io(e,"type"),r=To(Bo(e,"quantifier")),o=Co(e,["predicateExpr","*"]);return e=So(e,"quantifiedExprInClause").map((function(e){return{name:Oo(Co(e,["typedVariableBinding","varName"])),eb:As(e=Co(e,["sourceExpr","*"]),ws(t))}})),new Ai(r,e,As(o,ws(t)),n)}(e,t);case"ifThenElseExpr":return n=Io(e,"type"),new Ea(As(Bo(Bo(e,"ifClause"),"*"),ws(t)),As(Bo(Bo(e,"thenClause"),"*"),t),As(Bo(Bo(e,"elseClause"),"*"),t),n);case"instanceOfExpr":return n=As(Co(e,["argExpr","*"]),t),r=Co(e,["sequenceType","*"]),o=Co(e,["sequenceType","occurrenceIndicator"]),e=Io(e,"type"),new ai(n,As(r,ws(t)),o?To(o):"",e);case"castExpr":return t=As(Bo(Bo(e,"argExpr"),"*"),ws(t)),n=Bo(e,"singleType"),new ri(t,e=Oo(Bo(n,"atomicType")),n=null!==Bo(n,"optional"));case"castableExpr":return t=As(Bo(Bo(e,"argExpr"),"*"),ws(t)),n=Bo(e,"singleType"),new ni(t,e=Oo(Bo(n,"atomicType")),n=null!==Bo(n,"optional"));case"simpleMapExpr":return function(e,t){var n=Io(e,"type");return So(e,"*").reduce((function(e,r){return null===e?As(r,ws(t)):new ti(e,As(r,ws(t)),n)}),null)}(e,t);case"mapConstructor":return function(e,t){var n=Io(e,"type");return new ka(So(e,"mapConstructorEntry").map((function(e){return{key:As(Co(e,["mapKeyExpr","*"]),ws(t)),value:As(Co(e,["mapValueExpr","*"]),ws(t))}})),n)}(e,t);case"arrayConstructor":return function(e,t){var n=Io(e,"type"),r=So(e=Bo(e,"*"),"arrayElem").map((function(e){return As(Bo(e,"*"),ws(t))}));switch(e[0]){case"curlyArray":return new aa(r,n);case"squareArray":return new ia(r,n);default:throw Error("Unrecognized arrayType: "+e[0])}}(e,t);case"unaryLookup":return n=Io(e,"type"),new wi(Es(e,t),n);case"typeswitchExpr":return function(e,t){if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");var n=Io(e,"type"),r=As(Bo(Bo(e,"argExpr"),"*"),t),o=So(e,"typeswitchExprCaseClause").map((function(e){var n=0===So(e,"sequenceTypeUnion").length?[Bo(e,"sequenceType")]:So(Bo(e,"sequenceTypeUnion"),"sequenceType");return{xc:As(Co(e,["resultExpr","*"]),t),Lb:n.map((function(e){var n=Bo(e,"occurrenceIndicator");return{Cc:n?To(n):"",Kb:As(Bo(e,"*"),t)}}))}}));return e=As(Co(e,["typeswitchExprDefaultClause","resultExpr","*"]),t),new ms(r,o,e,n)}(e,t);case"elementConstructor":return function(e,t){if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");var n=Oo(Bo(e,"tagName")),r=Bo(e,"attributeList"),o=r?So(r,"attributeConstructor").map((function(e){return As(e,ws(t))})):[];return r=r?So(r,"namespaceDeclaration").map((function(e){var t=Bo(e,"prefix");return{prefix:t?To(t):"",uri:To(Bo(e,"uri"))}})):[],e=(e=Bo(e,"elementContent"))?So(e,"*").map((function(e){return As(e,ws(t))})):[],new ls(n,o,r,e)}(e,t);case"attributeConstructor":return function(e,t){if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");var n=Oo(Bo(e,"attributeName")),r=Bo(e,"attributeValue");return r=r?To(r):null,e=(e=Bo(e,"attributeValueExpr"))?So(e,"*").map((function(e){return As(e,ws(t))})):null,new us(n,{value:r,tb:e})}(e,t);case"computedAttributeConstructor":return(n=Bo(e,"tagName"))?n=Oo(n):(n=Bo(e,"tagNameExpr"),n={Ka:As(Bo(n,"*"),ws(t))}),new us(n,{tb:[e=As(Bo(Bo(e,"valueExpr"),"*"),ws(t))]});case"computedCommentConstructor":if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");return new cs(e=(e=Bo(e,"argExpr"))?As(Bo(e,"*"),ws(t)):null);case"computedTextConstructor":if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");return new ds(e=(e=Bo(e,"argExpr"))?As(Bo(e,"*"),ws(t)):null);case"computedElementConstructor":return function(e,t){var n=Bo(e,"tagName");return n?n=Oo(n):(n=Bo(e,"tagNameExpr"),n={Ka:As(Bo(n,"*"),ws(t))}),e=(e=Bo(e,"contentExpr"))?So(e,"*").map((function(e){return As(e,ws(t))})):[],new ls(n,[],[],e)}(e,t);case"computedPIConstructor":if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");return n=Bo(e,"piTargetExpr"),r=Bo(e,"piTarget"),o=Bo(e,"piValueExpr"),e=Io(e,"type"),new fs({Cb:n?As(Bo(n,"*"),ws(t)):null,Jb:r?To(r):null},o?As(Bo(o,"*"),ws(t)):new ei([],e));case"CDataSection":return new Ma(To(e),{type:1,g:3});case"deleteExpr":return new qi(e=As(Co(e,["targetExpr","*"]),t));case"insertExpr":switch(n=As(Co(e,["sourceExpr","*"]),t),(o=So(e,"*")[1])[0]){case"insertAfter":r=1;break;case"insertBefore":r=2;break;case"insertInto":r=(r=Bo(o,"*"))?"insertAsFirst"===r[0]?4:5:3}return new Ji(n,r,e=As(Co(e,["targetExpr","*"]),t));case"renameExpr":return new ns(n=As(Co(e,["targetExpr","*"]),t),e=As(Co(e,["newNameExpr","*"]),t));case"replaceExpr":return new rs(n=!!Bo(e,"replaceValue"),r=As(Co(e,["targetExpr","*"]),t),e=As(Co(e,["replacementExpr","*"]),t));case"transformExpr":return function(e,t){var n=So(Bo(e,"transformCopies"),"transformCopy").map((function(e){var n=Oo(Bo(Bo(e,"varRef"),"name"));return{eb:As(Bo(Bo(e,"copySource"),"*"),t),Nb:new ve(n.prefix,n.namespaceURI,n.localName)}})),r=As(Bo(Bo(e,"modifyExpr"),"*"),t);return e=As(Bo(Bo(e,"returnExpr"),"*"),t),new is(n,r,e)}(e,t);case"x:stackTrace":for(n=e[1],e=e[2];"x:stackTrace"===e[0];)e=e[2];return new Ia(n,e[0],As(e,t));default:return xs(e)}}function xs(e){switch(e[0]){case"nameTest":return new Ei(Oo(e));case"piTest":return(e=Bo(e,"piTarget"))?new Ni(To(e)):new bi(7);case"commentTest":return new bi(8);case"textTest":return new bi(3);case"documentTest":return new bi(9);case"attributeTest":var t=(e=Bo(e,"attributeName"))&&Bo(e,"star");return!e||t?new bi(2):new Ei(Oo(Bo(e,"QName")),{kind:2});case"elementTest":return t=(e=Bo(e,"elementName"))&&Bo(e,"star"),!e||t?new bi(1):new Ei(Oo(Bo(e,"QName")),{kind:1});case"anyKindTest":return new Bi({prefix:"",namespaceURI:null,localName:"node()"});case"anyMapTest":return new Bi({prefix:"",namespaceURI:null,localName:"map(*)"});case"anyArrayTest":return new Bi({prefix:"",namespaceURI:null,localName:"array(*)"});case"Wildcard":return Bo(e,"star")?(t=Bo(e,"uri"))?e=new Ei({localName:"*",namespaceURI:To(t),prefix:""}):(t=Bo(e,"NCName"),e="star"===Bo(e,"*")[0]?new Ei({localName:To(t),namespaceURI:null,prefix:"*"}):new Ei({localName:"*",namespaceURI:null,prefix:To(t)})):e=new Ei({localName:"*",namespaceURI:null,prefix:"*"}),e;case"atomicType":return new Bi(Oo(e));case"anyItemType":return new Bi({prefix:"",namespaceURI:null,localName:"item()"});default:throw Error("No selector counterpart for: "+e[0]+".")}}function bs(e,t,n){var r=[];return function t(o){var a=Bo(Bo(o,"firstOperand"),"*");o=Bo(Bo(o,"secondOperand"),"*"),a[0]===e?t(a):r.push(As(a,n)),o[0]===e?t(o):r.push(As(o,n))}(t),r}function Es(e,t){switch((e=Bo(e,"*"))[0]){case"NCName":return new Ma(To(e),{type:1,g:3});case"star":return"*";default:return As(e,ws(t))}}function Ns(e,t,n){var r=Co(t,["firstOperand","*"]),o=Co(t,["secondOperand","*"]);switch(r=As(r,ws(n)),n=As(o,ws(n)),e){case"valueCompare":return new Ya(t[0],r,n);case"nodeCompare":return new za(t[0],r,n);case"generalCompare":return new Ja(t[0],r,n)}}function Bs(e,t){return As(e,t)}var Ts=new Map;function Is(e,t,n,r,o,a){this.j=e,this.u=t,this.h=n,this.A=r,this.s=o,this.O=a}function Cs(e,t,n,r,o,a,i){var s=Ts.get(e);s||(s=Object.create(null),Ts.set(e,s)),(t=s[e=t+(a?"_DEBUG":"")])||(t=s[e]=[]),t.push(new Is(Object.values(n.h),Object.values(n.s),o,Object.keys(r).map((function(e){return{namespaceURI:r[e],prefix:e}})),i,n.j))}function Ss(e){var t=new Ee;if("http://www.w3.org/2005/XQueryX"!==e.namespaceURI&&"http://www.w3.org/2005/XQueryX"!==e.namespaceURI&&"http://fontoxml.com/fontoxpath"!==e.namespaceURI&&"http://www.w3.org/2007/xquery-update-10"!==e.namespaceURI)throw St("The XML structure passed as an XQueryX program was not valid XQueryX");var n=["stackTrace"===e.localName?"x:stackTrace":e.localName],r=t.getAllAttributes(e);for(r&&0<r.length&&n.push(Array.from(r).reduce((function(e,t){return e[t.localName]="type"===t.localName?ye(t.value):t.value,e}),{})),e=t.getChildNodes(e),t=(e=c(e)).next();!t.done;t=e.next())switch(t=t.value,t.nodeType){case 1:n.push(Ss(t));break;case 3:n.push(t.data)}return n}var Os=Object.create(null);function Rs(e,t){var n=Os[e];n||(n=Os[e]={Ma:[],Ua:[]}),n.Ma=n.Ma.concat(t.Ma),n.Ua=n.Ua.concat(t.Ua)}function Ds(e,t){var n=Os[t];if(!n)throw Error("XQST0051: No modules found with the namespace uri "+t);n.Ma.forEach((function(n){return Ao(e,t,n.localName,n.arity,n.Eb)})),n.Ua.forEach((function(n){bo(e,t,n.localName),Eo(e,t,n.localName,(function(e,t){return ur(n.da,e,t)}))}))}function Us(e){return e.replace(/(\x0D\x0A)|(\x0D(?!\x0A))/g,String.fromCharCode(10))}var Ms=t;function ks(e,t){return function(n,r){return t.has(r)?t.get(r):(n=e(n,r),t.set(r,n),n)}}function Gs(e,t){return Ms.delimited(t,e,t)}function Fs(e,t){return e.reverse().reduce((function(e,t){return Ms.preceded(t,e)}),t)}function Ps(e,t,n,r){return Ms.then(Ms.then(e,t,(function(e,t){return[e,t]})),n,(function(e,t){var n=c(e);return e=n.next().value,n=n.next().value,r(e,n,t)}))}function Hs(e,t,n,r,o){return Ms.then(Ms.then(Ms.then(e,t,(function(e,t){return[e,t]})),n,(function(e,t){var n=c(e);return[e=n.next().value,n=n.next().value,t]})),r,(function(e,t){var n=c(e);e=n.next().value;var r=n.next().value;return n=n.next().value,o(e,r,n,t)}))}function _s(e){return Ms.map(e,(function(e){return[e]}))}function js(e,t){return Ms.map(Ms.or(e),(function(){return t}))}function Xs(e){return function(t,n){return(t=e.exec(t.substring(n)))&&0===t.index?Ms.okWithValue(n+t[0].length,t[0]):Ms.error(n,[e.source],!1)}}var Ls=Ms.or([Ms.token(" "),Ms.token("\t"),Ms.token("\r"),Ms.token("\n")]),$s=Ms.token("(:"),qs=Ms.token(":)"),Ys=Ms.token("(#"),Vs=Ms.token("#)"),Qs=Ms.token("("),Js=Ms.token(")"),Ks=Ms.token("["),zs=Ms.token("]"),Ws=Ms.token("{"),Zs=Ms.token("}"),eu=Ms.token("{{"),tu=Ms.token("}}"),nu=Ms.token("'"),ru=Ms.token("''"),ou=Ms.token('"'),au=Ms.token('""'),iu=Ms.token("<![CDATA["),su=Ms.token("]]>"),uu=Ms.token("/>"),cu=Ms.token("</"),lu=Ms.token("\x3c!--"),pu=Ms.token("--\x3e"),hu=Ms.token("<?"),fu=Ms.token("?>"),du=Ms.token("&#x"),mu=Ms.token("&#"),gu=Ms.token(":*"),yu=Ms.token("*:"),vu=Ms.token(":="),wu=Ms.token("&"),Au=Ms.token(":"),xu=Ms.token(";"),bu=Ms.token("*"),Eu=Ms.token("@"),Nu=Ms.token("$"),Bu=Ms.token("#"),Tu=Ms.token("%"),Iu=Ms.token("?"),Cu=Ms.token("!"),Su=Ms.token("|"),Ou=Ms.token("||"),Ru=Ms.token("="),Du=Ms.token("!="),Uu=Ms.token("<"),Mu=Ms.token("<<"),ku=Ms.token("<="),Gu=Ms.token(">"),Fu=Ms.token(">>"),Pu=Ms.token(">="),Hu=Ms.token(","),_u=Ms.token("."),ju=Ms.token(".."),Xu=Ms.token("+"),Lu=Ms.token("-"),$u=Ms.token("/"),qu=Ms.token("//"),Yu=Ms.token("=>"),Vu=Ms.token("e"),Qu=Ms.token("E"),Ju=Ms.token("l"),Ku=Ms.token("L"),zu=Ms.token("m"),Wu=Ms.token("M"),Zu=Ms.token("Q"),ec=Ms.token("x"),tc=Ms.token("X"),nc=Ms.token("as"),rc=Ms.token("cast"),oc=Ms.token("castable"),ac=Ms.token("treat"),ic=Ms.token("instance"),sc=Ms.token("of"),uc=Ms.token("node"),cc=Ms.token("nodes"),lc=Ms.token("delete"),pc=Ms.token("value"),hc=Ms.token("function"),fc=Ms.token("map"),dc=Ms.token("element"),mc=Ms.token("attribute"),gc=Ms.token("schema-element"),yc=Ms.token("intersect"),vc=Ms.token("except"),wc=Ms.token("union"),Ac=Ms.token("to"),xc=Ms.token("is"),bc=Ms.token("or"),Ec=Ms.token("and"),Nc=Ms.token("div"),Bc=Ms.token("idiv"),Tc=Ms.token("mod"),Ic=Ms.token("eq"),Cc=Ms.token("ne"),Sc=Ms.token("lt"),Oc=Ms.token("le"),Rc=Ms.token("gt"),Dc=Ms.token("ge"),Uc=Ms.token("amp"),Mc=Ms.token("quot"),kc=Ms.token("apos"),Gc=Ms.token("if"),Fc=Ms.token("then"),Pc=Ms.token("else"),Hc=Ms.token("allowing"),_c=Ms.token("empty"),jc=Ms.token("at"),Xc=Ms.token("in"),Lc=Ms.token("for"),$c=Ms.token("let"),qc=Ms.token("where"),Yc=Ms.token("collation"),Vc=Ms.token("group"),Qc=Ms.token("by"),Jc=Ms.token("order"),Kc=Ms.token("stable"),zc=Ms.token("return"),Wc=Ms.token("array"),Zc=Ms.token("document"),el=Ms.token("namespace"),tl=Ms.token("text"),nl=Ms.token("comment"),rl=Ms.token("processing-instruction"),ol=Ms.token("lax"),al=Ms.token("strict"),il=Ms.token("validate"),sl=Ms.token("type"),ul=Ms.token("declare"),cl=Ms.token("default"),ll=Ms.token("boundary-space"),pl=Ms.token("strip"),hl=Ms.token("preserve"),fl=Ms.token("no-preserve"),dl=Ms.token("inherit"),ml=Ms.token("no-inherit"),gl=Ms.token("greatest"),yl=Ms.token("least"),vl=Ms.token("copy-namespaces"),wl=Ms.token("decimal-format"),Al=Ms.token("case"),xl=Ms.token("typeswitch"),bl=Ms.token("some"),El=Ms.token("every"),Nl=Ms.token("satisfies"),Bl=Ms.token("replace"),Tl=Ms.token("with"),Il=Ms.token("copy"),Cl=Ms.token("modify"),Sl=Ms.token("first"),Ol=Ms.token("last"),Rl=Ms.token("before"),Dl=Ms.token("after"),Ul=Ms.token("into"),Ml=Ms.token("insert"),kl=Ms.token("rename"),Gl=Ms.token("switch"),Fl=Ms.token("variable"),Pl=Ms.token("external"),Hl=Ms.token("updating"),_l=Ms.token("import"),jl=Ms.token("schema"),Xl=Ms.token("module"),Ll=Ms.token("base-uri"),$l=Ms.token("construction"),ql=Ms.token("ordering"),Yl=Ms.token("ordered"),Vl=Ms.token("unordered"),Ql=Ms.token("option"),Jl=Ms.token("context"),Kl=Ms.token("item"),zl=Ms.token("xquery"),Wl=Ms.token("version"),Zl=Ms.token("encoding"),ep=Ms.token("document-node"),tp=Ms.token("namespace-node"),np=Ms.token("schema-attribute"),rp=Ms.token("ascending"),op=Ms.token("descending"),ap=Ms.token("empty-sequence"),ip=Ms.token("child::"),sp=Ms.token("descendant::"),up=Ms.token("attribute::"),cp=Ms.token("self::"),lp=Ms.token("descendant-or-self::"),pp=Ms.token("following-sibling::"),hp=Ms.token("following::"),fp=Ms.token("parent::"),dp=Ms.token("ancestor::"),mp=Ms.token("preceding-sibling::"),gp=Ms.token("preceding::"),yp=Ms.token("ancestor-or-self::"),vp=Ms.token("decimal-separator"),wp=Ms.token("grouping-separator"),Ap=Ms.token("infinity"),xp=Ms.token("minus-sign"),bp=Ms.token("NaN"),Ep=Ms.token("per-mille"),Np=Ms.token("zero-digit"),Bp=Ms.token("digit"),Tp=Ms.token("pattern-separator"),Ip=Ms.token("exponent-separator"),Cp=Ms.token("schema-attribute("),Sp=Ms.token("document-node("),Op=Ms.token("processing-instruction("),Rp=Ms.token("processing-instruction()"),Dp=Ms.token("comment()"),Up=Ms.token("text()"),Mp=Ms.token("namespace-node()"),kp=Ms.token("node()"),Gp=Ms.token("item()"),Fp=Ms.token("empty-sequence()"),Pp=new Map,Hp=new Map,_p=Ms.or([Xs(/[\t\n\r -\uD7FF\uE000\uFFFD]/),Xs(/[\uD800-\uDBFF][\uDC00-\uDFFF]/)]),jp=Ms.preceded(Ms.peek(Ms.not(Ms.or([$s,qs]),['comment contents cannot contain "(:" or ":)"'])),_p),Xp=Ms.map(Ms.delimited($s,Ms.star(Ms.or([jp,function(e,t){return Xp(e,t)}])),qs),(function(e){return e.join("")})),Lp=Ms.or([Ls,Xp]),$p=Ms.map(Ms.plus(Ls),(function(e){return e.join("")})),qp=ks(Ms.map(Ms.star(Lp),(function(e){return e.join("")})),Pp),Yp=ks(Ms.map(Ms.plus(Lp),(function(e){return e.join("")})),Hp),Vp=Ms.or([Xs(/[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]/),Ms.then(Xs(/[\uD800-\uDB7F]/),Xs(/[\uDC00-\uDFFF]/),(function(e,t){return e+t}))]),Qp=Ms.or([Vp,Xs(/[\-\.0-9\xB7\u0300-\u036F\u203F\u2040]/)]),Jp=Ms.then(Vp,Ms.star(Qp),(function(e,t){return e+t.join("")})),Kp=Ms.map(Jp,(function(e){return["prefix",e]})),zp=Ms.or([Vp,Au]),Wp=Ms.or([Qp,Au]),Zp=Ms.then(zp,Ms.star(Wp),(function(e,t){return e+t.join("")})),eh=Ms.map(Jp,(function(e){var t={};return[(t.prefix="",t.URI=null,t),e]})),th=Ms.then(Jp,Ms.preceded(Au,Jp),(function(e,t){var n={};return[(n.prefix=e,n.URI=null,n),t]})),nh=Ms.or([th,eh]),rh=Ms.followed(Fs([Zu,qp,Ws],Ms.map(Ms.star(Xs(/[^{}]/)),(function(e){return e.join("").replace(/\s+/g," ").trim()}))),Zs),oh=Ms.then(rh,Jp,(function(e,t){return[e,t]})),ah=Ms.or([Ms.map(oh,(function(e){var t={};return[(t.prefix=null,t.URI=e[0],t),e[1]]})),nh]),ih=Ms.or([Ms.map(ah,(function(e){return["QName"].concat(p(e))})),Ms.map(bu,(function(){return["star"]}))]),sh=Ms.map(Ms.preceded(Nu,ah),(function(e){return["varRef",["name"].concat(p(e))]})),uh=Ms.peek(Ms.or([Qs,ou,nu,Lp])),ch=Ms.map(Ms.or([ip,sp,up,cp,lp,pp,hp]),(function(e){return e.substring(0,e.length-2)})),lh=Ms.map(Ms.or([fp,dp,mp,gp,yp]),(function(e){return e.substring(0,e.length-2)})),ph=Ps(wu,Ms.or([Sc,Rc,Uc,Mc,kc]),xu,(function(e,t,n){return e+t+n})),hh=Ms.or([Ps(du,Xs(/[0-9a-fA-F]+/),xu,(function(e,t,n){return e+t+n})),Ps(mu,Xs(/[0-9]+/),xu,(function(e,t,n){return e+t+n}))]),fh=js([au],'"'),dh=js([ru],"'"),mh=_s(js([Dp],"commentTest")),gh=_s(js([Up],"textTest")),yh=_s(js([Mp],"namespaceTest")),vh=_s(js([kp],"anyKindTest")),wh=Xs(/[0-9]+/),Ah=Ms.then(Ms.or([Ms.then(_u,wh,(function(e,t){return e+t})),Ms.then(wh,Ms.optional(Ms.preceded(_u,Xs(/[0-9]*/))),(function(e,t){return e+(null!==t?"."+t:"")}))]),Ps(Ms.or([Vu,Qu]),Ms.optional(Ms.or([Xu,Lu])),wh,(function(e,t,n){return e+(t||"")+n})),(function(e,t){return["doubleConstantExpr",["value",e+t]]})),xh=Ms.or([Ms.map(Ms.preceded(_u,wh),(function(e){return["decimalConstantExpr",["value","."+e]]})),Ms.then(Ms.followed(wh,_u),Ms.optional(wh),(function(e,t){return["decimalConstantExpr",["value",e+"."+(null!==t?t:"")]]}))]),bh=Ms.map(wh,(function(e){return["integerConstantExpr",["value",e]]})),Eh=Ms.followed(Ms.or([Ah,xh,bh]),Ms.peek(Ms.not(Xs(/[a-zA-Z]/),["no alphabetical characters after numeric literal"]))),Nh=Ms.map(Ms.followed(_u,Ms.peek(Ms.not(_u,["context item should not be followed by another ."]))),(function(){return["contextItemExpr"]})),Bh=Ms.or([Wc,mc,nl,ep,dc,ap,hc,Gc,Kl,fc,tp,uc,rl,np,gc,Gl,tl,xl]),Th=_s(js([Iu],"argumentPlaceholder")),Ih=Ms.or([Iu,bu,Xu]),Ch=Ms.preceded(Ms.peek(Ms.not(Xs(/[{}<&]/),["elementContentChar cannot be {, }, <, or &"])),_p),Sh=Ms.map(Ms.delimited(iu,Ms.star(Ms.preceded(Ms.peek(Ms.not(su,['CDataSection content may not contain "]]>"'])),_p)),su),(function(e){return["CDataSection",e.join("")]})),Oh=Ms.preceded(Ms.peek(Ms.not(Xs(/["{}<&]/),['quotAttrValueContentChar cannot be ", {, }, <, or &'])),_p),Rh=Ms.preceded(Ms.peek(Ms.not(Xs(/['{}<&]/),["aposAttrValueContentChar cannot be ', {, }, <, or &"])),_p),Dh=Ms.map(Ms.star(Ms.or([Ms.preceded(Ms.peek(Ms.not(Lu,[])),_p),Ms.map(Fs([Lu,Ms.peek(Ms.not(Lu,[]))],_p),(function(e){return"-"+e}))])),(function(e){return e.join("")})),Uh=Ms.map(Ms.delimited(lu,Dh,pu),(function(e){return["computedCommentConstructor",["argExpr",["stringConstantExpr",["value",e]]]]})),Mh=Ms.preceded(Ms.peek(Ms.not(Ps(Ms.or([tc,ec]),Ms.or([Wu,zu]),Ms.or([Ku,Ju]),(function(){return[]})),[])),Zp),kh=Ms.map(Ms.star(Ms.preceded(Ms.peek(Ms.not(fu,[])),_p)),(function(e){return e.join("")})),Gh=Ms.then(Ms.preceded(hu,Mh),Ms.followed(Ms.optional(Ms.preceded($p,kh)),fu),(function(e,t){return["computedPIConstructor",["piTarget",e],["piValueExpr",["stringConstantExpr",["value",t]]]]})),Fh=Ms.map(qu,(function(){return["stepExpr",["xpathAxis","descendant-or-self"],["anyKindTest"]]})),Ph=Ms.or([ol,al]),Hh=Ms.map(Ms.star(Ms.followed(_p,Ms.peek(Ms.not(Vs,["Pragma contents should not contain '#)'"])))),(function(e){return e.join("")})),_h=Ms.map(Ms.followed(Ms.or([Ic,Cc,Sc,Oc,Rc,Dc]),uh),(function(e){return e+"Op"})),jh=Ms.or([Ms.followed(js([xc],"isOp"),uh),js([Mu],"nodeBeforeOp"),js([Fu],"nodeAfterOp")]),Xh=Ms.or([js([Ru],"equalOp"),js([Du],"notEqualOp"),js([ku],"lessThanOrEqualOp"),js([Uu],"lessThanOp"),js([Pu],"greaterThanOrEqualOp"),js([Gu],"greaterThanOp")]),Lh=Ms.map(Hl,(function(){return["annotation",["annotationName","updating"]]})),$h=Ms.or([hl,fl]),qh=Ms.or([dl,ml]),Yh=Ms.or([vp,wp,Ap,xp,bp,Tu,Ep,Np,Bp,Tp,Ip]),Vh=Ms.map(Fs([ul,Yp,ll,Yp],Ms.or([hl,pl])),(function(e){return["boundarySpaceDecl",e]})),Qh=Ms.map(Fs([ul,Yp,$l,Yp],Ms.or([hl,pl])),(function(e){return["constructionDecl",e]})),Jh=Ms.map(Fs([ul,Yp,ql,Yp],Ms.or([Yl,Vl])),(function(e){return["orderingModeDecl",e]})),Kh=Ms.map(Fs([ul,Yp,cl,Yp,Jc,Yp,_c,Yp],Ms.or([gl,yl])),(function(e){return["emptyOrderDecl",e]})),zh=Ms.then(Fs([ul,Yp,vl,Yp],$h),Fs([qp,Hu,qp],qh),(function(e,t){return["copyNamespacesDecl",["preserveMode",e],["inheritMode",t]]}));function Wh(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 Zh(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 ef(e){return e.replace(/(&[^;]+);/g,(function(e){if(/^&#x/.test(e))return Zh(e=parseInt(e.slice(3,-1),16)),String.fromCodePoint(e);if(/^&#/.test(e))return Zh(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 tf(e,t,n){if(!e.length)return[];for(var r=[e[0]],o=1;o<e.length;++o){var a=r[r.length-1];"string"==typeof a&&"string"==typeof e[o]?r[r.length-1]=a+e[o]:r.push(e[o])}if("string"==typeof r[0]&&0===r.length)return[];if(r=r.reduce((function(e,t,o){if("string"!=typeof t)e.push(t);else if(n&&/^\s*$/.test(t)){var a=r[o+1];(a&&"CDataSection"===a[0]||(o=r[o-1])&&"CDataSection"===o[0])&&e.push(ef(t))}else e.push(ef(t));return e}),[]),!r.length)return r;if(1<r.length||t)for(e=0;e<r.length;e++)"string"==typeof r[e]&&(r[e]=["stringConstantExpr",["value",r[e]]]);return r}function nf(e){return e[0].prefix?e[0].prefix+":"+e[1]:e[1]}var rf=Ms.then(ah,Ms.optional(Iu),(function(e,t){return null!==t?["singleType",["atomicType"].concat(p(e)),["optional"]]:["singleType",["atomicType"].concat(p(e))]})),of=Ms.map(ah,(function(e){return["atomicType"].concat(p(e))})),af=new Map;function sf(e){function t(e,t){return t.reduce((function(e,t){return[t[0],["firstOperand",e],["secondOperand",t[1]]]}),e)}function n(e,t,n){return Ms.then(e,Ms.star(Ms.then(Gs(t,qp),e,(function(e,t){return[e,t]}))),n)}function r(e,t,n,r){return n=void 0===n?"firstOperand":n,r=void 0===r?"secondOperand":r,Ms.then(e,Ms.optional(Ms.then(Gs(t,qp),e,(function(e,t){return[e,t]}))),(function(e,t){return null===t?e:[t[0],[n,e],[r,t[1]]]}))}function o(t){return e.sb?function(e,n){if(!(e=t(e,n)).success)return e;var r=l.has(n)?l.get(n):{offset:n,line:-1,la:-1},o=l.has(e.offset)?l.get(e.offset):{offset:e.offset,line:-1,la:-1};return l.set(n,r),l.set(e.offset,o),Ms.okWithValue(e.offset,["x:stackTrace",{start:r,end:o},e.value])}:t}function a(e,t){return z(e,t)}function i(e,t){return He(e,t)}function s(e,t){return o(Ms.or([It,Ut,Xt,Ot,st,Ht,Mt,_t,kt,Ft,it]))(e,t)}function u(e,t){return n(s,Hu,(function(e,t){return 0===t.length?e:["sequenceExpr",e].concat(p(t.map((function(e){return e[1]}))))}))(e,t)}var l=new Map,h=Ms.preceded(Ks,Ms.followed(Gs(u,qp),zs)),f=Ms.map(e.Va?Ms.or([Gs(Ms.star(Ms.or([ph,hh,fh,Xs(/[^"&]/)])),ou),Gs(Ms.star(Ms.or([ph,hh,dh,Xs(/[^'&]/)])),nu)]):Ms.or([Gs(Ms.star(Ms.or([fh,Xs(/[^"]/)])),ou),Gs(Ms.star(Ms.or([dh,Xs(/[^']/)])),nu)]),(function(e){return e.join("")})),d=Ms.or([Ms.map(Fs([dc,qp],Ms.delimited(Ms.followed(Qs,qp),Ms.then(ih,Fs([qp,Hu,qp],ah),(function(e,t){return[["elementName",e],["typeName"].concat(p(t))]})),Ms.preceded(qp,Js))),(function(e){var t=c(e);return["elementTest",e=t.next().value,t=t.next().value]})),Ms.map(Fs([dc,qp],Ms.delimited(Qs,ih,Js)),(function(e){return["elementTest",["elementName",e]]})),Ms.map(Fs([dc,qp],Ms.delimited(Qs,qp,Js)),(function(){return["elementTest"]}))]),m=Ms.or([Ms.map(ah,(function(e){return["QName"].concat(p(e))})),Ms.map(bu,(function(){return["star"]}))]),g=Ms.or([Ms.map(Fs([mc,qp],Ms.delimited(Ms.followed(Qs,qp),Ms.then(m,Fs([qp,Hu,qp],ah),(function(e,t){return[["attributeName",e],["typeName"].concat(p(t))]})),Ms.preceded(qp,Js))),(function(e){var t=c(e);return["attributeTest",e=t.next().value,t=t.next().value]})),Ms.map(Fs([mc,qp],Ms.delimited(Qs,m,Js)),(function(e){return["attributeTest",["attributeName",e]]})),Ms.map(Fs([mc,qp],Ms.delimited(Qs,qp,Js)),(function(){return["attributeTest"]}))]),y=Ms.map(Fs([gc,qp,Qs],Ms.followed(ah,Js)),(function(e){return["schemaElementTest"].concat(p(e))})),v=Ms.map(Ms.delimited(Cp,Gs(ah,qp),Js),(function(e){return["schemaAttributeTest"].concat(p(e))})),w=Ms.map(Ms.preceded(Sp,Ms.followed(Gs(Ms.optional(Ms.or([d,y])),qp),Js)),(function(e){return["documentTest"].concat(p(e?[e]:[]))})),A=Ms.or([Ms.map(Ms.preceded(Op,Ms.followed(Gs(Ms.or([Jp,f]),qp),Js)),(function(e){return["piTest",["piTarget",e]]})),_s(js([Rp],"piTest"))]),x=Ms.or([w,d,g,y,v,A,mh,gh,yh,vh]),b=Ms.or([Ms.map(Ms.preceded(yu,Jp),(function(e){return["Wildcard",["star"],["NCName",e]]})),_s(js([bu],"Wildcard")),Ms.map(Ms.followed(rh,bu),(function(e){return["Wildcard",["uri",e],["star"]]})),Ms.map(Ms.followed(Jp,gu),(function(e){return["Wildcard",["NCName",e],["star"]]}))]),E=Ms.or([b,Ms.map(ah,(function(e){return["nameTest"].concat(p(e))}))]),N=Ms.or([x,E]),B=Ms.then(Ms.optional(Eu),N,(function(e,t){return null!==e||"attributeTest"===t[0]||"schemaAttributeTest"===t[0]?["stepExpr",["xpathAxis","attribute"],t]:["stepExpr",["xpathAxis","child"],t]})),T=Ms.or([Ms.then(ch,N,(function(e,t){return["stepExpr",["xpathAxis",e],t]})),B]),I=Ms.map(ju,(function(){return["stepExpr",["xpathAxis","parent"],["anyKindTest"]]})),C=Ms.or([Ms.then(lh,N,(function(e,t){return["stepExpr",["xpathAxis",e],t]})),I]),S=Ms.map(Ms.star(Ms.preceded(qp,h)),(function(e){return 0<e.length?["predicates"].concat(p(e)):void 0})),O=Ms.then(Ms.or([C,T]),S,(function(e,t){return void 0===t?e:e.concat([t])})),R=Ms.or([Eh,Ms.map(f,(function(t){return["stringConstantExpr",["value",e.Va?ef(t):t]]}))]),D=Ms.or([Ms.delimited(Qs,Gs(u,qp),Js),Ms.map(Ms.delimited(Qs,qp,Js),(function(){return["sequenceExpr"]}))]),U=Ms.or([s,Th]),M=Ms.map(Ms.delimited(Qs,Gs(Ms.optional(Ms.then(U,Ms.star(Ms.preceded(Gs(Hu,qp),U)),(function(e,t){return[e].concat(p(t))}))),qp),Js),(function(e){return null!==e?e:[]})),k=Ms.preceded(Ms.not(Ps(Bh,qp,Qs,(function(){})),["cannot use reseved keyword for function names"]),Ms.then(ah,Ms.preceded(qp,M),(function(e,t){return["functionCallExpr",["functionName"].concat(p(e)),null!==t?["arguments"].concat(p(t)):["arguments"]]}))),G=Ms.then(ah,Ms.preceded(Bu,bh),(function(e,t){return["namedFunctionRef",["functionName"].concat(p(e)),t]})),F=Ms.delimited(Ws,Gs(Ms.optional(u),qp),Zs),P=Ms.map(F,(function(e){return e||["sequenceExpr"]})),H=Ms.or([Ms.map(Fp,(function(){return[["voidSequenceType"]]})),Ms.then(a,Ms.optional(Ms.preceded(qp,Ih)),(function(e,t){return[e].concat(p(null!==t?[["occurrenceIndicator",t]]:[]))}))]),_=Ms.then(Fs([Tu,qp],ah),Ms.optional(Ms.followed(Ms.then(Fs([Qs,qp],R),Ms.star(Fs([Hu,qp],R)),(function(e,t){return e.concat(t)})),Js)),(function(e,t){return["annotation",["annotationName"].concat(p(e))].concat(p(t?["arguments",t]:[]))})),j=Ms.map(Fs([hc,qp,Qs,qp,bu,qp],Js),(function(){return["anyFunctionTest"]})),X=Ms.then(Fs([hc,qp,Qs,qp],Ms.optional(n(H,Hu,(function(e,t){return e.concat.apply(e,t.map((function(e){return e[1]})))})))),Fs([qp,Js,Yp,nc,Yp],H),(function(e,t){return["typedFunctionTest",["paramTypeList",["sequenceType"].concat(p(e||[]))],["sequenceType"].concat(p(t))]})),L=Ms.then(Ms.star(_),Ms.or([j,X]),(function(e,t){return[t[0]].concat(p(e),p(t.slice(1)))})),$=Ms.map(Fs([fc,qp,Qs,qp,bu,qp],Js),(function(){return["anyMapTest"]})),q=Ms.then(Fs([fc,qp,Qs,qp],of),Fs([qp,Hu],Ms.followed(Gs(H,qp),Js)),(function(e,t){return["typedMapTest",e,["sequenceType"].concat(p(t))]})),Y=Ms.or([$,q]),V=Ms.map(Fs([Wc,qp,Qs,qp,bu,qp],Js),(function(){return["anyArrayTest"]})),Q=Ms.map(Fs([Wc,qp,Qs],Ms.followed(Gs(H,qp),Js)),(function(e){return["typedArrayTest",["sequenceType"].concat(p(e))]})),J=Ms.or([V,Q]),K=Ms.map(Ms.delimited(Qs,Gs(a,qp),Js),(function(e){return["parenthesizedItemType",e]})),z=Ms.or([x,_s(js([Gp],"anyItemType")),L,Y,J,of,K]),W=Ms.map(Fs([nc,Yp],H),(function(e){return["typeDeclaration"].concat(p(e))})),Z=Ms.then(Ms.preceded(Nu,ah),Ms.optional(Ms.preceded(Yp,W)),(function(e,t){return["param",["varName"].concat(p(e))].concat(p(t?[t]:[]))})),ee=n(Z,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))})),te=Hs(Ms.star(_),Fs([qp,hc,qp,Qs,qp],Ms.optional(ee)),Fs([qp,Js,qp],Ms.optional(Ms.map(Fs([nc,qp],Ms.followed(H,qp)),(function(e){return["typeDeclaration"].concat(p(e))})))),P,(function(e,t,n,r){return["inlineFunctionExpr"].concat(p(e),[["paramList"].concat(p(t||[]))],p(n?[n]:[]),[["functionBody",r]])})),ne=Ms.or([G,te]),re=Ms.map(s,(function(e){return["mapKeyExpr",e]})),oe=Ms.map(s,(function(e){return["mapValueExpr",e]})),ae=Ms.then(re,Ms.preceded(Gs(Au,qp),oe),(function(e,t){return["mapConstructorEntry",e,t]})),ie=Ms.preceded(fc,Ms.delimited(Gs(Ws,qp),Ms.map(Ms.optional(n(ae,Gs(Hu,qp),(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))}))),(function(e){return e?["mapConstructor"].concat(p(e)):["mapConstructor"]})),Ms.preceded(qp,Zs))),se=Ms.map(Ms.delimited(Ks,Gs(Ms.optional(n(s,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]})))).map((function(e){return["arrayElem",e]}))}))),qp),zs),(function(e){return["squareArray"].concat(p(null!==e?e:[]))})),ue=Ms.map(Ms.preceded(Wc,Ms.preceded(qp,F)),(function(e){return["curlyArray"].concat(p(null!==e?[["arrayElem",e]]:[]))})),ce=Ms.map(Ms.or([se,ue]),(function(e){return["arrayConstructor",e]})),le=Ms.or([Jp,bh,D,bu]),pe=Ms.map(Ms.preceded(Iu,Ms.preceded(qp,le)),(function(e){return"*"===e?["unaryLookup",["star"]]:"string"==typeof e?["unaryLookup",["NCName",e]]:["unaryLookup",e]})),he=Ms.or([ph,hh,js([eu],"{"),js([tu],"}"),Ms.map(F,(function(e){return e||["sequenceExpr"]}))]),fe=Ms.or([Sh,function(e,t){return Ae(e,t)},he,Ch]),de=Ms.or([Ms.map(Oh,(function(e){return e.replace(/[\x20\x0D\x0A\x09]/g," ")})),he]),me=Ms.or([Ms.map(Rh,(function(e){return e.replace(/[\x20\x0D\x0A\x09]/g," ")})),he]),ge=Ms.map(Ms.or([Gs(Ms.star(Ms.or([fh,de])),ou),Gs(Ms.star(Ms.or([dh,me])),nu)]),(function(e){return tf(e,!1,!1)})),ye=Ms.then(nh,Ms.preceded(Gs(Ru,Ms.optional($p)),ge),(function(e,t){if(""===e[0].prefix&&"xmlns"===e[1]){if(t.length&&"string"!=typeof t[0])throw Error("XQST0022: A namespace declaration may not contain enclosed expressions");return["namespaceDeclaration",t.length?["uri",t[0]]:["uri"]]}if("xmlns"===e[0].prefix){if(t.length&&"string"!=typeof t[0])throw Error("XQST0022: The namespace declaration for 'xmlns:"+e[1]+"' may not contain enclosed expressions");return["namespaceDeclaration",["prefix",e[1]],t.length?["uri",t[0]]:["uri"]]}return["attributeConstructor",["attributeName"].concat(e),0===t.length?["attributeValue"]:1===t.length&&"string"==typeof t[0]?["attributeValue",t[0]]:["attributeValueExpr"].concat(t)]})),ve=Ms.map(Ms.star(Ms.preceded($p,Ms.optional(ye))),(function(e){return e.filter(Boolean)})),we=Ps(Ms.preceded(Uu,nh),ve,Ms.or([Ms.map(uu,(function(){return null})),Ms.then(Ms.preceded(Gu,Ms.star(fe)),Fs([qp,cu],Ms.followed(nh,Ms.then(Ms.optional($p),Gu,(function(){return null})))),(function(e,t){return[tf(e,!0,!0),t]}))]),(function(e,t,n){var r=n;if(n&&n.length){r=nf(e);var o=nf(n[1]);if(r!==o)throw Error('XQST0118: The start and the end tag of an element constructor must be equal. "'+r+'" does not match "'+o+'"');r=n[0]}return["elementConstructor",["tagName"].concat(p(e))].concat(p(t.length?[["attributeList"].concat(p(t))]:[]),p(r&&r.length?[["elementContent"].concat(p(r))]:[]))})),Ae=Ms.or([we,Uh,Gh]),xe=Ms.map(Fs([Zc,qp],F),(function(e){return["computedDocumentConstructor"].concat(p(e?[["argExpr",e]]:[]))})),be=Ms.map(F,(function(e){return e?[["contentExpr",e]]:[]})),Ee=Ms.then(Fs([dc,qp],Ms.or([Ms.map(ah,(function(e){return["tagName"].concat(p(e))})),Ms.map(Ms.delimited(Ws,Gs(u,qp),Zs),(function(e){return["tagNameExpr",e]}))])),Ms.preceded(qp,be),(function(e,t){return["computedElementConstructor",e].concat(p(t))})),Ne=Ms.then(Ms.preceded(mc,Ms.or([Ms.map(Fs([uh,qp],ah),(function(e){return["tagName"].concat(p(e))})),Ms.map(Ms.preceded(qp,Ms.delimited(Ws,Gs(u,qp),Zs)),(function(e){return["tagNameExpr",e]}))])),Ms.preceded(qp,F),(function(e,t){return["computedAttributeConstructor",e,["valueExpr",t||["sequenceExpr"]]]})),Be=Ms.map(F,(function(e){return e?[["prefixExpr",e]]:[]})),Te=Ms.map(F,(function(e){return e?[["URIExpr",e]]:[]})),Ie=Ms.then(Fs([el,qp],Ms.or([Kp,Be])),Ms.preceded(qp,Te),(function(e,t){return["computedNamespaceConstructor"].concat(p(e),p(t))})),Ce=Ms.map(Fs([tl,qp],F),(function(e){return["computedTextConstructor"].concat(p(e?[["argExpr",e]]:[]))})),Se=Ms.map(Fs([nl,qp],F),(function(e){return["computedCommentConstructor"].concat(p(e?[["argExpr",e]]:[]))})),Oe=Fs([rl,qp],Ms.then(Ms.or([Ms.map(Jp,(function(e){return["piTarget",e]})),Ms.map(Ms.delimited(Ws,Gs(u,qp),Zs),(function(e){return["piTargetExpr",e]}))]),Ms.preceded(qp,F),(function(e,t){return["computedPIConstructor",e].concat(p(t?[["piValueExpr",t]]:[]))}))),Re=Ms.or([xe,Ee,Ne,Ie,Ce,Se,Oe]),De=Ms.or([Ae,Re]),Ue=Ms.or([R,sh,D,Nh,k,De,ne,ie,ce,pe]),Me=Ms.map(Fs([Iu,qp],le),(function(e){return"*"===e?["lookup",["star"]]:"string"==typeof e?["lookup",["NCName",e]]:["lookup",e]})),ke=Ms.then(Ms.map(Ue,(function(e){return Wh(e)})),Ms.star(Ms.or([Ms.map(Ms.preceded(qp,h),(function(e){return["predicate",e]})),Ms.map(Ms.preceded(qp,M),(function(e){return["argumentList",e]})),Ms.preceded(qp,Me)])),(function(e,t){function n(){s&&1===a.length?i.push(["predicate",a[0]]):0!==a.length&&i.push(["predicates"].concat(p(a))),a.length=0}function r(e){n(),0!==i.length?("sequenceExpr"===o[0]&&2<o.length&&(o=["sequenceExpr",o]),o=[["filterExpr",o]].concat(p(i)),i.length=0):o=e?[["filterExpr",o]]:[o]}var o=e,a=[],i=[],s=!1;for(t=(e=c(t)).next();!t.done;t=e.next())switch(t=t.value,t[0]){case"predicate":a.push(t[1]);break;case"lookup":s=!0,n(),i.push(t);break;case"argumentList":r(!1),1<o.length&&(o=[["sequenceExpr",["pathExpr",["stepExpr"].concat(p(o))]]]),o=["dynamicFunctionInvocationExpr",["functionItem"].concat(p(o))].concat(p(t[1].length?[["arguments"].concat(p(t[1]))]:[]));break;default:throw Error("unreachable")}return r(!0),o})),Ge=Ms.or([Ms.map(ke,(function(e){return["stepExpr"].concat(p(e))})),O]),Fe=Ms.followed(Ue,Ms.peek(Ms.not(Ms.preceded(qp,Ms.or([h,M,Me])),["primary expression not followed by predicate, argumentList, or lookup"]))),Pe=Ms.or([Ps(Ge,Ms.preceded(qp,Fh),Ms.preceded(qp,i),(function(e,t,n){return["pathExpr",e,t].concat(p(n))})),Ms.then(Ge,Ms.preceded(Gs($u,qp),i),(function(e,t){return["pathExpr",e].concat(p(t))})),Fe,Ms.map(Ge,(function(e){return["pathExpr",e]}))]),He=Ms.or([Ps(Ge,Ms.preceded(qp,Fh),Ms.preceded(qp,i),(function(e,t,n){return[e,t].concat(p(n))})),Ms.then(Ge,Ms.preceded(Gs($u,qp),i),(function(e,t){return[e].concat(p(t))})),Ms.map(Ge,(function(e){return[e]}))]),_e=Ms.or([Ms.map(Fs([$u,qp],He),(function(e){return["pathExpr",["rootExpr"]].concat(p(e))})),Ms.then(Fh,Ms.preceded(qp,He),(function(e,t){return["pathExpr",["rootExpr"],e].concat(p(t))})),Ms.map(Ms.followed($u,Ms.not(Ms.preceded(qp,e.Va?Xs(/[*<a-zA-Z]/):Xs(/[*a-zA-Z]/)),["Single rootExpr cannot be by followed by something that can be interpreted as a relative path"])),(function(){return["pathExpr",["rootExpr"]]}))]),je=ks(Ms.or([Pe,_e]),af),Xe=Ms.preceded(il,Ms.then(Ms.optional(Ms.or([Ms.map(Ms.preceded(qp,Ph),(function(e){return["validationMode",e]})),Ms.map(Fs([qp,sl,qp],ah),(function(e){return["type"].concat(p(e))}))])),Ms.delimited(Ms.preceded(qp,Ws),Gs(u,qp),Zs),(function(e,t){return["validateExpr"].concat(p(e?[e]:[]),[["argExpr",t]])}))),Le=Ms.delimited(Ys,Ms.then(Ms.preceded(qp,ah),Ms.optional(Ms.preceded(Yp,Hh)),(function(e,t){return t?["pragma",["pragmaName",e],["pragmaContents",t]]:["pragma",["pragmaName",e]]})),Ms.preceded(qp,Vs)),$e=Ms.map(Ms.followed(Ms.plus(Le),Ms.preceded(qp,Ms.delimited(Ws,Gs(Ms.optional(u),qp),Zs))),(function(e){return["extensionExpr"].concat(p(e))})),qe=o(n(je,Cu,(function(e,t){return 0===t.length?e:["simpleMapExpr","pathExpr"===e[0]?e:["pathExpr",["stepExpr",["filterExpr",Wh(e)]]]].concat(t.map((function(e){return"pathExpr"===(e=e[1])[0]?e:["pathExpr",["stepExpr",["filterExpr",Wh(e)]]]})))}))),Ye=Ms.or([Xe,$e,qe]),Ve=Ms.or([Ms.then(Ms.or([js([Lu],"unaryMinusOp"),js([Xu],"unaryPlusOp")]),Ms.preceded(qp,(function(e,t){return Ve(e,t)})),(function(e,t){return[e,["operand",t]]})),Ye]),Qe=Ms.or([Ms.map(ah,(function(e){return["EQName"].concat(p(e))})),sh,D]),Je=Ms.then(Ve,Ms.star(Fs([qp,Yu,qp],Ms.then(Qe,Ms.preceded(qp,M),(function(e,t){return[e,t]})))),(function(e,t){return t.reduce((function(e,t){return["arrowExpr",["argExpr",e],t[0],["arguments"].concat(p(t[1]))]}),e)})),Ke=Ms.then(Je,Ms.optional(Fs([qp,rc,Yp,nc,uh,qp],rf)),(function(e,t){return null!==t?["castExpr",["argExpr",e],t]:e})),ze=Ms.then(Ke,Ms.optional(Fs([qp,oc,Yp,nc,uh,qp],rf)),(function(e,t){return null!==t?["castableExpr",["argExpr",e],t]:e})),We=Ms.then(ze,Ms.optional(Fs([qp,ac,Yp,nc,uh,qp],H)),(function(e,t){return null!==t?["treatExpr",["argExpr",e],["sequenceType"].concat(p(t))]:e})),Ze=Ms.then(We,Ms.optional(Fs([qp,ic,Yp,sc,uh,qp],H)),(function(e,t){return null!==t?["instanceOfExpr",["argExpr",e],["sequenceType"].concat(p(t))]:e})),et=n(Ze,Ms.followed(Ms.or([js([yc],"intersectOp"),js([vc],"exceptOp")]),uh),t),tt=n(et,Ms.or([js([Su],"unionOp"),Ms.followed(js([wc],"unionOp"),uh)]),t),nt=n(tt,Ms.or([js([bu],"multiplyOp"),Ms.followed(js([Nc],"divOp"),uh),Ms.followed(js([Bc],"idivOp"),uh),Ms.followed(js([Tc],"modOp"),uh)]),t),rt=n(nt,Ms.or([js([Lu],"subtractOp"),js([Xu],"addOp")]),t),ot=n(r(rt,Ms.followed(js([Ac],"rangeSequenceExpr"),uh),"startExpr","endExpr"),js([Ou],"stringConcatenateOp"),t),at=n(r(ot,Ms.or([_h,jh,Xh])),Ms.followed(js([Ec],"andOp"),uh),t),it=n(at,Ms.followed(js([bc],"orOp"),uh),t),st=Ms.then(Ms.then(Fs([Gc,qp,Qs,qp],u),Fs([qp,Js,qp,Fc,uh,qp],s),(function(e,t){return[e,t]})),Fs([qp,Pc,uh,qp],s),(function(e,t){return["ifThenElseExpr",["ifClause",e[0]],["thenClause",e[1]],["elseClause",t]]})),ut=Ms.delimited(Hc,Yp,_c),ct=Ms.map(Fs([jc,Yp,Nu],ah),(function(e){return["positionalVariableBinding"].concat(p(e))})),lt=function(e,t,n,r,o,a){return Ms.then(Ms.then(Ms.then(Ms.then(e,t,(function(e,t){return[e,t]})),n,(function(e,t){var n=c(e);return[e=n.next().value,n=n.next().value,t]})),r,(function(e,t){var n=c(e);return[e=n.next().value,n.next().value,n=n.next().value,t]})),o,(function(e,t){var n=c(e);e=n.next().value;var r=n.next().value,o=n.next().value;return n=n.next().value,a(e,r,o,n,t)}))}(Ms.preceded(Nu,ah),Ms.preceded(qp,Ms.optional(W)),Ms.preceded(qp,Ms.optional(ut)),Ms.preceded(qp,Ms.optional(ct)),Ms.preceded(Gs(Xc,qp),s),(function(e,t,n,r,o){return["forClauseItem",["typedVariableBinding",["varName"].concat(p(e),p(t?[t]:[]))]].concat(p(n?[["allowingEmpty"]]:[]),p(r?[r]:[]),[["forExpr",o]])})),pt=Fs([Lc,Yp],n(lt,Hu,(function(e,t){return["forClause",e].concat(p(t.map((function(e){return e[1]}))))}))),ht=Ps(Ms.preceded(Nu,ah),Ms.preceded(qp,Ms.optional(W)),Ms.preceded(Gs(vu,qp),s),(function(e,t,n){return["letClauseItem",["typedVariableBinding",["varName"].concat(p(e))].concat(p(t?[t]:[])),["letExpr",n]]})),ft=Ms.map(Fs([$c,qp],n(ht,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))}))),(function(e){return["letClause"].concat(p(e))})),dt=Ms.or([pt,ft]),mt=Ms.map(Fs([qc,uh,qp],s),(function(e){return["whereClause",e]})),gt=Ms.map(Ms.preceded(Nu,ah),(function(e){return["varName"].concat(p(e))})),yt=Ms.then(Ms.preceded(qp,Ms.optional(W)),Ms.preceded(Gs(vu,qp),s),(function(e,t){return["groupVarInitialize"].concat(p(e?[["typeDeclaration"].concat(p(e))]:[]),[["varValue",t]])})),vt=Ps(gt,Ms.optional(yt),Ms.optional(Ms.map(Ms.preceded(Gs(Yc,qp),f),(function(e){return["collation",e]}))),(function(e,t,n){return["groupingSpec",e].concat(p(t?[t]:[]),p(n?[n]:[]))})),wt=n(vt,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))})),At=Ms.map(Fs([Vc,Yp,Qc,qp],wt),(function(e){return["groupByClause"].concat(p(e))})),xt=Ps(Ms.optional(Ms.or([rp,op])),Ms.optional(Fs([qp,_c,qp],Ms.or([gl,yl].map((function(e){return Ms.map(e,(function(e){return"empty "+e}))}))))),Ms.preceded(qp,Ms.optional(Fs([Yc,qp],f))),(function(e,t,n){return e||t||n?["orderModifier"].concat(p(e?[["orderingKind",e]]:[]),p(t?[["emptyOrderingMode",t]]:[]),p(n?[["collation",n]]:[])):null})),bt=Ms.then(s,Ms.preceded(qp,xt),(function(e,t){return["orderBySpec",["orderByExpr",e]].concat(p(t?[t]:[]))})),Et=n(bt,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))})),Nt=Ms.then(Ms.or([Ms.map(Fs([Jc,Yp],Qc),(function(){return!1})),Ms.map(Fs([Kc,Yp,Jc,Yp],Qc),(function(){return!0}))]),Ms.preceded(qp,Et),(function(e,t){return["orderByClause"].concat(p(e?[["stable"]]:[]),p(t))})),Bt=Ms.or([dt,mt,At,Nt]),Tt=Ms.map(Fs([zc,qp],s),(function(e){return["returnClause",e]})),It=Ps(dt,Ms.star(Ms.preceded(qp,Bt)),Ms.preceded(qp,Tt),(function(e,t,n){return["flworExpr",e].concat(p(t),[n])})),Ct=n(H,Su,(function(e,t){return 0===t.length?["sequenceType"].concat(p(e)):["sequenceTypeUnion",["sequenceType"].concat(p(e))].concat(p(t.map((function(e){return["sequenceType"].concat(p(e[1]))}))))})),St=Ps(Fs([Al,qp],Ms.optional(Ms.preceded(Nu,Ms.followed(Ms.followed(ah,Yp),nc)))),Ms.preceded(qp,Ct),Fs([Yp,zc,Yp],s),(function(e,t,n){return["typeswitchExprCaseClause"].concat(e?[["variableBinding"].concat(p(e))]:[],[t],[["resultExpr",n]])})),Ot=Hs(Ms.preceded(xl,Gs(Ms.delimited(Qs,Gs(u,qp),Js),qp)),Ms.plus(Ms.followed(St,qp)),Fs([cl,Yp],Ms.optional(Ms.preceded(Nu,Ms.followed(ah,Yp)))),Fs([zc,Yp],s),(function(e,t,n,r){return["typeswitchExpr",["argExpr",e]].concat(p(t),[["typeswitchExprDefaultClause"].concat(p(n||[]),[["resultExpr",r]])])})),Rt=Ps(Ms.preceded(Nu,ah),Ms.optional(Ms.preceded(Yp,W)),Ms.preceded(Gs(Xc,Yp),s),(function(e,t,n){return["quantifiedExprInClause",["typedVariableBinding",["varName"].concat(p(e))].concat(p(t?[t]:[])),["sourceExpr",n]]})),Dt=n(Rt,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))})),Ut=Ps(Ms.or([bl,El]),Ms.preceded(Yp,Dt),Ms.preceded(Gs(Nl,qp),s),(function(e,t,n){return["quantifiedExpr",["quantifier",e]].concat(p(t),[["predicateExpr",n]])})),Mt=Ms.map(Fs([lc,Yp,Ms.or([cc,uc]),Yp],s),(function(e){return["deleteExpr",["targetExpr",e]]})),kt=Ps(Fs([Bl,Yp],Ms.optional(Fs([pc,Yp,sc],Yp))),Fs([uc,Yp],s),Ms.preceded(Gs(Tl,Yp),s),(function(e,t,n){return e?["replaceExpr",["replaceValue"],["targetExpr",t],["replacementExpr",n]]:["replaceExpr",["targetExpr",t],["replacementExpr",n]]})),Gt=Ms.then(sh,Ms.preceded(Gs(vu,qp),s),(function(e,t){return["transformCopy",e,["copySource",t]]})),Ft=Ps(Fs([Il,Yp],n(Gt,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))}))),Fs([qp,Cl,Yp],s),Ms.preceded(Gs(zc,Yp),s),(function(e,t,n){return["transformExpr",["transformCopies"].concat(p(e)),["modifyExpr",t],["returnExpr",n]]})),Pt=Ms.or([Ms.followed(Ms.map(Ms.optional(Ms.followed(Fs([nc,Yp],Ms.or([Ms.map(Sl,(function(){return["insertAsFirst"]})),Ms.map(Ol,(function(){return["insertAsLast"]}))])),Yp)),(function(e){return e?["insertInto",e]:["insertInto"]})),Ul),Ms.map(Dl,(function(){return["insertAfter"]})),Ms.map(Rl,(function(){return["insertBefore"]}))]),Ht=Ps(Fs([Ml,Yp,Ms.or([cc,uc]),Yp],s),Ms.preceded(Yp,Pt),Ms.preceded(Yp,s),(function(e,t,n){return["insertExpr",["sourceExpr",e],t,["targetExpr",n]]})),_t=Ms.then(Fs([kl,Yp,uc,qp],s),Fs([Yp,nc,Yp],s),(function(e,t){return["renameExpr",["targetExpr",e],["newNameExpr",t]]})),jt=Ms.then(Ms.plus(Ms.map(Fs([Al,Yp],s),(function(e){return["switchCaseExpr",e]}))),Fs([Yp,zc,Yp],s),(function(e,t){return["switchExprCaseClause"].concat(p(e),[["resultExpr",t]])})),Xt=Ps(Fs([Gl,qp,Qs],u),Fs([qp,Js,qp],Ms.plus(Ms.followed(jt,qp))),Fs([cl,Yp,zc,Yp],s),(function(e,t,n){return["switchExpr",["argExpr",e]].concat(p(t),[["switchExprDefaultClause",["resultExpr",n]]])})),Lt=Ms.map(u,(function(e){return["queryBody",e]})),$t=Fs([ul,Yp,el,Yp],Ms.then(Jp,Ms.preceded(Gs(Ru,qp),f),(function(e,t){return["namespaceDecl",["prefix",e],["uri",t]]}))),qt=Ms.then(Fs([Fl,Yp,Nu,qp],Ms.then(ah,Ms.optional(Ms.preceded(qp,W)),(function(e,t){return[e,t]}))),Ms.or([Ms.map(Fs([qp,vu,qp],s),(function(e){return["varValue",e]})),Ms.map(Fs([Yp,Pl],Ms.optional(Fs([qp,vu,qp],s))),(function(e){return["external"].concat(p(e?[["varValue",e]]:[]))}))]),(function(e,t){var n=c(e);return e=n.next().value,n=n.next().value,["varDecl",["varName"].concat(p(e))].concat(p(null!==n?[n]:[]),[t])})),Yt=Hs(Fs([hc,Yp,Ms.peek(Ms.not(Bh,["Cannot use reserved function name"]))],ah),Fs([qp,Qs,qp],Ms.optional(ee)),Fs([qp,Js],Ms.optional(Fs([Yp,nc,Yp],H))),Ms.preceded(qp,Ms.or([Ms.map(P,(function(e){return["functionBody",e]})),Ms.map(Pl,(function(){return["externalDefinition"]}))])),(function(e,t,n,r){return["functionDecl",["functionName"].concat(p(e)),["paramList"].concat(p(t||[]))].concat(p(n?[["typeDeclaration"].concat(p(n))]:[]),[r])})),Vt=Fs([ul,Yp],Ms.then(Ms.star(Ms.followed(Ms.or([_,Lh]),Yp)),Ms.or([qt,Yt]),(function(e,t){return[t[0]].concat(p(e),p(t.slice(1)))}))),Qt=Ms.then(Fs([ul,Yp,cl,Yp],Ms.or([dc,hc])),Fs([Yp,el,Yp],f),(function(e,t){return["defaultNamespaceDecl",["defaultNamespaceCategory",e],["uri",t]]})),Jt=Ms.or([Ms.map(Ms.followed(Fs([el,Yp],Jp),Ms.preceded(qp,Ru)),(function(e){return["namespacePrefix",e]})),Ms.map(Fs([cl,Yp,dc,Yp],el),(function(){return["defaultElementNamespace"]}))]),Kt=Fs([_l,Yp,jl],Ps(Ms.optional(Ms.preceded(Yp,Jt)),Ms.preceded(qp,f),Ms.optional(Ms.then(Fs([Yp,jc,Yp],f),Ms.star(Fs([qp,Hu,qp],f)),(function(e,t){return[e].concat(p(t))}))),(function(e,t,n){return["schemaImport"].concat(p(e?[e]:[]),[["targetNamespace",t]],p(n?[n]:[]))}))),zt=Fs([_l,Yp,Xl],Ps(Ms.optional(Ms.followed(Fs([Yp,el,Yp],Jp),Ms.preceded(qp,Ru))),Ms.preceded(qp,f),Ms.optional(Ms.then(Fs([Yp,jc,Yp],f),Ms.star(Fs([qp,Hu,qp],f)),(function(e,t){return[e].concat(p(t))}))),(function(e,t){return["moduleImport",["namespacePrefix",e],["targetNamespace",t]]}))),Wt=Ms.or([Kt,zt]),Zt=Ms.map(Fs([ul,Yp,cl,Yp,Yc,Yp],f),(function(e){return["defaultCollationDecl",e]})),en=Ms.map(Fs([ul,Yp,Ll,Yp],f),(function(e){return["baseUriDecl",e]})),tn=Ms.then(Fs([ul,Yp],Ms.or([Ms.map(Fs([wl,Yp],ah),(function(e){return["decimalFormatName"].concat(p(e))})),Ms.map(Fs([cl,Yp],wl),(function(){return null}))])),Ms.star(Ms.then(Ms.preceded(Yp,Yh),Ms.preceded(Gs(Ru,Yp),f),(function(e,t){return["decimalFormatParam",["decimalFormatParamName",e],["decimalFormatParamValue",t]]}))),(function(e,t){return["decimalFormatDecl"].concat(p(e?[e]:[]),p(t))})),nn=Ms.or([Vh,Zt,en,Qh,Jh,Kh,zh,tn]),rn=Ms.then(Fs([ul,Yp,Ql,Yp],ah),Ms.preceded(Yp,f),(function(e,t){return["optionDecl",["optionName",e],["optionContents",t]]})),on=Ms.then(Fs([ul,Yp,Jl,Yp,Kl],Ms.optional(Fs([Yp,nc],z))),Ms.or([Ms.map(Ms.preceded(Gs(vu,qp),s),(function(e){return["varValue",e]})),Ms.map(Fs([Yp,Pl],Ms.optional(Ms.preceded(Gs(vu,qp),s))),(function(){return["external"]}))]),(function(e,t){return["contextItemDecl"].concat(p(e?[["contextItemType",e]]:[]),[t])})),an=Ms.then(Ms.star(Ms.followed(Ms.or([Qt,nn,$t,Wt]),Gs(xu,qp))),Ms.star(Ms.followed(Ms.or([on,Vt,rn]),Gs(xu,qp))),(function(e,t){return 0===e.length&&0===t.length?null:["prolog"].concat(p(e),p(t))})),sn=Fs([Xl,Yp,el,Yp],Ms.then(Ms.followed(Jp,Gs(Ru,qp)),Ms.followed(f,Gs(xu,qp)),(function(e,t){return["moduleDecl",["prefix",e],["uri",t]]}))),un=Ms.then(sn,Ms.preceded(qp,an),(function(e,t){return["libraryModule",e].concat(p(t?[t]:[]))})),cn=Ms.then(an,Ms.preceded(qp,Lt),(function(e,t){return["mainModule"].concat(p(e?[e]:[]),[t])})),ln=Ms.map(Fs([zl,qp],Ms.followed(Ms.or([Ms.then(Ms.preceded(Zl,Yp),f,(function(e){return["encoding",e]})),Ms.then(Fs([Wl,Yp],f),Ms.optional(Fs([Yp,Zl,Yp],f)),(function(e,t){return[["version",e]].concat(p(t?[["encoding",t]]:[]))}))]),Ms.preceded(qp,xu))),(function(e){return["versionDecl"].concat(p(e))})),pn=Ms.then(Ms.optional(Gs(ln,qp)),Ms.or([un,cn]),(function(e,t){return["module"].concat(p(e?[e]:[]),[t])})),hn=Ms.complete(Gs(pn,qp));return function(e,t){l.clear(),t=hn(e,t);for(var n=1,r=1,o=0;o<e.length+1;o++){if(l.has(o)){var a=l.get(o);a.line=r,a.la=n}"\r"===(a=e[o])||"\n"===a?(r++,n=1):n++}return t}}var uf=sf({sb:!1,Va:!1}),cf=sf({sb:!0,Va:!1}),lf=sf({sb:!1,Va:!0}),pf=sf({sb:!0,Va:!0});function hf(e,t){var n=!!t.aa;if(t=!!t.debug,Pp.clear(),Hp.clear(),af.clear(),!0===(n=n?t?pf(e,0):lf(e,0):t?cf(e,0):uf(e,0)).success)return n.value;throw Error("XPST0003: Failed to parse '"+e+"' expected: "+n.expected+"\n"+e.slice(0,n.offset)+"[Error is around here]"+e.slice(n.offset))}var ff="http://www.w3.org/XML/1998/namespace http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2005/xpath-functions http://www.w3.org/2005/xpath-functions/math http://www.w3.org/2012/xquery http://www.w3.org/2005/xpath-functions/array http://www.w3.org/2005/xpath-functions/map".split(" ");function df(e,t,n){n=void 0===n||n;var r=[],o=[];So(e,"*").forEach((function(e){switch(e[0]){case"moduleImport":case"namespaceDecl":case"defaultNamespaceDecl":case"functionDecl":case"varDecl":break;default:throw Error("Not implemented: only module imports, namespace declarations, and function declarations are implemented in XQuery modules")}}));var a=new Set;So(e,"moduleImport").forEach((function(e){var n=To(Bo(e,"namespacePrefix"));if(e=To(Bo(e,"targetNamespace")),a.has(e))throw Error('XQST0047: The namespace "'+e+'" is imported more than once.');a.add(e),xo(t,n,e),Ds(t,e)})),So(e,"namespaceDecl").forEach((function(e){var n=To(Bo(e,"prefix"));if(e=To(Bo(e,"uri")),"xml"===n||"xmlns"===n)throw po();if("http://www.w3.org/XML/1998/namespace"===e||"http://www.w3.org/2000/xmlns/"===e)throw po();xo(t,n,e)}));for(var i=null,s=null,u=c(So(e,"defaultNamespaceDecl")),l=u.next();!l.done;l=u.next()){var h=l.value;if(l=To(Bo(h,"defaultNamespaceCategory")),!(h=To(Bo(h,"uri"))))throw co();if("http://www.w3.org/XML/1998/namespace"===h||"http://www.w3.org/2000/xmlns/"===h)throw po();if("function"===l){if(i)throw lo();i=h}else if("element"===l){if(s)throw lo();s=h}}i&&(t.A=i),s&&xo(t,"",s),So(e,"functionDecl").forEach((function(e){!function(e,t,n,r,o){var a=Bo(e,"functionName"),i=Io(a,"prefix")||"",s=Io(a,"URI"),u=To(a);if(null===s&&!(s=""===i?null===t.A?"http://www.w3.org/2005/xpath-functions":t.A:t.ba(i))&&i)throw fo(i);if(ff.includes(s))throw uo();if(i=So(e,"annotation").map((function(e){return Bo(e,"annotationName")})),a=i.every((function(e){return!Io(e,"URI")&&"private"!==To(e)})),i=i.some((function(e){return!Io(e,"URI")&&"updating"===To(e)})),!s)throw co();var c=Ro(e),l=So(Bo(e,"paramList"),"param"),h=l.map((function(e){return Bo(e,"varName")})),f=l.map((function(e){return Ro(e)}));if(e=Bo(e,"functionBody")){if(t.za(s,u,f.length))throw Error("XQST0049: The function Q{"+s+"}"+u+"#"+f.length+" has already been declared.");if(!o)return;var d=Bs(e[1],{qa:!1,aa:!0}),m=new yo(t),g=h.map((function(e){var n=Io(e,"URI"),r=Io(e,"prefix");return e=To(e),r&&null===n&&(n=t.ba(r||"")),bo(m,n,e)}));o=i?{l:f,arity:h.length,m:function(e,t,n,r){for(var o=[],a=3;a<arguments.length;++a)o[a-3]=arguments[a];return a=Bt(Nt(e,-1,null,ce.empty()),g.reduce((function(e,t,n){return e[t]=le(o[n]),e}),Object.create(null))),d.u(a,t)},Bb:!1,I:!0,localName:u,namespaceURI:s,i:c}:{l:f,arity:h.length,m:function(e,t,n,r){for(var o=[],a=3;a<arguments.length;++a)o[a-3]=arguments[a];return a=Bt(Nt(e,-1,null,ce.empty()),g.reduce((function(e,t,n){return e[t]=le(o[n]),e}),Object.create(null))),ur(d,a,t)},Bb:!1,I:!1,localName:u,namespaceURI:s,i:c},n.push({da:d,Ib:m}),a&&r.push({arity:h.length,da:d,Eb:o,localName:u,namespaceURI:s})}else{if(i)throw Error("Updating external function declarations are not supported");o={l:f,arity:h.length,m:function(e,t,n,r){for(var o=[],a=3;a<arguments.length;++a)o[a-3]=arguments[a];if(!(a=n.za(s,u,h.length,!0)))throw Error("XPST0017: Function Q{"+s+"}"+u+" with arity of "+h.length+" not registered. "+eo(u));if(a.i.type!==c.type||a.l.some((function(e,t){return e.type!==f[t].type})))throw Error("External function declaration types do not match actual function");return a.m.apply(a,[e,t,n].concat(p(o)))},Bb:!0,I:!1,localName:u,namespaceURI:s,i:c}}Ao(t,s,u,h.length,o)}(e,t,r,o,n)}));var f=[];return So(e,"varDecl").forEach((function(e){var o=Oo(Bo(e,"varName")),a=o.namespaceURI;if(null===a&&(!(a=t.ba(o.prefix))&&o.prefix))throw fo(o.prefix);if(ff.includes(a))throw uo();var i,s,u=Bo(e,"external");if(e=Bo(e,"varValue"),null!==u?null!==(u=Bo(u,"varValue"))&&(i=Bo(u,"*")):null!==e&&(i=Bo(e,"*")),f.some((function(e){return e.namespaceURI===a&&e.localName===o.localName})))throw Error("XQST0049: The variable "+(a?"Q{"+a+"}":"")+o.localName+" has already been declared.");if(bo(t,a||"",o.localName),n&&(i&&(s=Bs(i,{qa:!1,aa:!0})),i&&!function(e,t,n){return(e=e.Da[mo(t,n)])?e:null}(t,a||"",o.localName))){var c=null;Eo(t,a,o.localName,(function(e,t){return c?c():(c=le(ur(s,e,t)))()})),r.push({da:s,Ib:t}),f.push({da:s,localName:o.localName,namespaceURI:a})}})),r.forEach((function(e){e.da.P(e.Ib)})),o.forEach((function(e){if(!e.Eb.I&&e.da.I)throw Kn("The function Q{"+e.namespaceURI+"}"+e.localName+" is updating but the %updating annotation is missing.")})),{Ma:o,Ua:f}}function mf(e,t,n,r,o,a,i){var s=t.aa?"XQuery":"XPath";return n=t.Ha?null:function(e,t,n,r,o,a,i,s){return(e=Ts.get(e))&&(t=e[t+(a?"_DEBUG":"")])&&(t=t.find((function(e){return e.s===i&&e.j.every((function(e){return n(e.prefix)===e.namespaceURI}))&&e.u.every((function(e){return void 0!==r[e.name]}))&&e.A.every((function(e){return o[e.prefix]===e.namespaceURI}))&&e.O.every((function(e){var t=s(e.Bc,e.arity);return t&&t.namespaceURI===e.Hb.namespaceURI&&t.localName===e.Hb.localName}))})))?{da:t.h,Fc:!1}:null}(e,s,n,r,o,t.debug,a,i),null!==n?{state:n.Fc?1:2,da:n.da}:{state:0,wc:"string"==typeof e?hf(e,t):Ss(e)}}function gf(e,t,n,r,o,a,i){var s=new oo(n,r,a,i),u=new yo(s);switch(Object.keys(o).forEach((function(e){var t=o[e];Ds(u,t),xo(u,e,t)})),"string"==typeof e&&(e=Us(e)),(n=mf(e,t,n,r,o,a,i)).state){case 2:return{ia:u,da:n.da};case 1:return n.da.P(u),Cs(e,t.aa?"XQuery":"XPath",s,o,n.da,t.debug,a),{ia:u,da:n.da};case 0:return n=function(e,t,n){var r=Bo(e,"mainModule");if(!r)throw Error("Can not execute a library module.");var o=Bo(r,"prolog");if(o){if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");df(o,n)}return Qo(e,new na(n)),As(e=Co(r,["queryBody","*"]),t)}(n.wc,t,u),n.P(u),t.Ha||Cs(e,t.aa?"XQuery":"XPath",s,o,n,t.debug,a),{ia:u,da:n}}}function yf(e,t,n){if(1!==t.node.nodeType&&9!==t.node.nodeType)return[];var r=De(e,t).reduce((function(t,r){for(var o=(r=c(yf(e,r,n))).next();!o.done;o=r.next())t.push(o.value);return t}),[]);return n(t)&&r.unshift(t),r}function vf(e,t,n,r,o){if(!(e=o.first()))throw Error("XPDY0002: The context is absent, it needs to be present to use id function.");if(!ee(e.type,53))throw St("The context item is not a node, it needs to be node to use id function.");var a=t.h,i=r.M().reduce((function(e,t){return t.value.split(/\s+/).forEach((function(t){e[t]=!0})),e}),Object.create(null));for(t=e.value;9!==t.node.nodeType;)if(null===(t=Fe(a,t)))throw Error("FODC0001: the root node of the target node is not a document node.");return t=yf(a,t,(function(e){return 1===e.node.nodeType&&(!(!(e=Re(a,e,"id"))||!i[e])&&(i[e]=!1,!0))})),ce.create(t.map((function(e){return Xe(e)})))}function wf(e,t,n,r,o){if(!(e=o.first()))throw Error("XPDY0002: The context is absent, it needs to be present to use idref function.");if(!ee(e.type,53))throw St("The context item is not a node, it needs to be node to use idref function.");var a=t.h,i=r.M().reduce((function(e,t){return e[t.value]=!0,e}),Object.create(null));for(t=e.value;9!==t.node.nodeType;)if(null===(t=Fe(a,t)))throw Error("FODC0001: the root node of the context node is not a document node.");return t=yf(a,t,(function(e){return 1===e.node.nodeType&&(!!(e=Re(a,e,"idref"))&&e.split(/\s+/).some((function(e){return i[e]})))})),ce.create(t.map((function(e){return Xe(e)})))}function Af(e){switch(typeof e){case"object":return Array.isArray(e)?ce.o(new _e(e.map((function(e){return le(Af(e))})))):null===e?ce.empty():ce.o(new Ye(Object.keys(e).map((function(t){return{key:Y(t,1),value:le(Af(e[t]))}}))));case"number":return ce.o(Y(e,3));case"string":return ce.o(Y(e,1));case"boolean":return e?ce.ca():ce.X();default:throw Error("Unexpected type in JSON parse")}}function xf(e,t,n,r,o){var a=(e=qe(0,0,0,o,ce.o(Y("duplicates",1)))).G()?"use-first":e.first().value;return r.L((function(e){return ce.o(new Ye(e.reduce((function(e,t){return t.h.forEach((function(t){var n=e.findIndex((function(e){return $e(e.key,t.key)}));if(0<=n)switch(a){case"reject":throw Error("FOJS0003: Duplicate encountered when merging maps.");case"use-last":return void e.splice(n,1,t);case"combine":return void e.splice(n,1,{key:t.key,value:le(ce.create(e[n].value().M().concat(t.value().M())))});default:return}e.push(t)})),e}),[])))}))}function bf(e,t,n){var r=1,o=e.value;e=e.Na(!0);var a=null,i=Math.max(t-1,0);return-1!==e&&(a=Math.max(0,(null===n?e:Math.max(0,Math.min(e,n+(t-1))))-i)),ce.create({next:function(e){for(;r<t;)o.next(e),r++;return null!==n&&r>=t+n?z:(e=o.next(e),r++,e)}},a)}function Ef(e){return e.map((function(e){return ee(e.type,19)?zt(e,3):e}))}function Nf(e){if((e=Ef(e)).some((function(e){return Number.isNaN(e.value)})))return[Y(NaN,3)];if(!(e=li(e)))throw Error("FORG0006: Incompatible types to be converted to a common type");return e}function Bf(e,t,n,r,o,a){return Le([o,a],(function(e){var t=c(e);if(e=t.next().value,t=t.next().value,1/0===e.value)return ce.empty();if(-1/0===e.value)return t&&1/0===t.value?ce.empty():r;if(t){if(isNaN(t.value))return ce.empty();1/0===t.value&&(t=null)}return isNaN(e.value)?ce.empty():bf(r,Math.round(e.value),t?Math.round(t.value):null)}))}function Tf(e,t,n,r,o){if(r.G())return o;if(!(e=li(e=Ef(r.M()))))throw Error("FORG0006: Incompatible types to be converted to a common type");if(!e.every((function(e){return ee(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 ee(e.type,5)}))?ce.o(Y(t,5)):e.every((function(e){return ee(e.type,3)}))?ce.o(Y(t,3)):e.every((function(e){return ee(e.type,4)}))?ce.o(Y(t,4)):ce.o(Y(t,6))}var If=[].concat(Mr,[{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()?ce.ca():ce.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"true",l:[],i:{type:0,g:3},m:function(){return ce.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()?ce.ca():ce.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"false",l:[],i:{type:0,g:3},m:function(){return ce.X()}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"last",l:[],i:{type:5,g:3},m:function(e){if(null===e.N)throw Error("XPDY0002: The fn:last() function depends on dynamic context, which is absent.");var t=!1;return ce.create({next:function(){if(t)return z;var n=e.Ga.Na();return t=!0,W(Y(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.N)throw Error("XPDY0002: The fn:position() function depends on dynamic context, which is absent.");return ce.o(Y(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 ce.o(Y(bt(e),10))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-date",l:[],i:{type:7,g:3},m:function(e){return ce.o(Y(ut(bt(e),7),7))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-time",l:[],i:{type:8,g:3},m:function(e){return ce.o(Y(ut(bt(e),8),8))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"implicit-timezone",l:[],i:{type:17,g:3},m:function(e){return ce.o(Y(Et(e),17))}}],Gr,$r,Yr,[{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:ce.o(Y(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:ce.o(Y(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:ce.o(Y(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:ce.o(Y(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:ce.o(Y(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:ce.o(Y(r.first().value.getSeconds(),4))}}],Qr,[{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:vf},{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 vf(e,t,0,r,ce.o(e.N))}},{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:wf},{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 wf(e,t,0,r,ce.o(e.N))}}],[{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 o=JSON.parse(r.first().value)}catch(e){throw Error("FOJS0001: parsed JSON string contains illegal JSON.")}return Af(o)}}],[{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,o){return Le([r,o],(function(e){var t=(e=c(e)).next().value,n=e.next().value;return t.h.some((function(e){return $e(e.key,n)}))?ce.ca():ce.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,o){return r.map((function(e){return new Ye([{key:e,value:le(o)}])}))}},{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,o){return Le([r,o],(function(r){var o=(r=c(r)).next().value,a=r.next().value;return It(o.h.map((function(r){return a.value.call(void 0,e,t,n,ce.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:qe},{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 Le([r],(function(e){return e=c(e).next().value,ce.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:xf},{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 xf(e,0,0,r,ce.o(new Ye([{key:Y("duplicates",1),value:function(){return ce.o(Y("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,o,a){return Le([r,o],(function(e){var t=(e=c(e)).next().value,n=e.next().value;return e=t.h.concat(),t=e.findIndex((function(e){return $e(e.key,n)})),0<=t?e.splice(t,1,{key:n,value:le(a)}):e.push({key:n,value:le(a)}),ce.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,o){return Le([r],(function(e){var t=c(e).next().value.h.concat();return o.L((function(e){return e.forEach((function(e){var n=t.findIndex((function(t){return $e(t.key,e)}));0<=n&&t.splice(n,1)})),ce.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 Y(e.h.length,5)}))}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"pi",l:[],i:{type:3,g:3},m:function(){return ce.o(Y(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 Y(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 Y(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 Y(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 Y(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,o){return o.L((function(e){var t=c(e).next().value;return r.map((function(e){return 1!==Math.abs(e.value)||Number.isFinite(t.value)?Y(Math.pow(e.value,t.value),3):Y(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 Y(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 Y(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 Y(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 Y(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 Y(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 Y(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 Y(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,o){return o.L((function(e){var t=c(e).next().value;return r.map((function(e){return Y(Math.atan2(e.value,t.value),3)}))}))}}],jn,vn,[{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,o){if(e=r.first(),o=o.first(),null===e||null===o)return ce.empty();var a=e.value;return o=o.value,a>o?ce.empty():ce.create({next:function(){return W(Y(a++,5))}},o-a+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,o){return Le([r,o],(function(e){var t=c(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.G())return ce.o(Y(new ve("",null,t),23));if(!t.includes(":"))return ce.o(Y(new ve("",e,t),23));var n=c(t.split(":"));return t=n.next().value,n=n.next().value,ce.o(Y(new ve(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 Le([r],(function(e){return null===(e=c(e).next().value)?ce.empty():(e=e.value).prefix?ce.o(Y(e.prefix,24)):ce.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 Y(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 Y(e.value.namespaceURI||"",20)}))}}],[{l:[{type:59,g:2}],m:function(e,t,n,r){return r.$({empty:function(){return ce.ca()},multiple:function(){return ce.X()},o:function(){return ce.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 ce.X()},multiple:function(){return ce.ca()},o:function(){return ce.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 bf(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 bf(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,o,a){return r.G()?a:a.G()?r:(e=r.M(),0>(o=o.first().value-1)?o=0:o>e.length&&(o=e.length),t=e.slice(o),ce.create(e.slice(0,o).concat(a.M(),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,o){return e=o.first().value,!(r=r.M()).length||1>e||e>r.length||r.splice(e-1,1),ce.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 ce.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,o){return Bf(0,0,0,r,o,ce.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:Bf,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 o=Ut(r,t).M();return ce.create(o).filter((function(e,t){return o.slice(0,t).every((function(t){return!$n(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,o){return o.L((function(n){var o=c(n).next().value;return Ut(r,t).map((function(t,n){return qa("eqOp",t.type,o.type)(t,o,e)?Y(n+1,5):Y(-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,o){var a=!1,i=Vn(e,t,n,r,o);return ce.create({next:function(){if(a)return z;var e=i.next(0);return e.done?e:(a=!0,W(Y(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 o=!1;return ce.create({next:function(){if(o)return z;var e=r.Na();return o=!0,W(Y(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=li(e=Ef(r.M()))))throw Error("FORG0006: Incompatible types to be converted to a common type");if(!e.every((function(e){return ee(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 ee(e.type,5)||ee(e.type,3)}))?ce.o(Y(t,3)):e.every((function(e){return ee(e.type,4)}))?ce.o(Y(t,4)):ce.o(Y(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=Nf(r.M()),ce.o(e.reduce((function(e,t){return e.value<t.value?t:e}))))},localName:"max",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:"max",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=Nf(r.M()),ce.o(e.reduce((function(e,t){return e.value>t.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 Tf(e,t,0,r,ce.o(Y(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:Tf,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,o){if(r.G())return r;var a=o.first(),i=a.s;if(1!==i.length)throw Error("XPTY0004: signature of function passed to fn:filter is incompatible.");return r.filter((function(r){if(r=fn(i[0],ce.o(r),t,"fn:filter",!1),!(r=a.value.call(void 0,e,t,n,r)).ya()||!ee(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,o){if(r.G())return r;var a=o.first(),i=a.s;if(1!==i.length)throw Error("XPTY0004: signature of function passed to fn:for-each is incompatible.");var s,u=r.value;return ce.create({next:function(r){for(;;){if(!s){var o=u.next(0);if(o.done)return o;o=fn(i[0],ce.o(o.value),t,"fn:for-each",!1),s=a.value.call(void 0,e,t,n,o).value}if(!(o=s.next(r)).done)return o;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,o,a){if(r.G())return r;var i=a.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,o){return r=fn(s[0],r,t,"fn:fold-left",!1),o=fn(s[1],ce.o(o),t,"fn:fold-left",!1),i.value.call(void 0,e,t,n,r,o)}),o)}))},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,o,a){if(r.G())return r;var i=a.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,o){return r=fn(s[0],r,t,"fn:fold-right",!1),o=fn(s[1],ce.o(o),t,"fn:fold-right",!1),i.value.call(void 0,e,t,n,o,r)}),o)}))},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.M()).every((function(e){return ee(e.type,53)})))throw Error("Expected argument to fn:serialize to resolve to a sequence of Nodes.");return ce.o(Y(e.map((function(e){return t.j.serializeToString(Oi(e.value,t,!1))})),1))},localName:"serialize",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}}],On,[{l:[{type:59,g:3},{type:61,g:3}],m:function(e,t,n,r,o){var a,i;return ce.create({next:function(){if(!a){var e=function(e,t,n,r){e=e.first();var o=t.first().h.reduce((function(e,t){return e[t.key.value]=le(t.value()),e}),Object.create(null));t=o["."]?o["."]():ce.empty(),delete o["."];try{if(ee(e.type,1))var a=e.value;else{if(!ee(e.type,54))throw St("Unable to convert selector argument of type "+fe[e.type]+" to either an "+fe[1]+" or an "+fe[54]+" representing an XQueryX program while calling 'fontoxpath:evaluate'");a=e.value.node}var i=gf(a,{qa:!1,aa:!0,debug:r.debug,Ha:r.Ha},(function(e){return n.ba(e)}),Object.keys(o).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 At({N:c?t.first():null,Ja:c?0:-1,Ga:t,Ea:Object.keys(o).reduce((function(e,t){return e[u.qb(null,t)]=o[t],e}),Object.create(null))});return{Gc:s.h(l,r).value,Dc:e}}catch(t){zr(e.value,t)}}(r,o,n,t);a=e.Gc,i=e.Dc}try{return a.next(0)}catch(e){zr(i.value,e)}}})},localName:"evaluate",namespaceURI:"http://fontoxml.com/fontoxpath",i:{type:59,g:2}},{l:[],m:function(){return ce.o(Y("3.26.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,o){return Le([r,o],(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?ce.empty():(e=new we({l:r.l,arity:t.value,localName:e.value.localName,namespaceURI:e.value.namespaceURI,i:r.i,value:r.m}),ce.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 Le([r],(function(e){return(e=c(e).next().value).Pa()?ce.empty():ce.o(Y(new ve("",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 Le([r],(function(e){return e=c(e).next().value,ce.o(Y(e.A,5))}))},localName:"function-arity",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:5,g:3}}]);function Cf(e){this.h=e}(r=Cf.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 Sf=Symbol("IS_XPATH_VALUE_SYMBOL");function Of(e){return e&&"object"==typeof e&&"lookupNamespaceURI"in e?function(t){return e.lookupNamespaceURI(t||null)}:function(){return null}}function Rf(e){return function(t){var n=t.localName;return t.prefix?null:{namespaceURI:e,localName:n}}}function Df(e,t,n,r,o,a){var i,s,u,l,p,h,f;null==r&&(r=r||{}),o?(i=o.logger||{trace:console.log.bind(console)},s=o.documentWriter,u=o.moduleImports,l=o.namespaceResolver,p=o.functionNameResolver,h=o.nodesFactory,f=o.xmlSerializer):(i={trace:console.log.bind(console)},u={},l=null,h=null,s=null,f=null,p=void 0);var d=new Se(null===n?new Ee:n);n=u||Object.create(null),u=void 0===o.defaultFunctionNamespaceURI?"http://www.w3.org/2005/xpath-functions":o.defaultFunctionNamespaceURI;var m=gf(e,a,l||Of(t),r,n,u,p||Rf(u));for(e=t?wt(0,t):ce.empty(),t=!h&&a.aa?new lr(t):new Cf(h),s=s?new Te(s):Be,h=Object.keys(r).reduce((function(e,t){var n=r[t];return e["Q{}"+t+"[0]"]=n&&"object"==typeof n&&Sf in n?function(){return ce.create(n.Db)}:function(){return wt(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 At({N:e.first(),Ja:0,Ga:e,Ea:h}),y=new Tt(a.debug,a.Ha,d,t,s,o.currentContext,i,f);return{xb:g,zb:y,da:m.da}}function Uf(e,t){var n={},r=0,o=!1,a=null;return{next:function(){if(o)return z;for(var i={};r<e.h.length;){e:{var s=e.h[r].key.value;if(!a){i.kb=e.h[r];var u=i.kb.value().$({default:function(e){return e},multiple:function(e){return function(){throw Error("Serialization error: The value of an entry in a map is expected to be a single item or an empty sequence. Use arrays when putting multiple values in a map. The value of the key "+e.kb.key.value+" holds multiple items")}}(i)}).first();if(null===u){n[s]=null,r++;break e}a=kf(u,t)}u=a.next(0),a=null,n[s]=u.value,r++}i={kb:i.kb}}return o=!0,W(n)}}}function Mf(e,t){var n=[],r=0,o=!1,a=null;return{next:function(){if(o)return z;for(;r<e.R.length;){if(!a){var i=e.R[r]().$({default:function(e){return e},multiple:function(){throw Error("Serialization error: The value of an entry in an array is expected to be a single item or an empty sequence. Use nested arrays when putting multiple values in an array.")}}).first();if(null===i){n[r++]=null;continue}a=kf(i,t)}i=a.next(0),a=null,n[r++]=i.value}return o=!0,W(n)}}}function kf(e,t){if(ee(e.type,61))return Uf(e,t);if(ee(e.type,62))return Mf(e,t);if(ee(e.type,23)){var n=e.value;return{next:function(){return W("Q{"+(n.namespaceURI||"")+"}"+n.localName)}}}switch(e.type){case 7:case 8:case 9:case 11:case 12:case 13:case 14:case 15:var r=e.value;return{next:function(){return W(ct(r))}};case 47:case 53:case 54:case 55:case 56:case 57:case 58:var o=e.value;return{next:function(){return W(Oi(o,t,!1))}};default:return{next:function(){return W(e.value)}}}}If.forEach((function(e){to(e.namespaceURI,e.localName,e.l,e.i,e.m)}));var Gf={ANY:0,NUMBER:1,STRING:2,BOOLEAN:3,NODES:7,FIRST_NODE:9,STRINGS:10,MAP:11,ARRAY:12,NUMBERS:13,ALL_RESULTS:14,ASYNC_ITERATOR:99};function Ff(e,t,n,r){switch(n){case 3:return t.getEffectiveBooleanValue();case 2:return(t=Ut(t,r).M()).length?t.map((function(e){return zt(e,1).value})).join(" "):"";case 10:return(t=Ut(t,r).M()).length?t.map((function(e){return e.value+""})):[];case 1:return null!==(t=t.first())&&ee(t.type,2)?t.value:NaN;case 9:if(null===(t=t.first()))return null;if(!ee(t.type,53))throw Error("Expected XPath "+Jr(e)+" to resolve to Node. Got "+fe[t.type]);return Oi(t.value,r,!1);case 7:if(!(t=t.M()).every((function(e){return ee(e.type,53)})))throw Error("Expected XPath "+Jr(e)+" to resolve to a sequence of Nodes.");return t.map((function(e){return Oi(e.value,r,!1)}));case 11:if(1!==(t=t.M()).length)throw Error("Expected XPath "+Jr(e)+" to resolve to a single map.");if(!ee((t=t[0]).type,61))throw Error("Expected XPath "+Jr(e)+" to resolve to a map");return Uf(t,r).next(0).value;case 12:if(1!==(t=t.M()).length)throw Error("Expected XPath "+Jr(e)+" to resolve to a single array.");if(!ee((t=t[0]).type,62))throw Error("Expected XPath "+Jr(e)+" to resolve to an array");return Mf(t,r).next(0).value;case 13:return t.M().map((function(t){if(!ee(t.type,2))throw Error("Expected XPath "+Jr(e)+" to resolve to numbers");return t.value}));case 99:var o=t.value,a=null,i=!1,s=function(){for(;!i;){if(!a){var e=o.next(0);if(e.done){i=!0;break}a=kf(e.value,r)}return e=a.next(0),a=null,e}return Promise.resolve({done:!0,value:null})};return"asyncIterator"in Symbol?((t={})[Symbol.asyncIterator]=function(){return this},t.next=function(){return new Promise((function(e){return e(s())})).catch((function(t){zr(e,t)}))}):t={next:function(){return new Promise((function(e){return e(s())}))}},t;case 14:return t.M().map((function(e){return kf(e,r).next(0).value}));default:return(t=t.M()).every((function(e){return ee(e.type,53)&&!ee(e.type,47)}))?(t=t.map((function(e){return Oi(e.value,r,!1)})),1===t.length?t[0]:t):1===t.length?ee((t=t[0]).type,62)?Mf(t,r).next(0).value:ee(t.type,61)?Uf(t,r).next(0).value:Dt(t,r).first().value:Ut(ce.create(t),r).M().map((function(e){return e.value}))}}Gf[Gf.ANY]="ANY",Gf[Gf.NUMBER]="NUMBER",Gf[Gf.STRING]="STRING",Gf[Gf.BOOLEAN]="BOOLEAN",Gf[Gf.NODES]="NODES",Gf[Gf.FIRST_NODE]="FIRST_NODE",Gf[Gf.STRINGS]="STRINGS",Gf[Gf.MAP]="MAP",Gf[Gf.ARRAY]="ARRAY",Gf[Gf.NUMBERS]="NUMBERS",Gf[Gf.ALL_RESULTS]="ALL_RESULTS",Gf[Gf.ASYNC_ITERATOR]="ASYNC_ITERATOR";var Pf=!1,Hf=null,_f={getPerformanceSummary:function(){var e=Hf.getEntriesByType("measure").filter((function(e){return e.name.startsWith("XPath: ")}));return Array.from(e.reduce((function(e,t){var n=t.name.substring(7);return e.has(n)?((n=e.get(n)).times+=1,n.totalDuration+=t.duration):e.set(n,{xpath:n,times:1,totalDuration:t.duration,average:0}),e}),new Map).values()).map((function(e){return e.average=e.totalDuration/e.times,e})).sort((function(e,t){return t.totalDuration-e.totalDuration}))},setPerformanceImplementation:function(e){Hf=e},startProfiling:function(){if(null===Hf)throw Error("Performance API object must be set using `profiler.setPerformanceImplementation` before starting to profile");Hf.clearMarks(),Hf.clearMeasures(),Pf=!0},stopProfiling:function(){Pf=!1}},jf=0;function Xf(e,t,n,r,o,a){if(o=o||0,!e||"string"!=typeof e&&!("nodeType"in e))throw new TypeError("Failed to execute 'evaluateXPath': xpathExpression must be a string or an element depicting an XQueryX DOM tree.");a=a||{};try{var i=Df(e,t,n||null,r||{},a,{qa:"XQueryUpdate3.1"===a.language,aa:"XQuery3.1"===a.language||"XQueryUpdate3.1"===a.language,debug:!!a.debug,Ha:!!a.disableCache}),s=i.xb,u=i.zb,c=i.da}catch(t){zr(e,t)}if(c.I)throw Error("XUST0001: Updating expressions should be evaluated as updating expressions");if(3===o&&t&&"object"==typeof t&&"nodeType"in t&&(n=c.A(),t=be(t),null!==n&&!t.includes(n)))return!1;try{t=e,Pf&&("string"!=typeof t&&(t=Jr(t)),Hf.mark(t+(0===jf?"":"@"+jf)),jf++);var l=Ff(e,ur(c,s,u),o,u);return o=e,Pf&&("string"!=typeof o&&(o=Jr(o)),s=o+(0===--jf?"":"@"+jf),Hf.measure("XPath: "+o,s),Hf.clearMarks(s)),l}catch(t){zr(e,t)}}Object.assign(Xf,{Hc:14,ANY_TYPE:0,Pb:12,Qb:99,BOOLEAN_TYPE:3,Ub:9,hc:11,kc:7,oc:13,NUMBER_TYPE:1,rc:10,STRING_TYPE:2,Ic:"XPath3.1",Jc:"XQuery3.1",vc:"XQueryUpdate3.1"});var Lf={};function $f(e,t,n,r,o){return Xf(e,t,n,r,Xf.Qb,o)}function qf(e,t,n,r){var o={};return o.pendingUpdateList=e.fa.map((function(e){return e.h(r)})),o.xdmValue=Ff(t,ce.create(e.H),n,r),o}function Yf(e,t,n){switch(t.type){case 0:return[e,{type:0}];case 1:return[e,{type:1}];case 3:return[""+Yf(e+"("+(n||"contextItem")+")",t.i,n)[0],t.i];case 4:return[e,{type:4}];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.")}}function Vf(e,t,n){return{code:e,xa:t,isAstAccepted:!0,ta:n}}function Qf(e){return{isAstAccepted:!1,reason:e}}function Jf(e,t,n,r){switch(r=void 0===r?"contextItem":r,n.type){case 0:case 1:return Vf("!!"+e,{type:0},[t]);case 3:return(e=Jf(e+"("+r+")","",n.i,r)).isAstAccepted?Vf("!!"+e.code,e.xa,[t]):e;case 4:return Vf("(() => {\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(Xf,(Lf.ALL_RESULTS_TYPE=14,Lf.ANY_TYPE=0,Lf.ARRAY_TYPE=12,Lf.ASYNC_ITERATOR_TYPE=99,Lf.BOOLEAN_TYPE=3,Lf.FIRST_NODE_TYPE=9,Lf.MAP_TYPE=11,Lf.NODES_TYPE=7,Lf.NUMBERS_TYPE=13,Lf.NUMBER_TYPE=1,Lf.STRINGS_TYPE=10,Lf.STRING_TYPE=2,Lf.XPATH_3_1_LANGUAGE="XPath3.1",Lf.XQUERY_3_1_LANGUAGE="XQuery3.1",Lf.XQUERY_UPDATE_3_1_LANGUAGE="XQueryUpdate3.1",Lf));var Kf={DONE_TOKEN:z,getEffectiveBooleanValue:re,isSubtypeOf:ee,ready:W},zf={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"},Wf=Object.values(zf);function Zf(e,t,n,r,o){return e=Bo(e,n),(e=Bo(e,Wf))?(t+=n,n=c(r.yb(e,t,r)),r=n.next().value,n=n.next().value,r.isAstAccepted?0===o?[Jf(t,r.code,r.xa),null]:[Vf(t,r.xa,[r.code]),n]:[r,null]):[Qf("Unsupported: a base expression used with an operand."),null]}function ed(e,t,n){return 4===t&&(e+=".next().value"),47===n&&(e="(function () { const attr = "+e+"; return attr ? domFacade.getData(attr) : null})()"),e}function td(e,t,n,r,o){var a=Io(Bo(e,"firstOperand")[1],"type");if(e=Io(Bo(e,"secondOperand")[1],"type"),!a||!e)return Qf("Left or right type of compare are not found, annotation failed.");var i=[47,1];if(!i.includes(a.type)||!i.includes(e.type))return Qf("Unsupported types in compare: ["+fe[a.type]+", "+fe[e.type]+"]");if(!n.isAstAccepted)return n;if(!r.isAstAccepted)return r;if(!a||!e)return Qf("Operands in compare weren't annotated");if(!(i=new Map([["eqOp","==="],["neOp","!=="]])).has(t))return Qf(t+" not yet implemented");t=i.get(t),i=Yf(n.code,n.xa);var s=Yf(r.code,r.xa);return Vf("function "+o+"(contextItem) {\n\t\t\t\t"+n.ta.join("\n")+"\n\t\t\t \t"+r.ta.join("\n")+"\n\t \t \treturn "+ed(i[0],i[1].type,a.type)+" "+t+" "+ed(s[0],s[1].type,e.type)+";\n\t\t}",{type:3,i:{type:0}})}var nd={},rd=(nd.equalOp="eqOp",nd.notEqualOp="neOp",nd.lessThanOrEqualOp="leOp",nd.lessThanOp="ltOp",nd.greaterThanOrEqualOp="geOp",nd.greaterThanOp="gtOp",nd),od={"local-name":function(e,t,n){return sd(e,t,n,ad,"local-name()")},name:function(e,t,n){return sd(e,t,n,id,"name()")}};function ad(e){return"("+e+".localName || "+e+".target || '')"}function id(e){return"((("+e+".prefix || '').length !== 0 ? "+e+".prefix + ':' : '')\n\t\t+ ("+e+".localName || "+e+".target || ''))"}function sd(e,t,n,r,o){if(1===(e=Bo(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 Qf("Incorrect arg count for "+o+" function");if(o=e[1],e=(n=c(n.yb(o,"arg",n))).next().value,n.next(),n=e.isAstAccepted?Vf("arg",e.xa,[e.code]):e,"contextItemExpr"===o[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 = "+Yf(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 Vf(t,{type:3,i:{type:0}})}function ud(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function cd(e,t,n,r){var o=c(Zf(e,t,"firstOperand",n,0)),a=o.next().value;return o=o.next().value,a.isAstAccepted?(e=(n=c(Zf(e,t,"secondOperand",n,0))).next().value,n=n.next().value,e.isAstAccepted?[Vf("\n\tfunction "+t+"(contextItem) {\n\t\t"+a.ta.join("\n")+"\n\t\t"+e.ta.join("\n")+"\n\t\treturn "+a.code+" "+r+" "+e.code+";\n\t}\n\t",{type:3,i:{type:0}}),"&&"===r?la(o,n):o||n]:[e,null]):[a,null]}function ld(e){for(var t=[],n=0;n<arguments.length;++n)t[n]=arguments[n];return t.filter((function(e){return""!==e})).join(" && ")}function pd(e,t,n,r,o,a){var i=1!==n?"i"+n+" = 0;":"";return Vf("\n\t"+a+"\n\twhile ("+ld(o+n,"i"+n+" < "+o+n+".length")+") {\n\t\tconst contextItem"+n+" = "+o+n+"[i"+n+"];\n\t\tif (!("+(e=ld("contextItem"+n,e,t))+")) {\n\t\t\ti"+n+"++;\n\t\t\tcontinue;\n\t\t}\n\t\t"+r+"\n\t}\n\t"+i+"\n\t",{type:2},["let i"+n+" = 0;"])}function hd(e,t,n,r,o){return Vf("\n\t\t"+o+"\n\t\tif ("+(e=ld("i"+n+" === 0","contextItem"+n,e,t))+") {\n\t\t\t"+r+"\n\t\t}\n\t\t",{type:2},["let i"+n+" = 0;"])}var fd={tc:"textTest",Rb:"elementTest",ic:"nameTest",uc:"Wildcard"},dd=Object.values(fd);function md(e,t,n){if(null===t.namespaceURI&&"*"!==t.prefix){if(!(n=n.ba(t.prefix||"")||null)&&t.prefix)throw Error("XPST0081: The prefix "+t.prefix+" could not be resolved.");t.namespaceURI=n}n=t.prefix;var r=t.namespaceURI;t=t.localName;var o=e+".nodeType\n\t\t&& ("+e+".nodeType === /*ELEMENT_NODE*/ 1\n\t\t|| "+e+".nodeType === /*ATTRIBUTE_NODE*/ 2)";return"*"===n?"*"===t?[Vf(o,{type:0}),null]:[Vf(o+" && "+e+".localName === "+ud(t),{type:0}),"name-"+t]:[Vf((o="*"!==t?o+" && "+e+".localName === "+ud(t)+" && ":"")+"("+e+".namespaceURI || null) === (("+(n=""===n?e+".nodeType\n&& "+e+".nodeType === /*ELEMENT_NODE*/ 1 ? "+ud(r)+" : null":ud(r))+") || null)",{type:0}),"name-"+t]}function gd(e,t,n){var r=e[0];switch(r){case fd.Rb:return r=(e=Bo(e,"elementName"))&&Bo(e,"star"),null===e||r?t=[Vf(t+".nodeType === /*ELEMENT_NODE*/ 1",{type:0}),null]:t=md(t,e=Oo(Bo(e,"QName")),n),t;case fd.tc:return[Vf(t+".nodeType === /*TEXT_NODE*/ 3",{type:0}),null];case fd.ic:return md(t,Oo(e),n);case fd.uc:return Bo(e,"star")?null!==(r=Bo(e,"uri"))?t=md(t,{localName:"*",namespaceURI:To(r),prefix:""},n):(r=Bo(e,"NCName"),t="star"===Bo(e,"*")[0]?md(t,{localName:To(r),namespaceURI:null,prefix:"*"},n):md(t,{localName:"*",namespaceURI:null,prefix:To(r)},n)):t=md(t,{localName:"*",namespaceURI:null,prefix:"*"},n),t;default:return[Qf("Unsupported: the test '"+r+"'."),null]}}function yd(e,t,n){var r=e[0];switch(r){case zf.qc:r="",Bo(e,"rootExpr")&&(r="\n\t\tlet documentNode = contextItem;\n\t\twhile (documentNode.nodeType !== /*DOCUMENT_NODE*/9) {\n\t\t\tdocumentNode = domFacade.getParentNode(documentNode);\n\t\t\tif (documentNode === null) {\n\t\t\t\tthrow new Error('XPDY0050: the root node of the context node is not a document node.');\n\t\t\t}\n\t\t}\n\t\tcontextItem = documentNode;\n\t\t");var o=c(function(e,t){if(0===e.length)return[Vf("\n\t\t\tif (!hasReturned) {\n\t\t\t\thasReturned = true;\n\t\t\t\treturn ready(contextItem);\n\t\t\t}\n\t\t\t",{type:2},["let hasReturned = false;"]),null];for(var n="",r=[],o=null,a=e.length-1;0<=a;a--){var i=e[a],s=a+1,u=Bo(i,"predicates");e:{var l=t,h="",f=[];if(u){u=So(u,"*");for(var d=null,m=0;m<u.length;m++){var g="step"+s+"_predicate"+m,y=c(l.yb(u[m],g,l)),v=y.next().value;if(y=y.next().value,!v.isAstAccepted){l=[v,null];break e}if(d=la(d,y),!(g=Jf(g,"",v.xa,"contextItem"+s)).isAstAccepted){l=[g,null];break e}h=0===m?h+g.code:h+" && "+g.code,f.push(v.code)}l=[Vf(h,{type:0},f),d]}else l=[Vf("",{type:5},f),null]}if(l=(h=c(l)).next().value,f=h.next().value,!l.isAstAccepted)return[l,null];if(!(h=Bo(i,"xpathAxis")))return[Qf("Unsupported: filter expressions."),null];if(!(u=Bo(i,dd)))return[Qf("Unsupported: the test in the '"+i+"' step."),null];if(n=a===e.length-1?"i"+s+"++;\n\t\t\t\t\t return ready(contextItem"+s+");":n+"\n\t\t\t\t\t i"+s+"++;",u=(d=c(gd(u,"contextItem"+s,t))).next().value,d=d.next().value,!u.isAstAccepted)return[u,null];f=la(d,f);e:switch(u=u.code,d=l.code,h=To(h),h){case"attribute":s=[pd(u,d,s,n,"attributeNodes","\n\tlet attributeNodes"+s+";\n\tif (contextItem && contextItem"+(s-1)+".nodeType === /*ELEMENT_NODE*/ 1) {\n\t\tattributeNodes"+s+" = domFacade.getAllAttributes(contextItem"+(s-1)+" "+(f?', "'+f+'"':"")+");\n\t}\n\t"),"type-1"];break e;case"child":s=[pd(u,d,s,n,"childNodes","const childNodes"+s+" = domFacade.getChildNodes(contextItem"+(s-1)+" "+(f?', "'+f+'"':"")+");"),null];break e;case"parent":s=[hd(u,d,s,n,"\n\tconst contextItem"+s+" = domFacade.getParentNode(contextItem"+(s-1)+" "+(f?', "'+f+'"':"")+");\n\t"),null];break e;case"self":s=[hd(u,d,s,n,"const contextItem"+s+" = contextItem"+(s-1)+";"),f];break e;default:s=[Qf("Unsupported: the "+h+" axis"),null]}if(s=(n=c(s)).next().value,n=n.next().value,!s.isAstAccepted)return[s,null];if(0===a&&(o=n),r.push.apply(r,[].concat(p(s.ta),p(l.ta))),n=s.code,0<So(i,"lookup").length)return[Qf("Unsupported: lookups."),null]}return[Vf("const contextItem0 = contextItem;"+n,{type:2},r),o]}(So(e,"stepExpr"),n));return e=o.next().value,o=o.next().value,e.isAstAccepted?[Vf("\n\tfunction "+t+"(contextItem) {\n\t\t"+r+"\n\t\t"+e.ta.join("\n")+"\n\t\tconst next = () => {\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}}),o]:[e,null];case zf.Ob:return cd(e,t,n,"&&");case zf.pc:return cd(e,t,n,"||");case zf.sc:return[Vf("const "+t+" = "+(e=ud(e=Bo(e,"value")[1]||""))+";",{type:1}),null];case zf.Sb:case zf.nc:case zf.dc:case zf.cc:case zf.Yb:case zf.Xb:case zf.Tb:case zf.jc:case zf.fc:case zf.ec:case zf.Zb:case zf.Wb:case zf.ac:case zf.mc:case zf.lc:e:{var a=c(Zf(e,t,"firstOperand",n));if(o=a.next().value,a.next(),o.isAstAccepted)if(n=(a=c(Zf(e,t,"secondOperand",n))).next().value,a.next(),n.isAstAccepted)switch(r){case"eqOp":case"neOp":case"ltOp":case"leOp":case"gtOp":case"geOp":case"isOp":t=td(e,r,o,n,t);break e;case"equalOp":case"notEqualOp":case"lessThanOrEqualOp":case"lessThanOp":case"greaterThanOrEqualOp":case"greaterThanOp":a=Io(e,"type");var i=Io(e,"type");t=a&&i?3===a.g&&3===i.g?td(e,rd[r],o,n,t):Qf("generalCompare with sequences is still in development"):Qf("types of compare are not known");break e;default:t=Qf("Unsupported compare type")}else t=n;else t=o}return[t,null];case zf.Vb:return r=To(Bo(e,"functionName")),[void 0!==od[r]?od[r](e,t,n):Qf("Unsupported function: "+r),null];default:return[Qf("Unsupported: the base expression '"+r+"'."),null]}}function vd(e,t,n){var r=Bo(e,"mainModule");if(!r)return Qf("Unsupported: Can not execute a library module.");if(Bo(r,"prolog"))return Qf("Unsupported: XQuery.");r=Co(r,["queryBody","*"]),n.yb=yd;var o=c(yd(r,"compiledXPathExpression",n));return n=o.next().value,o.next(),!1===n.isAstAccepted?n:(o=n.ta?n.ta.join("\n"):"",r=Io(r,"type"),t=function(e,t,n){switch(e){case 9:if(e=(n=c(Yf("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 Vf("\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(Yf("compiledXPathExpression",t))).next().value,4!==n.next().value.type?Qf("Return type was not an iterator"):Vf("\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=Jf("compiledXPathExpression","",t)).isAstAccepted?Vf("return "+n.code+";",{type:2}):n;case 2:return n=void 0===n?Qf("Full AST wasn't annotated so we cannot correctly emit a string return"):ee(n,1)||ee(n,47)?Vf("return "+ed(e=(t=c(Yf("compiledXPathExpression",t))).next().value,(t=t.next().value).type,n)+" || '';",{type:2}):Qf("Not implemented: returning anything but strings and attributes from codegen");default:return Qf("Unsupported: the return type '"+e+"'.")}}(t,n.xa,r?r.type:void 0),!1===t.isAstAccepted?t:(t=o+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;",wd(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}))}function wd(e){var t=So(e,"*");if("pathExpr"===e[0])return!0;for(t=(e=c(t)).next();!t.done;t=e.next())if(wd(t.value))return!0;return!1}var Ad={},xd=(Ad["http://www.w3.org/2005/XQueryX"]="xqx",Ad["http://www.w3.org/2007/xquery-update-10"]="xquf",Ad["http://fontoxml.com/fontoxpath"]="x",Ad);function bd(e,t,n,r,o){if("string"==typeof n)return 0===n.length?null:t.createTextNode(n);if(!Array.isArray(n))throw new TypeError("JsonML element should be an array or string");var a=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"}}}(n[0],r);r=a.rb,a=t.createElementNS(r,xd[r]+":"+a.localName);var i=n[1],s=1;if("object"==typeof i&&!Array.isArray(i)){if(null!==i)for(var u=(s=c(Object.keys(i))).next();!u.done;u=s.next()){var l=i[u=u.value];null!==l&&("type"===u?void 0!==l&&e.setAttributeNS(a,r,"fontoxpath:"+u,me(l)):o&&"prefix"===u&&""===l||e.setAttributeNS(a,r,xd[r]+":"+u,l))}s=2}for(i=s,s=n.length;i<s;++i)null!==(u=bd(e,t,n[i],r,o))&&e.insertBefore(a,u,null);return a}function Ed(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.map((function(e){return e.startsWith(" ")||e.startsWith("\t")?e:" "+e})),r=r.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 Nd(e,t,n){return 0===t.g?e.G()?null:kf(e.first(),n).next(0).value:2===t.g||1===t.g?e.M().map((function(e){if(ee(e.type,47))throw Error("Cannot pass attribute nodes to custom functions");return kf(e,n).next(0).value})):kf(e.first(),n).next(0).value}y(Ed,Error);var Bd=new Map;function Td(e){var t;e:{if(t=Ts.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(Bd.has(e))return Bd.get(e);if(null===(t=Co(t="string"==typeof e?hf(e,{aa:!1}):Ss(e),["mainModule","queryBody","*"])))throw Error("Library modules do not have a specificity");return t=Bs(t,{qa:!1,aa:!1}),Bd.set(e,t),t}var Id=new Ee;return void 0!==n&&(n.compareSpecificity=function(e,t){return br(Td(e).s,Td(t).s)},n.compileXPathToJavaScript=function(e,t,n){n=n||{},t=t||0,"string"==typeof e?e=hf(e=Us(e),{aa:"XQuery3.1"===n.language||"XQueryUpdate3.1"===n.language,debug:!1}):e=Ss(e);var r=Bo(e,"mainModule");return r?Bo(r,"prolog")?Qf("Unsupported: XQuery Prologs are not supported."):(Qo(e,n=new na(new yo(new oo((r={ba:n.namespaceResolver||Of(null)}).ba,{},void 0===n.defaultFunctionNamespaceURI?"http://www.w3.org/2005/xpath-functions":n.defaultFunctionNamespaceURI,n.functionNameResolver||Rf("http://www.w3.org/2005/xpath-functions"))))),vd(e,t,r)):Qf("Unsupported: XQuery Library modules are not supported.")},n.domFacade=Id,n.evaluateXPath=Xf,n.evaluateXPathToArray=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.Pb,o)},n.evaluateXPathToAsyncIterator=$f,n.evaluateXPathToBoolean=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.BOOLEAN_TYPE,o)},n.evaluateXPathToFirstNode=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.Ub,o)},n.evaluateXPathToMap=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.hc,o)},n.evaluateXPathToNodes=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.kc,o)},n.evaluateXPathToNumber=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.NUMBER_TYPE,o)},n.evaluateXPathToNumbers=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.oc,o)},n.evaluateXPathToString=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.STRING_TYPE,o)},n.evaluateXPathToStrings=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.rc,o)},n.evaluateUpdatingExpression=function(e,t,n,r,o){var a,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,o){!function e(a){a.done?r(a.value):Promise.resolve(a.value).then(t,n).then(e,o)}(e.next())}))}(new N(new x((function(m){switch(m.h){case 1:o=o||{};try{u=Df(e,t,n||null,r||{},o||{},{qa:!0,aa:!0,debug:!!o.debug,Ha:!!o.disableCache}),a=u.xb,i=u.zb,s=u.da}catch(t){zr(e,t)}if(s.I){m.h=2;break}c=[];var g=(l=$f(e,t,n,r,Object.assign(Object.assign({},o),{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(a,i),f=d.next(0)}catch(t){zr(e,t)}return m.return(qf(f.value,e,o.returnType,i))}}))))},n.evaluateUpdatingExpressionSync=function(e,t,n,r,o){o=o||{};try{var a=Df(e,t,n||null,r||{},o||{},{qa:!0,aa:!0,debug:!!o.debug,Ha:!!o.disableCache}),i=a.xb,s=a.zb,u=a.da}catch(t){zr(e,t)}if(!u.I)return i={},(s={}).pendingUpdateList=[],s.xdmValue=Xf(e,t,n,r,o.i,Object.assign(Object.assign({},o),(i.language=Xf.vc,i))),s;try{var c=u.u(i,s).next(0)}catch(t){zr(e,t)}return qf(c.value,e,o.returnType,s)},n.executeJavaScriptCompiledXPath=function(e,t,n){return n=n||new Ee,e()(t,n,Kf)},n.executePendingUpdateList=function(e,t,n,r){t=new Se(t||new Ee),r=r?new Te(r):Be,n=n?n=new Cf(n):null,fr(e=e.map(os),t,n,r)},n.getBucketForSelector=function(e){return Td(e).A()},n.getBucketsForNode=be,n.precompileXPath=function(e){return Promise.resolve(e)},n.registerXQueryModule=function(e,t){if(Vo(t=hf(e,{aa:!0,debug:(t=void 0===t?{debug:!1}:t).debug}),new na(void 0)),!(t=Bo(t,"libraryModule")))throw Error("XQuery module must be declared in a library module.");var n=Bo(t,"moduleDecl"),r=Bo(n,"uri"),o=To(r);if(r=To(n=Bo(n,"prefix")),xo(n=new yo(new oo((function(){return null}),Object.create(null),"http://www.w3.org/2005/xpath-functions",Rf("http://www.w3.org/2005/xpath-functions"))),r,o),null!==(t=Bo(t,"prolog"))){try{var a=df(t,n)}catch(t){zr(e,t)}a.Ma.forEach((function(e){if(o!==e.namespaceURI)throw Error("XQST0048: Functions and variables declared in a module must reside in the module target namespace.")})),Rs(o,a)}else Rs(o,{Ma:[],Ua:[]});return o},n.registerCustomXPathFunction=function(e,t,n,r){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=ro[e];if(!n){if(n="generated_namespace_uri_"+e,ro[e])throw Error("Prefix already registered: Do not register the same prefix twice.");ro[e]=n}return{localName:t,namespaceURI:n}}(e);var o=e.namespaceURI,a=e.localName;if(!o)throw co();var i=t.map((function(e){return ye(e)})),s=ye(n);to(o,a,i,s,(function(e,t,n){var u=Array.from(arguments);u.splice(0,3),u=u.map((function(e,n){return Nd(e,i[n],t)}));var c={};c.currentContext=t.u,c.domFacade=t.h.h;try{var l=r.apply(void 0,[c].concat(p(u)))}catch(e){throw new Ed(e,a,o)}return l&&"object"==typeof l&&Object.getOwnPropertySymbols(l).includes(Sf)?ce.create(l.Db):wt(t.h,l,s)}))},n.parseScript=function(e,t,n,r){r=void 0===r?Be:r;var o=hf(e=Us(e),{aa:"XQuery3.1"===t.language||"XQueryUpdate3.1"===t.language,debug:t.debug}),a=new oo(t.namespaceResolver||function(){return null},{},void 0===t.defaultFunctionNamespaceURI?"http://www.w3.org/2005/xpath-functions":t.defaultFunctionNamespaceURI,t.functionNameResolver||function(){return null});a=new yo(a);var i=Bo(o,["mainModule","libraryModule"]),s=Bo(i,"moduleDecl");return s&&xo(a,To(Bo(s,"prefix")),s=To(Bo(s,"uri"))),(i=Bo(i,"prolog"))&&df(i,a,!1),!1!==t.annotateAst&&Vo(o,new na(a)),a=new Ee,t=bd(r,n,o,null,!1===t.Kc),r.insertBefore(t,n.createComment(e),a.getFirstChild(t)),t},n.profiler=_f,n.createTypedValueFactory=function(e){return function(t,n){return t=vt(new Se(null===n?new Ee:n),t,ye(e)),(n={})[Sf]=!0,n.Db=t,n}},n.Language={XPATH_3_1_LANGUAGE:"XPath3.1",XQUERY_3_1_LANGUAGE:"XQuery3.1",XQUERY_UPDATE_3_1_LANGUAGE:"XQueryUpdate3.1"},n.ReturnType=Gf),n}.call("undefined"==typeof window?void 0:window,be,_e);je.compareSpecificity,je.compileXPathToJavaScript,je.createTypedValueFactory,je.domFacade,je.evaluateUpdatingExpression,je.evaluateUpdatingExpressionSync;const Xe=je.evaluateXPath;je.evaluateXPathToArray,je.evaluateXPathToAsyncIterator;const Le=je.evaluateXPathToBoolean,$e=je.evaluateXPathToFirstNode;je.evaluateXPathToMap;const qe=je.evaluateXPathToNodes,Ye=je.evaluateXPathToNumber;je.evaluateXPathToNumbers;const Ve=je.evaluateXPathToString,Qe=je.evaluateXPathToStrings;je.executeJavaScriptCompiledXPath,je.executePendingUpdateList,je.getBucketForSelector;const Je=je.getBucketsForNode;je.Language;const Ke=je.parseScript;je.precompileXPath,je.profiler;const ze=je.registerCustomXPathFunction,We=je.registerXQueryModule;je.ReturnType;class Ze{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||Je(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||Je(n).includes(t))return this._onNodeTouched(n),n;return null}getLastChild(e,t){const n=e.getChildNodes().filter((e=>!t||Je(e).includes(t))),r=n[n.length-1];return r||null}getNextSibling(e,t){for(let n=e.nextSibling;n;n=n.nextSibling)if(Je(n).includes(t))return this._onNodeTouched(n),n;return null}getParentNode(e){return e.parentNode}getPreviousSibling(e,t){for(let{previousSibling:n}=e;n;n=n.previousSibling)if(Je(n).includes(t))return n;return null}}class et{static getParentBindingElement(e){return e.parentNode&&e.parentNode.nodeType!==Node.DOCUMENT_NODE?e.parentNode.hasAttribute("ref")?e.parentNode:et.getParentBindingElement(e.parentNode):null}static isAbsolutePath(e){return null!=e&&(e.startsWith("/")||e.startsWith("instance("))}static isSelfReference(e){return"."===e||"./text()"===e||"text()"===e||""===e||null===e}static getDefaultInstance(e){const t=et.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 et.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=Ve("path()",e);return et.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 tt(e,t,n,r){const o={};return function(a){if(o[a])return;const i={},s=[],u=[];for(u.push({node:a,processed:!1});u.length>0;){const a=u[u.length-1],{processed:c}=a,{node:l}=a;if(c)u.pop(),s.pop(),i[l]=!1,o[l]=!0,t&&0!==e[l].length||n.push(l);else{if(o[l]){u.pop();continue}if(i[l]){if(r){u.pop();continue}throw s.push(l),window.dispatchEvent(new CustomEvent("compute-exception",{composed:!1,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});a.processed=!0}}}}function nt(e){this.nodes={},this.outgoingEdges={},this.incomingEdges={},this.circular=e&&!!e.circular}nt.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 nt;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=[];tt(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=[];tt(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=tt(this.outgoingEdges,!1,[],this.circular);r.forEach((t=>{e(t)}))}const o=tt(this.outgoingEdges,e,n,this.circular);return r.filter((e=>0===t.incomingEdges[e].length)).forEach((e=>{o(e)})),this.circular&&r.filter((e=>-1===n.indexOf(e))).forEach((e=>o(e))),n}},nt.prototype.directDependentsOf=nt.prototype.directDependantsOf,nt.prototype.dependentsOf=nt.prototype.dependantsOf;class rt{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=[],t="0123456789abcdef";for(let n=0;n<36;n+=1)e[n]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.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 rt.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){return rt.UI_ELEMENTS.includes(e),rt.UI_ELEMENTS.includes(e)}static async refreshChildren(e,t){return new Promise((n=>{const{children:r}=e;r&&Array.from(r).forEach((e=>{"FX-FORE"===e.nodeName.toUpperCase()&&n("done"),rt.isUiElement(e.nodeName)&&"function"==typeof e.refresh?e.refresh():"FX-MODEL"!==e.nodeName.toUpperCase()&&rt.refreshChildren(e,t)})),n("done")}))}static getClosest(e,t){for(;!t.matches(e);){if(t.matches("fx-fore"))return null;if(!(t=t.parentNode))return null}return 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,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:!1,bubbles:!0,detail:n});console.log("dispatching",r),e.dispatchEvent(r)}static prettifyXml(e){const t=(new DOMParser).parseFromString(e,"application/xml"),n=(new DOMParser).parseFromString(['<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">',' <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>',' <xsl:strip-space elements="*"/>',' <xsl:template match="text()">',' <xsl:value-of select="normalize-space(.)"/>'," </xsl:template>",' <xsl:template match="node()|@*">'," <xsl:copy>",' <xsl:apply-templates select="node()|@*"/>'," </xsl:copy>"," </xsl:template>","</xsl:stylesheet>"].join("\n"),"application/xml"),r=new XSLTProcessor;r.importStylesheet(n);const o=r.transformToDocument(t);return(new XMLSerializer).serializeToString(o)}static formatXml(e){for(var t=(e=e.replace(/(>)(<)(\/*)/g,"$1\n$2$3").replace(/ *(.*) +\n/g,"$1\n").replace(/(<.+>)(.+\n)/g,"$1\n$2")).split("\n"),n=0;n<t.length;n++){var r=t[n];Boolean(r.match(/<.+\/>/)),Boolean(r.match(/<\/.+>/)),Boolean(r.match(/<[^!].*>/))}}static async loadForeFromUrl(e,t){console.log("########## loading Fore from ",this.src,"##########"),await fetch(t,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":"text/html"}}).then((e=>{const t=e.headers.get("content-type").toLowerCase();return console.log("********** responseContentType *********",t),t.startsWith("text/html")?e.text().then((e=>(new DOMParser).parseFromString(e,"text/html"))):"done"})).then((t=>{const n=t.querySelector("fx-fore");n||e.dispatchEvent(new CustomEvent("error",{composed:!1,bubbles:!0,detail:{message:"cyclic graph"}})),e.appendChild(n),n.classList.add("widget")})).catch((n=>{e.dispatchEvent(new CustomEvent("error",{composed:!1,bubbles:!0,detail:{error:n,message:`'${t}' not found or does not contain Fore element.`}}))}))}}rt.READONLY_DEFAULT=!1,rt.REQUIRED_DEFAULT=!1,rt.RELEVANT_DEFAULT=!0,rt.CONSTRAINT_DEFAULT=!0,rt.TYPE_DEFAULT="xs:string";const ot="http://www.w3.org/2002/xforms",at=new Map,it=[];function st(e,t,n){return at.has(e)?at.get(e).set(t,n):at.set(e,new Map)}const ut=e=>{if(!e)return"http://www.w3.org/1999/xhtml"};function ct(e,t,n=null){const r=qe("outermost(ancestor-or-self::fx-fore[1]/(descendant::fx-fore|descendant::*[@id = $id]))[not(self::fx-fore)]",t,null,{id:e},{namespaceResolver:ut});if(0===r.length)return null;if(1===r.length&&Le("(ancestor::fx-fore | ancestor::fx-repeat)[last()]/self::fx-fore",r[0],null,null,{namespaceResolver:ut})){const e=r[0];return n&&e.localName!==n?null:e}for(const e of qe("ancestor::fx-repeatitem => reverse()",t,null,null,{namespaceResolver:ut})){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=>qe("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 lt=(new DOMParser).parseFromString("<xml />","text/xml");function pt(e,t){const n=(r=e,o=t,at.has(r)&&at.get(r).get(o)||null);var r,o;if(n)return n;const a=Ke(e,{},lt);let i=Qe('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',a,null,{},{namespaceResolver:e=>"xqx"===e?"http://www.w3.org/2005/XQueryX":void 0});if(0===i.length){const n=$e("ancestor::*[@ref][1]",t);if(n){const r=pt(n.getAttribute("ref"),n);return st(e,t,r),r}i=["default"]}if(1===i.length){let n;if("default"===i[0]){const e=$e("ancestor-or-self::fx-fore[1]",t,null,null,{namespaceResolver:ut});n=e&&e.querySelector("fx-instance")}else n=ct(i[0],t,"fx-instance");if(n&&n.hasAttribute("xpath-default-namespace")){const r=n.getAttribute("xpath-default-namespace"),o=e=>{if(!e)return r};return st(e,t,o),o}}i.length>1&&console.warn(`More than one instance is used in the query "${e}". The default namespace resolving will be used`);const s=Ve("ancestor-or-self::*/@xpath-default-namespace[last()]",t)||"",u=function(e){return""===e?s:Ve('ancestor-or-self::*/@*[name() = "xmlns:" || $prefix][last()]',t,null,{prefix:e})};return st(e,t,u),u}function ht(e,t,n){return(t&&t.ownerDocument||t)===window.document?ut:pt(e,n)}function ft({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"parse":case"logtree":return{namespaceURI:ot,localName:t};default:return""===e&&it.includes(t)?{namespaceURI:"http://www.w3.org/2005/xquery-local-functions",localName:t}:"fn"===e||""===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 dt(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 mt(e,t,n,r={},o={}){const a=ht(e,t,n),i=dt(n);return Xe(e,t,null,{...i,...r},Xe.ALL_RESULTS_TYPE,{currentContext:{formElement:n,variables:r},moduleImports:{xf:ot},functionNameResolver:ft,namespaceResolver:a,language:o.language||mt.XPATH_3_1})}function gt(e,t,n){const r=ht(e,t,n),o=dt(n);return $e(e,t,null,o,{defaultFunctionNamespaceURI:ot,moduleImports:{xf:ot},currentContext:{formElement:n},functionNameResolver:ft,namespaceResolver:r})}function yt(e,t,n){const r=ht(e,t,n),o=dt(n);return qe(e,t,null,o,{currentContext:{formElement:n},functionNameResolver:ft,moduleImports:{xf:ot},namespaceResolver:r})}function vt(e,t,n){const r=ht(e,t,n),o=dt(n);return Le(e,t,null,o,{currentContext:{formElement:n},functionNameResolver:ft,moduleImports:{xf:ot},namespaceResolver:r})}function wt(e,t,n,r=null,o=n){const a=ht(e,t,n),i=dt(n);return Ve(e,t,r,i,{currentContext:{formElement:n},functionNameResolver:ft,moduleImports:{xf:ot},namespaceResolver:a})}function At(e,t,n,r=null,o=n){const a=ht(e,t,n),i=dt(n);return Ye(e,t,r,i,{currentContext:{formElement:n},functionNameResolver:ft,moduleImports:{xf:ot},namespaceResolver:a})}const xt=(e,t)=>{const n=e.currentContext.formElement;if(t){const e=ct(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=et.getParentBindingElement(n);return r?r.nodeset:n.getInScopeContext()};function bt(e,t){if(t&&t.nodeType===Node.ELEMENT_NODE&&t.children){const n=document.createElement("details");n.setAttribute("data-path",t.nodeName);const r=document.createElement("summary");let o,a=` <${t.nodeName}`;Array.from(t.attributes).forEach((e=>{a+=` ${e.nodeName}="${e.nodeValue}"`})),t.firstChild&&t.firstChild.nodeType===Node.TEXT_NODE&&""!==t.firstChild.data.trim()?(o=t.firstChild.nodeValue,a+=`>${o}</${t.nodeName}>`):a+=">",r.textContent=a,n.appendChild(r),0!==t.childElementCount?n.setAttribute("open","open"):r.setAttribute("style","list-style:none;"),e.appendChild(n),Array.from(t.children).forEach((e=>{bt(n,e)}))}}ze({namespaceURI:ot,localName:"context"},[],"item()?",xt),ze({namespaceURI:ot,localName:"context"},["xs:string"],"item()?",xt),ze({namespaceURI:ot,localName:"current"},["xs:string"],"item()?",((e,t)=>(e.currentContext.formElement,null))),ze({namespaceURI:ot,localName:"log"},["xs:string?"],"xs:string?",((e,t)=>{const{formElement:n}=e.currentContext,r=ct(t,n,"fx-instance");if(r){if("json"!==r.getAttribute("type")){const e=(new XMLSerializer).serializeToString(r.getDefaultContext());return rt.prettifyXml(e)}console.warn("log() does not work for JSON yet")}return null})),ze({namespaceURI:ot,localName:"parse"},["xs:string?"],"element()?",((e,t)=>{const n=(new DOMParser).parseFromString(t,"application/xml");return console.log("parse",n),n.firstElementChild})),ze({namespaceURI:ot,localName:"logtree"},["xs:string?"],"element()?",((e,t)=>{const{formElement:n}=e.currentContext,r=ct(t,n,"fx-instance");if(r){const t=document.createElement("div");t.setAttribute("class","logtree");const n=e.currentContext.formElement,o=n.querySelector(".logtree");o&&o.parentNode.removeChild(o);const a=bt(t,r.getDefaultContext());a&&n.appendChild(a)}return null}));const Et=(e,t)=>{const n=$e("ancestor-or-self::fx-fore[1]",e.currentContext.formElement,null,null,{namespaceResolver:ut}),r=t?ct(t,n,"fx-instance"):n.querySelector("fx-instance");if(r){return r.getDefaultContext()}return null};ze({namespaceURI:ot,localName:"index"},["xs:string?"],"xs:integer?",((e,t)=>{const{formElement:n}=e.currentContext;if(null===t)return 1;const r=ct(t,n,"fx-repeat");return r?r.getAttribute("index"):Number(1)})),ze({namespaceURI:ot,localName:"instance"},[],"item()?",(e=>Et(e,null))),ze({namespaceURI:ot,localName:"instance"},["xs:string?"],"item()?",Et),ze({namespaceURI:ot,localName:"depends"},["node()*"],"item()?",((e,t)=>t[0])),ze({namespaceURI:ot,localName:"event"},["xs:string?"],"item()?",((e,t)=>{if(!t)return[];if(e.currentContext.variables){const n=e.currentContext.variables[t];if(n.nodeType&&console.log("got some node as js object"),n)return e.currentContext.variables[t]}return e.currentContext.formElement.inScopeVariables?(console.log("event()",e.currentContext.formElement.inScopeVariables),console.log("event()",e.currentContext.formElement.inScopeVariables.get(t)),e.currentContext.formElement.inScopeVariables.get(t)):[]})),We(`\n module namespace xf="${ot}";\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`),ze({namespaceURI:ot,localName:"base64encode"},["xs:string?"],"xs:string?",((e,t)=>btoa(t)));class Nt 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 <style>\n \n :host {\n display: none;\n }\n :host * {\n display:none;\n }\n ::slotted(*){\n display:none;\n }\n \n </style>\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 gt(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("<data></data>","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("<data></data>","application/xml");this.instanceData=e}"json"===this.type&&(this.instanceData={})}async _loadData(){const e=`${this.src}`,t=rt.getContentType(this,"get");await fetch(e,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":t}}).then((e=>{const{status:t}=e;if(t>=400)throw console.log("response status",t),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 console.log("********** responseContentType *********",n),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=>{if(e.nodeType)return this.instanceData=e,void console.log("instanceData loaded: ",this.instanceData);this.instanceData=e})).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):"html"===this.type?this.instanceData=this.firstElementChild.children:"text"===this.type?this.instanceData=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.get("fx-instance")||customElements.define("fx-instance",Nt);class Bt{constructor(e,t,n,r,o,a,i,s,u){this.path=e,this.ref=t,this.constraint=a,this.readonly=n,this.relevant=r,this.required=o,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){console.log("modelitem.setvalue oldVal",this.value),console.log("modelitem.setvalue newVal",e),e.nodeType===Node.DOCUMENT_NODE?this.node.replaceWith(e.firstElementChild):e.nodeType===Node.ELEMENT_NODE?this.node.replaceWith(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 Tt 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 <slot></slot>\n ",this.addEventListener("model-construct-done",(()=>{this.modelConstructed=!0}),{once:!0}),this.skipUpdate=!1}static lazyCreateModelItem(e,t,n){let r,o={};if(null==n)return null;o=n.nodeType===n.TEXT_NODE?n.parentNode:n,n.nodeType?r=et.getPath(n):(r=null,o=n);const a=new Bt(r,t,rt.READONLY_DEFAULT,rt.RELEVANT_DEFAULT,rt.REQUIRED_DEFAULT,rt.CONSTRAINT_DEFAULT,rt.TYPE_DEFAULT,o,this);return e.registerModelItem(a),a}modelConstruct(){this.dispatchEvent(new CustomEvent("model-construct",{composed:!1,bubbles:!0,detail:{model:this}})),console.time("instance-loading");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),this.updateModel(),this.inited=!0,this.dispatchEvent(new CustomEvent("model-construct-done",{composed:!1,bubbles:!0,detail:{model:this}}))})),console.groupEnd()}else this.dispatchEvent(new CustomEvent("model-construct-done",{composed:!1,bubbles:!0,detail:{model:this}}));console.timeEnd("instance-loading"),this.inited=!0}registerModelItem(e){this.modelItems.push(e)}updateModel(){this.rebuild(),this.skipUpdate||(this.recalculate(),this.revalidate())}rebuild(){console.group("### rebuild"),console.time("rebuild"),this.mainGraph=new nt(!1),this.modelItems=[];const e=this.querySelectorAll("fx-model > fx-bind");0!==e.length?(e.forEach((e=>{e.init(this)})),console.log("rebuild mainGraph",this.mainGraph),console.log("rebuild mainGraph calc order",this.mainGraph.overallOrder()),this.dispatchEvent(new CustomEvent("rebuild-done",{detail:{maingraph:this.mainGraph}})),console.groupEnd()):this.skipUpdate=!0}recalculate(){if(this.mainGraph){if(console.group("### recalculate"),console.log("changed nodes ",this.changed),console.time("recalculate"),this.computes=0,this.subgraph=new nt(!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=[],console.log("subgraph",this.subgraph),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)}))}console.log(`recalculated ${this.computes} modelItems`),console.timeEnd("recalculate"),console.log(`recalculate finished with modelItems ${this.modelItems.length} item(s)`,this.modelItems),console.groupEnd()}}compute(e,t){const n=this.getModelItem(e);if(n&&t.includes(":")){const e=t.split(":")[1];if(e)if("calculate"===e){const t=mt(n.bind[e],n.node,this);n.value=t,n.readonly=!0}else if("constraint"!==e&&"type"!==e){const r=n.bind[e];if(r){const o=vt(r,n.node,this);n[e]=o,console.log(`recalculating path ${t} - Expr:'${r}' computed`,n[e])}}this.computes+=1}}revalidate(){if(0===this.modelItems.length)return!0;console.group("### revalidate"),console.time("revalidate");let e=!0;return this.modelItems.forEach((t=>{const{bind:n}=t;if(n){if("function"==typeof n.hasAttribute&&n.hasAttribute("constraint")){const r=n.getAttribute("constraint");if(r){const o=vt(r,t.node,this);if(console.log("modelItem validity computed: ",o),t.constraint=o,this.formElement.addToRefresh(t),o||(e=!1),!this.modelConstructed){const e=n.getAlert();e&&t.addAlert(e)}}}if("function"==typeof n.hasAttribute&&n.hasAttribute("required")){const r=n.getAttribute("required");if(r){const n=vt(r,t.node,this);console.log("modelItem required computed: ",n),t.required=n,this.formElement.addToRefresh(t),t.node.textContent||(e=!1)}}}})),console.timeEnd("revalidate"),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 It(e){return e.closest("fx-fore")}function Ct(e,t){const n=rt.getClosest("[ref]",e),r=rt.getClosest("fx-fore",e),o=function(e){return It(e).getModel()}(e);if(null!==n){return r===n.closest("fx-fore")?n.nodeset:o.getDefaultInstance().getDefaultContext()}if(et.isAbsolutePath(t)){const e=et.getInstanceId(t);return e?o.getInstance(e).getDefaultContext():o.getDefaultInstance().getDefaultContext()}return null!==o.getDefaultInstance()&&o.inited?o.getDefaultInstance().getDefaultContext():[]}function St(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=rt.getClosest("fx-repeatitem",n);if(r)return"context"===e.nodeName?gt(e.nodeValue,r.nodeset,It(n)):r.nodeset;if(n.hasAttribute("context")){const e=Ct(n.parentNode,t);return gt(n.getAttribute("context"),e,It(n))}if(e.nodeType===Node.ATTRIBUTE_NODE&&"context"===e.nodeName){const r=Ct(e.ownerElement.parentNode,t);return gt(e.ownerElement.getAttribute("context"),r,It(n))}if(e.nodeType===Node.ATTRIBUTE_NODE&&"ref"===e.nodeName){if(e.ownerElement.hasAttribute("context")){const r=Ct(e.ownerElement.parentNode,t);return gt(e.ownerElement.getAttribute("context"),r,It(n))}return Ct(n.parentNode,t)}return Ct(n,t)}customElements.get("fx-model")||customElements.define("fx-model",Tt);const Ot=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=St(this.getAttributeNode("context")||this,this.context)),this.hasAttribute("ref")&&(e=St(this.getAttributeNode("ref")||this,this.ref)),e||0===this.getModel().instances.length||(e=this.getModel().getDefaultInstance().getDefaultContext()),""===this.ref)this.nodeset=e;else if(Array.isArray(e))this.nodeset=gt(this.ref,e[0],this);else{const{nodeType:t}=e;t?this.nodeset=gt(this.ref,e,this):[this.nodeset]=mt(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=rt.getClosest("[ref]",this.parentNode);return e?e.getAttribute("ref"):"instance()"}getInstance(){if(this.ref.startsWith("instance(")){const e=et.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);const t=rt.getClosest("fx-repeatitem",this);let n;if(t){const{index:e}=t;n=Array.isArray(this.nodeset)?this.getModel().getModelItem(this.nodeset[e-1]):this.getModel().getModelItem(this.nodeset)}else n=this.getModel().getModelItem(this.nodeset);return n||Tt.lazyCreateModelItem(this.getModel(),this.ref,this.nodeset)}getValue(){if(this.hasAttribute("value")){const e=this.getAttribute("value");try{return wt(e,St(this,e),this.getOwnerForm())}catch(e){console.error(e),rt.dispatch(this,"error",{message:e})}}return this.textContent?this.textContent:null}getInScopeContext(){return St(this.getAttributeNode("ref")||this,this.ref)}setInScopeVariables(e){this.inScopeVariables=e}};class Rt extends(Ot(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=et.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 o=this._getReferencesForProperty(this.relevant,e);0!==o.length?this._addDependencies(o,e,t,"relevant"):this.relevant&&this.model.mainGraph.addNode(`${t}:relevant`,e);const a=this._getReferencesForProperty(this.constraint,e);0!==a.length?this._addDependencies(a,e,t,"constraint"):this.constraint&&this.model.mainGraph.addNode(`${t}:constraint`,e)}))}_addDependencies(e,t,n,r){const o=`${n}:${r}`;0!==e.length?(this.model.mainGraph.hasNode(o)||this.model.mainGraph.addNode(o,t),e.forEach((e=>{const t=et.getPath(e);t.endsWith("text()[1]")||(this.model.mainGraph.hasNode(t)||this.model.mainGraph.addNode(t,e),this.model.mainGraph.addDependency(o,t))}))):this.model.mainGraph.addNode(o,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=St(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(et.isSelfReference(this.ref))this.nodeset=e;else if(this.ref){yt(this.ref,t,this).forEach((e=>{this.nodeset.push(e)}))}}));else{"xml"===this.getModel().getInstance(this.instanceId).type?this.nodeset=yt(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)}_createModelItem(e){if(et.isSelfReference(this.ref)){const e=rt.getClosest("fx-bind[ref]",this.parentElement);return console.log("parent bound element ",e),void(e?e.required=this.required:console.error("no parent bound element"))}const t=e,n=et.getPath(e),r=new Bt(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){return e?this.getReferences(e):[]}getReferences(e){const t=new Set,n=new Ze((e=>t.add(e)));return this.nodeset.forEach((t=>{wt(e,t,this,n)})),Array.from(t.values())}_initBooleanModelItemProperty(e,t){return vt(this[e],t,this)}static shortenPath(e){const t=e.split("/");let n="";for(let e=2;e<t.length;e+=1){const r=t[e];if(-1!==r.indexOf("{}")){n+=`/${r.split("{}")[1]}`}else n+=`/${r}`}return n}_getInstanceId(){const e=this.getBindingExpr();return e.startsWith("instance(")?(this.instanceId=et.getInstanceId(e),this.instanceId):this.instanceId?this.instanceId:"default"}}Rt.READONLY_DEFAULT=!1,Rt.REQUIRED_DEFAULT=!1,Rt.RELEVANT_DEFAULT=!0,Rt.CONSTRAINT_DEFAULT=!0,Rt.TYPE_DEFAULT="xs:string",customElements.get("fx-bind")||customElements.define("fx-bind",Rt)
|
|
1
|
+
function e(e,t,n,r){const o={op:t,func:n,data:r};return e.push(o),o}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=[],o=[];return e.forEach((e=>{n.push(0),o.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");o[r+1]+=1;break;case 0:o[r]+=1}})),new r(t,n,o)}static createStub(e){const t=[],n=[];for(let r=0;r<e;++r)t.push(e),n.push(e);return new r(e,t,n)}}class o{constructor(e){this.acceptingTraces=e,this.success=e.length>0}}class a{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,o){let a=r,i=o;for(;a<i;){const r=a+i>>>1;n<t[e[r]]?i=r:a=r+1}return a}(this.h,this.l,t,this.i,this.t);this.h.copyWithin(n+1,n,this.t),this.h[n]=e,this.t+=1}reschedule(e,t){const n=Math.max(this.l[e],t>255?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<r+n;++e)t(this.u[e])}}function s(e,t,n=!1){return null===e?t:Array.isArray(e)?(-1===e.indexOf(t)&&(n&&(e=e.slice()),e.push(t)),e):e===t?e:[e,t]}class u{constructor(e,t){this.prefixes=e,this.record=t}}function c(e,t){let n;if(null===t){if(!Array.isArray(e))return e;n=e}else n=e===u.EMPTY?[]:Array.isArray(e)?e:[e];return new u(n,t)}u.EMPTY=new u([],null);class l{constructor(e){this.p=[],this.v=[];for(let t=0;t<e;++t)this.p.push(0),this.v.push(null)}mergeTraces(e,t,n,r,o,a){let i=!1;return n.forEach(t,(t=>{const n=this.trace(t,r,o,a);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 o=null;const a=t[e];if(null!==a)o=a;else if(!n.has(e))throw new Error(`Trace without source at pc ${e}`);if(o=this.mergeTraces(o,e,n,t,n,r),null!==o){const t=r[e];null!==t&&(o=c(o,t))}return this.v[e]=o,this.p[e]=2,o}buildSurvivorTraces(e,t,n,r,o){for(let a=0,i=e.length;a<i;++a){if(!n.has(a)){t[a]=null;continue}this.v.fill(null),this.p.fill(0);const i=this.mergeTraces(null,a,n,e,r,o);if(null===i)throw new Error(`No non-cyclic paths found to survivor ${a}`);t[a]=c(i,null)}this.v.fill(null)}}class p{constructor(e){this.g=[],this.k=[],this.m=[],this.A=new i(e.maxFromByPc),this.T=new i(e.maxSurvivorFromByPc),this.S=new l(e.programLength);for(let t=0;t<e.programLength;++t)this.g.push(null),this.k.push(null),this.m.push(null);this.k[0]=u.EMPTY}reset(e){this.A.clear(),this.T.clear(),this.g.fill(null),e&&(this.k.fill(null),this.m.fill(null),this.k[0]=u.EMPTY)}record(e,t){this.g[e]=t}has(e){return this.A.has(e)||null!==this.k[e]}add(e,t){this.A.add(e,t)}hasSurvivor(e){return this.T.has(e)}addSurvivor(e,t){this.T.add(e,t)}buildSurvivorTraces(){const e=this.k;this.S.buildSurvivorTraces(e,this.m,this.T,this.A,this.g),this.k=this.m,this.m=e}getTraces(e){const t=e.reduce(((e,t)=>s(e,this.k[t])),null);return null===t?[]:Array.isArray(t)?t:[t]}}class h{constructor(e){this.I=[],this.N=new a(e.programLength),this.M=new a(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 o=this.N.getBadness(e)+n;r?this.N.reschedule(t,o):this.N.add(t,o)}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 a,i=-1;do{let o=n.getNextThreadPc();if(null===o)break;for(++i,a=i>=r?null:e[i];null!==o;){const e=this.G[o];switch(e.op){case 0:null===a?n.accept(o):n.fail(o);break;case 2:{const r=e.func;if(null===r||r(t)){n.fail(o);break}n.step(o,o+1,0);break}case 1:n.step(o,o+1,e.data);break;case 5:if(null===a){n.fail(o);break}if(!(0,e.func)(a,e.data,t)){n.fail(o);break}n.stepToNextGeneration(o,o+1);break;case 3:{const t=e.data,r=t.length;if(0===r){n.fail(o);break}for(let e=0;e<r;++e)n.step(o,t[e],0);break}case 4:{const r=(0,e.func)(e.data,i,t);null!=r&&n.record(o,r),n.step(o,o+1,0);break}}o=n.getNextThreadPc()}n.nextGeneration()}while(null!==a);const s=new o(n.getAcceptingTraces());return n.reset(),this.U.push(n),s}}function d(e){return t=>t===e}function m(e,t){if(null===e||null===t)throw new Error("unescaped hyphen may not be used as a range endpoint");if(t<e)throw new Error("character range is in the wrong order");return n=>e<=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 A(e,t.value,!1)}}function A(e,t,n){const r=e.program.length,o=e.jump([]);n&&(o.data.push(e.program.length),e.test((()=>!0)),e.jump([r]));const a=[];if(t.forEach((t=>{o.data.push(e.program.length),function(e,t){t.forEach((t=>{!function(e,t){const[n,{min:r,max:o}]=t;if(null!==o){for(let t=0;t<r;++t)w(e,n);for(let t=r;t<o;++t){const t=e.jump([]);t.data.push(e.program.length),w(e,n),t.data.push(e.program.length)}}else if(r>0){for(let t=0;t<r-1;++t)w(e,n);const t=e.program.length;w(e,n),e.jump([t]).data.push(e.program.length)}else{const t=e.program.length,r=e.jump([]);r.data.push(e.program.length),w(e,n),e.jump([t]),r.data.push(e.program.length)}}(e,t)}))}(e,t),a.push(e.jump([]))})),a.forEach((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 N(e){return(t,n)=>{const r=n+e.length;return t.slice(n,r)===e?x(r,e):E(n,[e])}}function B(e,t){return(n,r)=>{const o=e(n,r);return o.success?x(o.offset,t(o.value)):o}}function T(e,t,n){return(r,o)=>{const a=e(r,o);return a.success?t(a.value)?a:E(o,n):a.offset===o?E(o,n):a}}function I(e){return(t,n)=>{let r=null;for(const o of e){const e=o(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:x(n,null)}}function S(e){return(t,n)=>{let r=[],o=n;for(;;){const n=e(t,o);if(!n.success){if(n.fatal)return n;break}r.push(n.value),o=n.offset}return x(o,r)}}function O(e,t,n){return(r,o)=>{const a=e(r,o);if(!a.success)return a;const i=t(r,a.offset);return i.success?x(i.offset,n(a.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 k(e,t){return O(e,t,D)}function G(e,t,n,r=!1){return M(e,r?P(k(t,n)):k(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"]),_=["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 X(e){return e.codePointAt(0)}"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(((e,t)=>{j[e]=t}));const L=e=>-1===e||-2===e;function $(e){return t=>!L(t)&&!e(t)}function q(e,t){return null===t?e:n=>e(n)&&!t(n)}const Y=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,o)=>{const a=t[o];null!==e&&e.split("|").forEach((e=>{const t=n.get(e),o=m(r,r+a-1);n.set(e,t?v(t,o):o)})),r+=a})),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]),V=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=_.map((()=>[]));let o=0,a=0;for(;a<n.length;){const e=j[n[a]],t=(31&e)-2;let i=1+j[n[a+1]];switch(32&e?(i+=j[n[a+2]]<<6,i+=j[n[a+3]]<<12,i+=j[n[a+4]]<<18,a+=5):a+=2,t){case-2:{let e=0;for(let t=o;t<o+i;++t)r[e].push(d(t)),e=(e+1)%2;break}case-1:break;default:{const e=r[t];1===i?e.push(d(o)):e.push(m(o,o+i-1));break}}o+=i}const i=new Map;return _.forEach(((e,n)=>{const o=r[n].reduce(v,y);t.set(e,o);const a=e.charAt(0),s=i.get(a)||[];i.set(a,s),s.push(o)})),i.forEach(((e,n)=>{t.set(n,e.reduce(v,y))})),t}();function Q(e){return 32===e||9===e||10===e||13===e}const J=[d(X(":")),m(X("A"),X("Z")),d(X("_")),m(X("a"),X("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),K=[J,d(X("-")),d(X(".")),m(X("0"),X("9")),d(183),m(768,879),m(8255,8256)].reduce(v),z=V.get("Nd"),W=$(z),Z=q(m(0,1114111),[V.get("P"),V.get("Z"),V.get("C")].reduce(v)),ee=$(Z);function te(e){return 10!==e&&13!==e&&!L(e)}const ne={s:Q,S:$(Q),i:J,I:$(J),c:K,C:$(K),d:z,D:W,w:Z,W:ee},re=N("*"),oe=N("\\"),ae=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("-["),Ae=X("0");function xe(e){return[...e].map((e=>e.codePointAt(0)))}var be=Object.freeze({__proto__:null,compile:function(e,t={language:"xsd"}){const r=function(e){function t(e){return new Set(e.split("").map((e=>X(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(oe,I([B(N("n"),(()=>10)),B(N("r"),(()=>13)),B(N("t"),(()=>9)),B(I([oe,ge,me,he,ce,ve,re,ye,ae,ie,le,fe,de,se,ue]),(e=>X(e)))])):M(oe,I([B(N("n"),(()=>10)),B(N("r"),(()=>13)),B(N("t"),(()=>9)),B(I([oe,ge,me,he,ce,ve,re,ye,ae,ie,fe,de,se,ue]),(e=>X(e)))]));function o(e,r){const o=t(r);return O(N(e),C(T(n,(e=>o.has(e)),r.split(""))),((e,t)=>function(e){const t=V.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 a=I([o("L","ultmo"),o("M","nce"),o("N","dlo"),o("P","cdseifo"),o("Z","slp"),o("S","mcko"),o("C","cfon")]),i=[m(X("a"),X("z")),m(X("A"),X("Z")),m(X("0"),X("9")),d(45)].reduce(v),s=I([a,B(M(N("Is"),function(e){return(t,n)=>{const r=e(t,n);return r.success?x(r.offset,t.slice(n,r.offset)):r}}(R(T(n,i,["block identifier"])))),(t=>function(e,t){const n=Y.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=G(N("\\p{"),s,ie,!0),c=B(G(N("\\P{"),s,ie,!0),$),l=M(oe,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]),A=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?x(n,r.value):r}}(I([ue,we])),(()=>null)),_=X("-"),j=I([B(k(k(he,F(se,["not ["])),U),(()=>_)),M(F(he,["not -"]),y)]),L=I([O(B(j,d),I([function(e,t){return L(e,t)},U]),b),O(I([A,h]),I([J,U]),b)]),Q=I([O(B(y,d),I([L,U]),b),O(I([A,h]),I([J,U]),b)]);function J(e,t){return Q(e,t)}const K=B(Q,(e=>e.reduce(v))),z=B(M(ce,K),$),W=O(I([M(F(ce,["not ^"]),K),z]),C(M(he,(function(e,t){return Z(e,t)}))),q),Z=G(se,W,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]),xe="xpath"===e.language?t(".\\?*+{}()|^$[]"):t(".\\?*+{}()|[]"),be=T(n,(e=>!xe.has(e)),["NormalChar"]),Ee=B(M(oe,O(B(T(n,m(X("1"),X("9")),["digit"]),(e=>e-Ae)),S(B(T(n,m(Ae,X("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.")})),Ne="xpath"===e.language?I([B(be,(e=>({kind:"predicate",value:d(e)}))),B(ee,(e=>({kind:"predicate",value:e}))),B(G(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(G(fe,Oe,de,!0),(e=>({kind:"regexp",value:e})))]),Be=B(R(B(T(n,m(Ae,X("9")),["digit"]),(e=>e-Ae))),(e=>e.reduce(((e,t)=>10*e+t)))),Te=I([O(Be,M(pe,Be),((e,t)=>{if(t<e)throw new Error("quantifier range is in the wrong order");return{min:e,max:t}})),O(Be,pe,(e=>({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}))),G(ae,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}))),G(ae,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)}}(t)(e),o=function(e){const t=new n;return e(t),new f(t.program)}((e=>{A(e,r,"xpath"===t.language),e.accept()}));return function(e){const n="xpath"===t.language?[-1,...xe(e),-2]:xe(e);return o.execute(n).success}}});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 e>65535?2:1}function Ie(e,t){return(n,r)=>{const o=n.codePointAt(r);return void 0!==o&&e(o)?Ne(r+Te(o)):Be(r,t)}}function Ce(e,t){return(n,r)=>{const o=e(n,r);return o.success?Ee(o.offset,t(o.value)):o}}function Se(e){return(t,n)=>{let r=[],o=n;for(;;){const n=e(t,o);if(!n.success){if(n.fatal)return n;break}if(r.push(n.value),n.offset===o)break;o=n.offset}return Ee(o,r)}}function Oe(e){return(t,n)=>{let r=n;for(;;){const n=e(t,r);if(!n.success){if(n.fatal)return n;break}if(n.offset===r)break;r=n.offset}return Ne(r)}}function Re(e,t,n){return(r,o)=>{const a=e(r,o);if(!a.success)return a;const i=t(r,a.offset);return i.success?Ee(i.offset,n(a.value,i.value)):i}}function De(e,t){return e}function Ue(e,t){return t}function Me(e,t){return Re(e,t,Ue)}function ke(e,t){return Re(e,t,De)}function Ge(e,t){return(n,r)=>e(n,r).success?Be(r,t):Ne(r)}function Fe(e){return(t,n)=>{const r=e(t,n);return r.success?r:Be(r.offset,r.expected,!0)}}const Pe=(e,t)=>e.length===t?Ne(t):Be(t,["end of input"]);function He(e){const t=[];let n=e.next();for(;!n.done;)t.push(n.value),n=e.next();return[t,n.value]}var _e=Object.freeze({__proto__:null,codepoint:Ie,codepoints:function(e,t){return(n,r)=>{const o=r;for(;;){const t=n.codePointAt(r);if(void 0===t)break;if(!e(t))break;r+=t>65535?2:1}return void 0!==t&&r===o?Be(r,t):Ne(r)}},collect:He,complete:function(e){return Re(e,Pe,De)},consume:function(e){return Ce(e,(()=>{}))},cut:Fe,delimited:function(e,t,n,r=!1){return Me(e,r?Fe(ke(t,n)):ke(t,n))},end:Pe,error:Be,except:function(e,t,n){return Me(Ge(t,n),e)},filter:function(e,t,n){return(r,o)=>{const a=e(r,o);return a.success?t(a.value)?a:Be(o,n):a}},filterUndefined:function(e){return Ce(e,(e=>e.filter((e=>void 0!==e))))},first:De,followed:ke,map:Ce,not:Ge,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,t){return(n,r)=>{let o=null;for(const a of e){const e=a(n,r);if(e.success)return e;if(null===o||e.offset>o.offset?o=e:e.offset===o.offset&&void 0===t&&(o.expected=o.expected.concat(e.expected)),e.fatal)return e}return t=t||(null==o?void 0:o.expected)||[],o&&(o.expected=t),o||Be(r,t)}},peek:function(e){return(t,n)=>{const r=e(t,n);return r.success?Ee(n,r.value):r}},plus:function(e){return Re(e,Se(e),((e,t)=>[e].concat(t)))},plusConsumed:function(e){return Re(e,Oe(e),Ue)},preceded:Me,range:function(e,t,n){return Ie((n=>e<=n&&n<=t),n||[`${String.fromCodePoint(e)}-${String.fromCodePoint(t)}`])},recognize:function(e){return(t,n)=>{const r=e(t,n);return r.success?Ee(r.offset,t.slice(n,r.offset)):r}},second:Ue,skipChars:function(e){return(t,n)=>{let r=e;for(;r>0;){const e=t.codePointAt(n);if(void 0===e)return Be(n,["any character"]);n+=Te(e),r-=1}return Ne(n)}},star:Se,starConsumed:Oe,start:(e,t)=>0===t?Ne(t):Be(t,["start of input"]),streaming:function(e){return function*(t,n){const r=e(t,n);return r.success&&(yield r.value),r}},streamingComplete:function(e){return function*(t,n){const r=yield*e(t,n);return r.success?Pe(t,r.offset):r}},streamingFilterUndefined:function(e){return function*(t,n){const r=e(t,n);let o=r.next();for(;!o.done;){const e=o.value;void 0!==e&&(yield e),o=r.next()}return o.value}},streamingOptional:function(e){return function*(t,n){const[r,o]=He(e(t,n));return o.success?(yield*r,o):o.fatal?o:Ne(n)}},streamingStar:function(e){return function*(t,n){for(;;){const[r,o]=He(e(t,n));if(!o.success)return o.fatal?o:Ne(n);if(yield*r,n===o.offset)return Ne(n);n=o.offset}}},streamingThen:function(e,t){return function*(n,r){const o=yield*e(n,r);return o.success?yield*t(n,o.offset):o}},then:Re,token:function(e){return(t,n)=>{const r=n+e.length;return t.slice(n,r)===e?Ee(r,e):Be(n,[e])}}});const je=function(e,t){const n={};var r;function o(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}var a="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e};var i=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function s(e,t){if(t)e:{var n=i;e=e.split(".");for(var r=0;r<e.length-1;r++){var o=e[r];if(!(o in n))break e;n=n[o]}(t=t(r=n[e=e[e.length-1]]))!=r&&null!=t&&a(n,e,{configurable:!0,writable:!0,value:t})}}function u(e){return(e={next:e})[Symbol.iterator]=function(){return this},e}function c(e){var t="undefined"!=typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];return t?t.call(e):{next:o(e)}}function l(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function p(e){return e instanceof Array?e:l(c(e))}s("Symbol",(function(e){function t(e,t){this.h=e,a(this,"description",{configurable:!0,writable:!0,value:t})}if(e)return e;t.prototype.toString=function(){return this.h};var n="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",r=0;return function e(o){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new t(n+(o||"")+"_"+r++,o)}})),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;n<t.length;n++){var r=i[t[n]];"function"==typeof r&&"function"!=typeof r.prototype[e]&&a(r.prototype,e,{configurable:!0,writable:!0,value:function(){return u(o(this))}})}return e})),s("Symbol.asyncIterator",(function(e){return e||Symbol("Symbol.asyncIterator")}));var h,f="function"==typeof Object.create?Object.create:function(e){function t(){}return t.prototype=e,new t};if("function"==typeof Object.setPrototypeOf)h=Object.setPrototypeOf;else{var d;e:{var m={};try{m.__proto__={a:!0},d=m.a;break e}catch(e){}d=!1}h=d?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw new TypeError(e+" is not extensible");return e}:null}var g=h;function y(e,t){if(e.prototype=f(t.prototype),e.prototype.constructor=e,g)g(e,t);else for(var n in t)if("prototype"!=n)if(Object.defineProperties){var r=Object.getOwnPropertyDescriptor(t,n);r&&Object.defineProperty(e,n,r)}else e[n]=t[n];e.Nc=t.prototype}function v(){this.j=!1,this.s=null,this.u=void 0,this.h=1,this.ha=0,this.A=null}function w(e){if(e.j)throw new TypeError("Generator is already running");e.j=!0}function A(e,t){e.A={yc:t,Ac:!0},e.h=e.ha}function x(e){this.h=new v,this.s=e}function b(e,t,n,r){try{var o=t.call(e.h.s,n);if(!(o instanceof Object))throw new TypeError("Iterator result "+o+" is not an object");if(!o.done)return e.h.j=!1,o;var a=o.value}catch(t){return e.h.s=null,A(e.h,t),E(e)}return e.h.s=null,r.call(e.h,a),E(e)}function E(e){for(;e.h.h;)try{var t=e.s(e.h);if(t)return e.h.j=!1,{value:t.value,done:!1}}catch(t){e.h.u=void 0,A(e.h,t)}if(e.h.j=!1,e.h.A){if(t=e.h.A,e.h.A=null,t.Ac)throw t.yc;return{value:t.return,done:!0}}return{value:void 0,done:!0}}function N(e){this.next=function(t){return w(e.h),e.h.s?t=b(e,e.h.s.next,t,e.h.O):(e.h.O(t),t=E(e)),t},this.throw=function(t){return w(e.h),e.h.s?t=b(e,e.h.s.throw,t,e.h.O):(A(e.h,t),t=E(e)),t},this.return=function(t){return function(e,t){w(e.h);var n=e.h.s;return n?b(e,"return"in n?n.return:function(e){return{value:e,done:!0}},t,e.h.return):(e.h.return(t),E(e))}(e,t)},this[Symbol.iterator]=function(){return this}}function B(e,t){return Object.prototype.hasOwnProperty.call(e,t)}v.prototype.O=function(e){this.u=e},v.prototype.return=function(e){this.A={return:e},this.h=this.ha},s("Promise",(function(e){function t(e){this.s=0,this.A=void 0,this.h=[],this.ha=!1;var t=this.j();try{e(t.resolve,t.reject)}catch(e){t.reject(e)}}function n(){this.h=null}function r(e){return e instanceof t?e:new t((function(t){t(e)}))}if(e)return e;n.prototype.s=function(e){if(null==this.h){this.h=[];var t=this;this.A((function(){t.u()}))}this.h.push(e)};var o=i.setTimeout;n.prototype.A=function(e){o(e,0)},n.prototype.u=function(){for(;this.h&&this.h.length;){var e=this.h;this.h=[];for(var t=0;t<e.length;++t){var n=e[t];e[t]=null;try{n()}catch(e){this.j(e)}}}this.h=null},n.prototype.j=function(e){this.A((function(){throw e}))},t.prototype.j=function(){function e(e){return function(r){n||(n=!0,e.call(t,r))}}var t=this,n=!1;return{resolve:e(this.na),reject:e(this.u)}},t.prototype.na=function(e){if(e===this)this.u(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof t)this.ua(e);else{e:switch(typeof e){case"object":var n=null!=e;break e;case"function":n=!0;break e;default:n=!1}n?this.ka(e):this.O(e)}},t.prototype.ka=function(e){var t=void 0;try{t=e.then}catch(e){return void this.u(e)}"function"==typeof t?this.mb(t,e):this.O(e)},t.prototype.u=function(e){this.B(2,e)},t.prototype.O=function(e){this.B(1,e)},t.prototype.B=function(e,t){if(0!=this.s)throw Error("Cannot settle("+e+", "+t+"): Promise already settled in state"+this.s);this.s=e,this.A=t,2===this.s&&this.Ya(),this.J()},t.prototype.Ya=function(){var e=this;o((function(){if(e.T()){var t=i.console;void 0!==t&&t.error(e.A)}}),1)},t.prototype.T=function(){if(this.ha)return!1;var e=i.CustomEvent,t=i.Event,n=i.dispatchEvent;return void 0===n||("function"==typeof e?e=new e("unhandledrejection",{cancelable:!0}):"function"==typeof t?e=new t("unhandledrejection",{cancelable:!0}):(e=i.document.createEvent("CustomEvent")).initCustomEvent("unhandledrejection",!1,!0,e),e.promise=this,e.reason=this.A,n(e))},t.prototype.J=function(){if(null!=this.h){for(var e=0;e<this.h.length;++e)a.s(this.h[e]);this.h=null}};var a=new n;return t.prototype.ua=function(e){var t=this.j();e.nb(t.resolve,t.reject)},t.prototype.mb=function(e,t){var n=this.j();try{e.call(t,n.resolve,n.reject)}catch(e){n.reject(e)}},t.prototype.then=function(e,n){function r(e,t){return"function"==typeof e?function(t){try{o(e(t))}catch(e){a(e)}}:t}var o,a,i=new t((function(e,t){o=e,a=t}));return this.nb(r(e,o),r(n,a)),i},t.prototype.catch=function(e){return this.then(void 0,e)},t.prototype.nb=function(e,t){function n(){switch(r.s){case 1:e(r.A);break;case 2:t(r.A);break;default:throw Error("Unexpected state: "+r.s)}}var r=this;null==this.h?a.s(n):this.h.push(n),this.ha=!0},t.resolve=r,t.reject=function(e){return new t((function(t,n){n(e)}))},t.race=function(e){return new t((function(t,n){for(var o=c(e),a=o.next();!a.done;a=o.next())r(a.value).nb(t,n)}))},t.all=function(e){var n=c(e),o=n.next();return o.done?r([]):new t((function(e,t){function a(t){return function(n){i[t]=n,0==--s&&e(i)}}var i=[],s=0;do{i.push(void 0),s++,r(o.value).nb(a(i.length-1),t),o=n.next()}while(!o.done)}))},t}));var T="function"==typeof Object.assign?Object.assign:function(e,t){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(r)for(var o in r)B(r,o)&&(e[o]=r[o])}return e};function I(e,t,n){if(null==e)throw new TypeError("The 'this' value for String.prototype."+n+" must not be null or undefined");if(t instanceof RegExp)throw new TypeError("First argument to String.prototype."+n+" must not be a regular expression");return e+""}function C(e,t){return e=void 0!==e?String(e):" ",0<t&&e?e.repeat(Math.ceil(t/e.length)).substring(0,t):""}function S(e,t,n){e instanceof String&&(e=String(e));for(var r=e.length,o=0;o<r;o++){var a=e[o];if(t.call(n,a,o,e))return{Fb:o,Mb:a}}return{Fb:-1,Mb:void 0}}function O(e){return e||Array.prototype.fill}function R(e,t){e instanceof String&&(e+="");var n=0,r=!1,o={next:function(){if(!r&&n<e.length){var o=n++;return{value:t(o,e[o]),done:!1}}return r=!0,{done:!0,value:void 0}}};return o[Symbol.iterator]=function(){return o},o}function D(e,t){if(!("0"!==e&&"-0"!==e||"0"!==t&&"-0"!==t))return 0;var n=/(?:\+|(-))?(\d+)?(?:\.(\d+))?/;e=n.exec(e+"");var r=n.exec(t+""),o=!e[1],a=!r[1];return t=(e[2]||"").replace(/^0*/,""),n=(r[2]||"").replace(/^0*/,""),e=e[3]||"",r=r[3]||"",o&&!a?1:!o&&a?-1:(o=o&&a,t.length>n.length?o?1:-1:t.length<n.length?o?-1:1:t>n?o?1:-1:t<n?o?-1:1:(t=Math.max(e.length,r.length),(n=e.padEnd(t,"0"))>(t=r.padEnd(t,"0"))?o?1:-1:n<t?o?-1:1:0))}function U(e,t){return!(-1<(e=e.toString()).indexOf(".")&&0===t)&&(!(e=/^[-+]?0*([1-9]\d*)?(?:\.((?:\d*[1-9])*)0*)?$/.exec(e))[2]||e[2].length<=t)}function M(e,t){switch(t){case"required":return/(Z)|([+-])([01]\d):([0-5]\d)$/.test(e.toString());case"prohibited":return!/(Z)|([+-])([01]\d):([0-5]\d)$/.test(e.toString());case"optional":return!0}}function k(e){switch(e){case 1:case 0:case 6:case 3:case 18:case 22:case 21:case 20:case 23:case 44:return{};case 4:return{ma:U,ra:function(e,t){return 1>D(e,t)},Lc:function(e,t){return 0>D(e,t)},sa:function(e,t){return-1<D(e,t)},Mc:function(e,t){return 0<D(e,t)}};case 9:case 8:case 7:case 11:case 12:case 13:case 15:case 14:return{wa:M};default:return null}}s("Object.assign",(function(e){return e||T})),s("String.prototype.repeat",(function(e){return e||function(e){var t=I(this,null,"repeat");if(0>e||1342177279<e)throw new RangeError("Invalid count value");e|=0;for(var n="";e;)1&e&&(n+=t),(e>>>=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 o(e){if(!B(e,s)){var t=new n;a(e,s,{value:t})}}function i(e){var t=Object[e];t&&(Object[e]=function(e){return e instanceof n?e:(Object.isExtensible(e)&&o(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(o(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?a.has(t)?n=a.get(t):(n=""+ ++i,a.set(t,n)):n="p_"+t;var r=e.s[n];if(r&&B(e.s,n))for(e=0;e<r.length;e++){var o=r[e];if(t!=t&&o.key!=o.key||t===o.key)return{id:n,list:r,index:e,ja:o}}return{id:n,list:r,index:-1,ja:void 0}}function o(e){if(this.s={},this.h=t(),this.size=0,e){e=c(e);for(var n;!(n=e.next()).done;)n=n.value,this.set(n[0],n[1])}}if(function(){if(!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var t=Object.seal({x:4}),n=new e(c([[t,"s"]]));if("s"!=n.get(t)||1!=n.size||n.get({x:4})||n.set({x:4},"t")!=n||2!=n.size)return!1;var r=n.entries(),o=r.next();return!o.done&&o.value[0]==t&&"s"==o.value[1]&&!((o=r.next()).done||4!=o.value[0].x||"t"!=o.value[1]||!r.next().done)}catch(e){return!1}}())return e;var a=new WeakMap;o.prototype.set=function(e,t){var n=r(this,e=0===e?0:e);return n.list||(n.list=this.s[n.id]=[]),n.ja?n.ja.value=t:(n.ja={next:this.h,Ba:this.h.Ba,head:this.h,key:e,value:t},n.list.push(n.ja),this.h.Ba.next=n.ja,this.h.Ba=n.ja,this.size++),this},o.prototype.delete=function(e){return!(!(e=r(this,e)).ja||!e.list)&&(e.list.splice(e.index,1),e.list.length||delete this.s[e.id],e.ja.Ba.next=e.ja.next,e.ja.next.Ba=e.ja.Ba,e.ja.head=null,this.size--,!0)},o.prototype.clear=function(){this.s={},this.h=this.h.Ba=t(),this.size=0},o.prototype.has=function(e){return!!r(this,e).ja},o.prototype.get=function(e){return(e=r(this,e).ja)&&e.value},o.prototype.entries=function(){return n(this,(function(e){return[e.key,e.value]}))},o.prototype.keys=function(){return n(this,(function(e){return e.key}))},o.prototype.values=function(){return n(this,(function(e){return e.value}))},o.prototype.forEach=function(e,t){for(var n,r=this.entries();!(n=r.next()).done;)n=n.value,e.call(t,n[1],n[0],this)},o.prototype[Symbol.iterator]=o.prototype.entries;var i=0;return o})),s("Array.prototype.find",(function(e){return e||function(e,t){return S(this,e,t).Mb}})),s("String.prototype.startsWith",(function(e){return e||function(e,t){var n=I(this,e,"startsWith"),r=n.length,o=e.length;t=Math.max(0,Math.min(0|t,n.length));for(var a=0;a<o&&t<r;)if(n[t++]!=e[a++])return!1;return a>=o}})),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<n;t++)this[t]=e;return this}})),s("Int8Array.prototype.fill",O),s("Uint8Array.prototype.fill",O),s("Uint8ClampedArray.prototype.fill",O),s("Int16Array.prototype.fill",O),s("Uint16Array.prototype.fill",O),s("Int32Array.prototype.fill",O),s("Uint32Array.prototype.fill",O),s("Float32Array.prototype.fill",O),s("Float64Array.prototype.fill",O),s("Array.from",(function(e){return e||function(e,t,n){t=null!=t?t:function(e){return e};var r=[],o="undefined"!=typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];if("function"==typeof o){e=o.call(e);for(var a=0;!(o=e.next()).done;)r.push(t.call(n,o.value,a++))}else for(o=e.length,a=0;a<o;a++)r.push(t.call(n,e[a],a));return r}})),s("Object.is",(function(e){return e||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}})),s("Array.prototype.includes",(function(e){return e||function(e,t){var n=this;n instanceof String&&(n=String(n));var r=n.length;for(0>(t=t||0)&&(t=Math.max(t+r,0));t<r;t++){var o=n[t];if(o===e||Object.is(o,e))return!0}return!1}})),s("String.prototype.includes",(function(e){return e||function(e,t){return-1!==I(this,e,"includes").indexOf(e,t||0)}})),s("Number.MAX_SAFE_INTEGER",(function(){return 9007199254740991})),s("Number.MIN_SAFE_INTEGER",(function(){return-9007199254740991})),s("Math.trunc",(function(e){return e||function(e){if(e=Number(e),isNaN(e)||1/0===e||-1/0===e||0===e)return e;var t=Math.floor(Math.abs(e));return 0>e?-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&&0<t;)if(n[--t]!=e[--r])return!1;return 0>=r}})),s("String.fromCodePoint",(function(e){return e||function(e){for(var t="",n=0;n<arguments.length;n++){var r=Number(arguments[n]);if(0>r||1114111<r||r!==Math.floor(r))throw new RangeError("invalid_code_point "+r);65535>=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)&&e<n){e|=0;var r=t.charCodeAt(e);return 55296>r||56319<r||e+1===n||(56320>(e=t.charCodeAt(e+1))||57343<e)?r:1024*(r-55296)+e+9216}}})),s("Set",(function(e){function t(e){if(this.h=new Map,e){e=c(e);for(var t;!(t=e.next()).done;)this.add(t.value)}this.size=this.h.size}return function(){if(!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var t=Object.seal({x:4}),n=new e(c([t]));if(!n.has(t)||1!=n.size||n.add(t)!=n||1!=n.size||n.add({x:4})!=n||2!=n.size)return!1;var r=n.entries(),o=r.next();return!o.done&&o.value[0]==t&&o.value[1]==t&&(!(o=r.next()).done&&o.value[0]!=t&&4==o.value[0].x&&o.value[1]==o.value[0]&&r.next().done)}catch(e){return!1}}()?e:(t.prototype.add=function(e){return e=0===e?0:e,this.h.set(e,e),this.size=this.h.size,this},t.prototype.delete=function(e){return e=this.h.delete(e),this.size=this.h.size,e},t.prototype.clear=function(){this.h.clear(),this.size=0},t.prototype.has=function(e){return this.h.has(e)},t.prototype.entries=function(){return this.h.entries()},t.prototype.values=function(){return this.h.values()},t.prototype.keys=t.prototype.values,t.prototype[Symbol.iterator]=t.prototype.values,t.prototype.forEach=function(e,t){var n=this;this.h.forEach((function(r){return e.call(t,r,r,n)}))},t)})),s("Math.log10",(function(e){return e||function(e){return Math.log(e)/Math.LN10}})),s("Object.values",(function(e){return e||function(e){var t,n=[];for(t in e)B(e,t)&&n.push(e[t]);return n}})),s("Number.isNaN",(function(e){return e||function(e){return"number"==typeof e&&isNaN(e)}})),s("Array.prototype.values",(function(e){return e||function(){return R(this,(function(e,t){return t}))}})),s("Object.getOwnPropertySymbols",(function(e){return e||function(){return[]}}));var G={},F={};function P(e){return/^([+-]?(\d*(\.\d*)?([eE][+-]?\d*)?|INF)|NaN)$/.test(e)}function H(e){return/^[_:A-Za-z][-._:A-Za-z0-9]*$/.test(e)}function _(e){return H(e)&&/^[_A-Za-z]([-._A-Za-z0-9])*$/.test(e)}function j(e){return 1===(e=e.split(":")).length?_(e[0]):2===e.length&&(_(e[0])&&_(e[1]))}function X(e){return!/[\u0009\u000A\u000D]/.test(e)}function L(e){return _(e)}var $=new Map([[45,function(){return!0}],[46,function(){return!0}],[1,function(){return!0}],[0,function(e){return/^(0|1|true|false)$/.test(e)}],[6,function(e){return P(e)}],[3,P],[4,function(e){return/^[+-]?\d*(\.\d*)?$/.test(e)}],[18,function(e){return/^(-)?P(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+(\.\d*)?S)?)?$/.test(e)}],[9,function(e){return/^-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[8,function(e){return/^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[7,function(e){return/^-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[11,function(e){return/^-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[12,function(e){return/^-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[13,function(e){return/^--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[15,function(e){return/^---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[14,function(e){return/^--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(e)}],[22,function(e){return/^([0-9A-Fa-f]{2})*$/.test(e)}],[21,function(e){return new RegExp(/^((([A-Za-z0-9+/] ?){4})*((([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/])|(([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=)|(([A-Za-z0-9+/] ?)[AQgw] ?= ?=)))?$/).test(e)}],[20,function(){return!0}],[44,j],[48,X],[52,function(e){return X(e)&&!/^ | {2,}| $/.test(e)}],[51,function(e){return/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/.test(e)}],[50,function(e){return/^[-._:A-Za-z0-9]+$/.test(e)}],[25,H],[23,j],[24,_],[42,L],[41,L],[26,function(e){return _(e)}],[5,function(e){return/^[+-]?\d+$/.test(e)}],[16,function(e){return/^-?P[0-9]+(Y([0-9]+M)?|M)$/.test(e)}],[17,function(e){return/^-?P([0-9]+D)?(T([0-9]+H)?([0-9]+M)?([0-9]+(\.[0-9]+)?S)?)?$/.test(e)}]]),q=Object.create(null);function Y(e,t){if(!q[t])throw Error("Unknown type");return{type:t,value:e}}[{D:0,name:59},{D:0,name:46,parent:59,K:{whiteSpace:"preserve"}},{D:0,name:19,parent:46},{D:0,name:1,parent:46},{D:0,name:0,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:4,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:6,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:3,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:18,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:9,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:8,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:7,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:11,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:12,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:13,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:15,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:14,parent:46,K:{wa:"optional",whiteSpace:"collapse"}},{D:0,name:22,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:21,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:20,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:23,parent:46,K:{whiteSpace:"collapse"}},{D:0,name:44,parent:46,K:{whiteSpace:"collapse"}},{D:1,name:10,U:9,K:{whiteSpace:"collapse",wa:"required"}},{D:1,name:48,U:1,K:{whiteSpace:"replace"}},{D:1,name:52,U:48,K:{whiteSpace:"collapse"}},{D:1,name:51,U:52,K:{whiteSpace:"collapse"}},{D:1,name:50,U:52,K:{whiteSpace:"collapse"}},{D:2,name:49,type:50,K:{minLength:1,whiteSpace:"collapse"}},{D:1,name:25,U:52,K:{whiteSpace:"collapse"}},{D:1,name:24,U:25,K:{whiteSpace:"collapse"}},{D:1,name:42,U:24,K:{whiteSpace:"collapse"}},{D:1,name:41,U:24,K:{whiteSpace:"collapse"}},{D:2,name:43,type:41,K:{minLength:1,whiteSpace:"collapse"}},{D:1,name:26,U:24,K:{whiteSpace:"collapse"}},{D:2,name:40,type:26,K:{minLength:1,whiteSpace:"collapse"}},{D:0,name:5,parent:4,K:{ma:0,whiteSpace:"collapse"}},{D:1,name:27,U:5,K:{ma:0,ra:"0",whiteSpace:"collapse"}},{D:1,name:28,U:27,K:{ma:0,ra:"-1",whiteSpace:"collapse"}},{D:1,name:31,U:5,K:{ma:0,ra:"9223372036854775807",sa:"-9223372036854775808",whiteSpace:"collapse"}},{D:1,name:32,U:31,K:{ma:0,ra:"2147483647",sa:"-2147483648",whiteSpace:"collapse"}},{D:1,name:33,U:32,K:{ma:0,ra:"32767",sa:"-32768",whiteSpace:"collapse"}},{D:1,name:34,U:33,K:{ma:0,ra:"127",sa:"-128",whiteSpace:"collapse"}},{D:1,name:30,U:5,K:{ma:0,sa:"0",whiteSpace:"collapse"}},{D:1,name:36,U:30,K:{ma:0,ra:"18446744073709551615",sa:"0",whiteSpace:"collapse"}},{D:1,name:35,U:36,K:{ma:0,ra:"4294967295",sa:"0",whiteSpace:"collapse"}},{D:1,name:38,U:35,K:{ma:0,ra:"65535",sa:"0",whiteSpace:"collapse"}},{D:1,name:37,U:38,K:{ma:0,ra:"255",sa:"0",whiteSpace:"collapse"}},{D:1,name:29,U:30,K:{ma:0,sa:"1",whiteSpace:"collapse"}},{D:1,name:16,U:18,K:{whiteSpace:"collapse"}},{D:1,name:17,U:18,K:{whiteSpace:"collapse"}},{D:1,name:60,U:59},{D:3,name:39,Aa:[]},{D:1,name:61,U:60},{D:1,name:62,U:60},{D:0,name:53,parent:59},{D:1,name:54,U:53},{D:1,name:58,U:53},{D:1,name:47,U:53},{D:1,name:56,U:53},{D:1,name:57,U:53},{D:1,name:55,U:53},{D:3,name:2,Aa:[4,5,6,3]},{D:3,name:63,Aa:[]}].forEach((function(e){var t=e.name,n=e.K||{};switch(e.D){case 0:e=e.parent?q[e.parent]:null;var r=$.get(t)||null;q[t]={D:0,type:t,Ia:n,parent:e,fb:r,La:k(t),Aa:[]};break;case 1:e=q[e.U],r=$.get(t)||null,q[t]={D:1,type:t,Ia:n,parent:e,fb:r,La:e.La,Aa:[]};break;case 2:q[t]={D:2,type:t,Ia:n,parent:q[e.type],fb:null,La:G,Aa:[]};break;case 3:e=e.Aa.map((function(e){return q[e]})),q[t]={D:3,type:t,Ia:n,parent:null,fb:null,La:F,Aa:e}}}));var V=Y(!0,0),Q=Y(!1,0);function J(){return Error("FORG0006: A wrong argument type was specified in a function call.")}function K(e,t){this.done=e,this.value=t}var z=new K(!0,void 0);function W(e){return new K(!1,e)}function Z(e,t){if(3===t.D)return!!t.Aa.find((function(t){return Z(e,t)}));for(;e;){if(e.type===t.type)return!0;if(3===e.D)return!!e.Aa.find((function(e){return ee(e.type,t.type)}));e=e.parent}return!1}function ee(e,t){return e===t||Z(q[e],q[t])}function te(e){this.s=ce,this.h=e;var t=-1;this.value={next:function(){return++t>=e.length?z:W(e[t])}}}function ne(){this.value={next:function(){return z}}}function re(e){var t=e.value;if(ee(e.type,53))return!0;if(ee(e.type,0))return t;if(ee(e.type,1)||ee(e.type,20)||ee(e.type,19))return 0!==t.length;if(ee(e.type,2))return!isNaN(t)&&0!==t;throw J()}function oe(e,t){var n=this;this.j=ce,this.value={next:function(t){return null!==n.s&&n.h>=n.s?z:void 0!==n.A[n.h]?W(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 ie(e){this.A=ce,this.h=e;var t=!1;this.value={next:function(){return t?z:(t=!0,W(e))}},this.s=null}(r=te.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&&!e(t.h[n],n,t);)n++;return n>=t.h.length?z:W(t.h[n])}})},r.first=function(){return this.h[0]},r.M=function(){return this.h},r.getEffectiveBooleanValue=function(){if(ee(this.h[0].type,53))return!0;throw J()},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?z: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=ne.prototype).ob=function(){return this},r.filter=function(){return this},r.first=function(){return null},r.M=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=oe.prototype).ob=function(){return this.j.create(this.M())},r.filter=function(e){var t=this,n=-1,r=this.value;return this.j.create({next:function(o){for(n++,o=r.next(o);!o.done&&!e(o.value,n,t);)n++,o=r.next(0);return o}})},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.M=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(ee((n=n.value).type,53))return ae(this,t),!0;if(!e.next(0).done)throw J();return ae(this,t),re(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.M().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(o){return(o=r.next(o)).done?z:W(e(o.value,n++,t))}},this.s)},r.L=function(e,t){var n,r=this.value,o=[],a=!0;return function(){for(var i=r.next(a?0:t);!i.done;i=r.next(t))a=!1,o.push(i.value);n=e(o).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(o){return r?r.next(o):n.G()?(t(e.empty?e.empty(n):e.default(n)),r.next(o)):n.ya()?(t(e.o?e.o(n):e.default(n)),r.next(o)):(t(e.multiple?e.multiple(n):e.default(n)),r.next(o))}})},(r=ie.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.M=function(){return[this.h]},r.getEffectiveBooleanValue=function(){return null===this.s&&(this.s=re(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 se=new ne;function ue(e,t){if(null===(e=void 0===e?null:e))return se;if(Array.isArray(e))switch(e.length){case 0:return se;case 1:return new ie(e[0]);default:return new te(e)}return e.next?new oe(e,void 0===t?null:t):new ie(e)}var ce={create:ue,o:function(e){return new ie(e)},empty:function(){return ue()},ca:function(){return ue(V)},X:function(){return ue(Q)}};function le(e){var t=[],n=e.value;return function(){var e=0;return ce.create({next:function(){if(void 0!==t[e])return t[e++];var r=n.next(0);return r.done?r:t[e++]=r}})}}function pe(e,t){this.type=e,this.value=t}var he={},fe=(he[0]="xs:boolean",he[1]="xs:string",he[2]="xs:numeric",he[3]="xs:double",he[4]="xs:decimal",he[5]="xs:integer",he[6]="xs:float",he[7]="xs:date",he[8]="xs:time",he[9]="xs:dateTime",he[10]="xs:dateTimeStamp",he[11]="xs:gYearMonth",he[12]="xs:gYear",he[13]="xs:gMonthDay",he[14]="xs:gMonth",he[15]="xs:gDay",he[16]="xs:yearMonthDuration",he[17]="xs:dayTimeDuration",he[18]="xs:duration",he[19]="xs:untypedAtomic",he[20]="xs:anyURI",he[21]="xs:base64Binary",he[22]="xs:hexBinary",he[23]="xs:QName",he[24]="xs:NCName",he[25]="xs:Name",he[26]="xs:ENTITY",he[27]="xs:nonPositiveInteger",he[28]="xs:negativeInteger",he[29]="xs:positiveInteger",he[30]="xs:nonNegativeInteger",he[31]="xs:long",he[32]="xs:int",he[33]="xs:short",he[34]="xs:byte",he[35]="xs:unsignedInt",he[36]="xs:unsignedLong",he[37]="xs:unsignedByte",he[38]="xs:unsignedShort",he[39]="xs:error",he[40]="xs:ENTITIES",he[41]="xs:IDREF",he[42]="xs:ID",he[43]="xs:IDREFS",he[44]="xs:NOTATION",he[45]="xs:anySimpleType",he[46]="xs:anyAtomicType",he[47]="attribute()",he[48]="xs:normalizedString",he[49]="xs:NMTOKENS",he[50]="xs:NMTOKEN",he[51]="xs:language",he[52]="xs:token",he[53]="node()",he[54]="element()",he[55]="document-node()",he[56]="text()",he[57]="processing-instruction()",he[58]="comment()",he[59]="item()",he[60]="function(*)",he[61]="map(*)",he[62]="array(*)",he[63]="none",he),de={"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 me(e){return 2===e.g?fe[e.type]+"*":1===e.g?fe[e.type]+"+":0===e.g?fe[e.type]+"?":fe[e.type]}function ge(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=de[e];if(void 0===t)throw Error('XPST0051: The type "'+e+'" could not be found');return t}function ye(e){switch(e[e.length-1]){case"*":return{type:ge(e.substr(0,e.length-1)),g:2};case"?":return{type:ge(e.substr(0,e.length-1)),g:0};case"+":return{type:ge(e.substr(0,e.length-1)),g:1};default:return{type:ge(e),g:3}}}function ve(e,t,n){this.namespaceURI=t||null,this.prefix=e||"",this.localName=n}function we(e){var t=e.l,n=e.arity,r=void 0!==e.Pa&&e.Pa,o=void 0!==e.I&&e.I,a=e.localName,i=e.namespaceURI,s=e.i;for(e=e.value,pe.call(this,60,null),this.value=e,this.I=o,o=-1,e=0;e<t.length;e++)4===t[e]&&(o=e);-1<o&&(e=Array(n-(t.length-1)).fill(t[o-1]),t=t.slice(0,o).concat(e)),this.s=t,this.A=n,this.ha=r,this.j=a,this.u=i,this.O=s}function Ae(e,t){var n=[];return 2!==e&&1!==e||n.push("type-1-or-type-2"),n.push("type-"+e),t&&n.push("name-"+t),n}function xe(e){var t=e.node.nodeType;if(2===t||1===t)var n=e.node.localName;return Ae(t,n)}function be(e){var t=e.nodeType;if(2===t||1===t)var n=e.localName;return Ae(t,n)}function Ee(){}function Ne(){}ve.prototype.va=function(){return this.prefix?this.prefix+":"+this.localName:this.localName},y(we,pe),we.prototype.Pa=function(){return this.ha},Ee.prototype.getAllAttributes=function(e,t){return t=void 0===t?null:t,1!==e.nodeType?[]:(e=Array.from(e.attributes),null===t?e:e.filter((function(e){return be(e).includes(t)})))},Ee.prototype.getAttribute=function(e,t){return 1!==e.nodeType?null:e.getAttribute(t)},Ee.prototype.getChildNodes=function(e,t){return t=void 0===t?null:t,e=Array.from(e.childNodes),null===t?e:e.filter((function(e){return be(e).includes(t)}))},Ee.prototype.getData=function(e){return 2===e.nodeType?e.value:e.data},Ee.prototype.getFirstChild=function(e,t){for(t=void 0===t?null:t,e=e.firstChild;e;e=e.nextSibling)if(null===t||be(e).includes(t))return e;return null},Ee.prototype.getLastChild=function(e,t){for(t=void 0===t?null:t,e=e.lastChild;e;e=e.previousSibling)if(null===t||be(e).includes(t))return e;return null},Ee.prototype.getNextSibling=function(e,t){for(t=void 0===t?null:t,e=e.nextSibling;e;e=e.nextSibling)if(null===t||be(e).includes(t))return e;return null},Ee.prototype.getParentNode=function(e,t){return t=void 0===t?null:t,(e=2===e.nodeType?e.ownerElement:e.parentNode)&&(null===t||be(e).includes(t))?e:null},Ee.prototype.getPreviousSibling=function(e,t){for(t=void 0===t?null:t,e=e.previousSibling;e;e=e.previousSibling)if(null===t||be(e).includes(t))return e;return null},(r=Ne.prototype).insertBefore=function(e,t,n){return e.insertBefore(t,n)},r.removeAttributeNS=function(e,t,n){return e.removeAttributeNS(t,n)},r.removeChild=function(e,t){return e.removeChild(t)},r.setAttributeNS=function(e,t,n,r){e.setAttributeNS(t,n,r)},r.setData=function(e,t){e.data=t};var Be=new Ne;function Te(e){this.h=e}function Ie(e){return void 0!==e.Qa}function Ce(e,t,n){var r=null;return t&&(Ie(t.node)?r={F:t.F,offset:n,parent:t.node}:t.F&&(r=t.F)),{node:e,F:r}}function Se(e){this.h=e,this.s=[]}function Oe(e,t,n){return e.getAllAttributes(t.node,void 0===n?null:n).map((function(e){return Ce(e,t,e.nodeName)}))}function Re(e,t,n){return Ie(t=t.node)?(e=t.attributes.find((function(e){return n===e.name})))?e.value:null:(e=e.h.getAttribute(t,n))?e:null}function De(e,t,n){return e.getChildNodes(t.node,void 0===n?null:n).map((function(e,n){return Ce(e,t,n)}))}function Ue(e,t){return e.getData(t.node)}function Me(e,t,n){var r=t.node;return Ie(r)?e=r.childNodes[0]:((n=e.h.getFirstChild(r,void 0===n?null:n))&&10===n.nodeType&&(n=e.h.getNextSibling(n)),e=n),e?Ce(e,t,0):null}function ke(e,t,n){n=void 0===n?null:n;var r=t.node;return Ie(r)?(e=r.childNodes.length-1,r=r.childNodes[e]):((r=e.h.getLastChild(r,n))&&10===r.nodeType&&(r=e.h.getPreviousSibling(r)),e=e.getChildNodes(t.node,n).length-1),r?Ce(r,t,e):null}function Ge(e,t,n){n=void 0===n?null:n;var r=t.node,o=t.F;if(Ie(r)){if(o)var a=o.offset+1,i=o.parent.childNodes[a]}else{if(!o){for(i=r;i&&(!(i=e.h.getNextSibling(i,n))||10===i.nodeType););return i?{node:i,F:null}:null}a=o.offset+1;var s=Fe(e,t,null);i=e.getChildNodes(s.node,n)[a]}return i?Ce(i,s||Fe(e,t,n),a):null}function Fe(e,t,n){n=void 0===n?null:n;var r=t.node,o=t.F;if(o)"number"==typeof o.offset&&r===o.parent.childNodes[o.offset]||"string"==typeof o.offset&&r===o.parent.attributes.find((function(e){return o.offset===e.nodeName}))?(e=o.parent,t=o.F):(e=e.getParentNode(r,n),t=o);else{if(Ie(r))return null;e=e.getParentNode(r,n),t=null}return e?{node:e,F:t}:null}function Pe(e,t,n){n=void 0===n?null:n;var r=t.node,o=t.F;if(Ie(r)){if(o)var a=o.offset-1,i=o.parent.childNodes[a]}else{if(!o){for(i=r;i&&(!(i=e.h.getPreviousSibling(i,n))||10===i.nodeType););return i?{node:i,F:null}:null}a=o.offset-1;var s=Fe(e,t,null);i=e.getChildNodes(s.node,n)[a]}return i?Ce(i,s||Fe(e,t,n),a):null}function He(e,t,n,r,o){return o.L((function(e){var t=c(e).next().value;return r.L((function(e){e=c(e).next().value;var n=t.value;if(0>=n||n>e.R.length)throw Error("FOAY0001: array position out of bounds.");return e.R[n-1]()}))}))}function _e(e){we.call(this,{value:function(e,n,r,o){return He(0,0,0,ce.o(t),o)},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 Le(e,t){return e=e.map((function(e){return e.first()})),t(e)}function $e(e,t){var n=ee(e.type,1)||ee(e.type,20)||ee(e.type,19),r=ee(t.type,1)||ee(t.type,20)||ee(t.type,19);return n&&r?e.value===t.value:(n=ee(e.type,4)||ee(e.type,3)||ee(e.type,6),r=ee(t.type,4)||ee(t.type,3)||ee(t.type,6),n&&r?!(!isNaN(e.value)||!isNaN(t.value))||e.value===t.value:(n=ee(e.type,0)||ee(e.type,22)||ee(e.type,18)||ee(e.type,23)||ee(e.type,44),r=ee(t.type,0)||ee(t.type,22)||ee(t.type,18)||ee(t.type,23)||ee(t.type,44),!(!n||!r)&&e.value===t.value))}function qe(e,t,n,r,o){return Le([r,o],(function(e){var t=(e=c(e)).next().value,n=e.next().value;return(e=t.h.find((function(e){return $e(e.key,n)})))?e.value():ce.empty()}))}function Ye(e){we.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,o){return qe(0,0,0,ce.o(t),o)},i:{type:59,g:2}});var t=this;this.type=61,this.h=e}function Ve(){}function Qe(e,t){return e.ab()===t.ab()&&e.bb()===t.bb()}function Je(e){if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)throw Error("FODT0002: Number of seconds given to construct DayTimeDuration overflows MAX_SAFE_INTEGER or MIN_SAFE_INTEGER");this.ea=e}function Ke(e){var t=Math.abs(e.Za()),n=Math.abs(e.getHours()),r=Math.abs(e.getMinutes());return n=(n?n+"H":"")+(r?r+"M":"")+((e=Math.abs(e.getSeconds()))?e+"S":""),(t=t?t+"D":"")&&n?t+"T"+n:t||(n?"T"+n:"T0S")}function ze(e,t,n,r,o,a){return e=86400*e+3600*t+60*n+r+o,new Je(a||0===e?e:-e)}function We(e){return(e=/^(-)?P(\d+Y)?(\d+M)?(\d+D)?(?:T(\d+H)?(\d+M)?(\d+(\.\d*)?S)?)?$/.exec(e))?ze(e[4]?parseInt(e[4],10):0,e[5]?parseInt(e[5],10):0,e[6]?parseInt(e[6],10):0,e[7]?parseInt(e[7],10):0,e[8]?parseFloat(e[8]):0,!e[1]):null}function Ze(e){return"Z"===(e=/^(Z)|([+-])([01]\d):([0-5]\d)$/.exec(e))[1]?ze(0,0,0,0,0,!0):ze(0,e[3]?parseInt(e[3],10):0,e[4]?parseInt(e[4],10):0,0,0,"+"===e[2])}function et(e,t){if(isNaN(t))throw Error("FOCA0005: Cannot multiply xs:dayTimeDuration by NaN");if((e=e.ea*t)>Number.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while multiplying xs:dayTimeDuration");return new Je(e<Number.MIN_SAFE_INTEGER||Object.is(-0,e)?0:e)}function tt(e){return e?parseInt(e,10):null}function nt(e){var t=(e+="").startsWith("-");return t&&(e=e.substring(1)),(t?"-":"")+e.padStart(4,"0")}function rt(e){return(e+"").padStart(2,"0")}function ot(e){return 1===(e+="").split(".")[0].length&&(e=e.padStart(e.length+1,"0")),e}function at(e){return 0===e.getHours()&&0===e.getMinutes()?"Z":(e.oa()?"+":"-")+rt(Math.abs(e.getHours()))+":"+rt(Math.abs(e.getMinutes()))}function it(e,t,n,r,o,a,i,s,u){this.A=e,this.h=t,this.s=n+(24===r?1:0),this.u=24===r?0:r,this.O=o,this.j=a,this.pa=i,this.Z=s,this.type=void 0===u?9:u}function st(e){var t=/^(?:(-?\d{4,}))?(?:--?(\d\d))?(?:-{1,3}(\d\d))?(T)?(?:(\d\d):(\d\d):(\d\d))?(\.\d+)?(Z|(?:[+-]\d\d:\d\d))?$/.exec(e);e=t[1]?parseInt(t[1],10):null;var n=tt(t[2]),r=tt(t[3]),o=t[4],a=tt(t[5]),i=tt(t[6]),s=tt(t[7]),u=t[8]?parseFloat(t[8]):0;if(t=t[9]?Ze(t[9]):null,e&&(-271821>e||273860<e))throw Error("FODT0001: Datetime year is out of bounds");return o?new it(e,n,r,a,i,s,u,t,9):null!==a&&null!==i&&null!==s?new it(1972,12,31,a,i,s,u,t,8):null!==e&&null!==n&&null!==r?new it(e,n,r,0,0,0,0,t,7):null!==e&&null!==n?new it(e,n,1,0,0,0,0,t,11):null!==n&&null!==r?new it(1972,n,r,0,0,0,0,t,13):null!==e?new it(e,1,1,0,0,0,0,t,12):null!==n?new it(1972,n,1,0,0,0,0,t,14):new it(1972,12,r,0,0,0,0,t,15)}function ut(e,t){switch(t){case 15:return new it(1972,12,e.s,0,0,0,0,e.Z,15);case 14:return new it(1972,e.h,1,0,0,0,0,e.Z,14);case 12:return new it(e.A,1,1,0,0,0,0,e.Z,12);case 13:return new it(1972,e.h,e.s,0,0,0,0,e.Z,13);case 11:return new it(e.A,e.h,1,0,0,0,0,e.Z,11);case 8:return new it(1972,12,31,e.u,e.O,e.j,e.pa,e.Z,8);case 7:return new it(e.A,e.h,e.s,0,0,0,0,e.Z,7);default:return new it(e.A,e.h,e.s,e.u,e.O,e.j,e.pa,e.Z,9)}}function ct(e,t){return t=e.Z||t||Ze("Z"),new Date(Date.UTC(e.A,e.h-1,e.s,e.u-t.getHours(),e.O-t.getMinutes(),e.j,1e3*e.pa))}function lt(e,t,n){var r=ct(e,n).getTime();return r===(n=ct(t,n).getTime())?e.pa===t.pa?0:e.pa>t.pa?1:-1:r>n?1:-1}function pt(e,t,n){return 0===lt(e,t,n)}function ht(e,t,n){return new Je(e=(ct(e,n).getTime()-ct(t,n).getTime())/1e3)}function ft(e){throw Error("Not implemented: adding durations to "+fe[e.type])}function dt(e){throw Error("Not implemented: subtracting durations from "+fe[e.type])}function mt(e,t){if(null===e)return null;switch(typeof e){case"boolean":return e?V:Q;case"number":return Y(e,3);case"string":return Y(e,1);case"object":if("nodeType"in e)return Xe({node:e,F:null});if(Array.isArray(e))return new _e(e.map((function(e){return void 0===e?function(){return ce.empty()}:le(e=null===(e=mt(e))?ce.empty():ce.o(e))})));if(e instanceof Date){var n=st(e.toISOString());return Y(n,n.type)}return new Ye(Object.keys(e).filter((function(t){return void 0!==e[t]})).map((function(t){var n=mt(e[t]);return n=null===n?ce.empty():ce.o(n),{key:Y(t,1),value:le(n)}})))}throw Error("Value "+String(e)+' of type "'+typeof e+'" is not adaptable to an XPath value.')}function gt(e,t){if("number"!=typeof e&&("string"!=typeof e||!$.get(t)(e)))throw Error("Cannot convert JavaScript value '"+e+"' to the XPath type "+fe[t]+" since it is not valid.")}function yt(e,t,n){if(null===t)return null;switch(e){case 0:return t?V:Q;case 1:return Y(t+"",1);case 3:case 2:return gt(t,3),Y(+t,3);case 4:return gt(t,e),Y(+t,4);case 5:return gt(t,e),Y(0|t,5);case 6:return gt(t,e),Y(+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 "+fe[e]+".");return Y(ut(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 "+fe[e]+".");return Xe({node:t,F:null});case 59:case 61:return mt(t);default:throw Error('Values of the type "'+fe[e]+'" can not be adapted from JavaScript to equivalent XPath values.')}}function vt(e,t,n){if(0===n.g)return null===(t=yt(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 "+me(n)+".");return t.map((function(e){return yt(n.type,e)})).filter((function(e){return null!==e}))}var r=yt(n.type,t);if(null===r)throw Error("The JavaScript value "+t+" should be a single entry if it is to be converted to "+me(n)+".");return[r]}function wt(e,t,n){return n=void 0===n?{type:59,g:0}:n,ce.create(vt(0,t,n))}function At(e,t){this.h=t=void 0===t?{vb:null,Ab:null,pb:!1}:t,this.Ja=e.Ja,this.Ga=e.Ga,this.N=e.N,this.Ea=e.Ea||Object.create(null)}function xt(e,t){var n=0,r=t.value;return{next:function(o){return(o=r.next(o)).done?z:W(Nt(e,n++,o.value,t))}}}function bt(e){return e.h.pb||(e.h.pb=!0,e.h.vb=st((new Date).toISOString()),e.h.Ab=We("PT0S")),e.h.vb}function Et(e){return e.h.pb||(e.h.pb=!0,e.h.vb=st((new Date).toISOString()),e.h.Ab=We("PT0S")),e.h.Ab}function Nt(e,t,n,r){return new At({N:n,Ja:t,Ga:r||e.Ga,Ea:e.Ea},e.h)}function Bt(e,t){return new At({N:e.N,Ja:e.Ja,Ga:e.Ga,Ea:Object.assign(Object.create(null),e.Ea,t)},e.h)}function Tt(e,t,n,r,o,a,i,s){var u=new Map;this.debug=e,this.Ha=t,this.h=n,this.s=r,this.A=o,this.u=a,this.ha=u,this.O=i,this.j=s}function It(e){var t=0,n=null,r=!0;return ce.create({next:function(o){for(;t<e.length;){n||(n=e[t].value,r=!0);var a=n.next(r?0:o);if(r=!1,!a.done)return a;t++,n=null}return z}})}function Ct(e,t,n){return Error("FORG0001: Cannot cast "+e+" to "+fe[t]+(n?", "+n:""))}function St(e){return Error("XPTY0004: "+e)}function Ot(e){return Error("FOTY0013: Atomization is not supported for "+fe[e]+".")}function Rt(e){return Error("XPST0081: The prefix "+e+" could not be resolved.")}function Dt(e,t){if(ee(e.type,46)||ee(e.type,19)||ee(e.type,0)||ee(e.type,4)||ee(e.type,3)||ee(e.type,6)||ee(e.type,5)||ee(e.type,2)||ee(e.type,23)||ee(e.type,1))return ce.create(e);var n=t.h;if(ee(e.type,53)){var r=e.value;if(2===r.node.nodeType||3===r.node.nodeType)return ce.create(Y(Ue(n,r),19));if(8===r.node.nodeType||7===r.node.nodeType)return ce.create(Y(Ue(n,r),1));var o=[];return function e(t){if(8!==r.node.nodeType&&7!==r.node.nodeType){var a=t.nodeType;3===a||4===a?o.push(n.getData(t)):1!==a&&9!==a||n.getChildNodes(t).forEach((function(t){e(t)}))}}(r.node),ce.create(Y(o.join(""),19))}if(ee(e.type,60)&&!ee(e.type,62))throw Ot(e.type);if(ee(e.type,62))return It(e.R.map((function(e){return Ut(e(),t)})));throw Error("Atomizing "+e.type+" is not implemented.")}function Ut(e,t){var n=!1,r=e.value,o=null;return ce.create({next:function(){for(;!n;){if(!o){var e=r.next(0);if(e.done){n=!0;break}o=Dt(e.value,t).value}if(!(e=o.next(0)).done)return e;o=null}return z}})}function Mt(e){for(e=q[e];e&&0!==e.D;)e=e.parent;return e?e.type:null}function kt(e,t){var n=(t=q[t]).Ia;if(!n||!n.whiteSpace)return t.parent?kt(e,t.parent.type):e;switch(t.Ia.whiteSpace){case"replace":return e.replace(/[\u0009\u000A\u000D]/g," ");case"collapse":return e.replace(/[\u0009\u000A\u000D]/g," ").replace(/ {2,}/g," ").replace(/^ | $/g,"")}return e}function Gt(e,t){for(t=q[t];t&&null===t.fb;){if(2===t.D||3===t.D)return!0;t=t.parent}return!t||t.fb(e)}function Ft(e,t){for(;e;){if(e.La&&e.La[t])return e.La[t];e=e.parent}return function(){return!0}}function Pt(e,t){return e(2)?function(e){return{v:!0,value:e}}:e(0)?function(e){return{v:!0,value:e?1:0}}:e(1)||e(19)?function(e){switch(e){case"NaN":return{v:!0,value:NaN};case"INF":case"+INF":return{v:!0,value:1/0};case"-INF":return{v:!0,value:-1/0};case"0":case"+0":return{v:!0,value:0};case"-0":return{v:!0,value:-0}}var n=parseFloat(e);return isNaN(n)?{v:!1,error:Ct(e,t)}:{v:!0,value:n}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to "+t+" or any of its derived types.")}}}function Ht(e){if(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)throw Error("FODT0002: Number of months given to construct YearMonthDuration overflows MAX_SAFE_INTEGER or MIN_SAFE_INTEGER");this.ga=e}function _t(e){var t=Math.abs(e.cb());return(t?t+"Y":"")+((e=Math.abs(e.$a()))?e+"M":"")||"0M"}function jt(e){var t=/^(-)?P(\d+Y)?(\d+M)?(\d+D)?(?:T(\d+H)?(\d+M)?(\d+(\.\d*)?S)?)?$/.exec(e);if(t){if(e=!t[1],(t=12*(t[2]?parseInt(t[2],10):0)+(t[3]?parseInt(t[3],10):0))>Number.MAX_SAFE_INTEGER||!Number.isFinite(t))throw Error("FODT0002: Value overflow while constructing xs:yearMonthDuration");e=new Ht(e||0===t?t:-t)}else e=null;return e}function Xt(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 Ht(e<Number.MIN_SAFE_INTEGER||0===e?0:e)}function Lt(e,t){this.Sa=e,this.Fa=t}(r=Te.prototype).insertBefore=function(e,t,n){return this.h.insertBefore(e,t,n)},r.removeAttributeNS=function(e,t,n){return this.h.removeAttributeNS(e,t,n)},r.removeChild=function(e,t){return this.h.removeChild(e,t)},r.setAttributeNS=function(e,t,n,r){this.h.setAttributeNS(e,t,n,r)},r.setData=function(e,t){this.h.setData(e,t)},Se.prototype.getAllAttributes=function(e,t){return Ie(e)?e.attributes:this.h.getAllAttributes(e,void 0===t?null:t)},Se.prototype.getChildNodes=function(e,t){return t=Ie(e)?e.childNodes:this.h.getChildNodes(e,void 0===t?null:t),9===e.nodeType?t.filter((function(e){return 10!==e.nodeType})):t},Se.prototype.getData=function(e){return Ie(e)?2===e.nodeType?e.value:e.data:this.h.getData(e)||""},Se.prototype.getParentNode=function(e,t){return this.h.getParentNode(e,void 0===t?null:t)},y(_e,we),y(Ye,we),(r=Ve.prototype).Za=function(){return 0},r.getHours=function(){return 0},r.getMinutes=function(){return 0},r.$a=function(){return 0},r.ab=function(){return 0},r.bb=function(){return 0},r.getSeconds=function(){return 0},r.cb=function(){return 0},r.oa=function(){return!0},y(Je,Ve),(r=Je.prototype).Za=function(){return Math.trunc(this.ea/86400)},r.getHours=function(){return Math.trunc(this.ea%86400/3600)},r.getMinutes=function(){return Math.trunc(this.ea%3600/60)},r.bb=function(){return this.ea},r.getSeconds=function(){var e=this.ea%60;return Object.is(-0,e)?0:e},r.oa=function(){return!Object.is(-0,this.ea)&&0<=this.ea},r.toString=function(){return(this.oa()?"P":"-P")+Ke(this)},(r=it.prototype).getDay=function(){return this.s},r.getHours=function(){return this.u},r.getMinutes=function(){return this.O},r.getMonth=function(){return this.h},r.getSeconds=function(){return this.j},r.getYear=function(){return this.A},r.toString=function(){switch(this.type){case 9:return nt(this.A)+"-"+rt(this.h)+"-"+rt(this.s)+"T"+rt(this.u)+":"+rt(this.O)+":"+ot(this.j+this.pa)+(this.Z?at(this.Z):"");case 7:return nt(this.A)+"-"+rt(this.h)+"-"+rt(this.s)+(this.Z?at(this.Z):"");case 8:return rt(this.u)+":"+rt(this.O)+":"+ot(this.j+this.pa)+(this.Z?at(this.Z):"");case 15:return"---"+rt(this.s)+(this.Z?at(this.Z):"");case 14:return"--"+rt(this.h)+(this.Z?at(this.Z):"");case 13:return"--"+rt(this.h)+"-"+rt(this.s)+(this.Z?at(this.Z):"");case 12:return nt(this.A)+(this.Z?at(this.Z):"");case 11:return nt(this.A)+"-"+rt(this.h)+(this.Z?at(this.Z):"")}throw Error("Unexpected subType")},y(Ht,Ve),(r=Ht.prototype).$a=function(){var e=this.ga%12;return 0===e?0:e},r.ab=function(){return this.ga},r.cb=function(){return Math.trunc(this.ga/12)},r.oa=function(){return!Object.is(-0,this.ga)&&0<=this.ga},r.toString=function(){return(this.oa()?"P":"-P")+_t(this)},y(Lt,Ve),(r=Lt.prototype).Za=function(){return this.Fa.Za()},r.getHours=function(){return this.Fa.getHours()},r.getMinutes=function(){return this.Fa.getMinutes()},r.$a=function(){return this.Sa.$a()},r.ab=function(){return this.Sa.ab()},r.bb=function(){return this.Fa.bb()},r.getSeconds=function(){return this.Fa.getSeconds()},r.cb=function(){return this.Sa.cb()},r.oa=function(){return this.Sa.oa()&&this.Fa.oa()},r.toString=function(){var e=this.oa()?"P":"-P",t=_t(this.Sa),n=Ke(this.Fa);return"0M"===t?e+n:"T0S"===n?e+t:e+t+n};var $t=[3,6,4,5];function qt(e){if(e(1)||e(19))return function(e){return{v:!0,value:e+""}};if(e(20))return function(e){return{v:!0,value:e}};if(e(23))return function(e){return{v:!0,value:e.prefix?e.prefix+":"+e.localName:e.localName}};if(e(44))return function(e){return{v:!0,value:e.toString()}};if(e(2)){if(e(5)||e(4))return function(e){return{v:!0,value:(e+"").replace("e","E")}};if(e(6)||e(3))return function(e){return isNaN(e)?{v:!0,value:"NaN"}:isFinite(e)?Object.is(e,-0)?{v:!0,value:"-0"}:{v:!0,value:(e+"").replace("e","E").replace("E+","E")}:{v:!0,value:(0>e?"-":"")+"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 Yt=[2,5,17,16];function Vt(e,t){function n(t){return ee(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=qt(e);return function(e){return(e=t(e)).v?{v:!0,value:Y(e.value,19)}:e}}(n);case 1:return function(e){var t=qt(e);return function(e){return(e=t(e)).v?{v:!0,value:Y(e.value,1)}:e}}(n);case 6:return function(e){var t=Pt(e,6);return function(e){return(e=t(e)).v?{v:!0,value:Y(e.value,6)}:e}}(n);case 3:return function(e){var t=Pt(e,3);return function(e){return(e=t(e)).v?{v:!0,value:Y(e.value,3)}:e}}(n);case 4:return function(e){return e(5)?function(e){return{v:!0,value:Y(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:Y(e,4)}}:e(0)?function(e){return{v:!0,value:Y(e?1:0,4)}}:e(1)||e(19)?function(e){var t=parseFloat(e);return!isNaN(t)||isFinite(t)?{v:!0,value:Y(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:Y(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:Y(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:Ct(e,5)}:Number.isSafeInteger(t)?{v:!0,value:Y(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=Vt;return function(n){for(var r=c($t),o=r.next();!o.done;o=r.next())if((o=t(e,o.value)(n)).v)return o;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:Y(new Lt(e,new Je(e.oa()?0:-0)),18)}}:e(17)?function(e){return{v:!0,value:Y(e=new Lt(new Ht(e.oa()?0:-0),e),18)}}:e(18)?function(e){return{v:!0,value:Y(e,18)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(new Lt(jt(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:Y(e.Sa,16)}}:e(17)?function(){return{v:!0,value:Y(jt("P0M"),16)}}:e(19)||e(1)?function(e){var t=jt(e);return t?{v:!0,value:Y(t,16)}:{v:!1,error:Ct(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:Y(e.Fa,17)}}:e(16)?function(){return{v:!0,value:Y(We("PT0.0S"),17)}}:e(19)||e(1)?function(e){var t=We(e);return t?{v:!0,value:Y(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:Y(ut(e,9),9)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,8),8)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,7),7)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,11),11)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,12),12)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,13),13)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,15),15)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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:Y(ut(e,14),14)}}:e(19)||e(1)?function(e){return{v:!0,value:Y(st(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)?Q:V}}:e(1)||e(19)?function(e){switch(e){case"true":case"1":return{v:!0,value:V};case"false":case"0":return{v:!0,value:Q};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;n<e.length;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return{v:!0,value:Y(btoa(t),21)}}:e(1)||e(19)?function(e){return{v:!0,value:Y(e,21)}}:function(){return{error:Error("XPTY0004: Casting not supported from given type to xs:base64Binary or any of its derived types."),v:!1}}}(n);case 22:return function(e){return e(21)?function(e){for(var t="",n=0,r=(e=atob(e)).length;n<r;n++)t+=Number(e.charCodeAt(n)).toString(16);return{v:!0,value:Y(t.toUpperCase(),22)}}:e(1)||e(19)?function(e){return{v:!0,value:Y(e,22)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:hexBinary or any of its derived types.")}}}(n);case 20:return function(e){return e(1)||e(19)?function(e){return{v:!0,value:Y(e,20)}}:function(){return{v:!1,error:Error("XPTY0004: Casting not supported from given type to xs:anyURI or any of its derived types.")}}}(n);case 23:throw Error("Casting to xs:QName is not implemented.")}return function(){return{v:!1,error:Error("XPTY0004: Casting not supported from "+e+" to "+t+".")}}}var Qt=Object.create(null);function Jt(e,t){if(19===e&&1===t)return function(e){return{v:!0,value:Y(e,1)}};if(44===t)return function(){return{v:!1,error:Error("XPST0080: Casting to xs:NOTATION is not permitted.")}};if(39===t)return function(){return{v:!1,error:Error("FORG0001: Casting to xs:error is not permitted.")}};if(45===e||45===t)return function(){return{v:!1,error:Error("XPST0080: Casting from or to xs:anySimpleType is not permitted.")}};if(46===e||46===t)return function(){return{v:!1,error:Error("XPST0080: Casting from or to xs:anyAtomicType is not permitted.")}};if(ee(e,60)&&1===t)return function(){return{v:!1,error:Error("FOTY0014: Casting from function item to xs:string is not permitted.")}};if(e===t)return function(e){return{v:!0,value:{type:t,value:e}}};var n=Yt.includes(e)?e:Mt(e),r=Yt.includes(t)?t:Mt(t);if(null===r||null===n)return function(){return{v:!1,error:Error("XPST0081: Can not cast: type "+(r?fe[e]:fe[t])+" is unknown.")}};var o=[];return 1!==n&&19!==n||o.push((function(e){var n=kt(e,t);return Gt(n,t)?{v:!0,value:n}:{v:!1,error:Ct(e,t,"pattern validation failed.")}})),n!==r&&(o.push(Vt(n,r)),o.push((function(e){return{v:!0,value:e.value}}))),19!==r&&1!==r||o.push((function(e){return Gt(e,t)?{v:!0,value:e}:{v:!1,error:Ct(e,t,"pattern validation failed.")}})),o.push((function(e){return function(e,t){for(var n=q[t];n;){if(n.Ia&&!Object.keys(n.Ia).every((function(t){if("whiteSpace"===t)return!0;var r=Ft(n,t);return!r||r(e,n.Ia[t])})))return!1;n=n.parent}return!0}(e,t)?{v:!0,value:e}:{v:!1,error:Ct(e,t,"pattern validation failed.")}})),o.push((function(e){return{v:!0,value:{type:t,value:e}}})),function(e){e={v:!0,value:e};for(var t=0,n=o.length;t<n&&!1!==(e=o[t](e.value)).v;++t);return e}}function Kt(e,t){var n=e.type+1e4*t,r=Qt[n];return r||(r=Qt[n]=Jt(e.type,t)),r.call(void 0,e.value,t)}function zt(e,t){if(!0===(e=Kt(e,t)).v)return e.value;throw e.error}function Wt(e){var t=!1;return{next:function(){return t?z:(t=!0,W(e))}}}function Zt(e,t){return e===t||!(!e||!t||e.offset!==t.offset||e.parent!==t.parent)&&Zt(e.F,t.F)}function en(e,t){return!!(e===t||e.node===t.node&&Zt(e.F,t.F))}function tn(e,t){for(var n=[];t;t=Fe(e,t,null))n.unshift(t);return n}function nn(e,t){for(var n=[];t;t=e.getParentNode(t,null))n.unshift(t);return n}function rn(e,t,n,r){if(n.F||r.F||Ie(n.node)||Ie(r.node)){if(en(n,r))return 0;n=tn(t,n),r=tn(t,r);var o=n[0],a=r[0];if(!en(o,a))return t=e.findIndex((function(e){return en(e,o)})),n=e.findIndex((function(e){return en(e,a)})),-1===t&&(t=e.push(o)),-1===n&&(n=e.push(a)),t-n;e=1;for(var i=Math.min(n.length,r.length);e<i&&en(n[e],r[e]);++e);return n[e]?r[e]?function(e,t,n){var r=Fe(e,t,null);e=De(e,r,null),r=0;for(var o=e.length;r<o;++r){var a=e[r];if(en(a,t))return-1;if(en(a,n))return 1}}(t,n[e],r[e]):1:-1}if((n=n.node)===(r=r.node))return 0;if(n=nn(t,n),r=nn(t,r),n[0]!==r[0]){var s={node:n[0],F:null},u={node:r[0],F:null};return t=e.findIndex((function(e){return en(e,s)})),n=e.findIndex((function(e){return en(e,u)})),-1===t&&(t=e.push(s)),-1===n&&(n=e.push(u)),t-n}for(i=1,e=Math.min(n.length,r.length);i<e&&n[i]===r[i];++i);if(e=n[i],n=r[i],!e)return-1;if(!n)return 1;for(t=t.getChildNodes(r[i-1],null),r=0,i=t.length;r<i;++r){var c=t[r];if(c===e)return-1;if(c===n)return 1}}function on(e,t,n,r){var o=ee(n.type,47),a=ee(r.type,47);if(o&&!a){if(en(n=Fe(t,n.value),r=r.value))return 1}else if(a&&!o){if(en(n=n.value,r=Fe(t,r.value)))return-1}else if(o&&a){if(en(Fe(t,r.value),Fe(t,n.value)))return n.value.node.localName>r.value.node.localName?1:-1;n=Fe(t,n.value),r=Fe(t,r.value)}else n=n.value,r=r.value;return rn(e,t,n,r)}function an(e,t,n){return on(e.s,e,t,n)}function sn(e,t){return cn(t,(function(t,n){return on(e.s,e,t,n)})).filter((function(e,t,n){return 0===t||!en(e.value,n[t-1].value)}))}function un(e,t){return e<t?-1:0}function cn(e,t){if(t=void 0===t?un:t,1>=e.length)return e;var n=Math.floor(e.length/2),r=cn(e.slice(0,n),t);for(e=cn(e.slice(n),t),n=[];r.length&&e.length;)0>t(r[0],e[0])?n.push(r.shift()):n.push(e.shift());return n.concat(r.concat(e))}var ln=e;function pn(e,t,n,r,o){if(ee(e.type,t.type))return e;if(ee(t.type,46)&&ee(e.type,53)&&(e=Dt(e,n).first()),ee(e.type,t.type)||46===t.type)return e;if(ee(e.type,19)){if(!(n=zt(e,t.type)))throw Error("XPTY0004 Unable to convert "+(o?"return":"argument")+" of type "+fe[e.type]+" to type "+me(t)+" while calling "+r);return n}if(n=function(e,t){if(ee(e.type,2)){if(ee(e.type,6))return 3===t?Y(e.value,3):null;if(ee(e.type,4)){if(6===t)return Y(e.value,6);if(3===t)return Y(e.value,3)}return null}return ee(e.type,20)&&1===t?Y(e.value,1):null}(e,t.type),!n)throw Error("XPTY0004 Unable to cast "+(o?"return":"argument")+" of type "+fe[e.type]+" to type "+me(t)+" while calling "+r);return n}function hn(e){switch(e){case 2:return"*";case 1:return"+";case 0:return"?";case 3:return""}}function fn(e,t,n,r,o){return 0===e.g?t.$({default:function(){return t.map((function(t){return pn(t,e,n,r,o)}))},multiple:function(){throw Error("XPTY0004: Multiplicity of "+(o?"function return value":"function argument")+" of type "+fe[e.type]+hn(e.g)+" for "+r+' is incorrect. Expected "?", but got "+".')}}):1===e.g?t.$({empty:function(){throw Error("XPTY0004: Multiplicity of "+(o?"function return value":"function argument")+" of type "+fe[e.type]+hn(e.g)+" for "+r+' is incorrect. Expected "+", but got "empty-sequence()"')},default:function(){return t.map((function(t){return pn(t,e,n,r,o)}))}}):2===e.g?t.map((function(t){return pn(t,e,n,r,o)})):t.$({o:function(){return t.map((function(t){return pn(t,e,n,r,o)}))},default:function(){throw Error("XPTY0004: Multiplicity of "+(o?"function return value":"function argument")+" of type "+fe[e.type]+hn(e.g)+" for "+r+" is incorrect. Expected exactly one")}})}function dn(e,t){return ee(e,5)?Y(t,5):ee(e,6)?Y(t,6):ee(e,3)?Y(t,3):Y(t,4)}function mn(e,t,n,r,o,a){var i=!1;return ce.create({next:function(){if(i)return z;var t,n=o.first();if(!n)return i=!0,z;if((ee(n.type,6)||ee(n.type,3))&&(0===n.value||isNaN(n.value)||1/0===n.value||-1/0===n.value))return i=!0,W(n);if(t=a?a.first().value:0,i=!0,function(e){if(Math.floor(e)===e||isNaN(e))return 0;var t=(e=/\d+(?:\.(\d*))?(?:[Ee](-)?(\d+))*/.exec(e+""))[1]?e[1].length:0;return e[3]?e[2]?t+parseInt(e[3],10):0>(e=t-parseInt(e[3],10))?0:e:t}(n.value)<t)return W(n);var r=[5,4,3,6].find((function(e){return ee(n.type,e)}));switch(t=function(e,t,n){return t&&0==e*n%1%.5?0==Math.floor(e*n)%2?Math.floor(e*n)/n:Math.ceil(e*n)/n:Math.round(e*n)/n}(zt(n,4).value,e,Math.pow(10,t)),r){case 4:return W(Y(t,4));case 3:return W(Y(t,3));case 6:return W(Y(t,6));case 5:return W(Y(t,5))}}})}function gn(e,t,n,r){return Ut(r,t).$({empty:function(){return ce.o(Y(NaN,3))},o:function(){var e=Kt(r.first(),3);return e.v?ce.o(e.value):ce.o(Y(NaN,3))},multiple:function(){throw Error("fn:number may only be called with zero or one values")}})}function yn(e,t,n,r){return r.G()?r:(e=r.M(),ce.o(e[Math.floor(Math.random()*e.length)]))}var vn=[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"abs",l:[{type:2,g:0}],i:{type:2,g:0},m:function(e,t,n,r){return r.map((function(e){return dn(e.type,Math.abs(e.value))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"ceiling",l:[{type:2,g:0}],i:{type:2,g:0},m:function(e,t,n,r){return r.map((function(e){return dn(e.type,Math.ceil(e.value))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"floor",l:[{type:2,g:0}],i:{type:2,g:0},m:function(e,t,n,r){return r.map((function(e){return dn(e.type,Math.floor(e.value))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"round",l:[{type:2,g:0}],i:{type:2,g:0},m:mn.bind(null,!1)},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"round",l:[{type:2,g:0},{type:5,g:3}],i:{type:2,g:0},m:mn.bind(null,!1)},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"round-half-to-even",l:[{type:2,g:0}],i:{type:2,g:0},m:mn.bind(null,!0)},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"round-half-to-even",l:[{type:2,g:0},{type:5,g:3}],i:{type:2,g:0},m:mn.bind(null,!0)},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"number",l:[{type:46,g:0}],i:{type:3,g:3},m:gn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"number",l:[],i:{type:3,g:3},m:function(e,t,n){var r=e.N&&fn({type:46,g:0},ce.o(e.N),t,"fn:number",!1);if(!r)throw Error("XPDY0002: fn:number needs an atomizable context item.");return gn(0,t,0,r)}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"random-number-generator",l:[],i:{type:61,g:3},m:function e(){return ce.o(new Ye([{key:Y("number",1),value:function(){return ce.o(Y(Math.random(),3))}},{key:Y("next",1),value:function(){return ce.o(new we({value:e,Pa:!0,localName:"",namespaceURI:"",l:[],arity:0,i:{type:61,g:3}}))}},{key:Y("permute",1),value:function(){return ce.o(new we({value:yn,Pa:!0,localName:"",namespaceURI:"",l:[{type:59,g:2}],arity:1,i:{type:59,g:2}}))}}]))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"random-number-generator",l:[{type:46,g:0}],i:{type:61,g:3},m:function(){throw Error("Not implemented: Specifying a seed is not supported")}}];function wn(){throw Error("FOCH0002: No collations are supported")}function An(e,t,n,r){if(null===t.N)throw Error("XPDY0002: The function which was called depends on dynamic context, which is absent.");return e(t,n,r,ce.o(t.N))}function xn(e,t,n,r){return r.$({empty:function(){return ce.o(Y("",1))},default:function(){return r.map((function(e){if(ee(e.type,53)){var n=Dt(e,t).first();return ee(e.type,47)?zt(n,1):n}return zt(e,1)}))}})}function bn(e,t,n,r,o){return Le([o],(function(e){var n=c(e).next().value;return Ut(r,t).L((function(e){return e=e.map((function(e){return zt(e,1).value})).join(n.value),ce.o(Y(e,1))}))}))}function En(e,t,n,r){return r.G()?ce.o(Y(0,5)):(e=r.first().value,ce.o(Y(Array.from(e).length,5)))}function Nn(e,t,n,r,o,a){var i=mn(!1,0,0,0,o,null),s=null!==a?mn(!1,0,0,0,a,null):null,u=!1,c=null,l=null,p=null;return ce.create({next:function(){return u?z:c||null!==(c=r.first())?(l||(l=i.first()),!p&&a&&(p=null,p=s.first()),u=!0,W(Y(Array.from(c.value).slice(Math.max(l.value-1,0),a?l.value+p.value-1:void 0).join(""),1))):(u=!0,W(Y("",1)))}})}function Bn(e,t,n,r,o){return r.G()||0===r.first().value.length?ce.empty():(e=r.first().value,o=Sn(o=o.first().value),ce.create(e.split(o).map((function(e){return Y(e,1)}))))}function Tn(e,t,n,r){return r.G()?ce.o(Y("",1)):(e=r.first().value.trim(),ce.o(Y(e.replace(/\s+/g," "),1)))}var In=new Map,Cn=new Map;function Sn(e){if(Cn.has(e))return Cn.get(e);try{var t=new RegExp(e,"g")}catch(e){throw Error("FORX0002: "+e)}if(t.test(""))throw Error("FORX0003: the pattern "+e+" matches the zero length string");return Cn.set(e,t),t}var On=[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"compare",l:[{type:1,g:0},{type:1,g:0}],i:{type:5,g:0},m:function(e,t,n,r,o){return r.G()||o.G()?ce.empty():(e=r.first().value)>(o=o.first().value)?ce.o(Y(1,5)):e<o?ce.o(Y(-1,5)):ce.o(Y(0,5))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"compare",l:[{type:1,g:0},{type:1,g:0},{type:1,g:3}],i:{type:5,g:0},m:wn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"concat",l:[{type:46,g:0},{type:46,g:0},4],i:{type:1,g:3},m:function(e,t,n,r){for(var o=[],a=3;a<arguments.length;++a)o[a-3]=arguments[a];return o=o.map((function(e){return Ut(e,t).L((function(e){return ce.o(Y(e.map((function(e){return null===e?"":zt(e,1).value})).join(""),1))}))})),Le(o,(function(e){return ce.o(Y(e.map((function(e){return e.value})).join(""),1))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"contains",l:[{type:1,g:0},{type:1,g:0},{type:1,g:0}],i:{type:0,g:3},m:wn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"contains",l:[{type:1,g:0},{type:1,g:0}],i:{type:0,g:3},m:function(e,t,n,r,o){return e=r.G()?"":r.first().value,0===(o=o.G()?"":o.first().value).length?ce.ca():0===e.length?ce.X():e.includes(o)?ce.ca():ce.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"ends-with",l:[{type:1,g:0},{type:1,g:0}],i:{type:0,g:3},m:function(e,t,n,r,o){return 0===(e=o.G()?"":o.first().value).length?ce.ca():0===(r=r.G()?"":r.first().value).length?ce.X():r.endsWith(e)?ce.ca():ce.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"ends-with",l:[{type:1,g:0},{type:1,g:0},{type:1,g:3}],i:{type:0,g:3},m:wn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"normalize-space",l:[{type:1,g:0}],i:{type:1,g:3},m:Tn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"normalize-space",l:[],i:{type:1,g:3},m:An.bind(null,(function(e,t,n,r){return Tn(e,0,0,xn(0,t,0,r))}))},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"starts-with",l:[{type:1,g:0},{type:1,g:0}],i:{type:0,g:3},m:function(e,t,n,r,o){return 0===(e=o.G()?"":o.first().value).length?ce.ca():0===(r=r.G()?"":r.first().value).length?ce.X():r.startsWith(e)?ce.ca():ce.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"starts-with",l:[{type:1,g:0},{type:1,g:0},{type:1,g:3}],i:{type:0,g:3},m:wn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"string",l:[{type:59,g:0}],i:{type:1,g:3},m:xn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"string",l:[],i:{type:1,g:3},m:An.bind(null,xn)},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"substring-before",l:[{type:1,g:0},{type:1,g:0}],i:{type:1,g:3},m:function(e,t,n,r,o){return e=r.G()?"":r.first().value,""===(o=o.G()?"":o.first().value)||-1===(o=e.indexOf(o))?ce.o(Y("",1)):ce.o(Y(e.substring(0,o),1))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"substring-after",l:[{type:1,g:0},{type:1,g:0}],i:{type:1,g:3},m:function(e,t,n,r,o){return e=r.G()?"":r.first().value,""===(o=o.G()?"":o.first().value)?ce.o(Y(e,1)):-1===(t=e.indexOf(o))?ce.o(Y("",1)):ce.o(Y(e.substring(t+o.length),1))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"substring",l:[{type:1,g:0},{type:3,g:3}],i:{type:1,g:3},m:Nn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"substring",l:[{type:1,g:0},{type:3,g:3},{type:3,g:3}],i:{type:1,g:3},m:Nn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"upper-case",l:[{type:1,g:0}],i:{type:1,g:3},m:function(e,t,n,r){return r.G()?ce.o(Y("",1)):r.map((function(e){return Y(e.value.toUpperCase(),1)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"lower-case",l:[{type:1,g:0}],i:{type:1,g:3},m:function(e,t,n,r){return r.G()?ce.o(Y("",1)):r.map((function(e){return Y(e.value.toLowerCase(),1)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"string-join",l:[{type:46,g:2},{type:1,g:3}],i:{type:1,g:3},m:bn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"string-join",l:[{type:46,g:2}],i:{type:1,g:3},m:function(e,t,n,r){return bn(0,t,0,r,ce.o(Y("",1)))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"string-length",l:[{type:1,g:0}],i:{type:5,g:3},m:En},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"string-length",l:[],i:{type:5,g:3},m:An.bind(null,(function(e,t,n,r){return En(e,0,0,xn(0,t,0,r))}))},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"tokenize",l:[{type:1,g:0},{type:1,g:3},{type:1,g:3}],i:{type:1,g:2},m:function(){throw Error("Not implemented: Using flags in tokenize is not supported")}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"tokenize",l:[{type:1,g:0},{type:1,g:3}],i:{type:1,g:2},m:Bn},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"tokenize",l:[{type:1,g:0}],i:{type:1,g:2},m:function(e,t,n,r){return Bn(e,0,0,Tn(e,0,0,r),ce.o(Y(" ",1)))}},{l:[{type:1,g:0},{type:1,g:3},{type:1,g:3}],m:function(e,t,n,r,o,a){return Le([r,o,a],(function(e){var t=c(e),n=t.next().value;e=t.next().value,t=t.next().value,n=Array.from(n?n.value:"");var r=Array.from(e.value),o=Array.from(t.value);return e=n.map((function(e){return r.includes(e)?(e=r.indexOf(e))<=o.length?o[e]:void 0:e})),ce.o(Y(e.join(""),1))}))},localName:"translate",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:5,g:2}],m:function(e,t,n,r){return r.L((function(e){return e=e.map((function(e){if(9===(e=e.value)||10===e||13===e||32<=e&&55295>=e||57344<=e&&65533>=e||65536<=e&&1114111>=e)return String.fromCodePoint(e);throw Error("FOCH0001")})).join(""),ce.o(Y(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 Le([r],(function(e){return 0===(e=(e=c(e).next().value)?e.value.split(""):[]).length?ce.empty():ce.create(e.map((function(e){return Y(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 Le([r],(function(e){return null===(e=c(e).next().value)||0===e.value.length?ce.create(Y("",1)):ce.create(Y(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 Le([r],(function(e){return null===(e=c(e).next().value)||0===e.value.length?ce.create(Y("",1)):ce.create(Y(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,o){return Le([r,o],(function(e){var t=c(e);if(e=t.next().value,t=t.next().value,null===e||null===t)return ce.empty();if(e=e.value,t=t.value,e.length!==t.length)return ce.X();e=e.split(""),t=t.split("");for(var n=0;n<e.length;n++)if(e[n].codePointAt(0)!==t[n].codePointAt(0))return ce.X();return ce.ca()}))},localName:"codepoint-equal",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:0}},{l:[{type:1,g:0},{type:1,g:3}],m:function(e,t,n,r,o){return Le([r,o],(function(e){var t=c(e);e=t.next().value,t=t.next().value,e=e?e.value:"",t=t.value;var n=In.get(t);if(!n){try{n=ln.compile(t,{language:"xpath"})}catch(e){throw Error("FORX0002: "+e)}In.set(t,n)}return n(e)?ce.ca():ce.X()}))},localName:"matches",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[{type:1,g:0},{type:1,g:3},{type:1,g:3}],m:function(e,t,n,r,o,a){return Le([r,o,a],(function(e){var t=c(e);e=t.next().value;var n=t.next().value;if(t=t.next().value,e=e?e.value:"",n=n.value,(t=t.value).includes("$0"))throw Error("Using $0 in fn:replace to replace substrings with full matches is not supported.");return t=t.split(/((?:\$\$)|(?:\\\$)|(?:\\\\))/).map((function(e){switch(e){case"\\$":return"$$";case"\\\\":return"\\";case"$$":throw Error('FORX0004: invalid replacement: "$$"');default:return e}})).join(""),n=Sn(n),e=e.replace(n,t),ce.o(Y(e,1))}))},localName:"replace",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:1,g:0},{type:1,g:3},{type:1,g:3},{type:1,g:3}],localName:"replace",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3},m:function(){throw Error("Not implemented: Using flags in replace is not supported")}}];function Rn(e,t,n,r){if(null===t.N)throw Error("XPDY0002: The function which was called depends on dynamic context, which is absent.");return e(t,n,r,ce.o(t.N))}function Dn(e,t,n,r){return Le([r],(function(e){if(null===(e=c(e).next().value))return ce.empty();switch((e=e.value).node.nodeType){case 1:case 2:return ce.o(Y(new ve(e.node.prefix,e.node.namespaceURI,e.node.localName),23));case 7:return ce.o(Y(new ve("","",e.node.target),23));default:return ce.empty()}}))}function Un(e,t,n,r){return r.$({default:function(){return xn(0,t,0,Dn(0,0,0,r))},empty:function(){return ce.empty()}})}function Mn(e,t,n,r){return Ut(r,t)}function kn(e,t,n,r){return Le([r],(function(e){return null!==(e=(e=c(e).next().value)?e.value:null)&&Me(t.h,e,null)?ce.ca():ce.X()}))}function Gn(e,t,n,r){return Le([r],(function(e){function n(e){for(var t=0,n=e;null!==n;)(e.node.nodeType!==n.node.nodeType?0:1===n.node.nodeType?n.node.localName===e.node.localName&&n.node.namespaceURI===e.node.namespaceURI:7===n.node.nodeType?n.node.target===e.node.target:1)&&t++,n=Pe(o,n,null);return t}var r=c(e).next().value;if(null===r)return ce.empty();var o=t.h;for(e="",r=r.value;null!==Fe(t.h,r,null);r=Fe(t.h,r,null))switch(r.node.nodeType){case 1:var a=r;e="/Q{"+(a.node.namespaceURI||"")+"}"+a.node.localName+"["+n(a)+"]"+e;break;case 2:e="/@"+((a=r).node.namespaceURI?"Q{"+a.node.namespaceURI+"}":"")+a.node.localName+e;break;case 3:e="/text()["+n(r)+"]"+e;break;case 7:e="/processing-instruction("+(a=r).node.target+")["+n(a)+"]"+e;break;case 8:e="/comment()["+n(r)+"]"+e}return 9===r.node.nodeType?ce.create(Y(e||"/",1)):ce.create(Y("Q{http://www.w3.org/2005/xpath-functions}root()"+e,1))}))}function Fn(e,t,n,r){return r.map((function(e){return Y(e.value.node.namespaceURI||"",20)}))}function Pn(e,t,n,r){return r.$({default:function(){return r.map((function(e){return 7===e.value.node.nodeType?Y(e.value.node.target,1):Y(e.value.node.localName||"",1)}))},empty:function(){return ce.o(Y("",1))}})}function Hn(e,t,n){if(2===t.node.nodeType)return en(t,n);for(;n;){if(en(t,n))return!0;if(9===n.node.nodeType)break;n=Fe(e,n,null)}return!1}function _n(e,t,n,r){return r.map((function(e){if(!ee(e.type,53))throw Error("XPTY0004 Argument passed to fn:root() should be of the type node()");for(e=e.value;e;){var n=e;e=Fe(t.h,n,null)}return Xe(n)}))}var jn=[{l:[{type:53,g:0}],m:Un,localName:"name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:0}},{l:[],m:Rn.bind(null,Un),localName:"name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:53,g:3}],m:Fn,localName:"namespace-uri",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:20,g:3}},{l:[],m:Rn.bind(null,Fn),localName:"namespace-uri",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:20,g:3}},{l:[{type:53,g:2}],m:function(e,t,n,r){return r.L((function(e){return e.length?(e=sn(t.h,e).reduceRight((function(e,n,r,o){return r===o.length-1?(e.push(n),e):(Hn(t.h,n.value,e[0].value)||e.unshift(n),e)}),[]),ce.create(e)):ce.empty()}))},localName:"innermost",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:53,g:2}},{l:[{type:53,g:2}],m:function(e,t,n,r){return r.L((function(e){return e.length?(e=sn(t.h,e).reduce((function(e,n,r){return 0===r?(e.push(n),e):(Hn(t.h,e[e.length-1].value,n.value)||e.push(n),e)}),[]),ce.create(e)):ce.empty()}),1)},localName:"outermost",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:53,g:2}},{l:[{type:53,g:0}],m:kn,localName:"has-children",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[],m:Rn.bind(null,kn),localName:"has-children",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:0,g:3}},{l:[{type:53,g:0}],m:Gn,localName:"path",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:0}},{l:[],m:Rn.bind(null,Gn),localName:"path",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:0}},{l:[{type:53,g:0}],m:Dn,localName:"node-name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:23,g:0}},{l:[],m:Rn.bind(null,Dn),localName:"node-name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:23,g:0}},{l:[{type:53,g:0}],m:Pn,localName:"local-name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[],m:Rn.bind(null,Pn),localName:"local-name",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}},{l:[{type:53,g:0}],m:_n,localName:"root",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:53,g:0}},{l:[],m:Rn.bind(null,_n),localName:"root",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:53,g:0}},{l:[],m:Rn.bind(null,Mn),localName:"data",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:2}},{l:[{type:59,g:2}],m:Mn,localName:"data",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:46,g:2}}];function Xn(e,t){var n=0,r=e.length,o=!1,a=null;return{next:function(){if(!o){for(;n<r;){a||(a=t(e[n],n,e));var i=a.next(0);if(a=null,!i.value)return W(!1);n++}return o=!0,W(!0)}return z}}}function Ln(e){return 1===(e=e.node.nodeType)||3===e}function $n(e,t){if((ee(e.type,4)||ee(e.type,6))&&(ee(t.type,4)||ee(t.type,6))){var n=zt(e,6),r=zt(t,6);return n.value===r.value||isNaN(e.value)&&isNaN(t.value)}return(ee(e.type,4)||ee(e.type,6)||ee(e.type,3))&&(ee(t.type,4)||ee(t.type,6)||ee(t.type,3))?(n=zt(e,3),r=zt(t,3),n.value===r.value||isNaN(e.value)&&isNaN(t.value)):ee(e.type,23)&&ee(t.type,23)?e.value.namespaceURI===t.value.namespaceURI&&e.value.localName===t.value.localName:(ee(e.type,9)||ee(e.type,7)||ee(e.type,8)||ee(e.type,11)||ee(e.type,12)||ee(e.type,13)||ee(e.type,14)||ee(e.type,15))&&(ee(t.type,9)||ee(t.type,7)||ee(t.type,8)||ee(t.type,11)||ee(t.type,12)||ee(t.type,13)||ee(t.type,14)||ee(t.type,15))?pt(e.value,t.value):(ee(e.type,16)||ee(e.type,17)||ee(e.type,18))&&(ee(t.type,16)||ee(t.type,17)||ee(t.type,17))?Qe(e.value,t.value):e.value===t.value}function qn(e,t,n){return n=c([t,n].map((function(t){return{type:1,value:t.reduce((function(t,n){return t+Dt(n,e).first().value}),"")}}))),W($n(t=n.next().value,n=n.next().value))}function Yn(e,t,n,r){for(;e.value&&ee(e.value.type,56);){t.push(e.value);var o=Ge(r,e.value.value);if(e=n.next(0),o&&3!==o.node.nodeType)break}return e}function Vn(e,t,n,r,o){var a,i=t.h,s=r.value,u=o.value,c=null,l=null,p=null,h=[],f=[];return{next:function(){for(;!a;)if(c||(c=s.next(0)),c=Yn(c,h,s,i),l||(l=u.next(0)),l=Yn(l,f,u,i),h.length||f.length){var r=qn(t,h,f);if(h.length=0,f.length=0,!1===r.value)return a=!0,r}else{if(c.done||l.done)return a=!0,W(c.done===l.done);if(p||(p=Jn(e,t,n,c.value,l.value)),r=p.next(0),p=null,!1===r.value)return a=!0,r;l=c=null}return z}}}function Qn(e,t,n,r,o){return r=De(t.h,r.value),o=De(t.h,o.value),r=r.filter((function(e){return Ln(e)})),o=o.filter((function(e){return Ln(e)})),r=ce.create(r.map((function(e){return Xe(e)}))),o=ce.create(o.map((function(e){return Xe(e)}))),Vn(e,t,n,r,o)}function Jn(e,t,n,r,o){if(ee(r.type,46)&&ee(o.type,46))return Wt($n(r,o));if(ee(r.type,61)&&ee(o.type,61))return function(e,t,n,r,o){return r.h.length!==o.h.length?Wt(!1):Xn(r.h,(function(r){var a=o.h.find((function(e){return $n(e.key,r.key)}));return a?Vn(e,t,n,r.value(),a.value()):Wt(!1)}))}(e,t,n,r,o);if(ee(r.type,62)&&ee(o.type,62))return function(e,t,n,r,o){return r.R.length!==o.R.length?Wt(!1):Xn(r.R,(function(r,a){return a=o.R[a],Vn(e,t,n,r(),a())}))}(e,t,n,r,o);if(ee(r.type,53)&&ee(o.type,53)){if(ee(r.type,55)&&ee(o.type,55))return Qn(e,t,n,r,o);if(ee(r.type,54)&&ee(o.type,54))return function(e,t,n,r,o){var a=Vn(e,t,n,Dn(0,0,0,ce.o(r)),Dn(0,0,0,ce.o(o))),i=Qn(e,t,n,r,o);r=Oe(t.h,r.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)})),o=Oe(t.h,o.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=Vn(e,t,n,ce.create(r),ce.create(o)),u=!1;return{next:function(){if(u)return z;var e=a.next(0);return!e.done&&!1===e.value||!(e=s.next(0)).done&&!1===e.value?(u=!0,e):(e=i.next(0),u=!0,e)}}}(e,t,n,r,o);if(ee(r.type,47)&&ee(o.type,47)||ee(r.type,57)&&ee(o.type,57)||ee(r.type,58)&&ee(o.type,58))return function(e,t,n,r,o){var a=Vn(e,t,n,Dn(0,0,0,ce.o(r)),Dn(0,0,0,ce.o(o))),i=!1;return{next:function(){if(i)return z;var e=a.next(0);return e.done||!1!==e.value?W($n(Dt(r,t).first(),Dt(o,t).first())):(i=!0,e)}}}(e,t,n,r,o)}return Wt(!1)}function Kn(e){return Error("XUST0001: "+(void 0===e?"Can not execute an updating expression in a non-updating context.":e))}function zn(e){return Error("XUTY0004: The attribute "+e.name+'="'+e.value+'" follows a node that is not an attribute node.')}function Wn(){return Error("XUTY0005: The target of a insert expression with into must be a single element or document node.")}function Zn(){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 er(){return Error("XUTY0008: The target of a replace expression must be a single element, attribute, text, comment, or processing instruction node.")}function tr(){return Error("XUTY0012: The target of a rename expression must be a single element, attribute, or processing instruction node.")}function nr(e){return Error("XUDY0017: The target "+e.outerHTML+" is used in more than one replace value of expression.")}function rr(e){return Error("XUDY0021: Applying the updates will result in the XDM instance violating constraint: '"+e+"'")}function or(e){return Error("XUDY0023: The namespace binding "+e+" is conflicting.")}function ar(e){return Error("XUDY0024: The namespace binding "+e+" is conflicting.")}function ir(){return Error("XUDY0027: The target for an insert, replace, or rename expression expression should not be empty.")}function sr(e,t,n,r,o){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=o}function ur(e,t,n){return t&&null!==t.N&&e.C?(null===e.Ya&&(e.Ya=le(e.h(null,n).ob())),e=e.Ya()):e=e.h(t,n),e}function cr(e,t){this.H=e,this.fa=t}function lr(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 pr(e,t,n){t.forEach((function(t){n.insertBefore(e.node,t.node,null)}))}function hr(e,t,n,r){var o=Fe(n,e),a=e.node.nodeType;if(2===a){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=o?o.node:null;r.removeAttributeNS(i,e.node.namespaceURI,e.node.nodeName),t.forEach((function(e){var t=e.node.nodeName;if(Re(n,o,t))throw rr("An attribute "+t+" already exists.");r.setAttributeNS(i,e.node.namespaceURI,t,Ue(n,e))}))}if(1===a||3===a||8===a||7===a){var s=(a=Ge(n,e))?a.node:null;r.removeChild(o.node,e.node),t.forEach((function(e){r.insertBefore(o.node,e.node,s)}))}}function fr(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 nr(e)})),r("replaceElementContent",(function(e){throw nr(e)}));var o=new Map;e.filter((function(e){return"replaceNode"===e.type&&2===e.target.node.nodeType})).forEach((function(e){var r=Fe(t,e.target);r=r?r.node:null;var a=o.get(r);a?a.push.apply(a,p(e.s.map(n))):o.set(r,e.s.map(n))})),e.filter((function(e){return"rename"===e.type&&2===e.target.node.nodeType})).forEach((function(e){var n=Fe(t,e.target);if(n){n=n.node;var r=o.get(n);r?r.push(e.s):o.set(n,[e.s])}})),o.forEach((function(e){var t={};e.forEach((function(e){if(t[e.prefix]||(t[e.prefix]=e.namespaceURI),t[e.prefix]!==e.namespaceURI)throw ar(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":pr(e.target,e.content,r);break;case"insertAttributes":!function(e,t,n,r){t.forEach((function(t){var o=t.node.nodeName;if(Re(n,e,o))throw rr("An attribute "+o+" already exists.");r.setAttributeNS(e.node,t.node.namespaceURI,o,Ue(n,t))}))}(e.target,e.content,t,r);break;case"rename":!function(e,t,n,r,o){switch(r||(r=new lr(e?e.node:null)),e.node.nodeType){case 1:var a=n.getAllAttributes(e.node),i=n.getChildNodes(e.node),s=r.createElementNS(t.namespaceURI,t.va()),u={node:s,F:null};a.forEach((function(e){o.setAttributeNS(s,e.namespaceURI,e.nodeName,e.value)})),i.forEach((function(e){o.insertBefore(s,e,null)}));break;case 2:(t=r.createAttributeNS(t.namespaceURI,t.va())).value=Ue(n,e),u={node:t,F:null};break;case 7:u={node:r.createProcessingInstruction(t.va(),Ue(n,e)),F:null}}if(!Fe(n,e))throw Error("Not supported: renaming detached nodes.");hr(e,[u],n,o)}(e.target,e.s,t,n,r);break;case"replaceValue":var o=e.target;if(e=e.s,2===o.node.nodeType){var a=Fe(t,o);a?r.setAttributeNS(a.node,o.node.namespaceURI,o.node.nodeName,e):o.node.value=e}else r.setData(o.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 o=Fe(n,e).node,a=(e=Ge(n,e))?e.node:null;t.forEach((function(e){r.insertBefore(o,e.node,a)}))}(e.target,e.content,t,r);break;case"insertBefore":!function(e,t,n,r){var o=Fe(n,e).node;t.forEach((function(t){r.insertBefore(o,t.node,e.node)}))}(e.target,e.content,t,r);break;case"insertIntoAsFirst":!function(e,t,n,r){var o=(n=Me(n,e))?n.node:null;t.forEach((function(t){r.insertBefore(e.node,t.node,o)}))}(e.target,e.content,t,r);break;case"insertIntoAsLast":pr(e.target,e.content,r)}})),e.filter((function(e){return"replaceNode"===e.type})).forEach((function(e){hr(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=Fe(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 dr(e,t){for(var n=[],r=1;r<arguments.length;++r)n[r-1]=arguments[r];return e.concat.apply(e,p(n.filter(Boolean)))}function mr(e,t,n,r){sr.call(this,e,t,n,!0,r),this.I=!0}function gr(e){return e.I?function(t,n){return e.u(t,n)}:function(t,n){var r=e.h(t,n);return{next:function(){return W({fa:[],H:r.M()})}}}}function yr(e,t){return t((e=e.next(0)).value.fa),ce.create(e.value.H)}function vr(e,t,n,r){mr.call(this,e,t,n,r),this.I=this.ha.some((function(e){return e.I}))}sr.prototype.A=function(){return null},sr.prototype.P=function(e){if(this.ha.forEach((function(t){return t.P(e)})),!this.bc&&this.ha.some((function(e){return e.I})))throw Kn()},(r=lr.prototype).createAttributeNS=function(e,t){if(!this.h)throw Error("Please pass a node factory if an XQuery script uses node constructors");return this.h.createAttributeNS(e,t)},r.createCDATASection=function(e){if(!this.h)throw Error("Please pass a node factory if an XQuery script uses node constructors");return this.h.createCDATASection(e)},r.createComment=function(e){if(!this.h)throw Error("Please pass a node factory if an XQuery script uses node constructors");return this.h.createComment(e)},r.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)},r.createElementNS=function(e,t){if(!this.h)throw Error("Please pass a node factory if an XQuery script uses node constructors");return this.h.createElementNS(e,t)},r.createProcessingInstruction=function(e,t){if(!this.h)throw Error("Please pass a node factory if an XQuery script uses node constructors");return this.h.createProcessingInstruction(e,t)},r.createTextNode=function(e){if(!this.h)throw Error("Please pass a node factory if an XQuery script uses node constructors");return this.h.createTextNode(e)},y(mr,sr),mr.prototype.h=function(){throw Kn()},y(vr,mr),vr.prototype.h=function(e,t){return this.B(e,t,this.ha.map((function(e){return function(n){return e.h(n,t)}})))},vr.prototype.u=function(e,t){var n=[],r=this.B(e,t,this.ha.map((function(e){return e.I?function(r){return yr(r=e.u(r,t),(function(e){return n=dr(n,e)}))}:function(n){return e.h(n,t)}}))),o=!1;return{next:function(){if(o)return z;var e=r.M();return o=!0,W(new cr(e,n))}}},vr.prototype.P=function(e){mr.prototype.P.call(this,e),function(e){e.ha.some((function(e){return e.I}))&&(e.I=!0)}(this)};var wr=["external","attribute","nodeName","nodeType","universal"],Ar=wr.length;function xr(e){if(this.h=wr.map((function(t){return e[t]||0})),Object.keys(e).some((function(e){return!wr.includes(e)})))throw Error("Invalid specificity kind passed")}function br(e,t){for(var n=0;n<Ar;++n){if(t.h[n]<e.h[n])return 1;if(t.h[n]>e.h[n])return-1}return 0}function Er(){return St("Expected base expression of a function call to evaluate to a sequence of single function item")}function Nr(e,t,n,r){for(var o=[],a=0;a<t.length;++a)if(null===t[a])o.push(null);else{var i=fn(e[a],t[a],n,r,!1);o.push(i)}return o}function Br(e,t){if(!ee(e.type,60))throw St("Expected base expression to evaluate to a function item");if(e.A!==t)throw Er();return e}function Tr(e,t,n,r,o,a,i){var s=0;return o=o.map((function(e){return e?null:a[s++](n)})),0<=(o=Nr(e.s,o,r,e.j)).indexOf(null)?function(e,t){var n=e.value,r=t.map((function(e){return null===e?null:le(e)}));return t=t.reduce((function(t,n,r){return null===n&&t.push(e.s[r]),t}),[]),t=new we({l:t,arity:t.length,Pa:!0,I:e.I,localName:"boundFunction",namespaceURI:e.u,i:e.O,value:function(e,t,o){var a=Array.from(arguments).slice(3),i=r.map((function(e){return null===e?a.shift():e()}));return n.apply(void 0,[e,t,o].concat(i))}}),ce.o(t)}(e,o):(t=t.apply(void 0,[n,r,i].concat(p(o))),fn(e.O,t,r,e.j,!0))}function Ir(e,t,n){var r={};vr.call(this,new xr((r.external=1,r)),[e].concat(t.filter((function(e){return!!e}))),{S:"unsorted",Y:!1,subtree:!1,C:!1},n),this.ka=t.length,this.T=t.map((function(e){return null===e})),this.J=null,this.na=e,this.ua=t}function Cr(e,t,n,r,o,a){return Le([r,o,a],(function(e){var t=c(e);e=t.next().value;var n=t.next().value;if(t=t.next().value,n=n.value,t=t.value,n>e.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 ce.o(new _e(e.R.slice(n-1,t+n-1)))}))}function Sr(e,t,n,r,o){return Le([r],(function(e){var t=c(e).next().value;return o.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,o=e.length;r<o;++r){var a=e[r];if(a>t.R.length||0>=a)throw Error("FOAY0001: subarray position out of bounds.");n.splice(a-1,1)}return ce.o(new _e(n))}))}))}function Or(e){return ee(e,1)||ee(e,20)||ee(e,19)}function Rr(e,t,n,r,o){return 0===r.length?0!==o.length:0!==o.length&&Jn(e,t,n,r[0],o[0]).next(0).value?Rr(e,t,n,r.slice(1),o.slice(1)):r[0].value!=r[0].value||(Or(r[0].type)&&0!==o.length&&Or(o[0].type)||0!==o.length)&&r[0].value<o[0].value}function Dr(e,t,n,r){return r.sort((function(r,o){return Vn(e,t,n,ce.create(r),ce.create(o)).next(0).value?0:Rr(e,t,n,r,o)?-1:1})),ce.o(new _e(r.map((function(e){return function(){return ce.create(e)}}))))}function Ur(e,t){return ee(t.type,62)?t.R.reduce((function(e,t){return t().L((function(t){return t.reduce(Ur,e)}))}),e):It([e,ce.o(t)])}xr.prototype.add=function(e){var t=this,n=wr.reduce((function(n,r,o){return n[r]=t.h[o]+e.h[o],n}),Object.create(null));return new xr(n)},y(Ir,vr),Ir.prototype.u=function(e,t){var n=this;if(!this.j||!this.j.I)return vr.prototype.u.call(this,e,t);var r=[],o=Tr(this.j,(function(e,t,o,a){for(var i=[],s=3;s<arguments.length;++s)i[s-3]=arguments[s];return yr(n.j.value.apply(n.j,[e,t,o].concat(p(i))),(function(e){r=dr(r,e)}))}),e,t,this.T,this.ua.map((function(n){return function(){return n.I?yr(n.u(e,t),(function(e){r=dr(r,e)})):ur(n,e,t)}})),this.J),a=!1;return{next:function(){if(a)return z;var e=o.M();return a=!0,W({fa:r,H:e})}}},Ir.prototype.B=function(e,t,n){var r=this,o=(n=c(n)).next().value,a=l(n);if(this.j)return Tr(this.j,(function(e,t,n,o){for(var a=[],i=3;i<arguments.length;++i)a[i-3]=arguments[i];return r.j.value.apply(r.j,[e,t,n].concat(p(a)))}),e,t,this.T,a,this.J);var i=o(e);return i.$({default:function(){throw Er()},o:function(){return i.L((function(n){if((n=Br(n=c(n).next().value,r.ka)).I)throw Error("XUDY0038: The function returned by the PrimaryExpr of a dynamic function invocation can not be an updating function");return Tr(n,n.value,e,t,r.T,a,r.J)}))}})},Ir.prototype.P=function(e){if(this.J=vo(e),vr.prototype.P.call(this,e),this.na.C){if(!(e=ur(this.na,null,null)).ya())throw Er();this.j=Br(e.first(),this.ka),this.j.I&&(this.I=!0)}};var Mr=[{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"size",l:[{type:62,g:3}],i:{type:5,g:3},m:function(e,t,n,r){return Le([r],(function(e){return e=c(e).next().value,ce.o(Y(e.R.length,5))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"get",l:[{type:62,g:3},{type:5,g:3}],i:{type:59,g:2},m:He},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"put",l:[{type:62,g:3},{type:5,g:3},{type:59,g:2}],i:{type:62,g:3},m:function(e,t,n,r,o,a){return Le([o,r],(function(e){var t=c(e);if(e=t.next().value,t=t.next().value,0>=(e=e.value)||e>t.R.length)throw Error("FOAY0001: array position out of bounds.");return(t=t.R.concat()).splice(e-1,1,le(a)),ce.o(new _e(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,o){return Le([r],(function(e){return e=c(e).next().value.R.concat([le(o)]),ce.o(new _e(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:Cr},{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,o){var a=ce.o(Y(r.first().value.length-o.first().value+1,5));return Cr(0,0,0,r,o,a)}},{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:Sr},{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,o,a){return Le([r,o],(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,le(a)),ce.o(new _e(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 He(0,0,0,r,ce.o(Y(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 Sr(0,0,0,r,ce.o(Y(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 Le([r],(function(e){return e=c(e).next().value,ce.o(new _e(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)}),[]),ce.o(new _e(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,o){return Le([r,o],(function(r){var o=(r=c(r)).next().value,a=r.next().value;if(1!==a.A)throw St("The callback passed into array:for-each has a wrong arity.");return r=o.R.map((function(r){return le(a.value.call(void 0,e,t,n,Nr(a.s,[r()],t,"array:for-each")[0]))})),ce.o(new _e(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,o){return Le([r,o],(function(r){var o=(r=c(r)).next().value,a=r.next().value;if(1!==a.A)throw St("The callback passed into array:filter has a wrong arity.");var i=o.R.map((function(r){return r=Nr(a.s,[r()],t,"array:filter")[0],(0,a.value)(e,t,n,r)})),s=[],u=!1;return ce.create({next:function(){if(u)return z;for(var e=0,t=o.R.length;e<t;++e){var n=i[e].getEffectiveBooleanValue();s[e]=n}return e=o.R.filter((function(e,t){return s[t]})),u=!0,W(new _e(e))}})}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"fold-left",l:[{type:62,g:3},{type:59,g:2},{type:60,g:3}],i:{type:59,g:2},m:function(e,t,n,r,o,a){return Le([r,a],(function(r){var a=(r=c(r)).next().value,i=r.next().value;if(2!==i.A)throw St("The callback passed into array:fold-left has a wrong arity.");return a.R.reduce((function(r,o){return o=Nr(i.s,[o()],t,"array:fold-left")[0],i.value.call(void 0,e,t,n,r,o)}),o)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"fold-right",l:[{type:62,g:3},{type:59,g:2},{type:60,g:3}],i:{type:59,g:2},m:function(e,t,n,r,o,a){return Le([r,a],(function(r){var a=(r=c(r)).next().value,i=r.next().value;if(2!==i.A)throw St("The callback passed into array:fold-right has a wrong arity.");return a.R.reduceRight((function(r,o){return o=Nr(i.s,[o()],t,"array:fold-right")[0],i.value.call(void 0,e,t,n,r,o)}),o)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"for-each-pair",l:[{type:62,g:3},{type:62,g:3},{type:60,g:3}],i:{type:62,g:3},m:function(e,t,n,r,o,a){return Le([r,o,a],(function(r){var o=c(r);r=o.next().value;var a=o.next().value;if(2!==(o=o.next().value).A)throw St("The callback passed into array:for-each-pair has a wrong arity.");for(var i=[],s=0,u=Math.min(r.R.length,a.R.length);s<u;++s){var l=c(Nr(o.s,[r.R[s](),a.R[s]()],t,"array:for-each-pair")),p=l.next().value;l=l.next().value,i[s]=le(o.value.call(void 0,e,t,n,p,l))}return ce.o(new _e(i))}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"sort",l:[{type:62,g:3}],i:{type:62,g:3},m:function(e,t,n,r){return Le([r],(function(r){return r=c(r).next().value.R.map((function(e){return e().M()})),Dr(e,t,n,r)}))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions/array",localName:"flatten",l:[{type:59,g:2}],i:{type:59,g:2},m:function(e,t,n,r){return r.L((function(e){return e.reduce(Ur,ce.empty())}))}}];function kr(e,t,n,r,o){return o.G()?o:ce.o(zt(o.first(),e))}var Gr=[{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"untypedAtomic",l:[{type:46,g:0}],i:{type:19,g:0},m:kr.bind(null,19)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"error",l:[{type:46,g:0}],i:{type:39,g:0},m:kr.bind(null,39)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"string",l:[{type:46,g:0}],i:{type:1,g:0},m:kr.bind(null,1)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"boolean",l:[{type:46,g:0}],i:{type:0,g:0},m:kr.bind(null,0)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"decimal",l:[{type:46,g:0}],i:{type:4,g:0},m:kr.bind(null,4)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"float",l:[{type:46,g:0}],i:{type:6,g:0},m:kr.bind(null,6)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"double",l:[{type:46,g:0}],i:{type:3,g:0},m:kr.bind(null,3)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"duration",l:[{type:46,g:0}],i:{type:18,g:0},m:kr.bind(null,18)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"dateTime",l:[{type:46,g:0}],i:{type:9,g:0},m:kr.bind(null,9)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"dateTimeStamp",l:[{type:46,g:0}],i:{type:10,g:0},m:kr.bind(null,10)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"time",l:[{type:46,g:0}],i:{type:8,g:0},m:kr.bind(null,8)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"date",l:[{type:46,g:0}],i:{type:7,g:0},m:kr.bind(null,7)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"gYearMonth",l:[{type:46,g:0}],i:{type:11,g:0},m:kr.bind(null,11)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"gYear",l:[{type:46,g:0}],i:{type:12,g:0},m:kr.bind(null,12)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"gMonthDay",l:[{type:46,g:0}],i:{type:13,g:0},m:kr.bind(null,13)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"gDay",l:[{type:46,g:0}],i:{type:15,g:0},m:kr.bind(null,15)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"gMonth",l:[{type:46,g:0}],i:{type:14,g:0},m:kr.bind(null,14)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"hexBinary",l:[{type:46,g:0}],i:{type:22,g:0},m:kr.bind(null,22)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"base64Binary",l:[{type:46,g:0}],i:{type:21,g:0},m:kr.bind(null,21)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"QName",l:[{type:46,g:0}],i:{type:23,g:0},m:function(e,t,n,r){if(r.G())return r;if(ee((e=r.first()).type,2))throw Error("XPTY0004: The provided QName is not a string-like value.");if(!Gt(e=kt(e=zt(e,1).value,23),23))throw Error("FORG0001: The provided QName is invalid.");if(!e.includes(":"))return n=n.ba(""),ce.o(Y(new ve("",n,e),23));if(t=(r=c(e.split(":"))).next().value,r=r.next().value,!(n=n.ba(t)))throw Error("FONS0004: The value "+e+" can not be cast to a QName. Did you mean to use fn:QName?");return ce.o(Y(new ve(t,n,r),23))}},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"anyURI",l:[{type:46,g:0}],i:{type:20,g:0},m:kr.bind(null,20)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"normalizedString",l:[{type:46,g:0}],i:{type:48,g:0},m:kr.bind(null,48)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"token",l:[{type:46,g:0}],i:{type:52,g:0},m:kr.bind(null,52)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"language",l:[{type:46,g:0}],i:{type:51,g:0},m:kr.bind(null,51)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"NMTOKEN",l:[{type:46,g:0}],i:{type:50,g:0},m:kr.bind(null,50)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"NMTOKENS",l:[{type:46,g:0}],i:{type:49,g:2},m:kr.bind(null,49)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"Name",l:[{type:46,g:0}],i:{type:25,g:0},m:kr.bind(null,25)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"NCName",l:[{type:46,g:0}],i:{type:24,g:0},m:kr.bind(null,24)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"ID",l:[{type:46,g:0}],i:{type:42,g:0},m:kr.bind(null,42)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"IDREF",l:[{type:46,g:0}],i:{type:41,g:0},m:kr.bind(null,41)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"IDREFS",l:[{type:46,g:0}],i:{type:43,g:2},m:kr.bind(null,43)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"ENTITY",l:[{type:46,g:0}],i:{type:26,g:0},m:kr.bind(null,26)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"ENTITIES",l:[{type:46,g:0}],i:{type:40,g:2},m:kr.bind(null,40)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"integer",l:[{type:46,g:0}],i:{type:5,g:0},m:kr.bind(null,5)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"nonPositiveInteger",l:[{type:46,g:0}],i:{type:27,g:0},m:kr.bind(null,27)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"negativeInteger",l:[{type:46,g:0}],i:{type:28,g:0},m:kr.bind(null,28)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"long",l:[{type:46,g:0}],i:{type:31,g:0},m:kr.bind(null,31)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"int",l:[{type:46,g:0}],i:{type:32,g:0},m:kr.bind(null,32)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"short",l:[{type:46,g:0}],i:{type:33,g:0},m:kr.bind(null,33)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"byte",l:[{type:46,g:0}],i:{type:34,g:0},m:kr.bind(null,34)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"nonNegativeInteger",l:[{type:46,g:0}],i:{type:30,g:0},m:kr.bind(null,30)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"unsignedLong",l:[{type:46,g:0}],i:{type:36,g:0},m:kr.bind(null,36)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"unsignedInt",l:[{type:46,g:0}],i:{type:35,g:0},m:kr.bind(null,35)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"unsignedShort",l:[{type:46,g:0}],i:{type:38,g:0},m:kr.bind(null,38)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"unsignedByte",l:[{type:46,g:0}],i:{type:37,g:0},m:kr.bind(null,37)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"positiveInteger",l:[{type:46,g:0}],i:{type:29,g:0},m:kr.bind(null,29)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"yearMonthDuration",l:[{type:46,g:0}],i:{type:16,g:0},m:kr.bind(null,16)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"dayTimeDuration",l:[{type:46,g:0}],i:{type:17,g:0},m:kr.bind(null,17)},{namespaceURI:"http://www.w3.org/2001/XMLSchema",localName:"dateTimeStamp",l:[{type:46,g:0}],i:{type:10,g:0},m:kr.bind(null,10)}];function Fr(e,t,n,r){return r.G()?r:ce.o(Y(r.first().value.getYear(),5))}function Pr(e,t,n,r){return r.G()?r:ce.o(Y(r.first().value.getMonth(),5))}function Hr(e,t,n,r){return r.G()?r:ce.o(Y(r.first().value.getDay(),5))}function _r(e,t,n,r){return r.G()?r:ce.o(Y(r.first().value.getHours(),5))}function jr(e,t,n,r){return r.G()?r:ce.o(Y(r.first().value.getMinutes(),5))}function Xr(e,t,n,r){return r.G()||(t=(e=ce).o,r=r.first().value,r=t.call(e,Y(r.j+r.pa,4))),r}function Lr(e,t,n,r){return r.G()?r:(e=r.first().value.Z)?ce.o(Y(e,17)):ce.empty()}var $r=[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"dateTime",l:[{type:7,g:0},{type:8,g:0}],i:{type:9,g:0},m:function(e,t,n,r,o){if(r.G())return r;if(o.G())return o;if(e=r.first().value,o=o.first().value,t=e.Z,n=o.Z,t||n){if(!t||n)if(!t&&n)t=n;else if(!Qe(t,n))throw Error("FORG0008: fn:dateTime: got a date and time value with different timezones.")}else t=null;return ce.o(Y(new it(e.getYear(),e.getMonth(),e.getDay(),o.getHours(),o.getMinutes(),o.getSeconds(),o.pa,t),9))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"year-from-dateTime",l:[{type:9,g:0}],i:{type:5,g:0},m:Fr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"month-from-dateTime",l:[{type:9,g:0}],i:{type:5,g:0},m:Pr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"day-from-dateTime",l:[{type:9,g:0}],i:{type:5,g:0},m:Hr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"hours-from-dateTime",l:[{type:9,g:0}],i:{type:5,g:0},m:_r},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"minutes-from-dateTime",l:[{type:9,g:0}],i:{type:5,g:0},m:jr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"seconds-from-dateTime",l:[{type:9,g:0}],i:{type:4,g:0},m:Xr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"timezone-from-dateTime",l:[{type:9,g:0}],i:{type:17,g:0},m:Lr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"year-from-date",l:[{type:7,g:0}],i:{type:5,g:0},m:Fr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"month-from-date",l:[{type:7,g:0}],i:{type:5,g:0},m:Pr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"day-from-date",l:[{type:7,g:0}],i:{type:5,g:0},m:Hr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"timezone-from-date",l:[{type:7,g:0}],i:{type:17,g:0},m:Lr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"hours-from-time",l:[{type:8,g:0}],i:{type:5,g:0},m:_r},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"minutes-from-time",l:[{type:8,g:0}],i:{type:5,g:0},m:jr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"seconds-from-time",l:[{type:8,g:0}],i:{type:4,g:0},m:Xr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"timezone-from-time",l:[{type:8,g:0}],i:{type:17,g:0},m:Lr}];function qr(e,t,n,r,o){return r.L((function(e){for(var n=Ut(ce.create(e),t).map((function(e){return zt(e,1)})).M(),r="",a=0;a<n.length;a++)r+="{type: "+n[a].type+", value: "+n[a].value+"}\n";return void 0!==o&&(r+=o.first().value),t.O.trace(r),ce.create(e)}))}var Yr=[{l:[{type:59,g:2}],m:qr,localName:"trace",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}},{l:[{type:59,g:2},{type:1,g:3}],m:qr,localName:"trace",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:59,g:2}}];function Vr(e,t,n,r,o){throw e=void 0===r||r.G()?new ve("err","http://www.w3.org/2005/xqt-errors","FOER0000"):r.first().value,t="",void 0===o||o.G()||(t=": "+o.first().value),Error(""+e.localName+t)}var Qr=[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"error",l:[],i:{type:63,g:3},m:Vr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"error",l:[{type:23,g:0}],i:{type:63,g:3},m:Vr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"error",l:[{type:23,g:0},{type:1,g:3}],i:{type:63,g:3},m:Vr},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"error",l:[{type:23,g:0},{type:1,g:3},{type:59,g:2}],i:{type:63,g:3},m:function(){throw Error("Not implemented: Using an error object in error is not supported")}}];function Jr(e){return"string"==typeof e?e:(e=(new Ee).getChildNodes(e).find((function(e){return 8===e.nodeType})))?e.data:"some expression"}function Kr(e,t){e=Error.call(this,e),this.message=e.message,"stack"in e&&(this.stack=e.stack),this.position={end:{la:t.end.la,line:t.end.line,offset:t.end.offset},start:{la:t.start.la,line:t.start.line,offset:t.start.offset}}}function zr(e,t){if(t instanceof Error)throw t;"string"!=typeof e&&(e=Jr(e));var n=Ba(t);e=e.replace("\r","").split("\n");var r=Math.floor(Math.log10(Math.min(n.end.line+2,e.length)))+1;throw e=e.reduce((function(e,t,o){var a=o+1;if(2<n.start.line-a||2<a-n.end.line)return e;if(o=Array(r).fill(" ",0,Math.floor(Math.log10(a))+1-r).join("")+a+": ",e.push(o+t),a>=n.start.line&&a<=n.end.line){var i=a<n.end.line?t.length+o.length:n.end.la-1+o.length;a=a>n.start.line?o.length:n.start.la-1+o.length,e.push(Array(o.length+t.length).fill(" ",0,a).fill("^",a,i).join(""))}return e}),[]),t=Ta(t).join("\n"),new Kr(e.join("\n")+"\n\n"+t,n)}y(Kr,Error);var Wr=Object.create(null);function Zr(e,t){for(var n=[],r=0;r<e.length+1;++r)n[r]=[];return function r(o,a){if(0===o)return a;if(0===a)return o;if(void 0!==n[o][a])return n[o][a];var i=0;return e[o-1]!==t[a-1]&&(i=1),i=Math.min(r(o-1,a)+1,r(o,a-1)+1,r(o-1,a-1)+i),n[o][a]=i}(e.length,t.length)}function eo(e){var t=Wr[e]?Wr[e]:Object.keys(Wr).map((function(t){return{name:t,wb:Zr(e,t.slice(t.lastIndexOf(":")+1))}})).sort((function(e,t){return e.wb-t.wb})).slice(0,5).filter((function(t){return t.wb<e.length/2})).reduce((function(e,t){return e.concat(Wr[t.name])}),[]).slice(0,5);return t.length?t.map((function(e){return'"Q{'+e.namespaceURI+"}"+e.localName+" ("+e.l.map((function(e){return 4===e?"...":me(e)})).join(", ")+')"'})).reduce((function(e,t,n,r){return 0===n?e+t:e+(n!==r.length-1?", ":" or ")+t}),"Did you mean ")+"?":"No similar functions found."}function to(e,t,n,r,o){Wr[e+":"+t]||(Wr[e+":"+t]=[]),Wr[e+":"+t].push({l:n,arity:n.length,m:o,I:!1,localName:t,namespaceURI:e,i:r})}var no={},ro=(no.xml="http://www.w3.org/XML/1998/namespace",no.xs="http://www.w3.org/2001/XMLSchema",no.fn="http://www.w3.org/2005/xpath-functions",no.map="http://www.w3.org/2005/xpath-functions/map",no.array="http://www.w3.org/2005/xpath-functions/array",no.math="http://www.w3.org/2005/xpath-functions/math",no.fontoxpath="http://fontoxml.com/fontoxpath",no.local="http://www.w3.org/2005/xquery-local-functions",no);function oo(e,t,n,r){this.Ca=[Object.create(null)],this.Da=Object.create(null),this.O=e,this.ha=Object.keys(t).reduce((function(e,n){return void 0===t[n]||(e[n]="Q{}"+n+"[0]"),e}),Object.create(null)),this.s=Object.create(null),this.h=Object.create(null),this.A=n,this.u=r,this.j=[]}function ao(e){return Error("XPTY0004: "+e)}function io(e,t){return e=2===e.node.nodeType?e.node.nodeName+'="'+Ue(t,e)+'"':e.node.outerHTML,Error("XQTY0024: The node "+e+" follows a node that is not an attribute node or a namespace node.")}function so(e){return Error('XQDY0044: The node name "'+e.va()+'" is invalid for a computed attribute constructor.')}function uo(){return Error("XQST0045: Functions and variables may not be declared in one of the reserved namespace URIs.")}function co(){return Error("XQST0060: Functions declared in a module or as an external function must reside in a namespace.")}function lo(){return Error("XQST0066: A Prolog may contain at most one default function namespace declaration.")}function po(){return Error("XQST0070: The prefixes xml and xmlns may not be used in a namespace declaration or be bound to another namespaceURI.")}function ho(e){return Error('XQDY0074: The value "'+e+'" of a name expressions cannot be converted to an expanded QName.')}function fo(e){return Error('XPST0081: The prefix "'+e+'" could not be resolved')}function mo(e,t){return"Q{"+(e||"")+"}"+t}function go(e,t){for(var n=e.length-1;0<=n;--n)if(t in e[n])return e[n][t]}function yo(e){this.s=e,this.O=this.h=0,this.j=[Object.create(null)],this.u=Object.create(null),this.A=null,this.Da=e&&e.Da,this.Ca=e&&e.Ca}function vo(e){for(var t=new yo(e.s),n=0;n<e.h+1;++n)t.j=[Object.assign(Object.create(null),t.j[0],e.j[n])],t.Ca=[Object.assign(Object.create(null),t.Ca[0],e.Ca[n])],t.u=Object.assign(Object.create(null),e.u),t.Da=e.Da,t.A=e.A;return t}function wo(e){e.O++,e.h++,e.j[e.h]=Object.create(null),e.Ca[e.h]=Object.create(null)}function Ao(e,t,n,r,o){if(r=mo(t,n)+"~"+r,e.u[r])throw Error('XQST0049: The function or variable "Q{'+t+"}"+n+'" is declared more than once.');e.u[r]=o}function xo(e,t,n){e.j[e.h][t]=n}function bo(e,t,n){return t=mo(t||"",n),e.Ca[e.h][t]=t+"["+e.O+"]"}function Eo(e,t,n,r){e.Da[mo(t||"",n)+"["+e.O+"]"]=r}function No(e){e.j.length=e.h,e.Ca.length=e.h,e.h--}function Bo(e,t){"*"===t||Array.isArray(t)||(t=[t]);for(var n=1;n<e.length;++n)if(Array.isArray(e[n])){var r=e[n];if("*"===t||t.includes(r[0]))return r}return null}function To(e){return 2>e.length?"":"object"==typeof e[1]?e[2]||"":e[1]||""}function Io(e,t){return Array.isArray(e)?"object"!=typeof(e=e[1])||Array.isArray(e)?null:t in e?e[t]:null:null}function Co(e,t){return t.reduce(Bo,e)}function So(e,t){for(var n=[],r=1;r<e.length;++r)if(Array.isArray(e[r])){var o=e[r];"*"!==t&&o[0]!==t||n.push(o)}return n}function Oo(e){return{localName:To(e),namespaceURI:Io(e,"URI"),prefix:Io(e,"prefix")}}function Ro(e){var t=Bo(e,"typeDeclaration");if(!t||Bo(t,"voidSequenceType"))return{type:59,g:2};e={type:function e(n){switch(n[0]){case"documentTest":return 55;case"elementTest":return 54;case"attributeTest":return 47;case"piTest":return 57;case"commentTest":return 58;case"textTest":return 56;case"anyKindTest":return 53;case"anyItemType":return 59;case"anyFunctionTest":case"functionTest":case"typedFunctionTest":return 60;case"anyMapTest":case"typedMapTest":return 61;case"anyArrayTest":case"typedArrayTest":return 62;case"atomicType":return ge([Io(n,"prefix"),To(n)].join(":"));case"parenthesizedItemType":return e(Bo(n,"*"));default:throw Error('Type declaration "'+Bo(t,"*")[0]+'" is not supported.')}}(Bo(t,"*")),g:3};var n=null,r=Bo(t,"occurrenceIndicator");switch(r&&(n=To(r)),n){case"*":return e.g=2,e;case"?":return e.g=0,e;case"+":return e.g=1,e;case"":case null:return e}}function Do(e,t,n){if("object"!=typeof e[1]||Array.isArray(e[1])){var r={};r[t]=n,e.splice(1,0,r)}else e[1][t]=n}function Uo(e,t,n){return(e<<20)+(t<<12)+(n.charCodeAt(0)<<8)+n.charCodeAt(1)}oo.prototype.za=function(e,t,n){return function(e,t,n){var r=Wr[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,i:r.i}:null}(e,t,n)},oo.prototype.qb=function(e,t){return e?null:(e=this.ha[t],this.s[t]||(this.s[t]={name:t}),e)},oo.prototype.Ra=function(e,t){var n=this.u(e,t);if(n)this.j.push({Bc:e,arity:t,Hb:n});else if(""===e.prefix){if(this.A)return{namespaceURI:this.A,localName:e.localName}}else if(t=this.ba(e.prefix,!0))return{namespaceURI:t,localName:e.localName};return n},oo.prototype.ba=function(e,t){return void 0===t||t?ro[e]?ro[e]:(t=this.O(e),this.h[e]||(this.h[e]={namespaceURI:t,prefix:e}),void 0!==t||e?t:null):null},yo.prototype.za=function(e,t,n,r){r=void 0!==r&&r;var o=this.u[mo(e,t)+"~"+n];return!o||r&&o.Bb?null===this.s?null:this.s.za(e,t,n,r):o},yo.prototype.qb=function(e,t){var n=go(this.Ca,mo(e,t));return n||(null===this.s?null:this.s.qb(e,t))},yo.prototype.Ra=function(e,t){var n=e.prefix,r=e.localName;return""===n&&this.A?{localName:r,namespaceURI:this.A}:n&&(n=this.ba(n,!1))?{localName:r,namespaceURI:n}:null===this.s?null:this.s.Ra(e,t)},yo.prototype.ba=function(e,t){var n=go(this.j,e||"");return void 0===n?null===this.s?void 0:this.s.ba(e||"",void 0===t||t):n};var Mo={},ko=(Mo[Uo(2,2,"idivOp")]=5,Mo[Uo(16,16,"addOp")]=16,Mo[Uo(16,16,"subtractOp")]=16,Mo[Uo(16,16,"divOp")]=4,Mo[Uo(16,2,"multiplyOp")]=16,Mo[Uo(16,2,"divOp")]=16,Mo[Uo(2,16,"multiplyOp")]=16,Mo[Uo(17,17,"addOp")]=17,Mo[Uo(17,17,"subtractOp")]=17,Mo[Uo(17,17,"divOp")]=4,Mo[Uo(17,2,"multiplyOp")]=17,Mo[Uo(17,2,"divOp")]=17,Mo[Uo(2,17,"multiplyOp")]=17,Mo[Uo(9,9,"subtractOp")]=17,Mo[Uo(7,7,"subtractOp")]=17,Mo[Uo(8,8,"subtractOp")]=17,Mo[Uo(9,16,"addOp")]=9,Mo[Uo(9,16,"subtractOp")]=9,Mo[Uo(9,17,"addOp")]=9,Mo[Uo(9,17,"subtractOp")]=9,Mo[Uo(7,16,"addOp")]=7,Mo[Uo(7,16,"subtractOp")]=7,Mo[Uo(7,17,"addOp")]=7,Mo[Uo(7,17,"subtractOp")]=7,Mo[Uo(8,17,"addOp")]=8,Mo[Uo(8,17,"subtractOp")]=8,Mo[Uo(9,16,"addOp")]=9,Mo[Uo(9,16,"subtractOp")]=9,Mo[Uo(9,17,"addOp")]=9,Mo[Uo(9,17,"subtractOp")]=9,Mo[Uo(7,17,"addOp")]=7,Mo[Uo(7,17,"subtractOp")]=7,Mo[Uo(7,16,"addOp")]=7,Mo[Uo(7,16,"subtractOp")]=7,Mo[Uo(8,17,"addOp")]=8,Mo[Uo(8,17,"subtractOp")]=8,Mo),Go={},Fo=(Go[Uo(2,2,"addOp")]=function(e,t){return e+t},Go[Uo(2,2,"subtractOp")]=function(e,t){return e-t},Go[Uo(2,2,"multiplyOp")]=function(e,t){return e*t},Go[Uo(2,2,"divOp")]=function(e,t){return e/t},Go[Uo(2,2,"modOp")]=function(e,t){return e%t},Go[Uo(2,2,"idivOp")]=function(e,t){return Math.trunc(e/t)},Go[Uo(16,16,"addOp")]=function(e,t){return new Ht(e.ga+t.ga)},Go[Uo(16,16,"subtractOp")]=function(e,t){return new Ht(e.ga-t.ga)},Go[Uo(16,16,"divOp")]=function(e,t){return e.ga/t.ga},Go[Uo(16,2,"multiplyOp")]=Xt,Go[Uo(16,2,"divOp")]=function(e,t){if(isNaN(t))throw Error("FOCA0005: Cannot divide xs:yearMonthDuration by NaN");if((e=Math.round(e.ga/t))>Number.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while dividing xs:yearMonthDuration");return new Ht(e<Number.MIN_SAFE_INTEGER||0===e?0:e)},Go[Uo(2,16,"multiplyOp")]=function(e,t){return Xt(t,e)},Go[Uo(17,17,"addOp")]=function(e,t){return new Je(e.ea+t.ea)},Go[Uo(17,17,"subtractOp")]=function(e,t){return new Je(e.ea-t.ea)},Go[Uo(17,17,"divOp")]=function(e,t){if(0===t.ea)throw Error("FOAR0001: Division by 0");return e.ea/t.ea},Go[Uo(17,2,"multiplyOp")]=et,Go[Uo(17,2,"divOp")]=function(e,t){if(isNaN(t))throw Error("FOCA0005: Cannot divide xs:dayTimeDuration by NaN");if((e=e.ea/t)>Number.MAX_SAFE_INTEGER||!Number.isFinite(e))throw Error("FODT0002: Value overflow while dividing xs:dayTimeDuration");return new Je(e<Number.MIN_SAFE_INTEGER||Object.is(-0,e)?0:e)},Go[Uo(2,17,"multiplyOp")]=function(e,t){return et(t,e)},Go[Uo(9,9,"subtractOp")]=ht,Go[Uo(7,7,"subtractOp")]=ht,Go[Uo(8,8,"subtractOp")]=ht,Go[Uo(9,16,"addOp")]=ft,Go[Uo(9,16,"subtractOp")]=dt,Go[Uo(9,17,"addOp")]=ft,Go[Uo(9,17,"subtractOp")]=dt,Go[Uo(7,16,"addOp")]=ft,Go[Uo(7,16,"subtractOp")]=dt,Go[Uo(7,17,"addOp")]=ft,Go[Uo(7,17,"subtractOp")]=dt,Go[Uo(8,17,"addOp")]=ft,Go[Uo(8,17,"subtractOp")]=dt,Go[Uo(9,16,"addOp")]=ft,Go[Uo(9,16,"subtractOp")]=dt,Go[Uo(9,17,"addOp")]=ft,Go[Uo(9,17,"subtractOp")]=dt,Go[Uo(7,17,"addOp")]=ft,Go[Uo(7,17,"subtractOp")]=dt,Go[Uo(7,16,"addOp")]=ft,Go[Uo(7,16,"subtractOp")]=dt,Go[Uo(8,17,"addOp")]=ft,Go[Uo(8,17,"subtractOp")]=dt,Go);function Po(e,t){return ee(e,5)&&ee(t,5)?5:ee(e,4)&&ee(t,4)?4:ee(e,6)&&ee(t,6)?6:3}var Ho=[2,16,17,9,7,8];function _o(e,t,n){function r(e,t){return{V:o?o(e):e,W:a?a(t):t}}var o=null,a=null;ee(t,19)&&(o=function(e){return zt(e,3)},t=3),ee(n,19)&&(a=function(e){return zt(e,3)},n=3);var i=Ho.filter((function(e){return ee(t,e)})),s=Ho.filter((function(e){return ee(n,e)}));if(i.includes(2)&&s.includes(2)){var u=Fo[Uo(2,2,e)],l=ko[Uo(2,2,e)];return l||(l=Po(t,n)),"divOp"===e&&5===l&&(l=4),"idivOp"===e?jo(r,u)[0]:function(e,t){return e=r(e,t),Y(u(e.V.value,e.W.value),l)}}for(var p=(i=c(i)).next();!p.done;p=i.next()){p=p.value;for(var h={},f=c(s),d=f.next();!d.done;h={ib:h.ib,lb:h.lb},d=f.next())if(d=d.value,h.ib=Fo[Uo(p,d,e)],h.lb=ko[Uo(p,d,e)],h.ib&&void 0!==h.lb)return function(e){return function(t,n){return t=r(t,n),Y(e.ib(t.V.value,t.W.value),e.lb)}}(h)}}function jo(e,t){return[function(n,r){if(n=(r=e(n,r)).V,0===(r=r.W).value)throw Error("FOAR0001: Divisor of idiv operator cannot be (-)0");if(Number.isNaN(n.value)||Number.isNaN(r.value)||!Number.isFinite(n.value))throw Error("FOAR0002: One of the operands of idiv is NaN or the first operand is (-)INF");return Number.isFinite(n.value)&&!Number.isFinite(r.value)?Y(0,5):Y(t(n.value,r.value),5)},5]}var Xo=Object.create(null);function Lo(e,t,n,r,o){sr.call(this,t.s.add(n.s),[t,n],{C:!1},!1,r),this.B=t,this.J=n,this.j=e,this.u=o}function $o(e,t,n){var r=Oo(Co(e,["forClauseItem","typedVariableBinding","varName"]));(e=Co(e,["forClauseItem","forExpr","sequenceExpr"]))&&(e=So(e,"*").map((function(e){return n(e,t)})),e.includes(void 0)||e.includes(null)||1===(e=qo(e)).length&&ra(t,r.localName,e[0]))}function qo(e){return e.filter((function(e,t,n){return n.findIndex((function(t){return t.type===e.type&&t.g===e.g}))===t}))}function Yo(e,t,n){var r=So(e,"*"),o=Bo(e,"atomicType");if(!o)return{type:59,g:2};if(ge(Io(o,"prefix")+":"+o[2])===t.type)if(1===r.length){if(3===t.g)return n}else if(e=Bo(e,"occurrenceIndicator")[1],t.g===function(e){switch(e){case"*":return 2;case"?":return 0;case"+":return 1;default:return 3}}(e))return n}function Vo(e,t){Qo(e,t)}function Qo(e,t){var n=ta.get(e[0]);if(n)return n(e,t);for(n=1;n<e.length;n++)e[n]&&Qo(e[n],t)}function Jo(e,t){var n=Qo(Bo(e,"firstOperand")[1],t),r=Qo(Bo(e,"secondOperand")[1],t),o=e[0];if(n&&r){if(!(t=function(e,t,n){var r=[2,53,59,46,47];if(r.includes(t)||r.includes(n))return 2;var o=null,a=null;ee(t,19)&&(o=function(e){return zt(e,3)},t=3),ee(n,19)&&(a=function(e){return zt(e,3)},n=3);var i=Ho.filter((function(e){return ee(t,e)}));if(r=Ho.filter((function(e){return ee(n,e)})),i.includes(2)&&r.includes(2))return void 0===(r=ko[Uo(2,2,e)])&&(r=Po(t,n)),"divOp"===e&&5===r&&(r=4),"idivOp"===e?jo((function(e,t){return{V:o?o(e):e,W:a?a(t):t}}),(function(e,t){return Math.trunc(e/t)}))[1]:r;for(var s=(i=c(i)).next();!s.done;s=i.next()){s=s.value;for(var u=c(r),l=u.next();!l.done;l=u.next())if(void 0!==(l=ko[Uo(s,l.value,e)]))return l}}(o,n.type,r.type)))throw Error("XPTY0004: "+o+" not available for types "+me(n)+" and "+me(r));n={type:t,g:n.g},2!==t&&59!==t&&Do(e,"type",n),e=n}else e={type:2,g:3};return e}function Ko(e,t){Qo(Bo(e,"firstOperand")[1],t),Qo(Bo(e,"secondOperand")[1],t);e:{switch(e[0]){case"orOp":case"andOp":Do(e,"type",t={type:0,g:3}),e=t;break e}e=void 0}return e}function zo(e,t){Qo(Bo(e,"firstOperand")[1],t),Qo(Bo(e,"secondOperand")[1],t);e:{switch(e[0]){case"unionOp":case"intersectOp":case"exceptOp":Do(e,"type",t={type:53,g:2}),e=t;break e}e=void 0}return e}function Wo(e,t){return Qo(Bo(e,"firstOperand")[1],t),Qo(Bo(e,"secondOperand")[1],t),Do(e,"type",t={type:0,g:3}),t}function Zo(e,t){return Qo(Bo(e,"firstOperand")[1],t),Qo(Bo(e,"secondOperand")[1],t),Do(e,"type",t={type:0,g:3}),t}function ea(e,t){return Qo(Bo(e,"firstOperand")[1],t),Qo(Bo(e,"secondOperand")[1],t),Do(e,"type",t={type:0,g:3}),t}y(Lo,sr),Lo.prototype.h=function(e,t){var n=this;return Ut(ur(this.B,e,t),t).L((function(r){return 0===r.length?ce.empty():Ut(ur(n.J,e,t),t).L((function(e){if(0===e.length)return ce.empty();if(1<r.length||1<e.length)throw Error('XPTY0004: the operands of the "'+n.j+'" operator should be empty or singleton.');var t=r[0];if(e=e[0],n.u&&n.type)return ce.o(n.u(t,e));var o=t.type,a=e.type,i=n.j,s=o+"~"+a+"~"+i,u=Xo[s];if(u||(u=Xo[s]=_o(i,o,a)),!(o=u))throw Error("XPTY0004: "+n.j+" not available for types "+fe[t.type]+" and "+fe[e.type]);return ce.o(o(t,e))}))}))};var ta=new Map([["unaryMinusOp",function(e,t){return(t=Qo(Bo(e,"operand")[1],t))?ee(t.type,2)?(Do(e,"type",t={type:t.type,g:t.g}),e=t):(Do(e,"type",t={type:3,g:3}),e=t):(Do(e,"type",t={type:2,g:2}),e=t),e}],["unaryPlusOp",function(e,t){return(t=Qo(Bo(e,"operand")[1],t))?ee(t.type,2)?(Do(e,"type",t={type:t.type,g:t.g}),e=t):(Do(e,"type",t={type:3,g:3}),e=t):(Do(e,"type",t={type:2,g:2}),e=t),e}],["addOp",Jo],["subtractOp",Jo],["divOp",Jo],["idivOp",Jo],["modOp",Jo],["multiplyOp",Jo],["andOp",Ko],["orOp",Ko],["sequenceExpr",function(e,t){var n=So(e,"*"),r=n.map((function(e){return Qo(e,t)}));return function(e,t,n){return t=0===t?{type:53,g:2}:n.includes(void 0)||n.includes(null)||1<(t=qo(n)).length?{type:59,g:2}:{type:t[0].type,g:2},t&&59!==t.type&&Do(e,"type",t),t}(e,n.length,r)}],["unionOp",zo],["intersectOp",zo],["exceptOp",zo],["stringConcatenateOp",function(e,t){return Qo(Bo(e,"firstOperand")[1],t),Qo(Bo(e,"secondOperand")[1],t),Do(e,"type",t={type:1,g:3}),t}],["rangeSequenceExpr",function(e,t){return Qo(Bo(e,"startExpr")[1],t),Qo(Bo(e,"endExpr")[1],t),Do(e,"type",t={type:5,g:1}),t}],["equalOp",Wo],["notEqualOp",Wo],["lessThanOrEqualOp",Wo],["lessThanOp",Wo],["greaterThanOrEqualOp",Wo],["greaterThanOp",Wo],["eqOp",Zo],["neOp",Zo],["ltOp",Zo],["leOp",Zo],["gtOp",Zo],["geOp",Zo],["isOp",ea],["nodeBeforeOp",ea],["nodeAfterOp",ea],["pathExpr",function(e,t){var n=Bo(e,"rootExpr");return n&&n[1]&&Qo(n[1],t),So(e,"stepExpr").map((function(e){return Qo(e,t)})),function(e,t){var n=So(e,"stepExpr");if(!n)return{type:59,g:2};for(var r=(n=c(n)).next();!r.done;r=n.next()){var o=r.value;r=void 0;var a=t;if(o){for(var i=So(o,"*"),s="",u=(i=c(i)).next();!u.done;u=i.next())switch(u=u.value,u[0]){case"filterExpr":r=Io(Co(u,["*"]),"type");break;case"xpathAxis":e:{switch(s=u[1]){case"attribute":r={type:47,g:2};break e;case"child":case"decendant":case"self":case"descendant-or-self":case"following-sibling":case"following":case"namespace":case"parent":case"ancestor":case"preceding-sibling":case"preceding":case"ancestor-or-self":r={type:53,g:2};break e}r=void 0}break;case"nameTest":var l=Oo(u);null!==l.namespaceURI||"attribute"===s&&!l.prefix||void 0!==(l=a.ba(l.prefix||""))&&Do(u,"URI",l)}r&&59!==r.type&&Do(o,"type",r)}o=Io(o,"type")}return o&&59!==o.type&&Do(e,"type",o),o}(e,t)}],["contextItemExpr",function(){return{type:59,g:2}}],["ifThenElseExpr",function(e,t){Qo(Bo(Bo(e,"ifClause"),"*"),t);var n=Qo(Bo(Bo(e,"thenClause"),"*"),t);return t=Qo(Bo(Bo(e,"elseClause"),"*"),t),n&&t&&n.type===t.type&&n.g===t.g?(59!==n.type&&Do(e,"type",n),e=n):e={type:59,g:2},e}],["instanceOfExpr",function(e,t){return Qo(Bo(e,"argExpr"),t),Qo(Bo(e,"sequenceType"),t),Do(e,"type",t={type:0,g:3}),t}],["integerConstantExpr",function(e){var t={type:5,g:3};return Do(e,"type",t),t}],["doubleConstantExpr",function(e){var t={type:3,g:3};return Do(e,"type",t),t}],["decimalConstantExpr",function(e){var t={type:4,g:3};return Do(e,"type",t),t}],["stringConstantExpr",function(e){var t={type:1,g:3};return Do(e,"type",t),t}],["functionCallExpr",function(e,t){return So(Bo(e,"arguments"),"*").map((function(e){return Qo(e,t)})),function(e,t){if(!t||!t.ia)return{type:59,g:2};var n=Bo(e,"functionName"),r=Oo(n),o=r.localName,a=r.prefix,i=r.namespaceURI;if(r=So(Bo(e,"arguments"),"*"),null===i){if(!(a=t.ia.Ra({localName:o,prefix:a},r.length)))return{type:59,g:2};o=a.localName,Do(n,"URI",i=a.namespaceURI),n[2]=o}return(t=t.ia.za(i,o,r.length))&&63!==t.i.type?(59!==t.i.type&&Do(e,"type",t.i),t.i):{type:59,g:2}}(e,t)}],["arrowExpr",function(e,t){return Qo(Bo(e,"argExpr")[1],t),function(e,t){if(!t||!t.ia)return{type:59,g:2};var n=Bo(e,"EQName");if(!n)return{type:59,g:2};var r=Oo(n);n=r.localName;var o=r.prefix;return r=So(Bo(e,"arguments"),"*"),(n=t.ia.Ra({localName:n,prefix:o},r.length))&&(t=t.ia.za(n.namespaceURI,n.localName,r.length+1))?(59!==t.i.type&&Do(e,"type",t.i),t.i):{type:59,g:2}}(e,t)}],["dynamicFunctionInvocationExpr",function(e,t){return Qo(Co(e,["functionItem","*"]),t),(e=Bo(e,"arguments"))&&Qo(e,t),{type:59,g:2}}],["namedFunctionRef",function(e,t){return function(e,t){if(!t||!t.ia)return{type:59,g:2};var n=Bo(e,"functionName"),r=Oo(n),o=r.localName,a=r.namespaceURI,i=r.prefix;if(r=Number(Co(e,["integerConstantExpr","value"])[1]),!a){if(!(a=t.ia.Ra({localName:o,prefix:i},r)))return{type:59,g:2};o=a.localName,Do(n,"URI",a=a.namespaceURI)}return(t=t.ia.za(a,o,r)||null)?(59!==t.i.type&&63!==t.i.type&&Do(e,"type",t.i),t.i):{type:59,g:2}}(e,t)}],["inlineFunctionExpr",function(e,t){return Qo(Bo(e,"functionBody")[1],t),Do(e,"type",t={type:60,g:3}),t}],["castExpr",function(e){var t=Co(e,["singleType","atomicType"]);return 59!==(t={type:ge(Io(t,"prefix")+":"+t[2]),g:3}).type&&Do(e,"type",t),t}],["castableExpr",function(e){var t={type:0,g:3};return Do(e,"type",t),t}],["simpleMapExpr",function(e,t){for(var n,r=So(e,"pathExpr"),o=0;o<r.length;o++)n=Qo(r[o],t);return null!=n?(59!==(t={type:n.type,g:2}).type&&Do(e,"type",t),e=t):e={type:59,g:2},e}],["mapConstructor",function(e,t){return So(e,"mapConstructorEntry").map((function(e){return{key:Qo(Co(e,["mapKeyExpr","*"]),t),value:Qo(Co(e,["mapValueExpr","*"]),t)}})),function(e){var t={type:61,g:3};return Do(e,"type",t),t}(e)}],["arrayConstructor",function(e,t){return So(Bo(e,"*"),"arrayElem").map((function(e){return Qo(e,t)})),function(e){var t={type:62,g:3};return Do(e,"type",t),t}(e)}],["unaryLookup",function(e){return Bo(e,"NCName"),{type:59,g:2}}],["typeswitchExpr",function(e,t){var n=Qo(Bo(e,"argExpr")[1],t),r=So(e,"typeswitchExprCaseClause").map((function(e){return Qo(Co(e,["resultExpr"])[1],t)}));return function(e,t,n,r){if(!t||n.includes(void 0))return{type:59,g:2};for(var o=So(e,"typeswitchExprCaseClause"),a=0;a<n.length;a++){var i=Bo(o[a],"*");switch(i[0]){case"sequenceType":if(i=Yo(i,t,n[a]))return 59!==i.type&&Do(e,"type",i),i;continue;case"sequenceTypeUnion":for(r=So(i,"*"),o=0;2>o;o++)if(i=Yo(r[o],t,n[a]))return 59!==i.type&&Do(e,"type",i),i;default:return{type:59,g:2}}}return 59!==r.type&&Do(e,"type",r),r}(e,n,r,Qo(Co(e,["typeswitchExprDefaultClause","resultExpr"])[1],t))}],["quantifiedExpr",function(e,t){return So(e,"*").map((function(e){return Qo(e,t)})),function(e){var t={type:0,g:3};return Do(e,"type",t),t}(e)}],["x:stackTrace",function(e,t){return Qo((e=So(e,"*"))[0],t)}],["queryBody",function(e,t){return Qo(e[1],t)}],["flworExpr",function(e,t){return function(e,t){for(var n=Qo,r=!1,o=1;o<e.length;o++)switch(e[o][0]){case"letClause":oa(t);var a=e[o],i=t,s=n,u=Co(a,["letClauseItem","typedVariableBinding","varName"]);u=Oo(u),s=s((a=Co(a,["letClauseItem","letExpr"]))[1],i),ra(i,u.localName,s);break;case"forClause":r=!0,oa(t),$o(e[o],t,n);break;case"whereClause":oa(t),n(i=e[o],t),Do(i,"type",{type:0,g:3});break;case"orderByClause":oa(t);break;case"returnClause":return i=n,Do(n=Co(o=e[o],["*"]),"type",t=i(n,t)),Do(o,"type",t),(n=t)?(r&&(n={type:n.type,g:2}),59!==n.type&&Do(e,"type",n),n):{type:59,g:2};default:return(n=n(e[o],t))?(r&&(n={type:n.type,g:2}),59!==n.type&&Do(e,"type",n),n):{type:59,g:2}}if(!(0<t.h))throw Error("Variable scope out of bound");t.h--,t.s.pop(),t.A.pop()}(e,t)}],["varRef",function(e,t){var n,r=Oo(Bo(e,"name"));e:{for(n=t.h;0<=n;n--){var o=t.s[n][r.localName];if(o){n=o;break e}}n=void 0}return n&&59!==n.type&&Do(e,"type",n),null===r.namespaceURI&&(void 0!==(t=t.ba(r.prefix))&&Do(e,"URI",t)),n}]]);function na(e){this.h=0,this.ia=e,this.s=[{}],this.A=[{}]}function ra(e,t,n){if(e.s[e.h][t])throw Error("Another variable of in the scope "+e.h+" with the same name "+t+" already exists");e.s[e.h][t]=n}function oa(e){e.h++,e.s.push({}),e.A.push({})}function aa(e,t){var n={};sr.call(this,new xr((n.external=1,n)),e,{C:e.every((function(e){return e.C}))},!1,t),this.j=e}function ia(e,t){var n={};sr.call(this,new xr((n.external=1,n)),e,{C:e.every((function(e){return e.C}))},!1,t),this.j=e}function sa(e){if(null===e)throw Error("XPDY0002: context is absent, it needs to be present to use axes.");if(!ee(e.type,53))throw Error("XPTY0020: Axes can only be applied to nodes.");return e.value}function ua(e,t){t=t||{Oa:!1},sr.call(this,e.s,[e],{S:"reverse-sorted",Y:!1,subtree:!1,C:!1}),this.j=e,this.u=!!t.Oa}na.prototype.ba=function(e){for(var t=this.h;0<=t;t--){var n=this.A[t][e];if(void 0!==n)return n}return this.ia?this.ia.ba(e):void 0},y(aa,sr),aa.prototype.h=function(e,t){return 0===this.j.length?ce.o(new _e([])):ur(this.j[0],e,t).L((function(e){return ce.o(new _e(e.map((function(e){return le(ce.o(e))}))))}))},y(ia,sr),ia.prototype.h=function(e,t){return ce.o(new _e(this.j.map((function(n){return le(ur(n,e,t))}))))},y(ua,sr),ua.prototype.h=function(e,t){var n=this;t=t.h,e=sa(e.N);var r=this.j.A();return r=r&&(r.startsWith("name-")||"type-1"===r)?"type-1":null,ce.create(function(e,t,n){var r=t;return{next:function(){if(!r)return z;var t=r;return r=Fe(e,t,n),W(Xe(t))}}}(t,this.u?e:Fe(t,e,r),r)).filter((function(e){return n.j.j(e)}))};var ca=new Map([["type-1-or-type-2",["name","type-1","type-2"]],["type-1",["name"]],["type-2",["name"]]]);function la(e,t){if(null===e)return t;if(null===t||e===t)return e;var n=e.startsWith("name-")?"name":e,r=t.startsWith("name-")?"name":t,o=ca.get(n);return void 0!==o&&o.includes(r)?t:void 0!==(t=ca.get(r))&&t.includes(n)?e:"empty"}function pa(e,t){var n={};sr.call(this,new xr((n.attribute=1,n)),[e],{S:"unsorted",subtree:!0,Y:!0,C:!1}),this.j=e,this.u=la(this.j.A(),t)}function ha(e,t){sr.call(this,e.s,[e],{S:"sorted",subtree:!0,Y:!0,C:!1}),this.u=e,this.j=la(t,e.A())}function fa(e,t,n){var r=t.node.nodeType;if(1!==r&&9!==r)return{next:function(){return z}};var o=Me(e,t,n);return{next:function(){if(!o)return z;var t=o;return o=Ge(e,o,n),W(t)}}}function da(e,t){t=t||{Oa:!1},sr.call(this,e.s,[e],{C:!1,Y:!1,S:"sorted",subtree:!0}),this.j=e,this.u=!!t.Oa,this.B=(e=this.j.A())&&(e.startsWith("name-")||"type-1"===e)?"type-1":null}function ma(e,t,n){var r=e.node.nodeType;if(1!==r&&9!==r)return e;for(r=ke(t,e,n);null!==r;){if(1!==r.node.nodeType)return r;r=ke(t,e=r,n)}return e}function ga(e,t,n,r){if(void 0!==n&&n){var o=t,a=!1;return{next:function(){if(a)return z;if(en(o,t))return en(o=ma(t,e,r),t)?(a=!0,z):W(Xe(o));var n=o.node.nodeType,i=9===n||2===n?null:Pe(e,o,r);return null!==i?W(Xe(o=ma(i,e,r))):en(o=9===n?null:Fe(e,o,r),t)?(a=!0,z):W(Xe(o))}}}var i=[fa(e,t,r)];return{next:function(){if(!i.length)return z;for(var t=i[0].next(0);t.done;){if(i.shift(),!i.length)return z;t=i[0].next(0)}return i.unshift(fa(e,t.value,r)),W(Xe(t.value))}}}function ya(e){sr.call(this,e.s,[e],{S:"sorted",Y:!0,subtree:!1,C:!1}),this.j=e,this.u=(e=this.j.A())&&(e.startsWith("name-")||"type-1"===e)?"type-1":null}function va(e,t){sr.call(this,e.s,[e],{S:"sorted",Y:!0,subtree:!1,C:!1}),this.j=e,this.u=la(this.j.A(),t)}function wa(e,t){sr.call(this,e.s,[e],{S:"reverse-sorted",Y:!0,subtree:!0,C:!1}),this.j=e,this.u=la(t,this.j.A())}function Aa(e){sr.call(this,e.s,[e],{C:!1,Y:!0,S:"reverse-sorted",subtree:!1}),this.j=e,this.u=(e=this.j.A())&&(e.startsWith("name-")||"type-1"===e)?"type-1":null}function xa(e,t){sr.call(this,e.s,[e],{C:!1,Y:!0,S:"reverse-sorted",subtree:!1}),this.j=e,this.u=la(this.j.A(),t)}function ba(e,t){sr.call(this,e.s,[e],{S:"sorted",subtree:!0,Y:!0,C:!1}),this.j=e,this.u=la(this.j.A(),t)}function Ea(e,t,n,r){var o=e.s.add(t.s).add(n.s);vr.call(this,o,[e,t,n],{C:e.C&&t.C&&n.C,Y:t.Y===n.Y&&t.Y,S:t.O===n.O?t.O:"unsorted",subtree:t.subtree===n.subtree&&t.subtree},r),this.j=e}function Na(e,t,n){this.location=e,this.s=t,this.h=n}function Ba(e){return e.h instanceof Error?e.location:Ba(e.h)}function Ta(e){var t=e.h instanceof Kr?["Inner error:",e.h.message]:e.h instanceof Error?[e.h.toString()]:Ta(e.h);return t.push(" at <"+e.s+">:"+e.location.start.line+":"+e.location.start.la+" - "+e.location.end.line+":"+e.location.end.la),t}function Ia(e,t,n){vr.call(this,n.s,[n],{C:n.C,Y:n.Y,S:n.O,subtree:n.subtree}),this.j=t,this.J={end:{la:e.end.la,line:e.end.line,offset:e.end.offset},start:{la:e.start.la,line:e.start.line,offset:e.start.offset}}}function Ca(e,t,n,r){sr.call(this,e,t,n,!0),this.j=r,this.I=this.j.I}function Sa(e,t,n,r){var o=[],a=e.J(t,n,r,(function(n){if(e.j instanceof Ca)return yr(Sa(e.j,t,n,r),(function(e){return o=e}));var a=null;return ce.create({next:function(){for(;;){if(!a){var t=n.next(0);if(t.done)return z;t=e.j.u(t.value,r),a=yr(t,(function(e){return o=dr(o,e)})).value}if(!(t=a.next(0)).done)return t;a=null}}})})),i=!1;return{next:function(){if(i)return z;var e=a.M();return i=!0,W(new cr(e,o))}}}function Oa(e,t,n,r){return e.J(t,n,r,(function(n){if(e.j instanceof Ca)return Oa(e.j,t,n,r);var o=null;return ce.create({next:function(){for(;;){if(!o){var t=n.next(0);if(t.done)return z;o=ur(e.j,t.value,r).value}if(!(t=o.next(0)).done)return t;o=null}}})}))}function Ra(e,t,n,r){Ca.call(this,t.s.add(r.s),[t,r],{C:!1},r),this.T=e.prefix,this.ka=e.namespaceURI,this.$b=e.localName,this.mb=null,this.B=n,this.ua=null,this.na=t}function Da(e,t,n){var r={};sr.call(this,new xr((r.external=1,r)),[n],{C:!1,S:"unsorted"}),this.T=e.map((function(e){return e.name})),this.B=e.map((function(e){return e.type})),this.u=null,this.J=t,this.j=n}function Ua(e,t,n){if(Ca.call(this,t.s.add(n.s),[t,n],{C:!1,Y:n.Y,S:n.O,subtree:n.subtree},n),e.prefix||e.namespaceURI)throw Error("Not implemented: let expressions with namespace usage.");this.B=e.prefix,this.T=e.namespaceURI,this.ua=e.localName,this.ka=t,this.na=null}function Ma(e,t){switch(sr.call(this,new xr({}),[],{C:!0,S:"sorted"},!1,t),t.type){case 5:var n=Y(parseInt(e,10),t.type);break;case 1:n=Y(e,t.type);break;case 4:case 3:n=Y(parseFloat(e),t.type);break;default:throw new TypeError("Type "+t+" not expected in a literal")}this.j=function(){return ce.o(n)}}function ka(e,t){var n={};sr.call(this,new xr((n.external=1,n)),e.reduce((function(e,t){return e.concat(t.key,t.value)}),[]),{C:!1},!1,t),this.j=e}function Ga(e,t,n){var r={};sr.call(this,new xr((r.external=1,r)),[],{C:!0},!1,n),this.u=t,this.B=e,this.j=null}y(pa,sr),pa.prototype.h=function(e,t){var n=this;return t=t.h,1!==(e=sa(e.N)).node.nodeType?ce.empty():(e=Oe(t,e,this.u).filter((function(e){return"http://www.w3.org/2000/xmlns/"!==e.node.namespaceURI})).map((function(e){return Xe(e)})).filter((function(e){return n.j.j(e)})),ce.create(e))},pa.prototype.A=function(){return"type-1"},y(ha,sr),ha.prototype.h=function(e,t){var n=this,r=t.h,o=sa(e.N);if(1!==(e=o.node.nodeType)&&9!==e)return ce.empty();var a=null,i=!1;return ce.create({next:function(){for(;!i;){if(!a){if(!(a=Me(r,o,n.j))){i=!0;continue}return W(Xe(a))}if(a=Ge(r,a,n.j))return W(Xe(a));i=!0}return z}}).filter((function(e){return n.u.j(e)}))},y(da,sr),da.prototype.h=function(e,t){var n=this;return e=function(e,t,n){var r=[Wt(t)];return{next:function(t){if(0<r.length&&0!=(1&t)&&r.shift(),!r.length)return z;for(t=r[0].next(0);t.done;){if(r.shift(),!r.length)return z;t=r[0].next(0)}return r.unshift(fa(e,t.value,n)),W(Xe(t.value))}}}(t=t.h,e=sa(e.N),this.B),this.u||e.next(0),ce.create(e).filter((function(e){return n.j.j(e)}))},y(ya,sr),ya.prototype.h=function(e,t){var n=this;return t=t.h,e=sa(e.N),ce.create(function(e,t,n){for(var r=[];t&&9!==t.node.nodeType;t=Fe(e,t,null)){var o=Ge(e,t,n);o&&r.push(o)}var a=null;return{next:function(){for(;a||r.length;){if(!a){a=ga(e,r[0],!1,n);var t=W(Xe(r[0])),o=Ge(e,r[0],n);return o?r[0]=o:r.shift(),t}if(!(t=a.next(0)).done)return t;a=null}return z}}}(t,e,this.u)).filter((function(e){return n.j.j(e)}))},y(va,sr),va.prototype.h=function(e,t){var n=this;return t=t.h,e=sa(e.N),ce.create(function(e,t,n){return{next:function(){return(t=t&&Ge(e,t,n))?W(Xe(t)):z}}}(t,e,this.u)).filter((function(e){return n.j.j(e)}))},y(wa,sr),wa.prototype.h=function(e,t){return(e=Fe(t=t.h,e=sa(e.N),this.u))?(e=Xe(e),this.j.j(e)?ce.o(e):ce.empty()):ce.empty()},y(Aa,sr),Aa.prototype.h=function(e,t){var n=this;return t=t.h,e=sa(e.N),ce.create(function(e,t,n){for(var r=[];t&&9!==t.node.nodeType;t=Fe(e,t,null)){var o=Pe(e,t,n);null!==o&&r.push(o)}var a=null;return{next:function(){for(;a||r.length;){a||(a=ga(e,r[0],!0,n));var t=a.next(0);if(t.done){a=null,t=Pe(e,r[0],n);var o=W(Xe(r[0]));return null===t?r.shift():r[0]=t,o}return t}return z}}}(t,e,this.u)).filter((function(e){return n.j.j(e)}))},y(xa,sr),xa.prototype.h=function(e,t){var n=this;return t=t.h,e=sa(e.N),ce.create(function(e,t,n){return{next:function(){return(t=t&&Pe(e,t,n))?W(Xe(t)):z}}}(t,e,this.u)).filter((function(e){return n.j.j(e)}))},y(ba,sr),ba.prototype.h=function(e){return sa(e.N),this.j.j(e.N)?ce.o(e.N):ce.empty()},ba.prototype.A=function(){return this.u},y(Ea,vr),Ea.prototype.B=function(e,t,n){var r=null,o=n[0](e);return ce.create({next:function(t){return r||(r=(o.getEffectiveBooleanValue()?n[1](e):n[2](e)).value),r.next(t)}})},Ea.prototype.P=function(e){if(vr.prototype.P.call(this,e),this.j.I)throw Kn()},y(Ia,vr),Ia.prototype.B=function(e,t,n){var r=this;t=c(n).next().value;try{var o=t(e)}catch(e){throw new Na(this.J,this.j,e)}return ce.create({next:function(e){try{return o.value.next(e)}catch(e){throw new Na(r.J,r.j,e)}}})},Ia.prototype.P=function(e){try{vr.prototype.P.call(this,e)}catch(e){throw new Na(this.J,this.j,e)}},y(Ca,sr),Ca.prototype.h=function(e,t){var n=this;return this.J(e,Wt(e),t,(function(r){if(n.j instanceof Ca)return Oa(n.j,e,r,t);var o=null;return ce.create({next:function(e){for(;;){if(!o){var a=r.next(0);if(a.done)return z;o=ur(n.j,a.value,t).value}if(!(a=o.next(e)).done)return a;o=null}}})}))},Ca.prototype.u=function(e,t){return Sa(this,e,Wt(e),t)},Ca.prototype.P=function(e){sr.prototype.P.call(this,e),this.I=this.j.I;for(var t=(e=c(this.ha)).next();!t.done;t=e.next())if((t=t.value)!==this.j&&t.I)throw Kn()},y(Ra,Ca),Ra.prototype.J=function(e,t,n,r){var o=this,a=null,i=null,s=0;return r({next:function(){for(var e={};;){if(!a){var r=t.next(0);if(r.done)return z;i=r.value,s=0,a=ur(o.na,i,n).value}if(e.hb=a.next(0),!e.hb.done)return s++,(r={})[o.mb]=function(e){return function(){return ce.o(e.hb.value)}}(e),e=r,o.ua&&(e[o.ua]=function(){return ce.o(new pe(5,s))}),W(Bt(i,e));a=null,e={hb:e.hb}}}})},Ra.prototype.P=function(e){if(this.T&&(this.ka=e.ba(this.T),!this.ka&&this.T))throw Error("XPST0081: Could not resolve namespace for prefix "+this.T+" in a for expression");if(this.na.P(e),wo(e),this.mb=bo(e,this.ka,this.$b),this.B){if(this.B.prefix&&(this.B.namespaceURI=e.ba(this.B.prefix),!this.B.namespaceURI&&this.B.prefix))throw Error("XPST0081: Could not resolve namespace for prefix "+this.T+" in the positionalVariableBinding in a for expression");this.ua=bo(e,this.B.namespaceURI,this.B.localName)}if(this.j.P(e),No(e),this.na.I)throw Kn();this.j.I&&(this.I=!0)},y(Da,sr),Da.prototype.h=function(e,t){var n=this,r=new we({l:this.B,arity:this.B.length,Pa:!0,I:this.j.I,localName:"dynamic-function",namespaceURI:"",i:this.J,value:function(r,o,a,i){for(var s=[],u=3;u<arguments.length;++u)s[u-3]=arguments[u];return u=Bt(Nt(e,-1,null,ce.empty()),n.u.reduce((function(e,t,n){return e[t]=le(s[n]),e}),Object.create(null))),ur(n.j,u,t)}});return ce.o(r)},Da.prototype.P=function(e){if(wo(e),this.u=this.T.map((function(t){return bo(e,t.namespaceURI,t.localName)})),this.j.P(e),No(e),this.j.I)throw Error("Not implemented: inline functions can not yet be updating.")},y(Ua,Ca),Ua.prototype.J=function(e,t,n,r){var o=this;return r({next:function(){var e=t.next(0);if(e.done)return z;var r={};return W(e=Bt(e=e.value,(r[o.na]=le(ur(o.ka,e,n)),r)))}})},Ua.prototype.P=function(e){if(this.B&&(this.T=e.ba(this.B),!this.T&&this.B))throw Error("XPST0081: Could not resolve namespace for prefix "+this.B+" using in a for expression");if(this.ka.P(e),wo(e),this.na=bo(e,this.T,this.ua),this.j.P(e),No(e),this.I=this.j.I,this.ka.I)throw Kn()},y(Ma,sr),Ma.prototype.h=function(){return this.j()},y(ka,sr),ka.prototype.h=function(e,t){var n=this,r=this.j.map((function(n){return Ut(ur(n.key,e,t),t).$({default:function(){throw Error("XPTY0004: A key of a map should be a single atomizable value.")},o:function(e){return e}})}));return Le(r,(function(r){return ce.o(new Ye(r.map((function(r,o){return{key:r,value:le(ur(n.j[o].value,e,t))}}))))}))},y(Ga,sr),Ga.prototype.h=function(){var e=new we({l:this.j.l,I:this.j.I,arity:this.u,localName:this.j.localName,namespaceURI:this.j.namespaceURI,i:this.j.i,value:this.j.m});return ce.o(e)},Ga.prototype.P=function(e){var t=this.B.namespaceURI,n=this.B.localName,r=this.B.prefix;if(null===t){var o=e.Ra({localName:n,prefix:r},this.u);if(!o)throw Error("XPST0017: The function "+(r?r+":":"")+n+" with arity "+this.u+" could not be resolved. "+eo(n));t=o.namespaceURI,n=o.localName}if(this.j=e.za(t,n,this.u)||null,!this.j)throw e=this.B,Error("XPST0017: Function "+(e.namespaceURI?"Q{"+e.namespaceURI+"}":e.prefix?e.prefix+":":"")+e.localName+" with arity of "+this.u+" not registered. "+eo(n));sr.prototype.P.call(this,e)};var Fa={},Pa=(Fa[5]=5,Fa[27]=5,Fa[28]=5,Fa[31]=5,Fa[32]=5,Fa[33]=5,Fa[34]=5,Fa[30]=5,Fa[36]=5,Fa[35]=5,Fa[38]=5,Fa[37]=5,Fa[29]=5,Fa[4]=4,Fa[6]=6,Fa[3]=3,Fa);function Ha(e,t,n){sr.call(this,t.s,[t],{C:!1},!1,n),this.u=t,this.j=e}function _a(e,t){sr.call(this,e.reduce((function(e,t){return e.add(t.s)}),new xr({})),e,{C:e.every((function(e){return e.C}))},!1,t),this.j=e,this.u=e.reduce((function(e,t){return la(e,t.A())}),null)}function ja(e,t){var n,r=e.reduce((function(e,t){return 0<br(e,t.s)?e:t.s}),new xr({}));for(sr.call(this,r,e,{C:e.every((function(e){return e.C}))},!1,t),t=0;t<e.length&&(void 0===n&&(n=e[t].A()),null!==n);++t)if(n!==e[t].A()){n=null;break}this.u=n,this.j=e}function Xa(e,t){var n;return ce.create({next:function(r){for(;;){if(!n){var o=e.value.next(r);if(o.done)return z;n=Dt(o.value,t)}if(!(o=n.value.next(r)).done)return o;n=null}}})}function La(e,t,n){function r(e,t){return{V:i?i(e):e,W:s?s(t):t}}function o(e){return ee(t,e)&&ee(n,e)}function a(e){return 0<e.filter((function(e){return ee(t,e)})).length&&0<e.filter((function(e){return ee(n,e)})).length}var i=null,s=null;if(ee(t,19)&&ee(n,19)?t=n=1:ee(t,19)?(i=function(e){return zt(e,n)},t=n):ee(n,19)&&(s=function(e){return zt(e,t)},n=t),ee(t,23)&&ee(n,23))return function(e,t){if("eqOp"===e)return function(e,n){return e=(n=t(e,n)).V,n=n.W,e.value.namespaceURI===n.value.namespaceURI&&e.value.localName===n.value.localName};if("neOp"===e)return function(e,n){return e=(n=t(e,n)).V,n=n.W,e.value.namespaceURI!==n.value.namespaceURI||e.value.localName!==n.value.localName};throw Error('XPTY0004: Only the "eq" and "ne" comparison is defined for xs:QName')}(e,r);if(o(0)||a([1,47,61])||a([2,47,61])||o(20)||o(22)||o(21)||a([1,20])){var u=function(e,t){switch(e){case"eqOp":return function(e,n){return(e=t(e,n)).V.value===e.W.value};case"neOp":return function(e,n){return(e=t(e,n)).V.value!==e.W.value};case"ltOp":return function(e,n){return(e=t(e,n)).V.value<e.W.value};case"leOp":return function(e,n){return(e=t(e,n)).V.value<=e.W.value};case"gtOp":return function(e,n){return(e=t(e,n)).V.value>e.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(o(16)&&(u=function(e,t){switch(e){case"ltOp":return function(e,n){return(e=t(e,n)).V.value.ga<e.W.value.ga};case"leOp":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};case"gtOp":return function(e,n){return(e=t(e,n)).V.value.ga>e.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),void 0!==u)||o(17)&&(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.ea<e.W.value.ea};case"leOp":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};case"gtOp":return function(e,n){return(e=t(e,n)).V.value.ea>e.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),void 0!==u)||o(18)&&(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),void 0!==u))return u;if((o(9)||o(7)||o(8))&&(u=function(e,t){switch(e){case"eqOp":return function(e,n,r){return pt((e=t(e,n)).V.value,e.W.value,Et(r))};case"neOp":return function(e,n,r){return!pt((e=t(e,n)).V.value,e.W.value,Et(r))};case"ltOp":return function(e,n,r){return e=t(e,n),r=Et(r),0>lt(e.V.value,e.W.value,r)};case"leOp":return function(e,n,r){var o;return e=(n=t(e,n)).V,n=n.W,(o=pt(e.value,n.value,Et(r)))||(r=Et(r),o=0>lt(e.value,n.value,r)),o};case"gtOp":return function(e,n,r){return e=t(e,n),r=Et(r),0<lt(e.V.value,e.W.value,r)};case"geOp":return function(e,n,r){var o;return e=(n=t(e,n)).V,n=n.W,(o=pt(e.value,n.value,Et(r)))||(r=Et(r),o=0<lt(e.value,n.value,r)),o}}}(e,r),void 0!==u))return u;if((o(11)||o(12)||o(13)||o(14)||o(15))&&(u=function(e,t){switch(e){case"eqOp":return function(e,n,r){return pt((e=t(e,n)).V.value,e.W.value,Et(r))};case"neOp":return function(e,n,r){return!pt((e=t(e,n)).V.value,e.W.value,Et(r))}}}(e,r),void 0!==u))return u;throw Error("XPTY0004: "+e+" not available for "+fe[t]+" and "+fe[n])}y(Ha,sr),Ha.prototype.h=function(e,t){var n=this;return Ut(ur(this.u,e,t),t).L((function(e){if(0===e.length)return ce.empty();var t=e[0];if(n.type)return e="+"===n.j?+t.value:-t.value,0===t.type&&(e=Number.NaN),ce.o(Y(e,n.type.type));if(1<e.length)throw Error("XPTY0004: The operand to a unary operator must be a sequence with a length less than one");return ee(t.type,19)?(t=zt(t,3).value,ce.o(Y("+"===n.j?t:-t,3))):ee(t.type,2)?"+"===n.j?ce.o(t):ce.o(Y(-1*t.value,Pa[t.type])):ce.o(Y(Number.NaN,3))}))},y(_a,sr),_a.prototype.h=function(e,t){var n=this,r=0,o=null,a=!1,i=null;if(null!==e){var s=e.N;null!==s&&ee(s.type,53)&&(i=xe(s.value))}return ce.create({next:function(){if(!a){for(;r<n.j.length;){if(!o){var s=n.j[r];if(null!==i&&null!==s.A()&&!i.includes(s.A()))return r++,a=!0,W(Q);o=ur(s,e,t)}if(!1===o.getEffectiveBooleanValue())return a=!0,W(Q);o=null,r++}return a=!0,W(V)}return z}})},_a.prototype.A=function(){return this.u},y(ja,sr),ja.prototype.h=function(e,t){var n=this,r=0,o=null,a=!1,i=null;if(null!==e){var s=e.N;null!==s&&ee(s.type,53)&&(i=xe(s.value))}return ce.create({next:function(){if(!a){for(;r<n.j.length;){if(!o){var s=n.j[r];if(null!==i&&null!==s.A()&&!i.includes(s.A())){r++;continue}o=ur(s,e,t)}if(!0===o.getEffectiveBooleanValue())return a=!0,W(V);o=null,r++}return a=!0,W(Q)}return z}})},ja.prototype.A=function(){return this.u};var $a=Object.create(null);function qa(e,t,n){var r=t+"~"+n+"~"+e,o=$a[r];return o||(o=$a[r]=La(e,t,n)),o}function Ya(e,t,n){sr.call(this,t.s.add(n.s),[t,n],{C:!1}),this.j=t,this.B=n,this.u=e}y(Ya,sr),Ya.prototype.h=function(e,t){var n=this,r=ur(this.j,e,t),o=ur(this.B,e,t),a=Xa(r,t),i=Xa(o,t);return a.$({empty:function(){return ce.empty()},o:function(){return i.$({empty:function(){return ce.empty()},o:function(){var t=a.first(),r=i.first();return qa(n.u,t.type,r.type)(t,r,e)?ce.ca():ce.X()},multiple:function(){throw Error("XPTY0004: Sequences to compare are not singleton.")}})},multiple:function(){throw Error("XPTY0004: Sequences to compare are not singleton.")}})};var Va={},Qa=(Va.equalOp="eqOp",Va.notEqualOp="neOp",Va.lessThanOrEqualOp="leOp",Va.lessThanOp="ltOp",Va.greaterThanOrEqualOp="geOp",Va.greaterThanOp="gtOp",Va);function Ja(e,t,n){sr.call(this,t.s.add(n.s),[t,n],{C:!1}),this.j=t,this.B=n,this.u=e}function Ka(e,t,n,r){if(!ee(n,53)||!ee(r,53))throw Error("XPTY0004: Sequences to compare are not nodes");switch(e){case"isOp":return function(e,t){return e!==t||47!==e&&53!==e&&54!==e&&55!==e&&56!==e&&57!==e&&58!==e?function(){return!1}:function(e,t){return en(e.first().value,t.first().value)}}(n,r);case"nodeBeforeOp":return t?function(e,n){return 0>an(t,e.first(),n.first())}:void 0;case"nodeAfterOp":return t?function(e,n){return 0<an(t,e.first(),n.first())}:void 0;default:throw Error("Unexpected operator")}}function za(e,t,n){sr.call(this,t.s.add(n.s),[t,n],{C:!1}),this.j=t,this.B=n,this.u=e}function Wa(e,t,n,r){return n.L((function(n){if(n.some((function(e){return!ee(e.type,53)})))throw Error("XPTY0004: Sequences given to "+e+" should only contain nodes.");return"sorted"===r?ce.create(n):"reverse-sorted"===r?ce.create(n.reverse()):ce.create(sn(t,n))}))}function Za(e,t,n,r){sr.call(this,0<br(t.s,n.s)?t.s:n.s,[t,n],{C:t.C&&n.C},!1,r),this.j=e,this.u=t,this.B=n}function ei(e,t){vr.call(this,e.reduce((function(e,t){return e.add(t.s)}),new xr({})),e,{S:"unsorted",C:e.every((function(e){return e.C}))},t)}function ti(e,t,n){sr.call(this,new xr({}).add(e.s),[e,t],{C:e.C&&t.C},!1,n),this.j=e,this.u=t}function ni(e,t,n){if(sr.call(this,e.s,[e],{C:!1}),this.j=ge(t.prefix?t.prefix+":"+t.localName:t.localName),46===this.j||45===this.j||44===this.j)throw Error("XPST0080: Casting to xs:anyAtomicType, xs:anySimpleType or xs:NOTATION is not permitted.");if(t.namespaceURI)throw Error("Not implemented: castable as expressions with a namespace URI.");this.B=e,this.u=n}function ri(e,t,n){if(sr.call(this,e.s,[e],{C:!1}),this.j=ge(t.prefix?t.prefix+":"+t.localName:t.localName),46===this.j||45===this.j||44===this.j)throw Error("XPST0080: Casting to xs:anyAtomicType, xs:anySimpleType or xs:NOTATION is not permitted.");if(t.namespaceURI)throw Error("Not implemented: casting expressions with a namespace URI.");this.B=e,this.u=n}function oi(e,t){var n=e.value,r=null,o=!1;return ce.create({next:function(){for(;!o;){if(!r){var e=n.next(0);if(e.done)return o=!0,W(V);r=t(e.value)}if(e=r.getEffectiveBooleanValue(),r=null,!1===e)return o=!0,W(Q)}return z}})}function ai(e,t,n,r){sr.call(this,e.s,[e],{C:!1},!1,r),this.B=e,this.u=t,this.j=n}function ii(e,t){return!(null===e||null===t||!ee(e.type,53)||!ee(t.type,53))&&en(e.value,t.value)}function si(e){var t=e.next(0);if(t.done)return ce.empty();var n=null,r=null;return ce.create({next:function(o){if(t.done)return z;n||(n=t.value.value);do{var a=n.next(o);if(a.done){if((t=e.next(0)).done)return a;n=t.value.value}}while(a.done||ii(a.value,r));return r=a.value,a}})}function ui(e,t){var n=[];!function(){for(var e=t.next(0),r={};!e.done;)r.jb=e.value.value,e={current:r.jb.next(0),next:function(e){return function(t){return e.jb.next(t)}}(r)},e.current.done||n.push(e),e=t.next(0),r={jb:r.jb}}();var r=null,o=!1,a={};return ce.create((a[Symbol.iterator]=function(){return this},a.next=function(){o||(o=!0,n.every((function(e){return ee(e.current.value.type,53)}))&&n.sort((function(t,n){return an(e,t.current.value,n.current.value)})));do{if(!n.length)return z;var t=n.shift(),a=t.current;if(t.current=t.next(0),!ee(a.value.type,53))return a;if(!t.current.done){for(var i=0,s=n.length-1,u=0;i<=s;){u=Math.floor((i+s)/2);var c=an(e,t.current.value,n[u].current.value);if(0===c){i=u;break}0<c?i=u+1:s=u-1}n.splice(i,0,t)}}while(ii(a.value,r));return r=a.value,a},a))}function ci(e,t){var n=e.reduce((function(e,t){return 0<br(e,t.s)?e:t.s}),new xr({}));sr.call(this,n,e,{C:e.every((function(e){return e.C}))},!1,t),this.j=e}function li(e){return e.every((function(e){return null===e||ee(e.type,5)||ee(e.type,4)}))||null!==e.map((function(e){return e?Mt(e.type):null})).reduce((function(e,t){return null===t||t===e?e:null}))?e:e.every((function(e){return null===e||ee(e.type,1)||ee(e.type,20)}))?e.map((function(e){return e?zt(e,1):null})):e.every((function(e){return null===e||ee(e.type,4)||ee(e.type,6)}))?e.map((function(e){return e?zt(e,6):e})):e.every((function(e){return null===e||ee(e.type,4)||ee(e.type,6)||ee(e.type,3)}))?e.map((function(e){return e?zt(e,3):e})):null}function pi(e,t){var n=new xr({});Ca.call(this,n,[t].concat(p(e.map((function(e){return e.da})))),{C:!1,Y:!1,S:"unsorted",subtree:!1},t),this.B=e}function hi(e){sr.call(this,e?e.s:new xr({}),e?[e]:[],{S:"sorted",subtree:!1,Y:!1,C:!1}),this.j=e}function fi(e){sr.call(this,new xr({}),[],{S:"sorted"},!1,e)}function di(e,t){var n=e.every((function(e){return e.Y})),r=e.every((function(e){return e.subtree}));sr.call(this,e.reduce((function(e,t){return e.add(t.s)}),new xr({})),e,{C:!1,Y:n,S:t?"sorted":"unsorted",subtree:r}),this.j=e,this.u=t}function mi(e,t){sr.call(this,e.s.add(t.s),[e,t],{C:e.C&&t.C,Y:e.Y,S:e.O,subtree:e.subtree}),this.u=e,this.j=t}function gi(e,t,n){if(n=[n],ee(e.type,62))if("*"===t)n.push.apply(n,p(e.R.map((function(e){return e()}))));else{if(!ee(t.type,5))throw ao("The key specifier is not an integer.");var r=t.value;if(e.R.length<r||0>=r)throw Error("FOAY0001: Array index out of bounds");n.push(e.R[r-1]())}else{if(!ee(e.type,61))throw ao("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 $e(e.key,t)})))&&n.push(e.value())}return It(n)}function yi(e,t,n,r,o){return"*"===t?gi(e,t,n):(t=le(t=ur(t,r,o))().L((function(t){return t.reduce((function(t,n){return gi(e,n,t)}),new ne)})),It([n,t]))}function vi(e,t){sr.call(this,e.s,[e].concat("*"===t?[]:[t]),{C:e.C,S:e.O,subtree:e.subtree}),this.j=e,this.u=t}function wi(e,t){var n={};sr.call(this,new xr((n.external=1,n)),"*"===e?[]:[e],{C:!1},!1,t),this.j=e}function Ai(e,t,n,r){var o=t.map((function(e){return e.eb}));t=t.map((function(e){return e.name}));var a=o.reduce((function(e,t){return e.add(t.s)}),n.s);sr.call(this,a,o.concat(n),{C:!1},!1,r),this.u=e,this.B=t,this.J=o,this.T=n,this.j=null}function xi(e){sr.call(this,e,[],{C:!1})}function bi(e){var t={};xi.call(this,new xr((t.nodeType=1,t))),this.u=e}function Ei(e,t){t=void 0===t?{kind:null}:t;var n=e.prefix,r=e.namespaceURI,o={};"*"!==(e=e.localName)&&(o.nodeName=1),o.nodeType=1,xi.call(this,new xr(o)),this.u=e,this.J=r,this.B=n,this.T=t.kind}function Ni(e){var t={};xi.call(this,new xr((t.nodeName=1,t))),this.u=e}function Bi(e){xi.call(this,new xr({})),this.u=e}function Ti(e,t,n){sr.call(this,new xr({}),[],{C:!1,S:"unsorted"}),this.B=n,this.u=t,this.J=e,this.j=null}function Ii(e,t){var n=new xr({});Ca.call(this,n,[e,t],{C:!1,Y:!1,S:"unsorted",subtree:!1},t),this.B=e}function Ci(e,t){var n=t.h,r=t.s,o=t.A;switch(e.node.nodeType){case 1:var a=r.createElementNS(e.node.namespaceURI,e.node.nodeName);for(n.getAllAttributes(e.node).forEach((function(e){return o.setAttributeNS(a,e.namespaceURI,e.nodeName,e.value)})),e=(r=c(De(n,e))).next();!e.done;e=r.next())e=Ci(e.value,t),o.insertBefore(a,e.node,null);return{node:a,F:null};case 2:return(t=r.createAttributeNS(e.node.namespaceURI,e.node.nodeName)).value=Ue(n,e),{node:t,F:null};case 4:return{node:r.createCDATASection(Ue(n,e)),F:null};case 8:return{node:r.createComment(Ue(n,e)),F:null};case 9:for(r=r.createDocument(),e=(n=c(De(n,e))).next();!e.done;e=n.next())e=Ci(e.value,t),o.insertBefore(r,e.node,null);return{node:r,F:null};case 7:return{node:r.createProcessingInstruction(e.node.target,Ue(n,e)),F:null};case 3:return{node:r.createTextNode(Ue(n,e)),F:null}}}function Si(e,t){var n=t.A,r=t.s,o=t.h;if(!Ie(e.node))return Ci(e,t).node;switch(e.node.nodeType){case 2:return(r=r.createAttributeNS(e.node.namespaceURI,e.node.nodeName)).value=Ue(o,e),r;case 8:return r.createComment(Ue(o,e));case 1:var a=e.node.prefix,i=e.node.localName,s=r.createElementNS(e.node.namespaceURI,a?a+":"+i:i);return De(o,e).forEach((function(e){e=Si(e,t),n.insertBefore(s,e,null)})),Oe(o,e).forEach((function(e){n.setAttributeNS(s,e.node.namespaceURI,e.node.nodeName,Ue(o,e))})),s.normalize(),s;case 7:return r.createProcessingInstruction(e.node.target,Ue(o,e));case 3:return r.createTextNode(Ue(o,e))}}function Oi(e,t,n){var r=e.node;if(!(Ie(r)||n||e.F))return r;r=t.ha;var o=[];return n?Si(e,t):(e=function(e,t,n){var r=e;for(e=Fe(n,r);null!==e;){if(2===r.node.nodeType)t.push(r.node.nodeName);else{var o=De(n,e);t.push(o.findIndex((function(e){return en(e,r)})))}e=Fe(n,r=e)}return r}(e,o,t.h),(n=r.get(e.node))||(n={node:Si(e,t),F:null},r.set(e.node,n)),function(e,t,n){for(var r={};0<t.length;)r.Xa=t.pop(),e="string"==typeof r.Xa?Oe(n,e).find(function(e){return function(t){return t.node.nodeName===e.Xa}}(r)):De(n,e)[r.Xa],r={Xa:r.Xa};return e.node}(n,o,t.h))}function Ri(e){this.type=e}function Di(e){this.type="delete",this.target=e}function Ui(e,t,n){this.type=n,this.target=e,this.content=t}function Mi(e,t){Ui.call(this,e,t,"insertAfter")}function ki(e,t){this.type="insertAttributes",this.target=e,this.content=t}function Gi(e,t){Ui.call(this,e,t,"insertBefore")}function Fi(e,t){Ui.call(this,e,t,"insertIntoAsFirst")}function Pi(e,t){Ui.call(this,e,t,"insertIntoAsLast")}function Hi(e,t){Ui.call(this,e,t,"insertInto")}function _i(e,t){this.type="rename",this.target=e,this.s=t.va?t:new ve(t.prefix,t.namespaceURI,t.localName)}function ji(e,t){this.type="replaceElementContent",this.target=e,this.text=t}function Xi(e,t){this.type="replaceNode",this.target=e,this.s=t}function Li(e,t){this.type="replaceValue",this.target=e,this.s=t}function $i(e,t){return new Xi(e,t)}function qi(e){mr.call(this,new xr({}),[e],{C:!1,S:"unsorted"}),this.j=e}function Yi(e,t,n,r,o,a){var i=t.h;return e.reduce((function e(t,n){return ee(n.type,62)?(n.R.forEach((function(n){return n().M().forEach((function(n){return e(t,n)}))})),t):(t.push(n),t)}),[]).forEach((function(e,s,u){if(ee(e.type,47)){if(o)throw a(e.value,i);n.push(e.value.node)}else if(ee(e.type,46)||ee(e.type,53)&&3===e.value.node.nodeType){var c=ee(e.type,46)?zt(Dt(e,t).first(),1).value:Ue(i,e.value);0!==s&&ee(u[s-1].type,46)&&ee(e.type,46)?(r.push({data:" "+c,Qa:!0,nodeType:3}),o=!0):c&&(r.push({data:""+c,Qa:!0,nodeType:3}),o=!0)}else if(ee(e.type,55)){var l=[];De(i,e.value).forEach((function(e){return l.push(Xe(e))})),o=Yi(l,t,n,r,o,a)}else{if(!ee(e.type,53)){if(ee(e.type,60))throw Ot(e.type);throw Error("Atomizing "+e.type+" is not implemented.")}r.push(e.value.node),o=!0}})),o}function Vi(e,t,n){var r=[],o=[],a=!1;return e.forEach((function(e){a=Yi(e,t,r,o,a,n)})),{attributes:r,Ta:o}}function Qi(e,t,n,r,o){var a=[];switch(e){case 4:r.length&&a.push(new ki(t,r)),o.length&&a.push(new Fi(t,o));break;case 5:r.length&&a.push(new ki(t,r)),o.length&&a.push(new Pi(t,o));break;case 3:r.length&&a.push(new ki(t,r)),o.length&&a.push(new Hi(t,o));break;case 2:r.length&&a.push(new ki(n,r)),o.length&&a.push(new Gi(t,o));break;case 1:r.length&&a.push(new ki(n,r)),o.length&&a.push(new Mi(t,o))}return a}function Ji(e,t,n){mr.call(this,new xr({}),[e,n],{C:!1,S:"unsorted"}),this.J=e,this.j=t,this.B=n}function Ki(){return St("Casting not supported from given type to a single xs:string or xs:untypedAtomic or any of its derived types.")}y(Ja,sr),Ja.prototype.h=function(e,t){var n=this,r=ur(this.j,e,t),o=ur(this.B,e,t);return r.$({empty:function(){return ce.X()},default:function(){return o.$({empty:function(){return ce.X()},default:function(){var a=Xa(r,t),i=Xa(o,t);return function(e,t,n,r){return e=Qa[e],n.L((function(n){return t.filter((function(t){for(var o=0,a=n.length;o<a;++o){var i=n[o],s=void 0,u=void 0,l=t.type,p=i.type;if((ee(l,19)||ee(p,19))&&(ee(l,2)?s=3:ee(p,2)?u=3:ee(l,17)?s=17:ee(p,17)?u=17:ee(l,16)?s=16:ee(p,16)?u=16:ee(l,19)?u=p:ee(p,19)&&(s=l)),s=(u=c([u,s])).next().value,u=u.next().value,s?t=zt(t,s):u&&(i=zt(i,u)),qa(e,t.type,i.type)(t,i,r))return!0}return!1})).$({default:function(){return ce.ca()},empty:function(){return ce.X()}})}))}(n.u,a,i,e)}})}})},y(za,sr),za.prototype.h=function(e,t){var n=this,r=ur(this.j,e,t),o=ur(this.B,e,t);return r.$({empty:function(){return ce.empty()},multiple:function(){throw Error("XPTY0004: Sequences to compare are not singleton")},o:function(){return o.$({empty:function(){return ce.empty()},multiple:function(){throw Error("XPTY0004: Sequences to compare are not singleton")},o:function(){var a=r.first(),i=o.first();return Ka(n.u,t.h,a.type,i.type)(r,o,e)?ce.ca():ce.X()}})}})},y(Za,sr),Za.prototype.h=function(e,t){var n=this,r=Wa(this.j,t.h,ur(this.u,e,t),this.u.O);e=Wa(this.j,t.h,ur(this.B,e,t),this.B.O);var o=r.value,a=e.value,i=null,s=null,u=!1,c=!1;return ce.create({next:function(){if(u)return z;for(;!c;){if(!i){var e=o.next(0);if(e.done)return u=!0,z;i=e.value}if(!s){if((e=a.next(0)).done){c=!0;break}s=e.value}if(en(i.value,s.value)){if(e=W(i),s=i=null,"intersectOp"===n.j)return e}else if(0>an(t.h,i,s)){if(e=W(i),i=null,"exceptOp"===n.j)return e}else s=null}return"exceptOp"===n.j?null!==i?(e=W(i),i=null,e):o.next(0):(u=!0,z)}})},y(ei,vr),ei.prototype.B=function(e,t,n){return n.length?It(n.map((function(t){return t(e)}))):ce.empty()},y(ti,sr),ti.prototype.h=function(e,t){var n=this,r=xt(e,ur(this.j,e,t)),o=null,a=null,i=!1;return ce.create({next:function(e){for(;!i;){if(!o&&(o=r.next(e)).done)return i=!0,z;a||(a=ur(n.u,o.value,t));var s=a.value.next(e);if(!s.done)return s;o=a=null}}})},y(ni,sr),ni.prototype.h=function(e,t){var n=this,r=Ut(ur(this.B,e,t),t);return r.$({empty:function(){return n.u?ce.ca():ce.X()},o:function(){return r.map((function(e){return Kt(e,n.j).v?V:Q}))},multiple:function(){return ce.X()}})},y(ri,sr),ri.prototype.h=function(e,t){var n=this,r=Ut(ur(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 ce.empty()},o:function(){return r.map((function(e){return zt(e,n.j)}))},multiple:function(){throw Error("XPTY0004: Sequence to cast is not singleton or empty.")}})},y(ai,sr),ai.prototype.h=function(e,t){var n=this,r=ur(this.B,e,t);return r.$({empty:function(){return"?"===n.j||"*"===n.j?ce.ca():ce.X()},multiple:function(){return"+"===n.j||"*"===n.j?oi(r,(function(r){var o=ce.o(r);return r=Nt(e,0,r,o),ur(n.u,r,t)})):ce.X()},o:function(){return oi(r,(function(r){var o=ce.o(r);return r=Nt(e,0,r,o),ur(n.u,r,t)}))}})},y(ci,sr),ci.prototype.h=function(e,t){var n=this;if(this.j.every((function(e){return"sorted"===e.O}))){var r=0;return ui(t.h,{next:function(){return r>=n.j.length?z:W(ur(n.j[r++],e,t))}}).map((function(e){if(!ee(e.type,53))throw Error("XPTY0004: The sequences to union are not of type node()*");return e}))}return It(this.j.map((function(n){return ur(n,e,t)}))).L((function(e){if(e.some((function(e){return!ee(e.type,53)})))throw Error("XPTY0004: The sequences to union are not of type node()*");return e=sn(t.h,e),ce.create(e)}))},y(pi,Ca),pi.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 o,a,i=[],s=!1,u=null,l=this.B[0];return ce.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 Ut(e,n)}))).find((function(e){return!e.G()&&!e.ya()})))throw ao("Order by only accepts empty or singleton sequences");if(function(e){return(e=e.find((function(e){return!!e})))?Mt(e.type):null}(o=(o=p.map((function(e){return e.first()}))).map((function(e){return null===e?e:ee(19,e.type)?zt(e,1):e})))&&!(o=li(o)))throw ao("Could not cast values");p=o.length,a=o.map((function(e,t){return t}));for(var h=0;h<p;h++)if(h+1!==p)for(var f=h;0<=f;f--){var d=f,m=f+1;if(m!==p){var g=o[a[d]],y=o[a[m]];if(null!==y||null!==g){if(l.zc){if(null===g)continue;if(null===y&&null!==g){g=c([a[m],a[d]]),a[d]=g.next().value,a[m]=g.next().value;continue}if(isNaN(y.value)&&null!==g&&!isNaN(g.value)){g=c([a[m],a[d]]),a[d]=g.next().value,a[m]=g.next().value;continue}}else{if(null===y)continue;if(null===g&&null!==y){g=c([a[m],a[d]]),a[d]=g.next().value,a[m]=g.next().value;continue}if(isNaN(g.value)&&null!==y&&!isNaN(y.value)){g=c([a[m],a[d]]),a[d]=g.next().value,a[m]=g.next().value;continue}}qa("gtOp",g.type,y.type)(g,y,e)&&(g=c([a[m],a[d]]),a[d]=g.next().value,a[m]=g.next().value)}}}var v=l.Gb?0:o.length-1;u=r({next:function(){return l.Gb?v>=o.length?z:W(i[a[v++]]):0>v?z:W(i[a[v--]])}}).value,s=!0}return u.next(0)}})},y(hi,sr),hi.prototype.h=function(e,t){if(null===e.N)throw Error("XPDY0002: context is absent, it needs to be present to use paths.");for(var n=t.h,r=e.N.value;9!==r.node.nodeType;)if(null===(r=Fe(n,r)))throw Error("XPDY0050: the root node of the context node is not a document node.");return n=ce.o(Xe(r)),this.j?ur(this.j,Nt(e,0,n.first(),n),t):n},y(fi,sr),fi.prototype.h=function(e){if(null===e.N)throw Error('XPDY0002: context is absent, it needs to be present to use the "." operator');return ce.o(e.N)},y(di,sr),di.prototype.h=function(e,t){var n=this,r=!0;return this.j.reduce((function(o,a,i){var s=null===o?Wt(e):xt(e,o);if(o={next:function(e){if((e=s.next(e)).done)return z;if(null!==e.value.N&&!ee(e.value.N.type,53)&&0<i)throw Error("XPTY0019: The result of E1 in a path expression E1/E2 should not evaluate to a sequence of nodes.");return W(ur(a,e.value,t))}},n.u)switch(a.O){case"reverse-sorted":var u=o;o={next:function(e){return(e=u.next(e)).done?e:W(e.value.L((function(e){return ce.create(e.reverse())})))}};case"sorted":if(a.subtree&&r){var c=si(o);break}c=ui(t.h,o);break;case"unsorted":return si(o).L((function(e){return ce.create(function(e,t){var n=!1,r=!1;if(t.forEach((function(e){ee(e.type,53)?n=!0:r=!0})),r&&n)throw Error("XPTY0018: The path operator should either return nodes or non-nodes. Mixed sequences are not allowed.");return n?sn(e,t):t}(t.h,e))}))}else c=si(o);return r=r&&a.Y,c}),null)},di.prototype.A=function(){return this.j[0].A()},y(mi,sr),mi.prototype.h=function(e,t){var n=this,r=ur(this.u,e,t);if(this.j.C){var o=ur(this.j,e,t);if(o.G())return o;var a=o.first();if(ee(a.type,2)){var i=a.value;if(!Number.isInteger(i))return ce.empty();var s=r.value,u=!1;return ce.create({next:function(){if(!u){for(var e=s.next(0);!e.done;e=s.next(0))if(1==i--)return u=!0,e;u=!0}return z}})}return o.getEffectiveBooleanValue()?r:ce.empty()}var c=r.value,l=null,p=0,h=null;return ce.create({next:function(o){for(var a=!1;(!l||!l.done)&&(l||(l=c.next(a?0:o),a=!0),!l.done);){h||(h=ur(n.j,Nt(e,p,l.value,r),t));var i=h.first();i=null!==i&&(ee(i.type,2)?i.value===p+1:h.getEffectiveBooleanValue()),h=null;var s=l.value;if(l=null,p++,i)return W(s)}return l}})},mi.prototype.A=function(){return this.u.A()},y(vi,sr),vi.prototype.h=function(e,t){var n=this;return ur(this.j,e,t).L((function(r){return r.reduce((function(r,o){return yi(o,n.u,r,e,t)}),new ne)}))},vi.prototype.A=function(){return this.j.A()},y(wi,sr),wi.prototype.h=function(e,t){return yi(e.N,this.j,new ne,e,t)},y(Ai,sr),Ai.prototype.h=function(e,t){var n=this,r=e,o=this.j.map((function(o,a){var i=ur(n.J[a],r,t).M();return r=Bt(e,((a={})[o]=function(){return ce.create(i)},a)),i}));if(o.some((function(e){return 0===e.length})))return"every"===this.u?ce.ca():ce.X();var a=Array(o.length).fill(0);a[0]=-1;for(var i=!0;i;){i=!1;for(var s=0,u=a.length;s<u;++s){var c=o[s];if(!(++a[s]>c.length-1)){for(i=Object.create(null),s={},u=0;u<a.length;s={ub:s.ub},u++)s.ub=o[u][a[u]],i[this.j[u]]=function(e){return function(){return ce.o(e.ub)}}(s);if(i=Bt(e,i),(i=ur(this.T,i,t)).getEffectiveBooleanValue()&&"some"===this.u)return ce.ca();if(!i.getEffectiveBooleanValue()&&"every"===this.u)return ce.X();i=!0;break}a[s]=0}}return"every"===this.u?ce.ca():ce.X()},Ai.prototype.P=function(e){this.j=[];for(var t=0,n=this.B.length;t<n;++t){this.J[t].P(e),wo(e);var r=this.B[t],o=r.prefix?e.ba(r.prefix):null;r=bo(e,o,r.localName),this.j[t]=r}for(this.T.P(e),t=0,n=this.B.length;t<n;++t)No(e)},y(xi,sr),xi.prototype.h=function(e){return this.j(e.N)?ce.ca():ce.X()},y(bi,xi),bi.prototype.j=function(e){return!!ee(e.type,53)&&(e=e.value.node.nodeType,3===this.u&&4===e||this.u===e)},bi.prototype.A=function(){return"type-"+this.u},y(Ei,xi),Ei.prototype.j=function(e){var t=ee(e.type,54),n=ee(e.type,47);return!(!t&&!n)&&(e=e.value,!(null!==this.T&&(1===this.T&&!t||2===this.T&&!n))&&(null===this.B&&""!==this.J&&"*"===this.u||("*"===this.B?"*"===this.u||this.u===e.node.localName:("*"===this.u||this.u===e.node.localName)&&(e.node.namespaceURI||null)===((""===this.B?t?this.J:null:this.J)||null))))},Ei.prototype.A=function(){return"*"===this.u?null===this.T?"type-1-or-type-2":"type-"+this.T:"name-"+this.u},Ei.prototype.P=function(e){if(null===this.J&&"*"!==this.B&&(this.J=e.ba(this.B||"")||null,!this.J&&this.B))throw Error("XPST0081: The prefix "+this.B+" could not be resolved.")},y(Ni,xi),Ni.prototype.j=function(e){return ee(e.type,57)&&e.value.node.target===this.u},Ni.prototype.A=function(){return"type-7"},y(Bi,xi),Bi.prototype.j=function(e){return ee(e.type,ge(this.u.prefix?this.u.prefix+":"+this.u.localName:this.u.localName))},y(Ti,sr),Ti.prototype.h=function(e,t){if(!e.Ea[this.j]){if(this.T)return this.T(e,t);throw Error("XQDY0054: The variable "+this.B+" is declared but not in scope.")}return e.Ea[this.j]()},Ti.prototype.P=function(e){if(null===this.u&&this.J&&(this.u=e.ba(this.J)),this.j=e.qb(this.u||"",this.B),!this.j)throw Error("XPST0008, The variable "+this.B+" is not in scope.");(e=e.Da[this.j])&&(this.T=e)},y(Ii,Ca),Ii.prototype.J=function(e,t,n,r){var o=this,a=null,i=null;return r({next:function(){for(;;){if(!i){var e=t.next(0);if(e.done)return z;a=e.value,i=ur(o.B,a,n)}e=i.getEffectiveBooleanValue();var r=a;if(i=a=null,e)return W(r)}}})},y(Di,Ri),Di.prototype.h=function(e){var t={};return t.type=this.type,t.target=Oi(this.target,e,!1),t},y(Ui,Ri),Ui.prototype.h=function(e){var t={};return t.type=this.type,t.target=Oi(this.target,e,!1),t.content=this.content.map((function(t){return Oi(t,e,!0)})),t},y(Mi,Ui),y(ki,Ri),ki.prototype.h=function(e){var t={};return t.type=this.type,t.target=Oi(this.target,e,!1),t.content=this.content.map((function(t){return Oi(t,e,!0)})),t},y(Gi,Ui),y(Fi,Ui),y(Pi,Ui),y(Hi,Ui),y(_i,Ri),_i.prototype.h=function(e){var t={},n={};return n.type=this.type,n.target=Oi(this.target,e,!1),n.newName=(t.prefix=this.s.prefix,t.namespaceURI=this.s.namespaceURI,t.localName=this.s.localName,t),n},y(ji,Ri),ji.prototype.h=function(e){var t={};return t.type=this.type,t.target=Oi(this.target,e,!1),t.text=this.text?Oi(this.text,e,!0):null,t},y(Xi,Ri),Xi.prototype.h=function(e){var t={};return t.type=this.type,t.target=Oi(this.target,e,!1),t.replacement=this.s.map((function(t){return Oi(t,e,!0)})),t},y(Li,Ri),Li.prototype.h=function(e){var t={};return t.type=this.type,t.target=Oi(this.target,e,!1),t["string-value"]=this.s,t},y(qi,mr),qi.prototype.u=function(e,t){var n,r,o=gr(this.j)(e,t),a=t.h;return{next:function(){if(!n){var e=o.next(0);if(e.value.H.some((function(e){return!ee(e.type,53)})))throw Error("XUTY0007: The target of a delete expression must be a sequence of zero or more nodes.");n=e.value.H,r=e.value.fa}return n=n.filter((function(e){return Fe(a,e.value)})),W({fa:dr(n.map((function(e){return new Di(e.value)})),r),H:[]})}}},y(Ji,mr),Ji.prototype.u=function(e,t){var n,r,o,a,i,s,u=this,c=gr(this.J)(e,t),l=gr(this.B)(e,t),p=t.h;return{next:function(){if(!n){var e=c.next(0),h=Vi([e.value.H],t,zn);n=h.attributes.map((function(e){return{node:e,F:null}})),r=h.Ta.map((function(e){return{node:e,F:null}})),o=e.value.fa}if(!a){if(0===(e=l.next(0)).value.H.length)throw ir();if(3<=u.j){if(1!==e.value.H.length)throw Wn();if(!ee(e.value.H[0].type,54)&&!ee(e.value.H[0].type,55))throw Wn()}else{if(1!==e.value.H.length)throw Zn();if(!(ee(e.value.H[0].type,54)||ee(e.value.H[0].type,56)||ee(e.value.H[0].type,58)||ee(e.value.H[0].type,57)))throw Zn();if(null===(s=Fe(p,e.value.H[0].value,null)))throw Error("XUDY0029: The target "+e.value.H[0].value.outerHTML+" for inserting a node before or after must have a parent.")}a=e.value.H[0],i=e.value.fa}if(n.length){if(3<=u.j){if(!ee(a.type,54))throw Error("XUTY0022: An insert expression specifies the insertion of an attribute node into a document node.")}else if(1!==s.node.nodeType)throw Error("XUDY0030: An insert expression specifies the insertion of an attribute node before or after a child of a document node.");n.reduce((function(e,t){var n=t.node.prefix||"",r=t.node.prefix||"",o=t.node.namespaceURI,i=r?a.value.node.lookupNamespaceURI(r):null;if(i&&i!==o)throw or(o);if((r=e[r])&&o!==r)throw ar(o);return e[n]=t.node.namespaceURI,e}),{})}return W({H:[],fa:dr(Qi(u.j,a.value,s||null,n,r),o,i)})}}};var zi=/([A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])/,Wi=new RegExp(zi.source+new RegExp("("+zi.source+"|[-.0-9·̀-ͯ‿⁀])").source+"*","g");function Zi(e){return!!(e=e.match(Wi))&&1===e.length}function es(e,t){return Ut(t,e).$({o:function(e){if(ee((e=e.first()).type,1)||ee(e.type,19)){if(!Zi(e.value))throw Error('XQDY0041: The value "'+e.value+'" of a name expressions cannot be converted to a NCName.');return ce.o(e)}throw Ki()},default:function(){throw Ki()}}).value}function ts(e,t,n){return Ut(n,t).$({o:function(t){if(ee((t=t.first()).type,23))return ce.o(t);if(ee(t.type,1)||ee(t.type,19)){if(1===(t=t.value.split(":")).length)t=t[0];else{var n=t[0],r=e.ba(n);t=t[1]}if(!Zi(t)||n&&!Zi(n))throw ho(n?n+":"+t:t);if(n&&!r)throw ho(n+":"+t);return ce.o({type:23,value:new ve(n,r,t)})}throw Ki()},default:function(){throw Ki()}}).value}function ns(e,t){mr.call(this,new xr({}),[e,t],{C:!1,S:"unsorted"}),this.B=e,this.J=t,this.j=void 0}function rs(e,t,n){mr.call(this,new xr({}),[t,n],{C:!1,S:"unsorted"}),this.J=e,this.j=t,this.B=n}function os(e){switch(e.type){case"delete":return new Di({node:e.target,F:null});case"insertAfter":return new Mi({node:e.target,F:null},e.content.map((function(e){return{node:e,F:null}})));case"insertBefore":return new Gi({node:e.target,F:null},e.content.map((function(e){return{node:e,F:null}})));case"insertInto":return new Hi({node:e.target,F:null},e.content.map((function(e){return{node:e,F:null}})));case"insertIntoAsFirst":return new Fi({node:e.target,F:null},e.content.map((function(e){return{node:e,F:null}})));case"insertIntoAsLast":return new Pi({node:e.target,F:null},e.content.map((function(e){return{node:e,F:null}})));case"insertAttributes":return new ki({node:e.target,F:null},e.content.map((function(e){return{node:e,F:null}})));case"rename":return new _i({node:e.target,F:null},e.newName);case"replaceNode":return new Xi({node:e.target,F:null},e.replacement.map((function(e){return{node:e,F:null}})));case"replaceValue":return new Li({node:e.target,F:null},e["string-value"]);case"replaceElementContent":return new ji({node:e.target,F:null},e.text?{node:e.text,F:null}:null);default:throw Error('Unexpected type "'+e.type+'" when parsing a transferable pending update.')}}function as(e,t,n){if(t.find((function(t){return en(t,e)})))return!0;var r=Fe(n,e);return!!r&&as(r,t,n)}function is(e,t,n){mr.call(this,new xr({}),e.reduce((function(e,t){return e.push(t.eb),e}),[t,n]),{C:!1,S:"unsorted"}),this.j=e,this.J=t,this.B=n,this.I=null}function ss(e,t){return{node:{nodeType:2,Qa:!0,nodeName:e.va(),namespaceURI:e.namespaceURI,prefix:e.prefix,localName:e.localName,name:e.va(),value:t},F:null}}function us(e,t){var n=t.tb||[];n=n.concat(e.Ka||[]),sr.call(this,new xr({}),n,{C:!1,S:"unsorted"}),e.Ka?this.u=e.Ka:this.name=new ve(e.prefix,e.namespaceURI,e.localName),this.j=t,this.B=void 0}function cs(e){sr.call(this,e?e.s:new xr({}),e?[e]:[],{C:!1,S:"unsorted"}),this.j=e}function ls(e,t,n,r){sr.call(this,new xr({}),r.concat(t).concat(e.Ka||[]),{C:!1,S:"unsorted"}),e.Ka?this.u=e.Ka:this.j=new ve(e.prefix,e.namespaceURI,e.localName),this.T=n.reduce((function(e,t){if(t.prefix in e)throw Error("XQST0071: The namespace declaration with the prefix "+t.prefix+" has already been declared on the constructed element.");return e[t.prefix||""]=t.uri,e}),{}),this.J=t,this.ka=r,this.B=void 0}function ps(e){if(/^xml$/i.test(e))throw Error('XQDY0064: The target of a created PI may not be "'+e+'"')}function hs(e,t){return{node:{data:t,Qa:!0,nodeName:e,nodeType:7,target:e},F:null}}function fs(e,t){var n=e.Cb?[e.Cb].concat(t):[t];sr.call(this,n.reduce((function(e,t){return e.add(t.s)}),new xr({})),n,{C:!1,S:"unsorted"}),this.j=e,this.u=t}function ds(e){sr.call(this,e?e.s:new xr({}),e?[e]:[],{C:!1,S:"unsorted"}),this.j=e}function ms(e,t,n,r){var o,a=new xr({});vr.call(this,a,(o=[e].concat(p(t.map((function(e){return e.xc}))),[n])).concat.apply(o,p(t.map((function(e){return e.Lb.map((function(e){return e.Kb}))})))),{C:!1,Y:!1,S:"unsorted",subtree:!1},r),this.J=e,this.j=t.length,this.T=t.map((function(e){return e.Lb}))}y(ns,mr),ns.prototype.u=function(e,t){var n=this,r=gr(this.B)(e,t),o=gr(this.J)(e,t);return{next:function(){var e=r.next(0),a=e.value.H;if(0===a.length)throw ir();if(1!==a.length)throw tr();if(!ee(a[0].type,54)&&!ee(a[0].type,47)&&!ee(a[0].type,57))throw tr();a=a[0];var i=o.next(0);e:{var s=n.j,u=ce.create(i.value.H);switch(a.type){case 54:if(s=ts(s,t,u).next(0).value.value,(u=a.value.node.lookupNamespaceURI(s.prefix))&&u!==s.namespaceURI)throw or(s.namespaceURI);break e;case 47:if((s=ts(s,t,u).next(0).value.value).namespaceURI&&(u=a.value.node.lookupNamespaceURI(s.prefix))&&u!==s.namespaceURI)throw or(s.namespaceURI);break e;case 57:s=new ve("",null,s=es(t,u).next(0).value.value);break e}s=void 0}return W({H:[],fa:dr([new _i(a.value,s)],e.value.fa,i.value.fa)})}}},ns.prototype.P=function(e){this.j=vo(e),mr.prototype.P.call(this,e)},y(rs,mr),rs.prototype.u=function(e,t){var n=gr(this.j)(e,t);return e=gr(this.B)(e,t),this.J?function(e,t,n){var r,o,a,i,s=!1;return{next:function(){if(s)return z;if(!a){var u=n.next(0),c=Ut(ce.create(u.value.H),e).map((function(e){return zt(e,1)})).M().map((function(e){return e.value})).join(" ");a=0===c.length?null:{node:e.s.createTextNode(c),F:null},i=u.value.fa}if(!r){if(0===(u=t.next(0)).value.H.length)throw ir();if(1!==u.value.H.length)throw er();if(!(ee(u.value.H[0].type,54)||ee(u.value.H[0].type,47)||ee(u.value.H[0].type,56)||ee(u.value.H[0].type,58)||ee(u.value.H[0].type,57)))throw er();r=u.value.H[0],o=u.value.fa}if(ee(r.type,54))return s=!0,W({H:[],fa:dr([new ji(r.value,a)],i,o)});if(ee(r.type,47)||ee(r.type,56)||ee(r.type,58)||ee(r.type,57)){if(u=a?Ue(e.h,a):"",ee(r.type,58)&&(u.includes("--")||u.endsWith("-")))throw Error('XQDY0072: The content "'+u+'" for a comment node contains two adjacent hyphens or ends with a hyphen.');if(ee(r.type,57)&&u.includes("?>"))throw Error('XQDY0026: The content "'+u+'" for a processing instruction node contains "?>".');return s=!0,W({H:[],fa:dr([new Li(r.value,u)],i,o)})}}}}(t,n,e):function(e,t,n){var r,o,a;return{next:function(){if(!r){var i=n.next(0),s=Vi([i.value.H],e,ar);r={attributes:s.attributes.map((function(e){return{node:e,F:null}})),Ta:s.Ta.map((function(e){return{node:e,F:null}}))},o=i.value.fa}if(0===(s=t.next(0)).value.H.length)throw ir();if(1!==s.value.H.length)throw er();if(!(ee(s.value.H[0].type,54)||ee(s.value.H[0].type,47)||ee(s.value.H[0].type,56)||ee(s.value.H[0].type,58)||ee(s.value.H[0].type,57)))throw er();if(null===(a=Fe(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,ee(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=a.node.lookupNamespaceURI(n);if(r&&r!==t)throw or(t);if((r=e[n])&&t!==r)throw ar(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 W({H:[],fa:dr([$i(i.value,[].concat(r.attributes,r.Ta))],o,s)})}}}(t,n,e)},y(is,mr),is.prototype.h=function(e,t){return yr(e=this.u(e,t),(function(){}))},is.prototype.u=function(e,t){var n,r,o,a=this,i=t.h,s=t.s,u=t.A,c=[],l=[],h=[];return{next:function(){if(l.length!==a.j.length)for(var f={},d=l.length;d<a.j.length;f={gb:f.gb},d++){var m=a.j[d],g=c[d];if(g||(c[d]=g=gr(m.eb)(e,t)),1!==(g=g.next(0)).value.H.length||!ee(g.value.H[0].type,53))throw Error("XUTY0013: The source expression of a copy modify expression must return a single node.");f.gb=Xe(Ci(g.value.H[0].value,t)),l.push(f.gb.value),h.push(g.value.fa),e=Bt(e,((g={})[m.Ec]=function(e){return function(){return ce.o(e.gb)}}(f),g))}return o||(n||(n=gr(a.J)(e,t)),o=n.next(0).value.fa),o.forEach((function(e){if(e.target&&!as(e.target,l,i))throw Error("XUDY0014: The target "+e.target.node.outerHTML+" must be a node created by the copy clause.");if("put"===e.type)throw Error("XUDY0037: The modify expression of a copy modify expression can not contain a fn:put.")})),f=o.map((function(e){return os(e=e.h(t))})),fr(f,i,s,u),r||(r=gr(a.B)(e,t)),W({H:(f=r.next(0)).value.H,fa:dr.apply(null,[f.value.fa].concat(p(h)))})}}},is.prototype.P=function(e){wo(e),this.j.forEach((function(t){return t.Ec=bo(e,t.Nb.namespaceURI,t.Nb.localName)})),mr.prototype.P.call(this,e),No(e),this.I=this.j.some((function(e){return e.eb.I}))||this.B.I},y(us,sr),us.prototype.h=function(e,t){var n,r,o,a=this,i=!1;return ce.create({next:function(){if(i)return z;if(!r){if(a.u){if(!n){var s=a.u.h(e,t);n=ts(a.B,t,s)}r=n.next(0).value.value}else r=a.name;if(r){if("xmlns"===r.prefix)throw so(r);if(""===r.prefix&&"xmlns"===r.localName)throw so(r);if("http://www.w3.org/2000/xmlns/"===r.namespaceURI)throw so(r);if("xml"===r.prefix&&"http://www.w3.org/XML/1998/namespace"!==r.namespaceURI)throw so(r);if(""!==r.prefix&&"xml"!==r.prefix&&"http://www.w3.org/XML/1998/namespace"===r.namespaceURI)throw so(r)}}return a.j.tb?(s=a.j.tb,o||(o=It(s.map((function(n){return Ut(n.h(e,t),t).L((function(e){return ce.o(Y(e.map((function(e){return e.value})).join(" "),1))}))}))).L((function(e){return ce.o(Xe(ss(r,e.map((function(e){return e.value})).join(""))))})).value),o.next(0)):(i=!0,W(Xe(ss(r,a.j.value))))}})},us.prototype.P=function(e){if(this.B=vo(e),this.name&&this.name.prefix&&!this.name.namespaceURI){var t=e.ba(this.name.prefix);if(void 0===t&&this.name.prefix)throw Rt(this.name.prefix);this.name.namespaceURI=t||null}sr.prototype.P.call(this,e)},y(cs,sr),cs.prototype.h=function(e,t){var n={data:"",Qa:!0,nodeType:8},r={node:n,F:null};return this.j?Ut(e=ur(this.j,e,t),t).L((function(e){if(e=e.map((function(e){return zt(e,1).value})).join(" "),-1!==e.indexOf("--\x3e"))throw Error('XQDY0072: The contents of the data of a comment may not include "--\x3e"');return n.data=e,ce.o(Xe(r))})):ce.o(Xe(r))},y(ls,sr),ls.prototype.h=function(e,t){var n,r,o,a,i,s=this,u=!1,c=!1,l=!1;return ce.create({next:function(){if(l)return z;if(u||(n||(n=It(s.J.map((function(n){return ur(n,e,t)})))),r=n.M(),u=!0),!c){o||(o=s.ka.map((function(n){return ur(n,e,t)})));for(var p=[],h=0;h<o.length;h++){var f=o[h].M();p.push(f)}a=p,c=!0}if(s.u&&(i||(p=s.u.h(e,t),i=ts(s.B,t,p)),p=i.next(0),s.j=p.value.value),"xmlns"===s.j.prefix||"http://www.w3.org/2000/xmlns/"===s.j.namespaceURI||"xml"===s.j.prefix&&"http://www.w3.org/XML/1998/namespace"!==s.j.namespaceURI||s.j.prefix&&"xml"!==s.j.prefix&&"http://www.w3.org/XML/1998/namespace"===s.j.namespaceURI)throw Error('XQDY0096: The node name "'+s.j.va()+'" is invalid for a computed element constructor.');var d={nodeType:1,Qa:!0,attributes:[],childNodes:[],nodeName:s.j.va(),namespaceURI:s.j.namespaceURI,prefix:s.j.prefix,localName:s.j.localName};for(p={node:d,F:null},r.forEach((function(e){d.attributes.push(e.value.node)})),(h=Vi(a,t,io)).attributes.forEach((function(e){if(d.attributes.find((function(t){return t.namespaceURI===e.namespaceURI&&t.localName===e.localName})))throw Error("XQDY0025: The attribute "+e.name+" does not have an unique name in the constructed element.");d.attributes.push(e)})),h.Ta.forEach((function(e){d.childNodes.push(e)})),h=0;h<d.childNodes.length;h++)if(Ie(f=d.childNodes[h])&&3===f.nodeType){var m=d.childNodes[h-1];m&&Ie(m)&&3===m.nodeType&&(m.data+=f.data,d.childNodes.splice(h,1),h--)}return l=!0,W(Xe(p))}})},ls.prototype.P=function(e){var t=this;if(wo(e),Object.keys(this.T).forEach((function(n){return xo(e,n,t.T[n])})),this.ha.forEach((function(t){return t.P(e)})),this.J.reduce((function(t,n){if(n.name){if(n="Q{"+(null===n.name.namespaceURI?e.ba(n.name.prefix):n.name.namespaceURI)+"}"+n.name.localName,t.includes(n))throw Error("XQST0040: The attribute "+n+" does not have an unique name in the constructed element.");t.push(n)}return t}),[]),this.j&&null===this.j.namespaceURI){var n=e.ba(this.j.prefix);if(void 0===n&&this.j.prefix)throw Rt(this.j.prefix);this.j.namespaceURI=n}this.B=vo(e),No(e)},y(fs,sr),fs.prototype.h=function(e,t){var n=this;return Ut(ur(this.u,e,t),t).L((function(r){var o=r.map((function(e){return zt(e,1).value})).join(" ");if(-1!==o.indexOf("?>"))throw Error('XQDY0026: The contents of the data of a processing instruction may not include "?>"');if(null!==n.j.Jb)return ps(r=n.j.Jb),ce.o(Xe(hs(r,o)));r=ur(n.j.Cb,e,t);var a=es(t,r);return ce.create({next:function(){var e=a.next(0);return e.done?e:(ps(e=e.value.value),W(Xe(hs(e,o))))}})}))},y(ds,sr),ds.prototype.h=function(e,t){return this.j?Ut(e=ur(this.j,e,t),t).L((function(e){return 0===e.length?ce.empty():(e={node:{data:e.map((function(e){return zt(e,1).value})).join(" "),Qa:!0,nodeType:3},F:null},ce.o(Xe(e)))})):ce.empty()},y(ms,vr),ms.prototype.B=function(e,t,n){var r=this;return n[0](e).L((function(o){for(var a=0;a<r.j;a++)if(r.T[a].some((function(n){switch(n.Cc){case"?":if(1<o.length)return!1;break;case"*":break;case"+":if(1>o.length)return!1;break;default:if(1!==o.length)return!1}var r=ce.create(o);return o.every((function(o,a){return o=Nt(e,a,o,r),ur(n.Kb,o,t).getEffectiveBooleanValue()}))})))return n[a+1](e);return n[r.j+1](e)}))},ms.prototype.P=function(e){if(vr.prototype.P.call(this,e),this.J.I)throw Kn()};var gs={aa:!1,qa:!1},ys={aa:!0,qa:!1},vs={aa:!0,qa:!0};function ws(e){return e.aa?e.qa?vs:ys:gs}function As(e,t){switch(e[0]){case"andOp":var n=Io(e,"type");return new _a(bs("andOp",e,ws(t)),n);case"orOp":return n=Io(e,"type"),new ja(bs("orOp",e,ws(t)),n);case"unaryPlusOp":return n=Bo(Bo(e,"operand"),"*"),e=Io(e,"type"),new Ha("+",As(n,t),e);case"unaryMinusOp":return n=Bo(Bo(e,"operand"),"*"),e=Io(e,"type"),new Ha("-",As(n,t),e);case"addOp":case"subtractOp":case"multiplyOp":case"divOp":case"idivOp":case"modOp":var r=e[0],o=As(Co(e,["firstOperand","*"]),ws(t));t=As(Co(e,["secondOperand","*"]),ws(t));var a=Io(e,"type"),i=Io(Co(e,["firstOperand","*"]),"type"),s=Io(Co(e,["secondOperand","*"]),"type");return i&&s&&Io(e,"type")&&(n=_o(r,i.type,s.type)),new Lo(r,o,t,a,n);case"sequenceExpr":return function(e,t){var n=So(e,"*").map((function(e){return As(e,t)}));return 1===n.length?n[0]:(n=Io(e,"type"),new ei(So(e,"*").map((function(e){return As(e,t)})),n))}(e,t);case"unionOp":return n=Io(e,"type"),new ci([As(Co(e,["firstOperand","*"]),ws(t)),As(Co(e,["secondOperand","*"]),ws(t))],n);case"exceptOp":case"intersectOp":return n=Io(e,"type"),new Za(e[0],As(Co(e,["firstOperand","*"]),ws(t)),As(Co(e,["secondOperand","*"]),ws(t)),n);case"stringConcatenateOp":return function(e,t){var n=Io(e,"type");return new Ir(new Ga({localName:"concat",namespaceURI:"http://www.w3.org/2005/xpath-functions",prefix:""},(e=[Co(e,["firstOperand","*"]),Co(e,["secondOperand","*"])]).length,n),e.map((function(e){return As(e,ws(t))})),n)}(e,t);case"rangeSequenceExpr":return function(e,t){var n=Io(e,"type");return new Ir(new Ga({localName:"to",namespaceURI:"http://fontoxpath/operators",prefix:""},(e=[Bo(Bo(e,"startExpr"),"*"),Bo(Bo(e,"endExpr"),"*")]).length,n),e.map((function(e){return As(e,ws(t))})),n)}(e,t);case"equalOp":case"notEqualOp":case"lessThanOrEqualOp":case"lessThanOp":case"greaterThanOrEqualOp":case"greaterThanOp":return Ns("generalCompare",e,t);case"eqOp":case"neOp":case"ltOp":case"leOp":case"gtOp":case"geOp":return Ns("valueCompare",e,t);case"isOp":case"nodeBeforeOp":case"nodeAfterOp":return Ns("nodeCompare",e,t);case"pathExpr":return function(e,t){var n=Io(e,"type"),r=So(e,"stepExpr"),o=!1,a=r.map((function(e){for(var r=Bo(e,"xpathAxis"),a=So(e,"*"),i=[],s=null,u=(a=c(a)).next();!u.done;u=a.next())switch(u=u.value,u[0]){case"lookup":i.push(["lookup",Es(u,t)]);break;case"predicate":case"predicates":for(var l=(u=c(So(u,"*"))).next();!l.done;l=u.next())s=la(s,(l=As(l.value,ws(t))).A()),i.push(["predicate",l])}if(r)switch(o=!0,e=Bo(e,"attributeTest anyElementTest piTest documentTest elementTest commentTest namespaceTest anyKindTest textTest anyFunctionTest typedFunctionTest schemaAttributeTest atomicType anyItemType parenthesizedItemType typedMapTest typedArrayTest nameTest Wildcard".split(" ")),e=xs(e),To(r)){case"ancestor":var p=new ua(e,{Oa:!1});break;case"ancestor-or-self":p=new ua(e,{Oa:!0});break;case"attribute":p=new pa(e,s);break;case"child":p=new ha(e,s);break;case"descendant":p=new da(e,{Oa:!1});break;case"descendant-or-self":p=new da(e,{Oa:!0});break;case"parent":p=new wa(e,s);break;case"following-sibling":p=new va(e,s);break;case"preceding-sibling":p=new xa(e,s);break;case"following":p=new ya(e);break;case"preceding":p=new Aa(e);break;case"self":p=new ba(e,s)}else p=As(p=Co(e,["filterExpr","*"]),ws(t));for(r=(i=c(i)).next();!r.done;r=i.next())switch(r=r.value,r[0]){case"lookup":p=new vi(p,r[1]);break;case"predicate":p=new mi(p,r[1])}return p.type=n,p}));return e=Bo(e,"rootExpr"),!(r=o||null!==e||1<r.length)&&1===a.length||!e&&1===a.length&&"sorted"===a[0].O?a[0]:e&&0===a.length?new hi(null):(a=new di(a,r),e?new hi(a):a)}(e,t);case"contextItemExpr":return new fi(Io(e,"type"));case"functionCallExpr":return function(e,t){var n=Bo(e,"functionName"),r=So(Bo(e,"arguments"),"*");return e=Io(e,"type"),new Ir(new Ga(Oo(n),r.length,e),r.map((function(e){return"argumentPlaceholder"===e[0]?null:As(e,t)})),e)}(e,t);case"inlineFunctionExpr":return function(e,t){var n=So(Bo(e,"paramList"),"*"),r=Co(e,["functionBody","*"]),o=Io(e,"type");return new Da(n.map((function(e){return{name:Oo(Bo(e,"varName")),type:Ro(e)}})),Ro(e),r?As(r,t):new ei([],o))}(e,t);case"arrowExpr":return function(e,t){var n=Io(e,"type"),r=Co(e,["argExpr","*"]);e=So(e,"*").slice(1),r=[As(r,t)];for(var o=0;o<e.length;o++)if("arguments"!==e[o][0]){if("arguments"===e[o+1][0]){var a=So(e[o+1],"*");r=r.concat(a.map((function(e){return"argumentPlaceholder"===e[0]?null:As(e,t)})))}r=[new Ir(a="EQName"===e[o][0]?new Ga(Oo(e[o]),r.length,n):As(e[o],ws(t)),r,n)]}return r[0]}(e,t);case"dynamicFunctionInvocationExpr":return function(e,t){var n=Co(e,["functionItem","*"]),r=Io(e,"type");e=Bo(e,"arguments");var o=[];return e&&(o=So(e,"*").map((function(e){return"argumentPlaceholder"===e[0]?null:As(e,t)}))),new Ir(As(n,t),o,r)}(e,t);case"namedFunctionRef":return t=Bo(e,"functionName"),n=Io(e,"type"),e=To(Co(e,["integerConstantExpr","value"])),new Ga(Oo(t),parseInt(e,10),n);case"integerConstantExpr":return new Ma(To(Bo(e,"value")),{type:5,g:3});case"stringConstantExpr":return new Ma(To(Bo(e,"value")),{type:1,g:3});case"decimalConstantExpr":return new Ma(To(Bo(e,"value")),{type:4,g:3});case"doubleConstantExpr":return new Ma(To(Bo(e,"value")),{type:3,g:3});case"varRef":return new Ti((e=Oo(Bo(e,"name"))).prefix,e.namespaceURI,e.localName);case"flworExpr":return function(e,t){var n=So(e,"*");if(e=Bo(n[n.length-1],"*"),1<(n=n.slice(0,-1)).length&&!t.aa)throw Error("XPST0003: Use of XQuery FLWOR expressions in XPath is no allowed");return n.reduceRight((function(e,n){switch(n[0]){case"forClause":for(var r=(n=So(n,"*")).length-1;0<=r;--r){var o=n[r],a=Co(o,["forExpr","*"]),i=Bo(o,"positionalVariableBinding");e=new Ra(Oo(Co(o,["typedVariableBinding","varName"])),As(a,ws(t)),i?Oo(i):null,e)}return e;case"letClause":for(r=(n=So(n,"*")).length-1;0<=r;--r)a=Co(o=n[r],["letExpr","*"]),e=new Ua(Oo(Co(o,["typedVariableBinding","varName"])),As(a,ws(t)),e);return e;case"whereClause":for(r=(n=So(n,"*")).length-1;0<=r;--r)e=new Ii(As(n[r],t),e);return e;case"windowClause":case"groupByClause":case"countClause":throw Error("Not implemented: "+n[0]+" is not implemented yet.");case"orderByClause":return function(e,t,n){return new pi((e=So(e,"*")).filter((function(e){return"stable"!==e[0]})).map((function(e){var n=Bo(e,"orderModifier"),r=n?Bo(n,"orderingKind"):null;return n=n?Bo(n,"emptyOrderingMode"):null,r=!r||"ascending"===To(r),n=!n||"empty least"===To(n),{da:As(Co(e,["orderByExpr","*"]),t),Gb:r,zc:n}})),n)}(n,t,e);default:throw Error("Not implemented: "+n[0]+" is not supported in a flwor expression")}}),As(e,t))}(e,t);case"quantifiedExpr":return function(e,t){var n=Io(e,"type"),r=To(Bo(e,"quantifier")),o=Co(e,["predicateExpr","*"]);return e=So(e,"quantifiedExprInClause").map((function(e){return{name:Oo(Co(e,["typedVariableBinding","varName"])),eb:As(e=Co(e,["sourceExpr","*"]),ws(t))}})),new Ai(r,e,As(o,ws(t)),n)}(e,t);case"ifThenElseExpr":return n=Io(e,"type"),new Ea(As(Bo(Bo(e,"ifClause"),"*"),ws(t)),As(Bo(Bo(e,"thenClause"),"*"),t),As(Bo(Bo(e,"elseClause"),"*"),t),n);case"instanceOfExpr":return n=As(Co(e,["argExpr","*"]),t),r=Co(e,["sequenceType","*"]),o=Co(e,["sequenceType","occurrenceIndicator"]),e=Io(e,"type"),new ai(n,As(r,ws(t)),o?To(o):"",e);case"castExpr":return t=As(Bo(Bo(e,"argExpr"),"*"),ws(t)),n=Bo(e,"singleType"),new ri(t,e=Oo(Bo(n,"atomicType")),n=null!==Bo(n,"optional"));case"castableExpr":return t=As(Bo(Bo(e,"argExpr"),"*"),ws(t)),n=Bo(e,"singleType"),new ni(t,e=Oo(Bo(n,"atomicType")),n=null!==Bo(n,"optional"));case"simpleMapExpr":return function(e,t){var n=Io(e,"type");return So(e,"*").reduce((function(e,r){return null===e?As(r,ws(t)):new ti(e,As(r,ws(t)),n)}),null)}(e,t);case"mapConstructor":return function(e,t){var n=Io(e,"type");return new ka(So(e,"mapConstructorEntry").map((function(e){return{key:As(Co(e,["mapKeyExpr","*"]),ws(t)),value:As(Co(e,["mapValueExpr","*"]),ws(t))}})),n)}(e,t);case"arrayConstructor":return function(e,t){var n=Io(e,"type"),r=So(e=Bo(e,"*"),"arrayElem").map((function(e){return As(Bo(e,"*"),ws(t))}));switch(e[0]){case"curlyArray":return new aa(r,n);case"squareArray":return new ia(r,n);default:throw Error("Unrecognized arrayType: "+e[0])}}(e,t);case"unaryLookup":return n=Io(e,"type"),new wi(Es(e,t),n);case"typeswitchExpr":return function(e,t){if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");var n=Io(e,"type"),r=As(Bo(Bo(e,"argExpr"),"*"),t),o=So(e,"typeswitchExprCaseClause").map((function(e){var n=0===So(e,"sequenceTypeUnion").length?[Bo(e,"sequenceType")]:So(Bo(e,"sequenceTypeUnion"),"sequenceType");return{xc:As(Co(e,["resultExpr","*"]),t),Lb:n.map((function(e){var n=Bo(e,"occurrenceIndicator");return{Cc:n?To(n):"",Kb:As(Bo(e,"*"),t)}}))}}));return e=As(Co(e,["typeswitchExprDefaultClause","resultExpr","*"]),t),new ms(r,o,e,n)}(e,t);case"elementConstructor":return function(e,t){if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");var n=Oo(Bo(e,"tagName")),r=Bo(e,"attributeList"),o=r?So(r,"attributeConstructor").map((function(e){return As(e,ws(t))})):[];return r=r?So(r,"namespaceDeclaration").map((function(e){var t=Bo(e,"prefix");return{prefix:t?To(t):"",uri:To(Bo(e,"uri"))}})):[],e=(e=Bo(e,"elementContent"))?So(e,"*").map((function(e){return As(e,ws(t))})):[],new ls(n,o,r,e)}(e,t);case"attributeConstructor":return function(e,t){if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");var n=Oo(Bo(e,"attributeName")),r=Bo(e,"attributeValue");return r=r?To(r):null,e=(e=Bo(e,"attributeValueExpr"))?So(e,"*").map((function(e){return As(e,ws(t))})):null,new us(n,{value:r,tb:e})}(e,t);case"computedAttributeConstructor":return(n=Bo(e,"tagName"))?n=Oo(n):(n=Bo(e,"tagNameExpr"),n={Ka:As(Bo(n,"*"),ws(t))}),new us(n,{tb:[e=As(Bo(Bo(e,"valueExpr"),"*"),ws(t))]});case"computedCommentConstructor":if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");return new cs(e=(e=Bo(e,"argExpr"))?As(Bo(e,"*"),ws(t)):null);case"computedTextConstructor":if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");return new ds(e=(e=Bo(e,"argExpr"))?As(Bo(e,"*"),ws(t)):null);case"computedElementConstructor":return function(e,t){var n=Bo(e,"tagName");return n?n=Oo(n):(n=Bo(e,"tagNameExpr"),n={Ka:As(Bo(n,"*"),ws(t))}),e=(e=Bo(e,"contentExpr"))?So(e,"*").map((function(e){return As(e,ws(t))})):[],new ls(n,[],[],e)}(e,t);case"computedPIConstructor":if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");return n=Bo(e,"piTargetExpr"),r=Bo(e,"piTarget"),o=Bo(e,"piValueExpr"),e=Io(e,"type"),new fs({Cb:n?As(Bo(n,"*"),ws(t)):null,Jb:r?To(r):null},o?As(Bo(o,"*"),ws(t)):new ei([],e));case"CDataSection":return new Ma(To(e),{type:1,g:3});case"deleteExpr":return new qi(e=As(Co(e,["targetExpr","*"]),t));case"insertExpr":switch(n=As(Co(e,["sourceExpr","*"]),t),(o=So(e,"*")[1])[0]){case"insertAfter":r=1;break;case"insertBefore":r=2;break;case"insertInto":r=(r=Bo(o,"*"))?"insertAsFirst"===r[0]?4:5:3}return new Ji(n,r,e=As(Co(e,["targetExpr","*"]),t));case"renameExpr":return new ns(n=As(Co(e,["targetExpr","*"]),t),e=As(Co(e,["newNameExpr","*"]),t));case"replaceExpr":return new rs(n=!!Bo(e,"replaceValue"),r=As(Co(e,["targetExpr","*"]),t),e=As(Co(e,["replacementExpr","*"]),t));case"transformExpr":return function(e,t){var n=So(Bo(e,"transformCopies"),"transformCopy").map((function(e){var n=Oo(Bo(Bo(e,"varRef"),"name"));return{eb:As(Bo(Bo(e,"copySource"),"*"),t),Nb:new ve(n.prefix,n.namespaceURI,n.localName)}})),r=As(Bo(Bo(e,"modifyExpr"),"*"),t);return e=As(Bo(Bo(e,"returnExpr"),"*"),t),new is(n,r,e)}(e,t);case"x:stackTrace":for(n=e[1],e=e[2];"x:stackTrace"===e[0];)e=e[2];return new Ia(n,e[0],As(e,t));default:return xs(e)}}function xs(e){switch(e[0]){case"nameTest":return new Ei(Oo(e));case"piTest":return(e=Bo(e,"piTarget"))?new Ni(To(e)):new bi(7);case"commentTest":return new bi(8);case"textTest":return new bi(3);case"documentTest":return new bi(9);case"attributeTest":var t=(e=Bo(e,"attributeName"))&&Bo(e,"star");return!e||t?new bi(2):new Ei(Oo(Bo(e,"QName")),{kind:2});case"elementTest":return t=(e=Bo(e,"elementName"))&&Bo(e,"star"),!e||t?new bi(1):new Ei(Oo(Bo(e,"QName")),{kind:1});case"anyKindTest":return new Bi({prefix:"",namespaceURI:null,localName:"node()"});case"anyMapTest":return new Bi({prefix:"",namespaceURI:null,localName:"map(*)"});case"anyArrayTest":return new Bi({prefix:"",namespaceURI:null,localName:"array(*)"});case"Wildcard":return Bo(e,"star")?(t=Bo(e,"uri"))?e=new Ei({localName:"*",namespaceURI:To(t),prefix:""}):(t=Bo(e,"NCName"),e="star"===Bo(e,"*")[0]?new Ei({localName:To(t),namespaceURI:null,prefix:"*"}):new Ei({localName:"*",namespaceURI:null,prefix:To(t)})):e=new Ei({localName:"*",namespaceURI:null,prefix:"*"}),e;case"atomicType":return new Bi(Oo(e));case"anyItemType":return new Bi({prefix:"",namespaceURI:null,localName:"item()"});default:throw Error("No selector counterpart for: "+e[0]+".")}}function bs(e,t,n){var r=[];return function t(o){var a=Bo(Bo(o,"firstOperand"),"*");o=Bo(Bo(o,"secondOperand"),"*"),a[0]===e?t(a):r.push(As(a,n)),o[0]===e?t(o):r.push(As(o,n))}(t),r}function Es(e,t){switch((e=Bo(e,"*"))[0]){case"NCName":return new Ma(To(e),{type:1,g:3});case"star":return"*";default:return As(e,ws(t))}}function Ns(e,t,n){var r=Co(t,["firstOperand","*"]),o=Co(t,["secondOperand","*"]);switch(r=As(r,ws(n)),n=As(o,ws(n)),e){case"valueCompare":return new Ya(t[0],r,n);case"nodeCompare":return new za(t[0],r,n);case"generalCompare":return new Ja(t[0],r,n)}}function Bs(e,t){return As(e,t)}var Ts=new Map;function Is(e,t,n,r,o,a){this.j=e,this.u=t,this.h=n,this.A=r,this.s=o,this.O=a}function Cs(e,t,n,r,o,a,i){var s=Ts.get(e);s||(s=Object.create(null),Ts.set(e,s)),(t=s[e=t+(a?"_DEBUG":"")])||(t=s[e]=[]),t.push(new Is(Object.values(n.h),Object.values(n.s),o,Object.keys(r).map((function(e){return{namespaceURI:r[e],prefix:e}})),i,n.j))}function Ss(e){var t=new Ee;if("http://www.w3.org/2005/XQueryX"!==e.namespaceURI&&"http://www.w3.org/2005/XQueryX"!==e.namespaceURI&&"http://fontoxml.com/fontoxpath"!==e.namespaceURI&&"http://www.w3.org/2007/xquery-update-10"!==e.namespaceURI)throw St("The XML structure passed as an XQueryX program was not valid XQueryX");var n=["stackTrace"===e.localName?"x:stackTrace":e.localName],r=t.getAllAttributes(e);for(r&&0<r.length&&n.push(Array.from(r).reduce((function(e,t){return e[t.localName]="type"===t.localName?ye(t.value):t.value,e}),{})),e=t.getChildNodes(e),t=(e=c(e)).next();!t.done;t=e.next())switch(t=t.value,t.nodeType){case 1:n.push(Ss(t));break;case 3:n.push(t.data)}return n}var Os=Object.create(null);function Rs(e,t){var n=Os[e];n||(n=Os[e]={Ma:[],Ua:[]}),n.Ma=n.Ma.concat(t.Ma),n.Ua=n.Ua.concat(t.Ua)}function Ds(e,t){var n=Os[t];if(!n)throw Error("XQST0051: No modules found with the namespace uri "+t);n.Ma.forEach((function(n){return Ao(e,t,n.localName,n.arity,n.Eb)})),n.Ua.forEach((function(n){bo(e,t,n.localName),Eo(e,t,n.localName,(function(e,t){return ur(n.da,e,t)}))}))}function Us(e){return e.replace(/(\x0D\x0A)|(\x0D(?!\x0A))/g,String.fromCharCode(10))}var Ms=t;function ks(e,t){return function(n,r){return t.has(r)?t.get(r):(n=e(n,r),t.set(r,n),n)}}function Gs(e,t){return Ms.delimited(t,e,t)}function Fs(e,t){return e.reverse().reduce((function(e,t){return Ms.preceded(t,e)}),t)}function Ps(e,t,n,r){return Ms.then(Ms.then(e,t,(function(e,t){return[e,t]})),n,(function(e,t){var n=c(e);return e=n.next().value,n=n.next().value,r(e,n,t)}))}function Hs(e,t,n,r,o){return Ms.then(Ms.then(Ms.then(e,t,(function(e,t){return[e,t]})),n,(function(e,t){var n=c(e);return[e=n.next().value,n=n.next().value,t]})),r,(function(e,t){var n=c(e);e=n.next().value;var r=n.next().value;return n=n.next().value,o(e,r,n,t)}))}function _s(e){return Ms.map(e,(function(e){return[e]}))}function js(e,t){return Ms.map(Ms.or(e),(function(){return t}))}function Xs(e){return function(t,n){return(t=e.exec(t.substring(n)))&&0===t.index?Ms.okWithValue(n+t[0].length,t[0]):Ms.error(n,[e.source],!1)}}var Ls=Ms.or([Ms.token(" "),Ms.token("\t"),Ms.token("\r"),Ms.token("\n")]),$s=Ms.token("(:"),qs=Ms.token(":)"),Ys=Ms.token("(#"),Vs=Ms.token("#)"),Qs=Ms.token("("),Js=Ms.token(")"),Ks=Ms.token("["),zs=Ms.token("]"),Ws=Ms.token("{"),Zs=Ms.token("}"),eu=Ms.token("{{"),tu=Ms.token("}}"),nu=Ms.token("'"),ru=Ms.token("''"),ou=Ms.token('"'),au=Ms.token('""'),iu=Ms.token("<![CDATA["),su=Ms.token("]]>"),uu=Ms.token("/>"),cu=Ms.token("</"),lu=Ms.token("\x3c!--"),pu=Ms.token("--\x3e"),hu=Ms.token("<?"),fu=Ms.token("?>"),du=Ms.token("&#x"),mu=Ms.token("&#"),gu=Ms.token(":*"),yu=Ms.token("*:"),vu=Ms.token(":="),wu=Ms.token("&"),Au=Ms.token(":"),xu=Ms.token(";"),bu=Ms.token("*"),Eu=Ms.token("@"),Nu=Ms.token("$"),Bu=Ms.token("#"),Tu=Ms.token("%"),Iu=Ms.token("?"),Cu=Ms.token("!"),Su=Ms.token("|"),Ou=Ms.token("||"),Ru=Ms.token("="),Du=Ms.token("!="),Uu=Ms.token("<"),Mu=Ms.token("<<"),ku=Ms.token("<="),Gu=Ms.token(">"),Fu=Ms.token(">>"),Pu=Ms.token(">="),Hu=Ms.token(","),_u=Ms.token("."),ju=Ms.token(".."),Xu=Ms.token("+"),Lu=Ms.token("-"),$u=Ms.token("/"),qu=Ms.token("//"),Yu=Ms.token("=>"),Vu=Ms.token("e"),Qu=Ms.token("E"),Ju=Ms.token("l"),Ku=Ms.token("L"),zu=Ms.token("m"),Wu=Ms.token("M"),Zu=Ms.token("Q"),ec=Ms.token("x"),tc=Ms.token("X"),nc=Ms.token("as"),rc=Ms.token("cast"),oc=Ms.token("castable"),ac=Ms.token("treat"),ic=Ms.token("instance"),sc=Ms.token("of"),uc=Ms.token("node"),cc=Ms.token("nodes"),lc=Ms.token("delete"),pc=Ms.token("value"),hc=Ms.token("function"),fc=Ms.token("map"),dc=Ms.token("element"),mc=Ms.token("attribute"),gc=Ms.token("schema-element"),yc=Ms.token("intersect"),vc=Ms.token("except"),wc=Ms.token("union"),Ac=Ms.token("to"),xc=Ms.token("is"),bc=Ms.token("or"),Ec=Ms.token("and"),Nc=Ms.token("div"),Bc=Ms.token("idiv"),Tc=Ms.token("mod"),Ic=Ms.token("eq"),Cc=Ms.token("ne"),Sc=Ms.token("lt"),Oc=Ms.token("le"),Rc=Ms.token("gt"),Dc=Ms.token("ge"),Uc=Ms.token("amp"),Mc=Ms.token("quot"),kc=Ms.token("apos"),Gc=Ms.token("if"),Fc=Ms.token("then"),Pc=Ms.token("else"),Hc=Ms.token("allowing"),_c=Ms.token("empty"),jc=Ms.token("at"),Xc=Ms.token("in"),Lc=Ms.token("for"),$c=Ms.token("let"),qc=Ms.token("where"),Yc=Ms.token("collation"),Vc=Ms.token("group"),Qc=Ms.token("by"),Jc=Ms.token("order"),Kc=Ms.token("stable"),zc=Ms.token("return"),Wc=Ms.token("array"),Zc=Ms.token("document"),el=Ms.token("namespace"),tl=Ms.token("text"),nl=Ms.token("comment"),rl=Ms.token("processing-instruction"),ol=Ms.token("lax"),al=Ms.token("strict"),il=Ms.token("validate"),sl=Ms.token("type"),ul=Ms.token("declare"),cl=Ms.token("default"),ll=Ms.token("boundary-space"),pl=Ms.token("strip"),hl=Ms.token("preserve"),fl=Ms.token("no-preserve"),dl=Ms.token("inherit"),ml=Ms.token("no-inherit"),gl=Ms.token("greatest"),yl=Ms.token("least"),vl=Ms.token("copy-namespaces"),wl=Ms.token("decimal-format"),Al=Ms.token("case"),xl=Ms.token("typeswitch"),bl=Ms.token("some"),El=Ms.token("every"),Nl=Ms.token("satisfies"),Bl=Ms.token("replace"),Tl=Ms.token("with"),Il=Ms.token("copy"),Cl=Ms.token("modify"),Sl=Ms.token("first"),Ol=Ms.token("last"),Rl=Ms.token("before"),Dl=Ms.token("after"),Ul=Ms.token("into"),Ml=Ms.token("insert"),kl=Ms.token("rename"),Gl=Ms.token("switch"),Fl=Ms.token("variable"),Pl=Ms.token("external"),Hl=Ms.token("updating"),_l=Ms.token("import"),jl=Ms.token("schema"),Xl=Ms.token("module"),Ll=Ms.token("base-uri"),$l=Ms.token("construction"),ql=Ms.token("ordering"),Yl=Ms.token("ordered"),Vl=Ms.token("unordered"),Ql=Ms.token("option"),Jl=Ms.token("context"),Kl=Ms.token("item"),zl=Ms.token("xquery"),Wl=Ms.token("version"),Zl=Ms.token("encoding"),ep=Ms.token("document-node"),tp=Ms.token("namespace-node"),np=Ms.token("schema-attribute"),rp=Ms.token("ascending"),op=Ms.token("descending"),ap=Ms.token("empty-sequence"),ip=Ms.token("child::"),sp=Ms.token("descendant::"),up=Ms.token("attribute::"),cp=Ms.token("self::"),lp=Ms.token("descendant-or-self::"),pp=Ms.token("following-sibling::"),hp=Ms.token("following::"),fp=Ms.token("parent::"),dp=Ms.token("ancestor::"),mp=Ms.token("preceding-sibling::"),gp=Ms.token("preceding::"),yp=Ms.token("ancestor-or-self::"),vp=Ms.token("decimal-separator"),wp=Ms.token("grouping-separator"),Ap=Ms.token("infinity"),xp=Ms.token("minus-sign"),bp=Ms.token("NaN"),Ep=Ms.token("per-mille"),Np=Ms.token("zero-digit"),Bp=Ms.token("digit"),Tp=Ms.token("pattern-separator"),Ip=Ms.token("exponent-separator"),Cp=Ms.token("schema-attribute("),Sp=Ms.token("document-node("),Op=Ms.token("processing-instruction("),Rp=Ms.token("processing-instruction()"),Dp=Ms.token("comment()"),Up=Ms.token("text()"),Mp=Ms.token("namespace-node()"),kp=Ms.token("node()"),Gp=Ms.token("item()"),Fp=Ms.token("empty-sequence()"),Pp=new Map,Hp=new Map,_p=Ms.or([Xs(/[\t\n\r -\uD7FF\uE000\uFFFD]/),Xs(/[\uD800-\uDBFF][\uDC00-\uDFFF]/)]),jp=Ms.preceded(Ms.peek(Ms.not(Ms.or([$s,qs]),['comment contents cannot contain "(:" or ":)"'])),_p),Xp=Ms.map(Ms.delimited($s,Ms.star(Ms.or([jp,function(e,t){return Xp(e,t)}])),qs),(function(e){return e.join("")})),Lp=Ms.or([Ls,Xp]),$p=Ms.map(Ms.plus(Ls),(function(e){return e.join("")})),qp=ks(Ms.map(Ms.star(Lp),(function(e){return e.join("")})),Pp),Yp=ks(Ms.map(Ms.plus(Lp),(function(e){return e.join("")})),Hp),Vp=Ms.or([Xs(/[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]/),Ms.then(Xs(/[\uD800-\uDB7F]/),Xs(/[\uDC00-\uDFFF]/),(function(e,t){return e+t}))]),Qp=Ms.or([Vp,Xs(/[\-\.0-9\xB7\u0300-\u036F\u203F\u2040]/)]),Jp=Ms.then(Vp,Ms.star(Qp),(function(e,t){return e+t.join("")})),Kp=Ms.map(Jp,(function(e){return["prefix",e]})),zp=Ms.or([Vp,Au]),Wp=Ms.or([Qp,Au]),Zp=Ms.then(zp,Ms.star(Wp),(function(e,t){return e+t.join("")})),eh=Ms.map(Jp,(function(e){var t={};return[(t.prefix="",t.URI=null,t),e]})),th=Ms.then(Jp,Ms.preceded(Au,Jp),(function(e,t){var n={};return[(n.prefix=e,n.URI=null,n),t]})),nh=Ms.or([th,eh]),rh=Ms.followed(Fs([Zu,qp,Ws],Ms.map(Ms.star(Xs(/[^{}]/)),(function(e){return e.join("").replace(/\s+/g," ").trim()}))),Zs),oh=Ms.then(rh,Jp,(function(e,t){return[e,t]})),ah=Ms.or([Ms.map(oh,(function(e){var t={};return[(t.prefix=null,t.URI=e[0],t),e[1]]})),nh]),ih=Ms.or([Ms.map(ah,(function(e){return["QName"].concat(p(e))})),Ms.map(bu,(function(){return["star"]}))]),sh=Ms.map(Ms.preceded(Nu,ah),(function(e){return["varRef",["name"].concat(p(e))]})),uh=Ms.peek(Ms.or([Qs,ou,nu,Lp])),ch=Ms.map(Ms.or([ip,sp,up,cp,lp,pp,hp]),(function(e){return e.substring(0,e.length-2)})),lh=Ms.map(Ms.or([fp,dp,mp,gp,yp]),(function(e){return e.substring(0,e.length-2)})),ph=Ps(wu,Ms.or([Sc,Rc,Uc,Mc,kc]),xu,(function(e,t,n){return e+t+n})),hh=Ms.or([Ps(du,Xs(/[0-9a-fA-F]+/),xu,(function(e,t,n){return e+t+n})),Ps(mu,Xs(/[0-9]+/),xu,(function(e,t,n){return e+t+n}))]),fh=js([au],'"'),dh=js([ru],"'"),mh=_s(js([Dp],"commentTest")),gh=_s(js([Up],"textTest")),yh=_s(js([Mp],"namespaceTest")),vh=_s(js([kp],"anyKindTest")),wh=Xs(/[0-9]+/),Ah=Ms.then(Ms.or([Ms.then(_u,wh,(function(e,t){return e+t})),Ms.then(wh,Ms.optional(Ms.preceded(_u,Xs(/[0-9]*/))),(function(e,t){return e+(null!==t?"."+t:"")}))]),Ps(Ms.or([Vu,Qu]),Ms.optional(Ms.or([Xu,Lu])),wh,(function(e,t,n){return e+(t||"")+n})),(function(e,t){return["doubleConstantExpr",["value",e+t]]})),xh=Ms.or([Ms.map(Ms.preceded(_u,wh),(function(e){return["decimalConstantExpr",["value","."+e]]})),Ms.then(Ms.followed(wh,_u),Ms.optional(wh),(function(e,t){return["decimalConstantExpr",["value",e+"."+(null!==t?t:"")]]}))]),bh=Ms.map(wh,(function(e){return["integerConstantExpr",["value",e]]})),Eh=Ms.followed(Ms.or([Ah,xh,bh]),Ms.peek(Ms.not(Xs(/[a-zA-Z]/),["no alphabetical characters after numeric literal"]))),Nh=Ms.map(Ms.followed(_u,Ms.peek(Ms.not(_u,["context item should not be followed by another ."]))),(function(){return["contextItemExpr"]})),Bh=Ms.or([Wc,mc,nl,ep,dc,ap,hc,Gc,Kl,fc,tp,uc,rl,np,gc,Gl,tl,xl]),Th=_s(js([Iu],"argumentPlaceholder")),Ih=Ms.or([Iu,bu,Xu]),Ch=Ms.preceded(Ms.peek(Ms.not(Xs(/[{}<&]/),["elementContentChar cannot be {, }, <, or &"])),_p),Sh=Ms.map(Ms.delimited(iu,Ms.star(Ms.preceded(Ms.peek(Ms.not(su,['CDataSection content may not contain "]]>"'])),_p)),su),(function(e){return["CDataSection",e.join("")]})),Oh=Ms.preceded(Ms.peek(Ms.not(Xs(/["{}<&]/),['quotAttrValueContentChar cannot be ", {, }, <, or &'])),_p),Rh=Ms.preceded(Ms.peek(Ms.not(Xs(/['{}<&]/),["aposAttrValueContentChar cannot be ', {, }, <, or &"])),_p),Dh=Ms.map(Ms.star(Ms.or([Ms.preceded(Ms.peek(Ms.not(Lu,[])),_p),Ms.map(Fs([Lu,Ms.peek(Ms.not(Lu,[]))],_p),(function(e){return"-"+e}))])),(function(e){return e.join("")})),Uh=Ms.map(Ms.delimited(lu,Dh,pu),(function(e){return["computedCommentConstructor",["argExpr",["stringConstantExpr",["value",e]]]]})),Mh=Ms.preceded(Ms.peek(Ms.not(Ps(Ms.or([tc,ec]),Ms.or([Wu,zu]),Ms.or([Ku,Ju]),(function(){return[]})),[])),Zp),kh=Ms.map(Ms.star(Ms.preceded(Ms.peek(Ms.not(fu,[])),_p)),(function(e){return e.join("")})),Gh=Ms.then(Ms.preceded(hu,Mh),Ms.followed(Ms.optional(Ms.preceded($p,kh)),fu),(function(e,t){return["computedPIConstructor",["piTarget",e],["piValueExpr",["stringConstantExpr",["value",t]]]]})),Fh=Ms.map(qu,(function(){return["stepExpr",["xpathAxis","descendant-or-self"],["anyKindTest"]]})),Ph=Ms.or([ol,al]),Hh=Ms.map(Ms.star(Ms.followed(_p,Ms.peek(Ms.not(Vs,["Pragma contents should not contain '#)'"])))),(function(e){return e.join("")})),_h=Ms.map(Ms.followed(Ms.or([Ic,Cc,Sc,Oc,Rc,Dc]),uh),(function(e){return e+"Op"})),jh=Ms.or([Ms.followed(js([xc],"isOp"),uh),js([Mu],"nodeBeforeOp"),js([Fu],"nodeAfterOp")]),Xh=Ms.or([js([Ru],"equalOp"),js([Du],"notEqualOp"),js([ku],"lessThanOrEqualOp"),js([Uu],"lessThanOp"),js([Pu],"greaterThanOrEqualOp"),js([Gu],"greaterThanOp")]),Lh=Ms.map(Hl,(function(){return["annotation",["annotationName","updating"]]})),$h=Ms.or([hl,fl]),qh=Ms.or([dl,ml]),Yh=Ms.or([vp,wp,Ap,xp,bp,Tu,Ep,Np,Bp,Tp,Ip]),Vh=Ms.map(Fs([ul,Yp,ll,Yp],Ms.or([hl,pl])),(function(e){return["boundarySpaceDecl",e]})),Qh=Ms.map(Fs([ul,Yp,$l,Yp],Ms.or([hl,pl])),(function(e){return["constructionDecl",e]})),Jh=Ms.map(Fs([ul,Yp,ql,Yp],Ms.or([Yl,Vl])),(function(e){return["orderingModeDecl",e]})),Kh=Ms.map(Fs([ul,Yp,cl,Yp,Jc,Yp,_c,Yp],Ms.or([gl,yl])),(function(e){return["emptyOrderDecl",e]})),zh=Ms.then(Fs([ul,Yp,vl,Yp],$h),Fs([qp,Hu,qp],qh),(function(e,t){return["copyNamespacesDecl",["preserveMode",e],["inheritMode",t]]}));function Wh(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 Zh(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 ef(e){return e.replace(/(&[^;]+);/g,(function(e){if(/^&#x/.test(e))return Zh(e=parseInt(e.slice(3,-1),16)),String.fromCodePoint(e);if(/^&#/.test(e))return Zh(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 tf(e,t,n){if(!e.length)return[];for(var r=[e[0]],o=1;o<e.length;++o){var a=r[r.length-1];"string"==typeof a&&"string"==typeof e[o]?r[r.length-1]=a+e[o]:r.push(e[o])}if("string"==typeof r[0]&&0===r.length)return[];if(r=r.reduce((function(e,t,o){if("string"!=typeof t)e.push(t);else if(n&&/^\s*$/.test(t)){var a=r[o+1];(a&&"CDataSection"===a[0]||(o=r[o-1])&&"CDataSection"===o[0])&&e.push(ef(t))}else e.push(ef(t));return e}),[]),!r.length)return r;if(1<r.length||t)for(e=0;e<r.length;e++)"string"==typeof r[e]&&(r[e]=["stringConstantExpr",["value",r[e]]]);return r}function nf(e){return e[0].prefix?e[0].prefix+":"+e[1]:e[1]}var rf=Ms.then(ah,Ms.optional(Iu),(function(e,t){return null!==t?["singleType",["atomicType"].concat(p(e)),["optional"]]:["singleType",["atomicType"].concat(p(e))]})),of=Ms.map(ah,(function(e){return["atomicType"].concat(p(e))})),af=new Map;function sf(e){function t(e,t){return t.reduce((function(e,t){return[t[0],["firstOperand",e],["secondOperand",t[1]]]}),e)}function n(e,t,n){return Ms.then(e,Ms.star(Ms.then(Gs(t,qp),e,(function(e,t){return[e,t]}))),n)}function r(e,t,n,r){return n=void 0===n?"firstOperand":n,r=void 0===r?"secondOperand":r,Ms.then(e,Ms.optional(Ms.then(Gs(t,qp),e,(function(e,t){return[e,t]}))),(function(e,t){return null===t?e:[t[0],[n,e],[r,t[1]]]}))}function o(t){return e.sb?function(e,n){if(!(e=t(e,n)).success)return e;var r=l.has(n)?l.get(n):{offset:n,line:-1,la:-1},o=l.has(e.offset)?l.get(e.offset):{offset:e.offset,line:-1,la:-1};return l.set(n,r),l.set(e.offset,o),Ms.okWithValue(e.offset,["x:stackTrace",{start:r,end:o},e.value])}:t}function a(e,t){return z(e,t)}function i(e,t){return He(e,t)}function s(e,t){return o(Ms.or([It,Ut,Xt,Ot,st,Ht,Mt,_t,kt,Ft,it]))(e,t)}function u(e,t){return n(s,Hu,(function(e,t){return 0===t.length?e:["sequenceExpr",e].concat(p(t.map((function(e){return e[1]}))))}))(e,t)}var l=new Map,h=Ms.preceded(Ks,Ms.followed(Gs(u,qp),zs)),f=Ms.map(e.Va?Ms.or([Gs(Ms.star(Ms.or([ph,hh,fh,Xs(/[^"&]/)])),ou),Gs(Ms.star(Ms.or([ph,hh,dh,Xs(/[^'&]/)])),nu)]):Ms.or([Gs(Ms.star(Ms.or([fh,Xs(/[^"]/)])),ou),Gs(Ms.star(Ms.or([dh,Xs(/[^']/)])),nu)]),(function(e){return e.join("")})),d=Ms.or([Ms.map(Fs([dc,qp],Ms.delimited(Ms.followed(Qs,qp),Ms.then(ih,Fs([qp,Hu,qp],ah),(function(e,t){return[["elementName",e],["typeName"].concat(p(t))]})),Ms.preceded(qp,Js))),(function(e){var t=c(e);return["elementTest",e=t.next().value,t=t.next().value]})),Ms.map(Fs([dc,qp],Ms.delimited(Qs,ih,Js)),(function(e){return["elementTest",["elementName",e]]})),Ms.map(Fs([dc,qp],Ms.delimited(Qs,qp,Js)),(function(){return["elementTest"]}))]),m=Ms.or([Ms.map(ah,(function(e){return["QName"].concat(p(e))})),Ms.map(bu,(function(){return["star"]}))]),g=Ms.or([Ms.map(Fs([mc,qp],Ms.delimited(Ms.followed(Qs,qp),Ms.then(m,Fs([qp,Hu,qp],ah),(function(e,t){return[["attributeName",e],["typeName"].concat(p(t))]})),Ms.preceded(qp,Js))),(function(e){var t=c(e);return["attributeTest",e=t.next().value,t=t.next().value]})),Ms.map(Fs([mc,qp],Ms.delimited(Qs,m,Js)),(function(e){return["attributeTest",["attributeName",e]]})),Ms.map(Fs([mc,qp],Ms.delimited(Qs,qp,Js)),(function(){return["attributeTest"]}))]),y=Ms.map(Fs([gc,qp,Qs],Ms.followed(ah,Js)),(function(e){return["schemaElementTest"].concat(p(e))})),v=Ms.map(Ms.delimited(Cp,Gs(ah,qp),Js),(function(e){return["schemaAttributeTest"].concat(p(e))})),w=Ms.map(Ms.preceded(Sp,Ms.followed(Gs(Ms.optional(Ms.or([d,y])),qp),Js)),(function(e){return["documentTest"].concat(p(e?[e]:[]))})),A=Ms.or([Ms.map(Ms.preceded(Op,Ms.followed(Gs(Ms.or([Jp,f]),qp),Js)),(function(e){return["piTest",["piTarget",e]]})),_s(js([Rp],"piTest"))]),x=Ms.or([w,d,g,y,v,A,mh,gh,yh,vh]),b=Ms.or([Ms.map(Ms.preceded(yu,Jp),(function(e){return["Wildcard",["star"],["NCName",e]]})),_s(js([bu],"Wildcard")),Ms.map(Ms.followed(rh,bu),(function(e){return["Wildcard",["uri",e],["star"]]})),Ms.map(Ms.followed(Jp,gu),(function(e){return["Wildcard",["NCName",e],["star"]]}))]),E=Ms.or([b,Ms.map(ah,(function(e){return["nameTest"].concat(p(e))}))]),N=Ms.or([x,E]),B=Ms.then(Ms.optional(Eu),N,(function(e,t){return null!==e||"attributeTest"===t[0]||"schemaAttributeTest"===t[0]?["stepExpr",["xpathAxis","attribute"],t]:["stepExpr",["xpathAxis","child"],t]})),T=Ms.or([Ms.then(ch,N,(function(e,t){return["stepExpr",["xpathAxis",e],t]})),B]),I=Ms.map(ju,(function(){return["stepExpr",["xpathAxis","parent"],["anyKindTest"]]})),C=Ms.or([Ms.then(lh,N,(function(e,t){return["stepExpr",["xpathAxis",e],t]})),I]),S=Ms.map(Ms.star(Ms.preceded(qp,h)),(function(e){return 0<e.length?["predicates"].concat(p(e)):void 0})),O=Ms.then(Ms.or([C,T]),S,(function(e,t){return void 0===t?e:e.concat([t])})),R=Ms.or([Eh,Ms.map(f,(function(t){return["stringConstantExpr",["value",e.Va?ef(t):t]]}))]),D=Ms.or([Ms.delimited(Qs,Gs(u,qp),Js),Ms.map(Ms.delimited(Qs,qp,Js),(function(){return["sequenceExpr"]}))]),U=Ms.or([s,Th]),M=Ms.map(Ms.delimited(Qs,Gs(Ms.optional(Ms.then(U,Ms.star(Ms.preceded(Gs(Hu,qp),U)),(function(e,t){return[e].concat(p(t))}))),qp),Js),(function(e){return null!==e?e:[]})),k=Ms.preceded(Ms.not(Ps(Bh,qp,Qs,(function(){})),["cannot use reseved keyword for function names"]),Ms.then(ah,Ms.preceded(qp,M),(function(e,t){return["functionCallExpr",["functionName"].concat(p(e)),null!==t?["arguments"].concat(p(t)):["arguments"]]}))),G=Ms.then(ah,Ms.preceded(Bu,bh),(function(e,t){return["namedFunctionRef",["functionName"].concat(p(e)),t]})),F=Ms.delimited(Ws,Gs(Ms.optional(u),qp),Zs),P=Ms.map(F,(function(e){return e||["sequenceExpr"]})),H=Ms.or([Ms.map(Fp,(function(){return[["voidSequenceType"]]})),Ms.then(a,Ms.optional(Ms.preceded(qp,Ih)),(function(e,t){return[e].concat(p(null!==t?[["occurrenceIndicator",t]]:[]))}))]),_=Ms.then(Fs([Tu,qp],ah),Ms.optional(Ms.followed(Ms.then(Fs([Qs,qp],R),Ms.star(Fs([Hu,qp],R)),(function(e,t){return e.concat(t)})),Js)),(function(e,t){return["annotation",["annotationName"].concat(p(e))].concat(p(t?["arguments",t]:[]))})),j=Ms.map(Fs([hc,qp,Qs,qp,bu,qp],Js),(function(){return["anyFunctionTest"]})),X=Ms.then(Fs([hc,qp,Qs,qp],Ms.optional(n(H,Hu,(function(e,t){return e.concat.apply(e,t.map((function(e){return e[1]})))})))),Fs([qp,Js,Yp,nc,Yp],H),(function(e,t){return["typedFunctionTest",["paramTypeList",["sequenceType"].concat(p(e||[]))],["sequenceType"].concat(p(t))]})),L=Ms.then(Ms.star(_),Ms.or([j,X]),(function(e,t){return[t[0]].concat(p(e),p(t.slice(1)))})),$=Ms.map(Fs([fc,qp,Qs,qp,bu,qp],Js),(function(){return["anyMapTest"]})),q=Ms.then(Fs([fc,qp,Qs,qp],of),Fs([qp,Hu],Ms.followed(Gs(H,qp),Js)),(function(e,t){return["typedMapTest",e,["sequenceType"].concat(p(t))]})),Y=Ms.or([$,q]),V=Ms.map(Fs([Wc,qp,Qs,qp,bu,qp],Js),(function(){return["anyArrayTest"]})),Q=Ms.map(Fs([Wc,qp,Qs],Ms.followed(Gs(H,qp),Js)),(function(e){return["typedArrayTest",["sequenceType"].concat(p(e))]})),J=Ms.or([V,Q]),K=Ms.map(Ms.delimited(Qs,Gs(a,qp),Js),(function(e){return["parenthesizedItemType",e]})),z=Ms.or([x,_s(js([Gp],"anyItemType")),L,Y,J,of,K]),W=Ms.map(Fs([nc,Yp],H),(function(e){return["typeDeclaration"].concat(p(e))})),Z=Ms.then(Ms.preceded(Nu,ah),Ms.optional(Ms.preceded(Yp,W)),(function(e,t){return["param",["varName"].concat(p(e))].concat(p(t?[t]:[]))})),ee=n(Z,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))})),te=Hs(Ms.star(_),Fs([qp,hc,qp,Qs,qp],Ms.optional(ee)),Fs([qp,Js,qp],Ms.optional(Ms.map(Fs([nc,qp],Ms.followed(H,qp)),(function(e){return["typeDeclaration"].concat(p(e))})))),P,(function(e,t,n,r){return["inlineFunctionExpr"].concat(p(e),[["paramList"].concat(p(t||[]))],p(n?[n]:[]),[["functionBody",r]])})),ne=Ms.or([G,te]),re=Ms.map(s,(function(e){return["mapKeyExpr",e]})),oe=Ms.map(s,(function(e){return["mapValueExpr",e]})),ae=Ms.then(re,Ms.preceded(Gs(Au,qp),oe),(function(e,t){return["mapConstructorEntry",e,t]})),ie=Ms.preceded(fc,Ms.delimited(Gs(Ws,qp),Ms.map(Ms.optional(n(ae,Gs(Hu,qp),(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))}))),(function(e){return e?["mapConstructor"].concat(p(e)):["mapConstructor"]})),Ms.preceded(qp,Zs))),se=Ms.map(Ms.delimited(Ks,Gs(Ms.optional(n(s,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]})))).map((function(e){return["arrayElem",e]}))}))),qp),zs),(function(e){return["squareArray"].concat(p(null!==e?e:[]))})),ue=Ms.map(Ms.preceded(Wc,Ms.preceded(qp,F)),(function(e){return["curlyArray"].concat(p(null!==e?[["arrayElem",e]]:[]))})),ce=Ms.map(Ms.or([se,ue]),(function(e){return["arrayConstructor",e]})),le=Ms.or([Jp,bh,D,bu]),pe=Ms.map(Ms.preceded(Iu,Ms.preceded(qp,le)),(function(e){return"*"===e?["unaryLookup",["star"]]:"string"==typeof e?["unaryLookup",["NCName",e]]:["unaryLookup",e]})),he=Ms.or([ph,hh,js([eu],"{"),js([tu],"}"),Ms.map(F,(function(e){return e||["sequenceExpr"]}))]),fe=Ms.or([Sh,function(e,t){return Ae(e,t)},he,Ch]),de=Ms.or([Ms.map(Oh,(function(e){return e.replace(/[\x20\x0D\x0A\x09]/g," ")})),he]),me=Ms.or([Ms.map(Rh,(function(e){return e.replace(/[\x20\x0D\x0A\x09]/g," ")})),he]),ge=Ms.map(Ms.or([Gs(Ms.star(Ms.or([fh,de])),ou),Gs(Ms.star(Ms.or([dh,me])),nu)]),(function(e){return tf(e,!1,!1)})),ye=Ms.then(nh,Ms.preceded(Gs(Ru,Ms.optional($p)),ge),(function(e,t){if(""===e[0].prefix&&"xmlns"===e[1]){if(t.length&&"string"!=typeof t[0])throw Error("XQST0022: A namespace declaration may not contain enclosed expressions");return["namespaceDeclaration",t.length?["uri",t[0]]:["uri"]]}if("xmlns"===e[0].prefix){if(t.length&&"string"!=typeof t[0])throw Error("XQST0022: The namespace declaration for 'xmlns:"+e[1]+"' may not contain enclosed expressions");return["namespaceDeclaration",["prefix",e[1]],t.length?["uri",t[0]]:["uri"]]}return["attributeConstructor",["attributeName"].concat(e),0===t.length?["attributeValue"]:1===t.length&&"string"==typeof t[0]?["attributeValue",t[0]]:["attributeValueExpr"].concat(t)]})),ve=Ms.map(Ms.star(Ms.preceded($p,Ms.optional(ye))),(function(e){return e.filter(Boolean)})),we=Ps(Ms.preceded(Uu,nh),ve,Ms.or([Ms.map(uu,(function(){return null})),Ms.then(Ms.preceded(Gu,Ms.star(fe)),Fs([qp,cu],Ms.followed(nh,Ms.then(Ms.optional($p),Gu,(function(){return null})))),(function(e,t){return[tf(e,!0,!0),t]}))]),(function(e,t,n){var r=n;if(n&&n.length){r=nf(e);var o=nf(n[1]);if(r!==o)throw Error('XQST0118: The start and the end tag of an element constructor must be equal. "'+r+'" does not match "'+o+'"');r=n[0]}return["elementConstructor",["tagName"].concat(p(e))].concat(p(t.length?[["attributeList"].concat(p(t))]:[]),p(r&&r.length?[["elementContent"].concat(p(r))]:[]))})),Ae=Ms.or([we,Uh,Gh]),xe=Ms.map(Fs([Zc,qp],F),(function(e){return["computedDocumentConstructor"].concat(p(e?[["argExpr",e]]:[]))})),be=Ms.map(F,(function(e){return e?[["contentExpr",e]]:[]})),Ee=Ms.then(Fs([dc,qp],Ms.or([Ms.map(ah,(function(e){return["tagName"].concat(p(e))})),Ms.map(Ms.delimited(Ws,Gs(u,qp),Zs),(function(e){return["tagNameExpr",e]}))])),Ms.preceded(qp,be),(function(e,t){return["computedElementConstructor",e].concat(p(t))})),Ne=Ms.then(Ms.preceded(mc,Ms.or([Ms.map(Fs([uh,qp],ah),(function(e){return["tagName"].concat(p(e))})),Ms.map(Ms.preceded(qp,Ms.delimited(Ws,Gs(u,qp),Zs)),(function(e){return["tagNameExpr",e]}))])),Ms.preceded(qp,F),(function(e,t){return["computedAttributeConstructor",e,["valueExpr",t||["sequenceExpr"]]]})),Be=Ms.map(F,(function(e){return e?[["prefixExpr",e]]:[]})),Te=Ms.map(F,(function(e){return e?[["URIExpr",e]]:[]})),Ie=Ms.then(Fs([el,qp],Ms.or([Kp,Be])),Ms.preceded(qp,Te),(function(e,t){return["computedNamespaceConstructor"].concat(p(e),p(t))})),Ce=Ms.map(Fs([tl,qp],F),(function(e){return["computedTextConstructor"].concat(p(e?[["argExpr",e]]:[]))})),Se=Ms.map(Fs([nl,qp],F),(function(e){return["computedCommentConstructor"].concat(p(e?[["argExpr",e]]:[]))})),Oe=Fs([rl,qp],Ms.then(Ms.or([Ms.map(Jp,(function(e){return["piTarget",e]})),Ms.map(Ms.delimited(Ws,Gs(u,qp),Zs),(function(e){return["piTargetExpr",e]}))]),Ms.preceded(qp,F),(function(e,t){return["computedPIConstructor",e].concat(p(t?[["piValueExpr",t]]:[]))}))),Re=Ms.or([xe,Ee,Ne,Ie,Ce,Se,Oe]),De=Ms.or([Ae,Re]),Ue=Ms.or([R,sh,D,Nh,k,De,ne,ie,ce,pe]),Me=Ms.map(Fs([Iu,qp],le),(function(e){return"*"===e?["lookup",["star"]]:"string"==typeof e?["lookup",["NCName",e]]:["lookup",e]})),ke=Ms.then(Ms.map(Ue,(function(e){return Wh(e)})),Ms.star(Ms.or([Ms.map(Ms.preceded(qp,h),(function(e){return["predicate",e]})),Ms.map(Ms.preceded(qp,M),(function(e){return["argumentList",e]})),Ms.preceded(qp,Me)])),(function(e,t){function n(){s&&1===a.length?i.push(["predicate",a[0]]):0!==a.length&&i.push(["predicates"].concat(p(a))),a.length=0}function r(e){n(),0!==i.length?("sequenceExpr"===o[0]&&2<o.length&&(o=["sequenceExpr",o]),o=[["filterExpr",o]].concat(p(i)),i.length=0):o=e?[["filterExpr",o]]:[o]}var o=e,a=[],i=[],s=!1;for(t=(e=c(t)).next();!t.done;t=e.next())switch(t=t.value,t[0]){case"predicate":a.push(t[1]);break;case"lookup":s=!0,n(),i.push(t);break;case"argumentList":r(!1),1<o.length&&(o=[["sequenceExpr",["pathExpr",["stepExpr"].concat(p(o))]]]),o=["dynamicFunctionInvocationExpr",["functionItem"].concat(p(o))].concat(p(t[1].length?[["arguments"].concat(p(t[1]))]:[]));break;default:throw Error("unreachable")}return r(!0),o})),Ge=Ms.or([Ms.map(ke,(function(e){return["stepExpr"].concat(p(e))})),O]),Fe=Ms.followed(Ue,Ms.peek(Ms.not(Ms.preceded(qp,Ms.or([h,M,Me])),["primary expression not followed by predicate, argumentList, or lookup"]))),Pe=Ms.or([Ps(Ge,Ms.preceded(qp,Fh),Ms.preceded(qp,i),(function(e,t,n){return["pathExpr",e,t].concat(p(n))})),Ms.then(Ge,Ms.preceded(Gs($u,qp),i),(function(e,t){return["pathExpr",e].concat(p(t))})),Fe,Ms.map(Ge,(function(e){return["pathExpr",e]}))]),He=Ms.or([Ps(Ge,Ms.preceded(qp,Fh),Ms.preceded(qp,i),(function(e,t,n){return[e,t].concat(p(n))})),Ms.then(Ge,Ms.preceded(Gs($u,qp),i),(function(e,t){return[e].concat(p(t))})),Ms.map(Ge,(function(e){return[e]}))]),_e=Ms.or([Ms.map(Fs([$u,qp],He),(function(e){return["pathExpr",["rootExpr"]].concat(p(e))})),Ms.then(Fh,Ms.preceded(qp,He),(function(e,t){return["pathExpr",["rootExpr"],e].concat(p(t))})),Ms.map(Ms.followed($u,Ms.not(Ms.preceded(qp,e.Va?Xs(/[*<a-zA-Z]/):Xs(/[*a-zA-Z]/)),["Single rootExpr cannot be by followed by something that can be interpreted as a relative path"])),(function(){return["pathExpr",["rootExpr"]]}))]),je=ks(Ms.or([Pe,_e]),af),Xe=Ms.preceded(il,Ms.then(Ms.optional(Ms.or([Ms.map(Ms.preceded(qp,Ph),(function(e){return["validationMode",e]})),Ms.map(Fs([qp,sl,qp],ah),(function(e){return["type"].concat(p(e))}))])),Ms.delimited(Ms.preceded(qp,Ws),Gs(u,qp),Zs),(function(e,t){return["validateExpr"].concat(p(e?[e]:[]),[["argExpr",t]])}))),Le=Ms.delimited(Ys,Ms.then(Ms.preceded(qp,ah),Ms.optional(Ms.preceded(Yp,Hh)),(function(e,t){return t?["pragma",["pragmaName",e],["pragmaContents",t]]:["pragma",["pragmaName",e]]})),Ms.preceded(qp,Vs)),$e=Ms.map(Ms.followed(Ms.plus(Le),Ms.preceded(qp,Ms.delimited(Ws,Gs(Ms.optional(u),qp),Zs))),(function(e){return["extensionExpr"].concat(p(e))})),qe=o(n(je,Cu,(function(e,t){return 0===t.length?e:["simpleMapExpr","pathExpr"===e[0]?e:["pathExpr",["stepExpr",["filterExpr",Wh(e)]]]].concat(t.map((function(e){return"pathExpr"===(e=e[1])[0]?e:["pathExpr",["stepExpr",["filterExpr",Wh(e)]]]})))}))),Ye=Ms.or([Xe,$e,qe]),Ve=Ms.or([Ms.then(Ms.or([js([Lu],"unaryMinusOp"),js([Xu],"unaryPlusOp")]),Ms.preceded(qp,(function(e,t){return Ve(e,t)})),(function(e,t){return[e,["operand",t]]})),Ye]),Qe=Ms.or([Ms.map(ah,(function(e){return["EQName"].concat(p(e))})),sh,D]),Je=Ms.then(Ve,Ms.star(Fs([qp,Yu,qp],Ms.then(Qe,Ms.preceded(qp,M),(function(e,t){return[e,t]})))),(function(e,t){return t.reduce((function(e,t){return["arrowExpr",["argExpr",e],t[0],["arguments"].concat(p(t[1]))]}),e)})),Ke=Ms.then(Je,Ms.optional(Fs([qp,rc,Yp,nc,uh,qp],rf)),(function(e,t){return null!==t?["castExpr",["argExpr",e],t]:e})),ze=Ms.then(Ke,Ms.optional(Fs([qp,oc,Yp,nc,uh,qp],rf)),(function(e,t){return null!==t?["castableExpr",["argExpr",e],t]:e})),We=Ms.then(ze,Ms.optional(Fs([qp,ac,Yp,nc,uh,qp],H)),(function(e,t){return null!==t?["treatExpr",["argExpr",e],["sequenceType"].concat(p(t))]:e})),Ze=Ms.then(We,Ms.optional(Fs([qp,ic,Yp,sc,uh,qp],H)),(function(e,t){return null!==t?["instanceOfExpr",["argExpr",e],["sequenceType"].concat(p(t))]:e})),et=n(Ze,Ms.followed(Ms.or([js([yc],"intersectOp"),js([vc],"exceptOp")]),uh),t),tt=n(et,Ms.or([js([Su],"unionOp"),Ms.followed(js([wc],"unionOp"),uh)]),t),nt=n(tt,Ms.or([js([bu],"multiplyOp"),Ms.followed(js([Nc],"divOp"),uh),Ms.followed(js([Bc],"idivOp"),uh),Ms.followed(js([Tc],"modOp"),uh)]),t),rt=n(nt,Ms.or([js([Lu],"subtractOp"),js([Xu],"addOp")]),t),ot=n(r(rt,Ms.followed(js([Ac],"rangeSequenceExpr"),uh),"startExpr","endExpr"),js([Ou],"stringConcatenateOp"),t),at=n(r(ot,Ms.or([_h,jh,Xh])),Ms.followed(js([Ec],"andOp"),uh),t),it=n(at,Ms.followed(js([bc],"orOp"),uh),t),st=Ms.then(Ms.then(Fs([Gc,qp,Qs,qp],u),Fs([qp,Js,qp,Fc,uh,qp],s),(function(e,t){return[e,t]})),Fs([qp,Pc,uh,qp],s),(function(e,t){return["ifThenElseExpr",["ifClause",e[0]],["thenClause",e[1]],["elseClause",t]]})),ut=Ms.delimited(Hc,Yp,_c),ct=Ms.map(Fs([jc,Yp,Nu],ah),(function(e){return["positionalVariableBinding"].concat(p(e))})),lt=function(e,t,n,r,o,a){return Ms.then(Ms.then(Ms.then(Ms.then(e,t,(function(e,t){return[e,t]})),n,(function(e,t){var n=c(e);return[e=n.next().value,n=n.next().value,t]})),r,(function(e,t){var n=c(e);return[e=n.next().value,n.next().value,n=n.next().value,t]})),o,(function(e,t){var n=c(e);e=n.next().value;var r=n.next().value,o=n.next().value;return n=n.next().value,a(e,r,o,n,t)}))}(Ms.preceded(Nu,ah),Ms.preceded(qp,Ms.optional(W)),Ms.preceded(qp,Ms.optional(ut)),Ms.preceded(qp,Ms.optional(ct)),Ms.preceded(Gs(Xc,qp),s),(function(e,t,n,r,o){return["forClauseItem",["typedVariableBinding",["varName"].concat(p(e),p(t?[t]:[]))]].concat(p(n?[["allowingEmpty"]]:[]),p(r?[r]:[]),[["forExpr",o]])})),pt=Fs([Lc,Yp],n(lt,Hu,(function(e,t){return["forClause",e].concat(p(t.map((function(e){return e[1]}))))}))),ht=Ps(Ms.preceded(Nu,ah),Ms.preceded(qp,Ms.optional(W)),Ms.preceded(Gs(vu,qp),s),(function(e,t,n){return["letClauseItem",["typedVariableBinding",["varName"].concat(p(e))].concat(p(t?[t]:[])),["letExpr",n]]})),ft=Ms.map(Fs([$c,qp],n(ht,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))}))),(function(e){return["letClause"].concat(p(e))})),dt=Ms.or([pt,ft]),mt=Ms.map(Fs([qc,uh,qp],s),(function(e){return["whereClause",e]})),gt=Ms.map(Ms.preceded(Nu,ah),(function(e){return["varName"].concat(p(e))})),yt=Ms.then(Ms.preceded(qp,Ms.optional(W)),Ms.preceded(Gs(vu,qp),s),(function(e,t){return["groupVarInitialize"].concat(p(e?[["typeDeclaration"].concat(p(e))]:[]),[["varValue",t]])})),vt=Ps(gt,Ms.optional(yt),Ms.optional(Ms.map(Ms.preceded(Gs(Yc,qp),f),(function(e){return["collation",e]}))),(function(e,t,n){return["groupingSpec",e].concat(p(t?[t]:[]),p(n?[n]:[]))})),wt=n(vt,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))})),At=Ms.map(Fs([Vc,Yp,Qc,qp],wt),(function(e){return["groupByClause"].concat(p(e))})),xt=Ps(Ms.optional(Ms.or([rp,op])),Ms.optional(Fs([qp,_c,qp],Ms.or([gl,yl].map((function(e){return Ms.map(e,(function(e){return"empty "+e}))}))))),Ms.preceded(qp,Ms.optional(Fs([Yc,qp],f))),(function(e,t,n){return e||t||n?["orderModifier"].concat(p(e?[["orderingKind",e]]:[]),p(t?[["emptyOrderingMode",t]]:[]),p(n?[["collation",n]]:[])):null})),bt=Ms.then(s,Ms.preceded(qp,xt),(function(e,t){return["orderBySpec",["orderByExpr",e]].concat(p(t?[t]:[]))})),Et=n(bt,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))})),Nt=Ms.then(Ms.or([Ms.map(Fs([Jc,Yp],Qc),(function(){return!1})),Ms.map(Fs([Kc,Yp,Jc,Yp],Qc),(function(){return!0}))]),Ms.preceded(qp,Et),(function(e,t){return["orderByClause"].concat(p(e?[["stable"]]:[]),p(t))})),Bt=Ms.or([dt,mt,At,Nt]),Tt=Ms.map(Fs([zc,qp],s),(function(e){return["returnClause",e]})),It=Ps(dt,Ms.star(Ms.preceded(qp,Bt)),Ms.preceded(qp,Tt),(function(e,t,n){return["flworExpr",e].concat(p(t),[n])})),Ct=n(H,Su,(function(e,t){return 0===t.length?["sequenceType"].concat(p(e)):["sequenceTypeUnion",["sequenceType"].concat(p(e))].concat(p(t.map((function(e){return["sequenceType"].concat(p(e[1]))}))))})),St=Ps(Fs([Al,qp],Ms.optional(Ms.preceded(Nu,Ms.followed(Ms.followed(ah,Yp),nc)))),Ms.preceded(qp,Ct),Fs([Yp,zc,Yp],s),(function(e,t,n){return["typeswitchExprCaseClause"].concat(e?[["variableBinding"].concat(p(e))]:[],[t],[["resultExpr",n]])})),Ot=Hs(Ms.preceded(xl,Gs(Ms.delimited(Qs,Gs(u,qp),Js),qp)),Ms.plus(Ms.followed(St,qp)),Fs([cl,Yp],Ms.optional(Ms.preceded(Nu,Ms.followed(ah,Yp)))),Fs([zc,Yp],s),(function(e,t,n,r){return["typeswitchExpr",["argExpr",e]].concat(p(t),[["typeswitchExprDefaultClause"].concat(p(n||[]),[["resultExpr",r]])])})),Rt=Ps(Ms.preceded(Nu,ah),Ms.optional(Ms.preceded(Yp,W)),Ms.preceded(Gs(Xc,Yp),s),(function(e,t,n){return["quantifiedExprInClause",["typedVariableBinding",["varName"].concat(p(e))].concat(p(t?[t]:[])),["sourceExpr",n]]})),Dt=n(Rt,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))})),Ut=Ps(Ms.or([bl,El]),Ms.preceded(Yp,Dt),Ms.preceded(Gs(Nl,qp),s),(function(e,t,n){return["quantifiedExpr",["quantifier",e]].concat(p(t),[["predicateExpr",n]])})),Mt=Ms.map(Fs([lc,Yp,Ms.or([cc,uc]),Yp],s),(function(e){return["deleteExpr",["targetExpr",e]]})),kt=Ps(Fs([Bl,Yp],Ms.optional(Fs([pc,Yp,sc],Yp))),Fs([uc,Yp],s),Ms.preceded(Gs(Tl,Yp),s),(function(e,t,n){return e?["replaceExpr",["replaceValue"],["targetExpr",t],["replacementExpr",n]]:["replaceExpr",["targetExpr",t],["replacementExpr",n]]})),Gt=Ms.then(sh,Ms.preceded(Gs(vu,qp),s),(function(e,t){return["transformCopy",e,["copySource",t]]})),Ft=Ps(Fs([Il,Yp],n(Gt,Hu,(function(e,t){return[e].concat(p(t.map((function(e){return e[1]}))))}))),Fs([qp,Cl,Yp],s),Ms.preceded(Gs(zc,Yp),s),(function(e,t,n){return["transformExpr",["transformCopies"].concat(p(e)),["modifyExpr",t],["returnExpr",n]]})),Pt=Ms.or([Ms.followed(Ms.map(Ms.optional(Ms.followed(Fs([nc,Yp],Ms.or([Ms.map(Sl,(function(){return["insertAsFirst"]})),Ms.map(Ol,(function(){return["insertAsLast"]}))])),Yp)),(function(e){return e?["insertInto",e]:["insertInto"]})),Ul),Ms.map(Dl,(function(){return["insertAfter"]})),Ms.map(Rl,(function(){return["insertBefore"]}))]),Ht=Ps(Fs([Ml,Yp,Ms.or([cc,uc]),Yp],s),Ms.preceded(Yp,Pt),Ms.preceded(Yp,s),(function(e,t,n){return["insertExpr",["sourceExpr",e],t,["targetExpr",n]]})),_t=Ms.then(Fs([kl,Yp,uc,qp],s),Fs([Yp,nc,Yp],s),(function(e,t){return["renameExpr",["targetExpr",e],["newNameExpr",t]]})),jt=Ms.then(Ms.plus(Ms.map(Fs([Al,Yp],s),(function(e){return["switchCaseExpr",e]}))),Fs([Yp,zc,Yp],s),(function(e,t){return["switchExprCaseClause"].concat(p(e),[["resultExpr",t]])})),Xt=Ps(Fs([Gl,qp,Qs],u),Fs([qp,Js,qp],Ms.plus(Ms.followed(jt,qp))),Fs([cl,Yp,zc,Yp],s),(function(e,t,n){return["switchExpr",["argExpr",e]].concat(p(t),[["switchExprDefaultClause",["resultExpr",n]]])})),Lt=Ms.map(u,(function(e){return["queryBody",e]})),$t=Fs([ul,Yp,el,Yp],Ms.then(Jp,Ms.preceded(Gs(Ru,qp),f),(function(e,t){return["namespaceDecl",["prefix",e],["uri",t]]}))),qt=Ms.then(Fs([Fl,Yp,Nu,qp],Ms.then(ah,Ms.optional(Ms.preceded(qp,W)),(function(e,t){return[e,t]}))),Ms.or([Ms.map(Fs([qp,vu,qp],s),(function(e){return["varValue",e]})),Ms.map(Fs([Yp,Pl],Ms.optional(Fs([qp,vu,qp],s))),(function(e){return["external"].concat(p(e?[["varValue",e]]:[]))}))]),(function(e,t){var n=c(e);return e=n.next().value,n=n.next().value,["varDecl",["varName"].concat(p(e))].concat(p(null!==n?[n]:[]),[t])})),Yt=Hs(Fs([hc,Yp,Ms.peek(Ms.not(Bh,["Cannot use reserved function name"]))],ah),Fs([qp,Qs,qp],Ms.optional(ee)),Fs([qp,Js],Ms.optional(Fs([Yp,nc,Yp],H))),Ms.preceded(qp,Ms.or([Ms.map(P,(function(e){return["functionBody",e]})),Ms.map(Pl,(function(){return["externalDefinition"]}))])),(function(e,t,n,r){return["functionDecl",["functionName"].concat(p(e)),["paramList"].concat(p(t||[]))].concat(p(n?[["typeDeclaration"].concat(p(n))]:[]),[r])})),Vt=Fs([ul,Yp],Ms.then(Ms.star(Ms.followed(Ms.or([_,Lh]),Yp)),Ms.or([qt,Yt]),(function(e,t){return[t[0]].concat(p(e),p(t.slice(1)))}))),Qt=Ms.then(Fs([ul,Yp,cl,Yp],Ms.or([dc,hc])),Fs([Yp,el,Yp],f),(function(e,t){return["defaultNamespaceDecl",["defaultNamespaceCategory",e],["uri",t]]})),Jt=Ms.or([Ms.map(Ms.followed(Fs([el,Yp],Jp),Ms.preceded(qp,Ru)),(function(e){return["namespacePrefix",e]})),Ms.map(Fs([cl,Yp,dc,Yp],el),(function(){return["defaultElementNamespace"]}))]),Kt=Fs([_l,Yp,jl],Ps(Ms.optional(Ms.preceded(Yp,Jt)),Ms.preceded(qp,f),Ms.optional(Ms.then(Fs([Yp,jc,Yp],f),Ms.star(Fs([qp,Hu,qp],f)),(function(e,t){return[e].concat(p(t))}))),(function(e,t,n){return["schemaImport"].concat(p(e?[e]:[]),[["targetNamespace",t]],p(n?[n]:[]))}))),zt=Fs([_l,Yp,Xl],Ps(Ms.optional(Ms.followed(Fs([Yp,el,Yp],Jp),Ms.preceded(qp,Ru))),Ms.preceded(qp,f),Ms.optional(Ms.then(Fs([Yp,jc,Yp],f),Ms.star(Fs([qp,Hu,qp],f)),(function(e,t){return[e].concat(p(t))}))),(function(e,t){return["moduleImport",["namespacePrefix",e],["targetNamespace",t]]}))),Wt=Ms.or([Kt,zt]),Zt=Ms.map(Fs([ul,Yp,cl,Yp,Yc,Yp],f),(function(e){return["defaultCollationDecl",e]})),en=Ms.map(Fs([ul,Yp,Ll,Yp],f),(function(e){return["baseUriDecl",e]})),tn=Ms.then(Fs([ul,Yp],Ms.or([Ms.map(Fs([wl,Yp],ah),(function(e){return["decimalFormatName"].concat(p(e))})),Ms.map(Fs([cl,Yp],wl),(function(){return null}))])),Ms.star(Ms.then(Ms.preceded(Yp,Yh),Ms.preceded(Gs(Ru,Yp),f),(function(e,t){return["decimalFormatParam",["decimalFormatParamName",e],["decimalFormatParamValue",t]]}))),(function(e,t){return["decimalFormatDecl"].concat(p(e?[e]:[]),p(t))})),nn=Ms.or([Vh,Zt,en,Qh,Jh,Kh,zh,tn]),rn=Ms.then(Fs([ul,Yp,Ql,Yp],ah),Ms.preceded(Yp,f),(function(e,t){return["optionDecl",["optionName",e],["optionContents",t]]})),on=Ms.then(Fs([ul,Yp,Jl,Yp,Kl],Ms.optional(Fs([Yp,nc],z))),Ms.or([Ms.map(Ms.preceded(Gs(vu,qp),s),(function(e){return["varValue",e]})),Ms.map(Fs([Yp,Pl],Ms.optional(Ms.preceded(Gs(vu,qp),s))),(function(){return["external"]}))]),(function(e,t){return["contextItemDecl"].concat(p(e?[["contextItemType",e]]:[]),[t])})),an=Ms.then(Ms.star(Ms.followed(Ms.or([Qt,nn,$t,Wt]),Gs(xu,qp))),Ms.star(Ms.followed(Ms.or([on,Vt,rn]),Gs(xu,qp))),(function(e,t){return 0===e.length&&0===t.length?null:["prolog"].concat(p(e),p(t))})),sn=Fs([Xl,Yp,el,Yp],Ms.then(Ms.followed(Jp,Gs(Ru,qp)),Ms.followed(f,Gs(xu,qp)),(function(e,t){return["moduleDecl",["prefix",e],["uri",t]]}))),un=Ms.then(sn,Ms.preceded(qp,an),(function(e,t){return["libraryModule",e].concat(p(t?[t]:[]))})),cn=Ms.then(an,Ms.preceded(qp,Lt),(function(e,t){return["mainModule"].concat(p(e?[e]:[]),[t])})),ln=Ms.map(Fs([zl,qp],Ms.followed(Ms.or([Ms.then(Ms.preceded(Zl,Yp),f,(function(e){return["encoding",e]})),Ms.then(Fs([Wl,Yp],f),Ms.optional(Fs([Yp,Zl,Yp],f)),(function(e,t){return[["version",e]].concat(p(t?[["encoding",t]]:[]))}))]),Ms.preceded(qp,xu))),(function(e){return["versionDecl"].concat(p(e))})),pn=Ms.then(Ms.optional(Gs(ln,qp)),Ms.or([un,cn]),(function(e,t){return["module"].concat(p(e?[e]:[]),[t])})),hn=Ms.complete(Gs(pn,qp));return function(e,t){l.clear(),t=hn(e,t);for(var n=1,r=1,o=0;o<e.length+1;o++){if(l.has(o)){var a=l.get(o);a.line=r,a.la=n}"\r"===(a=e[o])||"\n"===a?(r++,n=1):n++}return t}}var uf=sf({sb:!1,Va:!1}),cf=sf({sb:!0,Va:!1}),lf=sf({sb:!1,Va:!0}),pf=sf({sb:!0,Va:!0});function hf(e,t){var n=!!t.aa;if(t=!!t.debug,Pp.clear(),Hp.clear(),af.clear(),!0===(n=n?t?pf(e,0):lf(e,0):t?cf(e,0):uf(e,0)).success)return n.value;throw Error("XPST0003: Failed to parse '"+e+"' expected: "+n.expected+"\n"+e.slice(0,n.offset)+"[Error is around here]"+e.slice(n.offset))}var ff="http://www.w3.org/XML/1998/namespace http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2005/xpath-functions http://www.w3.org/2005/xpath-functions/math http://www.w3.org/2012/xquery http://www.w3.org/2005/xpath-functions/array http://www.w3.org/2005/xpath-functions/map".split(" ");function df(e,t,n){n=void 0===n||n;var r=[],o=[];So(e,"*").forEach((function(e){switch(e[0]){case"moduleImport":case"namespaceDecl":case"defaultNamespaceDecl":case"functionDecl":case"varDecl":break;default:throw Error("Not implemented: only module imports, namespace declarations, and function declarations are implemented in XQuery modules")}}));var a=new Set;So(e,"moduleImport").forEach((function(e){var n=To(Bo(e,"namespacePrefix"));if(e=To(Bo(e,"targetNamespace")),a.has(e))throw Error('XQST0047: The namespace "'+e+'" is imported more than once.');a.add(e),xo(t,n,e),Ds(t,e)})),So(e,"namespaceDecl").forEach((function(e){var n=To(Bo(e,"prefix"));if(e=To(Bo(e,"uri")),"xml"===n||"xmlns"===n)throw po();if("http://www.w3.org/XML/1998/namespace"===e||"http://www.w3.org/2000/xmlns/"===e)throw po();xo(t,n,e)}));for(var i=null,s=null,u=c(So(e,"defaultNamespaceDecl")),l=u.next();!l.done;l=u.next()){var h=l.value;if(l=To(Bo(h,"defaultNamespaceCategory")),!(h=To(Bo(h,"uri"))))throw co();if("http://www.w3.org/XML/1998/namespace"===h||"http://www.w3.org/2000/xmlns/"===h)throw po();if("function"===l){if(i)throw lo();i=h}else if("element"===l){if(s)throw lo();s=h}}i&&(t.A=i),s&&xo(t,"",s),So(e,"functionDecl").forEach((function(e){!function(e,t,n,r,o){var a=Bo(e,"functionName"),i=Io(a,"prefix")||"",s=Io(a,"URI"),u=To(a);if(null===s&&!(s=""===i?null===t.A?"http://www.w3.org/2005/xpath-functions":t.A:t.ba(i))&&i)throw fo(i);if(ff.includes(s))throw uo();if(i=So(e,"annotation").map((function(e){return Bo(e,"annotationName")})),a=i.every((function(e){return!Io(e,"URI")&&"private"!==To(e)})),i=i.some((function(e){return!Io(e,"URI")&&"updating"===To(e)})),!s)throw co();var c=Ro(e),l=So(Bo(e,"paramList"),"param"),h=l.map((function(e){return Bo(e,"varName")})),f=l.map((function(e){return Ro(e)}));if(e=Bo(e,"functionBody")){if(t.za(s,u,f.length))throw Error("XQST0049: The function Q{"+s+"}"+u+"#"+f.length+" has already been declared.");if(!o)return;var d=Bs(e[1],{qa:!1,aa:!0}),m=new yo(t),g=h.map((function(e){var n=Io(e,"URI"),r=Io(e,"prefix");return e=To(e),r&&null===n&&(n=t.ba(r||"")),bo(m,n,e)}));o=i?{l:f,arity:h.length,m:function(e,t,n,r){for(var o=[],a=3;a<arguments.length;++a)o[a-3]=arguments[a];return a=Bt(Nt(e,-1,null,ce.empty()),g.reduce((function(e,t,n){return e[t]=le(o[n]),e}),Object.create(null))),d.u(a,t)},Bb:!1,I:!0,localName:u,namespaceURI:s,i:c}:{l:f,arity:h.length,m:function(e,t,n,r){for(var o=[],a=3;a<arguments.length;++a)o[a-3]=arguments[a];return a=Bt(Nt(e,-1,null,ce.empty()),g.reduce((function(e,t,n){return e[t]=le(o[n]),e}),Object.create(null))),ur(d,a,t)},Bb:!1,I:!1,localName:u,namespaceURI:s,i:c},n.push({da:d,Ib:m}),a&&r.push({arity:h.length,da:d,Eb:o,localName:u,namespaceURI:s})}else{if(i)throw Error("Updating external function declarations are not supported");o={l:f,arity:h.length,m:function(e,t,n,r){for(var o=[],a=3;a<arguments.length;++a)o[a-3]=arguments[a];if(!(a=n.za(s,u,h.length,!0)))throw Error("XPST0017: Function Q{"+s+"}"+u+" with arity of "+h.length+" not registered. "+eo(u));if(a.i.type!==c.type||a.l.some((function(e,t){return e.type!==f[t].type})))throw Error("External function declaration types do not match actual function");return a.m.apply(a,[e,t,n].concat(p(o)))},Bb:!0,I:!1,localName:u,namespaceURI:s,i:c}}Ao(t,s,u,h.length,o)}(e,t,r,o,n)}));var f=[];return So(e,"varDecl").forEach((function(e){var o=Oo(Bo(e,"varName")),a=o.namespaceURI;if(null===a&&(!(a=t.ba(o.prefix))&&o.prefix))throw fo(o.prefix);if(ff.includes(a))throw uo();var i,s,u=Bo(e,"external");if(e=Bo(e,"varValue"),null!==u?null!==(u=Bo(u,"varValue"))&&(i=Bo(u,"*")):null!==e&&(i=Bo(e,"*")),f.some((function(e){return e.namespaceURI===a&&e.localName===o.localName})))throw Error("XQST0049: The variable "+(a?"Q{"+a+"}":"")+o.localName+" has already been declared.");if(bo(t,a||"",o.localName),n&&(i&&(s=Bs(i,{qa:!1,aa:!0})),i&&!function(e,t,n){return(e=e.Da[mo(t,n)])?e:null}(t,a||"",o.localName))){var c=null;Eo(t,a,o.localName,(function(e,t){return c?c():(c=le(ur(s,e,t)))()})),r.push({da:s,Ib:t}),f.push({da:s,localName:o.localName,namespaceURI:a})}})),r.forEach((function(e){e.da.P(e.Ib)})),o.forEach((function(e){if(!e.Eb.I&&e.da.I)throw Kn("The function Q{"+e.namespaceURI+"}"+e.localName+" is updating but the %updating annotation is missing.")})),{Ma:o,Ua:f}}function mf(e,t,n,r,o,a,i){var s=t.aa?"XQuery":"XPath";return n=t.Ha?null:function(e,t,n,r,o,a,i,s){return(e=Ts.get(e))&&(t=e[t+(a?"_DEBUG":"")])&&(t=t.find((function(e){return e.s===i&&e.j.every((function(e){return n(e.prefix)===e.namespaceURI}))&&e.u.every((function(e){return void 0!==r[e.name]}))&&e.A.every((function(e){return o[e.prefix]===e.namespaceURI}))&&e.O.every((function(e){var t=s(e.Bc,e.arity);return t&&t.namespaceURI===e.Hb.namespaceURI&&t.localName===e.Hb.localName}))})))?{da:t.h,Fc:!1}:null}(e,s,n,r,o,t.debug,a,i),null!==n?{state:n.Fc?1:2,da:n.da}:{state:0,wc:"string"==typeof e?hf(e,t):Ss(e)}}function gf(e,t,n,r,o,a,i){var s=new oo(n,r,a,i),u=new yo(s);switch(Object.keys(o).forEach((function(e){var t=o[e];Ds(u,t),xo(u,e,t)})),"string"==typeof e&&(e=Us(e)),(n=mf(e,t,n,r,o,a,i)).state){case 2:return{ia:u,da:n.da};case 1:return n.da.P(u),Cs(e,t.aa?"XQuery":"XPath",s,o,n.da,t.debug,a),{ia:u,da:n.da};case 0:return n=function(e,t,n){var r=Bo(e,"mainModule");if(!r)throw Error("Can not execute a library module.");var o=Bo(r,"prolog");if(o){if(!t.aa)throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context");df(o,n)}return Qo(e,new na(n)),As(e=Co(r,["queryBody","*"]),t)}(n.wc,t,u),n.P(u),t.Ha||Cs(e,t.aa?"XQuery":"XPath",s,o,n,t.debug,a),{ia:u,da:n}}}function yf(e,t,n){if(1!==t.node.nodeType&&9!==t.node.nodeType)return[];var r=De(e,t).reduce((function(t,r){for(var o=(r=c(yf(e,r,n))).next();!o.done;o=r.next())t.push(o.value);return t}),[]);return n(t)&&r.unshift(t),r}function vf(e,t,n,r,o){if(!(e=o.first()))throw Error("XPDY0002: The context is absent, it needs to be present to use id function.");if(!ee(e.type,53))throw St("The context item is not a node, it needs to be node to use id function.");var a=t.h,i=r.M().reduce((function(e,t){return t.value.split(/\s+/).forEach((function(t){e[t]=!0})),e}),Object.create(null));for(t=e.value;9!==t.node.nodeType;)if(null===(t=Fe(a,t)))throw Error("FODC0001: the root node of the target node is not a document node.");return t=yf(a,t,(function(e){return 1===e.node.nodeType&&(!(!(e=Re(a,e,"id"))||!i[e])&&(i[e]=!1,!0))})),ce.create(t.map((function(e){return Xe(e)})))}function wf(e,t,n,r,o){if(!(e=o.first()))throw Error("XPDY0002: The context is absent, it needs to be present to use idref function.");if(!ee(e.type,53))throw St("The context item is not a node, it needs to be node to use idref function.");var a=t.h,i=r.M().reduce((function(e,t){return e[t.value]=!0,e}),Object.create(null));for(t=e.value;9!==t.node.nodeType;)if(null===(t=Fe(a,t)))throw Error("FODC0001: the root node of the context node is not a document node.");return t=yf(a,t,(function(e){return 1===e.node.nodeType&&(!!(e=Re(a,e,"idref"))&&e.split(/\s+/).some((function(e){return i[e]})))})),ce.create(t.map((function(e){return Xe(e)})))}function Af(e){switch(typeof e){case"object":return Array.isArray(e)?ce.o(new _e(e.map((function(e){return le(Af(e))})))):null===e?ce.empty():ce.o(new Ye(Object.keys(e).map((function(t){return{key:Y(t,1),value:le(Af(e[t]))}}))));case"number":return ce.o(Y(e,3));case"string":return ce.o(Y(e,1));case"boolean":return e?ce.ca():ce.X();default:throw Error("Unexpected type in JSON parse")}}function xf(e,t,n,r,o){var a=(e=qe(0,0,0,o,ce.o(Y("duplicates",1)))).G()?"use-first":e.first().value;return r.L((function(e){return ce.o(new Ye(e.reduce((function(e,t){return t.h.forEach((function(t){var n=e.findIndex((function(e){return $e(e.key,t.key)}));if(0<=n)switch(a){case"reject":throw Error("FOJS0003: Duplicate encountered when merging maps.");case"use-last":return void e.splice(n,1,t);case"combine":return void e.splice(n,1,{key:t.key,value:le(ce.create(e[n].value().M().concat(t.value().M())))});default:return}e.push(t)})),e}),[])))}))}function bf(e,t,n){var r=1,o=e.value;e=e.Na(!0);var a=null,i=Math.max(t-1,0);return-1!==e&&(a=Math.max(0,(null===n?e:Math.max(0,Math.min(e,n+(t-1))))-i)),ce.create({next:function(e){for(;r<t;)o.next(e),r++;return null!==n&&r>=t+n?z:(e=o.next(e),r++,e)}},a)}function Ef(e){return e.map((function(e){return ee(e.type,19)?zt(e,3):e}))}function Nf(e){if((e=Ef(e)).some((function(e){return Number.isNaN(e.value)})))return[Y(NaN,3)];if(!(e=li(e)))throw Error("FORG0006: Incompatible types to be converted to a common type");return e}function Bf(e,t,n,r,o,a){return Le([o,a],(function(e){var t=c(e);if(e=t.next().value,t=t.next().value,1/0===e.value)return ce.empty();if(-1/0===e.value)return t&&1/0===t.value?ce.empty():r;if(t){if(isNaN(t.value))return ce.empty();1/0===t.value&&(t=null)}return isNaN(e.value)?ce.empty():bf(r,Math.round(e.value),t?Math.round(t.value):null)}))}function Tf(e,t,n,r,o){if(r.G())return o;if(!(e=li(e=Ef(r.M()))))throw Error("FORG0006: Incompatible types to be converted to a common type");if(!e.every((function(e){return ee(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 ee(e.type,5)}))?ce.o(Y(t,5)):e.every((function(e){return ee(e.type,3)}))?ce.o(Y(t,3)):e.every((function(e){return ee(e.type,4)}))?ce.o(Y(t,4)):ce.o(Y(t,6))}var If=[].concat(Mr,[{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()?ce.ca():ce.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"true",l:[],i:{type:0,g:3},m:function(){return ce.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()?ce.ca():ce.X()}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"false",l:[],i:{type:0,g:3},m:function(){return ce.X()}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"last",l:[],i:{type:5,g:3},m:function(e){if(null===e.N)throw Error("XPDY0002: The fn:last() function depends on dynamic context, which is absent.");var t=!1;return ce.create({next:function(){if(t)return z;var n=e.Ga.Na();return t=!0,W(Y(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.N)throw Error("XPDY0002: The fn:position() function depends on dynamic context, which is absent.");return ce.o(Y(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 ce.o(Y(bt(e),10))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-date",l:[],i:{type:7,g:3},m:function(e){return ce.o(Y(ut(bt(e),7),7))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"current-time",l:[],i:{type:8,g:3},m:function(e){return ce.o(Y(ut(bt(e),8),8))}},{namespaceURI:"http://www.w3.org/2005/xpath-functions",localName:"implicit-timezone",l:[],i:{type:17,g:3},m:function(e){return ce.o(Y(Et(e),17))}}],Gr,$r,Yr,[{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:ce.o(Y(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:ce.o(Y(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:ce.o(Y(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:ce.o(Y(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:ce.o(Y(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:ce.o(Y(r.first().value.getSeconds(),4))}}],Qr,[{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:vf},{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 vf(e,t,0,r,ce.o(e.N))}},{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:wf},{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 wf(e,t,0,r,ce.o(e.N))}}],[{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 o=JSON.parse(r.first().value)}catch(e){throw Error("FOJS0001: parsed JSON string contains illegal JSON.")}return Af(o)}}],[{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,o){return Le([r,o],(function(e){var t=(e=c(e)).next().value,n=e.next().value;return t.h.some((function(e){return $e(e.key,n)}))?ce.ca():ce.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,o){return r.map((function(e){return new Ye([{key:e,value:le(o)}])}))}},{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,o){return Le([r,o],(function(r){var o=(r=c(r)).next().value,a=r.next().value;return It(o.h.map((function(r){return a.value.call(void 0,e,t,n,ce.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:qe},{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 Le([r],(function(e){return e=c(e).next().value,ce.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:xf},{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 xf(e,0,0,r,ce.o(new Ye([{key:Y("duplicates",1),value:function(){return ce.o(Y("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,o,a){return Le([r,o],(function(e){var t=(e=c(e)).next().value,n=e.next().value;return e=t.h.concat(),t=e.findIndex((function(e){return $e(e.key,n)})),0<=t?e.splice(t,1,{key:n,value:le(a)}):e.push({key:n,value:le(a)}),ce.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,o){return Le([r],(function(e){var t=c(e).next().value.h.concat();return o.L((function(e){return e.forEach((function(e){var n=t.findIndex((function(t){return $e(t.key,e)}));0<=n&&t.splice(n,1)})),ce.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 Y(e.h.length,5)}))}}],[{namespaceURI:"http://www.w3.org/2005/xpath-functions/math",localName:"pi",l:[],i:{type:3,g:3},m:function(){return ce.o(Y(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 Y(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 Y(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 Y(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 Y(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,o){return o.L((function(e){var t=c(e).next().value;return r.map((function(e){return 1!==Math.abs(e.value)||Number.isFinite(t.value)?Y(Math.pow(e.value,t.value),3):Y(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 Y(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 Y(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 Y(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 Y(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 Y(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 Y(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 Y(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,o){return o.L((function(e){var t=c(e).next().value;return r.map((function(e){return Y(Math.atan2(e.value,t.value),3)}))}))}}],jn,vn,[{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,o){if(e=r.first(),o=o.first(),null===e||null===o)return ce.empty();var a=e.value;return o=o.value,a>o?ce.empty():ce.create({next:function(){return W(Y(a++,5))}},o-a+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,o){return Le([r,o],(function(e){var t=c(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.G())return ce.o(Y(new ve("",null,t),23));if(!t.includes(":"))return ce.o(Y(new ve("",e,t),23));var n=c(t.split(":"));return t=n.next().value,n=n.next().value,ce.o(Y(new ve(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 Le([r],(function(e){return null===(e=c(e).next().value)?ce.empty():(e=e.value).prefix?ce.o(Y(e.prefix,24)):ce.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 Y(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 Y(e.value.namespaceURI||"",20)}))}}],[{l:[{type:59,g:2}],m:function(e,t,n,r){return r.$({empty:function(){return ce.ca()},multiple:function(){return ce.X()},o:function(){return ce.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 ce.X()},multiple:function(){return ce.ca()},o:function(){return ce.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 bf(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 bf(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,o,a){return r.G()?a:a.G()?r:(e=r.M(),0>(o=o.first().value-1)?o=0:o>e.length&&(o=e.length),t=e.slice(o),ce.create(e.slice(0,o).concat(a.M(),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,o){return e=o.first().value,!(r=r.M()).length||1>e||e>r.length||r.splice(e-1,1),ce.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 ce.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,o){return Bf(0,0,0,r,o,ce.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:Bf,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 o=Ut(r,t).M();return ce.create(o).filter((function(e,t){return o.slice(0,t).every((function(t){return!$n(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,o){return o.L((function(n){var o=c(n).next().value;return Ut(r,t).map((function(t,n){return qa("eqOp",t.type,o.type)(t,o,e)?Y(n+1,5):Y(-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,o){var a=!1,i=Vn(e,t,n,r,o);return ce.create({next:function(){if(a)return z;var e=i.next(0);return e.done?e:(a=!0,W(Y(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 o=!1;return ce.create({next:function(){if(o)return z;var e=r.Na();return o=!0,W(Y(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=li(e=Ef(r.M()))))throw Error("FORG0006: Incompatible types to be converted to a common type");if(!e.every((function(e){return ee(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 ee(e.type,5)||ee(e.type,3)}))?ce.o(Y(t,3)):e.every((function(e){return ee(e.type,4)}))?ce.o(Y(t,4)):ce.o(Y(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=Nf(r.M()),ce.o(e.reduce((function(e,t){return e.value<t.value?t:e}))))},localName:"max",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:"max",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=Nf(r.M()),ce.o(e.reduce((function(e,t){return e.value>t.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 Tf(e,t,0,r,ce.o(Y(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:Tf,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,o){if(r.G())return r;var a=o.first(),i=a.s;if(1!==i.length)throw Error("XPTY0004: signature of function passed to fn:filter is incompatible.");return r.filter((function(r){if(r=fn(i[0],ce.o(r),t,"fn:filter",!1),!(r=a.value.call(void 0,e,t,n,r)).ya()||!ee(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,o){if(r.G())return r;var a=o.first(),i=a.s;if(1!==i.length)throw Error("XPTY0004: signature of function passed to fn:for-each is incompatible.");var s,u=r.value;return ce.create({next:function(r){for(;;){if(!s){var o=u.next(0);if(o.done)return o;o=fn(i[0],ce.o(o.value),t,"fn:for-each",!1),s=a.value.call(void 0,e,t,n,o).value}if(!(o=s.next(r)).done)return o;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,o,a){if(r.G())return r;var i=a.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,o){return r=fn(s[0],r,t,"fn:fold-left",!1),o=fn(s[1],ce.o(o),t,"fn:fold-left",!1),i.value.call(void 0,e,t,n,r,o)}),o)}))},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,o,a){if(r.G())return r;var i=a.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,o){return r=fn(s[0],r,t,"fn:fold-right",!1),o=fn(s[1],ce.o(o),t,"fn:fold-right",!1),i.value.call(void 0,e,t,n,o,r)}),o)}))},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.M()).every((function(e){return ee(e.type,53)})))throw Error("Expected argument to fn:serialize to resolve to a sequence of Nodes.");return ce.o(Y(e.map((function(e){return t.j.serializeToString(Oi(e.value,t,!1))})),1))},localName:"serialize",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:1,g:3}}],On,[{l:[{type:59,g:3},{type:61,g:3}],m:function(e,t,n,r,o){var a,i;return ce.create({next:function(){if(!a){var e=function(e,t,n,r){e=e.first();var o=t.first().h.reduce((function(e,t){return e[t.key.value]=le(t.value()),e}),Object.create(null));t=o["."]?o["."]():ce.empty(),delete o["."];try{if(ee(e.type,1))var a=e.value;else{if(!ee(e.type,54))throw St("Unable to convert selector argument of type "+fe[e.type]+" to either an "+fe[1]+" or an "+fe[54]+" representing an XQueryX program while calling 'fontoxpath:evaluate'");a=e.value.node}var i=gf(a,{qa:!1,aa:!0,debug:r.debug,Ha:r.Ha},(function(e){return n.ba(e)}),Object.keys(o).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 At({N:c?t.first():null,Ja:c?0:-1,Ga:t,Ea:Object.keys(o).reduce((function(e,t){return e[u.qb(null,t)]=o[t],e}),Object.create(null))});return{Gc:s.h(l,r).value,Dc:e}}catch(t){zr(e.value,t)}}(r,o,n,t);a=e.Gc,i=e.Dc}try{return a.next(0)}catch(e){zr(i.value,e)}}})},localName:"evaluate",namespaceURI:"http://fontoxml.com/fontoxpath",i:{type:59,g:2}},{l:[],m:function(){return ce.o(Y("3.26.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,o){return Le([r,o],(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?ce.empty():(e=new we({l:r.l,arity:t.value,localName:e.value.localName,namespaceURI:e.value.namespaceURI,i:r.i,value:r.m}),ce.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 Le([r],(function(e){return(e=c(e).next().value).Pa()?ce.empty():ce.o(Y(new ve("",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 Le([r],(function(e){return e=c(e).next().value,ce.o(Y(e.A,5))}))},localName:"function-arity",namespaceURI:"http://www.w3.org/2005/xpath-functions",i:{type:5,g:3}}]);function Cf(e){this.h=e}(r=Cf.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 Sf=Symbol("IS_XPATH_VALUE_SYMBOL");function Of(e){return e&&"object"==typeof e&&"lookupNamespaceURI"in e?function(t){return e.lookupNamespaceURI(t||null)}:function(){return null}}function Rf(e){return function(t){var n=t.localName;return t.prefix?null:{namespaceURI:e,localName:n}}}function Df(e,t,n,r,o,a){var i,s,u,l,p,h,f;null==r&&(r=r||{}),o?(i=o.logger||{trace:console.log.bind(console)},s=o.documentWriter,u=o.moduleImports,l=o.namespaceResolver,p=o.functionNameResolver,h=o.nodesFactory,f=o.xmlSerializer):(i={trace:console.log.bind(console)},u={},l=null,h=null,s=null,f=null,p=void 0);var d=new Se(null===n?new Ee:n);n=u||Object.create(null),u=void 0===o.defaultFunctionNamespaceURI?"http://www.w3.org/2005/xpath-functions":o.defaultFunctionNamespaceURI;var m=gf(e,a,l||Of(t),r,n,u,p||Rf(u));for(e=t?wt(0,t):ce.empty(),t=!h&&a.aa?new lr(t):new Cf(h),s=s?new Te(s):Be,h=Object.keys(r).reduce((function(e,t){var n=r[t];return e["Q{}"+t+"[0]"]=n&&"object"==typeof n&&Sf in n?function(){return ce.create(n.Db)}:function(){return wt(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 At({N:e.first(),Ja:0,Ga:e,Ea:h}),y=new Tt(a.debug,a.Ha,d,t,s,o.currentContext,i,f);return{xb:g,zb:y,da:m.da}}function Uf(e,t){var n={},r=0,o=!1,a=null;return{next:function(){if(o)return z;for(var i={};r<e.h.length;){e:{var s=e.h[r].key.value;if(!a){i.kb=e.h[r];var u=i.kb.value().$({default:function(e){return e},multiple:function(e){return function(){throw Error("Serialization error: The value of an entry in a map is expected to be a single item or an empty sequence. Use arrays when putting multiple values in a map. The value of the key "+e.kb.key.value+" holds multiple items")}}(i)}).first();if(null===u){n[s]=null,r++;break e}a=kf(u,t)}u=a.next(0),a=null,n[s]=u.value,r++}i={kb:i.kb}}return o=!0,W(n)}}}function Mf(e,t){var n=[],r=0,o=!1,a=null;return{next:function(){if(o)return z;for(;r<e.R.length;){if(!a){var i=e.R[r]().$({default:function(e){return e},multiple:function(){throw Error("Serialization error: The value of an entry in an array is expected to be a single item or an empty sequence. Use nested arrays when putting multiple values in an array.")}}).first();if(null===i){n[r++]=null;continue}a=kf(i,t)}i=a.next(0),a=null,n[r++]=i.value}return o=!0,W(n)}}}function kf(e,t){if(ee(e.type,61))return Uf(e,t);if(ee(e.type,62))return Mf(e,t);if(ee(e.type,23)){var n=e.value;return{next:function(){return W("Q{"+(n.namespaceURI||"")+"}"+n.localName)}}}switch(e.type){case 7:case 8:case 9:case 11:case 12:case 13:case 14:case 15:var r=e.value;return{next:function(){return W(ct(r))}};case 47:case 53:case 54:case 55:case 56:case 57:case 58:var o=e.value;return{next:function(){return W(Oi(o,t,!1))}};default:return{next:function(){return W(e.value)}}}}If.forEach((function(e){to(e.namespaceURI,e.localName,e.l,e.i,e.m)}));var Gf={ANY:0,NUMBER:1,STRING:2,BOOLEAN:3,NODES:7,FIRST_NODE:9,STRINGS:10,MAP:11,ARRAY:12,NUMBERS:13,ALL_RESULTS:14,ASYNC_ITERATOR:99};function Ff(e,t,n,r){switch(n){case 3:return t.getEffectiveBooleanValue();case 2:return(t=Ut(t,r).M()).length?t.map((function(e){return zt(e,1).value})).join(" "):"";case 10:return(t=Ut(t,r).M()).length?t.map((function(e){return e.value+""})):[];case 1:return null!==(t=t.first())&&ee(t.type,2)?t.value:NaN;case 9:if(null===(t=t.first()))return null;if(!ee(t.type,53))throw Error("Expected XPath "+Jr(e)+" to resolve to Node. Got "+fe[t.type]);return Oi(t.value,r,!1);case 7:if(!(t=t.M()).every((function(e){return ee(e.type,53)})))throw Error("Expected XPath "+Jr(e)+" to resolve to a sequence of Nodes.");return t.map((function(e){return Oi(e.value,r,!1)}));case 11:if(1!==(t=t.M()).length)throw Error("Expected XPath "+Jr(e)+" to resolve to a single map.");if(!ee((t=t[0]).type,61))throw Error("Expected XPath "+Jr(e)+" to resolve to a map");return Uf(t,r).next(0).value;case 12:if(1!==(t=t.M()).length)throw Error("Expected XPath "+Jr(e)+" to resolve to a single array.");if(!ee((t=t[0]).type,62))throw Error("Expected XPath "+Jr(e)+" to resolve to an array");return Mf(t,r).next(0).value;case 13:return t.M().map((function(t){if(!ee(t.type,2))throw Error("Expected XPath "+Jr(e)+" to resolve to numbers");return t.value}));case 99:var o=t.value,a=null,i=!1,s=function(){for(;!i;){if(!a){var e=o.next(0);if(e.done){i=!0;break}a=kf(e.value,r)}return e=a.next(0),a=null,e}return Promise.resolve({done:!0,value:null})};return"asyncIterator"in Symbol?((t={})[Symbol.asyncIterator]=function(){return this},t.next=function(){return new Promise((function(e){return e(s())})).catch((function(t){zr(e,t)}))}):t={next:function(){return new Promise((function(e){return e(s())}))}},t;case 14:return t.M().map((function(e){return kf(e,r).next(0).value}));default:return(t=t.M()).every((function(e){return ee(e.type,53)&&!ee(e.type,47)}))?(t=t.map((function(e){return Oi(e.value,r,!1)})),1===t.length?t[0]:t):1===t.length?ee((t=t[0]).type,62)?Mf(t,r).next(0).value:ee(t.type,61)?Uf(t,r).next(0).value:Dt(t,r).first().value:Ut(ce.create(t),r).M().map((function(e){return e.value}))}}Gf[Gf.ANY]="ANY",Gf[Gf.NUMBER]="NUMBER",Gf[Gf.STRING]="STRING",Gf[Gf.BOOLEAN]="BOOLEAN",Gf[Gf.NODES]="NODES",Gf[Gf.FIRST_NODE]="FIRST_NODE",Gf[Gf.STRINGS]="STRINGS",Gf[Gf.MAP]="MAP",Gf[Gf.ARRAY]="ARRAY",Gf[Gf.NUMBERS]="NUMBERS",Gf[Gf.ALL_RESULTS]="ALL_RESULTS",Gf[Gf.ASYNC_ITERATOR]="ASYNC_ITERATOR";var Pf=!1,Hf=null,_f={getPerformanceSummary:function(){var e=Hf.getEntriesByType("measure").filter((function(e){return e.name.startsWith("XPath: ")}));return Array.from(e.reduce((function(e,t){var n=t.name.substring(7);return e.has(n)?((n=e.get(n)).times+=1,n.totalDuration+=t.duration):e.set(n,{xpath:n,times:1,totalDuration:t.duration,average:0}),e}),new Map).values()).map((function(e){return e.average=e.totalDuration/e.times,e})).sort((function(e,t){return t.totalDuration-e.totalDuration}))},setPerformanceImplementation:function(e){Hf=e},startProfiling:function(){if(null===Hf)throw Error("Performance API object must be set using `profiler.setPerformanceImplementation` before starting to profile");Hf.clearMarks(),Hf.clearMeasures(),Pf=!0},stopProfiling:function(){Pf=!1}},jf=0;function Xf(e,t,n,r,o,a){if(o=o||0,!e||"string"!=typeof e&&!("nodeType"in e))throw new TypeError("Failed to execute 'evaluateXPath': xpathExpression must be a string or an element depicting an XQueryX DOM tree.");a=a||{};try{var i=Df(e,t,n||null,r||{},a,{qa:"XQueryUpdate3.1"===a.language,aa:"XQuery3.1"===a.language||"XQueryUpdate3.1"===a.language,debug:!!a.debug,Ha:!!a.disableCache}),s=i.xb,u=i.zb,c=i.da}catch(t){zr(e,t)}if(c.I)throw Error("XUST0001: Updating expressions should be evaluated as updating expressions");if(3===o&&t&&"object"==typeof t&&"nodeType"in t&&(n=c.A(),t=be(t),null!==n&&!t.includes(n)))return!1;try{t=e,Pf&&("string"!=typeof t&&(t=Jr(t)),Hf.mark(t+(0===jf?"":"@"+jf)),jf++);var l=Ff(e,ur(c,s,u),o,u);return o=e,Pf&&("string"!=typeof o&&(o=Jr(o)),s=o+(0===--jf?"":"@"+jf),Hf.measure("XPath: "+o,s),Hf.clearMarks(s)),l}catch(t){zr(e,t)}}Object.assign(Xf,{Hc:14,ANY_TYPE:0,Pb:12,Qb:99,BOOLEAN_TYPE:3,Ub:9,hc:11,kc:7,oc:13,NUMBER_TYPE:1,rc:10,STRING_TYPE:2,Ic:"XPath3.1",Jc:"XQuery3.1",vc:"XQueryUpdate3.1"});var Lf={};function $f(e,t,n,r,o){return Xf(e,t,n,r,Xf.Qb,o)}function qf(e,t,n,r){var o={};return o.pendingUpdateList=e.fa.map((function(e){return e.h(r)})),o.xdmValue=Ff(t,ce.create(e.H),n,r),o}function Yf(e,t,n){switch(t.type){case 0:return[e,{type:0}];case 1:return[e,{type:1}];case 3:return[""+Yf(e+"("+(n||"contextItem")+")",t.i,n)[0],t.i];case 4:return[e,{type:4}];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.")}}function Vf(e,t,n){return{code:e,xa:t,isAstAccepted:!0,ta:n}}function Qf(e){return{isAstAccepted:!1,reason:e}}function Jf(e,t,n,r){switch(r=void 0===r?"contextItem":r,n.type){case 0:case 1:return Vf("!!"+e,{type:0},[t]);case 3:return(e=Jf(e+"("+r+")","",n.i,r)).isAstAccepted?Vf("!!"+e.code,e.xa,[t]):e;case 4:return Vf("(() => {\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(Xf,(Lf.ALL_RESULTS_TYPE=14,Lf.ANY_TYPE=0,Lf.ARRAY_TYPE=12,Lf.ASYNC_ITERATOR_TYPE=99,Lf.BOOLEAN_TYPE=3,Lf.FIRST_NODE_TYPE=9,Lf.MAP_TYPE=11,Lf.NODES_TYPE=7,Lf.NUMBERS_TYPE=13,Lf.NUMBER_TYPE=1,Lf.STRINGS_TYPE=10,Lf.STRING_TYPE=2,Lf.XPATH_3_1_LANGUAGE="XPath3.1",Lf.XQUERY_3_1_LANGUAGE="XQuery3.1",Lf.XQUERY_UPDATE_3_1_LANGUAGE="XQueryUpdate3.1",Lf));var Kf={DONE_TOKEN:z,getEffectiveBooleanValue:re,isSubtypeOf:ee,ready:W},zf={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"},Wf=Object.values(zf);function Zf(e,t,n,r,o){return e=Bo(e,n),(e=Bo(e,Wf))?(t+=n,n=c(r.yb(e,t,r)),r=n.next().value,n=n.next().value,r.isAstAccepted?0===o?[Jf(t,r.code,r.xa),null]:[Vf(t,r.xa,[r.code]),n]:[r,null]):[Qf("Unsupported: a base expression used with an operand."),null]}function ed(e,t,n){return 4===t&&(e+=".next().value"),47===n&&(e="(function () { const attr = "+e+"; return attr ? domFacade.getData(attr) : null})()"),e}function td(e,t,n,r,o){var a=Io(Bo(e,"firstOperand")[1],"type");if(e=Io(Bo(e,"secondOperand")[1],"type"),!a||!e)return Qf("Left or right type of compare are not found, annotation failed.");var i=[47,1];if(!i.includes(a.type)||!i.includes(e.type))return Qf("Unsupported types in compare: ["+fe[a.type]+", "+fe[e.type]+"]");if(!n.isAstAccepted)return n;if(!r.isAstAccepted)return r;if(!a||!e)return Qf("Operands in compare weren't annotated");if(!(i=new Map([["eqOp","==="],["neOp","!=="]])).has(t))return Qf(t+" not yet implemented");t=i.get(t),i=Yf(n.code,n.xa);var s=Yf(r.code,r.xa);return Vf("function "+o+"(contextItem) {\n\t\t\t\t"+n.ta.join("\n")+"\n\t\t\t \t"+r.ta.join("\n")+"\n\t \t \treturn "+ed(i[0],i[1].type,a.type)+" "+t+" "+ed(s[0],s[1].type,e.type)+";\n\t\t}",{type:3,i:{type:0}})}var nd={},rd=(nd.equalOp="eqOp",nd.notEqualOp="neOp",nd.lessThanOrEqualOp="leOp",nd.lessThanOp="ltOp",nd.greaterThanOrEqualOp="geOp",nd.greaterThanOp="gtOp",nd),od={"local-name":function(e,t,n){return sd(e,t,n,ad,"local-name()")},name:function(e,t,n){return sd(e,t,n,id,"name()")}};function ad(e){return"("+e+".localName || "+e+".target || '')"}function id(e){return"((("+e+".prefix || '').length !== 0 ? "+e+".prefix + ':' : '')\n\t\t+ ("+e+".localName || "+e+".target || ''))"}function sd(e,t,n,r,o){if(1===(e=Bo(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 Qf("Incorrect arg count for "+o+" function");if(o=e[1],e=(n=c(n.yb(o,"arg",n))).next().value,n.next(),n=e.isAstAccepted?Vf("arg",e.xa,[e.code]):e,"contextItemExpr"===o[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 = "+Yf(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 Vf(t,{type:3,i:{type:0}})}function ud(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function cd(e,t,n,r){var o=c(Zf(e,t,"firstOperand",n,0)),a=o.next().value;return o=o.next().value,a.isAstAccepted?(e=(n=c(Zf(e,t,"secondOperand",n,0))).next().value,n=n.next().value,e.isAstAccepted?[Vf("\n\tfunction "+t+"(contextItem) {\n\t\t"+a.ta.join("\n")+"\n\t\t"+e.ta.join("\n")+"\n\t\treturn "+a.code+" "+r+" "+e.code+";\n\t}\n\t",{type:3,i:{type:0}}),"&&"===r?la(o,n):o||n]:[e,null]):[a,null]}function ld(e){for(var t=[],n=0;n<arguments.length;++n)t[n]=arguments[n];return t.filter((function(e){return""!==e})).join(" && ")}function pd(e,t,n,r,o,a){var i=1!==n?"i"+n+" = 0;":"";return Vf("\n\t"+a+"\n\twhile ("+ld(o+n,"i"+n+" < "+o+n+".length")+") {\n\t\tconst contextItem"+n+" = "+o+n+"[i"+n+"];\n\t\tif (!("+(e=ld("contextItem"+n,e,t))+")) {\n\t\t\ti"+n+"++;\n\t\t\tcontinue;\n\t\t}\n\t\t"+r+"\n\t}\n\t"+i+"\n\t",{type:2},["let i"+n+" = 0;"])}function hd(e,t,n,r,o){return Vf("\n\t\t"+o+"\n\t\tif ("+(e=ld("i"+n+" === 0","contextItem"+n,e,t))+") {\n\t\t\t"+r+"\n\t\t}\n\t\t",{type:2},["let i"+n+" = 0;"])}var fd={tc:"textTest",Rb:"elementTest",ic:"nameTest",uc:"Wildcard"},dd=Object.values(fd);function md(e,t,n){if(null===t.namespaceURI&&"*"!==t.prefix){if(!(n=n.ba(t.prefix||"")||null)&&t.prefix)throw Error("XPST0081: The prefix "+t.prefix+" could not be resolved.");t.namespaceURI=n}n=t.prefix;var r=t.namespaceURI;t=t.localName;var o=e+".nodeType\n\t\t&& ("+e+".nodeType === /*ELEMENT_NODE*/ 1\n\t\t|| "+e+".nodeType === /*ATTRIBUTE_NODE*/ 2)";return"*"===n?"*"===t?[Vf(o,{type:0}),null]:[Vf(o+" && "+e+".localName === "+ud(t),{type:0}),"name-"+t]:[Vf((o="*"!==t?o+" && "+e+".localName === "+ud(t)+" && ":"")+"("+e+".namespaceURI || null) === (("+(n=""===n?e+".nodeType\n&& "+e+".nodeType === /*ELEMENT_NODE*/ 1 ? "+ud(r)+" : null":ud(r))+") || null)",{type:0}),"name-"+t]}function gd(e,t,n){var r=e[0];switch(r){case fd.Rb:return r=(e=Bo(e,"elementName"))&&Bo(e,"star"),null===e||r?t=[Vf(t+".nodeType === /*ELEMENT_NODE*/ 1",{type:0}),null]:t=md(t,e=Oo(Bo(e,"QName")),n),t;case fd.tc:return[Vf(t+".nodeType === /*TEXT_NODE*/ 3",{type:0}),null];case fd.ic:return md(t,Oo(e),n);case fd.uc:return Bo(e,"star")?null!==(r=Bo(e,"uri"))?t=md(t,{localName:"*",namespaceURI:To(r),prefix:""},n):(r=Bo(e,"NCName"),t="star"===Bo(e,"*")[0]?md(t,{localName:To(r),namespaceURI:null,prefix:"*"},n):md(t,{localName:"*",namespaceURI:null,prefix:To(r)},n)):t=md(t,{localName:"*",namespaceURI:null,prefix:"*"},n),t;default:return[Qf("Unsupported: the test '"+r+"'."),null]}}function yd(e,t,n){var r=e[0];switch(r){case zf.qc:r="",Bo(e,"rootExpr")&&(r="\n\t\tlet documentNode = contextItem;\n\t\twhile (documentNode.nodeType !== /*DOCUMENT_NODE*/9) {\n\t\t\tdocumentNode = domFacade.getParentNode(documentNode);\n\t\t\tif (documentNode === null) {\n\t\t\t\tthrow new Error('XPDY0050: the root node of the context node is not a document node.');\n\t\t\t}\n\t\t}\n\t\tcontextItem = documentNode;\n\t\t");var o=c(function(e,t){if(0===e.length)return[Vf("\n\t\t\tif (!hasReturned) {\n\t\t\t\thasReturned = true;\n\t\t\t\treturn ready(contextItem);\n\t\t\t}\n\t\t\t",{type:2},["let hasReturned = false;"]),null];for(var n="",r=[],o=null,a=e.length-1;0<=a;a--){var i=e[a],s=a+1,u=Bo(i,"predicates");e:{var l=t,h="",f=[];if(u){u=So(u,"*");for(var d=null,m=0;m<u.length;m++){var g="step"+s+"_predicate"+m,y=c(l.yb(u[m],g,l)),v=y.next().value;if(y=y.next().value,!v.isAstAccepted){l=[v,null];break e}if(d=la(d,y),!(g=Jf(g,"",v.xa,"contextItem"+s)).isAstAccepted){l=[g,null];break e}h=0===m?h+g.code:h+" && "+g.code,f.push(v.code)}l=[Vf(h,{type:0},f),d]}else l=[Vf("",{type:5},f),null]}if(l=(h=c(l)).next().value,f=h.next().value,!l.isAstAccepted)return[l,null];if(!(h=Bo(i,"xpathAxis")))return[Qf("Unsupported: filter expressions."),null];if(!(u=Bo(i,dd)))return[Qf("Unsupported: the test in the '"+i+"' step."),null];if(n=a===e.length-1?"i"+s+"++;\n\t\t\t\t\t return ready(contextItem"+s+");":n+"\n\t\t\t\t\t i"+s+"++;",u=(d=c(gd(u,"contextItem"+s,t))).next().value,d=d.next().value,!u.isAstAccepted)return[u,null];f=la(d,f);e:switch(u=u.code,d=l.code,h=To(h),h){case"attribute":s=[pd(u,d,s,n,"attributeNodes","\n\tlet attributeNodes"+s+";\n\tif (contextItem && contextItem"+(s-1)+".nodeType === /*ELEMENT_NODE*/ 1) {\n\t\tattributeNodes"+s+" = domFacade.getAllAttributes(contextItem"+(s-1)+" "+(f?', "'+f+'"':"")+");\n\t}\n\t"),"type-1"];break e;case"child":s=[pd(u,d,s,n,"childNodes","const childNodes"+s+" = domFacade.getChildNodes(contextItem"+(s-1)+" "+(f?', "'+f+'"':"")+");"),null];break e;case"parent":s=[hd(u,d,s,n,"\n\tconst contextItem"+s+" = domFacade.getParentNode(contextItem"+(s-1)+" "+(f?', "'+f+'"':"")+");\n\t"),null];break e;case"self":s=[hd(u,d,s,n,"const contextItem"+s+" = contextItem"+(s-1)+";"),f];break e;default:s=[Qf("Unsupported: the "+h+" axis"),null]}if(s=(n=c(s)).next().value,n=n.next().value,!s.isAstAccepted)return[s,null];if(0===a&&(o=n),r.push.apply(r,[].concat(p(s.ta),p(l.ta))),n=s.code,0<So(i,"lookup").length)return[Qf("Unsupported: lookups."),null]}return[Vf("const contextItem0 = contextItem;"+n,{type:2},r),o]}(So(e,"stepExpr"),n));return e=o.next().value,o=o.next().value,e.isAstAccepted?[Vf("\n\tfunction "+t+"(contextItem) {\n\t\t"+r+"\n\t\t"+e.ta.join("\n")+"\n\t\tconst next = () => {\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}}),o]:[e,null];case zf.Ob:return cd(e,t,n,"&&");case zf.pc:return cd(e,t,n,"||");case zf.sc:return[Vf("const "+t+" = "+(e=ud(e=Bo(e,"value")[1]||""))+";",{type:1}),null];case zf.Sb:case zf.nc:case zf.dc:case zf.cc:case zf.Yb:case zf.Xb:case zf.Tb:case zf.jc:case zf.fc:case zf.ec:case zf.Zb:case zf.Wb:case zf.ac:case zf.mc:case zf.lc:e:{var a=c(Zf(e,t,"firstOperand",n));if(o=a.next().value,a.next(),o.isAstAccepted)if(n=(a=c(Zf(e,t,"secondOperand",n))).next().value,a.next(),n.isAstAccepted)switch(r){case"eqOp":case"neOp":case"ltOp":case"leOp":case"gtOp":case"geOp":case"isOp":t=td(e,r,o,n,t);break e;case"equalOp":case"notEqualOp":case"lessThanOrEqualOp":case"lessThanOp":case"greaterThanOrEqualOp":case"greaterThanOp":a=Io(e,"type");var i=Io(e,"type");t=a&&i?3===a.g&&3===i.g?td(e,rd[r],o,n,t):Qf("generalCompare with sequences is still in development"):Qf("types of compare are not known");break e;default:t=Qf("Unsupported compare type")}else t=n;else t=o}return[t,null];case zf.Vb:return r=To(Bo(e,"functionName")),[void 0!==od[r]?od[r](e,t,n):Qf("Unsupported function: "+r),null];default:return[Qf("Unsupported: the base expression '"+r+"'."),null]}}function vd(e,t,n){var r=Bo(e,"mainModule");if(!r)return Qf("Unsupported: Can not execute a library module.");if(Bo(r,"prolog"))return Qf("Unsupported: XQuery.");r=Co(r,["queryBody","*"]),n.yb=yd;var o=c(yd(r,"compiledXPathExpression",n));return n=o.next().value,o.next(),!1===n.isAstAccepted?n:(o=n.ta?n.ta.join("\n"):"",r=Io(r,"type"),t=function(e,t,n){switch(e){case 9:if(e=(n=c(Yf("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 Vf("\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(Yf("compiledXPathExpression",t))).next().value,4!==n.next().value.type?Qf("Return type was not an iterator"):Vf("\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=Jf("compiledXPathExpression","",t)).isAstAccepted?Vf("return "+n.code+";",{type:2}):n;case 2:return n=void 0===n?Qf("Full AST wasn't annotated so we cannot correctly emit a string return"):ee(n,1)||ee(n,47)?Vf("return "+ed(e=(t=c(Yf("compiledXPathExpression",t))).next().value,(t=t.next().value).type,n)+" || '';",{type:2}):Qf("Not implemented: returning anything but strings and attributes from codegen");default:return Qf("Unsupported: the return type '"+e+"'.")}}(t,n.xa,r?r.type:void 0),!1===t.isAstAccepted?t:(t=o+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;",wd(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}))}function wd(e){var t=So(e,"*");if("pathExpr"===e[0])return!0;for(t=(e=c(t)).next();!t.done;t=e.next())if(wd(t.value))return!0;return!1}var Ad={},xd=(Ad["http://www.w3.org/2005/XQueryX"]="xqx",Ad["http://www.w3.org/2007/xquery-update-10"]="xquf",Ad["http://fontoxml.com/fontoxpath"]="x",Ad);function bd(e,t,n,r,o){if("string"==typeof n)return 0===n.length?null:t.createTextNode(n);if(!Array.isArray(n))throw new TypeError("JsonML element should be an array or string");var a=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"}}}(n[0],r);r=a.rb,a=t.createElementNS(r,xd[r]+":"+a.localName);var i=n[1],s=1;if("object"==typeof i&&!Array.isArray(i)){if(null!==i)for(var u=(s=c(Object.keys(i))).next();!u.done;u=s.next()){var l=i[u=u.value];null!==l&&("type"===u?void 0!==l&&e.setAttributeNS(a,r,"fontoxpath:"+u,me(l)):o&&"prefix"===u&&""===l||e.setAttributeNS(a,r,xd[r]+":"+u,l))}s=2}for(i=s,s=n.length;i<s;++i)null!==(u=bd(e,t,n[i],r,o))&&e.insertBefore(a,u,null);return a}function Ed(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.map((function(e){return e.startsWith(" ")||e.startsWith("\t")?e:" "+e})),r=r.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 Nd(e,t,n){return 0===t.g?e.G()?null:kf(e.first(),n).next(0).value:2===t.g||1===t.g?e.M().map((function(e){if(ee(e.type,47))throw Error("Cannot pass attribute nodes to custom functions");return kf(e,n).next(0).value})):kf(e.first(),n).next(0).value}y(Ed,Error);var Bd=new Map;function Td(e){var t;e:{if(t=Ts.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(Bd.has(e))return Bd.get(e);if(null===(t=Co(t="string"==typeof e?hf(e,{aa:!1}):Ss(e),["mainModule","queryBody","*"])))throw Error("Library modules do not have a specificity");return t=Bs(t,{qa:!1,aa:!1}),Bd.set(e,t),t}var Id=new Ee;return void 0!==n&&(n.compareSpecificity=function(e,t){return br(Td(e).s,Td(t).s)},n.compileXPathToJavaScript=function(e,t,n){n=n||{},t=t||0,"string"==typeof e?e=hf(e=Us(e),{aa:"XQuery3.1"===n.language||"XQueryUpdate3.1"===n.language,debug:!1}):e=Ss(e);var r=Bo(e,"mainModule");return r?Bo(r,"prolog")?Qf("Unsupported: XQuery Prologs are not supported."):(Qo(e,n=new na(new yo(new oo((r={ba:n.namespaceResolver||Of(null)}).ba,{},void 0===n.defaultFunctionNamespaceURI?"http://www.w3.org/2005/xpath-functions":n.defaultFunctionNamespaceURI,n.functionNameResolver||Rf("http://www.w3.org/2005/xpath-functions"))))),vd(e,t,r)):Qf("Unsupported: XQuery Library modules are not supported.")},n.domFacade=Id,n.evaluateXPath=Xf,n.evaluateXPathToArray=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.Pb,o)},n.evaluateXPathToAsyncIterator=$f,n.evaluateXPathToBoolean=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.BOOLEAN_TYPE,o)},n.evaluateXPathToFirstNode=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.Ub,o)},n.evaluateXPathToMap=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.hc,o)},n.evaluateXPathToNodes=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.kc,o)},n.evaluateXPathToNumber=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.NUMBER_TYPE,o)},n.evaluateXPathToNumbers=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.oc,o)},n.evaluateXPathToString=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.STRING_TYPE,o)},n.evaluateXPathToStrings=function(e,t,n,r,o){return Xf(e,t,n,r,Xf.rc,o)},n.evaluateUpdatingExpression=function(e,t,n,r,o){var a,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,o){!function e(a){a.done?r(a.value):Promise.resolve(a.value).then(t,n).then(e,o)}(e.next())}))}(new N(new x((function(m){switch(m.h){case 1:o=o||{};try{u=Df(e,t,n||null,r||{},o||{},{qa:!0,aa:!0,debug:!!o.debug,Ha:!!o.disableCache}),a=u.xb,i=u.zb,s=u.da}catch(t){zr(e,t)}if(s.I){m.h=2;break}c=[];var g=(l=$f(e,t,n,r,Object.assign(Object.assign({},o),{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(a,i),f=d.next(0)}catch(t){zr(e,t)}return m.return(qf(f.value,e,o.returnType,i))}}))))},n.evaluateUpdatingExpressionSync=function(e,t,n,r,o){o=o||{};try{var a=Df(e,t,n||null,r||{},o||{},{qa:!0,aa:!0,debug:!!o.debug,Ha:!!o.disableCache}),i=a.xb,s=a.zb,u=a.da}catch(t){zr(e,t)}if(!u.I)return i={},(s={}).pendingUpdateList=[],s.xdmValue=Xf(e,t,n,r,o.i,Object.assign(Object.assign({},o),(i.language=Xf.vc,i))),s;try{var c=u.u(i,s).next(0)}catch(t){zr(e,t)}return qf(c.value,e,o.returnType,s)},n.executeJavaScriptCompiledXPath=function(e,t,n){return n=n||new Ee,e()(t,n,Kf)},n.executePendingUpdateList=function(e,t,n,r){t=new Se(t||new Ee),r=r?new Te(r):Be,n=n?n=new Cf(n):null,fr(e=e.map(os),t,n,r)},n.getBucketForSelector=function(e){return Td(e).A()},n.getBucketsForNode=be,n.precompileXPath=function(e){return Promise.resolve(e)},n.registerXQueryModule=function(e,t){if(Vo(t=hf(e,{aa:!0,debug:(t=void 0===t?{debug:!1}:t).debug}),new na(void 0)),!(t=Bo(t,"libraryModule")))throw Error("XQuery module must be declared in a library module.");var n=Bo(t,"moduleDecl"),r=Bo(n,"uri"),o=To(r);if(r=To(n=Bo(n,"prefix")),xo(n=new yo(new oo((function(){return null}),Object.create(null),"http://www.w3.org/2005/xpath-functions",Rf("http://www.w3.org/2005/xpath-functions"))),r,o),null!==(t=Bo(t,"prolog"))){try{var a=df(t,n)}catch(t){zr(e,t)}a.Ma.forEach((function(e){if(o!==e.namespaceURI)throw Error("XQST0048: Functions and variables declared in a module must reside in the module target namespace.")})),Rs(o,a)}else Rs(o,{Ma:[],Ua:[]});return o},n.registerCustomXPathFunction=function(e,t,n,r){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=ro[e];if(!n){if(n="generated_namespace_uri_"+e,ro[e])throw Error("Prefix already registered: Do not register the same prefix twice.");ro[e]=n}return{localName:t,namespaceURI:n}}(e);var o=e.namespaceURI,a=e.localName;if(!o)throw co();var i=t.map((function(e){return ye(e)})),s=ye(n);to(o,a,i,s,(function(e,t,n){var u=Array.from(arguments);u.splice(0,3),u=u.map((function(e,n){return Nd(e,i[n],t)}));var c={};c.currentContext=t.u,c.domFacade=t.h.h;try{var l=r.apply(void 0,[c].concat(p(u)))}catch(e){throw new Ed(e,a,o)}return l&&"object"==typeof l&&Object.getOwnPropertySymbols(l).includes(Sf)?ce.create(l.Db):wt(t.h,l,s)}))},n.parseScript=function(e,t,n,r){r=void 0===r?Be:r;var o=hf(e=Us(e),{aa:"XQuery3.1"===t.language||"XQueryUpdate3.1"===t.language,debug:t.debug}),a=new oo(t.namespaceResolver||function(){return null},{},void 0===t.defaultFunctionNamespaceURI?"http://www.w3.org/2005/xpath-functions":t.defaultFunctionNamespaceURI,t.functionNameResolver||function(){return null});a=new yo(a);var i=Bo(o,["mainModule","libraryModule"]),s=Bo(i,"moduleDecl");return s&&xo(a,To(Bo(s,"prefix")),s=To(Bo(s,"uri"))),(i=Bo(i,"prolog"))&&df(i,a,!1),!1!==t.annotateAst&&Vo(o,new na(a)),a=new Ee,t=bd(r,n,o,null,!1===t.Kc),r.insertBefore(t,n.createComment(e),a.getFirstChild(t)),t},n.profiler=_f,n.createTypedValueFactory=function(e){return function(t,n){return t=vt(new Se(null===n?new Ee:n),t,ye(e)),(n={})[Sf]=!0,n.Db=t,n}},n.Language={XPATH_3_1_LANGUAGE:"XPath3.1",XQUERY_3_1_LANGUAGE:"XQuery3.1",XQUERY_UPDATE_3_1_LANGUAGE:"XQueryUpdate3.1"},n.ReturnType=Gf),n}.call("undefined"==typeof window?void 0:window,be,_e);je.compareSpecificity,je.compileXPathToJavaScript,je.createTypedValueFactory,je.domFacade,je.evaluateUpdatingExpression,je.evaluateUpdatingExpressionSync;const Xe=je.evaluateXPath;je.evaluateXPathToArray,je.evaluateXPathToAsyncIterator;const Le=je.evaluateXPathToBoolean,$e=je.evaluateXPathToFirstNode;je.evaluateXPathToMap;const qe=je.evaluateXPathToNodes,Ye=je.evaluateXPathToNumber;je.evaluateXPathToNumbers;const Ve=je.evaluateXPathToString,Qe=je.evaluateXPathToStrings;je.executeJavaScriptCompiledXPath,je.executePendingUpdateList,je.getBucketForSelector;const Je=je.getBucketsForNode;je.Language;const Ke=je.parseScript;je.precompileXPath,je.profiler;const ze=je.registerCustomXPathFunction,We=je.registerXQueryModule;je.ReturnType;class Ze{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||Je(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||Je(n).includes(t))return this._onNodeTouched(n),n;return null}getLastChild(e,t){const n=e.getChildNodes().filter((e=>!t||Je(e).includes(t))),r=n[n.length-1];return r||null}getNextSibling(e,t){for(let n=e.nextSibling;n;n=n.nextSibling)if(Je(n).includes(t))return this._onNodeTouched(n),n;return null}getParentNode(e){return e.parentNode}getPreviousSibling(e,t){for(let{previousSibling:n}=e;n;n=n.previousSibling)if(Je(n).includes(t))return n;return null}}class et{static getParentBindingElement(e){return e.parentNode&&e.parentNode.nodeType!==Node.DOCUMENT_NODE?e.parentNode.hasAttribute("ref")?e.parentNode:et.getParentBindingElement(e.parentNode):null}static isAbsolutePath(e){return null!=e&&(e.startsWith("/")||e.startsWith("instance("))}static isSelfReference(e){return"."===e||"./text()"===e||"text()"===e||""===e||null===e}static getDefaultInstance(e){const t=et.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 et.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=Ve("path()",e);return et.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 tt(e,t,n,r){const o={};return function(a){if(o[a])return;const i={},s=[],u=[];for(u.push({node:a,processed:!1});u.length>0;){const a=u[u.length-1],{processed:c}=a,{node:l}=a;if(c)u.pop(),s.pop(),i[l]=!1,o[l]=!0,t&&0!==e[l].length||n.push(l);else{if(o[l]){u.pop();continue}if(i[l]){if(r){u.pop();continue}throw s.push(l),window.dispatchEvent(new CustomEvent("compute-exception",{composed:!1,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});a.processed=!0}}}}function nt(e){this.nodes={},this.outgoingEdges={},this.incomingEdges={},this.circular=e&&!!e.circular}nt.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 nt;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=[];tt(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=[];tt(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=tt(this.outgoingEdges,!1,[],this.circular);r.forEach((t=>{e(t)}))}const o=tt(this.outgoingEdges,e,n,this.circular);return r.filter((e=>0===t.incomingEdges[e].length)).forEach((e=>{o(e)})),this.circular&&r.filter((e=>-1===n.indexOf(e))).forEach((e=>o(e))),n}},nt.prototype.directDependentsOf=nt.prototype.directDependantsOf,nt.prototype.dependentsOf=nt.prototype.dependantsOf;class rt{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=[],t="0123456789abcdef";for(let n=0;n<36;n+=1)e[n]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.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 rt.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){return rt.UI_ELEMENTS.includes(e),rt.UI_ELEMENTS.includes(e)}static async refreshChildren(e,t){return new Promise((n=>{const{children:r}=e;r&&Array.from(r).forEach((e=>{"FX-FORE"===e.nodeName.toUpperCase()&&n("done"),rt.isUiElement(e.nodeName)&&"function"==typeof e.refresh?e.refresh():"FX-MODEL"!==e.nodeName.toUpperCase()&&rt.refreshChildren(e,t)})),n("done")}))}static getClosest(e,t){for(;!t.matches(e);){if(t.matches("fx-fore"))return null;if(!(t=t.parentNode))return null}return 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,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:!1,bubbles:!0,detail:n});console.log("dispatching",r),e.dispatchEvent(r)}static prettifyXml(e){const t=(new DOMParser).parseFromString(e,"application/xml"),n=(new DOMParser).parseFromString(['<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">',' <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>',' <xsl:strip-space elements="*"/>',' <xsl:template match="text()">',' <xsl:value-of select="normalize-space(.)"/>'," </xsl:template>",' <xsl:template match="node()|@*">'," <xsl:copy>",' <xsl:apply-templates select="node()|@*"/>'," </xsl:copy>"," </xsl:template>","</xsl:stylesheet>"].join("\n"),"application/xml"),r=new XSLTProcessor;r.importStylesheet(n);const o=r.transformToDocument(t);return(new XMLSerializer).serializeToString(o)}static formatXml(e){for(var t=(e=e.replace(/(>)(<)(\/*)/g,"$1\n$2$3").replace(/ *(.*) +\n/g,"$1\n").replace(/(<.+>)(.+\n)/g,"$1\n$2")).split("\n"),n=0;n<t.length;n++){var r=t[n];Boolean(r.match(/<.+\/>/)),Boolean(r.match(/<\/.+>/)),Boolean(r.match(/<[^!].*>/))}}static async loadForeFromUrl(e,t){console.log("########## loading Fore from ",this.src,"##########"),await fetch(t,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":"text/html"}}).then((e=>{const t=e.headers.get("content-type").toLowerCase();return console.log("********** responseContentType *********",t),t.startsWith("text/html")?e.text().then((e=>(new DOMParser).parseFromString(e,"text/html"))):"done"})).then((t=>{const n=t.querySelector("fx-fore");n||e.dispatchEvent(new CustomEvent("error",{composed:!1,bubbles:!0,detail:{message:"cyclic graph"}})),e.appendChild(n),n.classList.add("widget")})).catch((n=>{e.dispatchEvent(new CustomEvent("error",{composed:!1,bubbles:!0,detail:{error:n,message:`'${t}' not found or does not contain Fore element.`}}))}))}}rt.READONLY_DEFAULT=!1,rt.REQUIRED_DEFAULT=!1,rt.RELEVANT_DEFAULT=!0,rt.CONSTRAINT_DEFAULT=!0,rt.TYPE_DEFAULT="xs:string";const ot="http://www.w3.org/2002/xforms",at=new Map,it=[];function st(e,t,n){return at.has(e)?at.get(e).set(t,n):at.set(e,new Map)}const ut=e=>{if(!e)return"http://www.w3.org/1999/xhtml"};function ct(e,t,n=null){const r=qe("outermost(ancestor-or-self::fx-fore[1]/(descendant::fx-fore|descendant::*[@id = $id]))[not(self::fx-fore)]",t,null,{id:e},{namespaceResolver:ut});if(0===r.length)return null;if(1===r.length&&Le("(ancestor::fx-fore | ancestor::fx-repeat)[last()]/self::fx-fore",r[0],null,null,{namespaceResolver:ut})){const e=r[0];return n&&e.localName!==n?null:e}for(const e of qe("ancestor::fx-repeatitem => reverse()",t,null,null,{namespaceResolver:ut})){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=>qe("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 lt=(new DOMParser).parseFromString("<xml />","text/xml");function pt(e,t){const n=(r=e,o=t,at.has(r)&&at.get(r).get(o)||null);var r,o;if(n)return n;const a=Ke(e,{},lt);let i=Qe('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',a,null,{},{namespaceResolver:e=>"xqx"===e?"http://www.w3.org/2005/XQueryX":void 0});if(0===i.length){const n=$e("ancestor::*[@ref][1]",t);if(n){const r=pt(n.getAttribute("ref"),n);return st(e,t,r),r}i=["default"]}if(1===i.length){let n;if("default"===i[0]){const e=$e("ancestor-or-self::fx-fore[1]",t,null,null,{namespaceResolver:ut});n=e&&e.querySelector("fx-instance")}else n=ct(i[0],t,"fx-instance");if(n&&n.hasAttribute("xpath-default-namespace")){const r=n.getAttribute("xpath-default-namespace"),o=e=>{if(!e)return r};return st(e,t,o),o}}i.length>1&&console.warn(`More than one instance is used in the query "${e}". The default namespace resolving will be used`);const s=Ve("ancestor-or-self::*/@xpath-default-namespace[last()]",t)||"",u=function(e){return""===e?s:Ve('ancestor-or-self::*/@*[name() = "xmlns:" || $prefix][last()]',t,null,{prefix:e})};return st(e,t,u),u}function ht(e,t,n){return(t&&t.ownerDocument||t)===window.document?ut:pt(e,n)}function ft({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"parse":case"logtree":return{namespaceURI:ot,localName:t};default:return""===e&&it.includes(t)?{namespaceURI:"http://www.w3.org/2005/xquery-local-functions",localName:t}:"fn"===e||""===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 dt(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);r&&(n[e]=r.value)}return n}function mt(e,t,n,r={},o={}){const a=ht(e,t,n),i=dt(n);return Xe(e,t,null,{...i,...r},Xe.ALL_RESULTS_TYPE,{currentContext:{formElement:n,variables:r},moduleImports:{xf:ot},functionNameResolver:ft,namespaceResolver:a,language:o.language||mt.XPATH_3_1})}function gt(e,t,n){const r=ht(e,t,n),o=dt(n);return $e(e,t,null,o,{defaultFunctionNamespaceURI:ot,moduleImports:{xf:ot},currentContext:{formElement:n},functionNameResolver:ft,namespaceResolver:r})}function yt(e,t,n){const r=ht(e,t,n),o=dt(n);return qe(e,t,null,o,{currentContext:{formElement:n},functionNameResolver:ft,moduleImports:{xf:ot},namespaceResolver:r})}function vt(e,t,n){const r=ht(e,t,n),o=dt(n);return Le(e,t,null,o,{currentContext:{formElement:n},functionNameResolver:ft,moduleImports:{xf:ot},namespaceResolver:r})}function wt(e,t,n,r=null,o=n){const a=ht(e,t,n),i=dt(n);return Ve(e,t,r,i,{currentContext:{formElement:n},functionNameResolver:ft,moduleImports:{xf:ot},namespaceResolver:a})}function At(e,t,n,r=null,o=n){const a=ht(e,t,n),i=dt(n);return Ye(e,t,r,i,{currentContext:{formElement:n},functionNameResolver:ft,moduleImports:{xf:ot},namespaceResolver:a})}const xt=(e,t)=>{const n=e.currentContext.formElement;if(t){const e=ct(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=et.getParentBindingElement(n);return r?r.nodeset:n.getInScopeContext()};function bt(e,t){if(t&&t.nodeType===Node.ELEMENT_NODE&&t.children){const n=document.createElement("details");n.setAttribute("data-path",t.nodeName);const r=document.createElement("summary");let o,a=` <${t.nodeName}`;Array.from(t.attributes).forEach((e=>{a+=` ${e.nodeName}="${e.nodeValue}"`})),t.firstChild&&t.firstChild.nodeType===Node.TEXT_NODE&&""!==t.firstChild.data.trim()?(o=t.firstChild.nodeValue,a+=`>${o}</${t.nodeName}>`):a+=">",r.textContent=a,n.appendChild(r),0!==t.childElementCount?n.setAttribute("open","open"):r.setAttribute("style","list-style:none;"),e.appendChild(n),Array.from(t.children).forEach((e=>{bt(n,e)}))}}ze({namespaceURI:ot,localName:"context"},[],"item()?",xt),ze({namespaceURI:ot,localName:"context"},["xs:string"],"item()?",xt),ze({namespaceURI:ot,localName:"current"},["xs:string"],"item()?",((e,t)=>(e.currentContext.formElement,null))),ze({namespaceURI:ot,localName:"log"},["xs:string?"],"xs:string?",((e,t)=>{const{formElement:n}=e.currentContext,r=ct(t,n,"fx-instance");if(r){if("json"!==r.getAttribute("type")){const e=(new XMLSerializer).serializeToString(r.getDefaultContext());return rt.prettifyXml(e)}console.warn("log() does not work for JSON yet")}return null})),ze({namespaceURI:ot,localName:"parse"},["xs:string?"],"element()?",((e,t)=>{const n=(new DOMParser).parseFromString(t,"application/xml");return console.log("parse",n),n.firstElementChild})),ze({namespaceURI:ot,localName:"logtree"},["xs:string?"],"element()?",((e,t)=>{const{formElement:n}=e.currentContext,r=ct(t,n,"fx-instance");if(r){const t=document.createElement("div");t.setAttribute("class","logtree");const n=e.currentContext.formElement,o=n.querySelector(".logtree");o&&o.parentNode.removeChild(o);const a=bt(t,r.getDefaultContext());a&&n.appendChild(a)}return null}));const Et=(e,t)=>{const n=$e("ancestor-or-self::fx-fore[1]",e.currentContext.formElement,null,null,{namespaceResolver:ut}),r=t?ct(t,n,"fx-instance"):n.querySelector("fx-instance");if(r){return r.getDefaultContext()}return null};ze({namespaceURI:ot,localName:"index"},["xs:string?"],"xs:integer?",((e,t)=>{const{formElement:n}=e.currentContext;if(null===t)return 1;const r=ct(t,n,"fx-repeat");return r?r.getAttribute("index"):Number(1)})),ze({namespaceURI:ot,localName:"instance"},[],"item()?",(e=>Et(e,null))),ze({namespaceURI:ot,localName:"instance"},["xs:string?"],"item()?",Et),ze({namespaceURI:ot,localName:"depends"},["node()*"],"item()?",((e,t)=>t[0])),ze({namespaceURI:ot,localName:"event"},["xs:string?"],"item()?",((e,t)=>{if(!t)return[];if(e.currentContext.variables){const n=e.currentContext.variables[t];if(n.nodeType&&console.log("got some node as js object"),n)return e.currentContext.variables[t]}return e.currentContext.formElement.inScopeVariables?(console.log("event()",e.currentContext.formElement.inScopeVariables),console.log("event()",e.currentContext.formElement.inScopeVariables.get(t)),e.currentContext.formElement.inScopeVariables.get(t)):[]})),We(`\n module namespace xf="${ot}";\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`),ze({namespaceURI:ot,localName:"base64encode"},["xs:string?"],"xs:string?",((e,t)=>btoa(t)));class Nt 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 <style>\n \n :host {\n display: none;\n }\n :host * {\n display:none;\n }\n ::slotted(*){\n display:none;\n }\n \n </style>\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 gt(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("<data></data>","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("<data></data>","application/xml");this.instanceData=e}"json"===this.type&&(this.instanceData={})}async _loadData(){const e=`${this.src}`,t=rt.getContentType(this,"get");await fetch(e,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":t}}).then((e=>{const{status:t}=e;if(t>=400)throw console.log("response status",t),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 console.log("********** responseContentType *********",n),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=>{if(e.nodeType)return this.instanceData=e,void console.log("instanceData loaded: ",this.instanceData);this.instanceData=e})).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):"html"===this.type?this.instanceData=this.firstElementChild.children:"text"===this.type?this.instanceData=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.get("fx-instance")||customElements.define("fx-instance",Nt);class Bt{constructor(e,t,n,r,o,a,i,s,u){this.path=e,this.ref=t,this.constraint=a,this.readonly=n,this.relevant=r,this.required=o,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){console.log("modelitem.setvalue oldVal",this.value),console.log("modelitem.setvalue newVal",e),e.nodeType===Node.DOCUMENT_NODE?this.node.replaceWith(e.firstElementChild):e.nodeType===Node.ELEMENT_NODE?this.node.replaceWith(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 Tt 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 <slot></slot>\n ",this.addEventListener("model-construct-done",(()=>{this.modelConstructed=!0}),{once:!0}),this.skipUpdate=!1}static lazyCreateModelItem(e,t,n){let r,o={};if(null==n)return null;o=n.nodeType===n.TEXT_NODE?n.parentNode:n,n.nodeType?r=et.getPath(n):(r=null,o=n);const a=new Bt(r,t,rt.READONLY_DEFAULT,rt.RELEVANT_DEFAULT,rt.REQUIRED_DEFAULT,rt.CONSTRAINT_DEFAULT,rt.TYPE_DEFAULT,o,this);return e.registerModelItem(a),a}modelConstruct(){this.dispatchEvent(new CustomEvent("model-construct",{composed:!1,bubbles:!0,detail:{model:this}})),console.time("instance-loading");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),this.updateModel(),this.inited=!0,this.dispatchEvent(new CustomEvent("model-construct-done",{composed:!1,bubbles:!0,detail:{model:this}}))})),console.groupEnd()}else this.dispatchEvent(new CustomEvent("model-construct-done",{composed:!1,bubbles:!0,detail:{model:this}}));console.timeEnd("instance-loading"),this.inited=!0}registerModelItem(e){this.modelItems.push(e)}updateModel(){this.rebuild(),this.skipUpdate||(this.recalculate(),this.revalidate())}rebuild(){console.group("### rebuild"),console.time("rebuild"),this.mainGraph=new nt(!1),this.modelItems=[];const e=this.querySelectorAll("fx-model > fx-bind");0!==e.length?(e.forEach((e=>{e.init(this)})),console.log("rebuild mainGraph",this.mainGraph),console.log("rebuild mainGraph calc order",this.mainGraph.overallOrder()),this.dispatchEvent(new CustomEvent("rebuild-done",{detail:{maingraph:this.mainGraph}})),console.groupEnd()):this.skipUpdate=!0}recalculate(){if(this.mainGraph){if(console.group("### recalculate"),console.log("changed nodes ",this.changed),console.time("recalculate"),this.computes=0,this.subgraph=new nt(!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=[],console.log("subgraph",this.subgraph),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)}))}console.log(`recalculated ${this.computes} modelItems`),console.timeEnd("recalculate"),console.log("recalculate finished with modelItems ",this.modelItems),console.groupEnd()}}compute(e,t){const n=this.getModelItem(e);if(n&&t.includes(":")){const e=t.split(":")[1];if(e)if("calculate"===e){const t=mt(n.bind[e],n.node,this);n.value=t,n.readonly=!0}else if("constraint"!==e&&"type"!==e){const r=n.bind[e];if(r){const o=vt(r,n.node,this);n[e]=o,console.log(`recalculating path ${t} - Expr:'${r}' computed`,n[e])}}this.computes+=1}}revalidate(){if(0===this.modelItems.length)return!0;console.group("### revalidate"),console.time("revalidate");let e=!0;return this.modelItems.forEach((t=>{const{bind:n}=t;if(n){if("function"==typeof n.hasAttribute&&n.hasAttribute("constraint")){const r=n.getAttribute("constraint");if(r){const o=vt(r,t.node,this);if(console.log("modelItem validity computed: ",o),t.constraint=o,this.formElement.addToRefresh(t),o||(e=!1),!this.modelConstructed){const e=n.getAlert();e&&t.addAlert(e)}}}if("function"==typeof n.hasAttribute&&n.hasAttribute("required")){const r=n.getAttribute("required");if(r){const n=vt(r,t.node,this);console.log("modelItem required computed: ",n),t.required=n,this.formElement.addToRefresh(t),t.node.textContent||(e=!1)}}}})),console.timeEnd("revalidate"),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 It(e){return e.closest("fx-fore")}function Ct(e,t){const n=rt.getClosest("[ref]",e),r=rt.getClosest("fx-fore",e),o=function(e){return It(e).getModel()}(e);if(null!==n){return r===n.closest("fx-fore")?n.nodeset:o.getDefaultInstance().getDefaultContext()}if(et.isAbsolutePath(t)){const e=et.getInstanceId(t);return e?o.getInstance(e).getDefaultContext():o.getDefaultInstance().getDefaultContext()}return null!==o.getDefaultInstance()&&o.inited?o.getDefaultInstance().getDefaultContext():[]}function St(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=rt.getClosest("fx-repeatitem",n);if(r)return"context"===e.nodeName?gt(e.nodeValue,r.nodeset,It(n)):r.nodeset;if(n.hasAttribute("context")){const e=Ct(n.parentNode,t);return gt(n.getAttribute("context"),e,It(n))}if(e.nodeType===Node.ATTRIBUTE_NODE&&"context"===e.nodeName){const r=Ct(e.ownerElement.parentNode,t);return gt(e.ownerElement.getAttribute("context"),r,It(n))}if(e.nodeType===Node.ATTRIBUTE_NODE&&"ref"===e.nodeName){if(e.ownerElement.hasAttribute("context")){const r=Ct(e.ownerElement.parentNode,t);return gt(e.ownerElement.getAttribute("context"),r,It(n))}return Ct(n.parentNode,t)}return Ct(n,t)}customElements.get("fx-model")||customElements.define("fx-model",Tt);const Ot=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=new Map}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=St(this.getAttributeNode("context")||this,this.context)),this.hasAttribute("ref")&&(e=St(this.getAttributeNode("ref")||this,this.ref)),e||0===this.getModel().instances.length||(e=this.getModel().getDefaultInstance().getDefaultContext()),""===this.ref)this.nodeset=e;else if(Array.isArray(e))this.nodeset=gt(this.ref,e[0],this);else{const{nodeType:t}=e;t?this.nodeset=gt(this.ref,e,this):[this.nodeset]=mt(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=rt.getClosest("[ref]",this.parentNode);return e?e.getAttribute("ref"):"instance()"}getInstance(){if(this.ref.startsWith("instance(")){const e=et.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);const t=rt.getClosest("fx-repeatitem",this);let n;if(t){const{index:e}=t;n=Array.isArray(this.nodeset)?this.getModel().getModelItem(this.nodeset[e-1]):this.getModel().getModelItem(this.nodeset)}else n=this.getModel().getModelItem(this.nodeset);return n||Tt.lazyCreateModelItem(this.getModel(),this.ref,this.nodeset)}getValue(){if(this.hasAttribute("value")){const e=this.getAttribute("value");try{return wt(e,St(this,e),this.getOwnerForm())}catch(e){console.error(e),rt.dispatch(this,"error",{message:e})}}return this.textContent?this.textContent:null}getInScopeContext(){return St(this.getAttributeNode("ref")||this,this.ref)}setInScopeVariables(e){this.inScopeVariables=e}};class Rt extends(Ot(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=et.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 o=this._getReferencesForProperty(this.relevant,e);0!==o.length?this._addDependencies(o,e,t,"relevant"):this.relevant&&this.model.mainGraph.addNode(`${t}:relevant`,e);const a=this._getReferencesForProperty(this.constraint,e);0!==a.length?this._addDependencies(a,e,t,"constraint"):this.constraint&&this.model.mainGraph.addNode(`${t}:constraint`,e)}))}_addDependencies(e,t,n,r){const o=`${n}:${r}`;0!==e.length?(this.model.mainGraph.hasNode(o)||this.model.mainGraph.addNode(o,t),e.forEach((e=>{const t=et.getPath(e);t.endsWith("text()[1]")||(this.model.mainGraph.hasNode(t)||this.model.mainGraph.addNode(t,e),this.model.mainGraph.addDependency(o,t))}))):this.model.mainGraph.addNode(o,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=St(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(et.isSelfReference(this.ref))this.nodeset=e;else if(this.ref){yt(this.ref,t,this).forEach((e=>{this.nodeset.push(e)}))}}));else{"xml"===this.getModel().getInstance(this.instanceId).type?this.nodeset=yt(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)}_createModelItem(e){if(et.isSelfReference(this.ref)){const e=rt.getClosest("fx-bind[ref]",this.parentElement);return void(e?e.required=this.required:console.error("no parent bound element"))}const t=e,n=et.getPath(e),r=new Bt(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){return e?this.getReferences(e):[]}getReferences(e){const t=new Set,n=new Ze((e=>t.add(e)));return this.nodeset.forEach((t=>{wt(e,t,this,n)})),Array.from(t.values())}_initBooleanModelItemProperty(e,t){return vt(this[e],t,this)}static shortenPath(e){const t=e.split("/");let n="";for(let e=2;e<t.length;e+=1){const r=t[e];if(-1!==r.indexOf("{}")){n+=`/${r.split("{}")[1]}`}else n+=`/${r}`}return n}_getInstanceId(){const e=this.getBindingExpr();return e.startsWith("instance(")?(this.instanceId=et.getInstanceId(e),this.instanceId):this.instanceId?this.instanceId:"default"}}Rt.READONLY_DEFAULT=!1,Rt.REQUIRED_DEFAULT=!1,Rt.RELEVANT_DEFAULT=!0,Rt.CONSTRAINT_DEFAULT=!0,Rt.TYPE_DEFAULT="xs:string",customElements.get("fx-bind")||customElements.define("fx-bind",Rt)
|
|
2
2
|
/*!
|
|
3
3
|
* Toastify js 1.11.2
|
|
4
4
|
* https://github.com/apvarun/toastify-js
|
|
5
5
|
* @license MIT licensed
|
|
6
6
|
*
|
|
7
7
|
* Copyright (C) 2018 Varun A P
|
|
8
|
-
*/;class Dt{constructor(e){this.defaults={oldestFirst:!0,text:"Toastify is awesome!",node:void 0,duration:3e3,selector:void 0,callback:function(){},destination:void 0,newWindow:!1,close:!1,gravity:"toastify-top",positionLeft:!1,position:"",backgroundColor:"",avatar:"",className:"",stopOnFocus:!0,onClick:function(){},offset:{x:0,y:0},escapeMarkup:!0,style:{background:""}},this.version="1.11.2",this.options={},this.toastElement=null,this._rootElement=document.body,this._init(e)}showToast(){if(this.toastElement=this._buildToast(),"string"==typeof this.options.selector?this._rootElement=document.getElementById(this.options.selector):this.options.selector instanceof HTMLElement||this.options.selector instanceof ShadowRoot?this._rootElement=this.options.selector:this._rootElement=document.body,!this._rootElement)throw"Root element is not defined";return this._rootElement.insertBefore(this.toastElement,this._rootElement.firstChild),this._reposition(),this.options.duration>0&&(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,e.backgroundColor&&(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}`,o="toastify-top"==this.options.gravity?n:`-${n}`;e.style.transform=`translate(${r},${o})`}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},o=this._rootElement.querySelectorAll(".toastify");for(let a=0;a<o.length;a++){e=!0===o[a].classList.contains("toastify-top")?"toastify-top":"toastify-bottom";let i=o[a].offsetHeight;e=e.substr(9,e.length-1);let s=15;(window.innerWidth>0?window.innerWidth:screen.width)<=360?(o[a].style[e]=`${r[e]}px`,r[e]+=i+s):!0===o[a].classList.contains("toastify-left")?(o[a].style[e]=`${t[e]}px`,t[e]+=i+s):(o[a].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 Ut(e){return new Dt(e)}class Mt 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 <style>\n \n :host{\n display:none;\n }\n \n </style>\n ${this.renderHTML}\n `,this.addEventListener("jinn-toast",(e=>{this.showToast(e.detail.text)}))}disconnectedCallback(){this.removeEventListener("jinn-toast",this.showToast)}showToast(e){new Ut({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 <slot></slot>\n "}}customElements.get("jinn-toast")||window.customElements.define("jinn-toast",Mt);class kt 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=>{console.error("circular dependency: ",e)})),this.ready=!1,this.storedTemplateExpressionByNode=new Map;this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML='\n <style>\n \n :host {\n // display: none;\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 // :host(.fx-ready){\n // animation: fadein .4s forwards;\n // display:block;\n // }\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 @keyframes fadein {\n 0% {\n opacity:0;\n }\n 100% {\n opacity:1;\n }\n }\n \n </style>\n \n <jinn-toast id="message" gravity="bottom" position="left"></jinn-toast>\n <jinn-toast id="sticky" gravity="bottom" position="left" duration="-1" close="true" data-class="sticky-message"></jinn-toast>\n <jinn-toast id="error" text="error" duration="-1" data-class="error" close="true" position="left" gravity="bottom"></jinn-toast>\n <slot></slot>\n <div id="modalMessage" class="overlay">\n <div class="popup">\n <h2></h2>\n <a class="close" href="#" onclick="event.target.parentNode.parentNode.classList.remove(\'show\')" autofocus>×</a>\n <div id="messageContent"></div>\n </div>\n </div>\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||(console.log(`########## FORE: kick off processing for ... ${window.location.href} ##########`),this.src&&console.log("########## FORE: loaded from ... ",this.src,"##########"),t.modelConstruct()),this.model=t})),this.addEventListener("path-mutated",(e=>{console.log("path-mutated event received",e.detail.path,e.detail.index),this.someInstanceDataStructureChanged=!0}))}addToRefresh(e){this.toRefresh.find((t=>t.path===e.path))||this.toRefresh.push(e)}_loadFromSrc(){console.log("########## loading Fore from ",this.src,"##########"),fetch(this.src,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":"text/html"}}).then((e=>{const t=e.headers.get("content-type").toLowerCase();return console.log("********** responseContentType *********",t),t.startsWith("text/html")?e.text().then((e=>(new DOMParser).parseFromString(e,"text/html"))):"done"})).then((e=>{const t=e.querySelector("fx-fore");t||rt.dispatchEvent(this,"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((()=>{rt.dispatch(this,"error",{message:`'${this.src}' not found or does not contain Fore element.`})}))}handleIntersect(e,t){console.time("refreshLazy"),e.forEach((e=>{const{target:t}=e;e.isIntersecting&&(console.log("in view",e),t.classList.add("loaded"),"function"==typeof t.refresh?(console.log("refreshing target",t),t.refresh(t,!0)):(console.log("refreshing children",t),rt.refreshChildren(t,!0)))})),e[0].target.getOwnerForm().dispatchEvent(new CustomEvent("refresh-done")),console.timeEnd("refreshLazy")}evaluateToNodes(e,t){return yt(e,t,this)}disconnectedCallback(){}async forceRefresh(){console.time("refresh"),console.group("### forced refresh",this),rt.refreshChildren(this,!0),this._updateTemplateExpressions(),this.someInstanceDataStructureChanged=!1,this._processTemplateExpressions(),rt.dispatch(this,"refresh-done",{}),console.groupEnd(),console.timeEnd("refresh")}async refresh(e){if(console.group("### refresh"),console.time("refresh"),console.time("refreshChildren"),console.log("toRefresh",this.toRefresh),this.initialRun||0===this.toRefresh.length)rt.refreshChildren(this,!0),console.timeEnd("refreshChildren");else{let e=!1;this.toRefresh.forEach((t=>{const n=t.boundControls;n&&n.forEach((e=>{e.refresh()}));const{mainGraph:r}=this.getModel();if(r&&r.hasNode(t.path)){const n=this.getModel().mainGraph.dependentsOf(t.path,!1);0!==n.length&&(n.forEach((e=>{const t=et.getBasePath(e);this.getModel().modelItems.find((e=>e.path===t)).boundControls.forEach((e=>{e.refresh()}))})),e=!0)}})),this.toRefresh=[],e||console.log("skipping refresh - no dependants")}(this.initialRun||this.someInstanceDataStructureChanged)&&(this._updateTemplateExpressions(),this.someInstanceDataStructureChanged=!1),this._processTemplateExpressions(),console.timeEnd("refresh"),console.groupEnd(),rt.dispatch(this,"refresh-done",{})}_updateTemplateExpressions(){const e=yt("(descendant-or-self::*/(text(), @*))[not(ancestor-or-self::fx-model)][matches(.,'\\{.*\\}')]",this,this);this.storedTemplateExpressions||(this.storedTemplateExpressions=[]),console.log("######### storedTemplateExpressions",this.storedTemplateExpressions.length),Array.from(e).forEach((e=>{if(this.storedTemplateExpressionByNode.has(e))return;const t=this._getTemplateExpression(e);this.storedTemplateExpressionByNode.set(e,t)})),console.log("stored template expressions ",this.storedTemplateExpressionByNode),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){const n=e.replace(/{[^}]*}/g,(e=>{if("{}"===e)return e;const n=e.substring(1,e.length-1),r=St(t,n);if(!r){const n=t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ATTRIBUTE_NODE?t.parentNode:t;return console.warn("no inscope context for ",n),e}const o=et.getInstanceId(n),a=this.getModel().getInstance(o);try{return wt(n,r,t,null,a)}catch(t){return console.log("ignoring unparseable expr"),e}}));if(t.nodeType===Node.ATTRIBUTE_NODE){t.ownerElement.setAttribute(t.nodeName,n)}else t.nodeType===Node.TEXT_NODE&&(t.textContent=n)}_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){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")&&!rt.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<n.length;e+=1)this._generateInstance(n[e],t)}return t}_generateNode(e,t,n){const r=e.ownerDocument.createElement(t);return 0===n.children.length&&(r.textContent=n.textContent),e.appendChild(r),e=r}async _initUI(){if(console.log("### _initUI()"),!this.initialRun)return;await this._lazyCreateInstance();const e=new Map;!function t(n){for(const r of n.children)"setInScopeVariables"in r&&r.setInScopeVariables(e),t(r)}(this),console.log("Found variables:",e),await this.refresh(),this.classList.add("fx-ready"),document.body.classList.add("fx-ready"),this.ready=!0,this.initialRun=!1,console.log("modelItems: ",this.getModel().modelItems),console.log("### <<<<< FORE: form fully initialized...",this),rt.dispatch(this,"ready",{})}registerLazyElement(e){this.intersectionObserver&&this.intersectionObserver.observe(e)}unRegisterLazyElement(e){this.intersectionObserver&&this.intersectionObserver.unobserve(e)}getModel(){return this.querySelector("fx-model")}_displayMessage(e){const{level:t}=e.detail,n=e.detail.message;this._showMessage(t,n),e.stopPropagation()}_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("sticky"===e)this.shadowRoot.querySelector("#sticky").showToast(t);else{this.shadowRoot.querySelector("#message").showToast(t)}}}customElements.get("fx-fore")||customElements.define("fx-fore",kt);class Gt{static selectRelevant(e,t){return console.log("selectRelevant",t),"xml"===t?Gt._relevantXmlNodes(e):(console.warn(`relevance selection not supported for type:${e.type}`),e.nodeset)}static _relevantXmlNodes(e){if("keep"===e.getAttribute("nonrelevant"))return e.nodeset;const t=e.getModel().getModelItem(e.nodeset);if(t&&!t.relevant)return null;const n=e.nodeset.cloneNode(!1);return 0===e.nodeset.children.length&&Gt._isRelevant(e,e.nodeset)?e.nodeset:Gt._filterRelevant(e,e.nodeset,n)}static _filterRelevant(e,t,n){const{childNodes:r}=t;return Array.from(r).forEach((t=>{if(Gt._isRelevant(e,t)){const r=t.cloneNode(!1);n.appendChild(r);const{attributes:o}=t;return o&&Array.from(o).forEach((t=>{Gt._isRelevant(e,t)?r.setAttribute(t.nodeName,t.value):"empty"===e.nonrelevant?r.setAttribute(t.nodeName,""):r.removeAttribute(t.nodeName)})),Gt._filterRelevant(e,t,r)}return null})),n}static _isRelevant(e,t){const n=e.getModel().getModelItem(t);return!(n&&!n.relevant)}}class Ft extends(Ot(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.into=this.hasAttribute("into")?this.getAttribute("into"):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 <slot></slot>\n "}async submit(){await rt.dispatch(this,"submit",{submission:this}),this._submit()}async _submit(){console.log("submitting...."),this.evalInContext();const e=this.getModel();if(e.recalculate(),"true"===this.validate){if(!e.revalidate())return console.log("validation failed. Bubmission stopped"),rt.dispatch(this,"submit-error",{}),void this.getModel().parentNode.refresh()}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),o=wt(r,St(t,r),this.getOwnerForm()),a=e.replaceAll(n,o);console.log("replacing ",e," with ",a),e=a})),e}async _serializeAndSend(){const e=this._evaluateAttributeTemplateExpression(this.url,this),t=this.getInstance();let n;if(console.log("instance type",t.type),"none"===this.serialization)n=void 0;else{const e=Gt.selectRelevant(this,t.type);n=this._serialize(t.type,e)}if("get"===this.method.toLowerCase()&&(n=void 0),e.startsWith("#echo")){let e=this._parse(n,t);return this._handleResponse(e),void rt.dispatch(this,"submit-done",{})}if(e.startsWith("localStore:")&&"post"===this.method){const t=e.substring(e.indexOf(":")+1);return localStorage.setItem(t,n),void rt.dispatch(this,"submit-done",{})}if(e.startsWith("localStore:")&&("consume"===this.method||"get"===this.method)){this.replace="instance";const n=e.substring(e.indexOf(":")+1),r=localStorage.getItem(n);if(!r)return void rt.dispatch(this,"submit-error",{message:`Error reading key ${n} from localstorage`});let o=this._parse(r,t);return this._handleResponse(o),"consume"===this.method&&localStorage.removeItem(n),void rt.dispatch(this,"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 rt.dispatch(this,"error",{message:`Unknown method ${this.method}`});const o=await fetch(e,{method:this.method,mode:"cors",credentials:"include",headers:r,body:n});if(!o.ok||o.status>400)return void rt.dispatch(this,"submit-error",{message:`Error while submitting ${this.id}`});const a=o.headers.get("content-type").toLowerCase();if(a.startsWith("text/plain")||a.startsWith("text/html")||a.startsWith("text/markdown")){const e=await o.text();this._handleResponse(e)}else if(a.startsWith("application/json")){const e=await o.json();this._handleResponse(e)}else if(a.startsWith("application/xml")){const e=await o.text(),t=(new DOMParser).parseFromString(e,"application/xml");this._handleResponse(t)}else{const e=await o.blob();this._handleResponse(e)}rt.dispatch(this,"submit-done",{})}_parse(e,t){let n=null;return e&&"xml"===t.type&&(n=(new DOMParser).parseFromString(e,"application/xml")),e&&"json"===t.type&&(n=JSON.parse(e)),n}_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=rt.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]=mt(this.targetref,t.instanceData.firstElementChild,this);console.log("theTarget",n);const r=e.firstElementChild,o=n.parentNode;o.replaceChild(r,n),console.log("finally ",o)}else if(this.into){const[n]=mt(this.into,t.instanceData.firstElementChild,this);console.log("theTarget",n),n.innerHTML=e}else{const n=e;t.instanceData=n,console.log("### replaced instance ",this.getModel().instances),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)}_handleError(){rt.dispatch(this,"submit-error",{})}}customElements.get("fx-submission")||customElements.define("fx-submission",Ft);class Pt extends(Ot(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.get("fx-header")||customElements.define("fx-header",Pt);class Ht extends(Ot(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=St(this,this.valueQuery),t=mt(this.valueQuery,e,this,this.precedingVariables);[this.value]=t}setInScopeVariables(e){if(e.has(this.name))return console.error(`The variable ${this.name} is declared more than once`),void rt.dispatch(this,"xforms-binding-error",{});e.set(this.name,this),this.inScopeVariables=new Map(e)}}customElements.get("fx-var")||customElements.define("fx-var",Ht);class _t extends(Ot(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(){const e=this.value;if(!this.isNotBound()&&(this.oldVal=this.nodeset?this.nodeset:null,this.evalInContext(),this.isBound())){if(null===this.nodeset)return void(this.style.display="none");if(this.modelItem=this.getModelItem(),this.modelItem instanceof Bt){if(this.hasAttribute("as")&&"node"===this.getAttribute("as")?(console.log("as",this.nodeset),this.modelItem.value=this.nodeset,this.value=this.modelItem.node):this.value=this.modelItem.value,this.modelItem.boundControls.includes(this)||this.modelItem.boundControls.push(this),await this.updateWidgetValue(),this.handleModelItemProperties(),!this.getOwnerForm().ready)return;e!==this.value&&rt.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&&rt.dispatch(this,e,{})}handleRequired(){this.widget=this.getWidget(),this.modelItem.required?(this.getOwnerForm().ready&&(""===this.widget.value?this.classList.add("isRequiredFalse"):this.classList.remove("isRequiredFalse")),this.widget.setAttribute("required",""),this.setAttribute("required",""),this._dispatchEvent("required")):(this.widget.removeAttribute("required"),this.removeAttribute("required"),this._dispatchEvent("optional"))}handleReadonly(){this.isReadonly()!==this.modelItem.readonly&&(this.modelItem.readonly&&(this.widget.setAttribute("readonly",""),this.setAttribute("readonly",""),this._dispatchEvent("readonly")),this.modelItem.readonly||(this.widget.removeAttribute("readonly"),this.removeAttribute("readonly"),this._dispatchEvent("readwrite")))}handleValid(){const e=this.querySelector("fx-alert");if(this.isValid()!==this.modelItem.constraint)if(this.modelItem.constraint)e&&(e.style.display="none"),this._dispatchEvent("valid"),this.removeAttribute("invalid");else{if(this.setAttribute("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(){const e=this.modelItem.node;if(Array.isArray(e)&&0===e.length)return this._dispatchEvent("nonrelevant"),void(this.style.display="none");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.hasAttribute("required")}isValid(){return!this.hasAttribute("invalid")}isReadonly(){return this.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))}()}}customElements.get("fx-abstract-control")||window.customElements.define("fx-abstract-control",_t);class jt extends _t{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML="\n <style>\n \n :host {\n height: auto;\n font-size: 0.8em;\n font-weight: 400;\n color: red;\n display: none;\n }\n \n </style>\n \n <slot></slot>\n \n "}getWidget(){return this}async updateWidgetValue(){console.log("alert update",this),this.innerHTML=this.value}}customElements.get("fx-alert")||customElements.define("fx-alert",jt);class Xt extends _t{constructor(){super(),this.inited=!1,this.attachShadow({mode:"open"})}connectedCallback(){this.initial=this.hasAttribute("initial")?this.getAttribute("initial"):null,this.url=this.hasAttribute("url")?this.getAttribute("url"):null,this.loaded=!1,this.initialNode=null,this.debounceDelay=this.hasAttribute("debounce")?this.getAttribute("debounce"):null,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 <style>\n \n :host{\n display:inline-block;\n }\n \n </style>\n ${this.renderHTML(this.ref)}\n `,this.widget=this.getWidget();let e=this.widget;if(this.hasAttribute("listen-on")){const t=this.getAttribute("listen-on"),n=this.querySelector(t);n&&(e=n)}"enter"===this.updateEvent&&(this.widget.addEventListener("keyup",(e=>{13===e.keyCode&&(e.preventDefault(),this.setValue(this.widget[this.valueProp]))})),this.updateEvent="blur"),this.debounceDelay?e.addEventListener(this.updateEvent,function(e,t=300){let n;return(...r)=>{clearTimeout(n),n=setTimeout((()=>{e.apply(this,r)}),t)}}((()=>{console.log("eventlistener ",this.updateEvent),this.setValue(this.widget[this.valueProp])}),this.debounceDelay)):e.addEventListener(this.updateEvent,(()=>{console.log("eventlistener ",this.updateEvent),this.setValue(this.widget[this.valueProp])})),this.addEventListener("return",(e=>{console.log("catched return action on ",this),console.log("return detail",e.detail),console.log("return triggered on ",this),console.log("this.ref",this.ref),console.log("current outer instance",this.getInstance()),console.log("???? why ???? current nodeset should point to the node of the outer control",e.currentTarget.nodeset),console.log("???? why ???? current nodeset should point to the node of the outer control",this.nodeset);const t=e.detail.nodeset;console.log("new nodeset",t),console.log("currentTarget",e.currentTarget),console.log("target",e.target),e.stopPropagation(),this._replaceNode(t)})),this.template=this.querySelector("template")}_debounce(e,t=300){let n;return(...r)=>{const o=this;clearTimeout(n),n=setTimeout((()=>{e.apply(o,r)}),t)}}setValue(e){const t=this.getModelItem();if(t?.readonly)return void console.warn("attempt to change readonly node",t);if("node"===this.getAttribute("as")){const e=this.getWidget().value,n=this.shadowRoot.getElementById("replace");return n.replace(this.nodeset,this.getWidget().value),void(t&&e&&e!==t.value&&(t.value=e,n.actionPerformed()))}const n=this.shadowRoot.getElementById("setvalue");n.setValue(t,e),n.actionPerformed()}_replaceNode(e){this.modelItem.node.replaceWith(e.cloneNode(!0)),this.getOwnerForm().refresh()}renderHTML(e){return`\n ${this.label?`${this.label}`:""}\n <slot></slot>\n ${this.hasAttribute("as")&&"node"===this.getAttribute("as")?'<fx-replace id="replace" ref=".">':`<fx-setvalue id="setvalue" ref="${e}"></fx-setvalue>`}\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(){let{widget:e}=this;if(e||(e=this),"checked"!==this.valueProp)if(this.hasAttribute("as")){const t=this.getAttribute("as");if("text"===t){const t=new XMLSerializer,n=rt.prettifyXml(t.serializeToString(this.nodeset));e.value=n}if("node"===t&&this.nodeset!==e.value){const t=this.nodeset;if(e.value&&t!==this.widget.value)return console.log("changed"),void(e.value=this.nodeset.cloneNode(!0));e.value=this.nodeset.cloneNode(!0),console.log("passed value to widget",e.value)}}else{if(this.url&&!this.loaded)return this.initial&&(this.initialNode=gt(this.initial,this.nodeset,this),console.log("initialNodes",this.initialNode)),await this._loadForeFromUrl(),void(this.loaded=!0);e.value!==this.value&&(e.value=this.value)}else"true"===this.value?e.checked=!0:e.checked=!1}async _loadForeFromUrl(){console.log("########## loading Fore from ",this.src,"##########");try{const e=await fetch(this.url,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":"text/html"}}),t=e.headers.get("content-type").toLowerCase();let n;console.log("********** responseContentType *********",t),n=t.startsWith("text/html")?await e.text().then((e=>(new DOMParser).parseFromString(e,"text/html"))):"done";const r=n.querySelector("fx-fore");r.classList.add("widget");const o=this.querySelector("input");this.hasAttribute("shadow")?(o.parentNode.removeChild(o),this.shadowRoot.appendChild(r)):o.replaceWith(r),console.log(`########## loaded fore as component ##### ${this.url}`),r.addEventListener("model-construct-done",(e=>{console.log("subcomponent ready",e.target);const t=r.querySelector("fx-instance");if(console.log("defaultInst",t),this.initialNode){const e=(new DOMParser).parseFromString("<data></data>","application/xml");e.firstElementChild.appendChild(this.initialNode.cloneNode(!0)),t.setInstanceData(e)}console.log("new data",t.getInstanceData()),r.getModel().updateModel(),r.refresh()}),{once:!0}),r||this.dispatchEvent(new CustomEvent("error",{detail:{message:`Fore element not found in '${this.src}'. Maybe wrapped within 'template' element?`}})),console.log("loaded"),this.dispatchEvent(new CustomEvent("loaded",{detail:{fore:r}}))}catch(e){console.log("error",e),this.getOwnerForm().dispatchEvent(new CustomEvent("error",{detail:{message:`${this.url} not found`}}))}}getTemplate(){return this.querySelector("template")}async refresh(e){super.refresh(e);const t=this.getWidget();this._handleBoundWidget(t),rt.refreshChildren(this,e)}_handleBoundWidget(e){if(e&&e.hasAttribute("ref")){const t=e.getAttribute("ref"),n=mt(t,St(this,t),this);if(Array.isArray(n)&&0===n.length)return;const{children:r}=e;if(Array.from(r).forEach((e=>{"template"!==e.nodeName.toLowerCase()&&e.parentNode.removeChild(e)})),this.template){if("SELECT"===this.widget.nodeName&&this.widget.hasAttribute("selection")&&"open"===this.widget.getAttribute("selection")){const e=this.template.firstElementChild,t=document.createElement("option");this.widget.insertBefore(t,e)}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)}}}}updateEntry(e,t){if("SELECT"!==this.widget.nodeName)return;const n=this._getValueAttribute(e),r=n.value,o=wt(r.substring(1,r.length-1),t,e);n.value=o,this.value===o&&e.setAttribute("selected","selected");const a=e.textContent,i=wt(a.substring(1,a.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}}customElements.get("fx-control")||window.customElements.define("fx-control",Xt);class Lt extends(Ot(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML="\n <style>\n \n :host {\n display: block;\n }\n \n </style>\n \n <slot></slot>\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(),rt.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}}customElements.get("fx-container")||window.customElements.define("fx-container",Lt)
|
|
8
|
+
*/;class Dt{constructor(e){this.defaults={oldestFirst:!0,text:"Toastify is awesome!",node:void 0,duration:3e3,selector:void 0,callback:function(){},destination:void 0,newWindow:!1,close:!1,gravity:"toastify-top",positionLeft:!1,position:"",backgroundColor:"",avatar:"",className:"",stopOnFocus:!0,onClick:function(){},offset:{x:0,y:0},escapeMarkup:!0,style:{background:""}},this.version="1.11.2",this.options={},this.toastElement=null,this._rootElement=document.body,this._init(e)}showToast(){if(this.toastElement=this._buildToast(),"string"==typeof this.options.selector?this._rootElement=document.getElementById(this.options.selector):this.options.selector instanceof HTMLElement||this.options.selector instanceof ShadowRoot?this._rootElement=this.options.selector:this._rootElement=document.body,!this._rootElement)throw"Root element is not defined";return this._rootElement.insertBefore(this.toastElement,this._rootElement.firstChild),this._reposition(),this.options.duration>0&&(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,e.backgroundColor&&(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}`,o="toastify-top"==this.options.gravity?n:`-${n}`;e.style.transform=`translate(${r},${o})`}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},o=this._rootElement.querySelectorAll(".toastify");for(let a=0;a<o.length;a++){e=!0===o[a].classList.contains("toastify-top")?"toastify-top":"toastify-bottom";let i=o[a].offsetHeight;e=e.substr(9,e.length-1);let s=15;(window.innerWidth>0?window.innerWidth:screen.width)<=360?(o[a].style[e]=`${r[e]}px`,r[e]+=i+s):!0===o[a].classList.contains("toastify-left")?(o[a].style[e]=`${t[e]}px`,t[e]+=i+s):(o[a].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 Ut(e){return new Dt(e)}class Mt 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 <style>\n \n :host{\n display:none;\n }\n \n </style>\n ${this.renderHTML}\n `,this.addEventListener("jinn-toast",(e=>{this.showToast(e.detail.text)}))}disconnectedCallback(){this.removeEventListener("jinn-toast",this.showToast)}showToast(e){new Ut({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 <slot></slot>\n "}}customElements.get("jinn-toast")||window.customElements.define("jinn-toast",Mt);class kt 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=>{console.error("circular dependency: ",e)})),this.ready=!1,this.storedTemplateExpressionByNode=new Map;this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML='\n <style>\n \n :host {\n // display: none;\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 // :host(.fx-ready){\n // animation: fadein .4s forwards;\n // display:block;\n // }\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 @keyframes fadein {\n 0% {\n opacity:0;\n }\n 100% {\n opacity:1;\n }\n }\n \n </style>\n \n <jinn-toast id="message" gravity="bottom" position="left"></jinn-toast>\n <jinn-toast id="sticky" gravity="bottom" position="left" duration="-1" close="true" data-class="sticky-message"></jinn-toast>\n <jinn-toast id="error" text="error" duration="-1" data-class="error" close="true" position="left" gravity="bottom"></jinn-toast>\n <slot></slot>\n <div id="modalMessage" class="overlay">\n <div class="popup">\n <h2></h2>\n <a class="close" href="#" onclick="event.target.parentNode.parentNode.classList.remove(\'show\')" autofocus>×</a>\n <div id="messageContent"></div>\n </div>\n </div>\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||(console.log(`########## FORE: kick off processing for ... ${window.location.href} ##########`),this.src&&console.log("########## FORE: loaded from ... ",this.src,"##########"),t.modelConstruct()),this.model=t})),this.addEventListener("path-mutated",(e=>{console.log("path-mutated event received",e.detail.path,e.detail.index),this.someInstanceDataStructureChanged=!0}))}addToRefresh(e){this.toRefresh.find((t=>t.path===e.path))||this.toRefresh.push(e)}_loadFromSrc(){console.log("########## loading Fore from ",this.src,"##########"),fetch(this.src,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":"text/html"}}).then((e=>{const t=e.headers.get("content-type").toLowerCase();return console.log("********** responseContentType *********",t),t.startsWith("text/html")?e.text().then((e=>(new DOMParser).parseFromString(e,"text/html"))):"done"})).then((e=>{const t=e.querySelector("fx-fore");t||rt.dispatchEvent(this,"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((()=>{rt.dispatch(this,"error",{message:`'${this.src}' not found or does not contain Fore element.`})}))}handleIntersect(e,t){console.time("refreshLazy"),e.forEach((e=>{const{target:t}=e;e.isIntersecting&&(console.log("in view",e),t.classList.add("loaded"),"function"==typeof t.refresh?(console.log("refreshing target",t),t.refresh(t,!0)):(console.log("refreshing children",t),rt.refreshChildren(t,!0)))})),e[0].target.getOwnerForm().dispatchEvent(new CustomEvent("refresh-done")),console.timeEnd("refreshLazy")}evaluateToNodes(e,t){return yt(e,t,this)}disconnectedCallback(){}async forceRefresh(){console.time("refresh"),console.group("### forced refresh",this),rt.refreshChildren(this,!0),this._updateTemplateExpressions(),this.someInstanceDataStructureChanged=!1,this._processTemplateExpressions(),rt.dispatch(this,"refresh-done",{}),console.groupEnd(),console.timeEnd("refresh")}async refresh(e){if(console.group("### refresh"),console.time("refresh"),console.log("toRefresh",this.toRefresh),e||this.initialRun||0===this.toRefresh.length)rt.refreshChildren(this,!0);else{let e=!1;this.toRefresh.forEach((t=>{const n=t.boundControls;n&&n.forEach((e=>{e.refresh()}));const{mainGraph:r}=this.getModel();if(r&&r.hasNode(t.path)){const n=this.getModel().mainGraph.dependentsOf(t.path,!1);0!==n.length&&(n.forEach((e=>{const t=et.getBasePath(e);this.getModel().modelItems.find((e=>e.path===t)).boundControls.forEach((e=>{e.refresh()}))})),e=!0)}})),this.toRefresh=[],e||console.log("skipping refresh - no dependants")}(this.initialRun||this.someInstanceDataStructureChanged)&&(this._updateTemplateExpressions(),this.someInstanceDataStructureChanged=!1),this._processTemplateExpressions(),console.timeEnd("refresh"),console.groupEnd(),rt.dispatch(this,"refresh-done",{})}_updateTemplateExpressions(){const e=yt("(descendant-or-self::*/(text(), @*))[not(ancestor-or-self::fx-model)][matches(.,'\\{.*\\}')]",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){const n=e.replace(/{[^}]*}/g,(e=>{if("{}"===e)return e;const n=e.substring(1,e.length-1),r=St(t,n);if(!r){const n=t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ATTRIBUTE_NODE?t.parentNode:t;return console.warn("no inscope context for ",n),e}const o=et.getInstanceId(n),a=this.getModel().getInstance(o);try{return wt(n,r,t,null,a)}catch(t){return console.log("ignoring unparseable expr"),e}}));if(t.nodeType===Node.ATTRIBUTE_NODE){t.ownerElement.setAttribute(t.nodeName,n)}else t.nodeType===Node.TEXT_NODE&&(t.textContent=n)}_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){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")&&!rt.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<n.length;e+=1)this._generateInstance(n[e],t)}return t}_generateNode(e,t,n){const r=e.ownerDocument.createElement(t);return 0===n.children.length&&(r.textContent=n.textContent),e.appendChild(r),e=r}async _initUI(){if(console.log("### _initUI()"),!this.initialRun)return;await this._lazyCreateInstance();const e=new Map;!function t(n){for(const r of n.children)"setInScopeVariables"in r&&r.setInScopeVariables(e),t(r)}(this),await this.refresh(),this.classList.add("fx-ready"),document.body.classList.add("fx-ready"),this.ready=!0,this.initialRun=!1,console.log("### modelItems: ",this.getModel().modelItems),console.log("### <<<<< FORE: form fully initialized...",this),rt.dispatch(this,"ready",{})}registerLazyElement(e){this.intersectionObserver&&this.intersectionObserver.observe(e)}unRegisterLazyElement(e){this.intersectionObserver&&this.intersectionObserver.unobserve(e)}getModel(){return this.querySelector("fx-model")}_displayMessage(e){const{level:t}=e.detail,n=e.detail.message;this._showMessage(t,n),e.stopPropagation()}_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("sticky"===e)this.shadowRoot.querySelector("#sticky").showToast(t);else{this.shadowRoot.querySelector("#message").showToast(t)}}}customElements.get("fx-fore")||customElements.define("fx-fore",kt);class Gt{static selectRelevant(e,t){return console.log("selectRelevant",t),"xml"===t?Gt._relevantXmlNodes(e):(console.warn(`relevance selection not supported for type:${e.type}`),e.nodeset)}static _relevantXmlNodes(e){if("keep"===e.getAttribute("nonrelevant"))return e.nodeset;const t=e.getModel().getModelItem(e.nodeset);if(t&&!t.relevant)return null;const n=e.nodeset.cloneNode(!1);return 0===e.nodeset.children.length&&Gt._isRelevant(e,e.nodeset)?e.nodeset:Gt._filterRelevant(e,e.nodeset,n)}static _filterRelevant(e,t,n){const{childNodes:r}=t;return Array.from(r).forEach((t=>{if(Gt._isRelevant(e,t)){const r=t.cloneNode(!1);n.appendChild(r);const{attributes:o}=t;return o&&Array.from(o).forEach((t=>{Gt._isRelevant(e,t)?r.setAttribute(t.nodeName,t.value):"empty"===e.nonrelevant?r.setAttribute(t.nodeName,""):r.removeAttribute(t.nodeName)})),Gt._filterRelevant(e,t,r)}return null})),n}static _isRelevant(e,t){const n=e.getModel().getModelItem(t);return!(n&&!n.relevant)}}class Ft extends(Ot(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.into=this.hasAttribute("into")?this.getAttribute("into"):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 <slot></slot>\n "}async submit(){await rt.dispatch(this,"submit",{submission:this}),this._submit()}async _submit(){console.log("submitting....",this.getAttribute("id")),this.evalInContext();const e=this.getModel();if(e.recalculate(),"true"===this.validate){if(!e.revalidate())return console.log("validation failed. Bubmission stopped"),rt.dispatch(this,"submit-error",{}),void this.getModel().parentNode.refresh()}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),o=wt(r,St(t,r),this.getOwnerForm()),a=e.replaceAll(n,o);console.log("replacing ",e," with ",a),e=a})),e}async _serializeAndSend(){const e=this._evaluateAttributeTemplateExpression(this.url,this),t=this.getInstance();let n;if(console.log("instance type",t.type),"none"===this.serialization)n=void 0;else{const e=Gt.selectRelevant(this,t.type);n=this._serialize(t.type,e)}if("get"===this.method.toLowerCase()&&(n=void 0),e.startsWith("#echo")){let e=this._parse(n,t);return this._handleResponse(e),void rt.dispatch(this,"submit-done",{})}if(e.startsWith("localStore:")&&"post"===this.method){const t=e.substring(e.indexOf(":")+1);return localStorage.setItem(t,n),void rt.dispatch(this,"submit-done",{})}if(e.startsWith("localStore:")&&("consume"===this.method||"get"===this.method)){this.replace="instance";const n=e.substring(e.indexOf(":")+1),r=localStorage.getItem(n);if(!r)return void rt.dispatch(this,"submit-error",{message:`Error reading key ${n} from localstorage`});let o=this._parse(r,t);return this._handleResponse(o),"consume"===this.method&&localStorage.removeItem(n),void rt.dispatch(this,"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 rt.dispatch(this,"error",{message:`Unknown method ${this.method}`});const o=await fetch(e,{method:this.method,mode:"cors",credentials:"include",headers:r,body:n});if(!o.ok||o.status>400)return void rt.dispatch(this,"submit-error",{message:`Error while submitting ${this.id}`});const a=o.headers.get("content-type").toLowerCase();if(a.startsWith("text/plain")||a.startsWith("text/html")||a.startsWith("text/markdown")){const e=await o.text();this._handleResponse(e)}else if(a.startsWith("application/json")){const e=await o.json();this._handleResponse(e)}else if(a.startsWith("application/xml")){const e=await o.text(),t=(new DOMParser).parseFromString(e,"application/xml");this._handleResponse(t)}else{const e=await o.blob();this._handleResponse(e)}rt.dispatch(this,"submit-done",{})}_parse(e,t){let n=null;return e&&"xml"===t.type&&(n=(new DOMParser).parseFromString(e,"application/xml")),e&&"json"===t.type&&(n=JSON.parse(e)),n}_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=rt.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]=mt(this.targetref,t.instanceData.firstElementChild,this);console.log("theTarget",n);const r=e.firstElementChild,o=n.parentNode;o.replaceChild(r,n),console.log("finally ",o)}else if(this.into){const[n]=mt(this.into,t.instanceData.firstElementChild,this);console.log("theTarget",n),n.innerHTML=e}else{const n=e;t.instanceData=n,console.log("### replaced instance ",this.getModel().instances),console.log("### replaced instance ",t.instanceData)}this.model.updateModel(),this.getOwnerForm().refresh(!0)}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)}_handleError(){rt.dispatch(this,"submit-error",{})}}customElements.get("fx-submission")||customElements.define("fx-submission",Ft);class Pt extends(Ot(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.get("fx-header")||customElements.define("fx-header",Pt);class Ht extends(Ot(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=St(this,this.valueQuery),t=mt(this.valueQuery,e,this,this.precedingVariables);[this.value]=t}setInScopeVariables(e){if(e.has(this.name))return console.error(`The variable ${this.name} is declared more than once`),void rt.dispatch(this,"xforms-binding-error",{});e.set(this.name,this),this.inScopeVariables=new Map(e)}}customElements.get("fx-var")||customElements.define("fx-var",Ht);class _t extends(Ot(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(){const e=this.value;if(!this.isNotBound()&&(this.oldVal=this.nodeset?this.nodeset:null,this.evalInContext(),this.isBound())){if(!this.nodeset)return void(this.style.display="none");if(this.modelItem=this.getModelItem(),this.modelItem instanceof Bt){if(this.hasAttribute("as")&&"node"===this.getAttribute("as")?(this.modelItem.node=this.nodeset,this.value=this.modelItem.node):this.value=this.modelItem.value,this.modelItem.boundControls.includes(this)||this.modelItem.boundControls.push(this),await this.updateWidgetValue(),this.handleModelItemProperties(),!this.getOwnerForm().ready)return;e!==this.value&&rt.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&&rt.dispatch(this,e,{})}handleRequired(){this.widget=this.getWidget(),this.isRequired()!==this.modelItem.required&&(this.modelItem.required?(this.getOwnerForm().ready&&(""===this.widget.value?this.classList.add("isRequiredFalse"):this.classList.remove("isRequiredFalse")),this.widget.setAttribute("required",""),this.setAttribute("required",""),this._dispatchEvent("required")):(this.widget.removeAttribute("required"),this.removeAttribute("required"),this._dispatchEvent("optional")))}handleReadonly(){this.isReadonly()!==this.modelItem.readonly&&(this.modelItem.readonly&&(this.widget.setAttribute("readonly",""),this.setAttribute("readonly",""),this._dispatchEvent("readonly")),this.modelItem.readonly||(this.widget.removeAttribute("readonly"),this.removeAttribute("readonly"),this._dispatchEvent("readwrite")))}handleValid(){const e=this.querySelector("fx-alert");if(this.isValid()!==this.modelItem.constraint)if(this.modelItem.constraint)e&&(e.style.display="none"),this._dispatchEvent("valid"),this.removeAttribute("invalid");else{if(this.setAttribute("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(){const e=this.modelItem.node;if(Array.isArray(e)&&0===e.length)return this._dispatchEvent("nonrelevant"),void(this.style.display="none");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.hasAttribute("required")}isValid(){return!this.hasAttribute("invalid")}isReadonly(){return this.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))}()}}customElements.get("fx-abstract-control")||window.customElements.define("fx-abstract-control",_t);class jt extends _t{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML="\n <style>\n \n :host {\n height: auto;\n font-size: 0.8em;\n font-weight: 400;\n color: red;\n display: none;\n }\n \n </style>\n \n <slot></slot>\n \n "}getWidget(){return this}async updateWidgetValue(){console.log("alert update",this),this.innerHTML=this.value}}customElements.get("fx-alert")||customElements.define("fx-alert",jt);class Xt extends _t{constructor(){super(),this.inited=!1,this.attachShadow({mode:"open"})}connectedCallback(){this.initial=this.hasAttribute("initial")?this.getAttribute("initial"):null,this.url=this.hasAttribute("url")?this.getAttribute("url"):null,this.loaded=!1,this.initialNode=null,this.debounceDelay=this.hasAttribute("debounce")?this.getAttribute("debounce"):null,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 <style>\n \n :host{\n display:inline-block;\n }\n \n </style>\n ${this.renderHTML(this.ref)}\n `,this.widget=this.getWidget();let e=this.widget;if(this.hasAttribute("listen-on")){const t=this.getAttribute("listen-on"),n=this.querySelector(t);n&&(e=n)}"enter"===this.updateEvent&&(this.widget.addEventListener("keyup",(e=>{13===e.keyCode&&(e.preventDefault(),this.setValue(this.widget[this.valueProp]))})),this.updateEvent="blur"),this.debounceDelay?e.addEventListener(this.updateEvent,function(e,t=300){let n;return(...r)=>{clearTimeout(n),n=setTimeout((()=>{e.apply(this,r)}),t)}}((()=>{console.log("eventlistener ",this.updateEvent),this.setValue(this.widget[this.valueProp])}),this.debounceDelay)):e.addEventListener(this.updateEvent,(()=>{console.log("eventlistener ",this.updateEvent),this.setValue(this.widget[this.valueProp])})),this.addEventListener("return",(e=>{console.log("catched return action on ",this),console.log("return detail",e.detail),console.log("return triggered on ",this),console.log("this.ref",this.ref),console.log("current outer instance",this.getInstance()),console.log("???? why ???? current nodeset should point to the node of the outer control",e.currentTarget.nodeset),console.log("???? why ???? current nodeset should point to the node of the outer control",this.nodeset);const t=e.detail.nodeset;console.log("new nodeset",t),console.log("currentTarget",e.currentTarget),console.log("target",e.target),e.stopPropagation(),this._replaceNode(t)})),this.template=this.querySelector("template")}_debounce(e,t=300){let n;return(...r)=>{const o=this;clearTimeout(n),n=setTimeout((()=>{e.apply(o,r)}),t)}}setValue(e){const t=this.getModelItem();if(t?.readonly)return void console.warn("attempt to change readonly node",t);if("node"===this.getAttribute("as")){const e=this.getWidget().value,n=this.shadowRoot.getElementById("replace");return n.replace(this.nodeset,this.getWidget().value),void(t&&e&&e!==t.value&&(t.value=e,n.actionPerformed()))}const n=this.shadowRoot.getElementById("setvalue");n.setValue(t,e),this.modelItem instanceof Bt&&!this.modelItem?.boundControls.includes(this)&&this.modelItem.boundControls.push(this),n.actionPerformed()}_replaceNode(e){this.modelItem.node.replaceWith(e.cloneNode(!0)),this.getOwnerForm().refresh()}renderHTML(e){return`\n ${this.label?`${this.label}`:""}\n <slot></slot>\n ${this.hasAttribute("as")&&"node"===this.getAttribute("as")?'<fx-replace id="replace" ref=".">':`<fx-setvalue id="setvalue" ref="${e}"></fx-setvalue>`}\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(){let{widget:e}=this;if(e||(e=this),"checked"!==this.valueProp)if(this.hasAttribute("as")){const t=this.getAttribute("as");if("text"===t){const t=new XMLSerializer,n=rt.prettifyXml(t.serializeToString(this.nodeset));e.value=n}if("node"===t&&this.nodeset!==e.value){const t=this.nodeset;if(e.value&&t!==this.widget.value)return console.log("changed"),void(e.value=this.nodeset.cloneNode(!0));e.value=this.nodeset.cloneNode(!0),console.log("passed value to widget",e.value)}}else{if(this.url&&!this.loaded)return this.initial&&(this.initialNode=gt(this.initial,this.nodeset,this),console.log("initialNodes",this.initialNode)),await this._loadForeFromUrl(),void(this.loaded=!0);e.value!==this.value&&(e.value=this.value)}else"true"===this.value?e.checked=!0:e.checked=!1}async _loadForeFromUrl(){console.log("########## loading Fore from ",this.src,"##########");try{const e=await fetch(this.url,{method:"GET",mode:"cors",credentials:"include",headers:{"Content-Type":"text/html"}}),t=e.headers.get("content-type").toLowerCase();let n;console.log("********** responseContentType *********",t),n=t.startsWith("text/html")?await e.text().then((e=>(new DOMParser).parseFromString(e,"text/html"))):"done";const r=n.querySelector("fx-fore");r.classList.add("widget");const o=this.querySelector("input");this.hasAttribute("shadow")?(o.parentNode.removeChild(o),this.shadowRoot.appendChild(r)):o.replaceWith(r),console.log(`########## loaded fore as component ##### ${this.url}`),r.addEventListener("model-construct-done",(e=>{console.log("subcomponent ready",e.target);const t=r.querySelector("fx-instance");if(console.log("defaultInst",t),this.initialNode){const e=(new DOMParser).parseFromString("<data></data>","application/xml");e.firstElementChild.appendChild(this.initialNode.cloneNode(!0)),t.setInstanceData(e)}console.log("new data",t.getInstanceData()),r.getModel().updateModel(),r.refresh()}),{once:!0}),r||this.dispatchEvent(new CustomEvent("error",{detail:{message:`Fore element not found in '${this.src}'. Maybe wrapped within 'template' element?`}})),console.log("loaded"),this.dispatchEvent(new CustomEvent("loaded",{detail:{fore:r}}))}catch(e){console.log("error",e),this.getOwnerForm().dispatchEvent(new CustomEvent("error",{detail:{message:`${this.url} not found`}}))}}getTemplate(){return this.querySelector("template")}async refresh(e){super.refresh(e);const t=this.getWidget();this._handleBoundWidget(t),rt.refreshChildren(this,e)}_handleBoundWidget(e){if(e&&e.hasAttribute("ref")){const t=e.getAttribute("ref"),n=mt(t,St(this,t),this);if(Array.isArray(n)&&0===n.length)return;const{children:r}=e;if(Array.from(r).forEach((e=>{"template"!==e.nodeName.toLowerCase()&&e.parentNode.removeChild(e)})),this.template){if("SELECT"===this.widget.nodeName&&this.widget.hasAttribute("selection")&&"open"===this.widget.getAttribute("selection")){const e=this.template.firstElementChild,t=document.createElement("option");this.widget.insertBefore(t,e)}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)}}}}updateEntry(e,t){if("SELECT"!==this.widget.nodeName)return;const n=this._getValueAttribute(e),r=n.value,o=wt(r.substring(1,r.length-1),t,e);n.value=o,this.value===o&&e.setAttribute("selected","selected");const a=e.textContent,i=wt(a.substring(1,a.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}}customElements.get("fx-control")||window.customElements.define("fx-control",Xt);class Lt extends(Ot(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML="\n <style>\n \n :host {\n display: block;\n }\n \n </style>\n \n <slot></slot>\n \n ",this.getOwnerForm().registerLazyElement(this)}refresh(e){!e&&this.hasAttribute("refresh-on-view")||(this.isBound()&&(this.evalInContext(),this.modelItem=this.getModelItem(),this.modelItem&&!this.modelItem.boundControls.includes(this)&&this.modelItem.boundControls.push(this)),this._getForm().ready&&this.handleModelItemProperties(),rt.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}}customElements.get("fx-container")||window.customElements.define("fx-container",Lt)
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2019 Google LLC
|
|
@@ -39,5 +39,5 @@ var Ln;null==Xn||Xn({LitElement:jn}),(null!==(_n=globalThis.litElementVersions)&
|
|
|
39
39
|
* Copyright 2017 Google LLC
|
|
40
40
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
41
41
|
*/
|
|
42
|
-
console.warn("The main 'lit-element' module entrypoint is deprecated. Please update your imports to use the 'lit' package: 'lit' and 'lit/decorators.ts' or import from 'lit-element/lit-element.ts'. See https://lit.dev/msg/deprecated-import-path for more information.");class $n extends Lt{static get properties(){return{...super.properties,collapse:{type:Boolean,reflect:!0}}}constructor(){super(),this.collapse=!1}render(){return bn`<slot></slot>`}handleModelItemProperties(){this.handleRelevant()}initializeChildren(e){const t=Array.from(e.children);console.log("_initializeChildren ",t),t.forEach((e=>{if(console.log("child ",e),rt.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.get("fx-group")||window.customElements.define("fx-group",$n);class qn extends _t{static get styles(){return Qt`:host{display:block;height:auto;font-size:.8em;font-weight:400;font-style:italic}`}static get properties(){return{...super.properties}}render(){return bn`<slot></slot>`}}customElements.get("fx-hint")||customElements.define("fx-hint",qn);class Yn extends _t{constructor(){super(),this.attachShadow({mode:"open"}),this.valueAttr=this.hasAttribute("value")?this.getAttribute("value"):null,this.readonly=!0}connectedCallback(){this.shadowRoot.innerHTML='\n <style>\n \n :host {\n display: inline-block;\n }\n #widget {\n display: inline-block;\n }\n .label{\n display: inline-block;\n }\n table,tbody{\n width:100%;\n }\n th{\n text-align:left;\n }\n td{\n padding-right:1rem;\n }\n \n </style>\n \n <slot name="label"></slot>\n <span id="value">\n <slot id="main"></slot>\n </span>\n \n ',this.mediatype=this.hasAttribute("mediatype")?this.getAttribute("mediatype"):null,this.addEventListener("slotchange",(e=>{console.log("slotchange ",e)}))}async refresh(){this.ref&&await super.refresh(),this.valueAttr&&(this.value=this.getValue(),await this.updateWidgetValue())}getValue(){try{const e=St(this,this.valueAttr);return this.hasAttribute("html")?mt(this.valueAttr,e,this)[0]:function(e,t,n,r=null,o=n){const a=ht(e,t,n);return Qe(e,t,r,{},{currentContext:{formElement:n},functionNameResolver:ft,moduleImports:{xf:ot},namespaceResolver:a})}(this.valueAttr,e,this)[0]}catch(e){console.error(e),rt.dispatch(this,"error",{message:e})}return null}getWidget(){return this.shadowRoot.getElementById("value")}handleReadonly(){this.setAttribute("readonly","readonly")}async updateWidgetValue(){console.log("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!0}}customElements.get("fx-output")||customElements.define("fx-output",Yn);class Vn extends(Ot(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 <slot></slot>\n \n ",this.getOwnerForm().registerLazyElement(this)}disconnectedCallback(){this.removeEventListener("click",this._dispatchIndexChange()),this.removeEventListener("focusin",this._handleFocus)}init(){this.inited=!0}refresh(e){this.modelItem=this.getModelItem(),this.modelItem.boundControls.includes(this)||this.modelItem.boundControls.push(this),this.modelItem&&!this.modelItem.relevant?this.style.display="none":this.style.display=this.display,rt.refreshChildren(this,e)}}customElements.get("fx-repeatitem")||window.customElements.define("fx-repeatitem",Vn);class Qn extends(Ot(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})),document.addEventListener("index-changed",(e=>{if(e.stopPropagation(),!e.target===this)return;console.log("handle index event ",e);const{index:t}=e.detail;this.index=Number(t),this.applyIndex(this.children[t-1])})),this.mutationObserver=new MutationObserver((e=>{if(console.log("mutations",e),"childList"===e[0].type){const t=e[0].addedNodes[0];if(t){const e=et.getPath(t);console.log("path mutated",e),rt.dispatch(this,"path-mutated",{path:e,index:this.index})}}})),this.getOwnerForm().registerLazyElement(this);this.shadowRoot.innerHTML='\n <style>\n \n :host{\n }\n .fade-out-bottom {\n -webkit-animation: fade-out-bottom 0.7s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;\n animation: fade-out-bottom 0.7s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;\n }\n .fade-out-bottom {\n -webkit-animation: fade-out-bottom 0.7s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;\n animation: fade-out-bottom 0.7s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;\n }\n \n </style>\n \n <slot name="header"></slot>\n <slot></slot>\n \n '}init(){this._evalNodeset(),this._initTemplate(),this._initRepeatItems(),this.setAttribute("index",this.index),this.inited=!0}_evalNodeset(){const e=St(this.getAttributeNode("ref")||this,this.ref);this.mutationObserver&&e.nodeName&&this.mutationObserver.observe(e,{childList:!0,subtree:!0});const t=mt(this.ref,e,this);1===t.length&&Array.isArray(t[0])?this.nodeset=t[0]:this.nodeset=t}async refresh(e){this.inited||this.init(),console.time("repeat-refresh",this),this._evalNodeset();const t=this.querySelectorAll(":scope > fx-repeatitem"),n=t.length;let r=1;Array.isArray(this.nodeset)&&(r=this.nodeset.length);const o=r;if(o<n)for(let e=n;e>o;e-=1){const n=t[e-1];n.parentNode.removeChild(n),this.getOwnerForm().unRegisterLazyElement(n)}if(o>n)for(let e=n+1;e<=o;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;e<n;e+=1){const n=t[e];this.getOwnerForm().registerLazyElement(n),n.nodeset!==this.nodeset[e]&&(n.nodeset=this.nodeset[e])}this.getOwnerForm().lazyRefresh&&!e||rt.refreshChildren(this,e),this.setIndex(this.index),console.timeEnd("repeat-refresh"),console.groupEnd()}_fadeOut(e){e.style.opacity=1,function t(){(e.style.opacity-=.1)<0?e.style.display="none":requestAnimationFrame(t)}()}_fadeIn(e){e&&(e.style.opacity=0,e.style.display=this.display,function t(){let n=parseFloat(e.style.opacity);(n+=.1)>1||(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)}}customElements.get("fx-repeat")||window.customElements.define("fx-repeat",Qn);class Jn extends Lt{connectedCallback(){super.connectedCallback&&super.connectedCallback();this.shadowRoot.innerHTML="\n <style>\n \n :host ::slotted(fx-case.selected-case){\n display: block !important;\n }\n \n </style>\n \n <slot></slot>\n \n "}refresh(){super.refresh(),console.log("refresh on switch ");const e=this.querySelectorAll(":scope > 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(":scope > .selected-case")||e[0].classList.add("selected-case")}rt.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.get("fx-switch")||window.customElements.define("fx-switch",Jn);class Kn extends _t{connectedCallback(){this.attachShadow({mode:"open"}),this.ref=this.hasAttribute("ref")?this.getAttribute("ref"):null;this.shadowRoot.innerHTML=`\n <style>\n \n :host {\n cursor:pointer;\n }\n \n </style>\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 <slot></slot>\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()),this.querySelectorAll("fx-var").forEach((e=>e.refresh()));(async()=>{for(let t=0;t<this.children.length;t+=1){const n=this.children[t];"function"==typeof n.execute&&await n.execute(e)}})()}}customElements.get("fx-trigger")||customElements.define("fx-trigger",Kn);class zn extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.hasAttribute("label")&&(this.label=this.getAttribute("label")),this.hasAttribute("name")&&(this.name=this.getAttribute("name")),this.hasAttribute("selected")&&(this.selected=this.getAttribute("selected"));const e=`\n ${this.label?`<span>${this.label}</span>`:""}\n <slot></slot>\n `;this.shadowRoot.innerHTML=`\n <style>\n \n :host {\n visibility: none;\n }\n \n </style>\n ${e}\n `}}customElements.get("fx-case")||window.customElements.define("fx-case",zn);class Wn extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const e=this.closest("fx-fore");this.render("\n :host {\n position:absolute;\n display: block;\n width:var(--inspector-handle-width);\n background:var(--inspector-bg);\n top:0;\n right:0;\n bottom:0;\n height: 100%;\n background: var(--inspector-bg);\n color: white;\n /*max-height: 33%;*/\n overflow: scroll;\n transition:width 0.3s ease;\n }\n :host([open]){\n width: 30%;\n }\n details{\n margin:1rem;\n }\n .main{\n padding-left:var(--inspector-handle-width);\n color:var(--inspector-color);\n overflow:scroll;\n height:100%;\n }\n pre{\n background:var(--inspector-pre-bg);\n color:var(--inspector-color);\n overflow:scroll;\n padding:0.2rem;\n }\n .handle{\n display:block;\n height:100%;\n width:var(--inspector-handle-width);\n background:var(--inspector-handle-bg);\n opacity:0.7;\n position:absolute;\n left:0;\n color:white;\n cursor:pointer;\n }\n .handle:hover{\n opacity:1;\n }\n .handle::before{\n content: 'Data Inspector';\n white-space: nowrap;\n transform: rotate(-90deg);\n display: inline-block;\n position: absolute;\n left: -85px;\n width: 200px;\n top: 40px;\n }\n summary{\n cursor:pointer;\n }\n "),e.addEventListener("refresh-done",(()=>{this.update()}))}update(){const e=this.shadowRoot.querySelectorAll("pre"),t=this.closest("fx-fore");Array.from(e).forEach((e=>{const n=t.getModel().getInstance(e.getAttribute("id"));"xml"===n.type&&(e.innerText=this.serializeDOM(n.instanceData)),"json"===n.type&&(e.innerText=JSON.stringify(n.instanceData,void 0,2))}))}render(e){const t=this.closest("fx-fore"),n=Array.from(t.querySelectorAll("fx-instance"));this.shadowRoot.innerHTML=`\n <style>\n ${e}\n </style>\n <div class="main">\n <slot></slot>\n <span class="handle"></span>\n ${n.map(((e,t)=>`\n <details>\n <summary>${e.id}</summary>\n <pre id="${e.id}"></pre>\n </details>\n `))}\n </div>\n `}serializeDOM(e){const t=(new XMLSerializer).serializeToString(e);return rt.prettifyXml(t)}}customElements.get("fx-inspector")||customElements.define("fx-inspector",Wn);class Zn 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",(()=>{this.classList.remove("show")})),this.addEventListener("transitionend",(()=>{console.log("transitionend")})),this.focus()}render(e){return`\n <style>\n ${e}\n </style>\n <slot></slot>\n `}open(){window.addEventListener("keyup",(e=>{"Escape"===e.key&&this.hide()}),{once:!0}),this.classList.add("show")}async hide(){await rt.fadeOutElement(this,400),this.classList.remove("show")}}customElements.get("fx-dialog")||customElements.define("fx-dialog",Zn);class er extends Xt{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=ct(e.target.getAttribute("for"),this),n.checked=!n.checked);let r="";Array.from(t).forEach((e=>{e.checked&&(r+=` ${e.getAttribute("value")}`)})),this.setAttribute("value",r.trim());const o=rt.getClosest("[ref]",this.parentNode);if(!o)return;const a=o.getModelItem(),i=this.shadowRoot.getElementById("setvalue");i.setValue(a,r.trim()),i.actionPerformed()}))}getWidget(){return this}async updateWidgetValue(){const e=rt.getClosest("[ref]",this.parentNode);e&&(this.value=e.value),this.setAttribute("value",this.value)}updateEntry(e,t){const n=e.querySelector("label");n.textContent=t.textContent;const r=rt.createUUID();n.setAttribute("for",r);const o=e.querySelector("[value]"),a=o.value,i=wt(a.substring(1,a.length-1),t,e),s=` ${i} `,u=` ${this.getAttribute("value")} `;o.value=i,o.setAttribute("id",r),-1!==u.indexOf(s)&&(o.checked=!0)}}async function tr(e){return new Promise((t=>setTimeout((()=>t()),e)))}customElements.get("fx-items")||customElements.define("fx-items",er);class nr extends(Ot(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=ct(this.target,this),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.code){const t=new Map;t.set("code",e.code),this.setInScopeVariables(t)}if(e&&e.detail){this.detail=e.detail;const t=new Map;Object.keys(e.detail).forEach((function(n,r){t.set(n,e.detail[n])})),console.log("event detail vars",t),this.setInScopeVariables(t)}if(this.needsUpdate=!1,this.evalInContext(),this.targetElement&&this.targetElement.nodeset&&(this.nodeset=this.targetElement.nodeset),!this.ifExpr||vt(this.ifExpr,St(this),this)){if(this.whileExpr){const e=async()=>{await tr(this.delay||0),this.ownerDocument.contains(this)&&vt(this.whileExpr,St(this),this)&&(this.perform(),await e())};return await e(),void this.actionPerformed()}!this.delay||(await tr(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(){console.log("action-performed ",this),rt.dispatch(this,"action-performed",{})}}customElements.get("abstract-action")||window.customElements.define("abstract-action",nr);class rr extends nr{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),o=this._generateInstance(n.content,r);e.appendChild(o)}_dispatch(){const e=ct(this.repeat,this);console.log("dispatching index change ",e.nodeset.length),rt.dispatch(e,"index-changed",{index:e.nodeset.length})}_clear(e){let t=e.firstChild;const n=e.attributes;for(let e=0;e<n.length;e+=1)n[e].value="";for(;t;)1===t.nodeType&&t.hasAttributes()&&(t.textContent=""),this._clear(t),t=t.nextSibling}_generateInstance(e,t){if(1===e.nodeType&&e.hasAttribute("ref")){const n=e.getAttribute("ref");let r;"."===n||(n.startsWith("@")?t.setAttribute(n.substring(1),""):(r=document.createElement(n),t.appendChild(r),0===e.children.length&&(r.textContent=e.textContent)))}if(e.hasChildNodes()){const n=e.children;for(let e=0;e<n.length;e+=1)this._generateInstance(n[e],t)}return t}getInstanceId(){return this.ref.startsWith("instance(")?"not implemented":"default"}}customElements.get("fx-append")||window.customElements.define("fx-append",rr);class or extends nr{constructor(){super(),this.repeatId=""}perform(){if(super.perform(),console.log("##### fx-delete executing..."),console.log("delete nodeset ",this.nodeset),""===this.repeatId){const e=rt.getClosest("fx-repeatitem",this.parentNode),t=Array.from(e.parentNode.children).indexOf(e)+1;this.model=this.getModel();const n=rt.getClosest("fx-repeat",this.parentNode);let r;r=Array.isArray(this.nodeset)?this.nodeset[t-1]:this.nodeset;r.parentNode.removeChild(r),e.parentNode.removeChild(e);const{repeatSize:o}=n;1===t||1===o?n.setIndex(1):t>o?n.setIndex(o):n.setIndex(t)}this.needsUpdate=!0}actionPerformed(){this.getModel().rebuild(),super.actionPerformed()}}customElements.get("fx-delete")||window.customElements.define("fx-delete",or);class ar extends nr{connectedCallback(){super.connectedCallback(),this.control=this.hasAttribute("control")?this.getAttribute("control"):null}perform(){console.log("setting focus",this.control);const e="#"+this.control;let t=document.querySelector(e);const n=t.closest("fx-repeatitem, .fx-repeatitem");if(n){t=n.parentNode.querySelector("[repeat-index] "+e)}t.getWidget().focus()}}customElements.get("fx-setfocus")||window.customElements.define("fx-setfocus",ar);class ir extends nr{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback&&super.connectedCallback();this.shadowRoot.innerHTML="\n <style>\n \n :host{\n display:none;\n }\n \n </style>\n <slot></slot>\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=gt(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")?At(this.getAttribute("at"),e,this.getOwnerForm()):t.length}perform(){let e,t;this.hasAttribute("context")&&(e=St(this.getAttributeNode("context"),this.getAttribute("context")),t=yt(this.getAttribute("context"),e,this.getOwnerForm())),this.hasAttribute("ref")&&(e||(e=St(this.getAttributeNode("ref"),this.ref)),t=yt(this.ref,e,this.getOwnerForm()));const n=this._cloneOriginSequence(e,t);if(!n)return;let r,o;if(0===t.length)r=e,e.appendChild(n),o=1,console.log("appended",e);else{if(this.hasAttribute("at")?(o=At(this.getAttribute("at"),e,this.getOwnerForm()),r=t[o-1]):(o=t.length,r=t[t.length-1]),!r){o=1,r=t;o=At("count(preceding::*)",t,this.getOwnerForm())+1}this.position&&"before"===this.position&&r.parentNode.insertBefore(n,r),this.position&&"after"===this.position&&(o+=1,this.hasAttribute("context")&&this.hasAttribute("ref")?e.append(n):this.hasAttribute("context")?(o=1,r.prepend(n)):r.insertAdjacentElement("afterend",n))}console.log("<<<<<<< at",this.at),console.log("<<<<<<< index",o),document.dispatchEvent(new CustomEvent("index-changed",{composed:!0,bubbles:!0,detail:{insertedNodes:n,index:o}})),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<t.length;e+=1)t[e].value="";e.textContent&&(e.textContent="");let n=e.firstChild;for(;n;)1===n.nodeType&&n.hasAttributes()&&(n.textContent=""),this._clear(n),n=n.nextSibling}}customElements.get("fx-insert")||window.customElements.define("fx-insert",ir);class sr extends nr{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback(),this.event=this.hasAttribute("event")?this.getAttribute("event"):"",this.level=this.hasAttribute("level")?this.getAttribute("level"):"ephemeral";this.shadowRoot.innerHTML=`\n <style>\n \n :host{\n display:none;\n }\n \n </style>\n ${this.renderHTML()}\n `}disconnectedCallback(){this.targetElement.removeEventListener(this.event,(e=>this.execute(e)))}renderHTML(){return"\n <slot></slot>\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}}))}}customElements.get("fx-message")||window.customElements.define("fx-message",sr);class ur extends nr{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;null!==this.valueAttr?[e]=mt(this.valueAttr,this.nodeset,this,this.detail):e=""!==this.textContent?this.textContent:"",console.log("value",e),e.nodeType===Node.ATTRIBUTE_NODE&&(console.log("value",e.nodeValue),e=e.nodeValue);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,this.getModel().changed.push(e),this.needsUpdate=!0,console.log("setvalue[2] ",n,t))}}customElements.get("fx-setvalue")||window.customElements.define("fx-setvalue",ur);class cr extends nr{constructor(){super(),this.value=""}connectedCallback(){super.connectedCallback(),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()}}customElements.get("fx-send")||window.customElements.define("fx-send",cr);class lr extends nr{connectedCallback(){super.connectedCallback(),this.hasAttribute("case")&&(this.case=this.getAttribute("case"))}perform(){if(super.perform(),console.log("### fx-toggle.execute "),this.case){const e=this.getOwnerForm().querySelector(`#${this.case}`);e.parentNode.toggle(e)}}}customElements.get("fx-toggle")||window.customElements.define("fx-toggle",lr);class pr extends nr{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"),o=e.getAttribute("expr");if(o){if(r)throw new Error('if "expr" is given there must not be a "value" attribute');const[e]=mt(o,this.getInScopeContext(),this.getOwnerForm());let a=null;if(e.nodeName){a=(new XMLSerializer).serializeToString(e)}t[n]=a||e}r&&(t[n]=r)})),console.log("details ",t),this.targetid){let e=ct(this.targetid,this.parentNode,null);if(e||(e=document.getElementById(this.targetid)),console.log("target",e),!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}))}}customElements.get("fx-dispatch")||window.customElements.define("fx-dispatch",pr);class hr extends nr{perform(){this.getModel().updateModel()}}customElements.get("fx-update")||window.customElements.define("fx-update",hr);class fr extends nr{perform(){if(this.hasAttribute("self")){const e=rt.getClosest("fx-control",this);if(e)return void e.refresh()}this.hasAttribute("force")?this.getOwnerForm().forceRefresh():this.getOwnerForm().refresh()}}customElements.get("fx-refresh")||window.customElements.define("fx-refresh",fr);class dr extends nr{static get properties(){return{...super.properties,with:{type:String},replaceNode:Object}}constructor(){super(),this.with=""}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.with=this.getAttribute("with")}perform(){super.perform(),console.log("replace action");const e=gt(this.with,this.nodeset,this);e&&this.replace(this.nodeset,e)}replace(e,t){if(e&&t)if(e.nodeName&&t.nodeName){if(e.nodeType===Node.ATTRIBUTE_NODE){const{ownerElement:n}=e;n.setAttribute(t.nodeName,t.textContent),n.removeAttribute(e.nodeName),console.log("owner",n)}else if(e.nodeType===Node.ELEMENT_NODE){const n=t.cloneNode(!0);e.replaceWith(n)}this.needsUpdate=!0}else console.warn("fx-replace: one argument is not a node")}}customElements.get("fx-replace")||window.customElements.define("fx-replace",dr);class mr extends nr{connectedCallback(){super.connectedCallback&&super.connectedCallback()}perform(){super.perform(),console.log("performing return with nodes",this.nodeset);const e=new CustomEvent("return",{composed:!0,bubbles:!0,detail:{nodeset:this.nodeset}});this.getOwnerForm().dispatchEvent(e)}}customElements.get("fx-return")||window.customElements.define("fx-return",mr);class gr extends nr{connectedCallback(){this.message=this.hasAttribute("message")?this.getAttribute("message"):null}perform(){window.confirm(this.message)&&super.perform()}}customElements.get("fx-confirm")||window.customElements.define("fx-confirm",gr);class yr extends nr{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.src=this.hasAttribute("src")?this.getAttribute("src"):null;this.shadowRoot.innerHTML="\n <style>\n \n :host{\n display:none;\n }\n \n </style>\n <slot></slot>\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=>{if("fx-var"===e.localName)return;const t=e;t.detail=this.detail,t.perform()})),this.dispatchActionPerformed(),this.needsUpdate=!0}}customElements.get("fx-action")||window.customElements.define("fx-action",yr);class vr extends yr{connectedCallback(){this.dialog=this.getAttribute("dialog"),this.dialog||rt.dispatch(this,"error",{message:"dialog does not exist"})}perform(){const e=ct(this.dialog,this);e||console.error("target dialog with given id does not exist",this.dialog),e.open()}}customElements.get("fx-show")||window.customElements.define("fx-show",vr);class wr extends nr{connectedCallback(){this.dialog=this.getAttribute("dialog"),this.dialog||rt.dispatch(this,"error",{message:"dialog does not exist"})}perform(){ct(this.dialog,this).hide()}}customElements.get("fx-hide")||window.customElements.define("fx-hide",wr);class Ar extends(Ot(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="<slot></slot>",this.override=this.hasAttribute("override")?this.getAttribute("override"):"true",this.functionBody=this.innerText;const e=this.getAttribute("type")||"text/xpath",t=this.signature.match(/(?:(?<prefix>[^:]*):)?(?<localName>[^(]+)\((?<params>(?:\(\)|[^)])*)\)(?: as (?<returnType>.*))?/);if(!t)throw new Error(`Function signature ${this.signature} could not be parsed`);const{prefix:n,localName:r,params:o,returnType:a}=t.groups,i="local"!==n&&n?`${n}:${r}`:{namespaceURI:"http://www.w3.org/2005/xquery-local-functions",localName:r};n||it.push(r);const s=o?o.split(",").map((e=>{const t=e.match(/(?<variableName>\$[^\s]+)(?:\sas\s(?<varType>.+))/);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);ze(i,s.map((e=>e.variableType)),a||"item()*",((...t)=>e.apply(this.getInScopeContext(),[...t,this.getOwnerForm()])));break}case"text/xquf":case"text/xquery":case"text/xpath":{const t="text/xpath"===e?"XPath3.1":"text/xquery"===e?"XQuery3.1":"XQueryUpdate3.1",n=(e,...n)=>mt(this.functionBody,this.getInScopeContext(),this.getOwnerForm(),s.reduce(((e,t,r)=>(e[t.variableName.replace("$","")]=n[r],e)),{}),{language:t});ze(i,s.map((e=>e.variableType)),a||"item()*",n);break}default:throw new Error(`Unexpected mimetype ${e} for function`)}}}customElements.get("fx-function")||customElements.define("fx-function",Ar);
|
|
42
|
+
console.warn("The main 'lit-element' module entrypoint is deprecated. Please update your imports to use the 'lit' package: 'lit' and 'lit/decorators.ts' or import from 'lit-element/lit-element.ts'. See https://lit.dev/msg/deprecated-import-path for more information.");class $n extends Lt{static get properties(){return{...super.properties,collapse:{type:Boolean,reflect:!0}}}constructor(){super(),this.collapse=!1}render(){return bn`<slot></slot>`}handleModelItemProperties(){this.handleRelevant()}initializeChildren(e){const t=Array.from(e.children);console.log("_initializeChildren ",t),t.forEach((e=>{if(console.log("child ",e),rt.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.get("fx-group")||window.customElements.define("fx-group",$n);class qn extends _t{static get styles(){return Qt`:host{display:block;height:auto;font-size:.8em;font-weight:400;font-style:italic}`}static get properties(){return{...super.properties}}render(){return bn`<slot></slot>`}}customElements.get("fx-hint")||customElements.define("fx-hint",qn);class Yn extends _t{constructor(){super(),this.attachShadow({mode:"open"}),this.valueAttr=this.hasAttribute("value")?this.getAttribute("value"):null,this.readonly=!0}connectedCallback(){this.shadowRoot.innerHTML='\n <style>\n \n :host {\n display: inline-block;\n }\n #widget {\n display: inline-block;\n }\n .label{\n display: inline-block;\n }\n table,tbody{\n width:100%;\n }\n th{\n text-align:left;\n }\n td{\n padding-right:1rem;\n }\n \n </style>\n \n <slot name="label"></slot>\n <span id="value">\n <slot id="main"></slot>\n </span>\n \n ',this.mediatype=this.hasAttribute("mediatype")?this.getAttribute("mediatype"):null}async refresh(){this.ref&&await super.refresh(),this.valueAttr&&(this.value=this.getValue(),await this.updateWidgetValue())}getValue(){try{const e=St(this,this.valueAttr);return this.hasAttribute("html")?mt(this.valueAttr,e,this)[0]:function(e,t,n,r=null,o=n){const a=ht(e,t,n);return Qe(e,t,r,{},{currentContext:{formElement:n},functionNameResolver:ft,moduleImports:{xf:ot},namespaceResolver:a})}(this.valueAttr,e,this)[0]}catch(e){console.error(e),rt.dispatch(this,"error",{message:e})}return null}getWidget(){return this.shadowRoot.getElementById("value")}handleReadonly(){this.setAttribute("readonly","readonly")}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!0}}customElements.get("fx-output")||customElements.define("fx-output",Yn);class Vn extends(Ot(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 <slot></slot>\n \n ",this.getOwnerForm().registerLazyElement(this)}disconnectedCallback(){this.removeEventListener("click",this._dispatchIndexChange()),this.removeEventListener("focusin",this._handleFocus)}init(){this.inited=!0}refresh(e){this.modelItem=this.getModelItem(),this.modelItem.boundControls.includes(this)||this.modelItem.boundControls.push(this),this.modelItem&&!this.modelItem.relevant?this.style.display="none":this.style.display=this.display,rt.refreshChildren(this,e)}}customElements.get("fx-repeatitem")||window.customElements.define("fx-repeatitem",Vn);class Qn extends(Ot(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})),document.addEventListener("index-changed",(e=>{if(e.stopPropagation(),!e.target===this)return;console.log("handle index event ",e);const{index:t}=e.detail;this.index=Number(t),this.applyIndex(this.children[t-1])})),this.mutationObserver=new MutationObserver((e=>{if(console.log("mutations",e),"childList"===e[0].type){const t=e[0].addedNodes[0];if(t){const e=et.getPath(t);console.log("path mutated",e),rt.dispatch(this,"path-mutated",{path:e,index:this.index})}}})),this.getOwnerForm().registerLazyElement(this);this.shadowRoot.innerHTML='\n <style>\n \n :host{\n }\n .fade-out-bottom {\n -webkit-animation: fade-out-bottom 0.7s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;\n animation: fade-out-bottom 0.7s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;\n }\n .fade-out-bottom {\n -webkit-animation: fade-out-bottom 0.7s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;\n animation: fade-out-bottom 0.7s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;\n }\n \n </style>\n \n <slot name="header"></slot>\n <slot></slot>\n \n '}init(){this._evalNodeset(),this._initTemplate(),this._initRepeatItems(),this.setAttribute("index",this.index),this.inited=!0}_evalNodeset(){const e=St(this.getAttributeNode("ref")||this,this.ref);this.mutationObserver&&e.nodeName&&this.mutationObserver.observe(e,{childList:!0,subtree:!0});const t=mt(this.ref,e,this);1===t.length&&Array.isArray(t[0])?this.nodeset=t[0]:this.nodeset=t}async refresh(e){this.inited||this.init(),console.time("repeat-refresh",this),this._evalNodeset();const t=this.querySelectorAll(":scope > fx-repeatitem"),n=t.length;let r=1;Array.isArray(this.nodeset)&&(r=this.nodeset.length);const o=r;if(o<n)for(let e=n;e>o;e-=1){const n=t[e-1];n.parentNode.removeChild(n),this.getOwnerForm().unRegisterLazyElement(n)}if(o>n)for(let e=n+1;e<=o;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;e<n;e+=1){const n=t[e];this.getOwnerForm().registerLazyElement(n),n.nodeset!==this.nodeset[e]&&(n.nodeset=this.nodeset[e])}this.getOwnerForm().lazyRefresh&&!e||rt.refreshChildren(this,e),this.setIndex(this.index),console.timeEnd("repeat-refresh"),console.groupEnd()}_fadeOut(e){e.style.opacity=1,function t(){(e.style.opacity-=.1)<0?e.style.display="none":requestAnimationFrame(t)}()}_fadeIn(e){e&&(e.style.opacity=0,e.style.display=this.display,function t(){let n=parseFloat(e.style.opacity);(n+=.1)>1||(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)}}customElements.get("fx-repeat")||window.customElements.define("fx-repeat",Qn);class Jn extends Lt{connectedCallback(){super.connectedCallback&&super.connectedCallback();this.shadowRoot.innerHTML="\n <style>\n \n :host ::slotted(fx-case.selected-case){\n display: block !important;\n }\n \n </style>\n \n <slot></slot>\n \n "}refresh(){super.refresh(),console.log("refresh on switch ");const e=this.querySelectorAll(":scope > 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(":scope > .selected-case")||e[0].classList.add("selected-case")}rt.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.get("fx-switch")||window.customElements.define("fx-switch",Jn);class Kn extends _t{connectedCallback(){this.attachShadow({mode:"open"}),this.ref=this.hasAttribute("ref")?this.getAttribute("ref"):null;this.shadowRoot.innerHTML=`\n <style>\n \n :host {\n cursor:pointer;\n }\n \n </style>\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 <slot></slot>\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()),this.querySelectorAll("fx-var").forEach((e=>e.refresh()));(async()=>{for(let t=0;t<this.children.length;t+=1){const n=this.children[t];"function"==typeof n.execute&&await n.execute(e)}})()}}customElements.get("fx-trigger")||customElements.define("fx-trigger",Kn);class zn extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.hasAttribute("label")&&(this.label=this.getAttribute("label")),this.hasAttribute("name")&&(this.name=this.getAttribute("name")),this.hasAttribute("selected")&&(this.selected=this.getAttribute("selected"));const e=`\n ${this.label?`<span>${this.label}</span>`:""}\n <slot></slot>\n `;this.shadowRoot.innerHTML=`\n <style>\n \n :host {\n visibility: none;\n }\n \n </style>\n ${e}\n `}}customElements.get("fx-case")||window.customElements.define("fx-case",zn);class Wn extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const e=this.closest("fx-fore");this.render("\n :host {\n position:absolute;\n display: block;\n width:var(--inspector-handle-width);\n background:var(--inspector-bg);\n top:0;\n right:0;\n bottom:0;\n height: 100%;\n background: var(--inspector-bg);\n color: white;\n /*max-height: 33%;*/\n overflow: scroll;\n transition:width 0.3s ease;\n }\n :host([open]){\n width: 30%;\n }\n details{\n margin:1rem;\n }\n .main{\n padding-left:var(--inspector-handle-width);\n color:var(--inspector-color);\n overflow:scroll;\n height:100%;\n }\n pre{\n background:var(--inspector-pre-bg);\n color:var(--inspector-color);\n overflow:scroll;\n padding:0.2rem;\n }\n .handle{\n display:block;\n height:100%;\n width:var(--inspector-handle-width);\n background:var(--inspector-handle-bg);\n opacity:0.7;\n position:absolute;\n left:0;\n color:white;\n cursor:pointer;\n }\n .handle:hover{\n opacity:1;\n }\n .handle::before{\n content: 'Data Inspector';\n white-space: nowrap;\n transform: rotate(-90deg);\n display: inline-block;\n position: absolute;\n left: -85px;\n width: 200px;\n top: 40px;\n }\n summary{\n cursor:pointer;\n }\n "),e.addEventListener("refresh-done",(()=>{this.update()}))}update(){const e=this.shadowRoot.querySelectorAll("pre"),t=this.closest("fx-fore");Array.from(e).forEach((e=>{const n=t.getModel().getInstance(e.getAttribute("id"));"xml"===n.type&&(e.innerText=this.serializeDOM(n.instanceData)),"json"===n.type&&(e.innerText=JSON.stringify(n.instanceData,void 0,2))}))}render(e){const t=this.closest("fx-fore"),n=Array.from(t.querySelectorAll("fx-instance"));this.shadowRoot.innerHTML=`\n <style>\n ${e}\n </style>\n <div class="main">\n <slot></slot>\n <span class="handle"></span>\n ${n.map(((e,t)=>`\n <details>\n <summary>${e.id}</summary>\n <pre id="${e.id}"></pre>\n </details>\n `))}\n </div>\n `;this.shadowRoot.querySelector(".handle").addEventListener("click",(e=>{this.hasAttribute("open")?this.removeAttribute("open"):this.setAttribute("open","open")}))}serializeDOM(e){const t=(new XMLSerializer).serializeToString(e);return rt.prettifyXml(t)}}customElements.get("fx-inspector")||customElements.define("fx-inspector",Wn);class Zn 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",(()=>{this.classList.remove("show")})),this.addEventListener("transitionend",(()=>{console.log("transitionend")})),this.focus()}render(e){return`\n <style>\n ${e}\n </style>\n <slot></slot>\n `}open(){window.addEventListener("keyup",(e=>{"Escape"===e.key&&this.hide()}),{once:!0}),this.classList.add("show")}async hide(){await rt.fadeOutElement(this,400),this.classList.remove("show")}}customElements.get("fx-dialog")||customElements.define("fx-dialog",Zn);class er extends Xt{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=ct(e.target.getAttribute("for"),this),n.checked=!n.checked);let r="";Array.from(t).forEach((e=>{e.checked&&(r+=` ${e.getAttribute("value")}`)})),this.setAttribute("value",r.trim());const o=rt.getClosest("[ref]",this.parentNode);if(!o)return;const a=o.getModelItem(),i=this.shadowRoot.getElementById("setvalue");i.setValue(a,r.trim()),i.actionPerformed()}))}getWidget(){return this}async updateWidgetValue(){const e=rt.getClosest("[ref]",this.parentNode);e&&(this.value=e.value),this.setAttribute("value",this.value)}updateEntry(e,t){const n=e.querySelector("label");n.textContent=t.textContent;const r=rt.createUUID();n.setAttribute("for",r);const o=e.querySelector("[value]"),a=o.value,i=wt(a.substring(1,a.length-1),t,e),s=` ${i} `,u=` ${this.getAttribute("value")} `;o.value=i,o.setAttribute("id",r),-1!==u.indexOf(s)&&(o.checked=!0)}}async function tr(e){return new Promise((t=>setTimeout((()=>t()),e)))}customElements.get("fx-items")||customElements.define("fx-items",er);class nr extends(Ot(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=ct(this.target,this),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.code){const t=new Map;t.set("code",e.code),this.setInScopeVariables(new Map([...t,...this.inScopeVariables]))}if(e&&e.detail){this.detail=e.detail;const t=new Map;Object.keys(e.detail).forEach((function(n,r){t.set(n,e.detail[n])})),console.log("event detail vars",t),this.setInScopeVariables(new Map([...t,...this.inScopeVariables]))}this.needsUpdate=!1;try{this.evalInContext()}catch(e){console.warn("evaluation faild",e)}if(this.targetElement&&this.targetElement.nodeset&&(this.nodeset=this.targetElement.nodeset),!this.ifExpr||vt(this.ifExpr,St(this),this)){if(this.whileExpr){const e=async()=>{await tr(this.delay||0),this.ownerDocument.contains(this)&&vt(this.whileExpr,St(this),this)&&(this.perform(),await e())};return await e(),this.actionPerformed(),void rt.dispatch(this,"while-performed",{})}!this.delay||(await tr(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(){console.log("action-performed ",this),rt.dispatch(this,"action-performed",{})}}customElements.get("abstract-action")||window.customElements.define("abstract-action",nr);class rr extends nr{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),o=this._generateInstance(n.content,r);e.appendChild(o)}_dispatch(){const e=ct(this.repeat,this);console.log("dispatching index change ",e.nodeset.length),rt.dispatch(e,"index-changed",{index:e.nodeset.length})}_clear(e){let t=e.firstChild;const n=e.attributes;for(let e=0;e<n.length;e+=1)n[e].value="";for(;t;)1===t.nodeType&&t.hasAttributes()&&(t.textContent=""),this._clear(t),t=t.nextSibling}_generateInstance(e,t){if(1===e.nodeType&&e.hasAttribute("ref")){const n=e.getAttribute("ref");let r;"."===n||(n.startsWith("@")?t.setAttribute(n.substring(1),""):(r=document.createElement(n),t.appendChild(r),0===e.children.length&&(r.textContent=e.textContent)))}if(e.hasChildNodes()){const n=e.children;for(let e=0;e<n.length;e+=1)this._generateInstance(n[e],t)}return t}getInstanceId(){return this.ref.startsWith("instance(")?"not implemented":"default"}}customElements.get("fx-append")||window.customElements.define("fx-append",rr);class or extends nr{constructor(){super(),this.repeatId=""}perform(){if(super.perform(),console.log("##### fx-delete executing..."),console.log("delete nodeset ",this.nodeset),""===this.repeatId){const e=rt.getClosest("fx-repeatitem",this.parentNode),t=Array.from(e.parentNode.children).indexOf(e)+1;this.model=this.getModel();const n=rt.getClosest("fx-repeat",this.parentNode);let r;r=Array.isArray(this.nodeset)?this.nodeset[t-1]:this.nodeset;r.parentNode.removeChild(r),e.parentNode.removeChild(e);const{repeatSize:o}=n;1===t||1===o?n.setIndex(1):t>o?n.setIndex(o):n.setIndex(t)}this.needsUpdate=!0}actionPerformed(){this.getModel().rebuild(),super.actionPerformed()}}customElements.get("fx-delete")||window.customElements.define("fx-delete",or);class ar extends nr{connectedCallback(){super.connectedCallback(),this.control=this.hasAttribute("control")?this.getAttribute("control"):null}perform(){console.log("setting focus",this.control);const e="#"+this.control;let t=document.querySelector(e);const n=t.closest("fx-repeatitem, .fx-repeatitem");if(n){t=n.parentNode.querySelector("[repeat-index] "+e)}t.getWidget().focus()}}customElements.get("fx-setfocus")||window.customElements.define("fx-setfocus",ar);class ir extends nr{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback&&super.connectedCallback();this.shadowRoot.innerHTML="\n <style>\n \n :host{\n display:none;\n }\n \n </style>\n <slot></slot>\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=gt(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")?At(this.getAttribute("at"),e,this.getOwnerForm()):t.length}perform(){let e,t;this.hasAttribute("context")&&(e=St(this.getAttributeNode("context"),this.getAttribute("context")),t=yt(this.getAttribute("context"),e,this.getOwnerForm())),this.hasAttribute("ref")&&(e||(e=St(this.getAttributeNode("ref"),this.ref)),t=yt(this.ref,e,this.getOwnerForm()));const n=this._cloneOriginSequence(e,t);if(!n)return;let r,o;if(0===t.length)r=e,e.appendChild(n),o=1,console.log("appended",e);else{if(this.hasAttribute("at")?(o=At(this.getAttribute("at"),e,this.getOwnerForm()),r=t[o-1]):(o=t.length,r=t[t.length-1]),!r){o=1,r=t;o=At("count(preceding::*)",t,this.getOwnerForm())+1}this.position&&"before"===this.position&&r.parentNode.insertBefore(n,r),this.position&&"after"===this.position&&(o+=1,this.hasAttribute("context")&&this.hasAttribute("ref")?e.append(n):this.hasAttribute("context")?(o=1,r.prepend(n)):r.insertAdjacentElement("afterend",n))}console.log("<<<<<<< at",this.at),console.log("<<<<<<< index",o),document.dispatchEvent(new CustomEvent("index-changed",{composed:!0,bubbles:!0,detail:{insertedNodes:n,index:o}})),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<t.length;e+=1)t[e].value="";e.textContent&&(e.textContent="");let n=e.firstChild;for(;n;)1===n.nodeType&&n.hasAttributes()&&(n.textContent=""),this._clear(n),n=n.nextSibling}}customElements.get("fx-insert")||window.customElements.define("fx-insert",ir);class sr extends nr{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback(),this.event=this.hasAttribute("event")?this.getAttribute("event"):"",this.level=this.hasAttribute("level")?this.getAttribute("level"):"ephemeral";this.shadowRoot.innerHTML=`\n <style>\n \n :host{\n display:none;\n }\n \n </style>\n ${this.renderHTML()}\n `}disconnectedCallback(){this.targetElement.removeEventListener(this.event,(e=>this.execute(e)))}renderHTML(){return"\n <slot></slot>\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}}))}}customElements.get("fx-message")||window.customElements.define("fx-message",sr);class ur extends nr{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;null!==this.valueAttr?[e]=mt(this.valueAttr,this.nodeset,this,this.detail):e=""!==this.textContent?this.textContent:"",console.log("value",e),e.nodeType===Node.ATTRIBUTE_NODE&&(console.log("value",e.nodeValue),e=e.nodeValue);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,this.getModel().changed.push(e),this.needsUpdate=!0,console.log("setvalue[2] ",n,t))}}customElements.get("fx-setvalue")||window.customElements.define("fx-setvalue",ur);class cr extends nr{constructor(){super(),this.value=""}connectedCallback(){super.connectedCallback(),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()}}customElements.get("fx-send")||window.customElements.define("fx-send",cr);class lr extends nr{connectedCallback(){super.connectedCallback(),this.hasAttribute("case")&&(this.case=this.getAttribute("case"))}perform(){if(super.perform(),console.log("### fx-toggle.execute "),this.case){const e=this.getOwnerForm().querySelector(`#${this.case}`);e.parentNode.toggle(e)}}}customElements.get("fx-toggle")||window.customElements.define("fx-toggle",lr);class pr extends nr{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"),o=e.getAttribute("expr");if(o){if(r)throw new Error('if "expr" is given there must not be a "value" attribute');const[e]=mt(o,this.getInScopeContext(),this.getOwnerForm());let a=null;if(e.nodeName){a=(new XMLSerializer).serializeToString(e)}t[n]=a||e}r&&(t[n]=r)})),console.log("details ",t),this.targetid){let e=ct(this.targetid,this.parentNode,null);if(e||(e=document.getElementById(this.targetid)),console.log("target",e),!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}))}}customElements.get("fx-dispatch")||window.customElements.define("fx-dispatch",pr);class hr extends nr{perform(){this.getModel().updateModel()}}customElements.get("fx-update")||window.customElements.define("fx-update",hr);class fr extends nr{perform(){if(this.hasAttribute("self")){const e=rt.getClosest("fx-control",this);if(e)return void e.refresh()}if(this.hasAttribute("force"))this.getOwnerForm().forceRefresh();else if(this.hasAttribute("control")){const e=ct(this.getAttribute("control"),this);rt.isUiElement(e.nodeName)&&"function"==typeof e.refresh&&e.refresh()}else this.getOwnerForm().refresh()}}customElements.get("fx-refresh")||window.customElements.define("fx-refresh",fr);class dr extends nr{static get properties(){return{...super.properties,with:{type:String},replaceNode:Object}}constructor(){super(),this.with=""}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.with=this.getAttribute("with")}perform(){super.perform(),console.log("replace action");const e=gt(this.with,this.nodeset,this);e&&this.replace(this.nodeset,e)}replace(e,t){if(console.log("replace",e,t),e&&t)if(e.nodeName&&t.nodeName){if(e.nodeType===Node.ATTRIBUTE_NODE){const{ownerElement:n}=e;n.setAttribute(t.nodeName,t.textContent),n.removeAttribute(e.nodeName),console.log("owner",n)}else if(e.nodeType===Node.ELEMENT_NODE){const n=t.cloneNode(!0);e.replaceWith(n)}this.needsUpdate=!0}else console.warn("fx-replace: one argument is not a node")}}customElements.get("fx-replace")||window.customElements.define("fx-replace",dr);class mr extends nr{connectedCallback(){super.connectedCallback&&super.connectedCallback()}perform(){super.perform(),console.log("performing return with nodes",this.nodeset);const e=new CustomEvent("return",{composed:!0,bubbles:!0,detail:{nodeset:this.nodeset}});this.getOwnerForm().dispatchEvent(e)}}customElements.get("fx-return")||window.customElements.define("fx-return",mr);class gr extends nr{connectedCallback(){this.message=this.hasAttribute("message")?this.getAttribute("message"):null}perform(){window.confirm(this.message)&&super.perform()}}customElements.get("fx-confirm")||window.customElements.define("fx-confirm",gr);class yr extends nr{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.src=this.hasAttribute("src")?this.getAttribute("src"):null;this.shadowRoot.innerHTML="\n <style>\n \n :host{\n display:none;\n }\n \n </style>\n <slot></slot>\n "}perform(){super.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=>{if("fx-var"===e.localName)return;const t=e;t.detail=this.detail,t.perform()})),this.dispatchActionPerformed(),this.needsUpdate=!0}}customElements.get("fx-action")||window.customElements.define("fx-action",yr);class vr extends yr{connectedCallback(){this.dialog=this.getAttribute("dialog"),this.dialog||rt.dispatch(this,"error",{message:"dialog does not exist"})}perform(){const e=ct(this.dialog,this);e||console.error("target dialog with given id does not exist",this.dialog),e.open()}}customElements.get("fx-show")||window.customElements.define("fx-show",vr);class wr extends nr{connectedCallback(){this.dialog=this.getAttribute("dialog"),this.dialog||rt.dispatch(this,"error",{message:"dialog does not exist"})}perform(){ct(this.dialog,this).hide()}}customElements.get("fx-hide")||window.customElements.define("fx-hide",wr);class Ar extends(Ot(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="<slot></slot>",this.override=this.hasAttribute("override")?this.getAttribute("override"):"true",this.functionBody=this.innerText;const e=this.getAttribute("type")||"text/xpath",t=this.signature.match(/(?:(?<prefix>[^:]*):)?(?<localName>[^(]+)\((?<params>(?:\(\)|[^)])*)\)(?: as (?<returnType>.*))?/);if(!t)throw new Error(`Function signature ${this.signature} could not be parsed`);const{prefix:n,localName:r,params:o,returnType:a}=t.groups,i="local"!==n&&n?`${n}:${r}`:{namespaceURI:"http://www.w3.org/2005/xquery-local-functions",localName:r};n||it.push(r);const s=o?o.split(",").map((e=>{const t=e.match(/(?<variableName>\$[^\s]+)(?:\sas\s(?<varType>.+))/);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);ze(i,s.map((e=>e.variableType)),a||"item()*",((...t)=>e.apply(this.getInScopeContext(),[...t,this.getOwnerForm()])));break}case"text/xquf":case"text/xquery":case"text/xpath":{const t="text/xpath"===e?"XPath3.1":"text/xquery"===e?"XQuery3.1":"XQueryUpdate3.1",n=(e,...n)=>mt(this.functionBody,this.getInScopeContext(),this.getOwnerForm(),s.reduce(((e,t,r)=>(e[t.variableName.replace("$","")]=n[r],e)),{}),{language:t});ze(i,s.map((e=>e.variableType)),a||"item()*",n);break}default:throw new Error(`Unexpected mimetype ${e} for function`)}}}customElements.get("fx-function")||customElements.define("fx-function",Ar);
|
|
43
43
|
//# sourceMappingURL=fore-dev.js.map
|