├── .gitignore ├── README.md ├── dist ├── html-partials.js ├── html-partials.js.map ├── main.js ├── main.js.map ├── scoped-html.js ├── scoped-html.js.map ├── scoped-js.js └── scoped-js.js.map ├── docs ├── 1-scoped-html │ └── README.md ├── 2-scoped-css │ └── README.md ├── 3-scoped-js │ └── README.md ├── 4-html-partials │ └── README.md ├── 5-examples │ ├── README.md │ ├── jquery │ │ └── README.md │ ├── spa │ │ └── README.md │ └── todo │ │ └── README.md ├── README.md ├── bundle.html ├── bundle.json ├── installation │ └── README.md └── logo.png ├── explainer-1.md ├── explainer.md ├── package-lock.json ├── package.json ├── src ├── browser-entry.js ├── html-partials │ ├── browser-entry.js │ ├── index.js │ └── params.js ├── index.js ├── meta.js ├── scoped-css │ ├── browser-entry.js │ ├── index.js │ └── params.js ├── scoped-html │ ├── browser-entry.js │ ├── index.js │ └── params.js └── scoped-js │ ├── Scope.js │ ├── browser-entry.js │ ├── index.js │ └── params.js ├── webpack.config.cjs └── webpack.config.dev.cjs /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | !/.gitignore 3 | node_modules 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CHTML 2 | 3 | 4 | 5 | NPM version 6 | NPM downloads 7 | 8 | 9 | 10 | ### This project has moved to [WebQit/oohtml](https://github.com/webqit/oohtml). 11 | 12 | CHTML is a suite of new DOM features that brings native support for modern UI development paradigms: a component-based architecture, data binding, and reactivity. This lets us build elegant user interfaces using the web platform itself. 13 | 14 | > CHTML is being proposed as a [W3C standard at the Web Platform Incubator Community Group](https://discourse.wicg.io/t/proposal-chtml/4716) based on [this explainer](https://github.com/web-native/chtml/blob/master/explainer.md). 15 | 16 | ## Documentation 17 | 18 | + [Scoped HTML](https://docs.web-native.dev/chtml/scoped-html) - Structure your document as a hierarchy of *scopes* and *subscopes*. 19 | + [Scoped CSS](https://docs.web-native.dev/chtml/scoped-css) - Define styling as part of any element using scoped stylesheets. 20 | + [Scoped JS](https://docs.web-native.dev/chtml/scoped-js) - Define behaviour as part of any element using scoped scripts. 21 | + [HTML Partials](https://docs.web-native.dev/chtml/html-partials) - Define, import, and compose with reusable HTML snippets. 22 | 23 | ## Getting Started 24 | 25 | + [Installation](https://docs.web-native.dev/chtml/installation) - Follow the installation guide to add the CHTML polyfill to your page. 26 | + [Examples](https://docs.web-native.dev/chtml/examples) - Get a head start with these few examples. 27 | 28 | ## Issues 29 | 30 | To report bugs or request features, please submit an [issue](https://github.com/web-native/chtml/issues). 31 | 32 | ## License 33 | 34 | MIT. 35 | -------------------------------------------------------------------------------- /dist/html-partials.js: -------------------------------------------------------------------------------- 1 | !function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=36)}([function(e,t,r){"use strict";var n=r(14);t.a=function(e){return Array.isArray(e)||"object"==typeof e&&e||Object(n.a)(e)}},function(e,t,r){"use strict";t.a=function(e){return Array.isArray(e)}},function(e,t,r){"use strict";var n=r(1),a=r(4),i=r(8),s=r(27),o=r(5);t.a=function(e,t=!0){return Object(n.a)(e)?e:!t&&Object(o.a)(e)?[e]:!1!==e&&0!==e&&Object(s.a)(e)?[]:function(e){return!Object(a.a)(e)&&!Object(i.a)(e.length)}(e)?Array.prototype.slice.call(e):Object(o.a)(e)?Object.values(e):[e]}},function(e,t,r){"use strict";var n=r(14);t.a=function(e){return Object(n.a)(e)||e&&"[object function]"==={}.toString.call(e)}},function(e,t,r){"use strict";t.a=function(e){return e instanceof String||"string"==typeof e&&null!==e}},function(e,t,r){"use strict";t.a=function(e){return!Array.isArray(e)&&"object"==typeof e&&e}},function(e,t,r){"use strict";t.a=function(e){return!0!==e&&!1!==e&&null!==e&&""!==e&&!isNaN(1*e)}},function(e,t,r){"use strict";var n=r(0),a=r(6);t.a=function(e,t){var r=void 0;return Object(n.a)(e)&&Object.keys(e).forEach((n,i)=>{!1!==r&&(r=t(Object(a.a)(n)?parseFloat(n):n,e[n],i))}),r}},function(e,t,r){"use strict";t.a=function(e){return arguments.length&&(void 0===e||void 0===e)}},function(e,t,r){"use strict";t.a=function(e){return e.filter((e,t,r)=>r.indexOf(e)===t)}},function(e,t,r){"use strict";var n=r(21);t.a=function(...e){return Object(n.a)(e,(e,t,r)=>!0,!1,!1,!1)}},function(e,t,r){"use strict";t.a=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)}},function(e,t,r){"use strict";t.a=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)}},function(e,t,r){"use strict";r.d(t,"c",(function(){return o})),r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return u}));var n=r(4),a=r(29),i=r(2),s=r(19);function o(e,t,r,n={}){return n.on="removed",l(e,t,(e,t)=>{r(e,t)},n)}function c(e,t,r,a={}){Object(s.a)(e,()=>{e.MutationObserver&&function(e,t,r,n={}){n.on="added",l(e,t,(e,t)=>{r(e,t)},n)}(e,t,(e,t)=>{e.forEach(e=>r(e,t))},a),Object(n.a)(t)?Object(i.a)(e.document.querySelectorAll(t)).forEach(e=>r(e,1)):t.parentNode&&r(t,1)})}function l(e,t,r,s={}){t=Object(i.a)(t,!1);var o=(e,t)=>{if(t=t.filter(e=>e.matches),Object(n.a)(e)){var r=t.filter(t=>t.matches(e));if(!1!==s.observeIndirectMutation&&(r=t.reduce((t,r)=>t.concat(Object(i.a)(r.querySelectorAll(e))),r)).length)return r}else{if(t.includes(e))return[e];if(!1!==s.observeIndirectMutation&&t.length)for(var a=e;a=a.parentNode;)if(t.includes(a))return[e]}},c=[],l=[],u=s.context||e.document.documentElement,f=new e.MutationObserver(e=>{if(!s.on||"added"===s.on){var u=[];if(t.forEach(t=>{if(Object(n.a)(t))u=e.reduce((e,r)=>e.concat(o(t,Object(i.a)(r.addedNodes))||[]),u);else{var r=e.reduce((e,r)=>e||(o(t,Object(i.a)(r.addedNodes))||[])[0],null);r&&u.push(r)}}),u.length)if(s.onceEach){var b=Object(a.a)(u,c);b.length&&(c.push(...b),r(b,1))}else s.once&&f.disconnect(),r(u,1)}if(!s.on||"removed"===s.on){var p=[];if(t.forEach(t=>{if(Object(n.a)(t))p=e.reduce((e,r)=>e.concat(o(t,Object(i.a)(r.removedNodes))||[]),p);else{var r=e.reduce((e,r)=>e||(o(t,Object(i.a)(r.removedNodes))||[])[0],null);r&&p.push(r)}}),p.length)if(s.onceEach){var h=Object(a.a)(p,l);h.length&&(l.push(...h),r(h,0))}else s.once&&f.disconnect(),r(p,0)}});return f.observe(u,{childList:!0,subtree:!0}),f}function u(e,t,r,n=[]){var a=new e.MutationObserver(r),i={attributes:!0,attributeOldValue:!0};return n&&(i.attributeFilter=n),a.observe(t,i),a}},function(e,t,r){"use strict";t.a=function(e){return"function"==typeof e}},function(e,t,r){"use strict";t.a=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);return e}},function(e,t,r){"use strict";t.a=function(e){return e instanceof Number||"number"==typeof e}},function(e,t,r){"use strict";t.a=function(e){return null===e||""===e}},function(e,t,r){"use strict";t.a=function(e,t){return e.reduce((e,r)=>e||t(r),!1)}},function(e,t,r){"use strict";t.a=function(e,t){e.__readyCallbacks||(e.__readyCallbacks=[]),"complete"===e.document.readyState?t():e.__readyCallbacks.push(t),e.document.addEventListener("DOMContentLoaded",()=>{e.__readyCallbacks.forEach(e=>e()),e.__readyCallbacks.splice(0)},!1)}},function(e,t,r){"use strict";var n=r(14);t.a=function(e){return Object(n.a)(e)&&/^class\s?/.test(Function.prototype.toString.call(e))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(1),a=r(3),i=r(5),s=r(0),o=r(6),c=r(24),l=function(e,t){var r=[];return function(e,t){t=(t=t||Object.prototype)&&!Object(n.a)(t)?[t]:t;var r=[];for(e=e;e&&(!t||t.indexOf(e)<0)&&"default"!==e.name;)r.push(e),e=e?Object.getPrototypeOf(e):null;return r}(e,t).forEach(e=>{Object(c.a)(r,...Object.getOwnPropertyNames(e))}),r};function u(e,t,r=!1,c=!1,f=!0){var b=0,p=e.shift();if((Object(o.a)(p)||!0===p||!1===p)&&(b=p,p=e.shift()),!e.length)throw new Error("_merge() requires two or more array/objects.");return e.forEach((e,h)=>{(Object(s.a)(e)||Object(a.a)(e))&&(r?l(e):Object.getOwnPropertyNames(e)).forEach(a=>{var s=p[a],l=e[a];if((Object(n.a)(s)&&Object(n.a)(l)||Object(i.a)(s)&&Object(i.a)(l))&&(!0===b||b>0))p[a]=Object(n.a)(s)&&Object(n.a)(l)?[]:{},u([Object(o.a)(b)?b-1:b,p[a],s,l],t,r,c,f);else if(t(a,p,e,h))if(Object(n.a)(p)&&Object(n.a)(e))c?p[a]=l:p.push(l);else try{f?Object.defineProperty(p,a,Object.getOwnPropertyDescriptor(e,a)):p[a]=e[a]}catch(e){}})}),p}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(6),a=r(5),i=r(28),s=r(10),o=function(e,t,r=null){return Object(s.a)(e,Object(a.a)(t)?t:Object(i.a)(t,r))};function c(e,t,r=null){if(e.CHTML_META||(e.CHTML_METATag=e.document.querySelector('meta[name="chtml"]'))&&(e.CHTML_META=(e.CHTML_METATag.getAttribute("content")||"").split(";").filter(e=>e).reduce((e,t)=>{var r=t.split("=").map(e=>e.trim());return o(e,r[0],"true"===r[1]||"false"!==r[1]&&(Object(n.a)(r[1])?parseInt(r[1]):r[1]))},{})),3===arguments.length){!1===r?delete e.CHTML_META[t]:e.CHTML_META[t]=!0===r?"true":r;var a=Object.keys(e.CHTML_META).reduce((t,r)=>t+r+"="+e.CHTML_META[r]+";","");return e.CHTML_METATag.setAttribute("content",a),!0}return e.CHTML_META?e.CHTML_META[t]:void 0}},function(e,t,r){"use strict";var n=r(1);t.a=function(e,t,r=null){return Object(n.a)(t)?e.filter(e=>r?t.filter(t=>r(e,t)).length:-1!==t.indexOf(e)):[]}},function(e,t,r){"use strict";t.a=function(e,...t){return t.forEach(t=>{e.indexOf(t)<0&&e.push(t)}),e}},function(e,t,r){"use strict";var n=r(1),a=r(3),i=r(6),s=r(0),o=r(21);t.a=function(e,t=[],r=!0){var c=0;return Object(i.a)(arguments[0])&&Object(s.a)(arguments[1])&&(c=arguments[0],e=arguments[1],t=arguments[2]||[]),Object(o.a)([c,{},e],(e,r,i)=>Object(a.a)(t)?t(e):!Object(n.a)(t)||!t.length||t.indexOf(e)>-1,!1,!1,r)}},function(e,t,r){"use strict";var n=r(2),a=r(4),i=r(1),s=r(16),o=r(5),c=r(0),l=r(3),u=function(e){return typeof e},f=function(e,t,r=null){if(!Object(c.a)(e))throw new Error('Object must be of type subject; "'+u(e)+'" given!');var n;if(!(n=e[t])&&r)try{n=new r(e),Object.defineProperty(e,t,{get:()=>n,set:e=>{if(e!==n)throw new Error('Attempt to overwrite the "'+t+'" special property!')},enumerable:!1})}catch(e){}return n},b=r(15),p=r(23),h=class{constructor(e){this.subject=e,this.fireables=[],this.currentlyFiring=[]}add(e){return this.fireables.push(e),e}forget(e){this.filter(e).forEach(e=>{this.fireables=this.fireables.filter(t=>t!==e)})}filter(e){return this.fireables.filter(t=>{var r=Object(n.a)(t.filter),a=Object(n.a)((t.params||{}).tags),i=Object(n.a)(e.filter),s=Object(n.a)((e.params||{}).tags);return!(e.originalHandler&&t.handler!==e.originalHandler||i.length&&(i.length!==r.length||Object(p.a)(r,i).length!==i.length)||s.length&&(s.length!==a.length||Object(p.a)(a,s).length!==s.length))})}},d=r(24),m=r(18),j=r(11),O=r(8),v=r(17),w=function(e,t,r={},a={}){t=Object(n.a)(t).slice();for(var i=e;!Object(O.a)(i)&&!Object(v.a)(i)&&t.length;){var s=t.shift();if(!(r.get?r.get(i,s):Object(c.a)(i)?s in i:i[s]))return void(a.exists=!1);i=r.get?r.get(i,s):i[s]}return a.exists=!0,i},y=r(28),g=r(6),E=r(20),A=r(25),T=r(9),C=function(e,t,r=null,n={}){if(!e||!Object(c.a)(e))throw new Error('Object must be of type subject; "'+u(e)+'" given!');if(Object(l.a)(t)&&(n=arguments.length>2?r:{},r=t,t=null),r&&!Object(l.a)(r))throw new Error('Handler must be a function; "'+u(r)+'" given!');var a;if(a=z(e,!1))return a.forget({filter:t,originalHandler:r,params:n})},M=r(7),S=r(12),x=class{constructor(e,t){this.subject=e,this.handler=t.handler,this.filter=t.filter,this.params=t.params}disconnect(){this.disconnected=!0}},k=class extends x{fire(e,t,r){return this.disconnected||this.filter&&this.filter!==e.type?t(...Array.prototype.slice.call(arguments,2)):this.handler(e,r,t)}},P=class{constructor(e,t){if(this.subject=e,!t.type)throw new Error("Action type must be given in definition!");Object(M.a)(t,(e,t)=>{Object.defineProperty(this,e,{value:t,enumerable:!0})}),Object.seal(this)}},N=class extends h{add(e){return super.add(new k(this.subject,e))}fire(e,t=null){if(e instanceof P||(e=new P(this.subject,e)),this.currentlyFiring.filter(t=>t.type===e.type&&t.name===e.name).length)return t?t():void 0;this.currentlyFiring.push(e);const r=(n,...a)=>{var i=this.fireables[n];return i?i.fire(e,(...e)=>r(n+1,...e),...a):t?t(...a):a[0]};var n=r(0);return this.currentlyFiring.pop(),n}},_=function(e,t=!0){return f(e,".interceptors",t?N:null)},H=function(e,t){if(!t||!Object(c.a)(t))throw new Error("Target must be of type object!");var r,n=function(r){return arguments.length?r:e?Object.getOwnPropertyNames(t):Object.keys(t)};return(r=_(t,!1))?r.fire({type:e?"ownKeys":"keys"},n):n()},L=function(e){return H(!1,...arguments)};function R(e,t=null,r=!1){if(!e||!Object(c.a)(e))throw new Error("Target must be of type object!");var a=z(e);if(a&&!a.build){a.build=!0;var i=!(t=Object(n.a)(t)).length||t.filter(e=>e.startsWith(".")).length?L(e).filter(e=>-1===e.indexOf(".")):t.map(e=>Object(S.a)(e,".")),s=t.length?t.map(e=>Object(j.a)(e,".")):null;i.forEach(t=>{var n=I(e,t);Object(c.a)(n)&&(F(e,t,n),(s||r)&&R(n,s,r))})}}var B=function(e,t,r=null,n={}){if(!e||!Object(c.a)(e))throw new Error('Object must be of type subject; "'+u(r)+'" given!');if(Object(l.a)(t)&&(n=arguments.length>2?r:{},r=t,t=null),!Object(l.a)(r))throw new Error('Callback must be a function; "'+u(r)+'" given!');var a={filter:t,handler:r,params:n};(a.filter||a.params.subtree)&&R(e,a.filter,a.params.subtree);var i,s=z(e);return a.params.unique&&(i=s.filter({filter:t,params:n})).length?i[0]:s.add(a)},V=class{constructor(e,t){if(this.subject=e,t.originalSubject||(this.originalSubject=e),!("type"in t))throw new Error("Delta type must be given in definition!");if(!("name"in t))throw new Error("Property name must be given in definition!");Object(M.a)(t,(e,t)=>{Object.defineProperty(this,e,{value:t,enumerable:!0})}),this.path||Object.defineProperty(this,"path",{value:t.name,enumerable:!0}),Object.seal(this)}},F=function(e,t,r){var n;B(r,r=>{if(n=z(e,!1)){var a=r.map(r=>{var n={};return Object(M.a)(r,(e,t)=>{"subject"!==e&&"name"!==e&&"path"!==e&&(n[e]=t)}),n.name=t,n.path=t+"."+r.path,n.originalSubject=r.originalSubject,new V(e,n)});return n.fire(a)}},{subtree:!0,unique:!0,tags:[W,t,e]})};const W={};var D=function(e,t,r){C(r,null,null,{tags:[W,t,e]})},q=function(e,...t){var r=t.map(e=>{if(!Object(c.a)(e))throw new Error("Target must be of type object!");return{subject:e,subjectCopy:Object(i.a)(e)?e.slice(0):Object(A.a)(e)}}),n=e(...t);return r.map(e=>{var t,r=Object.keys(e.subjectCopy),n=Object.keys(e.subject),a=[],s=Object(T.a)(r.concat(n)).map(t=>{if((!Object(i.a)(e.subject)||"length"!==t&&".observer"!==t)&&e.subjectCopy[t]!==e.subject[t]){a.push(t);var s={name:t,related:a,buffered:!0};return n.includes(t)?(s.type="set",s.value=e.subject[t],r.includes(t)&&(s.isUpdate=!0)):s.type="del",r.includes(t)&&(s.oldValue=e.subjectCopy[t]),Object(c.a)(e.subjectCopy[t])&&D(e.subject,t,e.subjectCopy[t]),Object(c.a)(e.subject[t])&&F(e.subject,t,e.subject[t]),s}}).filter(e=>e);if(s.length&&(t=z(e.subject,!1)))return t.fire(s)}),n},I=function(e,t,r=!1){if(!e||!Object(c.a)(e))throw new Error("Target must be of type object!");var n,a,s=function(r){return arguments.length?r:Object(i.a)(t)?Object(y.a)(t,e):e[t]};return n=(a=_(e))?a.fire({type:"get",name:t},s):s(),r&&Object(i.a)(e)&&!Object(g.a)(t)&&Object(l.a)(n)&&!Object(E.a)(n)?function(...t){return q(()=>n.apply(e,t),e)}:n},K=class extends x{constructor(e,t){if(super(e,t),this.filterArray=Object(n.a)(this.filter),this.isDynamicFilter=this.filterArray.filter(e=>Object(a.a)(e)&&(e.indexOf("..")>-1||e.startsWith(".")||e.endsWith("."))).length,this.isDynamicFilter&&this.filterArray.length>1)throw new Error('Only one "Dynamic Filter" must be observed at a time! "'+this.filterArray.join(", ")+'" have been bound together.')}fire(e){var t;if(!(this.disconnected||this.params.type&&!Object(m.a)(e,e=>this.params.type===e.type)))if(this.filterArray.length){var r=[];this.filterArray.filter((t,n)=>(t=Object(a.a)(t)?t.replace(/`/g,""):t,r[n]=[],e.filter(e=>{var a=e.path.split("."),i=this.isDynamicFilter?t.split(".").map((e,t)=>e||a[t]||"").join("."):t;return Object(d.a)(r[n],i),(i===e.name||!1!==this.params.suptree&&(i+".").startsWith(e.path+".")||this.params.subtree&&(e.path+".").startsWith(i+"."))&&(!this.isDynamicFilter||!i.split(".").filter(e=>!e).length)}).length)).length&&(t=r,t.reduce((e,t)=>{var r=[];return e.forEach(e=>{Object(n.a)(t).forEach(t=>{var n=e.slice();n.push(t),r.push(n)})}),r},[[]])).forEach(t=>{var r=this.formatChanges(t,e);this.handler(Object(i.a)(this.filter)?r:r[0])})}else this.filter||!this.params.subtree&&e.filter(e=>e.path===e.name).length!==e.length||this.handler(e)}formatChanges(e,t){return!1===this.params.data?[]:e.map(e=>{var r=t.reduce((t,r)=>{if(t)return t;if(e+""==r.path+"")return r;if((e+".").startsWith(r.path+".")){var n=Object(a.a)(e)?Object(j.a)(e,r.path+".").split("."):e;t=new V(r.subject,{type:r.type,name:e});return("del"===r.type||r.isUpdate)&&(t.oldValue=w(r.oldValue,n,{get:I})),"del"!==r.type&&(t.value=w(r.value,n,{get:I})),t}},null);return r||(r=new V(this.subject,{type:"get",name:e,value:w(this.subject,Object(a.a)(e)?e.split("."):e,{get:I})})),r})}},U=class extends h{add(e){return super.add(new K(this.subject,e))}fire(e){return e=Object(n.a)(e,!1).map(e=>e instanceof V?e:new V(this.subject,e)),!this.currentlyFiring.filter(t=>e.filter(e=>t.type===e.type&&t.name===e.name).length).length&&(this.currentlyFiring.push(...e),this.fireables.forEach(t=>{if(e.propagationStopped)return!1;t.fire(e)}),e.forEach(e=>Object(b.a)(this.currentlyFiring,e)),!0)}},z=function(e,t=!0){return f(e,".observers",t?U:null)},G=function(e,t){if(!e||!Object(c.a)(e))throw new Error("Target must be of type object!");var r,n=function(r){return arguments.length?r:t in e};return(r=_(e,!1))?r.fire({type:"has",name:t},n):n()},J=function(e,t,r,l=null,u=null){if(!t||!Object(c.a)(t))throw new Error("Target must be of type object!");Object(o.a)(r)&&(u=l,l=null);var f=_(t,!1),b=z(t,!1);const p=(r,n,i,s)=>{if(Object(a.a)(r)&&-1!==r.indexOf("."))throw new Error("Property names with a dot are not supported!");var o,l="set";e&&(l="def",n=(o=n||{}).value);var u={name:r,type:l,value:n,related:i,detail:s};G(t,r)&&(u.isUpdate=!0,u.oldValue=I(t,r));var p=function(e){return arguments.length?e:(o?Object.defineProperty(t,r,o):t[r]=n,!0)};if(f){var h=o?{type:"def",name:r,descriptor:o,related:i,detail:s}:{type:"set",name:r,value:n,related:i,detail:s};u.success=f.fire(h,p)}else u.success=p();return u.success&&u.value!==u.oldValue&&(Object(c.a)(u.oldValue)&&D(t,r,u.oldValue),Object(c.a)(u.value)&&(F(t,r,u.value),b&&b.build&&R(u.value,null,!0))),u};var h,d=[];Object(i.a)(r)||(Object(a.a)(r)||Object(s.a)(r))&&(h=Object(n.a)(r))?d=h.map(e=>p(e,l,h,u)):Object(o.a)(r)&&(h=Object.keys(r))&&(d=h.map(e=>p(e,r[e],h,u)));var m=d.filter(e=>e.success);return b&&b.fire(m),m.length>0},Q=function(e,t,r=null,n=null){return J(!1,...arguments)},X=function(e,t,r=null){if(!e||!Object(c.a)(e))throw new Error("Target must be of type object!");var i,s=(t=Object(n.a)(t)).map(n=>{if(Object(a.a)(n)&&-1!==n.indexOf("."))throw new Error("Property names with a dot are not supported!");var i={name:n,type:"del",related:t,detail:r};G(e,n)&&(i.oldValue=I(e,n));var s,o=function(t){return arguments.length?t:(delete e[n],!0)};return(s=_(e,!1))?i.success=s.fire({type:"del",name:n,related:t},o):i.success=o(),i.success&&Object(c.a)(i.oldValue)&&D(e,n,i.oldValue),i}).filter(e=>e.success);return(i=z(e,!1))&&i.fire(s),s.length>0},Y=function(e,t,r=null,n=null){return J(!0,...arguments)},Z=function(e){return H(!0,...arguments)};const $=X,ee=Y;t.a={set:Q,get:I,has:G,deleteProperty:X,del:$,defineProperty:Y,def:ee,keys:L,ownKeys:Z,intercept:function(e,t,r,n={}){if(!Object(c.a)(e))throw new Error('Object must be of type subject; "'+u(r)+'" given!');if(Object(l.a)(t)&&(n=arguments.length>2?r:{},r=t,t=null),!Object(l.a)(r))throw new Error('Callback must be a function; "'+u(r)+'" given!');var a,i=_(e),s={filter:t,handler:r,params:n};return s.params.unique&&(a=i.filter(s)).length?a[0]:i.add(s)},unintercept:function(e,t,r=null,n={}){if(!e||!Object(c.a)(e))throw new Error('Object must be of type subject; "'+u(e)+'" given!');if(Object(l.a)(t)&&(n=arguments.length>2?r:{},r=t,t=null),r&&!Object(l.a)(r))throw new Error('Handler must be a function; "'+u(r)+'" given!');var a;if(a=_(e,!1))return a.forget({filter:t,originalHandler:r,params:n})},proxy:function(e){if(!Object(c.a)(e))throw new Error('Object must be of type subject; "'+u(e)+'" given!');var t=new Proxy(e,{get:(e,r)=>{var n=I(e,r);return Object(l.a)(n)&&!Object(E.a)(n)?n.bind(t):n},set:Q,has:G,deleteProperty:X,defineProperty:Y,ownKeys:Z});return t},observe:B,unobserve:C,closure:q,init:function(e,t){Object(n.a)(t).forEach(t=>{var r,n,a=e[t],i=Object.getOwnPropertyDescriptor(e,t)||{enumerable:!(t in e)};"value"in i&&delete i.value,"writable"in i&&delete i.writable,i.get=()=>{if(r)return a;r=!0;var n=I(e,t);return r=!1,n},i.set=r=>{if(n)return a=r,!0;n=!0;Q(e,t,r);return n=!1,!0},Object.defineProperty(e,t,i)})},build:R,link:F,unlink:D}},function(e,t,r){"use strict";var n=r(17),a=r(8),i=r(0);t.a=function(e){return Object(n.a)(e)||Object(a.a)(e)||!1===e||0===e||Object(i.a)(e)&&!Object.keys(e).length}},function(e,t,r){"use strict";var n=r(1);r(4);t.a=function(e,t=null){var r={};return 2===arguments.length&&(Object(n.a)(e)&&Object(n.a)(t)?e.forEach((e,n)=>r[e]=t[n]):r[e]=t),r}},function(e,t,r){"use strict";var n=r(1);t.a=function(e,t,r=null){return Object(n.a)(t)?e.filter(e=>r?t.filter(t=>r(e,t)).length:-1===t.indexOf(e)):[]}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return d}));var n=r(26),a=r(19),i=r(13),s=r(27),o=r(18),c=r(2),l=r(15),u=r(9),f=r(7),b=r(10),p=r(22),h={bundleElement:"partials-bundle",templateElement:"template",templateNamespaceAttribute:"name",slotReferenceAttribute:"partials-slot",templateReferenceAttribute:"template",slotElement:"partials-slot",slotNameAttribute:"name",itemsBindingMethod:"partialsItemize",itemIndexAttribute:"partials-index",keyValAttributes:[],listAttributes:[],inertContexts:["template"],inertSubjects:[],noinheritAttributes:["nocompose","name","template"],recomposeCallback:null};class d{constructor(e,t=n.a,r={}){const u=this;u.window=e,u.trap=t,u.params=Object(b.a)({},h,r);const d=e=>(e[".chtml"]||(e[".chtml"]={}),e[".chtml"]);if("templates"in u.window.document)throw new Error('document already has a "templates" property!');const m=[];Object.defineProperty(u.window.document,"templates",{value:{}}),Object.defineProperty(u.window.document,"templatesReadyState",{value:"loading",writable:!0});const j=e=>{var t=e.getAttribute(u.params.templateNamespaceAttribute);u.trap.set(u.window.document.templates,t,e)};Object(i.b)(u.window,"template["+u.window.CSS.escape(u.params.templateNamespaceAttribute)+"]",e=>{const t=()=>{var t=e.getAttribute("src");return new Promise((r,n)=>{u.window.fetch?u.window.fetch(t).then(e=>e.ok?e.text():Promise.reject(e.statusText)).then(t=>{e.innerHTML=t,j(e),e.dispatchEvent(new u.window.Event("load")),r(e)}).catch(n=>{e.innerHTML="",j(e),e.dispatchEvent(new u.window.Event("loaderror")),r(e),console.error("Error fetching the bundle at "+t+". ("+n+")")}):(r(e),console.error("Error fetching the bundle at "+t+". (window.fetch() not supported by browser.)"))})};Object(i.a)(u.window,e,e=>{t()},["src"]),Object(i.a)(u.window,e,t=>{u.window.document.templates[t[0].oldValue]===e&&u.trap.deleteProperty(u.window.document.templates,t[0].oldValue),j(e)},[u.params.templateNamespaceAttribute]),Object(i.c)(u.window,e,t=>{var r=e.getAttribute(u.params.templateNamespaceAttribute);u.window.document.templates[r]===e&&u.trap.deleteProperty(u.window.document.templates,r)},{once:!0}),e.getAttribute("src")&&!e.content.children.length?m.push(t()):j(e)});const O=e=>{(Object(s.a)(d(e).partials)||e.closest("[live]"))&&(d(e).templates={},d(e).partials={},Object(c.a)((e.content||e).children).forEach(t=>{var r;if(t instanceof u.window.HTMLTemplateElement&&(r=t.getAttribute(u.params.templateNamespaceAttribute)))d(e).templates[r]=t;else{var n=t.getAttribute(u.params.slotReferenceAttribute)||"default";d(e).partials[n]||(d(e).partials[n]=[]),d(e).partials[n].push(t)}}))};if("templates"in u.window.HTMLTemplateElement.prototype)throw new Error('The "HTMLTemplateElement" class already has a "templates" property!');if(Object.defineProperty(u.window.HTMLTemplateElement.prototype,"templates",{get:function(){return O(this),d(this).templates}}),"partials"in u.window.HTMLTemplateElement.prototype)throw new Error('The "HTMLTemplateElement" class already has a "partials" property!');if(Object.defineProperty(u.window.HTMLTemplateElement.prototype,"partials",{get:function(){return O(this),d(this).partials}}),"template"in u.window.Element.prototype)throw new Error('The "Element" class already has a "template" property!');Object.defineProperty(u.window.Element.prototype,"template",{get:function(){var e=this.getAttribute(u.params.templateReferenceAttribute);if(e){if(d(this).templates||(d(this).templates={}),!d(this).templates[e]||!this.hasAttribute("cache-template")){var t=e.split("/").filter(e=>e).reduce((e,t)=>e?e.templates[t]||e.templates["*"]:null,u.window.document);d(this).templates[e]=t}return d(this).templates[e]}}}),Object(i.b)(u.window,"["+u.window.CSS.escape(u.params.templateReferenceAttribute)+"]",e=>{var t=u.params.inertContexts.concat(u.params.inertSubjects);if(!Object(o.a)(t,t=>e.closest(t))){var r=()=>{Object(f.a)(d(e).slots,(e,t)=>{t.resolve()})};Object(i.a)(u.window,e,r,[u.params.templateReferenceAttribute]),u.trap.observe(u.window.document.templates,t=>{var n=e.getAttribute(u.params.templateReferenceAttribute);t.forEach(e=>{(n===e.value||n.startsWith(e.value+"/"))&&r()})})}}),u.window.customElements.define(u.params.slotElement,class extends u.window.HTMLElement{hydrate(e,t,r){this.anchorNode=e,d(this).slottedElements=t,d(this).compositionBlock=r,this._bindSlotted(t),this._connectToCompositionBlock()}connectedCallback(){this.anchorNode||(this.anchorNode=Object(p.a)(u.window,"isomorphic")?u.window.document.createComment(this.outerHTML):u.window.document.createTextNode(""),this.after(this.anchorNode),d(this).compositionBlock=this.hasAttribute(u.params.templateReferenceAttribute)?null:this.parentNode.closest("["+u.window.CSS.escape(u.params.templateReferenceAttribute)+"]"),this._connectToCompositionBlock(),Object(a.a)(u.window,()=>{Promise.all(m).then(()=>{this.resolve()})}))}_connectToCompositionBlock(){this.compositionBlock&&(d(this.compositionBlock).slots||(d(this.compositionBlock).slots={}),d(this.compositionBlock).slots[this.name]=this)}_bindSlotted(e){e.forEach(e=>{e.slotReference=this}),d(this).slottedObserver=Object(i.c)(u.window,e,e=>{e.forEach(e=>{e.parentNode||Object(l.a)(this.slottedElements,e),e.slotReference===this&&delete e.slotReference}),this.slottedElements.length||this.anchorNode.before(this)},{onceEach:!0})}resolve(){if(!Object(o.a)(u.params.inertContexts,e=>this.closest(e))){var e,t;if(this.hasAttribute(u.params.templateReferenceAttribute))this.compositionBlock&&d(this.compositionBlock).slots[this.name]===this&&delete d(this.compositionBlock).slots[this.name],(e=this.template)&&(t=e.partials[this.name]);else{if(!this.compositionBlock)return void console.warn("Scoped slots must be found within template contexts. ["+this.name+"]",this);(e=this.compositionBlock.template)&&(t=e.partials[this.name])}e?this.fill(t):this.empty()}}fill(e){e=Object(c.a)(e,!1).map(e=>e.cloneNode(!0)),this.empty(!0),this.remove(),e.forEach(e=>{"@slot"===e.getAttribute(u.params.templateReferenceAttribute)&&(d(e).templates||(d(e).templates={}),d(e).templates["@slot"]=this),u.mergeAttributes(e,this),e.getAttribute(u.params.slotReferenceAttribute)||e.setAttribute(u.params.slotReferenceAttribute,this.name),this.anchorNode.before(e)}),this._bindSlotted(e),this.slottedElements.push(...e)}empty(e=!1){if(this.slottedElements){var t=this.slottedElements;e&&this.slottedObserver&&(this.slottedObserver.disconnect(),t=this.slottedElements.splice(0)),t.forEach(e=>e.remove())}}get name(){return this.getAttribute(u.params.slotNameAttribute)||"default"}get compositionBlock(){return d(this).compositionBlock}get slottedElements(){return d(this).slottedElements||(d(this).slottedElements=[]),d(this).slottedElements}get partials(){return O(this),d(this).partials}static get observedAttributes(){return[u.params.slotNameAttribute]}});m.forEach(e=>{e.catch(e=>{console.warn(e)})}),Object(a.a)(u.window,()=>{Promise.all(m).then(()=>{u.window.document.templatesReadyState="complete",u.window.document.dispatchEvent(new u.window.Event("templatesreadystatechange"))}),Object(p.a)(u.window,"isomorphic")&&Object(c.a)(u.window.document.querySelectorAll("["+u.window.CSS.escape(u.params.slotReferenceAttribute)+"]")).forEach(e=>{if(!d(e.parentNode).slotsCan){var t=[];e.parentNode.childNodes.forEach(e=>{var r;if(1===e.nodeType&&e.matches("["+u.window.CSS.escape(u.params.slotReferenceAttribute)+"]"))t.push(e);else if(8===e.nodeType&&(r=e.nodeValue.trim())&&r.startsWith("<"+u.params.slotElement)&&r.endsWith("")){var n,a,i=u.window.document.createElement("div");i.innerHTML=r,(n=i.firstChild).matches(u.params.slotElement)&&(n.hasAttribute(u.params.templateReferenceAttribute)||(a=e.parentNode.closest("["+u.window.CSS.escape(u.params.templateReferenceAttribute)+"]")),n.hydrate(e,t,a),t=[])}}),d(e.parentNode).slotsCan=!0}})})}mergePartials(e,t,r=[]){return t.partialsSlottables?(Object(f.a)(t.partialsSlottables,(t,n)=>{if(e.partialsSlottables&&e.partialsSlottables[t]){var a=r.concat((e.getAttribute("noinherit")||"").split(" ").map(e=>e.trim()));this.mergeAttributes(e.partialsSlottables[t],n,a,!1)}else e.append(n.clone(!0))}),e):e}mergeAttributes(e,t,r=[],n=!0){r=r.concat(this.params.noinheritAttributes),e.hasAttribute("noinherit")&&(r=r.concat((e.getAttribute("noinherit")||"*").split(" ").map(e=>e.trim())));var a=this.params.listAttributes.concat(["role","class"]);if(Object(u.a)(a).forEach(a=>{var i,s;if(!r.includes(a)&&!r.includes("*")&&(i=t.getAttribute(a))){if(s=e.getAttribute(a))var o=n?[s,i]:[i,s];else o=[i];e.setAttribute(a,Object(u.a)(o.join(" ").split(" ").map(e=>e.trim())).join(" ")),r.push(a)}}),Object(u.a)(this.params.keyValAttributes.concat("style")).forEach(a=>{var i,s;if(!r.includes(a)&&!r.includes("*")&&(i=t.getAttribute(a))){if(s=e.getAttribute(a))(o=n?[s,i]:[i,s])[0].trim().endsWith(";")||(o[0]=o[0]+";");else var o=[i];e.setAttribute(a,o.join(" ")),r.push(a)}}),!r.includes("*"))for(var i=0;i{!1!==r&&(r=t(Object(a.a)(n)?parseFloat(n):n,e[n],i))}),r}},function(e,t,r){"use strict";t.a=function(e){return arguments.length&&(void 0===e||void 0===e)}},function(e,t,r){"use strict";t.a=function(e){return e.filter((e,t,r)=>r.indexOf(e)===t)}},function(e,t,r){"use strict";var n=r(21);t.a=function(...e){return Object(n.a)(e,(e,t,r)=>!0,!1,!1,!1)}},function(e,t,r){"use strict";t.a=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)}},function(e,t,r){"use strict";t.a=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)}},function(e,t,r){"use strict";r.d(t,"c",(function(){return u})),r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return l}));var n=r(4),a=r(29),i=r(2),c=r(19);function u(e,t,r,n={}){return n.on="removed",o(e,t,(e,t)=>{r(e,t)},n)}function s(e,t,r,a={}){Object(c.a)(e,()=>{e.MutationObserver&&function(e,t,r,n={}){n.on="added",o(e,t,(e,t)=>{r(e,t)},n)}(e,t,(e,t)=>{e.forEach(e=>r(e,t))},a),Object(n.a)(t)?Object(i.a)(e.document.querySelectorAll(t)).forEach(e=>r(e,1)):t.parentNode&&r(t,1)})}function o(e,t,r,c={}){t=Object(i.a)(t,!1);var u=(e,t)=>{if(t=t.filter(e=>e.matches),Object(n.a)(e)){var r=t.filter(t=>t.matches(e));if(!1!==c.observeIndirectMutation&&(r=t.reduce((t,r)=>t.concat(Object(i.a)(r.querySelectorAll(e))),r)).length)return r}else{if(t.includes(e))return[e];if(!1!==c.observeIndirectMutation&&t.length)for(var a=e;a=a.parentNode;)if(t.includes(a))return[e]}},s=[],o=[],l=c.context||e.document.documentElement,f=new e.MutationObserver(e=>{if(!c.on||"added"===c.on){var l=[];if(t.forEach(t=>{if(Object(n.a)(t))l=e.reduce((e,r)=>e.concat(u(t,Object(i.a)(r.addedNodes))||[]),l);else{var r=e.reduce((e,r)=>e||(u(t,Object(i.a)(r.addedNodes))||[])[0],null);r&&l.push(r)}}),l.length)if(c.onceEach){var b=Object(a.a)(l,s);b.length&&(s.push(...b),r(b,1))}else c.once&&f.disconnect(),r(l,1)}if(!c.on||"removed"===c.on){var p=[];if(t.forEach(t=>{if(Object(n.a)(t))p=e.reduce((e,r)=>e.concat(u(t,Object(i.a)(r.removedNodes))||[]),p);else{var r=e.reduce((e,r)=>e||(u(t,Object(i.a)(r.removedNodes))||[])[0],null);r&&p.push(r)}}),p.length)if(c.onceEach){var h=Object(a.a)(p,o);h.length&&(o.push(...h),r(h,0))}else c.once&&f.disconnect(),r(p,0)}});return f.observe(l,{childList:!0,subtree:!0}),f}function l(e,t,r,n=[]){var a=new e.MutationObserver(r),i={attributes:!0,attributeOldValue:!0};return n&&(i.attributeFilter=n),a.observe(t,i),a}},function(e,t,r){"use strict";t.a=function(e){return"function"==typeof e}},function(e,t,r){"use strict";t.a=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);return e}},function(e,t,r){"use strict";t.a=function(e){return e instanceof Number||"number"==typeof e}},function(e,t,r){"use strict";t.a=function(e){return null===e||""===e}},function(e,t,r){"use strict";t.a=function(e,t){return e.reduce((e,r)=>e||t(r),!1)}},function(e,t,r){"use strict";t.a=function(e,t){e.__readyCallbacks||(e.__readyCallbacks=[]),"complete"===e.document.readyState?t():e.__readyCallbacks.push(t),e.document.addEventListener("DOMContentLoaded",()=>{e.__readyCallbacks.forEach(e=>e()),e.__readyCallbacks.splice(0)},!1)}},function(e,t,r){"use strict";var n=r(14);t.a=function(e){return Object(n.a)(e)&&/^class\s?/.test(Function.prototype.toString.call(e))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(1),a=r(3),i=r(5),c=r(0),u=r(6),s=r(24),o=function(e,t){var r=[];return function(e,t){t=(t=t||Object.prototype)&&!Object(n.a)(t)?[t]:t;var r=[];for(e=e;e&&(!t||t.indexOf(e)<0)&&"default"!==e.name;)r.push(e),e=e?Object.getPrototypeOf(e):null;return r}(e,t).forEach(e=>{Object(s.a)(r,...Object.getOwnPropertyNames(e))}),r};function l(e,t,r=!1,s=!1,f=!0){var b=0,p=e.shift();if((Object(u.a)(p)||!0===p||!1===p)&&(b=p,p=e.shift()),!e.length)throw new Error("_merge() requires two or more array/objects.");return e.forEach((e,h)=>{(Object(c.a)(e)||Object(a.a)(e))&&(r?o(e):Object.getOwnPropertyNames(e)).forEach(a=>{var c=p[a],o=e[a];if((Object(n.a)(c)&&Object(n.a)(o)||Object(i.a)(c)&&Object(i.a)(o))&&(!0===b||b>0))p[a]=Object(n.a)(c)&&Object(n.a)(o)?[]:{},l([Object(u.a)(b)?b-1:b,p[a],c,o],t,r,s,f);else if(t(a,p,e,h))if(Object(n.a)(p)&&Object(n.a)(e))s?p[a]=o:p.push(o);else try{f?Object.defineProperty(p,a,Object.getOwnPropertyDescriptor(e,a)):p[a]=e[a]}catch(e){}})}),p}},,function(e,t,r){"use strict";var n=r(1);t.a=function(e,t,r=null){return Object(n.a)(t)?e.filter(e=>r?t.filter(t=>r(e,t)).length:-1!==t.indexOf(e)):[]}},function(e,t,r){"use strict";t.a=function(e,...t){return t.forEach(t=>{e.indexOf(t)<0&&e.push(t)}),e}},function(e,t,r){"use strict";var n=r(1),a=r(3),i=r(6),c=r(0),u=r(21);t.a=function(e,t=[],r=!0){var s=0;return Object(i.a)(arguments[0])&&Object(c.a)(arguments[1])&&(s=arguments[0],e=arguments[1],t=arguments[2]||[]),Object(u.a)([s,{},e],(e,r,i)=>Object(a.a)(t)?t(e):!Object(n.a)(t)||!t.length||t.indexOf(e)>-1,!1,!1,r)}},function(e,t,r){"use strict";var n=r(2),a=r(4),i=r(1),c=r(16),u=r(5),s=r(0),o=r(3),l=function(e){return typeof e},f=function(e,t,r=null){if(!Object(s.a)(e))throw new Error('Object must be of type subject; "'+l(e)+'" given!');var n;if(!(n=e[t])&&r)try{n=new r(e),Object.defineProperty(e,t,{get:()=>n,set:e=>{if(e!==n)throw new Error('Attempt to overwrite the "'+t+'" special property!')},enumerable:!1})}catch(e){}return n},b=r(15),p=r(23),h=class{constructor(e){this.subject=e,this.fireables=[],this.currentlyFiring=[]}add(e){return this.fireables.push(e),e}forget(e){this.filter(e).forEach(e=>{this.fireables=this.fireables.filter(t=>t!==e)})}filter(e){return this.fireables.filter(t=>{var r=Object(n.a)(t.filter),a=Object(n.a)((t.params||{}).tags),i=Object(n.a)(e.filter),c=Object(n.a)((e.params||{}).tags);return!(e.originalHandler&&t.handler!==e.originalHandler||i.length&&(i.length!==r.length||Object(p.a)(r,i).length!==i.length)||c.length&&(c.length!==a.length||Object(p.a)(a,c).length!==c.length))})}},d=r(24),j=r(18),O=r(11),y=r(8),m=r(17),v=function(e,t,r={},a={}){t=Object(n.a)(t).slice();for(var i=e;!Object(y.a)(i)&&!Object(m.a)(i)&&t.length;){var c=t.shift();if(!(r.get?r.get(i,c):Object(s.a)(i)?c in i:i[c]))return void(a.exists=!1);i=r.get?r.get(i,c):i[c]}return a.exists=!0,i},g=r(28),w=r(6),E=r(20),P=r(25),x=r(9),A=function(e,t,r=null,n={}){if(!e||!Object(s.a)(e))throw new Error('Object must be of type subject; "'+l(e)+'" given!');if(Object(o.a)(t)&&(n=arguments.length>2?r:{},r=t,t=null),r&&!Object(o.a)(r))throw new Error('Handler must be a function; "'+l(r)+'" given!');var a;if(a=G(e,!1))return a.forget({filter:t,originalHandler:r,params:n})},S=r(7),C=r(12),k=class{constructor(e,t){this.subject=e,this.handler=t.handler,this.filter=t.filter,this.params=t.params}disconnect(){this.disconnected=!0}},N=class extends k{fire(e,t,r){return this.disconnected||this.filter&&this.filter!==e.type?t(...Array.prototype.slice.call(arguments,2)):this.handler(e,r,t)}},_=class{constructor(e,t){if(this.subject=e,!t.type)throw new Error("Action type must be given in definition!");Object(S.a)(t,(e,t)=>{Object.defineProperty(this,e,{value:t,enumerable:!0})}),Object.seal(this)}},F=class extends h{add(e){return super.add(new N(this.subject,e))}fire(e,t=null){if(e instanceof _||(e=new _(this.subject,e)),this.currentlyFiring.filter(t=>t.type===e.type&&t.name===e.name).length)return t?t():void 0;this.currentlyFiring.push(e);const r=(n,...a)=>{var i=this.fireables[n];return i?i.fire(e,(...e)=>r(n+1,...e),...a):t?t(...a):a[0]};var n=r(0);return this.currentlyFiring.pop(),n}},T=function(e,t=!0){return f(e,".interceptors",t?F:null)},M=function(e,t){if(!t||!Object(s.a)(t))throw new Error("Target must be of type object!");var r,n=function(r){return arguments.length?r:e?Object.getOwnPropertyNames(t):Object.keys(t)};return(r=T(t,!1))?r.fire({type:e?"ownKeys":"keys"},n):n()},V=function(e){return M(!1,...arguments)};function D(e,t=null,r=!1){if(!e||!Object(s.a)(e))throw new Error("Target must be of type object!");var a=G(e);if(a&&!a.build){a.build=!0;var i=!(t=Object(n.a)(t)).length||t.filter(e=>e.startsWith(".")).length?V(e).filter(e=>-1===e.indexOf(".")):t.map(e=>Object(C.a)(e,".")),c=t.length?t.map(e=>Object(O.a)(e,".")):null;i.forEach(t=>{var n=U(e,t);Object(s.a)(n)&&(q(e,t,n),(c||r)&&D(n,c,r))})}}var H=function(e,t,r=null,n={}){if(!e||!Object(s.a)(e))throw new Error('Object must be of type subject; "'+l(r)+'" given!');if(Object(o.a)(t)&&(n=arguments.length>2?r:{},r=t,t=null),!Object(o.a)(r))throw new Error('Callback must be a function; "'+l(r)+'" given!');var a={filter:t,handler:r,params:n};(a.filter||a.params.subtree)&&D(e,a.filter,a.params.subtree);var i,c=G(e);return a.params.unique&&(i=c.filter({filter:t,params:n})).length?i[0]:c.add(a)},I=class{constructor(e,t){if(this.subject=e,t.originalSubject||(this.originalSubject=e),!("type"in t))throw new Error("Delta type must be given in definition!");if(!("name"in t))throw new Error("Property name must be given in definition!");Object(S.a)(t,(e,t)=>{Object.defineProperty(this,e,{value:t,enumerable:!0})}),this.path||Object.defineProperty(this,"path",{value:t.name,enumerable:!0}),Object.seal(this)}},q=function(e,t,r){var n;H(r,r=>{if(n=G(e,!1)){var a=r.map(r=>{var n={};return Object(S.a)(r,(e,t)=>{"subject"!==e&&"name"!==e&&"path"!==e&&(n[e]=t)}),n.name=t,n.path=t+"."+r.path,n.originalSubject=r.originalSubject,new I(e,n)});return n.fire(a)}},{subtree:!0,unique:!0,tags:[L,t,e]})};const L={};var W=function(e,t,r){A(r,null,null,{tags:[L,t,e]})},K=function(e,...t){var r=t.map(e=>{if(!Object(s.a)(e))throw new Error("Target must be of type object!");return{subject:e,subjectCopy:Object(i.a)(e)?e.slice(0):Object(P.a)(e)}}),n=e(...t);return r.map(e=>{var t,r=Object.keys(e.subjectCopy),n=Object.keys(e.subject),a=[],c=Object(x.a)(r.concat(n)).map(t=>{if((!Object(i.a)(e.subject)||"length"!==t&&".observer"!==t)&&e.subjectCopy[t]!==e.subject[t]){a.push(t);var c={name:t,related:a,buffered:!0};return n.includes(t)?(c.type="set",c.value=e.subject[t],r.includes(t)&&(c.isUpdate=!0)):c.type="del",r.includes(t)&&(c.oldValue=e.subjectCopy[t]),Object(s.a)(e.subjectCopy[t])&&W(e.subject,t,e.subjectCopy[t]),Object(s.a)(e.subject[t])&&q(e.subject,t,e.subject[t]),c}}).filter(e=>e);if(c.length&&(t=G(e.subject,!1)))return t.fire(c)}),n},U=function(e,t,r=!1){if(!e||!Object(s.a)(e))throw new Error("Target must be of type object!");var n,a,c=function(r){return arguments.length?r:Object(i.a)(t)?Object(g.a)(t,e):e[t]};return n=(a=T(e))?a.fire({type:"get",name:t},c):c(),r&&Object(i.a)(e)&&!Object(w.a)(t)&&Object(o.a)(n)&&!Object(E.a)(n)?function(...t){return K(()=>n.apply(e,t),e)}:n},z=class extends k{constructor(e,t){if(super(e,t),this.filterArray=Object(n.a)(this.filter),this.isDynamicFilter=this.filterArray.filter(e=>Object(a.a)(e)&&(e.indexOf("..")>-1||e.startsWith(".")||e.endsWith("."))).length,this.isDynamicFilter&&this.filterArray.length>1)throw new Error('Only one "Dynamic Filter" must be observed at a time! "'+this.filterArray.join(", ")+'" have been bound together.')}fire(e){var t;if(!(this.disconnected||this.params.type&&!Object(j.a)(e,e=>this.params.type===e.type)))if(this.filterArray.length){var r=[];this.filterArray.filter((t,n)=>(t=Object(a.a)(t)?t.replace(/`/g,""):t,r[n]=[],e.filter(e=>{var a=e.path.split("."),i=this.isDynamicFilter?t.split(".").map((e,t)=>e||a[t]||"").join("."):t;return Object(d.a)(r[n],i),(i===e.name||!1!==this.params.suptree&&(i+".").startsWith(e.path+".")||this.params.subtree&&(e.path+".").startsWith(i+"."))&&(!this.isDynamicFilter||!i.split(".").filter(e=>!e).length)}).length)).length&&(t=r,t.reduce((e,t)=>{var r=[];return e.forEach(e=>{Object(n.a)(t).forEach(t=>{var n=e.slice();n.push(t),r.push(n)})}),r},[[]])).forEach(t=>{var r=this.formatChanges(t,e);this.handler(Object(i.a)(this.filter)?r:r[0])})}else this.filter||!this.params.subtree&&e.filter(e=>e.path===e.name).length!==e.length||this.handler(e)}formatChanges(e,t){return!1===this.params.data?[]:e.map(e=>{var r=t.reduce((t,r)=>{if(t)return t;if(e+""==r.path+"")return r;if((e+".").startsWith(r.path+".")){var n=Object(a.a)(e)?Object(O.a)(e,r.path+".").split("."):e;t=new I(r.subject,{type:r.type,name:e});return("del"===r.type||r.isUpdate)&&(t.oldValue=v(r.oldValue,n,{get:U})),"del"!==r.type&&(t.value=v(r.value,n,{get:U})),t}},null);return r||(r=new I(this.subject,{type:"get",name:e,value:v(this.subject,Object(a.a)(e)?e.split("."):e,{get:U})})),r})}},B=class extends h{add(e){return super.add(new z(this.subject,e))}fire(e){return e=Object(n.a)(e,!1).map(e=>e instanceof I?e:new I(this.subject,e)),!this.currentlyFiring.filter(t=>e.filter(e=>t.type===e.type&&t.name===e.name).length).length&&(this.currentlyFiring.push(...e),this.fireables.forEach(t=>{if(e.propagationStopped)return!1;t.fire(e)}),e.forEach(e=>Object(b.a)(this.currentlyFiring,e)),!0)}},G=function(e,t=!0){return f(e,".observers",t?B:null)},J=function(e,t){if(!e||!Object(s.a)(e))throw new Error("Target must be of type object!");var r,n=function(r){return arguments.length?r:t in e};return(r=T(e,!1))?r.fire({type:"has",name:t},n):n()},Q=function(e,t,r,o=null,l=null){if(!t||!Object(s.a)(t))throw new Error("Target must be of type object!");Object(u.a)(r)&&(l=o,o=null);var f=T(t,!1),b=G(t,!1);const p=(r,n,i,c)=>{if(Object(a.a)(r)&&-1!==r.indexOf("."))throw new Error("Property names with a dot are not supported!");var u,o="set";e&&(o="def",n=(u=n||{}).value);var l={name:r,type:o,value:n,related:i,detail:c};J(t,r)&&(l.isUpdate=!0,l.oldValue=U(t,r));var p=function(e){return arguments.length?e:(u?Object.defineProperty(t,r,u):t[r]=n,!0)};if(f){var h=u?{type:"def",name:r,descriptor:u,related:i,detail:c}:{type:"set",name:r,value:n,related:i,detail:c};l.success=f.fire(h,p)}else l.success=p();return l.success&&l.value!==l.oldValue&&(Object(s.a)(l.oldValue)&&W(t,r,l.oldValue),Object(s.a)(l.value)&&(q(t,r,l.value),b&&b.build&&D(l.value,null,!0))),l};var h,d=[];Object(i.a)(r)||(Object(a.a)(r)||Object(c.a)(r))&&(h=Object(n.a)(r))?d=h.map(e=>p(e,o,h,l)):Object(u.a)(r)&&(h=Object.keys(r))&&(d=h.map(e=>p(e,r[e],h,l)));var j=d.filter(e=>e.success);return b&&b.fire(j),j.length>0},R=function(e,t,r=null,n=null){return Q(!1,...arguments)},X=function(e,t,r=null){if(!e||!Object(s.a)(e))throw new Error("Target must be of type object!");var i,c=(t=Object(n.a)(t)).map(n=>{if(Object(a.a)(n)&&-1!==n.indexOf("."))throw new Error("Property names with a dot are not supported!");var i={name:n,type:"del",related:t,detail:r};J(e,n)&&(i.oldValue=U(e,n));var c,u=function(t){return arguments.length?t:(delete e[n],!0)};return(c=T(e,!1))?i.success=c.fire({type:"del",name:n,related:t},u):i.success=u(),i.success&&Object(s.a)(i.oldValue)&&W(e,n,i.oldValue),i}).filter(e=>e.success);return(i=G(e,!1))&&i.fire(c),c.length>0},Y=function(e,t,r=null,n=null){return Q(!0,...arguments)},Z=function(e){return M(!0,...arguments)};const $=X,ee=Y;t.a={set:R,get:U,has:J,deleteProperty:X,del:$,defineProperty:Y,def:ee,keys:V,ownKeys:Z,intercept:function(e,t,r,n={}){if(!Object(s.a)(e))throw new Error('Object must be of type subject; "'+l(r)+'" given!');if(Object(o.a)(t)&&(n=arguments.length>2?r:{},r=t,t=null),!Object(o.a)(r))throw new Error('Callback must be a function; "'+l(r)+'" given!');var a,i=T(e),c={filter:t,handler:r,params:n};return c.params.unique&&(a=i.filter(c)).length?a[0]:i.add(c)},unintercept:function(e,t,r=null,n={}){if(!e||!Object(s.a)(e))throw new Error('Object must be of type subject; "'+l(e)+'" given!');if(Object(o.a)(t)&&(n=arguments.length>2?r:{},r=t,t=null),r&&!Object(o.a)(r))throw new Error('Handler must be a function; "'+l(r)+'" given!');var a;if(a=T(e,!1))return a.forget({filter:t,originalHandler:r,params:n})},proxy:function(e){if(!Object(s.a)(e))throw new Error('Object must be of type subject; "'+l(e)+'" given!');var t=new Proxy(e,{get:(e,r)=>{var n=U(e,r);return Object(o.a)(n)&&!Object(E.a)(n)?n.bind(t):n},set:R,has:J,deleteProperty:X,defineProperty:Y,ownKeys:Z});return t},observe:H,unobserve:A,closure:K,init:function(e,t){Object(n.a)(t).forEach(t=>{var r,n,a=e[t],i=Object.getOwnPropertyDescriptor(e,t)||{enumerable:!(t in e)};"value"in i&&delete i.value,"writable"in i&&delete i.writable,i.get=()=>{if(r)return a;r=!0;var n=U(e,t);return r=!1,n},i.set=r=>{if(n)return a=r,!0;n=!0;R(e,t,r);return n=!1,!0},Object.defineProperty(e,t,i)})},build:D,link:q,unlink:W}},function(e,t,r){"use strict";var n=r(17),a=r(8),i=r(0);t.a=function(e){return Object(n.a)(e)||Object(a.a)(e)||!1===e||0===e||Object(i.a)(e)&&!Object.keys(e).length}},function(e,t,r){"use strict";var n=r(1);r(4);t.a=function(e,t=null){var r={};return 2===arguments.length&&(Object(n.a)(e)&&Object(n.a)(t)?e.forEach((e,n)=>r[e]=t[n]):r[e]=t),r}},function(e,t,r){"use strict";var n=r(1);t.a=function(e,t,r=null){return Object(n.a)(t)?e.filter(e=>r?t.filter(t=>r(e,t)).length:-1===t.indexOf(e)):[]}},,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(26),a=r(13),i=r(10),c=r(18),u={rootAttribute:"namespace",scopedIdAttribute:"scoped:id",namespacePropertyName:"namespace",inertContexts:[],inertSubjects:[]};class s{constructor(e,t=n.a,r={}){const s=this;if(s.params=Object(i.a)({},u,r),s.window=e,s.trap=t,!s.window||!("Element"in s.window))throw new Error('The "Element" class not found in global context!');if(s.params.namespacePropertyName in s.window.Element.prototype)throw new Error('The "Element" class already has a "'+s.params.namespacePropertyName+'" property!');Object.defineProperty(s.window.Element.prototype,s.params.namespacePropertyName,{get:function(){if(!this[".sopedHTML-namespace"]){var e={};this[".sopedHTML-namespace"]=e,s.trap.link&&s.trap.link(this,s.params.namespacePropertyName,e)}return this[".sopedHTML-namespace"]}}),Object(a.b)(s.window,"["+s.window.CSS.escape(s.params.scopedIdAttribute)+"]",e=>{var t=s.params.inertContexts.concat(s.params.inertSubjects);if(!Object(c.a)(t,t=>e.closest(t))){var r=e.getAttribute(s.params.scopedIdAttribute),n=e.parentNode.closest("["+s.window.CSS.escape(s.params.rootAttribute)+"],html")[s.params.namespacePropertyName];n[r]!==e&&s.trap.set(n,r,e),Object(a.c)(s.window,e,()=>{n[r]===e&&s.trap.deleteProperty(n,r)},{once:!0})}})}}},function(e,t,r){"use strict";r.r(t),new(r(33).a)(window)}]); 2 | //# sourceMappingURL=scoped-html.js.map -------------------------------------------------------------------------------- /dist/scoped-js.js: -------------------------------------------------------------------------------- 1 | !function(t){var e={};function r(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,r),s.l=!0,s.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)r.d(n,s,function(e){return t[e]}.bind(null,s));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=35)}([function(t,e,r){"use strict";var n=r(14);e.a=function(t){return Array.isArray(t)||"object"==typeof t&&t||Object(n.a)(t)}},function(t,e,r){"use strict";e.a=function(t){return Array.isArray(t)}},function(t,e,r){"use strict";var n=r(1),s=r(4),i=r(8),a=r(27),o=r(5);e.a=function(t,e=!0){return Object(n.a)(t)?t:!e&&Object(o.a)(t)?[t]:!1!==t&&0!==t&&Object(a.a)(t)?[]:function(t){return!Object(s.a)(t)&&!Object(i.a)(t.length)}(t)?Array.prototype.slice.call(t):Object(o.a)(t)?Object.values(t):[t]}},function(t,e,r){"use strict";var n=r(14);e.a=function(t){return Object(n.a)(t)||t&&"[object function]"==={}.toString.call(t)}},function(t,e,r){"use strict";e.a=function(t){return t instanceof String||"string"==typeof t&&null!==t}},function(t,e,r){"use strict";e.a=function(t){return!Array.isArray(t)&&"object"==typeof t&&t}},function(t,e,r){"use strict";e.a=function(t){return!0!==t&&!1!==t&&null!==t&&""!==t&&!isNaN(1*t)}},function(t,e,r){"use strict";var n=r(0),s=r(6);e.a=function(t,e){var r=void 0;return Object(n.a)(t)&&Object.keys(t).forEach((n,i)=>{!1!==r&&(r=e(Object(s.a)(n)?parseFloat(n):n,t[n],i))}),r}},function(t,e,r){"use strict";e.a=function(t){return arguments.length&&(void 0===t||void 0===t)}},function(t,e,r){"use strict";e.a=function(t){return t.filter((t,e,r)=>r.indexOf(t)===e)}},function(t,e,r){"use strict";var n=r(21);e.a=function(...t){return Object(n.a)(t,(t,e,r)=>!0,!1,!1,!1)}},function(t,e,r){"use strict";e.a=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)}},function(t,e,r){"use strict";e.a=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)}},function(t,e,r){"use strict";r.d(e,"c",(function(){return o})),r.d(e,"b",(function(){return c})),r.d(e,"a",(function(){return l}));var n=r(4),s=r(29),i=r(2),a=r(19);function o(t,e,r,n={}){return n.on="removed",u(t,e,(t,e)=>{r(t,e)},n)}function c(t,e,r,s={}){Object(a.a)(t,()=>{t.MutationObserver&&function(t,e,r,n={}){n.on="added",u(t,e,(t,e)=>{r(t,e)},n)}(t,e,(t,e)=>{t.forEach(t=>r(t,e))},s),Object(n.a)(e)?Object(i.a)(t.document.querySelectorAll(e)).forEach(t=>r(t,1)):e.parentNode&&r(e,1)})}function u(t,e,r,a={}){e=Object(i.a)(e,!1);var o=(t,e)=>{if(e=e.filter(t=>t.matches),Object(n.a)(t)){var r=e.filter(e=>e.matches(t));if(!1!==a.observeIndirectMutation&&(r=e.reduce((e,r)=>e.concat(Object(i.a)(r.querySelectorAll(t))),r)).length)return r}else{if(e.includes(t))return[t];if(!1!==a.observeIndirectMutation&&e.length)for(var s=t;s=s.parentNode;)if(e.includes(s))return[t]}},c=[],u=[],l=a.context||t.document.documentElement,h=new t.MutationObserver(t=>{if(!a.on||"added"===a.on){var l=[];if(e.forEach(e=>{if(Object(n.a)(e))l=t.reduce((t,r)=>t.concat(o(e,Object(i.a)(r.addedNodes))||[]),l);else{var r=t.reduce((t,r)=>t||(o(e,Object(i.a)(r.addedNodes))||[])[0],null);r&&l.push(r)}}),l.length)if(a.onceEach){var p=Object(s.a)(l,c);p.length&&(c.push(...p),r(p,1))}else a.once&&h.disconnect(),r(l,1)}if(!a.on||"removed"===a.on){var f=[];if(e.forEach(e=>{if(Object(n.a)(e))f=t.reduce((t,r)=>t.concat(o(e,Object(i.a)(r.removedNodes))||[]),f);else{var r=t.reduce((t,r)=>t||(o(e,Object(i.a)(r.removedNodes))||[])[0],null);r&&f.push(r)}}),f.length)if(a.onceEach){var b=Object(s.a)(f,u);b.length&&(u.push(...b),r(b,0))}else a.once&&h.disconnect(),r(f,0)}});return h.observe(l,{childList:!0,subtree:!0}),h}function l(t,e,r,n=[]){var s=new t.MutationObserver(r),i={attributes:!0,attributeOldValue:!0};return n&&(i.attributeFilter=n),s.observe(e,i),s}},function(t,e,r){"use strict";e.a=function(t){return"function"==typeof t}},function(t,e,r){"use strict";e.a=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);return t}},function(t,e,r){"use strict";e.a=function(t){return t instanceof Number||"number"==typeof t}},function(t,e,r){"use strict";e.a=function(t){return null===t||""===t}},function(t,e,r){"use strict";e.a=function(t,e){return t.reduce((t,r)=>t||e(r),!1)}},function(t,e,r){"use strict";e.a=function(t,e){t.__readyCallbacks||(t.__readyCallbacks=[]),"complete"===t.document.readyState?e():t.__readyCallbacks.push(e),t.document.addEventListener("DOMContentLoaded",()=>{t.__readyCallbacks.forEach(t=>t()),t.__readyCallbacks.splice(0)},!1)}},function(t,e,r){"use strict";var n=r(14);e.a=function(t){return Object(n.a)(t)&&/^class\s?/.test(Function.prototype.toString.call(t))}},function(t,e,r){"use strict";r.d(e,"a",(function(){return l}));var n=r(1),s=r(3),i=r(5),a=r(0),o=r(6),c=r(24),u=function(t,e){var r=[];return function(t,e){e=(e=e||Object.prototype)&&!Object(n.a)(e)?[e]:e;var r=[];for(t=t;t&&(!e||e.indexOf(t)<0)&&"default"!==t.name;)r.push(t),t=t?Object.getPrototypeOf(t):null;return r}(t,e).forEach(t=>{Object(c.a)(r,...Object.getOwnPropertyNames(t))}),r};function l(t,e,r=!1,c=!1,h=!0){var p=0,f=t.shift();if((Object(o.a)(f)||!0===f||!1===f)&&(p=f,f=t.shift()),!t.length)throw new Error("_merge() requires two or more array/objects.");return t.forEach((t,b)=>{(Object(a.a)(t)||Object(s.a)(t))&&(r?u(t):Object.getOwnPropertyNames(t)).forEach(s=>{var a=f[s],u=t[s];if((Object(n.a)(a)&&Object(n.a)(u)||Object(i.a)(a)&&Object(i.a)(u))&&(!0===p||p>0))f[s]=Object(n.a)(a)&&Object(n.a)(u)?[]:{},l([Object(o.a)(p)?p-1:p,f[s],a,u],e,r,c,h);else if(e(s,f,t,b))if(Object(n.a)(f)&&Object(n.a)(t))c?f[s]=u:f.push(u);else try{h?Object.defineProperty(f,s,Object.getOwnPropertyDescriptor(t,s)):f[s]=t[s]}catch(t){}})}),f}},function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));var n=r(6),s=r(5),i=r(28),a=r(10),o=function(t,e,r=null){return Object(a.a)(t,Object(s.a)(e)?e:Object(i.a)(e,r))};function c(t,e,r=null){if(t.CHTML_META||(t.CHTML_METATag=t.document.querySelector('meta[name="chtml"]'))&&(t.CHTML_META=(t.CHTML_METATag.getAttribute("content")||"").split(";").filter(t=>t).reduce((t,e)=>{var r=e.split("=").map(t=>t.trim());return o(t,r[0],"true"===r[1]||"false"!==r[1]&&(Object(n.a)(r[1])?parseInt(r[1]):r[1]))},{})),3===arguments.length){!1===r?delete t.CHTML_META[e]:t.CHTML_META[e]=!0===r?"true":r;var s=Object.keys(t.CHTML_META).reduce((e,r)=>e+r+"="+t.CHTML_META[r]+";","");return t.CHTML_METATag.setAttribute("content",s),!0}return t.CHTML_META?t.CHTML_META[e]:void 0}},function(t,e,r){"use strict";var n=r(1);e.a=function(t,e,r=null){return Object(n.a)(e)?t.filter(t=>r?e.filter(e=>r(t,e)).length:-1!==e.indexOf(t)):[]}},function(t,e,r){"use strict";e.a=function(t,...e){return e.forEach(e=>{t.indexOf(e)<0&&t.push(e)}),t}},function(t,e,r){"use strict";var n=r(1),s=r(3),i=r(6),a=r(0),o=r(21);e.a=function(t,e=[],r=!0){var c=0;return Object(i.a)(arguments[0])&&Object(a.a)(arguments[1])&&(c=arguments[0],t=arguments[1],e=arguments[2]||[]),Object(o.a)([c,{},t],(t,r,i)=>Object(s.a)(e)?e(t):!Object(n.a)(e)||!e.length||e.indexOf(t)>-1,!1,!1,r)}},function(t,e,r){"use strict";var n=r(2),s=r(4),i=r(1),a=r(16),o=r(5),c=r(0),u=r(3),l=function(t){return typeof t},h=function(t,e,r=null){if(!Object(c.a)(t))throw new Error('Object must be of type subject; "'+l(t)+'" given!');var n;if(!(n=t[e])&&r)try{n=new r(t),Object.defineProperty(t,e,{get:()=>n,set:t=>{if(t!==n)throw new Error('Attempt to overwrite the "'+e+'" special property!')},enumerable:!1})}catch(t){}return n},p=r(15),f=r(23),b=class{constructor(t){this.subject=t,this.fireables=[],this.currentlyFiring=[]}add(t){return this.fireables.push(t),t}forget(t){this.filter(t).forEach(t=>{this.fireables=this.fireables.filter(e=>e!==t)})}filter(t){return this.fireables.filter(e=>{var r=Object(n.a)(e.filter),s=Object(n.a)((e.params||{}).tags),i=Object(n.a)(t.filter),a=Object(n.a)((t.params||{}).tags);return!(t.originalHandler&&e.handler!==t.originalHandler||i.length&&(i.length!==r.length||Object(f.a)(r,i).length!==i.length)||a.length&&(a.length!==s.length||Object(f.a)(s,a).length!==a.length))})}},d=r(24),g=r(18),m=r(11),j=r(8),v=r(17),O=function(t,e,r={},s={}){e=Object(n.a)(e).slice();for(var i=t;!Object(j.a)(i)&&!Object(v.a)(i)&&e.length;){var a=e.shift();if(!(r.get?r.get(i,a):Object(c.a)(i)?a in i:i[a]))return void(s.exists=!1);i=r.get?r.get(i,a):i[a]}return s.exists=!0,i},y=r(28),w=r(6),x=r(20),k=r(25),E=r(9),T=function(t,e,r=null,n={}){if(!t||!Object(c.a)(t))throw new Error('Object must be of type subject; "'+l(t)+'" given!');if(Object(u.a)(e)&&(n=arguments.length>2?r:{},r=e,e=null),r&&!Object(u.a)(r))throw new Error('Handler must be a function; "'+l(r)+'" given!');var s;if(s=Q(t,!1))return s.forget({filter:e,originalHandler:r,params:n})},C=r(7),P=r(12),S=class{constructor(t,e){this.subject=t,this.handler=e.handler,this.filter=e.filter,this.params=e.params}disconnect(){this.disconnected=!0}},A=class extends S{fire(t,e,r){return this.disconnected||this.filter&&this.filter!==t.type?e(...Array.prototype.slice.call(arguments,2)):this.handler(t,r,e)}},_=class{constructor(t,e){if(this.subject=t,!e.type)throw new Error("Action type must be given in definition!");Object(C.a)(e,(t,e)=>{Object.defineProperty(this,t,{value:e,enumerable:!0})}),Object.seal(this)}},M=class extends b{add(t){return super.add(new A(this.subject,t))}fire(t,e=null){if(t instanceof _||(t=new _(this.subject,t)),this.currentlyFiring.filter(e=>e.type===t.type&&e.name===t.name).length)return e?e():void 0;this.currentlyFiring.push(t);const r=(n,...s)=>{var i=this.fireables[n];return i?i.fire(t,(...t)=>r(n+1,...t),...s):e?e(...s):s[0]};var n=r(0);return this.currentlyFiring.pop(),n}},F=function(t,e=!0){return h(t,".interceptors",e?M:null)},$=function(t,e){if(!e||!Object(c.a)(e))throw new Error("Target must be of type object!");var r,n=function(r){return arguments.length?r:t?Object.getOwnPropertyNames(e):Object.keys(e)};return(r=F(e,!1))?r.fire({type:t?"ownKeys":"keys"},n):n()},W=function(t){return $(!1,...arguments)};function L(t,e=null,r=!1){if(!t||!Object(c.a)(t))throw new Error("Target must be of type object!");var s=Q(t);if(s&&!s.build){s.build=!0;var i=!(e=Object(n.a)(e)).length||e.filter(t=>t.startsWith(".")).length?W(t).filter(t=>-1===t.indexOf(".")):e.map(t=>Object(P.a)(t,".")),a=e.length?e.map(t=>Object(m.a)(t,".")):null;i.forEach(e=>{var n=H(t,e);Object(c.a)(n)&&(q(t,e,n),(a||r)&&L(n,a,r))})}}var N=function(t,e,r=null,n={}){if(!t||!Object(c.a)(t))throw new Error('Object must be of type subject; "'+l(r)+'" given!');if(Object(u.a)(e)&&(n=arguments.length>2?r:{},r=e,e=null),!Object(u.a)(r))throw new Error('Callback must be a function; "'+l(r)+'" given!');var s={filter:e,handler:r,params:n};(s.filter||s.params.subtree)&&L(t,s.filter,s.params.subtree);var i,a=Q(t);return s.params.unique&&(i=a.filter({filter:e,params:n})).length?i[0]:a.add(s)},V=class{constructor(t,e){if(this.subject=t,e.originalSubject||(this.originalSubject=t),!("type"in e))throw new Error("Delta type must be given in definition!");if(!("name"in e))throw new Error("Property name must be given in definition!");Object(C.a)(e,(t,e)=>{Object.defineProperty(this,t,{value:e,enumerable:!0})}),this.path||Object.defineProperty(this,"path",{value:e.name,enumerable:!0}),Object.seal(this)}},q=function(t,e,r){var n;N(r,r=>{if(n=Q(t,!1)){var s=r.map(r=>{var n={};return Object(C.a)(r,(t,e)=>{"subject"!==t&&"name"!==t&&"path"!==t&&(n[t]=e)}),n.name=e,n.path=e+"."+r.path,n.originalSubject=r.originalSubject,new V(t,n)});return n.fire(s)}},{subtree:!0,unique:!0,tags:[D,e,t]})};const D={};var B=function(t,e,r){T(r,null,null,{tags:[D,e,t]})},I=function(t,...e){var r=e.map(t=>{if(!Object(c.a)(t))throw new Error("Target must be of type object!");return{subject:t,subjectCopy:Object(i.a)(t)?t.slice(0):Object(k.a)(t)}}),n=t(...e);return r.map(t=>{var e,r=Object.keys(t.subjectCopy),n=Object.keys(t.subject),s=[],a=Object(E.a)(r.concat(n)).map(e=>{if((!Object(i.a)(t.subject)||"length"!==e&&".observer"!==e)&&t.subjectCopy[e]!==t.subject[e]){s.push(e);var a={name:e,related:s,buffered:!0};return n.includes(e)?(a.type="set",a.value=t.subject[e],r.includes(e)&&(a.isUpdate=!0)):a.type="del",r.includes(e)&&(a.oldValue=t.subjectCopy[e]),Object(c.a)(t.subjectCopy[e])&&B(t.subject,e,t.subjectCopy[e]),Object(c.a)(t.subject[e])&&q(t.subject,e,t.subject[e]),a}}).filter(t=>t);if(a.length&&(e=Q(t.subject,!1)))return e.fire(a)}),n},H=function(t,e,r=!1){if(!t||!Object(c.a)(t))throw new Error("Target must be of type object!");var n,s,a=function(r){return arguments.length?r:Object(i.a)(e)?Object(y.a)(e,t):t[e]};return n=(s=F(t))?s.fire({type:"get",name:e},a):a(),r&&Object(i.a)(t)&&!Object(w.a)(e)&&Object(u.a)(n)&&!Object(x.a)(n)?function(...e){return I(()=>n.apply(t,e),t)}:n},U=class extends S{constructor(t,e){if(super(t,e),this.filterArray=Object(n.a)(this.filter),this.isDynamicFilter=this.filterArray.filter(t=>Object(s.a)(t)&&(t.indexOf("..")>-1||t.startsWith(".")||t.endsWith("."))).length,this.isDynamicFilter&&this.filterArray.length>1)throw new Error('Only one "Dynamic Filter" must be observed at a time! "'+this.filterArray.join(", ")+'" have been bound together.')}fire(t){var e;if(!(this.disconnected||this.params.type&&!Object(g.a)(t,t=>this.params.type===t.type)))if(this.filterArray.length){var r=[];this.filterArray.filter((e,n)=>(e=Object(s.a)(e)?e.replace(/`/g,""):e,r[n]=[],t.filter(t=>{var s=t.path.split("."),i=this.isDynamicFilter?e.split(".").map((t,e)=>t||s[e]||"").join("."):e;return Object(d.a)(r[n],i),(i===t.name||!1!==this.params.suptree&&(i+".").startsWith(t.path+".")||this.params.subtree&&(t.path+".").startsWith(i+"."))&&(!this.isDynamicFilter||!i.split(".").filter(t=>!t).length)}).length)).length&&(e=r,e.reduce((t,e)=>{var r=[];return t.forEach(t=>{Object(n.a)(e).forEach(e=>{var n=t.slice();n.push(e),r.push(n)})}),r},[[]])).forEach(e=>{var r=this.formatChanges(e,t);this.handler(Object(i.a)(this.filter)?r:r[0])})}else this.filter||!this.params.subtree&&t.filter(t=>t.path===t.name).length!==t.length||this.handler(t)}formatChanges(t,e){return!1===this.params.data?[]:t.map(t=>{var r=e.reduce((e,r)=>{if(e)return e;if(t+""==r.path+"")return r;if((t+".").startsWith(r.path+".")){var n=Object(s.a)(t)?Object(m.a)(t,r.path+".").split("."):t;e=new V(r.subject,{type:r.type,name:t});return("del"===r.type||r.isUpdate)&&(e.oldValue=O(r.oldValue,n,{get:H})),"del"!==r.type&&(e.value=O(r.value,n,{get:H})),e}},null);return r||(r=new V(this.subject,{type:"get",name:t,value:O(this.subject,Object(s.a)(t)?t.split("."):t,{get:H})})),r})}},R=class extends b{add(t){return super.add(new U(this.subject,t))}fire(t){return t=Object(n.a)(t,!1).map(t=>t instanceof V?t:new V(this.subject,t)),!this.currentlyFiring.filter(e=>t.filter(t=>e.type===t.type&&e.name===t.name).length).length&&(this.currentlyFiring.push(...t),this.fireables.forEach(e=>{if(t.propagationStopped)return!1;e.fire(t)}),t.forEach(t=>Object(p.a)(this.currentlyFiring,t)),!0)}},Q=function(t,e=!0){return h(t,".observers",e?R:null)},K=function(t,e){if(!t||!Object(c.a)(t))throw new Error("Target must be of type object!");var r,n=function(r){return arguments.length?r:e in t};return(r=F(t,!1))?r.fire({type:"has",name:e},n):n()},J=function(t,e,r,u=null,l=null){if(!e||!Object(c.a)(e))throw new Error("Target must be of type object!");Object(o.a)(r)&&(l=u,u=null);var h=F(e,!1),p=Q(e,!1);const f=(r,n,i,a)=>{if(Object(s.a)(r)&&-1!==r.indexOf("."))throw new Error("Property names with a dot are not supported!");var o,u="set";t&&(u="def",n=(o=n||{}).value);var l={name:r,type:u,value:n,related:i,detail:a};K(e,r)&&(l.isUpdate=!0,l.oldValue=H(e,r));var f=function(t){return arguments.length?t:(o?Object.defineProperty(e,r,o):e[r]=n,!0)};if(h){var b=o?{type:"def",name:r,descriptor:o,related:i,detail:a}:{type:"set",name:r,value:n,related:i,detail:a};l.success=h.fire(b,f)}else l.success=f();return l.success&&l.value!==l.oldValue&&(Object(c.a)(l.oldValue)&&B(e,r,l.oldValue),Object(c.a)(l.value)&&(q(e,r,l.value),p&&p.build&&L(l.value,null,!0))),l};var b,d=[];Object(i.a)(r)||(Object(s.a)(r)||Object(a.a)(r))&&(b=Object(n.a)(r))?d=b.map(t=>f(t,u,b,l)):Object(o.a)(r)&&(b=Object.keys(r))&&(d=b.map(t=>f(t,r[t],b,l)));var g=d.filter(t=>t.success);return p&&p.fire(g),g.length>0},z=function(t,e,r=null,n=null){return J(!1,...arguments)},G=function(t,e,r=null){if(!t||!Object(c.a)(t))throw new Error("Target must be of type object!");var i,a=(e=Object(n.a)(e)).map(n=>{if(Object(s.a)(n)&&-1!==n.indexOf("."))throw new Error("Property names with a dot are not supported!");var i={name:n,type:"del",related:e,detail:r};K(t,n)&&(i.oldValue=H(t,n));var a,o=function(e){return arguments.length?e:(delete t[n],!0)};return(a=F(t,!1))?i.success=a.fire({type:"del",name:n,related:e},o):i.success=o(),i.success&&Object(c.a)(i.oldValue)&&B(t,n,i.oldValue),i}).filter(t=>t.success);return(i=Q(t,!1))&&i.fire(a),a.length>0},X=function(t,e,r=null,n=null){return J(!0,...arguments)},Y=function(t){return $(!0,...arguments)};const Z=G,tt=X;e.a={set:z,get:H,has:K,deleteProperty:G,del:Z,defineProperty:X,def:tt,keys:W,ownKeys:Y,intercept:function(t,e,r,n={}){if(!Object(c.a)(t))throw new Error('Object must be of type subject; "'+l(r)+'" given!');if(Object(u.a)(e)&&(n=arguments.length>2?r:{},r=e,e=null),!Object(u.a)(r))throw new Error('Callback must be a function; "'+l(r)+'" given!');var s,i=F(t),a={filter:e,handler:r,params:n};return a.params.unique&&(s=i.filter(a)).length?s[0]:i.add(a)},unintercept:function(t,e,r=null,n={}){if(!t||!Object(c.a)(t))throw new Error('Object must be of type subject; "'+l(t)+'" given!');if(Object(u.a)(e)&&(n=arguments.length>2?r:{},r=e,e=null),r&&!Object(u.a)(r))throw new Error('Handler must be a function; "'+l(r)+'" given!');var s;if(s=F(t,!1))return s.forget({filter:e,originalHandler:r,params:n})},proxy:function(t){if(!Object(c.a)(t))throw new Error('Object must be of type subject; "'+l(t)+'" given!');var e=new Proxy(t,{get:(t,r)=>{var n=H(t,r);return Object(u.a)(n)&&!Object(x.a)(n)?n.bind(e):n},set:z,has:K,deleteProperty:G,defineProperty:X,ownKeys:Y});return e},observe:N,unobserve:T,closure:I,init:function(t,e){Object(n.a)(e).forEach(e=>{var r,n,s=t[e],i=Object.getOwnPropertyDescriptor(t,e)||{enumerable:!(e in t)};"value"in i&&delete i.value,"writable"in i&&delete i.writable,i.get=()=>{if(r)return s;r=!0;var n=H(t,e);return r=!1,n},i.set=r=>{if(n)return s=r,!0;n=!0;z(t,e,r);return n=!1,!0},Object.defineProperty(t,e,i)})},build:L,link:q,unlink:B}},function(t,e,r){"use strict";var n=r(17),s=r(8),i=r(0);e.a=function(t){return Object(n.a)(t)||Object(s.a)(t)||!1===t||0===t||Object(i.a)(t)&&!Object.keys(t).length}},function(t,e,r){"use strict";var n=r(1);r(4);e.a=function(t,e=null){var r={};return 2===arguments.length&&(Object(n.a)(t)&&Object(n.a)(e)?t.forEach((t,n)=>r[t]=e[n]):r[t]=e),r}},function(t,e,r){"use strict";var n=r(1);e.a=function(t,e,r=null){return Object(n.a)(e)?t.filter(t=>r?e.filter(e=>r(t,e)).length:-1===e.indexOf(t)):[]}},function(t,e,r){"use strict";r.d(e,"b",(function(){return L})),r.d(e,"a",(function(){return vt}));var n=r(10),s=(r(27),r(15)),i=r(1),a=function(t,e){if(!t)return!1;if(t instanceof e)return!0;var r=t=>{for(;t&&t!==Function.prototype;){if(t===e||t.prototypes&&t.prototypes.reduce((t,n)=>t||n===e||r(n),!1))return!0;t=Object.getPrototypeOf(t)}return!1};return r(t.constructor)},o=r(5),c=r(16),u=r(0),l=r(3),h=function(t){return Object(o.a)(t)&&Object.getPrototypeOf(t)===Object.prototype},p=function(t){return!0===t||!1===t},f=r(7);const b=function(t,e,r=!0,n=1){if(Object(i.a)(t)&&Object(i.a)(e)&&t.length!==e.length)return!r;if(Object(o.a)(t)&&Object(o.a)(e)){var s=Object.keys(t),a=Object.keys(e);if(!s.length&&!a.length)return h(t)&&h(e)?r:t===e===r;if(!b(s,a))return!r}if(n>0&&(Object(i.a)(t)&&Object(i.a)(e)||Object(o.a)(t)&&Object(o.a)(e))){var d=function(t,e,r=!0,n=!0,s=!1,a=!1){if(Object(i.a)(t)&&Object(i.a)(e)){var c=[],l=!0;return t.forEach(t=>{if(l){var h=!1;Object(f.a)(e,(e,s)=>{(!h||n&&Object(u.a)(t))&&(h=r(t,s),(Object(i.a)(h)&&!h.length||Object(o.a)(h)&&!Object.keys(h).length)&&(h=!1),Object(u.a)(h)&&n&&(t=h))}),Object(u.a)(h)?c.push(n?h:t):p(h)?s&&!h||!s&&h?c.push(t):a&&(l=!1):c.push(h)}}),c}if(Object(o.a)(t)&&Object(o.a)(e)){c={},l=!0;return Object.keys(t).forEach(h=>{if(l){var f=r(t[h],e[h]);(Object(i.a)(f)&&!f.length||Object(o.a)(f)&&!Object.keys(f).length)&&(f=!1),Object(u.a)(f)?c[h]=n?f:t[h]:p(f)?s&&!f||!s&&f?c[h]=t[h]:a&&(l=!1):c[h]=f}}),c}}(t,e,(t,e)=>b(t,e,r,n-1),!1,!1,!0);return Object(i.a)(d)?d.length===t.length&&d.length===e.length:Object(o.a)(d)&&Object(o.a)(t)?Object.keys(d).length===Object.keys(t).length&&Object.keys(d).length===Object.keys(e).length:d}return Object(l.a)(r)?r(t,e):Object(c.a)(t)&&Object(c.a)(e)&&isNaN(t)&&isNaN(e)?r:t===e===r};var d=b,g=class{even(t){return!(!Object(o.a)(t)||t.jsenType!==this.jsenType)&&d(t,this)}inherit(t){return this}withComments(t){return this.meta||(this.meta={}),this.meta.comments=t,this}withVars(t){return this.meta||(this.meta={}),this.meta.vars=t,this}};const m=class extends g{};Object.defineProperty(m.prototype,"jsenType",{get:()=>"Reference"});var j=m;const v=class extends g{};Object.defineProperty(v.prototype,"jsenType",{get:()=>"CallExpression"});var O=v;const y=class extends g{};Object.defineProperty(y.prototype,"jsenType",{get:()=>"FunctionType"});var w=y;const x=class extends g{};Object.defineProperty(x.prototype,"jsenType",{get:()=>"IfConditional"});var k=x,E=class extends Error{constructor(...t){super(...t),this.name="Syntax Error"}};const T={};class C{static parse(t,e,r={}){if(t.length){var n;if(T[t]&&!e&&!1!==r.allowCache)if(n=this.parseOne(t,T[t],r))return n;for(var s=Object.values(e||this.grammars),i=0;i{var i=this.parse(t,e,s?Object(n.a)(r,s):r);return!1!==s.lodge&&((a(i,j)||a(i,O))&&o.push(i),i&&(i.meta.vars.forEach(t=>o.push(t)),i.meta.deepVars.forEach(t=>c.push(t)))),i},r);return u&&(u.meta||(u.meta={}),u.meta.vars=o,u.meta.deepVars=c,a(u,O)?u.reference.context&&u.meta.vars.push(u.reference.context):a(u,w)?(u.meta.vars.splice(0),u.meta.deepVars.splice(0)):a(u,k)&&(u.onTrue&&u.onTrue.meta.vars.concat(u.onTrue.meta.deepVars).forEach(t=>{Object(s.a)(u.meta.vars,t),u.meta.deepVars.push(t)}),u.onFalse&&u.onFalse.meta.vars.concat(u.onFalse.meta.deepVars).forEach(t=>{Object(s.a)(u.meta.vars,t),u.meta.deepVars.push(t)})),Object(i.a)(r.explain)&&r.explain.push(t+" >>-------------\x3e> "+u.jsenType)),u}}var P=r(8),S=r(20),A=r(4),_=r(17),M=r(11),F=r(12),$=r(9),W=class extends Error{constructor(...t){super(...t),this.name="Reference Error"}};class L{constructor(t,e={}){if(this.stack=t,this.params=e,!("main"in this.stack))throw new Error('A "main" context must be provided!');this.stack.super&&(this.stack.super=L.create(this.stack.super,{errorLevel:e.errorLevel})),this.stack.local=this.stack.local||{},this.stack.$local=this.stack.$local||{}}observe(t,e){this.stack.super&&this.stack.super.observe(t,r=>{if(r.props.filter(e=>!V(this.stack.local,e,t)&&!V(this.stack.main,e,t)).length)return r.scope="super",e(r)}),t.observe(this.stack,r=>{var n=(r=r.filter(t=>"main"===t.name)).map(t=>Object(M.a)(t.path,".")).filter(t=>t),s=n.map(t=>Object(F.a)(t,"."));if(!n.length&&r.length&&r[0].value&&(n=s=Object($.a)((Object(u.a)(r[0].value)?Object.keys(r[0].value):[]).concat(r[0].oldValue&&Object(u.a)(r[0].oldValue)?Object.keys(r[0].oldValue):[]))),s.filter(e=>!V(this.stack.local,e,t)).length)return e({props:s,references:n,scope:"local"})},{subtree:!0,tags:[this,"jsen-context"]})}unobserve(t,e){this.stack.super&&this.stack.super.unobserve(t,e),t.unobserve(this.stack,e,{subtree:!0,tags:[this,"jsen-context"]})}handle(t,e,r,n=0){var s=()=>e(this.stack.main,null,()=>this.stack.super?this.stack.super.handle(t,e,r,n+1):r?r():void 0,n);return"toString"===t&&this.stack.local.toString===Object.prototype.toString?s():e(this.stack.local,this.stack.$local,s,n)}get(t,e={},r=!0){return t instanceof String&&(t+=""),this.handle(t,(n,s,i,a)=>{var o=N(n,t,e);return!Object(P.a)(o)||V(n,t,e)?Object(l.a)(o)&&!Object(S.a)(o)&&r?o.bind(n):o:i()})}set(t,e,r={},n=!1){if(2===this.params.type&&"var"===n&&this.stack.super)return this.stack.super.set(t,e,r,n);t instanceof String&&(t+="");const s=(t,e,r,n)=>n.set?n.set(t,e,r):(t[e]=r,!0);return this.handle(!!n||t,(i,a,o)=>{if(a&&"const"===a[t])throw new LogicalError("CONST "+t+" cannot be modified!");return n?(a[t]=n,s(i,t,e,r)):V(i,t,r)?s(i,t,e,r):o()},()=>{throw new W('"'+t+'" is undefined!')})}del(t,e={}){return t instanceof String&&(t+=""),this.handle(t,(r,n,s)=>V(r,t,e)?(n&&delete n[t],e.deleteProperty||e.del?(e.deleteProperty||e.del)(r,t):(delete r[t],!0)):s())}has(t,e,r={}){return t instanceof String&&(t+=""),e instanceof String&&(e+=""),this.handle(t,(n,s,i)=>{if(V(n,t,r)){var a=N(n,t,r);return V(a,e,r)}return i()},()=>{throw new W('"'+t+'" is undefined!')})}exec(t,e,r={}){return t instanceof String&&(t+=""),this.handle(t,(n,s,i)=>{var a=N(n,t,r);if(!Object(P.a)(a)||V(n,t,r)){if(!Object(l.a)(a)){if(r.exec)return r.exec(n,t,e);throw new W('"'+t+'" is not a function! (Called on type: '+typeof n+".)")}return r.apply?r.apply(a,n,e):a.apply(n,e)}return i()},()=>{if(r.execUnknown)return r.execUnknown(this,t,e);throw new W('"'+t+'()" is undefined!')})}static create(t,e={}){return t instanceof L?t:new L({main:t},e)}}const N=(t,e,r)=>{if(!Object(_.a)(t)&&!Object(P.a)(t))return r.get&&Object(u.a)(t)?r.get(t,e):t[e]},V=(t,e,r)=>!Object(_.a)(t)&&!Object(P.a)(t)&&(r.has&&Object(u.a)(t)?r.has(t,e):Object(u.a)(t)?e in t:!Object(P.a)(t[e]));var q=function(t,e,r){return t.startsWith(e)&&t.endsWith(r)},D=function(t,e,r){return function(t,e){return Object(F.a)(t,e,!0)}(Object(M.a)(t,e),r)},B=r(2),I=r(6);const H=function(t,e=1,r=!0){return!Object(I.a)(e)||e<=0?t:(!Object(i.a)(t)&&Object(o.a)(t)&&r&&(t=Object.values(t)),Object(i.a)(t)?t.reduce((t,n)=>Object(i.a)(n)||Object(o.a)(n)&&r?t.concat(H(Object(i.a)(n)?n:Object.values(n),e-1,r)):t.concat(n),[]):t)};var U=H,R=function(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]},Q=function(t,e=1){return arguments.length>1?R(t.slice().reverse(),e).reverse():R(t.slice().reverse())},K=r(21),J=function(t,e=[]){return Object(K.a)([{},t],(t,r,n)=>{if(!Object(l.a)(n[t]))return Object(l.a)(e)?e(t):!Object(i.a)(e)||!e.length||e.indexOf(t)>-1},!1,!1,!1)};class z{static lex(t,e,r={}){if(!Object(A.a)(t+=""))throw new Error("Argument1 must be a string!");var n=t=>({delims:t.delims.slice(),options:J(t.options),nesting:t.nesting.slice(),maxDepth:t.maxDepth,comments:t.comments.slice(),tokens:t.tokens.slice(),matches:t.matches.slice(),matchesi:J(t.matchesi)});if(z.$cache[t]&&!1!==r.cache)for(var s=0;s=this.$str.length)){var r=1,n={},s={},i={};if(t.openComment||(s=this._testQuotes(t,e)),t.openQuote||(n=this._testComments(t,e)),t.openComment||n.ending)if(t.nesting.length||i.ending)this._push(t,this.$str[e]);else r=(o=n.starting||n.ending||this.$str[e]).length,this._push(t,o,"comments",n.starting);else if(t.openQuote||s.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;i=this._testNesting(t,e);i=this._testNesting(t,e);var a=this._testChars(t.options.stopChars||[],t,e);if(!t.nesting.length&&!1!==a)return t.options.stopChar=a,void(t.options.stopCharForward=this.$str.substr(e));if(t.delims.length)if(t.nesting.length||i.ending){var o;r=(o=i.starting||i.ending||this.$str[e]).length,this._push(t,o)}else{this._push(t,"");var c=this._testChars(t.delims,t,e);if(!1!==c&&(t.matches.push(c),t.matchesi[e]=c,r=c.length||1,!t.options.preserveDelims))return e+(c.length||1);this._push(t,c||this.$str[e])}else 2===t.nesting.length&&i.starting?(t.matches.push(null),this._push(t,i.starting),r=i.starting.length):!t.nesting.length&&i.ending?(this._push(t,i.ending),r=i.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(Q(n)===Q(t.openComment)){var s=Q(n);this.$str.substr(e).startsWith(s)&&(t.openComment=!1,r.ending=s)}}else{var i=R(n);this.$str.substr(e).startsWith(i)&&(t.openComment=n,r.starting=i)}}),r}_testNesting(t,e){var r={};return(t.options.blocks||[]).forEach(n=>{var s=R(n);if(this.$str.substr(e).startsWith(s))t.nesting=t.nesting.concat([n]),r.starting=s;else if(t.nesting.length&&Q(n)===Q(Q(t.nesting))){var i=Q(n);this.$str.substr(e).startsWith(i)&&(t.nesting=t.nesting.slice(0,-1),r.ending=i)}}),t.maxDepth=Math.max(t.maxDepth,t.nesting.length),r}_testChars(t,e,r){for(var n=0;n"Abstraction"});var X=G;var Y=class extends X{constructor(t){super(),this.expr=t}eval(t=null,e={}){return this.expr.eval(t,e)}toString(){return this.stringify()}stringify(t={}){return"("+this.expr.stringify(t)+")"}static parse(t,e,r={}){if(q(t,"(",")")&&!z.match(t,[" "]).length)return new this(e(D(t,"(",")")))}};const Z=class extends g{};Object.defineProperty(Z.prototype,"jsenType",{get:()=>"ArrayType"});var tt=Z;var et=class extends tt{constructor(t){super(),this.exprs=t||[]}inherit(t){if(t instanceof tt){var e=t.exprs.filter(t=>this.exprs.reduce((e,r)=>e&&!t.even(r),!0));this.exprs=e.concat(this.exprs)}return this}eval(t=null,e={}){return this.exprs.map(r=>r.eval(t,e))}toString(){return this.stringify()}stringify(t={}){return"["+this.exprs.map(e=>e.stringify(t)).join(", ")+"]"}static parse(t,e,r={}){if(q(t,"[","]")&&!z.match(t.trim(),[" "]).length)return new this(z.split(D(t,"[","]"),[","]).map(t=>t.trim()).filter(t=>t).map(t=>e(t)))}};const rt=class extends g{};Object.defineProperty(rt.prototype,"jsenType",{get:()=>"Arguments"});var nt=rt;var st=class extends nt{constructor(t=[]){super(),this.list=t}eval(t=null,e={}){return this.list.map(r=>r.eval(t,e))}toString(){return this.stringify()}stringify(t={}){return"("+this.list.map(e=>e.stringify(t)).join(", ")+")"}static parse(t,e,r={}){if(t=t.trim(),q(t,"(",")")&&!z.match(t,[" "]).length)return new this(z.split(D(t,"(",")"),[","]).map(t=>e(t.trim())))}};const it=class extends g{};Object.defineProperty(it.prototype,"jsenType",{get:()=>"AssertionExpression"});var at=it;const ot=class extends at{constructor(t,e){super(),this.exprs=t,this.logic=e}eval(t=null,e={}){if(this.logic.toLowerCase()===ot.negation.toLowerCase())return!R(this.exprs).eval(t,e);U(ot.operators);for(var r=(this.logic||"").trim().toUpperCase(),n=r===(ot.operators.or||"").trim().toUpperCase(),s=r===(ot.operators.nor||"").trim().toUpperCase(),i=r===(ot.operators.and||"").trim().toUpperCase(),a=r===(ot.operators.nand||"").trim().toUpperCase(),o=!0,c=0,u=0;ue.stringify(t)).join(" "+this.logic+" ")}static parse(t,e,r={}){if(t.toUpperCase().startsWith(ot.negation.toUpperCase()))return new this([e(t.substr(ot.negation.length))],ot.negation);var n=z.lex(t,U(this.operators));if(n.tokens.length>1){var s=Object($.a)(n.matches);if(s.length>1)throw new Error('"AND" and "OR" logic cannot be asserted in the same expression: '+t+"!");return new this(n.tokens.map(t=>e(t.trim())),R(s))}}};ot.negation="!",ot.operators={and:"&&",or:"||"};var ct=ot;const ut=class extends g{};Object.defineProperty(ut.prototype,"jsenType",{get:()=>"AssignmentExpression"});var lt=ut;const ht=class extends lt{constructor(t,e,r,n="=",s=!1){super(),this.initKeyword=t,this.reference=e,this.val=r,this.operator=n,this.postIncrDecr=s}eval(t=null,e={}){var r,n,s=this.reference.getEval(t,e);if(["++","--"].includes(this.operator)){if(n=this.reference.eval(t,e),!Object(c.a)(n))throw new Error(this.reference+" must be a number!");r="++"===this.operator?n+1:n-1}else if(["+=","-=","*=","/="].includes(this.operator)){var a=s.get(),o=this.val.eval(t,e);if(!("+="===this.operator||Object(c.a)(a)&&Object(c.a)(o)))throw new Error(this+" - operands must each be a number!");r="*="===this.operator?a*o:"/="===this.operator?a/o:"-="===this.operator?a-o:a+o}else r=this.val.eval(t,e);try{return s.set(r,this.initKeyword),e&&Object(i.a)(e.references)&&_pushUnique(e.references,this.reference.toString()),this.postIncrDecr?n:r}catch(t){throw t instanceof W?new W("["+this+"]: "+t.message):t}}toString(){return this.stringify()}stringify(t={}){return["++","--"].includes(this.operator)?this.postIncrDecr?this.reference.stringify(t)+this.operator:this.operator+this.reference.stringify(t):(this.initKeyword?this.initKeyword+" ":"")+[this.reference.stringify(t),this.operator,this.val.stringify(t)].join(" ")}static parse(t,e,r={}){var n=z.lex(t,this.operators.concat([pt]));if(n.matches.length){var s,i,a,o,c=n.matches[0].trim(),u=["++","--"].includes(c);if(u?(o=t.trim().endsWith("++")||t.trim().endsWith("--"),i=n.tokens[o?"shift":"pop"]().trim()):(i=n.tokens.shift().trim(),a=n.tokens.shift().trim()),["var","let","const"].includes(Object(F.a)(i," "))){if("="!==c)throw new E("Invalid declaration: "+t);s=Object(F.a)(i," "),i=Object(M.a)(i," ").trim()}if(!((i=e(i,null,{lodge:!1}))instanceof j)||!u&&!(a=e(a)))throw new E(t);return new this(s,i,a,c,o)}}};ht.operators=["+=","-=","*=","/=","++","--"];const pt=(t,e)=>!(t.endsWith("=")||!e.startsWith("=")||e.startsWith("=>")||e.startsWith("==")||e.startsWith("==="))&&"=";var ft=ht,bt=r(25);const dt=class extends g{};Object.defineProperty(dt.prototype,"jsenType",{get:()=>"Block"});var gt=dt;const mt=class extends g{};Object.defineProperty(mt.prototype,"jsenType",{get:()=>"ReturnDirective"});var jt=mt;class vt extends gt{constructor(t,e){super(),this.stmts=t||[],this.delim=e}eval(t=null,e={}){e=e?Object(bt.a)(e):{},t=L.create(t);for(var r=t=>Object($.a)(t.map(t=>Object(F.a)(Object(F.a)(t.toString(),"["),"("))),n=(t,e,r)=>{try{return t.eval(e,r)}catch(t){r.catch&&r.catch(t)}},s=[],i=0;io.filter(e=>(e+".").startsWith(t+".")).length),l=(e.references||[]).filter(t=>c.filter(e=>(e+".").startsWith(t+".")).length);if(!e.references||!e.references.length||(u=u.length)||(l=l.length)){var h=e;if(u&&delete(h=Object(bt.a)(e)).references,a instanceof jt)return n(a,t,h);s[i]=n(a,t,h),e.references&&a instanceof lt&&(e.references=e.references.concat(r([a.reference])))}}return s}toString(){return this.stringify()}stringify(t={}){return this.stmts.map(e=>e.stringify(t)).join(this.delim)}static parse(t,e,r={}){var n=z.lex(t+";",U(this.operators).concat([vt.testBlockEnd]));if(n.matches.length)return new this(n.tokens.map(t=>e(t.trim())).filter(t=>t),n.matches[0].trim())}static testBlockEnd(t,e){return!(!t.endsWith("}")||e.trim().startsWith("else"))&&""}}vt.operators=[";","\r\n"];const Ot=class extends g{};Object.defineProperty(Ot.prototype,"jsenType",{get:()=>"BooleanType"});var yt=Ot;var wt=class extends yt{constructor(t){super(),this.state=t}eval(){return"true"===this.state.toLowerCase().trim()}toString(){return this.stringify()}stringify(t={}){return this.state}static parse(t,e,r={}){if("true"===(t=t.toLowerCase().trim())||"false"===t)return new this(t)}};var xt=class extends O{constructor(t,e){super(),this.reference=t,this.args=e}eval(t=null,e={}){try{var r=this.args.eval(t,e);return this.reference.getEval(t,e).exec(r)}catch(t){throw t instanceof W?new W("["+this+"]: "+t.message):t}}toString(){return this.stringify()}stringify(t={}){return this.reference.stringify(t)+this.args.stringify(t)}static parse(t,e,r={}){if(!t.startsWith("(")&&t.endsWith(")")&&!z.match(t,[" "]).length){var n,s=z.split(t,[]),i=s.pop();if(!((n=e(s.join(""),null,{lodge:!1}))instanceof j&&(i=e(i,[st]))))throw new E(t);return new this(n,i)}}};r(29);const kt=class extends g{};Object.defineProperty(kt.prototype,"jsenType",{get:()=>"ComparisonExpression"});var Et=kt;class Tt extends Et{constructor(t,e,r){super(),this.operand1=t,this.operand2=e,this.operator=r}eval(t=null,e={}){return this.constructor.compare(this.operand1.eval(t,e),this.operand2.eval(t,e),this.operator)}toString(){return this.stringify()}stringify(t={}){return[this.operand1.stringify(t),this.operator,this.operand2.stringify(t)].join(" ")}static parse(t,e,r={}){var n=U(this.operators).map(t=>" "+t+" "),s=z.lex(t,n);if(s.tokens.length>1){if(s.tokens.length>2)throw new Error('Malformed "Comparison" expression: '+t+"!");return new this(e(R(s.tokens).trim()),e(Q(s.tokens).trim()),s.matches[0].trim())}}static compare(t,e,r="=="){if(-1===U(this.operators).indexOf(r))throw new Error('The operator "'+r+'" is not recognized.');switch(r){case"===":return t===e;case"==":case"=":return t==e;case">":return t>e;case"<":return t=":return t>=e;case"<=":return t<=e;case"!=":return t!=e;case"<>":case"!==":return t!==e;case"^=":return Object(A.a)(t)&&t.startsWith(e);case"$=":return Object(A.a)(t)&&t.endsWith(e);case"*=":return!(!Object(i.a)(e)&&!Object(A.a)(e))&&t.indexOf(e)>-1;case"~=":return Object(A.a)(t)&&Object(A.a)(e)&&(" "+t+" ").indexOf(" "+e+" ")>-1;case">=<":if(!Object(i.a)(e)||2!==e.length)throw new Error("A 'Between' comparison requires argument 2 to be an array of exactly 2 values.");return t>=e[0]&&t<=e[1];case"/**/":return e.match(new RegExp(t));default:return!1}}static diff(t,e,r){return!this.compare(t,e,r?"===":"==")}}Tt.operators={exact:{is:"===",isNull:"===",equalsTo:"==",strictlyNotEqualsTo:"!==",notEqualsTo:"!="},relative:{lesserThan:"<",greaterThan:">",lesserThanOrEqualsTo:"<=",greaterThanOrEqualsTo:">=",between:">=<"},partial:{startsWith:"^=",endsWith:"$=",contains:"*=",any:"~=",in:"~=",matches:"/**/"}};const Ct=class extends g{};Object.defineProperty(Ct.prototype,"jsenType",{get:()=>"TernaryConditional"});var Pt=Ct;class St extends Pt{constructor(t,e,r){super(),this.assertion=t,this.onTrue=e,this.onFalse=r}eval(t=null,e={}){return this.assertion.eval(t,e)?this.onTrue.eval(t,e):this.onFalse.eval(t,e)}toString(){return this.stringify()}stringify(t={}){return[this.assertion.stringify(t),this.constructor.operators[0],this.onTrue.stringify(t),this.constructor.operators[1],this.onFalse.stringify(t)].join(" ")}static parse(t,e,r={}){var n=z.split(t,this.operators);if(n.length>1){if(2===n.length)throw new Error("Malformed ternary expression: "+t+"!");return new this(e(n[0].trim()),e(n[1].trim()),e(n[2].trim()))}}}St.operators=["?",":"];const At=class extends g{};Object.defineProperty(At.prototype,"jsenType",{get:()=>"DeleteExpression"});var _t=At;const Mt=class extends _t{constructor(t,e="delete"){super(),this.reference=t,this.operator=e}eval(t=null,e={}){try{return this.reference.getEval(t,e).del()}catch(t){throw t instanceof W?new W("["+this+"]: "+t.message):t}}toString(){return this.stringify()}stringify(t={}){return this.operator+" "+this.reference.stringify(t)}static parse(t,e,r={}){var n=z.lex(t,Object.values(this.operators));if(1===n.matches.length&&t.startsWith(n.matches[0]+" ")){var s;if(!((s=e(n.tokens.pop().trim()))instanceof j))throw new E(t);return new this(s,n.matches[0].trim())}}};Mt.operators={red:"reduce",del:"delete"};var Ft=Mt;const $t=class extends w{constructor(t,e,r={}){super(),this.paramters=t||{},this.statements=e,this.arrowFunctionFormatting=r}inherit(t){if(t instanceof w){for(var e=Object.keys(t.paramters),r=Object.keys(this.paramters),n=0;n{var o=r.paramters[a];if(n.length-1i?n[i]:r.paramters[a]?r.paramters[a].eval(t,e):null}),r.arrowFunctionFormatting||(s.this=this);var i=t instanceof L?t.params.errorLevel:void 0,a=new L({main:s,super:t},{errorLevel:i}),o=r.statements.eval(a,e);return!1===r.arrowFunctionFormatting.body?o[0]:o}}toString(){return this.stringify()}stringify(t={}){var e=[];if(Object(f.a)(this.paramters,(r,n)=>{e.push(r+(n?"="+n.stringify(t):""))}),this.arrowFunctionFormatting){var r=!1===this.arrowFunctionFormatting.head||1===e.length&&-1===e[0].indexOf("="),n=!1===this.arrowFunctionFormatting.body;return(r?e[0]:"("+e.join(", ")+")")+" => "+(n?this.statements.stringify(t):"{"+this.statements.stringify(t)+"}")}return"function ("+e.join(", ")+") {"+this.statements.stringify(t)+"}"}static parse(t,e,r={}){var n;if((t=t.trim()).startsWith("function")&&(n=z.split(t,[]).slice(1).filter(t=>t.trim()))&&2===n.length)var s=!1,i=D(n.shift().trim(),"(",")"),a=D(n.shift().trim(),"{","}");else{if(t.startsWith("function")||!(n=z.split(t,["=>"]))||2!==n.length)return;i=n.shift().trim(),a=n.shift().trim(),s={};q(i,"(",")")?i=D(i,"(",")"):s.head=!1,q(a,"{","}")?a=D(a,"{","}"):s.body=!1}var o={};z.split(i,[","]).forEach(t=>{var r=t.split("=");r[1]?o[r[0].trim()]=e(r[1].trim(),null,{meta:null}):o[t.trim()]=null});var c=e(a,[vt],{assert:!1})||e(a,null,{meta:null});return new this(o,"Block"===c.jsenType?c:new vt([c]),s)}};$t.operators=["=>"];var Wt=$t;var Lt=class extends k{constructor(t,e,r,n={}){super(),this.assertion=t,this.onTrue=e,this.onFalse=r,this.params=n}eval(t=null,e={}){var r=t instanceof L?t.params.errorLevel:void 0,n=new L({main:{},super:t},{type:2,errorLevel:r});return this.assertion.eval(t,e)?this.onTrue?this.onTrue.eval(n,e):void 0:this.onFalse?this.onFalse.eval(n,e):void 0}toString(){return this.stringify()}stringify(t={}){var e=this.onTrue&&this.params.onTrueIsBlock?"{"+this.onTrue.stringify(t)+"}":this.onTrue?this.onTrue.stringify(t):"",r=this.onFalse&&this.params.onFalseIsBlock?"{"+this.onFalse.stringify(t)+"}":this.onFalse?this.onFalse.stringify(t):"";return"if ("+this.assertion.stringify(t)+")"+e+(r?" else "+r:"")}static parse(t,e,r={}){var n;if((t=t.trim()).startsWith("if")&&(n=z.split(t,[],{limit:2}).slice(1).filter(t=>t.trim()))&&2===n.length){var s,i,a=e(D(n.shift().trim(),"(",")").trim()),o=z.split(n.shift().trim(),["else"],{limit:1}),c=o.shift().trim(),u=(o.shift()||"").trim();return q(c,"{","}")&&(s=!0,c=D(c,"{","}").trim()),c=e(c,[vt],{assert:!1,meta:null})||e(c,null,{meta:null}),u&&(q(u,"{","}")&&(i=!0,u=D(u,"{","}").trim()),u=e(u,[vt],{assert:!1,meta:null})||e(u,null,{meta:null})),new this(a,c,u,{onTrueIsBlock:s,onFalseIsBlock:i})}}},Nt=r(23);const Vt=class extends g{};Object.defineProperty(Vt.prototype,"jsenType",{get:()=>"MathExpression"});var qt=Vt;const Dt=class extends qt{constructor(t,e){super(),this.val=t,this.exprs=e}eval(t=null,e={}){return this.exprs.reduce((r,n)=>{var s=n.val.eval(t,e),i=n.operator.trim();if(!(Object(I.a)(r)&&Object(I.a)(s)||"+"===i))throw new Error("Invalid Math expression: "+this.toString()+"!");switch(i){case"+":return r+s;case"-":return r-s;case"*":return r*s;case"/":return r/s}},this.val.eval(t,e))}toString(){return this.stringify()}stringify(t={}){return[this.val.stringify(t)].concat(this.exprs.map(e=>e.operator+" "+e.val.stringify(t))).join(" ")}static parse(t,e,r={}){var n=z.lex(t,U(this.operators));if(n.tokens.length>1&&n.matches.length===n.tokens.length-1){var s=Object($.a)(n.matches);if(Object(Nt.a)(s,this.operators.sup).length&&Object(Nt.a)(s,this.operators.sub).length)throw new Error('"Addition/subtraction" and "multiplication/division" operators cannot be used in the same expression: '+t+"!");return new this(e(n.tokens.shift().trim()),n.tokens.map((t,r)=>({operator:n.matches[r],val:e(t.trim())})))}}};Dt.operators={sup:["*","/"],sub:["+","-"]};var Bt=Dt;const It=class extends g{};Object.defineProperty(It.prototype,"jsenType",{get:()=>"NumberType"});var Ht=It;var Ut=class extends Ht{constructor(t,e=0){super(),this.int=t,this.dec=e}eval(){return parseFloat(this.int+(this.dec?"."+this.dec:null))}toString(){return this.stringify()}stringify(t={}){return this.int+(this.dec?"."+this.dec:null)}static parse(t,e,r={}){if(Object(I.a)(t)){t=t.split(".");return new this(parseInt(t.shift()),parseInt(t.shift()))}}};const Rt=class extends g{};Object.defineProperty(Rt.prototype,"jsenType",{get:()=>"ObjectType"});var Qt=Rt;const Kt=class extends Qt{constructor(t){super(),this.entries=t||{}}inherit(t){return t instanceof Qt&&Object(f.a)(t.entries,(t,e)=>{t in this.entries||(this.entries[t]=e)}),this}eval(t=null,e={}){var r={};return Object(f.a)(this.entries,(n,s)=>{r[n]=s.eval(t,e)}),r}toString(){return this.stringify()}stringify(t={}){var e=[];return Object(f.a)(this.entries,(r,n)=>{e.push(r+Kt.operators.sub+n.stringify(t))}),"{"+e.join(Kt.operators.sup)+"}"}static parse(t,e,r={}){if(q(t,"{","}")&&!z.match(t.trim(),[" "]).length){var n={},s=z.split(D(t,"{","}"),[Kt.operators.sup]).map(t=>t.trim()).filter(t=>t);return Object(f.a)(s,(t,r)=>{var s=z.split(r,[Kt.operators.sub],{limit:1});n[R(s).trim()]=e(Q(s).trim())}),new this(n)}}};Kt.operators={sup:",",sub:":"};var Jt=Kt;const zt=class extends g{};Object.defineProperty(zt.prototype,"jsenType",{get:()=>"PresenceOperator"});var Gt=zt;const Xt=class extends Gt{constructor(t,e,r="in"){super(),this.prop=t,this.reference=e,this.operator=r}eval(t=null,e={}){var r=this.prop.eval(t,e);try{return this.reference.getEval(t,e).has(r)}catch(t){throw t instanceof W?new W("["+this+"]: "+t.message):t}}toString(){return this.stringify()}stringify(t={}){return[this.prop.stringify(t),this.operator,this.reference.stringify(t)].join(" ")}static parse(t,e,r={}){var n=z.lex(t,this.operators);if(2===n.tokens.length){var s,i;if(!((s=e(n.tokens.shift().trim()))&&(i=e(n.tokens.shift().trim()))instanceof j))throw new E(t);return new this(s,i,n.matches[0].trim())}}};Xt.operators=[" in "];var Yt=Xt;const Zt=class extends j{constructor(t,e,r=!1){super(),this.context=t,this.name=e,this.backticks=r}getEval(t=null,e={}){var r=t,n=this.name;return this.context&&(n instanceof g&&(n=n.eval(t,e)),r=this.context.eval(t,e)),{get:()=>L.create(r).get(n,e.trap),del:()=>L.create(r).del(n,e.trap),has:t=>L.create(r).has(n,t,e.trap),set:(t,s=null)=>L.create(r).set(n,t,e.trap,s),exec:t=>L.create(r).exec(n,t,e.trap)}}eval(t=null,e={}){try{return this.getEval(t,e).get()}catch(t){throw t instanceof W?new W("["+this+"]: "+t.message):t}}toString(){return this.stringify()}stringify(t={}){var e=this.name;if(this.context){var r=this.context.stringify(t);e instanceof g?e="["+e.stringify(t)+"]":this.backticks&&(e="`"+e+"`")}else{r=t.context;this.backticks&&(e="`"+e+"`")}return(r||"")+(r&&!e.startsWith("[")?Zt.separator:"")+e}static parse(t,e,r={}){if(!z.match(t.trim(),[" "]).length){var n,s,i=z.split(t,[]),a=i.pop(),o=z.split(a.trim(),[this.separator],{preserveDelims:!0});if(o.length>1&&(a=o.pop().substr(1),i=i.concat(o)),q(a,"`","`")&&(a=D(a,"`","`"),s=!0),i.length&&((n=e(i.join(""))).isContext=!0),q(a,"[","]")){if(!n)throw new E(t);a=e(D(a,"[","]"))}return new this(n,a,s)}}};Zt.separator=".";var te=Zt;var ee=class extends jt{constructor(t){super(),this.expr=t}eval(t=null,e={}){return this.expr?this.expr.eval(t,e):void 0}toString(){return this.stringify()}stringify(t={}){return this.expr?"return "+this.expr.stringify(t):"return"}static parse(t,e,r={}){var n=t.toLowerCase();if(n.startsWith("return ")||"return"===n)return new this(e(t.substr(6).trim()))}};const re=class extends g{};Object.defineProperty(re.prototype,"jsenType",{get:()=>"StringType"});var ne=re;var se=class extends ne{constructor(t,e){super(),this.expr=t,this.quote=e}eval(){return this.expr}toString(){return this.stringify()}stringify(t={}){return this.quote+this.expr+this.quote}static parse(t,e,r={}){if(t=t.trim(),(q(t,'"','"')||q(t,"'","'"))&&!z.match(t,[" "]).length){var n=q(t,'"','"')?'"':"'";return new this(D(t,n,n),n)}}};const ie=class extends g{};Object.defineProperty(ie.prototype,"jsenType",{get:()=>"Void"});var ae=ie;var oe=class extends ae{constructor(t){super(),this.val=t}eval(){return"null"===this.val.toLowerCase().trim()?null:void 0}toString(){return this.stringify()}stringify(t={}){return this.val}static parse(t,e,r={}){if("null"===(t=t.toLowerCase().trim())||"undefined"===t)return new this(t)}};C.grammars={If:Lt,Return:ee,Deletion:Ft,Assignment:ft,Presence:Yt,Func:Wt,Abstraction:Y,Condition:St,Assertion:ct,Comparison:Tt,Math:Bt,Arr:et,Obj:Jt,Num:Ut,Str:se,Bool:wt,Void:oe,Call:xt,Reference:te};e.c=C},function(t,e,r){"use strict";r.d(e,"a",(function(){return b}));var n=r(26),s=r(30),i=r(19),a=r(13),o=r(10),c=(r(2),r(15)),u=r(18),l=r(3),h=r(22),p=s.b,f={scriptElement:'script[type="scoped"]',globalBindingMethod:"bind",localBindingMethod:"bind",inertContexts:[]};class b{static parse(t,e={}){var r;return(r=s.c.parse(t,[s.a],Object(o.a)({assert:!1},e)))||(r=new s.a([s.c.parse(t,null,e)])),r}constructor(t,e=n.a,r={}){const s=this;s.params=Object(o.a)({},f,r),s.window=t,s.trap=e;var d=[];Object(i.a)(s.window,()=>{Object(h.a)(s.window,"script-autorun")});const g=(t,e)=>s.trap?s.trap.get(t,e):t[e],m=(t,e)=>s.trap?s.trap.deleteProperty(t,e):(delete t[e],!0),j=(t,e,r)=>(s.trap?s.trap.set(t,e,r):t[e]=r,t),v=(t,e)=>(s.trap?s.trap.set(t,e):Object.keys(e).forEach(r=>{t[r]=e[r]}),t),O=function(t){return t[".chtml"]||(t[".chtml"]={}),t[".chtml"].scopedJS||(t[".chtml"].scopedJS={scope:new p(j({super:new p(j({super:w},"main",j({},"this",t)))},"main",{}))},t[".chtml"].scopedJS.scope.observe(s.trap,e=>{t[".chtml"].scopedJS.inWaitlist||y(t,e)})),t[".chtml"].scopedJS},y=function(t,e){var r=O(t);r.inWaitlist=!1;var n={references:(e||{}).references,catch:e=>{2===r.errorLevel?console.error(t,e):0!==r.errorLevel&&console.warn(t,e.message)},trap:s.trap};if(r.AST){var i=r.AST.eval(r.scope,n);Object(l.a)(i)&&i(r.scope.stack.main)}},w=new p(j({super:new p({main:s.window})},"main",{}),{errorLevel:s.params.errorLevel});if(Object(a.b)(s.window,s.params.scriptElement,(t,e)=>{if(!Object(u.a)(s.params.inertContexts,e=>t.closest(e))&&t.parentNode){var r,n=t.parentNode,i=O(n);if(Object(h.a)(s.window,"isomorphic")||t.remove(),i.scriptElement!==t){if(i.scriptElement)throw new Error("An element must only have one scopedJS instance!");if(i.scriptElement=t,r=(t.textContent||"").trim()){var a=[],o=t.hasAttribute("explain")||Object(h.a)(s.window,"script-explain");i.AST=b.parse(r,{explain:o?a:null}),o&&console.log(n,a),i.errorLevel=t.getAttribute("errors")?parseInt(t.getAttribute("errors")):Object(h.a)(s.window,"script-errors"),Object(h.a)(s.window,"script-autorun")||i.hasBindings||t.hasAttribute("autorun")?y(n):(i.inWaitlist=!0,d.push(n))}}}}),s.params.localBindingMethod in s.window.Element.prototype)throw new Error('The "Element" class already has a "'+s.params.localBindingMethod+'" property!');if(Object.defineProperty(s.window.Element.prototype,s.params.localBindingMethod,{value:function(t,e={}){let r=O(this);e.update?v(r.scope.stack.main,t):j(r.scope.stack,"main",t),r.hasBindings=!0,d.includes(this)&&(Object(c.a)(d,this),y(this))}}),"bindings"in s.window.Element.prototype)throw new Error('The "Element" class already has a "bindings" property!');if(Object.defineProperty(s.window.Element.prototype,"bindings",{get:function(){var t=O(this),e=this;return t.scopeInstanceProxy||(t.scopeInstanceProxy=new Proxy(t.scope.stack.main,{set:(r,n,s)=>(j(t.scope.stack.main,n,s),t.hasBindings=!0,d.includes(e)&&(Object(c.a)(d,e),y(e)),!0),get:(e,r)=>g(t.scope.stack.main,r),deleteProperty:(e,r)=>m(t.scope.stack.main,r)})),t.scopeInstanceProxy}}),s.params.globalBindingMethod in s.window.document)throw new Error('document already has a "'+s.params.globalBindingMethod+'" property!');if(Object.defineProperty(s.window.document,s.params.globalBindingMethod,{value:function(t,e={}){var r;for(e.update?v(w.stack.main,t):j(w.stack,"main",t);r=d.shift();)y(r);!0}}),"bindings"in s.window.document)throw new Error('document already has a "bindings" property!');var x;Object.defineProperty(s.window.document,"bindings",{get:function(){return x||(x=new Proxy(w.stack.main,{set:(t,e,r)=>{var n;for(j(w.stack.main,e,r);n=d.shift();)y(n);return!0,!0},get:(t,e)=>g(w.stack.main,e),deleteProperty:(t,e)=>m(w.stack.main,e)})),x}})}}},,,,function(t,e,r){"use strict";r.r(e),new(r(31).a)(window)}]); 2 | //# sourceMappingURL=scoped-js.js.map -------------------------------------------------------------------------------- /docs/1-scoped-html/README.md: -------------------------------------------------------------------------------- 1 | # Scoped HTML 2 | 3 | Scoped HTML is a DOM feature that let's an element establish its own naming context for descendant elements. It makes it possible to keep IDs out of HTML's global namespace and gives us a document that is structured as a hierarchy of *scopes* and *subscopes*. 4 | 5 | ## On this page: 6 | + [Convention](#convention) 7 | + [Scope API](#scope-api) 8 | + [Scope Observability](#scope-observability) 9 | 10 | ## Convention 11 | 12 | Scopes are designated with the `namespace` Boolean attribute. 13 | 14 | The following ID is scoped: 15 | 16 | ```html 17 |
18 |
19 |
20 |
21 |
22 | ``` 23 | 24 | At scale, what we get is a **hierarchy of *scopes* and *subscopes***. 25 | 26 | ```html 27 |
28 |
29 |
About Europe
30 |
Countries in Europe
31 |
32 |
33 |
About Asia
34 |
Countries in Asia
35 |
36 |
37 | ``` 38 | 39 | A mental model of the hierarchy would be: 40 | 41 | ```html 42 | continents 43 | |- europe 44 | | |- about 45 | | |- countries 46 | |- asia 47 | |- about 48 | |- countries 49 | ``` 50 | 51 | #### The Namespace Tree API 52 | 53 | Scoped HTML comes with a *namespace API* that models scope hierarchies. 54 | 55 | ```js 56 | // Get the "continents" article 57 | let continents = document.querySelector('#continents'); 58 | 59 | // Access scoped IDs with the new "namespace" DOM property 60 | let europe = continents.namespace.europe; 61 | let asia = continents.namespace.asia; 62 | 63 | // And for deeply-nested IDs... 64 | let aboutAfrica = continents.namespace.asia.namespace.about; 65 | ``` 66 | 67 | This gives an application a more bankable tree than the DOM tree as it lets a UI block hide its implementation details while exposing its relevant parts by role. 68 | 69 | ### Scope Observability 70 | 71 | An element's `.namespace` property is implemented as a live object that reflects the element's namespace tree in real time. CHTML also supports the [Observer API](https://docs.web-native.dev/observer) for change detection; [`Obs.observe()`](https://docs.web-native.dev/observer/api/observe) can thus be used to observe when IDs enter or exit the namespace. 72 | 73 | ```js 74 | Obs.observe(continents.namespace, changes => { 75 | console.log(changes.map(change => change.name)); 76 | }); 77 | ``` 78 | 79 | With the code below, our observer above should report having added a new ID `africa` to the namespace. 80 | 81 | ```js 82 | continents.append('
'); 83 | ``` 84 | -------------------------------------------------------------------------------- /docs/2-scoped-css/README.md: -------------------------------------------------------------------------------- 1 | # Scoped CSS 2 | 3 | Scoped CSS is currently a subject of discussion for CHTML. Please submit an issue on our github repo should you have a suggestion. 4 | -------------------------------------------------------------------------------- /docs/3-scoped-js/README.md: -------------------------------------------------------------------------------- 1 | # Scoped JS 2 | 3 | Scoped JS is a DOM feature that makes it possible to scope a script to its immediate host element and completely out of the global browser scope. 4 | 5 | ## On this page: 6 | + [Scoped Scripts](#scoped-scripts) 7 | + [Variable Bindings](#variable-bindings) 8 | + [Selective Execution](#selective-execution) 9 | + [Globals](#globals) 10 | + [Runtime](#runtime) 11 | + [Error Handling](#error-handling) 12 | + [Isomorphic Rendering](#isomorphic-rendering) 13 | 14 | ## Scoped Scripts 15 | 16 | Scoped scripts have their `this` variable implicitly bound to their host element. They are defined with the `scoped` MIME type. 17 | 18 | ```html 19 |
20 | 21 | 24 | 25 |
26 | ``` 27 | 28 | This lets us place behaviours just where we need them! This way, we are able to keep the main application layer void of the implementation details of the UI. 29 | 30 | Here's an *#alert* component with a "remove* feature. 31 | 32 | ```html 33 |
34 | 35 |
36 |
X
37 | 38 | 44 | 45 |
46 | ``` 47 | 48 | ## Variable Bindings 49 | 50 | Besides the `this` variable being implicitly bound to the script's host element, other variables in a scoped script are to be explicitly-bound to external values; variables are bound by name. 51 | 52 | Below, we're implementing a `message` variable in our *#alert* component. 53 | 54 | ```html 55 | 56 | 57 |
58 |
59 |
X
60 | 68 |
69 | 70 | 75 | 76 | 77 | ``` 78 | 79 | As shown above, an application simply binds its hard-earned values and is done! 80 | 81 | ## Selective Execution 82 | 83 | Scoped JS follows the normal top-down execution of a script. Calling the `.bind()` method with different variable-bindings reruns the script top-down. But as a UI binding langauge, it also features *Selective Execution* where an update to a variable gets to rerun only the corresponding statements within the script - skipping the other statements. This makes for the most-efficient way to keep a block of the UI in sync with little updates from an application. 84 | 85 | To update a variable or multiple variables, call `.bind()` with a `params` object as a second paremeter and set `params.update` to `true`. 86 | 87 | ```js 88 | alertEl.bind({ 89 | variable2: 'New value', 90 | variable5: 'New value', 91 | }, {update:true}); 92 | ``` 93 | 94 | Also, Scoped JS exposes a new DOM property `.bindings` for selectively updating an element's bindings. 95 | 96 | ```js 97 | alertEl.bindings.variable5 = 'New value', 98 | ``` 99 | 100 | This is illustrated in the clock below. 101 | 102 | ```html 103 | 104 | 105 |
106 | 107 |
108 |
109 | 110 | 114 | 115 |
116 | 117 | 129 | 130 | 131 | ``` 132 | 133 | Scoped JS also supports the [Observer API](https://docs.web-native.dev/observer) for object observability. With Observer, Scoped JS is able to respond to mutations made directly to the bound data object. So, the *#clock* above could be *ticked* by directly updating the data object. 134 | 135 | ```html 136 | 148 | ``` 149 | 150 | Statements may also reference deep mutations made on the bound data object, as in the `clock.currentTime` reference below. 151 | 152 | ```html 153 | 154 | 155 |
156 | 157 |
158 |
159 | 160 | 164 | 165 |
166 | 167 | 181 | 182 | 183 | ``` 184 | 185 | Within the script, the dependency chain is followed even when broken into local variables. Below, a change to `clock.currentTime` will still propagate through `variable1` and `variable2`. (The first and last statements in the script are left untouched touched, as expected.) 186 | 187 | ```html 188 | 189 | 190 |
191 | 192 |
193 |
194 | 195 | 202 | 203 |
204 | 205 | 206 | ``` 207 | 208 | ## Globals 209 | 210 | By default, scoped scripts have no access to anything besides what is explicitly bound into the scope. But they also have an idea of a global scope - that is, bindings seen by every scoped script. This global scope is created by binding on the `document` object itself, using a new `document.bind()` method. 211 | 212 | ```js 213 | document.bind({ 214 | greeting: 'Good Afternoon!', 215 | }); 216 | ``` 217 | 218 | To update a *global* or multiple *globals*, call `document.bind()` with a `params` object as a second paremeter and set `params.update` to `true`. 219 | 220 | ```js 221 | document.bind({ 222 | greeting: 'Good Afternoon!', 223 | }, {update:true}); 224 | ``` 225 | 226 | There is also the `document.bindings` property for selectively updating *globals*. 227 | 228 | ```js 229 | document.bindings.greeting = 'Good Evening!'; 230 | ``` 231 | 232 | ## Runtime 233 | 234 | By design, Scoped JS parses scoped scripts immediately they land on the DOM, but runs them only after the global scope has been initialized with `document.bind()` or the `document.bindings` property. Newer scipts are run immediately after this global runtime initilization. But the runtime of an individual script will begin before the global one on calling the element's `.bind()` method or assigning to its `.bindings` property. 235 | 236 | Alternatively, the `autorun=true` directive may be set on the CHTML META tag. The `autorun` *Boolean* attribute may also be set on individual script elements. 237 | 238 | ```html 239 | 240 | 241 | 242 | 243 | 244 |
245 | 248 |
249 | 250 | 251 | ``` 252 | 253 | Also, it is allowed for an element to receive bindings before its scoped script is appended or is ready to run. The element's runtime begins the first time both are available. 254 | 255 | ```js 256 | alertEl.bind({ 257 | message: 'This task is now complete!', 258 | }); 259 | 260 | // Sometime later 261 | alertEl.append(''); 262 | ``` 263 | 264 | ## Error Handling 265 | 266 | Scoped JS features a way to handle *syntax* or *reference* errors that may occur with scoped scripts. Normally, these are shown in the console as warnings. But they can be silently ignored by setting a directive on the CHTML META tag. Individual scripts may also be given a directive, to override whatever the global directive is. 267 | 268 | ```html 269 | 270 | 271 | 272 | 273 | 274 |

