@jsswift/core 1.0.54 → 2.0.1
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 +1196 -2968
- package/dist/cms.min.js +1 -1
- package/dist/min-cms.js +1 -1
- package/package.json +1 -1
- package/src/09-overlay-shared.js +6 -6
- package/src/10-overlay.js +6 -6
- package/src/20-renderer.js +3 -3
- package/src/32-lifecycle-helpers.js +3 -6
- package/src/49a-ui-meta-shared.js +31 -31
- package/src/50-ui-meta.js +12 -12
package/dist/min-cms.js
CHANGED
|
@@ -1 +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})})();
|
|
1
|
+
(()=>{var ve,be,we,_e,Se,Ae,Ee,Ce,ke;window.JSswift=window.JSswift||{};const s=window.JSswift;window._=window.JSswift,s.config=s.config||{};const $e=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{};s.config.debug=(ve=$e.modeDev)!=null?ve:!1,s.isDev=function(){return s.config.debug},s.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}},s.uiSizes=["xxs","xs","sm","md","lg","xl","xxl","xxxl"],s.uiColors=["primary","secondary","success","warning","danger","info","light","dark"],s.meta=s.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."]}}},s.omit=(e,t)=>{const n={},o=new Set(t||[]);for(const r in e||{})o.has(r)||(n[r]=e[r]);return n},s._cleanupRegistry=new WeakMap,s._registerCleanup=function(e,t){if(!e||typeof t!="function")return t;const n=s._cleanupRegistry.get(e)||[];return n.push(t),s._cleanupRegistry.set(e,n),t},s.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)}}s.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})})(),s.reactive=(()=>{let e=null;const t=[],n=100;let o=0,r="sync",a="sync",i=!1;const l=new Set;function f(h){const y=h==null?void 0:h.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 c(){for(;l.size;){const h=Array.from(l);l.clear(),h.forEach(y=>y())}}function u(){i||(i=!0,queueMicrotask(()=>{i=!1,a="sync",c()}))}function d(h){const y=Array.from(h);if(o>0||a==="microtask"){y.forEach(A=>l.add(A)),o===0&&a==="microtask"&&u();return}y.forEach(A=>A())}function p(h){if(h&&(h._deps.size&&(h._deps.forEach(y=>y.delete(h._runner)),h._deps.clear()),typeof h._cleanup=="function")){const y=h._cleanup;h._cleanup=null;try{y()}catch(A){console.error("[JSswift.reactive.effect] cleanup error:",A)}}}function v(h){if(!(!h||!h.active)){p(h),t.push(h),e=h;try{const y=C=>{h._cleanup=typeof C=="function"?C:null},A=h.fn.length>0?h.fn(y):h.fn();typeof A=="function"&&(h._cleanup=A)}finally{t.pop(),e=t[t.length-1]||null}}}function S(h){if(typeof h!="function")return()=>{};const y={fn:h,active:!0,_deps:new Set,_cleanup:null,_runner:null,_running:!1,_queued:!1},A=()=>{if(!y.active)return;if(y._running){y._queued=!0;return}y._running=!0;let C=0;try{do if(y._queued=!1,v(y),C++,C>=n){y._queued=!1,console.warn("[JSswift.reactive.effect] loop guard triggered: too many synchronous reruns",{max:n,effect:h.name||"anonymous"});break}while(y.active&&y._queued)}finally{y._running=!1}};return y._runner=A,A(),()=>{y.active&&(y.active=!1,p(y))}}function x(h){let y=h;const A=new Set;function C(){return e&&e.active&&(A.add(e._runner),e._deps.add(A)),y}function T(F){y=F,d(A)}function j(){A.clear()}return[C,T,j]}function b(h){if(typeof h!="function")throw new Error("JSswift.reactive.computed: fn must be a function");const[y,A,C]=x(void 0),T=S(()=>{A(h())}),j=()=>y();return j.dispose=()=>{T(),C()},j.peek=()=>y(),j.type="computed",j}function E(h){if(typeof h!="function")throw new Error("JSswift.reactive.untracked: fn must be a function");const y=e;e=null;try{return h()}finally{e=y}}function m(h,y){if(typeof h!="function")throw new Error("JSswift.reactive.batch: fn must be a function");const A=f(y);o===0?r=A:A==="microtask"&&(r="microtask"),o+=1;try{return h()}finally{if(o-=1,o===0){const C=r==="microtask"||a==="microtask";r="sync",C?(a="microtask",u()):c()}}}return{signal:x,effect:S,computed:b,untracked:E,batch:m}})(),s._overlayShared=(()=>{const e=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function t(a,i){const l=a();if(l&&l.isConnected)return l;let f=document.getElementById("jss-overlay-root");return!f&&(document!=null&&document.body)&&(f=document.createElement("div"),f.id="jss-overlay-root",f.className="jss-overlay-root",document.body.appendChild(f)),!document.body&&!f&&s.ready(()=>{let c=document.getElementById("jss-overlay-root");c||(c=document.createElement("div"),c.id="jss-overlay-root",c.className="jss-overlay-root",document.body.appendChild(c)),i(c)}),i(f),f}function n(a){var i;const l=a.querySelector(e);(i=l==null?void 0:l.focus)==null||i.call(l)}function o(a,i){if(a.key!=="Tab")return;const l=Array.from(i.querySelectorAll(e)).filter(d=>d.offsetParent!==null);if(!l.length)return;const f=l[0],c=l[l.length-1],u=document.activeElement;a.shiftKey&&u===f?(a.preventDefault(),c.focus()):!a.shiftKey&&u===c&&(a.preventDefault(),f.focus())}function r(a,i){var l,f,c,u,d,p;if(!i.anchorEl)return;const v=i.anchorEl.getBoundingClientRect(),S=a.getBoundingClientRect(),x=window.visualViewport||null,b=Math.max(0,Number(x==null?void 0:x.offsetLeft)||0),E=Math.max(0,Number(x==null?void 0:x.offsetTop)||0),m=Math.max(Number(x==null?void 0:x.width)||0,window.innerWidth||0,((l=document.documentElement)==null?void 0:l.clientWidth)||0),h=Math.max(Number(x==null?void 0:x.height)||0,window.innerHeight||0,((f=document.documentElement)==null?void 0:f.clientHeight)||0),y=Number((u=(c=i.viewportGutter)!=null?c:i.gutter)!=null?u:8),A=Number.isFinite(y)?Math.max(0,y):8,C=Number((d=i.offsetX)!=null?d:0),T=Number((p=i.offsetY)!=null?p:8),j=Number.isFinite(C)?C:0,F=Number.isFinite(T)?T:8,N=(G,V,Q)=>!Number.isFinite(G)||(Number.isFinite(V)||(V=0),Number.isFinite(Q)||(Q=V),Q<V)?V:Math.min(Math.max(G,V),Q),P=String(i.placement||"bottom-start").toLowerCase(),[M,z]=P.split("-"),g=["top","bottom","left","right"].includes(M)?M:"bottom",w=["start","end","center"].includes(z)?z:"start",O={top:"bottom",bottom:"top",left:"right",right:"left"}[g]||"top",I=g==="top"||g==="bottom",D=S.width,R=S.height,k=G=>{let V=v.left+j,Q=v.top+F;return G==="top"||G==="bottom"?(w==="center"?V=v.left+(v.width-D)/2+j:w==="end"&&(V=v.right-D+j),Q=G==="top"?v.top-R-F:v.bottom+F):(w==="center"?Q=v.top+(v.height-R)/2+F:w==="end"&&(Q=v.bottom-R+F),V=G==="left"?v.left-D-j:v.right+j),{left:V,top:Q}},L=G=>G==="top"?v.top-F-A:G==="bottom"?h-v.bottom-F-A:G==="left"?v.left-j-A:m-v.right-j-A,J=L(g),B=L(O),U=(I?R:D)>J&&B>J?O:g,q=k(U),ee=b+A,Y=E+A,te=Math.max(ee,b+m-D-A),H=Math.max(Y,E+h-R-A),se=N(q.left,ee,te),yt=N(q.top,Y,H);a.style.position="fixed",a.style.left=`${se}px`,a.style.top=`${yt}px`}return{ensureRoot:t,focusFirst:n,trapFocus:o,applyAnchoredPosition:r}})(),s.overlay=(()=>{let e=0;const t=new Map;let n=null;const{ensureRoot:o,focusFirst:r,trapFocus:a,applyAnchoredPosition:i}=s._overlayShared,l=()=>o(()=>n,b=>{n=b});let f=0;const c=()=>{f++,f===1&&document.documentElement.classList.add("jss-scroll-locked")},u=()=>{f=Math.max(0,f-1),f===0&&document.documentElement.classList.remove("jss-scroll-locked")},d=()=>{let b=null;for(const E of t.values())b=E;return b},p=b=>{var E;let m=b;for(;m&&m!==document;){if(m.nodeType===1&&((E=m.getAttribute)==null?void 0:E.call(m,"data-jss-overlay-portal"))==="true")return!0;m=m.parentNode}return!1},v=(b,E={})=>{var m,h,y,A;const C=`ov_${++e}`,T={id:C,opts:E,isOpen:!0,anchorEl:E.anchorEl||null,placement:E.placement||"bottom-start",onClose:typeof E.onClose=="function"?E.onClose:null,overlay:null,panel:null,backdrop:null,reposition:null,_positionCleanup:null,_positionFrame:null,_panelResizeObserver:null,_cleanup:null},j=document.createElement("div");j.className=["jss-overlay",E.type?`type-${E.type}`:""].filter(Boolean).join(" "),j.dataset.id=C;const F=document.createElement("div");F.className="jss-overlay-backdrop",E.backdrop||(F.style.display="none");const N=document.createElement("div");N.className=["jss-overlay-panel",E.className].filter(Boolean).join(" "),N.tabIndex=-1;const P=typeof b=="function"?b({close:()=>S(C)}):b,M=s.ui.slot(P);Array.isArray(M)?M.forEach(R=>R&&N.appendChild(R)):M&&N.appendChild(M),j.appendChild(F),j.appendChild(N);const z=l();if(!z)return{id:C,close:()=>S(C),panel:N,overlay:j};z.appendChild(j),T.overlay=j,T.panel=N,T.backdrop=F,t.set(C,T),E.lockScroll&&c(),E.autoFocus!==!1&&setTimeout(()=>{N.isConnected&&t.get(C)===T&&!N.contains(document.activeElement)&&r(N)},0);const g=(R=null)=>{R&&typeof R=="object"&&Object.assign(T.opts,R),i(N,T.opts)},w=()=>{if(!E.anchorEl)return;const R=globalThis.requestAnimationFrame||(k=>setTimeout(()=>k(Date.now()),0));T._positionFrame==null&&(T._positionFrame=R(()=>{T._positionFrame=null,g()}))};if(T.reposition=g,E.anchorEl){g(),w();const R=w;if(window.addEventListener("resize",R),window.addEventListener("scroll",R,!0),(h=(m=window.visualViewport)==null?void 0:m.addEventListener)==null||h.call(m,"resize",R),(A=(y=window.visualViewport)==null?void 0:y.addEventListener)==null||A.call(y,"scroll",R),typeof ResizeObserver=="function"){const k=new ResizeObserver(w);k.observe(N),T._panelResizeObserver=k}T._positionCleanup=()=>{var k,L,J,B,W,U;const q=globalThis.cancelAnimationFrame||clearTimeout;T._positionFrame!=null&&(q(T._positionFrame),T._positionFrame=null),(L=(k=T._panelResizeObserver)==null?void 0:k.disconnect)==null||L.call(k),T._panelResizeObserver=null,window.removeEventListener("resize",R),window.removeEventListener("scroll",R,!0),(B=(J=window.visualViewport)==null?void 0:J.removeEventListener)==null||B.call(J,"resize",R),(U=(W=window.visualViewport)==null?void 0:W.removeEventListener)==null||U.call(W,"scroll",R)}}const O=R=>{const k=d();!k||k.id!==C||E.closeOnOutside!==!1&&(p(R.target)||N.contains(R.target)||S(C))};document.addEventListener("mousedown",O,!0);const I=R=>{const k=d();!k||k.id!==C||(E.trapFocus&&a(R,N),R.key==="Escape"&&E.closeOnEsc!==!1&&(R.preventDefault(),S(C)))};document.addEventListener("keydown",I,!0),F.addEventListener("click",()=>{E.closeOnBackdrop!==!1&&S(C)}),T._cleanup=()=>{var R;document.removeEventListener("mousedown",O,!0),document.removeEventListener("keydown",I,!0),(R=T._positionCleanup)==null||R.call(T)};const D=1e3+t.size*10;return j.style.zIndex=String(D),{id:C,close:()=>S(C),panel:N,overlay:j,reposition:g}},S=b=>{var E,m,h;const y=t.get(b);y&&(t.delete(b),(E=y._cleanup)==null||E.call(y),y.opts.lockScroll&&u(),typeof X=="function"&&X(y.overlay),(m=y.overlay)==null||m.remove(),(h=y.onClose)==null||h.call(y))};return{open:v,close:S,closeTop:()=>{const b=d();b&&S(b.id)},root:n,_stack:t}})();function Te(e,t={}){const{isSVG:n=!1,normalizeClass:o=m=>String(m!=null?m:""),isContentProp:r=()=>!1,autoValueTags:a=new Set(["INPUT","TEXTAREA","SELECT"])}=t;function i(m){if(n||!(m in e))return!1;try{return typeof e[m]=="boolean"}catch(h){return!1}}function l(m){return n||m.startsWith("data-")||m.startsWith("aria-")||!(m in e)}function f(m,h){if(h==null){e.removeAttribute(m);return}if(h===!1){if(m.startsWith("aria-")){e.setAttribute(m,"false");return}e.removeAttribute(m);return}if(h===!0&&!n&&!m.startsWith("aria-")&&!m.startsWith("data-")){e.setAttribute(m,"");return}e.setAttribute(m,String(h))}function c(m,h){if(m==null)return;const y=String(m),A=y.startsWith("--")||y.includes("-");if(h==null||h===!1||h===""){A?e.style.removeProperty(y):e.style[y]="";return}if(A){e.style.setProperty(y,String(h));return}e.style[y]=h}function u(m){const h=o(m);if(h==null||h===!1||h===""){e.removeAttribute("class");return}e.setAttribute("class",String(h))}function d(m,h){const y=!!h;e[m]=y,y?e.setAttribute(m,""):e.removeAttribute(m)}function p(m){if(r(m)){e[m]="";return}if(m==="class"){e.removeAttribute("class");return}if(m==="style"){e.removeAttribute("style");return}if(i(m)){try{e[m]=!1}catch(h){}e.removeAttribute(m);return}if(e.removeAttribute(m),!l(m))try{typeof e[m]=="string"&&(e[m]="")}catch(h){}}function v(m){!m||typeof m!="object"||Object.entries(m).forEach(([h,y])=>{c(h,y)})}function S(m,h){if(r(m)){e[m]=h!=null?h:"";return}if(m==="class"){u(h);return}if(m==="style"){if(h==null||h===!1){p(m);return}if(typeof h=="object"){v(h);return}}if(i(m)){d(m,h);return}if(h==null||h===!1){p(m);return}if(l(m)){f(m,h);return}e[m]=h}function x(m,h){const y=String(m).split(".");let A=e;for(let C=0;C<y.length-1;C++)if(A=A==null?void 0:A[y[C]],!A)return;A[y[y.length-1]]=h}function b(m){return m?m==="auto"||m.startsWith("attr:")||m.startsWith("@")||m.startsWith("style.")||m.includes("."):!1}function E(m,h){if(!m||m==="auto"){a.has(e.tagName)?S("value",h):e.textContent=h!=null?h:"";return}if(m.startsWith("attr:")){f(m.slice(5),h);return}if(m.startsWith("@")){f(m.slice(1),h);return}if(m.startsWith("style.")){c(m.slice(6),h);return}if(m.includes(".")){x(m,h);return}S(m,h)}return{isBooleanDomProp:i,isAttributeOnlyProp:l,isBindingValueKey:b,setAttributeValue:f,setStyleEntry:c,setClassValue:u,setBooleanProp:d,removeProp:p,applyStyleObject:v,setProp:S,setPathValue:x,applyBindingValue:E}}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 i=a;typeof i=="function"?i=i():i&&i.type==="rod"&&(i=i.value),n(i?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 xe(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=>xe(n,t))}function Ge(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 i=a;typeof i=="function"?i=i():t(i)&&(i=i.value),o[r]=i}),o}function Ne(e){let t=new Set;function n(r){t.forEach(a=>{r.has(a)||e(a,null)}),t=r}function o(r,a){const i=Ge(r,a);if(!i){n(new Set);return}const l=new Set(Object.keys(i));n(l),Object.entries(i).forEach(([f,c])=>{e(f,c)})}return{apply:o}}function Ke(e){return typeof e=="string"&&(e.startsWith("on:")||e.startsWith("on")&&e.length>2)}const Re=128,Z=[];function Qe(e,t){Z.push({rod:e,value:String(t!=null?t:"")}),Z.length>Re&&Z.splice(0,Z.length-Re)}function Xe(){if(!Z.length)return null;const e=Z.slice();return Z.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,i=!1;for(;a<t.items.length;){const l=t.items[a],f=l.value;if(!f)break;const c=o.indexOf(f,r);if(c===-1)break;c>r&&n.push(o.slice(r,c)),n.push(l.rod),r=c+f.length,a++,i=!0}return i?(r<o.length&&n.push(o.slice(r)),t.index=a,n):null}function Le(e){var t;let n="";for(const o of e)typeof o=="string"?n+=o:n+=(t=o==null?void 0:o.value)!=null?t:"";return n}function Ye(e){if(e.startsWith("on:"))return e.slice(3);const t=e.slice(2);return t?t==="DoubleClick"?"dblclick":t.toLowerCase():""}function ae(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 Ze(e,t){const n=ae(e),o=ae(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 le(e,t){return Array.isArray(e)?e.some(n=>le(n,t)):t(e)?!0:!e||typeof e!="object"||Array.isArray(e)||e.nodeType?!1:Array.isArray(e.handlers)?e.handlers.some(n=>le(n,t))||t(e.options)||typeof e.options=="function":Array.isArray(e.listeners)?e.listeners.some(n=>le(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 ce(e,t,n){var o,r,a,i,l,f,c;if(e==null||e===!1)return[];if(typeof e=="function")return[{handler:e,options:ae(n!=null?n:!1)}];if(t(e))return ce(e.value,t,n);if(Array.isArray(e))return e.flatMap(u=>ce(u,t,n));if(typeof e=="object"&&!Array.isArray(e)&&!e.nodeType){if(Array.isArray(e.handlers)||Array.isArray(e.listeners)){const p=e.handlers||e.listeners||[],v=(r=(o=e.options)!=null?o:n)!=null?r:!1;return p.flatMap(S=>ce(S,t,v))}let u=(l=(i=(a=e.handler)!=null?a:e.listener)!=null?i:e.fn)!=null?l:null,d=(c=(f=e.options)!=null?f:n)!=null?c:!1;return t(u)&&(u=u.value),t(d)&&(d=d.value),typeof d=="function"&&(d=d()),typeof u=="function"?[{handler:u,options:ae(d)}]:[]}return[]}function et(e,t){return ce(e,t)}function tt(e,t,n,o){const r=Ye(t);if(!r)return;const a={listeners:[]},i=()=>{a.listeners.forEach(f=>{e.removeEventListener(r,f.dispatch,f.options)}),a.listeners=[]},l=f=>{const c=et(f,o);a.listeners.length===c.length&&a.listeners.every((d,p)=>{const v=c[p];return d.handler===v.handler&&Ze(d.options,v.options)})||(i(),c.forEach(d=>{const p={handler:d.handler,options:d.options,dispatch:null};p.dispatch=v=>{if(typeof p.handler=="function"){const S=p.handler.call(e,v);return p.options&&typeof p.options=="object"&&p.options.once&&(e.removeEventListener(r,p.dispatch,p.options),a.listeners=a.listeners.filter(x=>x!==p)),S}},e.addEventListener(r,p.dispatch,p.options),a.listeners.push(p)}))};if(s._registerCleanup(e,i),o(n)){const f=s.reactive.effect(()=>{l(n.value)});s._registerCleanup(e,f);return}if(le(n,o)){const f=s.reactive.effect(()=>{l(n)});s._registerCleanup(e,f);return}l(n)}function nt(e,t={}){const{isRod:n=()=>!1,interpolationCursor:o=null}=t;function r(u){const d=document.createTextNode(""),p=s.rodBind(d,u);return s._registerCleanup(d,p),d}function a(u){e.appendChild(r(u))}function i(u){const d=document.createTextNode("");e.appendChild(d);const p=s.reactive.effect(()=>{d.textContent=Le(u)});s._registerCleanup(d,p)}function l(u){const d=[],p=v=>{if(!(v==null||v===!1)){if(Array.isArray(v)){v.forEach(p);return}if(typeof v=="string"){d.push(document.createTextNode(v));return}if(typeof v=="number"){d.push(document.createTextNode(String(v)));return}if(typeof v!="boolean"){if(n(v)){d.push(r(v));return}if(v!=null&&v.nodeType){d.push(v);return}d.push(document.createTextNode(String(v)))}}};return p(u),d}function f(u){const d=document.createComment("dyn");e.appendChild(d);let p=[];const v=s.reactive.effect(()=>{p.forEach(E=>{X(E),E.parentNode&&E.parentNode.removeChild(E)}),p=[];const S=d.parentNode;if(!S)return;const x=l(u());if(!x.length)return;const b=document.createDocumentFragment();x.forEach(E=>b.appendChild(E)),S.insertBefore(b,d.nextSibling),p=x});s._registerCleanup(d,()=>{v(),p.forEach(S=>X(S)),p=[]})}function c(u){if(u!=null){if(Array.isArray(u)){for(const d of u)c(d);return}if(typeof u=="string"){const d=pe(u,o);d?i(d):e.appendChild(document.createTextNode(u));return}if(typeof u=="number"){e.appendChild(document.createTextNode(String(u)));return}if(typeof u=="function"){f(u);return}if(n(u)){a(u);return}u.nodeType&&e.appendChild(u)}}return{appendRodText:a,appendInterpolatedText:i,appendDynamicChild:f,appendChildValue:c}}function rt(e,t={}){const{el:n,isRod:o=()=>!1,interpolationCursor:r=null,appendChildValue:a=()=>{},appendRodText:i=()=>{},appendInterpolatedText:l=()=>{},appendDynamicChild:f=()=>{},bindProp:c=()=>{}}=t;for(const u of e)if(u!=null){if(Array.isArray(u)){a(u);continue}if(typeof u=="string"){const d=pe(u,r);d?l(d):n.appendChild(document.createTextNode(u));continue}if(typeof u=="number"){n.appendChild(document.createTextNode(String(u)));continue}if(typeof u=="function"){f(u);continue}if(o(u)){i(u);continue}if(u.nodeType){n.appendChild(u);continue}if(typeof u=="object")for(const[d,p]of Object.entries(u)){if(typeof p=="string"){const v=pe(p,r);if(v){c(d,()=>Le(v));continue}}if(d==="class"){c(d,p);continue}if(d==="style"&&typeof p=="object"&&p!==null&&!o(p)){c(d,p);continue}c(d,p)}}}const je="http://www.w3.org/2000/svg",ot=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 st(e,...t){const n=ot.has(e),o=e==="text"&&!n?document.createTextNode(""):n?document.createElementNS(je,e):document.createElement(e),r=g=>!!g&&g.type==="rod",a=Xe(),i=nt(o,{isRod:r,interpolationCursor:a}),{appendRodText:l,appendInterpolatedText:f,appendDynamicChild:c,appendChildValue:u}=i,d=Te(o,{isSVG:n,normalizeClass:ie,isContentProp:he}),{isBooleanDomProp:p,isBindingValueKey:v,applyBindingValue:S,setStyleEntry:x,setProp:b,setClassValue:E}=d;function m(g){const w=s.reactive.effect(g);return s._registerCleanup(o,w),w}function h(g){if(String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input")return!1;const w=String((g==null?void 0:g.type)||"").toLowerCase();return w==="range"||w==="number"}function y(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()!=="input"?"":String((g==null?void 0:g.type)||"").toLowerCase()}function A(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="select"&&!g.multiple}function C(g){return String((g==null?void 0:g.tagName)||"").toLowerCase()==="input"&&String((g==null?void 0:g.type)||"").toLowerCase()==="file"}function T(g,w,O){m(()=>{var D;const R=(D=w.value)!=null?D:"";g.value!==String(R)&&b("value",R)});const I=()=>{let D=g.value;const R=y(g),k=typeof w.value=="number"||w.value==null;if(A(g)&&g.value==="")D=null;else if(h(g)&&k)if(R==="number"&&g.value==="")D=null;else{const L=typeof g.valueAsNumber=="number"&&!Number.isNaN(g.valueAsNumber)?g.valueAsNumber:Number(g.value);D=Number.isNaN(L)?R==="number"?null:0:L}w.value!==D&&(w.value=D)};g.addEventListener(O,I),s._registerCleanup(g,()=>{g.removeEventListener(O,I)})}function j(g,w){m(()=>{const I=!!w.value;!!g.checked!==I&&b("checked",I)});const O=()=>{const I=!!g.checked;w.value!==I&&(w.value=I)};g.addEventListener("change",O),s._registerCleanup(g,()=>{g.removeEventListener("change",O)})}function F(g,w){const O=()=>{var D;return String((D=g.value)!=null?D:"on")};m(()=>{const R=(w.value==null?null:String(w.value))===O();!!g.checked!==R&&b("checked",R)});const I=()=>{if(!g.checked)return;const D=O();w.value!==D&&(w.value=D)};g.addEventListener("change",I),s._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function N(g,w){const O=()=>{const D=g.files;return D==null?[]:Array.isArray(D)?D.slice():typeof D.length=="number"?Array.from(D):[D]};m(()=>{const D=w.value;(D==null||Array.isArray(D)&&D.length===0)&&(g.value!==""&&b("value",""),Array.isArray(g.files)&&(g.files=[]))});const I=()=>{const D=O();w.value=D};g.addEventListener("change",I),s._registerCleanup(g,()=>{g.removeEventListener("change",I)})}function P(g,w){const O=()=>Array.from(g.childNodes||[]).filter(R=>(R==null?void 0:R.tagName)==="OPTION"&&R.selected).map(R=>{var k;return String((k=R.value)!=null?k:"")}),I=()=>{const R=Array.isArray(w.value)?w.value.map(L=>String(L)):[],k=new Set(R);Array.from(g.childNodes||[]).forEach(L=>{var J;if((L==null?void 0:L.tagName)!=="OPTION")return;const B=k.has(String((J=L.value)!=null?J:""));!!L.selected!==B&&(L.selected=B,B?L.setAttribute("selected",""):L.removeAttribute("selected"))})};m(I),g._jssApplySelectedValues=I,queueMicrotask(I);const D=()=>{const R=O(),k=Array.isArray(w.value)?w.value.map(L=>String(L)):[];k.length===R.length&&k.every((L,J)=>L===R[J])||(w.value=R)};g.addEventListener("change",D),s._registerCleanup(g,()=>{g.removeEventListener("change",D)})}function M(g,w){m(()=>{const R=!!w.value;!!g.selected!==R&&b("selected",R)});let O=null;const I=()=>{const R=!!g.selected;w.value!==R&&(w.value=R)};queueMicrotask(()=>{var R;O||((R=g.parentNode)==null?void 0:R.tagName)!=="SELECT"||(O=g.parentNode,O.addEventListener("change",I))}),s._registerCleanup(g,()=>{O==null||O.removeEventListener("change",I)})}function z(g,w){if(Ke(g)){tt(o,g,w,r);return}if(g==="class"){if(de(w)){m(()=>{E(ie(w))});return}E(ie(w));return}if(g==="style"&&w&&typeof w=="object"){const O=Ne(x);if(xe(w,r)){m(()=>{O.apply(w,r)});return}O.apply(w,r);return}if(g==="style"&&(typeof w=="function"||r(w))){const O=Ne(x);m(()=>{O.apply(w,r)});return}if(v(g)&&typeof w=="function"){m(()=>{S(g,w())});return}if(v(g)&&!r(w)){S(g,w);return}if(typeof w=="function"){m(()=>{b(g,w())});return}if(g==="value"&&r(w)&&(e==="input"||e==="textarea"||e==="select")){if(e==="select"&&o.multiple){P(o,w);return}T(o,w,e==="select"?"change":"input");return}if(g==="checked"&&r(w)&&e==="input"){if(String(o.type||"").toLowerCase()==="radio"){F(o,w);return}j(o,w);return}if(g==="files"&&r(w)&&C(o)){N(o,w);return}if(g==="selected"&&r(w)&&e==="option"){M(o,w);return}if(he(g)&&r(w)){m(()=>{b(g,w.value)});return}if(r(w)){const O=s.rodBind(o,w,{key:g});s._registerCleanup(o,O);return}b(g,w)}return rt(t,{el:o,isRod:r,interpolationCursor:a,appendChildValue:u,appendRodText:l,appendInterpolatedText:f,appendDynamicChild:c,bindProp:z}),e==="select"&&typeof o._jssApplySelectedValues=="function"&&o._jssApplySelectedValues(),o}const vt={},Pe=["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"];Pe.forEach(e=>{window._[e]=(...t)=>st(e,...t)}),_.DOM_ELEMENTS=Pe,_.fragment=(...e)=>e,_.dynamic=function(e){const t=document.createComment("dyn"),n=document.createDocumentFragment();n.appendChild(t);let o=null;return s.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 i=t.parentNode;i&&a&&a.nodeType&&(i.insertBefore(a,t.nextSibling),o=a)}),n};function it(){let e=!1;const t=new Set;function n(){var o,r,a;e=!1,(o=s.debug)==null||o.inc("rodFlushes"),(r=s.perf)==null||r.inc("rodFlushes"),(a=s.perf)==null||a.mark("rod:flush");const i=Array.from(t);t.clear();for(const l of i)try{l()}catch(f){console.error("[rod] flush error:",f)}}return function(r){t.add(r),e||(e=!0,queueMicrotask(n))}}const at=it();function Me(e,t,n){if(!e)return;if(e.nodeType===3){e.textContent=n!=null?n:"";return}Te(e,{isSVG:e.namespaceURI===je,normalizeClass:ie,isContentProp:he}).applyBindingValue(t,n)}function lt(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 r;if(this._disposed)return()=>{};if(!n)return()=>{};const a={el:n,key:(r=o==null?void 0:o.key)!=null?r:"auto"};return this._bindings.some(l=>l.el===a.el&&l.key===a.key)||this._bindings.push(a),Me(a.el,a.key,this.value),()=>{this._bindings=this._bindings.filter(l=>!(l.el===a.el&&l.key===a.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 n,o,r,a,i;if(this._disposed)return;const l=performance.now();(n=s.perf)==null||n.inc("rodNotifies"),this._bindings=this._bindings.filter(f=>{const c=f.el;return c?c.nodeType===3?!!c.parentNode:c.isConnected!==!1:!1});for(const f of this._bindings)Me(f.el,f.key,this.value);if(!(this._silentDepth>0)){for(const f of this._actions)try{f(this.value)}catch(c){console.error("[rod] action error:",c)}(o=s.debug)==null||o.inc("rodNotifies"),(i=s.perf)==null||i.tick("rod:notify",performance.now()-l,{bindings:((r=this._bindings)==null?void 0:r.length)||0,actions:((a=this._actions)==null?void 0:a.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 ct(e,t="value"){var n;let o=e[t],r=null,a=null,i=null;return(n=s==null?void 0:s.reactive)!=null&&n.signal&&([r,a,i]=s.reactive.signal(o),i&&typeof e.onDispose=="function"&&e.onDispose(i)),Object.defineProperty(e,t,{get(){return r?r():o},set(l){a?a(l):o=l,e._scheduleNotify()},configurable:!0}),typeof e.val!="function"&&Object.defineProperty(e,"val",{value(l){return arguments.length?(this.value=l,l):this.value},configurable:!0}),e[Symbol.toPrimitive]||Object.defineProperty(e,Symbol.toPrimitive,{value(l){const f=this.value;if(f==null)return f;const c=typeof f;return l==="number"?Number(f):(c!=="symbol"&&Qe(this,f),c==="string"||c==="number"||c==="boolean"||c==="bigint"||c==="symbol"?f:String(f))},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=lt(t);return ct(o,n),s.rod._all=s.rod._all||new Set,s.rod._all.add(o),typeof o.onDispose=="function"&&o.onDispose(()=>s.rod._all.delete(o)),o},s.rodBind=function(e,t,n={key:"auto"}){var o,r,a;if((o=s.debug)==null||o.inc("rodBinds"),!e)return(r=s.debug)==null||r.inc("rodBindNull"),(a=s.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)},s.rodFromSignal=function(e,t){const n=_.rod(e());let o=!1;const r=s.reactive.effect(()=>{const i=n.value,l=s.reactive.untracked(()=>e());if(!o&&l!==i){o=!0;try{t(i)}finally{o=!1}}}),a=s.reactive.effect(()=>{const i=e();if(s.reactive.untracked(()=>n.value)!==i){o=!0;try{n._setSilent(i)}finally{o=!1}}});return typeof n.onDispose=="function"&&(n.onDispose(r),n.onDispose(a)),n};function De(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}s.rodModel=function(e,t,n={}){var o,r,a;if(!t||t.type!=="rod")throw new Error("[JSswift.rodModel] rodObj deve essere un rod");const i=Array.isArray(e)||e instanceof NodeList?Array.from(e):[e],l=(o=n.event)!=null?o:"change",f=(r=n.parse)!=null?r:(b=>b),c=(a=n.format)!=null?a:(b=>b);let u=!1;const d=[],p=b=>{for(const E of i){if(!E)continue;switch(De(E)){case"checkbox":E.checked=!!b;break;case"radio":E.checked=E.value==b;break;case"select":E.value=b!=null?b:"";break;case"select-multiple":const h=Array.isArray(b)?b.map(String):[];for(const y of E.options)y.selected=h.includes(y.value);break;default:E.value=b!=null?b:""}}},v=b=>{if(!u){u=!0;try{p(c(b))}finally{u=!1}}};t.action(v),p(c(t.value));for(const b of i){if(!b)continue;const E=De(b),m=()=>{if(u)return;let h;switch(E){case"checkbox":h=b.checked;break;case"radio":if(!b.checked)return;h=b.value;break;case"select":h=b.value;break;case"select-multiple":h=Array.from(b.selectedOptions).map(y=>y.value);break;case"number":h=f(b.value===""?null:Number(b.value));break;default:h=f(b.value)}u=!0;try{t.value!==h&&(t.value=h)}finally{u=!1}};b.addEventListener(l,m),d.push(()=>b.removeEventListener(l,m))}let S=!1;const x=()=>{var b,E,m,h;if(S)return;S=!0,d.splice(0).forEach(C=>C());const y=(E=(b=t._actions)==null?void 0:b.indexOf(v))!=null?E:-1;y>=0&&t._actions.splice(y,1);const A=(h=(m=t._disposeHooks)==null?void 0:m.indexOf(x))!=null?h:-1;A>=0&&!t._disposed&&t._disposeHooks.splice(A,1)};return typeof t.onDispose=="function"&&t.onDispose(x),x},s.signalModel=function(e,t,n,o={}){const r=s.rodFromSignal(t,n),a=s.rodModel(e,r,o);return()=>{a(),r.dispose()}};function X(e){var t;if(!e)return;const n=(t=e.childNodes)!=null&&t.length?Array.from(e.childNodes):[],o=s._cleanupRegistry.get(e);if(o){s._cleanupRegistry.delete(e);for(const r of o)try{r()}catch(a){console.error("[cleanup] error:",a)}}for(const r of n)X(r)}function ut(e){const t=n=>typeof n=="string"?s.dom.q(n):n;return Array.isArray(e)?e.map(t).filter(Boolean):[t(e)].filter(Boolean)}function ft(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 Oe(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 Je(e=[],t=null){return Oe([...t?[t]:[],...e],"[component] dispose error:")}s.mount=function(e,t,n={}){var o;const r=ut(e),a=(o=n.clear)!=null?o:!0,i=r.length>1;if(r.length===0)return console.warn("[JSswift.mount] nessun target valido:",e),()=>{};const l=[];for(const c of r){if(a)for(;c.firstChild;)X(c.firstChild),c.removeChild(c.firstChild);const{nodes:u,disposers:d}=ft(t);let p=u;i&&typeof t!="function"&&(p=u.map(S=>S.cloneNode(!0)),d.length&&console.warn("[JSswift.mount] multi-target con dispose: usa content come function per istanze separate."));const v=Oe(d);for(const S of p)c.appendChild(S);l.push({root:c,nodes:p,dispose:v});for(const S of p)!S||!S.nodeType||s._registerCleanup(S,v)}return()=>{var c;for(const u of l){for(const d of u.nodes)d&&(X(d),d.parentNode===u.root&&u.root.removeChild(d));(c=u.dispose)==null||c.call(u)}}},s.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(i){typeof i=="function"&&o.push(i)}});return a&&typeof a=="object"&&"node"in a?{node:a.node,dispose:Je(o,typeof a.dispose=="function"?a.dispose:null)}:{node:a,dispose:Je(o)}}},s.enableAutoCleanup=function(){if(s._autoCleanupEnabled)return;s._autoCleanupEnabled=!0;const e=new MutationObserver(t=>{for(const n of t)for(const o of n.removedNodes)X(o)});e.observe(document.body,{childList:!0,subtree:!0}),s._cleanupObserver=e},s.debug=(()=>{const e={rodFlushes:0,rodNotifies:0,rodBinds:0,rodBindNull:0,rodBindDup:0};function t(){return!!s.config.debug}function n(...f){t()&&console.log("[JSswift]",...f)}function o(...f){t()&&console.warn("[JSswift]",...f)}function r(...f){console.error("[JSswift]",...f)}function a(f,c=1){e[f]||(e[f]=0),e[f]+=c}function i(){return{...e}}function l(){for(const f of Object.keys(e))e[f]=0}return{enabled:t,log:n,warn:o,error:r,inc:a,stats:i,reset:l}})(),s.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 i(y,A=0,C=null){e&&(n.push({t:Date.now(),type:y,ms:A,meta:C}),n.length>r.timelineMax&&n.shift())}function l(y,A=1){e&&(t[y]=(t[y]||0)+A)}function f(y,A){e&&(o.push({t:Date.now(),ms:y,meta:A}),o.length>100&&o.shift())}let c=null;function u(){c||(c=s.reactive.effect,s.reactive.effect=function(y,A){return c((...T)=>{const j=a();l("effectsRun");try{return y(...T)}finally{const F=a()-j;F>=r.slowEffectMs?(l("effectsSlow"),f(F,A||y.name||"effect"),i("effect:slow",F,A||y.name||null)):i("effect",F,A||y.name||null)}})})}function d(){c&&(s.reactive.effect=c,c=null)}function p(y=!0){return e=!!y,e?u():d(),e}function v(){for(const y of Object.keys(t))t[y]=0;n.length=0,o.length=0}function S(){return{enabled:e,...t,slowEffectMs:r.slowEffectMs,timelineSize:n.length}}function x(){return n.slice()}function b(y=r.slowEffectMs){return o.filter(A=>A.ms>=y).slice().sort((A,C)=>C.ms-A.ms)}function E(y,A){const C=a();try{return A()}finally{const T=a()-C;i("time:"+y,T,y)}}function m(y,A){i(y,0,A)}function h(y,A,C){i(y,A,C)}return{enable:p,reset:v,stats:S,timeline:x,slowEffects:b,time:E,mark:m,tick:h,inc:l,cfg:r}})(),s.rod=s.rod||{},s.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,i,l,f,c,u,d;return{key:r.key,el:((a=r.el)==null?void 0:a.nodeType)===3?"#text":(i=r.el)==null?void 0:i.tagName,id:((l=r.el)==null?void 0:l.id)||null,className:((f=r.el)==null?void 0:f.className)||null,isConnected:((c=r.el)==null?void 0:c.nodeType)===3?!!r.el.parentNode:(d=(u=r.el)==null?void 0:u.isConnected)!=null?d:null}}),actionsCount:Array.isArray(e._actions)?e._actions.length:null,disposed:!!e._disposed};return s.config.debug?(console.groupCollapsed(`[JSswift.rod.inspect] ${t}`),console.log(o),console.groupEnd()):console.log(o),o},s.rod.inspectAll=function(){const e=s.rod._all?Array.from(s.rod._all):[];return e.forEach((t,n)=>s.rod.inspect(t,`rod#${n+1}`)),e.length},s._storeShared=(()=>{function e(a){return`${a.storage}::${a.prefix}`}function t(a,i){function l(d={}){var p,v;const S={storage:(p=d.storage)!=null?p:a.storage,prefix:(v=d.prefix)!=null?v:a.prefix};return i.set(e(S),S),S}function f(d=null){var p;return(typeof d=="string"?d:(p=d==null?void 0:d.storage)!=null?p:a.storage)==="session"?window.sessionStorage:window.localStorage}function c(d,p=null){return(p||l()).prefix+d}function u(d,p=null){const v=p||l();return`${e(v)}::${d}`}return{getScope:l,getStorage:f,fullKey:c,channelKey:u}}function n(a){try{return JSON.parse(a)}catch(i){return}}function o(a){try{return JSON.stringify(a)}catch(i){return}}function r(a,...i){const l=`${a.storage}::${a.prefix}::`;for(const f of i)for(const c of Array.from(f.keys()))c.startsWith(l)&&f.delete(c)}return{createScopeTools:t,safeParse:n,safeStringify:o,clearScopedMapEntries:r}})(),s.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:i,safeParse:l,safeStringify:f,clearScopedMapEntries:c}=s._storeShared,{getScope:u,getStorage:d,fullKey:p,channelKey:v}=i(e,r);function S(N,P,M=null){var z;const g=M||u(),w=n.get(v(N,g));if(w)for(const O of w)try{(z=s.reactive)!=null&&z.untracked?s.reactive.untracked(()=>O(P)):O(P)}catch(I){console.error("[store] watcher error:",I)}}function x(){a=!1;for(const[N,P]of Array.from(o.entries())){o.delete(N);const M=t.get(N),z=f(M);if(z===void 0)continue;const g=d(P.scope);try{g.setItem(p(P.key,P.scope),z)}catch(w){console.error("[store] write error:",w)}}}function b(N,P=null){const M=P||u();o.set(v(N,M),{key:N,scope:M}),!a&&(a=!0,e.writeDelay>0?setTimeout(x,e.writeDelay):queueMicrotask(x))}function E(N,P=null){const M=P||u(),g=d(M).getItem(p(N,M));if(g!=null)return l(g)}function m(N,P,M=null){const z=M||u(),g=v(N,z);if(t.has(g))return t.get(g);const w=E(N,z);return w!==void 0?(t.set(g,w),w):P}function h(N,P,M=null){const z=M||u();return t.set(v(N,z),P),b(N,z),S(N,P,z),P}function y(N,P=null){const M=P||u(),z=v(N,M);t.delete(z),o.delete(z);try{d(M).removeItem(p(N,M))}catch(g){}S(N,void 0,M)}function A(N={}){const P=u(N),M=d(P),z=[];for(let g=0;g<M.length;g++){const w=M.key(g);w&&w.startsWith(P.prefix)&&z.push(w)}for(const g of z)M.removeItem(g);c(P,t,o,n)}function C(N,P,M=null){if(typeof P!="function")return()=>{};const z=M||u(),g=v(N,z);return n.has(g)||n.set(g,new Set),n.get(g).add(P),()=>{var w;return(w=n.get(g))==null?void 0:w.delete(P)}}function T(N,P,M={}){const z=u({storage:M.storage,prefix:M.prefix}),g=m(N,P,z),[w,O,I]=s.reactive.signal(g),D=s.reactive.effect(()=>{const L=w();h(N,L,z)}),R=C(N,L=>{w()!==L&&O(L)},z);return[w,O,()=>{try{D==null||D()}catch(L){}try{R==null||R()}catch(L){}try{I==null||I()}catch(L){}}]}u(),e.syncTabs&&window.addEventListener("storage",N=>{if(!(!N.key||!N.storageArea))for(const P of r.values()){if(d(P)!==N.storageArea||!N.key.startsWith(P.prefix))continue;const M=N.key.slice(P.prefix.length),z=N.newValue==null?void 0:l(N.newValue),g=v(M,P);z===void 0?t.delete(g):t.set(g,z),S(M,z,P)}});function j(N={}){Object.assign(e,N),u()}function F(){return{prefix:e.prefix,storage:e.storage,syncTabs:e.syncTabs,cacheSize:t.size,scopeCount:r.size}}return{configure:j,stats:F,get:m,set:h,remove:y,clear:A,watch:C,signal:T}})(),s.store.computed=function(e){if(typeof e!="function")throw new Error("store.computed: fn must be a function");return s.reactive.computed(e)},s.store.migrate=function(e,t,n={}){var o,r;const a=(o=n.versionKey)!=null?o:"__version",i=Number((r=s.store.get(a,0))!=null?r:0),l=Number(e!=null?e:0);if(!Number.isFinite(l)||l<0)throw new Error("store.migrate: targetVersion non valido");if(i>=l)return{from:i,to:l,applied:0};let f=0;for(let c=i;c<l;c++){const u=t==null?void 0:t[c];if(typeof u=="function")try{u(s.store)}catch(d){console.error("[store.migrate] step error at version",c,d)}f++,s.store.set(a,c+1)}return{from:i,to:l,applied:f}},s.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,i]=s.store.signal(t,n,{storage:o.storage,prefix:o.prefix}),l=s.rodFromSignal(r,a),f=s.rodModel(e,l,{event:o.event,parse:o.parse,format:o.format});return()=>{var c;try{f==null||f()}catch(u){}try{i==null||i()}catch(u){}try{(c=l.dispose)==null||c.call(l)}catch(u){}}},s.store.bind=function(e,t,n,o={}){var r;let a=e;return typeof e=="string"&&(e.includes("[")||e.includes(" ")?a=document.querySelectorAll(e):a=s.dom.q(e)),a?s.store.model(a,t,n,o):((r=s.config)!=null&&r.debug&&console.warn("[store.bind] target non trovato:",e),()=>{})},s.store.bindAll=function(e,t={},n={}){if(typeof e=="string"&&(e=s.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 i=e.querySelectorAll(`[name="${r}"]`);if(!i.length)continue;const l=s.store.model(i.length===1?i[0]:i,r,a,n);o.push(l)}return()=>o.forEach(r=>r())},s.store.inspect=function(){const e={...s.store.stats(),keys:Array.from((function(){const t=s.store.stats().storage==="session"?sessionStorage:localStorage,n=[];for(let o=0;o<t.length;o++){const r=t.key(o);r&&r.startsWith(s.store.stats().prefix)&&n.push(r.replace(s.store.stats().prefix,""))}return n})())};return console.groupCollapsed("[JSswift.store.inspect]"),console.table(e.keys),console.log(e),console.groupEnd(),e},s.store.autoForm=function(e,t={},n={}){var o;const r=s.store.bindAll(e,t,n);return(o=s.config)!=null&&o.debug&&console.log("[store.autoForm] autosave attivo:",t),r},s.useStore=function(e,t,n,o={}){const[r,a,i]=s.store.signal(e,t,o);return n&&typeof n.onDispose=="function"&&typeof i=="function"&&n.onDispose(i),[r,a]},s._plugins=new Set,s.usePlugin=function(e,t){var n;if(e){if(s._plugins.has(e)){(n=s.config)!=null&&n.debug&&console.warn("[JSswift.usePlugin] plugin gi\xE0 installato:",e.name||e);return}if(typeof e=="function"){e(s,t),s._plugins.add(e);return}if(e&&typeof e.install=="function"){e.install(s,t),s._plugins.add(e);return}console.warn("[JSswift.usePlugin] plugin non valido:",e)}},s.plugins=s.plugins||{},s.plugins.debug={install(e){e.config.debug=!0,console.log("[JSswift] Debug mode ON")}},s.plugins.forms={install(e){const t={};e.forms={validate(n,o={},r={}){var a,i;if(typeof n=="string"&&(n=e.dom.q(n)),!n||!n.querySelectorAll)return console.warn("[forms.validate] form non valido:",n),null;const l={mode:r.mode||"input",showMessages:(a=r.showMessages)!=null?a:!0,submitGuard:(i=r.submitGuard)!=null?i:!0,errorClass:r.errorClass||"is-invalid",validClass:r.validClass||"is-valid",messageClass:r.messageClass||"form-error"},f={};for(const[p,v]of Object.entries(o)){const S=n.querySelectorAll(`[name="${p}"]`);if(!S.length)continue;const[x,b]=e.reactive.signal(null);f[p]={getErr:x,setErr:b,els:S};let E=null;l.showMessages&&(E=document.createElement("div"),E.className=l.messageClass,S[S.length-1].after(E));const m=()=>{let h;const y=S[0];if(y.type==="checkbox")h=y.checked;else if(y.type==="radio"){const T=Array.from(S).find(j=>j.checked);h=T?T.value:null}else h=y.value;let A=!0;try{A=v(h)}catch(T){A=T.message||"Errore di validazione"}const C=A===!0?null:typeof A=="string"?A:"Valore non valido";return b(C),!C};for(const h of S)h.addEventListener(l.mode,m);e.reactive.effect(()=>{const h=x();for(const y of S)y.classList.toggle(l.errorClass,!!h),y.classList.toggle(l.validClass,!h);E&&(E.textContent=h||"",E.style.display=h?"block":"none")}),m()}const c=e.store.computed(()=>Object.values(f).every(p=>!p.getErr())),u=p=>{let v=!0;for(const S of Object.values(f)){const x=S.els[0];x&&x.dispatchEvent(new Event(l.mode,{bubbles:!0})),S.getErr()&&(v=!1)}!v&&l.submitGuard&&(p.preventDefault(),p.stopPropagation())};l.submitGuard&&n.addEventListener("submit",u);const d=()=>{l.submitGuard&&n.removeEventListener("submit",u)};return t[n]={isValid:c,dispose:d},{isValid:c,dispose:d}}}}},s._authShared=(()=>{function e(o){const r=()=>{var i;return((i=o())==null?void 0:i.roles)||[]},a=()=>{var i;return((i=o())==null?void 0:i.permissions)||[]};return{roles:r,perms:a,hasRole:i=>r().includes(i),can:i=>a().includes(i),canAny:i=>i.some(l=>r().includes(l)||a().includes(l)),canAll:i=>i.every(l=>r().includes(l)||a().includes(l))}}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 i(){return Date.now()}function l(p){if(!p||typeof p!="string")return null;const v=p.split(".");if(v.length<2)return null;try{const S=v[1].replace(/-/g,"+").replace(/_/g,"/"),x=decodeURIComponent(atob(S).split("").map(b=>"%"+b.charCodeAt(0).toString(16).padStart(2,"0")).join(""));return JSON.parse(x)}catch(S){return null}}function f(){var p,v,S,x;if(typeof r._getState=="function"){const b=r._getState();return b&&typeof b=="object"?b:{user:(v=(p=r.user)==null?void 0:p.call(r))!=null?v:null}}return{user:(x=(S=r.user)==null?void 0:S.call(r))!=null?x:null}}function c(){var p,v,S;const x=f()||{},b=(v=x.user)!=null?v:(p=r.user)==null?void 0:p.call(r),E=(b==null?void 0:b.name)||(b==null?void 0:b.email)||(b==null?void 0:b.id)||"anon",m=!!((S=r.isAuth)!=null&&S.call(r)),h=x.expiresAt||null,y=h?h-i():null;return m?`AUTH \u2705 user=${E}${h?` expiresIn=${Math.round(y/1e3)}s`:""}`:`AUTH \u274C user=${E}`}function u(p="auth"){var v,S,x;const b=f()||{},E=(S=b.user)!=null?S:(v=r.user)==null?void 0:v.call(r),m=(E==null?void 0:E.roles)||[],h=(E==null?void 0:E.permissions)||[],y=b.accessToken||null,A=b.refreshToken||null,C=y?l(y):null,T=b.expiresAt||(C!=null&&C.exp?C.exp*1e3:null),j=i(),F=T?T-j:null,N={label:p,isAuth:!!((x=r.isAuth)!=null&&x.call(r)),user:E,roles:m,permissions:h,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:!!y,hasRefresh:!!A,expiresAt:T,expiresInSec:F==null?null:Math.round(F/1e3),decodedJWT:C}};return console.groupCollapsed(`[JSswift.auth.inspect] ${p}`),console.log("status:",c()),console.log(N),F!=null&&(F<=0?console.warn("\u26A0\uFE0F Access token scaduto."):F<6e4&&console.warn("\u26A0\uFE0F Access token in scadenza (<60s).")),console.groupEnd(),N}function d(p=!0){a=!!p,console.log("[JSswift.auth.trace]",a?"ON":"OFF")}if(typeof r.fetch=="function"&&!r._fetchWrapped){const p=r.fetch.bind(r);r.fetch=async(...v)=>{const S=await p(...v);if(a)try{console.log("[auth.fetch]",S.status,v[0])}catch(x){}return S},r._fetchWrapped=!0}r.decodeJWT=l,r.status=c,r.inspect=u,r.trace=d}return{createPermissionApi:e,matchesProtectedPath:t,attachDevTools:n}})(),s.plugins.auth={install(e,t={}){var n;const{createPermissionApi:o,matchesProtectedPath:r,attachDevTools:a}=s._authShared,i={key:t.key||"auth",loginRoute:t.loginRoute||"/login",protected:t.protected||[],autoRedirect:(n=t.autoRedirect)!=null?n:!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},[l,f]=e.store.signal(i.key,null),c=()=>{var C;return((C=l())==null?void 0:C.user)||null},u=()=>{var C;return!!((C=l())!=null&&C.accessToken)},{hasRole:d,can:p,canAny:v,canAll:S}=o(c);let x=!1,b=[];function E(){const C=l();return C!=null&&C.expiresAt?Date.now()>C.expiresAt-i.refreshMargin:!1}async function m(){var C;if(x)return new Promise((T,j)=>b.push({res:T,rej:j}));x=!0;try{const T=await fetch(i.endpoints.refresh,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:(C=l())==null?void 0:C.refreshToken})});if(!T.ok)throw new Error("Refresh failed");const j=await T.json();return f({...l(),...j}),b.forEach(F=>F.res(!0)),b=[],!0}catch(T){throw b.forEach(j=>j.rej(T)),b=[],f(null),i.autoRedirect&&e.router.navigate(i.loginRoute),T}finally{x=!1}}async function h(C){const T=await fetch(i.endpoints.login,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)});if(!T.ok)throw new Error("Login failed");const j=await T.json();return f(j),j}async function y(){try{await fetch(i.endpoints.logout,{method:"POST"})}catch(C){}f(null),i.autoRedirect&&e.router.navigate(i.loginRoute)}async function A(C,T={}){var j;E()&&await m();const F=l(),N=new Headers(T.headers||{});F!=null&&F.accessToken&&N.set(i.tokenHeader,i.tokenPrefix+F.accessToken);const P=await fetch(C,{...i.fetchOptions,...T,headers:N});return P.status===401&&((j=l())!=null&&j.refreshToken)&&!T._authRetried?(await m(),A(C,{...T,_authRetried:!0})):P}e.router.beforeEach(C=>{const T=C.path;return r(T,i.protected)&&!u()?i.loginRoute:!0}),e.auth={user:c,isAuth:u,hasRole:d,can:p,canAny:v,canAll:S,loginAsync:h,logoutAsync:y,fetch:A,_getState:l},e.useAuth=function(C){return C&&C.onDispose,e.auth},a(s,e.auth)}},s._httpShared=(()=>{function e(c){var u;const d=c.reactive,[p,v]=d.signal(0),[S,x]=d.signal("idle"),[b,E]=d.signal(null),[m,h]=d.signal(null),[y,A]=d.signal(null),[C,T]=d.signal(0),[j,F]=d.signal(0);let N=0;function P(g){const w=++N,O=Date.now();return v(p()+1),x("pending"),A(null),h(null),E({id:w,url:g.url,method:g.method,meta:g.meta,timeout:g.timeout,retry:g.retry,startedAt:O}),F(O),w}function M(g,w,O,I){const D=Date.now();v(Math.max(0,p()-1)),g===N&&(O?(x("error"),A(O),h(null)):w?(x("success"),A(null),h({id:g,status:w.status,ok:w.ok,headers:w.headers,url:w.url,receivedAt:D,raw:w})):(x("idle"),A(null),h(null)),T(Math.max(0,Number(I||0)))),F(D)}return{state:{inFlight:p,status:S,isLoading:(u=c.store)!=null&&u.computed?c.store.computed(()=>p()>0):()=>p()>0,lastRequest:b,lastResponse:m,lastError:y,lastDuration:C,lastUpdated:j,reset(){v(0),x("idle"),E(null),h(null),A(null),T(0),F(Date.now())}},markStart:P,markEnd:M}}function t(c,u){if(!c||/^https?:\/\//i.test(u))return u;const d=c.endsWith("/")?c.slice(0,-1):c,p=u.startsWith("/")?u:"/"+u;return d+p}function n(c){return new Promise(u=>setTimeout(u,c))}function o(c,u){return c?!0:u?u.status===429||u.status>=500&&u.status<=599:!1}function r(c,u){if(!c&&!u)return{signal:void 0,cancel:()=>{}};const d=new AbortController,p=d.signal;let v=null;c>0&&(v=setTimeout(()=>d.abort(new Error("timeout")),c));const S=()=>d.abort(u.reason||new Error("aborted"));return u&&(u.aborted?S():u.addEventListener("abort",S,{once:!0})),{signal:p,cancel:()=>{var b;v&&clearTimeout(v),u&&((b=u.removeEventListener)==null||b.call(u,"abort",S))}}}function a(c,u,d={}){var p,v,S;const x=typeof u=="string"?t(c.baseURL,u):u,b=(d.method||"GET").toUpperCase(),E=new Headers(c.headers);return d.headers&&new Headers(d.headers).forEach((m,h)=>E.set(h,m)),{url:x,method:b,headers:E,body:d.body,credentials:(p=d.credentials)!=null?p:c.credentials,signal:d.signal,timeout:(v=d.timeout)!=null?v:c.timeout,retry:(S=d.retry)!=null?S:c.retry,meta:d.meta||{}}}async function i(c,...u){var d;let p=u[0];for(const v of c)p=(d=await v(p,...u.slice(1)))!=null?d:p;return p}function l(c,u){return{ok:c.ok,status:c.status,headers:c.headers,raw:c,req:u,async json(){let d=null,p=null;try{d=await c.json()}catch(v){d=null}return c.ok||(p=d!=null?d:{status:c.status}),{data:d,error:p,ok:c.ok,status:c.status}},async jsonStrict(){const{data:d,error:p}=await this.json();if(p){const v=new Error(`HTTP error ${c.status} ${(u==null?void 0:u.method)||""} ${(u==null?void 0:u.url)||""}`.trim());throw v.status=c.status,v.data=d,v.req={url:u==null?void 0:u.url,method:u==null?void 0:u.method,meta:u==null?void 0:u.meta},v}return{data:d,ok:!0,status:c.status}},async text(){let d="";try{d=await c.text()}catch(p){}return{text:d,ok:c.ok,status:c.status}},async textStrict(){const d=await this.text();if(!d.ok){const p=new Error("HTTP error "+c.status);throw p.status=c.status,p.text=d.text,p}return d}}}function f(c,u,d,p,v={}){const S=new Headers(v.headers||{});return S.has("Content-Type")||S.set("Content-Type","application/json"),c(d,{...v,method:u,headers:S,body:p==null?void 0:JSON.stringify(p)})}return{createReactiveState:e,joinURL:t,sleep:n,isRetryable:o,makeAbort:r,normalizeRequest:a,runHooks:i,wrapResponse:l,withJSON:f}})();const{createReactiveState:dt,sleep:Fe,isRetryable:ze,makeAbort:pt,normalizeRequest:ht,runHooks:Ie,wrapResponse:Be,withJSON:ne}=s._httpShared,re=typeof globalThis!="undefined"&&globalThis.JSswift_setting?globalThis.JSswift_setting:{},qe={baseURL:((be=re.http)==null?void 0:be.baseURL)||"",timeout:(_e=(we=re.http)==null?void 0:we.timeout)!=null?_e:0,retry:((Se=re.http)==null?void 0:Se.retry)||{attempts:0,delay:250,factor:2},headers:((Ae=re.http)==null?void 0:Ae.headers)||{},credentials:(Ee=re.http)==null?void 0:Ee.credentials,debug:(Ce=re.debug)!=null?Ce:!1},me=dt(s),ue=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now(),K={beforeRequest:new Set,afterResponse:new Set,onError:new Set};async function mt(e){const t=s.auth&&typeof s.auth.fetch=="function"?s.auth.fetch.bind(s.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 $(e,t={}){var n,o,r;let a=ht(qe,e,t);a=await Ie(K.beforeRequest,a);const i=me.markStart(a),l=ue(),f=a.retry||{attempts:0,delay:250,factor:2},c=Math.max(0,Number(f.attempts||0));let u=Math.max(0,Number(f.delay||0));const d=Math.max(1,Number(f.factor||2));let p=null,v=null,S=null,x=null;try{for(let b=0;b<=c;b++){p=null,v=null;const{signal:E,cancel:m}=pt(a.timeout,t.signal),h={...a,signal:E},y=ue();try{qe.debug&&console.log("[http.request]",h.method,h.url),(n=s.perf)==null||n.inc("httpRequests"),(o=s.perf)==null||o.mark("http:req",{url:a.url,method:a.method});const A=await mt(h);v=A;const C=await Ie(K.afterResponse,A,h),T=ue()-y;if((r=s.perf)==null||r.tick("http:res",T,{status:A.status,url:a.url}),b<c&&ze(null,C)){m(),await Fe(u),u=Math.round(u*d);continue}return m(),S=C,Be(C,h)}catch(A){p=A,m();for(const C of K.onError)try{C(A,h)}catch(T){}if(b<c&&ze(A,null)){await Fe(u),u=Math.round(u*d);continue}throw x=A,A}}}finally{const b=ue()-l;me.markEnd(i,S,x,b)}if(p)throw p;return Be(v,a)}s.http={},s.http.request=$,s.http.state=()=>me.state,s.http.get=(e,t)=>$(e,{...t,method:"GET"}),s.http.del=(e,t)=>$(e,{...t,method:"DELETE"}),s.http.post=(e,t,n)=>ne($,"POST",e,t,n),s.http.put=(e,t,n)=>ne($,"PUT",e,t,n),s.http.patch=(e,t,n)=>ne($,"PATCH",e,t,n),s.http.getJSON=async(e,t)=>(await $(e,{...t,method:"GET"})).jsonStrict(),s.http.delJSON=async(e,t)=>(await $(e,{...t,method:"DELETE"})).jsonStrict(),s.http.postJSON=async(e,t,n)=>(await ne($,"POST",e,t,n)).jsonStrict(),s.http.putJSON=async(e,t,n)=>(await ne($,"PUT",e,t,n)).jsonStrict(),s.http.patchJSON=async(e,t,n)=>(await ne($,"PATCH",e,t,n)).jsonStrict(),s.http.onBefore=function(e){return K.beforeRequest.add(e),()=>K.beforeRequest.delete(e)},s.http.onAfter=function(e){return K.afterResponse.add(e),()=>K.afterResponse.delete(e)},s.http.onError=function(e){return K.onError.add(e),()=>K.onError.delete(e)},window._http=s.http,s.useRouter=function(e){const t=s.router;return e&&e.onDispose,{navigate:t.navigate,back:()=>history.back(),forward:()=>history.forward(),get current(){return t}}},s.useRoute=function(e){const[t,n]=s.reactive.signal(""),[o,r]=s.reactive.signal({}),[a,i]=s.reactive.signal({}),[l,f]=s.reactive.signal(""),c=d=>{n(d.path||""),r(d.params||{}),i(d.query||{}),f(d.hash||"")},u=s.router.subscribe(c);return e&&typeof e.onDispose=="function"&&e.onDispose(u),{path:t,params:o,query:a,hash:l}},s._routerShared=(()=>{function e(l){return l?(l.startsWith("/")||(l="/"+l),l.length>1&&l.endsWith("/")&&(l=l.slice(0,-1)),l):"/"}function t(l,f=""){if(f&&l.startsWith(f)){const c=l.slice(f.length)||"/";return e(c)}return e(l)}function n(l){l=e(l);const f=[],c=l.replace(/([.+*?=^!${}()[\]|/\\])/g,"\\$1").replace(/\\\/:([A-Za-z0-9_]+)/g,(u,d)=>(f.push(d),"\\/([^\\/]+)"));return{pattern:l,regex:new RegExp("^"+c+"$"),keys:f}}function o(l){const f={};return new URLSearchParams(l||"").forEach((u,d)=>{f[d]===void 0?f[d]=u:Array.isArray(f[d])?f[d].push(u):f[d]=[f[d],u]}),f}function r(l){const f=[];for(const c of l)if(f.push({...c,_parent:null}),c.children&&c.children.length)for(const u of c.children)f.push({...u,_parent:c});return f.sort((c,u)=>u.path.length-c.path.length),f}function a(l,f){const c=e(l),u=r(f);for(const d of u){const p=d._compiled.regex.exec(c);if(!p)continue;const v={};return d._compiled.keys.forEach((S,x)=>{v[S]=decodeURIComponent(p[x+1])}),{route:d,params:v,parent:d._parent||null}}return null}function i(l,f,c=50){l.push({at:Date.now(),path:f.path,params:f.params,query:f.query,hash:f.hash}),l.length>c&&l.shift()}return{normalizePath:e,stripBase:t,compilePattern:n,parseQuery:o,flattenRoutes:r,matchRoute:a,pushHistoryEntry:i}})(),s._uiMetaShared=(()=>{function e(i){return{hasTabPanel:typeof i.TabPanel=="function",Card:typeof i.Card=="function"?i.Card:(...l)=>i.div({class:"jss-doc-card"},...l),Chip:typeof i.Chip=="function"?i.Chip:(l,f)=>i.span({class:"jss-chip jss-chip-fallback"},f)}}function t(i){return i?Array.isArray(i)?i.join(" | "):String(i):"\u2014"}function n(i,l,f){return i.div({class:"jss-doc-meta"},i.div({class:"jss-doc-meta-head"},i.div({class:"jss-doc-meta-name"},l.name),i.div({class:"jss-doc-meta-types"},...l.type?String(l.type).split("|").map(c=>f({color:"secondary",dense:!0,outline:!0},c)):[i.span("\u2014")])),i.div({class:"jss-doc-meta-grid"},i.div({class:"jss-doc-meta-block"},i.div({class:"jss-doc-meta-label"},"Default"),i.div({class:"jss-doc-meta-value"},l.default==null?"\u2014":String(l.default))),i.div({class:"jss-doc-meta-block"},i.div({class:"jss-doc-meta-label"},"Values"),i.div({class:"jss-doc-meta-value"},t(l.values)))),i.div({class:"jss-doc-meta-block"},i.div({class:"jss-doc-meta-label"},"Description"),i.div({class:"jss-doc-meta-value"},l.description||"\u2014")))}function o(i,l){return i.div({class:"jss-doc-fallback"},l.map(f=>i.div({class:"jss-doc-fallback-item"},i.h4({class:"jss-doc-fallback-title"},f.label||f.name),f.content)))}function r(i,l){return l?Array.isArray(l)?l.map(f=>({name:f.name,wrap:!0,label:f.name,content:i.div({class:"jss-p-md"},f.description)})):Object.entries(l).map(([f,c])=>({name:f,wrap:!0,label:f,content:i.div({class:"jss-p-md"},c)})):[]}function a(i,l){return l?Array.isArray(l)?l.map(f=>({name:f.name,wrap:!0,label:f.type,content:f.description})):Object.entries(l).map(([f,c])=>({name:f,wrap:!0,label:f,content:i.div({class:"jss-doc-meta"},i.div({class:"jss-doc-meta-head"},i.div({class:"jss-doc-meta-name"},f)),i.div({class:"jss-doc-meta-grid"},i.div({class:"jss-doc-meta-block"},i.div({class:"jss-doc-meta-label"},"Type"),i.div({class:"jss-doc-meta-value"},c.type||"\u2014"))),i.div({class:"jss-doc-meta-block"},i.div({class:"jss-doc-meta-label"},"Description"),i.div({class:"jss-doc-meta-value"},c.description||"\u2014")))})):[]}return{resolveDocComponents:e,renderMetaItem:n,renderTabGroupFallback:o,normalizeEventRows:r,normalizeSlotRows:a}})(),s.ui=s.ui||{},s.ui.meta=s.ui.meta||{},s.ui.slot=function(t,n={}){const o=s.ui,{as:r="node",wrap:a="span",iconProps:i=null,filter:l=!0}=n,f=p=>document.createTextNode(String(p)),c=p=>_.span(String(p)),u=p=>{if(p==null||p===!1)return null;if(typeof p=="function")return p;if(Array.isArray(p))return p.flatMap(u).filter(Boolean);if(p&&typeof p=="object"&&p.nodeType)return p;if(typeof p=="string"||typeof p=="number"||typeof p=="boolean"){const v=String(p);return r==="icon"&&o.Icon?o.Icon(v,{class:"jss-slot-icon",...i||{}}):a==="text"?f(v):a==="span"?c(v):v}return a==="text"?f(p):a==="span"?c(p):String(p)},d=u(t);return l&&Array.isArray(d)?d.filter(Boolean):d},s.ui.slots=function(...t){const n=[];for(const o of t){const r=s.ui.slot(o);r&&(Array.isArray(r)?n.push(...r):n.push(r))}return n},s.docTable=e=>{var t;if(!s.isDev())return _.div();const{resolveDocComponents:n,renderMetaItem:o,renderTabGroupFallback:r,normalizeEventRows:a,normalizeSlotRows:i}=s._uiMetaShared,l=(t=s.ui.meta)==null?void 0:t[e];if(!l)return _.div({class:"jss-muted"},`Meta non trovata: ${e}`);const{hasTabPanel:f,Card:c,Chip:u}=n(_),d={};Object.entries(l.props||{}).forEach(([m,h])=>{const y=h.category||"general";d[y]||(d[y]=[]),d[y].push({name:m,...h})});const p=Object.keys(d).map(m=>{const h=d[m].map(y=>({name:y.name,wrap:!0,label:y.name,content:o(_,y,u)}));return{name:m,wrap:!0,label:m,content:f?_.TabPanel({orientation:"vertical",animated:!0,radius:"0 0 0 var(--jss-r-default)",tabs:h}):r(_,h)}}),v=a(_,l.events),S=i(_,l.slots),x=_.rod(null),b=[];S.length&&b.push({name:"Slots",wrap:!0,label:"Slots",content:f?_.TabPanel({animated:!0,radius:"0 0 0 var(--jss-r-default)",orientation:"vertical",tabs:S}):r(_,S)}),p.length&&b.push(...p),v.length&&b.push({name:"Events",wrap:!0,label:"Events",content:f?_.TabPanel({animated:!0,radius:"0 0 0 var(--jss-r-default)",orientation:"vertical",tabs:v}):r(_,v)});const E="general";return b.sort((m,h)=>m.name===E?-1:h.name===E?1:m.name.localeCompare(h.name)),c({class:"jss-doc-table"},_.div({class:"jss-doc-table-header"},_.div({class:"jss-doc-table-title"},`_.${e}`),l.signature?_.div({class:"jss-doc-table-signature"},String(l.signature).replaceAll("UI.","_.")):null),b.length?_.h4({class:"jss-doc-table-section-title"},p.length?"Props":"Documentation"):_.p({class:"jss-muted"},"Nessuna documentazione strutturata disponibile."),b.length?f?_.TabPanel({border:!0,animated:!0,orientation:"horizontal",tabs:b,model:x}):r(_,b):null,l.returns?_.p({class:"jss-muted",style:{marginTop:"14px"}},`Returns: ${l.returns}`):null)},s.ui.inspect=e=>{var t;return console.log(((t=s.ui.meta)==null?void 0:t[e])||"meta not found")},s.ui.can=function(e,t,n,o=null){var r,a;const i=s.useAuth?s.useAuth(e):s.auth;return i?(typeof t=="function"?!!t(i):((r=i.can)==null?void 0:r.call(i,t))||((a=i.hasRole)==null?void 0:a.call(i,t)))?typeof n=="function"?n():n:typeof o=="function"?o():o:typeof o=="function"?o():null},s.ui.canAny=function(e,t,n,o=null){var r;const a=s.useAuth?s.useAuth(e):s.auth;return!!((r=a==null?void 0:a.canAny)!=null&&r.call(a,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},s.ui.canAll=function(e,t,n,o=null){var r;const a=s.useAuth?s.useAuth(e):s.auth;return!!((r=a==null?void 0:a.canAll)!=null&&r.call(a,t))?typeof n=="function"?n():n:typeof o=="function"?o():o},s.Can=function(t,n){var o,r;const a=s.useAuth?s.useAuth(n):s.auth;return(()=>{var l,f,c,u;return a?t.when&&typeof t.when=="function"?!!t.when(a):t.perm?!!((l=a.can)!=null&&l.call(a,t.perm)):t.role?!!((f=a.hasRole)!=null&&f.call(a,t.role)):t.any?!!((c=a.canAny)!=null&&c.call(a,t.any)):t.all?!!((u=a.canAll)!=null&&u.call(a,t.all)):!1:!1})()?typeof t.then=="function"?t.then():(o=t.then)!=null?o:null:typeof t.else=="function"?t.else():(r=t.else)!=null?r:null},s.router=(()=>{let e="history",t=[],n=null,o=null,r="",a=null,i=null,l=[],f=!1;const{normalizePath:c,stripBase:u,compilePattern:d,parseQuery:p,matchRoute:v,pushHistoryEntry:S}=s._routerShared,x={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 b(k,{replace:L=!1}={}){const J=typeof k=="string"?new URL(k,window.location.origin):k,B=J.pathname+J.search+J.hash;if(e==="hash"||e==="auto"){if(history.pushState){const U="#"+B;L?history.replaceState({},"",U):history.pushState({},"",U);return}const W="#"+B;L?window.location.replace(W):window.location.hash=W;return}L?history.replaceState({},"",r+B):history.pushState({},"",r+B)}function E(){if(e==="hash"){const k=window.location.hash||"#/",L=k.startsWith("#")?k.slice(1):k;return new URL(L,window.location.origin)}if(e==="auto"&&window.location.hash.startsWith("#/")){const k=window.location.hash.slice(1);return new URL(k,window.location.origin)}return new URL(window.location.href)}function m(k,L=!1){if(e==="hash"||e==="auto"&&!history.pushState){const J="#"+(k.pathname+k.search+k.hash);L?window.location.replace(J):window.location.hash=J;return}L?history.replaceState({},"",r+k.pathname+k.search+k.hash):history.pushState({},"",r+k.pathname+k.search+k.hash)}function h(k){e=k||"history"}function y(k){return u(k,r)}function A(k){if(!k)return!1;const L=i?i.path:y(E().pathname);let J=k;typeof J=="string"&&(J.includes("?")||J.includes("#")||J.includes("://"))&&(J=new URL(J,window.location.origin).pathname);const B=y(J);return B.includes(":")?d(B).regex.test(L):B===L}async function C(k,{replace:L=!1}={}){if(!n){console.warn("[router] outlet non impostato. Usa JSswift.router.setOutlet('#app').");return}const J=typeof k=="string"?new URL(k,window.location.origin):k;f&&console.log("[router.navigate]",J.toString());const B=J.pathname+J.search+J.hash;m(J,L);const W=y(J.pathname),U=v(W,t),q={path:W,fullPath:B,params:U?U.params:{},query:p(J.search),hash:J.hash||"",navigate:T,outlet:n};if(a){const H=await a(q);if(H===!1)return;if(typeof H=="string"){T(H,{replace:!0});return}}if(typeof o=="function"){try{o()}catch(H){console.error("[router] unmount error:",H)}o=null}if(!U){const H=t._notFound;H?o=s.mount(n,()=>H(q),{clear:!0}):o=s.mount(n,_.div("404"),{clear:!0}),w(q),i=q,S(l,q);return}const ee=U.route.view,Y=U.parent;let te=null;if(q.renderChild=H=>{if(!q._child)return null;const se=typeof H=="string"?q.outlet.querySelector(H):H;return se?(te=s.mount(se,()=>q._child.view(q._child.ctx),{clear:!0}),te):(console.warn("[router] child outlet non trovato:",H),null)},Y){const H=U.route,se={...q,params:{...q.params}};q._child={view:H.view,ctx:se},o=s.mount(n,()=>Y.view(q),{clear:!0})}else q._child=null,o=s.mount(n,()=>ee(q),{clear:!0});w(q),i=q,S(l,q)}function T(k,L={}){const J=new URL(k,window.location.origin);C(J,L)}function j(){window.addEventListener("popstate",()=>{C(E(),{replace:!0})}),window.addEventListener("hashchange",()=>{(e==="hash"||e==="auto")&&C(E(),{replace:!0})}),document.addEventListener("click",k=>{var L,J;const B=(J=(L=k.target)==null?void 0:L.closest)==null?void 0:J.call(L,"a");if(!B||k.defaultPrevented||k.button!==0||k.metaKey||k.ctrlKey||k.shiftKey||k.altKey||B.hasAttribute("download")||B.target&&B.target!=="_self")return;const W=B.getAttribute("href");if(!W||W.startsWith("mailto:")||W.startsWith("tel:"))return;const U=new URL(W,window.location.origin);if(U.origin!==window.location.origin)return;const q=new URL(window.location.href);U.pathname+U.search===q.pathname+q.search&&U.hash||(k.preventDefault(),T(U.pathname+U.search+U.hash))}),C(E(),{replace:!0})}function F(k){return n=typeof k=="string"?s.dom.q(k):k,n}function N(k){r=k?c(k):"",r==="/"&&(r="")}function P(k,L,J=null){const B=d(k),W={path:B.pattern,view:L,_compiled:B,children:[]};if(Array.isArray(J))for(const U of J){const[q,ee,Y]=U,te=c(B.pattern+"/"+(q||"").replace(/^\//,""));W.children.push({path:te,view:ee,_compiled:d(te),children:Array.isArray(Y)?Y:[]})}t.push(W)}function M(k){t._notFound=k}function z(k){a=k}let g=new Set;function w(k){for(const L of g)try{L(k)}catch(J){console.error("[router] listener error:",J)}}function O(){if(!i)return"ROUTER \u23F3 not ready";const k=Object.keys(i.query||{}).length?"?":"";return`ROUTER ${i.path}${k} ${i.hash||""}`}function I(k="router"){if(!i)return console.warn("[router.inspect] nessuna route attiva"),null;const L={label:k,mode:typeof e!="undefined"?e:"unknown",base:r,path:i.path,params:i.params,query:i.query,hash:i.hash,outlet:n,timestamp:new Date().toISOString()};return console.groupCollapsed(`[JSswift.router.inspect] ${k}`),console.log(L),console.log("history:",l.slice()),console.groupEnd(),L}function D(k=!0){f=!!k,console.log("[JSswift.router.trace]",f?"ON":"OFF")}function R(){return l.slice()}return{meta:x,setOutlet:F,setBase:N,add:P,setURLOnly:b,notFound:M,beforeEach:z,start:j,navigate:T,isActive:A,subscribe(k){return g.add(k),()=>g.delete(k)},current(){return E?E():new URL(window.location.href)},status:O,inspect:I,trace:D,history:R}})(),(ke=s.config)!=null&&ke.debug&&(window.$router=s.router),s.signal=s.reactive.signal,s.effect=s.reactive.effect,s.computed=s.reactive.computed,s.untracked=s.reactive.untracked,s.batch=s.reactive.batch;function oe(e){return e==null?null:String(e).trim()||null}function ge(e){const t=Array.isArray(e)?e:typeof e=="string"?e.split(","):[],n=[],o=new Set;for(const r of t){const a=oe(r);!a||o.has(a)||(o.add(a),n.push(a))}return n}function ye(){var e;return typeof document!="undefined"&&document.documentElement?document.documentElement:(e=s.dom)!=null&&e.q?s.dom.q("html"):null}function Ue(){try{return typeof globalThis!="undefined"&&globalThis.localStorage||null}catch(e){return null}}function fe(){var e;return oe((e=s.theme)==null?void 0:e.storageKey)||"jsswift:theme"}function We(){const e=Ue();if(!e)return null;try{return oe(e.getItem(fe()))}catch(t){return null}}function gt(e){const t=Ue();if(t)try{e==null?t.removeItem(fe()):t.setItem(fe(),e)}catch(n){}}function He(e){var t,n,o,r,a;const i=ye(),l=[e,(t=s.theme)==null?void 0:t.themes,(n=s.config)==null?void 0:n.themes,typeof globalThis!="undefined"?(o=globalThis.JSswift_setting)==null?void 0:o.themes:null,typeof globalThis!="undefined"?(r=globalThis.JSswift_setting)==null?void 0:r.themeList:null,(a=i==null?void 0:i.getAttribute)==null?void 0:a.call(i,"data-themes")];for(const f of l){const c=ge(f);if(c.length)return c}return[]}s.theme=s.theme||{},s.theme.storageKey=fe(),ge(s.theme.themes).length||(s.theme.themes=He()),s.setTheme=function(e,t={}){const n=oe(e),o=ye();return o&&(n==null?o.removeAttribute("data-theme"):o.setAttribute("data-theme",n)),t.persist!==!1&>(n),o},s.getTheme=function(e={}){var t;const n=ye(),o=oe((t=n==null?void 0:n.getAttribute)==null?void 0:t.call(n,"data-theme"));if(o)return o;if(e.storage===!1)return null;const r=We();return r&&n&&e.sync!==!1&&n.setAttribute("data-theme",r),r},s.toggleTheme=function(e,t={}){const n=He(e),o=n.length?n:ge([s.getTheme({sync:!1}),"light","dark"]),r=s.getTheme({sync:!1}),a=oe(t.fallback)||o[0]||"light",i=r?o.indexOf(r):-1,l=i>=0?o[(i+1)%o.length]:a;return s.theme.themes=o.slice(),s.setTheme(l,t),l};const Ve=We();Ve&&s.setTheme(Ve,{persist:!1})})();
|
package/package.json
CHANGED
package/src/09-overlay-shared.js
CHANGED
|
@@ -15,21 +15,21 @@
|
|
|
15
15
|
const currentRoot = getRoot();
|
|
16
16
|
if (currentRoot && currentRoot.isConnected) return currentRoot;
|
|
17
17
|
|
|
18
|
-
let el = document.getElementById("
|
|
18
|
+
let el = document.getElementById("jss-overlay-root");
|
|
19
19
|
if (!el && document?.body) {
|
|
20
20
|
el = document.createElement("div");
|
|
21
|
-
el.id = "
|
|
22
|
-
el.className = "
|
|
21
|
+
el.id = "jss-overlay-root";
|
|
22
|
+
el.className = "jss-overlay-root";
|
|
23
23
|
document.body.appendChild(el);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
if (!document.body && !el) {
|
|
27
27
|
JSswift.ready(() => {
|
|
28
|
-
let readyEl = document.getElementById("
|
|
28
|
+
let readyEl = document.getElementById("jss-overlay-root");
|
|
29
29
|
if (!readyEl) {
|
|
30
30
|
readyEl = document.createElement("div");
|
|
31
|
-
readyEl.id = "
|
|
32
|
-
readyEl.className = "
|
|
31
|
+
readyEl.id = "jss-overlay-root";
|
|
32
|
+
readyEl.className = "jss-overlay-root";
|
|
33
33
|
document.body.appendChild(readyEl);
|
|
34
34
|
}
|
|
35
35
|
setRoot(readyEl);
|
package/src/10-overlay.js
CHANGED
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
const lockScroll = () => {
|
|
17
17
|
scrollLockCount++;
|
|
18
18
|
if (scrollLockCount === 1) {
|
|
19
|
-
document.documentElement.classList.add("
|
|
19
|
+
document.documentElement.classList.add("jss-scroll-locked");
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
const unlockScroll = () => {
|
|
23
23
|
scrollLockCount = Math.max(0, scrollLockCount - 1);
|
|
24
24
|
if (scrollLockCount === 0) {
|
|
25
|
-
document.documentElement.classList.remove("
|
|
25
|
+
document.documentElement.classList.remove("jss-scroll-locked");
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
const isOverlayInteractivePortal = (target) => {
|
|
36
36
|
let node = target;
|
|
37
37
|
while (node && node !== document) {
|
|
38
|
-
if (node.nodeType === 1 && node.getAttribute?.("data-
|
|
38
|
+
if (node.nodeType === 1 && node.getAttribute?.("data-jss-overlay-portal") === "true") return true;
|
|
39
39
|
node = node.parentNode;
|
|
40
40
|
}
|
|
41
41
|
return false;
|
|
@@ -62,15 +62,15 @@
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
const overlay = document.createElement("div");
|
|
65
|
-
overlay.className = ["
|
|
65
|
+
overlay.className = ["jss-overlay", opts.type ? `type-${opts.type}` : ""].filter(Boolean).join(" ");
|
|
66
66
|
overlay.dataset.id = id;
|
|
67
67
|
|
|
68
68
|
const backdrop = document.createElement("div");
|
|
69
|
-
backdrop.className = "
|
|
69
|
+
backdrop.className = "jss-overlay-backdrop";
|
|
70
70
|
if (!opts.backdrop) backdrop.style.display = "none";
|
|
71
71
|
|
|
72
72
|
const panel = document.createElement("div");
|
|
73
|
-
panel.className = ["
|
|
73
|
+
panel.className = ["jss-overlay-panel", opts.className].filter(Boolean).join(" ");
|
|
74
74
|
panel.tabIndex = -1;
|
|
75
75
|
|
|
76
76
|
// mount content
|
package/src/20-renderer.js
CHANGED
|
@@ -206,7 +206,7 @@ function createElement(tag, ...args) {
|
|
|
206
206
|
};
|
|
207
207
|
|
|
208
208
|
registerNodeEffect(applyFromRod);
|
|
209
|
-
control.
|
|
209
|
+
control._jssApplySelectedValues = applyFromRod;
|
|
210
210
|
queueMicrotask(applyFromRod);
|
|
211
211
|
|
|
212
212
|
const onValueChange = () => {
|
|
@@ -344,8 +344,8 @@ function createElement(tag, ...args) {
|
|
|
344
344
|
bindProp
|
|
345
345
|
});
|
|
346
346
|
|
|
347
|
-
if (tag === "select" && typeof el.
|
|
348
|
-
el.
|
|
347
|
+
if (tag === "select" && typeof el._jssApplySelectedValues === "function") {
|
|
348
|
+
el._jssApplySelectedValues();
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
return el;
|
|
@@ -5,19 +5,16 @@
|
|
|
5
5
|
function cleanupNodeTree(node) {
|
|
6
6
|
if (!node) return;
|
|
7
7
|
|
|
8
|
+
const children = node.childNodes?.length ? Array.from(node.childNodes) : [];
|
|
8
9
|
const disposers = JSswift._cleanupRegistry.get(node);
|
|
9
10
|
if (disposers) {
|
|
11
|
+
JSswift._cleanupRegistry.delete(node);
|
|
10
12
|
for (const d of disposers) {
|
|
11
13
|
try { d(); } catch (e) { console.error("[cleanup] error:", e); }
|
|
12
14
|
}
|
|
13
|
-
JSswift._cleanupRegistry.delete(node);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
for (const child of node.childNodes) {
|
|
18
|
-
cleanupNodeTree(child);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
17
|
+
for (const child of children) cleanupNodeTree(child);
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
function toMountTargets(target) {
|