UNPKG

@seanox/aspect-js

Version:

full stack JavaScript framework for SPAs incl. reactivity rendering, mvc / mvvm, models, expression language, datasource, routing, paths, unit test and some more

1 lines 67.3 kB
(()=>{"use strict";if(void 0!==window.compliant)throw new Error("JavaScript incompatibility detected for: compliant");window.compliant=(context,payload)=>{if(null==context)return payload;if("undefined"!==new Function("return typeof "+context)())throw new Error("JavaScript incompatibility detected for: "+context);return context.match(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/)&&(context=`window["${context}"]`),eval(context+" = payload")},compliant("Namespace",{get PATTERN_NAMESPACE_SEPARATOR(){return/\./},get PATTERN_NAMESPACE_LEVEL_START(){return/^[_a-z\$][\w\$]*$/i},get PATTERN_NAMESPACE_LEVEL(){return/^[\w\$]+$/},use(...e){if(e.length<=0)return window;_filter(...e);let a=e.length,i=null;return 0<e.length&&"object"==typeof e[0]&&(i=e.shift()),a-=e.length,(e=e.join(".")).split(Namespace.PATTERN_NAMESPACE_SEPARATOR).forEach((e,t,r)=>{var o=0===t&&null===i?Namespace.PATTERN_NAMESPACE_LEVEL_START:Namespace.PATTERN_NAMESPACE_LEVEL;if(!e.match(o))throw new Error("Invalid namespace at level "+(t+1)+(e&&e.trim()?": "+e.trim():""));if(0===t&&null===i){if(void 0!==(i=_populate(i,e))&&!(i instanceof Element))return;i=window}var o=_populate(i,e),n=typeof o;if("undefined"!=n&&"object"!=n)throw new TypeError(`Invalid namespace type at level ${t+1+a}: `+n);(null==o||o instanceof Element)&&(t<r.length-1&&r[t+1].match(/^\d+$/)?i[e]=[]:i[e]={}),i=_populate(i,e)}),i},create(...e){if(e.length<2)throw new Error("Invalid namespace for creation: Namespace and/or value is missing");var t=e.pop(),r=(e=_filter(...e)).pop(),e=Namespace.use(...e);return null===e?null:(e[r]=t,_populate(e,r))},lookup(...t){if(t.length<=0)return window;_filter(...t);var r=t.length;let o=null;0<t.length&&"object"==typeof t[0]&&(o=t.shift()),r-=t.length,t=(t=t.join(".")).split(Namespace.PATTERN_NAMESPACE_SEPARATOR);for(let e=0;e<t.length;e++){var n=t[e],a=e+r===0?Namespace.PATTERN_NAMESPACE_LEVEL_START:Namespace.PATTERN_NAMESPACE_LEVEL;if(!n.match(a))throw new Error("Invalid namespace at level "+(e+1+r)+(n&&n.trim()?": "+n.trim():""));if(0===e&&null===o){if(void 0!==(o=_populate(o,n)))continue;o=window}if(null==(o=_populate(o,n)))return o;if(o instanceof Element)return}return o},exists(...e){return!(e.length<1)&&Object.usable(Namespace.lookup(...e))}});const _filter=(...e)=>{const r=[];return e.forEach((e,t)=>{if(0===t&&"object"!=typeof e&&"string"!=typeof e)throw new TypeError(`Invalid namespace at level ${t+1}: `+typeof e);if(0===t&&null===e)throw new TypeError(`Invalid namespace at level ${t+1}: null`);if(0<t&&"string"!=typeof e&&"number"!=typeof e)throw new TypeError(`Invalid namespace at level ${t+1}: `+typeof e);e="string"==typeof e?e.split(Namespace.PATTERN_NAMESPACE_SEPARATOR):[e],r.push(...e)}),r},_populate=(namespace,level)=>{if(namespace&&namespace!==window)return namespace[level];try{return eval(`typeof ${level} !== "undefined" ? ${level} : undefined`)}catch(error){if(error instanceof ReferenceError&&namespace===window)return window[level];throw error}},_appendChild=Element.prototype.appendChild,_offset=(Element.prototype.appendChild=function(t,e){if(e&&(this.innerHTML=""),t instanceof Node||!(Array.isArray(t)||t instanceof NodeList||Symbol&&Symbol.iterator&&t&&(t[Symbol.iterator],1)))return _appendChild.call(this,t);t=Array.from(t);for(let e=0;e<t.length;e++)_appendChild.call(this,t[e]);return t},compliant("Math.unique",t=>{(t=t||16)<0&&(t=16);let r="";for(let e=0;e<t;e++){var o=Math.floor(Math.random()*Math.floor(26));Math.floor(Math.random()*Math.floor(26))%2==0?r+=String(o%10):r+=String.fromCharCode(65+o)}return r}),compliant("Math.serial",()=>_serial.toString()),-9466848e5),_serial={timing:Date.now()+_offset,number:0,toString(){var e=Date.now()+_offset,e=(this.number=this.timing===e?this.number+1:0,this.timing=e,this.timing.toString(36)),t=this.number.toString(36);return(e.length.toString(36)+e+t.length.toString(36)+t).toUpperCase()}};compliant("RegExp.quote",e=>Object.usable(e)?String(e).replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&"):null),compliant("String.prototype.capitalize",function(){return this.length<=0?this:this.charAt(0).toUpperCase()+this.slice(1)}),compliant("String.prototype.uncapitalize",function(){return this.length<=0?this:this.charAt(0).toLowerCase()+this.slice(1)}),compliant("String.prototype.encodeHex",function(){let r="";for(let t=0;t<this.length;t++){let e=Number(this.charCodeAt(t)).toString(16).toUpperCase();for(;e.length<2;)e="0"+e;r+=e}return"0x"+r}),compliant("String.prototype.decodeHex",function(){let t=this,r=(t.match(/^0x/)&&(t=t.substring(2)),"");for(let e=0;e<t.length;e+=2)r+=String.fromCharCode(parseInt(t.substring(e,2),16));return r}),compliant("String.prototype.encodeBase64",function(){try{return btoa(encodeURIComponent(this).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode("0x"+t)))}catch(e){throw new Error("Malformed character sequence")}}),compliant("String.prototype.decodeBase64",function(){try{return decodeURIComponent(atob(this).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))}catch(e){throw new Error("Malformed character sequence")}}),compliant("String.prototype.encodeHtml",function(){var e=document.createElement("div");return e.textContent=this,e.innerHTML}),compliant("String.prototype.hashCode",function(){let t=0,r=0;for(let e=0;e<this.length;e++){var o=31*t+this.charCodeAt(e);t=Number.isSafeInteger(o)?o:(r++,Number.MAX_SAFE_INTEGER-t+this.charCodeAt(e))}return t=((t=(t=Math.abs(t).toString(36)).length.toString(36)+t)+r.toString(36)).toUpperCase()}),compliant("String.prototype.unescape",function(){let text=this.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/^(["'])/,"$1").replace(/([^\\])((?:\\{2})*)(?=["'])/g,"$1$2\\");return eval(`"${text}"`)}),compliant("window.serial"),Object.defineProperty(window,"serial",{value:Math.serial()}),compliant("window.location.contextPath"),Object.defineProperty(window.location,"contextPath",{value:(e=>e.substring(0,e.lastIndexOf("/"))+"/")(window.location.pathname||"/")}),compliant("window.location.combine",(...e)=>"/"+e.join("/").replace(/[\/\\]+/g,"/").replace(/(^\/+)|(\/+$)/g,""))})(),(()=>{"use strict";const s=window.location.combine(window.location.contextPath,"/data"),u=/^(?:([a-z]+):\/+)(\/((\w+)|(\w+(\-+\w+)+)))+$/,c=/^\s*text\s*\/\s*javascript\s*$/i,a=/(^\w+$)|(^((\w+\-+(?=\w))+)\w*$)/,l=(compliant("DataSource",{get locale(){return DataSource.locales?DataSource.locales.selection:null},localize(e){if(!DataSource.data||!DataSource.locales)throw new Error("Locale not available");if("string"!=typeof e)throw new TypeError("Invalid locale: "+typeof e);if(!(e=(e||"").trim().toLowerCase())||!DataSource.locales.includes(e))throw new Error("Locale not available");DataSource.locales.selection=e},transform(e,t,r){if("string"==typeof e&&e.match(u)&&(e=DataSource.fetch(e)),"string"==typeof t&&t.match(u)&&(t=DataSource.fetch(t)),!(e instanceof XMLDocument))throw new TypeError("Invalid xml document");if(!(t instanceof XMLDocument))throw new TypeError("Invalid xml stylesheet");var o,n,a=new XSLTProcessor;if(a.importStylesheet(t),r&&"object"==typeof r)for([o,n]of"function"!=typeof r[Symbol.iterator]?Object.entries(r):r)"function"!=typeof r[o]&&a.setParameter(null,o,n);let i=e.evaluate("string(/*/@escape)",e,null,XPathResult.ANY_TYPE,null).stringValue;i=!!i.match(/^yes|on|true|1$/i);t=a.transformToDocument(e.clone());let s=t.querySelectorAll(i?"*":"*[escape]");s.forEach(e=>{var t;(i||(e.getAttribute("escape")||"on").match(/^yes|on|true|1$/i))&&(t=e.innerHTML).indexOf("<")<0&&t.indexOf(">")<0&&(e.innerHTML=e.textContent),e.removeAttribute("escape")}),(s=t.querySelectorAll("script[type],script:not([type])")).forEach(e=>{e.hasAttribute("type")&&!(e.getAttribute("type")||"").match(c)||e.setAttribute("type","composite/javascript")}),s=t.childNodes,t.body?s=t.body.childNodes:t.firstChild&&t.firstChild.nodeName.match(/^transformiix\b/i)&&(s=t.firstChild.childNodes);var l=document.createDocumentFragment();s=Array.from(s);for(let e=0;e<s.length;e++)l.appendChild(s[e]);return l},fetch(e,t,r){if("string"!=typeof e||!e.match(u))throw new Error("Invalid locator: "+String(e));var o=e.match(u)[1],n=e.match(u)[2];if(1===arguments.length){let e=s+"/"+DataSource.locale+"/"+n+"."+o;n=(e=e.replace(/\/+/g,"/")).hashCode();if(l.hasOwnProperty(n))return l[n];var a=new XMLHttpRequest;if(a.overrideMimeType("application/xslt+xml"),a.open("GET",e,!1),a.send(),200!==a.status)throw new Error(`HTTP status ${a.status} for `+a.responseURL);return e=a.responseXML,(l[n]=e).clone()}if(!o.match(/^xml$/)&&t)throw new Error("Transformation is not supported for this locator");a=DataSource.fetch(e);if(!t)return a.clone();let i=e.replace(/(^((\w+\-+(?=\w))+)\w*)|(^\w+)/,"xslt");if("boolean"==typeof t||"string"==typeof(i=t)&&i.match(u))return DataSource.transform(a,DataSource.fetch(i),r);throw new Error("Invalid style: "+String(i))},collect(...e){if(e.length<=0)return null;let t=[],r="collection";if(2===e.length&&"string"==typeof e[0]&&Array.isArray(e[1])){if(!e[0].match(a))throw new TypeError("Invalid collector");r=e[0],t=Array.from(e[1])}else t=1===e.length&&Array.isArray(e[0])?t.concat(e[0]):Array.from(e);let o=r.hashCode()+":"+t.join().hashCode();if(t.forEach(e=>o+=":"+String(e).hashCode()),l.hasOwnProperty(o))return l[o].clone();const n=document.implementation.createDocument(null,r,null);return t.forEach(e=>{if("string"!=typeof e)throw new TypeError("Invalid collection entry");n.documentElement.appendChild(DataSource.fetch(e).documentElement.cloneNode(!0))}),(l[o]=n).clone()}}),compliant("XMLDocument.prototype.clone",function(){var e=this.implementation.createDocument(null,null);return e.appendChild(e.importNode(this.documentElement,!0)),e}),{});Object.defineProperty(DataSource,"cache",{value:{}}),Object.defineProperty(DataSource,"locales",{value:[],enumerable:!0});let r=[];if([navigator.language].concat(navigator.languages||[]).forEach(e=>{e=e.toLowerCase().trim(),r.push(e),e=e.replace(/-.*$/,""),r.includes(e)||r.push(e)}),r.length<=0)throw new Error("Locale not available");var o=new XMLHttpRequest;if(o.overrideMimeType("text/plain"),o.open("GET",s+"/locales.xml",!1),o.send(),Object.defineProperty(DataSource,"data",{value:200===o.status?(new DOMParser).parseFromString(o.responseText,"text/xml"):null}),!DataSource.data&&404!==o.status)throw new Error("Locale not available");if(DataSource.data){o=DataSource.data;let t=o.evaluate("/locales/*[@default]",o,null,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null);for(let e=t.iterateNext();e;e=t.iterateNext()){var n=e.nodeName.toLowerCase();DataSource.locales.includes(n)||DataSource.locales.push(n)}for(let e=(t=o.evaluate("/locales/*",o,null,XPathResult.UNORDERED_NODE_ITERATOR_TYPE,null)).iterateNext();e;e=t.iterateNext()){var i=e.nodeName.toLowerCase();DataSource.locales.includes(i)||DataSource.locales.push(i)}if(DataSource.locales.length<=0)throw new Error("Locale not available");r.push(DataSource.locales[0]),r=r.filter(e=>DataSource.locales.includes(e)),DataSource.locales.selection=(r.length?r:DataSource.locales)[0]}})(),(()=>{compliant("Scripting",{eval(n){if("string"!=typeof n)throw new TypeError("Invalid data type");let a,r;for(let o=0;o<n.length;o++){let e=n.charAt(o);if(!(o>=n.length)||a){if(r<0){if("?"===e){r=1;var t="_tolerate(()=>";n=n.substring(0,o)+t+n.substring(o+1),o+=t.length;continue}e.match(/\s/)||(r=0)}if("\\"===e)o++;else if(a)(a===n.substring(o,o+a.length)||"\n"===a&&"\r"===e)&&(a=null);else switch(e){case"/":"/"===(e=n.charAt(o+1))&&(a="\n"),"*"===e&&(a="*/");continue;case"(":0<r?r++:r=-1;continue;case")":if(r<=0)continue;if(0<--r)continue;n=n.substring(0,o)+")"+n.substring(o),o+=")".length;continue;case"'":case'"':case"`":a=e;continue;case"#":let t=n.substring(o-1,o+10);var i=t.match(/(^|\W)(#(?:import|export|module|use))\s/);if(i){let r=i[2];for(let e=o+r.length;e<=n.length;e++)if((t=n.charAt(e)).match(/[;\r\n]/)||!(e<n.length)){let t=n.substring(o+r.length,e).trim();switch(r){case"#import":if(!t.match(/^(\w+(\/\w+)*)(\s+(\w+(\/\w+)*))*$/))throw new Error(("Invalid macro: #import "+t).trim());var s=t.split(/\s+/).map(e=>'"'+e+'"');r="_import(...["+s.join(",")+"])";break;case"#export":const l=[],a=/^([_a-z]\w*)(?:@((?:[_a-z]\w*)(?:\.[_a-z]\w*)*))?$/i;t.split(/\s+/).forEach(e=>{e=e.match(a);if(!e)throw new Error(("Invalid macro: #export "+t).trim());t=[e[1],'"'+e[1]+'"'],e[2]&&t.push('"'+e[2]+'"'),l.push("["+t.join(",")+"]")}),r="_export(...["+l.join(",")+"])";break;case"#module":r=(r=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`").trim())&&"console.debug(`Module: "+r+"`)";break;case"#use":if(!t.match(/^([_a-z]\w*)(\.[_a-z]\w*)*(\s+([_a-z]\w*)(\.[_a-z]\w*)*)*$/i))throw new Error(("Invalid macro: #use "+t).trim());s=t.split(/\s+/).map(e=>'"'+e+'"');r="_use(...["+s.join(",")+"])"}n=n.substring(0,o-1)+(i[1]||"")+r+n.substring(e),o+=r.length;break}}continue;default:continue}}}return this.run(n)},run(script){if("string"!=typeof script)throw new TypeError("Invalid data type");if(script.trim())with(Composite.render.context)return eval(script)}});const _import=(...e)=>{e.forEach(e=>Composite.load(Composite.MODULES+"/"+e+".js",!0))},_export=(...e)=>{e.forEach(e=>{let t=window;(e[2]?e[2].split(/\./):[]).forEach(e=>{void 0===t[e]&&(t[e]={}),t=t[e]});var r=t[e[1]];if(!(void 0===r||r instanceof Element||r instanceof HTMLCollection))throw new Error("Context for export is already in use: "+e[1]+(e[2]?"@"+e[2]:""));t[e[1]]=e[0]})},_use=(...e)=>{e.forEach(e=>Namespace.use(e))},_tolerate=e=>{try{return e.call(window)}catch(e){return!1}}})(),(()=>{"use strict";compliant("Expression",{eval(...e){let t;1<e.length?t=String(e[1]):0<e.length&&(t=String(e[0]));let r,o=(r=1<e.length&&e[0]?String(e[0]):r)?n.get(r):null;o=o||u(a,t),r&&n.set(r,o);try{return Scripting.run(o)}catch(e){return console.error(e.message+"\n\t"+o),new Error(e.message+" in "+o)}}});const n=new Map,a=0,i=["and","&&","or","||","not","!","eq","==","eeq","===","ne","!=","nee","!==","lt","<","gt",">","le","<=","ge",">=","empty","!","div","/","mod","%"],s=new RegExp("(^|[^\\w\\.])("+i.filter((e,t)=>t%2==0).join("|")+")(?=[^\\w\\.]|$)","ig"),l=(e,r)=>e.replace(/[\t\r](\d+)\n/g,(e,t)=>r[t]),u=(e,t,r=[])=>{switch(e){case a:let e=t=t.replace(/[\r\n]/g," ").trim();if(!(e=(e=e.replace(/\{\{(.*?)\}\}/g,(e,t)=>u(3,t,r))).replace(/((?:[^\n]+$)|(?:[^\n]+(?=\r)))/g,(e,t)=>u(2,t,r))).match(/^(\r(\d+)\n)*$/))throw Error("Error in the expression structure\n\t"+t);const o=!t.startsWith("{{")||!t.endsWith("}}")||t.substring(2).includes("{{")||t.substring(0,t.length-2).includes("}}");return e=(e=(e=(e=(e=(e=(e=e.replace(/(?:\r(\d+)\n)/g,(e,t)=>o?"\r("+r[t]+")\n":"\r"+r[t]+"\n")).replace(/\r\\u0022\n/g,'\\"')).replace(/\r\\u0027\n/g,"\\'")).replace(/\r\\u0060\n/g,"\\`")).replace(/(\n\r)+/g," + ")).replace(/(^\r)|(\n$)/g,"")).replace(/[\r\n]+/g," ");case 2:t='"'+t+'"';case 1:return r.push(t),"\r"+(r.length-1)+"\n";case 3:if(!(t=t.trim()))return"";if((t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/(^|[^\\])((?:\\{2})*)(\\\")/g,"$1$2\r\\u0022\n")).replace(/(^|[^\\])((?:\\{2})*)(\\\')/g,"$1$2\r\\u0027\n")).replace(/(^|[^\\])((?:\\{2})*)(\\\`)/g,"$1$2\r\\u0060\n")).replace(/((['\"\`])[.\s\S]*?\2)/g,(e,t)=>u(1,t,r))).replace(/\t+/g," ")).replace(s,(e,t,r)=>t+i[i.indexOf(r.toLowerCase())+1])).replace(/(^|[^\w\.])(true|false|null|undefined|new|instanceof|typeof)(?=[^\w\.]|$)/gi,(e,t="",r="")=>t+r.toLowerCase())).replace(/#\[([^\[\]]*)\]/g,(e,t)=>(t=t.replace(/\/{2}([.\s\S]*?)\/{2}/g,'"+($1)+"'),r.push(l('document.getElementById("'+t+'")',r)),"\r"+(r.length-1)+"\n"))).replace(/#([_a-z]\w*)/gi,(e,t)=>(r.push(l('document.getElementById("'+t+'")',r)),"\r"+(r.length-1)+"\n"))).match(/\(\s*\?/))for(let e=-1;e<r.length;)e=r.length,t=t.replace(/(\([^\(\)]*\))/g,e=>(e=e.replace(/^\( *\?+ *([.\s\S]*?) *\)$/,(e,t)=>"_tolerate(()=>("+t+"))"),r.push(l(e,r)),"\t"+(r.length-1)+"\n"));return t=t.replace(/ {2,}/g," "),r.push(l(t,r)),"\r"+(r.length-1)+"\n";default:throw new Error("Unexpected script type")}}})(),(()=>{"use strict";const e=[],P=[],O=[],U=(compliant("Composite",{get MODULES(){return window.location.combine(window.location.contextPath,"/modules")},get ATTRIBUTE_COMPOSITE(){return"composite"},get ATTRIBUTE_CONDITION(){return"condition"},get ATTRIBUTE_EVENTS(){return"events"},get ATTRIBUTE_ID(){return"id"},get ATTRIBUTE_IMPORT(){return"import"},get ATTRIBUTE_INTERVAL(){return"interval"},get ATTRIBUTE_ITERATE(){return"iterate"},get ATTRIBUTE_MESSAGE(){return"message"},get ATTRIBUTE_NAME(){return"name"},get ATTRIBUTE_OUTPUT(){return"output"},get ATTRIBUTE_RENDER(){return"render"},get ATTRIBUTE_RELEASE(){return"release"},get ATTRIBUTE_TEXT(){return"text"},get ATTRIBUTE_TYPE(){return"type"},get ATTRIBUTE_VALIDATE(){return"validate"},get ATTRIBUTE_VALUE(){return"value"},get PATTERN_ATTRIBUTE_ACCEPT(){return/^(composite|condition|events|id|import|interval|iterate|message|output|release|render|validate)$/i},get PATTERN_ATTRIBUTE_STATIC(){return/^(composite|id)$/i},get PATTERN_EXPRESSION_CONTAINS(){return/\{\{(.|\r|\n)*?\}\}/g},get PATTERN_EXPRESSION_CONDITION(){return/^\s*\{\{\s*(([^}]|(}(?!})))*?)\s*\}\}\s*$/i},get PATTERN_EXPRESSION_VARIABLE(){return/^\s*\{\{\s*((?:(?:_*[a-z])|(?:_\w*))\w*)\s*:\s*(([^}]|(}(?!})))*?)\s*\}\}\s*$/i},get PATTERN_ELEMENT_IGNORE(){return/script|style/i},get PATTERN_SCRIPT(){return/script/i},get PATTERN_COMPOSITE_SCRIPT(){return/^composite\/javascript$/i},get PATTERN_COMPOSITE_ID(){return/^([_a-z]\w*)(?:@([_a-z]\w*(?::[_a-z]\w*)*))?$/i},get PATTERN_ELEMENT_ID(){return/^([_a-z]\w*)(?::(\w+(?::\w+)*))?(?:#(\w+))?(?:@([_a-z]\w*(?::[_a-z]\w*)*))?$/i},get PATTERN_CUSTOMIZE_SCOPE(){return/[_a-z]([\w-]*\w)?$/i},get PATTERN_DATASOURCE_URL(){return/^\s*xml:\s*(\/\S+)\s*(?:\s*(?:xslt|xsl):\s*(\/\S+))*$/i},get PATTERN_EVENT(){return/^([A-Z][a-z]+)+$/},get EVENT_RENDER_START(){return"RenderStart"},get EVENT_RENDER_NEXT(){return"RenderNext"},get EVENT_RENDER_END(){return"RenderEnd"},get EVENT_MOUNT_START(){return"MountStart"},get EVENT_MOUNT_NEXT(){return"MountNext"},get EVENT_MOUNT_END(){return"MountEnd"},get EVENT_MODULE_LOAD(){return"ModuleLoad"},get EVENT_MODULE_DOCK(){return"ModuleDock"},get EVENT_MODULE_READY(){return"ModuleReady"},get EVENT_MODULE_UNDOCK(){return"ModuleUndock"},get EVENT_HTTP_START(){return"HttpStart"},get EVENT_HTTP_PROGRESS(){return"HttpProgress"},get EVENT_HTTP_RECEIVE(){return"HttpReceive"},get EVENT_HTTP_LOAD(){return"HttpLoad"},get EVENT_HTTP_ABORT(){return"HttpAbort"},get EVENT_HTTP_TIMEOUT(){return"HttpTimeout"},get EVENT_HTTP_ERROR(){return"HttpError"},get EVENT_HTTP_END(){return"HttpEnd"},get EVENT_ERROR(){return"Error"},get EVENTS(){return"abort after|print animation|end animation|iteration animation|start before|print before|unload blur can|play can|play|through change click context|menu copy cut dbl|click drag drag|end drag|enter drag|leave drag|over drag|start drop duration|change ended error focus focus|in focus|out hash|change input invalid key|down key|press key|up load loaded|data loaded|meta|data load|start message mouse|down mouse|enter mouse|leave mouse|move mouse|over mouse|out mouse|up mouse|wheel offline online open page|hide page|show paste pause play playing popstate progress rate|change resize reset scroll search seeked seeking select show stalled storage submit suspend time|update toggle touch|cancel touch|end touch|move touch|start transition|end unload volume|change waiting wheel"},get PATTERN_EVENT_FUNCTIONS(){return e=Composite.EVENTS.replace(/(?:\||\b)(\w)/g,(e,t)=>t.toUpperCase()),new RegExp("^on("+e.replace(/\s+/g,"|")+")");var e},get PATTERN_EVENT_NAMES(){return Composite.EVENTS.replace(/(?:\||\b)(\w)/g,(e,t)=>t.toUpperCase()).split(/\s+/)},get PATTERN_EVENT_FILTER(){return Composite.EVENTS.replace(/(?:\||\b)(\w)/g,(e,t)=>t.toUpperCase()).toLowerCase().split(/\s+/)},lock(e,t){if(e.queue=e.queue||[],void 0===e.lock||!1===e.lock)if(e.lock={ticks:1,selector:t,queue:[],share(){return this.ticks++,this},release(){if(this.ticks--,!(0<this.ticks)){if(e===Composite.render){let e=this.selector;e instanceof Node&&e.nodeType===Node.TEXT_NODE&&(r=e.ordinal(),(r=j[r]||{}).condition)&&r.condition.element&&r.condition.marker===this.selector&&(e=r.condition.element);let t=[];"string"==typeof e?(r=document.querySelectorAll(e),Array.from(r).forEach(e=>{t.includes(e)||t.push(e);e=e.querySelectorAll("*");Array.from(e).forEach(e=>{t.includes(e)||t.push(e)})})):e instanceof Element&&(t=e.querySelectorAll("*"),t=[e].concat(Array.from(t))),t.forEach(e=>Composite.mount(e)),Composite.fire(Composite.EVENT_RENDER_END,this.selector)}else{if(e!==Composite.mount)throw new Error("Invalid context: "+e);Composite.fire(Composite.EVENT_MOUNT_END,this.selector)}var r=e.queue.shift();r&&Composite.asynchron(e,r),e.lock=!1}}},e===Composite.render)Composite.fire(Composite.EVENT_RENDER_START,t);else{if(e!==Composite.mount)throw new Error("Invalid context: "+e);Composite.fire(Composite.EVENT_MOUNT_START,t)}else if(e===Composite.render)Composite.fire(Composite.EVENT_RENDER_NEXT,t);else{if(e!==Composite.mount)throw new Error("Invalid context: "+e);Composite.fire(Composite.EVENT_MOUNT_NEXT,t)}return e.lock},listen(e,t){if("string"!=typeof e)throw new TypeError("Invalid event: "+typeof e);if("function"!=typeof t&&null!=t)throw new TypeError("Invalid callback: "+typeof t);if(!e.match(Composite.PATTERN_EVENT))throw new Error("Invalid event"+(e.trim()?": "+e:""));e=e.toLowerCase(),o.has(e)&&Array.isArray(o.get(e))||o.set(e,[]),o.get(e).push(t)},fire(e,...t){var r;e=(e||"").trim(),o.size<=0||!e||(r=o.get(e.toLowerCase()),Array.isArray(r)&&(t=[e,...t],r.forEach(e=>e(...t))))},asynchron(e,...t){window.setTimeout((e,...t)=>{e(...t)},0,e,...t)},lookup(e){if(null==e)return null;if("string"==typeof e){var t=document.querySelectorAll(e.trim());if(t.length<=0)return null;if(1<t.length)throw new Error("Selector is not unique");return Composite.lookup(t[0])}return e instanceof Element?(null!==(t=V(e))&&delete t.target,t):null},validate(o,n){if((arguments.length<2||!1!==n)&&(n=!0),"string"==typeof o){if(!(o=o.trim()))return;let r=Array.from(document.querySelectorAll(o));return r.forEach((e,t)=>{r[t]=Composite.validate(e,n),void 0===r[t]?r[t]=0:r[t]=!0===r[t]?1:2}),(r=r.join("")).match(/^1+$/)?!0:!r.match(/2/)&&void 0}if(o instanceof Element){var r=o.ordinal(),a=j[r];let t=!0;"function"==typeof o.setCustomValidity&&o.setCustomValidity(""),"function"==typeof o.checkValidity&&(t=o.checkValidity());var i,s=V(o);if(s instanceof Object){let e;o instanceof Element&&(o.tagName.match(/^input$/i)&&o.type.match(/^radio|checkbox/i)?e=o.checked:o.tagName.match(/^select/i)&&"selectedIndex"in o?e=o.options[o.selectedIndex].value:Composite.ATTRIBUTE_VALUE in o&&(e=o[Composite.ATTRIBUTE_VALUE])),a.attributes.hasOwnProperty(Composite.ATTRIBUTE_VALIDATE)&&!0===t&&!0!==n&&"function"==typeof s.model[Composite.ATTRIBUTE_VALIDATE]&&(i=s.model[Composite.ATTRIBUTE_VALIDATE],t=void 0!==e?i.call(s.model,o,e):i.call(s.model,o))}if("function"==typeof o.setCustomValidity&&(!0===t&&Object.usable(a.message)&&Object.usable(a.message.attribute)&&o.removeAttribute(a.message.attribute),!0!==t)){let e;"string"!=typeof(e="string"==typeof t&&t.trim()?t.trim():e)&&((e=a.attributes.hasOwnProperty(Composite.ATTRIBUTE_MESSAGE)?String(a.attributes[Composite.ATTRIBUTE_MESSAGE]||""):e)||"").match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(e=String(Expression.eval(r+":"+Composite.ATTRIBUTE_MESSAGE,e))),Object.usable(e)&&((i=e.match(/^@([_a-z](?:[\w-]*\w)?):\s*(.*?)\s*$/i))?(s=i[1],(a.statics||{}).hasOwnProperty(s.toLowerCase())||Composite.PATTERN_ATTRIBUTE_STATIC.test(s)||(a.message={attribute:s},o.setAttribute(s,i[2])),o.setCustomValidity(i[2])):(o.setCustomValidity(e),"function"==typeof o.reportValidity&&o.reportValidity()))}if(void 0!==t)return t}},mount(t,r){if(Composite.mount.queue=Composite.mount.queue||[],Composite.mount.lock&&Composite.mount.lock!==r)Composite.mount.queue.includes(t)||Composite.mount.queue.push(t);else{r=Composite.lock(Composite.mount,t);try{if("string"==typeof t)return(t=t.trim())?void document.querySelectorAll(t).forEach(e=>Composite.mount(e,r.share())):void 0;if(t instanceof Element&&!Composite.mount.queue.includes(t)&&!t.nodeName.match(Composite.PATTERN_ELEMENT_IGNORE)&&(Composite.mount.stack=Composite.mount.stack||[],!Composite.mount.stack.includes(t))){var e=t.ordinal(),o=j[e];if(o instanceof Object){var n=o.attributes[Composite.ATTRIBUTE_ID];let r=o.attributes.hasOwnProperty(Composite.ATTRIBUTE_EVENTS)?o.attributes[Composite.ATTRIBUTE_EVENTS]:"";r=(r=(r=String(r||"")).toLowerCase().split(/\s+/)).filter((e,t,r)=>Composite.PATTERN_EVENT_FILTER.includes(e)&&r.indexOf(e)===t);var a=V(t);if(a instanceof Object&&n){let t=a.model;for(var i in t=void 0!==a.target?"object"==typeof a.target?a.target:null:t)"function"==typeof t[i]&&i.match(Composite.PATTERN_EVENT_FUNCTIONS)&&(i=i.substring(2).toLowerCase(),r.includes(i)||r.push(i));let e=t?Object.getPrototypeOf(t):null;for(;e;)Object.getOwnPropertyNames(e).forEach(e=>{"function"==typeof t[e]&&e.match(Composite.PATTERN_EVENT_FUNCTIONS)&&(e=e.substring(2).toLowerCase(),r.includes(e)||r.push(e))}),e=Object.getPrototypeOf(e)}if(Composite.mount.stack.push(t),r.forEach(e=>{t.addEventListener(e.toLowerCase(),o=>{var n=o.currentTarget,t=n.ordinal(),a=j[t],i=o.type.toLowerCase();if(Composite.PATTERN_EVENT_FILTER.includes(i)){i=Composite.PATTERN_EVENT_FILTER.indexOf(i),i=Composite.PATTERN_EVENT_NAMES[i];let r;var s=Composite.validate(n,!1),l=V(n);if(l instanceof Object){let t;if(n instanceof Element&&(n.tagName.match(/^input$/i)&&n.type.match(/^radio|checkbox/i)?t=n.checked:n.tagName.match(/^select/i)&&"selectedIndex"in n?t=n.options[n.selectedIndex].value:Composite.ATTRIBUTE_VALUE in n&&(t=n[Composite.ATTRIBUTE_VALUE])),"optional"===String(a.attributes[Composite.ATTRIBUTE_VALIDATE]).toLowerCase()||!0===s){n=e=>{var t=typeof e;return void 0!==e&&("object"==t&&null===e||"boolean"==t||"number"==t||"string"==t)};n(l.target)?l.target=t:"object"==typeof l.target?n(l.target[Composite.ATTRIBUTE_VALUE])&&(l.target[Composite.ATTRIBUTE_VALUE]=t):void 0===l.target&&n(l.model[Composite.ATTRIBUTE_VALUE])&&(l.model[Composite.ATTRIBUTE_VALUE]=t);let e=l.model;(e=void 0!==l.target?l.target&&"object"==typeof l.target?l.target:null:e)&&"function"==typeof e["on"+i]&&(r=e["on"+i].call(e,o))}}let e=a.attributes.hasOwnProperty(Composite.ATTRIBUTE_EVENTS)?a.attributes[Composite.ATTRIBUTE_EVENTS]:"";if((e=(e=String(e||"")).toLowerCase().split(/\s+/)).includes(i.toLowerCase())){let e=a.attributes.hasOwnProperty(Composite.ATTRIBUTE_RENDER)?a.attributes[Composite.ATTRIBUTE_RENDER]:"";((e=String(e||""))||"").match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(e=Expression.eval(t+":"+Composite.ATTRIBUTE_RENDER,e)),Composite.render(e)}return l instanceof Object&&((void 0!==r&&!r||void 0!==s&&!0!==s)&&o.preventDefault(),void 0!==r)?r:void 0}})}),a&&a.target&&n){let e=a.target;void 0!==(e=a.target instanceof Object?Composite.ATTRIBUTE_VALUE in a.target?a.target.value:void 0:e)&&(t.tagName.match(/^input$/i)&&t.type.match(/^radio|checkbox/i)?t.checked=e:Composite.ATTRIBUTE_VALUE in t&&(t[Composite.ATTRIBUTE_VALUE]=e))}}}}finally{r.release()}}},customize(...e){let t;if("string"==typeof(t=0<e.length?e[0]:t)&&1<e.length&&"string"==typeof e[1]&&t.match(/^@ATTRIBUTES-STATICS$/i)){const o=[];(e[1]||"").trim().split(/\s+/).forEach(e=>{e=e.toLowerCase(),U.has(e)||e.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||(U.add(e),o.push(e))});const n=t=>{if(t instanceof Element){var e=t.ordinal();const r=j[e];r&&(o.forEach(e=>{r.statics=r.statics||{},r.statics.hasOwnProperty[e]&&void 0!==r.statics[e]||(t.hasAttribute(e)?r.statics[e]=t.getAttribute(e):r.statics[e]=null)}),Array.from(t.childNodes).forEach(e=>n(e)))}};void n(document.body)}else if("function"==typeof t&&1===e.length)D.add(t);else{if("string"!=typeof t)throw new TypeError("Invalid scope: "+typeof t);var r,e=1<e.length?e[1]:null;if("function"!=typeof e&&null!=e)throw new TypeError("Invalid callback: "+typeof e);if((t=t.trim()).length<=0)throw new Error("Invalid scope");t.match(Composite.PATTERN_CUSTOMIZE_SCOPE)?null===e?k.delete(t.toLowerCase()):k.set(t.toLowerCase(),e):(r=t.toLowerCase().hashCode(),null===e?L.delete(r):L.set(r,{selector:t,callback:e}))}},render(a,i){if(Composite.render.queue=Composite.render.queue||[],a||!(Composite.render.queue.length<=0))if(Composite.render.lock&&Composite.render.lock!==i)Composite.render.queue.includes(a)||Composite.render.queue.push(a),Composite.asynchron(Composite.render);else{if((a=a||Composite.render.queue[0])instanceof Element&&!j[a.ordinal()]){O.push(...P);let e=a.getAttribute(Composite.ATTRIBUTE_ID)||"";e.match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(e=Expression.eval(a.ordinal()+":"+Composite.ATTRIBUTE_ID,e),a.setAttribute(Composite.ATTRIBUTE_ID,e)),O.length=0}i=Composite.lock(Composite.render,a);const o=a;try{if("string"==typeof a)return(a=a.trim())?void document.querySelectorAll(a).forEach(e=>Composite.render(e,i.share())):void 0;if(a instanceof Node){let o=a.ordinal(),n=j[o];O.length=0,n&&n.context?O.push(...n.context):O.push(...P);var e,t,r,s,l,u,c,p,T,m=k.get(a.nodeName.toLowerCase());if(!m||!1!==m(a)){if(a.parentNode)for(var[E,d]of L){var h=a.parentNode.querySelectorAll(d.selector);if(Array.from(h).includes(a)&&!1===d.callback(a))return}if(!n){const b=(e,t)=>!(!e||!e.parentNode)&&(t.test(e.parentNode.nodeName)||b(e.parentNode,t));if(b(a,Composite.PATTERN_ELEMENT_IGNORE))return;if(D.forEach(e=>e.call(null,a)),n={serial:o,element:a,attributes:{},context:[...O]},j[o]=n,a instanceof Element&&a.attributes){if(Array.from(a.attributes).forEach(e=>{((e={name:e.name.toLowerCase(),value:(e.value||"").trim()}).value.match(Composite.PATTERN_EXPRESSION_CONTAINS)||e.name.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||U.has(e.name))&&(!e.name.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||e.name.match(Composite.PATTERN_ATTRIBUTE_STATIC)||U.has(e.name)||e.name===Composite.ATTRIBUTE_RELEASE||a.removeAttribute(e.name),n.attributes[e.name]=e.value,e.value.match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(e.name.match(Composite.PATTERN_ATTRIBUTE_STATIC)||e.name===Composite.ATTRIBUTE_ID||e.name===Composite.ATTRIBUTE_EVENTS||U.has(e.name))&&(e.value=Expression.eval(a.ordinal()+":"+e.name,e.value)),!e.name.match(Composite.PATTERN_ATTRIBUTE_STATIC)&&e.name!==Composite.ATTRIBUTE_ID&&e.name!==Composite.ATTRIBUTE_EVENTS||(n.attributes[e.name]=e.value),n.statics=n.statics||{},U.has(e.name)&&(n.statics[e.name]=e.value),e.name.match(Composite.PATTERN_ATTRIBUTE_STATIC)||e.name===Composite.ATTRIBUTE_ID||e.name===Composite.ATTRIBUTE_EVENTS||U.has(e.name))&&a.setAttribute(e.name,e.value)}),n.attributes.hasOwnProperty(Composite.ATTRIBUTE_CONDITION)){var f,g,w,A=(n.attributes[Composite.ATTRIBUTE_CONDITION]||"").trim();if(A.match(Composite.PATTERN_EXPRESSION_CONDITION))return f=document.createTextNode(""),g=a.cloneNode(!0),w=n.attributes,n={serial:f.ordinal(),element:f,attributes:w,context:[...O],condition:{expression:A,template:g,marker:f,element:null,attributes:w,complete:!1,share:null}},j[n.serial]=n,delete j[o],a.parentNode.replaceChild(f,a),void Composite.render(f,i.share());throw new Error("Invalid condition"+(A?": "+A:""))}n.attributes.hasOwnProperty(Composite.ATTRIBUTE_COMPOSITE)&&Composite.include(a)}}if(!n.hasOwnProperty("condition")||n.condition.share!==i.ordinal()){if(n.hasOwnProperty("condition")&&Math.abs(n.condition.share||0)!==i.ordinal())return n.condition.share=-i.ordinal(),e=n.condition,t=Expression.eval(o+":"+Composite.ATTRIBUTE_CONDITION,e.expression),a.nodeValue=t instanceof Error?t:"",!0!==t?(e.element&&e.element.parentNode&&e.element.parentNode.removeChild(e.element),e.element=null,void(e.share=i.ordinal())):(e.element||(e.element=e.template.cloneNode(!0),r=e.element,s=Object.assign({},e.attributes),j[r.ordinal()]={serial:r.ordinal(),element:r,attributes:s,condition:e,context:[...O]},s.hasOwnProperty(Composite.ATTRIBUTE_COMPOSITE)&&Composite.include(r),a.parentNode.insertBefore(r,a)),void Composite.render(e.element,i.share()));if(n.hasOwnProperty("condition")&&n.condition.share!==-i.ordinal()&&(n.condition.share=i.ordinal()),a.nodeType===Node.TEXT_NODE){if(void 0===n.render&&""===a.textContent)return;if(n.attributes.hasOwnProperty(Composite.ATTRIBUTE_TEXT))return;if(n.attributes.hasOwnProperty(Composite.ATTRIBUTE_VALUE))return void n.render();let e=a.textContent;if(e.match(Composite.PATTERN_EXPRESSION_CONTAINS)){if((e=e.replace(Composite.PATTERN_EXPRESSION_CONTAINS,e=>{var t,r,o;return e.substring(2,e.length-2).trim()?(r={serial:t=(r=document.createTextNode("")).ordinal(),element:r,attributes:{},value:null,context:[...O],render(){let e="";var t,r;this.attributes.hasOwnProperty(Composite.ATTRIBUTE_NAME)?(t=String(this.attributes[Composite.ATTRIBUTE_NAME]||"").trim(),r=String(this.attributes[Composite.ATTRIBUTE_VALUE]||"").trim(),window[t]=Expression.eval(this.serial+":"+Composite.ATTRIBUTE_VALUE,r)):(e=String(this.attributes[Composite.ATTRIBUTE_VALUE]||""),e=Expression.eval(this.serial+":"+Composite.ATTRIBUTE_VALUE,e)),this.value=e,this.element.textContent=void 0!==e?e:""}},(o=e.match(Composite.PATTERN_EXPRESSION_VARIABLE))?(r.attributes[Composite.ATTRIBUTE_NAME]=o[1],r.attributes[Composite.ATTRIBUTE_VALUE]="{{"+o[2]+"}}"):r.attributes[Composite.ATTRIBUTE_VALUE]=e,j[t]=r,"{{"+t+"}}"):""})).match(Composite.PATTERN_EXPRESSION_CONTAINS))return(l=e.split(/(\{\{\d+\}\})/)).forEach((e,t,r)=>{var o,n;e.match(/^\{\{\d+\}\}$/)?(n=parseInt(e.substring(2,e.length-2).trim()),n=j[n],Composite.fire(Composite.EVENT_RENDER_NEXT,n.element),n.render(),r[t]=n.element):(n={serial:o=(n=document.createTextNode(e)).ordinal(),element:n,attributes:{},context:[...O]},Composite.fire(Composite.EVENT_RENDER_NEXT,n.element),n.element.textContent=e,n.attributes[Composite.ATTRIBUTE_TEXT]=e,j[o]=n,r[t]=n.element)}),null===a.parentNode?void 0:(l.forEach(e=>a.parentNode.insertBefore(e,a)),void a.parentNode.removeChild(a));a.nodeValue=e}void(n.attributes[Composite.ATTRIBUTE_TEXT]=e)}else if(a instanceof Element){if(n.attributes.hasOwnProperty(Composite.ATTRIBUTE_COMPOSITE)&&(c=((u=x(a)).namespace||[]).concat(u.model).join("."),M.has(c)||(M.add(c),(c=Object.lookup(c))&&"function"==typeof c.dock&&(p=V(a),Composite.fire(Composite.EVENT_MODULE_DOCK,p),c.dock.call(c),Composite.fire(Composite.EVENT_MODULE_READY,p)))),n.attributes.hasOwnProperty(Composite.ATTRIBUTE_IMPORT)){a.innerHTML="";let t=n.attributes[Composite.ATTRIBUTE_IMPORT];if(t=(t||"").match(Composite.PATTERN_EXPRESSION_CONTAINS)?Expression.eval(o+":"+Composite.ATTRIBUTE_IMPORT,String(t)):t)if(t instanceof Element||t instanceof NodeList)a.appendChild(t,!0),delete n.attributes[Composite.ATTRIBUTE_IMPORT];else if(String(t).match(Composite.PATTERN_DATASOURCE_URL)){let e=String(t).match(Composite.PATTERN_DATASOURCE_URL);e[2]=DataSource.fetch("xslt://"+(e[2]||e[1])),e[1]=DataSource.fetch("xml://"+e[1]),e=DataSource.transform(e[1],e[2]),a.appendChild(e,!0);var C=a.ordinal();delete j[C].attributes[Composite.ATTRIBUTE_IMPORT]}else void 0!==B[t]?(a.innerHTML=B[t],T=a.ordinal(),delete j[T].attributes[Composite.ATTRIBUTE_IMPORT]):Composite.asynchron((e,t,r)=>{try{var o=new XMLHttpRequest;if(o.overrideMimeType("text/plain"),o.open("GET",r,!1),o.send(),200!==o.status)throw new Error(`HTTP status ${o.status} for `+o.responseURL);var n=o.responseText.trim(),a=(B[o.responseURL]=n,e.innerHTML=n,e.ordinal());delete j[a].attributes[Composite.ATTRIBUTE_IMPORT]}catch(e){throw Composite.fire(Composite.EVENT_HTTP_ERROR,e),e}finally{t.release()}},a,i.share(),t);else delete n.attributes[Composite.ATTRIBUTE_IMPORT]}if(n.attributes.hasOwnProperty(Composite.ATTRIBUTE_OUTPUT)){a.innerHTML="";let t=n.attributes[Composite.ATTRIBUTE_OUTPUT];if((t||"").match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(t=Expression.eval(o+":"+Composite.ATTRIBUTE_OUTPUT,String(t))),String(t).match(Composite.PATTERN_DATASOURCE_URL)){let e=String(t).match(Composite.PATTERN_DATASOURCE_URL);e[2]=DataSource.fetch("xslt://"+(e[2]||e[1])),e[1]=DataSource.fetch("xml://"+e[1]),e=DataSource.transform(e[1],e[2]),a.appendChild(e,!0)}else t instanceof Node?a.appendChild(t.cloneNode(!0),!0):t instanceof NodeList?Array.from(t).forEach((e,t)=>a.appendChild(e.cloneNode(!0),0===t)):a.innerHTML=String(t)}let e=String(n.attributes[Composite.ATTRIBUTE_INTERVAL]||"").trim();if(e&&!n.interval){var N=o+":"+Composite.ATTRIBUTE_INTERVAL;if(!(e=String(Expression.eval(N,e))).match(/^\d*$/))throw new Error("Invalid interval: "+e);e=Number.parseInt(e),n.interval=window.setInterval(()=>{document.body.contains(a)?Composite.render(a):(window.clearInterval(n.interval),delete n.interval)},e)}if(n.attributes.hasOwnProperty(Composite.ATTRIBUTE_ITERATE)){if(!n.iterate){var _=String(n.attributes[Composite.ATTRIBUTE_ITERATE]||"").trim(),y=_.match(Composite.PATTERN_EXPRESSION_VARIABLE);if(!y)throw new Error("Invalid iterate"+(_?": "+_:""));n.iterate={name:y[1].trim(),expression:"{{"+y[2].trim()+"}}"},n.template=a.cloneNode(!0),a.innerHTML=""}var R=o+":"+Composite.ATTRIBUTE_ITERATE;let e=Expression.eval(R,n.iterate.expression);if(e instanceof Error)throw e;if(e){if(e instanceof XPathResult){for(var v={entry:null,array:[],iterate:e};v.entry=v.iterate.iterateNext();)v.array.push(v.entry);e=v.array}else e=Array.from(e);a.innerHTML="",e.forEach((e,t,r)=>{var o={};Object.defineProperty(o,"item",{enumerable:!0,value:e}),Object.defineProperty(o,"index",{enumerable:!0,value:t}),Object.defineProperty(o,"data",{enumerable:!0,value:r}),P.push({[n.iterate.name]:o}),Array.from(n.template.cloneNode(!0).childNodes).forEach(e=>{a.appendChild(e),Composite.render(e,i.share())}),P.pop()})}}if(!a.nodeName.match(Composite.PATTERN_ELEMENT_IGNORE)){var I=[];for(const S in n.attributes)n.attributes.hasOwnProperty(S)&&I.push(S);Composite.ATTRIBUTE_VALUE in a&&n.attributes.hasOwnProperty(Composite.ATTRIBUTE_VALUE)&&!I.includes(Composite.ATTRIBUTE_VALUE)&&I.push(Composite.ATTRIBUTE_VALUE),I.forEach(t=>{if(!t.match(Composite.PATTERN_ATTRIBUTE_ACCEPT)||t.match(Composite.PATTERN_ATTRIBUTE_STATIC)){let e=String(n.attributes[t]||"");var r;e.match(Composite.PATTERN_EXPRESSION_CONTAINS)&&(r=o+":"+t,void 0!==(e=Expression.eval(r,e))?(e=(e=String(e).encodeHtml()).replace(/"/g,"&quot;"),t.toLowerCase()===Composite.ATTRIBUTE_VALUE&&Composite.ATTRIBUTE_VALUE in a&&(a.value=e),t.startsWith("@")&&(a.removeAttribute(t),t=t.replace(/^@+/,"")),a.setAttribute(t,e)):a.removeAttribute(t),a[t]=e)}})}if(a.nodeName.match(Composite.PATTERN_SCRIPT))if((a.getAttribute(Composite.ATTRIBUTE_TYPE)||"").trim().match(Composite.PATTERN_COMPOSITE_SCRIPT))try{Scripting.eval(a.textContent)}catch(e){throw new Error("Composite JavaScript",e)}!a.childNodes||a.nodeName.match(Composite.PATTERN_ELEMENT_IGNORE)||n.attributes.hasOwnProperty(Composite.ATTRIBUTE_ITERATE)||Array.from(a.childNodes).forEach(e=>{a.contains(e)&&Composite.render(e,i.share())}),a.hasAttribute(Composite.ATTRIBUTE_RELEASE)&&a.removeAttribute(Composite.ATTRIBUTE_RELEASE)}}}}}catch(e){console.error(e),Composite.fire(Composite.EVENT_ERROR,e),o instanceof Element&&(o.innerText="Error: "+(e.message.match(/(\{\{|\}\})/)?"Invalid expression":e.message))}finally{O.length=0,Composite.render.queue=Composite.render.queue.filter(e=>e!==o),i.release()}}},load(t,e){if(!(t=(t||"").trim()).match(/\.(js|css|html)(\?.*)?$/i))throw new Error("Resource not supported"+(t?": "+t:""));if(r=t,(o=document.createElement("a")).href=r,!(t=o.pathname.replace(/\/{2,}/g,"/")).startsWith(Composite.MODULES+"/"))throw new Error("Resource not supported: "+t);if(!(t in B&&t.match(/\.(js|css)(\?.*)?$/i)||t in B&&void 0===B[t])){if(!(t in B)){B[t]=void 0;var r=new XMLHttpRequest;if(r.overrideMimeType("text/plain"),r.open("GET",t,!1),r.send(),404===r.status&&!e)return;if(200!==r.status)throw new Error(`HTTP status ${r.status} for `+r.responseURL);B[t]=r.responseText.trim()}var o=B[t];if(t.match(/\.js(\?.*)?$/i))try{Scripting.eval(o)}catch(e){throw console.error(t,e.name+": "+e.message),e}else if(t.match(/\.css(\?.*)?$/i)){e=document.querySelector("html head");if(!e)throw new Error("No head element found");r=document.createElement("style");r.setAttribute("type","text/css"),r.textContent=o,e.appendChild(r)}else if(t.match(/\.html(\?.*)?$/i))return o}},include(...e){if(e.length<=0||1===e.length&&!(e[0]instanceof Element)&&"string"!=typeof e[0])throw new TypeError("Invalid composite for include");let t=e=1===e.length&&e[0]instanceof Element?e[0]:e,r=null;if(e instanceof Element){if(!e.hasAttribute(Composite.ATTRIBUTE_ID))throw new Error("Unknown composite without id");if(!(r=j[e.ordinal()]))throw new Error("Unknown composite");var o=x(e);o.namespace||(o.namespace=[]),o.namespace.push(o.model),t=o.namespace}var o=Composite.MODULES+"/"+t.join("/"),n=Object.lookup(t.join("."));t=t.join("/"),void 0===B[o+".composite"]&&Composite.fire(Composite.EVENT_MODULE_LOAD,e,t),B[o+".composite"]=null,(void 0===n||n instanceof Element||n instanceof HTMLCollection||"common"===t)&&this.load(o+".js"),"common"===t&&this.load(o+".css"),e instanceof Element&&!e.innerHTML.trim()&&this.load(o+".css"),e instanceof Element&&!e.innerHTML.trim()&&!r.attributes.hasOwnProperty(Composite.ATTRIBUTE_IMPORT)&&!r.attributes.hasOwnProperty(Composite.ATTRIBUTE_OUTPUT)&&void 0!==(n=this.load(o+".html"))&&(a(e),e instanceof Element)&&(e.innerHTML=n)}}),Object.defineProperty(Composite.render,"context",{get:()=>{const r=Array.from(e);return O.forEach(t=>{Object.keys(t).forEach(e=>{r[e]=t[e]})}),r},configurable:!1,enumerable:!0}),new Set),k=new Map,L=new Map,D=new Set,o=new Map,M=new Set,a=e=>{for(var t=(e instanceof Element&&e.id||"").trim(),r=t.toLowerCase();r&&e instanceof Element;)if((e=e.parentNode)instanceof Element&&e.hasAttribute(Composite.ATTRIBUTE_COMPOSITE)&&e.hasAttribute(Composite.ATTRIBUTE_ID)&&(e.id||"").toLowerCase().trim()===r)throw new Error("Recursion detected for composite: "+t)},x=e=>{if(!(e instanceof Element))return null;let t=(e.getAttribute(Composite.ATTRIBUTE_ID)||"").trim();if(e.hasAttribute(Composite.ATTRIBUTE_COMPOSITE)){var r=t.match(Composite.PATTERN_COMPOSITE_ID);if(r)return r[2]?{namespace:r[2].split(/:+/),model:r[1]}:{model:r[1]};throw new Error("Invalid composite id"+(t?": "+t:""))}r=x(e.parentNode);if(!e.hasAttribute(Composite.ATTRIBUTE_ID))return r;if(t.match(Composite.PATTERN_ELEMENT_ID))return e={namespace:[],model:null,route:[],target:null},r&&(r.namespace?r.namespace.push(r.model):r.namespace=[r.model],e.namespace=r.namespace,r.route?e.route.push(...r.route):e.route.push(r.model)),(t=t.match(Composite.PATTERN_ELEMENT_ID))[4]&&(e.namespace=t[4].split(/:/),e.route=[e.namespace[e.namespace.length-1]]),e.route.push(t[1]),t[2]&&e.route.push(...t[2].split(/:/)),t[3]&&(e.unique=t[3]),e.target=e.route[e.route.length-1],e.model=e.namespace.pop(),e.namespace.length<=0&&delete e.namespace,e.model?e:null;throw new Error("Invalid element id"+(t?": "+t:""))},V=e=>{var t,r,e=x(e);return e&&(t=Namespace.lookup(...e.namespace||[]),r=Object.lookup(t||window,e.model))?void 0===e.target?{meta:e,namespace:t,model:r}:(e={meta:e,namespace:t,model:r,get target(){return Object.lookup(this.namespace,...this.meta.route||[])},set target(e){let t=[this.meta.model];var r=(t=this.meta.route?this.meta.route:t).pop();Object.lookup(this.namespace,...t)[r]=e}}).model&&void 0!==e.target?e:null:null},B={},j=[];Object.defineProperty(Composite.render,"meta",{value:j});let t=0;compliant("Object.prototype.serial"),compliant("Object.prototype.ordinal",function(){return void 0===this.serial&&Object.defineProperty(this,"serial",{value:++t}),this.serial}),compliant("Object.use",(...e)=>Namespace.use.apply(null,e)),compliant("Object.lookup",(...e)=>Namespace.lookup.apply(null,e)),compliant("Object.exists",(...e)=>Namespace.exists.apply(null,e)),compliant("Object.usable",e=>null!=e);const r=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(...e){var t=(e=null)=>{if(e){if("loadstart"===e.type)e=[Composite.EVENT_HTTP_START,e];else if("progress"===e.type)e=[Composite.EVENT_HTTP_PROGRESS,e];else if("readystatechange"===e.type)e=[Composite.EVENT_HTTP_RECEIVE,e];else if("load"===e.type)e=[Composite.EVENT_HTTP_LOAD,e];else if("abort"===e.type)e=[Composite.EVENT_HTTP_ABORT,e];else if("error"===e.type)e=[Composite.EVENT_HTTP_ERROR,e];else if("timeout"===e.type)e=[Composite.EVENT_HTTP_TIMEOUT,e];else{if("loadend"!==e.type)return;e=[Composite.EVENT_HTTP_END,e]}Composite.fire(...e)}};this.status===XMLHttpRequest.UNSENT&&(this.addEventListener("loadstart",t),this.addEventListener("progress",t),this.addEventListener("readystatechange",t),this.addEventListener("load",t),this.addEventListener("abort",t),this.addEventListener("error",t),this.addEventListener("timeout",t),this.addEventListener("loadend",t)),r.call(this,...e)},window.addEventListener("error",e=>Composite.fire(Composite.EVENT_ERROR,e)),window.addEventListener("load",()=>{var e;document.querySelector("html")&&(document.querySelector("html head")||document.querySelector("html").appendChild(document.createElement("head")),(e=document.createElement("style")).setAttribute("type","text/css"),e.innerHTML="*[release] {display:none!important;}",document.querySelector("html head").appendChild(e)),Composite.include("common");const o=e=>{e.childNodes&&Array.from(e.childNodes).forEach(e=>o(e));var t,r=e.ordinal(),r=j[r];r&&r.attributes.hasOwnProperty(Composite.ATTRIBUTE_COMPOSITE)&&(r=V(e))&&r.meta&&r.meta.model&&r.model&&(t=(r.meta.namespace||[]).concat(r.meta.model).join("."),M.has(t))&&(M.delete(t),"function"==typeof r.model.undock)&&(r.model.undock.call(r.model),Composite.fire(Composite.EVENT_MODULE_UNDOCK,r)),delete j[e.ordinal()]};new MutationObserver(e=>{e.forEach(e=>{var t,r;"attributes"===e.type&&(t=e.attributeName).match(/^(autofocus|disabled|hidden|multiple|readonly|required)$/i)&&("false"===(r=String(e.target.getAttribute(t)))&&e.target.removeAttribute(t),"true"===r)&&e.target.setAttribute(t,t),j.length&&(r=e.target.ordinal(),t=j[r],"characterData"===e.type&&e.target.nodeType===Node.TEXT_NODE?t&&t.hasOwnProperty(Composite.ATTRIBUTE_VALUE)&&(r=void 0===t.value?"":String(t.value))!==e.target.textContent&&(e.target.textContent=r):(t&&"attributes"===e.type&&((r=(e.attributeName||"").toLowerCase().trim()).match(Composite.PATTERN_ATTRIBUTE_ACCEPT)&&!r.match(Composite.PATTERN_ATTRIBUTE_STATIC)?e.target.hasAttribute(r)&&e.target.removeAttribute(r):r.match(Composite.PATTERN_ATTRIBUTE_STATIC)?t.attributes.hasOwnProperty(r)?e.target.hasAttribute(r)&&t.attributes[r]===e.target.getAttribute(r)||e.target.setAttribute(r,t.attributes[r]):e.target.hasAttribute(r)&&e.target.removeAttribute(r):U.has(r)&&(t.statics=t.statics||{},t.statics.hasOwnProperty(r)?e.target.hasAttribute(r)&&t.statics[r]===e.target.getAttribute(r)||e.target.setAttribute(r,t.statics[r]):e.target.hasAttribute(r)&&e.target.removeAttribute(r))),(e.addedNodes||[]).forEach(e=>{(e instanceof Element||e instanceof Node&&e.nodeType===Node.TEXT_NODE)&&!j[e.ordinal()]&&document.body.contains(e)&&Composite.render(e)}),(e.removedNodes||[]).forEach(e=>o(e))))})}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,characterData:!0}),Composite.render(document.body)})})(),(()=>{"use strict";compliant("messages",{}),compliant("Messages",{});const n=[DataSource.data],t=DataSource.localize,a=e=>{var t=new Map,r="/locales/"+DataSource.locale+"/label",o=e.evaluate(r,e,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(let e=o.iterateNext();e;e=o.iterateNext()){var n,a=(e.getAttribute("key")||"").trim();t.has(a)||(n=((e.getAttribute("value")||"").trim()||(e.textContent||"").trim()).unescape(),t.set(a,n))}new Map([...t.entries()].sort()).forEach((e,t)=>{var r,o=t.match(/^(?:((?:\w+\.)*\w+)\.)*(\w+)$/);o&&(r="messages"+(o[1]?"."+o[1]:""),Namespace.exists(r,o[2])||Object.defineProperty(Namespace.use(r),o[2],{value:{toString(){return e}}}),Namespace.exists("Messages",t)||Object.defineProperty(Namespace.use("Messages"),t,{value:e}))})};DataSource.localize=e=>{t(e),delete window.messages,delete window.Messages,window.Messages={customize(e,...t){let r=Messages[e]||"";for(let e=0;e<t.length;e++)r=r.replace(new RegExp("\\{"+e+"\\}","g"),t[e]);return r.replace(/\{\d+\}/g,"")}},n.forEach(e=>a(e))},DataSource.data&&DataSource.locale&&DataSource.locales&&DataSource.locales.includes(DataSource.locale)&&DataSource.localize(DataSource.locale),Composite.listen(Composite.EVENT_MODULE_LOAD,(e,t,r)=>{var o=new XMLHttpRequest;o.open("GET",Composite.MODULES+"/"+r+".xml",!1),o.send(),200===o.status&&(r=(new DOMParser).parseFromString(o.responseText,"application/xml"),n.push(r),a(r))})})(),(()=>{"use strict";compliant("Reactive",e=>{if(null==e||"object"!=typeof e)throw new TypeError("Invalid object type");return l(e)});let a=null,r=(Composite.listen(Composite.EVENT_RENDER_START,(e,t)=>a=t),Composite.listen(Composite.EVENT_RENDER_NEXT,(e,t)=>a=t),Composite.listen(Composite.EVENT_RENDER_END,(e,t)=>a=null),null);Composite.listen(Composite.EVENT_MODULE_DOCK,(e,t)=>{r=a,a=null}),Composite.listen(Composite.EVENT_MODULE_READY,(e,t)=>{a=r,r=null}),compliant("Object.prototype.reactive",function(){return l(this)});const i=Math.serial(),s=new WeakMap,l=e=>{if("object"!=typeof e||null===e)return e;if(void 0!==e[i])return e;if(s.has(e))return s.get(e);const n=new Proxy(e,{notifications:new Map,cache:new Map,get(t,r){try{if(r===i)return t;let e;var o;return"object"!=typeof(e=a&&(o=Object.getOwnPropertyDescriptor(t,r))&&"function"==typeof o.get?o.get.call(n):t[r])||null===e||e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection?e:void 0!==e[i]?e:s.has(e)?s.get(e):l(e)}finally{Composite.asynchron((e,t,r,o)=>{if(null!==e&&t.hasOwnProperty(r)){var n=o.get(r)||new Map;if(!n.has(e.ordinal())){for(const a of n.values()){if(void 0!==a.contains&&a.contains(e))return;void 0!==e.contains&&e.contains(a)&&n.delete(a.ordinal())}n.set(e.ordinal(),e),o.set(r,n)}}},a,t,r,this.notifications)}},set(e,t,r){if(t===i)return!0;"object"==typeof r&&null!==r&&void 0!==r[i]&&(r=r[i]);try{e[t]=r}finally{return this.cache.get(t)!==r&&(this.cache.set(t,r),Composite.asynchron((e,t,r,o)=>{if(t.hasOwnProperty(r)){var n=this.notifications.get(r)||new Map;for(const a of n.values())document.body.co