@jasonshimmy/custom-elements-runtime 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements-runtime.cjs.js +5 -5
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +5 -4
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.umd.js +5 -5
- package/dist/custom-elements-runtime.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
[hidden] { display: none }
|
|
59
59
|
`,Ze={gray:{50:"var(--color-gray-50, #f9fafb)",100:"var(--color-gray-100, #f3f4f6)",200:"var(--color-gray-200, #e5e7eb)",300:"var(--color-gray-300, #d1d5db)",400:"var(--color-gray-400, #9ca3af)",500:"var(--color-gray-500, #6b7280)",600:"var(--color-gray-600, #4b5563)",700:"var(--color-gray-700, #374151)",800:"var(--color-gray-800, #1f2937)",900:"var(--color-gray-900, #111827)"},neutral:{50:"var(--color-neutral-50, #fafafa)",100:"var(--color-neutral-100, #f5f5f5)",200:"var(--color-neutral-200, #e5e5e5)",300:"var(--color-neutral-300, #d4d4d4)",400:"var(--color-neutral-400, #a3a3a3)",500:"var(--color-neutral-500, #737373)",600:"var(--color-neutral-600, #525252)",700:"var(--color-neutral-700, #404040)",800:"var(--color-neutral-800, #262626)",900:"var(--color-neutral-900, #171717)"},slate:{50:"var(--color-slate-50, #f8fafc)",100:"var(--color-slate-100, #f1f5f9)",200:"var(--color-slate-200, #e2e8f0)",300:"var(--color-slate-300, #cbd5e1)",400:"var(--color-slate-400, #94a3b8)",500:"var(--color-slate-500, #64748b)",600:"var(--color-slate-600, #475569)",700:"var(--color-slate-700, #334155)",800:"var(--color-slate-800, #1e293b)",900:"var(--color-slate-900, #0f172a)"},zinc:{50:"var(--color-zinc-50, #fafafa)",100:"var(--color-zinc-100, #f4f4f5)",200:"var(--color-zinc-200, #e4e4e7)",300:"var(--color-zinc-300, #d4d4d8)",400:"var(--color-zinc-400, #a1a1aa)",500:"var(--color-zinc-500, #71717a)",600:"var(--color-zinc-600, #52525b)",700:"var(--color-zinc-700, #3f3f46)",800:"var(--color-zinc-800, #27272a)",900:"var(--color-zinc-900, #18181b)"},red:{50:"var(--color-red-50, #fef2f2)",100:"var(--color-red-100, #fee2e2)",200:"var(--color-red-200, #fecaca)",300:"var(--color-red-300, #fca5a5)",400:"var(--color-red-400, #f87171)",500:"var(--color-red-500, #ef4444)",600:"var(--color-red-600, #dc2626)",700:"var(--color-red-700, #b91c1c)",800:"var(--color-red-800, #991b1b)",900:"var(--color-red-900, #7f1d1d)"},blue:{50:"var(--color-blue-50, #eff6ff)",100:"var(--color-blue-100, #dbeafe)",200:"var(--color-blue-200, #bfdbfe)",300:"var(--color-blue-300, #93c5fd)",400:"var(--color-blue-400, #60a5fa)",500:"var(--color-blue-500, #3b82f6)",600:"var(--color-blue-600, #2563eb)",700:"var(--color-blue-700, #1d4ed8)",800:"var(--color-blue-800, #1e40af)",900:"var(--color-blue-900, #1e3a8a)"},green:{50:"var(--color-green-50, #f0fdf4)",100:"var(--color-green-100, #dcfce7)",200:"var(--color-green-200, #bbf7d0)",300:"var(--color-green-300, #86efac)",400:"var(--color-green-400, #4ade80)",500:"var(--color-green-500, #22c55e)",600:"var(--color-green-600, #16a34a)",700:"var(--color-green-700, #15803d)",800:"var(--color-green-800, #166534)",900:"var(--color-green-900, #14532d)"},amber:{50:"var(--color-amber-50, #fffbeb)",100:"var(--color-amber-100, #fef3c7)",200:"var(--color-amber-200, #fde68a)",300:"var(--color-amber-300, #fcd34d)",400:"var(--color-amber-400, #fbbf24)",500:"var(--color-amber-500, #f59e0b)",600:"var(--color-amber-600, #d97706)",700:"var(--color-amber-700, #b45309)",800:"var(--color-amber-800, #92400e)",900:"var(--color-amber-900, #78350f)"},indigo:{50:"var(--color-indigo-50, #eef2ff)",100:"var(--color-indigo-100, #e0e7ff)",200:"var(--color-indigo-200, #c7d2fe)",300:"var(--color-indigo-300, #a5b4fc)",400:"var(--color-indigo-400, #818cf8)",500:"var(--color-indigo-500, #6366f1)",600:"var(--color-indigo-600, #4f46e5)",700:"var(--color-indigo-700, #4338ca)",800:"var(--color-indigo-800, #3730a3)",900:"var(--color-indigo-900, #312e81)"},emerald:{50:"var(--color-emerald-50, #ecfdf5)",100:"var(--color-emerald-100, #d1fae5)",200:"var(--color-emerald-200, #a7f3d0)",300:"var(--color-emerald-300, #6ee7b7)",400:"var(--color-emerald-400, #34d399)",500:"var(--color-emerald-500, #10b981)",600:"var(--color-emerald-600, #059669)",700:"var(--color-emerald-700, #047857)",800:"var(--color-emerald-800, #065f46)",900:"var(--color-emerald-900, #064e3b)"},rose:{50:"var(--color-rose-50, #fff1f2)",100:"var(--color-rose-100, #ffe4e6)",200:"var(--color-rose-200, #fecdd3)",300:"var(--color-rose-300, #fda4af)",400:"var(--color-rose-400, #fb7185)",500:"var(--color-rose-500, #f43f5e)",600:"var(--color-rose-600, #e11d48)",700:"var(--color-rose-700, #be123c)",800:"var(--color-rose-800, #9f1239)",900:"var(--color-rose-900, #881337)"},white:{DEFAULT:"var(--color-white, #ffffff)"},black:{DEFAULT:"var(--color-black, #000000)"}},G={block:"display:block;",inline:"display:inline;","inline-block":"display:inline-block;",flex:"display:flex;","inline-flex":"display:inline-flex;",grid:"display:grid;",hidden:"display:none;","w-full":"width:100%;","w-screen":"width:100dvw;","h-full":"height:100%;","h-screen":"height:100dvw;","max-w-full":"max-width:100%;","max-h-full":"max-height:100%;","min-w-0":"min-width:0;","min-h-0":"min-height:0;","m-auto":"margin:auto;","mx-auto":"margin-inline:auto;","my-auto":"margin-block:auto;","overflow-auto":"overflow:auto;","overflow-hidden":"overflow:hidden;","overflow-visible":"overflow:visible;","overflow-scroll":"overflow:scroll;","pointer-events-none":"pointer-events:none;","pointer-events-auto":"pointer-events:auto;","sr-only":"position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0;","not-sr-only":"position:static;width:auto;height:auto;padding:0;margin:0;overflow:visible;clip:auto;white-space:normal;","grid-cols-1":"grid-template-columns:repeat(1,minmax(0,1fr));","grid-cols-2":"grid-template-columns:repeat(2,minmax(0,1fr));","grid-cols-3":"grid-template-columns:repeat(3,minmax(0,1fr));","grid-cols-4":"grid-template-columns:repeat(4,minmax(0,1fr));","grid-cols-5":"grid-template-columns:repeat(5,minmax(0,1fr));","grid-cols-6":"grid-template-columns:repeat(6,minmax(0,1fr));","grid-cols-12":"grid-template-columns:repeat(12,minmax(0,1fr));","grid-rows-1":"grid-template-rows:repeat(1,minmax(0,1fr));","grid-rows-2":"grid-template-rows:repeat(2,minmax(0,1fr));","grid-rows-3":"grid-template-rows:repeat(3,minmax(0,1fr));","grid-rows-4":"grid-template-rows:repeat(4,minmax(0,1fr));","grid-rows-6":"grid-template-rows:repeat(6,minmax(0,1fr));","grid-rows-12":"grid-template-rows:repeat(12,minmax(0,1fr));","col-span-1":"grid-column:span 1 / span 1;","col-span-2":"grid-column:span 2 / span 2;","col-span-3":"grid-column:span 3 / span 3;","col-span-4":"grid-column:span 4 / span 4;","col-span-5":"grid-column:span 5 / span 5;","col-span-6":"grid-column:span 6 / span 6;","col-span-12":"grid-column:span 12 / span 12;","row-span-1":"grid-row:span 1 / span 1;","row-span-2":"grid-row:span 2 / span 2;","row-span-3":"grid-row:span 3 / span 3;","row-span-4":"grid-row:span 4 / span 4;","row-span-6":"grid-row:span 6 / span 6;","row-span-12":"grid-row:span 12 / span 12;",absolute:"position:absolute;",relative:"position:relative;",fixed:"position:fixed;",sticky:"position:sticky;","font-bold":"font-weight:700;","font-semibold":"font-weight:600;","font-medium":"font-weight:500;","font-light":"font-weight:300;",underline:"text-decoration-line:underline;",overline:"text-decoration-line:overline;","line-through":"text-decoration-line:line-through;","no-underline":"text-decoration-line:none;",italic:"font-style:italic;","not-italic":"font-style:normal;",uppercase:"text-transform:uppercase;",lowercase:"text-transform:lowercase;",capitalize:"text-transform:capitalize;","normal-case":"text-transform:none;","text-left":"text-align:left;","text-center":"text-align:center;","text-right":"text-align:right;","text-xs":"font-size:0.75rem;line-height:calc(1 / 0.75)","text-sm":"font-size:0.875rem;line-height:calc(1.25 / 0.875)","text-base":"font-size:1rem;line-height:calc(1.5 / 1)","text-lg":"font-size:1.125rem;line-height:calc(1.75 / 1.125)","text-xl":"font-size:1.25rem;line-height:calc(1.75 / 1.25)","text-2xl":"font-size:1.5rem;line-height:calc(2 / 1.5)","text-3xl":"font-size:1.875rem;line-height:calc(2.25 / 1.875)","text-4xl":"font-size:2.25rem;line-height:calc(2.5 / 2.25)","text-5xl":"font-size:3rem;line-height:1","text-6xl":"font-size:3.75rem;line-height:1","text-7xl":"font-size:4.5rem;line-height:1","text-8xl":"font-size:6rem;line-height:1",border:"border-width:1px;","rounded-none":"border-radius:0;","rounded-xs":"border-radius:0.125rem;",rounded:"border-radius:0.25rem;","rounded-sm":"border-radius:0.25rem;","rounded-md":"border-radius:0.375rem;","rounded-lg":"border-radius:0.5rem;","rounded-full":"border-radius:9999px;","ring-0":"box-shadow:none;","ring-1":"box-shadow:0 0 0 1px rgba(59,130,246,0.5);","ring-2":"box-shadow:0 0 0 2px rgba(59,130,246,0.5);","ring-4":"box-shadow:0 0 0 4px rgba(59,130,246,0.5);","ring-8":"box-shadow:0 0 0 8px rgba(59,130,246,0.5);","shadow-none":"box-shadow:0 0 #0000;","shadow-xs":"box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);","shadow-sm":"box-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);","shadow-md":"box-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);","shadow-lg":"box-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);","shadow-xl":"box-shadow:0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);","shadow-2xl":"box-shadow:0 25px 50px -12px rgb(0 0 0 / 0.25);",transition:"transition-property:all;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4,0,0.2,1);",truncate:"overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",visible:"visibility:visible;",invisible:"visibility:hidden;","items-center":"align-items:center;","items-start":"align-items:flex-start;","items-end":"align-items:flex-end;","items-baseline":"align-items:baseline;","items-stretch":"align-items:stretch;","justify-center":"justify-content:center;","justify-start":"justify-content:flex-start;","justify-between":"justify-content:space-between;","justify-around":"justify-content:space-around;","justify-evenly":"justify-content:space-evenly;","justify-end":"justify-content:flex-end;","flex-wrap":"flex-wrap:wrap;","flex-nowrap":"flex-wrap:nowrap;","flex-wrap-reverse":"flex-wrap:wrap-reverse;","content-center":"align-content:center;","content-start":"align-content:flex-start;","content-end":"align-content:flex-end;","content-between":"align-content:space-between;","content-around":"align-content:space-around;","content-stretch":"align-content:stretch;","self-auto":"align-self:auto;","self-start":"align-self:flex-start;","self-end":"align-self:flex-end;","self-center":"align-self:center;","self-stretch":"align-self:stretch;","flex-1":"flex:1 1 0%;","flex-auto":"flex:1 1 auto;","flex-initial":"flex:0 1 auto;","flex-none":"flex:0 0 auto;","flex-col":"flex-direction:column;","flex-row":"flex-direction:row;",grow:"flex-grow:1;",shrink:"flex-shrink:1;","grow-0":"flex-grow:0;","shrink-0":"flex-shrink:0;","font-sans":"font-family:ui-sans-serif,system-ui,sans-serif;","font-serif":"font-family:ui-serif,Georgia,serif;","font-mono":"font-family:ui-monospace,SFMono-Regular,monospace;","line-clamp-1":"display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;","line-clamp-2":"display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;","line-clamp-3":"display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;","line-clamp-4":"display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;","transition-colors":"transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;","transition-opacity":"transition-property:opacity;","transition-transform":"transition-property:transform;"},Xe="0.25rem",ge={m:["margin"],mx:["margin-inline"],my:["margin-block"],mt:["margin-top"],mr:["margin-right"],mb:["margin-bottom"],ml:["margin-left"],p:["padding"],px:["padding-inline"],py:["padding-block"],pt:["padding-top"],pr:["padding-right"],pb:["padding-bottom"],pl:["padding-left"],inset:["inset"],"inset-x":["inset-inline"],"inset-y":["inset-block"],h:["height"],w:["width"],"min-h":["min-height"],"min-w":["min-width"],"max-h":["max-height"],"max-w":["max-width"],top:["top"],bottom:["bottom"],left:["left"],right:["right"],gap:["gap"],"gap-x":["column-gap"],"gap-y":["row-gap"]},Ye={before:(e,t)=>`${e}::before{${t}}`,after:(e,t)=>`${e}::after{${t}}`,hover:(e,t)=>`${e}:hover{${t}}`,focus:(e,t)=>`${e}:focus{${t}}`,active:(e,t)=>`${e}:active{${t}}`,disabled:(e,t)=>`${e}:disabled{${t}}`,visited:(e,t)=>`${e}:visited{${t}}`,checked:(e,t)=>`${e}:checked{${t}}`,first:(e,t)=>`${e}:first-child{${t}}`,last:(e,t)=>`${e}:last-child{${t}}`,odd:(e,t)=>`${e}:nth-child(odd){${t}}`,even:(e,t)=>`${e}:nth-child(even){${t}}`,"focus-within":(e,t)=>`${e}:focus-within{${t}}`,"focus-visible":(e,t)=>`${e}:focus-visible{${t}}`,"group-hover":(e,t)=>`.group:hover ${e}{${t}}`,"group-focus":(e,t)=>`.group:focus ${e}{${t}}`,"group-active":(e,t)=>`.group:active ${e}{${t}}`,"group-disabled":(e,t)=>`.group:disabled ${e}{${t}}`,"peer-hover":(e,t)=>`.peer:hover ~ ${e}{${t}}`,"peer-focus":(e,t)=>`.peer:focus ~ ${e}{${t}}`,"peer-checked":(e,t)=>`.peer:checked ~ ${e}{${t}}`,"peer-disabled":(e,t)=>`.peer:disabled ~ ${e}{${t}}`},ye={sm:"(min-width:640px)",md:"(min-width:768px)",lg:"(min-width:1024px)",xl:"(min-width:1280px)","2xl":"(min-width:1536px)",dark:"(prefers-color-scheme: dark)"},ee=["sm","md","lg","xl","2xl"];function te(e){const t=e.startsWith("-"),n=(t?e.slice(1):e).split("-");if(n.length<2)return null;const o=n.slice(0,-1).join("-"),s=n[n.length-1],i=parseFloat(s);if(Number.isNaN(i)||!ge[o])return null;const a=t?"-":"";return ge[o].map(c=>`${c}:calc(${a}${Xe} * ${i});`).join("")}function me(e){const t=e.replace("#",""),r=parseInt(t,16),n=r>>16&255,o=r>>8&255,s=r&255;return`${n} ${o} ${s}`}function Ge(e){const t=/^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);if(!t)return null;const[,r,n,o="DEFAULT"]=t,s=Ze[n]?.[o];return s?`${{bg:"background-color",decoration:"text-decoration-color",text:"color",border:"border-color",shadow:"box-shadow",outline:"outline-color",caret:"caret-color",accent:"accent-color",placeholder:"placeholder-color",fill:"fill-color",stroke:"stroke-color"}[r]}:${s};`:null}function et(e){const[t,r]=e.split("/");if(!r)return{base:t};const n=parseInt(r,10);return isNaN(n)||n<0||n>100?{base:t}:{base:t,opacity:n/100}}function re(e){const{base:t,opacity:r}=et(e),n=Ge(t);if(n){if(r!==void 0){const s=/#([0-9a-f]{6})/i.exec(n);if(s){const i=me(s[0]);return n.replace(/#([0-9a-f]{6})/i,`rgb(${i} / ${r})`)}}return n}const o=Z(t);if(o&&r!==void 0){const s=/#([0-9a-f]{6})/i.exec(o);if(s){const i=me(s[0]);return o.replace(/#([0-9a-f]{6})/i,`rgb(${i} / ${r})`)}}return o}function Z(e){const t=e.indexOf("-["),r=e.endsWith("]");if(t>0&&r){const n=e.slice(0,t);let o=e.slice(t+2,-1);o=o.replace(/_/g," ");const i={bg:"background-color",text:"color",p:"padding",px:"padding-inline",py:"padding-block",m:"margin",mx:"margin-inline",my:"margin-block",w:"width",h:"height","min-w":"min-width","max-w":"max-width","min-h":"min-height","max-h":"max-height","border-t":"border-top","border-b":"border-bottom","border-l":"border-left","border-r":"border-right","border-x":"border-inline","border-y":"border-block",shadow:"box-shadow",duration:"transition-duration",list:"list-style",break:"word-break",flex:"flex-direction",items:"align-items",justify:"justify-content",whitespace:"white-space",select:"user-select",content:"align-content",self:"align-self",basis:"flex-basis",tracking:"letter-spacing",scroll:"scroll-behavior",delay:"transition-delay",weight:"font-weight",leading:"line-height",z:"z-index"}[n]??n.replace(/_/g,"-");if(i&&o)return`${i}:${o};`}return null}function tt(e){return e.startsWith("[")&&e.endsWith("]")?e:e.indexOf("-[")>0&&e.endsWith("]")?e.replace(/_/g,"-"):null}function rt(e){return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g,"\\$1")}function nt(e){const t=/class\s*=\s*["']([^"']+)["']/g,r=[];let n;for(;n=t.exec(e);){const o=n[1].match(/(?:\[[^\]]+\]:[^\s]+|[^\s]+)/g);o&&r.push(...o)}return r.filter(Boolean)}const be=new Map,ot=16;function it(e){const t=Date.now(),r=be.get(e);if(r&&t-r.timestamp<ot)return r.css;const n=nt(e),o=new Set(n),s=[],i=[],a=[],c=[],f={};function p(y,m=!1){const h=(m?"dark|":"")+y;if(h in f)return f[h];const d=l(y,m);return f[h]=d,d}function g(y){const m=y.some(d=>ee.includes(d)),h=y.includes("dark");return y.length===0?1:!m&&!h?2:m&&!h?3:4}function l(y,m=!1){const h=y.split(":"),d=h.find(k=>G[k]||te(k)||re(k)||Z(k));if(!d)return null;const v=G[d]??te(d)??re(d)??Z(d);if(!v)return null;let x=`.${rt(y)}`,u=v;const $=h.indexOf(d);let w=$>=0?h.slice(0,$):[];m&&(w=w.filter(k=>k!=="dark"));const S=w.filter(k=>ee.includes(k)),_=S.length?S[S.length-1]:null;for(const k of w){const B=tt(k);if(B){x=`${B}${x}`;continue}if(ee.includes(k))continue;const A=Ye[k];typeof A=="function"&&(x=A(x,u).replace(/\{.*$/,""))}let C=`${x}{${u}}`;return m&&_?C=`@media (prefers-color-scheme: dark) and ${ye[_]}{${C}}`:m?C=`@media (prefers-color-scheme: dark){${C}}`:_&&(C=`@media ${ye[_]}{${C}}`),C}for(const y of o){const m=y.split(":"),h=m.find(u=>G[u]||te(u)||re(u)||Z(u));if(!h)continue;const d=m.indexOf(h),v=d>=0?m.slice(0,d):[],x=g(v);if(x===4){const u=p(y,!0);u&&c.push(u)}else{const u=p(y);u&&(x===1?s.push(u):x===2?i.push(u):x===3&&a.push(u))}}const b=[...s,...i,...a,...c].join("");return be.set(e,{css:b,timestamp:t}),b}const K=[];function st(e,t,r,n,o,s,i,a){if(e){K.push(r);try{if(t.loadingTemplate&&r.isLoading){D(e,t.loadingTemplate(r),r,n,o);return}if(t.errorTemplate&&r.hasError){r.error instanceof Error&&D(e,t.errorTemplate(r.error,r),r,n,o);return}const c=t.render(r);if(c instanceof Promise){s(!0),c.then(f=>{s(!1),i(null),D(e,f,r,n,o),a(e.innerHTML)}).catch(f=>{s(!1),i(f),t.errorTemplate&&D(e,t.errorTemplate(f,r),r,n,o)}),t.loadingTemplate&&D(e,t.loadingTemplate(r),r,n,o);return}D(e,c,r,n,o),a(e.innerHTML)}finally{K.pop()}}}function D(e,t,r,n,o){e&&(Ue(e,Array.isArray(t)?t:[t],r,n),o(e.innerHTML))}function at(e,t,r,n,o,s,i){if(s!==null&&clearTimeout(s),Date.now()-t<16){if(o(r+1),r>10){console.warn("Potential infinite render loop detected. Skipping render."),i(null);return}}else o(0);const c=setTimeout(()=>{n(Date.now()),e(),i(null)},0);i(c)}function lt(e,t,r,n,o,s){if(!e)return;const i=it(n);if(!t.style&&(!i||i.trim()==="")){s(null),e.adoptedStyleSheets=[he()];return}let a="";t.style&&(typeof t.style=="string"?a=t.style:typeof t.style=="function"&&(a=t.style(r)));let c=Je(`${a}
|
|
60
60
|
${i}
|
|
61
|
-
`);c=we(c);let f=o;f||(f=new CSSStyleSheet),(f.cssRules.length===0||f.toString()!==c)&&f.replaceSync(c),e.adoptedStyleSheets=[he(),f],s(f)}const ct=new Map;function le(e,t,r){let n=fe(e);n.includes("-")||(n=`cer-${n}`);let o;typeof t=="function"?o={...r,render:t}:o=t,typeof o.onError!="function"&&(o.onError=(s,i)=>{console.error(`[${n}] Error:`,s,i)}),ct.set(n,o),typeof window<"u"&&!customElements.get(n)&&customElements.define(n,ft(o))}function ft(e){if(!e.render)throw new Error("Component must have a render function");return typeof window>"u"?class{constructor(){}}:class extends HTMLElement{context;_refs={};_listeners=[];_watchers=new Map;_renderTimeoutId=null;_mounted=!1;_hasError=!1;_initializing=!0;_styleSheet=null;_lastHtmlStringForJitCSS="";get lastHtmlStringForJitCSS(){return this._lastHtmlStringForJitCSS}get isLoading(){return this._templateLoading}get lastError(){return this._templateError}_cfg;_lastRenderTime=0;_renderCount=0;_templateLoading=!1;_templateError=null;constructor(){super(),this.attachShadow({mode:"open"}),this._cfg=e;const t=this._initContext(e);Object.defineProperty(t,"refs",{value:this._refs,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(t,"requestRender",{value:()=>this.requestRender(),writable:!1,enumerable:!1,configurable:!1}),this.context=t,this._applyProps(e),Object.defineProperty(this.context,"emit",{value:(r,n,o)=>{this.dispatchEvent(new CustomEvent(r,{detail:n,bubbles:!0,composed:!0,...o||{}}));const s=`on${r.charAt(0).toUpperCase()}${r.slice(1)}`,i=typeof this[s]=="function"?this[s]:void 0,a=typeof this.context[s]=="function"?this.context[s]:void 0,c=typeof e[s]=="function"?e[s]:void 0;i&&i(n,this.context),a&&a!==i&&a(n,this.context),c&&c!==i&&c!==a&&c(n,this.context)},writable:!1,enumerable:!1,configurable:!1}),Object.keys(e).forEach(r=>{const n=e[r];if(typeof n=="function"&&!r.startsWith("on"))this.context[r]=(...o)=>n(...o,this.context);else if(r.startsWith("on")&&r.length>2&&r[2]===r[2].toUpperCase()){const o=r.slice(2,3).toLowerCase()+r.slice(3);this.addEventListener(o,s=>{const i=typeof this[r]=="function"?this[r]:this.context[r];typeof i=="function"&&i(s.detail,this.context)})}}),this._applyComputed(e),this._initializing=!1,this._initWatchers(e),this._render(e)}connectedCallback(){this._runLogicWithinErrorBoundary(e,()=>{Oe(e,this.context,this._mounted,t=>{this._mounted=t})})}disconnectedCallback(){this._runLogicWithinErrorBoundary(e,()=>{Pe(e,this.context,this._listeners,()=>{this._listeners=[]},()=>{this._watchers.clear()},t=>{this._templateLoading=t},t=>{this._templateError=t},t=>{this._mounted=t})})}attributeChangedCallback(t,r,n){this._runLogicWithinErrorBoundary(e,()=>{this._applyProps(e),We(e,t,r,n,this.context)})}static get observedAttributes(){return e.props?Object.keys(e.props).map(fe):[]}_applyComputed(t){this._runLogicWithinErrorBoundary(e,()=>{t.computed&&Object.entries(t.computed).forEach(([r,n])=>{Object.defineProperty(this.context,r,{get:()=>{const o=n(this.context);return ie(o)},enumerable:!0})})})}_render(t){this._runLogicWithinErrorBoundary(t,()=>{st(this.shadowRoot,t,this.context,this._refs,r=>{this._lastHtmlStringForJitCSS=r,typeof this.onHtmlStringUpdate=="function"&&this.onHtmlStringUpdate(r)},r=>{this._templateLoading=r,typeof this.onLoadingStateChange=="function"&&this.onLoadingStateChange(r)},r=>{this._templateError=r,typeof this.onErrorStateChange=="function"&&this.onErrorStateChange(r)},r=>this._applyStyle(t,r))})}requestRender(){this._requestRender()}_requestRender(){this._runLogicWithinErrorBoundary(this._cfg,()=>{at(()=>this._render(this._cfg),this._lastRenderTime,this._renderCount,t=>{this._lastRenderTime=t},t=>{this._renderCount=t},this._renderTimeoutId,t=>{this._renderTimeoutId=t})})}_applyStyle(t,r){this._runLogicWithinErrorBoundary(t,()=>{lt(this.shadowRoot,t,this.context,r,this._styleSheet,n=>{this._styleSheet=n})})}_runLogicWithinErrorBoundary(t,r){this._hasError&&(this._hasError=!1);try{r()}catch(n){this._hasError=!0,t.onError&&t.onError(n,this.context),t.errorFallback&&this.shadowRoot&&(this.shadowRoot.innerHTML=t.errorFallback(n,this.context))}}_initContext(t){try{let r=function(o,s=""){return Array.isArray(o)?new Proxy(o,{get(i,a,c){const f=Reflect.get(i,a,c);return typeof f=="function"&&typeof a=="string"&&["push","pop","shift","unshift","splice","sort","reverse"].includes(a)?function(...g){const l=f.apply(i,g);if(!n._initializing){const b=s||"root";n._triggerWatchers(b,i),n._render(t)}return l}:f},set(i,a,c){if(i[a]=c,!n._initializing){const f=s?`${s}.${String(a)}`:String(a);n._triggerWatchers(f,c),n._render(t)}return!0},deleteProperty(i,a){if(delete i[a],!n._initializing){const c=s?`${s}.${String(a)}`:String(a);n._triggerWatchers(c,void 0),n._render(t)}return!0}}):o&&typeof o=="object"?(Object.keys(o).forEach(i=>{const a=s?`${s}.${i}`:i;o[i]=r(o[i],a)}),new Proxy(o,{set(i,a,c){const f=s?`${s}.${String(a)}`:String(a);return i[a]=r(c,f),n._initializing||(n._triggerWatchers(f,i[a]),n._render(t)),!0},get(i,a,c){return Reflect.get(i,a,c)}})):o};const n=this;return r({...t.state})}catch{return{}}}_initWatchers(t){this._runLogicWithinErrorBoundary(t,()=>{ze(this.context,this._watchers,t.watch||{})})}_triggerWatchers(t,r){Ne(this.context,this._watchers,t,r)}_applyProps(t){this._runLogicWithinErrorBoundary(t,()=>{try{Me(this,t,this.context)}catch(r){this._hasError=!0,t.onError&&t.onError(r,this.context),t.errorFallback&&this.shadowRoot&&(this.shadowRoot.innerHTML=t.errorFallback(r,this.context))}})}}}function F(e,t={},r,n){const o=n??t.key;return{tag:e,key:o,props:t,children:r}}function X(e){return!!e&&typeof e=="object"&&(e.type==="AnchorBlock"||e.tag==="#anchor")}function J(e){return typeof e=="object"&&e!==null&&"tag"in e&&!X(e)}function ut(e,t){return e.key!=null?e:{...e,key:t}}function dt(e,t=[],r={}){const n={},o={},s={},i=/([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;let a;for(;a=i.exec(e);){const c=a[1],f=a[2],p=(a[4]||a[6])??"",g=p.match(/^{{(\d+)}}$/);let l=g?t[Number(g[1])]??null:p;if(g||(l==="true"?l=!0:l==="false"?l=!1:l==="null"?l=null:isNaN(Number(l))||(l=Number(l))),c===":")typeof l=="boolean"?o[f]=l:l!=null&&(typeof r[l]<"u"?n[f]=r[l]:n[f]=l);else if(c==="@"){const b="on"+f.charAt(0).toUpperCase()+f.slice(1);n[b]=typeof l=="function"?l:typeof r[l]=="function"?r[l]:void 0}else if(c==="#"){const[b,...y]=f.split("."),m=[...y];let h=l,d=[...m];if(b==="model"&&typeof h=="string"&&h.includes(".")){const v=["trim","number","lazy"],x=h.split(".");let u=h;const $=[];for(let w=x.length-1;w>0&&v.includes(x[w]);w--)$.unshift(x[w]),u=x.slice(0,w).join(".");h=u,d.push(...$)}s[b]={value:h,modifiers:d}}else f==="ref"?n.ref=l:o[f]=l}return{props:n,attrs:o,directives:s}}function pt(e,t,r){const n=K.length>0?K[K.length-1]:void 0,o=r??n;function s(u,$){return F("#text",{},u,$)}let i="";for(let u=0;u<e.length;u++)i+=e[u],u<t.length&&(i+=`{{${u}}}`);const a=/<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g,c=[];let f,p=[],g=null,l={},b,y=0,m=[];function h(u){!u||typeof u!="object"||X(u)||(u.props||u.attrs?(u.props&&(l.props||(l.props={}),Object.assign(l.props,u.props)),u.attrs&&(l.attrs||(l.attrs={}),Object.keys(u.attrs).forEach($=>{if($==="style"&&l.attrs.style){const w=l.attrs.style.replace(/;?\s*$/,""),S=u.attrs.style.replace(/^;?\s*/,"");l.attrs.style=w+"; "+S}else if($==="class"&&l.attrs.class){const w=l.attrs.class.trim().split(/\s+/).filter(Boolean),S=u.attrs.class.trim().split(/\s+/).filter(Boolean),_=[...new Set([...w,...S])];l.attrs.class=_.join(" ")}else l.attrs[$]=u.attrs[$]}))):(l.props||(l.props={}),Object.assign(l.props,u)))}function d(u,$){const w=g?p:m;if(X(u)){const S=u.key??$;let _=u.children;w.push({...u,key:S,children:_});return}if(J(u)){w.push(ut(u,void 0));return}if(Array.isArray(u)){if(u.length===0)return;for(let S=0;S<u.length;S++){const _=u[S];X(_)||J(_)||Array.isArray(_)?d(_,`${$}-${S}`):_!==null&&typeof _=="object"?h(_):w.push(s(String(_),`${$}-${S}`))}return}if(u!==null&&typeof u=="object"){h(u);return}w.push(s(String(u),$))}const v=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);for(;f=a.exec(i);)if(f[1]){const u=f[1],$=f[0][1]==="/",w=f[0][f[0].length-2]==="/"||v.has(u),{props:S,attrs:_,directives:C}=dt(f[2]||"",t,o),k={props:{},attrs:{}};for(const A in S)k.props[A]=S[A];for(const A in _)k.attrs[A]=_[A];for(const[A,T]of Object.entries(C)){if(A==="bind")if(typeof T.value=="object"&&T.value!==null)for(const[E,j]of Object.entries(T.value))typeof j=="boolean"?k.attrs[E]=j:j!=null&&(k.attrs[E]=String(j));else T.value!=null&&(k.attrs[A]=String(T.value));if(["show","class","style"].includes(A)&&(k.directives||(k.directives={}),k.directives[A]=T),A==="show"){const E=!!T.value;k.attrs.style=(k.attrs.style||"")+(E?"":"; display: none !important")}else if(A==="class"){const E=T.value;let j=[];if(typeof E=="string")j=E.split(/\s+/).filter(Boolean);else if(Array.isArray(E)){for(const R of E)if(typeof R=="string")j.push(...R.split(/\s+/).filter(Boolean));else if(R&&typeof R=="object")for(const[z,V]of Object.entries(R))V&&j.push(...z.split(/\s+/).filter(Boolean))}else if(E&&typeof E=="object")for(const[R,z]of Object.entries(E))z&&j.push(...R.split(/\s+/).filter(Boolean));const q=k.attrs.class||"",I=[...new Set([...q.split(/\s+/).filter(Boolean),...j])];k.attrs.class=I.join(" ")}else if(A==="style"){const E=T.value;let j="";if(typeof E=="string")j=E;else if(E&&typeof E=="object"){const I=[];for(const[R,z]of Object.entries(E))if(z!=null&&z!==""){const V=R.replace(/[A-Z]/g,_e=>`-${_e.toLowerCase()}`),Se=["width","height","top","right","bottom","left","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","font-size","line-height","border-width","border-radius","min-width","max-width","min-height","max-height"];let de=String(z);typeof z=="number"&&Se.includes(V)&&(de=`${z}px`),I.push(`${V}: ${de}`)}j=I.join("; ")+(I.length>0?";":"")}const q=k.attrs.style||"";k.attrs.style=q+(q&&!q.endsWith(";")?"; ":"")+j}}const B={};for(const[A,T]of Object.entries(C))["bind","show","class","style"].includes(A)||(B[A]=T);if(Object.keys(B).length>0&&(k.directives=B),$){const A=F(g,l,p.length===1&&J(p[0])&&p[0].tag==="#text"?typeof p[0].children=="string"?p[0].children:"":p.length?p:void 0,b),T=c.pop();T?(g=T.tag,l=T.props,b=T.key,p=T.children,p.push(A)):(m.push(A),g=null,l={},b=void 0,p=[])}else w?g?p.push(F(u,k,void 0,void 0)):m.push(F(u,k,void 0,void 0)):(g&&c.push({tag:g,props:l,children:p,key:b}),g=u,l=k,p=[])}else if(typeof f[3]<"u"){const u=Number(f[3]),$=t[u],w=`interp-${u}`;d($,w)}else if(f[4]){const u=f[4],$=g?p:m,w=u.split(/({{\d+}})/);for(const S of w){if(!S)continue;const _=S.match(/^{{(\d+)}}$/);if(_){const C=Number(_[1]),k=t[C],B=`interp-${C}`;d(k,B)}else{const C=`text-${y++}`;$.push(s(S,C))}}}const x=m.filter(u=>J(u)&&u.tag==="#text"?typeof u.children=="string"&&u.children.trim()!=="":!0);return x.length===1?x[0]:x.length>1?x:F("div",{},"","fallback-root")}function M(e,...t){const r=t[t.length-1],n=typeof r=="object"&&r&&!Array.isArray(r)?r:void 0;return pt(e,t,n)}const ce=e=>e?typeof URLSearchParams>"u"?{}:Object.fromEntries(new URLSearchParams(e)):{},N=(e,t)=>{for(const r of e){const n=[],o=r.path.replace(/:[^/]+/g,a=>(n.push(a.slice(1)),"([^/]+)")),s=new RegExp(`^${o}$`),i=t.match(s);if(i){const a={};return n.forEach((c,f)=>{a[c]=i[f+1]}),{route:r,params:a}}}return{route:null,params:{}}},ne={};async function ke(e){if(e.component)return e.component;if(e.load){if(ne[e.path])return ne[e.path];try{const t=await e.load();return ne[e.path]=t.default,t.default}catch{throw new Error(`Failed to load component for route: ${e.path}`)}}throw new Error(`No component or loader defined for route: ${e.path}`)}function $e(e){const{routes:t,base:r="",initialUrl:n}=e;let o,s,i,a,c,f,p;const g=async(m,h)=>{const d=t.find(v=>N([v],m.path).route!==null);if(d?.beforeEnter)try{const v=await d.beforeEnter(m,h);return typeof v=="string"?(await y(v,!0),!1):v!==!1}catch(v){return console.error("beforeEnter error",v),!1}return!0},l=async(m,h)=>{const d=t.find(v=>N([v],m.path).route!==null);if(d?.onEnter)try{const v=await d.onEnter(m,h);return typeof v=="string"?(await y(v,!0),!1):v!==!1}catch(v){return console.error("onEnter error",v),!1}return!0},b=(m,h)=>{const d=t.find(v=>N([v],m.path).route!==null);if(d?.afterEnter)try{d.afterEnter(m,h)}catch(v){console.error("afterEnter error",v)}},y=async(m,h=!1)=>{try{const d={path:m.replace(r,"")||"/",query:{}},v=N(t,d.path);if(!v)throw new Error(`No route found for ${d.path}`);const x=i.getState(),u={path:d.path,params:v.params,query:d.query};if(!await g(u,x)||!await l(u,x))return;typeof window<"u"&&typeof document<"u"&&(h?window.history.replaceState({},"",r+m):window.history.pushState({},"",r+m)),i.setState(u),b(u,x)}catch(d){console.error("Navigation error:",d)}};if(typeof window<"u"&&typeof document<"u"){o=()=>{const h=new URL(window.location.href),d=h.pathname.replace(r,"")||"/",v=ce(h.search);return{path:d,query:v}},s=o();const m=N(t,s.path);i=oe({path:s.path,params:m.params,query:s.query}),a=async(h=!1)=>{const d=o();await y(d.path,h)},window.addEventListener("popstate",()=>a(!0)),c=h=>y(h,!1),f=h=>y(h,!0),p=()=>window.history.back()}else{o=()=>{const h=new URL(n||"/","http://localhost"),d=h.pathname.replace(r,"")||"/",v=ce(h.search);return{path:d,query:v}},s=o();const m=N(t,s.path);i=oe({path:s.path,params:m.params,query:s.query}),a=async()=>{},c=async()=>{},f=async()=>{},p=()=>{}}return{store:i,push:c,replace:f,back:p,subscribe:i.subscribe,matchRoute:m=>N(t,m),getCurrent:()=>i.getState(),resolveRouteComponent:ke}}function ht(e,t){return N(e,t)}function gt(e){const t=$e(e);return le("router-view",{async render(){if(!t)return M`<div>Router not initialized.</div>`;const r=t.getCurrent(),{path:n}=r,o=t.matchRoute(n);if(!o.route)return M`<div>Not found</div>`;let s=o.route.component;if(o.route.load){const i=await o.route.load();typeof i.default=="string"&&(s=i.default)}return typeof s=="string"?{tag:s,props:{},children:[]}:M`<div>Invalid route component</div>`},onConnected(r){t&&typeof t.subscribe=="function"&&t.subscribe(()=>{typeof r.requestRender=="function"&&r.requestRender()})}}),le("router-link",{state:{},props:{to:{type:String,default:""},tag:{type:String,default:"a"},replace:{type:Boolean,default:!1},exact:{type:Boolean,default:!1},activeClass:{type:String,default:"active"},exactActiveClass:{type:String,default:"exact-active"},ariaCurrentValue:{type:String,default:"page"},disabled:{type:Boolean,default:!1},external:{type:Boolean,default:!1},style:{type:String,default:ue`
|
|
61
|
+
`);c=we(c);let f=o;f||(f=new CSSStyleSheet),(f.cssRules.length===0||f.toString()!==c)&&f.replaceSync(c),e.adoptedStyleSheets=[he(),f],s(f)}const ct=new Map;function le(e,t,r){let n=fe(e);n.includes("-")||(n=`cer-${n}`);let o;typeof t=="function"?o={...r,render:t}:o=t,typeof o.onError!="function"&&(o.onError=(s,i)=>{console.error(`[${n}] Error:`,s,i)}),ct.set(n,o),typeof window<"u"&&!customElements.get(n)&&customElements.define(n,ft(o))}function ft(e){if(!e.render)throw new Error("Component must have a render function");return typeof window>"u"?class{constructor(){}}:class extends HTMLElement{context;_refs={};_listeners=[];_watchers=new Map;_renderTimeoutId=null;_mounted=!1;_hasError=!1;_initializing=!0;_styleSheet=null;_lastHtmlStringForJitCSS="";get lastHtmlStringForJitCSS(){return this._lastHtmlStringForJitCSS}get isLoading(){return this._templateLoading}get lastError(){return this._templateError}_cfg;_lastRenderTime=0;_renderCount=0;_templateLoading=!1;_templateError=null;constructor(){super(),this.attachShadow({mode:"open"}),this._cfg=e;const t=this._initContext(e);Object.defineProperty(t,"refs",{value:this._refs,writable:!1,enumerable:!1,configurable:!1}),Object.defineProperty(t,"requestRender",{value:()=>this.requestRender(),writable:!1,enumerable:!1,configurable:!1}),this.context=t,this._applyProps(e),Object.defineProperty(this.context,"emit",{value:(r,n,o)=>{this.dispatchEvent(new CustomEvent(r,{detail:n,bubbles:!0,composed:!0,...o||{}}));const s=`on${r.charAt(0).toUpperCase()}${r.slice(1)}`,i=typeof this[s]=="function"?this[s]:void 0,a=typeof this.context[s]=="function"?this.context[s]:void 0,c=typeof e[s]=="function"?e[s]:void 0;i&&i(n,this.context),a&&a!==i&&a(n,this.context),c&&c!==i&&c!==a&&c(n,this.context)},writable:!1,enumerable:!1,configurable:!1}),Object.keys(e).forEach(r=>{const n=e[r];if(typeof n=="function"&&!r.startsWith("on"))this.context[r]=(...o)=>n(...o,this.context);else if(r.startsWith("on")&&r.length>2&&r[2]===r[2].toUpperCase()){const o=r.slice(2,3).toLowerCase()+r.slice(3);this.addEventListener(o,s=>{const i=typeof this[r]=="function"?this[r]:this.context[r];typeof i=="function"&&i(s.detail,this.context)})}}),this._applyComputed(e),this._initializing=!1,this._initWatchers(e),this._render(e)}connectedCallback(){this._runLogicWithinErrorBoundary(e,()=>{Oe(e,this.context,this._mounted,t=>{this._mounted=t})})}disconnectedCallback(){this._runLogicWithinErrorBoundary(e,()=>{Pe(e,this.context,this._listeners,()=>{this._listeners=[]},()=>{this._watchers.clear()},t=>{this._templateLoading=t},t=>{this._templateError=t},t=>{this._mounted=t})})}attributeChangedCallback(t,r,n){this._runLogicWithinErrorBoundary(e,()=>{this._applyProps(e),We(e,t,r,n,this.context)})}static get observedAttributes(){return e.props?Object.keys(e.props).map(fe):[]}_applyComputed(t){this._runLogicWithinErrorBoundary(e,()=>{t.computed&&Object.entries(t.computed).forEach(([r,n])=>{Object.defineProperty(this.context,r,{get:()=>{const o=n(this.context);return ie(o)},enumerable:!0})})})}_render(t){this._runLogicWithinErrorBoundary(t,()=>{st(this.shadowRoot,t,this.context,this._refs,r=>{this._lastHtmlStringForJitCSS=r,typeof this.onHtmlStringUpdate=="function"&&this.onHtmlStringUpdate(r)},r=>{this._templateLoading=r,typeof this.onLoadingStateChange=="function"&&this.onLoadingStateChange(r)},r=>{this._templateError=r,typeof this.onErrorStateChange=="function"&&this.onErrorStateChange(r)},r=>this._applyStyle(t,r))})}requestRender(){this._requestRender()}_requestRender(){this._runLogicWithinErrorBoundary(this._cfg,()=>{at(()=>this._render(this._cfg),this._lastRenderTime,this._renderCount,t=>{this._lastRenderTime=t},t=>{this._renderCount=t},this._renderTimeoutId,t=>{this._renderTimeoutId=t})})}_applyStyle(t,r){this._runLogicWithinErrorBoundary(t,()=>{lt(this.shadowRoot,t,this.context,r,this._styleSheet,n=>{this._styleSheet=n})})}_runLogicWithinErrorBoundary(t,r){this._hasError&&(this._hasError=!1);try{r()}catch(n){this._hasError=!0,t.onError&&t.onError(n,this.context),t.errorFallback&&this.shadowRoot&&(this.shadowRoot.innerHTML=t.errorFallback(n,this.context))}}_initContext(t){try{let r=function(o,s=""){return Array.isArray(o)?new Proxy(o,{get(i,a,c){const f=Reflect.get(i,a,c);return typeof f=="function"&&typeof a=="string"&&["push","pop","shift","unshift","splice","sort","reverse"].includes(a)?function(...g){const l=f.apply(i,g);if(!n._initializing){const b=s||"root";n._triggerWatchers(b,i),n._render(t)}return l}:f},set(i,a,c){if(i[a]=c,!n._initializing){const f=s?`${s}.${String(a)}`:String(a);n._triggerWatchers(f,c),n._render(t)}return!0},deleteProperty(i,a){if(delete i[a],!n._initializing){const c=s?`${s}.${String(a)}`:String(a);n._triggerWatchers(c,void 0),n._render(t)}return!0}}):o&&typeof o=="object"?(Object.keys(o).forEach(i=>{const a=s?`${s}.${i}`:i;o[i]=r(o[i],a)}),new Proxy(o,{set(i,a,c){const f=s?`${s}.${String(a)}`:String(a);return i[a]=r(c,f),n._initializing||(n._triggerWatchers(f,i[a]),n._render(t)),!0},get(i,a,c){return Reflect.get(i,a,c)}})):o};const n=this;return r({...t.state})}catch{return{}}}_initWatchers(t){this._runLogicWithinErrorBoundary(t,()=>{ze(this.context,this._watchers,t.watch||{})})}_triggerWatchers(t,r){Ne(this.context,this._watchers,t,r)}_applyProps(t){this._runLogicWithinErrorBoundary(t,()=>{try{Me(this,t,this.context)}catch(r){this._hasError=!0,t.onError&&t.onError(r,this.context),t.errorFallback&&this.shadowRoot&&(this.shadowRoot.innerHTML=t.errorFallback(r,this.context))}})}}}function F(e,t={},r,n){const o=n??t.key;return{tag:e,key:o,props:t,children:r}}function X(e){return!!e&&typeof e=="object"&&(e.type==="AnchorBlock"||e.tag==="#anchor")}function J(e){return typeof e=="object"&&e!==null&&"tag"in e&&!X(e)}function ut(e,t){return e.key!=null?e:{...e,key:t}}function dt(e,t=[],r={}){const n={},o={},s={},i=/([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;let a;for(;a=i.exec(e);){const c=a[1],f=a[2],p=(a[4]||a[6])??"",g=p.match(/^{{(\d+)}}$/);let l=g?t[Number(g[1])]??null:p;if(g||(l==="true"?l=!0:l==="false"?l=!1:l==="null"?l=null:isNaN(Number(l))||(l=Number(l))),c===":")typeof l=="boolean"?o[f]=l:l!=null&&(typeof r[l]<"u"?n[f]=r[l]:n[f]=l);else if(c==="@"){const b="on"+f.charAt(0).toUpperCase()+f.slice(1);n[b]=typeof l=="function"?l:typeof r[l]=="function"?r[l]:void 0}else if(c==="#"){const[b,...y]=f.split("."),m=[...y];let h=l,d=[...m];if(b==="model"&&typeof h=="string"&&h.includes(".")){const v=["trim","number","lazy"],x=h.split(".");let u=h;const $=[];for(let w=x.length-1;w>0&&v.includes(x[w]);w--)$.unshift(x[w]),u=x.slice(0,w).join(".");h=u,d.push(...$)}s[b]={value:h,modifiers:d}}else f==="ref"?n.ref=l:o[f]=l}return{props:n,attrs:o,directives:s}}function pt(e,t,r){const n=K.length>0?K[K.length-1]:void 0,o=r??n;function s(u,$){return F("#text",{},u,$)}let i="";for(let u=0;u<e.length;u++)i+=e[u],u<t.length&&(i+=`{{${u}}}`);const a=/<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g,c=[];let f,p=[],g=null,l={},b,y=0,m=[];function h(u){!u||typeof u!="object"||X(u)||(u.props||u.attrs?(u.props&&(l.props||(l.props={}),Object.assign(l.props,u.props)),u.attrs&&(l.attrs||(l.attrs={}),Object.keys(u.attrs).forEach($=>{if($==="style"&&l.attrs.style){const w=l.attrs.style.replace(/;?\s*$/,""),S=u.attrs.style.replace(/^;?\s*/,"");l.attrs.style=w+"; "+S}else if($==="class"&&l.attrs.class){const w=l.attrs.class.trim().split(/\s+/).filter(Boolean),S=u.attrs.class.trim().split(/\s+/).filter(Boolean),_=[...new Set([...w,...S])];l.attrs.class=_.join(" ")}else l.attrs[$]=u.attrs[$]}))):(l.props||(l.props={}),Object.assign(l.props,u)))}function d(u,$){const w=g?p:m;if(X(u)){const S=u.key??$;let _=u.children;w.push({...u,key:S,children:_});return}if(J(u)){w.push(ut(u,void 0));return}if(Array.isArray(u)){if(u.length===0)return;for(let S=0;S<u.length;S++){const _=u[S];X(_)||J(_)||Array.isArray(_)?d(_,`${$}-${S}`):_!==null&&typeof _=="object"?h(_):w.push(s(String(_),`${$}-${S}`))}return}if(u!==null&&typeof u=="object"){h(u);return}w.push(s(String(u),$))}const v=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);for(;f=a.exec(i);)if(f[1]){const u=f[1],$=f[0][1]==="/",w=f[0][f[0].length-2]==="/"||v.has(u),{props:S,attrs:_,directives:C}=dt(f[2]||"",t,o),k={props:{},attrs:{}};for(const A in S)k.props[A]=S[A];for(const A in _)k.attrs[A]=_[A];for(const[A,T]of Object.entries(C)){if(A==="bind")if(typeof T.value=="object"&&T.value!==null)for(const[E,j]of Object.entries(T.value))typeof j=="boolean"?k.attrs[E]=j:j!=null&&(k.attrs[E]=String(j));else T.value!=null&&(k.attrs[A]=String(T.value));if(["show","class","style"].includes(A)&&(k.directives||(k.directives={}),k.directives[A]=T),A==="show"){const E=!!T.value;k.attrs.style=(k.attrs.style||"")+(E?"":"; display: none !important")}else if(A==="class"){const E=T.value;let j=[];if(typeof E=="string")j=E.split(/\s+/).filter(Boolean);else if(Array.isArray(E)){for(const R of E)if(typeof R=="string")j.push(...R.split(/\s+/).filter(Boolean));else if(R&&typeof R=="object")for(const[z,V]of Object.entries(R))V&&j.push(...z.split(/\s+/).filter(Boolean))}else if(E&&typeof E=="object")for(const[R,z]of Object.entries(E))z&&j.push(...R.split(/\s+/).filter(Boolean));const q=k.attrs.class||"",I=[...new Set([...q.split(/\s+/).filter(Boolean),...j])];k.attrs.class=I.join(" ")}else if(A==="style"){const E=T.value;let j="";if(typeof E=="string")j=E;else if(E&&typeof E=="object"){const I=[];for(const[R,z]of Object.entries(E))if(z!=null&&z!==""){const V=R.replace(/[A-Z]/g,_e=>`-${_e.toLowerCase()}`),Se=["width","height","top","right","bottom","left","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","font-size","line-height","border-width","border-radius","min-width","max-width","min-height","max-height"];let de=String(z);typeof z=="number"&&Se.includes(V)&&(de=`${z}px`),I.push(`${V}: ${de}`)}j=I.join("; ")+(I.length>0?";":"")}const q=k.attrs.style||"";k.attrs.style=q+(q&&!q.endsWith(";")?"; ":"")+j}}const B={};for(const[A,T]of Object.entries(C))["bind","show","class","style"].includes(A)||(B[A]=T);if(Object.keys(B).length>0&&(k.directives=B),$){const A=F(g,l,p.length===1&&J(p[0])&&p[0].tag==="#text"?typeof p[0].children=="string"?p[0].children:"":p.length?p:void 0,b),T=c.pop();T?(g=T.tag,l=T.props,b=T.key,p=T.children,p.push(A)):(m.push(A),g=null,l={},b=void 0,p=[])}else w?g?p.push(F(u,k,void 0,void 0)):m.push(F(u,k,void 0,void 0)):(g&&c.push({tag:g,props:l,children:p,key:b}),g=u,l=k,p=[])}else if(typeof f[3]<"u"){const u=Number(f[3]),$=t[u],w=`interp-${u}`;d($,w)}else if(f[4]){const u=f[4],$=g?p:m,w=u.split(/({{\d+}})/);for(const S of w){if(!S)continue;const _=S.match(/^{{(\d+)}}$/);if(_){const C=Number(_[1]),k=t[C],B=`interp-${C}`;d(k,B)}else{const C=`text-${y++}`;$.push(s(S,C))}}}const x=m.filter(u=>J(u)&&u.tag==="#text"?typeof u.children=="string"&&u.children.trim()!=="":!0);return x.length===1?x[0]:x.length>1?x:F("div",{},"","fallback-root")}function M(e,...t){const r=t[t.length-1],n=typeof r=="object"&&r&&!Array.isArray(r)?r:void 0;return pt(e,t,n)}const ce=e=>e?typeof URLSearchParams>"u"?{}:Object.fromEntries(new URLSearchParams(e)):{},N=(e,t)=>{for(const r of e){const n=[],o=r.path.replace(/:[^/]+/g,a=>(n.push(a.slice(1)),"([^/]+)")),s=new RegExp(`^${o}$`),i=t.match(s);if(i){const a={};return n.forEach((c,f)=>{a[c]=i[f+1]}),{route:r,params:a}}}return{route:null,params:{}}},ne={};async function ke(e){if(e.component)return e.component;if(e.load){if(ne[e.path])return ne[e.path];try{const t=await e.load();return ne[e.path]=t.default,t.default}catch{throw new Error(`Failed to load component for route: ${e.path}`)}}throw new Error(`No component or loader defined for route: ${e.path}`)}function $e(e){const{routes:t,base:r="",initialUrl:n}=e;let o,s,i,a,c,f,p;const g=async(m,h)=>{const d=t.find(v=>N([v],m.path).route!==null);if(d?.beforeEnter)try{const v=await d.beforeEnter(m,h);return typeof v=="string"?(await y(v,!0),!1):v!==!1}catch(v){return console.error("beforeEnter error",v),!1}return!0},l=async(m,h)=>{const d=t.find(v=>N([v],m.path).route!==null);if(d?.onEnter)try{const v=await d.onEnter(m,h);return typeof v=="string"?(await y(v,!0),!1):v!==!1}catch(v){return console.error("onEnter error",v),!1}return!0},b=(m,h)=>{const d=t.find(v=>N([v],m.path).route!==null);if(d?.afterEnter)try{d.afterEnter(m,h)}catch(v){console.error("afterEnter error",v)}},y=async(m,h=!1)=>{try{const d={path:m.replace(r,"")||"/",query:{}},v=N(t,d.path);if(!v)throw new Error(`No route found for ${d.path}`);const x=i.getState(),u={path:d.path,params:v.params,query:d.query};if(!await g(u,x)||!await l(u,x))return;typeof window<"u"&&typeof document<"u"&&(h?window.history.replaceState({},"",r+m):window.history.pushState({},"",r+m)),i.setState(u),b(u,x)}catch(d){console.error("Navigation error:",d)}};if(typeof window<"u"&&typeof document<"u"){o=()=>{const h=new URL(window.location.href),d=h.pathname.replace(r,"")||"/",v=ce(h.search);return{path:d,query:v}},s=o();const m=N(t,s.path);i=oe({path:s.path,params:m.params,query:s.query}),a=async(h=!1)=>{const d=o();await y(d.path,h)},window.addEventListener("popstate",()=>a(!0)),c=h=>y(h,!1),f=h=>y(h,!0),p=()=>window.history.back()}else{o=()=>{const h=new URL(n||"/","http://localhost"),d=h.pathname.replace(r,"")||"/",v=ce(h.search);return{path:d,query:v}},s=o();const m=N(t,s.path);i=oe({path:s.path,params:m.params,query:s.query}),a=async()=>{},c=async()=>{},f=async()=>{},p=()=>{}}return{store:i,push:c,replace:f,back:p,subscribe:i.subscribe,matchRoute:m=>N(t,m),getCurrent:()=>i.getState(),resolveRouteComponent:ke}}function ht(e,t){return N(e,t)}function gt(e){const t=$e(e);return le("router-view",{async render(){if(!t)return M`<div>Router not initialized.</div>`;const r=t.getCurrent(),{path:n}=r,o=t.matchRoute(n);if(!o.route)return M`<div>Not found</div>`;let s=o.route.component;if(o.route.load){const i=await o.route.load();typeof i.default=="string"&&(s=i.default)}return typeof s=="string"?{tag:s,props:{},children:[]}:M`<div>Invalid route component</div>`},onConnected(r){t&&typeof t.subscribe=="function"&&t.subscribe(()=>{typeof r.requestRender=="function"&&r.requestRender()})}}),le("router-link",{state:{},props:{to:{type:String,default:""},tag:{type:String,default:"a"},replace:{type:Boolean,default:!1},exact:{type:Boolean,default:!1},activeClass:{type:String,default:"active"},exactActiveClass:{type:String,default:"exact-active"},ariaCurrentValue:{type:String,default:"page"},disabled:{type:Boolean,default:!1},external:{type:Boolean,default:!1},class:{type:String,default:""},style:{type:String,default:ue`
|
|
62
62
|
[aria-disabled="true"] {
|
|
63
63
|
pointer-events: none;
|
|
64
64
|
opacity: 0.5;
|
|
@@ -67,21 +67,21 @@ ${i}
|
|
|
67
67
|
${ve().when(h,M`
|
|
68
68
|
<button
|
|
69
69
|
part="button"
|
|
70
|
-
class="${y}"
|
|
70
|
+
:class="${r.class} ${y}"
|
|
71
71
|
${m}
|
|
72
72
|
${d}
|
|
73
73
|
${v}
|
|
74
|
-
|
|
74
|
+
@click="navigate"
|
|
75
75
|
><slot></slot></button>
|
|
76
76
|
`).otherwise(M`
|
|
77
77
|
<a
|
|
78
78
|
part="link"
|
|
79
79
|
href="${o}"
|
|
80
|
-
class="${y}"
|
|
80
|
+
:class="${r.class} ${y}"
|
|
81
81
|
${m}
|
|
82
82
|
${d}
|
|
83
83
|
${v}
|
|
84
|
-
|
|
84
|
+
@click="navigate"
|
|
85
85
|
><slot></slot></a>
|
|
86
86
|
`).done()}
|
|
87
87
|
`},navigate:(r,n)=>{const{disabled:o,external:s,tag:i,replace:a,to:c}=n.props;if(o){r.preventDefault();return}s&&(i==="a"||!i)||(r.preventDefault(),a?t.replace(c):t.push(c))}}),t}exports.GlobalEventBus=O;exports.component=le;exports.createStore=oe;exports.css=ue;exports.each=Ae;exports.emit=Te;exports.eventBus=H;exports.html=M;exports.initRouter=gt;exports.listen=Re;exports.match=ve;exports.matchRoute=N;exports.matchRouteSSR=ht;exports.off=Le;exports.on=je;exports.once=Be;exports.parseQuery=ce;exports.resolveRouteComponent=ke;exports.useRouter=$e;exports.when=Ce;
|