275 | 278 | 279 | 280 | ``` 281 | 282 | ## Isomorphic Rendering 283 | 284 | The script tag of a scoped script is not always needed for the lifetime of the page. They are discarded by default after parsing. But when a page is rendered on the server and has to be *hydrated* by the browser, it becomes necessary to retain these scripts for revival on the browser. This feature is designed to be explicitly turned on with a directive on the CHTML META tag. 285 | 286 | ```html 287 | 288 | 289 | 290 | 291 | 292 |

293 | 296 | 297 | 298 | ``` 299 | 300 | Now, this binding will always be there for when we run the code `document.bind({headline: 'Hello World'})` - whether on the server and on the browser. 301 | 302 | **Environment-Specific Bindings** 303 | 304 | Sometimes, we want certain bindings to apply only on the server; sometimes, only on the browser. For example, animation is only a thing in the browser. This is the perfect use-case for conditionals. 305 | 306 | ```html 307 |
308 | 313 |
314 | ``` 315 | 316 | Above, `condition` could be a simple question about the current environment, and this can be acheived by simply binding a global variable, `env`, for example: `document.bind({env:'server', headline: 'Hello World'})`. 317 | 318 | ```html 319 |
320 | 328 |
329 | ``` -------------------------------------------------------------------------------- /docs/4-html-partials/README.md: -------------------------------------------------------------------------------- 1 | # HTML Partials 2 | 3 | HTML Partials is a DOM feature that lets us define, import, access, and compose with reusable HTML snippets using the *template*, *partials*, and *slots* paradigm. 4 | 5 | ## On this page: 6 | + [Templates, Partials and Slots](#templates-partials-and-slots) 7 | + [Slot Properties](#slot-properties) 8 | + [Nested Templates](#nested-templates) 9 | + [Remote Templates](#remote-templates) 10 | + [Partials API](#partials-api) 11 | + [Isomorphic Rendering](#isomorphic-rendering) 12 | 13 | ## Templates, Partials and Slots 14 | 15 | A *template* is a collection of independent *partials* that can be consumed from anywhere in the main document. 16 | 17 | ```html 18 | 19 | 20 | 24 | 25 | 26 | ``` 27 | 28 | An element in the main document, called the *implementation block* or the *composition area*, can define ``s, and then, point to a `