@jsswift/core 1.0.51 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cms.js +172 -161
- package/dist/cms.min.js +1 -1
- package/dist/min-cms.js +1 -1
- package/package.json +1 -1
- package/src/10-overlay.js +3 -4
- package/src/31-rod-model.js +169 -157
package/dist/min-cms.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var Fe,Ie,Be,je,Ue,We,He,qe,$e;window.JSswift=window.JSswift||{};const i=window.JSswift;window._=window.JSswift,i.config=i.config||{};const Ve=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{};i.config.debug=(Fe=Ve.modeDev)!=null?Fe:!1,i.isDev=function(){return i.config.debug},i.uiNormalizeArgs=function(e){let t={},n=e;return e.length>0&&typeof e[0]=="object"&&e[0]!==null&&!e[0].nodeType&&!Array.isArray(e[0])&&!(e[0]instanceof Function)&&(t=e[0],n=e.slice(1)),{props:t,children:n}},i.uiSizes=["xxs","xs","sm","md","lg","xl","xxl","xxxl"],i.uiColors=["primary","secondary","success","warning","danger","info","light","dark"],i.meta=i.meta||{version:"1.0.23",policy:{sourceOfTruth:"docDevelop/reference/core.md",syncRule:"Quando cambia un modulo core, aggiornare sia questo meta sia docDevelop/reference/core.md."},modules:{render:{description:"Bridge props -> DOM per hyperscript _, attributi, class, style, eventi e children reattivi.",entrypoints:["createElement","setProp","bindProp"],status:"milestone-3-closed",knownLimits:["Il mini-terzo-giro e il successivo micro-giro avanzato hanno chiuso style dinamico, eventi, children e props/attr speciali, ma restano altri edge case avanzati da esplorare.","Gli eventi ora supportano composizione base di listener multipli, ma non hanno ancora delegation o diff avanzato.","Restano da esplorare edge case avanzati del renderer oltre ai giri gia coperti dai test."]},reactive:{description:"Core minimale signal/effect usato come base della reattivita.",entrypoints:["JSswift.reactive.signal","JSswift.reactive.effect","JSswift.reactive.computed","JSswift.reactive.untracked","JSswift.reactive.batch"],status:"milestone-2-closed",knownLimits:["La protezione loop copre i loop sincroni per singolo effect, non ancora i cicli complessi tra effect multipli.","Il batching sincrono ora esiste, ma manca ancora scheduling configurabile oltre il flush immediato a fine batch.","Mancano primitive avanzate per controllare scheduling e transazioni asincrone."]},rod:{description:"Layer reattivo di alto livello per binding DOM, model e interpolazioni.",entrypoints:["_.rod","JSswift.rodBind","JSswift.rodModel"],status:"milestone-2-closed",knownLimits:["Va chiarito meglio il rapporto con JSswift.reactive oltre al primo riallineamento strutturale.","Restano casi avanzati di model/binding da esplorare oltre al primo giro coperto dai test.","Il modulo e piu pulito internamente ma non e ancora il punto finale della convergenza con il renderer."]},mount:{description:"Mount, component instances e cleanup automatico del tree DOM.",entrypoints:["JSswift.mount","JSswift.component","JSswift.enableAutoCleanup"],status:"milestone-2-closed",knownLimits:["Il lifecycle e piu pulito internamente ma resta da chiarire meglio la semantica su multi-mount e cloni.","Restano da esplorare edge case avanzati del cleanup automatico fuori dal primo giro gia coperto."]},platform:{description:"Moduli applicativi nel core: overlay, store, auth, http, router, UI meta.",entrypoints:["JSswift.overlay","JSswift.store","JSswift.plugins.auth","JSswift.http","JSswift.router","JSswift.ui.meta"],status:"milestone-2-closed",knownLimits:["Il secondo giro ha ripulito i moduli interni, ma mancano ancora demo separate per modulo e una validazione piu formale di alcune superfici pubbliche.","Esiste una demo browser aggregata del blocco platform, ma non ancora demo separate per ogni modulo.","Mancano configurazione pubblica piu coerente e confini piu netti tra auth, http e router.","Il registry UI meta non ha ancora validazione formale del suo shape."]}}},i.omit=(e,t)=>{const n={},o=new Set(t||[]);for(const r in e||{})o.has(r)||(n[r]=e[r]);return n},i._cleanupRegistry=new WeakMap,i._registerCleanup=function(e,t){if(!e||typeof t!="function")return t;const n=i._cleanupRegistry.get(e)||[];return n.push(t),i._cleanupRegistry.set(e,n),t},i.dom={q(e,t=document){return t.querySelector(e)},qa(e,t=document){return Array.from(t.querySelectorAll(e))},attr(e,t,n){return e?n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.setAttribute(t,String(n)),e):null}},(()=>{let e=[],t=!1;function n(){if(t)return;t=!0;const o=e.slice();e.length=0;for(const r of o)try{r()}catch(a){console.error("[JSswift.ready] error:",a)}}i.ready=function(o){typeof o=="function"&&(t||document.readyState==="interactive"||document.readyState==="complete"?queueMicrotask(()=>{try{o()}catch(r){console.error("[JSswift.ready] error:",r)}}):e.push(o))},document.addEventListener("DOMContentLoaded",n,{once:!0})})(),i.reactive=(()=>{let e=null;const t=[],n=100;let o=0,r="sync",a="sync",s=!1;const c=new Set;function d(p){const b=p==null?void 0:p.flush;if(b==null||b==="sync")return"sync";if(b==="microtask")return"microtask";throw new Error("JSswift.reactive.batch: options.flush must be 'sync' or 'microtask'")}function u(){for(;c.size;){const p=Array.from(c);c.clear(),p.forEach(b=>b())}}function l(){s||(s=!0,queueMicrotask(()=>{s=!1,a="sync",u()}))}function f(p){const b=Array.from(p);if(o>0||a==="microtask"){b.forEach(k=>c.add(k)),o===0&&a==="microtask"&&l();return}b.forEach(k=>k())}function m(p){if(p&&(p._deps.size&&(p._deps.forEach(b=>b.delete(p._runner)),p._deps.clear()),typeof p._cleanup=="function")){const b=p._cleanup;p._cleanup=null;try{b()}catch(k){console.error("[JSswift.reactive.effect] cleanup error:",k)}}}function h(p){if(!(!p||!p.active)){m(p),t.push(p),e=p;try{const b=A=>{p._cleanup=typeof A=="function"?A:null},k=p.fn.length>0?p.fn(b):p.fn();typeof k=="function"&&(p._cleanup=k)}finally{t.pop(),e=t[t.length-1]||null}}}function w(p){if(typeof p!="function")return()=>{};const b={fn:p,active:!0,_deps:new Set,_cleanup:null,_runner:null,_running:!1,_queued:!1},k=()=>{if(!b.active)return;if(b._running){b._queued=!0;return}b._running=!0;let A=0;try{do if(b._queued=!1,h(b),A++,A>=n){b._queued=!1,console.warn("[JSswift.reactive.effect] loop guard triggered: too many synchronous reruns",{max:n,effect:p.name||"anonymous"});break}while(b.active&&b._queued)}finally{b._running=!1}};return b._runner=k,k(),()=>{b.active&&(b.active=!1,m(b))}}function T(p){let b=p;const k=new Set;function A(){return e&&e.active&&(k.add(e._runner),e._deps.add(k)),b}function L(j){b=j,f(k)}function D(){k.clear()}return[A,L,D]}function C(p){if(typeof p!="function")throw new Error("JSswift.reactive.computed: fn must be a function");const[b,k,A]=T(void 0),L=w(()=>{k(p())}),D=()=>b();return D.dispose=()=>{L(),A()},D.peek=()=>b(),D.type="computed",D}function v(p){if(typeof p!="function")throw new Error("JSswift.reactive.untracked: fn must be a function");const b=e;e=null;try{return p()}finally{e=b}}function y(p,b){if(typeof p!="function")throw new Error("JSswift.reactive.batch: fn must be a function");const k=d(b);o===0?r=k:k==="microtask"&&(r="microtask"),o+=1;try{return p()}finally{if(o-=1,o===0){const A=r==="microtask"||a==="microtask";r="sync",A?(a="microtask",l()):u()}}}return{signal:T,effect:w,computed:C,untracked:v,batch:y}})(),i._overlayShared=(()=>{const e=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function t(a,s){const c=a();if(c&&c.isConnected)return c;let d=document.getElementById("cms-overlay-root");return!d&&(document!=null&&document.body)&&(d=document.createElement("div"),d.id="cms-overlay-root",d.className="cms-overlay-root",document.body.appendChild(d)),!document.body&&!d&&i.ready(()=>{let u=document.getElementById("cms-overlay-root");u||(u=document.createElement("div"),u.id="cms-overlay-root",u.className="cms-overlay-root",document.body.appendChild(u)),s(u)}),s(d),d}function n(a){var c;const s=a.querySelector(e);(c=s==null?void 0:s.focus)==null||c.call(s)}function o(a,s){if(a.key!=="Tab")return;const c=Array.from(s.querySelectorAll(e)).filter(f=>f.offsetParent!==null);if(!c.length)return;const d=c[0],u=c[c.length-1],l=document.activeElement;a.shiftKey&&l===d?(a.preventDefault(),u.focus()):!a.shiftKey&&l===u&&(a.preventDefault(),d.focus())}function r(a,s){var Q,Z,ee,H,ne,Ge;if(!s.anchorEl)return;const c=s.anchorEl.getBoundingClientRect(),d=a.getBoundingClientRect(),u=window.visualViewport||null,l=Math.max(0,Number(u==null?void 0:u.offsetLeft)||0),f=Math.max(0,Number(u==null?void 0:u.offsetTop)||0),m=Math.max(Number(u==null?void 0:u.width)||0,window.innerWidth||0,((Q=document.documentElement)==null?void 0:Q.clientWidth)||0),h=Math.max(Number(u==null?void 0:u.height)||0,window.innerHeight||0,((Z=document.documentElement)==null?void 0:Z.clientHeight)||0),w=Number((H=(ee=s.viewportGutter)!=null?ee:s.gutter)!=null?H:8),T=Number.isFinite(w)?Math.max(0,w):8,C=Number((ne=s.offsetX)!=null?ne:0),v=Number((Ge=s.offsetY)!=null?Ge:8),y=Number.isFinite(C)?C:0,p=Number.isFinite(v)?v:8,b=(V,$,X)=>!Number.isFinite(V)||(Number.isFinite($)||($=0),Number.isFinite(X)||(X=$),X<$)?$:Math.min(Math.max(V,$),X),k=String(s.placement||"bottom-start").toLowerCase(),[A,L]=k.split("-"),D=["top","bottom","left","right"].includes(A)?A:"bottom",j=["start","end","center"].includes(L)?L:"start",R={top:"bottom",bottom:"top",left:"right",right:"left"}[D]||"top",P=D==="top"||D==="bottom",M=d.width,F=d.height,g=V=>{let $=c.left+y,X=c.top+p;return V==="top"||V==="bottom"?(j==="center"?$=c.left+(c.width-M)/2+y:j==="end"&&($=c.right-M+y),X=V==="top"?c.top-F-p:c.bottom+p):(j==="center"?X=c.top+(c.height-F)/2+p:j==="end"&&(X=c.bottom-F+p),$=V==="left"?c.left-M-y:c.right+y),{left:$,top:X}},S=V=>V==="top"?c.top-p-T:V==="bottom"?h-c.bottom-p-T:V==="left"?c.left-y-T:m-c.right-y-T,z=S(D),I=S(R),N=(P?F:M)>z&&I>z?R:D,E=g(N),x=l+T,O=f+T,B=Math.max(x,l+m-M-T),q=Math.max(O,f+h-F-T),W=b(E.left,x,B),U=b(E.top,O,q);a.style.position="fixed",a.style.left=`${W}px`,a.style.top=`${U}px`}return{ensureRoot:t,focusFirst:n,trapFocus:o,applyAnchoredPosition:r}})(),i.overlay=(()=>{let e=0;const t=new Map;let n=null;const{ensureRoot:o,focusFirst:r,trapFocus:a,applyAnchoredPosition:s}=i._overlayShared,c=()=>o(()=>n,C=>{n=C});let d=0;const u=()=>{d++,d===1&&document.documentElement.classList.add("cms-scroll-locked")},l=()=>{d=Math.max(0,d-1),d===0&&document.documentElement.classList.remove("cms-scroll-locked")},f=()=>{let C=null;for(const v of t.values())C=v;return C},m=C=>{var y;let v=C;for(;v&&v!==document;){if(v.nodeType===1&&((y=v.getAttribute)==null?void 0:y.call(v,"data-cms-overlay-portal"))==="true")return!0;v=v.parentNode}return!1},h=(C,v={})=>{var S,z,I,J;const y=`ov_${++e}`,p={id:y,opts:v,isOpen:!0,anchorEl:v.anchorEl||null,placement:v.placement||"bottom-start",onClose:typeof v.onClose=="function"?v.onClose:null,overlay:null,panel:null,backdrop:null,reposition:null,_positionCleanup:null,_positionFrame:null,_panelResizeObserver:null,_cleanup:null},b=document.createElement("div");b.className=["cms-overlay",v.type?`type-${v.type}`:""].filter(Boolean).join(" "),b.dataset.id=y;const k=document.createElement("div");k.className="cms-overlay-backdrop",v.backdrop||(k.style.display="none");const A=document.createElement("div");A.className=["cms-overlay-panel",v.className].filter(Boolean).join(" "),A.tabIndex=-1;const L=typeof C=="function"?C({close:()=>w(y)}):C,D=i.ui.slot(L);Array.isArray(D)?D.forEach(N=>N&&A.appendChild(N)):D&&A.appendChild(D),b.appendChild(k),b.appendChild(A);const j=c();if(!j)return{id:y,close:()=>w(y),panel:A,overlay:b};j.appendChild(b),p.overlay=b,p.panel=A,p.backdrop=k,t.set(y,p),v.lockScroll&&u(),v.autoFocus!==!1&&setTimeout(()=>{A.isConnected&&t.get(y)===p&&!A.contains(document.activeElement)&&r(A)},0);const R=(N=null)=>{N&&typeof N=="object"&&Object.assign(p.opts,N),s(A,p.opts)},P=()=>{if(!v.anchorEl)return;const N=globalThis.requestAnimationFrame||(x=>setTimeout(()=>x(Date.now()),0)),E=globalThis.cancelAnimationFrame||clearTimeout;p._positionFrame!=null&&E(p._positionFrame),p._positionFrame=N(()=>{p._positionFrame=null,R()})};if(p.reposition=R,v.anchorEl){R(),P();const N=()=>R();if(window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),(z=(S=window.visualViewport)==null?void 0:S.addEventListener)==null||z.call(S,"resize",N),(J=(I=window.visualViewport)==null?void 0:I.addEventListener)==null||J.call(I,"scroll",N),typeof ResizeObserver=="function"){const E=new ResizeObserver(()=>R());E.observe(A),p._panelResizeObserver=E}p._positionCleanup=()=>{var x,O,B,q,W,U;const E=globalThis.cancelAnimationFrame||clearTimeout;p._positionFrame!=null&&(E(p._positionFrame),p._positionFrame=null),(O=(x=p._panelResizeObserver)==null?void 0:x.disconnect)==null||O.call(x),p._panelResizeObserver=null,window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0),(q=(B=window.visualViewport)==null?void 0:B.removeEventListener)==null||q.call(B,"resize",N),(U=(W=window.visualViewport)==null?void 0:W.removeEventListener)==null||U.call(W,"scroll",N)}}const M=N=>{const E=f();!E||E.id!==y||v.closeOnOutside!==!1&&(m(N.target)||A.contains(N.target)||w(y))};document.addEventListener("mousedown",M,!0);const F=N=>{const E=f();!E||E.id!==y||(v.trapFocus&&a(N,A),N.key==="Escape"&&v.closeOnEsc!==!1&&(N.preventDefault(),w(y)))};document.addEventListener("keydown",F,!0),k.addEventListener("click",()=>{v.closeOnBackdrop!==!1&&w(y)}),p._cleanup=()=>{var N;document.removeEventListener("mousedown",M,!0),document.removeEventListener("keydown",F,!0),(N=p._positionCleanup)==null||N.call(p)};const g=1e3+t.size*10;return b.style.zIndex=String(g),{id:y,close:()=>w(y),panel:A,overlay:b,reposition:R}},w=C=>{var y,p,b;const v=t.get(C);v&&(t.delete(C),(y=v._cleanup)==null||y.call(v),v.opts.lockScroll&&l(),typeof Y=="function"&&Y(v.overlay),(p=v.overlay)==null||p.remove(),(b=v.onClose)==null||b.call(v))};return{open:h,close:w,closeTop:()=>{const C=f();C&&w(C.id)},root:n,_stack:t}})();function be(e,t={}){const{isSVG:n=!1,normalizeClass:o=y=>String(y!=null?y:""),isContentProp:r=()=>!1,autoValueTags:a=new Set(["INPUT","TEXTAREA","SELECT"])}=t;function s(y){if(n||!(y in e))return!1;try{return typeof e[y]=="boolean"}catch(p){return!1}}function c(y){return n||y.startsWith("data-")||y.startsWith("aria-")||!(y in e)}function d(y,p){if(p==null){e.removeAttribute(y);return}if(p===!1){if(y.startsWith("aria-")){e.setAttribute(y,"false");return}e.removeAttribute(y);return}if(p===!0&&!n&&!y.startsWith("aria-")&&!y.startsWith("data-")){e.setAttribute(y,"");return}e.setAttribute(y,String(p))}function u(y,p){if(y==null)return;const b=String(y),k=b.startsWith("--")||b.includes("-");if(p==null||p===!1||p===""){k?e.style.removeProperty(b):e.style[b]="";return}if(k){e.style.setProperty(b,String(p));return}e.style[b]=p}function l(y){const p=o(y);if(p==null||p===!1||p===""){e.removeAttribute("class");return}e.setAttribute("class",String(p))}function f(y,p){const b=!!p;e[y]=b,b?e.setAttribute(y,""):e.removeAttribute(y)}function m(y){if(r(y)){e[y]="";return}if(y==="class"){e.removeAttribute("class");return}if(y==="style"){e.removeAttribute("style");return}if(s(y)){try{e[y]=!1}catch(p){}e.removeAttribute(y);return}if(e.removeAttribute(y),!c(y))try{typeof e[y]=="string"&&(e[y]="")}catch(p){}}function h(y){!y||typeof y!="object"||Object.entries(y).forEach(([p,b])=>{u(p,b)})}function w(y,p){if(r(y)){e[y]=p!=null?p:"";return}if(y==="class"){l(p);return}if(y==="style"){if(p==null||p===!1){m(y);return}if(typeof p=="object"){h(p);return}}if(s(y)){f(y,p);return}if(p==null||p===!1){m(y);return}if(c(y)){d(y,p);return}e[y]=p}function T(y,p){const b=String(y).split(".");let k=e;for(let A=0;A<b.length-1;A++)if(k=k==null?void 0:k[b[A]],!k)return;k[b[b.length-1]]=p}function C(y){return y?y==="auto"||y.startsWith("attr:")||y.startsWith("@")||y.startsWith("style.")||y.includes("."):!1}function v(y,p){if(!y||y==="auto"){a.has(e.tagName)?w("value",p):e.textContent=p!=null?p:"";return}if(y.startsWith("attr:")){d(y.slice(5),p);return}if(y.startsWith("@")){d(y.slice(1),p);return}if(y.startsWith("style.")){u(y.slice(6),p);return}if(y.includes(".")){T(y,p);return}w(y,p)}return{isBooleanDomProp:s,isAttributeOnlyProp:c,isBindingValueKey:C,setAttributeValue:d,setStyleEntry:u,setClassValue:l,setBooleanProp:f,removeProp:m,applyStyleObject:h,setProp:w,setPathValue:T,applyBindingValue:v}}function ie(e){const t=[],n=o=>{if(!(o==null||o===!1)){if(typeof o=="function"){n(o());return}if(o&&o.type==="rod"){n(o.value);return}if(Array.isArray(o)){o.forEach(n);return}if(typeof o=="object"){Object.entries(o).forEach(([r,a])=>{let s=a;typeof s=="function"?s=s():s&&s.type==="rod"&&(s=s.value),n(s?r:null)});return}o!==!0&&String(o).split(/\s+/).forEach(r=>{r&&t.push(r)})}};return n(e),t.length?Array.from(new Set(t)).join(" "):""}function de(e){return e==null||e===!1?!1:typeof e=="function"||e&&e.type==="rod"?!0:Array.isArray(e)?e.some(de):typeof e=="object"?Object.values(e).some(de):!1}function we(e,t){return e==null||e===!1?!1:typeof e=="function"||t(e)?!0:typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Object.values(e).some(n=>we(n,t))}function Ke(e,t){let n=e;if(typeof n=="function"?n=n():t(n)&&(n=n.value),!n||typeof n!="object"||Array.isArray(n)||n.nodeType)return null;const o={};return Object.entries(n).forEach(([r,a])=>{let s=a;typeof s=="function"?s=s():t(s)&&(s=s.value),o[r]=s}),o}function Se(e){let t=new Set;function n(r){t.forEach(a=>{r.has(a)||e(a,null)}),t=r}function o(r,a){const s=Ke(r,a);if(!s){n(new Set);return}const c=new Set(Object.keys(s));n(c),Object.entries(s).forEach(([d,u])=>{e(d,u)})}return{apply:o}}function Qe(e){return typeof e=="string"&&(e.startsWith("on:")||e.startsWith("on")&&e.length>2)}const ve=128,te=[];function Xe(e,t){te.push({rod:e,value:String(t!=null?t:"")}),te.length>ve&&te.splice(0,te.length-ve)}function Ye(){if(!te.length)return null;const e=te.slice();return te.length=0,{items:e,index:0}}function pe(e,t){if(!t||!e||t.index>=t.items.length)return null;const n=[],o=String(e);let r=0,a=t.index,s=!1;for(;a<t.items.length;){const c=t.items[a],d=c.value;if(!d)break;const u=o.indexOf(d,r);if(u===-1)break;u>r&&n.push(o.slice(r,u)),n.push(c.rod),r=u+d.length,a++,s=!0}return s?(r<o.length&&n.push(o.slice(r)),t.index=a,n):null}function Ae(e){var n;let t="";for(const o of e)typeof o=="string"?t+=o:t+=(n=o==null?void 0:o.value)!=null?n:"";return t}function Ze(e){if(e.startsWith("on:"))return e.slice(3);const t=e.slice(2);return t?t==="DoubleClick"?"dblclick":t.toLowerCase():""}function ce(e){return e==null||e===!1?!1:e===!0?{capture:!0}:typeof e=="boolean"?e:typeof e=="object"?{capture:!!e.capture,passive:!!e.passive,once:!!e.once}:!1}function et(e,t){const n=ce(e),o=ce(t);return typeof n=="boolean"||typeof o=="boolean"?n===o:!!n&&!!o&&n.capture===o.capture&&n.passive===o.passive&&n.once===o.once}function ae(e,t){return Array.isArray(e)?e.some(n=>ae(n,t)):t(e)?!0:!e||typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Array.isArray(e.handlers)?e.handlers.some(n=>ae(n,t))||t(e.options)||typeof e.options=="function":Array.isArray(e.listeners)?e.listeners.some(n=>ae(n,t))||t(e.options)||typeof e.options=="function":t(e.handler)||t(e.listener)||t(e.fn)||t(e.options)||typeof e.options=="function"}function ue(e,t,n){var o,r,a,s,c,d,u;if(e==null||e===!1)return[];if(typeof e=="function")return[{handler:e,options:ce(n!=null?n:!1)}];if(t(e))return ue(e.value,t,n);if(Array.isArray(e))return e.flatMap(l=>ue(l,t,n));if(typeof e=="object"&&!Array.isArray(e)&&!e.nodeType){if(Array.isArray(e.handlers)||Array.isArray(e.listeners)){const m=e.handlers||e.listeners||[],h=(r=(o=e.options)!=null?o:n)!=null?r:!1;return m.flatMap(w=>ue(w,t,h))}let l=(c=(s=(a=e.handler)!=null?a:e.listener)!=null?s:e.fn)!=null?c:null,f=(u=(d=e.options)!=null?d:n)!=null?u:!1;return t(l)&&(l=l.value),t(f)&&(f=f.value),typeof f=="function"&&(f=f()),typeof l=="function"?[{handler:l,options:ce(f)}]:[]}return[]}function tt(e,t){return ue(e,t)}function nt(e,t,n,o){const r=Ze(t);if(!r)return;const a={listeners:[]},s=()=>{a.listeners.forEach(d=>{e.removeEventListener(r,d.dispatch,d.options)}),a.listeners=[]},c=d=>{const u=tt(d,o);a.listeners.length===u.length&&a.listeners.every((f,m)=>{const h=u[m];return f.handler===h.handler&&et(f.options,h.options)})||(s(),u.forEach(f=>{const m={handler:f.handler,options:f.options,dispatch:null};m.dispatch=h=>{if(typeof m.handler=="function"){const w=m.handler.call(e,h);return m.options&&typeof m.options=="object"&&m.options.once&&(e.removeEventListener(r,m.dispatch,m.options),a.listeners=a.listeners.filter(T=>T!==m)),w}},e.addEventListener(r,m.dispatch,m.options),a.listeners.push(m)}))};if(i._registerCleanup(e,s),o(n)){const d=i.reactive.effect(()=>{c(n.value)});i._registerCleanup(e,d);return}if(ae(n,o)){const d=i.reactive.effect(()=>{c(n)});i._registerCleanup(e,d);return}c(n)}function rt(e,t={}){const{isRod:n=()=>!1,interpolationCursor:o=null}=t;function r(l){const f=document.createTextNode(""),m=i.rodBind(f,l);return i._registerCleanup(f,m),f}function a(l){e.appendChild(r(l))}function s(l){const f=document.createTextNode("");e.appendChild(f);const m=i.reactive.effect(()=>{f.textContent=Ae(l)});i._registerCleanup(f,m)}function c(l){const f=[],m=h=>{if(!(h==null||h===!1)){if(Array.isArray(h)){h.forEach(m);return}if(typeof h=="string"){f.push(document.createTextNode(h));return}if(typeof h=="number"){f.push(document.createTextNode(String(h)));return}if(typeof h!="boolean"){if(n(h)){f.push(r(h));return}if(h!=null&&h.nodeType){f.push(h);return}f.push(document.createTextNode(String(h)))}}};return m(l),f}function d(l){const f=document.createComment("dyn");e.appendChild(f);let m=[];const h=i.reactive.effect(()=>{m.forEach(v=>{Y(v),v.parentNode&&v.parentNode.removeChild(v)}),m=[];const w=f.parentNode;if(!w)return;const T=c(l());if(!T.length)return;const C=document.createDocumentFragment();T.forEach(v=>C.appendChild(v)),w.insertBefore(C,f.nextSibling),m=T});i._registerCleanup(f,()=>{h(),m.forEach(w=>Y(w)),m=[]})}function u(l){if(l!=null){if(Array.isArray(l)){for(const f of l)u(f);return}if(typeof l=="string"){const f=pe(l,o);f?s(f):e.appendChild(document.createTextNode(l));return}if(typeof l=="number"){e.appendChild(document.createTextNode(String(l)));return}if(typeof l=="function"){d(l);return}if(n(l)){a(l);return}l.nodeType&&e.appendChild(l)}}return{appendRodText:a,appendInterpolatedText:s,appendDynamicChild:d,appendChildValue:u}}function ot(e,t={}){const{el:n,isRod:o=()=>!1,interpolationCursor:r=null,appendChildValue:a=()=>{},appendRodText:s=()=>{},appendInterpolatedText:c=()=>{},appendDynamicChild:d=()=>{},bindProp:u=()=>{}}=t;for(const l of e)if(l!=null){if(Array.isArray(l)){a(l);continue}if(typeof l=="string"){const f=pe(l,r);f?c(f):n.appendChild(document.createTextNode(l));continue}if(typeof l=="number"){n.appendChild(document.createTextNode(String(l)));continue}if(typeof l=="function"){d(l);continue}if(o(l)){s(l);continue}if(l.nodeType){n.appendChild(l);continue}if(typeof l=="object")for(const[f,m]of Object.entries(l)){if(typeof m=="string"){const h=pe(m,r);if(h){u(f,()=>Ae(h));continue}}if(f==="class"){u(f,m);continue}if(f==="style"&&typeof m=="object"&&m!==null&&!o(m)){u(f,m);continue}u(f,m)}}}const _e="http://www.w3.org/2000/svg",st=new Set(["svg","g","path","circle","ellipse","line","rect","polygon","polyline","text","tspan","defs","linearGradient","radialGradient","stop","use","symbol","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feBlend","feColorMatrix"]);function he(e){return e==="innerHTML"||e==="innerText"||e==="textContent"||e==="value"}function it(e,...t){const n=st.has(e),o=e==="text"&&!n?document.createTextNode(""):n?document.createElementNS(_e,e):document.createElement(e),r=g=>!!g&&g.type==="rod",a=Ye(),s=rt(o,{isRod:r,interpolationCursor:a}),{appendRodText:c,appendInterpolatedText:d,appendDynamicChild:u,appendChildValue:l}=s,f=be(o,{isSVG:n,normalizeClass:ie,isContentProp:he}),{isBooleanDomProp:m,isBindingValueKey:h,applyBindingValue:w,setStyleEntry:T,setProp:C,setClassValue:v}=f;function y(g){const S=i.reactive.effect(g);return i._registerCleanup(o,S),S}function p(g){if(String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input")return!1;const S=String((g==null?void 0:g.type)||"").toLowerCase();return S==="range"||S==="number"}function b(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input"?"":String((g==null?void 0:g.type)||"").toLowerCase()}function k(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="select"&&!g.multiple}function A(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="input"&&String((g==null?void 0:g.type)||"").toLowerCase()==="file"}function L(g,S,z){y(()=>{var N;const J=(N=S.value)!=null?N:"";g.value!==String(J)&&C("value",J)});const I=()=>{let J=g.value;const N=b(g),E=typeof S.value=="number"||S.value==null;if(k(g)&&g.value==="")J=null;else if(p(g)&&E)if(N==="number"&&g.value==="")J=null;else{const x=typeof g.valueAsNumber=="number"&&!Number.isNaN(g.valueAsNumber)?g.valueAsNumber:Number(g.value);J=Number.isNaN(x)?N==="number"?null:0:x}S.value!==J&&(S.value=J)};g.addEventListener(z,I),i._registerCleanup(g,()=>{g.removeEventListener(z,I)})}function D(g,S){y(()=>{const I=!!S.value;!!g.checked!==I&&C("checked",I)});const z=()=>{const I=!!g.checked;S.value!==I&&(S.value=I)};g.addEventListener("change",z),i._registerCleanup(g,()=>{g.removeEventListener("change",z)})}function j(g,S){const z=()=>{var J;return String((J=g.value)!=null?J:"on")};y(()=>{const N=(S.value==null?null:String(S.value))===z();!!g.checked!==N&&C("checked",N)});const I=()=>{if(!g.checked)return;const J=z();S.value!==J&&(S.value=J)};g.addEventListener("change",I),i._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function R(g,S){const z=()=>{const J=g.files;return J==null?[]:Array.isArray(J)?J.slice():typeof J.length=="number"?Array.from(J):[J]};y(()=>{const J=S.value;(J==null||Array.isArray(J)&&J.length===0)&&(g.value!==""&&C("value",""),Array.isArray(g.files)&&(g.files=[]))});const I=()=>{const J=z();S.value=J};g.addEventListener("change",I),i._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function P(g,S){const z=()=>Array.from(g.childNodes||[]).filter(N=>(N==null?void 0:N.tagName)==="OPTION"&&N.selected).map(N=>{var E;return String((E=N.value)!=null?E:"")}),I=()=>{const N=Array.isArray(S.value)?S.value.map(x=>String(x)):[],E=new Set(N);Array.from(g.childNodes||[]).forEach(x=>{var B;if((x==null?void 0:x.tagName)!=="OPTION")return;const O=E.has(String((B=x.value)!=null?B:""));!!x.selected!==O&&(x.selected=O,O?x.setAttribute("selected",""):x.removeAttribute("selected"))})};y(I),g._cmsApplySelectedValues=I,queueMicrotask(I);const J=()=>{const N=z(),E=Array.isArray(S.value)?S.value.map(x=>String(x)):[];E.length===N.length&&E.every((x,O)=>x===N[O])||(S.value=N)};g.addEventListener("change",J),i._registerCleanup(g,()=>{g.removeEventListener("change",J)})}function M(g,S){y(()=>{const N=!!S.value;!!g.selected!==N&&C("selected",N)});let z=null;const I=()=>{const N=!!g.selected;S.value!==N&&(S.value=N)};queueMicrotask(()=>{var N;z||((N=g.parentNode)==null?void 0:N.tagName)!=="SELECT"||(z=g.parentNode,z.addEventListener("change",I))}),i._registerCleanup(g,()=>{z==null||z.removeEventListener("change",I)})}function F(g,S){if(Qe(g)){nt(o,g,S,r);return}if(g==="class"){if(de(S)){y(()=>{v(ie(S))});return}v(ie(S));return}if(g==="style"&&S&&typeof S=="object"){const z=Se(T);if(we(S,r)){y(()=>{z.apply(S,r)});return}z.apply(S,r);return}if(g==="style"&&(typeof S=="function"||r(S))){const z=Se(T);y(()=>{z.apply(S,r)});return}if(h(g)&&typeof S=="function"){y(()=>{w(g,S())});return}if(h(g)&&!r(S)){w(g,S);return}if(typeof S=="function"){y(()=>{C(g,S())});return}if(g==="value"&&r(S)&&(e==="input"||e==="textarea"||e==="select")){if(e==="select"&&o.multiple){P(o,S);return}L(o,S,e==="select"?"change":"input");return}if(g==="checked"&&r(S)&&e==="input"){if(String(o.type||"").toLowerCase()==="radio"){j(o,S);return}D(o,S);return}if(g==="files"&&r(S)&&A(o)){R(o,S);return}if(g==="selected"&&r(S)&&e==="option"){M(o,S);return}if(he(g)&&r(S)){y(()=>{C(g,S.value)});return}if(r(S)){const z=i.rodBind(o,S,{key:g});i._registerCleanup(o,z);return}C(g,S)}return ot(t,{el:o,isRod:r,interpolationCursor:a,appendChildValue:l,appendRodText:c,appendInterpolatedText:d,appendDynamicChild:u,bindProp:F}),e==="select"&&typeof o._cmsApplySelectedValues=="function"&&o._cmsApplySelectedValues(),o}const bt={},Ee=["html","head","title","base","link","meta","style","body","header","footer","main","section","article","aside","nav","h1","h2","h3","h4","h5","h6","p","div","span","pre","blockquote","hr","br","address","a","abbr","b","bdi","bdo","cite","code","data","dfn","em","i","kbd","mark","q","rp","rt","ruby","s","samp","small","strong","sub","sup","time","u","var","wbr","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","form","label","input","textarea","button","select","option","optgroup","fieldset","legend","datalist","output","progress","meter","img","picture","source","iframe","embed","object","param","audio","video","track","details","summary","dialog","script","noscript","canvas","template","slot","svg","g","path","circle","ellipse","line","rect","polygon","polyline","text","tspan","defs","linearGradient","radialGradient","stop","use","symbol","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feBlend","feColorMatrix"];Ee.forEach(e=>{window._[e]=(...t)=>it(e,...t)}),_.DOM_ELEMENTS=Ee,_.fragment=(...e)=>e,_.dynamic=function(e){const t=document.createComment("dyn"),n=document.createDocumentFragment();n.appendChild(t);let o=null;return i.reactive.effect(()=>{const r=e();if(o&&o.parentNode&&o.parentNode.removeChild(o),o=null,r==null)return;let a=r;(typeof r=="string"||typeof r=="number")&&(a=document.createTextNode(String(r)));const s=t.parentNode;s&&a&&a.nodeType&&(s.insertBefore(a,t.nextSibling),o=a)}),n};function ct(){let e=!1;const t=new Set;function n(){var r,a,s;e=!1,(r=i.debug)==null||r.inc("rodFlushes"),(a=i.perf)==null||a.inc("rodFlushes"),(s=i.perf)==null||s.mark("rod:flush");const o=Array.from(t);t.clear();for(const c of o)try{c()}catch(d){console.error("[rod] flush error:",d)}}return function(r){t.add(r),e||(e=!0,queueMicrotask(n))}}const at=ct();function Ce(e,t,n){if(!e)return;if(e.nodeType===3){e.textContent=n!=null?n:"";return}be(e,{isSVG:e.namespaceURI===_e,normalizeClass:ie,isContentProp:he}).applyBindingValue(t,n)}function ut(e){return{type:"rod",value:e,_bindings:[],_actions:[],_disposeHooks:[],_disposed:!1,_silentDepth:0,_pending:!1,bindings(){return this._bindings.map(n=>({el:n.el,key:n.key}))},onDispose(n){return typeof n=="function"&&this._disposeHooks.push(n),this},_bind(n,o={key:"auto"}){var s;if(this._disposed)return()=>{};if(!n)return()=>{};const r={el:n,key:(s=o==null?void 0:o.key)!=null?s:"auto"};return this._bindings.some(c=>c.el===r.el&&c.key===r.key)||this._bindings.push(r),Ce(r.el,r.key,this.value),()=>{this._bindings=this._bindings.filter(c=>!(c.el===r.el&&c.key===r.key))}},action(n){return!this._disposed&&typeof n=="function"&&this._actions.push(n),this},_setSilent(n){this._silentDepth++;try{this.value=n}finally{this._silentDepth--}return this},_scheduleNotify(){this._disposed||this._pending||(this._pending=!0,at(()=>{this._pending=!1,this._notifyNow()}))},_notifyNow(){var o,r,a,s,c;if(this._disposed)return;const n=performance.now();(o=i.perf)==null||o.inc("rodNotifies"),this._bindings=this._bindings.filter(d=>{const u=d.el;return u?u.nodeType===3?!!u.parentNode:u.isConnected!==!1:!1});for(const d of this._bindings)Ce(d.el,d.key,this.value);if(!(this._silentDepth>0)){for(const d of this._actions)try{d(this.value)}catch(u){console.error("[rod] action error:",u)}(r=i.debug)==null||r.inc("rodNotifies"),(c=i.perf)==null||c.tick("rod:notify",performance.now()-n,{bindings:((a=this._bindings)==null?void 0:a.length)||0,actions:((s=this._actions)==null?void 0:s.length)||0})}},dispose(){if(!this._disposed){this._disposed=!0;for(const n of this._disposeHooks)try{n()}catch(o){console.error("[rod] dispose hook error:",o)}this._bindings.length=0,this._actions.length=0,this._disposeHooks.length=0}}}}function lt(e,t="value"){var s;let n=e[t],o=null,r=null,a=null;return(s=i==null?void 0:i.reactive)!=null&&s.signal&&([o,r,a]=i.reactive.signal(n),a&&typeof e.onDispose=="function"&&e.onDispose(a)),Object.defineProperty(e,t,{get(){return o?o():n},set(c){r?r(c):n=c,e._scheduleNotify()},configurable:!0}),typeof e.val!="function"&&Object.defineProperty(e,"val",{value(c){return arguments.length?(this.value=c,c):this.value},configurable:!0}),e[Symbol.toPrimitive]||Object.defineProperty(e,Symbol.toPrimitive,{value(c){const d=this.value;if(d==null)return d;const u=typeof d;return c==="number"?Number(d):(u!=="symbol"&&Xe(this,d),u==="string"||u==="number"||u==="boolean"||u==="bigint"||u==="symbol"?d:String(d))},configurable:!0}),e.valueOf||Object.defineProperty(e,"valueOf",{value(){return this.value},configurable:!0}),e.toString||Object.defineProperty(e,"toString",{value(){return String(this.value)},configurable:!0}),e}_.rod=function(t,n="value"){const o=ut(t);return lt(o,n),i.rod._all=i.rod._all||new Set,i.rod._all.add(o),typeof o.onDispose=="function"&&o.onDispose(()=>i.rod._all.delete(o)),o},i.rodBind=function(e,t,n={key:"auto"}){var o,r,a;if((o=i.debug)==null||o.inc("rodBinds"),!e)return(r=i.debug)==null||r.inc("rodBindNull"),(a=i.debug)==null||a.warn("rodBind: target element \xE8 null/undefined",n),()=>{};if(!t||t.type!=="rod")throw new Error("JSswift.rodBind: react must be a rod object");return t._bind(e,n)},i.rodFromSignal=function(e,t){const n=_.rod(e());let o=!1;const r=i.reactive.effect(()=>{const s=n.value,c=i.reactive.untracked(()=>e());if(!o&&c!==s){o=!0;try{t(s)}finally{o=!1}}}),a=i.reactive.effect(()=>{const s=e();if(i.reactive.untracked(()=>n.value)!==s){o=!0;try{n._setSilent(s)}finally{o=!1}}});return typeof n.onDispose=="function"&&(n.onDispose(r),n.onDispose(a)),n};function ke(e){if(!e||!e.tagName)return null;const t=e.tagName.toLowerCase();if(t==="input"){const n=(e.type||"text").toLowerCase();return n==="checkbox"?"checkbox":n==="radio"?"radio":n==="number"?"number":"text"}return t==="select"?e.multiple?"select-multiple":"select":null}i.rodModel=function(e,t,n={}){var l,f,m;if(!t||t.type!=="rod")throw new Error("[JSswift.rodModel] rodObj deve essere un rod");const o=Array.isArray(e)||e instanceof NodeList?Array.from(e):[e],r=(l=n.event)!=null?l:"change",a=(f=n.parse)!=null?f:(h=>h),s=(m=n.format)!=null?m:(h=>h);let c=!1;const d=[],u=h=>{for(const w of o){if(!w)continue;switch(ke(w)){case"checkbox":w.checked=!!h;break;case"radio":w.checked=w.value==h;break;case"select":w.value=h!=null?h:"";break;case"select-multiple":const C=Array.isArray(h)?h.map(String):[];for(const v of w.options)v.selected=C.includes(v.value);break;default:w.value=h!=null?h:""}}};t.action(h=>{if(!c){c=!0;try{u(s(h))}finally{c=!1}}}),u(s(t.value));for(const h of o){if(!h)continue;const w=ke(h),T=()=>{if(c)return;let C;switch(w){case"checkbox":C=h.checked;break;case"radio":if(!h.checked)return;C=h.value;break;case"select":C=h.value;break;case"select-multiple":C=Array.from(h.selectedOptions).map(v=>v.value);break;case"number":C=a(h.value===""?null:Number(h.value));break;default:C=a(h.value)}c=!0;try{t.value!==C&&(t.value=C)}finally{c=!1}};h.addEventListener(r,T),d.push(()=>h.removeEventListener(r,T))}return typeof t.onDispose=="function"&&t.onDispose(()=>d.forEach(h=>h())),()=>d.forEach(h=>h())},i.signalModel=function(e,t,n,o={}){const r=i.rodFromSignal(t,n);return i.rodModel(e,r,o)};function Y(e){if(!e)return;const t=i._cleanupRegistry.get(e);if(t){for(const n of t)try{n()}catch(o){console.error("[cleanup] error:",o)}i._cleanupRegistry.delete(e)}if(e.childNodes&&e.childNodes.length)for(const n of e.childNodes)Y(n)}function ft(e){const t=n=>typeof n=="string"?i.dom.q(n):n;return Array.isArray(e)?e.map(t).filter(Boolean):[t(e)].filter(Boolean)}function dt(e){const t=[],n=[],o=r=>{if(r!=null){if(typeof r=="function"){o(r());return}if(r&&typeof r=="object"&&"node"in r){typeof r.dispose=="function"&&n.push(r.dispose),o(r.node);return}if(Array.isArray(r)){for(const a of r)o(a);return}if(typeof r=="string"||typeof r=="number"){t.push(document.createTextNode(String(r)));return}if(r.nodeType){t.push(r);return}console.warn("[JSswift.mount] contenuto non supportato:",r)}};return o(e),{nodes:t,disposers:n}}function Te(e=[],t="[JSswift.mount] dispose error:"){let n=!1;return()=>{if(!n){n=!0;for(const o of e)try{o()}catch(r){console.error(t,r)}}}}function Ne(e=[],t=null){return Te([...t?[t]:[],...e],"[component] dispose error:")}i.mount=function(e,t,n={}){var d;const o=ft(e),r=(d=n.clear)!=null?d:!0,a=o.length>1;if(o.length===0)return console.warn("[JSswift.mount] nessun target valido:",e),()=>{};const s=[];for(const u of o){if(r)for(;u.firstChild;)Y(u.firstChild),u.removeChild(u.firstChild);const{nodes:l,disposers:f}=dt(t);let m=l;a&&typeof t!="function"&&(m=l.map(w=>w.cloneNode(!0)),f.length&&console.warn("[JSswift.mount] multi-target con dispose: usa content come function per istanze separate."));const h=Te(f);for(const w of m)u.appendChild(w);s.push({root:u,nodes:m,dispose:h});for(const w of m)!w||!w.nodeType||i._registerCleanup(w,h)}return()=>{var u;for(const l of s){for(const f of l.nodes)f&&(Y(f),f.parentNode===l.root&&l.root.removeChild(f));(u=l.dispose)==null||u.call(l)}}},i.component=function(e){if(typeof e!="function")throw new Error("JSswift.component: renderFn must be a function");return function(n={}){const o=[],a=e(n,{onDispose(s){typeof s=="function"&&o.push(s)}});return a&&typeof a=="object"&&"node"in a?{node:a.node,dispose:Ne(o,typeof a.dispose=="function"?a.dispose:null)}:{node:a,dispose:Ne(o)}}},i.enableAutoCleanup=function(){if(i._autoCleanupEnabled)return;i._autoCleanupEnabled=!0;const e=new MutationObserver(t=>{for(const n of t)for(const o of n.removedNodes)Y(o)});e.observe(document.body,{childList:!0,subtree:!0}),i._cleanupObserver=e},i.debug=(()=>{const e={rodFlushes:0,rodNotifies:0,rodBinds:0,rodBindNull:0,rodBindDup:0};function t(){return!!i.config.debug}function n(...d){t()&&console.log("[JSswift]",...d)}function o(...d){t()&&console.warn("[JSswift]",...d)}function r(...d){console.error("[JSswift]",...d)}function a(d,u=1){e[d]||(e[d]=0),e[d]+=u}function s(){return{...e}}function c(){for(const d of Object.keys(e))e[d]=0}return{enabled:t,log:n,warn:o,error:r,inc:a,stats:s,reset:c}})(),i.perf=(()=>{let e=!1;const t={effectsRun:0,effectsSlow:0,rodNotifies:0,rodFlushes:0,domWrites:0,httpRequests:0},n=[],o=[],r={timelineMax:200,slowEffectMs:8};function a(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function s(b,k=0,A=null){e&&(n.push({t:Date.now(),type:b,ms:k,meta:A}),n.length>r.timelineMax&&n.shift())}function c(b,k=1){e&&(t[b]=(t[b]||0)+k)}function d(b,k){e&&(o.push({t:Date.now(),ms:b,meta:k}),o.length>100&&o.shift())}let u=null;function l(){u||(u=i.reactive.effect,i.reactive.effect=function(b,k){return u((...L)=>{const D=a();c("effectsRun");try{return b(...L)}finally{const j=a()-D;j>=r.slowEffectMs?(c("effectsSlow"),d(j,k||b.name||"effect"),s("effect:slow",j,k||b.name||null)):s("effect",j,k||b.name||null)}})})}function f(){u&&(i.reactive.effect=u,u=null)}function m(b=!0){return e=!!b,e?l():f(),e}function h(){for(const b of Object.keys(t))t[b]=0;n.length=0,o.length=0}function w(){return{enabled:e,...t,slowEffectMs:r.slowEffectMs,timelineSize:n.length}}function T(){return n.slice()}function C(b=r.slowEffectMs){return o.filter(k=>k.ms>=b).slice().sort((k,A)=>A.ms-k.ms)}function v(b,k){const A=a();try{return k()}finally{const L=a()-A;s("time:"+b,L,b)}}function y(b,k){s(b,0,k)}function p(b,k,A){s(b,k,A)}return{enable:m,reset:h,stats:w,timeline:T,slowEffects:C,time:v,mark:y,tick:p,inc:c,cfg:r}})(),i.rod=i.rod||{},i.rod.inspect=function(e,t="rod"){if(!e||e.type!=="rod")return console.warn("[JSswift.rod.inspect] non \xE8 un rod:",e),null;const n=typeof e.bindings=="function"?e.bindings():[],o={label:t,value:e.value,bindingsCount:n.length,bindings:n.map(r=>{var a,s,c,d,u,l,f;return{key:r.key,el:((a=r.el)==null?void 0:a.nodeType)===3?"#text":(s=r.el)==null?void 0:s.tagName,id:((c=r.el)==null?void 0:c.id)||null,className:((d=r.el)==null?void 0:d.className)||null,isConnected:((u=r.el)==null?void 0:u.nodeType)===3?!!r.el.parentNode:(f=(l=r.el)==null?void 0:l.isConnected)!=null?f:null}}),actionsCount:Array.isArray(e._actions)?e._actions.length:null,disposed:!!e._disposed};return i.config.debug?(console.groupCollapsed(`[JSswift.rod.inspect] ${t}`),console.log(o),console.groupEnd()):console.log(o),o},i.rod.inspectAll=function(){const e=i.rod._all?Array.from(i.rod._all):[];return e.forEach((t,n)=>i.rod.inspect(t,`rod#${n+1}`)),e.length},i._storeShared=(()=>{function e(a){return`${a.storage}::${a.prefix}`}function t(a,s){function c(f={}){var h,w;const m={storage:(h=f.storage)!=null?h:a.storage,prefix:(w=f.prefix)!=null?w:a.prefix};return s.set(e(m),m),m}function d(f=null){var h;return(typeof f=="string"?f:(h=f==null?void 0:f.storage)!=null?h:a.storage)==="session"?window.sessionStorage:window.localStorage}function u(f,m=null){return(m||c()).prefix+f}function l(f,m=null){const h=m||c();return`${e(h)}::${f}`}return{getScope:c,getStorage:d,fullKey:u,channelKey:l}}function n(a){try{return JSON.parse(a)}catch(s){return}}function o(a){try{return JSON.stringify(a)}catch(s){return}}function r(a,...s){const c=`${a.storage}::${a.prefix}::`;for(const d of s)for(const u of Array.from(d.keys()))u.startsWith(c)&&d.delete(u)}return{createScopeTools:t,safeParse:n,safeStringify:o,clearScopedMapEntries:r}})(),i.store=(()=>{const e={prefix:"JSswift:",storage:"local",syncTabs:!0,writeDelay:0},t=new Map,n=new Map,o=new Map,r=new Map;let a=!1;const{createScopeTools:s,safeParse:c,safeStringify:d,clearScopedMapEntries:u}=i._storeShared,{getScope:l,getStorage:f,fullKey:m,channelKey:h}=s(e,r);function w(R,P,M=null){var S;const F=M||l(),g=n.get(h(R,F));if(g)for(const z of g)try{(S=i.reactive)!=null&&S.untracked?i.reactive.untracked(()=>z(P)):z(P)}catch(I){console.error("[store] watcher error:",I)}}function T(){a=!1;for(const[R,P]of Array.from(o.entries())){o.delete(R);const M=t.get(R),F=d(M);if(F===void 0)continue;const g=f(P.scope);try{g.setItem(m(P.key,P.scope),F)}catch(S){console.error("[store] write error:",S)}}}function C(R,P=null){const M=P||l();o.set(h(R,M),{key:R,scope:M}),!a&&(a=!0,e.writeDelay>0?setTimeout(T,e.writeDelay):queueMicrotask(T))}function v(R,P=null){const M=P||l(),g=f(M).getItem(m(R,M));if(g!=null)return c(g)}function y(R,P,M=null){const F=M||l(),g=h(R,F);if(t.has(g))return t.get(g);const S=v(R,F);return S!==void 0?(t.set(g,S),S):P}function p(R,P,M=null){const F=M||l();return t.set(h(R,F),P),C(R,F),w(R,P,F),P}function b(R,P=null){const M=P||l(),F=h(R,M);t.delete(F),o.delete(F);try{f(M).removeItem(m(R,M))}catch(g){}w(R,void 0,M)}function k(R={}){const P=l(R),M=f(P),F=[];for(let g=0;g<M.length;g++){const S=M.key(g);S&&S.startsWith(P.prefix)&&F.push(S)}for(const g of F)M.removeItem(g);u(P,t,o,n)}function A(R,P,M=null){if(typeof P!="function")return()=>{};const F=M||l(),g=h(R,F);return n.has(g)||n.set(g,new Set),n.get(g).add(P),()=>{var S;return(S=n.get(g))==null?void 0:S.delete(P)}}function L(R,P,M={}){const F=l({storage:M.storage,prefix:M.prefix}),g=y(R,P,F),[S,z,I]=i.reactive.signal(g),J=i.reactive.effect(()=>{const x=S();p(R,x,F)}),N=A(R,x=>{S()!==x&&z(x)},F);return[S,z,()=>{try{J==null||J()}catch(x){}try{N==null||N()}catch(x){}try{I==null||I()}catch(x){}}]}l(),e.syncTabs&&window.addEventListener("storage",R=>{if(!(!R.key||!R.storageArea))for(const P of r.values()){if(f(P)!==R.storageArea||!R.key.startsWith(P.prefix))continue;const M=R.key.slice(P.prefix.length),F=R.newValue==null?void 0:c(R.newValue),g=h(M,P);F===void 0?t.delete(g):t.set(g,F),w(M,F,P)}});function D(R={}){Object.assign(e,R),l()}function j(){return{prefix:e.prefix,storage:e.storage,syncTabs:e.syncTabs,cacheSize:t.size,scopeCount:r.size}}return{configure:D,stats:j,get:y,set:p,remove:b,clear:k,watch:A,signal:L}})(),i.store.computed=function(e){if(typeof e!="function")throw new Error("store.computed: fn must be a function");return i.reactive.computed(e)},i.store.migrate=function(e,t,n={}){var c,d;const o=(c=n.versionKey)!=null?c:"__version",r=Number((d=i.store.get(o,0))!=null?d:0),a=Number(e!=null?e:0);if(!Number.isFinite(a)||a<0)throw new Error("store.migrate: targetVersion non valido");if(r>=a)return{from:r,to:a,applied:0};let s=0;for(let u=r;u<a;u++){const l=t==null?void 0:t[u];if(typeof l=="function")try{l(i.store)}catch(f){console.error("[store.migrate] step error at version",u,f)}s++,i.store.set(o,u+1)}return{from:r,to:a,applied:s}},i.store.model=function(e,t,n,o={}){if(typeof t!="string"||!t)throw new Error("store.model: key deve essere una stringa non vuota");const[r,a,s]=i.store.signal(t,n,{storage:o.storage,prefix:o.prefix}),c=i.rodFromSignal(r,a),d=i.rodModel(e,c,{event:o.event,parse:o.parse,format:o.format});return()=>{var u;try{d==null||d()}catch(l){}try{s==null||s()}catch(l){}try{(u=c.dispose)==null||u.call(c)}catch(l){}}},i.store.bind=function(e,t,n,o={}){var a;let r=e;return typeof e=="string"&&(e.includes("[")||e.includes(" ")?r=document.querySelectorAll(e):r=i.dom.q(e)),r?i.store.model(r,t,n,o):((a=i.config)!=null&&a.debug&&console.warn("[store.bind] target non trovato:",e),()=>{})},i.store.bindAll=function(e,t={},n={}){if(typeof e=="string"&&(e=i.dom.q(e)),!e||!e.querySelectorAll)return console.warn("[store.bindAll] form non valido:",e),()=>{};const o=[];for(const[r,a]of Object.entries(t)){const s=e.querySelectorAll(`[name="${r}"]`);if(!s.length)continue;const c=i.store.model(s.length===1?s[0]:s,r,a,n);o.push(c)}return()=>o.forEach(r=>r())},i.store.inspect=function(){const e={...i.store.stats(),keys:Array.from((function(){const t=i.store.stats().storage==="session"?sessionStorage:localStorage,n=[];for(let o=0;o<t.length;o++){const r=t.key(o);r&&r.startsWith(i.store.stats().prefix)&&n.push(r.replace(i.store.stats().prefix,""))}return n})())};return console.groupCollapsed("[JSswift.store.inspect]"),console.table(e.keys),console.log(e),console.groupEnd(),e},i.store.autoForm=function(e,t={},n={}){var r;const o=i.store.bindAll(e,t,n);return(r=i.config)!=null&&r.debug&&console.log("[store.autoForm] autosave attivo:",t),o},i.useStore=function(e,t,n,o={}){const[r,a,s]=i.store.signal(e,t,o);return n&&typeof n.onDispose=="function"&&typeof s=="function"&&n.onDispose(s),[r,a]},i._plugins=new Set,i.usePlugin=function(e,t){var n;if(e){if(i._plugins.has(e)){(n=i.config)!=null&&n.debug&&console.warn("[JSswift.usePlugin] plugin gi\xE0 installato:",e.name||e);return}if(typeof e=="function"){e(i,t),i._plugins.add(e);return}if(e&&typeof e.install=="function"){e.install(i,t),i._plugins.add(e);return}console.warn("[JSswift.usePlugin] plugin non valido:",e)}},i.plugins=i.plugins||{},i.plugins.debug={install(e){e.config.debug=!0,console.log("[JSswift] Debug mode ON")}},i.plugins.forms={install(e){const t={};e.forms={validate(n,o={},r={}){var l,f;if(typeof n=="string"&&(n=e.dom.q(n)),!n||!n.querySelectorAll)return console.warn("[forms.validate] form non valido:",n),null;const a={mode:r.mode||"input",showMessages:(l=r.showMessages)!=null?l:!0,submitGuard:(f=r.submitGuard)!=null?f:!0,errorClass:r.errorClass||"is-invalid",validClass:r.validClass||"is-valid",messageClass:r.messageClass||"form-error"},s={};for(const[m,h]of Object.entries(o)){const w=n.querySelectorAll(`[name="${m}"]`);if(!w.length)continue;const[T,C]=e.reactive.signal(null);s[m]={getErr:T,setErr:C,els:w};let v=null;a.showMessages&&(v=document.createElement("div"),v.className=a.messageClass,w[w.length-1].after(v));const y=()=>{let p;const b=w[0];if(b.type==="checkbox")p=b.checked;else if(b.type==="radio"){const L=Array.from(w).find(D=>D.checked);p=L?L.value:null}else p=b.value;let k=!0;try{k=h(p)}catch(L){k=L.message||"Errore di validazione"}const A=k===!0?null:typeof k=="string"?k:"Valore non valido";return C(A),!A};for(const p of w)p.addEventListener(a.mode,y);e.reactive.effect(()=>{const p=T();for(const b of w)b.classList.toggle(a.errorClass,!!p),b.classList.toggle(a.validClass,!p);v&&(v.textContent=p||"",v.style.display=p?"block":"none")}),y()}const c=e.store.computed(()=>Object.values(s).every(m=>!m.getErr())),d=m=>{let h=!0;for(const w of Object.values(s)){const T=w.els[0];T&&T.dispatchEvent(new Event(a.mode,{bubbles:!0})),w.getErr()&&(h=!1)}!h&&a.submitGuard&&(m.preventDefault(),m.stopPropagation())};a.submitGuard&&n.addEventListener("submit",d);const u=()=>{a.submitGuard&&n.removeEventListener("submit",d)};return t[n]={isValid:c,dispose:u},{isValid:c,dispose:u}}}}},i._authShared=(()=>{function e(o){const r=()=>{var s;return((s=o())==null?void 0:s.roles)||[]},a=()=>{var s;return((s=o())==null?void 0:s.permissions)||[]};return{roles:r,perms:a,hasRole:s=>r().includes(s),can:s=>a().includes(s),canAny:s=>s.some(c=>r().includes(c)||a().includes(c)),canAll:s=>s.every(c=>r().includes(c)||a().includes(c))}}function t(o,r){return r.some(a=>typeof a=="string"?o.startsWith(a):a instanceof RegExp?a.test(o):!1)}function n(o,r){if(!o||!r)return;let a=!1;function s(){return Date.now()}function c(m){if(!m||typeof m!="string")return null;const h=m.split(".");if(h.length<2)return null;try{const w=h[1].replace(/-/g,"+").replace(/_/g,"/"),T=decodeURIComponent(atob(w).split("").map(C=>"%"+C.charCodeAt(0).toString(16).padStart(2,"0")).join(""));return JSON.parse(T)}catch(w){return null}}function d(){var m,h,w,T;if(typeof r._getState=="function"){const C=r._getState();return C&&typeof C=="object"?C:{user:(h=(m=r.user)==null?void 0:m.call(r))!=null?h:null}}return{user:(T=(w=r.user)==null?void 0:w.call(r))!=null?T:null}}function u(){var y,p,b;const m=d()||{},h=(p=m.user)!=null?p:(y=r.user)==null?void 0:y.call(r),w=(h==null?void 0:h.name)||(h==null?void 0:h.email)||(h==null?void 0:h.id)||"anon",T=!!((b=r.isAuth)!=null&&b.call(r)),C=m.expiresAt||null,v=C?C-s():null;return T?`AUTH \u2705 user=${w}${C?` expiresIn=${Math.round(v/1e3)}s`:""}`:`AUTH \u274C user=${w}`}function l(m="auth"){var D,j,R;const h=d()||{},w=(j=h.user)!=null?j:(D=r.user)==null?void 0:D.call(r),T=(w==null?void 0:w.roles)||[],C=(w==null?void 0:w.permissions)||[],v=h.accessToken||null,y=h.refreshToken||null,p=v?c(v):null,b=h.expiresAt||(p!=null&&p.exp?p.exp*1e3:null),k=s(),A=b?b-k:null,L={label:m,isAuth:!!((R=r.isAuth)!=null&&R.call(r)),user:w,roles:T,permissions:C,has:{role:P=>{var M;return!!((M=r.hasRole)!=null&&M.call(r,P))},can:P=>{var M;return!!((M=r.can)!=null&&M.call(r,P))}},token:{hasAccess:!!v,hasRefresh:!!y,expiresAt:b,expiresInSec:A==null?null:Math.round(A/1e3),decodedJWT:p}};return console.groupCollapsed(`[JSswift.auth.inspect] ${m}`),console.log("status:",u()),console.log(L),A!=null&&(A<=0?console.warn("\u26A0\uFE0F Access token scaduto."):A<6e4&&console.warn("\u26A0\uFE0F Access token in scadenza (<60s).")),console.groupEnd(),L}function f(m=!0){a=!!m,console.log("[JSswift.auth.trace]",a?"ON":"OFF")}if(typeof r.fetch=="function"&&!r._fetchWrapped){const m=r.fetch.bind(r);r.fetch=async(...h)=>{const w=await m(...h);if(a)try{console.log("[auth.fetch]",w.status,h[0])}catch(T){}return w},r._fetchWrapped=!0}r.decodeJWT=c,r.status=u,r.inspect=l,r.trace=f}return{createPermissionApi:e,matchesProtectedPath:t,attachDevTools:n}})(),i.plugins.auth={install(e,t={}){var k;const{createPermissionApi:n,matchesProtectedPath:o,attachDevTools:r}=i._authShared,a={key:t.key||"auth",loginRoute:t.loginRoute||"/login",protected:t.protected||[],autoRedirect:(k=t.autoRedirect)!=null?k:!0,endpoints:t.endpoints||{login:"/api/login",refresh:"/api/refresh",logout:"/api/logout"},fetchOptions:t.fetchOptions||{},tokenHeader:t.tokenHeader||"Authorization",tokenPrefix:t.tokenPrefix||"Bearer ",refreshMargin:t.refreshMargin||3e4},[s,c]=e.store.signal(a.key,null),d=()=>{var A;return((A=s())==null?void 0:A.user)||null},u=()=>{var A;return!!((A=s())!=null&&A.accessToken)},{hasRole:l,can:f,canAny:m,canAll:h}=n(d);let w=!1,T=[];function C(){const A=s();return A!=null&&A.expiresAt?Date.now()>A.expiresAt-a.refreshMargin:!1}async function v(){var A;if(w)return new Promise((L,D)=>T.push({res:L,rej:D}));w=!0;try{const L=await fetch(a.endpoints.refresh,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:(A=s())==null?void 0:A.refreshToken})});if(!L.ok)throw new Error("Refresh failed");const D=await L.json();return c({...s(),...D}),T.forEach(j=>j.res(!0)),T=[],!0}catch(L){throw T.forEach(D=>D.rej(L)),T=[],c(null),a.autoRedirect&&e.router.navigate(a.loginRoute),L}finally{w=!1}}async function y(A){const L=await fetch(a.endpoints.login,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!L.ok)throw new Error("Login failed");const D=await L.json();return c(D),D}async function p(){try{await fetch(a.endpoints.logout,{method:"POST"})}catch(A){}c(null),a.autoRedirect&&e.router.navigate(a.loginRoute)}async function b(A,L={}){var P;C()&&await v();const D=s(),j=new Headers(L.headers||{});D!=null&&D.accessToken&&j.set(a.tokenHeader,a.tokenPrefix+D.accessToken);const R=await fetch(A,{...a.fetchOptions,...L,headers:j});return R.status===401&&((P=s())!=null&&P.refreshToken)&&!L._authRetried?(await v(),b(A,{...L,_authRetried:!0})):R}e.router.beforeEach(A=>{const L=A.path;return o(L,a.protected)&&!u()?a.loginRoute:!0}),e.auth={user:d,isAuth:u,hasRole:l,can:f,canAny:m,canAll:h,loginAsync:y,logoutAsync:p,fetch:b,_getState:s},e.useAuth=function(A){return A&&A.onDispose,e.auth},r(i,e.auth)}},i._httpShared=(()=>{function e(u){var F;const l=u.reactive,[f,m]=l.signal(0),[h,w]=l.signal("idle"),[T,C]=l.signal(null),[v,y]=l.signal(null),[p,b]=l.signal(null),[k,A]=l.signal(0),[L,D]=l.signal(0);let j=0;function R(g){const S=++j,z=Date.now();return m(f()+1),w("pending"),b(null),y(null),C({id:S,url:g.url,method:g.method,meta:g.meta,timeout:g.timeout,retry:g.retry,startedAt:z}),D(z),S}function P(g,S,z,I){const J=Date.now();m(Math.max(0,f()-1)),g===j&&(z?(w("error"),b(z),y(null)):S?(w("success"),b(null),y({id:g,status:S.status,ok:S.ok,headers:S.headers,url:S.url,receivedAt:J,raw:S})):(w("idle"),b(null),y(null)),A(Math.max(0,Number(I||0)))),D(J)}return{state:{inFlight:f,status:h,isLoading:(F=u.store)!=null&&F.computed?u.store.computed(()=>f()>0):()=>f()>0,lastRequest:T,lastResponse:v,lastError:p,lastDuration:k,lastUpdated:L,reset(){m(0),w("idle"),C(null),y(null),b(null),A(0),D(Date.now())}},markStart:R,markEnd:P}}function t(u,l){if(!u||/^https?:\/\//i.test(l))return l;const f=u.endsWith("/")?u.slice(0,-1):u,m=l.startsWith("/")?l:"/"+l;return f+m}function n(u){return new Promise(l=>setTimeout(l,u))}function o(u,l){return u?!0:l?l.status===429||l.status>=500&&l.status<=599:!1}function r(u,l){if(!u&&!l)return{signal:void 0,cancel:()=>{}};const f=new AbortController,m=f.signal;let h=null;u>0&&(h=setTimeout(()=>f.abort(new Error("timeout")),u));const w=()=>f.abort(l.reason||new Error("aborted"));return l&&(l.aborted?w():l.addEventListener("abort",w,{once:!0})),{signal:m,cancel:()=>{var C;h&&clearTimeout(h),l&&((C=l.removeEventListener)==null||C.call(l,"abort",w))}}}function a(u,l,f={}){var T,C,v;const m=typeof l=="string"?t(u.baseURL,l):l,h=(f.method||"GET").toUpperCase(),w=new Headers(u.headers);return f.headers&&new Headers(f.headers).forEach((y,p)=>w.set(p,y)),{url:m,method:h,headers:w,body:f.body,credentials:(T=f.credentials)!=null?T:u.credentials,signal:f.signal,timeout:(C=f.timeout)!=null?C:u.timeout,retry:(v=f.retry)!=null?v:u.retry,meta:f.meta||{}}}async function s(u,...l){var m;let f=l[0];for(const h of u)f=(m=await h(f,...l.slice(1)))!=null?m:f;return f}function c(u,l){return{ok:u.ok,status:u.status,headers:u.headers,raw:u,req:l,async json(){let f=null,m=null;try{f=await u.json()}catch(h){f=null}return u.ok||(m=f!=null?f:{status:u.status}),{data:f,error:m,ok:u.ok,status:u.status}},async jsonStrict(){const{data:f,error:m}=await this.json();if(m){const h=new Error(`HTTP error ${u.status} ${(l==null?void 0:l.method)||""} ${(l==null?void 0:l.url)||""}`.trim());throw h.status=u.status,h.data=f,h.req={url:l==null?void 0:l.url,method:l==null?void 0:l.method,meta:l==null?void 0:l.meta},h}return{data:f,ok:!0,status:u.status}},async text(){let f="";try{f=await u.text()}catch(m){}return{text:f,ok:u.ok,status:u.status}},async textStrict(){const f=await this.text();if(!f.ok){const m=new Error("HTTP error "+u.status);throw m.status=u.status,m.text=f.text,m}return f}}}function d(u,l,f,m,h={}){const w=new Headers(h.headers||{});return w.has("Content-Type")||w.set("Content-Type","application/json"),u(f,{...h,method:l,headers:w,body:m==null?void 0:JSON.stringify(m)})}return{createReactiveState:e,joinURL:t,sleep:n,isRetryable:o,makeAbort:r,normalizeRequest:a,runHooks:s,wrapResponse:c,withJSON:d}})();const{createReactiveState:pt,sleep:xe,isRetryable:Re,makeAbort:ht,normalizeRequest:mt,runHooks:Le,wrapResponse:Pe,withJSON:re}=i._httpShared,oe=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{},Me={baseURL:((Ie=oe.http)==null?void 0:Ie.baseURL)||"",timeout:(je=(Be=oe.http)==null?void 0:Be.timeout)!=null?je:0,retry:((Ue=oe.http)==null?void 0:Ue.retry)||{attempts:0,delay:250,factor:2},headers:((We=oe.http)==null?void 0:We.headers)||{},credentials:(He=oe.http)==null?void 0:He.credentials,debug:(qe=oe.debug)!=null?qe:!1},me=pt(i),le=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now(),K={beforeRequest:new Set,afterResponse:new Set,onError:new Set};async function yt(e){const t=i.auth&&typeof i.auth.fetch=="function"?i.auth.fetch.bind(i.auth):fetch,n={method:e.method,headers:e.headers,body:e.body,credentials:e.credentials,signal:e.signal};return t(e.url,n)}async function G(e,t={}){var h,w,T;let n=mt(Me,e,t);n=await Le(K.beforeRequest,n);const o=me.markStart(n),r=le(),a=n.retry||{attempts:0,delay:250,factor:2},s=Math.max(0,Number(a.attempts||0));let c=Math.max(0,Number(a.delay||0));const d=Math.max(1,Number(a.factor||2));let u=null,l=null,f=null,m=null;try{for(let C=0;C<=s;C++){u=null,l=null;const{signal:v,cancel:y}=ht(n.timeout,t.signal),p={...n,signal:v},b=le();try{Me.debug&&console.log("[http.request]",p.method,p.url),(h=i.perf)==null||h.inc("httpRequests"),(w=i.perf)==null||w.mark("http:req",{url:n.url,method:n.method});const k=await yt(p);l=k;const A=await Le(K.afterResponse,k,p),L=le()-b;if((T=i.perf)==null||T.tick("http:res",L,{status:k.status,url:n.url}),C<s&&Re(null,A)){y(),await xe(c),c=Math.round(c*d);continue}return y(),f=A,Pe(A,p)}catch(k){u=k,y();for(const A of K.onError)try{A(k,p)}catch(L){}if(C<s&&Re(k,null)){await xe(c),c=Math.round(c*d);continue}throw m=k,k}}}finally{const C=le()-r;me.markEnd(o,f,m,C)}if(u)throw u;return Pe(l,n)}i.http={},i.http.request=G,i.http.state=()=>me.state,i.http.get=(e,t)=>G(e,{...t,method:"GET"}),i.http.del=(e,t)=>G(e,{...t,method:"DELETE"}),i.http.post=(e,t,n)=>re(G,"POST",e,t,n),i.http.put=(e,t,n)=>re(G,"PUT",e,t,n),i.http.patch=(e,t,n)=>re(G,"PATCH",e,t,n),i.http.getJSON=async(e,t)=>(await G(e,{...t,method:"GET"})).jsonStrict(),i.http.delJSON=async(e,t)=>(await G(e,{...t,method:"DELETE"})).jsonStrict(),i.http.postJSON=async(e,t,n)=>(await re(G,"POST",e,t,n)).jsonStrict(),i.http.putJSON=async(e,t,n)=>(await re(G,"PUT",e,t,n)).jsonStrict(),i.http.patchJSON=async(e,t,n)=>(await re(G,"PATCH",e,t,n)).jsonStrict(),i.http.onBefore=function(e){return K.beforeRequest.add(e),()=>K.beforeRequest.delete(e)},i.http.onAfter=function(e){return K.afterResponse.add(e),()=>K.afterResponse.delete(e)},i.http.onError=function(e){return K.onError.add(e),()=>K.onError.delete(e)},window._http=i.http,i.useRouter=function(e){const t=i.router;return e&&e.onDispose,{navigate:t.navigate,back:()=>history.back(),forward:()=>history.forward(),get current(){return t}}},i.useRoute=function(e){const[t,n]=i.reactive.signal(""),[o,r]=i.reactive.signal({}),[a,s]=i.reactive.signal({}),[c,d]=i.reactive.signal(""),u=f=>{n(f.path||""),r(f.params||{}),s(f.query||{}),d(f.hash||"")},l=i.router.subscribe(u);return e&&typeof e.onDispose=="function"&&e.onDispose(l),{path:t,params:o,query:a,hash:c}},i._routerShared=(()=>{function e(c){return c?(c.startsWith("/")||(c="/"+c),c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1)),c):"/"}function t(c,d=""){if(d&&c.startsWith(d)){const u=c.slice(d.length)||"/";return e(u)}return e(c)}function n(c){c=e(c);const d=[],u=c.replace(/([.+*?=^!${}()[\]|/\\])/g,"\\$1").replace(/\\\/:([A-Za-z0-9_]+)/g,(l,f)=>(d.push(f),"\\/([^\\/]+)"));return{pattern:c,regex:new RegExp("^"+u+"$"),keys:d}}function o(c){const d={};return new URLSearchParams(c||"").forEach((l,f)=>{d[f]===void 0?d[f]=l:Array.isArray(d[f])?d[f].push(l):d[f]=[d[f],l]}),d}function r(c){const d=[];for(const u of c)if(d.push({...u,_parent:null}),u.children&&u.children.length)for(const l of u.children)d.push({...l,_parent:u});return d.sort((u,l)=>l.path.length-u.path.length),d}function a(c,d){const u=e(c),l=r(d);for(const f of l){const m=f._compiled.regex.exec(u);if(!m)continue;const h={};return f._compiled.keys.forEach((w,T)=>{h[w]=decodeURIComponent(m[T+1])}),{route:f,params:h,parent:f._parent||null}}return null}function s(c,d,u=50){c.push({at:Date.now(),path:d.path,params:d.params,query:d.query,hash:d.hash}),c.length>u&&c.shift()}return{normalizePath:e,stripBase:t,compilePattern:n,parseQuery:o,flattenRoutes:r,matchRoute:a,pushHistoryEntry:s}})(),i._uiMetaShared=(()=>{function e(s){return{hasTabPanel:typeof s.TabPanel=="function",Card:typeof s.Card=="function"?s.Card:(...c)=>s.div({class:"cms-doc-card"},...c),Chip:typeof s.Chip=="function"?s.Chip:(c,d)=>s.span({class:"cms-chip cms-chip-fallback"},d)}}function t(s){return s?Array.isArray(s)?s.join(" | "):String(s):"\u2014"}function n(s,c,d){return s.div({class:"cms-doc-meta"},s.div({class:"cms-doc-meta-head"},s.div({class:"cms-doc-meta-name"},c.name),s.div({class:"cms-doc-meta-types"},...c.type?String(c.type).split("|").map(u=>d({color:"secondary",dense:!0,outline:!0},u)):[s.span("\u2014")])),s.div({class:"cms-doc-meta-grid"},s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Default"),s.div({class:"cms-doc-meta-value"},c.default==null?"\u2014":String(c.default))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Values"),s.div({class:"cms-doc-meta-value"},t(c.values)))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Description"),s.div({class:"cms-doc-meta-value"},c.description||"\u2014")))}function o(s,c){return s.div({class:"cms-doc-fallback"},c.map(d=>s.div({class:"cms-doc-fallback-item"},s.h4({class:"cms-doc-fallback-title"},d.label||d.name),d.content)))}function r(s,c){return c?Array.isArray(c)?c.map(d=>({name:d.name,wrap:!0,label:d.name,content:s.div({class:"cms-p-md"},d.description)})):Object.entries(c).map(([d,u])=>({name:d,wrap:!0,label:d,content:s.div({class:"cms-p-md"},u)})):[]}function a(s,c){return c?Array.isArray(c)?c.map(d=>({name:d.name,wrap:!0,label:d.type,content:d.description})):Object.entries(c).map(([d,u])=>({name:d,wrap:!0,label:d,content:s.div({class:"cms-doc-meta"},s.div({class:"cms-doc-meta-head"},s.div({class:"cms-doc-meta-name"},d)),s.div({class:"cms-doc-meta-grid"},s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Type"),s.div({class:"cms-doc-meta-value"},u.type||"\u2014"))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Description"),s.div({class:"cms-doc-meta-value"},u.description||"\u2014")))})):[]}return{resolveDocComponents:e,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:a}})(),i.ui=i.ui||{},i.ui.meta=i.ui.meta||{},i.ui.slot=function(t,n={}){const o=i.ui,{as:r="node",wrap:a="span",iconProps:s=null,filter:c=!0}=n,d=m=>document.createTextNode(String(m)),u=m=>_.span(String(m)),l=m=>{if(m==null||m===!1)return null;if(typeof m=="function")return m;if(Array.isArray(m))return m.flatMap(l).filter(Boolean);if(m&&typeof m=="object"&&m.nodeType)return m;if(typeof m=="string"||typeof m=="number"||typeof m=="boolean"){const h=String(m);return r==="icon"&&o.Icon?o.Icon(h,{class:"cms-slot-icon",...s||{}}):a==="text"?d(h):a==="span"?u(h):h}return a==="text"?d(m):a==="span"?u(m):String(m)},f=l(t);return c&&Array.isArray(f)?f.filter(Boolean):f},i.ui.slots=function(...t){const n=[];for(const o of t){const r=i.ui.slot(o);r&&(Array.isArray(r)?n.push(...r):n.push(r))}return n},i.docTable=e=>{var v;if(!i.isDev())return _.div();const{resolveDocComponents:t,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:a}=i._uiMetaShared,s=(v=i.ui.meta)==null?void 0:v[e];if(!s)return _.div({class:"cms-muted"},`Meta non trovata: ${e}`);const{hasTabPanel:c,Card:d,Chip:u}=t(_),l={};Object.entries(s.props||{}).forEach(([y,p])=>{const b=p.category||"general";l[b]||(l[b]=[]),l[b].push({name:y,...p})});const f=Object.keys(l).map(y=>{const p=l[y].map(b=>({name:b.name,wrap:!0,label:b.name,content:n(_,b,u)}));return{name:y,wrap:!0,label:y,content:c?_.TabPanel({orientation:"vertical",animated:!0,radius:"0 0 0 var(--cms-r-default)",tabs:p}):o(_,p)}}),m=r(_,s.events),h=a(_,s.slots),w=_.rod(null),T=[];h.length&&T.push({name:"Slots",wrap:!0,label:"Slots",content:c?_.TabPanel({animated:!0,radius:"0 0 0 var(--cms-r-default)",orientation:"vertical",tabs:h}):o(_,h)}),f.length&&T.push(...f),m.length&&T.push({name:"Events",wrap:!0,label:"Events",content:c?_.TabPanel({animated:!0,radius:"0 0 0 var(--cms-r-default)",orientation:"vertical",tabs:m}):o(_,m)});const C="general";return T.sort((y,p)=>y.name===C?-1:p.name===C?1:y.name.localeCompare(p.name)),d({class:"cms-doc-table"},_.div({class:"cms-doc-table-header"},_.div({class:"cms-doc-table-title"},`_.${e}`),s.signature?_.div({class:"cms-doc-table-signature"},String(s.signature).replaceAll("UI.","_.")):null),T.length?_.h4({class:"cms-doc-table-section-title"},f.length?"Props":"Documentation"):_.p({class:"cms-muted"},"Nessuna documentazione strutturata disponibile."),T.length?c?_.TabPanel({border:!0,animated:!0,orientation:"horizontal",tabs:T,model:w}):o(_,T):null,s.returns?_.p({class:"cms-muted",style:{marginTop:"14px"}},`Returns: ${s.returns}`):null)},i.ui.inspect=e=>{var t;return console.log(((t=i.ui.meta)==null?void 0:t[e])||"meta not found")},i.ui.can=function(e,t,n,o=null){var s,c;const r=i.useAuth?i.useAuth(e):i.auth;return r?(typeof t=="function"?!!t(r):((s=r.can)==null?void 0:s.call(r,t))||((c=r.hasRole)==null?void 0:c.call(r,t)))?typeof n=="function"?n():n:typeof o=="function"?o():o:typeof o=="function"?o():null},i.ui.canAny=function(e,t,n,o=null){var s;const r=i.useAuth?i.useAuth(e):i.auth;return!!((s=r==null?void 0:r.canAny)!=null&&s.call(r,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},i.ui.canAll=function(e,t,n,o=null){var s;const r=i.useAuth?i.useAuth(e):i.auth;return!!((s=r==null?void 0:r.canAll)!=null&&s.call(r,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},i.Can=function(t,n){var a,s;const o=i.useAuth?i.useAuth(n):i.auth;return(()=>{var c,d,u,l;return o?t.when&&typeof t.when=="function"?!!t.when(o):t.perm?!!((c=o.can)!=null&&c.call(o,t.perm)):t.role?!!((d=o.hasRole)!=null&&d.call(o,t.role)):t.any?!!((u=o.canAny)!=null&&u.call(o,t.any)):t.all?!!((l=o.canAll)!=null&&l.call(o,t.all)):!1:!1})()?typeof t.then=="function"?t.then():(a=t.then)!=null?a:null:typeof t.else=="function"?t.else():(s=t.else)!=null?s:null},i.router=(()=>{let e="history",t=[],n=null,o=null,r="",a=null,s=null,c=[],d=!1;const{normalizePath:u,stripBase:l,compilePattern:f,parseQuery:m,matchRoute:h,pushHistoryEntry:w}=i._routerShared,T={setOutlet:{description:"imposta il contenitore del router"},setBase:{description:"imposta il base path del router"},add:{description:"per aggiungere la route"},notFound:{description:"imposta la view 404"},beforeEach:{description:"hook prima di ogni navigazione"},start:{description:"avvia il router"},navigate:{description:"naviga verso una route"},subscribe:{description:"sottoscrive agli aggiornamenti di route"},current:{description:"ritorna l'URL corrente"},isActive:{description:"verifica se una route e\u0300 attiva"},status:{description:"stringa di stato router"},inspect:{description:"stampa info diagnostiche"},trace:{description:"abilita/disabilita tracing"},history:{description:"ritorna la history interna"},setURLOnly:{description:"aggiorna solo l'URL del browser senza render/meta"}};function C(E,{replace:x=!1}={}){const O=typeof E=="string"?new URL(E,window.location.origin):E,B=O.pathname+O.search+O.hash;if(e==="hash"||e==="auto"){if(history.pushState){const W="#"+B;x?history.replaceState({},"",W):history.pushState({},"",W);return}const q="#"+B;x?window.location.replace(q):window.location.hash=q;return}x?history.replaceState({},"",r+B):history.pushState({},"",r+B)}function v(){if(e==="hash"){const E=window.location.hash||"#/",x=E.startsWith("#")?E.slice(1):E;return new URL(x,window.location.origin)}if(e==="auto"&&window.location.hash.startsWith("#/")){const E=window.location.hash.slice(1);return new URL(E,window.location.origin)}return new URL(window.location.href)}function y(E,x=!1){if(e==="hash"||e==="auto"&&!history.pushState){const O="#"+(E.pathname+E.search+E.hash);x?window.location.replace(O):window.location.hash=O;return}x?history.replaceState({},"",r+E.pathname+E.search+E.hash):history.pushState({},"",r+E.pathname+E.search+E.hash)}function p(E){e=E||"history"}function b(E){return l(E,r)}function k(E){if(!E)return!1;const x=s?s.path:b(v().pathname);let O=E;typeof O=="string"&&(O.includes("?")||O.includes("#")||O.includes("://"))&&(O=new URL(O,window.location.origin).pathname);const B=b(O);return B.includes(":")?f(B).regex.test(x):B===x}async function A(E,{replace:x=!1}={}){if(!n){console.warn("[router] outlet non impostato. Usa JSswift.router.setOutlet('#app').");return}const O=typeof E=="string"?new URL(E,window.location.origin):E;d&&console.log("[router.navigate]",O.toString());const B=O.pathname+O.search+O.hash;y(O,x);const q=b(O.pathname),W=h(q,t),U={path:q,fullPath:B,params:W?W.params:{},query:m(O.search),hash:O.hash||"",navigate:L,outlet:n};if(a){const H=await a(U);if(H===!1)return;if(typeof H=="string"){L(H,{replace:!0});return}}if(typeof o=="function"){try{o()}catch(H){console.error("[router] unmount error:",H)}o=null}if(!W){const H=t._notFound;H?o=i.mount(n,()=>H(U),{clear:!0}):o=i.mount(n,_.div("404"),{clear:!0}),S(U),s=U,w(c,U);return}const Q=W.route.view,Z=W.parent;let ee=null;if(U.renderChild=H=>{if(!U._child)return null;const ne=typeof H=="string"?U.outlet.querySelector(H):H;return ne?(ee=i.mount(ne,()=>U._child.view(U._child.ctx),{clear:!0}),ee):(console.warn("[router] child outlet non trovato:",H),null)},Z){const H=W.route,ne={...U,params:{...U.params}};U._child={view:H.view,ctx:ne},o=i.mount(n,()=>Z.view(U),{clear:!0})}else U._child=null,o=i.mount(n,()=>Q(U),{clear:!0});S(U),s=U,w(c,U)}function L(E,x={}){const O=new URL(E,window.location.origin);A(O,x)}function D(){window.addEventListener("popstate",()=>{A(v(),{replace:!0})}),window.addEventListener("hashchange",()=>{(e==="hash"||e==="auto")&&A(v(),{replace:!0})}),document.addEventListener("click",E=>{var U,Q;const x=(Q=(U=E.target)==null?void 0:U.closest)==null?void 0:Q.call(U,"a");if(!x||E.defaultPrevented||E.button!==0||E.metaKey||E.ctrlKey||E.shiftKey||E.altKey||x.hasAttribute("download")||x.target&&x.target!=="_self")return;const O=x.getAttribute("href");if(!O||O.startsWith("mailto:")||O.startsWith("tel:"))return;const B=new URL(O,window.location.origin);if(B.origin!==window.location.origin)return;const q=new URL(window.location.href);B.pathname+B.search===q.pathname+q.search&&B.hash||(E.preventDefault(),L(B.pathname+B.search+B.hash))}),A(v(),{replace:!0})}function j(E){return n=typeof E=="string"?i.dom.q(E):E,n}function R(E){r=E?u(E):"",r==="/"&&(r="")}function P(E,x,O=null){const B=f(E),q={path:B.pattern,view:x,_compiled:B,children:[]};if(Array.isArray(O))for(const W of O){const[U,Q,Z]=W,ee=u(B.pattern+"/"+(U||"").replace(/^\//,""));q.children.push({path:ee,view:Q,_compiled:f(ee),children:Array.isArray(Z)?Z:[]})}t.push(q)}function M(E){t._notFound=E}function F(E){a=E}let g=new Set;function S(E){for(const x of g)try{x(E)}catch(O){console.error("[router] listener error:",O)}}function z(){if(!s)return"ROUTER \u23F3 not ready";const E=Object.keys(s.query||{}).length?"?":"";return`ROUTER ${s.path}${E} ${s.hash||""}`}function I(E="router"){if(!s)return console.warn("[router.inspect] nessuna route attiva"),null;const x={label:E,mode:typeof e!="undefined"?e:"unknown",base:r,path:s.path,params:s.params,query:s.query,hash:s.hash,outlet:n,timestamp:new Date().toISOString()};return console.groupCollapsed(`[JSswift.router.inspect] ${E}`),console.log(x),console.log("history:",c.slice()),console.groupEnd(),x}function J(E=!0){d=!!E,console.log("[JSswift.router.trace]",d?"ON":"OFF")}function N(){return c.slice()}return{meta:T,setOutlet:j,setBase:R,add:P,setURLOnly:C,notFound:M,beforeEach:F,start:D,navigate:L,isActive:k,subscribe(E){return g.add(E),()=>g.delete(E)},current(){return v?v():new URL(window.location.href)},status:z,inspect:I,trace:J,history:N}})(),($e=i.config)!=null&&$e.debug&&(window.$router=i.router),i.signal=i.reactive.signal,i.effect=i.reactive.effect,i.computed=i.reactive.computed,i.untracked=i.reactive.untracked,i.batch=i.reactive.batch;function se(e){return e==null?null:String(e).trim()||null}function ye(e){const t=Array.isArray(e)?e:typeof e=="string"?e.split(","):[],n=[],o=new Set;for(const r of t){const a=se(r);!a||o.has(a)||(o.add(a),n.push(a))}return n}function ge(){var e;return typeof document!="undefined"&&document.documentElement?document.documentElement:(e=i.dom)!=null&&e.q?i.dom.q("html"):null}function De(){try{return typeof globalThis!="undefined"&&globalThis.localStorage||null}catch(e){return null}}function fe(){var e;return se((e=i.theme)==null?void 0:e.storageKey)||"jsswift:theme"}function Oe(){const e=De();if(!e)return null;try{return se(e.getItem(fe()))}catch(t){return null}}function gt(e){const t=De();if(t)try{e==null?t.removeItem(fe()):t.setItem(fe(),e)}catch(n){}}function ze(e){var o,r,a,s,c;const t=ge(),n=[e,(o=i.theme)==null?void 0:o.themes,(r=i.config)==null?void 0:r.themes,typeof globalThis!="undefined"?(a=globalThis.JSswift_setting)==null?void 0:a.themes:null,typeof globalThis!="undefined"?(s=globalThis.JSswift_setting)==null?void 0:s.themeList:null,(c=t==null?void 0:t.getAttribute)==null?void 0:c.call(t,"data-themes")];for(const d of n){const u=ye(d);if(u.length)return u}return[]}i.theme=i.theme||{},i.theme.storageKey=fe(),ye(i.theme.themes).length||(i.theme.themes=ze()),i.setTheme=function(e,t={}){const n=se(e),o=ge();return o&&(n==null?o.removeAttribute("data-theme"):o.setAttribute("data-theme",n)),t.persist!==!1&>(n),o},i.getTheme=function(e={}){var r;const t=ge(),n=se((r=t==null?void 0:t.getAttribute)==null?void 0:r.call(t,"data-theme"));if(n)return n;if(e.storage===!1)return null;const o=Oe();return o&&t&&e.sync!==!1&&t.setAttribute("data-theme",o),o},i.toggleTheme=function(e,t={}){const n=ze(e),o=n.length?n:ye([i.getTheme({sync:!1}),"light","dark"]),r=i.getTheme({sync:!1}),a=se(t.fallback)||o[0]||"light",s=r?o.indexOf(r):-1,c=s>=0?o[(s+1)%o.length]:a;return i.theme.themes=o.slice(),i.setTheme(c,t),c};const Je=Oe();Je&&i.setTheme(Je,{persist:!1})})();
|
|
1
|
+
(()=>{var Fe,Ie,Be,Ue,je,We,He,qe,$e;window.JSswift=window.JSswift||{};const i=window.JSswift;window._=window.JSswift,i.config=i.config||{};const Ve=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{};i.config.debug=(Fe=Ve.modeDev)!=null?Fe:!1,i.isDev=function(){return i.config.debug},i.uiNormalizeArgs=function(e){let t={},n=e;return e.length>0&&typeof e[0]=="object"&&e[0]!==null&&!e[0].nodeType&&!Array.isArray(e[0])&&!(e[0]instanceof Function)&&(t=e[0],n=e.slice(1)),{props:t,children:n}},i.uiSizes=["xxs","xs","sm","md","lg","xl","xxl","xxxl"],i.uiColors=["primary","secondary","success","warning","danger","info","light","dark"],i.meta=i.meta||{version:"1.0.23",policy:{sourceOfTruth:"docDevelop/reference/core.md",syncRule:"Quando cambia un modulo core, aggiornare sia questo meta sia docDevelop/reference/core.md."},modules:{render:{description:"Bridge props -> DOM per hyperscript _, attributi, class, style, eventi e children reattivi.",entrypoints:["createElement","setProp","bindProp"],status:"milestone-3-closed",knownLimits:["Il mini-terzo-giro e il successivo micro-giro avanzato hanno chiuso style dinamico, eventi, children e props/attr speciali, ma restano altri edge case avanzati da esplorare.","Gli eventi ora supportano composizione base di listener multipli, ma non hanno ancora delegation o diff avanzato.","Restano da esplorare edge case avanzati del renderer oltre ai giri gia coperti dai test."]},reactive:{description:"Core minimale signal/effect usato come base della reattivita.",entrypoints:["JSswift.reactive.signal","JSswift.reactive.effect","JSswift.reactive.computed","JSswift.reactive.untracked","JSswift.reactive.batch"],status:"milestone-2-closed",knownLimits:["La protezione loop copre i loop sincroni per singolo effect, non ancora i cicli complessi tra effect multipli.","Il batching sincrono ora esiste, ma manca ancora scheduling configurabile oltre il flush immediato a fine batch.","Mancano primitive avanzate per controllare scheduling e transazioni asincrone."]},rod:{description:"Layer reattivo di alto livello per binding DOM, model e interpolazioni.",entrypoints:["_.rod","JSswift.rodBind","JSswift.rodModel"],status:"milestone-2-closed",knownLimits:["Va chiarito meglio il rapporto con JSswift.reactive oltre al primo riallineamento strutturale.","Restano casi avanzati di model/binding da esplorare oltre al primo giro coperto dai test.","Il modulo e piu pulito internamente ma non e ancora il punto finale della convergenza con il renderer."]},mount:{description:"Mount, component instances e cleanup automatico del tree DOM.",entrypoints:["JSswift.mount","JSswift.component","JSswift.enableAutoCleanup"],status:"milestone-2-closed",knownLimits:["Il lifecycle e piu pulito internamente ma resta da chiarire meglio la semantica su multi-mount e cloni.","Restano da esplorare edge case avanzati del cleanup automatico fuori dal primo giro gia coperto."]},platform:{description:"Moduli applicativi nel core: overlay, store, auth, http, router, UI meta.",entrypoints:["JSswift.overlay","JSswift.store","JSswift.plugins.auth","JSswift.http","JSswift.router","JSswift.ui.meta"],status:"milestone-2-closed",knownLimits:["Il secondo giro ha ripulito i moduli interni, ma mancano ancora demo separate per modulo e una validazione piu formale di alcune superfici pubbliche.","Esiste una demo browser aggregata del blocco platform, ma non ancora demo separate per ogni modulo.","Mancano configurazione pubblica piu coerente e confini piu netti tra auth, http e router.","Il registry UI meta non ha ancora validazione formale del suo shape."]}}},i.omit=(e,t)=>{const n={},o=new Set(t||[]);for(const r in e||{})o.has(r)||(n[r]=e[r]);return n},i._cleanupRegistry=new WeakMap,i._registerCleanup=function(e,t){if(!e||typeof t!="function")return t;const n=i._cleanupRegistry.get(e)||[];return n.push(t),i._cleanupRegistry.set(e,n),t},i.dom={q(e,t=document){return t.querySelector(e)},qa(e,t=document){return Array.from(t.querySelectorAll(e))},attr(e,t,n){return e?n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.setAttribute(t,String(n)),e):null}},(()=>{let e=[],t=!1;function n(){if(t)return;t=!0;const o=e.slice();e.length=0;for(const r of o)try{r()}catch(c){console.error("[JSswift.ready] error:",c)}}i.ready=function(o){typeof o=="function"&&(t||document.readyState==="interactive"||document.readyState==="complete"?queueMicrotask(()=>{try{o()}catch(r){console.error("[JSswift.ready] error:",r)}}):e.push(o))},document.addEventListener("DOMContentLoaded",n,{once:!0})})(),i.reactive=(()=>{let e=null;const t=[],n=100;let o=0,r="sync",c="sync",s=!1;const a=new Set;function p(f){const y=f==null?void 0:f.flush;if(y==null||y==="sync")return"sync";if(y==="microtask")return"microtask";throw new Error("JSswift.reactive.batch: options.flush must be 'sync' or 'microtask'")}function u(){for(;a.size;){const f=Array.from(a);a.clear(),f.forEach(y=>y())}}function l(){s||(s=!0,queueMicrotask(()=>{s=!1,c="sync",u()}))}function d(f){const y=Array.from(f);if(o>0||c==="microtask"){y.forEach(k=>a.add(k)),o===0&&c==="microtask"&&l();return}y.forEach(k=>k())}function m(f){if(f&&(f._deps.size&&(f._deps.forEach(y=>y.delete(f._runner)),f._deps.clear()),typeof f._cleanup=="function")){const y=f._cleanup;f._cleanup=null;try{y()}catch(k){console.error("[JSswift.reactive.effect] cleanup error:",k)}}}function b(f){if(!(!f||!f.active)){m(f),t.push(f),e=f;try{const y=E=>{f._cleanup=typeof E=="function"?E:null},k=f.fn.length>0?f.fn(y):f.fn();typeof k=="function"&&(f._cleanup=k)}finally{t.pop(),e=t[t.length-1]||null}}}function w(f){if(typeof f!="function")return()=>{};const y={fn:f,active:!0,_deps:new Set,_cleanup:null,_runner:null,_running:!1,_queued:!1},k=()=>{if(!y.active)return;if(y._running){y._queued=!0;return}y._running=!0;let E=0;try{do if(y._queued=!1,b(y),E++,E>=n){y._queued=!1,console.warn("[JSswift.reactive.effect] loop guard triggered: too many synchronous reruns",{max:n,effect:f.name||"anonymous"});break}while(y.active&&y._queued)}finally{y._running=!1}};return y._runner=k,k(),()=>{y.active&&(y.active=!1,m(y))}}function T(f){let y=f;const k=new Set;function E(){return e&&e.active&&(k.add(e._runner),e._deps.add(k)),y}function P(U){y=U,d(k)}function D(){k.clear()}return[E,P,D]}function S(f){if(typeof f!="function")throw new Error("JSswift.reactive.computed: fn must be a function");const[y,k,E]=T(void 0),P=w(()=>{k(f())}),D=()=>y();return D.dispose=()=>{P(),E()},D.peek=()=>y(),D.type="computed",D}function A(f){if(typeof f!="function")throw new Error("JSswift.reactive.untracked: fn must be a function");const y=e;e=null;try{return f()}finally{e=y}}function h(f,y){if(typeof f!="function")throw new Error("JSswift.reactive.batch: fn must be a function");const k=p(y);o===0?r=k:k==="microtask"&&(r="microtask"),o+=1;try{return f()}finally{if(o-=1,o===0){const E=r==="microtask"||c==="microtask";r="sync",E?(c="microtask",l()):u()}}}return{signal:T,effect:w,computed:S,untracked:A,batch:h}})(),i._overlayShared=(()=>{const e=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function t(c,s){const a=c();if(a&&a.isConnected)return a;let p=document.getElementById("cms-overlay-root");return!p&&(document!=null&&document.body)&&(p=document.createElement("div"),p.id="cms-overlay-root",p.className="cms-overlay-root",document.body.appendChild(p)),!document.body&&!p&&i.ready(()=>{let u=document.getElementById("cms-overlay-root");u||(u=document.createElement("div"),u.id="cms-overlay-root",u.className="cms-overlay-root",document.body.appendChild(u)),s(u)}),s(p),p}function n(c){var a;const s=c.querySelector(e);(a=s==null?void 0:s.focus)==null||a.call(s)}function o(c,s){if(c.key!=="Tab")return;const a=Array.from(s.querySelectorAll(e)).filter(d=>d.offsetParent!==null);if(!a.length)return;const p=a[0],u=a[a.length-1],l=document.activeElement;c.shiftKey&&l===p?(c.preventDefault(),u.focus()):!c.shiftKey&&l===u&&(c.preventDefault(),p.focus())}function r(c,s){var Q,Z,ee,H,ne,Ge;if(!s.anchorEl)return;const a=s.anchorEl.getBoundingClientRect(),p=c.getBoundingClientRect(),u=window.visualViewport||null,l=Math.max(0,Number(u==null?void 0:u.offsetLeft)||0),d=Math.max(0,Number(u==null?void 0:u.offsetTop)||0),m=Math.max(Number(u==null?void 0:u.width)||0,window.innerWidth||0,((Q=document.documentElement)==null?void 0:Q.clientWidth)||0),b=Math.max(Number(u==null?void 0:u.height)||0,window.innerHeight||0,((Z=document.documentElement)==null?void 0:Z.clientHeight)||0),w=Number((H=(ee=s.viewportGutter)!=null?ee:s.gutter)!=null?H:8),T=Number.isFinite(w)?Math.max(0,w):8,S=Number((ne=s.offsetX)!=null?ne:0),A=Number((Ge=s.offsetY)!=null?Ge:8),h=Number.isFinite(S)?S:0,f=Number.isFinite(A)?A:8,y=(V,$,X)=>!Number.isFinite(V)||(Number.isFinite($)||($=0),Number.isFinite(X)||(X=$),X<$)?$:Math.min(Math.max(V,$),X),k=String(s.placement||"bottom-start").toLowerCase(),[E,P]=k.split("-"),D=["top","bottom","left","right"].includes(E)?E:"bottom",U=["start","end","center"].includes(P)?P:"start",R={top:"bottom",bottom:"top",left:"right",right:"left"}[D]||"top",L=D==="top"||D==="bottom",M=p.width,F=p.height,g=V=>{let $=a.left+h,X=a.top+f;return V==="top"||V==="bottom"?(U==="center"?$=a.left+(a.width-M)/2+h:U==="end"&&($=a.right-M+h),X=V==="top"?a.top-F-f:a.bottom+f):(U==="center"?X=a.top+(a.height-F)/2+f:U==="end"&&(X=a.bottom-F+f),$=V==="left"?a.left-M-h:a.right+h),{left:$,top:X}},v=V=>V==="top"?a.top-f-T:V==="bottom"?b-a.bottom-f-T:V==="left"?a.left-h-T:m-a.right-h-T,z=v(D),I=v(R),x=(L?F:M)>z&&I>z?R:D,C=g(x),N=l+T,O=d+T,B=Math.max(N,l+m-M-T),q=Math.max(O,d+b-F-T),W=y(C.left,N,B),j=y(C.top,O,q);c.style.position="fixed",c.style.left=`${W}px`,c.style.top=`${j}px`}return{ensureRoot:t,focusFirst:n,trapFocus:o,applyAnchoredPosition:r}})(),i.overlay=(()=>{let e=0;const t=new Map;let n=null;const{ensureRoot:o,focusFirst:r,trapFocus:c,applyAnchoredPosition:s}=i._overlayShared,a=()=>o(()=>n,S=>{n=S});let p=0;const u=()=>{p++,p===1&&document.documentElement.classList.add("cms-scroll-locked")},l=()=>{p=Math.max(0,p-1),p===0&&document.documentElement.classList.remove("cms-scroll-locked")},d=()=>{let S=null;for(const A of t.values())S=A;return S},m=S=>{var h;let A=S;for(;A&&A!==document;){if(A.nodeType===1&&((h=A.getAttribute)==null?void 0:h.call(A,"data-cms-overlay-portal"))==="true")return!0;A=A.parentNode}return!1},b=(S,A={})=>{var v,z,I,J;const h=`ov_${++e}`,f={id:h,opts:A,isOpen:!0,anchorEl:A.anchorEl||null,placement:A.placement||"bottom-start",onClose:typeof A.onClose=="function"?A.onClose:null,overlay:null,panel:null,backdrop:null,reposition:null,_positionCleanup:null,_positionFrame:null,_panelResizeObserver:null,_cleanup:null},y=document.createElement("div");y.className=["cms-overlay",A.type?`type-${A.type}`:""].filter(Boolean).join(" "),y.dataset.id=h;const k=document.createElement("div");k.className="cms-overlay-backdrop",A.backdrop||(k.style.display="none");const E=document.createElement("div");E.className=["cms-overlay-panel",A.className].filter(Boolean).join(" "),E.tabIndex=-1;const P=typeof S=="function"?S({close:()=>w(h)}):S,D=i.ui.slot(P);Array.isArray(D)?D.forEach(x=>x&&E.appendChild(x)):D&&E.appendChild(D),y.appendChild(k),y.appendChild(E);const U=a();if(!U)return{id:h,close:()=>w(h),panel:E,overlay:y};U.appendChild(y),f.overlay=y,f.panel=E,f.backdrop=k,t.set(h,f),A.lockScroll&&u(),A.autoFocus!==!1&&setTimeout(()=>{E.isConnected&&t.get(h)===f&&!E.contains(document.activeElement)&&r(E)},0);const R=(x=null)=>{x&&typeof x=="object"&&Object.assign(f.opts,x),s(E,f.opts)},L=()=>{if(!A.anchorEl)return;const x=globalThis.requestAnimationFrame||(C=>setTimeout(()=>C(Date.now()),0));f._positionFrame==null&&(f._positionFrame=x(()=>{f._positionFrame=null,R()}))};if(f.reposition=R,A.anchorEl){R(),L();const x=L;if(window.addEventListener("resize",x),window.addEventListener("scroll",x,!0),(z=(v=window.visualViewport)==null?void 0:v.addEventListener)==null||z.call(v,"resize",x),(J=(I=window.visualViewport)==null?void 0:I.addEventListener)==null||J.call(I,"scroll",x),typeof ResizeObserver=="function"){const C=new ResizeObserver(L);C.observe(E),f._panelResizeObserver=C}f._positionCleanup=()=>{var N,O,B,q,W,j;const C=globalThis.cancelAnimationFrame||clearTimeout;f._positionFrame!=null&&(C(f._positionFrame),f._positionFrame=null),(O=(N=f._panelResizeObserver)==null?void 0:N.disconnect)==null||O.call(N),f._panelResizeObserver=null,window.removeEventListener("resize",x),window.removeEventListener("scroll",x,!0),(q=(B=window.visualViewport)==null?void 0:B.removeEventListener)==null||q.call(B,"resize",x),(j=(W=window.visualViewport)==null?void 0:W.removeEventListener)==null||j.call(W,"scroll",x)}}const M=x=>{const C=d();!C||C.id!==h||A.closeOnOutside!==!1&&(m(x.target)||E.contains(x.target)||w(h))};document.addEventListener("mousedown",M,!0);const F=x=>{const C=d();!C||C.id!==h||(A.trapFocus&&c(x,E),x.key==="Escape"&&A.closeOnEsc!==!1&&(x.preventDefault(),w(h)))};document.addEventListener("keydown",F,!0),k.addEventListener("click",()=>{A.closeOnBackdrop!==!1&&w(h)}),f._cleanup=()=>{var x;document.removeEventListener("mousedown",M,!0),document.removeEventListener("keydown",F,!0),(x=f._positionCleanup)==null||x.call(f)};const g=1e3+t.size*10;return y.style.zIndex=String(g),{id:h,close:()=>w(h),panel:E,overlay:y,reposition:R}},w=S=>{var h,f,y;const A=t.get(S);A&&(t.delete(S),(h=A._cleanup)==null||h.call(A),A.opts.lockScroll&&l(),typeof Y=="function"&&Y(A.overlay),(f=A.overlay)==null||f.remove(),(y=A.onClose)==null||y.call(A))};return{open:b,close:w,closeTop:()=>{const S=d();S&&w(S.id)},root:n,_stack:t}})();function be(e,t={}){const{isSVG:n=!1,normalizeClass:o=h=>String(h!=null?h:""),isContentProp:r=()=>!1,autoValueTags:c=new Set(["INPUT","TEXTAREA","SELECT"])}=t;function s(h){if(n||!(h in e))return!1;try{return typeof e[h]=="boolean"}catch(f){return!1}}function a(h){return n||h.startsWith("data-")||h.startsWith("aria-")||!(h in e)}function p(h,f){if(f==null){e.removeAttribute(h);return}if(f===!1){if(h.startsWith("aria-")){e.setAttribute(h,"false");return}e.removeAttribute(h);return}if(f===!0&&!n&&!h.startsWith("aria-")&&!h.startsWith("data-")){e.setAttribute(h,"");return}e.setAttribute(h,String(f))}function u(h,f){if(h==null)return;const y=String(h),k=y.startsWith("--")||y.includes("-");if(f==null||f===!1||f===""){k?e.style.removeProperty(y):e.style[y]="";return}if(k){e.style.setProperty(y,String(f));return}e.style[y]=f}function l(h){const f=o(h);if(f==null||f===!1||f===""){e.removeAttribute("class");return}e.setAttribute("class",String(f))}function d(h,f){const y=!!f;e[h]=y,y?e.setAttribute(h,""):e.removeAttribute(h)}function m(h){if(r(h)){e[h]="";return}if(h==="class"){e.removeAttribute("class");return}if(h==="style"){e.removeAttribute("style");return}if(s(h)){try{e[h]=!1}catch(f){}e.removeAttribute(h);return}if(e.removeAttribute(h),!a(h))try{typeof e[h]=="string"&&(e[h]="")}catch(f){}}function b(h){!h||typeof h!="object"||Object.entries(h).forEach(([f,y])=>{u(f,y)})}function w(h,f){if(r(h)){e[h]=f!=null?f:"";return}if(h==="class"){l(f);return}if(h==="style"){if(f==null||f===!1){m(h);return}if(typeof f=="object"){b(f);return}}if(s(h)){d(h,f);return}if(f==null||f===!1){m(h);return}if(a(h)){p(h,f);return}e[h]=f}function T(h,f){const y=String(h).split(".");let k=e;for(let E=0;E<y.length-1;E++)if(k=k==null?void 0:k[y[E]],!k)return;k[y[y.length-1]]=f}function S(h){return h?h==="auto"||h.startsWith("attr:")||h.startsWith("@")||h.startsWith("style.")||h.includes("."):!1}function A(h,f){if(!h||h==="auto"){c.has(e.tagName)?w("value",f):e.textContent=f!=null?f:"";return}if(h.startsWith("attr:")){p(h.slice(5),f);return}if(h.startsWith("@")){p(h.slice(1),f);return}if(h.startsWith("style.")){u(h.slice(6),f);return}if(h.includes(".")){T(h,f);return}w(h,f)}return{isBooleanDomProp:s,isAttributeOnlyProp:a,isBindingValueKey:S,setAttributeValue:p,setStyleEntry:u,setClassValue:l,setBooleanProp:d,removeProp:m,applyStyleObject:b,setProp:w,setPathValue:T,applyBindingValue:A}}function ie(e){const t=[],n=o=>{if(!(o==null||o===!1)){if(typeof o=="function"){n(o());return}if(o&&o.type==="rod"){n(o.value);return}if(Array.isArray(o)){o.forEach(n);return}if(typeof o=="object"){Object.entries(o).forEach(([r,c])=>{let s=c;typeof s=="function"?s=s():s&&s.type==="rod"&&(s=s.value),n(s?r:null)});return}o!==!0&&String(o).split(/\s+/).forEach(r=>{r&&t.push(r)})}};return n(e),t.length?Array.from(new Set(t)).join(" "):""}function de(e){return e==null||e===!1?!1:typeof e=="function"||e&&e.type==="rod"?!0:Array.isArray(e)?e.some(de):typeof e=="object"?Object.values(e).some(de):!1}function we(e,t){return e==null||e===!1?!1:typeof e=="function"||t(e)?!0:typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Object.values(e).some(n=>we(n,t))}function Ke(e,t){let n=e;if(typeof n=="function"?n=n():t(n)&&(n=n.value),!n||typeof n!="object"||Array.isArray(n)||n.nodeType)return null;const o={};return Object.entries(n).forEach(([r,c])=>{let s=c;typeof s=="function"?s=s():t(s)&&(s=s.value),o[r]=s}),o}function Se(e){let t=new Set;function n(r){t.forEach(c=>{r.has(c)||e(c,null)}),t=r}function o(r,c){const s=Ke(r,c);if(!s){n(new Set);return}const a=new Set(Object.keys(s));n(a),Object.entries(s).forEach(([p,u])=>{e(p,u)})}return{apply:o}}function Qe(e){return typeof e=="string"&&(e.startsWith("on:")||e.startsWith("on")&&e.length>2)}const ve=128,te=[];function Xe(e,t){te.push({rod:e,value:String(t!=null?t:"")}),te.length>ve&&te.splice(0,te.length-ve)}function Ye(){if(!te.length)return null;const e=te.slice();return te.length=0,{items:e,index:0}}function pe(e,t){if(!t||!e||t.index>=t.items.length)return null;const n=[],o=String(e);let r=0,c=t.index,s=!1;for(;c<t.items.length;){const a=t.items[c],p=a.value;if(!p)break;const u=o.indexOf(p,r);if(u===-1)break;u>r&&n.push(o.slice(r,u)),n.push(a.rod),r=u+p.length,c++,s=!0}return s?(r<o.length&&n.push(o.slice(r)),t.index=c,n):null}function _e(e){var n;let t="";for(const o of e)typeof o=="string"?t+=o:t+=(n=o==null?void 0:o.value)!=null?n:"";return t}function Ze(e){if(e.startsWith("on:"))return e.slice(3);const t=e.slice(2);return t?t==="DoubleClick"?"dblclick":t.toLowerCase():""}function ce(e){return e==null||e===!1?!1:e===!0?{capture:!0}:typeof e=="boolean"?e:typeof e=="object"?{capture:!!e.capture,passive:!!e.passive,once:!!e.once}:!1}function et(e,t){const n=ce(e),o=ce(t);return typeof n=="boolean"||typeof o=="boolean"?n===o:!!n&&!!o&&n.capture===o.capture&&n.passive===o.passive&&n.once===o.once}function ae(e,t){return Array.isArray(e)?e.some(n=>ae(n,t)):t(e)?!0:!e||typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Array.isArray(e.handlers)?e.handlers.some(n=>ae(n,t))||t(e.options)||typeof e.options=="function":Array.isArray(e.listeners)?e.listeners.some(n=>ae(n,t))||t(e.options)||typeof e.options=="function":t(e.handler)||t(e.listener)||t(e.fn)||t(e.options)||typeof e.options=="function"}function ue(e,t,n){var o,r,c,s,a,p,u;if(e==null||e===!1)return[];if(typeof e=="function")return[{handler:e,options:ce(n!=null?n:!1)}];if(t(e))return ue(e.value,t,n);if(Array.isArray(e))return e.flatMap(l=>ue(l,t,n));if(typeof e=="object"&&!Array.isArray(e)&&!e.nodeType){if(Array.isArray(e.handlers)||Array.isArray(e.listeners)){const m=e.handlers||e.listeners||[],b=(r=(o=e.options)!=null?o:n)!=null?r:!1;return m.flatMap(w=>ue(w,t,b))}let l=(a=(s=(c=e.handler)!=null?c:e.listener)!=null?s:e.fn)!=null?a:null,d=(u=(p=e.options)!=null?p:n)!=null?u:!1;return t(l)&&(l=l.value),t(d)&&(d=d.value),typeof d=="function"&&(d=d()),typeof l=="function"?[{handler:l,options:ce(d)}]:[]}return[]}function tt(e,t){return ue(e,t)}function nt(e,t,n,o){const r=Ze(t);if(!r)return;const c={listeners:[]},s=()=>{c.listeners.forEach(p=>{e.removeEventListener(r,p.dispatch,p.options)}),c.listeners=[]},a=p=>{const u=tt(p,o);c.listeners.length===u.length&&c.listeners.every((d,m)=>{const b=u[m];return d.handler===b.handler&&et(d.options,b.options)})||(s(),u.forEach(d=>{const m={handler:d.handler,options:d.options,dispatch:null};m.dispatch=b=>{if(typeof m.handler=="function"){const w=m.handler.call(e,b);return m.options&&typeof m.options=="object"&&m.options.once&&(e.removeEventListener(r,m.dispatch,m.options),c.listeners=c.listeners.filter(T=>T!==m)),w}},e.addEventListener(r,m.dispatch,m.options),c.listeners.push(m)}))};if(i._registerCleanup(e,s),o(n)){const p=i.reactive.effect(()=>{a(n.value)});i._registerCleanup(e,p);return}if(ae(n,o)){const p=i.reactive.effect(()=>{a(n)});i._registerCleanup(e,p);return}a(n)}function rt(e,t={}){const{isRod:n=()=>!1,interpolationCursor:o=null}=t;function r(l){const d=document.createTextNode(""),m=i.rodBind(d,l);return i._registerCleanup(d,m),d}function c(l){e.appendChild(r(l))}function s(l){const d=document.createTextNode("");e.appendChild(d);const m=i.reactive.effect(()=>{d.textContent=_e(l)});i._registerCleanup(d,m)}function a(l){const d=[],m=b=>{if(!(b==null||b===!1)){if(Array.isArray(b)){b.forEach(m);return}if(typeof b=="string"){d.push(document.createTextNode(b));return}if(typeof b=="number"){d.push(document.createTextNode(String(b)));return}if(typeof b!="boolean"){if(n(b)){d.push(r(b));return}if(b!=null&&b.nodeType){d.push(b);return}d.push(document.createTextNode(String(b)))}}};return m(l),d}function p(l){const d=document.createComment("dyn");e.appendChild(d);let m=[];const b=i.reactive.effect(()=>{m.forEach(A=>{Y(A),A.parentNode&&A.parentNode.removeChild(A)}),m=[];const w=d.parentNode;if(!w)return;const T=a(l());if(!T.length)return;const S=document.createDocumentFragment();T.forEach(A=>S.appendChild(A)),w.insertBefore(S,d.nextSibling),m=T});i._registerCleanup(d,()=>{b(),m.forEach(w=>Y(w)),m=[]})}function u(l){if(l!=null){if(Array.isArray(l)){for(const d of l)u(d);return}if(typeof l=="string"){const d=pe(l,o);d?s(d):e.appendChild(document.createTextNode(l));return}if(typeof l=="number"){e.appendChild(document.createTextNode(String(l)));return}if(typeof l=="function"){p(l);return}if(n(l)){c(l);return}l.nodeType&&e.appendChild(l)}}return{appendRodText:c,appendInterpolatedText:s,appendDynamicChild:p,appendChildValue:u}}function ot(e,t={}){const{el:n,isRod:o=()=>!1,interpolationCursor:r=null,appendChildValue:c=()=>{},appendRodText:s=()=>{},appendInterpolatedText:a=()=>{},appendDynamicChild:p=()=>{},bindProp:u=()=>{}}=t;for(const l of e)if(l!=null){if(Array.isArray(l)){c(l);continue}if(typeof l=="string"){const d=pe(l,r);d?a(d):n.appendChild(document.createTextNode(l));continue}if(typeof l=="number"){n.appendChild(document.createTextNode(String(l)));continue}if(typeof l=="function"){p(l);continue}if(o(l)){s(l);continue}if(l.nodeType){n.appendChild(l);continue}if(typeof l=="object")for(const[d,m]of Object.entries(l)){if(typeof m=="string"){const b=pe(m,r);if(b){u(d,()=>_e(b));continue}}if(d==="class"){u(d,m);continue}if(d==="style"&&typeof m=="object"&&m!==null&&!o(m)){u(d,m);continue}u(d,m)}}}const Ae="http://www.w3.org/2000/svg",st=new Set(["svg","g","path","circle","ellipse","line","rect","polygon","polyline","text","tspan","defs","linearGradient","radialGradient","stop","use","symbol","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feBlend","feColorMatrix"]);function he(e){return e==="innerHTML"||e==="innerText"||e==="textContent"||e==="value"}function it(e,...t){const n=st.has(e),o=e==="text"&&!n?document.createTextNode(""):n?document.createElementNS(Ae,e):document.createElement(e),r=g=>!!g&&g.type==="rod",c=Ye(),s=rt(o,{isRod:r,interpolationCursor:c}),{appendRodText:a,appendInterpolatedText:p,appendDynamicChild:u,appendChildValue:l}=s,d=be(o,{isSVG:n,normalizeClass:ie,isContentProp:he}),{isBooleanDomProp:m,isBindingValueKey:b,applyBindingValue:w,setStyleEntry:T,setProp:S,setClassValue:A}=d;function h(g){const v=i.reactive.effect(g);return i._registerCleanup(o,v),v}function f(g){if(String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input")return!1;const v=String((g==null?void 0:g.type)||"").toLowerCase();return v==="range"||v==="number"}function y(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input"?"":String((g==null?void 0:g.type)||"").toLowerCase()}function k(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="select"&&!g.multiple}function E(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="input"&&String((g==null?void 0:g.type)||"").toLowerCase()==="file"}function P(g,v,z){h(()=>{var x;const J=(x=v.value)!=null?x:"";g.value!==String(J)&&S("value",J)});const I=()=>{let J=g.value;const x=y(g),C=typeof v.value=="number"||v.value==null;if(k(g)&&g.value==="")J=null;else if(f(g)&&C)if(x==="number"&&g.value==="")J=null;else{const N=typeof g.valueAsNumber=="number"&&!Number.isNaN(g.valueAsNumber)?g.valueAsNumber:Number(g.value);J=Number.isNaN(N)?x==="number"?null:0:N}v.value!==J&&(v.value=J)};g.addEventListener(z,I),i._registerCleanup(g,()=>{g.removeEventListener(z,I)})}function D(g,v){h(()=>{const I=!!v.value;!!g.checked!==I&&S("checked",I)});const z=()=>{const I=!!g.checked;v.value!==I&&(v.value=I)};g.addEventListener("change",z),i._registerCleanup(g,()=>{g.removeEventListener("change",z)})}function U(g,v){const z=()=>{var J;return String((J=g.value)!=null?J:"on")};h(()=>{const x=(v.value==null?null:String(v.value))===z();!!g.checked!==x&&S("checked",x)});const I=()=>{if(!g.checked)return;const J=z();v.value!==J&&(v.value=J)};g.addEventListener("change",I),i._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function R(g,v){const z=()=>{const J=g.files;return J==null?[]:Array.isArray(J)?J.slice():typeof J.length=="number"?Array.from(J):[J]};h(()=>{const J=v.value;(J==null||Array.isArray(J)&&J.length===0)&&(g.value!==""&&S("value",""),Array.isArray(g.files)&&(g.files=[]))});const I=()=>{const J=z();v.value=J};g.addEventListener("change",I),i._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function L(g,v){const z=()=>Array.from(g.childNodes||[]).filter(x=>(x==null?void 0:x.tagName)==="OPTION"&&x.selected).map(x=>{var C;return String((C=x.value)!=null?C:"")}),I=()=>{const x=Array.isArray(v.value)?v.value.map(N=>String(N)):[],C=new Set(x);Array.from(g.childNodes||[]).forEach(N=>{var B;if((N==null?void 0:N.tagName)!=="OPTION")return;const O=C.has(String((B=N.value)!=null?B:""));!!N.selected!==O&&(N.selected=O,O?N.setAttribute("selected",""):N.removeAttribute("selected"))})};h(I),g._cmsApplySelectedValues=I,queueMicrotask(I);const J=()=>{const x=z(),C=Array.isArray(v.value)?v.value.map(N=>String(N)):[];C.length===x.length&&C.every((N,O)=>N===x[O])||(v.value=x)};g.addEventListener("change",J),i._registerCleanup(g,()=>{g.removeEventListener("change",J)})}function M(g,v){h(()=>{const x=!!v.value;!!g.selected!==x&&S("selected",x)});let z=null;const I=()=>{const x=!!g.selected;v.value!==x&&(v.value=x)};queueMicrotask(()=>{var x;z||((x=g.parentNode)==null?void 0:x.tagName)!=="SELECT"||(z=g.parentNode,z.addEventListener("change",I))}),i._registerCleanup(g,()=>{z==null||z.removeEventListener("change",I)})}function F(g,v){if(Qe(g)){nt(o,g,v,r);return}if(g==="class"){if(de(v)){h(()=>{A(ie(v))});return}A(ie(v));return}if(g==="style"&&v&&typeof v=="object"){const z=Se(T);if(we(v,r)){h(()=>{z.apply(v,r)});return}z.apply(v,r);return}if(g==="style"&&(typeof v=="function"||r(v))){const z=Se(T);h(()=>{z.apply(v,r)});return}if(b(g)&&typeof v=="function"){h(()=>{w(g,v())});return}if(b(g)&&!r(v)){w(g,v);return}if(typeof v=="function"){h(()=>{S(g,v())});return}if(g==="value"&&r(v)&&(e==="input"||e==="textarea"||e==="select")){if(e==="select"&&o.multiple){L(o,v);return}P(o,v,e==="select"?"change":"input");return}if(g==="checked"&&r(v)&&e==="input"){if(String(o.type||"").toLowerCase()==="radio"){U(o,v);return}D(o,v);return}if(g==="files"&&r(v)&&E(o)){R(o,v);return}if(g==="selected"&&r(v)&&e==="option"){M(o,v);return}if(he(g)&&r(v)){h(()=>{S(g,v.value)});return}if(r(v)){const z=i.rodBind(o,v,{key:g});i._registerCleanup(o,z);return}S(g,v)}return ot(t,{el:o,isRod:r,interpolationCursor:c,appendChildValue:l,appendRodText:a,appendInterpolatedText:p,appendDynamicChild:u,bindProp:F}),e==="select"&&typeof o._cmsApplySelectedValues=="function"&&o._cmsApplySelectedValues(),o}const bt={},Ee=["html","head","title","base","link","meta","style","body","header","footer","main","section","article","aside","nav","h1","h2","h3","h4","h5","h6","p","div","span","pre","blockquote","hr","br","address","a","abbr","b","bdi","bdo","cite","code","data","dfn","em","i","kbd","mark","q","rp","rt","ruby","s","samp","small","strong","sub","sup","time","u","var","wbr","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","form","label","input","textarea","button","select","option","optgroup","fieldset","legend","datalist","output","progress","meter","img","picture","source","iframe","embed","object","param","audio","video","track","details","summary","dialog","script","noscript","canvas","template","slot","svg","g","path","circle","ellipse","line","rect","polygon","polyline","text","tspan","defs","linearGradient","radialGradient","stop","use","symbol","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feBlend","feColorMatrix"];Ee.forEach(e=>{window._[e]=(...t)=>it(e,...t)}),_.DOM_ELEMENTS=Ee,_.fragment=(...e)=>e,_.dynamic=function(e){const t=document.createComment("dyn"),n=document.createDocumentFragment();n.appendChild(t);let o=null;return i.reactive.effect(()=>{const r=e();if(o&&o.parentNode&&o.parentNode.removeChild(o),o=null,r==null)return;let c=r;(typeof r=="string"||typeof r=="number")&&(c=document.createTextNode(String(r)));const s=t.parentNode;s&&c&&c.nodeType&&(s.insertBefore(c,t.nextSibling),o=c)}),n};function ct(){let e=!1;const t=new Set;function n(){var r,c,s;e=!1,(r=i.debug)==null||r.inc("rodFlushes"),(c=i.perf)==null||c.inc("rodFlushes"),(s=i.perf)==null||s.mark("rod:flush");const o=Array.from(t);t.clear();for(const a of o)try{a()}catch(p){console.error("[rod] flush error:",p)}}return function(r){t.add(r),e||(e=!0,queueMicrotask(n))}}const at=ct();function Ce(e,t,n){if(!e)return;if(e.nodeType===3){e.textContent=n!=null?n:"";return}be(e,{isSVG:e.namespaceURI===Ae,normalizeClass:ie,isContentProp:he}).applyBindingValue(t,n)}function ut(e){return{type:"rod",value:e,_bindings:[],_actions:[],_disposeHooks:[],_disposed:!1,_silentDepth:0,_pending:!1,bindings(){return this._bindings.map(n=>({el:n.el,key:n.key}))},onDispose(n){return typeof n=="function"&&this._disposeHooks.push(n),this},_bind(n,o={key:"auto"}){var s;if(this._disposed)return()=>{};if(!n)return()=>{};const r={el:n,key:(s=o==null?void 0:o.key)!=null?s:"auto"};return this._bindings.some(a=>a.el===r.el&&a.key===r.key)||this._bindings.push(r),Ce(r.el,r.key,this.value),()=>{this._bindings=this._bindings.filter(a=>!(a.el===r.el&&a.key===r.key))}},action(n){return!this._disposed&&typeof n=="function"&&this._actions.push(n),this},_setSilent(n){this._silentDepth++;try{this.value=n}finally{this._silentDepth--}return this},_scheduleNotify(){this._disposed||this._pending||(this._pending=!0,at(()=>{this._pending=!1,this._notifyNow()}))},_notifyNow(){var o,r,c,s,a;if(this._disposed)return;const n=performance.now();(o=i.perf)==null||o.inc("rodNotifies"),this._bindings=this._bindings.filter(p=>{const u=p.el;return u?u.nodeType===3?!!u.parentNode:u.isConnected!==!1:!1});for(const p of this._bindings)Ce(p.el,p.key,this.value);if(!(this._silentDepth>0)){for(const p of this._actions)try{p(this.value)}catch(u){console.error("[rod] action error:",u)}(r=i.debug)==null||r.inc("rodNotifies"),(a=i.perf)==null||a.tick("rod:notify",performance.now()-n,{bindings:((c=this._bindings)==null?void 0:c.length)||0,actions:((s=this._actions)==null?void 0:s.length)||0})}},dispose(){if(!this._disposed){this._disposed=!0;for(const n of this._disposeHooks)try{n()}catch(o){console.error("[rod] dispose hook error:",o)}this._bindings.length=0,this._actions.length=0,this._disposeHooks.length=0}}}}function lt(e,t="value"){var s;let n=e[t],o=null,r=null,c=null;return(s=i==null?void 0:i.reactive)!=null&&s.signal&&([o,r,c]=i.reactive.signal(n),c&&typeof e.onDispose=="function"&&e.onDispose(c)),Object.defineProperty(e,t,{get(){return o?o():n},set(a){r?r(a):n=a,e._scheduleNotify()},configurable:!0}),typeof e.val!="function"&&Object.defineProperty(e,"val",{value(a){return arguments.length?(this.value=a,a):this.value},configurable:!0}),e[Symbol.toPrimitive]||Object.defineProperty(e,Symbol.toPrimitive,{value(a){const p=this.value;if(p==null)return p;const u=typeof p;return a==="number"?Number(p):(u!=="symbol"&&Xe(this,p),u==="string"||u==="number"||u==="boolean"||u==="bigint"||u==="symbol"?p:String(p))},configurable:!0}),e.valueOf||Object.defineProperty(e,"valueOf",{value(){return this.value},configurable:!0}),e.toString||Object.defineProperty(e,"toString",{value(){return String(this.value)},configurable:!0}),e}_.rod=function(t,n="value"){const o=ut(t);return lt(o,n),i.rod._all=i.rod._all||new Set,i.rod._all.add(o),typeof o.onDispose=="function"&&o.onDispose(()=>i.rod._all.delete(o)),o},i.rodBind=function(e,t,n={key:"auto"}){var o,r,c;if((o=i.debug)==null||o.inc("rodBinds"),!e)return(r=i.debug)==null||r.inc("rodBindNull"),(c=i.debug)==null||c.warn("rodBind: target element \xE8 null/undefined",n),()=>{};if(!t||t.type!=="rod")throw new Error("JSswift.rodBind: react must be a rod object");return t._bind(e,n)},i.rodFromSignal=function(e,t){const n=_.rod(e());let o=!1;const r=i.reactive.effect(()=>{const s=n.value,a=i.reactive.untracked(()=>e());if(!o&&a!==s){o=!0;try{t(s)}finally{o=!1}}}),c=i.reactive.effect(()=>{const s=e();if(i.reactive.untracked(()=>n.value)!==s){o=!0;try{n._setSilent(s)}finally{o=!1}}});return typeof n.onDispose=="function"&&(n.onDispose(r),n.onDispose(c)),n};function ke(e){if(!e||!e.tagName)return null;const t=e.tagName.toLowerCase();if(t==="input"){const n=(e.type||"text").toLowerCase();return n==="checkbox"?"checkbox":n==="radio"?"radio":n==="number"?"number":"text"}return t==="select"?e.multiple?"select-multiple":"select":null}i.rodModel=function(e,t,n={}){var b,w,T;if(!t||t.type!=="rod")throw new Error("[JSswift.rodModel] rodObj deve essere un rod");const o=Array.isArray(e)||e instanceof NodeList?Array.from(e):[e],r=(b=n.event)!=null?b:"change",c=(w=n.parse)!=null?w:(S=>S),s=(T=n.format)!=null?T:(S=>S);let a=!1;const p=[],u=S=>{for(const A of o){if(!A)continue;switch(ke(A)){case"checkbox":A.checked=!!S;break;case"radio":A.checked=A.value==S;break;case"select":A.value=S!=null?S:"";break;case"select-multiple":const f=Array.isArray(S)?S.map(String):[];for(const y of A.options)y.selected=f.includes(y.value);break;default:A.value=S!=null?S:""}}},l=S=>{if(!a){a=!0;try{u(s(S))}finally{a=!1}}};t.action(l),u(s(t.value));for(const S of o){if(!S)continue;const A=ke(S),h=()=>{if(a)return;let f;switch(A){case"checkbox":f=S.checked;break;case"radio":if(!S.checked)return;f=S.value;break;case"select":f=S.value;break;case"select-multiple":f=Array.from(S.selectedOptions).map(y=>y.value);break;case"number":f=c(S.value===""?null:Number(S.value));break;default:f=c(S.value)}a=!0;try{t.value!==f&&(t.value=f)}finally{a=!1}};S.addEventListener(r,h),p.push(()=>S.removeEventListener(r,h))}let d=!1;const m=()=>{var h,f,y,k;if(d)return;d=!0,p.splice(0).forEach(E=>E());const S=(f=(h=t._actions)==null?void 0:h.indexOf(l))!=null?f:-1;S>=0&&t._actions.splice(S,1);const A=(k=(y=t._disposeHooks)==null?void 0:y.indexOf(m))!=null?k:-1;A>=0&&!t._disposed&&t._disposeHooks.splice(A,1)};return typeof t.onDispose=="function"&&t.onDispose(m),m},i.signalModel=function(e,t,n,o={}){const r=i.rodFromSignal(t,n),c=i.rodModel(e,r,o);return()=>{c(),r.dispose()}};function Y(e){if(!e)return;const t=i._cleanupRegistry.get(e);if(t){for(const n of t)try{n()}catch(o){console.error("[cleanup] error:",o)}i._cleanupRegistry.delete(e)}if(e.childNodes&&e.childNodes.length)for(const n of e.childNodes)Y(n)}function ft(e){const t=n=>typeof n=="string"?i.dom.q(n):n;return Array.isArray(e)?e.map(t).filter(Boolean):[t(e)].filter(Boolean)}function dt(e){const t=[],n=[],o=r=>{if(r!=null){if(typeof r=="function"){o(r());return}if(r&&typeof r=="object"&&"node"in r){typeof r.dispose=="function"&&n.push(r.dispose),o(r.node);return}if(Array.isArray(r)){for(const c of r)o(c);return}if(typeof r=="string"||typeof r=="number"){t.push(document.createTextNode(String(r)));return}if(r.nodeType){t.push(r);return}console.warn("[JSswift.mount] contenuto non supportato:",r)}};return o(e),{nodes:t,disposers:n}}function Te(e=[],t="[JSswift.mount] dispose error:"){let n=!1;return()=>{if(!n){n=!0;for(const o of e)try{o()}catch(r){console.error(t,r)}}}}function xe(e=[],t=null){return Te([...t?[t]:[],...e],"[component] dispose error:")}i.mount=function(e,t,n={}){var p;const o=ft(e),r=(p=n.clear)!=null?p:!0,c=o.length>1;if(o.length===0)return console.warn("[JSswift.mount] nessun target valido:",e),()=>{};const s=[];for(const u of o){if(r)for(;u.firstChild;)Y(u.firstChild),u.removeChild(u.firstChild);const{nodes:l,disposers:d}=dt(t);let m=l;c&&typeof t!="function"&&(m=l.map(w=>w.cloneNode(!0)),d.length&&console.warn("[JSswift.mount] multi-target con dispose: usa content come function per istanze separate."));const b=Te(d);for(const w of m)u.appendChild(w);s.push({root:u,nodes:m,dispose:b});for(const w of m)!w||!w.nodeType||i._registerCleanup(w,b)}return()=>{var u;for(const l of s){for(const d of l.nodes)d&&(Y(d),d.parentNode===l.root&&l.root.removeChild(d));(u=l.dispose)==null||u.call(l)}}},i.component=function(e){if(typeof e!="function")throw new Error("JSswift.component: renderFn must be a function");return function(n={}){const o=[],c=e(n,{onDispose(s){typeof s=="function"&&o.push(s)}});return c&&typeof c=="object"&&"node"in c?{node:c.node,dispose:xe(o,typeof c.dispose=="function"?c.dispose:null)}:{node:c,dispose:xe(o)}}},i.enableAutoCleanup=function(){if(i._autoCleanupEnabled)return;i._autoCleanupEnabled=!0;const e=new MutationObserver(t=>{for(const n of t)for(const o of n.removedNodes)Y(o)});e.observe(document.body,{childList:!0,subtree:!0}),i._cleanupObserver=e},i.debug=(()=>{const e={rodFlushes:0,rodNotifies:0,rodBinds:0,rodBindNull:0,rodBindDup:0};function t(){return!!i.config.debug}function n(...p){t()&&console.log("[JSswift]",...p)}function o(...p){t()&&console.warn("[JSswift]",...p)}function r(...p){console.error("[JSswift]",...p)}function c(p,u=1){e[p]||(e[p]=0),e[p]+=u}function s(){return{...e}}function a(){for(const p of Object.keys(e))e[p]=0}return{enabled:t,log:n,warn:o,error:r,inc:c,stats:s,reset:a}})(),i.perf=(()=>{let e=!1;const t={effectsRun:0,effectsSlow:0,rodNotifies:0,rodFlushes:0,domWrites:0,httpRequests:0},n=[],o=[],r={timelineMax:200,slowEffectMs:8};function c(){return typeof performance!="undefined"&&performance.now?performance.now():Date.now()}function s(y,k=0,E=null){e&&(n.push({t:Date.now(),type:y,ms:k,meta:E}),n.length>r.timelineMax&&n.shift())}function a(y,k=1){e&&(t[y]=(t[y]||0)+k)}function p(y,k){e&&(o.push({t:Date.now(),ms:y,meta:k}),o.length>100&&o.shift())}let u=null;function l(){u||(u=i.reactive.effect,i.reactive.effect=function(y,k){return u((...P)=>{const D=c();a("effectsRun");try{return y(...P)}finally{const U=c()-D;U>=r.slowEffectMs?(a("effectsSlow"),p(U,k||y.name||"effect"),s("effect:slow",U,k||y.name||null)):s("effect",U,k||y.name||null)}})})}function d(){u&&(i.reactive.effect=u,u=null)}function m(y=!0){return e=!!y,e?l():d(),e}function b(){for(const y of Object.keys(t))t[y]=0;n.length=0,o.length=0}function w(){return{enabled:e,...t,slowEffectMs:r.slowEffectMs,timelineSize:n.length}}function T(){return n.slice()}function S(y=r.slowEffectMs){return o.filter(k=>k.ms>=y).slice().sort((k,E)=>E.ms-k.ms)}function A(y,k){const E=c();try{return k()}finally{const P=c()-E;s("time:"+y,P,y)}}function h(y,k){s(y,0,k)}function f(y,k,E){s(y,k,E)}return{enable:m,reset:b,stats:w,timeline:T,slowEffects:S,time:A,mark:h,tick:f,inc:a,cfg:r}})(),i.rod=i.rod||{},i.rod.inspect=function(e,t="rod"){if(!e||e.type!=="rod")return console.warn("[JSswift.rod.inspect] non \xE8 un rod:",e),null;const n=typeof e.bindings=="function"?e.bindings():[],o={label:t,value:e.value,bindingsCount:n.length,bindings:n.map(r=>{var c,s,a,p,u,l,d;return{key:r.key,el:((c=r.el)==null?void 0:c.nodeType)===3?"#text":(s=r.el)==null?void 0:s.tagName,id:((a=r.el)==null?void 0:a.id)||null,className:((p=r.el)==null?void 0:p.className)||null,isConnected:((u=r.el)==null?void 0:u.nodeType)===3?!!r.el.parentNode:(d=(l=r.el)==null?void 0:l.isConnected)!=null?d:null}}),actionsCount:Array.isArray(e._actions)?e._actions.length:null,disposed:!!e._disposed};return i.config.debug?(console.groupCollapsed(`[JSswift.rod.inspect] ${t}`),console.log(o),console.groupEnd()):console.log(o),o},i.rod.inspectAll=function(){const e=i.rod._all?Array.from(i.rod._all):[];return e.forEach((t,n)=>i.rod.inspect(t,`rod#${n+1}`)),e.length},i._storeShared=(()=>{function e(c){return`${c.storage}::${c.prefix}`}function t(c,s){function a(d={}){var b,w;const m={storage:(b=d.storage)!=null?b:c.storage,prefix:(w=d.prefix)!=null?w:c.prefix};return s.set(e(m),m),m}function p(d=null){var b;return(typeof d=="string"?d:(b=d==null?void 0:d.storage)!=null?b:c.storage)==="session"?window.sessionStorage:window.localStorage}function u(d,m=null){return(m||a()).prefix+d}function l(d,m=null){const b=m||a();return`${e(b)}::${d}`}return{getScope:a,getStorage:p,fullKey:u,channelKey:l}}function n(c){try{return JSON.parse(c)}catch(s){return}}function o(c){try{return JSON.stringify(c)}catch(s){return}}function r(c,...s){const a=`${c.storage}::${c.prefix}::`;for(const p of s)for(const u of Array.from(p.keys()))u.startsWith(a)&&p.delete(u)}return{createScopeTools:t,safeParse:n,safeStringify:o,clearScopedMapEntries:r}})(),i.store=(()=>{const e={prefix:"JSswift:",storage:"local",syncTabs:!0,writeDelay:0},t=new Map,n=new Map,o=new Map,r=new Map;let c=!1;const{createScopeTools:s,safeParse:a,safeStringify:p,clearScopedMapEntries:u}=i._storeShared,{getScope:l,getStorage:d,fullKey:m,channelKey:b}=s(e,r);function w(R,L,M=null){var v;const F=M||l(),g=n.get(b(R,F));if(g)for(const z of g)try{(v=i.reactive)!=null&&v.untracked?i.reactive.untracked(()=>z(L)):z(L)}catch(I){console.error("[store] watcher error:",I)}}function T(){c=!1;for(const[R,L]of Array.from(o.entries())){o.delete(R);const M=t.get(R),F=p(M);if(F===void 0)continue;const g=d(L.scope);try{g.setItem(m(L.key,L.scope),F)}catch(v){console.error("[store] write error:",v)}}}function S(R,L=null){const M=L||l();o.set(b(R,M),{key:R,scope:M}),!c&&(c=!0,e.writeDelay>0?setTimeout(T,e.writeDelay):queueMicrotask(T))}function A(R,L=null){const M=L||l(),g=d(M).getItem(m(R,M));if(g!=null)return a(g)}function h(R,L,M=null){const F=M||l(),g=b(R,F);if(t.has(g))return t.get(g);const v=A(R,F);return v!==void 0?(t.set(g,v),v):L}function f(R,L,M=null){const F=M||l();return t.set(b(R,F),L),S(R,F),w(R,L,F),L}function y(R,L=null){const M=L||l(),F=b(R,M);t.delete(F),o.delete(F);try{d(M).removeItem(m(R,M))}catch(g){}w(R,void 0,M)}function k(R={}){const L=l(R),M=d(L),F=[];for(let g=0;g<M.length;g++){const v=M.key(g);v&&v.startsWith(L.prefix)&&F.push(v)}for(const g of F)M.removeItem(g);u(L,t,o,n)}function E(R,L,M=null){if(typeof L!="function")return()=>{};const F=M||l(),g=b(R,F);return n.has(g)||n.set(g,new Set),n.get(g).add(L),()=>{var v;return(v=n.get(g))==null?void 0:v.delete(L)}}function P(R,L,M={}){const F=l({storage:M.storage,prefix:M.prefix}),g=h(R,L,F),[v,z,I]=i.reactive.signal(g),J=i.reactive.effect(()=>{const N=v();f(R,N,F)}),x=E(R,N=>{v()!==N&&z(N)},F);return[v,z,()=>{try{J==null||J()}catch(N){}try{x==null||x()}catch(N){}try{I==null||I()}catch(N){}}]}l(),e.syncTabs&&window.addEventListener("storage",R=>{if(!(!R.key||!R.storageArea))for(const L of r.values()){if(d(L)!==R.storageArea||!R.key.startsWith(L.prefix))continue;const M=R.key.slice(L.prefix.length),F=R.newValue==null?void 0:a(R.newValue),g=b(M,L);F===void 0?t.delete(g):t.set(g,F),w(M,F,L)}});function D(R={}){Object.assign(e,R),l()}function U(){return{prefix:e.prefix,storage:e.storage,syncTabs:e.syncTabs,cacheSize:t.size,scopeCount:r.size}}return{configure:D,stats:U,get:h,set:f,remove:y,clear:k,watch:E,signal:P}})(),i.store.computed=function(e){if(typeof e!="function")throw new Error("store.computed: fn must be a function");return i.reactive.computed(e)},i.store.migrate=function(e,t,n={}){var a,p;const o=(a=n.versionKey)!=null?a:"__version",r=Number((p=i.store.get(o,0))!=null?p:0),c=Number(e!=null?e:0);if(!Number.isFinite(c)||c<0)throw new Error("store.migrate: targetVersion non valido");if(r>=c)return{from:r,to:c,applied:0};let s=0;for(let u=r;u<c;u++){const l=t==null?void 0:t[u];if(typeof l=="function")try{l(i.store)}catch(d){console.error("[store.migrate] step error at version",u,d)}s++,i.store.set(o,u+1)}return{from:r,to:c,applied:s}},i.store.model=function(e,t,n,o={}){if(typeof t!="string"||!t)throw new Error("store.model: key deve essere una stringa non vuota");const[r,c,s]=i.store.signal(t,n,{storage:o.storage,prefix:o.prefix}),a=i.rodFromSignal(r,c),p=i.rodModel(e,a,{event:o.event,parse:o.parse,format:o.format});return()=>{var u;try{p==null||p()}catch(l){}try{s==null||s()}catch(l){}try{(u=a.dispose)==null||u.call(a)}catch(l){}}},i.store.bind=function(e,t,n,o={}){var c;let r=e;return typeof e=="string"&&(e.includes("[")||e.includes(" ")?r=document.querySelectorAll(e):r=i.dom.q(e)),r?i.store.model(r,t,n,o):((c=i.config)!=null&&c.debug&&console.warn("[store.bind] target non trovato:",e),()=>{})},i.store.bindAll=function(e,t={},n={}){if(typeof e=="string"&&(e=i.dom.q(e)),!e||!e.querySelectorAll)return console.warn("[store.bindAll] form non valido:",e),()=>{};const o=[];for(const[r,c]of Object.entries(t)){const s=e.querySelectorAll(`[name="${r}"]`);if(!s.length)continue;const a=i.store.model(s.length===1?s[0]:s,r,c,n);o.push(a)}return()=>o.forEach(r=>r())},i.store.inspect=function(){const e={...i.store.stats(),keys:Array.from((function(){const t=i.store.stats().storage==="session"?sessionStorage:localStorage,n=[];for(let o=0;o<t.length;o++){const r=t.key(o);r&&r.startsWith(i.store.stats().prefix)&&n.push(r.replace(i.store.stats().prefix,""))}return n})())};return console.groupCollapsed("[JSswift.store.inspect]"),console.table(e.keys),console.log(e),console.groupEnd(),e},i.store.autoForm=function(e,t={},n={}){var r;const o=i.store.bindAll(e,t,n);return(r=i.config)!=null&&r.debug&&console.log("[store.autoForm] autosave attivo:",t),o},i.useStore=function(e,t,n,o={}){const[r,c,s]=i.store.signal(e,t,o);return n&&typeof n.onDispose=="function"&&typeof s=="function"&&n.onDispose(s),[r,c]},i._plugins=new Set,i.usePlugin=function(e,t){var n;if(e){if(i._plugins.has(e)){(n=i.config)!=null&&n.debug&&console.warn("[JSswift.usePlugin] plugin gi\xE0 installato:",e.name||e);return}if(typeof e=="function"){e(i,t),i._plugins.add(e);return}if(e&&typeof e.install=="function"){e.install(i,t),i._plugins.add(e);return}console.warn("[JSswift.usePlugin] plugin non valido:",e)}},i.plugins=i.plugins||{},i.plugins.debug={install(e){e.config.debug=!0,console.log("[JSswift] Debug mode ON")}},i.plugins.forms={install(e){const t={};e.forms={validate(n,o={},r={}){var l,d;if(typeof n=="string"&&(n=e.dom.q(n)),!n||!n.querySelectorAll)return console.warn("[forms.validate] form non valido:",n),null;const c={mode:r.mode||"input",showMessages:(l=r.showMessages)!=null?l:!0,submitGuard:(d=r.submitGuard)!=null?d:!0,errorClass:r.errorClass||"is-invalid",validClass:r.validClass||"is-valid",messageClass:r.messageClass||"form-error"},s={};for(const[m,b]of Object.entries(o)){const w=n.querySelectorAll(`[name="${m}"]`);if(!w.length)continue;const[T,S]=e.reactive.signal(null);s[m]={getErr:T,setErr:S,els:w};let A=null;c.showMessages&&(A=document.createElement("div"),A.className=c.messageClass,w[w.length-1].after(A));const h=()=>{let f;const y=w[0];if(y.type==="checkbox")f=y.checked;else if(y.type==="radio"){const P=Array.from(w).find(D=>D.checked);f=P?P.value:null}else f=y.value;let k=!0;try{k=b(f)}catch(P){k=P.message||"Errore di validazione"}const E=k===!0?null:typeof k=="string"?k:"Valore non valido";return S(E),!E};for(const f of w)f.addEventListener(c.mode,h);e.reactive.effect(()=>{const f=T();for(const y of w)y.classList.toggle(c.errorClass,!!f),y.classList.toggle(c.validClass,!f);A&&(A.textContent=f||"",A.style.display=f?"block":"none")}),h()}const a=e.store.computed(()=>Object.values(s).every(m=>!m.getErr())),p=m=>{let b=!0;for(const w of Object.values(s)){const T=w.els[0];T&&T.dispatchEvent(new Event(c.mode,{bubbles:!0})),w.getErr()&&(b=!1)}!b&&c.submitGuard&&(m.preventDefault(),m.stopPropagation())};c.submitGuard&&n.addEventListener("submit",p);const u=()=>{c.submitGuard&&n.removeEventListener("submit",p)};return t[n]={isValid:a,dispose:u},{isValid:a,dispose:u}}}}},i._authShared=(()=>{function e(o){const r=()=>{var s;return((s=o())==null?void 0:s.roles)||[]},c=()=>{var s;return((s=o())==null?void 0:s.permissions)||[]};return{roles:r,perms:c,hasRole:s=>r().includes(s),can:s=>c().includes(s),canAny:s=>s.some(a=>r().includes(a)||c().includes(a)),canAll:s=>s.every(a=>r().includes(a)||c().includes(a))}}function t(o,r){return r.some(c=>typeof c=="string"?o.startsWith(c):c instanceof RegExp?c.test(o):!1)}function n(o,r){if(!o||!r)return;let c=!1;function s(){return Date.now()}function a(m){if(!m||typeof m!="string")return null;const b=m.split(".");if(b.length<2)return null;try{const w=b[1].replace(/-/g,"+").replace(/_/g,"/"),T=decodeURIComponent(atob(w).split("").map(S=>"%"+S.charCodeAt(0).toString(16).padStart(2,"0")).join(""));return JSON.parse(T)}catch(w){return null}}function p(){var m,b,w,T;if(typeof r._getState=="function"){const S=r._getState();return S&&typeof S=="object"?S:{user:(b=(m=r.user)==null?void 0:m.call(r))!=null?b:null}}return{user:(T=(w=r.user)==null?void 0:w.call(r))!=null?T:null}}function u(){var h,f,y;const m=p()||{},b=(f=m.user)!=null?f:(h=r.user)==null?void 0:h.call(r),w=(b==null?void 0:b.name)||(b==null?void 0:b.email)||(b==null?void 0:b.id)||"anon",T=!!((y=r.isAuth)!=null&&y.call(r)),S=m.expiresAt||null,A=S?S-s():null;return T?`AUTH \u2705 user=${w}${S?` expiresIn=${Math.round(A/1e3)}s`:""}`:`AUTH \u274C user=${w}`}function l(m="auth"){var D,U,R;const b=p()||{},w=(U=b.user)!=null?U:(D=r.user)==null?void 0:D.call(r),T=(w==null?void 0:w.roles)||[],S=(w==null?void 0:w.permissions)||[],A=b.accessToken||null,h=b.refreshToken||null,f=A?a(A):null,y=b.expiresAt||(f!=null&&f.exp?f.exp*1e3:null),k=s(),E=y?y-k:null,P={label:m,isAuth:!!((R=r.isAuth)!=null&&R.call(r)),user:w,roles:T,permissions:S,has:{role:L=>{var M;return!!((M=r.hasRole)!=null&&M.call(r,L))},can:L=>{var M;return!!((M=r.can)!=null&&M.call(r,L))}},token:{hasAccess:!!A,hasRefresh:!!h,expiresAt:y,expiresInSec:E==null?null:Math.round(E/1e3),decodedJWT:f}};return console.groupCollapsed(`[JSswift.auth.inspect] ${m}`),console.log("status:",u()),console.log(P),E!=null&&(E<=0?console.warn("\u26A0\uFE0F Access token scaduto."):E<6e4&&console.warn("\u26A0\uFE0F Access token in scadenza (<60s).")),console.groupEnd(),P}function d(m=!0){c=!!m,console.log("[JSswift.auth.trace]",c?"ON":"OFF")}if(typeof r.fetch=="function"&&!r._fetchWrapped){const m=r.fetch.bind(r);r.fetch=async(...b)=>{const w=await m(...b);if(c)try{console.log("[auth.fetch]",w.status,b[0])}catch(T){}return w},r._fetchWrapped=!0}r.decodeJWT=a,r.status=u,r.inspect=l,r.trace=d}return{createPermissionApi:e,matchesProtectedPath:t,attachDevTools:n}})(),i.plugins.auth={install(e,t={}){var k;const{createPermissionApi:n,matchesProtectedPath:o,attachDevTools:r}=i._authShared,c={key:t.key||"auth",loginRoute:t.loginRoute||"/login",protected:t.protected||[],autoRedirect:(k=t.autoRedirect)!=null?k:!0,endpoints:t.endpoints||{login:"/api/login",refresh:"/api/refresh",logout:"/api/logout"},fetchOptions:t.fetchOptions||{},tokenHeader:t.tokenHeader||"Authorization",tokenPrefix:t.tokenPrefix||"Bearer ",refreshMargin:t.refreshMargin||3e4},[s,a]=e.store.signal(c.key,null),p=()=>{var E;return((E=s())==null?void 0:E.user)||null},u=()=>{var E;return!!((E=s())!=null&&E.accessToken)},{hasRole:l,can:d,canAny:m,canAll:b}=n(p);let w=!1,T=[];function S(){const E=s();return E!=null&&E.expiresAt?Date.now()>E.expiresAt-c.refreshMargin:!1}async function A(){var E;if(w)return new Promise((P,D)=>T.push({res:P,rej:D}));w=!0;try{const P=await fetch(c.endpoints.refresh,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:(E=s())==null?void 0:E.refreshToken})});if(!P.ok)throw new Error("Refresh failed");const D=await P.json();return a({...s(),...D}),T.forEach(U=>U.res(!0)),T=[],!0}catch(P){throw T.forEach(D=>D.rej(P)),T=[],a(null),c.autoRedirect&&e.router.navigate(c.loginRoute),P}finally{w=!1}}async function h(E){const P=await fetch(c.endpoints.login,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)});if(!P.ok)throw new Error("Login failed");const D=await P.json();return a(D),D}async function f(){try{await fetch(c.endpoints.logout,{method:"POST"})}catch(E){}a(null),c.autoRedirect&&e.router.navigate(c.loginRoute)}async function y(E,P={}){var L;S()&&await A();const D=s(),U=new Headers(P.headers||{});D!=null&&D.accessToken&&U.set(c.tokenHeader,c.tokenPrefix+D.accessToken);const R=await fetch(E,{...c.fetchOptions,...P,headers:U});return R.status===401&&((L=s())!=null&&L.refreshToken)&&!P._authRetried?(await A(),y(E,{...P,_authRetried:!0})):R}e.router.beforeEach(E=>{const P=E.path;return o(P,c.protected)&&!u()?c.loginRoute:!0}),e.auth={user:p,isAuth:u,hasRole:l,can:d,canAny:m,canAll:b,loginAsync:h,logoutAsync:f,fetch:y,_getState:s},e.useAuth=function(E){return E&&E.onDispose,e.auth},r(i,e.auth)}},i._httpShared=(()=>{function e(u){var F;const l=u.reactive,[d,m]=l.signal(0),[b,w]=l.signal("idle"),[T,S]=l.signal(null),[A,h]=l.signal(null),[f,y]=l.signal(null),[k,E]=l.signal(0),[P,D]=l.signal(0);let U=0;function R(g){const v=++U,z=Date.now();return m(d()+1),w("pending"),y(null),h(null),S({id:v,url:g.url,method:g.method,meta:g.meta,timeout:g.timeout,retry:g.retry,startedAt:z}),D(z),v}function L(g,v,z,I){const J=Date.now();m(Math.max(0,d()-1)),g===U&&(z?(w("error"),y(z),h(null)):v?(w("success"),y(null),h({id:g,status:v.status,ok:v.ok,headers:v.headers,url:v.url,receivedAt:J,raw:v})):(w("idle"),y(null),h(null)),E(Math.max(0,Number(I||0)))),D(J)}return{state:{inFlight:d,status:b,isLoading:(F=u.store)!=null&&F.computed?u.store.computed(()=>d()>0):()=>d()>0,lastRequest:T,lastResponse:A,lastError:f,lastDuration:k,lastUpdated:P,reset(){m(0),w("idle"),S(null),h(null),y(null),E(0),D(Date.now())}},markStart:R,markEnd:L}}function t(u,l){if(!u||/^https?:\/\//i.test(l))return l;const d=u.endsWith("/")?u.slice(0,-1):u,m=l.startsWith("/")?l:"/"+l;return d+m}function n(u){return new Promise(l=>setTimeout(l,u))}function o(u,l){return u?!0:l?l.status===429||l.status>=500&&l.status<=599:!1}function r(u,l){if(!u&&!l)return{signal:void 0,cancel:()=>{}};const d=new AbortController,m=d.signal;let b=null;u>0&&(b=setTimeout(()=>d.abort(new Error("timeout")),u));const w=()=>d.abort(l.reason||new Error("aborted"));return l&&(l.aborted?w():l.addEventListener("abort",w,{once:!0})),{signal:m,cancel:()=>{var S;b&&clearTimeout(b),l&&((S=l.removeEventListener)==null||S.call(l,"abort",w))}}}function c(u,l,d={}){var T,S,A;const m=typeof l=="string"?t(u.baseURL,l):l,b=(d.method||"GET").toUpperCase(),w=new Headers(u.headers);return d.headers&&new Headers(d.headers).forEach((h,f)=>w.set(f,h)),{url:m,method:b,headers:w,body:d.body,credentials:(T=d.credentials)!=null?T:u.credentials,signal:d.signal,timeout:(S=d.timeout)!=null?S:u.timeout,retry:(A=d.retry)!=null?A:u.retry,meta:d.meta||{}}}async function s(u,...l){var m;let d=l[0];for(const b of u)d=(m=await b(d,...l.slice(1)))!=null?m:d;return d}function a(u,l){return{ok:u.ok,status:u.status,headers:u.headers,raw:u,req:l,async json(){let d=null,m=null;try{d=await u.json()}catch(b){d=null}return u.ok||(m=d!=null?d:{status:u.status}),{data:d,error:m,ok:u.ok,status:u.status}},async jsonStrict(){const{data:d,error:m}=await this.json();if(m){const b=new Error(`HTTP error ${u.status} ${(l==null?void 0:l.method)||""} ${(l==null?void 0:l.url)||""}`.trim());throw b.status=u.status,b.data=d,b.req={url:l==null?void 0:l.url,method:l==null?void 0:l.method,meta:l==null?void 0:l.meta},b}return{data:d,ok:!0,status:u.status}},async text(){let d="";try{d=await u.text()}catch(m){}return{text:d,ok:u.ok,status:u.status}},async textStrict(){const d=await this.text();if(!d.ok){const m=new Error("HTTP error "+u.status);throw m.status=u.status,m.text=d.text,m}return d}}}function p(u,l,d,m,b={}){const w=new Headers(b.headers||{});return w.has("Content-Type")||w.set("Content-Type","application/json"),u(d,{...b,method:l,headers:w,body:m==null?void 0:JSON.stringify(m)})}return{createReactiveState:e,joinURL:t,sleep:n,isRetryable:o,makeAbort:r,normalizeRequest:c,runHooks:s,wrapResponse:a,withJSON:p}})();const{createReactiveState:pt,sleep:Ne,isRetryable:Re,makeAbort:ht,normalizeRequest:mt,runHooks:Le,wrapResponse:Pe,withJSON:re}=i._httpShared,oe=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{},Me={baseURL:((Ie=oe.http)==null?void 0:Ie.baseURL)||"",timeout:(Ue=(Be=oe.http)==null?void 0:Be.timeout)!=null?Ue:0,retry:((je=oe.http)==null?void 0:je.retry)||{attempts:0,delay:250,factor:2},headers:((We=oe.http)==null?void 0:We.headers)||{},credentials:(He=oe.http)==null?void 0:He.credentials,debug:(qe=oe.debug)!=null?qe:!1},me=pt(i),le=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now(),K={beforeRequest:new Set,afterResponse:new Set,onError:new Set};async function yt(e){const t=i.auth&&typeof i.auth.fetch=="function"?i.auth.fetch.bind(i.auth):fetch,n={method:e.method,headers:e.headers,body:e.body,credentials:e.credentials,signal:e.signal};return t(e.url,n)}async function G(e,t={}){var b,w,T;let n=mt(Me,e,t);n=await Le(K.beforeRequest,n);const o=me.markStart(n),r=le(),c=n.retry||{attempts:0,delay:250,factor:2},s=Math.max(0,Number(c.attempts||0));let a=Math.max(0,Number(c.delay||0));const p=Math.max(1,Number(c.factor||2));let u=null,l=null,d=null,m=null;try{for(let S=0;S<=s;S++){u=null,l=null;const{signal:A,cancel:h}=ht(n.timeout,t.signal),f={...n,signal:A},y=le();try{Me.debug&&console.log("[http.request]",f.method,f.url),(b=i.perf)==null||b.inc("httpRequests"),(w=i.perf)==null||w.mark("http:req",{url:n.url,method:n.method});const k=await yt(f);l=k;const E=await Le(K.afterResponse,k,f),P=le()-y;if((T=i.perf)==null||T.tick("http:res",P,{status:k.status,url:n.url}),S<s&&Re(null,E)){h(),await Ne(a),a=Math.round(a*p);continue}return h(),d=E,Pe(E,f)}catch(k){u=k,h();for(const E of K.onError)try{E(k,f)}catch(P){}if(S<s&&Re(k,null)){await Ne(a),a=Math.round(a*p);continue}throw m=k,k}}}finally{const S=le()-r;me.markEnd(o,d,m,S)}if(u)throw u;return Pe(l,n)}i.http={},i.http.request=G,i.http.state=()=>me.state,i.http.get=(e,t)=>G(e,{...t,method:"GET"}),i.http.del=(e,t)=>G(e,{...t,method:"DELETE"}),i.http.post=(e,t,n)=>re(G,"POST",e,t,n),i.http.put=(e,t,n)=>re(G,"PUT",e,t,n),i.http.patch=(e,t,n)=>re(G,"PATCH",e,t,n),i.http.getJSON=async(e,t)=>(await G(e,{...t,method:"GET"})).jsonStrict(),i.http.delJSON=async(e,t)=>(await G(e,{...t,method:"DELETE"})).jsonStrict(),i.http.postJSON=async(e,t,n)=>(await re(G,"POST",e,t,n)).jsonStrict(),i.http.putJSON=async(e,t,n)=>(await re(G,"PUT",e,t,n)).jsonStrict(),i.http.patchJSON=async(e,t,n)=>(await re(G,"PATCH",e,t,n)).jsonStrict(),i.http.onBefore=function(e){return K.beforeRequest.add(e),()=>K.beforeRequest.delete(e)},i.http.onAfter=function(e){return K.afterResponse.add(e),()=>K.afterResponse.delete(e)},i.http.onError=function(e){return K.onError.add(e),()=>K.onError.delete(e)},window._http=i.http,i.useRouter=function(e){const t=i.router;return e&&e.onDispose,{navigate:t.navigate,back:()=>history.back(),forward:()=>history.forward(),get current(){return t}}},i.useRoute=function(e){const[t,n]=i.reactive.signal(""),[o,r]=i.reactive.signal({}),[c,s]=i.reactive.signal({}),[a,p]=i.reactive.signal(""),u=d=>{n(d.path||""),r(d.params||{}),s(d.query||{}),p(d.hash||"")},l=i.router.subscribe(u);return e&&typeof e.onDispose=="function"&&e.onDispose(l),{path:t,params:o,query:c,hash:a}},i._routerShared=(()=>{function e(a){return a?(a.startsWith("/")||(a="/"+a),a.length>1&&a.endsWith("/")&&(a=a.slice(0,-1)),a):"/"}function t(a,p=""){if(p&&a.startsWith(p)){const u=a.slice(p.length)||"/";return e(u)}return e(a)}function n(a){a=e(a);const p=[],u=a.replace(/([.+*?=^!${}()[\]|/\\])/g,"\\$1").replace(/\\\/:([A-Za-z0-9_]+)/g,(l,d)=>(p.push(d),"\\/([^\\/]+)"));return{pattern:a,regex:new RegExp("^"+u+"$"),keys:p}}function o(a){const p={};return new URLSearchParams(a||"").forEach((l,d)=>{p[d]===void 0?p[d]=l:Array.isArray(p[d])?p[d].push(l):p[d]=[p[d],l]}),p}function r(a){const p=[];for(const u of a)if(p.push({...u,_parent:null}),u.children&&u.children.length)for(const l of u.children)p.push({...l,_parent:u});return p.sort((u,l)=>l.path.length-u.path.length),p}function c(a,p){const u=e(a),l=r(p);for(const d of l){const m=d._compiled.regex.exec(u);if(!m)continue;const b={};return d._compiled.keys.forEach((w,T)=>{b[w]=decodeURIComponent(m[T+1])}),{route:d,params:b,parent:d._parent||null}}return null}function s(a,p,u=50){a.push({at:Date.now(),path:p.path,params:p.params,query:p.query,hash:p.hash}),a.length>u&&a.shift()}return{normalizePath:e,stripBase:t,compilePattern:n,parseQuery:o,flattenRoutes:r,matchRoute:c,pushHistoryEntry:s}})(),i._uiMetaShared=(()=>{function e(s){return{hasTabPanel:typeof s.TabPanel=="function",Card:typeof s.Card=="function"?s.Card:(...a)=>s.div({class:"cms-doc-card"},...a),Chip:typeof s.Chip=="function"?s.Chip:(a,p)=>s.span({class:"cms-chip cms-chip-fallback"},p)}}function t(s){return s?Array.isArray(s)?s.join(" | "):String(s):"\u2014"}function n(s,a,p){return s.div({class:"cms-doc-meta"},s.div({class:"cms-doc-meta-head"},s.div({class:"cms-doc-meta-name"},a.name),s.div({class:"cms-doc-meta-types"},...a.type?String(a.type).split("|").map(u=>p({color:"secondary",dense:!0,outline:!0},u)):[s.span("\u2014")])),s.div({class:"cms-doc-meta-grid"},s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Default"),s.div({class:"cms-doc-meta-value"},a.default==null?"\u2014":String(a.default))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Values"),s.div({class:"cms-doc-meta-value"},t(a.values)))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Description"),s.div({class:"cms-doc-meta-value"},a.description||"\u2014")))}function o(s,a){return s.div({class:"cms-doc-fallback"},a.map(p=>s.div({class:"cms-doc-fallback-item"},s.h4({class:"cms-doc-fallback-title"},p.label||p.name),p.content)))}function r(s,a){return a?Array.isArray(a)?a.map(p=>({name:p.name,wrap:!0,label:p.name,content:s.div({class:"cms-p-md"},p.description)})):Object.entries(a).map(([p,u])=>({name:p,wrap:!0,label:p,content:s.div({class:"cms-p-md"},u)})):[]}function c(s,a){return a?Array.isArray(a)?a.map(p=>({name:p.name,wrap:!0,label:p.type,content:p.description})):Object.entries(a).map(([p,u])=>({name:p,wrap:!0,label:p,content:s.div({class:"cms-doc-meta"},s.div({class:"cms-doc-meta-head"},s.div({class:"cms-doc-meta-name"},p)),s.div({class:"cms-doc-meta-grid"},s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Type"),s.div({class:"cms-doc-meta-value"},u.type||"\u2014"))),s.div({class:"cms-doc-meta-block"},s.div({class:"cms-doc-meta-label"},"Description"),s.div({class:"cms-doc-meta-value"},u.description||"\u2014")))})):[]}return{resolveDocComponents:e,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:c}})(),i.ui=i.ui||{},i.ui.meta=i.ui.meta||{},i.ui.slot=function(t,n={}){const o=i.ui,{as:r="node",wrap:c="span",iconProps:s=null,filter:a=!0}=n,p=m=>document.createTextNode(String(m)),u=m=>_.span(String(m)),l=m=>{if(m==null||m===!1)return null;if(typeof m=="function")return m;if(Array.isArray(m))return m.flatMap(l).filter(Boolean);if(m&&typeof m=="object"&&m.nodeType)return m;if(typeof m=="string"||typeof m=="number"||typeof m=="boolean"){const b=String(m);return r==="icon"&&o.Icon?o.Icon(b,{class:"cms-slot-icon",...s||{}}):c==="text"?p(b):c==="span"?u(b):b}return c==="text"?p(m):c==="span"?u(m):String(m)},d=l(t);return a&&Array.isArray(d)?d.filter(Boolean):d},i.ui.slots=function(...t){const n=[];for(const o of t){const r=i.ui.slot(o);r&&(Array.isArray(r)?n.push(...r):n.push(r))}return n},i.docTable=e=>{var A;if(!i.isDev())return _.div();const{resolveDocComponents:t,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:c}=i._uiMetaShared,s=(A=i.ui.meta)==null?void 0:A[e];if(!s)return _.div({class:"cms-muted"},`Meta non trovata: ${e}`);const{hasTabPanel:a,Card:p,Chip:u}=t(_),l={};Object.entries(s.props||{}).forEach(([h,f])=>{const y=f.category||"general";l[y]||(l[y]=[]),l[y].push({name:h,...f})});const d=Object.keys(l).map(h=>{const f=l[h].map(y=>({name:y.name,wrap:!0,label:y.name,content:n(_,y,u)}));return{name:h,wrap:!0,label:h,content:a?_.TabPanel({orientation:"vertical",animated:!0,radius:"0 0 0 var(--cms-r-default)",tabs:f}):o(_,f)}}),m=r(_,s.events),b=c(_,s.slots),w=_.rod(null),T=[];b.length&&T.push({name:"Slots",wrap:!0,label:"Slots",content:a?_.TabPanel({animated:!0,radius:"0 0 0 var(--cms-r-default)",orientation:"vertical",tabs:b}):o(_,b)}),d.length&&T.push(...d),m.length&&T.push({name:"Events",wrap:!0,label:"Events",content:a?_.TabPanel({animated:!0,radius:"0 0 0 var(--cms-r-default)",orientation:"vertical",tabs:m}):o(_,m)});const S="general";return T.sort((h,f)=>h.name===S?-1:f.name===S?1:h.name.localeCompare(f.name)),p({class:"cms-doc-table"},_.div({class:"cms-doc-table-header"},_.div({class:"cms-doc-table-title"},`_.${e}`),s.signature?_.div({class:"cms-doc-table-signature"},String(s.signature).replaceAll("UI.","_.")):null),T.length?_.h4({class:"cms-doc-table-section-title"},d.length?"Props":"Documentation"):_.p({class:"cms-muted"},"Nessuna documentazione strutturata disponibile."),T.length?a?_.TabPanel({border:!0,animated:!0,orientation:"horizontal",tabs:T,model:w}):o(_,T):null,s.returns?_.p({class:"cms-muted",style:{marginTop:"14px"}},`Returns: ${s.returns}`):null)},i.ui.inspect=e=>{var t;return console.log(((t=i.ui.meta)==null?void 0:t[e])||"meta not found")},i.ui.can=function(e,t,n,o=null){var s,a;const r=i.useAuth?i.useAuth(e):i.auth;return r?(typeof t=="function"?!!t(r):((s=r.can)==null?void 0:s.call(r,t))||((a=r.hasRole)==null?void 0:a.call(r,t)))?typeof n=="function"?n():n:typeof o=="function"?o():o:typeof o=="function"?o():null},i.ui.canAny=function(e,t,n,o=null){var s;const r=i.useAuth?i.useAuth(e):i.auth;return!!((s=r==null?void 0:r.canAny)!=null&&s.call(r,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},i.ui.canAll=function(e,t,n,o=null){var s;const r=i.useAuth?i.useAuth(e):i.auth;return!!((s=r==null?void 0:r.canAll)!=null&&s.call(r,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},i.Can=function(t,n){var c,s;const o=i.useAuth?i.useAuth(n):i.auth;return(()=>{var a,p,u,l;return o?t.when&&typeof t.when=="function"?!!t.when(o):t.perm?!!((a=o.can)!=null&&a.call(o,t.perm)):t.role?!!((p=o.hasRole)!=null&&p.call(o,t.role)):t.any?!!((u=o.canAny)!=null&&u.call(o,t.any)):t.all?!!((l=o.canAll)!=null&&l.call(o,t.all)):!1:!1})()?typeof t.then=="function"?t.then():(c=t.then)!=null?c:null:typeof t.else=="function"?t.else():(s=t.else)!=null?s:null},i.router=(()=>{let e="history",t=[],n=null,o=null,r="",c=null,s=null,a=[],p=!1;const{normalizePath:u,stripBase:l,compilePattern:d,parseQuery:m,matchRoute:b,pushHistoryEntry:w}=i._routerShared,T={setOutlet:{description:"imposta il contenitore del router"},setBase:{description:"imposta il base path del router"},add:{description:"per aggiungere la route"},notFound:{description:"imposta la view 404"},beforeEach:{description:"hook prima di ogni navigazione"},start:{description:"avvia il router"},navigate:{description:"naviga verso una route"},subscribe:{description:"sottoscrive agli aggiornamenti di route"},current:{description:"ritorna l'URL corrente"},isActive:{description:"verifica se una route e\u0300 attiva"},status:{description:"stringa di stato router"},inspect:{description:"stampa info diagnostiche"},trace:{description:"abilita/disabilita tracing"},history:{description:"ritorna la history interna"},setURLOnly:{description:"aggiorna solo l'URL del browser senza render/meta"}};function S(C,{replace:N=!1}={}){const O=typeof C=="string"?new URL(C,window.location.origin):C,B=O.pathname+O.search+O.hash;if(e==="hash"||e==="auto"){if(history.pushState){const W="#"+B;N?history.replaceState({},"",W):history.pushState({},"",W);return}const q="#"+B;N?window.location.replace(q):window.location.hash=q;return}N?history.replaceState({},"",r+B):history.pushState({},"",r+B)}function A(){if(e==="hash"){const C=window.location.hash||"#/",N=C.startsWith("#")?C.slice(1):C;return new URL(N,window.location.origin)}if(e==="auto"&&window.location.hash.startsWith("#/")){const C=window.location.hash.slice(1);return new URL(C,window.location.origin)}return new URL(window.location.href)}function h(C,N=!1){if(e==="hash"||e==="auto"&&!history.pushState){const O="#"+(C.pathname+C.search+C.hash);N?window.location.replace(O):window.location.hash=O;return}N?history.replaceState({},"",r+C.pathname+C.search+C.hash):history.pushState({},"",r+C.pathname+C.search+C.hash)}function f(C){e=C||"history"}function y(C){return l(C,r)}function k(C){if(!C)return!1;const N=s?s.path:y(A().pathname);let O=C;typeof O=="string"&&(O.includes("?")||O.includes("#")||O.includes("://"))&&(O=new URL(O,window.location.origin).pathname);const B=y(O);return B.includes(":")?d(B).regex.test(N):B===N}async function E(C,{replace:N=!1}={}){if(!n){console.warn("[router] outlet non impostato. Usa JSswift.router.setOutlet('#app').");return}const O=typeof C=="string"?new URL(C,window.location.origin):C;p&&console.log("[router.navigate]",O.toString());const B=O.pathname+O.search+O.hash;h(O,N);const q=y(O.pathname),W=b(q,t),j={path:q,fullPath:B,params:W?W.params:{},query:m(O.search),hash:O.hash||"",navigate:P,outlet:n};if(c){const H=await c(j);if(H===!1)return;if(typeof H=="string"){P(H,{replace:!0});return}}if(typeof o=="function"){try{o()}catch(H){console.error("[router] unmount error:",H)}o=null}if(!W){const H=t._notFound;H?o=i.mount(n,()=>H(j),{clear:!0}):o=i.mount(n,_.div("404"),{clear:!0}),v(j),s=j,w(a,j);return}const Q=W.route.view,Z=W.parent;let ee=null;if(j.renderChild=H=>{if(!j._child)return null;const ne=typeof H=="string"?j.outlet.querySelector(H):H;return ne?(ee=i.mount(ne,()=>j._child.view(j._child.ctx),{clear:!0}),ee):(console.warn("[router] child outlet non trovato:",H),null)},Z){const H=W.route,ne={...j,params:{...j.params}};j._child={view:H.view,ctx:ne},o=i.mount(n,()=>Z.view(j),{clear:!0})}else j._child=null,o=i.mount(n,()=>Q(j),{clear:!0});v(j),s=j,w(a,j)}function P(C,N={}){const O=new URL(C,window.location.origin);E(O,N)}function D(){window.addEventListener("popstate",()=>{E(A(),{replace:!0})}),window.addEventListener("hashchange",()=>{(e==="hash"||e==="auto")&&E(A(),{replace:!0})}),document.addEventListener("click",C=>{var j,Q;const N=(Q=(j=C.target)==null?void 0:j.closest)==null?void 0:Q.call(j,"a");if(!N||C.defaultPrevented||C.button!==0||C.metaKey||C.ctrlKey||C.shiftKey||C.altKey||N.hasAttribute("download")||N.target&&N.target!=="_self")return;const O=N.getAttribute("href");if(!O||O.startsWith("mailto:")||O.startsWith("tel:"))return;const B=new URL(O,window.location.origin);if(B.origin!==window.location.origin)return;const q=new URL(window.location.href);B.pathname+B.search===q.pathname+q.search&&B.hash||(C.preventDefault(),P(B.pathname+B.search+B.hash))}),E(A(),{replace:!0})}function U(C){return n=typeof C=="string"?i.dom.q(C):C,n}function R(C){r=C?u(C):"",r==="/"&&(r="")}function L(C,N,O=null){const B=d(C),q={path:B.pattern,view:N,_compiled:B,children:[]};if(Array.isArray(O))for(const W of O){const[j,Q,Z]=W,ee=u(B.pattern+"/"+(j||"").replace(/^\//,""));q.children.push({path:ee,view:Q,_compiled:d(ee),children:Array.isArray(Z)?Z:[]})}t.push(q)}function M(C){t._notFound=C}function F(C){c=C}let g=new Set;function v(C){for(const N of g)try{N(C)}catch(O){console.error("[router] listener error:",O)}}function z(){if(!s)return"ROUTER \u23F3 not ready";const C=Object.keys(s.query||{}).length?"?":"";return`ROUTER ${s.path}${C} ${s.hash||""}`}function I(C="router"){if(!s)return console.warn("[router.inspect] nessuna route attiva"),null;const N={label:C,mode:typeof e!="undefined"?e:"unknown",base:r,path:s.path,params:s.params,query:s.query,hash:s.hash,outlet:n,timestamp:new Date().toISOString()};return console.groupCollapsed(`[JSswift.router.inspect] ${C}`),console.log(N),console.log("history:",a.slice()),console.groupEnd(),N}function J(C=!0){p=!!C,console.log("[JSswift.router.trace]",p?"ON":"OFF")}function x(){return a.slice()}return{meta:T,setOutlet:U,setBase:R,add:L,setURLOnly:S,notFound:M,beforeEach:F,start:D,navigate:P,isActive:k,subscribe(C){return g.add(C),()=>g.delete(C)},current(){return A?A():new URL(window.location.href)},status:z,inspect:I,trace:J,history:x}})(),($e=i.config)!=null&&$e.debug&&(window.$router=i.router),i.signal=i.reactive.signal,i.effect=i.reactive.effect,i.computed=i.reactive.computed,i.untracked=i.reactive.untracked,i.batch=i.reactive.batch;function se(e){return e==null?null:String(e).trim()||null}function ye(e){const t=Array.isArray(e)?e:typeof e=="string"?e.split(","):[],n=[],o=new Set;for(const r of t){const c=se(r);!c||o.has(c)||(o.add(c),n.push(c))}return n}function ge(){var e;return typeof document!="undefined"&&document.documentElement?document.documentElement:(e=i.dom)!=null&&e.q?i.dom.q("html"):null}function De(){try{return typeof globalThis!="undefined"&&globalThis.localStorage||null}catch(e){return null}}function fe(){var e;return se((e=i.theme)==null?void 0:e.storageKey)||"jsswift:theme"}function Oe(){const e=De();if(!e)return null;try{return se(e.getItem(fe()))}catch(t){return null}}function gt(e){const t=De();if(t)try{e==null?t.removeItem(fe()):t.setItem(fe(),e)}catch(n){}}function ze(e){var o,r,c,s,a;const t=ge(),n=[e,(o=i.theme)==null?void 0:o.themes,(r=i.config)==null?void 0:r.themes,typeof globalThis!="undefined"?(c=globalThis.JSswift_setting)==null?void 0:c.themes:null,typeof globalThis!="undefined"?(s=globalThis.JSswift_setting)==null?void 0:s.themeList:null,(a=t==null?void 0:t.getAttribute)==null?void 0:a.call(t,"data-themes")];for(const p of n){const u=ye(p);if(u.length)return u}return[]}i.theme=i.theme||{},i.theme.storageKey=fe(),ye(i.theme.themes).length||(i.theme.themes=ze()),i.setTheme=function(e,t={}){const n=se(e),o=ge();return o&&(n==null?o.removeAttribute("data-theme"):o.setAttribute("data-theme",n)),t.persist!==!1&>(n),o},i.getTheme=function(e={}){var r;const t=ge(),n=se((r=t==null?void 0:t.getAttribute)==null?void 0:r.call(t,"data-theme"));if(n)return n;if(e.storage===!1)return null;const o=Oe();return o&&t&&e.sync!==!1&&t.setAttribute("data-theme",o),o},i.toggleTheme=function(e,t={}){const n=ze(e),o=n.length?n:ye([i.getTheme({sync:!1}),"light","dark"]),r=i.getTheme({sync:!1}),c=se(t.fallback)||o[0]||"light",s=r?o.indexOf(r):-1,a=s>=0?o[(s+1)%o.length]:c;return i.theme.themes=o.slice(),i.setTheme(a,t),a};const Je=Oe();Je&&i.setTheme(Je,{persist:!1})})();
|
package/package.json
CHANGED
package/src/10-overlay.js
CHANGED
|
@@ -106,8 +106,7 @@
|
|
|
106
106
|
const schedulePosition = () => {
|
|
107
107
|
if (!opts.anchorEl) return;
|
|
108
108
|
const raf = globalThis.requestAnimationFrame || ((fn) => setTimeout(() => fn(Date.now()), 0));
|
|
109
|
-
|
|
110
|
-
if (entry._positionFrame != null) caf(entry._positionFrame);
|
|
109
|
+
if (entry._positionFrame != null) return;
|
|
111
110
|
entry._positionFrame = raf(() => {
|
|
112
111
|
entry._positionFrame = null;
|
|
113
112
|
position();
|
|
@@ -118,13 +117,13 @@
|
|
|
118
117
|
if (opts.anchorEl) {
|
|
119
118
|
position();
|
|
120
119
|
schedulePosition();
|
|
121
|
-
const onResize =
|
|
120
|
+
const onResize = schedulePosition;
|
|
122
121
|
window.addEventListener("resize", onResize);
|
|
123
122
|
window.addEventListener("scroll", onResize, true);
|
|
124
123
|
window.visualViewport?.addEventListener?.("resize", onResize);
|
|
125
124
|
window.visualViewport?.addEventListener?.("scroll", onResize);
|
|
126
125
|
if (typeof ResizeObserver === "function") {
|
|
127
|
-
const panelResizeObserver = new ResizeObserver(
|
|
126
|
+
const panelResizeObserver = new ResizeObserver(schedulePosition);
|
|
128
127
|
panelResizeObserver.observe(panel);
|
|
129
128
|
entry._panelResizeObserver = panelResizeObserver;
|
|
130
129
|
}
|