\n \n '}connectedCallback(){this.shadowRoot.querySelector("slot").addEventListener("slotchange",e=>{let t=e.target.assignedElements().find(e=>"FX-MODEL"===e.nodeName.toUpperCase());if(!t){const e=document.createElement("FX-model");this.appendChild(e),t=e}t.inited||(console.log("########## FORE: kick off processing... ##########"),t.modelConstruct()),this.model=t})}evaluateToNodes(e,t){return ke(e,t,this)}disconnectedCallback(){}async refresh(){console.group("### refresh"),Pe.refreshChildren(this),this._updateTemplateExpressions(),console.groupEnd(),console.log("### <<<<< dispatching refresh-done - end of UI update cycle >>>>>"),this.dispatchEvent(new CustomEvent("refresh-done"))}_updateTemplateExpressions(){const e=ke("(descendant-or-self::*/(text(), @*))[matches(.,'\\{.*\\}')] except descendant-or-self::xhtml:fx-model/descendant-or-self::node()/(., @*)",this,this);console.log("template expressions found ",e),Array.from(e).forEach(e=>{if(this.storedTemplateExpressionByNode.has(e))return;const t=this._getTemplateExpression(e);this.storedTemplateExpressionByNode.set(e,t)});for(const e of this.storedTemplateExpressionByNode.keys())this._processTemplateExpression({node:e,expr:this.storedTemplateExpressionByNode.get(e)});console.log("stored template expressions ",this.storedTemplateExpressionByNode)}_processTemplateExpression(e){const{expr:t}=e,{node:n}=e;this.evaluateTemplateExpression(t,n,this)}evaluateTemplateExpression(e,t){if("{}"===e)return;const n=e.match(/{[^}]*}/g),r=t.nodeType===t.TEXT_NODE?t.parentNode:t.ownerElement;n&&n.forEach(n=>{let a=n.substring(1,n.length-1);const i=tt(t,a);if(i)try{const o=qe(a,i,t,null,r),s=e.replaceAll(n,o);if(console.log("result of replacing ",s),t.nodeType===Node.ATTRIBUTE_NODE){t.ownerElement.setAttribute(t.nodeName,s)}else t.nodeType===Node.TEXT_NODE&&(t.textContent=s);s.includes("{")&&(console.log("need to go next round"),a=s.substring(1,s.length),this.evaluateTemplateExpression(s,t))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:e}))}else{const e=t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ATTRIBUTE_NODE?t.parentNode:t;console.warn("no inscope context for ",e)}})}_getTemplateExpression(e){return e.nodeType===Node.ATTRIBUTE_NODE?e.value:e.nodeType===Node.TEXT_NODE?e.textContent:null}_refreshChildren(){this.querySelectorAll("*").forEach(e=>{Pe.isUiElement(e.nodeName)&&"function"==typeof e.refresh&&e.refresh()})}_handleModelConstructDone(){this._initUI()}async _lazyCreateInstance(){const e=this.querySelector("fx-model");if(0===e.instances.length){console.log("### lazy creation of instance");const t=document.createElement("fx-instance");e.appendChild(t);const n=document.implementation.createDocument(null,"data",null);this._generateInstance(this,n.firstElementChild),t.instanceData=n,e.instances.push(t),console.log("generatedInstance ",this.getModel().getDefaultInstanceData())}}_generateInstance(e,t){if(e.hasAttribute("ref")&&!Pe.isActionElement(e.nodeName)){const n=e.getAttribute("ref");if(n.includes("/")){console.log("complex path to create ",n);n.split("/").forEach(n=>{console.log("step ",n),t=this._generateNode(t,n,e)})}else t=this._generateNode(t,n,e)}if(e.hasChildNodes()){const n=e.children;for(let e=0;e>>>>"),console.log("########## modelItems: ",this.getModel().modelItems),console.log("########## FORE: form fully initialized... ##########"),this.dispatchEvent(new CustomEvent("ready",{}))}getModel(){return this.querySelector("fx-model")}_displayMessage(e){const{level:t}=e.detail,n=e.detail.message;this._showMessage(t,n)}_displayError(e){const t=e.detail.message;this.shadowRoot.querySelector("#error").showToast(t)}_showMessage(e,t){if("modal"===e)this.shadowRoot.getElementById("messageContent").innerText=t,this.shadowRoot.getElementById("modalMessage").classList.add("show");else if("modeless"===e)this.shadowRoot.querySelector("#message").showToast(t);else{this.shadowRoot.querySelector("#message").showToast(t)}}}customElements.define("fx-fore",st);class ut extends(nt(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.methods=["get","put","post","delete","head","urlencoded-post"],this.model=this.parentNode,this.hasAttribute("id")||console.warn("id is required"),this.id=this.getAttribute("id"),this.instance=this.hasAttribute("instance")?this.getAttribute("instance"):null,this.method=this.hasAttribute("method")?this.getAttribute("method"):"get",this.nonrelevant=this.hasAttribute("nonrelevant")?this.getAttribute("nonrelevant"):"remove",this.replace=this.hasAttribute("replace")?this.getAttribute("replace"):"all",this.serialization=this.hasAttribute("serialization")?this.getAttribute("serialization"):"xml",this.hasAttribute("url")||console.warn("url is required for submission: "+this.id),this.url=this.getAttribute("url"),this.targetref=this.hasAttribute("targetref")?this.getAttribute("targetref"):null,this.mediatype=this.hasAttribute("mediatype")?this.getAttribute("mediatype"):"application/xml",this.validate=this.getAttribute("validate")?this.getAttribute("validate"):"true",this.shadowRoot.innerHTML=this.renderHTML()}renderHTML(){return"\n \n "}async submit(){await this.dispatch("submit",{submission:this}),this._submit()}async _submit(){console.log("submitting...."),this.evalInContext();const e=this.getModel();if(e.recalculate(),this.validate){if(!e.revalidate())return void console.log("validation failed. Bubmission stopped")}console.log("model updated...."),await this._serializeAndSend()}_evaluateAttributeTemplateExpression(e,t){const n=e.match(/{[^}]*}/g);return n&&n.forEach(n=>{console.log("match ",n);const r=n.substring(1,n.length-1),a=qe(r,tt(t,r),this.getOwnerForm()),i=e.replaceAll(n,a);console.log("replacing ",e," with ",i),e=i}),e}async _serializeAndSend(){const e=this._evaluateAttributeTemplateExpression(this.url,this),t=this.getInstance();if("xml"!==t.type)return void console.error("JSON serialization is not supported yet");let n;if("none"===this.serialization)n=void 0;else{const e=this.selectRelevant();n=this._serialize(t.type,e)}if("get"===this.method.toLowerCase()&&(n=void 0),"#echo"===e){let e;return e=n?(new DOMParser).parseFromString(n,"application/xml"):void 0,this._handleResponse(e),void this.dispatch("submit-done",{})}const r=this._getHeaders();if(console.log("headers",r),"urlencoded-post"===this.method&&(this.method="post"),!this.methods.includes(this.method.toLowerCase()))return void this.dispatch("error",{message:"Unknown method "+this.method});const a=await fetch(e,{method:this.method,mode:"cors",credentials:"include",headers:r,body:n});if(!a.ok||a.status>400)return void this.dispatch("submit-error",{message:"Error while submitting "+this.id});const i=a.headers.get("content-type").toLowerCase();if(i.startsWith("text/plain")||i.startsWith("text/html")){const e=await a.text();this._handleResponse(e)}else if(i.startsWith("application/json")){const e=await a.json();this._handleResponse(e)}else if(i.startsWith("application/xml")){const e=await a.text(),t=(new DOMParser).parseFromString(e,"application/xml");this._handleResponse(t)}else{const e=await a.blob();this._handleResponse(e)}this.dispatch("submit-done",{})}_serialize(e,t){if("urlencoded-post"===this.method){const e=new URLSearchParams;return Array.from(t.children).forEach(t=>{e.append(t.nodeName,t.textContent)}),e}if("xml"===e){return(new XMLSerializer).serializeToString(t)}throw new Error("unknown instance type ",e)}_getHeaders(){const e=new Headers,t=this.getInstance(),n=Pe.getContentType(t,this.method);e.append("Content-Type",n),e.has("Accept")&&e.delete("Accept");const r=this.querySelectorAll("fx-header");return Array.from(r).forEach(t=>{const{name:n}=t,r=t.getValue();e.append(n,r)}),e}_getUrlExpr(){return this.storedTemplateExpressions.find(e=>"url"===e.node.nodeName)}_getTargetInstance(){let e;if(e=this.instance?this.model.getInstance(this.instance):this.model.getInstance("default"),!e)throw new Error("target instance not found: "+e);return e}_handleResponse(e){if(console.log("_handleResponse ",e),"instance"===this.replace){const t=this._getTargetInstance();if(!t)throw new Error("target instance not found: "+t);if(this.targetref){const n=_e(this.targetref,t,this.getOwnerForm());console.log("theTarget",n);const r=e.firstElementChild,a=n.parentNode;a.replaceChild(r,n),console.log("finally ",a)}else{const n=e;t.instanceData=n,console.log("### replaced instance ",t.instanceData)}this.model.updateModel(),this.getOwnerForm().refresh()}if("all"===this.replace&&(document.getElementsByTagName("html")[0].innerHTML=e),"target"===this.replace){const t=this.getAttribute("target");document.querySelector(t).innerHTML=e}"redirect"===this.replace&&(window.location.href=e)}selectRelevant(){if("keep"===this.nonrelevant)return this.nodeset;const e=this.getModel().getModelItem(this.nodeset);if(e&&!e.relevant)return null;const t=(new DOMParser).parseFromString("","application/xml").firstElementChild;if(0===this.nodeset.children.length&&this._isRelevant(this.nodeset))return this.nodeset;return this._filterRelevant(this.nodeset,t)}_filterRelevant(e,t){const{childNodes:n}=e;return Array.from(n).forEach(e=>{if(this._isRelevant(e)){const n=e.cloneNode(!1);t.appendChild(n);const{attributes:r}=e;return r&&Array.from(r).forEach(e=>{this._isRelevant(e)?n.setAttribute(e.nodeName,e.value):"empty"===this.nonrelevant?n.setAttribute(e.nodeName,""):n.removeAttribute(e.nodeName)}),this._filterRelevant(e,n)}return null}),t}_isRelevant(e){const t=this.getModel().getModelItem(e);return!(t&&!t.relevant)}_handleError(){this.dispatch("submit-error",{})}}customElements.define("fx-submission",ut);class lt extends(nt(HTMLElement)){constructor(){if(super(),this.style.display="none",this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML="",!this.hasAttribute("name"))throw new Error('required attribute "name" missing');this.name=this.getAttribute("name")}connectedCallback(){this.shadowRoot.innerHTML=""}}customElements.define("fx-header",lt);
+/**
+ * @license
+ * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
+ * This code may only be used under the BSD style license found at
+ * http://polymer.github.io/LICENSE.txt
+ * The complete set of authors may be found at
+ * http://polymer.github.io/AUTHORS.txt
+ * The complete set of contributors may be found at
+ * http://polymer.github.io/CONTRIBUTORS.txt
+ * Code distributed by Google as part of the polymer project is also
+ * subject to an additional IP rights grant found at
+ * http://polymer.github.io/PATENTS.txt
+ */
+const ct="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,pt=`{{lit-${String(Math.random()).slice(2)}}}`,ht=`\x3c!--${pt}--\x3e`,ft=e=>-1!==e.index,dt=()=>document.createComment(""),mt=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/,vt=new WeakMap,gt=e=>"function"==typeof e&&vt.has(e),yt={},wt={};
+/**
+ * @license
+ * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
+ * This code may only be used under the BSD style license found at
+ * http://polymer.github.io/LICENSE.txt
+ * The complete set of authors may be found at
+ * http://polymer.github.io/AUTHORS.txt
+ * The complete set of contributors may be found at
+ * http://polymer.github.io/CONTRIBUTORS.txt
+ * Code distributed by Google as part of the polymer project is also
+ * subject to an additional IP rights grant found at
+ * http://polymer.github.io/PATENTS.txt
+ */
+class At{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this.options=n}update(e){let t=0;for(const n of this.__parts)void 0!==n&&n.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=ct?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],n=this.template.parts,r=document.createTreeWalker(e,133,null,!1);let a,i=0,o=0,s=r.nextNode();for(;ie}),bt=` ${pt} `;class Et{constructor(e,t,n,r){this.strings=e,this.values=t,this.type=n,this.processor=r}getHTML(){const e=this.strings.length-1;let t="",n=!1;for(let r=0;r-1||n)&&-1===e.indexOf("--\x3e",a+1);const i=mt.exec(e);t+=null===i?e+(n?bt:ht):e.substr(0,i.index)+i[1]+i[2]+"$lit$"+i[3]+pt}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==xt&&(t=xt.createHTML(t)),e.innerHTML=t,e}}
+/**
+ * @license
+ * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
+ * This code may only be used under the BSD style license found at
+ * http://polymer.github.io/LICENSE.txt
+ * The complete set of authors may be found at
+ * http://polymer.github.io/AUTHORS.txt
+ * The complete set of contributors may be found at
+ * http://polymer.github.io/CONTRIBUTORS.txt
+ * Code distributed by Google as part of the polymer project is also
+ * subject to an additional IP rights grant found at
+ * http://polymer.github.io/PATENTS.txt
+ */const Bt=e=>null===e||!("object"==typeof e||"function"==typeof e),Nt=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class Ct{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e{for(;t!==n;){const n=t.nextSibling;e.removeChild(t),t=n}})(this.startNode.parentNode,e.nextSibling,this.endNode)}}class Ot{constructor(e,t,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=n}setValue(e){this.__pendingValue=e}commit(){for(;gt(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=yt,e(this)}if(this.__pendingValue===yt)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=yt}}class St extends Ct{constructor(e,t,n){super(e,t,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new Dt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class Dt extends Tt{}let Rt=!1;(()=>{try{const e={get capture(){return Rt=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class Gt{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;gt(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=yt,e(this)}if(this.__pendingValue===yt)return;const e=this.__pendingValue,t=this.value,n=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),r=null!=e&&(null==t||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),r&&(this.__options=Mt(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=yt}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const Mt=e=>e&&(Rt?{capture:e.capture,passive:e.passive,once:e.once}:e.capture)
+/**
+ * @license
+ * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
+ * This code may only be used under the BSD style license found at
+ * http://polymer.github.io/LICENSE.txt
+ * The complete set of authors may be found at
+ * http://polymer.github.io/AUTHORS.txt
+ * The complete set of contributors may be found at
+ * http://polymer.github.io/CONTRIBUTORS.txt
+ * Code distributed by Google as part of the polymer project is also
+ * subject to an additional IP rights grant found at
+ * http://polymer.github.io/PATENTS.txt
+ */;const Ut=new class{handleAttributeExpressions(e,t,n,r){const a=t[0];if("."===a){return new St(e,t.slice(1),n).parts}if("@"===a)return[new Gt(e,t.slice(1),r.eventContext)];if("?"===a)return[new Ot(e,t.slice(1),n)];return new Ct(e,t,n).parts}handleTextExpression(e){return new It(e)}};
+/**
+ * @license
+ * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
+ * This code may only be used under the BSD style license found at
+ * http://polymer.github.io/LICENSE.txt
+ * The complete set of authors may be found at
+ * http://polymer.github.io/AUTHORS.txt
+ * The complete set of contributors may be found at
+ * http://polymer.github.io/CONTRIBUTORS.txt
+ * Code distributed by Google as part of the polymer project is also
+ * subject to an additional IP rights grant found at
+ * http://polymer.github.io/PATENTS.txt
+ */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const Ft=(e,...t)=>new Et(e,t,"html",Ut)
+/**
+ * @license
+ * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
+ * This code may only be used under the BSD style license found at
+ * http://polymer.github.io/LICENSE.txt
+ * The complete set of authors may be found at
+ * http://polymer.github.io/AUTHORS.txt
+ * The complete set of contributors may be found at
+ * http://polymer.github.io/CONTRIBUTORS.txt
+ * Code distributed by Google as part of the polymer project is also
+ * subject to an additional IP rights grant found at
+ * http://polymer.github.io/PATENTS.txt
+ */;void 0===window.ShadyCSS||void 0===window.ShadyCSS.prepareTemplateDom&&console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1.")
+/**
+ * @license
+ * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
+ * This code may only be used under the BSD style license found at
+ * http://polymer.github.io/LICENSE.txt
+ * The complete set of authors may be found at
+ * http://polymer.github.io/AUTHORS.txt
+ * The complete set of contributors may be found at
+ * http://polymer.github.io/CONTRIBUTORS.txt
+ * Code distributed by Google as part of the polymer project is also
+ * subject to an additional IP rights grant found at
+ * http://polymer.github.io/PATENTS.txt
+ */,window.JSCompiler_renameProperty=(e,t)=>e
+/**
+@license
+Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at
+http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
+http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
+found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
+part of the polymer project is also subject to an additional IP rights grant
+found at http://polymer.github.io/PATENTS.txt
+*/;const Pt=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ht=Symbol();class jt{constructor(e,t){if(t!==Ht)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(Pt?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const Xt=(e,...t)=>{const n=t.reduce((t,n,r)=>t+(e=>{if(e instanceof jt)return e.cssText;if("number"==typeof e)return e;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(n)+e[r+1],e[0]);return new jt(n,Ht)};
+/**
+ * @license
+ * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
+ * This code may only be used under the BSD style license found at
+ * http://polymer.github.io/LICENSE.txt
+ * The complete set of authors may be found at
+ * http://polymer.github.io/AUTHORS.txt
+ * The complete set of contributors may be found at
+ * http://polymer.github.io/CONTRIBUTORS.txt
+ * Code distributed by Google as part of the polymer project is also
+ * subject to an additional IP rights grant found at
+ * http://polymer.github.io/PATENTS.txt
+ */
+(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");class _t extends(nt(HTMLElement)){constructor(){super(),this.value="",this.display=this.style.display,this.required=!1,this.readonly=!1,this.widget=null}getWidget(){throw new Error("You have to implement the method getWidget!")}async refresh(){console.log("### AbstractControl.refresh on : ",this);const e=this.value;if(!this.isNotBound()&&(this.evalInContext(),this.isBound())){if(null===this.nodeset)return void(this.style.display="none");if(this.modelItem=this.getModelItem(),this.modelItem instanceof ze){if(this.value=this.modelItem.value,await this.updateWidgetValue(),this.handleModelItemProperties(),!this.getOwnerForm().ready)return;e!==this.value&&this.dispatch("value-changed",{path:this.modelItem.path})}}}async updateWidgetValue(){throw new Error("You have to implement the method updateWidgetValue!")}handleModelItemProperties(){console.log("form ready",this.getOwnerForm().ready),this.handleRequired(),this.handleReadonly(),this.getOwnerForm().ready&&this.handleValid(),this.handleRelevant()}_getForm(){return this.getModel().parentNode}_dispatchEvent(e){this.getOwnerForm().ready&&this.dispatch(e,{})}handleRequired(){this.widget=this.getWidget(),this.isRequired()!==this.modelItem.required&&(this.modelItem.required?(this.widget.setAttribute("required","required"),this.classList.add("required"),this._dispatchEvent("required")):(this.widget.removeAttribute("required"),this.required=!1,this.classList.toggle("required"),this._dispatchEvent("optional")))}handleReadonly(){this.isReadonly()!==this.modelItem.readonly&&(this.modelItem.readonly&&(this.widget.setAttribute("readonly","readonly"),this.classList.toggle("readonly"),this._dispatchEvent("readonly")),this.modelItem.readonly||(this.widget.removeAttribute("readonly"),this.classList.toggle("readonly"),this._dispatchEvent("readwrite")))}handleValid(){const e=this.querySelector("fx-alert");if(this.isValid()!==this.modelItem.constraint)if(this.modelItem.constraint)this.classList.remove("invalid"),e&&(e.style.display="none"),this._dispatchEvent("valid");else{if(this.classList.add("invalid"),e&&(e.style.display="block"),0!==this.modelItem.alerts.length){const{alerts:e}=this.modelItem;console.log("alerts from bind: ",e);this.querySelector("fx-alert")||e.forEach(e=>{const t=document.createElement("fx-alert");t.innerHTML=e,this.appendChild(t),t.style.display="block"})}this._dispatchEvent("invalid")}}handleRelevant(){this.isEnabled()!==this.modelItem.relevant&&(this.modelItem.relevant?(this._dispatchEvent("relevant"),this.style.display=this.display):(this._dispatchEvent("nonrelevant"),this.style.display="none"))}isRequired(){return!!this.widget.hasAttribute("required")}isValid(){return!this.classList.contains("invalid")}isReadonly(){return!!this.widget.hasAttribute("readonly")}isEnabled(){return"none"!==this.style.display}_fadeOut(e){e.style.opacity=1,function t(){(e.style.opacity-=.1)<0?e.style.display="none":requestAnimationFrame(t)}()}_fadeIn(e,t){e.style.opacity=0,e.style.display=t||"block",function t(){let n=parseFloat(e.style.opacity);(n+=.1)>1||(e.style.opacity=n,requestAnimationFrame(t))}()}}window.customElements.define("fx-abstract-control",_t);customElements.define("fx-alert",class extends _t{static get styles(){return Xt`:host{display:block;height:auto;font-size:.8em;font-weight:400;color:red;display:none}`}constructor(){super(),this.style.display="none"}static get properties(){return{...super.properties}}render(){return Ft``}async updateWidgetValue(){console.log("alert update",this),this.innerHTML=this.value}});window.customElements.define("fx-control",class extends _t{constructor(){super(),this.inited=!1,this.attachShadow({mode:"open"})}connectedCallback(){this.updateEvent=this.hasAttribute("update-event")?this.getAttribute("update-event"):"blur",this.valueProp=this.hasAttribute("value-prop")?this.getAttribute("value-prop"):"value",this.label=this.hasAttribute("label")?this.getAttribute("label"):null;this.shadowRoot.innerHTML=`\n \n ${this.renderHTML(this.ref)}\n `,this.widget=this.getWidget(),console.log("widget ",this.widget),"enter"===this.updateEvent&&(this.widget.addEventListener("keyup",e=>{13===e.keyCode&&(e.preventDefault(),this.setValue(this.widget[this.valueProp]))}),this.updateEvent="blur"),this.widget.addEventListener(this.updateEvent,()=>{console.log("eventlistener ",this.updateEvent),this.setValue(this.widget[this.valueProp])})}setValue(e){const t=this.getModelItem(),n=this.shadowRoot.getElementById("setvalue");n.setValue(t,e),n.actionPerformed()}renderHTML(e){return`\n ${this.label?""+this.label:""}\n \n \n `}getWidget(){let e=this.querySelector(".widget");if(e||(e=this.querySelector("input")),!e){const e=document.createElement("input");return e.classList.add("widget"),e.setAttribute("type","text"),this.appendChild(e),e}return e}async updateWidgetValue(){if("checked"===this.valueProp)"true"===this.value?this.widget.checked=!0:this.widget.checked=!1;else{let{widget:e}=this;e||(e=this),e.value=this.value}}async refresh(){if(super.refresh(),this.widget.hasAttribute("ref")){const e=this.widget.querySelector("template"),t=this.widget.getAttribute("ref"),n=this.getInScopeContext(),r=this.closest("fx-fore"),a=_e(t,n,r),{children:i}=this.widget;Array.from(i).forEach(e=>{"template"!==e.nodeName.toLowerCase()&&e.parentNode.removeChild(e)}),Array.from(a).forEach(t=>{console.log("#### node",t);const n=e.content.firstElementChild.cloneNode(!0),a=document.importNode(n,!0);this.widget.appendChild(a);const i=this._getValueAttribute(a),o=i.value,s=_e(o.substring(1,o.length-1),t,r);i.value=s,this.value===s&&a.setAttribute("selected","selected");const u=a.textContent,l=qe(u.substring(1,u.length-1),t,r);a.textContent=l})}}_getValueAttribute(e){let t;return Array.from(e.attributes).forEach(e=>{-1!==e.value.indexOf("{")&&(t=e)}),t}});class Lt extends(nt(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.shadowRoot.innerHTML="\n \n \n \n \n "}refresh(){console.log("### FxContainer.refresh on : ",this),this.isBound()&&(this.evalInContext(),this.modelItem=this.getModelItem(),this.value=this.modelItem.value),this._getForm().ready&&this.handleModelItemProperties(),Pe.refreshChildren(this)}handleModelItemProperties(){this.handleReadonly(),this.handleRelevant()}_getForm(){return this.getModel().parentNode}handleReadonly(){this.isReadonly()!==this.modelItem.readonly&&(this.modelItem.readonly&&(this.setAttribute("readonly","readonly"),this.dispatchEvent(new CustomEvent("readonly",{}))),this.modelItem.readonly||(this.removeAttribute("readonly"),this.dispatchEvent(new CustomEvent("readwrite",{}))))}handleRelevant(){this.isEnabled()!==this.modelItem.enabled&&(this.modelItem.enabled?this.dispatchEvent(new CustomEvent("enabled",{})):this.dispatchEvent(new CustomEvent("disabled",{})))}isReadonly(){return!!this.hasAttribute("readonly")}isEnabled(){return"none"!==this.style.display}}window.customElements.define("fx-container",Lt);window.customElements.define("fx-group",class extends Lt{static get properties(){return{...super.properties,collapse:{type:Boolean,reflect:!0}}}constructor(){super(),this.collapse=!1}render(){return Ft``}handleModelItemProperties(){this.handleRelevant()}initializeChildren(e){const t=Array.from(e.children);console.log("_initializeChildren ",t),t.forEach(e=>{if(console.log("child ",e),Pe.isUiElement(e.nodeName))e.init(this.model);else if(0!==e.children.length){Array.from(e.children).forEach(e=>{this.initializeChildren(e)})}}),console.groupEnd()}});customElements.define("fx-hint",class extends _t{static get styles(){return Xt`:host{display:block;height:auto;font-size:.8em;font-weight:400;font-style:italic}`}static get properties(){return{...super.properties}}render(){return Ft``}});customElements.define("fx-output",class extends _t{static get properties(){return{...super.properties,valueAttr:{type:String}}}constructor(){super(),this.attachShadow({mode:"open"}),this.valueAttr=this.hasAttribute("value")?this.getAttribute("value"):null}connectedCallback(){this.shadowRoot.innerHTML='\n \n \n \n \n \n \n \n ',this.addEventListener("slotchange",e=>{console.log("slotchange ",e)})}async refresh(){if(this.valueAttr)return this.value=this.getValue(),void await this.updateWidgetValue();this.ref&&super.refresh()}getValue(){try{const e=tt(this,this.valueAttr);return this.hasAttribute("html")?_e(this.valueAttr,e,this):qe(this.valueAttr,e,this)}catch(e){console.error(e),this.dispatch("error",{message:e})}return null}getWidget(){return this.shadowRoot.getElementById("value")}async updateWidgetValue(){const e=this.shadowRoot.getElementById("value");if(this.hasAttribute("html"))return this.modelItem.node?void(e.innerHTML=this.modelItem.node.outerHTML):void(e.innerHTML=this.value.outerHTML);e.innerHTML=this.value}isReadonly(){return this.readonly=!0,this.readonly}});class kt extends(nt(HTMLElement)){static get properties(){return{inited:{type:Boolean}}}constructor(){super(),this.inited=!1,this.addEventListener("click",this._dispatchIndexChange),this.addEventListener("focusin",this._handleFocus),this.attachShadow({mode:"open",delegatesFocus:!0})}_handleFocus(){this.parentNode.setIndex(this.index),this.closest("fx-fore").refresh()}_dispatchIndexChange(){this.parentNode&&this.parentNode.dispatchEvent(new CustomEvent("item-changed",{composed:!0,bubbles:!0,detail:{item:this}}))}connectedCallback(){this.display=this.style.display;this.shadowRoot.innerHTML="\n \n \n \n "}disconnectedCallback(){this.removeEventListener("click",this._dispatchIndexChange()),this.removeEventListener("focusin",this._handleFocus)}init(){this.inited=!0}getModelItem(){return super.getModelItem(),this.getModelItem()[this.index]}refresh(){this.modelItem=this.getModel().getModelItem(this.nodeset),this.modelItem&&!this.modelItem.relevant?this.style.display="none":this.style.display=this.display,Pe.refreshChildren(this)}}window.customElements.define("fx-repeatitem",kt);class Yt extends(nt(HTMLElement)){static get properties(){return{...super.properties,index:{type:Number},template:{type:Object},focusOnCreate:{type:String},initDone:{type:Boolean},repeatIndex:{type:Number},nodeset:{type:Array}}}constructor(){super(),this.ref="",this.dataTemplate=[],this.focusOnCreate="",this.initDone=!1,this.repeatIndex=1,this.nodeset=[],this.inited=!1,this.index=1,this.repeatSize=0,this.attachShadow({mode:"open",delegatesFocus:!0})}get repeatSize(){return this.querySelectorAll(":scope > fx-repeatitem").length}set repeatSize(e){this.size=e}setIndex(e){this.index=e;const t=this.querySelectorAll(":scope > fx-repeatitem");this.applyIndex(t[this.index-1])}applyIndex(e){this._removeIndexMarker(),e&&e.setAttribute("repeat-index","")}get index(){return this.getAttribute("index")}set index(e){this.setAttribute("index",e)}connectedCallback(){this.ref=this.getAttribute("ref"),this.addEventListener("item-changed",e=>{console.log("handle index event ",e);const{item:t}=e.detail,n=Array.from(this.children).indexOf(t);this.applyIndex(this.children[n]),this.index=n+1}),this.addEventListener("index-changed",e=>{if(e.stopPropagation(),!e.target===this)return;console.log("handle index event ",e);const{index:t}=e.detail;this.index=t,this.applyIndex(this.children[t-1])}),document.addEventListener("insert",e=>{const t=e.detail.insertedNodes;this.index=e.detail.position,console.log("insert catched",t,this.index)});this.shadowRoot.innerHTML='\n \n \n \n \n \n '}init(){this._evalNodeset(),this._initTemplate(),this._initRepeatItems(),this.setAttribute("index",this.index),this.inited=!0}_evalNodeset(){const e=tt(this,this.ref),t=_e(this.ref,e,this.getOwnerForm());if(null!==t){if("object"==typeof t){if("nodeType"in t)return void(this.nodeset=[t]);if(Array.isArray(t))return void(this.nodeset=t)}throw new Error("Unexpected result of repeat nodeset: "+t)}this.nodeset=[]}async refresh(){console.group("fx-repeat.refresh on",this.id),this.inited||this.init(),this._evalNodeset(),console.log("repeat refresh nodeset ",this.nodeset);const e=this.querySelectorAll(":scope > fx-repeatitem"),t=e.length;let n=1;Array.isArray(this.nodeset)&&(n=this.nodeset.length);const r=n;if(rr;n-=1){const t=e[n-1];t.parentNode.removeChild(t)}if(r>t)for(let e=t+1;e<=r;e+=1){const t=document.createElement("fx-repeatitem"),n=this._clone();t.appendChild(n),this.appendChild(t),t.nodeset=this.nodeset[e-1],t.index=e}for(let n=0;n1||(e.style.opacity=n,requestAnimationFrame(t))}())}_initTemplate(){this.template=this.querySelector("template"),console.log("### init template for repeat ",this.id,this.template),null===this.template&&this.dispatchEvent(new CustomEvent("no-template-error",{composed:!0,bubbles:!0,detail:{message:"no template found for repeat:"+this.id}})),this.shadowRoot.appendChild(this.template)}_initRepeatItems(){this.nodeset.forEach((e,t)=>{const n=document.createElement("fx-repeatitem");n.nodeset=this.nodeset[t],n.index=t+1;const r=this._clone();n.appendChild(r),this.appendChild(n),1===n.index&&this.applyIndex(n)})}_clone(){this.template=this.shadowRoot.querySelector("template");const e=this.template.content.cloneNode(!0);return document.importNode(e,!0)}_removeIndexMarker(){Array.from(this.children).forEach(e=>{e.removeAttribute("repeat-index")})}}window.customElements.define("fx-repeat",Yt);window.customElements.define("fx-switch",class extends Lt{connectedCallback(){super.connectedCallback&&super.connectedCallback();this.shadowRoot.innerHTML="\n \n \n \n \n "}refresh(){super.refresh(),console.log("refresh on switch ");const e=this.querySelectorAll("fx-case");if(this.isBound())Array.from(e).forEach(e=>{e.getAttribute("name")===this.modelItem.value?e.classList.add("selected-case"):e.classList.remove("selected-case")});else{this.querySelector(".selected-case")||e[0].classList.add("selected-case")}Pe.refreshChildren(this)}toggle(e){const t=this.querySelectorAll("fx-case");Array.from(t).forEach(t=>{e===t?t.classList.add("selected-case"):t.classList.remove("selected-case")})}});customElements.define("fx-trigger",class extends _t{connectedCallback(){this.attachShadow({mode:"open"}),this.ref=this.hasAttribute("ref")?this.getAttribute("ref"):null;this.shadowRoot.innerHTML=`\n \n ${this.renderHTML()}\n `;const e=this.shadowRoot.querySelector("slot");e.addEventListener("slotchange",()=>{const t=e.assignedElements({flatten:!0});t[0].setAttribute("tabindex","0"),t[0].setAttribute("role","button");const n=t[0];n.addEventListener("click",e=>this.performActions(e)),this.widget=n,"BUTTON"!==n.nodeName&&n.addEventListener("keypress",e=>{"Space"!==e.code&&"Enter"!==e.code||this.performActions(e)})})}renderHTML(){return"\n \n "}getWidget(){return this.widget}async updateWidgetValue(){return console.log("trigger update",this),null}handleReadonly(){super.handleReadonly(),this.widget.hasAttribute("readonly")?this.widget.setAttribute("disabled","disabled"):this.widget.removeAttribute("disabled")}async performActions(e){const t=this.closest("fx-repeatitem");t&&(console.log("repeated click"),t.click());(async()=>{for(let t=0;t${this.label}`:""}\n \n `;this.shadowRoot.innerHTML=`\n \n ${e}\n `,this.style.display="none"}}async function Vt(e){return new Promise(t=>setTimeout(()=>t(),e))}window.customElements.define("fx-case",qt);class Jt extends(nt(HTMLElement)){static get properties(){return{...super.properties,detail:{type:Object},needsUpdate:{type:Boolean},event:{type:Object},target:{type:String},ifExpr:{type:String},whileExpr:{type:String},delay:{type:Number}}}constructor(){super(),this.detail={},this.needsUpdate=!1}connectedCallback(){this.style.display="none",this.repeatContext=void 0,this.hasAttribute("event")?this.event=this.getAttribute("event"):this.event="activate",this.target=this.getAttribute("target"),this.target?"#window"===this.target?window.addEventListener(this.event,e=>this.execute(e)):"#document"===this.target?document.addEventListener(this.event,e=>this.execute(e)):(this.targetElement=document.getElementById(this.target),this.targetElement.addEventListener(this.event,e=>this.execute(e))):(this.targetElement=this.parentNode,this.targetElement.addEventListener(this.event,e=>this.execute(e))),this.ifExpr=this.hasAttribute("if")?this.getAttribute("if"):null,this.whileExpr=this.hasAttribute("while")?this.getAttribute("while"):null,this.delay=this.hasAttribute("delay")?Number(this.getAttribute("delay")):0}async execute(e){if(console.log("executing",this),e&&e.detail&&(this.detail=e.detail),this.needsUpdate=!1,this.evalInContext(),this.targetElement&&this.targetElement.nodeset&&(this.nodeset=this.targetElement.nodeset),!this.ifExpr||Ye(this.ifExpr,this.nodeset,this.getOwnerForm())){if(this.whileExpr){const e=async()=>{await Vt(this.delay||0),this.ownerDocument.contains(this)&&Ye(this.whileExpr,this.nodeset,this.getOwnerForm())&&(this.perform(),await e())};return await e(),void this.actionPerformed()}!this.delay||(await Vt(this.delay),this.ownerDocument.contains(this))?(this.perform(),this.actionPerformed()):this.actionPerformed()}}perform(){(this.isBound()||"FX-ACTION"===this.nodeName)&&this.evalInContext()}actionPerformed(){if(this.needsUpdate){const e=this.getModel();e.recalculate(),e.revalidate(),e.parentNode.refresh(),this._dispatchActionPerformed()}}_dispatchActionPerformed(){console.log("action-performed ",this),this.dispatchEvent(new CustomEvent("action-performed",{composed:!0,bubbles:!0,detail:{}}))}}window.customElements.define("abstract-action",Jt);window.customElements.define("fx-append",class extends Jt{static get properties(){return{ref:{type:String},repeat:{type:String},clear:{type:String}}}constructor(){super(),this.repeat=""}connectedCallback(){super.connectedCallback(),console.log("connectedCallback ",this),this.ref=this.getAttribute("ref"),this.repeat=this.getAttribute("repeat")}perform(){super.perform(),this._dataFromTemplate(),this.needsUpdate=!0}actionPerformed(){super.actionPerformed(),this.dispatch()}_dataFromTemplate(){const e=this.getInScopeContext(),t=this.getOwnerForm().querySelector("#"+this.repeat),n=t.shadowRoot.querySelector("template"),r=e.ownerDocument.createElement(t.ref),a=this._generateInstance(n.content,r);e.appendChild(a)}dispatch(){let e;Pe.isRepeated(this)?(console.log("append repeated ",this.repeatContext),e=Pe.getRepeatTarget(this,this.repeat)):e=document.getElementById(this.repeat),console.log("dispatching index change ",e.nodeset.length),e.dispatchEvent(new CustomEvent("index-changed",{composed:!0,bubbles:!0,detail:{index:e.nodeset.length}}))}_clear(e){let t=e.firstChild;const n=e.attributes;for(let e=0;ea?n.setIndex(a):n.setIndex(t)}this.needsUpdate=!0}actionPerformed(){this.getModel().rebuild(),super.actionPerformed()}});window.customElements.define("fx-insert",class extends Jt{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback&&super.connectedCallback();this.shadowRoot.innerHTML="\n \n \n ",this.at=Number(this.hasAttribute("at")?this.getAttribute("at"):0),this.position=this.hasAttribute("position")?this.getAttribute("position"):"after",this.origin=this.hasAttribute("origin")?this.getAttribute("origin"):null,this.keepValues=!!this.hasAttribute("keep-values")}_cloneOriginSequence(e,t){let n;if(this.origin){let t;try{t=Le(this.origin,e,this.getOwnerForm()),Array.isArray(t)&&0===t.length&&(console.warn("invalid origin for this insert action - ignoring...",this),n=null),n=t.cloneNode(!0)}catch(e){console.warn("invalid origin for this insert action - ignoring...",this)}}else t&&(n=this._cloneTargetSequence(t),n&&!this.keepValues&&this._clear(n));return n}_getInsertIndex(e,t){return 0===t.length?null:this.hasAttribute("at")?Ve(this.getAttribute("at"),e,this.getOwnerForm()):t.length}perform(){super.perform();const e=tt(this,this.ref),t=ke(this.ref,e,this.getOwnerForm());console.log("insert nodeset ",t);const n=this._cloneOriginSequence(e,t);if(!n)return;let r,a;const i=this._getInsertIndex(e,t);if(console.log("insert index",i),0===t.length)r=e,e.appendChild(n),a=1,console.log("appended",e);else{if(this.hasAttribute("at")?(a=Ve(this.getAttribute("at"),e,this.getOwnerForm()),r=t[a-1]):(a=t.length,r=t[t.length-1]),!r){a=1,r=t;const e=_e("count(preceding::*)",t,this.getOwnerForm());console.log("context",e),a=e+1}this.position&&"before"===this.position&&r.parentNode.insertBefore(n,r),this.position&&"after"===this.position&&(a+=1,r.insertAdjacentElement("afterend",n))}console.log("instance ",this.getModel().getDefaultContext()),console.log("<<<<<<< at",this.at),console.log("<<<<<<< index",a),document.dispatchEvent(new CustomEvent("insert",{composed:!0,bubbles:!0,detail:{insertedNodes:n,position:a}})),this.needsUpdate=!0}_cloneTargetSequence(e){return Array.isArray(e)&&0!==e.length?e[e.length-1].cloneNode(!0):!Array.isArray(e)&&e?e.cloneNode(!0):null}actionPerformed(){this.getModel().rebuild(),super.actionPerformed()}_clear(e){const t=e.attributes;for(let e=0;e\n \n :host{\n display:none;\n }\n \n \n ${this.renderHTML()}\n `}disconnectedCallback(){this.targetElement.removeEventListener(this.event,e=>this.execute(e))}renderHTML(){return"\n \n "}perform(){let e;super.perform(),e=this.hasAttribute("value")?this.getValue():this.textContent,this.dispatchEvent(new CustomEvent("message",{composed:!0,bubbles:!0,detail:{level:this.level,message:e}}))}});window.customElements.define("fx-setvalue",class extends Jt{static get properties(){return{...super.properties,ref:{type:String},valueAttr:{type:String}}}constructor(){super(),this.ref="",this.valueAttr=""}connectedCallback(){if(super.connectedCallback&&super.connectedCallback(),!this.hasAttribute("ref"))throw new Error('fx-setvalue must specify a "ref" attribute');this.ref=this.getAttribute("ref"),this.valueAttr=this.getAttribute("value")}perform(){super.perform();let{value:e}=this;e=null!==this.valueAttr?_e(this.valueAttr,this.nodeset,this.getOwnerForm(),this.detail):""!==this.textContent?this.textContent:"";const t=this.getModelItem();this.setValue(t,e)}setValue(e,t){console.log("setvalue[1] ",e,t);const n=e;n&&n.value!==t&&(n.value=t,n.changed=!0,this.needsUpdate=!0,console.log("setvalue[2] ",n,t))}});window.customElements.define("fx-send",class extends Jt{constructor(){super(),this.value=""}connectedCallback(){super.connectedCallback(),console.log("connectedCallback ",this),this.submission=this.getAttribute("submission")}perform(){super.perform(),console.log("submitting ",this.submission),console.log("submitting model",this.getModel());const e=this.getModel().querySelector("#"+this.submission);if(null===e)throw this.dispatchEvent(new CustomEvent("error",{composed:!0,bubbles:!0,detail:{message:`fx-submission element with id: '${this.submission}' not found`}})),new Error(`submission with id: ${this.submission} not found`);console.log("submission",e),e.submit()}});class Qt extends Jt{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.src=this.hasAttribute("src")?this.getAttribute("src"):null;this.shadowRoot.innerHTML="\n \n \n "}perform(){const{children:e}=this;if(this.src){this.innerHTML="",console.log("### fx-script.perform ");const e=document.createElement("script");e.src=this.src,this.appendChild(e)}else Array.from(e).forEach(e=>{e.detail=this.detail,e.execute()})}}window.customElements.define("fx-action",Qt);window.customElements.define("fx-toggle",class extends Qt{connectedCallback(){this.hasAttribute("case")&&(this.case=this.getAttribute("case"))}execute(){if(console.log("### fx-toggle.execute "),this.case){const e=this.getOwnerForm().querySelector("#"+this.case);e.parentNode.toggle(e)}}});window.customElements.define("fx-dispatch",class extends Jt{constructor(){super(),this.name=null,this.targetid=null,this.details=null,this.attachShadow({mode:"open"})}connectedCallback(){if(super.connectedCallback(),this.name=this.getAttribute("name"),!this.name)throw new Error("no event specified for dispatch",this);this.targetid=this.hasAttribute("targetid")?this.getAttribute("targetid"):null}perform(){console.log("### fx-dispatch.perform ",this);const e=this.querySelectorAll("fx-property"),t={};if(Array.from(e).forEach(e=>{console.log("prop ",e);const n=e.getAttribute("name"),r=e.getAttribute("value"),a=e.getAttribute("expr");if(a){if(r)throw new Error('if "expr" is given there must not be a "value" attribute');const e=_e(a,this.getInScopeContext(),this.getOwnerForm());let i=null;if(e.nodeName){i=(new XMLSerializer).serializeToString(e)}t[n]=i||e}r&&(t[n]=r)}),console.log("details ",t),this.targetid){const e=document.getElementById(this.targetid);if(!e)throw new Error(`targetid ${this.targetid} does not exist in document`);e.dispatchEvent(new CustomEvent(this.name,{composed:!0,bubbles:!0,detail:t}))}else document.dispatchEvent(new CustomEvent(this.name,{composed:!0,bubbles:!0,detail:t}))}});window.customElements.define("fx-update",class extends Jt{perform(){this.getModel().updateModel()}});window.customElements.define("fx-refresh",class extends Jt{perform(){this.getOwnerForm().refresh()}});window.customElements.define("fx-confirm",class extends Qt{connectedCallback(){this.message=this.hasAttribute("message")?this.getAttribute("message"):null}perform(){window.confirm(this.message)&&super.perform()}});class Kt extends(nt(HTMLElement)){constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){this.style.display="none",this.signature=this.hasAttribute("signature")?this.getAttribute("signature"):null,null===this.signature&&console.error("signature is a required attribute"),this.type=this.hasAttribute("type")?this.getAttribute("type"):null,this.shadowRoot.innerHTML="",this.override=this.hasAttribute("override")?this.getAttribute("override"):"true",this.functionBody=this.innerText;const e=this.getAttribute("type")||"text/xpath",t=this.signature.match(/(?:(?[^:]*):)?(?[^(]+)\((?(?:\(\)|[^)])*)\)(?: as (?.*))?/);if(!t)throw new Error(`Function signature ${this.signature} could not be parsed`);const{prefix:n,localName:r,params:a,returnType:i}=t.groups,o="local"===n?{namespaceURI:"http://www.w3.org/2005/xquery-local-functions",localName:r}:`${n}:${r}`,s=a?a.split(",").map(e=>{const t=e.match(/(?\$[^\s]+)(?:\sas\s(?.+))/);if(!t)throw new Error(`Param ${e} could not be parsed`);const{variableName:n,varType:r}=t.groups;return{variableName:n,variableType:r||"item()*"}}):[];switch(e){case"text/javascript":{const e=new Function("_domFacade",...s.map(e=>e.variableName),"form",this.functionBody);De(o,s.map(e=>e.variableType),i||"item()*",(...t)=>e.apply(this.getInScopeContext(),[...t,this.getOwnerForm()]));break}case"text/xpath":{const e=(e,...t)=>_e(this.functionBody,this.getInScopeContext(),this.getOwnerForm(),s.reduce((e,n,r)=>(e[n.variableName.replace("$","")]=t[r],e),{}));De(o,s.map(e=>e.variableType),i||"item()*",e);break}default:throw new Error(`Unexpected mimetype ${e} for function`)}}}customElements.define("fx-function",Kt);
+//# sourceMappingURL=fore-debug.js.map
diff --git a/src/js/fore-debug.js.map b/src/js/fore-debug.js.map
new file mode 100644
index 0000000..d56cde0
--- /dev/null
+++ b/src/js/fore-debug.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"fore-debug.js","sources":["../node_modules/whynot/dist/whynot.esm.js","../node_modules/xspattern/dist/xspattern.esm.js","../node_modules/fontoxpath/dist/fontoxpath.esm.js","../src/DependencyNotifyingDomFacade.js","../src/xpath-util.js","../src/dep_graph.js","../src/fore.js","../src/xpath-evaluation.js","../src/fx-instance.js","../src/modelitem.js","../src/fx-model.js","../src/getInScopeContext.js","../src/ForeElementMixin.js","../src/fx-bind.js","../node_modules/toastify-js/src/toastify-es.js","../node_modules/@jinntec/jinn-toast/src/JinnToast.js","../src/fx-fore.js","../src/fx-submission.js","../src/fx-header.js","../node_modules/lit-html/lib/dom.js","../node_modules/lit-html/lib/template.js","../node_modules/lit-html/lib/directive.js","../node_modules/lit-html/lib/part.js","../node_modules/lit-html/lib/template-instance.js","../node_modules/lit-html/lib/template-result.js","../node_modules/lit-html/lib/parts.js","../node_modules/lit-html/lib/default-template-processor.js","../node_modules/lit-html/lit-html.js","../node_modules/lit-html/lib/shady-render.js","../node_modules/lit-element/lib/updating-element.js","../node_modules/lit-element/lib/css-tag.js","../node_modules/lit-element/lit-element.js","../src/ui/abstract-control.js","../src/ui/fx-alert.js","../src/ui/fx-control.js","../src/ui/fx-container.js","../src/ui/fx-group.js","../src/ui/fx-hint.js","../src/ui/fx-output.js","../src/ui/fx-repeatitem.js","../src/ui/fx-repeat.js","../src/ui/fx-switch.js","../src/ui/fx-trigger.js","../src/ui/fx-case.js","../src/actions/abstract-action.js","../src/actions/fx-append.js","../src/actions/fx-delete.js","../src/actions/fx-insert.js","../src/actions/fx-message.js","../src/actions/fx-setvalue.js","../src/actions/fx-send.js","../src/actions/fx-action.js","../src/actions/fx-toggle.js","../src/actions/fx-dispatch.js","../src/actions/fx-update.js","../src/actions/fx-refresh.js","../src/actions/fx-confirm.js","../src/functions/fx-function.js"],"sourcesContent":["function t(t,s,r,i){const n={op:s,func:r,data:i};return t.push(n),n}function s(t,s){return t}class r{constructor(){this.program=[]}test(s,r){return t(this.program,5,s,void 0===r?null:r)}jump(s){return t(this.program,3,null,s)}record(r,i){return t(this.program,4,void 0===i?s:i,r)}bad(s=1){return t(this.program,1,null,s)}accept(){return t(this.program,0,null,null)}fail(s){return t(this.program,2,s||null,null)}}class i{constructor(t,s,r){this.programLength=t,this.maxFromByPc=s,this.maxSurvivorFromByPc=r}static fromProgram(t){const s=t.length,r=[],n=[];return t.forEach((t=>{r.push(0),n.push(0)})),t.forEach(((t,i)=>{switch(t.op){case 2:if(null===t.func)return;if(i+1>=s)throw new Error(\"Invalid program: program could run past end\");r[i+1]+=1;break;case 1:case 4:if(i+1>=s)throw new Error(\"Invalid program: program could run past end\");r[i+1]+=1;break;case 3:t.data.forEach((t=>{if(t<0||t>=s)throw new Error(\"Invalid program: program could run past end\");r[t]+=1}));break;case 5:if(i+1>=s)throw new Error(\"Invalid program: program could run past end\");n[i+1]+=1;break;case 0:n[i]+=1}})),new i(s,r,n)}static createStub(t){const s=[],r=[];for(let i=0;i0}}class h{constructor(t){this.t=0,this.i=0,this.h=new Uint16Array(t),this.l=new Uint8Array(t)}getBadness(t){return this.l[t]}add(t,s){this.l[t]=s>255?255:s;const r=function(t,s,r,i,n){let h=i,e=n;for(;h>>1;r255?255:s);if(this.l[t]!==r){const s=this.h.indexOf(t,this.i);if(s<0||s>=this.t)return void(this.l[t]=r);this.h.copyWithin(s,s+1,this.t),this.t-=1,this.add(t,r)}}getNextPc(){return this.i>=this.t?null:this.h[this.i++]}reset(){this.t=0,this.i=0,this.l.fill(0)}}class e{constructor(t){this.o=[];let s=t.length;t.forEach((t=>{this.o.push(t>0?s:-1),s+=t})),this.u=new Uint16Array(s)}clear(){this.u.fill(0,0,this.o.length)}add(t,s){const r=this.u[s],i=this.o[s];this.u[s]+=1,this.u[i+r]=t}has(t){return this.u[t]>0}forEach(t,s){const r=this.u[t],i=this.o[t];for(let t=i;t{const r=this.trace(s,i,n,h);var c,o,u;o=r,u=e,t=null===(c=t)?o:null===o?c:Array.isArray(o)?o.reduce(((t,s)=>l(t,s,t===o)),c):l(c,o,u),e=t===r})),t}trace(t,s,r,i){switch(this.p[t]){case 2:return this.v[t];case 1:return null}this.p[t]=1;let n=null;const h=s[t];if(null!==h)n=h;else if(!r.has(t))throw new Error(`Trace without source at pc ${t}`);if(n=this.mergeTraces(n,t,r,s,r,i),null!==n){const s=i[t];null!==s&&(n=o(n,s))}return this.v[t]=n,this.p[t]=2,n}buildSurvivorTraces(t,s,r,i,n){for(let h=0,e=t.length;hl(t,this.k[s])),null);return null===s?[]:Array.isArray(s)?s:[s]}}class f{constructor(t){this.I=[],this.N=new h(t.programLength),this.M=new h(t.programLength),this.P=new a(t)}reset(){this.N.reset(),this.N.add(0,0),this.I.length=0,this.P.reset(!0)}getNextThreadPc(){return this.N.getNextPc()}step(t,s,r){const i=this.P.has(s);this.P.add(t,s);const n=this.N.getBadness(t)+r;i?this.N.reschedule(s,n):this.N.add(s,n)}stepToNextGeneration(t,s){const r=this.P.hasSurvivor(s);this.P.addSurvivor(t,s);const i=this.N.getBadness(t);r?this.M.reschedule(s,i):this.M.add(s,i)}accept(t){this.I.push(t),this.P.addSurvivor(t,t)}fail(t){}record(t,s){this.P.record(t,s)}nextGeneration(){this.P.buildSurvivorTraces(),this.P.reset(!1);const t=this.N;t.reset(),this.N=this.M,this.M=t}getAcceptingTraces(){return this.P.getTraces(this.I)}}class d{constructor(t){this.U=[],this.G=t,this.V=i.fromProgram(t),this.U.push(new f(this.V))}execute(t,s){const r=this.U.pop()||new f(this.V);r.reset();const i=t.length;let h,e=-1;do{let n=r.getNextThreadPc();if(null===n)break;for(++e,h=e>=i?null:t[e];null!==n;){const t=this.G[n];switch(t.op){case 0:null===h?r.accept(n):r.fail(n);break;case 2:{const i=t.func;if(null===i||i(s)){r.fail(n);break}r.step(n,n+1,0);break}case 1:r.step(n,n+1,t.data);break;case 5:if(null===h){r.fail(n);break}if(!(0,t.func)(h,t.data,s)){r.fail(n);break}r.stepToNextGeneration(n,n+1);break;case 3:{const s=t.data,i=s.length;if(0===i){r.fail(n);break}for(let t=0;tB===A}function a(A,B){if(null===A||null===B)throw new Error(\"unescaped hyphen may not be used as a range endpoint\");if(BA<=a&&a<=B}function n(A){return!0}function e(){return!1}function t(A,B){return a=>A(a)||B(a)}function G(A,B){switch(B.kind){case\"predicate\":return void A.test(B.value);case\"regexp\":return void r(A,B.value,!1)}}function i(A,B){B.forEach((B=>{!function(A,B){const[a,{min:n,max:e}]=B;if(null!==e){for(let B=0;B0){for(let B=0;B!0)),A.jump([n]));const t=[];if(B.forEach((B=>{e.data.push(A.program.length),i(A,B),t.push(A.jump([]))})),t.forEach((B=>{B.data.push(A.program.length)})),a){const B=A.program.length,a=A.jump([]);a.data.push(A.program.length),A.test((()=>!0)),A.jump([B]),a.data.push(A.program.length)}}function o(A,B){return{success:!0,offset:A,value:B}}function l(A){return o(A,void 0)}function H(A,B,a=!1){return{success:!1,offset:A,expected:B,fatal:a}}function u(A){return(B,a)=>{const n=a+A.length;return B.slice(a,n)===A?o(n,A):H(a,[A])}}function C(A,B){return(a,n)=>{const e=A(a,n);return e.success?o(e.offset,B(e.value)):e}}function s(A,B,a){return(n,e)=>{const t=A(n,e);return t.success?B(t.value)?t:H(e,a):t.offset===e?H(e,a):t}}function c(A){return(B,a)=>{let n=null;for(const e of A){const A=e(B,a);if(A.success)return A;if(null===n||A.offset>n.offset?n=A:A.offset===n.offset&&(n.expected=n.expected.concat(A.expected)),A.fatal)break}return n||H(a,[])}}function D(A){return(B,a)=>{const n=A(B,a);return n.success||n.fatal?n:o(a,null)}}function m(A){return(B,a)=>{let n=[],e=a;for(;;){const a=A(B,e);if(!a.success){if(a.fatal)return a;break}n.push(a.value),e=a.offset}return o(e,n)}}function h(A,B,a){return(n,e)=>{const t=A(n,e);if(!t.success)return t;const G=B(n,t.offset);return G.success?o(G.offset,a(t.value,G.value)):G}}function I(A){return h(A,m(A),((A,B)=>[A].concat(B)))}function d(A,B){return A}function T(A,B){return B}function p(A,B){return h(A,B,T)}function E(A,B){return h(A,B,d)}function f(A,B,a,n=!1){return p(A,n?F(E(B,a)):E(B,a))}function g(A,B){return(a,n)=>A(a,n).success?H(n,B):l(n)}function F(A){return(B,a)=>{const n=A(B,a);return n.success?n:H(n.offset,n.expected,!0)}}const P=(A,B)=>A.length===B?l(B):H(B,[\"end of input\"]);const M=[\"Lu\",\"Ll\",\"Lt\",\"Lm\",\"Lo\",\"Mn\",\"Mc\",\"Me\",\"Nd\",\"Nl\",\"No\",\"Pc\",\"Pd\",\"Ps\",\"Pe\",\"Pi\",\"Pf\",\"Po\",\"Zs\",\"Zl\",\"Zp\",\"Sm\",\"Sc\",\"Sk\",\"So\",\"Cc\",\"Cf\",\"Co\",\"Cn\"],J={};function S(A){return A.codePointAt(0)}\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\".split(\"\").forEach(((A,B)=>{J[A]=B}));const K=A=>-1===A||-2===A;function b(A){return B=>!K(B)&&!A(B)}function y(A,B){return null===B?A:a=>A(a)&&!B(a)}const Q=function(A,B){const n=new Map;let e=0;return A.forEach(((A,G)=>{const i=B[G];null!==A&&A.split(\"|\").forEach((A=>{const B=n.get(A),G=a(e,e+i-1);n.set(A,B?t(B,G):G)})),e+=i})),n}([\"BasicLatin\",\"Latin-1Supplement\",\"LatinExtended-A\",\"LatinExtended-B\",\"IPAExtensions\",\"SpacingModifierLetters\",\"CombiningDiacriticalMarks\",\"GreekandCoptic|Greek\",\"Cyrillic\",\"CyrillicSupplement\",\"Armenian\",\"Hebrew\",\"Arabic\",\"Syriac\",\"ArabicSupplement\",\"Thaana\",\"NKo\",\"Samaritan\",\"Mandaic\",\"SyriacSupplement\",null,\"ArabicExtended-A\",\"Devanagari\",\"Bengali\",\"Gurmukhi\",\"Gujarati\",\"Oriya\",\"Tamil\",\"Telugu\",\"Kannada\",\"Malayalam\",\"Sinhala\",\"Thai\",\"Lao\",\"Tibetan\",\"Myanmar\",\"Georgian\",\"HangulJamo\",\"Ethiopic\",\"EthiopicSupplement\",\"Cherokee\",\"UnifiedCanadianAboriginalSyllabics\",\"Ogham\",\"Runic\",\"Tagalog\",\"Hanunoo\",\"Buhid\",\"Tagbanwa\",\"Khmer\",\"Mongolian\",\"UnifiedCanadianAboriginalSyllabicsExtended\",\"Limbu\",\"TaiLe\",\"NewTaiLue\",\"KhmerSymbols\",\"Buginese\",\"TaiTham\",\"CombiningDiacriticalMarksExtended\",\"Balinese\",\"Sundanese\",\"Batak\",\"Lepcha\",\"OlChiki\",\"CyrillicExtended-C\",\"GeorgianExtended\",\"SundaneseSupplement\",\"VedicExtensions\",\"PhoneticExtensions\",\"PhoneticExtensionsSupplement\",\"CombiningDiacriticalMarksSupplement\",\"LatinExtendedAdditional\",\"GreekExtended\",\"GeneralPunctuation\",\"SuperscriptsandSubscripts\",\"CurrencySymbols\",\"CombiningDiacriticalMarksforSymbols|CombiningMarksforSymbols\",\"LetterlikeSymbols\",\"NumberForms\",\"Arrows\",\"MathematicalOperators\",\"MiscellaneousTechnical\",\"ControlPictures\",\"OpticalCharacterRecognition\",\"EnclosedAlphanumerics\",\"BoxDrawing\",\"BlockElements\",\"GeometricShapes\",\"MiscellaneousSymbols\",\"Dingbats\",\"MiscellaneousMathematicalSymbols-A\",\"SupplementalArrows-A\",\"BraillePatterns\",\"SupplementalArrows-B\",\"MiscellaneousMathematicalSymbols-B\",\"SupplementalMathematicalOperators\",\"MiscellaneousSymbolsandArrows\",\"Glagolitic\",\"LatinExtended-C\",\"Coptic\",\"GeorgianSupplement\",\"Tifinagh\",\"EthiopicExtended\",\"CyrillicExtended-A\",\"SupplementalPunctuation\",\"CJKRadicalsSupplement\",\"KangxiRadicals\",null,\"IdeographicDescriptionCharacters\",\"CJKSymbolsandPunctuation\",\"Hiragana\",\"Katakana\",\"Bopomofo\",\"HangulCompatibilityJamo\",\"Kanbun\",\"BopomofoExtended\",\"CJKStrokes\",\"KatakanaPhoneticExtensions\",\"EnclosedCJKLettersandMonths\",\"CJKCompatibility\",\"CJKUnifiedIdeographsExtensionA\",\"YijingHexagramSymbols\",\"CJKUnifiedIdeographs\",\"YiSyllables\",\"YiRadicals\",\"Lisu\",\"Vai\",\"CyrillicExtended-B\",\"Bamum\",\"ModifierToneLetters\",\"LatinExtended-D\",\"SylotiNagri\",\"CommonIndicNumberForms\",\"Phags-pa\",\"Saurashtra\",\"DevanagariExtended\",\"KayahLi\",\"Rejang\",\"HangulJamoExtended-A\",\"Javanese\",\"MyanmarExtended-B\",\"Cham\",\"MyanmarExtended-A\",\"TaiViet\",\"MeeteiMayekExtensions\",\"EthiopicExtended-A\",\"LatinExtended-E\",\"CherokeeSupplement\",\"MeeteiMayek\",\"HangulSyllables\",\"HangulJamoExtended-B\",\"HighSurrogates\",\"HighPrivateUseSurrogates\",\"LowSurrogates\",\"PrivateUseArea|PrivateUse\",\"CJKCompatibilityIdeographs\",\"AlphabeticPresentationForms\",\"ArabicPresentationForms-A\",\"VariationSelectors\",\"VerticalForms\",\"CombiningHalfMarks\",\"CJKCompatibilityForms\",\"SmallFormVariants\",\"ArabicPresentationForms-B\",\"HalfwidthandFullwidthForms\",\"Specials\",\"LinearBSyllabary\",\"LinearBIdeograms\",\"AegeanNumbers\",\"AncientGreekNumbers\",\"AncientSymbols\",\"PhaistosDisc\",null,\"Lycian\",\"Carian\",\"CopticEpactNumbers\",\"OldItalic\",\"Gothic\",\"OldPermic\",\"Ugaritic\",\"OldPersian\",null,\"Deseret\",\"Shavian\",\"Osmanya\",\"Osage\",\"Elbasan\",\"CaucasianAlbanian\",null,\"LinearA\",null,\"CypriotSyllabary\",\"ImperialAramaic\",\"Palmyrene\",\"Nabataean\",null,\"Hatran\",\"Phoenician\",\"Lydian\",null,\"MeroiticHieroglyphs\",\"MeroiticCursive\",\"Kharoshthi\",\"OldSouthArabian\",\"OldNorthArabian\",null,\"Manichaean\",\"Avestan\",\"InscriptionalParthian\",\"InscriptionalPahlavi\",\"PsalterPahlavi\",null,\"OldTurkic\",null,\"OldHungarian\",\"HanifiRohingya\",null,\"RumiNumeralSymbols\",null,\"OldSogdian\",\"Sogdian\",null,\"Elymaic\",\"Brahmi\",\"Kaithi\",\"SoraSompeng\",\"Chakma\",\"Mahajani\",\"Sharada\",\"SinhalaArchaicNumbers\",\"Khojki\",null,\"Multani\",\"Khudawadi\",\"Grantha\",null,\"Newa\",\"Tirhuta\",null,\"Siddham\",\"Modi\",\"MongolianSupplement\",\"Takri\",null,\"Ahom\",null,\"Dogra\",null,\"WarangCiti\",null,\"Nandinagari\",\"ZanabazarSquare\",\"Soyombo\",null,\"PauCinHau\",null,\"Bhaiksuki\",\"Marchen\",null,\"MasaramGondi\",\"GunjalaGondi\",null,\"Makasar\",null,\"TamilSupplement\",\"Cuneiform\",\"CuneiformNumbersandPunctuation\",\"EarlyDynasticCuneiform\",null,\"EgyptianHieroglyphs\",\"EgyptianHieroglyphFormatControls\",null,\"AnatolianHieroglyphs\",null,\"BamumSupplement\",\"Mro\",null,\"BassaVah\",\"PahawhHmong\",null,\"Medefaidrin\",null,\"Miao\",null,\"IdeographicSymbolsandPunctuation\",\"Tangut\",\"TangutComponents\",null,\"KanaSupplement\",\"KanaExtended-A\",\"SmallKanaExtension\",\"Nushu\",null,\"Duployan\",\"ShorthandFormatControls\",null,\"ByzantineMusicalSymbols\",\"MusicalSymbols\",\"AncientGreekMusicalNotation\",null,\"MayanNumerals\",\"TaiXuanJingSymbols\",\"CountingRodNumerals\",null,\"MathematicalAlphanumericSymbols\",\"SuttonSignWriting\",null,\"GlagoliticSupplement\",null,\"NyiakengPuachueHmong\",null,\"Wancho\",null,\"MendeKikakui\",null,\"Adlam\",null,\"IndicSiyaqNumbers\",null,\"OttomanSiyaqNumbers\",null,\"ArabicMathematicalAlphabeticSymbols\",null,\"MahjongTiles\",\"DominoTiles\",\"PlayingCards\",\"EnclosedAlphanumericSupplement\",\"EnclosedIdeographicSupplement\",\"MiscellaneousSymbolsandPictographs\",\"Emoticons\",\"OrnamentalDingbats\",\"TransportandMapSymbols\",\"AlchemicalSymbols\",\"GeometricShapesExtended\",\"SupplementalArrows-C\",\"SupplementalSymbolsandPictographs\",\"ChessSymbols\",\"SymbolsandPictographsExtended-A\",null,\"CJKUnifiedIdeographsExtensionB\",null,\"CJKUnifiedIdeographsExtensionC\",\"CJKUnifiedIdeographsExtensionD\",\"CJKUnifiedIdeographsExtensionE\",\"CJKUnifiedIdeographsExtensionF\",null,\"CJKCompatibilityIdeographsSupplement\",null,\"Tags\",null,\"VariationSelectorsSupplement\",null,\"SupplementaryPrivateUseArea-A|PrivateUse\",\"SupplementaryPrivateUseArea-B|PrivateUse\"],[128,128,128,208,96,80,112,144,256,48,96,112,256,80,48,64,64,64,32,16,48,96,128,128,128,128,128,128,128,128,128,128,128,128,256,160,96,256,384,32,96,640,32,96,32,32,32,32,128,176,80,80,48,96,32,32,144,80,128,64,64,80,48,16,48,16,48,128,64,64,256,256,112,48,48,48,80,64,112,256,256,64,32,160,128,32,96,256,192,48,16,256,128,128,256,256,96,32,128,48,80,96,32,128,128,224,16,16,64,96,96,48,96,16,32,48,16,256,256,6592,64,20992,1168,64,48,320,96,96,32,224,48,16,64,96,32,48,48,32,96,32,96,32,96,32,48,64,80,64,11184,80,896,128,1024,6400,512,80,688,16,16,16,32,32,144,240,16,128,128,64,80,64,48,128,32,64,32,48,32,48,32,64,32,80,48,48,80,48,64,144,384,128,64,32,32,48,48,32,32,32,64,32,96,96,32,32,32,64,64,32,32,48,80,80,48,128,64,288,32,128,48,64,112,32,128,80,48,80,48,96,32,80,48,48,80,128,128,128,96,160,128,96,32,80,48,64,192,80,80,96,160,96,80,96,16,64,256,112,80,64,96,80,304,32,192,64,1024,128,208,2736,1072,16,4032,640,8576,576,48,96,48,144,688,96,96,160,64,32,6144,768,9472,256,48,64,400,2304,160,16,4944,256,256,80,144,32,96,32,128,1024,688,1360,48,208,80,368,64,1280,224,32,96,784,80,64,80,176,256,256,48,112,96,256,256,768,80,48,128,128,128,256,256,112,144,1280,42720,32,4160,224,5776,7488,3088,544,722400,128,128,240,65040,65536,65536]),x=function(A){const n=new Map,G=A.split(\"\"),i=M.map((()=>[]));let r=0,o=0;for(;o{const a=i[B].reduce(t,e);n.set(A,a);const G=A.charAt(0),r=l.get(G)||[];l.set(G,r),r.push(a)})),l.forEach(((A,B)=>{n.set(B,A.reduce(t,e))})),n}(\"bfUATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAbgUATAYDaATAZAaAGARAXAcAaAZAaAXAMBZADATBZAMAGASAMCTACWXACGDXXADHA3DAAPDAAtCAAFDBCAADCAABCCDBCCABCAABCCDCCAABCAAFCAADDAABCAABCBADCBDBGACADCGDCAEADACAEADACAEADAAPDAARDACAEADAABCBA7DFCAABCBDBABCCAJjDBAAGADaFRZDFLZNFEZGFAZAFAZQnvBAAADFAZACADABBFADCTACABDZBCATACCBACABACAABCQBACIDiCADBCCDCAXDDCADAXAABCBDBCyDvAhaAHEJBA1CAANDAgfBAABAClBBFATFDoTAOABBaBYABAHsOAHATAHBTAHBTAHABHGaBDGDTBBKcFXCTBYATBaBHKTAcABATBGfFAGJHUKJTDGBHAmiBAATAGAHGcAaAHFFBHBaAHDGBKJGCaBGATNBAcAGAHAGdHaBBmYBAAHKGABNKJGgHIFBaATCFABBHAYBGVHDFAHIFAHCFAHEBBTOBAGYHCBBTABAGKB0GUBAGHBUHOcAHfIAG1HAIAHAGAICHHIDHAIBGAHGGJHBTBKJTAFAGOHAIBBAGHBBGBBBGVBAGGBAGABCGDBBHAGAICHDBBIBBBIBHAGABHIABDGBBAGCHBBBKJGBYBMFaAYAGATAHABBHBIABAGFBDGBBBGVBAGGBAGBBAGBBAGBBBHABAICHBBDHBBBHCBCHABGGDBAGABGKJHBGCHATABJHBIABAGIBAGCBAGVBAGGBAGBBAGEBBHAGAICHEBAHBIABAIBHABBGABOGBHBBBKJTAYABGGAHFBAHAIBBAGHBBGBBBGVBAGGBAGBBAGEBBHAGAIAHAIAHDBBIBBBIBHABHHAIABDGBBAGCHBBBKJaAGAMFBJHAGABAGFBCGCBAGDBCGBBAGABAGBBCGBBCGCBCGLBDIBHAIBBCICBAICHABBGABFIABNKJMCaFYAaABEHAICHAGHBAGCBAGWBAGPBCGAHCIDBAHCBAHDBGHBBAGCBEGBHBBBKJBGTAMGaAGAHAIBTAGHBAGCBAGWBAGJBAGEBBHAGAIAHAIEBAHAIBBAIBHBBGIBBGGABAGBHBBBKJBAGBBMHBIBBAGHBAGCBAGoHBGAICHDBAICBAICHAGAaABDGCIAMGGCHBBBKJMIaAGFBBIBBAGRBCGXBAGIBAGABBGGBCHABDICHCBAHABAIHBFKJBBIBTABLGvHAGBHGBDYAGFFAHHTAKJTBBkGBBAGABAGEBAGXBAGABAGJHAGBHIGABBGEBAFABAHFBBKJBBGDBfGAaCTOaATAaCHBaFKJMJaAHAaAHAaAHAPAQAPAQAIBGHBAGjBDHNIAHETAHBGEHKBAHjBAaHHAaFBAaBTEaDTBBkGqIBHDIAHFIAHBIBHBGAKJTFGFIBHBGDHCGAICGBIGGCHDGMHAIBHBIFHAGAIAKJICHAaBClBACABECABBDqTAFADCmIFAABAGDBBGGBAGABAGDBBGoBAGDBBGgBAGDBBGGBAGABAGDBBGOBAG4BAGDBBmCBAABBHCTIMTBCGPaJBFiVBAABBDFBBOAmrJAAaATAGQUAGZPAQABCmKBAATCLCGHBGGMBAGDHCBKGRHCTBBIGRHBBLGMBAGCBAHBBLGzHBIAHGIHHAIBHKTCFATCYAGAHABBKJBFMJBFTFOATDHCcABAKJBFGiFAG0BGGEHBGhHAGABEmFBAABJGeBAHCIDHBICBDIBHAIFHCBDaABCTBKJGdBBGEBKGrBDGZBFKJMABCahGWHBIBHABBTBG0IAHAIAHGBAHAIAHAIBHHIFHJBBHAKJBFKJBFTGFATFBBHNJAhABAAHDIAGuHAIAHEIAHAIEHAIBGGBDKJTGaJHIaIBCHBIAGdIAHDIBHBIAHCGBKJGrHAIAHBICHAIAHCIBBHTDGjIHHHIBHBBCTEKJBCGCKJGdFFTBDIBGCqBBCCTHBHHCTAHMIAHGGDHAGFHAGBIAHBGABEDrF+DMFADhFkH5BAHEgVCAADHghBAADHCHDFBBCFBBDHCHDHCHDFBBCFBBDHBACABACABACABACADHCHDNBBDHEHDHEHDHEHDEBADBCDEAZADAZCDCBADBCDEAZCDDBBDBCDBAZCDHCEZCBBDCBADBCDEAZBBAUKcEOFTBRASAPARBSAPARATHVAWAcEUATIRASATDNBTCXAPAQATKXATANATJUAcEBAcJMAFABBMFXCPAQAFAMJXCPAQABAFMBCYfBPHMJDHAJCHLBOaBCAaDCAaBDACCDBCCDAaACAaBXACEaFCAaACAaACAaACDaADACDDAGDDAaBDBCBXECADDaAXAaBDAaAMPLiCADALDMAaBBDXEaEXBaDXAaBXAaBXAaGXAaeXBaBXAaAXAae3LEAAaHPAQAPAQAaTXBaGPAQA6QBAAXAadXYanXF6EBAABYaKBUM76NBAAMV62CAAXAaIXAa1XH6uBAAXA63DAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAMdarXEPAQAXePAQAPAQAPAQAPAQAPAQAXP6/DAA3CCAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAX+PAQAPAQAXfPAQA3BEAAavXUaBXFamBBafBB6nBAACuBADuBAABCCDBAFCCADDACADFFBCBgjBAADAaFADHCCADABETDMATBDlBADABEDABBG3BGFATABNHAGWBIGGBAGGBAGGBAGGBAGGBAGGBAGGBAGGBAHfTBRASARASATCRASATARASATIOATBOATARASATBRASAPAQAPAQAPAQAPAQATEFATJOBTDOATAPATMBvaZBA6YBAABL6VDAABZaLBDUATCaAFAGALAPAQAPAQAPAQAPAQAPAQAaBPAQAPAQAPAQAPAQAOAPAQBaALIHDIBOAFEaBLCFAGATAaBBAmVBAABBHBZBFBGAOAmZBAATAFCGABEGqBAmdBAABAaBMDaJGaBEajBLGPaeBAMJadMHaAMOafMJamMO6/EAAm1mBABJa/mvHFABPGUFAm2RAABCa2BIGnFFTBmLEAAFATCGPKJGBBTAtGAHAJCTAHJTAFAAbFBHBmFBAALJHBTFBHZWFIZBANDBA9FADHADCAAJFAZBADGAADDBATCDABCDALBBABCCBvGAFBDAGGHAGCHAGDHAGWIBHBIAaDBDMFaBYAaABFGzTDBHIBGxIPHBBHTBKJBFHRGFTCGATAGBHAKJGbHHTBGWHKIBBKTAGcBCHCIAGuHAIBHDIBHBICTMBAFAKJBDTBGEHAFAGIKJGEBAGoHFIBHBIBHBBIGCHAGHHAIABBKJBBTDGPFAGFaCGAIAHAIAGxHAGAHCGBHBGEHBGAHAGABXGBFATBGKIAHBIBTBGAFBIAHABJGFBBGFBBGFBIGGBAGGBADqZAFDDHBHjPBAAGiIBHAIBHAIBTAIAHABBKJBFmjuCABLGWBDGwhDgAA9/jBAmtFAABBmpBAABlDGBLDEBEGAHAGJXAGMBAGEBAGABAGBBAGBBAmrBAAZPBQmqFAAQAPABPG/BBG1BnGLYAaABBHPTGPAQATABFHPTAOBNBPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQATBPAQATDNCTCBATDOAPAQAPAQAPAQATCXAOAXCBATAYATBBDGEBAmGCAABBcABATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAPAQATAPAQATBGJFAGsFBGeBCGFBBGFBBGFBBGCBCYBXAZAaAYBBAaAXDaBBJcCaBBBGLBAGZBAGSBAGBBAGOBBGNBhm6BAABETCBDMsBCaIL0MDaQMBaCBAaLBDaABuasHAhBCAAGcBCGwBOHAMaBDGfMDBIGTLAGHLABEGlHEBEGdBATAGjBDGHTALEBpCnDnmNBAABBKJBFCjBDDjBDGnBHGzBKTAhPCAAm2EAABIGVBJGHhXCAAGFBBGABAGrBAGBBCGABBGWBATAMHGWaBMGGeBHMIBvGSBAGBBEMEGVMFBCTAGZBETAB/G3BDMBGBMPBBMtGAHCBAHBBEHDGDBAGCBAGcBBHCBDHAMIBGTIBGGcMBTAGcMCBfGHaAGbHBBDMETGBIG1BCTGGVBBMHGSBEMHGRBGTDBLMGhPBAAmIBAAB2CyBMDyBGMFGjHDBHKJhlEAAMehACAAGcMJGABHGVHKMDTEhFCAAGWBIIAHAIAG0HOTGBDMTKJBOHCIAGsICHDIBHBTBcATDBKcABBGYBGKJBFHCGjHEIAHHBAKJTDGAIBBIGiHATBGABIHBIAGvICHIIBGDTDHDTABBKJGATAGATCBAMTBKGRBAGYICHCIBHAIAHBTFHAhABAAGGBAGABAGDBAGOBAGJTABFGuHAICHHBEKJBFHBIBBAGHBBGBBBGVBAGGBAGBBAGEBAHBGAIBHAIDBBIBBBICBBGABFIABEGEIBBBHGBCHEhKCAAG0ICHHIBHCIAHAGDTEKJBATABATAHAGABfGvICHFIAHAIDHBIAHBGBTAGABHKJhlCAAGuICHDBBIDHBIAHBTWGDHBBhGvICHHIBHAIAHBTCGABKKJBFTMBSGqHAIAHAIBHFIAHAGABGKJB1GaBBHCIBHDIAHEBDKJMBTCaAh/CAAGrICHIIAHBTAhjBAACfDfKJMIBLGAhfCAAGHBBGmICHDBBHBIDHAGATAGAIABaGAHJGnHFIAGAHDTHHABHGAHFIBHCGtHMIAHBTCGATEBcG4hGEAAGIBAGkIAHGBAHFIAHAGATEBJKJMSBCTBGdBBHVBAIAHGIAHBIAHBhIBAAGGBAGBBAGlHFBCHABAHBBAHGGAHABHKJBFGFBAGBBAGfIEBAHBBAIBHAIAHAGABGKJh1EAAGSHBIBTBhGDAAMUaHYDaQBMTAmZOAAhlBAAruBAABATEBKmDDAAh7qAAmuQAABAcIhG/AAmGJAAh4GCAm4IAABGGeBAKJBDTBhfBAAGdBBHETABJGvHGTEaDFDTAaABJKJBAMGBAGUBEGShvKAACfDfMWTDhkBAAmKBAABDHAGAI2BGHDFMB/FBTAFABbm3fBABHmyLAAhMUCAmeEAABwGCBQGDBHmLGAAhDkAAmqBAABEGMBCGIBGGJBBaAHBTAcDhbNBA61DAABJamBBa7IBHCaCIFcHHHaBHGadHDa6BW6BBAAHCaAhZCAAMTBL6WBAABIMYhGCAACZDZCZDGBADRCZDZCABACBBBCABBCBBBCDBACHDDBADABADGBADKCZDZCBBACDBBCHBACGBADZCBBACDBACEBACABCCGBADZCZDZCZDZCZDZCZDZCZDZCZDbBBCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCADABBKx6/HAAH2aDHxaHHAaNHAaBTEBOHEBAHOhPVAAHGBAHQBBHGBAHBBAHEhUDAAGsBCHGFGBBKJBDGAaAhvFAAGrHDKJBEYAh/TAAmEDAABBMIHGBoChDhHGFABDKJBDTBhQMAAM6aAMCYAMDhLBAAMsaAMOhBDAAGDBAGaBAGBBAGABBGABAGJBAGDBAGABAGABFGABDGABAGABAGABAGCBAGBBAGABBGABAGABAGABAGABAGABAGBBAGABBGDBAGGBAGDBAGDBAGABAGJBAGQBEGCBAGEBAGQBzXBhNEAAarBD6jBAABLaOBBaOBAaOBAakBJMMBC6cBAABCa8B4acBMarBDaIBGaBBNaFhZCAA66DAAZE6VLAABJaMBCaKBE6zBAABL6YBAABGaLBTaLBDa3BHaJBFanBHadhRBAAaLBA6kBAABAaDBCaoBBaFBCacBB6GCAABLaNBBaDBDaCBEaCBMaFhpVAAmWbKABom0ABABKmdDAABBmBaBABNmw0BAhewAAmdIAAhiXwCcABd8fBAAh/BAAnvDAAhP4PA99/PABB99/PA\");function L(A){return 32===A||9===A||10===A||13===A}const Z=[B(S(\":\")),a(S(\"A\"),S(\"Z\")),B(S(\"_\")),a(S(\"a\"),S(\"z\")),a(192,214),a(216,246),a(192,214),a(216,246),a(248,767),a(880,893),a(895,8191),a(8204,8205),a(8304,8591),a(11264,12271),a(12289,55295),a(63744,64975),a(65008,65533),a(65536,983039)].reduce(t),X=[Z,B(S(\"-\")),B(S(\".\")),a(S(\"0\"),S(\"9\")),B(183),a(768,879),a(8255,8256)].reduce(t),k=x.get(\"Nd\"),O=b(k),N=y(a(0,1114111),[x.get(\"P\"),x.get(\"Z\"),x.get(\"C\")].reduce(t)),v=b(N);function w(A){return 10!==A&&13!==A&&!K(A)}const Y={s:L,S:b(L),i:Z,I:b(Z),c:X,C:b(X),d:k,D:O,w:N,W:v},U=u(\"*\"),j=u(\"\\\\\"),R=u(\"{\"),V=u(\"}\"),W=u(\"[\"),q=u(\"]\"),$=u(\"^\"),z=u(\"$\"),_=u(\",\"),AA=u(\"-\"),BA=u(\"(\"),aA=u(\")\"),nA=u(\".\"),eA=u(\"|\"),tA=u(\"+\"),GA=u(\"?\"),iA=u(\"-[\"),rA=S(\"0\");function oA(A){function e(A){return new Set(A.split(\"\").map((A=>S(A))))}function G(A,B){const a=A.codePointAt(B);return void 0===a?H(B,[\"any character\"]):o(B+String.fromCodePoint(a).length,a)}const i=\"xpath\"===A.language?p(j,c([C(u(\"n\"),(()=>10)),C(u(\"r\"),(()=>13)),C(u(\"t\"),(()=>9)),C(c([j,eA,nA,AA,$,GA,U,tA,R,V,z,BA,aA,W,q]),(A=>S(A)))])):p(j,c([C(u(\"n\"),(()=>10)),C(u(\"r\"),(()=>13)),C(u(\"t\"),(()=>9)),C(c([j,eA,nA,AA,$,GA,U,tA,R,V,BA,aA,W,q]),(A=>S(A)))]));function r(A,B){const a=e(B);return h(u(A),D(s(G,(A=>a.has(A)),B.split(\"\"))),((A,B)=>function(A){const B=x.get(A);if(null==B)throw new Error(`${A} is not a valid unicode category`);return B}(null===B?A:A+String.fromCodePoint(B))))}const l=c([r(\"L\",\"ultmo\"),r(\"M\",\"nce\"),r(\"N\",\"dlo\"),r(\"P\",\"cdseifo\"),r(\"Z\",\"slp\"),r(\"S\",\"mcko\"),r(\"C\",\"cfon\")]),T=[a(S(\"a\"),S(\"z\")),a(S(\"A\"),S(\"Z\")),a(S(\"0\"),S(\"9\")),B(45)].reduce(t),M=c([l,C(p(u(\"Is\"),function(A){return(B,a)=>{const n=A(B,a);return n.success?o(n.offset,B.slice(a,n.offset)):n}}(I(s(G,T,[\"block identifier\"])))),(B=>function(A,B){const a=Q.get(A);if(void 0===a){if(B)return n;throw new Error(`The unicode block identifier \"${A}\" is not known.`)}return a}(B,\"xpath\"!==A.language)))]),J=f(u(\"\\\\p{\"),M,V,!0),K=C(f(u(\"\\\\P{\"),M,V,!0),b),L=p(j,C(c(\"sSiIcCdDwW\".split(\"\").map((A=>u(A)))),(A=>Y[A]))),Z=C(nA,(()=>w)),X=c([L,J,K]),k=e(\"\\\\[]\"),O=c([i,s(G,(A=>!k.has(A)),[\"unescaped character\"])]),N=c([C(AA,(()=>null)),O]),v=h(N,p(AA,N),a);function oA(A,B){return[A].concat(B||[])}const lA=C(function(A){return(B,a)=>{const n=A(B,a);return n.success?o(a,n.value):n}}(c([q,iA])),(()=>null)),HA=S(\"-\"),uA=c([C(E(E(AA,g(W,[\"not [\"])),lA),(()=>HA)),p(g(AA,[\"not -\"]),O)]),CA=c([h(C(uA,B),c([function(A,B){return CA(A,B)},lA]),oA),h(c([v,X]),c([cA,lA]),oA)]);const sA=c([h(C(O,B),c([CA,lA]),oA),h(c([v,X]),c([cA,lA]),oA)]);function cA(A,B){return sA(A,B)}const DA=C(sA,(A=>A.reduce(t))),mA=C(p($,DA),b),hA=h(c([p(g($,[\"not ^\"]),DA),mA]),D(p(AA,(function(A,B){return IA(A,B)}))),y),IA=f(W,hA,q,!0);const dA=\"xpath\"===A.language?c([C(i,B),X,IA,Z,C($,(()=>A=>-1===A)),C(z,(()=>A=>-2===A))]):c([C(i,B),X,IA,Z]),TA=\"xpath\"===A.language?e(\".\\\\?*+{}()|^$[]\"):e(\".\\\\?*+{}()|[]\"),pA=s(G,(A=>!TA.has(A)),[\"NormalChar\"]),EA=C(p(j,h(C(s(G,a(S(\"1\"),S(\"9\")),[\"digit\"]),(A=>A-rA)),m(C(s(G,a(rA,S(\"9\")),[\"digit\"]),(A=>A-rA))),((A,B)=>{B.reduce(((A,B)=>10*A+B),A)}))),(A=>{throw new Error(\"Backreferences in XPath patterns are not yet implemented.\")})),fA=\"xpath\"===A.language?c([C(pA,(A=>({kind:\"predicate\",value:B(A)}))),C(dA,(A=>({kind:\"predicate\",value:A}))),C(f(BA,p(D(u(\"?:\")),SA),aA,!0),(A=>({kind:\"regexp\",value:A}))),EA]):c([C(pA,(A=>({kind:\"predicate\",value:B(A)}))),C(dA,(A=>({kind:\"predicate\",value:A}))),C(f(BA,SA,aA,!0),(A=>({kind:\"regexp\",value:A})))]),gA=C(I(C(s(G,a(rA,S(\"9\")),[\"digit\"]),(A=>A-rA))),(A=>A.reduce(((A,B)=>10*A+B)))),FA=c([h(gA,p(_,gA),((A,B)=>{if(B({min:A,max:null}))),C(gA,(A=>({min:A,max:A})))]),PA=\"xpath\"===A.language?h(c([C(GA,(()=>({min:0,max:1}))),C(U,(()=>({min:0,max:null}))),C(tA,(()=>({min:1,max:null}))),f(R,FA,V,!0)]),D(GA),((A,B)=>A)):c([C(GA,(()=>({min:0,max:1}))),C(U,(()=>({min:0,max:null}))),C(tA,(()=>({min:1,max:null}))),f(R,FA,V,!0)]),MA=m(h(fA,C(D(PA),(A=>null===A?{min:1,max:1}:A)),((A,B)=>[A,B]))),JA=h(MA,m(p(eA,F(MA))),((A,B)=>[A].concat(B)));function SA(A,B){return JA(A,B)}const KA=function(A){return h(A,P,d)}(JA);return function(A){let B;try{B=KA(A,0)}catch(B){throw new Error(`Error parsing pattern \"${A}\": ${B.message}`)}return B.success?B.value:function(A,B,a){const n=a.map((A=>`\"${A}\"`));throw new Error(`Error parsing pattern \"${A}\" at offset ${B}: expected ${n.length>1?\"one of \"+n.join(\", \"):n[0]} but found \"${A.slice(B,B+1)}\"`)}(A,B.offset,B.expected)}}function lA(A){return[...A].map((A=>A.codePointAt(0)))}function HA(B,a={language:\"xsd\"}){const n=oA(a)(B),e=A((A=>{r(A,n,\"xpath\"===a.language),A.accept()}));return function(A){const B=\"xpath\"===a.language?[-1,...lA(A),-2]:lA(A);return e.execute(B).success}}export{HA as compile};\n//# sourceMappingURL=xspattern.esm.js.map\n","import * as xspattern from 'xspattern';\nconst fontoxpath = (function (xspattern) {\nconst VERSION='3.20.4';\nconst fontoxpathGlobal = {};\nvar D;function aa(a){var c=0;return function(){return cc||1342177279>>=1)e+=e;return g}});\nfunction hb(a,c){a=void 0!==a?String(a):\" \";return 0=m}});ea(\"Array.prototype.fill\",function(a){return a?a:function(c,e,g){var f=this.length||0;0>e&&(e=Math.max(0,f+e));if(null==g||g>f)g=f;g=Number(g);0>g&&(g=Math.max(0,f+g));for(e=Number(e||0);ee&&(e=Math.max(e+f,0));ec?-e:e}});ea(\"Number.isFinite\",function(a){return a?a:function(c){return\"number\"!==typeof c?!1:!isNaN(c)&&Infinity!==c&&-Infinity!==c}});ea(\"String.prototype.padStart\",function(a){return a?a:function(c,e){var g=cb(this,null,\"padStart\");return hb(e,c-g.length)+g}});\nfunction lb(a,c){a instanceof String&&(a+=\"\");var e=0,g=!1,f={next:function(){if(!g&&e=f}});\nea(\"String.fromCodePoint\",function(a){return a?a:function(c){for(var e=\"\",g=0;gf||1114111=f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(f>>>10&1023|55296),e+=String.fromCharCode(f&1023|56320))}return e}});\nea(\"String.prototype.codePointAt\",function(a){return a?a:function(c){var e=cb(this,null,\"codePointAt\"),g=e.length;c=Number(c)||0;if(0<=c&&cf||56319c||57343e.length)return f?1:-1;if(c.lengthe)return f?1:-1;if(cc?f?1:-1:epb(a,c)}}function ub(){return function(a,c){return 0>pb(a,c)}}function vb(){return function(a,c){return-1=a.length?Q:S(a[c])}}}D=zc.prototype;D.pb=function(){return this};D.filter=function(a){var c=this,e=-1;return this.o.create({next:function(){for(e++;e=c.h.length?Q:S(c.h[e])}})};D.first=function(){return this.h[0]};D.S=function(){return this.h};D.getEffectiveBooleanValue=function(){if(T(this.h[0].type,53))return!0;throw oc();};D.ya=function(){return this.h.length};D.F=function(){return!1};\nD.za=function(){return!1};D.map=function(a){var c=this,e=-1;return this.o.create({next:function(){return++e>=c.h.length?Q:S(a(c.h[e],e,c))}},this.h.length)};D.M=function(a){return a(this.h)};D.aa=function(a){return a.multiple?a.multiple(this):a.default(this)};function Ac(){this.value={next:function(){return Q}}}D=Ac.prototype;D.pb=function(){return this};D.filter=function(){return this};D.first=function(){return null};D.S=function(){return[]};D.getEffectiveBooleanValue=function(){return!1};D.ya=function(){return 0};D.F=function(){return!0};D.za=function(){return!1};D.map=function(){return this};D.M=function(a){return a([])};D.aa=function(a){return a.empty?a.empty(this):a.default(this)};function Bc(a){var c=a.value;if(T(a.type,53))return!0;if(T(a.type,0))return c;if(T(a.type,1)||T(a.type,20)||T(a.type,19))return 0!==c.length;if(T(a.type,2))return!isNaN(c)&&0!==c;throw oc();};function Cc(a,c){var e=this;this.J=U;this.value={next:function(g){if(null!==e.o&&e.h>=e.o)return Q;if(void 0!==e.B[e.h])return S(e.B[e.h++]);g=a.next(g);if(g.done)return e.o=e.h,g;if(e.v||2>e.h)e.B[e.h]=g.value;e.h++;return g}};this.v=!1;this.B=[];this.h=0;this.o=void 0===c?null:c}D=Cc.prototype;D.pb=function(){return this.J.create(this.S())};D.filter=function(a){var c=this,e=-1,g=this.value;return this.J.create({next:function(f){e++;for(var m=g.next(f);!m.done&&!a(m.value,e,c);)e++,m=g.next(f);return m}})};\nD.first=function(){if(void 0!==this.B[0])return this.B[0];var a=this.value.next(0);Dc(this);return a.done?null:a.value};D.S=function(){if(this.h>this.B.length&&this.o!==this.B.length)throw Error(\"Implementation error: Sequence Iterator has progressed.\");var a=this.value;this.v=!0;for(var c=a.next(0);!c.done;)c=a.next(0);return this.B};\nD.getEffectiveBooleanValue=function(){var a=this.value,c=this.h;Dc(this);var e=a.next(0);if(e.done)return Dc(this,c),!1;e=e.value;if(T(e.type,53))return Dc(this,c),!0;if(!a.next(0).done)throw oc();Dc(this,c);return Bc(e)};D.ya=function(a){if(null!==this.o)return this.o;if(void 0===a?0:a)return-1;a=this.h;var c=this.S().length;Dc(this,a);return c};D.F=function(){return 0===this.o?!0:null===this.first()};\nD.za=function(){if(null!==this.o)return 1===this.o;var a=this.value,c=this.h;Dc(this);if(a.next(0).done)return Dc(this,c),!1;a=a.next(0);Dc(this,c);return a.done};D.map=function(a){var c=this,e=0,g=this.value;return this.J.create({next:function(f){f=g.next(f);return f.done?Q:S(a(f.value,e++,c))}},this.o)};D.M=function(a,c){var e=this.value,g,f=[],m=!0;(function(){for(var p=e.next(m?0:c);!p.done;p=e.next(c))m=!1,f.push(p.value);g=a(f).value})();return this.J.create({next:function(){return g.next(0)}})};\nD.aa=function(a){function c(f){g=f.value;f=f.ya(!0);-1!==f&&(e.o=f)}var e=this,g=null;return this.J.create({next:function(f){if(g)return g.next(f);if(e.F())return c(a.empty?a.empty(e):a.default(e)),g.next(f);if(e.za())return c(a.s?a.s(e):a.default(e)),g.next(f);c(a.multiple?a.multiple(e):a.default(e));return g.next(f)}})};function Dc(a,c){a.h=void 0===c?0:c};function Ec(a){this.B=U;this.h=a;var c=!1;this.value={next:function(){if(c)return Q;c=!0;return S(a)}};this.o=null}D=Ec.prototype;D.pb=function(){return this};D.filter=function(a){return a(this.h,0,this)?this:this.B.create()};D.first=function(){return this.h};D.S=function(){return[this.h]};D.getEffectiveBooleanValue=function(){null===this.o&&(this.o=Bc(this.h));return this.o};D.ya=function(){return 1};D.F=function(){return!1};D.za=function(){return!0};\nD.map=function(a){return this.B.create(a(this.h,0,this))};D.M=function(a){return a([this.h])};D.aa=function(a){return a.s?a.s(this):a.default(this)};var Fc=new Ac;function Gc(a,c){a=void 0===a?null:a;if(null===a)return Fc;if(Array.isArray(a))switch(a.length){case 0:return Fc;case 1:return new Ec(a[0]);default:return new zc(a)}return a.next?new Cc(a,void 0===c?null:c):new Ec(a)}var U={create:Gc,s:function(a){return new Ec(a)},empty:function(){return Gc()},$:function(){return Gc(mc)},U:function(){return Gc(nc)}};function Rc(a){var c=[],e=a.value;return function(){var g=0;return U.create({next:function(){if(void 0!==c[g])return c[g++];var f=e.next(0);return f.done?f:c[g++]=f}})}};function Sc(a,c){this.type=a;this.value=c}\nvar Tc={},Uc=(Tc[0]=\"xs:boolean\",Tc[1]=\"xs:string\",Tc[2]=\"xs:numeric\",Tc[3]=\"xs:double\",Tc[4]=\"xs:decimal\",Tc[5]=\"xs:integer\",Tc[6]=\"xs:float\",Tc[7]=\"xs:date\",Tc[8]=\"xs:time\",Tc[9]=\"xs:dateTime\",Tc[10]=\"xs:dateTimeStamp\",Tc[11]=\"xs:gYearMonth\",Tc[12]=\"xs:gYear\",Tc[13]=\"xs:gMonthDay\",Tc[14]=\"xs:gMonth\",Tc[15]=\"xs:gDay\",Tc[16]=\"xs:yearMonthDuration\",Tc[17]=\"xs:dayTimeDuration\",Tc[18]=\"xs:duration\",Tc[19]=\"xs:untypedAtomic\",Tc[20]=\"xs:anyURI\",Tc[21]=\"xs:base64Binary\",Tc[22]=\"xs:hexBinary\",Tc[23]=\"xs:QName\",\nTc[24]=\"xs:NCName\",Tc[25]=\"xs:Name\",Tc[26]=\"xs:ENTITY\",Tc[27]=\"xs:nonPositiveInteger\",Tc[28]=\"xs:negativeInteger\",Tc[29]=\"xs:positiveInteger\",Tc[30]=\"xs:nonNegativeInteger\",Tc[31]=\"xs:long\",Tc[32]=\"xs:int\",Tc[33]=\"xs:short\",Tc[34]=\"xs:byte\",Tc[35]=\"xs:unsignedInt\",Tc[36]=\"xs:unsignedLong\",Tc[37]=\"xs:unsignedByte\",Tc[38]=\"xs:unsignedShort\",Tc[39]=\"xs:error\",Tc[40]=\"xs:ENTITIES\",Tc[41]=\"xs:IDREF\",Tc[42]=\"xs:ID\",Tc[43]=\"xs:IDFREFS\",Tc[44]=\"xs:NOTATION\",Tc[45]=\"xs:anySimpleType\",Tc[46]=\"xs:anyAtomicType\",\nTc[47]=\"attribute()\",Tc[48]=\"xs:normalizedString\",Tc[49]=\"xs:NMTOKENS\",Tc[50]=\"xs:NMTOKEN\",Tc[51]=\"xs:language\",Tc[52]=\"xs:token\",Tc[53]=\"node()\",Tc[54]=\"element()\",Tc[55]=\"document-node()\",Tc[56]=\"text()\",Tc[57]=\"processing-instruction()\",Tc[58]=\"comment()\",Tc[59]=\"item()\",Tc[60]=\"function(*)\",Tc[61]=\"map(*)\",Tc[62]=\"array(*)\",Tc),Vc={\"xs:boolean\":0,\"xs:string\":1,\"xs:numeric\":2,\"xs:double\":3,\"xs:decimal\":4,\"xs:integer\":5,\"xs:float\":6,\"xs:date\":7,\"xs:time\":8,\"xs:dateTime\":9,\"xs:dateTimeStamp\":10,\n\"xs:gYearMonth\":11,\"xs:gYear\":12,\"xs:gMonthDay\":13,\"xs:gMonth\":14,\"xs:gDay\":15,\"xs:yearMonthDuration\":16,\"xs:dayTimeDuration\":17,\"xs:duration\":18,\"xs:untypedAtomic\":19,\"xs:anyURI\":20,\"xs:base64Binary\":21,\"xs:hexBinary\":22,\"xs:QName\":23,\"xs:NCName\":24,\"xs:Name\":25,\"xs:ENTITY\":26,\"xs:nonPositiveInteger\":27,\"xs:negativeInteger\":28,\"xs:positiveInteger\":29,\"xs:nonNegativeInteger\":30,\"xs:long\":31,\"xs:int\":32,\"xs:short\":33,\"xs:byte\":34,\"xs:unsignedInt\":35,\"xs:unsignedLong\":36,\"xs:unsignedByte\":37,\"xs:unsignedShort\":38,\n\"xs:error\":39,\"xs:ENTITIES\":40,\"xs:IDREF\":41,\"xs:ID\":42,\"xs:IDREFS\":43,\"xs:NOTATION\":44,\"xs:anySimpleType\":45,\"xs:anyAtomicType\":46,\"attribute()\":47,\"xs:normalizedString\":48,\"xs:NMTOKENS\":49,\"xs:NMTOKEN\":50,\"xs:language\":51,\"xs:token\":52,\"node()\":53,\"element()\":54,\"document-node()\":55,\"text()\":56,\"processing-instruction()\":57,\"comment()\":58,\"item()\":59,\"function(*)\":60,\"map(*)\":61,\"array(*)\":62};\nfunction Wc(a){return 2===a.g?Uc[a.type]+\"*\":1===a.g?Uc[a.type]+\"+\":0===a.g?Uc[a.type]+\"?\":Uc[a.type]}function Xc(a){if(!a.startsWith(\"xs:\")&&0<=a.indexOf(\":\"))throw Error(\"XPST0081: Invalid prefix for input \"+a);var c=Vc[a];if(void 0===c)throw Error('XPST0051: The type \"'+a+'\" could not be found');return c}\nfunction Yc(a){switch(a[a.length-1]){case \"*\":return{type:Xc(a.substr(0,a.length-1)),g:2};case \"?\":return{type:Xc(a.substr(0,a.length-1)),g:0};case \"+\":return{type:Xc(a.substr(0,a.length-1)),g:1};default:return{type:Xc(a),g:3}}}function Zc(a){switch(a){case \"*\":return 2;case \"?\":return 0;case \"+\":return 1;default:return 3}};function $c(a,c,e){this.namespaceURI=c||null;this.prefix=a||\"\";this.localName=e}$c.prototype.va=function(){return this.prefix?this.prefix+\":\"+this.localName:this.localName};function ad(a){var c=a.l,e=a.arity,g=void 0===a.Oa?!1:a.Oa,f=void 0===a.I?!1:a.I,m=a.localName,p=a.namespaceURI,t=a.j;a=a.value;Sc.call(this,60,null);this.value=a;this.I=f;f=-1;for(a=0;a=v||v>t.R.length)throw Error(\"FOAY0001: array position out of bounds.\");return t.R[v-1]()})})};function $d(a){ad.call(this,{value:function(e,g,f,m){return Zd(e,g,f,U.s(c),m)},localName:\"get\",namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",l:[{type:5,g:3}],arity:1,j:{type:59,g:2}});var c=this;this.type=62;this.R=a}K($d,ad);function ae(a){switch(a.node.nodeType){case 2:return 47;case 1:return 54;case 3:case 4:return 56;case 7:return 57;case 8:return 58;case 9:return 55;default:return 53}}function be(a){return{type:ae(a),value:a}};function ce(a,c){a=a.map(function(e){return e.first()});return c(a)};function de(a,c){var e=T(a.type,1)||T(a.type,20)||T(a.type,19),g=T(c.type,1)||T(c.type,20)||T(c.type,19);if(e&&g)return a.value===c.value;e=T(a.type,4)||T(a.type,3)||T(a.type,6);g=T(c.type,4)||T(c.type,3)||T(c.type,6);if(e&&g)return isNaN(a.value)&&isNaN(c.value)?!0:a.value===c.value;e=T(a.type,0)||T(a.type,22)||T(a.type,18)||T(a.type,23)||T(a.type,44);g=T(c.type,0)||T(c.type,22)||T(c.type,18)||T(c.type,23)||T(c.type,44);return e&&g?a.value===c.value:!1};function ee(a,c,e,g,f){return ce([g,f],function(m){m=H(m);var p=m.next().value,t=m.next().value;return(m=p.h.find(function(v){return de(v.key,t)}))?m.value():U.empty()})};function fe(a){ad.call(this,{l:[{type:59,g:3}],arity:1,localName:\"get\",namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",value:function(e,g,f,m){return ee(e,g,f,U.s(c),m)},j:{type:59,g:2}});var c=this;this.type=61;this.h=a}K(fe,ad);function Ce(){}function De(a,c){return a.ab()===c.ab()&&a.bb()===c.bb()}D=Ce.prototype;D.Za=function(){return 0};D.getHours=function(){return 0};D.getMinutes=function(){return 0};D.$a=function(){return 0};D.ab=function(){return 0};D.bb=function(){return 0};D.getSeconds=function(){return 0};D.cb=function(){return 0};D.oa=function(){return!0};function Ee(a){if(a>Number.MAX_SAFE_INTEGER||aNumber.MAX_SAFE_INTEGER||!Number.isFinite(a))throw Error(\"FODT0002: Value overflow while multiplying xs:dayTimeDuration\");return new Ee(aa||273860c.pa?1:-1:g>e?1:-1}function Nf(a,c,e){return 0===Mf(a,c,e)}function Of(a,c,e){a=(Kf(a,e).getTime()-Kf(c,e).getTime())/1E3;return new Ee(a)}\nfunction Pf(a){throw Error(\"Not implemented: adding durations to \"+Uc[a.type]);}function Qf(a){throw Error(\"Not implemented: subtracting durations from \"+Uc[a.type]);};function Rf(a,c){if(null===a)return null;switch(typeof a){case \"boolean\":return a?mc:nc;case \"number\":return L(a,3);case \"string\":return L(a,1);case \"object\":return\"nodeType\"in a?be({node:a,G:null}):Array.isArray(a)?new $d(a.map(function(e){if(void 0===e)return function(){return U.empty()};e=Rf(e,c);e=null===e?U.empty():U.s(e);return Rc(e)})):new fe(Object.keys(a).filter(function(e){return void 0!==a[e]}).map(function(e){var g=Rf(a[e],c);g=null===g?U.empty():U.s(g);return{key:L(e,1),value:Rc(g)}}))}throw Error(\"Value \"+\nString(a)+' of type \"'+typeof a+'\" is not adaptable to an XPath value.');}function Sf(a,c){if(\"number\"!==typeof a&&(\"string\"!==typeof a||!kc.get(c)(a)))throw Error(\"Cannot convert JavaScript value '\"+a+\"' to the XPath type \"+Uc[c]+\" since it is not valid.\");}\nfunction Tf(a,c,e){if(null===c)return null;switch(a){case 0:return c?mc:nc;case 1:return L(c+\"\",1);case 3:case 2:return Sf(c,3),L(+c,3);case 4:return Sf(c,a),L(+c,4);case 5:return Sf(c,a),L(c|0,5);case 6:return Sf(c,a),L(+c,6);case 7:case 8:case 9:case 11:case 12:case 13:case 14:case 15:if(!(c instanceof Date))throw Error(\"The JavaScript value \"+c+\" with type \"+typeof c+\" is not a valid type to be converted to an XPath \"+Uc[a]+\".\");return L(Jf(Lf(c.toISOString()),a),a);case 53:case 47:case 55:case 54:case 56:case 57:case 58:if(\"object\"!==\ntypeof c||!(\"nodeType\"in c))throw Error(\"The JavaScript value \"+c+\" with type \"+typeof c+\" is not a valid type to be converted to an XPath \"+Uc[a]+\".\");return be({node:c,G:null});case 59:return Rf(c,e);default:throw Error('Values of the type \"'+a+'\" can not be adapted to equivalent XPath values.');}}\nfunction Uf(a,c,e){if(0===e.g)return c=Tf(e.type,c,a),null===c?[]:[c];if(2===e.g||1===e.g){if(!Array.isArray(c))throw Error(\"The JavaScript value \"+c+\" should be an array if it is to be converted to \"+Wc(e)+\".\");return c.map(function(f){return Tf(e.type,f,a)}).filter(function(f){return null!==f})}var g=Tf(e.type,c,a);if(null===g)throw Error(\"The JavaScript value \"+c+\" should be a single entry if it is to be converted to \"+Wc(e)+\".\");return[g]}\nfunction Vf(a,c,e){e=void 0===e?{type:59,g:0}:e;return U.create(Uf(a,c,e))};function Wf(a,c){this.h=c=void 0===c?{xb:null,Bb:null,qb:!1}:c;this.Ga=a.Ga;this.wa=a.wa;this.O=a.O;this.ta=a.ta||Object.create(null)}function Xf(a,c){var e=0,g=c.value;return{next:function(f){f=g.next(f);return f.done?Q:S(Yf(a,e++,f.value,c))}}}function Zf(a){a.h.qb||(a.h.qb=!0,a.h.xb=Lf((new Date).toISOString()),a.h.Bb=He(\"PT0S\"));return a.h.xb}function $f(a){a.h.qb||(a.h.qb=!0,a.h.xb=Lf((new Date).toISOString()),a.h.Bb=He(\"PT0S\"));return a.h.Bb}\nfunction Yf(a,c,e,g){return new Wf({O:e,Ga:c,wa:g||a.wa,ta:a.ta},a.h)}function ag(a,c){return new Wf({O:a.O,Ga:a.Ga,wa:a.wa,ta:Object.assign(Object.create(null),a.ta,c)},a.h)};function bg(a,c,e,g,f,m){var p=new Map;this.debug=a;this.h=c;this.o=e;this.B=g;this.J=f;this.C=p;this.v=m;this.Ta=!0};function cg(a){var c=0,e=null,g=!0;return U.create({next:function(f){for(;cNumber.MAX_VALUE?{u:!1,error:Error(\"FOAR0002: Can not cast \"+c+\" to xs:decimal, it is out of bounds for JavaScript numbers\")}:{u:!0,value:L(c,4)}}:a(0)?function(c){return{u:!0,value:L(c?1:0,4)}}:a(1)||a(19)?function(c){var e=parseFloat(c);return!isNaN(e)||isFinite(e)?{u:!0,value:L(e,4)}:{u:!1,error:Error(\"FORG0001: Can not cast \"+\nc+\" to xs:decimal\")}}:function(){return{u:!1,error:Error(\"XPTY0004: Casting not supported from given type to xs:decimal or any of its derived types.\")}}};function eh(a,c){return a(2)?function(e){return{u:!0,value:e}}:a(0)?function(e){return{u:!0,value:e?1:0}}:a(1)||a(19)?function(e){switch(e){case \"NaN\":return{u:!0,value:NaN};case \"INF\":case \"+INF\":return{u:!0,value:Infinity};case \"-INF\":return{u:!0,value:-Infinity};case \"0\":case \"+0\":return{u:!0,value:0};case \"-0\":return{u:!0,value:-0}}var g=parseFloat(e);return isNaN(g)?{u:!1,error:dg(e,c)}:{u:!0,value:g}}:function(){return{u:!1,error:Error(\"XPTY0004: Casting not supported from given type to \"+c+\n\" or any of its derived types.\")}}};function fh(a){var c=eh(a,3);return function(e){e=c(e);return e.u?{u:!0,value:L(e.value,3)}:e}};function gh(a){if(a>Number.MAX_SAFE_INTEGER||aNumber.MAX_SAFE_INTEGER||!Number.isFinite(c))throw Error(\"FODT0002: Value overflow while constructing xs:yearMonthDuration\");a=new gh(a||0===c?c:-c)}else a=null;return a}\nfunction jh(a,c){if(isNaN(c))throw Error(\"FOCA0005: Cannot multiply xs:yearMonthDuration by NaN\");a=Math.round(a.ha*c);if(a>Number.MAX_SAFE_INTEGER||!Number.isFinite(a))throw Error(\"FODT0002: Value overflow while constructing xs:yearMonthDuration\");return new gh(ac?\"-\":\"\")+\"INF\"}}}return a(9)||a(7)||a(8)||a(15)||a(14)||a(13)||a(12)||a(11)?function(c){return{u:!0,value:c.toString()}}:a(16)?function(c){return{u:!0,value:c.toString()}}:a(17)?function(c){return{u:!0,value:c.toString()}}:a(18)?function(c){return{u:!0,value:c.toString()}}:a(22)?function(c){return{u:!0,value:c.toUpperCase()}}:function(c){return{u:!0,value:c+\"\"}}};function yh(a){var c=xh(a);return function(e){e=c(e);return e.u?{u:!0,value:L(e.value,1)}:e}};function zh(a){return a(9)?function(c){return{u:!0,value:L(Jf(c,8),8)}}:a(19)||a(1)?function(c){return{u:!0,value:L(Lf(c),8)}}:function(){return{u:!1,error:Error(\"XPTY0004: Casting not supported from given type to xs:time or any of its derived types.\")}}};function Ah(a){var c=xh(a);return function(e){e=c(e);return e.u?{u:!0,value:L(e.value,19)}:e}};function Bh(a){return a(18)&&!a(17)?function(c){return{u:!0,value:L(c.Sa,16)}}:a(17)?function(){return{u:!0,value:L(ih(\"P0M\"),16)}}:a(19)||a(1)?function(c){var e=ih(c);return e?{u:!0,value:L(e,16)}:{u:!1,error:dg(c,16)}}:function(){return{u:!1,error:Error(\"XPTY0004: Casting not supported from given type to xs:yearMonthDuration or any of its derived types.\")}}};var Ch=[2,5,17,16];\nfunction wh(a,c){function e(g){return T(a,g)}if(39===c)return function(){return{u:!1,error:Error(\"FORG0001: Casting to xs:error is always invalid.\")}};switch(c){case 19:return Ah(e);case 1:return yh(e);case 6:return mh(e);case 3:return fh(e);case 4:return dh(e);case 5:return th(e);case 2:return vh(a);case 18:return lh(e);case 16:return Bh(e);case 17:return ch(e);case 9:return bh(e);case 8:return zh(e);case 7:return ah(e);case 11:return rh(e);case 12:return qh(e);case 13:return ph(e);case 15:return nh(e);\ncase 14:return oh(e);case 0:return $g(e);case 21:return Zg(e);case 22:return sh(e);case 20:return Yg(e);case 23:throw Error(\"Casting to xs:QName is not implemented.\");}return function(){return{u:!1,error:Error(\"XPTY0004: Casting not supported from \"+a+\" to \"+c+\".\")}}}var Dh=Object.create(null);\nfunction Eh(a,c){if(19===a&&1===c)return function(m){return{u:!0,value:L(m,1)}};if(44===c)return function(){return{u:!1,error:Error(\"XPST0080: Casting to xs:NOTATION is not permitted.\")}};if(39===c)return function(){return{u:!1,error:Error(\"FORG0001: Casting to xs:error is not permitted.\")}};if(45===a||45===c)return function(){return{u:!1,error:Error(\"XPST0080: Casting from or to xs:anySimpleType is not permitted.\")}};if(46===a||46===c)return function(){return{u:!1,error:Error(\"XPST0080: Casting from or to xs:anyAtomicType is not permitted.\")}};\nif(T(a,60)&&1===c)return function(){return{u:!1,error:Error(\"FOTY0014: Casting from function item to xs:string is not permitted.\")}};if(a===c)return function(m){return{u:!0,value:{type:c,value:m}}};var e=Ch.includes(a)?a:Tg(a),g=Ch.includes(c)?c:Tg(c);if(null===g||null===e)return function(){return{u:!1,error:Error(\"XPST0081: Can not cast: type \"+(g?Uc[a]:Uc[c])+\" is unknown.\")}};var f=[];1!==e&&19!==e||f.push(function(m){var p=Ug(m,c);return Vg(p,c)?{u:!0,value:p}:{u:!1,error:dg(m,c,\"pattern validation failed.\")}});\ne!==g&&(f.push(wh(e,g)),f.push(function(m){return{u:!0,value:m.value}}));19!==g&&1!==g||f.push(function(m){return Vg(m,c)?{u:!0,value:m}:{u:!1,error:dg(m,c,\"pattern validation failed.\")}});f.push(function(m){return Xg(m,c)?{u:!0,value:m}:{u:!1,error:dg(m,c,\"pattern validation failed.\")}});f.push(function(m){return{u:!0,value:{type:c,value:m}}});return function(m){m={u:!0,value:m};for(var p=0,t=f.length;pg.value.node.localName?1:-1;e=Xd(c,e.value);g=Xd(c,g.value)}else e=e.value,g=g.value;return Nh(a,c,e,g)}function Ph(a,c,e){return Oh(a.o,a,c,e)}\nfunction Qh(a,c){return Rh(c,function(e,g){return Oh(a.o,a,e,g)}).filter(function(e,g,f){return 0===g?!0:!Jh(e.value,f[g-1].value)})}function Sh(a,c){return a=a.length)return a;var e=Math.floor(a.length/2),g=Rh(a.slice(0,e),c);a=Rh(a.slice(e),c);for(e=[];g.length&&a.length;)0>c(g[0],a[0])?e.push(g.shift()):e.push(a.shift());return e.concat(g.concat(a))};var Th=xspattern;function Uh(a,c){if(T(a.type,2)){if(T(a.type,6))return 3===c?L(a.value,3):null;if(T(a.type,4)){if(6===c)return L(a.value,6);if(3===c)return L(a.value,3)}return null}return T(a.type,20)&&1===c?L(a.value,1):null};function Vh(a,c,e,g,f){if(T(a.type,c.type))return a;T(c.type,46)&&T(a.type,53)&&(a=Rg(a,e).first());if(T(a.type,c.type)||46===c.type)return a;if(T(a.type,19)){e=Gh(a,c.type);if(!e)throw Error(\"XPTY0004 Unable to convert \"+(f?\"return\":\"argument\")+\" of type \"+Uc[a.type]+\" to type \"+Wc(c)+\" while calling \"+g);return e}e=Uh(a,c.type);if(!e)throw Error(\"XPTY0004 Unable to cast \"+(f?\"return\":\"argument\")+\" of type \"+Uc[a.type]+\" to type \"+Wc(c)+\" while calling \"+g);return e}\nfunction Wh(a,c,e,g,f){return 0===a.g?c.aa({default:function(){return c.map(function(m){return Vh(m,a,e,g,f)})},multiple:function(){throw Error(\"XPTY0004: Multiplicity of \"+(f?\"function return value\":\"function argument\")+\" of type \"+Uc[a.type]+(a.type||\"\")+\" for \"+g+' is incorrect. Expected \"?\", but got \"+\".');}}):1===a.g?c.aa({empty:function(){throw Error(\"XPTY0004: Multiplicity of \"+(f?\"function return value\":\"function argument\")+\" of type \"+Uc[a.type]+(a.type||\"\")+\" for \"+g+' is incorrect. Expected \"+\", but got \"empty-sequence()\"');\n},default:function(){return c.map(function(m){return Vh(m,a,e,g,f)})}}):2===a.g?c.map(function(m){return Vh(m,a,e,g,f)}):c.aa({s:function(){return c.map(function(m){return Vh(m,a,e,g,f)})},default:function(){throw Error(\"XPTY0004: Multiplicity of \"+(f?\"function return value\":\"function argument\")+\" of type \"+Uc[a.type]+(a.type||\"\")+\" for \"+g+\" is incorrect. Expected exactly one\");}})};function bj(a,c){return T(a,5)?L(c,5):T(a,6)?L(c,6):T(a,3)?L(c,3):L(c,4)}function cj(a){if(Math.floor(a)===a||isNaN(a))return 0;a=/\\d+(?:\\.(\\d*))?(?:[Ee](-)?(\\d+))*/.exec(a+\"\");var c=a[1]?a[1].length:0;if(a[3]){if(a[2])return c+parseInt(a[3],10);a=c-parseInt(a[3],10);return 0>a?0:a}return c}function dj(a,c,e){return c&&0===a*e%1%.5?0===Math.floor(a*e)%2?Math.floor(a*e)/e:Math.ceil(a*e)/e:Math.round(a*e)/e}\nfunction ej(a,c,e,g,f,m){var p=!1;return U.create({next:function(){if(p)return Q;var t=f.first();if(!t)return p=!0,Q;if((T(t.type,6)||T(t.type,3))&&(0===t.value||isNaN(t.value)||Infinity===t.value||-Infinity===t.value))return p=!0,S(t);var v;m?v=m.first().value:v=0;p=!0;if(cj(t.value)f?U.s(L(1,5)):a=m||57344<=m&&65533>=m||65536<=\nm&&1114111>=m)return String.fromCodePoint(m);throw Error(\"FOCH0001\");}).join(\"\");return U.s(L(f,1))})},localName:\"codepoints-to-string\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:1,g:3}},{l:[{type:1,g:0}],m:function(a,c,e,g){return ce([g],function(f){f=(f=H(f).next().value)?f.value.split(\"\"):[];return 0===f.length?U.empty():U.create(f.map(function(m){return L(m.codePointAt(0),5)}))})},localName:\"string-to-codepoints\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:5,\ng:2}},{l:[{type:1,g:0}],m:function(a,c,e,g){return ce([g],function(f){f=H(f).next().value;return null===f||0===f.value.length?U.create(L(\"\",1)):U.create(L(encodeURIComponent(f.value).replace(/[!'()*]/g,function(m){return\"%\"+m.charCodeAt(0).toString(16).toUpperCase()}),1))})},localName:\"encode-for-uri\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:1,g:3}},{l:[{type:1,g:0}],m:function(a,c,e,g){return ce([g],function(f){f=H(f).next().value;return null===f||0===f.value.length?U.create(L(\"\",\n1)):U.create(L(f.value.replace(/([\\u00A0-\\uD7FF\\uE000-\\uFDCF\\uFDF0-\\uFFEF \"<>{}|\\\\^`/\\n\\u007f\\u0080-\\u009f]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g,function(m){return encodeURI(m)}),1))})},localName:\"iri-to-uri\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:1,g:3}},{l:[{type:1,g:0},{type:1,g:0}],m:function(a,c,e,g,f){return ce([g,f],function(m){var p=H(m);m=p.next().value;p=p.next().value;if(null===m||null===p)return U.empty();m=m.value;p=p.value;if(m.length!==p.length)return U.U();m=m.split(\"\");\np=p.split(\"\");for(var t=0;tE.node.nodeName?1:-1}).map(function(A){return be(A)});f=vd(c.h,f.value).filter(function(A){return\"http://www.w3.org/2000/xmlns/\"!==A.node.namespaceURI}).sort(function(A,E){return A.node.nodeName>E.node.nodeName?1:-1}).map(function(A){return be(A)});var t=Jj(a,c,e,U.create(g),\nU.create(f)),v=!1;return{next:function(){if(v)return Q;var A=m.next(0);if(!A.done&&!1===A.value)return v=!0,A;A=t.next(0);if(!A.done&&!1===A.value)return v=!0,A;A=p.next(0);v=!0;return A}}}function Pj(a,c,e,g,f){var m=Jj(a,c,e,uj(a,c,e,U.s(g)),uj(a,c,e,U.s(f))),p=!1;return{next:function(){if(p)return Q;var t=m.next(0);return t.done||!1!==t.value?S(Gj(Rg(g,c).first(),Rg(f,c).first())):(p=!0,t)}}}\nfunction Kj(a,c,e,g,f){if(T(g.type,46)&&T(f.type,46))return Hh(Gj(g,f));if(T(g.type,61)&&T(f.type,61))return Lj(a,c,e,g,f);if(T(g.type,62)&&T(f.type,62))return Mj(a,c,e,g,f);if(T(g.type,53)&&T(f.type,53)){if(T(g.type,55)&&T(f.type,55))return Nj(a,c,e,g,f);if(T(g.type,54)&&T(f.type,54))return Oj(a,c,e,g,f);if(T(g.type,47)&&T(f.type,47)||T(g.type,57)&&T(f.type,57)||T(g.type,58)&&T(f.type,58))return Pj(a,c,e,g,f)}return Hh(!1)};function Qj(a){return Error(\"XUST0001: \"+(void 0===a?\"Can not execute an updating expression in a non-updating context.\":a))}function Rj(a){return Error(\"XUTY0004: The attribute \"+a.name+'=\"'+a.value+'\" follows a node that is not an attribute node.')}function Sj(){return Error(\"XUTY0005: The target of a insert expression with into must be a single element or document node.\")}\nfunction Tj(){return Error(\"XUTY0006: The target of a insert expression with before or after must be a single element, text, comment, or processing instruction node.\")}function Uj(){return Error(\"XUTY0008: The target of a replace expression must be a single element, attribute, text, comment, or processing instruction node.\")}function Vj(){return Error(\"XUTY0012: The target of a rename expression must be a single element, attribute, or processing instruction node.\")}\nfunction Wj(a){return Error(\"XUDY0017: The target \"+a.outerHTML+\" is used in more than one replace value of expression.\")}function Xj(a){return Error(\"XUDY0021: Applying the updates will result in the XDM instance violating constraint: '\"+a+\"'\")}function Yj(a){return Error(\"XUDY0023: The namespace binding \"+a+\" is conflicting.\")}function Zj(a){return Error(\"XUDY0024: The namespace binding \"+a+\" is conflicting.\")}\nfunction ak(){return Error(\"XUDY0027: The target for an insert, replace, or rename expression expression should not be empty.\")};function V(a,c,e,g,f){e=void 0===e?{A:!1,Z:!1,T:\"unsorted\",subtree:!1}:e;this.K=a;this.B=e.T||\"unsorted\";this.subtree=!!e.subtree;this.Z=!!e.Z;this.A=!!e.A;this.J=c;this.I=!1;this.Ya=null;this.wb=void 0===g?!1:g;this.type=f}function bk(a,c,e){c&&null!==c.O?a.A?(null===a.Ya&&(a.Ya=Rc(a.evaluate(null,e).pb())),a=a.Ya()):a=a.evaluate(c,e):a=a.evaluate(c,e);return a}V.prototype.Y=function(){return null};\nV.prototype.P=function(a){this.J.forEach(function(c){return c.P(a)});if(!this.wb&&this.J.some(function(c){return c.I}))throw Qj();};function ck(a,c){this.H=a;this.fa=c};function dk(a){a&&\"nodeType\"in a&&(a=a.ownerDocument||a,\"function\"===typeof a.createElementNS&&\"function\"===typeof a.createProcessingInstruction&&\"function\"===typeof a.createTextNode&&\"function\"===typeof a.createComment&&(this.h=a));this.h||(this.h=null)}D=dk.prototype;D.createAttributeNS=function(a,c){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createAttributeNS(a,c)};\nD.createCDATASection=function(a){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createCDATASection(a)};D.createComment=function(a){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createComment(a)};D.createDocument=function(){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.implementation.createDocument(null,null,null)};\nD.createElementNS=function(a,c){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createElementNS(a,c)};D.createProcessingInstruction=function(a,c){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createProcessingInstruction(a,c)};D.createTextNode=function(a){if(!this.h)throw Error(\"Please pass a node factory if an XQuery script uses node constructors\");return this.h.createTextNode(a)};function ek(a,c,e,g){var f=Xd(e,a).node,m=(a=Bd(e,a))?a.node:null;c.forEach(function(p){g.insertBefore(f,p.node,m)})}function fk(a,c,e,g){var f=Xd(e,a).node;c.forEach(function(m){g.insertBefore(f,m.node,a.node)})}function gk(a,c,e,g){var f=(e=zd(e,a))?e.node:null;c.forEach(function(m){g.insertBefore(a.node,m.node,f)})}function hk(a,c,e){c.forEach(function(g){e.insertBefore(a.node,g.node,null)})}\nfunction ik(a,c,e,g){c.forEach(function(f){var m=f.node.nodeName;if(wd(e,a,m))throw Xj(\"An attribute \"+m+\" already exists.\");g.setAttributeNS(a.node,f.node.namespaceURI,m,yd(e,f))})}\nfunction jk(a,c,e,g,f){g||(g=new dk(a?a.node:null));switch(a.node.nodeType){case 1:var m=e.getAllAttributes(a.node),p=e.getChildNodes(a.node),t=g.createElementNS(c.namespaceURI,c.va());var v={node:t,G:null};m.forEach(function(A){f.setAttributeNS(t,A.namespaceURI,A.nodeName,A.value)});p.forEach(function(A){f.insertBefore(t,A,null)});break;case 2:c=g.createAttributeNS(c.namespaceURI,c.va());c.value=yd(e,a);v={node:c,G:null};break;case 7:v={node:g.createProcessingInstruction(c.va(),yd(e,a)),G:null}}if(!Xd(e,\na))throw Error(\"Not supported: renaming detached nodes.\");kk(a,[v],e,f)}function lk(a,c,e,g){e.getChildNodes(a.node).forEach(function(f){return g.removeChild(a.node,f)});c&&g.insertBefore(a.node,c.node,null)}\nfunction kk(a,c,e,g){var f=Xd(e,a),m=a.node.nodeType;if(2===m){if(c.some(function(v){return 2!==v.node.nodeType}))throw Error('Constraint \"If $target is an attribute node, $replacement must consist of zero or more attribute nodes.\" failed.');var p=f?f.node:null;g.removeAttributeNS(p,a.node.namespaceURI,a.node.nodeName);c.forEach(function(v){var A=v.node.nodeName;if(wd(e,f,A))throw Xj(\"An attribute \"+A+\" already exists.\");g.setAttributeNS(p,v.node.namespaceURI,A,yd(e,v))})}if(1===m||3===m||8===m||\n7===m){var t=(m=Bd(e,a))?m.node:null;g.removeChild(f.node,a.node);c.forEach(function(v){g.insertBefore(f.node,v.node,t)})}};function mk(a,c,e,g){nk(a,c);a.filter(function(f){return-1!==[\"insertInto\",\"insertAttributes\",\"replaceValue\",\"rename\"].indexOf(f.type)}).forEach(function(f){switch(f.type){case \"insertInto\":hk(f.target,f.content,g);break;case \"insertAttributes\":ik(f.target,f.content,c,g);break;case \"rename\":jk(f.target,f.o,c,e,g);break;case \"replaceValue\":var m=f.target;f=f.o;if(2===m.node.nodeType){var p=Xd(c,m);p?g.setAttributeNS(p.node,m.node.namespaceURI,m.node.nodeName,f):m.node.value=f}else g.setData(m.node,\nf)}});a.filter(function(f){return-1!==[\"insertBefore\",\"insertAfter\",\"insertIntoAsFirst\",\"insertIntoAsLast\"].indexOf(f.type)}).forEach(function(f){switch(f.type){case \"insertAfter\":ek(f.target,f.content,c,g);break;case \"insertBefore\":fk(f.target,f.content,c,g);break;case \"insertIntoAsFirst\":gk(f.target,f.content,c,g);break;case \"insertIntoAsLast\":hk(f.target,f.content,g)}});a.filter(function(f){return\"replaceNode\"===f.type}).forEach(function(f){kk(f.target,f.o,c,g)});a.filter(function(f){return\"replaceElementContent\"===\nf.type}).forEach(function(f){lk(f.target,f.text,c,g)});a.filter(function(f){return\"delete\"===f.type}).forEach(function(f){f=f.target;var m=Xd(c,f);(m=m?m.node:null)&&(2===f.node.nodeType?g.removeAttributeNS(m,f.node.namespaceURI,f.node.nodeName):g.removeChild(m,f.node))});if(a.some(function(f){return\"put\"===f.type}))throw Error('Not implemented: the execution for pendingUpdate \"put\" is not yet implemented.');}\nfunction nk(a,c){function e(m){return new $c(m.node.prefix,m.node.namespaceURI,m.node.localName)}function g(m,p){var t=new Set;a.filter(function(v){return v.type===m}).map(function(v){return v.target}).forEach(function(v){v=v?v.node:null;t.has(v)&&p(v);t.add(v)})}g(\"rename\",function(m){throw Error(\"XUDY0015: The target \"+m.outerHTML+\" is used in more than one rename expression.\");});g(\"replaceNode\",function(m){throw Error(\"XUDY0016: The target \"+m.outerHTML+\" is used in more than one replace expression.\");\n});g(\"replaceValue\",function(m){throw Wj(m);});g(\"replaceElementContent\",function(m){throw Wj(m);});var f=new Map;a.filter(function(m){return\"replaceNode\"===m.type&&2===m.target.node.nodeType}).forEach(function(m){var p=Xd(c,m.target);p=p?p.node:null;var t=f.get(p);t?t.push.apply(t,ia(m.o.map(e))):f.set(p,m.o.map(e))});a.filter(function(m){return\"rename\"===m.type&&2===m.target.node.nodeType}).forEach(function(m){var p=Xd(c,m.target);if(p){p=p.node;var t=f.get(p);t?t.push(m.o):f.set(p,[m.o])}});f.forEach(function(m){var p=\n{};m.forEach(function(t){p[t.prefix]||(p[t.prefix]=t.namespaceURI);if(p[t.prefix]!==t.namespaceURI)throw Zj(t.namespaceURI);})})}function ok(a,c){for(var e=[],g=1;ga.h[e])return-1}return 0};function yk(){return eg(\"Expected base expression of a function call to evaluate to a sequence of single function item\")}function zk(a,c,e,g){for(var f=[],m=0;mp.R.length||0>=v)throw Error(\"FOAY0001: subarray start out of bounds.\");if(0>t)throw Error(\"FOAY0002: subarray length out of bounds.\");if(v+t>p.R.length+1)throw Error(\"FOAY0001: subarray start + length out of bounds.\");return U.s(new $d(p.R.slice(v-1,t+v-1)))})}\nfunction Gl(a,c,e,g,f){return ce([g],function(m){var p=H(m).next().value;return f.M(function(t){t=t.map(function(M){return M.value}).sort(function(M,O){return O-M}).filter(function(M,O,R){return R[O-1]!==M});for(var v=p.R.concat(),A=0,E=t.length;Ap.R.length||0>=I)throw Error(\"FOAY0001: subarray position out of bounds.\");v.splice(I-1,1)}return U.s(new $d(v))})})}function Hl(a){return T(a,1)||T(a,20)||T(a,19)}\nfunction Il(a,c,e,g,f){return 0===g.length?0!==f.length:0!==f.length&&Kj(a,c,e,g[0],f[0]).next(0).value?Il(a,c,e,g.slice(1),f.slice(1)):g[0].value!==g[0].value?!0:Hl(g[0].type)&&0!==f.length&&Hl(f[0].type)?g[0].value=p||p>t.R.length)throw Error(\"FOAY0001: array position out of bounds.\");t=t.R.concat();t.splice(p-1,1,Rc(m));return U.s(new $d(t))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"append\",l:[{type:62,g:3},{type:59,g:2}],j:{type:62,g:3},m:function(a,c,e,g,f){return ce([g],function(m){m=H(m).next().value.R.concat([Rc(f)]);return U.s(new $d(m))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",\nlocalName:\"subarray\",l:[{type:62,g:3},{type:5,g:3},{type:5,g:3}],j:{type:62,g:3},m:Fl},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"subarray\",l:[{type:62,g:3},{type:5,g:3}],j:{type:62,g:3},m:function(a,c,e,g,f){var m=U.s(L(g.first().value.length-f.first().value+1,5));return Fl(a,c,e,g,f,m)}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"remove\",l:[{type:62,g:3},{type:5,g:2}],j:{type:62,g:3},m:Gl},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",\nlocalName:\"insert-before\",l:[{type:62,g:3},{type:5,g:3},{type:59,g:2}],j:{type:62,g:3},m:function(a,c,e,g,f,m){return ce([g,f],function(p){var t=H(p);p=t.next().value;t=t.next().value.value;if(t>p.R.length+1||0>=t)throw Error(\"FOAY0001: subarray position out of bounds.\");p=p.R.concat();p.splice(t-1,0,Rc(m));return U.s(new $d(p))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"head\",l:[{type:62,g:3}],j:{type:59,g:2},m:function(a,c,e,g){return Zd(a,c,e,g,U.s(L(1,5)))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",\nlocalName:\"tail\",l:[{type:62,g:3}],j:{type:59,g:2},m:function(a,c,e,g){return Gl(a,c,e,g,U.s(L(1,5)))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"reverse\",l:[{type:62,g:3}],j:{type:62,g:3},m:function(a,c,e,g){return ce([g],function(f){f=H(f).next().value;return U.s(new $d(f.R.concat().reverse()))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"join\",l:[{type:62,g:2}],j:{type:62,g:3},m:function(a,c,e,g){return g.M(function(f){f=f.reduce(function(m,\np){return m.concat(p.R)},[]);return U.s(new $d(f))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",localName:\"for-each\",l:[{type:62,g:3},{type:60,g:3}],j:{type:62,g:3},m:function(a,c,e,g,f){return ce([g,f],function(m){m=H(m);var p=m.next().value,t=m.next().value;if(1!==t.B)throw eg(\"The callback passed into array:for-each has a wrong arity.\");m=p.R.map(function(v){return Rc(t.value.call(void 0,a,c,e,zk(t.o,[v()],c,\"array:for-each\")[0]))});return U.s(new $d(m))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/array\",\nlocalName:\"filter\",l:[{type:62,g:3},{type:60,g:3}],j:{type:62,g:3},m:function(a,c,e,g,f){return ce([g,f],function(m){m=H(m);var p=m.next().value,t=m.next().value;if(1!==t.B)throw eg(\"The callback passed into array:filter has a wrong arity.\");var v=p.R.map(function(I){I=zk(t.o,[I()],c,\"array:filter\")[0];var M=t.value;return M(a,c,e,I)}),A=[],E=!1;return U.create({next:function(){if(E)return Q;for(var I=0,M=p.R.length;I=e.start.line&&t<=e.end.line){var v=te.start.line?p.length:e.start.da-1+p.length;f.push(Array(p.length+m.length).fill(\" \",0,\nt).fill(\"^\",t,v).join(\"\"))}return f},[]);c=am(c).join(\"\\n\");throw new Yl(a.join(\"\\n\")+\"\\n\\n\"+c,e);};function W(a,c){\"*\"===c||Array.isArray(c)||(c=[c]);for(var e=1;ea.length?\"\":\"object\"===typeof a[1]?a[2]||\"\":a[1]||\"\"}function cm(a,c){if(!Array.isArray(a))return null;a=a[1];return\"object\"!==typeof a||Array.isArray(a)?null:c in a?a[c]:null}function dm(a,c){return c.reduce(W,a)}\nfunction em(a,c){for(var e=[],g=1;g:\"+a.location.start.line+\":\"+a.location.start.da+\" - \"+a.location.end.line+\":\"+a.location.end.da);return c};function Gm(a,c,e){sk.call(this,e.K,[e],{A:e.A,Z:e.Z,T:e.B,subtree:e.subtree});this.h=c;this.C={end:{da:a.end.da,line:a.end.line,offset:a.end.offset},start:{da:a.start.da,line:a.start.line,offset:a.start.offset}}}K(Gm,sk);Gm.prototype.v=function(a,c,e){var g=this;c=H(e).next().value;try{var f=c(a)}catch(m){throw new Fm(this.C,this.h,m);}return U.create({next:function(m){try{return f.value.next(m)}catch(p){throw new Fm(g.C,g.h,p);}}})};\nGm.prototype.P=function(a){try{sk.prototype.P.call(this,a)}catch(c){throw new Fm(this.C,this.h,c);}};function Hm(a,c,e,g){V.call(this,a,c,e,!0);this.h=g;this.I=this.h.I}K(Hm,V);function Im(a,c,e,g){var f=[],m=a.C(c,e,g,function(t){if(a.h instanceof Hm){var v=Im(a.h,c,t,g);return rk(v,function(E){return f=E})}var A=null;return U.create({next:function(){for(;;){if(!A){var E=t.next(0);if(E.done)return Q;E=a.h.o(E.value,g);A=rk(E,function(I){return f=ok(f,I)}).value}E=A.next(0);if(E.done)A=null;else return E}}})}),p=!1;return{next:function(){if(p)return Q;var t=m.S();p=!0;return S(new ck(t,f))}}}\nHm.prototype.evaluate=function(a,c){var e=this;return this.C(a,Hh(a),c,function(g){if(e.h instanceof Hm)return Jm(e.h,a,g,c);var f=null;return U.create({next:function(m){for(;;){if(!f){var p=g.next(0);if(p.done)return Q;f=bk(e.h,p.value,c).value}p=f.next(m);if(p.done)f=null;else return p}}})})};Hm.prototype.o=function(a,c){return Im(this,a,Hh(a),c)};\nHm.prototype.P=function(a){V.prototype.P.call(this,a);this.I=this.h.I;a=H(this.J);for(var c=a.next();!c.done;c=a.next())if(c=c.value,c!==this.h&&c.I)throw Qj();};function Jm(a,c,e,g){return a.C(c,e,g,function(f){if(a.h instanceof Hm)return Jm(a.h,c,f,g);var m=null;return U.create({next:function(){for(;;){if(!m){var p=f.next(0);if(p.done)return Q;m=bk(a.h,p.value,g).value}p=m.next(0);if(p.done)m=null;else return p}}})})};function Km(a,c,e,g){Hm.call(this,c.K.add(g.K),[c,g],{A:!1},g);this.N=a.prefix;this.ka=a.namespaceURI;this.vb=a.localName;this.mb=null;this.v=e;this.ua=null;this.na=c}K(Km,Hm);\nKm.prototype.C=function(a,c,e,g){var f=this,m=null,p=null,t=0;return g({next:function(){for(var v={};;){if(!m){var A=c.next(0);if(A.done)return Q;p=A.value;t=0;m=bk(f.na,p,e).value}v.hb=m.next(0);if(v.hb.done)m=null;else return t++,A={},v=(A[f.mb]=function(E){return function(){return U.s(E.hb.value)}}(v),A),f.ua&&(v[f.ua]=function(){return U.s(new Sc(5,t))}),S(ag(p,v));v={hb:v.hb}}}})};\nKm.prototype.P=function(a){if(this.N&&(this.ka=a.ga(this.N),!this.ka&&this.N))throw Error(\"XPST0081: Could not resolve namespace for prefix \"+this.N+\" in a for expression\");this.na.P(a);Lm(a);this.mb=Mm(a,this.ka,this.vb);if(this.v){if(this.v.prefix&&(this.v.namespaceURI=a.ga(this.v.prefix),!this.v.namespaceURI&&this.v.prefix))throw Error(\"XPST0081: Could not resolve namespace for prefix \"+this.N+\" in the positionalVariableBinding in a for expression\");this.ua=Mm(a,this.v.namespaceURI,this.v.localName)}this.h.P(a);\nNm(a);if(this.na.I)throw Qj();this.h.I&&(this.I=!0)};function Om(a,c,e){var g={};V.call(this,new wk((g.external=1,g)),[e],{A:!1,T:\"unsorted\"});this.N=a.map(function(f){return f.name});this.v=a.map(function(f){return f.type});this.o=null;this.C=c;this.h=e}K(Om,V);\nOm.prototype.evaluate=function(a,c){var e=this,g=new ad({l:this.v,arity:this.v.length,Oa:!0,I:this.h.I,localName:\"dynamic-function\",namespaceURI:\"\",j:this.C,value:function(f,m,p,t){for(var v=[],A=3;ANumber.MAX_SAFE_INTEGER||!Number.isFinite(a))throw Error(\"FODT0002: Value overflow while dividing xs:yearMonthDuration\");return new gh(aNumber.MAX_SAFE_INTEGER||!Number.isFinite(a))throw Error(\"FODT0002: Value overflow while dividing xs:dayTimeDuration\");return new Ee(ae.X.value};case \"geOp\":return function(e,g){e=c(e,g);return e.W.value>=e.X.value}}}\nfunction qn(a,c){switch(a){case \"ltOp\":return function(e,g){e=c(e,g);return e.W.value.hae.X.value.ha};case \"geOp\":return function(e,g){g=c(e,g);e=g.W;g=g.X;return De(e.value,g.value)||e.value.ha>g.value.ha}}}\nfunction rn(a,c){switch(a){case \"eqOp\":return function(e,g){e=c(e,g);return De(e.W.value,e.X.value)};case \"ltOp\":return function(e,g){e=c(e,g);return e.W.value.eae.X.value.ea};case \"geOp\":return function(e,g){g=c(e,g);e=g.W;g=g.X;return De(e.value,g.value)||e.value.ea>g.value.ea}}}\nfunction sn(a,c){switch(a){case \"eqOp\":return function(e,g){e=c(e,g);return De(e.W.value,e.X.value)};case \"neOp\":return function(e,g){e=c(e,g);return!De(e.W.value,e.X.value)}}}\nfunction tn(a,c){switch(a){case \"eqOp\":return function(e,g,f){e=c(e,g);return Nf(e.W.value,e.X.value,$f(f))};case \"neOp\":return function(e,g,f){e=c(e,g);return!Nf(e.W.value,e.X.value,$f(f))};case \"ltOp\":return function(e,g,f){e=c(e,g);f=$f(f);return 0>Mf(e.W.value,e.X.value,f)};case \"leOp\":return function(e,g,f){g=c(e,g);e=g.W;g=g.X;var m;(m=Nf(e.value,g.value,$f(f)))||(f=$f(f),m=0>Mf(e.value,g.value,f));return m};case \"gtOp\":return function(e,g,f){e=c(e,g);f=$f(f);return 0Ph(c,f.first(),m.first())}:void 0;case \"nodeAfterOp\":return c?function(f,m){return 0Ph(c.h,p,t)){if(E=S(p),p=null,\"exceptOp\"===e.h)return E}else t=null}if(\"exceptOp\"===\ne.h)return null!==p?(E=S(p),p=null,E):f.next(0);v=!0;return Q}})};function Ln(a,c){sk.call(this,a.reduce(function(e,g){return e.add(g.K)},new wk({})),a,{T:\"unsorted\",A:a.every(function(e){return e.A})},c)}K(Ln,sk);Ln.prototype.v=function(a,c,e){return e.length?cg(e.map(function(g){return g(a)})):U.empty()};function Mn(a,c,e){V.call(this,(new wk({})).add(a.K),[a,c],{A:a.A&&c.A},!1,e);this.h=a;this.o=c}K(Mn,V);Mn.prototype.evaluate=function(a,c){var e=this,g=bk(this.h,a,c),f=Xf(a,g),m=null,p=null,t=!1;return U.create({next:function(v){for(;!t;){if(!m&&(m=f.next(v),m.done))return t=!0,Q;p||(p=bk(e.o,m.value,c));var A=p.value.next(v);if(A.done)m=p=null;else return A}}})};function Nn(a,c,e){V.call(this,a.K,[a],{A:!1});this.h=Xc(c.prefix?c.prefix+\":\"+c.localName:c.localName);if(46===this.h||45===this.h||44===this.h)throw Error(\"XPST0080: Casting to xs:anyAtomicType, xs:anySimpleType or xs:NOTATION is not permitted.\");if(c.namespaceURI)throw Error(\"Not implemented: castable as expressions with a namespace URI.\");this.v=a;this.o=e}K(Nn,V);\nNn.prototype.evaluate=function(a,c){var e=this,g=Sg(bk(this.v,a,c),c);return g.aa({empty:function(){return e.o?U.$():U.U()},s:function(){return g.map(function(f){return Fh(f,e.h).u?mc:nc})},multiple:function(){return U.U()}})};function On(a,c,e){V.call(this,a.K,[a],{A:!1});this.h=Xc(c.prefix?c.prefix+\":\"+c.localName:c.localName);if(46===this.h||45===this.h||44===this.h)throw Error(\"XPST0080: Casting to xs:anyAtomicType, xs:anySimpleType or xs:NOTATION is not permitted.\");if(c.namespaceURI)throw Error(\"Not implemented: casting expressions with a namespace URI.\");this.v=a;this.o=e}K(On,V);\nOn.prototype.evaluate=function(a,c){var e=this,g=Sg(bk(this.v,a,c),c);return g.aa({empty:function(){if(!e.o)throw Error(\"XPTY0004: Sequence to cast is empty while target type is singleton.\");return U.empty()},s:function(){return g.map(function(f){return Gh(f,e.h)})},multiple:function(){throw Error(\"XPTY0004: Sequence to cast is not singleton or empty.\");}})};function Pn(a,c){var e=a.value,g=null,f=!1;return U.create({next:function(){for(;!f;){if(!g){var m=e.next(0);if(m.done)return f=!0,S(mc);g=c(m.value)}m=g.getEffectiveBooleanValue();g=null;if(!1===m)return f=!0,S(nc)}return Q}})};function Qn(a,c,e,g){V.call(this,a.K,[a],{A:!1},!1,g);this.v=a;this.o=c;this.h=e}K(Qn,V);Qn.prototype.evaluate=function(a,c){var e=this,g=bk(this.v,a,c);return g.aa({empty:function(){return\"?\"===e.h||\"*\"===e.h?U.$():U.U()},multiple:function(){return\"+\"===e.h||\"*\"===e.h?Pn(g,function(f){var m=U.s(f);f=Yf(a,0,f,m);return bk(e.o,f,c)}):U.U()},s:function(){return Pn(g,function(f){var m=U.s(f);f=Yf(a,0,f,m);return bk(e.o,f,c)})}})};function Rn(a,c){return null!==a&&null!==c&&T(a.type,53)&&T(c.type,53)?Jh(a.value,c.value):!1}function Sn(a){var c=a.next(0);if(c.done)return U.empty();var e=null,g=null;return U.create({next:function(f){if(c.done)return Q;e||(e=c.value.value);do{var m=e.next(f);if(m.done){c=a.next(0);if(c.done)return m;e=c.value.value}}while(m.done||Rn(m.value,g));g=m.value;return m}})}\nfunction Tn(a,c){var e=[];(function(){for(var p=c.next(0),t={};!p.done;)t.jb=p.value.value,p={current:t.jb.next(0),next:function(v){return function(A){return v.jb.next(A)}}(t)},p.current.done||e.push(p),p=c.next(0),t={jb:t.jb}})();var g=null,f=!1,m={};return U.create((m[Symbol.iterator]=function(){return this},m.next=function(){f||(f=!0,e.every(function(M){return T(M.current.value.type,53)})&&e.sort(function(M,O){return Ph(a,M.current.value,O.current.value)}));do{if(!e.length)return Q;var p=e.shift();\nvar t=p.current;p.current=p.next(0);if(!T(t.value.type,53))return t;if(!p.current.done){for(var v=0,A=e.length-1,E=0;v<=A;){E=Math.floor((v+A)/2);var I=Ph(a,p.current.value,e[E].current.value);if(0===I){v=E;break}0=e.h.length?Q:S(bk(e.h[g++],a,c))}}).map(function(f){if(!T(f.type,53))throw Error(\"XPTY0004: The sequences to union are not of type node()*\");return f})}return cg(this.h.map(function(f){return bk(f,a,c)})).M(function(f){if(f.some(function(m){return!T(m.type,53)}))throw Error(\"XPTY0004: The sequences to union are not of type node()*\");f=Qh(c.h,f);return U.create(f)})};function Vn(a){return a.every(function(c){return null===c||T(c.type,5)||T(c.type,4)})||null!==a.map(function(c){return c?Tg(c.type):null}).reduce(function(c,e){return null===e?c:e===c?c:null})?a:a.every(function(c){return null===c||T(c.type,1)||T(c.type,20)})?a.map(function(c){return c?Gh(c,1):null}):a.every(function(c){return null===c||T(c.type,4)||T(c.type,6)})?a.map(function(c){return c?Gh(c,6):c}):a.every(function(c){return null===c||T(c.type,4)||T(c.type,6)||T(c.type,3)})?a.map(function(c){return c?\nGh(c,3):c}):null};function Wn(a){return Error(\"XPTY0004: \"+a)}function Xn(a,c){a=2===a.node.nodeType?a.node.nodeName+'=\"'+yd(c,a)+'\"':a.node.outerHTML;return Error(\"XQTY0024: The node \"+a+\" follows a node that is not an attribute node or a namespace node.\")}function Yn(){return Error(\"XQST0045: Functions and variables may not be declared in one of the reserved namespace URIs.\")}function Zn(){return Error(\"XQST0060: Functions declared in a module or as an external function must reside in a namespace.\")}\nfunction $n(){return Error(\"XQST0070: The prefixes xml and xmlns may not be used in a namespace declaration or be bound to another namespaceURI.\")}function ao(a){return Error('XQDY0074: The value \"'+a+'\" of a name expressions cannot be converted to an expanded QName.')}function bo(a){return Error('XPST0081: The prefix \"'+a+'\" could not be resolved')};function co(a){return(a=a.find(function(c){return!!c}))?Tg(a.type):null}function eo(a,c){var e=new wk({});Hm.call(this,e,[c].concat(ia(a.map(function(g){return g.ia}))),{A:!1,Z:!1,T:\"unsorted\",subtree:!1},c);this.v=a}K(eo,Hm);\neo.prototype.C=function(a,c,e,g){if(this.v[1])throw Error(\"More than one order spec is not supported for the order by clause.\");var f=[],m=!1,p,t,v=null,A=this.v[0];return U.create({next:function(){if(!m){for(var E=c.next(0);!E.done;)f.push(E.value),E=c.next(0);E=f.map(function(xa){return A.ia.evaluate(xa,e)}).map(function(xa){return Sg(xa,e)});if(E.find(function(xa){return!xa.F()&&!xa.za()}))throw Wn(\"Order by only accepts empty or singleton sequences\");p=E.map(function(xa){return xa.first()});p=\np.map(function(xa){return null===xa?xa:T(19,xa.type)?Gh(xa,1):xa});if(co(p)&&(p=Vn(p),!p))throw Wn(\"Could not cast values\");E=p.length;t=p.map(function(xa,x){return x});for(var I=0;I=p.length?Q:S(f[t[Ba++]]):0>Ba?Q:S(f[t[Ba--]])}}).value;m=!0}return v.next(0)}})};function fo(a){V.call(this,a?a.K:new wk({}),a?[a]:[],{T:\"sorted\",subtree:!1,Z:!1,A:!1});this.h=a}K(fo,V);fo.prototype.evaluate=function(a,c){if(null===a.O)throw Error(\"XPDY0002: context is absent, it needs to be present to use paths.\");for(var e=c.h,g=a.O.value;9!==g.node.nodeType;)if(g=Xd(e,g),null===g)throw Error(\"XPDY0050: the root node of the context node is not a document node.\");e=U.s(be(g));return this.h?bk(this.h,Yf(a,0,e.first(),e),c):e};function go(a){V.call(this,new wk({}),[],{T:\"sorted\"},!1,a)}K(go,V);go.prototype.evaluate=function(a){if(null===a.O)throw Error('XPDY0002: context is absent, it needs to be present to use the \".\" operator');return U.s(a.O)};function ho(a,c){var e=!1,g=!1;c.forEach(function(f){T(f.type,53)?e=!0:g=!0});if(g&&e)throw Error(\"XPTY0018: The path operator should either return nodes or non-nodes. Mixed sequences are not allowed.\");return e?Qh(a,c):c}function io(a,c){var e=a.every(function(f){return f.Z}),g=a.every(function(f){return f.subtree});V.call(this,a.reduce(function(f,m){return f.add(m.K)},new wk({})),a,{A:!1,Z:e,T:c?\"sorted\":\"unsorted\",subtree:g});this.h=a;this.o=c}K(io,V);\nio.prototype.evaluate=function(a,c){var e=this,g=!0;return this.h.reduce(function(f,m,p){var t=null===f?Hh(a):Xf(a,f);f={next:function(E){E=t.next(E);if(E.done)return Q;if(null!==E.value.O&&!T(E.value.O.type,53)&&0
=g)throw Error(\"FOAY0001: Array index out of bounds\");e.push(a.R[g-1]())}else throw Wn(\"The key specifier is not an integer.\");else if(T(a.type,61))\"*\"===c?e.push.apply(e,ia(a.h.map(function(f){return f.value()}))):(a=a.h.find(function(f){return de(f.key,c)}))&&e.push(a.value());else throw Wn(\"The provided context item is not a map or an array.\");\nreturn cg(e)}function lo(a,c,e,g,f){if(\"*\"===c)return ko(a,c,e);c=bk(c,g,f);c=Rc(c)().M(function(m){return m.reduce(function(p,t){return ko(a,t,p)},new Ac)});return cg([e,c])};function ns(a,c){V.call(this,a.K,[a].concat(\"*\"===c?[]:[c]),{A:a.A,T:a.B,subtree:a.subtree});this.h=a;this.o=c}K(ns,V);ns.prototype.evaluate=function(a,c){var e=this;return bk(this.h,a,c).M(function(g){return g.reduce(function(f,m){return lo(m,e.o,f,a,c)},new Ac)})};ns.prototype.Y=function(){return this.h.Y()};function os(a,c){var e={};V.call(this,new wk((e.external=1,e)),\"*\"===a?[]:[a],{A:!1},!1,c);this.h=a}K(os,V);os.prototype.evaluate=function(a,c){return lo(a.O,this.h,new Ac,a,c)};function ps(a,c,e,g){var f=c.map(function(p){return p.eb});c=c.map(function(p){return p.name});var m=f.reduce(function(p,t){return p.add(t.K)},e.K);V.call(this,m,f.concat(e),{A:!1},!1,g);this.o=a;this.v=c;this.C=f;this.N=e;this.h=null}K(ps,V);\nps.prototype.evaluate=function(a,c){var e=this,g=a,f=this.h.map(function(E,I){var M=bk(e.C[I],g,c).S();I={};g=ag(a,(I[E]=function(){return U.create(M)},I));return M});if(f.some(function(E){return 0===E.length}))return\"every\"===this.o?U.$():U.U();var m=Array(f.length).fill(0);m[0]=-1;for(var p=!0;p;){p=!1;for(var t=0,v=m.length;tA.length-1)m[t]=0;else{p=Object.create(null);t={};for(v=0;v\"))throw Error('XQDY0026: The content \"'+v+'\" for a processing instruction node contains \"?>\".');t=!0;return S({H:[],fa:ok([new Os(g.value,\nv)],p,f)})}}}}function dt(a,c,e){pk.call(this,new wk({}),[c,e],{A:!1,T:\"unsorted\"});this.C=a;this.h=c;this.v=e}K(dt,pk);dt.prototype.o=function(a,c){var e=qk(this.h)(a,c);a=qk(this.v)(a,c);return this.C?ct(c,e,a):bt(c,e,a)};function et(a){switch(a.type){case \"delete\":return new Ds({node:a.target,G:null});case \"insertAfter\":return new Fs({node:a.target,G:null},a.content.map(function(c){return{node:c,G:null}}));case \"insertBefore\":return new Hs({node:a.target,G:null},a.content.map(function(c){return{node:c,G:null}}));case \"insertInto\":return new Ks({node:a.target,G:null},a.content.map(function(c){return{node:c,G:null}}));case \"insertIntoAsFirst\":return new Is({node:a.target,G:null},a.content.map(function(c){return{node:c,\nG:null}}));case \"insertIntoAsLast\":return new Js({node:a.target,G:null},a.content.map(function(c){return{node:c,G:null}}));case \"insertAttributes\":return new Gs({node:a.target,G:null},a.content.map(function(c){return{node:c,G:null}}));case \"rename\":return new Ls({node:a.target,G:null},a.newName);case \"replaceNode\":return new Ns({node:a.target,G:null},a.replacement.map(function(c){return{node:c,G:null}}));case \"replaceValue\":return new Os({node:a.target,G:null},a[\"string-value\"]);case \"replaceElementContent\":return new Ms({node:a.target,\nG:null},a.text?{node:a.text,G:null}:null);default:throw Error('Unexpected type \"'+a.type+'\" when parsing a transferable pending update.');}};function ft(a,c,e){if(c.find(function(f){return Jh(f,a)}))return!0;var g=Xd(e,a);return g?ft(g,c,e):!1}function gt(a,c,e){pk.call(this,new wk({}),a.reduce(function(g,f){g.push(f.eb);return g},[c,e]),{A:!1,T:\"unsorted\"});this.h=a;this.C=c;this.v=e;this.I=null}K(gt,pk);gt.prototype.evaluate=function(a,c){a=this.o(a,c);return rk(a,function(){})};\ngt.prototype.o=function(a,c){var e=this,g=c.h,f=c.o,m=c.B,p=[],t,v,A,E=[],I=[];return{next:function(){if(E.length!==e.h.length)for(var M={},O=E.length;O\"))throw Error('XQDY0026: The contents of the data of a processing instruction may not include \"?>\"');if(null!==e.h.Mb)return f=e.h.Mb,lt(f),U.s(be(mt(f,m)));f=bk(e.h.Db,a,c);var p=Zs(c,f);return U.create({next:function(){var t=p.next(0);if(t.done)return t;t=t.value.value;lt(t);return S(be(mt(t,m)))}})})};function ot(a){V.call(this,a?a.K:new wk({}),a?[a]:[],{A:!1,T:\"unsorted\"});this.h=a}K(ot,V);ot.prototype.evaluate=function(a,c){if(!this.h)return U.empty();a=bk(this.h,a,c);return Sg(a,c).M(function(e){if(0===e.length)return U.empty();e={node:{data:e.map(function(g){return Gh(g,1).value}).join(\" \"),Pa:!0,nodeType:3},G:null};return U.s(be(e))})};function pt(a,c,e,g){var f=new wk({}),m;sk.call(this,f,(m=[a].concat(ia(c.map(function(p){return p.jc})),[e])).concat.apply(m,ia(c.map(function(p){return p.Ob.map(function(t){return t.Nb})}))),{A:!1,Z:!1,T:\"unsorted\",subtree:!1},g);this.C=a;this.h=c.length;this.N=c.map(function(p){return p.Ob})}K(pt,sk);\npt.prototype.v=function(a,c,e){var g=this;return e[0](a).M(function(f){for(var m=0;mf.length)return!1;break;default:if(1!==f.length)return!1}var t=U.create(f);return f.every(function(v,A){v=Yf(a,A,v,t);return bk(p.Nb,v,c).getEffectiveBooleanValue()})}))return e[m+1](a);return e[g.h+1](a)})};pt.prototype.P=function(a){sk.prototype.P.call(this,a);if(this.C.I)throw Qj();};var qt={ca:!1,qa:!1},rt={ca:!0,qa:!1},st={ca:!0,qa:!0};function tt(a){return a.ca?a.qa?st:rt:qt}\nfunction Z(a,c){switch(a[0]){case \"andOp\":var e=cm(a,\"type\");return new mn(ut(\"andOp\",a,tt(c)),e);case \"orOp\":return e=cm(a,\"type\"),new nn(ut(\"orOp\",a,tt(c)),e);case \"unaryPlusOp\":return e=W(W(a,\"operand\"),\"*\"),a=cm(a,\"type\"),new ln(\"+\",Z(e,c),a);case \"unaryMinusOp\":return e=W(W(a,\"operand\"),\"*\"),a=cm(a,\"type\"),new ln(\"-\",Z(e,c),a);case \"addOp\":case \"subtractOp\":case \"multiplyOp\":case \"divOp\":case \"idivOp\":case \"modOp\":var g=a[0],f=Z(dm(a,[\"firstOperand\",\"*\"]),tt(c));c=Z(dm(a,[\"secondOperand\",\"*\"]),\ntt(c));var m=cm(a,\"type\"),p=cm(dm(a,[\"firstOperand\",\"*\"]),\"type\"),t=cm(dm(a,[\"secondOperand\",\"*\"]),\"type\");p&&t&&cm(a,\"type\")&&(e=dn(g,p.type,t.type));return new hn(g,f,c,m,e);case \"sequenceExpr\":return vt(a,c);case \"unionOp\":return e=cm(a,\"type\"),new Un([Z(dm(a,[\"firstOperand\",\"*\"]),tt(c)),Z(dm(a,[\"secondOperand\",\"*\"]),tt(c))],e);case \"exceptOp\":case \"intersectOp\":return e=cm(a,\"type\"),new Kn(a[0],Z(dm(a,[\"firstOperand\",\"*\"]),tt(c)),Z(dm(a,[\"secondOperand\",\"*\"]),tt(c)),e);case \"stringConcatenateOp\":return wt(a,\nc);case \"rangeSequenceExpr\":return xt(a,c);case \"equalOp\":case \"notEqualOp\":case \"lessThanOrEqualOp\":case \"lessThanOp\":case \"greaterThanOrEqualOp\":case \"greaterThanOp\":case \"eqOp\":case \"neOp\":case \"ltOp\":case \"leOp\":case \"gtOp\":case \"geOp\":case \"isOp\":case \"nodeBeforeOp\":case \"nodeAfterOp\":return e=dm(a,[\"firstOperand\",\"*\"]),g=dm(a,[\"secondOperand\",\"*\"]),f=cm(e,\"type\"),m=cm(g,\"type\"),new Hn(a[0],Z(e,tt(c)),Z(g,tt(c)),f,m);case \"pathExpr\":return yt(a,c);case \"contextItemExpr\":return a=cm(a,\"type\"),\nnew go(a);case \"functionCallExpr\":return zt(a,c);case \"inlineFunctionExpr\":return At(a,c);case \"arrowExpr\":return Bt(a,c);case \"dynamicFunctionInvocationExpr\":return Ct(a,c);case \"namedFunctionRef\":return c=W(a,\"functionName\"),e=cm(a,\"type\"),a=bm(dm(a,[\"integerConstantExpr\",\"value\"])),new Xm(fm(c),parseInt(a,10),e);case \"integerConstantExpr\":return new Qm(bm(W(a,\"value\")),{type:5,g:3});case \"stringConstantExpr\":return new Qm(bm(W(a,\"value\")),{type:1,g:3});case \"decimalConstantExpr\":return new Qm(bm(W(a,\n\"value\")),{type:4,g:3});case \"doubleConstantExpr\":return new Qm(bm(W(a,\"value\")),{type:3,g:3});case \"varRef\":return a=fm(W(a,\"name\")),new vs(a.prefix,a.namespaceURI,a.localName);case \"flworExpr\":return Dt(a,c);case \"quantifiedExpr\":return Et(a,c);case \"ifThenElseExpr\":return e=cm(a,\"type\"),new Em(Z(W(W(a,\"ifClause\"),\"*\"),tt(c)),Z(W(W(a,\"thenClause\"),\"*\"),c),Z(W(W(a,\"elseClause\"),\"*\"),c),e);case \"instanceOfExpr\":return e=Z(dm(a,[\"argExpr\",\"*\"]),c),g=dm(a,[\"sequenceType\",\"*\"]),f=dm(a,[\"sequenceType\",\n\"occurrenceIndicator\"]),a=cm(a,\"type\"),new Qn(e,Z(g,tt(c)),f?bm(f):\"\",a);case \"castExpr\":return c=Z(W(W(a,\"argExpr\"),\"*\"),tt(c)),e=W(a,\"singleType\"),a=fm(W(e,\"atomicType\")),e=null!==W(e,\"optional\"),new On(c,a,e);case \"castableExpr\":return c=Z(W(W(a,\"argExpr\"),\"*\"),tt(c)),e=W(a,\"singleType\"),a=fm(W(e,\"atomicType\")),e=null!==W(e,\"optional\"),new Nn(c,a,e);case \"simpleMapExpr\":return Ft(a,c);case \"mapConstructor\":return Gt(a,c);case \"arrayConstructor\":return Ht(a,c);case \"unaryLookup\":return e=cm(a,\"type\"),\nnew os(It(a,c),e);case \"typeswitchExpr\":return Jt(a,c);case \"elementConstructor\":return Kt(a,c);case \"attributeConstructor\":return Lt(a,c);case \"computedAttributeConstructor\":return(e=W(a,\"tagName\"))?e=fm(e):(e=W(a,\"tagNameExpr\"),e={Ja:Z(W(e,\"*\"),tt(c))}),a=Z(W(W(a,\"valueExpr\"),\"*\"),tt(c)),new it(e,{tb:[a]});case \"computedCommentConstructor\":if(!c.ca)throw Error(\"XPST0003: Use of XQuery functionality is not allowed in XPath context\");a=(a=W(a,\"argExpr\"))?Z(W(a,\"*\"),tt(c)):null;return new jt(a);case \"computedTextConstructor\":if(!c.ca)throw Error(\"XPST0003: Use of XQuery functionality is not allowed in XPath context\");\na=(a=W(a,\"argExpr\"))?Z(W(a,\"*\"),tt(c)):null;return new ot(a);case \"computedElementConstructor\":return Mt(a,c);case \"computedPIConstructor\":if(!c.ca)throw Error(\"XPST0003: Use of XQuery functionality is not allowed in XPath context\");e=W(a,\"piTargetExpr\");g=W(a,\"piTarget\");f=W(a,\"piValueExpr\");a=cm(a,\"type\");return new nt({Db:e?Z(W(e,\"*\"),tt(c)):null,Mb:g?bm(g):null},f?Z(W(f,\"*\"),tt(c)):new Ln([],a));case \"CDataSection\":return new Qm(bm(a),{type:1,g:3});case \"deleteExpr\":return a=Z(dm(a,[\"targetExpr\",\n\"*\"]),c),new Qs(a);case \"insertExpr\":e=Z(dm(a,[\"sourceExpr\",\"*\"]),c);f=em(a,\"*\")[1];switch(f[0]){case \"insertAfter\":g=1;break;case \"insertBefore\":g=2;break;case \"insertInto\":g=(g=W(f,\"*\"))?\"insertAsFirst\"===g[0]?4:5:3}a=Z(dm(a,[\"targetExpr\",\"*\"]),c);return new Us(e,g,a);case \"renameExpr\":return e=Z(dm(a,[\"targetExpr\",\"*\"]),c),a=Z(dm(a,[\"newNameExpr\",\"*\"]),c),new at(e,a);case \"replaceExpr\":return e=!!W(a,\"replaceValue\"),g=Z(dm(a,[\"targetExpr\",\"*\"]),c),a=Z(dm(a,[\"replacementExpr\",\"*\"]),c),new dt(e,\ng,a);case \"transformExpr\":return Nt(a,c);case \"x:stackTrace\":e=a[1];for(a=a[2];\"x:stackTrace\"===a[0];)a=a[2];return new Gm(e,a[0],Z(a,c));default:return Ot(a)}}\nfunction Ot(a){switch(a[0]){case \"nameTest\":return new ss(fm(a));case \"piTest\":return(a=W(a,\"piTarget\"))?new ts(bm(a)):new rs(7);case \"commentTest\":return new rs(8);case \"textTest\":return new rs(3);case \"documentTest\":return new rs(9);case \"attributeTest\":var c=(a=W(a,\"attributeName\"))&&W(a,\"star\");return!a||c?new rs(2):new ss(fm(W(a,\"QName\")),{kind:2});case \"elementTest\":return c=(a=W(a,\"elementName\"))&&W(a,\"star\"),!a||c?new rs(1):new ss(fm(W(a,\"QName\")),{kind:1});case \"anyKindTest\":return new us({prefix:\"\",\nnamespaceURI:null,localName:\"node()\"});case \"anyMapTest\":return new us({prefix:\"\",namespaceURI:null,localName:\"map(*)\"});case \"anyArrayTest\":return new us({prefix:\"\",namespaceURI:null,localName:\"array(*)\"});case \"Wildcard\":return W(a,\"star\")?(c=W(a,\"uri\"))?a=new ss({localName:\"*\",namespaceURI:bm(c),prefix:\"\"}):(c=W(a,\"NCName\"),a=\"star\"===W(a,\"*\")[0]?new ss({localName:bm(c),namespaceURI:null,prefix:\"*\"}):new ss({localName:\"*\",namespaceURI:null,prefix:bm(c)})):a=new ss({localName:\"*\",namespaceURI:null,\nprefix:\"*\"}),a;case \"atomicType\":return a=fm(a),new us(a);case \"anyItemType\":return new us({prefix:\"\",namespaceURI:null,localName:\"item()\"});default:throw Error(\"No selector counterpart for: \"+a[0]+\".\");}}function Ht(a,c){var e=cm(a,\"type\");a=W(a,\"*\");var g=em(a,\"arrayElem\").map(function(f){return Z(W(f,\"*\"),tt(c))});switch(a[0]){case \"curlyArray\":return new im(g,e);case \"squareArray\":return new jm(g,e);default:throw Error(\"Unrecognized arrayType: \"+a[0]);}}\nfunction Gt(a,c){var e=cm(a,\"type\");return new Rm(em(a,\"mapConstructorEntry\").map(function(g){return{key:Z(dm(g,[\"mapKeyExpr\",\"*\"]),tt(c)),value:Z(dm(g,[\"mapValueExpr\",\"*\"]),tt(c))}}),e)}function ut(a,c,e){function g(m){var p=W(m,\"firstOperand\")[1];m=W(m,\"secondOperand\")[1];p[0]===a?g(p):f.push(Z(p,e));m[0]===a?g(m):f.push(Z(m,e))}var f=[];g(c);return f}function It(a,c){a=W(a,\"*\");switch(a[0]){case \"NCName\":return new Qm(bm(a),{type:1,g:3});case \"star\":return\"*\";default:return Z(a,tt(c))}}\nfunction Pt(a,c,e){a=em(a,\"*\");return new eo(a.filter(function(g){return\"stable\"!==g[0]}).map(function(g){var f=W(g,\"orderModifier\"),m=f?W(f,\"orderingKind\"):null;f=f?W(f,\"emptyOrderingMode\"):null;m=m?\"ascending\"===bm(m):!0;f=f?\"empty least\"===bm(f):!0;return{ia:Z(dm(g,[\"orderByExpr\",\"*\"]),c),Ib:m,mc:f}}),e)}\nfunction Dt(a,c){var e=em(a,\"*\");a=W(e[e.length-1],\"*\");e=e.slice(0,-1);if(1m)return f;m-=f.length;p+=p.repeat(m);return f+p.slice(0,m)}(function(f,m){function p(){this.constructor=f}p.prototype=m.prototype;f.prototype=new p})(e,Error);e.prototype.format=function(f){var m=\"Error: \"+this.message;if(this.location){var p=null,t;for(t=0;tHc&&(Hc=b,Dk=[]),Dk.push(h))}function Ka(){var h,u,k=233*b;if(h=z[k])return b=h.i,h.result;h=b;F();var l=233*b+2;if(u=z[l])b=u.i,l=u.result;else{u=b;if(f.substr(b,6)===mo){var n=mo;b+=6}else n=d,0===w&&x(xv);if(n!==d){F();n=b;if(f.substr(b,8)===Yh){var q=Yh;b+=8}else q=d,0===w&&x(no);q!==d?(q=P(),q!==d?(q=\nbb(),q!==d?(B=n,n=[\"encoding\",q]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d);if(n===d)if(n=b,f.substr(b,7)===oo?(q=oo,b+=7):(q=d,0===w&&x(yv)),q!==d)if(q=P(),q!==d)if(q=bb(),q!==d){var r=b;var y=P();y!==d?(f.substr(b,8)===Yh?(y=Yh,b+=8):(y=d,0===w&&x(no)),y!==d?(y=P(),y!==d?(y=bb(),y!==d?(B=r,r=y):(b=r,r=d)):(b=r,r=d)):(b=r,r=d)):(b=r,r=d);r===d&&(r=null);B=n;n=[[\"version\",q]].concat(r?[[\"encoding\",r]]:[])}else b=n,n=d;else b=n,n=d;else b=n,n=d;n!==d?(F(),q=Ib(),q!==d?(B=u,u=[\"versionDecl\"].concat(n)):(b=u,\nu=d)):(b=u,u=d)}else b=u,u=d;z[l]={i:b,result:u};l=u}l===d&&(l=null);F();u=233*b+3;if(n=z[u])b=n.i,u=n.result;else{n=b;q=233*b+4;if(r=z[q])b=r.i,q=r.result;else{r=b;f.substr(b,6)===Zh?(y=Zh,b+=6):(y=d,0===w&&x(po));if(y!==d)if(y=P(),y!==d)if(f.substr(b,9)===Jb?(y=Jb,b+=9):(y=d,0===w&&x(ge)),y!==d)if(y=P(),y!==d){y=b;var C=Kb();y=C!==d?f.substring(y,b):C;if(y!==d)if(F(),61===f.charCodeAt(b)?(C=Cd,b++):(C=d,0===w&&x(Dd)),C!==d)if(F(),C=bb(),C!==d){F();var J=Ib();J!==d?(B=r,r=[\"moduleDecl\",[\"prefix\",\ny],[\"uri\",C]]):(b=r,r=d)}else b=r,r=d;else b=r,r=d;else b=r,r=d}else b=r,r=d;else b=r,r=d;else b=r,r=d;else b=r,r=d;z[q]={i:b,result:r};q=r}q!==d?(F(),r=ac(),B=n,n=[\"libraryModule\",q].concat(r?[r]:[])):(b=n,n=d);z[u]={i:b,result:n};u=n}u===d&&(u=233*b+1,(n=z[u])?(b=n.i,u=n.result):(n=b,q=ac(),F(),r=233*b+36,(y=z[r])?(b=y.i,r=y.result):(y=b,C=pc(),C!==d&&(B=y,C=[\"queryBody\",C]),y=C,z[r]={i:b,result:y},r=y),r!==d?(B=n,n=[\"mainModule\"].concat(q?[q]:[],[r])):(b=n,n=d),z[u]={i:b,result:n},u=n));u!==d?\n(F(),B=h,h=[\"module\"].concat(l?[l]:[],[u])):(b=h,h=d);z[k]={i:b,result:h};return h}function ac(){var h,u=233*b+5;if(h=z[u])return b=h.i,h.result;h=b;var k=[];var l=b;var n=Ed();n===d&&(n=fg(),n===d&&(n=Ic(),n===d&&(n=Fa())));if(n!==d){F();var q=Ib();q!==d?(F(),B=l,l=n):(b=l,l=d)}else b=l,l=d;for(;l!==d;)k.push(l),l=b,n=Ed(),n===d&&(n=fg(),n===d&&(n=Ic(),n===d&&(n=Fa()))),n!==d?(F(),q=Ib(),q!==d?(F(),B=l,l=n):(b=l,l=d)):(b=l,l=d);l=[];n=b;q=qo();q===d&&(q=Ne(),q===d&&(q=ro()));if(q!==d){F();var r=\nIb();r!==d?(F(),B=n,n=q):(b=n,n=d)}else b=n,n=d;for(;n!==d;)l.push(n),n=b,q=qo(),q===d&&(q=Ne(),q===d&&(q=ro())),q!==d?(F(),r=Ib(),r!==d?(F(),B=n,n=q):(b=n,n=d)):(b=n,n=d);B=h;h=0===k.length&&0===l.length?null:[\"prolog\"].concat(k,l);z[u]={i:b,result:h};return h}function Ib(){var h,u=233*b+6;if(h=z[u])return b=h.i,h.result;59===f.charCodeAt(b)?(h=$h,b++):(h=d,0===w&&x(ai));z[u]={i:b,result:h};return h}function fg(){var h,u=233*b+7;if(h=z[u])return b=h.i,h.result;var k;h=233*b+8;if(k=z[h])b=k.i,h=k.result;\nelse{k=b;if(f.substr(b,7)===La){var l=La;b+=7}else l=d,0===w&&x(Sb);l!==d?(l=P(),l!==d?(f.substr(b,14)===so?(l=so,b+=14):(l=d,0===w&&x(zv)),l!==d?(l=P(),l!==d?(f.substr(b,8)===Oe?(l=Oe,b+=8):(l=d,0===w&&x(Ek)),l===d&&(f.substr(b,5)===bi?(l=bi,b+=5):(l=d,0===w&&x(to))),l!==d?(B=k,k=[\"boundarySpaceDecl\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d);z[h]={i:b,result:k};h=k}if(h===d&&(h=233*b+9,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,7)===La?(l=La,b+=7):(l=d,0===w&&x(Sb)),l!==d?(l=P(),\nl!==d?(f.substr(b,7)===bc?(l=bc,b+=7):(l=d,0===w&&x(Pe)),l!==d?(l=P(),l!==d?(f.substr(b,9)===Qe?(l=Qe,b+=9):(l=d,0===w&&x(Fk)),l!==d?(l=P(),l!==d?(l=bb(),l!==d?(B=k,k=[\"defaultCollationDecl\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),z[h]={i:b,result:k},h=k),h===d&&(h=233*b+10,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,7)===La?(l=La,b+=7):(l=d,0===w&&x(Sb)),l!==d?(l=P(),l!==d?(f.substr(b,8)===uo?(l=uo,b+=8):(l=d,0===w&&x(Av)),l!==d?(l=P(),l!==d?(l=bb(),l!==d?\n(B=k,k=[\"baseUriDecl\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),z[h]={i:b,result:k},h=k),h===d&&(h=233*b+11,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,7)===La?(l=La,b+=7):(l=d,0===w&&x(Sb)),l!==d?(l=P(),l!==d?(f.substr(b,12)===vo?(l=vo,b+=12):(l=d,0===w&&x(Bv)),l!==d?(l=P(),l!==d?(f.substr(b,5)===bi?(l=bi,b+=5):(l=d,0===w&&x(to)),l===d&&(f.substr(b,8)===Oe?(l=Oe,b+=8):(l=d,0===w&&x(Ek))),l!==d?(B=k,k=[\"constructionDecl\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),z[h]=\n{i:b,result:k},h=k),h===d&&(h=233*b+12,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,7)===La?(l=La,b+=7):(l=d,0===w&&x(Sb)),l!==d?(l=P(),l!==d?(f.substr(b,8)===wo?(l=wo,b+=8):(l=d,0===w&&x(Cv)),l!==d?(l=P(),l!==d?(f.substr(b,7)===xo?(l=xo,b+=7):(l=d,0===w&&x(Dv)),l===d&&(f.substr(b,9)===yo?(l=yo,b+=9):(l=d,0===w&&x(Ev))),l!==d?(B=k,k=[\"orderingModeDecl\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),z[h]={i:b,result:k},h=k),h===d&&(h=233*b+13,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,7)===\nLa?(l=La,b+=7):(l=d,0===w&&x(Sb)),l!==d?(l=P(),l!==d?(f.substr(b,7)===bc?(l=bc,b+=7):(l=d,0===w&&x(Pe)),l!==d?(l=P(),l!==d?(f.substr(b,5)===Re?(l=Re,b+=5):(l=d,0===w&&x(Gk)),l!==d?(l=P(),l!==d?(f.substr(b,5)===Se?(l=Se,b+=5):(l=d,0===w&&x(Hk)),l!==d?(l=P(),l!==d?(f.substr(b,8)===ci?(l=ci,b+=8):(l=d,0===w&&x(zo)),l===d&&(f.substr(b,5)===di?(l=di,b+=5):(l=d,0===w&&x(Ao))),l!==d?(B=k,k=[\"emptyOrderDecl\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d)):(b=k,\nk=d),z[h]={i:b,result:k},h=k),h===d)))))){var n;h=233*b+14;if(k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,7)===La?(l=La,b+=7):(l=d,0===w&&x(Sb));if(l!==d)if(l=P(),l!==d)if(f.substr(b,15)===Bo?(l=Bo,b+=15):(l=d,0===w&&x(Fv)),l!==d)if(l=P(),l!==d)if(l=233*b+15,(n=z[l])?(b=n.i,l=n.result):(f.substr(b,8)===Oe?(n=Oe,b+=8):(n=d,0===w&&x(Ek)),n===d&&(f.substr(b,11)===Co?(n=Co,b+=11):(n=d,0===w&&x(Gv))),z[l]={i:b,result:n},l=n),l!==d)if(F(),44===f.charCodeAt(b)?(n=ua,b++):(n=d,0===w&&x(va)),n!==d){F();var q;\nn=233*b+16;(q=z[n])?(b=q.i,n=q.result):(f.substr(b,7)===Do?(q=Do,b+=7):(q=d,0===w&&x(Hv)),q===d&&(f.substr(b,10)===Eo?(q=Eo,b+=10):(q=d,0===w&&x(Iv))),z[n]={i:b,result:q},n=q);n!==d?(B=k,k=[\"copyNamespacesDecl\",[\"preserveMode\",l],[\"inheritMode\",n]]):(b=k,k=d)}else b=k,k=d;else b=k,k=d;else b=k,k=d;else b=k,k=d;else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}if(h===d)if(h=233*b+17,k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,7)===La?(l=La,b+=7):(l=d,0===w&&x(Sb));if(l!==d)if(l=P(),l!==d){l=b;f.substr(b,\n14)===ei?(n=ei,b+=14):(n=d,0===w&&x(Fo));if(n!==d)if(q=P(),q!==d){var r=Aa();r!==d?(B=l,l=[\"decimalFormatName\"].concat(r)):(b=l,l=d)}else b=l,l=d;else b=l,l=d;l===d&&(l=b,f.substr(b,7)===bc?(n=bc,b+=7):(n=d,0===w&&x(Pe)),n!==d?(q=P(),q!==d?(f.substr(b,14)===ei?(r=ei,b+=14):(r=d,0===w&&x(Fo)),r!==d?(B=l,l=null):(b=l,l=d)):(b=l,l=d)):(b=l,l=d));if(l!==d){n=[];q=b;r=P();if(r!==d)if(r=qc(),r!==d){var y=P();y!==d?(61===f.charCodeAt(b)?(y=Cd,b++):(y=d,0===w&&x(Dd)),y!==d?(y=P(),y!==d?(y=bb(),y!==d?(B=q,\nq=R(l,r,y)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)}else b=q,q=d;else b=q,q=d;for(;q!==d;)n.push(q),q=b,r=P(),r!==d?(r=qc(),r!==d?(y=P(),y!==d?(61===f.charCodeAt(b)?(y=Cd,b++):(y=d,0===w&&x(Dd)),y!==d?(y=P(),y!==d?(y=bb(),y!==d?(B=q,q=R(l,r,y)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d);B=k;k=[\"decimalFormatDecl\"].concat(l?[l]:[],n)}else b=k,k=d}else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}}z[u]={i:b,result:h};return h}function qc(){var h,u=233*b+18;if(h=z[u])return b=\nh.i,h.result;f.substr(b,17)===Go?(h=Go,b+=17):(h=d,0===w&&x(Jv));h===d&&(f.substr(b,18)===Ho?(h=Ho,b+=18):(h=d,0===w&&x(Kv)),h===d&&(f.substr(b,8)===Io?(h=Io,b+=8):(h=d,0===w&&x(Lv)),h===d&&(f.substr(b,10)===Jo?(h=Jo,b+=10):(h=d,0===w&&x(Mv)),h===d&&(f.substr(b,3)===Ko?(h=Ko,b+=3):(h=d,0===w&&x(Nv)),h===d&&(f.substr(b,7)===Lo?(h=Lo,b+=7):(h=d,0===w&&x(Ov)),h===d&&(f.substr(b,9)===Mo?(h=Mo,b+=9):(h=d,0===w&&x(Pv)),h===d&&(f.substr(b,10)===No?(h=No,b+=10):(h=d,0===w&&x(Qv)),h===d&&(f.substr(b,5)===\nOo?(h=Oo,b+=5):(h=d,0===w&&x(Rv)),h===d&&(f.substr(b,17)===Po?(h=Po,b+=17):(h=d,0===w&&x(Sv)),h===d&&(f.substr(b,18)===Qo?(h=Qo,b+=18):(h=d,0===w&&x(Tv))))))))))));z[u]={i:b,result:h};return h}function Fa(){var h,u=233*b+19;if(h=z[u])return b=h.i,h.result;var k,l;h=233*b+20;if(k=z[h])b=k.i,h=k.result;else{k=b;if(f.substr(b,6)===fi){var n=fi;b+=6}else n=d,0===w&&x(Ro);if(n!==d)if(n=P(),n!==d)if(f.substr(b,6)===So?(n=So,b+=6):(n=d,0===w&&x(Uv)),n!==d){n=b;var q=P();if(q!==d){q=233*b+21;if(l=z[q])b=\nl.i,q=l.result;else{l=b;if(f.substr(b,9)===Jb){var r=Jb;b+=9}else r=d,0===w&&x(ge);if(r!==d){var y=P();if(y!==d){var C=Kb();if(C!==d){F();if(61===f.charCodeAt(b)){var J=Cd;b++}else J=d,0===w&&x(Dd);J!==d?(B=l,l=[\"namespacePrefix\",C]):(b=l,l=d)}else b=l,l=d}else b=l,l=d}else b=l,l=d;if(l===d){r=l=b;f.substr(b,7)===bc?(y=bc,b+=7):(y=d,0===w&&x(Pe));if(y!==d)if(C=P(),C!==d){if(f.substr(b,7)===Lb){var N=Lb;b+=7}else N=d,0===w&&x(he);if(N!==d)if(J=P(),J!==d){if(f.substr(b,9)===Jb){var oa=Jb;b+=9}else oa=\nd,0===w&&x(ge);if(oa!==d){var wb=za();wb!==d?r=y=[y,C,N,J,oa,wb]:(b=r,r=d)}else b=r,r=d}else b=r,r=d;else b=r,r=d}else b=r,r=d;else b=r,r=d;r!==d&&(B=l,r=[\"defaultElementNamespace\"]);l=r}z[q]={i:b,result:l};q=l}q!==d?(B=n,n=q):(b=n,n=d)}else b=n,n=d;n===d&&(n=null);F();q=bb();if(q!==d){l=b;r=P();if(r!==d)if(f.substr(b,2)===Te?(r=Te,b+=2):(r=d,0===w&&x(Ik)),r!==d)if(r=P(),r!==d)if(r=bb(),r!==d){y=[];C=b;N=P();N!==d?(44===f.charCodeAt(b)?(N=ua,b++):(N=d,0===w&&x(va)),N!==d?(N=P(),N!==d?(N=bb(),N!==\nd?(B=C,C=N):(b=C,C=d)):(b=C,C=d)):(b=C,C=d)):(b=C,C=d);for(;C!==d;)y.push(C),C=b,N=P(),N!==d?(44===f.charCodeAt(b)?(N=ua,b++):(N=d,0===w&&x(va)),N!==d?(N=P(),N!==d?(N=bb(),N!==d?(B=C,C=N):(b=C,C=d)):(b=C,C=d)):(b=C,C=d)):(b=C,C=d);B=l;l=[r].concat(y)}else b=l,l=d;else b=l,l=d;else b=l,l=d;else b=l,l=d;l===d&&(l=null);B=k;k=[\"schemaImport\"].concat(n?[n]:[],[[\"targetNamespace\",q]],l?[l]:[])}else b=k,k=d}else b=k,k=d;else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}if(h===d)if(h=233*b+22,k=z[h])b=k.i,\nh=k.result;else{k=b;f.substr(b,6)===fi?(n=fi,b+=6):(n=d,0===w&&x(Ro));if(n!==d)if(n=P(),n!==d)if(f.substr(b,6)===Zh?(n=Zh,b+=6):(n=d,0===w&&x(po)),n!==d)if(n=b,q=P(),q!==d?(f.substr(b,9)===Jb?(q=Jb,b+=9):(q=d,0===w&&x(ge)),q!==d?(l=P(),l!==d?(r=b,y=Kb(),r=y!==d?f.substring(r,b):y,r!==d?(F(),61===f.charCodeAt(b)?(y=Cd,b++):(y=d,0===w&&x(Dd)),y!==d?(B=n,n=r):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d),n===d&&(n=null),F(),q=bb(),q!==d){l=b;r=P();if(r!==d)if(f.substr(b,2)===Te?(y=Te,b+=2):(y=\nd,0===w&&x(Ik)),y!==d)if(y=P(),y!==d)if(r=bb(),r!==d)for(l=[],r=b,y=F(),44===f.charCodeAt(b)?(C=ua,b++):(C=d,0===w&&x(va)),C!==d?(N=F(),J=bb(),J!==d?r=y=[y,C,N,J]:(b=r,r=d)):(b=r,r=d);r!==d;)l.push(r),r=b,y=F(),44===f.charCodeAt(b)?(C=ua,b++):(C=d,0===w&&x(va)),C!==d?(N=F(),J=bb(),J!==d?r=y=[y,C,N,J]:(b=r,r=d)):(b=r,r=d);else b=l;else b=l;else b=l;else b=l;B=k;k=[\"moduleImport\",[\"namespacePrefix\",n],[\"targetNamespace\",q]]}else b=k,k=d;else b=k,k=d;else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}z[u]=\n{i:b,result:h};return h}function Ic(){var h,u=233*b+23;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,7)===La){var k=La;b+=7}else k=d,0===w&&x(Sb);if(k!==d)if(k=P(),k!==d)if(f.substr(b,9)===Jb?(k=Jb,b+=9):(k=d,0===w&&x(ge)),k!==d)if(k=P(),k!==d)if(k=Kb(),k!==d){F();if(61===f.charCodeAt(b)){var l=Cd;b++}else l=d,0===w&&x(Dd);l!==d?(F(),l=bb(),l!==d?(B=h,h=[\"namespaceDecl\",[\"prefix\",k],[\"uri\",l]]):(b=h,h=d)):(b=h,h=d)}else b=h,h=d;else b=h,h=d;else b=h,h=d;else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};\nreturn h}function Ed(){var h,u=233*b+24;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,7)===La){var k=La;b+=7}else k=d,0===w&&x(Sb);if(k!==d)if(k=P(),k!==d)if(f.substr(b,7)===bc?(k=bc,b+=7):(k=d,0===w&&x(Pe)),k!==d)if(k=P(),k!==d)if(f.substr(b,7)===Lb?(k=Lb,b+=7):(k=d,0===w&&x(he)),k===d&&(f.substr(b,8)===cc?(k=cc,b+=8):(k=d,0===w&&x(Ue))),k!==d){var l=P();l!==d?(f.substr(b,9)===Jb?(l=Jb,b+=9):(l=d,0===w&&x(ge)),l!==d?(l=P(),l!==d?(l=bb(),l!==d?(B=h,h=[\"defaultNamespaceDecl\",[\"defaultNamespaceCategory\",\nk],[\"uri\",l]]):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)}else b=h,h=d;else b=h,h=d;else b=h,h=d;else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function Ne(){var h,u=233*b+25;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,7)===La){var k=La;b+=7}else k=d,0===w&&x(Sb);if(k!==d)if(k=P(),k!==d){k=[];var l=b;var n=Ve();n===d&&(n=To());if(n!==d){var q=P();q!==d?(B=l,l=n):(b=l,l=d)}else b=l,l=d;for(;l!==d;)k.push(l),l=b,n=Ve(),n===d&&(n=To()),n!==d?(q=P(),q!==d?(B=l,l=n):(b=l,l=d)):(b=l,l=d);\nl=233*b+28;if(n=z[l])b=n.i,l=n.result;else{n=b;f.substr(b,8)===Uo?(q=Uo,b+=8):(q=d,0===w&&x(Vv));if(q!==d)if(q=P(),q!==d)if(36===f.charCodeAt(b)?(q=Jc,b++):(q=d,0===w&&x(Kc)),q!==d)if(F(),q=Aa(),q!==d){var r=b;F();var y=We();y!==d?(B=r,r=y):(b=r,r=d);r===d&&(r=null);var C=b;F();f.substr(b,2)===Mb?(y=Mb,b+=2):(y=d,0===w&&x(ie));y!==d?(F(),y=ta(),y!==d?(B=C,C=[\"varValue\",y]):(b=C,C=d)):(b=C,C=d);if(C===d)if(C=b,y=P(),y!==d)if(f.substr(b,8)===Xe?(y=Xe,b+=8):(y=d,0===w&&x(Jk)),y!==d){y=b;F();if(f.substr(b,\n2)===Mb){var J=Mb;b+=2}else J=d,0===w&&x(ie);J!==d?(F(),J=ta(),J!==d?(B=y,y=[\"varValue\",J]):(b=y,y=d)):(b=y,y=d);y===d&&(y=null);B=C;C=[\"external\"].concat(y?[y]:[])}else b=C,C=d;else b=C,C=d;C!==d?(B=n,n=[\"varDecl\",[\"varName\"].concat(q)].concat(r?[r]:[],[C])):(b=n,n=d)}else b=n,n=d;else b=n,n=d;else b=n,n=d;else b=n,n=d;z[l]={i:b,result:n};l=n}l===d&&(l=233*b+30,(n=z[l])?(b=n.i,l=n.result):(n=b,f.substr(b,8)===cc?(q=cc,b+=8):(q=d,0===w&&x(Ue)),q!==d?(q=P(),q!==d?(r=b,w++,q=Vo(),w--,q===d?r=void 0:\n(b=r,r=d),r!==d?(q=Aa(),q!==d?(F(),40===f.charCodeAt(b)?(r=fb,b++):(r=d,0===w&&x(gb)),r!==d?(F(),r=Wo(),r===d&&(r=null),F(),41===f.charCodeAt(b)?(C=Oa,b++):(C=d,0===w&&x(Pa)),C!==d?(C=b,y=P(),y!==d?(f.substr(b,2)===db?(y=db,b+=2):(y=d,0===w&&x(rc)),y!==d?(J=P(),J!==d?(y=Nb(),y!==d?(B=C,C=y):(b=C,C=d)):(b=C,C=d)):(b=C,C=d)):(b=C,C=d),C===d&&(C=null),F(),y=b,J=Xo(),J!==d&&(B=y,J=[\"functionBody\",J]),y=J,y===d&&(y=b,f.substr(b,8)===Xe?(J=Xe,b+=8):(J=d,0===w&&x(Jk)),J!==d&&(B=y,J=[\"externalDefinition\"]),\ny=J),y!==d?(B=n,n=[\"functionDecl\",[\"functionName\"].concat(q),[\"paramList\"].concat(r||[])].concat(C?[[\"typeDeclaration\"].concat(C)]:[],[y])):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d),z[l]={i:b,result:n},l=n));l!==d?(B=h,h=[l[0]].concat(k,l.slice(1))):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function To(){var h,u=233*b+26;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,8)===Yo){var k=Yo;b+=8}else k=d,0===w&&x(Wv);k!==d&&(B=h,k=[\"annotation\",\n[\"annotationName\",\"updating\"]]);h=k;z[u]={i:b,result:h};return h}function Ve(){var h,u=233*b+27;if(h=z[u])return b=h.i,h.result;h=b;if(37===f.charCodeAt(b)){var k=Xv;b++}else k=d,0===w&&x(Yv);if(k!==d)if(F(),k=Aa(),k!==d){var l=b;F();if(40===f.charCodeAt(b)){var n=fb;b++}else n=d,0===w&&x(gb);if(n!==d)if(F(),n=gi(),n!==d){var q=[];var r=b;F();if(44===f.charCodeAt(b)){var y=ua;b++}else y=d,0===w&&x(va);y!==d?(F(),y=gi(),y!==d?(B=r,r=y):(b=r,r=d)):(b=r,r=d);for(;r!==d;)q.push(r),r=b,F(),44===f.charCodeAt(b)?\n(y=ua,b++):(y=d,0===w&&x(va)),y!==d?(F(),y=gi(),y!==d?(B=r,r=y):(b=r,r=d)):(b=r,r=d);F();41===f.charCodeAt(b)?(r=Oa,b++):(r=d,0===w&&x(Pa));r!==d?(B=l,l=n.concat(q)):(b=l,l=d)}else b=l,l=d;else b=l,l=d;l===d&&(l=null);B=h;h=[\"annotation\",[\"annotationName\"].concat(k)].concat(l?[\"arguments\",l]:[])}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function qo(){var h,u=233*b+29;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,7)===La){var k=La;b+=7}else k=d,0===w&&x(Sb);if(k!==d)if(k=P(),k!==d)if(f.substr(b,\n7)===Zo?(k=Zo,b+=7):(k=d,0===w&&x(Zv)),k!==d)if(k=P(),k!==d)if(f.substr(b,4)===hi?(k=hi,b+=4):(k=d,0===w&&x($o)),k!==d){var l=b;var n=P();if(n!==d)if(f.substr(b,2)===db?(k=db,b+=2):(k=d,0===w&&x(rc)),k!==d){var q=Kk();q!==d||(b=l)}else b=l;else b=l;n=b;k=F();f.substr(b,2)===Mb?(q=Mb,b+=2):(q=d,0===w&&x(ie));if(q!==d){l=F();var r=ta();r!==d?n=k=[k,q,l,r]:(b=n,n=d)}else b=n,n=d;if(n===d)if(n=b,k=P(),k!==d)if(f.substr(b,8)===Xe?(q=Xe,b+=8):(q=d,0===w&&x(Jk)),q!==d){l=b;r=F();f.substr(b,2)===Mb?(n=Mb,\nb+=2):(n=d,0===w&&x(ie));if(n!==d){var y=F();var C=ta();C!==d?l=r=[r,n,y,C]:(b=l,l=d)}else b=l,l=d;l===d&&(l=null);n=k=[k,q,l]}else b=n,n=d;else b=n,n=d;n!==d?(B=h,h={type:\"contextItemDecl\"}):(b=h,h=d)}else b=h,h=d;else b=h,h=d;else b=h,h=d;else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function Wo(){var h,u=233*b+31;if(h=z[u])return b=h.i,h.result;h=b;var k=Lk();if(k!==d){var l=[];var n=b;F();if(44===f.charCodeAt(b)){var q=ua;b++}else q=d,0===w&&x(va);q!==d?(F(),q=Lk(),q!==d?(B=n,n=q):(b=\nn,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),44===f.charCodeAt(b)?(q=ua,b++):(q=d,0===w&&x(va)),q!==d?(F(),q=Lk(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d);B=h;h=[k].concat(l)}else b=h,h=d;z[u]={i:b,result:h};return h}function Lk(){var h,u=233*b+32;if(h=z[u])return b=h.i,h.result;h=b;if(36===f.charCodeAt(b)){var k=Jc;b++}else k=d,0===w&&x(Kc);if(k!==d)if(k=Aa(),k!==d){var l=b;var n=P();n!==d?(n=We(),n!==d?(B=l,l=n):(b=l,l=d)):(b=l,l=d);l===d&&(l=null);B=h;h=[\"param\",[\"varName\"].concat(k)].concat(l?\n[l]:[])}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function Xo(){var h,u=233*b+33;if(h=z[u])return b=h.i,h.result;h=b;var k=sc();k!==d&&(B=h,k=k?k:[\"sequenceExpr\"]);h=k;z[u]={i:b,result:h};return h}function sc(){var h,u=233*b+34;if(h=z[u])return b=h.i,h.result;h=b;if(123===f.charCodeAt(b)){var k=Fd;b++}else k=d,0===w&&x(Gd);if(k!==d){F();k=pc();k===d&&(k=null);F();if(125===f.charCodeAt(b)){var l=Hd;b++}else l=d,0===w&&x(Id);l!==d?(B=h,h=k||null):(b=h,h=d)}else b=h,h=d;z[u]={i:b,result:h};\nreturn h}function ro(){var h,u=233*b+35;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,7)===La){var k=La;b+=7}else k=d,0===w&&x(Sb);k!==d?(k=P(),k!==d?(f.substr(b,6)===ap?(k=ap,b+=6):(k=d,0===w&&x($v)),k!==d?(k=P(),k!==d?(k=Aa(),k!==d?(k=P(),k!==d?(k=bb(),k!==d?(B=h,h={type:\"optionDecl\"}):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d);z[u]={i:b,result:h};return h}function pc(){var h,u=233*b+37;if(h=z[u])return b=h.i,h.result;h=b;var k=ta();if(k!==d){var l=[];var n=\nb;F();if(44===f.charCodeAt(b)){var q=ua;b++}else q=d,0===w&&x(va);q!==d?(F(),q=ta(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),44===f.charCodeAt(b)?(q=ua,b++):(q=d,0===w&&x(va)),q!==d?(F(),q=ta(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d);B=h;h=0===l.length?k:[\"sequenceExpr\",k].concat(l)}else b=h,h=d;z[u]={i:b,result:h};return h}function ta(){var h=233*b+38,u=z[h];if(u)return b=u.i,u.result;var k=b;var l=233*b+39,n=z[l];if(n){b=n.i;var q=n.result}else{var r=b;var y=bp();if(y!==d){var C=\n[];var J=b;var N=F();var oa=cp();oa!==d?(B=J,J=oa):(b=J,J=d);for(;J!==d;)C.push(J),J=b,N=F(),oa=cp(),oa!==d?(B=J,J=oa):(b=J,J=d);J=F();var wb=233*b+58,Tb=z[wb];if(Tb)b=Tb.i,N=Tb.result;else{var dc=b;if(f.substr(b,6)===Jd){var je=Jd;b+=6}else je=d,0===w&&x(ii);if(je!==d){F();var Ye=ta();Ye!==d?(B=dc,dc=[\"returnClause\",Ye]):(b=dc,dc=d)}else b=dc,dc=d;z[wb]={i:b,result:dc};N=dc}N!==d?(B=r,r=[\"flworExpr\",y].concat(C,[N])):(b=r,r=d)}else b=r,r=d;z[l]={i:b,result:r};q=r}q!==d&&(B=k,q=$b(q));k=q;if(k===\nd){k=b;var gg=233*b+59,ke=z[gg];if(ke)b=ke.i,q=ke.result;else{var Xa=b;if(f.substr(b,4)===dp){var dd=dp;b+=4}else dd=d,0===w&&x(aw);dd===d&&(f.substr(b,5)===ep?(dd=ep,b+=5):(dd=d,0===w&&x(bw)));if(dd!==d){var hg=P();if(hg!==d){var ig=233*b+60,le=z[ig];if(le){b=le.i;var Qa=le.result}else{var Eb=b;var jg=Mk();if(jg!==d){var Ze=[];var mb=b;F();if(44===f.charCodeAt(b)){var ed=ua;b++}else ed=d,0===w&&x(va);if(ed!==d){F();var xb=Mk();xb!==d?(B=mb,mb=xb):(b=mb,mb=d)}else b=mb,mb=d;for(;mb!==d;)Ze.push(mb),\nmb=b,F(),44===f.charCodeAt(b)?(ed=ua,b++):(ed=d,0===w&&x(va)),ed!==d?(F(),xb=Mk(),xb!==d?(B=mb,mb=xb):(b=mb,mb=d)):(b=mb,mb=d);B=Eb;Eb=[jg].concat(Ze)}else b=Eb,Eb=d;z[ig]={i:b,result:Eb};Qa=Eb}if(Qa!==d){var ji=P();if(ji!==d){if(f.substr(b,9)===fp){var sb=fp;b+=9}else sb=d,0===w&&x(cw);if(sb!==d){var fd=P();if(fd!==d){var kg=ta();kg!==d?(B=Xa,Xa=[\"quantifiedExpr\",[\"quantifier\",dd]].concat(Qa,[[\"predicateExpr\",kg]])):(b=Xa,Xa=d)}else b=Xa,Xa=d}else b=Xa,Xa=d}else b=Xa,Xa=d}else b=Xa,Xa=d}else b=Xa,\nXa=d}else b=Xa,Xa=d;z[gg]={i:b,result:Xa};q=Xa}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var lg=233*b+62,$e=z[lg];if($e)b=$e.i,q=$e.result;else{var Da=b;if(f.substr(b,10)===ki){var af=ki;b+=10}else af=d,0===w&&x(gp);if(af!==d){F();if(40===f.charCodeAt(b)){var me=fb;b++}else me=d,0===w&&x(gb);if(me!==d){var Kd=pc();if(Kd!==d){if(41===f.charCodeAt(b)){var mg=Oa;b++}else mg=d,0===w&&x(Pa);if(mg!==d){F();var Ld=[];var Ma=b;var Lc=hp();if(Lc!==d){var ya=F();B=Ma;Ma=Lc}else b=Ma,Ma=d;if(Ma!==d)for(;Ma!==d;)Ld.push(Ma),\nMa=b,Lc=hp(),Lc!==d?(ya=F(),B=Ma,Ma=Lc):(b=Ma,Ma=d);else Ld=d;if(Ld!==d)if(f.substr(b,7)===bc?(Ma=bc,b+=7):(Ma=d,0===w&&x(Pe)),Ma!==d)if(Lc=P(),Lc!==d){ya=b;if(36===f.charCodeAt(b)){var ne=Jc;b++}else ne=d,0===w&&x(Kc);if(ne!==d){var oe=Aa();if(oe!==d){var tc=P();tc!==d?(B=ya,ya=oe):(b=ya,ya=d)}else b=ya,ya=d}else b=ya,ya=d;ya===d&&(ya=null);f.substr(b,6)===Jd?(ne=Jd,b+=6):(ne=d,0===w&&x(ii));ne!==d?(oe=P(),oe!==d?(tc=ta(),tc!==d?(B=Da,Da=[\"typeswitchExpr\",[\"argExpr\",Kd]].concat(Ld,[[\"typeswitchExprDefaultClause\"].concat(ya||\n[],[[\"resultExpr\",tc]])])):(b=Da,Da=d)):(b=Da,Da=d)):(b=Da,Da=d)}else b=Da,Da=d;else b=Da,Da=d;else b=Da,Da=d}else b=Da,Da=d}else b=Da,Da=d}else b=Da,Da=d}else b=Da,Da=d;z[lg]={i:b,result:Da};q=Da}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var ng=233*b+65,bf=z[ng];if(bf)b=bf.i,q=bf.result;else{var Ga=b;if(f.substr(b,2)===li){var cf=li;b+=2}else cf=d,0===w&&x(ip);if(cf!==d){F();if(40===f.charCodeAt(b)){var Ub=fb;b++}else Ub=d,0===w&&x(gb);if(Ub!==d){F();var og=pc();if(og!==d){F();if(41===f.charCodeAt(b)){var pg=\nOa;b++}else pg=d,0===w&&x(Pa);if(pg!==d){F();if(f.substr(b,4)===jp){var df=jp;b+=4}else df=d,0===w&&x(dw);if(df!==d){var Md=za();if(Md!==d){F();var pe=ta();if(pe!==d){F();if(f.substr(b,4)===kp){var qe=kp;b+=4}else qe=d,0===w&&x(ew);if(qe!==d){var mi=za();if(mi!==d){F();var ef=ta();ef!==d?(B=Ga,Ga=[\"ifThenElseExpr\",[\"ifClause\",og],[\"thenClause\",pe],[\"elseClause\",ef]]):(b=Ga,Ga=d)}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=Ga,Ga=d}else b=\nGa,Ga=d;z[ng]={i:b,result:Ga};q=Ga}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var re=233*b+214,gd=z[re];if(gd)b=gd.i,q=gd.result;else{var Ra=b;if(f.substr(b,6)===lp){var ff=lp;b+=6}else ff=d,0===w&&x(fw);if(ff!==d){var qg=P();if(qg!==d){if(f.substr(b,5)===ni){var Mc=ni;b+=5}else Mc=d,0===w&&x(mp);Mc===d&&(f.substr(b,4)===Nc?(Mc=Nc,b+=4):(Mc=d,0===w&&x(rg)));if(Mc!==d){var se=P();if(se!==d){var sg=ta();if(sg!==d){var tg=P();if(tg!==d){var Ya,ug=233*b+213,te=z[ug];if(te){b=te.i;var gf=te.result}else{var Ea=\nYa=b;if(f.substr(b,2)===db){var Ob=db;b+=2}else Ob=d,0===w&&x(rc);if(Ob!==d){var oi=P();if(oi!==d){var ec=b;if(f.substr(b,5)===np){var Pb=np;b+=5}else Pb=d,0===w&&x(gw);Pb!==d&&(B=ec,Pb=[\"insertAsFirst\"]);ec=Pb;ec===d&&(ec=b,f.substr(b,4)===op?(Pb=op,b+=4):(Pb=d,0===w&&x(hw)),Pb!==d&&(B=ec,Pb=[\"insertAsLast\"]),ec=Pb);ec!==d?(Pb=P(),Pb!==d?(B=Ea,Ea=ec):(b=Ea,Ea=d)):(b=Ea,Ea=d)}else b=Ea,Ea=d}else b=Ea,Ea=d;Ea===d&&(Ea=null);f.substr(b,4)===pp?(Ob=pp,b+=4):(Ob=d,0===w&&x(iw));Ob!==d?(B=Ya,Ya=Ea?[\"insertInto\",\nEa]:[\"insertInto\"]):(b=Ya,Ya=d);Ya===d&&(Ya=b,f.substr(b,5)===qp?(Ea=qp,b+=5):(Ea=d,0===w&&x(jw)),Ea!==d&&(B=Ya,Ea=[\"insertAfter\"]),Ya=Ea,Ya===d&&(Ya=b,f.substr(b,6)===rp?(Ea=rp,b+=6):(Ea=d,0===w&&x(kw)),Ea!==d&&(B=Ya,Ea=[\"insertBefore\"]),Ya=Ea));z[ug]={i:b,result:Ya};gf=Ya}if(gf!==d){var vg=P();if(vg!==d){var Vb=ta();Vb!==d?(B=Ra,Ra=[\"insertExpr\",[\"sourceExpr\",sg],gf,[\"targetExpr\",Vb]]):(b=Ra,Ra=d)}else b=Ra,Ra=d}else b=Ra,Ra=d}else b=Ra,Ra=d}else b=Ra,Ra=d}else b=Ra,Ra=d}else b=Ra,Ra=d}else b=Ra,\nRa=d}else b=Ra,Ra=d;z[re]={i:b,result:Ra};q=Ra}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var wg=233*b+215,nb=z[wg];if(nb)b=nb.i,q=nb.result;else{var eb=b;if(f.substr(b,6)===sp){var xg=sp;b+=6}else xg=d,0===w&&x(lw);if(xg!==d){var pi=P();if(pi!==d){if(f.substr(b,5)===ni){var hd=ni;b+=5}else hd=d,0===w&&x(mp);hd===d&&(f.substr(b,4)===Nc?(hd=Nc,b+=4):(hd=d,0===w&&x(rg)));if(hd!==d){var qi=P();if(qi!==d){var hf=ta();hf!==d?(B=eb,eb=[\"deleteExpr\",[\"targetExpr\",hf]]):(b=eb,eb=d)}else b=eb,eb=d}else b=eb,eb=\nd}else b=eb,eb=d}else b=eb,eb=d;z[wg]={i:b,result:eb};q=eb}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var yg=233*b+217,ue=z[yg];if(ue)b=ue.i,q=ue.result;else{var Ha=b;if(f.substr(b,6)===tp){var Wb=tp;b+=6}else Wb=d,0===w&&x(mw);if(Wb!==d){var ri=P();if(ri!==d){if(f.substr(b,4)===Nc){var zg=Nc;b+=4}else zg=d,0===w&&x(rg);if(zg!==d){F();var Ag=ta();if(Ag!==d){var jf=P();if(jf!==d){if(f.substr(b,2)===db){var Bg=db;b+=2}else Bg=d,0===w&&x(rc);if(Bg!==d){var Cg=P();if(Cg!==d){var Fb=ta();Fb!==d?(B=Ha,Ha=[\"renameExpr\",\n[\"targetExpr\",Ag],[\"newNameExpr\",Fb]]):(b=Ha,Ha=d)}else b=Ha,Ha=d}else b=Ha,Ha=d}else b=Ha,Ha=d}else b=Ha,Ha=d}else b=Ha,Ha=d}else b=Ha,Ha=d}else b=Ha,Ha=d;z[yg]={i:b,result:Ha};q=Ha}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var Dg=233*b+216,kf=z[Dg];if(kf)b=kf.i,q=kf.result;else{var Sa=b;if(f.substr(b,7)===up){var lf=up;b+=7}else lf=d,0===w&&x(nw);if(lf!==d){var si=P();if(si!==d){var Ta=b;if(f.substr(b,5)===vp){var Xb=vp;b+=5}else Xb=d,0===w&&x(ow);if(Xb!==d){var mf=P();if(mf!==d){if(f.substr(b,2)===\nti){var Oc=ti;b+=2}else Oc=d,0===w&&x(wp);if(Oc!==d){var ve=P();ve!==d?Ta=Xb=[Xb,mf,Oc,ve]:(b=Ta,Ta=d)}else b=Ta,Ta=d}else b=Ta,Ta=d}else b=Ta,Ta=d;Ta===d&&(Ta=null);f.substr(b,4)===Nc?(Xb=Nc,b+=4):(Xb=d,0===w&&x(rg));if(Xb!==d)if(mf=P(),mf!==d)if(Oc=ta(),Oc!==d)if(ve=P(),ve!==d){if(f.substr(b,4)===xp){var nf=xp;b+=4}else nf=d,0===w&&x(pw);if(nf!==d){var fc=P();if(fc!==d){var of=ta();of!==d?(B=Sa,Sa=Ta?[\"replaceExpr\",[\"replaceValue\"],[\"targetExpr\",Oc],[\"replacementExpr\",of]]:[\"replaceExpr\",[\"targetExpr\",\nOc],[\"replacementExpr\",of]]):(b=Sa,Sa=d)}else b=Sa,Sa=d}else b=Sa,Sa=d}else b=Sa,Sa=d;else b=Sa,Sa=d;else b=Sa,Sa=d;else b=Sa,Sa=d}else b=Sa,Sa=d}else b=Sa,Sa=d;z[Dg]={i:b,result:Sa};q=Sa}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var Eg=233*b+218,gc=z[Eg];if(gc)b=gc.i,q=gc.result;else{var Ia=b;if(f.substr(b,4)===yp){var Nd=yp;b+=4}else Nd=d,0===w&&x(qw);if(Nd!==d){var tb=P();if(tb!==d){var Od=Nk();if(Od!==d){var Pd=[];var jb=b;var Qd=F();if(44===f.charCodeAt(b)){var yb=ua;b++}else yb=d,0===w&&x(va);\nif(yb!==d){var we=F();var uc=Nk();uc!==d?(B=jb,jb=uc):(b=jb,jb=d)}else b=jb,jb=d;for(;jb!==d;)Pd.push(jb),jb=b,Qd=F(),44===f.charCodeAt(b)?(yb=ua,b++):(yb=d,0===w&&x(va)),yb!==d?(we=F(),uc=Nk(),uc!==d?(B=jb,jb=uc):(b=jb,jb=d)):(b=jb,jb=d);jb=F();f.substr(b,6)===zp?(Qd=zp,b+=6):(Qd=d,0===w&&x(rw));if(Qd!==d)if(yb=P(),yb!==d)if(we=ta(),we!==d)if(uc=P(),uc!==d){if(f.substr(b,6)===Jd){var Qb=Jd;b+=6}else Qb=d,0===w&&x(ii);if(Qb!==d){var Pc=P();if(Pc!==d){var Fg=ta();Fg!==d?(B=Ia,Ia=[\"transformExpr\",[\"transformCopies\",\nOd].concat(Pd),[\"modifyExpr\",we],[\"returnExpr\",Fg]]):(b=Ia,Ia=d)}else b=Ia,Ia=d}else b=Ia,Ia=d}else b=Ia,Ia=d;else b=Ia,Ia=d;else b=Ia,Ia=d;else b=Ia,Ia=d}else b=Ia,Ia=d}else b=Ia,Ia=d}else b=Ia,Ia=d;z[Eg]={i:b,result:Ia};q=Ia}q!==d&&(B=k,q=$b(q));k=q;if(k===d){k=b;var Qc=233*b+66,pf=z[Qc];if(pf)b=pf.i,q=pf.result;else{var id=b;var ob=Ok();if(ob!==d){var Rd=[];var Ua=b;F();if(f.substr(b,2)===ui){var Sd=ui;b+=2}else Sd=d,0===w&&x(Ap);if(Sd!==d){var qf=za();if(qf!==d){F();var jd=Ok();jd!==d?(B=Ua,Ua=\njd):(b=Ua,Ua=d)}else b=Ua,Ua=d}else b=Ua,Ua=d;for(;Ua!==d;)Rd.push(Ua),Ua=b,F(),f.substr(b,2)===ui?(Sd=ui,b+=2):(Sd=d,0===w&&x(Ap)),Sd!==d?(qf=za(),qf!==d?(F(),jd=Ok(),jd!==d?(B=Ua,Ua=jd):(b=Ua,Ua=d)):(b=Ua,Ua=d)):(b=Ua,Ua=d);B=id;id=vi(\"orOp\",ob,Rd)}else b=id,id=d;z[Qc]={i:b,result:id};q=id}q!==d&&(B=k,q=$b(q));k=q}}}}}}}}}z[h]={i:b,result:k};return k}function bp(){var h,u=233*b+40;if(h=z[u])return b=h.i,h.result;var k;h=233*b+42;if(k=z[h])b=k.i,h=k.result;else{k=b;if(f.substr(b,3)===Bp){var l=Bp;\nb+=3}else l=d,0===w&&x(sw);if(l!==d)if(l=P(),l!==d)if(l=Pk(),l!==d){var n=[];var q=b;F();if(44===f.charCodeAt(b)){var r=ua;b++}else r=d,0===w&&x(va);r!==d?(F(),r=Pk(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d);for(;q!==d;)n.push(q),q=b,F(),44===f.charCodeAt(b)?(r=ua,b++):(r=d,0===w&&x(va)),r!==d?(F(),r=Pk(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d);B=k;k=[\"forClause\",l].concat(n)}else b=k,k=d;else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}if(h===d)if(h=233*b+46,k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,\n3)===Cp?(l=Cp,b+=3):(l=d,0===w&&x(tw));if(l!==d)if(F(),l=Qk(),l!==d){F();n=[];q=b;44===f.charCodeAt(b)?(r=ua,b++):(r=d,0===w&&x(va));r!==d?(F(),r=Qk(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d);for(;q!==d;)n.push(q),q=b,44===f.charCodeAt(b)?(r=ua,b++):(r=d,0===w&&x(va)),r!==d?(F(),r=Qk(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d);B=k;k=[\"letClause\",l].concat(n)}else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}z[u]={i:b,result:h};return h}function cp(){var h,u=233*b+41;if(h=z[u])return b=h.i,h.result;h=bp();\nif(h===d){var k;h=233*b+48;if(k=z[h])b=k.i,h=k.result;else{k=b;if(f.substr(b,5)===Dp){var l=Dp;b+=5}else l=d,0===w&&x(uw);l!==d?(l=za(),l!==d?(F(),l=ta(),l!==d?(B=k,k=[\"whereClause\",l]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d);z[h]={i:b,result:k};h=k}if(h===d){h=233*b+49;if(k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,5)===Ep?(l=Ep,b+=5):(l=d,0===w&&x(vw));if(l!==d)if(l=P(),l!==d)if(f.substr(b,2)===rf?(l=rf,b+=2):(l=d,0===w&&x(Rk)),l!==d){F();var n;l=233*b+50;if(n=z[l])b=n.i,l=n.result;else{n=b;var q=Sk();\nif(q!==d){var r=[];var y=b;F();if(44===f.charCodeAt(b)){var C=ua;b++}else C=d,0===w&&x(va);C!==d?(F(),C=Sk(),C!==d?(B=y,y=C):(b=y,y=d)):(b=y,y=d);for(;y!==d;)r.push(y),y=b,F(),44===f.charCodeAt(b)?(C=ua,b++):(C=d,0===w&&x(va)),C!==d?(F(),C=Sk(),C!==d?(B=y,y=C):(b=y,y=d)):(b=y,y=d);B=n;n=[q].concat(r)}else b=n,n=d;z[l]={i:b,result:n};l=n}l!==d?(B=k,k=[\"groupByClause\"].concat(l)):(b=k,k=d)}else b=k,k=d;else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};h=k}if(h===d)if(h=233*b+54,k=z[h])b=k.i,h=k.result;\nelse{l=k=b;f.substr(b,5)===Re?(n=Re,b+=5):(n=d,0===w&&x(Gk));n!==d?(n=P(),n!==d?(f.substr(b,2)===rf?(n=rf,b+=2):(n=d,0===w&&x(Rk)),n!==d?(B=l,l=!1):(b=l,l=d)):(b=l,l=d)):(b=l,l=d);l===d&&(l=b,f.substr(b,6)===Fp?(n=Fp,b+=6):(n=d,0===w&&x(ww)),n!==d?(n=P(),n!==d?(f.substr(b,5)===Re?(n=Re,b+=5):(n=d,0===w&&x(Gk)),n!==d?(n=P(),n!==d?(f.substr(b,2)===rf?(n=rf,b+=2):(n=d,0===w&&x(Rk)),n!==d?(B=l,l=!0):(b=l,l=d)):(b=l,l=d)):(b=l,l=d)):(b=l,l=d)):(b=l,l=d));if(l!==d){F();n=233*b+55;if(q=z[n])b=q.i,n=q.result;\nelse{q=b;r=Tk();if(r!==d){y=[];C=b;F();if(44===f.charCodeAt(b)){var J=ua;b++}else J=d,0===w&&x(va);J!==d?(F(),J=Tk(),J!==d?(B=C,C=J):(b=C,C=d)):(b=C,C=d);for(;C!==d;)y.push(C),C=b,F(),44===f.charCodeAt(b)?(J=ua,b++):(J=d,0===w&&x(va)),J!==d?(F(),J=Tk(),J!==d?(B=C,C=J):(b=C,C=d)):(b=C,C=d);B=q;q=[r].concat(y)}else b=q,q=d;z[n]={i:b,result:q};n=q}n!==d?(B=k,k=[\"orderByClause\"].concat(l?[[\"stable\"]]:[],n)):(b=k,k=d)}else b=k,k=d;z[h]={i:b,result:k};h=k}}}z[u]={i:b,result:h};return h}function Pk(){var h,\nu,k=233*b+43;if(h=z[k])return b=h.i,h.result;h=b;if(36===f.charCodeAt(b)){var l=Jc;b++}else l=d,0===w&&x(Kc);if(l!==d)if(l=Aa(),l!==d){F();var n=We();n===d&&(n=null);F();var q=233*b+44;if(u=z[q])b=u.i,q=u.result;else{u=b;if(f.substr(b,8)===Gp){var r=Gp;b+=8}else r=d,0===w&&x(xw);if(r!==d){var y=P();if(y!==d){if(f.substr(b,5)===Se){var C=Se;b+=5}else C=d,0===w&&x(Hk);C!==d?u=r=[r,y,C]:(b=u,u=d)}else b=u,u=d}else b=u,u=d;z[q]={i:b,result:u};q=u}q===d&&(q=null);F();u=233*b+45;(r=z[u])?(b=r.i,u=r.result):\n(r=b,f.substr(b,2)===Te?(y=Te,b+=2):(y=d,0===w&&x(Ik)),y!==d?(y=P(),y!==d?(36===f.charCodeAt(b)?(y=Jc,b++):(y=d,0===w&&x(Kc)),y!==d?(y=Aa(),y!==d?(B=r,r=[\"positionalVariableBinding\"].concat(y)):(b=r,r=d)):(b=r,r=d)):(b=r,r=d)):(b=r,r=d),z[u]={i:b,result:r},u=r);u===d&&(u=null);F();f.substr(b,2)===wi?(r=wi,b+=2):(r=d,0===w&&x(Hp));r!==d?(F(),r=ta(),r!==d?(B=h,h=[\"forClauseItem\",[\"typedVariableBinding\",[\"varName\"].concat(l,n?[n]:[])]].concat(q?[[\"allowingEmpty\"]]:[],u?[u]:[],[[\"forExpr\",r]])):(b=h,\nh=d)):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[k]={i:b,result:h};return h}function Qk(){var h,u=233*b+47;if(h=z[u])return b=h.i,h.result;h=b;if(36===f.charCodeAt(b)){var k=Jc;b++}else k=d,0===w&&x(Kc);if(k!==d)if(k=Aa(),k!==d){F();var l=We();l===d&&(l=null);F();if(f.substr(b,2)===Mb){var n=Mb;b+=2}else n=d,0===w&&x(ie);n!==d?(F(),n=ta(),n!==d?(B=h,h=[\"letClauseItem\",[\"typedVariableBinding\",[\"varName\"].concat(k)].concat(l?[l]:[]),[\"letExpr\",n]]):(b=h,h=d)):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[u]={i:b,\nresult:h};return h}function Sk(){var h,u,k=233*b+51;if(h=z[k])return b=h.i,h.result;h=b;var l=233*b+53;if(u=z[l])b=u.i,l=u.result;else{u=b;if(36===f.charCodeAt(b)){var n=Jc;b++}else n=d,0===w&&x(Kc);n!==d?(n=Aa(),n!==d?(B=u,u=[\"varName\"].concat(n)):(b=u,u=d)):(b=u,u=d);z[l]={i:b,result:u};l=u}if(l!==d){u=233*b+52;if(n=z[u])b=n.i,u=n.result;else{n=b;F();var q=We();q===d&&(q=null);F();if(f.substr(b,2)===Mb){var r=Mb;b+=2}else r=d,0===w&&x(ie);r!==d?(F(),r=ta(),r!==d?(B=n,n=[\"groupVarInitialize\"].concat(q?\n[[\"typeDeclaration\"].concat(q)]:[],[[\"varValue\",r]])):(b=n,n=d)):(b=n,n=d);z[u]={i:b,result:n};u=n}u===d&&(u=null);n=b;F();f.substr(b,9)===Qe?(q=Qe,b+=9):(q=d,0===w&&x(Fk));q!==d?(F(),q=bb(),q!==d?(B=n,n=[\"collation\",q]):(b=n,n=d)):(b=n,n=d);n===d&&(n=null);B=h;h=[\"groupingSpec\",l].concat(u?[u]:[],n?[n]:[])}else b=h,h=d;z[k]={i:b,result:h};return h}function Tk(){var h,u=233*b+56;if(h=z[u])return b=h.i,h.result;h=b;var k=ta();if(k!==d){F();var l;var n=233*b+57;if(l=z[n])b=l.i,n=l.result;else{l=b;if(f.substr(b,\n9)===Ip){var q=Ip;b+=9}else q=d,0===w&&x(yw);q===d&&(f.substr(b,10)===Jp?(q=Jp,b+=10):(q=d,0===w&&x(zw)));q===d&&(q=null);F();var r=b;if(f.substr(b,5)===Se){var y=Se;b+=5}else y=d,0===w&&x(Hk);if(y!==d){F();var C=b;if(f.substr(b,8)===ci){var J=ci;b+=8}else J=d,0===w&&x(zo);J!==d&&(B=C,J=\"empty greatest\");C=J;C===d&&(C=b,f.substr(b,5)===di?(J=di,b+=5):(J=d,0===w&&x(Ao)),J!==d&&(B=C,J=\"empty least\"),C=J);C!==d?(B=r,r=C):(b=r,r=d)}else b=r,r=d;r===d&&(r=null);F();y=b;f.substr(b,9)===Qe?(C=Qe,b+=9):(C=\nd,0===w&&x(Fk));if(C!==d){J=F();var N=bb();N!==d?y=C=[C,J,N]:(b=y,y=d)}else b=y,y=d;y===d&&(y=null);B=l;l=q||r||y?[\"orderModifier\"].concat(q?[[\"orderingKind\",q]]:[],r?[[\"emptyOrderingMode\",r]]:[],y?[[\"collation\",y]]:[]):null;z[n]={i:b,result:l};n=l}B=h;h=[\"orderBySpec\",[\"orderByExpr\",k]].concat(n?[n]:[])}else b=h,h=d;z[u]={i:b,result:h};return h}function Mk(){var h,u=233*b+61;if(h=z[u])return b=h.i,h.result;h=b;if(36===f.charCodeAt(b)){var k=Jc;b++}else k=d,0===w&&x(Kc);if(k!==d)if(k=Aa(),k!==d){var l=\nb;var n=P();n!==d?(n=We(),n!==d?(B=l,l=n):(b=l,l=d)):(b=l,l=d);l===d&&(l=null);n=P();n!==d?(f.substr(b,2)===wi?(n=wi,b+=2):(n=d,0===w&&x(Hp)),n!==d?(n=P(),n!==d?(n=ta(),n!==d?(B=h,h=[\"quantifiedExprInClause\",[\"typedVariableBinding\",[\"varName\"].concat(k)].concat(l?[l]:[]),[\"sourceExpr\",n]]):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function hp(){var h,u=233*b+63;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,4)===Kp){var k=Kp;b+=4}else k=d,\n0===w&&x(Aw);if(k!==d){F();k=b;if(36===f.charCodeAt(b)){var l=Jc;b++}else l=d,0===w&&x(Kc);if(l!==d)if(l=Aa(),l!==d){var n=P();n!==d?(f.substr(b,2)===db?(n=db,b+=2):(n=d,0===w&&x(rc)),n!==d?(B=k,k=l):(b=k,k=d)):(b=k,k=d)}else b=k,k=d;else b=k,k=d;k===d&&(k=null);F();l=233*b+64;if(n=z[l])b=n.i,l=n.result;else{n=b;var q=Nb();if(q!==d){var r=[];var y=b;F();if(124===f.charCodeAt(b)){var C=xi;b++}else C=d,0===w&&x(yi);C!==d?(F(),C=Nb(),C!==d?(B=y,y=C):(b=y,y=d)):(b=y,y=d);for(;y!==d;)r.push(y),y=b,F(),\n124===f.charCodeAt(b)?(C=xi,b++):(C=d,0===w&&x(yi)),C!==d?(F(),C=Nb(),C!==d?(B=y,y=C):(b=y,y=d)):(b=y,y=d);B=n;n=O(q,r)}else b=n,n=d;z[l]={i:b,result:n};l=n}l!==d?(n=P(),n!==d?(f.substr(b,6)===Jd?(n=Jd,b+=6):(n=d,0===w&&x(ii)),n!==d?(n=P(),n!==d?(n=ta(),n!==d?(B=h,h=[\"typeswitchExprCaseClause\"].concat(k?[[\"variableBinding\"].concat(k)]:[],l,[[\"resultExpr\",n]])):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)}else b=h,h=d;z[u]={i:b,result:h};return h}function Ok(){var h,u=233*b+67;if(h=z[u])return b=\nh.i,h.result;h=b;var k=Uk();if(k!==d){var l=[];var n=b;F();if(f.substr(b,3)===zi){var q=zi;b+=3}else q=d,0===w&&x(Lp);q!==d?(q=za(),q!==d?(F(),q=Uk(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),f.substr(b,3)===zi?(q=zi,b+=3):(q=d,0===w&&x(Lp)),q!==d?(q=za(),q!==d?(F(),q=Uk(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d)):(b=n,n=d);B=h;h=vi(\"andOp\",k,l)}else b=h,h=d;z[u]={i:b,result:h};return h}function Uk(){var h,u,k=233*b+68;if(h=z[k])return b=h.i,h.result;h=b;var l=Mp();\nif(l!==d){var n=b;F();var q=233*b+83;if(u=z[q])b=u.i,q=u.result;else{u=b;if(f.substr(b,2)===Np){var r=Np;b+=2}else r=d,0===w&&x(Bw);r!==d?(r=za(),r!==d?(B=u,u=\"eqOp\"):(b=u,u=d)):(b=u,u=d);u===d&&(u=b,f.substr(b,2)===Op?(r=Op,b+=2):(r=d,0===w&&x(Cw)),r!==d?(r=za(),r!==d?(B=u,u=\"neOp\"):(b=u,u=d)):(b=u,u=d),u===d&&(u=b,f.substr(b,2)===Ai?(r=Ai,b+=2):(r=d,0===w&&x(Pp)),r!==d?(r=za(),r!==d?(B=u,u=\"ltOp\"):(b=u,u=d)):(b=u,u=d),u===d&&(u=b,f.substr(b,2)===Qp?(r=Qp,b+=2):(r=d,0===w&&x(Dw)),r!==d?(r=za(),r!==\nd?(B=u,u=\"leOp\"):(b=u,u=d)):(b=u,u=d),u===d&&(u=b,f.substr(b,2)===Bi?(r=Bi,b+=2):(r=d,0===w&&x(Rp)),r!==d?(r=za(),r!==d?(B=u,u=\"gtOp\"):(b=u,u=d)):(b=u,u=d),u===d&&(u=b,f.substr(b,2)===Sp?(r=Sp,b+=2):(r=d,0===w&&x(Ew)),r!==d?(r=za(),r!==d?(B=u,u=\"geOp\"):(b=u,u=d)):(b=u,u=d))))));z[q]={i:b,result:u};q=u}q===d&&(q=233*b+84,(u=z[q])?(b=u.i,q=u.result):(u=b,f.substr(b,2)===Tp?(r=Tp,b+=2):(r=d,0===w&&x(Fw)),r!==d?(r=za(),r!==d?(B=u,u=\"isOp\"):(b=u,u=d)):(b=u,u=d),u===d&&(u=b,f.substr(b,2)===Up?(r=Up,b+=\n2):(r=d,0===w&&x(Gw)),r!==d&&(B=u,r=\"nodeBeforeOp\"),u=r,u===d&&(u=b,f.substr(b,2)===Vp?(r=Vp,b+=2):(r=d,0===w&&x(Hw)),r!==d&&(B=u,r=\"nodeAfterOp\"),u=r)),z[q]={i:b,result:u},q=u),q===d&&(q=233*b+82,(u=z[q])?(b=u.i,q=u.result):(u=b,61===f.charCodeAt(b)?(r=Cd,b++):(r=d,0===w&&x(Dd)),r!==d&&(B=u,r=\"equalOp\"),u=r,u===d&&(u=b,f.substr(b,2)===Wp?(r=Wp,b+=2):(r=d,0===w&&x(Iw)),r!==d&&(B=u,r=\"notEqualOp\"),u=r,u===d&&(u=b,f.substr(b,2)===Xp?(r=Xp,b+=2):(r=d,0===w&&x(Jw)),r!==d&&(B=u,r=\"lessThanOrEqualOp\"),\nu=r,u===d&&(u=b,60===f.charCodeAt(b)?(r=Yp,b++):(r=d,0===w&&x(Zp)),r!==d&&(B=u,r=\"lessThanOp\"),u=r,u===d&&(u=b,f.substr(b,2)===$p?(r=$p,b+=2):(r=d,0===w&&x(Kw)),r!==d&&(B=u,r=\"greaterThanOrEqualOp\"),u=r,u===d&&(u=b,62===f.charCodeAt(b)?(r=Vk,b++):(r=d,0===w&&x(Wk)),r!==d&&(B=u,r=\"greaterThanOp\"),u=r))))),z[q]={i:b,result:u},q=u)));q!==d?(F(),u=Mp(),u!==d?(B=n,n=[q,u]):(b=n,n=d)):(b=n,n=d);n===d&&(n=null);B=h;h=n?[n[0],[\"firstOperand\",l],[\"secondOperand\",n[1]]]:l}else b=h,h=d;z[k]={i:b,result:h};return h}\nfunction Mp(){var h,u=233*b+69;if(h=z[u])return b=h.i,h.result;h=b;var k=Xk();if(k!==d){var l=[];var n=b;F();if(f.substr(b,2)===Ci){var q=Ci;b+=2}else q=d,0===w&&x(aq);q!==d?(F(),q=Xk(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),f.substr(b,2)===Ci?(q=Ci,b+=2):(q=d,0===w&&x(aq)),q!==d?(F(),q=Xk(),q!==d?(B=n,n=q):(b=n,n=d)):(b=n,n=d);B=h;h=vi(\"stringConcatenateOp\",k,l)}else b=h,h=d;z[u]={i:b,result:h};return h}function Xk(){var h,u=233*b+70;if(h=z[u])return b=h.i,h.result;h=\nb;var k=bq();if(k!==d){var l=b;F();if(f.substr(b,2)===cq){var n=cq;b+=2}else n=d,0===w&&x(Lw);n!==d?(n=za(),n!==d?(F(),n=bq(),n!==d?(B=l,l=n):(b=l,l=d)):(b=l,l=d)):(b=l,l=d);l===d&&(l=null);B=h;h=null===l?k:[\"rangeSequenceExpr\",[\"startExpr\",k],[\"endExpr\",l]]}else b=h,h=d;z[u]={i:b,result:h};return h}function bq(){var h,u=233*b+71;if(h=z[u])return b=h.i,h.result;h=b;var k=Yk();if(k!==d){var l=[];var n=b;F();var q=b;if(45===f.charCodeAt(b)){var r=kd;b++}else r=d,0===w&&x(ld);r!==d&&(B=q,r=\"subtractOp\");\nq=r;q===d&&(q=b,43===f.charCodeAt(b)?(r=Di,b++):(r=d,0===w&&x(Ei)),r!==d&&(B=q,r=\"addOp\"),q=r);q!==d?(F(),r=Yk(),r!==d?(B=n,n=[q,r]):(b=n,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),q=b,45===f.charCodeAt(b)?(r=kd,b++):(r=d,0===w&&x(ld)),r!==d&&(B=q,r=\"subtractOp\"),q=r,q===d&&(q=b,43===f.charCodeAt(b)?(r=Di,b++):(r=d,0===w&&x(Ei)),r!==d&&(B=q,r=\"addOp\"),q=r),q!==d?(F(),r=Yk(),r!==d?(B=n,n=[q,r]):(b=n,n=d)):(b=n,n=d);B=h;h=M(k,l)}else b=h,h=d;z[u]={i:b,result:h};return h}function Yk(){var h,u=233*\nb+72;if(h=z[u])return b=h.i,h.result;h=b;var k=Zk();if(k!==d){var l=[];var n=b;F();var q=b;if(42===f.charCodeAt(b)){var r=vc;b++}else r=d,0===w&&x(wc);r!==d&&(B=q,r=\"multiplyOp\");q=r;q===d&&(q=b,f.substr(b,3)===Fi?(r=Fi,b+=3):(r=d,0===w&&x(dq)),r!==d?(r=za(),r!==d?(B=q,q=\"divOp\"):(b=q,q=d)):(b=q,q=d),q===d&&(q=b,f.substr(b,4)===Gi?(r=Gi,b+=4):(r=d,0===w&&x(eq)),r!==d?(r=za(),r!==d?(B=q,q=\"idivOp\"):(b=q,q=d)):(b=q,q=d),q===d&&(q=b,f.substr(b,3)===Hi?(r=Hi,b+=3):(r=d,0===w&&x(fq)),r!==d?(r=za(),r!==\nd?(B=q,q=\"modOp\"):(b=q,q=d)):(b=q,q=d))));q!==d?(F(),r=Zk(),r!==d?(B=n,n=[q,r]):(b=n,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),q=b,42===f.charCodeAt(b)?(r=vc,b++):(r=d,0===w&&x(wc)),r!==d&&(B=q,r=\"multiplyOp\"),q=r,q===d&&(q=b,f.substr(b,3)===Fi?(r=Fi,b+=3):(r=d,0===w&&x(dq)),r!==d?(r=za(),r!==d?(B=q,q=\"divOp\"):(b=q,q=d)):(b=q,q=d),q===d&&(q=b,f.substr(b,4)===Gi?(r=Gi,b+=4):(r=d,0===w&&x(eq)),r!==d?(r=za(),r!==d?(B=q,q=\"idivOp\"):(b=q,q=d)):(b=q,q=d),q===d&&(q=b,f.substr(b,3)===Hi?(r=Hi,b+=3):(r=\nd,0===w&&x(fq)),r!==d?(r=za(),r!==d?(B=q,q=\"modOp\"):(b=q,q=d)):(b=q,q=d)))),q!==d?(F(),r=Zk(),r!==d?(B=n,n=[q,r]):(b=n,n=d)):(b=n,n=d);B=h;h=I(k,l)}else b=h,h=d;z[u]={i:b,result:h};return h}function Zk(){var h,u=233*b+73;if(h=z[u])return b=h.i,h.result;h=b;var k=Gg();if(k!==d){var l=[];var n=b;F();if(124===f.charCodeAt(b)){var q=xi;b++}else q=d,0===w&&x(yi);if(q===d){q=b;if(f.substr(b,5)===Ii){var r=Ii;b+=5}else r=d,0===w&&x(gq);if(r!==d){var y=za();y!==d?q=r=[r,y]:(b=q,q=d)}else b=q,q=d}q!==d?(F(),\ny=Gg(),y!==d?(B=n,n=y):(b=n,n=d)):(b=n,n=d);for(;n!==d;)l.push(n),n=b,F(),124===f.charCodeAt(b)?(q=xi,b++):(q=d,0===w&&x(yi)),q===d&&(q=b,f.substr(b,5)===Ii?(r=Ii,b+=5):(r=d,0===w&&x(gq)),r!==d?(y=za(),y!==d?q=r=[r,y]:(b=q,q=d)):(b=q,q=d)),q!==d?(F(),y=Gg(),y!==d?(B=n,n=y):(b=n,n=d)):(b=n,n=d);B=h;h=vi(\"unionOp\",k,l)}else b=h,h=d;z[u]={i:b,result:h};return h}function Gg(){var h,u,k=233*b+74;if(h=z[k])return b=h.i,h.result;h=b;var l=233*b+75;if(u=z[l])b=u.i,l=u.result;else{u=b;var n=hq();if(n!==d){var q=\nb;F();if(f.substr(b,8)===iq){var r=iq;b+=8}else r=d,0===w&&x(Mw);r!==d?(r=P(),r!==d?(f.substr(b,2)===ti?(r=ti,b+=2):(r=d,0===w&&x(wp)),r!==d?(r=za(),r!==d?(F(),r=Nb(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d);q===d&&(q=null);B=u;u=q?[\"instanceOfExpr\",[\"argExpr\",n],[\"sequenceType\"].concat(q)]:n}else b=u,u=d;u===d&&(u=hq());z[l]={i:b,result:u};l=u}if(l!==d){u=[];n=b;F();q=b;f.substr(b,9)===Ji?(r=Ji,b+=9):(r=d,0===w&&x(jq));r!==d&&(B=q,r=\"intersectOp\");q=r;q===d&&(q=b,f.substr(b,\n6)===Ki?(r=Ki,b+=6):(r=d,0===w&&x(kq)),r!==d&&(B=q,r=\"exceptOp\"),q=r);q!==d?(r=za(),r!==d?(F(),r=Gg(),r!==d?(B=n,n=[q,r]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d);for(;n!==d;)u.push(n),n=b,F(),q=b,f.substr(b,9)===Ji?(r=Ji,b+=9):(r=d,0===w&&x(jq)),r!==d&&(B=q,r=\"intersectOp\"),q=r,q===d&&(q=b,f.substr(b,6)===Ki?(r=Ki,b+=6):(r=d,0===w&&x(kq)),r!==d&&(B=q,r=\"exceptOp\"),q=r),q!==d?(r=za(),r!==d?(F(),r=Gg(),r!==d?(B=n,n=[q,r]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d);B=h;h=E(l,u)}else b=h,h=d;z[k]={i:b,result:h};return h}\nfunction hq(){var h,u,k=233*b+76;if(h=z[k])return b=h.i,h.result;h=b;var l;var n=233*b+77;if(u=z[n])b=u.i,n=u.result;else{u=b;var q;var r=233*b+78;if(l=z[r])b=l.i,r=l.result;else{l=b;var y=233*b+79;if(q=z[y])b=q.i,y=q.result;else{q=b;var C=$k();if(C!==d){var J=[];var N=b;F();if(f.substr(b,2)===Li){var oa=Li;b+=2}else oa=d,0===w&&x(lq);if(oa!==d)if(F(),oa=mq(),oa!==d){F();var wb=sf();wb!==d?(B=N,N=[oa,wb]):(b=N,N=d)}else b=N,N=d;else b=N,N=d;for(;N!==d;)J.push(N),N=b,F(),f.substr(b,2)===Li?(oa=Li,\nb+=2):(oa=d,0===w&&x(lq)),oa!==d?(F(),oa=mq(),oa!==d?(F(),wb=sf(),wb!==d?(B=N,N=[oa,wb]):(b=N,N=d)):(b=N,N=d)):(b=N,N=d);B=q;q=A(C,J)}else b=q,q=d;z[y]={i:b,result:q};y=q}y!==d?(q=b,F(),f.substr(b,4)===nq?(C=nq,b+=4):(C=d,0===w&&x(Nw)),C!==d?(C=P(),C!==d?(f.substr(b,2)===db?(C=db,b+=2):(C=d,0===w&&x(rc)),C!==d?(C=za(),C!==d?(F(),C=oq(),C!==d?(B=q,q=C):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d),q===d&&(q=null),B=l,l=q?[\"castExpr\",[\"argExpr\",y],q]:y):(b=l,l=d);z[r]={i:b,result:l};r=l}r!==\nd?(l=b,F(),f.substr(b,8)===pq?(y=pq,b+=8):(y=d,0===w&&x(Ow)),y!==d?(y=P(),y!==d?(f.substr(b,2)===db?(y=db,b+=2):(y=d,0===w&&x(rc)),y!==d?(y=za(),y!==d?(F(),y=oq(),y!==d?(B=l,l=y):(b=l,l=d)):(b=l,l=d)):(b=l,l=d)):(b=l,l=d)):(b=l,l=d),l===d&&(l=null),B=u,u=l?[\"castableExpr\",[\"argExpr\",r],l]:r):(b=u,u=d);z[n]={i:b,result:u};n=u}n!==d?(u=b,F(),f.substr(b,5)===qq?(r=qq,b+=5):(r=d,0===w&&x(Pw)),r!==d?(r=P(),r!==d?(f.substr(b,2)===db?(r=db,b+=2):(r=d,0===w&&x(rc)),r!==d?(r=za(),r!==d?(F(),r=Nb(),r!==d?(B=\nu,u=r):(b=u,u=d)):(b=u,u=d)):(b=u,u=d)):(b=u,u=d)):(b=u,u=d),u===d&&(u=null),B=h,h=u?[\"treatExpr\",[\"argExpr\",n],[\"sequenceType\"].concat(u)]:n):(b=h,h=d);z[k]={i:b,result:h};return h}function $k(){var h,u=233*b+80;if(h=z[u])return b=h.i,h.result;h=b;if(45===f.charCodeAt(b)){var k=kd;b++}else k=d,0===w&&x(ld);k!==d?(F(),k=$k(),k!==d?(B=h,h=[\"unaryMinusOp\",[\"operand\",k]]):(b=h,h=d)):(b=h,h=d);if(h===d&&(h=b,43===f.charCodeAt(b)?(k=Di,b++):(k=d,0===w&&x(Ei)),k!==d?(F(),k=$k(),k!==d?(B=h,h=[\"unaryPlusOp\",\n[\"operand\",k]]):(b=h,h=d)):(b=h,h=d),h===d))if(h=233*b+81,k=z[h])b=k.i,h=k.result;else{var l,n;k=233*b+85;if(l=z[k])b=l.i,k=l.result;else{l=b;if(f.substr(b,8)===rq){var q=rq;b+=8}else q=d,0===w&&x(Qw);if(q!==d){q=b;F();var r=233*b+86;(n=z[r])?(b=n.i,r=n.result):(f.substr(b,3)===sq?(n=sq,b+=3):(n=d,0===w&&x(Rw)),n===d&&(f.substr(b,6)===tq?(n=tq,b+=6):(n=d,0===w&&x(Sw))),z[r]={i:b,result:n},r=n);r!==d?(B=q,q=[\"validationMode\",r]):(b=q,q=d);q===d&&(q=b,F(),f.substr(b,4)===uq?(r=uq,b+=4):(r=d,0===w&&\nx(Tw)),r!==d?(F(),r=Aa(),r!==d?(B=q,q=[\"type\"].concat(r)):(b=q,q=d)):(b=q,q=d));q===d&&(q=null);F();123===f.charCodeAt(b)?(r=Fd,b++):(r=d,0===w&&x(Gd));r!==d?(F(),r=pc(),r!==d?(F(),125===f.charCodeAt(b)?(n=Hd,b++):(n=d,0===w&&x(Id)),n!==d?(B=l,l=[\"validateExpr\"].concat(q?[q]:[],[[\"argExpr\",r]])):(b=l,l=d)):(b=l,l=d)):(b=l,l=d)}else b=l,l=d;z[k]={i:b,result:l};k=l}if(k===d){k=233*b+87;if(l=z[k])b=l.i,k=l.result;else{l=b;q=[];r=vq();if(r!==d)for(;r!==d;)q.push(r),r=vq();else q=d;q!==d?(F(),123===f.charCodeAt(b)?\n(r=Fd,b++):(r=d,0===w&&x(Gd)),r!==d?(F(),pc(),F(),125===f.charCodeAt(b)?(r=Hd,b++):(r=d,0===w&&x(Id)),r!==d?(B=l,l=[\"extensionExpr\"].concat(q)):(b=l,l=d)):(b=l,l=d)):(b=l,l=d);z[k]={i:b,result:l};k=l}if(k===d)if(k=233*b+90,l=z[k])b=l.i,k=l.result;else{l=b;q=al();if(q!==d){r=[];n=b;F();if(33===f.charCodeAt(b)){var y=wq;b++}else y=d,0===w&&x(xq);y!==d?(F(),y=al(),y!==d?(B=n,n=y):(b=n,n=d)):(b=n,n=d);for(;n!==d;)r.push(n),n=b,F(),33===f.charCodeAt(b)?(y=wq,b++):(y=d,0===w&&x(xq)),y!==d?(F(),y=al(),y!==\nd?(B=n,n=y):(b=n,n=d)):(b=n,n=d);B=l;l=v(q,r)}else b=l,l=d;z[k]={i:b,result:l};k=l}}z[h]={i:b,result:k};h=k}z[u]={i:b,result:h};return h}function vq(){var h,u=233*b+88;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,2)===yq){var k=yq;b+=2}else k=d,0===w&&x(Uw);if(k!==d)if(P(),k=Aa(),k!==d){var l=b;var n=P();if(n!==d){var q;n=233*b+89;if(q=z[n])b=q.i,n=q.result;else{q=b;var r=[];var y=b;var C=Rb();if(C!==d){var J=b;w++;if(f.substr(b,2)===tf){var N=tf;b+=2}else N=d,0===w&&x(bl);w--;N===d?J=void 0:\n(b=J,J=d);J!==d?(B=y,y=C):(b=y,y=d)}else b=y,y=d;for(;y!==d;)r.push(y),y=b,C=Rb(),C!==d?(J=b,w++,f.substr(b,2)===tf?(N=tf,b+=2):(N=d,0===w&&x(bl)),w--,N===d?J=void 0:(b=J,J=d),J!==d?(B=y,y=C):(b=y,y=d)):(b=y,y=d);B=q;q=r=r.join(\"\");z[n]={i:b,result:q};n=q}B=l;l=n}else b=l,l=d;l===d&&(l=null);F();f.substr(b,2)===tf?(n=tf,b+=2):(n=d,0===w&&x(bl));n!==d?(B=h,h=l?[\"pragma\",[\"pragmaName\",k],[\"pragmaContents\",l]]:[\"pragma\",[\"pragmaName\",k]]):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}\nfunction al(){var h,u=233*b+91;if(h=z[u])return b=h.i,h.result;var k;h=233*b+92;if(k=z[h])b=k.i,h=k.result;else{k=b;var l=uf();if(l!==d){F();var n=cl();if(n!==d){F();var q=vf();q!==d?(B=k,k=[\"pathExpr\",l,n].concat(q)):(b=k,k=d)}else b=k,k=d}else b=k,k=d;if(k===d&&(k=b,l=uf(),l!==d?(F(),47===f.charCodeAt(b)?(n=Mi,b++):(n=d,0===w&&x(Ni)),n!==d?(F(),q=vf(),q!==d?(B=k,k=[\"pathExpr\",l].concat(q)):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),k===d)){k=233*b+98;if(l=z[k])b=l.i,k=l.result;else{l=b;n=zq();if(n!==d){q=\nb;w++;var r=b;var y=F();var C=Hg();C!==d?r=y=[y,C]:(b=r,r=d);r===d&&(r=b,y=F(),C=sf(),C!==d?r=y=[y,C]:(b=r,r=d),r===d&&(r=b,y=F(),C=dl(),C!==d?r=y=[y,C]:(b=r,r=d)));w--;r===d?q=void 0:(b=q,q=d);q!==d?(B=l,l=n):(b=l,l=d)}else b=l,l=d;z[k]={i:b,result:l};k=l}k===d&&(k=b,l=uf(),l!==d&&(B=k,l=[\"pathExpr\",l]),k=l)}z[h]={i:b,result:k};h=k}h===d&&(h=233*b+95,(k=z[h])?(b=k.i,h=k.result):(k=b,47===f.charCodeAt(b)?(n=Mi,b++):(n=d,0===w&&x(Ni)),n!==d?(F(),l=vf(),l!==d?(B=k,k=[\"pathExpr\",[\"rootExpr\"]].concat(l)):\n(b=k,k=d)):(b=k,k=d),k===d&&(k=b,n=cl(),n!==d?(F(),l=vf(),l!==d?(B=k,k=[\"pathExpr\",[\"rootExpr\"],n].concat(l)):(b=k,k=d)):(b=k,k=d),k===d&&(k=b,47===f.charCodeAt(b)?(n=Mi,b++):(n=d,0===w&&x(Ni)),n!==d?(n=b,w++,l=b,q=F(),B=r=b,(y=m.Ra)?y=void 0:y=d,y!==d?(Vw.test(f.charAt(b))?(C=f.charAt(b),b++):(C=d,0===w&&x(Ww)),C!==d?r=y=[y,C]:(b=r,r=d)):(b=r,r=d),r!==d?l=q=[q,r]:(b=l,l=d),l===d&&(B=l=b,(q=!m.Ra)?q=void 0:q=d,q!==d?(Xw.test(f.charAt(b))?(r=f.charAt(b),b++):(r=d,0===w&&x(Yw)),r!==d?l=q=[q,r]:(b=l,\nl=d)):(b=l,l=d)),w--,l===d?n=void 0:(b=n,n=d),n!==d?(B=k,k=[\"pathExpr\",[\"rootExpr\"]]):(b=k,k=d)):(b=k,k=d))),z[h]={i:b,result:k},h=k));z[u]={i:b,result:h};return h}function vf(){var h,u=233*b+93;if(h=z[u])return b=h.i,h.result;h=b;var k=uf();if(k!==d){F();var l=cl();if(l!==d){F();var n=vf();n!==d?(B=h,h=[k,l].concat(n)):(b=h,h=d)}else b=h,h=d}else b=h,h=d;h===d&&(h=b,k=uf(),k!==d?(F(),47===f.charCodeAt(b)?(l=Mi,b++):(l=d,0===w&&x(Ni)),l!==d?(F(),n=vf(),n!==d?(B=h,h=[k].concat(n)):(b=h,h=d)):(b=h,\nh=d)):(b=h,h=d),h===d&&(h=b,k=uf(),k!==d&&(B=h,k=[k]),h=k));z[u]={i:b,result:h};return h}function uf(){var h,u=233*b+94;if(h=z[u])return b=h.i,h.result;h=b;var k;var l=233*b+97;if(k=z[l])b=k.i,l=k.result;else{var n=k=b;var q=zq();q!==d&&(B=n,q=Ck(q));n=q;if(n!==d){q=[];var r=b;F();var y=Hg();y!==d?(B=r,r=[\"predicate\",y]):(b=r,r=d);r===d&&(r=b,F(),y=sf(),y!==d?(B=r,r=[\"argumentList\",y]):(b=r,r=d),r===d&&(r=b,F(),y=dl(),y!==d?(B=r,r=y):(b=r,r=d)));for(;r!==d;)q.push(r),r=b,F(),y=Hg(),y!==d?(B=r,r=[\"predicate\",\ny]):(b=r,r=d),r===d&&(r=b,F(),y=sf(),y!==d?(B=r,r=[\"argumentList\",y]):(b=r,r=d),r===d&&(r=b,F(),y=dl(),y!==d?(B=r,r=y):(b=r,r=d)));B=k;k=t(n,q)}else b=k,k=d;z[l]={i:b,result:k};l=k}l!==d&&(B=h,l=[\"stepExpr\"].concat(l));h=l;if(h===d)if(h=233*b+99,l=z[h])b=l.i,h=l.result;else{l=b;k=233*b+103;if(n=z[k])b=n.i,k=n.result;else{n=b;q=233*b+104;if(r=z[q])b=r.i,q=r.result;else{y=r=b;if(f.substr(b,6)===Aq){var C=Aq;b+=6}else C=d,0===w&&x(Zw);if(C!==d){if(f.substr(b,2)===Za){var J=Za;b+=2}else J=d,0===w&&x(hc);\nJ!==d?y=C=[C,J]:(b=y,y=d)}else b=y,y=d;y!==d&&(B=r,y=\"parent\");r=y;r===d&&(y=r=b,f.substr(b,8)===Bq?(C=Bq,b+=8):(C=d,0===w&&x($w)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"ancestor\"),r=y,r===d&&(y=r=b,f.substr(b,17)===Cq?(C=Cq,b+=17):(C=d,0===w&&x(ax)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"preceding-sibling\"),r=y,r===d&&(y=r=b,f.substr(b,9)===Dq?(C=Dq,b+=9):(C=\nd,0===w&&x(bx)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"preceding\"),r=y,r===d&&(y=r=b,f.substr(b,16)===Eq?(C=Eq,b+=16):(C=d,0===w&&x(cx)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"ancestor-or-self\"),r=y))));z[q]={i:b,result:r};q=r}q!==d?(r=el(),r!==d?(B=n,n=[\"stepExpr\",[\"xpathAxis\",q],r]):(b=n,n=d)):(b=n,n=d);n===d&&(n=b,q=233*b+105,(r=z[q])?(b=r.i,q=r.result):(r=\nb,f.substr(b,2)===Fq?(y=Fq,b+=2):(y=d,0===w&&x(dx)),y!==d&&(B=r,y=[\"stepExpr\",[\"xpathAxis\",\"parent\"],[\"anyKindTest\"]]),r=y,z[q]={i:b,result:r},q=r),q!==d&&(B=n),n=q);z[k]={i:b,result:n};k=n}k===d&&(k=233*b+100,(n=z[k])?(b=n.i,k=n.result):(n=b,q=233*b+101,(r=z[q])?(b=r.i,q=r.result):(y=r=b,f.substr(b,5)===Gq?(C=Gq,b+=5):(C=d,0===w&&x(ex)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"child\"),r=y,r===d&&(y=r=b,f.substr(b,10)===Hq?(C=Hq,\nb+=10):(C=d,0===w&&x(fx)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"descendant\"),r=y,r===d&&(y=r=b,f.substr(b,9)===wf?(C=wf,b+=9):(C=d,0===w&&x(fl)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"attribute\"),r=y,r===d&&(y=r=b,f.substr(b,4)===Iq?(C=Iq,b+=4):(C=d,0===w&&x(gx)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==\nd&&(B=r,y=\"self\"),r=y,r===d&&(y=r=b,f.substr(b,18)===Jq?(C=Jq,b+=18):(C=d,0===w&&x(hx)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"descendant-or-self\"),r=y,r===d&&(y=r=b,f.substr(b,17)===Kq?(C=Kq,b+=17):(C=d,0===w&&x(ix)),C!==d?(f.substr(b,2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"following-sibling\"),r=y,r===d&&(y=r=b,f.substr(b,9)===Lq?(C=Lq,b+=9):(C=d,0===w&&x(jx)),C!==d?(f.substr(b,\n2)===Za?(J=Za,b+=2):(J=d,0===w&&x(hc)),J!==d?y=C=[C,J]:(b=y,y=d)):(b=y,y=d),y!==d&&(B=r,y=\"following\"),r=y)))))),z[q]={i:b,result:r},q=r),q!==d?(r=el(),r!==d?(B=n,n=[\"stepExpr\",[\"xpathAxis\",q],r]):(b=n,n=d)):(b=n,n=d),n===d&&(n=233*b+102,(q=z[n])?(b=q.i,n=q.result):(q=b,64===f.charCodeAt(b)?(r=kx,b++):(r=d,0===w&&x(lx)),r===d&&(r=null),y=el(),y!==d?(B=q,q=r||\"attributeTest\"===y[0]||\"schemaAttributeTest\"===y[0]?[\"stepExpr\",[\"xpathAxis\",\"attribute\"],y]:[\"stepExpr\",[\"xpathAxis\",\"child\"],y]):(b=q,q=d),\nz[n]={i:b,result:q},n=q)),z[k]={i:b,result:n},k=n));if(k!==d){n=233*b+110;if(q=z[n])b=q.i,n=q.result;else{q=b;r=[];y=b;F();C=Hg();C!==d?(B=y,y=C):(b=y,y=d);for(;y!==d;)r.push(y),y=b,F(),C=Hg(),C!==d?(B=y,y=C):(b=y,y=d);B=q;q=r=r.length?[\"predicates\"].concat(r):[];z[n]={i:b,result:q};n=q}B=l;l=0===n.length?k:k.concat([n])}else b=l,l=d;z[h]={i:b,result:l};h=l}z[u]={i:b,result:h};return h}function cl(){var h,u=233*b+96;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,2)===Mq){var k=Mq;b+=2}else k=d,\n0===w&&x(mx);k!==d&&(B=h,k=[\"stepExpr\",[\"xpathAxis\",\"descendant-or-self\"],[\"anyKindTest\"]]);h=k;z[u]={i:b,result:h};return h}function el(){var h,u=233*b+106;if(h=z[u])return b=h.i,h.result;h=Nq();if(h===d){var k,l;h=233*b+107;if(k=z[h])b=k.i,h=k.result;else{k=233*b+108;if(l=z[k])b=l.i,k=l.result;else{l=b;if(f.substr(b,2)===Oq){var n=Oq;b+=2}else n=d,0===w&&x(nx);if(n!==d){var q=Kb();q!==d?(B=l,l=[\"Wildcard\",[\"star\"],[\"NCName\",q]]):(b=l,l=d)}else b=l,l=d;l===d&&(l=b,42===f.charCodeAt(b)?(n=vc,b++):\n(n=d,0===w&&x(wc)),n!==d&&(B=l,n=[\"Wildcard\"]),l=n,l===d&&(l=b,n=Pq(),n!==d?(42===f.charCodeAt(b)?(q=vc,b++):(q=d,0===w&&x(wc)),q!==d?(B=l,l=[\"Wildcard\",[\"uri\",n],[\"star\"]]):(b=l,l=d)):(b=l,l=d),l===d&&(l=b,n=Kb(),n!==d?(f.substr(b,2)===Qq?(q=Qq,b+=2):(q=d,0===w&&x(ox)),q!==d?(B=l,l=[\"Wildcard\",[\"NCName\",n],[\"star\"]]):(b=l,l=d)):(b=l,l=d))));z[k]={i:b,result:l};k=l}k===d&&(k=b,l=Aa(),l!==d&&(B=k,l=[\"nameTest\"].concat(l)),k=l);z[h]={i:b,result:k};h=k}}z[u]={i:b,result:h};return h}function sf(){var h,\nu=233*b+109;if(h=z[u])return b=h.i,h.result;h=b;if(40===f.charCodeAt(b)){var k=fb;b++}else k=d,0===w&&x(gb);if(k!==d){F();k=b;var l=gl();if(l!==d){var n=[];var q=b;F();if(44===f.charCodeAt(b)){var r=ua;b++}else r=d,0===w&&x(va);r!==d?(F(),r=gl(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d);for(;q!==d;)n.push(q),q=b,F(),44===f.charCodeAt(b)?(r=ua,b++):(r=d,0===w&&x(va)),r!==d?(F(),r=gl(),r!==d?(B=q,q=r):(b=q,q=d)):(b=q,q=d);B=k;k=[l].concat(n)}else b=k,k=d;k===d&&(k=null);F();41===f.charCodeAt(b)?(n=Oa,b++):\n(n=d,0===w&&x(Pa));n!==d?(B=h,h=k||[]):(b=h,h=d)}else b=h,h=d;z[u]={i:b,result:h};return h}function Hg(){var h,u=233*b+111;if(h=z[u])return b=h.i,h.result;h=b;if(91===f.charCodeAt(b)){var k=Rq;b++}else k=d,0===w&&x(Sq);if(k!==d)if(F(),k=pc(),k!==d){F();if(93===f.charCodeAt(b)){var l=Tq;b++}else l=d,0===w&&x(Uq);l!==d?(B=h,h=k):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function dl(){var h,u=233*b+112;if(h=z[u])return b=h.i,h.result;h=b;if(63===f.charCodeAt(b)){var k=Ig;b++}else k=\nd,0===w&&x(Jg);k!==d?(F(),k=Vq(),k!==d?(B=h,h=\"*\"===k?[\"lookup\",[\"star\"]]:\"string\"===typeof k?[\"lookup\",[\"NCName\",k]]:[\"lookup\",k]):(b=h,h=d)):(b=h,h=d);z[u]={i:b,result:h};return h}function Vq(){var h,u=233*b+113;if(h=z[u])return b=h.i,h.result;h=Kb();h===d&&(h=hl(),h===d&&(h=il(),h===d&&(42===f.charCodeAt(b)?(h=vc,b++):(h=d,0===w&&x(wc)))));z[u]={i:b,result:h};return h}function mq(){var h,u=233*b+114;if(h=z[u])return b=h.i,h.result;h=b;var k=Aa();k!==d&&(B=h,k=[\"EQName\"].concat(k));h=k;h===d&&(h=\njl(),h===d&&(h=il()));z[u]={i:b,result:h};return h}function zq(){var h=233*b+115,u=z[h];if(u)return b=u.i,u.result;var k=gi();if(k===d&&(k=jl(),k===d&&(k=il(),k===d))){var l=233*b+120,n=z[l];if(n)b=n.i,k=n.result;else{var q=b;if(46===f.charCodeAt(b)){var r=xf;b++}else r=d,0===w&&x(yf);if(r!==d){var y=b;w++;if(46===f.charCodeAt(b)){var C=xf;b++}else C=d,0===w&&x(yf);w--;C===d?y=void 0:(b=y,y=d);y!==d?(B=q,q=[\"contextItemExpr\"]):(b=q,q=d)}else b=q,q=d;z[l]={i:b,result:q};k=q}if(k===d){var J,N=233*b+\n121,oa=z[N];if(oa)b=oa.i,k=oa.result;else{var wb=J=b;w++;var Tb=b;var dc=Vo();if(dc!==d){var je=F();if(40===f.charCodeAt(b)){var Ye=fb;b++}else Ye=d,0===w&&x(gb);Ye!==d?Tb=dc=[dc,je,Ye]:(b=Tb,Tb=d)}else b=Tb,Tb=d;w--;Tb===d?wb=void 0:(b=wb,wb=d);wb!==d?(Tb=Aa(),Tb!==d?(F(),je=sf(),je!==d?(B=J,J=[\"functionCallExpr\",[\"functionName\"].concat(Tb),[\"arguments\"].concat(je)]):(b=J,J=d)):(b=J,J=d)):(b=J,J=d);z[N]={i:b,result:J};k=J}if(k===d){var gg=233*b+124,ke=z[gg];if(ke)b=ke.i,k=ke.result;else{var Xa=Wq();\nif(Xa===d){var dd=233*b+140,hg=z[dd];if(hg)b=hg.i,Xa=hg.result;else{var ig=233*b+141,le=z[ig];if(le){b=le.i;var Qa=le.result}else{var Eb=b;if(f.substr(b,8)===Xq){var jg=Xq;b+=8}else jg=d,0===w&&x(px);if(jg!==d){F();var Ze=sc();Ze!==d?(B=Eb,Eb=Ze?[\"computedDocumentConstructor\",[\"argExpr\",Ze]]:[\"computedDocumentConstructor\"]):(b=Eb,Eb=d)}else b=Eb,Eb=d;z[ig]={i:b,result:Eb};Qa=Eb}if(Qa===d){var mb=233*b+142,ed=z[mb];if(ed)b=ed.i,Qa=ed.result;else{var xb=b;if(f.substr(b,7)===Lb){var ji=Lb;b+=7}else ji=\nd,0===w&&x(he);if(ji!==d){F();var sb=b;var fd=Aa();fd!==d&&(B=sb,fd=[\"tagName\"].concat(fd));sb=fd;if(sb===d)if(sb=b,123===f.charCodeAt(b)?(fd=Fd,b++):(fd=d,0===w&&x(Gd)),fd!==d){F();var kg=pc();if(kg!==d){F();if(125===f.charCodeAt(b)){var lg=Hd;b++}else lg=d,0===w&&x(Id);lg!==d?(B=sb,sb=[\"tagNameExpr\",kg]):(b=sb,sb=d)}else b=sb,sb=d}else b=sb,sb=d;if(sb!==d){F();var $e=233*b+143,Da=z[$e];if(Da){b=Da.i;var af=Da.result}else{var me=b;var Kd=sc();Kd!==d&&(B=me,Kd=Kd?[[\"contentExpr\",Kd]]:[]);me=Kd;z[$e]=\n{i:b,result:me};af=me}af!==d?(B=xb,xb=[\"computedElementConstructor\",sb].concat(af)):(b=xb,xb=d)}else b=xb,xb=d}else b=xb,xb=d;z[mb]={i:b,result:xb};Qa=xb}if(Qa===d){var mg=233*b+144,Ld=z[mg];if(Ld)b=Ld.i,Qa=Ld.result;else{var Ma=b;if(f.substr(b,9)===wf){var Lc=wf;b+=9}else Lc=d,0===w&&x(fl);if(Lc!==d){var ya=b;var ne=za();if(ne!==d){F();var oe=Aa();oe!==d?(B=ya,ya=[\"tagName\"].concat(oe)):(b=ya,ya=d)}else b=ya,ya=d;if(ya===d){ya=b;F();if(123===f.charCodeAt(b)){var tc=Fd;b++}else tc=d,0===w&&x(Gd);\nif(tc!==d){F();var ng=pc();if(ng!==d){F();if(125===f.charCodeAt(b)){var bf=Hd;b++}else bf=d,0===w&&x(Id);bf!==d?(B=ya,ya=[\"tagNameExpr\",ng]):(b=ya,ya=d)}else b=ya,ya=d}else b=ya,ya=d}ya!==d?(F(),tc=sc(),tc!==d?(B=Ma,Ma=[\"computedAttributeConstructor\",ya].concat([[\"valueExpr\",tc?tc:[\"sequenceExpr\"]]])):(b=Ma,Ma=d)):(b=Ma,Ma=d)}else b=Ma,Ma=d;z[mg]={i:b,result:Ma};Qa=Ma}if(Qa===d){var Ga=233*b+145,cf=z[Ga];if(cf)b=cf.i,Qa=cf.result;else{var Ub=b;if(f.substr(b,9)===Jb){var og=Jb;b+=9}else og=d,0===w&&\nx(ge);if(og!==d){F();var pg=233*b+146,df=z[pg];if(df){b=df.i;var Md=df.result}else{var pe=b;var qe=Kb();qe!==d&&(B=pe,qe=[\"prefix\",qe]);pe=qe;z[pg]={i:b,result:pe};Md=pe}if(Md===d){var mi=233*b+147,ef=z[mi];if(ef)b=ef.i,Md=ef.result;else{var re=b;var gd=sc();gd!==d&&(B=re,gd=gd?[[\"prefixExpr\",gd]]:[]);re=gd;z[mi]={i:b,result:re};Md=re}}if(Md!==d){F();var Ra=233*b+148,ff=z[Ra];if(ff){b=ff.i;var qg=ff.result}else{var Mc=b;var se=sc();se!==d&&(B=Mc,se=se?[[\"URIExpr\",se]]:[]);Mc=se;z[Ra]={i:b,result:Mc};\nqg=Mc}qg!==d?(B=Ub,Ub=[\"computedNamespaceConstructor\"].concat(Md,qg)):(b=Ub,Ub=d)}else b=Ub,Ub=d}else b=Ub,Ub=d;z[Ga]={i:b,result:Ub};Qa=Ub}if(Qa===d){var sg=233*b+149,tg=z[sg];if(tg)b=tg.i,Qa=tg.result;else{var Ya=b;if(f.substr(b,4)===Oi){var ug=Oi;b+=4}else ug=d,0===w&&x(Yq);if(ug!==d){F();var te=sc();te!==d?(B=Ya,Ya=[\"computedTextConstructor\"].concat(te?[[\"argExpr\",te]]:[])):(b=Ya,Ya=d)}else b=Ya,Ya=d;z[sg]={i:b,result:Ya};Qa=Ya}if(Qa===d){var gf=233*b+150,Ea=z[gf];if(Ea)b=Ea.i,Qa=Ea.result;else{var Ob=\nb;if(f.substr(b,7)===Pi){var oi=Pi;b+=7}else oi=d,0===w&&x(Zq);if(oi!==d){F();var ec=sc();ec!==d?(B=Ob,Ob=[\"computedCommentConstructor\"].concat(ec?[[\"argExpr\",ec]]:[])):(b=Ob,Ob=d)}else b=Ob,Ob=d;z[gf]={i:b,result:Ob};Qa=Ob}if(Qa===d){var Pb=233*b+151,vg=z[Pb];if(vg)b=vg.i,Qa=vg.result;else{var Vb=b;if(f.substr(b,22)===Qi){var wg=Qi;b+=22}else wg=d,0===w&&x($q);if(wg!==d){F();var nb=b;var eb=Kb();eb!==d&&(B=nb,eb=[\"piTarget\",eb]);nb=eb;if(nb===d)if(nb=b,123===f.charCodeAt(b)?(eb=Fd,b++):(eb=d,0===\nw&&x(Gd)),eb!==d){F();var xg=pc();if(xg!==d){F();if(125===f.charCodeAt(b)){var pi=Hd;b++}else pi=d,0===w&&x(Id);pi!==d?(B=nb,nb=[\"piTargetExpr\",xg]):(b=nb,nb=d)}else b=nb,nb=d}else b=nb,nb=d;if(nb!==d){F();var hd=sc();hd!==d?(B=Vb,Vb=[\"computedPIConstructor\",nb].concat(hd?[[\"piValueExpr\",hd]]:[])):(b=Vb,Vb=d)}else b=Vb,Vb=d}else b=Vb,Vb=d;z[Pb]={i:b,result:Vb};Qa=Vb}}}}}}}z[dd]={i:b,result:Qa};Xa=Qa}}z[gg]={i:b,result:Xa};k=Xa}if(k===d){var qi=233*b+152,hf=z[qi];if(hf)b=hf.i,k=hf.result;else{var yg=\n233*b+153,ue=z[yg];if(ue){b=ue.i;var Ha=ue.result}else{var Wb=b;var ri=Aa();if(ri!==d){if(35===f.charCodeAt(b)){var zg=qx;b++}else zg=d,0===w&&x(rx);if(zg!==d){var Ag=hl();Ag!==d?(B=Wb,Wb=[\"namedFunctionRef\",[\"functionName\"].concat(ri),Ag]):(b=Wb,Wb=d)}else b=Wb,Wb=d}else b=Wb,Wb=d;z[yg]={i:b,result:Wb};Ha=Wb}if(Ha===d){var jf,Bg=233*b+154,Cg=z[Bg];if(Cg)b=Cg.i,Ha=Cg.result;else{var Fb=b;var Dg=[];for(jf=Ve();jf!==d;)Dg.push(jf),jf=Ve();F();if(f.substr(b,8)===cc){var kf=cc;b+=8}else kf=d,0===w&&x(Ue);\nif(kf!==d){F();if(40===f.charCodeAt(b)){var Sa=fb;b++}else Sa=d,0===w&&x(gb);if(Sa!==d){F();var lf=Wo();lf===d&&(lf=null);F();if(41===f.charCodeAt(b)){var si=Oa;b++}else si=d,0===w&&x(Pa);if(si!==d){F();var Ta=b;if(f.substr(b,2)===db){var Xb=db;b+=2}else Xb=d,0===w&&x(rc);if(Xb!==d){var mf=P();if(mf!==d){var Oc=Nb();Oc!==d?(F(),B=Ta,Ta=[\"typeDeclaration\"].concat(Oc)):(b=Ta,Ta=d)}else b=Ta,Ta=d}else b=Ta,Ta=d;Ta===d&&(Ta=null);Xb=Xo();Xb!==d?(B=Fb,Fb=[\"inlineFunctionExpr\"].concat(Dg,[[\"paramList\"].concat(lf||\n[])],Ta?[Ta]:[],[[\"functionBody\",Xb]])):(b=Fb,Fb=d)}else b=Fb,Fb=d}else b=Fb,Fb=d}else b=Fb,Fb=d;z[Bg]={i:b,result:Fb};Ha=Fb}}z[qi]={i:b,result:Ha};k=Ha}if(k===d){var ve=233*b+155,nf=z[ve];if(nf)b=nf.i,k=nf.result;else{var fc=b;if(f.substr(b,3)===Td){var of=Td;b+=3}else of=d,0===w&&x(Ri);if(of!==d){F();if(123===f.charCodeAt(b)){var Eg=Fd;b++}else Eg=d,0===w&&x(Gd);if(Eg!==d){F();var gc=b;var Ia=kl();if(Ia!==d){var Nd=[];var tb=b;F();if(44===f.charCodeAt(b)){var Od=ua;b++}else Od=d,0===w&&x(va);if(Od!==\nd){F();var Pd=kl();Pd!==d?(B=tb,tb=Pd):(b=tb,tb=d)}else b=tb,tb=d;for(;tb!==d;)Nd.push(tb),tb=b,F(),44===f.charCodeAt(b)?(Od=ua,b++):(Od=d,0===w&&x(va)),Od!==d?(F(),Pd=kl(),Pd!==d?(B=tb,tb=Pd):(b=tb,tb=d)):(b=tb,tb=d);B=gc;gc=[Ia].concat(Nd)}else b=gc,gc=d;gc===d&&(gc=null);F();125===f.charCodeAt(b)?(Nd=Hd,b++):(Nd=d,0===w&&x(Id));Nd!==d?(B=fc,fc=gc?[\"mapConstructor\"].concat(gc):[\"mapConstructor\"]):(b=fc,fc=d)}else b=fc,fc=d}else b=fc,fc=d;z[ve]={i:b,result:fc};k=fc}if(k===d){var jb=233*b+159,Qd=\nz[jb];if(Qd)b=Qd.i,k=Qd.result;else{var yb=b;var we=233*b+160,uc=z[we];if(uc){b=uc.i;var Qb=uc.result}else{var Pc=b;if(91===f.charCodeAt(b)){var Fg=Rq;b++}else Fg=d,0===w&&x(Sq);if(Fg!==d){F();var Qc=b;var pf=ta();if(pf!==d){F();var id=[];var ob=b;if(44===f.charCodeAt(b)){var Rd=ua;b++}else Rd=d,0===w&&x(va);if(Rd!==d){F();var Ua=ta();Ua!==d?(B=ob,ob=Ua):(b=ob,ob=d)}else b=ob,ob=d;for(;ob!==d;)id.push(ob),ob=b,44===f.charCodeAt(b)?(Rd=ua,b++):(Rd=d,0===w&&x(va)),Rd!==d?(F(),Ua=ta(),Ua!==d?(B=ob,ob=\nUa):(b=ob,ob=d)):(b=ob,ob=d);B=Qc;Qc=p(pf,id)}else b=Qc,Qc=d;Qc===d&&(Qc=null);F();if(93===f.charCodeAt(b)){var Sd=Tq;b++}else Sd=d,0===w&&x(Uq);Sd!==d?(B=Pc,Pc=[\"squareArray\"].concat(Qc)):(b=Pc,Pc=d)}else b=Pc,Pc=d;z[we]={i:b,result:Pc};Qb=Pc}Qb!==d&&(B=yb,Qb=[\"arrayConstructor\",Qb]);yb=Qb;if(yb===d){yb=b;var qf=233*b+161,jd=z[qf];if(jd)b=jd.i,Qb=jd.result;else{var Ud=b;if(f.substr(b,5)===Vd){var ar=Vd;b+=5}else ar=d,0===w&&x(Si);if(ar!==d){F();var ll=sc();ll!==d?(B=Ud,Ud=[\"curlyArray\"].concat(ll?\n[[\"arrayElem\",ll]]:[])):(b=Ud,Ud=d)}else b=Ud,Ud=d;z[qf]={i:b,result:Ud};Qb=Ud}Qb!==d&&(B=yb,Qb=[\"arrayConstructor\",Qb]);yb=Qb}z[jb]={i:b,result:yb};k=yb}if(k===d){var br=233*b+162,ml=z[br];if(ml)b=ml.i,k=ml.result;else{var Wd=b;if(63===f.charCodeAt(b)){var cr=Ig;b++}else cr=d,0===w&&x(Jg);if(cr!==d){F();var Kg=Vq();Kg!==d?(B=Wd,Wd=\"*\"===Kg?[\"unaryLookup\",[\"star\"]]:\"string\"===typeof Kg?[\"unaryLookup\",[\"NCName\",Kg]]:[\"unaryLookup\",Kg]):(b=Wd,Wd=d)}else b=Wd,Wd=d;z[br]={i:b,result:Wd};k=Wd}}}}}}}}z[h]=\n{i:b,result:k};return k}function gi(){var h,u,k=233*b+116;if(h=z[k])return b=h.i,h.result;var l,n;h=233*b+117;if(u=z[h])b=u.i,h=u.result;else{u=b;var q;var r=233*b+195;if(l=z[r])b=l.i,r=l.result;else{var y=q=n=l=b;if(46===f.charCodeAt(b)){var C=xf;b++}else C=d,0===w&&x(yf);if(C!==d){var J=xe();J!==d?y=C=[C,J]:(b=y,y=d)}else b=y,y=d;if(y===d)if(y=b,C=xe(),C!==d){J=b;if(46===f.charCodeAt(b)){var N=xf;b++}else N=d,0===w&&x(yf);if(N!==d){y=[];zf.test(f.charAt(b))?(J=f.charAt(b),b++):(J=d,0===w&&x(Af));\nfor(;J!==d;)y.push(J),zf.test(f.charAt(b))?(J=f.charAt(b),b++):(J=d,0===w&&x(Af));J=N=[N,y]}else b=J,J=d;J===d&&(J=null);y=C=[C,J]}else b=y,y=d;y!==d?(sx.test(f.charAt(b))?(C=f.charAt(b),b++):(C=d,0===w&&x(tx)),C!==d?(ux.test(f.charAt(b))?(J=f.charAt(b),b++):(J=d,0===w&&x(vx)),J===d&&(J=null),N=xe(),N!==d?q=y=[y,C,J,N]:(b=q,q=d)):(b=q,q=d)):(b=q,q=d);n=q!==d?f.substring(n,b):q;n!==d&&(B=l,n=[\"doubleConstantExpr\",[\"value\",n]]);l=n;z[r]={i:b,result:l};r=l}r===d&&(r=233*b+194,(l=z[r])?(b=l.i,r=l.result):\n(N=n=l=b,46===f.charCodeAt(b)?(q=xf,b++):(q=d,0===w&&x(yf)),q!==d?(C=xe(),C!==d?N=q=[q,C]:(b=N,N=d)):(b=N,N=d),n=N!==d?f.substring(n,b):N,n!==d&&(B=l,n=[\"decimalConstantExpr\",[\"value\",n]]),l=n,l===d&&(N=n=l=b,q=xe(),q!==d?(46===f.charCodeAt(b)?(C=xf,b++):(C=d,0===w&&x(yf)),C!==d?(N=xe(),N===d&&(N=null),N=q=[q,C,N]):(b=N,N=d)):(b=N,N=d),n=N!==d?f.substring(n,b):N,n!==d&&(B=l,n=[\"decimalConstantExpr\",[\"value\",n]]),l=n),z[r]={i:b,result:l},r=l),r===d&&(r=hl()));r!==d?(l=b,w++,wx.test(f.charAt(b))?(n=\nf.charAt(b),b++):(n=d,0===w&&x(xx)),w--,n===d?l=void 0:(b=l,l=d),l!==d?(B=u,u=r):(b=u,u=d)):(b=u,u=d);z[h]={i:b,result:u};h=u}h===d&&(h=b,u=bb(),u!==d&&(B=h,u=[\"stringConstantExpr\",[\"value\",Ti(u)]]),h=u);z[k]={i:b,result:h};return h}function jl(){var h,u=233*b+118;if(h=z[u])return b=h.i,h.result;h=b;if(36===f.charCodeAt(b)){var k=Jc;b++}else k=d,0===w&&x(Kc);k!==d?(k=Aa(),k!==d?(B=h,h=[\"varRef\",[\"name\"].concat(k)]):(b=h,h=d)):(b=h,h=d);z[u]={i:b,result:h};return h}function il(){var h,u=233*b+119;\nif(h=z[u])return b=h.i,h.result;h=b;if(40===f.charCodeAt(b)){var k=fb;b++}else k=d,0===w&&x(gb);if(k!==d)if(F(),k=pc(),k!==d){F();if(41===f.charCodeAt(b)){var l=Oa;b++}else l=d,0===w&&x(Pa);l!==d?(B=h,h=k):(b=h,h=d)}else b=h,h=d;else b=h,h=d;h===d&&(h=b,40===f.charCodeAt(b)?(k=fb,b++):(k=d,0===w&&x(gb)),k!==d?(F(),41===f.charCodeAt(b)?(k=Oa,b++):(k=d,0===w&&x(Pa)),k!==d?(B=h,h=[\"sequenceExpr\"]):(b=h,h=d)):(b=h,h=d));z[u]={i:b,result:h};return h}function gl(){var h,u=233*b+122;if(h=z[u])return b=h.i,\nh.result;h=ta();if(h===d){var k;h=233*b+123;if(k=z[h])b=k.i,h=k.result;else{k=b;if(63===f.charCodeAt(b)){var l=Ig;b++}else l=d,0===w&&x(Jg);l!==d&&(B=k,l=[\"argumentPlaceholder\"]);k=l;z[h]={i:b,result:k};h=k}}z[u]={i:b,result:h};return h}function Wq(){var h,u=233*b+125;if(h=z[u])return b=h.i,h.result;var k,l;h=233*b+126;if(k=z[h])b=k.i,h=k.result;else{k=b;if(60===f.charCodeAt(b)){var n=Yp;b++}else n=d,0===w&&x(Zp);if(n!==d)if(n=Ui(),n!==d){var q=233*b+127;if(l=z[q])b=l.i,q=l.result;else{l=b;var r=\n[];var y=b;var C=Bf();C!==d?(C=dr(),C===d&&(C=null),B=y,y=C):(b=y,y=d);for(;y!==d;)r.push(y),y=b,C=Bf(),C!==d?(C=dr(),C===d&&(C=null),B=y,y=C):(b=y,y=d);B=l;l=r=r.filter(Boolean);z[q]={i:b,result:l};q=l}r=b;f.substr(b,2)===er?(l=er,b+=2):(l=d,0===w&&x(yx));l!==d&&(B=r,l=null);r=l;if(r===d)if(r=b,62===f.charCodeAt(b)?(l=Vk,b++):(l=d,0===w&&x(Wk)),l!==d){l=[];for(y=fr();y!==d;)l.push(y),y=fr();F();f.substr(b,2)===gr?(y=gr,b+=2):(y=d,0===w&&x(zx));y!==d?(y=Ui(),y!==d?(Bf(),62===f.charCodeAt(b)?(C=Vk,\nb++):(C=d,0===w&&x(Wk)),C!==d?(B=r,r=1===n.length?n[0]:n[0].prefix+\":\"+n[1],y=1===y.length?y[0]:y[0].prefix+\":\"+y[1],r!==y&&Lg(\"XQST0118\",'The start and the end tag of an element constructor must be equal. \"'+r+'\" does not match \"'+y+'\"'),r=nl(l,!0,!0)):(b=r,r=d)):(b=r,r=d)):(b=r,r=d)}else b=r,r=d;r!==d?(B=k,k=[\"elementConstructor\",[\"tagName\"].concat(n)].concat(q.length?[[\"attributeList\"].concat(q)]:[],r&&r.length?[[\"elementContent\"].concat(r)]:[])):(b=k,k=d)}else b=k,k=d;else b=k,k=d;z[h]={i:b,result:k};\nh=k}if(h===d){h=233*b+134;if(k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,4)===hr?(n=hr,b+=4):(n=d,0===w&&x(Ax));if(n!==d){n=b;q=233*b+135;if(l=z[q])b=l.i;else{l=[];y=r=b;w++;45===f.charCodeAt(b)?(C=kd,b++):(C=d,0===w&&x(ld));w--;C===d?y=void 0:(b=y,y=d);y!==d?(C=Rb(),C!==d?r=y=[y,C]:(b=r,r=d)):(b=r,r=d);if(r===d)if(r=b,45===f.charCodeAt(b)?(y=kd,b++):(y=d,0===w&&x(ld)),y!==d){var J=C=b;w++;if(45===f.charCodeAt(b)){var N=kd;b++}else N=d,0===w&&x(ld);w--;N===d?J=void 0:(b=J,J=d);J!==d?(N=Rb(),N!==d?\nC=J=[J,N]:(b=C,C=d)):(b=C,C=d);C!==d?r=y=[y,C]:(b=r,r=d)}else b=r,r=d;for(;r!==d;)l.push(r),y=r=b,w++,45===f.charCodeAt(b)?(C=kd,b++):(C=d,0===w&&x(ld)),w--,C===d?y=void 0:(b=y,y=d),y!==d?(C=Rb(),C!==d?r=y=[y,C]:(b=r,r=d)):(b=r,r=d),r===d&&(r=b,45===f.charCodeAt(b)?(y=kd,b++):(y=d,0===w&&x(ld)),y!==d?(J=C=b,w++,45===f.charCodeAt(b)?(N=kd,b++):(N=d,0===w&&x(ld)),w--,N===d?J=void 0:(b=J,J=d),J!==d?(N=Rb(),N!==d?C=J=[J,N]:(b=C,C=d)):(b=C,C=d),C!==d?r=y=[y,C]:(b=r,r=d)):(b=r,r=d));z[q]={i:b,result:l}}n=\nf.substring(n,b);f.substr(b,3)===ir?(q=ir,b+=3):(q=d,0===w&&x(Bx));q!==d?(B=k,k=[\"computedCommentConstructor\",[\"argExpr\",[\"stringConstantExpr\",[\"value\",n]]]]):(b=k,k=d)}else b=k,k=d;z[h]={i:b,result:k};h=k}if(h===d)if(h=233*b+136,k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,2)===jr?(n=jr,b+=2):(n=d,0===w&&x(Cx));if(n!==d){n=b;q=233*b+206;if(l=z[q])b=l.i,q=l.result;else{r=l=b;w++;y=b;88===f.charCodeAt(b)?(C=Dx,b++):(C=d,0===w&&x(Ex));C===d&&(120===f.charCodeAt(b)?(C=Fx,b++):(C=d,0===w&&x(Gx)));C!==\nd?(77===f.charCodeAt(b)?(J=Hx,b++):(J=d,0===w&&x(Ix)),J===d&&(109===f.charCodeAt(b)?(J=Jx,b++):(J=d,0===w&&x(Kx))),J!==d?(76===f.charCodeAt(b)?(N=Lx,b++):(N=d,0===w&&x(Mx)),N===d&&(108===f.charCodeAt(b)?(N=Nx,b++):(N=d,0===w&&x(Ox))),N!==d?y=C=[C,J,N]:(b=y,y=d)):(b=y,y=d)):(b=y,y=d);w--;y===d?r=void 0:(b=r,r=d);if(r!==d){var oa;y=233*b+230;if(C=z[y])b=C.i,y=C.result;else{J=C=b;N=233*b+229;(oa=z[N])?(b=oa.i,N=oa.result):(oa=ol(),oa===d&&(58===f.charCodeAt(b)?(oa=Vi,b++):(oa=d,0===w&&x(Wi))),z[N]={i:b,\nresult:oa},N=oa);if(N!==d){J=[];for(oa=kr();oa!==d;)J.push(oa),oa=kr();J=N=[N,J]}else b=J,J=d;C=J!==d?f.substring(C,b):J;z[y]={i:b,result:C};y=C}y!==d?l=r=[r,y]:(b=l,l=d)}else b=l,l=d;z[q]={i:b,result:l};q=l}n=q!==d?f.substring(n,b):q;if(n!==d){q=b;l=Bf();if(l!==d){l=b;r=233*b+137;if(y=z[r])b=y.i;else{y=[];J=C=b;w++;f.substr(b,2)===Cf?(N=Cf,b+=2):(N=d,0===w&&x(pl));w--;N===d?J=void 0:(b=J,J=d);J!==d?(N=Rb(),N!==d?C=J=[J,N]:(b=C,C=d)):(b=C,C=d);for(;C!==d;)y.push(C),J=C=b,w++,f.substr(b,2)===Cf?(N=\nCf,b+=2):(N=d,0===w&&x(pl)),w--,N===d?J=void 0:(b=J,J=d),J!==d?(N=Rb(),N!==d?C=J=[J,N]:(b=C,C=d)):(b=C,C=d);z[r]={i:b,result:y}}l=f.substring(l,b);B=q;q=l}else b=q,q=d;q===d&&(q=null);f.substr(b,2)===Cf?(l=Cf,b+=2):(l=d,0===w&&x(pl));l!==d?(B=k,k=[\"computedPIConstructor\",[\"piTarget\",n],[\"piValueExpr\",[\"stringConstantExpr\",[\"value\",q]]]]):(b=k,k=d)}else b=k,k=d}else b=k,k=d;z[h]={i:b,result:k};h=k}}z[u]={i:b,result:h};return h}function dr(){var h,u=233*b+128;if(h=z[u])return b=h.i,h.result;var k=b;\nh=Ui();if(h!==d){Bf();if(61===f.charCodeAt(b)){var l=Cd;b++}else l=d,0===w&&x(Dd);if(l!==d){Bf();var n;l=233*b+129;if(n=z[l])b=n.i,l=n.result;else{n=b;if(34===f.charCodeAt(b)){var q=ye;b++}else q=d,0===w&&x(ze);if(q!==d){q=[];var r=Df();for(r===d&&(r=lr());r!==d;)q.push(r),r=Df(),r===d&&(r=lr());34===f.charCodeAt(b)?(r=ye,b++):(r=d,0===w&&x(ze));r!==d?(B=n,n=nl(q,!1,!1)):(b=n,n=d)}else b=n,n=d;if(n===d)if(n=b,39===f.charCodeAt(b)?(q=Ae,b++):(q=d,0===w&&x(Be)),q!==d){q=[];r=Ef();for(r===d&&(r=mr());r!==\nd;)q.push(r),r=Ef(),r===d&&(r=mr());39===f.charCodeAt(b)?(r=Ae,b++):(r=d,0===w&&x(Be));r!==d?(B=n,n=nl(q,!1,!1)):(b=n,n=d)}else b=n,n=d;z[l]={i:b,result:n};l=n}l!==d?(B=k,k=l,1===h.length&&\"xmlns\"===h[0]?(k.length&&\"string\"!==typeof k[0]&&Lg(\"XQST0022\",\"A namespace declaration may not contain enclosed expressions\"),k=[\"namespaceDeclaration\",k.length?[\"uri\",k[0]]:[\"uri\"]]):\"xmlns\"===h[0].prefix?(k.length&&\"string\"!==typeof k[0]&&Lg(\"XQST0022\",\"The namespace declaration for 'xmlns:\"+h[1]+\"' may not contain enclosed expressions\"),\nk=[\"namespaceDeclaration\",[\"prefix\",h[1]],k.length?[\"uri\",k[0]]:[\"uri\"]]):k=[\"attributeConstructor\",[\"attributeName\"].concat(h),0===k.length?[\"attributeValue\"]:1===k.length&&\"string\"===typeof k[0]?[\"attributeValue\",k[0]]:[\"attributeValueExpr\"].concat(k)]):(b=k,k=d)}else b=k,k=d}else b=k,k=d;z[u]={i:b,result:k};return k}function lr(){var h,u=233*b+130;if(h=z[u])return b=h.i,h.result;h=b;var k;var l=233*b+203;if(k=z[l])b=k.i,l=k.result;else{var n=k=b;w++;if(Px.test(f.charAt(b))){var q=f.charAt(b);b++}else q=\nd,0===w&&x(Qx);w--;q===d?n=void 0:(b=n,n=d);n!==d?(q=Rb(),q!==d?(B=k,k=q):(b=k,k=d)):(b=k,k=d);z[l]={i:b,result:k};l=k}l!==d&&(B=h,l=l.replace(/[\\x20\\x0D\\x0A\\x09]/g,\" \"));h=l;h===d&&(h=ql());z[u]={i:b,result:h};return h}function mr(){var h,u=233*b+131;if(h=z[u])return b=h.i,h.result;h=b;var k;var l=233*b+204;if(k=z[l])b=k.i,l=k.result;else{var n=k=b;w++;if(Rx.test(f.charAt(b))){var q=f.charAt(b);b++}else q=d,0===w&&x(Sx);w--;q===d?n=void 0:(b=n,n=d);n!==d?(q=Rb(),q!==d?(B=k,k=q):(b=k,k=d)):(b=k,k=\nd);z[l]={i:b,result:k};l=k}l!==d&&(B=h,l=l.replace(/[\\x20\\x0D\\x0A\\x09]/g,\" \"));h=l;h===d&&(h=ql());z[u]={i:b,result:h};return h}function fr(){var h,u,k=233*b+132;if(h=z[k])return b=h.i,h.result;h=b;var l=233*b+138;if(u=z[l])b=u.i,l=u.result;else{u=b;if(f.substr(b,9)===nr){var n=nr;b+=9}else n=d,0===w&&x(Tx);if(n!==d){n=b;var q,r;var y=233*b+139;if(q=z[y])b=q.i;else{q=[];var C=r=b;w++;if(f.substr(b,3)===Ff){var J=Ff;b+=3}else J=d,0===w&&x(rl);w--;J===d?C=void 0:(b=C,C=d);C!==d?(J=Rb(),J!==d?r=C=[C,\nJ]:(b=r,r=d)):(b=r,r=d);for(;r!==d;)q.push(r),C=r=b,w++,f.substr(b,3)===Ff?(J=Ff,b+=3):(J=d,0===w&&x(rl)),w--,J===d?C=void 0:(b=C,C=d),C!==d?(J=Rb(),J!==d?r=C=[C,J]:(b=r,r=d)):(b=r,r=d);z[y]={i:b,result:q}}n=f.substring(n,b);f.substr(b,3)===Ff?(y=Ff,b+=3):(y=d,0===w&&x(rl));y!==d?(B=u,u=[\"CDataSection\",n]):(b=u,u=d)}else b=u,u=d;z[l]={i:b,result:u};l=u}l!==d&&(B=h);h=l;h===d&&(h=b,l=Wq(),l!==d&&(B=h),h=l,h===d&&(h=b,l=ql(),l!==d&&(B=h),h=l,h===d&&(l=h=b,u=233*b+202,(n=z[u])?(b=n.i,u=n.result):(y=\nn=b,w++,Ux.test(f.charAt(b))?(q=f.charAt(b),b++):(q=d,0===w&&x(Vx)),w--,q===d?y=void 0:(b=y,y=d),y!==d?(q=Rb(),q!==d?n=y=[y,q]:(b=n,n=d)):(b=n,n=d),z[u]={i:b,result:n},u=n),l=u!==d?f.substring(l,b):u,l!==d&&(B=h),h=l)));z[k]={i:b,result:h};return h}function ql(){var h,u=233*b+133;if(h=z[u])return b=h.i,h.result;h=Mg();if(h===d&&(h=Ng(),h===d)){h=b;if(f.substr(b,2)===or){var k=or;b+=2}else k=d,0===w&&x(Wx);k!==d&&(B=h,k=\"{\");h=k;h===d&&(h=b,f.substr(b,2)===pr?(k=pr,b+=2):(k=d,0===w&&x(Xx)),k!==d&&\n(B=h,k=\"}\"),h=k,h===d&&(h=b,k=sc(),k!==d&&(B=h,k=k||[\"sequenceExpr\"]),h=k))}z[u]={i:b,result:h};return h}function kl(){var h,u,k=233*b+156;if(h=z[k])return b=h.i,h.result;h=b;var l=233*b+157;if(u=z[l])b=u.i,l=u.result;else{u=b;var n=ta();n!==d&&(B=u,n=[\"mapKeyExpr\",n]);u=n;z[l]={i:b,result:u};l=u}if(l!==d)if(F(),58===f.charCodeAt(b)?(u=Vi,b++):(u=d,0===w&&x(Wi)),u!==d){F();u=233*b+158;if(n=z[u])b=n.i,u=n.result;else{n=b;var q=ta();q!==d&&(B=n,q=[\"mapValueExpr\",q]);n=q;z[u]={i:b,result:n};u=n}u!==\nd?(B=h,h=[\"mapConstructorEntry\",l,u]):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[k]={i:b,result:h};return h}function oq(){var h,u=233*b+163;if(h=z[u])return b=h.i,h.result;h=b;var k=Aa();if(k!==d){if(63===f.charCodeAt(b)){var l=Ig;b++}else l=d,0===w&&x(Jg);l===d&&(l=null);B=h;h=l?[\"singleType\",[\"atomicType\"].concat(k),[\"optional\"]]:[\"singleType\",[\"atomicType\"].concat(k)]}else b=h,h=d;z[u]={i:b,result:h};return h}function We(){var h,u=233*b+164;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,2)===db){var k=\ndb;b+=2}else k=d,0===w&&x(rc);k!==d?(k=P(),k!==d?(k=Nb(),k!==d?(B=h,h=[\"typeDeclaration\"].concat(k)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d);z[u]={i:b,result:h};return h}function Nb(){var h,u=233*b+165;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,16)===qr){var k=qr;b+=16}else k=d,0===w&&x(Yx);k!==d&&(B=h,k=[[\"voidSequenceType\"]]);h=k;if(h===d)if(h=b,k=Kk(),k!==d){var l=b;F();var n;var q=233*b+166;(n=z[q])?(b=n.i,q=n.result):(63===f.charCodeAt(b)?(n=Ig,b++):(n=d,0===w&&x(Jg)),n===d&&(42===f.charCodeAt(b)?\n(n=vc,b++):(n=d,0===w&&x(wc)),n===d&&(43===f.charCodeAt(b)?(n=Di,b++):(n=d,0===w&&x(Ei)))),z[q]={i:b,result:n},q=n);q!==d?(B=l,l=q):(b=l,l=d);l===d&&(l=null);B=h;h=[k].concat(l?[[\"occurrenceIndicator\",l]]:[])}else b=h,h=d;z[u]={i:b,result:h};return h}function Kk(){var h,u=233*b+167;if(h=z[u])return b=h.i,h.result;h=Nq();if(h===d){h=b;if(f.substr(b,6)===rr){var k=rr;b+=6}else k=d,0===w&&x(Zx);k!==d&&(B=h,k=[\"anyItemType\"]);h=k;if(h===d){var l;h=233*b+182;if(k=z[h])b=k.i,h=k.result;else{k=b;var n=[];\nfor(l=Ve();l!==d;)n.push(l),l=Ve();var q;l=233*b+183;if(q=z[l])b=q.i,l=q.result;else{q=b;if(f.substr(b,8)===cc){var r=cc;b+=8}else r=d,0===w&&x(Ue);r!==d?(F(),40===f.charCodeAt(b)?(r=fb,b++):(r=d,0===w&&x(gb)),r!==d?(F(),42===f.charCodeAt(b)?(r=vc,b++):(r=d,0===w&&x(wc)),r!==d?(F(),41===f.charCodeAt(b)?(r=Oa,b++):(r=d,0===w&&x(Pa)),r!==d?(B=q,q=[\"anyFunctionTest\"]):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d);z[l]={i:b,result:q};l=q}if(l===d)if(l=233*b+184,q=z[l])b=q.i,l=q.result;else{q=b;f.substr(b,\n8)===cc?(r=cc,b+=8):(r=d,0===w&&x(Ue));if(r!==d)if(F(),40===f.charCodeAt(b)?(r=fb,b++):(r=d,0===w&&x(gb)),r!==d){F();r=b;var y=Nb();if(y!==d){var C=[];var J=b;if(44===f.charCodeAt(b)){var N=ua;b++}else N=d,0===w&&x(va);N!==d?(F(),N=Nb(),N!==d?(B=J,J=N):(b=J,J=d)):(b=J,J=d);for(;J!==d;)C.push(J),J=b,44===f.charCodeAt(b)?(N=ua,b++):(N=d,0===w&&x(va)),N!==d?(F(),N=Nb(),N!==d?(B=J,J=N):(b=J,J=d)):(b=J,J=d);B=r;r=y.concat.apply(y,C)}else b=r,r=d;r===d&&(r=null);F();41===f.charCodeAt(b)?(C=Oa,b++):(C=d,\n0===w&&x(Pa));C!==d?(J=P(),J!==d?(f.substr(b,2)===db?(N=db,b+=2):(N=d,0===w&&x(rc)),N!==d?(y=P(),y!==d?(N=Nb(),N!==d?(B=q,q=[\"typedFunctionTest\",[\"paramTypeList\",[\"sequenceType\"].concat(r)],[\"sequenceType\"].concat(N)]):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)):(b=q,q=d)}else b=q,q=d;else b=q,q=d;z[l]={i:b,result:q};l=q}l!==d?(B=k,k=[l[0]].concat(n,l.slice(1))):(b=k,k=d);z[h]={i:b,result:k};h=k}h===d&&(h=233*b+185,(k=z[h])?(b=k.i,h=k.result):(k=233*b+186,(n=z[k])?(b=n.i,k=n.result):(n=b,f.substr(b,\n3)===Td?(l=Td,b+=3):(l=d,0===w&&x(Ri)),l!==d?(F(),40===f.charCodeAt(b)?(l=fb,b++):(l=d,0===w&&x(gb)),l!==d?(F(),42===f.charCodeAt(b)?(l=vc,b++):(l=d,0===w&&x(wc)),l!==d?(F(),41===f.charCodeAt(b)?(l=Oa,b++):(l=d,0===w&&x(Pa)),l!==d?(B=n,n=[\"anyMapTest\"]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d),z[k]={i:b,result:n},k=n),k===d&&(k=233*b+187,(n=z[k])?(b=n.i,k=n.result):(n=b,f.substr(b,3)===Td?(l=Td,b+=3):(l=d,0===w&&x(Ri)),l!==d?(F(),40===f.charCodeAt(b)?(l=fb,b++):(l=d,0===w&&x(gb)),l!==d?(F(),l=sr(),\nl!==d?(F(),44===f.charCodeAt(b)?(q=ua,b++):(q=d,0===w&&x(va)),q!==d?(F(),q=Nb(),q!==d?(F(),41===f.charCodeAt(b)?(r=Oa,b++):(r=d,0===w&&x(Pa)),r!==d?(B=n,n=[\"typedMapTest\",l,[\"sequenceType\"].concat(q)]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d),z[k]={i:b,result:n},k=n)),z[h]={i:b,result:k},h=k),h===d&&(h=233*b+188,(k=z[h])?(b=k.i,h=k.result):(k=233*b+189,(n=z[k])?(b=n.i,k=n.result):(n=b,f.substr(b,5)===Vd?(l=Vd,b+=5):(l=d,0===w&&x(Si)),l!==d?(F(),40===f.charCodeAt(b)?(l=fb,b++):\n(l=d,0===w&&x(gb)),l!==d?(F(),42===f.charCodeAt(b)?(l=vc,b++):(l=d,0===w&&x(wc)),l!==d?(F(),41===f.charCodeAt(b)?(l=Oa,b++):(l=d,0===w&&x(Pa)),l!==d?(B=n,n=[\"anyArrayTest\"]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d),z[k]={i:b,result:n},k=n),k===d&&(k=233*b+190,(n=z[k])?(b=n.i,k=n.result):(n=b,f.substr(b,5)===Vd?(l=Vd,b+=5):(l=d,0===w&&x(Si)),l!==d?(F(),40===f.charCodeAt(b)?(l=fb,b++):(l=d,0===w&&x(gb)),l!==d?(F(),l=Nb(),l!==d?(F(),41===f.charCodeAt(b)?(q=Oa,b++):(q=d,0===w&&x(Pa)),q!==d?(B=n,n=[\"typedArrayTest\",\n[\"sequenceType\"].concat(l)]):(b=n,n=d)):(b=n,n=d)):(b=n,n=d)):(b=n,n=d),z[k]={i:b,result:n},k=n)),z[h]={i:b,result:k},h=k),h===d&&(h=sr(),h===d&&(h=233*b+191,(k=z[h])?(b=k.i,h=k.result):(k=b,40===f.charCodeAt(b)?(n=fb,b++):(n=d,0===w&&x(gb)),n!==d?(F(),n=Kk(),n!==d?(F(),41===f.charCodeAt(b)?(l=Oa,b++):(l=d,0===w&&x(Pa)),l!==d?(B=k,k=[\"parenthesizedItemType\",n]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),z[h]={i:b,result:k},h=k)))))}}z[u]={i:b,result:h};return h}function sr(){var h,u=233*b+168;if(h=z[u])return b=\nh.i,h.result;h=b;var k=Aa();k!==d&&(B=h,k=[\"atomicType\"].concat(k));h=k;z[u]={i:b,result:h};return h}function Nq(){var h,u=233*b+169;if(h=z[u])return b=h.i,h.result;var k;h=233*b+171;if(k=z[h])b=k.i,h=k.result;else{k=b;if(f.substr(b,14)===tr){var l=tr;b+=14}else l=d,0===w&&x($x);if(l!==d){F();l=ur();l===d&&(l=vr());l===d&&(l=null);F();if(41===f.charCodeAt(b)){var n=Oa;b++}else n=d,0===w&&x(Pa);n!==d?(B=k,k=[\"documentTest\"].concat(l?[l]:[])):(b=k,k=d)}else b=k,k=d;z[h]={i:b,result:k};h=k}if(h===d&&\n(h=ur(),h===d)){h=233*b+176;if(k=z[h])b=k.i,h=k.result;else{k=b;f.substr(b,10)===Xi?(l=Xi,b+=10):(l=d,0===w&&x(wr));if(l!==d)if(F(),l=xr(),l!==d)if(F(),44===f.charCodeAt(b)?(n=ua,b++):(n=d,0===w&&x(va)),n!==d)if(F(),n=Aa(),n!==d){F();if(41===f.charCodeAt(b)){var q=Oa;b++}else q=d,0===w&&x(Pa);q!==d?(B=k,k=[\"attributeTest\",[\"attributeName\",l],[\"typeName\"].concat(n)]):(b=k,k=d)}else b=k,k=d;else b=k,k=d;else b=k,k=d;else b=k,k=d;k===d&&(k=b,f.substr(b,10)===Xi?(l=Xi,b+=10):(l=d,0===w&&x(wr)),l!==d?\n(F(),l=xr(),l!==d?(F(),41===f.charCodeAt(b)?(n=Oa,b++):(n=d,0===w&&x(Pa)),n!==d?(B=k,k=[\"attributeTest\",[\"attributeName\",l]]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),k===d&&(k=b,f.substr(b,11)===yr?(l=yr,b+=11):(l=d,0===w&&x(ay)),l!==d&&(B=k,l=[\"attributeTest\"]),k=l));z[h]={i:b,result:k};h=k}h===d&&(h=vr(),h===d&&(h=233*b+178,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,17)===zr?(l=zr,b+=17):(l=d,0===w&&x(by)),l!==d?(F(),l=Aa(),l!==d?(F(),41===f.charCodeAt(b)?(n=Oa,b++):(n=d,0===w&&x(Pa)),n!==d?(B=k,k=[\"schemaAttributeTest\"].concat(l)):\n(b=k,k=d)):(b=k,k=d)):(b=k,k=d),z[h]={i:b,result:k},h=k),h===d&&(h=233*b+175,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,23)===Yi?(l=Yi,b+=23):(l=d,0===w&&x(Ar)),l!==d?(F(),l=Kb(),l!==d?(F(),41===f.charCodeAt(b)?(n=Oa,b++):(n=d,0===w&&x(Pa)),n!==d?(B=k,k=[\"piTest\",[\"piTarget\",l]]):(b=k,k=d)):(b=k,k=d)):(b=k,k=d),k===d&&(k=b,f.substr(b,23)===Yi?(l=Yi,b+=23):(l=d,0===w&&x(Ar)),l!==d?(F(),l=bb(),l!==d?(F(),41===f.charCodeAt(b)?(n=Oa,b++):(n=d,0===w&&x(Pa)),n!==d?(B=k,k=[\"piTest\",[\"piTarget\",l]]):(b=\nk,k=d)):(b=k,k=d)):(b=k,k=d),k===d&&(k=b,f.substr(b,24)===Br?(l=Br,b+=24):(l=d,0===w&&x(cy)),l!==d&&(B=k,l=[\"piTest\"]),k=l)),z[h]={i:b,result:k},h=k),h===d&&(h=233*b+173,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,9)===Cr?(l=Cr,b+=9):(l=d,0===w&&x(dy)),l!==d&&(B=k,l=[\"commentTest\"]),k=l,z[h]={i:b,result:k},h=k),h===d&&(h=233*b+172,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,6)===Dr?(l=Dr,b+=6):(l=d,0===w&&x(ey)),l!==d&&(B=k,l=[\"textTest\"]),k=l,z[h]={i:b,result:k},h=k),h===d&&(h=233*b+174,(k=z[h])?\n(b=k.i,h=k.result):(k=b,f.substr(b,16)===Er?(l=Er,b+=16):(l=d,0===w&&x(fy)),l!==d&&(B=k,l=[\"namespaceTest\"]),k=l,z[h]={i:b,result:k},h=k),h===d&&(h=233*b+170,(k=z[h])?(b=k.i,h=k.result):(k=b,f.substr(b,6)===Fr?(l=Fr,b+=6):(l=d,0===w&&x(gy)),l!==d&&(B=k,l=[\"anyKindTest\"]),k=l,z[h]={i:b,result:k},h=k))))))))}z[u]={i:b,result:h};return h}function xr(){var h,u=233*b+177;if(h=z[u])return b=h.i,h.result;h=b;var k=Aa();k!==d&&(B=h,k=[\"QName\"].concat(k));h=k;h===d&&(h=b,42===f.charCodeAt(b)?(k=vc,b++):(k=\nd,0===w&&x(wc)),k!==d&&(B=h,k=[\"star\"]),h=k);z[u]={i:b,result:h};return h}function ur(){var h,u=233*b+179;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,7)===Lb){var k=Lb;b+=7}else k=d,0===w&&x(he);if(k!==d)if(F(),40===f.charCodeAt(b)?(k=fb,b++):(k=d,0===w&&x(gb)),k!==d)if(F(),k=Gr(),k!==d){F();if(44===f.charCodeAt(b)){var l=ua;b++}else l=d,0===w&&x(va);if(l!==d)if(F(),l=Aa(),l!==d){F();if(41===f.charCodeAt(b)){var n=Oa;b++}else n=d,0===w&&x(Pa);n!==d?(B=h,h=[\"elementTest\",[\"elementName\",k],[\"typeName\"].concat(l)]):\n(b=h,h=d)}else b=h,h=d;else b=h,h=d}else b=h,h=d;else b=h,h=d;else b=h,h=d;h===d&&(h=b,f.substr(b,7)===Lb?(k=Lb,b+=7):(k=d,0===w&&x(he)),k!==d?(F(),40===f.charCodeAt(b)?(k=fb,b++):(k=d,0===w&&x(gb)),k!==d?(F(),k=Gr(),k!==d?(F(),41===f.charCodeAt(b)?(l=Oa,b++):(l=d,0===w&&x(Pa)),l!==d?(B=h,h=[\"elementTest\",[\"elementName\",k]]):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)):(b=h,h=d),h===d&&(h=b,f.substr(b,7)===Lb?(k=Lb,b+=7):(k=d,0===w&&x(he)),k!==d?(F(),40===f.charCodeAt(b)?(k=fb,b++):(k=d,0===w&&x(gb)),k!==d?(F(),\n41===f.charCodeAt(b)?(k=Oa,b++):(k=d,0===w&&x(Pa)),k!==d?(B=h,h=[\"elementTest\"]):(b=h,h=d)):(b=h,h=d)):(b=h,h=d)));z[u]={i:b,result:h};return h}function Gr(){var h,u=233*b+180;if(h=z[u])return b=h.i,h.result;h=b;var k=Aa();k!==d&&(B=h,k=[\"QName\"].concat(k));h=k;h===d&&(h=b,42===f.charCodeAt(b)?(k=vc,b++):(k=d,0===w&&x(wc)),k!==d&&(B=h,k=[\"star\"]),h=k);z[u]={i:b,result:h};return h}function vr(){var h,u=233*b+181;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,14)===Zi){var k=Zi;b+=14}else k=d,0===\nw&&x(Hr);if(k!==d)if(F(),40===f.charCodeAt(b)?(k=fb,b++):(k=d,0===w&&x(gb)),k!==d)if(k=Aa(),k!==d){if(41===f.charCodeAt(b)){var l=Oa;b++}else l=d,0===w&&x(Pa);l!==d?(B=h,h=[\"schemaElementTest\"].concat(k)):(b=h,h=d)}else b=h,h=d;else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function Aa(){var h,u=233*b+192;if(h=z[u])return b=h.i,h.result;h=b;var k;var l=233*b+197;if(k=z[l])b=k.i,l=k.result;else{k=b;var n=Pq();if(n!==d){var q=Kb();q!==d?(B=k,k=[n,q]):(b=k,k=d)}else b=k,k=d;z[l]={i:b,result:k};\nl=k}l!==d&&(B=h,h=l,l={},l=[(l.prefix=null,l.URI=h[0],l),h[1]]);h=l;h===d&&(h=Ui());z[u]={i:b,result:h};return h}function hl(){var h,u=233*b+193;if(h=z[u])return b=h.i,h.result;h=b;var k=xe();k!==d&&(B=h,k=[\"integerConstantExpr\",[\"value\",k]]);h=k;z[u]={i:b,result:h};return h}function bb(){var h,u,k=233*b+196;if(h=z[k])return b=h.i,h.result;B=h=b;(u=m.Ra)?u=void 0:u=d;if(u!==d)if(34===f.charCodeAt(b)?(u=ye,b++):(u=d,0===w&&x(ze)),u!==d){u=[];var l=Mg();l===d&&(l=Ng(),l===d&&(l=Df(),l===d&&(Ir.test(f.charAt(b))?\n(l=f.charAt(b),b++):(l=d,0===w&&x(Jr)))));for(;l!==d;)u.push(l),l=Mg(),l===d&&(l=Ng(),l===d&&(l=Df(),l===d&&(Ir.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Jr)))));34===f.charCodeAt(b)?(l=ye,b++):(l=d,0===w&&x(ze));l!==d?(B=h,h=u.join(\"\")):(b=h,h=d)}else b=h,h=d;else b=h,h=d;if(h===d){B=h=b;(u=m.Ra)?u=void 0:u=d;if(u!==d)if(39===f.charCodeAt(b)?(u=Ae,b++):(u=d,0===w&&x(Be)),u!==d){u=[];l=Mg();l===d&&(l=Ng(),l===d&&(l=Ef(),l===d&&(Kr.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Lr)))));\nfor(;l!==d;)u.push(l),l=Mg(),l===d&&(l=Ng(),l===d&&(l=Ef(),l===d&&(Kr.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Lr)))));39===f.charCodeAt(b)?(l=Ae,b++):(l=d,0===w&&x(Be));l!==d?(B=h,h=u.join(\"\")):(b=h,h=d)}else b=h,h=d;else b=h,h=d;if(h===d){B=h=b;(u=!m.Ra)?u=void 0:u=d;if(u!==d)if(34===f.charCodeAt(b)?(u=ye,b++):(u=d,0===w&&x(ze)),u!==d){u=[];l=Df();l===d&&(Mr.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Nr)));for(;l!==d;)u.push(l),l=Df(),l===d&&(Mr.test(f.charAt(b))?(l=f.charAt(b),\nb++):(l=d,0===w&&x(Nr)));34===f.charCodeAt(b)?(l=ye,b++):(l=d,0===w&&x(ze));l!==d?(B=h,h=u.join(\"\")):(b=h,h=d)}else b=h,h=d;else b=h,h=d;if(h===d)if(B=h=b,(u=!m.Ra)?u=void 0:u=d,u!==d)if(39===f.charCodeAt(b)?(u=Ae,b++):(u=d,0===w&&x(Be)),u!==d){u=[];l=Ef();l===d&&(Or.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Pr)));for(;l!==d;)u.push(l),l=Ef(),l===d&&(Or.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Pr)));39===f.charCodeAt(b)?(l=Ae,b++):(l=d,0===w&&x(Be));l!==d?(B=h,h=u.join(\"\")):(b=\nh,h=d)}else b=h,h=d;else b=h,h=d}}z[k]={i:b,result:h};return h}function Pq(){var h,u=233*b+198;if(h=z[u])return b=h.i,h.result;h=b;if(81===f.charCodeAt(b)){var k=hy;b++}else k=d,0===w&&x(iy);if(k!==d)if(F(),123===f.charCodeAt(b)?(k=Fd,b++):(k=d,0===w&&x(Gd)),k!==d){k=[];if(Qr.test(f.charAt(b))){var l=f.charAt(b);b++}else l=d,0===w&&x(Rr);for(;l!==d;)k.push(l),Qr.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Rr));125===f.charCodeAt(b)?(l=Hd,b++):(l=d,0===w&&x(Id));l!==d?(B=h,h=k.join(\"\").replace(/\\s+/g,\n\" \").trim()):(b=h,h=d)}else b=h,h=d;else b=h,h=d;z[u]={i:b,result:h};return h}function Mg(){var h,u=233*b+199;if(h=z[u])return b=h.i,h.result;var k=h=b;if(38===f.charCodeAt(b)){var l=jy;b++}else l=d,0===w&&x(ky);if(l!==d){if(f.substr(b,2)===Ai){var n=Ai;b+=2}else n=d,0===w&&x(Pp);n===d&&(f.substr(b,2)===Bi?(n=Bi,b+=2):(n=d,0===w&&x(Rp)),n===d&&(f.substr(b,3)===Sr?(n=Sr,b+=3):(n=d,0===w&&x(ly)),n===d&&(f.substr(b,4)===Tr?(n=Tr,b+=4):(n=d,0===w&&x(my)),n===d&&(f.substr(b,4)===Ur?(n=Ur,b+=4):(n=d,0===\nw&&x(ny))))));if(n!==d){if(59===f.charCodeAt(b)){var q=$h;b++}else q=d,0===w&&x(ai);q!==d?k=l=[l,n,q]:(b=k,k=d)}else b=k,k=d}else b=k,k=d;h=k!==d?f.substring(h,b):k;z[u]={i:b,result:h};return h}function Df(){var h,u=233*b+200;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,2)===Vr){var k=Vr;b+=2}else k=d,0===w&&x(oy);k!==d&&(B=h,k='\"');h=k;z[u]={i:b,result:h};return h}function Ef(){var h,u=233*b+201;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,2)===Wr){var k=Wr;b+=2}else k=d,0===w&&x(py);k!==\nd&&(B=h,k=\"'\");h=k;z[u]={i:b,result:h};return h}function sl(){var h,u=233*b+205;if(h=z[u])return b=h.i,h.result;h=b;if(f.substr(b,2)===$i){var k=$i;b+=2}else k=d,0===w&&x(Xr);if(k!==d){var l=[];var n=Yr();for(n===d&&(n=sl());n!==d;)l.push(n),n=Yr(),n===d&&(n=sl());f.substr(b,2)===aj?(n=aj,b+=2):(n=d,0===w&&x(Zr));n!==d?h=k=[k,l,n]:(b=h,h=d)}else b=h,h=d;z[u]={i:b,result:h};return h}function Ng(){var h,u=233*b+207;if(h=z[u])return b=h.i,h.result;var k=h=b;if(f.substr(b,3)===$r){var l=$r;b+=3}else l=\nd,0===w&&x(qy);if(l!==d){var n=[];if(as.test(f.charAt(b))){var q=f.charAt(b);b++}else q=d,0===w&&x(bs);if(q!==d)for(;q!==d;)n.push(q),as.test(f.charAt(b))?(q=f.charAt(b),b++):(q=d,0===w&&x(bs));else n=d;n!==d?(59===f.charCodeAt(b)?(q=$h,b++):(q=d,0===w&&x(ai)),q!==d?k=l=[l,n,q]:(b=k,k=d)):(b=k,k=d)}else b=k,k=d;h=k!==d?f.substring(h,b):k;if(h===d){k=h=b;f.substr(b,2)===cs?(l=cs,b+=2):(l=d,0===w&&x(ry));if(l!==d){n=[];zf.test(f.charAt(b))?(q=f.charAt(b),b++):(q=d,0===w&&x(Af));if(q!==d)for(;q!==d;)n.push(q),\nzf.test(f.charAt(b))?(q=f.charAt(b),b++):(q=d,0===w&&x(Af));else n=d;n!==d?(59===f.charCodeAt(b)?(q=$h,b++):(q=d,0===w&&x(ai)),q!==d?k=l=[l,n,q]:(b=k,k=d)):(b=k,k=d)}else b=k,k=d;h=k!==d?f.substring(h,b):k}z[u]={i:b,result:h};return h}function Ui(){var h,u=233*b+208;if(h=z[u])return b=h.i,h.result;var k;h=233*b+224;if(k=z[h])b=k.i,h=k.result;else{var l=b;k=Kb();if(k!==d){if(58===f.charCodeAt(b)){var n=Vi;b++}else n=d,0===w&&x(Wi);n!==d?(n=Kb(),n!==d?(B=l,l={},l=[(l.prefix=k,l),n]):(b=l,l=d)):(b=l,\nl=d)}else b=l,l=d;z[h]={i:b,result:l};h=l}h===d&&(h=233*b+225,(k=z[h])?(b=k.i,h=k.result):(k=b,l=Kb(),l!==d&&(B=k,l=[l]),k=l,z[h]={i:b,result:k},h=k));z[u]={i:b,result:h};return h}function Kb(){var h,u,k=233*b+209;if(h=z[k])return b=h.i,h.result;h=b;var l=ol();if(l!==d){var n=[];for(u=tl();u!==d;)n.push(u),u=tl();B=h;h=l+n.join(\"\")}else b=h,h=d;z[k]={i:b,result:h};return h}function Rb(){var h,u=233*b+210;if(h=z[u])return b=h.i,h.result;sy.test(f.charAt(b))?(h=f.charAt(b),b++):(h=d,0===w&&x(ty));if(h===\nd){h=b;if(uy.test(f.charAt(b))){var k=f.charAt(b);b++}else k=d,0===w&&x(vy);if(k!==d){if(ds.test(f.charAt(b))){var l=f.charAt(b);b++}else l=d,0===w&&x(es);l!==d?h=k=[k,l]:(b=h,h=d)}else b=h,h=d}z[u]={i:b,result:h};return h}function xe(){var h,u=233*b+211;if(h=z[u])return b=h.i,h.result;h=b;var k=[];if(zf.test(f.charAt(b))){var l=f.charAt(b);b++}else l=d,0===w&&x(Af);if(l!==d)for(;l!==d;)k.push(l),zf.test(f.charAt(b))?(l=f.charAt(b),b++):(l=d,0===w&&x(Af));else k=d;k!==d&&(B=h,k=k.join(\"\"));h=k;z[u]=\n{i:b,result:h};return h}function Yr(){var h,u=233*b+212;if(h=z[u])return b=h.i,h.result;var k=h=b;w++;if(f.substr(b,2)===$i){var l=$i;b+=2}else l=d,0===w&&x(Xr);w--;l===d?k=void 0:(b=k,k=d);if(k!==d){l=b;w++;if(f.substr(b,2)===aj){var n=aj;b+=2}else n=d,0===w&&x(Zr);w--;n===d?l=void 0:(b=l,l=d);l!==d?(n=Rb(),n!==d?h=k=[k,l,n]:(b=h,h=d)):(b=h,h=d)}else b=h,h=d;z[u]={i:b,result:h};return h}function Nk(){var h,u=233*b+219;if(h=z[u])return b=h.i,h.result;h=b;var k=jl();if(k!==d){F();if(f.substr(b,2)===\nMb){var l=Mb;b+=2}else l=d,0===w&&x(ie);l!==d?(F(),l=ta(),l!==d?(B=h,h=[\"transformCopy\",k,[\"copySource\",l]]):(b=h,h=d)):(b=h,h=d)}else b=h,h=d;z[u]={i:b,result:h};return h}function F(){var h,u,k=233*b+220;if(h=z[k])return b=h.i,h.result;h=[];for(u=Og();u!==d;)h.push(u),u=Og();z[k]={i:b,result:h};return h}function P(){var h,u=233*b+221;if(h=z[u])return b=h.i,h.result;h=[];var k=Og();if(k!==d)for(;k!==d;)h.push(k),k=Og();else h=d;z[u]={i:b,result:h};return h}function Bf(){var h,u=233*b+222;if(h=z[u])return b=\nh.i,h.result;h=[];if(32===f.charCodeAt(b)){var k=ul;b++}else k=d,0===w&&x(vl);k===d&&(9===f.charCodeAt(b)?(k=wl,b++):(k=d,0===w&&x(xl)),k===d&&(13===f.charCodeAt(b)?(k=yl,b++):(k=d,0===w&&x(zl)),k===d&&(10===f.charCodeAt(b)?(k=Al,b++):(k=d,0===w&&x(Bl)))));if(k!==d)for(;k!==d;)h.push(k),32===f.charCodeAt(b)?(k=ul,b++):(k=d,0===w&&x(vl)),k===d&&(9===f.charCodeAt(b)?(k=wl,b++):(k=d,0===w&&x(xl)),k===d&&(13===f.charCodeAt(b)?(k=yl,b++):(k=d,0===w&&x(zl)),k===d&&(10===f.charCodeAt(b)?(k=Al,b++):(k=d,\n0===w&&x(Bl)))));else h=d;z[u]={i:b,result:h};return h}function Og(){var h,u=233*b+223;if(h=z[u])return b=h.i,h.result;32===f.charCodeAt(b)?(h=ul,b++):(h=d,0===w&&x(vl));h===d&&(9===f.charCodeAt(b)?(h=wl,b++):(h=d,0===w&&x(xl)),h===d&&(13===f.charCodeAt(b)?(h=yl,b++):(h=d,0===w&&x(zl)),h===d&&(10===f.charCodeAt(b)?(h=Al,b++):(h=d,0===w&&x(Bl)),h===d&&(h=sl()))));z[u]={i:b,result:h};return h}function ol(){var h,u=233*b+226;if(h=z[u])return b=h.i,h.result;wy.test(f.charAt(b))?(h=f.charAt(b),b++):(h=\nd,0===w&&x(xy));if(h===d){h=b;if(yy.test(f.charAt(b))){var k=f.charAt(b);b++}else k=d,0===w&&x(zy);if(k!==d){if(ds.test(f.charAt(b))){var l=f.charAt(b);b++}else l=d,0===w&&x(es);l!==d?h=k=[k,l]:(b=h,h=d)}else b=h,h=d}z[u]={i:b,result:h};return h}function tl(){var h,u=233*b+227;if(h=z[u])return b=h.i,h.result;h=ol();h===d&&(Ay.test(f.charAt(b))?(h=f.charAt(b),b++):(h=d,0===w&&x(By)));z[u]={i:b,result:h};return h}function kr(){var h,u=233*b+228;if(h=z[u])return b=h.i,h.result;h=tl();h===d&&(58===f.charCodeAt(b)?\n(h=Vi,b++):(h=d,0===w&&x(Wi)));z[u]={i:b,result:h};return h}function Vo(){var h,u=233*b+231;if(h=z[u])return b=h.i,h.result;f.substr(b,5)===Vd?(h=Vd,b+=5):(h=d,0===w&&x(Si));h===d&&(f.substr(b,9)===wf?(h=wf,b+=9):(h=d,0===w&&x(fl)),h===d&&(f.substr(b,7)===Pi?(h=Pi,b+=7):(h=d,0===w&&x(Zq)),h===d&&(f.substr(b,13)===fs?(h=fs,b+=13):(h=d,0===w&&x(Cy)),h===d&&(f.substr(b,7)===Lb?(h=Lb,b+=7):(h=d,0===w&&x(he)),h===d&&(f.substr(b,14)===gs?(h=gs,b+=14):(h=d,0===w&&x(Dy)),h===d&&(f.substr(b,8)===cc?(h=cc,\nb+=8):(h=d,0===w&&x(Ue)),h===d&&(f.substr(b,2)===li?(h=li,b+=2):(h=d,0===w&&x(ip)),h===d&&(f.substr(b,4)===hi?(h=hi,b+=4):(h=d,0===w&&x($o)),h===d&&(f.substr(b,3)===Td?(h=Td,b+=3):(h=d,0===w&&x(Ri)),h===d&&(f.substr(b,14)===hs?(h=hs,b+=14):(h=d,0===w&&x(Ey)),h===d&&(f.substr(b,4)===Nc?(h=Nc,b+=4):(h=d,0===w&&x(rg)),h===d&&(f.substr(b,22)===Qi?(h=Qi,b+=22):(h=d,0===w&&x($q)),h===d&&(f.substr(b,16)===is?(h=is,b+=16):(h=d,0===w&&x(Fy)),h===d&&(f.substr(b,14)===Zi?(h=Zi,b+=14):(h=d,0===w&&x(Hr)),h===\nd&&(f.substr(b,6)===js?(h=js,b+=6):(h=d,0===w&&x(Gy)),h===d&&(f.substr(b,4)===Oi?(h=Oi,b+=4):(h=d,0===w&&x(Yq)),h===d&&(f.substr(b,10)===ki?(h=ki,b+=10):(h=d,0===w&&x(gp)))))))))))))))))));z[u]={i:b,result:h};return h}function za(){var h,u=233*b+232;if(h=z[u])return b=h.i,h.result;h=b;w++;if(40===f.charCodeAt(b)){var k=fb;b++}else k=d,0===w&&x(gb);k===d&&(34===f.charCodeAt(b)?(k=ye,b++):(k=d,0===w&&x(ze)),k===d&&(39===f.charCodeAt(b)?(k=Ae,b++):(k=d,0===w&&x(Be)),k===d&&(k=Og())));w--;k!==d?(b=h,\nh=void 0):h=d;z[u]={i:b,result:h};return h}function vi(h,u,k){return k.reduce(function(l,n){return[h,[\"firstOperand\",l],[\"secondOperand\",n]]},u)}function ks(h){1<=h&&55295>=h||57344<=h&&65533>=h||65536<=h&&1114111>=h||Lg(\"XQST0090\",\"The character reference \"+h+\" (\"+h.toString(16)+\") does not reference a valid codePoint.\")}function Ti(h){return m.Ra?h.replace(/(&[^;]+);/g,function(u){if(/^/.test(u))return u=parseInt(u.slice(3,-1),16),ks(u),String.fromCodePoint(u);if(/^/.test(u))return u=parseInt(u.slice(2,\n-1),10),ks(u),String.fromCodePoint(u);switch(u){case \"<\":return\"<\";case \">\":return\">\";case \"&\":return\"&\";case \""\":return String.fromCharCode(34);case \"'\":return String.fromCharCode(39)}Lg(\"XPST0003\",'Unknown character reference: \"'+u+'\"')}):h}function nl(h,u,k){if(!h.length)return[];for(var l=[h[0]],n=1;n\",Wp=\"!=\",Xp=\"<=\",Yp=\"<\",$p=\">=\",Vk=\">\",Np=\"eq\",Op=\"ne\",Ai=\"lt\",Qp=\"le\",Bi=\"gt\",Sp=\"ge\",Tp=\"is\",Up=\"<<\",Vp=\">>\",rq=\"validate\",uq=\"type\",sq=\"lax\",tq=\"strict\",yq=\"(#\",tf=\"#)\",wq=\"!\",Mi=\"/\",Mq=\"//\",\nGq=\"child\",Za=\"::\",Hq=\"descendant\",wf=\"attribute\",Iq=\"self\",Jq=\"descendant-or-self\",Kq=\"following-sibling\",Lq=\"following\",kx=\"@\",Aq=\"parent\",Bq=\"ancestor\",Cq=\"preceding-sibling\",Dq=\"preceding\",Eq=\"ancestor-or-self\",Fq=\"..\",Oq=\"*:\",Qq=\":*\",Rq=\"[\",Tq=\"]\",Ig=\"?\",xf=\".\",er=\"/>\",gr=\"\",ye='\"',Ae=\"'\",or=\"{{\",pr=\"}}\",hr=\"\\x3c!--\",ir=\"--\\x3e\",jr=\"\",Cf=\"?>\",nr=\"\",!1),Iw=G(\"!=\",!1),Jw=G(\"<=\",!1),Zp=G(\"<\",!1),Kw=G(\">=\",!1),Wk=G(\">\",!1),Bw=G(\"eq\",!1),Cw=G(\"ne\",!1),Pp=G(\"lt\",!1),Dw=G(\"le\",!1),Rp=G(\"gt\",!1),Ew=G(\"ge\",!1),Fw=G(\"is\",!1),Gw=G(\"<<\",!1),Hw=G(\">>\",!1),Qw=G(\"validate\",\n!1),Tw=G(\"type\",!1),Rw=G(\"lax\",!1),Sw=G(\"strict\",!1),Uw=G(\"(#\",!1),bl=G(\"#)\",!1),xq=G(\"!\",!1),Ni=G(\"/\",!1),Ww=X([\"*\",\"<\",[\"a\",\"z\"],[\"A\",\"Z\"]],!1,!1),Yw=X([\"*\",[\"a\",\"z\"],[\"A\",\"Z\"]],!1,!1),mx=G(\"//\",!1),ex=G(\"child\",!1),hc=G(\"::\",!1),fx=G(\"descendant\",!1),fl=G(\"attribute\",!1),gx=G(\"self\",!1),hx=G(\"descendant-or-self\",!1),ix=G(\"following-sibling\",!1),jx=G(\"following\",!1),lx=G(\"@\",!1),Zw=G(\"parent\",!1),$w=G(\"ancestor\",!1),ax=G(\"preceding-sibling\",!1),bx=G(\"preceding\",!1),cx=G(\"ancestor-or-self\",!1),dx=\nG(\"..\",!1),nx=G(\"*:\",!1),ox=G(\":*\",!1),Sq=G(\"[\",!1),Uq=G(\"]\",!1),Jg=G(\"?\",!1),xx=X([[\"a\",\"z\"],[\"A\",\"Z\"]],!1,!1),yf=G(\".\",!1),yx=G(\"/>\",!1),zx=G(\"\",!1),ze=G('\"',!1),Be=G(\"'\",!1),Wx=G(\"{{\",!1),Xx=G(\"}}\",!1),Ax=G(\"\\x3c!--\",!1),Bx=G(\"--\\x3e\",!1),Cx=G(\"\",!1),pl=G(\"?>\",!1),Tx=G(\"f;f++)if(p=wu(g[f],c,e[m]))return 59!==p.type&&hm(a,p),p;default:return{type:59,g:2}}}59!==g.type&&hm(a,g);return g}\nfunction wu(a,c,e){var g=em(a,\"*\"),f=W(a,\"atomicType\");if(!f)return{type:59,g:2};if(Xc(cm(f,\"prefix\")+\":\"+f[2])===c.type)if(1===g.length){if(3===c.g)return e}else if(a=W(a,\"occurrenceIndicator\")[1],c.g===Zc(a))return e};function xu(a,c){ku(a,c)}function ku(a,c){var e=yu.get(a[0]);if(e)return e(a,c);for(e=1;e=c+e)return Q;t=f.next(t);g++;return t}},m)}function Pu(a){return a.map(function(c){return T(c.type,19)?Gh(c,3):c})}\nfunction Qu(a){a=Pu(a);if(a.some(function(c){return Number.isNaN(c.value)}))return[L(NaN,3)];a=Vn(a);if(!a)throw Error(\"FORG0006: Incompatible types to be converted to a common type\");return a}\nfunction Ru(a,c,e,g,f,m){return ce([f,m],function(p){var t=H(p);p=t.next().value;t=t.next().value;if(Infinity===p.value)return U.empty();if(-Infinity===p.value)return t&&Infinity===t.value?U.empty():g;if(t){if(isNaN(t.value))return U.empty();Infinity===t.value&&(t=null)}return isNaN(p.value)?U.empty():Ou(g,Math.round(p.value),t?Math.round(t.value):null)})}\nfunction Su(a,c,e,g,f){if(g.F())return f;a=Pu(g.S());a=Vn(a);if(!a)throw Error(\"FORG0006: Incompatible types to be converted to a common type\");if(!a.every(function(m){return T(m.type,2)}))throw Error(\"FORG0006: items passed to fn:sum are not all numeric.\");c=a.reduce(function(m,p){return m+p.value},0);return a.every(function(m){return T(m.type,5)})?U.s(L(c,5)):a.every(function(m){return T(m.type,3)})?U.s(L(c,3)):a.every(function(m){return T(m.type,4)})?U.s(L(c,4)):U.s(L(c,6))};var Tu=[].concat(Ll,[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"boolean\",l:[{type:59,g:2}],j:{type:0,g:3},m:function(a,c,e,g){return g.getEffectiveBooleanValue()?U.$():U.U()}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"true\",l:[],j:{type:0,g:3},m:function(){return U.$()}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"not\",l:[{type:59,g:2}],j:{type:0,g:3},m:function(a,c,e,g){return!1===g.getEffectiveBooleanValue()?U.$():U.U()}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nlocalName:\"false\",l:[],j:{type:0,g:3},m:function(){return U.U()}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"last\",l:[],j:{type:5,g:3},m:function(a){if(null===a.O)throw Error(\"XPDY0002: The fn:last() function depends on dynamic context, which is absent.\");var c=!1;return U.create({next:function(){if(c)return Q;var e=a.wa.ya();c=!0;return S(L(e,5))}},1)}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"position\",l:[],j:{type:5,g:3},m:function(a){if(null===\na.O)throw Error(\"XPDY0002: The fn:position() function depends on dynamic context, which is absent.\");return U.s(L(a.Ga+1,5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"current-dateTime\",l:[],j:{type:10,g:3},m:function(a){return U.s(L(Zf(a),10))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"current-date\",l:[],j:{type:7,g:3},m:function(a){return U.s(L(Jf(Zf(a),7),7))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"current-time\",l:[],\nj:{type:8,g:3},m:function(a){return U.s(L(Jf(Zf(a),8),8))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"implicit-timezone\",l:[],j:{type:17,g:3},m:function(a){return U.s(L($f(a),17))}}],Nl,Vl,Xl,[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"years-from-duration\",l:[{type:18,g:0}],j:{type:5,g:0},m:function(a,c,e,g){return g.F()?g:U.s(L(g.first().value.cb(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"months-from-duration\",l:[{type:18,\ng:0}],j:{type:5,g:0},m:function(a,c,e,g){return g.F()?g:U.s(L(g.first().value.$a(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"days-from-duration\",l:[{type:18,g:0}],j:{type:5,g:0},m:function(a,c,e,g){return g.F()?g:U.s(L(g.first().value.Za(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"hours-from-duration\",l:[{type:18,g:0}],j:{type:5,g:0},m:function(a,c,e,g){return g.F()?g:U.s(L(g.first().value.getHours(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nlocalName:\"minutes-from-duration\",l:[{type:18,g:0}],j:{type:5,g:0},m:function(a,c,e,g){return g.F()?g:U.s(L(g.first().value.getMinutes(),5))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"seconds-from-duration\",l:[{type:18,g:0}],j:{type:4,g:0},m:function(a,c,e,g){return g.F()?g:U.s(L(g.first().value.getSeconds(),4))}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"id\",l:[{type:1,g:2},{type:53,g:3}],j:{type:54,g:2},m:Ku},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nlocalName:\"id\",l:[{type:1,g:2}],j:{type:54,g:2},m:function(a,c,e,g){return Ku(a,c,e,g,U.s(a.O))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"idref\",l:[{type:1,g:2},{type:53,g:3}],j:{type:53,g:2},m:Lu},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"idref\",l:[{type:1,g:2}],j:{type:53,g:2},m:function(a,c,e,g){return Lu(a,c,e,g,U.s(a.O))}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"parse-json\",l:[{type:1,g:3}],j:{type:59,g:0},m:function(a,\nc,e,g){try{var f=JSON.parse(g.first().value)}catch(m){throw Error(\"FOJS0001: parsed JSON string contains illegal JSON.\");}return Mu(f)}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"contains\",l:[{type:61,g:3},{type:46,g:3}],j:{type:0,g:3},m:function(a,c,e,g,f){return ce([g,f],function(m){m=H(m);var p=m.next().value,t=m.next().value;return p.h.some(function(v){return de(v.key,t)})?U.$():U.U()})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"entry\",\nl:[{type:46,g:3},{type:59,g:2}],j:{type:61,g:3},m:function(a,c,e,g,f){return g.map(function(m){return new fe([{key:m,value:Rc(f)}])})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"for-each\",l:[{type:61,g:3},{type:59,g:2}],j:{type:59,g:2},m:function(a,c,e,g,f){return ce([g,f],function(m){m=H(m);var p=m.next().value,t=m.next().value;return cg(p.h.map(function(v){return t.value.call(void 0,a,c,e,U.s(v.key),v.value())}))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",\nlocalName:\"get\",l:[{type:61,g:3},{type:46,g:3}],j:{type:59,g:2},m:ee},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"keys\",l:[{type:61,g:3}],j:{type:46,g:2},m:function(a,c,e,g){return ce([g],function(f){f=H(f).next().value;return U.create(f.h.map(function(m){return m.key}))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"merge\",l:[{type:61,g:2},{type:61,g:3}],j:{type:61,g:3},m:Nu},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"merge\",\nl:[{type:61,g:2}],j:{type:61,g:3},m:function(a,c,e,g){return Nu(a,c,e,g,U.s(new fe([{key:L(\"duplicates\",1),value:function(){return U.s(L(\"use-first\",1))}}])))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"put\",l:[{type:61,g:3},{type:46,g:3},{type:59,g:2}],j:{type:61,g:3},m:function(a,c,e,g,f,m){return ce([g,f],function(p){p=H(p);var t=p.next().value,v=p.next().value;p=t.h.concat();t=p.findIndex(function(A){return de(A.key,v)});0<=t?p.splice(t,1,{key:v,value:Rc(m)}):p.push({key:v,\nvalue:Rc(m)});return U.s(new fe(p))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"remove\",l:[{type:61,g:3},{type:46,g:2}],j:{type:61,g:3},m:function(a,c,e,g,f){return ce([g],function(m){var p=H(m).next().value.h.concat();return f.M(function(t){t.forEach(function(v){var A=p.findIndex(function(E){return de(E.key,v)});0<=A&&p.splice(A,1)});return U.s(new fe(p))})})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/map\",localName:\"size\",l:[{type:61,g:3}],j:{type:5,g:3},\nm:function(a,c,e,g){return g.map(function(f){return L(f.h.length,5)})}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"pi\",l:[],j:{type:3,g:3},m:function(){return U.s(L(Math.PI,3))}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"exp\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.pow(Math.E,f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"exp10\",l:[{type:3,g:0}],j:{type:3,\ng:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.pow(10,f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"log\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.log(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"log10\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.log10(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",\nlocalName:\"pow\",l:[{type:3,g:0},{type:2,g:3}],j:{type:3,g:0},m:function(a,c,e,g,f){return f.M(function(m){var p=H(m).next().value;return g.map(function(t){return 1!==Math.abs(t.value)||Number.isFinite(p.value)?L(Math.pow(t.value,p.value),3):L(1,3)})})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"sqrt\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.sqrt(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",\nlocalName:\"sin\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.sin(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"cos\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.cos(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"tan\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.tan(f.value),3)})}},\n{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"asin\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.asin(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"acos\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,e,g){return g.map(function(f){return L(Math.acos(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"atan\",l:[{type:3,g:0}],j:{type:3,g:0},m:function(a,c,\ne,g){return g.map(function(f){return L(Math.atan(f.value),3)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions/math\",localName:\"atan2\",l:[{type:3,g:0},{type:3,g:3}],j:{type:3,g:0},m:function(a,c,e,g,f){return f.M(function(m){var p=H(m).next().value;return g.map(function(t){return L(Math.atan2(t.value,p.value),3)})})}}],Dj,ij,[{namespaceURI:\"http://fontoxpath/operators\",localName:\"to\",l:[{type:5,g:0},{type:5,g:0}],j:{type:5,g:2},m:function(a,c,e,g,f){a=g.first();f=f.first();if(null===a||null===\nf)return U.empty();var m=a.value;f=f.value;return m>f?U.empty():U.create({next:function(){return S(L(m++,5))}},f-m+1)}}],[{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"QName\",l:[{type:1,g:0},{type:1,g:3}],j:{type:23,g:3},m:function(a,c,e,g,f){return ce([g,f],function(m){var p=H(m);m=p.next().value;p=p.next().value.value;if(!Vg(p,23))throw Error(\"FOCA0002: The provided QName is invalid.\");m=m?m.value||null:null;if(null===m&&p.includes(\":\"))throw Error(\"FOCA0002: The URI of a QName may not be empty if a prefix is provided.\");\nif(g.F())return U.s(L(new $c(\"\",null,p),23));if(!p.includes(\":\"))return U.s(L(new $c(\"\",m,p),23));var t=H(p.split(\":\"));p=t.next().value;t=t.next().value;return U.s(L(new $c(p,m,t),23))})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"prefix-from-QName\",l:[{type:23,g:0}],j:{type:24,g:0},m:function(a,c,e,g){return ce([g],function(f){f=H(f).next().value;if(null===f)return U.empty();f=f.value;return f.prefix?U.s(L(f.prefix,24)):U.empty()})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nlocalName:\"local-name-from-QName\",l:[{type:23,g:0}],j:{type:24,g:0},m:function(a,c,e,g){return g.map(function(f){return L(f.value.localName,24)})}},{namespaceURI:\"http://www.w3.org/2005/xpath-functions\",localName:\"namespace-uri-from-QName\",l:[{type:23,g:0}],j:{type:20,g:0},m:function(a,c,e,g){return g.map(function(f){return L(f.value.namespaceURI||\"\",20)})}}],[{l:[{type:59,g:2}],m:function(a,c,e,g){return g.aa({empty:function(){return U.$()},multiple:function(){return U.U()},s:function(){return U.U()}})},\nlocalName:\"empty\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:0,g:3}},{l:[{type:59,g:2}],m:function(a,c,e,g){return g.aa({empty:function(){return U.U()},multiple:function(){return U.$()},s:function(){return U.$()}})},localName:\"exists\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:0,g:3}},{l:[{type:59,g:2}],m:function(a,c,e,g){return Ou(g,1,1)},localName:\"head\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:0}},{l:[{type:59,g:2}],m:function(a,\nc,e,g){return Ou(g,2,null)},localName:\"tail\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2},{type:5,g:3},{type:59,g:2}],m:function(a,c,e,g,f,m){if(g.F())return m;if(m.F())return g;a=g.S();f=f.first().value-1;0>f?f=0:f>a.length&&(f=a.length);c=a.slice(f);return U.create(a.slice(0,f).concat(m.S(),c))},localName:\"insert-before\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2},{type:5,g:3}],m:function(a,c,e,g,f){a=f.first().value;\ng=g.S();if(!g.length||1>a||a>g.length)return U.create(g);g.splice(a-1,1);return U.create(g)},localName:\"remove\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2}],m:function(a,c,e,g){return g.M(function(f){return U.create(f.reverse())})},localName:\"reverse\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2},{type:3,g:3}],m:function(a,c,e,g,f){return Ru(a,c,e,g,f,U.empty())},localName:\"subsequence\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nj:{type:59,g:2}},{l:[{type:59,g:2},{type:3,g:3},{type:3,g:3}],m:Ru,localName:\"subsequence\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2}],m:function(a,c,e,g){return g},localName:\"unordered\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:46,g:2},{type:46,g:3}],m:function(a,c,e,g,f){return f.M(function(m){var p=H(m).next().value;return Sg(g,c).map(function(t,v){return xn(\"eqOp\",t.type,p.type)(t,p,a)?L(v+1,5):L(-1,5)}).filter(function(t){return-1!==\nt.value})})},localName:\"index-of\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:5,g:2}},{l:[{type:46,g:2},{type:46,g:3},{type:1,g:3}],m:function(){throw Error(\"FOCH0002: No collations are supported\");},localName:\"index-of\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:5,g:2}},{l:[{type:59,g:2},{type:59,g:2}],m:function(a,c,e,g,f){var m=!1,p=Jj(a,c,e,g,f);return U.create({next:function(){if(m)return Q;var t=p.next(0);if(t.done)return t;m=!0;return S(L(t.value,0))}})},\nlocalName:\"deep-equal\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:0,g:3}},{l:[{type:59,g:2},{type:59,g:2},{type:1,g:3}],m:function(){throw Error(\"FOCH0002: No collations are supported\");},localName:\"deep-equal\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:0,g:3}},{l:[{type:59,g:2}],m:function(a,c,e,g){var f=!1;return U.create({next:function(){if(f)return Q;var m=g.ya();f=!0;return S(L(m,5))}})},localName:\"count\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nj:{type:5,g:3}},{l:[{type:46,g:2}],m:function(a,c,e,g){if(g.F())return g;a=Pu(g.S());a=Vn(a);if(!a)throw Error(\"FORG0006: Incompatible types to be converted to a common type\");if(!a.every(function(f){return T(f.type,2)}))throw Error(\"FORG0006: items passed to fn:avg are not all numeric.\");c=a.reduce(function(f,m){return f+m.value},0)/a.length;return a.every(function(f){return T(f.type,5)||T(f.type,3)})?U.s(L(c,3)):a.every(function(f){return T(f.type,4)})?U.s(L(c,4)):U.s(L(c,6))},localName:\"avg\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nj:{type:46,g:0}},{l:[{type:46,g:2}],m:function(a,c,e,g){if(g.F())return g;a=Qu(g.S());return U.s(a.reduce(function(f,m){return f.valuem.value?m:f}))},localName:\"min\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:46,g:0}},{l:[{type:46,g:2},{type:1,g:3}],m:function(){throw Error(\"FOCH0002: No collations are supported\");},localName:\"min\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:46,g:0}},{l:[{type:46,g:2}],m:function(a,c,e,g){return Su(a,c,e,g,U.s(L(0,5)))},localName:\"sum\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:46,g:3}},{l:[{type:46,g:2},{type:46,g:0}],m:Su,\nlocalName:\"sum\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:46,g:0}},{l:[{type:59,g:2}],m:function(a,c,e,g){if(!g.F()&&!g.za())throw Error(\"FORG0003: The argument passed to fn:zero-or-one contained more than one item.\");return g},localName:\"zero-or-one\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:0}},{l:[{type:59,g:2}],m:function(a,c,e,g){if(g.F())throw Error(\"FORG0004: The argument passed to fn:one-or-more was empty.\");return g},localName:\"one-or-more\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",\nj:{type:59,g:1}},{l:[{type:59,g:2}],m:function(a,c,e,g){if(!g.za())throw Error(\"FORG0005: The argument passed to fn:exactly-one is empty or contained more than one item.\");return g},localName:\"exactly-one\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:3}},{l:[{type:59,g:2},{type:60,g:3}],m:function(a,c,e,g,f){if(g.F())return g;var m=f.first(),p=m.o;if(1!==p.length)throw Error(\"XPTY0004: signature of function passed to fn:filter is incompatible.\");return g.filter(function(t){t=\nWh(p[0],U.s(t),c,\"fn:filter\",!1);t=m.value.call(void 0,a,c,e,t);if(!t.za()||!T(t.first().type,0))throw Error(\"XPTY0004: signature of function passed to fn:filter is incompatible.\");return t.first().value})},localName:\"filter\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2},{type:60,g:3}],m:function(a,c,e,g,f){if(g.F())return g;var m=f.first(),p=m.o;if(1!==p.length)throw Error(\"XPTY0004: signature of function passed to fn:for-each is incompatible.\");var t=g.value,\nv;return U.create({next:function(A){for(;;){if(!v){var E=t.next(0);if(E.done)return E;E=Wh(p[0],U.s(E.value),c,\"fn:for-each\",!1);v=m.value.call(void 0,a,c,e,E).value}E=v.next(A);if(!E.done)return E;v=null}}})},localName:\"for-each\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2},{type:59,g:2},{type:60,g:3}],m:function(a,c,e,g,f,m){if(g.F())return g;var p=m.first(),t=p.o;if(2!==t.length)throw Error(\"XPTY0004: signature of function passed to fn:fold-left is incompatible.\");\nreturn g.M(function(v){return v.reduce(function(A,E){A=Wh(t[0],A,c,\"fn:fold-left\",!1);E=Wh(t[1],U.s(E),c,\"fn:fold-left\",!1);return p.value.call(void 0,a,c,e,A,E)},f)})},localName:\"fold-left\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}},{l:[{type:59,g:2},{type:59,g:2},{type:60,g:3}],m:function(a,c,e,g,f,m){if(g.F())return g;var p=m.first(),t=p.o;if(2!==t.length)throw Error(\"XPTY0004: signature of function passed to fn:fold-right is incompatible.\");return g.M(function(v){return v.reduceRight(function(A,\nE){A=Wh(t[0],A,c,\"fn:fold-right\",!1);E=Wh(t[1],U.s(E),c,\"fn:fold-right\",!1);return p.value.call(void 0,a,c,e,E,A)},f)})},localName:\"fold-right\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:59,g:2}}],sj,[{l:[{type:1,g:3},{type:61,g:3}],m:function(a,c,e,g,f){var m,p;return U.create({next:function(){if(!m){p=g.value.next(0).value.value;var t=f.first().h.reduce(function(O,R){O[R.key.value]=Rc(R.value());return O},Object.create(null)),v=t[\".\"]?t[\".\"]():U.empty();delete t[\".\"];var A=new Iu(function(O){return e.ga(O)},\nObject.keys(t).reduce(function(O,R){O[R]=R;return O},{}),function(O,R){return e.Qa(O,R)}),E=new Zt(A),I=Wt(p,{ca:!1,debug:c.debug});c.Ta&&xu(I,new Fu(E));var M=dm(I,[\"mainModule\",\"prolog\"]);M&&gu(M,E);I=dm(I,[\"mainModule\",\"queryBody\",\"*\"]);I=Qt(I,{qa:!1,ca:!0});try{I.P(E)}catch(O){Zl(p,O)}E=Object.keys(t).reduce(function(O,R){O[A.rb(null,R)]=t[R];return O},Object.create(null));v=v.F()?{O:null,Ga:-1,wa:v,ta:E}:{O:v.first(),Ga:0,wa:v,ta:E};v=new Wf(v);try{m=I.evaluate(v,c).value}catch(O){Zl(p,O)}}try{return m.next(0)}catch(O){Zl(p,\nO)}}})},localName:\"evaluate\",namespaceURI:\"http://fontoxml.com/fontoxpath\",j:{type:59,g:2}},{l:[],m:function(){return U.s(L(\"undefined\"===typeof VERSION?\"devbuild\":VERSION,1))},localName:\"version\",namespaceURI:\"http://fontoxml.com/fontoxpath\",j:{type:1,g:3}}],[{l:[{type:23,g:3},{type:5,g:3}],m:function(a,c,e,g,f){return ce([g,f],function(m){var p=H(m);m=p.next().value;p=p.next().value;var t=e.Aa(m.value.namespaceURI,m.value.localName,p.value);if(null===t)return U.empty();m=new ad({l:t.l,arity:p.value,\nlocalName:m.value.localName,namespaceURI:m.value.namespaceURI,j:t.j,value:t.m});return U.s(m)})},localName:\"function-lookup\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{g:0,type:60}},{l:[{type:60,g:3}],m:function(a,c,e,g){return ce([g],function(f){f=H(f).next().value;return f.Oa()?U.empty():U.s(L(new $c(\"\",f.v,f.J),23))})},localName:\"function-name\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:23,g:0}},{l:[{type:60,g:3}],m:function(a,c,e,g){return ce([g],function(f){f=\nH(f).next().value;return U.s(L(f.B,5))})},localName:\"function-arity\",namespaceURI:\"http://www.w3.org/2005/xpath-functions\",j:{type:5,g:3}}]);function Uu(a){this.h=a}D=Uu.prototype;D.createAttributeNS=function(a,c){return this.h.createAttributeNS(a,c)};D.createCDATASection=function(a){return this.h.createCDATASection(a)};D.createComment=function(a){return this.h.createComment(a)};D.createDocument=function(){return this.h.createDocument()};D.createElementNS=function(a,c){return this.h.createElementNS(a,c)};D.createProcessingInstruction=function(a,c){return this.h.createProcessingInstruction(a,c)};D.createTextNode=function(a){return this.h.createTextNode(a)};var Vu=Object.create(null),Wu=Object.create(null);function Xu(a,c,e,g,f,m){this.J=a;this.v=c;this.h=e;this.B=g;this.o=f;this.C=m}function Yu(a,c){return a+(c?\"_DEBUG\":\"\")}function Zu(a,c,e){c=Yu(c,e);if(e=Wu[a])return e[c]||null;a=Vu[a];return a?(a=a[c])&&0!==a.length?a[0].h:null:null}\nfunction $u(a,c,e,g,f,m,p,t){var v=Vu[a];if(!v)return(a=Zu(a,c,m))?{ia:a,sb:!0}:null;c=Yu(c,m);v=v[c];if(!v)return(a=Wu[a]&&Wu[a][c])?{ia:a,sb:!0}:null;v=v.find(function(A){return A.o===p&&A.J.every(function(E){return e(E.prefix)===E.namespaceURI})&&A.v.every(function(E){return void 0!==g[E.name]})&&A.B.every(function(E){return f[E.prefix]===E.namespaceURI})&&A.C.every(function(E){var I=t(E.oc,E.arity);return I&&I.namespaceURI===E.Jb.namespaceURI&&I.localName===E.Jb.localName})});return v?{ia:v.h,\nsb:!1}:(a=Wu[a]&&Wu[a][c])?{ia:a,sb:!0}:null}function av(a,c,e,g){c=Yu(c,e);(a=Wu[a])&&(e=a[c])&&e===g&&delete a[c]}function bv(a,c,e,g,f,m,p){av(a,c,m,f);var t=Vu[a];t||(t=Vu[a]=Object.create(null));a=Yu(c,m);(c=t[a])||(c=t[a]=[]);c.push(new Xu(Object.values(e.h),Object.values(e.o),f,Object.keys(g).map(function(v){return{namespaceURI:g[v],prefix:v}}),p,e.B))};function cv(a,c,e,g,f,m,p){var t=c.ca?\"XQuery\":\"XPath\",v=c.ob?null:$u(a,t,e,g,f,c.debug,m,p);e=new Iu(e,g,p);var A=new Zt(e);if(null!==v)g=v.ia;else{g=Wt(a,c);p=new Fu(A);c.Ta&&ku(g,p);p=W(g,\"mainModule\");if(!p)throw Error(\"Can not execute a library module.\");g=W(p,\"prolog\");p=dm(p,[\"queryBody\",\"*\"]);if(g){if(!c.ca)throw Error(\"XPST0003: Use of XQuery functionality is not allowed in XPath context\");gu(g,A)}g=Z(p,c)}if(null===v||v.sb)Object.keys(f).forEach(function(E){var I=f[E];eu(A,I);A.o[A.h][E]=\nI}),g.P(A),c.ob||bv(a,t,e,f,g,c.debug,m);return{ia:g,ma:A}};var dv=Symbol(\"IS_XPATH_VALUE_SYMBOL\");function ev(a){return function(c,e){c=Uf(new ud(null===e?new od:e),c,Yc(a));e={};return e[dv]=!0,e.Eb=c,e}};Tu.forEach(function(a){Wm(a.namespaceURI,a.localName,a.l,a.j,a.m)});function fv(a){return a&&\"object\"===typeof a&&\"lookupNamespaceURI\"in a?function(c){return a.lookupNamespaceURI(c||null)}:function(){return null}}function gv(a){return a.replace(/(\\x0D\\x0A)|(\\x0D(?!\\x0A))/g,String.fromCharCode(10))}function hv(a){return function(c){var e=c.localName;return c.prefix?null:{namespaceURI:a,localName:e}}}\nfunction iv(a,c,e,g,f,m){var p,t,v,A,E,I;if(null===g||void 0===g)g=g||{};f?(p=f.logger||{trace:console.log.bind(console)},t=f.documentWriter,v=f.moduleImports,A=f.namespaceResolver,E=f.functionNameResolver,I=f.nodesFactory):(p={trace:console.log.bind(console)},v={},A=null,I=null,t=null,E=void 0);var M=new ud(null===e?new od:e);a=gv(a);e=v||Object.create(null);v=f.defaultFunctionNamespaceURI||\"http://www.w3.org/2005/xpath-functions\";var O=cv(a,m,A||fv(c),g,e,v,E||hv(v));a=c?Vf(M,c):U.empty();c=!I&&\nm.ca?new dk(c):new Uu(I);t=t?new rd(t):qd;I=Object.keys(g).reduce(function(X,Ba){var xa=g[Ba];X[\"Q{}\"+Ba+\"[0]\"]=xa&&\"object\"===typeof xa&&dv in xa?function(){return U.create(xa.Eb)}:function(){return Vf(M,g[Ba])};return X},Object.create(null));A={};E=H(Object.keys(O.ma.Da));for(e=E.next();!e.done;A={Wa:A.Wa},e=E.next())A.Wa=e.value,I[A.Wa]||(I[A.Wa]=function(X){return function(){return(0,O.ma.Da[X.Wa])(R,G)}}(A));var R=new Wf({O:a.first(),Ga:0,wa:a,ta:I});var G=new bg(m.debug,M,c,t,f.currentContext,\np);return{zb:R,Ab:G,ia:O.ia}};function jv(a,c){var e={},g=0,f=!1,m=null;return{next:function(){if(f)return Q;for(var p={};g {\\n\\t\\t\\t\\t\\tconst result = \"+a+\".next();\\n\\t\\t\\t\\t\\treturn result.done ? false : !!result.value; \\n\\t\\t\\t\\t})()\",{type:0});case 5:throw Error(\"Trying to get value of generated code with type None\");default:throw Error(\"Unreachable! Trying to get compiled value of unsupported GeneratedCodeType.\");\n}}var Yy={DONE_TOKEN:Q,getEffectiveBooleanValue:Bc,isSubtypeOf:T,ready:S};var Zy={bc:\"pathExpr\",Rb:\"andOp\",ac:\"orOp\",dc:\"stringConstantExpr\"},$y=Object.values(Zy);function az(a,c,e,g,f){a=W(a,e);a=W(a,$y);if(!a)return Wy(\"Unsupported: a base expression used with an operand.\");c+=e;g=g.Fb(a,c,g);return g.isAstAccepted?0===f?Xy(c,g.code,g.Ma):Vy(c,g.Ma,[g.code]):g};function bz(a,c,e){4===c&&(a+=\".next().value\");47===e&&(a=\"(function () { const attr = \"+a+\"; return attr ? domFacade.getData(attr) : null})()\");return a}\nfunction cz(a,c,e,g,f){var m=cm(W(a,\"firstOperand\")[1],\"type\");a=cm(W(a,\"secondOperand\")[1],\"type\");if(!m||!a)return Wy(\"Left or right type of compare are not found, annotation failed.\");var p=[47,1];if(!p.includes(m.type)||!p.includes(a.type))return Wy(\"Unsupported types in compare: [\"+Uc[m.type]+\", \"+Uc[a.type]+\"]\");if(!e.isAstAccepted)return e;if(!g.isAstAccepted)return g;if(!m||!a)return Wy(\"Operands in compare weren't annotated\");p=new Map([[\"eqOp\",\"===\"],[\"neOp\",\"!==\"]]);if(!p.has(c))return Wy(c+\n\" not yet implemented\");c=p.get(c);p=Uy(e.code,e.Ma);var t=Uy(g.code,g.Ma);return Vy(\"function \"+f+\"(contextItem) {\\n\\t\\t\\t\\t\"+e.Ea.join(\"\\n\")+\"\\n\\t\\t\\t \\t\"+g.Ea.join(\"\\n\")+\"\\n\\t \\t \\treturn \"+bz(p[0],p[1].type,m.type)+\" \"+c+\" \"+bz(t[0],t[1].type,a.type)+\";\\n\\t\\t}\",{type:3,j:{type:0}})}var dz={},ez=(dz.equalOp=\"eqOp\",dz.notEqualOp=\"neOp\",dz.lessThanOrEqualOp=\"leOp\",dz.lessThanOp=\"ltOp\",dz.greaterThanOrEqualOp=\"geOp\",dz.greaterThanOp=\"gtOp\",dz);function fz(a){return JSON.stringify(a).replace(/\\u2028/g,\"\\\\u2028\").replace(/\\u2029/g,\"\\\\u2029\")};function gz(a,c,e,g){var f=az(a,c,\"firstOperand\",e,0);if(!f.isAstAccepted)return f;a=az(a,c,\"secondOperand\",e,0);return a.isAstAccepted?Vy(\"\\n\\tfunction \"+c+\"(contextItem) {\\n\\t\\t\"+f.Ea.join(\"\\n\")+\"\\n\\t\\t\"+a.Ea.join(\"\\n\")+\"\\n\\t\\treturn \"+f.code+\" \"+g+\" \"+a.code+\";\\n\\t}\\n\\t\",{type:3,j:{type:0}}):a};function hz(a){for(var c=[],e=0;e {\\n\\t\\t\\t\"+a.code+\"\\n\\t\\t\\treturn DONE_TOKEN;\\n\\t\\t};\\n\\t\\treturn {\\n\\t\\t\\tnext,\\n\\t\\t\\t[Symbol.iterator]() { return this; }\\n\\t\\t};\\n\\t}\\n\\t\",{type:3,j:{type:4}}):a;case Zy.Rb:return gz(a,c,e,\"&&\");case Zy.ac:return gz(a,c,e,\"||\");case Zy.dc:return a=W(a,\"value\")[1],a=fz(a),Vy(\"const \"+c+\" = \"+a+\";\",{type:1});case \"equalOp\":case \"notEqualOp\":case \"lessThanOrEqualOp\":case \"lessThanOp\":case \"greaterThanOrEqualOp\":case \"greaterThanOp\":case \"eqOp\":case \"neOp\":case \"ltOp\":case \"leOp\":case \"gtOp\":case \"geOp\":case \"isOp\":case \"nodeBeforeOp\":case \"nodeAfterOp\":a:{var f=\naz(a,c,\"firstOperand\",e);if(f.isAstAccepted)if(e=az(a,c,\"secondOperand\",e),e.isAstAccepted)switch(g){case \"eqOp\":case \"neOp\":case \"ltOp\":case \"leOp\":case \"gtOp\":case \"geOp\":case \"isOp\":c=cz(a,g,f,e,c);break a;case \"equalOp\":case \"notEqualOp\":case \"lessThanOrEqualOp\":case \"lessThanOp\":case \"greaterThanOrEqualOp\":case \"greaterThanOp\":W(a,\"firstOperand\");var m=cm(a,\"type\");W(a,\"secondOperand\");var p=cm(a,\"type\");c=m&&p?3===m.g&&3===p.g?cz(a,ez[g],f,e,c):Wy(\"generalCompare with sequences is still in development\"):\nWy(\"types of compare are not known\");break a;default:c=Wy(\"Unsupported compare type\")}else c=e;else c=f}return c;default:return Wy(\"Unsupported: the base expression '\"+g+\"'.\")}};function qz(a,c,e){switch(a){case 9:e=H(Uy(\"compiledXPathExpression\",c));a=e.next().value;if(4!==e.next().value.type)throw Error(\"Trying access generated code as an iterator while this is not the case.\");return Vy(\"\\n\\tconst firstResult = \"+a+\".next();\\n\\tif (!firstResult.done) {\\n\\t\\treturn firstResult.value\\n\\t}\\n\\treturn null;\\n\\t\",{type:2});case 7:return e=H(Uy(\"compiledXPathExpression\",c)),a=e.next().value,4!==e.next().value.type?Vy(\"return [];\",{type:2}):Vy(\"\\n\\tconst nodes = [];\\n\\tfor (const node of \"+\na+\") {\\n\\t\\tnodes.push(node);\\n\\t}\\n\\treturn nodes;\\n\\t\",{type:2});case 3:return e=Xy(\"compiledXPathExpression\",\"\",c),e.isAstAccepted?Vy(\"return \"+e.code+\";\",{type:2}):e;case 2:return void 0===e?e=Wy(\"Full AST wasn't annotated so we cannot correctly emit a string return\"):T(e,1)||T(e,47)?(c=H(Uy(\"compiledXPathExpression\",c)),a=c.next().value,c=c.next().value,e=Vy(\"return \"+bz(a,c.type,e)+\" || '';\",{type:2})):e=Wy(\"Not implemented: returning anything but strings and attributes from codegen\"),e;default:return Wy(\"Unsupported: the return type '\"+\na+\"'.\")}}\nfunction rz(a,c,e){var g=W(a,\"mainModule\");if(!g)return Wy(\"Unsupported: Can not execute a library module.\");if(W(g,\"prolog\"))return Wy(\"Unsupported: XQuery.\");var f=dm(g,[\"queryBody\",\"*\"]);e.Fb=pz;e=pz(f,\"compiledXPathExpression\",e);if(!1===e.isAstAccepted)return e;g=e.Ea?e.Ea.join(\"\\n\"):\"\";f=cm(f,\"type\");c=qz(c,e.Ma,f?f.type:void 0);if(!1===c.isAstAccepted)return c;c=g+e.code+c.code;e=\"\\n\\treturn (contextItem, domFacade, runtimeLib) => {\\n\\t\\tconst {\\n\\t\\t\\tDONE_TOKEN,\\n\\t\\t\\tValueType,\\n\\t\\t\\tXPDY0002,\\n\\t\\t\\tdeterminePredicateTruthValue,\\n\\t\\t\\tisSubtypeOf,\\n\\t\\t\\tready,\\n\\t\\t\\tatomize,\\n\\t\\t} = runtimeLib;\";sz(a)&&\n(e+='\\n\\t\\tif (!contextItem) {\\n\\t\\t\\tthrow XPDY0002(\"Context is needed to evaluate the given path expression.\");\\n\\t\\t}\\n\\n\\t\\tif (!contextItem.nodeType) {\\n\\t\\t\\tthrow new Error(\"Context item must be subtype of node().\");\\n\\t\\t}\\n\\t\\t');return{code:e+(c+\"}\\n//# sourceURL=generated.js\"),isAstAccepted:!0}}function sz(a){var c=em(a,\"*\");if(\"pathExpr\"===a[0])return!0;a=H(c);for(c=a.next();!c.done;c=a.next())if(sz(c.value))return!0;return!1};function tz(a,c,e){e=e||{};c=c||0;a=gv(a);a=Wt(a,{ca:\"XQuery3.1\"===e.language||\"XQueryUpdate3.1\"===e.language,debug:!1});e={ga:e.namespaceResolver||fv(null)};var g=new Fu(new Zt(new Iu(e.ga,{},hv(\"http://www.w3.org/2005/xpath-functions\"))));ku(a,g);return rz(a,c,e)};function uz(a,c,e){e=e?e:new od;return a()(c,e,Yy)};var vz={},wz=(vz[\"http://www.w3.org/2005/XQueryX\"]=\"xqx\",vz[\"http://www.w3.org/2007/xquery-update-10\"]=\"xquf\",vz);\nfunction xz(a,c,e,g){if(\"string\"===typeof e)return 0===e.length?null:c.createTextNode(e);if(!Array.isArray(e))throw new TypeError(\"JsonML element should be an array or string\");var f=e[0];switch(f){case \"copySource\":case \"insertAfter\":case \"insertAsFirst\":case \"insertAsLast\":case \"insertBefore\":case \"insertInto\":case \"modifyExpr\":case \"newNameExpr\":case \"replacementExpr\":case \"replaceValue\":case \"returnExpr\":case \"sourceExpr\":case \"targetExpr\":case \"transformCopies\":case \"transformCopy\":g=g||\"http://www.w3.org/2005/XQueryX\";\nbreak;case \"deleteExpr\":case \"insertExpr\":case \"renameExpr\":case \"replaceExpr\":case \"transformExpr\":g=\"http://www.w3.org/2007/xquery-update-10\";break;default:g=\"http://www.w3.org/2005/XQueryX\"}f=c.createElementNS(g,wz[g]+\":\"+f);var m=e[1],p=1;if(\"object\"===typeof m&&!Array.isArray(m)){for(var t in m)null!==m[t]&&(\"type\"===t?a.setAttributeNS(f,g,\"fontoxpath:\"+t,Wc(m[t])):a.setAttributeNS(f,g,wz[g]+\":\"+t,m[t]));p=2}t=p;for(m=e.length;t !bucket || getBucketsForNode(childNode).includes(bucket),\n );\n return matchingNodes;\n }\n\n /**\n * Get the data of this node.\n *\n * @param node -\n */\n getData(node) {\n if (node.nodeType === Node.ATTRIBUTE_NODE) {\n this._onNodeTouched(node);\n return node.value;\n }\n // Text node\n this._onNodeTouched(node.parentNode);\n return node.data;\n }\n\n /**\n * Get the first child of this element.\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the attribute that will be used.\n */\n getFirstChild(node, bucket) {\n const matchingNode = Array.from(this.getChildNodes()).filter(\n childNode => !bucket || getBucketsForNode(childNode).includes(bucket),\n )[0];\n if (matchingNode) {\n return matchingNode;\n }\n return null;\n }\n\n /**\n * Get the last child of this element.\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the attribute that will be used.\n */\n // eslint-disable-next-line class-methods-use-this\n getLastChild(node, bucket) {\n const matchingNodes = node\n .getChildNodes()\n .filter(childNode => !bucket || getBucketsForNode(childNode).includes(bucket));\n const matchNode = matchingNodes[matchingNodes.length - 1];\n if (matchNode) {\n return matchNode;\n }\n return null;\n }\n\n /**\n * Get the next sibling of this node\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the nextSibling that is requested.\n */\n // eslint-disable-next-line class-methods-use-this\n getNextSibling(node, bucket) {\n for (let { nextSibling } = node; nextSibling; nextSibling = nextSibling.nextSibling) {\n if (!getBucketsForNode(nextSibling).includes(bucket)) {\n // eslint-disable-next-line no-continue\n continue;\n }\n return nextSibling;\n }\n return null;\n }\n\n /**\n * Get the parent of this element.\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the attribute that will be used.\n */\n // eslint-disable-next-line class-methods-use-this\n getParentNode(node) {\n return node.parentNode;\n }\n\n /**\n * Get the previous sibling of this element.\n * An implementation of IDomFacade is free to interpret the bucket to skip returning nodes that do not match the bucket, or use this information to its advantage.\n *\n * @param node -\n * @param bucket - The bucket that matches the attribute that will be used.\n */\n // eslint-disable-next-line class-methods-use-this\n getPreviousSibling(node, bucket) {\n for (\n let { previousSibling } = node;\n previousSibling;\n previousSibling = previousSibling.previousSibling\n ) {\n if (!getBucketsForNode(previousSibling).includes(bucket)) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n return previousSibling;\n }\n return null;\n }\n}\n","import * as fx from 'fontoxpath';\n\n/**\n * Checks wether the specified path expression is an absolute path.\n *\n * @param path the path expression.\n * @return true if specified path expression is an absolute\n * path, otherwise false.\n */\n\nexport class XPathUtil {\n static isAbsolutePath(path) {\n return path != null && (path.startsWith('/') || path.startsWith('instance('));\n }\n\n static isSelfReference(ref) {\n return ref === '.' || ref === './text()' || ref === 'text()' || ref === '' || ref === null;\n }\n\n // todo: this will need more work to look upward for instance() expr.\n static getInstanceId(ref) {\n if (!ref) {\n return 'default';\n }\n if (ref.startsWith('instance(')) {\n const result = ref.substring(ref.indexOf('(') + 1);\n return result.substring(1, result.indexOf(')') - 1);\n }\n return 'default';\n }\n\n // todo: certainly not ideal to rely on duplicating instance id on instance document - better way later ;)\n static getPath(node) {\n const path = fx.evaluateXPath('path()', node);\n const instanceId = node.ownerDocument.firstElementChild.getAttribute('id');\n if (instanceId !== null && instanceId !== 'default') {\n return `#${instanceId}${XPathUtil.shortenPath(path)}`;\n }\n return XPathUtil.shortenPath(path);\n }\n\n static shortenPath(path) {\n const steps = path.split('/');\n let result = '';\n for (let i = 2; i < steps.length; i += 1) {\n const step = steps[i];\n if (step.indexOf('{}') !== -1) {\n const q = step.split('{}');\n result += `/${q[1]}`;\n } else {\n result += `/${step}`;\n }\n }\n return result;\n }\n}\n","/**\n * A simple dependency graph\n *\n * based on the work of https://github.com/jriecken/dependency-graph but working on ES6.\n *\n * Furthermore instead of the DepGraphCycleError a compute-exception event is dispatched.\n *\n *\n */\n\n/**\n * Cycle error, including the path of the cycle.\n */\n// const DepGraphCycleError = (exports.DepGraphCycleError = function (cyclePath) {\n\n/*\nexport function DepGraphCycleError(cyclePath) {\n const message = \"Dependency Cycle Found: \" + cyclePath.join(\" -> \");\n const instance = new Error(message);\n instance.cyclePath = cyclePath;\n Object.setPrototypeOf(instance, Object.getPrototypeOf(this));\n if (Error.captureStackTrace) {\n Error.captureStackTrace(instance, DepGraphCycleError);\n }\n return instance;\n};\n\nDepGraphCycleError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: Error,\n enumerable: false,\n writable: true,\n configurable: true\n }\n});\nObject.setPrototypeOf(DepGraphCycleError, Error);\n*/\n\n/**\n * Helper for creating a Topological Sort using Depth-First-Search on a set of edges.\n *\n * Detects cycles and throws an Error if one is detected (unless the \"circular\"\n * parameter is \"true\" in which case it ignores them).\n *\n * @param edges The set of edges to DFS through\n * @param leavesOnly Whether to only return \"leaf\" nodes (ones who have no edges)\n * @param result An array in which the results will be populated\n * @param circular A boolean to allow circular dependencies\n */\nfunction createDFS(edges, leavesOnly, result, circular) {\n const visited = {};\n // eslint-disable-next-line func-names\n return function(start) {\n // console.log('start ', start);\n if (visited[start]) {\n return;\n }\n const inCurrentPath = {};\n const currentPath = [];\n const todo = []; // used as a stack\n todo.push({ node: start, processed: false });\n while (todo.length > 0) {\n const current = todo[todo.length - 1]; // peek at the todo stack\n const { processed } = current;\n const { node } = current;\n if (!processed) {\n // Haven't visited edges yet (visiting phase)\n if (visited[node]) {\n todo.pop();\n // eslint-disable-next-line no-continue\n continue;\n } else if (inCurrentPath[node]) {\n // It's not a DAG\n if (circular) {\n todo.pop();\n // If we're tolerating cycles, don't revisit the node\n // eslint-disable-next-line no-continue\n continue;\n }\n currentPath.push(node);\n window.dispatchEvent(\n new CustomEvent('compute-exception', {\n composed: true,\n bubbles: true,\n detail: {\n path: currentPath,\n message: 'cyclic graph',\n },\n }),\n );\n // return;\n // console.log('‘circular path: ' + currentPath);\n // throw new DepGraphCycleError(currentPath);\n // throw new Error(currentPath);\n }\n\n inCurrentPath[node] = true;\n currentPath.push(node);\n const nodeEdges = edges[node];\n // (push edges onto the todo stack in reverse order to be order-compatible with the old DFS implementation)\n for (let i = nodeEdges.length - 1; i >= 0; i -= 1) {\n todo.push({ node: nodeEdges[i], processed: false });\n }\n current.processed = true;\n } else {\n // Have visited edges (stack unrolling phase)\n todo.pop();\n currentPath.pop();\n inCurrentPath[node] = false;\n visited[node] = true;\n if (!leavesOnly || edges[node].length === 0) {\n result.push(node);\n }\n }\n }\n };\n}\n\n/**\n * Simple Dependency Graph\n */\n\n/*\nvar DepGraph = (exports.DepGraph = function DepGraph(opts) {\n this.nodes = {}; // Node -> Node/Data (treated like a Set)\n this.outgoingEdges = {}; // Node -> [Dependency Node]\n this.incomingEdges = {}; // Node -> [Dependant Node]\n this.circular = opts && !!opts.circular; // Allows circular deps\n});\n*/\n\nexport function DepGraph(opts) {\n this.nodes = {}; // Node -> Node/Data (treated like a Set)\n this.outgoingEdges = {}; // Node -> [Dependency Node]\n this.incomingEdges = {}; // Node -> [Dependant Node]\n this.circular = opts && !!opts.circular; // Allows circular deps\n}\n\nDepGraph.prototype = {\n /**\n * The number of nodes in the graph.\n */\n size() {\n return Object.keys(this.nodes).length;\n },\n /**\n * Add a node to the dependency graph. If a node already exists, this method will do nothing.\n */\n addNode(node, data) {\n if (!this.hasNode(node)) {\n // Checking the arguments length allows the user to add a node with undefined data\n if (arguments.length === 2) {\n this.nodes[node] = data;\n } else {\n this.nodes[node] = node;\n }\n this.outgoingEdges[node] = [];\n this.incomingEdges[node] = [];\n }\n },\n /**\n * Remove a node from the dependency graph. If a node does not exist, this method will do nothing.\n */\n removeNode(node) {\n if (this.hasNode(node)) {\n delete this.nodes[node];\n delete this.outgoingEdges[node];\n delete this.incomingEdges[node];\n // [this.incomingEdges, this.outgoingEdges].forEach(function (edgeList) {\n [this.incomingEdges, this.outgoingEdges].forEach(edgeList => {\n Object.keys(edgeList).forEach(key => {\n const idx = edgeList[key].indexOf(node);\n if (idx >= 0) {\n edgeList[key].splice(idx, 1);\n }\n }, this);\n });\n }\n },\n /**\n * Check if a node exists in the graph\n */\n hasNode(node) {\n // return this.nodes.hasOwnProperty(node);\n\n return Object.prototype.hasOwnProperty.call(this.nodes, node);\n },\n /**\n * Get the data associated with a node name\n */\n getNodeData(node) {\n if (this.hasNode(node)) {\n return this.nodes[node];\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * Set the associated data for a given node name. If the node does not exist, this method will throw an error\n */\n setNodeData(node, data) {\n if (this.hasNode(node)) {\n this.nodes[node] = data;\n } else {\n throw new Error(`Node does not exist: ${node}`);\n }\n },\n /**\n * Add a dependency between two nodes. If either of the nodes does not exist,\n * an Error will be thrown.\n */\n addDependency(from, to) {\n if (!this.hasNode(from)) {\n throw new Error(`Node does not exist: ${from}`);\n }\n if (!this.hasNode(to)) {\n throw new Error(`Node does not exist: ${to}`);\n }\n if (this.outgoingEdges[from].indexOf(to) === -1) {\n this.outgoingEdges[from].push(to);\n }\n if (this.incomingEdges[to].indexOf(from) === -1) {\n this.incomingEdges[to].push(from);\n }\n return true;\n },\n /**\n * Remove a dependency between two nodes.\n */\n removeDependency(from, to) {\n let idx;\n if (this.hasNode(from)) {\n idx = this.outgoingEdges[from].indexOf(to);\n if (idx >= 0) {\n this.outgoingEdges[from].splice(idx, 1);\n }\n }\n\n if (this.hasNode(to)) {\n idx = this.incomingEdges[to].indexOf(from);\n if (idx >= 0) {\n this.incomingEdges[to].splice(idx, 1);\n }\n }\n },\n /**\n * Return a clone of the dependency graph. If any custom data is attached\n * to the nodes, it will only be shallow copied.\n */\n clone() {\n const source = this;\n const result = new DepGraph();\n const keys = Object.keys(source.nodes);\n keys.forEach(n => {\n result.nodes[n] = source.nodes[n];\n result.outgoingEdges[n] = source.outgoingEdges[n].slice(0);\n result.incomingEdges[n] = source.incomingEdges[n].slice(0);\n });\n return result;\n },\n /**\n * Get an array containing the direct dependencies of the specified node.\n *\n * Throws an Error if the specified node does not exist.\n */\n directDependenciesOf(node) {\n if (this.hasNode(node)) {\n return this.outgoingEdges[node].slice(0);\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * Get an array containing the nodes that directly depend on the specified node.\n *\n * Throws an Error if the specified node does not exist.\n */\n directDependantsOf(node) {\n if (this.hasNode(node)) {\n return this.incomingEdges[node].slice(0);\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * Get an array containing the nodes that the specified node depends on (transitively).\n *\n * Throws an Error if the graph has a cycle, or the specified node does not exist.\n *\n * If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned\n * in the array.\n */\n dependenciesOf(node, leavesOnly) {\n if (this.hasNode(node)) {\n const result = [];\n const DFS = createDFS(this.outgoingEdges, leavesOnly, result, this.circular);\n DFS(node);\n const idx = result.indexOf(node);\n if (idx >= 0) {\n result.splice(idx, 1);\n }\n return result;\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * get an array containing the nodes that depend on the specified node (transitively).\n *\n * Throws an Error if the graph has a cycle, or the specified node does not exist.\n *\n * If `leavesOnly` is true, only nodes that do not have any dependants will be returned in the array.\n */\n dependantsOf(node, leavesOnly) {\n if (this.hasNode(node)) {\n const result = [];\n const DFS = createDFS(this.incomingEdges, leavesOnly, result, this.circular);\n DFS(node);\n const idx = result.indexOf(node);\n if (idx >= 0) {\n result.splice(idx, 1);\n }\n return result;\n }\n throw new Error(`Node does not exist: ${node}`);\n },\n /**\n * Construct the overall processing order for the dependency graph.\n *\n * Throws an Error if the graph has a cycle.\n *\n * If `leavesOnly` is true, only nodes that do not depend on any other nodes will be returned.\n */\n overallOrder(leavesOnly) {\n const self = this;\n const result = [];\n const keys = Object.keys(this.nodes);\n if (keys.length === 0) {\n return result; // Empty graph\n }\n if (!this.circular) {\n // Look for cycles - we run the DFS starting at all the nodes in case there\n // are several disconnected subgraphs inside this dependency graph.\n const CycleDFS = createDFS(this.outgoingEdges, false, [], this.circular);\n keys.forEach(n => {\n CycleDFS(n);\n });\n }\n\n const DFS = createDFS(this.outgoingEdges, leavesOnly, result, this.circular);\n // Find all potential starting points (nodes with nothing depending on them) an\n // run a DFS starting at these points to get the order\n keys\n .filter(node => self.incomingEdges[node].length === 0)\n .forEach(n => {\n DFS(n);\n });\n\n // If we're allowing cycles - we need to run the DFS against any remaining\n // nodes that did not end up in the initial result (as they are part of a\n // subgraph that does not have a clear starting point)\n if (this.circular) {\n keys.filter(node => result.indexOf(node) === -1).forEach(n => DFS(n));\n }\n\n return result;\n },\n};\n\n// Create some aliases\nDepGraph.prototype.directDependentsOf = DepGraph.prototype.directDependantsOf;\nDepGraph.prototype.dependentsOf = DepGraph.prototype.dependantsOf;\n","export class Fore {\n static READONLY_DEFAULT = false;\n\n static REQUIRED_DEFAULT = false;\n\n static RELEVANT_DEFAULT = true;\n\n static CONSTRAINT_DEFAULT = true;\n\n static TYPE_DEFAULT = 'xs:string';\n\n static get ACTION_ELEMENTS() {\n return [\n 'FX-DELETE',\n 'FX-DISPATCH',\n 'FX-INSERT',\n 'FX-LOAD',\n 'FX-MESSAGE',\n 'FX-REBUILD',\n 'FX-RECALCULATE',\n 'FX-REFRESH',\n 'FX-RENEW',\n 'FX-REPLACE',\n 'FX-RESET',\n 'FX-RETAIN',\n 'FX-RETURN',\n 'FX-REVALIDATE',\n 'FX-SEND',\n 'FX-SETFOCUS',\n 'FX-SETINDEX',\n 'FX-SETVALUE',\n 'FX-TOGGLE',\n 'FX-UPDATE',\n ];\n }\n\n static get XFORMS_NAMESPACE_URI() {\n // todo: should be centralized somewhere as constant. Exists in several? places\n return 'http://www.w3.org/2002/xforms';\n }\n\n static isActionElement(elementName) {\n return Fore.ACTION_ELEMENTS.includes(elementName);\n }\n\n static get UI_ELEMENTS() {\n return [\n 'FX-ALERT',\n 'FX-CONTROL',\n 'FX-BUTTON',\n 'FX-CONTROL',\n 'FX-DIALOG',\n 'FX-FILENAME',\n 'FX-MEDIATYPE',\n 'FX-GROUP',\n 'FX-HINT',\n 'FX-INPUT',\n 'FX-ITEMSET',\n 'FX-LABEL',\n 'FX-OUTPUT',\n 'FX-RANGE',\n 'FX-REPEAT',\n 'FX-REPEATITEM',\n 'FX-SWITCH',\n 'FX-SECRET',\n 'FX-SELECT',\n 'FX-SUBMIT',\n 'FX-TEXTAREA',\n 'FX-TRIGGER',\n 'FX-UPLOAD',\n ];\n }\n\n static isUiElement(elementName) {\n const found = Fore.UI_ELEMENTS.includes(elementName);\n if (found) {\n // console.log('_isUiElement ', found);\n }\n return Fore.UI_ELEMENTS.includes(elementName);\n }\n\n static async refreshChildren(startElement) {\n const refreshed = new Promise(resolve => {\n const { children } = startElement;\n if (children) {\n Array.from(children).forEach(element => {\n if (Fore.isUiElement(element.nodeName) && typeof element.refresh === 'function') {\n element.refresh();\n } else if (element.nodeName.toUpperCase() !== 'FX-MODEL') {\n Fore.refreshChildren(element);\n }\n });\n }\n resolve('done');\n });\n\n return refreshed;\n }\n\n static isRepeated(element) {\n return element.closest('fx-repeatitem') !== null;\n }\n\n static getRepeatTarget(element, id) {\n const repeatContextItem = element.closest('fx-repeatitem');\n const target = repeatContextItem.querySelector(`#${id}`);\n return target;\n }\n\n /**\n * returns the proper content-type for instance.\n *\n * @param instance an fx-instance element\n * @returns {string|null}\n */\n static getContentType(instance, method) {\n if (method === 'urlencoded-post') {\n return 'application/x-www-form-urlencoded; charset=UTF-8';\n }\n if (instance.type === 'xml') {\n return 'application/xml; charset=UTF-8';\n }\n if (instance.type === 'json') {\n return 'application/json';\n }\n console.warn('content-type unknown ', instance.type);\n return null;\n }\n\n static fadeInElement(element) {\n const duration = 600;\n let fadeIn = () => {\n // Stop all current animations\n if (element.getAnimations) {\n element.getAnimations().map(anim => anim.finish());\n }\n\n // Play the animation with the newly specified duration\n fadeIn = element.animate(\n {\n opacity: [0, 1],\n },\n duration,\n );\n return fadeIn.finished;\n };\n return fadeIn();\n }\n\n static fadeOutElement(element) {\n const duration = 2600;\n let fadeOut = () => {\n // Stop all current animations\n if (element.getAnimations) {\n element.getAnimations().map(anim => anim.finish());\n }\n\n // Play the animation with the newly specified duration\n fadeOut = element.animate(\n {\n opacity: [1, 0],\n },\n duration,\n );\n return fadeOut.finished;\n };\n return fadeOut();\n }\n\n /**\n * clear all text nodes and attribute values to get a 'clean' template.\n * @param n\n * @private\n */\n /*\n static clear(n) {\n n.textContent = '';\n if (n.hasAttributes()) {\n const attrs = n.attributes;\n for (let i = 0; i < attrs.length; i+= 1) {\n attrs[i].value = '';\n }\n }\n const { children } = n;\n for (let i = 0; i < children.length; i+= 1) {\n Fore.clear(children[i]);\n }\n }\n */\n}\n","import {\n evaluateXPath as fxEvaluateXPath,\n evaluateXPathToFirstNode as fxEvaluateXPathToFirstNode,\n evaluateXPathToNodes as fxEvaluateXPathToNodes,\n evaluateXPathToBoolean as fxEvaluateXPathToBoolean,\n evaluateXPathToString as fxEvaluateXPathToString,\n evaluateXPathToNumber as fxEvaluateXPathToNumber,\n registerCustomXPathFunction,\n registerXQueryModule,\n} from 'fontoxpath';\n\nconst XFORMS_NAMESPACE_URI = 'http://www.w3.org/2002/xforms';\n\n/**\n * Resolve a namespace. Needs a namespace prefix and the element that is most closely related to the\n * XPath in which the namespace is being resolved. The prefix will be resolved by using the\n * ancestry of said element.\n *\n * It has two ways of doing so:\n *\n * - If the prefix is defined in an `xmlns:XXX=\"YYY\"` namespace declaration, it will return 'YYY'.\n * - If the prefix is the empty prefix and there is an `xpath-default-namespace=\"YYY\"` attribute in the\n * - ancestry, that attribute will be used and 'YYY' will be returned\n *\n * @param {Node} contextElement The element that is most closely related with the XPath in which this prefix is resolved.\n * @param {string} prefix The prefix to resolve\n */\nfunction resolveNamespacePrefix(contextElement, prefix) {\n if (prefix === 'xhtml') {\n return 'http://www.w3.org/1999/xhtml';\n }\n\n if (prefix === '') {\n return (\n fxEvaluateXPathToString(\n 'ancestor-or-self::*/@xpath-default-namespace[last()]',\n contextElement,\n ) || null\n );\n }\n\n // Note: ideally we should use Node#lookupNamespaceURI. However, the nodes we are passed are\n // XML. The best we can do is emulate the `xmlns:xxx` namespace declarations by regarding them as\n // attributes. Which they technically ARE NOT!\n\n const result = fxEvaluateXPathToString(\n 'ancestor-or-self::*/@*[name() = \"xmlns:\" || $prefix][last()]',\n contextElement,\n null,\n { prefix },\n );\n\n console.log('result', result);\n return result;\n}\n\n/**\n * Implementation of the functionNameResolver passed to FontoXPath to\n * redirect function resolving for unprefixed functions to either the fn or the xf namespace\n */\n// eslint-disable-next-line no-unused-vars\nfunction functionNameResolver({ prefix, localName }, _arity) {\n switch (localName) {\n // TODO: put the full XForms library functions set here\n case 'base64encode':\n case 'boolean-from-string':\n case 'current':\n case 'depends':\n case 'event':\n case 'index':\n case 'instance':\n case 'log':\n case 'logtree':\n return { namespaceURI: XFORMS_NAMESPACE_URI, localName };\n default:\n if (prefix === '' || prefix === 'fn') {\n return { namespaceURI: 'http://www.w3.org/2005/xpath-functions', localName };\n }\n if (prefix === 'local') {\n return { namespaceURI: 'http://www.w3.org/2005/xquery-local-functions', localName };\n }\n return null;\n }\n}\n\n/**\n * Evaluate an XPath to _any_ type. When possible, prefer to use any other function to ensure the\n * type of the output is more predictable.\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {{parentNode}|ForeElementMixin} formElement The form element associated to the XPath\n */\nexport function evaluateXPath(xpath, contextNode, formElement, variables = {}) {\n return fxEvaluateXPath(xpath, contextNode, null, variables, 'xs:anyType', {\n currentContext: { formElement, variables },\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n functionNameResolver,\n namespaceResolver: prefix => resolveNamespacePrefix(formElement, prefix),\n });\n}\n\n/**\n * Evaluate an XPath to the first Node\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @return {Node} The first node found by the XPath\n */\nexport function evaluateXPathToFirstNode(xpath, contextNode, formElement) {\n return fxEvaluateXPathToFirstNode(\n xpath,\n contextNode,\n null,\n {},\n {\n namespaceResolver: prefix => resolveNamespacePrefix(formElement, prefix),\n defaultFunctionNamespaceURI: XFORMS_NAMESPACE_URI,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n currentContext: { formElement },\n },\n );\n}\n\n/**\n * Evaluate an XPath to all nodes\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @return {Node[]} All nodes\n */\nexport function evaluateXPathToNodes(xpath, contextNode, formElement) {\n return fxEvaluateXPathToNodes(\n xpath,\n contextNode,\n null,\n {},\n {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver: prefix => resolveNamespacePrefix(formElement, prefix),\n },\n );\n}\n\n/**\n * Evaluate an XPath to a boolean\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @return {boolean}\n */\nexport function evaluateXPathToBoolean(xpath, contextNode, formElement) {\n return fxEvaluateXPathToBoolean(\n xpath,\n contextNode,\n null,\n {},\n {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver: prefix => resolveNamespacePrefix(formElement, prefix),\n },\n );\n}\n\n/**\n * Evaluate an XPath to a string\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @param {DomFacade} [domFacade=null] A DomFacade is used in bindings to intercept DOM\n * access. This is used to determine dependencies between bind elements.\n * @param {Node} formElement The element where the XPath is defined: used for namespace resolving\n * @return {string}\n */\nexport function evaluateXPathToString(\n xpath,\n contextNode,\n formElement,\n domFacade = null,\n namespaceReferenceNode = formElement,\n) {\n return fxEvaluateXPathToString(\n xpath,\n contextNode,\n domFacade,\n {},\n\n {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver: prefix => resolveNamespacePrefix(namespaceReferenceNode, prefix),\n },\n );\n}\n\n/**\n * Evaluate an XPath to a number\n *\n * @param {string} xpath The XPath to run\n * @param {Node} contextNode The start of the XPath\n * @param {Node} formElement The form element associated to the XPath\n * @param {DomFacade} [domFacade=null] A DomFacade is used in bindings to intercept DOM\n * @param {Node} formElement The element where the XPath is defined: used for namespace resolving\n * access. This is used to determine dependencies between bind elements.\n * @return {Number}\n */\nexport function evaluateXPathToNumber(\n xpath,\n contextNode,\n formElement,\n domFacade = null,\n namespaceReferenceNode = formElement,\n) {\n return fxEvaluateXPathToNumber(\n xpath,\n contextNode,\n domFacade,\n {},\n {\n currentContext: { formElement },\n functionNameResolver,\n moduleImports: {\n xf: XFORMS_NAMESPACE_URI,\n },\n namespaceResolver: prefix => resolveNamespacePrefix(namespaceReferenceNode, prefix),\n },\n );\n}\n\nconst xhtmlNamespaceResolver = prefix => {\n if (!prefix) {\n return 'http://www.w3.org/1999/xhtml';\n }\n return undefined;\n};\n\n/**\n * Resolve an id in scope. Behaves like the algorithm defined on https://www.w3.org/community/xformsusers/wiki/XForms_2.0#idref-resolve\n */\nfunction resolveId(id, sourceObject, nodeName = null) {\n const allMatchingTargetObjects = fxEvaluateXPathToNodes(\n 'outermost(ancestor-or-self::fx-fore[1]/(descendant::xf-fore|descendant::*[@id = $id]))[not(self::fx-fore)]',\n sourceObject,\n null,\n { id },\n { namespaceResolver: xhtmlNamespaceResolver },\n );\n\n if (allMatchingTargetObjects.length === 0) {\n return null;\n }\n\n if (\n allMatchingTargetObjects.length === 1 &&\n fxEvaluateXPathToBoolean(\n '(ancestor::fx-fore | ancestor::fx-repeat)[last()]/self::fx-fore',\n allMatchingTargetObjects[0],\n null,\n null,\n { namespaceResolver: xhtmlNamespaceResolver },\n )\n ) {\n // If the target element is not repeated, then the search for the target object is trivial since\n // there is only one associated with the target element that bears the matching ID. This is true\n // regardless of whether or not the source object is repeated. However, if the target element is\n // repeated, then additional information must be used to help select a target object from among\n // those associated with the identified target element.\n const targetObject = allMatchingTargetObjects[0];\n if (nodeName && targetObject.localName !== nodeName) {\n return null;\n }\n return targetObject;\n }\n\n // SPEC:\n\n // 12.2.1 References to Elements within a repeat Element\n\n // When the target element that is identified by the IDREF of a source object has one or more\n // repeat elements as ancestors, then the set of ancestor repeats are partitioned into two\n // subsets, those in common with the source element and those that are not in common. Any ancestor\n // repeat elements of the target element not in common with the source element are descendants of\n // the repeat elements that the source and target element have in common, if any.\n\n // For the repeat elements that are in common, the desired target object exists in the same set of\n // run-time objects that contains the source object. Then, for each ancestor repeat of the target\n // element that is not in common with the source element, the current index of the repeat\n // determines the set of run-time objects that contains the desired target object.\n for (const ancestorRepeatItem of fxEvaluateXPathToNodes(\n 'ancestor::fx-repeatitem => reverse()',\n sourceObject,\n null,\n null,\n { namespaceResolver: xhtmlNamespaceResolver },\n )) {\n const foundTargetObjects = allMatchingTargetObjects.filter(to =>\n ancestorRepeatItem.contains(to),\n );\n switch (foundTargetObjects.length) {\n case 0:\n // Nothing found: ignore\n break;\n case 1: {\n // A single one is found: the target object is directly in a common repeat\n const targetObject = foundTargetObjects[0];\n if (nodeName && targetObject.localName !== nodeName) {\n return null;\n }\n return targetObject;\n }\n default: {\n // Multiple target objects are found: they are in a repeat that is not common with the source object\n // We found a target object in a common repeat! We now need to find the one that is in the repeatitem identified at the current index\n const targetObject = foundTargetObjects.find(to =>\n fxEvaluateXPathToNodes(\n 'every $ancestor of ancestor::fx-repeatitem satisfies $ancestor is $ancestor/../child::fx-repeatitem[../@repeat-index]',\n to,\n null,\n {},\n ),\n );\n if (!targetObject) {\n // Nothing valid found for whatever reason. This might be something dynamic?\n return null;\n }\n if (nodeName && targetObject.localName !== nodeName) {\n return null;\n }\n return targetObject;\n }\n }\n }\n // We found no target objects in common repeats. The id is unresolvable\n return null;\n}\n\n/**\n * @param id as string\n * @return instance data for given id serialized to string.\n */\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'log' },\n ['xs:string?'],\n 'xs:string?',\n (dynamicContext, string) => {\n const { formElement } = dynamicContext.currentContext;\n const instance = resolveId(string, formElement, 'fx-instance');\n if (instance) {\n const def = new XMLSerializer().serializeToString(instance.getDefaultContext());\n return def;\n }\n return null;\n },\n);\n\nfunction buildTree(tree, data) {\n if (!data) return;\n if (data.nodeType === Node.ELEMENT_NODE) {\n if (data.children) {\n const details = document.createElement('details');\n details.setAttribute('data-path', data.nodeName);\n const summary = document.createElement('summary');\n\n let display = ` <${data.nodeName}`;\n Array.from(data.attributes).forEach(attr => {\n display += ` ${attr.nodeName}=\"${attr.nodeValue}\"`;\n });\n\n let contents;\n if (\n data.firstChild &&\n data.firstChild.nodeType === Node.TEXT_NODE &&\n data.firstChild.data.trim() !== ''\n ) {\n // console.log('whoooooooooopp');\n contents = data.firstChild.nodeValue;\n display += `>${contents}${data.nodeName}>`;\n } else {\n display += '>';\n }\n summary.textContent = display;\n\n details.appendChild(summary);\n if (data.childElementCount !== 0) {\n details.setAttribute('open', 'open');\n } else {\n summary.setAttribute('style', 'list-style:none;');\n }\n tree.appendChild(details);\n\n Array.from(data.children).forEach(child => {\n // if(child.nodeType === Node.ELEMENT_NODE){\n // child.parentNode.appendChild(buildTree(child));\n buildTree(details, child);\n // }\n });\n }\n } /* else if(data.nodeType === Node.ATTRIBUTE_NODE){\n //create span for now\n // const span = document.createElement('span');\n // span.style.background = 'grey';\n // span.textContent = data.value;\n // tree.appendChild(span);\n tree.setAttribute(data.nodeName,data.value);\n }else {\n tree.textContent = data;\n } */\n\n // return tree;\n}\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'logtree' },\n ['xs:string?'],\n 'element()?',\n (dynamicContext, string) => {\n const { formElement } = dynamicContext.currentContext;\n const instance = resolveId(string, formElement, 'fx-instance');\n\n if (instance) {\n // const def = new XMLSerializer().serializeToString(instance.getDefaultContext());\n // const def = JSON.stringify(instance.getDefaultContext());\n\n const treeDiv = document.createElement('div');\n treeDiv.setAttribute('class', 'logtree');\n // const datatree = buildTree(tree,instance.getDefaultContext());\n // return tree.appendChild(datatree);\n // return buildTree(root,instance.getDefaultContext());;\n const form = dynamicContext.currentContext.formElement;\n const logtree = form.querySelector('.logtree');\n if (logtree) {\n logtree.parentNode.removeChild(logtree);\n }\n const tree = buildTree(treeDiv, instance.getDefaultContext());\n if (tree) {\n form.appendChild(tree);\n }\n }\n return null;\n },\n);\n\nconst instance = (dynamicContext, string) => {\n // Spec: https://www.w3.org/TR/xforms-xpath/#The_XForms_Function_Library#The_instance.28.29_Function\n // TODO: handle no string passed (null will be passed instead)\n\n const formElement = fxEvaluateXPathToFirstNode(\n 'ancestor-or-self::fx-fore',\n dynamicContext.currentContext.formElement,\n null,\n null,\n { namespaceResolver: xhtmlNamespaceResolver },\n );\n\n // console.log('fnInstance dynamicContext: ', dynamicContext);\n // console.log('fnInstance string: ', string);\n\n const inst = string\n ? resolveId(string, formElement, 'fx-instance')\n : formElement.querySelector(`fx-instance`);\n\n // const def = instance.getInstanceData();\n if (inst) {\n const def = inst.getDefaultContext();\n // console.log('target instance root node: ', def);\n\n return def;\n }\n return null;\n};\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'index' },\n ['xs:string?'],\n 'xs:integer?',\n (dynamicContext, string) => {\n const { formElement } = dynamicContext.currentContext;\n if (string === null) {\n return 1;\n }\n const repeat = resolveId(string, formElement, 'fx-repeat');\n\n // const def = instance.getInstanceData();\n if (repeat) {\n return repeat.getAttribute('index');\n }\n return 1;\n },\n);\n\n// Note that this is not to spec. The spec enforces elements to be returned from the\n// instance. However, we allow instances to actually be JSON!\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'instance' },\n [],\n 'item()?',\n domFacade => instance(domFacade, null),\n);\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'instance' },\n ['xs:string?'],\n 'item()?',\n instance,\n);\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'depends' },\n ['node()*'],\n 'item()?',\n (dynamicContext, nodes) =>\n // console.log('depends on : ', nodes[0]);\n nodes[0],\n);\n\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'event' },\n ['xs:string?'],\n 'item()?',\n (dynamicContext, arg) => {\n const payload = dynamicContext.currentContext.variables[arg];\n if (payload.nodeType) {\n console.log('got some node as js object');\n }\n\n return dynamicContext.currentContext.variables[arg];\n },\n);\n\n// Implement the XForms standard functions here.\nregisterXQueryModule(`\n module namespace xf=\"${XFORMS_NAMESPACE_URI}\";\n\n declare %public function xf:boolean-from-string($str as xs:string) as xs:boolean {\n lower-case($str) = \"true\" or $str = \"1\"\n };\n`);\n\n// How to run XQUERY:\n/**\n registerXQueryModule(`\n module namespace my-custom-namespace = \"my-custom-uri\";\n (:~\n Insert attribute somewhere\n ~:)\n declare %public %updating function my-custom-namespace:do-something ($ele as element()) as xs:boolean {\n\tif ($ele/@done) then false() else\n\t(insert node\n\tattribute done {\"true\"}\n\tinto $ele, true())\n};\n `)\n // At some point:\n const contextNode = null;\n const pendingUpdatesAndXdmValue = evaluateUpdatingExpressionSync('ns:do-something(.)', contextNode, null, null, {moduleImports: {'ns': 'my-custom-uri'}})\n\n console.log(pendingUpdatesAndXdmValue.xdmValue); // this is true or false, see function\n\n executePendingUpdateList(pendingUpdatesAndXdmValue.pendingUpdateList, null, null, null);\n */\n\n/**\n * @param input as string\n * @return {string}\n */\nregisterCustomXPathFunction(\n { namespaceURI: XFORMS_NAMESPACE_URI, localName: 'base64encode' },\n ['xs:string?'],\n 'xs:string?',\n (dynamicContext, string) => btoa(string),\n);\n","import { Fore } from './fore.js';\nimport { evaluateXPathToFirstNode } from './xpath-evaluation.js';\n\n/**\n * Container for data instances.\n *\n * Offers several ways of loading data from either inline content or via 'src' attribute which will use the fetch\n * API to resolve data.\n */\nexport class FxInstance extends HTMLElement {\n constructor() {\n super();\n this.model = this.parentNode;\n this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback() {\n // console.log('connectedCallback ', this);\n if (this.hasAttribute('src')) {\n this.src = this.getAttribute('src');\n }\n\n if (this.hasAttribute('id')) {\n this.id = this.getAttribute('id');\n } else {\n this.id = 'default';\n }\n\n if (this.hasAttribute('type')) {\n this.type = this.getAttribute('type');\n } else {\n this.type = 'xml';\n }\n const style = `\n :host {\n display: none;\n }\n :host * {\n display:none;\n }\n ::slotted(*){\n display:none;\n }\n `;\n\n const html = `\n `;\n this.shadowRoot.innerHTML = `\n \n ${html}\n `;\n }\n\n /**\n * Is called by fx-model during initialization phase (model-construct)\n * @returns {Promise}\n */\n async init() {\n // console.log('fx-instance init');\n await this._initInstance().then(() => {\n this.dispatchEvent(\n new CustomEvent('instance-loaded', {\n composed: true,\n bubbles: true,\n detail: { instance: this },\n }),\n );\n return this;\n });\n }\n\n evalXPath(xpath) {\n const formElement = this.parentElement.parentElement;\n const result = evaluateXPathToFirstNode(xpath, this.getDefaultContext(), formElement);\n return result;\n }\n\n /**\n * returns the current instance data\n *\n * @returns {Document | T | any}\n */\n getInstanceData() {\n if (!this.instanceData) {\n this._createInstanceData();\n }\n return this.instanceData;\n }\n\n setInstanceData(data) {\n if (!data) {\n this._createInstanceData();\n return;\n }\n this.instanceData = data;\n }\n\n /**\n * return the default context (root node of respective instance) for XPath evalution.\n *\n * @returns {Document|T|any|Element}\n */\n getDefaultContext() {\n // console.log('getDefaultContext ', this.instanceData.firstElementChild);\n if (this.type === 'xml') {\n return this.instanceData.firstElementChild;\n }\n return this.instanceData;\n }\n\n /**\n * does the actual loading of data. Handles inline data, data loaded via fetch() or data constructed from\n * querystring.\n *\n * @returns {Promise}\n * @private\n */\n async _initInstance() {\n if (this.src === '#querystring') {\n /*\n * generate XML data from URL querystring\n * todo: there's no variant to generate JSON yet\n */\n // eslint-disable-next-line no-restricted-globals\n const query = new URLSearchParams(location.search);\n const doc = new DOMParser().parseFromString('', 'application/xml');\n const root = doc.firstElementChild;\n for (const p of query) {\n const newNode = doc.createElement(p[0]);\n newNode.appendChild(doc.createTextNode(p[1]));\n root.appendChild(newNode);\n }\n this.instanceData = doc;\n // this.instanceData.firstElementChild.setAttribute('id', this.id);\n // resolve('done');\n } else if (this.src) {\n await this._loadData();\n } else if (this.childNodes.length !== 0) {\n this._useInlineData();\n }\n }\n\n _createInstanceData() {\n if (this.type === 'xml') {\n const doc = new DOMParser().parseFromString('', 'application/xml');\n this.instanceData = doc;\n }\n if (this.type === 'json') {\n this.instanceData = {};\n }\n }\n\n async _loadData() {\n const url = `${this.src}`;\n const contentType = Fore.getContentType(this, 'get');\n\n await fetch(url, {\n method: 'GET',\n mode: 'cors',\n credentials: 'include',\n headers: {\n 'Content-Type': contentType,\n },\n })\n .then(response => {\n const responseContentType = response.headers.get('content-type').toLowerCase();\n console.log('********** responseContentType *********', responseContentType);\n if (responseContentType.startsWith('text/plain')) {\n // console.log(\"********** inside res plain *********\");\n return response.text();\n }\n if (responseContentType.startsWith('application/json')) {\n // console.log(\"********** inside res json *********\");\n return response.json();\n }\n if (responseContentType.startsWith('application/xml')) {\n return response.text().then(result => {\n console.log('xml ********', result);\n return new DOMParser().parseFromString(result, 'application/xml');\n });\n }\n return 'done';\n })\n .then(data => {\n this.instanceData = data;\n console.log('instanceData loaded: ', this.instanceData);\n })\n .catch(error => {\n throw new Error(`failed loading data ${error}`);\n });\n }\n\n _getContentType() {\n if (this.type === 'xml') {\n return 'application/xml';\n }\n if (this.type === 'json') {\n return 'application/json';\n }\n console.warn('content-type unknown ', this.type);\n return null;\n }\n\n _useInlineData() {\n if (this.type === 'xml') {\n // console.log('innerHTML ', this.innerHTML);\n const instanceData = new DOMParser().parseFromString(this.innerHTML, 'application/xml');\n\n console.log('fx-instance init id:', this.id);\n this.instanceData = instanceData;\n // console.log('instanceData ', this.instanceData);\n // console.log('instanceData ', this.instanceData.firstElementChild);\n\n console.log('fx-instance data: ', this.instanceData);\n // this.instanceData.firstElementChild.setAttribute('id', this.id);\n // todo: move innerHTML out to shadowDOM (for later reset)\n } else if (this.type === 'json') {\n this.instanceData = JSON.parse(this.textContent);\n } else {\n console.warn('unknow type for data ', this.type);\n }\n }\n\n _handleResponse() {\n console.log('_handleResponse ');\n const ajax = this.shadowRoot.getElementById('loader');\n const instanceData = new DOMParser().parseFromString(ajax.lastResponse, 'application/xml');\n this.instanceData = instanceData;\n console.log('data: ', this.instanceData);\n }\n\n _handleError() {\n const loader = this.shadowRoot.getElementById('loader');\n console.log('_handleResponse ', loader.lastError);\n }\n}\ncustomElements.define('fx-instance', FxInstance);\n","/**\n * Class for holding ModelItem facets.\n *\n * A ModelItem annotates nodes that are referred by a fx-bind element with facets for calculation and validation.\n *\n * Each bound node in an instance has exactly one ModelItem associated with it.\n */\nexport class ModelItem {\n /**\n *\n * @param {path} calculated normalized path expression linking to data\n * @param {ref} ref relative binding expression\n * @param {*} isReadonly - boolean to signal readonly/readwrite state\n * @param {*} relevant - boolean to signal relevant/non-relevant state\n * @param {*} required - boolean to signal required/optional state\n * @param {*} required - boolean boolean to signal valid/invalid state\n * @param {*} type - string expression to set a datatype\n * @param {*} node - the node the 'ref' expression is referring to\n * @param {*} bind - the fx-bind element having created this modelItem\n */\n constructor(path, ref, readonly, relevant, required, constraint, type, node, bind) {\n this.path = path;\n this.ref = ref;\n this.constraint = constraint;\n this.readonly = readonly;\n this.relevant = relevant;\n this.required = required;\n this.type = type;\n this.node = node;\n this.bind = bind;\n this.changed = false;\n this.alerts = [];\n // this.value = this._getValue();\n }\n\n /*\n get ref(){\n return this.bind.ref;\n }\n*/\n\n get value() {\n if (!this.node.nodeType) return this.node;\n\n if (this.node.nodeType === Node.ATTRIBUTE_NODE) {\n return this.node.nodeValue;\n }\n return this.node.textContent;\n }\n\n set value(newVal) {\n console.log('modelitem.setvalue oldVal', this.value);\n console.log('modelitem.setvalue newVal', newVal);\n\n if (newVal.nodeType === Node.DOCUMENT_NODE) {\n // this.node.replaceWith(newVal.firstElementChild);\n this.node.appendChild(newVal.firstElementChild);\n } else if (newVal.nodeType === Node.ELEMENT_NODE) {\n // this.node.replaceWith(newVal);\n this.node.appendChild(newVal);\n } else if (this.node.nodeType === Node.ATTRIBUTE_NODE) {\n this.node.nodeValue = newVal;\n } else {\n this.node.textContent = newVal;\n }\n }\n\n addAlert(alert) {\n this.alerts.push(alert);\n }\n\n cleanAlerts() {\n this.alerts = [];\n }\n}\n","import { DepGraph } from './dep_graph.js';\nimport { Fore } from './fore.js';\nimport './fx-instance.js';\nimport { ModelItem } from './modelitem.js';\nimport { evaluateXPath, evaluateXPathToBoolean } from './xpath-evaluation.js';\nimport { XPathUtil } from './xpath-util.js';\n\n/**\n * @ts-check\n */\nexport class FxModel extends HTMLElement {\n constructor() {\n super();\n // this.id = '';\n\n this.instances = [];\n this.modelItems = [];\n this.defaultContext = {};\n\n // this.mainGraph = new DepGraph(false);\n this.inited = false;\n this.modelConstructed = false;\n this.attachShadow({ mode: 'open' });\n }\n\n get formElement() {\n return this.parentElement;\n }\n\n connectedCallback() {\n // console.log('connectedCallback ', this);\n this.shadowRoot.innerHTML = `\n \n `;\n\n this.addEventListener('model-construct-done', e => {\n this.modelConstructed = true;\n // console.log('model-construct-done fired ', this.modelConstructed);\n console.log('model-construct-done fired ', e.detail.model.instances);\n });\n\n // logging\n }\n\n static lazyCreateModelItem(model, ref, node) {\n // console.log('lazyCreateModelItem ', node);\n\n let targetNode = {};\n if (node === null || node === undefined) return null;\n if (node.nodeType === node.TEXT_NODE) {\n // const parent = node.parentNode;\n // console.log('PARENT ', parent);\n targetNode = node.parentNode;\n } else {\n targetNode = node;\n }\n\n // const path = fx.evaluateXPath('path()',node);\n let path;\n if (node.nodeType) {\n path = XPathUtil.getPath(node);\n } else {\n path = null;\n targetNode = node;\n }\n // const path = XPathUtil.getPath(node);\n\n // ### intializing ModelItem with default values (as there is no matching for given ref)\n const mi = new ModelItem(\n path,\n ref,\n Fore.READONLY_DEFAULT,\n Fore.RELEVANT_DEFAULT,\n Fore.REQUIRED_DEFAULT,\n Fore.CONSTRAINT_DEFAULT,\n Fore.TYPE_DEFAULT,\n targetNode,\n this,\n );\n\n // console.log('new ModelItem is instanceof ModelItem ', mi instanceof ModelItem);\n model.registerModelItem(mi);\n return mi;\n }\n\n modelConstruct() {\n console.log('### <<<<< dispatching model-construct >>>>>');\n this.dispatchEvent(new CustomEvent('model-construct', { detail: this }));\n\n const instances = this.querySelectorAll('fx-instance');\n if (instances.length > 0) {\n console.group('init instances');\n const promises = [];\n instances.forEach(instance => {\n promises.push(instance.init());\n });\n\n Promise.all(promises).then(() => {\n this.instances = Array.from(instances);\n console.log('_modelConstruct this.instances ', this.instances);\n this.updateModel();\n this.inited = true;\n\n console.log('### <<<<< dispatching model-construct-done >>>>>');\n this.dispatchEvent(\n new CustomEvent('model-construct-done', {\n composed: true,\n bubbles: true,\n detail: { model: this },\n }),\n );\n });\n console.groupEnd();\n } else {\n // ### if there's no instance one will created\n this.dispatchEvent(\n new CustomEvent('model-construct-done', {\n composed: true,\n bubbles: true,\n detail: { model: this },\n }),\n );\n }\n this.inited = true;\n }\n\n registerModelItem(modelItem) {\n // console.log('ModelItem registered ', modelItem);\n this.modelItems.push(modelItem);\n }\n\n /**\n * update action triggering the update cycle\n */\n updateModel() {\n this.rebuild();\n this.recalculate();\n this.revalidate();\n }\n\n rebuild() {\n console.group('### rebuild');\n\n this.mainGraph = new DepGraph(false);\n this.modelItems = [];\n\n // trigger recursive initialization of the fx-bind elements\n const binds = this.querySelectorAll('fx-model > fx-bind');\n binds.forEach(bind => {\n bind.init(this);\n });\n\n // console.log(`dependencies of a `, this.mainGraph.dependenciesOf(\"/Q{}data[1]/Q{}a[1]:required\"));\n // console.log(`dependencies of b `, this.mainGraph.dependenciesOf(\"/Q{}data[1]/Q{}b[1]:required\"));\n console.log(`rebuild mainGraph`, this.mainGraph);\n console.log(`rebuild mainGraph calc order`, this.mainGraph.overallOrder());\n /*\n console.log(\n `rebuild finished with modelItems ${this.modelItems.length} item(s)`,\n this.modelItems,\n );\n*/\n console.groupEnd();\n }\n\n /**\n * recalculation of all modelItems. Uses dependency graph to determine order of computation.\n *\n * todo: use 'changed' flag on modelItems to determine subgraph for recalculation. Flag already exists but is not used.\n */\n recalculate() {\n console.group('### recalculate');\n console.log('recalculate instances ', this.instances);\n\n const v = this.mainGraph.overallOrder();\n v.forEach(path => {\n const node = this.mainGraph.getNodeData(path);\n const modelItem = this.getModelItem(node);\n\n if (modelItem && path.includes(':')) {\n const property = path.split(':')[1];\n if (property) {\n if (property === 'calculate') {\n const expr = modelItem.bind[property];\n const compute = evaluateXPath(expr, modelItem.node, this);\n modelItem.value = compute;\n } else if (property !== 'constraint' && property !== 'type') {\n const expr = modelItem.bind[property];\n if (expr) {\n const compute = evaluateXPathToBoolean(expr, modelItem.node, this);\n modelItem[property] = compute;\n console.log(\n `recalculating path ${path} - Expr:'${expr}' computed`,\n modelItem[property],\n );\n }\n }\n }\n }\n });\n console.log(\n `recalculate finished with modelItems ${this.modelItems.length} item(s)`,\n this.modelItems,\n );\n console.groupEnd();\n }\n\n /**\n * Iterates all modelItems to calculate the validation status.\n *\n * Model alerts are given on 'fx-bind' elements as either attribute `alert` or as `fx-alert` child elements.\n *\n * During model-construct all model alerts are added to the modelItem if any\n *\n * to revalidate:\n * Gets the `constraint` attribute declaration from modelItem.bind\n * Computes the XPath to a Boolean\n * Updates the modelItem.constraint property\n *\n * todo: type checking\n * todo: run browser validation API\n *\n */\n revalidate() {\n console.group('### revalidate');\n\n let valid = true;\n this.modelItems.forEach(modelItem => {\n // console.log('validating node ', modelItem.node);\n\n const { bind } = modelItem;\n if (bind) {\n /*\n todo: investigate why bind is an element when created in fx-bind.init() and an fx-bind object when\n created lazily.\n */\n if (typeof bind.hasAttribute === 'function' && bind.hasAttribute('constraint')) {\n const constraint = bind.getAttribute('constraint');\n if (constraint) {\n const compute = evaluateXPathToBoolean(constraint, modelItem.node, this);\n console.log('modelItem validity computed: ', compute);\n modelItem.constraint = compute;\n if (!compute) valid = false;\n // ### alerts are added only once during model-construct. Otherwise they would add up in each run of revalidate()\n if (!this.modelConstructed) {\n // todo: get alert from attribute or child element\n const alert = bind.getAlert();\n if (alert) {\n modelItem.addAlert(alert);\n }\n }\n }\n }\n }\n });\n console.log('modelItems after revalidate: ', this.modelItems);\n console.groupEnd();\n return valid;\n }\n\n /**\n *\n * @param node\n * @returns {ModelItem}\n */\n getModelItem(node) {\n return this.modelItems.find(m => m.node === node);\n }\n\n /**\n * get the default evaluation context for this model.\n * @returns {Element} the\n */\n getDefaultContext() {\n return this.instances[0].getDefaultContext();\n }\n\n getDefaultInstance() {\n return this.instances[0];\n }\n\n getDefaultInstanceData() {\n console.log('default instance data ', this.instances[0].instanceData);\n return this.instances[0].instanceData;\n }\n\n getInstance(id) {\n // console.log('getInstance ', id);\n // console.log('instances ', this.instances);\n // console.log('instances array ',Array.from(this.instances));\n\n const instArray = Array.from(this.instances);\n return instArray.find(inst => inst.id === id);\n }\n\n evalBinding(bindingExpr) {\n // console.log('MODEL.evalBinding ', bindingExpr);\n // default context of evaluation is always the default instance\n const result = this.instances[0].evalXPath(bindingExpr);\n return result;\n }\n}\n\ncustomElements.define('fx-model', FxModel);\n","import { evaluateXPathToFirstNode } from './xpath-evaluation.js';\n\nimport { XPathUtil } from './xpath-util.js';\n\nfunction _getParentElement(node) {\n if (node.nodeType === Node.ATTRIBUTE_NODE) {\n return node.ownerElement;\n }\n return node.parentNode;\n}\n\nfunction _getForeContext(node) {\n return node.closest('fx-fore');\n}\n\nfunction _getModelInContext(node) {\n // const ownerForm = node.closest('fx-fore');\n const ownerForm = _getForeContext(node);\n return ownerForm.getModel();\n}\n\nfunction _getInitialContext(node, ref) {\n const parentBind = node.closest('[ref]');\n\n if (parentBind !== null) {\n return parentBind.nodeset;\n }\n\n const model = _getModelInContext(node);\n if (XPathUtil.isAbsolutePath(ref)) {\n const instanceId = XPathUtil.getInstanceId(ref);\n return model.getInstance(instanceId).getDefaultContext();\n }\n if (model.getDefaultInstance() !== null) {\n return model.getDefaultInstance().getDefaultContext();\n }\n return [];\n}\n\nexport default function getInScopeContext(node, ref) {\n const parentElement = _getParentElement(node);\n /*\n if(parentElement.nodeName.toUpperCase() === 'FX-REPEATITEM'){\n return parentElement.nodeset;\n }\n*/\n\n const repeatItem = parentElement.closest('fx-repeatitem');\n if (repeatItem) {\n return repeatItem.nodeset;\n }\n\n if (node.nodeType === Node.ELEMENT_NODE && node.hasAttribute('context')) {\n const initialContext = _getInitialContext(node.parentNode, ref);\n const contextAttr = node.getAttribute('context');\n return evaluateXPathToFirstNode(contextAttr, initialContext, _getForeContext(parentElement));\n }\n return _getInitialContext(parentElement, ref);\n}\n","import { XPathUtil } from './xpath-util.js';\nimport { FxModel } from './fx-model.js';\nimport {\n evaluateXPath,\n evaluateXPathToFirstNode,\n evaluateXPathToString,\n} from './xpath-evaluation.js';\nimport getInScopeContext from './getInScopeContext.js';\n\nexport const foreElementMixin = superclass =>\n class ForeElementMixin extends superclass {\n static get properties() {\n return {\n /**\n * context object for evaluation\n */\n context: {\n type: Object,\n },\n /**\n * the model of this element\n */\n model: {\n type: Object,\n },\n /**\n * XPath binding expression pointing to bound node\n */\n ref: {\n type: String,\n },\n /**\n * The modelitem object associated to the bound node holding the evaluated state.\n */\n modelItem: {\n type: Object,\n },\n /**\n * the node(s) bound by this element\n */\n nodeset: {\n type: Object,\n },\n };\n }\n\n constructor() {\n super();\n this.context = null;\n this.model = null;\n this.modelItem = {};\n this.ref = this.hasAttribute('ref') ? this.getAttribute('ref') : '';\n }\n\n getModel() {\n // console.log('getModel this ', this);\n if (this.model) {\n return this.model;\n }\n // const ownerForm = this.closest('fx-fore');\n // const ownerForm = this.getOwnerForm(this);\n const ownerForm = this.getOwnerForm();\n return ownerForm.querySelector('fx-model');\n }\n\n /**\n *\n * @returns {{parentNode}|ForeElementMixin}\n */\n getOwnerForm() {\n let currentElement = this;\n while (currentElement && currentElement.parentNode) {\n // console.log('current ', currentElement);\n\n if (currentElement.nodeName.toUpperCase() === 'FX-FORE') {\n return currentElement;\n }\n\n if (currentElement.parentNode instanceof DocumentFragment) {\n currentElement = currentElement.parentNode.host;\n } else {\n currentElement = currentElement.parentNode;\n }\n }\n return currentElement;\n }\n\n /**\n * evaluation of fx-bind and UiElements differ in details so that each class needs it's own implementation.\n */\n evalInContext() {\n // const inscopeContext = this.getInScopeContext();\n const inscopeContext = getInScopeContext(this, this.ref);\n if (!inscopeContext) {\n console.warn('no in scopeContext for ', this);\n return;\n }\n if (this.ref === '') {\n this.nodeset = inscopeContext;\n } else if (Array.isArray(inscopeContext)) {\n inscopeContext.forEach(n => {\n if (XPathUtil.isSelfReference(this.ref)) {\n this.nodeset = inscopeContext;\n } else {\n const localResult = evaluateXPathToFirstNode(this.ref, n, null);\n // console.log('local result: ', localResult);\n this.nodeset.push(localResult);\n }\n });\n } else {\n // this.nodeset = fx.evaluateXPathToFirstNode(this.ref, inscopeContext, null, {namespaceResolver: this.namespaceResolver});\n\n // todo: code below fails - why?\n const formElement = this.getOwnerForm();\n if (inscopeContext.nodeType) {\n this.nodeset = evaluateXPathToFirstNode(this.ref, inscopeContext, formElement);\n } else {\n this.nodeset = evaluateXPath(this.ref, inscopeContext, formElement);\n }\n // this.nodeset = evaluateXPath(this.ref,inscopeContext,formElement)\n }\n // console.log('UiElement evaluated to nodeset: ', this.nodeset);\n }\n\n isNotBound() {\n return !this.hasAttribute('ref');\n }\n\n isBound() {\n return this.hasAttribute('ref');\n }\n\n getBindingExpr() {\n if (this.hasAttribute('ref')) {\n return this.getAttribute('ref');\n }\n // try to get closest parent bind\n const parent = this.parentNode.closest('[ref]');\n if (!parent) {\n return 'instance()'; // the default instance\n }\n return parent.getAttribute('ref');\n }\n\n getInstance() {\n if (this.ref.startsWith('instance(')) {\n const instId = XPathUtil.getInstanceId(this.ref);\n return this.getModel().getInstance(instId);\n }\n return this.getModel().getInstance('default');\n }\n\n _getParentBindingElement(start) {\n if (start.parentNode.host) {\n const { host } = start.parentNode;\n if (host.hasAttribute('ref')) {\n return host;\n }\n } else if (start.parentNode) {\n if (start.parentNode.hasAttribute('ref')) {\n return this.parentNode;\n }\n this._getParentBindingElement(this.parentNode);\n }\n return null;\n }\n\n getModelItem() {\n // return this.model.bindingMap.find(m => m.refnode === this.nodeset);\n // return this.getModel().bindingMap.find(m => m.refnode === this.nodeset);\n\n const mi = this.getModel().getModelItem(this.nodeset);\n if (mi) {\n this.modelItem = mi;\n }\n\n const repeated = this.closest('fx-repeatitem');\n let existed;\n if (repeated) {\n const { index } = this.closest('fx-repeatitem');\n if (Array.isArray(this.nodeset)) {\n existed = this.getModel().getModelItem(this.nodeset[index - 1]);\n } else {\n existed = this.getModel().getModelItem(this.nodeset);\n }\n } else {\n existed = this.getModel().getModelItem(this.nodeset);\n }\n\n if (!existed) {\n return FxModel.lazyCreateModelItem(this.getModel(), this.ref, this.nodeset);\n }\n return existed;\n }\n\n /**\n * Returns the effective value for the element.\n * a: look for 'value' attribute and if present evaluate it and return the resulting value\n * b: look for textContent and return the value if present\n * c: return null\n */\n getValue() {\n if (this.hasAttribute('value')) {\n const valAttr = this.getAttribute('value');\n try {\n const inscopeContext = getInScopeContext(this, valAttr);\n return evaluateXPathToString(valAttr, inscopeContext, this.getOwnerForm());\n } catch (error) {\n console.error(error);\n this.dispatch('error', { message: error });\n }\n }\n if (this.textContent) {\n return this.textContent;\n }\n return null;\n }\n\n getInScopeContext() {\n return getInScopeContext(this, this.ref);\n }\n\n dispatch(eventName, detail) {\n const event = new CustomEvent(eventName, {\n composed: true,\n bubbles: true,\n detail,\n });\n console.log('firing', event);\n this.dispatchEvent(event);\n }\n };\n","import { DependencyNotifyingDomFacade } from './DependencyNotifyingDomFacade.js';\nimport { foreElementMixin } from './ForeElementMixin.js';\nimport { ModelItem } from './modelitem.js';\nimport {\n evaluateXPathToBoolean,\n evaluateXPathToNodes,\n evaluateXPathToString,\n} from './xpath-evaluation.js';\nimport { XPathUtil } from './xpath-util.js';\n\n/**\n * FxBind declaratively attaches constraints to nodes in the data (instances).\n *\n * It's major task is to create ModelItem Objects for each Node in the data their ref is pointing to.\n *\n * References and constraint attributes use XPath statements to point to the nodes they are attributing.\n *\n * Note: why is fx-bind not extending BoundElement? Though fx-bind has a 'ref' attr it is not bound in the sense of\n * getting updates about changes of the bound nodes. Instead it acts as a factory for modelItems that are used by\n * BoundElements to track their state.\n */\n// export class FxBind extends HTMLElement {\nexport class FxBind extends foreElementMixin(HTMLElement) {\n static READONLY_DEFAULT = false;\n\n static REQUIRED_DEFAULT = false;\n\n static RELEVANT_DEFAULT = true;\n\n static CONSTRAINT_DEFAULT = true;\n\n static TYPE_DEFAULT = 'xs:string';\n\n /*\n static get styles() {\n return css`\n :host {\n display: none;\n }\n `;\n }\n*/\n\n /*\n static get properties() {\n return {\n ...super.properties,\n\n /!**\n * allows to calculate a value. This value will become readonly.\n *!/\n calculate: {\n type: String\n },\n contextNode:{\n type:Object\n },\n /!**\n * arbitrary XPath resolving to xs:boolean - defaults to 'true()'\n *!/\n constraint: {\n type: String\n },\n /!**\n * id of this bind\n *!/\n id:{\n type:String\n },\n /!**\n * the nodeset the bind is referring to by it's binding expression (ref attribute)\n *!/\n nodeset: {\n type: Array\n },\n /!**\n * the owning model of this bind\n *!/\n model:{\n type:Object\n },\n /!**\n * XPath statement resolving to xs:boolean to switch between readonly and readwrite mode - defaults to 'false()'\n *!/\n readonly: {\n type: String\n },\n /!**\n * the XPath binding expression of this bind\n *!/\n ref: {\n type: String\n },\n /!**\n * XPath statement resolving to xs:boolean to switch between relevant and non-relevant mode - defaults to 'true()'\n *!/\n relevant: {\n type: String\n },\n /!**\n * XPath statement resolving to xs:boolean to switch between required and optional - defaults to 'false'.\n *!/\n required: {\n type: String\n },\n /!**\n * XPath statement\n *!/\n type: {\n type: String\n }\n };\n }\n*/\n\n constructor() {\n super();\n // this.id='';\n // this.ref = '';\n // this.readonly = 'false()';\n // this.required = 'false()';\n // this.relevant = 'true()';\n // this.constraint = 'true()';\n // this.type = 'xs:string';\n // this.calculate = '';\n this.nodeset = [];\n this.model = {};\n this.contextNode = {};\n this.inited = false;\n }\n\n connectedCallback() {\n // console.log('connectedCallback ', this);\n // this.id = this.hasAttribute('id')?this.getAttribute('id'):;\n this.ref = this.getAttribute('ref');\n this.readonly = this.getAttribute('readonly');\n this.required = this.getAttribute('required');\n this.relevant = this.getAttribute('relevant');\n this.type = this.hasAttribute('type') ? this.getAttribute('type') : FxBind.TYPE_DEFAULT;\n this.calculate = this.getAttribute('calculate');\n }\n\n /**\n * initializes the bind element by evaluating the binding expression.\n *\n * For each node referred to by the binding expr a ModelItem object is created.\n *\n * @param model\n */\n init(model) {\n this.model = model;\n console.log('init binding ', this);\n this.instanceId = this._getInstanceId();\n this.bindType = this.getModel().getInstance(this.instanceId).type;\n // console.log('binding type ', this.bindType);\n\n if (this.bindType === 'xml') {\n this._evalInContext();\n this._buildBindGraph();\n this._createModelItems();\n }\n\n // ### process child bindings\n this._processChildren(model);\n }\n\n /*\n //todo: certainly not ideal to rely on duplicating instance id on instance document - better way later ;)\n static getPath(node){\n let path = fx.evaluateXPath('path()',node);\n const instanceId = node.ownerDocument.firstElementChild.getAttribute('id');\n if(instanceId !== 'default'){\n return '#' + instanceId + FxBind.shortenPath(path);\n }else {\n return FxBind.shortenPath(path);\n }\n\n }\n*/\n\n _buildBindGraph() {\n if (this.bindType === 'xml') {\n this.nodeset.forEach(node => {\n const path = XPathUtil.getPath(node);\n\n if (this.calculate) {\n this.model.mainGraph.addNode(`${path}:calculate`, node);\n // Calculated values are a dependency of the model item.\n // Make `model1` depend on `model1:calculate`\n this.model.mainGraph.addNode(path, node);\n this.model.mainGraph.addDependency(path, `${path}:calculate`);\n }\n\n const calculateRefs = this._getReferencesForProperty(this.calculate, node);\n if (calculateRefs.length !== 0) {\n this._addDependencies(calculateRefs, node, path, 'calculate');\n }\n\n const readonlyRefs = this._getReferencesForProperty(this.readonly, node);\n if (readonlyRefs.length !== 0) {\n this._addDependencies(readonlyRefs, node, path, 'readonly');\n } else if (this.readonly) {\n this.model.mainGraph.addNode(`${path}:readonly`, node);\n }\n\n // const requiredRefs = this.requiredReferences;\n const requiredRefs = this._getReferencesForProperty(this.required, node);\n if (requiredRefs.length !== 0) {\n this._addDependencies(requiredRefs, node, path, 'required');\n } else if (this.required) {\n this.model.mainGraph.addNode(`${path}:required`, node);\n }\n\n const relevantRefs = this._getReferencesForProperty(this.relevant, node);\n if (relevantRefs.length !== 0) {\n this._addDependencies(relevantRefs, node, path, 'relevant');\n } else if (this.relevant) {\n this.model.mainGraph.addNode(`${path}:relevant`, node);\n }\n\n const constraintRefs = this._getReferencesForProperty(this.constraint, node);\n if (constraintRefs.length !== 0) {\n this._addDependencies(constraintRefs, node, path, 'constraint');\n } else if (this.constraint) {\n this.model.mainGraph.addNode(`${path}:constraint`, node);\n }\n });\n }\n }\n\n _addNode(path, node) {\n if (!this.model.mainGraph.hasNode(path)) {\n this.model.mainGraph.addNode(path, { node });\n }\n }\n\n /**\n * Add the dependencies of this bind\n *\n * @param {Node[]} refs The nodes that are referenced by this bind. these need to be resolved before\n * this bind can be resolved.\n * @param {Node} node The start of the reference\n * @param {string} path The path to the start of the reference\n * @param {string} property The property with this dependency\n */\n _addDependencies(refs, node, path, property) {\n const nodeHash = `${path}:${property}`;\n if (refs.length !== 0) {\n if (!this.model.mainGraph.hasNode(nodeHash)) {\n this.model.mainGraph.addNode(nodeHash, node);\n }\n refs.forEach(ref => {\n const otherPath = XPathUtil.getPath(ref);\n\n if (!this.model.mainGraph.hasNode(otherPath)) {\n this.model.mainGraph.addNode(otherPath, ref);\n }\n this.model.mainGraph.addDependency(nodeHash, otherPath);\n });\n } else {\n this.model.mainGraph.addNode(nodeHash, node);\n }\n }\n\n _processChildren(model) {\n const childbinds = this.querySelectorAll(':scope > fx-bind');\n Array.from(childbinds).forEach(bind => {\n // console.log('init child bind ', bind);\n bind.init(model);\n });\n }\n\n /*\n render() {\n return html`\n \n `;\n }\n*/\n\n getAlert() {\n if (this.hasAttribute('alert')) {\n return this.getAttribute('alert');\n }\n const alertChild = this.querySelector('fx-alert');\n if (alertChild) {\n return alertChild.innerHTML;\n }\n return null;\n }\n\n /*\n firstUpdated(_changedProperties) {\n super.firstUpdated(_changedProperties);\n }\n */\n\n /*\n namespaceResolver(prefix) {\n // TODO: Do proper namespace resolving. Look at the ancestry / namespacesInScope of the declaration\n\n /!**\n * for (let ancestor = this; ancestor; ancestor = ancestor.parentNode) {\n * \tif (ancestor.getAttribute(`xmlns:${prefix}`)) {\n * // Return value\n * }\n * }\n *!/\n\n // console.log('namespaceResolver prefix', prefix);\n const ns = {\n xhtml: 'http://www.w3.org/1999/xhtml',\n // '' : Fore.XFORMS_NAMESPACE_URI\n };\n return ns[prefix] || null;\n }\n*/\n\n /**\n * overwrites\n */\n _evalInContext() {\n const inscopeContext = this.getInScopeContext();\n\n // reset nodeset\n this.nodeset = [];\n\n if (this.ref === '' || this.ref === null) {\n this.nodeset = inscopeContext;\n } else if (Array.isArray(inscopeContext)) {\n inscopeContext.forEach(n => {\n if (XPathUtil.isSelfReference(this.ref)) {\n this.nodeset = inscopeContext;\n } else {\n // eslint-disable-next-line no-lonely-if\n if (this.ref) {\n const localResult = evaluateXPathToNodes(this.ref, n, this.getOwnerForm());\n localResult.forEach(item => {\n this.nodeset.push(item);\n });\n /*\n const localResult = fx.evaluateXPathToFirstNode(this.ref, n, null, {namespaceResolver: this.namespaceResolver});\n this.nodeset.push(localResult);\n */\n }\n // console.log('local result: ', localResult);\n // this.nodeset.push(localResult);\n }\n });\n } else {\n const inst = this.getModel().getInstance(this.instanceId);\n if (inst.type === 'xml') {\n this.nodeset = evaluateXPathToNodes(this.ref, inscopeContext, this.getOwnerForm());\n } else {\n this.nodeset = this.ref;\n }\n }\n }\n\n _createModelItems() {\n // console.log('#### ', thi+s.nodeset);\n\n /*\n if(XPathUtil.isSelfReference(this.ref)){\n return;\n }\n */\n if (Array.isArray(this.nodeset)) {\n // todo - iterate and create\n // console.log('################################################ ', this.nodeset);\n // Array.from(this.nodeset).forEach((n, index) => {\n Array.from(this.nodeset).forEach(n => {\n // console.log('node ',n);\n // this._createModelItem(n, index);\n this._createModelItem(n);\n });\n } else {\n this._createModelItem(this.nodeset);\n }\n }\n\n static lazyCreateModelitems(model, ref, nodeset) {\n if (Array.isArray(nodeset)) {\n Array.from(nodeset).forEach(n => {\n FxBind.lazyCreateModelItem(model, ref, n);\n });\n } else {\n FxBind.lazyCreateModelItem(model, ref, nodeset);\n }\n }\n\n /*\n static lazyCreateModelItem(model,ref,node){\n console.log('lazyCreateModelItem ', node);\n\n let mItem = {};\n let targetNode = {};\n if(node === null) return null;\n if(node.nodeType === node.TEXT_NODE){\n // const parent = node.parentNode;\n // console.log('PARENT ', parent);\n targetNode = node.parentNode;\n }else {\n targetNode = node;\n }\n\n // const path = fx.evaluateXPath('path()',node);\n const path = FxBind.getPath(node);\n\n // const path = Fore.evaluateXPath ('path()', node, this, Fore.namespaceResolver) ;\n\n // ### intializing ModelItem with default values (as there is no matching for given ref)\n const mi = new ModelItem(path,\n ref,\n FxBind.READONLY_DEFAULT,\n FxBind.RELEVANT_DEFAULT,\n FxBind.REQUIRED_DEFAULT,\n FxBind.CONSTRAINT_DEFAULT,\n FxBind.TYPE_DEFAULT,\n targetNode,\n this);\n\n\n // console.log('new ModelItem is instanceof ModelItem ', mi instanceof ModelItem);\n model.registerModelItem(mi);\n return mi;\n }\n*/\n\n /**\n * creates a ModelItem for given instance node.\n *\n * Please note that for textnode no ModelItem is created but instead the one of its parent is used which either\n * must exist and be initialized already when we hit the textnode.\n * @param node\n * @private\n */\n // _createModelItem(node, index) {\n _createModelItem(node) {\n // console.log('_createModelItem node', node, index);\n\n /*\n this.calculateReferences = this._getReferencesForProperty(this.calculate,node);\n this.readOnlyReferences = this._getReferencesForProperty(this.readonly,node);\n this.requiredReferences = this._getReferencesForProperty(this.required,node);\n this.relevantReferences = this._getReferencesForProperty(this.relevant,node);\n this.constraintReferences = this._getReferencesForProperty(this.constraint,node);\n */\n\n /*\n if bind is the dot expression we use the modelitem of the parent\n */\n if (XPathUtil.isSelfReference(this.ref)) {\n const parentBoundElement = this.parentElement.closest('fx-bind[ref]');\n console.log('parent bound element ', parentBoundElement);\n\n if (parentBoundElement) {\n // todo: Could be fancier by combining them\n parentBoundElement.required = this.required; // overwrite parent property!\n } else {\n console.error('no parent bound element');\n }\n\n return;\n }\n\n // let value = null;\n // const mItem = {};\n /*\n let targetNode = {};\n if (node.nodeType === node.TEXT_NODE) {\n // const parent = node.parentNode;\n // console.log('PARENT ', parent);\n targetNode = node.parentNode;\n } else {\n targetNode = node;\n }\n*/\n const targetNode = node;\n\n // const path = fx.evaluateXPath('path()',node);\n // const path = this.getPath(node);\n const path = XPathUtil.getPath(node);\n // const shortPath = this.shortenPath(path);\n\n // ### constructiong default modelitem - will get evaluated during reaalculate()\n // ### constructiong default modelitem - will get evaluated during reaalculate()\n // ### constructiong default modelitem - will get evaluated during reaalculate()\n // const newItem = new ModelItem(shortPath,\n const newItem = new ModelItem(\n path,\n this.getBindingExpr(),\n FxBind.READONLY_DEFAULT,\n FxBind.RELEVANT_DEFAULT,\n FxBind.REQUIRED_DEFAULT,\n FxBind.CONSTRAINT_DEFAULT,\n this.type,\n targetNode,\n this,\n );\n\n this.getModel().registerModelItem(newItem);\n }\n\n /**\n * Get the nodes that are referred by the given XPath expression\n *\n * @param {string} propertyExpr The XPath to get the referenced nodes from\n *\n * @return {Node[]} The nodes that are referenced by the XPath\n */\n _getReferencesForProperty(propertyExpr) {\n if (propertyExpr) {\n const touchedNodes = new Set();\n const domFacade = new DependencyNotifyingDomFacade(otherNode => touchedNodes.add(otherNode));\n this.nodeset.forEach(node => {\n evaluateXPathToString(propertyExpr, node, this.getOwnerForm(), domFacade);\n });\n\n return Array.from(touchedNodes.values());\n }\n return [];\n }\n\n _initBooleanModelItemProperty(property, node) {\n // evaluate expression to boolean\n const propertyExpr = this[property];\n // console.log('####### ', propertyExpr);\n const result = evaluateXPathToBoolean(propertyExpr, node, this);\n return result;\n }\n\n static shortenPath(path) {\n const steps = path.split('/');\n let result = '';\n for (let i = 2; i < steps.length; i += 1) {\n const step = steps[i];\n if (step.indexOf('{}') !== -1) {\n const q = step.split('{}');\n result += `/${q[1]}`;\n } else {\n result += `/${step}`;\n }\n }\n return result;\n }\n\n // todo: more elaborated implementation ;)\n _getInstanceId() {\n const bindExpr = this.getBindingExpr();\n // console.log('_getInstanceId bindExpr ', bindExpr);\n if (bindExpr.startsWith('instance(')) {\n this.instanceId = XPathUtil.getInstanceId(bindExpr);\n return this.instanceId;\n }\n if (this.instanceId) {\n return this.instanceId;\n }\n return 'default';\n }\n}\ncustomElements.define('fx-bind', FxBind);\n","/*!\n * Toastify js 1.11.0\n * https://github.com/apvarun/toastify-js\n * @license MIT licensed\n *\n * Copyright (C) 2018 Varun A P\n */\n\n/**\n * Options used for Toastify\n * @typedef {Object} ToastifyConfigurationObject\n * @property {string} text - Message to be displayed in the toast\n * @property {Element} node - Provide a node to be mounted inside the toast. node takes higher precedence over text\n * @property {number} duration - Duration for which the toast should be displayed. -1 for permanent toast\n * @property {string|Element} selector - CSS ID Selector on which the toast should be added\n * @property {url} destination - URL to which the browser should be navigated on click of the toast\n * @property {boolean} newWindow - Decides whether the destination should be opened in a new window or not\n * @property {boolean} close - To show the close icon or not\n * @property {string} gravity - To show the toast from top or bottom\n * @property {string} position - To show the toast on left or right\n * @property {string} backgroundColor - Deprecated: Sets the background color of the toast\n * @property {url} avatar - Image/icon to be shown before text\n * @property {string} className - Ability to provide custom class name for further customization\n * @property {boolean} stopOnFocus - To stop timer when hovered over the toast (Only if duration is set)\n * @property {Function} callback - Invoked when the toast is dismissed\n * @property {Function} onClick - Invoked when the toast is clicked\n * @property {Object} offset - Ability to add some offset to axis\n * @property {boolean} escapeMarkup - Toggle the default behavior of escaping HTML markup\n * @property {Object} style - Use the HTML DOM style property to add styles to toast\n */\n\n\nclass Toastify {\n\n defaults = {\n oldestFirst: true,\n text: \"Toastify is awesome!\",\n node: undefined,\n duration: 3000,\n selector: undefined,\n callback: function() {},\n destination: undefined,\n newWindow: false,\n close: false,\n gravity: \"toastify-top\",\n positionLeft: false,\n position: \"\",\n backgroundColor: \"\",\n avatar: \"\",\n className: \"\",\n stopOnFocus: true,\n onClick: function() {},\n offset: { x: 0, y: 0 },\n escapeMarkup: true,\n style: { background: \"\" },\n };\n\n constructor(options) {\n /**\n * The version of Toastify\n * @type {string}\n * @public\n */\n this.version = \"1.11.0\";\n\n /**\n * The configuration object to configure Toastify\n * @type {ToastifyConfigurationObject}\n * @public\n */\n this.options = {};\n\n /**\n * The element that is the Toast\n * @type {Element}\n * @public\n */\n this.toastElement = null;\n\n /**\n * The root element that contains all the toasts\n * @type {Element}\n * @private\n */\n this._rootElement = document.body;\n\n this._init(options);\n }\n\n /**\n * Display the toast\n * @public\n */\n showToast() {\n // Creating the DOM object for the toast\n this.toastElement = this._buildToast();\n\n // Getting the root element to with the toast needs to be added\n if (typeof this.options.selector === \"string\") {\n this._rootElement = document.getElementById(this.options.selector);\n } else if (this.options.selector instanceof HTMLElement || this.options.selector instanceof ShadowRoot) {\n this._rootElement = this.options.selector;\n } else {\n this._rootElement = document.body;\n }\n\n // Validating if root element is present in DOM\n if (!this._rootElement) {\n throw \"Root element is not defined\";\n }\n\n // Adding the DOM element\n this._rootElement.insertBefore(this.toastElement, this._rootElement.firstChild);\n\n // Repositioning the toasts in case multiple toasts are present\n this._reposition();\n\n if (this.options.duration > 0) {\n this.toastElement.timeOutValue = window.setTimeout(\n () => {\n // Remove the toast from DOM\n this._removeElement(this.toastElement);\n },\n this.options.duration\n ); // Binding `this` for function invocation\n }\n\n // Supporting function chaining\n return this;\n }\n\n /**\n * Hide the toast\n * @public\n */\n hideToast() {\n if (this.toastElement.timeOutValue) {\n clearTimeout(this.toastElement.timeOutValue);\n }\n this._removeElement(this.toastElement);\n }\n\n /**\n * Init the Toastify class\n * @param {ToastifyConfigurationObject} options - The configuration object to configure Toastify\n * @param {string} [options.text=Hi there!] - Message to be displayed in the toast\n * @param {Element} [options.node] - Provide a node to be mounted inside the toast. node takes higher precedence over text\n * @param {number} [options.duration=3000] - Duration for which the toast should be displayed. -1 for permanent toast\n * @param {string} [options.selector] - CSS Selector on which the toast should be added\n * @param {url} [options.destination] - URL to which the browser should be navigated on click of the toast\n * @param {boolean} [options.newWindow=false] - Decides whether the destination should be opened in a new window or not\n * @param {boolean} [options.close=false] - To show the close icon or not\n * @param {string} [options.gravity=toastify-top] - To show the toast from top or bottom\n * @param {string} [options.position=right] - To show the toast on left or right\n * @param {string} [options.backgroundColor] - Sets the background color of the toast (To be deprecated)\n * @param {url} [options.avatar] - Image/icon to be shown before text\n * @param {string} [options.className] - Ability to provide custom class name for further customization\n * @param {boolean} [options.stopOnFocus] - To stop timer when hovered over the toast (Only if duration is set)\n * @param {Function} [options.callback] - Invoked when the toast is dismissed\n * @param {Function} [options.onClick] - Invoked when the toast is clicked\n * @param {Object} [options.offset] - Ability to add some offset to axis\n * @param {boolean} [options.escapeMarkup=true] - Toggle the default behavior of escaping HTML markup\n * @param {Object} [options.style] - Use the HTML DOM style property to add styles to toast\n * @private\n */\n _init(options) {\n\n // Setting defaults\n this.options = Object.assign(this.defaults, options);\n\n if (this.options.backgroundColor) {\n // This is being deprecated in favor of using the style HTML DOM property\n console.warn('DEPRECATION NOTICE: \"backgroundColor\" is being deprecated. Please use the \"style.background\" property.');\n }\n\n this.toastElement = null;\n\n this.options.gravity = options.gravity === \"bottom\" ? \"toastify-bottom\" : \"toastify-top\"; // toast position - top or bottom\n this.options.stopOnFocus = options.stopOnFocus === undefined ? true : options.stopOnFocus; // stop timeout on focus\n\n this.options.style.background = this.options.style.background || options.backgroundColor;\n }\n\n /**\n * Build the Toastify element\n * @returns {Element}\n * @private\n */\n _buildToast() {\n // Validating if the options are defined\n if (!this.options) {\n throw \"Toastify is not initialized\";\n }\n\n // Creating the DOM object\n let divElement = document.createElement(\"div\");\n divElement.className = `toastify on ${this.options.className}`;\n\n // Positioning toast to left or right or center (default right)\n divElement.className += ` toastify-${this.options.position}`;\n\n // Assigning gravity of element\n divElement.className += ` ${this.options.gravity}`;\n\n // Loop through our style object and apply styles to divElement\n for (const property in this.options.style) {\n divElement.style[property] = this.options.style[property];\n }\n\n // Adding the toast message/node\n if (this.options.node && this.options.node.nodeType === Node.ELEMENT_NODE) {\n // If we have a valid node, we insert it\n divElement.appendChild(this.options.node)\n } else {\n if (this.options.escapeMarkup) {\n divElement.innerText = this.options.text;\n } else {\n divElement.innerHTML = this.options.text;\n }\n\n if (this.options.avatar !== \"\") {\n let avatarElement = document.createElement(\"img\");\n avatarElement.src = this.options.avatar;\n\n avatarElement.className = \"toastify-avatar\";\n\n if (this.options.position == \"left\") {\n // Adding close icon on the left of content\n divElement.appendChild(avatarElement);\n } else {\n // Adding close icon on the right of content\n divElement.insertAdjacentElement(\"afterbegin\", avatarElement);\n }\n }\n }\n\n // Adding a close icon to the toast\n if (this.options.close === true) {\n // Create a span for close element\n let closeElement = document.createElement(\"span\");\n closeElement.innerHTML = \"✖\";\n\n closeElement.className = \"toast-close\";\n\n // Triggering the removal of toast from DOM on close click\n closeElement.addEventListener(\n \"click\",\n (event) => {\n event.stopPropagation();\n this._removeElement(this.toastElement);\n window.clearTimeout(this.toastElement.timeOutValue);\n }\n );\n\n //Calculating screen width\n const width = window.innerWidth > 0 ? window.innerWidth : screen.width;\n\n // Adding the close icon to the toast element\n // Display on the right if screen width is less than or equal to 360px\n if ((this.options.position == \"left\") && width > 360) {\n // Adding close icon on the left of content\n divElement.insertAdjacentElement(\"afterbegin\", closeElement);\n } else {\n // Adding close icon on the right of content\n divElement.appendChild(closeElement);\n }\n }\n\n // Clear timeout while toast is focused\n if (this.options.stopOnFocus && this.options.duration > 0) {\n // stop countdown\n divElement.addEventListener(\n \"mouseover\",\n (event) => {\n window.clearTimeout(divElement.timeOutValue);\n }\n )\n // add back the timeout\n divElement.addEventListener(\n \"mouseleave\",\n () => {\n divElement.timeOutValue = window.setTimeout(\n () => {\n // Remove the toast from DOM\n this._removeElement(divElement);\n },\n this.options.duration\n )\n }\n )\n }\n\n // Adding an on-click destination path\n if (typeof this.options.destination !== \"undefined\") {\n divElement.addEventListener(\n \"click\",\n (event) => {\n event.stopPropagation();\n if (this.options.newWindow === true) {\n window.open(this.options.destination, \"_blank\");\n } else {\n window.location = this.options.destination;\n }\n }\n );\n }\n\n if (typeof this.options.onClick === \"function\" && typeof this.options.destination === \"undefined\") {\n divElement.addEventListener(\n \"click\",\n (event) => {\n event.stopPropagation();\n this.options.onClick();\n }\n );\n }\n\n // Adding offset\n if (typeof this.options.offset === \"object\") {\n\n const x = this._getAxisOffsetAValue(\"x\", this.options);\n const y = this._getAxisOffsetAValue(\"y\", this.options);\n\n const xOffset = this.options.position == \"left\" ? x : `-${x}`;\n const yOffset = this.options.gravity == \"toastify-top\" ? y : `-${y}`;\n\n divElement.style.transform = `translate(${xOffset},${yOffset})`;\n\n }\n\n // Returning the generated element\n return divElement;\n }\n\n /**\n * Remove the toast from the DOM\n * @param {Element} toastElement\n */\n _removeElement(toastElement) {\n // Hiding the element\n toastElement.className = toastElement.className.replace(\" on\", \"\");\n\n // Removing the element from DOM after transition end\n window.setTimeout(\n () => {\n // remove options node if any\n if (this.options.node && this.options.node.parentNode) {\n this.options.node.parentNode.removeChild(this.options.node);\n }\n\n // Remove the element from the DOM, only when the parent node was not removed before.\n if (toastElement.parentNode) {\n toastElement.parentNode.removeChild(toastElement);\n }\n\n // Calling the callback function\n this.options.callback.call(toastElement);\n\n // Repositioning the toasts again\n this._reposition();\n },\n 400\n ); // Binding `this` for function invocation\n }\n\n /**\n * Position the toast on the DOM\n * @private\n */\n _reposition() {\n\n // Top margins with gravity\n let topLeftOffsetSize = {\n top: 15,\n bottom: 15,\n };\n let topRightOffsetSize = {\n top: 15,\n bottom: 15,\n };\n let offsetSize = {\n top: 15,\n bottom: 15,\n };\n\n // Get all toast messages that have been added to the container (selector)\n let allToasts = this._rootElement.querySelectorAll(\".toastify\");\n\n let classUsed;\n\n // Modifying the position of each toast element\n for (let i = 0; i < allToasts.length; i++) {\n // Getting the applied gravity\n if (allToasts[i].classList.contains(\"toastify-top\") === true) {\n classUsed = \"toastify-top\";\n } else {\n classUsed = \"toastify-bottom\";\n }\n\n let height = allToasts[i].offsetHeight;\n classUsed = classUsed.substr(9, classUsed.length - 1)\n // Spacing between toasts\n let offset = 15;\n\n let width = window.innerWidth > 0 ? window.innerWidth : screen.width;\n\n // Show toast in center if screen with less than or equal to 360px\n if (width <= 360) {\n // Setting the position\n allToasts[i].style[classUsed] = `${offsetSize[classUsed]}px`;\n\n offsetSize[classUsed] += height + offset;\n } else {\n if (allToasts[i].classList.contains(\"toastify-left\") === true) {\n // Setting the position\n allToasts[i].style[classUsed] = `${topLeftOffsetSize[classUsed]}px`;\n\n topLeftOffsetSize[classUsed] += height + offset;\n } else {\n // Setting the position\n allToasts[i].style[classUsed] = `${topRightOffsetSize[classUsed]}px`;\n\n topRightOffsetSize[classUsed] += height + offset;\n }\n }\n }\n }\n\n /**\n * Helper function to get offset\n * @param {string} axis - 'x' or 'y'\n * @param {ToastifyConfigurationObject} options - The options object containing the offset object\n */\n _getAxisOffsetAValue(axis, options) {\n\n if (options.offset[axis]) {\n if (isNaN(options.offset[axis])) {\n return options.offset[axis];\n } else {\n return `${options.offset[axis]}px`;\n }\n }\n\n return '0px';\n\n }\n\n }\n\n\n // Returning the Toastify function to be assigned to the window object/module\n function StartToastifyInstance(options) {\n return new Toastify(options);\n }\n\n export default StartToastifyInstance;\n","import Toastify from 'toastify-js/src/toastify-es';\n\n/**\n *\n * Wrapper component for toastify-js - https://github.com/apvarun/toastify-js\n *\n * @event jinn-toast - will show the toast with text passed in event\n */\nexport class JinnToast extends HTMLElement {\n\n static get properties() {\n return {\n avatar: {type: String},\n backgroundColor: {type: String},\n callback: {type: String},\n classProp: {type: String},\n close: {type: Boolean},\n destination: {type: String},\n duration: {type: Number},\n escapeMarkup: {type: Boolean},\n gravity: {type: String},\n newWindow: {type: Boolean},\n oldestFirst: {type: Boolean},\n position: {type: String},\n selector: {type: String},\n stopOnFocus: {type: Boolean},\n text: {type: String}\n };\n }\n\n constructor() {\n super();\n this.attachShadow({mode: 'open'});\n }\n\n _initVar(name, defaultVal) {\n return this.hasAttribute(name) ? this.getAttribute(name) : defaultVal;\n }\n\n connectedCallback() {\n this.avatar = this._initVar('avatar', '');\n this.backgroundColor = this._initVar('backgroundColor', '');\n this.callback = this._initVar('callback', {});\n this.classProp = this._initVar('data-class', '');\n this.close = (this._initVar('close', false)) === 'true';\n this.destination = this._initVar('destination', '');\n this.duration = Number(this._initVar('duration', 3000));\n this.escapeMarkup = (this._initVar('escapeMarkup', true)) === 'true';\n this.gravity = this._initVar('gravity', 'top');\n this.newWindow = (this._initVar('newWindow', false)) === 'true';\n // this.offSet = this._initVar('offSet', {});\n this.oldestFirst = (this._initVar('oldestFirst', true)) === 'true';\n this.position = this._initVar('position', 'right');\n // this.selector = this._initVar('selector','');\n this.stopOnFocus = this._initVar('stopOnFocus', true);\n this.text = this._initVar('text', '');\n\n const style = `\n :host{\n display:none;\n }\n `;\n this.shadowRoot.innerHTML = `\n \n ${this.renderHTML}\n `;\n\n /**\n * trigger toast via @jinn-toast events\n */\n this.addEventListener('jinn-toast', (ev) =>{\n this.showToast(ev.detail.text);\n });\n\n }\n\n showToast(text){\n new Toastify({\n avatar: this.avatar,\n // backgroundColor:this.backgroundColor,\n // callback: this.callback,\n className:this.classProp,\n close: this.close,\n destination: this.destination,\n duration: this.duration,\n escapeMarkup: this.escapeMarkup,\n gravity: this.gravity,\n newWindow: this.newWindow,\n // offset:this.offset,\n oldestFirst: this.oldestFirst,\n position: this.position,\n node: this.shadowRoot,\n stopOnFocus: this.stopOnFocus,\n text,\n }).showToast();\n\n }\n\n renderHTML() {\n return `\n \n `;\n }\n\n}\nwindow.customElements.define('jinn-toast', JinnToast);\n","import { Fore } from './fore.js';\nimport './fx-instance.js';\nimport './fx-model.js';\nimport '@jinntec/jinn-toast';\nimport { evaluateXPathToNodes, evaluateXPathToString } from './xpath-evaluation.js';\nimport getInScopeContext from './getInScopeContext.js';\n\n/**\n * Main class for Fore.Outermost container element for each Fore application.\n *\n *\n *\n * Root element for Fore. Kicks off initialization and displays messages.\n *\n * fx-fore is the outermost container for each form. A form can have exactly one model\n * with arbitrary number of instances.\n *\n * Main responsiblities are initialization of model, update of UI (refresh) and global messaging\n *\n * @ts-check\n */\nexport class FxFore extends HTMLElement {\n static get properties() {\n return {\n model: {\n type: Object,\n },\n ready: {\n type: Boolean,\n },\n };\n }\n\n constructor() {\n super();\n this.model = {};\n this.addEventListener('model-construct-done', this._handleModelConstructDone);\n this.addEventListener('message', this._displayMessage);\n this.addEventListener('error', this._displayError);\n window.addEventListener('compute-exception', e => {\n console.error('circular dependency: ', e);\n });\n\n this.ready = false;\n\n this.storedTemplateExpressionByNode = new Map();\n\n const style = `\n :host {\n display: block;\n height:auto;\n padding:var(--model-element-padding);\n font-family:Roboto, sans-serif;\n color:var(--paper-grey-900);\n }\n :host ::slotted(fx-model){\n display:none;\n }\n #modalMessage .dialogActions{\n text-align:center;\n }\n .overlay {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, 0.7);\n transition: all 500ms;\n visibility: hidden;\n opacity: 0;\n z-index:10;\n }\n .overlay.show {\n visibility: visible;\n opacity: 1;\n }\n\n .popup {\n margin: 70px auto;\n background: #fff;\n border-radius: 5px;\n width: 30%;\n position: relative;\n transition: all 5s ease-in-out;\n padding: 20px;\n\n }\n .popup h2 {\n margin-top: 0;\n width:100%;\n background:#eee;\n position:absolute;\n top:0;\n right:0;\n left:0;\n height:40px;\n border-radius: 5px;\n\n }\n .popup .close {\n position: absolute;\n top: 3px;\n right: 10px;\n transition: all 200ms;\n font-size: 30px;\n font-weight: bold;\n text-decoration: none;\n color: #333;\n }\n .popup .close:focus{\n outline:none;\n }\n\n .popup .close:hover {\n color: #06D85F;\n }\n #messageContent{\n margin-top:40px;\n }\n `;\n\n const html = `\n \n \n \n
\n `;\n\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.innerHTML = `\n \n ${html}\n `;\n }\n\n connectedCallback() {\n const slot = this.shadowRoot.querySelector('slot');\n slot.addEventListener('slotchange', event => {\n const children = event.target.assignedElements();\n let modelElement = children.find(\n modelElem => modelElem.nodeName.toUpperCase() === 'FX-MODEL',\n );\n if (!modelElement) {\n const generatedModel = document.createElement('FX-model');\n this.appendChild(generatedModel);\n modelElement = generatedModel;\n }\n if (!modelElement.inited) {\n console.log('########## FORE: kick off processing... ##########');\n modelElement.modelConstruct();\n }\n this.model = modelElement;\n });\n }\n\n evaluateToNodes(xpath, context) {\n return evaluateXPathToNodes(xpath, context, this);\n }\n\n disconnectedCallback() {}\n\n /**\n * refreshes the whole UI by visiting each bound element (having a 'ref' attribute) and applying the state of\n * the bound modelItem to the bound element.\n *\n *\n * AVT:\n *\n */\n async refresh() {\n // refresh () {\n console.group('### refresh');\n // await this.updateComplete;\n\n Fore.refreshChildren(this);\n // this.dispatchEvent(new CustomEvent('refresh-done', {detail:'foo'}));\n\n // ### refresh template expressions\n this._updateTemplateExpressions();\n\n console.groupEnd();\n console.log('### <<<<< dispatching refresh-done - end of UI update cycle >>>>>');\n this.dispatchEvent(new CustomEvent('refresh-done'));\n }\n\n /**\n * entry point for processing of template expression enclosed in '{}' brackets.\n *\n * Expressions are found with an XPath search. For each node an entry is added to the storedTemplateExpressionByNode map.\n *\n *\n * @private\n */\n _updateTemplateExpressions() {\n // Note the fact we're going over HTML here: therefore the `html` prefix.\n const search =\n \"(descendant-or-self::*/(text(), @*))[matches(.,'\\\\{.*\\\\}')] except descendant-or-self::xhtml:fx-model/descendant-or-self::node()/(., @*)\";\n\n const tmplExpressions = evaluateXPathToNodes(search, this, this);\n console.log('template expressions found ', tmplExpressions);\n\n /*\n storing expressions and their nodes for re-evaluation\n */\n Array.from(tmplExpressions).forEach(node => {\n if (this.storedTemplateExpressionByNode.has(node)) {\n // If the node is already known, do not process it twice\n return;\n }\n const expr = this._getTemplateExpression(node);\n\n this.storedTemplateExpressionByNode.set(node, expr);\n });\n\n // TODO: Should we clean up nodes that existed but are now gone?\n for (const node of this.storedTemplateExpressionByNode.keys()) {\n this._processTemplateExpression({\n node,\n expr: this.storedTemplateExpressionByNode.get(node),\n });\n }\n\n console.log('stored template expressions ', this.storedTemplateExpressionByNode);\n }\n\n // eslint-disable-next-line class-methods-use-this\n _processTemplateExpression(exprObj) {\n // console.log('processing template expression ', exprObj);\n\n const { expr } = exprObj;\n const { node } = exprObj;\n // console.log('expr ', expr);\n this.evaluateTemplateExpression(expr, node, this);\n }\n\n /**\n * evaluate a template expression (some expression in {} brackets) on a node (either text- or attribute node.\n * @param expr the XPath to evaluate\n * @param node the node which will get updated with evaluation result\n * @param form the form element\n */\n evaluateTemplateExpression(expr, node) {\n if (expr === '{}') return;\n const matches = expr.match(/{[^}]*}/g);\n const namespaceContextNode =\n node.nodeType === node.TEXT_NODE ? node.parentNode : node.ownerElement;\n if (matches) {\n matches.forEach(match => {\n // console.log('match ', match);\n let naked = match.substring(1, match.length - 1);\n const inscope = getInScopeContext(node, naked);\n if (!inscope) {\n const errNode =\n node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ATTRIBUTE_NODE\n ? node.parentNode\n : node;\n console.warn('no inscope context for ', errNode);\n return;\n }\n // Templates are special: they use the namespace configuration from the place where they are\n // being defined\n\n try {\n const result = evaluateXPathToString(naked, inscope, node, null, namespaceContextNode);\n\n // console.log('result of eval ', result);\n const replaced = expr.replaceAll(match, result);\n console.log('result of replacing ', replaced);\n\n if (node.nodeType === Node.ATTRIBUTE_NODE) {\n const parent = node.ownerElement;\n\n // parent.setAttribute(name, replaced);\n parent.setAttribute(node.nodeName, replaced);\n } else if (node.nodeType === Node.TEXT_NODE) {\n node.textContent = replaced;\n }\n\n if (replaced.includes('{')) {\n console.log('need to go next round');\n\n // todo: duplicated code here - see above\n naked = replaced.substring(1, replaced.length);\n this.evaluateTemplateExpression(replaced, node);\n }\n } catch (error) {\n this.dispatchEvent(new CustomEvent('error', { detail: error }));\n }\n });\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n _getTemplateExpression(node) {\n if (node.nodeType === Node.ATTRIBUTE_NODE) {\n return node.value;\n }\n if (node.nodeType === Node.TEXT_NODE) {\n return node.textContent;\n }\n return null;\n }\n\n _refreshChildren() {\n const uiElements = this.querySelectorAll('*');\n\n uiElements.forEach(element => {\n if (Fore.isUiElement(element.nodeName) && typeof element.refresh === 'function') {\n element.refresh();\n }\n });\n }\n\n _handleModelConstructDone() {\n this._initUI();\n }\n\n async _lazyCreateInstance() {\n const model = this.querySelector('fx-model');\n if (model.instances.length === 0) {\n console.log('### lazy creation of instance');\n const generatedInstance = document.createElement('fx-instance');\n model.appendChild(generatedInstance);\n\n const generated = document.implementation.createDocument(null, 'data', null);\n // const newData = this._generateInstance(this, generated.firstElementChild);\n this._generateInstance(this, generated.firstElementChild);\n generatedInstance.instanceData = generated;\n model.instances.push(generatedInstance);\n console.log('generatedInstance ', this.getModel().getDefaultInstanceData());\n }\n }\n\n /**\n * @param {Element} start\n * @param {Element} parent\n */\n _generateInstance(start, parent) {\n if (start.hasAttribute('ref') && !Fore.isActionElement(start.nodeName)) {\n const ref = start.getAttribute('ref');\n\n if (ref.includes('/')) {\n console.log('complex path to create ', ref);\n const steps = ref.split('/');\n steps.forEach(step => {\n console.log('step ', step);\n\n // const generated = document.createElement(ref);\n parent = this._generateNode(parent, step, start);\n });\n } else {\n parent = this._generateNode(parent, ref, start);\n }\n }\n\n if (start.hasChildNodes()) {\n const list = start.children;\n for (let i = 0; i < list.length; i += 1) {\n this._generateInstance(list[i], parent);\n }\n }\n return parent;\n }\n\n // eslint-disable-next-line class-methods-use-this\n _generateNode(parent, step, start) {\n const generated = parent.ownerDocument.createElement(step);\n if (start.children.length === 0) {\n generated.textContent = start.textContent;\n }\n parent.appendChild(generated);\n parent = generated;\n return parent;\n }\n\n /*\n _createStep(){\n\n }\n */\n\n /*\n _generateInstance(start, parent) {\n if (start.hasAttribute('ref')) {\n const ref = start.getAttribute('ref');\n\n if(ref.includes('/')){\n console.log('complex path to create ', ref);\n const steps = ref.split('/');\n steps.forEach(step => {\n console.log('step ', step);\n\n\n });\n }\n\n // const generated = document.createElement(ref);\n const generated = parent.ownerDocument.createElement(ref);\n if (start.children.length === 0) {\n generated.textContent = start.textContent;\n }\n parent.appendChild(generated);\n parent = generated;\n }\n\n if (start.hasChildNodes()) {\n const list = start.children;\n for (let i = 0; i < list.length; i += 1) {\n this._generateInstance(list[i], parent);\n }\n }\n return parent;\n }\n */\n\n async _initUI() {\n console.log('### _initUI()');\n\n await this._lazyCreateInstance();\n await this.refresh();\n this.ready = true;\n console.log('### <<<<< dispatching ready >>>>>');\n console.log('########## modelItems: ', this.getModel().modelItems);\n console.log('########## FORE: form fully initialized... ##########');\n this.dispatchEvent(new CustomEvent('ready', {}));\n }\n\n /**\n *\n * @returns {FxModel}\n */\n getModel() {\n return this.querySelector('fx-model');\n }\n\n _displayMessage(e) {\n const { level } = e.detail;\n const msg = e.detail.message;\n this._showMessage(level, msg);\n }\n\n _displayError(e) {\n // const { error } = e.detail;\n const msg = e.detail.message;\n // this._showMessage('modal', msg);\n const toast = this.shadowRoot.querySelector('#error');\n toast.showToast(msg);\n }\n\n _showMessage(level, msg) {\n if (level === 'modal') {\n // this.$.messageContent.innerText = msg;\n // this.$.modalMessage.open();\n\n this.shadowRoot.getElementById('messageContent').innerText = msg;\n // this.shadowRoot.getElementById('modalMessage').open();\n this.shadowRoot.getElementById('modalMessage').classList.add('show');\n } else if (level === 'modeless') {\n // const notification = this.$.modeless;\n this.shadowRoot.querySelector('#message').showToast(msg);\n } else {\n const toast = this.shadowRoot.querySelector('#message');\n toast.showToast(msg);\n }\n }\n}\n\ncustomElements.define('fx-fore', FxFore);\n","import { Fore } from './fore.js';\nimport { foreElementMixin } from './ForeElementMixin.js';\nimport { evaluateXPathToString, evaluateXPath } from './xpath-evaluation.js';\nimport getInScopeContext from './getInScopeContext.js';\n\n/**\n * todo: validate='false'\n */\nexport class FxSubmission extends foreElementMixin(HTMLElement) {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n }\n\n connectedCallback() {\n // this.style.display = 'none';\n this.methods = ['get', 'put', 'post', 'delete', 'head', 'urlencoded-post'];\n\n this.model = this.parentNode;\n\n // ### initialize properties with defaults\n // if (!this.hasAttribute('id')) throw new Error('id is required');\n if (!this.hasAttribute('id')) console.warn('id is required');\n this.id = this.getAttribute('id');\n\n /** if present should be a existing instance id */\n this.instance = this.hasAttribute('instance') ? this.getAttribute('instance') : null;\n\n /** http method */\n this.method = this.hasAttribute('method') ? this.getAttribute('method') : 'get';\n\n /** relevance processing - one of 'remove, keep or empty' */\n this.nonrelevant = this.hasAttribute('nonrelevant')\n ? this.getAttribute('nonrelevant')\n : 'remove';\n\n /** replace might be 'all', 'instance' or 'none' */\n this.replace = this.hasAttribute('replace') ? this.getAttribute('replace') : 'all';\n\n this.serialization = this.hasAttribute('serialization')\n ? this.getAttribute('serialization')\n : 'xml';\n\n // if (!this.hasAttribute('url')) throw new Error(`url is required for submission: ${this.id}`);\n if (!this.hasAttribute('url')) console.warn(`url is required for submission: ${this.id}`);\n this.url = this.getAttribute('url');\n\n this.targetref = this.hasAttribute('targetref') ? this.getAttribute('targetref') : null;\n\n this.mediatype = this.hasAttribute('mediatype')\n ? this.getAttribute('mediatype')\n : 'application/xml';\n\n this.validate = this.getAttribute('validate') ? this.getAttribute('validate') : 'true';\n this.shadowRoot.innerHTML = this.renderHTML();\n }\n\n // eslint-disable-next-line class-methods-use-this\n renderHTML() {\n return `\n \n `;\n }\n\n async submit() {\n await this.dispatch('submit', { submission: this });\n this._submit();\n }\n\n async _submit() {\n console.log('submitting....');\n this.evalInContext();\n const model = this.getModel();\n\n model.recalculate();\n\n if (this.validate) {\n const valid = model.revalidate();\n if (!valid) {\n console.log('validation failed. Bubmission stopped');\n return;\n }\n }\n console.log('model updated....');\n await this._serializeAndSend();\n }\n\n /**\n * resolves template expressions for a single attribute\n * @param expr the attribute value to evaluate\n * @param node the attribute node used for scoped resolution\n * @returns {*}\n * @private\n */\n _evaluateAttributeTemplateExpression(expr, node) {\n const matches = expr.match(/{[^}]*}/g);\n if (matches) {\n matches.forEach(match => {\n console.log('match ', match);\n const naked = match.substring(1, match.length - 1);\n const inscope = getInScopeContext(node, naked);\n const result = evaluateXPathToString(naked, inscope, this.getOwnerForm());\n const replaced = expr.replaceAll(match, result);\n console.log('replacing ', expr, ' with ', replaced);\n expr = replaced;\n });\n }\n return expr;\n }\n\n /**\n * sends the data after evaluating\n *\n * todo: can send only XML at the moment\n * @private\n */\n async _serializeAndSend() {\n const resolvedUrl = this._evaluateAttributeTemplateExpression(this.url, this);\n\n const instance = this.getInstance();\n if (instance.type !== 'xml') {\n console.error('JSON serialization is not supported yet');\n return;\n }\n\n // let serialized = serializer.serializeToString(this.nodeset);\n let serialized;\n if (this.serialization === 'none') {\n serialized = undefined;\n } else {\n const relevant = this.selectRelevant();\n serialized = this._serialize(instance.type, relevant);\n }\n\n // let serialized = serializer.serializeToString(relevant);\n if (this.method.toLowerCase() === 'get') {\n serialized = undefined;\n }\n // console.log('data being send', serialized);\n // console.log('submitting data',serialized);\n\n if (resolvedUrl === '#echo') {\n let doc;\n if (serialized) {\n doc = new DOMParser().parseFromString(serialized, 'application/xml');\n } else {\n doc = undefined;\n }\n // const doc = new DOMParser().parseFromString(serialized, 'application/xml');\n // const newDoc = doc.replaceChild(relevant, doc.firstElementChild);\n this._handleResponse(doc);\n this.dispatch('submit-done', {});\n return;\n }\n // ### setting headers\n const headers = this._getHeaders();\n console.log('headers', headers);\n\n // ### map urlencoded-post to post for fetch\n if (this.method === 'urlencoded-post') {\n this.method = 'post';\n }\n\n if (!this.methods.includes(this.method.toLowerCase())) {\n this.dispatch('error', { message: `Unknown method ${this.method}` });\n return;\n }\n const response = await fetch(resolvedUrl, {\n method: this.method,\n mode: 'cors',\n credentials: 'include',\n headers,\n body: serialized,\n });\n\n if (!response.ok || response.status > 400) {\n this.dispatch('submit-error', { message: `Error while submitting ${this.id}` });\n return;\n }\n\n const contentType = response.headers.get('content-type').toLowerCase();\n if (contentType.startsWith('text/plain') || contentType.startsWith('text/html')) {\n const text = await response.text();\n this._handleResponse(text);\n } else if (contentType.startsWith('application/json')) {\n const json = await response.json();\n this._handleResponse(json);\n } else if (contentType.startsWith('application/xml')) {\n const text = await response.text();\n const xml = new DOMParser().parseFromString(text, 'application/xml');\n this._handleResponse(xml);\n } else {\n const blob = await response.blob();\n this._handleResponse(blob);\n }\n\n this.dispatch('submit-done', {});\n }\n\n _serialize(instanceType, relevantNodes) {\n if (this.method === 'urlencoded-post') {\n // this.method = 'post';\n const params = new URLSearchParams();\n // console.log('nodes to serialize', relevantNodes);\n Array.from(relevantNodes.children).forEach(child => {\n params.append(child.nodeName, child.textContent);\n });\n return params;\n }\n if (instanceType === 'xml') {\n const serializer = new XMLSerializer();\n return serializer.serializeToString(relevantNodes);\n }\n /*\n if(instanceType === 'json'){\n console.warn('JSON serialization is not yet supported')\n }\n */\n throw new Error('unknown instance type ', instanceType);\n }\n\n _getHeaders() {\n const headers = new Headers();\n\n // ### set content-type header according to type of instance\n const instance = this.getInstance();\n const contentType = Fore.getContentType(instance, this.method);\n headers.append('Content-Type', contentType);\n // ### needed to overwrite browsers' setting of 'Accept' header\n if (headers.has('Accept')) {\n headers.delete('Accept');\n }\n // headers.append('Accept', 'application/xml');\n\n // ### add header defined by fx-header elements\n const headerElems = this.querySelectorAll('fx-header');\n Array.from(headerElems).forEach(header => {\n const { name } = header;\n const val = header.getValue();\n headers.append(name, val);\n });\n return headers;\n }\n\n _getUrlExpr() {\n return this.storedTemplateExpressions.find(stored => stored.node.nodeName === 'url');\n }\n\n _getTargetInstance() {\n let targetInstance;\n if (this.instance) {\n targetInstance = this.model.getInstance(this.instance);\n } else {\n targetInstance = this.model.getInstance('default');\n }\n if (!targetInstance) {\n throw new Error(`target instance not found: ${targetInstance}`);\n }\n return targetInstance;\n }\n\n _handleResponse(data) {\n console.log('_handleResponse ', data);\n if (this.replace === 'instance') {\n const targetInstance = this._getTargetInstance();\n if (targetInstance) {\n if (this.targetref) {\n const theTarget = evaluateXPath(this.targetref, targetInstance, this.getOwnerForm());\n console.log('theTarget', theTarget);\n const clone = data.firstElementChild;\n const parent = theTarget.parentNode;\n parent.replaceChild(clone, theTarget);\n console.log('finally ', parent);\n } else {\n const instanceData = data;\n targetInstance.instanceData = instanceData;\n console.log('### replaced instance ', targetInstance.instanceData);\n }\n\n this.model.updateModel(); // force update\n // this.model.formElement.refresh();\n this.getOwnerForm().refresh();\n } else {\n throw new Error(`target instance not found: ${targetInstance}`);\n }\n }\n\n if (this.replace === 'all') {\n document.getElementsByTagName('html')[0].innerHTML = data;\n }\n if (this.replace === 'target') {\n const target = this.getAttribute('target');\n const targetNode = document.querySelector(target);\n targetNode.innerHTML = data;\n }\n if (this.replace === 'redirect') {\n window.location.href = data;\n }\n\n /*\n const event = new CustomEvent('submit-done', {\n composed: true,\n bubbles: true,\n detail: {},\n });\n console.log('firing',event);\n this.dispatchEvent(event);\n */\n // this.dispatch('submit-done', {});\n }\n\n /**\n * select relevant nodes\n *\n * todo: support for 'empty'\n * @returns {*}\n */\n selectRelevant() {\n // ### no relevance selection - current nodeset is used 'as-is'\n if (this.nonrelevant === 'keep') {\n return this.nodeset;\n }\n\n // first check if nodeset of submission is relevant - otherwise bail out\n const mi = this.getModel().getModelItem(this.nodeset);\n if (mi && !mi.relevant) return null;\n\n const doc = new DOMParser().parseFromString('', 'application/xml');\n const root = doc.firstElementChild;\n\n if (this.nodeset.children.length === 0 && this._isRelevant(this.nodeset)) {\n return this.nodeset;\n }\n const result = this._filterRelevant(this.nodeset, root);\n return result;\n }\n\n _filterRelevant(node, result) {\n const { childNodes } = node;\n Array.from(childNodes).forEach(n => {\n if (this._isRelevant(n)) {\n const clone = n.cloneNode(false);\n result.appendChild(clone);\n const { attributes } = n;\n if (attributes) {\n Array.from(attributes).forEach(attr => {\n if (this._isRelevant(attr)) {\n clone.setAttribute(attr.nodeName, attr.value);\n } else if (this.nonrelevant === 'empty') {\n clone.setAttribute(attr.nodeName, '');\n } else {\n clone.removeAttribute(attr.nodeName);\n }\n });\n }\n return this._filterRelevant(n, clone);\n }\n return null;\n });\n return result;\n }\n\n _isRelevant(node) {\n const mi = this.getModel().getModelItem(node);\n if (!mi || mi.relevant) {\n return true;\n }\n return false;\n }\n\n _handleError() {\n this.dispatch('submit-error', {});\n /*\n console.log('ERRRORRRRR');\n this.dispatchEvent(\n new CustomEvent('submit-error', {\n composed: true,\n bubbles: true,\n detail: {},\n }),\n );\n */\n }\n}\n\ncustomElements.define('fx-submission', FxSubmission);\n","import { foreElementMixin } from './ForeElementMixin.js';\n\nexport class FxHeader extends foreElementMixin(HTMLElement) {\n constructor() {\n super();\n this.style.display = 'none';\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.innerHTML = ``;\n\n if (!this.hasAttribute('name')) {\n throw new Error('required attribute \"name\" missing');\n }\n this.name = this.getAttribute('name');\n }\n\n connectedCallback() {\n this.shadowRoot.innerHTML = ``;\n }\n}\ncustomElements.define('fx-header', FxHeader);\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n window.customElements.polyfillWrapFlushCallback !==\n undefined;\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes = (container, start, end = null, before = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.insertBefore(start, before);\n start = n;\n }\n};\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes = (container, start, end = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.removeChild(start);\n start = n;\n }\n};\n//# sourceMappingURL=dom.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = ``;\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n constructor(result, element) {\n this.parts = [];\n this.element = element;\n const nodesToRemove = [];\n const stack = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(element.content, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const { strings, values: { length } } = result;\n while (partIndex < length) {\n const node = walker.nextNode();\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n continue;\n }\n index++;\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if (node.hasAttributes()) {\n const attributes = node.attributes;\n const { length } = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)[2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName = name.toLowerCase() + boundAttributeSuffix;\n const attributeValue = node.getAttribute(attributeLookupName);\n node.removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({ type: 'attribute', index, name, strings: statics });\n partIndex += statics.length - 1;\n }\n }\n if (node.tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n }\n else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = node.data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n }\n else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({ type: 'node', index: ++index });\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n }\n else {\n node.data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n }\n else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if (node.data === marker) {\n const parent = node.parentNode;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({ type: 'node', index });\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n node.data = '';\n }\n else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n }\n else {\n let i = -1;\n while ((i = node.data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({ type: 'node', index: -1 });\n partIndex++;\n }\n }\n }\n }\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode.removeChild(n);\n }\n }\n}\nconst endsWith = (str, suffix) => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\nexport const isTemplatePartActive = (part) => part.index !== -1;\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex = \n// eslint-disable-next-line no-control-regex\n/([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n//# sourceMappingURL=template.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nconst directives = new WeakMap();\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`
<${repeat(items, (item) => html`
${item}
`)}
`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = (f) => ((...args) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n});\nexport const isDirective = (o) => {\n return typeof o === 'function' && directives.has(o);\n};\n//# sourceMappingURL=directive.js.map","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n//# sourceMappingURL=part.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nimport { isCEPolyfill } from './dom.js';\nimport { isTemplatePartActive } from './template.js';\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n constructor(template, processor, options) {\n this.__parts = [];\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n update(values) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n _clone() {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) :\n document.importNode(this.template.element.content, true);\n const stack = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(fragment, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node.nodeName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n node = walker.nextNode();\n }\n }\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node.previousSibling);\n this.__parts.push(part);\n }\n else {\n this.__parts.push(...this.processor.handleAttributeExpressions(node, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n//# sourceMappingURL=template-instance.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * @module lit-html\n */\nimport { reparentNodes } from './dom.js';\nimport { boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker } from './template.js';\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes.createPolicy('lit-html', { createHTML: (s) => s });\nconst commentMarker = ` ${marker} `;\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n constructor(strings, values, type, processor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n /**\n * Returns a string of HTML used to create a `` element.\n */\n getHTML() {\n const l = this.strings.length - 1;\n let html = '';\n let isCommentBinding = false;\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n // For each binding we want to determine the kind of marker to insert\n // into the template source before it's parsed by the browser's HTML\n // parser. The marker type is based on whether the expression is in an\n // attribute, text, or comment position.\n // * For node-position bindings we insert a comment with the marker\n // sentinel as its text content, like .\n // * For attribute bindings we insert just the marker sentinel for the\n // first binding, so that we support unquoted attribute bindings.\n // Subsequent bindings can use a comment marker because multi-binding\n // attributes must be quoted.\n // * For comment bindings we insert just the marker sentinel so we don't\n // close the comment.\n //\n // The following code scans the template source, but is *not* an HTML\n // parser. We don't need to track the tree structure of the HTML, only\n // whether a binding is inside a comment, and if not, if it appears to be\n // the first binding in an attribute.\n const commentOpen = s.lastIndexOf('', commentOpen + 1) === -1;\n // Check to see if we have an attribute-like sequence preceding the\n // expression. This can match \"name=value\" like structures in text,\n // comments, and attribute values, so there can be false-positives.\n const attributeMatch = lastAttributeNameRegex.exec(s);\n if (attributeMatch === null) {\n // We're only in this branch if we don't have a attribute-like\n // preceding sequence. For comments, this guards against unusual\n // attribute values like
. Cases like\n // are handled correctly in the attribute branch\n // below.\n html += s + (isCommentBinding ? commentMarker : nodeMarker);\n }\n else {\n // For attributes we use just a marker sentinel, and also append a\n // $lit$ suffix to the name to opt-out of attribute-specific parsing\n // that IE and Edge do for style and certain SVG attributes.\n html += s.substr(0, attributeMatch.index) + attributeMatch[1] +\n attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] +\n marker;\n }\n }\n html += this.strings[l];\n return html;\n }\n getTemplateElement() {\n const template = document.createElement('template');\n let value = this.getHTML();\n if (policy !== undefined) {\n // this is secure because `this.strings` is a TemplateStringsArray.\n // TODO: validate this when\n // https://github.com/tc39/proposal-array-is-template-object is\n // implemented.\n value = policy.createHTML(value);\n }\n template.innerHTML = value;\n return template;\n }\n}\n/**\n * A TemplateResult for SVG fragments.\n *\n * This class wraps HTML in an `