thecore-auth 0.0.211 → 0.0.212

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.
@@ -28,7 +28,7 @@ React keys must be passed directly to JSX without using spread:
28
28
 
29
29
  Check the render method of \``+P+"`."),F||(f=e(f))&&(F=`
30
30
 
31
- Check the top-level render call using <`+f+">."),F}var y=l,g=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),X=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),G=Symbol.for("react.context"),i0=Symbol.for("react.forward_ref"),w0=Symbol.for("react.suspense"),J0=Symbol.for("react.suspense_list"),d0=Symbol.for("react.memo"),a0=Symbol.for("react.lazy"),A0=Symbol.for("react.offscreen"),z0=Symbol.iterator,u0=Symbol.for("react.client.reference"),N0=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_0=Object.prototype.hasOwnProperty,k0=Object.assign,u2=Symbol.for("react.client.reference"),u1=Array.isArray,s1=0,L0,l0,U,r0,f0,K0,l1;t.__reactDisabledLog=!0;var e1,W,B=!1,S=new(typeof WeakMap=="function"?WeakMap:Map),C=Symbol.for("react.client.reference"),Y,o0={},h0={},M0={};Fe.Fragment=v,Fe.jsx=function(f,F,P,c0,j0){return A(f,F,P,!1,c0,j0)},Fe.jsxs=function(f,F,P,c0,j0){return A(f,F,P,!0,c0,j0)}}()),Fe}var OM;function tc(){return OM||(OM=1,process.env.NODE_ENV==="production"?Ea.exports=ac():Ea.exports=nc()),Ea.exports}var d=tc();const Ns=l.createContext(),oc=({children:e,defaultComponent:a})=>{const[n,t]=l.useState(!1),[o,M]=l.useState({}),[b,s]=l.useState(a),z={isLoading:n,setIsLoading:t,loadingProps:o,setLoadingProps:M,loadingComponent:b,setLoadingComponent:s,showLoadingFor:(p=2e3,c={})=>{M(c),t(!0),setTimeout(()=>{t(!1)},p)}};return d.jsx(Ns.Provider,{value:z,children:e})},K2=()=>{const e=l.useContext(Ns);if(e===void 0)throw new Error("Non puoi settare il loading");return e},Mc="0.0.211",_s=({errorMessage:e,errorShow:a})=>d.jsx("section",{className:a?"":"hidden",children:d.jsxs("div",{className:"container mx-auto",children:[d.jsx("h1",{className:"text-center text-8xl my-12",children:"Errore"}),d.jsx("pre",{className:"text-xl",children:e})]})});function bc(){const[e,a]=l.useState(document.visibilityState),[n,t]=l.useState(document.hasFocus()),[o,M]=l.useState(!1),[b,s]=l.useState(!1),i=()=>{a(document.visibilityState)},z=()=>t(!0),p=()=>t(!1),c=A=>{M(A.persisted),s(!1)},r=()=>{s(!0)};l.useEffect(()=>(document.addEventListener("visibilitychange",i),window.addEventListener("focus",z),window.addEventListener("blur",p),window.addEventListener("pageshow",c),window.addEventListener("pagehide",r),()=>{document.removeEventListener("visibilitychange",i),window.removeEventListener("focus",z),window.removeEventListener("blur",p),window.removeEventListener("pageshow",c),window.removeEventListener("pagehide",r)}),[]);const u=l.useMemo(()=>e==="visible"&&n,[e,n]);return{visibilityState:e,isVisible:e==="visible",isHidden:e==="hidden",hasFocus:n,isActive:u,isFromBFCache:o,isPageHidden:b}}const Bs=l.createContext(),sc=({children:e})=>{const a=bc(),[n,t]=l.useState({}),[o,M]=l.useState(!1),b=l.useRef(!1),s=`Creare un file config.json in public per il corretto funzionamento
31
+ Check the top-level render call using <`+f+">."),F}var y=l,g=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),X=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),G=Symbol.for("react.context"),i0=Symbol.for("react.forward_ref"),w0=Symbol.for("react.suspense"),J0=Symbol.for("react.suspense_list"),d0=Symbol.for("react.memo"),a0=Symbol.for("react.lazy"),A0=Symbol.for("react.offscreen"),z0=Symbol.iterator,u0=Symbol.for("react.client.reference"),N0=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_0=Object.prototype.hasOwnProperty,k0=Object.assign,u2=Symbol.for("react.client.reference"),u1=Array.isArray,s1=0,L0,l0,U,r0,f0,K0,l1;t.__reactDisabledLog=!0;var e1,W,B=!1,S=new(typeof WeakMap=="function"?WeakMap:Map),C=Symbol.for("react.client.reference"),Y,o0={},h0={},M0={};Fe.Fragment=v,Fe.jsx=function(f,F,P,c0,j0){return A(f,F,P,!1,c0,j0)},Fe.jsxs=function(f,F,P,c0,j0){return A(f,F,P,!0,c0,j0)}}()),Fe}var OM;function tc(){return OM||(OM=1,process.env.NODE_ENV==="production"?Ea.exports=ac():Ea.exports=nc()),Ea.exports}var d=tc();const Ns=l.createContext(),oc=({children:e,defaultComponent:a})=>{const[n,t]=l.useState(!1),[o,M]=l.useState({}),[b,s]=l.useState(a),z={isLoading:n,setIsLoading:t,loadingProps:o,setLoadingProps:M,loadingComponent:b,setLoadingComponent:s,showLoadingFor:(p=2e3,c={})=>{M(c),t(!0),setTimeout(()=>{t(!1)},p)}};return d.jsx(Ns.Provider,{value:z,children:e})},K2=()=>{const e=l.useContext(Ns);if(e===void 0)throw new Error("Non puoi settare il loading");return e},Mc="0.0.212",_s=({errorMessage:e,errorShow:a})=>d.jsx("section",{className:a?"":"hidden",children:d.jsxs("div",{className:"container mx-auto",children:[d.jsx("h1",{className:"text-center text-8xl my-12",children:"Errore"}),d.jsx("pre",{className:"text-xl",children:e})]})});function bc(){const[e,a]=l.useState(document.visibilityState),[n,t]=l.useState(document.hasFocus()),[o,M]=l.useState(!1),[b,s]=l.useState(!1),i=()=>{a(document.visibilityState)},z=()=>t(!0),p=()=>t(!1),c=A=>{M(A.persisted),s(!1)},r=()=>{s(!0)};l.useEffect(()=>(document.addEventListener("visibilitychange",i),window.addEventListener("focus",z),window.addEventListener("blur",p),window.addEventListener("pageshow",c),window.addEventListener("pagehide",r),()=>{document.removeEventListener("visibilitychange",i),window.removeEventListener("focus",z),window.removeEventListener("blur",p),window.removeEventListener("pageshow",c),window.removeEventListener("pagehide",r)}),[]);const u=l.useMemo(()=>e==="visible"&&n,[e,n]);return{visibilityState:e,isVisible:e==="visible",isHidden:e==="hidden",hasFocus:n,isActive:u,isFromBFCache:o,isPageHidden:b}}const Bs=l.createContext(),sc=({children:e})=>{const a=bc(),[n,t]=l.useState({}),[o,M]=l.useState(!1),b=l.useRef(!1),s=`Creare un file config.json in public per il corretto funzionamento
32
32
  Esempio di config.json:
33
33
 
34
34
  {
@@ -99,7 +99,7 @@ Esempio di config.json:
99
99
  [data-sileo-badge],[data-sileo-title],[data-sileo-button]
100
100
  )[data-state=info]{--_c:var(--sileo-state-info)}:is(
101
101
  [data-sileo-badge],[data-sileo-title],[data-sileo-button]
102
- )[data-state=action]{--_c:var(--sileo-state-action)}:is([data-sileo-badge],[data-sileo-title])[data-state]{--sileo-tone:var(--_c);--sileo-tone-bg:color-mix(in oklch, var(--_c) 20%, transparent)}[data-sileo-content]{position:absolute;left:0;z-index:10;width:100%;pointer-events:none;opacity:var(--_co, 0)}[data-sileo-content]:not([data-visible=true]){content-visibility:hidden}[data-sileo-toast][data-ready=true] [data-sileo-content]{transition:opacity calc(var(--sileo-duration) * .08) ease calc(var(--sileo-duration) * .04)}[data-sileo-content][data-edge=top]{top:0}[data-sileo-content][data-edge=bottom]{top:var(--sileo-height)}[data-sileo-content][data-visible=true]{pointer-events:auto}[data-sileo-toast][data-ready=true] [data-sileo-content][data-visible=true]{transition:opacity calc(var(--sileo-duration) * .6) ease calc(var(--sileo-duration) * .3)}[data-sileo-description]{width:100%;text-align:left;padding:1rem;font-size:.875rem;line-height:1.25rem;contain:layout style paint;content-visibility:auto}[data-sileo-button]{display:flex;align-items:center;justify-content:center;height:1.75rem;padding:0 .625rem;margin-top:.75rem;border-radius:9999px;border:0;font-size:.75rem;font-weight:500;cursor:pointer;color:var(--sileo-btn-color,currentColor);background-color:var(--sileo-btn-bg,transparent);transition:background-color 150ms ease}[data-sileo-button]:hover{background-color:var(--sileo-btn-bg-hover,transparent)}[data-sileo-button][data-state]{--sileo-btn-color:var(--_c);--sileo-btn-bg:color-mix(in oklch, var(--_c) 15%, transparent);--sileo-btn-bg-hover:color-mix(in oklch, var(--_c) 25%, transparent)}[data-sileo-icon=spin]{animation:sileo-spin 1s linear infinite}@keyframes sileo-spin{to{transform:rotate(360deg)}}@keyframes sileo-header-enter{from{opacity:0;filter:blur(6px)}to{opacity:1;filter:blur(0px)}}@keyframes sileo-header-exit{from{opacity:1;filter:blur(0px)}to{opacity:0;filter:blur(6px)}}[data-sileo-viewport]{position:fixed;z-index:50;display:flex;gap:.75rem;padding:.75rem;pointer-events:none;max-width:calc(100vw - 1.5rem);contain:layout style}[data-sileo-viewport][data-position^=top] [data-sileo-toast]:not([data-ready=true]){margin-bottom:calc(-1 * (var(--sileo-height) + .75rem))}[data-sileo-viewport][data-position^=bottom] [data-sileo-toast]:not([data-ready=true]){margin-top:calc(-1 * (var(--sileo-height) + .75rem))}[data-sileo-viewport][data-position^=top]{top:0;flex-direction:column-reverse}[data-sileo-viewport][data-position^=bottom]{bottom:0;flex-direction:column}[data-sileo-viewport][data-position$=left]{left:0;align-items:flex-start}[data-sileo-viewport][data-position$=right]{right:0;align-items:flex-end}[data-sileo-viewport][data-position$=center]{left:50%;transform:translateX(-50%);align-items:center}@media (prefers-reduced-motion:no-preference){[data-sileo-toast][data-ready=true]:hover,[data-sileo-toast][data-ready=true][data-exiting=true]{will-change:transform,opacity,height}}@media (prefers-reduced-motion:reduce){*,::after,::before{animation-duration:0s;animation-iteration-count:1;transition-duration:0s}}`);const j1=40,Je=350,vd=16,Wz=600,Nd=Wz/1e3,Xe=6e3,_d=Xe*.1,Bd=Xe*.025,Dd=Xe-2e3,St={type:"spring",bounce:.25,duration:Nd},wd=.5,Ja=10,Sd=2.25,Td=200,xd=Wz*.7,ke=e=>{let{title:a,children:n}=e,t=Tc(e,["title","children"]);return d.jsxs("svg",V0({},t,{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("title",{children:a}),n]}))},Xd=()=>d.jsxs(ke,{title:"Arrow Right",children:[d.jsx("path",{d:"M5 12h14"}),d.jsx("path",{d:"m12 5 7 7-7 7"})]}),kd=()=>d.jsxs(ke,{title:"Life Buoy",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("path",{d:"m4.93 4.93 4.24 4.24"}),d.jsx("path",{d:"m14.83 9.17 4.24-4.24"}),d.jsx("path",{d:"m14.83 14.83 4.24 4.24"}),d.jsx("path",{d:"m9.17 14.83-4.24 4.24"}),d.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),Cd=e=>d.jsx(ke,V0({title:"Loader Circle"},e,{children:d.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})),Pd=()=>d.jsxs(ke,{title:"X",children:[d.jsx("path",{d:"M18 6 6 18"}),d.jsx("path",{d:"m6 6 12 12"})]}),Ed=()=>d.jsxs(ke,{title:"Circle Alert",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),d.jsx("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),jd=()=>d.jsx(ke,{title:"Check",children:d.jsx("path",{d:"M20 6 9 17l-5-5"})}),Jb={success:d.jsx(jd,{}),loading:d.jsx(Cd,{"data-sileo-icon":"spin","aria-hidden":"true"}),error:d.jsx(Pd,{}),warning:d.jsx(Ed,{}),info:d.jsx(kd,{}),action:d.jsx(Xd,{})},Id=l.memo(function({filterId:a,blur:n}){return d.jsx("defs",{children:d.jsxs("filter",{id:a,x:"-20%",y:"-20%",width:"140%",height:"140%",colorInterpolationFilters:"sRGB",children:[d.jsx("feGaussianBlur",{in:"SourceGraphic",stdDeviation:n,result:"blur"}),d.jsx("feColorMatrix",{in:"blur",mode:"matrix",values:"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -10",result:"goo"}),d.jsx("feComposite",{in:"SourceGraphic",in2:"goo",operator:"atop"})]})})}),Fd=l.memo(function({id:a,fill:n="#FFFFFF",state:t="success",title:o=t,description:M,position:b="left",expand:s="bottom",className:i,icon:z,styles:p,button:c,roundness:r,exiting:u=!1,autoExpandDelayMs:A,autoCollapseDelayMs:R,canExpand:q,interruptKey:O,refreshKey:m,onMouseEnter:y,onMouseLeave:g,onDismiss:h}){var v,N,X,I,G,i0,w0,J0;const d0=l.useMemo(()=>({title:o,description:M,state:t,icon:z,styles:p,button:c,fill:n}),[o,M,t,z,p,c,n]),[a0,A0]=l.useState(d0),[z0,u0]=l.useState(m),[N0,_0]=l.useState(!1),[k0,u2]=l.useState(!1),[u1,s1]=l.useState(0),[L0,l0]=l.useState(0),U=!!a0.description||!!a0.button,r0=a0.state==="loading",f0=U&&N0&&!r0,K0=r0?!1:q??(!O||O===a),l1=`${a0.state}-${a0.title}`,e1=`sileo-gooey-${a}`,W=Math.max(0,r??vd),B=W*wd,S=l.useRef(null),C=l.useRef(null),Y=l.useRef(null),o0=l.useRef(null),h0=l.useRef(null),M0=l.useRef(null),f=l.useRef(m),F=l.useRef(null),[P,c0]=l.useState({current:{key:l1,view:a0},prev:null}),j0=l.useRef(null),y0=l.useRef(null),Q=l.useRef(null),c1=l.useRef(0),v1=l.useRef(null);l.useLayoutEffect(()=>{const $=j0.current,I0=S.current;if(!$||!I0)return;if(y0.current===null){const i1=getComputedStyle(I0);y0.current=parseFloat(i1.paddingLeft)+parseFloat(i1.paddingRight)}const Z0=y0.current;(()=>{const i1=$.scrollWidth+Z0+Ja;i1>Ja&&s1(E1=>E1===i1?E1:i1)})(),Q.current||(Q.current=new ResizeObserver(()=>{cancelAnimationFrame(c1.current),c1.current=requestAnimationFrame(()=>{var i1;const E1=j0.current,$r=(i1=y0.current)!=null?i1:0;if(!E1)return;const it=E1.scrollWidth+$r+Ja;it>Ja&&s1(zM=>zM===it?zM:it)})})),v1.current!==$&&(v1.current&&Q.current.unobserve(v1.current),Q.current.observe($),v1.current=$)},[P.current.key]),l.useEffect(()=>()=>{var $;cancelAnimationFrame(c1.current),($=Q.current)==null||$.disconnect()},[]),l.useLayoutEffect(()=>{if(!U){l0(0);return}const $=C.current;if(!$)return;const I0=()=>{const i1=$.scrollHeight;l0(E1=>E1===i1?E1:i1)};I0();let Z0=0;const q1=new ResizeObserver(()=>{cancelAnimationFrame(Z0),Z0=requestAnimationFrame(I0)});return q1.observe($),()=>{cancelAnimationFrame(Z0),q1.disconnect()}},[U]),l.useEffect(()=>{const $=requestAnimationFrame(()=>u2(!0));return()=>cancelAnimationFrame($)},[]),l.useLayoutEffect(()=>{c0($=>$.current.key===l1?$.current.view===a0?$:V0({},$,{current:{key:l1,view:a0}}):{prev:$.current,current:{key:l1,view:a0}})},[l1,a0]),l.useEffect(()=>{if(P.prev)return Y.current&&clearTimeout(Y.current),Y.current=window.setTimeout(()=>{Y.current=null,c0($=>V0({},$,{prev:null}))},xd),()=>{Y.current&&(clearTimeout(Y.current),Y.current=null)}},[P.prev]),l.useEffect(()=>{if(m===void 0){A0(d0),u0(void 0),F.current=null,f.current=m;return}f.current!==m&&(f.current=m,M0.current&&(clearTimeout(M0.current),M0.current=null),f0?(F.current={key:m,payload:d0},_0(!1),M0.current=window.setTimeout(()=>{M0.current=null;const $=F.current;$&&(A0($.payload),u0($.key),F.current=null)},Td)):(F.current=null,A0(d0),u0(m)))},[f0,m,d0]),l.useEffect(()=>{if(!U)return;if(o0.current&&clearTimeout(o0.current),h0.current&&clearTimeout(h0.current),u||!K0){_0(!1);return}if(A==null&&R==null)return;const $=A??0,I0=R??0;return $>0?o0.current=window.setTimeout(()=>_0(!0),$):_0(!0),I0>0&&(h0.current=window.setTimeout(()=>_0(!1),I0)),()=>{o0.current&&clearTimeout(o0.current),h0.current&&clearTimeout(h0.current)}},[R,A,U,K0,u,z0]);const G0=j1*Sd,N1=U?Math.max(G0,j1+L0):G0,l2=l.useRef(N1);f0&&(l2.current=N1);const O1=f0?N1:l2.current,T2=U?Math.max(O1,G0):j1,m1=Math.max(0,O1-j1),Q2=Math.max(u1||j1,j1),iM=j1+B*3,ka=b==="right"?Je-Q2:b==="center"?(Je-Q2)/2:0,Cr=l.useMemo(()=>({x:ka,width:Q2,height:f0?iM:j1}),[ka,Q2,f0,iM]),Pr=l.useMemo(()=>({height:f0?m1:0,opacity:f0?1:0}),[f0,m1]),Er=l.useMemo(()=>f0?St:V0({},St,{bounce:0}),[f0]),jr=l.useMemo(()=>k0?St:{duration:0},[k0]),Ir=`0 0 ${Je} ${T2}`,Fr=l.useMemo(()=>({filter:`url(#${e1})`}),[e1]),Hr=l.useMemo(()=>({"--_h":`${f0?O1:j1}px`,"--_pw":`${Q2}px`,"--_px":`${ka}px`,"--_ht":`translateY(${f0?s==="bottom"?3:-3:0}px) scale(${f0?.9:1})`,"--_co":`${f0?1:0}`}),[f0,O1,Q2,ka,s]),Vr=l.useCallback($=>{y==null||y($),U&&_0(!0)},[U,y]),Gr=l.useCallback($=>{g==null||g($),_0(!1)},[g]),Ur=l.useCallback($=>{if($.propertyName!=="height"&&$.propertyName!=="transform"||f0)return;const I0=F.current;I0&&(M0.current&&(clearTimeout(M0.current),M0.current=null),A0(I0.payload),u0(I0.key),F.current=null)},[f0]),Yr=30,Jr=20,Ca=l.useRef(null),ee=l.useRef(null),Pa=l.useRef(h);Pa.current=h;const st=l.useRef(null);if(!st.current){const $={onMove:I0=>{const Z0=Ca.current;if(ee.current===null||!Z0)return;const q1=I0.clientY-ee.current,i1=q1>0?1:-1,E1=Math.min(Math.abs(q1),Jr)*i1;Z0.style.transform=`translateY(${E1}px)`},onUp:I0=>{const Z0=Ca.current;if(ee.current===null||!Z0)return;const q1=I0.clientY-ee.current;ee.current=null,Z0.style.transform="",Z0.removeEventListener("pointermove",$.onMove),Z0.removeEventListener("pointerup",$.onUp),Math.abs(q1)>Yr&&(Pa.current==null||Pa.current.call(Pa))}};st.current=$}const Kr=l.useCallback($=>{var I0;$.preventDefault(),$.stopPropagation(),(I0=a0.button)==null||I0.onClick()},[a0.button]),Zr=l.useCallback($=>{if(u||!h||$.target.closest("[data-sileo-button]"))return;ee.current=$.clientY,$.currentTarget.setPointerCapture($.pointerId);const Z0=Ca.current,q1=st.current;Z0&&q1&&(Z0.addEventListener("pointermove",q1.onMove,{passive:!0}),Z0.addEventListener("pointerup",q1.onUp,{passive:!0}))},[u,h]);return d.jsxs("button",{ref:Ca,type:"button","data-sileo-toast":!0,"data-ready":k0,"data-expanded":f0,"data-exiting":u,"data-edge":s,"data-position":b,"data-state":a0.state,className:i,style:Hr,onMouseEnter:Vr,onMouseLeave:Gr,onTransitionEnd:Ur,onPointerDown:Zr,children:[d.jsx("div",{"data-sileo-canvas":!0,"data-edge":s,style:Fr,children:d.jsxs("svg",{"data-sileo-svg":!0,width:Je,height:T2,viewBox:Ir,children:[d.jsx("title",{children:"Sileo Notification"}),d.jsx(Id,{filterId:e1,blur:B}),d.jsx(Yb.rect,{"data-sileo-pill":!0,rx:W,ry:W,fill:a0.fill,initial:!1,animate:Cr,transition:jr}),d.jsx(Yb.rect,{"data-sileo-body":!0,y:j1,width:Je,rx:W,ry:W,fill:a0.fill,initial:!1,animate:Pr,transition:Er})]})}),d.jsx("div",{ref:S,"data-sileo-header":!0,"data-edge":s,children:d.jsxs("div",{"data-sileo-header-stack":!0,children:[d.jsxs("div",{ref:j0,"data-sileo-header-inner":!0,"data-layer":"current",children:[d.jsx("div",{"data-sileo-badge":!0,"data-state":P.current.view.state,className:(X=P.current.view.styles)==null?void 0:X.badge,children:(v=P.current.view.icon)!=null?v:Jb[P.current.view.state]}),d.jsx("span",{"data-sileo-title":!0,"data-state":P.current.view.state,className:(I=P.current.view.styles)==null?void 0:I.title,children:P.current.view.title})]},P.current.key),P.prev&&d.jsxs("div",{"data-sileo-header-inner":!0,"data-layer":"prev","data-exiting":"true",children:[d.jsx("div",{"data-sileo-badge":!0,"data-state":P.prev.view.state,className:(G=P.prev.view.styles)==null?void 0:G.badge,children:(N=P.prev.view.icon)!=null?N:Jb[P.prev.view.state]}),d.jsx("span",{"data-sileo-title":!0,"data-state":P.prev.view.state,className:(i0=P.prev.view.styles)==null?void 0:i0.title,children:P.prev.view.title})]},P.prev.key)]})}),U&&d.jsx("div",{"data-sileo-content":!0,"data-edge":s,"data-visible":f0,children:d.jsxs("div",{ref:C,"data-sileo-description":!0,className:(w0=a0.styles)==null?void 0:w0.description,children:[a0.description,a0.button&&d.jsx("a",{href:"#",type:"button","data-sileo-button":!0,"data-state":a0.state,className:(J0=a0.styles)==null?void 0:J0.button,onClick:Kr,children:a0.button.title})]})})]})}),Hd=e=>e.includes("right")?"right":e.includes("center")?"center":"left",Vd=e=>e.startsWith("top")?"bottom":"top",Q0={toasts:[],listeners:new Set,position:"top-right",options:void 0,emit(){for(const e of this.listeners)e(this.toasts)},update(e){this.toasts=e(this.toasts),this.emit()}};let Gd=0;const Ud=()=>`${++Gd}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,Kb=e=>`${e.id}:${e.instanceId}`,Ro=e=>{const a=Q0.toasts.find(n=>n.id===e);!a||a.exiting||(Q0.update(n=>n.map(t=>t.id===e?V0({},t,{exiting:!0}):t)),setTimeout(()=>Q0.update(n=>n.filter(t=>t.id!==e)),_d))},Yd=(e,a)=>{var n,t;if(e.autopilot===!1||!a||a<=0)return{};const o=typeof e.autopilot=="object"?e.autopilot:void 0,M=b=>Math.min(a,Math.max(0,b));return{expandDelayMs:M((n=o==null?void 0:o.expand)!=null?n:Bd),collapseDelayMs:M((t=o==null?void 0:o.collapse)!=null?t:Dd)}},Rz=e=>{var a;return V0({},Q0.options,e,{styles:V0({},(a=Q0.options)==null?void 0:a.styles,e.styles)})},gz=(e,a,n)=>{var t,o,M;const b=(t=e.duration)!=null?t:Xe,s=Yd(e,b);return V0({},e,{id:a,instanceId:Ud(),position:(o=(M=e.position)!=null?M:n)!=null?o:Q0.position,autoExpandDelayMs:s.expandDelayMs,autoCollapseDelayMs:s.collapseDelayMs})},k2=e=>{var a,n;const t=Q0.toasts.filter(i=>!i.exiting),o=Rz(e),M=(a=o.id)!=null?a:"sileo-default",b=t.find(i=>i.id===M),s=gz(o,M,b==null?void 0:b.position);return b?Q0.update(i=>i.map(z=>z.id===M?s:z)):Q0.update(i=>[...i.filter(z=>z.id!==M),s]),{id:M,duration:(n=o.duration)!=null?n:Xe}},Tt=(e,a)=>{const n=Q0.toasts.find(o=>o.id===e);if(!n)return;const t=gz(Rz(a),e,n.position);Q0.update(o=>o.map(M=>M.id===e?t:M))},Ke={show:e=>k2(e).id,success:e=>k2(V0({},e,{state:"success"})).id,error:e=>k2(V0({},e,{state:"error"})).id,warning:e=>k2(V0({},e,{state:"warning"})).id,info:e=>k2(V0({},e,{state:"info"})).id,action:e=>k2(V0({},e,{state:"action"})).id,promise:(e,a)=>{const{id:n}=k2(V0({},a.loading,{state:"loading",duration:null,position:a.position})),t=typeof e=="function"?e():e;return t.then(o=>{if(a.action){const M=typeof a.action=="function"?a.action(o):a.action;Tt(n,V0({},M,{state:"action",id:n}))}else{const M=typeof a.success=="function"?a.success(o):a.success;Tt(n,V0({},M,{state:"success",id:n}))}}).catch(o=>{const M=typeof a.error=="function"?a.error(o):a.error;Tt(n,V0({},M,{state:"error",id:n}))}),t},dismiss:Ro,clear:e=>Q0.update(a=>e?a.filter(n=>n.position!==e):[])};function Jd({children:e,position:a="top-right",offset:n,options:t}){const[o,M]=l.useState(Q0.toasts),[b,s]=l.useState(),i=l.useRef(!1),z=l.useRef(new Map),p=l.useRef(o),c=l.useRef(void 0),r=l.useRef(new Map);l.useEffect(()=>{Q0.position=a,Q0.options=t},[a,t]);const u=l.useCallback(()=>{for(const h of z.current.values())clearTimeout(h);z.current.clear()},[]),A=l.useCallback(h=>{if(!i.current)for(const N of h){var v;if(N.exiting)continue;const X=Kb(N);if(z.current.has(X))continue;const I=(v=N.duration)!=null?v:Xe;I===null||I<=0||z.current.set(X,window.setTimeout(()=>Ro(N.id),I))}},[]);l.useEffect(()=>{const h=v=>M(v);return Q0.listeners.add(h),()=>{Q0.listeners.delete(h),u()}},[u]),l.useEffect(()=>{p.current=o;const h=new Set(o.map(Kb)),v=new Set(o.map(N=>N.id));for(const[N,X]of z.current)h.has(N)||(clearTimeout(X),z.current.delete(N));for(const N of r.current.keys())v.has(N)||r.current.delete(N);A(o)},[o,A]);const R=l.useRef(null),q=l.useRef(null);R.current=l.useCallback(()=>{i.current||(i.current=!0,u())},[u]),q.current=l.useCallback(()=>{i.current&&(i.current=!1,A(p.current))},[A]);const O=l.useMemo(()=>{for(let h=o.length-1;h>=0;h--)if(!o[h].exiting)return o[h].id},[o]);l.useEffect(()=>{c.current=O,s(O)},[O]);const m=l.useCallback(h=>{let v=r.current.get(h);return v||(v={enter:N=>{s(X=>X===h?X:h),R.current==null||R.current.call(R,N)},leave:N=>{s(X=>X===c.current?X:c.current),q.current==null||q.current.call(q,N)},dismiss:()=>Ro(h)},r.current.set(h,v),v)},[]),y=l.useCallback(h=>{if(n===void 0)return;const v=typeof n=="object"?n:{top:n,right:n,bottom:n,left:n},N={},X=I=>typeof I=="number"?`${I}px`:I;return h.startsWith("top")&&v.top&&(N.top=X(v.top)),h.startsWith("bottom")&&v.bottom&&(N.bottom=X(v.bottom)),h.endsWith("left")&&v.left&&(N.left=X(v.left)),h.endsWith("right")&&v.right&&(N.right=X(v.right)),N},[n]),g=l.useMemo(()=>{const h=new Map;for(const N of o){var v;const X=(v=N.position)!=null?v:a,I=h.get(X);I?I.push(N):h.set(X,[N])}return h},[o,a]);return d.jsxs(d.Fragment,{children:[e,Array.from(g,([h,v])=>{const N=Hd(h),X=Vd(h);return d.jsx("section",{"data-sileo-viewport":!0,"data-position":h,"aria-live":"polite",style:y(h),children:v.map(I=>{const G=m(I.id);return d.jsx(Fd,{id:I.id,state:I.state,title:I.title,description:I.description,position:N,expand:X,icon:I.icon,fill:I.fill,styles:I.styles,button:I.button,roundness:I.roundness,exiting:I.exiting,autoExpandDelayMs:I.autoExpandDelayMs,autoCollapseDelayMs:I.autoCollapseDelayMs,refreshKey:I.instanceId,canExpand:b===void 0||b===I.id,onMouseEnter:G.enter,onMouseLeave:G.leave,onDismiss:G.dismiss},I.id)})},h)})]})}const m3=()=>({success:(M,b)=>Ke.success({title:M,description:b}),error:(M,b)=>Ke.error({title:M,description:b}),info:(M,b)=>Ke.info({title:M,description:b}),warning:(M,b)=>Ke.warning({title:M,description:b}),promise:(M,b)=>Ke.promise(M,b)}),Lz=l.createContext(),Kd=({children:e})=>{const{sileoToastEnabled:a,customDeviceType:n}=R1(),{success:t,error:o,info:M,warning:b}=m3(),s=Xs(),[i,z]=l.useState(!1),[p,c]=l.useState(),[r,u]=l.useState(),A=n||s.type,y={showAlert:i,setShowAlert:z,typeAlert:p,setTypeAlert:c,messageAlert:r,setMessageAlert:u,alertConfig:{danger:{bgColor:"bg-danger",textColor:"text-danger-text",buttonBg:"bg-danger",hoverBg:"hover:bg-danger-hover",focusRing:"focus:ring-danger-progress",progressColor:"bg-danger-progress"},info:{bgColor:"bg-info",textColor:"text-info-text",buttonBg:"bg-info",hoverBg:"hover:bg-info-hover",focusRing:"focus:ring-info-progress",progressColor:"bg-info-progress"},success:{bgColor:"bg-success",textColor:"text-success-text",buttonBg:"bg-success",hoverBg:"hover:bg-success-hover",focusRing:"focus:ring-success-progress",progressColor:"bg-success-progress"},warning:{bgColor:"bg-warning",textColor:"text-warning-text",buttonBg:"bg-warning",hoverBg:"hover:bg-warning-hover",focusRing:"focus:ring-warning-progress",progressColor:"bg-warning-progress"}},getIcon:g=>{switch(g){case"danger":return d.jsx(ic,{className:"w-[20px] h-[20px]"});case"info":return d.jsx(zc,{className:"w-[20px] h-[20px]"});case"success":return d.jsx(mc,{className:"text-xl"});case"warning":return d.jsx(pc,{className:"w-[20px] h-[20px]"})}},closeAlert:()=>{z(!i)},activeAlert:(g,h,v=null)=>{if(z(!1),a&&!v&&["mobile","tablet"].includes(A)){switch(g){case"danger":o("Errore",h);break;case"info":M("Info",h);break;case"success":t("Successo",h);break;case"warning":b("Attenzione",h);break;default:M("Info",h)}return}setTimeout(()=>{c(g),u(h),z(!0)},50)}};return d.jsx(Lz.Provider,{value:y,children:e})},w2=()=>{const e=l.useContext(Lz);if(e===void 0)throw new Error("Non puoi modificare l'alert");return e};let be;const vz=async(e,a,n,t)=>{if(be)return be;try{const M=await(await fetch("/config.json")).json(),b=M.baseUri,{unauthorized:s,notFound:i,defaultMessage:z}=M.axiosErrors;return be=Ls.create({baseURL:b}),be.interceptors.request.use(p=>{const c=JSON.parse(localStorage.getItem("accessToken"));return c?p.headers.Authorization=`Bearer ${c}`:delete p.headers.Authorization,p}),be.interceptors.response.use(p=>p,p=>{if(p.response)switch(p.response.status){case 401:localStorage.removeItem("accessToken"),e==null||e("danger",s),a==null||a();break;case 404:e==null||e("danger",i),n==null||n(p);break;default:e==null||e("danger",`${z} ${p.response.status||""} ${p.response.data.error||""}`),t==null||t(p)}return Promise.reject(p)}),be}catch(o){console.error(o)}},go=(e,a)=>{const[n,t]=l.useState(()=>{try{const b=localStorage.getItem(a);return b===null?(localStorage.setItem(a,JSON.stringify(e)),e):JSON.parse(b)}catch(b){return console.error("Errore nel recupero dal localStorage:",b),e}});return[n,b=>{t(s=>{const i=typeof b=="function"?b(s):b;return localStorage.setItem(a,JSON.stringify(i)),i})},(b=!1)=>{b?localStorage.clear():localStorage.removeItem(a),t(e)}]},Ce=()=>{const[e,a,n]=go(null,"accessToken"),[t,o,M]=go(null,"user");return{token:e,user:t,setToken:a,setUser:o,storageLogout:()=>{n(),M()}}},Nz=l.createContext(),Zd=({children:e})=>{const{heartbeatEndpoint:a,firstPrivatePath:n,infiniteSession:t,timeDeducted:o,authenticatedEndpoint:M,autoLogin:b,setCurrentDate:s,isDebug:i,backendToken:z,useCustomLoginTimeout:p,stopLoaderOnFinish:c,customLoginTimeout:r,tokenLog:u,timerInfiniteSession:A}=R1(),{setIsLoading:R,showLoadingFor:q}=K2(),{setShowAlert:O,activeAlert:m}=w2(),{token:y,setToken:g,setUser:h,storageLogout:v}=Ce(),N=s0.useNavigate(),[X,I]=l.useState(null),[G,i0]=l.useState(),[w0,J0]=l.useState(),[d0,a0]=l.useState(!1),A0=async(L0=u0,l0,U)=>await vz(m,L0,l0,U),z0=async(L0=null,l0)=>{L0&&L0.preventDefault(),a0(!0);try{p?q(r):R(!0),O(!1);const r0=await(await A0()).post(M,{auth:l0}),f0=r0.headers.token,K0=r0.data;f0&&(h(K0),g(f0),I(!0),N(`${n}${K0.id}`))}catch(U){console.error(U),R(!1)}finally{a0(!1),!p&&c&&R(!1)}},u0=()=>{v(),I(!1)},N0=async()=>{try{const U=(await(await A0()).get(`${a}`)).headers.token;g(U),i&&console.log("[Auth]: Nuovo token: ",U,"Data:",s())}catch(L0){console.error(L0),u0()}},_0=L0=>{const l0=L0||y;if(!l0)return;const U="Token non valido";try{const r0=pM(l0);if(!r0.exp){u&&console.warn("[Auth]: Token senza data di scadenza, eseguo logout."),u0(),m("danger",U);return}const f0=Math.floor(Date.now()/1e3),K0=(r0.exp-f0)*1e3;if(K0<=0){u&&console.warn("[Auth]: Token scaduto, eseguo logout."),u0(),m("danger",U);return}J0(K0),i0(K0-o);const l1=K0-o;if(u){const e1=Math.floor(K0/1e3),W=Math.floor(e1/60),B=e1%60;console.log(`[Auth]: Token valido per ancora: ${W} minuti e ${B} secondi`),console.log("[Auth]: Token:",y)}return l1}catch(r0){u&&console.error("[Auth]: Errore nella decodifica del token:",r0),u0(),m("danger",U)}},k0=L0=>{if(!L0)return!1;try{const l0=pM(L0),U=Math.floor(Date.now()/1e3);return!l0.exp||l0.exp<U?(console.warn("[Auth]: Token scaduto o non valido"),!1):!0}catch(l0){return console.error("[Auth]: Token non valido o corrotto",l0),!1}},u2=async L0=>{try{const r0=(await(await A0()).get(a)).data;r0&&(h(r0),g(L0),I(!0),N(`${n}${r0.id}`))}catch(l0){console.error(l0)}},u1=()=>{k0(y)?(u&&console.log("[Auth]: Ricarico pagina → controllo scadenza token"),_0(y)):(u&&console.warn("[Auth]: Token non valido al reload, eseguo logout"),u0())};l.useEffect(()=>{if(!k0(y)){u0();return}I(!0)},[]),l.useEffect(()=>{b&&!X&&!d0&&(u&&console.log("[Auth]: Tentativo di autologin con backendToken"),u2(z))},[b,X,d0]),l.useEffect(()=>{if(document.readyState==="complete")u1();else return window.addEventListener("load",u1),()=>window.removeEventListener("load",u1)},[]),l.useEffect(()=>{if(b)return;const L0=_0(y),l0=A||L0;u&&console.log("[Auth]: intervallo per il prossimo token:",l0);let U;t&&y&&L0&&(u&&console.log("[Auth]: Entrato dentro il timer della sessione infinita"),U=setInterval(()=>{N0()},l0));let r0;return!t&&y&&(u&&console.log("[Auth]: Entrato dentro il timer della sessione con scadenza del token"),r0=setTimeout(()=>{u0(),m("danger","Sessione scaduta")},w0)),()=>{U&&clearInterval(U),r0&&clearTimeout(r0)}},[y,G]);const s1={isAuthenticated:X,setIsAuthenticated:I,login:z0,logout:u0,createAxiosInstances:A0,fetchHeartbeat:N0,getTokenExpiry:_0,checkTokenValidity:k0,fetchUser:u2,handleLoad:u1};return d.jsx(Nz.Provider,{value:s1,children:e})},La=()=>{const e=l.useContext(Nz);if(e===void 0)throw new Error("Non sei dentro al Auth Provider");return e},_z=l.createContext(),$d=({children:e,publicRoutes:a=[],privateRoutes:n=[]})=>d.jsx(_z.Provider,{value:{publicRoutes:a,privateRoutes:n},children:e}),Bz=()=>{const e=l.useContext(_z);if(e===void 0)throw new Error(`Errore: Le rotte non sono state inizializzate correttamente.
102
+ )[data-state=action]{--_c:var(--sileo-state-action)}:is([data-sileo-badge],[data-sileo-title])[data-state]{--sileo-tone:var(--_c);--sileo-tone-bg:color-mix(in oklch, var(--_c) 20%, transparent)}[data-sileo-content]{position:absolute;left:0;z-index:10;width:100%;pointer-events:none;opacity:var(--_co, 0)}[data-sileo-content]:not([data-visible=true]){content-visibility:hidden}[data-sileo-toast][data-ready=true] [data-sileo-content]{transition:opacity calc(var(--sileo-duration) * .08) ease calc(var(--sileo-duration) * .04)}[data-sileo-content][data-edge=top]{top:0}[data-sileo-content][data-edge=bottom]{top:var(--sileo-height)}[data-sileo-content][data-visible=true]{pointer-events:auto}[data-sileo-toast][data-ready=true] [data-sileo-content][data-visible=true]{transition:opacity calc(var(--sileo-duration) * .6) ease calc(var(--sileo-duration) * .3)}[data-sileo-description]{width:100%;text-align:left;padding:1rem;font-size:.875rem;line-height:1.25rem;contain:layout style paint;content-visibility:auto}[data-sileo-button]{display:flex;align-items:center;justify-content:center;height:1.75rem;padding:0 .625rem;margin-top:.75rem;border-radius:9999px;border:0;font-size:.75rem;font-weight:500;cursor:pointer;color:var(--sileo-btn-color,currentColor);background-color:var(--sileo-btn-bg,transparent);transition:background-color 150ms ease}[data-sileo-button]:hover{background-color:var(--sileo-btn-bg-hover,transparent)}[data-sileo-button][data-state]{--sileo-btn-color:var(--_c);--sileo-btn-bg:color-mix(in oklch, var(--_c) 15%, transparent);--sileo-btn-bg-hover:color-mix(in oklch, var(--_c) 25%, transparent)}[data-sileo-icon=spin]{animation:sileo-spin 1s linear infinite}@keyframes sileo-spin{to{transform:rotate(360deg)}}@keyframes sileo-header-enter{from{opacity:0;filter:blur(6px)}to{opacity:1;filter:blur(0px)}}@keyframes sileo-header-exit{from{opacity:1;filter:blur(0px)}to{opacity:0;filter:blur(6px)}}[data-sileo-viewport]{position:fixed;z-index:50;display:flex;gap:.75rem;padding:.75rem;pointer-events:none;max-width:calc(100vw - 1.5rem);contain:layout style}[data-sileo-viewport][data-position^=top] [data-sileo-toast]:not([data-ready=true]){margin-bottom:calc(-1 * (var(--sileo-height) + .75rem))}[data-sileo-viewport][data-position^=bottom] [data-sileo-toast]:not([data-ready=true]){margin-top:calc(-1 * (var(--sileo-height) + .75rem))}[data-sileo-viewport][data-position^=top]{top:0;flex-direction:column-reverse}[data-sileo-viewport][data-position^=bottom]{bottom:0;flex-direction:column}[data-sileo-viewport][data-position$=left]{left:0;align-items:flex-start}[data-sileo-viewport][data-position$=right]{right:0;align-items:flex-end}[data-sileo-viewport][data-position$=center]{left:50%;transform:translateX(-50%);align-items:center}@media (prefers-reduced-motion:no-preference){[data-sileo-toast][data-ready=true]:hover,[data-sileo-toast][data-ready=true][data-exiting=true]{will-change:transform,opacity,height}}@media (prefers-reduced-motion:reduce){*,::after,::before{animation-duration:0s;animation-iteration-count:1;transition-duration:0s}}`);const j1=40,Je=350,vd=16,Wz=600,Nd=Wz/1e3,Xe=6e3,_d=Xe*.1,Bd=Xe*.025,Dd=Xe-2e3,St={type:"spring",bounce:.25,duration:Nd},wd=.5,Ja=10,Sd=2.25,Td=200,xd=Wz*.7,ke=e=>{let{title:a,children:n}=e,t=Tc(e,["title","children"]);return d.jsxs("svg",V0({},t,{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("title",{children:a}),n]}))},Xd=()=>d.jsxs(ke,{title:"Arrow Right",children:[d.jsx("path",{d:"M5 12h14"}),d.jsx("path",{d:"m12 5 7 7-7 7"})]}),kd=()=>d.jsxs(ke,{title:"Life Buoy",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("path",{d:"m4.93 4.93 4.24 4.24"}),d.jsx("path",{d:"m14.83 9.17 4.24-4.24"}),d.jsx("path",{d:"m14.83 14.83 4.24 4.24"}),d.jsx("path",{d:"m9.17 14.83-4.24 4.24"}),d.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),Cd=e=>d.jsx(ke,V0({title:"Loader Circle"},e,{children:d.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})),Pd=()=>d.jsxs(ke,{title:"X",children:[d.jsx("path",{d:"M18 6 6 18"}),d.jsx("path",{d:"m6 6 12 12"})]}),Ed=()=>d.jsxs(ke,{title:"Circle Alert",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),d.jsx("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),jd=()=>d.jsx(ke,{title:"Check",children:d.jsx("path",{d:"M20 6 9 17l-5-5"})}),Jb={success:d.jsx(jd,{}),loading:d.jsx(Cd,{"data-sileo-icon":"spin","aria-hidden":"true"}),error:d.jsx(Pd,{}),warning:d.jsx(Ed,{}),info:d.jsx(kd,{}),action:d.jsx(Xd,{})},Id=l.memo(function({filterId:a,blur:n}){return d.jsx("defs",{children:d.jsxs("filter",{id:a,x:"-20%",y:"-20%",width:"140%",height:"140%",colorInterpolationFilters:"sRGB",children:[d.jsx("feGaussianBlur",{in:"SourceGraphic",stdDeviation:n,result:"blur"}),d.jsx("feColorMatrix",{in:"blur",mode:"matrix",values:"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -10",result:"goo"}),d.jsx("feComposite",{in:"SourceGraphic",in2:"goo",operator:"atop"})]})})}),Fd=l.memo(function({id:a,fill:n="#FFFFFF",state:t="success",title:o=t,description:M,position:b="left",expand:s="bottom",className:i,icon:z,styles:p,button:c,roundness:r,exiting:u=!1,autoExpandDelayMs:A,autoCollapseDelayMs:R,canExpand:q,interruptKey:O,refreshKey:m,onMouseEnter:y,onMouseLeave:g,onDismiss:h}){var v,N,X,I,G,i0,w0,J0;const d0=l.useMemo(()=>({title:o,description:M,state:t,icon:z,styles:p,button:c,fill:n}),[o,M,t,z,p,c,n]),[a0,A0]=l.useState(d0),[z0,u0]=l.useState(m),[N0,_0]=l.useState(!1),[k0,u2]=l.useState(!1),[u1,s1]=l.useState(0),[L0,l0]=l.useState(0),U=!!a0.description||!!a0.button,r0=a0.state==="loading",f0=U&&N0&&!r0,K0=r0?!1:q??(!O||O===a),l1=`${a0.state}-${a0.title}`,e1=`sileo-gooey-${a}`,W=Math.max(0,r??vd),B=W*wd,S=l.useRef(null),C=l.useRef(null),Y=l.useRef(null),o0=l.useRef(null),h0=l.useRef(null),M0=l.useRef(null),f=l.useRef(m),F=l.useRef(null),[P,c0]=l.useState({current:{key:l1,view:a0},prev:null}),j0=l.useRef(null),y0=l.useRef(null),Q=l.useRef(null),c1=l.useRef(0),v1=l.useRef(null);l.useLayoutEffect(()=>{const $=j0.current,I0=S.current;if(!$||!I0)return;if(y0.current===null){const i1=getComputedStyle(I0);y0.current=parseFloat(i1.paddingLeft)+parseFloat(i1.paddingRight)}const Z0=y0.current;(()=>{const i1=$.scrollWidth+Z0+Ja;i1>Ja&&s1(E1=>E1===i1?E1:i1)})(),Q.current||(Q.current=new ResizeObserver(()=>{cancelAnimationFrame(c1.current),c1.current=requestAnimationFrame(()=>{var i1;const E1=j0.current,$r=(i1=y0.current)!=null?i1:0;if(!E1)return;const it=E1.scrollWidth+$r+Ja;it>Ja&&s1(zM=>zM===it?zM:it)})})),v1.current!==$&&(v1.current&&Q.current.unobserve(v1.current),Q.current.observe($),v1.current=$)},[P.current.key]),l.useEffect(()=>()=>{var $;cancelAnimationFrame(c1.current),($=Q.current)==null||$.disconnect()},[]),l.useLayoutEffect(()=>{if(!U){l0(0);return}const $=C.current;if(!$)return;const I0=()=>{const i1=$.scrollHeight;l0(E1=>E1===i1?E1:i1)};I0();let Z0=0;const q1=new ResizeObserver(()=>{cancelAnimationFrame(Z0),Z0=requestAnimationFrame(I0)});return q1.observe($),()=>{cancelAnimationFrame(Z0),q1.disconnect()}},[U]),l.useEffect(()=>{const $=requestAnimationFrame(()=>u2(!0));return()=>cancelAnimationFrame($)},[]),l.useLayoutEffect(()=>{c0($=>$.current.key===l1?$.current.view===a0?$:V0({},$,{current:{key:l1,view:a0}}):{prev:$.current,current:{key:l1,view:a0}})},[l1,a0]),l.useEffect(()=>{if(P.prev)return Y.current&&clearTimeout(Y.current),Y.current=window.setTimeout(()=>{Y.current=null,c0($=>V0({},$,{prev:null}))},xd),()=>{Y.current&&(clearTimeout(Y.current),Y.current=null)}},[P.prev]),l.useEffect(()=>{if(m===void 0){A0(d0),u0(void 0),F.current=null,f.current=m;return}f.current!==m&&(f.current=m,M0.current&&(clearTimeout(M0.current),M0.current=null),f0?(F.current={key:m,payload:d0},_0(!1),M0.current=window.setTimeout(()=>{M0.current=null;const $=F.current;$&&(A0($.payload),u0($.key),F.current=null)},Td)):(F.current=null,A0(d0),u0(m)))},[f0,m,d0]),l.useEffect(()=>{if(!U)return;if(o0.current&&clearTimeout(o0.current),h0.current&&clearTimeout(h0.current),u||!K0){_0(!1);return}if(A==null&&R==null)return;const $=A??0,I0=R??0;return $>0?o0.current=window.setTimeout(()=>_0(!0),$):_0(!0),I0>0&&(h0.current=window.setTimeout(()=>_0(!1),I0)),()=>{o0.current&&clearTimeout(o0.current),h0.current&&clearTimeout(h0.current)}},[R,A,U,K0,u,z0]);const G0=j1*Sd,N1=U?Math.max(G0,j1+L0):G0,l2=l.useRef(N1);f0&&(l2.current=N1);const O1=f0?N1:l2.current,T2=U?Math.max(O1,G0):j1,m1=Math.max(0,O1-j1),Q2=Math.max(u1||j1,j1),iM=j1+B*3,ka=b==="right"?Je-Q2:b==="center"?(Je-Q2)/2:0,Cr=l.useMemo(()=>({x:ka,width:Q2,height:f0?iM:j1}),[ka,Q2,f0,iM]),Pr=l.useMemo(()=>({height:f0?m1:0,opacity:f0?1:0}),[f0,m1]),Er=l.useMemo(()=>f0?St:V0({},St,{bounce:0}),[f0]),jr=l.useMemo(()=>k0?St:{duration:0},[k0]),Ir=`0 0 ${Je} ${T2}`,Fr=l.useMemo(()=>({filter:`url(#${e1})`}),[e1]),Hr=l.useMemo(()=>({"--_h":`${f0?O1:j1}px`,"--_pw":`${Q2}px`,"--_px":`${ka}px`,"--_ht":`translateY(${f0?s==="bottom"?3:-3:0}px) scale(${f0?.9:1})`,"--_co":`${f0?1:0}`}),[f0,O1,Q2,ka,s]),Vr=l.useCallback($=>{y==null||y($),U&&_0(!0)},[U,y]),Gr=l.useCallback($=>{g==null||g($),_0(!1)},[g]),Ur=l.useCallback($=>{if($.propertyName!=="height"&&$.propertyName!=="transform"||f0)return;const I0=F.current;I0&&(M0.current&&(clearTimeout(M0.current),M0.current=null),A0(I0.payload),u0(I0.key),F.current=null)},[f0]),Yr=30,Jr=20,Ca=l.useRef(null),ee=l.useRef(null),Pa=l.useRef(h);Pa.current=h;const st=l.useRef(null);if(!st.current){const $={onMove:I0=>{const Z0=Ca.current;if(ee.current===null||!Z0)return;const q1=I0.clientY-ee.current,i1=q1>0?1:-1,E1=Math.min(Math.abs(q1),Jr)*i1;Z0.style.transform=`translateY(${E1}px)`},onUp:I0=>{const Z0=Ca.current;if(ee.current===null||!Z0)return;const q1=I0.clientY-ee.current;ee.current=null,Z0.style.transform="",Z0.removeEventListener("pointermove",$.onMove),Z0.removeEventListener("pointerup",$.onUp),Math.abs(q1)>Yr&&(Pa.current==null||Pa.current.call(Pa))}};st.current=$}const Kr=l.useCallback($=>{var I0;$.preventDefault(),$.stopPropagation(),(I0=a0.button)==null||I0.onClick()},[a0.button]),Zr=l.useCallback($=>{if(u||!h||$.target.closest("[data-sileo-button]"))return;ee.current=$.clientY,$.currentTarget.setPointerCapture($.pointerId);const Z0=Ca.current,q1=st.current;Z0&&q1&&(Z0.addEventListener("pointermove",q1.onMove,{passive:!0}),Z0.addEventListener("pointerup",q1.onUp,{passive:!0}))},[u,h]);return d.jsxs("button",{ref:Ca,type:"button","data-sileo-toast":!0,"data-ready":k0,"data-expanded":f0,"data-exiting":u,"data-edge":s,"data-position":b,"data-state":a0.state,className:i,style:Hr,onMouseEnter:Vr,onMouseLeave:Gr,onTransitionEnd:Ur,onPointerDown:Zr,children:[d.jsx("div",{"data-sileo-canvas":!0,"data-edge":s,style:Fr,children:d.jsxs("svg",{"data-sileo-svg":!0,width:Je,height:T2,viewBox:Ir,children:[d.jsx("title",{children:"Sileo Notification"}),d.jsx(Id,{filterId:e1,blur:B}),d.jsx(Yb.rect,{"data-sileo-pill":!0,rx:W,ry:W,fill:a0.fill,initial:!1,animate:Cr,transition:jr}),d.jsx(Yb.rect,{"data-sileo-body":!0,y:j1,width:Je,rx:W,ry:W,fill:a0.fill,initial:!1,animate:Pr,transition:Er})]})}),d.jsx("div",{ref:S,"data-sileo-header":!0,"data-edge":s,children:d.jsxs("div",{"data-sileo-header-stack":!0,children:[d.jsxs("div",{ref:j0,"data-sileo-header-inner":!0,"data-layer":"current",children:[d.jsx("div",{"data-sileo-badge":!0,"data-state":P.current.view.state,className:(X=P.current.view.styles)==null?void 0:X.badge,children:(v=P.current.view.icon)!=null?v:Jb[P.current.view.state]}),d.jsx("span",{"data-sileo-title":!0,"data-state":P.current.view.state,className:(I=P.current.view.styles)==null?void 0:I.title,children:P.current.view.title})]},P.current.key),P.prev&&d.jsxs("div",{"data-sileo-header-inner":!0,"data-layer":"prev","data-exiting":"true",children:[d.jsx("div",{"data-sileo-badge":!0,"data-state":P.prev.view.state,className:(G=P.prev.view.styles)==null?void 0:G.badge,children:(N=P.prev.view.icon)!=null?N:Jb[P.prev.view.state]}),d.jsx("span",{"data-sileo-title":!0,"data-state":P.prev.view.state,className:(i0=P.prev.view.styles)==null?void 0:i0.title,children:P.prev.view.title})]},P.prev.key)]})}),U&&d.jsx("div",{"data-sileo-content":!0,"data-edge":s,"data-visible":f0,children:d.jsxs("div",{ref:C,"data-sileo-description":!0,className:(w0=a0.styles)==null?void 0:w0.description,children:[a0.description,a0.button&&d.jsx("a",{href:"#",type:"button","data-sileo-button":!0,"data-state":a0.state,className:(J0=a0.styles)==null?void 0:J0.button,onClick:Kr,children:a0.button.title})]})})]})}),Hd=e=>e.includes("right")?"right":e.includes("center")?"center":"left",Vd=e=>e.startsWith("top")?"bottom":"top",Q0={toasts:[],listeners:new Set,position:"top-right",options:void 0,emit(){for(const e of this.listeners)e(this.toasts)},update(e){this.toasts=e(this.toasts),this.emit()}};let Gd=0;const Ud=()=>`${++Gd}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,Kb=e=>`${e.id}:${e.instanceId}`,Ro=e=>{const a=Q0.toasts.find(n=>n.id===e);!a||a.exiting||(Q0.update(n=>n.map(t=>t.id===e?V0({},t,{exiting:!0}):t)),setTimeout(()=>Q0.update(n=>n.filter(t=>t.id!==e)),_d))},Yd=(e,a)=>{var n,t;if(e.autopilot===!1||!a||a<=0)return{};const o=typeof e.autopilot=="object"?e.autopilot:void 0,M=b=>Math.min(a,Math.max(0,b));return{expandDelayMs:M((n=o==null?void 0:o.expand)!=null?n:Bd),collapseDelayMs:M((t=o==null?void 0:o.collapse)!=null?t:Dd)}},Rz=e=>{var a;return V0({},Q0.options,e,{styles:V0({},(a=Q0.options)==null?void 0:a.styles,e.styles)})},gz=(e,a,n)=>{var t,o,M;const b=(t=e.duration)!=null?t:Xe,s=Yd(e,b);return V0({},e,{id:a,instanceId:Ud(),position:(o=(M=e.position)!=null?M:n)!=null?o:Q0.position,autoExpandDelayMs:s.expandDelayMs,autoCollapseDelayMs:s.collapseDelayMs})},k2=e=>{var a,n;const t=Q0.toasts.filter(i=>!i.exiting),o=Rz(e),M=(a=o.id)!=null?a:"sileo-default",b=t.find(i=>i.id===M),s=gz(o,M,b==null?void 0:b.position);return b?Q0.update(i=>i.map(z=>z.id===M?s:z)):Q0.update(i=>[...i.filter(z=>z.id!==M),s]),{id:M,duration:(n=o.duration)!=null?n:Xe}},Tt=(e,a)=>{const n=Q0.toasts.find(o=>o.id===e);if(!n)return;const t=gz(Rz(a),e,n.position);Q0.update(o=>o.map(M=>M.id===e?t:M))},Ke={show:e=>k2(e).id,success:e=>k2(V0({},e,{state:"success"})).id,error:e=>k2(V0({},e,{state:"error"})).id,warning:e=>k2(V0({},e,{state:"warning"})).id,info:e=>k2(V0({},e,{state:"info"})).id,action:e=>k2(V0({},e,{state:"action"})).id,promise:(e,a)=>{const{id:n}=k2(V0({},a.loading,{state:"loading",duration:null,position:a.position})),t=typeof e=="function"?e():e;return t.then(o=>{if(a.action){const M=typeof a.action=="function"?a.action(o):a.action;Tt(n,V0({},M,{state:"action",id:n}))}else{const M=typeof a.success=="function"?a.success(o):a.success;Tt(n,V0({},M,{state:"success",id:n}))}}).catch(o=>{const M=typeof a.error=="function"?a.error(o):a.error;Tt(n,V0({},M,{state:"error",id:n}))}),t},dismiss:Ro,clear:e=>Q0.update(a=>e?a.filter(n=>n.position!==e):[])};function Jd({children:e,position:a="top-right",offset:n,options:t}){const[o,M]=l.useState(Q0.toasts),[b,s]=l.useState(),i=l.useRef(!1),z=l.useRef(new Map),p=l.useRef(o),c=l.useRef(void 0),r=l.useRef(new Map);l.useEffect(()=>{Q0.position=a,Q0.options=t},[a,t]);const u=l.useCallback(()=>{for(const h of z.current.values())clearTimeout(h);z.current.clear()},[]),A=l.useCallback(h=>{if(!i.current)for(const N of h){var v;if(N.exiting)continue;const X=Kb(N);if(z.current.has(X))continue;const I=(v=N.duration)!=null?v:Xe;I===null||I<=0||z.current.set(X,window.setTimeout(()=>Ro(N.id),I))}},[]);l.useEffect(()=>{const h=v=>M(v);return Q0.listeners.add(h),()=>{Q0.listeners.delete(h),u()}},[u]),l.useEffect(()=>{p.current=o;const h=new Set(o.map(Kb)),v=new Set(o.map(N=>N.id));for(const[N,X]of z.current)h.has(N)||(clearTimeout(X),z.current.delete(N));for(const N of r.current.keys())v.has(N)||r.current.delete(N);A(o)},[o,A]);const R=l.useRef(null),q=l.useRef(null);R.current=l.useCallback(()=>{i.current||(i.current=!0,u())},[u]),q.current=l.useCallback(()=>{i.current&&(i.current=!1,A(p.current))},[A]);const O=l.useMemo(()=>{for(let h=o.length-1;h>=0;h--)if(!o[h].exiting)return o[h].id},[o]);l.useEffect(()=>{c.current=O,s(O)},[O]);const m=l.useCallback(h=>{let v=r.current.get(h);return v||(v={enter:N=>{s(X=>X===h?X:h),R.current==null||R.current.call(R,N)},leave:N=>{s(X=>X===c.current?X:c.current),q.current==null||q.current.call(q,N)},dismiss:()=>Ro(h)},r.current.set(h,v),v)},[]),y=l.useCallback(h=>{if(n===void 0)return;const v=typeof n=="object"?n:{top:n,right:n,bottom:n,left:n},N={},X=I=>typeof I=="number"?`${I}px`:I;return h.startsWith("top")&&v.top&&(N.top=X(v.top)),h.startsWith("bottom")&&v.bottom&&(N.bottom=X(v.bottom)),h.endsWith("left")&&v.left&&(N.left=X(v.left)),h.endsWith("right")&&v.right&&(N.right=X(v.right)),N},[n]),g=l.useMemo(()=>{const h=new Map;for(const N of o){var v;const X=(v=N.position)!=null?v:a,I=h.get(X);I?I.push(N):h.set(X,[N])}return h},[o,a]);return d.jsxs(d.Fragment,{children:[e,Array.from(g,([h,v])=>{const N=Hd(h),X=Vd(h);return d.jsx("section",{"data-sileo-viewport":!0,"data-position":h,"aria-live":"polite",style:y(h),children:v.map(I=>{const G=m(I.id);return d.jsx(Fd,{id:I.id,state:I.state,title:I.title,description:I.description,position:N,expand:X,icon:I.icon,fill:I.fill,styles:I.styles,button:I.button,roundness:I.roundness,exiting:I.exiting,autoExpandDelayMs:I.autoExpandDelayMs,autoCollapseDelayMs:I.autoCollapseDelayMs,refreshKey:I.instanceId,canExpand:b===void 0||b===I.id,onMouseEnter:G.enter,onMouseLeave:G.leave,onDismiss:G.dismiss},I.id)})},h)})]})}const m3=()=>({success:(M,b)=>Ke.success({title:M,description:b}),error:(M,b)=>Ke.error({title:M,description:b}),info:(M,b)=>Ke.info({title:M,description:b}),warning:(M,b)=>Ke.warning({title:M,description:b}),promise:(M,b)=>Ke.promise(M,b)}),Lz=l.createContext(),Kd=({children:e})=>{const{sileoToastEnabled:a,customDeviceType:n}=R1(),{success:t,error:o,info:M,warning:b}=m3(),s=Xs(),[i,z]=l.useState(!1),[p,c]=l.useState(),[r,u]=l.useState(),A=n||s.type,y={showAlert:i,setShowAlert:z,typeAlert:p,setTypeAlert:c,messageAlert:r,setMessageAlert:u,alertConfig:{danger:{bgColor:"bg-danger",textColor:"text-danger-text",buttonBg:"bg-danger",hoverBg:"hover:bg-danger-hover",focusRing:"focus:ring-danger-progress",progressColor:"bg-danger-progress"},info:{bgColor:"bg-info",textColor:"text-info-text",buttonBg:"bg-info",hoverBg:"hover:bg-info-hover",focusRing:"focus:ring-info-progress",progressColor:"bg-info-progress"},success:{bgColor:"bg-success",textColor:"text-success-text",buttonBg:"bg-success",hoverBg:"hover:bg-success-hover",focusRing:"focus:ring-success-progress",progressColor:"bg-success-progress"},warning:{bgColor:"bg-warning",textColor:"text-warning-text",buttonBg:"bg-warning",hoverBg:"hover:bg-warning-hover",focusRing:"focus:ring-warning-progress",progressColor:"bg-warning-progress"}},getIcon:g=>{switch(g){case"danger":return d.jsx(ic,{className:"w-[20px] h-[20px]"});case"info":return d.jsx(zc,{className:"w-[20px] h-[20px]"});case"success":return d.jsx(mc,{className:"text-xl"});case"warning":return d.jsx(pc,{className:"w-[20px] h-[20px]"})}},closeAlert:()=>{z(!i)},activeAlert:(g,h,v=null)=>{if(z(!1),a&&!v&&["mobile","tablet"].includes(A)){switch(g){case"danger":o("Errore",h);break;case"info":M("Info",h);break;case"success":t("Successo",h);break;case"warning":b("Attenzione",h);break;default:M("Info",h)}return}setTimeout(()=>{c(g),u(h),z(!0)},50)}};return d.jsx(Lz.Provider,{value:y,children:e})},w2=()=>{const e=l.useContext(Lz);if(e===void 0)throw new Error("Non puoi modificare l'alert");return e};let be;const vz=async(e,a,n,t)=>{if(be)return be;try{const M=await(await fetch("/config.json")).json(),b=M.baseUri,{unauthorized:s,notFound:i,defaultMessage:z}=M.axiosErrors;return be=Ls.create({baseURL:b}),be.interceptors.request.use(p=>{const c=JSON.parse(localStorage.getItem("accessToken"));return c?p.headers.Authorization=`Bearer ${c}`:p.headers.Authorization||delete p.headers.Authorization,p}),be.interceptors.response.use(p=>p,p=>{if(p.response)switch(p.response.status){case 401:localStorage.removeItem("accessToken"),e==null||e("danger",s),a==null||a();break;case 404:e==null||e("danger",i),n==null||n(p);break;default:e==null||e("danger",`${z} ${p.response.status||""} ${p.response.data.error||""}`),t==null||t(p)}return Promise.reject(p)}),be}catch(o){console.error(o)}},go=(e,a)=>{const[n,t]=l.useState(()=>{try{const b=localStorage.getItem(a);return b===null?(localStorage.setItem(a,JSON.stringify(e)),e):JSON.parse(b)}catch(b){return console.error("Errore nel recupero dal localStorage:",b),e}});return[n,b=>{t(s=>{const i=typeof b=="function"?b(s):b;return localStorage.setItem(a,JSON.stringify(i)),i})},(b=!1)=>{b?localStorage.clear():localStorage.removeItem(a),t(e)}]},Ce=()=>{const[e,a,n]=go(null,"accessToken"),[t,o,M]=go(null,"user");return{token:e,user:t,setToken:a,setUser:o,storageLogout:()=>{n(),M()}}},Nz=l.createContext(),Zd=({children:e})=>{const{heartbeatEndpoint:a,firstPrivatePath:n,infiniteSession:t,timeDeducted:o,authenticatedEndpoint:M,autoLogin:b,setCurrentDate:s,isDebug:i,backendToken:z,useCustomLoginTimeout:p,stopLoaderOnFinish:c,customLoginTimeout:r,tokenLog:u,timerInfiniteSession:A}=R1(),{setIsLoading:R,showLoadingFor:q}=K2(),{setShowAlert:O,activeAlert:m}=w2(),{token:y,setToken:g,setUser:h,storageLogout:v}=Ce(),N=s0.useNavigate(),[X,I]=l.useState(null),[G,i0]=l.useState(),[w0,J0]=l.useState(),[d0,a0]=l.useState(!1),A0=async(L0=u0,l0,U)=>await vz(m,L0,l0,U),z0=async(L0=null,l0)=>{L0&&L0.preventDefault(),a0(!0);try{p?q(r):R(!0),O(!1);const r0=await(await A0()).post(M,{auth:l0}),f0=r0.headers.token,K0=r0.data;f0&&(h(K0),g(f0),I(!0),N(`${n}${K0.id}`))}catch(U){console.error(U),R(!1)}finally{a0(!1),!p&&c&&R(!1)}},u0=()=>{v(),I(!1)},N0=async()=>{try{const U=(await(await A0()).get(`${a}`)).headers.token;g(U),i&&console.log("[Auth]: Nuovo token: ",U,"Data:",s())}catch(L0){console.error(L0),u0()}},_0=L0=>{const l0=L0||y;if(!l0)return;const U="Token non valido";try{const r0=pM(l0);if(!r0.exp){u&&console.warn("[Auth]: Token senza data di scadenza, eseguo logout."),u0(),m("danger",U);return}const f0=Math.floor(Date.now()/1e3),K0=(r0.exp-f0)*1e3;if(K0<=0){u&&console.warn("[Auth]: Token scaduto, eseguo logout."),u0(),m("danger",U);return}J0(K0),i0(K0-o);const l1=K0-o;if(u){const e1=Math.floor(K0/1e3),W=Math.floor(e1/60),B=e1%60;console.log(`[Auth]: Token valido per ancora: ${W} minuti e ${B} secondi`),console.log("[Auth]: Token:",y)}return l1}catch(r0){u&&console.error("[Auth]: Errore nella decodifica del token:",r0),u0(),m("danger",U)}},k0=L0=>{if(!L0)return!1;try{const l0=pM(L0),U=Math.floor(Date.now()/1e3);return!l0.exp||l0.exp<U?(console.warn("[Auth]: Token scaduto o non valido"),!1):!0}catch(l0){return console.error("[Auth]: Token non valido o corrotto",l0),!1}},u2=async L0=>{try{const r0=(await(await A0()).get(a,{headers:{Authorization:`Bearer ${L0}`}})).data;r0&&(h(r0),g(L0),I(!0),N(`${n}${r0.id}`))}catch(l0){console.error(l0)}},u1=()=>{k0(y)?(u&&console.log("[Auth]: Ricarico pagina → controllo scadenza token"),_0(y)):(u&&console.warn("[Auth]: Token non valido al reload, eseguo logout"),u0())};l.useEffect(()=>{if(!k0(y)){u0();return}I(!0)},[]),l.useEffect(()=>{b&&!X&&!d0&&(u&&console.log("[Auth]: Tentativo di autologin con backendToken"),u2(z))},[b,X,d0]),l.useEffect(()=>{if(document.readyState==="complete")u1();else return window.addEventListener("load",u1),()=>window.removeEventListener("load",u1)},[]),l.useEffect(()=>{if(b)return;const L0=_0(y),l0=A||L0;u&&console.log("[Auth]: intervallo per il prossimo token:",l0);let U;t&&y&&L0&&(u&&console.log("[Auth]: Entrato dentro il timer della sessione infinita"),U=setInterval(()=>{N0()},l0));let r0;return!t&&y&&(u&&console.log("[Auth]: Entrato dentro il timer della sessione con scadenza del token"),r0=setTimeout(()=>{u0(),m("danger","Sessione scaduta")},w0)),()=>{U&&clearInterval(U),r0&&clearTimeout(r0)}},[y,G]);const s1={isAuthenticated:X,setIsAuthenticated:I,login:z0,logout:u0,createAxiosInstances:A0,fetchHeartbeat:N0,getTokenExpiry:_0,checkTokenValidity:k0,fetchUser:u2,handleLoad:u1};return d.jsx(Nz.Provider,{value:s1,children:e})},La=()=>{const e=l.useContext(Nz);if(e===void 0)throw new Error("Non sei dentro al Auth Provider");return e},_z=l.createContext(),$d=({children:e,publicRoutes:a=[],privateRoutes:n=[]})=>d.jsx(_z.Provider,{value:{publicRoutes:a,privateRoutes:n},children:e}),Bz=()=>{const e=l.useContext(_z);if(e===void 0)throw new Error(`Errore: Le rotte non sono state inizializzate correttamente.
103
103
 
104
104
  Soluzione: Assicurati di avvolgere il tuo componente con <RouteProvider>.
105
105
 
@@ -481,7 +481,7 @@ const Es = q1(), Kq = ({ children: e, defaultComponent: a }) => {
481
481
  const e = j0(Es);
482
482
  if (e === void 0) throw new Error("Non puoi settare il loading");
483
483
  return e;
484
- }, zc = "0.0.211", pc = ({ errorMessage: e, errorShow: a }) => /* @__PURE__ */ d.jsx("section", { className: a ? "" : "hidden", children: /* @__PURE__ */ d.jsxs("div", { className: "container mx-auto", children: [
484
+ }, zc = "0.0.212", pc = ({ errorMessage: e, errorShow: a }) => /* @__PURE__ */ d.jsx("section", { className: a ? "" : "hidden", children: /* @__PURE__ */ d.jsxs("div", { className: "container mx-auto", children: [
485
485
  /* @__PURE__ */ d.jsx("h1", { className: "text-center text-8xl my-12", children: "Errore" }),
486
486
  /* @__PURE__ */ d.jsx("pre", { className: "text-xl", children: e })
487
487
  ] }) });
@@ -8249,7 +8249,7 @@ const aA = async (e, a, n, t) => {
8249
8249
  }), Oe.interceptors.request.use(
8250
8250
  (p) => {
8251
8251
  const c = JSON.parse(localStorage.getItem("accessToken"));
8252
- return c ? p.headers.Authorization = `Bearer ${c}` : delete p.headers.Authorization, p;
8252
+ return c ? p.headers.Authorization = `Bearer ${c}` : p.headers.Authorization || delete p.headers.Authorization, p;
8253
8253
  }
8254
8254
  ), Oe.interceptors.response.use(
8255
8255
  (p) => p,
@@ -8351,7 +8351,9 @@ const aA = async (e, a, n, t) => {
8351
8351
  }
8352
8352
  }, y2 = async (N0) => {
8353
8353
  try {
8354
- const r0 = (await (await u0()).get(a)).data;
8354
+ const r0 = (await (await u0()).get(a, {
8355
+ headers: { Authorization: `Bearer ${N0}` }
8356
+ })).data;
8355
8357
  r0 && (f(r0), R(N0), j(!0), v(`${n}${r0.id}`));
8356
8358
  } catch (m0) {
8357
8359
  console.error(m0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "thecore-auth",
3
3
  "private": false,
4
- "version": "0.0.211",
4
+ "version": "0.0.212",
5
5
  "type": "module",
6
6
  "main": "dist/thecore-auth.cjs.js",
7
7
  "style": "dist/thecore-auth.css",