sigment 1.3.1 → 1.3.3

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.
Files changed (2) hide show
  1. package/dist/index.js +4 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var ue=Object.defineProperty;var a=(e,t)=>ue(e,"name",{value:t,configurable:!0});var A={cleanHtml:he,cleanhtml:!0,setMaxCacheSize:me,maxCacheSize:10,setloadAtRunTime:be,loadAtRunTime:null,setRoute:ye,route:null,setStopPropagation:ge,stopPropagation:!1},w={funcname:[],dataMap:new Map},D=null,v={},N=new Map,k=new Map,re=new Map,O=new Map,fe=null,L=null,U=new Map,de=null,F="",_=typeof window>"u",$=0;_||(F=window.location.href.replace(/^https?:\/\//,"").replace(/\/$/,""));globalThis.__CURRENT_COMPONENT__=null;var R=0,le=new Map;_&&(globalThis.__HANDLER_REGISTRY__||(globalThis.__HANDLER_REGISTRY__={}),globalThis.__HANDLER_ELEMENT_MAP__||(globalThis.__HANDLER_ELEMENT_MAP__=new Map));var g={innerHTMLElements:["div","p","span","h1","h2","h3","h4","h5","h6","a","ul","ol","li","table","tr","td","th","thead","tbody","tfoot","form","label","button","section","article","header","footer","nav","aside","main","figure","figcaption","blockquote","cite","code","pre","em","strong","i","b","u","s","small","mark","time","abbr","q","dl","dt","dd","fieldset","legend","textarea","output","progress","meter","fragment","details","summary","dialog","menu","slot","template"],valueElements:["input","textarea","select","button","option","progress","meter"],srcElements:["img","script","iframe","audio","video","source","track","embed","frame","input"],hrefElements:["a","link","area","base"],voidElements:["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr","frame"]};Object.values(g).flat().forEach(e=>{globalThis[e]=(...t)=>q(e,...t)});var W=new Set(g.valueElements),X=new Set(g.srcElements),Z=new Set(g.hrefElements),z=new Set(g.voidElements);function $e(e,t){v[e]||(v[e]=Ce(t))}a($e,"createGlobalSignal");function Pe(e){return v[e]}a(Pe,"getGlobalSignal");function Q(e,t){w.dataMap.has(e)&&w.dataMap.delete(e),w.dataMap.set(e,t)}a(Q,"addEntry");function H(e){M(H.name);let t=w.dataMap.get(e);if(t)if(typeof t.value.hydrate<"u"&&t.value.hydrate!==null){if(t.value.hydrate){let n=document.getElementById(e);return n||null}}else return t.value;else return null}a(H,"gve");function je(e,t,n){let o;if(t instanceof HTMLElement?o=t.outerHTML:typeof t=="object"?o=JSON.stringify(t):o=t.toString(),o.length>4096){console.error("Cookie size exceeds 4KB limit. Data not stored.");return}document.cookie=e+"="+o+"; max-age="+n+" ; path=/ ;",setTimeout(()=>{document.cookie="testCookie=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;"},n*1e3)}a(je,"setCookie");function Fe(e){let n=`; ${document.cookie}`.split(`; ${e}=`);if(n.length===2){let o=n.pop().split(";").shift();try{let l=JSON.parse(o);return typeof l=="object"&&l!==null&&"nodeType"in l&&l.nodeType===1,l}catch{return o}}return null}a(Fe,"getCookie");function He(e,t){let n;t instanceof HTMLElement?n=t.outerHTML:typeof t=="object"?n=JSON.stringify(t):n=t.toString(),localStorage.setItem(e,n)}a(He,"setStorage");function De(e){let t=localStorage.getItem(e);if(t!==null)try{let n=JSON.parse(t);return typeof n=="object"&&n!==null&&"nodeType"in n&&n.nodeType===1,n}catch{return t}}a(De,"getStorage");function G(e,t=void 0){M(G.name),w.createInstance=G.name;let n="";t===void 0?n=e():n=e(t)}a(G,"createInstance");function ee(e,t){M(ee.name),w.rpc=ee.name;let n={};for(let[o,l]of Object.entries(t))e[o]?n[o]=e[o].apply(null,l):(console.error(`Function ${o} not found!`),n[o]=null);return n}a(ee,"rpc");function te(e,t=!1,n){M(te.name),w.gvec=te.name;let o=Object.keys(e),l=o[0],i=o[1],r=o[2];var p=e[l];p=p.name;var b=e[i];let f=e[i];var c=H(i)===null;if(c||t===!1){var m=""+i;w.dataMap.delete(m),G(b,e[r])}b=H(i);var d=H(l);if(d===null)throw new Error(` source id '${l} is not found in source component `);if(b===null)throw new Error(` target id '${i} is not found in target component `);if(d.replaceWith(b),n!==void 0)for(let s in f){let u=s.toString();if(typeof n=="object"){for(var y in n)if(u===y){var h=n[y];typeof h=="object"?f[s].apply(null,h):f[s].apply(null,[])}}else if(n.indexOf(",">-1)){let E=n.split(",");for(let C=0;C<E.length;C++)u===E[C]&&f[s].apply(null,[])}else u===n&&f[s].apply(null,[])}}a(te,"gvec");async function Ie(e,t={}){let{passRestriction:n=[]}=t,o=window.location.pathname.replace(/^\/|\/$/g,"").toLowerCase(),l=e.replace(/^\/|\/$/g,"").toLowerCase();if(!new RegExp("^"+l.replace(/:[^\/]+/g,"[^/]+")+"$").test(o))return!1;let r=Array.isArray(n)?n:[n];for(let p of r)try{let b=typeof p=="function"?p():p;if(b instanceof Promise){if(!await b)return!1}else if(!b)return!1}catch(b){return console.error("Route check failed:",b),!1}return!0}a(Ie,"Route");function qe(e){return e==null||e===""}a(qe,"IsEmpty");function pe(e){let t=e.startsWith("/")?e:"/"+e;window.history.pushState({},"",t)}a(pe,"Navigate");function me(e){A.maxCacheSize=e}a(me,"setMaxCacheSize");function he(e){A.cleanhtml=e}a(he,"cleanHtml");function ye(e){A.route=e}a(ye,"setRoute");function be(e){A.loadAtRunTime=e}a(be,"setloadAtRunTime");function ge(e){A.stopPropagation=e}a(ge,"setStopPropagation");async function Ne(e,t){let n;t==="/"?n=t:n=t.replace(/\//g,"").toLowerCase();let o=Object.keys(e).find(l=>l.toLowerCase()===n.toLowerCase());if(!o){let l=Object.keys(e).join(", ");throw new Error(`Unknown component: "${t}".
1
+ var fe=Object.defineProperty;var a=(e,t)=>fe(e,"name",{value:t,configurable:!0});var A={cleanHtml:ye,cleanhtml:!0,setMaxCacheSize:he,maxCacheSize:10,setloadAtRunTime:be,loadAtRunTime:null,setRoute:ge,route:null,setStopPropagation:Ee,stopPropagation:!1},w={funcname:[],dataMap:new Map},N=null,v={},I=new Map,k=new Map,U=new Map,M=new Map,de=null,O=null,W=new Map,pe=null,F="",_=typeof window>"u",P=0;_||(F=window.location.href.replace(/^https?:\/\//,"").replace(/\/$/,""));globalThis.__CURRENT_COMPONENT__=null;var $=0,le=new Map;_&&(globalThis.__HANDLER_REGISTRY__||(globalThis.__HANDLER_REGISTRY__={}),globalThis.__HANDLER_ELEMENT_MAP__||(globalThis.__HANDLER_ELEMENT_MAP__=new Map));var b={innerHTMLElements:["div","p","span","h1","h2","h3","h4","h5","h6","a","ul","ol","li","table","tr","td","th","thead","tbody","tfoot","form","label","button","section","article","header","footer","nav","aside","main","figure","figcaption","blockquote","cite","code","pre","em","strong","i","b","u","s","small","mark","time","abbr","q","dl","dt","dd","fieldset","legend","textarea","output","progress","meter","fragment","details","summary","dialog","menu","slot","template"],valueElements:["input","textarea","select","button","option","progress","meter"],srcElements:["img","script","iframe","audio","video","source","track","embed","frame","input"],hrefElements:["a","link","area","base"],voidElements:["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr","frame"]};Object.values(b).flat().forEach(e=>{globalThis[e]=(...t)=>V(e,...t)});var z=new Set(b.valueElements),Z=new Set(b.srcElements),Q=new Set(b.hrefElements),G=new Set(b.voidElements);function Pe(e,t){v[e]||(v[e]=we(t))}a(Pe,"createGlobalSignal");function je(e){return v[e]}a(je,"getGlobalSignal");function ee(e,t){w.dataMap.has(e)&&w.dataMap.delete(e),w.dataMap.set(e,t)}a(ee,"addEntry");function H(e){R(H.name);let t=w.dataMap.get(e);if(t)if(typeof t.value.hydrate<"u"&&t.value.hydrate!==null){if(t.value.hydrate){let n=document.getElementById(e);return n||null}}else return t.value;else return null}a(H,"gve");function Fe(e,t,n){let o;if(t instanceof HTMLElement?o=t.outerHTML:typeof t=="object"?o=JSON.stringify(t):o=t.toString(),o.length>4096){console.error("Cookie size exceeds 4KB limit. Data not stored.");return}document.cookie=e+"="+o+"; max-age="+n+" ; path=/ ;",setTimeout(()=>{document.cookie="testCookie=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;"},n*1e3)}a(Fe,"setCookie");function He(e){let n=`; ${document.cookie}`.split(`; ${e}=`);if(n.length===2){let o=n.pop().split(";").shift();try{let l=JSON.parse(o);return typeof l=="object"&&l!==null&&"nodeType"in l&&l.nodeType===1,l}catch{return o}}return null}a(He,"getCookie");function Ne(e,t){let n;t instanceof HTMLElement?n=t.outerHTML:typeof t=="object"?n=JSON.stringify(t):n=t.toString(),localStorage.setItem(e,n)}a(Ne,"setStorage");function De(e){let t=localStorage.getItem(e);if(t!==null)try{let n=JSON.parse(t);return typeof n=="object"&&n!==null&&"nodeType"in n&&n.nodeType===1,n}catch{return t}}a(De,"getStorage");function J(e,t=void 0){R(J.name),w.createInstance=J.name;let n="";t===void 0?n=e():n=e(t)}a(J,"createInstance");function te(e,t){R(te.name),w.rpc=te.name;let n={};for(let[o,l]of Object.entries(t))e[o]?n[o]=e[o].apply(null,l):(console.error(`Function ${o} not found!`),n[o]=null);return n}a(te,"rpc");function ne(e,t=!1,n){R(ne.name),w.gvec=ne.name;let o=Object.keys(e),l=o[0],i=o[1],u=o[2];var r=e[l];r=r.name;var g=e[i];let d=e[i];var f=H(i)===null;if(f||t===!1){var m=""+i;w.dataMap.delete(m),J(g,e[u])}g=H(i);var p=H(l);if(p===null)throw new Error(` source id '${l} is not found in source component `);if(g===null)throw new Error(` target id '${i} is not found in target component `);if(p.replaceWith(g),n!==void 0)for(let c in d){let s=c.toString();if(typeof n=="object"){for(var y in n)if(s===y){var h=n[y];typeof h=="object"?d[c].apply(null,h):d[c].apply(null,[])}}else if(n.indexOf(",">-1)){let E=n.split(",");for(let C=0;C<E.length;C++)s===E[C]&&d[c].apply(null,[])}else s===n&&d[c].apply(null,[])}}a(ne,"gvec");async function Ve(e,t={}){let{passRestriction:n=[]}=t,o=window.location.pathname.replace(/^\/|\/$/g,"").toLowerCase(),l=e.replace(/^\/|\/$/g,"").toLowerCase();if(!new RegExp("^"+l.replace(/:[^\/]+/g,"[^/]+")+"$").test(o))return!1;let u=Array.isArray(n)?n:[n];for(let r of u)try{let g=typeof r=="function"?r():r;if(g instanceof Promise){if(!await g)return!1}else if(!g)return!1}catch(g){return console.error("Route check failed:",g),!1}return!0}a(Ve,"Route");function Ie(e){return e==null||e===""}a(Ie,"IsEmpty");function me(e){let t=e.startsWith("/")?e:"/"+e;window.history.pushState({},"",t)}a(me,"Navigate");function he(e){A.maxCacheSize=e}a(he,"setMaxCacheSize");function ye(e){A.cleanhtml=e}a(ye,"cleanHtml");function ge(e){A.route=e}a(ge,"setRoute");function be(e){A.loadAtRunTime=e}a(be,"setloadAtRunTime");function Ee(e){A.stopPropagation=e}a(Ee,"setStopPropagation");async function qe(e,t){let n;t==="/"?n=t:n=t.replace(/\//g,"").toLowerCase();let o=Object.keys(e).find(l=>l.toLowerCase()===n.toLowerCase());if(!o){let l=Object.keys(e).join(", ");throw new Error(`Unknown component: "${t}".
2
2
  Available components: ${l}
3
3
 
4
4
  To add this component:
@@ -6,6 +6,6 @@ To add this component:
6
6
  const loadAsyncComponents = {
7
7
  ...existingComponents,
8
8
  "${t}": () => import('./${t}.js')
9
- };`)}if(k.has(o))return k.get(o);try{let i=(await e[o]()).default;return k.set(o,i),i}catch(l){throw new Error(`Failed to load component "${o}": ${l.message}`)}}a(Ne,"loadFunc");function Ee(e){let t=null,n=-1;if(typeof e=="string")return{partName:e,index:n};let o=(e==null?void 0:e.target)instanceof Element?e.target.closest("[data-component]"):null;if(o){let l=o.closest("[data-part]");if(t=l==null?void 0:l.getAttribute("data-part"),l){let i=o.getAttribute("data-component");i&&l.querySelectorAll(`[data-component="${i}"]`).forEach((p,b)=>{p===o&&(n=b)})}}return{partName:t,index:n}}a(Ee,"getTargetPartAndIndex");async function Ve(e,t,n,o,l=null){if(_)return;let i=null,{partName:r,index:p}=Ee(l);r&&(i=r);let b=window.location.host+"/"+e;if(i===null){if(F===b)return;F=b}let f;typeof t=="boolean"||typeof t=="string"?(n=t,t=A.route):t===void 0&&(t=A.route,n=!1),pe(e);let{componentKey:c,params:m}=ie(t);(c===void 0||c==="")&&console.warn(`current path "${e}" not match in route map file , check if param path is match`);let d=Object.keys(t);if(typeof n=="string")c=n,f=!!o;else if(typeof n=="boolean"){if(d.length===1)c=d[0];else if(d.includes(c))c=c;else throw new Error(`Ambiguous component map: multiple components exist and no matching key for path '${e}' found. Provide component key explicitly.`);f=n}else{if(d.length===1)c=d[0];else if(d.includes(c))c=c;else throw new Error(`Ambiguous component map: multiple components exist and no matching key for path '${e}' found. Provide component key explicitly.`);f=!1}let y=await Ae(t,c,m,null,!1);i&&(e=e+i+p);let h=U.get(e);if((!h||!f)&&(typeof y=="function"?(R=le.get(y.name),$=0,Array.isArray(m)?h=y(...m):typeof m=="object"&&m!==null?h=y(m):h=y(),U.set(e,h)):h=y),L&&L.isConnected){var s=L.contains(h);s||L.replaceWith(h)}else{typeof rvs_map_sigment<"u"&&rvs_map_sigment!==null&&(c=I(rvs_map_sigment,c));let u=document.querySelectorAll('[data-part="'+i+'"] [data-component="'+c+'"]');h.setAttribute("data-component",c),u&&u.length===1?u[0].replaceWith(h):u&&u.length>1?u[p].replaceWith(h):document.body.replaceChildren(h)}i===null&&(L=h,fe=e),F=b}a(Ve,"NavigateTo");function Ue(e=de,t){let n=typeof e=="string"?document.getElementById(e):e;n.contains(t)||n.replaceChildren(t)}a(Ue,"updateNodeIfNeeded");function We(e){if(e){let t=e.toLowerCase(),n=!1;for(let o of k.keys())o.toLowerCase()===t&&(k.delete(o),n=!0);return n}else return k.clear(),!0}a(We,"clearComponentCache");function ie(e){if(_)return;let t=window.location.pathname.replace(/\/{2,}/g,"/");t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1));let n=t.replace(/^\//,"").split("/").filter(Boolean);n[0]===void 0&&(n[0]="/");let o={},l=null,i=null,r=0;function p(f){return f.length>1&&f.endsWith("/")&&(f=f.slice(0,-1)),f.replace(/^\//,"").split("/").map(c=>{let m=c.startsWith(":"),d=m&&c.endsWith("?"),y=m?c.slice(1).replace("?",""):c;return y===""&&(y="/"),{isParam:m,isOptional:d,name:y}})}a(p,"parseRouteSegments");for(let[f,c]of Object.entries(e)){let m=c.path||`/${f}`,d=p(m),y=!0;for(let h=0;h<d.length;h++){let s=d[h],u=n[h];if(s.isParam){if(!u&&!s.isOptional){y=!1;break}}else if(s.name!==u){y=!1;break}}if(n.length<d.length){for(let h=n.length;h<d.length;h++)if(!d[h].isOptional){y=!1;break}}if(y){l=f,i=c,r=d.length,d.forEach((h,s)=>{if(h.isParam){let u=n[s];u!==void 0&&u!==""&&(o[h.name]=u)}});break}}return l||(l="",i=e[l]),i!=null&&i.urlParam&&i.urlParam.split("/").map(c=>c.replace(/[{}]/g,"")).forEach((c,m)=>{let d=n[r+m];d!==void 0&&d!==""&&(o[c]=d)}),new URL(window.location.href).searchParams.forEach((f,c)=>{o[c]=f}),{componentKey:l,componentName:l,params:o}}a(ie,"parsePath");function j(e){return new DOMParser().parseFromString(e,"text/html").body.firstChild}a(j,"parseHTML");async function Ae(e,t,n=null,o=null,l=!0){if(_)return;let i=e[t.toLowerCase()];if(i||(typeof e.fallback=="string"?i=e[e.fallback]:i=e.fallback),!i)return j("<h1>404 - Component not found</h1>");let{loader:r,guard:p,cacheExpiration:b=null,...f}=i;if(o===null&&typeof i.logic=="function"&&(o=i.logic),typeof p=="function"&&!await p(n))return j("<h1>403 - Forbidden</h1><p>You do not have access to this page.</p>");for(let c in f){let m=f[c];if(typeof m=="function")try{await m()}catch(d){console.error(d)}}try{let c=Date.now(),m=k.get(t);m&&b!==null&&c-m.cachedAt>b&&(k.delete(t),m=null);let d;if(m)d=m.component,k.set(t,{component:d,cachedAt:c});else{if(d=(await r()).default,k.size>=A.maxCacheSize){let u=k.keys().next().value;k.delete(u)}k.set(t,{component:d,cachedAt:c})}if(typeof d!="function")return j("<h1>Invalid component</h1>");if(!l)return d;let y;Array.isArray(n)?y=d(...n):typeof n=="object"&&n!==null?y=d(n):y=d();let h="/";try{h=window.location.pathname.slice(1)+window.location.hash,h=h.endsWith("/")&&h!=="/"?h.slice(0,-1):h,h===""&&(h="/")}catch{h=t}return U.set(h,y),L=y,y}catch(c){return console.error(c),j("<h1>Error loading component</h1>")}}a(Ae,"loadRunFunc");function J(e=""){var l,i;if(_)return"";M(J.name),w.buildRoadMap=J.name;var t="";let n=(l=new Error().stack)==null?void 0:l.toString();navigator.userAgent.toLowerCase().indexOf("firefox")>0?n=n.split("@"):n=n.split(`
10
- `);for(let r=0;r<n.length;r++){var o="";if(navigator.userAgent.indexOf("Firefox")>0){let p=n[r].lastIndexOf(`
11
- `);if(p===-1)continue;o=n[r].slice(p+1),o===""?(p=n[r].lastIndexOf("/")+1,p>-1&&(o=n[r].substr(p),o=o.substr(0,o.indexOf(".")))):o.indexOf("/")>-1&&(o=o.substr(0,o.indexOf("/")))}else o=(i=n[r])==null?void 0:i.trim().split(" ")[1];if(!w.funcname.includes(o)&&!(o===void 0||o==="")&&!(o.indexOf("http://")>-1||o.indexOf("https://")>-1)){if(w.gvec!==void 0&&o.indexOf(w.gvec)>-1)break;t.indexOf("|"+o)>-1||(t+="|"+o.replace(".","|"))}}return e+t}a(J,"buildRoadMap");function M(e){!w.funcname.includes(e)&&w.funcname.push(e)}a(M,"setFuncName");function Ce(e){let t=e,n=new Set;function o(){return D&&n.add(D),t}a(o,"get");function l(i,r=!1){(r||t!==i)&&(t=i,n.forEach(p=>p()))}return a(l,"set"),[o,l]}a(Ce,"createSignal");function K(e){function t(){D=t,e(),D=null}a(t,"wrapped"),t()}a(K,"createEffect");function we(e){e=e.toLowerCase(),g.innerHTMLElements.includes(e)||(g.innerHTMLElements.push(e),globalThis[e]=(...t)=>q(e,...t))}a(we,"createTypeElement");function se(e){return e.replace(/-+/g,"-").replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}a(se,"dashToCamel");function ze(e,t=null){ae(e,t)}a(ze,"createSigment");function Ge(e,t=null){ae(e,t)}a(Ge,"addSigment");function Je(e,...t){if(we(e),t.length!==0)return globalThis[e](...t)}a(Je,"createElement");function Te(e){let t=document.createTextNode("");return K(()=>{if(typeof v!="object"||v===null){t.nodeValue=e;return}let n=e.replace(/{{(.*?)}}/g,(o,l)=>{let i=l.trim();if(v.hasOwnProperty(i)){let r=v[i];if(r&&typeof r[0]=="function")return r[0]()??""}return""});t.nodeValue=n}),t}a(Te,"interpolateReactiveText");function Ke(e,t=5e3,n={}){let o=JSON.stringify([e,n,t]);if(!N.has(o)){let l=_e(async()=>{let i=await fetch(e,n);if(!i.ok)throw new Error(`Fetch failed: ${i.status}`);return i.json()},t);N.set(o,l)}return N.get(o)()}a(Ke,"fetchCache");function B(e){if(Array.isArray(e))return e.map(B);if(e&&typeof e=="object"){let t={};return Object.keys(e).sort().forEach(n=>{t[n]=B(e[n])}),t}return e}a(B,"sortObjectDeep");function ke(e){if(e&&typeof e=="object"&&!Array.isArray(e)){let t={};return Object.keys(e).sort().forEach(n=>{t[n]=e[n]}),t}return e}a(ke,"sortObjectShallow");function _e(e,t=null,n={}){let o=new Map,l=a((...i)=>{let{deepSort:r}=n,p;r===!0?p=i.map(y=>y&&typeof y=="object"?B(y):y):r===!1?p=i.map(y=>y&&typeof y=="object"?ke(y):y):p=i;let b=JSON.stringify(p),f=Date.now();b.length===2&&(b=e.name);let m=o.get(b);if(m&&(t===null||f-m.timestamp<t))return m.value;let d=e(...i);return o.set(b,{value:d,timestamp:f}),d instanceof Promise&&d.catch(()=>o.delete(b)),d},"wrapped");return l.clear=()=>o.clear(),l}a(_e,"memoizeFunc");function Se(e,t,n){let l=document.querySelectorAll("[data-component]")[n];return!l||l.getAttribute("data-component")!==e?null:[l,...l.querySelectorAll("*")][t]||null}a(Se,"getSsrElementByIndex");function V(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return e.replace(/[&<>"']/g,n=>t[n])}a(V,"escapeHtml");function q(e,...t){var h;let n={},o=[];if(t[0]&&typeof t[0]=="object"&&!Array.isArray(t[0])&&t[0]!==null&&!(t[0]instanceof String)&&(_||!(t[0]instanceof Node))?(n=t[0],o=t.slice(1)):o=t,_&&typeof document>"u"){let s=globalThis.__CURRENT_COMPONENT__;globalThis.__HANDLER_REGISTRY__||(globalThis.__HANDLER_REGISTRY__={}),(h=globalThis.__HANDLER_REGISTRY__)[s]||(h[s]=[]);let u=[];for(let[T,S]of Object.entries(n))if(T==="style"&&typeof S=="object"){let P=Object.entries(S).map(([x,ce])=>`${x.replace(/([A-Z])/g,"-$1").toLowerCase()}:${ce}`).join(";");u.push(` style="${V(P)}"`)}else T!=="className"&&T!=="class"&&!T.startsWith("on")&&u.push(` ${T}="${V(String(S))}"`);(n.className||n.class)&&u.push(` class="${V(n.className||n.class)}"`);let E=o.map(T=>typeof T=="function"?T():T??"").join("");return["input","img","br","hr","meta","link"].includes(e)?`<${e}${u.join("")} />`:e==="fragment"?E:`<${e}${u.join("")}>${E}</${e}>`}M(q.name);var l="";l=J();var i=l.split("|");if(i.includes(w.rpc))return;let r=null,p=e.toLowerCase()==="fragment";if(p)r=document.createDocumentFragment();else{var b;let s=re.get(e);s&&(b=s.tagName,s.nativeTag!==null&&(b=s.nativeTag)),b!==void 0&&(e=b),r=document.createElement(e)}if(globalThis.__CURRENT_COMPONENT__){$++;let s=$;r.dataIndex=s,r.realtedComponent=globalThis.__CURRENT_COMPONENT__,r.cmpNbr=R}let f=[];for(let[s,u]of Object.entries(n))if(s.startsWith("on")&&typeof u=="function"){let E=s.slice(2).toLowerCase();f.push({type:E,val:u})}f.length&&(r._handlers=f);let c=z.has(e),m=W.has(se(e)),d=e==="input"||e==="option",y=e==="option";if(!p)for(let s in n){let u=n[s];if(s.startsWith("on")&&typeof u=="function"){let E=s.slice(2).toLowerCase();r.addEventListener(E,C=>{A.stopPropagation&&C.stopPropagation(),u(C)})}else typeof u=="function"&&s!=="children"?K(()=>{let E=u();E==null||E===!1?(r.removeAttribute(s),s==="value"&&m&&(r.value="",A.cleanhtml||r.removeAttribute("value")),s==="checked"&&d&&(r.checked=!1,A.cleanhtml||r.removeAttribute("checked")),s==="selected"&&y&&(r.selected=!1,A.cleanhtml||r.removeAttribute("selected")),s==="id"&&(r.iid="",A.cleanhtml||r.removeAttribute("id"))):s==="id"?(r.iid=E,A.cleanhtml?r.removeAttribute("id"):r.setAttribute("id",E),Q(E,{name:E,caller:E+l,value:r})):s==="value"&&m?(r.value=E,A.cleanhtml?r.removeAttribute("value"):r.setAttribute("value",E)):s==="checked"&&d?(r.checked=E,A.cleanhtml?r.removeAttribute("checked"):E?r.setAttribute("checked",""):r.removeAttribute("checked")):s==="selected"&&y?(r.selected=E,A.cleanhtml?r.removeAttribute("selected"):E?r.setAttribute("selected",""):r.removeAttribute("selected")):r.setAttribute(s,E)}):u!=null&&u!==!1&&(s==="id"?(r.iid=u,A.cleanhtml?r.removeAttribute("id"):r.setAttribute("id",u),Q(u,{name:u,caller:u+l,value:r})):s==="value"&&m?(r.value=u,A.cleanhtml?r.removeAttribute("value"):r.setAttribute("value",u)):s==="checked"&&d?(r.checked=u,A.cleanhtml?r.removeAttribute("checked"):r.setAttribute("checked","")):s==="selected"&&y?(r.selected=u,A.cleanhtml?r.removeAttribute("selected"):r.setAttribute("selected","")):r.setAttribute(s,u))}return c?o.length===1&&(typeof o[0]=="string"||typeof o[0]=="number")?m&&(r.value=o[0],A.cleanhtml?r.removeAttribute("value"):r.setAttribute("value",o[0])):o.length>0&&console.warn(`Void element <${e}> should not have children.`):o.flat().forEach(s=>{if(typeof s=="function"){let u=document.createTextNode("");r.appendChild(u),K(()=>{let E=s();if(E instanceof Node){let C=u.parentNode;if(!C)return;C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.replaceChildren(E):C.replaceChild(E,u),u=E}else{let C=E==null?"":String(E);if(u.nodeValue!==C){let T=u.parentNode;if(T.realtedComponent){let S=null,P=Se(T.realtedComponent,T.dataset.index,T.cmpNbr);if(P&&(S=P),S!==null){let x=S;x=S.childNodes[0].firstChild,x===null&&(x=S.firstChild),x.nodeType===Node.TEXT_NODE&&(x.nodeValue=C)}}else u.nodeValue=C}}})}else if(typeof s=="string"&&s.includes("{{")&&!s.includes("function"))r.appendChild(Te(s));else if(typeof s=="string"||typeof s=="number"){if(s.includes("function get(")||s.includes("function (")||s.includes("[native code]"))throw new Error("Detected reactive getter function used inside a template string. Use a function instead like: div(() => `Your text is: ${someState()}`)");r.appendChild(document.createTextNode(s))}else(s instanceof DocumentFragment||s instanceof Node)&&r.appendChild(s)}),r}a(q,"h");function xe(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/-+/g,"-").toLowerCase()}a(xe,"camelToDash");function ae(e,t=null){if(g.innerHTMLElements.includes(e)||g.valueElements.includes(e)||g.srcElements.includes(e)||g.hrefElements.includes(e)||g.voidElements.includes(e))return;let o=/[A-Z]/.test(e)?xe(e):e.toLowerCase();o.includes("-")||(o="s-"+o),e.includes("-")&&(o=e,e=se(e)),re.set(e,{tagName:o,nativeTag:t}),!g.innerHTMLElements.includes(e)&&t===null?g.innerHTMLElements.push(e):!g.innerHTMLElements.includes(e)&&t!==null&&(g.innerHTMLElements.includes(t)||g.innerHTMLElements.push(e)),!g.valueElements.includes(e)&&t===null?(g.valueElements.push(e),W.add(e)):!g.valueElements.includes(e)&&t!==null&&(g.valueElements.includes(t)||(g.valueElements.push(e),W.add(e))),!g.srcElements.includes(e)&&t===null?(g.srcElements.push(e),X.add(e)):!g.srcElements.includes(e)&&t!==null&&(g.srcElements.includes(t)||(g.srcElements.push(e),X.add(e))),!g.hrefElements.includes(e)&&t===null?(g.hrefElements.push(e),Z.add(e)):!g.hrefElements.includes(e)&&t!==null&&(g.hrefElements.includes(t)||(g.hrefElements.push(e),Z.add(e))),!g.voidElements.includes(e)&&t===null?(g.voidElements.push(e),z.add(e)):!g.voidElements.includes(e)&&t!==null&&(g.voidElements.includes(t)||(g.voidElements.push(e),z.add(e))),globalThis[e]=(...l)=>q(e,...l)}a(ae,"defineElement");function ve(e){_||requestAnimationFrame(()=>{requestAnimationFrame(e)})}a(ve,"onPaint");function Be(e){if(_)return;let t=!1;ve(()=>{t||(t=!0,e())})}a(Be,"paintFinish");function ne(e){let t={};for(let n of e.attributes)if(n.name.startsWith("data-")&&n.name!=="data-component"){let o=n.name.slice(5);try{t[o]=JSON.parse(n.value)}catch{t[o]=n.value}}return t}a(ne,"getPropsFromDataAttributes");async function Le(){let e=document.querySelector("layout[data-layout]");if(!e)return!1;let t=e.getAttribute("data-layout");if(!t)return!1;try{let n=await fetch(t);if(!n.ok)throw new Error("Failed to load layout");let o=await n.text(),i=new DOMParser().parseFromString(o,"text/html"),r=document.querySelector("description[data-description]");if(r){let f=i.querySelector('meta[name="description"]');f||(f=i.createElement("meta"),f.name="description",i.head.appendChild(f)),f.content=r.getAttribute("data-description")}let p=document.querySelector("keywords[data-keywords]");if(p){let f=i.querySelector('meta[name="keywords"]');f||(f=i.createElement("meta"),f.name="keywords",i.head.appendChild(f)),f.content=p.getAttribute("data-keywords")}return document.querySelectorAll("[data-part]").forEach(f=>{let c=f.getAttribute("data-part"),m=i.querySelector(`[data-part="${c}"]`);m&&(m.innerHTML="",[...f.childNodes].forEach(d=>{m.appendChild(d.cloneNode(!0))}))}),document.documentElement.innerHTML=i.documentElement.innerHTML,!0}catch(n){return console.error("Failed to inject layout:",n),!1}}a(Le,"injectLayout");function I(e,t){if(!t)return;let n=t.trim();if(e[n])return e[n];let o=n[0].toUpperCase()+n.slice(1).toLowerCase();if(e[o])return e[o];let l=n.toUpperCase();if(e[l])return e[l];let i=n.toLowerCase(),r=Object.entries(e).find(([p,b])=>p.toLowerCase()===i);if(r)return r[1]}a(I,"lookupComponent");async function oe(e){var f;let t=e||A.route,n=await Le(),{componentKey:o,componentName:l,params:i}=ie(t),r=new Set,p=l,b=document.querySelectorAll("[data-component]");for(let c of b){let m=c.getAttribute("data-component"),d=m==null?void 0:m.toLowerCase();if(typeof rvs_map_sigment<"u"&&rvs_map_sigment!==null?p=I(rvs_map_sigment,m):p=d,!p||r.has(p))continue;let y=I(t,p);try{c.hasChildNodes()&&(globalThis.__CURRENT_COMPONENT__=m);let h=y?await Oe(y):await Me(A.loadAtRunTime,p),s=y?{...i,...ne(c)}:ne(c),u=h.default(s);u.funcName=l.toLowerCase();let E=(f=c.closest("[data-part]"))==null?void 0:f.getAttribute("data-part");u.datapart=E,u.setAttribute("data-component",m),u.hydrate=!0,c.cmpNbr=R,Y(c,u),le.set(p,R),R++,$=0}catch(h){console.warn(`Component "${d}" failed to load`,h)}}}a(oe,"hydrateComponent");async function Oe(e){if(!O.has(e)){let t=await e.loader();O.set(e,t)}return O.get(e)}a(Oe,"loadModule");async function Me(e,t){let n=I(e,t);if(n){if(O.has(n))return O.get(n);try{let o=await n();return O.set(n,o),o}catch(o){console.error(`Component "${t}" failed to load`,o)}}}a(Me,"loadModuleFromFile");function Ye(e,t){if(e===void 0){oe();return}if(typeof e=="object"&&t===void 0){oe(e);return}let n=typeof e=="string"?document.getElementById(e):e;if(!n)throw new Error("Mount target not found: "+e);n.hasChildNodes()?Y(n,t):n.replaceChildren(t)}a(Ye,"mount");function Y(e,t){if(e.hasChildNodes()){let l=[t,...t.querySelectorAll("*")],i=[e,...e.querySelectorAll("*")];l.forEach((r,p)=>{let b=i[p];if(b){r.dataset.index=p;for(let f of r.getAttributeNames()){let c=r.getAttribute(f);if(b.getAttribute(f)!==c){if(f==="data-component"||f==="data-index")continue;b.setAttribute(f,c)}}r.nodeType===Node.TEXT_NODE&&r.nodeValue!==b.nodeValue&&(b.nodeValue=r.nodeValue),r._handlers&&r._handlers.forEach(({type:f,val:c})=>{b.addEventListener(f,m=>{A.stopPropagation&&m.stopPropagation(),c(m)})})}}),globalThis.__CURRENT_COMPONENT__=null,$=0;return}if(!t||e.nodeName!==t.nodeName){e.replaceWith(t);return}if(t.nodeType===Node.TEXT_NODE){e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue);return}if(e.nodeType===Node.ELEMENT_NODE&&t.nodeType===Node.ELEMENT_NODE){for(let l of Array.from(t.attributes))e.setAttribute(l.name,l.value);if(t._handlers)for(let{type:l,val:i}of t._handlers)e.addEventListener(l,r=>{A.stopPropagation&&r.stopPropagation(),i(r)});e instanceof HTMLInputElement?(e.value!==t.value&&(e.value=t.value),["checkbox","radio"].includes(e.type)&&e.checked!==t.checked&&(e.checked=t.checked)):e instanceof HTMLTextAreaElement?e.value!==t.value&&(e.value=t.value):e instanceof HTMLSelectElement&&e.value!==t.value&&(e.value=t.value);for(let l of Array.from(e.attributes))t.hasAttribute(l.name)||e.removeAttribute(l.name)}let n=Array.from(t.childNodes),o=Array.from(e.childNodes);for(let l=0;l<Math.max(n.length,o.length);l++){let i=o[l],r=n[l];i&&r?Y(i,r):r?e.appendChild(r):i&&e.removeChild(i)}}a(Y,"hydrate");export{qe as IsEmpty,A as MyApp,pe as Navigate,Ve as NavigateTo,Ie as Route,Ge as addSigment,We as clearComponentCache,K as createEffect,Je as createElement,$e as createGlobalSignal,ze as createSigment,Ce as createSignal,Ke as fetchCache,Fe as getCookie,Pe as getGlobalSignal,De as getStorage,H as getVirtualElementById,$e as globalSignal,H as gve,te as gvec,q as h,oe as hydrateComponent,Ne as loadFunc,Ae as loadRunFunc,_e as memoizeFunc,Ye as mount,ve as onPaint,Be as paintFinish,ie as parsePath,ee as rpc,je as setCookie,He as setStorage,Ce as signal,Ue as updateNodeIfNeeded,Pe as useGlobalSignal};
9
+ };`)}if(k.has(o))return k.get(o);try{let i=(await e[o]()).default;return k.set(o,i),i}catch(l){throw new Error(`Failed to load component "${o}": ${l.message}`)}}a(qe,"loadFunc");function Ae(e){let t=null,n=-1;if(typeof e=="string")return{partName:e,index:n};let o=(e==null?void 0:e.target)instanceof Element?e.target.closest("[data-component]"):null;if(o){let l=o.closest("[data-part]");if(t=l==null?void 0:l.getAttribute("data-part"),l){let i=o.getAttribute("data-component");i&&l.querySelectorAll(`[data-component="${i}"]`).forEach((r,g)=>{r===o&&(n=g)})}}return{partName:t,index:n}}a(Ae,"getTargetPartAndIndex");async function Ue(e,t,n,o,l=null){if(_)return;let i=null,{partName:u,index:r}=Ae(l);u&&(i=u);let g=window.location.host+"/"+e;if(i===null){if(F===g)return;F=g}let d;typeof t=="boolean"||typeof t=="string"?(n=t,t=A.route):t===void 0&&(t=A.route,n=!1),me(e);let{componentKey:f,params:m}=ie(t);(f===void 0||f==="")&&console.warn(`current path "${e}" not match in route map file , check if param path is match`);let p=Object.keys(t);if(typeof n=="string")f=n,d=!!o;else if(typeof n=="boolean"){if(p.length===1)f=p[0];else if(p.includes(f))f=f;else throw new Error(`Ambiguous component map: multiple components exist and no matching key for path '${e}' found. Provide component key explicitly.`);d=n}else{if(p.length===1)f=p[0];else if(p.includes(f))f=f;else throw new Error(`Ambiguous component map: multiple components exist and no matching key for path '${e}' found. Provide component key explicitly.`);d=!1}let y=await Ce(t,f,m,null,!1);i&&(e=e+i+r);let h=W.get(e);if((!h||!d)&&(typeof y=="function"?($=le.get(y.name),P=0,Array.isArray(m)?h=y(...m):typeof m=="object"&&m!==null?h=y(m):h=y(),W.set(e,h)):h=y),O&&O.isConnected){var c=O.contains(h);c||O.replaceWith(h)}else{typeof rvs_map_sigment<"u"&&rvs_map_sigment!==null&&(f=D(rvs_map_sigment,f));let s=document.querySelectorAll('[data-part="'+i+'"] [data-component="'+f+'"]');h.setAttribute("data-component",f),s&&s.length===1?s[0].replaceWith(h):s&&s.length>1?s[r].replaceWith(h):document.body.replaceChildren(h)}i===null&&(O=h,de=e),F=g}a(Ue,"NavigateTo");function We(e=pe,t){let n=typeof e=="string"?document.getElementById(e):e;n.contains(t)||n.replaceChildren(t)}a(We,"updateNodeIfNeeded");function ze(e){if(e){let t=e.toLowerCase(),n=!1;for(let o of k.keys())o.toLowerCase()===t&&(k.delete(o),n=!0);return n}else return k.clear(),!0}a(ze,"clearComponentCache");function ie(e){if(_)return;let t=window.location.pathname.replace(/\/{2,}/g,"/");t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1));let n=t.replace(/^\//,"").split("/").filter(Boolean);n[0]===void 0&&(n[0]="/");let o={},l=null,i=null,u=0;function r(d){return d.length>1&&d.endsWith("/")&&(d=d.slice(0,-1)),d.replace(/^\//,"").split("/").map(f=>{let m=f.startsWith(":"),p=m&&f.endsWith("?"),y=m?f.slice(1).replace("?",""):f;return y===""&&(y="/"),{isParam:m,isOptional:p,name:y}})}a(r,"parseRouteSegments");for(let[d,f]of Object.entries(e)){let m=f.path||`/${d}`,p=r(m),y=!0;for(let h=0;h<p.length;h++){let c=p[h],s=n[h];if(c.isParam){if(!s&&!c.isOptional){y=!1;break}}else if(c.name!==s){y=!1;break}}if(n.length<p.length){for(let h=n.length;h<p.length;h++)if(!p[h].isOptional){y=!1;break}}if(y){l=d,i=f,u=p.length,p.forEach((h,c)=>{if(h.isParam){let s=n[c];s!==void 0&&s!==""&&(o[h.name]=s)}});break}}return l||(l="",i=e[l]),i!=null&&i.urlParam&&i.urlParam.split("/").map(f=>f.replace(/[{}]/g,"")).forEach((f,m)=>{let p=n[u+m];p!==void 0&&p!==""&&(o[f]=p)}),new URL(window.location.href).searchParams.forEach((d,f)=>{o[f]=d}),{componentKey:l,componentName:l,params:o}}a(ie,"parsePath");function j(e){return new DOMParser().parseFromString(e,"text/html").body.firstChild}a(j,"parseHTML");async function Ce(e,t,n=null,o=null,l=!0){if(_)return;let i=e[t.toLowerCase()];if(i||(typeof e.fallback=="string"?i=e[e.fallback]:i=e.fallback),!i)return j("<h1>404 - Component not found</h1>");let{loader:u,guard:r,cacheExpiration:g=null,...d}=i;if(o===null&&typeof i.logic=="function"&&(o=i.logic),typeof r=="function"&&!await r(n))return j("<h1>403 - Forbidden</h1><p>You do not have access to this page.</p>");for(let f in d){let m=d[f];if(typeof m=="function")try{await m()}catch(p){console.error(p)}}try{let f=Date.now(),m=k.get(t);m&&g!==null&&f-m.cachedAt>g&&(k.delete(t),m=null);let p;if(m)p=m.component,k.set(t,{component:p,cachedAt:f});else{if(p=(await u()).default,k.size>=A.maxCacheSize){let s=k.keys().next().value;k.delete(s)}k.set(t,{component:p,cachedAt:f})}if(typeof p!="function")return j("<h1>Invalid component</h1>");if(!l)return p;let y;Array.isArray(n)?y=p(...n):typeof n=="object"&&n!==null?y=p(n):y=p();let h="/";try{h=window.location.pathname.slice(1)+window.location.hash,h=h.endsWith("/")&&h!=="/"?h.slice(0,-1):h,h===""&&(h="/")}catch{h=t}return W.set(h,y),O=y,y}catch(f){return console.error(f),j("<h1>Error loading component</h1>")}}a(Ce,"loadRunFunc");function K(e=""){var l,i;if(_)return"";R(K.name),w.buildRoadMap=K.name;var t="";let n=(l=new Error().stack)==null?void 0:l.toString();navigator.userAgent.toLowerCase().indexOf("firefox")>0?n=n.split("@"):n=n.split(`
10
+ `);for(let u=0;u<n.length;u++){var o="";if(navigator.userAgent.indexOf("Firefox")>0){let r=n[u].lastIndexOf(`
11
+ `);if(r===-1)continue;o=n[u].slice(r+1),o===""?(r=n[u].lastIndexOf("/")+1,r>-1&&(o=n[u].substr(r),o=o.substr(0,o.indexOf(".")))):o.indexOf("/")>-1&&(o=o.substr(0,o.indexOf("/")))}else o=(i=n[u])==null?void 0:i.trim().split(" ")[1];if(!w.funcname.includes(o)&&!(o===void 0||o==="")&&!(o.indexOf("http://")>-1||o.indexOf("https://")>-1)){if(w.gvec!==void 0&&o.indexOf(w.gvec)>-1)break;t.indexOf("|"+o)>-1||(t+="|"+o.replace(".","|"))}}return e+t}a(K,"buildRoadMap");function R(e){!w.funcname.includes(e)&&w.funcname.push(e)}a(R,"setFuncName");function we(e){let t=e,n=new Set;function o(){return N&&n.add(N),t}a(o,"get");function l(i,u=!1){(u||t!==i)&&(t=i,n.forEach(r=>r()))}return a(l,"set"),[o,l]}a(we,"createSignal");function B(e){function t(){N=t,e(),N=null}a(t,"wrapped"),t()}a(B,"createEffect");function Te(e){e=e.toLowerCase(),b.innerHTMLElements.includes(e)||(b.innerHTMLElements.push(e),globalThis[e]=(...t)=>V(e,...t))}a(Te,"createTypeElement");function se(e){return e.replace(/-+/g,"-").replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}a(se,"dashToCamel");function Ge(e,t=null){ae(e,t)}a(Ge,"createSigment");function Je(e,t=null){ae(e,t)}a(Je,"addSigment");function Ke(e,...t){if(Te(e),t.length!==0)return globalThis[e](...t)}a(Ke,"createElement");function ke(e){let t=document.createTextNode("");return B(()=>{if(typeof v!="object"||v===null){t.nodeValue=e;return}let n=e.replace(/{{(.*?)}}/g,(o,l)=>{let i=l.trim();if(v.hasOwnProperty(i)){let u=v[i];if(u&&typeof u[0]=="function")return u[0]()??""}return""});t.nodeValue=n}),t}a(ke,"interpolateReactiveText");function Be(e,t=5e3,n={}){let o=JSON.stringify([e,n,t]);if(!I.has(o)){let l=Se(async()=>{let i=await fetch(e,n);if(!i.ok)throw new Error(`Fetch failed: ${i.status}`);return i.json()},t);I.set(o,l)}return I.get(o)()}a(Be,"fetchCache");function Y(e){if(Array.isArray(e))return e.map(Y);if(e&&typeof e=="object"){let t={};return Object.keys(e).sort().forEach(n=>{t[n]=Y(e[n])}),t}return e}a(Y,"sortObjectDeep");function _e(e){if(e&&typeof e=="object"&&!Array.isArray(e)){let t={};return Object.keys(e).sort().forEach(n=>{t[n]=e[n]}),t}return e}a(_e,"sortObjectShallow");function Se(e,t=null,n={}){let o=new Map,l=a((...i)=>{let{deepSort:u}=n,r;u===!0?r=i.map(y=>y&&typeof y=="object"?Y(y):y):u===!1?r=i.map(y=>y&&typeof y=="object"?_e(y):y):r=i;let g=JSON.stringify(r),d=Date.now();g.length===2&&(g=e.name);let m=o.get(g);if(m&&(t===null||d-m.timestamp<t))return m.value;let p=e(...i);return o.set(g,{value:p,timestamp:d}),p instanceof Promise&&p.catch(()=>o.delete(g)),p},"wrapped");return l.clear=()=>o.clear(),l}a(Se,"memoizeFunc");function xe(e,t,n){let l=document.querySelectorAll("[data-component]")[n];return!l||l.getAttribute("data-component")!==e?null:[l,...l.querySelectorAll("*")][t]||null}a(xe,"getSsrElementByIndex");function q(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return e.replace(/[&<>"']/g,n=>t[n])}a(q,"escapeHtml");function V(e,...t){var h;let n={},o=[];if(t[0]&&typeof t[0]=="object"&&!Array.isArray(t[0])&&t[0]!==null&&!(t[0]instanceof String)&&(_||!(t[0]instanceof Node))?(n=t[0],o=t.slice(1)):o=t,_&&typeof document>"u"){let c=globalThis.__CURRENT_COMPONENT__;globalThis.__HANDLER_REGISTRY__||(globalThis.__HANDLER_REGISTRY__={}),(h=globalThis.__HANDLER_REGISTRY__)[c]||(h[c]=[]);let s=[];for(let[T,L]of Object.entries(n))if(T==="style"&&typeof L=="object"){let x=Object.entries(L).map(([ce,ue])=>`${ce.replace(/([A-Z])/g,"-$1").toLowerCase()}:${ue}`).join(";");s.push(` style="${q(x)}"`)}else T!=="className"&&T!=="class"&&!T.startsWith("on")&&s.push(` ${T}="${q(String(L))}"`);(n.className||n.class)&&s.push(` class="${q(n.className||n.class)}"`);let E=o.map(T=>typeof T=="function"?T():T??"").join("");if(["input","img","br","hr","meta","link"].includes(e))return`<${e}${s.join("")} />`;if(e==="fragment")return E;var l;let S=U.get(e);return S&&(l=S.tagName,S.nativeTag!==null&&(l=S.nativeTag)),l!==void 0&&(e=l),`<${e}${s.join("")}>${E}</${e}>`}R(V.name);var i="";i=K();var u=i.split("|");if(u.includes(w.rpc))return;let r=null,g=e.toLowerCase()==="fragment";if(g)r=document.createDocumentFragment();else{var l;let s=U.get(e);s&&(l=s.tagName,s.nativeTag!==null&&(l=s.nativeTag)),l!==void 0&&(e=l),r=document.createElement(e)}if(globalThis.__CURRENT_COMPONENT__){P++;let c=P;r.dataIndex=c,r.realtedComponent=globalThis.__CURRENT_COMPONENT__,r.cmpNbr=$}let d=[];for(let[c,s]of Object.entries(n))if(c.startsWith("on")&&typeof s=="function"){let E=c.slice(2).toLowerCase();d.push({type:E,val:s})}d.length&&(r._handlers=d);let f=G.has(e),m=z.has(se(e)),p=e==="input"||e==="option",y=e==="option";if(!g)for(let c in n){let s=n[c];if(c.startsWith("on")&&typeof s=="function"){let E=c.slice(2).toLowerCase();r.addEventListener(E,C=>{A.stopPropagation&&C.stopPropagation(),s(C)})}else typeof s=="function"&&c!=="children"?B(()=>{let E=s();E==null||E===!1?(r.removeAttribute(c),c==="value"&&m&&(r.value="",A.cleanhtml||r.removeAttribute("value")),c==="checked"&&p&&(r.checked=!1,A.cleanhtml||r.removeAttribute("checked")),c==="selected"&&y&&(r.selected=!1,A.cleanhtml||r.removeAttribute("selected")),c==="id"&&(r.iid="",A.cleanhtml||r.removeAttribute("id"))):c==="id"?(r.iid=E,A.cleanhtml?r.removeAttribute("id"):r.setAttribute("id",E),ee(E,{name:E,caller:E+i,value:r})):c==="value"&&m?(r.value=E,A.cleanhtml?r.removeAttribute("value"):r.setAttribute("value",E)):c==="checked"&&p?(r.checked=E,A.cleanhtml?r.removeAttribute("checked"):E?r.setAttribute("checked",""):r.removeAttribute("checked")):c==="selected"&&y?(r.selected=E,A.cleanhtml?r.removeAttribute("selected"):E?r.setAttribute("selected",""):r.removeAttribute("selected")):r.setAttribute(c,E)}):s!=null&&s!==!1&&(c==="id"?(r.iid=s,A.cleanhtml?r.removeAttribute("id"):r.setAttribute("id",s),ee(s,{name:s,caller:s+i,value:r})):c==="value"&&m?(r.value=s,A.cleanhtml?r.removeAttribute("value"):r.setAttribute("value",s)):c==="checked"&&p?(r.checked=s,A.cleanhtml?r.removeAttribute("checked"):r.setAttribute("checked","")):c==="selected"&&y?(r.selected=s,A.cleanhtml?r.removeAttribute("selected"):r.setAttribute("selected","")):r.setAttribute(c,s))}return f?o.length===1&&(typeof o[0]=="string"||typeof o[0]=="number")?m&&(r.value=o[0],A.cleanhtml?r.removeAttribute("value"):r.setAttribute("value",o[0])):o.length>0&&console.warn(`Void element <${e}> should not have children.`):o.flat().forEach(c=>{if(typeof c=="function"){let s=document.createTextNode("");r.appendChild(s),B(()=>{let E=c();if(E instanceof Node){let C=s.parentNode;if(!C)return;C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.replaceChildren(E):C.replaceChild(E,s),s=E}else{let C=E==null?"":String(E);if(s.nodeValue!==C){let S=s.parentNode;if(S.realtedComponent){let T=null,L=xe(S.realtedComponent,S.dataset.index,S.cmpNbr);if(L&&(T=L),T!==null){let x=T;x=T.childNodes[0].firstChild,x===null&&(x=T.firstChild),x.nodeType===Node.TEXT_NODE&&(x.nodeValue=C)}else s.nodeValue=C}else s.nodeValue=C}}})}else if(typeof c=="string"&&c.includes("{{")&&!c.includes("function"))r.appendChild(ke(c));else if(typeof c=="string"||typeof c=="number"){if(c.includes("function get(")||c.includes("function (")||c.includes("[native code]"))throw new Error("Detected reactive getter function used inside a template string. Use a function instead like: div(() => `Your text is: ${someState()}`)");r.appendChild(document.createTextNode(c))}else(c instanceof DocumentFragment||c instanceof Node)&&r.appendChild(c)}),r}a(V,"h");function ve(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/-+/g,"-").toLowerCase()}a(ve,"camelToDash");function ae(e,t=null){if(b.innerHTMLElements.includes(e)||b.valueElements.includes(e)||b.srcElements.includes(e)||b.hrefElements.includes(e)||b.voidElements.includes(e))return;let o=/[A-Z]/.test(e)?ve(e):e.toLowerCase();o.includes("-")||(o="s-"+o),e.includes("-")&&(o=e,e=se(e)),U.set(e,{tagName:o,nativeTag:t}),!b.innerHTMLElements.includes(e)&&t===null?b.innerHTMLElements.push(e):!b.innerHTMLElements.includes(e)&&t!==null&&(b.innerHTMLElements.includes(t)||b.innerHTMLElements.push(e)),!b.valueElements.includes(e)&&t===null?(b.valueElements.push(e),z.add(e)):!b.valueElements.includes(e)&&t!==null&&(b.valueElements.includes(t)||(b.valueElements.push(e),z.add(e))),!b.srcElements.includes(e)&&t===null?(b.srcElements.push(e),Z.add(e)):!b.srcElements.includes(e)&&t!==null&&(b.srcElements.includes(t)||(b.srcElements.push(e),Z.add(e))),!b.hrefElements.includes(e)&&t===null?(b.hrefElements.push(e),Q.add(e)):!b.hrefElements.includes(e)&&t!==null&&(b.hrefElements.includes(t)||(b.hrefElements.push(e),Q.add(e))),!b.voidElements.includes(e)&&t===null?(b.voidElements.push(e),G.add(e)):!b.voidElements.includes(e)&&t!==null&&(b.voidElements.includes(t)||(b.voidElements.push(e),G.add(e))),globalThis[e]=(...l)=>V(e,...l)}a(ae,"defineElement");function Le(e){_||requestAnimationFrame(()=>{requestAnimationFrame(e)})}a(Le,"onPaint");function Ye(e){if(_)return;let t=!1;Le(()=>{t||(t=!0,e())})}a(Ye,"paintFinish");function oe(e){let t={};for(let n of e.attributes)if(n.name.startsWith("data-")&&n.name!=="data-component"){let o=n.name.slice(5);try{t[o]=JSON.parse(n.value)}catch{t[o]=n.value}}return t}a(oe,"getPropsFromDataAttributes");async function Oe(){let e=document.querySelector("layout[data-layout]");if(!e)return!1;let t=e.getAttribute("data-layout");if(!t)return!1;try{let n=await fetch(t);if(!n.ok)throw new Error("Failed to load layout");let o=await n.text(),i=new DOMParser().parseFromString(o,"text/html"),u=document.querySelector("description[data-description]");if(u){let d=i.querySelector('meta[name="description"]');d||(d=i.createElement("meta"),d.name="description",i.head.appendChild(d)),d.content=u.getAttribute("data-description")}let r=document.querySelector("keywords[data-keywords]");if(r){let d=i.querySelector('meta[name="keywords"]');d||(d=i.createElement("meta"),d.name="keywords",i.head.appendChild(d)),d.content=r.getAttribute("data-keywords")}return document.querySelectorAll("[data-part]").forEach(d=>{let f=d.getAttribute("data-part"),m=i.querySelector(`[data-part="${f}"]`);m&&(m.innerHTML="",[...d.childNodes].forEach(p=>{m.appendChild(p.cloneNode(!0))}))}),document.documentElement.innerHTML=i.documentElement.innerHTML,!0}catch(n){return console.error("Failed to inject layout:",n),!1}}a(Oe,"injectLayout");function D(e,t){if(!t)return;let n=t.trim();if(e[n])return e[n];let o=n[0].toUpperCase()+n.slice(1).toLowerCase();if(e[o])return e[o];let l=n.toUpperCase();if(e[l])return e[l];let i=n.toLowerCase(),u=Object.entries(e).find(([r,g])=>r.toLowerCase()===i);if(u)return u[1]}a(D,"lookupComponent");async function re(e){var d;let t=e||A.route,n=await Oe(),{componentKey:o,componentName:l,params:i}=ie(t),u=new Set,r=l,g=document.querySelectorAll("[data-component]");for(let f of g){let m=f.getAttribute("data-component"),p=m==null?void 0:m.toLowerCase();if(typeof rvs_map_sigment<"u"&&rvs_map_sigment!==null?r=D(rvs_map_sigment,m):r=p,!r||u.has(r))continue;let y=D(t,r);try{f.hasChildNodes()&&(globalThis.__CURRENT_COMPONENT__=m);let h=y?await Me(y):await Re(A.loadAtRunTime,r),c=y?{...i,...oe(f)}:oe(f),s=h.default(c);s.funcName=l.toLowerCase();let E=(d=f.closest("[data-part]"))==null?void 0:d.getAttribute("data-part");s.datapart=E,s.setAttribute("data-component",m),s.hydrate=!0,f.cmpNbr=$,X(f,s),le.set(r,$),$++,P=0}catch(h){console.warn(`Component "${p}" failed to load`,h)}}}a(re,"hydrateComponent");async function Me(e){if(!M.has(e)){let t=await e.loader();M.set(e,t)}return M.get(e)}a(Me,"loadModule");async function Re(e,t){let n=D(e,t);if(n){if(M.has(n))return M.get(n);try{let o=await n();return M.set(n,o),o}catch(o){console.error(`Component "${t}" failed to load`,o)}}}a(Re,"loadModuleFromFile");function Xe(e,t){if(e===void 0){re();return}if(typeof e=="object"&&t===void 0){re(e);return}let n=typeof e=="string"?document.getElementById(e):e;if(!n)throw new Error("Mount target not found: "+e);n.hasChildNodes()?X(n,t):n.replaceChildren(t)}a(Xe,"mount");function X(e,t){if(e.hasChildNodes()){let l=[t,...t.querySelectorAll("*")],i=[e,...e.querySelectorAll("*")];l.forEach((u,r)=>{let g=i[r];if(g){u.dataset.index=r;for(let d of u.getAttributeNames()){let f=u.getAttribute(d);if(g.getAttribute(d)!==f){if(d==="data-component"||d==="data-index")continue;g.setAttribute(d,f)}}u.nodeType===Node.TEXT_NODE&&u.nodeValue!==g.nodeValue&&(g.nodeValue=u.nodeValue),u.childNodes[0].nodeType===Node.TEXT_NODE&&u.childNodes[0].nodeValue!==g.nodeValue&&(g.childNodes[0].nodeValue=u.childNodes[0].nodeValue),u._handlers&&u._handlers.forEach(({type:d,val:f})=>{g.addEventListener(d,m=>{A.stopPropagation&&m.stopPropagation(),f(m)})})}}),globalThis.__CURRENT_COMPONENT__=null,P=0;return}if(!t||e.nodeName!==t.nodeName){e.replaceWith(t);return}if(t.nodeType===Node.TEXT_NODE){e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue);return}if(e.nodeType===Node.ELEMENT_NODE&&t.nodeType===Node.ELEMENT_NODE){for(let l of Array.from(t.attributes))e.setAttribute(l.name,l.value);if(t._handlers)for(let{type:l,val:i}of t._handlers)e.addEventListener(l,u=>{A.stopPropagation&&u.stopPropagation(),i(u)});e instanceof HTMLInputElement?(e.value!==t.value&&(e.value=t.value),["checkbox","radio"].includes(e.type)&&e.checked!==t.checked&&(e.checked=t.checked)):e instanceof HTMLTextAreaElement?e.value!==t.value&&(e.value=t.value):e instanceof HTMLSelectElement&&e.value!==t.value&&(e.value=t.value);for(let l of Array.from(e.attributes))t.hasAttribute(l.name)||e.removeAttribute(l.name)}let n=Array.from(t.childNodes),o=Array.from(e.childNodes);for(let l=0;l<Math.max(n.length,o.length);l++){let i=o[l],u=n[l];i&&u?X(i,u):u?e.appendChild(u):i&&e.removeChild(i)}}a(X,"hydrate");export{Ie as IsEmpty,A as MyApp,me as Navigate,Ue as NavigateTo,Ve as Route,Je as addSigment,ze as clearComponentCache,B as createEffect,Ke as createElement,Pe as createGlobalSignal,Ge as createSigment,we as createSignal,Be as fetchCache,He as getCookie,je as getGlobalSignal,De as getStorage,H as getVirtualElementById,Pe as globalSignal,H as gve,ne as gvec,V as h,re as hydrateComponent,qe as loadFunc,Ce as loadRunFunc,Se as memoizeFunc,Xe as mount,Le as onPaint,Ye as paintFinish,ie as parsePath,te as rpc,Fe as setCookie,Ne as setStorage,we as signal,We as updateNodeIfNeeded,je as useGlobalSignal};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigment",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "A lightweight reactive JavaScript framework built with signals and vanilla JS — no virtual DOM, no JSX, no transpilation.",
5
5
  "main": "./dist/index.js",
6
6
  "repository": {