@webqit/oohtml 1.9.6 → 1.9.7

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.
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";function t(t,e){return t.reduce(((t,r,n)=>t||e(r,n)),!1)}function e(t){return Array.isArray(t)}function r(t){return t instanceof String||"string"==typeof t&&null!==t}function n(t){return arguments.length&&(void 0===t||void 0===t)}function i(t){return"function"==typeof t}function s(t){return Array.isArray(t)||"object"==typeof t&&t||i(t)}function o(t){return!Array.isArray(t)&&"object"==typeof t&&t}function a(t,i=!0){return e(t)?t:!i&&o(t)?[t]:!1!==t&&0!==t&&function(t){return function(t){return null===t||""===t}(t)||n(t)||!1===t||0===t||s(t)&&!Object.keys(t).length}(t)?[]:function(t){return!r(t)&&!n(t.length)}(t)?Array.prototype.slice.call(t):o(t)?Object.values(t):[t]}function l(t){return t.filter(((t,e,r)=>r.indexOf(t)===e))}function c(t,...e){globalThis.WebQitInternalsRegistry||(globalThis.WebQitInternalsRegistry=new Map);var r,n,i=globalThis.WebQitInternalsRegistry.get(t);if(!i){if(i=new Map,!1===e[0])return i;globalThis.WebQitInternalsRegistry.set(t,i)}for(;r=e.shift();)if((n=i)&&!(i=i.get(r))){if(i=new Map,!1===e[0])return i;n.set(r,i)}return i}function h(t){return!Array.isArray(t)&&"object"==typeof t&&t}function u(){if(!(h(this)&&this.window||"undefined"!=typeof window))throw new Error("A window context is required.");const t=h(this)&&this.window?this.window:window;if(t.WebQit||(t.WebQit={}),!t.WebQit.window){let e,r;Object.defineProperty(t.WebQit,"window",{get:()=>t}),Object.defineProperty(t.WebQit,"vendor",{value:{getName:()=>(e||(e=function(t){if(void 0!==t.InstallTrigger)return"firefox";if(/constructor/i.test(t.HTMLElement)||"[object SafariRemoteNotification]"===(!t.safari||void 0!==t.safari&&t.safari.pushNotification).toString())return"safari";var e=!(!t.chrome||!t.chrome.webstore&&!t.chrome.runtime),r=e&&-1!=t.navigator.userAgent.indexOf("Edg"),n=!!t.opr&&!!t.opr.addons||!!t.opera||t.navigator.userAgent.indexOf(" OPR/")>=0,i=!!t.document.documentMode,s=!i&&!!t.StyleMedia;return(e||n)&&t.CSS,s?"edge":i?"ie":n?"opera":r?"ie-chromium":e?"chrome":"unknown"}(t)),e),getPrefix:()=>(r||(r=function(t){var e=t.getComputedStyle(t.document.documentElement,""),r=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.Olink&&["","o"])[1];return{api:("WebKit|Moz|Ms|O".match(new RegExp("("+r+")","i"))||[])[1],prefix:r,css:"-"+r+"-"}}(t)),r)}})}return t.WebQit}new Map;class m{constructor(t,e=!0){this.window=t,this.async=e,this.readCallbacks=[],this.writeCallbacks=[],this._run()}_run(){this.window.requestAnimationFrame((()=>{this.readCallbacks.forEach(((t,e)=>{t&&!t()&&(this.readCallbacks[e]=null)})),this.writeCallbacks.forEach(((t,e)=>{t&&!t()&&(this.writeCallbacks[e]=null)})),this._run()}))}onread(t,e=!1){if(e)return new Promise(((e,r)=>{!1===this.async?t(e,r):this.readCallbacks.push((()=>{t(e,r)}))}));!1===this.async?t():this.readCallbacks.push(t)}onwrite(t,e=!1){if(e)return new Promise(((e,r)=>{!1===this.async?t(e,r):this.writeCallbacks.push((()=>{t(e,r)}))}));!1===this.async?t():this.writeCallbacks.push(t)}cycle(t,e,r){this.onread((()=>{var n=t(r);if(n){var i=n=>{this.onwrite((()=>{var i=e(n,r);if(i){var s=r=>{this.cycle(t,e,r)};i instanceof Promise?i.then(s):s()}}))};n instanceof Promise?n.then(i):i()}}))}}function d(t){return t instanceof String||"string"==typeof t&&null!==t}function f(t){return Array.isArray(t)}function p(t){return arguments.length&&(void 0===t||void 0===t)}function g(t){return null===t||""===t}function b(t){return"function"==typeof t}function v(t){return Array.isArray(t)||"object"==typeof t&&t||b(t)}function w(t,e=!0){return f(t)?t:!e&&h(t)?[t]:!1!==t&&0!==t&&function(t){return g(t)||p(t)||!1===t||0===t||v(t)&&!Object.keys(t).length}(t)?[]:function(t){return!d(t)&&!p(t.length)}(t)?Array.prototype.slice.call(t):h(t)?Object.values(t):[t]}function y(t){const e=u.call(this);e.DOM.isDOMReady||"complete"===e.window.document.readyState?t(e.window):(e.window.domReadyCallbacks||(e.window.domReadyCallbacks=[],e.window.document.addEventListener("DOMContentLoaded",(()=>{e.DOM.isDOMReady=!0,e.window.domReadyCallbacks.splice(0).forEach((t=>t(e.window)))}),!1)),e.window.domReadyCallbacks.push(t))}class O{constructor(t){this.window=t}onAdded(t,e,r={}){return r.on="added",this.onPresenceChange(t,((t,r,n,i,s)=>{e(t,r,n,i,s)}),r)}onRemoved(t,e,r={}){return r.on="removed",this.onPresenceChange(t,((t,r,n,i,s)=>{e(t,r,n,i,s)}),r)}onPresent(t,e,r={}){y.call(this.window,(()=>{this.window.MutationObserver&&this.onAdded(t,((t,r)=>{t.forEach((t=>e(t,r)))}),r),d(t)?w(this.window.document.querySelectorAll(t)).forEach((t=>e(t,1))):t.parentNode&&e(t,1)}))}onAbsent(t,e,r={}){y.call(this.window,(()=>{this.window.MutationObserver&&onRemoved(t,((t,r)=>{t.forEach((t=>e(t,r)))}),r),d(t)?0===w(this.window.document.querySelectorAll(t)).length&&e(null,0):t.parentNode||e(t,0)}))}onPresenceChange(t,e,r={}){t=w(t,!1);var n=new Set,i=new Set,s=(s,o,a)=>{o&&"removed"===r.on||!o&&"added"===r.on||(s=((t,e)=>(e.$$searchCache||(e.$$searchCache=new Map),t.reduce(((t,n)=>{var i;return e.$$searchCache.has(n)?i=e.$$searchCache.get(n):(i=((t,e)=>{if(e=e.filter((t=>t.matches)),d(t)){var n=e.filter((e=>e.matches(t)));if(!1!==r.observeIndirectMutation&&(n=e.reduce(((e,r)=>e.concat(w(r.querySelectorAll(t)))),n)).length)return n}else{if(e.includes(t))return[t];if(!1!==r.observeIndirectMutation&&e.length)for(var i=t;i=i.parentNode;)if(e.includes(i))return[t]}})(n,e,d(n))||[],e.$$searchCache.set(n,i)),t.concat(i)}),[])))(t,s)).length&&(r.maintainCallState?(s.forEach((t=>{o?(n.add(t),i.delete(t)):(n.delete(t),i.add(t))})),e(s,o,a,n,i)):e(s,o,a))},o=r.context||this.window.document.documentElement;return this._observe(o,((t,e,n,i)=>{r.ignoreTransients||(s(t,0,!0),s(t.concat(e),1,!0),s(e,0,!0)),s(i,0),s(n,1)}))}onAttrChange(t,e,r=[]){var n=new this.window.MutationObserver(e),i={attributes:!0,attributeOldValue:!0};return r&&(i.attributeFilter=r),n.observe(t,i),n}onTreeChange(t,e,r=!1){var n=new this.window.MutationObserver(e),i={childList:!0,subtree:r};return n.observe(t,i),n}onMutation(t,e,r){var n=new this.window.MutationObserver(e);return n.observe(t,r),n}_observe(t,e){if(!k.has(t)){const e=new Set,r=new this.window.MutationObserver((t=>{if(e.size){var r=t.reduce(((t,e)=>t.concat(w(e.addedNodes))),[]),n=t.reduce(((t,e)=>t.concat(w(e.removedNodes))),[]),i=[],s=[];r=new Set(r),n=new Set(n),r.forEach((t=>{n.has(t)&&(n.delete(t),r.delete(t),t.isConnected?i.push(t):s.push(t))})),r=[...r],n=[...n],e.forEach((t=>t(i,s,r,n)))}}));r.observe(t,{childList:!0,subtree:!0}),k.set(t,{callbacks:e,observer:r})}const r=k.get(t);return r.callbacks.add(e),{disconnect(){r.callbacks.delete(e)},reconnect(){r.callbacks.add(e)}}}}const k=new Map;function E(t,e=null,r=!1){const n=u.call(this);if(d(t)){var i;if(t.trim().startsWith("<")){var s=n.window.document.createElement("div");s.innerHTML=t,i=r?w(s.children):s.firstChild}else i=r?w(M.call(this,t,e)):A.call(this,t,e);return i}return t instanceof n.window.Element?r?[t]:t:r?w(t):t}function C(t,e=null){return E.call(this,t,e,!0)}function A(t,e=null,r=!1){const n=u.call(this);e=e||n.window.document;var i,s=r?"querySelectorAll":"querySelector";try{i=e[s](t)}catch(r){try{i=e[s](t.replace(/\:is\(/g,":matches("))}catch(r){try{i=e[s](t.replace(/\:is\(/g,":-webkit-any("))}catch(r){try{i=e[s](t.replace(/\:is\(/g,":-moz-any("))}catch(t){throw t}}}}return i}function M(t,e=null){return A.call(this,t,e,!0)}function $(t){return function(t){return t instanceof Number||"number"==typeof t}(t)||!0!==t&&!1!==t&&null!==t&&""!==t&&!isNaN(1*t)}function x(t){return b(t)||t&&"[object function]"==={}.toString.call(t)}function S(t,e,r={},n={}){e=w(e).slice();for(var i=t;!p(i)&&!g(i)&&e.length;){var s=e.shift();if(!(r.get?r.get(i,s):v(i)?s in i:i[s]))return void(n.exists=!1);i=r.get?r.get(i,s):i[s]}return n.exists=!0,i}function N(t,e,r,n={},i={}){const s=(t,r,n)=>i.set?i.set(t,r,n):($(e[a])&&f(t)?t.push(n):t[r]=n,!0);e=w(e);for(var o=t,a=0;a<e.length;a++){if(!(a<e.length-1))return s(o,e[a],r);if(!o||!v(o)&&!x(o))return!1;var l=S(o,e[a],i);if(!v(l)){if(!1===i.buildTree)return!1;if(l=x(i.buildTree)?i.buildTree(a):$(e[a+1])?[]:{},!s(o,e[a],l))return!1}o=l}}function j(t,e,r=!1,n={}){e=w(e);var i=!1;do{var s=""===(s=e.pop())?0:s,o=t;e.length&&(o=S(t,e,{},n)),(v(o)||x(o))&&(n.has?n.has(o,s):s in o)&&(n.deleteProperty?i=n.deleteProperty(o,s):n.del?i=n.del(o,s):(delete o[s],i=!0))}while(i&&r&&e.length&&(v(o)||x(o))&&!(n.keys?n.keys(o):Object.keys(o)).length);return i}function D(t,e,r={}){var n={};return S(t,e,r,n),n.exists}function _(t,e=!1){const r=u.call(this);var n={};return!(n.el=r.window.document.head.querySelector('meta[name="oohtml"]'))&&e&&(n.el=r.window.document.createElement("meta"),n.el.setAttribute("name",t),r.window.document.head.append(n.el)),n.el&&(n.vars=(n.el.getAttribute("content")||"").split(";").filter((t=>t)).reduce(((t,e)=>{var r=e.split("=").map((t=>t.trim()));return N(t,r[0].split("."),"true"===r[1]||"false"!==r[1]&&($(r[1])?parseInt(r[1]):r[1])),t}),{})),n.get=function(t){return S(this.vars,t.split("."))},n.set=function(t,r=null,n=!1){var i=h(t)?t:{[t]:!0===r?"true":r};if(n=arguments.length<3?r:n,Object.keys(i).forEach((t=>{if(!1===i[t])j(this.vars,t.split("."));else if(h(i[t]))Object.keys(i[t]).forEach((e=>{var r=(t+"."+e).split(".");n&&D(this.vars,r)||N(this.vars,r,i[t][e])}));else{var e=t.split(".");n&&D(this.vars,e)||N(this.vars,e,i[t])}})),e){const t=(e,r)=>Object.keys(r).reduce(((n,i)=>{var s=(e?e+".":"")+i;return h(r[i])?n.push(...t(s,r[i])):n.push(s+"="+r[i]),n}),[]);this.el.setAttribute("content",t("",this.vars).join(";"))}return!0},n.defaults=function(t,e=null){return this.set(t,e,!0)},n}function T(){const t=u.call(this);return t.DOM||(t.DOM={},function(t){!function(t){t.CSS||(t.CSS={}),t.CSS.escape||(t.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}(t),function(t){"isConnected"in t.Node.prototype||Object.defineProperty(t.Node.prototype,"isConnected",{get:function(){return!(this.ownerDocument&&this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}(t),function(t){t.Element.prototype.matches||(t.Element.prototype.matches=t.Element.prototype.matchesSelector||t.Element.prototype.mozMatchesSelector||t.Element.prototype.msMatchesSelector||t.Element.prototype.oMatchesSelector||t.Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),r=e.length;--r>=0&&e.item(r)!==this;);return r>-1})}(t)}(t.window),t.DOM.reflow=new m(t.window),t.DOM.mutations=new O(t.window),t.DOM.meta=_.bind(t.window),t.DOM.query=E.bind(t.window),t.DOM.queryAll=C.bind(t.window),t.DOM.ready=y.bind(t.window)),t}function W(t,e,r){return function(t,e){return function(t,e,r=!1){if(""==e)return t;var n=r?t.lastIndexOf(e):t.indexOf(e);return-1===n?t:t.substr(0,n)}(t,e,!0)}(function(t,e,r=!1){if(""==e)return t;var n=r?t.lastIndexOf(e):t.indexOf(e);return-1===n?"":t.substr(n+e.length)}(t,e),r)}function P(t){return i(t)||t&&"[object function]"==={}.toString.call(t)}function I(t){return t instanceof Number||"number"==typeof t}function R(t){return I(t)||!0!==t&&!1!==t&&null!==t&&""!==t&&!isNaN(1*t)}function q(t,r,n=!1,i=!1,a=!1){var l=0,c=t.shift();if((R(c)||!0===c||!1===c)&&(l=c,c=t.shift()),!t.length)throw new Error("_merge() requires two or more array/objects.");return t.forEach(((t,h)=>{var u,m,d;(s(t)||P(t))&&(n?(u=t,d=[],function(t,r){r=(r=r||Object.prototype)&&!e(r)?[r]:r;var n=[];for(t=t;t&&(!r||r.indexOf(t)<0)&&"default"!==t.name;)n.push(t),t=t?Object.getPrototypeOf(t):null;return n}(u,m).forEach((t=>{!function(t,...e){e.forEach((e=>{t.indexOf(e)<0&&t.push(e)}))}(d,...Object.getOwnPropertyNames(t))})),d):Object.getOwnPropertyNames(t)).forEach((s=>{if(r(s,c,t,h)){var u=c[s],m=t[s];if((e(u)&&e(m)||o(u)&&o(m))&&(!0===l||l>0))c[s]=e(u)&&e(m)?[]:{},q([R(l)?l-1:l,c[s],u,m],r,n,i,a);else if(e(c)&&e(t))i?c[s]=m:c.push(m);else try{a?Object.defineProperty(c,s,Object.getOwnPropertyDescriptor(t,s)):c[s]=t[s]}catch(t){}}}))})),c}function L(...t){return q(t,((t,e,r)=>!0),!1,!1,!1)}const Q=function(t,r=1,n=!0){return!R(r)||r<=0?t:(!e(t)&&o(t)&&n&&(t=Object.values(t)),e(t)?t.reduce(((t,i)=>e(i)||o(i)&&n?t.concat(Q(e(i)?i:Object.values(i),r-1,n)):t.concat(i)),[]):t)},B=Q;function H(t,e=1){var r=0;t.forEach((t=>{r++}));var n=t.slice(t.length-r,e);return arguments.length>1?n:n[0]}function z(t,e=1){return arguments.length>1?H(t.slice().reverse(),e).reverse():H(t.slice().reverse())}function F(t){return o(t)&&Object.getPrototypeOf(t)===Object.prototype}function V(t){return!0===t||!1===t}const U=function(t,r,n=!0,i=1){if(e(t)&&e(r)&&t.length!==r.length)return!n;if(o(t)&&o(r)){var a=Object.keys(t),l=Object.keys(r);if(!a.length&&!l.length)return F(t)&&F(r)?n:t===r===n;if(!U(a,l))return!n}if(i>0&&(e(t)&&e(r)||o(t)&&o(r))){var c=function(t,r,n=!0,i=!0,a=!1,l=!1){if(e(t)&&e(r)){var c=[],h=!0;return t.forEach((t=>{if(h){var u,m,d,f=!1;m=(r,a)=>{(!f||i&&s(t))&&((e(f=n(t,a))&&!f.length||o(f)&&!Object.keys(f).length)&&(f=!1),s(f)&&i&&(t=f))},d=void 0,s(u=r)&&Object.keys(u).forEach(((t,e)=>{!1!==d&&(d=m(R(t)&&parseFloat(t),u[t]))})),s(f)?c.push(i?f:t):V(f)?a&&!f||!a&&f?c.push(t):l&&(h=!1):c.push(f)}})),c}if(o(t)&&o(r))return c={},h=!0,Object.keys(t).forEach((u=>{if(h){var m=n(t[u],r[u]);(e(m)&&!m.length||o(m)&&!Object.keys(m).length)&&(m=!1),s(m)?c[u]=i?m:t[u]:V(m)?a&&!m||!a&&m?c[u]=t[u]:l&&(h=!1):c[u]=m}})),c}(t,r,((t,e)=>U(t,e,n,i-1)),!1,!1,!0);return e(c)?c.length===t.length&&c.length===r.length:o(c)&&o(t)?Object.keys(c).length===Object.keys(t).length&&Object.keys(c).length===Object.keys(r).length:c}return P(n)?n(t,r):I(t)&&I(r)&&isNaN(t)&&isNaN(r)?n:t===r===n},K=U;function G(t,r=[]){return q([{},t],((t,n,i)=>{if(!P(i[t]))return P(r)?r(t):!e(r)||!r.length||r.indexOf(t)>-1}),!1,!1,!1)}class J{static lex(t,e,n={}){if(!r(t+=""))throw new Error("Argument1 must be a string!");var i=t=>({delims:t.delims.slice(),options:G(t.options),nesting:t.nesting.slice(),maxDepth:t.maxDepth,comments:t.comments.slice(),tokens:t.tokens.slice(),matches:t.matches.slice(),matchesi:G(t.matchesi)});if(J.$cache[t]&&!1!==n.cache)for(var s=0;s<J.$cache[t].length;s++){var o=J.$cache[t][s];if(K(o.delims,e))return i(o)}var a=new J(t,n).lex(e);return!1!==n.cache&&(J.$cache[t]=J.$cache[t]||[],J.$cache[t].push(a)),i(a)}static split(t,e,r){return J.lex(t,e,r).tokens}static match(t,e,r){return J.lex(t,e,r).matches}constructor(t,e){if(!r(t))throw new Error("Lexer requires the first argument to be a string.");this.$str=t,this.$options=e||{},this.$options.blocks||(this.$options.blocks=J.$blocks),this.$options.quotes||(this.$options.quotes=J.$quotes),this.$options.comments||(this.$options.comments=J.$comments)}lex(t,e){for(var r={delims:a(t),options:L(!0,{},this.$options,e||{}),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: "+B(r.nesting).join(", "));return r}_evalCharsAt(t,e){if(!(e>=this.$str.length)){var r=1,n={},i={},s={};if(t.openComment||(i=this._testQuotes(t,e)),t.openQuote||(n=this._testComments(t,e)),t.openComment||n.ending)t.nesting.length||s.ending?this._push(t,this.$str[e]):(r=(a=n.starting||n.ending||this.$str[e]).length,this._push(t,a,"comments",n.starting));else if(t.openQuote||i.ending)this._push(t,this.$str[e]);else{if(t.options.limit&&t.matches.length===t.options.limit)return this._push(t,this.$str[e]),e+1;s=this._testNesting(t,e),s=this._testNesting(t,e);var o=this._testChars(t.options.stopChars||[],t,e);if(!t.nesting.length&&!1!==o)return t.options.stopChar=o,void(t.options.stopCharForward=this.$str.substr(e));if(t.delims.length)if(t.nesting.length||s.ending){var a;r=(a=s.starting||s.ending||this.$str[e]).length,this._push(t,a)}else{this._push(t,"");var l=this._testChars(t.delims,t,e);if(!1!==l&&(t.matches.push(l),t.matchesi[e]=l,r=l.length||1,!t.options.preserveDelims)){var c=e+(l.length||1);return c===this.$str.length&&this._push(t,""),c}this._push(t,l||this.$str[e])}else 2===t.nesting.length&&s.starting?(t.matches.push(null),this._push(t,s.starting),r=s.starting.length):!t.nesting.length&&s.ending?(this._push(t,s.ending),r=s.ending.length,t.matches.push(null)):this._push(t,this.$str[e])}return e+r}}_testQuotes(t,e){var r={};return(t.options.quotes||[]).forEach((n=>{this.$str.substr(e,1)===n&&(t.openQuote?n===t.openQuote&&(t.openQuote=!1,r.ending=n):(t.openQuote=n,r.starting=n))})),r}_testComments(t,e){var r={};return(t.options.comments||[]).forEach((n=>{if(t.openComment){if(z(n)===z(t.openComment)){var i=z(n);this.$str.substr(e).startsWith(i)&&(t.openComment=!1,r.ending=i)}}else{var s=H(n);this.$str.substr(e).startsWith(s)&&(t.openComment=n,r.starting=s)}})),r}_testNesting(t,e){var r={};return(t.options.blocks||[]).forEach((n=>{var i=H(n);if(this.$str.substr(e).startsWith(i))t.nesting=t.nesting.concat([n]),r.starting=i;else if(t.nesting.length&&z(n)===z(z(t.nesting))){var s=z(n);this.$str.substr(e).startsWith(s)&&(t.nesting=t.nesting.slice(0,-1),r.ending=s)}})),t.maxDepth=Math.max(t.maxDepth,t.nesting.length),r}_testChars(t,e,r){for(var n=0;n<t.length;n++){var i=t[n];if(P(i)){var s=i(this.$str.substr(0,r),this.$str.substr(r),e.tokens.slice());if(!1!==s)return s}if(e.options.useRegex){var o=this.$str.substr(r).match(new RegExp("^"+i,!0!==e.options.useRegex?e.options.useRegex:""));if(o)return o[0]}if(!e.options.ci&&this.$str.substr(r,i.length)===i||e.options.ci&&this.$str.substr(r,i.length).toLowerCase()===i.toLowerCase())return i}return!1}_push(t,e,r="tokens",i=!1){var s=t.matches.length;if(n(t.tokens[s])&&(t.tokens[s]=""),"comments"===r){t.tokens[s].comments||(t.tokens[s]=new String(t.tokens[s]),t.tokens[s].comments=[]);var o=t.tokens[s].comments.length-(!t.tokens[s].comments.length||i?0:1);t.tokens[s].comments[o]=(t.tokens[s].comments[o]||"")+e}else t.tokens[s].comments,t.tokens[s]=t.tokens[s]+e}split(t,e,r){return this.lex(e,r).tokens}match(t,e,r){return this.lex(e,r).matches}regParse(t,e){return this.lex(t,L({useRegex:!0},e||{}))}regSplit(t,e){return this.regParse(t,e).tokens}regMatch(t,e){return this.regParse(t,e).matches}}function X(t,e={}){const r=T.call(this);return r.OOHTML||(r.OOHTML={}),r.OOHTML.meta||(r.OOHTML.meta=r.DOM.meta("oohtml",!0)),r.OOHTML.meta.defaults(L(3,t,e)),r.OOHTML.meta}function Y(t){var e=J.split(t.trim(),[":"]);return[t=e.shift(),e.reduce(((t,e)=>{var[r,n]=J.split(e.trim(),[]);return t[r]=W(n,"(",")"),t}),{})]}J.$blocks=[["(",")"],["[","]"],["{","}"]],J.$quotes=['"',"'","`"],J.$comments=[["/*","*/"],["//","\n"]],J.$cache=Object.create(null);const Z=(t,e)=>J.split(t.trim(),["|","+"],{preserveDelims:!0}).reduce(((t,r)=>{var n;return(r.startsWith("|")||r.startsWith("+"))&&(n=r.substr(0,1),r=r.substr(1).trim()),t.theEnd||"|"===n&&t.length?(t.theEnd=!0,t):t.concat(e(r.trim()))}),[]).filter((t=>t)),tt=(t,e,r)=>{const n=t=>t.reduce(((t,e)=>t.concat(...r(e).values())),[]);return Z(e,(e=>{var[e,i]=Y(e);return t.reduce(((t,s)=>{var o=r(s);"*"===e&&(e="("+o.keys().join("+")+")");var l,c=("(",")",(l=e).startsWith("(")&&l.endsWith(")")?tt([s],W(e,"(",")"),r):a(o.get(e),!1)),h=[];return Object.keys(i).forEach((t=>{if("deep"===t||"deepest"===t)for(var o=[s];("deepest"===t||!c.length)&&(o=n(o)).length;){var a=tt(o,`${e}${h.map((t=>`:${t}(${i[t]})`)).join("")}`,r);a.length&&(c=a)}else"having"!==t&&"not-having"!==t||(c=c.filter((e=>{var n=Z(i[t],(t=>r(e,t)));return"not-having"===t?!n.length:n.length}))),h.push(t)})),t.concat(c)}),[])}))},et=function(t,e,r,n=null,i=0){if(!e.length)return[];var s,o=e.shift();o.endsWith(".")&&(s=!0,o=o.substr(0,o.length-1).trim());var a=tt(t,o,r);if(a.length&&s)return a;if(e.length){var l=et(a,e.slice(),r,n,i+1);return-1===l?n(a,i,!0):l}return n?n(a,i):a},rt=["nocompose"],nt=[],it=[];(function r(n=null,i=!1){const s=T.call(this);if(i)return void s.DOM.ready((()=>{r.call(this,n,!1)}));const o=s.window,h=s.window.document,u=s.DOM.mutations,m=[],d=X.call(this,{element:{import:"import"},attr:{importid:"name",exportsearch:"exportsearch"}},n);rt.push(d.get("attr.importid"),d.get("attr.moduleref"));const f="["+o.CSS.escape(d.get("attr.moduleref"))+"]",p="["+o.CSS.escape(d.get("attr.exportgroup"))+"]",g=class{static create(t){return new g(t)}constructor(t){this.el=t;const[e,r]=Y(t.getAttribute(d.get("attr.importid"))||"default");c(this.el,"oohtml").set("importID",e),c(this.el,"oohtml").set("importModifiers",r)}hydrate(t,e,r){c(this.el,"oohtml").set("anchorNode",t),c(this.el,"oohtml").set("slottedElements",e),c(this.el,"oohtml").set("compositionBlock",r),this._bindSlotted(e),this._connectToCompositionBlock()}connectedCallback(){c(this.el,"oohtml").has("anchorNode")||(c(this.el,"oohtml").set("anchorNode",d.get("isomorphic")?h.createComment(this.el.outerHTML):h.createTextNode("")),c(this.el,"oohtml").set("compositionBlock",this.el.hasAttribute(d.get("attr.moduleref"))?this.el.getAttribute(d.get("attr.moduleref")).trim().startsWith("~")?this.el.parentNode.closest(p):null:this.el.parentNode.closest(f)),this._connectToCompositionBlock()),s.DOM.ready.call(s,(()=>{this.resolve()}))}_connectToCompositionBlock(){this.compositionBlock&&c(this.compositionBlock,"oohtml","imports").set(this.importID,this.el)}_bindSlotted(t){t.forEach((t=>{t.importReference=this.el})),c(this.el,"oohtml").set("slottedObserver",u.onRemoved(t,((e,r,n,i,s)=>{s&&s.size===t.length&&c(this.el,"oohtml").get("slottedObserver").disconnect(),e.forEach((t=>{t.parentNode||function(t,e,r=!1){for(var n=t.indexOf(e);n>-1&&(r||!1===r);)t.splice(n,1),r>0&&r--,n=t.indexOf(e)}(this.slottedElements,t),t.importReference===this.el&&delete t.importReference})),this.slottedElements.length||this.anchorNode.isConnected&&this.anchorNode.replaceWith(this.el)}),{maintainCallState:!0,ignoreTransients:!0}))}resolve(){if(!t(m,(t=>this.el.closest(t)))){var r,n;if(this.el.hasAttribute(d.get("attr.moduleref")))this.compositionBlock&&c(this.compositionBlock,"oohtml","imports").get(this.importID)===this.el&&c(this.compositionBlock,"oohtml","imports").delete(this.importID),r=this.el;else{if(!this.compositionBlock)return void console.warn("Scoped slots must be found within template contexts. ["+this.importID+"]",this.el);r=this.compositionBlock}var i=r.getAttribute(d.get("attr.moduleref")).trim(),s=this.el.getAttribute(d.get("attr.exportsearch"));r&&(n=((t,e,r)=>{var n=this.importID,i=this.importModifiers,[s,o]="search"in i||null!==r?("search"in i?i.search:r).split("-").filter((t=>t)).map((t=>parseInt(t||0))).concat([0,1e3]):[0,0];return function(t,e,r,n=null){var i=e.split("#")[0].split("/").map((t=>t.trim())).filter((t=>t));return et(t,i,r,n)}(t,e,(function(t,e){var r=c(t,"oohtml","templates");return 1===arguments.length?r:e.startsWith(":")?c(t,"oohtml","exports").get(e.substr(1)):r.get(e)}),(function(t,e,r){var i=t.reduce(((t,e)=>t.concat(c(e,"oohtml","exports").get(n)||[])),[]);return!i.length&&e>s&&o?(o--,-1):i}))})([i.startsWith("~")?this.compositionBlock:h],i,s)).length?function(t,r,n=null){return e(r)?t.filter((t=>n?r.filter((e=>n(t,e))).length:-1===r.indexOf(t))):[]}(n,c(this.el,"oohtml").get("originalSlottedElements")||[]).length&&(c(this.el,"oohtml").set("originalSlottedElements",n),this.fill(n)):(c(this.el,"oohtml").set("originalSlottedElements",null),this.empty())}}fill(t){t=a(t,!1).map((t=>t.cloneNode(!0))),this.empty(!0),this.el.isConnected&&this.el.replaceWith(this.anchorNode),t.forEach((t=>{c(t,"oohtml","templates").set("~",this.el),function(t,e,r=[],n=!0){if(r=r.concat(rt),t.hasAttribute("noinherit")&&(r=r.concat((t.getAttribute("noinherit")||"*").split(" ").map((t=>t.trim())))),l(it.concat(["role","class"])).forEach((i=>{var s,o;if(!r.includes(i)&&!r.includes("*")&&(s=e.getAttribute(i))){if(o=t.getAttribute(i))var a=n?[o,s]:[s,o];else a=[s];t.setAttribute(i,l(a.join(" ").split(" ").map((t=>t.trim()))).join(" ")),r.push(i)}})),l(nt.concat("style")).forEach((i=>{var s,o;if(!r.includes(i)&&!r.includes("*")&&(s=e.getAttribute(i))){if(o=t.getAttribute(i))(a=n?[o,s]:[s,o])[0].trim().endsWith(";")||(a[0]=a[0]+";");else var a=[s];t.setAttribute(i,a.join(" ")),r.push(i)}})),!r.includes("*"))for(var i=0;i<e.attributes.length;i++){var s=e.attributes[i];r.includes(s.name)||t.hasAttribute(s.name)&&!n||t.setAttribute(s.name,s.value)}}(t,this.el),t.getAttribute(d.get("attr.exportgroup"))||t.setAttribute(d.get("attr.exportgroup"),this.importID),this.anchorNode.before(t)})),this._bindSlotted(t),this.slottedElements.push(...t)}empty(t=!1){if(this.slottedElements){var e=this.slottedElements;t&&c(this.el,"oohtml").has("slottedObserver")&&(c(this.el,"oohtml").get("slottedObserver").disconnect(),e=this.slottedElements.splice(0)),e.forEach((t=>t.remove()))}}get importID(){return c(this.el,"oohtml").get("importID")}get importModifiers(){return c(this.el,"oohtml").get("importModifiers")}get anchorNode(){return c(this.el,"oohtml").get("anchorNode")}get compositionBlock(){return c(this.el,"oohtml").get("compositionBlock")}get slottedElements(){return c(this.el,"oohtml").has("slottedElements")||c(this.el,"oohtml").set("slottedElements",[]),c(this.el,"oohtml").get("slottedElements")}get exports(){return c(this.el,"oohtml").get("exports")}static get observedAttributes(){return[d.get("attr.importid")]}};u.onPresent(d.get("element.import"),(t=>{g.create(t).connectedCallback()}));const b=(t,e)=>{const r=(t,r)=>!e||r===e||!0===e&&(this.importModifiers&&"search"in this.importModifiers||t.getAttribute(d.get("attr.exportsearch")));if(t.matches(d.get("element.import"))){var n=g.create(t);n.connectedCallback(),r(t,n.importID)&&n.resolve()}else c(t,"oohtml","imports").forEach(((t,e)=>{r(t,e)&&g.create(t).resolve()}))};u.onPresent(f,(e=>{t(m,(t=>e.closest(t)))||u.onAttrChange(e,(t=>{t[0].target.getAttribute(t[0].attributeName)!==t[0].oldValue&&b(e)}),[d.get("attr.moduleref"),d.get("attr.importid")])})),h.addEventListener("templatemutation",(t=>{t.detail.path&&a(h.querySelectorAll("["+o.CSS.escape(d.get("attr.moduleref"))+"]")).forEach((e=>{(function(t,e){return e=e.split("#")[0].split("/").map((t=>t.trim())).filter((t=>t)),!!(t=t.split("#")[0].split("/").map((t=>t.trim())).filter((t=>t))).length&&t.reduce(((t,r,n)=>!!t&&J.split(r.trim(),["|","+"]).reduce(((t,r)=>{var[r,i]=Y(r),s=(r=r.trim())===e[n];if(!s&&("deep"in i||"deepest"in i)){var o=e.slice(n+1).reduce(((t,e,n)=>t>-1&&"deep"in i?t:e===r?n:t),-1);o>-1&&(e.splice(n,o+1),s=!0)}return t||s}),!1)),!0)})(e.getAttribute(d.get("attr.moduleref")),t.detail.path)&&(b(e,!0),t.detail.addedExports.concat(t.detail.removedExports).forEach((t=>{b(e,t.name)})))}))})),s.DOM.ready.call(s,(()=>{d.get("isomorphic")&&a(h.querySelectorAll(p)).forEach((t=>{if(!c(t.parentNode,"oohtml").get("importsCan")){var e=[];t.parentNode.childNodes.forEach((t=>{var r;if(1===t.nodeType&&t.matches(p))e.push(t);else if(8===t.nodeType&&(r=t.nodeValue.trim())&&r.startsWith("<"+d.get("element.import"))&&r.endsWith("</"+d.get("element.import")+">")){var n,i=h.createElement("div");if(i.innerHTML=r,(n=i.firstChild).matches(d.get("element.import"))){var s=n.hasAttribute(d.get("attr.moduleref"))?n.getAttribute(d.get("attr.moduleref")).trim().startsWith("~")?t.parentNode.closest(p):null:t.parentNode.closest(f);g.create(n).hydrate(t,e,s),e=[]}}})),c(t.parentNode,"oohtml").set("importsCan",!0)}}))}))}).call(window)})();
1
+ (()=>{"use strict";function t(t,e){return t.reduce(((t,r,n)=>t||e(r,n)),!1)}function e(t){return Array.isArray(t)}function r(t){return t instanceof String||"string"==typeof t&&null!==t}function n(t){return arguments.length&&(void 0===t||void 0===t)}function i(t){return"function"==typeof t}function s(t){return Array.isArray(t)||"object"==typeof t&&t||i(t)}function o(t){return!Array.isArray(t)&&"object"==typeof t&&t}function l(t,i=!0){return e(t)?t:!i&&o(t)?[t]:!1!==t&&0!==t&&function(t){return function(t){return null===t||""===t}(t)||n(t)||!1===t||0===t||s(t)&&!Object.keys(t).length}(t)?[]:function(t){return!r(t)&&!n(t.length)}(t)?Array.prototype.slice.call(t):o(t)?Object.values(t):[t]}function a(t){return t.filter(((t,e,r)=>r.indexOf(t)===e))}function c(t,...e){globalThis.WebQitInternalsRegistry||(globalThis.WebQitInternalsRegistry=new Map);var r,n,i=globalThis.WebQitInternalsRegistry.get(t);if(!i){if(i=new Map,!1===e[0])return i;globalThis.WebQitInternalsRegistry.set(t,i)}for(;r=e.shift();)if((n=i)&&!(i=i.get(r))){if(i=new Map,!1===e[0])return i;n.set(r,i)}return i}function h(t){return!Array.isArray(t)&&"object"==typeof t&&t}function u(){if(!(h(this)&&this.window||"undefined"!=typeof window))throw new Error("A window context is required.");const t=h(this)&&this.window?this.window:window;if(t.WebQit||(t.WebQit={}),!t.WebQit.window){let e,r;Object.defineProperty(t.WebQit,"window",{get:()=>t}),Object.defineProperty(t.WebQit,"vendor",{value:{getName:()=>(e||(e=function(t){if(void 0!==t.InstallTrigger)return"firefox";if(/constructor/i.test(t.HTMLElement)||"[object SafariRemoteNotification]"===(!t.safari||void 0!==t.safari&&t.safari.pushNotification).toString())return"safari";var e=!(!t.chrome||!t.chrome.webstore&&!t.chrome.runtime),r=e&&-1!=t.navigator.userAgent.indexOf("Edg"),n=!!t.opr&&!!t.opr.addons||!!t.opera||t.navigator.userAgent.indexOf(" OPR/")>=0,i=!!t.document.documentMode,s=!i&&!!t.StyleMedia;return(e||n)&&t.CSS,s?"edge":i?"ie":n?"opera":r?"ie-chromium":e?"chrome":"unknown"}(t)),e),getPrefix:()=>(r||(r=function(t){var e=t.getComputedStyle(t.document.documentElement,""),r=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.Olink&&["","o"])[1];return{api:("WebKit|Moz|Ms|O".match(new RegExp("("+r+")","i"))||[])[1],prefix:r,css:"-"+r+"-"}}(t)),r)}})}return t.WebQit}new Map;class m{constructor(t,e=!0){this.window=t,this.async=e,this.readCallbacks=[],this.writeCallbacks=[],this._run()}_run(){this.window.requestAnimationFrame((()=>{this.readCallbacks.forEach(((t,e)=>{t&&!t()&&(this.readCallbacks[e]=null)})),this.writeCallbacks.forEach(((t,e)=>{t&&!t()&&(this.writeCallbacks[e]=null)})),this._run()}))}onread(t,e=!1){if(e)return new Promise(((e,r)=>{!1===this.async?t(e,r):this.readCallbacks.push((()=>{t(e,r)}))}));!1===this.async?t():this.readCallbacks.push(t)}onwrite(t,e=!1){if(e)return new Promise(((e,r)=>{!1===this.async?t(e,r):this.writeCallbacks.push((()=>{t(e,r)}))}));!1===this.async?t():this.writeCallbacks.push(t)}cycle(t,e,r){this.onread((()=>{var n=t(r);if(n){var i=n=>{this.onwrite((()=>{var i=e(n,r);if(i){var s=r=>{this.cycle(t,e,r)};i instanceof Promise?i.then(s):s()}}))};n instanceof Promise?n.then(i):i()}}))}}function d(t){return t instanceof String||"string"==typeof t&&null!==t}function f(t){return Array.isArray(t)}function p(t){return arguments.length&&(void 0===t||void 0===t)}function g(t){return null===t||""===t}function b(t){return"function"==typeof t}function v(t){return Array.isArray(t)||"object"==typeof t&&t||b(t)}function w(t,e=!0){return f(t)?t:!e&&h(t)?[t]:!1!==t&&0!==t&&function(t){return g(t)||p(t)||!1===t||0===t||v(t)&&!Object.keys(t).length}(t)?[]:function(t){return!d(t)&&!p(t.length)}(t)?Array.prototype.slice.call(t):h(t)?Object.values(t):[t]}function y(t){const e=u.call(this);e.DOM.isDOMReady||"complete"===e.window.document.readyState?t(e.window):(e.window.domReadyCallbacks||(e.window.domReadyCallbacks=[],e.window.document.addEventListener("DOMContentLoaded",(()=>{e.DOM.isDOMReady=!0,e.window.domReadyCallbacks.splice(0).forEach((t=>t(e.window)))}),!1)),e.window.domReadyCallbacks.push(t))}class O{constructor(t){this.window=t}onAdded(t,e,r={}){return r.on="added",this.onPresenceChange(t,((t,r,n,i,s)=>{e(t,r,n,i,s)}),r)}onRemoved(t,e,r={}){return r.on="removed",this.onPresenceChange(t,((t,r,n,i,s)=>{e(t,r,n,i,s)}),r)}onPresent(t,e,r={}){y.call(this.window,(()=>{this.window.MutationObserver&&this.onAdded(t,((t,r)=>{t.forEach((t=>e(t,r)))}),r),d(t)?w(this.window.document.querySelectorAll(t)).forEach((t=>e(t,1))):t.parentNode&&e(t,1)}))}onAbsent(t,e,r={}){y.call(this.window,(()=>{this.window.MutationObserver&&onRemoved(t,((t,r)=>{t.forEach((t=>e(t,r)))}),r),d(t)?0===w(this.window.document.querySelectorAll(t)).length&&e(null,0):t.parentNode||e(t,0)}))}onPresenceChange(t,e,r={}){t=w(t,!1);var n=new Set,i=new Set,s=(s,o,l)=>{o&&"removed"===r.on||!o&&"added"===r.on||(s=((t,e)=>(e.$$searchCache||(e.$$searchCache=new Map),t.reduce(((t,n)=>{var i;return e.$$searchCache.has(n)?i=e.$$searchCache.get(n):(i=((t,e)=>{if(e=e.filter((t=>t.matches)),d(t)){var n=e.filter((e=>e.matches(t)));if(!1!==r.observeIndirectMutation&&(n=e.reduce(((e,r)=>e.concat(w(r.querySelectorAll(t)))),n)).length)return n}else{if(e.includes(t))return[t];if(!1!==r.observeIndirectMutation&&e.length)for(var i=t;i=i.parentNode;)if(e.includes(i))return[t]}})(n,e,d(n))||[],e.$$searchCache.set(n,i)),t.concat(i)}),[])))(t,s)).length&&(r.maintainCallState?(s.forEach((t=>{o?(n.add(t),i.delete(t)):(n.delete(t),i.add(t))})),e(s,o,l,n,i)):e(s,o,l))},o=r.context||this.window.document.documentElement;return this._observe(o,((t,e,n,i)=>{r.ignoreTransients||(s(t,0,!0),s(t.concat(e),1,!0),s(e,0,!0)),s(i,0),s(n,1)}))}onAttrChange(t,e,r=[]){var n=new this.window.MutationObserver(e),i={attributes:!0,attributeOldValue:!0};return r&&(i.attributeFilter=r),n.observe(t,i),n}onTreeChange(t,e,r=!1){var n=new this.window.MutationObserver(e),i={childList:!0,subtree:r};return n.observe(t,i),n}onMutation(t,e,r){var n=new this.window.MutationObserver(e);return n.observe(t,r),n}_observe(t,e){if(!k.has(t)){const e=new Set,r=new this.window.MutationObserver((t=>{if(e.size){var r=t.reduce(((t,e)=>t.concat(w(e.addedNodes))),[]),n=t.reduce(((t,e)=>t.concat(w(e.removedNodes))),[]),i=[],s=[];r=new Set(r),n=new Set(n),r.forEach((t=>{n.has(t)&&(n.delete(t),r.delete(t),t.isConnected?i.push(t):s.push(t))})),r=[...r],n=[...n],e.forEach((t=>t(i,s,r,n)))}}));r.observe(t,{childList:!0,subtree:!0}),k.set(t,{callbacks:e,observer:r})}const r=k.get(t);return r.callbacks.add(e),{disconnect(){r.callbacks.delete(e)},reconnect(){r.callbacks.add(e)}}}}const k=new Map;function E(t,e=null,r=!1){const n=u.call(this);if(d(t)){var i;if(t.trim().startsWith("<")){var s=n.window.document.createElement("div");s.innerHTML=t,i=r?w(s.children):s.firstChild}else i=r?w(M.call(this,t,e)):A.call(this,t,e);return i}return t instanceof n.window.Element?r?[t]:t:r?w(t):t}function C(t,e=null){return E.call(this,t,e,!0)}function A(t,e=null,r=!1){const n=u.call(this);e=e||n.window.document;var i,s=r?"querySelectorAll":"querySelector";try{i=e[s](t)}catch(r){try{i=e[s](t.replace(/\:is\(/g,":matches("))}catch(r){try{i=e[s](t.replace(/\:is\(/g,":-webkit-any("))}catch(r){try{i=e[s](t.replace(/\:is\(/g,":-moz-any("))}catch(t){throw t}}}}return i}function M(t,e=null){return A.call(this,t,e,!0)}function $(t){return function(t){return t instanceof Number||"number"==typeof t}(t)||!0!==t&&!1!==t&&null!==t&&""!==t&&!isNaN(1*t)}function x(t){return b(t)||t&&"[object function]"==={}.toString.call(t)}function S(t,e,r={},n={}){e=w(e).slice();for(var i=t;!p(i)&&!g(i)&&e.length;){var s=e.shift();if(!(r.get?r.get(i,s):v(i)?s in i:i[s]))return void(n.exists=!1);i=r.get?r.get(i,s):i[s]}return n.exists=!0,i}function N(t,e,r,n={},i={}){const s=(t,r,n)=>i.set?i.set(t,r,n):($(e[l])&&f(t)?t.push(n):t[r]=n,!0);e=w(e);for(var o=t,l=0;l<e.length;l++){if(!(l<e.length-1))return s(o,e[l],r);if(!o||!v(o)&&!x(o))return!1;var a=S(o,e[l],i);if(!v(a)){if(!1===i.buildTree)return!1;if(a=x(i.buildTree)?i.buildTree(l):$(e[l+1])?[]:{},!s(o,e[l],a))return!1}o=a}}function j(t,e,r=!1,n={}){e=w(e);var i=!1;do{var s=""===(s=e.pop())?0:s,o=t;e.length&&(o=S(t,e,{},n)),(v(o)||x(o))&&(n.has?n.has(o,s):s in o)&&(n.deleteProperty?i=n.deleteProperty(o,s):n.del?i=n.del(o,s):(delete o[s],i=!0))}while(i&&r&&e.length&&(v(o)||x(o))&&!(n.keys?n.keys(o):Object.keys(o)).length);return i}function D(t,e,r={}){var n={};return S(t,e,r,n),n.exists}function _(t,e=!1){const r=u.call(this);var n={};return!(n.el=r.window.document.head.querySelector('meta[name="oohtml"]'))&&e&&(n.el=r.window.document.createElement("meta"),n.el.setAttribute("name",t),r.window.document.head.append(n.el)),n.el&&(n.vars=(n.el.getAttribute("content")||"").split(";").filter((t=>t)).reduce(((t,e)=>{var r=e.split("=").map((t=>t.trim()));return N(t,r[0].split("."),"true"===r[1]||"false"!==r[1]&&($(r[1])?parseInt(r[1]):r[1])),t}),{})),n.get=function(t){return S(this.vars,t.split("."))},n.set=function(t,r=null,n=!1){var i=h(t)?t:{[t]:!0===r?"true":r};if(n=arguments.length<3?r:n,Object.keys(i).forEach((t=>{if(!1===i[t])j(this.vars,t.split("."));else if(h(i[t]))Object.keys(i[t]).forEach((e=>{var r=(t+"."+e).split(".");n&&D(this.vars,r)||N(this.vars,r,i[t][e])}));else{var e=t.split(".");n&&D(this.vars,e)||N(this.vars,e,i[t])}})),e){const t=(e,r)=>Object.keys(r).reduce(((n,i)=>{var s=(e?e+".":"")+i;return h(r[i])?n.push(...t(s,r[i])):n.push(s+"="+r[i]),n}),[]);this.el.setAttribute("content",t("",this.vars).join(";"))}return!0},n.defaults=function(t,e=null){return this.set(t,e,!0)},n}function T(){const t=u.call(this);return t.DOM||(t.DOM={},function(t){!function(t){t.CSS||(t.CSS={}),t.CSS.escape||(t.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}(t),function(t){"isConnected"in t.Node.prototype||Object.defineProperty(t.Node.prototype,"isConnected",{get:function(){return!(this.ownerDocument&&this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}(t),function(t){t.Element.prototype.matches||(t.Element.prototype.matches=t.Element.prototype.matchesSelector||t.Element.prototype.mozMatchesSelector||t.Element.prototype.msMatchesSelector||t.Element.prototype.oMatchesSelector||t.Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),r=e.length;--r>=0&&e.item(r)!==this;);return r>-1})}(t)}(t.window),t.DOM.reflow=new m(t.window),t.DOM.mutations=new O(t.window),t.DOM.meta=_.bind(t.window),t.DOM.query=E.bind(t.window),t.DOM.queryAll=C.bind(t.window),t.DOM.ready=y.bind(t.window)),t}function W(t,e,r){return function(t,e){return function(t,e,r=!1){if(""==e)return t;var n=r?t.lastIndexOf(e):t.indexOf(e);return-1===n?t:t.substr(0,n)}(t,e,!0)}(function(t,e,r=!1){if(""==e)return t;var n=r?t.lastIndexOf(e):t.indexOf(e);return-1===n?"":t.substr(n+e.length)}(t,e),r)}function P(t){return i(t)||t&&"[object function]"==={}.toString.call(t)}function R(t){return t instanceof Number||"number"==typeof t}function I(t){return R(t)||!0!==t&&!1!==t&&null!==t&&""!==t&&!isNaN(1*t)}function q(t,r,n=!1,i=!1,l=!1){var a=0,c=t.shift();if((I(c)||!0===c||!1===c)&&(a=c,c=t.shift()),!t.length)throw new Error("_merge() requires two or more array/objects.");return t.forEach(((t,h)=>{var u,m,d;(s(t)||P(t))&&(n?(u=t,d=[],function(t,r){r=(r=r||Object.prototype)&&!e(r)?[r]:r;var n=[];for(t=t;t&&(!r||r.indexOf(t)<0)&&"default"!==t.name;)n.push(t),t=t?Object.getPrototypeOf(t):null;return n}(u,m).forEach((t=>{!function(t,...e){e.forEach((e=>{t.indexOf(e)<0&&t.push(e)}))}(d,...Object.getOwnPropertyNames(t))})),d):Object.getOwnPropertyNames(t)).forEach((s=>{if(r(s,c,t,h)){var u=c[s],m=t[s];if((e(u)&&e(m)||o(u)&&o(m))&&(!0===a||a>0))c[s]=e(u)&&e(m)?[]:{},q([I(a)?a-1:a,c[s],u,m],r,n,i,l);else if(e(c)&&e(t))i?c[s]=m:c.push(m);else try{l?Object.defineProperty(c,s,Object.getOwnPropertyDescriptor(t,s)):c[s]=t[s]}catch(t){}}}))})),c}function L(...t){return q(t,((t,e,r)=>!0),!1,!1,!1)}const Q=function(t,r=1,n=!0){return!I(r)||r<=0?t:(!e(t)&&o(t)&&n&&(t=Object.values(t)),e(t)?t.reduce(((t,i)=>e(i)||o(i)&&n?t.concat(Q(e(i)?i:Object.values(i),r-1,n)):t.concat(i)),[]):t)},B=Q;function H(t,e=1){var r=0;t.forEach((t=>{r++}));var n=t.slice(t.length-r,e);return arguments.length>1?n:n[0]}function z(t,e=1){return arguments.length>1?H(t.slice().reverse(),e).reverse():H(t.slice().reverse())}function F(t){return o(t)&&Object.getPrototypeOf(t)===Object.prototype}function V(t){return!0===t||!1===t}const U=function(t,r,n=!0,i=1){if(e(t)&&e(r)&&t.length!==r.length)return!n;if(o(t)&&o(r)){var l=Object.keys(t),a=Object.keys(r);if(!l.length&&!a.length)return F(t)&&F(r)?n:t===r===n;if(!U(l,a))return!n}if(i>0&&(e(t)&&e(r)||o(t)&&o(r))){var c=function(t,r,n=!0,i=!0,l=!1,a=!1){if(e(t)&&e(r)){var c=[],h=!0;return t.forEach((t=>{if(h){var u,m,d,f=!1;m=(r,l)=>{(!f||i&&s(t))&&((e(f=n(t,l))&&!f.length||o(f)&&!Object.keys(f).length)&&(f=!1),s(f)&&i&&(t=f))},d=void 0,s(u=r)&&Object.keys(u).forEach(((t,e)=>{!1!==d&&(d=m(I(t)&&parseFloat(t),u[t]))})),s(f)?c.push(i?f:t):V(f)?l&&!f||!l&&f?c.push(t):a&&(h=!1):c.push(f)}})),c}if(o(t)&&o(r))return c={},h=!0,Object.keys(t).forEach((u=>{if(h){var m=n(t[u],r[u]);(e(m)&&!m.length||o(m)&&!Object.keys(m).length)&&(m=!1),s(m)?c[u]=i?m:t[u]:V(m)?l&&!m||!l&&m?c[u]=t[u]:a&&(h=!1):c[u]=m}})),c}(t,r,((t,e)=>U(t,e,n,i-1)),!1,!1,!0);return e(c)?c.length===t.length&&c.length===r.length:o(c)&&o(t)?Object.keys(c).length===Object.keys(t).length&&Object.keys(c).length===Object.keys(r).length:c}return P(n)?n(t,r):R(t)&&R(r)&&isNaN(t)&&isNaN(r)?n:t===r===n},K=U;function G(t,r=[]){return q([{},t],((t,n,i)=>{if(!P(i[t]))return P(r)?r(t):!e(r)||!r.length||r.indexOf(t)>-1}),!1,!1,!1)}class J{static lex(t,e,n={}){if(!r(t+=""))throw new Error("Argument1 must be a string!");var i=t=>({delims:t.delims.slice(),options:G(t.options),nesting:t.nesting.slice(),maxDepth:t.maxDepth,comments:t.comments.slice(),tokens:t.tokens.slice(),matches:t.matches.slice(),matchesi:G(t.matchesi)});if(J.$cache[t]&&!1!==n.cache)for(var s=0;s<J.$cache[t].length;s++){var o=J.$cache[t][s];if(K(o.delims,e))return i(o)}var l=new J(t,n).lex(e);return!1!==n.cache&&(J.$cache[t]=J.$cache[t]||[],J.$cache[t].push(l)),i(l)}static split(t,e,r){return J.lex(t,e,r).tokens}static match(t,e,r){return J.lex(t,e,r).matches}constructor(t,e){if(!r(t))throw new Error("Lexer requires the first argument to be a string.");this.$str=t,this.$options=e||{},this.$options.blocks||(this.$options.blocks=J.$blocks),this.$options.quotes||(this.$options.quotes=J.$quotes),this.$options.comments||(this.$options.comments=J.$comments)}lex(t,e){for(var r={delims:l(t),options:L(!0,{},this.$options,e||{}),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: "+B(r.nesting).join(", "));return r}_evalCharsAt(t,e){if(!(e>=this.$str.length)){var r=1,n={},i={},s={};if(t.openComment||(i=this._testQuotes(t,e)),t.openQuote||(n=this._testComments(t,e)),t.openComment||n.ending)t.nesting.length||s.ending?this._push(t,this.$str[e]):(r=(l=n.starting||n.ending||this.$str[e]).length,this._push(t,l,"comments",n.starting));else if(t.openQuote||i.ending)this._push(t,this.$str[e]);else{if(t.options.limit&&t.matches.length===t.options.limit)return this._push(t,this.$str[e]),e+1;s=this._testNesting(t,e),s=this._testNesting(t,e);var o=this._testChars(t.options.stopChars||[],t,e);if(!t.nesting.length&&!1!==o)return t.options.stopChar=o,void(t.options.stopCharForward=this.$str.substr(e));if(t.delims.length)if(t.nesting.length||s.ending){var l;r=(l=s.starting||s.ending||this.$str[e]).length,this._push(t,l)}else{this._push(t,"");var a=this._testChars(t.delims,t,e);if(!1!==a&&(t.matches.push(a),t.matchesi[e]=a,r=a.length||1,!t.options.preserveDelims)){var c=e+(a.length||1);return c===this.$str.length&&this._push(t,""),c}this._push(t,a||this.$str[e])}else 2===t.nesting.length&&s.starting?(t.matches.push(null),this._push(t,s.starting),r=s.starting.length):!t.nesting.length&&s.ending?(this._push(t,s.ending),r=s.ending.length,t.matches.push(null)):this._push(t,this.$str[e])}return e+r}}_testQuotes(t,e){var r={};return(t.options.quotes||[]).forEach((n=>{this.$str.substr(e,1)===n&&(t.openQuote?n===t.openQuote&&(t.openQuote=!1,r.ending=n):(t.openQuote=n,r.starting=n))})),r}_testComments(t,e){var r={};return(t.options.comments||[]).forEach((n=>{if(t.openComment){if(z(n)===z(t.openComment)){var i=z(n);this.$str.substr(e).startsWith(i)&&(t.openComment=!1,r.ending=i)}}else{var s=H(n);this.$str.substr(e).startsWith(s)&&(t.openComment=n,r.starting=s)}})),r}_testNesting(t,e){var r={};return(t.options.blocks||[]).forEach((n=>{var i=H(n);if(this.$str.substr(e).startsWith(i))t.nesting=t.nesting.concat([n]),r.starting=i;else if(t.nesting.length&&z(n)===z(z(t.nesting))){var s=z(n);this.$str.substr(e).startsWith(s)&&(t.nesting=t.nesting.slice(0,-1),r.ending=s)}})),t.maxDepth=Math.max(t.maxDepth,t.nesting.length),r}_testChars(t,e,r){for(var n=0;n<t.length;n++){var i=t[n];if(P(i)){var s=i(this.$str.substr(0,r),this.$str.substr(r),e.tokens.slice());if(!1!==s)return s}if(e.options.useRegex){var o=this.$str.substr(r).match(new RegExp("^"+i,!0!==e.options.useRegex?e.options.useRegex:""));if(o)return o[0]}if(!e.options.ci&&this.$str.substr(r,i.length)===i||e.options.ci&&this.$str.substr(r,i.length).toLowerCase()===i.toLowerCase())return i}return!1}_push(t,e,r="tokens",i=!1){var s=t.matches.length;if(n(t.tokens[s])&&(t.tokens[s]=""),"comments"===r){t.tokens[s].comments||(t.tokens[s]=new String(t.tokens[s]),t.tokens[s].comments=[]);var o=t.tokens[s].comments.length-(!t.tokens[s].comments.length||i?0:1);t.tokens[s].comments[o]=(t.tokens[s].comments[o]||"")+e}else t.tokens[s].comments,t.tokens[s]=t.tokens[s]+e}split(t,e,r){return this.lex(e,r).tokens}match(t,e,r){return this.lex(e,r).matches}regParse(t,e){return this.lex(t,L({useRegex:!0},e||{}))}regSplit(t,e){return this.regParse(t,e).tokens}regMatch(t,e){return this.regParse(t,e).matches}}function X(t,e={}){const r=T.call(this);return r.OOHTML||(r.OOHTML={}),r.OOHTML.meta||(r.OOHTML.meta=r.DOM.meta("oohtml",!0)),r.OOHTML.meta.defaults(L(3,t,e)),r.OOHTML.meta}function Y(t){var e=J.split(t.trim(),[":"]);return[t=e.shift(),e.reduce(((t,e)=>{var[r,n]=J.split(e.trim(),[]);return t[r]=W(n,"(",")"),t}),{})]}J.$blocks=[["(",")"],["[","]"],["{","}"]],J.$quotes=['"',"'","`"],J.$comments=[["/*","*/"],["//","\n"]],J.$cache=Object.create(null);const Z=(t,e)=>J.split(t.trim(),["|","+"],{preserveDelims:!0}).reduce(((t,r)=>{var n;return(r.startsWith("|")||r.startsWith("+"))&&(n=r.substr(0,1),r=r.substr(1).trim()),t.theEnd||"|"===n&&t.length?(t.theEnd=!0,t):t.concat(e(r.trim()))}),[]).filter((t=>t)),tt=(t,e,r)=>{const n=t=>t.reduce(((t,e)=>t.concat(...r(e).values())),[]);return Z(e,(e=>{var[e,i]=Y(e);return t.reduce(((t,s)=>{var o=r(s);"*"===e&&(e="("+o.keys().join("+")+")");var a,c=("(",")",(a=e).startsWith("(")&&a.endsWith(")")?tt([s],W(e,"(",")"),r):l(o.get(e),!1)),h=[];return Object.keys(i).forEach((t=>{if("deep"===t||"deepest"===t)for(var o=[s];("deepest"===t||!c.length)&&(o=n(o)).length;){var l=tt(o,`${e}${h.map((t=>`:${t}(${i[t]})`)).join("")}`,r);l.length&&(c=l)}else"having"!==t&&"not-having"!==t||(c=c.filter((e=>{var n=Z(i[t],(t=>r(e,t)));return"not-having"===t?!n.length:n.length}))),h.push(t)})),t.concat(c)}),[])}))},et=function(t,e,r,n=null,i=0){if(!e.length)return[];var s,o=e.shift();o.endsWith(".")&&(s=!0,o=o.substr(0,o.length-1).trim());var l=tt(t,o,r);if(l.length&&s)return l;if(e.length){var a=et(l,e.slice(),r,n,i+1);return-1===a?n(l,i,!0):a}return n?n(l,i):l},rt=["nocompose"],nt=[],it=[];(function r(n=null,i=!1){const s=T.call(this);if(i)return void s.DOM.ready((()=>{r.call(this,n,!1)}));const o=s.window,h=s.window.document,u=s.DOM.mutations,m=[],d=X.call(this,{element:{import:"import"},attr:{importid:"name",exportsearch:"exportsearch"}},n);rt.push(d.get("attr.importid"),d.get("attr.moduleref"));const f="["+o.CSS.escape(d.get("attr.moduleref"))+"]",p="["+o.CSS.escape(d.get("attr.exportgroup"))+"]",g=class{static create(t){return c(this.el,"oohtml").get("instance")||new g(t)}constructor(t){this.el=t,c(this.el,"oohtml").set("instance",this);const[e,r]=Y(t.getAttribute(d.get("attr.importid"))||"default");c(this.el,"oohtml").set("importID",e),c(this.el,"oohtml").set("importModifiers",r)}hydrate(t,e,r){c(this.el,"oohtml").set("anchorNode",t),c(this.el,"oohtml").set("slottedElements",e),c(this.el,"oohtml").set("compositionBlock",r),this._bindSlotted(e),this._connectToCompositionBlock()}connectedCallback(){c(this.el,"oohtml").has("anchorNode")||(c(this.el,"oohtml").set("anchorNode",d.get("isomorphic")?h.createComment(this.el.outerHTML):h.createTextNode("")),c(this.el,"oohtml").set("compositionBlock",this.el.hasAttribute(d.get("attr.moduleref"))?this.el.getAttribute(d.get("attr.moduleref")).trim().startsWith("~")?this.el.parentNode.closest(p):null:this.el.parentNode.closest(f)),this._connectToCompositionBlock()),s.DOM.ready.call(s,(()=>{this.resolve()}))}_connectToCompositionBlock(){this.compositionBlock&&c(this.compositionBlock,"oohtml","imports").set(this.importID,this.el)}_bindSlotted(t){t.forEach((t=>{t.importReference=this.el})),c(this.el,"oohtml").set("slottedObserver",u.onRemoved(t,((e,r,n,i,s)=>{s&&s.size===t.length&&c(this.el,"oohtml").get("slottedObserver").disconnect(),e.forEach((t=>{t.parentNode||function(t,e,r=!1){for(var n=t.indexOf(e);n>-1&&(r||!1===r);)t.splice(n,1),r>0&&r--,n=t.indexOf(e)}(this.slottedElements,t),t.importReference===this.el&&delete t.importReference})),this.slottedElements.length||this.anchorNode.isConnected&&this.anchorNode.replaceWith(this.el)}),{maintainCallState:!0,ignoreTransients:!0}))}resolve(){if(!t(m,(t=>this.el.closest(t)))){var r,n;if(this.el.hasAttribute(d.get("attr.moduleref")))this.compositionBlock&&c(this.compositionBlock,"oohtml","imports").get(this.importID)===this.el&&c(this.compositionBlock,"oohtml","imports").delete(this.importID),r=this.el;else{if(!this.compositionBlock)return void console.warn("Scoped slots must be found within template contexts. ["+this.importID+"]",this.el);r=this.compositionBlock}var i=r.getAttribute(d.get("attr.moduleref")).trim(),s=this.el.getAttribute(d.get("attr.exportsearch"));r&&(n=((t,e,r)=>{var n=this.importID,i=this.importModifiers,[s,o]="search"in i||null!==r?("search"in i?i.search:r).split("-").filter((t=>t)).map((t=>parseInt(t||0))).concat([0,1e3]):[0,0];return function(t,e,r,n=null){var i=e.split("#")[0].split("/").map((t=>t.trim())).filter((t=>t));return et(t,i,r,n)}(t,e,(function(t,e){var r=c(t,"oohtml","templates");return 1===arguments.length?r:e.startsWith(":")?c(t,"oohtml","exports").get(e.substr(1)):r.get(e)}),(function(t,e,r){var i=t.reduce(((t,e)=>t.concat(c(e,"oohtml","exports").get(n)||[])),[]);return!i.length&&e>s&&o?(o--,-1):i}))})([i.startsWith("~")?this.compositionBlock:h],i,s)).length?function(t,r,n=null){return e(r)?t.filter((t=>n?r.filter((e=>n(t,e))).length:-1===r.indexOf(t))):[]}(n,c(this.el,"oohtml").get("originalSlottedElements")||[]).length&&(c(this.el,"oohtml").set("originalSlottedElements",n),this.fill(n)):(c(this.el,"oohtml").set("originalSlottedElements",null),this.empty())}}fill(t){t=l(t,!1).map((t=>t.cloneNode(!0))),this.empty(!0),this.el.isConnected&&this.el.replaceWith(this.anchorNode),t.forEach((t=>{c(t,"oohtml","templates").set("~",this.el),function(t,e,r=[],n=!0){if(r=r.concat(rt),t.hasAttribute("noinherit")&&(r=r.concat((t.getAttribute("noinherit")||"*").split(" ").map((t=>t.trim())))),a(it.concat(["role","class"])).forEach((i=>{var s,o;if(!r.includes(i)&&!r.includes("*")&&(s=e.getAttribute(i))){if(o=t.getAttribute(i))var l=n?[o,s]:[s,o];else l=[s];t.setAttribute(i,a(l.join(" ").split(" ").map((t=>t.trim()))).join(" ")),r.push(i)}})),a(nt.concat("style")).forEach((i=>{var s,o;if(!r.includes(i)&&!r.includes("*")&&(s=e.getAttribute(i))){if(o=t.getAttribute(i))(l=n?[o,s]:[s,o])[0].trim().endsWith(";")||(l[0]=l[0]+";");else var l=[s];t.setAttribute(i,l.join(" ")),r.push(i)}})),!r.includes("*"))for(var i=0;i<e.attributes.length;i++){var s=e.attributes[i];r.includes(s.name)||t.hasAttribute(s.name)&&!n||t.setAttribute(s.name,s.value)}}(t,this.el),t.getAttribute(d.get("attr.exportgroup"))||t.setAttribute(d.get("attr.exportgroup"),this.importID),this.anchorNode.before(t)})),this._bindSlotted(t),this.slottedElements.push(...t)}empty(t=!1){if(this.slottedElements){var e=this.slottedElements;t&&c(this.el,"oohtml").has("slottedObserver")&&(c(this.el,"oohtml").get("slottedObserver").disconnect(),e=this.slottedElements.splice(0)),e.forEach((t=>t.remove()))}}get importID(){return c(this.el,"oohtml").get("importID")}get importModifiers(){return c(this.el,"oohtml").get("importModifiers")}get anchorNode(){return c(this.el,"oohtml").get("anchorNode")}get compositionBlock(){return c(this.el,"oohtml").get("compositionBlock")}get slottedElements(){return c(this.el,"oohtml").has("slottedElements")||c(this.el,"oohtml").set("slottedElements",[]),c(this.el,"oohtml").get("slottedElements")}get exports(){return c(this.el,"oohtml").get("exports")}static get observedAttributes(){return[d.get("attr.importid")]}};u.onPresent(d.get("element.import"),(t=>{g.create(t).connectedCallback()}));const b=(t,e)=>{const r=(t,r)=>!e||r===e||!0===e&&(this.importModifiers&&"search"in this.importModifiers||t.getAttribute(d.get("attr.exportsearch")));if(t.matches(d.get("element.import"))){var n=g.create(t);n.connectedCallback(),r(t,n.importID)&&n.resolve()}else c(t,"oohtml","imports").forEach(((t,e)=>{r(t,e)&&g.create(t).resolve()}))};u.onPresent(f,(e=>{t(m,(t=>e.closest(t)))||u.onAttrChange(e,(t=>{t[0].target.getAttribute(t[0].attributeName)!==t[0].oldValue&&b(e)}),[d.get("attr.moduleref"),d.get("attr.importid")])})),h.addEventListener("templatemutation",(t=>{t.detail.path&&l(h.querySelectorAll("["+o.CSS.escape(d.get("attr.moduleref"))+"]")).forEach((e=>{(function(t,e){return e=e.split("#")[0].split("/").map((t=>t.trim())).filter((t=>t)),!!(t=t.split("#")[0].split("/").map((t=>t.trim())).filter((t=>t))).length&&t.reduce(((t,r,n)=>!!t&&J.split(r.trim(),["|","+"]).reduce(((t,r)=>{var[r,i]=Y(r),s=(r=r.trim())===e[n];if(!s&&("deep"in i||"deepest"in i)){var o=e.slice(n+1).reduce(((t,e,n)=>t>-1&&"deep"in i?t:e===r?n:t),-1);o>-1&&(e.splice(n,o+1),s=!0)}return t||s}),!1)),!0)})(e.getAttribute(d.get("attr.moduleref")),t.detail.path)&&(b(e,!0),t.detail.addedExports.concat(t.detail.removedExports).forEach((t=>{b(e,t.name)})))}))})),s.DOM.ready.call(s,(()=>{d.get("isomorphic")&&l(h.querySelectorAll(p)).forEach((t=>{if(!c(t.parentNode,"oohtml").get("importsCan")&&!t.importReference){var e=[];t.parentNode.childNodes.forEach((t=>{var r;if(1===t.nodeType&&t.matches(p))e.push(t);else if(8===t.nodeType&&(r=t.nodeValue.trim())&&r.startsWith("<"+d.get("element.import"))&&r.endsWith("</"+d.get("element.import")+">")){var n,i=h.createElement("div");if(i.innerHTML=r,(n=i.firstChild).matches(d.get("element.import"))){var s=n.hasAttribute(d.get("attr.moduleref"))?n.getAttribute(d.get("attr.moduleref")).trim().startsWith("~")?t.parentNode.closest(p):null:t.parentNode.closest(f);g.create(n).hydrate(t,e,s),e=[]}}})),c(t.parentNode,"oohtml").set("importsCan",!0)}}))}))}).call(window)})();
2
2
  //# sourceMappingURL=html-imports.js.map
Binary file