@erickxavier/no-js 1.0.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,7 +28,7 @@ No build step. No virtual DOM. No transpiler. No JSX. Just HTML.
28
28
  - **i18n** — `t` directive with pluralization
29
29
  - **Filters** — `uppercase`, `currency`, `date`, `truncate`, 30+ built-in pipes
30
30
  - **Custom Directives** — Extend with `NoJS.directive()`
31
- - **~11 KB gzipped** — Zero dependencies
31
+ - **~20 KB gzipped** — Zero dependencies
32
32
 
33
33
  ---
34
34
 
@@ -148,5 +148,5 @@ Contributions are welcome! Please open an issue or submit a pull request.
148
148
 
149
149
  <p align="center">
150
150
  <strong>No.JS</strong> — Because the best JavaScript is the JavaScript you don't write.<br>
151
- <code>~11 KB gzipped</code> · <code>Zero dependencies</code> · <code>MIT License</code>
151
+ <code>~20 KB gzipped</code> · <code>Zero dependencies</code> · <code>MIT License</code>
152
152
  </p>
package/dist/cjs/no.js CHANGED
@@ -1,12 +1,12 @@
1
1
  /**
2
- * No.JS v1.0.2 — The HTML-First Reactive Framework
2
+ * No.JS v1.2.0 — The HTML-First Reactive Framework
3
3
  * No more JavaScript. Just HTML attributes with superpowers.
4
4
  * @license MIT
5
5
  * @see https://github.com/erickillian/nojs
6
6
  */
