thecore-auth 0.0.206 → 0.0.207
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/thecore-auth.cjs.js
CHANGED
|
@@ -28,7 +28,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
28
28
|
|
|
29
29
|
Check the render method of \``+L+"`."),O||(g=e(g))&&(O=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+g+">."),O}var T=p,M=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),B=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),ye=Symbol.for("react.suspense"),Se=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),se=Symbol.for("react.offscreen"),H=Symbol.iterator,q=Symbol.for("react.client.reference"),re=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=Object.prototype.hasOwnProperty,pe=Object.assign,Nt=Symbol.for("react.client.reference"),qe=Array.isArray,Ye=0,oe,ee,G,ae,Y,Pe,Ke;i.__reactDisabledLog=!0;var Xe,Ze,dt=!1,Bt=new(typeof WeakMap=="function"?WeakMap:Map),$n=Symbol.for("react.client.reference"),Je,ft={},ht={},_e={};mn.Fragment=R,mn.jsx=function(g,O,L,W,ce){return y(g,O,L,!1,W,ce)},mn.jsxs=function(g,O,L,W,ce){return y(g,O,L,!0,W,ce)}}()),mn}var wr;function zc(){return wr||(wr=1,process.env.NODE_ENV==="production"?Wn.exports=Fc():Wn.exports=$c()),Wn.exports}var h=zc();const la=p.createContext(),Uc=({children:e,defaultComponent:t})=>{const[n,i]=p.useState(!1),[s,o]=p.useState({}),[r,a]=p.useState(t),c={isLoading:n,setIsLoading:i,loadingProps:s,setLoadingProps:o,loadingComponent:r,setLoadingComponent:a,showLoadingFor:(u=2e3,d={})=>{o(d),i(!0),setTimeout(()=>{i(!1)},u)}};return h.jsx(la.Provider,{value:c,children:e})},It=()=>{const e=p.useContext(la);if(e===void 0)throw new Error("Non puoi settare il loading");return e},Hc="0.0.
|
|
31
|
+
Check the top-level render call using <`+g+">."),O}var T=p,M=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),B=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),ye=Symbol.for("react.suspense"),Se=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),se=Symbol.for("react.offscreen"),H=Symbol.iterator,q=Symbol.for("react.client.reference"),re=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=Object.prototype.hasOwnProperty,pe=Object.assign,Nt=Symbol.for("react.client.reference"),qe=Array.isArray,Ye=0,oe,ee,G,ae,Y,Pe,Ke;i.__reactDisabledLog=!0;var Xe,Ze,dt=!1,Bt=new(typeof WeakMap=="function"?WeakMap:Map),$n=Symbol.for("react.client.reference"),Je,ft={},ht={},_e={};mn.Fragment=R,mn.jsx=function(g,O,L,W,ce){return y(g,O,L,!1,W,ce)},mn.jsxs=function(g,O,L,W,ce){return y(g,O,L,!0,W,ce)}}()),mn}var wr;function zc(){return wr||(wr=1,process.env.NODE_ENV==="production"?Wn.exports=Fc():Wn.exports=$c()),Wn.exports}var h=zc();const la=p.createContext(),Uc=({children:e,defaultComponent:t})=>{const[n,i]=p.useState(!1),[s,o]=p.useState({}),[r,a]=p.useState(t),c={isLoading:n,setIsLoading:i,loadingProps:s,setLoadingProps:o,loadingComponent:r,setLoadingComponent:a,showLoadingFor:(u=2e3,d={})=>{o(d),i(!0),setTimeout(()=>{i(!1)},u)}};return h.jsx(la.Provider,{value:c,children:e})},It=()=>{const e=p.useContext(la);if(e===void 0)throw new Error("Non puoi settare il loading");return e},Hc="0.0.207",ca=({errorMessage:e,errorShow:t})=>h.jsx("section",{className:t?"":"hidden",children:h.jsxs("div",{className:"container mx-auto",children:[h.jsx("h1",{className:"text-center text-8xl my-12",children:"Errore"}),h.jsx("pre",{className:"text-xl",children:e})]})});function Wc(){const[e,t]=p.useState(document.visibilityState),[n,i]=p.useState(document.hasFocus()),[s,o]=p.useState(!1),[r,a]=p.useState(!1),l=()=>{t(document.visibilityState)},c=()=>i(!0),u=()=>i(!1),d=y=>{o(y.persisted),a(!1)},f=()=>{a(!0)};p.useEffect(()=>(document.addEventListener("visibilitychange",l),window.addEventListener("focus",c),window.addEventListener("blur",u),window.addEventListener("pageshow",d),window.addEventListener("pagehide",f),()=>{document.removeEventListener("visibilitychange",l),window.removeEventListener("focus",c),window.removeEventListener("blur",u),window.removeEventListener("pageshow",d),window.removeEventListener("pagehide",f)}),[]);const m=p.useMemo(()=>e==="visible"&&n,[e,n]);return{visibilityState:e,isVisible:e==="visible",isHidden:e==="hidden",hasFocus:n,isActive:m,isFromBFCache:s,isPageHidden:r}}const ua=p.createContext(),Gc=({children:e})=>{const t=Wc(),[n,i]=p.useState({}),[s,o]=p.useState(!1),r=p.useRef(!1),a=`Creare un file config.json in public per il corretto funzionamento
|
|
32
32
|
Esempio di config.json:
|
|
33
33
|
|
|
34
34
|
{
|
|
@@ -107,4 +107,4 @@ Esempio:
|
|
|
107
107
|
|
|
108
108
|
<RouteProvider publicRoutes={[]} privateRoutes={[]}>
|
|
109
109
|
<MyPackageRoutes />
|
|
110
|
-
</RouteProvider>`);return e},dc=p.createContext(),_m=({children:e})=>{const{login:t}=Fn(),{clearLoginFormOnError:n}=Be(),i={email:"",password:""},[s,o]=p.useState("Accedi"),[r,a]=p.useState("Email"),[l,c]=p.useState("email"),[u,d]=p.useState("example@example.it"),[f,m]=p.useState("Accedi"),[y,S]=p.useState(i),[w,v]=p.useState(),[b,T]=p.useState(),[M,x]=p.useState(),[R,D]=p.useState(),[j,I]=p.useState({}),[B,Q]=p.useState(null),Z={overrideStyle:j,setOverrideStyle:I,title:s,setTitle:o,label:r,setLabel:a,type:l,setType:c,placeholder:u,setPlaceholder:d,buttonText:f,setButtonText:m,formData:y,setFormData:S,LogoImg:w,setLogoImg:v,styleCardForm:b,setStyleCardForm:T,styleContainerLogo:M,setStyleContainerLogo:x,styleLogo:R,setStyleLogo:D,changeData:(z,se)=>{S(H=>({...H,[z]:se}))},handleLogin:z=>{t(z,y),n&&S(i)},customVersion:B,setCustomVersion:Q};return h.jsx(dc.Provider,{value:Z,children:e})},pr=()=>{const e=p.useContext(dc);if(e===void 0)throw new Error("Non puoi modificare La login");return e},fc=p.createContext(),Fm=({children:e})=>{const[t,n]=p.useState(!1),[i,s]=p.useState(null),[o,r]=p.useState(""),[a,l]=p.useState(null),[c,u]=p.useState(null),[d,f]=p.useState(null),[m,y]=p.useState("modal-form"),[S,w]=p.useState("submit"),[v,b]=p.useState({}),[T,M]=p.useState(null),[x,R]=p.useState(null),[D,j]=p.useState(null),I=({modalData:Z,component:z,title:se="",onConfirm:H=null,type:q="submit",formId:re="modal-form",item:te=null,style:pe})=>{M(Z),s(()=>z),r(se),l(()=>H),w(q),y(re),f(te),b(pe),n(!0)},B=()=>{s(null),r(""),l(null),w("submit"),y("modal-form"),f(null),b({}),n(!1),M(null)},Se={isOpen:t,openModal:I,closeModal:B,content:i,title:o,onConfirm:a,type:S,item:d,formId:m,style:v,modalData:T,setModalData:M,handleChange:Z=>{const{name:z,value:se}=Z.target;M(H=>({...H,[z]:se}))},handleSubmit:Z=>{Z.preventDefault(),a&&(a(T),B())},headerContent:x,setHeaderContent:R,footerContent:D,setFooterContent:j,onCancel:c,setOnCancel:u};return h.jsx(fc.Provider,{value:Se,children:e})},hc=()=>{const e=p.useContext(fc);if(e===void 0)throw new Error("Non sei all'interno del ModalProvider");return e},pc=(e=[],t="SPOT")=>{const n=U.useLocation();p.useLayoutEffect(()=>{let i=t;for(const s of e)if(U.matchPath({path:s.path,end:!0},n.pathname)){i=s.title;break}document.title=i},[n,e,t])},$m=(e,t,n=1)=>{const i=p.useRef(null),[s,o]=p.useState(!1),r=p.useCallback(m=>new Promise((y,S)=>{if(!i.current){S("DB non pronto");return}const b=i.current.transaction(t,"readonly").objectStore(t).get(m);b.onsuccess=()=>y(b.result),b.onerror=T=>S(T.target.error)}),[t]),a=p.useCallback(()=>new Promise((m,y)=>{if(!i.current)return y("DB non pronto");const v=i.current.transaction(t,"readonly").objectStore(t).getAll();v.onsuccess=()=>m(v.result),v.onerror=b=>y(b.target.error)}),[t]),l=p.useCallback(m=>new Promise((y,S)=>{if(!i.current){S("DB non pronto");return}const b=i.current.transaction(t,"readwrite").objectStore(t).put(m);b.onsuccess=()=>y(b.result),b.onerror=T=>S(T.target.error)}),[t]),c=p.useCallback(async()=>{let m=Date.now();for(;await r(m);)m++;return m},[r]),u=p.useCallback(async m=>(m.id||(m.id=await c()),l(m)),[c,l]),d=p.useCallback(m=>new Promise((y,S)=>{if(!i.current){S("DB non pronto");return}const b=i.current.transaction(t,"readwrite").objectStore(t).delete(m);b.onsuccess=()=>y(!0),b.onerror=T=>S(T.target.error)}),[t]),f=p.useCallback(()=>new Promise((m,y)=>{if(!i.current){y("DB non pronto");return}const v=i.current.transaction(t,"readwrite").objectStore(t).clear();v.onsuccess=()=>m(!0),v.onerror=b=>y(b.target.error)}),[t]);return p.useEffect(()=>{const m=indexedDB.open(e,n);return m.onupgradeneeded=y=>{const S=y.target.result;S.objectStoreNames.contains(t)||S.createObjectStore(t,{keyPath:"id"})},m.onsuccess=y=>{i.current=y.target.result,o(!0)},m.onerror=y=>{console.error("IndexedDB error",y.target.error)},()=>{var y;(y=i.current)==null||y.close()}},[e,t,n]),{get:r,getAll:a,set:l,setWithAutoId:u,remove:d,clear:f,isReady:s}},zm=()=>{const[e,t]=p.useState(window.innerWidth>window.innerHeight?"landscape":"portrait");return p.useEffect(()=>{const n=()=>{t(window.innerWidth>window.innerHeight?"landscape":"portrait")};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e},mc=(e={getValues:!1})=>{const{getValues:t}=e,[n,i]=p.useState(0),s=()=>{const o=window.visualViewport?window.visualViewport.height:window.innerHeight,r=o*.01;document.documentElement.style.setProperty("--vh",`${r}px`),t&&i(o)};return p.useEffect(()=>(s(),window.addEventListener("resize",s),window.addEventListener("orientationchange",s),()=>{window.removeEventListener("resize",s),window.removeEventListener("orientationchange",s)}),[t]),t?{height:n,vh:n*.01}:null},Um=(e=["/"])=>{const t=U.useLocation();p.useEffect(()=>(e.includes(t.pathname)?document.body.classList.remove("with-safe-area"):document.body.classList.add("with-safe-area"),()=>{document.body.classList.remove("with-safe-area")}),[t.pathname,e])};function gc(e){return St({tag:"svg",attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M8 0c-4.355 0-7.898 3.481-7.998 7.812 0.092-3.779 2.966-6.812 6.498-6.812 3.59 0 6.5 3.134 6.5 7 0 0.828 0.672 1.5 1.5 1.5s1.5-0.672 1.5-1.5c0-4.418-3.582-8-8-8zM8 16c4.355 0 7.898-3.481 7.998-7.812-0.092 3.779-2.966 6.812-6.498 6.812-3.59 0-6.5-3.134-6.5-7 0-0.828-0.672-1.5-1.5-1.5s-1.5 0.672-1.5 1.5c0 4.418 3.582 8 8 8z"},child:[]}]})(e)}const yc=()=>{const{loadingProps:e,loadingComponent:t}=It(),{spinner:n=!0,spinnerStyle:i,text:s,textStyle:o,children:r,containerStyle:a,overrideStyle:l={}}=e;return t||h.jsxs("div",{className:l.container||`fixed top-0 bottom-0 left-0 right-0 flex items-center justify-center bg-loading-bg z-[999] ${a}`,children:[n&&h.jsx(gc,{className:l.spinner||`text-[20rem] relative animate-spin text-spinner ${i}`}),r||h.jsx("p",{className:l.text||`text-white text-2xl select-none absolute ${o}`,children:s||"Loading..."})]})};function Hm(e){return St({tag:"svg",attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor"},child:[]}]})(e)}const Ds=()=>{const{messageAlert:e,typeAlert:t,alertConfig:n,getIcon:i,closeAlert:s}=Ct(),{alertTimeout:o}=Be(),[r,a]=p.useState(0),{bgColor:l,textColor:c,buttonBg:u,hoverBg:d,focusRing:f,progressColor:m}=n[t];return p.useEffect(()=>{let y;const w=100/(o/100);y=setInterval(()=>{a(b=>b>=100?(clearInterval(y),100):b+w)},100);const v=setTimeout(()=>{s()},o);return()=>{clearTimeout(v),clearInterval(y)}},[]),h.jsxs("div",{className:` ${l} ${c} flex items-center min-h-[65px] max-h-[100px] p-4 pt-6 rounded-lg mx-auto max-sm:min-w-[240px] sm:max-w-1/3 fixed sm:top-[calc(100vh-100px)] top-[calc(100vh-115px)] sm:right-10 right-1/2 translate-x-1/2 sm:translate-0 z-100`,role:"alert",children:[h.jsx("div",{className:"w-full bg-gray-200 rounded-t-lg overflow-hidden h-2.5 absolute top-0 left-0 right-0",children:h.jsx("div",{className:`${m} h-2.5 rounded-t-lg`,style:{width:`${r}%`}})}),i(t),h.jsx("div",{className:"px-4 text-sm font-medium",children:e}),h.jsx("button",{type:"button",className:`ms-auto ${u} rounded-lg focus:ring-2 ${f} p-1.5 ${d} inline-flex items-center justify-center h-8 w-8 cursor-pointer`,title:"Close",onClick:s,children:h.jsx(Hm,{className:"text-xl"})})]})},Wm=({onClose:e,onConfirm:t,onCancel:n,type:i,formId:s,style:o})=>{const r=o.resetButton??!0,a=o.confirmButtonText??(i==="delete"?"Elimina":"Salva"),l=o.cancelButtonText??"Annulla",c=o.bgSaveButton??"bg-indigo-600 rounded-lg shadow-md hover:bg-indigo-700 hover:shadow-lg active:bg-indigo-800 text-white",u=o.bgDeleteButton??"bg-rose-500 rounded-lg shadow-md hover:bg-rose-600 hover:shadow-lg active:bg-rose-700 text-white",d=o.bgResetButton??"bg-rose-500 rounded-lg shadow-md hover:bg-rose-600 hover:shadow-lg active:bg-rose-700 text-white",f=o.bgCancelButton??"text-gray-800 bg-gray-300 rounded-lg shadow-md hover:bg-gray-400 hover:shadow-lg active:bg-gray-500",m=i==="custom"?o.customButtonStyle:null,y={delete:()=>{t==null||t(),e==null||e()},custom:()=>{t==null||t()}};return h.jsxs("footer",{className:"flex items-center justify-between mt-4",children:[h.jsx("button",{onClick:n||e,className:`${f} px-4 py-2 cursor-pointer text-sm font-medium active:shadow-sm transition-all duration-150 ease-in-out hover:opacity-90 active:scale-95 active:opacity-70`,children:l}),h.jsxs("div",{className:"flex items-center gap-4",children:[i!=="delete"&&r&&h.jsx("button",{type:"reset",form:s,className:`px-4 py-2 cursor-pointer text-sm font-medium ${d} active:shadow-sm transition-all duration-150 ease-in-out hover:opacity-90 active:scale-95 active:opacity-70`,children:"Reset"}),h.jsx("button",{type:i==="submit"?"submit":"button",form:i==="submit"?s:void 0,onClick:()=>{var S;return(S=y[i])==null?void 0:S.call(y)},className:m||`${i==="delete"?u:c} px-4 py-2 cursor-pointer text-sm font-medium active:shadow-sm transition-all duration-150 ease-in-out hover:opacity-90 active:scale-95 active:opacity-70`,children:a})]})]})};function Gm(e){return St({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"18",y1:"6",x2:"6",y2:"18"},child:[]},{tag:"line",attr:{x1:"6",y1:"6",x2:"18",y2:"18"},child:[]}]})(e)}const qm=({onClose:e,type:t,title:n,name:i,onCancel:s})=>h.jsxs("header",{className:`flex items-center justify-between mb-4 ${t==="delete"?"gap-8":""}`,children:[t==="delete"&&i?h.jsxs("h2",{className:"text-2xl",children:["Sei sicuro di volere eliminare: ",h.jsx("strong",{children:i}),"?"]}):h.jsx("h2",{className:"text-2xl",children:n||"Conferma operazione"}),h.jsx("button",{onClick:s||e,className:"text-gray-500 hover:text-gray-700 cursor-pointer transition-transform duration-150 ease-in-out hover:scale-110 hover:opacity-80 active:scale-95 active:opacity-60","aria-label":"Chiudi modale",children:h.jsx(Gm,{className:"text-2xl"})})]}),Ym=({type:e,children:t,item:n,overrideStyle:i})=>h.jsx(h.Fragment,{children:e!=="delete"&&h.jsx("main",{className:i||"my-8 max-h-[600px] overflow-y-auto overflow-x-hidden",children:e==="delete"&&!n?h.jsx("div",{className:"text-red-600 font-semibold",children:"Errore: nessun item selezionato per l'operazione."}):t})}),Km=({isOpen:e,onClose:t,onCancel:n,title:i,formId:s,children:o,item:r,onConfirm:a,type:l="submit",style:c={},headerContent:u,footerContent:d})=>{const f=p.useRef(null),[m,y]=p.useState(e),S=()=>{e||y(!1)},w=c.width??(l==="delete"?"max-w-md w-auto":"w-full max-w-4xl"),v=c.bgModal??"bg-white",b=c.bgOverlay??"bg-black/50",T=c.zIndex??"z-50";return p.useEffect(()=>{e&&y(!0)},[e]),p.useEffect(()=>{const M=x=>{x.key==="Escape"&&(n?n():t())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[t,n]),p.useEffect(()=>{var M;if(e){const x=document.activeElement;return(M=f.current)==null||M.focus(),()=>x==null?void 0:x.focus()}},[e]),m?aa.createPortal(h.jsx("div",{className:`fixed inset-0 ${T} flex items-center justify-center transition-opacity duration-200 ${e?`${b} opacity-100`:"opacity-0"}`,onClick:n||t,onKeyDown:M=>{var x;M.key==="Escape"&&((x=n||t)==null||x())},onTransitionEnd:S,role:"button",tabIndex:0,"aria-label":"Chiudi modale",children:h.jsxs("div",{ref:f,className:`relative ${v} rounded-lg p-6 shadow-xl ${w} transform transition-transform duration-200 ${e?"scale-100 opacity-100":"scale-95 opacity-0"}`,onClick:M=>M.stopPropagation(),onKeyDown:M=>{M.key==="Escape"&&t()},role:"dialog","aria-modal":"true",tabIndex:-1,children:[u||h.jsx(qm,{onClose:t,onCancel:n,type:l,title:i,name:r==null?void 0:r.name}),h.jsx(Ym,{type:l,item:r,overrideStyle:c.overrideStyle,children:o}),d||h.jsx(Wm,{onClose:t,onCancel:n,onConfirm:a,type:l,formId:s,style:c})]})}),document.body):null},vc=e=>{const{isLoading:t}=It(),{showAlert:n}=Ct(),{sileoToastConfig:i,pwa:s}=Be(),{isOpen:o,closeModal:r,onCancel:a,content:l,title:c,onConfirm:u,item:d,type:f,formId:m,style:y,headerContent:S,footerContent:w}=hc(),v=U.useLocation(),{isMain:b=!0,headerComponent:T=null,showHeaderOnLogin:M=!1,headerExcludedRoutes:x=[],footerComponent:R=null,showFooterOnLogin:D=!1,footerExcludedRoutes:j=[],promptComponent:I=null}=e,B={fill:"#000000",duration:2e3,styles:{title:"text-white font-semibold",description:"text-white/75",badge:"bg-white/20"}},Q=i==null?void 0:i.position,ye=(i==null?void 0:i.options)||B,Se=x.some(H=>U.matchPath(H,v.pathname));let Z;v.pathname==="/"?Z=T&&M:Z=T&&!Se;const z=j.some(H=>U.matchPath(H,v.pathname));let se;return v.pathname==="/"?se=R&&D:se=R&&!z,h.jsxs(h.Fragment,{children:[s&&s.customPrompt&&I,t&&h.jsx(yc,{}),n&&h.jsx(Ds,{}),h.jsx(Om,{position:Q||"bottom-right",options:ye}),h.jsx(Km,{isOpen:o,onClose:r,onCancel:a,title:c,formId:m,onConfirm:u,type:f,item:d,style:y,headerContent:S,footerContent:w,children:l}),Z&&T,b?h.jsxs("main",{className:t?"hidden":"",children:[n&&h.jsx(Ds,{}),h.jsx(U.Outlet,{})]}):h.jsx(U.Outlet,{}),se&&R]})},xi=e=>{const{inputType:t,inputId:n,inputPlaceholder:i,inputRequired:s,inputValue:o,inputChange:r,inputName:a,autoFocus:l,inputStyle:c,overrideStyle:u,disabled:d}=e,m=["text","email","password","search","tel","url"].includes(t)?t:"text";return h.jsx("input",{type:m,autoFocus:l,id:n,className:u||`bg-input-bg border border-input-border text-input-text text-input-placeholder input-rounded focus:ring focus:ring-primary focus:border-primary focus:outline-none focus:shadow-(--shadow-primary-input) block w-full p-input ${c}`,placeholder:i,required:s??!0,value:o,onChange:r,disabled:d,name:a})},Si=({label:e,labelId:t,labelStyle:n,overrideStyle:i})=>h.jsx("label",{htmlFor:t,className:i||`show-label mb-1 sm:mb-2 text-input-label font-medium text-color-label ${n}`,children:e}),bc=()=>{const{title:e,label:t,type:n,placeholder:i,buttonText:s,formData:o,changeData:r,handleLogin:a,overrideStyle:l}=pr();return h.jsxs("form",{onSubmit:a,className:l.form||"form-size",children:[h.jsx("h1",{className:l.title||"text-form-title-size show-title title-position m-form-title",children:e}),h.jsxs("div",{className:l.containerEmail||"flex justify-center flex-col gap-1 m-input-form input-size mx-auto",children:[h.jsx(Si,{labelId:"user-email",label:t}),h.jsx(xi,{inputType:n,inputId:"user-email",inputPlaceholder:i,inputValue:o.email,inputChange:c=>{r("email",c.target.value)},autoFocus:!0})]}),h.jsxs("div",{className:l.containerPassword||"flex justify-center flex-col gap-1 my-4 input-size mx-auto",children:[h.jsx(Si,{labelId:"password",label:"Password"}),h.jsx(xi,{inputType:"password",inputId:"password",inputPlaceholder:"Password",inputValue:o.password,inputChange:c=>{r("password",c.target.value)}})]}),h.jsx("div",{className:l.containerButton||"flex button-position items-center m-primary-button",children:h.jsx("button",{className:l.button||"font-bold cursor-pointer shadow-(--shadow-primary) transition-all duration-200 hover:shadow-(--shadow-primary-hover) active:shadow-(--shadow-primary-active) active:translate-y-[2px] p-primary-button rounded-primary-button bg-primary hover:bg-primary-hover text-primary-text",children:s})})]})},wc=({Logo:e})=>{const{styleCardForm:t,styleContainerLogo:n,styleLogo:i,overrideStyle:s,customVersion:o}=pr(),{firstPrivatePath:r,version:a}=Be(),{token:l,user:c}=hn();mc();const u=U.useNavigate();return p.useEffect(()=>{l&&(c!=null&&c.id)&&u(`${r}${c.id}`)},[]),h.jsxs("section",{id:"login-page",children:[(a||o)&&h.jsx("div",{style:{top:"calc(1rem + env(safe-area-inset-top))",left:"calc(1rem + env(safe-area-inset-left))"},className:"text-md text-primary absolute",children:o||a}),h.jsx("div",{className:s.container||"container mx-auto flex items-center justify-center min-h-screen",children:h.jsxs("div",{className:s.cardForm||`bg-form card-style card-size flex flex-col sm:flex-row sm:items-center justify-center ${t}`,children:[h.jsx("div",{className:s.containerLogo||`basis-1/2 flex items-center justify-center ${n}`,children:e&&h.jsx(e,{className:s.logo||`login-logo h-full sm:h-auto ${i}`})}),h.jsx(bc,{})]})})]})},Cn=()=>{const{isAuthenticated:e}=Fn(),{activeAlert:t}=Ct(),{autoLogin:n}=Be(),{token:i}=hn();return p.useEffect(()=>{!e&&!i&&!n&&t("danger","Non sei autorizzato")},[]),e===null?null:e?h.jsx(U.Outlet,{}):h.jsx(U.Navigate,{to:"/",replace:!0})},xc=({value:e,defaultValue:t=!1,onChange:n})=>{const i=e!==void 0,[s,o]=p.useState(t),r=i?e:s,a=()=>{const l=!r;i||o(l),n&&n(l)};return p.useEffect(()=>{i||o(t)},[t,i]),h.jsx("button",{type:"button",onClick:a,className:`w-14 h-6 flex items-center rounded-full p-1 transition-colors cursor-pointer ${r?"bg-blue-500":"bg-gray-300"}`,"aria-pressed":r,children:h.jsx("div",{className:`bg-white w-4 h-4 rounded-full shadow-md transform transition-transform ${r?"translate-x-8":"translate-x-0"}`})})},Sc=()=>{const{logout:e,createAxiosInstances:t}=Fn(),{usersEndpoint:n}=Be(),{setIsLoading:i}=It(),{activeAlert:s}=Ct(),{token:o,user:r}=hn(),{success:a,error:l,info:c,warning:u,promise:d}=hr(),[f,m]=p.useState(null),[y,S]=p.useState(!1),[w,v]=p.useState(!1),b=(B,Q)=>d(B,{loading:{title:Q.loading||"Caricamento..."},success:{title:Q.success||"Fatto!"},error:{title:Q.error||"Errore!"}}),T=async()=>{try{if(S(!0),!o){e(),s("danger","Sessione Scaduta");return}const B=await t(),ye=(await b(B.get(`${n}`),{loading:"Caricamento utenti...",success:"Utenti caricati!"})).data;m(ye)}catch(B){console.error(B),i(!1)}finally{S(!1)}},M=B=>{v(B),s("info",`Alert impostato su ${B?"Mobile":"Desktop"} `)},x=(B="Operazione riuscita!")=>{w?a("Successo",B):s("success",B,!0)},R=(B="Si è verificato un errore!")=>{w?l("Errore",B):s("danger",B,!0)},D=(B="Informazione generica")=>{w?c("Info",B):s("info",B,!0)},j=(B="Attenzione!")=>{w?u("Attenzione",B):s("warning",B,!0)},I=()=>{e(),s("info","Hai effettuato il logout")};return h.jsx("section",{children:h.jsxs("div",{className:"container mx-auto py-8",children:[h.jsxs("div",{className:"flex items-center justify-center gap-8 h-20",children:[h.jsxs("h1",{className:"text-4xl text-center text-slate-800",children:["Email: ",r.email]}),h.jsx("button",{onClick:I,className:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-full cursor-pointer shadow-[0_4px_10px_rgba(239,68,68,0.3),0_2px_4px_rgba(239,68,68,0.2)] hover:shadow-[0_6px_14px_rgba(185,28,28,0.4),0_3px_6px_rgba(185,28,28,0.3)] active:shadow-[0_2px_5px_rgba(239,68,68,0.3)] transition-all duration-200 active:translate-y-[2px]",children:"Logout"})]}),h.jsxs("div",{className:"flex justify-center items-center gap-4 my-8 flex-wrap",children:[h.jsx("button",{onClick:()=>x("Questo è un toast di successo!"),className:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded-full shadow-md transition-all",children:"Success"}),h.jsx("button",{onClick:()=>R("Questo è un toast di errore!"),className:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-full shadow-md transition-all",children:"Error"}),h.jsx("button",{onClick:()=>D("Questo è un toast informativo!"),className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full shadow-md transition-all",children:"Info"}),h.jsx("button",{onClick:()=>j("Questo è un toast di avviso!"),className:"bg-yellow-500 hover:bg-yellow-600 text-white font-bold py-2 px-4 rounded-full shadow-md transition-all",children:"Warning"}),h.jsxs("div",{className:"flex items-center gap-4 my-4",children:[h.jsx("span",{children:"Desktop"}),h.jsx(xc,{value:w,onChange:M}),h.jsx("span",{children:"Mobile"})]})]}),h.jsx("div",{className:"flex justify-center items-center my-12 gap-8",children:h.jsx("button",{onClick:T,className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full disabled:bg-blue-300 disabled:text-gray-500 disabled:cursor-not-allowed cursor-pointer transition-all duration-200 active:translate-y-[2px] shadow-[0_4px_10px_rgba(59,130,246,0.3),0_2px_4px_rgba(59,130,246,0.2)] hover:shadow-[0_6px_14px_rgba(29,78,216,0.4),0_3px_6px_rgba(29,78,216,0.3)] active:shadow-[0_2px_5px_rgba(59,130,246,0.3)]",disabled:y,children:"Lista degli utenti"})}),h.jsx("div",{className:"flex justify-center items-center",children:f&&h.jsx("ul",{children:f.map(B=>h.jsxs("li",{className:"text-xl my-4",children:[B.id," - ",B.email]},`user-${B.id}`))})})]})})},Xm=e=>V.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",xmlSpace:"preserve",id:"svg1",width:409.748,height:409.748,viewBox:"0 0 108.413 108.413",...e},V.createElement("defs",{id:"defs1"},V.createElement("linearGradient",{id:"linearGradient27"},V.createElement("stop",{id:"stop27",offset:0,style:{stopColor:"red",stopOpacity:1}}),V.createElement("stop",{id:"stop28",offset:1,style:{stopColor:"#ffca00",stopOpacity:.96862745}})),V.createElement("linearGradient",{xlinkHref:"#linearGradient27",id:"linearGradient28",x1:35.002,x2:143.414,y1:192.355,y2:83.942,gradientUnits:"userSpaceOnUse"})),V.createElement("g",{id:"layer1",transform:"translate(-35.002 -83.942)"},V.createElement("rect",{id:"rect26",width:108.413,height:108.413,x:35.002,y:83.942,rx:30,ry:30,style:{fill:"url(#linearGradient28)",fillOpacity:1,fillRule:"evenodd",stroke:"#ff9b01",strokeWidth:0,strokeOpacity:1,paintOrder:"stroke markers fill"}}),V.createElement("g",{id:"g1",style:{strokeWidth:1.10252},transform:"translate(9.37 14.003)scale(.90701)"},V.createElement("path",{id:"path272",d:"M103.624 105.014c-.27.002-.79.209-1.004.4a2.5 2.5 0 0 0-.313.395l-.181.277-.018 18.064-.018 18.064h-3.047v-9.75c0-10.412-.004-10.52-.345-11.948-1.398-5.861-6.243-10.128-12.213-10.755-1.515-.16-19.836-.16-20.462-.003l-.002-.004-19.984 3.575 18.852 2.16v6.078l-17.36 3.103 17.36 1.99v6.523l-17.36 3.103 14.275 1.636-.016 4.905-.019 5.726-.63.126c-1.587.315-3.197 1.068-4.528 2.117-2.206 1.737-3.742 4.446-4.053 7.144-.37 3.213.552 6.199 2.657 8.602 1.688 1.926 4.174 3.26 6.696 3.592.824.108 2.933.031 3.671-.134.932-.21 1.79-.515 2.637-.939 2.065-1.033 3.824-2.775 4.827-4.784.504-1.01.91-2.207 1.026-3.029l.047-.329h18.828v.214c0 .117.064.468.142.78.904 3.589 3.509 6.46 6.975 7.686 1.343.475 1.946.568 3.655.564 1.32-.003 1.612-.025 2.182-.158 3.368-.785 6.026-2.86 7.515-5.865.44-.89.882-2.203.972-2.892l.043-.329 7.183-.002c7.08-.002 7.188-.003 7.495-.143.647-.293.9-.703.9-1.457 0-.569-.168-.945-.55-1.225-.505-.373-.225-.36-7.9-.36h-7.115l-.117-.597c-.261-1.329-.848-2.71-1.682-3.957-.57-.854-2.02-2.296-2.864-2.852-1.214-.798-2.805-1.463-4-1.673l-.502-.088-.018-21.17-.018-21.17-.154-.312c-.258-.521-.88-.903-1.465-.9zm9.34.76c-1.961 0-3.686 1.068-4.532 2.806-.536 1.103-.53 1.026-.507 6.443l.02 4.78.189.556c.62 1.83 2.225 3.176 4.083 3.424.241.032 2.715.053 5.496.046 5.705-.015 5.342.017 6.547-.574.548-.269.757-.422 1.25-.918.49-.49.649-.709.917-1.252.538-1.096.535-1.045.535-6.262 0-4.846-.013-5.061-.328-5.862-.764-1.94-2.613-3.187-4.727-3.187h-.557l-.003 4.14-.003 4.139-1.878 1.49a123 123 0 0 1-1.964 1.54c-.056.033-.792-.513-2.034-1.507l-1.947-1.56v-8.242zm2.29.553v6.927l1.084.87c.596.478 1.106.86 1.132.85s.535-.41 1.132-.886l1.085-.866-.017-3.43-.017-3.429-2.2-.018zm-47.247 6.508 9.197.025c9.138.025 9.2.026 9.889.175 2.276.495 4.009 1.425 5.576 2.993 1.563 1.563 2.494 3.26 3.002 5.472.15.658.15.664.17 10.686l.018 10.028h-2.393l-2.91-2.91c-2.148-2.147-2.999-2.954-3.252-3.082l-.342-.174H68.007v-11.606zm44.87 16.355c-.846 0-1.356.1-1.977.386-1.351.623-2.296 1.666-2.771 3.059l-.184.539-.02 4.745c-.023 5.4-.023 5.392.503 6.478.506 1.043 1.244 1.779 2.297 2.294.347.17.83.351 1.073.404.354.077 1.48.097 5.603.1 5.817.004 5.683.015 6.749-.507 1.377-.674 2.299-1.8 2.674-3.27.13-.505.137-.783.137-5.222 0-4.448-.007-4.717-.137-5.237-.233-.926-.636-1.636-1.32-2.324-.515-.519-.69-.645-1.318-.948-.817-.396-1.263-.497-2.19-.497h-.646v8.223l-1.91 1.518c-1.049.834-1.938 1.527-1.974 1.54s-.938-.673-2.004-1.524l-1.939-1.548v-8.209zm2.377.554.004 3.447.004 3.446 1.052.845c.58.464 1.08.845 1.112.848s.555-.39 1.16-.874l1.101-.878v-6.834h-2.217zm-50.295 9.491H85.98l3.015 3.002c2.568 2.557 3.058 3.014 3.3 3.083.206.058 1.624.08 5.04.08h4.755v3.16l-.537.094c-1.12.195-2.648.81-3.729 1.498-1.69 1.076-3.119 2.7-3.994 4.536-.443.931-.884 2.341-.884 2.83v.214H74.119l-.046-.329c-.174-1.222-.844-2.861-1.707-4.174-.532-.809-1.996-2.292-2.8-2.836-1.322-.897-2.958-1.574-4.282-1.772l-.325-.05v-4.668z",style:{fill:"#000",strokeWidth:1.10252}}),V.createElement("path",{id:"path268",d:"M103.624 103.562c-.27.002-.79.209-1.004.4a2.5 2.5 0 0 0-.313.395l-.181.277-.018 18.064-.018 18.064h-3.047v-9.75c0-10.412-.004-10.52-.345-11.948-1.398-5.861-6.243-10.129-12.213-10.755-1.515-.16-19.836-.16-20.462-.003l-.002-.004-19.984 3.575 18.852 2.16v6.078l-17.36 3.103 17.36 1.99v6.523l-17.36 3.103 14.275 1.635-.016 4.906-.019 5.726-.63.125c-1.587.316-3.197 1.069-4.528 2.118-2.206 1.737-3.742 4.445-4.053 7.144-.37 3.213.552 6.199 2.657 8.602 1.688 1.926 4.174 3.26 6.696 3.592.824.108 2.933.031 3.671-.134.932-.21 1.79-.515 2.637-.939 2.066-1.033 3.824-2.775 4.827-4.784.504-1.01.91-2.207 1.027-3.029l.046-.33h18.828v.215c0 .117.064.468.142.779a10.96 10.96 0 0 0 6.975 7.687c1.343.475 1.946.568 3.655.564 1.32-.003 1.613-.025 2.182-.158 3.368-.785 6.027-2.86 7.515-5.865.44-.89.882-2.204.972-2.892l.043-.33 7.183-.001c7.08-.002 7.188-.003 7.495-.143.647-.293.9-.703.9-1.457 0-.569-.168-.945-.55-1.225-.505-.373-.225-.36-7.899-.36h-7.116l-.117-.597c-.261-1.329-.848-2.71-1.682-3.958-.57-.853-2.02-2.295-2.864-2.85-1.214-.799-2.805-1.465-4-1.674l-.502-.088-.018-21.17-.018-21.17-.154-.312c-.258-.521-.88-.903-1.465-.9zm9.34.76c-1.961 0-3.686 1.068-4.532 2.806-.536 1.103-.53 1.026-.507 6.443l.02 4.78.189.556c.62 1.83 2.225 3.176 4.083 3.424.241.032 2.715.053 5.496.046 5.705-.015 5.343.017 6.547-.574.548-.269.757-.422 1.25-.918.49-.49.65-.709.917-1.252.539-1.096.535-1.045.535-6.262 0-4.846-.012-5.061-.328-5.862-.764-1.94-2.613-3.187-4.727-3.187h-.557l-.003 4.14-.003 4.139-1.878 1.49a116 116 0 0 1-1.964 1.54c-.056.033-.792-.513-2.034-1.507l-1.947-1.56v-8.242zm2.29.553v6.927l1.084.87c.597.478 1.106.86 1.132.85s.535-.41 1.132-.886l1.085-.866-.017-3.43-.017-3.429-2.2-.018zm-47.247 6.508 9.197.025c9.138.025 9.2.026 9.889.175 2.276.495 4.009 1.425 5.576 2.993 1.563 1.563 2.494 3.26 3.002 5.472.15.658.15.664.17 10.686l.018 10.028h-2.393l-2.91-2.91c-2.148-2.147-2.999-2.954-3.252-3.082l-.342-.174H68.007V122.99zm44.87 16.355c-.846 0-1.356.1-1.976.386-1.352.623-2.297 1.666-2.772 3.059l-.184.539-.02 4.745c-.023 5.4-.023 5.392.503 6.477.507 1.044 1.244 1.78 2.297 2.295.347.17.83.351 1.073.404.354.077 1.48.097 5.603.1 5.817.005 5.683.015 6.749-.507 1.377-.674 2.299-1.8 2.674-3.27.13-.505.137-.783.137-5.222 0-4.448-.007-4.717-.137-5.237-.233-.926-.636-1.636-1.32-2.324-.515-.519-.69-.645-1.318-.948-.817-.396-1.263-.497-2.19-.497h-.646v8.223l-1.91 1.518c-1.049.834-1.938 1.527-1.974 1.54s-.938-.673-2.004-1.524l-1.939-1.548v-8.209zm2.377.554.004 3.447.004 3.446 1.052.844c.58.465 1.08.846 1.112.849s.555-.39 1.16-.874l1.101-.878v-6.834h-2.217zm-50.295 9.491H85.98l3.015 3.002c2.568 2.557 3.058 3.014 3.3 3.083.206.058 1.624.08 5.04.08h4.755v3.16l-.537.094c-1.12.195-2.648.809-3.729 1.498-1.69 1.076-3.118 2.7-3.994 4.536-.443.931-.884 2.341-.884 2.83v.214H74.119l-.046-.329c-.174-1.222-.844-2.861-1.707-4.174-.532-.809-1.996-2.292-2.8-2.836-1.322-.897-2.958-1.574-4.282-1.773l-.325-.048v-4.669z",style:{fill:"#fff",strokeWidth:1.10252}})))),Zm=e=>{const{publicRoutes:t,privateRoutes:n}=uc(),{firstPrivatePath:i,routes:s,defaultTitle:o}=Be();pc(s,o);const{logoImg:r=Xm,pathImg:a="./src/assets/MyWarehouse.svg",firstPrivateElement:l=h.jsx(Sc,{}),globalLayout:c,isMain:u,headerComponent:d,showHeaderOnLogin:f,headerExcludedRoutes:m,footerComponent:y,showFooterOnLogin:S,footerExcludedRoutes:w,privateProvider:v,customProvider:b,promptComponent:T}=e;let M;c==="none"?M=null:p.isValidElement(c)?M=c:M=h.jsx(vc,{isMain:u,headerComponent:d,showHeaderOnLogin:f,headerExcludedRoutes:m,footerComponent:y,showFooterOnLogin:S,footerExcludedRoutes:w,promptComponent:T});const x=p.useMemo(()=>v?p.cloneElement(v,{},b?p.cloneElement(b,{},h.jsx(Cn,{children:h.jsx(U.Outlet,{})})):h.jsx(Cn,{children:h.jsx(U.Outlet,{})})):b?p.cloneElement(b,{},h.jsx(Cn,{children:h.jsx(U.Outlet,{})})):h.jsx(Cn,{children:h.jsx(U.Outlet,{})}),[v,b]),R=()=>{const D=document.querySelector("link[rel='icon']");a&&(D.href=a)};return p.useEffect(()=>{R()},[]),h.jsx(U.Routes,{children:h.jsxs(U.Route,{element:M,children:[h.jsxs(U.Route,{path:"/",children:[h.jsx(U.Route,{index:!0,element:h.jsx(wc,{Logo:r})}),t.map((D,j)=>h.jsx(U.Route,{path:D.path,element:D.element},`public-${j}`))]}),h.jsxs(U.Route,{element:x,children:[h.jsx(U.Route,{path:`${i??"/dashboard/"}:id`,element:l}),n.map((D,j)=>h.jsx(U.Route,{path:D.path,element:D.element},`private-${j}`))]})]})})},Jm=({children:e})=>{var s;const{user:t}=hn(),n=U.useLocation(),{activeAlert:i}=Ct();return p.useEffect(()=>{(!t||!t.admin)&&i("warning","Non puoi accedere a questa pagina")},[t]),!t||!t.admin?h.jsx(U.Navigate,{to:((s=n.state)==null?void 0:s.from)||"/",replace:!0}):e},Qm=({spinner:e=!0,spinnerStyle:t,text:n,textStyle:i,children:s,containerStyle:o,overrideStyle:r={}})=>h.jsxs("div",{className:r.container||`w-full h-full relative flex items-center justify-center ${o}`,children:[e&&h.jsx(gc,{className:r.spinner||`text-[20rem] animate-spin text-black ${t}`}),s||h.jsx("p",{className:r.text||`text-black text-2xl select-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${i}`,children:n||"Loading..."})]}),Ls=({isTag:e=!1,value:t,label:n,placeholder:i,id:s,onChange:o,error:r=null})=>h.jsxs("div",{className:`flex items-center justify-center relative ${e?"gap-4 mb-2":"gap-1 m-4"}`,children:[h.jsx(Si,{labelId:s,label:n,overrideStyle:`text-xl font-bold text-color-label ${e?"":"basis-1/3"}`}),h.jsx(xi,{type:"text",inputId:s,inputPlaceholder:i,inputValue:t||"",disabled:e,inputChange:o,overrideStyle:`${e?"w-full":"basis-2/3"} ${r?"border-red-600 focus:ring focus:ring-red-600 focus:border-red-600 focus:shadow-[0_0_0_4px_rgba(255,0,0,0.5)]":""} bg-input-bg border border-input-border text-input-text text-input-placeholder input-rounded focus:ring focus:ring-focus-ring focus:border-spot-rfid-input-border focus:outline-none focus:shadow-spot-rfid-input block w-full p-input`}),r&&h.jsx("p",{className:"text-red-600 text-[13px] absolute bottom-0 left-26 translate-y-[20px]",children:r})]}),e0=({title:e,showTag:t,value:n,tag:i,showButton:s,handleClick:o})=>h.jsxs("div",{className:`border border-slate-300 rounded-xl p-2 m-2 shadow-xl transition-all duration-700 transform ${e==="TAG B"?"delay-200":"mb-4"} ${t?"opacity-100 translate-y-0":"opacity-0 translate-y-10"}`,children:[h.jsx("h2",{className:"text-center mb-2 text-2xl",children:e}),h.jsx(Ls,{label:"TID",placeholder:`Leggi ${e}`,id:i?`tid-${i}`:"tid",isTag:!0,value:(n==null?void 0:n.valueTID)||""}),h.jsx(Ls,{label:"EPC",placeholder:`Leggi ${e}`,id:i?`epc-${i}`:"epc",isTag:!0,value:(n==null?void 0:n.valueEPC)||""}),!s&&h.jsx("div",{className:"flex items-center justify-center",children:h.jsx("button",{onClick:o,disabled:!(n!=null&&n.valueTID)&&!(n!=null&&n.valueEPC),className:"my-1 bg-write-button disabled:bg-write-button/40 text-white px-4 py-2 rounded-lg shadow-md disabled:transition-none disabled:active:translate-y-0 transition-all duration-200 ease-in-out transform active:translate-y-[2px] cursor-pointer uppercase",children:"Scrivi tag"})})]});function t0(e){return St({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.04 1.33L12.71 3l.29.71v.33h-.5l-.5.5v-.83l-1.67-1.67H10v4H4v-4H2v10h3l-.5 1H2l-1-1v-10l1-1h8.33l.71.29zM7 5h2V2H7v3zm6.5 0L15 6.5l-.02.69-5.5 5.5-.13.12-.37.37-.1.09-3 1.5-.67-.67 1.5-3 .09-.1.37-.37.12-.13 5.5-5.5h.71zm-6.22 7.24l-.52 1 1.04-.48-.52-.52zm.69-1.03l.79.79 5.15-5.15-.79-.79-5.15 5.15z"},child:[]}]})(e)}const n0=({minReadingPower:e,maxReadingPower:t,stepRangePower:n,rangeValue:i,setRangeValue:s,show:o,handleClick:r})=>{const a=(i-e)/(t-e)*100;return h.jsxs("div",{className:`border border-slate-300 rounded-xl p-2 m-2 shadow-xl transition-all duration-700 transform ${o?"opacity-100 translate-y-0":"opacity-0 translate-y-10"}`,children:[h.jsx("h2",{className:"text-center my-4 text-2xl",children:"Configurazione Potenza"}),h.jsxs("div",{className:"relative my-12 w-[90%] mx-auto",children:[h.jsx("input",{id:"power",type:"range",min:e,max:t,step:n,value:i,onChange:l=>s(Number(l.target.value)),className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-primary-accent"}),h.jsx("div",{className:"absolute bottom-8 transform -translate-x-1/2 bg-white border border-gray-200 text-sm text-gray-800 py-1 px-2 rounded-lg shadow-md transition-opacity",style:{left:`${a}%`},children:i})]}),h.jsx("div",{className:"flex items-center justify-center my-4",children:h.jsxs("button",{onClick:()=>r(i),className:"py-2 px-4 flex items-center justify-center gap-1 bg-save-button text-white rounded-lg shadow-md transition duration-200 ease-in-out transform active:translate-y-[2px] cursor-pointer",children:["Salva",h.jsx(t0,{})]})})]})},i0=({show:e,isConfigPage:t,handleSelectFile:n})=>h.jsxs("div",{className:`${t?`${e?"opacity-100 translate-y-0 delay-200":"opacity-0 translate-y-10"}`:""} p-4 text-center transition-all duration-700 transform`,children:[h.jsxs("h2",{className:"text-xl my-4",children:["Seleziona il file ",h.jsx("strong",{children:"config.json"})," per recuperare le chiavi univoche del dispositivo"]}),h.jsx("button",{onClick:n,className:"my-4 bg-blue-500 text-white px-4 py-2 rounded-lg",children:"Seleziona file"})]});function s0(e){return St({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M312 372c-7.7 0-14 6.3-14 14 0 9.9-8.1 18-18 18H94c-9.9 0-18-8.1-18-18V126c0-9.9 8.1-18 18-18h186c9.9 0 18 8.1 18 18 0 7.7 6.3 14 14 14s14-6.3 14-14c0-25.4-20.6-46-46-46H94c-25.4 0-46 20.6-46 46v260c0 25.4 20.6 46 46 46h186c25.4 0 46-20.6 46-46 0-7.7-6.3-14-14-14z"},child:[]},{tag:"path",attr:{d:"M372.9 158.1c-2.6-2.6-6.1-4.1-9.9-4.1-3.7 0-7.3 1.4-9.9 4.1-5.5 5.5-5.5 14.3 0 19.8l65.2 64.2H162c-7.7 0-14 6.3-14 14s6.3 14 14 14h256.6L355 334.2c-5.4 5.4-5.4 14.3 0 19.8l.1.1c2.7 2.5 6.2 3.9 9.8 3.9 3.8 0 7.3-1.4 9.9-4.1l82.6-82.4c4.3-4.3 6.5-9.3 6.5-14.7 0-5.3-2.3-10.3-6.5-14.5l-84.5-84.2z"},child:[]}]})(e)}function r0(e){return St({tag:"svg",attr:{version:"1.2",baseProfile:"tiny",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 9.059v-2.559c0-.256-.098-.512-.293-.708-.195-.195-.451-.292-.707-.292s-.512.097-.707.292l-6.293 6.208 6.293 6.207c.195.195.451.293.707.293s.512-.098.707-.293.293-.452.293-.707v-2.489c2.75.068 5.755.566 8 3.989v-1c0-4.633-3.5-8.443-8-8.941z"},child:[]}]})(e)}const o0=e=>V.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",xmlSpace:"preserve",id:"svg1",width:409.748,height:409.748,viewBox:"0 0 108.413 108.413",...e},V.createElement("defs",{id:"defs1"},V.createElement("linearGradient",{id:"linearGradient27"},V.createElement("stop",{id:"stop27",offset:0,style:{stopColor:"red",stopOpacity:1}}),V.createElement("stop",{id:"stop28",offset:1,style:{stopColor:"#ffca00",stopOpacity:.96862745}})),V.createElement("linearGradient",{xlinkHref:"#linearGradient27",id:"linearGradient28",x1:35.002,x2:143.414,y1:192.355,y2:83.942,gradientUnits:"userSpaceOnUse"})),V.createElement("g",{id:"layer1",transform:"translate(-35.002 -83.942)"},V.createElement("rect",{id:"rect26",width:108.413,height:108.413,x:35.002,y:83.942,rx:30,ry:30,style:{fill:"url(#linearGradient28)",fillOpacity:1,fillRule:"evenodd",stroke:"#ff9b01",strokeWidth:0,strokeOpacity:1,paintOrder:"stroke markers fill"}}),V.createElement("g",{id:"g1",style:{strokeWidth:.892424},transform:"matrix(1.08335 0 0 1.15901 -13.02 -26.51)"},V.createElement("path",{id:"path1",d:"M93.826 176.603c-.169-.034-1.837-.443-3.708-.909s-6.894-1.707-11.162-2.759a2463 2463 0 0 1-8.036-1.986 1.26 1.26 0 0 1-.84-.72c-.135-.297-.142-.67-.144-7.586l-.002-7.275-1.586-.388c-.873-.214-2.732-.663-4.131-.998-1.664-.399-2.62-.664-2.765-.767-.451-.321-.673-1.178-.44-1.7.05-.114 1.348-1.542 2.882-3.173l4.473-4.751c.925-.983 1.682-1.813 1.682-1.846 0-.032-2.013-2.197-4.473-4.811s-4.513-4.845-4.564-4.96c-.124-.278-.122-.806.005-1.108.137-.329.59-.717.947-.812a377 377 0 0 1 3.04-.735 4957 4957 0 0 0 16.208-3.91c3.114-.76 3.63-.84 4.028-.63.113.059 1.108 1.071 2.211 2.249a1906 1906 0 0 0 4.454 4.731l2.447 2.591.578-.603c.73-.762 7.41-7.89 7.899-8.429.533-.588 1.164-.826 1.676-.632.098.037 1.949.488 4.115 1.003 2.165.515 5.554 1.325 7.53 1.802l7.11 1.713c1.934.466 3.612.885 3.727.931.44.176.82.811.821 1.372 0 .11-.077.339-.171.51-.146.264-2.64 2.954-7.92 8.542-.595.63-1.074 1.174-1.062 1.207.011.034 2.015 2.18 4.453 4.768s4.493 4.832 4.565 4.985c.232.491.124 1.107-.27 1.528-.244.262-.464.356-1.276.544-.4.093-2.137.51-3.86.927l-3.307.798-.172.04v7.212c0 5.18-.025 7.285-.087 7.472a1.6 1.6 0 0 1-.287.477c-.211.23-.693.509-.877.509-.06 0-4.2 1.011-9.197 2.248-12.941 3.202-13.804 3.411-14.017 3.4a4 4 0 0 1-.497-.071m-.115-14.064c0-6.938-.027-12.614-.059-12.614s-1.13 1.144-2.44 2.542c-5.288 5.648-5.758 6.135-6.045 6.267-.478.22.5.423-8.925-1.857-2.27-.549-4.327-1.045-4.568-1.102l-.44-.103v13.955l.975.24c6.052 1.49 19.206 4.741 20.126 4.974a30 30 0 0 0 1.28.306c.076.005.096-2.563.096-12.608m12.576 9.853c5.93-1.467 10.857-2.684 10.951-2.706l.171-.04.02-6.992c.018-6.187.006-6.99-.094-6.958-.063.019-1.698.416-3.632.883-1.934.466-4.72 1.14-6.192 1.497-3.653.887-3.407.84-3.789.725-.186-.056-.463-.233-.65-.416-.18-.175-2.039-2.141-4.13-4.37-2.092-2.229-3.833-4.063-3.868-4.077s-.063 5.656-.063 12.601v12.627l.248-.054c.137-.03 5.1-1.253 11.028-2.72m-20.964-15.644c.885-.919 7.626-8.102 8.034-8.56.163-.184.284-.345.268-.36-.03-.026-1.291-.333-7.062-1.721l-9.387-2.26-5.87-1.413-.512.554a2343 2343 0 0 0-8.041 8.564c-.267.285-.47.533-.45.552s1.89.48 4.158 1.025c9.94 2.387 16.933 4.072 17.464 4.209.316.08.598.149.627.151s.376-.33.771-.74m20.235.401c.78-.189 3.86-.93 6.845-1.648 12.242-2.942 13.984-3.364 14.015-3.396.019-.018-.237-.321-.568-.673l-4.112-4.38-3.921-4.178-.413-.437-6.82 1.638c-3.75.9-8.299 1.997-10.107 2.437s-3.76.91-4.339 1.047c-.578.137-1.05.278-1.05.313 0 .06 1.972 2.177 6.918 7.426 1.135 1.204 2.08 2.191 2.1 2.193.019.002.672-.152 1.452-.342m-9.338-11.001c.954-.227 3.678-.885 6.054-1.461a4296 4296 0 0 1 11.257-2.72c.41-.097.746-.196.746-.22 0-.042-2.28-.6-11.889-2.913a3300 3300 0 0 1-5.734-1.386c-1.219-.297-2.268-.538-2.331-.536s-1.388.313-2.944.691-4.05.982-5.543 1.34c-1.492.36-4.434 1.07-6.536 1.58-2.103.508-4.072.982-4.377 1.054-.305.07-.554.148-.554.17s.61.186 1.357.362c.746.177 4.831 1.16 9.078 2.188l8.525 2.06c.441.106.882.196.98.199s.958-.18 1.911-.408m-23.175-5.507c1.616-.385 15.137-3.644 18.927-4.562.914-.222 1.663-.423 1.663-.447 0-.043-2.176-2.373-6.494-6.955a220 220 0 0 1-2.417-2.588c-.068-.09-.257-.065-1.223.168-2.153.52-10.698 2.575-15.93 3.832-2.876.692-5.247 1.274-5.267 1.295-.046.045-.21-.132 4.76 5.153 2.23 2.371 4.083 4.358 4.117 4.415s.074.105.09.105.815-.187 1.774-.416m44.726.017c.668-.727 2.633-2.823 4.61-4.915 3.59-3.802 4.074-4.323 4.04-4.356-.019-.019-.892-.24-1.942-.491a14930 14930 0 0 1-17.845-4.296l-2.558-.62-.225.256c-.123.141-.763.824-1.42 1.518-.66.694-2.26 2.397-3.559 3.784a573 573 0 0 1-3.073 3.264c-.392.408-.712.773-.712.812 0 .081 1.221.382 13.259 3.264 4.832 1.157 8.803 2.12 8.824 2.141.102.102.267.003.601-.361",style:{fill:"#fff",fillOpacity:1,strokeWidth:0,strokeDasharray:"none"}}),V.createElement("path",{id:"path2",d:"M94.237 147.397c-.19-.076-.536-.44-.83-.87-.138-.202-.98-1.552-1.87-3.001-6.428-10.455-9.515-15.547-9.95-16.413-.459-.916-.982-2.465-1.178-3.493-.478-2.499-.335-4.879.435-7.235 1.186-3.633 3.713-6.577 7.144-8.326a14.6 14.6 0 0 1 4.316-1.388c1.018-.165 3.183-.165 4.201 0a14.6 14.6 0 0 1 5.902 2.32c3.031 2.03 5.227 5.32 5.959 8.928.623 3.072.293 6.038-.986 8.869-.359.792-3.667 6.345-7.571 12.703l-3.23 5.263c-.787 1.285-1.265 1.992-1.542 2.284-.398.42-.519.473-.8.36m1.266-20.98a6.44 6.44 0 0 0 4.949-4.23c.294-.862.38-1.48.33-2.368-.098-1.758-.749-3.161-2.028-4.375-1.216-1.153-2.656-1.723-4.35-1.723-1.69 0-3.132.57-4.345 1.72-.963.913-1.534 1.855-1.868 3.078-.13.48-.154.72-.151 1.567.003.873.026 1.084.183 1.657a6.43 6.43 0 0 0 3.963 4.37 6.3 6.3 0 0 0 3.317.303",style:{fill:"#d30000",fillOpacity:1,strokeWidth:.892424}}),V.createElement("path",{id:"rect2",d:"M158.632 137.745h3.539v1.387h-3.539z",style:{fill:"#fff",fillOpacity:1,fillRule:"evenodd",stroke:"#ff9b01",strokeWidth:0,strokeDasharray:"none",paintOrder:"stroke markers fill"},transform:"matrix(.98806 .15405 -.46962 .88287 0 0)"}),V.createElement("path",{id:"rect3",d:"M120.628 170.946h3.167v1.222h-3.167z",style:{fill:"#fff",fillOpacity:1,fillRule:"evenodd",stroke:"#ff9b01",strokeWidth:0,strokeDasharray:"none",paintOrder:"stroke markers fill"},transform:"rotate(8.335)scale(.9449 1)skewY(-18.126)"})))),a0=({Logo:e,logo:t})=>{const{logout:n}=Fn(),{activeAlert:i}=Ct(),{autoLogin:s,configRoutes:o,firstPrivateTitle:r,showHeaderButton:a}=Be(),{isLoading:l}=It(),c=U.useLocation(),u=U.useNavigate(),d=()=>{n(),i("info","Hai effettuato il logout")},f=o.find(y=>y.path===c.pathname),m=U.useMatch("home/:id");return h.jsx("header",{className:l?"hidden":"",children:h.jsxs("nav",{className:"header-size flex items-center justify-between px-2 shadow-lg border-b gap-2 border-b-gray-300",children:[h.jsx("figure",{children:e&&typeof e=="function"?h.jsx(e,{className:"header-logo-size"}):t?h.jsx("img",{src:t,alt:"Logo",className:"header-logo-size"}):h.jsx(o0,{className:"header-logo-size"})}),h.jsx("div",{children:h.jsx("p",{children:(f==null?void 0:f.title)||r})}),h.jsxs("div",{children:[!s&&m&&h.jsx("button",{className:"h-[48px] w-[48px] flex items-center justify-center bg-red-600 text-white rounded-lg shadow-md transition duration-200 ease-in-out transform active:translate-y-[2px] cursor-pointer",type:"button",onClick:d,children:h.jsx(s0,{className:"text-4xl w-full"})}),!m&&a&&h.jsx("button",{className:"h-[48px] w-[48px] flex items-center justify-center bg-sky-600 text-white rounded-lg shadow-md transition duration-200 ease-in-out transform active:translate-y-[2px] cursor-pointer",type:"button",onClick:()=>u(-1),children:h.jsx(r0,{className:"text-4xl w-full"})})]})]})})};function l0(e){return St({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M763.024 259.968C718.4 141.536 622.465 66.527 477.553 66.527c-184.384 0-313.392 136.912-324.479 315.536C64.177 410.495.002 501.183.002 603.903c0 125.744 98.848 231.968 215.823 231.968h92.448c17.664 0 32-14.336 32-32 0-17.68-14.336-32-32-32h-92.448c-82.304 0-152.832-76.912-152.832-167.968 0-80.464 56.416-153.056 127.184-165.216l29.04-5.008-2.576-29.328-.24-.368c0-155.872 102.576-273.44 261.152-273.44 127.104 0 198.513 62.624 231.537 169.44l6.847 22.032 23.056.496c118.88 2.496 223.104 98.945 223.104 218.77 0 109.055-72.273 230.591-181.696 230.591h-73.12c-17.664 0-32 14.336-32 32 0 17.68 14.336 32 32 32l72.88-.095c160-4.224 243.344-157.071 243.344-294.495 0-147.712-115.76-265.744-260.48-281.312zM535.985 514.941c-.176-.192-.241-.352-.354-.512l-8.095-8.464c-4.432-4.688-10.336-7.008-16.24-6.976-5.905-.048-11.777 2.288-16.289 6.975l-8.095 8.464c-.16.16-.193.353-.336.513L371.072 642.685c-8.944 9.344-8.944 24.464 0 33.84l8.064 5.471c8.945 9.344 23.44 6.32 32.368-3.024l68.113-75.935v322.432c0 17.664 14.336 32 32 32s32-14.336 32-32V603.34l70.368 77.631c8.944 9.344 23.408 12.369 32.336 3.025l8.064-5.472c8.945-9.376 8.945-24.496 0-33.84z"},child:[]}]})(e)}const c0=e=>{const[t,n]=p.useState(!1),{onFilesSelect:i,id:s="dropzone-file",containerStyle:o="flex items-center justify-center w-full relative h-full",dropzoneStyle:r="flex flex-col items-center justify-center text-body px-6 text-center pt-5 pb-6 pointer-events-none",labelStyle:a=`flex flex-col items-center justify-center w-full h-full rounded-2xl transition-all duration-300 bg-slate-100/80 shadow-lg border border-slate-300 rounded-base cursor-pointer hover:bg-slate-200/80 hover:border-slate-500 hover:shadow-xl ${t?"bg-slate-200/80 border-slate-600 shadow-xl shadow-primary-strong":"border-default-strong"}`,dragActiveStyle:l="absolute w-full h-full top-0 left-0 rounded-2xl border-2 border-primary-strong/70 animate-pulse"}=e,c=p.useCallback(f=>{f.preventDefault(),f.stopPropagation(),f.type==="dragenter"||f.type==="dragover"?n(!0):f.type==="dragleave"&&n(!1)},[]),u=p.useCallback(f=>{f.preventDefault(),f.stopPropagation(),n(!1),f.dataTransfer.files&&f.dataTransfer.files.length>0&&(i==null||i(Array.from(f.dataTransfer.files)))},[i]),d=f=>{f.target.files&&f.target.files.length>0&&(i==null||i(Array.from(f.target.files)))};return h.jsxs("div",{className:o,onDragEnter:c,children:[h.jsxs("label",{htmlFor:s,className:a,children:[h.jsxs("div",{className:r,children:[h.jsx(l0,{className:"text-8xl"}),h.jsxs("p",{className:"mb-2",children:[h.jsx("span",{className:"font-semibold",children:"Clicca per caricare"})," o trascina qui i file"]}),h.jsx("p",{className:"text-sm opacity-70",children:"Puoi selezionare più file"})]}),h.jsx("input",{id:s,type:"file",multiple:!0,className:"hidden",onChange:d})]}),t&&h.jsx("div",{className:l,onDragEnter:c,onDragLeave:c,onDragOver:c,onDrop:u})]})},Vs=e=>{const{id:t,name:n,value:i,onChange:s,disabled:o,required:r,labelStyle:a,containerStyle:l,inputStyle:c,title:u,children:d}=e;return h.jsxs("div",{className:l||"flex flex-col gap-1 mx-auto w-full",children:[h.jsx("label",{htmlFor:t,className:a||"mb-1 text-input-label font-medium text-color-label",children:u}),h.jsx("input",{type:"date",id:t,name:n,value:i||"",onChange:s,disabled:o,required:r,className:c||"bg-input-bg border border-input-border rounded-lg text-input-text placeholder:text-input-placeholder rounded-input focus:ring focus:ring-primary focus:border-primary focus:outline-none focus:shadow-[var(--shadow-primary-input)] block w-full h-[43px] p-input disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed disabled:opacity-60"}),d]})},u0=e=>{const{startId:t,endId:n,startName:i,endName:s,startValue:o,endValue:r,onChange:a,disabled:l,required:c,dateError:u,startTitle:d,endTitle:f,startStyle:m,endStyle:y,labelStyle:S,containerStyle:w,startContainerStyle:v,endContainerStyle:b,endDateShow:T=!0,children:M}=e;return h.jsxs("div",{className:w||"flex gap-4 mx-auto w-full mb-4",children:[h.jsx(Vs,{id:t,name:i,value:o,onChange:a,disabled:l,required:c,title:d,labelStyle:S,containerStyle:v,inputStyle:m}),T&&h.jsx(Vs,{id:n,name:s,value:r,onChange:a,disabled:l,required:c,title:f,labelStyle:S,containerStyle:b,inputStyle:y,children:u&&h.jsx("p",{className:"text-red-500 text-[13px] mt-1",children:u})}),M]})},Tc=({sizeContainer:e,Logo:t,spinnerColor:n})=>h.jsxs("div",{className:`relative ${e||"h-60 w-60"}`,children:[h.jsx("svg",{className:"absolute inset-0 w-full h-full animate-spin-slow z-10",viewBox:"0 0 100 100",children:h.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:n||"#60A5FA",strokeWidth:"6",strokeLinecap:"round",strokeDasharray:"280",strokeDashoffset:"210"})}),h.jsx("figure",{className:"h-full w-full rounded-full overflow-hidden relative",children:h.jsx(t,{className:"h-full w-full"})})]}),d0=({gradients:e,moreGradients:t,containerSize:n,overlayStyle:i,NewLogoLoader:s,Logo:o,spinnerColor:r})=>{const{customLoginTimeout:a}=Be(),{isLoading:l}=It(),[c,u]=p.useState(l),[d,f]=p.useState(!1),m=["bg-gradient-to-br from-blue-500 via-blue-400 to-blue-200","bg-gradient-to-br from-blue-200 via-blue-400 to-purple-300","bg-gradient-to-br from-blue-400 via-cyan-300 to-blue-200","bg-gradient-to-br from-blue-100 via-purple-200 to-pink-100","bg-gradient-to-br from-blue-400 via-blue-500 to-blue-600","bg-gradient-to-br from-blue-300 via-cyan-400 to-indigo-400","bg-gradient-to-br from-cyan-200 via-blue-300 to-blue-500","bg-gradient-to-br from-indigo-300 via-blue-400 to-purple-400",...t||[]],y=e??[...m,...t??[]],S=y[Math.floor(Math.random()*y.length)],w=n||"h-[420px] w-[420px]";return p.useEffect(()=>{if(l){u(!0);const v=setTimeout(()=>f(!0),10);return()=>clearTimeout(v)}else{f(!1);const v=setTimeout(()=>u(!1),300);return()=>clearTimeout(v)}},[l,a]),h.jsx("div",{className:`${i||"fixed top-0 bottom-0 left-0 right-0 flex items-center justify-center z-999 transition-opacity duration-300"} ${S} ${d?"opacity-100":"opacity-0"}`,children:s?h.jsx(s,{}):h.jsx(Tc,{sizeContainer:w,Logo:o,spinnerColor:r})})};Object.defineProperty(exports,"BrowserRouter",{enumerable:!0,get:()=>U.BrowserRouter});Object.defineProperty(exports,"Link",{enumerable:!0,get:()=>U.Link});Object.defineProperty(exports,"NavLink",{enumerable:!0,get:()=>U.NavLink});Object.defineProperty(exports,"Outlet",{enumerable:!0,get:()=>U.Outlet});Object.defineProperty(exports,"Route",{enumerable:!0,get:()=>U.Route});Object.defineProperty(exports,"Routes",{enumerable:!0,get:()=>U.Routes});Object.defineProperty(exports,"useLocation",{enumerable:!0,get:()=>U.useLocation});Object.defineProperty(exports,"useMatch",{enumerable:!0,get:()=>U.useMatch});Object.defineProperty(exports,"useNavigate",{enumerable:!0,get:()=>U.useNavigate});Object.defineProperty(exports,"useParams",{enumerable:!0,get:()=>U.useParams});exports.axios=oa;exports.ReactDOM=aa;exports.Alert=Ds;exports.AlertProvider=Im;exports.AuthAdmin=Jm;exports.AuthPage=Cn;exports.AuthProvider=Nm;exports.CardInputRange=n0;exports.CardInputTag=e0;exports.ConfigFileReader=i0;exports.ConfigProvider=Gc;exports.Dashboard=Sc;exports.DefaultLayout=vc;exports.ErrorPage=ca;exports.FileDropzone=c0;exports.Header=a0;exports.Input=xi;exports.InputDate=Vs;exports.InputGroup=Ls;exports.InputLabel=Si;exports.InputStartEndDate=u0;exports.Loader=d0;exports.Loading=yc;exports.LoadingComponent=Qm;exports.LoadingProvider=Uc;exports.Login=wc;exports.LoginForm=bc;exports.LoginFormProvider=_m;exports.LogoLoader=Tc;exports.ModalProvider=Fm;exports.PackageRoutes=Zm;exports.RouteProvider=Bm;exports.SwitchRadio=xc;exports.UsePageTitle=pc;exports.fetchAxiosConfig=ac;exports.useAlert=Ct;exports.useAuth=Fn;exports.useAuthStorage=hn;exports.useConfig=Be;exports.useDevice=ga;exports.useIndexedDB=$m;exports.useLoading=It;exports.useLoginForm=pr;exports.useModal=hc;exports.useOrientation=zm;exports.useRoutesInjection=uc;exports.useSafeArea=Um;exports.useStorage=js;exports.useToast=hr;exports.useViewportHeight=mc;
|
|
110
|
+
</RouteProvider>`);return e},dc=p.createContext(),_m=({children:e})=>{const{login:t}=Fn(),{clearLoginFormOnError:n}=Be(),i={email:"",password:""},[s,o]=p.useState("Accedi"),[r,a]=p.useState("Email"),[l,c]=p.useState("email"),[u,d]=p.useState("example@example.it"),[f,m]=p.useState("Accedi"),[y,S]=p.useState(i),[w,v]=p.useState(),[b,T]=p.useState(),[M,x]=p.useState(),[R,D]=p.useState(),[j,I]=p.useState({}),[B,Q]=p.useState(null),Z={overrideStyle:j,setOverrideStyle:I,title:s,setTitle:o,label:r,setLabel:a,type:l,setType:c,placeholder:u,setPlaceholder:d,buttonText:f,setButtonText:m,formData:y,setFormData:S,LogoImg:w,setLogoImg:v,styleCardForm:b,setStyleCardForm:T,styleContainerLogo:M,setStyleContainerLogo:x,styleLogo:R,setStyleLogo:D,changeData:(z,se)=>{S(H=>({...H,[z]:se}))},handleLogin:z=>{t(z,y),n&&S(i)},customVersion:B,setCustomVersion:Q};return h.jsx(dc.Provider,{value:Z,children:e})},pr=()=>{const e=p.useContext(dc);if(e===void 0)throw new Error("Non puoi modificare La login");return e},fc=p.createContext(),Fm=({children:e})=>{const[t,n]=p.useState(!1),[i,s]=p.useState(null),[o,r]=p.useState(""),[a,l]=p.useState(null),[c,u]=p.useState(null),[d,f]=p.useState(null),[m,y]=p.useState("modal-form"),[S,w]=p.useState("submit"),[v,b]=p.useState({}),[T,M]=p.useState(null),[x,R]=p.useState(null),[D,j]=p.useState(null),I=({modalData:Z={},component:z=null,title:se="",onConfirm:H=null,type:q="submit",formId:re="modal-form",item:te=null,style:pe={}}={})=>{M(Z),s(()=>z),r(se),l(()=>H),w(q),y(re),f(te),b(pe),n(!0)},B=()=>{s(null),r(""),l(null),w("submit"),y("modal-form"),f(null),b({}),n(!1),M(null)},Se={isOpen:t,openModal:I,closeModal:B,content:i,title:o,onConfirm:a,type:S,item:d,formId:m,style:v,modalData:T,setModalData:M,handleChange:Z=>{const{name:z,value:se}=Z.target;M(H=>({...H,[z]:se}))},handleSubmit:Z=>{Z.preventDefault(),a&&(a(T),B())},headerContent:x,setHeaderContent:R,footerContent:D,setFooterContent:j,onCancel:c,setOnCancel:u};return h.jsx(fc.Provider,{value:Se,children:e})},hc=()=>{const e=p.useContext(fc);if(e===void 0)throw new Error("Non sei all'interno del ModalProvider");return e},pc=(e=[],t="SPOT")=>{const n=U.useLocation();p.useLayoutEffect(()=>{let i=t;for(const s of e)if(U.matchPath({path:s.path,end:!0},n.pathname)){i=s.title;break}document.title=i},[n,e,t])},$m=(e,t,n=1)=>{const i=p.useRef(null),[s,o]=p.useState(!1),r=p.useCallback(m=>new Promise((y,S)=>{if(!i.current){S("DB non pronto");return}const b=i.current.transaction(t,"readonly").objectStore(t).get(m);b.onsuccess=()=>y(b.result),b.onerror=T=>S(T.target.error)}),[t]),a=p.useCallback(()=>new Promise((m,y)=>{if(!i.current)return y("DB non pronto");const v=i.current.transaction(t,"readonly").objectStore(t).getAll();v.onsuccess=()=>m(v.result),v.onerror=b=>y(b.target.error)}),[t]),l=p.useCallback(m=>new Promise((y,S)=>{if(!i.current){S("DB non pronto");return}const b=i.current.transaction(t,"readwrite").objectStore(t).put(m);b.onsuccess=()=>y(b.result),b.onerror=T=>S(T.target.error)}),[t]),c=p.useCallback(async()=>{let m=Date.now();for(;await r(m);)m++;return m},[r]),u=p.useCallback(async m=>(m.id||(m.id=await c()),l(m)),[c,l]),d=p.useCallback(m=>new Promise((y,S)=>{if(!i.current){S("DB non pronto");return}const b=i.current.transaction(t,"readwrite").objectStore(t).delete(m);b.onsuccess=()=>y(!0),b.onerror=T=>S(T.target.error)}),[t]),f=p.useCallback(()=>new Promise((m,y)=>{if(!i.current){y("DB non pronto");return}const v=i.current.transaction(t,"readwrite").objectStore(t).clear();v.onsuccess=()=>m(!0),v.onerror=b=>y(b.target.error)}),[t]);return p.useEffect(()=>{const m=indexedDB.open(e,n);return m.onupgradeneeded=y=>{const S=y.target.result;S.objectStoreNames.contains(t)||S.createObjectStore(t,{keyPath:"id"})},m.onsuccess=y=>{i.current=y.target.result,o(!0)},m.onerror=y=>{console.error("IndexedDB error",y.target.error)},()=>{var y;(y=i.current)==null||y.close()}},[e,t,n]),{get:r,getAll:a,set:l,setWithAutoId:u,remove:d,clear:f,isReady:s}},zm=()=>{const[e,t]=p.useState(window.innerWidth>window.innerHeight?"landscape":"portrait");return p.useEffect(()=>{const n=()=>{t(window.innerWidth>window.innerHeight?"landscape":"portrait")};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),e},mc=(e={getValues:!1})=>{const{getValues:t}=e,[n,i]=p.useState(0),s=()=>{const o=window.visualViewport?window.visualViewport.height:window.innerHeight,r=o*.01;document.documentElement.style.setProperty("--vh",`${r}px`),t&&i(o)};return p.useEffect(()=>(s(),window.addEventListener("resize",s),window.addEventListener("orientationchange",s),()=>{window.removeEventListener("resize",s),window.removeEventListener("orientationchange",s)}),[t]),t?{height:n,vh:n*.01}:null},Um=(e=["/"])=>{const t=U.useLocation();p.useEffect(()=>(e.includes(t.pathname)?document.body.classList.remove("with-safe-area"):document.body.classList.add("with-safe-area"),()=>{document.body.classList.remove("with-safe-area")}),[t.pathname,e])};function gc(e){return St({tag:"svg",attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M8 0c-4.355 0-7.898 3.481-7.998 7.812 0.092-3.779 2.966-6.812 6.498-6.812 3.59 0 6.5 3.134 6.5 7 0 0.828 0.672 1.5 1.5 1.5s1.5-0.672 1.5-1.5c0-4.418-3.582-8-8-8zM8 16c4.355 0 7.898-3.481 7.998-7.812-0.092 3.779-2.966 6.812-6.498 6.812-3.59 0-6.5-3.134-6.5-7 0-0.828-0.672-1.5-1.5-1.5s-1.5 0.672-1.5 1.5c0 4.418 3.582 8 8 8z"},child:[]}]})(e)}const yc=()=>{const{loadingProps:e,loadingComponent:t}=It(),{spinner:n=!0,spinnerStyle:i,text:s,textStyle:o,children:r,containerStyle:a,overrideStyle:l={}}=e;return t||h.jsxs("div",{className:l.container||`fixed top-0 bottom-0 left-0 right-0 flex items-center justify-center bg-loading-bg z-[999] ${a}`,children:[n&&h.jsx(gc,{className:l.spinner||`text-[20rem] relative animate-spin text-spinner ${i}`}),r||h.jsx("p",{className:l.text||`text-white text-2xl select-none absolute ${o}`,children:s||"Loading..."})]})};function Hm(e){return St({tag:"svg",attr:{viewBox:"0 0 15 15",fill:"none"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor"},child:[]}]})(e)}const Ds=()=>{const{messageAlert:e,typeAlert:t,alertConfig:n,getIcon:i,closeAlert:s}=Ct(),{alertTimeout:o}=Be(),[r,a]=p.useState(0),{bgColor:l,textColor:c,buttonBg:u,hoverBg:d,focusRing:f,progressColor:m}=n[t];return p.useEffect(()=>{let y;const w=100/(o/100);y=setInterval(()=>{a(b=>b>=100?(clearInterval(y),100):b+w)},100);const v=setTimeout(()=>{s()},o);return()=>{clearTimeout(v),clearInterval(y)}},[]),h.jsxs("div",{className:` ${l} ${c} flex items-center min-h-[65px] max-h-[100px] p-4 pt-6 rounded-lg mx-auto max-sm:min-w-[240px] sm:max-w-1/3 fixed sm:top-[calc(100vh-100px)] top-[calc(100vh-115px)] sm:right-10 right-1/2 translate-x-1/2 sm:translate-0 z-100`,role:"alert",children:[h.jsx("div",{className:"w-full bg-gray-200 rounded-t-lg overflow-hidden h-2.5 absolute top-0 left-0 right-0",children:h.jsx("div",{className:`${m} h-2.5 rounded-t-lg`,style:{width:`${r}%`}})}),i(t),h.jsx("div",{className:"px-4 text-sm font-medium",children:e}),h.jsx("button",{type:"button",className:`ms-auto ${u} rounded-lg focus:ring-2 ${f} p-1.5 ${d} inline-flex items-center justify-center h-8 w-8 cursor-pointer`,title:"Close",onClick:s,children:h.jsx(Hm,{className:"text-xl"})})]})},Wm=({onClose:e,onConfirm:t,onCancel:n,type:i,formId:s,style:o})=>{const r=o.resetButton??!0,a=o.confirmButtonText??(i==="delete"?"Elimina":"Salva"),l=o.cancelButtonText??"Annulla",c=o.bgSaveButton??"bg-indigo-600 rounded-lg shadow-md hover:bg-indigo-700 hover:shadow-lg active:bg-indigo-800 text-white",u=o.bgDeleteButton??"bg-rose-500 rounded-lg shadow-md hover:bg-rose-600 hover:shadow-lg active:bg-rose-700 text-white",d=o.bgResetButton??"bg-rose-500 rounded-lg shadow-md hover:bg-rose-600 hover:shadow-lg active:bg-rose-700 text-white",f=o.bgCancelButton??"text-gray-800 bg-gray-300 rounded-lg shadow-md hover:bg-gray-400 hover:shadow-lg active:bg-gray-500",m=i==="custom"?o.customButtonStyle:null,y={delete:()=>{t==null||t(),e==null||e()},custom:()=>{t==null||t()}};return h.jsxs("footer",{className:"flex items-center justify-between mt-4",children:[h.jsx("button",{onClick:n||e,className:`${f} px-4 py-2 cursor-pointer text-sm font-medium active:shadow-sm transition-all duration-150 ease-in-out hover:opacity-90 active:scale-95 active:opacity-70`,children:l}),h.jsxs("div",{className:"flex items-center gap-4",children:[i!=="delete"&&r&&h.jsx("button",{type:"reset",form:s,className:`px-4 py-2 cursor-pointer text-sm font-medium ${d} active:shadow-sm transition-all duration-150 ease-in-out hover:opacity-90 active:scale-95 active:opacity-70`,children:"Reset"}),h.jsx("button",{type:i==="submit"?"submit":"button",form:i==="submit"?s:void 0,onClick:()=>{var S;return(S=y[i])==null?void 0:S.call(y)},className:m||`${i==="delete"?u:c} px-4 py-2 cursor-pointer text-sm font-medium active:shadow-sm transition-all duration-150 ease-in-out hover:opacity-90 active:scale-95 active:opacity-70`,children:a})]})]})};function Gm(e){return St({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"18",y1:"6",x2:"6",y2:"18"},child:[]},{tag:"line",attr:{x1:"6",y1:"6",x2:"18",y2:"18"},child:[]}]})(e)}const qm=({onClose:e,type:t,title:n,name:i,onCancel:s})=>h.jsxs("header",{className:`flex items-center justify-between mb-4 ${t==="delete"?"gap-8":""}`,children:[t==="delete"&&i?h.jsxs("h2",{className:"text-2xl",children:["Sei sicuro di volere eliminare: ",h.jsx("strong",{children:i}),"?"]}):h.jsx("h2",{className:"text-2xl",children:n||"Conferma operazione"}),h.jsx("button",{onClick:s||e,className:"text-gray-500 hover:text-gray-700 cursor-pointer transition-transform duration-150 ease-in-out hover:scale-110 hover:opacity-80 active:scale-95 active:opacity-60","aria-label":"Chiudi modale",children:h.jsx(Gm,{className:"text-2xl"})})]}),Ym=({type:e,children:t,item:n,overrideStyle:i})=>h.jsx(h.Fragment,{children:e!=="delete"&&h.jsx("main",{className:i||"my-8 max-h-[600px] overflow-y-auto overflow-x-hidden",children:e==="delete"&&!n?h.jsx("div",{className:"text-red-600 font-semibold",children:"Errore: nessun item selezionato per l'operazione."}):t})}),Km=({isOpen:e,onClose:t,onCancel:n,title:i,formId:s,children:o,item:r,onConfirm:a,type:l="submit",style:c={},headerContent:u,footerContent:d})=>{const f=p.useRef(null),[m,y]=p.useState(e),S=()=>{e||y(!1)},w=c.width??(l==="delete"?"max-w-md w-auto":"w-full max-w-4xl"),v=c.bgModal??"bg-white",b=c.bgOverlay??"bg-black/50",T=c.zIndex??"z-50";return p.useEffect(()=>{e&&y(!0)},[e]),p.useEffect(()=>{const M=x=>{x.key==="Escape"&&(n?n():t())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[t,n]),p.useEffect(()=>{var M;if(e){const x=document.activeElement;return(M=f.current)==null||M.focus(),()=>x==null?void 0:x.focus()}},[e]),m?aa.createPortal(h.jsx("div",{className:`fixed inset-0 ${T} flex items-center justify-center transition-opacity duration-200 ${e?`${b} opacity-100`:"opacity-0"}`,onClick:n||t,onKeyDown:M=>{var x;M.key==="Escape"&&((x=n||t)==null||x())},onTransitionEnd:S,role:"button",tabIndex:0,"aria-label":"Chiudi modale",children:h.jsxs("div",{ref:f,className:`relative ${v} rounded-lg p-6 shadow-xl ${w} transform transition-transform duration-200 ${e?"scale-100 opacity-100":"scale-95 opacity-0"}`,onClick:M=>M.stopPropagation(),onKeyDown:M=>{M.key==="Escape"&&t()},role:"dialog","aria-modal":"true",tabIndex:-1,children:[u||h.jsx(qm,{onClose:t,onCancel:n,type:l,title:i,name:r==null?void 0:r.name}),h.jsx(Ym,{type:l,item:r,overrideStyle:c.overrideStyle,children:o}),d||h.jsx(Wm,{onClose:t,onCancel:n,onConfirm:a,type:l,formId:s,style:c})]})}),document.body):null},vc=e=>{const{isLoading:t}=It(),{showAlert:n}=Ct(),{sileoToastConfig:i,pwa:s}=Be(),{isOpen:o,closeModal:r,onCancel:a,content:l,title:c,onConfirm:u,item:d,type:f,formId:m,style:y,headerContent:S,footerContent:w}=hc(),v=U.useLocation(),{isMain:b=!0,headerComponent:T=null,showHeaderOnLogin:M=!1,headerExcludedRoutes:x=[],footerComponent:R=null,showFooterOnLogin:D=!1,footerExcludedRoutes:j=[],promptComponent:I=null}=e,B={fill:"#000000",duration:2e3,styles:{title:"text-white font-semibold",description:"text-white/75",badge:"bg-white/20"}},Q=i==null?void 0:i.position,ye=(i==null?void 0:i.options)||B,Se=x.some(H=>U.matchPath(H,v.pathname));let Z;v.pathname==="/"?Z=T&&M:Z=T&&!Se;const z=j.some(H=>U.matchPath(H,v.pathname));let se;return v.pathname==="/"?se=R&&D:se=R&&!z,h.jsxs(h.Fragment,{children:[s&&s.customPrompt&&I,t&&h.jsx(yc,{}),n&&h.jsx(Ds,{}),h.jsx(Om,{position:Q||"bottom-right",options:ye}),h.jsx(Km,{isOpen:o,onClose:r,onCancel:a,title:c,formId:m,onConfirm:u,type:f,item:d,style:y,headerContent:S,footerContent:w,children:l}),Z&&T,b?h.jsxs("main",{className:t?"hidden":"",children:[n&&h.jsx(Ds,{}),h.jsx(U.Outlet,{})]}):h.jsx(U.Outlet,{}),se&&R]})},xi=e=>{const{inputType:t,inputId:n,inputPlaceholder:i,inputRequired:s,inputValue:o,inputChange:r,inputName:a,autoFocus:l,inputStyle:c,overrideStyle:u,disabled:d}=e,m=["text","email","password","search","tel","url"].includes(t)?t:"text";return h.jsx("input",{type:m,autoFocus:l,id:n,className:u||`bg-input-bg border border-input-border text-input-text text-input-placeholder input-rounded focus:ring focus:ring-primary focus:border-primary focus:outline-none focus:shadow-(--shadow-primary-input) block w-full p-input ${c}`,placeholder:i,required:s??!0,value:o,onChange:r,disabled:d,name:a})},Si=({label:e,labelId:t,labelStyle:n,overrideStyle:i})=>h.jsx("label",{htmlFor:t,className:i||`show-label mb-1 sm:mb-2 text-input-label font-medium text-color-label ${n}`,children:e}),bc=()=>{const{title:e,label:t,type:n,placeholder:i,buttonText:s,formData:o,changeData:r,handleLogin:a,overrideStyle:l}=pr();return h.jsxs("form",{onSubmit:a,className:l.form||"form-size",children:[h.jsx("h1",{className:l.title||"text-form-title-size show-title title-position m-form-title",children:e}),h.jsxs("div",{className:l.containerEmail||"flex justify-center flex-col gap-1 m-input-form input-size mx-auto",children:[h.jsx(Si,{labelId:"user-email",label:t}),h.jsx(xi,{inputType:n,inputId:"user-email",inputPlaceholder:i,inputValue:o.email,inputChange:c=>{r("email",c.target.value)},autoFocus:!0})]}),h.jsxs("div",{className:l.containerPassword||"flex justify-center flex-col gap-1 my-4 input-size mx-auto",children:[h.jsx(Si,{labelId:"password",label:"Password"}),h.jsx(xi,{inputType:"password",inputId:"password",inputPlaceholder:"Password",inputValue:o.password,inputChange:c=>{r("password",c.target.value)}})]}),h.jsx("div",{className:l.containerButton||"flex button-position items-center m-primary-button",children:h.jsx("button",{className:l.button||"font-bold cursor-pointer shadow-(--shadow-primary) transition-all duration-200 hover:shadow-(--shadow-primary-hover) active:shadow-(--shadow-primary-active) active:translate-y-[2px] p-primary-button rounded-primary-button bg-primary hover:bg-primary-hover text-primary-text",children:s})})]})},wc=({Logo:e})=>{const{styleCardForm:t,styleContainerLogo:n,styleLogo:i,overrideStyle:s,customVersion:o}=pr(),{firstPrivatePath:r,version:a}=Be(),{token:l,user:c}=hn();mc();const u=U.useNavigate();return p.useEffect(()=>{l&&(c!=null&&c.id)&&u(`${r}${c.id}`)},[]),h.jsxs("section",{id:"login-page",children:[(a||o)&&h.jsx("div",{style:{top:"calc(1rem + env(safe-area-inset-top))",left:"calc(1rem + env(safe-area-inset-left))"},className:"text-md text-primary absolute",children:o||a}),h.jsx("div",{className:s.container||"container mx-auto flex items-center justify-center min-h-screen",children:h.jsxs("div",{className:s.cardForm||`bg-form card-style card-size flex flex-col sm:flex-row sm:items-center justify-center ${t}`,children:[h.jsx("div",{className:s.containerLogo||`basis-1/2 flex items-center justify-center ${n}`,children:e&&h.jsx(e,{className:s.logo||`login-logo h-full sm:h-auto ${i}`})}),h.jsx(bc,{})]})})]})},Cn=()=>{const{isAuthenticated:e}=Fn(),{activeAlert:t}=Ct(),{autoLogin:n}=Be(),{token:i}=hn();return p.useEffect(()=>{!e&&!i&&!n&&t("danger","Non sei autorizzato")},[]),e===null?null:e?h.jsx(U.Outlet,{}):h.jsx(U.Navigate,{to:"/",replace:!0})},xc=({value:e,defaultValue:t=!1,onChange:n})=>{const i=e!==void 0,[s,o]=p.useState(t),r=i?e:s,a=()=>{const l=!r;i||o(l),n&&n(l)};return p.useEffect(()=>{i||o(t)},[t,i]),h.jsx("button",{type:"button",onClick:a,className:`w-14 h-6 flex items-center rounded-full p-1 transition-colors cursor-pointer ${r?"bg-blue-500":"bg-gray-300"}`,"aria-pressed":r,children:h.jsx("div",{className:`bg-white w-4 h-4 rounded-full shadow-md transform transition-transform ${r?"translate-x-8":"translate-x-0"}`})})},Sc=()=>{const{logout:e,createAxiosInstances:t}=Fn(),{usersEndpoint:n}=Be(),{setIsLoading:i}=It(),{activeAlert:s}=Ct(),{token:o,user:r}=hn(),{success:a,error:l,info:c,warning:u,promise:d}=hr(),[f,m]=p.useState(null),[y,S]=p.useState(!1),[w,v]=p.useState(!1),b=(B,Q)=>d(B,{loading:{title:Q.loading||"Caricamento..."},success:{title:Q.success||"Fatto!"},error:{title:Q.error||"Errore!"}}),T=async()=>{try{if(S(!0),!o){e(),s("danger","Sessione Scaduta");return}const B=await t(),ye=(await b(B.get(`${n}`),{loading:"Caricamento utenti...",success:"Utenti caricati!"})).data;m(ye)}catch(B){console.error(B),i(!1)}finally{S(!1)}},M=B=>{v(B),s("info",`Alert impostato su ${B?"Mobile":"Desktop"} `)},x=(B="Operazione riuscita!")=>{w?a("Successo",B):s("success",B,!0)},R=(B="Si è verificato un errore!")=>{w?l("Errore",B):s("danger",B,!0)},D=(B="Informazione generica")=>{w?c("Info",B):s("info",B,!0)},j=(B="Attenzione!")=>{w?u("Attenzione",B):s("warning",B,!0)},I=()=>{e(),s("info","Hai effettuato il logout")};return h.jsx("section",{children:h.jsxs("div",{className:"container mx-auto py-8",children:[h.jsxs("div",{className:"flex items-center justify-center gap-8 h-20",children:[h.jsxs("h1",{className:"text-4xl text-center text-slate-800",children:["Email: ",r.email]}),h.jsx("button",{onClick:I,className:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-full cursor-pointer shadow-[0_4px_10px_rgba(239,68,68,0.3),0_2px_4px_rgba(239,68,68,0.2)] hover:shadow-[0_6px_14px_rgba(185,28,28,0.4),0_3px_6px_rgba(185,28,28,0.3)] active:shadow-[0_2px_5px_rgba(239,68,68,0.3)] transition-all duration-200 active:translate-y-[2px]",children:"Logout"})]}),h.jsxs("div",{className:"flex justify-center items-center gap-4 my-8 flex-wrap",children:[h.jsx("button",{onClick:()=>x("Questo è un toast di successo!"),className:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded-full shadow-md transition-all",children:"Success"}),h.jsx("button",{onClick:()=>R("Questo è un toast di errore!"),className:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-full shadow-md transition-all",children:"Error"}),h.jsx("button",{onClick:()=>D("Questo è un toast informativo!"),className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full shadow-md transition-all",children:"Info"}),h.jsx("button",{onClick:()=>j("Questo è un toast di avviso!"),className:"bg-yellow-500 hover:bg-yellow-600 text-white font-bold py-2 px-4 rounded-full shadow-md transition-all",children:"Warning"}),h.jsxs("div",{className:"flex items-center gap-4 my-4",children:[h.jsx("span",{children:"Desktop"}),h.jsx(xc,{value:w,onChange:M}),h.jsx("span",{children:"Mobile"})]})]}),h.jsx("div",{className:"flex justify-center items-center my-12 gap-8",children:h.jsx("button",{onClick:T,className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full disabled:bg-blue-300 disabled:text-gray-500 disabled:cursor-not-allowed cursor-pointer transition-all duration-200 active:translate-y-[2px] shadow-[0_4px_10px_rgba(59,130,246,0.3),0_2px_4px_rgba(59,130,246,0.2)] hover:shadow-[0_6px_14px_rgba(29,78,216,0.4),0_3px_6px_rgba(29,78,216,0.3)] active:shadow-[0_2px_5px_rgba(59,130,246,0.3)]",disabled:y,children:"Lista degli utenti"})}),h.jsx("div",{className:"flex justify-center items-center",children:f&&h.jsx("ul",{children:f.map(B=>h.jsxs("li",{className:"text-xl my-4",children:[B.id," - ",B.email]},`user-${B.id}`))})})]})})},Xm=e=>V.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",xmlSpace:"preserve",id:"svg1",width:409.748,height:409.748,viewBox:"0 0 108.413 108.413",...e},V.createElement("defs",{id:"defs1"},V.createElement("linearGradient",{id:"linearGradient27"},V.createElement("stop",{id:"stop27",offset:0,style:{stopColor:"red",stopOpacity:1}}),V.createElement("stop",{id:"stop28",offset:1,style:{stopColor:"#ffca00",stopOpacity:.96862745}})),V.createElement("linearGradient",{xlinkHref:"#linearGradient27",id:"linearGradient28",x1:35.002,x2:143.414,y1:192.355,y2:83.942,gradientUnits:"userSpaceOnUse"})),V.createElement("g",{id:"layer1",transform:"translate(-35.002 -83.942)"},V.createElement("rect",{id:"rect26",width:108.413,height:108.413,x:35.002,y:83.942,rx:30,ry:30,style:{fill:"url(#linearGradient28)",fillOpacity:1,fillRule:"evenodd",stroke:"#ff9b01",strokeWidth:0,strokeOpacity:1,paintOrder:"stroke markers fill"}}),V.createElement("g",{id:"g1",style:{strokeWidth:1.10252},transform:"translate(9.37 14.003)scale(.90701)"},V.createElement("path",{id:"path272",d:"M103.624 105.014c-.27.002-.79.209-1.004.4a2.5 2.5 0 0 0-.313.395l-.181.277-.018 18.064-.018 18.064h-3.047v-9.75c0-10.412-.004-10.52-.345-11.948-1.398-5.861-6.243-10.128-12.213-10.755-1.515-.16-19.836-.16-20.462-.003l-.002-.004-19.984 3.575 18.852 2.16v6.078l-17.36 3.103 17.36 1.99v6.523l-17.36 3.103 14.275 1.636-.016 4.905-.019 5.726-.63.126c-1.587.315-3.197 1.068-4.528 2.117-2.206 1.737-3.742 4.446-4.053 7.144-.37 3.213.552 6.199 2.657 8.602 1.688 1.926 4.174 3.26 6.696 3.592.824.108 2.933.031 3.671-.134.932-.21 1.79-.515 2.637-.939 2.065-1.033 3.824-2.775 4.827-4.784.504-1.01.91-2.207 1.026-3.029l.047-.329h18.828v.214c0 .117.064.468.142.78.904 3.589 3.509 6.46 6.975 7.686 1.343.475 1.946.568 3.655.564 1.32-.003 1.612-.025 2.182-.158 3.368-.785 6.026-2.86 7.515-5.865.44-.89.882-2.203.972-2.892l.043-.329 7.183-.002c7.08-.002 7.188-.003 7.495-.143.647-.293.9-.703.9-1.457 0-.569-.168-.945-.55-1.225-.505-.373-.225-.36-7.9-.36h-7.115l-.117-.597c-.261-1.329-.848-2.71-1.682-3.957-.57-.854-2.02-2.296-2.864-2.852-1.214-.798-2.805-1.463-4-1.673l-.502-.088-.018-21.17-.018-21.17-.154-.312c-.258-.521-.88-.903-1.465-.9zm9.34.76c-1.961 0-3.686 1.068-4.532 2.806-.536 1.103-.53 1.026-.507 6.443l.02 4.78.189.556c.62 1.83 2.225 3.176 4.083 3.424.241.032 2.715.053 5.496.046 5.705-.015 5.342.017 6.547-.574.548-.269.757-.422 1.25-.918.49-.49.649-.709.917-1.252.538-1.096.535-1.045.535-6.262 0-4.846-.013-5.061-.328-5.862-.764-1.94-2.613-3.187-4.727-3.187h-.557l-.003 4.14-.003 4.139-1.878 1.49a123 123 0 0 1-1.964 1.54c-.056.033-.792-.513-2.034-1.507l-1.947-1.56v-8.242zm2.29.553v6.927l1.084.87c.596.478 1.106.86 1.132.85s.535-.41 1.132-.886l1.085-.866-.017-3.43-.017-3.429-2.2-.018zm-47.247 6.508 9.197.025c9.138.025 9.2.026 9.889.175 2.276.495 4.009 1.425 5.576 2.993 1.563 1.563 2.494 3.26 3.002 5.472.15.658.15.664.17 10.686l.018 10.028h-2.393l-2.91-2.91c-2.148-2.147-2.999-2.954-3.252-3.082l-.342-.174H68.007v-11.606zm44.87 16.355c-.846 0-1.356.1-1.977.386-1.351.623-2.296 1.666-2.771 3.059l-.184.539-.02 4.745c-.023 5.4-.023 5.392.503 6.478.506 1.043 1.244 1.779 2.297 2.294.347.17.83.351 1.073.404.354.077 1.48.097 5.603.1 5.817.004 5.683.015 6.749-.507 1.377-.674 2.299-1.8 2.674-3.27.13-.505.137-.783.137-5.222 0-4.448-.007-4.717-.137-5.237-.233-.926-.636-1.636-1.32-2.324-.515-.519-.69-.645-1.318-.948-.817-.396-1.263-.497-2.19-.497h-.646v8.223l-1.91 1.518c-1.049.834-1.938 1.527-1.974 1.54s-.938-.673-2.004-1.524l-1.939-1.548v-8.209zm2.377.554.004 3.447.004 3.446 1.052.845c.58.464 1.08.845 1.112.848s.555-.39 1.16-.874l1.101-.878v-6.834h-2.217zm-50.295 9.491H85.98l3.015 3.002c2.568 2.557 3.058 3.014 3.3 3.083.206.058 1.624.08 5.04.08h4.755v3.16l-.537.094c-1.12.195-2.648.81-3.729 1.498-1.69 1.076-3.119 2.7-3.994 4.536-.443.931-.884 2.341-.884 2.83v.214H74.119l-.046-.329c-.174-1.222-.844-2.861-1.707-4.174-.532-.809-1.996-2.292-2.8-2.836-1.322-.897-2.958-1.574-4.282-1.772l-.325-.05v-4.668z",style:{fill:"#000",strokeWidth:1.10252}}),V.createElement("path",{id:"path268",d:"M103.624 103.562c-.27.002-.79.209-1.004.4a2.5 2.5 0 0 0-.313.395l-.181.277-.018 18.064-.018 18.064h-3.047v-9.75c0-10.412-.004-10.52-.345-11.948-1.398-5.861-6.243-10.129-12.213-10.755-1.515-.16-19.836-.16-20.462-.003l-.002-.004-19.984 3.575 18.852 2.16v6.078l-17.36 3.103 17.36 1.99v6.523l-17.36 3.103 14.275 1.635-.016 4.906-.019 5.726-.63.125c-1.587.316-3.197 1.069-4.528 2.118-2.206 1.737-3.742 4.445-4.053 7.144-.37 3.213.552 6.199 2.657 8.602 1.688 1.926 4.174 3.26 6.696 3.592.824.108 2.933.031 3.671-.134.932-.21 1.79-.515 2.637-.939 2.066-1.033 3.824-2.775 4.827-4.784.504-1.01.91-2.207 1.027-3.029l.046-.33h18.828v.215c0 .117.064.468.142.779a10.96 10.96 0 0 0 6.975 7.687c1.343.475 1.946.568 3.655.564 1.32-.003 1.613-.025 2.182-.158 3.368-.785 6.027-2.86 7.515-5.865.44-.89.882-2.204.972-2.892l.043-.33 7.183-.001c7.08-.002 7.188-.003 7.495-.143.647-.293.9-.703.9-1.457 0-.569-.168-.945-.55-1.225-.505-.373-.225-.36-7.899-.36h-7.116l-.117-.597c-.261-1.329-.848-2.71-1.682-3.958-.57-.853-2.02-2.295-2.864-2.85-1.214-.799-2.805-1.465-4-1.674l-.502-.088-.018-21.17-.018-21.17-.154-.312c-.258-.521-.88-.903-1.465-.9zm9.34.76c-1.961 0-3.686 1.068-4.532 2.806-.536 1.103-.53 1.026-.507 6.443l.02 4.78.189.556c.62 1.83 2.225 3.176 4.083 3.424.241.032 2.715.053 5.496.046 5.705-.015 5.343.017 6.547-.574.548-.269.757-.422 1.25-.918.49-.49.65-.709.917-1.252.539-1.096.535-1.045.535-6.262 0-4.846-.012-5.061-.328-5.862-.764-1.94-2.613-3.187-4.727-3.187h-.557l-.003 4.14-.003 4.139-1.878 1.49a116 116 0 0 1-1.964 1.54c-.056.033-.792-.513-2.034-1.507l-1.947-1.56v-8.242zm2.29.553v6.927l1.084.87c.597.478 1.106.86 1.132.85s.535-.41 1.132-.886l1.085-.866-.017-3.43-.017-3.429-2.2-.018zm-47.247 6.508 9.197.025c9.138.025 9.2.026 9.889.175 2.276.495 4.009 1.425 5.576 2.993 1.563 1.563 2.494 3.26 3.002 5.472.15.658.15.664.17 10.686l.018 10.028h-2.393l-2.91-2.91c-2.148-2.147-2.999-2.954-3.252-3.082l-.342-.174H68.007V122.99zm44.87 16.355c-.846 0-1.356.1-1.976.386-1.352.623-2.297 1.666-2.772 3.059l-.184.539-.02 4.745c-.023 5.4-.023 5.392.503 6.477.507 1.044 1.244 1.78 2.297 2.295.347.17.83.351 1.073.404.354.077 1.48.097 5.603.1 5.817.005 5.683.015 6.749-.507 1.377-.674 2.299-1.8 2.674-3.27.13-.505.137-.783.137-5.222 0-4.448-.007-4.717-.137-5.237-.233-.926-.636-1.636-1.32-2.324-.515-.519-.69-.645-1.318-.948-.817-.396-1.263-.497-2.19-.497h-.646v8.223l-1.91 1.518c-1.049.834-1.938 1.527-1.974 1.54s-.938-.673-2.004-1.524l-1.939-1.548v-8.209zm2.377.554.004 3.447.004 3.446 1.052.844c.58.465 1.08.846 1.112.849s.555-.39 1.16-.874l1.101-.878v-6.834h-2.217zm-50.295 9.491H85.98l3.015 3.002c2.568 2.557 3.058 3.014 3.3 3.083.206.058 1.624.08 5.04.08h4.755v3.16l-.537.094c-1.12.195-2.648.809-3.729 1.498-1.69 1.076-3.118 2.7-3.994 4.536-.443.931-.884 2.341-.884 2.83v.214H74.119l-.046-.329c-.174-1.222-.844-2.861-1.707-4.174-.532-.809-1.996-2.292-2.8-2.836-1.322-.897-2.958-1.574-4.282-1.773l-.325-.048v-4.669z",style:{fill:"#fff",strokeWidth:1.10252}})))),Zm=e=>{const{publicRoutes:t,privateRoutes:n}=uc(),{firstPrivatePath:i,routes:s,defaultTitle:o}=Be();pc(s,o);const{logoImg:r=Xm,pathImg:a="./src/assets/MyWarehouse.svg",firstPrivateElement:l=h.jsx(Sc,{}),globalLayout:c,isMain:u,headerComponent:d,showHeaderOnLogin:f,headerExcludedRoutes:m,footerComponent:y,showFooterOnLogin:S,footerExcludedRoutes:w,privateProvider:v,customProvider:b,promptComponent:T}=e;let M;c==="none"?M=null:p.isValidElement(c)?M=c:M=h.jsx(vc,{isMain:u,headerComponent:d,showHeaderOnLogin:f,headerExcludedRoutes:m,footerComponent:y,showFooterOnLogin:S,footerExcludedRoutes:w,promptComponent:T});const x=p.useMemo(()=>v?p.cloneElement(v,{},b?p.cloneElement(b,{},h.jsx(Cn,{children:h.jsx(U.Outlet,{})})):h.jsx(Cn,{children:h.jsx(U.Outlet,{})})):b?p.cloneElement(b,{},h.jsx(Cn,{children:h.jsx(U.Outlet,{})})):h.jsx(Cn,{children:h.jsx(U.Outlet,{})}),[v,b]),R=()=>{const D=document.querySelector("link[rel='icon']");a&&(D.href=a)};return p.useEffect(()=>{R()},[]),h.jsx(U.Routes,{children:h.jsxs(U.Route,{element:M,children:[h.jsxs(U.Route,{path:"/",children:[h.jsx(U.Route,{index:!0,element:h.jsx(wc,{Logo:r})}),t.map((D,j)=>h.jsx(U.Route,{path:D.path,element:D.element},`public-${j}`))]}),h.jsxs(U.Route,{element:x,children:[h.jsx(U.Route,{path:`${i??"/dashboard/"}:id`,element:l}),n.map((D,j)=>h.jsx(U.Route,{path:D.path,element:D.element},`private-${j}`))]})]})})},Jm=({children:e})=>{var s;const{user:t}=hn(),n=U.useLocation(),{activeAlert:i}=Ct();return p.useEffect(()=>{(!t||!t.admin)&&i("warning","Non puoi accedere a questa pagina")},[t]),!t||!t.admin?h.jsx(U.Navigate,{to:((s=n.state)==null?void 0:s.from)||"/",replace:!0}):e},Qm=({spinner:e=!0,spinnerStyle:t,text:n,textStyle:i,children:s,containerStyle:o,overrideStyle:r={}})=>h.jsxs("div",{className:r.container||`w-full h-full relative flex items-center justify-center ${o}`,children:[e&&h.jsx(gc,{className:r.spinner||`text-[20rem] animate-spin text-black ${t}`}),s||h.jsx("p",{className:r.text||`text-black text-2xl select-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${i}`,children:n||"Loading..."})]}),Ls=({isTag:e=!1,value:t,label:n,placeholder:i,id:s,onChange:o,error:r=null})=>h.jsxs("div",{className:`flex items-center justify-center relative ${e?"gap-4 mb-2":"gap-1 m-4"}`,children:[h.jsx(Si,{labelId:s,label:n,overrideStyle:`text-xl font-bold text-color-label ${e?"":"basis-1/3"}`}),h.jsx(xi,{type:"text",inputId:s,inputPlaceholder:i,inputValue:t||"",disabled:e,inputChange:o,overrideStyle:`${e?"w-full":"basis-2/3"} ${r?"border-red-600 focus:ring focus:ring-red-600 focus:border-red-600 focus:shadow-[0_0_0_4px_rgba(255,0,0,0.5)]":""} bg-input-bg border border-input-border text-input-text text-input-placeholder input-rounded focus:ring focus:ring-focus-ring focus:border-spot-rfid-input-border focus:outline-none focus:shadow-spot-rfid-input block w-full p-input`}),r&&h.jsx("p",{className:"text-red-600 text-[13px] absolute bottom-0 left-26 translate-y-[20px]",children:r})]}),e0=({title:e,showTag:t,value:n,tag:i,showButton:s,handleClick:o})=>h.jsxs("div",{className:`border border-slate-300 rounded-xl p-2 m-2 shadow-xl transition-all duration-700 transform ${e==="TAG B"?"delay-200":"mb-4"} ${t?"opacity-100 translate-y-0":"opacity-0 translate-y-10"}`,children:[h.jsx("h2",{className:"text-center mb-2 text-2xl",children:e}),h.jsx(Ls,{label:"TID",placeholder:`Leggi ${e}`,id:i?`tid-${i}`:"tid",isTag:!0,value:(n==null?void 0:n.valueTID)||""}),h.jsx(Ls,{label:"EPC",placeholder:`Leggi ${e}`,id:i?`epc-${i}`:"epc",isTag:!0,value:(n==null?void 0:n.valueEPC)||""}),!s&&h.jsx("div",{className:"flex items-center justify-center",children:h.jsx("button",{onClick:o,disabled:!(n!=null&&n.valueTID)&&!(n!=null&&n.valueEPC),className:"my-1 bg-write-button disabled:bg-write-button/40 text-white px-4 py-2 rounded-lg shadow-md disabled:transition-none disabled:active:translate-y-0 transition-all duration-200 ease-in-out transform active:translate-y-[2px] cursor-pointer uppercase",children:"Scrivi tag"})})]});function t0(e){return St({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.04 1.33L12.71 3l.29.71v.33h-.5l-.5.5v-.83l-1.67-1.67H10v4H4v-4H2v10h3l-.5 1H2l-1-1v-10l1-1h8.33l.71.29zM7 5h2V2H7v3zm6.5 0L15 6.5l-.02.69-5.5 5.5-.13.12-.37.37-.1.09-3 1.5-.67-.67 1.5-3 .09-.1.37-.37.12-.13 5.5-5.5h.71zm-6.22 7.24l-.52 1 1.04-.48-.52-.52zm.69-1.03l.79.79 5.15-5.15-.79-.79-5.15 5.15z"},child:[]}]})(e)}const n0=({minReadingPower:e,maxReadingPower:t,stepRangePower:n,rangeValue:i,setRangeValue:s,show:o,handleClick:r})=>{const a=(i-e)/(t-e)*100;return h.jsxs("div",{className:`border border-slate-300 rounded-xl p-2 m-2 shadow-xl transition-all duration-700 transform ${o?"opacity-100 translate-y-0":"opacity-0 translate-y-10"}`,children:[h.jsx("h2",{className:"text-center my-4 text-2xl",children:"Configurazione Potenza"}),h.jsxs("div",{className:"relative my-12 w-[90%] mx-auto",children:[h.jsx("input",{id:"power",type:"range",min:e,max:t,step:n,value:i,onChange:l=>s(Number(l.target.value)),className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-primary-accent"}),h.jsx("div",{className:"absolute bottom-8 transform -translate-x-1/2 bg-white border border-gray-200 text-sm text-gray-800 py-1 px-2 rounded-lg shadow-md transition-opacity",style:{left:`${a}%`},children:i})]}),h.jsx("div",{className:"flex items-center justify-center my-4",children:h.jsxs("button",{onClick:()=>r(i),className:"py-2 px-4 flex items-center justify-center gap-1 bg-save-button text-white rounded-lg shadow-md transition duration-200 ease-in-out transform active:translate-y-[2px] cursor-pointer",children:["Salva",h.jsx(t0,{})]})})]})},i0=({show:e,isConfigPage:t,handleSelectFile:n})=>h.jsxs("div",{className:`${t?`${e?"opacity-100 translate-y-0 delay-200":"opacity-0 translate-y-10"}`:""} p-4 text-center transition-all duration-700 transform`,children:[h.jsxs("h2",{className:"text-xl my-4",children:["Seleziona il file ",h.jsx("strong",{children:"config.json"})," per recuperare le chiavi univoche del dispositivo"]}),h.jsx("button",{onClick:n,className:"my-4 bg-blue-500 text-white px-4 py-2 rounded-lg",children:"Seleziona file"})]});function s0(e){return St({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M312 372c-7.7 0-14 6.3-14 14 0 9.9-8.1 18-18 18H94c-9.9 0-18-8.1-18-18V126c0-9.9 8.1-18 18-18h186c9.9 0 18 8.1 18 18 0 7.7 6.3 14 14 14s14-6.3 14-14c0-25.4-20.6-46-46-46H94c-25.4 0-46 20.6-46 46v260c0 25.4 20.6 46 46 46h186c25.4 0 46-20.6 46-46 0-7.7-6.3-14-14-14z"},child:[]},{tag:"path",attr:{d:"M372.9 158.1c-2.6-2.6-6.1-4.1-9.9-4.1-3.7 0-7.3 1.4-9.9 4.1-5.5 5.5-5.5 14.3 0 19.8l65.2 64.2H162c-7.7 0-14 6.3-14 14s6.3 14 14 14h256.6L355 334.2c-5.4 5.4-5.4 14.3 0 19.8l.1.1c2.7 2.5 6.2 3.9 9.8 3.9 3.8 0 7.3-1.4 9.9-4.1l82.6-82.4c4.3-4.3 6.5-9.3 6.5-14.7 0-5.3-2.3-10.3-6.5-14.5l-84.5-84.2z"},child:[]}]})(e)}function r0(e){return St({tag:"svg",attr:{version:"1.2",baseProfile:"tiny",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 9.059v-2.559c0-.256-.098-.512-.293-.708-.195-.195-.451-.292-.707-.292s-.512.097-.707.292l-6.293 6.208 6.293 6.207c.195.195.451.293.707.293s.512-.098.707-.293.293-.452.293-.707v-2.489c2.75.068 5.755.566 8 3.989v-1c0-4.633-3.5-8.443-8-8.941z"},child:[]}]})(e)}const o0=e=>V.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",xmlSpace:"preserve",id:"svg1",width:409.748,height:409.748,viewBox:"0 0 108.413 108.413",...e},V.createElement("defs",{id:"defs1"},V.createElement("linearGradient",{id:"linearGradient27"},V.createElement("stop",{id:"stop27",offset:0,style:{stopColor:"red",stopOpacity:1}}),V.createElement("stop",{id:"stop28",offset:1,style:{stopColor:"#ffca00",stopOpacity:.96862745}})),V.createElement("linearGradient",{xlinkHref:"#linearGradient27",id:"linearGradient28",x1:35.002,x2:143.414,y1:192.355,y2:83.942,gradientUnits:"userSpaceOnUse"})),V.createElement("g",{id:"layer1",transform:"translate(-35.002 -83.942)"},V.createElement("rect",{id:"rect26",width:108.413,height:108.413,x:35.002,y:83.942,rx:30,ry:30,style:{fill:"url(#linearGradient28)",fillOpacity:1,fillRule:"evenodd",stroke:"#ff9b01",strokeWidth:0,strokeOpacity:1,paintOrder:"stroke markers fill"}}),V.createElement("g",{id:"g1",style:{strokeWidth:.892424},transform:"matrix(1.08335 0 0 1.15901 -13.02 -26.51)"},V.createElement("path",{id:"path1",d:"M93.826 176.603c-.169-.034-1.837-.443-3.708-.909s-6.894-1.707-11.162-2.759a2463 2463 0 0 1-8.036-1.986 1.26 1.26 0 0 1-.84-.72c-.135-.297-.142-.67-.144-7.586l-.002-7.275-1.586-.388c-.873-.214-2.732-.663-4.131-.998-1.664-.399-2.62-.664-2.765-.767-.451-.321-.673-1.178-.44-1.7.05-.114 1.348-1.542 2.882-3.173l4.473-4.751c.925-.983 1.682-1.813 1.682-1.846 0-.032-2.013-2.197-4.473-4.811s-4.513-4.845-4.564-4.96c-.124-.278-.122-.806.005-1.108.137-.329.59-.717.947-.812a377 377 0 0 1 3.04-.735 4957 4957 0 0 0 16.208-3.91c3.114-.76 3.63-.84 4.028-.63.113.059 1.108 1.071 2.211 2.249a1906 1906 0 0 0 4.454 4.731l2.447 2.591.578-.603c.73-.762 7.41-7.89 7.899-8.429.533-.588 1.164-.826 1.676-.632.098.037 1.949.488 4.115 1.003 2.165.515 5.554 1.325 7.53 1.802l7.11 1.713c1.934.466 3.612.885 3.727.931.44.176.82.811.821 1.372 0 .11-.077.339-.171.51-.146.264-2.64 2.954-7.92 8.542-.595.63-1.074 1.174-1.062 1.207.011.034 2.015 2.18 4.453 4.768s4.493 4.832 4.565 4.985c.232.491.124 1.107-.27 1.528-.244.262-.464.356-1.276.544-.4.093-2.137.51-3.86.927l-3.307.798-.172.04v7.212c0 5.18-.025 7.285-.087 7.472a1.6 1.6 0 0 1-.287.477c-.211.23-.693.509-.877.509-.06 0-4.2 1.011-9.197 2.248-12.941 3.202-13.804 3.411-14.017 3.4a4 4 0 0 1-.497-.071m-.115-14.064c0-6.938-.027-12.614-.059-12.614s-1.13 1.144-2.44 2.542c-5.288 5.648-5.758 6.135-6.045 6.267-.478.22.5.423-8.925-1.857-2.27-.549-4.327-1.045-4.568-1.102l-.44-.103v13.955l.975.24c6.052 1.49 19.206 4.741 20.126 4.974a30 30 0 0 0 1.28.306c.076.005.096-2.563.096-12.608m12.576 9.853c5.93-1.467 10.857-2.684 10.951-2.706l.171-.04.02-6.992c.018-6.187.006-6.99-.094-6.958-.063.019-1.698.416-3.632.883-1.934.466-4.72 1.14-6.192 1.497-3.653.887-3.407.84-3.789.725-.186-.056-.463-.233-.65-.416-.18-.175-2.039-2.141-4.13-4.37-2.092-2.229-3.833-4.063-3.868-4.077s-.063 5.656-.063 12.601v12.627l.248-.054c.137-.03 5.1-1.253 11.028-2.72m-20.964-15.644c.885-.919 7.626-8.102 8.034-8.56.163-.184.284-.345.268-.36-.03-.026-1.291-.333-7.062-1.721l-9.387-2.26-5.87-1.413-.512.554a2343 2343 0 0 0-8.041 8.564c-.267.285-.47.533-.45.552s1.89.48 4.158 1.025c9.94 2.387 16.933 4.072 17.464 4.209.316.08.598.149.627.151s.376-.33.771-.74m20.235.401c.78-.189 3.86-.93 6.845-1.648 12.242-2.942 13.984-3.364 14.015-3.396.019-.018-.237-.321-.568-.673l-4.112-4.38-3.921-4.178-.413-.437-6.82 1.638c-3.75.9-8.299 1.997-10.107 2.437s-3.76.91-4.339 1.047c-.578.137-1.05.278-1.05.313 0 .06 1.972 2.177 6.918 7.426 1.135 1.204 2.08 2.191 2.1 2.193.019.002.672-.152 1.452-.342m-9.338-11.001c.954-.227 3.678-.885 6.054-1.461a4296 4296 0 0 1 11.257-2.72c.41-.097.746-.196.746-.22 0-.042-2.28-.6-11.889-2.913a3300 3300 0 0 1-5.734-1.386c-1.219-.297-2.268-.538-2.331-.536s-1.388.313-2.944.691-4.05.982-5.543 1.34c-1.492.36-4.434 1.07-6.536 1.58-2.103.508-4.072.982-4.377 1.054-.305.07-.554.148-.554.17s.61.186 1.357.362c.746.177 4.831 1.16 9.078 2.188l8.525 2.06c.441.106.882.196.98.199s.958-.18 1.911-.408m-23.175-5.507c1.616-.385 15.137-3.644 18.927-4.562.914-.222 1.663-.423 1.663-.447 0-.043-2.176-2.373-6.494-6.955a220 220 0 0 1-2.417-2.588c-.068-.09-.257-.065-1.223.168-2.153.52-10.698 2.575-15.93 3.832-2.876.692-5.247 1.274-5.267 1.295-.046.045-.21-.132 4.76 5.153 2.23 2.371 4.083 4.358 4.117 4.415s.074.105.09.105.815-.187 1.774-.416m44.726.017c.668-.727 2.633-2.823 4.61-4.915 3.59-3.802 4.074-4.323 4.04-4.356-.019-.019-.892-.24-1.942-.491a14930 14930 0 0 1-17.845-4.296l-2.558-.62-.225.256c-.123.141-.763.824-1.42 1.518-.66.694-2.26 2.397-3.559 3.784a573 573 0 0 1-3.073 3.264c-.392.408-.712.773-.712.812 0 .081 1.221.382 13.259 3.264 4.832 1.157 8.803 2.12 8.824 2.141.102.102.267.003.601-.361",style:{fill:"#fff",fillOpacity:1,strokeWidth:0,strokeDasharray:"none"}}),V.createElement("path",{id:"path2",d:"M94.237 147.397c-.19-.076-.536-.44-.83-.87-.138-.202-.98-1.552-1.87-3.001-6.428-10.455-9.515-15.547-9.95-16.413-.459-.916-.982-2.465-1.178-3.493-.478-2.499-.335-4.879.435-7.235 1.186-3.633 3.713-6.577 7.144-8.326a14.6 14.6 0 0 1 4.316-1.388c1.018-.165 3.183-.165 4.201 0a14.6 14.6 0 0 1 5.902 2.32c3.031 2.03 5.227 5.32 5.959 8.928.623 3.072.293 6.038-.986 8.869-.359.792-3.667 6.345-7.571 12.703l-3.23 5.263c-.787 1.285-1.265 1.992-1.542 2.284-.398.42-.519.473-.8.36m1.266-20.98a6.44 6.44 0 0 0 4.949-4.23c.294-.862.38-1.48.33-2.368-.098-1.758-.749-3.161-2.028-4.375-1.216-1.153-2.656-1.723-4.35-1.723-1.69 0-3.132.57-4.345 1.72-.963.913-1.534 1.855-1.868 3.078-.13.48-.154.72-.151 1.567.003.873.026 1.084.183 1.657a6.43 6.43 0 0 0 3.963 4.37 6.3 6.3 0 0 0 3.317.303",style:{fill:"#d30000",fillOpacity:1,strokeWidth:.892424}}),V.createElement("path",{id:"rect2",d:"M158.632 137.745h3.539v1.387h-3.539z",style:{fill:"#fff",fillOpacity:1,fillRule:"evenodd",stroke:"#ff9b01",strokeWidth:0,strokeDasharray:"none",paintOrder:"stroke markers fill"},transform:"matrix(.98806 .15405 -.46962 .88287 0 0)"}),V.createElement("path",{id:"rect3",d:"M120.628 170.946h3.167v1.222h-3.167z",style:{fill:"#fff",fillOpacity:1,fillRule:"evenodd",stroke:"#ff9b01",strokeWidth:0,strokeDasharray:"none",paintOrder:"stroke markers fill"},transform:"rotate(8.335)scale(.9449 1)skewY(-18.126)"})))),a0=({Logo:e,logo:t})=>{const{logout:n}=Fn(),{activeAlert:i}=Ct(),{autoLogin:s,configRoutes:o,firstPrivateTitle:r,showHeaderButton:a}=Be(),{isLoading:l}=It(),c=U.useLocation(),u=U.useNavigate(),d=()=>{n(),i("info","Hai effettuato il logout")},f=o.find(y=>y.path===c.pathname),m=U.useMatch("home/:id");return h.jsx("header",{className:l?"hidden":"",children:h.jsxs("nav",{className:"header-size flex items-center justify-between px-2 shadow-lg border-b gap-2 border-b-gray-300",children:[h.jsx("figure",{children:e&&typeof e=="function"?h.jsx(e,{className:"header-logo-size"}):t?h.jsx("img",{src:t,alt:"Logo",className:"header-logo-size"}):h.jsx(o0,{className:"header-logo-size"})}),h.jsx("div",{children:h.jsx("p",{children:(f==null?void 0:f.title)||r})}),h.jsxs("div",{children:[!s&&m&&h.jsx("button",{className:"h-[48px] w-[48px] flex items-center justify-center bg-red-600 text-white rounded-lg shadow-md transition duration-200 ease-in-out transform active:translate-y-[2px] cursor-pointer",type:"button",onClick:d,children:h.jsx(s0,{className:"text-4xl w-full"})}),!m&&a&&h.jsx("button",{className:"h-[48px] w-[48px] flex items-center justify-center bg-sky-600 text-white rounded-lg shadow-md transition duration-200 ease-in-out transform active:translate-y-[2px] cursor-pointer",type:"button",onClick:()=>u(-1),children:h.jsx(r0,{className:"text-4xl w-full"})})]})]})})};function l0(e){return St({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M763.024 259.968C718.4 141.536 622.465 66.527 477.553 66.527c-184.384 0-313.392 136.912-324.479 315.536C64.177 410.495.002 501.183.002 603.903c0 125.744 98.848 231.968 215.823 231.968h92.448c17.664 0 32-14.336 32-32 0-17.68-14.336-32-32-32h-92.448c-82.304 0-152.832-76.912-152.832-167.968 0-80.464 56.416-153.056 127.184-165.216l29.04-5.008-2.576-29.328-.24-.368c0-155.872 102.576-273.44 261.152-273.44 127.104 0 198.513 62.624 231.537 169.44l6.847 22.032 23.056.496c118.88 2.496 223.104 98.945 223.104 218.77 0 109.055-72.273 230.591-181.696 230.591h-73.12c-17.664 0-32 14.336-32 32 0 17.68 14.336 32 32 32l72.88-.095c160-4.224 243.344-157.071 243.344-294.495 0-147.712-115.76-265.744-260.48-281.312zM535.985 514.941c-.176-.192-.241-.352-.354-.512l-8.095-8.464c-4.432-4.688-10.336-7.008-16.24-6.976-5.905-.048-11.777 2.288-16.289 6.975l-8.095 8.464c-.16.16-.193.353-.336.513L371.072 642.685c-8.944 9.344-8.944 24.464 0 33.84l8.064 5.471c8.945 9.344 23.44 6.32 32.368-3.024l68.113-75.935v322.432c0 17.664 14.336 32 32 32s32-14.336 32-32V603.34l70.368 77.631c8.944 9.344 23.408 12.369 32.336 3.025l8.064-5.472c8.945-9.376 8.945-24.496 0-33.84z"},child:[]}]})(e)}const c0=e=>{const[t,n]=p.useState(!1),{onFilesSelect:i,id:s="dropzone-file",containerStyle:o="flex items-center justify-center w-full relative h-full",dropzoneStyle:r="flex flex-col items-center justify-center text-body px-6 text-center pt-5 pb-6 pointer-events-none",labelStyle:a=`flex flex-col items-center justify-center w-full h-full rounded-2xl transition-all duration-300 bg-slate-100/80 shadow-lg border border-slate-300 rounded-base cursor-pointer hover:bg-slate-200/80 hover:border-slate-500 hover:shadow-xl ${t?"bg-slate-200/80 border-slate-600 shadow-xl shadow-primary-strong":"border-default-strong"}`,dragActiveStyle:l="absolute w-full h-full top-0 left-0 rounded-2xl border-2 border-primary-strong/70 animate-pulse"}=e,c=p.useCallback(f=>{f.preventDefault(),f.stopPropagation(),f.type==="dragenter"||f.type==="dragover"?n(!0):f.type==="dragleave"&&n(!1)},[]),u=p.useCallback(f=>{f.preventDefault(),f.stopPropagation(),n(!1),f.dataTransfer.files&&f.dataTransfer.files.length>0&&(i==null||i(Array.from(f.dataTransfer.files)))},[i]),d=f=>{f.target.files&&f.target.files.length>0&&(i==null||i(Array.from(f.target.files)))};return h.jsxs("div",{className:o,onDragEnter:c,children:[h.jsxs("label",{htmlFor:s,className:a,children:[h.jsxs("div",{className:r,children:[h.jsx(l0,{className:"text-8xl"}),h.jsxs("p",{className:"mb-2",children:[h.jsx("span",{className:"font-semibold",children:"Clicca per caricare"})," o trascina qui i file"]}),h.jsx("p",{className:"text-sm opacity-70",children:"Puoi selezionare più file"})]}),h.jsx("input",{id:s,type:"file",multiple:!0,className:"hidden",onChange:d})]}),t&&h.jsx("div",{className:l,onDragEnter:c,onDragLeave:c,onDragOver:c,onDrop:u})]})},Vs=e=>{const{id:t,name:n,value:i,onChange:s,disabled:o,required:r,labelStyle:a,containerStyle:l,inputStyle:c,title:u,children:d}=e;return h.jsxs("div",{className:l||"flex flex-col gap-1 mx-auto w-full",children:[h.jsx("label",{htmlFor:t,className:a||"mb-1 text-input-label font-medium text-color-label",children:u}),h.jsx("input",{type:"date",id:t,name:n,value:i||"",onChange:s,disabled:o,required:r,className:c||"bg-input-bg border border-input-border rounded-lg text-input-text placeholder:text-input-placeholder rounded-input focus:ring focus:ring-primary focus:border-primary focus:outline-none focus:shadow-[var(--shadow-primary-input)] block w-full h-[43px] p-input disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed disabled:opacity-60"}),d]})},u0=e=>{const{startId:t,endId:n,startName:i,endName:s,startValue:o,endValue:r,onChange:a,disabled:l,required:c,dateError:u,startTitle:d,endTitle:f,startStyle:m,endStyle:y,labelStyle:S,containerStyle:w,startContainerStyle:v,endContainerStyle:b,endDateShow:T=!0,children:M}=e;return h.jsxs("div",{className:w||"flex gap-4 mx-auto w-full mb-4",children:[h.jsx(Vs,{id:t,name:i,value:o,onChange:a,disabled:l,required:c,title:d,labelStyle:S,containerStyle:v,inputStyle:m}),T&&h.jsx(Vs,{id:n,name:s,value:r,onChange:a,disabled:l,required:c,title:f,labelStyle:S,containerStyle:b,inputStyle:y,children:u&&h.jsx("p",{className:"text-red-500 text-[13px] mt-1",children:u})}),M]})},Tc=({sizeContainer:e,Logo:t,spinnerColor:n})=>h.jsxs("div",{className:`relative ${e||"h-60 w-60"}`,children:[h.jsx("svg",{className:"absolute inset-0 w-full h-full animate-spin-slow z-10",viewBox:"0 0 100 100",children:h.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:n||"#60A5FA",strokeWidth:"6",strokeLinecap:"round",strokeDasharray:"280",strokeDashoffset:"210"})}),h.jsx("figure",{className:"h-full w-full rounded-full overflow-hidden relative",children:h.jsx(t,{className:"h-full w-full"})})]}),d0=({gradients:e,moreGradients:t,containerSize:n,overlayStyle:i,NewLogoLoader:s,Logo:o,spinnerColor:r})=>{const{customLoginTimeout:a}=Be(),{isLoading:l}=It(),[c,u]=p.useState(l),[d,f]=p.useState(!1),m=["bg-gradient-to-br from-blue-500 via-blue-400 to-blue-200","bg-gradient-to-br from-blue-200 via-blue-400 to-purple-300","bg-gradient-to-br from-blue-400 via-cyan-300 to-blue-200","bg-gradient-to-br from-blue-100 via-purple-200 to-pink-100","bg-gradient-to-br from-blue-400 via-blue-500 to-blue-600","bg-gradient-to-br from-blue-300 via-cyan-400 to-indigo-400","bg-gradient-to-br from-cyan-200 via-blue-300 to-blue-500","bg-gradient-to-br from-indigo-300 via-blue-400 to-purple-400",...t||[]],y=e??[...m,...t??[]],S=y[Math.floor(Math.random()*y.length)],w=n||"h-[420px] w-[420px]";return p.useEffect(()=>{if(l){u(!0);const v=setTimeout(()=>f(!0),10);return()=>clearTimeout(v)}else{f(!1);const v=setTimeout(()=>u(!1),300);return()=>clearTimeout(v)}},[l,a]),h.jsx("div",{className:`${i||"fixed top-0 bottom-0 left-0 right-0 flex items-center justify-center z-999 transition-opacity duration-300"} ${S} ${d?"opacity-100":"opacity-0"}`,children:s?h.jsx(s,{}):h.jsx(Tc,{sizeContainer:w,Logo:o,spinnerColor:r})})};Object.defineProperty(exports,"BrowserRouter",{enumerable:!0,get:()=>U.BrowserRouter});Object.defineProperty(exports,"Link",{enumerable:!0,get:()=>U.Link});Object.defineProperty(exports,"NavLink",{enumerable:!0,get:()=>U.NavLink});Object.defineProperty(exports,"Outlet",{enumerable:!0,get:()=>U.Outlet});Object.defineProperty(exports,"Route",{enumerable:!0,get:()=>U.Route});Object.defineProperty(exports,"Routes",{enumerable:!0,get:()=>U.Routes});Object.defineProperty(exports,"useLocation",{enumerable:!0,get:()=>U.useLocation});Object.defineProperty(exports,"useMatch",{enumerable:!0,get:()=>U.useMatch});Object.defineProperty(exports,"useNavigate",{enumerable:!0,get:()=>U.useNavigate});Object.defineProperty(exports,"useParams",{enumerable:!0,get:()=>U.useParams});exports.axios=oa;exports.ReactDOM=aa;exports.Alert=Ds;exports.AlertProvider=Im;exports.AuthAdmin=Jm;exports.AuthPage=Cn;exports.AuthProvider=Nm;exports.CardInputRange=n0;exports.CardInputTag=e0;exports.ConfigFileReader=i0;exports.ConfigProvider=Gc;exports.Dashboard=Sc;exports.DefaultLayout=vc;exports.ErrorPage=ca;exports.FileDropzone=c0;exports.Header=a0;exports.Input=xi;exports.InputDate=Vs;exports.InputGroup=Ls;exports.InputLabel=Si;exports.InputStartEndDate=u0;exports.Loader=d0;exports.Loading=yc;exports.LoadingComponent=Qm;exports.LoadingProvider=Uc;exports.Login=wc;exports.LoginForm=bc;exports.LoginFormProvider=_m;exports.LogoLoader=Tc;exports.ModalProvider=Fm;exports.PackageRoutes=Zm;exports.RouteProvider=Bm;exports.SwitchRadio=xc;exports.UsePageTitle=pc;exports.fetchAxiosConfig=ac;exports.useAlert=Ct;exports.useAuth=Fn;exports.useAuthStorage=hn;exports.useConfig=Be;exports.useDevice=ga;exports.useIndexedDB=$m;exports.useLoading=It;exports.useLoginForm=pr;exports.useModal=hc;exports.useOrientation=zm;exports.useRoutesInjection=uc;exports.useSafeArea=Um;exports.useStorage=js;exports.useToast=hr;exports.useViewportHeight=mc;
|
package/dist/thecore-auth.esm.js
CHANGED
|
@@ -459,7 +459,7 @@ const wa = Nt(), v0 = ({ children: t, defaultComponent: e }) => {
|
|
|
459
459
|
const t = ut(wa);
|
|
460
460
|
if (t === void 0) throw new Error("Non puoi settare il loading");
|
|
461
461
|
return t;
|
|
462
|
-
}, Xc = "0.0.
|
|
462
|
+
}, Xc = "0.0.207", Zc = ({ errorMessage: t, errorShow: e }) => /* @__PURE__ */ h.jsx("section", { className: e ? "" : "hidden", children: /* @__PURE__ */ h.jsxs("div", { className: "container mx-auto", children: [
|
|
463
463
|
/* @__PURE__ */ h.jsx("h1", { className: "text-center text-8xl my-12", children: "Errore" }),
|
|
464
464
|
/* @__PURE__ */ h.jsx("pre", { className: "text-xl", children: t })
|
|
465
465
|
] }) });
|
|
@@ -8439,7 +8439,7 @@ Esempio:
|
|
|
8439
8439
|
if (t === void 0) throw new Error("Non puoi modificare La login");
|
|
8440
8440
|
return t;
|
|
8441
8441
|
}, Tc = Nt(), A0 = ({ children: t }) => {
|
|
8442
|
-
const [e, n] = N(!1), [i, s] = N(null), [o, r] = N(""), [a, l] = N(null), [c, u] = N(null), [d, f] = N(null), [p, g] = N("modal-form"), [x, b] = N("submit"), [y, v] = N({}), [T, k] = N(null), [w, j] = N(null), [D, M] = N(null), O = ({ modalData: J, component: z, title: rt = "", onConfirm: H = null, type: Y = "submit", formId: ot = "modal-form", item: nt = null, style: yt }) => {
|
|
8442
|
+
const [e, n] = N(!1), [i, s] = N(null), [o, r] = N(""), [a, l] = N(null), [c, u] = N(null), [d, f] = N(null), [p, g] = N("modal-form"), [x, b] = N("submit"), [y, v] = N({}), [T, k] = N(null), [w, j] = N(null), [D, M] = N(null), O = ({ modalData: J = {}, component: z = null, title: rt = "", onConfirm: H = null, type: Y = "submit", formId: ot = "modal-form", item: nt = null, style: yt = {} } = {}) => {
|
|
8443
8443
|
k(J), s(() => z), r(rt), l(() => H), b(Y), g(ot), f(nt), v(yt), n(!0);
|
|
8444
8444
|
}, B = () => {
|
|
8445
8445
|
s(null), r(""), l(null), b("submit"), g("modal-form"), f(null), v({}), n(!1), k(null);
|