From dbe0bed71c58a96814ab60b629b67516eac7ddf7 Mon Sep 17 00:00:00 2001 From: Kevin Bulteel Date: Sun, 10 Mar 2024 16:11:36 +0100 Subject: [PATCH] regen --- packages/@hec.js/ui/dist/hec.esm.min.js | 2 +- packages/@hec.js/ui/dist/hec.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@hec.js/ui/dist/hec.esm.min.js b/packages/@hec.js/ui/dist/hec.esm.min.js index 3e33452..f75e542 100644 --- a/packages/@hec.js/ui/dist/hec.esm.min.js +++ b/packages/@hec.js/ui/dist/hec.esm.min.js @@ -1 +1 @@ -function F(t){let e=t.matchAll(/([^ {}\s]+)/g),n={meta:{},text:t,prop:null};for(let r of e)if(r[1].includes("=")){let o=r[1].split("=");n.meta[o[0]]=o[1].replaceAll(/'|"/g,"")}else n.prop=r[1];return n}var S={};var A=new WeakMap,N=t=>A.get(t),Pt=t=>A.delete(t),$=t=>A.has(t),k=(t,e)=>{let n=N(t);n&&typeof n=="object"?A.set(t,Object.assign(n,e)):A.set(t,e)},p=t=>typeof t=="function"?p(t()):t;function d(t,e){let n=e.split(".");if(!e)return t;if(!t)return null;for(let r of n){if(["state"].includes(r)&&t?.state)return t[r];if(m(t)){let o=t()?.[r];if(m(o)){let s=new AbortController,a=h(o());o.subscribe({next:a},{signal:s.signal});let c=i=>{s.abort(),m(i[r])?(s=new AbortController,i[r].subscribe({next:a},{signal:s.signal}),a(i[r]())):a(i[r])};t.subscribe({next:c}),t=a}else t=t.map(s=>s&&s[r])}else if(typeof t=="function")t=p(t);else if(typeof t[r]<"u")typeof t[r]=="function"&&!m(t[r])?t=t[r].bind(t):t=t[r];else return}return t}function Lt(t,e){let n=e.split(".");if(!e||!t)return!1;for(let r of n){if(["loading","error"].includes(r)&&t?.loading&&t?.error)return t[r];if(typeof t=="function")t=p(t);else if(typeof t[r]<"u")t=t[r];else return!1}return!0}var U={items:new Map,setItem(t,e){this.items.set(t,e?.toString())},get length(){return this.items.keys().length},key(t){return Array.from(this.items.values()).at(t)},clear(){this.items.clear()},getItem(t){return this.items.get(t)},removeItem(t){this.items.delete(t)}},E=new Map;function gt(t){try{let e=window[t+"Storage"];return typeof e.length=="number"?e:U}catch{return U}}window.addEventListener("storage",t=>{if(!E.has(t.key))return;let e=E.get(t.key),n=t.storageArea.getItem(t.key);typeof n=="string"&&n!=="undefined"&&e.update(JSON.parse(n))});function h(t=null,e={}){if(e.id&&E.has(e.id))return E.get(e.id);let n=[],r=e.storage&>(e.storage),o=i=>{t=i,r&&r.setItem(e.id,JSON.stringify(t));for(let l of n)l.next(t)};function s(){return arguments.length&&t!==arguments[0]&&o(arguments[0]),t}let a=(i,l=null)=>{n.push(i),l?.signal.addEventListener("abort",()=>{let u=n.indexOf(i);u>-1&&n.splice(u,1)},{once:!0})};if(r){let i=r.getItem(e.id);o(typeof i=="string"&&i!=="undefined"?JSON.parse(i):t)}let c=Object.assign(s,{id:e.id,storage:e.storage,toString:()=>t?.toString(),set:i=>t=i,update:o,subscribe:a,map:i=>{let l=h(i(t)),u=new AbortController,b=l.subscribe;return a({next:f=>l(i(f))},{signal:u.signal}),Object.assign(l,{set:()=>null,subscribe:(f,y)=>{b(f,y),y?.signal.addEventListener("abort",()=>u.abort())}})},filter:i=>{let l=h(i(t)?t:null);return a({next:u=>i(u)?l(u):null}),Object.assign(l,{set:()=>null})}});return e.id&&E.set(e.id,c),c}function bt(t,e=[],n=null){for(let r of e)r.subscribe({next:()=>n=t(n)});return t(n)}function Mt(t,e=[],n=null){let r=h(null);return r(bt(o=>r(t(o)),e,n)),r}function xt(t,e=null){let n=h(e),r=h("loaded"),o=async()=>{if(r()!="pending"){try{r("pending"),n(await t()),r("loaded"),delete n.error}catch(s){r("error"),n.error=s}return n()}};return o(),Object.assign(n,{state:r,refetch:o})}function Wt(t,e,n=null){let r=xt(()=>e(p(t)),n);return m(t)&&t.subscribe({next:()=>r.refetch()}),r}function m(t){return t&&t.subscribe}function zt(t,e=[]){function n(){let r=h(null),o=null,s=a=>{o=a,r(t(a))};for(let a of e)a.subscribe({next:()=>r(t(o))});return Object.assign({provide:s},r)}return n}var yt=h({}),z=h(location.pathname),Q=window.history.pushState,wt=window.history.replaceState,W={updateQueued:!1},j=[],H=new WeakMap;function vt(t,e){let n=Array.from(t.path.matchAll(/\:/g)).length*25,r=Array.from(e.path.matchAll(/\:/g)).length*25;return n+=Array.from(t.path.matchAll(/\*/g)).length*150,r+=Array.from(e.path.matchAll(/\*/g)).length*150,n-r}function G(t){requestAnimationFrame(()=>{let e=t.node,n=t.path,r=e.parentElement?.closest("[data-route]"),o=H.get(r),s=o?.pattern?.pathname,a=o?.group??j;t.group=[],H.set(e,t),s&&(n=n=="/"?"":n,n=s.replaceAll(/[^\/a-zA-Z0-9]+$/gm,"")+n.replaceAll(/^[^\/a-zA-Z0-9]+/gm,"")),n=n.replaceAll(/\/+/g,"/").replace(/\/$/m,""),t.pattern=new URLPattern({pathname:n||"/"}),a.push(t),a.sort(vt),W.updateQueued||(W.updateQueued=!0,queueMicrotask(w))})}var C=document.querySelector('head meta[name="route"]')||document.createElement("meta");C.name="route";C.content=location.pathname;document.head.append(C);var w=()=>{let t=location.href.replace(/index\.*[a-z0-9]*$/gm,"");z(t),yt(Object.fromEntries(new URLSearchParams(location.search)));let e=!1,n=r=>{let o=!1;for(let s of r){let a=s.pattern.test(t);s.update(!o&&a),!o&&a&&(o=!0,s.group.length?n(s.group):(e=!0,C.content=s.pattern.pathname))}return e};return W.updateQueued=!1,n(j)},St=t=>{let e=t.target.closest("a")?.href,n=new URL(e,location.href);e&&n.hostname==location.hostname&&j.some(r=>r.pattern.test(e))&&(Q.call(window.history,null,null,e),w()&&t.preventDefault())};window.addEventListener("popstate",w);window.addEventListener("hashchange",w);window.addEventListener("click",St);window.history.pushState=function(e,n,r){Q.call(window.history,e,n,r),w()};window.history.replaceState=function(e,n,r){wt.call(window.history,e,n,r),w()};var R=new WeakMap,At=new MutationObserver(t=>{for(let e of t)R.has(e.target)&&R.get(e.target)()}),J={select:"[data-match]",run:t=>{let e=t.dataset.match,n=s=>s.replace(/index\.*[a-z0-9]*$/gm,"");function r(){return n(new URL(t.dataset.route||t.getAttribute("href"),location.href).pathname)}let o=()=>{r()==n(location.pathname)?t.classList.add(e):t.classList.remove(e)};z.subscribe({next:o}),R.set(t,o),At.observe(t,{attributes:!0,attributeFilter:["href","data-route"]}),o(),t.removeAttribute("data-match")}};var D={number:t=>t.valueAsNumber,date:t=>t.valueAsDate,text:t=>t.value,checkbox:t=>t.checked,"":t=>t.value},Z={select:"[data-bind],[name]",run:(t,e)=>{let n=t.dataset.bind||t.getAttribute("name"),r=d(e,n);if(r){let o=s=>{t.type=="checkbox"?t.checked=s:t.value=s};o(p(r)),m(r)&&(r.subscribe({next:o}),t.addEventListener("input",()=>r(D[t.type]?.(t)??t.value)),t.addEventListener("change",()=>r(D[t.type]?.(t)??t.value)))}}};var P=new WeakMap,K=new IntersectionObserver(t=>{for(let e of t)if(e.isIntersecting&&P.has(e.target)){for(let n of P.get(e.target))n();P.delete(e.target),K.unobserve(e.target)}},{rootMargin:"256px"});function x(t){return new Promise(e=>{let n=P.get(t)??[];n.push(e),P.set(t,n),K.observe(t)})}var O=new WeakSet,X={select:"[data-include]",run:(t,e)=>{if(O.has(t)||t.children.length)return;O.add(t);let n=t.hasAttribute("data-lazy")&&t.closest("[hidden]"),r=async()=>{t.dispatchEvent(new CustomEvent("::load",{bubbles:!0}));let o=await fetch(t.dataset.include,{headers:{accept:"text/html,text/*"}});if(o.ok){let s=await o.text();t.dispatchEvent(new CustomEvent("::loaded",{bubbles:!0})),t.innerHTML=s;for(let a of t.childNodes)g(a,e);t.removeAttribute("data-include"),t.removeAttribute("data-lazy")}};t.hasAttribute("data-lazy")?x(t).then(r):r()}};var Y=new WeakSet,tt={select:"[data-for]",run:(t,e,n)=>{if(Y.has(t))return;let r=t.dataset.for.replace("let","").split("of"),o=r[0].split(","),s=r.at(-1).trim(),a=o[0].trim()==s?"__e":o[0].trim(),c=o[1]?.trim()??"__i",i=d(e,s),l=document.createComment(t.dataset.for);t.replaceWith(l),O.add(t);let u=()=>{let f=l;for(;(f=f.nextSibling)&&((f instanceof HTMLElement||f instanceof SVGElement)&&f.dataset.for==t.dataset.for);)f=f.previousSibling,f.nextSibling.remove()},b=f=>{if(u(),!f||!f[Symbol.iterator])return console.warn("data-for: The value given is not iterable.",{key:s,value:f});for(let y=0,M=l;y{let n=d(e,t.dataset.if||t.dataset.ifNot),r=document.createComment("if: "+(t.dataset.if||t.dataset.ifNot)),o=!!t.dataset.ifNot;t.replaceWith(r);let s=a=>{a=o?!a:a,!t.parentNode&&a?(t.hidden=!1,r.after(t)):t.localName!="link"&&t.remove()};s(p(n)),m(n)&&n.subscribe({next:s})}};var rt=new WeakSet,nt={select:"[data-lazy]",run:(t,e,n)=>{if(rt.has(t)||!t.childNodes.length)return;rt.add(t);let r=t.dataset.lazy,o=()=>{t.removeAttribute("data-lazy"),I(t,e);for(let s of t.childNodes)g(s,e)};r&&(t.addEventListener("::load",()=>t.classList.add(r),{once:!0}),t.addEventListener("::loaded",()=>t.classList.remove(r),{once:!0})),x(t).then(o),n()}};var ot={select:"[data-on]",run:(t,e)=>{let n=r=>{let o=r.split(":"),s=o[0].trim(),a=o.at(-1).trim(),c=d(e,a);c&&t.addEventListener(s,c)};for(let r of t.dataset.on.split(","))n(r)}};var at=t=>{let e=document.createElement("link");Object.assign(e,t),e.rel="preload",document.head.append(e)};var st=new WeakSet,it={select:"[data-preload]",run:t=>{if(st.has(t)||t.hidden)return;st.add(t);let e=()=>{let n=t.dataset.preload.split(",");for(let r of n){let o=r.split(":");at({href:o[0],as:o[1]??"fetch"})}};t.hasAttribute("data-lazy")?x(t).then(e):e()}};var ct={select:"[data-route], [data-route-not]",run:async t=>{"URLPattern"in window||await import("https://kevinblt.github.io/hec/packages/@hec.js/ui/dist/urlpattnern.min.js");let e=t.dataset.route,n=document.createComment("route: "+e);G({path:e,update:o=>{if(o){if(t.hidden=!1,t.parentNode)return;n.after(t)}else t.localName!="link"&&t.remove()},node:t}),t.replaceWith(n)}};var B="[data-component], [data-view], [data-page]",T=(t,e=document.body,n=V)=>{let r=B.replaceAll("]",`="${t}"]`);e.matches(r)&&n(e,t);for(let o of e.querySelectorAll(r))n(o,t)};new MutationObserver(t=>{for(let e of t){for(let n of e.addedNodes)for(let r of Object.keys(v))T(r);for(let n of e.removedNodes)for(let r of Object.keys(v))n instanceof Element&&T(r,n,o=>o.dispatchEvent(new CustomEvent("::unmount")))}}).observe(document,{childList:!0,subtree:!0});var v={},L=new WeakMap;function V(t,e){L.has(t)||!v[e]||(v[e].use(t),L.set(t,v[e].component))}var _=class{constructor(e){Object.assign(this,e)}signals={};node;props;#t=null;async insert(e){this.#t??=this.node.hasAttribute("data-lazy"),this.#t?(this.node.dispatchEvent(new CustomEvent("::load")),this.node.removeAttribute("data-lazy"),await x(this.node)):(this.node.dispatchEvent(new CustomEvent("::load")),await Promise.resolve());let n=e(this.signals,this.node);(o=>{k(this,N(o));let s=Array.from(this.node.childNodes);if(this.node.append(o),s.length){let a=this.node.querySelector("slot"),c=document.createComment("children/"),i=document.createComment("/children");a?a.replaceWith(c,...s,i):this.node.append(c,...s)}for(let a in this.props){let c=this.node.getAttribute(a)??"";this.node.hasAttribute(a)||this.node.setAttribute(a,this.props[a]?.toString()),c.startsWith("@")||this.signals[a].subscribe({next:i=>i==null?this.node.removeAttribute(a):this.node.setAttribute(a,i.toString())})}this.node.dispatchEvent(new CustomEvent("::loaded")),this.node.dispatchEvent(new CustomEvent("::mount"))})(n instanceof Promise?await n:n)}attributeChange(e,n,r){let o=Object.entries(this.props).filter(s=>s[0].toLowerCase()==e.toLowerCase())[0];if(r?.startsWith("@")){let s=this.node.parentNode,a=r.slice(1),c=d(N(s),a)??d(N(this.node),a);m(c)?this.signals[e]=c:(this.signals[o[0]]??=h(c),this.signals[o[0]](c))}else this.signals[o[0]]??=h(r),this.signals[o[0]](typeof o[1]=="number"?parseFloat(r):r)}};function lt(t,e,n){v[t]??={observer:new MutationObserver(r=>{for(let o of r)o.target instanceof Element&&L.get(o.target)?.attributeChange(o.attributeName,o.oldValue,o.target.getAttribute(o.attributeName))}),component:null,use(r){this.component=new _({props:e,node:r});for(let o of Object.keys(e))this.component.attributeChange(o,null,r.getAttribute(o)??e[o]);this.component.insert(n),this.observer.observe(r,{attributes:!0,attributeOldValue:!0,attributeFilter:Object.keys(e).map(o=>o.toLowerCase())})}},T(t,document.body)}var de=lt,he=lt;var ut={select:B,run:t=>{L.has(t)||V(t,t.dataset.component??t.dataset.view??t.dataset.page)}};var ft=[ut,tt,et,ct,it,X,ot,Z,J,nt];var mt={};function _e(t,e={}){t instanceof URL&&(t=t.host==location.host?t.pathname:t.toString());let n=document.querySelector(`template[name="${t}"]`);if(!n){let r=document.querySelector('head meta[name="template-path"]');return mt[t]??=new Promise(async o=>{n=document.createElement("template"),n.setAttribute("id",t.toString()),n.innerHTML=await fetch(r?.content?.replaceAll("[name]",t.toString())??t).then(s=>s.text()),document.body.append(n),o(n)}),mt[t].then(o=>g(o.content.cloneNode(!0),e))}return g(n.content.cloneNode(!0),e)}function Be(t,e={}){let n=document.createElement("template");return n.dataset.name="anonymous",n.innerHTML=t,g(n.content.cloneNode(!0),e)}function g(t,e={}){let n=(r,o=new WeakSet)=>{let s=!1;if(!($(r)||o.has(r))){if(r.nodeName=="#document-fragment"&&k(r,e),r instanceof HTMLElement||r instanceof SVGElement){k(r,e);for(let a of ft)r.matches(a.select)&&a.run(r,e,()=>s=!0);if(s)return;I(r,e)}else if(r instanceof Text&&r.textContent.includes("{{")){let a=r.textContent.split(/{{|}}/g);for(let c=0,i=r,l;cl.data=u),o.add(l),i.after(l),i=l;r.remove()}o.add(r);for(let a of r.childNodes)n(a,o)}};return n(t,new WeakSet),t}var I=(t,e)=>{let n=t.getAttributeNames();for(let r of n){let o=t.getAttribute(r);o?.includes("{{")&&pt(o,e,s=>{s=s.trim().replace(/ +/," "),s==="undefined"||s==="null"?t.removeAttribute(r):t.setAttribute(r,s)})}},pt=(t,e,n)=>{let r=t.match(/{{[^}]+}}/g).map(F),o=t,s=()=>{t=o;for(let a of r)t=t.replace(a.text,p(a.value));return t};for(let a of r){let c=null;if(a.prop[a.prop.length-1]===")"){let i=a.prop.split("("),l=d(e,i[1].substring(0,i[1].length-1).trim()),u=i[0].trim();c=d(e,u),c=c(),c.provide(p(l)),m(l)&&l.subscribe({next:b=>c.resolve(p(b))})}else c=d(e,a.prop);if(c==null&&console.warn(`{{ ${a.prop} }}: No value for this key`,{key:a.prop,value:c}),m(c)){let i=c;for(let l in a.meta)if(S[l]){let u=S[l];i=i.map(b=>u({value:b,key:a.prop,param:a.meta[l],options:a.meta}))}a.value=i,i.subscribe({next:()=>n(s())})}else{let i=c;for(let l in a.meta)if(S[l]){let u=S[l];i=u({value:p(c),key:a.prop,param:a.meta[l],options:a.meta})}a.value=()=>i}}n(s())};var dt=new WeakMap;function qe(t,e=null){document.dispatchEvent(new CustomEvent(t,{detail:e}))}function Fe(t,e){let n=r=>e(r.detail);dt.set(e,n),document.addEventListener(t,n)}function $e(t){return new Promise(e=>{let n=r=>e(r.detail);document.addEventListener(t,n,{once:!0})})}function Ue(t,e){document.removeEventListener(t,dt.get(e))}export{L as activeComponents,lt as component,B as componentSelector,Pt as deletePropsOf,bt as effect,qe as emit,I as executeNodeAttributesTemplate,F as expression,p as f,Lt as hasProp,$ as hasProps,m as isSignal,Mt as memo,Ue as off,Fe as on,$e as once,he as page,S as pipes,ft as plugins,d as prop,N as propsOf,zt as provider,xt as resource,Wt as resourceBy,k as setPropsOf,h as signal,_e as templateByName,g as templateByNode,Be as templateByString,V as useComponent,de as view}; +function q(t){let e=t.matchAll(/([^ {}\s]+)/g),n={meta:{},text:t,prop:null};for(let r of e)if(r[1].includes("=")){let o=r[1].split("=");n.meta[o[0]]=o[1].replaceAll(/'|"/g,"")}else n.prop=r[1];return n}var S={};var A=new WeakMap,N=t=>A.get(t),Pt=t=>A.delete(t),F=t=>A.has(t),k=(t,e)=>{let n=N(t);n&&typeof n=="object"?A.set(t,Object.assign(n,e)):A.set(t,e)},m=t=>typeof t=="function"?m(t()):t;function d(t,e){let n=e.split(".");if(!e)return t;if(!t)return null;for(let r of n){if(["state"].includes(r)&&t?.state)return t[r];if(p(t)){let o=t()?.[r];if(p(o)){let s=new AbortController,a=h(o());o.subscribe({next:a},{signal:s.signal});let c=i=>{s.abort(),p(i[r])?(s=new AbortController,i[r].subscribe({next:a},{signal:s.signal}),a(i[r]())):a(i[r])};t.subscribe({next:c}),t=a}else t=t.map(s=>s&&s[r])}else if(typeof t=="function")t=m(t);else if(typeof t[r]<"u")typeof t[r]=="function"&&!p(t[r])?t=t[r].bind(t):t=t[r];else return}return t}function Lt(t,e){let n=e.split(".");if(!e||!t)return!1;for(let r of n){if(["loading","error"].includes(r)&&t?.loading&&t?.error)return t[r];if(typeof t=="function")t=m(t);else if(typeof t[r]<"u")t=t[r];else return!1}return!0}var U={items:new Map,setItem(t,e){this.items.set(t,e?.toString())},get length(){return this.items.keys().length},key(t){return Array.from(this.items.values()).at(t)},clear(){this.items.clear()},getItem(t){return this.items.get(t)},removeItem(t){this.items.delete(t)}},E=new Map;function gt(t){try{let e=window[t+"Storage"];return typeof e.length=="number"?e:U}catch{return U}}window.addEventListener("storage",t=>{if(!E.has(t.key))return;let e=E.get(t.key),n=t.storageArea.getItem(t.key);typeof n=="string"&&n!=="undefined"&&e.update(JSON.parse(n))});function h(t=null,e={}){if(e.id&&E.has(e.id))return E.get(e.id);let n=[],r=e.storage&>(e.storage),o=i=>{t=i,r&&r.setItem(e.id,JSON.stringify(t));for(let l of n)l.next(t)};function s(){return arguments.length&&t!==arguments[0]&&o(arguments[0]),t}let a=(i,l=null)=>{n.push(i),l?.signal.addEventListener("abort",()=>{let u=n.indexOf(i);u>-1&&n.splice(u,1)},{once:!0})};if(r){let i=r.getItem(e.id);o(typeof i=="string"&&i!=="undefined"?JSON.parse(i):t)}let c=Object.assign(s,{id:e.id,storage:e.storage,toString:()=>t?.toString(),set:i=>t=i,update:o,subscribe:a,map:i=>{let l=h(i(t)),u=new AbortController,b=l.subscribe;return a({next:f=>l(i(f))},{signal:u.signal}),Object.assign(l,{set:()=>null,subscribe:(f,y)=>{b(f,y),y?.signal.addEventListener("abort",()=>u.abort())}})},filter:i=>{let l=h(i(t)?t:null);return a({next:u=>i(u)?l(u):null}),Object.assign(l,{set:()=>null})}});return e.id&&E.set(e.id,c),c}function bt(t,e=[],n=null){for(let r of e)r.subscribe({next:()=>n=t(n)});return t(n)}function Mt(t,e=[],n=null){let r=h(null);return r(bt(o=>r(t(o)),e,n)),r}function xt(t,e=null){let n=h(e),r=h("loaded"),o=async()=>{if(r()!="pending"){try{r("pending"),n(await t()),r("loaded"),delete n.error}catch(s){r("error"),n.error=s}return n()}};return o(),Object.assign(n,{state:r,refetch:o})}function Wt(t,e,n=null){let r=xt(()=>e(m(t)),n);return p(t)&&t.subscribe({next:()=>r.refetch()}),r}function p(t){return t&&t.subscribe}function zt(t,e=[]){function n(){let r=h(null),o=null,s=a=>{o=a,r(t(a))};for(let a of e)a.subscribe({next:()=>r(t(o))});return Object.assign({provide:s},r)}return n}var yt=h({}),z=h(location.pathname),Q=window.history.pushState,wt=window.history.replaceState,W={updateQueued:!1},j=[],H=new WeakMap;function vt(t,e){let n=Array.from(t.path.matchAll(/\:/g)).length*25,r=Array.from(e.path.matchAll(/\:/g)).length*25;return n+=Array.from(t.path.matchAll(/\*/g)).length*150,r+=Array.from(e.path.matchAll(/\*/g)).length*150,n-r}function G(t){let e=t.node,n=t.path,r=t.placeholder,o=(e.parentElement??r?.parentElement)?.closest("[data-route]"),s=H.get(o),a=s?.pattern?.pathname,c=s?.group??j;t.group=[],H.set(e,t),a&&(n=n=="/"?"":n,n=a.replaceAll(/[^\/a-zA-Z0-9]+$/gm,"")+n.replaceAll(/^[^\/a-zA-Z0-9]+/gm,"")),n=n.replaceAll(/\/+/g,"/").replace(/\/$/m,""),t.pattern=new URLPattern({pathname:n||"/"}),c.push(t),c.sort(vt),W.updateQueued||(W.updateQueued=!0,queueMicrotask(w))}var C=document.querySelector('head meta[name="route"]')||document.createElement("meta");C.name="route";C.content=location.pathname;document.head.append(C);var w=()=>{let t=location.href.replace(/index\.*[a-z0-9]*$/gm,"");z(t),yt(Object.fromEntries(new URLSearchParams(location.search)));let e=!1,n=r=>{let o=!1;for(let s of r){let a=s.pattern.test(t);s.update(!o&&a),!o&&a&&(o=!0,s.group.length?n(s.group):(e=!0,C.content=s.pattern.pathname))}return e};return W.updateQueued=!1,n(j)},St=t=>{let e=t.target.closest("a")?.href,n=new URL(e,location.href);e&&n.hostname==location.hostname&&j.some(r=>r.pattern.test(e))&&(Q.call(window.history,null,null,e),w()&&t.preventDefault())};window.addEventListener("popstate",w);window.addEventListener("hashchange",w);window.addEventListener("click",St);window.history.pushState=function(e,n,r){Q.call(window.history,e,n,r),w()};window.history.replaceState=function(e,n,r){wt.call(window.history,e,n,r),w()};var R=new WeakMap,At=new MutationObserver(t=>{for(let e of t)R.has(e.target)&&R.get(e.target)()}),J={select:"[data-match]",run:t=>{let e=t.dataset.match,n=s=>s.replace(/index\.*[a-z0-9]*$/gm,"");function r(){return n(new URL(t.dataset.route||t.getAttribute("href"),location.href).pathname)}let o=()=>{r()==n(location.pathname)?t.classList.add(e):t.classList.remove(e)};z.subscribe({next:o}),R.set(t,o),At.observe(t,{attributes:!0,attributeFilter:["href","data-route"]}),o(),t.removeAttribute("data-match")}};var D={number:t=>t.valueAsNumber,date:t=>t.valueAsDate,text:t=>t.value,checkbox:t=>t.checked,"":t=>t.value},Z={select:"[data-bind],[name]",run:(t,e)=>{let n=t.dataset.bind||t.getAttribute("name"),r=d(e,n);if(r){let o=s=>{t.type=="checkbox"?t.checked=s:t.value=s};o(m(r)),p(r)&&(r.subscribe({next:o}),t.addEventListener("input",()=>r(D[t.type]?.(t)??t.value)),t.addEventListener("change",()=>r(D[t.type]?.(t)??t.value)))}}};var P=new WeakMap,K=new IntersectionObserver(t=>{for(let e of t)if(e.isIntersecting&&P.has(e.target)){for(let n of P.get(e.target))n();P.delete(e.target),K.unobserve(e.target)}},{rootMargin:"256px"});function x(t){return new Promise(e=>{let n=P.get(t)??[];n.push(e),P.set(t,n),K.observe(t)})}var O=new WeakSet,X={select:"[data-include]",run:(t,e)=>{if(O.has(t)||t.children.length)return;O.add(t);let n=t.hasAttribute("data-lazy")&&t.closest("[hidden]"),r=async()=>{t.dispatchEvent(new CustomEvent("::load",{bubbles:!0}));let o=await fetch(t.dataset.include,{headers:{accept:"text/html,text/*"}});if(o.ok){let s=await o.text();t.dispatchEvent(new CustomEvent("::loaded",{bubbles:!0})),t.innerHTML=s;for(let a of t.childNodes)g(a,e);t.removeAttribute("data-include"),t.removeAttribute("data-lazy")}};t.hasAttribute("data-lazy")?x(t).then(r):r()}};var Y=new WeakSet,tt={select:"[data-for]",run:(t,e,n)=>{if(Y.has(t))return;let r=t.dataset.for.replace("let","").split("of"),o=r[0].split(","),s=r.at(-1).trim(),a=o[0].trim()==s?"__e":o[0].trim(),c=o[1]?.trim()??"__i",i=d(e,s),l=document.createComment(t.dataset.for);t.replaceWith(l),O.add(t);let u=()=>{let f=l;for(;(f=f.nextSibling)&&((f instanceof HTMLElement||f instanceof SVGElement)&&f.dataset.for==t.dataset.for);)f=f.previousSibling,f.nextSibling.remove()},b=f=>{if(u(),!f||!f[Symbol.iterator])return console.warn("data-for: The value given is not iterable.",{key:s,value:f});for(let y=0,M=l;y{let n=d(e,t.dataset.if||t.dataset.ifNot),r=document.createComment("if: "+(t.dataset.if||t.dataset.ifNot)),o=!!t.dataset.ifNot;t.replaceWith(r);let s=a=>{a=o?!a:a,!t.parentNode&&a?(t.hidden=!1,r.after(t)):t.localName!="link"&&t.remove()};s(m(n)),p(n)&&n.subscribe({next:s})}};var rt=new WeakSet,nt={select:"[data-lazy]",run:(t,e,n)=>{if(rt.has(t)||!t.childNodes.length)return;rt.add(t);let r=t.dataset.lazy,o=()=>{t.removeAttribute("data-lazy"),I(t,e);for(let s of t.childNodes)g(s,e)};r&&(t.addEventListener("::load",()=>t.classList.add(r),{once:!0}),t.addEventListener("::loaded",()=>t.classList.remove(r),{once:!0})),x(t).then(o),n()}};var ot={select:"[data-on]",run:(t,e)=>{let n=r=>{let o=r.split(":"),s=o[0].trim(),a=o.at(-1).trim(),c=d(e,a);c&&t.addEventListener(s,c)};for(let r of t.dataset.on.split(","))n(r)}};var at=t=>{let e=document.createElement("link");Object.assign(e,t),e.rel="preload",document.head.append(e)};var st=new WeakSet,it={select:"[data-preload]",run:t=>{if(st.has(t)||t.hidden)return;st.add(t);let e=()=>{let n=t.dataset.preload.split(",");for(let r of n){let o=r.split(":");at({href:o[0],as:o[1]??"fetch"})}};t.hasAttribute("data-lazy")?x(t).then(e):e()}};var ct={select:"[data-route], [data-route-not]",run:async t=>{"URLPattern"in window||await import("https://kevinblt.github.io/hec/packages/@hec.js/ui/dist/urlpattnern.min.js");let e=t.dataset.route,n=document.createComment("route: "+e);G({path:e,update:o=>{if(o){if(t.hidden=!1,t.parentNode)return;n.after(t)}else t.localName!="link"&&t.remove()},node:t,placeholder:n}),t.replaceWith(n)}};var B="[data-component], [data-view], [data-page]",T=(t,e=document.body,n=V)=>{let r=B.replaceAll("]",`="${t}"]`);e.matches(r)&&n(e,t);for(let o of e.querySelectorAll(r))n(o,t)};new MutationObserver(t=>{for(let e of t){for(let n of e.addedNodes)for(let r of Object.keys(v))T(r);for(let n of e.removedNodes)for(let r of Object.keys(v))n instanceof Element&&T(r,n,o=>o.dispatchEvent(new CustomEvent("::unmount")))}}).observe(document,{childList:!0,subtree:!0});var v={},L=new WeakMap;function V(t,e){L.has(t)||!v[e]||(v[e].use(t),L.set(t,v[e].component))}var _=class{constructor(e){Object.assign(this,e)}signals={};node;props;#t=null;async insert(e){this.#t??=this.node.hasAttribute("data-lazy"),this.#t?(this.node.dispatchEvent(new CustomEvent("::load")),this.node.removeAttribute("data-lazy"),await x(this.node)):(this.node.dispatchEvent(new CustomEvent("::load")),await Promise.resolve());let n=e(this.signals,this.node);(o=>{k(this,N(o));let s=Array.from(this.node.childNodes);if(this.node.append(o),s.length){let a=this.node.querySelector("slot"),c=document.createComment("children/"),i=document.createComment("/children");a?a.replaceWith(c,...s,i):this.node.append(c,...s)}for(let a in this.props){let c=this.node.getAttribute(a)??"";this.node.hasAttribute(a)||this.node.setAttribute(a,this.props[a]?.toString()),c.startsWith("@")||this.signals[a].subscribe({next:i=>i==null?this.node.removeAttribute(a):this.node.setAttribute(a,i.toString())})}this.node.dispatchEvent(new CustomEvent("::loaded")),this.node.dispatchEvent(new CustomEvent("::mount"))})(n instanceof Promise?await n:n)}attributeChange(e,n,r){let o=Object.entries(this.props).filter(s=>s[0].toLowerCase()==e.toLowerCase())[0];if(r?.startsWith("@")){let s=this.node.parentNode,a=r.slice(1),c=d(N(s),a)??d(N(this.node),a);p(c)?this.signals[e]=c:(this.signals[o[0]]??=h(c),this.signals[o[0]](c))}else this.signals[o[0]]??=h(r),this.signals[o[0]](typeof o[1]=="number"?parseFloat(r):r)}};function lt(t,e,n){v[t]??={observer:new MutationObserver(r=>{for(let o of r)o.target instanceof Element&&L.get(o.target)?.attributeChange(o.attributeName,o.oldValue,o.target.getAttribute(o.attributeName))}),component:null,use(r){this.component=new _({props:e,node:r});for(let o of Object.keys(e))this.component.attributeChange(o,null,r.getAttribute(o)??e[o]);this.component.insert(n),this.observer.observe(r,{attributes:!0,attributeOldValue:!0,attributeFilter:Object.keys(e).map(o=>o.toLowerCase())})}},T(t,document.body)}var de=lt,he=lt;var ut={select:B,run:t=>{L.has(t)||V(t,t.dataset.component??t.dataset.view??t.dataset.page)}};var ft=[ut,tt,et,ct,it,X,ot,Z,J,nt];var pt={};function _e(t,e={}){t instanceof URL&&(t=t.host==location.host?t.pathname:t.toString());let n=document.querySelector(`template[name="${t}"]`);if(!n){let r=document.querySelector('head meta[name="template-path"]');return pt[t]??=new Promise(async o=>{n=document.createElement("template"),n.setAttribute("id",t.toString()),n.innerHTML=await fetch(r?.content?.replaceAll("[name]",t.toString())??t).then(s=>s.text()),document.body.append(n),o(n)}),pt[t].then(o=>g(o.content.cloneNode(!0),e))}return g(n.content.cloneNode(!0),e)}function Be(t,e={}){let n=document.createElement("template");return n.dataset.name="anonymous",n.innerHTML=t,g(n.content.cloneNode(!0),e)}function g(t,e={}){let n=(r,o=new WeakSet)=>{let s=!1;if(!(F(r)||o.has(r))){if(r.nodeName=="#document-fragment"&&k(r,e),r instanceof HTMLElement||r instanceof SVGElement){k(r,e);for(let a of ft)r.matches(a.select)&&a.run(r,e,()=>s=!0);if(s)return;I(r,e)}else if(r instanceof Text&&r.textContent.includes("{{")){let a=r.textContent.split(/{{|}}/g);for(let c=0,i=r,l;cl.data=u),o.add(l),i.after(l),i=l;r.remove()}o.add(r);for(let a of r.childNodes)n(a,o)}};return n(t,new WeakSet),t}var I=(t,e)=>{let n=t.getAttributeNames();for(let r of n){let o=t.getAttribute(r);o?.includes("{{")&&mt(o,e,s=>{s=s.trim().replace(/ +/," "),s==="undefined"||s==="null"?t.removeAttribute(r):t.setAttribute(r,s)})}},mt=(t,e,n)=>{let r=t.match(/{{[^}]+}}/g).map(q),o=t,s=()=>{t=o;for(let a of r)t=t.replace(a.text,m(a.value));return t};for(let a of r){let c=null;if(a.prop[a.prop.length-1]===")"){let i=a.prop.split("("),l=d(e,i[1].substring(0,i[1].length-1).trim()),u=i[0].trim();c=d(e,u),c=c(),c.provide(m(l)),p(l)&&l.subscribe({next:b=>c.resolve(m(b))})}else c=d(e,a.prop);if(c==null&&console.warn(`{{ ${a.prop} }}: No value for this key`,{key:a.prop,value:c}),p(c)){let i=c;for(let l in a.meta)if(S[l]){let u=S[l];i=i.map(b=>u({value:b,key:a.prop,param:a.meta[l],options:a.meta}))}a.value=i,i.subscribe({next:()=>n(s())})}else{let i=c;for(let l in a.meta)if(S[l]){let u=S[l];i=u({value:m(c),key:a.prop,param:a.meta[l],options:a.meta})}a.value=()=>i}}n(s())};var dt=new WeakMap;function $e(t,e=null){document.dispatchEvent(new CustomEvent(t,{detail:e}))}function qe(t,e){let n=r=>e(r.detail);dt.set(e,n),document.addEventListener(t,n)}function Fe(t){return new Promise(e=>{let n=r=>e(r.detail);document.addEventListener(t,n,{once:!0})})}function Ue(t,e){document.removeEventListener(t,dt.get(e))}export{L as activeComponents,lt as component,B as componentSelector,Pt as deletePropsOf,bt as effect,$e as emit,I as executeNodeAttributesTemplate,q as expression,m as f,Lt as hasProp,F as hasProps,p as isSignal,Mt as memo,Ue as off,qe as on,Fe as once,he as page,S as pipes,ft as plugins,d as prop,N as propsOf,zt as provider,xt as resource,Wt as resourceBy,k as setPropsOf,h as signal,_e as templateByName,g as templateByNode,Be as templateByString,V as useComponent,de as view}; diff --git a/packages/@hec.js/ui/dist/hec.min.js b/packages/@hec.js/ui/dist/hec.min.js index dabdc21..27cf2af 100644 --- a/packages/@hec.js/ui/dist/hec.min.js +++ b/packages/@hec.js/ui/dist/hec.min.js @@ -1 +1 @@ -(()=>{var wt=Object.create;var T=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var kt=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Et=(t,e)=>{for(var n in e)T(t,n,{get:e[n],enumerable:!0})},Pt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of St(e))!Nt.call(t,o)&&o!==n&&T(t,o,{get:()=>e[o],enumerable:!(r=vt(e,o))||r.enumerable});return t};var Lt=(t,e,n)=>(n=t!=null?wt(At(t)):{},Pt(e||!t||!t.__esModule?T(n,"default",{value:t,enumerable:!0}):n,t));var j={};Et(j,{activeComponents:()=>k,component:()=>H,componentSelector:()=>W,deletePropsOf:()=>Ct,effect:()=>D,emit:()=>Ut,executeNodeAttributesTemplate:()=>M,expression:()=>I,f:()=>p,hasProp:()=>Ot,hasProps:()=>_,isSignal:()=>m,memo:()=>Wt,off:()=>Gt,on:()=>Ht,once:()=>Qt,page:()=>qt,pipes:()=>w,plugins:()=>Q,prop:()=>d,propsOf:()=>v,provider:()=>jt,resource:()=>Z,resourceBy:()=>zt,setPropsOf:()=>S,signal:()=>h,templateByName:()=>Ft,templateByNode:()=>g,templateByString:()=>$t,useComponent:()=>z,view:()=>Vt});function I(t){let e=t.matchAll(/([^ {}\s]+)/g),n={meta:{},text:t,prop:null};for(let r of e)if(r[1].includes("=")){let o=r[1].split("=");n.meta[o[0]]=o[1].replaceAll(/'|"/g,"")}else n.prop=r[1];return n}var w={};var E=new WeakMap,v=t=>E.get(t),Ct=t=>E.delete(t),_=t=>E.has(t),S=(t,e)=>{let n=v(t);n&&typeof n=="object"?E.set(t,Object.assign(n,e)):E.set(t,e)},p=t=>typeof t=="function"?p(t()):t;function d(t,e){let n=e.split(".");if(!e)return t;if(!t)return null;for(let r of n){if(["state"].includes(r)&&t?.state)return t[r];if(m(t)){let o=t()?.[r];if(m(o)){let s=new AbortController,a=h(o());o.subscribe({next:a},{signal:s.signal});let c=i=>{s.abort(),m(i[r])?(s=new AbortController,i[r].subscribe({next:a},{signal:s.signal}),a(i[r]())):a(i[r])};t.subscribe({next:c}),t=a}else t=t.map(s=>s&&s[r])}else if(typeof t=="function")t=p(t);else if(typeof t[r]<"u")typeof t[r]=="function"&&!m(t[r])?t=t[r].bind(t):t=t[r];else return}return t}function Ot(t,e){let n=e.split(".");if(!e||!t)return!1;for(let r of n){if(["loading","error"].includes(r)&&t?.loading&&t?.error)return t[r];if(typeof t=="function")t=p(t);else if(typeof t[r]<"u")t=t[r];else return!1}return!0}var J={items:new Map,setItem(t,e){this.items.set(t,e?.toString())},get length(){return this.items.keys().length},key(t){return Array.from(this.items.values()).at(t)},clear(){this.items.clear()},getItem(t){return this.items.get(t)},removeItem(t){this.items.delete(t)}},P=new Map;function Mt(t){try{let e=window[t+"Storage"];return typeof e.length=="number"?e:J}catch{return J}}window.addEventListener("storage",t=>{if(!P.has(t.key))return;let e=P.get(t.key),n=t.storageArea.getItem(t.key);typeof n=="string"&&n!=="undefined"&&e.update(JSON.parse(n))});function h(t=null,e={}){if(e.id&&P.has(e.id))return P.get(e.id);let n=[],r=e.storage&&Mt(e.storage),o=i=>{t=i,r&&r.setItem(e.id,JSON.stringify(t));for(let l of n)l.next(t)};function s(){return arguments.length&&t!==arguments[0]&&o(arguments[0]),t}let a=(i,l=null)=>{n.push(i),l?.signal.addEventListener("abort",()=>{let u=n.indexOf(i);u>-1&&n.splice(u,1)},{once:!0})};if(r){let i=r.getItem(e.id);o(typeof i=="string"&&i!=="undefined"?JSON.parse(i):t)}let c=Object.assign(s,{id:e.id,storage:e.storage,toString:()=>t?.toString(),set:i=>t=i,update:o,subscribe:a,map:i=>{let l=h(i(t)),u=new AbortController,b=l.subscribe;return a({next:f=>l(i(f))},{signal:u.signal}),Object.assign(l,{set:()=>null,subscribe:(f,y)=>{b(f,y),y?.signal.addEventListener("abort",()=>u.abort())}})},filter:i=>{let l=h(i(t)?t:null);return a({next:u=>i(u)?l(u):null}),Object.assign(l,{set:()=>null})}});return e.id&&P.set(e.id,c),c}function D(t,e=[],n=null){for(let r of e)r.subscribe({next:()=>n=t(n)});return t(n)}function Wt(t,e=[],n=null){let r=h(null);return r(D(o=>r(t(o)),e,n)),r}function Z(t,e=null){let n=h(e),r=h("loaded"),o=async()=>{if(r()!="pending"){try{r("pending"),n(await t()),r("loaded"),delete n.error}catch(s){r("error"),n.error=s}return n()}};return o(),Object.assign(n,{state:r,refetch:o})}function zt(t,e,n=null){let r=Z(()=>e(p(t)),n);return m(t)&&t.subscribe({next:()=>r.refetch()}),r}function m(t){return t&&t.subscribe}function jt(t,e=[]){function n(){let r=h(null),o=null,s=a=>{o=a,r(t(a))};for(let a of e)a.subscribe({next:()=>r(t(o))});return Object.assign({provide:s},r)}return n}var Rt=h({}),V=h(location.pathname),X=window.history.pushState,Tt=window.history.replaceState,B={updateQueued:!1},q=[],K=new WeakMap;function It(t,e){let n=Array.from(t.path.matchAll(/\:/g)).length*25,r=Array.from(e.path.matchAll(/\:/g)).length*25;return n+=Array.from(t.path.matchAll(/\*/g)).length*150,r+=Array.from(e.path.matchAll(/\*/g)).length*150,n-r}function Y(t){requestAnimationFrame(()=>{let e=t.node,n=t.path,r=e.parentElement?.closest("[data-route]"),o=K.get(r),s=o?.pattern?.pathname,a=o?.group??q;t.group=[],K.set(e,t),s&&(n=n=="/"?"":n,n=s.replaceAll(/[^\/a-zA-Z0-9]+$/gm,"")+n.replaceAll(/^[^\/a-zA-Z0-9]+/gm,"")),n=n.replaceAll(/\/+/g,"/").replace(/\/$/m,""),t.pattern=new URLPattern({pathname:n||"/"}),a.push(t),a.sort(It),B.updateQueued||(B.updateQueued=!0,queueMicrotask(A))})}var C=document.querySelector('head meta[name="route"]')||document.createElement("meta");C.name="route";C.content=location.pathname;document.head.append(C);var A=()=>{let t=location.href.replace(/index\.*[a-z0-9]*$/gm,"");V(t),Rt(Object.fromEntries(new URLSearchParams(location.search)));let e=!1,n=r=>{let o=!1;for(let s of r){let a=s.pattern.test(t);s.update(!o&&a),!o&&a&&(o=!0,s.group.length?n(s.group):(e=!0,C.content=s.pattern.pathname))}return e};return B.updateQueued=!1,n(q)},_t=t=>{let e=t.target.closest("a")?.href,n=new URL(e,location.href);e&&n.hostname==location.hostname&&q.some(r=>r.pattern.test(e))&&(X.call(window.history,null,null,e),A()&&t.preventDefault())};window.addEventListener("popstate",A);window.addEventListener("hashchange",A);window.addEventListener("click",_t);window.history.pushState=function(e,n,r){X.call(window.history,e,n,r),A()};window.history.replaceState=function(e,n,r){Tt.call(window.history,e,n,r),A()};var F=new WeakMap,Bt=new MutationObserver(t=>{for(let e of t)F.has(e.target)&&F.get(e.target)()}),tt={select:"[data-match]",run:t=>{let e=t.dataset.match,n=s=>s.replace(/index\.*[a-z0-9]*$/gm,"");function r(){return n(new URL(t.dataset.route||t.getAttribute("href"),location.href).pathname)}let o=()=>{r()==n(location.pathname)?t.classList.add(e):t.classList.remove(e)};V.subscribe({next:o}),F.set(t,o),Bt.observe(t,{attributes:!0,attributeFilter:["href","data-route"]}),o(),t.removeAttribute("data-match")}};var et={number:t=>t.valueAsNumber,date:t=>t.valueAsDate,text:t=>t.value,checkbox:t=>t.checked,"":t=>t.value},rt={select:"[data-bind],[name]",run:(t,e)=>{let n=t.dataset.bind||t.getAttribute("name"),r=d(e,n);if(r){let o=s=>{t.type=="checkbox"?t.checked=s:t.value=s};o(p(r)),m(r)&&(r.subscribe({next:o}),t.addEventListener("input",()=>r(et[t.type]?.(t)??t.value)),t.addEventListener("change",()=>r(et[t.type]?.(t)??t.value)))}}};var L=new WeakMap,nt=new IntersectionObserver(t=>{for(let e of t)if(e.isIntersecting&&L.has(e.target)){for(let n of L.get(e.target))n();L.delete(e.target),nt.unobserve(e.target)}},{rootMargin:"256px"});function x(t){return new Promise(e=>{let n=L.get(t)??[];n.push(e),L.set(t,n),nt.observe(t)})}var O=new WeakSet,ot={select:"[data-include]",run:(t,e)=>{if(O.has(t)||t.children.length)return;O.add(t);let n=t.hasAttribute("data-lazy")&&t.closest("[hidden]"),r=async()=>{t.dispatchEvent(new CustomEvent("::load",{bubbles:!0}));let o=await fetch(t.dataset.include,{headers:{accept:"text/html,text/*"}});if(o.ok){let s=await o.text();t.dispatchEvent(new CustomEvent("::loaded",{bubbles:!0})),t.innerHTML=s;for(let a of t.childNodes)g(a,e);t.removeAttribute("data-include"),t.removeAttribute("data-lazy")}};t.hasAttribute("data-lazy")?x(t).then(r):r()}};var at=new WeakSet,st={select:"[data-for]",run:(t,e,n)=>{if(at.has(t))return;let r=t.dataset.for.replace("let","").split("of"),o=r[0].split(","),s=r.at(-1).trim(),a=o[0].trim()==s?"__e":o[0].trim(),c=o[1]?.trim()??"__i",i=d(e,s),l=document.createComment(t.dataset.for);t.replaceWith(l),O.add(t);let u=()=>{let f=l;for(;(f=f.nextSibling)&&((f instanceof HTMLElement||f instanceof SVGElement)&&f.dataset.for==t.dataset.for);)f=f.previousSibling,f.nextSibling.remove()},b=f=>{if(u(),!f||!f[Symbol.iterator])return console.warn("data-for: The value given is not iterable.",{key:s,value:f});for(let y=0,R=l;y{let n=d(e,t.dataset.if||t.dataset.ifNot),r=document.createComment("if: "+(t.dataset.if||t.dataset.ifNot)),o=!!t.dataset.ifNot;t.replaceWith(r);let s=a=>{a=o?!a:a,!t.parentNode&&a?(t.hidden=!1,r.after(t)):t.localName!="link"&&t.remove()};s(p(n)),m(n)&&n.subscribe({next:s})}};var ct=new WeakSet,lt={select:"[data-lazy]",run:(t,e,n)=>{if(ct.has(t)||!t.childNodes.length)return;ct.add(t);let r=t.dataset.lazy,o=()=>{t.removeAttribute("data-lazy"),M(t,e);for(let s of t.childNodes)g(s,e)};r&&(t.addEventListener("::load",()=>t.classList.add(r),{once:!0}),t.addEventListener("::loaded",()=>t.classList.remove(r),{once:!0})),x(t).then(o),n()}};var ut={select:"[data-on]",run:(t,e)=>{let n=r=>{let o=r.split(":"),s=o[0].trim(),a=o.at(-1).trim(),c=d(e,a);c&&t.addEventListener(s,c)};for(let r of t.dataset.on.split(","))n(r)}};var ft=t=>{let e=document.createElement("link");Object.assign(e,t),e.rel="preload",document.head.append(e)};var mt=new WeakSet,pt={select:"[data-preload]",run:t=>{if(mt.has(t)||t.hidden)return;mt.add(t);let e=()=>{let n=t.dataset.preload.split(",");for(let r of n){let o=r.split(":");ft({href:o[0],as:o[1]??"fetch"})}};t.hasAttribute("data-lazy")?x(t).then(e):e()}};var dt={select:"[data-route], [data-route-not]",run:async t=>{"URLPattern"in window||await import("https://kevinblt.github.io/hec/packages/@hec.js/ui/dist/urlpattnern.min.js");let e=t.dataset.route,n=document.createComment("route: "+e);Y({path:e,update:o=>{if(o){if(t.hidden=!1,t.parentNode)return;n.after(t)}else t.localName!="link"&&t.remove()},node:t}),t.replaceWith(n)}};var W="[data-component], [data-view], [data-page]",$=(t,e=document.body,n=z)=>{let r=W.replaceAll("]",`="${t}"]`);e.matches(r)&&n(e,t);for(let o of e.querySelectorAll(r))n(o,t)};new MutationObserver(t=>{for(let e of t){for(let n of e.addedNodes)for(let r of Object.keys(N))$(r);for(let n of e.removedNodes)for(let r of Object.keys(N))n instanceof Element&&$(r,n,o=>o.dispatchEvent(new CustomEvent("::unmount")))}}).observe(document,{childList:!0,subtree:!0});var N={},k=new WeakMap;function z(t,e){k.has(t)||!N[e]||(N[e].use(t),k.set(t,N[e].component))}var U=class{constructor(e){Object.assign(this,e)}signals={};node;props;#t=null;async insert(e){this.#t??=this.node.hasAttribute("data-lazy"),this.#t?(this.node.dispatchEvent(new CustomEvent("::load")),this.node.removeAttribute("data-lazy"),await x(this.node)):(this.node.dispatchEvent(new CustomEvent("::load")),await Promise.resolve());let n=e(this.signals,this.node);(o=>{S(this,v(o));let s=Array.from(this.node.childNodes);if(this.node.append(o),s.length){let a=this.node.querySelector("slot"),c=document.createComment("children/"),i=document.createComment("/children");a?a.replaceWith(c,...s,i):this.node.append(c,...s)}for(let a in this.props){let c=this.node.getAttribute(a)??"";this.node.hasAttribute(a)||this.node.setAttribute(a,this.props[a]?.toString()),c.startsWith("@")||this.signals[a].subscribe({next:i=>i==null?this.node.removeAttribute(a):this.node.setAttribute(a,i.toString())})}this.node.dispatchEvent(new CustomEvent("::loaded")),this.node.dispatchEvent(new CustomEvent("::mount"))})(n instanceof Promise?await n:n)}attributeChange(e,n,r){let o=Object.entries(this.props).filter(s=>s[0].toLowerCase()==e.toLowerCase())[0];if(r?.startsWith("@")){let s=this.node.parentNode,a=r.slice(1),c=d(v(s),a)??d(v(this.node),a);m(c)?this.signals[e]=c:(this.signals[o[0]]??=h(c),this.signals[o[0]](c))}else this.signals[o[0]]??=h(r),this.signals[o[0]](typeof o[1]=="number"?parseFloat(r):r)}};function H(t,e,n){N[t]??={observer:new MutationObserver(r=>{for(let o of r)o.target instanceof Element&&k.get(o.target)?.attributeChange(o.attributeName,o.oldValue,o.target.getAttribute(o.attributeName))}),component:null,use(r){this.component=new U({props:e,node:r});for(let o of Object.keys(e))this.component.attributeChange(o,null,r.getAttribute(o)??e[o]);this.component.insert(n),this.observer.observe(r,{attributes:!0,attributeOldValue:!0,attributeFilter:Object.keys(e).map(o=>o.toLowerCase())})}},$(t,document.body)}var Vt=H,qt=H;var ht={select:W,run:t=>{k.has(t)||z(t,t.dataset.component??t.dataset.view??t.dataset.page)}};var Q=[ht,st,it,dt,pt,ot,ut,rt,tt,lt];var gt={};function Ft(t,e={}){t instanceof URL&&(t=t.host==location.host?t.pathname:t.toString());let n=document.querySelector(`template[name="${t}"]`);if(!n){let r=document.querySelector('head meta[name="template-path"]');return gt[t]??=new Promise(async o=>{n=document.createElement("template"),n.setAttribute("id",t.toString()),n.innerHTML=await fetch(r?.content?.replaceAll("[name]",t.toString())??t).then(s=>s.text()),document.body.append(n),o(n)}),gt[t].then(o=>g(o.content.cloneNode(!0),e))}return g(n.content.cloneNode(!0),e)}function $t(t,e={}){let n=document.createElement("template");return n.dataset.name="anonymous",n.innerHTML=t,g(n.content.cloneNode(!0),e)}function g(t,e={}){let n=(r,o=new WeakSet)=>{let s=!1;if(!(_(r)||o.has(r))){if(r.nodeName=="#document-fragment"&&S(r,e),r instanceof HTMLElement||r instanceof SVGElement){S(r,e);for(let a of Q)r.matches(a.select)&&a.run(r,e,()=>s=!0);if(s)return;M(r,e)}else if(r instanceof Text&&r.textContent.includes("{{")){let a=r.textContent.split(/{{|}}/g);for(let c=0,i=r,l;cl.data=u),o.add(l),i.after(l),i=l;r.remove()}o.add(r);for(let a of r.childNodes)n(a,o)}};return n(t,new WeakSet),t}var M=(t,e)=>{let n=t.getAttributeNames();for(let r of n){let o=t.getAttribute(r);o?.includes("{{")&&bt(o,e,s=>{s=s.trim().replace(/ +/," "),s==="undefined"||s==="null"?t.removeAttribute(r):t.setAttribute(r,s)})}},bt=(t,e,n)=>{let r=t.match(/{{[^}]+}}/g).map(I),o=t,s=()=>{t=o;for(let a of r)t=t.replace(a.text,p(a.value));return t};for(let a of r){let c=null;if(a.prop[a.prop.length-1]===")"){let i=a.prop.split("("),l=d(e,i[1].substring(0,i[1].length-1).trim()),u=i[0].trim();c=d(e,u),c=c(),c.provide(p(l)),m(l)&&l.subscribe({next:b=>c.resolve(p(b))})}else c=d(e,a.prop);if(c==null&&console.warn(`{{ ${a.prop} }}: No value for this key`,{key:a.prop,value:c}),m(c)){let i=c;for(let l in a.meta)if(w[l]){let u=w[l];i=i.map(b=>u({value:b,key:a.prop,param:a.meta[l],options:a.meta}))}a.value=i,i.subscribe({next:()=>n(s())})}else{let i=c;for(let l in a.meta)if(w[l]){let u=w[l];i=u({value:p(c),key:a.prop,param:a.meta[l],options:a.meta})}a.value=()=>i}}n(s())};var xt=new WeakMap;function Ut(t,e=null){document.dispatchEvent(new CustomEvent(t,{detail:e}))}function Ht(t,e){let n=r=>e(r.detail);xt.set(e,n),document.addEventListener(t,n)}function Qt(t){return new Promise(e=>{let n=r=>e(r.detail);document.addEventListener(t,n,{once:!0})})}function Gt(t,e){document.removeEventListener(t,xt.get(e))}for(let t in j)globalThis[t]=j[t];})(); +(()=>{var wt=Object.create;var T=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var kt=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Et=(t,e)=>{for(var n in e)T(t,n,{get:e[n],enumerable:!0})},Pt=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of St(e))!Nt.call(t,o)&&o!==n&&T(t,o,{get:()=>e[o],enumerable:!(r=vt(e,o))||r.enumerable});return t};var Lt=(t,e,n)=>(n=t!=null?wt(At(t)):{},Pt(e||!t||!t.__esModule?T(n,"default",{value:t,enumerable:!0}):n,t));var j={};Et(j,{activeComponents:()=>k,component:()=>H,componentSelector:()=>W,deletePropsOf:()=>Ct,effect:()=>D,emit:()=>Ut,executeNodeAttributesTemplate:()=>M,expression:()=>I,f:()=>m,hasProp:()=>Ot,hasProps:()=>_,isSignal:()=>p,memo:()=>Wt,off:()=>Gt,on:()=>Ht,once:()=>Qt,page:()=>$t,pipes:()=>w,plugins:()=>Q,prop:()=>d,propsOf:()=>v,provider:()=>jt,resource:()=>Z,resourceBy:()=>zt,setPropsOf:()=>S,signal:()=>h,templateByName:()=>qt,templateByNode:()=>g,templateByString:()=>Ft,useComponent:()=>z,view:()=>Vt});function I(t){let e=t.matchAll(/([^ {}\s]+)/g),n={meta:{},text:t,prop:null};for(let r of e)if(r[1].includes("=")){let o=r[1].split("=");n.meta[o[0]]=o[1].replaceAll(/'|"/g,"")}else n.prop=r[1];return n}var w={};var E=new WeakMap,v=t=>E.get(t),Ct=t=>E.delete(t),_=t=>E.has(t),S=(t,e)=>{let n=v(t);n&&typeof n=="object"?E.set(t,Object.assign(n,e)):E.set(t,e)},m=t=>typeof t=="function"?m(t()):t;function d(t,e){let n=e.split(".");if(!e)return t;if(!t)return null;for(let r of n){if(["state"].includes(r)&&t?.state)return t[r];if(p(t)){let o=t()?.[r];if(p(o)){let s=new AbortController,a=h(o());o.subscribe({next:a},{signal:s.signal});let c=i=>{s.abort(),p(i[r])?(s=new AbortController,i[r].subscribe({next:a},{signal:s.signal}),a(i[r]())):a(i[r])};t.subscribe({next:c}),t=a}else t=t.map(s=>s&&s[r])}else if(typeof t=="function")t=m(t);else if(typeof t[r]<"u")typeof t[r]=="function"&&!p(t[r])?t=t[r].bind(t):t=t[r];else return}return t}function Ot(t,e){let n=e.split(".");if(!e||!t)return!1;for(let r of n){if(["loading","error"].includes(r)&&t?.loading&&t?.error)return t[r];if(typeof t=="function")t=m(t);else if(typeof t[r]<"u")t=t[r];else return!1}return!0}var J={items:new Map,setItem(t,e){this.items.set(t,e?.toString())},get length(){return this.items.keys().length},key(t){return Array.from(this.items.values()).at(t)},clear(){this.items.clear()},getItem(t){return this.items.get(t)},removeItem(t){this.items.delete(t)}},P=new Map;function Mt(t){try{let e=window[t+"Storage"];return typeof e.length=="number"?e:J}catch{return J}}window.addEventListener("storage",t=>{if(!P.has(t.key))return;let e=P.get(t.key),n=t.storageArea.getItem(t.key);typeof n=="string"&&n!=="undefined"&&e.update(JSON.parse(n))});function h(t=null,e={}){if(e.id&&P.has(e.id))return P.get(e.id);let n=[],r=e.storage&&Mt(e.storage),o=i=>{t=i,r&&r.setItem(e.id,JSON.stringify(t));for(let l of n)l.next(t)};function s(){return arguments.length&&t!==arguments[0]&&o(arguments[0]),t}let a=(i,l=null)=>{n.push(i),l?.signal.addEventListener("abort",()=>{let u=n.indexOf(i);u>-1&&n.splice(u,1)},{once:!0})};if(r){let i=r.getItem(e.id);o(typeof i=="string"&&i!=="undefined"?JSON.parse(i):t)}let c=Object.assign(s,{id:e.id,storage:e.storage,toString:()=>t?.toString(),set:i=>t=i,update:o,subscribe:a,map:i=>{let l=h(i(t)),u=new AbortController,b=l.subscribe;return a({next:f=>l(i(f))},{signal:u.signal}),Object.assign(l,{set:()=>null,subscribe:(f,y)=>{b(f,y),y?.signal.addEventListener("abort",()=>u.abort())}})},filter:i=>{let l=h(i(t)?t:null);return a({next:u=>i(u)?l(u):null}),Object.assign(l,{set:()=>null})}});return e.id&&P.set(e.id,c),c}function D(t,e=[],n=null){for(let r of e)r.subscribe({next:()=>n=t(n)});return t(n)}function Wt(t,e=[],n=null){let r=h(null);return r(D(o=>r(t(o)),e,n)),r}function Z(t,e=null){let n=h(e),r=h("loaded"),o=async()=>{if(r()!="pending"){try{r("pending"),n(await t()),r("loaded"),delete n.error}catch(s){r("error"),n.error=s}return n()}};return o(),Object.assign(n,{state:r,refetch:o})}function zt(t,e,n=null){let r=Z(()=>e(m(t)),n);return p(t)&&t.subscribe({next:()=>r.refetch()}),r}function p(t){return t&&t.subscribe}function jt(t,e=[]){function n(){let r=h(null),o=null,s=a=>{o=a,r(t(a))};for(let a of e)a.subscribe({next:()=>r(t(o))});return Object.assign({provide:s},r)}return n}var Rt=h({}),V=h(location.pathname),X=window.history.pushState,Tt=window.history.replaceState,B={updateQueued:!1},$=[],K=new WeakMap;function It(t,e){let n=Array.from(t.path.matchAll(/\:/g)).length*25,r=Array.from(e.path.matchAll(/\:/g)).length*25;return n+=Array.from(t.path.matchAll(/\*/g)).length*150,r+=Array.from(e.path.matchAll(/\*/g)).length*150,n-r}function Y(t){let e=t.node,n=t.path,r=t.placeholder,o=(e.parentElement??r?.parentElement)?.closest("[data-route]"),s=K.get(o),a=s?.pattern?.pathname,c=s?.group??$;t.group=[],K.set(e,t),a&&(n=n=="/"?"":n,n=a.replaceAll(/[^\/a-zA-Z0-9]+$/gm,"")+n.replaceAll(/^[^\/a-zA-Z0-9]+/gm,"")),n=n.replaceAll(/\/+/g,"/").replace(/\/$/m,""),t.pattern=new URLPattern({pathname:n||"/"}),c.push(t),c.sort(It),B.updateQueued||(B.updateQueued=!0,queueMicrotask(A))}var C=document.querySelector('head meta[name="route"]')||document.createElement("meta");C.name="route";C.content=location.pathname;document.head.append(C);var A=()=>{let t=location.href.replace(/index\.*[a-z0-9]*$/gm,"");V(t),Rt(Object.fromEntries(new URLSearchParams(location.search)));let e=!1,n=r=>{let o=!1;for(let s of r){let a=s.pattern.test(t);s.update(!o&&a),!o&&a&&(o=!0,s.group.length?n(s.group):(e=!0,C.content=s.pattern.pathname))}return e};return B.updateQueued=!1,n($)},_t=t=>{let e=t.target.closest("a")?.href,n=new URL(e,location.href);e&&n.hostname==location.hostname&&$.some(r=>r.pattern.test(e))&&(X.call(window.history,null,null,e),A()&&t.preventDefault())};window.addEventListener("popstate",A);window.addEventListener("hashchange",A);window.addEventListener("click",_t);window.history.pushState=function(e,n,r){X.call(window.history,e,n,r),A()};window.history.replaceState=function(e,n,r){Tt.call(window.history,e,n,r),A()};var q=new WeakMap,Bt=new MutationObserver(t=>{for(let e of t)q.has(e.target)&&q.get(e.target)()}),tt={select:"[data-match]",run:t=>{let e=t.dataset.match,n=s=>s.replace(/index\.*[a-z0-9]*$/gm,"");function r(){return n(new URL(t.dataset.route||t.getAttribute("href"),location.href).pathname)}let o=()=>{r()==n(location.pathname)?t.classList.add(e):t.classList.remove(e)};V.subscribe({next:o}),q.set(t,o),Bt.observe(t,{attributes:!0,attributeFilter:["href","data-route"]}),o(),t.removeAttribute("data-match")}};var et={number:t=>t.valueAsNumber,date:t=>t.valueAsDate,text:t=>t.value,checkbox:t=>t.checked,"":t=>t.value},rt={select:"[data-bind],[name]",run:(t,e)=>{let n=t.dataset.bind||t.getAttribute("name"),r=d(e,n);if(r){let o=s=>{t.type=="checkbox"?t.checked=s:t.value=s};o(m(r)),p(r)&&(r.subscribe({next:o}),t.addEventListener("input",()=>r(et[t.type]?.(t)??t.value)),t.addEventListener("change",()=>r(et[t.type]?.(t)??t.value)))}}};var L=new WeakMap,nt=new IntersectionObserver(t=>{for(let e of t)if(e.isIntersecting&&L.has(e.target)){for(let n of L.get(e.target))n();L.delete(e.target),nt.unobserve(e.target)}},{rootMargin:"256px"});function x(t){return new Promise(e=>{let n=L.get(t)??[];n.push(e),L.set(t,n),nt.observe(t)})}var O=new WeakSet,ot={select:"[data-include]",run:(t,e)=>{if(O.has(t)||t.children.length)return;O.add(t);let n=t.hasAttribute("data-lazy")&&t.closest("[hidden]"),r=async()=>{t.dispatchEvent(new CustomEvent("::load",{bubbles:!0}));let o=await fetch(t.dataset.include,{headers:{accept:"text/html,text/*"}});if(o.ok){let s=await o.text();t.dispatchEvent(new CustomEvent("::loaded",{bubbles:!0})),t.innerHTML=s;for(let a of t.childNodes)g(a,e);t.removeAttribute("data-include"),t.removeAttribute("data-lazy")}};t.hasAttribute("data-lazy")?x(t).then(r):r()}};var at=new WeakSet,st={select:"[data-for]",run:(t,e,n)=>{if(at.has(t))return;let r=t.dataset.for.replace("let","").split("of"),o=r[0].split(","),s=r.at(-1).trim(),a=o[0].trim()==s?"__e":o[0].trim(),c=o[1]?.trim()??"__i",i=d(e,s),l=document.createComment(t.dataset.for);t.replaceWith(l),O.add(t);let u=()=>{let f=l;for(;(f=f.nextSibling)&&((f instanceof HTMLElement||f instanceof SVGElement)&&f.dataset.for==t.dataset.for);)f=f.previousSibling,f.nextSibling.remove()},b=f=>{if(u(),!f||!f[Symbol.iterator])return console.warn("data-for: The value given is not iterable.",{key:s,value:f});for(let y=0,R=l;y{let n=d(e,t.dataset.if||t.dataset.ifNot),r=document.createComment("if: "+(t.dataset.if||t.dataset.ifNot)),o=!!t.dataset.ifNot;t.replaceWith(r);let s=a=>{a=o?!a:a,!t.parentNode&&a?(t.hidden=!1,r.after(t)):t.localName!="link"&&t.remove()};s(m(n)),p(n)&&n.subscribe({next:s})}};var ct=new WeakSet,lt={select:"[data-lazy]",run:(t,e,n)=>{if(ct.has(t)||!t.childNodes.length)return;ct.add(t);let r=t.dataset.lazy,o=()=>{t.removeAttribute("data-lazy"),M(t,e);for(let s of t.childNodes)g(s,e)};r&&(t.addEventListener("::load",()=>t.classList.add(r),{once:!0}),t.addEventListener("::loaded",()=>t.classList.remove(r),{once:!0})),x(t).then(o),n()}};var ut={select:"[data-on]",run:(t,e)=>{let n=r=>{let o=r.split(":"),s=o[0].trim(),a=o.at(-1).trim(),c=d(e,a);c&&t.addEventListener(s,c)};for(let r of t.dataset.on.split(","))n(r)}};var ft=t=>{let e=document.createElement("link");Object.assign(e,t),e.rel="preload",document.head.append(e)};var pt=new WeakSet,mt={select:"[data-preload]",run:t=>{if(pt.has(t)||t.hidden)return;pt.add(t);let e=()=>{let n=t.dataset.preload.split(",");for(let r of n){let o=r.split(":");ft({href:o[0],as:o[1]??"fetch"})}};t.hasAttribute("data-lazy")?x(t).then(e):e()}};var dt={select:"[data-route], [data-route-not]",run:async t=>{"URLPattern"in window||await import("https://kevinblt.github.io/hec/packages/@hec.js/ui/dist/urlpattnern.min.js");let e=t.dataset.route,n=document.createComment("route: "+e);Y({path:e,update:o=>{if(o){if(t.hidden=!1,t.parentNode)return;n.after(t)}else t.localName!="link"&&t.remove()},node:t,placeholder:n}),t.replaceWith(n)}};var W="[data-component], [data-view], [data-page]",F=(t,e=document.body,n=z)=>{let r=W.replaceAll("]",`="${t}"]`);e.matches(r)&&n(e,t);for(let o of e.querySelectorAll(r))n(o,t)};new MutationObserver(t=>{for(let e of t){for(let n of e.addedNodes)for(let r of Object.keys(N))F(r);for(let n of e.removedNodes)for(let r of Object.keys(N))n instanceof Element&&F(r,n,o=>o.dispatchEvent(new CustomEvent("::unmount")))}}).observe(document,{childList:!0,subtree:!0});var N={},k=new WeakMap;function z(t,e){k.has(t)||!N[e]||(N[e].use(t),k.set(t,N[e].component))}var U=class{constructor(e){Object.assign(this,e)}signals={};node;props;#t=null;async insert(e){this.#t??=this.node.hasAttribute("data-lazy"),this.#t?(this.node.dispatchEvent(new CustomEvent("::load")),this.node.removeAttribute("data-lazy"),await x(this.node)):(this.node.dispatchEvent(new CustomEvent("::load")),await Promise.resolve());let n=e(this.signals,this.node);(o=>{S(this,v(o));let s=Array.from(this.node.childNodes);if(this.node.append(o),s.length){let a=this.node.querySelector("slot"),c=document.createComment("children/"),i=document.createComment("/children");a?a.replaceWith(c,...s,i):this.node.append(c,...s)}for(let a in this.props){let c=this.node.getAttribute(a)??"";this.node.hasAttribute(a)||this.node.setAttribute(a,this.props[a]?.toString()),c.startsWith("@")||this.signals[a].subscribe({next:i=>i==null?this.node.removeAttribute(a):this.node.setAttribute(a,i.toString())})}this.node.dispatchEvent(new CustomEvent("::loaded")),this.node.dispatchEvent(new CustomEvent("::mount"))})(n instanceof Promise?await n:n)}attributeChange(e,n,r){let o=Object.entries(this.props).filter(s=>s[0].toLowerCase()==e.toLowerCase())[0];if(r?.startsWith("@")){let s=this.node.parentNode,a=r.slice(1),c=d(v(s),a)??d(v(this.node),a);p(c)?this.signals[e]=c:(this.signals[o[0]]??=h(c),this.signals[o[0]](c))}else this.signals[o[0]]??=h(r),this.signals[o[0]](typeof o[1]=="number"?parseFloat(r):r)}};function H(t,e,n){N[t]??={observer:new MutationObserver(r=>{for(let o of r)o.target instanceof Element&&k.get(o.target)?.attributeChange(o.attributeName,o.oldValue,o.target.getAttribute(o.attributeName))}),component:null,use(r){this.component=new U({props:e,node:r});for(let o of Object.keys(e))this.component.attributeChange(o,null,r.getAttribute(o)??e[o]);this.component.insert(n),this.observer.observe(r,{attributes:!0,attributeOldValue:!0,attributeFilter:Object.keys(e).map(o=>o.toLowerCase())})}},F(t,document.body)}var Vt=H,$t=H;var ht={select:W,run:t=>{k.has(t)||z(t,t.dataset.component??t.dataset.view??t.dataset.page)}};var Q=[ht,st,it,dt,mt,ot,ut,rt,tt,lt];var gt={};function qt(t,e={}){t instanceof URL&&(t=t.host==location.host?t.pathname:t.toString());let n=document.querySelector(`template[name="${t}"]`);if(!n){let r=document.querySelector('head meta[name="template-path"]');return gt[t]??=new Promise(async o=>{n=document.createElement("template"),n.setAttribute("id",t.toString()),n.innerHTML=await fetch(r?.content?.replaceAll("[name]",t.toString())??t).then(s=>s.text()),document.body.append(n),o(n)}),gt[t].then(o=>g(o.content.cloneNode(!0),e))}return g(n.content.cloneNode(!0),e)}function Ft(t,e={}){let n=document.createElement("template");return n.dataset.name="anonymous",n.innerHTML=t,g(n.content.cloneNode(!0),e)}function g(t,e={}){let n=(r,o=new WeakSet)=>{let s=!1;if(!(_(r)||o.has(r))){if(r.nodeName=="#document-fragment"&&S(r,e),r instanceof HTMLElement||r instanceof SVGElement){S(r,e);for(let a of Q)r.matches(a.select)&&a.run(r,e,()=>s=!0);if(s)return;M(r,e)}else if(r instanceof Text&&r.textContent.includes("{{")){let a=r.textContent.split(/{{|}}/g);for(let c=0,i=r,l;cl.data=u),o.add(l),i.after(l),i=l;r.remove()}o.add(r);for(let a of r.childNodes)n(a,o)}};return n(t,new WeakSet),t}var M=(t,e)=>{let n=t.getAttributeNames();for(let r of n){let o=t.getAttribute(r);o?.includes("{{")&&bt(o,e,s=>{s=s.trim().replace(/ +/," "),s==="undefined"||s==="null"?t.removeAttribute(r):t.setAttribute(r,s)})}},bt=(t,e,n)=>{let r=t.match(/{{[^}]+}}/g).map(I),o=t,s=()=>{t=o;for(let a of r)t=t.replace(a.text,m(a.value));return t};for(let a of r){let c=null;if(a.prop[a.prop.length-1]===")"){let i=a.prop.split("("),l=d(e,i[1].substring(0,i[1].length-1).trim()),u=i[0].trim();c=d(e,u),c=c(),c.provide(m(l)),p(l)&&l.subscribe({next:b=>c.resolve(m(b))})}else c=d(e,a.prop);if(c==null&&console.warn(`{{ ${a.prop} }}: No value for this key`,{key:a.prop,value:c}),p(c)){let i=c;for(let l in a.meta)if(w[l]){let u=w[l];i=i.map(b=>u({value:b,key:a.prop,param:a.meta[l],options:a.meta}))}a.value=i,i.subscribe({next:()=>n(s())})}else{let i=c;for(let l in a.meta)if(w[l]){let u=w[l];i=u({value:m(c),key:a.prop,param:a.meta[l],options:a.meta})}a.value=()=>i}}n(s())};var xt=new WeakMap;function Ut(t,e=null){document.dispatchEvent(new CustomEvent(t,{detail:e}))}function Ht(t,e){let n=r=>e(r.detail);xt.set(e,n),document.addEventListener(t,n)}function Qt(t){return new Promise(e=>{let n=r=>e(r.detail);document.addEventListener(t,n,{once:!0})})}function Gt(t,e){document.removeEventListener(t,xt.get(e))}for(let t in j)globalThis[t]=j[t];})();