@webqit/oohtml 1.9.16 → 1.9.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";function e(e,...t){globalThis.WebQitInternalsRegistry||(globalThis.WebQitInternalsRegistry=new Map);var r,n,s=globalThis.WebQitInternalsRegistry.get(e);if(!s){if(s=new Map,!1===t[0])return s;globalThis.WebQitInternalsRegistry.set(e,s)}for(;r=t.shift();)if((n=s)&&!(s=s.get(r))){if(s=new Map,!1===t[0])return s;n.set(r,s)}return s}function t(e){return Array.isArray(e)}function r(e){return e instanceof String||"string"==typeof e&&null!==e}function n(e){return arguments.length&&(void 0===e||void 0===e)}function s(e){return"function"==typeof e}function o(e){return Array.isArray(e)||"object"==typeof e&&e||s(e)}function i(e){return!Array.isArray(e)&&"object"==typeof e&&e}function a(e,s=!0){return t(e)?e:!s&&i(e)?[e]:!1!==e&&0!==e&&function(e){return function(e){return null===e||""===e}(e)||n(e)||!1===e||0===e||o(e)&&!Object.keys(e).length}(e)?[]:function(e){return!r(e)&&!n(e.length)}(e)?Array.prototype.slice.call(e):i(e)?Object.values(e):[e]}function l(e){return!Array.isArray(e)&&"object"==typeof e&&e}function c(){if(!(l(this)&&this.window||"undefined"!=typeof window))throw new Error("A window context is required.");const e=l(this)&&this.window?this.window:window;if(e.WebQit||(e.WebQit={}),!e.WebQit.window){let t,r;Object.defineProperty(e.WebQit,"window",{get:()=>e}),Object.defineProperty(e.WebQit,"vendor",{value:{getName:()=>(t||(t=function(e){if(void 0!==e.InstallTrigger)return"firefox";if(/constructor/i.test(e.HTMLElement)||"[object SafariRemoteNotification]"===(!e.safari||void 0!==e.safari&&e.safari.pushNotification).toString())return"safari";var t=!(!e.chrome||!e.chrome.webstore&&!e.chrome.runtime),r=t&&-1!=e.navigator.userAgent.indexOf("Edg"),n=!!e.opr&&!!e.opr.addons||!!e.opera||e.navigator.userAgent.indexOf(" OPR/")>=0,s=!!e.document.documentMode,o=!s&&!!e.StyleMedia;return(t||n)&&e.CSS,o?"edge":s?"ie":n?"opera":r?"ie-chromium":t?"chrome":"unknown"}(e)),t),getPrefix:()=>(r||(r=function(e){var t=e.getComputedStyle(e.document.documentElement,""),r=(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.Olink&&["","o"])[1];return{api:("WebKit|Moz|Ms|O".match(new RegExp("("+r+")","i"))||[])[1],prefix:r,css:"-"+r+"-"}}(e)),r)}})}return e.WebQit}new Map;class h{constructor(e,t=!0){this.window=e,this.async=t,this.readCallbacks=[],this.writeCallbacks=[],this._run()}_run(){this.window.requestAnimationFrame((()=>{this.readCallbacks.forEach(((e,t)=>{e&&!e()&&(this.readCallbacks[t]=null)})),this.writeCallbacks.forEach(((e,t)=>{e&&!e()&&(this.writeCallbacks[t]=null)})),this._run()}))}onread(e,t=!1){if(t)return new Promise(((t,r)=>{!1===this.async?e(t,r):this.readCallbacks.push((()=>{e(t,r)}))}));!1===this.async?e():this.readCallbacks.push(e)}onwrite(e,t=!1){if(t)return new Promise(((t,r)=>{!1===this.async?e(t,r):this.writeCallbacks.push((()=>{e(t,r)}))}));!1===this.async?e():this.writeCallbacks.push(e)}cycle(e,t,r){this.onread((()=>{var n=e(r);if(n){var s=n=>{this.onwrite((()=>{var s=t(n,r);if(s){var o=r=>{this.cycle(e,t,r)};s instanceof Promise?s.then(o):o()}}))};n instanceof Promise?n.then(s):s()}}))}}function u(e){return e instanceof String||"string"==typeof e&&null!==e}function d(e){return Array.isArray(e)}function m(e){return arguments.length&&(void 0===e||void 0===e)}function p(e){return null===e||""===e}function f(e){return"function"==typeof e}function g(e){return Array.isArray(e)||"object"==typeof e&&e||f(e)}function v(e,t=!0){return d(e)?e:!t&&l(e)?[e]:!1!==e&&0!==e&&function(e){return p(e)||m(e)||!1===e||0===e||g(e)&&!Object.keys(e).length}(e)?[]:function(e){return!u(e)&&!m(e.length)}(e)?Array.prototype.slice.call(e):l(e)?Object.values(e):[e]}function b(e){const t=c.call(this);t.DOM.isDOMReady||"complete"===t.window.document.readyState?e(t.window):(t.window.domReadyCallbacks||(t.window.domReadyCallbacks=[],t.window.document.addEventListener("DOMContentLoaded",(()=>{t.DOM.isDOMReady=!0,t.window.domReadyCallbacks.splice(0).forEach((e=>e(t.window)))}),!1)),t.window.domReadyCallbacks.push(e))}class w{constructor(e){this.window=e}onAdded(e,t,r={}){return r.on="added",this.onPresenceChange(e,((e,r,n,s,o)=>{t(e,r,n,s,o)}),r)}onRemoved(e,t,r={}){return r.on="removed",this.onPresenceChange(e,((e,r,n,s,o)=>{t(e,r,n,s,o)}),r)}onPresent(e,t,r={}){b.call(this.window,(()=>{this.window.MutationObserver&&this.onAdded(e,((e,r)=>{e.forEach((e=>t(e,r)))}),r),u(e)?v(this.window.document.querySelectorAll(e)).forEach((e=>t(e,1))):e.parentNode&&t(e,1)}))}onAbsent(e,t,r={}){b.call(this.window,(()=>{this.window.MutationObserver&&onRemoved(e,((e,r)=>{e.forEach((e=>t(e,r)))}),r),u(e)?0===v(this.window.document.querySelectorAll(e)).length&&t(null,0):e.parentNode||t(e,0)}))}onPresenceChange(e,t,r={}){e=v(e,!1);var n=new Set,s=new Set,o=(o,i,a)=>{i&&"removed"===r.on||!i&&"added"===r.on||(o=((e,t)=>(t.$$searchCache||(t.$$searchCache=new Map),e.reduce(((e,n)=>{var s;return t.$$searchCache.has(n)?s=t.$$searchCache.get(n):(s=((e,t)=>{if(t=t.filter((e=>e.matches)),u(e)){var n=t.filter((t=>t.matches(e)));if(!1!==r.observeIndirectMutation&&(n=t.reduce(((t,r)=>t.concat(v(r.querySelectorAll(e)))),n)).length)return n}else{if(t.includes(e))return[e];if(!1!==r.observeIndirectMutation&&t.length)for(var s=e;s=s.parentNode;)if(t.includes(s))return[e]}})(n,t,u(n))||[],t.$$searchCache.set(n,s)),e.concat(s)}),[])))(e,o)).length&&(r.maintainCallState?(o.forEach((e=>{i?(n.add(e),s.delete(e)):(n.delete(e),s.add(e))})),t(o,i,a,n,s)):t(o,i,a))},i=r.context||this.window.document.documentElement;return this._observe(i,((e,t,n,s)=>{r.ignoreTransients||(o(e,0,!0),o(e.concat(t),1,!0),o(t,0,!0)),o(s,0),o(n,1)}))}onAttrChange(e,t,r=[]){var n=new this.window.MutationObserver(t),s={attributes:!0,attributeOldValue:!0};return r&&(s.attributeFilter=r),n.observe(e,s),n}onTreeChange(e,t,r=!1){var n=new this.window.MutationObserver(t),s={childList:!0,subtree:r};return n.observe(e,s),n}onMutation(e,t,r){var n=new this.window.MutationObserver(t);return n.observe(e,r),n}_observe(e,t){if(!y.has(e)){const t=new Set,r=new this.window.MutationObserver((e=>{if(t.size){var r=e.reduce(((e,t)=>e.concat(v(t.addedNodes))),[]),n=e.reduce(((e,t)=>e.concat(v(t.removedNodes))),[]),s=[],o=[];r=new Set(r),n=new Set(n),r.forEach((e=>{n.has(e)&&(n.delete(e),r.delete(e),e.isConnected?s.push(e):o.push(e))})),r=[...r],n=[...n],t.forEach((e=>e(s,o,r,n)))}}));r.observe(e,{childList:!0,subtree:!0}),y.set(e,{callbacks:t,observer:r})}const r=y.get(e);return r.callbacks.add(t),{disconnect(){r.callbacks.delete(t)},reconnect(){r.callbacks.add(t)}}}}const y=new Map;function O(e,t=null,r=!1){const n=c.call(this);if(u(e)){var s;if(e.trim().startsWith("<")){var o=n.window.document.createElement("div");o.innerHTML=e,s=r?v(o.children):o.firstChild}else s=r?v(k.call(this,e,t)):x.call(this,e,t);return s}return e instanceof n.window.Element?r?[e]:e:r?v(e):e}function E(e,t=null){return O.call(this,e,t,!0)}function x(e,t=null,r=!1){const n=c.call(this);t=t||n.window.document;var s,o=r?"querySelectorAll":"querySelector";try{s=t[o](e)}catch(r){try{s=t[o](e.replace(/\:is\(/g,":matches("))}catch(r){try{s=t[o](e.replace(/\:is\(/g,":-webkit-any("))}catch(r){try{s=t[o](e.replace(/\:is\(/g,":-moz-any("))}catch(e){throw e}}}}return s}function k(e,t=null){return x.call(this,e,t,!0)}function j(e){return function(e){return e instanceof Number||"number"==typeof e}(e)||!0!==e&&!1!==e&&null!==e&&""!==e&&!isNaN(1*e)}function C(e){return f(e)||e&&"[object function]"==={}.toString.call(e)}function $(e,t,r={},n={}){t=v(t).slice();for(var s=e;!m(s)&&!p(s)&&t.length;){var o=t.shift();if(!(r.get?r.get(s,o):g(s)?o in s:s[o]))return void(n.exists=!1);s=r.get?r.get(s,o):s[o]}return n.exists=!0,s}function M(e,t,r,n={},s={}){const o=(e,r,n)=>s.set?s.set(e,r,n):(j(t[a])&&d(e)?e.push(n):e[r]=n,!0);t=v(t);for(var i=e,a=0;a<t.length;a++){if(!(a<t.length-1))return o(i,t[a],r);if(!i||!g(i)&&!C(i))return!1;var l=$(i,t[a],s);if(!g(l)){if(!1===s.buildTree)return!1;if(l=C(s.buildTree)?s.buildTree(a):j(t[a+1])?[]:{},!o(i,t[a],l))return!1}i=l}}function T(e,t,r=!1,n={}){t=v(t);var s=!1;do{var o=""===(o=t.pop())?0:o,i=e;t.length&&(i=$(e,t,{},n)),(g(i)||C(i))&&(n.has?n.has(i,o):o in i)&&(n.deleteProperty?s=n.deleteProperty(i,o):n.del?s=n.del(i,o):(delete i[o],s=!0))}while(s&&r&&t.length&&(g(i)||C(i))&&!(n.keys?n.keys(i):Object.keys(i)).length);return s}function A(e,t,r={}){var n={};return $(e,t,r,n),n.exists}function S(e,t=!1){const r=c.call(this);var n={};return!(n.el=r.window.document.head.querySelector('meta[name="oohtml"]'))&&t&&(n.el=r.window.document.createElement("meta"),n.el.setAttribute("name",e),r.window.document.head.append(n.el)),n.el&&(n.vars=(n.el.getAttribute("content")||"").split(";").filter((e=>e)).reduce(((e,t)=>{var r=t.split("=").map((e=>e.trim()));return M(e,r[0].split("."),"true"===r[1]||"false"!==r[1]&&(j(r[1])?parseInt(r[1]):r[1])),e}),{})),n.get=function(e){return $(this.vars,e.split("."))},n.set=function(e,r=null,n=!1){var s=l(e)?e:{[e]:!0===r?"true":r};if(n=arguments.length<3?r:n,Object.keys(s).forEach((e=>{if(!1===s[e])T(this.vars,e.split("."));else if(l(s[e]))Object.keys(s[e]).forEach((t=>{var r=(e+"."+t).split(".");n&&A(this.vars,r)||M(this.vars,r,s[e][t])}));else{var t=e.split(".");n&&A(this.vars,t)||M(this.vars,t,s[e])}})),t){const e=(t,r)=>Object.keys(r).reduce(((n,s)=>{var o=(t?t+".":"")+s;return l(r[s])?n.push(...e(o,r[s])):n.push(o+"="+r[s]),n}),[]);this.el.setAttribute("content",e("",this.vars).join(";"))}return!0},n.defaults=function(e,t=null){return this.set(e,t,!0)},n}function P(){const e=c.call(this);return e.DOM||(e.DOM={},function(e){!function(e){e.CSS||(e.CSS={}),e.CSS.escape||(e.CSS.escape=e=>e.replace(/([\:@\~\$\&])/g,"\\$1"))}(e),function(e){"isConnected"in e.Node.prototype||Object.defineProperty(e.Node.prototype,"isConnected",{get:function(){return!(this.ownerDocument&&this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}(e),function(e){e.Element.prototype.matches||(e.Element.prototype.matches=e.Element.prototype.matchesSelector||e.Element.prototype.mozMatchesSelector||e.Element.prototype.msMatchesSelector||e.Element.prototype.oMatchesSelector||e.Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),r=t.length;--r>=0&&t.item(r)!==this;);return r>-1})}(e)}(e.window),e.DOM.reflow=new h(e.window),e.DOM.mutations=new w(e.window),e.DOM.meta=S.bind(e.window),e.DOM.query=O.bind(e.window),e.DOM.queryAll=E.bind(e.window),e.DOM.ready=b.bind(e.window)),e}function _(e,t,r){return function(e,t){return function(e,t,r=!1){if(""==t)return e;var n=r?e.lastIndexOf(t):e.indexOf(t);return-1===n?e:e.substr(0,n)}(e,t,!0)}(function(e,t,r=!1){if(""==t)return e;var n=r?e.lastIndexOf(t):e.indexOf(t);return-1===n?"":e.substr(n+t.length)}(e,t),r)}function D(e){return s(e)||e&&"[object function]"==={}.toString.call(e)}function N(e){return e instanceof Number||"number"==typeof e}function L(e){return N(e)||!0!==e&&!1!==e&&null!==e&&""!==e&&!isNaN(1*e)}function W(e,r,n=!1,s=!1,a=!1){var l=0,c=e.shift();if((L(c)||!0===c||!1===c)&&(l=c,c=e.shift()),!e.length)throw new Error("_merge() requires two or more array/objects.");return e.forEach(((e,h)=>{var u,d,m;(o(e)||D(e))&&(n?(u=e,m=[],function(e,r){r=(r=r||Object.prototype)&&!t(r)?[r]:r;var n=[];for(e=e;e&&(!r||r.indexOf(e)<0)&&"default"!==e.name;)n.push(e),e=e?Object.getPrototypeOf(e):null;return n}(u,d).forEach((e=>{!function(e,...t){t.forEach((t=>{e.indexOf(t)<0&&e.push(t)}))}(m,...Object.getOwnPropertyNames(e))})),m):Object.getOwnPropertyNames(e)).forEach((o=>{if(r(o,c,e,h)){var u=c[o],d=e[o];if((t(u)&&t(d)||i(u)&&i(d))&&(!0===l||l>0))c[o]=t(u)&&t(d)?[]:{},W([L(l)?l-1:l,c[o],u,d],r,n,s,a);else if(t(c)&&t(e))s?c[o]=d:c.push(d);else try{a?Object.defineProperty(c,o,Object.getOwnPropertyDescriptor(e,o)):c[o]=e[o]}catch(e){}}}))})),c}function R(...e){return W(e,((e,t,r)=>!0),!1,!1,!1)}const q=function(e,r=1,n=!0){return!L(r)||r<=0?e:(!t(e)&&i(e)&&n&&(e=Object.values(e)),t(e)?e.reduce(((e,s)=>t(s)||i(s)&&n?e.concat(q(t(s)?s:Object.values(s),r-1,n)):e.concat(s)),[]):e)},Q=q;function I(e,t=1){var r=0;e.forEach((e=>{r++}));var n=e.slice(e.length-r,t);return arguments.length>1?n:n[0]}function H(e,t=1){return arguments.length>1?I(e.slice().reverse(),t).reverse():I(e.slice().reverse())}function z(e){return i(e)&&Object.getPrototypeOf(e)===Object.prototype}function F(e){return!0===e||!1===e}const U=function(e,r,n=!0,s=1){if(t(e)&&t(r)&&e.length!==r.length)return!n;if(i(e)&&i(r)){var a=Object.keys(e),l=Object.keys(r);if(!a.length&&!l.length)return z(e)&&z(r)?n:e===r===n;if(!U(a,l))return!n}if(s>0&&(t(e)&&t(r)||i(e)&&i(r))){var c=function(e,r,n=!0,s=!0,a=!1,l=!1){if(t(e)&&t(r)){var c=[],h=!0;return e.forEach((e=>{if(h){var u,d,m,p=!1;d=(r,a)=>{(!p||s&&o(e))&&((t(p=n(e,a))&&!p.length||i(p)&&!Object.keys(p).length)&&(p=!1),o(p)&&s&&(e=p))},m=void 0,o(u=r)&&Object.keys(u).forEach(((e,t)=>{!1!==m&&(m=d(L(e)&&parseFloat(e),u[e]))})),o(p)?c.push(s?p:e):F(p)?a&&!p||!a&&p?c.push(e):l&&(h=!1):c.push(p)}})),c}if(i(e)&&i(r))return c={},h=!0,Object.keys(e).forEach((u=>{if(h){var d=n(e[u],r[u]);(t(d)&&!d.length||i(d)&&!Object.keys(d).length)&&(d=!1),o(d)?c[u]=s?d:e[u]:F(d)?a&&!d||!a&&d?c[u]=e[u]:l&&(h=!1):c[u]=d}})),c}(e,r,((e,t)=>U(e,t,n,s-1)),!1,!1,!0);return t(c)?c.length===e.length&&c.length===r.length:i(c)&&i(e)?Object.keys(c).length===Object.keys(e).length&&Object.keys(c).length===Object.keys(r).length:c}return D(n)?n(e,r):N(e)&&N(r)&&isNaN(e)&&isNaN(r)?n:e===r===n},V=U;function K(e,r=[]){return W([{},e],((e,n,s)=>{if(!D(s[e]))return D(r)?r(e):!t(r)||!r.length||r.indexOf(e)>-1}),!1,!1,!1)}class Z{static lex(e,t,n={}){if(!r(e+=""))throw new Error("Argument1 must be a string!");var s=e=>({delims:e.delims.slice(),options:K(e.options),nesting:e.nesting.slice(),maxDepth:e.maxDepth,comments:e.comments.slice(),tokens:e.tokens.slice(),matches:e.matches.slice(),matchesi:K(e.matchesi)});if(Z.$cache[e]&&!1!==n.cache)for(var o=0;o<Z.$cache[e].length;o++){var i=Z.$cache[e][o];if(V(i.delims,t))return s(i)}var a=new Z(e,n).lex(t);return!1!==n.cache&&(Z.$cache[e]=Z.$cache[e]||[],Z.$cache[e].push(a)),s(a)}static split(e,t,r){return Z.lex(e,t,r).tokens}static match(e,t,r){return Z.lex(e,t,r).matches}constructor(e,t){if(!r(e))throw new Error("Lexer requires the first argument to be a string.");this.$str=e,this.$options=t||{},this.$options.blocks||(this.$options.blocks=Z.$blocks),this.$options.quotes||(this.$options.quotes=Z.$quotes),this.$options.comments||(this.$options.comments=Z.$comments)}lex(e,t){for(var r={delims:a(e),options:R(!0,{},this.$options,t||{}),nesting:[],maxDepth:0,comments:[],tokens:[],matches:[],matchesi:{}},n=0;"number"==typeof n;)n=this._evalCharsAt(r,n);if(r.nesting.length)throw new Error("Error parsing the string: "+this.$str+". Unterminated blocks: "+Q(r.nesting).join(", "));return r}_evalCharsAt(e,t){if(!(t>=this.$str.length)){var r=1,n={},s={},o={};if(e.openComment||(s=this._testQuotes(e,t)),e.openQuote||(n=this._testComments(e,t)),e.openComment||n.ending)e.nesting.length||o.ending?this._push(e,this.$str[t]):(r=(a=n.starting||n.ending||this.$str[t]).length,this._push(e,a,"comments",n.starting));else if(e.openQuote||s.ending)this._push(e,this.$str[t]);else{if(e.options.limit&&e.matches.length===e.options.limit)return this._push(e,this.$str[t]),t+1;o=this._testNesting(e,t),o=this._testNesting(e,t);var i=this._testChars(e.options.stopChars||[],e,t);if(!e.nesting.length&&!1!==i)return e.options.stopChar=i,void(e.options.stopCharForward=this.$str.substr(t));if(e.delims.length)if(e.nesting.length||o.ending){var a;r=(a=o.starting||o.ending||this.$str[t]).length,this._push(e,a)}else{this._push(e,"");var l=this._testChars(e.delims,e,t);if(!1!==l&&(e.matches.push(l),e.matchesi[t]=l,r=l.length||1,!e.options.preserveDelims)){var c=t+(l.length||1);return c===this.$str.length&&this._push(e,""),c}this._push(e,l||this.$str[t])}else 2===e.nesting.length&&o.starting?(e.matches.push(null),this._push(e,o.starting),r=o.starting.length):!e.nesting.length&&o.ending?(this._push(e,o.ending),r=o.ending.length,e.matches.push(null)):this._push(e,this.$str[t])}return t+r}}_testQuotes(e,t){var r={};return(e.options.quotes||[]).forEach((n=>{this.$str.substr(t,1)===n&&(e.openQuote?n===e.openQuote&&(e.openQuote=!1,r.ending=n):(e.openQuote=n,r.starting=n))})),r}_testComments(e,t){var r={};return(e.options.comments||[]).forEach((n=>{if(e.openComment){if(H(n)===H(e.openComment)){var s=H(n);this.$str.substr(t).startsWith(s)&&(e.openComment=!1,r.ending=s)}}else{var o=I(n);this.$str.substr(t).startsWith(o)&&(e.openComment=n,r.starting=o)}})),r}_testNesting(e,t){var r={};return(e.options.blocks||[]).forEach((n=>{var s=I(n);if(this.$str.substr(t).startsWith(s))e.nesting=e.nesting.concat([n]),r.starting=s;else if(e.nesting.length&&H(n)===H(H(e.nesting))){var o=H(n);this.$str.substr(t).startsWith(o)&&(e.nesting=e.nesting.slice(0,-1),r.ending=o)}})),e.maxDepth=Math.max(e.maxDepth,e.nesting.length),r}_testChars(e,t,r){for(var n=0;n<e.length;n++){var s=e[n];if(D(s)){var o=s(this.$str.substr(0,r),this.$str.substr(r),t.tokens.slice());if(!1!==o)return o}if(t.options.useRegex){var i=this.$str.substr(r).match(new RegExp("^"+s,!0!==t.options.useRegex?t.options.useRegex:""));if(i)return i[0]}if(!t.options.ci&&this.$str.substr(r,s.length)===s||t.options.ci&&this.$str.substr(r,s.length).toLowerCase()===s.toLowerCase())return s}return!1}_push(e,t,r="tokens",s=!1){var o=e.matches.length;if(n(e.tokens[o])&&(e.tokens[o]=""),"comments"===r){e.tokens[o].comments||(e.tokens[o]=new String(e.tokens[o]),e.tokens[o].comments=[]);var i=e.tokens[o].comments.length-(!e.tokens[o].comments.length||s?0:1);e.tokens[o].comments[i]=(e.tokens[o].comments[i]||"")+t}else e.tokens[o].comments,e.tokens[o]=e.tokens[o]+t}split(e,t,r){return this.lex(t,r).tokens}match(e,t,r){return this.lex(t,r).matches}regParse(e,t){return this.lex(e,R({useRegex:!0},t||{}))}regSplit(e,t){return this.regParse(e,t).tokens}regMatch(e,t){return this.regParse(e,t).matches}}function B(e,t={}){const r=P.call(this);return r.OOHTML||(r.OOHTML={}),r.OOHTML.meta||(r.OOHTML.meta=r.DOM.meta("oohtml",!0)),r.OOHTML.meta.defaults(R(3,e,t)),r.OOHTML.meta}Z.$blocks=[["(",")"],["[","]"],["{","}"]],Z.$quotes=['"',"'","`"],Z.$comments=[["/*","*/"],["//","\n"]],Z.$cache=Object.create(null);const G=(e,t)=>Z.split(e.trim(),["|","+"],{preserveDelims:!0}).reduce(((e,r)=>{var n;return(r.startsWith("|")||r.startsWith("+"))&&(n=r.substr(0,1),r=r.substr(1).trim()),e.theEnd||"|"===n&&e.length?(e.theEnd=!0,e):e.concat(t(r.trim()))}),[]).filter((e=>e)),J=(e,t,r)=>{const n=e=>e.reduce(((e,t)=>e.concat(...r(t).values())),[]);return G(t,(t=>{var s,o,[t,i]=(s=t,o=Z.split(s.trim(),[":"]),[s=o.shift(),o.reduce(((e,t)=>{var[r,n]=Z.split(t.trim(),[]);return e[r]=_(n,"(",")"),e}),{})]);return e.reduce(((e,s)=>{var o=r(s);"*"===t&&(t="("+o.keys().join("+")+")");var l,c=("(",")",(l=t).startsWith("(")&&l.endsWith(")")?J([s],_(t,"(",")"),r):a(o.get(t),!1)),h=[];return Object.keys(i).forEach((e=>{if("deep"===e||"deepest"===e)for(var o=[s];("deepest"===e||!c.length)&&(o=n(o)).length;){var a=J(o,`${t}${h.map((e=>`:${e}(${i[e]})`)).join("")}`,r);a.length&&(c=a)}else"having"!==e&&"not-having"!==e||(c=c.filter((t=>{var n=G(i[e],(e=>r(t,e)));return"not-having"===e?!n.length:n.length}))),h.push(e)})),e.concat(c)}),[])}))},X=function(e,t,r,n=null,s=0){if(!t.length)return[];var o,i=t.shift();i.endsWith(".")&&(o=!0,i=i.substr(0,i.length-1).trim());var a=J(e,i,r);if(a.length&&o)return a;if(t.length){var l=X(a,t.slice(),r,n,s+1);return-1===l?n(a,s,!0):l}return n?n(a,s):a};(function t(r=null,n=!1){const s=P.call(this);if(n)return void s.DOM.ready((()=>{t.call(this,r,!1)}));const o=s.window,i=s.window.document,l=s.DOM.mutations,c=B.call(this,{element:{template:"",export:"export",import:"import"},attr:{moduleid:"name",moduleref:"template",exportid:"name",exportgroup:"exportgroup"},api:{templateClass:"",templates:"templates",exports:"exports",moduleref:"template"}},r),h="template"+(c.get("element.template")?'[is="'+c.get("element.template")+'"]':"")+"["+o.CSS.escape(c.get("attr.moduleid"))+"]";var u=o.HTMLTemplateElement;if(c.get("api.templateClass")){if(!o[c.get("api.templateClass")])throw new Error('The custom element class "'+c.get("api.templateClass")+'" is not defined!');u=o[c.get("api.templateClass")]}const d=(e,t,r)=>{"templatemutation"===e&&(["addedExports","removedExports"].forEach((e=>{Object.defineProperty(t,e,{value:Object.keys(t[e]).map((r=>({name:r,items:t[e][r]})))})})),["addedTemplates","removedTemplates"].forEach((e=>{Object.defineProperty(t,e,{value:Object.keys(t[e]).map((r=>({name:r,item:t[e][r]})))})}))),Object.defineProperty(t,"path",{value:r}),i.dispatchEvent(new o.CustomEvent(e,{detail:t}))},m=(e,t)=>{const r=r=>{e.dispatchEvent(new o.CustomEvent(r,{detail:{path:t}}))};var n=e.getAttribute("src");return new Promise(((s,i)=>{o.fetch?o.fetch(n).then((e=>e.ok?e.text():Promise.reject(e.statusText))).then((n=>{e.innerHTML=n,r("load"),d("templatecontentloaded",{template:e},t),s(e)})).catch((o=>{console.error("Error fetching the bundle at "+n+". ("+o+")"),e.innerHTML="",r("loaderror"),d("templatecontentloaderror",{template:e},t),s(e)})):(s(),console.error("Error fetching the bundle at "+n+". (window.fetch() not supported by browser.)"))}))},p=(t,r,n,s=null,i=!0)=>{const u=(t,s,o,i)=>{var l;if(t.matches)if(t.matches(h)&&(l=t.getAttribute(c.get("attr.moduleid")))&&v(l)){var u=(n?n+"/":"")+l;"removed"===o?(e(r,"oohtml","templates").delete(l),e(r,"oohtml").get("parentTemplate")===r&&e(r,"oohtml").delete("parentTemplate"),s&&(s.removedTemplates[l]=t)):"added"===o&&(e(r,"oohtml","templates").set(l,t),e(t,"oohtml").set("parentTemplate",r),s&&(s.addedTemplates[l]=t)),p(t.content,t,u,o,i)}else{const n=t=>{var n=t.getAttribute(c.get("attr.exportgroup"))||"default";"removed"===o?e(r,"oohtml","exports").has(n)&&(function(e,t,r=!1){for(var n=e.indexOf(t);n>-1&&(r||!1===r);)e.splice(n,1),r>0&&r--,n=e.indexOf(t)}(e(r,"oohtml","exports").get(n),t),e(r,"oohtml","exports").has(n).length||e(r,"oohtml","exports").delete(n),s&&(s.removedExports[n]||(s.removedExports[n]=[]),s.removedExports[n].push(t))):"added"===o&&(e(r,"oohtml","exports").has(n)||e(r,"oohtml","exports").set(n,[]),e(r,"oohtml","exports").get(n).push(t),s&&(s.addedExports[n]||(s.addedExports[n]=[]),s.addedExports[n].push(t)))};if(t.matches(c.get("element.export"))){var d=t.getAttribute(c.get("attr.exportid"))||"default";a(t.children).forEach((e=>{e.setAttribute(c.get("attr.exportgroup"),d),n(e)}))}else n(t)}};r.modulemutationsType=s;const g={addedTemplates:Object.create(null),removedTemplates:Object.create(null),addedExports:Object.create(null),removedExports:Object.create(null)};if(a(t.children).forEach((e=>u(e,g,s,i))),i&&d("templatemutation",g,n),"added"===s&&!e(r,"oohtml").get("onLiveMode")){e(r,"oohtml").set("onLiveMode",!0),r.getAttribute("src")&&!r.content.children.length&&f.push(m(r,n)),l.onAttrChange(r,(e=>{e[0].target.getAttribute(e[0].attributeName)!==e[0].oldValue&&m(r,n)}),["src"]);var b=new o.MutationObserver((e=>{const t={addedTemplates:Object.create(null),removedTemplates:Object.create(null),addedExports:Object.create(null),removedExports:Object.create(null)};e.forEach((e=>{e.addedNodes.forEach((e=>u(e,t,"added",!0))),e.removedNodes.forEach((e=>u(e,t,"removed",!0)))})),d("templatemutation",t,n)}));b.observe(t,{childList:!0})}};if(c.get("api.templates")in i)throw new Error('document already has a "'+c.get("api.templates")+'" property!');const f=[];if(Object.defineProperty(i,c.get("api.templates"),{get:function(){return g(e(i,"oohtml","templates"))}}),c.get("api.templates")in u.prototype)throw new Error('The "HTMLTemplateElement" class already has a "'+c.get("api.templates")+'" property!');if(Object.defineProperty(u.prototype,c.get("api.templates"),{get:function(){return g(e(this,"oohtml","templates"))}}),c.get("api.exports")in u.prototype)throw new Error('The "HTMLTemplateElement" class already has a "'+c.get("api.exports")+'" property!');Object.defineProperty(u.prototype,c.get("api.exports"),{get:function(){return g(e(this,"oohtml","exports"))}});const g=e=>Object.defineProperties({},Array.from(e.keys()).reduce(((t,r)=>(t[r]={get:()=>e.get(r)},t)),{})),v=e=>{var t;return!(t=e.match(/([^a-zA-Z0-9\_\-\@])/))||(console.error(`Invalid character "${t}" in the module name: ${e}.`),!1)};if(a(i.querySelectorAll(h)).forEach((async t=>{var r=t.getAttribute(c.get("attr.moduleid"));!t.closest(c.get("element.import"))&&v(r)&&(e(i,"oohtml","templates").set(r,t),p(t.content,t,r,"added",!1))})),l.onPresenceChange(h,(async(t,r)=>{const n={addedTemplates:Object.create(null),removedTemplates:Object.create(null),addedExports:Object.create(null),removedExports:Object.create(null)};t.forEach((t=>{var s=t.getAttribute(c.get("attr.moduleid"));!t.closest(c.get("element.import"))&&v(s)&&(r?(e(i,"oohtml","templates").set(s,t),p(t.content,t,s,"added"),n.addedTemplates[s]=t):(e(i,"oohtml","templates").get(s)===t&&e(i,"oohtml","templates").delete(s),p(t.content,t,s,"removed"),n.removedTemplates[s]=t))})),d("templatemutation",n,"")})),l.onPresent(c.get("element.import"),(e=>{p(e,e,"","added",!1)})),c.get("api.moduleref")in o.Element.prototype)throw new Error('The "Element" class already has a "'+c.get("api.moduleref")+'" property!');Object.defineProperty(o.Element.prototype,c.get("api.moduleref"),{get:function(){var t;if(!e(this,"oohtml").has("module")&&(t=this.getAttribute(c.get("attr.moduleref")))){var r=(t=>{var r=i.createElement("template");return function(e,t,r,n=null){var s=t.split("#")[0].split("/").map((e=>e.trim())).filter((e=>e));return X(e,s,r,n)}([i],t,(function(t,r){var n=e(t,"oohtml","templates");return 1===arguments.length?n:r.startsWith(":")?e(t,"oohtml","exports").get(r.substr(1)):n.get(r)})).forEach((t=>{e(t,"oohtml","templates").forEach(((t,n)=>{e(r,"oohtml","templates").set(n,t)})),e(t,"oohtml","exports").forEach(((t,n)=>{e(r,"oohtml","exports").has(n)||e(r,"oohtml","exports").set(n,[]),e(r,"oohtml","exports").get(n).push(...t)}))})),r})(t);e(this,"oohtml").set("module",r)}return e(this,"oohtml").get("module")}});var b=f.length?"loading":"indeterminate";Object.defineProperty(i,"templatesReadyState",{get:()=>b}),s.DOM.ready.call(s,(()=>(f.forEach((e=>{e.catch((e=>{console.warn(e)}))})),Promise.all(f).then((()=>{b="complete",i.dispatchEvent(new o.Event("templatesreadystatechange"))})))))}).call(window)})();
1
+ (()=>{"use strict";function e(e,...t){globalThis.WebQitInternalsRegistry||(globalThis.WebQitInternalsRegistry=new Map);var r,n,s=globalThis.WebQitInternalsRegistry.get(e);if(!s){if(s=new Map,!1===t[0])return s;globalThis.WebQitInternalsRegistry.set(e,s)}for(;r=t.shift();)if((n=s)&&!(s=s.get(r))){if(s=new Map,!1===t[0])return s;n.set(r,s)}return s}function t(e){return Array.isArray(e)}function r(e){return e instanceof String||"string"==typeof e&&null!==e}function n(e){return arguments.length&&(void 0===e||void 0===e)}function s(e){return"function"==typeof e}function o(e){return Array.isArray(e)||"object"==typeof e&&e||s(e)}function i(e){return!Array.isArray(e)&&"object"==typeof e&&e}function a(e,s=!0){return t(e)?e:!s&&i(e)?[e]:!1!==e&&0!==e&&function(e){return function(e){return null===e||""===e}(e)||n(e)||!1===e||0===e||o(e)&&!Object.keys(e).length}(e)?[]:function(e){return!r(e)&&!n(e.length)}(e)?Array.prototype.slice.call(e):i(e)?Object.values(e):[e]}function l(e){return!Array.isArray(e)&&"object"==typeof e&&e}function c(){if(!(l(this)&&this.window||"undefined"!=typeof window))throw new Error("A window context is required.");const e=l(this)&&this.window?this.window:window;if(e.WebQit||(e.WebQit={}),!e.WebQit.window){let t,r;Object.defineProperty(e.WebQit,"window",{get:()=>e}),Object.defineProperty(e.WebQit,"vendor",{value:{getName:()=>(t||(t=function(e){if(void 0!==e.InstallTrigger)return"firefox";if(/constructor/i.test(e.HTMLElement)||"[object SafariRemoteNotification]"===(!e.safari||void 0!==e.safari&&e.safari.pushNotification).toString())return"safari";var t=!(!e.chrome||!e.chrome.webstore&&!e.chrome.runtime),r=t&&-1!=e.navigator.userAgent.indexOf("Edg"),n=!!e.opr&&!!e.opr.addons||!!e.opera||e.navigator.userAgent.indexOf(" OPR/")>=0,s=!!e.document.documentMode,o=!s&&!!e.StyleMedia;return(t||n)&&e.CSS,o?"edge":s?"ie":n?"opera":r?"ie-chromium":t?"chrome":"unknown"}(e)),t),getPrefix:()=>(r||(r=function(e){var t=e.getComputedStyle(e.document.documentElement,""),r=(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.Olink&&["","o"])[1];return{api:("WebKit|Moz|Ms|O".match(new RegExp("("+r+")","i"))||[])[1],prefix:r,css:"-"+r+"-"}}(e)),r)}})}return e.WebQit}new Map;class h{constructor(e,t=!0){this.window=e,this.async=t,this.readCallbacks=[],this.writeCallbacks=[],this._run()}_run(){this.window.requestAnimationFrame((()=>{this.readCallbacks.forEach(((e,t)=>{e&&!e()&&(this.readCallbacks[t]=null)})),this.writeCallbacks.forEach(((e,t)=>{e&&!e()&&(this.writeCallbacks[t]=null)})),this._run()}))}onread(e,t=!1){if(t)return new Promise(((t,r)=>{!1===this.async?e(t,r):this.readCallbacks.push((()=>{e(t,r)}))}));!1===this.async?e():this.readCallbacks.push(e)}onwrite(e,t=!1){if(t)return new Promise(((t,r)=>{!1===this.async?e(t,r):this.writeCallbacks.push((()=>{e(t,r)}))}));!1===this.async?e():this.writeCallbacks.push(e)}cycle(e,t,r){this.onread((()=>{var n=e(r);if(n){var s=n=>{this.onwrite((()=>{var s=t(n,r);if(s){var o=r=>{this.cycle(e,t,r)};s instanceof Promise?s.then(o):o()}}))};n instanceof Promise?n.then(s):s()}}))}}function u(e){return e instanceof String||"string"==typeof e&&null!==e}function d(e){return Array.isArray(e)}function m(e){return arguments.length&&(void 0===e||void 0===e)}function p(e){return null===e||""===e}function f(e){return"function"==typeof e}function g(e){return Array.isArray(e)||"object"==typeof e&&e||f(e)}function v(e,t=!0){return d(e)?e:!t&&l(e)?[e]:!1!==e&&0!==e&&function(e){return p(e)||m(e)||!1===e||0===e||g(e)&&!Object.keys(e).length}(e)?[]:function(e){return!u(e)&&!m(e.length)}(e)?Array.prototype.slice.call(e):l(e)?Object.values(e):[e]}function b(e){const t=c.call(this);t.DOM.isDOMReady||"complete"===t.window.document.readyState?e(t.window):(t.window.domReadyCallbacks||(t.window.domReadyCallbacks=[],t.window.document.addEventListener("DOMContentLoaded",(()=>{t.DOM.isDOMReady=!0,t.window.domReadyCallbacks.splice(0).forEach((e=>e(t.window)))}),!1)),t.window.domReadyCallbacks.push(e))}class w{constructor(e){this.window=e}onAdded(e,t,r={}){return r.on="added",this.onPresenceChange(e,((e,r,n,s,o)=>{t(e,r,n,s,o)}),r)}onRemoved(e,t,r={}){return r.on="removed",this.onPresenceChange(e,((e,r,n,s,o)=>{t(e,r,n,s,o)}),r)}onPresent(e,t,r={}){b.call(this.window,(()=>{this.window.MutationObserver&&this.onAdded(e,((e,r)=>{e.forEach((e=>t(e,r)))}),r),u(e)?v(this.window.document.querySelectorAll(e)).forEach((e=>t(e,1))):e.parentNode&&t(e,1)}))}onAbsent(e,t,r={}){b.call(this.window,(()=>{this.window.MutationObserver&&onRemoved(e,((e,r)=>{e.forEach((e=>t(e,r)))}),r),u(e)?0===v(this.window.document.querySelectorAll(e)).length&&t(null,0):e.parentNode||t(e,0)}))}onPresenceChange(e,t,r={}){e=v(e,!1);var n=new Set,s=new Set,o=(o,i,a)=>{i&&"removed"===r.on||!i&&"added"===r.on||(o=((e,t)=>(t.$$searchCache||(t.$$searchCache=new Map),e.reduce(((e,n)=>{var s;return t.$$searchCache.has(n)?s=t.$$searchCache.get(n):(s=((e,t)=>{if(t=t.filter((e=>e.matches)),u(e)){var n=t.filter((t=>t.matches(e)));if(!1!==r.observeIndirectMutation&&(n=t.reduce(((t,r)=>t.concat(v(r.querySelectorAll(e)))),n)).length)return n}else{if(t.includes(e))return[e];if(!1!==r.observeIndirectMutation&&t.length)for(var s=e;s=s.parentNode;)if(t.includes(s))return[e]}})(n,t,u(n))||[],t.$$searchCache.set(n,s)),e.concat(s)}),[])))(e,o)).length&&(r.maintainCallState?(o.forEach((e=>{i?(n.add(e),s.delete(e)):(n.delete(e),s.add(e))})),t(o,i,a,n,s)):t(o,i,a))},i=r.context||this.window.document.documentElement;return this._observe(i,((e,t,n,s)=>{r.ignoreTransients||(o(e,0,!0),o(e.concat(t),1,!0),o(t,0,!0)),o(s,0),o(n,1)}))}onAttrChange(e,t,r=[]){var n=new this.window.MutationObserver(t),s={attributes:!0,attributeOldValue:!0};return r&&(s.attributeFilter=r),n.observe(e,s),n}onTreeChange(e,t,r=!1){var n=new this.window.MutationObserver(t),s={childList:!0,subtree:r};return n.observe(e,s),n}onMutation(e,t,r){var n=new this.window.MutationObserver(t);return n.observe(e,r),n}_observe(e,t){if(!y.has(e)){const t=new Set,r=new this.window.MutationObserver((e=>{if(t.size){var r=e.reduce(((e,t)=>e.concat(v(t.addedNodes))),[]),n=e.reduce(((e,t)=>e.concat(v(t.removedNodes))),[]),s=[],o=[];r=new Set(r),n=new Set(n),r.forEach((e=>{n.has(e)&&(n.delete(e),r.delete(e),e.isConnected?s.push(e):o.push(e))})),r=[...r],n=[...n],t.forEach((e=>e(s,o,r,n)))}}));r.observe(e,{childList:!0,subtree:!0}),y.set(e,{callbacks:t,observer:r})}const r=y.get(e);return r.callbacks.add(t),{disconnect(){r.callbacks.delete(t)},reconnect(){r.callbacks.add(t)}}}}const y=new Map;function O(e,t=null,r=!1){const n=c.call(this);if(u(e)){var s;if(e.trim().startsWith("<")){var o=n.window.document.createElement("div");o.innerHTML=e,s=r?v(o.children):o.firstChild}else s=r?v(k.call(this,e,t)):x.call(this,e,t);return s}return e instanceof n.window.Element?r?[e]:e:r?v(e):e}function E(e,t=null){return O.call(this,e,t,!0)}function x(e,t=null,r=!1){const n=c.call(this);t=t||n.window.document;var s,o=r?"querySelectorAll":"querySelector";try{s=t[o](e)}catch(r){try{s=t[o](e.replace(/\:is\(/g,":matches("))}catch(r){try{s=t[o](e.replace(/\:is\(/g,":-webkit-any("))}catch(r){try{s=t[o](e.replace(/\:is\(/g,":-moz-any("))}catch(e){throw e}}}}return s}function k(e,t=null){return x.call(this,e,t,!0)}function j(e){return function(e){return e instanceof Number||"number"==typeof e}(e)||!0!==e&&!1!==e&&null!==e&&""!==e&&!isNaN(1*e)}function C(e){return f(e)||e&&"[object function]"==={}.toString.call(e)}function $(e,t,r={},n={}){t=v(t).slice();for(var s=e;!m(s)&&!p(s)&&t.length;){var o=t.shift();if(!(r.get?r.get(s,o):g(s)?o in s:s[o]))return void(n.exists=!1);s=r.get?r.get(s,o):s[o]}return n.exists=!0,s}function M(e,t,r,n={},s={}){const o=(e,r,n)=>s.set?s.set(e,r,n):(j(t[a])&&d(e)?e.push(n):e[r]=n,!0);t=v(t);for(var i=e,a=0;a<t.length;a++){if(!(a<t.length-1))return o(i,t[a],r);if(!i||!g(i)&&!C(i))return!1;var l=$(i,t[a],s);if(!g(l)){if(!1===s.buildTree)return!1;if(l=C(s.buildTree)?s.buildTree(a):j(t[a+1])?[]:{},!o(i,t[a],l))return!1}i=l}}function T(e,t,r=!1,n={}){t=v(t);var s=!1;do{var o=""===(o=t.pop())?0:o,i=e;t.length&&(i=$(e,t,{},n)),(g(i)||C(i))&&(n.has?n.has(i,o):o in i)&&(n.deleteProperty?s=n.deleteProperty(i,o):n.del?s=n.del(i,o):(delete i[o],s=!0))}while(s&&r&&t.length&&(g(i)||C(i))&&!(n.keys?n.keys(i):Object.keys(i)).length);return s}function A(e,t,r={}){var n={};return $(e,t,r,n),n.exists}function S(e,t=!1){const r=c.call(this);var n={};return!(n.el=r.window.document.head.querySelector('meta[name="oohtml"]'))&&t&&(n.el=r.window.document.createElement("meta"),n.el.setAttribute("name",e),r.window.document.head.append(n.el)),n.el&&(n.vars=(n.el.getAttribute("content")||"").split(";").filter((e=>e)).reduce(((e,t)=>{var r=t.split("=").map((e=>e.trim()));return M(e,r[0].split("."),"true"===r[1]||"false"!==r[1]&&(j(r[1])?parseInt(r[1]):r[1])),e}),{})),n.get=function(e){return $(this.vars,e.split("."))},n.set=function(e,r=null,n=!1){var s=l(e)?e:{[e]:!0===r?"true":r};if(n=arguments.length<3?r:n,Object.keys(s).forEach((e=>{if(!1===s[e])T(this.vars,e.split("."));else if(l(s[e]))Object.keys(s[e]).forEach((t=>{var r=(e+"."+t).split(".");n&&A(this.vars,r)||M(this.vars,r,s[e][t])}));else{var t=e.split(".");n&&A(this.vars,t)||M(this.vars,t,s[e])}})),t){const e=(t,r)=>Object.keys(r).reduce(((n,s)=>{var o=(t?t+".":"")+s;return l(r[s])?n.push(...e(o,r[s])):n.push(o+"="+r[s]),n}),[]);this.el.setAttribute("content",e("",this.vars).join(";"))}return!0},n.defaults=function(e,t=null){return this.set(e,t,!0)},n}function P(){const e=c.call(this);return e.DOM||(e.DOM={},function(e){!function(e){e.CSS||(e.CSS={}),e.CSS.escape||(e.CSS.escape=e=>e.replace(/([\:@\~\$\&])/g,"\\$1"))}(e),function(e){"isConnected"in e.Node.prototype||Object.defineProperty(e.Node.prototype,"isConnected",{get:function(){return!(this.ownerDocument&&this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}(e),function(e){e.Element.prototype.matches||(e.Element.prototype.matches=e.Element.prototype.matchesSelector||e.Element.prototype.mozMatchesSelector||e.Element.prototype.msMatchesSelector||e.Element.prototype.oMatchesSelector||e.Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),r=t.length;--r>=0&&t.item(r)!==this;);return r>-1})}(e)}(e.window),e.DOM.reflow=new h(e.window),e.DOM.mutations=new w(e.window),e.DOM.meta=S.bind(e.window),e.DOM.query=O.bind(e.window),e.DOM.queryAll=E.bind(e.window),e.DOM.ready=b.bind(e.window)),e}function D(e,t,r){return function(e,t){return function(e,t,r=!1){if(""==t)return e;var n=r?e.lastIndexOf(t):e.indexOf(t);return-1===n?e:e.substr(0,n)}(e,t,!0)}(function(e,t,r=!1){if(""==t)return e;var n=r?e.lastIndexOf(t):e.indexOf(t);return-1===n?"":e.substr(n+t.length)}(e,t),r)}function _(e){return s(e)||e&&"[object function]"==={}.toString.call(e)}function N(e){return e instanceof Number||"number"==typeof e}function L(e){return N(e)||!0!==e&&!1!==e&&null!==e&&""!==e&&!isNaN(1*e)}function R(e,r,n=!1,s=!1,a=!1){var l=0,c=e.shift();if((L(c)||!0===c||!1===c)&&(l=c,c=e.shift()),!e.length)throw new Error("_merge() requires two or more array/objects.");return e.forEach(((e,h)=>{var u,d,m;(o(e)||_(e))&&(n?(u=e,m=[],function(e,r){r=(r=r||Object.prototype)&&!t(r)?[r]:r;var n=[];for(e=e;e&&(!r||r.indexOf(e)<0)&&"default"!==e.name;)n.push(e),e=e?Object.getPrototypeOf(e):null;return n}(u,d).forEach((e=>{!function(e,...t){t.forEach((t=>{e.indexOf(t)<0&&e.push(t)}))}(m,...Object.getOwnPropertyNames(e))})),m):Object.getOwnPropertyNames(e)).forEach((o=>{if(r(o,c,e,h)){var u=c[o],d=e[o];if((t(u)&&t(d)||i(u)&&i(d))&&(!0===l||l>0))c[o]=t(u)&&t(d)?[]:{},R([L(l)?l-1:l,c[o],u,d],r,n,s,a);else if(t(c)&&t(e))s?c[o]=d:c.push(d);else try{a?Object.defineProperty(c,o,Object.getOwnPropertyDescriptor(e,o)):c[o]=e[o]}catch(e){}}}))})),c}function W(...e){return R(e,((e,t,r)=>!0),!1,!1,!1)}const q=function(e,r=1,n=!0){return!L(r)||r<=0?e:(!t(e)&&i(e)&&n&&(e=Object.values(e)),t(e)?e.reduce(((e,s)=>t(s)||i(s)&&n?e.concat(q(t(s)?s:Object.values(s),r-1,n)):e.concat(s)),[]):e)},Q=q;function I(e,t=1){var r=0;e.forEach((e=>{r++}));var n=e.slice(e.length-r,t);return arguments.length>1?n:n[0]}function H(e,t=1){return arguments.length>1?I(e.slice().reverse(),t).reverse():I(e.slice().reverse())}function z(e){return i(e)&&Object.getPrototypeOf(e)===Object.prototype}function F(e){return!0===e||!1===e}const U=function(e,r,n=!0,s=1){if(t(e)&&t(r)&&e.length!==r.length)return!n;if(i(e)&&i(r)){var a=Object.keys(e),l=Object.keys(r);if(!a.length&&!l.length)return z(e)&&z(r)?n:e===r===n;if(!U(a,l))return!n}if(s>0&&(t(e)&&t(r)||i(e)&&i(r))){var c=function(e,r,n=!0,s=!0,a=!1,l=!1){if(t(e)&&t(r)){var c=[],h=!0;return e.forEach((e=>{if(h){var u,d,m,p=!1;d=(r,a)=>{(!p||s&&o(e))&&((t(p=n(e,a))&&!p.length||i(p)&&!Object.keys(p).length)&&(p=!1),o(p)&&s&&(e=p))},m=void 0,o(u=r)&&Object.keys(u).forEach(((e,t)=>{!1!==m&&(m=d(L(e)&&parseFloat(e),u[e]))})),o(p)?c.push(s?p:e):F(p)?a&&!p||!a&&p?c.push(e):l&&(h=!1):c.push(p)}})),c}if(i(e)&&i(r))return c={},h=!0,Object.keys(e).forEach((u=>{if(h){var d=n(e[u],r[u]);(t(d)&&!d.length||i(d)&&!Object.keys(d).length)&&(d=!1),o(d)?c[u]=s?d:e[u]:F(d)?a&&!d||!a&&d?c[u]=e[u]:l&&(h=!1):c[u]=d}})),c}(e,r,((e,t)=>U(e,t,n,s-1)),!1,!1,!0);return t(c)?c.length===e.length&&c.length===r.length:i(c)&&i(e)?Object.keys(c).length===Object.keys(e).length&&Object.keys(c).length===Object.keys(r).length:c}return _(n)?n(e,r):N(e)&&N(r)&&isNaN(e)&&isNaN(r)?n:e===r===n},V=U;function K(e,r=[]){return R([{},e],((e,n,s)=>{if(!_(s[e]))return _(r)?r(e):!t(r)||!r.length||r.indexOf(e)>-1}),!1,!1,!1)}class Z{static lex(e,t,n={}){if(!r(e+=""))throw new Error("Argument1 must be a string!");var s=e=>({delims:e.delims.slice(),options:K(e.options),nesting:e.nesting.slice(),maxDepth:e.maxDepth,comments:e.comments.slice(),tokens:e.tokens.slice(),matches:e.matches.slice(),matchesi:K(e.matchesi)});if(Z.$cache[e]&&!1!==n.cache)for(var o=0;o<Z.$cache[e].length;o++){var i=Z.$cache[e][o];if(V(i.delims,t))return s(i)}var a=new Z(e,n).lex(t);return!1!==n.cache&&(Z.$cache[e]=Z.$cache[e]||[],Z.$cache[e].push(a)),s(a)}static split(e,t,r){return Z.lex(e,t,r).tokens}static match(e,t,r){return Z.lex(e,t,r).matches}constructor(e,t){if(!r(e))throw new Error("Lexer requires the first argument to be a string.");this.$str=e,this.$options=t||{},this.$options.blocks||(this.$options.blocks=Z.$blocks),this.$options.quotes||(this.$options.quotes=Z.$quotes),this.$options.comments||(this.$options.comments=Z.$comments)}lex(e,t){for(var r={delims:a(e),options:W(!0,{},this.$options,t||{}),nesting:[],maxDepth:0,comments:[],tokens:[],matches:[],matchesi:{}},n=0;"number"==typeof n;)n=this._evalCharsAt(r,n);if(r.nesting.length)throw new Error("Error parsing the string: "+this.$str+". Unterminated blocks: "+Q(r.nesting).join(", "));return r}_evalCharsAt(e,t){if(!(t>=this.$str.length)){var r=1,n={},s={},o={};if(e.openComment||(s=this._testQuotes(e,t)),e.openQuote||(n=this._testComments(e,t)),e.openComment||n.ending)e.nesting.length||o.ending?this._push(e,this.$str[t]):(r=(a=n.starting||n.ending||this.$str[t]).length,this._push(e,a,"comments",n.starting));else if(e.openQuote||s.ending)this._push(e,this.$str[t]);else{if(e.options.limit&&e.matches.length===e.options.limit)return this._push(e,this.$str[t]),t+1;o=this._testNesting(e,t),o=this._testNesting(e,t);var i=this._testChars(e.options.stopChars||[],e,t);if(!e.nesting.length&&!1!==i)return e.options.stopChar=i,void(e.options.stopCharForward=this.$str.substr(t));if(e.delims.length)if(e.nesting.length||o.ending){var a;r=(a=o.starting||o.ending||this.$str[t]).length,this._push(e,a)}else{this._push(e,"");var l=this._testChars(e.delims,e,t);if(!1!==l&&(e.matches.push(l),e.matchesi[t]=l,r=l.length||1,!e.options.preserveDelims)){var c=t+(l.length||1);return c===this.$str.length&&this._push(e,""),c}this._push(e,l||this.$str[t])}else 2===e.nesting.length&&o.starting?(e.matches.push(null),this._push(e,o.starting),r=o.starting.length):!e.nesting.length&&o.ending?(this._push(e,o.ending),r=o.ending.length,e.matches.push(null)):this._push(e,this.$str[t])}return t+r}}_testQuotes(e,t){var r={};return(e.options.quotes||[]).forEach((n=>{this.$str.substr(t,1)===n&&(e.openQuote?n===e.openQuote&&(e.openQuote=!1,r.ending=n):(e.openQuote=n,r.starting=n))})),r}_testComments(e,t){var r={};return(e.options.comments||[]).forEach((n=>{if(e.openComment){if(H(n)===H(e.openComment)){var s=H(n);this.$str.substr(t).startsWith(s)&&(e.openComment=!1,r.ending=s)}}else{var o=I(n);this.$str.substr(t).startsWith(o)&&(e.openComment=n,r.starting=o)}})),r}_testNesting(e,t){var r={};return(e.options.blocks||[]).forEach((n=>{var s=I(n);if(this.$str.substr(t).startsWith(s))e.nesting=e.nesting.concat([n]),r.starting=s;else if(e.nesting.length&&H(n)===H(H(e.nesting))){var o=H(n);this.$str.substr(t).startsWith(o)&&(e.nesting=e.nesting.slice(0,-1),r.ending=o)}})),e.maxDepth=Math.max(e.maxDepth,e.nesting.length),r}_testChars(e,t,r){for(var n=0;n<e.length;n++){var s=e[n];if(_(s)){var o=s(this.$str.substr(0,r),this.$str.substr(r),t.tokens.slice());if(!1!==o)return o}if(t.options.useRegex){var i=this.$str.substr(r).match(new RegExp("^"+s,!0!==t.options.useRegex?t.options.useRegex:""));if(i)return i[0]}if(!t.options.ci&&this.$str.substr(r,s.length)===s||t.options.ci&&this.$str.substr(r,s.length).toLowerCase()===s.toLowerCase())return s}return!1}_push(e,t,r="tokens",s=!1){var o=e.matches.length;if(n(e.tokens[o])&&(e.tokens[o]=""),"comments"===r){e.tokens[o].comments||(e.tokens[o]=new String(e.tokens[o]),e.tokens[o].comments=[]);var i=e.tokens[o].comments.length-(!e.tokens[o].comments.length||s?0:1);e.tokens[o].comments[i]=(e.tokens[o].comments[i]||"")+t}else e.tokens[o].comments,e.tokens[o]=e.tokens[o]+t}split(e,t,r){return this.lex(t,r).tokens}match(e,t,r){return this.lex(t,r).matches}regParse(e,t){return this.lex(e,W({useRegex:!0},t||{}))}regSplit(e,t){return this.regParse(e,t).tokens}regMatch(e,t){return this.regParse(e,t).matches}}function B(e,t={}){const r=P.call(this);return r.OOHTML||(r.OOHTML={}),r.OOHTML.meta||(r.OOHTML.meta=r.DOM.meta("oohtml",!0)),r.OOHTML.meta.defaults(W(3,e,t)),r.OOHTML.meta}Z.$blocks=[["(",")"],["[","]"],["{","}"]],Z.$quotes=['"',"'","`"],Z.$comments=[["/*","*/"],["//","\n"]],Z.$cache=Object.create(null);const G=(e,t)=>Z.split(e.trim(),["|","+"],{preserveDelims:!0}).reduce(((e,r)=>{var n;return(r.startsWith("|")||r.startsWith("+"))&&(n=r.substr(0,1),r=r.substr(1).trim()),e.theEnd||"|"===n&&e.length?(e.theEnd=!0,e):e.concat(t(r.trim()))}),[]).filter((e=>e)),J=(e,t,r)=>{const n=e=>e.reduce(((e,t)=>e.concat(...r(t).values())),[]);return G(t,(t=>{var s,o,[t,i]=(s=t,o=Z.split(s.trim(),[":"]),[s=o.shift(),o.reduce(((e,t)=>{var[r,n]=Z.split(t.trim(),[]);return e[r]=D(n,"(",")"),e}),{})]);return e.reduce(((e,s)=>{var o=r(s);"*"===t&&(t="("+o.keys().join("+")+")");var l,c=("(",")",(l=t).startsWith("(")&&l.endsWith(")")?J([s],D(t,"(",")"),r):a(o.get(t),!1)),h=[];return Object.keys(i).forEach((e=>{if("deep"===e||"deepest"===e)for(var o=[s];("deepest"===e||!c.length)&&(o=n(o)).length;){var a=J(o,`${t}${h.map((e=>`:${e}(${i[e]})`)).join("")}`,r);a.length&&(c=a)}else"having"!==e&&"not-having"!==e||(c=c.filter((t=>{var n=G(i[e],(e=>r(t,e)));return"not-having"===e?!n.length:n.length}))),h.push(e)})),e.concat(c)}),[])}))},X=function(e,t,r,n=null,s=0){if(!t.length)return[];var o,i=t.shift();i.endsWith(".")&&(o=!0,i=i.substr(0,i.length-1).trim());var a=J(e,i,r);if(a.length&&o)return a;if(t.length){var l=X(a,t.slice(),r,n,s+1);return-1===l?n(a,s,!0):l}return n?n(a,s):a};(function t(r={}){const n=P.call(this);if(r.onDomReady)return void n.DOM.ready((()=>{t.call(this,{...r,onDomReady:!1})}));const s=n.window,o=n.window.document,i=n.DOM.mutations,l=B.call(this,{element:{template:"",export:"export",import:"import"},attr:{moduleid:"name",moduleref:"template",exportid:"name",exportgroup:"exportgroup"},api:{templateClass:"",templates:"templates",exports:"exports",moduleref:"template"}},r.params),c="template"+(l.get("element.template")?'[is="'+l.get("element.template")+'"]':"")+"["+s.CSS.escape(l.get("attr.moduleid"))+"]";var h=s.HTMLTemplateElement;if(l.get("api.templateClass")){if(!s[l.get("api.templateClass")])throw new Error('The custom element class "'+l.get("api.templateClass")+'" is not defined!');h=s[l.get("api.templateClass")]}const u=(e,t,r)=>{"templatemutation"===e&&(["addedExports","removedExports"].forEach((e=>{Object.defineProperty(t,e,{value:Object.keys(t[e]).map((r=>({name:r,items:t[e][r]})))})})),["addedTemplates","removedTemplates"].forEach((e=>{Object.defineProperty(t,e,{value:Object.keys(t[e]).map((r=>({name:r,item:t[e][r]})))})}))),Object.defineProperty(t,"path",{value:r}),o.dispatchEvent(new s.CustomEvent(e,{detail:t}))},d=(e,t)=>{const r=r=>{e.dispatchEvent(new s.CustomEvent(r,{detail:{path:t}}))};var n=e.getAttribute("src");return new Promise(((o,i)=>{s.fetch?s.fetch(n).then((e=>e.ok?e.text():Promise.reject(e.statusText))).then((n=>{e.innerHTML=n,r("load"),u("templatecontentloaded",{template:e},t),o(e)})).catch((s=>{console.error("Error fetching the bundle at "+n+". ("+s+")"),e.innerHTML="",r("loaderror"),u("templatecontentloaderror",{template:e},t),o(e)})):(o(),console.error("Error fetching the bundle at "+n+". (window.fetch() not supported by browser.)"))}))},m=(t,r,n,o=null,h=!0)=>{const f=(t,s,o,i)=>{var h;if(t.matches)if(t.matches(c)&&(h=t.getAttribute(l.get("attr.moduleid")))&&g(h)){var u=(n?n+"/":"")+h;"removed"===o?(e(r,"oohtml","templates").delete(h),e(r,"oohtml").get("parentTemplate")===r&&e(r,"oohtml").delete("parentTemplate"),s&&(s.removedTemplates[h]=t)):"added"===o&&(e(r,"oohtml","templates").set(h,t),e(t,"oohtml").set("parentTemplate",r),s&&(s.addedTemplates[h]=t)),m(t.content,t,u,o,i)}else{const n=t=>{var n=t.getAttribute(l.get("attr.exportgroup"))||"default";"removed"===o?e(r,"oohtml","exports").has(n)&&(function(e,t,r=!1){for(var n=e.indexOf(t);n>-1&&(r||!1===r);)e.splice(n,1),r>0&&r--,n=e.indexOf(t)}(e(r,"oohtml","exports").get(n),t),e(r,"oohtml","exports").has(n).length||e(r,"oohtml","exports").delete(n),s&&(s.removedExports[n]||(s.removedExports[n]=[]),s.removedExports[n].push(t))):"added"===o&&(e(r,"oohtml","exports").has(n)||e(r,"oohtml","exports").set(n,[]),e(r,"oohtml","exports").get(n).push(t),s&&(s.addedExports[n]||(s.addedExports[n]=[]),s.addedExports[n].push(t)))};if(t.matches(l.get("element.export"))){var d=t.getAttribute(l.get("attr.exportid"))||"default";a(t.children).forEach((e=>{e.setAttribute(l.get("attr.exportgroup"),d),n(e)}))}else n(t)}};r.modulemutationsType=o;const v={addedTemplates:Object.create(null),removedTemplates:Object.create(null),addedExports:Object.create(null),removedExports:Object.create(null)};if(a(t.children).forEach((e=>f(e,v,o,h))),h&&u("templatemutation",v,n),"added"===o&&!e(r,"oohtml").get("onLiveMode")){e(r,"oohtml").set("onLiveMode",!0),r.getAttribute("src")&&!r.content.children.length&&p.push(d(r,n)),i.onAttrChange(r,(e=>{e[0].target.getAttribute(e[0].attributeName)!==e[0].oldValue&&d(r,n)}),["src"]);var b=new s.MutationObserver((e=>{const t={addedTemplates:Object.create(null),removedTemplates:Object.create(null),addedExports:Object.create(null),removedExports:Object.create(null)};e.forEach((e=>{e.addedNodes.forEach((e=>f(e,t,"added",!0))),e.removedNodes.forEach((e=>f(e,t,"removed",!0)))})),u("templatemutation",t,n)}));b.observe(t,{childList:!0})}};if(l.get("api.templates")in o)throw new Error('document already has a "'+l.get("api.templates")+'" property!');const p=[];if(Object.defineProperty(o,l.get("api.templates"),{get:function(){return f(e(o,"oohtml","templates"))}}),l.get("api.templates")in h.prototype)throw new Error('The "HTMLTemplateElement" class already has a "'+l.get("api.templates")+'" property!');if(Object.defineProperty(h.prototype,l.get("api.templates"),{get:function(){return f(e(this,"oohtml","templates"))}}),l.get("api.exports")in h.prototype)throw new Error('The "HTMLTemplateElement" class already has a "'+l.get("api.exports")+'" property!');Object.defineProperty(h.prototype,l.get("api.exports"),{get:function(){return f(e(this,"oohtml","exports"))}});const f=e=>Object.defineProperties({},Array.from(e.keys()).reduce(((t,r)=>(t[r]={get:()=>e.get(r)},t)),{})),g=e=>{var t;return!(t=e.match(/([^a-zA-Z0-9\_\-\@])/))||(console.error(`Invalid character "${t}" in the module name: ${e}.`),!1)};if(a(o.querySelectorAll(c)).forEach((async t=>{var r=t.getAttribute(l.get("attr.moduleid"));!t.closest(l.get("element.import"))&&g(r)&&(e(o,"oohtml","templates").set(r,t),m(t.content,t,r,"added",!1))})),i.onPresenceChange(c,(async(t,r)=>{const n={addedTemplates:Object.create(null),removedTemplates:Object.create(null),addedExports:Object.create(null),removedExports:Object.create(null)};t.forEach((t=>{var s=t.getAttribute(l.get("attr.moduleid"));!t.closest(l.get("element.import"))&&g(s)&&(r?(e(o,"oohtml","templates").set(s,t),m(t.content,t,s,"added"),n.addedTemplates[s]=t):(e(o,"oohtml","templates").get(s)===t&&e(o,"oohtml","templates").delete(s),m(t.content,t,s,"removed"),n.removedTemplates[s]=t))})),u("templatemutation",n,"")})),i.onPresent(l.get("element.import"),(e=>{m(e,e,"","added",!1)})),l.get("api.moduleref")in s.Element.prototype)throw new Error('The "Element" class already has a "'+l.get("api.moduleref")+'" property!');Object.defineProperty(s.Element.prototype,l.get("api.moduleref"),{get:function(){var t;if(!e(this,"oohtml").has("module")&&(t=this.getAttribute(l.get("attr.moduleref")))){var r=(t=>{var r=o.createElement("template");return function(e,t,r,n=null){var s=t.split("#")[0].split("/").map((e=>e.trim())).filter((e=>e));return X(e,s,r,n)}([o],t,(function(t,r){var n=e(t,"oohtml","templates");return 1===arguments.length?n:r.startsWith(":")?e(t,"oohtml","exports").get(r.substr(1)):n.get(r)})).forEach((t=>{e(t,"oohtml","templates").forEach(((t,n)=>{e(r,"oohtml","templates").set(n,t)})),e(t,"oohtml","exports").forEach(((t,n)=>{e(r,"oohtml","exports").has(n)||e(r,"oohtml","exports").set(n,[]),e(r,"oohtml","exports").get(n).push(...t)}))})),r})(t);e(this,"oohtml").set("module",r)}return e(this,"oohtml").get("module")}});var v=p.length?"loading":"indeterminate";Object.defineProperty(o,"templatesReadyState",{get:()=>v}),n.DOM.ready.call(n,(()=>(p.forEach((e=>{e.catch((e=>{console.warn(e)}))})),Promise.all(p).then((()=>{v="complete",o.dispatchEvent(new s.Event("templatesreadystatechange"))})))))}).call(window)})();
2
2
  //# sourceMappingURL=html-modules.js.map
Binary file