@twobirds/microcomponents 0.0.61 → 0.0.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,7 +20,7 @@ This systems **modular** approach gives you full control over your software, wit
20
20
 
21
21
  ## Status
22
22
 
23
- **WIP**. Should be done soon. In [manual testing](http://twobirds.gitlab.io/microcomponents/test.html), also working a lot on the documentation.
23
+ **WIP**. Should be done soon. In [manual testing](https://twobirds.gitlab.io/microcomponents/test.html), also working a lot on the documentation.
24
24
 
25
25
  ## General
26
26
 
package/dist/MC.min.js CHANGED
@@ -403,7 +403,7 @@ class DC extends McBase {
403
403
  const CEs = new Map();
404
404
  const MCs = new Map();
405
405
  function makeLoadScript(element) {
406
- const fileName = '/' + element.split('-').join('/') + '.js';
406
+ const fileName = './' + element.split('-').join('/') + '.js';
407
407
  const se = document.createElement('script');
408
408
  se.setAttribute('src', fileName);
409
409
  se.setAttribute('blocking', 'render');
@@ -452,7 +452,7 @@ function loadUndefinedMicroComponents() {
452
452
  && !customElements.get(element.tagName.toLowerCase())
453
453
  && !CEs.has(element.tagName.toLowerCase()))
454
454
  .forEach((el) => {
455
- const elementName = el.tagName.toLowerCase(), fileName = '/' + elementName.split('-').join('/') + '.js';
455
+ const elementName = el.tagName.toLowerCase(), fileName = './' + elementName.split('-').join('/') + '.js';
456
456
  const se = makeLoadScript(elementName);
457
457
  addListener(se, 'load', () => {
458
458
  CEs.set(elementName, customElements.get(el.tagName.toLowerCase()));
package/dist/MC.ts CHANGED
@@ -449,7 +449,7 @@ const MCs = new Map();
449
449
 
450
450
  function makeLoadScript( element: string ): HTMLScriptElement {
451
451
 
452
- const fileName: string = '/' + element.split('-').join('/')+'.js';
452
+ const fileName: string = './' + element.split('-').join('/')+'.js';
453
453
 
454
454
  const se: HTMLScriptElement = document.createElement('script');
455
455
 
@@ -520,7 +520,7 @@ function loadUndefinedMicroComponents() {
520
520
  )
521
521
  .forEach((el) => {
522
522
  const elementName = el.tagName.toLowerCase(),
523
- fileName: string = '/'+elementName.split('-').join('/')+'.js';
523
+ fileName: string = './'+elementName.split('-').join('/')+'.js';
524
524
 
525
525
  const se: HTMLScriptElement = makeLoadScript( elementName );
526
526
 
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.elements=t():e.elements=t()}(this,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{defineCE:()=>j,getCE:()=>M});var n=new Function("try {return this===window;}catch(e){ return false;}");let r=new Set;n()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>r.add(e)));class o{#e;#t=!1;#n=!1;constructor(e,t={},n="l"){this.#e=e,this.data=t,this.bubble=n}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#n}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#n=!0}}var c=new Function("try {return this===window;}catch(e){ return false;}");let s=new Set;function i(e,t){let n=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const r=e?._mc;!t&&r?n=n.concat(Object.values(e._mc)):t&&r&&r[t]&&n.push(r[t])}})),n}function a(e,t,n=!0){let r=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&r.push(e._mc[t]):r=r.concat(Object.values(e._mc)),n))return r;e=e.parentNode}return r}function l(e){return e&&e instanceof HTMLElement}function u(e,t,n,r=!1,o=!1){let c={once:!1};r&&(c.capture=r),o&&(c.once=o),e.addEventListener(t,n,c)}function m(e,t,n={}){let r=e;if(!r._mc){let t=h?.debug;h.debug=!1,r._mc=new h(e),h.debug=t,delete r._mc._mc}const o=r._mc;return t.length&&!o[t]&&(o[t]=n,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),n}function d(e,t){if(!t)return;const n=e?._mc||{};n&&n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function p(e,t,n={},r="l"){let c=e?._mc;if(!c)return;let s=t instanceof o?new o(t.type,t.data,"l"):new o(t,n,"l"),i="string"!=typeof t?t:new o(t,n,r);[...Object.values(c)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(s)})),/[ud]/.test(i.bubble)&&f(e,i)}function f(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let n=a(e,"",!0)?.[0].target;n&&h.trigger(n,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&h.trigger(e,t)}))}),0)}c()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>s.add(e)));class g{#r;constructor(e,t=!1){var n;this.#r=new WeakRef(e||{}),(n=this).constructor!==h&&setTimeout((()=>{n.trigger("Init")}),0),function(e){if(!c()||e.constructor===h)return;const t=e.target;if(t instanceof HTMLElement){let n=e;Object.getOwnPropertyNames(n.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof n.constructor.prototype[e])).forEach((r=>{let o=/^one/.test(r),c=r.replace(/^on[e]{0,1}/,""),i=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{n.constructor.prototype[r].bind(n)(e)}}),s.has("on"+i)&&u(t,i,(e=>{n.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#r.deref()}}class b extends g{_mc={};constructor(e){super(e)}static trigger=p;trigger(e,t={},n="l"){let r=this;if(r.constructor===b||r.constructor===h){let c=e instanceof o?new o(e.type,e.data,"l"):new o(e,t,"l"),s="string"!=typeof e?e:new o(e,t,n);return[...Object.getOwnPropertyNames(r)].forEach((e=>{r[e]?.trigger&&"function"==typeof r[e]?.trigger&&r[e]?.trigger(c)})),void(/[ud]/.test(s.bubble)&&f(r.target,s))}if(r instanceof b||r instanceof h){const r=this,c="string"!=typeof e?e:new o(e,t,n),s="on"+c.type[0].toUpperCase()+c.type.slice(1);if(c.bubble.indexOf("l")>-1&&(c.immediateStopped||"function"!=typeof r[s]||(r[s](c),r.hasOwnProperty(s)&&delete r[s])),c.stopped||"l"===c.bubble)return r;/[ud]/.test(c.bubble)&&f(r.target,c)}}}class h extends g{_mc={};constructor(e,t=!1){super(e)}static add=m;static remove=d;static trigger=p;trigger(e,t={},n){b.prototype.trigger.call(this,e,t,n)}parent(e=""){let t=this.target;return l(t)?a(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return l(t)?a(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!l(t))return[];const n=Math.random().toString().replace(".",""),r='[_mc]:not([temp_id="'+n+'"] [_mc] [_mc])';t.setAttribute("temp_id",n);const o=i([...t.querySelectorAll(r)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return l(t)?i([...t.querySelectorAll("*[_mc]")],e):[]}}const y=new Map,w=new Map;function _(e){const t="/"+e.split("-").join("/")+".js",n=document.createElement("script");return n.setAttribute("src",t),n.setAttribute("blocking","render"),n.async=!0,n.setAttribute("type","module"),n.setAttribute("name",e),n.setAttribute("loading",""),u(n,"load",(e=>{n.removeAttribute("loading"),n.setAttribute("loaded","")})),u(n,"error",(e=>{console.error("could not load Custom Element code from",t)})),n}function E(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!y.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),n=(t.split("-").join("/"),_(t));u(n,"load",(()=>{y.set(t,customElements.get(e.tagName.toLowerCase()))})),y.set(t,"loading"),document.head.append(n)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],n=t.filter((e=>!w.has(e)));n?.forEach((e=>{const t=_(e);u(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),n=t.getAttribute("name"),r=document.createElement("script");r.async=!0,r.setAttribute("type","module");const o=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${n}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${n}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${n}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${n}]"')?.remove();\n},0);`;r.innerHTML=o,document.body.append(r)}),0);var t})),w.set(e,"loading"),document.head.append(t)}));const r=t.filter((e=>w.has(e)&&!w.get(e).length));r?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,v.state.MCs.get(t)),h.add(e,t,new(v.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let A=!1,C=null;function v(e=!0){return e?(A=e,C=new MutationObserver(E),setTimeout((()=>{C.observe(document.body,{childList:!0,subtree:!0}),E()}),5),A):(C?.disconnect(),C=null,A)}v.state={CEs:y,MCs:w};class O extends HTMLElement{constructor(){super()}connectedCallback(){h.trigger(this,"Connected")}disconnectedCallback(){h.trigger(this,"Disconnected")}adoptedCallback(){h.trigger(this,"Adopted")}attributeChangedCallback(e,t,n){h.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:n})}}function j(e,t,n=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let r=e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("");customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(r,class extends O{instance;constructor(e){super();let n=new t(this,e);h.add(this,r,n)}static get observedAttributes(){return n}}))}function M(e){return customElements.get(e)}return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.elements=t():e.elements=t()}(this,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{defineCE:()=>j,getCE:()=>M});var n=new Function("try {return this===window;}catch(e){ return false;}");let r=new Set;n()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>r.add(e)));class o{#e;#t=!1;#n=!1;constructor(e,t={},n="l"){this.#e=e,this.data=t,this.bubble=n}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#n}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#n=!0}}var c=new Function("try {return this===window;}catch(e){ return false;}");let s=new Set;function i(e,t){let n=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const r=e?._mc;!t&&r?n=n.concat(Object.values(e._mc)):t&&r&&r[t]&&n.push(r[t])}})),n}function a(e,t,n=!0){let r=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&r.push(e._mc[t]):r=r.concat(Object.values(e._mc)),n))return r;e=e.parentNode}return r}function l(e){return e&&e instanceof HTMLElement}function u(e,t,n,r=!1,o=!1){let c={once:!1};r&&(c.capture=r),o&&(c.once=o),e.addEventListener(t,n,c)}function m(e,t,n={}){let r=e;if(!r._mc){let t=h?.debug;h.debug=!1,r._mc=new h(e),h.debug=t,delete r._mc._mc}const o=r._mc;return t.length&&!o[t]&&(o[t]=n,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),n}function d(e,t){if(!t)return;const n=e?._mc||{};n&&n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function p(e,t,n={},r="l"){let c=e?._mc;if(!c)return;let s=t instanceof o?new o(t.type,t.data,"l"):new o(t,n,"l"),i="string"!=typeof t?t:new o(t,n,r);[...Object.values(c)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(s)})),/[ud]/.test(i.bubble)&&f(e,i)}function f(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let n=a(e,"",!0)?.[0].target;n&&h.trigger(n,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&h.trigger(e,t)}))}),0)}c()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>s.add(e)));class g{#r;constructor(e,t=!1){var n;this.#r=new WeakRef(e||{}),(n=this).constructor!==h&&setTimeout((()=>{n.trigger("Init")}),0),function(e){if(!c()||e.constructor===h)return;const t=e.target;if(t instanceof HTMLElement){let n=e;Object.getOwnPropertyNames(n.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof n.constructor.prototype[e])).forEach((r=>{let o=/^one/.test(r),c=r.replace(/^on[e]{0,1}/,""),i=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{n.constructor.prototype[r].bind(n)(e)}}),s.has("on"+i)&&u(t,i,(e=>{n.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#r.deref()}}class b extends g{_mc={};constructor(e){super(e)}static trigger=p;trigger(e,t={},n="l"){let r=this;if(r.constructor===b||r.constructor===h){let c=e instanceof o?new o(e.type,e.data,"l"):new o(e,t,"l"),s="string"!=typeof e?e:new o(e,t,n);return[...Object.getOwnPropertyNames(r)].forEach((e=>{r[e]?.trigger&&"function"==typeof r[e]?.trigger&&r[e]?.trigger(c)})),void(/[ud]/.test(s.bubble)&&f(r.target,s))}if(r instanceof b||r instanceof h){const r=this,c="string"!=typeof e?e:new o(e,t,n),s="on"+c.type[0].toUpperCase()+c.type.slice(1);if(c.bubble.indexOf("l")>-1&&(c.immediateStopped||"function"!=typeof r[s]||(r[s](c),r.hasOwnProperty(s)&&delete r[s])),c.stopped||"l"===c.bubble)return r;/[ud]/.test(c.bubble)&&f(r.target,c)}}}class h extends g{_mc={};constructor(e,t=!1){super(e)}static add=m;static remove=d;static trigger=p;trigger(e,t={},n){b.prototype.trigger.call(this,e,t,n)}parent(e=""){let t=this.target;return l(t)?a(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return l(t)?a(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!l(t))return[];const n=Math.random().toString().replace(".",""),r='[_mc]:not([temp_id="'+n+'"] [_mc] [_mc])';t.setAttribute("temp_id",n);const o=i([...t.querySelectorAll(r)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return l(t)?i([...t.querySelectorAll("*[_mc]")],e):[]}}const y=new Map,w=new Map;function _(e){const t="./"+e.split("-").join("/")+".js",n=document.createElement("script");return n.setAttribute("src",t),n.setAttribute("blocking","render"),n.async=!0,n.setAttribute("type","module"),n.setAttribute("name",e),n.setAttribute("loading",""),u(n,"load",(e=>{n.removeAttribute("loading"),n.setAttribute("loaded","")})),u(n,"error",(e=>{console.error("could not load Custom Element code from",t)})),n}function E(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!y.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),n=(t.split("-").join("/"),_(t));u(n,"load",(()=>{y.set(t,customElements.get(e.tagName.toLowerCase()))})),y.set(t,"loading"),document.head.append(n)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],n=t.filter((e=>!w.has(e)));n?.forEach((e=>{const t=_(e);u(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),n=t.getAttribute("name"),r=document.createElement("script");r.async=!0,r.setAttribute("type","module");const o=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${n}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${n}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${n}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${n}]"')?.remove();\n},0);`;r.innerHTML=o,document.body.append(r)}),0);var t})),w.set(e,"loading"),document.head.append(t)}));const r=t.filter((e=>w.has(e)&&!w.get(e).length));r?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,v.state.MCs.get(t)),h.add(e,t,new(v.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let A=!1,C=null;function v(e=!0){return e?(A=e,C=new MutationObserver(E),setTimeout((()=>{C.observe(document.body,{childList:!0,subtree:!0}),E()}),5),A):(C?.disconnect(),C=null,A)}v.state={CEs:y,MCs:w};class O extends HTMLElement{constructor(){super()}connectedCallback(){h.trigger(this,"Connected")}disconnectedCallback(){h.trigger(this,"Disconnected")}adoptedCallback(){h.trigger(this,"Adopted")}attributeChangedCallback(e,t,n){h.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:n})}}function j(e,t,n=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let r=e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("");customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(r,class extends O{instance;constructor(e){super();let n=new t(this,e);h.add(this,r,n)}static get observedAttributes(){return n}}))}function M(e){return customElements.get(e)}return t})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.formValues=t():e.formValues=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var o;(o=e[n])&&o.constructor&&o.constructor===Object?t[n]=r(e[n]):t[n]=e[n]})),t}function n(e,t=!0){let o={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const r=n(e[t],!1);for(const e in r)o[t+"."+e]=r[e]}else o[t]=e[t]})),t?r(o):o}function o(e,t){return JSON.stringify(n(e))===JSON.stringify(n(t))}function c(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function s(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{formValues:()=>J});var a=new Function("try {return this===window;}catch(e){ return false;}");let l=new Set;a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>l.add(e)));class i{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var u=new Function("try {return this===window;}catch(e){ return false;}");let f=new Set;function d(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function m(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function p(e){return e&&e instanceof HTMLElement}function b(e,t,r,n=!1,o=!1){let c={once:!1};n&&(c.capture=n),o&&(c.once=o),e.addEventListener(t,r,c)}function g(e,t,r={}){let n=e;if(!n._mc){let t=E?.debug;E.debug=!1,n._mc=new E(e),E.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function h(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function y(e,t,r={},n="l"){let o=e?._mc;if(!o)return;let c=t instanceof i?new i(t.type,t.data,"l"):new i(t,r,"l"),s="string"!=typeof t?t:new i(t,r,n);[...Object.values(o)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(s.bubble)&&O(e,s)}function O(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=m(e,"",!0)?.[0].target;r&&E.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&E.trigger(e,t)}))}),0)}u()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>f.add(e)));class v{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==E&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!u()||e.constructor===E)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),c=n.replace(/^on[e]{0,1}/,""),s=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),f.has("on"+s)&&b(t,s,(e=>{r.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class w extends v{_mc={};constructor(e){super(e)}static trigger=y;trigger(e,t={},r="l"){let n=this;if(n.constructor===w||n.constructor===E){let o=e instanceof i?new i(e.type,e.data,"l"):new i(e,t,"l"),c="string"!=typeof e?e:new i(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(o)})),void(/[ud]/.test(c.bubble)&&O(n.target,c))}if(n instanceof w||n instanceof E){const n=this,o="string"!=typeof e?e:new i(e,t,r),c="on"+o.type[0].toUpperCase()+o.type.slice(1);if(o.bubble.indexOf("l")>-1&&(o.immediateStopped||"function"!=typeof n[c]||(n[c](o),n.hasOwnProperty(c)&&delete n[c])),o.stopped||"l"===o.bubble)return n;/[ud]/.test(o.bubble)&&O(n.target,o)}}}class E extends v{_mc={};constructor(e,t=!1){super(e)}static add=g;static remove=h;static trigger=y;trigger(e,t={},r){w.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return p(t)?m(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return p(t)?m(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!p(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=d([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return p(t)?d([...t.querySelectorAll("*[_mc]")],e):[]}}const A=new Map,_=new Map;function j(e){const t="/"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),b(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),b(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function S(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!A.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),j(t));b(r,"load",(()=>{A.set(t,customElements.get(e.tagName.toLowerCase()))})),A.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!_.has(e)));r?.forEach((e=>{const t=j(e);b(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const o=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=o,document.body.append(n)}),0);var t})),_.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>_.has(e)&&!_.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,N.state.MCs.get(t)),E.add(e,t,new(N.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let T=!1,k=null;function N(e=!0){return e?(T=e,k=new MutationObserver(S),setTimeout((()=>{k.observe(document.body,{childList:!0,subtree:!0}),S()}),5),T):(k?.disconnect(),k=null,T)}function C(e){return null!=e&&"object"==typeof e}function M(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,"")))}N.state={CEs:A,MCs:_};const L=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class x extends E{data={};oldDisplay="";constructor(e){super(e);let t=this;M(e).forEach((e=>t.data[e]="")),P(t),t.#o(),delete t._mc}#o(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var o;e.data.observe((o=t.getAttribute(r),e=>{let c=o;n.forEach((t=>{c=c.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,c)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let o=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var c;e.data.observe((c=n.nodeValue,r=>{let s=c;o.forEach((e=>{s=s.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=s})),e.oldDisplay=t.getAttribute("style)")||"",r&&!L.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const P=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,a=e[t];if(!a.prototype)switch(typeof a){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=a instanceof Array?Array:Object;break;default:return}let l=class extends r{#c=!0;constructor(e){super(e),this.constructor.callbacks=[],C(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(C(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!M(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||E.add(e,"_placeholders",new x(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),o=function(e){let t=n(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(o),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=C(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#c=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},i=new l(a);Object.defineProperty(e,t,{enumerable:!0,get(){if(C(i.valueOf())){let e=structuredClone(Object.assign({},i));setTimeout(c((function(){o(structuredClone(Object.assign({},i)),e)||i.notify()}),0),0)}return i},set(e){if(typeof e==typeof i.valueOf())if(C(i.valueOf())&&i.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},i));i instanceof l==0&&(i=new l(structuredClone(Object.assign({},e))),s(e,i),i.seal()),Object.assign(i,e),setTimeout(c((function(){o(structuredClone(Object.assign({},i)),t)||i.notify()}),0),0)}else{let t=i.valueOf(),r=i.constructor.callbacks;i=new l(e),i.constructor.callbacks=r,e!==t&&i.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof i.valueOf(),i,"- CANNOT BECOME:",typeof e)}}),e[t]=a})),e);class q{constructor(e){}}class D extends q{#s;constructor(e){super(e),this.#s=e}get val(){return new FormData(this.#s.form).get(this.#s.name)}set val(e){[...this.#s.form.querySelectorAll(`input[type="radio"][name="${this.#s.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class H extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.checked}set val(e){this.#s.checked=e}}class V extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}class I extends q{#s;#a=!1;constructor(e){super(e),this.#s=e,this.#a=e.multiple}get val(){const e=[];return[...this.#s.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#a?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#s.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class $ extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value||""}set val(e){this.#s.value=e}}const F=e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new D(e);break;case"checkbox":n=new H(e);break;default:n=new V(e)}break;case"select":n=new I(e);break;case"textarea":n=new $(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(E.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r};function J(e,t,r){let n=F(r);e[t]=Object.assign({},n),P(e,t),s(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{b(r,"keyup",(r=>{e[t].notify()})),b(r,"change",(r=>{e[t].notify()})),b(r,"select",(r=>{e[t].notify()}))}))}return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.formValues=t():e.formValues=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var o;(o=e[n])&&o.constructor&&o.constructor===Object?t[n]=r(e[n]):t[n]=e[n]})),t}function n(e,t=!0){let o={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const r=n(e[t],!1);for(const e in r)o[t+"."+e]=r[e]}else o[t]=e[t]})),t?r(o):o}function o(e,t){return JSON.stringify(n(e))===JSON.stringify(n(t))}function c(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function s(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{formValues:()=>J});var a=new Function("try {return this===window;}catch(e){ return false;}");let l=new Set;a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>l.add(e)));class i{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var u=new Function("try {return this===window;}catch(e){ return false;}");let f=new Set;function d(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function m(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function p(e){return e&&e instanceof HTMLElement}function b(e,t,r,n=!1,o=!1){let c={once:!1};n&&(c.capture=n),o&&(c.once=o),e.addEventListener(t,r,c)}function g(e,t,r={}){let n=e;if(!n._mc){let t=E?.debug;E.debug=!1,n._mc=new E(e),E.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function h(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function y(e,t,r={},n="l"){let o=e?._mc;if(!o)return;let c=t instanceof i?new i(t.type,t.data,"l"):new i(t,r,"l"),s="string"!=typeof t?t:new i(t,r,n);[...Object.values(o)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(s.bubble)&&O(e,s)}function O(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=m(e,"",!0)?.[0].target;r&&E.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&E.trigger(e,t)}))}),0)}u()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>f.add(e)));class v{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==E&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!u()||e.constructor===E)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),c=n.replace(/^on[e]{0,1}/,""),s=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),f.has("on"+s)&&b(t,s,(e=>{r.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class w extends v{_mc={};constructor(e){super(e)}static trigger=y;trigger(e,t={},r="l"){let n=this;if(n.constructor===w||n.constructor===E){let o=e instanceof i?new i(e.type,e.data,"l"):new i(e,t,"l"),c="string"!=typeof e?e:new i(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(o)})),void(/[ud]/.test(c.bubble)&&O(n.target,c))}if(n instanceof w||n instanceof E){const n=this,o="string"!=typeof e?e:new i(e,t,r),c="on"+o.type[0].toUpperCase()+o.type.slice(1);if(o.bubble.indexOf("l")>-1&&(o.immediateStopped||"function"!=typeof n[c]||(n[c](o),n.hasOwnProperty(c)&&delete n[c])),o.stopped||"l"===o.bubble)return n;/[ud]/.test(o.bubble)&&O(n.target,o)}}}class E extends v{_mc={};constructor(e,t=!1){super(e)}static add=g;static remove=h;static trigger=y;trigger(e,t={},r){w.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return p(t)?m(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return p(t)?m(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!p(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=d([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return p(t)?d([...t.querySelectorAll("*[_mc]")],e):[]}}const A=new Map,_=new Map;function j(e){const t="./"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),b(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),b(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function S(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!A.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),j(t));b(r,"load",(()=>{A.set(t,customElements.get(e.tagName.toLowerCase()))})),A.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!_.has(e)));r?.forEach((e=>{const t=j(e);b(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const o=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=o,document.body.append(n)}),0);var t})),_.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>_.has(e)&&!_.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,N.state.MCs.get(t)),E.add(e,t,new(N.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let T=!1,k=null;function N(e=!0){return e?(T=e,k=new MutationObserver(S),setTimeout((()=>{k.observe(document.body,{childList:!0,subtree:!0}),S()}),5),T):(k?.disconnect(),k=null,T)}function C(e){return null!=e&&"object"==typeof e}function M(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,"")))}N.state={CEs:A,MCs:_};const L=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class x extends E{data={};oldDisplay="";constructor(e){super(e);let t=this;M(e).forEach((e=>t.data[e]="")),P(t),t.#o(),delete t._mc}#o(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var o;e.data.observe((o=t.getAttribute(r),e=>{let c=o;n.forEach((t=>{c=c.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,c)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let o=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var c;e.data.observe((c=n.nodeValue,r=>{let s=c;o.forEach((e=>{s=s.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=s})),e.oldDisplay=t.getAttribute("style)")||"",r&&!L.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const P=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,a=e[t];if(!a.prototype)switch(typeof a){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=a instanceof Array?Array:Object;break;default:return}let l=class extends r{#c=!0;constructor(e){super(e),this.constructor.callbacks=[],C(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(C(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!M(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||E.add(e,"_placeholders",new x(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),o=function(e){let t=n(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(o),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=C(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#c=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},i=new l(a);Object.defineProperty(e,t,{enumerable:!0,get(){if(C(i.valueOf())){let e=structuredClone(Object.assign({},i));setTimeout(c((function(){o(structuredClone(Object.assign({},i)),e)||i.notify()}),0),0)}return i},set(e){if(typeof e==typeof i.valueOf())if(C(i.valueOf())&&i.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},i));i instanceof l==0&&(i=new l(structuredClone(Object.assign({},e))),s(e,i),i.seal()),Object.assign(i,e),setTimeout(c((function(){o(structuredClone(Object.assign({},i)),t)||i.notify()}),0),0)}else{let t=i.valueOf(),r=i.constructor.callbacks;i=new l(e),i.constructor.callbacks=r,e!==t&&i.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof i.valueOf(),i,"- CANNOT BECOME:",typeof e)}}),e[t]=a})),e);class q{constructor(e){}}class D extends q{#s;constructor(e){super(e),this.#s=e}get val(){return new FormData(this.#s.form).get(this.#s.name)}set val(e){[...this.#s.form.querySelectorAll(`input[type="radio"][name="${this.#s.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class H extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.checked}set val(e){this.#s.checked=e}}class V extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}class I extends q{#s;#a=!1;constructor(e){super(e),this.#s=e,this.#a=e.multiple}get val(){const e=[];return[...this.#s.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#a?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#s.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class $ extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value||""}set val(e){this.#s.value=e}}const F=e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new D(e);break;case"checkbox":n=new H(e);break;default:n=new V(e)}break;case"select":n=new I(e);break;case"textarea":n=new $(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(E.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r};function J(e,t,r){let n=F(r);e[t]=Object.assign({},n),P(e,t),s(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{b(r,"keyup",(r=>{e[t].notify()})),b(r,"change",(r=>{e[t].notify()})),b(r,"select",(r=>{e[t].notify()}))}))}return t})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microcomponents=t():e.microcomponents=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return e&&e.constructor&&e.constructor===Object}function n(e){let t={};return[...Object.keys(e)].sort().forEach((a=>{r(e[a])?t[a]=n(e[a]):t[a]=e[a]})),t}function a(e,t=!0){let r={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const n=a(e[t],!1);for(const e in n)r[t+"."+e]=n[e]}else r[t]=e[t]})),t?n(r):r}function s(e,t){return JSON.stringify(a(e))===JSON.stringify(a(t))}function o(e,t={}){let r=e.constructor===String?e.split("."):e;if(t&&r[0]&&t[r[0]])return t[r[0]].constructor===Object&&r.length>1?o(r.splice(1),t[r[0]]):t[r[0]];console.warn("ns",r[0],"not in",t)}function c(e,t){var n=Array.from(arguments);if(n.length>2){for(;n.length>1;)n[0]=c(n[0],n[1]),n.splice(1,1);return n[0]}if("string"==typeof e)e.match(/\{[^\{\}]*\}/g)?.forEach((function(r){var n=o(r.substring(1,r.length-1),t);void 0!==n&&(e=e.replace(r,n))}));else if(r(e))switch(e.constructor){case Object:Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&(e[r]=c(e[r],t))}));break;case Array:e.forEach((function(r,n,a){a[n]=c(e[n],t)}))}return e}function i(e){return e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function l(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function u(e){let t=document.createElement("template");return e=e.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),t.innerHTML=e,t.content.normalize(),Array.from(t.content.childNodes)}function f(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{$d:()=>Q,$t:()=>X,DC:()=>k,MC:()=>x,McBase:()=>_,McEvent:()=>p,addListener:()=>v,autoload:()=>P,copyGettersSetters:()=>f,debounce:()=>l,deepEqual:()=>s,defineCE:()=>q,flattenObject:()=>a,formValues:()=>ce,getCE:()=>D,htmlToElements:()=>u,isNativeObject:()=>r,kebabToPascal:()=>i,nameSpace:()=>o,observe:()=>J,parse:()=>c,removeListener:()=>w,sortObject:()=>n});var h=new Function("try {return this===window;}catch(e){ return false;}");let d=new Set;h()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>d.add(e)));class p{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var m=new Function("try {return this===window;}catch(e){ return false;}");let g=new Set;function b(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function y(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function E(e){return e&&e instanceof HTMLElement}function v(e,t,r,n=!1,a=!1){let s={once:!1};n&&(s.capture=n),a&&(s.once=a),e.addEventListener(t,r,s)}function w(e,t,r){e.removeEventListener(t,r)}function O(e,t,r={}){let n=e;if(!n._mc){let t=k?.debug;k.debug=!1,n._mc=new k(e),k.debug=t,delete n._mc._mc}const a=n._mc;return t.length&&!a[t]&&(a[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function A(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function S(e,t,r={},n="l"){let a=e?._mc;if(!a)return;let s=t instanceof p?new p(t.type,t.data,"l"):new p(t,r,"l"),o="string"!=typeof t?t:new p(t,r,n);[...Object.values(a)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(s)})),/[ud]/.test(o.bubble)&&j(e,o)}function j(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=y(e,"",!0)?.[0].target;r&&k.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&k.trigger(e,t)}))}),0)}m()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>g.add(e)));class _{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==k&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!m()||e.constructor===k)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let a=/^one/.test(n),s=n.replace(/^on[e]{0,1}/,""),o=s.toLowerCase();a&&Object.defineProperty(e,"on"+s,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),g.has("on"+o)&&v(t,o,(e=>{r.trigger(s,e)}),!1,a)}))}}(this)}get target(){return this.#n.deref()}}class x extends _{_mc={};constructor(e){super(e)}static trigger=S;trigger(e,t={},r="l"){let n=this;if(n.constructor===x||n.constructor===k){let a=e instanceof p?new p(e.type,e.data,"l"):new p(e,t,"l"),s="string"!=typeof e?e:new p(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(a)})),void(/[ud]/.test(s.bubble)&&j(n.target,s))}if(n instanceof x||n instanceof k){const n=this,a="string"!=typeof e?e:new p(e,t,r),s="on"+a.type[0].toUpperCase()+a.type.slice(1);if(a.bubble.indexOf("l")>-1&&(a.immediateStopped||"function"!=typeof n[s]||(n[s](a),n.hasOwnProperty(s)&&delete n[s])),a.stopped||"l"===a.bubble)return n;/[ud]/.test(a.bubble)&&j(n.target,a)}}}class k extends _{_mc={};constructor(e,t=!1){super(e)}static add=O;static remove=A;static trigger=S;trigger(e,t={},r){x.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return E(t)?y(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return E(t)?y(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!E(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const a=b([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),a}descendants(e=""){let t=this?.target;return E(t)?b([...t.querySelectorAll("*[_mc]")],e):[]}}const T=new Map,C=new Map;function N(e){const t="/"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),v(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),v(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function L(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!T.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),N(t));v(r,"load",(()=>{T.set(t,customElements.get(e.tagName.toLowerCase()))})),T.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!C.has(e)));r?.forEach((e=>{const t=N(e);v(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const a=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=a,document.body.append(n)}),0);var t})),C.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>C.has(e)&&!C.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,P.state.MCs.get(t)),k.add(e,t,new(P.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let M=!1,$=null;function P(e=!0){return e?(M=e,$=new MutationObserver(L),setTimeout((()=>{$.observe(document.body,{childList:!0,subtree:!0}),L()}),5),M):($?.disconnect(),$=null,M)}P.state={CEs:T,MCs:C};class H extends HTMLElement{constructor(){super()}connectedCallback(){k.trigger(this,"Connected")}disconnectedCallback(){k.trigger(this,"Disconnected")}adoptedCallback(){k.trigger(this,"Adopted")}attributeChangedCallback(e,t,r){k.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:r})}}function q(e,t,r=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let n=i(e);customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(n,class extends H{instance;constructor(e){super();let r=new t(this,e);k.add(this,n,r)}static get observedAttributes(){return r}}))}function D(e){return customElements.get(e)}function I(e){return null!=e&&"object"==typeof e}function B(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,"")))}const V=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class z extends k{data={};oldDisplay="";constructor(e){super(e);let t=this;B(e).forEach((e=>t.data[e]="")),J(t),t.#a(),delete t._mc}#a(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var a;e.data.observe((a=t.getAttribute(r),e=>{let s=a;n.forEach((t=>{s=s.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,s)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let a=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var s;e.data.observe((s=n.nodeValue,r=>{let o=s;a.forEach((e=>{o=o.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=o})),e.oldDisplay=t.getAttribute("style)")||"",r&&!V.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const J=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,n=e[t];if(!n.prototype)switch(typeof n){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=n instanceof Array?Array:Object;break;default:return}let o=class extends r{#s=!0;constructor(e){super(e),this.constructor.callbacks=[],I(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(I(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!B(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||k.add(e,"_placeholders",new z(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),n=function(e){let t=a(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(n),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=I(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#s=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},c=new o(n);Object.defineProperty(e,t,{enumerable:!0,get(){if(I(c.valueOf())){let e=structuredClone(Object.assign({},c));setTimeout(l((function(){s(structuredClone(Object.assign({},c)),e)||c.notify()}),0),0)}return c},set(e){if(typeof e==typeof c.valueOf())if(I(c.valueOf())&&c.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},c));c instanceof o==0&&(c=new o(structuredClone(Object.assign({},e))),f(e,c),c.seal()),Object.assign(c,e),setTimeout(l((function(){s(structuredClone(Object.assign({},c)),t)||c.notify()}),0),0)}else{let t=c.valueOf(),r=c.constructor.callbacks;c=new o(e),c.constructor.callbacks=r,e!==t&&c.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof c.valueOf(),c,"- CANNOT BECOME:",typeof e)}}),e[t]=n})),e),F=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},G=e=>{let t=Q("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let a;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":a=new W(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"select":a=new Z(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"textarea":a=new U(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class R{constructor(e){}}class W extends R{#o;#e;#c;constructor(e,t){super(e),this.#o=e,this.#e=e.type,this.#c=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=Q(`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,this.#c).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#o.checked;default:return t.#o.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,n=Q(r,this.#c);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const a=n.filter((t=>t.getAttribute("value")===e));if(!a.length)return;return void(a.array[0].checked=!0);case"checkbox":t.#o.checked=e;break;default:t.#o.value=e}}}class Z extends R{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i="select-multiple"===e.type}get val(){const e=[];return Q(this.#o.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,Q(this.#o.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class U extends R{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class Y{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new K;return this.#l.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return Q(e,t).forEach((e=>{r.#l.add(e)})),r}addClass(...e){return e=F(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=Q(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=Q(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=Q(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{Q(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=Q(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,a=!1;return e&&(a=Q(e,t)),r.#l.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=Q([...n]),e&&r.filter((e=>a.has(e))),r}has(e){return this.#l.has(e)}hasClass(...e){return e=F(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)+1;a<r.length&&n.add(r.at(a))}})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#l.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){w(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let a=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(a,Array.from(arguments))}return o.cb=t,a.forEach((e=>{s.forEach((function(t){v(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e,t,s,r,!0)}))})),s}parent(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=Q(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)-1;a>-1&&n.add(r.at(a))}})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=F(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=F(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,a=!1){let s,o={bubbles:r,cancelable:n,composed:a},c=e.indexOf(" ")>-1?e.split(" "):[e];return this.#l.forEach((e=>{c.forEach((function(r){s=new Event(r,o),s.data=t,e.dispatchEvent(s)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,a=G(r.array[0]);var s;return e?null!=(s=e)&&"object"==typeof s?(Object.assign(a,e),n=r):"string"==typeof e&&(void 0===t?n=a[e]:(a[e]=t,n=r)):n=Object.assign({},a),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=G(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return Q(this.array.at(e))}concat(e){let t=this;return(e instanceof Y?e.array:e).forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#l=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#l.add(e)})),this}shift(){let e=this,t=e.#l.size?e.array[0]:void 0;return t&&e.#l.delete(t),t}slice(e,t){return Q(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),Q(n)}}class K{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}set length(e){}constructor(e,t=document.body){if(!e)return this;Q(e,t).forEach((e=>{X(e).forEach((e=>{this.#l.add(e)}))}))}$d(e,t=document.body){let r=new Y,n=new Set,a=!!e||!1,s=new Set;return a&&(s=Q(e,t).set),this.#l.forEach((e=>{a&&!s.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}descendants(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}first(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#l.has(e)}last(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);X([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){w(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e._tg,`[TB]${t}`,s,!1,r)}))})),s}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(r,Array.from(arguments))}return a.cb=t,r.forEach((e=>{n.forEach((function(t){v(e._tg,`[TB]${t}`,a,!1,!0)}))})),a}parent(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}parents(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}prev(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);X([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return X(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return X(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#l=new Set(e),t}push(e){return this.#l.add(e),this}shift(){let e=this.array.shift();return this.#l.delete(e),e}slice(e,t){return X(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return X(n)}}const Q=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{Q(e,t).forEach((e=>{r.add(e)}))})),new Y([...r])):new Y(e,t)},X=(e,t=document)=>Q(e,t).$t();class ee{constructor(e){}}class te extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return new FormData(this.#o.form).get(this.#o.name)}set val(e){[...this.#o.form.querySelectorAll(`input[type="radio"][name="${this.#o.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class re extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.checked}set val(e){this.#o.checked=e}}class ne extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class ae extends ee{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i=e.multiple}get val(){const e=[];return[...this.#o.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#o.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class se extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value||""}set val(e){this.#o.value=e}}const oe=e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new te(e);break;case"checkbox":n=new re(e);break;default:n=new ne(e)}break;case"select":n=new ae(e);break;case"textarea":n=new se(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(k.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r};function ce(e,t,r){let n=oe(r);e[t]=Object.assign({},n),J(e,t),f(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{v(r,"keyup",(r=>{e[t].notify()})),v(r,"change",(r=>{e[t].notify()})),v(r,"select",(r=>{e[t].notify()}))}))}return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microcomponents=t():e.microcomponents=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return e&&e.constructor&&e.constructor===Object}function n(e){let t={};return[...Object.keys(e)].sort().forEach((a=>{r(e[a])?t[a]=n(e[a]):t[a]=e[a]})),t}function a(e,t=!0){let r={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const n=a(e[t],!1);for(const e in n)r[t+"."+e]=n[e]}else r[t]=e[t]})),t?n(r):r}function s(e,t){return JSON.stringify(a(e))===JSON.stringify(a(t))}function o(e,t={}){let r=e.constructor===String?e.split("."):e;if(t&&r[0]&&t[r[0]])return t[r[0]].constructor===Object&&r.length>1?o(r.splice(1),t[r[0]]):t[r[0]];console.warn("ns",r[0],"not in",t)}function c(e,t){var n=Array.from(arguments);if(n.length>2){for(;n.length>1;)n[0]=c(n[0],n[1]),n.splice(1,1);return n[0]}if("string"==typeof e)e.match(/\{[^\{\}]*\}/g)?.forEach((function(r){var n=o(r.substring(1,r.length-1),t);void 0!==n&&(e=e.replace(r,n))}));else if(r(e))switch(e.constructor){case Object:Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&(e[r]=c(e[r],t))}));break;case Array:e.forEach((function(r,n,a){a[n]=c(e[n],t)}))}return e}function i(e){return e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function l(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function u(e){let t=document.createElement("template");return e=e.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),t.innerHTML=e,t.content.normalize(),Array.from(t.content.childNodes)}function f(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{$d:()=>Q,$t:()=>X,DC:()=>k,MC:()=>x,McBase:()=>_,McEvent:()=>p,addListener:()=>v,autoload:()=>P,copyGettersSetters:()=>f,debounce:()=>l,deepEqual:()=>s,defineCE:()=>q,flattenObject:()=>a,formValues:()=>ce,getCE:()=>D,htmlToElements:()=>u,isNativeObject:()=>r,kebabToPascal:()=>i,nameSpace:()=>o,observe:()=>J,parse:()=>c,removeListener:()=>w,sortObject:()=>n});var h=new Function("try {return this===window;}catch(e){ return false;}");let d=new Set;h()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>d.add(e)));class p{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var m=new Function("try {return this===window;}catch(e){ return false;}");let g=new Set;function b(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function y(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function E(e){return e&&e instanceof HTMLElement}function v(e,t,r,n=!1,a=!1){let s={once:!1};n&&(s.capture=n),a&&(s.once=a),e.addEventListener(t,r,s)}function w(e,t,r){e.removeEventListener(t,r)}function O(e,t,r={}){let n=e;if(!n._mc){let t=k?.debug;k.debug=!1,n._mc=new k(e),k.debug=t,delete n._mc._mc}const a=n._mc;return t.length&&!a[t]&&(a[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function A(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function S(e,t,r={},n="l"){let a=e?._mc;if(!a)return;let s=t instanceof p?new p(t.type,t.data,"l"):new p(t,r,"l"),o="string"!=typeof t?t:new p(t,r,n);[...Object.values(a)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(s)})),/[ud]/.test(o.bubble)&&j(e,o)}function j(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=y(e,"",!0)?.[0].target;r&&k.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&k.trigger(e,t)}))}),0)}m()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>g.add(e)));class _{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==k&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!m()||e.constructor===k)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let a=/^one/.test(n),s=n.replace(/^on[e]{0,1}/,""),o=s.toLowerCase();a&&Object.defineProperty(e,"on"+s,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),g.has("on"+o)&&v(t,o,(e=>{r.trigger(s,e)}),!1,a)}))}}(this)}get target(){return this.#n.deref()}}class x extends _{_mc={};constructor(e){super(e)}static trigger=S;trigger(e,t={},r="l"){let n=this;if(n.constructor===x||n.constructor===k){let a=e instanceof p?new p(e.type,e.data,"l"):new p(e,t,"l"),s="string"!=typeof e?e:new p(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(a)})),void(/[ud]/.test(s.bubble)&&j(n.target,s))}if(n instanceof x||n instanceof k){const n=this,a="string"!=typeof e?e:new p(e,t,r),s="on"+a.type[0].toUpperCase()+a.type.slice(1);if(a.bubble.indexOf("l")>-1&&(a.immediateStopped||"function"!=typeof n[s]||(n[s](a),n.hasOwnProperty(s)&&delete n[s])),a.stopped||"l"===a.bubble)return n;/[ud]/.test(a.bubble)&&j(n.target,a)}}}class k extends _{_mc={};constructor(e,t=!1){super(e)}static add=O;static remove=A;static trigger=S;trigger(e,t={},r){x.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return E(t)?y(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return E(t)?y(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!E(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const a=b([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),a}descendants(e=""){let t=this?.target;return E(t)?b([...t.querySelectorAll("*[_mc]")],e):[]}}const T=new Map,C=new Map;function N(e){const t="./"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),v(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),v(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function L(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!T.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),N(t));v(r,"load",(()=>{T.set(t,customElements.get(e.tagName.toLowerCase()))})),T.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!C.has(e)));r?.forEach((e=>{const t=N(e);v(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const a=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=a,document.body.append(n)}),0);var t})),C.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>C.has(e)&&!C.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,P.state.MCs.get(t)),k.add(e,t,new(P.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let M=!1,$=null;function P(e=!0){return e?(M=e,$=new MutationObserver(L),setTimeout((()=>{$.observe(document.body,{childList:!0,subtree:!0}),L()}),5),M):($?.disconnect(),$=null,M)}P.state={CEs:T,MCs:C};class H extends HTMLElement{constructor(){super()}connectedCallback(){k.trigger(this,"Connected")}disconnectedCallback(){k.trigger(this,"Disconnected")}adoptedCallback(){k.trigger(this,"Adopted")}attributeChangedCallback(e,t,r){k.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:r})}}function q(e,t,r=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let n=i(e);customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(n,class extends H{instance;constructor(e){super();let r=new t(this,e);k.add(this,n,r)}static get observedAttributes(){return r}}))}function D(e){return customElements.get(e)}function I(e){return null!=e&&"object"==typeof e}function B(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,"")))}const V=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class z extends k{data={};oldDisplay="";constructor(e){super(e);let t=this;B(e).forEach((e=>t.data[e]="")),J(t),t.#a(),delete t._mc}#a(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var a;e.data.observe((a=t.getAttribute(r),e=>{let s=a;n.forEach((t=>{s=s.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,s)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let a=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var s;e.data.observe((s=n.nodeValue,r=>{let o=s;a.forEach((e=>{o=o.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=o})),e.oldDisplay=t.getAttribute("style)")||"",r&&!V.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const J=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,n=e[t];if(!n.prototype)switch(typeof n){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=n instanceof Array?Array:Object;break;default:return}let o=class extends r{#s=!0;constructor(e){super(e),this.constructor.callbacks=[],I(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(I(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!B(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||k.add(e,"_placeholders",new z(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),n=function(e){let t=a(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(n),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=I(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#s=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},c=new o(n);Object.defineProperty(e,t,{enumerable:!0,get(){if(I(c.valueOf())){let e=structuredClone(Object.assign({},c));setTimeout(l((function(){s(structuredClone(Object.assign({},c)),e)||c.notify()}),0),0)}return c},set(e){if(typeof e==typeof c.valueOf())if(I(c.valueOf())&&c.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},c));c instanceof o==0&&(c=new o(structuredClone(Object.assign({},e))),f(e,c),c.seal()),Object.assign(c,e),setTimeout(l((function(){s(structuredClone(Object.assign({},c)),t)||c.notify()}),0),0)}else{let t=c.valueOf(),r=c.constructor.callbacks;c=new o(e),c.constructor.callbacks=r,e!==t&&c.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof c.valueOf(),c,"- CANNOT BECOME:",typeof e)}}),e[t]=n})),e),F=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},G=e=>{let t=Q("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let a;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":a=new W(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"select":a=new Z(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"textarea":a=new U(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class R{constructor(e){}}class W extends R{#o;#e;#c;constructor(e,t){super(e),this.#o=e,this.#e=e.type,this.#c=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=Q(`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,this.#c).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#o.checked;default:return t.#o.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,n=Q(r,this.#c);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const a=n.filter((t=>t.getAttribute("value")===e));if(!a.length)return;return void(a.array[0].checked=!0);case"checkbox":t.#o.checked=e;break;default:t.#o.value=e}}}class Z extends R{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i="select-multiple"===e.type}get val(){const e=[];return Q(this.#o.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,Q(this.#o.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class U extends R{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class Y{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new K;return this.#l.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return Q(e,t).forEach((e=>{r.#l.add(e)})),r}addClass(...e){return e=F(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=Q(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=Q(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=Q(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{Q(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=Q(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,a=!1;return e&&(a=Q(e,t)),r.#l.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=Q([...n]),e&&r.filter((e=>a.has(e))),r}has(e){return this.#l.has(e)}hasClass(...e){return e=F(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)+1;a<r.length&&n.add(r.at(a))}})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#l.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){w(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let a=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(a,Array.from(arguments))}return o.cb=t,a.forEach((e=>{s.forEach((function(t){v(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e,t,s,r,!0)}))})),s}parent(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=Q(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)-1;a>-1&&n.add(r.at(a))}})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=F(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=F(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,a=!1){let s,o={bubbles:r,cancelable:n,composed:a},c=e.indexOf(" ")>-1?e.split(" "):[e];return this.#l.forEach((e=>{c.forEach((function(r){s=new Event(r,o),s.data=t,e.dispatchEvent(s)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,a=G(r.array[0]);var s;return e?null!=(s=e)&&"object"==typeof s?(Object.assign(a,e),n=r):"string"==typeof e&&(void 0===t?n=a[e]:(a[e]=t,n=r)):n=Object.assign({},a),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=G(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return Q(this.array.at(e))}concat(e){let t=this;return(e instanceof Y?e.array:e).forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#l=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#l.add(e)})),this}shift(){let e=this,t=e.#l.size?e.array[0]:void 0;return t&&e.#l.delete(t),t}slice(e,t){return Q(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),Q(n)}}class K{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}set length(e){}constructor(e,t=document.body){if(!e)return this;Q(e,t).forEach((e=>{X(e).forEach((e=>{this.#l.add(e)}))}))}$d(e,t=document.body){let r=new Y,n=new Set,a=!!e||!1,s=new Set;return a&&(s=Q(e,t).set),this.#l.forEach((e=>{a&&!s.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}descendants(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}first(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#l.has(e)}last(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);X([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){w(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e._tg,`[TB]${t}`,s,!1,r)}))})),s}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(r,Array.from(arguments))}return a.cb=t,r.forEach((e=>{n.forEach((function(t){v(e._tg,`[TB]${t}`,a,!1,!0)}))})),a}parent(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}parents(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}prev(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);X([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return X(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return X(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#l=new Set(e),t}push(e){return this.#l.add(e),this}shift(){let e=this.array.shift();return this.#l.delete(e),e}slice(e,t){return X(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return X(n)}}const Q=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{Q(e,t).forEach((e=>{r.add(e)}))})),new Y([...r])):new Y(e,t)},X=(e,t=document)=>Q(e,t).$t();class ee{constructor(e){}}class te extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return new FormData(this.#o.form).get(this.#o.name)}set val(e){[...this.#o.form.querySelectorAll(`input[type="radio"][name="${this.#o.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class re extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.checked}set val(e){this.#o.checked=e}}class ne extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class ae extends ee{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i=e.multiple}get val(){const e=[];return[...this.#o.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#o.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class se extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value||""}set val(e){this.#o.value=e}}const oe=e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new te(e);break;case"checkbox":n=new re(e);break;default:n=new ne(e)}break;case"select":n=new ae(e);break;case"textarea":n=new se(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(k.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r};function ce(e,t,r){let n=oe(r);e[t]=Object.assign({},n),J(e,t),f(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{v(r,"keyup",(r=>{e[t].notify()})),v(r,"change",(r=>{e[t].notify()})),v(r,"select",(r=>{e[t].notify()}))}))}return t})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.observables=t():e.observables=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var o;(o=e[n])&&o.constructor&&o.constructor===Object?t[n]=r(e[n]):t[n]=e[n]})),t}function n(e,t=!0){let o={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const r=n(e[t],!1);for(const e in r)o[t+"."+e]=r[e]}else o[t]=e[t]})),t?r(o):o}function o(e,t){return JSON.stringify(n(e))===JSON.stringify(n(t))}function c(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}e.r(t),e.d(t,{observe:()=>P});var a=new Function("try {return this===window;}catch(e){ return false;}");let s=new Set;a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>s.add(e)));class i{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var l=new Function("try {return this===window;}catch(e){ return false;}");let u=new Set;function f(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function d(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function m(e){return e&&e instanceof HTMLElement}function p(e,t,r,n=!1,o=!1){let c={once:!1};n&&(c.capture=n),o&&(c.once=o),e.addEventListener(t,r,c)}function b(e,t,r={}){let n=e;if(!n._mc){let t=w?.debug;w.debug=!1,n._mc=new w(e),w.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function g(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function h(e,t,r={},n="l"){let o=e?._mc;if(!o)return;let c=t instanceof i?new i(t.type,t.data,"l"):new i(t,r,"l"),a="string"!=typeof t?t:new i(t,r,n);[...Object.values(o)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(a.bubble)&&y(e,a)}function y(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=d(e,"",!0)?.[0].target;r&&w.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&w.trigger(e,t)}))}),0)}l()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>u.add(e)));class O{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==w&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!l()||e.constructor===w)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),c=n.replace(/^on[e]{0,1}/,""),a=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),u.has("on"+a)&&p(t,a,(e=>{r.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class E extends O{_mc={};constructor(e){super(e)}static trigger=h;trigger(e,t={},r="l"){let n=this;if(n.constructor===E||n.constructor===w){let o=e instanceof i?new i(e.type,e.data,"l"):new i(e,t,"l"),c="string"!=typeof e?e:new i(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(o)})),void(/[ud]/.test(c.bubble)&&y(n.target,c))}if(n instanceof E||n instanceof w){const n=this,o="string"!=typeof e?e:new i(e,t,r),c="on"+o.type[0].toUpperCase()+o.type.slice(1);if(o.bubble.indexOf("l")>-1&&(o.immediateStopped||"function"!=typeof n[c]||(n[c](o),n.hasOwnProperty(c)&&delete n[c])),o.stopped||"l"===o.bubble)return n;/[ud]/.test(o.bubble)&&y(n.target,o)}}}class w extends O{_mc={};constructor(e,t=!1){super(e)}static add=b;static remove=g;static trigger=h;trigger(e,t={},r){E.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return m(t)?d(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return m(t)?d(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!m(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=f([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return m(t)?f([...t.querySelectorAll("*[_mc]")],e):[]}}const _=new Map,v=new Map;function A(e){const t="/"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),p(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),p(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function j(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!_.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),A(t));p(r,"load",(()=>{_.set(t,customElements.get(e.tagName.toLowerCase()))})),_.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!v.has(e)));r?.forEach((e=>{const t=A(e);p(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const o=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=o,document.body.append(n)}),0);var t})),v.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>v.has(e)&&!v.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,N.state.MCs.get(t)),w.add(e,t,new(N.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let S=!1,T=null;function N(e=!0){return e?(S=e,T=new MutationObserver(j),setTimeout((()=>{T.observe(document.body,{childList:!0,subtree:!0}),j()}),5),S):(T?.disconnect(),T=null,S)}function M(e){return null!=e&&"object"==typeof e}function C(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,"")))}N.state={CEs:_,MCs:v};const L=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class k extends w{data={};oldDisplay="";constructor(e){super(e);let t=this;C(e).forEach((e=>t.data[e]="")),P(t),t.#o(),delete t._mc}#o(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var o;e.data.observe((o=t.getAttribute(r),e=>{let c=o;n.forEach((t=>{c=c.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,c)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let o=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var c;e.data.observe((c=n.nodeValue,r=>{let a=c;o.forEach((e=>{a=a.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=a})),e.oldDisplay=t.getAttribute("style)")||"",r&&!L.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const P=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,a=e[t];if(!a.prototype)switch(typeof a){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=a instanceof Array?Array:Object;break;default:return}let s=class extends r{#c=!0;constructor(e){super(e),this.constructor.callbacks=[],M(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(M(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!C(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||w.add(e,"_placeholders",new k(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),o=function(e){let t=n(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(o),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=M(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#c=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},i=new s(a);Object.defineProperty(e,t,{enumerable:!0,get(){if(M(i.valueOf())){let e=structuredClone(Object.assign({},i));setTimeout(c((function(){o(structuredClone(Object.assign({},i)),e)||i.notify()}),0),0)}return i},set(e){if(typeof e==typeof i.valueOf())if(M(i.valueOf())&&i.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},i));i instanceof s==0&&(i=new s(structuredClone(Object.assign({},e))),function(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}(e,i),i.seal()),Object.assign(i,e),setTimeout(c((function(){o(structuredClone(Object.assign({},i)),t)||i.notify()}),0),0)}else{let t=i.valueOf(),r=i.constructor.callbacks;i=new s(e),i.constructor.callbacks=r,e!==t&&i.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof i.valueOf(),i,"- CANNOT BECOME:",typeof e)}}),e[t]=a})),e);return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.observables=t():e.observables=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var o;(o=e[n])&&o.constructor&&o.constructor===Object?t[n]=r(e[n]):t[n]=e[n]})),t}function n(e,t=!0){let o={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const r=n(e[t],!1);for(const e in r)o[t+"."+e]=r[e]}else o[t]=e[t]})),t?r(o):o}function o(e,t){return JSON.stringify(n(e))===JSON.stringify(n(t))}function c(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}e.r(t),e.d(t,{observe:()=>P});var a=new Function("try {return this===window;}catch(e){ return false;}");let s=new Set;a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>s.add(e)));class i{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var l=new Function("try {return this===window;}catch(e){ return false;}");let u=new Set;function f(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function d(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function m(e){return e&&e instanceof HTMLElement}function p(e,t,r,n=!1,o=!1){let c={once:!1};n&&(c.capture=n),o&&(c.once=o),e.addEventListener(t,r,c)}function b(e,t,r={}){let n=e;if(!n._mc){let t=w?.debug;w.debug=!1,n._mc=new w(e),w.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function g(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function h(e,t,r={},n="l"){let o=e?._mc;if(!o)return;let c=t instanceof i?new i(t.type,t.data,"l"):new i(t,r,"l"),a="string"!=typeof t?t:new i(t,r,n);[...Object.values(o)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(a.bubble)&&y(e,a)}function y(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=d(e,"",!0)?.[0].target;r&&w.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&w.trigger(e,t)}))}),0)}l()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>u.add(e)));class O{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==w&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!l()||e.constructor===w)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),c=n.replace(/^on[e]{0,1}/,""),a=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),u.has("on"+a)&&p(t,a,(e=>{r.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class E extends O{_mc={};constructor(e){super(e)}static trigger=h;trigger(e,t={},r="l"){let n=this;if(n.constructor===E||n.constructor===w){let o=e instanceof i?new i(e.type,e.data,"l"):new i(e,t,"l"),c="string"!=typeof e?e:new i(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(o)})),void(/[ud]/.test(c.bubble)&&y(n.target,c))}if(n instanceof E||n instanceof w){const n=this,o="string"!=typeof e?e:new i(e,t,r),c="on"+o.type[0].toUpperCase()+o.type.slice(1);if(o.bubble.indexOf("l")>-1&&(o.immediateStopped||"function"!=typeof n[c]||(n[c](o),n.hasOwnProperty(c)&&delete n[c])),o.stopped||"l"===o.bubble)return n;/[ud]/.test(o.bubble)&&y(n.target,o)}}}class w extends O{_mc={};constructor(e,t=!1){super(e)}static add=b;static remove=g;static trigger=h;trigger(e,t={},r){E.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return m(t)?d(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return m(t)?d(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!m(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=f([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return m(t)?f([...t.querySelectorAll("*[_mc]")],e):[]}}const _=new Map,v=new Map;function A(e){const t="./"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),p(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),p(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function j(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!_.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),A(t));p(r,"load",(()=>{_.set(t,customElements.get(e.tagName.toLowerCase()))})),_.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!v.has(e)));r?.forEach((e=>{const t=A(e);p(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const o=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=o,document.body.append(n)}),0);var t})),v.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>v.has(e)&&!v.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,N.state.MCs.get(t)),w.add(e,t,new(N.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let S=!1,T=null;function N(e=!0){return e?(S=e,T=new MutationObserver(j),setTimeout((()=>{T.observe(document.body,{childList:!0,subtree:!0}),j()}),5),S):(T?.disconnect(),T=null,S)}function M(e){return null!=e&&"object"==typeof e}function C(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,"")))}N.state={CEs:_,MCs:v};const L=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class k extends w{data={};oldDisplay="";constructor(e){super(e);let t=this;C(e).forEach((e=>t.data[e]="")),P(t),t.#o(),delete t._mc}#o(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var o;e.data.observe((o=t.getAttribute(r),e=>{let c=o;n.forEach((t=>{c=c.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,c)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let o=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var c;e.data.observe((c=n.nodeValue,r=>{let a=c;o.forEach((e=>{a=a.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=a})),e.oldDisplay=t.getAttribute("style)")||"",r&&!L.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const P=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,a=e[t];if(!a.prototype)switch(typeof a){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=a instanceof Array?Array:Object;break;default:return}let s=class extends r{#c=!0;constructor(e){super(e),this.constructor.callbacks=[],M(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(M(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!C(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||w.add(e,"_placeholders",new k(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),o=function(e){let t=n(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(o),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=M(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#c=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},i=new s(a);Object.defineProperty(e,t,{enumerable:!0,get(){if(M(i.valueOf())){let e=structuredClone(Object.assign({},i));setTimeout(c((function(){o(structuredClone(Object.assign({},i)),e)||i.notify()}),0),0)}return i},set(e){if(typeof e==typeof i.valueOf())if(M(i.valueOf())&&i.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},i));i instanceof s==0&&(i=new s(structuredClone(Object.assign({},e))),function(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}(e,i),i.seal()),Object.assign(i,e),setTimeout(c((function(){o(structuredClone(Object.assign({},i)),t)||i.notify()}),0),0)}else{let t=i.valueOf(),r=i.constructor.callbacks;i=new s(e),i.constructor.callbacks=r,e!==t&&i.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof i.valueOf(),i,"- CANNOT BECOME:",typeof e)}}),e[t]=a})),e);return t})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.selectors=t():e.selectors=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{$d:()=>C,$t:()=>H});var r=new Function("try {return this===window;}catch(e){ return false;}");let n=new Set;r()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>n.add(e)));class s{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var a=new Function("try {return this===window;}catch(e){ return false;}");let o=new Set;function i(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function c(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function l(e){return e&&e instanceof HTMLElement}function u(e,t,r,n=!1,s=!1){let a={once:!1};n&&(a.capture=n),s&&(a.once=s),e.addEventListener(t,r,a)}function h(e,t,r){e.removeEventListener(t,r)}function f(e,t,r={}){let n=e;if(!n._mc){let t=b?.debug;b.debug=!1,n._mc=new b(e),b.debug=t,delete n._mc._mc}const s=n._mc;return t.length&&!s[t]&&(s[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function d(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function p(e,t,r={},n="l"){let a=e?._mc;if(!a)return;let o=t instanceof s?new s(t.type,t.data,"l"):new s(t,r,"l"),i="string"!=typeof t?t:new s(t,r,n);[...Object.values(a)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(o)})),/[ud]/.test(i.bubble)&&m(e,i)}function m(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=c(e,"",!0)?.[0].target;r&&b.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&b.trigger(e,t)}))}),0)}a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>o.add(e)));class y{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==b&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!a()||e.constructor===b)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let s=/^one/.test(n),a=n.replace(/^on[e]{0,1}/,""),i=a.toLowerCase();s&&Object.defineProperty(e,"on"+a,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),o.has("on"+i)&&u(t,i,(e=>{r.trigger(a,e)}),!1,s)}))}}(this)}get target(){return this.#n.deref()}}class g extends y{_mc={};constructor(e){super(e)}static trigger=p;trigger(e,t={},r="l"){let n=this;if(n.constructor===g||n.constructor===b){let a=e instanceof s?new s(e.type,e.data,"l"):new s(e,t,"l"),o="string"!=typeof e?e:new s(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(a)})),void(/[ud]/.test(o.bubble)&&m(n.target,o))}if(n instanceof g||n instanceof b){const n=this,a="string"!=typeof e?e:new s(e,t,r),o="on"+a.type[0].toUpperCase()+a.type.slice(1);if(a.bubble.indexOf("l")>-1&&(a.immediateStopped||"function"!=typeof n[o]||(n[o](a),n.hasOwnProperty(o)&&delete n[o])),a.stopped||"l"===a.bubble)return n;/[ud]/.test(a.bubble)&&m(n.target,a)}}}class b extends y{_mc={};constructor(e,t=!1){super(e)}static add=f;static remove=d;static trigger=p;trigger(e,t={},r){g.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return l(t)?c(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return l(t)?c(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!l(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const s=i([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),s}descendants(e=""){let t=this?.target;return l(t)?i([...t.querySelectorAll("*[_mc]")],e):[]}}const E=new Map,w=new Map;function v(e){const t="/"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),u(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),u(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function S(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!E.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),v(t));u(r,"load",(()=>{E.set(t,customElements.get(e.tagName.toLowerCase()))})),E.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!w.has(e)));r?.forEach((e=>{const t=v(e);u(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const s=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=s,document.body.append(n)}),0);var t})),w.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>w.has(e)&&!w.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,_.state.MCs.get(t)),b.add(e,t,new(_.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let A=!1,O=null;function _(e=!0){return e?(A=e,O=new MutationObserver(S),setTimeout((()=>{O.observe(document.body,{childList:!0,subtree:!0}),S()}),5),A):(O?.disconnect(),O=null,A)}_.state={CEs:E,MCs:w};const x=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},j=e=>{let t=C("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let s;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":s=new L(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"select":s=new M(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"textarea":s=new N(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class T{constructor(e){}}class L extends T{#s;#e;#a;constructor(e,t){super(e),this.#s=e,this.#e=e.type,this.#a=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=C(`input[type="radio"][name="${this.#s.getAttribute("name")}"]`,this.#a).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#s.checked;default:return t.#s.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#s.getAttribute("name")}"]`,n=C(r,this.#a);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const s=n.filter((t=>t.getAttribute("value")===e));if(!s.length)return;return void(s.array[0].checked=!0);case"checkbox":t.#s.checked=e;break;default:t.#s.value=e}}}class M extends T{#s;#o=!1;constructor(e){super(e),this.#s=e,this.#o="select-multiple"===e.type}get val(){const e=[];return C(this.#s.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#o?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,C(this.#s.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class N extends T{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}class ${#i=new Set;get set(){return this.#i}get array(){return Array.from(this.#i)}set set(e){this.#i=e}get length(){return this.#i.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new k;return this.#i.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return C(e,t).forEach((e=>{r.#i.add(e)})),r}addClass(...e){return e=x(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=C(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=C(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=C(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{C(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=C(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,s=!1;return e&&(s=C(e,t)),r.#i.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=C([...n]),e&&r.filter((e=>s.has(e))),r}has(e){return this.#i.has(e)}hasClass(...e){return e=x(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),s=r.indexOf(e)+1;s<r.length&&n.add(r.at(s))}})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#i.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){h(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let s=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(s,Array.from(arguments))}return o.cb=t,s.forEach((e=>{a.forEach((function(t){u(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(n,Array.from(arguments))}return a.cb=t,n.forEach((e=>{s.forEach((function(t){u(e,t,a,r,!0)}))})),a}parent(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=C(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),s=r.indexOf(e)-1;s>-1&&n.add(r.at(s))}})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=x(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=x(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,s=!1){let a,o={bubbles:r,cancelable:n,composed:s},i=e.indexOf(" ")>-1?e.split(" "):[e];return this.#i.forEach((e=>{i.forEach((function(r){a=new Event(r,o),a.data=t,e.dispatchEvent(a)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,s=j(r.array[0]);var a;return e?null!=(a=e)&&"object"==typeof a?(Object.assign(s,e),n=r):"string"==typeof e&&(void 0===t?n=s[e]:(s[e]=t,n=r)):n=Object.assign({},s),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=j(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return C(this.array.at(e))}concat(e){let t=this;return(e instanceof $?e.array:e).forEach((e=>{t.#i.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#i=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#i.add(e)})),this}shift(){let e=this,t=e.#i.size?e.array[0]:void 0;return t&&e.#i.delete(t),t}slice(e,t){return C(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),C(n)}}class k{#i=new Set;get set(){return this.#i}get array(){return Array.from(this.#i)}set set(e){this.#i=e}get length(){return this.#i.size}set length(e){}constructor(e,t=document.body){if(!e)return this;C(e,t).forEach((e=>{H(e).forEach((e=>{this.#i.add(e)}))}))}$d(e,t=document.body){let r=new $,n=new Set,s=!!e||!1,a=new Set;return s&&(a=C(e,t).set),this.#i.forEach((e=>{s&&!a.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}descendants(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}first(e){let t=this,r=new Set;return t.#i.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#i.has(e)}last(e){let t=this,r=new Set;return t.#i.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#i.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);H([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){h(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(n,Array.from(arguments))}return a.cb=t,n.forEach((e=>{s.forEach((function(t){u(e._tg,`[TB]${t}`,a,!1,r)}))})),a}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(r,Array.from(arguments))}return s.cb=t,r.forEach((e=>{n.forEach((function(t){u(e._tg,`[TB]${t}`,s,!1,!0)}))})),s}parent(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}parents(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}prev(e){let t=this,r=new Set;return t.#i.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);H([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return H(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#i.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return H(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#i=new Set(e),t}push(e){return this.#i.add(e),this}shift(){let e=this.array.shift();return this.#i.delete(e),e}slice(e,t){return H(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return H(n)}}const C=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{C(e,t).forEach((e=>{r.add(e)}))})),new $([...r])):new $(e,t)},H=(e,t=document)=>C(e,t).$t();return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.selectors=t():e.selectors=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{$d:()=>C,$t:()=>H});var r=new Function("try {return this===window;}catch(e){ return false;}");let n=new Set;r()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>n.add(e)));class s{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var a=new Function("try {return this===window;}catch(e){ return false;}");let o=new Set;function i(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function c(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function l(e){return e&&e instanceof HTMLElement}function u(e,t,r,n=!1,s=!1){let a={once:!1};n&&(a.capture=n),s&&(a.once=s),e.addEventListener(t,r,a)}function h(e,t,r){e.removeEventListener(t,r)}function f(e,t,r={}){let n=e;if(!n._mc){let t=b?.debug;b.debug=!1,n._mc=new b(e),b.debug=t,delete n._mc._mc}const s=n._mc;return t.length&&!s[t]&&(s[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function d(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function p(e,t,r={},n="l"){let a=e?._mc;if(!a)return;let o=t instanceof s?new s(t.type,t.data,"l"):new s(t,r,"l"),i="string"!=typeof t?t:new s(t,r,n);[...Object.values(a)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(o)})),/[ud]/.test(i.bubble)&&m(e,i)}function m(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=c(e,"",!0)?.[0].target;r&&b.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&b.trigger(e,t)}))}),0)}a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>o.add(e)));class y{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==b&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!a()||e.constructor===b)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let s=/^one/.test(n),a=n.replace(/^on[e]{0,1}/,""),i=a.toLowerCase();s&&Object.defineProperty(e,"on"+a,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),o.has("on"+i)&&u(t,i,(e=>{r.trigger(a,e)}),!1,s)}))}}(this)}get target(){return this.#n.deref()}}class g extends y{_mc={};constructor(e){super(e)}static trigger=p;trigger(e,t={},r="l"){let n=this;if(n.constructor===g||n.constructor===b){let a=e instanceof s?new s(e.type,e.data,"l"):new s(e,t,"l"),o="string"!=typeof e?e:new s(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(a)})),void(/[ud]/.test(o.bubble)&&m(n.target,o))}if(n instanceof g||n instanceof b){const n=this,a="string"!=typeof e?e:new s(e,t,r),o="on"+a.type[0].toUpperCase()+a.type.slice(1);if(a.bubble.indexOf("l")>-1&&(a.immediateStopped||"function"!=typeof n[o]||(n[o](a),n.hasOwnProperty(o)&&delete n[o])),a.stopped||"l"===a.bubble)return n;/[ud]/.test(a.bubble)&&m(n.target,a)}}}class b extends y{_mc={};constructor(e,t=!1){super(e)}static add=f;static remove=d;static trigger=p;trigger(e,t={},r){g.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return l(t)?c(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return l(t)?c(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!l(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const s=i([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),s}descendants(e=""){let t=this?.target;return l(t)?i([...t.querySelectorAll("*[_mc]")],e):[]}}const E=new Map,w=new Map;function v(e){const t="./"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),u(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),u(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function S(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!E.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),v(t));u(r,"load",(()=>{E.set(t,customElements.get(e.tagName.toLowerCase()))})),E.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!w.has(e)));r?.forEach((e=>{const t=v(e);u(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const s=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=s,document.body.append(n)}),0);var t})),w.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>w.has(e)&&!w.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,_.state.MCs.get(t)),b.add(e,t,new(_.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let A=!1,O=null;function _(e=!0){return e?(A=e,O=new MutationObserver(S),setTimeout((()=>{O.observe(document.body,{childList:!0,subtree:!0}),S()}),5),A):(O?.disconnect(),O=null,A)}_.state={CEs:E,MCs:w};const x=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},j=e=>{let t=C("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let s;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":s=new L(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"select":s=new M(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"textarea":s=new N(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class T{constructor(e){}}class L extends T{#s;#e;#a;constructor(e,t){super(e),this.#s=e,this.#e=e.type,this.#a=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=C(`input[type="radio"][name="${this.#s.getAttribute("name")}"]`,this.#a).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#s.checked;default:return t.#s.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#s.getAttribute("name")}"]`,n=C(r,this.#a);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const s=n.filter((t=>t.getAttribute("value")===e));if(!s.length)return;return void(s.array[0].checked=!0);case"checkbox":t.#s.checked=e;break;default:t.#s.value=e}}}class M extends T{#s;#o=!1;constructor(e){super(e),this.#s=e,this.#o="select-multiple"===e.type}get val(){const e=[];return C(this.#s.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#o?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,C(this.#s.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class N extends T{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}class ${#i=new Set;get set(){return this.#i}get array(){return Array.from(this.#i)}set set(e){this.#i=e}get length(){return this.#i.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new k;return this.#i.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return C(e,t).forEach((e=>{r.#i.add(e)})),r}addClass(...e){return e=x(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=C(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=C(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=C(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{C(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=C(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,s=!1;return e&&(s=C(e,t)),r.#i.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=C([...n]),e&&r.filter((e=>s.has(e))),r}has(e){return this.#i.has(e)}hasClass(...e){return e=x(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),s=r.indexOf(e)+1;s<r.length&&n.add(r.at(s))}})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#i.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){h(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let s=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(s,Array.from(arguments))}return o.cb=t,s.forEach((e=>{a.forEach((function(t){u(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(n,Array.from(arguments))}return a.cb=t,n.forEach((e=>{s.forEach((function(t){u(e,t,a,r,!0)}))})),a}parent(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=C(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),s=r.indexOf(e)-1;s>-1&&n.add(r.at(s))}})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=x(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=x(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,s=!1){let a,o={bubbles:r,cancelable:n,composed:s},i=e.indexOf(" ")>-1?e.split(" "):[e];return this.#i.forEach((e=>{i.forEach((function(r){a=new Event(r,o),a.data=t,e.dispatchEvent(a)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,s=j(r.array[0]);var a;return e?null!=(a=e)&&"object"==typeof a?(Object.assign(s,e),n=r):"string"==typeof e&&(void 0===t?n=s[e]:(s[e]=t,n=r)):n=Object.assign({},s),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=j(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return C(this.array.at(e))}concat(e){let t=this;return(e instanceof $?e.array:e).forEach((e=>{t.#i.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#i=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#i.add(e)})),this}shift(){let e=this,t=e.#i.size?e.array[0]:void 0;return t&&e.#i.delete(t),t}slice(e,t){return C(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),C(n)}}class k{#i=new Set;get set(){return this.#i}get array(){return Array.from(this.#i)}set set(e){this.#i=e}get length(){return this.#i.size}set length(e){}constructor(e,t=document.body){if(!e)return this;C(e,t).forEach((e=>{H(e).forEach((e=>{this.#i.add(e)}))}))}$d(e,t=document.body){let r=new $,n=new Set,s=!!e||!1,a=new Set;return s&&(a=C(e,t).set),this.#i.forEach((e=>{s&&!a.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}descendants(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}first(e){let t=this,r=new Set;return t.#i.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#i.has(e)}last(e){let t=this,r=new Set;return t.#i.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#i.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);H([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){h(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(n,Array.from(arguments))}return a.cb=t,n.forEach((e=>{s.forEach((function(t){u(e._tg,`[TB]${t}`,a,!1,r)}))})),a}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(r,Array.from(arguments))}return s.cb=t,r.forEach((e=>{n.forEach((function(t){u(e._tg,`[TB]${t}`,s,!1,!0)}))})),s}parent(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}parents(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}prev(e){let t=this,r=new Set;return t.#i.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);H([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return H(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#i.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return H(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#i=new Set(e),t}push(e){return this.#i.add(e),this}shift(){let e=this.array.shift();return this.#i.delete(e),e}slice(e,t){return H(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return H(n)}}const C=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{C(e,t).forEach((e=>{r.add(e)}))})),new $([...r])):new $(e,t)},H=(e,t=document)=>C(e,t).$t();return t})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twobirds/microcomponents",
3
- "version": "0.0.61",
3
+ "version": "0.0.63",
4
4
  "description": "Micro Components Organization Class",
5
5
  "main": "./dist/microcomponents.ts",
6
6
  "types": "./dist/microcomponents.d.ts",
package/public/MC.js CHANGED
@@ -270,7 +270,7 @@ class DC extends McBase {
270
270
  const CEs = new Map();
271
271
  const MCs = new Map();
272
272
  function makeLoadScript(element) {
273
- const fileName = '/' + element.split('-').join('/') + '.js';
273
+ const fileName = './' + element.split('-').join('/') + '.js';
274
274
  const se = document.createElement('script');
275
275
  se.setAttribute('src', fileName);
276
276
  se.setAttribute('blocking', 'render');
@@ -319,7 +319,7 @@ function loadUndefinedMicroComponents() {
319
319
  && !customElements.get(element.tagName.toLowerCase())
320
320
  && !CEs.has(element.tagName.toLowerCase()))
321
321
  .forEach((el) => {
322
- const elementName = el.tagName.toLowerCase(), fileName = '/' + elementName.split('-').join('/') + '.js';
322
+ const elementName = el.tagName.toLowerCase(), fileName = './' + elementName.split('-').join('/') + '.js';
323
323
  const se = makeLoadScript(elementName);
324
324
  addListener(se, 'load', () => {
325
325
  CEs.set(elementName, customElements.get(el.tagName.toLowerCase()));
package/public/MC.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"MC.js","sourceRoot":"","sources":["../src/MC.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,IAAI,SAAS,GAAG,IAAI,QAAQ,CAC3B,qDAAqD,CACrD,CAAC;AAEF,IAAI,gBAAgB,GAAgB,IAAI,GAAG,EAAE,CAAC;AAG9C,IAAI,SAAS,EAAE,EAAE,CAAC;IACjB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;SAChC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAChC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;AAC3D,CAAC;AAOD,SAAS,kBAAkB,CAAC,QAAe,EAAE,MAAc;IAC1D,IAAI,QAAQ,GAAU,EAAE,CAAC;IAEzB,QAAQ,CAAC,OAAO,CAAC,CAAC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,CAAC,EAAE,CAAC,CAAC,CAAC;IAEN,OAAO,eAAe,CAAC;AACxB,CAAC;AAEA,QAAwB,CAAC,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC"}
package/public/MC.min.js CHANGED
@@ -403,7 +403,7 @@ class DC extends McBase {
403
403
  const CEs = new Map();
404
404
  const MCs = new Map();
405
405
  function makeLoadScript(element) {
406
- const fileName = '/' + element.split('-').join('/') + '.js';
406
+ const fileName = './' + element.split('-').join('/') + '.js';
407
407
  const se = document.createElement('script');
408
408
  se.setAttribute('src', fileName);
409
409
  se.setAttribute('blocking', 'render');
@@ -452,7 +452,7 @@ function loadUndefinedMicroComponents() {
452
452
  && !customElements.get(element.tagName.toLowerCase())
453
453
  && !CEs.has(element.tagName.toLowerCase()))
454
454
  .forEach((el) => {
455
- const elementName = el.tagName.toLowerCase(), fileName = '/' + elementName.split('-').join('/') + '.js';
455
+ const elementName = el.tagName.toLowerCase(), fileName = './' + elementName.split('-').join('/') + '.js';
456
456
  const se = makeLoadScript(elementName);
457
457
  addListener(se, 'load', () => {
458
458
  CEs.set(elementName, customElements.get(el.tagName.toLowerCase()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.elements=t():e.elements=t()}(this,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{defineCE:()=>j,getCE:()=>M});var n=new Function("try {return this===window;}catch(e){ return false;}");let r=new Set;n()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>r.add(e)));class o{#e;#t=!1;#n=!1;constructor(e,t={},n="l"){this.#e=e,this.data=t,this.bubble=n}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#n}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#n=!0}}var c=new Function("try {return this===window;}catch(e){ return false;}");let s=new Set;function i(e,t){let n=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const r=e?._mc;!t&&r?n=n.concat(Object.values(e._mc)):t&&r&&r[t]&&n.push(r[t])}})),n}function a(e,t,n=!0){let r=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&r.push(e._mc[t]):r=r.concat(Object.values(e._mc)),n))return r;e=e.parentNode}return r}function l(e){return e&&e instanceof HTMLElement}function u(e,t,n,r=!1,o=!1){let c={once:!1};r&&(c.capture=r),o&&(c.once=o),e.addEventListener(t,n,c)}function m(e,t,n={}){let r=e;if(!r._mc){let t=h?.debug;h.debug=!1,r._mc=new h(e),h.debug=t,delete r._mc._mc}const o=r._mc;return t.length&&!o[t]&&(o[t]=n,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),n}function d(e,t){if(!t)return;const n=e?._mc||{};n&&n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function p(e,t,n={},r="l"){let c=e?._mc;if(!c)return;let s=t instanceof o?new o(t.type,t.data,"l"):new o(t,n,"l"),i="string"!=typeof t?t:new o(t,n,r);[...Object.values(c)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(s)})),/[ud]/.test(i.bubble)&&f(e,i)}function f(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let n=a(e,"",!0)?.[0].target;n&&h.trigger(n,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&h.trigger(e,t)}))}),0)}c()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>s.add(e)));class g{#r;constructor(e,t=!1){var n;this.#r=new WeakRef(e||{}),(n=this).constructor!==h&&setTimeout((()=>{n.trigger("Init")}),0),function(e){if(!c()||e.constructor===h)return;const t=e.target;if(t instanceof HTMLElement){let n=e;Object.getOwnPropertyNames(n.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof n.constructor.prototype[e])).forEach((r=>{let o=/^one/.test(r),c=r.replace(/^on[e]{0,1}/,""),i=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{n.constructor.prototype[r].bind(n)(e)}}),s.has("on"+i)&&u(t,i,(e=>{n.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#r.deref()}}class b extends g{_mc={};constructor(e){super(e)}static trigger=p;trigger(e,t={},n="l"){let r=this;if(r.constructor===b||r.constructor===h){let c=e instanceof o?new o(e.type,e.data,"l"):new o(e,t,"l"),s="string"!=typeof e?e:new o(e,t,n);return[...Object.getOwnPropertyNames(r)].forEach((e=>{r[e]?.trigger&&"function"==typeof r[e]?.trigger&&r[e]?.trigger(c)})),void(/[ud]/.test(s.bubble)&&f(r.target,s))}if(r instanceof b||r instanceof h){const r=this,c="string"!=typeof e?e:new o(e,t,n),s="on"+c.type[0].toUpperCase()+c.type.slice(1);if(c.bubble.indexOf("l")>-1&&(c.immediateStopped||"function"!=typeof r[s]||(r[s](c),r.hasOwnProperty(s)&&delete r[s])),c.stopped||"l"===c.bubble)return r;/[ud]/.test(c.bubble)&&f(r.target,c)}}}class h extends g{_mc={};constructor(e,t=!1){super(e)}static add=m;static remove=d;static trigger=p;trigger(e,t={},n){b.prototype.trigger.call(this,e,t,n)}parent(e=""){let t=this.target;return l(t)?a(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return l(t)?a(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!l(t))return[];const n=Math.random().toString().replace(".",""),r='[_mc]:not([temp_id="'+n+'"] [_mc] [_mc])';t.setAttribute("temp_id",n);const o=i([...t.querySelectorAll(r)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return l(t)?i([...t.querySelectorAll("*[_mc]")],e):[]}}const y=new Map,w=new Map;function _(e){const t="/"+e.split("-").join("/")+".js",n=document.createElement("script");return n.setAttribute("src",t),n.setAttribute("blocking","render"),n.async=!0,n.setAttribute("type","module"),n.setAttribute("name",e),n.setAttribute("loading",""),u(n,"load",(e=>{n.removeAttribute("loading"),n.setAttribute("loaded","")})),u(n,"error",(e=>{console.error("could not load Custom Element code from",t)})),n}function E(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!y.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),n=(t.split("-").join("/"),_(t));u(n,"load",(()=>{y.set(t,customElements.get(e.tagName.toLowerCase()))})),y.set(t,"loading"),document.head.append(n)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],n=t.filter((e=>!w.has(e)));n?.forEach((e=>{const t=_(e);u(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),n=t.getAttribute("name"),r=document.createElement("script");r.async=!0,r.setAttribute("type","module");const o=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${n}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${n}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${n}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${n}]"')?.remove();\n},0);`;r.innerHTML=o,document.body.append(r)}),0);var t})),w.set(e,"loading"),document.head.append(t)}));const r=t.filter((e=>w.has(e)&&!w.get(e).length));r?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,v.state.MCs.get(t)),h.add(e,t,new(v.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let A=!1,C=null;function v(e=!0){return e?(A=e,C=new MutationObserver(E),setTimeout((()=>{C.observe(document.body,{childList:!0,subtree:!0}),E()}),5),A):(C?.disconnect(),C=null,A)}v.state={CEs:y,MCs:w};class O extends HTMLElement{constructor(){super()}connectedCallback(){h.trigger(this,"Connected")}disconnectedCallback(){h.trigger(this,"Disconnected")}adoptedCallback(){h.trigger(this,"Adopted")}attributeChangedCallback(e,t,n){h.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:n})}}function j(e,t,n=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let r=e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("");customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(r,class extends O{instance;constructor(e){super();let n=new t(this,e);h.add(this,r,n)}static get observedAttributes(){return n}}))}function M(e){return customElements.get(e)}return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.elements=t():e.elements=t()}(this,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{defineCE:()=>j,getCE:()=>M});var n=new Function("try {return this===window;}catch(e){ return false;}");let r=new Set;n()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>r.add(e)));class o{#e;#t=!1;#n=!1;constructor(e,t={},n="l"){this.#e=e,this.data=t,this.bubble=n}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#n}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#n=!0}}var c=new Function("try {return this===window;}catch(e){ return false;}");let s=new Set;function i(e,t){let n=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const r=e?._mc;!t&&r?n=n.concat(Object.values(e._mc)):t&&r&&r[t]&&n.push(r[t])}})),n}function a(e,t,n=!0){let r=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&r.push(e._mc[t]):r=r.concat(Object.values(e._mc)),n))return r;e=e.parentNode}return r}function l(e){return e&&e instanceof HTMLElement}function u(e,t,n,r=!1,o=!1){let c={once:!1};r&&(c.capture=r),o&&(c.once=o),e.addEventListener(t,n,c)}function m(e,t,n={}){let r=e;if(!r._mc){let t=h?.debug;h.debug=!1,r._mc=new h(e),h.debug=t,delete r._mc._mc}const o=r._mc;return t.length&&!o[t]&&(o[t]=n,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),n}function d(e,t){if(!t)return;const n=e?._mc||{};n&&n[t]&&delete n[t],!Object.keys(n).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function p(e,t,n={},r="l"){let c=e?._mc;if(!c)return;let s=t instanceof o?new o(t.type,t.data,"l"):new o(t,n,"l"),i="string"!=typeof t?t:new o(t,n,r);[...Object.values(c)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(s)})),/[ud]/.test(i.bubble)&&f(e,i)}function f(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let n=a(e,"",!0)?.[0].target;n&&h.trigger(n,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&h.trigger(e,t)}))}),0)}c()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>s.add(e)));class g{#r;constructor(e,t=!1){var n;this.#r=new WeakRef(e||{}),(n=this).constructor!==h&&setTimeout((()=>{n.trigger("Init")}),0),function(e){if(!c()||e.constructor===h)return;const t=e.target;if(t instanceof HTMLElement){let n=e;Object.getOwnPropertyNames(n.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof n.constructor.prototype[e])).forEach((r=>{let o=/^one/.test(r),c=r.replace(/^on[e]{0,1}/,""),i=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{n.constructor.prototype[r].bind(n)(e)}}),s.has("on"+i)&&u(t,i,(e=>{n.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#r.deref()}}class b extends g{_mc={};constructor(e){super(e)}static trigger=p;trigger(e,t={},n="l"){let r=this;if(r.constructor===b||r.constructor===h){let c=e instanceof o?new o(e.type,e.data,"l"):new o(e,t,"l"),s="string"!=typeof e?e:new o(e,t,n);return[...Object.getOwnPropertyNames(r)].forEach((e=>{r[e]?.trigger&&"function"==typeof r[e]?.trigger&&r[e]?.trigger(c)})),void(/[ud]/.test(s.bubble)&&f(r.target,s))}if(r instanceof b||r instanceof h){const r=this,c="string"!=typeof e?e:new o(e,t,n),s="on"+c.type[0].toUpperCase()+c.type.slice(1);if(c.bubble.indexOf("l")>-1&&(c.immediateStopped||"function"!=typeof r[s]||(r[s](c),r.hasOwnProperty(s)&&delete r[s])),c.stopped||"l"===c.bubble)return r;/[ud]/.test(c.bubble)&&f(r.target,c)}}}class h extends g{_mc={};constructor(e,t=!1){super(e)}static add=m;static remove=d;static trigger=p;trigger(e,t={},n){b.prototype.trigger.call(this,e,t,n)}parent(e=""){let t=this.target;return l(t)?a(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return l(t)?a(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!l(t))return[];const n=Math.random().toString().replace(".",""),r='[_mc]:not([temp_id="'+n+'"] [_mc] [_mc])';t.setAttribute("temp_id",n);const o=i([...t.querySelectorAll(r)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return l(t)?i([...t.querySelectorAll("*[_mc]")],e):[]}}const y=new Map,w=new Map;function _(e){const t="./"+e.split("-").join("/")+".js",n=document.createElement("script");return n.setAttribute("src",t),n.setAttribute("blocking","render"),n.async=!0,n.setAttribute("type","module"),n.setAttribute("name",e),n.setAttribute("loading",""),u(n,"load",(e=>{n.removeAttribute("loading"),n.setAttribute("loaded","")})),u(n,"error",(e=>{console.error("could not load Custom Element code from",t)})),n}function E(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!y.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),n=(t.split("-").join("/"),_(t));u(n,"load",(()=>{y.set(t,customElements.get(e.tagName.toLowerCase()))})),y.set(t,"loading"),document.head.append(n)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],n=t.filter((e=>!w.has(e)));n?.forEach((e=>{const t=_(e);u(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),n=t.getAttribute("name"),r=document.createElement("script");r.async=!0,r.setAttribute("type","module");const o=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${n}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${n}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${n}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${n}]"')?.remove();\n},0);`;r.innerHTML=o,document.body.append(r)}),0);var t})),w.set(e,"loading"),document.head.append(t)}));const r=t.filter((e=>w.has(e)&&!w.get(e).length));r?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,v.state.MCs.get(t)),h.add(e,t,new(v.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let A=!1,C=null;function v(e=!0){return e?(A=e,C=new MutationObserver(E),setTimeout((()=>{C.observe(document.body,{childList:!0,subtree:!0}),E()}),5),A):(C?.disconnect(),C=null,A)}v.state={CEs:y,MCs:w};class O extends HTMLElement{constructor(){super()}connectedCallback(){h.trigger(this,"Connected")}disconnectedCallback(){h.trigger(this,"Disconnected")}adoptedCallback(){h.trigger(this,"Adopted")}attributeChangedCallback(e,t,n){h.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:n})}}function j(e,t,n=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let r=e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("");customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(r,class extends O{instance;constructor(e){super();let n=new t(this,e);h.add(this,r,n)}static get observedAttributes(){return n}}))}function M(e){return customElements.get(e)}return t})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.formValues=t():e.formValues=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var o;(o=e[n])&&o.constructor&&o.constructor===Object?t[n]=r(e[n]):t[n]=e[n]})),t}function n(e,t=!0){let o={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const r=n(e[t],!1);for(const e in r)o[t+"."+e]=r[e]}else o[t]=e[t]})),t?r(o):o}function o(e,t){return JSON.stringify(n(e))===JSON.stringify(n(t))}function c(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function s(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{formValues:()=>J});var a=new Function("try {return this===window;}catch(e){ return false;}");let l=new Set;a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>l.add(e)));class i{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var u=new Function("try {return this===window;}catch(e){ return false;}");let f=new Set;function d(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function m(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function p(e){return e&&e instanceof HTMLElement}function b(e,t,r,n=!1,o=!1){let c={once:!1};n&&(c.capture=n),o&&(c.once=o),e.addEventListener(t,r,c)}function g(e,t,r={}){let n=e;if(!n._mc){let t=E?.debug;E.debug=!1,n._mc=new E(e),E.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function h(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function y(e,t,r={},n="l"){let o=e?._mc;if(!o)return;let c=t instanceof i?new i(t.type,t.data,"l"):new i(t,r,"l"),s="string"!=typeof t?t:new i(t,r,n);[...Object.values(o)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(s.bubble)&&O(e,s)}function O(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=m(e,"",!0)?.[0].target;r&&E.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&E.trigger(e,t)}))}),0)}u()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>f.add(e)));class v{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==E&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!u()||e.constructor===E)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),c=n.replace(/^on[e]{0,1}/,""),s=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),f.has("on"+s)&&b(t,s,(e=>{r.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class w extends v{_mc={};constructor(e){super(e)}static trigger=y;trigger(e,t={},r="l"){let n=this;if(n.constructor===w||n.constructor===E){let o=e instanceof i?new i(e.type,e.data,"l"):new i(e,t,"l"),c="string"!=typeof e?e:new i(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(o)})),void(/[ud]/.test(c.bubble)&&O(n.target,c))}if(n instanceof w||n instanceof E){const n=this,o="string"!=typeof e?e:new i(e,t,r),c="on"+o.type[0].toUpperCase()+o.type.slice(1);if(o.bubble.indexOf("l")>-1&&(o.immediateStopped||"function"!=typeof n[c]||(n[c](o),n.hasOwnProperty(c)&&delete n[c])),o.stopped||"l"===o.bubble)return n;/[ud]/.test(o.bubble)&&O(n.target,o)}}}class E extends v{_mc={};constructor(e,t=!1){super(e)}static add=g;static remove=h;static trigger=y;trigger(e,t={},r){w.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return p(t)?m(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return p(t)?m(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!p(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=d([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return p(t)?d([...t.querySelectorAll("*[_mc]")],e):[]}}const A=new Map,_=new Map;function j(e){const t="/"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),b(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),b(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function S(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!A.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),j(t));b(r,"load",(()=>{A.set(t,customElements.get(e.tagName.toLowerCase()))})),A.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!_.has(e)));r?.forEach((e=>{const t=j(e);b(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const o=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=o,document.body.append(n)}),0);var t})),_.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>_.has(e)&&!_.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,N.state.MCs.get(t)),E.add(e,t,new(N.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let T=!1,k=null;function N(e=!0){return e?(T=e,k=new MutationObserver(S),setTimeout((()=>{k.observe(document.body,{childList:!0,subtree:!0}),S()}),5),T):(k?.disconnect(),k=null,T)}function C(e){return null!=e&&"object"==typeof e}function M(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,"")))}N.state={CEs:A,MCs:_};const L=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class x extends E{data={};oldDisplay="";constructor(e){super(e);let t=this;M(e).forEach((e=>t.data[e]="")),P(t),t.#o(),delete t._mc}#o(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var o;e.data.observe((o=t.getAttribute(r),e=>{let c=o;n.forEach((t=>{c=c.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,c)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let o=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var c;e.data.observe((c=n.nodeValue,r=>{let s=c;o.forEach((e=>{s=s.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=s})),e.oldDisplay=t.getAttribute("style)")||"",r&&!L.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const P=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,a=e[t];if(!a.prototype)switch(typeof a){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=a instanceof Array?Array:Object;break;default:return}let l=class extends r{#c=!0;constructor(e){super(e),this.constructor.callbacks=[],C(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(C(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!M(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||E.add(e,"_placeholders",new x(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),o=function(e){let t=n(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(o),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=C(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#c=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},i=new l(a);Object.defineProperty(e,t,{enumerable:!0,get(){if(C(i.valueOf())){let e=structuredClone(Object.assign({},i));setTimeout(c((function(){o(structuredClone(Object.assign({},i)),e)||i.notify()}),0),0)}return i},set(e){if(typeof e==typeof i.valueOf())if(C(i.valueOf())&&i.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},i));i instanceof l==0&&(i=new l(structuredClone(Object.assign({},e))),s(e,i),i.seal()),Object.assign(i,e),setTimeout(c((function(){o(structuredClone(Object.assign({},i)),t)||i.notify()}),0),0)}else{let t=i.valueOf(),r=i.constructor.callbacks;i=new l(e),i.constructor.callbacks=r,e!==t&&i.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof i.valueOf(),i,"- CANNOT BECOME:",typeof e)}}),e[t]=a})),e);class q{constructor(e){}}class D extends q{#s;constructor(e){super(e),this.#s=e}get val(){return new FormData(this.#s.form).get(this.#s.name)}set val(e){[...this.#s.form.querySelectorAll(`input[type="radio"][name="${this.#s.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class H extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.checked}set val(e){this.#s.checked=e}}class V extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}class I extends q{#s;#a=!1;constructor(e){super(e),this.#s=e,this.#a=e.multiple}get val(){const e=[];return[...this.#s.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#a?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#s.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class $ extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value||""}set val(e){this.#s.value=e}}const F=e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new D(e);break;case"checkbox":n=new H(e);break;default:n=new V(e)}break;case"select":n=new I(e);break;case"textarea":n=new $(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(E.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r};function J(e,t,r){let n=F(r);e[t]=Object.assign({},n),P(e,t),s(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{b(r,"keyup",(r=>{e[t].notify()})),b(r,"change",(r=>{e[t].notify()})),b(r,"select",(r=>{e[t].notify()}))}))}return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.formValues=t():e.formValues=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var o;(o=e[n])&&o.constructor&&o.constructor===Object?t[n]=r(e[n]):t[n]=e[n]})),t}function n(e,t=!0){let o={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const r=n(e[t],!1);for(const e in r)o[t+"."+e]=r[e]}else o[t]=e[t]})),t?r(o):o}function o(e,t){return JSON.stringify(n(e))===JSON.stringify(n(t))}function c(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function s(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{formValues:()=>J});var a=new Function("try {return this===window;}catch(e){ return false;}");let l=new Set;a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>l.add(e)));class i{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var u=new Function("try {return this===window;}catch(e){ return false;}");let f=new Set;function d(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function m(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function p(e){return e&&e instanceof HTMLElement}function b(e,t,r,n=!1,o=!1){let c={once:!1};n&&(c.capture=n),o&&(c.once=o),e.addEventListener(t,r,c)}function g(e,t,r={}){let n=e;if(!n._mc){let t=E?.debug;E.debug=!1,n._mc=new E(e),E.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function h(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function y(e,t,r={},n="l"){let o=e?._mc;if(!o)return;let c=t instanceof i?new i(t.type,t.data,"l"):new i(t,r,"l"),s="string"!=typeof t?t:new i(t,r,n);[...Object.values(o)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(s.bubble)&&O(e,s)}function O(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=m(e,"",!0)?.[0].target;r&&E.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&E.trigger(e,t)}))}),0)}u()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>f.add(e)));class v{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==E&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!u()||e.constructor===E)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),c=n.replace(/^on[e]{0,1}/,""),s=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),f.has("on"+s)&&b(t,s,(e=>{r.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class w extends v{_mc={};constructor(e){super(e)}static trigger=y;trigger(e,t={},r="l"){let n=this;if(n.constructor===w||n.constructor===E){let o=e instanceof i?new i(e.type,e.data,"l"):new i(e,t,"l"),c="string"!=typeof e?e:new i(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(o)})),void(/[ud]/.test(c.bubble)&&O(n.target,c))}if(n instanceof w||n instanceof E){const n=this,o="string"!=typeof e?e:new i(e,t,r),c="on"+o.type[0].toUpperCase()+o.type.slice(1);if(o.bubble.indexOf("l")>-1&&(o.immediateStopped||"function"!=typeof n[c]||(n[c](o),n.hasOwnProperty(c)&&delete n[c])),o.stopped||"l"===o.bubble)return n;/[ud]/.test(o.bubble)&&O(n.target,o)}}}class E extends v{_mc={};constructor(e,t=!1){super(e)}static add=g;static remove=h;static trigger=y;trigger(e,t={},r){w.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return p(t)?m(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return p(t)?m(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!p(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=d([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return p(t)?d([...t.querySelectorAll("*[_mc]")],e):[]}}const A=new Map,_=new Map;function j(e){const t="./"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),b(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),b(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function S(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!A.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),j(t));b(r,"load",(()=>{A.set(t,customElements.get(e.tagName.toLowerCase()))})),A.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!_.has(e)));r?.forEach((e=>{const t=j(e);b(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const o=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=o,document.body.append(n)}),0);var t})),_.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>_.has(e)&&!_.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,N.state.MCs.get(t)),E.add(e,t,new(N.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let T=!1,k=null;function N(e=!0){return e?(T=e,k=new MutationObserver(S),setTimeout((()=>{k.observe(document.body,{childList:!0,subtree:!0}),S()}),5),T):(k?.disconnect(),k=null,T)}function C(e){return null!=e&&"object"==typeof e}function M(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,"")))}N.state={CEs:A,MCs:_};const L=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class x extends E{data={};oldDisplay="";constructor(e){super(e);let t=this;M(e).forEach((e=>t.data[e]="")),P(t),t.#o(),delete t._mc}#o(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var o;e.data.observe((o=t.getAttribute(r),e=>{let c=o;n.forEach((t=>{c=c.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,c)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let o=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var c;e.data.observe((c=n.nodeValue,r=>{let s=c;o.forEach((e=>{s=s.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=s})),e.oldDisplay=t.getAttribute("style)")||"",r&&!L.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const P=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,a=e[t];if(!a.prototype)switch(typeof a){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=a instanceof Array?Array:Object;break;default:return}let l=class extends r{#c=!0;constructor(e){super(e),this.constructor.callbacks=[],C(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(C(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!M(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||E.add(e,"_placeholders",new x(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),o=function(e){let t=n(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(o),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=C(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#c=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},i=new l(a);Object.defineProperty(e,t,{enumerable:!0,get(){if(C(i.valueOf())){let e=structuredClone(Object.assign({},i));setTimeout(c((function(){o(structuredClone(Object.assign({},i)),e)||i.notify()}),0),0)}return i},set(e){if(typeof e==typeof i.valueOf())if(C(i.valueOf())&&i.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},i));i instanceof l==0&&(i=new l(structuredClone(Object.assign({},e))),s(e,i),i.seal()),Object.assign(i,e),setTimeout(c((function(){o(structuredClone(Object.assign({},i)),t)||i.notify()}),0),0)}else{let t=i.valueOf(),r=i.constructor.callbacks;i=new l(e),i.constructor.callbacks=r,e!==t&&i.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof i.valueOf(),i,"- CANNOT BECOME:",typeof e)}}),e[t]=a})),e);class q{constructor(e){}}class D extends q{#s;constructor(e){super(e),this.#s=e}get val(){return new FormData(this.#s.form).get(this.#s.name)}set val(e){[...this.#s.form.querySelectorAll(`input[type="radio"][name="${this.#s.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class H extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.checked}set val(e){this.#s.checked=e}}class V extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}class I extends q{#s;#a=!1;constructor(e){super(e),this.#s=e,this.#a=e.multiple}get val(){const e=[];return[...this.#s.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#a?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#s.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class $ extends q{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value||""}set val(e){this.#s.value=e}}const F=e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new D(e);break;case"checkbox":n=new H(e);break;default:n=new V(e)}break;case"select":n=new I(e);break;case"textarea":n=new $(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(E.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r};function J(e,t,r){let n=F(r);e[t]=Object.assign({},n),P(e,t),s(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{b(r,"keyup",(r=>{e[t].notify()})),b(r,"change",(r=>{e[t].notify()})),b(r,"select",(r=>{e[t].notify()}))}))}return t})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microcomponents=t():e.microcomponents=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return e&&e.constructor&&e.constructor===Object}function n(e){let t={};return[...Object.keys(e)].sort().forEach((a=>{r(e[a])?t[a]=n(e[a]):t[a]=e[a]})),t}function a(e,t=!0){let r={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const n=a(e[t],!1);for(const e in n)r[t+"."+e]=n[e]}else r[t]=e[t]})),t?n(r):r}function s(e,t){return JSON.stringify(a(e))===JSON.stringify(a(t))}function o(e,t={}){let r=e.constructor===String?e.split("."):e;if(t&&r[0]&&t[r[0]])return t[r[0]].constructor===Object&&r.length>1?o(r.splice(1),t[r[0]]):t[r[0]];console.warn("ns",r[0],"not in",t)}function c(e,t){var n=Array.from(arguments);if(n.length>2){for(;n.length>1;)n[0]=c(n[0],n[1]),n.splice(1,1);return n[0]}if("string"==typeof e)e.match(/\{[^\{\}]*\}/g)?.forEach((function(r){var n=o(r.substring(1,r.length-1),t);void 0!==n&&(e=e.replace(r,n))}));else if(r(e))switch(e.constructor){case Object:Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&(e[r]=c(e[r],t))}));break;case Array:e.forEach((function(r,n,a){a[n]=c(e[n],t)}))}return e}function i(e){return e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function l(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function u(e){let t=document.createElement("template");return e=e.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),t.innerHTML=e,t.content.normalize(),Array.from(t.content.childNodes)}function f(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{$d:()=>Q,$t:()=>X,DC:()=>k,MC:()=>x,McBase:()=>_,McEvent:()=>p,addListener:()=>v,autoload:()=>P,copyGettersSetters:()=>f,debounce:()=>l,deepEqual:()=>s,defineCE:()=>q,flattenObject:()=>a,formValues:()=>ce,getCE:()=>D,htmlToElements:()=>u,isNativeObject:()=>r,kebabToPascal:()=>i,nameSpace:()=>o,observe:()=>J,parse:()=>c,removeListener:()=>w,sortObject:()=>n});var h=new Function("try {return this===window;}catch(e){ return false;}");let d=new Set;h()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>d.add(e)));class p{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var m=new Function("try {return this===window;}catch(e){ return false;}");let g=new Set;function b(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function y(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function E(e){return e&&e instanceof HTMLElement}function v(e,t,r,n=!1,a=!1){let s={once:!1};n&&(s.capture=n),a&&(s.once=a),e.addEventListener(t,r,s)}function w(e,t,r){e.removeEventListener(t,r)}function O(e,t,r={}){let n=e;if(!n._mc){let t=k?.debug;k.debug=!1,n._mc=new k(e),k.debug=t,delete n._mc._mc}const a=n._mc;return t.length&&!a[t]&&(a[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function A(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function S(e,t,r={},n="l"){let a=e?._mc;if(!a)return;let s=t instanceof p?new p(t.type,t.data,"l"):new p(t,r,"l"),o="string"!=typeof t?t:new p(t,r,n);[...Object.values(a)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(s)})),/[ud]/.test(o.bubble)&&j(e,o)}function j(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=y(e,"",!0)?.[0].target;r&&k.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&k.trigger(e,t)}))}),0)}m()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>g.add(e)));class _{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==k&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!m()||e.constructor===k)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let a=/^one/.test(n),s=n.replace(/^on[e]{0,1}/,""),o=s.toLowerCase();a&&Object.defineProperty(e,"on"+s,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),g.has("on"+o)&&v(t,o,(e=>{r.trigger(s,e)}),!1,a)}))}}(this)}get target(){return this.#n.deref()}}class x extends _{_mc={};constructor(e){super(e)}static trigger=S;trigger(e,t={},r="l"){let n=this;if(n.constructor===x||n.constructor===k){let a=e instanceof p?new p(e.type,e.data,"l"):new p(e,t,"l"),s="string"!=typeof e?e:new p(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(a)})),void(/[ud]/.test(s.bubble)&&j(n.target,s))}if(n instanceof x||n instanceof k){const n=this,a="string"!=typeof e?e:new p(e,t,r),s="on"+a.type[0].toUpperCase()+a.type.slice(1);if(a.bubble.indexOf("l")>-1&&(a.immediateStopped||"function"!=typeof n[s]||(n[s](a),n.hasOwnProperty(s)&&delete n[s])),a.stopped||"l"===a.bubble)return n;/[ud]/.test(a.bubble)&&j(n.target,a)}}}class k extends _{_mc={};constructor(e,t=!1){super(e)}static add=O;static remove=A;static trigger=S;trigger(e,t={},r){x.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return E(t)?y(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return E(t)?y(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!E(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const a=b([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),a}descendants(e=""){let t=this?.target;return E(t)?b([...t.querySelectorAll("*[_mc]")],e):[]}}const T=new Map,C=new Map;function N(e){const t="/"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),v(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),v(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function L(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!T.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),N(t));v(r,"load",(()=>{T.set(t,customElements.get(e.tagName.toLowerCase()))})),T.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!C.has(e)));r?.forEach((e=>{const t=N(e);v(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const a=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=a,document.body.append(n)}),0);var t})),C.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>C.has(e)&&!C.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,P.state.MCs.get(t)),k.add(e,t,new(P.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let M=!1,$=null;function P(e=!0){return e?(M=e,$=new MutationObserver(L),setTimeout((()=>{$.observe(document.body,{childList:!0,subtree:!0}),L()}),5),M):($?.disconnect(),$=null,M)}P.state={CEs:T,MCs:C};class H extends HTMLElement{constructor(){super()}connectedCallback(){k.trigger(this,"Connected")}disconnectedCallback(){k.trigger(this,"Disconnected")}adoptedCallback(){k.trigger(this,"Adopted")}attributeChangedCallback(e,t,r){k.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:r})}}function q(e,t,r=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let n=i(e);customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(n,class extends H{instance;constructor(e){super();let r=new t(this,e);k.add(this,n,r)}static get observedAttributes(){return r}}))}function D(e){return customElements.get(e)}function I(e){return null!=e&&"object"==typeof e}function B(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,"")))}const V=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class z extends k{data={};oldDisplay="";constructor(e){super(e);let t=this;B(e).forEach((e=>t.data[e]="")),J(t),t.#a(),delete t._mc}#a(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var a;e.data.observe((a=t.getAttribute(r),e=>{let s=a;n.forEach((t=>{s=s.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,s)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let a=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var s;e.data.observe((s=n.nodeValue,r=>{let o=s;a.forEach((e=>{o=o.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=o})),e.oldDisplay=t.getAttribute("style)")||"",r&&!V.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const J=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,n=e[t];if(!n.prototype)switch(typeof n){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=n instanceof Array?Array:Object;break;default:return}let o=class extends r{#s=!0;constructor(e){super(e),this.constructor.callbacks=[],I(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(I(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!B(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||k.add(e,"_placeholders",new z(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),n=function(e){let t=a(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(n),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=I(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#s=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},c=new o(n);Object.defineProperty(e,t,{enumerable:!0,get(){if(I(c.valueOf())){let e=structuredClone(Object.assign({},c));setTimeout(l((function(){s(structuredClone(Object.assign({},c)),e)||c.notify()}),0),0)}return c},set(e){if(typeof e==typeof c.valueOf())if(I(c.valueOf())&&c.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},c));c instanceof o==0&&(c=new o(structuredClone(Object.assign({},e))),f(e,c),c.seal()),Object.assign(c,e),setTimeout(l((function(){s(structuredClone(Object.assign({},c)),t)||c.notify()}),0),0)}else{let t=c.valueOf(),r=c.constructor.callbacks;c=new o(e),c.constructor.callbacks=r,e!==t&&c.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof c.valueOf(),c,"- CANNOT BECOME:",typeof e)}}),e[t]=n})),e),F=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},G=e=>{let t=Q("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let a;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":a=new W(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"select":a=new Z(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"textarea":a=new U(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class R{constructor(e){}}class W extends R{#o;#e;#c;constructor(e,t){super(e),this.#o=e,this.#e=e.type,this.#c=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=Q(`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,this.#c).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#o.checked;default:return t.#o.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,n=Q(r,this.#c);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const a=n.filter((t=>t.getAttribute("value")===e));if(!a.length)return;return void(a.array[0].checked=!0);case"checkbox":t.#o.checked=e;break;default:t.#o.value=e}}}class Z extends R{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i="select-multiple"===e.type}get val(){const e=[];return Q(this.#o.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,Q(this.#o.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class U extends R{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class Y{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new K;return this.#l.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return Q(e,t).forEach((e=>{r.#l.add(e)})),r}addClass(...e){return e=F(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=Q(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=Q(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=Q(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{Q(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=Q(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,a=!1;return e&&(a=Q(e,t)),r.#l.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=Q([...n]),e&&r.filter((e=>a.has(e))),r}has(e){return this.#l.has(e)}hasClass(...e){return e=F(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)+1;a<r.length&&n.add(r.at(a))}})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#l.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){w(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let a=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(a,Array.from(arguments))}return o.cb=t,a.forEach((e=>{s.forEach((function(t){v(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e,t,s,r,!0)}))})),s}parent(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=Q(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)-1;a>-1&&n.add(r.at(a))}})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=F(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=F(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,a=!1){let s,o={bubbles:r,cancelable:n,composed:a},c=e.indexOf(" ")>-1?e.split(" "):[e];return this.#l.forEach((e=>{c.forEach((function(r){s=new Event(r,o),s.data=t,e.dispatchEvent(s)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,a=G(r.array[0]);var s;return e?null!=(s=e)&&"object"==typeof s?(Object.assign(a,e),n=r):"string"==typeof e&&(void 0===t?n=a[e]:(a[e]=t,n=r)):n=Object.assign({},a),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=G(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return Q(this.array.at(e))}concat(e){let t=this;return(e instanceof Y?e.array:e).forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#l=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#l.add(e)})),this}shift(){let e=this,t=e.#l.size?e.array[0]:void 0;return t&&e.#l.delete(t),t}slice(e,t){return Q(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),Q(n)}}class K{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}set length(e){}constructor(e,t=document.body){if(!e)return this;Q(e,t).forEach((e=>{X(e).forEach((e=>{this.#l.add(e)}))}))}$d(e,t=document.body){let r=new Y,n=new Set,a=!!e||!1,s=new Set;return a&&(s=Q(e,t).set),this.#l.forEach((e=>{a&&!s.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}descendants(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}first(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#l.has(e)}last(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);X([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){w(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e._tg,`[TB]${t}`,s,!1,r)}))})),s}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(r,Array.from(arguments))}return a.cb=t,r.forEach((e=>{n.forEach((function(t){v(e._tg,`[TB]${t}`,a,!1,!0)}))})),a}parent(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}parents(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}prev(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);X([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return X(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return X(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#l=new Set(e),t}push(e){return this.#l.add(e),this}shift(){let e=this.array.shift();return this.#l.delete(e),e}slice(e,t){return X(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return X(n)}}const Q=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{Q(e,t).forEach((e=>{r.add(e)}))})),new Y([...r])):new Y(e,t)},X=(e,t=document)=>Q(e,t).$t();class ee{constructor(e){}}class te extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return new FormData(this.#o.form).get(this.#o.name)}set val(e){[...this.#o.form.querySelectorAll(`input[type="radio"][name="${this.#o.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class re extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.checked}set val(e){this.#o.checked=e}}class ne extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class ae extends ee{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i=e.multiple}get val(){const e=[];return[...this.#o.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#o.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class se extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value||""}set val(e){this.#o.value=e}}const oe=e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new te(e);break;case"checkbox":n=new re(e);break;default:n=new ne(e)}break;case"select":n=new ae(e);break;case"textarea":n=new se(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(k.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r};function ce(e,t,r){let n=oe(r);e[t]=Object.assign({},n),J(e,t),f(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{v(r,"keyup",(r=>{e[t].notify()})),v(r,"change",(r=>{e[t].notify()})),v(r,"select",(r=>{e[t].notify()}))}))}return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microcomponents=t():e.microcomponents=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return e&&e.constructor&&e.constructor===Object}function n(e){let t={};return[...Object.keys(e)].sort().forEach((a=>{r(e[a])?t[a]=n(e[a]):t[a]=e[a]})),t}function a(e,t=!0){let r={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const n=a(e[t],!1);for(const e in n)r[t+"."+e]=n[e]}else r[t]=e[t]})),t?n(r):r}function s(e,t){return JSON.stringify(a(e))===JSON.stringify(a(t))}function o(e,t={}){let r=e.constructor===String?e.split("."):e;if(t&&r[0]&&t[r[0]])return t[r[0]].constructor===Object&&r.length>1?o(r.splice(1),t[r[0]]):t[r[0]];console.warn("ns",r[0],"not in",t)}function c(e,t){var n=Array.from(arguments);if(n.length>2){for(;n.length>1;)n[0]=c(n[0],n[1]),n.splice(1,1);return n[0]}if("string"==typeof e)e.match(/\{[^\{\}]*\}/g)?.forEach((function(r){var n=o(r.substring(1,r.length-1),t);void 0!==n&&(e=e.replace(r,n))}));else if(r(e))switch(e.constructor){case Object:Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&(e[r]=c(e[r],t))}));break;case Array:e.forEach((function(r,n,a){a[n]=c(e[n],t)}))}return e}function i(e){return e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join("")}function l(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}function u(e){let t=document.createElement("template");return e=e.replace(/<([A-Za-z0-9\-]*)([^>\/]*)(\/>)/gi,"<$1$2></$1>"),t.innerHTML=e,t.content.normalize(),Array.from(t.content.childNodes)}function f(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}e.r(t),e.d(t,{$d:()=>Q,$t:()=>X,DC:()=>k,MC:()=>x,McBase:()=>_,McEvent:()=>p,addListener:()=>v,autoload:()=>P,copyGettersSetters:()=>f,debounce:()=>l,deepEqual:()=>s,defineCE:()=>q,flattenObject:()=>a,formValues:()=>ce,getCE:()=>D,htmlToElements:()=>u,isNativeObject:()=>r,kebabToPascal:()=>i,nameSpace:()=>o,observe:()=>J,parse:()=>c,removeListener:()=>w,sortObject:()=>n});var h=new Function("try {return this===window;}catch(e){ return false;}");let d=new Set;h()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>d.add(e)));class p{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var m=new Function("try {return this===window;}catch(e){ return false;}");let g=new Set;function b(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function y(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function E(e){return e&&e instanceof HTMLElement}function v(e,t,r,n=!1,a=!1){let s={once:!1};n&&(s.capture=n),a&&(s.once=a),e.addEventListener(t,r,s)}function w(e,t,r){e.removeEventListener(t,r)}function O(e,t,r={}){let n=e;if(!n._mc){let t=k?.debug;k.debug=!1,n._mc=new k(e),k.debug=t,delete n._mc._mc}const a=n._mc;return t.length&&!a[t]&&(a[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function A(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function S(e,t,r={},n="l"){let a=e?._mc;if(!a)return;let s=t instanceof p?new p(t.type,t.data,"l"):new p(t,r,"l"),o="string"!=typeof t?t:new p(t,r,n);[...Object.values(a)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(s)})),/[ud]/.test(o.bubble)&&j(e,o)}function j(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=y(e,"",!0)?.[0].target;r&&k.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&k.trigger(e,t)}))}),0)}m()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>g.add(e)));class _{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==k&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!m()||e.constructor===k)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let a=/^one/.test(n),s=n.replace(/^on[e]{0,1}/,""),o=s.toLowerCase();a&&Object.defineProperty(e,"on"+s,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),g.has("on"+o)&&v(t,o,(e=>{r.trigger(s,e)}),!1,a)}))}}(this)}get target(){return this.#n.deref()}}class x extends _{_mc={};constructor(e){super(e)}static trigger=S;trigger(e,t={},r="l"){let n=this;if(n.constructor===x||n.constructor===k){let a=e instanceof p?new p(e.type,e.data,"l"):new p(e,t,"l"),s="string"!=typeof e?e:new p(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(a)})),void(/[ud]/.test(s.bubble)&&j(n.target,s))}if(n instanceof x||n instanceof k){const n=this,a="string"!=typeof e?e:new p(e,t,r),s="on"+a.type[0].toUpperCase()+a.type.slice(1);if(a.bubble.indexOf("l")>-1&&(a.immediateStopped||"function"!=typeof n[s]||(n[s](a),n.hasOwnProperty(s)&&delete n[s])),a.stopped||"l"===a.bubble)return n;/[ud]/.test(a.bubble)&&j(n.target,a)}}}class k extends _{_mc={};constructor(e,t=!1){super(e)}static add=O;static remove=A;static trigger=S;trigger(e,t={},r){x.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return E(t)?y(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return E(t)?y(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!E(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const a=b([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),a}descendants(e=""){let t=this?.target;return E(t)?b([...t.querySelectorAll("*[_mc]")],e):[]}}const T=new Map,C=new Map;function N(e){const t="./"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),v(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),v(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function L(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!T.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),N(t));v(r,"load",(()=>{T.set(t,customElements.get(e.tagName.toLowerCase()))})),T.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!C.has(e)));r?.forEach((e=>{const t=N(e);v(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const a=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=a,document.body.append(n)}),0);var t})),C.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>C.has(e)&&!C.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,P.state.MCs.get(t)),k.add(e,t,new(P.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let M=!1,$=null;function P(e=!0){return e?(M=e,$=new MutationObserver(L),setTimeout((()=>{$.observe(document.body,{childList:!0,subtree:!0}),L()}),5),M):($?.disconnect(),$=null,M)}P.state={CEs:T,MCs:C};class H extends HTMLElement{constructor(){super()}connectedCallback(){k.trigger(this,"Connected")}disconnectedCallback(){k.trigger(this,"Disconnected")}adoptedCallback(){k.trigger(this,"Adopted")}attributeChangedCallback(e,t,r){k.trigger(this,"AttributeChanged",{name:e,oldValue:t,newValue:r})}}function q(e,t,r=[]){if(customElements.get(e))return void console.warn(`IGNORED: Custom element "${e}" is already defined!`);if(!e.includes("-"))throw new Error('createCustomElement: tagName must contain at least one hyphen ("-").');let n=i(e);customElements.define(e,function(e,t){return Object.defineProperty(t,"name",{value:e})}(n,class extends H{instance;constructor(e){super();let r=new t(this,e);k.add(this,n,r)}static get observedAttributes(){return r}}))}function D(e){return customElements.get(e)}function I(e){return null!=e&&"object"==typeof e}function B(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,"")))}const V=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class z extends k{data={};oldDisplay="";constructor(e){super(e);let t=this;B(e).forEach((e=>t.data[e]="")),J(t),t.#a(),delete t._mc}#a(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var a;e.data.observe((a=t.getAttribute(r),e=>{let s=a;n.forEach((t=>{s=s.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,s)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let a=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var s;e.data.observe((s=n.nodeValue,r=>{let o=s;a.forEach((e=>{o=o.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=o})),e.oldDisplay=t.getAttribute("style)")||"",r&&!V.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const J=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,n=e[t];if(!n.prototype)switch(typeof n){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=n instanceof Array?Array:Object;break;default:return}let o=class extends r{#s=!0;constructor(e){super(e),this.constructor.callbacks=[],I(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(I(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!B(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||k.add(e,"_placeholders",new z(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),n=function(e){let t=a(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(n),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=I(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#s=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},c=new o(n);Object.defineProperty(e,t,{enumerable:!0,get(){if(I(c.valueOf())){let e=structuredClone(Object.assign({},c));setTimeout(l((function(){s(structuredClone(Object.assign({},c)),e)||c.notify()}),0),0)}return c},set(e){if(typeof e==typeof c.valueOf())if(I(c.valueOf())&&c.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},c));c instanceof o==0&&(c=new o(structuredClone(Object.assign({},e))),f(e,c),c.seal()),Object.assign(c,e),setTimeout(l((function(){s(structuredClone(Object.assign({},c)),t)||c.notify()}),0),0)}else{let t=c.valueOf(),r=c.constructor.callbacks;c=new o(e),c.constructor.callbacks=r,e!==t&&c.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof c.valueOf(),c,"- CANNOT BECOME:",typeof e)}}),e[t]=n})),e),F=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},G=e=>{let t=Q("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let a;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":a=new W(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"select":a=new Z(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;case"textarea":a=new U(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>a.val,set:e=>{a.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class R{constructor(e){}}class W extends R{#o;#e;#c;constructor(e,t){super(e),this.#o=e,this.#e=e.type,this.#c=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=Q(`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,this.#c).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#o.checked;default:return t.#o.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#o.getAttribute("name")}"]`,n=Q(r,this.#c);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const a=n.filter((t=>t.getAttribute("value")===e));if(!a.length)return;return void(a.array[0].checked=!0);case"checkbox":t.#o.checked=e;break;default:t.#o.value=e}}}class Z extends R{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i="select-multiple"===e.type}get val(){const e=[];return Q(this.#o.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,Q(this.#o.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class U extends R{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class Y{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new K;return this.#l.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return Q(e,t).forEach((e=>{r.#l.add(e)})),r}addClass(...e){return e=F(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=Q(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=Q(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=Q(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{Q(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=Q(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,a=!1;return e&&(a=Q(e,t)),r.#l.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=Q([...n]),e&&r.filter((e=>a.has(e))),r}has(e){return this.#l.has(e)}hasClass(...e){return e=F(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)+1;a<r.length&&n.add(r.at(a))}})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#l.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){w(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let a=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(a,Array.from(arguments))}return o.cb=t,a.forEach((e=>{s.forEach((function(t){v(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e,t,s,r,!0)}))})),s}parent(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=Q(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#l.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),a=r.indexOf(e)-1;a>-1&&n.add(r.at(a))}})),r=Q([...n]),e){let n=Q(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=F(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=F(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,a=!1){let s,o={bubbles:r,cancelable:n,composed:a},c=e.indexOf(" ")>-1?e.split(" "):[e];return this.#l.forEach((e=>{c.forEach((function(r){s=new Event(r,o),s.data=t,e.dispatchEvent(s)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,a=G(r.array[0]);var s;return e?null!=(s=e)&&"object"==typeof s?(Object.assign(a,e),n=r):"string"==typeof e&&(void 0===t?n=a[e]:(a[e]=t,n=r)):n=Object.assign({},a),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=G(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return Q(this.array.at(e))}concat(e){let t=this;return(e instanceof Y?e.array:e).forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#l=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#l.add(e)})),this}shift(){let e=this,t=e.#l.size?e.array[0]:void 0;return t&&e.#l.delete(t),t}slice(e,t){return Q(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),Q(n)}}class K{#l=new Set;get set(){return this.#l}get array(){return Array.from(this.#l)}set set(e){this.#l=e}get length(){return this.#l.size}set length(e){}constructor(e,t=document.body){if(!e)return this;Q(e,t).forEach((e=>{X(e).forEach((e=>{this.#l.add(e)}))}))}$d(e,t=document.body){let r=new Y,n=new Set,a=!!e||!1,s=new Set;return a&&(s=Q(e,t).set),this.#l.forEach((e=>{a&&!s.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}descendants(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}first(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#l.has(e)}last(e){let t=this,r=new Set;return t.#l.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);X([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){w(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(n,Array.from(arguments))}return s.cb=t,n.forEach((e=>{a.forEach((function(t){v(e._tg,`[TB]${t}`,s,!1,r)}))})),s}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(r,Array.from(arguments))}return a.cb=t,r.forEach((e=>{n.forEach((function(t){v(e._tg,`[TB]${t}`,a,!1,!0)}))})),a}parent(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}parents(e){let t=this,r=new Set;return t.#l.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#l=r,t}prev(e){let t=this,r=new Set;return t.#l.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);X([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#l=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return X(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#l.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return X(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#l=new Set(e),t}push(e){return this.#l.add(e),this}shift(){let e=this.array.shift();return this.#l.delete(e),e}slice(e,t){return X(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return X(n)}}const Q=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{Q(e,t).forEach((e=>{r.add(e)}))})),new Y([...r])):new Y(e,t)},X=(e,t=document)=>Q(e,t).$t();class ee{constructor(e){}}class te extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return new FormData(this.#o.form).get(this.#o.name)}set val(e){[...this.#o.form.querySelectorAll(`input[type="radio"][name="${this.#o.name}"]`)].filter((t=>t.getAttribute("value")===e)).shift().checked=!0}}class re extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.checked}set val(e){this.#o.checked=e}}class ne extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value}set val(e){this.#o.value=e}}class ae extends ee{#o;#i=!1;constructor(e){super(e),this.#o=e,this.#i=e.multiple}get val(){const e=[];return[...this.#o.querySelectorAll("option")].filter((e=>e.selected)).forEach((t=>{e.push(t.value)})),this.#i?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,[...this.#o.querySelectorAll("option")].forEach((t=>{e.indexOf(t.value)>-1?t.selected=!0:t.selected=!1}))}}class se extends ee{#o;constructor(e){super(e),this.#o=e}get val(){return this.#o.value||""}set val(e){this.#o.value=e}}const oe=e=>{let t=[...(e||document).querySelectorAll("input,select,textarea")],r={};return t.forEach((e=>{const t=e.getAttribute("name");if(t){let n=!1;switch((e=>e.tagName.toLowerCase())(e)){case"input":switch(e.type){case"radio":n=new te(e);break;case"checkbox":n=new re(e);break;default:n=new ne(e)}break;case"select":n=new ae(e);break;case"textarea":n=new se(e);break;default:console.warn("handler missing:",t,"for",e.tagName.toLowerCase(),e)}n&&(k.add(e,t,n),Object.defineProperty(r,t,{enumerable:!0,configurable:!0,get:()=>n.val,set:e=>{n.val!==e&&(n.val=e)}}))}})),r};function ce(e,t,r){let n=oe(r);e[t]=Object.assign({},n),J(e,t),f(n,e[t]),[...r.querySelectorAll("input, textarea, select")].forEach((r=>{v(r,"keyup",(r=>{e[t].notify()})),v(r,"change",(r=>{e[t].notify()})),v(r,"select",(r=>{e[t].notify()}))}))}return t})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.observables=t():e.observables=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var o;(o=e[n])&&o.constructor&&o.constructor===Object?t[n]=r(e[n]):t[n]=e[n]})),t}function n(e,t=!0){let o={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const r=n(e[t],!1);for(const e in r)o[t+"."+e]=r[e]}else o[t]=e[t]})),t?r(o):o}function o(e,t){return JSON.stringify(n(e))===JSON.stringify(n(t))}function c(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}e.r(t),e.d(t,{observe:()=>P});var a=new Function("try {return this===window;}catch(e){ return false;}");let s=new Set;a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>s.add(e)));class i{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var l=new Function("try {return this===window;}catch(e){ return false;}");let u=new Set;function f(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function d(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function m(e){return e&&e instanceof HTMLElement}function p(e,t,r,n=!1,o=!1){let c={once:!1};n&&(c.capture=n),o&&(c.once=o),e.addEventListener(t,r,c)}function b(e,t,r={}){let n=e;if(!n._mc){let t=w?.debug;w.debug=!1,n._mc=new w(e),w.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function g(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function h(e,t,r={},n="l"){let o=e?._mc;if(!o)return;let c=t instanceof i?new i(t.type,t.data,"l"):new i(t,r,"l"),a="string"!=typeof t?t:new i(t,r,n);[...Object.values(o)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(a.bubble)&&y(e,a)}function y(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=d(e,"",!0)?.[0].target;r&&w.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&w.trigger(e,t)}))}),0)}l()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>u.add(e)));class O{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==w&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!l()||e.constructor===w)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),c=n.replace(/^on[e]{0,1}/,""),a=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),u.has("on"+a)&&p(t,a,(e=>{r.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class E extends O{_mc={};constructor(e){super(e)}static trigger=h;trigger(e,t={},r="l"){let n=this;if(n.constructor===E||n.constructor===w){let o=e instanceof i?new i(e.type,e.data,"l"):new i(e,t,"l"),c="string"!=typeof e?e:new i(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(o)})),void(/[ud]/.test(c.bubble)&&y(n.target,c))}if(n instanceof E||n instanceof w){const n=this,o="string"!=typeof e?e:new i(e,t,r),c="on"+o.type[0].toUpperCase()+o.type.slice(1);if(o.bubble.indexOf("l")>-1&&(o.immediateStopped||"function"!=typeof n[c]||(n[c](o),n.hasOwnProperty(c)&&delete n[c])),o.stopped||"l"===o.bubble)return n;/[ud]/.test(o.bubble)&&y(n.target,o)}}}class w extends O{_mc={};constructor(e,t=!1){super(e)}static add=b;static remove=g;static trigger=h;trigger(e,t={},r){E.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return m(t)?d(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return m(t)?d(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!m(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=f([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return m(t)?f([...t.querySelectorAll("*[_mc]")],e):[]}}const _=new Map,v=new Map;function A(e){const t="/"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),p(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),p(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function j(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!_.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),A(t));p(r,"load",(()=>{_.set(t,customElements.get(e.tagName.toLowerCase()))})),_.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!v.has(e)));r?.forEach((e=>{const t=A(e);p(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const o=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=o,document.body.append(n)}),0);var t})),v.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>v.has(e)&&!v.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,N.state.MCs.get(t)),w.add(e,t,new(N.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let S=!1,T=null;function N(e=!0){return e?(S=e,T=new MutationObserver(j),setTimeout((()=>{T.observe(document.body,{childList:!0,subtree:!0}),j()}),5),S):(T?.disconnect(),T=null,S)}function M(e){return null!=e&&"object"==typeof e}function C(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,"")))}N.state={CEs:_,MCs:v};const L=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class k extends w{data={};oldDisplay="";constructor(e){super(e);let t=this;C(e).forEach((e=>t.data[e]="")),P(t),t.#o(),delete t._mc}#o(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var o;e.data.observe((o=t.getAttribute(r),e=>{let c=o;n.forEach((t=>{c=c.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,c)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let o=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var c;e.data.observe((c=n.nodeValue,r=>{let a=c;o.forEach((e=>{a=a.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=a})),e.oldDisplay=t.getAttribute("style)")||"",r&&!L.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const P=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,a=e[t];if(!a.prototype)switch(typeof a){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=a instanceof Array?Array:Object;break;default:return}let s=class extends r{#c=!0;constructor(e){super(e),this.constructor.callbacks=[],M(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(M(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!C(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||w.add(e,"_placeholders",new k(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),o=function(e){let t=n(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(o),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=M(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#c=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},i=new s(a);Object.defineProperty(e,t,{enumerable:!0,get(){if(M(i.valueOf())){let e=structuredClone(Object.assign({},i));setTimeout(c((function(){o(structuredClone(Object.assign({},i)),e)||i.notify()}),0),0)}return i},set(e){if(typeof e==typeof i.valueOf())if(M(i.valueOf())&&i.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},i));i instanceof s==0&&(i=new s(structuredClone(Object.assign({},e))),function(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}(e,i),i.seal()),Object.assign(i,e),setTimeout(c((function(){o(structuredClone(Object.assign({},i)),t)||i.notify()}),0),0)}else{let t=i.valueOf(),r=i.constructor.callbacks;i=new s(e),i.constructor.callbacks=r,e!==t&&i.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof i.valueOf(),i,"- CANNOT BECOME:",typeof e)}}),e[t]=a})),e);return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.observables=t():e.observables=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){let t={};return[...Object.keys(e)].sort().forEach((n=>{var o;(o=e[n])&&o.constructor&&o.constructor===Object?t[n]=r(e[n]):t[n]=e[n]})),t}function n(e,t=!0){let o={};return[...Object.getOwnPropertyNames(e)].forEach((t=>{if(e[t]&&e[t].constructor&&e[t].constructor===Object){const r=n(e[t],!1);for(const e in r)o[t+"."+e]=r[e]}else o[t]=e[t]})),t?r(o):o}function o(e,t){return JSON.stringify(n(e))===JSON.stringify(n(t))}function c(e,t){let r;return()=>{clearTimeout(r),r=setTimeout((function(){e(...arguments)}),t)}}e.r(t),e.d(t,{observe:()=>P});var a=new Function("try {return this===window;}catch(e){ return false;}");let s=new Set;a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>s.add(e)));class i{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var l=new Function("try {return this===window;}catch(e){ return false;}");let u=new Set;function f(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function d(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function m(e){return e&&e instanceof HTMLElement}function p(e,t,r,n=!1,o=!1){let c={once:!1};n&&(c.capture=n),o&&(c.once=o),e.addEventListener(t,r,c)}function b(e,t,r={}){let n=e;if(!n._mc){let t=w?.debug;w.debug=!1,n._mc=new w(e),w.debug=t,delete n._mc._mc}const o=n._mc;return t.length&&!o[t]&&(o[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function g(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function h(e,t,r={},n="l"){let o=e?._mc;if(!o)return;let c=t instanceof i?new i(t.type,t.data,"l"):new i(t,r,"l"),a="string"!=typeof t?t:new i(t,r,n);[...Object.values(o)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(c)})),/[ud]/.test(a.bubble)&&y(e,a)}function y(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=d(e,"",!0)?.[0].target;r&&w.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&w.trigger(e,t)}))}),0)}l()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>u.add(e)));class O{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==w&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!l()||e.constructor===w)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let o=/^one/.test(n),c=n.replace(/^on[e]{0,1}/,""),a=c.toLowerCase();o&&Object.defineProperty(e,"on"+c,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),u.has("on"+a)&&p(t,a,(e=>{r.trigger(c,e)}),!1,o)}))}}(this)}get target(){return this.#n.deref()}}class E extends O{_mc={};constructor(e){super(e)}static trigger=h;trigger(e,t={},r="l"){let n=this;if(n.constructor===E||n.constructor===w){let o=e instanceof i?new i(e.type,e.data,"l"):new i(e,t,"l"),c="string"!=typeof e?e:new i(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(o)})),void(/[ud]/.test(c.bubble)&&y(n.target,c))}if(n instanceof E||n instanceof w){const n=this,o="string"!=typeof e?e:new i(e,t,r),c="on"+o.type[0].toUpperCase()+o.type.slice(1);if(o.bubble.indexOf("l")>-1&&(o.immediateStopped||"function"!=typeof n[c]||(n[c](o),n.hasOwnProperty(c)&&delete n[c])),o.stopped||"l"===o.bubble)return n;/[ud]/.test(o.bubble)&&y(n.target,o)}}}class w extends O{_mc={};constructor(e,t=!1){super(e)}static add=b;static remove=g;static trigger=h;trigger(e,t={},r){E.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return m(t)?d(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return m(t)?d(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!m(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const o=f([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),o}descendants(e=""){let t=this?.target;return m(t)?f([...t.querySelectorAll("*[_mc]")],e):[]}}const _=new Map,v=new Map;function A(e){const t="./"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),p(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),p(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function j(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!_.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),A(t));p(r,"load",(()=>{_.set(t,customElements.get(e.tagName.toLowerCase()))})),_.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!v.has(e)));r?.forEach((e=>{const t=A(e);p(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const o=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=o,document.body.append(n)}),0);var t})),v.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>v.has(e)&&!v.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,N.state.MCs.get(t)),w.add(e,t,new(N.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let S=!1,T=null;function N(e=!0){return e?(S=e,T=new MutationObserver(j),setTimeout((()=>{T.observe(document.body,{childList:!0,subtree:!0}),j()}),5),S):(T?.disconnect(),T=null,S)}function M(e){return null!=e&&"object"==typeof e}function C(e){let t=new Set,r=/\{[^\{\}]*\}/g;return e.getAttributeNames().filter((t=>e.getAttribute(t)?.match(r))).forEach((n=>{new Set(e.getAttribute(n)?.match(r)).forEach((e=>t.add(e.replace(/[\{\}]/g,""))))})),[...e.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(r))).forEach((e=>{(e.nodeValue||"").match(r).forEach((e=>{t.add(e.replace(/[\{\}]/g,""))}))})),[...t].map((e=>e.replace(/[\{\}]/g,"")))}N.state={CEs:_,MCs:v};const L=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement];class k extends w{data={};oldDisplay="";constructor(e){super(e);let t=this;C(e).forEach((e=>t.data[e]="")),P(t),t.#o(),delete t._mc}#o(){let e=this,t=e.target,r=!1;t.getAttributeNames().filter((e=>t.getAttribute(e)?.match(/\{[^\{\}]*\}/g))).forEach((r=>{let n=new Set(t.getAttribute(r)?.match(/\{[^\{\}]*\}/g));var o;e.data.observe((o=t.getAttribute(r),e=>{let c=o;n.forEach((t=>{c=c.replace(t,e[t.replace(/[\{\}]/g,"")])})),t.setAttribute(r,c)}))})),[...t.childNodes].filter((e=>3===e.nodeType&&(e.nodeValue||"").match(/\{[^\{\}]*\}/g))).forEach((n=>{r=!0;let o=new Set(n.nodeValue.match(/\{[^\{\}]*\}/g));var c;e.data.observe((c=n.nodeValue,r=>{let a=c;o.forEach((e=>{a=a.replace(e,r[e.replace(/[\{\}]/g,"")])})),Object.keys(r).some((e=>!!r[e]))&&(e.oldDisplay?t.style=e.oldDisplay:t.removeAttribute("style"),delete e.oldDisplay),n.nodeValue=a})),e.oldDisplay=t.getAttribute("style)")||"",r&&!L.includes(t.constructor)&&"FIELDSET"!==t.tagName&&(t.style.display="none")}))}onData(e){let t=this,r={};Object.keys(e.data).forEach((n=>{t.data.hasOwnProperty(n)&&(r[n]=e.data[n])})),JSON.stringify(r)!==JSON.stringify(t.data)&&Object.assign(t.data,r)}}const P=(e,t)=>((t?[t]:[...Object.getOwnPropertyNames(e)]).forEach((t=>{if("_"===t[0]||void 0===e?.[t])return e;let r,a=e[t];if(!a.prototype)switch(typeof a){case"string":r=String;break;case"number":r=Number;break;case"boolean":r=Boolean;break;case"object":r=a instanceof Array?Array:Object;break;default:return}let s=class extends r{#c=!0;constructor(e){super(e),this.constructor.callbacks=[],M(e)&&Object.getOwnPropertyNames(e).forEach((t=>{this[t]=e[t]}))}observe(e){return this.constructor.callbacks.push(e),this}bind(e){const t=this;if(M(t.valueOf())){!function(e){var t;(t=e,(t instanceof HTMLElement?[t]:[]).concat([...t.querySelectorAll("*")]).filter((e=>!!C(e).length)).filter((e=>"STYLE"!==e.tagName))).forEach((e=>{e?._mc?._placeholders||w.add(e,"_placeholders",new k(e))}))}(e);const r=[...e.querySelectorAll("[_mc]")].filter((e=>!!e?._mc?._placeholders)),o=function(e){let t=n(e);r.forEach((e=>{e&&e._mc.trigger("data",t)}))};t.constructor.callbacks.push(o),t.notify()}else console.warn("IGNORED - cannot bind a non-Object to the dom, IS:",typeof t.valueOf(),t);return this}notify(e){let t=this,r=M(t.valueOf())&&t.valueOf()instanceof Array==0?structuredClone(Object.assign({},t)):t.valueOf();return void 0!==e&&(t.#c=e),t.constructor.callbacks.forEach((e=>{e(r)})),t}},i=new s(a);Object.defineProperty(e,t,{enumerable:!0,get(){if(M(i.valueOf())){let e=structuredClone(Object.assign({},i));setTimeout(c((function(){o(structuredClone(Object.assign({},i)),e)||i.notify()}),0),0)}return i},set(e){if(typeof e==typeof i.valueOf())if(M(i.valueOf())&&i.valueOf()instanceof Array==0){let t=structuredClone(Object.assign({},i));i instanceof s==0&&(i=new s(structuredClone(Object.assign({},e))),function(e,t){const r=Object.getOwnPropertyDescriptors(e);for(const[e,n]of Object.entries(r))("get"in n||"set"in n)&&Object.defineProperty(t,e,n)}(e,i),i.seal()),Object.assign(i,e),setTimeout(c((function(){o(structuredClone(Object.assign({},i)),t)||i.notify()}),0),0)}else{let t=i.valueOf(),r=i.constructor.callbacks;i=new s(e),i.constructor.callbacks=r,e!==t&&i.notify()}else console.warn("IGNORED - cannot change observable types, IS:",typeof i.valueOf(),i,"- CANNOT BECOME:",typeof e)}}),e[t]=a})),e);return t})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.selectors=t():e.selectors=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{$d:()=>C,$t:()=>H});var r=new Function("try {return this===window;}catch(e){ return false;}");let n=new Set;r()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>n.add(e)));class s{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var a=new Function("try {return this===window;}catch(e){ return false;}");let o=new Set;function i(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function c(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function l(e){return e&&e instanceof HTMLElement}function u(e,t,r,n=!1,s=!1){let a={once:!1};n&&(a.capture=n),s&&(a.once=s),e.addEventListener(t,r,a)}function h(e,t,r){e.removeEventListener(t,r)}function f(e,t,r={}){let n=e;if(!n._mc){let t=b?.debug;b.debug=!1,n._mc=new b(e),b.debug=t,delete n._mc._mc}const s=n._mc;return t.length&&!s[t]&&(s[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function d(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function p(e,t,r={},n="l"){let a=e?._mc;if(!a)return;let o=t instanceof s?new s(t.type,t.data,"l"):new s(t,r,"l"),i="string"!=typeof t?t:new s(t,r,n);[...Object.values(a)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(o)})),/[ud]/.test(i.bubble)&&m(e,i)}function m(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=c(e,"",!0)?.[0].target;r&&b.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&b.trigger(e,t)}))}),0)}a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>o.add(e)));class y{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==b&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!a()||e.constructor===b)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let s=/^one/.test(n),a=n.replace(/^on[e]{0,1}/,""),i=a.toLowerCase();s&&Object.defineProperty(e,"on"+a,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),o.has("on"+i)&&u(t,i,(e=>{r.trigger(a,e)}),!1,s)}))}}(this)}get target(){return this.#n.deref()}}class g extends y{_mc={};constructor(e){super(e)}static trigger=p;trigger(e,t={},r="l"){let n=this;if(n.constructor===g||n.constructor===b){let a=e instanceof s?new s(e.type,e.data,"l"):new s(e,t,"l"),o="string"!=typeof e?e:new s(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(a)})),void(/[ud]/.test(o.bubble)&&m(n.target,o))}if(n instanceof g||n instanceof b){const n=this,a="string"!=typeof e?e:new s(e,t,r),o="on"+a.type[0].toUpperCase()+a.type.slice(1);if(a.bubble.indexOf("l")>-1&&(a.immediateStopped||"function"!=typeof n[o]||(n[o](a),n.hasOwnProperty(o)&&delete n[o])),a.stopped||"l"===a.bubble)return n;/[ud]/.test(a.bubble)&&m(n.target,a)}}}class b extends y{_mc={};constructor(e,t=!1){super(e)}static add=f;static remove=d;static trigger=p;trigger(e,t={},r){g.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return l(t)?c(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return l(t)?c(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!l(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const s=i([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),s}descendants(e=""){let t=this?.target;return l(t)?i([...t.querySelectorAll("*[_mc]")],e):[]}}const E=new Map,w=new Map;function v(e){const t="/"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),u(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),u(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function S(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!E.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),v(t));u(r,"load",(()=>{E.set(t,customElements.get(e.tagName.toLowerCase()))})),E.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!w.has(e)));r?.forEach((e=>{const t=v(e);u(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const s=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=s,document.body.append(n)}),0);var t})),w.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>w.has(e)&&!w.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,_.state.MCs.get(t)),b.add(e,t,new(_.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let A=!1,O=null;function _(e=!0){return e?(A=e,O=new MutationObserver(S),setTimeout((()=>{O.observe(document.body,{childList:!0,subtree:!0}),S()}),5),A):(O?.disconnect(),O=null,A)}_.state={CEs:E,MCs:w};const x=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},j=e=>{let t=C("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let s;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":s=new L(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"select":s=new M(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"textarea":s=new N(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class T{constructor(e){}}class L extends T{#s;#e;#a;constructor(e,t){super(e),this.#s=e,this.#e=e.type,this.#a=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=C(`input[type="radio"][name="${this.#s.getAttribute("name")}"]`,this.#a).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#s.checked;default:return t.#s.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#s.getAttribute("name")}"]`,n=C(r,this.#a);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const s=n.filter((t=>t.getAttribute("value")===e));if(!s.length)return;return void(s.array[0].checked=!0);case"checkbox":t.#s.checked=e;break;default:t.#s.value=e}}}class M extends T{#s;#o=!1;constructor(e){super(e),this.#s=e,this.#o="select-multiple"===e.type}get val(){const e=[];return C(this.#s.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#o?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,C(this.#s.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class N extends T{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}class ${#i=new Set;get set(){return this.#i}get array(){return Array.from(this.#i)}set set(e){this.#i=e}get length(){return this.#i.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new k;return this.#i.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return C(e,t).forEach((e=>{r.#i.add(e)})),r}addClass(...e){return e=x(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=C(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=C(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=C(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{C(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=C(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,s=!1;return e&&(s=C(e,t)),r.#i.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=C([...n]),e&&r.filter((e=>s.has(e))),r}has(e){return this.#i.has(e)}hasClass(...e){return e=x(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),s=r.indexOf(e)+1;s<r.length&&n.add(r.at(s))}})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#i.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){h(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let s=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(s,Array.from(arguments))}return o.cb=t,s.forEach((e=>{a.forEach((function(t){u(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(n,Array.from(arguments))}return a.cb=t,n.forEach((e=>{s.forEach((function(t){u(e,t,a,r,!0)}))})),a}parent(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=C(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),s=r.indexOf(e)-1;s>-1&&n.add(r.at(s))}})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=x(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=x(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,s=!1){let a,o={bubbles:r,cancelable:n,composed:s},i=e.indexOf(" ")>-1?e.split(" "):[e];return this.#i.forEach((e=>{i.forEach((function(r){a=new Event(r,o),a.data=t,e.dispatchEvent(a)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,s=j(r.array[0]);var a;return e?null!=(a=e)&&"object"==typeof a?(Object.assign(s,e),n=r):"string"==typeof e&&(void 0===t?n=s[e]:(s[e]=t,n=r)):n=Object.assign({},s),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=j(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return C(this.array.at(e))}concat(e){let t=this;return(e instanceof $?e.array:e).forEach((e=>{t.#i.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#i=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#i.add(e)})),this}shift(){let e=this,t=e.#i.size?e.array[0]:void 0;return t&&e.#i.delete(t),t}slice(e,t){return C(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),C(n)}}class k{#i=new Set;get set(){return this.#i}get array(){return Array.from(this.#i)}set set(e){this.#i=e}get length(){return this.#i.size}set length(e){}constructor(e,t=document.body){if(!e)return this;C(e,t).forEach((e=>{H(e).forEach((e=>{this.#i.add(e)}))}))}$d(e,t=document.body){let r=new $,n=new Set,s=!!e||!1,a=new Set;return s&&(a=C(e,t).set),this.#i.forEach((e=>{s&&!a.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}descendants(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}first(e){let t=this,r=new Set;return t.#i.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#i.has(e)}last(e){let t=this,r=new Set;return t.#i.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#i.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);H([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){h(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(n,Array.from(arguments))}return a.cb=t,n.forEach((e=>{s.forEach((function(t){u(e._tg,`[TB]${t}`,a,!1,r)}))})),a}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(r,Array.from(arguments))}return s.cb=t,r.forEach((e=>{n.forEach((function(t){u(e._tg,`[TB]${t}`,s,!1,!0)}))})),s}parent(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}parents(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}prev(e){let t=this,r=new Set;return t.#i.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);H([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return H(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#i.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return H(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#i=new Set(e),t}push(e){return this.#i.add(e),this}shift(){let e=this.array.shift();return this.#i.delete(e),e}slice(e,t){return H(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return H(n)}}const C=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{C(e,t).forEach((e=>{r.add(e)}))})),new $([...r])):new $(e,t)},H=(e,t=document)=>C(e,t).$t();return t})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.selectors=t():e.selectors=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{$d:()=>C,$t:()=>H});var r=new Function("try {return this===window;}catch(e){ return false;}");let n=new Set;r()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>n.add(e)));class s{#e;#t=!1;#r=!1;constructor(e,t={},r="l"){this.#e=e,this.data=t,this.bubble=r}get type(){return this.#e}get stopped(){return this.#t}get immediateStopped(){return this.#r}stopPropagation(){this.#t=!0}stopImmediatePropagation(){this.stopPropagation(),this.#r=!0}}var a=new Function("try {return this===window;}catch(e){ return false;}");let o=new Set;function i(e,t){let r=[];return e.forEach((e=>{if(e&&e instanceof HTMLElement){const n=e?._mc;!t&&n?r=r.concat(Object.values(e._mc)):t&&n&&n[t]&&r.push(n[t])}})),r}function c(e,t,r=!0){let n=[];for(;e;){if(e._mc&&(t?t&&e._mc[t]&&n.push(e._mc[t]):n=n.concat(Object.values(e._mc)),r))return n;e=e.parentNode}return n}function l(e){return e&&e instanceof HTMLElement}function u(e,t,r,n=!1,s=!1){let a={once:!1};n&&(a.capture=n),s&&(a.once=s),e.addEventListener(t,r,a)}function h(e,t,r){e.removeEventListener(t,r)}function f(e,t,r={}){let n=e;if(!n._mc){let t=b?.debug;b.debug=!1,n._mc=new b(e),b.debug=t,delete n._mc._mc}const s=n._mc;return t.length&&!s[t]&&(s[t]=r,e instanceof HTMLElement&&!e.getAttribute("_mc")&&e.setAttribute("_mc","")),r}function d(e,t){if(!t)return;const r=e?._mc||{};r&&r[t]&&delete r[t],!Object.keys(r).length&&e instanceof HTMLElement&&e.hasAttribute("_mc")&&e.removeAttribute("_mc")}function p(e,t,r={},n="l"){let a=e?._mc;if(!a)return;let o=t instanceof s?new s(t.type,t.data,"l"):new s(t,r,"l"),i="string"!=typeof t?t:new s(t,r,n);[...Object.values(a)].forEach((e=>{e?.trigger&&"function"==typeof e?.trigger&&e?.trigger(o)})),/[ud]/.test(i.bubble)&&m(e,i)}function m(e,t){/[ud]/.test(t.bubble)&&setTimeout((()=>{if(-1===t.bubble.indexOf("l")&&(t.bubble+="l"),t.bubble.indexOf("u")>-1){let r=c(e,"",!0)?.[0].target;r&&b.trigger(r,t)}t.bubble.indexOf("d")>-1&&new Set(e._mc.children().map((e=>e?.target))).forEach((e=>{e&&b.trigger(e,t)}))}),0)}a()&&Object.keys(HTMLElement.prototype).filter((e=>/^on/.test(e))).forEach((e=>o.add(e)));class y{#n;constructor(e,t=!1){var r;this.#n=new WeakRef(e||{}),(r=this).constructor!==b&&setTimeout((()=>{r.trigger("Init")}),0),function(e){if(!a()||e.constructor===b)return;const t=e.target;if(t instanceof HTMLElement){let r=e;Object.getOwnPropertyNames(r.constructor.prototype).filter((e=>/^on[A-Z]|one[A-Z]/.test(e)&&"function"==typeof r.constructor.prototype[e])).forEach((n=>{let s=/^one/.test(n),a=n.replace(/^on[e]{0,1}/,""),i=a.toLowerCase();s&&Object.defineProperty(e,"on"+a,{configurable:!0,enumerable:!1,writable:!0,value:e=>{r.constructor.prototype[n].bind(r)(e)}}),o.has("on"+i)&&u(t,i,(e=>{r.trigger(a,e)}),!1,s)}))}}(this)}get target(){return this.#n.deref()}}class g extends y{_mc={};constructor(e){super(e)}static trigger=p;trigger(e,t={},r="l"){let n=this;if(n.constructor===g||n.constructor===b){let a=e instanceof s?new s(e.type,e.data,"l"):new s(e,t,"l"),o="string"!=typeof e?e:new s(e,t,r);return[...Object.getOwnPropertyNames(n)].forEach((e=>{n[e]?.trigger&&"function"==typeof n[e]?.trigger&&n[e]?.trigger(a)})),void(/[ud]/.test(o.bubble)&&m(n.target,o))}if(n instanceof g||n instanceof b){const n=this,a="string"!=typeof e?e:new s(e,t,r),o="on"+a.type[0].toUpperCase()+a.type.slice(1);if(a.bubble.indexOf("l")>-1&&(a.immediateStopped||"function"!=typeof n[o]||(n[o](a),n.hasOwnProperty(o)&&delete n[o])),a.stopped||"l"===a.bubble)return n;/[ud]/.test(a.bubble)&&m(n.target,a)}}}class b extends y{_mc={};constructor(e,t=!1){super(e)}static add=f;static remove=d;static trigger=p;trigger(e,t={},r){g.prototype.trigger.call(this,e,t,r)}parent(e=""){let t=this.target;return l(t)?c(t.parentNode,e,!0):[]}ancestors(e=""){let t=this?.target;return l(t)?c(this.target.parentNode,e,!1):[]}children(e=""){let t=this?.target;if(!l(t))return[];const r=Math.random().toString().replace(".",""),n='[_mc]:not([temp_id="'+r+'"] [_mc] [_mc])';t.setAttribute("temp_id",r);const s=i([...t.querySelectorAll(n)],e);return t.removeAttribute("temp_id"),s}descendants(e=""){let t=this?.target;return l(t)?i([...t.querySelectorAll("*[_mc]")],e):[]}}const E=new Map,w=new Map;function v(e){const t="./"+e.split("-").join("/")+".js",r=document.createElement("script");return r.setAttribute("src",t),r.setAttribute("blocking","render"),r.async=!0,r.setAttribute("type","module"),r.setAttribute("name",e),r.setAttribute("loading",""),u(r,"load",(e=>{r.removeAttribute("loading"),r.setAttribute("loaded","")})),u(r,"error",(e=>{console.error("could not load Custom Element code from",t)})),r}function S(){[...document.querySelectorAll(":not(:defined)")].filter((e=>!!e&&!customElements.get(e.tagName.toLowerCase())&&!E.has(e.tagName.toLowerCase()))).forEach((e=>{const t=e.tagName.toLowerCase(),r=(t.split("-").join("/"),v(t));u(r,"load",(()=>{E.set(t,customElements.get(e.tagName.toLowerCase()))})),E.set(t,"loading"),document.head.append(r)})),[...document.querySelectorAll('[_mc]:not([_mc=""]')].filter((e=>!!e)).forEach((e=>{const t=e.getAttribute("_mc")?.split(" ").filter((e=>!!e))||[],r=t.filter((e=>!w.has(e)));r?.forEach((e=>{const t=v(e);u(t,"load",(()=>{return t=document.head.querySelector(`script[name="${e}"]`),void setTimeout((function(){const e=t.getAttribute("src"),r=t.getAttribute("name"),n=document.createElement("script");n.async=!0,n.setAttribute("type","module");const s=`\nimport _ from "${e}";\nimport {DC} from "./microcomponents.js";\n\nconst elements = Array.from(document.querySelectorAll('[_mc*="${r}"]')).filter( element => element instanceof HTMLElement );\n\nelements.forEach((element) => {\n\tautoload.state.MCs.set( '${r}', _ ); // add class to MCs repository\n\tDC.add(element, _.name, new _(element)); // add instance to DOM\n\telement.setAttribute('_mc', element.getAttribute('_mc').replace('${r}', '').replace( /ww/g, ' ').trim()); // remove name from elements "_mc" attribute\n});\n\nsetTimeout( () => {\n\tdocument.body.querySelector('script[name="${r}]"')?.remove();\n},0);`;n.innerHTML=s,document.body.append(n)}),0);var t})),w.set(e,"loading"),document.head.append(t)}));const n=t.filter((e=>w.has(e)&&!w.get(e).length));n?.forEach((t=>{setTimeout((()=>{console.log("attaching",t,_.state.MCs.get(t)),b.add(e,t,new(_.state.MCs.get(t))(e)),e.setAttribute("_mc",e.getAttribute("_mc").replace("${elementName}","").replace(/\w\w/g," ").trim())}),5)}))}))}let A=!1,O=null;function _(e=!0){return e?(A=e,O=new MutationObserver(S),setTimeout((()=>{O.observe(document.body,{childList:!0,subtree:!0}),S()}),5),A):(O?.disconnect(),O=null,A)}_.state={CEs:E,MCs:w};const x=e=>{let t=new Set;return e.forEach((e=>{(e=e.trim()).split(" ").forEach((e=>{""!==e&&t.add(e)}))})),Array.from(t)},j=e=>{let t=C("input,select,textarea",e).array,r={};return t.forEach((t=>{const n=t.getAttribute("name")||"undefined";if(n){let s;switch((e=>e instanceof HTMLInputElement?"input":e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"textarea":"")(t)){case"input":s=new L(t,e),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"select":s=new M(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;case"textarea":s=new N(t),Object.defineProperty(r,n,{enumerable:!0,configurable:!0,get:()=>s.val,set:e=>{s.val=e}});break;default:console.warn("handler missing:",n,"for",t)}}})),r};class T{constructor(e){}}class L extends T{#s;#e;#a;constructor(e,t){super(e),this.#s=e,this.#e=e.type,this.#a=t}get val(){let e,t=this;switch(t.#e){case"radio":const r=C(`input[type="radio"][name="${this.#s.getAttribute("name")}"]`,this.#a).filter((e=>e.checked));return r.length?(e=r.array[0],e.value):"";case"checkbox":return t.#s.checked;default:return t.#s.value}return""}set val(e){let t=this;switch(t.#e){case"radio":const r=`input[type="radio"][name="${this.#s.getAttribute("name")}"]`,n=C(r,this.#a);if(!n.length)return;if(""===e)return void n.forEach((e=>{e.checked&&(e.checked=!1)}));const s=n.filter((t=>t.getAttribute("value")===e));if(!s.length)return;return void(s.array[0].checked=!0);case"checkbox":t.#s.checked=e;break;default:t.#s.value=e}}}class M extends T{#s;#o=!1;constructor(e){super(e),this.#s=e,this.#o="select-multiple"===e.type}get val(){const e=[];return C(this.#s.querySelectorAll("option")).filter((e=>e.selected)).forEach((t=>{t.selected&&e.push(t.value)})),this.#o?e:e.length?e[0]:""}set val(e){e="string"==typeof e?[e]:e,C(this.#s.querySelectorAll("option")).forEach((t=>{e.indexOf(t.value)>-1?(t.setAttribute("selected",!0),t.selected=!0):(t.removeAttribute("selected"),t.selected=!1)}))}}class N extends T{#s;constructor(e){super(e),this.#s=e}get val(){return this.#s.value}set val(e){this.#s.value=e}}class ${#i=new Set;get set(){return this.#i}get array(){return Array.from(this.#i)}set set(e){this.#i=e}get length(){return this.#i.size}constructor(e,t=document.body){if(new Set,!e)return this}$t(e){let t=new k;return this.#i.forEach((e=>{e._mc&&Object.values(e._mc).forEach((e=>{t.set.add(e)}))})),e&&t.filter((t=>t.nameSpace===e)),t}add(e,t){let r=this;return C(e,t).forEach((e=>{r.#i.add(e)})),r}addClass(...e){return e=x(e),this.forEach((t=>{t.classList.add(...e)})),this}after(e,t){let r=this,n=C(e,t);return n.length?(n.first().forEach((e=>{r.array.reverse().forEach((t=>{t.after(e)}))})),r):r}append(e,t){let r=this.array[0],n=C(e,t);return r&&n.forEach((e=>{r.append(e)})),this}appendTo(e,t){let r=C(e,t).array[0];return r&&this.forEach((e=>{r.append(e)})),this}attr(e,t){let r=this,n={};return r.length?arguments.length?"string"==typeof e?void 0===t?[...r.set][0].getAttribute(e):null===t?([...r.set].forEach((t=>{t.removeAttribute(e)})),r):("object"==typeof t&&(t=JSON.stringify(t)),[...r.set].forEach((r=>{r.setAttribute(e,t)})),r):"object"==typeof e?([...r.set].forEach((t=>{Object.keys(e).forEach((r=>{C(t).attr(r,e.key)}))})),r):r:(Array.from([...r.set][0].attributes).forEach((e=>{n[e.name]=e.value})),n):r}before(e,t){let r=this,n=C(e,t);return n.length?(n.first().forEach((e=>{r.forEach((t=>{t.before(e)}))})),r):r}children(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{Array.from(e.children).forEach((e=>{n.add(e)}))})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}descendants(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{e.querySelectorAll("*").forEach((e=>{n.add(e)}))})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}empty(){return this.filter((e=>!1))}first(e,t){let r=this,n=new Set,s=!1;return e&&(s=C(e,t)),r.#i.forEach((e=>{e.parentNode&&n.add(e.parentNode.children[0])})),r=C([...n]),e&&r.filter((e=>s.has(e))),r}has(e){return this.#i.has(e)}hasClass(...e){return e=x(e),this.every((e=>Array.from(e.classList).every((t=>e.contains(t)))))}html(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerHTML=e:(()=>{console.warn("Cannot access the .innerHTML of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerHTML}last(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e.parentNode?.children;t&&n.add(Array.from(t).at(-1))})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}next(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),s=r.indexOf(e)+1;s<r.length&&n.add(r.at(s))}})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}normalize(){return this.#i.forEach((e=>{e.normalize()})),this}off(e,t){let r=e.indexOf(" ")>-1?e.split(" "):[e];return this.array.forEach((e=>{r.forEach((function(r){h(e,r,t)}))})),this}on(e,t,r=!1,n=!1){let s=this,a=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function o(){o.cb.apply(s,Array.from(arguments))}return o.cb=t,s.forEach((e=>{a.forEach((function(t){u(e,t,o,r,n)}))})),o}one(e,t,r=!1){let n=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(n,Array.from(arguments))}return a.cb=t,n.forEach((e=>{s.forEach((function(t){u(e,t,a,r,!0)}))})),a}parent(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{e.parentNode&&"HTML"!==e.parentNode.tagName&&n.add(e.parentNode)})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}parents(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e;for(;t.parentNode&&"HTML"!==t.parentNode.tagName;)t=t.parentNode,n.add(t)})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}prepend(e,t){let r=this.array[0],n=C(e,t);return r&&n.forEach((e=>{r.prepend(e)})),this}prev(e,t){let r=this,n=new Set;if(r.#i.forEach((e=>{let t=e.parentNode?.children;if(t){let r=Array.from(t),s=r.indexOf(e)-1;s>-1&&n.add(r.at(s))}})),r=C([...n]),e){let n=C(e,t);r.filter((e=>n.has(e)))}return r}removeClass(...e){return e=x(e),this.forEach((t=>{t.classList.remove(...e)})),this}text(e){let t=this;return e?(t.forEach((t=>{t.parentNode?t.innerText=e:(()=>{console.warn("Cannot access the .textContent of a HTMLElement that hasnt been inserted yet",t),console.trace(t,this),console.info("If you called this from inside a Web Component constructor, consider using the %c[connected] event callback!","color: blue;")})()})),t):t.array[0].innerText??""}toggleClass(...e){return e=x(e),this.forEach((t=>{t.classList.toggle(...e)})),this}trigger(e,t={},r=!1,n=!1,s=!1){let a,o={bubbles:r,cancelable:n,composed:s},i=e.indexOf(" ")>-1?e.split(" "):[e];return this.#i.forEach((e=>{i.forEach((function(r){a=new Event(r,o),a.data=t,e.dispatchEvent(a)}))})),this}val(e,t){if(!this.length)return this;const r=this;let n,s=j(r.array[0]);var a;return e?null!=(a=e)&&"object"==typeof a?(Object.assign(s,e),n=r):"string"==typeof e&&(void 0===t?n=s[e]:(s[e]=t,n=r)):n=Object.assign({},s),n}values(e){const t=this;let r={};if(!t.length)return console.warn("no dom selection to search inputs in"),{};let n=j(t.array[0]);return Object.keys(n).forEach((e=>{r[e]=n[e]})),0===Object.keys(r).length&&console.warn("no inputs in this dom selection",t.array[0],r),e&&Object.keys(e).forEach((t=>{n.hasOwnProperty(t)&&(console.log("key found",t),n[t]=e[t])})),structuredClone(Object.assign(n))}at(e){return C(this.array.at(e))}concat(e){let t=this;return(e instanceof $?e.array:e).forEach((e=>{t.#i.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return this.#i=new Set(this.array.filter(e,t)),this}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e,0)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){return this.array.pop()}push(...e){return e.forEach((e=>{this.#i.add(e)})),this}shift(){let e=this,t=e.#i.size?e.array[0]:void 0;return t&&e.#i.delete(t),t}slice(e,t){return C(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array;return n.splice(e,t,...r),C(n)}}class k{#i=new Set;get set(){return this.#i}get array(){return Array.from(this.#i)}set set(e){this.#i=e}get length(){return this.#i.size}set length(e){}constructor(e,t=document.body){if(!e)return this;C(e,t).forEach((e=>{H(e).forEach((e=>{this.#i.add(e)}))}))}$d(e,t=document.body){let r=new $,n=new Set,s=!!e||!1,a=new Set;return s&&(a=C(e,t).set),this.#i.forEach((e=>{s&&!a.has(e._tg)||n.add(e._tg)})),r.set=n,r}children(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.children(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}descendants(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.descendants(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}first(e){let t=this,r=new Set;return t.#i.forEach((e=>{e.parent().children().$d().first().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}has(e){return this.#i.has(e)}last(e){let t=this,r=new Set;return t.#i.forEach((e=>{e.parent().children().$d().last().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}next(e){let t=this,r=new Set;return t.#i.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.nextElementSibling;)t=t.nextElementSibling,n.add(t);H([...n]).$d().first().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}ns(e){return this.filter((t=>t.nameSpace===e))}off(e,t){let r=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];return this.$d().array.forEach((e=>{r.forEach((function(r){h(e,`[TB]${r}`,t)}))})),this}on(e,t,r=!1){let n=this,s=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function a(){a.cb.apply(n,Array.from(arguments))}return a.cb=t,n.forEach((e=>{s.forEach((function(t){u(e._tg,`[TB]${t}`,a,!1,r)}))})),a}one(e,t){let r=this,n=e.indexOf(" ")>-1?e.split(" ").filter((e=>""!==e)):[e];function s(){s.cb.apply(r,Array.from(arguments))}return s.cb=t,r.forEach((e=>{n.forEach((function(t){u(e._tg,`[TB]${t}`,s,!1,!0)}))})),s}parent(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.parent(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}parents(e){let t=this,r=new Set;return t.#i.forEach((t=>{t.parents(e).forEach((e=>{r.add(e)}))})),t.#i=r,t}prev(e){let t=this,r=new Set;return t.#i.forEach((e=>{let t,n=new Set;for(t=e._tg;null!==t.previousElementSibling;)t=t.previousElementSibling,n.add(t);H([...n]).$d().last().$t().forEach((e=>{r.add(e)}))})),t.#i=r,e&&t.filter((t=>t.nameSpace=e)),t}trigger(e,t={},r="l"){return this.forEach((n=>{n.trigger(e,t,r)})),this}at(e){return H(this.array.at(e))}concat(e){let t=this;return e.forEach((e=>{t.#i.add(e)})),t}entries(){return this.array.entries()}every(e,t){return this.array.every(e,t)}filter(e,t){return H(this.array.filter(e,t))}forEach(e,t){return this.array.forEach(e,t),this}includes(e){return-1!==this.array.indexOf(e)}indexOf(e,t){return this.array.indexOf(e,t)}map(e,t){return this.array.map(e,t)}pop(){let e=this.array,t=e.pop();return this.#i=new Set(e),t}push(e){return this.#i.add(e),this}shift(){let e=this.array.shift();return this.#i.delete(e),e}slice(e,t){return H(this.array.slice(e,t))}some(e,t){return this.array.some(e,t)}splice(e,t,...r){let n=this.array.splice(e,t,...r);return H(n)}}const C=(e,t=document)=>{let r=new Set;return e instanceof Array?(e.forEach((e=>{C(e,t).forEach((e=>{r.add(e)}))})),new $([...r])):new $(e,t)},H=(e,t=document)=>C(e,t).$t();return t})()));
package/public/src/MC.ts CHANGED
@@ -449,7 +449,7 @@ const MCs = new Map();
449
449
 
450
450
  function makeLoadScript( element: string ): HTMLScriptElement {
451
451
 
452
- const fileName: string = '/' + element.split('-').join('/')+'.js';
452
+ const fileName: string = './' + element.split('-').join('/')+'.js';
453
453
 
454
454
  const se: HTMLScriptElement = document.createElement('script');
455
455
 
@@ -520,7 +520,7 @@ function loadUndefinedMicroComponents() {
520
520
  )
521
521
  .forEach((el) => {
522
522
  const elementName = el.tagName.toLowerCase(),
523
- fileName: string = '/'+elementName.split('-').join('/')+'.js';
523
+ fileName: string = './'+elementName.split('-').join('/')+'.js';
524
524
 
525
525
  const se: HTMLScriptElement = makeLoadScript( elementName );
526
526
 
package/src/MC.ts CHANGED
@@ -449,7 +449,7 @@ const MCs = new Map();
449
449
 
450
450
  function makeLoadScript( element: string ): HTMLScriptElement {
451
451
 
452
- const fileName: string = '/' + element.split('-').join('/')+'.js';
452
+ const fileName: string = './' + element.split('-').join('/')+'.js';
453
453
 
454
454
  const se: HTMLScriptElement = document.createElement('script');
455
455
 
@@ -520,7 +520,7 @@ function loadUndefinedMicroComponents() {
520
520
  )
521
521
  .forEach((el) => {
522
522
  const elementName = el.tagName.toLowerCase(),
523
- fileName: string = '/'+elementName.split('-').join('/')+'.js';
523
+ fileName: string = './'+elementName.split('-').join('/')+'.js';
524
524
 
525
525
  const se: HTMLScriptElement = makeLoadScript( elementName );
526
526