7
- var ht=Object.defineProperty;var Pt=Object.getOwnPropertyDescriptor;var jt=Object.getOwnPropertyNames;var Ut=Object.prototype.hasOwnProperty;var Ft=(t,e)=>{for(var r in e)ht(t,r,{get:e[r],enumerable:!0})},qt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of jt(e))!Ut.call(t,o)&&o!==r&&ht(t,o,{get:()=>e[o],enumerable:!(n=Pt(e,o))||n.enumerable});return t};var Wt=t=>qt(ht({},"__esModule",{value:!0}),t);var te={};Ft(te,{default:()=>Zt});module.exports=Wt(te);var p={baseApiUrl:"",headers:{},timeout:1e4,retries:0,retryDelay:1e3,credentials:"same-origin",csrf:null,cache:{strategy:"none",ttl:3e5},templates:{cache:!0},router:{mode:"history",base:"/",scrollBehavior:"top"},i18n:{defaultLocale:"en",fallbackLocale:"en",detectBrowser:!1},debug:!1,devtools:!1,csp:null,sanitize:!0},rt={request:[],response:[]},G={},O={},wt=new Set,w={},Q={},gt=new Map,nt={},j=null;function vt(t){j=t}function k(...t){p.debug&&console.log("[No.JS]",...t)}function X(...t){console.warn("[No.JS]",...t)}function ot(){for(let t of wt)t()}function Z(t,e,r){e.$watch(r),typeof t=="string"&&t.includes("$store")&&wt.add(r)}function ft(t,e){(G[t]||[]).forEach(r=>r(e))}var yt=new Set;function At(t){return yt.add(t),()=>yt.delete(t)}var U={_locale:"en",locales:{},get locale(){return this._locale},set locale(t){this._locale!==t&&(this._locale=t,yt.forEach(e=>e()))},t(t,e={}){let r=U.locales[U.locale]||U.locales[p.i18n.fallbackLocale]||{},n=t.split(".").reduce((o,s)=>o?.[s],r);if(n==null)return t;if(typeof n=="string"&&n.includes("|")&&e.count!=null){let o=n.split("|").map(s=>s.trim());n=Number(e.count)===1?o[0]:o[1]||o[0]}return typeof n=="string"&&(n=n.replace(/\{(\w+)\}/g,(o,s)=>e[s]!=null?e[s]:"")),n}};var Jt=0,zt=new Set;function L(t={},e=null){let r=new Set,n={};Object.assign(n,t);let o=!1;function s(){if(!o){o=!0;try{Jt>0?r.forEach(f=>zt.add(f)):r.forEach(f=>f())}finally{o=!1}}}let i={get(f,u){if(u==="__isProxy")return!0;if(u==="__raw")return f;if(u==="__listeners")return r;if(u==="$watch")return c=>(r.add(c),()=>r.delete(c));if(u==="$notify")return s;if(u==="$set")return(c,l)=>{a[c]=l};if(u==="$parent")return e;if(u==="$refs")return nt;if(u==="$store")return O;if(u==="$route")return j?j.current:{};if(u==="$router")return j;if(u==="$i18n")return U;if(u==="$form")return f.$form||null;if(u in f)return f[u];if(e&&e.__isProxy)return e[u]},set(f,u,c){let l=f[u];return f[u]=c,l!==c&&s(),!0},has(f,u){return u in f?!0:e&&e.__isProxy?u in e:!1}},a=new Proxy(n,i);return a}function _t(t){let e=new Set,r={},n=t;for(;n&&n.__isProxy;){let o=n.__raw;for(let s of Object.keys(o))e.has(s)||(e.add(s),r[s]=o[s]);n=n.$parent}return{keys:[...e],vals:r}}var Et=new Map;function V(t,e,r){let n={};for(let u=0;u<e.length;u++)n[e[u]]=r[u];function o(u,c){return u.split(".").reduce((l,d)=>l?.[d],c)}function s(u){let c=u.trim();if(c==="true")return!0;if(c==="false")return!1;if(c==="null")return null;if(c!=="undefined")return/^-?\d+(\.\d+)?$/.test(c)?Number(c):/^(['"`]).*\1$/.test(c)?c.slice(1,-1):o(c,n)}let i=t.trim(),a=i.match(/^(.+?)\s*\?\s*(.+?)\s*:\s*(.+)$/);if(a){let u=V(a[1].trim(),e,r);return V(u?a[2].trim():a[3].trim(),e,r)}if(i.includes("||")){let u=i.split("||");for(let c of u){let l=V(c.trim(),e,r);if(l)return l}return V(u[u.length-1].trim(),e,r)}if(i.includes("&&")){let u=i.split("&&"),c;for(let l of u)if(c=V(l.trim(),e,r),!c)return c;return c}let f=i.match(/^(.+?)\s*(===|!==|==|!=|>=|<=|>|<)\s*(.+)$/);if(f){let u=s(f[1]),c=s(f[3]);switch(f[2]){case"===":return u===c;case"!==":return u!==c;case"==":return u==c;case"!=":return u!=c;case">=":return u>=c;case"<=":return u<=c;case">":return u>c;case"<":return u<c}}return i.startsWith("!")?!V(i.slice(1).trim(),e,r):s(i)}function Kt(t){let e=[],r="",n=0,o=!1,s="";for(let i=0;i<t.length;i++){let a=t[i];if(o){r+=a,a===s&&t[i-1]!=="\\"&&(o=!1);continue}if(a==="'"||a==='"'||a==="`"){o=!0,s=a,r+=a;continue}if(a==="("||a==="["||a==="{"){n++,r+=a;continue}if(a===")"||a==="]"||a==="}"){n--,r+=a;continue}if(a==="|"&&n===0&&t[i+1]!=="|"&&t[i-1]!=="|"){e.push(r.trim()),r="";continue}r+=a}return e.push(r.trim()),e}function Xt(t,e){let r=e.indexOf(":"),n,o;r===-1?(n=e.trim(),o=null):(n=e.substring(0,r).trim(),o=e.substring(r+1).trim());let s=w[n];if(!s)return X(`Unknown filter: ${n}`),t;let i=o?Vt(o):[];return s(t,...i)}function Vt(t){let e=[],r="",n=!1,o="";for(let s of t){if(n){if(s===o){n=!1;continue}r+=s;continue}if(s==="'"||s==='"'){n=!0,o=s;continue}if(s===","){e.push(r.trim()),r="";continue}r+=s}return r.trim()&&e.push(r.trim()),e.map(s=>{let i=Number(s);return isNaN(i)?s:i})}function _(t,e){if(!(t==null||t===""))try{let r=Kt(t),n=r[0],{keys:o,vals:s}=_t(e),i=["$store","$route","$router","$i18n","$refs","$form"];for(let c of i)o.includes(c)||(o.push(c),s[c]=e[c]);let a=o,f=a.map(c=>s[c]),u;if(p.csp==="strict")u=V(n,a,f);else{let c=n+"|"+a.join(","),l=Et.get(c);l||(l=new Function(...a,`return (${n})`),Et.set(c,l)),u=l(...f)}for(let c=1;c<r.length;c++)u=Xt(u,r[c]);return u}catch{return}}function F(t,e,r={}){try{let{keys:n,vals:o}=_t(e),s={$store:O,$route:j?.current,$router:j,$i18n:U,$refs:e.$refs};Object.assign(s,r);for(let[d,m]of Object.entries(s))n.includes(d)||(n.push(d),o[d]=m);let i=[...n],a=i.map(d=>o[d]),f=new Set,u=e;for(;u&&u.__isProxy;){for(let d of Object.keys(u.__raw))f.add(d);u=u.$parent}let c=[...f].filter(d=>!d.startsWith("$")).map(d=>`{let _c=__ctx;while(_c&&_c.__isProxy){if('${d}'in _c.__raw){_c.$set('${d}',typeof ${d}!=='undefined'?${d}:_c.__raw['${d}']);break;}_c=_c.$parent;}}`).join(`
8
- `);new Function("__ctx",...i,`${t};
9
- ${c}`)(e,...a),typeof t=="string"&&t.includes("$store")&&ot()}catch(n){X("Expression error:",t,n.message),r.$el&&r.$el.dispatchEvent(new CustomEvent("nojs:error",{bubbles:!0,detail:{message:n.message,error:n}}))}}function tt(t,e){return t.split(".").reduce((r,n)=>r?.[n],e)}function Y(t,e){return t.replace(/\{([^}]+)\}/g,(r,n)=>{let o=_(n.trim(),e);return o??""})}function bt(t,e){if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"))return t;let r=e;for(;r;){let n=r.getAttribute?.("base");if(n)return n.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,"");r=r.parentElement}return p.baseApiUrl?p.baseApiUrl.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):t}async function dt(t,e="GET",r=null,n={},o=null,s=null){let i=bt(t,o),a={method:e.toUpperCase(),headers:{...p.headers||{},...n},credentials:p.credentials};if(r&&e!=="GET")if(typeof r=="string")try{JSON.parse(r),a.headers["Content-Type"]="application/json",a.body=r}catch{a.body=r}else r instanceof FormData?a.body=r:(a.headers["Content-Type"]="application/json",a.body=JSON.stringify(r));p.csrf&&e!=="GET"&&(a.headers[p.csrf.header||"X-CSRF-Token"]=p.csrf.token||"");for(let c of rt.request)a=c(i,a)||a;let f=p.retries||0,u;for(let c=0;c<=f;c++)try{let l=new AbortController,d=setTimeout(()=>l.abort(),p.timeout||1e4);if(s){if(s.aborted)throw clearTimeout(d),new DOMException("Aborted","AbortError");s.addEventListener("abort",()=>l.abort(),{once:!0})}a.signal=l.signal;let m=await fetch(i,a);clearTimeout(d);for(let y of rt.response)m=y(m,i)||m;if(!m.ok){let y=await m.json().catch(()=>({})),b=new Error(y.message||`HTTP ${m.status}`);throw b.status=m.status,b.body=y,b}let h=await m.text();try{return JSON.parse(h)}catch{return h}}catch(l){if(l.name==="AbortError")throw l;u=l,c<f&&await new Promise(d=>setTimeout(d,p.retryDelay||1e3))}throw u}function xt(t,e){if(e==="none")return null;if(e==="memory"){let n=gt.get(t);return n&&Date.now()-n.time<(p.cache.ttl||3e5)?n.data:null}let r=e==="local"?localStorage:e==="session"?sessionStorage:null;if(!r)return null;try{let n=r.getItem("nojs_cache_"+t);if(!n)return null;let o=JSON.parse(n);if(Date.now()-o.time<(p.cache.ttl||3e5))return o.data;r.removeItem("nojs_cache_"+t)}catch{}return null}function Lt(t,e,r){if(r==="none")return;let n={data:e,time:Date.now()};if(r==="memory"){gt.set(t,n);return}let o=r==="local"?localStorage:r==="session"?sessionStorage:null;if(o)try{o.setItem("nojs_cache_"+t,JSON.stringify(n))}catch{}}var it=new Map;function v(t){let e=t;for(;e;){if(e.__ctx)return e.__ctx;e=e.parentElement}return L()}function z(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();)e.currentNode.__declared=!1}function M(t){if(!t)return null;let e=t.startsWith("#")?t.slice(1):t,r=document.getElementById(e);return r&&r.content?r.content.cloneNode(!0):null}function Tt(t){return p.sanitize?t.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/on\w+\s*=/gi,"data-blocked=").replace(/javascript:/gi,""):t}function Ct(t,e){if(t.startsWith("./")){let r=e.parentNode;for(;r;){if(r.__srcBase)return r.__srcBase+t.slice(2);r=r.parentNode}return t.slice(2)}return bt(t,e)}async function $t(t){let e=t||document,r=e.querySelectorAll("template[src]");if(k("[LRT] called on",e===document?"document":e.nodeName||"fragment","\u2014 found",r.length,"template[src]",[...r].map(o=>o.getAttribute("src"))),!r.length)return;let n=[...r].map(async o=>{if(o.__srcLoaded){k("[LRT] SKIP (already loaded):",o.getAttribute("src"));return}o.__srcLoaded=!0;let s=o.getAttribute("src"),i=Ct(s,o),a=i.substring(0,i.lastIndexOf("/")+1);try{let f=p.templates.cache!==!1,u;if(f&&it.has(i)?(u=it.get(i),k("[LRT] CACHE HIT:",i)):(u=await(await fetch(i)).text(),f&&it.set(i,u)),o.innerHTML=u,o.content&&(o.content.__srcBase=a),k("Loaded remote template:",s,"\u2192",i),await $t(o.content||o),!o.hasAttribute("route")&&o.parentNode){let l=[...o.content.childNodes],d=o.parentNode,m=o.nextSibling;d.removeChild(o);for(let h of l)h.nodeType===1&&(h.__srcBase=h.__srcBase||a),d.insertBefore(h,m)}}catch(f){X("Failed to load template:",s,f.message)}});await Promise.all(n)}async function st(t){let e=t.getAttribute("src");if(t.__srcLoaded){k("[LTE] SKIP (already loaded):",e);return}k("[LTE] START fetch:",e,"| route:",t.hasAttribute("route"),"| inDOM:",document.contains(t),"| loading:",t.getAttribute("loading")),t.__srcLoaded=!0;let r=Ct(e,t),n=r.substring(0,r.lastIndexOf("/")+1),o=null,s=t.getAttribute("loading");if(s&&t.parentNode){let i=s.startsWith("#")?s.slice(1):s,a=document.getElementById(i);a&&a.content&&(o=document.createElement("span"),o.style.cssText="display:contents",o.appendChild(a.content.cloneNode(!0)),t.parentNode.insertBefore(o,t))}try{let i=p.templates.cache!==!1,a;if(i&&it.has(r)?(a=it.get(r),k("[LTE] CACHE HIT:",r)):(a=await(await fetch(r)).text(),i&&it.set(r,a)),t.innerHTML=a,t.content&&(t.content.__srcBase=n),k("Loaded remote template:",e,"\u2192",r),t.hasAttribute("route")||await $t(t.content||t),o&&o.remove(),!t.hasAttribute("route")&&t.parentNode){let u=[...t.content.childNodes],c=t.parentNode,l=t.nextSibling;c.removeChild(t);for(let d of u)d.nodeType===1&&(d.__srcBase=d.__srcBase||n),c.insertBefore(d,l)}}catch(i){o&&o.remove(),X("Failed to load template:",e,i.message)}}function mt(t){(t||document).querySelectorAll("template[include]").forEach(r=>{let n=r.getAttribute("include"),o=document.getElementById(n.startsWith("#")?n.slice(1):n);!o||!o.content||r.replaceWith(o.content.cloneNode(!0))})}async function St(t){let e=[...document.querySelectorAll("template[src]")],r=e.filter(o=>!o.__srcLoaded&&o.getAttribute("lazy")==="priority");await Promise.all(r.map(st));let n=e.filter(o=>{if(o.__srcLoaded)return!1;let s=o.getAttribute("lazy");return s==="ondemand"||s==="priority"?!1:o.hasAttribute("route")?t!=null&&o.getAttribute("route")===t:!0});await Promise.all(n.map(st))}function Nt(){let e=[...document.querySelectorAll("template[src]")].filter(r=>r.__srcLoaded||r.getAttribute("lazy")==="ondemand"?!1:r.hasAttribute("route"));return Promise.all(e.map(st))}var ut=new Map;function A(t,e){ut.set(t,{priority:e.priority??50,init:e.init})}function Yt(t){if(ut.has(t))return{directive:ut.get(t),match:t};let e=["class-*","on:*","style-*","bind-*"];for(let r of e){let n=r.replace("*","");if(t.startsWith(n)&&ut.has(r))return{directive:ut.get(r),match:r}}return null}function It(t){if(t.__declared)return;t.__declared=!0;let e=[];for(let r of[...t.attributes]){let n=Yt(r.name);n&&e.push({name:r.name,value:r.value,priority:n.directive.priority,init:n.directive.init})}e.sort((r,n)=>r.priority-n.priority);for(let r of e)r.init(t,r.name,r.value)}function T(t){if(!t)return;t.nodeType===1&&!t.__declared&&It(t);let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let r=e.currentNode;r.tagName==="TEMPLATE"||r.tagName==="SCRIPT"||r.__declared||It(r)}}var Dt=!1;function Mt(){if(Dt||typeof document>"u")return;Dt=!0;let t=`
7
+ var Ht=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var ve=Object.prototype.hasOwnProperty;var Yt=(t,e)=>()=>(t&&(e=t(t=0)),e);var Vt=(t,e)=>{for(var r in e)Ht(t,r,{get:e[r],enumerable:!0})},Ee=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of _e(e))!ve.call(t,o)&&o!==r&&Ht(t,o,{get:()=>e[o],enumerable:!(n=ye(e,o))||n.enumerable});return t};var xe=t=>Ee(Ht({},"__esModule",{value:!0}),t);function Rt(t){ct=t}function Gt(t){tt=t}function K(...t){h.debug&&console.log("[No.JS]",...t)}function st(...t){console.warn("[No.JS]",...t)}function xt(){for(let t of Ct){if(t._el&&!t._el.isConnected){Ct.delete(t);continue}t()}}function W(t,e,r){e.$watch(r),typeof t=="string"&&t.includes("$store")&&Ct.add(r)}function G(t){ct&&(ct.__disposers=ct.__disposers||[],ct.__disposers.push(t))}function Dt(t,e){(ht[t]||[]).forEach(r=>r(e))}var h,Et,ht,Y,Ct,N,bt,Pt,ut,tt,ct,J=Yt(()=>{h={baseApiUrl:"",headers:{},timeout:1e4,retries:0,retryDelay:1e3,credentials:"same-origin",csrf:null,cache:{strategy:"none",ttl:3e5},templates:{cache:!0},router:{mode:"history",base:"/",scrollBehavior:"top",templates:"pages",ext:".tpl"},i18n:{defaultLocale:"en",fallbackLocale:"en",detectBrowser:!1,loadPath:null,ns:[],cache:!0,persist:!1},debug:!1,devtools:!1,csp:null,sanitize:!0},Et={request:[],response:[]},ht={},Y={},Ct=new Set,N={},bt={},Pt=new Map,ut={},tt=null,ct=null});var Qt={};Vt(Qt,{_deepMerge:()=>Ut,_i18n:()=>q,_i18nCache:()=>Ft,_i18nListeners:()=>yt,_loadI18nForLocale:()=>Wt,_loadI18nNamespace:()=>zt,_loadLocale:()=>St,_loadedNs:()=>qt,_notifyI18n:()=>Tt,_watchI18n:()=>$t});function $t(t){return yt.add(t),()=>yt.delete(t)}function Tt(){for(let t of yt){if(t._el&&!t._el.isConnected){yt.delete(t);continue}t()}}function Ut(t,e){let r={...t};for(let n of Object.keys(e))e[n]&&typeof e[n]=="object"&&!Array.isArray(e[n])&&t[n]&&typeof t[n]=="object"&&!Array.isArray(t[n])?r[n]=Ut(t[n],e[n]):r[n]=e[n];return r}async function St(t,e){let r=e?`${t}:${e}`:t;if(h.i18n.cache&&Ft.has(r))return;let n=h.i18n.loadPath.replace("{locale}",t);if(e)n=n.replace("{ns}",e);else if(n.includes("{ns}"))return;try{let o=await fetch(n);if(!o.ok){st(`i18n: failed to load ${n} (${o.status})`);return}let i=await o.json();q.locales[t]=Ut(q.locales[t]||{},i),h.i18n.cache&&Ft.set(r,i)}catch(o){st(`i18n: error loading ${n}`,o)}}async function Wt(t){if(!h.i18n.loadPath)return;let e=h.i18n.ns;!e.length||!h.i18n.loadPath.includes("{ns}")?await St(t,null):await Promise.all(e.map(r=>St(t,r)))}async function zt(t){if(!h.i18n.loadPath)return;qt.add(t);let e=new Set([q.locale,h.i18n.fallbackLocale]);await Promise.all([...e].map(r=>St(r,t)))}var yt,Ft,qt,q,pt=Yt(()=>{J();yt=new Set;Ft=new Map,qt=new Set;q={_locale:"en",locales:{},get locale(){return this._locale},set locale(t){if(this._locale!==t){if(this._locale=t,h.i18n.persist&&typeof localStorage<"u")try{localStorage.setItem("nojs-locale",t)}catch{}if(h.i18n.loadPath){let e=new Set([...h.i18n.ns,...qt]);Promise.all([...e].map(r=>St(t,r))).then(()=>Tt())}else Tt()}},t(t,e={}){let r=q.locales[q.locale]||q.locales[h.i18n.fallbackLocale]||{},n=t.split(".").reduce((o,i)=>o?.[i],r);if(n==null)return t;if(typeof n=="string"&&n.includes("|")&&e.count!=null){let o=n.split("|").map(i=>i.trim());n=Number(e.count)===1?o[0]:o[1]||o[0]}return typeof n=="string"&&(n=n.replace(/\{(\w+)\}/g,(o,i)=>e[i]!=null?e[i]:"")),n}}});var ke={};Vt(ke,{default:()=>Ne});module.exports=xe(ke);J();pt();J();pt();var Ae=0,we=new Set;function O(t={},e=null){let r=new Set,n={};Object.assign(n,t);let o=!1;function i(){if(!o){o=!0;try{if(Ae>0)for(let c of r){if(c._el&&!c._el.isConnected){r.delete(c);continue}we.add(c)}else for(let c of r){if(c._el&&!c._el.isConnected){r.delete(c);continue}c()}}finally{o=!1}}}let s={get(c,d){if(d==="__isProxy")return!0;if(d==="__raw")return c;if(d==="__listeners")return r;if(d==="$watch")return f=>(ct&&(f._el=ct),r.add(f),()=>r.delete(f));if(d==="$notify")return i;if(d==="$set")return(f,l)=>{let p=f.split(".");if(p.length===1)a[f]=l;else{let u=a;for(let v=0;v<p.length-1;v++)if(u=u[p[v]],u==null)return;let m=p[p.length-1],L=u[m];u[m]=l,L!==l&&i()}};if(d==="$parent")return e;if(d==="$refs")return ut;if(d==="$store")return Y;if(d==="$route")return tt?tt.current:{};if(d==="$router")return tt;if(d==="$i18n")return q;if(d==="$form")return c.$form||null;if(d in c)return c[d];if(e&&e.__isProxy)return e[d]},set(c,d,f){let l=c[d];return c[d]=f,l!==f&&i(),!0},has(c,d){return d in c?!0:e&&e.__isProxy?d in e:!1}},a=new Proxy(n,s);return a}function Kt(t){let e=new Set,r={},n=t;for(;n&&n.__isProxy;){let o=n.__raw;for(let i of Object.keys(o))e.has(i)||(e.add(i),r[i]=o[i]);n=n.$parent}return{keys:[...e],vals:r}}J();pt();var Zt=new Map;function mt(t,e,r){let n={};for(let d=0;d<e.length;d++)n[e[d]]=r[d];function o(d,f){return d.split(".").reduce((l,p)=>l?.[p],f)}function i(d){let f=d.trim();if(f==="true")return!0;if(f==="false")return!1;if(f==="null")return null;if(f!=="undefined")return/^-?\d+(\.\d+)?$/.test(f)?Number(f):/^(['"`]).*\1$/.test(f)?f.slice(1,-1):o(f,n)}let s=t.trim(),a=s.match(/^(.+?)\s*\?\s*(.+?)\s*:\s*(.+)$/);if(a){let d=mt(a[1].trim(),e,r);return mt(d?a[2].trim():a[3].trim(),e,r)}if(s.includes("||")){let d=s.split("||");for(let f of d){let l=mt(f.trim(),e,r);if(l)return l}return mt(d[d.length-1].trim(),e,r)}if(s.includes("&&")){let d=s.split("&&"),f;for(let l of d)if(f=mt(l.trim(),e,r),!f)return f;return f}let c=s.match(/^(.+?)\s*(===|!==|==|!=|>=|<=|>|<)\s*(.+)$/);if(c){let d=i(c[1]),f=i(c[3]);switch(c[2]){case"===":return d===f;case"!==":return d!==f;case"==":return d==f;case"!=":return d!=f;case">=":return d>=f;case"<=":return d<=f;case">":return d>f;case"<":return d<f}}return s.startsWith("!")?!mt(s.slice(1).trim(),e,r):i(s)}function Le(t){let e=[],r="",n=0,o=!1,i="";for(let s=0;s<t.length;s++){let a=t[s];if(o){r+=a,a===i&&t[s-1]!=="\\"&&(o=!1);continue}if(a==="'"||a==='"'||a==="`"){o=!0,i=a,r+=a;continue}if(a==="("||a==="["||a==="{"){n++,r+=a;continue}if(a===")"||a==="]"||a==="}"){n--,r+=a;continue}if(a==="|"&&n===0&&t[s+1]!=="|"&&t[s-1]!=="|"){e.push(r.trim()),r="";continue}r+=a}return e.push(r.trim()),e}function Ce(t,e){let r=e.indexOf(":"),n,o;r===-1?(n=e.trim(),o=null):(n=e.substring(0,r).trim(),o=e.substring(r+1).trim());let i=N[n];if(!i)return st(`Unknown filter: ${n}`),t;let s=o?Te(o):[];return i(t,...s)}function Te(t){let e=[],r="",n=!1,o="";for(let i of t){if(n){if(i===o){n=!1;continue}r+=i;continue}if(i==="'"||i==='"'){n=!0,o=i;continue}if(i===","){e.push(r.trim()),r="";continue}r+=i}return r.trim()&&e.push(r.trim()),e.map(i=>{let s=Number(i);return isNaN(s)?i:s})}function x(t,e){if(!(t==null||t===""))try{let r=Le(t),n=r[0],{keys:o,vals:i}=Kt(e),s=["$store","$route","$router","$i18n","$refs","$form"];for(let f of s)o.includes(f)||(o.push(f),i[f]=e[f]);let a=o,c=a.map(f=>i[f]),d;if(h.csp==="strict")d=mt(n,a,c);else{let f=n+"|"+a.join(","),l=Zt.get(f);l||(l=new Function(...a,`return (${n})`),Zt.set(f,l)),d=l(...c)}for(let f=1;f<r.length;f++)d=Ce(d,r[f]);return d}catch{return}}function Q(t,e,r={}){try{let{keys:n,vals:o}=Kt(e),i={$store:Y,$route:tt?.current,$router:tt,$i18n:q,$refs:e.$refs};Object.assign(i,r);for(let[u,m]of Object.entries(i))n.includes(u)||(n.push(u),o[u]=m);let s=[...n],a=s.map(u=>o[u]),c=new Set,d=e;for(;d&&d.__isProxy;){for(let u of Object.keys(d.__raw))c.add(u);d=d.$parent}let f={};for(let u of c)!u.startsWith("$")&&u in o&&(f[u]=o[u]);let l=[...c].filter(u=>!u.startsWith("$")).map(u=>`{let _c=__ctx;while(_c&&_c.__isProxy){if('${u}'in _c.__raw){if(typeof ${u}!=='undefined'){if(${u}!==__orig['${u}'])_c.$set('${u}',${u});else if(typeof ${u}==='object'&&${u}!==null)_c.$notify();}break;}_c=_c.$parent;}}`).join(`
8
+ `);new Function("__ctx","__orig",...s,`${t};
9
+ ${l}`)(e,f,...a),typeof t=="string"&&t.includes("$store")&&xt()}catch(n){st("Expression error:",t,n.message),r.$el&&r.$el.dispatchEvent(new CustomEvent("nojs:error",{bubbles:!0,detail:{message:n.message,error:n}}))}}function rt(t,e){return t.split(".").reduce((r,n)=>r?.[n],e)}function gt(t,e){return t.replace(/\{([^}]+)\}/g,(r,n)=>{let o=x(n.trim(),e);return o??""})}J();J();function Jt(t,e){if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"))return t;let r=e;for(;r;){let n=r.getAttribute?.("base");if(n)return n.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,"");r=r.parentElement}return h.baseApiUrl?h.baseApiUrl.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):t}async function Nt(t,e="GET",r=null,n={},o=null,i=null){let s=Jt(t,o),a={method:e.toUpperCase(),headers:{...h.headers||{},...n},credentials:h.credentials};if(r&&e!=="GET")if(typeof r=="string")try{JSON.parse(r),a.headers["Content-Type"]="application/json",a.body=r}catch{a.body=r}else r instanceof FormData?a.body=r:(a.headers["Content-Type"]="application/json",a.body=JSON.stringify(r));h.csrf&&e!=="GET"&&(a.headers[h.csrf.header||"X-CSRF-Token"]=h.csrf.token||"");for(let f of Et.request)a=f(s,a)||a;let c=h.retries||0,d;for(let f=0;f<=c;f++)try{let l=new AbortController,p=setTimeout(()=>l.abort(),h.timeout||1e4);if(i){if(i.aborted)throw clearTimeout(p),new DOMException("Aborted","AbortError");i.addEventListener("abort",()=>l.abort(),{once:!0})}a.signal=l.signal;let u=await fetch(s,a);clearTimeout(p);for(let L of Et.response)u=L(u,s)||u;if(!u.ok){let L=await u.json().catch(()=>({})),v=new Error(L.message||`HTTP ${u.status}`);throw v.status=u.status,v.body=L,v}let m=await u.text();try{return JSON.parse(m)}catch{return m}}catch(l){if(l.name==="AbortError")throw l;d=l,f<c&&await new Promise(p=>setTimeout(p,h.retryDelay||1e3))}throw d}function te(t,e){if(e==="none")return null;if(e==="memory"){let n=Pt.get(t);return n&&Date.now()-n.time<(h.cache.ttl||3e5)?n.data:null}let r=e==="local"?localStorage:e==="session"?sessionStorage:null;if(!r)return null;try{let n=r.getItem("nojs_cache_"+t);if(!n)return null;let o=JSON.parse(n);if(Date.now()-o.time<(h.cache.ttl||3e5))return o.data;r.removeItem("nojs_cache_"+t)}catch{}return null}function ee(t,e,r){if(r==="none")return;let n={data:e,time:Date.now()};if(r==="memory"){Pt.set(t,n);return}let o=r==="local"?localStorage:r==="session"?sessionStorage:null;if(o)try{o.setItem("nojs_cache_"+t,JSON.stringify(n))}catch{}}var At=new Map;function $(t){let e=t;for(;e;){if(e.__ctx)return e.__ctx;e=e.parentElement}return O()}function dt(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();)e.currentNode.__declared=!1}function z(t){if(!t)return null;let e=t.startsWith("#")?t.slice(1):t,r=document.getElementById(e);return r&&r.content?r.content.cloneNode(!0):null}function re(t){return h.sanitize?t.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/on\w+\s*=/gi,"data-blocked=").replace(/javascript:/gi,""):t}function ne(t,e){if(t.startsWith("./")){let r=e.parentNode;for(;r;){if(r.__srcBase)return r.__srcBase+t.slice(2);r=r.parentNode}return t.slice(2)}return Jt(t,e)}async function oe(t){let e=t||document,r=e.querySelectorAll("template[src]");if(K("[LRT] called on",e===document?"document":e.nodeName||"fragment","\u2014 found",r.length,"template[src]",[...r].map(o=>o.getAttribute("src"))),!r.length)return;let n=[...r].map(async o=>{if(o.__srcLoaded){K("[LRT] SKIP (already loaded):",o.getAttribute("src"));return}o.__srcLoaded=!0;let i=o.getAttribute("src"),s=ne(i,o),a=s.substring(0,s.lastIndexOf("/")+1);try{let c=h.templates.cache!==!1,d;if(c&&At.has(s)?(d=At.get(s),K("[LRT] CACHE HIT:",s)):(d=await(await fetch(s)).text(),c&&At.set(s,d)),o.innerHTML=d,o.content&&(o.content.__srcBase=a),K("Loaded remote template:",i,"\u2192",s),await oe(o.content||o),!o.hasAttribute("route")&&o.parentNode){let l=[...o.content.childNodes],p=o.parentNode,u=o.nextSibling;p.removeChild(o);for(let m of l)m.nodeType===1&&(m.__srcBase=m.__srcBase||a),p.insertBefore(m,u)}}catch(c){st("Failed to load template:",i,c.message)}});await Promise.all(n)}async function wt(t){let e=t.getAttribute("src");if(t.__srcLoaded){K("[LTE] SKIP (already loaded):",e);return}K("[LTE] START fetch:",e,"| route:",t.hasAttribute("route"),"| inDOM:",document.contains(t),"| loading:",t.getAttribute("loading")),t.__srcLoaded=!0;let r=ne(e,t),n=r.substring(0,r.lastIndexOf("/")+1),o=null,i=t.getAttribute("loading");if(i&&t.parentNode){let s=i.startsWith("#")?i.slice(1):i,a=document.getElementById(s);a&&a.content&&(o=document.createElement("span"),o.style.cssText="display:contents",o.appendChild(a.content.cloneNode(!0)),t.parentNode.insertBefore(o,t))}try{let s=h.templates.cache!==!1,a;if(s&&At.has(r)?(a=At.get(r),K("[LTE] CACHE HIT:",r)):(a=await(await fetch(r)).text(),s&&At.set(r,a)),t.innerHTML=a,t.content&&(t.content.__srcBase=n),K("Loaded remote template:",e,"\u2192",r),t.hasAttribute("route")||await oe(t.content||t),o&&o.remove(),!t.hasAttribute("route")&&t.parentNode){let d=[...t.content.childNodes],f=t.parentNode,l=t.nextSibling;f.removeChild(t);for(let p of d)p.nodeType===1&&(p.__srcBase=p.__srcBase||n),f.insertBefore(p,l)}}catch(s){o&&o.remove(),st("Failed to load template:",e,s.message)}}function kt(t){(t||document).querySelectorAll("template[include]").forEach(r=>{let n=r.getAttribute("include"),o=document.getElementById(n.startsWith("#")?n.slice(1):n);!o||!o.content||r.replaceWith(o.content.cloneNode(!0))})}async function ie(t){let e=[...document.querySelectorAll("template[src]")],r=e.filter(o=>!o.__srcLoaded&&o.getAttribute("lazy")==="priority");await Promise.all(r.map(wt));let n=e.filter(o=>{if(o.__srcLoaded)return!1;let i=o.getAttribute("lazy");return i==="ondemand"||i==="priority"?!1:o.hasAttribute("route")?t!=null&&o.getAttribute("route")===t:!0});await Promise.all(n.map(wt))}function se(){let e=[...document.querySelectorAll("template[src]")].filter(r=>r.__srcLoaded||r.getAttribute("lazy")==="ondemand"?!1:r.hasAttribute("route"));return Promise.all(e.map(wt))}J();pt();var It=new Map;function S(t,e){It.set(t,{priority:e.priority??50,init:e.init})}function Se(t){if(It.has(t))return{directive:It.get(t),match:t};let e=["class-*","on:*","style-*","bind-*"];for(let r of e){let n=r.replace("*","");if(t.startsWith(n)&&It.has(r))return{directive:It.get(r),match:r}}return null}function ae(t){if(t.__declared)return;t.__declared=!0;let e=[];for(let n of[...t.attributes]){let o=Se(n.name);o&&e.push({name:n.name,value:n.value,priority:o.directive.priority,init:o.directive.init})}e.sort((n,o)=>n.priority-o.priority);let r=ct;for(let n of e)Rt(t),n.init(t,n.name,n.value);Rt(r)}function B(t){if(!t)return;t.nodeType===1&&!t.__declared&&ae(t);let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let r=e.currentNode;r.tagName==="TEMPLATE"||r.tagName==="SCRIPT"||r.__declared||ae(r)}}function ce(t){if(t.__ctx&&t.__ctx.__listeners){for(let e of t.__ctx.__listeners)Ct.delete(e),yt.delete(e);t.__ctx.__listeners.clear()}t.__disposers&&(t.__disposers.forEach(e=>e()),t.__disposers=null),t.__declared=!1}function le(t){if(!t)return;ce(t);let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();)ce(e.currentNode)}J();var de=!1;function fe(){if(de||typeof document>"u")return;de=!0;let t=`
10
10
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
11
11
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
12
12
  @keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@@ -21,5 +21,44 @@ ${c}`)(e,...a),typeof t=="string"&&t.includes("$store")&&ot()}catch(n){X("Expres
21
21
  @keyframes zoomOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.5); } }
22
22
  @keyframes bounceIn { 0% { opacity: 0; transform: scale(0.3); } 50% { opacity: 1; transform: scale(1.05); } 70% { transform: scale(0.9); } 100% { opacity: 1; transform: scale(1); } }
23
23
  @keyframes bounceOut { 0% { opacity: 1; transform: scale(1); } 20% { transform: scale(0.9); } 50%,55% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(0.3); } }
24
- `.trim(),e=document.createElement("style");e.setAttribute("data-nojs-animations",""),e.textContent=t,document.head.appendChild(e)}function at(t,e,r,n){Mt();let o=n||1e3;if(e){let s=t.firstElementChild||t;s.classList.add(e),n&&(s.style.animationDuration=n+"ms"),s.addEventListener("animationend",()=>s.classList.remove(e),{once:!0})}if(r){let s=t.firstElementChild||t;s.classList.add(r+"-enter",r+"-enter-active"),requestAnimationFrame(()=>{s.classList.remove(r+"-enter"),s.classList.add(r+"-enter-to");let i=()=>{s.classList.remove(r+"-enter-active",r+"-enter-to")};s.addEventListener("transitionend",i,{once:!0}),setTimeout(i,o)})}}function pt(t,e,r,n,o){Mt();let s=o||2e3;if(!t.firstElementChild&&!t.childNodes.length){n();return}if(e){let i=t.firstElementChild||t;i.classList.add(e),o&&(i.style.animationDuration=o+"ms"),i.addEventListener("animationend",()=>{i.classList.remove(e),n()},{once:!0}),setTimeout(n,s);return}if(r){let i=t.firstElementChild||t;i.classList.add(r+"-leave",r+"-leave-active"),requestAnimationFrame(()=>{i.classList.remove(r+"-leave"),i.classList.add(r+"-leave-to");let a=()=>{i.classList.remove(r+"-leave-active",r+"-leave-to"),n()};i.addEventListener("transitionend",a,{once:!0}),setTimeout(a,s)});return}n()}function Ot(){let t=[],e={path:"",params:{},query:{},hash:""},r=new Set;function n(c){let l=t.find(d=>d.path===c);return l||(l={path:c,outlets:{}},t.push(l)),l}function o(c){let l={};return new URLSearchParams(c).forEach((d,m)=>{l[m]=d}),l}function s(c){for(let l of t){let d=[],m=l.path.replace(/:(\w+)/g,(b,S)=>(d.push(S),"([^/]+)")),h=new RegExp("^"+m+"$"),y=c.match(h);if(y){let b={};return d.forEach((S,g)=>{b[S]=y[g+1]}),{route:l,params:b}}}return null}async function i(c,l=!1){let d=c.indexOf("#"),m=d>=0?c.slice(d+1):"",h=d>=0?c.slice(0,d):c,[y,b=""]=h.split("?");e={path:y,params:{},query:o(b),hash:m?"#"+m:""};let S=s(y);if(S){e.params=S.params;let g=S.route.outlets?.default,x=g?.getAttribute("guard"),C=g?.getAttribute("redirect");if(x){let N=L({},null);if(N.__raw.$store=O,N.__raw.$route=e,!_(x,N)&&C){await i(C,!0);return}}}if(p.router.mode==="hash"){let g="#"+c;l?window.location.replace(g):window.location.hash=c}else{let g=p.router.base.replace(/\/$/,"")+c;l?window.history.replaceState({},"",g):window.history.pushState({},"",g)}if(await a(S),r.forEach(g=>g(e)),e.hash){let g=e.hash.slice(1);requestAnimationFrame(()=>{let x=document.getElementById(g);x&&x.scrollIntoView({behavior:"smooth"})})}}async function a(c){let l=document.querySelectorAll("[route-view]");for(let m of l){let h=m.getAttribute("route-view"),y=h&&h.trim()!==""?h.trim():"default",b=c?.route?.outlets?.[y];if(m.innerHTML="",b){b.getAttribute("src")&&!b.__srcLoaded&&(k("Loading route template on demand:",b.getAttribute("src")),await st(b));let S=b.content.cloneNode(!0),g=L({$route:e},v(m)),x=document.createElement("div");x.style.display="contents",x.__ctx=g,b.content.__srcBase&&(x.__srcBase=b.content.__srcBase),x.appendChild(S),m.appendChild(x),mt(x);let C=[...x.querySelectorAll("template[src]")];k("[ROUTER] nested templates found in wrapper:",C.length,C.map(I=>I.getAttribute("src")+(I.__srcLoaded?"[LOADED]":"[NEW]"))),await Promise.all(C.map(st)),k("[ROUTER] all nested loads done for route:",e.path);let N=m.getAttribute("transition");N&&at(x,null,N),z(x),T(x)}}document.querySelectorAll("[route]").forEach(m=>{let h=m.getAttribute("route"),y=m.getAttribute("route-active")||"active",b=m.getAttribute("route-active-exact");b?m.classList.toggle(b,e.path===h):y&&!m.hasAttribute("route-active-exact")&&m.classList.toggle(y,e.path.startsWith(h))});let d=p.router.scrollBehavior;d==="top"?window.scrollTo(0,0):d==="smooth"&&window.scrollTo({top:0,behavior:"smooth"})}function f(c,l){l.scrollIntoView({behavior:"smooth"});let d='a[href="#'+c+'"]';document.querySelectorAll('a[href^="#"]').forEach(m=>{m.hasAttribute("route")||m.classList.toggle("active",m.matches(d))})}return{get current(){return e},push(c){return i(c)},replace(c){return i(c,!0)},back(){window.history.back()},forward(){window.history.forward()},on(c){return r.add(c),()=>r.delete(c)},register(c,l,d="default"){let m=n(c);m.outlets[d]=l},async init(){if(document.querySelectorAll("template[route]").forEach(c=>{let l=c.getAttribute("route"),d=c.getAttribute("outlet")||"default",m=n(l);m.outlets[d]=c}),document.addEventListener("click",c=>{let l=c.target.closest("[route]");if(l&&!l.hasAttribute("route-view")){c.preventDefault();let d=l.getAttribute("route");i(d);return}if(p.router.mode==="hash"){let d=c.target.closest('a[href^="#"]');if(d&&!d.hasAttribute("route")){let h=d.getAttribute("href").slice(1);if(h&&!h.startsWith("/")){let y=document.getElementById(h);y&&(c.preventDefault(),f(h,y))}}}}),p.router.mode==="hash"){window.addEventListener("hashchange",()=>{let l=window.location.hash.slice(1)||"/";if(!l.startsWith("/")){let d=document.getElementById(l);d&&(f(l,d),window.history.replaceState(null,"","#"+e.path));return}i(l,!0)});let c=window.location.hash.slice(1)||"/";await i(c,!0)}else{window.addEventListener("popstate",()=>{let l=window.location.pathname.replace(p.router.base,"")||"/";i(l,!0)});let c=window.location.pathname.replace(p.router.base,"")||"/";await i(c,!0)}}}}w.uppercase=t=>String(t??"").toUpperCase();w.lowercase=t=>String(t??"").toLowerCase();w.capitalize=t=>String(t??"").replace(/\b\w/g,e=>e.toUpperCase());w.truncate=(t,e=100)=>{let r=String(t??"");return r.length>e?r.slice(0,e)+"...":r};w.trim=t=>String(t??"").trim();w.stripHtml=t=>String(t??"").replace(/<[^>]*>/g,"");w.slugify=t=>String(t??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");w.nl2br=t=>String(t??"").replace(/\n/g,"<br>");w.encodeUri=t=>encodeURIComponent(String(t??""));w.number=(t,e=0)=>{let r=Number(t);return isNaN(r)?t:r.toLocaleString(void 0,{minimumFractionDigits:e,maximumFractionDigits:e})};w.currency=(t,e="USD")=>{let r=Number(t);if(isNaN(r))return t;try{return r.toLocaleString(void 0,{style:"currency",currency:e})}catch{return`${e} ${r.toFixed(2)}`}};w.percent=(t,e=0)=>{let r=Number(t);return isNaN(r)?t:(r*100).toFixed(e)+"%"};w.filesize=t=>{let e=Number(t);if(isNaN(e))return t;let r=["B","KB","MB","GB","TB"],n=0,o=e;for(;o>=1024&&n<r.length-1;)o/=1024,n++;return o.toFixed(n>0?1:0)+" "+r[n]};w.ordinal=t=>{let e=Number(t);if(isNaN(e))return t;let r=["th","st","nd","rd"],n=e%100;return e+(r[(n-20)%10]||r[n]||r[0])};w.count=t=>Array.isArray(t)?t.length:0;w.first=t=>Array.isArray(t)?t[0]:t;w.last=t=>Array.isArray(t)?t[t.length-1]:t;w.join=(t,e=", ")=>Array.isArray(t)?t.join(e):t;w.reverse=t=>Array.isArray(t)?[...t].reverse():t;w.unique=t=>Array.isArray(t)?[...new Set(t)]:t;w.pluck=(t,e)=>Array.isArray(t)?t.map(r=>r?.[e]):t;w.sortBy=(t,e)=>{if(!Array.isArray(t))return t;let r=e?.startsWith("-"),n=r?e.slice(1):e;return[...t].sort((o,s)=>{let i=o?.[n],a=s?.[n],f=i<a?-1:i>a?1:0;return r?-f:f})};w.where=(t,e,r)=>Array.isArray(t)?t.filter(n=>n?.[e]===r):t;w.date=(t,e="short")=>{let r=new Date(t);if(isNaN(r))return t;let n=e==="long"?{dateStyle:"long"}:e==="full"?{dateStyle:"full"}:{dateStyle:"short"};return r.toLocaleDateString(void 0,n)};w.datetime=t=>{let e=new Date(t);return isNaN(e)?t:e.toLocaleString()};w.relative=t=>{let e=new Date(t);if(isNaN(e))return t;let r=(Date.now()-e.getTime())/1e3;return r<60?"just now":r<3600?Math.floor(r/60)+"m ago":r<86400?Math.floor(r/3600)+"h ago":r<2592e3?Math.floor(r/86400)+"d ago":e.toLocaleDateString()};w.fromNow=t=>{let e=new Date(t);if(isNaN(e))return t;let r=(e.getTime()-Date.now())/1e3;return r<0?w.relative(t):r<60?"in a moment":r<3600?"in "+Math.floor(r/60)+"m":r<86400?"in "+Math.floor(r/3600)+"h":"in "+Math.floor(r/86400)+"d"};w.default=(t,e="")=>t==null||t===""?e:t;w.json=(t,e=2)=>JSON.stringify(t,null,e);w.debug=t=>(console.log("[No.JS debug]",t),t);w.keys=t=>t&&typeof t=="object"?Object.keys(t):[];w.values=t=>t&&typeof t=="object"?Object.values(t):[];A("state",{priority:0,init(t,e,r){let n=_(r,L())||{},o=t.parentElement?v(t.parentElement):null,s=L(n,o);t.__ctx=s;let i=t.getAttribute("persist"),a=t.getAttribute("persist-key");if(i&&a){let f=i==="localStorage"?localStorage:i==="sessionStorage"?sessionStorage:null;if(f){try{let u=f.getItem("nojs_state_"+a);if(u){let c=JSON.parse(u);for(let[l,d]of Object.entries(c))s.$set(l,d)}}catch{}s.$watch(()=>{try{f.setItem("nojs_state_"+a,JSON.stringify(s.__raw))}catch{}})}}k("state",n)}});A("store",{priority:0,init(t,e,r){let n=t.getAttribute("value");if(r){if(!O[r]){let o=n?_(n,L())||{}:{};O[r]=L(o)}k("store",r)}}});A("computed",{priority:2,init(t,e,r){let n=t.getAttribute("expr");if(!r||!n)return;let o=v(t);function s(){let i=_(n,o);o.$set(r,i)}o.$watch(s),s()}});A("watch",{priority:2,init(t,e,r){let n=v(t),o=t.getAttribute("on:change"),s=_(r,n);n.$watch(()=>{let i=_(r,n);if(i!==s){let a=s;s=i,o&&F(o,n,{$old:a,$new:i})}})}});var Gt=["get","post","put","patch","delete"];for(let t of Gt)A(t,{priority:1,init(e,r,n){let o=e.getAttribute("as")||"data",s=e.getAttribute("loading"),i=e.getAttribute("error"),a=e.getAttribute("empty"),f=e.getAttribute("success"),u=e.getAttribute("then"),c=e.getAttribute("redirect"),l=e.getAttribute("confirm"),d=parseInt(e.getAttribute("refresh"))||0,m=e.getAttribute("cached"),h=e.hasAttribute("cached")?m||"memory":"none",y=e.getAttribute("body"),b=e.getAttribute("headers"),S=e.getAttribute("var"),g=e.getAttribute("into"),x=parseInt(e.getAttribute("retry"))||p.retries,C=parseInt(e.getAttribute("retry-delay"))||p.retryDelay||1e3,N=e.getAttribute("params"),I=e.parentElement?v(e.parentElement):L(),E=e.__ctx||L({},I);e.__ctx=E;let B=[...e.childNodes].map(D=>D.cloneNode(!0)),R=null;async function P(){if(R&&R.abort(),R=new AbortController,l&&!window.confirm(l))return;let D=Y(n,E);if(N){let $=_(N,E);if($&&typeof $=="object"){let K=D.includes("?")?"&":"?",q=new URLSearchParams($).toString();q&&(D+=K+q)}}let ct=t+":"+D;if(t==="get"){let $=xt(ct,h);if($!=null){E.$set(o,$),z(e),T(e);return}}if(s){let $=M(s);$&&(e.innerHTML="",e.appendChild($),T(e))}try{let $=null;if(y){let H=Y(y,E);try{$=JSON.parse(H)}catch{$=H}}if(e.tagName==="FORM"){let H=new FormData(e);$=Object.fromEntries(H.entries())}let K=b?JSON.parse(b):{},q=p.retries,et=p.retryDelay;p.retries=x,p.retryDelay=C;let W=await dt(D,t,$,K,e,R.signal);if(p.retries=q,p.retryDelay=et,t==="get"&&Lt(ct,W,h),a&&(W==null||Array.isArray(W)&&W.length===0)){let H=M(a);H&&(e.innerHTML="",e.appendChild(H),T(e));return}if(E.$set(o,W),g&&(O[g]||(O[g]=L({})),O[g].$set(o,W),ot()),f){let H=M(f);if(H){e.innerHTML="";let Ht=document.getElementById(f.replace("#",""))?.getAttribute("var")||S||"result",Rt=L({[Ht]:W},E),lt=document.createElement("div");lt.style.display="contents",lt.__ctx=Rt,lt.appendChild(H),e.appendChild(lt),T(lt)}}else{e.innerHTML="";for(let H of B)e.appendChild(H.cloneNode(!0));z(e),T(e)}u&&F(u,E,{result:W}),c&&j&&j.push(c),ft("fetch:success",{url:D,data:W})}catch($){if($.name==="AbortError")return;if(X(`${t.toUpperCase()} ${D} failed:`,$.message),ft("fetch:error",{url:D,error:$}),ft("error",{url:D,error:$}),i){let K=M(i);if(K){e.innerHTML="";let et=document.getElementById(i.replace("#",""))?.getAttribute("var")||"err",W=L({[et]:{message:$.message,status:$.status,body:$.body}},E),H=document.createElement("div");H.style.display="contents",H.__ctx=W,H.appendChild(K),e.appendChild(H),T(H)}}}}if(e.tagName==="FORM"&&t!=="get"?e.addEventListener("submit",D=>{D.preventDefault(),P()}):t==="get"?P():e.addEventListener("click",D=>{D.preventDefault(),P()}),/\{[^}]+\}/.test(n)){let K=function(){let et=Y(n,E);et!==ct&&(ct=et,$&&clearTimeout($),D>0?$=setTimeout(P,D):P())},D=parseInt(e.getAttribute("debounce"))||0,ct=Y(n,E),$=null,q=I;for(;q&&q.__isProxy;)q.$watch(K),q=q.$parent}d>0&&setInterval(P,d)}});A("bind",{priority:20,init(t,e,r){let n=v(t);function o(){let s=_(r,n);t.textContent=s!=null?String(s):""}Z(r,n,o),o()}});A("bind-html",{priority:20,init(t,e,r){let n=v(t);function o(){let s=_(r,n);s!=null&&(t.innerHTML=Tt(String(s)))}Z(r,n,o),o()}});A("bind-*",{priority:20,init(t,e,r){let n=e.replace("bind-",""),o=v(t);n==="value"&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")&&t.addEventListener("input",()=>{let i=t.type==="number"?Number(t.value):t.value;F(`${r} = ${JSON.stringify(i)}`,o)});function s(){let i=_(r,o);if(["disabled","readonly","checked","selected","hidden","required"].includes(n)){i?t.setAttribute(n,""):t.removeAttribute(n),n in t&&(t[n]=!!i);return}i!=null?t.setAttribute(n,String(i)):t.removeAttribute(n)}Z(r,o,s),s()}});A("model",{priority:20,init(t,e,r){let n=v(t),o=t.tagName,s=t.type;function i(){let f=_(r,n);o==="INPUT"&&s==="checkbox"?t.checked=!!f:o==="INPUT"&&s==="radio"?t.checked=t.value===String(f):t.value=f!=null?String(f):""}let a=o==="SELECT"||s==="checkbox"||s==="radio"?"change":"input";t.addEventListener(a,()=>{let f;s==="checkbox"?f=t.checked:s==="number"||s==="range"?f=Number(t.value):f=t.value,F(`${r} = __val`,n,{__val:f})}),n.$watch(i),i()}});A("if",{priority:10,init(t,e,r){let n=v(t),o=t.getAttribute("then"),s=t.getAttribute("else"),i=t.getAttribute("animate-enter")||t.getAttribute("animate"),a=t.getAttribute("animate-leave"),f=t.getAttribute("transition"),u=parseInt(t.getAttribute("animate-duration"))||0,c=[...t.childNodes].map(h=>h.cloneNode(!0)),l;function d(){let h=!!_(r,n);h!==l&&(l=h,a||f?pt(t,a,f,()=>m(h),u):m(h))}function m(h){if(h)if(o){let y=M(o);y&&(t.innerHTML="",t.appendChild(y))}else{t.innerHTML="";for(let y of c)t.appendChild(y.cloneNode(!0))}else if(s){let y=M(s);y&&(t.innerHTML="",t.appendChild(y))}else t.innerHTML="";z(t),T(t),(i||f)&&at(t,i,f,u)}n.$watch(d),d()}});A("else-if",{priority:10,init(t,e,r){let n=v(t),o=t.getAttribute("then"),s=[...t.childNodes].map(a=>a.cloneNode(!0));function i(){let a=t.previousElementSibling;for(;a;){let u=a.getAttribute("if")||a.getAttribute("else-if");if(u){if(_(u,n)){t.innerHTML="",t.style.display="none";return}}else break;a=a.previousElementSibling}let f=!!_(r,n);if(t.style.display="",f){if(o){let u=M(o);u&&(t.innerHTML="",t.appendChild(u))}else{t.innerHTML="";for(let u of s)t.appendChild(u.cloneNode(!0))}z(t),T(t)}else t.innerHTML=""}n.$watch(i),i()}});A("else",{priority:10,init(t){if(t.hasAttribute("if"))return;let e=v(t),r=t.getAttribute("then"),n=[...t.childNodes].map(s=>s.cloneNode(!0));function o(){let s=t.previousElementSibling;for(;s;){let i=s.getAttribute("if")||s.getAttribute("else-if");if(i){if(_(i,e)){t.innerHTML="",t.style.display="none";return}}else break;s=s.previousElementSibling}if(t.style.display="",r){let i=M(r);i&&(t.innerHTML="",t.appendChild(i))}else{t.innerHTML="";for(let i of n)t.appendChild(i.cloneNode(!0))}z(t),T(t)}e.$watch(o),o()}});A("show",{priority:20,init(t,e,r){let n=v(t),o=t.getAttribute("animate-enter")||t.getAttribute("animate"),s=t.getAttribute("animate-leave"),i=t.getAttribute("transition"),a=parseInt(t.getAttribute("animate-duration"))||0,f;function u(){let c=!!_(r,n);c!==f&&(f=c,c?(t.style.display="",(o||i)&&at(t,o,i,a)):s||i?pt(t,s,i,()=>{t.style.display="none"},a):t.style.display="none")}Z(r,n,u),u()}});A("hide",{priority:20,init(t,e,r){let n=v(t),o=t.getAttribute("animate-enter")||t.getAttribute("animate"),s=t.getAttribute("animate-leave"),i=t.getAttribute("transition"),a=parseInt(t.getAttribute("animate-duration"))||0,f;function u(){let c=!_(r,n);c!==f&&(f=c,c?(t.style.display="",(o||i)&&at(t,o,i,a)):s||i?pt(t,s,i,()=>{t.style.display="none"},a):t.style.display="none")}Z(r,n,u),u()}});A("switch",{priority:10,init(t,e,r){let n=v(t);function o(){let s=_(r,n),i=!1;for(let a of[...t.children]){let f=a.getAttribute("case"),u=a.hasAttribute("default"),c=a.getAttribute("then");if(f){let l=f.split(",").map(d=>_(d.trim(),n));if(!i&&l.includes(s)){if(i=!0,a.style.display="",c){let d=M(c);d&&(a.innerHTML="",a.appendChild(d)),a.__declared=!1,T(a)}}else a.style.display="none"}else if(u&&(a.style.display=i?"none":"",!i&&c)){let l=M(c);l&&(a.innerHTML="",a.appendChild(l)),a.__declared=!1,T(a)}}}n.$watch(o),o()}});A("each",{priority:10,init(t,e,r){let n=v(t),o=r.match(/^(\w+)\s+in\s+(\S+)$/);if(!o)return;let[,s,i]=o,a=t.getAttribute("template"),f=t.getAttribute("else"),u=t.getAttribute("key"),c=t.getAttribute("animate-enter")||t.getAttribute("animate"),l=t.getAttribute("animate-leave"),d=parseInt(t.getAttribute("animate-stagger"))||0,m=parseInt(t.getAttribute("animate-duration"))||0;function h(){let b=tt(i,n);if(!Array.isArray(b))return;if(b.length===0&&f){let g=M(f);g&&(t.innerHTML="",t.appendChild(g),T(t));return}let S=a?document.getElementById(a):null;if(S)if(l&&t.children.length>0){let g=[...t.children],x=g.length;g.forEach(C=>{let N=C.firstElementChild||C;N.classList.add(l);let I=()=>{N.classList.remove(l),x--,x<=0&&y(S,b)};N.addEventListener("animationend",I,{once:!0}),setTimeout(I,m||2e3)})}else y(S,b)}function y(b,S){let g=S.length;t.innerHTML="",S.forEach((x,C)=>{let N={[s]:x,$index:C,$count:g,$first:C===0,$last:C===g-1,$even:C%2===0,$odd:C%2!==0},I=L(N,n),E=b.content.cloneNode(!0),B=document.createElement("div");if(B.style.display="contents",B.__ctx=I,B.appendChild(E),t.appendChild(B),T(B),c){let R=B.firstElementChild;R&&(R.classList.add(c),d&&(R.style.animationDelay=C*d+"ms"))}})}n.$watch(h),h()}});A("foreach",{priority:10,init(t,e,r){let n=v(t),o=t.getAttribute("from"),s=t.getAttribute("index")||"$index",i=t.getAttribute("else"),a=t.getAttribute("filter"),f=t.getAttribute("sort"),u=parseInt(t.getAttribute("limit"))||1/0,c=parseInt(t.getAttribute("offset"))||0,l=t.getAttribute("template"),d=t.getAttribute("animate-enter")||t.getAttribute("animate"),m=t.getAttribute("animate-leave"),h=parseInt(t.getAttribute("animate-stagger"))||0,y=parseInt(t.getAttribute("animate-duration"))||0;if(!o||!r)return;let b=l?null:t.cloneNode(!0);function S(){let g=tt(o,n);if(!Array.isArray(g))return;if(a&&(g=g.filter((I,E)=>{let B=L({[r]:I,[s]:E},n);return!!_(a,B)})),f){let I=f.startsWith("-"),E=I?f.slice(1):f;g=[...g].sort((B,R)=>{let P=tt(E,B)??B?.[E],J=tt(E,R)??R?.[E],D=P<J?-1:P>J?1:0;return I?-D:D})}if(g=g.slice(c,c+u),g.length===0&&i){let I=M(i);I&&(t.innerHTML="",t.appendChild(I),T(t));return}let x=l?document.getElementById(l):null,C=g.length;function N(){t.innerHTML="",g.forEach((I,E)=>{let B={[r]:I,[s]:E,$index:E,$count:C,$first:E===0,$last:E===C-1,$even:E%2===0,$odd:E%2!==0},R=L(B,n),P;x?P=x.content.cloneNode(!0):P=b.cloneNode(!0);let J=document.createElement("div");if(J.style.display="contents",J.__ctx=R,J.appendChild(P),t.appendChild(J),T(J),d){let D=J.firstElementChild;D&&(D.classList.add(d),h&&(D.style.animationDelay=E*h+"ms"))}})}if(m&&t.children.length>0){let I=[...t.children],E=I.length;I.forEach(B=>{let R=B.firstElementChild||B;R.classList.add(m);let P=()=>{R.classList.remove(m),E--,E<=0&&N()};R.addEventListener("animationend",P,{once:!0}),setTimeout(P,y||2e3)})}else N()}n.$watch(S),S()}});A("class-*",{priority:20,init(t,e,r){let n=e.replace("class-",""),o=v(t);if(n==="map"){let i=function(){let a=_(r,o);if(a&&typeof a=="object")for(let[f,u]of Object.entries(a))t.classList.toggle(f,!!u)};o.$watch(i),i();return}if(n==="list"){let a=function(){let f=_(r,o);if(Array.isArray(f)){i.forEach(c=>{c&&t.classList.remove(c)});let u=f.filter(Boolean);u.forEach(c=>t.classList.add(c)),i=u}},i=[];o.$watch(a),a();return}function s(){t.classList.toggle(n,!!_(r,o))}o.$watch(s),s()}});A("style-*",{priority:20,init(t,e,r){let n=e.replace("style-",""),o=v(t);if(n==="map"){let a=function(){let f=_(r,o);if(f&&typeof f=="object")for(let[u,c]of Object.entries(f))t.style[u]=c??""};o.$watch(a),a();return}let s=n.replace(/-([a-z])/g,(a,f)=>f.toUpperCase());function i(){let a=_(r,o);t.style[s]=a!=null?String(a):""}o.$watch(i),i()}});A("on:*",{priority:20,init(t,e,r){let n=v(t),o=e.replace("on:","").split("."),s=o[0],i=new Set(o.slice(1));if(s==="mounted"){requestAnimationFrame(()=>F(r,n,{$el:t}));return}if(s==="init"){F(r,n,{$el:t});return}if(s==="updated"){new MutationObserver(()=>{F(r,n,{$el:t})}).observe(t,{childList:!0,subtree:!0,characterData:!0,attributes:!0});return}if(s==="error"){window.addEventListener("error",l=>{(t.contains(l.target)||l.target===t)&&F(r,n,{$el:t,$error:l.error||l.message})});return}if(s==="unmounted"){let l=new MutationObserver(d=>{for(let m of d)for(let h of m.removedNodes)if(h===t||h.contains?.(t)){F(r,n,{$el:t}),l.disconnect();return}});t.parentElement&&l.observe(t.parentElement,{childList:!0});return}let a=0,f=0;for(let l of i)/^\d+$/.test(l)&&(i.has("debounce")?a=parseInt(l):i.has("throttle")&&(f=parseInt(l)));let u=l=>{if(s==="keydown"||s==="keyup"||s==="keypress"){let d=["enter","escape","tab","space","delete","backspace","up","down","left","right","ctrl","alt","shift","meta"];for(let m of i)if(d.includes(m)&&(m==="enter"&&l.key!=="Enter"||m==="escape"&&l.key!=="Escape"||m==="tab"&&l.key!=="Tab"||m==="space"&&l.key!==" "||m==="delete"&&l.key!=="Delete"&&l.key!=="Backspace"||m==="up"&&l.key!=="ArrowUp"||m==="down"&&l.key!=="ArrowDown"||m==="left"&&l.key!=="ArrowLeft"||m==="right"&&l.key!=="ArrowRight"||m==="ctrl"&&!l.ctrlKey||m==="alt"&&!l.altKey||m==="shift"&&!l.shiftKey||m==="meta"&&!l.metaKey))return}i.has("prevent")&&l.preventDefault(),i.has("stop")&&l.stopPropagation(),!(i.has("self")&&l.target!==t)&&F(r,n,{$event:l,$el:t})};if(a>0){let l=u,d;u=m=>{clearTimeout(d),d=setTimeout(()=>l(m),a)}}if(f>0){let l=u,d=0;u=m=>{let h=Date.now();h-d>=f&&(d=h,l(m))}}let c={};i.has("once")&&(c.once=!0),t.addEventListener(s,u,c)}});A("trigger",{priority:20,init(t,e,r){let n=v(t),o=t.getAttribute("trigger-data");t.addEventListener("click",()=>{let s=o?_(o,n):null;t.dispatchEvent(new CustomEvent(r,{detail:s,bubbles:!0}))})}});A("ref",{priority:5,init(t,e,r){nt[r]=t}});A("use",{priority:10,init(t,e,r){let n=v(t),o=M(r);if(!o)return;let s={};for(let c of[...t.attributes])if(c.name.startsWith("var-")){let l=c.name.replace("var-","");s[l]=_(c.value,n)}let i=L(s,n),a={};for(let c of[...t.children]){let l=c.getAttribute("slot")||"default";a[l]||(a[l]=document.createDocumentFragment()),a[l].appendChild(c.cloneNode(!0))}let f=o.querySelectorAll("slot");for(let c of f){let l=c.getAttribute("name")||"default";a[l]&&c.replaceWith(a[l])}t.innerHTML="";let u=document.createElement("div");u.style.display="contents",u.__ctx=i,u.appendChild(o),t.appendChild(u),T(u)}});A("call",{priority:20,init(t,e,r){let n=v(t),o=t.getAttribute("method")||"get",s=t.getAttribute("as"),i=t.getAttribute("into"),a=t.getAttribute("success"),f=t.getAttribute("error"),u=t.getAttribute("then"),c=t.getAttribute("confirm"),l=t.getAttribute("body");t.addEventListener("click",async d=>{if(d.preventDefault(),c&&!window.confirm(c))return;let m=Y(r,n);try{let h=null;if(l){let b=Y(l,n);try{h=JSON.parse(b)}catch{h=b}}let y=await dt(m,o,h,{},t);if(s&&n.$set(s,y),s&&i&&(O[i]||(O[i]=L({})),O[i].$set(s,y),ot()),u&&F(u,n,{result:y}),a){let b=M(a);if(b){let g=document.getElementById(a.replace("#",""))?.getAttribute("var")||"result",x=L({[g]:y},n),C=t.closest("[route-view]")||t.parentElement,N=document.createElement("div");N.style.display="contents",N.__ctx=x,N.appendChild(b),C.appendChild(N),T(N)}}}catch(h){if(f){let y=M(f);if(y){let S=document.getElementById(f.replace("#",""))?.getAttribute("var")||"err",g=L({[S]:{message:h.message,status:h.status}},n),x=t.parentElement,C=document.createElement("div");C.style.display="contents",C.__ctx=g,C.appendChild(y),x.appendChild(C),T(C)}}}})}});function kt(t,e,r){let n=e.split("|").map(o=>o.trim());for(let o of n){let[s,...i]=o.split(":"),a=Q[s];if(a){let f=a(t,...i,r);if(f!==!0&&f)return f}else switch(s){case"required":if(t==null||String(t).trim()==="")return"Required";break;case"email":if(t&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return"Invalid email";break;case"url":try{new URL(t)}catch{return"Invalid URL"}break;case"min":if(Number(t)<Number(i[0]))return`Minimum value is ${i[0]}`;break;case"max":if(Number(t)>Number(i[0]))return`Maximum value is ${i[0]}`;break;case"between":{let f=Number(t);if(f<Number(i[0])||f>Number(i[1]))return`Must be between ${i[0]} and ${i[1]}`;break}case"match":if(t!==r[i[0]])return`Must match ${i[0]}`;break;case"phone":if(!/^[\d\s\-+()]{7,15}$/.test(t))return"Invalid phone number";break;case"cpf":if(!/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/.test(t))return"Invalid CPF";break;case"cnpj":if(!/^\d{2}\.?\d{3}\.?\d{3}\/?\d{4}-?\d{2}$/.test(t))return"Invalid CNPJ";break;case"creditcard":if(!/^\d{13,19}$/.test(t.replace(/\s|-/g,"")))return"Invalid card number";break;case"custom":if(i[0]&&Q[i[0]]){let f=Q[i[0]](t,r);if(f!==!0&&f)return f}break}}return null}A("validate",{priority:30,init(t,e,r){let n=v(t);if(t.tagName==="FORM"){let s=function(){let i={},a={},f=!0;for(let u of t.querySelectorAll("input, textarea, select")){if(!u.name)continue;a[u.name]=u.value;let c=u.getAttribute("validate");if(c){let l=kt(u.value,c,a);l&&(i[u.name]=l,f=!1)}u.checkValidity()||(i[u.name]=i[u.name]||u.validationMessage,f=!1)}o.valid=f,o.errors=i,o.values=a,n.$set("$form",{...o})},o={valid:!1,dirty:!1,touched:!1,submitting:!1,errors:{},values:{},reset:()=>{o.dirty=!1,o.touched=!1,t.reset(),s()}};n.$set("$form",o),t.addEventListener("input",()=>{o.dirty=!0,s()}),t.addEventListener("focusout",()=>{o.touched=!0,s()}),t.addEventListener("submit",()=>{o.submitting=!0,n.$set("$form",{...o}),requestAnimationFrame(()=>{o.submitting=!1,n.$set("$form",{...o})})}),requestAnimationFrame(s);return}if(r&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")){let o=t.getAttribute("error");t.addEventListener("input",()=>{let s=kt(t.value,r,{});if(s&&o){let i=t.nextElementSibling?.__validationError?t.nextElementSibling:null;i||(i=document.createElement("div"),i.__validationError=!0,i.style.display="contents",t.parentNode.insertBefore(i,t.nextSibling));let a=M(o);if(a){let f=L({err:{message:s}},n);i.innerHTML="",i.__ctx=f,i.appendChild(a),T(i)}}else{let i=t.nextElementSibling?.__validationError?t.nextElementSibling:null;i&&(i.innerHTML="")}})}}});A("error-boundary",{priority:1,init(t,e,r){let n=v(t);function o(s){let i=M(r);if(i){let a=L({err:{message:s}},n);t.innerHTML="";let f=document.createElement("div");f.style.display="contents",f.__ctx=a,f.appendChild(i),t.appendChild(f),T(f)}}t.addEventListener("nojs:error",s=>{o(s.detail?.message||"An error occurred")}),window.addEventListener("error",s=>{(t.contains(s.target)||t===s.target)&&o(s.message||"An error occurred")})}});A("t",{priority:20,init(t,e,r){let n=v(t);function o(){let s={};for(let i of[...t.attributes])if(i.name.startsWith("t-")&&i.name!=="t"){let a=i.name.replace("t-","");s[a]=_(i.value,n)??i.value}t.textContent=U.t(r,s)}n.$watch(o),At(o),o()}});function Qt(){if(typeof window>"u")return null;let t=p.router||{};if(t.mode==="hash")return window.location.hash.slice(1)||"/";let e=(t.base||"/").replace(/\/$/,"");return window.location.pathname.replace(e,"")||"/"}var Bt={get baseApiUrl(){return p.baseApiUrl},set baseApiUrl(t){p.baseApiUrl=t},config(t={}){let e={...p.headers},r={...p.cache},n={...p.templates},o={...p.router},s={...p.i18n};Object.assign(p,t),t.headers&&(p.headers={...e,...t.headers}),t.csrf&&(p.csrf=t.csrf),t.cache&&(p.cache={...r,...t.cache}),t.templates&&(p.templates={...n,...t.templates}),t.router&&(p.router={...o,...t.router}),t.i18n&&(p.i18n={...s,...t.i18n},U.locale=t.i18n.defaultLocale||U.locale)},async init(t){if(typeof document>"u")return;t=t||document.body,k("Initializing..."),mt(t);let e=Qt();await St(e),document.querySelector("[route-view]")&&vt(Ot()),T(t),j&&await j.init(),k("Initialized."),Nt(),p.devtools&&typeof window<"u"&&(window.__NOJS_DEVTOOLS__={stores:O,config:p,refs:nt,router:j,filters:Object.keys(w),validators:Object.keys(Q),version:Bt.version},k("DevTools enabled \u2014 access via window.__NOJS_DEVTOOLS__"))},directive(t,e){A(t,e)},filter(t,e){w[t]=e},validator(t,e){Q[t]=e},i18n(t){if(t.locales&&(U.locales=t.locales),t.defaultLocale&&(U.locale=t.defaultLocale),t.fallbackLocale&&(p.i18n.fallbackLocale=t.fallbackLocale),t.detectBrowser){let e=typeof navigator<"u"?navigator.language:"en";U.locales[e]&&(U.locale=e)}},on(t,e){return G[t]||(G[t]=[]),G[t].push(e),()=>{G[t]=G[t].filter(r=>r!==e)}},interceptor(t,e){rt[t]&&rt[t].push(e)},get store(){return O},get router(){return j},createContext:L,evaluate:_,findContext:v,processTree:T,resolve:tt,version:"1.0.2"},Zt=Bt;
24
+ `.trim(),e=document.createElement("style");e.setAttribute("data-nojs-animations",""),e.textContent=t,document.head.appendChild(e)}function Lt(t,e,r,n){fe();let o=n||1e3;if(e){let i=t.firstElementChild||t;i.classList.add(e),n&&(i.style.animationDuration=n+"ms"),i.addEventListener("animationend",()=>i.classList.remove(e),{once:!0})}if(r){let i=t.firstElementChild||t;i.classList.add(r+"-enter",r+"-enter-active"),requestAnimationFrame(()=>{i.classList.remove(r+"-enter"),i.classList.add(r+"-enter-to");let s=()=>{i.classList.remove(r+"-enter-active",r+"-enter-to")};i.addEventListener("transitionend",s,{once:!0}),setTimeout(s,o)})}}function Bt(t,e,r,n,o){fe();let i=o||2e3;if(!t.firstElementChild&&!t.childNodes.length){n();return}if(e){let s=t.firstElementChild||t;s.classList.add(e),o&&(s.style.animationDuration=o+"ms");let a=!1,c=()=>{a||(a=!0,s.classList.remove(e),n())};s.addEventListener("animationend",c,{once:!0}),setTimeout(c,i);return}if(r){let s=t.firstElementChild||t;s.classList.add(r+"-leave",r+"-leave-active"),requestAnimationFrame(()=>{s.classList.remove(r+"-leave"),s.classList.add(r+"-leave-to");let a=!1,c=()=>{a||(a=!0,s.classList.remove(r+"-leave-active",r+"-leave-to"),n())};s.addEventListener("transitionend",c,{once:!0}),setTimeout(c,i)});return}n()}function ue(){let t=[],e={path:"",params:{},query:{},hash:""},r=new Set,n=new Map;function o(l){let p=t.find(u=>u.path===l);return p||(p={path:l,outlets:{}},t.push(p)),p}function i(l){let p={};return new URLSearchParams(l).forEach((u,m)=>{p[m]=u}),p}function s(l){for(let p of t){let u=[],m=p.path.replace(/:(\w+)/g,(b,A)=>(u.push(A),"([^/]+)")),L=new RegExp("^"+m+"$"),v=l.match(L);if(v){let b={};return u.forEach((A,y)=>{b[A]=v[y+1]}),{route:p,params:b}}}return null}async function a(l,p=!1){let u=l.indexOf("#"),m=u>=0?l.slice(u+1):"",L=u>=0?l.slice(0,u):l,[v,b=""]=L.split("?");e={path:v,params:{},query:i(b),hash:m?"#"+m:""};let A=s(v);if(A){e.params=A.params;let y=A.route.outlets?.default,E=y?.getAttribute("guard"),T=y?.getAttribute("redirect");if(E){let _=O({},null);if(_.__raw.$store=Y,_.__raw.$route=e,!x(E,_)&&T){await a(T,!0);return}}}if(h.router.mode==="hash"){let y="#"+l;p?window.location.replace(y):window.location.hash=l}else{let y=h.router.base.replace(/\/$/,"")+l;p?window.history.replaceState({},"",y):window.history.pushState({},"",y)}if(await c(A),r.forEach(y=>y(e)),e.hash){let y=e.hash.slice(1);requestAnimationFrame(()=>{let E=document.getElementById(y);E&&E.scrollIntoView({behavior:"smooth"})})}}async function c(l){let p=document.querySelectorAll("[route-view]");for(let m of p){let L=m.getAttribute("route-view"),v=L&&L.trim()!==""?L.trim():"default",b=l?.route?.outlets?.[v],A=h.router.templates||"";if(!b&&(m.hasAttribute("src")||A)){let E=(m.getAttribute("src")||A).replace(/\/?$/,"/"),T=m.getAttribute("ext")||h.router.ext||".html",_=m.getAttribute("route-index")||"index",w=e.path==="/"?_:e.path.replace(/^\//,""),F=E+w+T,I=v+":"+F;n.has(I)?b=n.get(I):(b=document.createElement("template"),b.setAttribute("src",F),b.setAttribute("route",e.path),document.body.appendChild(b),n.set(I,b),K("[ROUTER] File-based route:",e.path,"\u2192",F)),m.hasAttribute("i18n-ns")&&!b.getAttribute("i18n-ns")&&b.setAttribute("i18n-ns",w)}if(le(m),m.innerHTML="",b){b.getAttribute("src")&&!b.__srcLoaded&&(K("Loading route template on demand:",b.getAttribute("src")),await wt(b));let y=b.getAttribute("i18n-ns");if(y){let{_loadI18nNamespace:I}=await Promise.resolve().then(()=>(pt(),Qt));await I(y)}let E=b.content.cloneNode(!0),T=O({$route:e},$(m)),_=document.createElement("div");_.style.display="contents",_.__ctx=T,b.content.__srcBase&&(_.__srcBase=b.content.__srcBase),_.appendChild(E),m.appendChild(_),kt(_);let w=[..._.querySelectorAll("template[src]")];K("[ROUTER] nested templates found in wrapper:",w.length,w.map(I=>I.getAttribute("src")+(I.__srcLoaded?"[LOADED]":"[NEW]"))),await Promise.all(w.map(wt)),K("[ROUTER] all nested loads done for route:",e.path);let F=m.getAttribute("transition");F&&Lt(_,null,F),dt(_),B(_)}}document.querySelectorAll("[route]").forEach(m=>{let L=m.getAttribute("route"),v=m.getAttribute("route-active")||"active",b=m.getAttribute("route-active-exact");if(b)m.classList.toggle(b,e.path===L);else if(v&&!m.hasAttribute("route-active-exact")){let A=L==="/"?e.path==="/":e.path.startsWith(L);m.classList.toggle(v,A)}});let u=h.router.scrollBehavior;u==="top"?window.scrollTo(0,0):u==="smooth"&&window.scrollTo({top:0,behavior:"smooth"})}function d(l,p){p.scrollIntoView({behavior:"smooth"});let u='a[href="#'+l+'"]';document.querySelectorAll('a[href^="#"]').forEach(m=>{m.hasAttribute("route")||m.classList.toggle("active",m.matches(u))})}return{get current(){return e},push(l){return a(l)},replace(l){return a(l,!0)},back(){window.history.back()},forward(){window.history.forward()},on(l){return r.add(l),()=>r.delete(l)},register(l,p,u="default"){let m=o(l);m.outlets[u]=p},async init(){if(document.querySelectorAll("template[route]").forEach(l=>{let p=l.getAttribute("route"),u=l.getAttribute("outlet")||"default",m=o(p);m.outlets[u]=l}),document.addEventListener("click",l=>{let p=l.target.closest("[route]");if(p&&!p.hasAttribute("route-view")){l.preventDefault();let u=p.getAttribute("route");a(u);return}if(h.router.mode==="hash"){let u=l.target.closest('a[href^="#"]');if(u&&!u.hasAttribute("route")){let L=u.getAttribute("href").slice(1);if(L&&!L.startsWith("/")){let v=document.getElementById(L);v&&(l.preventDefault(),d(L,v))}}}}),h.router.mode==="hash"){window.addEventListener("hashchange",()=>{let p=window.location.hash.slice(1)||"/";if(!p.startsWith("/")){let m=document.getElementById(p);m&&(d(p,m),window.history.replaceState(null,"","#"+e.path));return}let[u]=p.split("?");u!==e.path&&a(p,!0)});let l=window.location.hash.slice(1)||"/";await a(l,!0)}else{window.addEventListener("popstate",()=>{let p=window.location.pathname.replace(h.router.base,"")||"/";a(p,!0)});let l=window.location.pathname.replace(h.router.base,"")||"/";await a(l,!0)}}}}J();N.uppercase=t=>String(t??"").toUpperCase();N.lowercase=t=>String(t??"").toLowerCase();N.capitalize=t=>String(t??"").replace(/\b\w/g,e=>e.toUpperCase());N.truncate=(t,e=100)=>{let r=String(t??"");return r.length>e?r.slice(0,e)+"...":r};N.trim=t=>String(t??"").trim();N.stripHtml=t=>String(t??"").replace(/<[^>]*>/g,"");N.slugify=t=>String(t??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");N.nl2br=t=>String(t??"").replace(/\n/g,"<br>");N.encodeUri=t=>encodeURIComponent(String(t??""));N.number=(t,e=0)=>{let r=Number(t);return isNaN(r)?t:r.toLocaleString(void 0,{minimumFractionDigits:e,maximumFractionDigits:e})};N.currency=(t,e="USD")=>{let r=Number(t);if(isNaN(r))return t;try{return r.toLocaleString(void 0,{style:"currency",currency:e})}catch{return`${e} ${r.toFixed(2)}`}};N.percent=(t,e=0)=>{let r=Number(t);return isNaN(r)?t:(r*100).toFixed(e)+"%"};N.filesize=t=>{let e=Number(t);if(isNaN(e))return t;let r=["B","KB","MB","GB","TB"],n=0,o=e;for(;o>=1024&&n<r.length-1;)o/=1024,n++;return o.toFixed(n>0?1:0)+" "+r[n]};N.ordinal=t=>{let e=Number(t);if(isNaN(e))return t;let r=["th","st","nd","rd"],n=e%100;return e+(r[(n-20)%10]||r[n]||r[0])};N.count=t=>Array.isArray(t)?t.length:0;N.first=t=>Array.isArray(t)?t[0]:t;N.last=t=>Array.isArray(t)?t[t.length-1]:t;N.join=(t,e=", ")=>Array.isArray(t)?t.join(e):t;N.reverse=t=>Array.isArray(t)?[...t].reverse():t;N.unique=t=>Array.isArray(t)?[...new Set(t)]:t;N.pluck=(t,e)=>Array.isArray(t)?t.map(r=>r?.[e]):t;N.sortBy=(t,e)=>{if(!Array.isArray(t))return t;let r=e?.startsWith("-"),n=r?e.slice(1):e;return[...t].sort((o,i)=>{let s=o?.[n],a=i?.[n],c=s<a?-1:s>a?1:0;return r?-c:c})};N.where=(t,e,r)=>Array.isArray(t)?t.filter(n=>n?.[e]===r):t;N.date=(t,e="short")=>{let r=new Date(t);if(isNaN(r))return t;let n=e==="long"?{dateStyle:"long"}:e==="full"?{dateStyle:"full"}:{dateStyle:"short"};return r.toLocaleDateString(void 0,n)};N.datetime=t=>{let e=new Date(t);return isNaN(e)?t:e.toLocaleString()};N.relative=t=>{let e=new Date(t);if(isNaN(e))return t;let r=(Date.now()-e.getTime())/1e3;return r<60?"just now":r<3600?Math.floor(r/60)+"m ago":r<86400?Math.floor(r/3600)+"h ago":r<2592e3?Math.floor(r/86400)+"d ago":e.toLocaleDateString()};N.fromNow=t=>{let e=new Date(t);if(isNaN(e))return t;let r=(e.getTime()-Date.now())/1e3;return r<0?N.relative(t):r<60?"in a moment":r<3600?"in "+Math.floor(r/60)+"m":r<86400?"in "+Math.floor(r/3600)+"h":"in "+Math.floor(r/86400)+"d"};N.default=(t,e="")=>t==null||t===""?e:t;N.json=(t,e=2)=>JSON.stringify(t,null,e);N.debug=t=>(console.log("[No.JS debug]",t),t);N.keys=t=>t&&typeof t=="object"?Object.keys(t):[];N.values=t=>t&&typeof t=="object"?Object.values(t):[];J();S("state",{priority:0,init(t,e,r){let n=x(r,O())||{},o=t.parentElement?$(t.parentElement):null,i=O(n,o);t.__ctx=i;let s=t.getAttribute("persist"),a=t.getAttribute("persist-key");if(s&&a){let c=s==="localStorage"?localStorage:s==="sessionStorage"?sessionStorage:null;if(c){try{let d=c.getItem("nojs_state_"+a);if(d){let f=JSON.parse(d);for(let[l,p]of Object.entries(f))i.$set(l,p)}}catch{}i.$watch(()=>{try{c.setItem("nojs_state_"+a,JSON.stringify(i.__raw))}catch{}})}}K("state",n)}});S("store",{priority:0,init(t,e,r){let n=t.getAttribute("value");if(r){if(!Y[r]){let o=n?x(n,O())||{}:{};Y[r]=O(o)}K("store",r)}}});S("computed",{priority:2,init(t,e,r){let n=t.getAttribute("expr");if(!r||!n)return;let o=$(t);function i(){let s=x(n,o);o.$set(r,s)}W(n,o,i),i()}});S("watch",{priority:2,init(t,e,r){let n=$(t),o=t.getAttribute("on:change"),i=x(r,n);W(r,n,()=>{let s=x(r,n);if(s!==i){let a=i;i=s,o&&Q(o,n,{$old:a,$new:s})}})}});J();var $e=["get","post","put","patch","delete"];for(let t of $e)S(t,{priority:1,init(e,r,n){let o=e.getAttribute("as")||"data",i=e.getAttribute("loading"),s=e.getAttribute("error"),a=e.getAttribute("empty"),c=e.getAttribute("success"),d=e.getAttribute("then"),f=e.getAttribute("redirect"),l=e.getAttribute("confirm"),p=parseInt(e.getAttribute("refresh"))||0,u=e.getAttribute("cached"),m=e.hasAttribute("cached")?u||"memory":"none",L=e.getAttribute("body"),v=e.getAttribute("headers"),b=e.getAttribute("var"),A=e.getAttribute("into"),y=parseInt(e.getAttribute("retry"))||h.retries,E=parseInt(e.getAttribute("retry-delay"))||h.retryDelay||1e3,T=e.getAttribute("params"),_=e.parentElement?$(e.parentElement):O(),w=e.__ctx||O({},_);e.__ctx=w;let F=[...e.childNodes].map(H=>H.cloneNode(!0)),I=null;async function U(){if(I&&I.abort(),I=new AbortController,l&&!window.confirm(l))return;let H=gt(n,w);if(T){let R=x(T,w);if(R&&typeof R=="object"){let k=H.includes("?")?"&":"?",j=new URLSearchParams(R).toString();j&&(H+=k+j)}}let lt=t+":"+H;if(t==="get"){let R=te(lt,m);if(R!=null){w.$set(o,R),dt(e),B(e);return}}if(i){let R=z(i);R&&(e.innerHTML="",e.appendChild(R),B(e))}try{let R=null;if(L){let C=gt(L,w);try{R=JSON.parse(C)}catch{R=C}}if(e.tagName==="FORM"){let C=new FormData(e);R=Object.fromEntries(C.entries())}let k=v?JSON.parse(v):{},j=h.retries,P=h.retryDelay;h.retries=y,h.retryDelay=E;let D;try{D=await Nt(H,t,R,k,e,I.signal)}finally{h.retries=j,h.retryDelay=P}if(t==="get"&&ee(lt,D,m),a&&(D==null||Array.isArray(D)&&D.length===0)){let C=z(a);C&&(e.innerHTML="",e.appendChild(C),B(e));return}if(w.$set(o,D),A&&(Y[A]||(Y[A]=O({})),Y[A].$set(o,D),xt()),c){let C=z(c);if(C){e.innerHTML="";let ft=document.getElementById(c.replace("#",""))?.getAttribute("var")||b||"result",ot=O({[ft]:D},w),V=document.createElement("div");V.style.display="contents",V.__ctx=ot,V.appendChild(C),e.appendChild(V),B(V)}}else{e.innerHTML="";for(let C of F)e.appendChild(C.cloneNode(!0));dt(e),B(e)}d&&Q(d,w,{result:D}),f&&tt&&tt.push(f),Dt("fetch:success",{url:H,data:D})}catch(R){if(R.name==="AbortError")return;if(st(`${t.toUpperCase()} ${H} failed:`,R.message),Dt("fetch:error",{url:H,error:R}),Dt("error",{url:H,error:R}),s){let k=z(s);if(k){e.innerHTML="";let P=document.getElementById(s.replace("#",""))?.getAttribute("var")||"err",D=O({[P]:{message:R.message,status:R.status,body:R.body}},w),C=document.createElement("div");C.style.display="contents",C.__ctx=D,C.appendChild(k),e.appendChild(C),B(C)}}}}if(e.tagName==="FORM"&&t!=="get"?e.addEventListener("submit",H=>{H.preventDefault(),U()}):t==="get"?U():e.addEventListener("click",H=>{H.preventDefault(),U()}),/\{[^}]+\}/.test(n)){let k=function(){let P=gt(n,w);P!==lt&&(lt=P,R&&clearTimeout(R),H>0?R=setTimeout(U,H):U())},H=parseInt(e.getAttribute("debounce"))||0,lt=gt(n,w),R=null,j=_;for(;j&&j.__isProxy;)j.$watch(k),j=j.$parent}if(p>0){let H=setInterval(U,p);G(()=>clearInterval(H))}}});J();S("bind",{priority:20,init(t,e,r){let n=$(t);function o(){let i=x(r,n);t.textContent=i!=null?String(i):""}W(r,n,o),o()}});S("bind-html",{priority:20,init(t,e,r){let n=$(t);function o(){let i=x(r,n);i!=null&&(t.innerHTML=re(String(i)))}W(r,n,o),o()}});S("bind-*",{priority:20,init(t,e,r){let n=e.replace("bind-",""),o=$(t);n==="value"&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")&&t.addEventListener("input",()=>{let s=t.type==="number"?Number(t.value):t.value;Q(`${r} = ${JSON.stringify(s)}`,o)});function i(){let s=x(r,o);if(["disabled","readonly","checked","selected","hidden","required"].includes(n)){s?t.setAttribute(n,""):t.removeAttribute(n),n in t&&(t[n]=!!s);return}s!=null?t.setAttribute(n,String(s)):t.removeAttribute(n)}W(r,o,i),i()}});S("model",{priority:20,init(t,e,r){let n=$(t),o=t.tagName,i=t.type;function s(){let c=x(r,n);o==="INPUT"&&i==="checkbox"?t.checked=!!c:o==="INPUT"&&i==="radio"?t.checked=t.value===String(c):t.value=c!=null?String(c):""}let a=o==="SELECT"||i==="checkbox"||i==="radio"?"change":"input";t.addEventListener(a,()=>{let c;i==="checkbox"?c=t.checked:i==="number"||i==="range"?c=Number(t.value):c=t.value,Q(`${r} = __val`,n,{__val:c})}),W(r,n,s),s()}});J();S("if",{priority:10,init(t,e,r){let n=$(t),o=t.getAttribute("then"),i=t.getAttribute("else"),s=t.getAttribute("animate-enter")||t.getAttribute("animate"),a=t.getAttribute("animate-leave"),c=t.getAttribute("transition"),d=parseInt(t.getAttribute("animate-duration"))||0,f=[...t.childNodes].map(m=>m.cloneNode(!0)),l;function p(){let m=!!x(r,n);m!==l&&(l=m,a||c?Bt(t,a,c,()=>u(m),d):u(m))}function u(m){if(m)if(o){let L=z(o);L&&(t.innerHTML="",t.appendChild(L))}else{t.innerHTML="";for(let L of f)t.appendChild(L.cloneNode(!0))}else if(i){let L=z(i);L&&(t.innerHTML="",t.appendChild(L))}else t.innerHTML="";dt(t),B(t),(s||c)&&Lt(t,s,c,d)}W(r,n,p),p()}});S("else-if",{priority:10,init(t,e,r){let n=$(t),o=t.getAttribute("then"),i=[...t.childNodes].map(a=>a.cloneNode(!0));function s(){let a=t.previousElementSibling;for(;a;){let d=a.getAttribute("if")||a.getAttribute("else-if");if(d){if(x(d,n)){t.innerHTML="",t.style.display="none";return}}else break;a=a.previousElementSibling}let c=!!x(r,n);if(t.style.display="",c){if(o){let d=z(o);d&&(t.innerHTML="",t.appendChild(d))}else{t.innerHTML="";for(let d of i)t.appendChild(d.cloneNode(!0))}dt(t),B(t)}else t.innerHTML=""}W(r,n,s),s()}});S("else",{priority:10,init(t){if(t.hasAttribute("if"))return;let e=$(t),r=t.getAttribute("then"),n=[...t.childNodes].map(i=>i.cloneNode(!0));function o(){let i=t.previousElementSibling;for(;i;){let s=i.getAttribute("if")||i.getAttribute("else-if");if(s){if(x(s,e)){t.innerHTML="",t.style.display="none";return}}else break;i=i.previousElementSibling}if(t.style.display="",r){let s=z(r);s&&(t.innerHTML="",t.appendChild(s))}else{t.innerHTML="";for(let s of n)t.appendChild(s.cloneNode(!0))}dt(t),B(t)}W("",e,o),o()}});S("show",{priority:20,init(t,e,r){let n=$(t),o=t.getAttribute("animate-enter")||t.getAttribute("animate"),i=t.getAttribute("animate-leave"),s=t.getAttribute("transition"),a=parseInt(t.getAttribute("animate-duration"))||0,c;function d(){let f=!!x(r,n);f!==c&&(c=f,f?(t.style.display="",(o||s)&&Lt(t,o,s,a)):i||s?Bt(t,i,s,()=>{t.style.display="none"},a):t.style.display="none")}W(r,n,d),d()}});S("hide",{priority:20,init(t,e,r){let n=$(t),o=t.getAttribute("animate-enter")||t.getAttribute("animate"),i=t.getAttribute("animate-leave"),s=t.getAttribute("transition"),a=parseInt(t.getAttribute("animate-duration"))||0,c;function d(){let f=!x(r,n);f!==c&&(c=f,f?(t.style.display="",(o||s)&&Lt(t,o,s,a)):i||s?Bt(t,i,s,()=>{t.style.display="none"},a):t.style.display="none")}W(r,n,d),d()}});S("switch",{priority:10,init(t,e,r){let n=$(t);function o(){let i=x(r,n),s=!1;for(let a of[...t.children]){let c=a.getAttribute("case"),d=a.hasAttribute("default"),f=a.getAttribute("then");if(c){let l=c.split(",").map(p=>x(p.trim(),n));if(!s&&l.includes(i)){if(s=!0,a.style.display="",f){let p=z(f);p&&(a.innerHTML="",a.appendChild(p)),a.__declared=!1,B(a)}}else a.style.display="none"}else if(d&&(a.style.display=s?"none":"",!s&&f)){let l=z(f);l&&(a.innerHTML="",a.appendChild(l)),a.__declared=!1,B(a)}}}W(r,n,o),o()}});J();S("each",{priority:10,init(t,e,r){let n=$(t),o=r.match(/^(\w+)\s+in\s+(\S+)$/);if(!o)return;let[,i,s]=o,a=t.getAttribute("template"),c=t.getAttribute("else"),d=t.getAttribute("key"),f=t.getAttribute("animate-enter")||t.getAttribute("animate"),l=t.getAttribute("animate-leave"),p=parseInt(t.getAttribute("animate-stagger"))||0,u=parseInt(t.getAttribute("animate-duration"))||0,m=null;function L(){let b=/[\[\]()\s+\-*\/!?:&|]/.test(s)?x(s,n):rt(s,n);if(!Array.isArray(b))return;if(b===m&&b.length>0&&t.children.length>0){for(let y of t.children)y.__ctx&&y.__ctx.$notify&&y.__ctx.$notify();return}if(m=b,b.length===0&&c){let y=z(c);y&&(t.innerHTML="",t.appendChild(y),B(t));return}let A=a?document.getElementById(a):null;if(A)if(l&&t.children.length>0){let y=[...t.children],E=y.length;y.forEach(T=>{let _=T.firstElementChild||T;_.classList.add(l);let w=()=>{_.classList.remove(l),E--,E<=0&&v(A,b)};_.addEventListener("animationend",w,{once:!0}),setTimeout(w,u||2e3)})}else v(A,b)}function v(b,A){let y=A.length;t.innerHTML="",A.forEach((E,T)=>{let _={[i]:E,$index:T,$count:y,$first:T===0,$last:T===y-1,$even:T%2===0,$odd:T%2!==0},w=O(_,n),F=b.content.cloneNode(!0),I=document.createElement("div");if(I.style.display="contents",I.__ctx=w,I.appendChild(F),t.appendChild(I),B(I),f){let U=I.firstElementChild;U&&(U.classList.add(f),U.addEventListener("animationend",()=>U.classList.remove(f),{once:!0}),p&&(U.style.animationDelay=T*p+"ms"))}})}W(r,n,L),L()}});S("foreach",{priority:10,init(t,e,r){let n=$(t),o=t.getAttribute("from"),i=t.getAttribute("index")||"$index",s=t.getAttribute("else"),a=t.getAttribute("filter"),c=t.getAttribute("sort"),d=parseInt(t.getAttribute("limit"))||1/0,f=parseInt(t.getAttribute("offset"))||0,l=t.getAttribute("template"),p=t.getAttribute("animate-enter")||t.getAttribute("animate"),u=t.getAttribute("animate-leave"),m=parseInt(t.getAttribute("animate-stagger"))||0,L=parseInt(t.getAttribute("animate-duration"))||0;if(!o||!r)return;let v=l?null:t.cloneNode(!0);function b(){let A=rt(o,n);if(!Array.isArray(A))return;if(a&&(A=A.filter((_,w)=>{let F=O({[r]:_,[i]:w},n);return!!x(a,F)})),c){let _=c.startsWith("-"),w=_?c.slice(1):c;A=[...A].sort((F,I)=>{let U=rt(w,F)??F?.[w],nt=rt(w,I)??I?.[w],H=U<nt?-1:U>nt?1:0;return _?-H:H})}if(A=A.slice(f,f+d),A.length===0&&s){let _=z(s);_&&(t.innerHTML="",t.appendChild(_),B(t));return}let y=l?document.getElementById(l):null,E=A.length;function T(){t.innerHTML="",A.forEach((_,w)=>{let F={[r]:_,[i]:w,$index:w,$count:E,$first:w===0,$last:w===E-1,$even:w%2===0,$odd:w%2!==0},I=O(F,n),U;y?U=y.content.cloneNode(!0):U=v.cloneNode(!0);let nt=document.createElement("div");if(nt.style.display="contents",nt.__ctx=I,nt.appendChild(U),t.appendChild(nt),B(nt),p){let H=nt.firstElementChild;H&&(H.classList.add(p),H.addEventListener("animationend",()=>H.classList.remove(p),{once:!0}),m&&(H.style.animationDelay=w*m+"ms"))}})}if(u&&t.children.length>0){let _=[...t.children],w=_.length;_.forEach(F=>{let I=F.firstElementChild||F;I.classList.add(u);let U=()=>{I.classList.remove(u),w--,w<=0&&T()};I.addEventListener("animationend",U,{once:!0}),setTimeout(U,L||2e3)})}else T()}W(o,n,b),b()}});J();pt();S("class-*",{priority:20,init(t,e,r){let n=e.replace("class-",""),o=$(t);if(n==="map"){let s=function(){let a=x(r,o);if(a&&typeof a=="object")for(let[c,d]of Object.entries(a))c.split(/\s+/).filter(Boolean).forEach(l=>t.classList.toggle(l,!!d))};W(r,o,s),s();return}if(n==="list"){let a=function(){let c=x(r,o);if(Array.isArray(c)){s.forEach(f=>{f&&t.classList.remove(f)});let d=c.filter(Boolean);d.forEach(f=>t.classList.add(f)),s=d}},s=[];W(r,o,a),a();return}function i(){t.classList.toggle(n,!!x(r,o))}W(r,o,i),(r.includes("$i18n")||r.includes("NoJS.locale"))&&$t(i),i()}});S("style-*",{priority:20,init(t,e,r){let n=e.replace("style-",""),o=$(t);if(n==="map"){let a=function(){let c=x(r,o);if(c&&typeof c=="object")for(let[d,f]of Object.entries(c))t.style[d]=f??""};W(r,o,a),a();return}let i=n.replace(/-([a-z])/g,(a,c)=>c.toUpperCase());function s(){let a=x(r,o);t.style[i]=a!=null?String(a):""}W(r,o,s),s()}});J();S("on:*",{priority:20,init(t,e,r){let n=$(t),o=e.replace("on:","").split("."),i=o[0],s=new Set(o.slice(1));if(i==="mounted"){requestAnimationFrame(()=>Q(r,n,{$el:t}));return}if(i==="init"){Q(r,n,{$el:t});return}if(i==="updated"){let l=new MutationObserver(()=>{Q(r,n,{$el:t})});l.observe(t,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),G(()=>l.disconnect());return}if(i==="error"){let l=p=>{(t.contains(p.target)||p.target===t)&&Q(r,n,{$el:t,$error:p.error||p.message})};window.addEventListener("error",l),G(()=>window.removeEventListener("error",l));return}if(i==="unmounted"){let l=new MutationObserver(p=>{for(let u of p)for(let m of u.removedNodes)if(m===t||m.contains?.(t)){Q(r,n,{$el:t}),l.disconnect();return}});t.parentElement&&l.observe(t.parentElement,{childList:!0,subtree:!0}),G(()=>l.disconnect());return}let a=0,c=0;for(let l of s)/^\d+$/.test(l)&&(s.has("debounce")?a=parseInt(l):s.has("throttle")&&(c=parseInt(l)));let d=l=>{if(i==="keydown"||i==="keyup"||i==="keypress"){let p=["enter","escape","tab","space","delete","backspace","up","down","left","right","ctrl","alt","shift","meta"];for(let u of s)if(p.includes(u)&&(u==="enter"&&l.key!=="Enter"||u==="escape"&&l.key!=="Escape"||u==="tab"&&l.key!=="Tab"||u==="space"&&l.key!==" "||u==="delete"&&l.key!=="Delete"&&l.key!=="Backspace"||u==="up"&&l.key!=="ArrowUp"||u==="down"&&l.key!=="ArrowDown"||u==="left"&&l.key!=="ArrowLeft"||u==="right"&&l.key!=="ArrowRight"||u==="ctrl"&&!l.ctrlKey||u==="alt"&&!l.altKey||u==="shift"&&!l.shiftKey||u==="meta"&&!l.metaKey))return}s.has("prevent")&&l.preventDefault(),s.has("stop")&&l.stopPropagation(),!(s.has("self")&&l.target!==t)&&Q(r,n,{$event:l,$el:t})};if(a>0){let l=d,p;d=u=>{clearTimeout(p),p=setTimeout(()=>l(u),a)}}if(c>0){let l=d,p=0;d=u=>{let m=Date.now();m-p>=c&&(p=m,l(u))}}let f={};s.has("once")&&(f.once=!0),t.addEventListener(i,d,f)}});S("trigger",{priority:20,init(t,e,r){let n=$(t),o=t.getAttribute("trigger-data");t.addEventListener("click",()=>{let i=o?x(o,n):null;t.dispatchEvent(new CustomEvent(r,{detail:i,bubbles:!0}))})}});J();S("ref",{priority:5,init(t,e,r){ut[r]=t,G(()=>{ut[r]===t&&delete ut[r]})}});S("use",{priority:10,init(t,e,r){let n=$(t),o=z(r);if(!o)return;let i={};for(let f of[...t.attributes])if(f.name.startsWith("var-")){let l=f.name.replace("var-","");i[l]=x(f.value,n)}let s=O(i,n),a={};for(let f of[...t.children]){let l=f.getAttribute("slot")||"default";a[l]||(a[l]=document.createDocumentFragment()),a[l].appendChild(f.cloneNode(!0))}let c=o.querySelectorAll("slot");for(let f of c){let l=f.getAttribute("name")||"default";a[l]&&f.replaceWith(a[l])}t.innerHTML="";let d=document.createElement("div");d.style.display="contents",d.__ctx=s,d.appendChild(o),t.appendChild(d),B(d)}});S("call",{priority:20,init(t,e,r){let n=$(t),o=t.getAttribute("method")||"get",i=t.getAttribute("as"),s=t.getAttribute("into"),a=t.getAttribute("success"),c=t.getAttribute("error"),d=t.getAttribute("then"),f=t.getAttribute("confirm"),l=t.getAttribute("body");t.addEventListener("click",async p=>{if(p.preventDefault(),f&&!window.confirm(f))return;let u=gt(r,n);try{let m=null;if(l){let v=gt(l,n);try{m=JSON.parse(v)}catch{m=v}}let L=await Nt(u,o,m,{},t);if(i&&n.$set(i,L),i&&s&&(Y[s]||(Y[s]=O({})),Y[s].$set(i,L),xt()),d&&Q(d,n,{result:L}),a){let v=z(a);if(v){let A=document.getElementById(a.replace("#",""))?.getAttribute("var")||"result",y=O({[A]:L},n),E=t.closest("[route-view]")||t.parentElement,T=document.createElement("div");T.style.display="contents",T.__ctx=y,T.appendChild(v),E.appendChild(T),B(T)}}}catch(m){if(c){let L=z(c);if(L){let b=document.getElementById(c.replace("#",""))?.getAttribute("var")||"err",A=O({[b]:{message:m.message,status:m.status}},n),y=t.parentElement,E=document.createElement("div");E.style.display="contents",E.__ctx=A,E.appendChild(L),y.appendChild(E),B(E)}}}})}});J();function pe(t,e,r){let n=e.split("|").map(o=>o.trim());for(let o of n){let[i,...s]=o.split(":"),a=bt[i];if(a){let c=a(t,...s,r);if(c!==!0&&c)return c}else switch(i){case"required":if(t==null||String(t).trim()==="")return"Required";break;case"email":if(t&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return"Invalid email";break;case"url":try{new URL(t)}catch{return"Invalid URL"}break;case"min":if(Number(t)<Number(s[0]))return`Minimum value is ${s[0]}`;break;case"max":if(Number(t)>Number(s[0]))return`Maximum value is ${s[0]}`;break;case"between":{let c=Number(t);if(c<Number(s[0])||c>Number(s[1]))return`Must be between ${s[0]} and ${s[1]}`;break}case"match":if(t!==r[s[0]])return`Must match ${s[0]}`;break;case"phone":if(!/^[\d\s\-+()]{7,15}$/.test(t))return"Invalid phone number";break;case"cpf":if(!/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/.test(t))return"Invalid CPF";break;case"cnpj":if(!/^\d{2}\.?\d{3}\.?\d{3}\/?\d{4}-?\d{2}$/.test(t))return"Invalid CNPJ";break;case"creditcard":if(!/^\d{13,19}$/.test(t.replace(/\s|-/g,"")))return"Invalid card number";break;case"custom":if(s[0]&&bt[s[0]]){let c=bt[s[0]](t,r);if(c!==!0&&c)return c}break}}return null}S("validate",{priority:30,init(t,e,r){let n=$(t);if(t.tagName==="FORM"){let i=function(){let s={},a={},c=!0;for(let d of t.querySelectorAll("input, textarea, select")){if(!d.name)continue;a[d.name]=d.value;let f=d.getAttribute("validate");if(f){let l=pe(d.value,f,a);l&&(s[d.name]=l,c=!1)}d.checkValidity()||(s[d.name]=s[d.name]||d.validationMessage,c=!1)}o.valid=c,o.errors=s,o.values=a,n.$set("$form",{...o})},o={valid:!1,dirty:!1,touched:!1,submitting:!1,errors:{},values:{},reset:()=>{o.dirty=!1,o.touched=!1,t.reset(),i()}};n.$set("$form",o),t.addEventListener("input",()=>{o.dirty=!0,i()}),t.addEventListener("focusout",()=>{o.touched=!0,i()}),t.addEventListener("submit",()=>{o.submitting=!0,n.$set("$form",{...o}),requestAnimationFrame(()=>{o.submitting=!1,n.$set("$form",{...o})})}),requestAnimationFrame(i);return}if(r&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")){let o=t.getAttribute("error");t.addEventListener("input",()=>{let i=pe(t.value,r,{});if(i&&o){let s=t.nextElementSibling?.__validationError?t.nextElementSibling:null;s||(s=document.createElement("div"),s.__validationError=!0,s.style.display="contents",t.parentNode.insertBefore(s,t.nextSibling));let a=z(o);if(a){let c=O({err:{message:i}},n);s.innerHTML="",s.__ctx=c,s.appendChild(a),B(s)}}else{let s=t.nextElementSibling?.__validationError?t.nextElementSibling:null;s&&(s.innerHTML="")}})}}});S("error-boundary",{priority:1,init(t,e,r){let n=$(t);function o(s){let a=z(r);if(a){let c=O({err:{message:s}},n);t.innerHTML="";let d=document.createElement("div");d.style.display="contents",d.__ctx=c,d.appendChild(a),t.appendChild(d),B(d)}}t.addEventListener("nojs:error",s=>{o(s.detail?.message||"An error occurred")});let i=s=>{(t.contains(s.target)||t===s.target)&&o(s.message||"An error occurred")};window.addEventListener("error",i),G(()=>window.removeEventListener("error",i))}});pt();J();S("t",{priority:20,init(t,e,r){let n=$(t),o=t.hasAttribute("t-html");function i(){let s={};for(let c of[...t.attributes])if(c.name.startsWith("t-")&&c.name!=="t"&&c.name!=="t-html"){let d=c.name.replace("t-","");s[d]=x(c.value,n)??c.value}let a=q.t(r,s);o?t.innerHTML=a:t.textContent=a}W(r,n,i),$t(i),i()}});S("i18n-ns",{priority:1,init(t,e,r){if(!r)return;let n=document.createDocumentFragment();for(;t.firstChild;)n.appendChild(t.firstChild);zt(r).then(()=>{t.appendChild(n),B(t),Tt()})}});J();var g={dragging:null,selected:new Map,placeholder:null};function jt(t){let e=0;for(let r of t.children){if(r.classList.contains("nojs-drop-placeholder"))continue;(r.style||{}).display==="contents"?e+=jt(r):e++}return e}function Xt(){if(typeof document>"u"||document.querySelector("style[data-nojs-dnd]"))return;let t=`
25
+ .nojs-dragging {
26
+ opacity: 0.5;
27
+ cursor: grabbing !important;
28
+ }
29
+ .nojs-drag-over {
30
+ outline: 2px dashed #3b82f6;
31
+ outline-offset: -2px;
32
+ }
33
+ .nojs-drop-placeholder {
34
+ border: 2px dashed #3b82f6;
35
+ border-radius: 6px;
36
+ background: color-mix(in srgb, #3b82f6 6%, transparent);
37
+ box-sizing: border-box;
38
+ min-height: 2.5rem;
39
+ transition: all 0.15s ease;
40
+ pointer-events: none;
41
+ }
42
+ .nojs-drop-reject {
43
+ outline: 2px dashed #ef4444;
44
+ outline-offset: -2px;
45
+ background: color-mix(in srgb, #ef4444 4%, transparent);
46
+ }
47
+ .nojs-selected {
48
+ outline: 2px solid #3b82f6;
49
+ outline-offset: 1px;
50
+ }
51
+ [drag-axis="x"] { touch-action: pan-y; }
52
+ [drag-axis="y"] { touch-action: pan-x; }
53
+ @keyframes nojs-drop-settle {
54
+ from { transform: scale(1.05); opacity: 0.8; }
55
+ to { transform: scale(1); opacity: 1; }
56
+ }
57
+ .nojs-drop-settle {
58
+ animation: nojs-drop-settle 0.2s ease-out;
59
+ }
60
+ .nojs-drag-list-empty {
61
+ min-height: 3rem;
62
+ }
63
+ `.trim(),e=document.createElement("style");e.setAttribute("data-nojs-dnd",""),e.textContent=t,document.head.appendChild(e)}function Mt(t,e,r,n){let o=[...t.children].filter(i=>!i.classList.contains("nojs-drop-placeholder"));if(o.length===0)return 0;for(let i=0;i<o.length;i++){let a=(o[i].style&&o[i].style.display==="contents"&&o[i].firstElementChild||o[i]).getBoundingClientRect();if(n==="horizontal"){let c=a.left+a.width/2;if(e<c)return i}else if(n==="grid"){let c=a.left+a.width/2,d=a.top+a.height/2;if(r<d&&e<c||r<a.top+a.height&&e<c)return i}else{let c=a.top+a.height/2;if(r<c)return i}}return o.length}function ge(t,e,r,n){at();let o;if(r==="auto"){if(o=document.createElement("div"),o.className=n||"nojs-drop-placeholder",g.dragging&&g.dragging.sourceEl){let a=(g.dragging.sourceEl.firstElementChild||g.dragging.sourceEl).getBoundingClientRect();a.height>0&&(o.style.height=a.height+"px"),a.width>0&&(o.style.width=a.width+"px")}}else{let s=document.getElementById(r.startsWith("#")?r.slice(1):r);s&&s.content?(o=document.createElement("div"),o.style.display="contents",o.className=n||"nojs-drop-placeholder",o.appendChild(s.content.cloneNode(!0))):(o=document.createElement("div"),o.className=n||"nojs-drop-placeholder")}o.classList.add("nojs-drop-placeholder");let i=[...t.children].filter(s=>!s.classList.contains("nojs-drop-placeholder"));e>=i.length?t.appendChild(o):t.insertBefore(o,i[e]),g.placeholder=o}function at(){g.placeholder&&(g.placeholder.remove(),g.placeholder=null)}function _t(t,e){return!e||e==="*"?!0:e.split(",").map(n=>n.trim()).includes(t)}function Ie(t,e){let r=document.createElement("div");r.style.cssText="position:fixed;top:-9999px;left:-9999px;pointer-events:none;z-index:99999;";let n=t.style&&t.style.display==="contents"&&t.firstElementChild||t,o=n.getBoundingClientRect(),i=o.width,s=o.height,a=getComputedStyle(n),c=Math.min(e,3);for(let f=c-1;f>=0;f--){let l=document.createElement("div"),p=f*4;l.style.cssText="position:absolute;top:"+p+"px;left:"+p+"px;width:"+i+"px;height:"+s+"px;border-radius:"+a.borderRadius+";box-shadow:0 1px 4px rgba(0,0,0,0.12);overflow:hidden;box-sizing:border-box;",f===0?(l.innerHTML=n.innerHTML,l.style.background=a.backgroundColor||"#fff",l.style.border=a.border,l.style.padding=a.padding,l.style.fontSize=a.fontSize,l.style.color=a.color,l.style.fontFamily=a.fontFamily):(l.style.background=a.backgroundColor||"#fff",l.style.border=a.border||"1px solid #ddd"),r.appendChild(l)}let d=document.createElement("div");return d.textContent=e,d.style.cssText="position:absolute;top:-6px;right:-6px;min-width:22px;height:22px;padding:0 5px;background:#3b82f6;color:#fff;border-radius:11px;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;border:2px solid #fff;box-shadow:0 1px 3px rgba(0,0,0,0.2);",r.appendChild(d),r.style.width=i+(c-1)*4+"px",r.style.height=s+(c-1)*4+"px",r}S("drag",{priority:15,init(t,e,r){Xt();let n=$(t),o=t.getAttribute("drag-type")||"default",i=t.getAttribute("drag-effect")||"move",s=t.getAttribute("drag-handle"),a=t.getAttribute("drag-image"),c=t.getAttribute("drag-image-offset")||"0,0",d=t.getAttribute("drag-disabled"),f=t.getAttribute("drag-class")||"nojs-dragging",l=t.getAttribute("drag-ghost-class");t.draggable=!0,t.setAttribute("aria-grabbed","false"),t.getAttribute("tabindex")||t.setAttribute("tabindex","0");let p=!0;if(s){let v=b=>{p=!!b.target.closest(s)};t.addEventListener("mousedown",v),G(()=>t.removeEventListener("mousedown",v))}let u=v=>{if(s&&!p){v.preventDefault();return}if(d&&x(d,n)){v.preventDefault();return}let b=x(r,n),A=t.getAttribute("drag-group"),y=b;if(A&&g.selected.has(A)){let E=g.selected.get(A);E.size>0&&[...E].some(_=>_.el===t)&&(y=[...E].map(_=>_.item))}if(g.dragging={item:y,type:o,effect:i,sourceEl:t,sourceCtx:n,sourceList:null,sourceIndex:null,listDirective:null},v.dataTransfer){if(v.dataTransfer.effectAllowed=i,v.dataTransfer.setData("text/plain",""),Array.isArray(y)&&y.length>1&&v.dataTransfer.setDragImage){let E=Ie(t,y.length);document.body.appendChild(E);let T=t.getBoundingClientRect();v.dataTransfer.setDragImage(E,T.width/2,T.height/2),requestAnimationFrame(()=>E.remove())}else if(a&&v.dataTransfer.setDragImage)if(a==="none"){let E=document.createElement("div");E.style.cssText="width:1px;height:1px;opacity:0;position:fixed;top:-999px",document.body.appendChild(E);let[T,_]=c.split(",").map(Number);v.dataTransfer.setDragImage(E,T||0,_||0),requestAnimationFrame(()=>E.remove())}else{let E=t.querySelector(a);if(E){let[T,_]=c.split(",").map(Number);l&&E.classList.add(l),v.dataTransfer.setDragImage(E,T||0,_||0)}}}if(f.split(/\s+/).filter(Boolean).forEach(E=>t.classList.add(E)),Array.isArray(y)&&A&&g.selected.has(A))for(let E of g.selected.get(A))E.el!==t&&f.split(/\s+/).filter(Boolean).forEach(T=>E.el.classList.add(T));t.setAttribute("aria-grabbed","true"),t.dispatchEvent(new CustomEvent("drag-start",{bubbles:!0,detail:{item:y,index:g.dragging.sourceIndex,el:t}}))},m=()=>{f.split(/\s+/).filter(Boolean).forEach(b=>t.classList.remove(b));let v=t.getAttribute("drag-group");if(v&&g.selected.has(v))for(let b of g.selected.get(v))f.split(/\s+/).filter(Boolean).forEach(A=>b.el.classList.remove(A));if(t.setAttribute("aria-grabbed","false"),l&&a&&a!=="none"){let b=t.querySelector(a);b&&b.classList.remove(l)}t.dispatchEvent(new CustomEvent("drag-end",{bubbles:!0,detail:{item:g.dragging?.item,index:g.dragging?.sourceIndex,dropped:g.dragging===null}})),g.dragging=null,at()};if(t.addEventListener("dragstart",u),t.addEventListener("dragend",m),G(()=>{t.removeEventListener("dragstart",u),t.removeEventListener("dragend",m)}),d){let v=function(){let b=!!x(d,n);t.draggable=!b,b?t.removeAttribute("aria-grabbed"):t.setAttribute("aria-grabbed","false")};n.$watch(v)}let L=v=>{if(g.dragging&&!g.dragging.sourceEl.isConnected&&(g.dragging=null),v.key===" "&&!g.dragging){v.preventDefault();let b=x(r,n);g.dragging={item:b,type:o,effect:i,sourceEl:t,sourceCtx:n,sourceList:null,sourceIndex:null,listDirective:null},f.split(/\s+/).filter(Boolean).forEach(A=>t.classList.add(A)),t.setAttribute("aria-grabbed","true"),t.dispatchEvent(new CustomEvent("drag-start",{bubbles:!0,detail:{item:b,index:null,el:t}}))}else v.key==="Escape"&&g.dragging&&g.dragging.sourceEl===t&&(v.preventDefault(),f.split(/\s+/).filter(Boolean).forEach(b=>t.classList.remove(b)),t.setAttribute("aria-grabbed","false"),g.dragging=null,at())};t.addEventListener("keydown",L),G(()=>t.removeEventListener("keydown",L))}});S("drop",{priority:15,init(t,e,r){Xt();let n=$(t),o=t.getAttribute("drop-accept")||"default",i=t.getAttribute("drop-effect")||"move",s=t.getAttribute("drop-class")||"nojs-drag-over",a=t.getAttribute("drop-reject-class")||"nojs-drop-reject",c=t.getAttribute("drop-disabled"),d=t.getAttribute("drop-max"),f=t.getAttribute("drop-sort"),l=t.getAttribute("drop-placeholder"),p=t.getAttribute("drop-placeholder-class");t.setAttribute("aria-dropeffect",i);let u=0,m=y=>{if(!g.dragging||c&&x(c,n))return;let E=_t(g.dragging.type,o),T=!0;if(d){let _=x(d,n),w=jt(t);typeof _=="number"&&w>=_&&(T=!1)}if(!E||!T){a.split(/\s+/).filter(Boolean).forEach(_=>t.classList.add(_)),s.split(/\s+/).filter(Boolean).forEach(_=>t.classList.remove(_)),at();return}if(a.split(/\s+/).filter(Boolean).forEach(_=>t.classList.remove(_)),y.preventDefault(),y.dataTransfer&&(y.dataTransfer.dropEffect=i),f){let _=Mt(t,y.clientX,y.clientY,f);l&&ge(t,_,l,p),t.dispatchEvent(new CustomEvent("drag-over",{bubbles:!1,detail:{item:g.dragging.item,index:_}}))}},L=y=>{if(g.dragging&&!(c&&x(c,n))&&(u++,u===1)){let E=_t(g.dragging.type,o),T=!0;if(d){let _=x(d,n),w=jt(t);typeof _=="number"&&w>=_&&(T=!1)}E&&T?(s.split(/\s+/).filter(Boolean).forEach(_=>t.classList.add(_)),t.dispatchEvent(new CustomEvent("drag-enter",{bubbles:!1,detail:{item:g.dragging.item,type:g.dragging.type}}))):a.split(/\s+/).filter(Boolean).forEach(_=>t.classList.add(_))}},v=y=>{g.dragging&&(u--,u<=0&&(u=0,s.split(/\s+/).filter(Boolean).forEach(E=>t.classList.remove(E)),a.split(/\s+/).filter(Boolean).forEach(E=>t.classList.remove(E)),at(),t.dispatchEvent(new CustomEvent("drag-leave",{bubbles:!1,detail:{item:g.dragging.item}}))))},b=y=>{if(y.preventDefault(),y.stopPropagation(),u=0,!g.dragging||c&&x(c,n)||!_t(g.dragging.type,o))return;if(d){let I=x(d,n),U=jt(t);if(typeof I=="number"&&U>=I)return}let E=g.dragging.item,T=g.dragging.type,_=g.dragging.effect,w=0;f&&(w=Mt(t,y.clientX,y.clientY,f)),s.split(/\s+/).filter(Boolean).forEach(I=>t.classList.remove(I)),a.split(/\s+/).filter(Boolean).forEach(I=>t.classList.remove(I)),at();let F={$drag:E,$dragType:T,$dragEffect:_,$dropIndex:w,$source:{list:g.dragging.sourceList,index:g.dragging.sourceIndex,el:g.dragging.sourceEl},$target:{list:null,index:w,el:t},$el:t};Q(r,n,F),g.dragging=null,t.dispatchEvent(new CustomEvent("drop",{bubbles:!1,detail:{item:E,index:w,source:F.$source,target:F.$target,effect:_}}))},A=y=>{g.dragging&&(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),b(y))};t.addEventListener("dragover",m),t.addEventListener("dragenter",L),t.addEventListener("dragleave",v),t.addEventListener("drop",b),t.addEventListener("keydown",A),G(()=>{t.removeEventListener("dragover",m),t.removeEventListener("dragenter",L),t.removeEventListener("dragleave",v),t.removeEventListener("drop",b),t.removeEventListener("keydown",A)})}});var me=new Map;S("drag-list",{priority:10,init(t,e,r){Xt();let n=$(t),o=t.getAttribute("template"),i=t.getAttribute("drag-list-key"),s=t.getAttribute("drag-list-item")||"item",a=t.getAttribute("drop-sort")||"vertical",c=t.getAttribute("drag-type")||"__draglist_"+r,d=t.getAttribute("drop-accept")||c,f=t.hasAttribute("drag-list-copy"),l=t.hasAttribute("drag-list-remove"),p=t.getAttribute("drag-disabled"),u=t.getAttribute("drop-disabled"),m=t.getAttribute("drop-max"),L=t.getAttribute("drop-placeholder"),v=t.getAttribute("drop-placeholder-class"),b=t.getAttribute("drag-class")||"nojs-dragging",A=t.getAttribute("drop-class")||"nojs-drag-over",y=t.getAttribute("drop-reject-class")||"nojs-drop-reject",E=t.getAttribute("drop-settle-class")||"nojs-drop-settle",T=t.getAttribute("drop-empty-class")||"nojs-drag-list-empty";t.setAttribute("role","listbox"),t.setAttribute("aria-dropeffect",f?"copy":"move");let _={listPath:r,ctx:n,el:t};me.set(t,_),G(()=>me.delete(t));let w=0,F=null;function I(){let k=rt(r,n);if(!Array.isArray(k))return;if(k===F&&k.length>0&&t.children.length>0){for(let C of t.children)C.__ctx&&C.__ctx.$notify&&C.__ctx.$notify();return}F=k;let j=o?document.getElementById(o):null;if(!j)return;t.innerHTML="";let P=k.length;k.forEach((C,et)=>{let ft={[s]:C,$index:et,$count:P,$first:et===0,$last:et===P-1,$even:et%2===0,$odd:et%2!==0},ot=O(ft,n),V=j.content.cloneNode(!0),M=document.createElement("div");M.style.display="contents",M.__ctx=ot,M.setAttribute("role","option"),M.appendChild(V),t.appendChild(M);let X=M.firstElementChild||M;X.draggable=!0,X.setAttribute("aria-grabbed","false"),X.getAttribute("tabindex")||X.setAttribute("tabindex","0");let vt=Z=>{if(p&&x(p,n)){Z.preventDefault();return}g.dragging={item:C,type:c,effect:f?"copy":"move",sourceEl:M,sourceCtx:ot,sourceList:k,sourceIndex:et,listDirective:{el:t,listPath:r,ctx:n,keyProp:i,copyMode:f,removeMode:l}},Z.dataTransfer&&(Z.dataTransfer.effectAllowed=f?"copy":"move",Z.dataTransfer.setData("text/plain","")),b.split(/\s+/).filter(Boolean).forEach(it=>X.classList.add(it)),X.setAttribute("aria-grabbed","true"),t.dispatchEvent(new CustomEvent("drag-start",{bubbles:!0,detail:{item:C,index:et,el:X}}))},Ot=()=>{b.split(/\s+/).filter(Boolean).forEach(Z=>X.classList.remove(Z)),X.setAttribute("aria-grabbed","false"),g.dragging&&g.dragging.sourceEl===M&&(g.dragging=null),at()};M.addEventListener("dragstart",vt),M.addEventListener("dragend",Ot),M.addEventListener("keydown",Z=>{if(Z.key===" "&&!g.dragging)Z.preventDefault(),g.dragging={item:C,type:c,effect:f?"copy":"move",sourceEl:M,sourceCtx:ot,sourceList:k,sourceIndex:et,listDirective:{el:t,listPath:r,ctx:n,keyProp:i,copyMode:f,removeMode:l}},b.split(/\s+/).filter(Boolean).forEach(it=>X.classList.add(it)),X.setAttribute("aria-grabbed","true");else if(Z.key==="Escape"&&g.dragging&&g.dragging.sourceEl===M)Z.preventDefault(),b.split(/\s+/).filter(Boolean).forEach(it=>X.classList.remove(it)),X.setAttribute("aria-grabbed","false"),g.dragging=null,at();else if((Z.key==="ArrowDown"||Z.key==="ArrowRight")&&g.dragging&&g.dragging.sourceEl===M){Z.preventDefault();let it=M.nextElementSibling;it&&(it.firstElementChild||it).focus()}else if((Z.key==="ArrowUp"||Z.key==="ArrowLeft")&&g.dragging&&g.dragging.sourceEl===M){Z.preventDefault();let it=M.previousElementSibling;it&&(it.firstElementChild||it).focus()}}),B(M)});let D=k.length===0;T.split(/\s+/).filter(Boolean).forEach(C=>t.classList.toggle(C,D))}let U=k=>{if(!g.dragging||u&&x(u,n))return;let j=_t(g.dragging.type,d),P=!0;if(m){let C=x(m,n),et=rt(r,n);typeof C=="number"&&Array.isArray(et)&&et.length>=C&&(P=!1)}if(!j||!P){y.split(/\s+/).filter(Boolean).forEach(C=>t.classList.add(C)),A.split(/\s+/).filter(Boolean).forEach(C=>t.classList.remove(C)),at();return}y.split(/\s+/).filter(Boolean).forEach(C=>t.classList.remove(C)),k.preventDefault(),k.dataTransfer&&(k.dataTransfer.dropEffect=f?"copy":"move");let D=Mt(t,k.clientX,k.clientY,a);L&&ge(t,D,L,v)},nt=k=>{if(g.dragging&&!(u&&x(u,n))&&(w++,w===1)){let j=_t(g.dragging.type,d),P=!0;if(m){let D=x(m,n),C=rt(r,n);typeof D=="number"&&Array.isArray(C)&&C.length>=D&&(P=!1)}j&&P?(A.split(/\s+/).filter(Boolean).forEach(D=>t.classList.add(D)),t.dispatchEvent(new CustomEvent("drag-enter",{bubbles:!1,detail:{item:g.dragging.item,type:g.dragging.type}}))):y.split(/\s+/).filter(Boolean).forEach(D=>t.classList.add(D))}},H=()=>{g.dragging&&(w--,w<=0&&(w=0,A.split(/\s+/).filter(Boolean).forEach(k=>t.classList.remove(k)),y.split(/\s+/).filter(Boolean).forEach(k=>t.classList.remove(k)),at(),t.dispatchEvent(new CustomEvent("drag-leave",{bubbles:!1,detail:{item:g.dragging?.item}}))))},lt=k=>{if(k.preventDefault(),k.stopPropagation(),w=0,!g.dragging||u&&x(u,n)||!_t(g.dragging.type,d))return;if(m){let V=x(m,n),M=rt(r,n);if(typeof V=="number"&&Array.isArray(M)&&M.length>=V)return}let j=g.dragging.item,P=g.dragging.listDirective,D=g.dragging.sourceIndex,C=Mt(t,k.clientX,k.clientY,a);A.split(/\s+/).filter(Boolean).forEach(V=>t.classList.remove(V)),y.split(/\s+/).filter(Boolean).forEach(V=>t.classList.remove(V)),at();let et=rt(r,n);if(!Array.isArray(et))return;let ft=P&&P.el===t;if(ft&&D===C){g.dragging=null;return}if(ft&&D+1===C){g.dragging=null;return}let ot=[...et];if(ft){let[V]=ot.splice(D,1),M=D<C?C-1:C;ot.splice(M,0,V),n.$set(r,ot),t.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{list:ot,item:j,from:D,to:M}}))}else{let V=f&&typeof j=="object"?{...j}:j;if(ot.splice(C,0,V),n.$set(r,ot),P&&!P.copyMode&&(l||P.removeMode)){let M=rt(P.listPath,P.ctx);if(Array.isArray(M)&&D!=null){let X=M.filter((vt,Ot)=>Ot!==D);P.ctx.$set(P.listPath,X),P.el.dispatchEvent(new CustomEvent("remove",{bubbles:!0,detail:{list:X,item:j,index:D}}))}}t.dispatchEvent(new CustomEvent("receive",{bubbles:!0,detail:{list:ot,item:j,from:D,fromList:P?rt(P.listPath,P.ctx):null}}))}requestAnimationFrame(()=>{let M=[...t.children][ft&&D<C?C-1:C];if(M){let X=M.firstElementChild||M;E.split(/\s+/).filter(Boolean).forEach(vt=>X.classList.add(vt)),X.addEventListener("animationend",()=>{E.split(/\s+/).filter(Boolean).forEach(vt=>X.classList.remove(vt))},{once:!0})}}),g.dragging=null},R=k=>{if(g.dragging&&_t(g.dragging.type,d)&&(k.key==="Enter"||k.key===" ")){k.preventDefault();let j=t.querySelector(":focus");if(j){let D=(j.style?.display==="contents"&&j.firstElementChild||j).getBoundingClientRect(),C={preventDefault(){},stopPropagation(){},clientX:D.left+D.width/2,clientY:D.top+D.height+1,dataTransfer:null};lt(C)}}};t.addEventListener("dragover",U),t.addEventListener("dragenter",nt),t.addEventListener("dragleave",H),t.addEventListener("drop",lt),t.addEventListener("keydown",R),G(()=>{t.removeEventListener("dragover",U),t.removeEventListener("dragenter",nt),t.removeEventListener("dragleave",H),t.removeEventListener("drop",lt),t.removeEventListener("keydown",R)}),n.$watch(I),I()}});S("drag-multiple",{priority:16,init(t,e){let r=$(t),n=t.getAttribute("drag-group"),o=t.getAttribute("drag-multiple-class")||"nojs-selected";if(!n){st("drag-multiple requires drag-group attribute");return}g.selected.has(n)||g.selected.set(n,new Set);let i=g.selected.get(n),s=c=>{let d=t.getAttribute("drag"),l={item:d?x(d,r):null,el:t,ctx:r};if(c.ctrlKey||c.metaKey){let p=[...i].find(u=>u.el===t);p?(i.delete(p),o.split(/\s+/).filter(Boolean).forEach(u=>t.classList.remove(u))):(i.add(l),o.split(/\s+/).filter(Boolean).forEach(u=>t.classList.add(u)))}else{for(let p of i)o.split(/\s+/).filter(Boolean).forEach(u=>p.el.classList.remove(u));i.clear(),i.add(l),o.split(/\s+/).filter(Boolean).forEach(p=>t.classList.add(p))}};t.addEventListener("click",s),G(()=>{t.removeEventListener("click",s);let c=[...i].find(d=>d.el===t);c&&i.delete(c)});let a=c=>{if(c.key==="Escape"){for(let d of i)o.split(/\s+/).filter(Boolean).forEach(f=>d.el.classList.remove(f));i.clear()}};window.addEventListener("keydown",a),G(()=>window.removeEventListener("keydown",a))}});function De(){if(typeof window>"u")return null;let t=h.router||{};if(t.mode==="hash")return window.location.hash.slice(1)||"/";let e=(t.base||"/").replace(/\/$/,"");return window.location.pathname.replace(e,"")||"/"}var he={get baseApiUrl(){return h.baseApiUrl},set baseApiUrl(t){h.baseApiUrl=t},get locale(){return q.locale},set locale(t){q.locale=t},config(t={}){let e={...h.headers},r={...h.cache},n={...h.templates},o={...h.router},i={...h.i18n};Object.assign(h,t),t.headers&&(h.headers={...e,...t.headers}),t.csrf&&(h.csrf=t.csrf),t.cache&&(h.cache={...r,...t.cache}),t.templates&&(h.templates={...n,...t.templates}),t.router&&(h.router={...o,...t.router}),t.i18n&&(h.i18n={...i,...t.i18n},q.locale=t.i18n.defaultLocale||q.locale)},async init(t){if(typeof document>"u")return;if(t=t||document.body,K("Initializing..."),h.i18n.loadPath){let r=new Set([q.locale,h.i18n.fallbackLocale]);await Promise.all([...r].map(n=>Wt(n)))}kt(t);let e=De();await ie(e),document.querySelector("[route-view]")&&Gt(ue()),B(t),tt&&await tt.init(),K("Initialized."),se(),h.devtools&&typeof window<"u"&&(window.__NOJS_DEVTOOLS__={stores:Y,config:h,refs:ut,router:tt,filters:Object.keys(N),validators:Object.keys(bt),version:he.version},K("DevTools enabled \u2014 access via window.__NOJS_DEVTOOLS__"))},directive(t,e){S(t,e)},filter(t,e){N[t]=e},validator(t,e){bt[t]=e},i18n(t){if(t.loadPath!=null&&(h.i18n.loadPath=t.loadPath),t.ns&&(h.i18n.ns=t.ns),t.cache!=null&&(h.i18n.cache=t.cache),t.persist!=null&&(h.i18n.persist=t.persist),t.locales&&(q.locales=t.locales),t.fallbackLocale&&(h.i18n.fallbackLocale=t.fallbackLocale),t.defaultLocale&&(q._locale=t.defaultLocale),h.i18n.persist&&typeof localStorage<"u")try{let e=localStorage.getItem("nojs-locale");if(e&&q.locales[e]){q._locale=e;return}}catch{}if(t.detectBrowser){let e=typeof navigator<"u"?navigator.language:"en",r=e.split("-")[0];q.locales[e]?q._locale=e:q.locales[r]&&(q._locale=r)}},on(t,e){return ht[t]||(ht[t]=[]),ht[t].push(e),()=>{ht[t]=ht[t].filter(r=>r!==e)}},interceptor(t,e){Et[t]&&Et[t].push(e)},get store(){return Y},get router(){return tt},createContext:O,evaluate:x,findContext:$,processTree:B,resolve:rt,version:"1.2.0"},Ne=he;
25
64
  //# sourceMappingURL=no.js.map