@atlashub/smartstack 3.9.0 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/{AuthCallbackPage-CbkCo5cL.cjs → AuthCallbackPage-Bv2Cyn80.cjs} +2 -2
  2. package/dist/{AuthCallbackPage-CbkCo5cL.cjs.map → AuthCallbackPage-Bv2Cyn80.cjs.map} +1 -1
  3. package/dist/{AuthCallbackPage-UbzOvvaa.js → AuthCallbackPage-Cu74zAX1.js} +2 -2
  4. package/dist/{AuthCallbackPage-UbzOvvaa.js.map → AuthCallbackPage-Cu74zAX1.js.map} +1 -1
  5. package/dist/{ConfirmEmailPage-Cui47UrD.js → ConfirmEmailPage-BTp8J0pw.js} +2 -2
  6. package/dist/{ConfirmEmailPage-Cui47UrD.js.map → ConfirmEmailPage-BTp8J0pw.js.map} +1 -1
  7. package/dist/{ConfirmEmailPage-BkCDKBy0.cjs → ConfirmEmailPage-su3Fvl0e.cjs} +2 -2
  8. package/dist/{ConfirmEmailPage-BkCDKBy0.cjs.map → ConfirmEmailPage-su3Fvl0e.cjs.map} +1 -1
  9. package/dist/{ForceChangePasswordPage-ov-jJgku.js → ForceChangePasswordPage-ClENqzCH.js} +2 -2
  10. package/dist/{ForceChangePasswordPage-ov-jJgku.js.map → ForceChangePasswordPage-ClENqzCH.js.map} +1 -1
  11. package/dist/{ForceChangePasswordPage-3ozgKLOY.cjs → ForceChangePasswordPage-kEFsb5Aq.cjs} +2 -2
  12. package/dist/{ForceChangePasswordPage-3ozgKLOY.cjs.map → ForceChangePasswordPage-kEFsb5Aq.cjs.map} +1 -1
  13. package/dist/{ForgotPasswordPage-DkrQI8cO.cjs → ForgotPasswordPage--Wl0Vxbv.cjs} +2 -2
  14. package/dist/{ForgotPasswordPage-DkrQI8cO.cjs.map → ForgotPasswordPage--Wl0Vxbv.cjs.map} +1 -1
  15. package/dist/{ForgotPasswordPage-CNyDYEfP.js → ForgotPasswordPage-BEgvV5f-.js} +2 -2
  16. package/dist/{ForgotPasswordPage-CNyDYEfP.js.map → ForgotPasswordPage-BEgvV5f-.js.map} +1 -1
  17. package/dist/{OnboardingWizardPage-DNoe1_iv.js → OnboardingWizardPage-Bx1UlTbr.js} +2 -2
  18. package/dist/{OnboardingWizardPage-DNoe1_iv.js.map → OnboardingWizardPage-Bx1UlTbr.js.map} +1 -1
  19. package/dist/{OnboardingWizardPage-BWMGYiu9.cjs → OnboardingWizardPage-C7vendrq.cjs} +2 -2
  20. package/dist/{OnboardingWizardPage-BWMGYiu9.cjs.map → OnboardingWizardPage-C7vendrq.cjs.map} +1 -1
  21. package/dist/{RegisterPage-DUGhJPnX.js → RegisterPage-BzV0sCTe.js} +2 -2
  22. package/dist/{RegisterPage-DUGhJPnX.js.map → RegisterPage-BzV0sCTe.js.map} +1 -1
  23. package/dist/{RegisterPage--lihqFk7.cjs → RegisterPage-DKr8quRk.cjs} +2 -2
  24. package/dist/{RegisterPage--lihqFk7.cjs.map → RegisterPage-DKr8quRk.cjs.map} +1 -1
  25. package/dist/{ResetPasswordPage-BxZb9y8W.js → ResetPasswordPage-DphmJrcJ.js} +2 -2
  26. package/dist/{ResetPasswordPage-BxZb9y8W.js.map → ResetPasswordPage-DphmJrcJ.js.map} +1 -1
  27. package/dist/{ResetPasswordPage-BpVqJA06.cjs → ResetPasswordPage-x4do1o-j.cjs} +2 -2
  28. package/dist/{ResetPasswordPage-BpVqJA06.cjs.map → ResetPasswordPage-x4do1o-j.cjs.map} +1 -1
  29. package/dist/{index-C2c3iEpN.js → index-0Jhdcj59.js} +3 -3
  30. package/dist/index-0Jhdcj59.js.map +1 -0
  31. package/dist/{index-CHdBJkh4.cjs → index-C6C5XmVj.cjs} +3 -3
  32. package/dist/index-C6C5XmVj.cjs.map +1 -0
  33. package/dist/smartstack.cjs +1 -1
  34. package/dist/smartstack.js +1 -1
  35. package/package.json +1 -1
  36. package/dist/index-C2c3iEpN.js.map +0 -1
  37. package/dist/index-CHdBJkh4.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("react/jsx-runtime"),n=require("react"),ns=require("axios"),ne=require("react-i18next"),jt=require("i18next"),Da=require("i18next-browser-languagedetector"),N=require("react-router-dom"),Ma=require("@microsoft/signalr"),l=require("lucide-react"),nr=require("react-error-boundary"),$t=require("react-dom"),js=require("modern-screenshot"),gt=require("react-resizable-panels"),Fa=require("dompurify");function or(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,a.get?a:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const ie=or(Ma),xt=or(l),Je={none:"0px",small:"4px",medium:"8px",large:"12px",xlarge:"16px",xxlarge:"24px"},Oa={none:"Carré",small:"Léger",medium:"Moyen",large:"Arrondi",xlarge:"Très arrondi",xxlarge:"Pill"},Ue={slate:{name:"Ardoise",shades:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"}},gray:{name:"Gris",shades:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"}},zinc:{name:"Zinc",shades:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"}},stone:{name:"Pierre",shades:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"}},indigo:{name:"Indigo",shades:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"}},violet:{name:"Violet",shades:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"}},blue:{name:"Bleu",shades:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"}},cyan:{name:"Cyan",shades:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"}},teal:{name:"Teal",shades:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"}},emerald:{name:"Émeraude",shades:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"}},amber:{name:"Ambre",shades:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"}},orange:{name:"Orange",shades:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"}},rose:{name:"Rose",shades:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}},pink:{name:"Pink",shades:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"}}},Ua={card:"large",button:"medium",badge:"medium",input:"medium",modal:"xlarge",menuItem:"medium"},dt={neutral:{name:"Neutre",icon:"⚪",colors:{light:{light:"#ffffff",medium:"#f4f4f5",dark:"#e4e4e7",border:"#d4d4d8"},dark:{light:"#1c1c1f",medium:"#27272a",dark:"#3f3f46",border:"#52525b"}}},ocean:{name:"Océan",icon:"🌊",colors:{light:{light:"#e0f2fe",medium:"#bae6fd",dark:"#7dd3fc",border:"#93c5fd"},dark:{light:"#141c24",medium:"#1a2836",dark:"#2a4a5e",border:"#3a5a70"}}},forest:{name:"Forêt",icon:"🌲",colors:{light:{light:"#d1fae5",medium:"#a7f3d0",dark:"#6ee7b7",border:"#86efac"},dark:{light:"#121d18",medium:"#182a22",dark:"#2a4a3a",border:"#3a5a4a"}}},sunset:{name:"Coucher de soleil",icon:"🌅",colors:{light:{light:"#fef3c7",medium:"#fde68a",dark:"#fbbf24",border:"#fcd34d"},dark:{light:"#1c1810",medium:"#2a2418",dark:"#4a3a24",border:"#5a4a34"}}},lavender:{name:"Lavande",icon:"💜",colors:{light:{light:"#ede9fe",medium:"#ddd6fe",dark:"#c4b5fd",border:"#c4b5fd"},dark:{light:"#1a1820",medium:"#24222e",dark:"#3a3650",border:"#4a4660"}}},rose:{name:"Rose",icon:"🌸",colors:{light:{light:"#fce7f3",medium:"#fbcfe8",dark:"#f9a8d4",border:"#f9a8d4"},dark:{light:"#1c1418",medium:"#2a1e24",dark:"#4a3040",border:"#5a4050"}}}},os="neutral",ut=t=>{const s=Ue[t]?.shades||Ue.indigo.shades;return{name:"Clair",primary:Ue.indigo.shades,accent:s,backgrounds:{app:"#fafafa",primary:"#ffffff",secondary:"#f4f4f5",tertiary:"#e4e4e7",card:"#ffffff",hover:"#f4f4f5",active:"#e4e4e7"},text:{primary:"#18181b",secondary:"#52525b",tertiary:"#71717a",muted:"#a1a1aa",inverse:"#fafafa"},border:{default:"#e4e4e7",subtle:"#f4f4f5",strong:"#d4d4d8"},status:{success:{bg:"#f0fdfa",text:"#0f766e",border:"#99f6e4",dot:"#14b8a6"},warning:{bg:"#fffbeb",text:"#b45309",border:"#fde68a",dot:"#f59e0b"},error:{bg:"#fff1f2",text:"#be123c",border:"#fecdd3",dot:"#f43f5e"},info:{bg:"#f0f9ff",text:"#0369a1",border:"#bae6fd",dot:"#0ea5e9"}},accentTransparent:{bg:`${s[50]}`,text:s[700],border:s[200]}}},mt=t=>{const s=Ue[t]?.shades||Ue.indigo.shades;return{name:"Sombre",primary:Ue.indigo.shades,accent:s,backgrounds:{app:"#161618",primary:"#1c1c1f",secondary:"#232326",tertiary:"#2a2a2e",card:"#1c1c1f",hover:"#27272a",active:"#3f3f46"},text:{primary:"#fafafa",secondary:"#d4d4d8",tertiary:"#a1a1aa",muted:"#71717a",inverse:"#18181b"},border:{default:"#3f3f46",subtle:"#27272a",strong:"#52525b"},status:{success:{bg:"rgba(20, 184, 166, 0.15)",text:"#5eead4",border:"rgba(20, 184, 166, 0.3)",dot:"#14b8a6"},warning:{bg:"rgba(245, 158, 11, 0.15)",text:"#fbbf24",border:"rgba(245, 158, 11, 0.3)",dot:"#f59e0b"},error:{bg:"rgba(244, 63, 94, 0.15)",text:"#fb7185",border:"rgba(244, 63, 94, 0.3)",dot:"#f43f5e"},info:{bg:"rgba(14, 165, 233, 0.15)",text:"#7dd3fc",border:"rgba(14, 165, 233, 0.3)",dot:"#0ea5e9"}},accentTransparent:{bg:`rgba(${ws(s[500])}, 0.15)`,text:s[300],border:`rgba(${ws(s[500])}, 0.3)`}}};function ws(t){const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return s?`${parseInt(s[1],16)}, ${parseInt(s[2],16)}, ${parseInt(s[3],16)}`:"99, 102, 241"}const yt={mode:"dark",borderRadius:Ua,colors:{light:ut("indigo"),dark:mt("indigo")},accentColorKey:"indigo",itemPaletteKey:os},Ba=[{id:"default",name:"Par défaut",description:"Style SmartStack classique avec coins arrondis",icon:"✨",config:{borderRadius:{card:"large",button:"medium",badge:"medium",input:"medium",modal:"xlarge",menuItem:"medium"},accentColorKey:"indigo",itemPaletteKey:"neutral"}},{id:"minimal",name:"Minimal",description:"Style épuré et professionnel",icon:"⚪",config:{borderRadius:{card:"medium",button:"small",badge:"small",input:"small",modal:"medium",menuItem:"small"},accentColorKey:"slate",itemPaletteKey:"neutral"}},{id:"corporate",name:"Corporate",description:"Style sobre pour environnement professionnel",icon:"🏢",config:{borderRadius:{card:"small",button:"small",badge:"medium",input:"small",modal:"medium",menuItem:"small"},accentColorKey:"gray",itemPaletteKey:"neutral"}},{id:"ocean",name:"Océan",description:"Teintes bleues apaisantes",icon:"🌊",config:{borderRadius:{card:"large",button:"medium",badge:"medium",input:"medium",modal:"xlarge",menuItem:"medium"},accentColorKey:"cyan",itemPaletteKey:"ocean"}},{id:"forest",name:"Forêt",description:"Tons verts naturels",icon:"🌲",config:{borderRadius:{card:"medium",button:"medium",badge:"medium",input:"medium",modal:"large",menuItem:"medium"},accentColorKey:"emerald",itemPaletteKey:"forest"}},{id:"sunset",name:"Coucher de soleil",description:"Couleurs chaudes et accueillantes",icon:"🌅",config:{borderRadius:{card:"large",button:"large",badge:"xxlarge",input:"medium",modal:"xlarge",menuItem:"medium"},accentColorKey:"orange",itemPaletteKey:"sunset"}},{id:"lavender",name:"Lavande",description:"Tons violets élégants",icon:"💜",config:{borderRadius:{card:"xlarge",button:"large",badge:"xlarge",input:"large",modal:"xlarge",menuItem:"large"},accentColorKey:"violet",itemPaletteKey:"lavender"}},{id:"rose",name:"Rose",description:"Teintes roses douces",icon:"🌸",config:{borderRadius:{card:"xxlarge",button:"xlarge",badge:"xxlarge",input:"large",modal:"xxlarge",menuItem:"large"},accentColorKey:"pink",itemPaletteKey:"rose"}}],ir="smartstack-theme-config";class kt extends Error{statusCode;details;constructor(s,r,a){super(s),this.name="AppError",this.statusCode=r,this.details=a}}class is extends Error{constructor(s="Network error occurred"){super(s),this.name="NetworkError"}}class lr extends Error{code;constructor(s="Authentication required",r){super(s),this.name="AuthenticationError",this.code=r}}class _a extends Error{constructor(s="Access denied"){super(s),this.name="ForbiddenError"}}const qa=10;class za{queue=[];recentErrors=[];isProcessing=!1;batchSize=10;batchDelay=2e3;async logError(s,r,a){const o=typeof s=="string"?s:s.message;let c=o;if(a?.url){const d=String(a.url),u=a.status?` [${a.status}]`:"";c=`${o}${u} - ${d}`}const i={message:c,stack:typeof s=="string"?void 0:s.stack,url:window.location.href,component:r,level:"Error",metadata:a};this.storeRecentError(i),this.queue.push({type:"error",data:i}),this.processQueue()}async logCritical(s,r,a){const o=typeof s=="string"?s:s.message;let c=o;if(a?.url){const u=String(a.url),x=a.status?` [${a.status}]`:"";c=`${o}${x} - ${u}`}const i={message:c,stack:typeof s=="string"?void 0:s.stack,url:window.location.href,component:r,level:"Critical",metadata:a};return this.storeRecentError(i),await this.sendErrorWithResponse(i)}getRecentErrors(){return[...this.recentErrors]}clearRecentErrors(){this.recentErrors=[]}storeRecentError(s){this.recentErrors.unshift({...s,timestamp:new Date}),this.recentErrors.length>qa&&this.recentErrors.pop()}async logEvent(s,r,a){const o={event:s,category:r,data:a};this.queue.push({type:"event",data:o}),this.processQueue()}async processQueue(){if(this.isProcessing||this.queue.length===0)return;this.isProcessing=!0,await new Promise(r=>setTimeout(r,this.batchDelay));const s=this.queue.splice(0,this.batchSize);for(const r of s)try{r.type==="error"?await this.sendError(r.data):await this.sendEvent(r.data)}catch{}this.isProcessing=!1,this.queue.length>0&&this.processQueue()}async sendError(s){const r=localStorage.getItem("token");await fetch("/api/logs/client-error",{method:"POST",headers:{"Content-Type":"application/json",...r&&{Authorization:`Bearer ${r}`}},body:JSON.stringify(s)})}async sendErrorWithResponse(s){const r=localStorage.getItem("token");try{const a=await fetch("/api/logs/client-error",{method:"POST",headers:{"Content-Type":"application/json",...r&&{Authorization:`Bearer ${r}`}},body:JSON.stringify(s)});return a.ok&&a.status===200&&(await a.json()).ticketNumber||null}catch{return null}}async sendEvent(s){const r=localStorage.getItem("token");await fetch("/api/logs/client-event",{method:"POST",headers:{"Content-Type":"application/json",...r&&{Authorization:`Bearer ${r}`}},body:JSON.stringify(s)})}}const Pe=new za;window.onerror=(t,s,r,a,o)=>{Pe.logError(o||String(t),"window.onerror",{source:s,lineno:r,colno:a})};window.onunhandledrejection=t=>{Pe.logError(t.reason instanceof Error?t.reason:String(t.reason),"unhandledrejection")};const Ie=ns.create({timeout:3e4,headers:{"Content-Type":"application/json"}});Ie.interceptors.request.use(t=>{const s=localStorage.getItem("token");s&&t.headers&&(t.headers.Authorization=`Bearer ${s}`);const r=crypto.randomUUID();t.headers&&(t.headers["X-Correlation-ID"]=r);const a=localStorage.getItem("i18nextLng")||navigator.language||"fr";t.headers&&(t.headers["Accept-Language"]=a);const o=localStorage.getItem("currentTenantSlug");return o&&t.headers&&!t.headers["X-Tenant-Slug"]&&(t.headers["X-Tenant-Slug"]=o),t},t=>(Pe.logError(t,"apiClient.request"),Promise.reject(t)));Ie.interceptors.response.use(t=>t,async t=>{const s=t.config?.headers?.["X-Correlation-ID"];if(ns.isCancel(t)||t.code==="ERR_CANCELED")return Promise.reject(t);if(!t.response){const i=new is("Impossible de se connecter au serveur. Vérifiez votre connexion internet.");return Pe.logError(i,"apiClient.response",{correlationId:s}),Promise.reject(i)}const{status:r,data:a}=t.response,o=a?.message||a?.detail||a?.title||t.message,c=a?.code;switch(r){case 401:{const i=new lr(o,c);Pe.logError(i,"apiClient.response",{correlationId:s,url:t.config?.url,code:c});const d=t.config?.url||"",x=["/api/user/preferences","/api/auth/session-info","/api/auth/refresh","/api/navigation/menu","/api/navigation/favorites","/api/navigation/contexts","/api/onboarding/status","/api/administration/tenants/tenant-analytics/track/"].some(m=>d.startsWith(m));if(!window.location.pathname.includes("/login")&&!x){localStorage.removeItem("token"),localStorage.removeItem("refreshToken"),localStorage.removeItem("user");const f=c==="SESSION_EXPIRED"?"/login?reason=session_expired":"/login";window.location.href=f}return Promise.reject(i)}case 403:{const i=new _a(o),d=["/api/administration/tenants/tenant-analytics/track/","/api/support/notifications"],u=t.config?.url||"";return d.some(m=>u.startsWith(m))||Pe.logError(i,"apiClient.response",{correlationId:s,url:t.config?.url,method:t.config?.method}),Promise.reject(i)}case 404:return Promise.reject(new kt(o||"Resource not found",r));case 400:return Promise.reject(new kt(o||"Invalid request",r,a?.details||a?.errors));case 500:case 502:case 503:case 504:{const i=new kt(o||"Server error",r);return Pe.logCritical(i,"apiClient.response",{correlationId:s,url:t.config?.url,status:r}),Promise.reject(i)}default:{const i=new kt(o,r,a?.details);return Pe.logError(i,"apiClient.response",{correlationId:s,status:r}),Promise.reject(i)}}});const D={get:(t,s)=>Ie.get(t,s).then(r=>r.data),post:(t,s,r)=>Ie.post(t,s,r).then(a=>a.data),put:(t,s,r)=>Ie.put(t,s,r).then(a=>a.data),patch:(t,s,r)=>Ie.patch(t,s,r).then(a=>a.data),delete:(t,s)=>Ie.delete(t,s).then(r=>r.data)},It={preferences:{get:()=>D.get("/api/user/preferences"),updateTheme:t=>D.put("/api/user/preferences/theme",t),updateLanguage:t=>D.put("/api/user/preferences/language",t),updateNotifications:t=>D.put("/api/user/preferences/notifications",t)},dashboard:{getAll:(t=30,s=10)=>D.get(`/api/user/dashboard/all?period=${t}&errorLimit=${s}`),getSessionAnalytics:(t=30)=>D.get(`/api/user/dashboard/session-analytics?period=${t}`),getLoginErrors:(t=10)=>D.get(`/api/user/dashboard/login-errors?limit=${t}`),getCurrentSession:()=>D.get("/api/user/dashboard/current-session"),getDeviceStats:()=>D.get("/api/user/dashboard/device-stats"),getWeeklyStats:(t=30)=>D.get(`/api/user/dashboard/weekly-stats?period=${t}`),getHourlyStats:(t=30)=>D.get(`/api/user/dashboard/hourly-stats?period=${t}`),getApplicationUsage:(t=30)=>D.get(`/api/user/dashboard/application-usage?period=${t}`)}},Ga=t=>({getAll:s=>t.get("/api/administration/users",{params:s}),getById:s=>t.get(`/api/administration/users/${s}`),create:s=>t.post("/api/administration/users",s),update:(s,r)=>t.put(`/api/administration/users/${s}`,r),sendPasswordResetLink:s=>t.post(`/api/administration/users/${s}/send-password-reset`),resetPasswordDirect:(s,r)=>t.post(`/api/administration/users/${s}/reset-password-direct`,r?{temporaryPassword:r}:{}),activate:s=>t.patch(`/api/administration/users/${s}/activate`),deactivate:s=>t.patch(`/api/administration/users/${s}/deactivate`),unlock:(s,r)=>t.post(`/api/administration/users/${s}/unlock`,r),clearFailedAttempts:s=>t.post(`/api/administration/users/${s}/clear-failed-attempts`),delete:s=>t.delete(`/api/administration/users/${s}`),getSessions:s=>t.get(`/api/administration/users/${s}/sessions`),endAllSessions:s=>t.post(`/api/administration/users/${s}/sessions/end-all`),endSession:(s,r)=>t.delete(`/api/administration/users/${s}/sessions/${r}`),getActivity:s=>t.get(`/api/administration/users/${s}/activity`),getCustomRole:s=>t.get(`/api/administration/users/${s}/custom-role`),createCustomRole:s=>t.post(`/api/administration/users/${s}/custom-role`),deleteCustomRole:s=>t.delete(`/api/administration/users/${s}/custom-role`),getHistory:(s,r=50)=>t.get(`/api/administration/users/${s}/history`,{params:{limit:r}}),restoreFromHistory:(s,r)=>t.post(`/api/administration/users/${s}/history/${r}/restore`),getOrganizationReferences:()=>t.get("/api/administration/users/organization-references"),references:{getCompanies:s=>t.get("/api/administration/users/references/companies",{params:s}),getDepartments:s=>t.get("/api/administration/users/references/departments",{params:s}),getJobTitles:s=>t.get("/api/administration/users/references/job-titles",{params:s}),getOffices:s=>t.get("/api/administration/users/references/offices",{params:s}),createCompany:(s,r)=>t.post(`/api/administration/users/references/companies${r?`?tenantId=${r}`:""}`,s),createDepartment:(s,r)=>t.post(`/api/administration/users/references/departments${r?`?tenantId=${r}`:""}`,s),createJobTitle:(s,r)=>t.post(`/api/administration/users/references/job-titles${r?`?tenantId=${r}`:""}`,s),createOffice:(s,r)=>t.post(`/api/administration/users/references/offices${r?`?tenantId=${r}`:""}`,s),updateCompany:(s,r)=>t.put(`/api/administration/users/references/companies/${s}`,r),updateDepartment:(s,r)=>t.put(`/api/administration/users/references/departments/${s}`,r),updateJobTitle:(s,r)=>t.put(`/api/administration/users/references/job-titles/${s}`,r),updateOffice:(s,r)=>t.put(`/api/administration/users/references/offices/${s}`,r),activateCompany:s=>t.patch(`/api/administration/users/references/companies/${s}/activate`),activateDepartment:s=>t.patch(`/api/administration/users/references/departments/${s}/activate`),activateJobTitle:s=>t.patch(`/api/administration/users/references/job-titles/${s}/activate`),activateOffice:s=>t.patch(`/api/administration/users/references/offices/${s}/activate`),deactivateCompany:s=>t.patch(`/api/administration/users/references/companies/${s}/deactivate`),deactivateDepartment:s=>t.patch(`/api/administration/users/references/departments/${s}/deactivate`),deactivateJobTitle:s=>t.patch(`/api/administration/users/references/job-titles/${s}/deactivate`),deactivateOffice:s=>t.patch(`/api/administration/users/references/offices/${s}/deactivate`),deleteCompany:s=>t.delete(`/api/administration/users/references/companies/${s}`),deleteDepartment:s=>t.delete(`/api/administration/users/references/departments/${s}`),deleteJobTitle:s=>t.delete(`/api/administration/users/references/job-titles/${s}`),deleteOffice:s=>t.delete(`/api/administration/users/references/offices/${s}`)},updateProfile:(s,r)=>t.put(`/api/administration/users/${s}/profile`,r),updateOrganization:(s,r)=>t.put(`/api/administration/users/${s}/organization`,r),updateJobInfo:(s,r)=>t.put(`/api/administration/users/${s}/job-info`,r),updatePhones:(s,r)=>t.put(`/api/administration/users/${s}/phones`,r),updateAddress:(s,r)=>t.put(`/api/administration/users/${s}/address`,r),updateContact:(s,r)=>t.put(`/api/administration/users/${s}/contact`,r),getTenants:s=>t.get(`/api/administration/users/${s}/tenants`),getGroups:s=>t.get(`/api/administration/users/${s}/groups`),getConsolidatedRoles:(s,r)=>{const a=r?`/api/administration/users/${s}/consolidated-roles?tenantId=${r}`:`/api/administration/users/${s}/consolidated-roles`;return t.get(a)},getApplicationAccess:(s,r)=>{const a=r?`/api/administration/users/${s}/application-access?tenantId=${r}`:`/api/administration/users/${s}/application-access`;return t.get(a)}}),Ka=t=>({getAll:s=>t.get("/api/administration/permissions/roles",{params:s}),getAssignable:()=>t.get("/api/administration/permissions/roles",{params:{excludeCategories:"Custom",minPermissionsCount:1}}),getServiceAssignable:()=>t.get("/api/administration/permissions/roles",{params:{forExternalApps:!0,minPermissionsCount:1}}),getByApplication:s=>t.get("/api/administration/permissions/roles",{params:{applicationId:s,excludeCategories:"Custom",minPermissionsCount:1}}),getById:s=>t.get(`/api/administration/permissions/roles/${s}`),create:s=>t.post("/api/administration/permissions/roles",s),update:(s,r)=>t.put(`/api/administration/permissions/roles/${s}`,r),delete:s=>t.delete(`/api/administration/permissions/roles/${s}`),assignUser:(s,r)=>t.post(`/api/administration/permissions/roles/${s}/users/${r}`),removeUser:(s,r)=>t.delete(`/api/administration/permissions/roles/${s}/users/${r}`),getGroups:s=>t.get(`/api/administration/permissions/roles/${s}/groups`),assignGroup:(s,r)=>t.post(`/api/administration/permissions/roles/${s}/groups/${r}`),removeGroup:(s,r)=>t.delete(`/api/administration/permissions/roles/${s}/groups/${r}`),getTranslations:s=>t.get(`/api/administration/permissions/roles/${s}/translations`),upsertTranslation:(s,r,a)=>t.put(`/api/administration/permissions/roles/${s}/translations/${r}`,a),deleteTranslation:(s,r)=>t.delete(`/api/administration/permissions/roles/${s}/translations/${r}`)}),Ha=t=>({getAll:s=>t.get("/api/administration/permissions",{params:s}),getById:s=>t.get(`/api/administration/permissions/${s}`),getTree:()=>t.get("/api/administration/permissions/tree"),getMatrix:()=>t.get("/api/administration/permissions/matrix"),delete:s=>t.delete(`/api/administration/permissions/${s}`)}),Va=t=>({getAll:s=>t.get("/api/administration/applications",{params:s}),getById:s=>t.get(`/api/administration/applications/${s}`),update:(s,r)=>t.put(`/api/administration/applications/${s}`,r),activate:s=>t.patch(`/api/administration/applications/${s}/activate`),deactivate:s=>t.patch(`/api/administration/applications/${s}/deactivate`),getModules:s=>t.get(`/api/administration/applications/${s}/modules`),updateModule:(s,r,a)=>t.put(`/api/administration/applications/${s}/modules/${r}`,a),getModuleSections:(s,r)=>t.get(`/api/administration/applications/${s}/modules/${r}/sections`),reorderModules:(s,r)=>t.put(`/api/administration/applications/${s}/modules/reorder`,{items:r}),reorderSections:(s,r,a)=>t.put(`/api/administration/applications/${s}/modules/${r}/sections/reorder`,{items:a}),getTenants:s=>t.get(`/api/administration/applications/${s}/tenants`),getAvailableTenants:s=>t.get(`/api/administration/applications/${s}/tenants/available`),assignToTenant:(s,r,a)=>t.post(`/api/administration/applications/${s}/tenants/${r}`,a?{accessLevel:a}:{}),removeFromTenant:(s,r)=>t.delete(`/api/administration/applications/${s}/tenants/${r}`),updateTenantAccessLevel:(s,r,a)=>t.patch(`/api/administration/applications/${s}/tenants/${r}/access-level`,{accessLevel:a}),bulkAssignTenants:(s,r)=>t.post(`/api/administration/applications/${s}/tenants/bulk`,r)}),Wa=t=>({getOverview:(s=30,r)=>t.get("/api/administration/users/dashboard/overview",{params:{days:s},signal:r?.signal}),getByStatus:s=>t.get("/api/administration/users/dashboard/by-status",{signal:s?.signal}),getByRole:s=>t.get("/api/administration/users/dashboard/by-role",{signal:s?.signal}),getByType:s=>t.get("/api/administration/users/dashboard/by-type",{signal:s?.signal}),getLoginActivity:(s=30,r)=>t.get("/api/administration/users/dashboard/login-activity",{params:{days:s},signal:r?.signal}),getTrends:(s=30,r)=>t.get("/api/administration/users/dashboard/trends",{params:{days:s},signal:r?.signal}),getRecentUsers:(s=10,r)=>t.get("/api/administration/users/dashboard/recent-users",{params:{limit:s},signal:r?.signal}),getSecurityAlerts:(s=3,r=24,a)=>t.get("/api/administration/users/dashboard/security-alerts",{params:{threshold:s,hours:r},signal:a?.signal}),getActiveSessions:s=>t.get("/api/administration/users/dashboard/active-sessions",{signal:s?.signal}),getLatestActiveSessions:(s=5,r)=>t.get("/api/administration/users/dashboard/latest-active-sessions",{params:{limit:s},signal:r?.signal})}),Xa=t=>({getAll:()=>t.get("/api/administration/configuration/settings"),getByCategory:s=>t.get(`/api/administration/configuration/settings/${s}`),get:(s,r)=>t.get(`/api/administration/configuration/settings/${s}/${r}`),update:(s,r,a)=>t.put(`/api/administration/configuration/settings/${s}/${r}`,{value:a}),reset:(s,r)=>t.post(`/api/administration/configuration/settings/${s}/${r}/reset`),getHistory:(s,r)=>t.get(`/api/administration/configuration/settings/${s}/${r}/history`),getCategories:()=>t.get("/api/administration/configuration/settings/categories")}),Ya=t=>({get:()=>t.get("/api/user/preferences"),getGlobal:()=>t.get("/api/user/preferences/global"),getForTenant:s=>t.get(`/api/user/preferences/for-tenant/${s}`),getThemeOverrides:()=>t.get("/api/user/preferences/theme-overrides"),deleteTenantOverride:()=>t.delete("/api/user/preferences/tenant-override"),applyToTenant:()=>t.post("/api/user/preferences/apply-to-tenant")}),Ja=t=>({getConfig:()=>t.get("/api/administration/tenants/config"),getAll:s=>{const{excludeTypes:r,...a}=s||{},o=new URLSearchParams;a.page&&o.set("page",String(a.page)),a.pageSize&&o.set("pageSize",String(a.pageSize)),a.search&&o.set("search",a.search),a.status&&o.set("status",a.status),a.type&&o.set("type",a.type),a.sortBy&&o.set("sortBy",a.sortBy),a.sortDesc&&o.set("sortDesc","true"),r?.length&&r.forEach(i=>o.append("excludeTypes",i));const c=o.toString();return t.get(`/api/administration/tenants${c?`?${c}`:""}`)},getById:s=>t.get(`/api/administration/tenants/${s}`),createB2C:s=>t.post("/api/administration/tenants/b2c",s),createB2B:s=>t.post("/api/administration/tenants/b2b",s),update:(s,r)=>t.put(`/api/administration/tenants/${s}`,r),delete:s=>t.delete(`/api/administration/tenants/${s}`),activate:s=>t.post(`/api/administration/tenants/${s}/activate`),suspend:s=>t.post(`/api/administration/tenants/${s}/suspend`),archive:s=>t.delete(`/api/administration/tenants/${s}`),checkSlugAvailable:s=>t.get(`/api/administration/tenants/check-slug/${s}`),assignTemplate:(s,r)=>t.post(`/api/administration/tenants/${s}/template`,{templateId:r}),removeTemplate:s=>t.delete(`/api/administration/tenants/${s}/template`),getMembers:s=>t.get(`/api/administration/tenants/${s}/members`),getMember:(s,r)=>t.get(`/api/administration/tenants/${s}/members/${r}`),addMember:(s,r)=>t.post(`/api/administration/tenants/${s}/members`,r),removeMember:(s,r)=>t.delete(`/api/administration/tenants/${s}/members/${r}`),setMemberDefault:(s,r)=>t.patch(`/api/administration/tenants/${s}/members/${r}/set-default`),transferOwnership:(s,r)=>t.post(`/api/administration/tenants/${s}/members/transfer-ownership`,{toUserId:r}),assignRole:(s,r,a)=>t.post(`/api/administration/tenants/${s}/members/${r}/roles/${a}`),removeRole:(s,r,a)=>t.delete(`/api/administration/tenants/${s}/members/${r}/roles/${a}`),assignMemberRoles:(s,r,a)=>t.put(`/api/administration/tenants/${s}/members/${r}/roles`,{roleIds:a}),getMemberCustomRole:(s,r)=>t.get(`/api/administration/tenants/${s}/members/${r}/custom-role`),createMemberCustomRole:(s,r)=>t.post(`/api/administration/tenants/${s}/members/${r}/custom-role`),deleteMemberCustomRole:(s,r)=>t.delete(`/api/administration/tenants/${s}/members/${r}/custom-role`),getTenantRoles:s=>t.get(`/api/administration/tenants/${s}/roles`),getGroups:s=>t.get(`/api/administration/tenants/${s}/groups`),getAvailableGroups:s=>t.get(`/api/administration/tenants/${s}/groups/available`),addGroupToTenant:(s,r)=>t.post(`/api/administration/tenants/${s}/groups`,{groupId:r}),removeGroupFromTenant:(s,r)=>t.delete(`/api/administration/tenants/${s}/groups/${r}`),getApplications:s=>t.get(`/api/administration/tenants/${s}/applications`),getAvailableApplications:s=>t.get(`/api/administration/tenants/${s}/applications/available`),assignApplication:(s,r)=>t.post(`/api/administration/tenants/${s}/applications/${r}`),removeApplication:(s,r)=>t.delete(`/api/administration/tenants/${s}/applications/${r}`),bulkAssignApplications:(s,r)=>t.post(`/api/administration/tenants/${s}/applications/bulk`,r),toggleApplication:(s,r,a)=>t.patch(`/api/administration/tenants/${s}/applications/${r}/toggle`,{isActive:a}),updateApplicationAccessLevel:(s,r,a)=>t.patch(`/api/administration/tenants/${s}/applications/${r}/access-level`,{accessLevel:a}),getEffectiveTree:(s,r)=>t.get(`/api/administration/tenants/${s}/applications/${r}/effective-tree`),saveOverrides:(s,r,a)=>t.put(`/api/administration/tenants/${s}/applications/${r}/overrides`,a),getModules:s=>t.get(`/api/administration/tenants/${s}/modules`),getAvailableModules:s=>t.get(`/api/administration/tenants/${s}/modules/available`),assignModule:(s,r)=>t.post(`/api/administration/tenants/${s}/modules/${r}`),removeModule:(s,r)=>t.delete(`/api/administration/tenants/${s}/modules/${r}`),toggleModule:(s,r,a)=>t.patch(`/api/administration/tenants/${s}/modules/${r}/toggle`,{isActive:a}),getSections:s=>t.get(`/api/administration/tenants/${s}/sections`),getAvailableSections:s=>t.get(`/api/administration/tenants/${s}/sections/available`),assignSection:(s,r)=>t.post(`/api/administration/tenants/${s}/sections/${r}`),removeSection:(s,r)=>t.delete(`/api/administration/tenants/${s}/sections/${r}`),toggleSection:(s,r,a)=>t.patch(`/api/administration/tenants/${s}/sections/${r}/toggle`,{isActive:a}),getModulesWithSections:(s,r)=>t.get(`/api/administration/tenants/${s}/applications/${r}/modules-tree`),linkOrganisation:(s,r)=>t.post(`/api/administration/tenants/${s}/organisation`,{organisationId:r}),unlinkOrganisation:s=>t.delete(`/api/administration/tenants/${s}/organisation`)}),Qa=t=>({getAll:()=>t.get("/api/administration/tenants/templates"),getById:s=>t.get(`/api/administration/tenants/templates/${s}`),create:s=>t.post("/api/administration/tenants/templates",s),update:(s,r)=>t.put(`/api/administration/tenants/templates/${s}`,r),delete:s=>t.delete(`/api/administration/tenants/templates/${s}`),assignApplication:(s,r)=>t.post(`/api/administration/tenants/templates/${s}/applications/${r}`),removeApplication:(s,r)=>t.delete(`/api/administration/tenants/templates/${s}/applications/${r}`),bulkAssignApplications:(s,r)=>t.post(`/api/administration/tenants/templates/${s}/applications/bulk`,r),getTenants:s=>t.get(`/api/administration/tenants/templates/${s}/tenants`),getApplications:s=>t.get(`/api/administration/tenants/templates/${s}/applications`),getAvailableApplications:s=>t.get(`/api/administration/tenants/templates/${s}/applications/available`),updateApplicationAccessLevel:(s,r,a)=>t.patch(`/api/administration/tenants/templates/${s}/applications/${r}/access-level`,{accessLevel:a}),getApplicationModules:(s,r)=>t.get(`/api/administration/tenants/templates/${s}/applications/${r}/modules`),updateApplicationModules:(s,r,a)=>t.put(`/api/administration/tenants/templates/${s}/applications/${r}/modules`,a),getAiInstances:s=>t.get(`/api/administration/tenants/templates/${s}/ai-instances`),assignAiInstance:(s,r)=>t.post(`/api/administration/tenants/templates/${s}/ai-instances/${r}`),removeAiInstance:(s,r)=>t.delete(`/api/administration/tenants/templates/${s}/ai-instances/${r}`)}),Za=t=>({getAll:s=>t.get("/api/administration/tenants/organisations",{params:s}),getAvailable:s=>t.get("/api/administration/tenants/organisations/available",{params:s?{search:s}:void 0}),getPendingVerification:()=>t.get("/api/administration/tenants/organisations/pending-verification"),getById:s=>t.get(`/api/administration/tenants/organisations/${s}`),findById:async s=>{const r=await Ie.get(`/api/administration/tenants/organisations/${s}`,{validateStatus:a=>a===200||a===404});return r.status===200?r.data:null},create:s=>t.post("/api/administration/tenants/organisations",s),updateContact:(s,r)=>t.put(`/api/administration/tenants/organisations/${s}/contact`,r),updateAddress:(s,r)=>t.put(`/api/administration/tenants/organisations/${s}/address`,r),verify:(s,r)=>t.post(`/api/administration/tenants/organisations/${s}/verify`,{notes:r}),reject:(s,r)=>t.post(`/api/administration/tenants/organisations/${s}/reject`,{reason:r}),lookup:(s,r)=>t.get("/api/administration/tenants/organisations/lookup",{params:{countryCode:s,identifier:r}})}),en=t=>({getAll:s=>t.get("/api/administration/tenants/my",{params:s?{search:s}:void 0}),getDefault:()=>t.get("/api/administration/tenants/my/default"),setDefault:s=>t.post(`/api/administration/tenants/${s}/set-default`),clearDefault:()=>t.delete("/api/administration/tenants/clear-default"),getFavorites:()=>t.get("/api/user/preferences/tenant-favorites"),addFavorite:s=>t.post(`/api/user/preferences/tenant-favorites/${s}`),removeFavorite:s=>t.delete(`/api/user/preferences/tenant-favorites/${s}`),recordRecent:s=>t.post(`/api/user/preferences/tenant-recent/${s}`)}),tn=t=>({getAll:s=>t.get("/api/accounts",{params:s}),getById:s=>t.get(`/api/accounts/${s}`),create:s=>t.post("/api/accounts",s),update:(s,r)=>t.put(`/api/accounts/${s}`,r),delete:s=>t.delete(`/api/accounts/${s}`),activate:s=>t.patch(`/api/accounts/${s}/activate`),deactivate:s=>t.patch(`/api/accounts/${s}/deactivate`),rotateSecret:(s,r="Primary")=>t.post(`/api/accounts/${s}/rotate-secret?keySlot=${r}`),revokeSecondarySecret:s=>t.delete(`/api/accounts/${s}/secondary-secret`),assignRole:(s,r)=>t.post(`/api/accounts/${s}/roles`,r),removeRole:(s,r,a)=>t.delete(`/api/accounts/${s}/roles/${r}`,{params:a?{tenantId:a}:void 0}),generateSecret:()=>t.post("/api/accounts/generate-secret"),getAuditLogs:(s,r=1,a=20)=>t.get(`/api/accounts/${s}/audit-logs`,{params:{page:r,pageSize:a}}),getUsageStats:(s,r=30)=>t.get(`/api/accounts/${s}/usage-stats`,{params:{days:r}}),getKeyUsage:s=>t.get(`/api/accounts/${s}/key-usage`),getApiEndpoints:()=>t.get("/api/accounts/api-endpoints"),getAppApiAccess:s=>t.get(`/api/accounts/${s}/api-access`),updateApiAccess:(s,r,a)=>t.put(`/api/accounts/${s}/api-access/${r}`,a),removeApiAccess:(s,r)=>t.delete(`/api/accounts/${s}/api-access/${r}`)}),sn=t=>({getNavigationLookup:()=>t.get("/api/apis/navigation-lookup")}),rn=t=>{const s=D;return{users:Ga(s),roles:Ka(s),permissions:Ha(s),applications:Va(s),dashboard:Wa(s),settings:Xa(s),tenants:Ja(s),templates:Qa(s),organisations:Za(s),myTenants:en(s),preferences:Ya(s),externalApps:tn(s),apiCatalog:sn(s)}},je=rn(),xe=(t,s,r)=>{const a=t[s];return a?typeof a=="function"?a():Promise.resolve(a):new Promise((o,c)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(c.bind(null,new Error("Unknown variable dynamic import: "+s+(s.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},cr=async t=>{if(!t)return null;try{const[s,r,a,o,c,i,d,u,x,m,f,h,v,g,y,p,b,j,S,w,P,$,A,k,R,L,I,C,O,_,E,z,W,G]=await Promise.all([xe(Object.assign({"./locales/de/common.json":()=>Promise.resolve().then(()=>require("./common-BcZGi8mP.cjs")),"./locales/en/common.json":()=>Promise.resolve().then(()=>require("./common-w-cABALd.cjs")),"./locales/fr/common.json":()=>Promise.resolve().then(()=>require("./common-BemjTKsn.cjs")),"./locales/it/common.json":()=>Promise.resolve().then(()=>require("./common-CUprL8ig.cjs"))}),`./locales/${t}/common.json`,4),xe(Object.assign({"./locales/de/navigation.json":()=>Promise.resolve().then(()=>require("./navigation-D8yOGHza.cjs")),"./locales/en/navigation.json":()=>Promise.resolve().then(()=>require("./navigation-rEtU7BPw.cjs")),"./locales/fr/navigation.json":()=>Promise.resolve().then(()=>require("./navigation-BI8iMTJl.cjs")),"./locales/it/navigation.json":()=>Promise.resolve().then(()=>require("./navigation-BTkWh95c.cjs"))}),`./locales/${t}/navigation.json`,4),xe(Object.assign({"./locales/de/auth.json":()=>Promise.resolve().then(()=>require("./auth-C5zpZ9k7.cjs")),"./locales/en/auth.json":()=>Promise.resolve().then(()=>require("./auth-DL47kvnl.cjs")),"./locales/fr/auth.json":()=>Promise.resolve().then(()=>require("./auth-B-hELPDB.cjs")),"./locales/it/auth.json":()=>Promise.resolve().then(()=>require("./auth-CyPkCta2.cjs"))}),`./locales/${t}/auth.json`,4),xe(Object.assign({"./locales/de/admin.json":()=>Promise.resolve().then(()=>require("./admin-xzsr0_qA.cjs")),"./locales/en/admin.json":()=>Promise.resolve().then(()=>require("./admin-Cc6DZlcU.cjs")),"./locales/fr/admin.json":()=>Promise.resolve().then(()=>require("./admin-BTW2xEuA.cjs")),"./locales/it/admin.json":()=>Promise.resolve().then(()=>require("./admin-C0suc2Qj.cjs"))}),`./locales/${t}/admin.json`,4),xe(Object.assign({"./locales/de/support.json":()=>Promise.resolve().then(()=>require("./support-CXovIlzp.cjs")),"./locales/en/support.json":()=>Promise.resolve().then(()=>require("./support-Bt_0KUwJ.cjs")),"./locales/fr/support.json":()=>Promise.resolve().then(()=>require("./support-DsU3adXz.cjs")),"./locales/it/support.json":()=>Promise.resolve().then(()=>require("./support-D_BPwt4n.cjs"))}),`./locales/${t}/support.json`,4),xe(Object.assign({"./locales/de/docs.json":()=>Promise.resolve().then(()=>require("./docs-sqOeJ3Lg.cjs")),"./locales/en/docs.json":()=>Promise.resolve().then(()=>require("./docs-BR4q7sou.cjs")),"./locales/fr/docs.json":()=>Promise.resolve().then(()=>require("./docs-CDz8QplV.cjs")),"./locales/it/docs.json":()=>Promise.resolve().then(()=>require("./docs-DCOsvfv7.cjs"))}),`./locales/${t}/docs.json`,4),xe(Object.assign({"./locales/de/ai.json":()=>Promise.resolve().then(()=>require("./ai-BGdFYXWS.cjs")),"./locales/en/ai.json":()=>Promise.resolve().then(()=>require("./ai-D_SXDYCZ.cjs")),"./locales/fr/ai.json":()=>Promise.resolve().then(()=>require("./ai-9gEEAcjc.cjs")),"./locales/it/ai.json":()=>Promise.resolve().then(()=>require("./ai-CVDdg8-U.cjs"))}),`./locales/${t}/ai.json`,4),xe(Object.assign({"./locales/de/communications.json":()=>Promise.resolve().then(()=>require("./communications-DBbKXpf1.cjs")),"./locales/en/communications.json":()=>Promise.resolve().then(()=>require("./communications-BPsS3Vfm.cjs")),"./locales/fr/communications.json":()=>Promise.resolve().then(()=>require("./communications-DElJaoVw.cjs")),"./locales/it/communications.json":()=>Promise.resolve().then(()=>require("./communications-BKaku0MU.cjs"))}),`./locales/${t}/communications.json`,4),xe(Object.assign({"./locales/de/entra.json":()=>Promise.resolve().then(()=>require("./entra-BadKCc7Y.cjs")),"./locales/en/entra.json":()=>Promise.resolve().then(()=>require("./entra-CfLYpxKq.cjs")),"./locales/fr/entra.json":()=>Promise.resolve().then(()=>require("./entra-Bc0Dwf7d.cjs")),"./locales/it/entra.json":()=>Promise.resolve().then(()=>require("./entra-DDgx1JoT.cjs"))}),`./locales/${t}/entra.json`,4),xe(Object.assign({"./locales/en/structure.json":()=>Promise.resolve().then(()=>require("./structure-BL5cd83u.cjs")),"./locales/fr/structure.json":()=>Promise.resolve().then(()=>require("./structure-BblXL_QG.cjs"))}),`./locales/${t}/structure.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/preferences.json":()=>Promise.resolve().then(()=>require("./preferences-DLJ9mTYQ.cjs")),"./locales/en/preferences.json":()=>Promise.resolve().then(()=>require("./preferences-pkUX3R0G.cjs")),"./locales/fr/preferences.json":()=>Promise.resolve().then(()=>require("./preferences-Di_IL1wh.cjs")),"./locales/it/preferences.json":()=>Promise.resolve().then(()=>require("./preferences-B65OLntJ.cjs"))}),`./locales/${t}/preferences.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/groups.json":()=>Promise.resolve().then(()=>require("./groups-aYHQCkbY.cjs")),"./locales/en/groups.json":()=>Promise.resolve().then(()=>require("./groups-C92n_AjP.cjs")),"./locales/fr/groups.json":()=>Promise.resolve().then(()=>require("./groups-8opu86IJ.cjs")),"./locales/it/groups.json":()=>Promise.resolve().then(()=>require("./groups-DwDEmB18.cjs"))}),`./locales/${t}/groups.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/en/ba.json":()=>Promise.resolve().then(()=>require("./ba-9HglDm-t.cjs")),"./locales/fr/ba.json":()=>Promise.resolve().then(()=>require("./ba-CXlHUyjN.cjs"))}),`./locales/${t}/ba.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-users.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-CsRMxznf.cjs")),"./locales/en/docs-administration-users.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-BUnDEWjL.cjs")),"./locales/fr/docs-administration-users.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-DRITa5fK.cjs")),"./locales/it/docs-administration-users.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-qLwE7c_z.cjs"))}),`./locales/${t}/docs-administration-users.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-permissions.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-BHJfnRA-.cjs")),"./locales/en/docs-administration-permissions.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-CXsWrgCA.cjs")),"./locales/fr/docs-administration-permissions.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-BLmrJB-I.cjs")),"./locales/it/docs-administration-permissions.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-BmiGStz4.cjs"))}),`./locales/${t}/docs-administration-permissions.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-Cmjpaxwy.cjs")),"./locales/en/docs-administration-tenants.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-CvYnhoo5.cjs")),"./locales/fr/docs-administration-tenants.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-xhQOAORE.cjs")),"./locales/it/docs-administration-tenants.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-CuHqwklv.cjs"))}),`./locales/${t}/docs-administration-tenants.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-ai.json":()=>Promise.resolve().then(()=>require("./docs-administration-ai-CPqGrO8q.cjs")),"./locales/en/docs-administration-ai.json":()=>Promise.resolve().then(()=>require("./docs-administration-ai-EVzVu3kS.cjs")),"./locales/fr/docs-administration-ai.json":()=>Promise.resolve().then(()=>require("./docs-administration-ai-B0zkD6zQ.cjs")),"./locales/it/docs-administration-ai.json":()=>Promise.resolve().then(()=>require("./docs-administration-ai-DngqfS6k.cjs"))}),`./locales/${t}/docs-administration-ai.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-workflows.json":()=>Promise.resolve().then(()=>require("./docs-administration-workflows-DRw16ooP.cjs")),"./locales/en/docs-administration-workflows.json":()=>Promise.resolve().then(()=>require("./docs-administration-workflows-Da6XQxlv.cjs")),"./locales/fr/docs-administration-workflows.json":()=>Promise.resolve().then(()=>require("./docs-administration-workflows-CofvuK9f.cjs")),"./locales/it/docs-administration-workflows.json":()=>Promise.resolve().then(()=>require("./docs-administration-workflows-DW4kFs3z.cjs"))}),`./locales/${t}/docs-administration-workflows.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-entra.json":()=>Promise.resolve().then(()=>require("./docs-administration-entra-D3hQEI3V.cjs")),"./locales/en/docs-administration-entra.json":()=>Promise.resolve().then(()=>require("./docs-administration-entra-griadux5.cjs")),"./locales/fr/docs-administration-entra.json":()=>Promise.resolve().then(()=>require("./docs-administration-entra-BbS4ZUu7.cjs")),"./locales/it/docs-administration-entra.json":()=>Promise.resolve().then(()=>require("./docs-administration-entra-D0KuJ7Ps.cjs"))}),`./locales/${t}/docs-administration-entra.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-applications-C6VsiHxH.cjs")),"./locales/en/docs-administration-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-applications-DRYyRp3S.cjs")),"./locales/fr/docs-administration-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-applications-BEepPuXf.cjs")),"./locales/it/docs-administration-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-applications-BiZBTxgS.cjs"))}),`./locales/${t}/docs-administration-applications.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-configuration.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-BdZl4hL4.cjs")),"./locales/en/docs-administration-configuration.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-DvZxFmnH.cjs")),"./locales/fr/docs-administration-configuration.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-CXro3iiT.cjs")),"./locales/it/docs-administration-configuration.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-B1YtxR_A.cjs"))}),`./locales/${t}/docs-administration-configuration.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-configuration-license.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-license-DSMqi4PQ.cjs")),"./locales/en/docs-administration-configuration-license.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-license-C3rm7u1h.cjs")),"./locales/fr/docs-administration-configuration-license.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-license-CJsMRPaR.cjs")),"./locales/it/docs-administration-configuration-license.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-license-_LdQyRjT.cjs"))}),`./locales/${t}/docs-administration-configuration-license.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-template.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-template-HRqVNkqP.cjs")),"./locales/en/docs-administration-tenants-template.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-template-XQ-IiS31.cjs")),"./locales/fr/docs-administration-tenants-template.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-template-B3IDsztG.cjs")),"./locales/it/docs-administration-tenants-template.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-template-DKbpQgBH.cjs"))}),`./locales/${t}/docs-administration-tenants-template.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-business.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-business-BtAQiVRM.cjs")),"./locales/en/docs-administration-tenants-business.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-business-Cs4N4jrq.cjs")),"./locales/fr/docs-administration-tenants-business.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-business-XRmC4aRE.cjs")),"./locales/it/docs-administration-tenants-business.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-business-D1T8STQX.cjs"))}),`./locales/${t}/docs-administration-tenants-business.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-personal.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-personal-DHGVmv0D.cjs")),"./locales/en/docs-administration-tenants-personal.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-personal-Bk0D7emY.cjs")),"./locales/fr/docs-administration-tenants-personal.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-personal-DSnrN4MO.cjs")),"./locales/it/docs-administration-tenants-personal.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-personal-KFjQQGdW.cjs"))}),`./locales/${t}/docs-administration-tenants-personal.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-other.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-other-B5w2xFPJ.cjs")),"./locales/en/docs-administration-tenants-other.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-other-Dh2ohplZ.cjs")),"./locales/fr/docs-administration-tenants-other.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-other-WV4RsrVj.cjs")),"./locales/it/docs-administration-tenants-other.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-other-DeZKiNkH.cjs"))}),`./locales/${t}/docs-administration-tenants-other.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-permissions-assignments.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-assignments-BbAfGAzk.cjs")),"./locales/en/docs-administration-permissions-assignments.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-assignments-cv88prRo.cjs")),"./locales/fr/docs-administration-permissions-assignments.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-assignments-Clm4Yhy7.cjs")),"./locales/it/docs-administration-permissions-assignments.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-assignments-Xtrdol6a.cjs"))}),`./locales/${t}/docs-administration-permissions-assignments.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-applications-BXTwlVt_.cjs")),"./locales/en/docs-administration-tenants-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-applications-DxKx9YEc.cjs")),"./locales/fr/docs-administration-tenants-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-applications-DehK43TA.cjs")),"./locales/it/docs-administration-tenants-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-applications-D2SCJxWE.cjs"))}),`./locales/${t}/docs-administration-tenants-applications.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-access-requests.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-access-requests-CMJEiBDZ.cjs")),"./locales/en/docs-administration-tenants-access-requests.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-access-requests-BDCjPv_a.cjs")),"./locales/fr/docs-administration-tenants-access-requests.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-access-requests-DXBq6rZX.cjs")),"./locales/it/docs-administration-tenants-access-requests.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-access-requests-7mBPVsvv.cjs"))}),`./locales/${t}/docs-administration-tenants-access-requests.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-organisations.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-organisations-DV-_MnD2.cjs")),"./locales/en/docs-administration-tenants-organisations.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-organisations-BJS2qchs.cjs")),"./locales/fr/docs-administration-tenants-organisations.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-organisations-DDPYmh_7.cjs")),"./locales/it/docs-administration-tenants-organisations.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-organisations-BWchU3XZ.cjs"))}),`./locales/${t}/docs-administration-tenants-organisations.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-platform-support-tickets.json":()=>Promise.resolve().then(()=>require("./docs-platform-support-tickets-nvIWiI_l.cjs")),"./locales/en/docs-platform-support-tickets.json":()=>Promise.resolve().then(()=>require("./docs-platform-support-tickets-yc0oKKrD.cjs")),"./locales/fr/docs-platform-support-tickets.json":()=>Promise.resolve().then(()=>require("./docs-platform-support-tickets-jObWdig-.cjs")),"./locales/it/docs-platform-support-tickets.json":()=>Promise.resolve().then(()=>require("./docs-platform-support-tickets-BtPIdbRr.cjs"))}),`./locales/${t}/docs-platform-support-tickets.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-users-dashboard.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-dashboard-D6Oy2YkN.cjs")),"./locales/en/docs-administration-users-dashboard.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-dashboard-sPBt_1c4.cjs")),"./locales/fr/docs-administration-users-dashboard.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-dashboard-BVpRmDsI.cjs")),"./locales/it/docs-administration-users-dashboard.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-dashboard-lQ9K3m9K.cjs"))}),`./locales/${t}/docs-administration-users-dashboard.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-users-references.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-references-Du_ykq8Q.cjs")),"./locales/en/docs-administration-users-references.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-references-CNWOU2Wq.cjs")),"./locales/fr/docs-administration-users-references.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-references-Dc8nUoSy.cjs")),"./locales/it/docs-administration-users-references.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-references-C5YUKBpW.cjs"))}),`./locales/${t}/docs-administration-users-references.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-users-groups.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-groups-WmOKFuUm.cjs")),"./locales/en/docs-administration-users-groups.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-groups-C6xh7MWi.cjs")),"./locales/fr/docs-administration-users-groups.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-groups-DgWpE7cP.cjs")),"./locales/it/docs-administration-users-groups.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-groups-7NuH5xFT.cjs"))}),`./locales/${t}/docs-administration-users-groups.json`,4).catch(()=>({default:{}}))]);return{common:s.default,navigation:r.default,auth:a.default,admin:o.default,support:c.default,docs:i.default,ai:d.default,communications:u.default,entra:x.default,structure:m.default||{},preferences:f.default||{},groups:h.default||{},ba:v.default||{},docsAdministrationUsers:g.default||{},docsAdministrationPermissions:y.default||{},docsAdministrationTenants:p.default||{},docsAdministrationAi:b.default||{},docsAdministrationWorkflows:j.default||{},docsAdministrationEntra:S.default||{},docsAdministrationApplications:w.default||{},docsAdministrationConfiguration:P.default||{},docsAdministrationConfigurationLicense:$.default||{},docsAdministrationTenantsTemplate:A.default||{},docsAdministrationTenantsBusiness:k.default||{},docsAdministrationTenantsPersonal:R.default||{},docsAdministrationTenantsOther:L.default||{},docsAdministrationPermissionsAssignments:I.default||{},docsAdministrationTenantsApplications:C.default||{},docsAdministrationTenantsAccessRequests:O.default||{},docsAdministrationTenantsOrganisations:_.default||{},docsPlatformSupportTickets:E.default||{},docsAdministrationUsersDashboard:z.default||{},docsAdministrationUsersReferences:W.default||{},docsAdministrationUsersGroups:G.default||{}}}catch(s){return console.warn(`Failed to load language: ${t}`,s),null}},an={},nn=()=>{const t=localStorage.getItem("i18nextLng");if(t&&["en","fr","de","it"].includes(t))return t;const s=navigator.language.split("-")[0];return["en","fr","de","it"].includes(s)?s:"en"},Jt=nn();jt.use(Da).use(ne.initReactI18next).init({resources:an,lng:Jt,fallbackLng:"en",defaultNS:"common",ns:["common","navigation","auth","admin","support","docs","ai","communications","entra","structure","preferences","groups","ba","docsAdministrationUsers","docsAdministrationPermissions","docsAdministrationTenants","docsAdministrationAi","docsAdministrationWorkflows","docsAdministrationEntra","docsAdministrationApplications","docsAdministrationConfiguration","docsAdministrationConfigurationLicense","docsAdministrationTenantsTemplate","docsAdministrationTenantsBusiness","docsAdministrationTenantsPersonal","docsAdministrationTenantsOther","docsAdministrationPermissionsAssignments","docsAdministrationTenantsApplications","docsAdministrationTenantsAccessRequests","docsAdministrationTenantsOrganisations","docsPlatformSupportTickets","docsAdministrationUsersReferences","docsAdministrationUsersGroups"],interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator","htmlTag"],caches:["localStorage"]}});cr(Jt).then(t=>{t&&Object.entries(t).forEach(([s,r])=>{jt.addResourceBundle(Jt,s,r,!0,!0)})});const ls=async t=>{if(!jt.hasResourceBundle(t,"common")){const s=await cr(t);s&&Object.entries(s).forEach(([r,a])=>{jt.addResourceBundle(t,r,a,!0,!0)})}return jt.changeLanguage(t)},dr=n.createContext(void 0);function on(){if(typeof window>"u")return yt;try{const s=localStorage.getItem(ir);if(s){const r=JSON.parse(s);return{...yt,...r,borderRadius:{...yt.borderRadius,...r.borderRadius},itemPaletteKey:r.itemPaletteKey||os,colors:{light:ut(r.accentColorKey||"indigo"),dark:mt(r.accentColorKey||"indigo")}}}}catch{}const t=window.matchMedia("(prefers-color-scheme: dark)").matches;return{...yt,mode:t?"dark":"light"}}function At(t){const s=t.accentColorKey||"indigo",r=t.borderRadius;return{mode:t.theme||"dark",accentColorKey:s,borderRadius:{card:r?.card||"large",button:r?.button||"medium",badge:r?.badge||"medium",input:r?.input||"medium",modal:r?.modal||"xlarge",menuItem:r?.menuItem||"medium"},itemPaletteKey:t.itemPaletteKey||os,colors:{light:ut(s),dark:mt(s)}}}function ln(t){const s=document.documentElement,r=t.mode==="dark"?t.colors.dark:t.colors.light,a=Ue[t.accentColorKey]?.shades||Ue.indigo.shades,o=dt[t.itemPaletteKey]||dt.neutral,c=t.mode==="dark"?o.colors.dark:o.colors.light;t.mode==="dark"?s.classList.add("dark"):s.classList.remove("dark"),s.style.setProperty("--radius-card",Je[t.borderRadius.card]),s.style.setProperty("--radius-button",Je[t.borderRadius.button]),s.style.setProperty("--radius-badge",Je[t.borderRadius.badge]),s.style.setProperty("--radius-input",Je[t.borderRadius.input]),s.style.setProperty("--radius-modal",Je[t.borderRadius.modal]),s.style.setProperty("--radius-menu-item",Je[t.borderRadius.menuItem]),Object.entries(a).forEach(([i,d])=>{s.style.setProperty(`--color-accent-${i}`,d)}),s.style.setProperty("--item-color-light",c.light),s.style.setProperty("--item-color-medium",c.medium),s.style.setProperty("--item-color-dark",c.dark),s.style.setProperty("--item-color-border",c.border),s.style.setProperty("--bg-app",r.backgrounds.app),s.style.setProperty("--bg-primary",r.backgrounds.primary),s.style.setProperty("--bg-secondary",r.backgrounds.secondary),s.style.setProperty("--bg-tertiary",r.backgrounds.tertiary),s.style.setProperty("--bg-card",r.backgrounds.card),s.style.setProperty("--bg-hover",r.backgrounds.hover),s.style.setProperty("--bg-active",r.backgrounds.active),s.style.setProperty("--text-primary",r.text.primary),s.style.setProperty("--text-secondary",r.text.secondary),s.style.setProperty("--text-tertiary",r.text.tertiary),s.style.setProperty("--text-muted",r.text.muted),s.style.setProperty("--text-inverse",r.text.inverse),s.style.setProperty("--border-color",r.border.default),s.style.setProperty("--border-subtle",r.border.subtle),s.style.setProperty("--border-strong",r.border.strong),s.style.setProperty("--success-bg",r.status.success.bg),s.style.setProperty("--success-text",r.status.success.text),s.style.setProperty("--success-border",r.status.success.border),s.style.setProperty("--success-dot",r.status.success.dot),s.style.setProperty("--warning-bg",r.status.warning.bg),s.style.setProperty("--warning-text",r.status.warning.text),s.style.setProperty("--warning-border",r.status.warning.border),s.style.setProperty("--warning-dot",r.status.warning.dot),s.style.setProperty("--error-bg",r.status.error.bg),s.style.setProperty("--error-text",r.status.error.text),s.style.setProperty("--error-border",r.status.error.border),s.style.setProperty("--error-dot",r.status.error.dot),s.style.setProperty("--info-bg",r.status.info.bg),s.style.setProperty("--info-text",r.status.info.text),s.style.setProperty("--info-border",r.status.info.border),s.style.setProperty("--info-dot",r.status.info.dot),s.style.setProperty("--accent-bg",r.accentTransparent.bg),s.style.setProperty("--accent-text",r.accentTransparent.text),s.style.setProperty("--accent-border",r.accentTransparent.border)}function ur({children:t}){const[s,r]=n.useState(on),[a,o]=n.useState(!1),[c,i]=n.useState(null),[d,u]=n.useState(void 0),[x,m]=n.useState([]),{i18n:f}=ne.useTranslation(),h=n.useRef(null),v=n.useRef(!0),g=n.useRef(!1),y=n.useRef(!1),p=n.useCallback(async(E,z=void 0)=>{if(!localStorage.getItem("token")||y.current)return;let G=null;const J=localStorage.getItem("currentTenantId");if(z===void 0)J?G=J:G=null;else{if(z!==null&&J&&z!==J)return;G=z}try{o(!0),await It.preferences.updateTheme({mode:E.mode,accentColorKey:E.accentColorKey,borderRadius:{card:E.borderRadius.card,button:E.borderRadius.button,badge:E.borderRadius.badge,input:E.borderRadius.input,modal:E.borderRadius.modal,menuItem:E.borderRadius.menuItem},itemPaletteKey:E.itemPaletteKey,targetTenantId:G}),G&&!x.includes(G)&&m(pe=>[...pe,G])}catch(pe){console.error("[ThemeContext] ❌ Failed to save theme to server:",{error:pe,targetTenantId:G,mode:E.mode,accentColorKey:E.accentColorKey,localStorage_currentTenantId:localStorage.getItem("currentTenantId"),localStorage_currentTenantSlug:localStorage.getItem("currentTenantSlug")})}finally{o(!1)}},[x]),b=n.useCallback((E,z=void 0)=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{p(E,z)},1e3)},[p]);n.useLayoutEffect(()=>{ln(s)},[s]),n.useEffect(()=>{const E={mode:s.mode,borderRadius:s.borderRadius,accentColorKey:s.accentColorKey,itemPaletteKey:s.itemPaletteKey};localStorage.setItem(ir,JSON.stringify(E)),!y.current&&!v.current&&b(s,d),v.current=!1},[s,b,d]),n.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const j=n.useCallback(async E=>{const z=localStorage.getItem("token"),W=localStorage.getItem("currentTenantSlug");if(!z)return;const G=E==="global";if(!(!G&&!W))try{o(!0);const J=G?await je.preferences.getGlobal():await je.preferences.get();i(J.scope);const pe=At(J);v.current=!0,r(pe),g.current=!0,J.language&&J.language!==f.language&&(ls(J.language),document.documentElement.lang=J.language)}catch(J){console.error("[ThemeContext] Failed to load theme from server:",J)}finally{o(!1)}},[f]),S=n.useCallback(async()=>{const E=localStorage.getItem("token"),z=localStorage.getItem("currentTenantSlug");if(!(!E||!z))try{o(!0);const W=await je.preferences.applyToTenant();i(W.scope)}catch(W){throw console.error("[ThemeContext] Failed to create tenant-specific preferences:",W),W}finally{o(!1)}},[]),w=n.useCallback(async()=>{const E=localStorage.getItem("token"),z=localStorage.getItem("currentTenantSlug");if(!(!E||!z))try{o(!0);const W=await je.preferences.deleteTenantOverride();i(W.scope);const G=At(W);v.current=!0,r(G)}catch(W){throw console.error("[ThemeContext] Failed to delete tenant-specific preferences:",W),W}finally{o(!1)}},[]),P=n.useCallback(async()=>{if(localStorage.getItem("token"))try{const z=await je.preferences.getThemeOverrides();m(z)}catch(z){console.error("[ThemeContext] Failed to load tenant overrides:",z)}},[]),$=n.useCallback(async(E,z=!1)=>{if(h.current&&(clearTimeout(h.current),h.current=null),y.current=!0,g.current=!0,v.current=!0,u(E),z){y.current=!1;return}if(!localStorage.getItem("token")){y.current=!1;return}try{if(o(!0),E===null){const G=await je.preferences.getGlobal();i(G.scope);const J=At(G);v.current=!0,r(J)}else{const G=await je.preferences.getForTenant(E);i(G.scope);const J=At(G);v.current=!0,r(J)}}catch(G){console.error("[ThemeContext] Failed to load preferences for tenant:",G)}finally{o(!1),y.current=!1}},[]),A=n.useCallback(()=>{r(E=>({...E,mode:E.mode==="light"?"dark":"light",colors:{light:ut(E.accentColorKey),dark:mt(E.accentColorKey)}}))},[]),k=n.useCallback(E=>{r(z=>({...z,mode:E}))},[]),R=n.useCallback((E,z)=>{r(W=>({...W,borderRadius:{...W.borderRadius,[E]:z}}))},[]),L=n.useCallback(E=>{Ue[E]&&r(z=>({...z,accentColorKey:E,colors:{light:ut(E),dark:mt(E)}}))},[]),I=n.useCallback(E=>{dt[E]&&r(z=>({...z,itemPaletteKey:E}))},[]),C=n.useCallback(E=>{r(z=>{const W=E.accentColorKey||z.accentColorKey;return{...z,...E,borderRadius:{...z.borderRadius,...E.borderRadius},accentColorKey:W,itemPaletteKey:E.itemPaletteKey||z.itemPaletteKey,colors:{light:ut(W),dark:mt(W)}}})},[]),O=n.useCallback(()=>{r(yt)},[]),_=n.useCallback(E=>Je[s.borderRadius[E]],[s.borderRadius]);return e.jsx(dr.Provider,{value:{config:s,mode:s.mode,toggleMode:A,setMode:k,setBorderRadius:R,setAccentColor:L,setItemPalette:I,applyPreset:C,resetToDefault:O,getBorderRadius:_,loadFromServer:j,isSyncing:a,scopeInfo:c,applyToTenant:S,resetToGlobal:w,selectedThemeTenant:d,setSelectedThemeTenant:$,tenantOverrides:x,loadTenantOverrides:P},children:t})}function St(){const t=n.useContext(dr);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t}let ft=null,st=null;const cn={async getFeatureConfig(t){return ft||st||(st=(async()=>{try{return ft=(await ns.get("/api/config/features",{timeout:1e4,signal:t,headers:{"Content-Type":"application/json"}})).data,ft}finally{st=null}})(),st)},clearCache(){ft=null,st=null}},mr=n.createContext(void 0);function dn({children:t}){const[s,r]=n.useState(null),[a,o]=n.useState(!0);n.useEffect(()=>{const i=new AbortController;return cn.getFeatureConfig(i.signal).then(d=>{i.signal.aborted||r(d)}).catch(d=>{d.name==="CanceledError"||i.signal.aborted||(console.error("Failed to load feature config:",d),r({multiTenantEnabled:!0,enableB2B:!0,enableB2C:!0,useUrlRouting:!0}))}).finally(()=>{i.signal.aborted||o(!1)}),()=>i.abort()},[]);const c={config:s,isLoading:a,isMultiTenant:!0,isHybridMode:s?.multiTenantEnabled===!0&&s?.enableB2B===!1&&s?.enableB2C===!0,enableB2B:s?.enableB2B??!0,enableB2C:s?.enableB2C??!0,useUrlRouting:s?.useUrlRouting??!0};return e.jsx(mr.Provider,{value:c,children:t})}function cs(){const t=n.useContext(mr);if(!t)throw new Error("useFeatureConfig must be used within FeatureConfigProvider");return t}function ds(t,s){const r=t.toLowerCase(),a=s.toLowerCase();if(r==="*"||r===a)return!0;if(r.endsWith(".*")){const o=r.slice(0,-2);return a.startsWith(o+".")||a===o}return!1}function Tt(t,s){return t.includes("*")||s.includes("Super Administrator")}function un(t,s,r){if(!r||Tt(t,s))return!0;const a=r.toLowerCase(),o=a+".";for(const c of t){const i=c.toLowerCase();if(i===a||i.startsWith(o))return!0;if(i.endsWith(".*")){const d=i.slice(0,-1);if(a.startsWith(d)||o.startsWith(d))return!0}}return!1}const us=n.createContext(void 0),rt="token",at="user";function xr({children:t}){const[s,r]=n.useState(()=>{if(typeof window<"u"){const x=localStorage.getItem(at);if(x)try{return JSON.parse(x)}catch{return null}}return null}),[a,o]=n.useState(!0),c=n.useCallback((x,m)=>{localStorage.setItem(rt,x),localStorage.setItem(at,JSON.stringify(m)),r(m)},[]),i=n.useCallback(async()=>{try{localStorage.getItem(rt)&&await D.post("/api/auth/logout")}catch{}localStorage.removeItem(rt),localStorage.removeItem("refreshToken"),localStorage.removeItem(at),r(null),window.location.href="/login"},[]),d=n.useCallback(x=>{if(!s)return!1;if(Tt(s.permissions,s.roles)||s.permissions.includes(x))return!0;for(const m of s.permissions)if(ds(m,x))return!0;return!1},[s]),u=n.useCallback(async()=>{if(localStorage.getItem(rt))try{const m=await D.get("/api/auth/me");r(m),localStorage.setItem(at,JSON.stringify(m))}catch(m){console.error("Failed to refresh permissions:",m)}},[]);return n.useEffect(()=>{localStorage.getItem(rt)&&!s?D.get("/api/auth/me").then(m=>{r(m),localStorage.setItem(at,JSON.stringify(m))}).catch(()=>{localStorage.removeItem(rt),localStorage.removeItem("refreshToken"),localStorage.removeItem(at)}).finally(()=>o(!1)):o(!1)},[s]),e.jsx(us.Provider,{value:{user:s,isAuthenticated:!!s,isLoading:a,login:c,logout:i,hasPermission:d,refreshPermissions:u},children:t})}function Ae(){const t=n.useContext(us);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function mn(){return n.useContext(us)??null}const pr=n.createContext(void 0);function hr({children:t}){const[s,r]=n.useState(null),[a,o]=n.useState(null),[c,i]=n.useState(!0),[d,u]=n.useState(null),x=n.useRef(null),m=n.useCallback(async g=>{try{i(!0),u(null);const[y,p]=await Promise.all([D.get("/api/administration/license",{signal:g}),D.get("/api/administration/license/usage",{signal:g}).catch(()=>null)]);g?.aborted||(r(y),o(p))}catch(y){if(y instanceof Error&&y.name==="CanceledError"||g?.aborted)return;u(y instanceof Error?y.message:"Failed to load license info"),console.error("Failed to fetch license:",y)}finally{g?.aborted||i(!1)}},[]);n.useEffect(()=>{x.current?.abort();const g=new AbortController;return x.current=g,m(g.signal),()=>g.abort()},[m]);const f=n.useCallback(g=>s?s.enabledFeatures.includes("*")?!0:s.enabledFeatures.some(y=>y.toLowerCase()===g.toLowerCase()):!1,[s]),h=n.useCallback(async()=>{x.current?.abort();const g=new AbortController;x.current=g,await m(g.signal)},[m]),v=n.useCallback(async(g,y)=>{try{const p=await D.post("/api/administration/license/activate",{licenseKey:g,apiKey:y||null});return p.success?(await h(),{success:!0}):{success:!1,error:p.errorMessage||"Activation failed"}}catch(p){return{success:!1,error:p instanceof Error?p.message:"Activation failed"}}},[h]);return e.jsx(pr.Provider,{value:{license:s,usage:a,isLoading:c,error:d,isFeatureEnabled:f,isReadOnlyMode:s?.isReadOnlyMode??!1,refreshLicense:h,activateLicense:v},children:t})}function Ge(){const t=n.useContext(pr);if(t===void 0)throw new Error("useLicense must be used within a LicenseProvider");return t}const gr=n.createContext(void 0),Ve="currentTenantId",We="currentTenantSlug",_e="isGlobalView";function xn({children:t}){const{isAuthenticated:s,user:r,refreshPermissions:a}=Ae(),{isLoading:o}=cs(),[c,i]=n.useState(null),[d,u]=n.useState([]),[x,m]=n.useState(!0),[f,h]=n.useState(null),[v,g]=n.useState(()=>localStorage.getItem(_e)==="true"),y=n.useRef(!1),p=n.useRef(""),b=d.filter(C=>C.type==="Business"),j=d.find(C=>C.type==="Personal")||null,S=n.useCallback((C,O)=>{if(u(C),C.length===0){i(null),g(!1),localStorage.removeItem(Ve),localStorage.removeItem(We),localStorage.removeItem(_e),m(!1);return}const _=localStorage.getItem(Ve),E=_?C.find(J=>J.id===_):null;if(E&&E.status==="Active"){i(E),g(!1),localStorage.setItem(Ve,E.id),localStorage.setItem(We,E.slug),localStorage.removeItem(_e),m(!1);return}if(localStorage.getItem(_e)==="true"){g(!0),i(null),m(!1);return}const W=C.find(J=>J.isDefault&&J.status==="Active");if(W){i(W),g(!1),localStorage.setItem(Ve,W.id),localStorage.setItem(We,W.slug),localStorage.removeItem(_e),m(!1);return}if(O){g(!0),i(null),localStorage.setItem(_e,"true"),m(!1);return}const G=C.find(J=>J.status==="Active");i(G||null),G&&(localStorage.setItem(Ve,G.id),localStorage.setItem(We,G.slug)),m(!1)},[]),w=n.useCallback(async C=>{const O=d.find(_=>_.id===C);if(!O)throw new Error("Tenant not found");if(O.status!=="Active")throw new Error("Cannot switch to inactive tenant");g(!1),localStorage.removeItem(_e),i(O),localStorage.setItem(Ve,C),localStorage.setItem(We,O.slug),await a()},[d,a]),P=n.useCallback(async()=>{g(!0),localStorage.setItem(_e,"true"),i(null),localStorage.removeItem(Ve),localStorage.removeItem(We),await a()},[a]),$=n.useCallback(async()=>{g(!1),localStorage.removeItem(_e);const C=d.find(E=>E.isDefault&&E.status==="Active"),O=d.find(E=>E.status==="Active"),_=C||O||null;_&&(i(_),localStorage.setItem(Ve,_.id),localStorage.setItem(We,_.slug)),await a()},[d,a]),A=n.useCallback(async C=>{try{await je.myTenants.setDefault(C),u(O=>O.map(E=>({...E,isDefault:E.id===C}))),await w(C)}catch(O){throw console.error("[TenantContext] Failed to set default tenant:",O),O}},[w]),k=n.useCallback(async()=>{try{await je.myTenants.clearDefault(),u(C=>C.map(O=>({...O,isDefault:!1}))),await P()}catch(C){throw console.error("[TenantContext] Failed to clear default tenant:",C),C}},[P]),R=n.useCallback(async()=>{m(!0),h(null);try{await a()}catch(C){console.error("Failed to refresh tenants:",C),h("Failed to refresh tenants")}finally{m(!1)}},[a]);n.useEffect(()=>{if(!s||!r){y.current&&(u([]),i(null),m(!1),y.current=!1,p.current="");return}const C=r.tenants||[],O=C.map(_=>`${_.id}:${_.status}:${_.isDefault}`).sort((_,E)=>_.localeCompare(E)).join(",");if(!y.current||O!==p.current){y.current=!0,p.current=O;const _=Tt(r.permissions||[],r.roles||[]);S(C,_),localStorage.getItem(We)&&a().catch(z=>console.error("[TenantContext] Failed to refresh permissions after tenant init:",z))}},[s,r,S,a]),n.useEffect(()=>{s||(i(null),u([]),g(!1),localStorage.removeItem(Ve),localStorage.removeItem(We),localStorage.removeItem(_e))},[s]);const L=r?Tt(r.permissions||[],r.roles||[]):!1,I={currentTenant:c,userTenants:d,b2bTenants:b,personalTenant:j,isLoading:x||o,error:f,switchTenant:w,setDefaultTenant:A,clearDefaultTenant:k,refreshTenants:R,hasMultipleTenants:d.filter(C=>C.status==="Active").length>1,isCurrentTenantOwner:c?.isOwner??!1,hasGlobalRoles:L,isGlobalView:v,enterGlobalView:P,exitGlobalView:$};return e.jsx(gr.Provider,{value:I,children:t})}function Ee(){const t=n.useContext(gr);if(t===void 0)throw new Error("useTenant must be used within a TenantProvider");return t}const Rt=5,fr=n.createContext(null);function br({children:t}){const{i18n:s}=ne.useTranslation(),{isAuthenticated:r}=Ae(),{currentTenant:a,isLoading:o}=Ee(),[c,i]=n.useState([]),[d,u]=n.useState(!1),[x,m]=n.useState(null),[f,h]=n.useState(!1),v=n.useCallback(()=>{h(!0)},[]),g=n.useCallback(()=>{h(!1)},[]),y=n.useCallback(async()=>{try{u(!0),m(null);const k=(await D.get("/api/navigation/module-favorites")).map(R=>({id:R.id,code:R.code,label:R.label,icon:R.icon||"Star",route:R.route||"",applicationId:R.applicationId,applicationCode:R.applicationCode,applicationLabel:R.applicationLabel,displayOrder:R.displayOrder}));i(k)}catch(A){console.error("Failed to load favorite modules:",A),m("Erreur lors du chargement des favoris"),i([])}finally{u(!1)}},[]);n.useEffect(()=>{r&&!o?y():r||(i([]),m(null))},[r,o,a,y]),n.useEffect(()=>{const A=()=>{r&&!o&&y()};return s.on("languageChanged",A),()=>{s.off("languageChanged",A)}},[s,r,o,y]);const p=n.useCallback(async A=>{if(c.length>=Rt||c.some(k=>k.id===A.id))return!1;try{return m(null),await D.post(`/api/navigation/module-favorites/${A.id}`),i(k=>[...k,{...A,displayOrder:k.length+1}]),!0}catch(k){return console.error("Failed to add favorite module:",k),await y(),!1}},[c,y]),b=n.useCallback(async A=>{try{return m(null),await D.delete(`/api/navigation/module-favorites/${A}`),i(k=>k.filter(R=>R.id!==A)),!0}catch(k){return console.error("Failed to remove favorite module:",k),await y(),!1}},[y]),j=n.useCallback(A=>c.some(k=>k.id===A),[c]),S=n.useCallback(async A=>j(A.id)?await b(A.id):await p(A),[j,b,p]),w=n.useCallback(async A=>{const k=A.slice(0,Rt),R=k.map(I=>I.id),L=[...c];i(k.map((I,C)=>({...I,displayOrder:C+1})));try{return m(null),await D.put("/api/navigation/module-favorites/reorder",R),!0}catch(I){return console.error("Failed to reorder favorite modules:",I),i(L),!1}},[c]),P=c.length<Rt;return e.jsx(fr.Provider,{value:{favorites:c,loading:d,error:x,addFavorite:p,removeFavorite:b,toggleFavorite:S,isFavorite:j,reorderFavorites:w,canAddMore:P,maxFavorites:Rt,reload:y,expandFavorites:f,triggerExpand:v,clearExpand:g,requiresTenant:!1},children:t})}function ze(){const t=n.useContext(fr);if(!t)throw new Error("useFavorites must be used within a FavoritesProvider");return t}const vr="smartstack-sidebar-collapsed",yr=n.createContext(void 0);function pn(){if(typeof window>"u")return!1;try{return localStorage.getItem(vr)==="true"}catch{return!1}}function jr({children:t}){const[s,r]=n.useState(pn);n.useEffect(()=>{localStorage.setItem(vr,String(s))},[s]);const a=n.useCallback(()=>{r(i=>!i)},[]),o=n.useCallback(i=>{r(i)},[]),c=s?64:256;return e.jsx(yr.Provider,{value:{isCollapsed:s,toggleCollapsed:a,setCollapsed:o,sidebarWidth:c},children:t})}function Lt(){const t=n.useContext(yr);if(t===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return t}const hn=["login","callback","logout","onboarding","system","applications"],wr=n.createContext(void 0);function gn(t){let s=t.split("/").filter(Boolean);return s.length>=2&&s[0]==="t"&&(s=s.slice(2)),s.length===0?{app:null,module:null}:hn.includes(s[0])?{app:null,module:null}:{app:s[0]||null,module:s[1]||null}}function ms({children:t}){const s=N.useLocation(),{i18n:r}=ne.useTranslation(),{currentTenant:a,isLoading:o,isGlobalView:c}=Ee(),[i,d]=n.useState(null),[u,x]=n.useState([]),[m,f]=n.useState(!0),h=n.useRef(!1),v=n.useRef(void 0),g=n.useRef(0),{app:y,module:p}=gn(s.pathname),b=n.useCallback(async()=>{try{const I=await D.get("/api/navigation/menu");d(I)}catch(I){console.error("Failed to fetch menu:",I)}},[]),j=n.useCallback(async()=>{try{const I=await D.get("/api/navigation/favorites");x(I)}catch(I){console.error("Failed to fetch favorites:",I)}},[]),S=n.useCallback(async()=>{const I=++g.current;if(f(!0),await b(),I===g.current){if(a){if(await j(),I!==g.current)return}else x([]);f(!1)}},[b,j,a]);n.useEffect(()=>{const I=localStorage.getItem("token"),C=c?"global":a?.id??"none";if(!(!I||o)){if(!h.current){h.current=!0,v.current=C,S();return}C!==v.current&&(v.current=C,S())}},[a?.id,c,o]),n.useEffect(()=>{const I=()=>{localStorage.getItem("token")&&S()};return r.on("languageChanged",I),()=>{r.off("languageChanged",I)}},[r,S]);const w=n.useCallback(I=>I.startsWith("core_")?I.slice(5):I.startsWith("ext_")?I.slice(4):I,[]),P=n.useCallback((I,C)=>I&&I.split("/").filter(Boolean)[C]||null,[]),$=n.useCallback(()=>i?.applications.find(I=>P(I.route,0)===y||w(I.code)===y),[i,y,P,w]),A=n.useCallback(()=>$()?.modules.find(C=>P(C.route,1)===p||w(C.code)===p),[$,p,P,w]),k=n.useCallback(I=>i?.applications.filter(C=>C.zone===I)||[],[i]),R=n.useCallback(I=>u.some(C=>C.id===I),[u]),L=n.useCallback(async I=>{if(a)try{R(I)?(await D.delete(`/api/navigation/favorites/${I}`),x(C=>C.filter(O=>O.id!==I))):(await D.post(`/api/navigation/favorites/${I}`,{}),await j())}catch(C){console.error("Failed to toggle favorite:",C)}},[a,R,j]);return e.jsx(wr.Provider,{value:{menu:i,favorites:u,currentAppCode:y,currentModuleCode:p,isLoading:m,getCurrentApplication:$,getCurrentModule:A,getApplicationsByZone:k,getApplicationsForContext:k,toggleFavorite:L,isFavorite:R,refreshMenu:S},children:t})}function Re(){const t=n.useContext(wr);if(t===void 0)throw new Error("useNavigation must be used within a NavigationProvider");return t}const Nr=n.createContext(null);function Sr({children:t}){const{isAuthenticated:s,refreshPermissions:r}=Ae(),{refreshMenu:a}=Re(),o=n.useRef(null),[c,i]=n.useState(ie.HubConnectionState.Disconnected),d=n.useRef(new Set),u=n.useRef(new Set),x=n.useRef(!1),m=n.useCallback(async()=>{if(!x.current){x.current=!0;try{await Promise.all([r(),a()])}catch(p){console.error("[SignalR] Failed to refresh permissions:",p)}finally{x.current=!1}}},[r,a]),f=n.useCallback(async()=>{const p=localStorage.getItem("token");if(p&&!(o.current?.state===ie.HubConnectionState.Connected||o.current?.state===ie.HubConnectionState.Connecting))try{const b=new ie.HubConnectionBuilder().withUrl("/hubs/notifications",{accessTokenFactory:()=>p}).withAutomaticReconnect({nextRetryDelayInMilliseconds:j=>j.previousRetryCount===0?0:j.previousRetryCount===1?2e3:j.previousRetryCount===2?1e4:j.previousRetryCount<5?3e4:null}).configureLogging(ie.LogLevel.Warning).build();b.on("ReceiveNotification",j=>{d.current.forEach(S=>S(j))}),b.on("UnreadCountUpdate",j=>{u.current.forEach(S=>S(j))}),b.on("PermissionsChanged",m),b.onreconnecting(()=>{i(ie.HubConnectionState.Reconnecting)}),b.onreconnected(()=>{i(ie.HubConnectionState.Connected)}),b.onclose(()=>{i(ie.HubConnectionState.Disconnected)}),await b.start(),o.current=b,i(ie.HubConnectionState.Connected)}catch(b){console.error("[SignalR] Failed to connect:",b),i(ie.HubConnectionState.Disconnected)}},[m]),h=n.useCallback(async()=>{if(o.current)try{await o.current.stop(),o.current=null,i(ie.HubConnectionState.Disconnected)}catch(p){console.error("[SignalR] Failed to disconnect:",p)}},[]);n.useEffect(()=>(s?f():h(),()=>{h()}),[s,f,h]);const v=n.useCallback(p=>(d.current.add(p),()=>{d.current.delete(p)}),[]),g=n.useCallback(p=>(u.current.add(p),()=>{u.current.delete(p)}),[]),y={isConnected:c===ie.HubConnectionState.Connected,connectionState:c,onNotification:v,onUnreadCountUpdate:g};return e.jsx(Nr.Provider,{value:y,children:t})}function Cr(){const t=n.useContext(Nr);if(!t)throw new Error("useSignalRContext must be used within a SignalRProvider");return t}const Et={register:async t=>D.post("/api/auth/register",t),confirmEmail:async t=>D.post("/api/auth/confirm-email",{token:t}),resendConfirmation:async t=>D.post("/api/auth/resend-confirmation",{email:t}),forgotPassword:async t=>D.post("/api/auth/forgot-password",{email:t}),resetPassword:async(t,s)=>D.post("/api/auth/reset-password",{token:t,newPassword:s}),login:async(t,s)=>{const r=await D.post("/api/auth/login",{email:t,password:s});return r.token&&(localStorage.setItem("token",r.token),localStorage.setItem("refreshToken",r.refreshToken)),r},logout:async()=>{try{await D.post("/api/auth/logout")}finally{localStorage.removeItem("token"),localStorage.removeItem("refreshToken"),localStorage.removeItem("user")}},changePassword:async(t,s)=>D.post("/api/auth/change-password",{currentPassword:t,newPassword:s}),refreshSession:async()=>{const t=await D.post("/api/auth/refresh");return t.token&&(localStorage.setItem("token",t.token),localStorage.setItem("refreshToken",t.refreshToken)),t},getSessionInfo:async t=>D.get("/api/auth/session-info",{signal:t?.signal})};function kr(t={}){const{checkIntervalMs:s=6e4,onSessionExpired:r,onWarningThreshold:a,enabled:o=!0}=t,[c,i]=n.useState({isActive:!0,timeRemainingSeconds:0,isWarning:!1,sessionInfo:null}),[d,u]=n.useState(!1),x=n.useRef(!1),m=n.useRef(null),f=n.useRef(null),h=n.useCallback(async g=>{if(!o)return;if(!localStorage.getItem("token")){i(p=>({...p,isActive:!1}));return}try{const p=await Et.getSessionInfo({signal:g});if(g?.aborted)return;const b=Math.min(p.timeUntilIdleExpirySeconds,p.timeUntilAbsoluteExpirySeconds);i({isActive:!0,timeRemainingSeconds:b,isWarning:p.isWarningThreshold,sessionInfo:p}),p.isWarningThreshold&&!x.current&&(x.current=!0,a?.()),p.isWarningThreshold||(x.current=!1)}catch(p){if(p instanceof Error&&p.name==="CanceledError"||g?.aborted)return;i(b=>({...b,isActive:!1})),r?.()}},[o,r,a]),v=n.useCallback(async()=>{if(d)return!1;u(!0);try{return await Et.refreshSession(),x.current=!1,await h(),!0}catch{return i(g=>({...g,isActive:!1})),!1}finally{u(!1)}},[d,h]);return n.useEffect(()=>{if(!o)return;f.current?.abort();const g=new AbortController;return f.current=g,h(g.signal),m.current=setInterval(()=>h(),s),()=>{g.abort(),m.current&&clearInterval(m.current)}},[o,s,h]),n.useEffect(()=>{if(!o)return;const g=()=>{c.isWarning&&h()},y=["mousedown","keydown","touchstart","scroll"];return y.forEach(p=>{window.addEventListener(p,g,{passive:!0})}),()=>{y.forEach(p=>{window.removeEventListener(p,g)})}},[o,c.isWarning,h]),{...c,isRefreshing:d,refreshSession:v,checkSession:h}}function fn(t){if(t<=0)return"0:00";const s=Math.floor(t/60),r=t%60;if(s>=60){const a=Math.floor(s/60),o=s%60;return`${a}h ${o}min`}return`${s}:${r.toString().padStart(2,"0")}`}function Ar({isOpen:t,timeRemainingSeconds:s,onExtendSession:r,onLogout:a}){const{t:o}=ne.useTranslation("common"),[c,i]=n.useState(!1),[d,u]=n.useState(s);n.useEffect(()=>{u(s)},[s]),n.useEffect(()=>{if(!t||d<=0)return;const f=setInterval(()=>{u(h=>h<=1?(a(),0):h-1)},1e3);return()=>clearInterval(f)},[t,d,a]);const x=async()=>{i(!0);try{await r()||a()}finally{i(!1)}};if(!t)return null;const m=Math.max(0,Math.min(100,d/300*100));return e.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:e.jsxs("div",{className:"relative w-full max-w-md bg-[var(--bg-card)] rounded-2xl shadow-2xl border border-amber-500/30 overflow-hidden animate-in fade-in zoom-in duration-200",children:[e.jsx("div",{className:"absolute top-0 left-0 h-1 bg-amber-500/30 w-full",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-amber-500 to-orange-500 transition-all duration-1000 ease-linear",style:{width:`${m}%`}})}),e.jsxs("div",{className:"p-6 pt-8",children:[e.jsxs("div",{className:"flex flex-col items-center text-center mb-6",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-amber-500/20 flex items-center justify-center mb-4",children:e.jsx(l.Clock,{className:"w-8 h-8 text-amber-500"})}),e.jsx("h2",{className:"text-xl font-semibold text-[var(--text-primary)] mb-2",children:o("session.warningTitle","Session Expiring")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-4",children:o("session.warningMessage","Your session will expire due to inactivity.")}),e.jsx("div",{className:"text-4xl font-mono font-bold text-amber-500 tabular-nums",children:fn(d)}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-2",children:o("session.remainingTime","remaining")})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("button",{onClick:a,className:"flex-1 flex items-center justify-center gap-2 px-6 py-3 rounded-xl border border-[var(--border-color)] text-[var(--text-secondary)] hover:bg-[var(--bg-hover)] transition-all font-medium",children:[e.jsx(l.LogOut,{className:"w-4 h-4"}),o("session.logout","Logout")]}),e.jsxs("button",{onClick:x,disabled:c,className:"flex-1 flex items-center justify-center gap-2 px-6 py-3 rounded-xl font-medium transition-all bg-gradient-to-r from-amber-500 to-orange-500 text-white hover:from-amber-600 hover:to-orange-600 shadow-lg shadow-amber-500/30 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(l.RefreshCw,{className:`w-4 h-4 ${c?"animate-spin":""}`}),c?o("session.extending","Extending..."):o("session.extend","Continue Session")]})]})]})]})})}const bn=n.createContext(void 0);function Rr({children:t}){const{isAuthenticated:s,logout:r}=Ae(),a=n.useCallback(()=>{localStorage.removeItem("token"),localStorage.removeItem("refreshToken"),localStorage.removeItem("user"),window.location.href="/login?reason=session_expired"},[]),{isActive:o,timeRemainingSeconds:c,isWarning:i,refreshSession:d}=kr({enabled:s,checkIntervalMs:3e4,onSessionExpired:a}),u=n.useCallback(async()=>{try{await Et.logout()}finally{r()}},[r]),x=n.useCallback(async()=>await d(),[d]);return e.jsxs(bn.Provider,{value:{isSessionActive:o,timeRemainingSeconds:c,isWarning:i,refreshSession:d},children:[t,e.jsx(Ar,{isOpen:i&&s,timeRemainingSeconds:c,onExtendSession:x,onLogout:u})]})}const vn=150;function yn({children:t}){const s=mn(),r=s?.isAuthenticated??!1,a=s?.isLoading??!0,{currentTenant:o,isLoading:c,isGlobalView:i}=Ee(),{setSelectedThemeTenant:d,loadFromServer:u}=St(),x=n.useRef(null),m=n.useRef(!1),f=n.useRef(null),h=n.useRef(null),v=n.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]),g=n.useCallback(()=>x.current==="global"?!1:(v(),h.current=null,x.current="global",m.current=!0,u("global"),d(null,!0),!0),[v,u,d]),y=n.useCallback((j,S)=>{h.current=j,f.current=setTimeout(()=>{h.current===j&&(x.current=j,m.current=!0,h.current=null,d(j,!1)),f.current=null},vn)},[d]),p=n.useCallback(()=>{if(!o)return;const j=o.id!==x.current,S=h.current!==null&&h.current!==o.id;!j&&!S||(v(),j?y(o.id,o.slug):h.current=null)},[o,v,y]),b=n.useCallback(()=>{v(),x.current=null,h.current=null,m.current=!1},[v]);return n.useEffect(()=>{if(!r){b();return}if(!(a||c)){if(i&&!o){g();return}o&&p()}},[r,a,c,o,i,g,p,b]),n.useEffect(()=>()=>{v()},[v]),e.jsx(e.Fragment,{children:t})}function jn(t){const s=t.message.toLowerCase(),r=t.name.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("failed to fetch")||s.includes("econnrefused")||s.includes("timeout")?"network":s.includes("401")||s.includes("403")||s.includes("unauthorized")||s.includes("forbidden")||s.includes("permission")?"permission":s.includes("404")||s.includes("not found")?"notFound":r.includes("validation")||s.includes("validation")||s.includes("invalid")?"validation":"technical"}function wn(){const t=Date.now().toString(36),s=Math.random().toString(36).substring(2,6);return`ERR-${t}-${s}`.toUpperCase()}const Nn={network:{icon:l.WifiOff,color:"text-orange-500",bgColor:"bg-orange-500/10"},permission:{icon:l.ShieldX,color:"text-red-500",bgColor:"bg-red-500/10"},notFound:{icon:l.FileWarning,color:"text-yellow-500",bgColor:"bg-yellow-500/10"},validation:{icon:l.AlertTriangle,color:"text-amber-500",bgColor:"bg-amber-500/10"},technical:{icon:l.Bug,color:"text-red-500",bgColor:"bg-red-500/10"}};function Pr({error:t,resetErrorBoundary:s}){const{t:r}=ne.useTranslation("common"),[a,o]=n.useState(!1),[c]=n.useState(()=>wn()),i=jn(t),d=Nn[i],u=d.icon,x=()=>{window.history.length>2&&document.referrer?window.location.href=document.referrer:window.history.length>2?(window.history.back(),setTimeout(()=>window.location.reload(),50)):window.location.href="/"};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-[var(--bg-primary)] p-4",children:e.jsx("div",{className:"max-w-lg w-full p-8 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-2xl shadow-xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:`w-16 h-16 rounded-full ${d.bgColor} flex items-center justify-center mb-6`,children:e.jsx(u,{className:`w-8 h-8 ${d.color}`})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:r(`errors.${i}.title`,{defaultValue:r("errors.technical.title")})}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-4",children:r(`errors.${i}.description`,{defaultValue:r("errors.technical.description")})}),e.jsxs("div",{className:"mb-6 px-3 py-1.5 bg-[var(--bg-tertiary)] rounded-lg border border-[var(--border-color)]",children:[e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)]",children:[r("errors.errorId"),": "]}),e.jsx("span",{className:"text-xs font-mono text-[var(--text-secondary)]",children:c})]}),!1,e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[e.jsxs("button",{onClick:s,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white font-medium transition-all",children:[e.jsx(l.RefreshCw,{className:"w-4 h-4"}),r("errors.retry")]}),e.jsxs("button",{onClick:x,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.ArrowLeft,{className:"w-4 h-4"}),r("errors.goBack")]}),e.jsxs("a",{href:"/",className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.Home,{className:"w-4 h-4"}),r("errors.home")]})]}),e.jsxs("p",{className:"mt-6 text-sm text-[var(--text-tertiary)]",children:[r("errors.persistsHelp")," ",e.jsx("a",{href:"mailto:support@atlashub.ch",className:"text-[var(--color-accent-500)] hover:underline",children:r("errors.contactSupport")})]})]})})})}function Sn(t,s){Pe.logCritical(t,"GlobalErrorBoundary",{componentStack:s.componentStack})}function Cn(){window.location.reload()}function Tr({children:t}){return e.jsx(nr.ErrorBoundary,{FallbackComponent:Pr,onError:Sn,onReset:Cn,children:t})}const xs="/api/myspace/application-tracking",kn="00000000-0000-0000-0000-000000000000",Ns=t=>!!t&&t!==kn,Er=t=>{const s=t.match(/^\/t\/[^/]+(\/.*)$/);return s?s[1]:t},An=t=>{const s=Er(t);return s.startsWith("/administration/")||s.startsWith("/support/")||s.startsWith("/myspace/")},$r=(t,s)=>{if(!t||typeof t!="object"||!("status"in t))return!0;const r=t.status;return!s.includes(r??-1)},Rn=async(t,s)=>{const r=new Date,a=Math.floor((r.getTime()-s.getTime())/1e3);try{await D.post(`${xs}/end`,{accessId:t,endedAt:r.toISOString(),durationSeconds:a})}catch(o){$r(o,[401,408])&&console.error("Failed to end page tracking:",o)}},Pn=async t=>{const s=new Date;try{return(await D.post(`${xs}/start`,{route:t,accessedAt:s.toISOString()})).accessId}catch(r){return $r(r,[401])&&console.error("Failed to track page access:",r),null}},Tn=(t,s)=>{const r=localStorage.getItem("token");if(!r)return;const a=new Date,o=Math.floor((a.getTime()-s.getTime())/1e3);fetch(`${xs}/end`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({accessId:t,endedAt:a.toISOString(),durationSeconds:o}),keepalive:!0}).catch(()=>{})};function Ir(){const t=N.useLocation(),s=n.useRef(new Date),r=n.useRef(null),a=n.useRef(!1);n.useEffect(()=>a.current?void 0:((async()=>{const c=Er(t.pathname);An(c)&&(a.current=!0,Ns(r.current)&&await Rn(r.current,s.current),s.current=new Date,r.current=await Pn(c),a.current=!1)})(),()=>{Ns(r.current)&&Tn(r.current,s.current)}),[t.pathname])}function En(){return Ir(),null}function Lr(){return N.useInRouterContext()?e.jsx(En,{}):null}const bt="/api/administration/tenants/tenant-analytics",Ss={getDashboardStats:async(t=30)=>await D.get(`${bt}/dashboard`,{params:{period:t}}),getTopTenants:async(t=10,s=30,r="access")=>await D.get(`${bt}/top-tenants`,{params:{limit:t,period:s,sortBy:r}}),getTrends:async(t=30)=>await D.get(`${bt}/trends`,{params:{period:t}}),trackStart:async t=>await D.post(`${bt}/track/start`,{tenantId:t}),trackEnd:async t=>{await D.post(`${bt}/track/end`,{accessId:t})}},$n="/api/administration/tenants/tenant-analytics";function In(){const{currentTenant:t}=Ee(),{isAuthenticated:s}=Ae(),r=n.useRef(null),a=n.useRef(null),o=n.useRef(!1);n.useEffect(()=>{if(!s)return;const c=window.location.pathname;if(c.startsWith("/auth/")||c.startsWith("/login"))return;const i=t?.id??null;return i===a.current||o.current?void 0:(o.current=!0,(async()=>{if(r.current){try{await Ss.trackEnd(r.current)}catch{}r.current=null}if(a.current=i,i)try{const u=await Ss.trackStart(i);r.current=u.accessId}catch{r.current=null}o.current=!1})(),()=>{if(r.current){const u=localStorage.getItem("token");if(!u)return;fetch(`${$n}/track/end`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`},body:JSON.stringify({accessId:r.current}),keepalive:!0}).catch(()=>{}),r.current=null,a.current=null}})},[t?.id,s])}function Dr(){return In(),null}const Dt=n.createContext(null);function Mr(){const t=n.useContext(Dt);if(!t)throw new Error("useSlotFill must be used within a SlotFillProvider");return t}function Fr({children:t,initialFills:s}){const r=n.useMemo(()=>{const o=new Map;return s&&Object.entries(s).forEach(([c,i])=>{const d=o.get(c)||[];Array.isArray(i)?o.set(c,[...d,...i]):o.set(c,[...d,i])}),o},[s]),a=n.useMemo(()=>({fills:r,registerFill:(o,c)=>{const i=r.get(o)||[];r.set(o,[...i,c])},unregisterFill:(o,c)=>{const i=r.get(o)||[];r.set(o,i.filter(d=>d!==c))},getSlotContent:o=>r.get(o)||[]}),[r]);return e.jsx(Dt.Provider,{value:a,children:t})}function Or({name:t,context:s={},children:r,fallback:a,wrapper:o}){const i=n.useContext(Dt)?.getSlotContent(t)||[],d=n.useMemo(()=>({slotName:t,context:s}),[t,s]),u=n.useMemo(()=>i.length===0?a||null:i.map((m,f)=>{const h=`${t}-${f}`;return e.jsx(n.Fragment,{children:Br(m,d)},h)}),[i,t,d,a]),x=e.jsxs(e.Fragment,{children:[u,r]});return o?e.jsx(o,{children:x}):e.jsx(e.Fragment,{children:x})}function Ur({slot:t,children:s}){const{registerFill:r,unregisterFill:a}=Mr();return n.useMemo(()=>(r(t,s),()=>a(t,s)),[t,s,r,a]),null}function Br(t,s){if(t==null)return null;if(Array.isArray(t))return e.jsx(e.Fragment,{children:t.map((r,a)=>e.jsx(n.Fragment,{children:Br(r,s)},`slot-item-${a}`))});if(n.isValidElement(t))return t;if(typeof t=="function"){const r=t;return e.jsx(r,{...s})}return t}function Ln(t){return(n.useContext(Dt)?.getSlotContent(t)?.length||0)>0}function Dn(t){function s(a){return e.jsx(Or,{...a,name:t})}s.displayName=`Slot(${t})`;function r({children:a}){return e.jsx(Ur,{slot:t,children:a})}return r.displayName=`Fill(${t})`,{Slot:s,Fill:r,slotName:t}}const _r=n.createContext(null);function Ct(){const t=n.useContext(_r);return t||{config:{},getPage:()=>{},getSlotContent:()=>{},getTableColumns:()=>[],getFormFields:()=>[],hasExtension:()=>!1}}function Mt(t){const{getPage:s}=Ct();return s(t)}function Mn(t){const{getTableColumns:s}=Ct();return s(t)}function Fn(t){const{getFormFields:s}=Ct();return s(t)}function On(t){const{hasExtension:s}=Ct();return s(t)}function qr({config:t={},children:s}){const r=n.useMemo(()=>{const{pages:a={},slots:o={},tableColumns:c={},formFields:i={}}=t;return{config:t,getPage:d=>a[d],getSlotContent:d=>o[d],getTableColumns:d=>c[d]||[],getFormFields:d=>i[d]||[],hasExtension:d=>d in a||d in o||d in c||d in i}},[t]);return e.jsx(_r.Provider,{value:r,children:e.jsx(Fr,{initialFills:t.slots,children:s})})}const Un=n.createContext(null);function Bn({config:t,children:s}){typeof window<"u"&&(window.__SMARTSTACK_CONFIG__=t);const r=n.useMemo(()=>({config:t}),[t]);return e.jsx(Un.Provider,{value:r,children:e.jsx(Tr,{children:e.jsx(qr,{config:t.extensions,children:e.jsx(ur,{children:e.jsx(dn,{children:e.jsx(xr,{children:e.jsx(hr,{children:e.jsx(xn,{children:e.jsx(ms,{children:e.jsx(Sr,{children:e.jsx(br,{children:e.jsx(jr,{children:e.jsx(Rr,{children:e.jsxs(yn,{children:[e.jsx(Lr,{}),e.jsx(Dr,{}),s]})})})})})})})})})})})})})})}class _n{pages=new Map;register(s,r,a=[]){this.pages.set(s,{key:s,defaultComponent:r,slots:a})}get(s){return this.pages.get(s)}resolve(s){return this.pages.get(s)?.defaultComponent}getAll(){return Array.from(this.pages.values())}has(s){return this.pages.has(s)}getSlots(s){return this.pages.get(s)?.slots||[]}keys(){return Array.from(this.pages.keys())}}const Te=new _n;function qn(t,s){function r(a){const o=Mt(t);return o?e.jsx(o,{...a}):e.jsx(s,{...a})}return r.displayName=`Overridable(${t})`,r}function zn(t){const s=Mt(t),r=Te.get(t);return s||r?.defaultComponent}function Gn({pageKey:t,defaultComponent:s,params:r}){const a=Mt(t),o={pageKey:t,params:r};return a?e.jsx(a,{...o}):e.jsx(s,{...o})}const Kn={ADMIN_INDEX:"administration",ADMIN_DASHBOARD:"administration.dashboard",USERS_LIST:"administration.users",USERS_DETAIL:"administration.users.detail",USERS_DASHBOARD:"administration.users.dashboard",USERS_GROUPS:"administration.users.groups",USERS_GROUPS_DETAIL:"administration.users.groups.detail",USERS_REFERENCES:"administration.users.references",ROLES_LIST:"administration.permissions.roles",ROLES_DETAIL:"administration.permissions.roles.detail",PERMISSIONS_LIST:"administration.permissions.permissions",PERMISSIONS_DETAIL:"administration.permissions.permissions.detail",ASSIGNMENTS:"administration.permissions.assignments",APPLICATIONS_INDEX:"administration.applications",APPLICATIONS_DASHBOARD:"administration.applications.dashboard",APPLICATIONS_LIST:"administration.applications.list",APPLICATIONS_DETAIL:"administration.applications.detail",AI_DASHBOARD:"administration.ai.dashboard",AI_SETTINGS:"administration.ai.settings",AI_SKILLS_LIST:"administration.ai.skills",AI_SKILLS_DETAIL:"administration.ai.skills.detail",AI_SKILLS_CREATE:"administration.ai.skills.create",AI_SKILLS_EDIT:"administration.ai.skills.edit",AI_BLOCKS_LIST:"administration.ai.skills.blocks",AI_BLOCKS_DETAIL:"administration.ai.skills.blocks.detail",AI_BLOCKS_CREATE:"administration.ai.skills.blocks.create",AI_BLOCKS_EDIT:"administration.ai.skills.blocks.edit",AI_MONITORING:"administration.ai.monitoring",AI_AGENTS:"administration.ai.agents",AI_AGENTS_DETAIL:"administration.ai.agents.detail",AI_AGENTS_EDIT:"administration.ai.agents.edit",WORKFLOWS_LIST:"administration.workflows.list",WORKFLOWS_DETAIL:"administration.workflows.detail",WORKFLOWS_CREATE:"administration.workflows.create",WORKFLOWS_EDIT:"administration.workflows.edit",WORKFLOWS_TRIGGERS:"administration.workflows.triggers",WORKFLOWS_HISTORY:"administration.workflows.history",EMAIL_TEMPLATES_LIST:"administration.workflows.email-templates",EMAIL_TEMPLATES_DETAIL:"administration.workflows.email-templates.detail",EMAIL_TEMPLATES_CREATE:"administration.workflows.email-templates.create",EMAIL_TEMPLATES_EDIT:"administration.workflows.email-templates.edit",SMS_TEMPLATES_LIST:"administration.workflows.email-templates.sms",ENTRA_DASHBOARD:"administration.entra.dashboard",ENTRA_GROUPS:"administration.entra.groups",ENTRA_USERS:"administration.entra.users",ENTRA_CONFLICTS:"administration.entra.conflicts",ENTRA_SETTINGS:"administration.entra.settings",TENANTS_DASHBOARD:"administration.tenants.dashboard",TENANTS_LIST:"administration.tenants.list",TENANTS_DETAIL:"administration.tenants.detail",TENANTS_CREATE:"administration.tenants.create",TENANTS_SETTINGS:"administration.tenants.settings",TENANTS_TEMPLATE:"administration.tenants.template",TENANTS_TEMPLATE_CREATE:"administration.tenants.template.create",TENANTS_TEMPLATE_DETAIL:"administration.tenants.template.detail",TENANTS_BUSINESS:"administration.tenants.list.enterprise",TENANTS_PERSONAL:"administration.tenants.list.personal",TENANTS_OTHER:"administration.tenants.list.other",TENANTS_ACCESS_REQUESTS:"administration.tenants.access-requests",ORGANISATIONS_LIST:"administration.tenants.organisations",ORGANISATIONS_CREATE:"administration.tenants.organisations.create",ORGANISATIONS_DETAIL:"administration.tenants.organisations.detail",SETTINGS:"administration.configuration.settings",SETTINGS_GENERAL:"administration.configuration.settings.general",SETTINGS_FILE_UPLOAD:"administration.configuration.settings.file-upload",SETTINGS_LEGAL_FILE:"administration.configuration.settings.legal-file",APPSETTINGS:"administration.configuration.appsettings",APPSETTINGS_INFRASTRUCTURE:"administration.configuration.appsettings.infrastructure",APPSETTINGS_AUTHENTICATION:"administration.configuration.appsettings.authentication",APPSETTINGS_LOGGING:"administration.configuration.appsettings.logging",APPSETTINGS_EMAIL:"administration.configuration.appsettings.email",APPSETTINGS_ENTRA:"administration.configuration.appsettings.entra",LICENSE:"administration.configuration.license",API_ACCOUNTS_LIST:"api.accounts.list",API_ACCOUNTS_CREATE:"api.accounts.create",API_ACCOUNTS_DETAIL:"api.accounts.detail",API_CATALOG:"api.apis.catalog",API_CATALOG_DETAIL:"api.apis.catalog.detail",SUPPORT_DASHBOARD:"support.tickets",TICKETS_LIST:"support.tickets.list",TICKETS_DETAIL:"support.tickets.detail",TICKETS_ESCALATION:"support.tickets.escalation",TICKETS_NEW:"support.tickets.new",MY_TICKETS_LIST:"support.my-tickets",MY_TICKETS_DETAIL:"support.my-tickets.detail",MY_TICKETS_CREATE:"support.my-tickets.create",SUPPORT_SLA:"support.admin.sla",SUPPORT_TEMPLATES:"support.admin.templates",SUPPORT_PERMISSIONS:"support.admin.permissions",SUPPORT_ASSIGNMENT:"support.assignment",SUPPORT_ASSIGNMENT_SKILLS:"support.assignment.skills",SUPPORT_ASSIGNMENT_WORKLOAD:"support.assignment.workload",MYSPACE_DASHBOARD:"myspace.dashboard",USER_PROFILE:"myspace.profile",USER_PREFERENCES:"myspace.preferences",MYSPACE_TENANTS:"myspace.tenants.workspaces",MYSPACE_ACCESS_REQUESTS:"myspace.tenants.access-requests",MYSPACE_PORTAL:"myspace.portal",NOTIFICATIONS:"notifications",APPLICATIONS_HUB:"applications"},zr="smartstack-doc-panel-size",Gr=n.createContext(void 0);function Hn(){if(typeof window>"u")return 33;try{const t=localStorage.getItem(zr);if(t){const s=parseFloat(t);if(s>=20&&s<=60)return s}}catch{}return 33}const Cs={"administration/users":"/docs/business/administration/users","administration/users/dashboard":"/docs/business/administration/users","administration/users/list":"/docs/business/administration/users","administration/users/create":"/docs/business/administration/users","administration/users/groups":"/docs/business/administration/users/groups","administration/users/references":"/docs/business/administration/users/references","administration/permissions":"/docs/business/administration/permissions","administration/permissions/roles":"/docs/business/administration/permissions","administration/permissions/permissions":"/docs/business/administration/permissions","administration/permissions/assignments":"/docs/business/administration/permissions/assignments","administration/applications":"/docs/business/administration/applications","administration/applications/list":"/docs/business/administration/applications","administration/applications/grid":"/docs/business/administration/applications","administration/applications/dashboard":"/docs/business/administration/applications","administration/tenants":"/docs/business/administration/tenants","administration/tenants/dashboard":"/docs/business/administration/tenants","administration/tenants/create":"/docs/business/administration/tenants","administration/tenants/list":"/docs/business/administration/tenants/business","administration/tenants/list/enterprise":"/docs/business/administration/tenants/business","administration/tenants/list/personal":"/docs/business/administration/tenants/personal","administration/tenants/list/other":"/docs/business/administration/tenants/other","administration/tenants/template":"/docs/business/administration/tenants/template","administration/tenants/business":"/docs/business/administration/tenants/business","administration/tenants/personal":"/docs/business/administration/tenants","administration/tenants/organisations":"/docs/business/administration/tenants/organisations","administration/tenants/organisations/create":"/docs/business/administration/tenants/organisations","administration/tenants/access-requests":"/docs/business/administration/tenants/access-requests","administration/tenants/applications":"/docs/business/administration/tenants/applications","administration/workflows":"/docs/business/administration/workflows","administration/workflows/list":"/docs/business/administration/workflows","administration/workflows/create":"/docs/business/administration/workflows","administration/workflows/triggers":"/docs/business/administration/workflows","administration/workflows/history":"/docs/business/administration/workflows","administration/workflows/email-templates":"/docs/business/administration/workflows","administration/workflows/email-templates/email":"/docs/business/administration/workflows","administration/workflows/email-templates/sms":"/docs/business/administration/workflows","administration/workflows/email-templates/create":"/docs/business/administration/workflows","administration/ai":"/docs/business/administration/ai","administration/ai/dashboard":"/docs/business/administration/ai","administration/ai/settings":"/docs/business/administration/ai","administration/ai/providers":"/docs/business/administration/ai","administration/ai/models":"/docs/business/administration/ai","administration/ai/prompts":"/docs/business/administration/ai","administration/ai/blocks":"/docs/business/administration/ai","administration/entra":"/docs/business/administration/entra","administration/entra/dashboard":"/docs/business/administration/entra","administration/entra/groups":"/docs/business/administration/entra","administration/entra/users":"/docs/business/administration/entra","administration/entra/conflicts":"/docs/business/administration/entra","administration/entra/settings":"/docs/business/administration/entra","administration/configuration":"/docs/business/administration/configuration","administration/configuration/settings":"/docs/business/administration/configuration","administration/configuration/appsettings":"/docs/business/administration/configuration","administration/configuration/license":"/docs/business/administration/configuration/license","support/tickets":"/system/docs/user/support-dashboard","support/tickets/list":"/docs/business/platform/support/tickets","support/tickets/escalation":"/system/docs/user/support-escalation","support/my-tickets":"/docs/business/platform/support/tickets","support/my-tickets/list":"/docs/business/platform/support/tickets","support/my-tickets/create":"/docs/business/platform/support/tickets","support/admin/sla":"/system/docs/user/support-sla","support/admin/templates":"/system/docs/user/support-templates","myspace/profile":"/system/docs/user/modules","myspace/preferences":"/system/docs/user/modules","myspace/tenants":"/system/docs/user/modules","myspace/portal":"/system/docs/user/modules"},ks={administration:"/docs/business/administration/users",support:"/system/docs/user/support-dashboard",myspace:"/system/docs/user/modules"};function As(t){const s=t.split("/").filter(Boolean),a=s[0]==="t"&&s.length>=3?2:0,o=s.slice(a),c=o[0],i=o.slice(1);if(i.length>0)for(let d=i.length;d>0;d--){const u=`${c}/${i.slice(0,d).join("/")}`;if(Cs[u])return Cs[u]}return c&&ks[c]?ks[c]:"/system/docs/user"}function Kr({children:t}){const[s,r]=n.useState(!1),[a,o]=n.useState(Hn),[c,i]=n.useState(null),d=N.useLocation(),u=n.useRef(d.pathname);n.useEffect(()=>{u.current!==d.pathname&&(u.current=d.pathname,r(!1))},[d.pathname]),n.useEffect(()=>{a>=20&&a<=60&&localStorage.setItem(zr,String(a))},[a]);const x=n.useCallback(v=>{const g=v||As(d.pathname);i(g),r(!0)},[d.pathname]),m=n.useCallback(()=>{r(!1)},[]),f=n.useCallback(()=>{if(s)r(!1);else{const v=As(d.pathname);i(v),r(!0)}},[s,d.pathname]),h=n.useCallback(v=>{v>=20&&v<=60&&o(v)},[]);return e.jsx(Gr.Provider,{value:{isOpen:s,panelSize:a,docUrl:c,openDocPanel:x,closeDocPanel:m,toggleDocPanel:f,setPanelSize:h},children:t})}function Ft(){const t=n.useContext(Gr);if(t===void 0)throw new Error("useDocPanel must be used within a DocPanelProvider");return t}class Vn{captureBrowserInfo(){const s=navigator.userAgent;return{browser:this.getBrowserName(s),browserVersion:this.getBrowserVersion(s),os:this.getOSName(s),osVersion:this.getOSVersion(s),language:navigator.language,screenResolution:`${window.screen.width}x${window.screen.height}`,deviceType:this.getDeviceType(s)}}getBrowserName(s){return s.includes("Firefox")?"Firefox":s.includes("Edg/")?"Microsoft Edge":s.includes("Chrome")&&!s.includes("Edg/")?"Google Chrome":s.includes("Safari")&&!s.includes("Chrome")?"Safari":s.includes("Opera")||s.includes("OPR/")?"Opera":s.includes("MSIE")||s.includes("Trident/")?"Internet Explorer":"Unknown Browser"}getBrowserVersion(s){let r=null;return s.includes("Firefox")?r=s.match(/Firefox\/(\d+(?:\.\d+)*)/):s.includes("Edg/")?r=s.match(/Edg\/(\d+(?:\.\d+)*)/):s.includes("Chrome")&&!s.includes("Edg/")?r=s.match(/Chrome\/(\d+(?:\.\d+)*)/):s.includes("Safari")&&!s.includes("Chrome")?r=s.match(/Version\/(\d+(?:\.\d+)*)/):s.includes("OPR/")&&(r=s.match(/OPR\/(\d+(?:\.\d+)*)/)),r?r[1]:"Unknown"}getOSName(s){return s.includes("Windows NT 10")?"Windows 10/11":s.includes("Windows NT 6.3")?"Windows 8.1":s.includes("Windows NT 6.2")?"Windows 8":s.includes("Windows NT 6.1")?"Windows 7":s.includes("Windows")?"Windows":s.includes("Mac OS X")?"macOS":s.includes("Linux")&&s.includes("Android")?"Android":s.includes("Linux")?"Linux":s.includes("iPhone")||s.includes("iPad")?"iOS":s.includes("CrOS")?"Chrome OS":"Unknown OS"}getWindowsVersion(s){return s==="10.0"?"10/11":s==="6.3"?"8.1":s==="6.2"?"8":s==="6.1"?"7":s}getOSVersion(s){if(s.includes("Windows NT")){const r=s.match(/Windows NT (\d+\.\d+)/);if(r)return this.getWindowsVersion(r[1])}if(s.includes("Mac OS X")){const r=s.match(/Mac OS X (\d+[._]\d+(?:[._]\d+)?)/);if(r)return r[1].replace(/_/g,".")}if(s.includes("Android")){const r=s.match(/Android (\d+(?:\.\d+)*)/);if(r)return r[1]}if(s.includes("iPhone OS")||s.includes("iPad")){const r=s.match(/(?:iPhone|iPad|CPU) OS (\d+[._]\d+(?:[._]\d+)?)/);if(r)return r[1].replace(/_/g,".")}return"Unknown"}getDeviceType(s){return/Tablet|iPad/i.test(s)?"Tablet":/Mobile|iPhone|Android.*Mobile/i.test(s)?"Mobile":"Desktop"}formatForDescription(s){return[`Browser: ${s.browser} ${s.browserVersion}`,`OS: ${s.os} ${s.osVersion}`,`Device: ${s.deviceType}`,`Screen: ${s.screenResolution}`,`Language: ${s.language}`].join(`
1
+ "use strict";const e=require("react/jsx-runtime"),n=require("react"),ns=require("axios"),ne=require("react-i18next"),jt=require("i18next"),Da=require("i18next-browser-languagedetector"),N=require("react-router-dom"),Ma=require("@microsoft/signalr"),l=require("lucide-react"),nr=require("react-error-boundary"),$t=require("react-dom"),js=require("modern-screenshot"),gt=require("react-resizable-panels"),Fa=require("dompurify");function or(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,a.get?a:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const ie=or(Ma),xt=or(l),Je={none:"0px",small:"4px",medium:"8px",large:"12px",xlarge:"16px",xxlarge:"24px"},Oa={none:"Carré",small:"Léger",medium:"Moyen",large:"Arrondi",xlarge:"Très arrondi",xxlarge:"Pill"},Ue={slate:{name:"Ardoise",shades:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"}},gray:{name:"Gris",shades:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"}},zinc:{name:"Zinc",shades:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"}},stone:{name:"Pierre",shades:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"}},indigo:{name:"Indigo",shades:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"}},violet:{name:"Violet",shades:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"}},blue:{name:"Bleu",shades:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"}},cyan:{name:"Cyan",shades:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"}},teal:{name:"Teal",shades:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"}},emerald:{name:"Émeraude",shades:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"}},amber:{name:"Ambre",shades:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"}},orange:{name:"Orange",shades:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"}},rose:{name:"Rose",shades:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"}},pink:{name:"Pink",shades:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"}}},Ua={card:"large",button:"medium",badge:"medium",input:"medium",modal:"xlarge",menuItem:"medium"},dt={neutral:{name:"Neutre",icon:"⚪",colors:{light:{light:"#ffffff",medium:"#f4f4f5",dark:"#e4e4e7",border:"#d4d4d8"},dark:{light:"#1c1c1f",medium:"#27272a",dark:"#3f3f46",border:"#52525b"}}},ocean:{name:"Océan",icon:"🌊",colors:{light:{light:"#e0f2fe",medium:"#bae6fd",dark:"#7dd3fc",border:"#93c5fd"},dark:{light:"#141c24",medium:"#1a2836",dark:"#2a4a5e",border:"#3a5a70"}}},forest:{name:"Forêt",icon:"🌲",colors:{light:{light:"#d1fae5",medium:"#a7f3d0",dark:"#6ee7b7",border:"#86efac"},dark:{light:"#121d18",medium:"#182a22",dark:"#2a4a3a",border:"#3a5a4a"}}},sunset:{name:"Coucher de soleil",icon:"🌅",colors:{light:{light:"#fef3c7",medium:"#fde68a",dark:"#fbbf24",border:"#fcd34d"},dark:{light:"#1c1810",medium:"#2a2418",dark:"#4a3a24",border:"#5a4a34"}}},lavender:{name:"Lavande",icon:"💜",colors:{light:{light:"#ede9fe",medium:"#ddd6fe",dark:"#c4b5fd",border:"#c4b5fd"},dark:{light:"#1a1820",medium:"#24222e",dark:"#3a3650",border:"#4a4660"}}},rose:{name:"Rose",icon:"🌸",colors:{light:{light:"#fce7f3",medium:"#fbcfe8",dark:"#f9a8d4",border:"#f9a8d4"},dark:{light:"#1c1418",medium:"#2a1e24",dark:"#4a3040",border:"#5a4050"}}}},os="neutral",ut=t=>{const s=Ue[t]?.shades||Ue.indigo.shades;return{name:"Clair",primary:Ue.indigo.shades,accent:s,backgrounds:{app:"#fafafa",primary:"#ffffff",secondary:"#f4f4f5",tertiary:"#e4e4e7",card:"#ffffff",hover:"#f4f4f5",active:"#e4e4e7"},text:{primary:"#18181b",secondary:"#52525b",tertiary:"#71717a",muted:"#a1a1aa",inverse:"#fafafa"},border:{default:"#e4e4e7",subtle:"#f4f4f5",strong:"#d4d4d8"},status:{success:{bg:"#f0fdfa",text:"#0f766e",border:"#99f6e4",dot:"#14b8a6"},warning:{bg:"#fffbeb",text:"#b45309",border:"#fde68a",dot:"#f59e0b"},error:{bg:"#fff1f2",text:"#be123c",border:"#fecdd3",dot:"#f43f5e"},info:{bg:"#f0f9ff",text:"#0369a1",border:"#bae6fd",dot:"#0ea5e9"}},accentTransparent:{bg:`${s[50]}`,text:s[700],border:s[200]}}},mt=t=>{const s=Ue[t]?.shades||Ue.indigo.shades;return{name:"Sombre",primary:Ue.indigo.shades,accent:s,backgrounds:{app:"#161618",primary:"#1c1c1f",secondary:"#232326",tertiary:"#2a2a2e",card:"#1c1c1f",hover:"#27272a",active:"#3f3f46"},text:{primary:"#fafafa",secondary:"#d4d4d8",tertiary:"#a1a1aa",muted:"#71717a",inverse:"#18181b"},border:{default:"#3f3f46",subtle:"#27272a",strong:"#52525b"},status:{success:{bg:"rgba(20, 184, 166, 0.15)",text:"#5eead4",border:"rgba(20, 184, 166, 0.3)",dot:"#14b8a6"},warning:{bg:"rgba(245, 158, 11, 0.15)",text:"#fbbf24",border:"rgba(245, 158, 11, 0.3)",dot:"#f59e0b"},error:{bg:"rgba(244, 63, 94, 0.15)",text:"#fb7185",border:"rgba(244, 63, 94, 0.3)",dot:"#f43f5e"},info:{bg:"rgba(14, 165, 233, 0.15)",text:"#7dd3fc",border:"rgba(14, 165, 233, 0.3)",dot:"#0ea5e9"}},accentTransparent:{bg:`rgba(${ws(s[500])}, 0.15)`,text:s[300],border:`rgba(${ws(s[500])}, 0.3)`}}};function ws(t){const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return s?`${parseInt(s[1],16)}, ${parseInt(s[2],16)}, ${parseInt(s[3],16)}`:"99, 102, 241"}const yt={mode:"dark",borderRadius:Ua,colors:{light:ut("indigo"),dark:mt("indigo")},accentColorKey:"indigo",itemPaletteKey:os},Ba=[{id:"default",name:"Par défaut",description:"Style SmartStack classique avec coins arrondis",icon:"✨",config:{borderRadius:{card:"large",button:"medium",badge:"medium",input:"medium",modal:"xlarge",menuItem:"medium"},accentColorKey:"indigo",itemPaletteKey:"neutral"}},{id:"minimal",name:"Minimal",description:"Style épuré et professionnel",icon:"⚪",config:{borderRadius:{card:"medium",button:"small",badge:"small",input:"small",modal:"medium",menuItem:"small"},accentColorKey:"slate",itemPaletteKey:"neutral"}},{id:"corporate",name:"Corporate",description:"Style sobre pour environnement professionnel",icon:"🏢",config:{borderRadius:{card:"small",button:"small",badge:"medium",input:"small",modal:"medium",menuItem:"small"},accentColorKey:"gray",itemPaletteKey:"neutral"}},{id:"ocean",name:"Océan",description:"Teintes bleues apaisantes",icon:"🌊",config:{borderRadius:{card:"large",button:"medium",badge:"medium",input:"medium",modal:"xlarge",menuItem:"medium"},accentColorKey:"cyan",itemPaletteKey:"ocean"}},{id:"forest",name:"Forêt",description:"Tons verts naturels",icon:"🌲",config:{borderRadius:{card:"medium",button:"medium",badge:"medium",input:"medium",modal:"large",menuItem:"medium"},accentColorKey:"emerald",itemPaletteKey:"forest"}},{id:"sunset",name:"Coucher de soleil",description:"Couleurs chaudes et accueillantes",icon:"🌅",config:{borderRadius:{card:"large",button:"large",badge:"xxlarge",input:"medium",modal:"xlarge",menuItem:"medium"},accentColorKey:"orange",itemPaletteKey:"sunset"}},{id:"lavender",name:"Lavande",description:"Tons violets élégants",icon:"💜",config:{borderRadius:{card:"xlarge",button:"large",badge:"xlarge",input:"large",modal:"xlarge",menuItem:"large"},accentColorKey:"violet",itemPaletteKey:"lavender"}},{id:"rose",name:"Rose",description:"Teintes roses douces",icon:"🌸",config:{borderRadius:{card:"xxlarge",button:"xlarge",badge:"xxlarge",input:"large",modal:"xxlarge",menuItem:"large"},accentColorKey:"pink",itemPaletteKey:"rose"}}],ir="smartstack-theme-config";class kt extends Error{statusCode;details;constructor(s,r,a){super(s),this.name="AppError",this.statusCode=r,this.details=a}}class is extends Error{constructor(s="Network error occurred"){super(s),this.name="NetworkError"}}class lr extends Error{code;constructor(s="Authentication required",r){super(s),this.name="AuthenticationError",this.code=r}}class _a extends Error{constructor(s="Access denied"){super(s),this.name="ForbiddenError"}}const qa=10;class za{queue=[];recentErrors=[];isProcessing=!1;batchSize=10;batchDelay=2e3;async logError(s,r,a){const o=typeof s=="string"?s:s.message;let c=o;if(a?.url){const d=String(a.url),u=a.status?` [${a.status}]`:"";c=`${o}${u} - ${d}`}const i={message:c,stack:typeof s=="string"?void 0:s.stack,url:window.location.href,component:r,level:"Error",metadata:a};this.storeRecentError(i),this.queue.push({type:"error",data:i}),this.processQueue()}async logCritical(s,r,a){const o=typeof s=="string"?s:s.message;let c=o;if(a?.url){const u=String(a.url),x=a.status?` [${a.status}]`:"";c=`${o}${x} - ${u}`}const i={message:c,stack:typeof s=="string"?void 0:s.stack,url:window.location.href,component:r,level:"Critical",metadata:a};return this.storeRecentError(i),await this.sendErrorWithResponse(i)}getRecentErrors(){return[...this.recentErrors]}clearRecentErrors(){this.recentErrors=[]}storeRecentError(s){this.recentErrors.unshift({...s,timestamp:new Date}),this.recentErrors.length>qa&&this.recentErrors.pop()}async logEvent(s,r,a){const o={event:s,category:r,data:a};this.queue.push({type:"event",data:o}),this.processQueue()}async processQueue(){if(this.isProcessing||this.queue.length===0)return;this.isProcessing=!0,await new Promise(r=>setTimeout(r,this.batchDelay));const s=this.queue.splice(0,this.batchSize);for(const r of s)try{r.type==="error"?await this.sendError(r.data):await this.sendEvent(r.data)}catch{}this.isProcessing=!1,this.queue.length>0&&this.processQueue()}async sendError(s){const r=localStorage.getItem("token");await fetch("/api/logs/client-error",{method:"POST",headers:{"Content-Type":"application/json",...r&&{Authorization:`Bearer ${r}`}},body:JSON.stringify(s)})}async sendErrorWithResponse(s){const r=localStorage.getItem("token");try{const a=await fetch("/api/logs/client-error",{method:"POST",headers:{"Content-Type":"application/json",...r&&{Authorization:`Bearer ${r}`}},body:JSON.stringify(s)});return a.ok&&a.status===200&&(await a.json()).ticketNumber||null}catch{return null}}async sendEvent(s){const r=localStorage.getItem("token");await fetch("/api/logs/client-event",{method:"POST",headers:{"Content-Type":"application/json",...r&&{Authorization:`Bearer ${r}`}},body:JSON.stringify(s)})}}const Pe=new za;window.onerror=(t,s,r,a,o)=>{Pe.logError(o||String(t),"window.onerror",{source:s,lineno:r,colno:a})};window.onunhandledrejection=t=>{Pe.logError(t.reason instanceof Error?t.reason:String(t.reason),"unhandledrejection")};const Ie=ns.create({timeout:3e4,headers:{"Content-Type":"application/json"}});Ie.interceptors.request.use(t=>{const s=localStorage.getItem("token");s&&t.headers&&(t.headers.Authorization=`Bearer ${s}`);const r=crypto.randomUUID();t.headers&&(t.headers["X-Correlation-ID"]=r);const a=localStorage.getItem("i18nextLng")||navigator.language||"fr";t.headers&&(t.headers["Accept-Language"]=a);const o=localStorage.getItem("currentTenantSlug");return o&&t.headers&&!t.headers["X-Tenant-Slug"]&&(t.headers["X-Tenant-Slug"]=o),t},t=>(Pe.logError(t,"apiClient.request"),Promise.reject(t)));Ie.interceptors.response.use(t=>t,async t=>{const s=t.config?.headers?.["X-Correlation-ID"];if(ns.isCancel(t)||t.code==="ERR_CANCELED")return Promise.reject(t);if(!t.response){const i=new is("Impossible de se connecter au serveur. Vérifiez votre connexion internet.");return Pe.logError(i,"apiClient.response",{correlationId:s}),Promise.reject(i)}const{status:r,data:a}=t.response,o=a?.message||a?.detail||a?.title||t.message,c=a?.code;switch(r){case 401:{const i=new lr(o,c);Pe.logError(i,"apiClient.response",{correlationId:s,url:t.config?.url,code:c});const d=t.config?.url||"",x=["/api/user/preferences","/api/auth/session-info","/api/auth/refresh","/api/navigation/menu","/api/navigation/favorites","/api/navigation/contexts","/api/onboarding/status","/api/administration/tenants/tenant-analytics/track/"].some(m=>d.startsWith(m));if(!window.location.pathname.includes("/login")&&!x){localStorage.removeItem("token"),localStorage.removeItem("refreshToken"),localStorage.removeItem("user");const f=c==="SESSION_EXPIRED"?"/login?reason=session_expired":"/login";window.location.href=f}return Promise.reject(i)}case 403:{const i=new _a(o),d=["/api/administration/tenants/tenant-analytics/track/","/api/support/notifications"],u=t.config?.url||"";return d.some(m=>u.startsWith(m))||Pe.logError(i,"apiClient.response",{correlationId:s,url:t.config?.url,method:t.config?.method}),Promise.reject(i)}case 404:return Promise.reject(new kt(o||"Resource not found",r));case 400:return Promise.reject(new kt(o||"Invalid request",r,a?.details||a?.errors));case 500:case 502:case 503:case 504:{const i=new kt(o||"Server error",r);return Pe.logCritical(i,"apiClient.response",{correlationId:s,url:t.config?.url,status:r}),Promise.reject(i)}default:{const i=new kt(o,r,a?.details);return Pe.logError(i,"apiClient.response",{correlationId:s,status:r}),Promise.reject(i)}}});const D={get:(t,s)=>Ie.get(t,s).then(r=>r.data),post:(t,s,r)=>Ie.post(t,s,r).then(a=>a.data),put:(t,s,r)=>Ie.put(t,s,r).then(a=>a.data),patch:(t,s,r)=>Ie.patch(t,s,r).then(a=>a.data),delete:(t,s)=>Ie.delete(t,s).then(r=>r.data)},It={preferences:{get:()=>D.get("/api/user/preferences"),updateTheme:t=>D.put("/api/user/preferences/theme",t),updateLanguage:t=>D.put("/api/user/preferences/language",t),updateNotifications:t=>D.put("/api/user/preferences/notifications",t)},dashboard:{getAll:(t=30,s=10)=>D.get(`/api/user/dashboard/all?period=${t}&errorLimit=${s}`),getSessionAnalytics:(t=30)=>D.get(`/api/user/dashboard/session-analytics?period=${t}`),getLoginErrors:(t=10)=>D.get(`/api/user/dashboard/login-errors?limit=${t}`),getCurrentSession:()=>D.get("/api/user/dashboard/current-session"),getDeviceStats:()=>D.get("/api/user/dashboard/device-stats"),getWeeklyStats:(t=30)=>D.get(`/api/user/dashboard/weekly-stats?period=${t}`),getHourlyStats:(t=30)=>D.get(`/api/user/dashboard/hourly-stats?period=${t}`),getApplicationUsage:(t=30)=>D.get(`/api/user/dashboard/application-usage?period=${t}`)}},Ga=t=>({getAll:s=>t.get("/api/administration/users",{params:s}),getById:s=>t.get(`/api/administration/users/${s}`),create:s=>t.post("/api/administration/users",s),update:(s,r)=>t.put(`/api/administration/users/${s}`,r),sendPasswordResetLink:s=>t.post(`/api/administration/users/${s}/send-password-reset`),resetPasswordDirect:(s,r)=>t.post(`/api/administration/users/${s}/reset-password-direct`,r?{temporaryPassword:r}:{}),activate:s=>t.patch(`/api/administration/users/${s}/activate`),deactivate:s=>t.patch(`/api/administration/users/${s}/deactivate`),unlock:(s,r)=>t.post(`/api/administration/users/${s}/unlock`,r),clearFailedAttempts:s=>t.post(`/api/administration/users/${s}/clear-failed-attempts`),delete:s=>t.delete(`/api/administration/users/${s}`),getSessions:s=>t.get(`/api/administration/users/${s}/sessions`),endAllSessions:s=>t.post(`/api/administration/users/${s}/sessions/end-all`),endSession:(s,r)=>t.delete(`/api/administration/users/${s}/sessions/${r}`),getActivity:s=>t.get(`/api/administration/users/${s}/activity`),getCustomRole:s=>t.get(`/api/administration/users/${s}/custom-role`),createCustomRole:s=>t.post(`/api/administration/users/${s}/custom-role`),deleteCustomRole:s=>t.delete(`/api/administration/users/${s}/custom-role`),getHistory:(s,r=50)=>t.get(`/api/administration/users/${s}/history`,{params:{limit:r}}),restoreFromHistory:(s,r)=>t.post(`/api/administration/users/${s}/history/${r}/restore`),getOrganizationReferences:()=>t.get("/api/administration/users/organization-references"),references:{getCompanies:s=>t.get("/api/administration/users/references/companies",{params:s}),getDepartments:s=>t.get("/api/administration/users/references/departments",{params:s}),getJobTitles:s=>t.get("/api/administration/users/references/job-titles",{params:s}),getOffices:s=>t.get("/api/administration/users/references/offices",{params:s}),createCompany:(s,r)=>t.post(`/api/administration/users/references/companies${r?`?tenantId=${r}`:""}`,s),createDepartment:(s,r)=>t.post(`/api/administration/users/references/departments${r?`?tenantId=${r}`:""}`,s),createJobTitle:(s,r)=>t.post(`/api/administration/users/references/job-titles${r?`?tenantId=${r}`:""}`,s),createOffice:(s,r)=>t.post(`/api/administration/users/references/offices${r?`?tenantId=${r}`:""}`,s),updateCompany:(s,r)=>t.put(`/api/administration/users/references/companies/${s}`,r),updateDepartment:(s,r)=>t.put(`/api/administration/users/references/departments/${s}`,r),updateJobTitle:(s,r)=>t.put(`/api/administration/users/references/job-titles/${s}`,r),updateOffice:(s,r)=>t.put(`/api/administration/users/references/offices/${s}`,r),activateCompany:s=>t.patch(`/api/administration/users/references/companies/${s}/activate`),activateDepartment:s=>t.patch(`/api/administration/users/references/departments/${s}/activate`),activateJobTitle:s=>t.patch(`/api/administration/users/references/job-titles/${s}/activate`),activateOffice:s=>t.patch(`/api/administration/users/references/offices/${s}/activate`),deactivateCompany:s=>t.patch(`/api/administration/users/references/companies/${s}/deactivate`),deactivateDepartment:s=>t.patch(`/api/administration/users/references/departments/${s}/deactivate`),deactivateJobTitle:s=>t.patch(`/api/administration/users/references/job-titles/${s}/deactivate`),deactivateOffice:s=>t.patch(`/api/administration/users/references/offices/${s}/deactivate`),deleteCompany:s=>t.delete(`/api/administration/users/references/companies/${s}`),deleteDepartment:s=>t.delete(`/api/administration/users/references/departments/${s}`),deleteJobTitle:s=>t.delete(`/api/administration/users/references/job-titles/${s}`),deleteOffice:s=>t.delete(`/api/administration/users/references/offices/${s}`)},updateProfile:(s,r)=>t.put(`/api/administration/users/${s}/profile`,r),updateOrganization:(s,r)=>t.put(`/api/administration/users/${s}/organization`,r),updateJobInfo:(s,r)=>t.put(`/api/administration/users/${s}/job-info`,r),updatePhones:(s,r)=>t.put(`/api/administration/users/${s}/phones`,r),updateAddress:(s,r)=>t.put(`/api/administration/users/${s}/address`,r),updateContact:(s,r)=>t.put(`/api/administration/users/${s}/contact`,r),getTenants:s=>t.get(`/api/administration/users/${s}/tenants`),getGroups:s=>t.get(`/api/administration/users/${s}/groups`),getConsolidatedRoles:(s,r)=>{const a=r?`/api/administration/users/${s}/consolidated-roles?tenantId=${r}`:`/api/administration/users/${s}/consolidated-roles`;return t.get(a)},getApplicationAccess:(s,r)=>{const a=r?`/api/administration/users/${s}/application-access?tenantId=${r}`:`/api/administration/users/${s}/application-access`;return t.get(a)}}),Ka=t=>({getAll:s=>t.get("/api/administration/permissions/roles",{params:s}),getAssignable:()=>t.get("/api/administration/permissions/roles",{params:{excludeCategories:"Custom",minPermissionsCount:1}}),getServiceAssignable:()=>t.get("/api/administration/permissions/roles",{params:{forExternalApps:!0,minPermissionsCount:1}}),getByApplication:s=>t.get("/api/administration/permissions/roles",{params:{applicationId:s,excludeCategories:"Custom",minPermissionsCount:1}}),getById:s=>t.get(`/api/administration/permissions/roles/${s}`),create:s=>t.post("/api/administration/permissions/roles",s),update:(s,r)=>t.put(`/api/administration/permissions/roles/${s}`,r),delete:s=>t.delete(`/api/administration/permissions/roles/${s}`),assignUser:(s,r)=>t.post(`/api/administration/permissions/roles/${s}/users/${r}`),removeUser:(s,r)=>t.delete(`/api/administration/permissions/roles/${s}/users/${r}`),getGroups:s=>t.get(`/api/administration/permissions/roles/${s}/groups`),assignGroup:(s,r)=>t.post(`/api/administration/permissions/roles/${s}/groups/${r}`),removeGroup:(s,r)=>t.delete(`/api/administration/permissions/roles/${s}/groups/${r}`),getTranslations:s=>t.get(`/api/administration/permissions/roles/${s}/translations`),upsertTranslation:(s,r,a)=>t.put(`/api/administration/permissions/roles/${s}/translations/${r}`,a),deleteTranslation:(s,r)=>t.delete(`/api/administration/permissions/roles/${s}/translations/${r}`)}),Ha=t=>({getAll:s=>t.get("/api/administration/permissions",{params:s}),getById:s=>t.get(`/api/administration/permissions/${s}`),getTree:()=>t.get("/api/administration/permissions/tree"),getMatrix:()=>t.get("/api/administration/permissions/matrix"),delete:s=>t.delete(`/api/administration/permissions/${s}`)}),Va=t=>({getAll:s=>t.get("/api/administration/applications",{params:s}),getById:s=>t.get(`/api/administration/applications/${s}`),update:(s,r)=>t.put(`/api/administration/applications/${s}`,r),activate:s=>t.patch(`/api/administration/applications/${s}/activate`),deactivate:s=>t.patch(`/api/administration/applications/${s}/deactivate`),getModules:s=>t.get(`/api/administration/applications/${s}/modules`),updateModule:(s,r,a)=>t.put(`/api/administration/applications/${s}/modules/${r}`,a),getModuleSections:(s,r)=>t.get(`/api/administration/applications/${s}/modules/${r}/sections`),reorderModules:(s,r)=>t.put(`/api/administration/applications/${s}/modules/reorder`,{items:r}),reorderSections:(s,r,a)=>t.put(`/api/administration/applications/${s}/modules/${r}/sections/reorder`,{items:a}),getTenants:s=>t.get(`/api/administration/applications/${s}/tenants`),getAvailableTenants:s=>t.get(`/api/administration/applications/${s}/tenants/available`),assignToTenant:(s,r,a)=>t.post(`/api/administration/applications/${s}/tenants/${r}`,a?{accessLevel:a}:{}),removeFromTenant:(s,r)=>t.delete(`/api/administration/applications/${s}/tenants/${r}`),updateTenantAccessLevel:(s,r,a)=>t.patch(`/api/administration/applications/${s}/tenants/${r}/access-level`,{accessLevel:a}),bulkAssignTenants:(s,r)=>t.post(`/api/administration/applications/${s}/tenants/bulk`,r)}),Wa=t=>({getOverview:(s=30,r)=>t.get("/api/administration/users/dashboard/overview",{params:{days:s},signal:r?.signal}),getByStatus:s=>t.get("/api/administration/users/dashboard/by-status",{signal:s?.signal}),getByRole:s=>t.get("/api/administration/users/dashboard/by-role",{signal:s?.signal}),getByType:s=>t.get("/api/administration/users/dashboard/by-type",{signal:s?.signal}),getLoginActivity:(s=30,r)=>t.get("/api/administration/users/dashboard/login-activity",{params:{days:s},signal:r?.signal}),getTrends:(s=30,r)=>t.get("/api/administration/users/dashboard/trends",{params:{days:s},signal:r?.signal}),getRecentUsers:(s=10,r)=>t.get("/api/administration/users/dashboard/recent-users",{params:{limit:s},signal:r?.signal}),getSecurityAlerts:(s=3,r=24,a)=>t.get("/api/administration/users/dashboard/security-alerts",{params:{threshold:s,hours:r},signal:a?.signal}),getActiveSessions:s=>t.get("/api/administration/users/dashboard/active-sessions",{signal:s?.signal}),getLatestActiveSessions:(s=5,r)=>t.get("/api/administration/users/dashboard/latest-active-sessions",{params:{limit:s},signal:r?.signal})}),Xa=t=>({getAll:()=>t.get("/api/administration/configuration/settings"),getByCategory:s=>t.get(`/api/administration/configuration/settings/${s}`),get:(s,r)=>t.get(`/api/administration/configuration/settings/${s}/${r}`),update:(s,r,a)=>t.put(`/api/administration/configuration/settings/${s}/${r}`,{value:a}),reset:(s,r)=>t.post(`/api/administration/configuration/settings/${s}/${r}/reset`),getHistory:(s,r)=>t.get(`/api/administration/configuration/settings/${s}/${r}/history`),getCategories:()=>t.get("/api/administration/configuration/settings/categories")}),Ya=t=>({get:()=>t.get("/api/user/preferences"),getGlobal:()=>t.get("/api/user/preferences/global"),getForTenant:s=>t.get(`/api/user/preferences/for-tenant/${s}`),getThemeOverrides:()=>t.get("/api/user/preferences/theme-overrides"),deleteTenantOverride:()=>t.delete("/api/user/preferences/tenant-override"),applyToTenant:()=>t.post("/api/user/preferences/apply-to-tenant")}),Ja=t=>({getConfig:()=>t.get("/api/administration/tenants/config"),getAll:s=>{const{excludeTypes:r,...a}=s||{},o=new URLSearchParams;a.page&&o.set("page",String(a.page)),a.pageSize&&o.set("pageSize",String(a.pageSize)),a.search&&o.set("search",a.search),a.status&&o.set("status",a.status),a.type&&o.set("type",a.type),a.sortBy&&o.set("sortBy",a.sortBy),a.sortDesc&&o.set("sortDesc","true"),r?.length&&r.forEach(i=>o.append("excludeTypes",i));const c=o.toString();return t.get(`/api/administration/tenants${c?`?${c}`:""}`)},getById:s=>t.get(`/api/administration/tenants/${s}`),createB2C:s=>t.post("/api/administration/tenants/b2c",s),createB2B:s=>t.post("/api/administration/tenants/b2b",s),update:(s,r)=>t.put(`/api/administration/tenants/${s}`,r),delete:s=>t.delete(`/api/administration/tenants/${s}`),activate:s=>t.post(`/api/administration/tenants/${s}/activate`),suspend:s=>t.post(`/api/administration/tenants/${s}/suspend`),archive:s=>t.delete(`/api/administration/tenants/${s}`),checkSlugAvailable:s=>t.get(`/api/administration/tenants/check-slug/${s}`),assignTemplate:(s,r)=>t.post(`/api/administration/tenants/${s}/template`,{templateId:r}),removeTemplate:s=>t.delete(`/api/administration/tenants/${s}/template`),getMembers:s=>t.get(`/api/administration/tenants/${s}/members`),getMember:(s,r)=>t.get(`/api/administration/tenants/${s}/members/${r}`),addMember:(s,r)=>t.post(`/api/administration/tenants/${s}/members`,r),removeMember:(s,r)=>t.delete(`/api/administration/tenants/${s}/members/${r}`),setMemberDefault:(s,r)=>t.patch(`/api/administration/tenants/${s}/members/${r}/set-default`),transferOwnership:(s,r)=>t.post(`/api/administration/tenants/${s}/members/transfer-ownership`,{toUserId:r}),assignRole:(s,r,a)=>t.post(`/api/administration/tenants/${s}/members/${r}/roles/${a}`),removeRole:(s,r,a)=>t.delete(`/api/administration/tenants/${s}/members/${r}/roles/${a}`),assignMemberRoles:(s,r,a)=>t.put(`/api/administration/tenants/${s}/members/${r}/roles`,{roleIds:a}),getMemberCustomRole:(s,r)=>t.get(`/api/administration/tenants/${s}/members/${r}/custom-role`),createMemberCustomRole:(s,r)=>t.post(`/api/administration/tenants/${s}/members/${r}/custom-role`),deleteMemberCustomRole:(s,r)=>t.delete(`/api/administration/tenants/${s}/members/${r}/custom-role`),getTenantRoles:s=>t.get(`/api/administration/tenants/${s}/roles`),getGroups:s=>t.get(`/api/administration/tenants/${s}/groups`),getAvailableGroups:s=>t.get(`/api/administration/tenants/${s}/groups/available`),addGroupToTenant:(s,r)=>t.post(`/api/administration/tenants/${s}/groups`,{groupId:r}),removeGroupFromTenant:(s,r)=>t.delete(`/api/administration/tenants/${s}/groups/${r}`),getApplications:s=>t.get(`/api/administration/tenants/${s}/applications`),getAvailableApplications:s=>t.get(`/api/administration/tenants/${s}/applications/available`),assignApplication:(s,r)=>t.post(`/api/administration/tenants/${s}/applications/${r}`),removeApplication:(s,r)=>t.delete(`/api/administration/tenants/${s}/applications/${r}`),bulkAssignApplications:(s,r)=>t.post(`/api/administration/tenants/${s}/applications/bulk`,r),toggleApplication:(s,r,a)=>t.patch(`/api/administration/tenants/${s}/applications/${r}/toggle`,{isActive:a}),updateApplicationAccessLevel:(s,r,a)=>t.patch(`/api/administration/tenants/${s}/applications/${r}/access-level`,{accessLevel:a}),getEffectiveTree:(s,r)=>t.get(`/api/administration/tenants/${s}/applications/${r}/effective-tree`),saveOverrides:(s,r,a)=>t.put(`/api/administration/tenants/${s}/applications/${r}/overrides`,a),getModules:s=>t.get(`/api/administration/tenants/${s}/modules`),getAvailableModules:s=>t.get(`/api/administration/tenants/${s}/modules/available`),assignModule:(s,r)=>t.post(`/api/administration/tenants/${s}/modules/${r}`),removeModule:(s,r)=>t.delete(`/api/administration/tenants/${s}/modules/${r}`),toggleModule:(s,r,a)=>t.patch(`/api/administration/tenants/${s}/modules/${r}/toggle`,{isActive:a}),getSections:s=>t.get(`/api/administration/tenants/${s}/sections`),getAvailableSections:s=>t.get(`/api/administration/tenants/${s}/sections/available`),assignSection:(s,r)=>t.post(`/api/administration/tenants/${s}/sections/${r}`),removeSection:(s,r)=>t.delete(`/api/administration/tenants/${s}/sections/${r}`),toggleSection:(s,r,a)=>t.patch(`/api/administration/tenants/${s}/sections/${r}/toggle`,{isActive:a}),getModulesWithSections:(s,r)=>t.get(`/api/administration/tenants/${s}/applications/${r}/modules-tree`),linkOrganisation:(s,r)=>t.post(`/api/administration/tenants/${s}/organisation`,{organisationId:r}),unlinkOrganisation:s=>t.delete(`/api/administration/tenants/${s}/organisation`)}),Qa=t=>({getAll:()=>t.get("/api/administration/tenants/templates"),getById:s=>t.get(`/api/administration/tenants/templates/${s}`),create:s=>t.post("/api/administration/tenants/templates",s),update:(s,r)=>t.put(`/api/administration/tenants/templates/${s}`,r),delete:s=>t.delete(`/api/administration/tenants/templates/${s}`),assignApplication:(s,r)=>t.post(`/api/administration/tenants/templates/${s}/applications/${r}`),removeApplication:(s,r)=>t.delete(`/api/administration/tenants/templates/${s}/applications/${r}`),bulkAssignApplications:(s,r)=>t.post(`/api/administration/tenants/templates/${s}/applications/bulk`,r),getTenants:s=>t.get(`/api/administration/tenants/templates/${s}/tenants`),getApplications:s=>t.get(`/api/administration/tenants/templates/${s}/applications`),getAvailableApplications:s=>t.get(`/api/administration/tenants/templates/${s}/applications/available`),updateApplicationAccessLevel:(s,r,a)=>t.patch(`/api/administration/tenants/templates/${s}/applications/${r}/access-level`,{accessLevel:a}),getApplicationModules:(s,r)=>t.get(`/api/administration/tenants/templates/${s}/applications/${r}/modules`),updateApplicationModules:(s,r,a)=>t.put(`/api/administration/tenants/templates/${s}/applications/${r}/modules`,a),getAiInstances:s=>t.get(`/api/administration/tenants/templates/${s}/ai-instances`),assignAiInstance:(s,r)=>t.post(`/api/administration/tenants/templates/${s}/ai-instances/${r}`),removeAiInstance:(s,r)=>t.delete(`/api/administration/tenants/templates/${s}/ai-instances/${r}`)}),Za=t=>({getAll:s=>t.get("/api/administration/tenants/organisations",{params:s}),getAvailable:s=>t.get("/api/administration/tenants/organisations/available",{params:s?{search:s}:void 0}),getPendingVerification:()=>t.get("/api/administration/tenants/organisations/pending-verification"),getById:s=>t.get(`/api/administration/tenants/organisations/${s}`),findById:async s=>{const r=await Ie.get(`/api/administration/tenants/organisations/${s}`,{validateStatus:a=>a===200||a===404});return r.status===200?r.data:null},create:s=>t.post("/api/administration/tenants/organisations",s),updateContact:(s,r)=>t.put(`/api/administration/tenants/organisations/${s}/contact`,r),updateAddress:(s,r)=>t.put(`/api/administration/tenants/organisations/${s}/address`,r),verify:(s,r)=>t.post(`/api/administration/tenants/organisations/${s}/verify`,{notes:r}),reject:(s,r)=>t.post(`/api/administration/tenants/organisations/${s}/reject`,{reason:r}),lookup:(s,r)=>t.get("/api/administration/tenants/organisations/lookup",{params:{countryCode:s,identifier:r}})}),en=t=>({getAll:s=>t.get("/api/administration/tenants/my",{params:s?{search:s}:void 0}),getDefault:()=>t.get("/api/administration/tenants/my/default"),setDefault:s=>t.post(`/api/administration/tenants/${s}/set-default`),clearDefault:()=>t.delete("/api/administration/tenants/clear-default"),getFavorites:()=>t.get("/api/user/preferences/tenant-favorites"),addFavorite:s=>t.post(`/api/user/preferences/tenant-favorites/${s}`),removeFavorite:s=>t.delete(`/api/user/preferences/tenant-favorites/${s}`),recordRecent:s=>t.post(`/api/user/preferences/tenant-recent/${s}`)}),tn=t=>({getAll:s=>t.get("/api/accounts",{params:s}),getById:s=>t.get(`/api/accounts/${s}`),create:s=>t.post("/api/accounts",s),update:(s,r)=>t.put(`/api/accounts/${s}`,r),delete:s=>t.delete(`/api/accounts/${s}`),activate:s=>t.patch(`/api/accounts/${s}/activate`),deactivate:s=>t.patch(`/api/accounts/${s}/deactivate`),rotateSecret:(s,r="Primary")=>t.post(`/api/accounts/${s}/rotate-secret?keySlot=${r}`),revokeSecondarySecret:s=>t.delete(`/api/accounts/${s}/secondary-secret`),assignRole:(s,r)=>t.post(`/api/accounts/${s}/roles`,r),removeRole:(s,r,a)=>t.delete(`/api/accounts/${s}/roles/${r}`,{params:a?{tenantId:a}:void 0}),generateSecret:()=>t.post("/api/accounts/generate-secret"),getAuditLogs:(s,r=1,a=20)=>t.get(`/api/accounts/${s}/audit-logs`,{params:{page:r,pageSize:a}}),getUsageStats:(s,r=30)=>t.get(`/api/accounts/${s}/usage-stats`,{params:{days:r}}),getKeyUsage:s=>t.get(`/api/accounts/${s}/key-usage`),getApiEndpoints:()=>t.get("/api/accounts/api-endpoints"),getAppApiAccess:s=>t.get(`/api/accounts/${s}/api-access`),updateApiAccess:(s,r,a)=>t.put(`/api/accounts/${s}/api-access/${r}`,a),removeApiAccess:(s,r)=>t.delete(`/api/accounts/${s}/api-access/${r}`)}),sn=t=>({getNavigationLookup:()=>t.get("/api/apis/navigation-lookup")}),rn=t=>{const s=D;return{users:Ga(s),roles:Ka(s),permissions:Ha(s),applications:Va(s),dashboard:Wa(s),settings:Xa(s),tenants:Ja(s),templates:Qa(s),organisations:Za(s),myTenants:en(s),preferences:Ya(s),externalApps:tn(s),apiCatalog:sn(s)}},je=rn(),xe=(t,s,r)=>{const a=t[s];return a?typeof a=="function"?a():Promise.resolve(a):new Promise((o,c)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(c.bind(null,new Error("Unknown variable dynamic import: "+s+(s.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},cr=async t=>{if(!t)return null;try{const[s,r,a,o,c,i,d,u,x,m,f,h,v,g,y,p,b,j,S,w,P,$,A,k,R,L,I,C,O,_,E,z,W,G]=await Promise.all([xe(Object.assign({"./locales/de/common.json":()=>Promise.resolve().then(()=>require("./common-BcZGi8mP.cjs")),"./locales/en/common.json":()=>Promise.resolve().then(()=>require("./common-w-cABALd.cjs")),"./locales/fr/common.json":()=>Promise.resolve().then(()=>require("./common-BemjTKsn.cjs")),"./locales/it/common.json":()=>Promise.resolve().then(()=>require("./common-CUprL8ig.cjs"))}),`./locales/${t}/common.json`,4),xe(Object.assign({"./locales/de/navigation.json":()=>Promise.resolve().then(()=>require("./navigation-D8yOGHza.cjs")),"./locales/en/navigation.json":()=>Promise.resolve().then(()=>require("./navigation-rEtU7BPw.cjs")),"./locales/fr/navigation.json":()=>Promise.resolve().then(()=>require("./navigation-BI8iMTJl.cjs")),"./locales/it/navigation.json":()=>Promise.resolve().then(()=>require("./navigation-BTkWh95c.cjs"))}),`./locales/${t}/navigation.json`,4),xe(Object.assign({"./locales/de/auth.json":()=>Promise.resolve().then(()=>require("./auth-C5zpZ9k7.cjs")),"./locales/en/auth.json":()=>Promise.resolve().then(()=>require("./auth-DL47kvnl.cjs")),"./locales/fr/auth.json":()=>Promise.resolve().then(()=>require("./auth-B-hELPDB.cjs")),"./locales/it/auth.json":()=>Promise.resolve().then(()=>require("./auth-CyPkCta2.cjs"))}),`./locales/${t}/auth.json`,4),xe(Object.assign({"./locales/de/admin.json":()=>Promise.resolve().then(()=>require("./admin-xzsr0_qA.cjs")),"./locales/en/admin.json":()=>Promise.resolve().then(()=>require("./admin-Cc6DZlcU.cjs")),"./locales/fr/admin.json":()=>Promise.resolve().then(()=>require("./admin-BTW2xEuA.cjs")),"./locales/it/admin.json":()=>Promise.resolve().then(()=>require("./admin-C0suc2Qj.cjs"))}),`./locales/${t}/admin.json`,4),xe(Object.assign({"./locales/de/support.json":()=>Promise.resolve().then(()=>require("./support-CXovIlzp.cjs")),"./locales/en/support.json":()=>Promise.resolve().then(()=>require("./support-Bt_0KUwJ.cjs")),"./locales/fr/support.json":()=>Promise.resolve().then(()=>require("./support-DsU3adXz.cjs")),"./locales/it/support.json":()=>Promise.resolve().then(()=>require("./support-D_BPwt4n.cjs"))}),`./locales/${t}/support.json`,4),xe(Object.assign({"./locales/de/docs.json":()=>Promise.resolve().then(()=>require("./docs-sqOeJ3Lg.cjs")),"./locales/en/docs.json":()=>Promise.resolve().then(()=>require("./docs-BR4q7sou.cjs")),"./locales/fr/docs.json":()=>Promise.resolve().then(()=>require("./docs-CDz8QplV.cjs")),"./locales/it/docs.json":()=>Promise.resolve().then(()=>require("./docs-DCOsvfv7.cjs"))}),`./locales/${t}/docs.json`,4),xe(Object.assign({"./locales/de/ai.json":()=>Promise.resolve().then(()=>require("./ai-BGdFYXWS.cjs")),"./locales/en/ai.json":()=>Promise.resolve().then(()=>require("./ai-D_SXDYCZ.cjs")),"./locales/fr/ai.json":()=>Promise.resolve().then(()=>require("./ai-9gEEAcjc.cjs")),"./locales/it/ai.json":()=>Promise.resolve().then(()=>require("./ai-CVDdg8-U.cjs"))}),`./locales/${t}/ai.json`,4),xe(Object.assign({"./locales/de/communications.json":()=>Promise.resolve().then(()=>require("./communications-DBbKXpf1.cjs")),"./locales/en/communications.json":()=>Promise.resolve().then(()=>require("./communications-BPsS3Vfm.cjs")),"./locales/fr/communications.json":()=>Promise.resolve().then(()=>require("./communications-DElJaoVw.cjs")),"./locales/it/communications.json":()=>Promise.resolve().then(()=>require("./communications-BKaku0MU.cjs"))}),`./locales/${t}/communications.json`,4),xe(Object.assign({"./locales/de/entra.json":()=>Promise.resolve().then(()=>require("./entra-BadKCc7Y.cjs")),"./locales/en/entra.json":()=>Promise.resolve().then(()=>require("./entra-CfLYpxKq.cjs")),"./locales/fr/entra.json":()=>Promise.resolve().then(()=>require("./entra-Bc0Dwf7d.cjs")),"./locales/it/entra.json":()=>Promise.resolve().then(()=>require("./entra-DDgx1JoT.cjs"))}),`./locales/${t}/entra.json`,4),xe(Object.assign({"./locales/en/structure.json":()=>Promise.resolve().then(()=>require("./structure-BL5cd83u.cjs")),"./locales/fr/structure.json":()=>Promise.resolve().then(()=>require("./structure-BblXL_QG.cjs"))}),`./locales/${t}/structure.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/preferences.json":()=>Promise.resolve().then(()=>require("./preferences-DLJ9mTYQ.cjs")),"./locales/en/preferences.json":()=>Promise.resolve().then(()=>require("./preferences-pkUX3R0G.cjs")),"./locales/fr/preferences.json":()=>Promise.resolve().then(()=>require("./preferences-Di_IL1wh.cjs")),"./locales/it/preferences.json":()=>Promise.resolve().then(()=>require("./preferences-B65OLntJ.cjs"))}),`./locales/${t}/preferences.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/groups.json":()=>Promise.resolve().then(()=>require("./groups-aYHQCkbY.cjs")),"./locales/en/groups.json":()=>Promise.resolve().then(()=>require("./groups-C92n_AjP.cjs")),"./locales/fr/groups.json":()=>Promise.resolve().then(()=>require("./groups-8opu86IJ.cjs")),"./locales/it/groups.json":()=>Promise.resolve().then(()=>require("./groups-DwDEmB18.cjs"))}),`./locales/${t}/groups.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/en/ba.json":()=>Promise.resolve().then(()=>require("./ba-9HglDm-t.cjs")),"./locales/fr/ba.json":()=>Promise.resolve().then(()=>require("./ba-CXlHUyjN.cjs"))}),`./locales/${t}/ba.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-users.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-CsRMxznf.cjs")),"./locales/en/docs-administration-users.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-BUnDEWjL.cjs")),"./locales/fr/docs-administration-users.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-DRITa5fK.cjs")),"./locales/it/docs-administration-users.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-qLwE7c_z.cjs"))}),`./locales/${t}/docs-administration-users.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-permissions.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-BHJfnRA-.cjs")),"./locales/en/docs-administration-permissions.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-CXsWrgCA.cjs")),"./locales/fr/docs-administration-permissions.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-BLmrJB-I.cjs")),"./locales/it/docs-administration-permissions.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-BmiGStz4.cjs"))}),`./locales/${t}/docs-administration-permissions.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-Cmjpaxwy.cjs")),"./locales/en/docs-administration-tenants.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-CvYnhoo5.cjs")),"./locales/fr/docs-administration-tenants.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-xhQOAORE.cjs")),"./locales/it/docs-administration-tenants.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-CuHqwklv.cjs"))}),`./locales/${t}/docs-administration-tenants.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-ai.json":()=>Promise.resolve().then(()=>require("./docs-administration-ai-CPqGrO8q.cjs")),"./locales/en/docs-administration-ai.json":()=>Promise.resolve().then(()=>require("./docs-administration-ai-EVzVu3kS.cjs")),"./locales/fr/docs-administration-ai.json":()=>Promise.resolve().then(()=>require("./docs-administration-ai-B0zkD6zQ.cjs")),"./locales/it/docs-administration-ai.json":()=>Promise.resolve().then(()=>require("./docs-administration-ai-DngqfS6k.cjs"))}),`./locales/${t}/docs-administration-ai.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-workflows.json":()=>Promise.resolve().then(()=>require("./docs-administration-workflows-DRw16ooP.cjs")),"./locales/en/docs-administration-workflows.json":()=>Promise.resolve().then(()=>require("./docs-administration-workflows-Da6XQxlv.cjs")),"./locales/fr/docs-administration-workflows.json":()=>Promise.resolve().then(()=>require("./docs-administration-workflows-CofvuK9f.cjs")),"./locales/it/docs-administration-workflows.json":()=>Promise.resolve().then(()=>require("./docs-administration-workflows-DW4kFs3z.cjs"))}),`./locales/${t}/docs-administration-workflows.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-entra.json":()=>Promise.resolve().then(()=>require("./docs-administration-entra-D3hQEI3V.cjs")),"./locales/en/docs-administration-entra.json":()=>Promise.resolve().then(()=>require("./docs-administration-entra-griadux5.cjs")),"./locales/fr/docs-administration-entra.json":()=>Promise.resolve().then(()=>require("./docs-administration-entra-BbS4ZUu7.cjs")),"./locales/it/docs-administration-entra.json":()=>Promise.resolve().then(()=>require("./docs-administration-entra-D0KuJ7Ps.cjs"))}),`./locales/${t}/docs-administration-entra.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-applications-C6VsiHxH.cjs")),"./locales/en/docs-administration-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-applications-DRYyRp3S.cjs")),"./locales/fr/docs-administration-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-applications-BEepPuXf.cjs")),"./locales/it/docs-administration-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-applications-BiZBTxgS.cjs"))}),`./locales/${t}/docs-administration-applications.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-configuration.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-BdZl4hL4.cjs")),"./locales/en/docs-administration-configuration.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-DvZxFmnH.cjs")),"./locales/fr/docs-administration-configuration.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-CXro3iiT.cjs")),"./locales/it/docs-administration-configuration.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-B1YtxR_A.cjs"))}),`./locales/${t}/docs-administration-configuration.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-configuration-license.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-license-DSMqi4PQ.cjs")),"./locales/en/docs-administration-configuration-license.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-license-C3rm7u1h.cjs")),"./locales/fr/docs-administration-configuration-license.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-license-CJsMRPaR.cjs")),"./locales/it/docs-administration-configuration-license.json":()=>Promise.resolve().then(()=>require("./docs-administration-configuration-license-_LdQyRjT.cjs"))}),`./locales/${t}/docs-administration-configuration-license.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-template.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-template-HRqVNkqP.cjs")),"./locales/en/docs-administration-tenants-template.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-template-XQ-IiS31.cjs")),"./locales/fr/docs-administration-tenants-template.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-template-B3IDsztG.cjs")),"./locales/it/docs-administration-tenants-template.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-template-DKbpQgBH.cjs"))}),`./locales/${t}/docs-administration-tenants-template.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-business.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-business-BtAQiVRM.cjs")),"./locales/en/docs-administration-tenants-business.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-business-Cs4N4jrq.cjs")),"./locales/fr/docs-administration-tenants-business.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-business-XRmC4aRE.cjs")),"./locales/it/docs-administration-tenants-business.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-business-D1T8STQX.cjs"))}),`./locales/${t}/docs-administration-tenants-business.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-personal.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-personal-DHGVmv0D.cjs")),"./locales/en/docs-administration-tenants-personal.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-personal-Bk0D7emY.cjs")),"./locales/fr/docs-administration-tenants-personal.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-personal-DSnrN4MO.cjs")),"./locales/it/docs-administration-tenants-personal.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-personal-KFjQQGdW.cjs"))}),`./locales/${t}/docs-administration-tenants-personal.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-other.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-other-B5w2xFPJ.cjs")),"./locales/en/docs-administration-tenants-other.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-other-Dh2ohplZ.cjs")),"./locales/fr/docs-administration-tenants-other.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-other-WV4RsrVj.cjs")),"./locales/it/docs-administration-tenants-other.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-other-DeZKiNkH.cjs"))}),`./locales/${t}/docs-administration-tenants-other.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-permissions-assignments.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-assignments-BbAfGAzk.cjs")),"./locales/en/docs-administration-permissions-assignments.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-assignments-cv88prRo.cjs")),"./locales/fr/docs-administration-permissions-assignments.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-assignments-Clm4Yhy7.cjs")),"./locales/it/docs-administration-permissions-assignments.json":()=>Promise.resolve().then(()=>require("./docs-administration-permissions-assignments-Xtrdol6a.cjs"))}),`./locales/${t}/docs-administration-permissions-assignments.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-applications-BXTwlVt_.cjs")),"./locales/en/docs-administration-tenants-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-applications-DxKx9YEc.cjs")),"./locales/fr/docs-administration-tenants-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-applications-DehK43TA.cjs")),"./locales/it/docs-administration-tenants-applications.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-applications-D2SCJxWE.cjs"))}),`./locales/${t}/docs-administration-tenants-applications.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-access-requests.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-access-requests-CMJEiBDZ.cjs")),"./locales/en/docs-administration-tenants-access-requests.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-access-requests-BDCjPv_a.cjs")),"./locales/fr/docs-administration-tenants-access-requests.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-access-requests-DXBq6rZX.cjs")),"./locales/it/docs-administration-tenants-access-requests.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-access-requests-7mBPVsvv.cjs"))}),`./locales/${t}/docs-administration-tenants-access-requests.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-tenants-organisations.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-organisations-DV-_MnD2.cjs")),"./locales/en/docs-administration-tenants-organisations.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-organisations-BJS2qchs.cjs")),"./locales/fr/docs-administration-tenants-organisations.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-organisations-DDPYmh_7.cjs")),"./locales/it/docs-administration-tenants-organisations.json":()=>Promise.resolve().then(()=>require("./docs-administration-tenants-organisations-BWchU3XZ.cjs"))}),`./locales/${t}/docs-administration-tenants-organisations.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-platform-support-tickets.json":()=>Promise.resolve().then(()=>require("./docs-platform-support-tickets-nvIWiI_l.cjs")),"./locales/en/docs-platform-support-tickets.json":()=>Promise.resolve().then(()=>require("./docs-platform-support-tickets-yc0oKKrD.cjs")),"./locales/fr/docs-platform-support-tickets.json":()=>Promise.resolve().then(()=>require("./docs-platform-support-tickets-jObWdig-.cjs")),"./locales/it/docs-platform-support-tickets.json":()=>Promise.resolve().then(()=>require("./docs-platform-support-tickets-BtPIdbRr.cjs"))}),`./locales/${t}/docs-platform-support-tickets.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-users-dashboard.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-dashboard-D6Oy2YkN.cjs")),"./locales/en/docs-administration-users-dashboard.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-dashboard-sPBt_1c4.cjs")),"./locales/fr/docs-administration-users-dashboard.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-dashboard-BVpRmDsI.cjs")),"./locales/it/docs-administration-users-dashboard.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-dashboard-lQ9K3m9K.cjs"))}),`./locales/${t}/docs-administration-users-dashboard.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-users-references.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-references-Du_ykq8Q.cjs")),"./locales/en/docs-administration-users-references.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-references-CNWOU2Wq.cjs")),"./locales/fr/docs-administration-users-references.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-references-Dc8nUoSy.cjs")),"./locales/it/docs-administration-users-references.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-references-C5YUKBpW.cjs"))}),`./locales/${t}/docs-administration-users-references.json`,4).catch(()=>({default:{}})),xe(Object.assign({"./locales/de/docs-administration-users-groups.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-groups-WmOKFuUm.cjs")),"./locales/en/docs-administration-users-groups.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-groups-C6xh7MWi.cjs")),"./locales/fr/docs-administration-users-groups.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-groups-DgWpE7cP.cjs")),"./locales/it/docs-administration-users-groups.json":()=>Promise.resolve().then(()=>require("./docs-administration-users-groups-7NuH5xFT.cjs"))}),`./locales/${t}/docs-administration-users-groups.json`,4).catch(()=>({default:{}}))]);return{common:s.default,navigation:r.default,auth:a.default,admin:o.default,support:c.default,docs:i.default,ai:d.default,communications:u.default,entra:x.default,structure:m.default||{},preferences:f.default||{},groups:h.default||{},ba:v.default||{},docsAdministrationUsers:g.default||{},docsAdministrationPermissions:y.default||{},docsAdministrationTenants:p.default||{},docsAdministrationAi:b.default||{},docsAdministrationWorkflows:j.default||{},docsAdministrationEntra:S.default||{},docsAdministrationApplications:w.default||{},docsAdministrationConfiguration:P.default||{},docsAdministrationConfigurationLicense:$.default||{},docsAdministrationTenantsTemplate:A.default||{},docsAdministrationTenantsBusiness:k.default||{},docsAdministrationTenantsPersonal:R.default||{},docsAdministrationTenantsOther:L.default||{},docsAdministrationPermissionsAssignments:I.default||{},docsAdministrationTenantsApplications:C.default||{},docsAdministrationTenantsAccessRequests:O.default||{},docsAdministrationTenantsOrganisations:_.default||{},docsPlatformSupportTickets:E.default||{},docsAdministrationUsersDashboard:z.default||{},docsAdministrationUsersReferences:W.default||{},docsAdministrationUsersGroups:G.default||{}}}catch(s){return console.warn(`Failed to load language: ${t}`,s),null}},an={},nn=()=>{const t=localStorage.getItem("i18nextLng");if(t&&["en","fr","de","it"].includes(t))return t;const s=navigator.language.split("-")[0];return["en","fr","de","it"].includes(s)?s:"en"},Jt=nn();jt.use(Da).use(ne.initReactI18next).init({resources:an,lng:Jt,fallbackLng:"en",defaultNS:"common",ns:["common","navigation","auth","admin","support","docs","ai","communications","entra","structure","preferences","groups","ba","docsAdministrationUsers","docsAdministrationPermissions","docsAdministrationTenants","docsAdministrationAi","docsAdministrationWorkflows","docsAdministrationEntra","docsAdministrationApplications","docsAdministrationConfiguration","docsAdministrationConfigurationLicense","docsAdministrationTenantsTemplate","docsAdministrationTenantsBusiness","docsAdministrationTenantsPersonal","docsAdministrationTenantsOther","docsAdministrationPermissionsAssignments","docsAdministrationTenantsApplications","docsAdministrationTenantsAccessRequests","docsAdministrationTenantsOrganisations","docsPlatformSupportTickets","docsAdministrationUsersReferences","docsAdministrationUsersGroups"],interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator","htmlTag"],caches:["localStorage"]}});cr(Jt).then(t=>{t&&Object.entries(t).forEach(([s,r])=>{jt.addResourceBundle(Jt,s,r,!0,!0)})});const ls=async t=>{if(!jt.hasResourceBundle(t,"common")){const s=await cr(t);s&&Object.entries(s).forEach(([r,a])=>{jt.addResourceBundle(t,r,a,!0,!0)})}return jt.changeLanguage(t)},dr=n.createContext(void 0);function on(){if(typeof window>"u")return yt;try{const s=localStorage.getItem(ir);if(s){const r=JSON.parse(s);return{...yt,...r,borderRadius:{...yt.borderRadius,...r.borderRadius},itemPaletteKey:r.itemPaletteKey||os,colors:{light:ut(r.accentColorKey||"indigo"),dark:mt(r.accentColorKey||"indigo")}}}}catch{}const t=window.matchMedia("(prefers-color-scheme: dark)").matches;return{...yt,mode:t?"dark":"light"}}function At(t){const s=t.accentColorKey||"indigo",r=t.borderRadius;return{mode:t.theme||"dark",accentColorKey:s,borderRadius:{card:r?.card||"large",button:r?.button||"medium",badge:r?.badge||"medium",input:r?.input||"medium",modal:r?.modal||"xlarge",menuItem:r?.menuItem||"medium"},itemPaletteKey:t.itemPaletteKey||os,colors:{light:ut(s),dark:mt(s)}}}function ln(t){const s=document.documentElement,r=t.mode==="dark"?t.colors.dark:t.colors.light,a=Ue[t.accentColorKey]?.shades||Ue.indigo.shades,o=dt[t.itemPaletteKey]||dt.neutral,c=t.mode==="dark"?o.colors.dark:o.colors.light;t.mode==="dark"?s.classList.add("dark"):s.classList.remove("dark"),s.style.setProperty("--radius-card",Je[t.borderRadius.card]),s.style.setProperty("--radius-button",Je[t.borderRadius.button]),s.style.setProperty("--radius-badge",Je[t.borderRadius.badge]),s.style.setProperty("--radius-input",Je[t.borderRadius.input]),s.style.setProperty("--radius-modal",Je[t.borderRadius.modal]),s.style.setProperty("--radius-menu-item",Je[t.borderRadius.menuItem]),Object.entries(a).forEach(([i,d])=>{s.style.setProperty(`--color-accent-${i}`,d)}),s.style.setProperty("--item-color-light",c.light),s.style.setProperty("--item-color-medium",c.medium),s.style.setProperty("--item-color-dark",c.dark),s.style.setProperty("--item-color-border",c.border),s.style.setProperty("--bg-app",r.backgrounds.app),s.style.setProperty("--bg-primary",r.backgrounds.primary),s.style.setProperty("--bg-secondary",r.backgrounds.secondary),s.style.setProperty("--bg-tertiary",r.backgrounds.tertiary),s.style.setProperty("--bg-card",r.backgrounds.card),s.style.setProperty("--bg-hover",r.backgrounds.hover),s.style.setProperty("--bg-active",r.backgrounds.active),s.style.setProperty("--text-primary",r.text.primary),s.style.setProperty("--text-secondary",r.text.secondary),s.style.setProperty("--text-tertiary",r.text.tertiary),s.style.setProperty("--text-muted",r.text.muted),s.style.setProperty("--text-inverse",r.text.inverse),s.style.setProperty("--border-color",r.border.default),s.style.setProperty("--border-subtle",r.border.subtle),s.style.setProperty("--border-strong",r.border.strong),s.style.setProperty("--success-bg",r.status.success.bg),s.style.setProperty("--success-text",r.status.success.text),s.style.setProperty("--success-border",r.status.success.border),s.style.setProperty("--success-dot",r.status.success.dot),s.style.setProperty("--warning-bg",r.status.warning.bg),s.style.setProperty("--warning-text",r.status.warning.text),s.style.setProperty("--warning-border",r.status.warning.border),s.style.setProperty("--warning-dot",r.status.warning.dot),s.style.setProperty("--error-bg",r.status.error.bg),s.style.setProperty("--error-text",r.status.error.text),s.style.setProperty("--error-border",r.status.error.border),s.style.setProperty("--error-dot",r.status.error.dot),s.style.setProperty("--info-bg",r.status.info.bg),s.style.setProperty("--info-text",r.status.info.text),s.style.setProperty("--info-border",r.status.info.border),s.style.setProperty("--info-dot",r.status.info.dot),s.style.setProperty("--accent-bg",r.accentTransparent.bg),s.style.setProperty("--accent-text",r.accentTransparent.text),s.style.setProperty("--accent-border",r.accentTransparent.border)}function ur({children:t}){const[s,r]=n.useState(on),[a,o]=n.useState(!1),[c,i]=n.useState(null),[d,u]=n.useState(void 0),[x,m]=n.useState([]),{i18n:f}=ne.useTranslation(),h=n.useRef(null),v=n.useRef(!0),g=n.useRef(!1),y=n.useRef(!1),p=n.useCallback(async(E,z=void 0)=>{if(!localStorage.getItem("token")||y.current)return;let G=null;const J=localStorage.getItem("currentTenantId");if(z===void 0)J?G=J:G=null;else{if(z!==null&&J&&z!==J)return;G=z}try{o(!0),await It.preferences.updateTheme({mode:E.mode,accentColorKey:E.accentColorKey,borderRadius:{card:E.borderRadius.card,button:E.borderRadius.button,badge:E.borderRadius.badge,input:E.borderRadius.input,modal:E.borderRadius.modal,menuItem:E.borderRadius.menuItem},itemPaletteKey:E.itemPaletteKey,targetTenantId:G}),G&&!x.includes(G)&&m(pe=>[...pe,G])}catch(pe){console.error("[ThemeContext] ❌ Failed to save theme to server:",{error:pe,targetTenantId:G,mode:E.mode,accentColorKey:E.accentColorKey,localStorage_currentTenantId:localStorage.getItem("currentTenantId"),localStorage_currentTenantSlug:localStorage.getItem("currentTenantSlug")})}finally{o(!1)}},[x]),b=n.useCallback((E,z=void 0)=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{p(E,z)},1e3)},[p]);n.useLayoutEffect(()=>{ln(s)},[s]),n.useEffect(()=>{const E={mode:s.mode,borderRadius:s.borderRadius,accentColorKey:s.accentColorKey,itemPaletteKey:s.itemPaletteKey};localStorage.setItem(ir,JSON.stringify(E)),!y.current&&!v.current&&b(s,d),v.current=!1},[s,b,d]),n.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const j=n.useCallback(async E=>{const z=localStorage.getItem("token"),W=localStorage.getItem("currentTenantSlug");if(!z)return;const G=E==="global";if(!(!G&&!W))try{o(!0);const J=G?await je.preferences.getGlobal():await je.preferences.get();i(J.scope);const pe=At(J);v.current=!0,r(pe),g.current=!0,J.language&&J.language!==f.language&&(ls(J.language),document.documentElement.lang=J.language)}catch(J){console.error("[ThemeContext] Failed to load theme from server:",J)}finally{o(!1)}},[f]),S=n.useCallback(async()=>{const E=localStorage.getItem("token"),z=localStorage.getItem("currentTenantSlug");if(!(!E||!z))try{o(!0);const W=await je.preferences.applyToTenant();i(W.scope)}catch(W){throw console.error("[ThemeContext] Failed to create tenant-specific preferences:",W),W}finally{o(!1)}},[]),w=n.useCallback(async()=>{const E=localStorage.getItem("token"),z=localStorage.getItem("currentTenantSlug");if(!(!E||!z))try{o(!0);const W=await je.preferences.deleteTenantOverride();i(W.scope);const G=At(W);v.current=!0,r(G)}catch(W){throw console.error("[ThemeContext] Failed to delete tenant-specific preferences:",W),W}finally{o(!1)}},[]),P=n.useCallback(async()=>{if(localStorage.getItem("token"))try{const z=await je.preferences.getThemeOverrides();m(z)}catch(z){console.error("[ThemeContext] Failed to load tenant overrides:",z)}},[]),$=n.useCallback(async(E,z=!1)=>{if(h.current&&(clearTimeout(h.current),h.current=null),y.current=!0,g.current=!0,v.current=!0,u(E),z){y.current=!1;return}if(!localStorage.getItem("token")){y.current=!1;return}try{if(o(!0),E===null){const G=await je.preferences.getGlobal();i(G.scope);const J=At(G);v.current=!0,r(J)}else{const G=await je.preferences.getForTenant(E);i(G.scope);const J=At(G);v.current=!0,r(J)}}catch(G){console.error("[ThemeContext] Failed to load preferences for tenant:",G)}finally{o(!1),y.current=!1}},[]),A=n.useCallback(()=>{r(E=>({...E,mode:E.mode==="light"?"dark":"light",colors:{light:ut(E.accentColorKey),dark:mt(E.accentColorKey)}}))},[]),k=n.useCallback(E=>{r(z=>({...z,mode:E}))},[]),R=n.useCallback((E,z)=>{r(W=>({...W,borderRadius:{...W.borderRadius,[E]:z}}))},[]),L=n.useCallback(E=>{Ue[E]&&r(z=>({...z,accentColorKey:E,colors:{light:ut(E),dark:mt(E)}}))},[]),I=n.useCallback(E=>{dt[E]&&r(z=>({...z,itemPaletteKey:E}))},[]),C=n.useCallback(E=>{r(z=>{const W=E.accentColorKey||z.accentColorKey;return{...z,...E,borderRadius:{...z.borderRadius,...E.borderRadius},accentColorKey:W,itemPaletteKey:E.itemPaletteKey||z.itemPaletteKey,colors:{light:ut(W),dark:mt(W)}}})},[]),O=n.useCallback(()=>{r(yt)},[]),_=n.useCallback(E=>Je[s.borderRadius[E]],[s.borderRadius]);return e.jsx(dr.Provider,{value:{config:s,mode:s.mode,toggleMode:A,setMode:k,setBorderRadius:R,setAccentColor:L,setItemPalette:I,applyPreset:C,resetToDefault:O,getBorderRadius:_,loadFromServer:j,isSyncing:a,scopeInfo:c,applyToTenant:S,resetToGlobal:w,selectedThemeTenant:d,setSelectedThemeTenant:$,tenantOverrides:x,loadTenantOverrides:P},children:t})}function St(){const t=n.useContext(dr);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t}let ft=null,st=null;const cn={async getFeatureConfig(t){return ft||st||(st=(async()=>{try{return ft=(await ns.get("/api/config/features",{timeout:1e4,signal:t,headers:{"Content-Type":"application/json"}})).data,ft}finally{st=null}})(),st)},clearCache(){ft=null,st=null}},mr=n.createContext(void 0);function dn({children:t}){const[s,r]=n.useState(null),[a,o]=n.useState(!0);n.useEffect(()=>{const i=new AbortController;return cn.getFeatureConfig(i.signal).then(d=>{i.signal.aborted||r(d)}).catch(d=>{d.name==="CanceledError"||i.signal.aborted||(console.error("Failed to load feature config:",d),r({multiTenantEnabled:!0,enableB2B:!0,enableB2C:!0,useUrlRouting:!0}))}).finally(()=>{i.signal.aborted||o(!1)}),()=>i.abort()},[]);const c={config:s,isLoading:a,isMultiTenant:!0,isHybridMode:s?.multiTenantEnabled===!0&&s?.enableB2B===!1&&s?.enableB2C===!0,enableB2B:s?.enableB2B??!0,enableB2C:s?.enableB2C??!0,useUrlRouting:s?.useUrlRouting??!0};return e.jsx(mr.Provider,{value:c,children:t})}function cs(){const t=n.useContext(mr);if(!t)throw new Error("useFeatureConfig must be used within FeatureConfigProvider");return t}function ds(t,s){const r=t.toLowerCase(),a=s.toLowerCase();if(r==="*"||r===a)return!0;if(r.endsWith(".*")){const o=r.slice(0,-2);return a.startsWith(o+".")||a===o}return!1}function Tt(t,s){return t.includes("*")||s.includes("Super Administrator")||s.includes("Platform Administrator")}function un(t,s,r){if(!r||Tt(t,s))return!0;const a=r.toLowerCase(),o=a+".";for(const c of t){const i=c.toLowerCase();if(i===a||i.startsWith(o))return!0;if(i.endsWith(".*")){const d=i.slice(0,-1);if(a.startsWith(d)||o.startsWith(d))return!0}}return!1}const us=n.createContext(void 0),rt="token",at="user";function xr({children:t}){const[s,r]=n.useState(()=>{if(typeof window<"u"){const x=localStorage.getItem(at);if(x)try{return JSON.parse(x)}catch{return null}}return null}),[a,o]=n.useState(!0),c=n.useCallback((x,m)=>{localStorage.setItem(rt,x),localStorage.setItem(at,JSON.stringify(m)),r(m)},[]),i=n.useCallback(async()=>{try{localStorage.getItem(rt)&&await D.post("/api/auth/logout")}catch{}localStorage.removeItem(rt),localStorage.removeItem("refreshToken"),localStorage.removeItem(at),r(null),window.location.href="/login"},[]),d=n.useCallback(x=>{if(!s)return!1;if(Tt(s.permissions,s.roles)||s.permissions.includes(x))return!0;for(const m of s.permissions)if(ds(m,x))return!0;return!1},[s]),u=n.useCallback(async()=>{if(localStorage.getItem(rt))try{const m=await D.get("/api/auth/me");r(m),localStorage.setItem(at,JSON.stringify(m))}catch(m){console.error("Failed to refresh permissions:",m)}},[]);return n.useEffect(()=>{localStorage.getItem(rt)&&!s?D.get("/api/auth/me").then(m=>{r(m),localStorage.setItem(at,JSON.stringify(m))}).catch(()=>{localStorage.removeItem(rt),localStorage.removeItem("refreshToken"),localStorage.removeItem(at)}).finally(()=>o(!1)):o(!1)},[s]),e.jsx(us.Provider,{value:{user:s,isAuthenticated:!!s,isLoading:a,login:c,logout:i,hasPermission:d,refreshPermissions:u},children:t})}function Ae(){const t=n.useContext(us);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function mn(){return n.useContext(us)??null}const pr=n.createContext(void 0);function hr({children:t}){const[s,r]=n.useState(null),[a,o]=n.useState(null),[c,i]=n.useState(!0),[d,u]=n.useState(null),x=n.useRef(null),m=n.useCallback(async g=>{try{i(!0),u(null);const[y,p]=await Promise.all([D.get("/api/administration/license",{signal:g}),D.get("/api/administration/license/usage",{signal:g}).catch(()=>null)]);g?.aborted||(r(y),o(p))}catch(y){if(y instanceof Error&&y.name==="CanceledError"||g?.aborted)return;u(y instanceof Error?y.message:"Failed to load license info"),console.error("Failed to fetch license:",y)}finally{g?.aborted||i(!1)}},[]);n.useEffect(()=>{x.current?.abort();const g=new AbortController;return x.current=g,m(g.signal),()=>g.abort()},[m]);const f=n.useCallback(g=>s?s.enabledFeatures.includes("*")?!0:s.enabledFeatures.some(y=>y.toLowerCase()===g.toLowerCase()):!1,[s]),h=n.useCallback(async()=>{x.current?.abort();const g=new AbortController;x.current=g,await m(g.signal)},[m]),v=n.useCallback(async(g,y)=>{try{const p=await D.post("/api/administration/license/activate",{licenseKey:g,apiKey:y||null});return p.success?(await h(),{success:!0}):{success:!1,error:p.errorMessage||"Activation failed"}}catch(p){return{success:!1,error:p instanceof Error?p.message:"Activation failed"}}},[h]);return e.jsx(pr.Provider,{value:{license:s,usage:a,isLoading:c,error:d,isFeatureEnabled:f,isReadOnlyMode:s?.isReadOnlyMode??!1,refreshLicense:h,activateLicense:v},children:t})}function Ge(){const t=n.useContext(pr);if(t===void 0)throw new Error("useLicense must be used within a LicenseProvider");return t}const gr=n.createContext(void 0),Ve="currentTenantId",We="currentTenantSlug",_e="isGlobalView";function xn({children:t}){const{isAuthenticated:s,user:r,refreshPermissions:a}=Ae(),{isLoading:o}=cs(),[c,i]=n.useState(null),[d,u]=n.useState([]),[x,m]=n.useState(!0),[f,h]=n.useState(null),[v,g]=n.useState(()=>localStorage.getItem(_e)==="true"),y=n.useRef(!1),p=n.useRef(""),b=d.filter(C=>C.type==="Business"),j=d.find(C=>C.type==="Personal")||null,S=n.useCallback((C,O)=>{if(u(C),C.length===0){i(null),g(!1),localStorage.removeItem(Ve),localStorage.removeItem(We),localStorage.removeItem(_e),m(!1);return}const _=localStorage.getItem(Ve),E=_?C.find(J=>J.id===_):null;if(E&&E.status==="Active"){i(E),g(!1),localStorage.setItem(Ve,E.id),localStorage.setItem(We,E.slug),localStorage.removeItem(_e),m(!1);return}if(localStorage.getItem(_e)==="true"){g(!0),i(null),m(!1);return}const W=C.find(J=>J.isDefault&&J.status==="Active");if(W){i(W),g(!1),localStorage.setItem(Ve,W.id),localStorage.setItem(We,W.slug),localStorage.removeItem(_e),m(!1);return}if(O){g(!0),i(null),localStorage.setItem(_e,"true"),m(!1);return}const G=C.find(J=>J.status==="Active");i(G||null),G&&(localStorage.setItem(Ve,G.id),localStorage.setItem(We,G.slug)),m(!1)},[]),w=n.useCallback(async C=>{const O=d.find(_=>_.id===C);if(!O)throw new Error("Tenant not found");if(O.status!=="Active")throw new Error("Cannot switch to inactive tenant");g(!1),localStorage.removeItem(_e),i(O),localStorage.setItem(Ve,C),localStorage.setItem(We,O.slug),await a()},[d,a]),P=n.useCallback(async()=>{g(!0),localStorage.setItem(_e,"true"),i(null),localStorage.removeItem(Ve),localStorage.removeItem(We),await a()},[a]),$=n.useCallback(async()=>{g(!1),localStorage.removeItem(_e);const C=d.find(E=>E.isDefault&&E.status==="Active"),O=d.find(E=>E.status==="Active"),_=C||O||null;_&&(i(_),localStorage.setItem(Ve,_.id),localStorage.setItem(We,_.slug)),await a()},[d,a]),A=n.useCallback(async C=>{try{await je.myTenants.setDefault(C),u(O=>O.map(E=>({...E,isDefault:E.id===C}))),await w(C)}catch(O){throw console.error("[TenantContext] Failed to set default tenant:",O),O}},[w]),k=n.useCallback(async()=>{try{await je.myTenants.clearDefault(),u(C=>C.map(O=>({...O,isDefault:!1}))),await P()}catch(C){throw console.error("[TenantContext] Failed to clear default tenant:",C),C}},[P]),R=n.useCallback(async()=>{m(!0),h(null);try{await a()}catch(C){console.error("Failed to refresh tenants:",C),h("Failed to refresh tenants")}finally{m(!1)}},[a]);n.useEffect(()=>{if(!s||!r){y.current&&(u([]),i(null),m(!1),y.current=!1,p.current="");return}const C=r.tenants||[],O=C.map(_=>`${_.id}:${_.status}:${_.isDefault}`).sort((_,E)=>_.localeCompare(E)).join(",");if(!y.current||O!==p.current){y.current=!0,p.current=O;const _=Tt(r.permissions||[],r.roles||[]);S(C,_),localStorage.getItem(We)&&a().catch(z=>console.error("[TenantContext] Failed to refresh permissions after tenant init:",z))}},[s,r,S,a]),n.useEffect(()=>{s||(i(null),u([]),g(!1),localStorage.removeItem(Ve),localStorage.removeItem(We),localStorage.removeItem(_e))},[s]);const L=r?Tt(r.permissions||[],r.roles||[]):!1,I={currentTenant:c,userTenants:d,b2bTenants:b,personalTenant:j,isLoading:x||o,error:f,switchTenant:w,setDefaultTenant:A,clearDefaultTenant:k,refreshTenants:R,hasMultipleTenants:d.filter(C=>C.status==="Active").length>1,isCurrentTenantOwner:c?.isOwner??!1,hasGlobalRoles:L,isGlobalView:v,enterGlobalView:P,exitGlobalView:$};return e.jsx(gr.Provider,{value:I,children:t})}function Ee(){const t=n.useContext(gr);if(t===void 0)throw new Error("useTenant must be used within a TenantProvider");return t}const Rt=5,fr=n.createContext(null);function br({children:t}){const{i18n:s}=ne.useTranslation(),{isAuthenticated:r}=Ae(),{currentTenant:a,isLoading:o}=Ee(),[c,i]=n.useState([]),[d,u]=n.useState(!1),[x,m]=n.useState(null),[f,h]=n.useState(!1),v=n.useCallback(()=>{h(!0)},[]),g=n.useCallback(()=>{h(!1)},[]),y=n.useCallback(async()=>{try{u(!0),m(null);const k=(await D.get("/api/navigation/module-favorites")).map(R=>({id:R.id,code:R.code,label:R.label,icon:R.icon||"Star",route:R.route||"",applicationId:R.applicationId,applicationCode:R.applicationCode,applicationLabel:R.applicationLabel,displayOrder:R.displayOrder}));i(k)}catch(A){console.error("Failed to load favorite modules:",A),m("Erreur lors du chargement des favoris"),i([])}finally{u(!1)}},[]);n.useEffect(()=>{r&&!o?y():r||(i([]),m(null))},[r,o,a,y]),n.useEffect(()=>{const A=()=>{r&&!o&&y()};return s.on("languageChanged",A),()=>{s.off("languageChanged",A)}},[s,r,o,y]);const p=n.useCallback(async A=>{if(c.length>=Rt||c.some(k=>k.id===A.id))return!1;try{return m(null),await D.post(`/api/navigation/module-favorites/${A.id}`),i(k=>[...k,{...A,displayOrder:k.length+1}]),!0}catch(k){return console.error("Failed to add favorite module:",k),await y(),!1}},[c,y]),b=n.useCallback(async A=>{try{return m(null),await D.delete(`/api/navigation/module-favorites/${A}`),i(k=>k.filter(R=>R.id!==A)),!0}catch(k){return console.error("Failed to remove favorite module:",k),await y(),!1}},[y]),j=n.useCallback(A=>c.some(k=>k.id===A),[c]),S=n.useCallback(async A=>j(A.id)?await b(A.id):await p(A),[j,b,p]),w=n.useCallback(async A=>{const k=A.slice(0,Rt),R=k.map(I=>I.id),L=[...c];i(k.map((I,C)=>({...I,displayOrder:C+1})));try{return m(null),await D.put("/api/navigation/module-favorites/reorder",R),!0}catch(I){return console.error("Failed to reorder favorite modules:",I),i(L),!1}},[c]),P=c.length<Rt;return e.jsx(fr.Provider,{value:{favorites:c,loading:d,error:x,addFavorite:p,removeFavorite:b,toggleFavorite:S,isFavorite:j,reorderFavorites:w,canAddMore:P,maxFavorites:Rt,reload:y,expandFavorites:f,triggerExpand:v,clearExpand:g,requiresTenant:!1},children:t})}function ze(){const t=n.useContext(fr);if(!t)throw new Error("useFavorites must be used within a FavoritesProvider");return t}const vr="smartstack-sidebar-collapsed",yr=n.createContext(void 0);function pn(){if(typeof window>"u")return!1;try{return localStorage.getItem(vr)==="true"}catch{return!1}}function jr({children:t}){const[s,r]=n.useState(pn);n.useEffect(()=>{localStorage.setItem(vr,String(s))},[s]);const a=n.useCallback(()=>{r(i=>!i)},[]),o=n.useCallback(i=>{r(i)},[]),c=s?64:256;return e.jsx(yr.Provider,{value:{isCollapsed:s,toggleCollapsed:a,setCollapsed:o,sidebarWidth:c},children:t})}function Lt(){const t=n.useContext(yr);if(t===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return t}const hn=["login","callback","logout","onboarding","system","applications"],wr=n.createContext(void 0);function gn(t){let s=t.split("/").filter(Boolean);return s.length>=2&&s[0]==="t"&&(s=s.slice(2)),s.length===0?{app:null,module:null}:hn.includes(s[0])?{app:null,module:null}:{app:s[0]||null,module:s[1]||null}}function ms({children:t}){const s=N.useLocation(),{i18n:r}=ne.useTranslation(),{currentTenant:a,isLoading:o,isGlobalView:c}=Ee(),[i,d]=n.useState(null),[u,x]=n.useState([]),[m,f]=n.useState(!0),h=n.useRef(!1),v=n.useRef(void 0),g=n.useRef(0),{app:y,module:p}=gn(s.pathname),b=n.useCallback(async()=>{try{const I=await D.get("/api/navigation/menu");d(I)}catch(I){console.error("Failed to fetch menu:",I)}},[]),j=n.useCallback(async()=>{try{const I=await D.get("/api/navigation/favorites");x(I)}catch(I){console.error("Failed to fetch favorites:",I)}},[]),S=n.useCallback(async()=>{const I=++g.current;if(f(!0),await b(),I===g.current){if(a){if(await j(),I!==g.current)return}else x([]);f(!1)}},[b,j,a]);n.useEffect(()=>{const I=localStorage.getItem("token"),C=c?"global":a?.id??"none";if(!(!I||o)){if(!h.current){h.current=!0,v.current=C,S();return}C!==v.current&&(v.current=C,S())}},[a?.id,c,o]),n.useEffect(()=>{const I=()=>{localStorage.getItem("token")&&S()};return r.on("languageChanged",I),()=>{r.off("languageChanged",I)}},[r,S]);const w=n.useCallback(I=>I.startsWith("core_")?I.slice(5):I.startsWith("ext_")?I.slice(4):I,[]),P=n.useCallback((I,C)=>I&&I.split("/").filter(Boolean)[C]||null,[]),$=n.useCallback(()=>i?.applications.find(I=>P(I.route,0)===y||w(I.code)===y),[i,y,P,w]),A=n.useCallback(()=>$()?.modules.find(C=>P(C.route,1)===p||w(C.code)===p),[$,p,P,w]),k=n.useCallback(I=>i?.applications.filter(C=>C.zone===I)||[],[i]),R=n.useCallback(I=>u.some(C=>C.id===I),[u]),L=n.useCallback(async I=>{if(a)try{R(I)?(await D.delete(`/api/navigation/favorites/${I}`),x(C=>C.filter(O=>O.id!==I))):(await D.post(`/api/navigation/favorites/${I}`,{}),await j())}catch(C){console.error("Failed to toggle favorite:",C)}},[a,R,j]);return e.jsx(wr.Provider,{value:{menu:i,favorites:u,currentAppCode:y,currentModuleCode:p,isLoading:m,getCurrentApplication:$,getCurrentModule:A,getApplicationsByZone:k,getApplicationsForContext:k,toggleFavorite:L,isFavorite:R,refreshMenu:S},children:t})}function Re(){const t=n.useContext(wr);if(t===void 0)throw new Error("useNavigation must be used within a NavigationProvider");return t}const Nr=n.createContext(null);function Sr({children:t}){const{isAuthenticated:s,refreshPermissions:r}=Ae(),{refreshMenu:a}=Re(),o=n.useRef(null),[c,i]=n.useState(ie.HubConnectionState.Disconnected),d=n.useRef(new Set),u=n.useRef(new Set),x=n.useRef(!1),m=n.useCallback(async()=>{if(!x.current){x.current=!0;try{await Promise.all([r(),a()])}catch(p){console.error("[SignalR] Failed to refresh permissions:",p)}finally{x.current=!1}}},[r,a]),f=n.useCallback(async()=>{const p=localStorage.getItem("token");if(p&&!(o.current?.state===ie.HubConnectionState.Connected||o.current?.state===ie.HubConnectionState.Connecting))try{const b=new ie.HubConnectionBuilder().withUrl("/hubs/notifications",{accessTokenFactory:()=>p}).withAutomaticReconnect({nextRetryDelayInMilliseconds:j=>j.previousRetryCount===0?0:j.previousRetryCount===1?2e3:j.previousRetryCount===2?1e4:j.previousRetryCount<5?3e4:null}).configureLogging(ie.LogLevel.Warning).build();b.on("ReceiveNotification",j=>{d.current.forEach(S=>S(j))}),b.on("UnreadCountUpdate",j=>{u.current.forEach(S=>S(j))}),b.on("PermissionsChanged",m),b.onreconnecting(()=>{i(ie.HubConnectionState.Reconnecting)}),b.onreconnected(()=>{i(ie.HubConnectionState.Connected)}),b.onclose(()=>{i(ie.HubConnectionState.Disconnected)}),await b.start(),o.current=b,i(ie.HubConnectionState.Connected)}catch(b){console.error("[SignalR] Failed to connect:",b),i(ie.HubConnectionState.Disconnected)}},[m]),h=n.useCallback(async()=>{if(o.current)try{await o.current.stop(),o.current=null,i(ie.HubConnectionState.Disconnected)}catch(p){console.error("[SignalR] Failed to disconnect:",p)}},[]);n.useEffect(()=>(s?f():h(),()=>{h()}),[s,f,h]);const v=n.useCallback(p=>(d.current.add(p),()=>{d.current.delete(p)}),[]),g=n.useCallback(p=>(u.current.add(p),()=>{u.current.delete(p)}),[]),y={isConnected:c===ie.HubConnectionState.Connected,connectionState:c,onNotification:v,onUnreadCountUpdate:g};return e.jsx(Nr.Provider,{value:y,children:t})}function Cr(){const t=n.useContext(Nr);if(!t)throw new Error("useSignalRContext must be used within a SignalRProvider");return t}const Et={register:async t=>D.post("/api/auth/register",t),confirmEmail:async t=>D.post("/api/auth/confirm-email",{token:t}),resendConfirmation:async t=>D.post("/api/auth/resend-confirmation",{email:t}),forgotPassword:async t=>D.post("/api/auth/forgot-password",{email:t}),resetPassword:async(t,s)=>D.post("/api/auth/reset-password",{token:t,newPassword:s}),login:async(t,s)=>{const r=await D.post("/api/auth/login",{email:t,password:s});return r.token&&(localStorage.setItem("token",r.token),localStorage.setItem("refreshToken",r.refreshToken)),r},logout:async()=>{try{await D.post("/api/auth/logout")}finally{localStorage.removeItem("token"),localStorage.removeItem("refreshToken"),localStorage.removeItem("user")}},changePassword:async(t,s)=>D.post("/api/auth/change-password",{currentPassword:t,newPassword:s}),refreshSession:async()=>{const t=await D.post("/api/auth/refresh");return t.token&&(localStorage.setItem("token",t.token),localStorage.setItem("refreshToken",t.refreshToken)),t},getSessionInfo:async t=>D.get("/api/auth/session-info",{signal:t?.signal})};function kr(t={}){const{checkIntervalMs:s=6e4,onSessionExpired:r,onWarningThreshold:a,enabled:o=!0}=t,[c,i]=n.useState({isActive:!0,timeRemainingSeconds:0,isWarning:!1,sessionInfo:null}),[d,u]=n.useState(!1),x=n.useRef(!1),m=n.useRef(null),f=n.useRef(null),h=n.useCallback(async g=>{if(!o)return;if(!localStorage.getItem("token")){i(p=>({...p,isActive:!1}));return}try{const p=await Et.getSessionInfo({signal:g});if(g?.aborted)return;const b=Math.min(p.timeUntilIdleExpirySeconds,p.timeUntilAbsoluteExpirySeconds);i({isActive:!0,timeRemainingSeconds:b,isWarning:p.isWarningThreshold,sessionInfo:p}),p.isWarningThreshold&&!x.current&&(x.current=!0,a?.()),p.isWarningThreshold||(x.current=!1)}catch(p){if(p instanceof Error&&p.name==="CanceledError"||g?.aborted)return;i(b=>({...b,isActive:!1})),r?.()}},[o,r,a]),v=n.useCallback(async()=>{if(d)return!1;u(!0);try{return await Et.refreshSession(),x.current=!1,await h(),!0}catch{return i(g=>({...g,isActive:!1})),!1}finally{u(!1)}},[d,h]);return n.useEffect(()=>{if(!o)return;f.current?.abort();const g=new AbortController;return f.current=g,h(g.signal),m.current=setInterval(()=>h(),s),()=>{g.abort(),m.current&&clearInterval(m.current)}},[o,s,h]),n.useEffect(()=>{if(!o)return;const g=()=>{c.isWarning&&h()},y=["mousedown","keydown","touchstart","scroll"];return y.forEach(p=>{window.addEventListener(p,g,{passive:!0})}),()=>{y.forEach(p=>{window.removeEventListener(p,g)})}},[o,c.isWarning,h]),{...c,isRefreshing:d,refreshSession:v,checkSession:h}}function fn(t){if(t<=0)return"0:00";const s=Math.floor(t/60),r=t%60;if(s>=60){const a=Math.floor(s/60),o=s%60;return`${a}h ${o}min`}return`${s}:${r.toString().padStart(2,"0")}`}function Ar({isOpen:t,timeRemainingSeconds:s,onExtendSession:r,onLogout:a}){const{t:o}=ne.useTranslation("common"),[c,i]=n.useState(!1),[d,u]=n.useState(s);n.useEffect(()=>{u(s)},[s]),n.useEffect(()=>{if(!t||d<=0)return;const f=setInterval(()=>{u(h=>h<=1?(a(),0):h-1)},1e3);return()=>clearInterval(f)},[t,d,a]);const x=async()=>{i(!0);try{await r()||a()}finally{i(!1)}};if(!t)return null;const m=Math.max(0,Math.min(100,d/300*100));return e.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:e.jsxs("div",{className:"relative w-full max-w-md bg-[var(--bg-card)] rounded-2xl shadow-2xl border border-amber-500/30 overflow-hidden animate-in fade-in zoom-in duration-200",children:[e.jsx("div",{className:"absolute top-0 left-0 h-1 bg-amber-500/30 w-full",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-amber-500 to-orange-500 transition-all duration-1000 ease-linear",style:{width:`${m}%`}})}),e.jsxs("div",{className:"p-6 pt-8",children:[e.jsxs("div",{className:"flex flex-col items-center text-center mb-6",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-amber-500/20 flex items-center justify-center mb-4",children:e.jsx(l.Clock,{className:"w-8 h-8 text-amber-500"})}),e.jsx("h2",{className:"text-xl font-semibold text-[var(--text-primary)] mb-2",children:o("session.warningTitle","Session Expiring")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-4",children:o("session.warningMessage","Your session will expire due to inactivity.")}),e.jsx("div",{className:"text-4xl font-mono font-bold text-amber-500 tabular-nums",children:fn(d)}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-2",children:o("session.remainingTime","remaining")})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("button",{onClick:a,className:"flex-1 flex items-center justify-center gap-2 px-6 py-3 rounded-xl border border-[var(--border-color)] text-[var(--text-secondary)] hover:bg-[var(--bg-hover)] transition-all font-medium",children:[e.jsx(l.LogOut,{className:"w-4 h-4"}),o("session.logout","Logout")]}),e.jsxs("button",{onClick:x,disabled:c,className:"flex-1 flex items-center justify-center gap-2 px-6 py-3 rounded-xl font-medium transition-all bg-gradient-to-r from-amber-500 to-orange-500 text-white hover:from-amber-600 hover:to-orange-600 shadow-lg shadow-amber-500/30 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(l.RefreshCw,{className:`w-4 h-4 ${c?"animate-spin":""}`}),c?o("session.extending","Extending..."):o("session.extend","Continue Session")]})]})]})]})})}const bn=n.createContext(void 0);function Rr({children:t}){const{isAuthenticated:s,logout:r}=Ae(),a=n.useCallback(()=>{localStorage.removeItem("token"),localStorage.removeItem("refreshToken"),localStorage.removeItem("user"),window.location.href="/login?reason=session_expired"},[]),{isActive:o,timeRemainingSeconds:c,isWarning:i,refreshSession:d}=kr({enabled:s,checkIntervalMs:3e4,onSessionExpired:a}),u=n.useCallback(async()=>{try{await Et.logout()}finally{r()}},[r]),x=n.useCallback(async()=>await d(),[d]);return e.jsxs(bn.Provider,{value:{isSessionActive:o,timeRemainingSeconds:c,isWarning:i,refreshSession:d},children:[t,e.jsx(Ar,{isOpen:i&&s,timeRemainingSeconds:c,onExtendSession:x,onLogout:u})]})}const vn=150;function yn({children:t}){const s=mn(),r=s?.isAuthenticated??!1,a=s?.isLoading??!0,{currentTenant:o,isLoading:c,isGlobalView:i}=Ee(),{setSelectedThemeTenant:d,loadFromServer:u}=St(),x=n.useRef(null),m=n.useRef(!1),f=n.useRef(null),h=n.useRef(null),v=n.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]),g=n.useCallback(()=>x.current==="global"?!1:(v(),h.current=null,x.current="global",m.current=!0,u("global"),d(null,!0),!0),[v,u,d]),y=n.useCallback((j,S)=>{h.current=j,f.current=setTimeout(()=>{h.current===j&&(x.current=j,m.current=!0,h.current=null,d(j,!1)),f.current=null},vn)},[d]),p=n.useCallback(()=>{if(!o)return;const j=o.id!==x.current,S=h.current!==null&&h.current!==o.id;!j&&!S||(v(),j?y(o.id,o.slug):h.current=null)},[o,v,y]),b=n.useCallback(()=>{v(),x.current=null,h.current=null,m.current=!1},[v]);return n.useEffect(()=>{if(!r){b();return}if(!(a||c)){if(i&&!o){g();return}o&&p()}},[r,a,c,o,i,g,p,b]),n.useEffect(()=>()=>{v()},[v]),e.jsx(e.Fragment,{children:t})}function jn(t){const s=t.message.toLowerCase(),r=t.name.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("failed to fetch")||s.includes("econnrefused")||s.includes("timeout")?"network":s.includes("401")||s.includes("403")||s.includes("unauthorized")||s.includes("forbidden")||s.includes("permission")?"permission":s.includes("404")||s.includes("not found")?"notFound":r.includes("validation")||s.includes("validation")||s.includes("invalid")?"validation":"technical"}function wn(){const t=Date.now().toString(36),s=Math.random().toString(36).substring(2,6);return`ERR-${t}-${s}`.toUpperCase()}const Nn={network:{icon:l.WifiOff,color:"text-orange-500",bgColor:"bg-orange-500/10"},permission:{icon:l.ShieldX,color:"text-red-500",bgColor:"bg-red-500/10"},notFound:{icon:l.FileWarning,color:"text-yellow-500",bgColor:"bg-yellow-500/10"},validation:{icon:l.AlertTriangle,color:"text-amber-500",bgColor:"bg-amber-500/10"},technical:{icon:l.Bug,color:"text-red-500",bgColor:"bg-red-500/10"}};function Pr({error:t,resetErrorBoundary:s}){const{t:r}=ne.useTranslation("common"),[a,o]=n.useState(!1),[c]=n.useState(()=>wn()),i=jn(t),d=Nn[i],u=d.icon,x=()=>{window.history.length>2&&document.referrer?window.location.href=document.referrer:window.history.length>2?(window.history.back(),setTimeout(()=>window.location.reload(),50)):window.location.href="/"};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-[var(--bg-primary)] p-4",children:e.jsx("div",{className:"max-w-lg w-full p-8 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-2xl shadow-xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:`w-16 h-16 rounded-full ${d.bgColor} flex items-center justify-center mb-6`,children:e.jsx(u,{className:`w-8 h-8 ${d.color}`})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:r(`errors.${i}.title`,{defaultValue:r("errors.technical.title")})}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-4",children:r(`errors.${i}.description`,{defaultValue:r("errors.technical.description")})}),e.jsxs("div",{className:"mb-6 px-3 py-1.5 bg-[var(--bg-tertiary)] rounded-lg border border-[var(--border-color)]",children:[e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)]",children:[r("errors.errorId"),": "]}),e.jsx("span",{className:"text-xs font-mono text-[var(--text-secondary)]",children:c})]}),!1,e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[e.jsxs("button",{onClick:s,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white font-medium transition-all",children:[e.jsx(l.RefreshCw,{className:"w-4 h-4"}),r("errors.retry")]}),e.jsxs("button",{onClick:x,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.ArrowLeft,{className:"w-4 h-4"}),r("errors.goBack")]}),e.jsxs("a",{href:"/",className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.Home,{className:"w-4 h-4"}),r("errors.home")]})]}),e.jsxs("p",{className:"mt-6 text-sm text-[var(--text-tertiary)]",children:[r("errors.persistsHelp")," ",e.jsx("a",{href:"mailto:support@atlashub.ch",className:"text-[var(--color-accent-500)] hover:underline",children:r("errors.contactSupport")})]})]})})})}function Sn(t,s){Pe.logCritical(t,"GlobalErrorBoundary",{componentStack:s.componentStack})}function Cn(){window.location.reload()}function Tr({children:t}){return e.jsx(nr.ErrorBoundary,{FallbackComponent:Pr,onError:Sn,onReset:Cn,children:t})}const xs="/api/myspace/application-tracking",kn="00000000-0000-0000-0000-000000000000",Ns=t=>!!t&&t!==kn,Er=t=>{const s=t.match(/^\/t\/[^/]+(\/.*)$/);return s?s[1]:t},An=t=>{const s=Er(t);return s.startsWith("/administration/")||s.startsWith("/support/")||s.startsWith("/myspace/")},$r=(t,s)=>{if(!t||typeof t!="object"||!("status"in t))return!0;const r=t.status;return!s.includes(r??-1)},Rn=async(t,s)=>{const r=new Date,a=Math.floor((r.getTime()-s.getTime())/1e3);try{await D.post(`${xs}/end`,{accessId:t,endedAt:r.toISOString(),durationSeconds:a})}catch(o){$r(o,[401,408])&&console.error("Failed to end page tracking:",o)}},Pn=async t=>{const s=new Date;try{return(await D.post(`${xs}/start`,{route:t,accessedAt:s.toISOString()})).accessId}catch(r){return $r(r,[401])&&console.error("Failed to track page access:",r),null}},Tn=(t,s)=>{const r=localStorage.getItem("token");if(!r)return;const a=new Date,o=Math.floor((a.getTime()-s.getTime())/1e3);fetch(`${xs}/end`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({accessId:t,endedAt:a.toISOString(),durationSeconds:o}),keepalive:!0}).catch(()=>{})};function Ir(){const t=N.useLocation(),s=n.useRef(new Date),r=n.useRef(null),a=n.useRef(!1);n.useEffect(()=>a.current?void 0:((async()=>{const c=Er(t.pathname);An(c)&&(a.current=!0,Ns(r.current)&&await Rn(r.current,s.current),s.current=new Date,r.current=await Pn(c),a.current=!1)})(),()=>{Ns(r.current)&&Tn(r.current,s.current)}),[t.pathname])}function En(){return Ir(),null}function Lr(){return N.useInRouterContext()?e.jsx(En,{}):null}const bt="/api/administration/tenants/tenant-analytics",Ss={getDashboardStats:async(t=30)=>await D.get(`${bt}/dashboard`,{params:{period:t}}),getTopTenants:async(t=10,s=30,r="access")=>await D.get(`${bt}/top-tenants`,{params:{limit:t,period:s,sortBy:r}}),getTrends:async(t=30)=>await D.get(`${bt}/trends`,{params:{period:t}}),trackStart:async t=>await D.post(`${bt}/track/start`,{tenantId:t}),trackEnd:async t=>{await D.post(`${bt}/track/end`,{accessId:t})}},$n="/api/administration/tenants/tenant-analytics";function In(){const{currentTenant:t}=Ee(),{isAuthenticated:s}=Ae(),r=n.useRef(null),a=n.useRef(null),o=n.useRef(!1);n.useEffect(()=>{if(!s)return;const c=window.location.pathname;if(c.startsWith("/auth/")||c.startsWith("/login"))return;const i=t?.id??null;return i===a.current||o.current?void 0:(o.current=!0,(async()=>{if(r.current){try{await Ss.trackEnd(r.current)}catch{}r.current=null}if(a.current=i,i)try{const u=await Ss.trackStart(i);r.current=u.accessId}catch{r.current=null}o.current=!1})(),()=>{if(r.current){const u=localStorage.getItem("token");if(!u)return;fetch(`${$n}/track/end`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`},body:JSON.stringify({accessId:r.current}),keepalive:!0}).catch(()=>{}),r.current=null,a.current=null}})},[t?.id,s])}function Dr(){return In(),null}const Dt=n.createContext(null);function Mr(){const t=n.useContext(Dt);if(!t)throw new Error("useSlotFill must be used within a SlotFillProvider");return t}function Fr({children:t,initialFills:s}){const r=n.useMemo(()=>{const o=new Map;return s&&Object.entries(s).forEach(([c,i])=>{const d=o.get(c)||[];Array.isArray(i)?o.set(c,[...d,...i]):o.set(c,[...d,i])}),o},[s]),a=n.useMemo(()=>({fills:r,registerFill:(o,c)=>{const i=r.get(o)||[];r.set(o,[...i,c])},unregisterFill:(o,c)=>{const i=r.get(o)||[];r.set(o,i.filter(d=>d!==c))},getSlotContent:o=>r.get(o)||[]}),[r]);return e.jsx(Dt.Provider,{value:a,children:t})}function Or({name:t,context:s={},children:r,fallback:a,wrapper:o}){const i=n.useContext(Dt)?.getSlotContent(t)||[],d=n.useMemo(()=>({slotName:t,context:s}),[t,s]),u=n.useMemo(()=>i.length===0?a||null:i.map((m,f)=>{const h=`${t}-${f}`;return e.jsx(n.Fragment,{children:Br(m,d)},h)}),[i,t,d,a]),x=e.jsxs(e.Fragment,{children:[u,r]});return o?e.jsx(o,{children:x}):e.jsx(e.Fragment,{children:x})}function Ur({slot:t,children:s}){const{registerFill:r,unregisterFill:a}=Mr();return n.useMemo(()=>(r(t,s),()=>a(t,s)),[t,s,r,a]),null}function Br(t,s){if(t==null)return null;if(Array.isArray(t))return e.jsx(e.Fragment,{children:t.map((r,a)=>e.jsx(n.Fragment,{children:Br(r,s)},`slot-item-${a}`))});if(n.isValidElement(t))return t;if(typeof t=="function"){const r=t;return e.jsx(r,{...s})}return t}function Ln(t){return(n.useContext(Dt)?.getSlotContent(t)?.length||0)>0}function Dn(t){function s(a){return e.jsx(Or,{...a,name:t})}s.displayName=`Slot(${t})`;function r({children:a}){return e.jsx(Ur,{slot:t,children:a})}return r.displayName=`Fill(${t})`,{Slot:s,Fill:r,slotName:t}}const _r=n.createContext(null);function Ct(){const t=n.useContext(_r);return t||{config:{},getPage:()=>{},getSlotContent:()=>{},getTableColumns:()=>[],getFormFields:()=>[],hasExtension:()=>!1}}function Mt(t){const{getPage:s}=Ct();return s(t)}function Mn(t){const{getTableColumns:s}=Ct();return s(t)}function Fn(t){const{getFormFields:s}=Ct();return s(t)}function On(t){const{hasExtension:s}=Ct();return s(t)}function qr({config:t={},children:s}){const r=n.useMemo(()=>{const{pages:a={},slots:o={},tableColumns:c={},formFields:i={}}=t;return{config:t,getPage:d=>a[d],getSlotContent:d=>o[d],getTableColumns:d=>c[d]||[],getFormFields:d=>i[d]||[],hasExtension:d=>d in a||d in o||d in c||d in i}},[t]);return e.jsx(_r.Provider,{value:r,children:e.jsx(Fr,{initialFills:t.slots,children:s})})}const Un=n.createContext(null);function Bn({config:t,children:s}){typeof window<"u"&&(window.__SMARTSTACK_CONFIG__=t);const r=n.useMemo(()=>({config:t}),[t]);return e.jsx(Un.Provider,{value:r,children:e.jsx(Tr,{children:e.jsx(qr,{config:t.extensions,children:e.jsx(ur,{children:e.jsx(dn,{children:e.jsx(xr,{children:e.jsx(hr,{children:e.jsx(xn,{children:e.jsx(ms,{children:e.jsx(Sr,{children:e.jsx(br,{children:e.jsx(jr,{children:e.jsx(Rr,{children:e.jsxs(yn,{children:[e.jsx(Lr,{}),e.jsx(Dr,{}),s]})})})})})})})})})})})})})})}class _n{pages=new Map;register(s,r,a=[]){this.pages.set(s,{key:s,defaultComponent:r,slots:a})}get(s){return this.pages.get(s)}resolve(s){return this.pages.get(s)?.defaultComponent}getAll(){return Array.from(this.pages.values())}has(s){return this.pages.has(s)}getSlots(s){return this.pages.get(s)?.slots||[]}keys(){return Array.from(this.pages.keys())}}const Te=new _n;function qn(t,s){function r(a){const o=Mt(t);return o?e.jsx(o,{...a}):e.jsx(s,{...a})}return r.displayName=`Overridable(${t})`,r}function zn(t){const s=Mt(t),r=Te.get(t);return s||r?.defaultComponent}function Gn({pageKey:t,defaultComponent:s,params:r}){const a=Mt(t),o={pageKey:t,params:r};return a?e.jsx(a,{...o}):e.jsx(s,{...o})}const Kn={ADMIN_INDEX:"administration",ADMIN_DASHBOARD:"administration.dashboard",USERS_LIST:"administration.users",USERS_DETAIL:"administration.users.detail",USERS_DASHBOARD:"administration.users.dashboard",USERS_GROUPS:"administration.users.groups",USERS_GROUPS_DETAIL:"administration.users.groups.detail",USERS_REFERENCES:"administration.users.references",ROLES_LIST:"administration.permissions.roles",ROLES_DETAIL:"administration.permissions.roles.detail",PERMISSIONS_LIST:"administration.permissions.permissions",PERMISSIONS_DETAIL:"administration.permissions.permissions.detail",ASSIGNMENTS:"administration.permissions.assignments",APPLICATIONS_INDEX:"administration.applications",APPLICATIONS_DASHBOARD:"administration.applications.dashboard",APPLICATIONS_LIST:"administration.applications.list",APPLICATIONS_DETAIL:"administration.applications.detail",AI_DASHBOARD:"administration.ai.dashboard",AI_SETTINGS:"administration.ai.settings",AI_SKILLS_LIST:"administration.ai.skills",AI_SKILLS_DETAIL:"administration.ai.skills.detail",AI_SKILLS_CREATE:"administration.ai.skills.create",AI_SKILLS_EDIT:"administration.ai.skills.edit",AI_BLOCKS_LIST:"administration.ai.skills.blocks",AI_BLOCKS_DETAIL:"administration.ai.skills.blocks.detail",AI_BLOCKS_CREATE:"administration.ai.skills.blocks.create",AI_BLOCKS_EDIT:"administration.ai.skills.blocks.edit",AI_MONITORING:"administration.ai.monitoring",AI_AGENTS:"administration.ai.agents",AI_AGENTS_DETAIL:"administration.ai.agents.detail",AI_AGENTS_EDIT:"administration.ai.agents.edit",WORKFLOWS_LIST:"administration.workflows.list",WORKFLOWS_DETAIL:"administration.workflows.detail",WORKFLOWS_CREATE:"administration.workflows.create",WORKFLOWS_EDIT:"administration.workflows.edit",WORKFLOWS_TRIGGERS:"administration.workflows.triggers",WORKFLOWS_HISTORY:"administration.workflows.history",EMAIL_TEMPLATES_LIST:"administration.workflows.email-templates",EMAIL_TEMPLATES_DETAIL:"administration.workflows.email-templates.detail",EMAIL_TEMPLATES_CREATE:"administration.workflows.email-templates.create",EMAIL_TEMPLATES_EDIT:"administration.workflows.email-templates.edit",SMS_TEMPLATES_LIST:"administration.workflows.email-templates.sms",ENTRA_DASHBOARD:"administration.entra.dashboard",ENTRA_GROUPS:"administration.entra.groups",ENTRA_USERS:"administration.entra.users",ENTRA_CONFLICTS:"administration.entra.conflicts",ENTRA_SETTINGS:"administration.entra.settings",TENANTS_DASHBOARD:"administration.tenants.dashboard",TENANTS_LIST:"administration.tenants.list",TENANTS_DETAIL:"administration.tenants.detail",TENANTS_CREATE:"administration.tenants.create",TENANTS_SETTINGS:"administration.tenants.settings",TENANTS_TEMPLATE:"administration.tenants.template",TENANTS_TEMPLATE_CREATE:"administration.tenants.template.create",TENANTS_TEMPLATE_DETAIL:"administration.tenants.template.detail",TENANTS_BUSINESS:"administration.tenants.list.enterprise",TENANTS_PERSONAL:"administration.tenants.list.personal",TENANTS_OTHER:"administration.tenants.list.other",TENANTS_ACCESS_REQUESTS:"administration.tenants.access-requests",ORGANISATIONS_LIST:"administration.tenants.organisations",ORGANISATIONS_CREATE:"administration.tenants.organisations.create",ORGANISATIONS_DETAIL:"administration.tenants.organisations.detail",SETTINGS:"administration.configuration.settings",SETTINGS_GENERAL:"administration.configuration.settings.general",SETTINGS_FILE_UPLOAD:"administration.configuration.settings.file-upload",SETTINGS_LEGAL_FILE:"administration.configuration.settings.legal-file",APPSETTINGS:"administration.configuration.appsettings",APPSETTINGS_INFRASTRUCTURE:"administration.configuration.appsettings.infrastructure",APPSETTINGS_AUTHENTICATION:"administration.configuration.appsettings.authentication",APPSETTINGS_LOGGING:"administration.configuration.appsettings.logging",APPSETTINGS_EMAIL:"administration.configuration.appsettings.email",APPSETTINGS_ENTRA:"administration.configuration.appsettings.entra",LICENSE:"administration.configuration.license",API_ACCOUNTS_LIST:"api.accounts.list",API_ACCOUNTS_CREATE:"api.accounts.create",API_ACCOUNTS_DETAIL:"api.accounts.detail",API_CATALOG:"api.apis.catalog",API_CATALOG_DETAIL:"api.apis.catalog.detail",SUPPORT_DASHBOARD:"support.tickets",TICKETS_LIST:"support.tickets.list",TICKETS_DETAIL:"support.tickets.detail",TICKETS_ESCALATION:"support.tickets.escalation",TICKETS_NEW:"support.tickets.new",MY_TICKETS_LIST:"support.my-tickets",MY_TICKETS_DETAIL:"support.my-tickets.detail",MY_TICKETS_CREATE:"support.my-tickets.create",SUPPORT_SLA:"support.admin.sla",SUPPORT_TEMPLATES:"support.admin.templates",SUPPORT_PERMISSIONS:"support.admin.permissions",SUPPORT_ASSIGNMENT:"support.assignment",SUPPORT_ASSIGNMENT_SKILLS:"support.assignment.skills",SUPPORT_ASSIGNMENT_WORKLOAD:"support.assignment.workload",MYSPACE_DASHBOARD:"myspace.dashboard",USER_PROFILE:"myspace.profile",USER_PREFERENCES:"myspace.preferences",MYSPACE_TENANTS:"myspace.tenants.workspaces",MYSPACE_ACCESS_REQUESTS:"myspace.tenants.access-requests",MYSPACE_PORTAL:"myspace.portal",NOTIFICATIONS:"notifications",APPLICATIONS_HUB:"applications"},zr="smartstack-doc-panel-size",Gr=n.createContext(void 0);function Hn(){if(typeof window>"u")return 33;try{const t=localStorage.getItem(zr);if(t){const s=parseFloat(t);if(s>=20&&s<=60)return s}}catch{}return 33}const Cs={"administration/users":"/docs/business/administration/users","administration/users/dashboard":"/docs/business/administration/users","administration/users/list":"/docs/business/administration/users","administration/users/create":"/docs/business/administration/users","administration/users/groups":"/docs/business/administration/users/groups","administration/users/references":"/docs/business/administration/users/references","administration/permissions":"/docs/business/administration/permissions","administration/permissions/roles":"/docs/business/administration/permissions","administration/permissions/permissions":"/docs/business/administration/permissions","administration/permissions/assignments":"/docs/business/administration/permissions/assignments","administration/applications":"/docs/business/administration/applications","administration/applications/list":"/docs/business/administration/applications","administration/applications/grid":"/docs/business/administration/applications","administration/applications/dashboard":"/docs/business/administration/applications","administration/tenants":"/docs/business/administration/tenants","administration/tenants/dashboard":"/docs/business/administration/tenants","administration/tenants/create":"/docs/business/administration/tenants","administration/tenants/list":"/docs/business/administration/tenants/business","administration/tenants/list/enterprise":"/docs/business/administration/tenants/business","administration/tenants/list/personal":"/docs/business/administration/tenants/personal","administration/tenants/list/other":"/docs/business/administration/tenants/other","administration/tenants/template":"/docs/business/administration/tenants/template","administration/tenants/business":"/docs/business/administration/tenants/business","administration/tenants/personal":"/docs/business/administration/tenants","administration/tenants/organisations":"/docs/business/administration/tenants/organisations","administration/tenants/organisations/create":"/docs/business/administration/tenants/organisations","administration/tenants/access-requests":"/docs/business/administration/tenants/access-requests","administration/tenants/applications":"/docs/business/administration/tenants/applications","administration/workflows":"/docs/business/administration/workflows","administration/workflows/list":"/docs/business/administration/workflows","administration/workflows/create":"/docs/business/administration/workflows","administration/workflows/triggers":"/docs/business/administration/workflows","administration/workflows/history":"/docs/business/administration/workflows","administration/workflows/email-templates":"/docs/business/administration/workflows","administration/workflows/email-templates/email":"/docs/business/administration/workflows","administration/workflows/email-templates/sms":"/docs/business/administration/workflows","administration/workflows/email-templates/create":"/docs/business/administration/workflows","administration/ai":"/docs/business/administration/ai","administration/ai/dashboard":"/docs/business/administration/ai","administration/ai/settings":"/docs/business/administration/ai","administration/ai/providers":"/docs/business/administration/ai","administration/ai/models":"/docs/business/administration/ai","administration/ai/prompts":"/docs/business/administration/ai","administration/ai/blocks":"/docs/business/administration/ai","administration/entra":"/docs/business/administration/entra","administration/entra/dashboard":"/docs/business/administration/entra","administration/entra/groups":"/docs/business/administration/entra","administration/entra/users":"/docs/business/administration/entra","administration/entra/conflicts":"/docs/business/administration/entra","administration/entra/settings":"/docs/business/administration/entra","administration/configuration":"/docs/business/administration/configuration","administration/configuration/settings":"/docs/business/administration/configuration","administration/configuration/appsettings":"/docs/business/administration/configuration","administration/configuration/license":"/docs/business/administration/configuration/license","support/tickets":"/system/docs/user/support-dashboard","support/tickets/list":"/docs/business/platform/support/tickets","support/tickets/escalation":"/system/docs/user/support-escalation","support/my-tickets":"/docs/business/platform/support/tickets","support/my-tickets/list":"/docs/business/platform/support/tickets","support/my-tickets/create":"/docs/business/platform/support/tickets","support/admin/sla":"/system/docs/user/support-sla","support/admin/templates":"/system/docs/user/support-templates","myspace/profile":"/system/docs/user/modules","myspace/preferences":"/system/docs/user/modules","myspace/tenants":"/system/docs/user/modules","myspace/portal":"/system/docs/user/modules"},ks={administration:"/docs/business/administration/users",support:"/system/docs/user/support-dashboard",myspace:"/system/docs/user/modules"};function As(t){const s=t.split("/").filter(Boolean),a=s[0]==="t"&&s.length>=3?2:0,o=s.slice(a),c=o[0],i=o.slice(1);if(i.length>0)for(let d=i.length;d>0;d--){const u=`${c}/${i.slice(0,d).join("/")}`;if(Cs[u])return Cs[u]}return c&&ks[c]?ks[c]:"/system/docs/user"}function Kr({children:t}){const[s,r]=n.useState(!1),[a,o]=n.useState(Hn),[c,i]=n.useState(null),d=N.useLocation(),u=n.useRef(d.pathname);n.useEffect(()=>{u.current!==d.pathname&&(u.current=d.pathname,r(!1))},[d.pathname]),n.useEffect(()=>{a>=20&&a<=60&&localStorage.setItem(zr,String(a))},[a]);const x=n.useCallback(v=>{const g=v||As(d.pathname);i(g),r(!0)},[d.pathname]),m=n.useCallback(()=>{r(!1)},[]),f=n.useCallback(()=>{if(s)r(!1);else{const v=As(d.pathname);i(v),r(!0)}},[s,d.pathname]),h=n.useCallback(v=>{v>=20&&v<=60&&o(v)},[]);return e.jsx(Gr.Provider,{value:{isOpen:s,panelSize:a,docUrl:c,openDocPanel:x,closeDocPanel:m,toggleDocPanel:f,setPanelSize:h},children:t})}function Ft(){const t=n.useContext(Gr);if(t===void 0)throw new Error("useDocPanel must be used within a DocPanelProvider");return t}class Vn{captureBrowserInfo(){const s=navigator.userAgent;return{browser:this.getBrowserName(s),browserVersion:this.getBrowserVersion(s),os:this.getOSName(s),osVersion:this.getOSVersion(s),language:navigator.language,screenResolution:`${window.screen.width}x${window.screen.height}`,deviceType:this.getDeviceType(s)}}getBrowserName(s){return s.includes("Firefox")?"Firefox":s.includes("Edg/")?"Microsoft Edge":s.includes("Chrome")&&!s.includes("Edg/")?"Google Chrome":s.includes("Safari")&&!s.includes("Chrome")?"Safari":s.includes("Opera")||s.includes("OPR/")?"Opera":s.includes("MSIE")||s.includes("Trident/")?"Internet Explorer":"Unknown Browser"}getBrowserVersion(s){let r=null;return s.includes("Firefox")?r=s.match(/Firefox\/(\d+(?:\.\d+)*)/):s.includes("Edg/")?r=s.match(/Edg\/(\d+(?:\.\d+)*)/):s.includes("Chrome")&&!s.includes("Edg/")?r=s.match(/Chrome\/(\d+(?:\.\d+)*)/):s.includes("Safari")&&!s.includes("Chrome")?r=s.match(/Version\/(\d+(?:\.\d+)*)/):s.includes("OPR/")&&(r=s.match(/OPR\/(\d+(?:\.\d+)*)/)),r?r[1]:"Unknown"}getOSName(s){return s.includes("Windows NT 10")?"Windows 10/11":s.includes("Windows NT 6.3")?"Windows 8.1":s.includes("Windows NT 6.2")?"Windows 8":s.includes("Windows NT 6.1")?"Windows 7":s.includes("Windows")?"Windows":s.includes("Mac OS X")?"macOS":s.includes("Linux")&&s.includes("Android")?"Android":s.includes("Linux")?"Linux":s.includes("iPhone")||s.includes("iPad")?"iOS":s.includes("CrOS")?"Chrome OS":"Unknown OS"}getWindowsVersion(s){return s==="10.0"?"10/11":s==="6.3"?"8.1":s==="6.2"?"8":s==="6.1"?"7":s}getOSVersion(s){if(s.includes("Windows NT")){const r=s.match(/Windows NT (\d+\.\d+)/);if(r)return this.getWindowsVersion(r[1])}if(s.includes("Mac OS X")){const r=s.match(/Mac OS X (\d+[._]\d+(?:[._]\d+)?)/);if(r)return r[1].replace(/_/g,".")}if(s.includes("Android")){const r=s.match(/Android (\d+(?:\.\d+)*)/);if(r)return r[1]}if(s.includes("iPhone OS")||s.includes("iPad")){const r=s.match(/(?:iPhone|iPad|CPU) OS (\d+[._]\d+(?:[._]\d+)?)/);if(r)return r[1].replace(/_/g,".")}return"Unknown"}getDeviceType(s){return/Tablet|iPad/i.test(s)?"Tablet":/Mobile|iPhone|Android.*Mobile/i.test(s)?"Mobile":"Desktop"}formatForDescription(s){return[`Browser: ${s.browser} ${s.browserVersion}`,`OS: ${s.os} ${s.osVersion}`,`Device: ${s.deviceType}`,`Screen: ${s.screenResolution}`,`Language: ${s.language}`].join(`
2
2
  `)}}const Wn=new Vn;function Xn(){return{captureContext:n.useCallback(()=>{const s=Wn.captureBrowserInfo(),r=Pe.getRecentErrors().slice(0,5);return{sourceUrl:window.location.href,browser:{name:s.browser,version:s.browserVersion,language:s.language},os:{name:s.os,version:s.osVersion},device:{type:s.deviceType,screenResolution:s.screenResolution},recentErrors:r.map(a=>({message:a.message,stack:a.stack,component:a.component,timestamp:a.timestamp.toISOString()}))}},[])}}function Yn(){const[t,s]=n.useState(new Set),[r,a]=n.useState(new Set),o=n.useCallback(m=>{s(f=>{const h=new Set(f);return h.has(m)?h.delete(m):h.add(m),h})},[]),c=n.useCallback(m=>{a(f=>{const h=new Set(f);return h.has(m)?h.delete(m):h.add(m),h})},[]),i=n.useCallback(()=>{s(new Set),a(new Set)},[]),d=n.useCallback((m,f)=>{s(new Set(m)),a(new Set(f))},[]),u=n.useCallback(m=>t.has(m),[t]),x=n.useCallback(m=>r.has(m),[r]);return{collapsedContexts:t,collapsedApps:r,toggleContext:o,toggleApp:c,expandAll:i,collapseAll:d,isContextCollapsed:u,isAppCollapsed:x}}function Jn(t={}){const{canEditSystemRoles:s=!1}=t,{t:r,i18n:a}=ne.useTranslation("admin"),[o,c]=n.useState(!0),[i,d]=n.useState(null),[u,x]=n.useState(null),[m,f]=n.useState(!1),[h,v]=n.useState(!1),[g,y]=n.useState([]),[p,b]=n.useState([]),[j,S]=n.useState(new Map),[w,P]=n.useState({}),[$,A]=n.useState({}),[k,R]=n.useState({}),[L,I]=n.useState({selectedRoleIds:[],resourceSearch:"",applicationFilter:"all",moduleFilter:"all",categoryFilter:"all"}),C=n.useRef(null),O=n.useRef(new Map),_=n.useCallback((B,H,X)=>{const se=B.has(X),ee=H.get(X);if(!ee)return{isDirect:se,isInherited:!1};const ue=ee.path.toLowerCase();let ae,ve,be=1/0;for(const Me of Array.from(B)){const Le=H.get(Me);if(!Le||Me===X)continue;const Fe=Le.path.toLowerCase();if((Le.isWildcard||Fe.endsWith(".*"))&&ds(Fe,ue)){const He=Fe.split(".").length;He<be&&(be=He,ae=Le.path,ve=Le.id)}}return{isDirect:se,isInherited:ae!==void 0,inheritedFromPath:ae,inheritedFromId:ve}},[]),E=n.useCallback((B,H)=>{const X={};return Object.entries(B).forEach(([se,ee])=>{const ue=new Map;H.forEach((ae,ve)=>{const be=_(ee,H,ve);ue.set(ve,be)}),X[se]=ue}),X},[_]),z=(B,H,X,se)=>{const ee=[],ue=[];return B.resources.forEach(ae=>{const ve=ae.permissionPath.toLowerCase().replace(/\.\*$/,"").replace(/\*$/,""),be=se.get(ve)||[],$e={id:ae.id,path:ae.permissionPath,label:ae.label,applicationLabel:X.label,moduleLabel:ae.label,parentModuleLabel:H.label,parentModuleId:H.id,parentSectionLabel:B.label,parentSectionId:B.id,level:"resource",permissions:be,totalPermissions:be.length};ee.push($e),ue.push($e)}),{childResources:ee,nodes:ue}},W=(B,H,X)=>{const se=[],ee=[];return B.sections.forEach(ue=>{const ae=ue.permissionPath.toLowerCase().replace(/\.\*$/,"").replace(/\*$/,""),ve=X.get(ae)||[],{childResources:be,nodes:$e}=z(ue,B,H,X),Me=be.reduce((Qe,He)=>Qe+He.totalPermissions,0),Le=ve.length+Me,Fe={id:ue.id,path:ue.permissionPath,label:ue.label,applicationLabel:H.label,moduleLabel:ue.label,parentModuleLabel:B.label,parentModuleId:B.id,level:"section",permissions:ve,totalPermissions:Le,childResources:be.length>0?be:void 0};se.push(Fe),ee.push(Fe),ee.push(...$e)}),{childSections:se,nodes:ee}},G=(B,H,X,se)=>{const ee=B.permissionPath.toLowerCase().replace(/\.\*$/,"").replace(/\*$/,""),ue=X.get(ee)||[],{childSections:ae,nodes:ve}=W(B,H,X),be=ae.reduce((Me,Le)=>Me+Le.totalPermissions,0),$e=ue.length+be;se.push({id:B.id,path:B.permissionPath,label:B.label,applicationLabel:H.label,moduleLabel:B.label,level:"module",permissions:ue,totalPermissions:$e,childSections:ae.length>0?ae:void 0}),se.push(...ve)},J=(B,H,X)=>{B.modules.forEach(se=>{G(se,B,H,X)})},pe=n.useCallback((B,H)=>{const X=[];if(!B||!B.applications||!H||!Array.isArray(H))return X;const se=new Map;return H.forEach(ee=>{const ae=ee.path.toLowerCase().split(".");if(ae.length>=2){const ve=ae.slice(0,-1).join("."),be=se.get(ve)||[];be.push({id:ee.id,action:ae[ae.length-1],path:ee.path}),se.set(ve,be)}}),B.applications.forEach(ee=>{J(ee,se,X)}),X.sort((ee,ue)=>{const ae=ee.applicationLabel.localeCompare(ue.applicationLabel);return ae!==0?ae:ee.moduleLabel.localeCompare(ue.moduleLabel)})},[]),q=n.useCallback(async()=>{try{c(!0),d(null);const B=await je.permissions.getMatrix(),H={};B.roles.forEach(ae=>{H[ae.id]=new Set(ae.permissionIds)});const X=new Map(B.permissions.map(ae=>[ae.id,ae])),se=pe(B.tree,B.permissions),ee=E(H,X);y(B.roles),b(se),S(X),P(H),R(ee);const ue=Object.entries(H).reduce((ae,[ve,be])=>(ae[ve]=new Set(Array.from(be)),ae),{});A(ue),O.current.clear()}catch(B){d(B instanceof Error?B.message:"Failed to load permission matrix data")}finally{c(!1)}},[pe,E]);n.useEffect(()=>{q()},[q,a.language]),n.useEffect(()=>{if(j.size>0){const B=E(w,j);R(B)}},[w,j,E]);const Y=n.useCallback(async()=>{if(O.current.size===0)return;const B=new Map(O.current);O.current.clear(),f(!0),x(null);try{const H=Array.from(B.entries()).map(async([ee,ue])=>{const ae=g.find(ve=>ve.id===ee);ae&&await je.roles.update(ee,{name:ae.name,shortName:ae.shortName,category:ae.category,description:ae.description||void 0,permissionIds:Array.from(ue)})});await Promise.all(H);const X=JSON.parse(JSON.stringify(Object.fromEntries(Object.entries(w).map(([ee,ue])=>[ee,Array.from(ue)])))),se=Object.entries(X).reduce((ee,[ue,ae])=>(ee[ue]=new Set(ae),ee),{});A(se),v(!0),setTimeout(()=>{v(!1)},3e3)}catch(H){console.error("Failed to save permission changes:",H);let X="Failed to save changes";if(H&&typeof H=="object"&&"response"in H){const se=H.response;se?.status===403?X=r("assignments.noPermissionToEditRole"):se?.data?.message&&(X=se.data.message)}else H instanceof Error&&(X=H.message);x(X),await q()}finally{f(!1)}},[g,w,q]),M=n.useCallback(()=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{Y()},500)},[Y]),te=n.useCallback((B,H)=>{g.find(se=>se.id===B)?.isSystem&&!s||P(se=>{const ee=new Set(se[B]||[]);return ee.has(H)?ee.delete(H):ee.add(H),O.current.set(B,ee),M(),{...se,[B]:ee}})},[g,s,M]),oe=B=>{p.forEach(H=>{H.permissions.forEach(X=>{B.add(X.id)})})},le=n.useCallback((B,H)=>{g.find(se=>se.id===B)?.isSystem&&!s||P(se=>{const ee=new Set;return H&&oe(ee),O.current.set(B,ee),M(),{...se,[B]:ee}})},[g,s,p,M]),F=(B,H,X)=>{H.permissions.forEach(se=>{X?B.add(se.id):B.delete(se.id)})},K=n.useCallback((B,H)=>{P(X=>{const se={...X};return g.forEach(ee=>{if(ee.isSystem&&!s)return;const ue=new Set(se[ee.id]||[]);F(ue,B,H),se[ee.id]=ue,O.current.set(ee.id,ue)}),M(),se})},[g,s,M]),Q=n.useCallback(B=>{I(H=>({...H,...B}))},[]),U=n.useCallback(()=>{const B=Object.entries($).reduce((H,[X,se])=>(H[X]=new Set(Array.from(se)),H),{});P(B),O.current.clear(),C.current&&clearTimeout(C.current)},[$]),Z=n.useMemo(()=>g.filter(B=>L.selectedRoleIds.length===0?!0:L.selectedRoleIds.includes(B.id)),[g,L.selectedRoleIds]),re=n.useMemo(()=>p.filter(B=>!(L.resourceSearch&&!B.moduleLabel.toLowerCase().includes(L.resourceSearch.toLowerCase())||L.applicationFilter!=="all"&&B.applicationLabel!==L.applicationFilter||L.moduleFilter!=="all"&&B.moduleLabel!==L.moduleFilter)),[p,L]),de=n.useMemo(()=>Array.from(Object.entries(w)).some(([B,H])=>{const X=$[B];return X?H.size!==X.size?!0:Array.from(H).some(se=>!X.has(se)):H.size>0}),[w,$]),he=n.useMemo(()=>{const B=new Map;return p.forEach(H=>{B.has(H.applicationLabel)||B.set(H.applicationLabel,{app:H.applicationLabel,label:H.applicationLabel})}),Array.from(B.values()).sort((H,X)=>H.label.localeCompare(X.label))},[p]),fe=n.useMemo(()=>p.filter(B=>B.level==="module").map(B=>({app:B.applicationLabel,module:B.label,label:B.label})).sort((B,H)=>B.label.localeCompare(H.label)),[p]),Ne=n.useMemo(()=>{const B=new Set(g.map(X=>X.category));return["Global","Admin","Manager","Contributor","Viewer","Custom"].filter(X=>B.has(X))},[g]),Be=n.useCallback((B,H)=>{const X=k[B];return X?X.get(H)||{isDirect:!1,isInherited:!1}:{isDirect:!1,isInherited:!1}},[k]),Ke=n.useCallback(()=>{x(null)},[]);return{loading:o,error:i,saveError:u,saving:m,saveSuccess:h,roles:g,resources:p,permissions:j,assignments:w,inheritanceMap:k,filters:L,filteredRoles:Z,filteredResources:re,hasChanges:de,canEditSystemRoles:s,applications:he,modules:fe,categories:Ne,togglePermission:te,toggleAllForRole:le,toggleAllForResource:K,updateFilters:Q,reloadData:q,resetChanges:U,saveChanges:Y,clearSaveError:Ke,getPermissionInheritance:Be}}function Hr(t={}){const s=n.useRef(null),[r,a]=n.useState(ie.HubConnectionState.Disconnected),o=n.useRef(t);o.current=t;const c=n.useCallback(()=>localStorage.getItem("token"),[]),i=n.useCallback(async()=>{const u=c();if(u&&s.current?.state!==ie.HubConnectionState.Connected)try{const x=new ie.HubConnectionBuilder().withUrl("/hubs/notifications",{accessTokenFactory:()=>u}).withAutomaticReconnect({nextRetryDelayInMilliseconds:m=>m.previousRetryCount===0?0:m.previousRetryCount===1?2e3:m.previousRetryCount===2?1e4:m.previousRetryCount<5?3e4:null}).configureLogging(ie.LogLevel.Warning).build();x.on("ReceiveNotification",m=>{o.current.onNotification?.(m)}),x.on("UnreadCountUpdate",m=>{o.current.onUnreadCountUpdate?.(m)}),x.on("PermissionsChanged",()=>{o.current.onPermissionsChanged?.()}),x.onreconnecting(()=>{a(ie.HubConnectionState.Reconnecting),o.current.onConnectionStateChange?.(ie.HubConnectionState.Reconnecting)}),x.onreconnected(()=>{a(ie.HubConnectionState.Connected),o.current.onConnectionStateChange?.(ie.HubConnectionState.Connected)}),x.onclose(()=>{a(ie.HubConnectionState.Disconnected),o.current.onConnectionStateChange?.(ie.HubConnectionState.Disconnected)}),await x.start(),s.current=x,a(ie.HubConnectionState.Connected),o.current.onConnectionStateChange?.(ie.HubConnectionState.Connected)}catch(x){console.error("SignalR: Failed to connect",x),a(ie.HubConnectionState.Disconnected)}},[c]),d=n.useCallback(async()=>{if(s.current)try{await s.current.stop(),s.current=null,a(ie.HubConnectionState.Disconnected)}catch(u){console.error("SignalR: Failed to disconnect",u)}},[]);return n.useEffect(()=>(i(),()=>{d()}),[i,d]),n.useEffect(()=>{const u=x=>{x.key==="token"&&(x.newValue?i():d())};return window.addEventListener("storage",u),()=>window.removeEventListener("storage",u)},[i,d]),{connectionState:r,isConnected:r===ie.HubConnectionState.Connected,connect:i,disconnect:d}}function Qn(){const{refreshPermissions:t,user:s}=Ae(),{refreshMenu:r}=Re(),a=n.useRef(!1),o=n.useCallback(async()=>{if(!a.current){a.current=!0;try{await Promise.all([t(),r()])}catch(d){console.error("[PermissionSync] Failed to refresh permissions:",d)}finally{a.current=!1}}},[t,r]),{isConnected:c,connectionState:i}=Hr({onPermissionsChanged:o});return{isConnected:c,connectionState:i,isAuthenticated:!!s}}function Vr(t){const{ticketId:s,onCommentAdded:r,onTicketUpdated:a,onConnectionStateChange:o}=t,c=n.useRef(null),i=n.useRef(null),[d,u]=n.useState(ie.HubConnectionState.Disconnected),x=n.useCallback(()=>localStorage.getItem("token"),[]),m=n.useCallback(async g=>{if(c.current?.state===ie.HubConnectionState.Connected)try{await c.current.invoke("JoinTicket",g),i.current=g}catch(y){console.error("SignalR: Failed to join ticket group",y)}},[]),f=n.useCallback(async g=>{if(c.current?.state===ie.HubConnectionState.Connected)try{await c.current.invoke("LeaveTicket",g)}catch(y){console.error("SignalR: Failed to leave ticket group",y)}i.current=null},[]),h=n.useCallback(async()=>{const g=x();if(g){if(c.current?.state===ie.HubConnectionState.Connected)return c.current;try{const y=new ie.HubConnectionBuilder().withUrl("/hubs/notifications",{accessTokenFactory:()=>g}).withAutomaticReconnect({nextRetryDelayInMilliseconds:p=>p.previousRetryCount===0?0:p.previousRetryCount===1?2e3:p.previousRetryCount===2?1e4:p.previousRetryCount<5?3e4:null}).configureLogging(ie.LogLevel.Warning).build();return y.on("TicketCommentAdded",p=>{r?.(p)}),y.on("TicketUpdated",p=>{a?.(p)}),y.onreconnecting(()=>{u(ie.HubConnectionState.Reconnecting),o?.(ie.HubConnectionState.Reconnecting)}),y.onreconnected(async()=>{u(ie.HubConnectionState.Connected),o?.(ie.HubConnectionState.Connected),i.current&&await m(i.current)}),y.onclose(()=>{u(ie.HubConnectionState.Disconnected),o?.(ie.HubConnectionState.Disconnected)}),await y.start(),c.current=y,u(ie.HubConnectionState.Connected),o?.(ie.HubConnectionState.Connected),y}catch(y){return console.error("SignalR: Failed to connect",y),u(ie.HubConnectionState.Disconnected),null}}},[x,m,r,a,o]),v=n.useCallback(async()=>{if(i.current&&await f(i.current),c.current)try{await c.current.stop(),c.current=null,u(ie.HubConnectionState.Disconnected)}catch(g){console.error("SignalR: Failed to disconnect",g)}},[f]);return n.useEffect(()=>{let g=!0;return(async()=>(await h(),g&&s&&await m(s)))(),()=>{g=!1,v()}},[h,v,s,m]),n.useEffect(()=>{const g=async()=>{i.current&&i.current!==s&&await f(i.current),s&&s!==i.current&&await m(s)};c.current?.state===ie.HubConnectionState.Connected&&g()},[s,m,f]),{connectionState:d,isConnected:d===ie.HubConnectionState.Connected,joinTicket:m,leaveTicket:f}}function Zn(t,s,r,a){const o=[];for(const c of a.resources)c.route&&o.push({componentKey:c.componentKey,permissionPath:c.permissionPath,route:c.route,hasComponent:Te.has(c.componentKey),requiredFeature:r,isOpen:s,level:"resource",applicationCode:t});return o}function eo(t,s,r,a){const o=[];for(const c of a.sections)c.route&&o.push({componentKey:c.componentKey,permissionPath:c.permissionPath,route:c.route,hasComponent:Te.has(c.componentKey),requiredFeature:r,isOpen:s,level:"section",applicationCode:t}),o.push(...Zn(t,s,r,c));return o}function to(t,s,r){const a=[];for(const o of r.modules)o.route&&a.push({componentKey:o.componentKey,permissionPath:o.permissionPath,route:o.route,hasComponent:Te.has(o.componentKey),requiredFeature:o.requiredFeature,isOpen:s,level:"module",applicationCode:t}),a.push(...eo(t,s,o.requiredFeature,o));return a}function so(t){const s=[];for(const r of t)r.route&&s.push({componentKey:r.componentKey,permissionPath:r.permissionPath,route:r.route,hasComponent:Te.has(r.componentKey),requiredFeature:r.requiredFeature,isOpen:r.isOpen,level:"application",applicationCode:r.code}),s.push(...to(r.code,r.isOpen,r));return s}function ro(){const{menu:t,isLoading:s}=Re();return n.useMemo(()=>{if(!t||s)return{entries:[],byKey:new Map,isLoading:!0,byApplication:new Map};const r=so(t.applications),a=new Map(r.map(c=>[c.componentKey,c])),o=new Map;for(const c of r){const i=o.get(c.applicationCode)||[];i.push(c),o.set(c.applicationCode,i)}return{entries:r,byKey:a,isLoading:!1,byApplication:o}},[t,s])}const ao=(t,s,r)=>{const a=t.has(r),o=s.get(r);if(!o)return{isDirect:a,isInherited:!1};const c=o.path;let i,d,u=1/0;for(const m of Array.from(t)){const f=s.get(m);if(!(!f||!f.isWildcard||m===r)&&ds(f.path,c)){const h=f.path.split(".").length;h<u&&(u=h,i=f.path,d=f.id)}}return{isDirect:a,isInherited:i!==void 0,inheritedFromPath:i,inheritedFromId:d}},Rs=(t,s)=>{const r={};return Object.entries(t).forEach(([a,o])=>{const c=new Map;s.forEach((i,d)=>{const u=ao(o,s,d);c.set(d,u)}),r[a]=c}),r},no=t=>{const s=new Map;return t.forEach(r=>{const o=r.path.toLowerCase().split(".");if(o.length>=2){const c=o.slice(0,-1).join("."),i=s.get(c)||[];i.push({id:r.id,action:o[o.length-1],path:r.path}),s.set(c,i)}}),s},Ut=(t,s)=>{const r=s.toLowerCase().replace(/\.\*$/,"").replace(/\*$/,"");return t.get(r)||[]};function oo(t){const{entityId:s,tenantId:r,loadEntity:a,loadRoles:o}=t,{i18n:c}=ne.useTranslation(),[i,d]=n.useState(!0),[u,x]=n.useState(null),[m,f]=n.useState(null),[h,v]=n.useState([]),[g,y]=n.useState([]),[p,b]=n.useState(new Map),[j,S]=n.useState({}),[w,P]=n.useState({}),[$,A]=n.useState({selectedRoleIds:[],resourceSearch:"",contextFilter:"all",applicationFilter:"all",moduleFilter:"all"}),k=!!r,R=n.useCallback((F,K,Q,U)=>{const Z=Ut(U,K.permissionPath);F.push({id:K.id,path:K.permissionPath,label:K.label,contextLabel:Q.label,applicationLabel:Q.label,moduleLabel:K.label,level:"module",permissions:Z,totalPermissions:Z.length})},[]),L=n.useCallback((F,K,Q,U,Z)=>{const re=Ut(Z,K.permissionPath);K.resources.forEach(de=>{const he=Ut(Z,de.permissionPath);F.push({id:de.id,path:de.permissionPath,label:de.label,contextLabel:U.label,applicationLabel:U.label,moduleLabel:Q.label,parentModuleLabel:Q.label,parentModuleId:Q.id,parentSectionLabel:K.label,parentSectionId:K.id,level:"resource",permissions:he,totalPermissions:he.length})}),F.push({id:K.id,path:K.permissionPath,label:K.label,contextLabel:U.label,applicationLabel:U.label,moduleLabel:Q.label,parentModuleLabel:Q.label,parentModuleId:Q.id,level:"section",permissions:re,totalPermissions:re.length})},[]),I=n.useCallback((F,K,Q,U)=>{R(U,F,K,Q),F.sections.forEach(Z=>{L(U,Z,F,K,Q)})},[R,L]),C=n.useCallback((F,K,Q)=>{F.modules.forEach(U=>{I(U,F,K,Q)})},[I]),O=n.useCallback((F,K)=>{if(!F?.applications||!Array.isArray(K))return[];const Q=no(K),U=[];return F.applications.forEach(Z=>{C(Z,Q,U)}),U.sort((Z,re)=>{const de=Z.applicationLabel.localeCompare(re.applicationLabel);return de!==0?de:Z.moduleLabel.localeCompare(re.moduleLabel)})},[C]),_=n.useCallback(async()=>{try{d(!0),x(null);const[F,K,Q]=await Promise.all([a(s),o(s,r),je.permissions.getMatrix()]);f(F),v(K);const U=new Set(K.map(Ne=>Ne.id)),Z=Q.roles.filter(Ne=>U.has(Ne.id)),re={};Z.forEach(Ne=>{re[Ne.id]=new Set(Ne.permissionIds)});const de=new Map(Q.permissions.map(Ne=>[Ne.id,Ne])),he=O(Q.tree,Q.permissions),fe=Rs(re,de);y(he),b(de),S(re),P(fe)}catch(F){x(F instanceof Error?F.message:"Failed to load permissions data")}finally{d(!1)}},[s,r,a,o,O]);n.useEffect(()=>{_()},[_,c.language]),n.useEffect(()=>{if(p.size>0){const F=Rs(j,p);P(F)}},[j,p]);const E=n.useMemo(()=>{const F=new Set;return Object.entries(w).forEach(([K,Q])=>{Q.forEach((U,Z)=>{(U.isDirect||U.isInherited)&&F.add(Z)})}),F},[w]),z=F=>$.resourceSearch?F.label.toLowerCase().includes($.resourceSearch.toLowerCase()):!0,W=F=>$.contextFilter==="all"?!0:F.contextLabel===$.contextFilter,G=F=>$.applicationFilter==="all"?!0:F.applicationLabel===$.applicationFilter,J=F=>$.moduleFilter==="all"?!0:F.level==="module"?F.label===$.moduleFilter:F.parentModuleLabel===$.moduleFilter,pe=n.useMemo(()=>g.filter(F=>z(F)&&W(F)&&G(F)&&J(F)),[g,$]),q=n.useMemo(()=>{const F=new Set(g.map(K=>K.contextLabel??K.applicationLabel));return Array.from(F).sort((K,Q)=>K.localeCompare(Q))},[g]),Y=n.useMemo(()=>{const F=new Map;return g.forEach(K=>{const Q=K.contextLabel??K.applicationLabel,U=`${Q}:${K.applicationLabel}`;F.has(U)||F.set(U,{context:Q,app:K.applicationLabel,label:K.applicationLabel})}),Array.from(F.values()).sort((K,Q)=>K.label.localeCompare(Q.label))},[g]),M=n.useMemo(()=>g.filter(F=>F.level==="module").map(F=>({context:F.contextLabel??F.applicationLabel,app:F.applicationLabel,module:F.label,label:F.label})).sort((F,K)=>F.label.localeCompare(K.label)),[g]),te=n.useCallback(F=>{A(K=>({...K,...F}))},[]),oe=n.useCallback((F,K)=>{const Q=w[F];return Q?Q.get(K)||{isDirect:!1,isInherited:!1}:{isDirect:!1,isInherited:!1}},[w]),le=n.useCallback(F=>{const K=[];return h.forEach(Q=>{const U=w[Q.id];if(U){const Z=U.get(F);Z&&(Z.isDirect||Z.isInherited)&&K.push(Q)}}),K},[h,w]);return{loading:i,error:u,entity:m,roles:h,resources:g,assignments:j,inheritanceMap:w,effectivePermissions:E,filters:$,filteredResources:pe,contexts:q,applications:Y,modules:M,updateFilters:te,getPermissionInheritance:oe,getPermissionSources:le,reloadData:_,isTenantMode:k}}function io(t){const{userId:s,tenantId:r}=t,[a,o]=n.useState(null),[c,i]=n.useState([]),d=!!r,u=n.useCallback(async y=>je.users.getById(y),[]),x=n.useCallback(async(y,p)=>{const b=await je.users.getById(y);let j=[];try{const w=await je.users.getConsolidatedRoles(y,p);if(i(w),j=w.map(P=>({id:P.roleId,name:P.roleName,shortName:P.roleShortName||P.roleName,category:"Custom",description:null})),p)try{const $=(await je.tenants.getMembers(p)).find(A=>A.userId===y);o($||null)}catch{o(null)}else o(null)}catch{i([]),o(null),j=b.roles}return Array.from(new Map(j.map(w=>[w.id,w])).values())},[]),m=oo({entityId:s,tenantId:r,loadEntity:u,loadRoles:x}),f=m.entity,h=m.roles,v=n.useCallback(y=>{const p=[];return h.forEach(b=>{const j=m.inheritanceMap[b.id];if(j){const S=j.get(y);S&&(S.isDirect||S.isInherited)&&p.push(b)}}),p},[h,m.inheritanceMap]),g=n.useCallback(async y=>{if(!d||!r||!a)throw new Error("Cannot assign tenant roles: not in tenant mode or no tenant member found");await je.tenants.assignMemberRoles(r,a.userId,y),await m.reloadData()},[d,r,a,m]);return{loading:m.loading,error:m.error,user:f,userRoles:h,resources:m.resources,assignments:m.assignments,inheritanceMap:m.inheritanceMap,effectivePermissions:m.effectivePermissions,filters:m.filters,filteredResources:m.filteredResources,contexts:m.contexts,applications:m.applications,modules:m.modules,updateFilters:m.updateFilters,getPermissionInheritance:m.getPermissionInheritance,getPermissionSources:v,reloadData:m.reloadData,isTenantMode:d,tenantMember:a,assignTenantRoles:g,consolidatedRoles:c}}function Ot(){const{mode:t,toggleMode:s}=St(),a=(t==="dark"?"dark":"light")==="light";return e.jsx("button",{onClick:s,className:"relative p-2 bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] transition-all duration-300 group",style:{borderRadius:"var(--radius-button)"},"aria-label":`Basculer vers le mode ${a?"sombre":"clair"}`,children:e.jsxs("div",{className:"relative w-6 h-6",children:[e.jsx(l.Sun,{className:`absolute inset-0 w-6 h-6 text-amber-500 transition-all duration-300 ${a?"opacity-100 rotate-0 scale-100":"opacity-0 rotate-90 scale-0"}`}),e.jsx(l.Moon,{className:`absolute inset-0 w-6 h-6 text-[var(--color-accent-400)] transition-all duration-300 ${a?"opacity-0 -rotate-90 scale-0":"opacity-100 rotate-0 scale-100"}`})]})})}const Bt=[{code:"en",label:"English",short:"EN"},{code:"fr",label:"Français",short:"FR"},{code:"de",label:"Deutsch",short:"DE"},{code:"it",label:"Italiano",short:"IT"}];function ps(){const{i18n:t}=ne.useTranslation(),{isAuthenticated:s}=Ae(),[r,a]=n.useState(!1),o=n.useRef(null),c=t.language?.split("-")[0]||"en",i=Bt.find(u=>u.code===c)||Bt[0],d=async u=>{if(await ls(u),document.documentElement.lang=u,a(!1),s)try{await It.preferences.updateLanguage({language:u})}catch{}};return n.useEffect(()=>{const u=x=>{o.current&&!o.current.contains(x.target)&&a(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[]),e.jsxs("div",{ref:o,className:"relative",children:[e.jsx("button",{onClick:()=>a(!r),className:"relative p-2 bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] transition-all duration-300",style:{borderRadius:"var(--radius-button)"},"aria-label":"Change language",children:e.jsx("span",{className:"flex items-center justify-center w-6 h-6 text-xs font-bold text-[var(--text-secondary)]",children:i.short})}),r&&e.jsx("div",{className:"absolute right-0 mt-2 py-1 bg-[var(--bg-tertiary)] border border-[var(--border-color)] shadow-lg shadow-[var(--shadow-color)] z-50 overflow-hidden",style:{borderRadius:"var(--radius-card)"},children:Bt.map(u=>{const x=u.code===c;return e.jsxs("button",{onClick:()=>d(u.code),className:`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors whitespace-nowrap ${x?"bg-primary-600/10 text-primary-500":"text-[var(--text-secondary)] hover:bg-[var(--bg-secondary)] hover:text-[var(--text-primary)]"}`,children:[e.jsx("span",{className:"text-xs font-bold w-6",children:u.short}),e.jsx("span",{className:"text-sm font-medium",children:u.label}),x&&e.jsx(l.Check,{className:"w-4 h-4 ml-auto text-primary-500"})]},u.code)})})]})}function lo(t,s){if(!s.useUrlRouting||!s.slug)return ct(t);if(t.startsWith(`/t/${s.slug}`))return t;const r=ct(t);return`/t/${s.slug}${r}`}function Ps(t){const s=t.match(/^\/t\/([^/]+)/);return s?s[1]:null}function ct(t){return t.replace(/^\/t\/[^/]+/,"")||"/"}function et(){const{currentTenant:t}=Ee(),{useUrlRouting:s}=cs();return n.useCallback(r=>lo(r,{slug:t?.slug,useUrlRouting:s}),[t?.slug,s])}const Ts={background:"linear-gradient(to bottom right, var(--color-accent-500), var(--color-accent-600))"};function Wr(){const{t}=ne.useTranslation("navigation"),{user:s,logout:r}=Ae(),{refreshMenu:a}=Re(),{refreshTenants:o}=Ee(),c=N.useLocation(),i=N.useNavigate(),d=et(),[u,x]=n.useState(!1),[m,f]=n.useState(!1),h=n.useRef(null),v=async()=>{f(!0);try{await D.post("/api/navigation/invalidate-cache").catch(()=>{}),await Promise.all([a(),o()])}catch(b){console.error("Failed to refresh cache:",b)}finally{f(!1),x(!1)}},g=b=>{const j=d(b);c.pathname!==j&&i(j),x(!1)};n.useEffect(()=>{function b(j){h.current&&!h.current.contains(j.target)&&x(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[]),n.useEffect(()=>{function b(j){j.key==="Escape"&&x(!1)}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[]);const y=()=>{if(!s)return"?";const b=s.firstName?.[0]||"",j=s.lastName?.[0]||"";return(b+j).toUpperCase()||s.email[0].toUpperCase()},p=()=>s?s.firstName||s.lastName?`${s.firstName||""} ${s.lastName||""}`.trim():s.email.split("@")[0]:"";return e.jsxs("div",{ref:h,className:"relative",children:[e.jsxs("button",{onClick:()=>x(!u),className:"flex items-center gap-2 p-1.5 pr-3 bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] transition-all duration-200 group",style:{borderRadius:"var(--radius-button)"},"aria-expanded":u,"aria-haspopup":"true",children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-medium shadow-sm",style:Ts,children:y()}),e.jsx(l.ChevronDown,{className:`w-4 h-4 text-[var(--text-tertiary)] transition-transform duration-200 ${u?"rotate-180":""}`})]}),e.jsx("div",{className:`absolute right-0 mt-2 w-72 origin-top-right transition-all duration-200 ease-out ${u?"opacity-100 scale-100 translate-y-0":"opacity-0 scale-95 -translate-y-2 pointer-events-none"}`,children:e.jsxs("div",{className:"bg-[var(--bg-card)] border border-[var(--border-color)] shadow-xl overflow-hidden",style:{borderRadius:"var(--radius-card)"},children:[e.jsx("div",{className:"p-4 bg-gradient-to-br from-[var(--bg-secondary)] to-[var(--bg-tertiary)]",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full flex items-center justify-center text-white text-lg font-semibold shadow-lg",style:Ts,children:y()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-semibold text-[var(--text-primary)] truncate",children:p()}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] truncate",children:s?.email})]})]})}),e.jsx("div",{className:"p-2 border-b border-[var(--border-color)]",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs("button",{onClick:()=>g("/applications"),className:"w-full flex items-center gap-3 px-3 py-2.5 hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--bg-tertiary)] flex items-center justify-center text-[var(--text-secondary)]",children:e.jsx(l.LayoutGrid,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:t("avatarMenu.applications")})]}),e.jsxs("button",{onClick:()=>g("/myspace"),className:"w-full flex items-center gap-3 px-3 py-2.5 hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--bg-tertiary)] flex items-center justify-center text-[var(--text-secondary)]",children:e.jsx(l.User,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:t("avatarMenu.mySpace")})]})]})}),e.jsx("div",{className:"p-2",children:e.jsxs("button",{onClick:v,disabled:m,className:"w-full flex items-center gap-3 px-3 py-2.5 hover:bg-[var(--bg-tertiary)] transition-colors disabled:opacity-50",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--bg-tertiary)] flex items-center justify-center text-[var(--text-secondary)]",children:e.jsx(l.RefreshCw,{className:`w-4 h-4 ${m?"animate-spin":""}`})}),e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:t("avatarMenu.refreshCache")})]})}),e.jsx("div",{className:"p-2 border-t border-[var(--border-color)]",children:e.jsxs("button",{onClick:()=>{x(!1),r()},className:"w-full flex items-center gap-3 px-3 py-2.5 hover:bg-red-500/10 transition-colors group",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--bg-tertiary)] group-hover:bg-red-500/20 flex items-center justify-center text-[var(--text-secondary)] group-hover:text-red-500 transition-colors",children:e.jsx(l.LogOut,{className:"w-4 h-4"})}),e.jsx("span",{className:"font-medium text-[var(--text-primary)] group-hover:text-red-500 transition-colors",children:t("avatarMenu.logout")})]})})]})})]})}const co={settings:l.Settings,users:l.Users,key:l.Key,briefcase:l.Briefcase,folder:l.FolderOpen,file:l.FileText,box:l.Box};function uo(t){return t&&co[t.toLowerCase()]||l.Box}function Es({app:t,isFavorite:s,showFavorite:r,onToggleFavorite:a,onSelect:o}){const c=uo(t.icon);return e.jsxs("div",{className:"group relative",children:[e.jsxs("button",{onClick:o,className:"w-full flex flex-col items-center gap-2 p-3 hover:bg-[var(--bg-tertiary)] transition-all duration-200",style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[var(--color-accent-500)]/20 to-[var(--color-accent-600)]/20 flex items-center justify-center group-hover:from-[var(--color-accent-500)]/30 group-hover:to-[var(--color-accent-600)]/30 transition-all",style:{borderRadius:"var(--radius-card)"},children:e.jsx(c,{className:"w-6 h-6 text-[var(--color-accent-500)]"})}),e.jsx("span",{className:"text-xs font-medium text-[var(--text-primary)] text-center line-clamp-2",children:t.label})]}),r&&e.jsx("button",{onClick:i=>{i.stopPropagation(),a()},className:`absolute top-1 right-1 p-1.5 transition-all duration-200 ${s?"text-amber-500 bg-amber-500/10":"text-[var(--text-tertiary)] opacity-0 group-hover:opacity-100 hover:bg-[var(--bg-secondary)]"}`,style:{borderRadius:"var(--radius-button)"},title:s?"Retirer des favoris":"Ajouter aux favoris",children:e.jsx(l.Star,{className:`w-4 h-4 ${s?"fill-current":""}`})})]})}function Xr(){const{t}=ne.useTranslation("navigation"),{favorites:s,menu:r,toggleFavorite:a,isFavorite:o}=Re(),{currentTenant:c}=Ee(),[i,d]=n.useState(!1),u=n.useRef(null),x=N.useNavigate(),m=et(),f=!!c,h=r?.applications||[];n.useEffect(()=>{function g(y){u.current&&!u.current.contains(y.target)&&d(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),n.useEffect(()=>{function g(y){y.key==="Escape"&&d(!1)}return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[]);const v=g=>{d(!1),g.route&&x(m(g.route))};return e.jsxs("div",{ref:u,className:"relative",children:[e.jsx("button",{onClick:()=>d(!i),className:"p-2 hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-button)"},"aria-expanded":i,"aria-haspopup":"true",title:t("appSwitcher.title","Applications"),children:e.jsx(l.LayoutGrid,{className:"w-5 h-5 text-[var(--text-secondary)]"})}),e.jsx("div",{className:`absolute right-0 mt-2 w-80 origin-top-right transition-all duration-200 ease-out ${i?"opacity-100 scale-100 translate-y-0":"opacity-0 scale-95 -translate-y-2 pointer-events-none"}`,children:e.jsxs("div",{className:"bg-[var(--bg-card)] border border-[var(--border-color)] shadow-xl overflow-hidden",style:{borderRadius:"var(--radius-card)"},children:[s.length>0&&e.jsxs("div",{className:"p-3 border-b border-[var(--border-color)]",children:[e.jsxs("p",{className:"px-2 py-1 text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider flex items-center gap-2",children:[e.jsx(l.Star,{className:"w-3 h-3 text-amber-500 fill-amber-500"}),t("appSwitcher.favorites","Favoris")]}),e.jsx("div",{className:"grid grid-cols-3 gap-1 mt-2",children:s.slice(0,6).map(g=>e.jsx(Es,{app:g,isFavorite:!0,showFavorite:f,onToggleFavorite:()=>a(g.id),onSelect:()=>{d(!1),g.route&&x(m(g.route))}},g.id))})]}),e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"px-2 py-1 text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider",children:t("appSwitcher.allApps","Toutes les applications")}),h.length>0?e.jsx("div",{className:"grid grid-cols-3 gap-1 mt-2 max-h-64 overflow-y-auto",children:h.map(g=>e.jsx(Es,{app:g,isFavorite:o(g.id),showFavorite:f,onToggleFavorite:()=>a(g.id),onSelect:()=>v(g)},g.id))}):e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] text-center py-6",children:t("appSwitcher.noApps","Aucune application disponible")})]})]})})]})}function mo(){const[t,s]=n.useState([]),r=n.useCallback(async()=>{try{const c=await je.myTenants.getFavorites();s(c)}catch{}},[]),a=n.useCallback(async c=>{const i=t.includes(c);try{if(i){const d=await je.myTenants.removeFavorite(c);s(d)}else{const d=await je.myTenants.addFavorite(c);s(d)}}catch(d){console.error("Failed to toggle favorite:",d)}},[t]),o=n.useCallback(c=>{je.myTenants.recordRecent(c).catch(console.error)},[]);return{favorites:t,loadFavorites:r,toggleFavorite:a,recordRecent:o}}const xo={Pending:"bg-blue-500",Active:"bg-emerald-500",Suspended:"bg-amber-500",Archived:"bg-gray-400"},po={Pending:"En attente",Active:"Actif",Suspended:"Suspendu",Archived:"Archivé"};function _t({tenant:t,isSelected:s,isFavorite:r,hasThemeOverride:a,onSelect:o,onToggleFavorite:c,showStatus:i=!0}){const d=t.type==="Business",u=t.status==="Active",x=(m,f)=>m?"bg-[var(--color-accent-500)]/10 text-[var(--color-accent-600)]":f?"hover:bg-[var(--bg-tertiary)] text-[var(--text-primary)]":"opacity-50 cursor-not-allowed text-[var(--text-tertiary)]";return e.jsxs("div",{className:"flex items-center group",children:[e.jsxs("button",{onClick:o,disabled:!u,className:`flex-1 flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 ${x(s,u)}`,style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:`flex-shrink-0 w-8 h-8 flex items-center justify-center ${d?"bg-blue-500/10":"bg-violet-500/10"}`,style:{borderRadius:"var(--radius-card)"},children:d?e.jsx(l.Building2,{className:"w-4 h-4 text-blue-500"}):e.jsx(l.User,{className:"w-4 h-4 text-violet-500"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium truncate",children:t.name}),a&&e.jsx("span",{className:"w-2 h-2 rounded-full bg-[var(--color-accent-500)]",title:"Thème personnalisé"})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx("span",{className:"text-xs text-[var(--text-tertiary)] truncate",children:t.organisationName||t.slug}),i&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${xo[t.status]}`}),t.status!=="Active"&&e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:po[t.status]})]})]})]}),s&&e.jsx(l.Check,{className:"w-4 h-4 text-[var(--color-accent-500)] flex-shrink-0"})]}),c&&u&&e.jsx("button",{onClick:m=>{m.stopPropagation(),c()},className:`p-2 transition-colors ${r?"text-amber-500":"text-[var(--text-tertiary)] opacity-0 group-hover:opacity-100 hover:text-amber-500"}`,title:r?"Retirer des favoris":"Ajouter aux favoris",children:e.jsx(l.Star,{className:`w-4 h-4 ${r?"fill-amber-500":""}`})})]})}const Yr="tenant_recents",Qt=5;function Jr(){try{return JSON.parse(localStorage.getItem(Yr)||"[]")}catch{return[]}}function ho(t){const s=Jr().filter(r=>r!==t);s.unshift(t),localStorage.setItem(Yr,JSON.stringify(s.slice(0,Qt)))}const go=(t,s,r)=>{const a=o=>{t.current&&!t.current.contains(o.target)&&(s(!1),r(""))};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},fo=(t,s)=>{const r=a=>{a.key==="Escape"&&(t(!1),s(""))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},bo=(t,s,r,a,o)=>{const c=n.useMemo(()=>t.filter(u=>s.includes(u.id)&&u.status==="Active"),[t,s]),i=n.useMemo(()=>{if(o.trim())return[];const u=new Set(s);return r.map(x=>a.find(m=>m.id===x)).filter(x=>!!x&&x.status==="Active"&&!u.has(x.id)).slice(0,Qt)},[r,a,s,o]),d=n.useMemo(()=>{const u=new Set([...s,...r.slice(0,Qt)]);return t.filter(x=>!u.has(x.id))},[t,s,r]);return{favoriteTenants:c,recentTenants:i,otherTenants:d}};function vo(){const{t}=ne.useTranslation("navigation"),{refreshMenu:s}=Re(),{currentTenant:r,userTenants:a,switchTenant:o,isLoading:c,hasMultipleTenants:i,hasGlobalRoles:d,isGlobalView:u,enterGlobalView:x}=Ee(),{tenantOverrides:m,loadTenantOverrides:f}=St(),[h,v]=n.useState(!1),[g,y]=n.useState(""),[p]=n.useState(()=>Jr()),b=n.useRef(null),j=n.useRef(null),{favorites:S,loadFavorites:w,toggleFavorite:P,recordRecent:$}=mo();n.useEffect(()=>{h&&(w(),f())},[h,w,f]),n.useEffect(()=>{h&&j.current&&setTimeout(()=>j.current?.focus(),100)},[h]),n.useEffect(()=>go(b,v,y),[]),n.useEffect(()=>fo(v,y),[]);const A=n.useCallback(async E=>{if(E===r?.id&&!u){v(!1);return}try{ho(E),$(E),await o(E),v(!1),y(""),await s()}catch(z){console.error("Failed to switch tenant:",z)}},[r?.id,u,o,s,$]),k=n.useCallback(async()=>{await x(),v(!1),y(""),await s()},[x,s]),R=n.useCallback(async E=>{await P(E)},[P]),L=n.useMemo(()=>{if(!g.trim())return a;const E=g.toLowerCase();return a.filter(z=>z.name.toLowerCase().includes(E)||z.slug.toLowerCase().includes(E)||z.organisationName&&z.organisationName.toLowerCase().includes(E))},[a,g]),{favoriteTenants:I,recentTenants:C,otherTenants:O}=bo(L,S,p,a,g);if(c)return null;if(!(i||d)&&r){const E=r.type==="Business";return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-[var(--bg-secondary)] border border-[var(--border-color)]",style:{borderRadius:"var(--radius-button)"},children:[E?e.jsx(l.Building2,{className:"w-4 h-4 text-blue-500"}):e.jsx(l.User,{className:"w-4 h-4 text-violet-500"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r.name})]})}return e.jsxs("div",{ref:b,className:"relative",children:[e.jsxs("button",{onClick:()=>v(!h),className:`flex items-center gap-2 px-3 py-1.5 border transition-colors ${u?"bg-emerald-500/10 border-emerald-500/30 hover:bg-emerald-500/20":"bg-[var(--bg-secondary)] border-[var(--border-color)] hover:bg-[var(--bg-tertiary)]"}`,style:{borderRadius:"var(--radius-button)"},"aria-expanded":h,"aria-haspopup":"true",children:[u?e.jsxs(e.Fragment,{children:[e.jsx(l.Globe,{className:"w-4 h-4 text-emerald-600"}),e.jsx("span",{className:"text-sm font-medium text-emerald-700",children:t("tenants.selector.global","Global")})]}):r?e.jsxs(e.Fragment,{children:[r.type==="Business"?e.jsx(l.Building2,{className:"w-4 h-4 text-blue-500"}):e.jsx(l.User,{className:"w-4 h-4 text-violet-500"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)] max-w-[120px] truncate",children:r.name})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Building2,{className:"w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-secondary)]",children:t("tenants.selector.select","Select")})]}),e.jsx(l.ChevronDown,{className:`w-4 h-4 text-[var(--text-tertiary)] transition-transform ${h?"rotate-180":""}`})]}),e.jsx("div",{className:`absolute left-0 mt-2 w-80 origin-top-left transition-all duration-200 ease-out z-50 ${h?"opacity-100 scale-100 translate-y-0":"opacity-0 scale-95 -translate-y-2 pointer-events-none"}`,children:e.jsxs("div",{className:"bg-[var(--bg-card)] border border-[var(--border-color)] shadow-xl overflow-hidden",style:{borderRadius:"var(--radius-card)"},children:[e.jsx("div",{className:"p-2 border-b border-[var(--border-color)]",children:e.jsxs("div",{className:"relative",children:[e.jsx(l.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("input",{ref:j,type:"text",value:g,onChange:E=>y(E.target.value),placeholder:t("tenants.selector.search","Rechercher..."),className:"w-full pl-9 pr-3 py-2 text-sm bg-[var(--bg-secondary)] border border-[var(--border-color)] focus:border-[var(--color-accent-500)] focus:outline-none",style:{borderRadius:"var(--radius-input)"}})]})}),e.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[d&&!g&&e.jsx("div",{className:"p-2 border-b border-[var(--border-color)]",children:e.jsxs("button",{onClick:k,className:`w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all duration-150 ${u?"bg-emerald-500/10 text-emerald-700":"hover:bg-[var(--bg-tertiary)] text-[var(--text-primary)]"}`,style:{borderRadius:"var(--radius-menu-item)"},children:[e.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-emerald-500/10 flex items-center justify-center",style:{borderRadius:"var(--radius-card)"},children:e.jsx(l.Globe,{className:"w-4 h-4 text-emerald-600"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-medium",children:t("tenants.selector.global","Global")}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mt-0.5",children:t("tenants.selector.globalDesc","Voir tous les tenants")})]}),u&&e.jsx(l.Check,{className:"w-4 h-4 text-emerald-600 flex-shrink-0"})]})}),I.length>0&&e.jsxs("div",{className:"p-2",children:[e.jsxs("p",{className:"px-2 py-1 text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(l.Star,{className:"w-3 h-3 text-amber-500"}),t("tenants.selector.favorites","Favoris")]}),e.jsx("div",{className:"mt-1",children:I.map(E=>e.jsx(_t,{tenant:E,isSelected:!u&&r?.id===E.id,isFavorite:!0,hasThemeOverride:m.includes(E.id),onSelect:()=>A(E.id),onToggleFavorite:()=>R(E.id)},E.id))})]}),C.length>0&&e.jsxs("div",{className:`p-2 ${I.length>0?"border-t border-[var(--border-color)]":""}`,children:[e.jsxs("p",{className:"px-2 py-1 text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(l.Clock,{className:"w-3 h-3"}),t("tenants.selector.recent","Récents")]}),e.jsx("div",{className:"mt-1",children:C.map(E=>e.jsx(_t,{tenant:E,isSelected:!u&&r?.id===E.id,isFavorite:S.includes(E.id),hasThemeOverride:m.includes(E.id),onSelect:()=>A(E.id),onToggleFavorite:()=>R(E.id)},E.id))})]}),O.length>0&&e.jsxs("div",{className:`p-2 ${I.length>0||C.length>0?"border-t border-[var(--border-color)]":""}`,children:[!g&&e.jsxs("p",{className:"px-2 py-1 text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(l.Building2,{className:"w-3 h-3"}),t("tenants.selector.all","Tous")]}),e.jsx("div",{className:"mt-1 max-h-40 overflow-y-auto",children:O.map(E=>e.jsx(_t,{tenant:E,isSelected:!u&&r?.id===E.id,isFavorite:S.includes(E.id),hasThemeOverride:m.includes(E.id),onSelect:()=>A(E.id),onToggleFavorite:()=>R(E.id)},E.id))})]}),g&&L.length===0&&e.jsx("div",{className:"p-4 text-center text-sm text-[var(--text-tertiary)]",children:t("tenants.selector.noResults","Aucun résultat")})]}),e.jsx("div",{className:"p-2 border-t border-[var(--border-color)]",children:e.jsxs(N.Link,{to:"/myspace/tenants",className:"flex items-center justify-center gap-2 px-3 py-2 text-sm text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-tertiary)] transition-colors",style:{borderRadius:"var(--radius-button)"},onClick:()=>v(!1),children:[e.jsx(l.Eye,{className:"w-4 h-4"}),t("tenants.selector.viewAll","Voir tous mes espaces")," (",a.length,")"]})})]})})]})}function Qr(t,s){return t?s===t?"current":"other":"global"}const yo={getConfigurations:()=>D.get("/api/support/sla/configurations"),updateConfiguration:(t,s)=>D.put(`/api/support/sla/configurations/${t}`,s),getEscalationRules:()=>D.get("/api/support/sla/escalation-rules"),getBreachedTickets:(t=!0,s=!0)=>D.get("/api/support/sla/breached",{params:{responseBreached:t,resolutionBreached:s}}),getTicketsApproachingBreach:(t=60)=>D.get("/api/support/sla/approaching-breach",{params:{warningMinutes:t}}),getMetrics:(t,s)=>D.get("/api/support/sla/metrics",{params:{fromDate:t,toDate:s}}),escalateTicket:(t,s,r)=>D.post(`/api/support/sla/tickets/${t}/escalate`,{level:s,reason:r})},nt={getAll:(t=1,s=20,r,a)=>D.get("/api/support/notifications",{params:{page:t,pageSize:s,isRead:r,tenantId:a}}),getUnread:(t=10)=>D.get("/api/support/notifications/unread",{params:{limit:t}}),getUnreadCount:()=>D.get("/api/support/notifications/unread/count"),markAsRead:t=>D.patch(`/api/support/notifications/${t}/read`),markAllAsRead:()=>D.patch("/api/support/notifications/read-all"),delete:t=>D.delete(`/api/support/notifications/${t}`),deleteAll:()=>D.delete("/api/support/notifications/all"),getPreferences:()=>D.get("/api/support/notifications/preferences"),updatePreferences:t=>D.put("/api/support/notifications/preferences",t)},qt={getAll:(t,s=!0,r)=>D.get("/api/support/templates",{params:{category:t,activeOnly:s,language:r}}),getById:t=>D.get(`/api/support/templates/${t}`),getCategories:()=>D.get("/api/support/templates/categories"),getByCategory:t=>D.get(`/api/support/templates/by-category/${t}`),create:t=>D.post("/api/support/templates",t),update:(t,s)=>D.put(`/api/support/templates/${t}`,s),activate:t=>D.patch(`/api/support/templates/${t}/activate`),deactivate:t=>D.patch(`/api/support/templates/${t}/deactivate`),delete:t=>D.delete(`/api/support/templates/${t}`),render:(t,s)=>D.post(`/api/support/templates/${t}/render`,{variables:s})},Zt={STARTED:"EntraSyncStarted",COMPLETED:"EntraSyncCompleted",FAILED:"EntraSyncFailed"};function jo(t,s,r){if(r){const o=s.relatedEntityId,c=t.filter(i=>!(i.type===Zt.STARTED&&i.relatedEntityId===o));return[s,...c].slice(0,10)}return t.some(o=>o.id===s.id)?t:[s,...t].slice(0,10)}function wo(t){return{id:t.id,type:t.type,title:t.title,message:t.message,relatedEntityType:t.relatedEntityType,relatedEntityId:t.relatedEntityId,actionUrl:t.actionUrl,isRead:t.isRead,readAt:t.readAt,createdAt:t.createdAt,tenantId:t.tenantId,tenantName:t.tenantName,tenantSlug:t.tenantSlug}}function No(){const[t,s]=n.useState(0),[r,a]=n.useState([]),[o,c]=n.useState(!1),{isConnected:i,onNotification:d,onUnreadCountUpdate:u}=Cr(),{isFeatureEnabled:x}=Ge(),m=x("support");n.useEffect(()=>{const p=d(j=>{const S=wo(j),w=j.type===Zt.COMPLETED||j.type===Zt.FAILED;a(P=>jo(P,S,w))}),b=u(j=>{s(j)});return()=>{p(),b()}},[d,u]),n.useEffect(()=>{if(!m)return;let p=!1;async function b(){try{const j=await nt.getUnreadCount();p||s(j.count)}catch(j){p||console.error("Failed to load unread count:",j)}}return b(),()=>{p=!0}},[m]);const f=n.useCallback(async()=>{if(m)try{c(!0);const p=await nt.getUnread(10);a(p)}catch(p){console.error("Failed to load notifications:",p)}finally{c(!1)}},[m]),h=n.useCallback(async p=>{try{await nt.markAsRead(p),a(b=>b.map(j=>j.id===p?{...j,isRead:!0}:j)),s(b=>Math.max(0,b-1))}catch(b){console.error("Failed to mark as read:",b)}},[]),v=n.useCallback(async()=>{try{await nt.markAllAsRead(),a(p=>p.map(b=>({...b,isRead:!0}))),s(0)}catch(p){console.error("Failed to mark all as read:",p)}},[]),g=n.useCallback(async p=>{try{await nt.delete(p);const b=r.find(j=>j.id===p);a(j=>j.filter(S=>S.id!==p)),b&&!b.isRead&&s(j=>Math.max(0,j-1))}catch(b){console.error("Failed to delete notification:",b)}},[r]),y=n.useCallback(p=>{nt.markAsRead(p),s(b=>Math.max(0,b-1))},[]);return{notifications:r,unreadCount:t,loading:o,isConnected:i,loadNotifications:f,markAsRead:h,markAllAsRead:v,deleteNotification:g,markAsReadSilent:y}}const vt={STARTED:"EntraSyncStarted",COMPLETED:"EntraSyncCompleted",FAILED:"EntraSyncFailed"};function Zr(){const t=N.useNavigate(),{currentTenant:s,hasMultipleTenants:r}=Ee(),[a,o]=n.useState(!1),c=n.useRef(null),{notifications:i,unreadCount:d,loading:u,isConnected:x,loadNotifications:m,markAsRead:f,markAllAsRead:h,deleteNotification:v,markAsReadSilent:g}=No(),[,y]=n.useState(0);n.useEffect(()=>{if(!i.some(R=>R.type===vt.STARTED&&!R.isRead))return;const k=setInterval(()=>{y(R=>R+1)},1e3);return()=>clearInterval(k)},[i]),n.useEffect(()=>{a&&m()},[a,m]),n.useEffect(()=>{const A=k=>{c.current&&!c.current.contains(k.target)&&o(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);const p=(A,k)=>{k.stopPropagation(),f(A)},b=(A,k)=>{k.stopPropagation(),v(A)},j=A=>{A.isRead||g(A.id),o(!1),A.actionUrl&&t(A.actionUrl)},S=A=>{switch(A){case"TicketCreated":return"🎫";case"TicketAssigned":return"👤";case"TicketStatusChanged":case"StatusChanged":return"🔄";case"TicketCommented":case"CommentAdded":return"💬";case"TicketResolved":return"✅";case"TicketClosed":return"🔒";case"TicketUpdated":return"📝";case"SlaResponseBreached":case"SlaResolutionBreached":return"⚠️";case"SlaWarning":return"⏰";case"TicketEscalated":return"📈";case"SatisfactionRequested":return"⭐";case"GroupMemberAdded":return"👥";case"GroupMemberRemoved":return"🚪";case"RoleAssigned":return"🎭";case"RoleRemoved":return"🚫";case"RolePermissionsChanged":return"🔑";case"AccountUpdated":return"👤";case"SystemAnnouncement":return"📢";case vt.STARTED:return null;case vt.COMPLETED:return"✅";case vt.FAILED:return"❌";default:return"📌"}},w=A=>{const k=new Date(A).getTime(),R=Date.now(),L=Math.floor((R-k)/1e3),I=Math.floor(L/60),C=L%60;return`${I.toString().padStart(2,"0")}:${C.toString().padStart(2,"0")}`},P=A=>{const k=new Date(A),L=new Date().getTime()-k.getTime(),I=Math.floor(L/6e4),C=Math.floor(I/60),O=Math.floor(C/24);return I<1?"Just now":I<60?`${I}m ago`:C<24?`${C}h ago`:O<7?`${O}d ago`:k.toLocaleDateString()},$=A=>{if(!r)return null;const k=Qr(A.tenantId,s?.id??null);return k==="global"?e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 border border-purple-200 dark:border-purple-700",children:"System"}):k==="current"?e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--bg-secondary)] text-[var(--text-secondary)] border border-[var(--border-color)] truncate max-w-[120px]",children:A.tenantName}):e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 border border-blue-200 dark:border-blue-700 font-medium truncate max-w-[120px]",children:A.tenantName})};return e.jsxs("div",{className:"relative",ref:c,children:[e.jsxs("button",{onClick:()=>o(!a),className:"relative p-2 rounded-lg hover:bg-[var(--bg-hover)] transition-colors","aria-label":"Notifications",children:[e.jsx(l.Bell,{className:"w-5 h-5"}),d>0&&e.jsx("span",{className:"absolute -top-1 -right-1 w-5 h-5 bg-red-500 text-white text-xs font-bold rounded-full flex items-center justify-center",children:d>9?"9+":d})]}),a&&e.jsxs("div",{className:"absolute right-0 mt-2 w-96 bg-[var(--bg-primary)] rounded-lg shadow-xl border border-[var(--border-color)] z-50 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-[var(--border-color)]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold",children:"Notifications"}),x?e.jsx("span",{title:"Real-time connected",children:e.jsx(l.Wifi,{className:"w-3 h-3 text-green-500"})}):e.jsx("span",{title:"Offline mode",children:e.jsx(l.WifiOff,{className:"w-3 h-3 text-gray-400"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d>0&&e.jsxs("button",{onClick:h,className:"text-sm text-[var(--color-primary-600)] hover:underline flex items-center gap-1",children:[e.jsx(l.CheckCheck,{className:"w-4 h-4"}),"Mark all read"]}),e.jsx("button",{onClick:()=>o(!1),className:"p-1 rounded hover:bg-[var(--bg-hover)]",children:e.jsx(l.X,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"max-h-96 overflow-y-auto",children:u?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--color-primary-600)]"})}):i.length>0?i.map(A=>{const k=A.type===vt.STARTED&&!A.isRead,R=S(A.type);return e.jsx("div",{onClick:()=>j(A),onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&j(A)},role:"button",tabIndex:0,className:`p-4 border-b border-[var(--border-color)] cursor-pointer hover:bg-[var(--bg-hover)] transition-colors ${A.isRead?"":"bg-blue-50/50 dark:bg-blue-900/10"} ${k?"bg-[var(--color-accent-50)] dark:bg-[var(--color-accent-900)]/20":""}`,children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("span",{className:"text-xl flex-shrink-0",children:k?e.jsx(l.RefreshCw,{className:"w-5 h-5 text-[var(--color-accent-600)] animate-spin"}):R}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:`text-sm ${A.isRead?"":"font-semibold"}`,children:A.title}),$(A)]}),k?e.jsxs("span",{className:"text-xs font-mono font-bold text-[var(--color-accent-600)] flex-shrink-0 bg-[var(--color-accent-100)] px-2 py-0.5 rounded",children:["⏱ ",w(A.createdAt)]}):e.jsx("span",{className:"text-xs text-[var(--text-secondary)] flex-shrink-0",children:P(A.createdAt)})]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] line-clamp-2 mt-1",children:A.message})]}),e.jsxs("div",{className:"flex flex-col gap-1 flex-shrink-0",children:[!A.isRead&&!k&&e.jsx("button",{onClick:L=>p(A.id,L),className:"p-1 rounded hover:bg-[var(--bg-secondary)]",title:"Mark as read",children:e.jsx(l.Check,{className:"w-4 h-4 text-green-600"})}),!k&&e.jsx("button",{onClick:L=>b(A.id,L),className:"p-1 rounded hover:bg-[var(--bg-secondary)]",title:"Delete",children:e.jsx(l.Trash2,{className:"w-4 h-4 text-red-500"})})]})]})},A.id)}):e.jsxs("div",{className:"py-8 text-center text-[var(--text-secondary)]",children:[e.jsx(l.Bell,{className:"w-12 h-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No notifications"})]})}),e.jsx("div",{className:"p-3 border-t border-[var(--border-color)] text-center",children:e.jsx("button",{onClick:()=>{o(!1),t("/notifications")},className:"text-sm text-[var(--color-primary-600)] hover:underline",children:"View all notifications"})})]})]})}const So={default:{bg:"bg-[var(--bg-tertiary)]",text:"text-[var(--text-primary)]",border:"border-[var(--border-color)]",arrow:"bg-[var(--bg-tertiary)] border-[var(--border-color)]"},error:{bg:"bg-[var(--tooltip-error-bg)]",text:"text-[var(--error-text)]",border:"border-[var(--error-border)]",arrow:"bg-[var(--tooltip-error-bg)] border-[var(--error-border)]"},warning:{bg:"bg-[var(--tooltip-warning-bg)]",text:"text-[var(--warning-text)]",border:"border-[var(--warning-border)]",arrow:"bg-[var(--tooltip-warning-bg)] border-[var(--warning-border)]"},success:{bg:"bg-[var(--tooltip-success-bg)]",text:"text-[var(--success-text)]",border:"border-[var(--success-border)]",arrow:"bg-[var(--tooltip-success-bg)] border-[var(--success-border)]"},info:{bg:"bg-[var(--tooltip-info-bg)]",text:"text-[var(--info-text)]",border:"border-[var(--info-border)]",arrow:"bg-[var(--tooltip-info-bg)] border-[var(--info-border)]"}};function ea({content:t,children:s,position:r="top",variant:a="default",delay:o=200,disabled:c=!1,className:i=""}){const d=So[a],[u,x]=n.useState(!1),[m,f]=n.useState({top:0,left:0}),h=n.useRef(null),v=n.useRef(null),g=n.useRef(null),y=()=>{if(!h.current||!v.current)return;const S=h.current.getBoundingClientRect(),w=v.current.getBoundingClientRect(),P=window.scrollX,$=window.scrollY,A=8;let k=0,R=0;switch(r){case"top":k=S.top+$-w.height-A,R=S.left+P+(S.width-w.width)/2;break;case"bottom":k=S.bottom+$+A,R=S.left+P+(S.width-w.width)/2;break;case"left":k=S.top+$+(S.height-w.height)/2,R=S.left+P-w.width-A;break;case"right":k=S.top+$+(S.height-w.height)/2,R=S.right+P+A;break}const L=window.innerWidth,I=window.innerHeight,C=8;R<C?R=C:R+w.width>L-C&&(R=L-w.width-C),k<C+$?k=C+$:k+w.height>I+$-C&&(k=I+$-w.height-C),f({top:k,left:R})};n.useEffect(()=>(u&&(y(),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y)),()=>{window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y)}),[u,r]);const p=()=>{c||!t||(g.current=setTimeout(()=>{x(!0)},o))},b=()=>{g.current&&(clearTimeout(g.current),g.current=null),x(!1)};n.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const j=()=>{const S=`absolute w-2 h-2 ${d.arrow} transform rotate-45`;switch(r){case"top":return`${S} -bottom-1 left-1/2 -translate-x-1/2 border-r border-b`;case"bottom":return`${S} -top-1 left-1/2 -translate-x-1/2 border-l border-t`;case"left":return`${S} -right-1 top-1/2 -translate-y-1/2 border-t border-r`;case"right":return`${S} -left-1 top-1/2 -translate-y-1/2 border-b border-l`}};return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:h,onMouseEnter:p,onMouseLeave:b,onFocus:p,onBlur:b,className:"inline-flex",children:s}),u&&t&&$t.createPortal(e.jsxs("div",{ref:v,role:"tooltip",style:{position:"absolute",top:m.top,left:m.left,zIndex:9999},className:`
3
3
  px-3 py-2 text-sm font-medium
4
4
  ${d.bg} ${d.text}
@@ -26,7 +26,7 @@
26
26
 
27
27
  ${i("errors.accessDenied.ticket.navigationContext")}:
28
28
  ${b.join(`
29
- `)}`},[v,i]),y=n.useMemo(()=>{if(!t||!r||!s||!a)return null;const j=`${a.replace(/\/applications$/,"")}/support/my-tickets/create`,S=t==="tenant"?"ApplicationRequest":"Support",w=r.split(".")[0],P=t==="tenant"?i("errors.accessDenied.ticket.accessSubject",{permissionPath:r,tenantName:s}):i("errors.accessDenied.ticket.permissionSubject",{permissionPath:r,tenantName:s}),A=(t==="tenant"?i("errors.accessDenied.ticket.accessBody",{appCode:w,tenantName:s,permissionPath:r}):i("errors.accessDenied.ticket.permissionBody",{permissionPath:r,tenantName:s}))+g,k=new URLSearchParams({type:S,subject:P,body:A});return`${j}?${k.toString()}`},[t,r,s,a,i,g]),p=t==="tenant"&&s?i("errors.accessDenied.tenantNotAvailable",{tenantName:s}):t==="permission"&&s?i("errors.accessDenied.permissionMissing",{tenantName:s}):s?i("errors.accessDenied.tenantDescription",{tenantName:s}):i("errors.accessDenied.description");return e.jsx("div",{className:"min-h-[60vh] flex items-center justify-center p-4",children:e.jsx("div",{className:"max-w-lg w-full p-8 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-2xl shadow-xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-red-500/10 flex items-center justify-center mb-6",children:e.jsx(l.ShieldX,{className:"w-8 h-8 text-red-500"})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:i("errors.accessDenied.title")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-4",children:p}),h?e.jsxs("div",{className:"w-full mb-6 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-color)] divide-y divide-[var(--border-color)]",children:[e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:i("errors.accessDenied.requiredPermission")}),e.jsx("p",{className:"text-sm font-mono font-medium text-red-500",children:r})]}),o&&o.length>0&&e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-2",children:i("errors.accessDenied.yourRoles")}),e.jsx("div",{className:"flex flex-wrap gap-1.5 justify-center",children:o.map(b=>e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium bg-[var(--bg-tertiary)] text-[var(--text-secondary)] border border-[var(--border-color)]",children:b},b))})]}),c&&e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-2",children:i("errors.accessDenied.yourPermissionsFor",{appCode:m??""})}),f.length>0?e.jsx("div",{className:"flex flex-col gap-1 items-start",children:f.map(b=>e.jsx("span",{className:"text-xs font-mono text-[var(--text-secondary)]",children:b},b))}):e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] italic",children:i("errors.accessDenied.noPermissions")})]})]}):r?e.jsxs("div",{className:"w-full mb-6 p-3 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-color)]",children:[e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:i("errors.accessDenied.requiredPermission")}),e.jsx("p",{className:"text-sm font-mono text-[var(--text-primary)]",children:r})]}):null,e.jsxs("div",{className:"flex flex-col gap-3 w-full",children:[y&&e.jsxs("a",{href:y,className:"flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white font-medium transition-all",children:[e.jsx(l.TicketPlus,{className:"w-4 h-4"}),i(t==="tenant"?"errors.accessDenied.requestAccess":"errors.accessDenied.requestPermission")]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[a?e.jsxs("a",{href:a,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.LayoutGrid,{className:"w-4 h-4"}),i("errors.accessDenied.goToApplications")]}):e.jsxs("button",{onClick:x,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.ArrowLeft,{className:"w-4 h-4"}),i("errors.goBack")]}),e.jsxs("a",{href:"/",className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.Home,{className:"w-4 h-4"}),i("errors.home")]})]})]})]})})})}function wi(){const{t}=ne.useTranslation("common"),{logout:s}=Ae();return e.jsx("div",{className:"min-h-[60vh] flex items-center justify-center p-4",children:e.jsx("div",{className:"max-w-lg w-full p-8 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-2xl shadow-xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-orange-500/10 flex items-center justify-center mb-6",children:e.jsx(l.Building2,{className:"w-8 h-8 text-orange-500"})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:t("errors.noActiveWorkspace.title")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-6",children:t("errors.noActiveWorkspace.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[e.jsxs("a",{href:"mailto:support@atlashub.ch",className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white font-medium transition-all",children:[e.jsx(l.Mail,{className:"w-4 h-4"}),t("errors.noActiveWorkspace.contactAdmin")]}),e.jsxs("button",{onClick:()=>{s()},className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.LogOut,{className:"w-4 h-4"}),t("errors.noActiveWorkspace.logout")]})]}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mt-6",children:t("errors.noActiveWorkspace.hint")})]})})})}function Nt(){return e.jsx("div",{className:"flex items-center justify-center min-h-[400px] w-full",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx(l.Loader2,{className:"w-10 h-10 animate-spin text-[var(--color-primary-500)]"}),e.jsx("span",{className:"text-sm text-[var(--color-text-secondary)]",children:"Chargement..."})]})})}function la(){const{user:t,isLoading:s}=Ae(),r=N.useLocation(),{currentAppCode:a,currentModuleCode:o,isLoading:c,menu:i}=Re(),{currentTenant:d,userTenants:u,isLoading:x,isGlobalView:m}=Ee(),f=d?.id||"global",h=n.useRef(d?.id);let v=!1;if(d?.id!==h.current&&(h.current=d?.id,v=!0),s)return e.jsx(Nt,{});if(!t)return e.jsx(N.Navigate,{to:"/login",state:{from:r},replace:!0});if(v||c||x)return e.jsx(Nt,{});if(!d&&!m&&!u.some(j=>j.status==="Active"))return e.jsx(wi,{});if(!a)return e.jsx(N.Outlet,{},f);const y=(i?.applications||[]).find(b=>b.route?.split("/").filter(Boolean)[0]===a||b.code===a);if(y?.isOpen)return e.jsx(N.Outlet,{},f);if(!y){const b=[a,o].filter(Boolean).join("."),j=d?.slug?`/t/${d.slug}/applications`:"/applications";return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:[e.jsx(wt,{onMenuToggle:()=>{}}),e.jsx("main",{className:"pt-16 transition-all duration-300 h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"p-4 sm:p-6 lg:px-10 h-full overflow-auto",children:e.jsx(rs,{reason:"tenant",tenantName:d?.name,permissionPath:b,applicationsUrl:j,userRoles:t.roles,userPermissions:t.permissions})})})]})}const p=[a,o].filter(Boolean).join(".");if(!un(t.permissions,t.roles,p)&&y.accessLevel!=="RequestAccess"){const b=d?.slug?`/t/${d.slug}/applications`:"/applications";return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:[e.jsx(wt,{onMenuToggle:()=>{}}),e.jsx("main",{className:"pt-16 transition-all duration-300 h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"p-4 sm:p-6 lg:px-10 h-full overflow-auto",children:e.jsx(rs,{reason:"permission",tenantName:d?.name,permissionPath:p,applicationsUrl:b,userRoles:t.roles,userPermissions:t.permissions})})})]})}return e.jsx(N.Outlet,{},f)}function Ms(){const{slug:t}=N.useParams(),s=N.useNavigate(),r=N.useLocation(),{currentTenant:a,userTenants:o,switchTenant:c,isLoading:i,isGlobalView:d}=Ee(),{useUrlRouting:u,isLoading:x}=cs(),m=n.useRef(!1),f=n.useRef(null),h=n.useRef(null);return n.useEffect(()=>{if(i||x||!u||d)return;const v=t||Ps(r.pathname),g=v!==h.current;if(h.current=v,!!g&&v&&v!==a?.slug){const y=o.find(p=>p.slug===v&&p.status==="Active");if(y)f.current=v,c(y.id).then(()=>{f.current=null}).catch(p=>{f.current=null,console.error("[TenantRouteWrapper] Failed to switch tenant:",p)});else if(a){const p=ct(r.pathname);s(`/t/${a.slug}${p}`,{replace:!0})}else s("/",{replace:!0})}},[t,r.pathname,a?.slug,o,u,i,x,d,c,s]),n.useEffect(()=>{if(i||x||m.current)return;const v=r.pathname,g=Ps(v);if(d&&g){m.current=!0;const y=ct(v);s(y,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}if(!u&&g){m.current=!0;const y=ct(v);s(y,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}if(u&&a&&!g&&!d&&v!=="/"&&!v.startsWith("/login")&&!v.startsWith("/auth")&&!v.startsWith("/public")){m.current=!0,s(`/t/${a.slug}${v}`,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}if(u&&a&&g&&!d&&g!==a.slug&&g!==f.current){m.current=!0;const y=ct(v);s(`/t/${a.slug}${y}`,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}},[r.pathname,a?.slug,u,i,x,d,s]),e.jsx(N.Outlet,{})}function Oe({to:t,replace:s=!0}){const{slug:r}=N.useParams(),a=r?`/t/${r}${t}`:t;return e.jsx(N.Navigate,{to:a,replace:s})}function Ni(){const{t}=ne.useTranslation("admin"),{license:s}=Ge(),r=et();return!s||s.status==="NoLicense"?e.jsx(ia,{open:!0,onOpenChange:()=>{}}):e.jsxs("div",{className:"fixed inset-0 z-40 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),e.jsxs("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-2xl w-full max-w-md mx-4 overflow-hidden",children:[e.jsx("div",{className:"flex justify-center pt-8 pb-4",children:e.jsx("div",{className:"p-4 bg-red-100 dark:bg-red-900/30 rounded-full",children:e.jsx(l.Lock,{className:"w-10 h-10 text-red-600 dark:text-red-400"})})}),e.jsxs("div",{className:"px-6 pb-6 text-center",children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-2",children:t("license.guard.title","License Required")}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:t("license.guard.description","Your license has expired or is invalid. Access to this area is restricted. Please activate a valid license to continue using the platform.")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs(N.Link,{to:r("/administration/configuration/license"),className:"w-full inline-flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(l.Settings,{className:"w-4 h-4"}),t("license.guard.manageLicense","Manage License")]}),e.jsxs(N.Link,{to:r("/myspace/profile"),className:"w-full inline-flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:[e.jsx(l.User,{className:"w-4 h-4"}),t("license.guard.myProfile","My Profile")]})]})]})]})]})}const Si=["/myspace","/administration/configuration"];function Ci(t){const s=t.match(/^\/t\/[^/]+\/(.*)/);return s?`/${s[1]}`:t}function ca(){const{license:t,isLoading:s,isReadOnlyMode:r}=Ge(),a=N.useLocation();if(s)return e.jsx(N.Outlet,{});const o=Ci(a.pathname);return Si.some(i=>o.startsWith(i))?e.jsx(N.Outlet,{}):!t?.isValid||r?e.jsxs(e.Fragment,{children:[e.jsx(N.Outlet,{}),e.jsx(Ni,{})]}):e.jsx(N.Outlet,{})}function fs({feature:t}){const{t:s}=ne.useTranslation("admin"),{isFeatureEnabled:r,license:a,isLoading:o}=Ge();return o?e.jsx(N.Outlet,{}):r(t)?e.jsx(N.Outlet,{}):e.jsx("div",{className:"flex items-center justify-center min-h-[60vh] p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 bg-gray-50 dark:bg-gray-800/50 rounded-xl border-2 border-dashed border-gray-200 dark:border-gray-700 max-w-md",children:[e.jsx("div",{className:"p-4 bg-gray-100 dark:bg-gray-700 rounded-full mb-4",children:e.jsx(l.Lock,{className:"w-8 h-8 text-gray-400 dark:text-gray-500"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:s("license.featureNotAvailable","Feature Not Available")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center max-w-sm mb-4",children:s("license.upgradeToAccess","Upgrade your license to access the {{feature}} feature.",{feature:t})}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 dark:text-gray-500",children:[e.jsx(l.Sparkles,{className:"w-4 h-4"}),e.jsx("span",{children:s("license.currentEdition","Current: {{edition}}",{edition:a?.edition||"Unknown"})})]})]})})}const Fs=n.lazy(()=>Promise.resolve().then(()=>Ko).then(t=>({default:t.DocsLayout}))),ki=n.lazy(()=>Promise.resolve().then(()=>require("./DocsIndexPage-BPfi0FQD.cjs")).then(t=>({default:t.DocsIndexPage}))),Ai=n.lazy(()=>Promise.resolve().then(()=>require("./SmartStackPresentationPage-52Nb7F0X.cjs")).then(t=>({default:t.SmartStackPresentationPage}))),Ri=n.lazy(()=>Promise.resolve().then(()=>require("./DeveloperIndexPage-CtBfD2JI.cjs")).then(t=>({default:t.DeveloperIndexPage}))),Pi=n.lazy(()=>Promise.resolve().then(()=>require("./InfrastructurePage-D4ZjLzI_.cjs")).then(t=>({default:t.InfrastructurePage}))),Ti=n.lazy(()=>Promise.resolve().then(()=>require("./InstallationPage-BJ-GBVPp.cjs")).then(t=>({default:t.InstallationPage}))),Ei=n.lazy(()=>Promise.resolve().then(()=>require("./DatabasePage-CRq_-Yo2.cjs")).then(t=>({default:t.DatabasePage}))),$i=n.lazy(()=>Promise.resolve().then(()=>require("./DualDbContextPage--Qk-qEgD.cjs")).then(t=>({default:t.DualDbContextPage}))),Ii=n.lazy(()=>Promise.resolve().then(()=>require("./CrossSchemaFkPage-DqFNORYd.cjs")).then(t=>({default:t.CrossSchemaFkPage}))),Li=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0AgM8YN.cjs")).then(t=>({default:t.TenantIndexPage}))),Di=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0AgM8YN.cjs")).then(t=>({default:t.MultiTenantModePage}))),Mi=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0AgM8YN.cjs")).then(t=>({default:t.TenantB2CPage}))),Fi=n.lazy(()=>Promise.resolve().then(()=>require("./TeamsIntegrationPage-DXj5MDRS.cjs")).then(t=>({default:t.TeamsIntegrationPage}))),Oi=n.lazy(()=>Promise.resolve().then(()=>require("./index-CdORB0b4.cjs")).then(t=>({default:t.SecurityTestingPage}))),Ui=n.lazy(()=>Promise.resolve().then(()=>require("./UserIndexPage-DahU6wzK.cjs")).then(t=>({default:t.UserIndexPage}))),Bi=n.lazy(()=>Promise.resolve().then(()=>require("./ArchitecturePage-Cn_XCDAo.cjs")).then(t=>({default:t.ArchitecturePage}))),_i=n.lazy(()=>Promise.resolve().then(()=>require("./ModulesPage-lz8DUm3X.cjs")).then(t=>({default:t.ModulesPage}))),qi=n.lazy(()=>Promise.resolve().then(()=>require("./SlaDocPage-D44QWNY8.cjs")).then(t=>({default:t.SlaDocPage}))),zi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportIndexPage-CsDQ35Cu.cjs")).then(t=>({default:t.SupportIndexPage}))),Gi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportDashboardDocPage-DpgGq5Mm.cjs")).then(t=>({default:t.SupportDashboardDocPage}))),Ki=n.lazy(()=>Promise.resolve().then(()=>require("./SupportTicketsDocPage-C_ybDTjC.cjs")).then(t=>({default:t.SupportTicketsDocPage}))),Hi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportMyTicketsDocPage-jE1UMaIY.cjs")).then(t=>({default:t.SupportMyTicketsDocPage}))),Vi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportTemplatesDocPage-ajO-cHmK.cjs")).then(t=>({default:t.SupportTemplatesDocPage}))),Wi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportEscalationDocPage-WXkAQr8k.cjs")).then(t=>({default:t.SupportEscalationDocPage}))),Xi=n.lazy(()=>Promise.resolve().then(()=>require("./AiDocPage-CM7j_50_.cjs")).then(t=>({default:t.AiDocPage}))),Yi=n.lazy(()=>Promise.resolve().then(()=>require("./SettingsDocPage-Dqj8KzOa.cjs")).then(t=>({default:t.SettingsDocPage}))),Ji=n.lazy(()=>Promise.resolve().then(()=>require("./ThemeDocPage-B6x55uSE.cjs")).then(t=>({default:t.ThemeDocPage}))),Qi=n.lazy(()=>Promise.resolve().then(()=>require("./BaIndexPage-BhdOX87v.cjs")).then(t=>({default:t.BaIndexPage}))),Os=n.lazy(()=>Promise.resolve().then(()=>require("./BaViewerPage-SYgjCF7x.cjs")).then(t=>({default:t.BaViewerPage}))),Zi=n.lazy(()=>Promise.resolve().then(()=>require("./index-C9BaizLE.cjs"))),el=n.lazy(()=>Promise.resolve().then(()=>require("./index-ASxPhrgZ.cjs"))),tl=n.lazy(()=>Promise.resolve().then(()=>require("./index-BnWMDCRU.cjs"))),sl=n.lazy(()=>Promise.resolve().then(()=>require("./index-C54HbULX.cjs"))),rl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DDJTWztK.cjs"))),al=n.lazy(()=>Promise.resolve().then(()=>require("./index-ZVUUUZmv.cjs"))),nl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DmuVa7Ye.cjs"))),ol=n.lazy(()=>Promise.resolve().then(()=>require("./index-Dxau-XnQ.cjs"))),il=n.lazy(()=>Promise.resolve().then(()=>require("./index-Txfokhn3.cjs"))),ll=n.lazy(()=>Promise.resolve().then(()=>require("./index-BYhFG50Z.cjs"))),cl=n.lazy(()=>Promise.resolve().then(()=>require("./index-eAHjmtzn.cjs"))),dl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DKK07NF1.cjs"))),ul=n.lazy(()=>Promise.resolve().then(()=>require("./index-CtcdHE_9.cjs"))),ml=n.lazy(()=>Promise.resolve().then(()=>require("./index-CBOLnJkG.cjs"))),xl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DKRiN1hJ.cjs"))),pl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DdsLBKHV.cjs"))),hl=n.lazy(()=>Promise.resolve().then(()=>require("./index-1tvWzIw0.cjs"))),gl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DJXny6rD.cjs"))),fl=n.lazy(()=>Promise.resolve().then(()=>require("./index-Bup-dL1l.cjs"))),bl=n.lazy(()=>Promise.resolve().then(()=>require("./index-Du4fQfix.cjs"))),vl=n.lazy(()=>Promise.resolve().then(()=>require("./index-BP5i2CQo.cjs")));function yl(){return e.jsxs(e.Fragment,{children:[e.jsxs(N.Route,{path:"/system/docs",element:e.jsx(Fs,{}),children:[e.jsx(N.Route,{index:!0,element:e.jsx(ki,{})}),e.jsx(N.Route,{path:"developer",element:e.jsx(Ri,{})}),e.jsx(N.Route,{path:"developer/infrastructure",element:e.jsx(Pi,{})}),e.jsx(N.Route,{path:"developer/installation",element:e.jsx(Ti,{})}),e.jsx(N.Route,{path:"developer/database",element:e.jsx(Ei,{})}),e.jsx(N.Route,{path:"developer/dual-dbcontext",element:e.jsx($i,{})}),e.jsx(N.Route,{path:"developer/cross-schema-fk",element:e.jsx(Ii,{})}),e.jsx(N.Route,{path:"developer/tenants",element:e.jsx(Li,{})}),e.jsx(N.Route,{path:"developer/tenants/multi-tenant-mode",element:e.jsx(Di,{})}),e.jsx(N.Route,{path:"developer/tenants/b2c",element:e.jsx(Mi,{})}),e.jsx(N.Route,{path:"developer/multi-tenant-mode",element:e.jsx(N.Navigate,{to:"/system/docs/developer/tenants/multi-tenant-mode",replace:!0})}),e.jsx(N.Route,{path:"developer/teams-integration",element:e.jsx(Fi,{})}),e.jsx(N.Route,{path:"developer/testing/security",element:e.jsx(Oi,{})}),e.jsx(N.Route,{path:"user",element:e.jsx(Ui,{})}),e.jsx(N.Route,{path:"user/architecture",element:e.jsx(Bi,{})}),e.jsx(N.Route,{path:"user/modules",element:e.jsx(_i,{})}),e.jsx(N.Route,{path:"user/support",element:e.jsx(zi,{})}),e.jsx(N.Route,{path:"user/support-dashboard",element:e.jsx(Gi,{})}),e.jsx(N.Route,{path:"user/support-tickets",element:e.jsx(Ki,{})}),e.jsx(N.Route,{path:"user/support-my-tickets",element:e.jsx(Hi,{})}),e.jsx(N.Route,{path:"user/support-sla",element:e.jsx(qi,{})}),e.jsx(N.Route,{path:"user/support-templates",element:e.jsx(Vi,{})}),e.jsx(N.Route,{path:"user/support-escalation",element:e.jsx(Wi,{})}),e.jsx(N.Route,{path:"user/ai",element:e.jsx(Xi,{})}),e.jsx(N.Route,{path:"user/settings",element:e.jsx(Yi,{})}),e.jsx(N.Route,{path:"user/theme",element:e.jsx(Ji,{})}),e.jsx(N.Route,{path:"ba",element:e.jsx(Qi,{})}),e.jsx(N.Route,{path:"ba/:appCode",element:e.jsx(Os,{})}),e.jsx(N.Route,{path:"ba/:appCode/:moduleCode",element:e.jsx(Os,{})})]}),e.jsxs(N.Route,{path:"/docs/business",element:e.jsx(Fs,{}),children:[e.jsx(N.Route,{path:"administration/users",element:e.jsx(Zi,{})}),e.jsx(N.Route,{path:"administration/users/dashboard",element:e.jsx(el,{})}),e.jsx(N.Route,{path:"administration/users/references",element:e.jsx(tl,{})}),e.jsx(N.Route,{path:"administration/users/groups",element:e.jsx(sl,{})}),e.jsx(N.Route,{path:"administration/permissions",element:e.jsx(rl,{})}),e.jsx(N.Route,{path:"administration/permissions/assignments",element:e.jsx(al,{})}),e.jsx(N.Route,{path:"administration/tenants",element:e.jsx(nl,{})}),e.jsx(N.Route,{path:"administration/tenants/template",element:e.jsx(ol,{})}),e.jsx(N.Route,{path:"administration/tenants/business",element:e.jsx(il,{})}),e.jsx(N.Route,{path:"administration/tenants/personal",element:e.jsx(ll,{})}),e.jsx(N.Route,{path:"administration/tenants/other",element:e.jsx(cl,{})}),e.jsx(N.Route,{path:"administration/tenants/applications",element:e.jsx(dl,{})}),e.jsx(N.Route,{path:"administration/tenants/access-requests",element:e.jsx(ul,{})}),e.jsx(N.Route,{path:"administration/tenants/organisations",element:e.jsx(ml,{})}),e.jsx(N.Route,{path:"administration/ai",element:e.jsx(xl,{})}),e.jsx(N.Route,{path:"administration/workflows",element:e.jsx(pl,{})}),e.jsx(N.Route,{path:"administration/entra",element:e.jsx(hl,{})}),e.jsx(N.Route,{path:"administration/applications",element:e.jsx(gl,{})}),e.jsx(N.Route,{path:"administration/configuration",element:e.jsx(fl,{})}),e.jsx(N.Route,{path:"administration/configuration/license",element:e.jsx(bl,{})}),e.jsx(N.Route,{path:"platform/support/tickets",element:e.jsx(vl,{})})]}),e.jsx(N.Route,{path:"/system/docs/presentation",element:e.jsx(Ai,{})}),e.jsx(N.Route,{path:"/docs/*",element:e.jsx(N.Navigate,{to:"/system/docs",replace:!0})}),e.jsx(N.Route,{path:"/docs",element:e.jsx(N.Navigate,{to:"/system/docs",replace:!0})})]})}const jl=[{icon:l.Users,title:"Gestion des Utilisateurs",description:"Créez, modifiez et gérez vos utilisateurs avec une interface intuitive. Profils complets, avatars et informations personnalisables.",color:"from-blue-500 to-cyan-500"},{icon:l.Bell,title:"Gestion des Notifications",description:"Système de notifications en temps réel. Email, push, in-app. Templates personnalisables et historique complet.",color:"from-amber-500 to-orange-500"},{icon:l.HeadphonesIcon,title:"Gestion du Support",description:"Système de tickets intégré pour le support client. Suivi, priorités, assignation et statistiques.",color:"from-emerald-500 to-teal-500"},{icon:l.Shield,title:"Panneau Administrateur",description:"Dashboard complet pour administrer votre plateforme. Métriques, logs, configuration et monitoring.",color:"from-purple-500 to-pink-500"},{icon:l.Key,title:"Gestion des Rôles",description:"RBAC avancé avec permissions granulaires. Hiérarchie de rôles, wildcards et héritage des droits.",color:"from-red-500 to-rose-500"},{icon:l.Layers,title:"Architecture Modulaire",description:"Structure en 5 niveaux : Contexte, Application, Module, Section, Resource. Extensible et maintenable.",color:"from-indigo-500 to-violet-500"}],wl=[{icon:l.Zap,text:"Démarrage rapide"},{icon:l.Lock,text:"Sécurité intégrée"},{icon:l.Rocket,text:"Performance optimale"}],Nl=[".NET 10","React 19","TypeScript","EF Core","SQL Server","Tailwind CSS"];function Sl(){return e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("section",{className:"relative pt-32 pb-20 md:pt-40 md:pb-32 overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute -top-40 -right-40 w-80 h-80 rounded-full bg-primary-500/10 blur-3xl"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-80 h-80 rounded-full bg-accent-500/10 blur-3xl"}),e.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px] rounded-full bg-gradient-to-r from-primary-500/5 to-accent-500/5 blur-3xl"})]}),e.jsx("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-primary-500/10 border border-primary-500/20 mb-8",children:[e.jsx(l.Zap,{className:"w-4 h-4 text-primary-500"}),e.jsx("span",{className:"text-sm font-medium text-primary-500",children:"Version 1.0 disponible"})]}),e.jsxs("h1",{className:"text-4xl sm:text-5xl md:text-6xl lg:text-7xl font-bold tracking-tight mb-6",children:["Le socle moderne pour",e.jsx("br",{}),e.jsx("span",{className:"gradient-text",children:"vos applications"})]}),e.jsx("p",{className:"max-w-2xl mx-auto text-lg md:text-xl text-[var(--text-secondary)] mb-10",children:"SmartStack est une plateforme complète pour créer des applications d'entreprise. Authentification, rôles, notifications et support intégrés."}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4 mb-16",children:[e.jsxs("a",{href:"/register",className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-8 py-4 rounded-xl bg-primary-600 hover:bg-primary-700 text-white font-semibold transition-all shadow-lg shadow-primary-500/25 hover:shadow-primary-500/40",children:["Commencer gratuitement",e.jsx(l.ArrowRight,{className:"w-5 h-5"})]}),e.jsx("a",{href:"#features",className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-8 py-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] font-semibold transition-all",children:"Découvrir les fonctionnalités"})]}),e.jsx("div",{className:"flex flex-wrap items-center justify-center gap-6",children:wl.map(t=>e.jsxs("div",{className:"flex items-center gap-2 text-[var(--text-secondary)]",children:[e.jsx(t.icon,{className:"w-5 h-5 text-primary-500"}),e.jsx("span",{children:t.text})]},t.text))})]})})]}),e.jsx("section",{className:"py-8 bg-[var(--bg-secondary)] border-y border-[var(--border-color)]",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-8 md:gap-12",children:[e.jsx("span",{className:"text-[var(--text-tertiary)] text-sm uppercase tracking-wider",children:"Construit avec"}),Nl.map(t=>e.jsx("span",{className:"text-[var(--text-secondary)] font-medium",children:t},t))]})})}),e.jsx("section",{id:"features",className:"py-20 md:py-32",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Tout ce dont vous avez besoin"}),e.jsx("p",{className:"max-w-2xl mx-auto text-[var(--text-secondary)]",children:"SmartStack inclut toutes les fonctionnalités essentielles pour démarrer votre projet d'entreprise."})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:jl.map(t=>e.jsxs("div",{className:"group p-6 rounded-2xl bg-[var(--bg-card)] border border-[var(--border-color)] hover-card",children:[e.jsx("div",{className:`w-12 h-12 rounded-xl bg-gradient-to-br ${t.color} flex items-center justify-center mb-4`,children:e.jsx(t.icon,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",children:t.title}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:t.description})]},t.title))})]})}),e.jsx("section",{id:"modules",className:"py-20 md:py-32 bg-[var(--bg-secondary)]",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-3xl md:text-4xl font-bold mb-6",children:["Architecture modulaire",e.jsx("br",{}),e.jsx("span",{className:"gradient-text",children:"prête pour la production"})]}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-8",children:"SmartStack utilise une architecture en 5 niveaux qui permet une organisation claire et une extensibilité maximale. Chaque niveau correspond à un scope de permissions."}),e.jsx("ul",{className:"space-y-4 mb-8",children:["Contexte - Environnements séparés (Platform, Business, Personal)","Application - Apps au sein d'un contexte (Admin, MySpace)","Module - Fonctionnalités (Users, Roles, Profile)","Section - Sous-divisions des modules","Resource - Éléments individuels"].map(t=>e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-primary-500/10 flex items-center justify-center mt-0.5",children:e.jsx(l.Check,{className:"w-4 h-4 text-primary-500"})}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:t})]},t))})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary-500/20 to-accent-500/20 rounded-3xl blur-2xl"}),e.jsx("div",{className:"relative p-8 rounded-3xl bg-[var(--bg-card)] border border-[var(--border-color)]",children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-primary-500/10 to-primary-500/5 border border-primary-500/20",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-primary-500"}),e.jsx("span",{className:"font-semibold text-primary-500",children:"Contexte: Platform"})]}),e.jsxs("div",{className:"ml-4 mt-3 p-3 rounded-lg bg-accent-500/10 border border-accent-500/20",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-500"}),e.jsx("span",{className:"font-medium text-accent-500",children:"Application: Admin"})]}),e.jsxs("div",{className:"ml-4 mt-2 space-y-2",children:[e.jsx("div",{className:"p-2 rounded bg-[var(--bg-tertiary)] border border-[var(--border-color)]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Users,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("span",{className:"text-sm",children:"Module: Users"})]})}),e.jsx("div",{className:"p-2 rounded bg-[var(--bg-tertiary)] border border-[var(--border-color)]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Key,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("span",{className:"text-sm",children:"Module: Roles"})]})})]})]})]})})})]})]})})}),e.jsx("section",{id:"contact",className:"py-20 md:py-32",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"relative overflow-hidden rounded-3xl animated-gradient p-px",children:e.jsxs("div",{className:"relative rounded-3xl bg-[var(--bg-primary)] p-8 md:p-16 text-center",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Prêt à commencer ?"}),e.jsx("p",{className:"max-w-2xl mx-auto text-[var(--text-secondary)] mb-8",children:"Lancez votre projet d'entreprise avec SmartStack. Tout est déjà configuré pour vous permettre de vous concentrer sur votre métier."}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[e.jsxs("a",{href:"/register",className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-8 py-4 rounded-xl bg-primary-600 hover:bg-primary-700 text-white font-semibold transition-all shadow-lg shadow-primary-500/25 hover:shadow-primary-500/40",children:["Créer un compte",e.jsx(l.ArrowRight,{className:"w-5 h-5"})]}),e.jsx("a",{href:"/contact",className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-8 py-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] font-semibold transition-all",children:"Nous contacter"})]})]})})})})]})}function da(){const t=navigator.userAgent.toLowerCase();return/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(t)?"tablet":/(android|webos|iphone|ipod|blackberry|iemobile|opera mini|mobile|phone)/.test(t)?"mobile":/(windows|macintosh|linux|x11)/.test(t)?"desktop":"unknown"}async function ua(){try{const t=await fetch("https://api.ipify.org?format=json",{method:"GET",signal:AbortSignal.timeout(5e3)});return t.ok&&(await t.json()).ip||null}catch{return null}}function Cl(){const[t,s]=n.useState(""),[r,a]=n.useState(""),[o,c]=n.useState(!1),[i,d]=n.useState(!1),[u,x]=n.useState("auth"),[m,f]=n.useState(null),[h]=n.useState(()=>{const g=new URLSearchParams(window.location.search).get("redirect_uri");return g?(sessionStorage.setItem("sso_redirect_uri",g),g):sessionStorage.getItem("sso_redirect_uri")}),v=n.useCallback(async g=>{g.preventDefault(),f(null),x("auth"),d(!0);try{Pe.logEvent("login_attempt","auth",{email:t});const y=da(),p=await ua(),b=await D.post("/api/auth/login",{email:t,password:r,deviceType:y,clientIp:p});localStorage.setItem("token",b.token),localStorage.setItem("refreshToken",b.refreshToken),localStorage.setItem("user",JSON.stringify(b.user)),Pe.logEvent("login_success","auth",{email:t}),x("prefs");try{if(!(await D.get("/api/onboarding/status")).hasCompletedOnboarding){window.location.href="/auth/onboarding";return}}catch{}try{const j=await It.preferences.get(),S={mode:j.theme||"dark",accentColorKey:j.accentColorKey||"indigo",borderRadius:j.borderRadius||{},itemPaletteKey:j.itemPaletteKey||"neutral"};localStorage.setItem("smartstack-theme-config",JSON.stringify(S)),j.language&&localStorage.setItem("i18nextLng",j.language)}catch{}if(localStorage.removeItem("currentTenantId"),localStorage.removeItem("currentTenantSlug"),localStorage.removeItem("isGlobalView"),h){sessionStorage.removeItem("sso_redirect_uri");const j=h.includes("?")?"&":"?";window.location.href=`${h}${j}token=${encodeURIComponent(b.token)}&refreshToken=${encodeURIComponent(b.refreshToken)}`;return}window.location.href="/myspace"}catch(y){if(y instanceof is)f({message:y.message,code:"NETWORK_ERROR"});else if(y instanceof lr)f({message:y.message,code:y.code});else{const p=y instanceof Error?y.message:"Une erreur inattendue est survenue";f({message:p})}Pe.logError(y instanceof Error?y:new Error(String(y)),"LoginPage.handleSubmit",{email:t})}finally{d(!1)}},[t,r,h]);return{email:t,setEmail:s,password:r,setPassword:a,showPassword:o,setShowPassword:c,isLoading:i,loadingStep:u,error:m,handleSubmit:v}}const kl=[{icon:l.Shield,title:"Sécurité avancée",description:"Authentification multi-facteurs et contrôle d'accès granulaire"},{icon:l.Zap,title:"Performance optimale",description:"Interface rapide et réactive pour une productivité maximale"},{icon:l.Users,title:"Collaboration",description:"Gestion des équipes et permissions centralisée"},{icon:l.BarChart3,title:"Analytics",description:"Tableaux de bord et rapports en temps réel"}],Al=t=>{switch(t){case"ACCOUNT_DISABLED":return e.jsx(l.UserX,{className:"w-5 h-5 flex-shrink-0"});case"ACCOUNT_LOCKED":return e.jsx(l.Clock,{className:"w-5 h-5 flex-shrink-0"});case"EXTERNAL_AUTH_REQUIRED":return e.jsx(l.KeyRound,{className:"w-5 h-5 flex-shrink-0"});case"NETWORK_ERROR":return e.jsx(l.WifiOff,{className:"w-5 h-5 flex-shrink-0"});default:return e.jsx(l.AlertCircle,{className:"w-5 h-5 flex-shrink-0"})}},Rl=t=>{switch(t){case"ACCOUNT_DISABLED":return"bg-orange-500/10 border-orange-500/20 text-orange-600 dark:text-orange-400";case"ACCOUNT_LOCKED":return"bg-amber-500/10 border-amber-500/20 text-amber-600 dark:text-amber-400";case"EXTERNAL_AUTH_REQUIRED":return"bg-blue-500/10 border-blue-500/20 text-blue-600 dark:text-blue-400";case"NETWORK_ERROR":return"bg-gray-500/10 border-gray-500/20 text-gray-600 dark:text-gray-400";default:return"bg-red-500/10 border-red-500/20 text-red-500"}};function Pl(){const{email:t,setEmail:s,password:r,setPassword:a,showPassword:o,setShowPassword:c,isLoading:i,loadingStep:d,error:u,handleSubmit:x}=Cl();return e.jsxs("div",{className:"min-h-screen flex",children:[e.jsxs("div",{className:"hidden lg:flex lg:w-1/2 xl:w-[55%] relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 animated-gradient"}),e.jsx("div",{className:"absolute inset-0 opacity-10",style:{backgroundImage:"radial-gradient(circle at 1px 1px, white 1px, transparent 0)",backgroundSize:"40px 40px"}}),e.jsx("div",{className:"absolute top-20 left-20 w-72 h-72 bg-white/10 rounded-full blur-3xl animate-pulse"}),e.jsx("div",{className:"absolute bottom-20 right-20 w-96 h-96 bg-white/10 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),e.jsx("div",{className:"absolute top-1/2 left-1/3 w-64 h-64 bg-white/5 rounded-full blur-2xl animate-pulse",style:{animationDelay:"2s"}}),e.jsxs("div",{className:"relative z-10 flex flex-col justify-between p-12 xl:p-16 text-white w-full",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 bg-white/20 backdrop-blur-sm rounded-xl flex items-center justify-center",children:e.jsx(l.Layers,{className:"w-7 h-7 text-white"})}),e.jsx("span",{className:"text-2xl font-bold",children:"SmartStack"})]}),e.jsxs("div",{className:"max-w-lg",children:[e.jsx("h1",{className:"text-4xl xl:text-5xl font-bold leading-tight mb-6",children:"Votre plateforme de gestion unifiée"}),e.jsx("p",{className:"text-xl text-white/80 mb-12",children:"Simplifiez vos processus, centralisez vos données et boostez la productivité de votre équipe."}),e.jsx("div",{className:"grid grid-cols-2 gap-6",children:kl.map(m=>e.jsxs("div",{className:"bg-white/10 backdrop-blur-sm rounded-2xl p-5 hover:bg-white/15 transition-colors",children:[e.jsx(m.icon,{className:"w-8 h-8 mb-3 text-white/90"}),e.jsx("h3",{className:"font-semibold mb-1",children:m.title}),e.jsx("p",{className:"text-sm text-white/70",children:m.description})]},m.title))})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex -space-x-3",children:[1,2,3,4].map(m=>e.jsx("div",{className:"w-10 h-10 rounded-full bg-white/20 border-2 border-white/30 flex items-center justify-center text-sm font-medium",children:String.fromCharCode(64+m)},m))}),e.jsxs("p",{className:"text-white/80",children:[e.jsx("span",{className:"font-semibold text-white",children:"+500"})," entreprises nous font confiance"]})]})]})]}),e.jsxs("div",{className:"w-full lg:w-1/2 xl:w-[45%] flex flex-col relative bg-[var(--bg-primary)]",children:[e.jsx("div",{className:"lg:hidden absolute inset-0",children:e.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[e.jsx("div",{className:"absolute -top-40 -right-40 w-96 h-96 rounded-full bg-primary-500/20 blur-3xl animate-pulse"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-96 h-96 rounded-full bg-accent-500/20 blur-3xl animate-pulse",style:{animationDelay:"1s"}})]})}),e.jsxs("div",{className:"absolute top-6 right-6 z-10 flex items-center gap-2",children:[e.jsx("a",{href:"/",className:"p-2 rounded-lg bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] transition-colors",title:"Retour à l'accueil",children:e.jsx(l.Home,{className:"w-5 h-5 text-[var(--text-secondary)]"})}),e.jsx(Ot,{})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-6 sm:p-8 lg:p-12",children:e.jsxs("div",{className:"w-full max-w-md relative",children:[e.jsxs("div",{className:"lg:hidden flex flex-col items-center mb-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl animated-gradient flex items-center justify-center mb-4 shadow-lg",children:e.jsx(l.Layers,{className:"w-8 h-8 text-white"})}),e.jsx("h1",{className:"text-2xl font-bold",children:"SmartStack"})]}),e.jsxs("div",{className:"hidden lg:block mb-8",children:[e.jsx("h2",{className:"text-3xl font-bold mb-2",children:"Bienvenue"}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:"Connectez-vous à votre compte pour continuer"})]}),u&&e.jsxs("div",{className:`mb-6 p-4 rounded-xl border text-sm flex items-start gap-3 ${Rl(u.code)}`,children:[Al(u.code),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:u.message}),u.code==="ACCOUNT_DISABLED"&&e.jsx("p",{className:"text-xs mt-1 opacity-80",children:"Contactez le support si vous pensez qu'il s'agit d'une erreur."}),u.code==="EXTERNAL_AUTH_REQUIRED"&&e.jsx("p",{className:"text-xs mt-1 opacity-80",children:"Utilisez les boutons Microsoft ou Google ci-dessous."})]})]}),e.jsxs("form",{onSubmit:x,className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium mb-2",children:"Adresse email"}),e.jsxs("div",{className:"relative",children:[e.jsx(l.Mail,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]"}),e.jsx("input",{id:"email",type:"email",value:t,onChange:m=>s(m.target.value),placeholder:"vous@exemple.com",required:!0,className:"w-full pl-12 pr-4 py-3.5 rounded-xl bg-[var(--bg-tertiary)] border border-[var(--border-color)] focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 outline-none transition-all placeholder:text-[var(--text-tertiary)]"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium mb-2",children:"Mot de passe"}),e.jsxs("div",{className:"relative",children:[e.jsx(l.Lock,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]"}),e.jsx("input",{id:"password",type:o?"text":"password",value:r,onChange:m=>a(m.target.value),placeholder:"••••••••",required:!0,className:"w-full pl-12 pr-12 py-3.5 rounded-xl bg-[var(--bg-tertiary)] border border-[var(--border-color)] focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 outline-none transition-all placeholder:text-[var(--text-tertiary)]"}),e.jsx("button",{type:"button",onClick:()=>c(!o),className:"absolute right-4 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)] hover:text-[var(--text-primary)] transition-colors",children:o?e.jsx(l.EyeOff,{className:"w-5 h-5"}):e.jsx(l.Eye,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"w-4 h-4 rounded border-[var(--border-color)] bg-[var(--bg-tertiary)] text-primary-600 focus:ring-primary-500/20"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:"Se souvenir de moi"})]}),e.jsx("a",{href:"/forgot-password",className:"text-primary-500 hover:text-primary-600 font-medium transition-colors",children:"Mot de passe oublié ?"})]}),e.jsx("button",{type:"submit",disabled:i,className:"w-full py-3.5 px-4 rounded-xl bg-primary-600 hover:bg-primary-700 disabled:bg-primary-600/50 text-white font-semibold transition-all shadow-lg shadow-primary-500/25 hover:shadow-primary-500/40 disabled:shadow-none flex items-center justify-center gap-2",children:i?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin"}),d==="auth"?"Connexion en cours...":"Chargement des préférences..."]}):"Se connecter"})]}),e.jsxs("div",{className:"relative my-8",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-[var(--border-color)]"})}),e.jsx("div",{className:"relative flex justify-center text-sm",children:e.jsx("span",{className:"px-4 bg-[var(--bg-primary)] text-[var(--text-tertiary)]",children:"Ou continuer avec"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("button",{type:"button",onClick:()=>window.location.href="/api/auth/microsoft",className:"flex items-center justify-center gap-3 py-3.5 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] font-medium transition-all",children:[e.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("rect",{x:"1",y:"1",width:"9",height:"9",fill:"#F25022"}),e.jsx("rect",{x:"11",y:"1",width:"9",height:"9",fill:"#7FBA00"}),e.jsx("rect",{x:"1",y:"11",width:"9",height:"9",fill:"#00A4EF"}),e.jsx("rect",{x:"11",y:"11",width:"9",height:"9",fill:"#FFB900"})]}),"Microsoft"]}),e.jsxs("button",{type:"button",onClick:()=>window.location.href="/api/auth/google",className:"flex items-center justify-center gap-3 py-3.5 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] font-medium transition-all",children:[e.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Google"]})]}),e.jsxs("p",{className:"text-center text-[var(--text-secondary)] mt-8",children:["Nouveau sur SmartStack ?"," ",e.jsx("a",{href:"/register",className:"text-primary-500 hover:text-primary-600 font-semibold transition-colors",children:"Créer un compte"})]})]})}),e.jsx("div",{className:"p-6 text-center",children:e.jsxs("p",{className:"text-sm text-[var(--text-tertiary)]",children:["© ",new Date().getFullYear()," SmartStack. Tous droits réservés."]})})]})]})}function Tl(){const{t}=ne.useTranslation("common"),s=N.useNavigate(),r=()=>{window.history.length>2?s(-1):s("/")};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-[var(--bg-primary)] p-4",children:e.jsx("div",{className:"max-w-md w-full p-8 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-2xl shadow-xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-yellow-500/10 flex items-center justify-center mb-6",children:e.jsx(l.FileWarning,{className:"w-8 h-8 text-yellow-500"})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:t("errors.notFound.title")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-6",children:t("errors.notFound.description")}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-6 font-mono",children:window.location.pathname}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[e.jsxs("button",{onClick:r,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white font-medium transition-all",children:[e.jsx(l.ArrowLeft,{className:"w-4 h-4"}),t("errors.goBack")]}),e.jsxs("a",{href:"/",className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.Home,{className:"w-4 h-4"}),t("errors.home")]})]})]})})})}const El=n.lazy(()=>Promise.resolve().then(()=>Ho).then(t=>({default:t.PublicLayout}))),Wt=n.lazy(()=>Promise.resolve().then(()=>Bo).then(t=>({default:t.AppLayout}))),$l=n.lazy(()=>Promise.resolve().then(()=>require("./RegisterPage--lihqFk7.cjs")).then(t=>({default:t.RegisterPage}))),Il=n.lazy(()=>Promise.resolve().then(()=>require("./ConfirmEmailPage-BkCDKBy0.cjs")).then(t=>({default:t.ConfirmEmailPage}))),Ll=n.lazy(()=>Promise.resolve().then(()=>require("./ForgotPasswordPage-DkrQI8cO.cjs")).then(t=>({default:t.ForgotPasswordPage}))),Dl=n.lazy(()=>Promise.resolve().then(()=>require("./ResetPasswordPage-BpVqJA06.cjs")).then(t=>({default:t.ResetPasswordPage}))),Ml=n.lazy(()=>Promise.resolve().then(()=>require("./ForceChangePasswordPage-3ozgKLOY.cjs")).then(t=>({default:t.ForceChangePasswordPage}))),Fl=n.lazy(()=>Promise.resolve().then(()=>require("./AuthCallbackPage-CbkCo5cL.cjs")).then(t=>({default:t.AuthCallbackPage}))),Ol=n.lazy(()=>Promise.resolve().then(()=>require("./OnboardingWizardPage-BWMGYiu9.cjs")).then(t=>({default:t.OnboardingWizardPage}))),Ul={".detail":"/:id",".edit":"/:id/edit",".create":"/create",".new":"/new",".duplicate":"/:id/duplicate",".settings":"/:id/settings",".configure":"/:id/configure",".permissions":"/:id/permissions",".members":"/:id/members",".history":"/:id/history",".logs":"/:id/logs",".analytics":"/:id/analytics",".preview":"/:id/preview",".versions":"/:id/versions",".comments":"/:id/comments",".attachments":"/:id/attachments",".audit":"/:id/audit",".export":"/:id/export",".notifications":"/:id/notifications",".schedule":"/:id/schedule",".workflow":"/:id/workflow",".summary":"/:id/summary",".test":"/:id/test",".runs":"/:id/runs",".import":"/import"},Bl={"administration.configuration.settings":{defaultTab:"general",tabs:["general","file-upload","legal-file"]},"administration.configuration.appsettings":{defaultTab:"infrastructure",tabs:["infrastructure","authentication","logging","email","entra"]}};function bs(t,s){const r=[];for(const[a,o]of Object.entries(Ul)){const c=`${t}${a}`,i=Te.resolve(c);if(i){const d=s.replace(/^\//,"")+o;r.push({path:d,Component:i})}}return r}function _l(t,s,r,a){const o=[],c=r.route?.replace(`/${a}/`,"")||`${t.code}/${s.code}/${r.code}`,i=Te.resolve(r.componentKey);if(i){const d=i;o.push(e.jsx(N.Route,{path:c,element:e.jsx(d,{})},r.componentKey))}if(r.route)for(const d of bs(r.componentKey,c)){const u=d.Component;o.push(e.jsx(N.Route,{path:d.path,element:e.jsx(u,{})},`${r.componentKey}-implicit-${d.path}`))}return o}function ql(t,s,r){const a=[],o=s.route?.replace(`/${r}/`,"")||`${t.code}/${s.code}`,c=Bl[s.componentKey];if(c){const d=Te.resolve(s.componentKey);if(d){const u=c.tabs.map(x=>{const m=`${s.componentKey}.${x}`,f=Te.resolve(m);return f?e.jsx(N.Route,{path:x,element:e.jsx(f,{})},m):null}).filter(Boolean);return a.push(e.jsxs(N.Route,{path:o,element:e.jsx(d,{}),children:[e.jsx(N.Route,{index:!0,element:e.jsx(N.Navigate,{to:c.defaultTab,replace:!0})}),u]},s.componentKey)),a}}const i=Te.resolve(s.componentKey);if(i){const d=i;a.push(e.jsx(N.Route,{path:o,element:e.jsx(d,{})},s.componentKey))}if(!i&&s.resources.length>0){const d=s.resources[0];a.push(e.jsx(N.Route,{path:o,element:e.jsx(N.Navigate,{to:d.code,replace:!0})},`${s.componentKey}-redirect`))}if(s.route)for(const d of bs(s.componentKey,o)){const u=d.Component;a.push(e.jsx(N.Route,{path:d.path,element:e.jsx(u,{})},`${s.componentKey}-implicit-${d.path}`))}for(const d of s.resources){const u=_l(t,s,d,r);a.push(...u)}return a}function zl(t,s){const r=[],a=t.route?.replace(`/${s}/`,"")||t.code,o=Te.resolve(t.componentKey);if(o){const c=o;r.push(e.jsx(N.Route,{path:a,element:e.jsx(c,{})},t.componentKey))}if(!o&&t.sections.length>0){const c=t.sections[0];r.push(e.jsx(N.Route,{path:a,element:e.jsx(N.Navigate,{to:c.code,replace:!0})},`${t.componentKey}-redirect`))}if(t.route)for(const c of bs(t.componentKey,a)){const i=c.Component;r.push(e.jsx(N.Route,{path:c.path,element:e.jsx(i,{})},`${t.componentKey}-implicit-${c.path}`))}for(const c of t.sections){const i=ql(t,c,s);r.push(...i)}return r}function Gl(t){const s=[],r=Te.resolve(t.componentKey);if(r){const a=r;s.push(e.jsx(N.Route,{index:!0,element:e.jsx(a,{})},`${t.code}-index`))}for(const a of t.modules){const o=zl(a,t.code);a.requiredFeature?s.push(e.jsx(N.Route,{element:e.jsx(fs,{feature:a.requiredFeature}),children:o},`feature-${a.componentKey}`)):s.push(...o)}return s}function Kl(t,s){return t.requiredFeature?[e.jsx(N.Route,{element:e.jsx(fs,{feature:t.requiredFeature}),children:s},`feature-${t.code}`)]:s}function Us({pageKey:t}){const s=Te.resolve(t);return s?e.jsx(s,{}):null}function Hl(t){switch(t){case"administration":return[e.jsx(N.Route,{path:"settings",element:e.jsx(N.Navigate,{to:"../configuration/settings",relative:"path",replace:!0})},"legacy-settings"),e.jsx(N.Route,{path:"settings/*",element:e.jsx(Oe,{to:"/administration/configuration/settings"})},"legacy-settings-wc"),e.jsx(N.Route,{path:"appsettings",element:e.jsx(N.Navigate,{to:"../configuration/appsettings",relative:"path",replace:!0})},"legacy-appsettings"),e.jsx(N.Route,{path:"appsettings/*",element:e.jsx(Oe,{to:"/administration/configuration/appsettings"})},"legacy-appsettings-wc"),e.jsx(N.Route,{path:"email-templates",element:e.jsx(N.Navigate,{to:"../workflows/email-templates",relative:"path",replace:!0})},"legacy-email-templates"),e.jsx(N.Route,{path:"email-templates/list",element:e.jsx(N.Navigate,{to:"../../workflows/email-templates",relative:"path",replace:!0})},"legacy-email-templates-list"),e.jsx(N.Route,{path:"email-templates/create",element:e.jsx(N.Navigate,{to:"../../workflows/email-templates/create",relative:"path",replace:!0})},"legacy-email-templates-create"),e.jsx(N.Route,{path:"workflows/templates",element:e.jsx(N.Navigate,{to:"../email-templates",relative:"path",replace:!0})},"legacy-wf-templates"),e.jsx(N.Route,{path:"workflows/templates/*",element:e.jsx(Oe,{to:"/administration/workflows/email-templates"})},"legacy-wf-templates-wc"),e.jsx(N.Route,{path:"tenants/business",element:e.jsx(N.Navigate,{to:"../tenants/list/enterprise",replace:!0})},"legacy-tenants-biz"),e.jsx(N.Route,{path:"tenants/personal",element:e.jsx(N.Navigate,{to:"../tenants/list/personal",replace:!0})},"legacy-tenants-perso")];case"support":return[e.jsx(N.Route,{path:"dashboard",element:e.jsx(N.Navigate,{to:"tickets",replace:!0})},"legacy-dashboard"),e.jsx(N.Route,{path:"sla",element:e.jsx(N.Navigate,{to:"admin/sla",replace:!0})},"legacy-sla"),e.jsx(N.Route,{path:"templates",element:e.jsx(N.Navigate,{to:"admin/templates",replace:!0})},"legacy-templates"),e.jsx(N.Route,{path:"admin/escalation",element:e.jsx(N.Navigate,{to:"tickets/escalation",replace:!0})},"legacy-admin-esc")];default:return[]}}function Vl(){const{isLoading:t}=Re(),{currentTenant:s}=Ee(),{user:r}=Ae(),a=N.useLocation();if(t)return e.jsx(Nt,{});const o=a.pathname.split("/").filter(Boolean),i=(o[0]==="t"?o.slice(2):o).slice(0,2).join("."),d=s?.slug?`/t/${s.slug}/applications`:"/applications";return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:[e.jsx(wt,{onMenuToggle:()=>{}}),e.jsx("main",{className:"pt-16 transition-all duration-300 h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"p-4 sm:p-6 lg:px-10 h-full overflow-auto",children:e.jsx(rs,{reason:"tenant",tenantName:s?.name,permissionPath:i||void 0,applicationsUrl:d,userRoles:r?.roles,userPermissions:r?.permissions})})})]})}function Wl(){const{isLoading:t}=Re();return!!localStorage.getItem("token")&&t?e.jsx(Nt,{}):e.jsx(Tl,{})}function Xl(){const{menu:t,isLoading:s}=Re(),r=n.useMemo(()=>!t||s?[]:t.applications.map(o=>{const c=o.route?.replace(/^\//,"")||o.code,i=Gl(o),d=Kl(o,i),u=Hl(o.code);return e.jsxs(N.Route,{path:c,element:e.jsx(Wt,{}),children:[d,u]},o.code)}),[t,s]),a=e.jsx(e.Fragment,{children:e.jsx(N.Route,{element:e.jsx(la,{}),children:e.jsxs(N.Route,{element:e.jsx(ca,{}),children:[r,Te.has("applications")&&e.jsx(N.Route,{path:"applications",element:e.jsx(Wt,{}),children:e.jsx(N.Route,{index:!0,element:e.jsx(Us,{pageKey:"applications"})})}),Te.has("notifications")&&e.jsx(N.Route,{path:"notifications",element:e.jsx(Wt,{}),children:e.jsx(N.Route,{index:!0,element:e.jsx(Us,{pageKey:"notifications"})})}),e.jsx(N.Route,{path:"administration/external-apps",element:e.jsx(Oe,{to:"/api/accounts/list"})}),e.jsx(N.Route,{path:"administration/external-apps/*",element:e.jsx(Oe,{to:"/api/accounts/list"})}),e.jsx(N.Route,{path:"api/external-apps",element:e.jsx(Oe,{to:"/api/accounts/list"})}),e.jsx(N.Route,{path:"api/external-apps/*",element:e.jsx(Oe,{to:"/api/accounts/list"})}),e.jsx(N.Route,{path:"support-client",element:e.jsx(Oe,{to:"/support/my-tickets"})}),e.jsx(N.Route,{path:"support-client/*",element:e.jsx(Oe,{to:"/support/my-tickets"})}),e.jsx(N.Route,{path:"user",element:e.jsx(Oe,{to:"/myspace"})}),e.jsx(N.Route,{path:"user/*",element:e.jsx(Oe,{to:"/myspace"})}),e.jsx(N.Route,{path:"*",element:e.jsx(Vl,{})})]})})});return e.jsxs(n.Suspense,{fallback:e.jsx(Nt,{}),children:[e.jsx(Lr,{}),e.jsx(Dr,{}),e.jsxs(N.Routes,{children:[e.jsx(N.Route,{path:"/",element:e.jsx(El,{}),children:e.jsx(N.Route,{index:!0,element:e.jsx(Sl,{})})}),yl(),e.jsx(N.Route,{path:"/login",element:e.jsx(Pl,{})}),e.jsx(N.Route,{path:"/register",element:e.jsx($l,{})}),e.jsx(N.Route,{path:"/confirm-email",element:e.jsx(Il,{})}),e.jsx(N.Route,{path:"/forgot-password",element:e.jsx(Ll,{})}),e.jsx(N.Route,{path:"/reset-password",element:e.jsx(Dl,{})}),e.jsx(N.Route,{path:"/force-change-password",element:e.jsx(Ml,{})}),e.jsx(N.Route,{path:"/auth/callback",element:e.jsx(Fl,{})}),e.jsx(N.Route,{path:"/auth/onboarding",element:e.jsx(Ol,{})}),e.jsx(N.Route,{path:"/t/:slug",element:e.jsx(Ms,{}),children:a}),e.jsx(N.Route,{element:e.jsx(Ms,{}),children:a}),e.jsx(N.Route,{path:"/admin",element:e.jsx(N.Navigate,{to:"/administration",replace:!0})}),e.jsx(N.Route,{path:"/platform",element:e.jsx(N.Navigate,{to:"/administration",replace:!0})}),e.jsx(N.Route,{path:"/platform/admin/*",element:e.jsx(N.Navigate,{to:"/administration",replace:!0})}),e.jsx(N.Route,{path:"/platform/administration/*",element:e.jsx(N.Navigate,{to:"/administration",replace:!0})}),e.jsx(N.Route,{path:"/platform/support/*",element:e.jsx(N.Navigate,{to:"/support",replace:!0})}),e.jsx(N.Route,{path:"/dashboard",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/personal",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/personal/myspace",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/personal/myspace/*",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/user",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/user/*",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/business",element:e.jsx(N.Navigate,{to:"/applications",replace:!0})}),e.jsx(N.Route,{path:"/business/support-client/*",element:e.jsx(N.Navigate,{to:"/support/my-tickets",replace:!0})}),e.jsx(N.Route,{path:"/support-client/*",element:e.jsx(N.Navigate,{to:"/support/my-tickets",replace:!0})}),e.jsx(N.Route,{path:"/support-client",element:e.jsx(N.Navigate,{to:"/support/my-tickets",replace:!0})}),e.jsx(N.Route,{path:"*",element:e.jsx(Wl,{})})]})]})}function Bs({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}function ma({isOpen:t,onClose:s}){const{t:r}=ne.useTranslation(["common","navigation"]),{menu:a}=Re(),{favorites:o,toggleFavorite:c,isFavorite:i,canAddMore:d,maxFavorites:u}=ze();if(!t)return null;const x=[];a?.applications.forEach(f=>{f.modules&&f.modules.length>0&&x.push({app:f,modules:f.modules})});const m=(f,h)=>{const v=[...f.sections||[]].sort((p,b)=>p.displayOrder-b.displayOrder),g=v.length>0&&v[0].route?v[0].route:`/${h.code}/${f.code}`,y={id:f.id,code:f.code,label:f.label,icon:f.icon||"Star",route:g,applicationCode:h.code,applicationLabel:h.label};c(y)};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-[var(--bg-primary)] rounded-[var(--radius-modal)] shadow-xl w-full max-w-lg max-h-[80vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-[var(--border-color)]",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(l.Star,{className:"w-5 h-5 text-[var(--color-accent-500)]"}),r("common:favorites.manageTitle")]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:r("common:favorites.selectModules",{count:o.length,max:u})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>{const f={component:"FavoritesModal",url:window.location.href},h=`https://github.com/anthropics/claude-code/issues/new?title=${encodeURIComponent("[Bug] Favorites Modal")}&body=${encodeURIComponent(`## Context
29
+ `)}`},[v,i]),y=n.useMemo(()=>{if(!t||!r||!s||!a)return null;const j=`${a.replace(/\/applications$/,"")}/support/my-tickets/create`,S=t==="tenant"?"ApplicationRequest":"Support",w=r.split(".")[0],P=t==="tenant"?i("errors.accessDenied.ticket.accessSubject",{permissionPath:r,tenantName:s}):i("errors.accessDenied.ticket.permissionSubject",{permissionPath:r,tenantName:s}),A=(t==="tenant"?i("errors.accessDenied.ticket.accessBody",{appCode:w,tenantName:s,permissionPath:r}):i("errors.accessDenied.ticket.permissionBody",{permissionPath:r,tenantName:s}))+g,k=new URLSearchParams({type:S,subject:P,body:A});return`${j}?${k.toString()}`},[t,r,s,a,i,g]),p=t==="tenant"&&s?i("errors.accessDenied.tenantNotAvailable",{tenantName:s}):t==="permission"&&s?i("errors.accessDenied.permissionMissing",{tenantName:s}):s?i("errors.accessDenied.tenantDescription",{tenantName:s}):i("errors.accessDenied.description");return e.jsx("div",{className:"min-h-[60vh] flex items-center justify-center p-4",children:e.jsx("div",{className:"max-w-lg w-full p-8 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-2xl shadow-xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-red-500/10 flex items-center justify-center mb-6",children:e.jsx(l.ShieldX,{className:"w-8 h-8 text-red-500"})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:i("errors.accessDenied.title")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-4",children:p}),h?e.jsxs("div",{className:"w-full mb-6 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-color)] divide-y divide-[var(--border-color)]",children:[e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:i("errors.accessDenied.requiredPermission")}),e.jsx("p",{className:"text-sm font-mono font-medium text-red-500",children:r})]}),o&&o.length>0&&e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-2",children:i("errors.accessDenied.yourRoles")}),e.jsx("div",{className:"flex flex-wrap gap-1.5 justify-center",children:o.map(b=>e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium bg-[var(--bg-tertiary)] text-[var(--text-secondary)] border border-[var(--border-color)]",children:b},b))})]}),c&&e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-2",children:i("errors.accessDenied.yourPermissionsFor",{appCode:m??""})}),f.length>0?e.jsx("div",{className:"flex flex-col gap-1 items-start",children:f.map(b=>e.jsx("span",{className:"text-xs font-mono text-[var(--text-secondary)]",children:b},b))}):e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] italic",children:i("errors.accessDenied.noPermissions")})]})]}):r?e.jsxs("div",{className:"w-full mb-6 p-3 bg-[var(--bg-secondary)] rounded-lg border border-[var(--border-color)]",children:[e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-1",children:i("errors.accessDenied.requiredPermission")}),e.jsx("p",{className:"text-sm font-mono text-[var(--text-primary)]",children:r})]}):null,e.jsxs("div",{className:"flex flex-col gap-3 w-full",children:[y&&e.jsxs("a",{href:y,className:"flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white font-medium transition-all",children:[e.jsx(l.TicketPlus,{className:"w-4 h-4"}),i(t==="tenant"?"errors.accessDenied.requestAccess":"errors.accessDenied.requestPermission")]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[a?e.jsxs("a",{href:a,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.LayoutGrid,{className:"w-4 h-4"}),i("errors.accessDenied.goToApplications")]}):e.jsxs("button",{onClick:x,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.ArrowLeft,{className:"w-4 h-4"}),i("errors.goBack")]}),e.jsxs("a",{href:"/",className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.Home,{className:"w-4 h-4"}),i("errors.home")]})]})]})]})})})}function wi(){const{t}=ne.useTranslation("common"),{logout:s}=Ae();return e.jsx("div",{className:"min-h-[60vh] flex items-center justify-center p-4",children:e.jsx("div",{className:"max-w-lg w-full p-8 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-2xl shadow-xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-orange-500/10 flex items-center justify-center mb-6",children:e.jsx(l.Building2,{className:"w-8 h-8 text-orange-500"})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:t("errors.noActiveWorkspace.title")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-6",children:t("errors.noActiveWorkspace.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[e.jsxs("a",{href:"mailto:support@atlashub.ch",className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white font-medium transition-all",children:[e.jsx(l.Mail,{className:"w-4 h-4"}),t("errors.noActiveWorkspace.contactAdmin")]}),e.jsxs("button",{onClick:()=>{s()},className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.LogOut,{className:"w-4 h-4"}),t("errors.noActiveWorkspace.logout")]})]}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mt-6",children:t("errors.noActiveWorkspace.hint")})]})})})}function Nt(){return e.jsx("div",{className:"flex items-center justify-center min-h-[400px] w-full",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx(l.Loader2,{className:"w-10 h-10 animate-spin text-[var(--color-primary-500)]"}),e.jsx("span",{className:"text-sm text-[var(--color-text-secondary)]",children:"Chargement..."})]})})}function la(){const{user:t,isLoading:s}=Ae(),r=N.useLocation(),{currentAppCode:a,currentModuleCode:o,isLoading:c,menu:i}=Re(),{currentTenant:d,userTenants:u,isLoading:x,isGlobalView:m}=Ee(),f=d?.id||"global",h=n.useRef(d?.id);let v=!1;if(d?.id!==h.current&&(h.current=d?.id,v=!0),s)return e.jsx(Nt,{});if(!t)return e.jsx(N.Navigate,{to:"/login",state:{from:r},replace:!0});if(v||c||x)return e.jsx(Nt,{});if(!d&&!m&&!u.some(j=>j.status==="Active"))return e.jsx(wi,{});if(!a)return e.jsx(N.Outlet,{},f);const y=(i?.applications||[]).find(b=>b.route?.split("/").filter(Boolean)[0]===a||b.code===a);if(y?.isOpen)return e.jsx(N.Outlet,{},f);if(!y){const b=[a,o].filter(Boolean).join("."),j=d?.slug?`/t/${d.slug}/applications`:"/applications";return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:[e.jsx(wt,{onMenuToggle:()=>{}}),e.jsx("main",{className:"pt-16 transition-all duration-300 h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"p-4 sm:p-6 lg:px-10 h-full overflow-auto",children:e.jsx(rs,{reason:"tenant",tenantName:d?.name,permissionPath:b,applicationsUrl:j,userRoles:t.roles,userPermissions:t.permissions})})})]})}const p=[a,o].filter(Boolean).join(".");if(!un(t.permissions,t.roles,p)&&y.accessLevel!=="RequestAccess"){const b=d?.slug?`/t/${d.slug}/applications`:"/applications";return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:[e.jsx(wt,{onMenuToggle:()=>{}}),e.jsx("main",{className:"pt-16 transition-all duration-300 h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"p-4 sm:p-6 lg:px-10 h-full overflow-auto",children:e.jsx(rs,{reason:"permission",tenantName:d?.name,permissionPath:p,applicationsUrl:b,userRoles:t.roles,userPermissions:t.permissions})})})]})}return e.jsx(N.Outlet,{},f)}function Ms(){const{slug:t}=N.useParams(),s=N.useNavigate(),r=N.useLocation(),{currentTenant:a,userTenants:o,switchTenant:c,isLoading:i,isGlobalView:d}=Ee(),{useUrlRouting:u,isLoading:x}=cs(),m=n.useRef(!1),f=n.useRef(null),h=n.useRef(null);return n.useEffect(()=>{if(i||x||!u||d)return;const v=t||Ps(r.pathname),g=v!==h.current;if(h.current=v,!!g&&v&&v!==a?.slug){const y=o.find(p=>p.slug===v&&p.status==="Active");if(y)f.current=v,c(y.id).then(()=>{f.current=null}).catch(p=>{f.current=null,console.error("[TenantRouteWrapper] Failed to switch tenant:",p)});else if(a){const p=ct(r.pathname);s(`/t/${a.slug}${p}`,{replace:!0})}else s("/",{replace:!0})}},[t,r.pathname,a?.slug,o,u,i,x,d,c,s]),n.useEffect(()=>{if(i||x||m.current)return;const v=r.pathname,g=Ps(v);if(d&&g){m.current=!0;const y=ct(v);s(y,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}if(!u&&g){m.current=!0;const y=ct(v);s(y,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}if(u&&a&&!g&&!d&&v!=="/"&&!v.startsWith("/login")&&!v.startsWith("/auth")&&!v.startsWith("/public")){m.current=!0,s(`/t/${a.slug}${v}`,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}if(u&&a&&g&&!d&&g!==a.slug&&g!==f.current){m.current=!0;const y=ct(v);s(`/t/${a.slug}${y}`,{replace:!0}),setTimeout(()=>{m.current=!1},100);return}},[r.pathname,a?.slug,u,i,x,d,s]),e.jsx(N.Outlet,{})}function Oe({to:t,replace:s=!0}){const{slug:r}=N.useParams(),a=r?`/t/${r}${t}`:t;return e.jsx(N.Navigate,{to:a,replace:s})}function Ni(){const{t}=ne.useTranslation("admin"),{license:s}=Ge(),r=et();return!s||s.status==="NoLicense"?e.jsx(ia,{open:!0,onOpenChange:()=>{}}):e.jsxs("div",{className:"fixed inset-0 z-40 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),e.jsxs("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-2xl w-full max-w-md mx-4 overflow-hidden",children:[e.jsx("div",{className:"flex justify-center pt-8 pb-4",children:e.jsx("div",{className:"p-4 bg-red-100 dark:bg-red-900/30 rounded-full",children:e.jsx(l.Lock,{className:"w-10 h-10 text-red-600 dark:text-red-400"})})}),e.jsxs("div",{className:"px-6 pb-6 text-center",children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-2",children:t("license.guard.title","License Required")}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:t("license.guard.description","Your license has expired or is invalid. Access to this area is restricted. Please activate a valid license to continue using the platform.")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs(N.Link,{to:r("/administration/configuration/license"),className:"w-full inline-flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(l.Settings,{className:"w-4 h-4"}),t("license.guard.manageLicense","Manage License")]}),e.jsxs(N.Link,{to:r("/myspace/profile"),className:"w-full inline-flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:[e.jsx(l.User,{className:"w-4 h-4"}),t("license.guard.myProfile","My Profile")]})]})]})]})]})}const Si=["/myspace","/administration/configuration"];function Ci(t){const s=t.match(/^\/t\/[^/]+\/(.*)/);return s?`/${s[1]}`:t}function ca(){const{license:t,isLoading:s,isReadOnlyMode:r}=Ge(),a=N.useLocation();if(s)return e.jsx(N.Outlet,{});const o=Ci(a.pathname);return Si.some(i=>o.startsWith(i))?e.jsx(N.Outlet,{}):!t?.isValid||r?e.jsxs(e.Fragment,{children:[e.jsx(N.Outlet,{}),e.jsx(Ni,{})]}):e.jsx(N.Outlet,{})}function fs({feature:t}){const{t:s}=ne.useTranslation("admin"),{isFeatureEnabled:r,license:a,isLoading:o}=Ge();return o?e.jsx(N.Outlet,{}):r(t)?e.jsx(N.Outlet,{}):e.jsx("div",{className:"flex items-center justify-center min-h-[60vh] p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 bg-gray-50 dark:bg-gray-800/50 rounded-xl border-2 border-dashed border-gray-200 dark:border-gray-700 max-w-md",children:[e.jsx("div",{className:"p-4 bg-gray-100 dark:bg-gray-700 rounded-full mb-4",children:e.jsx(l.Lock,{className:"w-8 h-8 text-gray-400 dark:text-gray-500"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:s("license.featureNotAvailable","Feature Not Available")}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 text-center max-w-sm mb-4",children:s("license.upgradeToAccess","Upgrade your license to access the {{feature}} feature.",{feature:t})}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-400 dark:text-gray-500",children:[e.jsx(l.Sparkles,{className:"w-4 h-4"}),e.jsx("span",{children:s("license.currentEdition","Current: {{edition}}",{edition:a?.edition||"Unknown"})})]})]})})}const Fs=n.lazy(()=>Promise.resolve().then(()=>Ko).then(t=>({default:t.DocsLayout}))),ki=n.lazy(()=>Promise.resolve().then(()=>require("./DocsIndexPage-BPfi0FQD.cjs")).then(t=>({default:t.DocsIndexPage}))),Ai=n.lazy(()=>Promise.resolve().then(()=>require("./SmartStackPresentationPage-52Nb7F0X.cjs")).then(t=>({default:t.SmartStackPresentationPage}))),Ri=n.lazy(()=>Promise.resolve().then(()=>require("./DeveloperIndexPage-CtBfD2JI.cjs")).then(t=>({default:t.DeveloperIndexPage}))),Pi=n.lazy(()=>Promise.resolve().then(()=>require("./InfrastructurePage-D4ZjLzI_.cjs")).then(t=>({default:t.InfrastructurePage}))),Ti=n.lazy(()=>Promise.resolve().then(()=>require("./InstallationPage-BJ-GBVPp.cjs")).then(t=>({default:t.InstallationPage}))),Ei=n.lazy(()=>Promise.resolve().then(()=>require("./DatabasePage-CRq_-Yo2.cjs")).then(t=>({default:t.DatabasePage}))),$i=n.lazy(()=>Promise.resolve().then(()=>require("./DualDbContextPage--Qk-qEgD.cjs")).then(t=>({default:t.DualDbContextPage}))),Ii=n.lazy(()=>Promise.resolve().then(()=>require("./CrossSchemaFkPage-DqFNORYd.cjs")).then(t=>({default:t.CrossSchemaFkPage}))),Li=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0AgM8YN.cjs")).then(t=>({default:t.TenantIndexPage}))),Di=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0AgM8YN.cjs")).then(t=>({default:t.MultiTenantModePage}))),Mi=n.lazy(()=>Promise.resolve().then(()=>require("./index-C0AgM8YN.cjs")).then(t=>({default:t.TenantB2CPage}))),Fi=n.lazy(()=>Promise.resolve().then(()=>require("./TeamsIntegrationPage-DXj5MDRS.cjs")).then(t=>({default:t.TeamsIntegrationPage}))),Oi=n.lazy(()=>Promise.resolve().then(()=>require("./index-CdORB0b4.cjs")).then(t=>({default:t.SecurityTestingPage}))),Ui=n.lazy(()=>Promise.resolve().then(()=>require("./UserIndexPage-DahU6wzK.cjs")).then(t=>({default:t.UserIndexPage}))),Bi=n.lazy(()=>Promise.resolve().then(()=>require("./ArchitecturePage-Cn_XCDAo.cjs")).then(t=>({default:t.ArchitecturePage}))),_i=n.lazy(()=>Promise.resolve().then(()=>require("./ModulesPage-lz8DUm3X.cjs")).then(t=>({default:t.ModulesPage}))),qi=n.lazy(()=>Promise.resolve().then(()=>require("./SlaDocPage-D44QWNY8.cjs")).then(t=>({default:t.SlaDocPage}))),zi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportIndexPage-CsDQ35Cu.cjs")).then(t=>({default:t.SupportIndexPage}))),Gi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportDashboardDocPage-DpgGq5Mm.cjs")).then(t=>({default:t.SupportDashboardDocPage}))),Ki=n.lazy(()=>Promise.resolve().then(()=>require("./SupportTicketsDocPage-C_ybDTjC.cjs")).then(t=>({default:t.SupportTicketsDocPage}))),Hi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportMyTicketsDocPage-jE1UMaIY.cjs")).then(t=>({default:t.SupportMyTicketsDocPage}))),Vi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportTemplatesDocPage-ajO-cHmK.cjs")).then(t=>({default:t.SupportTemplatesDocPage}))),Wi=n.lazy(()=>Promise.resolve().then(()=>require("./SupportEscalationDocPage-WXkAQr8k.cjs")).then(t=>({default:t.SupportEscalationDocPage}))),Xi=n.lazy(()=>Promise.resolve().then(()=>require("./AiDocPage-CM7j_50_.cjs")).then(t=>({default:t.AiDocPage}))),Yi=n.lazy(()=>Promise.resolve().then(()=>require("./SettingsDocPage-Dqj8KzOa.cjs")).then(t=>({default:t.SettingsDocPage}))),Ji=n.lazy(()=>Promise.resolve().then(()=>require("./ThemeDocPage-B6x55uSE.cjs")).then(t=>({default:t.ThemeDocPage}))),Qi=n.lazy(()=>Promise.resolve().then(()=>require("./BaIndexPage-BhdOX87v.cjs")).then(t=>({default:t.BaIndexPage}))),Os=n.lazy(()=>Promise.resolve().then(()=>require("./BaViewerPage-SYgjCF7x.cjs")).then(t=>({default:t.BaViewerPage}))),Zi=n.lazy(()=>Promise.resolve().then(()=>require("./index-C9BaizLE.cjs"))),el=n.lazy(()=>Promise.resolve().then(()=>require("./index-ASxPhrgZ.cjs"))),tl=n.lazy(()=>Promise.resolve().then(()=>require("./index-BnWMDCRU.cjs"))),sl=n.lazy(()=>Promise.resolve().then(()=>require("./index-C54HbULX.cjs"))),rl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DDJTWztK.cjs"))),al=n.lazy(()=>Promise.resolve().then(()=>require("./index-ZVUUUZmv.cjs"))),nl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DmuVa7Ye.cjs"))),ol=n.lazy(()=>Promise.resolve().then(()=>require("./index-Dxau-XnQ.cjs"))),il=n.lazy(()=>Promise.resolve().then(()=>require("./index-Txfokhn3.cjs"))),ll=n.lazy(()=>Promise.resolve().then(()=>require("./index-BYhFG50Z.cjs"))),cl=n.lazy(()=>Promise.resolve().then(()=>require("./index-eAHjmtzn.cjs"))),dl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DKK07NF1.cjs"))),ul=n.lazy(()=>Promise.resolve().then(()=>require("./index-CtcdHE_9.cjs"))),ml=n.lazy(()=>Promise.resolve().then(()=>require("./index-CBOLnJkG.cjs"))),xl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DKRiN1hJ.cjs"))),pl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DdsLBKHV.cjs"))),hl=n.lazy(()=>Promise.resolve().then(()=>require("./index-1tvWzIw0.cjs"))),gl=n.lazy(()=>Promise.resolve().then(()=>require("./index-DJXny6rD.cjs"))),fl=n.lazy(()=>Promise.resolve().then(()=>require("./index-Bup-dL1l.cjs"))),bl=n.lazy(()=>Promise.resolve().then(()=>require("./index-Du4fQfix.cjs"))),vl=n.lazy(()=>Promise.resolve().then(()=>require("./index-BP5i2CQo.cjs")));function yl(){return e.jsxs(e.Fragment,{children:[e.jsxs(N.Route,{path:"/system/docs",element:e.jsx(Fs,{}),children:[e.jsx(N.Route,{index:!0,element:e.jsx(ki,{})}),e.jsx(N.Route,{path:"developer",element:e.jsx(Ri,{})}),e.jsx(N.Route,{path:"developer/infrastructure",element:e.jsx(Pi,{})}),e.jsx(N.Route,{path:"developer/installation",element:e.jsx(Ti,{})}),e.jsx(N.Route,{path:"developer/database",element:e.jsx(Ei,{})}),e.jsx(N.Route,{path:"developer/dual-dbcontext",element:e.jsx($i,{})}),e.jsx(N.Route,{path:"developer/cross-schema-fk",element:e.jsx(Ii,{})}),e.jsx(N.Route,{path:"developer/tenants",element:e.jsx(Li,{})}),e.jsx(N.Route,{path:"developer/tenants/multi-tenant-mode",element:e.jsx(Di,{})}),e.jsx(N.Route,{path:"developer/tenants/b2c",element:e.jsx(Mi,{})}),e.jsx(N.Route,{path:"developer/multi-tenant-mode",element:e.jsx(N.Navigate,{to:"/system/docs/developer/tenants/multi-tenant-mode",replace:!0})}),e.jsx(N.Route,{path:"developer/teams-integration",element:e.jsx(Fi,{})}),e.jsx(N.Route,{path:"developer/testing/security",element:e.jsx(Oi,{})}),e.jsx(N.Route,{path:"user",element:e.jsx(Ui,{})}),e.jsx(N.Route,{path:"user/architecture",element:e.jsx(Bi,{})}),e.jsx(N.Route,{path:"user/modules",element:e.jsx(_i,{})}),e.jsx(N.Route,{path:"user/support",element:e.jsx(zi,{})}),e.jsx(N.Route,{path:"user/support-dashboard",element:e.jsx(Gi,{})}),e.jsx(N.Route,{path:"user/support-tickets",element:e.jsx(Ki,{})}),e.jsx(N.Route,{path:"user/support-my-tickets",element:e.jsx(Hi,{})}),e.jsx(N.Route,{path:"user/support-sla",element:e.jsx(qi,{})}),e.jsx(N.Route,{path:"user/support-templates",element:e.jsx(Vi,{})}),e.jsx(N.Route,{path:"user/support-escalation",element:e.jsx(Wi,{})}),e.jsx(N.Route,{path:"user/ai",element:e.jsx(Xi,{})}),e.jsx(N.Route,{path:"user/settings",element:e.jsx(Yi,{})}),e.jsx(N.Route,{path:"user/theme",element:e.jsx(Ji,{})}),e.jsx(N.Route,{path:"ba",element:e.jsx(Qi,{})}),e.jsx(N.Route,{path:"ba/:appCode",element:e.jsx(Os,{})}),e.jsx(N.Route,{path:"ba/:appCode/:moduleCode",element:e.jsx(Os,{})})]}),e.jsxs(N.Route,{path:"/docs/business",element:e.jsx(Fs,{}),children:[e.jsx(N.Route,{path:"administration/users",element:e.jsx(Zi,{})}),e.jsx(N.Route,{path:"administration/users/dashboard",element:e.jsx(el,{})}),e.jsx(N.Route,{path:"administration/users/references",element:e.jsx(tl,{})}),e.jsx(N.Route,{path:"administration/users/groups",element:e.jsx(sl,{})}),e.jsx(N.Route,{path:"administration/permissions",element:e.jsx(rl,{})}),e.jsx(N.Route,{path:"administration/permissions/assignments",element:e.jsx(al,{})}),e.jsx(N.Route,{path:"administration/tenants",element:e.jsx(nl,{})}),e.jsx(N.Route,{path:"administration/tenants/template",element:e.jsx(ol,{})}),e.jsx(N.Route,{path:"administration/tenants/business",element:e.jsx(il,{})}),e.jsx(N.Route,{path:"administration/tenants/personal",element:e.jsx(ll,{})}),e.jsx(N.Route,{path:"administration/tenants/other",element:e.jsx(cl,{})}),e.jsx(N.Route,{path:"administration/tenants/applications",element:e.jsx(dl,{})}),e.jsx(N.Route,{path:"administration/tenants/access-requests",element:e.jsx(ul,{})}),e.jsx(N.Route,{path:"administration/tenants/organisations",element:e.jsx(ml,{})}),e.jsx(N.Route,{path:"administration/ai",element:e.jsx(xl,{})}),e.jsx(N.Route,{path:"administration/workflows",element:e.jsx(pl,{})}),e.jsx(N.Route,{path:"administration/entra",element:e.jsx(hl,{})}),e.jsx(N.Route,{path:"administration/applications",element:e.jsx(gl,{})}),e.jsx(N.Route,{path:"administration/configuration",element:e.jsx(fl,{})}),e.jsx(N.Route,{path:"administration/configuration/license",element:e.jsx(bl,{})}),e.jsx(N.Route,{path:"platform/support/tickets",element:e.jsx(vl,{})})]}),e.jsx(N.Route,{path:"/system/docs/presentation",element:e.jsx(Ai,{})}),e.jsx(N.Route,{path:"/docs/*",element:e.jsx(N.Navigate,{to:"/system/docs",replace:!0})}),e.jsx(N.Route,{path:"/docs",element:e.jsx(N.Navigate,{to:"/system/docs",replace:!0})})]})}const jl=[{icon:l.Users,title:"Gestion des Utilisateurs",description:"Créez, modifiez et gérez vos utilisateurs avec une interface intuitive. Profils complets, avatars et informations personnalisables.",color:"from-blue-500 to-cyan-500"},{icon:l.Bell,title:"Gestion des Notifications",description:"Système de notifications en temps réel. Email, push, in-app. Templates personnalisables et historique complet.",color:"from-amber-500 to-orange-500"},{icon:l.HeadphonesIcon,title:"Gestion du Support",description:"Système de tickets intégré pour le support client. Suivi, priorités, assignation et statistiques.",color:"from-emerald-500 to-teal-500"},{icon:l.Shield,title:"Panneau Administrateur",description:"Dashboard complet pour administrer votre plateforme. Métriques, logs, configuration et monitoring.",color:"from-purple-500 to-pink-500"},{icon:l.Key,title:"Gestion des Rôles",description:"RBAC avancé avec permissions granulaires. Hiérarchie de rôles, wildcards et héritage des droits.",color:"from-red-500 to-rose-500"},{icon:l.Layers,title:"Architecture Modulaire",description:"Structure en 5 niveaux : Contexte, Application, Module, Section, Resource. Extensible et maintenable.",color:"from-indigo-500 to-violet-500"}],wl=[{icon:l.Zap,text:"Démarrage rapide"},{icon:l.Lock,text:"Sécurité intégrée"},{icon:l.Rocket,text:"Performance optimale"}],Nl=[".NET 10","React 19","TypeScript","EF Core","SQL Server","Tailwind CSS"];function Sl(){return e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("section",{className:"relative pt-32 pb-20 md:pt-40 md:pb-32 overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute -top-40 -right-40 w-80 h-80 rounded-full bg-primary-500/10 blur-3xl"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-80 h-80 rounded-full bg-accent-500/10 blur-3xl"}),e.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px] rounded-full bg-gradient-to-r from-primary-500/5 to-accent-500/5 blur-3xl"})]}),e.jsx("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-primary-500/10 border border-primary-500/20 mb-8",children:[e.jsx(l.Zap,{className:"w-4 h-4 text-primary-500"}),e.jsx("span",{className:"text-sm font-medium text-primary-500",children:"Version 1.0 disponible"})]}),e.jsxs("h1",{className:"text-4xl sm:text-5xl md:text-6xl lg:text-7xl font-bold tracking-tight mb-6",children:["Le socle moderne pour",e.jsx("br",{}),e.jsx("span",{className:"gradient-text",children:"vos applications"})]}),e.jsx("p",{className:"max-w-2xl mx-auto text-lg md:text-xl text-[var(--text-secondary)] mb-10",children:"SmartStack est une plateforme complète pour créer des applications d'entreprise. Authentification, rôles, notifications et support intégrés."}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4 mb-16",children:[e.jsxs("a",{href:"/register",className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-8 py-4 rounded-xl bg-primary-600 hover:bg-primary-700 text-white font-semibold transition-all shadow-lg shadow-primary-500/25 hover:shadow-primary-500/40",children:["Commencer gratuitement",e.jsx(l.ArrowRight,{className:"w-5 h-5"})]}),e.jsx("a",{href:"#features",className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-8 py-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] font-semibold transition-all",children:"Découvrir les fonctionnalités"})]}),e.jsx("div",{className:"flex flex-wrap items-center justify-center gap-6",children:wl.map(t=>e.jsxs("div",{className:"flex items-center gap-2 text-[var(--text-secondary)]",children:[e.jsx(t.icon,{className:"w-5 h-5 text-primary-500"}),e.jsx("span",{children:t.text})]},t.text))})]})})]}),e.jsx("section",{className:"py-8 bg-[var(--bg-secondary)] border-y border-[var(--border-color)]",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-8 md:gap-12",children:[e.jsx("span",{className:"text-[var(--text-tertiary)] text-sm uppercase tracking-wider",children:"Construit avec"}),Nl.map(t=>e.jsx("span",{className:"text-[var(--text-secondary)] font-medium",children:t},t))]})})}),e.jsx("section",{id:"features",className:"py-20 md:py-32",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Tout ce dont vous avez besoin"}),e.jsx("p",{className:"max-w-2xl mx-auto text-[var(--text-secondary)]",children:"SmartStack inclut toutes les fonctionnalités essentielles pour démarrer votre projet d'entreprise."})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:jl.map(t=>e.jsxs("div",{className:"group p-6 rounded-2xl bg-[var(--bg-card)] border border-[var(--border-color)] hover-card",children:[e.jsx("div",{className:`w-12 h-12 rounded-xl bg-gradient-to-br ${t.color} flex items-center justify-center mb-4`,children:e.jsx(t.icon,{className:"w-6 h-6 text-white"})}),e.jsx("h3",{className:"text-xl font-semibold mb-2",children:t.title}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:t.description})]},t.title))})]})}),e.jsx("section",{id:"modules",className:"py-20 md:py-32 bg-[var(--bg-secondary)]",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-3xl md:text-4xl font-bold mb-6",children:["Architecture modulaire",e.jsx("br",{}),e.jsx("span",{className:"gradient-text",children:"prête pour la production"})]}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-8",children:"SmartStack utilise une architecture en 5 niveaux qui permet une organisation claire et une extensibilité maximale. Chaque niveau correspond à un scope de permissions."}),e.jsx("ul",{className:"space-y-4 mb-8",children:["Contexte - Environnements séparés (Platform, Business, Personal)","Application - Apps au sein d'un contexte (Admin, MySpace)","Module - Fonctionnalités (Users, Roles, Profile)","Section - Sous-divisions des modules","Resource - Éléments individuels"].map(t=>e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-primary-500/10 flex items-center justify-center mt-0.5",children:e.jsx(l.Check,{className:"w-4 h-4 text-primary-500"})}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:t})]},t))})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary-500/20 to-accent-500/20 rounded-3xl blur-2xl"}),e.jsx("div",{className:"relative p-8 rounded-3xl bg-[var(--bg-card)] border border-[var(--border-color)]",children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-primary-500/10 to-primary-500/5 border border-primary-500/20",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-primary-500"}),e.jsx("span",{className:"font-semibold text-primary-500",children:"Contexte: Platform"})]}),e.jsxs("div",{className:"ml-4 mt-3 p-3 rounded-lg bg-accent-500/10 border border-accent-500/20",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-accent-500"}),e.jsx("span",{className:"font-medium text-accent-500",children:"Application: Admin"})]}),e.jsxs("div",{className:"ml-4 mt-2 space-y-2",children:[e.jsx("div",{className:"p-2 rounded bg-[var(--bg-tertiary)] border border-[var(--border-color)]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Users,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("span",{className:"text-sm",children:"Module: Users"})]})}),e.jsx("div",{className:"p-2 rounded bg-[var(--bg-tertiary)] border border-[var(--border-color)]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Key,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("span",{className:"text-sm",children:"Module: Roles"})]})})]})]})]})})})]})]})})}),e.jsx("section",{id:"contact",className:"py-20 md:py-32",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"relative overflow-hidden rounded-3xl animated-gradient p-px",children:e.jsxs("div",{className:"relative rounded-3xl bg-[var(--bg-primary)] p-8 md:p-16 text-center",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4",children:"Prêt à commencer ?"}),e.jsx("p",{className:"max-w-2xl mx-auto text-[var(--text-secondary)] mb-8",children:"Lancez votre projet d'entreprise avec SmartStack. Tout est déjà configuré pour vous permettre de vous concentrer sur votre métier."}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-4",children:[e.jsxs("a",{href:"/register",className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-8 py-4 rounded-xl bg-primary-600 hover:bg-primary-700 text-white font-semibold transition-all shadow-lg shadow-primary-500/25 hover:shadow-primary-500/40",children:["Créer un compte",e.jsx(l.ArrowRight,{className:"w-5 h-5"})]}),e.jsx("a",{href:"/contact",className:"w-full sm:w-auto inline-flex items-center justify-center gap-2 px-8 py-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] font-semibold transition-all",children:"Nous contacter"})]})]})})})})]})}function da(){const t=navigator.userAgent.toLowerCase();return/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(t)?"tablet":/(android|webos|iphone|ipod|blackberry|iemobile|opera mini|mobile|phone)/.test(t)?"mobile":/(windows|macintosh|linux|x11)/.test(t)?"desktop":"unknown"}async function ua(){try{const t=await fetch("https://api.ipify.org?format=json",{method:"GET",signal:AbortSignal.timeout(5e3)});return t.ok&&(await t.json()).ip||null}catch{return null}}function Cl(){const[t,s]=n.useState(""),[r,a]=n.useState(""),[o,c]=n.useState(!1),[i,d]=n.useState(!1),[u,x]=n.useState("auth"),[m,f]=n.useState(null),[h]=n.useState(()=>{const g=new URLSearchParams(window.location.search).get("redirect_uri");return g?(sessionStorage.setItem("sso_redirect_uri",g),g):sessionStorage.getItem("sso_redirect_uri")}),v=n.useCallback(async g=>{g.preventDefault(),f(null),x("auth"),d(!0);try{Pe.logEvent("login_attempt","auth",{email:t});const y=da(),p=await ua(),b=await D.post("/api/auth/login",{email:t,password:r,deviceType:y,clientIp:p});localStorage.setItem("token",b.token),localStorage.setItem("refreshToken",b.refreshToken),localStorage.setItem("user",JSON.stringify(b.user)),Pe.logEvent("login_success","auth",{email:t}),x("prefs");try{if(!(await D.get("/api/onboarding/status")).hasCompletedOnboarding){window.location.href="/auth/onboarding";return}}catch{}try{const j=await It.preferences.get(),S={mode:j.theme||"dark",accentColorKey:j.accentColorKey||"indigo",borderRadius:j.borderRadius||{},itemPaletteKey:j.itemPaletteKey||"neutral"};localStorage.setItem("smartstack-theme-config",JSON.stringify(S)),j.language&&localStorage.setItem("i18nextLng",j.language)}catch{}if(localStorage.removeItem("currentTenantId"),localStorage.removeItem("currentTenantSlug"),localStorage.removeItem("isGlobalView"),h){sessionStorage.removeItem("sso_redirect_uri");const j=h.includes("?")?"&":"?";window.location.href=`${h}${j}token=${encodeURIComponent(b.token)}&refreshToken=${encodeURIComponent(b.refreshToken)}`;return}window.location.href="/myspace"}catch(y){if(y instanceof is)f({message:y.message,code:"NETWORK_ERROR"});else if(y instanceof lr)f({message:y.message,code:y.code});else{const p=y instanceof Error?y.message:"Une erreur inattendue est survenue";f({message:p})}Pe.logError(y instanceof Error?y:new Error(String(y)),"LoginPage.handleSubmit",{email:t})}finally{d(!1)}},[t,r,h]);return{email:t,setEmail:s,password:r,setPassword:a,showPassword:o,setShowPassword:c,isLoading:i,loadingStep:u,error:m,handleSubmit:v}}const kl=[{icon:l.Shield,title:"Sécurité avancée",description:"Authentification multi-facteurs et contrôle d'accès granulaire"},{icon:l.Zap,title:"Performance optimale",description:"Interface rapide et réactive pour une productivité maximale"},{icon:l.Users,title:"Collaboration",description:"Gestion des équipes et permissions centralisée"},{icon:l.BarChart3,title:"Analytics",description:"Tableaux de bord et rapports en temps réel"}],Al=t=>{switch(t){case"ACCOUNT_DISABLED":return e.jsx(l.UserX,{className:"w-5 h-5 flex-shrink-0"});case"ACCOUNT_LOCKED":return e.jsx(l.Clock,{className:"w-5 h-5 flex-shrink-0"});case"EXTERNAL_AUTH_REQUIRED":return e.jsx(l.KeyRound,{className:"w-5 h-5 flex-shrink-0"});case"NETWORK_ERROR":return e.jsx(l.WifiOff,{className:"w-5 h-5 flex-shrink-0"});default:return e.jsx(l.AlertCircle,{className:"w-5 h-5 flex-shrink-0"})}},Rl=t=>{switch(t){case"ACCOUNT_DISABLED":return"bg-orange-500/10 border-orange-500/20 text-orange-600 dark:text-orange-400";case"ACCOUNT_LOCKED":return"bg-amber-500/10 border-amber-500/20 text-amber-600 dark:text-amber-400";case"EXTERNAL_AUTH_REQUIRED":return"bg-blue-500/10 border-blue-500/20 text-blue-600 dark:text-blue-400";case"NETWORK_ERROR":return"bg-gray-500/10 border-gray-500/20 text-gray-600 dark:text-gray-400";default:return"bg-red-500/10 border-red-500/20 text-red-500"}};function Pl(){const{email:t,setEmail:s,password:r,setPassword:a,showPassword:o,setShowPassword:c,isLoading:i,loadingStep:d,error:u,handleSubmit:x}=Cl();return e.jsxs("div",{className:"min-h-screen flex",children:[e.jsxs("div",{className:"hidden lg:flex lg:w-1/2 xl:w-[55%] relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 animated-gradient"}),e.jsx("div",{className:"absolute inset-0 opacity-10",style:{backgroundImage:"radial-gradient(circle at 1px 1px, white 1px, transparent 0)",backgroundSize:"40px 40px"}}),e.jsx("div",{className:"absolute top-20 left-20 w-72 h-72 bg-white/10 rounded-full blur-3xl animate-pulse"}),e.jsx("div",{className:"absolute bottom-20 right-20 w-96 h-96 bg-white/10 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),e.jsx("div",{className:"absolute top-1/2 left-1/3 w-64 h-64 bg-white/5 rounded-full blur-2xl animate-pulse",style:{animationDelay:"2s"}}),e.jsxs("div",{className:"relative z-10 flex flex-col justify-between p-12 xl:p-16 text-white w-full",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 bg-white/20 backdrop-blur-sm rounded-xl flex items-center justify-center",children:e.jsx(l.Layers,{className:"w-7 h-7 text-white"})}),e.jsx("span",{className:"text-2xl font-bold",children:"SmartStack"})]}),e.jsxs("div",{className:"max-w-lg",children:[e.jsx("h1",{className:"text-4xl xl:text-5xl font-bold leading-tight mb-6",children:"Votre plateforme de gestion unifiée"}),e.jsx("p",{className:"text-xl text-white/80 mb-12",children:"Simplifiez vos processus, centralisez vos données et boostez la productivité de votre équipe."}),e.jsx("div",{className:"grid grid-cols-2 gap-6",children:kl.map(m=>e.jsxs("div",{className:"bg-white/10 backdrop-blur-sm rounded-2xl p-5 hover:bg-white/15 transition-colors",children:[e.jsx(m.icon,{className:"w-8 h-8 mb-3 text-white/90"}),e.jsx("h3",{className:"font-semibold mb-1",children:m.title}),e.jsx("p",{className:"text-sm text-white/70",children:m.description})]},m.title))})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex -space-x-3",children:[1,2,3,4].map(m=>e.jsx("div",{className:"w-10 h-10 rounded-full bg-white/20 border-2 border-white/30 flex items-center justify-center text-sm font-medium",children:String.fromCharCode(64+m)},m))}),e.jsxs("p",{className:"text-white/80",children:[e.jsx("span",{className:"font-semibold text-white",children:"+500"})," entreprises nous font confiance"]})]})]})]}),e.jsxs("div",{className:"w-full lg:w-1/2 xl:w-[45%] flex flex-col relative bg-[var(--bg-primary)]",children:[e.jsx("div",{className:"lg:hidden absolute inset-0",children:e.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[e.jsx("div",{className:"absolute -top-40 -right-40 w-96 h-96 rounded-full bg-primary-500/20 blur-3xl animate-pulse"}),e.jsx("div",{className:"absolute -bottom-40 -left-40 w-96 h-96 rounded-full bg-accent-500/20 blur-3xl animate-pulse",style:{animationDelay:"1s"}})]})}),e.jsxs("div",{className:"absolute top-6 right-6 z-10 flex items-center gap-2",children:[e.jsx("a",{href:"/",className:"p-2 rounded-lg bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] transition-colors",title:"Retour à l'accueil",children:e.jsx(l.Home,{className:"w-5 h-5 text-[var(--text-secondary)]"})}),e.jsx(Ot,{})]}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-6 sm:p-8 lg:p-12",children:e.jsxs("div",{className:"w-full max-w-md relative",children:[e.jsxs("div",{className:"lg:hidden flex flex-col items-center mb-8",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl animated-gradient flex items-center justify-center mb-4 shadow-lg",children:e.jsx(l.Layers,{className:"w-8 h-8 text-white"})}),e.jsx("h1",{className:"text-2xl font-bold",children:"SmartStack"})]}),e.jsxs("div",{className:"hidden lg:block mb-8",children:[e.jsx("h2",{className:"text-3xl font-bold mb-2",children:"Bienvenue"}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:"Connectez-vous à votre compte pour continuer"})]}),u&&e.jsxs("div",{className:`mb-6 p-4 rounded-xl border text-sm flex items-start gap-3 ${Rl(u.code)}`,children:[Al(u.code),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:u.message}),u.code==="ACCOUNT_DISABLED"&&e.jsx("p",{className:"text-xs mt-1 opacity-80",children:"Contactez le support si vous pensez qu'il s'agit d'une erreur."}),u.code==="EXTERNAL_AUTH_REQUIRED"&&e.jsx("p",{className:"text-xs mt-1 opacity-80",children:"Utilisez les boutons Microsoft ou Google ci-dessous."})]})]}),e.jsxs("form",{onSubmit:x,className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium mb-2",children:"Adresse email"}),e.jsxs("div",{className:"relative",children:[e.jsx(l.Mail,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]"}),e.jsx("input",{id:"email",type:"email",value:t,onChange:m=>s(m.target.value),placeholder:"vous@exemple.com",required:!0,className:"w-full pl-12 pr-4 py-3.5 rounded-xl bg-[var(--bg-tertiary)] border border-[var(--border-color)] focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 outline-none transition-all placeholder:text-[var(--text-tertiary)]"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium mb-2",children:"Mot de passe"}),e.jsxs("div",{className:"relative",children:[e.jsx(l.Lock,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]"}),e.jsx("input",{id:"password",type:o?"text":"password",value:r,onChange:m=>a(m.target.value),placeholder:"••••••••",required:!0,className:"w-full pl-12 pr-12 py-3.5 rounded-xl bg-[var(--bg-tertiary)] border border-[var(--border-color)] focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 outline-none transition-all placeholder:text-[var(--text-tertiary)]"}),e.jsx("button",{type:"button",onClick:()=>c(!o),className:"absolute right-4 top-1/2 -translate-y-1/2 text-[var(--text-tertiary)] hover:text-[var(--text-primary)] transition-colors",children:o?e.jsx(l.EyeOff,{className:"w-5 h-5"}):e.jsx(l.Eye,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"w-4 h-4 rounded border-[var(--border-color)] bg-[var(--bg-tertiary)] text-primary-600 focus:ring-primary-500/20"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:"Se souvenir de moi"})]}),e.jsx("a",{href:"/forgot-password",className:"text-primary-500 hover:text-primary-600 font-medium transition-colors",children:"Mot de passe oublié ?"})]}),e.jsx("button",{type:"submit",disabled:i,className:"w-full py-3.5 px-4 rounded-xl bg-primary-600 hover:bg-primary-700 disabled:bg-primary-600/50 text-white font-semibold transition-all shadow-lg shadow-primary-500/25 hover:shadow-primary-500/40 disabled:shadow-none flex items-center justify-center gap-2",children:i?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin"}),d==="auth"?"Connexion en cours...":"Chargement des préférences..."]}):"Se connecter"})]}),e.jsxs("div",{className:"relative my-8",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-[var(--border-color)]"})}),e.jsx("div",{className:"relative flex justify-center text-sm",children:e.jsx("span",{className:"px-4 bg-[var(--bg-primary)] text-[var(--text-tertiary)]",children:"Ou continuer avec"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("button",{type:"button",onClick:()=>window.location.href="/api/auth/microsoft",className:"flex items-center justify-center gap-3 py-3.5 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] font-medium transition-all",children:[e.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("rect",{x:"1",y:"1",width:"9",height:"9",fill:"#F25022"}),e.jsx("rect",{x:"11",y:"1",width:"9",height:"9",fill:"#7FBA00"}),e.jsx("rect",{x:"1",y:"11",width:"9",height:"9",fill:"#00A4EF"}),e.jsx("rect",{x:"11",y:"11",width:"9",height:"9",fill:"#FFB900"})]}),"Microsoft"]}),e.jsxs("button",{type:"button",onClick:()=>window.location.href="/api/auth/google",className:"flex items-center justify-center gap-3 py-3.5 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-secondary)] border border-[var(--border-color)] font-medium transition-all",children:[e.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Google"]})]}),e.jsxs("p",{className:"text-center text-[var(--text-secondary)] mt-8",children:["Nouveau sur SmartStack ?"," ",e.jsx("a",{href:"/register",className:"text-primary-500 hover:text-primary-600 font-semibold transition-colors",children:"Créer un compte"})]})]})}),e.jsx("div",{className:"p-6 text-center",children:e.jsxs("p",{className:"text-sm text-[var(--text-tertiary)]",children:["© ",new Date().getFullYear()," SmartStack. Tous droits réservés."]})})]})]})}function Tl(){const{t}=ne.useTranslation("common"),s=N.useNavigate(),r=()=>{window.history.length>2?s(-1):s("/")};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-[var(--bg-primary)] p-4",children:e.jsx("div",{className:"max-w-md w-full p-8 bg-[var(--bg-card)] border border-[var(--border-color)] rounded-2xl shadow-xl",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-yellow-500/10 flex items-center justify-center mb-6",children:e.jsx(l.FileWarning,{className:"w-8 h-8 text-yellow-500"})}),e.jsx("h1",{className:"text-2xl font-bold text-[var(--text-primary)] mb-2",children:t("errors.notFound.title")}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-6",children:t("errors.notFound.description")}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] mb-6 font-mono",children:window.location.pathname}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 w-full",children:[e.jsxs("button",{onClick:r,className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--color-accent-600)] hover:bg-[var(--color-accent-700)] text-white font-medium transition-all",children:[e.jsx(l.ArrowLeft,{className:"w-4 h-4"}),t("errors.goBack")]}),e.jsxs("a",{href:"/",className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 rounded-xl bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] text-[var(--text-primary)] font-medium transition-all",children:[e.jsx(l.Home,{className:"w-4 h-4"}),t("errors.home")]})]})]})})})}const El=n.lazy(()=>Promise.resolve().then(()=>Ho).then(t=>({default:t.PublicLayout}))),Wt=n.lazy(()=>Promise.resolve().then(()=>Bo).then(t=>({default:t.AppLayout}))),$l=n.lazy(()=>Promise.resolve().then(()=>require("./RegisterPage-DKr8quRk.cjs")).then(t=>({default:t.RegisterPage}))),Il=n.lazy(()=>Promise.resolve().then(()=>require("./ConfirmEmailPage-su3Fvl0e.cjs")).then(t=>({default:t.ConfirmEmailPage}))),Ll=n.lazy(()=>Promise.resolve().then(()=>require("./ForgotPasswordPage--Wl0Vxbv.cjs")).then(t=>({default:t.ForgotPasswordPage}))),Dl=n.lazy(()=>Promise.resolve().then(()=>require("./ResetPasswordPage-x4do1o-j.cjs")).then(t=>({default:t.ResetPasswordPage}))),Ml=n.lazy(()=>Promise.resolve().then(()=>require("./ForceChangePasswordPage-kEFsb5Aq.cjs")).then(t=>({default:t.ForceChangePasswordPage}))),Fl=n.lazy(()=>Promise.resolve().then(()=>require("./AuthCallbackPage-Bv2Cyn80.cjs")).then(t=>({default:t.AuthCallbackPage}))),Ol=n.lazy(()=>Promise.resolve().then(()=>require("./OnboardingWizardPage-C7vendrq.cjs")).then(t=>({default:t.OnboardingWizardPage}))),Ul={".detail":"/:id",".edit":"/:id/edit",".create":"/create",".new":"/new",".duplicate":"/:id/duplicate",".settings":"/:id/settings",".configure":"/:id/configure",".permissions":"/:id/permissions",".members":"/:id/members",".history":"/:id/history",".logs":"/:id/logs",".analytics":"/:id/analytics",".preview":"/:id/preview",".versions":"/:id/versions",".comments":"/:id/comments",".attachments":"/:id/attachments",".audit":"/:id/audit",".export":"/:id/export",".notifications":"/:id/notifications",".schedule":"/:id/schedule",".workflow":"/:id/workflow",".summary":"/:id/summary",".test":"/:id/test",".runs":"/:id/runs",".import":"/import"},Bl={"administration.configuration.settings":{defaultTab:"general",tabs:["general","file-upload","legal-file"]},"administration.configuration.appsettings":{defaultTab:"infrastructure",tabs:["infrastructure","authentication","logging","email","entra"]}};function bs(t,s){const r=[];for(const[a,o]of Object.entries(Ul)){const c=`${t}${a}`,i=Te.resolve(c);if(i){const d=s.replace(/^\//,"")+o;r.push({path:d,Component:i})}}return r}function _l(t,s,r,a){const o=[],c=r.route?.replace(`/${a}/`,"")||`${t.code}/${s.code}/${r.code}`,i=Te.resolve(r.componentKey);if(i){const d=i;o.push(e.jsx(N.Route,{path:c,element:e.jsx(d,{})},r.componentKey))}if(r.route)for(const d of bs(r.componentKey,c)){const u=d.Component;o.push(e.jsx(N.Route,{path:d.path,element:e.jsx(u,{})},`${r.componentKey}-implicit-${d.path}`))}return o}function ql(t,s,r){const a=[],o=s.route?.replace(`/${r}/`,"")||`${t.code}/${s.code}`,c=Bl[s.componentKey];if(c){const d=Te.resolve(s.componentKey);if(d){const u=c.tabs.map(x=>{const m=`${s.componentKey}.${x}`,f=Te.resolve(m);return f?e.jsx(N.Route,{path:x,element:e.jsx(f,{})},m):null}).filter(Boolean);return a.push(e.jsxs(N.Route,{path:o,element:e.jsx(d,{}),children:[e.jsx(N.Route,{index:!0,element:e.jsx(N.Navigate,{to:c.defaultTab,replace:!0})}),u]},s.componentKey)),a}}const i=Te.resolve(s.componentKey);if(i){const d=i;a.push(e.jsx(N.Route,{path:o,element:e.jsx(d,{})},s.componentKey))}if(!i&&s.resources.length>0){const d=s.resources[0];a.push(e.jsx(N.Route,{path:o,element:e.jsx(N.Navigate,{to:d.code,replace:!0})},`${s.componentKey}-redirect`))}if(s.route)for(const d of bs(s.componentKey,o)){const u=d.Component;a.push(e.jsx(N.Route,{path:d.path,element:e.jsx(u,{})},`${s.componentKey}-implicit-${d.path}`))}for(const d of s.resources){const u=_l(t,s,d,r);a.push(...u)}return a}function zl(t,s){const r=[],a=t.route?.replace(`/${s}/`,"")||t.code,o=Te.resolve(t.componentKey);if(o){const c=o;r.push(e.jsx(N.Route,{path:a,element:e.jsx(c,{})},t.componentKey))}if(!o&&t.sections.length>0){const c=t.sections[0];r.push(e.jsx(N.Route,{path:a,element:e.jsx(N.Navigate,{to:c.code,replace:!0})},`${t.componentKey}-redirect`))}if(t.route)for(const c of bs(t.componentKey,a)){const i=c.Component;r.push(e.jsx(N.Route,{path:c.path,element:e.jsx(i,{})},`${t.componentKey}-implicit-${c.path}`))}for(const c of t.sections){const i=ql(t,c,s);r.push(...i)}return r}function Gl(t){const s=[],r=Te.resolve(t.componentKey);if(r){const a=r;s.push(e.jsx(N.Route,{index:!0,element:e.jsx(a,{})},`${t.code}-index`))}for(const a of t.modules){const o=zl(a,t.code);a.requiredFeature?s.push(e.jsx(N.Route,{element:e.jsx(fs,{feature:a.requiredFeature}),children:o},`feature-${a.componentKey}`)):s.push(...o)}return s}function Kl(t,s){return t.requiredFeature?[e.jsx(N.Route,{element:e.jsx(fs,{feature:t.requiredFeature}),children:s},`feature-${t.code}`)]:s}function Us({pageKey:t}){const s=Te.resolve(t);return s?e.jsx(s,{}):null}function Hl(t){switch(t){case"administration":return[e.jsx(N.Route,{path:"settings",element:e.jsx(N.Navigate,{to:"../configuration/settings",relative:"path",replace:!0})},"legacy-settings"),e.jsx(N.Route,{path:"settings/*",element:e.jsx(Oe,{to:"/administration/configuration/settings"})},"legacy-settings-wc"),e.jsx(N.Route,{path:"appsettings",element:e.jsx(N.Navigate,{to:"../configuration/appsettings",relative:"path",replace:!0})},"legacy-appsettings"),e.jsx(N.Route,{path:"appsettings/*",element:e.jsx(Oe,{to:"/administration/configuration/appsettings"})},"legacy-appsettings-wc"),e.jsx(N.Route,{path:"email-templates",element:e.jsx(N.Navigate,{to:"../workflows/email-templates",relative:"path",replace:!0})},"legacy-email-templates"),e.jsx(N.Route,{path:"email-templates/list",element:e.jsx(N.Navigate,{to:"../../workflows/email-templates",relative:"path",replace:!0})},"legacy-email-templates-list"),e.jsx(N.Route,{path:"email-templates/create",element:e.jsx(N.Navigate,{to:"../../workflows/email-templates/create",relative:"path",replace:!0})},"legacy-email-templates-create"),e.jsx(N.Route,{path:"workflows/templates",element:e.jsx(N.Navigate,{to:"../email-templates",relative:"path",replace:!0})},"legacy-wf-templates"),e.jsx(N.Route,{path:"workflows/templates/*",element:e.jsx(Oe,{to:"/administration/workflows/email-templates"})},"legacy-wf-templates-wc"),e.jsx(N.Route,{path:"tenants/business",element:e.jsx(N.Navigate,{to:"../tenants/list/enterprise",replace:!0})},"legacy-tenants-biz"),e.jsx(N.Route,{path:"tenants/personal",element:e.jsx(N.Navigate,{to:"../tenants/list/personal",replace:!0})},"legacy-tenants-perso")];case"support":return[e.jsx(N.Route,{path:"dashboard",element:e.jsx(N.Navigate,{to:"tickets",replace:!0})},"legacy-dashboard"),e.jsx(N.Route,{path:"sla",element:e.jsx(N.Navigate,{to:"admin/sla",replace:!0})},"legacy-sla"),e.jsx(N.Route,{path:"templates",element:e.jsx(N.Navigate,{to:"admin/templates",replace:!0})},"legacy-templates"),e.jsx(N.Route,{path:"admin/escalation",element:e.jsx(N.Navigate,{to:"tickets/escalation",replace:!0})},"legacy-admin-esc")];default:return[]}}function Vl(){const{isLoading:t}=Re(),{currentTenant:s}=Ee(),{user:r}=Ae(),a=N.useLocation();if(t)return e.jsx(Nt,{});const o=a.pathname.split("/").filter(Boolean),i=(o[0]==="t"?o.slice(2):o).slice(0,2).join("."),d=s?.slug?`/t/${s.slug}/applications`:"/applications";return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:[e.jsx(wt,{onMenuToggle:()=>{}}),e.jsx("main",{className:"pt-16 transition-all duration-300 h-[calc(100vh-4rem)]",children:e.jsx("div",{className:"p-4 sm:p-6 lg:px-10 h-full overflow-auto",children:e.jsx(rs,{reason:"tenant",tenantName:s?.name,permissionPath:i||void 0,applicationsUrl:d,userRoles:r?.roles,userPermissions:r?.permissions})})})]})}function Wl(){const{isLoading:t}=Re();return!!localStorage.getItem("token")&&t?e.jsx(Nt,{}):e.jsx(Tl,{})}function Xl(){const{menu:t,isLoading:s}=Re(),r=n.useMemo(()=>!t||s?[]:t.applications.map(o=>{const c=o.route?.replace(/^\//,"")||o.code,i=Gl(o),d=Kl(o,i),u=Hl(o.code);return e.jsxs(N.Route,{path:c,element:e.jsx(Wt,{}),children:[d,u]},o.code)}),[t,s]),a=e.jsx(e.Fragment,{children:e.jsx(N.Route,{element:e.jsx(la,{}),children:e.jsxs(N.Route,{element:e.jsx(ca,{}),children:[r,Te.has("applications")&&e.jsx(N.Route,{path:"applications",element:e.jsx(Wt,{}),children:e.jsx(N.Route,{index:!0,element:e.jsx(Us,{pageKey:"applications"})})}),Te.has("notifications")&&e.jsx(N.Route,{path:"notifications",element:e.jsx(Wt,{}),children:e.jsx(N.Route,{index:!0,element:e.jsx(Us,{pageKey:"notifications"})})}),e.jsx(N.Route,{path:"administration/external-apps",element:e.jsx(Oe,{to:"/api/accounts/list"})}),e.jsx(N.Route,{path:"administration/external-apps/*",element:e.jsx(Oe,{to:"/api/accounts/list"})}),e.jsx(N.Route,{path:"api/external-apps",element:e.jsx(Oe,{to:"/api/accounts/list"})}),e.jsx(N.Route,{path:"api/external-apps/*",element:e.jsx(Oe,{to:"/api/accounts/list"})}),e.jsx(N.Route,{path:"support-client",element:e.jsx(Oe,{to:"/support/my-tickets"})}),e.jsx(N.Route,{path:"support-client/*",element:e.jsx(Oe,{to:"/support/my-tickets"})}),e.jsx(N.Route,{path:"user",element:e.jsx(Oe,{to:"/myspace"})}),e.jsx(N.Route,{path:"user/*",element:e.jsx(Oe,{to:"/myspace"})}),e.jsx(N.Route,{path:"*",element:e.jsx(Vl,{})})]})})});return e.jsxs(n.Suspense,{fallback:e.jsx(Nt,{}),children:[e.jsx(Lr,{}),e.jsx(Dr,{}),e.jsxs(N.Routes,{children:[e.jsx(N.Route,{path:"/",element:e.jsx(El,{}),children:e.jsx(N.Route,{index:!0,element:e.jsx(Sl,{})})}),yl(),e.jsx(N.Route,{path:"/login",element:e.jsx(Pl,{})}),e.jsx(N.Route,{path:"/register",element:e.jsx($l,{})}),e.jsx(N.Route,{path:"/confirm-email",element:e.jsx(Il,{})}),e.jsx(N.Route,{path:"/forgot-password",element:e.jsx(Ll,{})}),e.jsx(N.Route,{path:"/reset-password",element:e.jsx(Dl,{})}),e.jsx(N.Route,{path:"/force-change-password",element:e.jsx(Ml,{})}),e.jsx(N.Route,{path:"/auth/callback",element:e.jsx(Fl,{})}),e.jsx(N.Route,{path:"/auth/onboarding",element:e.jsx(Ol,{})}),e.jsx(N.Route,{path:"/t/:slug",element:e.jsx(Ms,{}),children:a}),e.jsx(N.Route,{element:e.jsx(Ms,{}),children:a}),e.jsx(N.Route,{path:"/admin",element:e.jsx(N.Navigate,{to:"/administration",replace:!0})}),e.jsx(N.Route,{path:"/platform",element:e.jsx(N.Navigate,{to:"/administration",replace:!0})}),e.jsx(N.Route,{path:"/platform/admin/*",element:e.jsx(N.Navigate,{to:"/administration",replace:!0})}),e.jsx(N.Route,{path:"/platform/administration/*",element:e.jsx(N.Navigate,{to:"/administration",replace:!0})}),e.jsx(N.Route,{path:"/platform/support/*",element:e.jsx(N.Navigate,{to:"/support",replace:!0})}),e.jsx(N.Route,{path:"/dashboard",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/personal",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/personal/myspace",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/personal/myspace/*",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/user",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/user/*",element:e.jsx(N.Navigate,{to:"/myspace",replace:!0})}),e.jsx(N.Route,{path:"/business",element:e.jsx(N.Navigate,{to:"/applications",replace:!0})}),e.jsx(N.Route,{path:"/business/support-client/*",element:e.jsx(N.Navigate,{to:"/support/my-tickets",replace:!0})}),e.jsx(N.Route,{path:"/support-client/*",element:e.jsx(N.Navigate,{to:"/support/my-tickets",replace:!0})}),e.jsx(N.Route,{path:"/support-client",element:e.jsx(N.Navigate,{to:"/support/my-tickets",replace:!0})}),e.jsx(N.Route,{path:"*",element:e.jsx(Wl,{})})]})]})}function Bs({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}function ma({isOpen:t,onClose:s}){const{t:r}=ne.useTranslation(["common","navigation"]),{menu:a}=Re(),{favorites:o,toggleFavorite:c,isFavorite:i,canAddMore:d,maxFavorites:u}=ze();if(!t)return null;const x=[];a?.applications.forEach(f=>{f.modules&&f.modules.length>0&&x.push({app:f,modules:f.modules})});const m=(f,h)=>{const v=[...f.sections||[]].sort((p,b)=>p.displayOrder-b.displayOrder),g=v.length>0&&v[0].route?v[0].route:`/${h.code}/${f.code}`,y={id:f.id,code:f.code,label:f.label,icon:f.icon||"Star",route:g,applicationCode:h.code,applicationLabel:h.label};c(y)};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-[var(--bg-primary)] rounded-[var(--radius-modal)] shadow-xl w-full max-w-lg max-h-[80vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-[var(--border-color)]",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(l.Star,{className:"w-5 h-5 text-[var(--color-accent-500)]"}),r("common:favorites.manageTitle")]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:r("common:favorites.selectModules",{count:o.length,max:u})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>{const f={component:"FavoritesModal",url:window.location.href},h=`https://github.com/anthropics/claude-code/issues/new?title=${encodeURIComponent("[Bug] Favorites Modal")}&body=${encodeURIComponent(`## Context
30
30
  - Component: ${f.component}
31
31
  - URL: ${f.url}
32
32
 
@@ -45,4 +45,4 @@ ${b.join(`
45
45
  ## Actual Behavior
46
46
  `)}`;window.open(h,"_blank")},className:"p-2 rounded-[var(--radius-button)] hover:bg-[var(--bg-hover)] transition-colors text-[var(--text-secondary)]",title:r("common:buttons.reportBug"),children:e.jsx(l.Bug,{className:"w-5 h-5"})}),e.jsx("button",{onClick:s,className:"p-2 rounded-[var(--radius-button)] hover:bg-[var(--bg-hover)] transition-colors",children:e.jsx(l.X,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[x.map(({app:f,modules:h})=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Bs,{name:f.icon||"Folder",className:"w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-secondary)]",children:f.label})]}),e.jsx("div",{className:"space-y-1 ml-6",children:h.map(v=>{const g=i(v.id),y=!g&&!d;return e.jsxs("button",{onClick:()=>m(v,f),disabled:y,className:`w-full flex items-center gap-3 p-2.5 rounded-[var(--radius-button)] transition-all ${g?"bg-[var(--color-accent-100)] border border-[var(--color-accent-500)]":y?"opacity-50 cursor-not-allowed bg-[var(--bg-secondary)]":"bg-[var(--bg-secondary)] hover:bg-[var(--bg-hover)] border border-transparent hover:border-[var(--border-color)]"}`,children:[e.jsx("div",{className:`w-8 h-8 flex items-center justify-center rounded-[var(--radius-button)] ${g?"bg-[var(--color-accent-600)] text-white":"bg-[var(--bg-tertiary)] text-[var(--text-secondary)]"}`,children:e.jsx(Bs,{name:v.icon||"Star",className:"w-4 h-4"})}),e.jsx("span",{className:`flex-1 text-left text-sm ${g?"font-medium text-[var(--color-accent-700)]":"text-[var(--text-primary)]"}`,children:v.label}),g&&e.jsx(l.Check,{className:"w-4 h-4 text-[var(--color-accent-600)]"})]},v.id)})})]},f.id)),x.length===0&&e.jsx("div",{className:"text-center py-8 text-[var(--text-secondary)]",children:r("common:favorites.noModules")})]}),e.jsx("div",{className:"p-4 border-t border-[var(--border-color)]",children:e.jsx("button",{onClick:s,className:"w-full px-4 py-2 bg-[var(--color-accent-600)] text-white rounded-[var(--radius-button)] hover:bg-[var(--color-accent-700)] transition-colors font-medium",children:r("common:actions.done")})})]})})}function Yl({name:t,className:s}){const a=xt[t];return a?e.jsx(a,{className:s}):e.jsx(l.Star,{className:s})}function Jl({className:t=""}){const{t:s}=ne.useTranslation(["common"]),r=N.useNavigate(),{favorites:a,maxFavorites:o}=ze(),{triggerExpand:c}=ze(),{menu:i}=Re(),[d,u]=n.useState(!1),x=o-a.length,m=h=>{if(i)for(const v of i.applications){const g=v.modules.find(y=>y.id===h.id);if(g?.sections?.length){const y=[...g.sections].sort((p,b)=>p.displayOrder-b.displayOrder)[0];if(y.route)return y.route}}return h.route},f=h=>{const v=m(h);v&&(c(),r(v))};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`bg-[var(--bg-card)] border border-[var(--border-color)] rounded-[var(--radius-card)] p-4 ${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Star,{className:"w-4 h-4 text-[var(--color-accent-500)]"}),e.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:s("common:favorites.quickAccess")})]}),e.jsxs("button",{onClick:()=>u(!0),className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-hover)] rounded-[var(--radius-button)] transition-colors",children:[e.jsx(l.Settings2,{className:"w-3.5 h-3.5"}),s("common:favorites.manage")]})]}),e.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-1",children:[a.map(h=>e.jsxs("button",{onClick:()=>f(h),className:"flex flex-col items-center gap-1.5 min-w-[80px] p-3 bg-[var(--bg-secondary)] hover:bg-[var(--bg-hover)] border border-[var(--border-color)] hover:border-[var(--color-accent-500)] rounded-[var(--radius-card)] transition-all group",title:`${h.applicationLabel} - ${h.label}`,children:[e.jsx("div",{className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-button)] bg-[var(--color-accent-100)] text-[var(--color-accent-600)] group-hover:bg-[var(--color-accent-600)] group-hover:text-white transition-colors",children:e.jsx(Yl,{name:h.icon||"Star",className:"w-4 h-4"})}),e.jsx("span",{className:"text-xs font-medium text-[var(--text-secondary)] group-hover:text-[var(--text-primary)] truncate max-w-[70px]",children:h.label})]},h.id)),Array.from({length:x}).map((h,v)=>e.jsxs("button",{onClick:()=>u(!0),className:"flex flex-col items-center justify-center gap-1.5 min-w-[80px] p-3 border-2 border-dashed border-[var(--border-color)] hover:border-[var(--color-accent-500)] rounded-[var(--radius-card)] transition-colors group",children:[e.jsx("div",{className:"w-8 h-8 flex items-center justify-center rounded-[var(--radius-button)] bg-[var(--bg-tertiary)] text-[var(--text-muted)] group-hover:bg-[var(--color-accent-100)] group-hover:text-[var(--color-accent-600)] transition-colors",children:e.jsx(l.Plus,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-xs text-[var(--text-muted)] group-hover:text-[var(--text-secondary)]",children:s("common:favorites.add")})]},`empty-slot-${v}`))]})]}),e.jsx(ma,{isOpen:d,onClose:()=>u(!1)})]})}function Ql({activities:t,loading:s=!1}){return s?e.jsx("div",{className:"animate-pulse space-y-4",children:[1,2,3].map(r=>e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"w-8 h-8 bg-[var(--bg-secondary)] rounded-full"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-[var(--bg-secondary)] rounded w-3/4 mb-2"}),e.jsx("div",{className:"h-3 bg-[var(--bg-secondary)] rounded w-1/4"})]})]},r))}):t.length===0?e.jsxs("div",{className:"text-center py-8 text-[var(--text-secondary)]",children:[e.jsx(l.RefreshCcw,{className:"w-12 h-12 mx-auto mb-4 opacity-30"}),e.jsx("p",{children:"No activity recorded yet"})]}):e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-4 top-0 bottom-0 w-0.5 bg-[var(--border-color)]"}),e.jsx("div",{className:"space-y-4",children:t.map((r,a)=>e.jsx(Zl,{activity:r,isLast:a===t.length-1},r.id))})]})}function Zl({activity:t,isLast:s}){const{icon:r,color:a,bgColor:o}=sc(t.action),c=r;return e.jsxs("div",{className:"relative flex gap-4 pl-0",children:[e.jsx("div",{className:`relative z-10 w-8 h-8 rounded-full flex items-center justify-center ${o}`,children:e.jsx(c,{className:`w-4 h-4 ${a}`})}),e.jsx("div",{className:"flex-1 pb-4 ",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm",children:[t.changedByUserName?e.jsx("span",{className:"font-medium",children:t.changedByUserName}):e.jsx("span",{className:"font-medium text-[var(--text-secondary)]",children:"System"})," ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:mc(t)})]}),t.fieldChanged&&t.oldValue&&t.newValue&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"px-2 py-0.5 bg-[var(--error-bg)] text-[var(--error-text)] rounded line-through",children:t.oldValue}),e.jsx(l.ArrowRight,{className:"w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("span",{className:"px-2 py-0.5 bg-[var(--success-bg)] text-[var(--success-text)] rounded",children:t.newValue})]})]}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)] whitespace-nowrap",children:xc(t.createdAt)})]})})]})}const ec={Created:{icon:l.PlusCircle,color:"text-[var(--success-text)]",bgColor:"bg-[var(--success-bg)]"},StatusChanged:{icon:l.RefreshCcw,color:"text-[var(--info-text)]",bgColor:"bg-[var(--info-bg)]"},PriorityChanged:{icon:l.AlertTriangle,color:"text-[var(--warning-text)]",bgColor:"bg-[var(--warning-bg)]"},Assigned:{icon:l.UserPlus,color:"text-[var(--accent-text)]",bgColor:"bg-[var(--accent-bg)]"},Commented:{icon:l.MessageSquare,color:"text-[var(--info-text)]",bgColor:"bg-[var(--info-bg)]"},AttachmentAdded:{icon:l.Paperclip,color:"text-[var(--text-secondary)]",bgColor:"bg-[var(--bg-secondary)]"},Resolved:{icon:l.CheckCircle,color:"text-[var(--success-text)]",bgColor:"bg-[var(--success-bg)]"},Closed:{icon:l.XCircle,color:"text-[var(--text-secondary)]",bgColor:"bg-[var(--bg-secondary)]"},Reopened:{icon:l.RefreshCcw,color:"text-[var(--warning-text)]",bgColor:"bg-[var(--warning-bg)]"},SlaBreached:{icon:l.AlertTriangle,color:"text-[var(--error-text)]",bgColor:"bg-[var(--error-bg)]"},Escalated:{icon:l.TrendingUp,color:"text-[var(--error-text)]",bgColor:"bg-[var(--error-bg)]"},Updated:{icon:l.Edit,color:"text-[var(--info-text)]",bgColor:"bg-[var(--info-bg)]"},Deleted:{icon:l.Trash2,color:"text-[var(--error-text)]",bgColor:"bg-[var(--error-bg)]"},OnHold:{icon:l.Pause,color:"text-[var(--warning-text)]",bgColor:"bg-[var(--warning-bg)]"},InProgress:{icon:l.Play,color:"text-[var(--info-text)]",bgColor:"bg-[var(--info-bg)]"}},tc={icon:l.RefreshCcw,color:"text-[var(--text-secondary)]",bgColor:"bg-[var(--bg-secondary)]"};function sc(t){return ec[t]||tc}const rc=t=>t.oldValue&&t.newValue?`changed status from ${t.oldValue} to ${t.newValue}`:"changed the status",ac=t=>t.oldValue&&t.newValue?`changed priority from ${t.oldValue} to ${t.newValue}`:"changed the priority",nc=t=>t.newValue?`assigned to ${t.newValue}`:"unassigned the ticket",oc=t=>t.newValue==="internal"?"added an internal note":"added a comment",ic=t=>t.newValue?`added attachment: ${t.newValue}`:"added an attachment",lc=t=>t.newValue==="response"?"Response SLA was breached":"Resolution SLA was breached",cc=t=>t.newValue?`escalated to ${t.newValue}`:"escalated this ticket",dc=t=>t.fieldChanged?`updated ${t.fieldChanged}`:"updated the ticket",uc={Created:()=>"created this ticket",StatusChanged:rc,PriorityChanged:ac,Assigned:nc,Commented:oc,AttachmentAdded:ic,Resolved:()=>"resolved this ticket",Closed:()=>"closed this ticket",Reopened:()=>"reopened this ticket",SlaBreached:lc,Escalated:cc,Updated:dc,OnHold:()=>"put this ticket on hold",InProgress:()=>"started working on this ticket"};function mc(t){const s=uc[t.action];return s?s(t):t.action.toLowerCase()}function xc(t){const s=new Date(t),a=new Date().getTime()-s.getTime(),o=Math.floor(a/6e4),c=Math.floor(o/60),i=Math.floor(c/24);return o<1?"Just now":o<60?`${o}m ago`:c<24?`${c}h ago`:i<7?`${i}d ago`:s.toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function pc({responseDueAt:t,resolutionDueAt:s,responseBreached:r,resolutionBreached:a,firstResponseAt:o,isPaused:c,responseSlaPercentage:i=0,resolutionSlaPercentage:d=0,showDetails:u=!1}){const x=new Date,m=new Date(t),f=new Date(s),h=m.getTime()-x.getTime(),v=f.getTime()-x.getTime(),g=!!o;let y="ok",p="green",b=l.CheckCircle;c?(y="paused",p="gray",b=l.Pause):r||a?(y="breached",p="red",b=l.XCircle):(!g&&h<1800*1e3||v<3600*1e3)&&(y="warning",p="yellow",b=l.AlertTriangle);const j={green:"bg-[var(--success-bg)] text-[var(--success-text)] border-[var(--success-border)]",yellow:"bg-[var(--warning-bg)] text-[var(--warning-text)] border-[var(--warning-border)]",red:"bg-[var(--error-bg)] text-[var(--error-text)] border-[var(--error-border)]",gray:"bg-[var(--bg-secondary)] text-[var(--text-secondary)] border-[var(--border-color)]"};return u?e.jsxs("div",{className:`p-3 rounded-lg border ${j[p]}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(b,{className:"w-4 h-4"}),e.jsxs("span",{className:"font-medium",children:[y==="paused"&&"SLA Paused",y==="breached"&&"SLA Breached",y==="warning"&&"SLA Warning",y==="ok"&&"Within SLA"]})]}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"opacity-80",children:"Response"}),r?e.jsx("span",{className:"text-[var(--error-text)] font-medium",children:"Breached"}):g?e.jsx("span",{className:"text-[var(--success-text)] font-medium",children:"Completed"}):e.jsx("span",{children:qs(h)})]}),!g&&!r&&e.jsx(_s,{percentage:i})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"opacity-80",children:"Resolution"}),a?e.jsx("span",{className:"text-[var(--error-text)] font-medium",children:"Breached"}):e.jsx("span",{children:qs(v)})]}),!a&&e.jsx(_s,{percentage:d})]})]})]}):e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-1 rounded text-xs font-medium border ${j[p]}`,children:[e.jsx(b,{className:"w-3 h-3"}),y==="paused"&&"SLA Paused",y==="breached"&&"SLA Breached",y==="warning"&&"SLA Warning",y==="ok"&&"Within SLA"]})}function _s({percentage:t}){const s=()=>t>=90?"bg-[var(--error-text)]":t>=75?"bg-[var(--warning-text)]":"bg-[var(--success-text)]";return e.jsx("div",{className:"h-1.5 bg-white/50 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-300 ${s()}`,style:{width:`${Math.min(t,100)}%`}})})}function qs(t){if(t<=0)return"Overdue";const s=Math.floor(t/(1e3*60)),r=Math.floor(s/60),a=Math.floor(r/24);if(a>0){const o=r%24;return o>0?`${a}d ${o}h`:`${a}d`}if(r>0){const o=s%60;return o>0?`${r}h ${o}m`:`${r}h`}return`${s}m`}const zs={Greeting:"bg-[var(--info-bg)] text-[var(--info-text)]",Acknowledgment:"bg-[var(--success-bg)] text-[var(--success-text)]",RequestInfo:"bg-[var(--warning-bg)] text-[var(--warning-text)]",InProgress:"bg-[var(--info-bg)] text-[var(--info-text)]",Resolution:"bg-[var(--accent-bg)] text-[var(--accent-text)]",Escalation:"bg-[var(--warning-bg)] text-[var(--warning-text)]",OnHold:"bg-[var(--bg-secondary)] text-[var(--text-secondary)]",Closure:"bg-[var(--bg-secondary)] text-[var(--text-secondary)]",Rejection:"bg-[var(--error-bg)] text-[var(--error-text)]",General:"bg-[var(--bg-secondary)] text-[var(--text-secondary)]"},hc=[{code:"fr",label:"Français"},{code:"en",label:"English"},{code:"de",label:"Deutsch"},{code:"it",label:"Italiano"}];function gc({isOpen:t,onClose:s,onSelect:r,ticketVariables:a}){const{t:o,i18n:c}=ne.useTranslation("support"),[i,d]=n.useState([]),[u,x]=n.useState(!1),[m,f]=n.useState(null),[h,v]=n.useState(""),[g,y]=n.useState(""),[p,b]=n.useState(c.language?.substring(0,2)||"fr"),[j,S]=n.useState([]),w=n.useCallback(k=>{x(!0),Promise.all([qt.getAll(void 0,!0,k),qt.getCategories()]).then(([R,L])=>{d(R),S(L)}).catch(console.error).finally(()=>x(!1))},[]);n.useEffect(()=>{t&&(b(c.language?.substring(0,2)||"fr"),w(c.language?.substring(0,2)||"fr"))},[t,c.language,w]);const P=k=>{b(k),w(k)};if(!t)return null;const $=i.filter(k=>{const R=!h||k.title.toLowerCase().includes(h.toLowerCase())||k.content.toLowerCase().includes(h.toLowerCase()),L=!g||k.category===g;return R&&L}),A=async k=>{try{f(k.id);const R=await qt.render(k.id,a);r(R.content),s()}catch(R){console.error("Failed to render template:",R)}finally{f(null)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-center justify-center p-4",onClick:s,children:e.jsxs("div",{className:"bg-[var(--bg-card)] rounded-xl shadow-xl w-full max-w-lg max-h-[70vh] flex flex-col",onClick:k=>k.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-[var(--border-color)]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.FileText,{className:"w-5 h-5 text-[var(--color-primary-500)]"}),e.jsx("h3",{className:"font-semibold text-[var(--text-primary)]",children:o("templatePicker.title")})]}),e.jsx("button",{onClick:s,className:"p-1 rounded hover:bg-[var(--bg-secondary)]",children:e.jsx(l.X,{className:"w-5 h-5 text-[var(--text-secondary)]"})})]}),e.jsxs("div",{className:"p-3 space-y-2 border-b border-[var(--border-color)]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.Globe,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("div",{className:"flex gap-1",children:hc.map(k=>e.jsx("button",{onClick:()=>P(k.code),className:`px-2 py-1 text-xs rounded transition-colors ${p===k.code?"bg-[var(--color-primary-500)] text-white":"bg-[var(--bg-secondary)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:k.label},k.code))})]}),e.jsxs("div",{className:"relative",children:[e.jsx(l.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("input",{type:"text",value:h,onChange:k=>v(k.target.value),placeholder:o("templatePicker.searchPlaceholder"),className:"w-full pl-9 pr-3 py-2 text-sm bg-[var(--bg-secondary)] border border-[var(--border-color)] rounded-lg outline-none focus:ring-1 focus:ring-[var(--color-primary-500)]",autoFocus:!0})]}),e.jsxs("div",{className:"flex gap-1 flex-wrap",children:[e.jsx("button",{onClick:()=>y(""),className:`px-2 py-1 text-xs rounded-full transition-colors ${g?"bg-[var(--bg-secondary)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)]":"bg-[var(--color-primary-500)] text-white"}`,children:o("templatePicker.allCategories")}),j.map(k=>e.jsx("button",{onClick:()=>y(k===g?"":k),className:`px-2 py-1 text-xs rounded-full transition-colors ${k===g?"bg-[var(--color-primary-500)] text-white":`${zs[k]||"bg-[var(--bg-secondary)] text-[var(--text-secondary)]"} hover:opacity-80`}`,children:o(`templates.categories.${k}`,{defaultValue:k})},k))]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:u?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--text-tertiary)]"})}):$.length===0?e.jsx("p",{className:"text-center py-8 text-sm text-[var(--text-tertiary)]",children:o("templatePicker.noResults")}):e.jsx("div",{className:"space-y-1",children:$.map(k=>e.jsxs("button",{onClick:()=>A(k),disabled:m!==null,className:"w-full text-left p-3 rounded-lg hover:bg-[var(--bg-secondary)] transition-colors group disabled:opacity-50",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:`px-2 py-0.5 text-[10px] rounded-full ${zs[k.category]||"bg-[var(--bg-secondary)]"}`,children:o(`templates.categories.${k.category}`,{defaultValue:k.category})}),e.jsx("span",{className:"font-medium text-sm text-[var(--text-primary)]",children:k.title}),m===k.id&&e.jsx(l.Loader2,{className:"w-3 h-3 animate-spin ml-auto"})]}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] line-clamp-2",children:k.content})]},k.id))})}),e.jsx("div",{className:"p-3 border-t border-[var(--border-color)]",children:e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] text-center",children:o("templatePicker.selectTemplate")})})]})})}const Gs={Created:{icon:l.Clock,color:"var(--color-primary-500)",labelKey:"history.actions.Created"},StatusChanged:{icon:l.ArrowRightLeft,color:"var(--info-text)",labelKey:"history.actions.StatusChanged"},PriorityChanged:{icon:l.AlertTriangle,color:"var(--warning-text)",labelKey:"history.actions.PriorityChanged"},Assigned:{icon:l.UserPlus,color:"var(--success-text)",labelKey:"history.actions.Assigned"},Unassigned:{icon:l.UserPlus,color:"var(--text-secondary)",labelKey:"history.actions.Unassigned"},Commented:{icon:l.MessageSquare,color:"var(--color-primary-500)",labelKey:"history.actions.Commented"},InternalCommented:{icon:l.MessageSquare,color:"var(--warning-text)",labelKey:"history.actions.InternalCommented"},AttachmentAdded:{icon:l.Paperclip,color:"var(--success-text)",labelKey:"history.actions.AttachmentAdded"},AttachmentRemoved:{icon:l.Paperclip,color:"var(--error-text)",labelKey:"history.actions.AttachmentRemoved"},Resolved:{icon:l.CheckCircle,color:"var(--success-text)",labelKey:"history.actions.Resolved"},Closed:{icon:l.XCircle,color:"var(--text-secondary)",labelKey:"history.actions.Closed"},Reopened:{icon:l.RotateCcw,color:"var(--warning-text)",labelKey:"history.actions.Reopened"},Rejected:{icon:l.XCircle,color:"var(--error-text)",labelKey:"history.actions.Rejected"},SlaResponseBreached:{icon:l.AlertTriangle,color:"var(--error-text)",labelKey:"history.actions.SlaResponseBreached"},SlaResolutionBreached:{icon:l.AlertTriangle,color:"var(--error-text)",labelKey:"history.actions.SlaResolutionBreached"},Escalated:{icon:l.ArrowRightLeft,color:"var(--warning-text)",labelKey:"history.actions.Escalated"},TitleChanged:{icon:l.MessageSquare,color:"var(--text-secondary)",labelKey:"history.actions.TitleChanged"},DescriptionChanged:{icon:l.MessageSquare,color:"var(--text-secondary)",labelKey:"history.actions.DescriptionChanged"},TypeChanged:{icon:l.ArrowRightLeft,color:"var(--text-secondary)",labelKey:"history.actions.TypeChanged"},SatisfactionSubmitted:{icon:l.CheckCircle,color:"var(--success-text)",labelKey:"history.actions.SatisfactionSubmitted"}},xa=(t,s,r)=>{const a=new Date(t),c=new Date().getTime()-a.getTime(),i=Math.floor(c/6e4),d=Math.floor(c/36e5),u=Math.floor(c/864e5);return i<1?s("history.timeAgo.now"):i<60?s("history.timeAgo.minutes",{count:i}):d<24?s("history.timeAgo.hours",{count:d}):u<7?s("history.timeAgo.days",{count:u}):a.toLocaleDateString(r,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})},fc=t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,Ks=t=>t?.startsWith("image/")||!1,bc=(t,s)=>t?"px-4 py-2.5 shadow-sm rounded-2xl bg-[var(--warning-bg)] border border-[var(--warning-border)]":s?"px-4 py-2.5 shadow-sm rounded-2xl rounded-tr-md bg-[var(--color-accent-600)] text-white":"px-4 py-2.5 shadow-sm rounded-2xl rounded-tl-md bg-[var(--bg-card)] border border-[var(--border-color)]";function vc(t,s,r){const a=[];(r?t:t.filter(i=>!i.isInternal)).forEach(i=>{a.push({type:"comment",id:`comment-${i.id}`,timestamp:new Date(i.createdAt),data:i})});const c=["Commented","InternalCommented"];return s.filter(i=>!c.includes(i.action)).forEach(i=>{a.push({type:"activity",id:`activity-${i.id}`,timestamp:new Date(i.createdAt),data:i})}),a.sort((i,d)=>i.timestamp.getTime()-d.timestamp.getTime()),a}function yc({activity:t,t:s,locale:r}){const a=Gs[t.action]||Gs.Created,o=a.icon;return e.jsx("div",{className:"flex justify-center my-4",children:e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-[var(--bg-secondary)] border border-[var(--border-color)] text-sm",children:[e.jsx(o,{className:"w-4 h-4",style:{color:a.color}}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:s(a.labelKey)}),t.newValue&&t.action==="StatusChanged"&&e.jsxs("span",{className:"font-medium text-[var(--text-primary)]",children:["→ ",t.newValue]}),t.newValue&&t.action==="Assigned"&&e.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:t.newValue}),e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:xa(t.createdAt,s,r)})]})})}const jc=t=>{const s=t.trim().split(/\s+/);return s.length>=2?(s[0][0]+s[s.length-1][0]).toUpperCase():t.slice(0,2).toUpperCase()},wc=t=>{const s=["#6366f1","#8b5cf6","#ec4899","#f43f5e","#f97316","#eab308","#22c55e","#14b8a6","#06b6d4","#3b82f6"];let r=0;for(let a=0;a<t.length;a++)r=t.charCodeAt(a)+((r<<5)-r);return s[Math.abs(r)%s.length]};function Hs({src:t,alt:s,className:r,onClick:a}){const[o,c]=n.useState(null),[i,d]=n.useState(!0),[u,x]=n.useState(!1);return n.useEffect(()=>{let m=!0;const f=new AbortController;return Ie.get(t,{responseType:"blob",signal:f.signal}).then(h=>{if(m){const v=URL.createObjectURL(h.data);c(v),d(!1)}}).catch(()=>{m&&(x(!0),d(!1))}),()=>{m=!1,f.abort(),o&&URL.revokeObjectURL(o)}},[t]),i?e.jsx("div",{className:`flex items-center justify-center bg-[var(--bg-secondary)] ${r}`,onClick:a,children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--text-tertiary)]"})}):u||!o?e.jsx("div",{className:`flex items-center justify-center bg-[var(--bg-secondary)] ${r}`,onClick:a,children:e.jsx(l.Image,{className:"w-6 h-6 text-[var(--text-tertiary)]"})}):e.jsx("img",{src:o,alt:s,className:r,onClick:a})}function Nc({comment:t,isOwn:s,isSupport:r,attachments:a,getAttachmentUrl:o,onDownloadAttachment:c,t:i,locale:d}){const[u,x]=n.useState(null),m=new Date(t.createdAt).getTime(),f=a.filter(p=>{const b=new Date(p.createdAt).getTime();return Math.abs(b-m)<6e4}),h=f.filter(p=>Ks(p.contentType)),v=f.filter(p=>!Ks(p.contentType)),g=jc(t.userName),y=wc(t.userName);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`flex gap-3 mb-4 ${s?"flex-row-reverse":"flex-row"}`,children:[e.jsx("div",{className:"w-9 h-9 rounded-full flex items-center justify-center flex-shrink-0 text-white text-sm font-semibold shadow-sm",style:{backgroundColor:y},title:t.userName,children:g}),e.jsxs("div",{className:`flex flex-col max-w-[70%] ${s?"items-end":"items-start"}`,children:[e.jsxs("div",{className:`flex items-center gap-2 mb-1 ${s?"flex-row-reverse":"flex-row"}`,children:[e.jsx("span",{className:"text-xs font-medium text-[var(--text-secondary)]",children:t.userName}),r&&t.isInternal&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-[var(--warning-bg)] text-[var(--warning-text)] border border-[var(--warning-border)]",children:i("conversation.internalNoteLabel")}),t.isEdited&&e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:i("conversation.edited")})]}),e.jsxs("div",{className:bc(t.isInternal||!1,s),children:[e.jsx("p",{className:"whitespace-pre-wrap text-sm leading-relaxed",children:t.content}),h.length>0&&e.jsx("div",{className:`mt-3 grid gap-2 ${h.length>1?"grid-cols-2":"grid-cols-1"}`,children:h.map(p=>e.jsxs("button",{className:"relative cursor-pointer rounded-lg overflow-hidden group",onClick:()=>x(p),type:"button",children:[e.jsx(Hs,{src:o(p),alt:p.fileName,className:"w-full h-32 object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors flex items-center justify-center",children:e.jsx(l.Eye,{className:"w-6 h-6 text-white opacity-0 group-hover:opacity-100 transition-opacity"})})]},p.id))}),v.length>0&&e.jsx("div",{className:"mt-3 space-y-2",children:v.map(p=>e.jsxs("button",{onClick:()=>c(p),className:`flex items-center gap-2 w-full p-2 rounded-lg transition-colors ${s&&!t.isInternal?"bg-white/10 hover:bg-white/20":"bg-[var(--bg-secondary)] hover:bg-[var(--bg-tertiary)]"}`,children:[e.jsx(l.FileText,{className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{className:"text-xs truncate flex-1 text-left",children:p.fileName}),e.jsx("span",{className:"text-xs opacity-70",children:fc(p.fileSize)}),e.jsx(l.Download,{className:"w-3.5 h-3.5"})]},p.id))})]}),e.jsx("div",{className:"text-[10px] text-[var(--text-tertiary)] mt-1 px-1",children:xa(t.createdAt,i,d)})]})]}),u&&e.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>x(null),children:e.jsxs("div",{className:"relative max-w-4xl max-h-[90vh] w-full",children:[e.jsx("button",{onClick:()=>x(null),className:"absolute -top-10 right-0 text-white hover:text-gray-300",children:e.jsx(l.X,{className:"w-6 h-6"})}),e.jsx(Hs,{src:o(u),alt:u.fileName,className:"max-w-full max-h-[80vh] mx-auto object-contain rounded-lg",onClick:p=>p.stopPropagation()}),e.jsxs("div",{className:"mt-4 flex items-center justify-center gap-4",children:[e.jsx("p",{className:"text-white text-sm",children:u.fileName}),e.jsxs("button",{onClick:p=>{p.stopPropagation(),c(u)},className:"btn btn-secondary",children:[e.jsx(l.Download,{className:"w-4 h-4 mr-2"}),i("conversation.download")]})]})]})})]})}const Sc=(t,s,r)=>t?r("conversation.internalPlaceholder","Ajouter une note interne..."):s?r("conversation.supportPlaceholder","Répondre au client..."):r("conversation.clientPlaceholder","Écrire un message..."),Cc=t=>`flex items-end gap-2 rounded-xl border ${t?"border-[var(--warning-border)] bg-[var(--warning-bg)]/30":"border-[var(--border-color)] bg-[var(--bg-secondary)]"} p-2`,kc=(t,s)=>`p-2.5 rounded-lg transition-colors ${t?"bg-[var(--color-primary-600)] text-white hover:bg-[var(--color-primary-700)]":"bg-[var(--bg-tertiary)] text-[var(--text-tertiary)]"} disabled:opacity-50`;function Ac({isConnected:t,commentCount:s,t:r}){return e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-[var(--border-color)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.MessageSquare,{className:"w-5 h-5 text-[var(--color-accent-600)]"}),e.jsx("h2",{className:"font-semibold",children:r("conversation.title","Conversation")}),e.jsxs("span",{className:"text-sm text-[var(--text-secondary)]",children:["(",s,")"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",title:r(t?"conversation.realtimeActive":"conversation.realtimeInactive"),children:[t?e.jsx(l.Wifi,{className:"w-4 h-4 text-[var(--success-text)]"}):e.jsx(l.WifiOff,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("span",{className:`text-xs ${t?"text-[var(--success-text)]":"text-[var(--text-tertiary)]"}`,children:r(t?"conversation.live":"conversation.offline")})]})]})}function Rc({t}){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-[var(--text-secondary)]",children:[e.jsx(l.MessageSquare,{className:"w-12 h-12 mb-3 opacity-50"}),e.jsx("p",{children:t("conversation.empty","Aucun message pour le moment")}),e.jsx("p",{className:"text-sm mt-1",children:t("conversation.startHint","Commencez la conversation ci-dessous")})]})}function Pc({timeline:t,currentUserName:s,isSupport:r,attachments:a,getAttachmentUrl:o,onDownloadAttachment:c,messagesEndRef:i,t:d,locale:u}){return e.jsxs(e.Fragment,{children:[t.map(x=>{if(x.type==="activity")return e.jsx(yc,{activity:x.data,t:d,locale:u},x.id);const m=x.data,f=m.userName===s;return e.jsx(Nc,{comment:m,isOwn:f,isSupport:r,attachments:a,getAttachmentUrl:o,onDownloadAttachment:c,t:d,locale:u},x.id)}),e.jsx("div",{ref:i})]})}function Tc({isInternalComment:t,onToggle:s,t:r}){return e.jsx("div",{className:"mb-2",children:e.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:a=>s(a.target.checked),className:"rounded border-[var(--border-color)]"}),e.jsx("span",{className:`text-sm ${t?"text-[var(--warning-text)] font-medium":"text-[var(--text-secondary)]"}`,children:r("conversation.internalNote","Note interne (invisible pour le client)")})]})})}function Ec({newComment:t,onCommentChange:s,onKeyDown:r,onSend:a,isInternalComment:o,onInternalToggle:c,sending:i,isSupport:d,textareaRef:u,ticketVariables:x,onOpenTemplatePicker:m,t:f}){const h=t.trim();return e.jsxs("div",{className:"border-t border-[var(--border-color)] bg-[var(--bg-card)] p-3",children:[d&&e.jsx(Tc,{isInternalComment:o,onToggle:c,t:f}),e.jsxs("div",{className:Cc(o),children:[e.jsx("textarea",{ref:u,value:t,onChange:v=>s(v.target.value),onKeyDown:r,placeholder:Sc(o,d,f),className:"flex-1 bg-transparent border-none outline-none resize-none text-sm min-h-[24px] max-h-[150px] py-1 px-2",rows:1}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[d&&x&&m&&e.jsx("button",{onClick:m,className:"p-2 rounded-lg text-[var(--text-tertiary)] hover:text-[var(--color-primary-500)] hover:bg-[var(--bg-tertiary)] transition-colors",title:f("templatePicker.buttonTitle"),children:e.jsx(l.FileText,{className:"w-4 h-4"})}),e.jsx("button",{onClick:a,disabled:!h||i,className:kc(!!h),children:i?e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin"}):e.jsx(l.Send,{className:"w-5 h-5"})})]})]}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mt-2 text-center",children:f("conversation.hint","Appuyez sur Entrée pour envoyer, Maj+Entrée pour un saut de ligne")})]})}function $c({t}){return e.jsx("div",{className:"border-t border-[var(--border-color)] bg-[var(--bg-secondary)] p-4 text-center",children:e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:t("conversation.closed","Ce ticket est fermé. Aucun nouveau message ne peut être ajouté.")})})}function pa({comments:t,activities:s,attachments:r,isSupport:a,isClosed:o,isConnected:c,currentUserName:i,ticketVariables:d,onAddComment:u,onDownloadAttachment:x,getAttachmentUrl:m}){const{t:f,i18n:h}=ne.useTranslation("support"),[v,g]=n.useState(""),[y,p]=n.useState(!1),[b,j]=n.useState(!1),[S,w]=n.useState(!1),P=n.useRef(null),$=n.useRef(null),A=vc(t,s,a),k=t.filter(C=>a||!C.isInternal).length;n.useEffect(()=>{P.current?.scrollIntoView({behavior:"smooth"})},[A.length]),n.useEffect(()=>{$.current&&($.current.style.height="auto",$.current.style.height=`${Math.min($.current.scrollHeight,150)}px`)},[v]);const R=async()=>{if(!(!v.trim()||b))try{j(!0),await u(v,y),g(""),p(!1)}finally{j(!1)}},L=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),R())},I=C=>{g(O=>O?O+`
47
47
  `+C:C)};return e.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[e.jsx(Ac,{isConnected:c,commentCount:k,t:f}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 bg-[var(--bg-primary)]",children:A.length===0?e.jsx(Rc,{t:f}):e.jsx(Pc,{timeline:A,currentUserName:i,isSupport:a,attachments:r,getAttachmentUrl:m,onDownloadAttachment:x,messagesEndRef:P,t:f,locale:h.language})}),o?e.jsx($c,{t:f}):e.jsx(Ec,{newComment:v,onCommentChange:g,onKeyDown:L,onSend:R,isInternalComment:y,onInternalToggle:p,sending:b,isSupport:a,textareaRef:$,ticketVariables:d,onOpenTemplatePicker:a&&d?()=>w(!0):void 0,t:f}),d&&e.jsx(gc,{isOpen:S,onClose:()=>w(!1),onSelect:I,ticketVariables:d})]})}const Vs=t=>{const s=t.contentType?.toLowerCase()||"",a=t.fileName.toLowerCase().split(".").pop()||"";if(s.startsWith("image/"))return"image";if(s==="application/pdf")return"pdf";if(s.startsWith("text/")||s==="application/json")return"text";if(s.startsWith("video/"))return"video";if(s.startsWith("audio/"))return"audio";const o=["png","jpg","jpeg","gif","webp","svg","bmp","ico"],c=["txt","csv","json","md","xml","log","html","css","js","ts"],i=["mp4","webm","ogg","mov","avi"],d=["mp3","wav","ogg","aac","m4a"];return o.includes(a)?"image":a==="pdf"?"pdf":c.includes(a)?"text":i.includes(a)?"video":d.includes(a)?"audio":"unknown"},Ws=t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`;function Ic({attachment:t,getUrl:s,onClose:r,onDownload:a}){const{t:o}=ne.useTranslation("support"),[c,i]=n.useState(1),[d,u]=n.useState(0),[x,m]=n.useState(!0),[f,h]=n.useState(null),[v,g]=n.useState(null),[y,p]=n.useState(!1),[b,j]=n.useState(null),S=n.useRef(null),w=t?Vs(t):"unknown";n.useEffect(()=>{if(S.current?.id===t?.id||(S.current=t,b&&URL.revokeObjectURL(b),i(1),u(0),m(!0),h(null),g(null),j(null),p(!1),!t))return;const L=Vs(t),I=s(t),C=new AbortController;return L==="text"?Ie.get(I,{signal:C.signal,responseType:"text"}).then(O=>{g(O.data),m(!1)}).catch(O=>{O.name==="CanceledError"||O.code==="ERR_CANCELED"||(h(o("filePreview.loadError","Impossible de charger le fichier")),m(!1))}):L==="image"||L==="video"||L==="audio"?Ie.get(I,{signal:C.signal,responseType:"blob"}).then(O=>{const _=URL.createObjectURL(O.data);j(_),m(!1)}).catch(O=>{O.name==="CanceledError"||O.code==="ERR_CANCELED"||(h(o("filePreview.loadError","Impossible de charger le fichier")),m(!1))}):L==="pdf"?Ie.get(I,{signal:C.signal,responseType:"blob"}).then(O=>{const _=URL.createObjectURL(O.data);j(_),m(!1)}).catch(O=>{O.name==="CanceledError"||O.code==="ERR_CANCELED"||(h(o("filePreview.loadError","Impossible de charger le fichier")),m(!1))}):m(!1),()=>{C.abort()}},[t,s,o]),n.useEffect(()=>()=>{b&&URL.revokeObjectURL(b)},[b]),n.useEffect(()=>{if(!t)return;const L=I=>{I.key==="Escape"&&(y?p(!1):r()),(I.key==="+"||I.key==="=")&&(I.preventDefault(),i(C=>Math.min(C+.25,3))),I.key==="-"&&(I.preventDefault(),i(C=>Math.max(C-.25,.25))),I.key==="r"&&!I.ctrlKey&&!I.metaKey&&(I.preventDefault(),u(C=>(C+90)%360)),I.key==="f"&&(I.preventDefault(),p(C=>!C))};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,y,r]);const P=n.useCallback(()=>i(L=>Math.min(L+.25,3)),[]),$=n.useCallback(()=>i(L=>Math.max(L-.25,.25)),[]),A=n.useCallback(()=>u(L=>(L+90)%360),[]);if(!t)return null;const k=()=>{if(x&&w!=="pdf"&&w!=="image"&&w!=="video"&&w!=="audio")return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-[var(--color-accent-500)]"})});if(f)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center px-8",children:[e.jsx(l.AlertTriangle,{className:"w-12 h-12 text-[var(--warning-text)]"}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:f}),e.jsxs("button",{onClick:()=>a(t),className:"btn btn-primary",children:[e.jsx(l.Download,{className:"w-4 h-4 mr-2"}),o("filePreview.download","Télécharger le fichier")]})]});switch(w){case"image":return e.jsx("div",{className:"relative flex items-center justify-center h-full overflow-auto p-4",children:b?e.jsx("img",{src:b,alt:t.fileName,className:"max-w-none transition-transform duration-200",style:{transform:`scale(${c}) rotate(${d}deg)`,maxHeight:y?"90vh":"70vh"},onClick:L=>L.stopPropagation()}):e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-white"})})});case"pdf":return e.jsx("div",{className:"h-full w-full",children:b?e.jsx("iframe",{src:`${b}#toolbar=1&navpanes=0`,className:"w-full h-full border-0 rounded",title:t.fileName}):e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-white"})})});case"text":return e.jsx("div",{className:"h-full overflow-auto p-4",children:e.jsx("pre",{className:"text-sm text-[var(--text-primary)] font-mono whitespace-pre-wrap break-words bg-[var(--bg-secondary)] p-4 rounded-lg",children:v})});case"video":return e.jsx("div",{className:"flex items-center justify-center h-full p-4",children:b?e.jsx("video",{src:b,controls:!0,className:"max-w-full max-h-[70vh] rounded-lg",children:o("filePreview.videoNotSupported","Votre navigateur ne supporte pas la lecture vidéo.")}):e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-white"})})});case"audio":return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-6 p-4",children:[e.jsx("div",{className:"w-24 h-24 rounded-full bg-[var(--color-accent-500)]/20 flex items-center justify-center",children:e.jsx(l.File,{className:"w-12 h-12 text-[var(--color-accent-500)]"})}),e.jsx("p",{className:"text-lg font-medium text-[var(--text-primary)]",children:t.fileName}),b?e.jsx("audio",{src:b,controls:!0,className:"w-full max-w-md",children:o("filePreview.audioNotSupported","Votre navigateur ne supporte pas la lecture audio.")}):e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-[var(--color-accent-500)]"})})]});default:return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center px-8",children:[e.jsx("div",{className:"w-20 h-20 rounded-xl bg-[var(--bg-secondary)] flex items-center justify-center",children:e.jsx(l.FileText,{className:"w-10 h-10 text-[var(--text-tertiary)]"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg font-medium text-[var(--text-primary)] mb-1",children:t.fileName}),e.jsx("p",{className:"text-sm text-[var(--text-tertiary)]",children:Ws(t.fileSize)})]}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:o("filePreview.noPreview","Aperçu non disponible pour ce type de fichier")}),e.jsxs("button",{onClick:()=>a(t),className:"btn btn-primary",children:[e.jsx(l.Download,{className:"w-4 h-4 mr-2"}),o("filePreview.download","Télécharger le fichier")]})]})}},R=e.jsxs("div",{className:"fixed inset-0 bg-black/90 backdrop-blur-sm flex flex-col z-[100]",onClick:r,children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 bg-black/50",onClick:L=>L.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(l.FileText,{className:"w-5 h-5 text-white/70 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-white font-medium truncate",children:t.fileName}),e.jsx("p",{className:"text-xs text-white/50",children:Ws(t.fileSize)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[w==="image"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:$,className:"p-2 text-white/70 hover:text-white hover:bg-white/10 rounded-lg transition-colors",title:o("filePreview.zoomOut","Zoom arrière (-)")||"Zoom out",children:e.jsx(l.ZoomOut,{className:"w-5 h-5"})}),e.jsxs("span",{className:"text-white/70 text-sm min-w-[3rem] text-center",children:[Math.round(c*100),"%"]}),e.jsx("button",{onClick:P,className:"p-2 text-white/70 hover:text-white hover:bg-white/10 rounded-lg transition-colors",title:o("filePreview.zoomIn","Zoom avant (+)")||"Zoom in",children:e.jsx(l.ZoomIn,{className:"w-5 h-5"})}),e.jsx("button",{onClick:A,className:"p-2 text-white/70 hover:text-white hover:bg-white/10 rounded-lg transition-colors",title:o("filePreview.rotate","Rotation (R)")||"Rotate",children:e.jsx(l.RotateCw,{className:"w-5 h-5"})}),e.jsx("div",{className:"w-px h-6 bg-white/20 mx-1"})]}),e.jsx("button",{onClick:()=>p(L=>!L),className:"p-2 text-white/70 hover:text-white hover:bg-white/10 rounded-lg transition-colors",title:o("filePreview.fullscreen","Plein écran (F)")||"Fullscreen",children:y?e.jsx(l.Minimize2,{className:"w-5 h-5"}):e.jsx(l.Maximize2,{className:"w-5 h-5"})}),e.jsx("button",{onClick:()=>a(t),className:"p-2 text-white/70 hover:text-white hover:bg-white/10 rounded-lg transition-colors",title:o("filePreview.download","Télécharger")||"Download",children:e.jsx(l.Download,{className:"w-5 h-5"})}),e.jsx("button",{onClick:r,className:"p-2 text-white/70 hover:text-white hover:bg-white/10 rounded-lg transition-colors",title:o("common.close","Fermer (Échap)")||"Close",children:e.jsx(l.X,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden",onClick:L=>L.stopPropagation(),children:k()}),e.jsx("div",{className:"px-4 py-2 bg-black/50 text-center",onClick:L=>L.stopPropagation(),children:e.jsx("p",{className:"text-xs text-white/40",children:o("filePreview.shortcuts","Raccourcis: Échap pour fermer • +/- pour zoomer • R pour rotation • F pour plein écran")})})]});return $t.createPortal(R,document.body)}const Xs={Low:{bg:"var(--info-bg)",text:"var(--info-text)"},Medium:{bg:"var(--warning-bg)",text:"var(--warning-text)"},High:{bg:"var(--error-bg)",text:"var(--error-text)"},Critical:{bg:"var(--error-text)",text:"white"}},Lc=t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,Ys=t=>t?.startsWith("image/")||!1;function Dc({src:t,alt:s,className:r,onClick:a}){const[o,c]=n.useState(null),[i,d]=n.useState(!0),[u,x]=n.useState(!1);return n.useEffect(()=>{let m=!0;const f=new AbortController;return Ie.get(t,{responseType:"blob",signal:f.signal}).then(h=>{if(m){const v=URL.createObjectURL(h.data);c(v),d(!1)}}).catch(()=>{m&&(x(!0),d(!1))}),()=>{m=!1,f.abort(),o&&URL.revokeObjectURL(o)}},[t]),i?e.jsx("div",{className:`flex items-center justify-center bg-[var(--bg-secondary)] ${r}`,children:e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin text-[var(--text-tertiary)]"})}):u||!o?e.jsx("div",{className:`flex items-center justify-center bg-[var(--bg-secondary)] ${r}`,children:e.jsx(l.Image,{className:"w-4 h-4 text-[var(--text-tertiary)]"})}):e.jsx("img",{src:o,alt:s,className:r,onClick:a})}const Mc={Created:{icon:l.Plus,color:"var(--success-text)"},StatusChanged:{icon:l.Edit,color:"var(--info-text)"},Assigned:{icon:l.UserCheck,color:"var(--color-accent-600)"},Unassigned:{icon:l.User,color:"var(--warning-text)"},Commented:{icon:l.MessageSquare,color:"var(--text-secondary)"},PriorityChanged:{icon:l.AlertTriangle,color:"var(--warning-text)"},Resolved:{icon:l.CheckCircle,color:"var(--success-text)"},Closed:{icon:l.XCircle,color:"var(--text-tertiary)"},Reopened:{icon:l.RotateCcw,color:"var(--warning-text)"},Escalated:{icon:l.ArrowUpCircle,color:"var(--error-text)"},Started:{icon:l.Play,color:"var(--info-text)"},Paused:{icon:l.Pause,color:"var(--warning-text)"}},Fc=(t,s)=>{const r=new Date(t),o=new Date().getTime()-r.getTime(),c=Math.floor(o/6e4),i=Math.floor(o/36e5),d=Math.floor(o/864e5);return c<1?s("sidebar.timeAgo.justNow",{defaultValue:"Just now"}):c<60?s("sidebar.timeAgo.minutes",{count:c}):i<24?s("sidebar.timeAgo.hours",{count:i}):d<7?s("sidebar.timeAgo.days",{count:d}):r.toLocaleDateString(void 0,{day:"numeric",month:"short"})},Oc=10*1024*1024,Js=[".pdf",".doc",".docx",".xls",".xlsx",".txt",".csv",".zip",".png",".jpg",".jpeg",".gif",".webp"];function it({section:t,icon:s,title:r,count:a,isExpanded:o,onToggle:c}){return e.jsxs("button",{onClick:()=>c(t),className:"w-full flex items-center gap-2 py-2 px-3 hover:bg-[var(--bg-secondary)] transition-colors rounded-lg",children:[o?e.jsx(l.ChevronDown,{className:"w-4 h-4 text-[var(--text-tertiary)]"}):e.jsx(l.ChevronRight,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx(s,{className:"w-4 h-4 text-[var(--color-accent-600)]"}),e.jsx("span",{className:"font-medium text-sm flex-1 text-left",children:r}),a!==void 0&&a>0&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded-full bg-[var(--bg-tertiary)] text-[var(--text-secondary)]",children:a})]})}function ha({ticket:t,attachments:s,activities:r,isSupport:a,saving:o,uploading:c,layout:i="compact",onAssign:d,onStatusChange:u,onResolve:x,onCloseTicket:m,onReopen:f,onEscalate:h,onDownloadAttachment:v,onUploadAttachment:g,getAttachmentUrl:y}){const{t:p}=ne.useTranslation("support"),[b,j]=n.useState(new Set(i==="grid"?["info","system","errors","attachments","actions","history"]:["info","attachments","actions"])),[S,w]=n.useState(null),[P,$]=n.useState(!1),[A,k]=n.useState(null),R=n.useRef(null),L=n.useCallback(M=>{if(M.type.startsWith("image/"))return!0;const te="."+M.name.split(".").pop()?.toLowerCase();return Js.includes(te)},[]),I=n.useCallback(async M=>{if(!(!M||!g)){k(null);for(let te=0;te<M.length;te++){const oe=M[te];if(oe.size>Oc){k(p("sidebar.fileTooLarge","File too large (max 10 MB)"));continue}if(!L(oe)){k(p("sidebar.fileTypeNotAllowed","File type not allowed"));continue}try{await g(oe)}catch{k(p("sidebar.uploadError","Upload failed"))}}}},[g,L,p]),C=n.useCallback(M=>{M.preventDefault(),M.stopPropagation()},[]),O=n.useCallback(M=>{M.preventDefault(),M.stopPropagation(),$(!0)},[]),_=n.useCallback(M=>{M.preventDefault(),M.stopPropagation(),$(!1)},[]),E=n.useCallback(M=>{M.preventDefault(),M.stopPropagation(),$(!1),I(M.dataTransfer.files)},[I]),z=s.filter(M=>Ys(M.contentType)),W=s.filter(M=>!Ys(M.contentType)),G=t.clientContext,J=n.useCallback(M=>{j(te=>{const oe=new Set(te);return oe.has(M)?oe.delete(M):oe.add(M),oe})},[]),pe=t.status==="Closed"||t.status==="Rejected",q=i==="grid",Y=q?"bg-[var(--bg-card)] rounded-lg border border-[var(--border-color)] overflow-hidden":"px-2 py-1 border-b border-[var(--border-color)]";return e.jsxs("div",{className:q?"":"h-full flex flex-col bg-[var(--bg-card)] overflow-hidden",children:[e.jsxs("div",{className:q?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4":"flex-1 overflow-y-auto",children:[e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"info",icon:l.FileText,title:p("details.info","Informations"),isExpanded:b.has("info"),onToggle:J}),b.has("info")&&e.jsx("div",{className:"px-3 pb-3",children:e.jsxs("dl",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:p("sidebar.type","Type")}),e.jsx("dd",{className:"font-medium",children:p(`tickets.types.${t.type}`,{defaultValue:t.type})})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:p("sidebar.priority","Priority")}),e.jsx("dd",{children:e.jsx("span",{className:"inline-block px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:Xs[t.priority]?.bg,color:Xs[t.priority]?.text},children:p(`tickets.priorities.${t.priority}`,{defaultValue:t.priority})})})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:p("sidebar.createdBy","Created by")}),e.jsx("dd",{children:t.createdByName||p("sidebar.unknown","Unknown")})]}),e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:p("sidebar.assignedTo","Assigned to")}),e.jsxs("dd",{className:"flex flex-col items-end gap-1",children:[t.assignees&&t.assignees.length>0?e.jsx("div",{className:"space-y-1",children:t.assignees.map(M=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-sm",children:M.fullName}),M.isPrimary&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-[var(--color-accent-600)] text-white rounded-md",children:p("sidebar.primary","primary")}),M.assignedViaGroupName&&e.jsxs("span",{className:"text-xs px-1.5 py-0.5 bg-[var(--bg-secondary)] text-[var(--text-secondary)] rounded-md",children:["(",p("sidebar.viaGroup",{groupName:M.assignedViaGroupName}),")"]})]},M.userId))}):e.jsx("span",{className:"text-sm",children:p("sidebar.unassigned","Unassigned")}),d&&e.jsx("button",{onClick:d,className:"p-1 hover:bg-[var(--bg-secondary)] rounded mt-1",children:e.jsx(l.UserPlus,{className:"w-3.5 h-3.5 text-[var(--color-accent-600)]"})})]})]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:p("sidebar.createdAt","Created")}),e.jsx("dd",{className:"text-xs",children:new Date(t.createdAt).toLocaleString()})]}),t.updatedAt&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{className:"text-[var(--text-tertiary)]",children:p("sidebar.updatedAt","Updated")}),e.jsx("dd",{className:"text-xs",children:new Date(t.updatedAt).toLocaleString()})]})]})})]}),a&&G&&e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"system",icon:l.Monitor,title:p("details.systemInfo","Infos système"),isExpanded:b.has("system"),onToggle:J}),b.has("system")&&e.jsxs("div",{className:"px-3 pb-3 space-y-2",children:[G.sourceUrl&&e.jsxs("div",{className:"p-2 bg-[var(--bg-secondary)] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[var(--text-tertiary)] mb-1",children:[e.jsx(l.Globe,{className:"w-3 h-3"}),p("sidebar.url","URL")]}),e.jsx("p",{className:"text-xs font-mono break-all",children:G.sourceUrl})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[G.browser&&e.jsxs("div",{className:"p-2 bg-[var(--bg-secondary)] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[var(--text-tertiary)] mb-1",children:[e.jsx(l.Globe,{className:"w-3 h-3"}),p("sidebar.browser","Browser")]}),e.jsx("p",{className:"text-xs font-medium",children:G.browser.name}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)]",children:G.browser.version})]}),G.os&&e.jsxs("div",{className:"p-2 bg-[var(--bg-secondary)] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[var(--text-tertiary)] mb-1",children:[e.jsx(l.Laptop,{className:"w-3 h-3"}),p("sidebar.os","OS")]}),e.jsx("p",{className:"text-xs font-medium",children:G.os.name}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)]",children:G.os.version})]})]}),G.device&&e.jsxs("div",{className:"p-2 bg-[var(--bg-secondary)] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[var(--text-tertiary)] mb-1",children:[e.jsx(l.Smartphone,{className:"w-3 h-3"}),p("sidebar.device","Device")]}),e.jsxs("p",{className:"text-xs font-medium",children:[G.device.type||p("sidebar.defaultDeviceType","Desktop"),G.device.screenResolution&&` • ${G.device.screenResolution}`]})]})]})]}),a&&G?.recentErrors&&G.recentErrors.length>0&&e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"errors",icon:l.Bug,title:p("details.errors","Erreurs"),count:G.recentErrors.length,isExpanded:b.has("errors"),onToggle:J}),b.has("errors")&&e.jsx("div",{className:"px-3 pb-3 space-y-2",children:G.recentErrors.slice(0,3).map((M,te)=>e.jsxs("div",{className:"p-2 bg-[var(--error-bg)]/30 border border-[var(--error-border)] rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx(l.AlertTriangle,{className:"w-3 h-3 text-[var(--error-text)]"}),M.component&&e.jsx("span",{className:"text-xs px-1 py-0.5 bg-[var(--bg-secondary)] rounded",children:M.component})]}),e.jsx("p",{className:"text-xs font-medium text-[var(--error-text)] line-clamp-2",children:M.message})]},`error-${te}`))})]}),e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"attachments",icon:l.File,title:p("details.attachments","Pièces jointes"),count:s.length,isExpanded:b.has("attachments"),onToggle:J}),b.has("attachments")&&e.jsxs("div",{className:"px-3 pb-3",children:[z.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("p",{className:"text-xs text-[var(--text-tertiary)] mb-2 flex items-center gap-1",children:[e.jsx(l.Image,{className:"w-3 h-3"}),p("sidebar.images","Images")," (",z.length,")"]}),e.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:z.map(M=>e.jsxs("div",{className:"relative cursor-pointer rounded overflow-hidden border border-[var(--border-color)] aspect-square group",onClick:()=>w(M),children:[e.jsx(Dc,{src:y(M),alt:M.fileName,className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors flex items-center justify-center",children:e.jsx(l.Eye,{className:"w-5 h-5 text-white opacity-0 group-hover:opacity-100 transition-opacity"})})]},M.id))})]}),W.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("p",{className:"text-xs text-[var(--text-tertiary)] mb-2 flex items-center gap-1",children:[e.jsx(l.FileText,{className:"w-3 h-3"}),p("sidebar.documents","Documents")," (",W.length,")"]}),e.jsx("div",{className:"space-y-1.5",children:W.map(M=>e.jsxs("div",{className:"flex items-center gap-2 w-full p-2 bg-[var(--bg-secondary)] rounded-lg hover:bg-[var(--bg-tertiary)] transition-colors group",children:[e.jsxs("button",{onClick:()=>w(M),className:"flex items-center gap-2 flex-1 min-w-0 text-left",children:[e.jsx(l.FileText,{className:"w-4 h-4 text-[var(--text-secondary)] flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-xs block truncate",children:M.fileName}),e.jsx("span",{className:"text-[10px] text-[var(--text-tertiary)]",children:Lc(M.fileSize)})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>w(M),className:"p-1 rounded hover:bg-[var(--bg-primary)] transition-colors opacity-0 group-hover:opacity-100",title:p("filePreview.view","Aperçu")||"View",children:e.jsx(l.Eye,{className:"w-3.5 h-3.5 text-[var(--color-accent-500)]"})}),e.jsx("button",{onClick:()=>v(M),className:"p-1 rounded hover:bg-[var(--bg-primary)] transition-colors",title:p("filePreview.download","Télécharger")||"Download",children:e.jsx(l.Download,{className:"w-3.5 h-3.5 text-[var(--text-tertiary)]"})})]})]},M.id))})]}),a&&!pe&&g&&e.jsxs("div",{children:[e.jsx("input",{ref:R,type:"file",multiple:!0,onChange:M=>I(M.target.files),accept:Js.join(","),className:"hidden"}),e.jsx("div",{className:`border-2 border-dashed rounded-lg p-3 text-center transition-colors cursor-pointer ${P?"border-[var(--color-accent-500)] bg-[var(--color-accent-500)]/10":"border-[var(--border-color)] hover:border-[var(--color-accent-500)]"}`,onClick:()=>R.current?.click(),onDragOver:C,onDragEnter:O,onDragLeave:_,onDrop:E,children:c?e.jsxs("div",{className:"flex items-center justify-center gap-2 py-1",children:[e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin text-[var(--color-accent-500)]"}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:p("sidebar.uploading","Uploading...")})]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Plus,{className:"w-5 h-5 mx-auto mb-1 text-[var(--text-tertiary)]"}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:P?p("sidebar.dropHere","Drop here"):p("sidebar.addFile","Add a file")})]})}),A&&e.jsx("p",{className:"mt-2 text-xs text-[var(--error-text)]",children:A})]}),s.length===0&&(!a||pe||!g)&&e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] text-center py-2",children:p("sidebar.noAttachments","No attachments")})]})]}),a&&!q&&e.jsxs("div",{className:Y,children:[e.jsx(it,{section:"actions",icon:l.User,title:p("details.actions","Actions"),isExpanded:b.has("actions"),onToggle:J}),b.has("actions")&&e.jsxs("div",{className:"px-3 pb-3 space-y-2",children:[t.status==="Open"&&u&&e.jsx("button",{onClick:()=>u("InProgress"),disabled:o,className:"btn btn-secondary w-full text-sm py-2",children:p("sidebar.startProcessing","Start processing")}),t.status==="InProgress"&&e.jsxs(e.Fragment,{children:[u&&e.jsx("button",{onClick:()=>u("OnHold"),disabled:o,className:"btn btn-secondary w-full text-sm py-2",children:p("sidebar.putOnHold","Put on hold")}),x&&e.jsxs("button",{onClick:x,disabled:o,className:"btn btn-primary w-full text-sm py-2",children:[e.jsx(l.CheckCircle,{className:"w-4 h-4 mr-2"}),p("sidebar.resolve","Resolve")]})]}),t.status==="OnHold"&&u&&e.jsx("button",{onClick:()=>u("InProgress"),disabled:o,className:"btn btn-secondary w-full text-sm py-2",children:p("sidebar.resume","Resume")}),t.status==="Resolved"&&m&&e.jsxs("button",{onClick:m,disabled:o,className:"btn btn-primary w-full text-sm py-2",children:[e.jsx(l.XCircle,{className:"w-4 h-4 mr-2"}),p("sidebar.closeTicket","Close ticket")]}),(t.status==="Closed"||t.status==="Resolved")&&f&&e.jsxs("button",{onClick:f,disabled:o,className:"btn btn-secondary w-full text-sm py-2",children:[e.jsx(l.RotateCcw,{className:"w-4 h-4 mr-2"}),p("sidebar.reopen","Reopen")]}),!pe&&h&&e.jsxs("button",{onClick:h,disabled:o,className:"btn w-full text-sm py-2 border border-[var(--warning-border)] bg-[var(--warning-bg)] text-[var(--warning-text)] hover:bg-[var(--warning-border)]",children:[e.jsx(l.ArrowUpCircle,{className:"w-4 h-4 mr-2"}),p("sidebar.escalate","Escalate")]}),o&&e.jsx("div",{className:"flex items-center justify-center py-2",children:e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin text-[var(--color-primary-600)]"})})]})]}),a&&r.length>0&&e.jsxs("div",{className:q?Y:"px-2 py-1",children:[e.jsx(it,{section:"history",icon:l.History,title:p("details.history","History"),count:r.length,isExpanded:b.has("history"),onToggle:J}),b.has("history")&&e.jsx("div",{className:"px-3 pb-3",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-3 top-2 bottom-2 w-0.5 bg-[var(--border-color)]"}),e.jsx("div",{className:"space-y-3",children:r.slice(0,10).map((M,te)=>{const oe=Mc[M.action]||{icon:l.Edit,color:"var(--text-secondary)"},le=oe.icon,F=p(`history.actions.${M.action}`,{defaultValue:M.action});return e.jsxs("div",{className:"relative flex gap-3 pl-1",children:[e.jsx("div",{className:"relative z-10 w-5 h-5 rounded-full flex items-center justify-center bg-[var(--bg-card)] border border-[var(--border-color)]",style:{color:oe.color},children:e.jsx(le,{className:"w-3 h-3"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-xs font-medium text-[var(--text-primary)]",children:[F,M.newValue&&e.jsxs("span",{className:"text-[var(--text-secondary)] font-normal",children:[" → ",M.newValue]})]}),e.jsx("p",{className:"text-[10px] text-[var(--text-tertiary)]",children:Fc(M.createdAt,p)})]})]},te)})}),r.length>10&&e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] text-center mt-3",children:p("sidebar.moreActivities",{count:r.length-10})})]})})]})]}),e.jsx(Ic,{attachment:S,getUrl:y,onClose:()=>w(null),onDownload:v})]})}const Xt=["Open","InProgress","Resolved","Closed"],Ye={Open:{label:"Ouvert",icon:l.Clock,color:"var(--warning-text)"},InProgress:{label:"En cours",icon:l.Play,color:"var(--info-text)"},OnHold:{label:"En attente",icon:l.Pause,color:"var(--warning-text)"},Resolved:{label:"Résolu",icon:l.CheckCircle,color:"var(--success-text)"},Closed:{label:"Fermé",icon:l.XCircle,color:"var(--text-secondary)"},Rejected:{label:"Rejeté",icon:l.AlertTriangle,color:"var(--error-text)"}},Uc=t=>new Date(t).toLocaleDateString("fr-FR",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}),Bc=t=>t.isActive?"ring-4 ring-opacity-30":t.isPast?"bg-[var(--success-bg)]":"bg-[var(--bg-secondary)] border-2 border-[var(--border-color)]",_c=(t,s)=>{if(t.isActive)return s.color;if(t.isPast)return"var(--success-bg)"},qc=(t,s)=>({backgroundColor:_c(t,s),boxShadow:t.isActive?`0 0 0 4px ${s.color}30`:void 0}),zc=t=>t.isActive?"white":t.isPast?"var(--success-text)":"var(--text-tertiary)",Gc=t=>t.isActive?"text-[var(--text-primary)]":t.isPast?"text-[var(--success-text)]":"text-[var(--text-tertiary)]",Kc=(t,s)=>t.isPast?"var(--success-text)":t.isActive?s.color:"var(--border-color)";function Hc({step:t,config:s}){const r=t.icon;return e.jsx("div",{className:`relative w-10 h-10 rounded-full flex items-center justify-center shrink-0 transition-all ${Bc(t)}`,style:qc(t,s),children:e.jsx(r,{className:"w-5 h-5",style:{color:zc(t)}})})}function Vc({step:t}){return e.jsxs("div",{className:"mt-2 text-center",children:[e.jsx("p",{className:`text-xs font-medium ${Gc(t)}`,children:t.label}),t.date&&(t.isActive||t.isPast)&&e.jsx("p",{className:"text-[10px] text-[var(--text-secondary)] mt-0.5",children:Uc(t.date)})]})}function Wc({step:t,config:s,isLast:r}){return r?null:e.jsx("div",{className:"flex-1 h-0.5 mx-2 mt-[-20px]",style:{backgroundColor:Kc(t,s)}})}function Xc({currentStatus:t,createdAt:s,resolvedAt:r,closedAt:a,activities:o=[],isSupport:c,saving:i,assignees:d,onAssign:u,onStatusChange:x,onResolve:m,onCloseTicket:f,onReopen:h,onEscalate:v}){const{t:g}=ne.useTranslation("support"),y=t==="Rejected",p=o.some(S=>S.action==="Reopened"),j=(()=>{if(y)return[{status:"Open",label:g("tickets.statuses.Open",Ye.Open.label),icon:Ye.Open.icon,date:s,isActive:!1,isPast:!0,isFuture:!1},{status:"Rejected",label:g("tickets.statuses.Rejected",Ye.Rejected.label),icon:Ye.Rejected.icon,date:a,isActive:!0,isPast:!1,isFuture:!1}];const S=Xt.indexOf(t),w=[],P={Open:s};o.filter(A=>A.action==="StatusChanged"&&A.newValue).forEach(A=>{A.newValue&&(P[A.newValue]=A.createdAt)}),r&&(P.Resolved=r),a&&(P.Closed=a);const $=o.some(A=>A.action==="StatusChanged"&&A.newValue==="OnHold");if(Xt.forEach(A=>{const k=Ye[A],R=A===t?S:Xt.indexOf(A),L=A===t,I=R<S,C=R>S;w.push({status:A,label:g(`tickets.statuses.${A}`,{defaultValue:k.label}),icon:k.icon,date:P[A],isActive:L,isPast:I,isFuture:C})}),$){const A=w.findIndex(k=>k.status==="Resolved");w.splice(A,0,{status:"OnHold",label:g("tickets.statuses.OnHold",Ye.OnHold.label),icon:Ye.OnHold.icon,date:P.OnHold,isActive:t==="OnHold",isPast:t!=="OnHold"&&t!=="Open"&&t!=="InProgress",isFuture:!1})}return w})();return e.jsx("div",{className:"w-full px-4 py-2 bg-[var(--bg-card)] border-b border-[var(--border-color)]",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center flex-1 min-w-0",children:[j.map((S,w)=>{const P=Ye[S.status],$=w===j.length-1;return e.jsxs("div",{className:"flex items-center flex-1",children:[e.jsxs("div",{className:`flex flex-col items-center ${S.isFuture?"opacity-40":""}`,children:[e.jsx(Hc,{step:S,config:P}),e.jsx(Vc,{step:S})]}),e.jsx(Wc,{step:S,config:P,isLast:$})]},S.status)}),p&&e.jsxs("div",{className:"ml-2 flex items-center gap-1 text-[10px] text-[var(--warning-text)] shrink-0",children:[e.jsx(l.RotateCcw,{className:"w-3 h-3"}),e.jsx("span",{children:g("workflow.reopened","Réouvert")})]})]}),c&&e.jsx("div",{className:"w-px h-12 bg-[var(--border-color)] shrink-0"}),c&&e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[d&&d.length>0?e.jsxs("div",{className:"flex items-center -space-x-1.5",title:d.map(S=>S.fullName).join(", "),children:[d.slice(0,3).map(S=>e.jsx("div",{className:"w-7 h-7 rounded-full bg-[var(--color-accent-500)] flex items-center justify-center text-white text-[10px] font-medium border-2 border-[var(--bg-card)]",title:`${S.fullName}${S.isPrimary?` (${g("workflow.primary","principal")})`:""}${S.assignedViaGroupName?` (${g("workflow.viaGroup","via")} ${S.assignedViaGroupName})`:""}`,children:S.fullName.charAt(0).toUpperCase()},S.userId)),d.length>3&&e.jsxs("div",{className:"w-7 h-7 rounded-full bg-[var(--bg-tertiary)] flex items-center justify-center text-[10px] font-medium text-[var(--text-secondary)] border-2 border-[var(--bg-card)]",children:["+",d.length-3]})]}):e.jsx("span",{className:"text-[10px] text-[var(--text-tertiary)] italic",children:g("workflow.notAssigned","Non assigné")}),u&&e.jsx("button",{onClick:u,className:"w-7 h-7 rounded-full border border-dashed border-[var(--border-color)] flex items-center justify-center hover:border-[var(--color-accent-500)] hover:bg-[var(--bg-secondary)] transition-colors",title:g("workflow.assign","Assigner"),children:e.jsx(l.UserPlus,{className:"w-3.5 h-3.5 text-[var(--color-accent-600)]"})})]}),i&&e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin text-[var(--color-primary-600)]"}),t==="Open"&&x&&e.jsxs("button",{onClick:()=>x("InProgress"),disabled:i,className:"btn btn-secondary btn-sm text-xs",children:[e.jsx(l.Play,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.start","Commencer")]}),t==="InProgress"&&x&&e.jsxs("button",{onClick:()=>x("OnHold"),disabled:i,className:"btn btn-secondary btn-sm text-xs",children:[e.jsx(l.Pause,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.hold","En attente")]}),t==="InProgress"&&m&&e.jsxs("button",{onClick:m,disabled:i,className:"btn btn-primary btn-sm text-xs",children:[e.jsx(l.CheckCircle,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.resolve","Résoudre")]}),t==="OnHold"&&x&&e.jsxs("button",{onClick:()=>x("InProgress"),disabled:i,className:"btn btn-secondary btn-sm text-xs",children:[e.jsx(l.Play,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.resume","Reprendre")]}),t==="Resolved"&&f&&e.jsxs("button",{onClick:f,disabled:i,className:"btn btn-primary btn-sm text-xs",children:[e.jsx(l.XCircle,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.close","Fermer")]}),(t==="Closed"||t==="Resolved")&&h&&e.jsxs("button",{onClick:h,disabled:i,className:"btn btn-secondary btn-sm text-xs",children:[e.jsx(l.RotateCcw,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.reopen","Réouvrir")]}),t!=="Closed"&&t!=="Rejected"&&v&&e.jsxs("button",{onClick:v,disabled:i,className:"btn btn-sm text-xs border border-[var(--warning-border)] bg-[var(--warning-bg)] text-[var(--warning-text)] hover:bg-[var(--warning-border)]",children:[e.jsx(l.ArrowUpCircle,{className:"w-3.5 h-3.5 mr-1"}),g("workflow.actions.escalate","Escalader")]})]})]})})}const lt={Proposed:{border:"border-blue-500",bg:"bg-blue-50",text:"text-blue-900"},Approved:{border:"border-green-500",bg:"bg-green-50",text:"text-green-900"},Rejected:{border:"border-red-500",bg:"bg-red-50",text:"text-red-900"},Superseded:{border:"border-gray-400",bg:"bg-gray-50",text:"text-gray-700"}},Qs={Proposed:l.Clock,Approved:l.CheckCircle,Rejected:l.XCircle,Superseded:l.AlertCircle};function Yc({ticketId:t,solutions:s,activeSolution:r,mode:a,onProposeSolution:o,onApproveSolution:c,onRejectSolution:i,isLoading:d}){const{t:u}=ne.useTranslation("support"),[x,m]=n.useState(!1),[f,h]=n.useState(""),[v,g]=n.useState(!1),[y,p]=n.useState(""),[b,j]=n.useState(!1),[S,w]=n.useState(!1),P=n.useCallback(async()=>{if(!(!f.trim()||!o)){m(!0);try{await o(f),h("")}finally{m(!1)}}},[f,o]),$=n.useCallback(()=>{j(!0)},[]),A=n.useCallback(async()=>{if(!(!y.trim()||!i)){g(!0);try{await i(y),p(""),j(!1)}finally{g(!1)}}},[y,i]),k=R=>{if(!R.autoCloseAt)return null;const L=new Date(R.autoCloseAt),I=new Date,C=L.getTime()-I.getTime(),O=Math.ceil(C/(1e3*60*60*24));return O>0?O:0};return s.length===0&&a==="support"&&o?e.jsxs("div",{className:"bg-[var(--bg-card)] rounded-lg border border-[var(--border-color)] p-4",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:u("solution.proposeSolution","Propose Solution")}),e.jsx("textarea",{value:f,onChange:R=>h(R.target.value),placeholder:u("solution.enterSolution","Enter solution..."),className:"w-full p-3 border border-[var(--border-color)] rounded-lg bg-[var(--bg-primary)] text-[var(--text-primary)] placeholder-[var(--text-tertiary)] focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-500)] resize-none",rows:4,disabled:x||d}),e.jsx("div",{className:"mt-3 flex gap-2 justify-end",children:e.jsx("button",{onClick:P,disabled:!f.trim()||x||d,className:"btn btn-primary flex items-center gap-2",children:x?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}),u("solution.proposeSolution","Propose Solution")]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Send,{className:"w-4 h-4"}),u("solution.proposeSolution","Propose Solution")]})})})]}):e.jsxs("div",{className:"space-y-4",children:[r&&e.jsxs("div",{className:`rounded-lg border-2 p-4 ${lt[r.status].border} ${lt[r.status].bg}`,children:[e.jsx("div",{className:"flex items-start justify-between mb-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[(()=>{const R=Qs[r.status];return e.jsx(R,{className:`w-5 h-5 ${lt[r.status].text}`})})(),e.jsxs("div",{children:[e.jsx("h4",{className:`font-semibold ${lt[r.status].text}`,children:u(`solution.status.${r.status.toLowerCase()}`,r.status)}),e.jsxs("p",{className:"text-sm opacity-75",children:[u("solution.solutionNumber","Solution #"),r.solutionNumber," - ",u("solution.proposedBy","Proposed by")," ",r.proposedByUserName||"Unknown"]})]})]})}),e.jsx("div",{className:"bg-white/50 rounded p-3 mb-3 max-h-32 overflow-y-auto",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:r.content})}),r.status==="Proposed"&&r.autoCloseAt&&e.jsx("div",{className:"mb-3 p-2 bg-yellow-100/50 border-l-2 border-yellow-500 rounded",children:e.jsxs("p",{className:"text-sm",children:[u("solution.autoCloseWarning","Will be auto-approved in")," ",e.jsxs("strong",{children:[k(r)," ",u("solution.autoCloseCountdown","days")]}),r.autoCloseWarningSent&&e.jsxs(e.Fragment,{children:[" (",u("solution.warningEmailSent","warning email sent"),")"]})]})}),r.status==="Approved"&&e.jsxs("p",{className:"text-sm",children:[u("solution.approvedBy","Approved by")," ",r.approvedByUserName||"Unknown"," on ",r.approvedAt&&new Date(r.approvedAt).toLocaleDateString()]}),r.status==="Rejected"&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm mb-2",children:[u("solution.rejectedBy","Rejected by")," ",r.rejectedByUserName||"Unknown"," on ",r.rejectedAt&&new Date(r.rejectedAt).toLocaleDateString()]}),r.rejectionReason&&e.jsxs("p",{className:"text-sm bg-white/30 p-2 rounded italic",children:[u("solution.rejectionReason","Reason"),": ",r.rejectionReason]})]}),a==="client"&&r.status==="Proposed"&&e.jsxs("div",{className:"mt-3 flex gap-2 justify-end",children:[e.jsx("button",{onClick:$,disabled:v||d,className:"btn btn-secondary text-sm py-1.5",children:u("solution.rejectSolution","Reject")}),e.jsx("button",{onClick:c,disabled:v||d||!c,className:"btn btn-primary text-sm py-1.5 flex items-center gap-2",children:d?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-3 h-3 animate-spin"}),u("solution.acceptSolution","Approve")]}):e.jsxs(e.Fragment,{children:[e.jsx(l.CheckCircle,{className:"w-3 h-3"}),u("solution.acceptSolution","Approve")]})})]})]}),a==="support"&&o&&!r&&e.jsxs("div",{className:"bg-[var(--bg-card)] rounded-lg border border-[var(--border-color)] p-4",children:[e.jsx("h4",{className:"font-semibold mb-3",children:u("solution.proposeSolution","Propose Solution")}),e.jsx("textarea",{value:f,onChange:R=>h(R.target.value),placeholder:u("solution.enterSolution","Enter solution..."),className:"w-full p-3 border border-[var(--border-color)] rounded-lg bg-[var(--bg-primary)] text-[var(--text-primary)] placeholder-[var(--text-tertiary)] focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-500)] resize-none",rows:4,disabled:x||d}),e.jsx("div",{className:"mt-3 flex gap-2 justify-end",children:e.jsx("button",{onClick:P,disabled:!f.trim()||x||d,className:"btn btn-primary flex items-center gap-2",children:x?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}),u("solution.proposeSolution","Propose Solution")]}):e.jsxs(e.Fragment,{children:[e.jsx(l.Send,{className:"w-4 h-4"}),u("solution.proposeSolution","Propose Solution")]})})})]}),s.length>1&&e.jsxs("div",{className:"bg-[var(--bg-card)] rounded-lg border border-[var(--border-color)] overflow-hidden",children:[e.jsxs("button",{onClick:()=>w(!S),className:"w-full flex items-center gap-2 p-4 hover:bg-[var(--bg-secondary)] transition-colors",children:[S?e.jsx(l.ChevronDown,{className:"w-4 h-4 text-[var(--text-tertiary)]"}):e.jsx(l.ChevronRight,{className:"w-4 h-4 text-[var(--text-tertiary)]"}),e.jsxs("h4",{className:"font-semibold",children:[u("solution.solutionHistory","Solution History")," (",s.length,")"]})]}),S&&e.jsx("div",{className:"border-t border-[var(--border-color)] p-4 space-y-3",children:s.map(R=>e.jsxs("div",{className:`rounded-lg border p-3 ${lt[R.status].border}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[(()=>{const L=Qs[R.status];return e.jsx(L,{className:`w-4 h-4 ${lt[R.status].text}`})})(),e.jsx("span",{className:"text-sm font-medium",children:u(`solution.status.${R.status.toLowerCase()}`,R.status)}),e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)]",children:["#",R.solutionNumber]})]}),e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:new Date(R.proposedAt).toLocaleDateString()})]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-2 line-clamp-2",children:R.content}),e.jsxs("p",{className:"text-xs text-[var(--text-tertiary)]",children:[u("solution.proposedBy","Proposed by")," ",R.proposedByUserName||"Unknown"]})]},R.id))})]}),s.length===0&&a==="client"&&e.jsx("div",{className:"text-center py-6 text-[var(--text-tertiary)]",children:e.jsx("p",{children:u("solution.noSolutions","No solutions proposed yet")})}),b&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-[var(--bg-card)] rounded-lg shadow-lg p-6 w-96 max-w-[90vw]",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:u("solution.rejectSolution","Reject Solution")}),e.jsx("textarea",{value:y,onChange:R=>p(R.target.value),placeholder:u("solution.enterRejectReason","Enter reason for rejection..."),className:"w-full p-3 border border-[var(--border-color)] rounded-lg bg-[var(--bg-primary)] text-[var(--text-primary)] placeholder-[var(--text-tertiary)] focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-500)] resize-none",rows:4,disabled:v}),e.jsxs("div",{className:"mt-4 flex gap-2 justify-end",children:[e.jsx("button",{onClick:()=>j(!1),disabled:v,className:"btn btn-secondary",children:u("common:cancel","Cancel")}),e.jsx("button",{onClick:A,disabled:!y.trim()||v,className:"btn btn-primary flex items-center gap-2",children:v?e.jsxs(e.Fragment,{children:[e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}),u("solution.rejectSolution","Reject")]}):e.jsxs(e.Fragment,{children:[e.jsx(l.XCircle,{className:"w-4 h-4"}),u("solution.rejectSolution","Reject")]})})]})]})})]})}const Jc={getCached:t=>D.get(`/api/support/ai-routing/cached/${t}`)},ga={analyze:t=>D.get(`/api/support/ai-routing/analyze/${t}`)},fa={summarize:t=>D.post(`/api/support/ai-routing/summarize/${t}`)},ba={applyRouting:(t,s)=>D.post(`/api/support/ai-routing/apply/${t}`,s)},Zs=Object.freeze(Object.defineProperty({__proto__:null,analyzeApi:ga,cachedAiApi:Jc,routingApi:ba,summarizeApi:fa},Symbol.toStringTag,{value:"Module"}));function va({classification:t}){const{t:s}=ne.useTranslation("support");if(!t)return null;const r=o=>o>.8?"bg-[var(--success-bg)] text-[var(--success-text)]":o>.5?"bg-[var(--warning-bg)] text-[var(--warning-text)]":"bg-[var(--error-bg)] text-[var(--error-text)]",a=o=>o>.8?s("aiClassification.confidence.high"):o>.5?s("aiClassification.confidence.medium"):s("aiClassification.confidence.low");return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"px-3 py-1 rounded-full text-xs font-medium bg-[var(--info-bg)] text-[var(--info-text)]",children:s(`tickets.types.${t.suggestedType}`)}),e.jsx("span",{className:"px-3 py-1 rounded-full text-xs font-medium bg-[var(--warning-bg)] text-[var(--warning-text)]",children:s(`tickets.priorities.${t.suggestedPriority}`)}),e.jsxs("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${r(t.confidenceScore)}`,children:[a(t.confidenceScore)," (",Math.round(t.confidenceScore*100),"%)"]})]})}function ya(t){const[s,r]=n.useState(t?.initialData??null),[a,o]=n.useState(!1),[c,i]=n.useState(null),d=n.useRef(null),u=n.useRef(!1);n.useEffect(()=>(u.current=!1,()=>{u.current=!0,d.current?.abort()}),[]);const x=n.useCallback(async h=>{d.current?.abort();const v=new AbortController;d.current=v,o(!0),i(null);try{const g=await h(v.signal);!u.current&&!v.signal.aborted&&r(g)}catch(g){!u.current&&!v.signal.aborted&&i(g instanceof Error?g.message:"Unknown error")}finally{!u.current&&!v.signal.aborted&&o(!1)}},[]),m=n.useCallback(()=>{d.current?.abort(),u.current||o(!1)},[]),f=n.useCallback(()=>{r(null),i(null),o(!1)},[]);return{data:s,loading:a,error:c,execute:x,cancel:m,reset:f}}function Qc({ticketId:t,cachedClassification:s,cachedRouting:r,cachedGeneratedAt:a,processing:o,onProcessingStart:c,onProcessingEnd:i}){const{t:d}=ne.useTranslation("support"),u=s||r?{classification:s??null,routingSuggestion:r??null,isAiAvailable:!0,errorCode:null,errorMessage:null}:void 0,{data:x,loading:m,error:f,execute:h,reset:v}=ya({initialData:u}),[g,y]=n.useState(!1),p=n.useCallback(async()=>{c?.(),await h(async()=>{const w=await ga.analyze(t);return i?.(),w})},[t,h,c,i]),b=n.useCallback(async()=>{if(x?.routingSuggestion)try{y(!0);const w={assignToUserId:x.routingSuggestion.suggestedAgents[0]?.userId,assignToGroupId:x.routingSuggestion.suggestedGroupId??void 0,applyPriorityAdjustment:x.routingSuggestion.priorityAdjustment!==null};await ba.applyRouting(t,w),v()}catch{}finally{y(!1)}},[x,v,d]);if(f&&!x)return e.jsx("div",{className:"card p-4 bg-[var(--error-bg)]/10 border border-[var(--error-border)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-[var(--error-text)] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-[var(--error-text)] font-medium mb-1",children:d("aiRouting.error")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:f}),e.jsxs("button",{onClick:p,disabled:m,className:"btn btn-secondary btn-sm mt-2 flex items-center gap-1",children:[e.jsx(l.RefreshCw,{className:"w-3 h-3"}),d("common:actions.retry")]})]})]})});if(!x)return o?e.jsx("div",{className:"card p-4 bg-[var(--info-bg)]/10 border border-[var(--info-border)]",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin text-[var(--info-text)] flex-shrink-0"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:d("aiRouting.processing")})]})}):e.jsxs("button",{onClick:p,disabled:m,className:"btn btn-secondary btn-sm flex items-center gap-2",children:[m?e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}):e.jsx(l.Sparkles,{className:"w-4 h-4"}),d("aiRouting.analyze")]});if(m&&!x)return e.jsx("div",{className:"card p-6 flex items-center justify-center",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--color-primary-600)]"})});if(!x.isAiAvailable){const w=x.errorCode?`aiRouting.errors.${x.errorCode}`:null,P=w&&d(w)!==w?d(w):x.errorMessage??d("aiRouting.notConfigured");return e.jsx("div",{className:"card p-4 bg-[var(--warning-bg)]/10 border border-[var(--warning-border)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-[var(--warning-text)] flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:P})]})})}if(!x.classification&&!x.routingSuggestion)return e.jsx("div",{className:"card p-4 bg-[var(--error-bg)]/10 border border-[var(--error-border)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-[var(--error-text)] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-[var(--error-text)] font-medium mb-1",children:d("aiRouting.error")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:x.errorMessage??d("aiRouting.notAvailable")}),e.jsxs("button",{onClick:p,disabled:m,className:"btn btn-secondary btn-sm mt-2 flex items-center gap-1",children:[e.jsx(l.RefreshCw,{className:"w-3 h-3"}),d("common:actions.retry")]})]})]})});const j=x.routingSuggestion,S=a&&!m?new Date(a):null;return e.jsx("div",{className:"card p-6 bg-[var(--info-bg)]/10 border border-[var(--info-border)]",children:e.jsxs("div",{className:"space-y-4",children:[x.errorMessage&&e.jsxs("div",{className:"flex items-start gap-2 text-xs text-[var(--warning-text)] bg-[var(--warning-bg)]/20 rounded p-2",children:[e.jsx(l.AlertCircle,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),e.jsx("p",{children:x.errorMessage})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.Sparkles,{className:"w-5 h-5 text-[var(--info-text)] flex-shrink-0 mt-1"}),e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"font-semibold text-sm",children:d("aiRouting.suggestedRouting")}),e.jsxs("button",{onClick:p,disabled:m,className:"btn btn-secondary btn-sm flex items-center gap-1",title:d("aiRouting.refresh"),children:[m?e.jsx(l.Loader2,{className:"w-3 h-3 animate-spin"}):e.jsx(l.RefreshCw,{className:"w-3 h-3"}),d("aiRouting.refresh")]})]}),S&&e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-3",children:d("aiRouting.generatedAt",{date:S.toLocaleString()})}),e.jsxs("div",{className:"space-y-3",children:[x.classification&&e.jsx(va,{classification:x.classification}),j&&j.suggestedAgents.length>0&&e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"text-[var(--text-secondary)] mb-2",children:d("aiRouting.suggestedAgents")}),e.jsx("div",{className:"space-y-1",children:j.suggestedAgents.map(w=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"font-medium",children:w.userName||w.userId}),e.jsxs("span",{className:"text-xs text-[var(--text-tertiary)]",children:[Math.round(w.matchScore*100),"%"]})]},w.userId))})]}),j?.suggestedGroupName&&e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"text-[var(--text-secondary)] mb-1",children:d("aiRouting.suggestedGroup")}),e.jsx("p",{className:"font-medium",children:j.suggestedGroupName})]}),j?.reasoning&&e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"text-[var(--text-secondary)] mb-1",children:d("aiRouting.reasoning")}),e.jsx("p",{className:"italic",children:j.reasoning})]}),e.jsx("div",{className:"pt-3 border-t border-[var(--border-color)] flex gap-2",children:j&&e.jsxs("button",{onClick:b,disabled:g,className:"btn btn-primary btn-sm flex items-center gap-2 flex-1 justify-center",children:[g?e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}):e.jsx(l.Check,{className:"w-4 h-4"}),d("aiRouting.apply")]})})]})]})]})]})})}function Zc({ticketId:t,cachedSummary:s,cachedGeneratedAt:r,processing:a,onProcessingStart:o,onProcessingEnd:c}){const{t:i}=ne.useTranslation("support"),d=s?{summary:s,isAiAvailable:!0,errorCode:null,errorMessage:null}:void 0,{data:u,loading:x,error:m,execute:f}=ya({initialData:d}),h=n.useCallback(async()=>{o?.(),await f(async()=>{const y=await fa.summarize(t);return c?.(),y})},[t,f,o,c]);if(m&&!u)return e.jsx("div",{className:"card p-4 bg-[var(--error-bg)]/10 border border-[var(--error-border)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-[var(--error-text)] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-[var(--error-text)] font-medium mb-1",children:i("aiSummary.error")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:m}),e.jsxs("button",{onClick:h,disabled:x,className:"btn btn-secondary btn-sm mt-2 flex items-center gap-1",children:[e.jsx(l.RefreshCw,{className:"w-3 h-3"}),i("common:actions.retry")]})]})]})});if(!u)return a?e.jsx("div",{className:"card p-4 bg-[var(--info-bg)]/10 border border-[var(--info-border)]",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin text-[var(--info-text)] flex-shrink-0"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:i("aiSummary.processing")})]})}):e.jsxs("button",{onClick:h,disabled:x,className:"btn btn-secondary btn-sm flex items-center gap-2",children:[x?e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}):e.jsx(l.Zap,{className:"w-4 h-4"}),i("aiSummary.generate")]});if(x&&!u)return e.jsx("div",{className:"card p-6 flex items-center justify-center",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--color-primary-600)]"})});if(!u.isAiAvailable){const y=u.errorCode?`aiRouting.errors.${u.errorCode}`:null,p=y&&i(y)!==y?i(y):u.errorMessage??i("aiRouting.notConfigured");return e.jsx("div",{className:"card p-4 bg-[var(--warning-bg)]/10 border border-[var(--warning-border)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-[var(--warning-text)] flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:p})]})})}if(!u.summary){const y=u.errorCode?`aiSummary.errors.${u.errorCode}`:null,p=y&&i(y)!==y?i(y):u.errorMessage??i("aiSummary.error");return e.jsx("div",{className:"card p-4 bg-[var(--error-bg)]/10 border border-[var(--error-border)]",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l.AlertCircle,{className:"w-5 h-5 text-[var(--error-text)] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-[var(--error-text)] font-medium mb-1",children:i("aiSummary.error")}),e.jsx("p",{className:"text-xs text-[var(--text-secondary)]",children:p}),e.jsxs("button",{onClick:h,disabled:x,className:"btn btn-secondary btn-sm mt-2 flex items-center gap-1",children:[e.jsx(l.RefreshCw,{className:"w-3 h-3"}),i("common:actions.retry")]})]})]})})}const v=u.summary,g=r&&!x?new Date(r):null;return e.jsxs("div",{className:"card p-6 bg-[var(--bg-secondary)]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[e.jsx(l.Zap,{className:"w-5 h-5"}),i("aiSummary.title")]}),e.jsxs("button",{onClick:h,disabled:x,className:"btn btn-secondary btn-sm flex items-center gap-1",title:i("aiSummary.refresh"),children:[x?e.jsx(l.Loader2,{className:"w-3 h-3 animate-spin"}):e.jsx(l.RefreshCw,{className:"w-3 h-3"}),i("aiSummary.refresh")]})]}),g&&e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] mb-3",children:i("aiSummary.generatedAt",{date:g.toLocaleString()})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-2 font-medium",children:i("aiSummary.summary")}),e.jsx("p",{className:"text-sm",children:v.summary})]}),v.keyPoints.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-2 font-medium",children:i("aiSummary.keyPoints")}),e.jsx("ul",{className:"list-disc list-inside space-y-1",children:v.keyPoints.map((y,p)=>e.jsx("li",{className:"text-sm",children:y},p))})]}),v.sentiment&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-2 font-medium",children:i("aiSummary.sentiment")}),e.jsx("p",{className:"text-sm",children:v.sentiment})]}),v.blockers&&v.blockers.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-2 font-medium",children:i("aiSummary.blockers")}),e.jsx("ul",{className:"space-y-2",children:v.blockers.map((y,p)=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-xs px-2 py-1 rounded bg-[var(--warning-bg)] text-[var(--warning-text)] flex-shrink-0 mt-0.5",children:p+1}),e.jsx("span",{className:"text-sm",children:y})]},p))})]})]})]})}const ye={tickets:{getAll:t=>D.get("/api/support/tickets",{params:t}),getMyTickets:t=>D.get("/api/support/tickets/my-assigned",{params:t}),getById:t=>D.get(`/api/support/tickets/${t}`),create:t=>D.post("/api/support/tickets",t),update:(t,s)=>D.put(`/api/support/tickets/${t}`,s),updateStatus:(t,s)=>D.patch(`/api/support/tickets/${t}/status`,{status:s}),assign:(t,s,r,a)=>D.patch(`/api/support/tickets/${t}/assign`,{assignedToUserId:s,userIds:r,groupIds:a}),resolve:(t,s)=>D.patch(`/api/support/tickets/${t}/resolve`,{resolution:s}),close:t=>D.patch(`/api/support/tickets/${t}/close`),reopen:t=>D.patch(`/api/support/tickets/${t}/reopen`),addComment:(t,s)=>D.post(`/api/support/tickets/${t}/comments`,s),delete:t=>D.delete(`/api/support/tickets/${t}`),getStats:t=>D.get("/api/support/tickets/stats",{params:{tenantId:t}}),getMyAssignedStats:()=>D.get("/api/support/tickets/my-assigned/stats"),getAttachmentUrl:(t,s)=>`/api/support/tickets/${t}/attachments/${s}`,downloadAttachment:(t,s)=>D.get(`/api/support/tickets/${t}/attachments/${s}`,{responseType:"blob"}),uploadAttachment:(t,s)=>{const r=new FormData;return r.append("file",s),D.post(`/api/support/tickets/${t}/attachments`,r,{headers:{"Content-Type":"multipart/form-data"}})},getActivities:(t,s=10)=>D.get(`/api/support/tickets/${t}/activities`,{params:{limit:s}}),getTicketingProvider:()=>D.get("/api/support/tickets/provider"),getGlpiSyncStats:()=>D.get("/api/support/tickets/glpi-sync-stats"),proposeSolution:(t,s)=>D.post(`/api/support/tickets/${t}/solutions`,{content:s}),getSolutions:t=>D.get(`/api/support/tickets/${t}/solutions`),approveSolution:t=>D.patch(`/api/support/tickets/${t}/solutions/approve`),rejectSolution:(t,s)=>D.patch(`/api/support/tickets/${t}/solutions/reject`,{reason:s})}},qe={getAll:t=>D.get("/api/support/my-tickets",{params:t}),getById:t=>D.get(`/api/support/my-tickets/${t}`),create:t=>D.post("/api/support/my-tickets",t),update:(t,s)=>D.put(`/api/support/my-tickets/${t}`,s),addComment:(t,s)=>D.post(`/api/support/my-tickets/${t}/comments`,{content:s}),getStats:()=>D.get("/api/support/my-tickets/stats"),uploadAttachment:(t,s)=>{const r=new FormData;return r.append("file",s),D.post(`/api/support/my-tickets/${t}/attachments`,r,{headers:{"Content-Type":"multipart/form-data"}})},downloadAttachment:(t,s)=>D.get(`/api/support/my-tickets/${t}/attachments/${s}`,{responseType:"blob"}),deleteAttachment:(t,s)=>D.delete(`/api/support/my-tickets/${t}/attachments/${s}`),getActivities:(t,s=10)=>D.get(`/api/support/my-tickets/${t}/activities`,{params:{limit:s}}),getAttachmentUrl:(t,s)=>`/api/support/my-tickets/${t}/attachments/${s}`,submitSatisfaction:(t,s)=>D.post(`/api/support/my-tickets/${t}/satisfaction`,s),getSatisfaction:t=>D.get(`/api/support/my-tickets/${t}/satisfaction`),getSolutions:t=>D.get(`/api/support/my-tickets/${t}/solutions`),approveSolution:t=>D.patch(`/api/support/my-tickets/${t}/solutions/approve`),rejectSolution:(t,s)=>D.patch(`/api/support/my-tickets/${t}/solutions/reject`,{reason:s})},ed={getByTicket:(t,s=1,r=50)=>D.get("/api/support/assignment/logs",{params:{ticketId:t,page:s,pageSize:r}})},ge="/api/administration/users/groups",td=t=>{const s=D;return{getAll:async(r,a,o)=>{const c=new URLSearchParams;r&&c.append("search",r),a!==void 0&&c.append("isActive",String(a)),o!==void 0&&c.append("syncedFromEntra",String(o));const i=c.toString(),d=i?`${ge}?${i}`:ge;return await s.get(d)},getById:async r=>await s.get(`${ge}/${r}`),create:async r=>await s.post(ge,r),update:async(r,a)=>await s.put(`${ge}/${r}`,a),delete:async r=>{await s.delete(`${ge}/${r}`)},activate:async r=>{await s.patch(`${ge}/${r}/activate`)},deactivate:async r=>{await s.patch(`${ge}/${r}/deactivate`)},linkToEntra:async(r,a)=>{await s.post(`${ge}/${r}/link-entra`,a)},unlinkFromEntra:async r=>{await s.post(`${ge}/${r}/unlink-entra`)},getMembers:async r=>await s.get(`${ge}/${r}/members`),addMember:async(r,a)=>{await s.post(`${ge}/${r}/members`,a)},removeMember:async(r,a)=>{await s.delete(`${ge}/${r}/members/${a}`)},getRoles:async r=>await s.get(`${ge}/${r}/roles`),assignRole:async(r,a)=>{await s.post(`${ge}/${r}/roles`,a)},removeRole:async(r,a,o)=>{const c=o?`?tenantId=${o}`:"";await s.delete(`${ge}/${r}/roles/${a}${c}`)},setRoleInheritable:async(r,a,o)=>{await s.patch(`${ge}/${r}/roles/${a}/inheritable`,o)},getChildGroups:async r=>await s.get(`${ge}/${r}/children`),setParentGroup:async(r,a)=>{await s.patch(`${ge}/${r}/parent`,a)},getTenants:async r=>await s.get(`${ge}/${r}/tenants`),getInheritedTenants:async r=>await s.get(`${ge}/${r}/inherited-tenants`),addToTenant:async(r,a)=>{await s.post(`${ge}/${r}/tenants`,a)},removeFromTenant:async(r,a)=>{await s.delete(`${ge}/${r}/tenants/${a}`)},getApplicationAccess:async(r,a)=>{const o=a?`${ge}/${r}/application-access?tenantId=${a}`:`${ge}/${r}/application-access`;return await s.get(o)},getCustomRole:async r=>await s.get(`${ge}/${r}/custom-role`),createCustomRole:async r=>await s.post(`${ge}/${r}/custom-role`),deleteCustomRole:async r=>{await s.delete(`${ge}/${r}/custom-role`)}}},sd=td();function ja(){const{currentTenant:t}=Ee(),[s,r]=n.useState(null),[a,o]=n.useState(!!t),[c,i]=n.useState(null),d=n.useCallback(async()=>{if(!t){r(null);return}o(!0),i(null);try{const u=await ye.tickets.getTicketingProvider();r(u)}catch{i("Failed to load ticketing provider configuration"),r(null)}finally{o(!1)}},[t]);return n.useEffect(()=>{d()},[d]),{provider:s?.provider??"SmartStack",isGlpi:s?.provider==="Glpi",isConfigured:s?.isConfigured??!1,glpiBaseUrl:s?.glpiBaseUrl??void 0,loading:a,error:c,refresh:d}}const as={Open:"pending",InProgress:"active",OnHold:"warning",Resolved:"active",Closed:"inactive",Rejected:"error"},er={Low:{bg:"var(--info-bg)",text:"var(--info-text)"},Medium:{bg:"var(--warning-bg)",text:"var(--warning-text)"},High:{bg:"var(--error-bg)",text:"var(--error-text)"},Critical:{bg:"var(--error-text)",text:"white"}},rd=["conversation","description","information","assignment","ai"],ad={Open:"statusDescriptions.Open",InProgress:"statusDescriptions.InProgress",OnHold:"statusDescriptions.OnHold",Resolved:"statusDescriptions.Resolved",Closed:"statusDescriptions.Closed",Rejected:"statusDescriptions.Rejected"};function nd({satisfaction:t,showRatingForm:s,ratingValue:r,ratingComment:a,submittingRating:o,onShowForm:c,onRatingChange:i,onCommentChange:d,onCancel:u,onSubmit:x,t:m}){return t?e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium flex items-center gap-2 mb-2",children:[e.jsx(l.Star,{className:"w-4 h-4 text-amber-500 fill-amber-500"}),m("satisfaction.yourRating","Votre évaluation")]}),e.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[[1,2,3,4,5].map(f=>e.jsx(l.Star,{className:`w-5 h-5 ${f<=t.rating?"text-amber-500 fill-amber-500":"text-[var(--text-tertiary)]"}`},f)),e.jsxs("span",{className:"ml-2 text-sm text-[var(--text-secondary)]",children:[t.rating,"/5"]})]}),t.comment&&e.jsxs("p",{className:"text-sm text-[var(--text-secondary)] italic",children:['"',t.comment,'"']})]}):s?e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium flex items-center gap-2 mb-3",children:[e.jsx(l.Star,{className:"w-4 h-4 text-amber-500"}),m("satisfaction.rateTitle","Évaluez cette résolution")]}),e.jsx("div",{className:"flex items-center gap-1 mb-3",children:[1,2,3,4,5].map(f=>e.jsx("button",{type:"button",onClick:()=>i(f),className:"p-1 hover:scale-110 transition-transform",children:e.jsx(l.Star,{className:`w-7 h-7 transition-colors ${f<=r?"text-amber-500 fill-amber-500":"text-[var(--text-tertiary)] hover:text-amber-300"}`})},f))}),e.jsx("textarea",{value:a,onChange:f=>d(f.target.value),placeholder:m("satisfaction.commentPlaceholder","Commentaire (optionnel)..."),className:"input w-full h-20 mb-3 text-sm"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:u,className:"btn btn-secondary btn-sm",children:m("common.cancel","Annuler")}),e.jsxs("button",{onClick:x,disabled:r===0||o,className:"btn btn-primary btn-sm",children:[o?e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin mr-1"}):e.jsx(l.Star,{className:"w-4 h-4 mr-1"}),m("satisfaction.submit","Envoyer")]})]})]}):e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"font-medium flex items-center gap-2",children:[e.jsx(l.Star,{className:"w-4 h-4 text-amber-500"}),m("satisfaction.askTitle","Comment évaluez-vous cette résolution ?")]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mt-1",children:m("satisfaction.askDescription","Votre avis nous aide à améliorer notre service.")})]}),e.jsxs("button",{onClick:c,className:"btn btn-primary btn-sm",children:[e.jsx(l.Star,{className:"w-4 h-4 mr-1"}),m("satisfaction.rateButton","Évaluer")]})]})}function od({show:t,resolution:s,saving:r,onResolutionChange:a,onClose:o,onResolve:c,t:i}){return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50",children:e.jsxs("div",{className:"card w-full max-w-lg p-6 m-4",children:[e.jsx("h2",{className:"text-xl font-bold mb-4",children:i("resolve.title","Proposer une solution")}),e.jsx("textarea",{value:s,onChange:d=>a(d.target.value),placeholder:i("resolve.placeholder","Décrivez la résolution..."),className:"input w-full h-32 mb-4"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:o,className:"btn btn-secondary",children:i("common.cancel","Annuler")}),e.jsxs("button",{onClick:c,disabled:!s.trim()||r,className:"btn btn-primary",children:[r&&e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin mr-2"}),i("resolve.confirm","Proposer")]})]})]})}):null}function id({show:t,filteredUsers:s,selectedUserIds:r,selectedGroupIds:a,groups:o,userSearchQuery:c,groupSearchQuery:i,loadingUsers:d,loadingGroups:u,saving:x,activeTab:m,onUserSearchChange:f,onGroupSearchChange:h,onSelectUser:v,onSelectGroup:g,onTabChange:y,onClose:p,onAssign:b,t:j}){const S=n.useMemo(()=>{if(!i.trim())return o;const w=i.toLowerCase();return o.filter(P=>P.name.toLowerCase().includes(w))},[o,i]);return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50",children:e.jsxs("div",{className:"card w-full max-w-lg p-6 m-4 max-h-[80vh] flex flex-col",children:[e.jsx("h2",{className:"text-xl font-bold mb-4",children:j("assign.title","Assigner le ticket")}),e.jsxs("div",{className:"flex gap-2 mb-4 border-b border-[var(--border-color)]",children:[e.jsx("button",{onClick:()=>y("users"),className:`pb-2 px-3 font-medium transition-colors border-b-2 ${m==="users"?"border-[var(--color-accent-500)] text-[var(--color-accent-500)]":"border-transparent text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:j("assign.tabUsers","Utilisateurs")}),e.jsx("button",{onClick:()=>y("groups"),className:`pb-2 px-3 font-medium transition-colors border-b-2 ${m==="groups"?"border-[var(--color-accent-500)] text-[var(--color-accent-500)]":"border-transparent text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:j("assign.tabGroups","Groupes")})]}),e.jsxs("div",{className:"relative mb-3",children:[e.jsx(l.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-tertiary)]"}),e.jsx("input",{type:"text",value:m==="users"?c:i,onChange:w=>m==="users"?f(w.target.value):h(w.target.value),placeholder:m==="users"?j("assign.searchUserPlaceholder","Rechercher un utilisateur..."):j("assign.searchGroupPlaceholder","Rechercher un groupe..."),className:"input w-full pl-10",autoFocus:!0})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto mb-4",children:[m==="users"&&e.jsx(e.Fragment,{children:d?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--color-primary-600)]"})}):e.jsx("div",{className:"border border-[var(--border-color)] rounded-lg overflow-hidden",children:s.length===0?e.jsx("div",{className:"px-4 py-6 text-center text-sm text-[var(--text-tertiary)]",children:j("assign.noUsersFound","Aucun utilisateur trouvé")}):s.map(w=>e.jsxs("button",{onClick:()=>v(w.id),className:`w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[var(--bg-secondary)] transition-colors border-t border-[var(--border-color)] first:border-t-0 ${r.includes(w.id)?"bg-[var(--color-accent-500)]/10":""}`,children:[e.jsx("div",{className:"w-5 h-5 border-2 border-[var(--border-color)] rounded flex items-center justify-center flex-shrink-0",children:r.includes(w.id)&&e.jsx("div",{className:"w-3 h-3 bg-[var(--color-accent-500)] rounded-sm"})}),e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--color-accent-500)] flex items-center justify-center text-white font-medium text-sm flex-shrink-0",children:w.fullName.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:w.fullName}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)] truncate",children:w.email})]})]},w.id))})}),m==="groups"&&e.jsx(e.Fragment,{children:u?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--color-primary-600)]"})}):e.jsx("div",{className:"border border-[var(--border-color)] rounded-lg overflow-hidden",children:S.length===0?e.jsx("div",{className:"px-4 py-6 text-center text-sm text-[var(--text-tertiary)]",children:j("assign.noGroupsFound","Aucun groupe trouvé")}):S.map(w=>e.jsxs("button",{onClick:()=>g(w.id),className:`w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[var(--bg-secondary)] transition-colors border-t border-[var(--border-color)] first:border-t-0 ${a.includes(w.id)?"bg-[var(--color-accent-500)]/10":""}`,children:[e.jsx("div",{className:"w-5 h-5 border-2 border-[var(--border-color)] rounded flex items-center justify-center flex-shrink-0",children:a.includes(w.id)&&e.jsx("div",{className:"w-3 h-3 bg-[var(--color-accent-500)] rounded-sm"})}),e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--color-accent-500)] flex items-center justify-center text-white font-medium text-sm flex-shrink-0",children:w.name.charAt(0).toUpperCase()}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"font-medium truncate",children:w.name})}),e.jsx("span",{className:"text-xs px-2 py-1 rounded bg-[var(--bg-tertiary)] text-[var(--text-secondary)] flex-shrink-0",children:w.memberCount})]},w.id))})})]}),e.jsx("div",{className:"text-sm text-[var(--text-secondary)] mb-4 px-3 py-2 bg-[var(--bg-secondary)] rounded",children:j("assign.selectedSummary","{{userCount}} utilisateur(s), {{groupCount}} groupe(s) sélectionné(s)",{userCount:r.length,groupCount:a.length})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{p(),f(""),h("")},className:"btn btn-secondary",children:j("common.cancel","Annuler")}),e.jsxs("button",{onClick:b,disabled:x||d||u,className:"btn btn-primary",children:[x&&e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin mr-2"}),j("assign.confirm","Assigner")]})]})]})}):null}const ld=["Supervisor","Manager","Director"];function cd({show:t,escalationLevel:s,escalationReason:r,saving:a,onLevelChange:o,onReasonChange:c,onClose:i,onEscalate:d,t:u}){return t?e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50",children:e.jsxs("div",{className:"card w-full max-w-lg p-6 m-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-[var(--warning-bg)] flex items-center justify-center",children:e.jsx(l.ArrowUpCircle,{className:"w-5 h-5 text-[var(--warning-text)]"})}),e.jsx("h2",{className:"text-xl font-bold",children:u("escalate.title")})]}),e.jsx("p",{className:"text-sm text-[var(--text-secondary)] mb-4",children:u("escalate.description")}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:u("escalate.level")}),e.jsx("div",{className:"space-y-2",children:ld.map(x=>e.jsxs("button",{onClick:()=>o(x),className:`w-full flex items-center gap-3 px-4 py-3 text-left rounded-lg border transition-colors ${s===x?"border-[var(--warning-border)] bg-[var(--warning-bg)]":"border-[var(--border-color)] hover:bg-[var(--bg-secondary)]"}`,children:[e.jsx("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center ${s===x?"border-[var(--warning-text)]":"border-[var(--border-color)]"}`,children:s===x&&e.jsx("div",{className:"w-2 h-2 rounded-full bg-[var(--warning-text)]"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:u(`escalate.levels.${x}`)}),e.jsx("p",{className:"text-xs text-[var(--text-tertiary)]",children:u(`escalate.levels.${x}Desc`)})]})]},x))})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-2",children:u("escalate.reason")}),e.jsx("textarea",{value:r,onChange:x=>c(x.target.value),placeholder:u("escalate.reasonPlaceholder"),className:"input w-full h-24"})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{i(),o("Supervisor"),c("")},className:"btn btn-secondary",children:u("common.cancel")}),e.jsxs("button",{onClick:d,disabled:a,className:"btn border border-[var(--warning-border)] bg-[var(--warning-bg)] text-[var(--warning-text)] hover:bg-[var(--warning-border)]",children:[a&&e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin mr-2"}),e.jsx(l.ArrowUpCircle,{className:"w-4 h-4 mr-2"}),u("escalate.confirm")]})]})]})}):null}function dd(t){return{id:t.id,ticketNumber:t.ticketNumber,title:t.title,description:t.description,type:t.type,status:t.status,priority:t.priority,createdByName:t.createdBy?.fullName,assignedToName:t.assignedTo?.fullName,resolution:t.resolution,resolvedAt:t.resolvedAt,closedAt:t.closedAt,assignees:t.assignees,comments:t.comments.map(s=>({id:s.id,userName:s.userName,content:s.content,isInternal:s.isInternal,isEdited:s.isEdited,createdAt:s.createdAt})),attachments:t.attachments.map(s=>({id:s.id,fileName:s.fileName,contentType:s.contentType,fileSize:s.fileSize,createdAt:s.createdAt})),createdAt:t.createdAt,updatedAt:t.updatedAt,clientContext:t.clientContext,externalProvider:t.externalProvider,externalId:t.externalId,externalUrl:t.externalUrl,isExternallyManaged:t.isExternallyManaged,solutions:t.solutions,activeSolution:t.activeSolution,hasPendingSolution:t.hasPendingSolution}}function ud(t){return{id:t.id,ticketNumber:t.ticketNumber,title:t.title,description:t.description,type:t.type,status:t.status,priority:t.priority,resolution:t.resolution,resolvedAt:t.resolvedAt,closedAt:t.closedAt,comments:t.comments.map(s=>({id:s.id,userName:s.userName,content:s.content,isInternal:!1,isEdited:s.isEdited,createdAt:s.createdAt})),attachments:t.attachments.map(s=>({id:s.id,fileName:s.fileName,fileSize:s.fileSize,createdAt:s.createdAt})),createdAt:t.createdAt,updatedAt:t.updatedAt,solutions:t.solutions,activeSolution:t.activeSolution,hasPendingSolution:t.hasPendingSolution}}function tr(t,s){return s==="support"?dd(t):ud(t)}const md=()=>{const[t,s]=n.useState(null),[r,a]=n.useState(!0),[o,c]=n.useState(!1),[i,d]=n.useState(!1),[u,x]=n.useState(null),[m,f]=n.useState([]),[h,v]=n.useState(!1),[g,y]=n.useState({title:"",priority:"Medium"}),[p,b]=n.useState(!1),[j,S]=n.useState(!1),[w,P]=n.useState(!1),[$,A]=n.useState(""),[k,R]=n.useState("Supervisor"),[L,I]=n.useState(""),[C,O]=n.useState([]),[_,E]=n.useState([]),[z,W]=n.useState([]),[G,J]=n.useState(!1),[pe,q]=n.useState(""),[Y,M]=n.useState(""),[te,oe]=n.useState([]),[le,F]=n.useState(!1),[K,Q]=n.useState("users"),[U,Z]=n.useState(null),[re,de]=n.useState(!1),[he,fe]=n.useState(0),[Ne,Be]=n.useState(""),[Ke,B]=n.useState(!1);return{ticket:t,setTicket:s,loading:r,setLoading:a,saving:o,setSaving:c,uploading:i,setUploading:d,error:u,setError:x,activities:m,setActivities:f,isEditing:h,setIsEditing:v,editForm:g,setEditForm:y,showAssignModal:p,setShowAssignModal:b,showResolveModal:j,setShowResolveModal:S,showEscalateModal:w,setShowEscalateModal:P,resolution:$,setResolution:A,escalationLevel:k,setEscalationLevel:R,escalationReason:L,setEscalationReason:I,users:C,setUsers:O,selectedUserIds:_,setSelectedUserIds:E,selectedGroupIds:z,setSelectedGroupIds:W,loadingUsers:G,setLoadingUsers:J,userSearchQuery:pe,setUserSearchQuery:q,groupSearchQuery:Y,setGroupSearchQuery:M,groups:te,setGroups:oe,loadingGroups:le,setLoadingGroups:F,assignModalTab:K,setAssignModalTab:Q,satisfaction:U,setSatisfaction:Z,showRatingForm:re,setShowRatingForm:de,ratingValue:he,setRatingValue:fe,ratingComment:Ne,setRatingComment:Be,submittingRating:Ke,setSubmittingRating:B}},xd=(t,s)=>t?s?.email||"":(s?.firstName&&s?.lastName?`${s.firstName} ${s.lastName}`:s?.email)||"",pd=(t,s,r)=>{const a=s.get("tab");t==="conversation"?a&&(s.delete("tab"),r(s,{replace:!0})):a!==t&&r({tab:t},{replace:!0})},hd=(t,s)=>{const r=t.get("tab");return r&&s.includes(r)?r:"conversation"};function gd({ticket:t,isSupport:s,isEditing:r,saving:a,editForm:o,error:c,onEditToggle:i,onSave:d,onEditFormChange:u,onErrorClear:x,t:m}){return e.jsxs("div",{className:"flex-shrink-0 border-b border-[var(--border-color)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>window.history.back(),className:"btn btn-ghost p-2",children:e.jsx(l.ArrowLeft,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-mono text-sm text-[var(--text-secondary)]",children:t.ticketNumber}),t.externalId&&t.externalUrl&&e.jsxs("a",{href:t.externalUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--info-bg)] text-[var(--info-text)] border border-[var(--info-border)] hover:opacity-80",children:[e.jsx(l.ExternalLink,{className:"w-3 h-3"}),"GLPI #",t.externalId]}),e.jsx(ss,{status:as[t.status]||"pending",label:t.status}),e.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:er[t.priority]?.bg,color:er[t.priority]?.text},children:t.priority})]}),s&&r?e.jsx("input",{type:"text",value:o.title,onChange:f=>u({...o,title:f.target.value}),className:"input w-full text-lg font-bold"}):e.jsx("h1",{className:"text-lg font-bold truncate",children:t.title})]}),e.jsx("div",{className:"flex items-center gap-2",children:s&&r?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>i(!1),className:"btn btn-ghost p-2",children:e.jsx(l.X,{className:"w-5 h-5"})}),e.jsx("button",{onClick:d,disabled:a,className:"btn btn-primary",children:a?e.jsx(l.Loader2,{className:"w-4 h-4 animate-spin"}):e.jsx(l.Save,{className:"w-4 h-4"})})]}):e.jsx(e.Fragment,{children:s&&!t.isExternallyManaged&&e.jsx("button",{onClick:()=>i(!0),className:"btn btn-ghost p-2",title:"Modifier",children:e.jsx(l.Edit2,{className:"w-5 h-5"})})})})]}),c&&e.jsxs("div",{className:"mt-3 p-3 rounded-lg bg-[var(--error-bg)] text-[var(--error-text)] flex items-center gap-2",children:[e.jsx(l.AlertTriangle,{className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{className:"text-sm flex-1",children:c}),e.jsx("button",{onClick:x,className:"p-1 hover:bg-[var(--error-border)] rounded",children:e.jsx(l.X,{className:"w-4 h-4"})})]}),t.isExternallyManaged&&e.jsxs("div",{className:"mt-3 p-3 rounded-lg bg-[var(--info-bg)] border border-[var(--info-border)] flex items-center gap-3",children:[e.jsx(l.ShieldAlert,{className:"w-5 h-5 text-[var(--info-text)] flex-shrink-0"}),e.jsx("div",{className:"flex-1",children:e.jsx("p",{className:"text-sm font-medium text-[var(--info-text)]",children:m("glpi.readOnlyBanner","This ticket is managed by GLPI and is read-only.")})}),t.externalUrl&&e.jsxs("a",{href:t.externalUrl,target:"_blank",rel:"noopener noreferrer",className:"btn btn-sm bg-[var(--info-bg)] text-[var(--info-text)] border border-[var(--info-border)] hover:opacity-80 flex items-center gap-1.5",children:[e.jsx(l.ExternalLink,{className:"w-4 h-4"}),m("glpi.viewInGlpi","View in GLPI")]})]})]})}function fd({ticket:t,isSupport:s,satisfaction:r,showRatingForm:a,ratingValue:o,ratingComment:c,submittingRating:i,onShowRatingForm:d,onRatingChange:u,onCommentChange:x,onCancelRating:m,onSubmitRating:f,t:h}){return e.jsxs(e.Fragment,{children:[!s&&e.jsx("div",{className:"mt-3 p-3 rounded-lg bg-[var(--bg-secondary)] border border-[var(--border-color)]",children:e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:h(ad[t.status]||"statusDescriptions.InProgress")})}),t.resolution&&e.jsxs("div",{className:"mt-3 p-4 rounded-lg bg-[var(--success-bg)] border border-[var(--success-border)]",children:[e.jsxs("h3",{className:"font-medium flex items-center gap-2 text-[var(--success-text)] mb-1",children:[e.jsx(l.CheckCircle,{className:"w-4 h-4"}),h("resolution.title","Résolution")]}),e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.resolution})]}),!s&&(t.status==="Resolved"||t.status==="Closed")&&e.jsx("div",{className:"mt-3 p-4 rounded-lg bg-[var(--bg-secondary)] border border-[var(--border-color)]",children:e.jsx(nd,{satisfaction:r,showRatingForm:a,ratingValue:o,ratingComment:c,submittingRating:i,onShowForm:d,onRatingChange:u,onCommentChange:x,onCancel:m,onSubmit:f,t:h})})]})}function bd({activeTab:t,commentCount:s,isSupport:r,assigneeCount:a,onTabChange:o,t:c}){const i=[{id:"conversation",icon:l.MessageSquare,label:c("tabs.conversation"),badge:s},{id:"description",icon:l.FileText,label:c("tabs.description"),badge:0},{id:"information",icon:l.Info,label:c("tabs.information"),badge:0},...r?[{id:"assignment",icon:l.Users,label:c("tabs.assignment"),badge:a},{id:"ai",icon:l.Sparkles,label:c("tabs.ai"),badge:0}]:[]];return e.jsx("div",{className:"flex-shrink-0 flex border-b border-[var(--border-color)] bg-[var(--bg-card)]",children:i.map(({id:d,icon:u,label:x,badge:m})=>e.jsxs("button",{onClick:()=>o(d),className:`flex items-center gap-2 px-4 py-2.5 text-sm font-medium transition-colors border-b-2 ${t===d?"border-[var(--color-accent-600)] text-[var(--color-accent-600)]":"border-transparent text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--border-color)]"}`,children:[e.jsx(u,{className:"w-4 h-4"}),x,m>0&&e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded-full bg-[var(--bg-tertiary)] text-[var(--text-secondary)]",children:m})]},d))})}function vd({activeTab:t,ticket:s,activities:r,isSupport:a,isClosed:o,isReadOnly:c,isConnected:i,currentUserName:d,saving:u,uploading:x,onAddComment:m,onDownloadAttachment:f,onUploadAttachment:h,onStatusChange:v,onAssign:g,onResolve:y,onClose:p,onReopen:b,onEscalate:j,getAttachmentUrl:S,onProposeSolution:w,onApproveSolution:P,onRejectSolution:$,t:A}){if(t==="description")return e.jsx("div",{className:"h-full overflow-y-auto p-6 bg-[var(--bg-primary)]",children:s.description?e.jsx("div",{className:"prose prose-sm max-w-none text-[var(--text-primary)] leading-relaxed [&_a]:text-[var(--color-accent-600)] [&_a]:underline",dangerouslySetInnerHTML:{__html:Fa.sanitize(s.description)}}):e.jsx("p",{className:"text-[var(--text-tertiary)] italic",children:A("tabs.noDescription")})});if(t==="conversation"){const k=n.useMemo(()=>{if(s)return{ticketNumber:s.ticketNumber??"",ticketTitle:s.title??"",userName:s.createdBy?.fullName??"",userFirstName:s.createdBy?.fullName?.split(" ")[0]??"",userLastName:s.createdBy?.fullName?.split(" ").slice(1).join(" ")??"",userEmail:s.createdBy?.email??"",priority:s.priority??"",type:s.type??"",status:s.status??"",agentName:s.assignedTo?.fullName??"",agentFirstName:s.assignedTo?.fullName?.split(" ")[0]??"",createdAt:s.createdAt?new Date(s.createdAt).toLocaleDateString():"",resolvedAt:s.resolvedAt?new Date(s.resolvedAt).toLocaleDateString():"",resolution:s.resolution??""}},[s]);return e.jsxs("div",{className:"h-full flex flex-col",children:[(s.activeSolution||s.hasPendingSolution||a&&!o&&s.status!=="Closed")&&e.jsx("div",{className:"p-4 border-b border-[var(--border-color)]",children:e.jsx(Yc,{ticketId:s.id,solutions:s.solutions??[],activeSolution:s.activeSolution,mode:a?"support":"client",onProposeSolution:!c&&a?w:void 0,onApproveSolution:c?void 0:P,onRejectSolution:c?void 0:$,isLoading:u})}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(pa,{ticketId:s.id,comments:s.comments,activities:r.map(R=>({id:R.id,action:R.action,oldValue:R.oldValue??null,newValue:R.newValue??null,changedByUserName:"changedByUserName"in R?R.changedByUserName:null,createdAt:R.createdAt})),attachments:s.attachments,isSupport:a,isClosed:o||c,isConnected:i,currentUserName:d,ticketVariables:k,onAddComment:m,onDownloadAttachment:f,getAttachmentUrl:S})})]})}return t==="assignment"?e.jsx(yd,{ticket:s,isReadOnly:c,onAssign:g,t:A}):t==="ai"?e.jsx(wd,{ticket:s,t:A}):e.jsx("div",{className:"h-full overflow-y-auto",children:e.jsx("div",{className:"space-y-6 p-6",children:e.jsx(ha,{ticket:s,attachments:s.attachments,activities:r.map(k=>({action:k.action,newValue:k.newValue,createdAt:k.createdAt})),isSupport:a,saving:u,uploading:x,isReadOnly:c,layout:"grid",onAssign:c?void 0:g,onStatusChange:c?void 0:v,onResolve:c?void 0:y,onCloseTicket:c?void 0:p,onReopen:c?void 0:b,onEscalate:c?void 0:j,onDownloadAttachment:f,onUploadAttachment:c?void 0:h,getAttachmentUrl:S})})})}function yd({ticket:t,isReadOnly:s,onAssign:r,t:a}){const[o,c]=n.useState([]),[i,d]=n.useState(!1);n.useEffect(()=>{t?.id&&(d(!0),ed.getByTicket(t.id).then(x=>c(x)).catch(()=>c([])).finally(()=>d(!1)))},[t?.id]);const u=t.assignees??[];return e.jsx("div",{className:"h-full overflow-y-auto p-6",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"font-semibold text-sm text-[var(--text-primary)]",children:a("tabs.assignmentCurrentAssignees")}),!s&&e.jsx("button",{onClick:r,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--color-accent-600)] text-white hover:bg-[var(--color-accent-700)] transition-colors",children:a("tabs.assignmentAssign")})]}),u.length===0?e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] italic",children:a("tabs.assignmentNoAssignees")}):e.jsx("div",{className:"space-y-2",children:u.map(x=>e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-md bg-[var(--bg-secondary)]",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-[var(--color-accent-100)] text-[var(--color-accent-700)] flex items-center justify-center text-xs font-medium",children:(x.fullName||x.email||"?").charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-[var(--text-primary)] truncate",children:x.fullName||x.email}),x.assignedViaGroupName&&e.jsx("div",{className:"text-xs text-[var(--text-tertiary)]",children:a("tabs.assignmentViaGroup",{group:x.assignedViaGroupName})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[x.isPrimary&&e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-[var(--info-bg)] text-[var(--info-text)]",children:a("tabs.assignmentPrimary")}),x.assignedAt&&e.jsx("span",{className:"text-xs text-[var(--text-tertiary)]",children:new Date(x.assignedAt).toLocaleDateString()})]})]},x.userId))})]}),e.jsxs("div",{className:"card p-4",children:[e.jsx("h3",{className:"font-semibold text-sm text-[var(--text-primary)] mb-4",children:a("tabs.assignmentLogs")}),i?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(l.Loader2,{className:"w-5 h-5 animate-spin text-[var(--text-tertiary)]"})}):o.length===0?e.jsx("p",{className:"text-sm text-[var(--text-tertiary)] italic",children:a("tabs.assignmentNoLogs")}):e.jsx("div",{className:"space-y-2",children:o.map(x=>e.jsxs("div",{className:"flex items-start gap-3 p-2 rounded-md border border-[var(--border-color)] bg-[var(--bg-primary)]",children:[e.jsx("div",{className:`mt-0.5 w-2 h-2 rounded-full flex-shrink-0 ${x.success?"bg-[var(--success-text)]":"bg-[var(--error-text)]"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-sm text-[var(--text-primary)]",children:[e.jsx("span",{className:"font-medium",children:x.strategyUsed}),x.reason&&e.jsxs("span",{className:"text-[var(--text-secondary)]",children:[" — ",x.reason]})]}),e.jsx("div",{className:"text-xs text-[var(--text-tertiary)] mt-0.5",children:new Date(x.createdAt).toLocaleString()})]}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${x.success?"bg-[var(--success-bg)] text-[var(--success-text)]":"bg-[var(--error-bg)] text-[var(--error-text)]"}`,children:x.success?a("tabs.assignmentSuccess"):a("tabs.assignmentFailed")})]},x.id))})]})]})})}const jd=12e4;function sr(t){const s=sessionStorage.getItem(t);return s?Date.now()-Number(s)>jd?(sessionStorage.removeItem(t),!1):!0:!1}function wd({ticket:t,t:s}){const[r,a]=n.useState(null),[o,c]=n.useState(!0),i=`ai_routing_${t.id}`,d=`ai_summary_${t.id}`,[u,x]=n.useState(()=>sr(i)),[m,f]=n.useState(()=>sr(d));n.useEffect(()=>{let p=!1;return(async()=>{try{const{cachedAiApi:j}=await Promise.resolve().then(()=>Zs),S=await j.getCached(t.id);p||(a(S),S.routingSuggestion&&(sessionStorage.removeItem(i),x(!1)),S.summary&&(sessionStorage.removeItem(d),f(!1)))}catch{}finally{p||c(!1)}})(),()=>{p=!0}},[t.id,i,d]),n.useEffect(()=>{if(!u&&!m)return;let p=!1;const j=setInterval(async()=>{try{const{cachedAiApi:S}=await Promise.resolve().then(()=>Zs),w=await S.getCached(t.id);if(p)return;a(w),u&&w.routingSuggestion&&(sessionStorage.removeItem(i),x(!1)),m&&w.summary&&(sessionStorage.removeItem(d),f(!1))}catch{}},3e3);return()=>{p=!0,clearInterval(j)}},[u,m,t.id,i,d]);const h=n.useCallback(()=>{sessionStorage.setItem(i,Date.now().toString()),x(!0)},[i]),v=n.useCallback(()=>{sessionStorage.removeItem(i),x(!1)},[i]),g=n.useCallback(()=>{sessionStorage.setItem(d,Date.now().toString()),f(!0)},[d]),y=n.useCallback(()=>{sessionStorage.removeItem(d),f(!1)},[d]);return o?e.jsx("div",{className:"h-full overflow-y-auto p-6 flex items-center justify-center",children:e.jsx(l.Loader2,{className:"w-6 h-6 animate-spin text-[var(--color-primary-600)]"})}):e.jsx("div",{className:"h-full overflow-y-auto p-6",children:e.jsxs("div",{className:"space-y-4",children:[(t.aiClassification||r?.classification)&&e.jsxs("div",{className:"card p-4",children:[e.jsx("h3",{className:"font-semibold text-sm mb-3 text-[var(--text-primary)]",children:s("aiClassification.title")}),e.jsx(va,{classification:t.aiClassification||r?.classification})]}),e.jsx(Qc,{ticketId:t.id,cachedClassification:r?.classification,cachedRouting:r?.routingSuggestion,cachedGeneratedAt:r?.routingSuggestionGeneratedAt,processing:u,onProcessingStart:h,onProcessingEnd:v}),e.jsx(Zc,{ticketId:t.id,cachedSummary:r?.summary,cachedGeneratedAt:r?.summaryGeneratedAt,processing:m,onProcessingStart:g,onProcessingEnd:y})]})})}function Nd({mode:t}){const{id:s}=N.useParams(),r=N.useNavigate(),{t:a}=ne.useTranslation("support"),{user:o}=Ae(),[c,i]=N.useSearchParams(),{isGlpi:d}=ja(),u=t==="support",x=xd(u,o),[m,f]=n.useState(()=>hd(c,rd));n.useEffect(()=>{pd(m,c,i)},[m,c,i]);const{ticket:h,setTicket:v,loading:g,setLoading:y,saving:p,setSaving:b,uploading:j,setUploading:S,error:w,setError:P,activities:$,setActivities:A,isEditing:k,setIsEditing:R,editForm:L,setEditForm:I,showAssignModal:C,setShowAssignModal:O,showResolveModal:_,setShowResolveModal:E,showEscalateModal:z,setShowEscalateModal:W,resolution:G,setResolution:J,escalationLevel:pe,setEscalationLevel:q,escalationReason:Y,setEscalationReason:M,users:te,setUsers:oe,selectedUserIds:le,setSelectedUserIds:F,selectedGroupIds:K,setSelectedGroupIds:Q,loadingUsers:U,setLoadingUsers:Z,userSearchQuery:re,setUserSearchQuery:de,groupSearchQuery:he,setGroupSearchQuery:fe,groups:Ne,setGroups:Be,loadingGroups:Ke,setLoadingGroups:B,assignModalTab:H,setAssignModalTab:X,satisfaction:se,setSatisfaction:ee,showRatingForm:ue,setShowRatingForm:ae,ratingValue:ve,setRatingValue:be,ratingComment:$e,setRatingComment:Me,submittingRating:Le,setSubmittingRating:Fe}=md(),Qe=n.useCallback(async()=>{if(s)try{const V=u?await ye.tickets.getActivities(s,50):await qe.getActivities(s,50);A(V)}catch(V){console.error("Failed to load activities",V)}},[s,u]),He=n.useCallback(async()=>{if(!(!s||u))try{const V=await qe.getSatisfaction(s);ee(V)}catch(V){console.error("Failed to load satisfaction",V)}},[s,u]),Ce=n.useCallback(async()=>{if(s)try{if(y(!0),P(null),u){const V=await ye.tickets.getById(s);if(!V){v(null);return}v(tr(V,t)),I({title:V.title,priority:V.priority})}else{const V=await qe.getById(s);if(!V){v(null);return}v(tr(V,t)),He()}Qe()}catch(V){P(a("error.loadFailed","Impossible de charger le ticket")),console.error(V)}finally{y(!1)}},[s,u,t,Qe,He,a]),T=n.useCallback(V=>{if(V.ticketId===s){if(!u&&V.isInternal)return;v(me=>!me||me.comments.some(Se=>Se.id===V.id)?me:{...me,comments:[...me.comments,{id:V.id,userName:V.userName,content:V.content,isInternal:V.isInternal,isEdited:V.isEdited,createdAt:V.createdAt}]})}},[s,u]),ce=n.useCallback(V=>{V.ticketId===s&&Ce()},[s,Ce]),{isConnected:we}=Vr({ticketId:s,onCommentAdded:T,onTicketUpdated:ce});n.useEffect(()=>{Ce()},[Ce]),n.useEffect(()=>{(async()=>{if(!(!C||te.length>0||!u))try{Z(!0);const me=await D.get("/api/administration/users");oe(me.items.map(Se=>({id:Se.id,email:Se.email,fullName:`${Se.firstName} ${Se.lastName}`}))),h?.assignees&&h.assignees.length>0&&F(h.assignees.map(Se=>Se.userId))}catch(me){console.error("Failed to load users",me)}finally{Z(!1)}})()},[C,te.length,u,h?.assignees]),n.useEffect(()=>{(async()=>{if(!(!C||!u))try{B(!0);const me=await sd.getAll();Be(me.map(Se=>({id:Se.id,name:Se.name,memberCount:Se.memberCount})))}catch(me){console.error("Failed to load groups",me)}finally{B(!1)}})()},[C,u]);const ke=async()=>{if(!(!s||!u))try{b(!0),await ye.tickets.update(s,{title:L.title,priority:L.priority,description:h?.description||""}),await Ce(),R(!1)}catch{P(a("error.updateFailed","Impossible de mettre à jour le ticket"))}finally{b(!1)}},De=async V=>{if(!(!s||!u))try{b(!0),await ye.tickets.updateStatus(s,V),await Ce()}catch{P(a("error.statusFailed","Impossible de changer le statut"))}finally{b(!1)}},pt=async()=>{if(!(!s||!u))try{b(!0),await ye.tickets.assign(s,le.length>0?le[0]:null,le.length>0?le:void 0,K.length>0?K:void 0),await Ce(),O(!1),F([]),Q([]),X("users")}catch{P(a("error.assignFailed","Impossible d'assigner le ticket"))}finally{b(!1)}},tt=async()=>{if(!(!s||!G.trim()||!u))try{b(!0),await ye.tickets.proposeSolution(s,G),await Ce(),E(!1),J("")}catch{P(a("error.resolveFailed","Impossible de proposer une solution"))}finally{b(!1)}},wa=async V=>{if(s)try{b(!0),u&&await ye.tickets.proposeSolution(s,V),await Ce()}catch{P(a("error.resolveFailed","Impossible de proposer une solution"))}finally{b(!1)}},Na=async()=>{if(s)try{b(!0),u?await ye.tickets.approveSolution(s):await qe.approveSolution(s),await Ce()}catch{P(a("error.approveFailed","Impossible d'approuver la solution"))}finally{b(!1)}},Sa=async V=>{if(s)try{b(!0),u?await ye.tickets.rejectSolution(s,V):await qe.rejectSolution(s,V),await Ce()}catch{P(a("error.rejectFailed","Impossible de rejeter la solution"))}finally{b(!1)}},vs=async()=>{if(!(!s||!u))try{b(!0),await ye.tickets.close(s),await Ce()}catch{P(a("error.closeFailed","Impossible de fermer le ticket"))}finally{b(!1)}},ys=async()=>{if(!(!s||!u))try{b(!0),await ye.tickets.reopen(s),await Ce()}catch{P(a("error.reopenFailed","Impossible de réouvrir le ticket"))}finally{b(!1)}},Ca=async()=>{if(!(!s||!u||!pe))try{b(!0),await yo.escalateTicket(s,pe,Y||void 0),await Ce(),W(!1),q("Supervisor"),M("")}catch{P(a("error.escalateFailed","Failed to escalate ticket"))}finally{b(!1)}},ka=async(V,me)=>{!s||!V.trim()||(u?await ye.tickets.addComment(s,{content:V,isInternal:me}):await qe.addComment(s,V),await Ce())},Aa=async()=>{if(!(!s||ve===0||u))try{Fe(!0);const V=await qe.submitSatisfaction(s,{rating:ve,comment:$e.trim()||void 0});ee(V),ae(!1),be(0),Me("")}catch(V){const me=V instanceof Error?V.message:a("error.ratingFailed","Failed to submit rating");P(me)}finally{Fe(!1)}},Ra=async V=>{if(s)try{const me=u?await ye.tickets.downloadAttachment(s,V.id):await qe.downloadAttachment(s,V.id),Se=window.URL.createObjectURL(me),ht=document.createElement("a");ht.href=Se,ht.setAttribute("download",V.fileName),document.body.appendChild(ht),ht.click(),ht.remove(),window.URL.revokeObjectURL(Se)}catch{P(a("error.downloadFailed","Impossible de télécharger le fichier"))}},Pa=async V=>{if(!(!s||!u))try{S(!0),await ye.tickets.uploadAttachment(s,V),await Ce()}catch(me){throw P(a("error.uploadFailed","Failed to upload file")),me}finally{S(!1)}},Ta=V=>s?u?ye.tickets.getAttachmentUrl(s,V.id):`/api/support/my-tickets/${s}/attachments/${V.id}`:"",Ea=n.useMemo(()=>{if(!re.trim())return te;const V=re.toLowerCase();return te.filter(me=>me.fullName.toLowerCase().includes(V)||me.email.toLowerCase().includes(V))},[te,re]),$a=n.useCallback(V=>{F(me=>me.includes(V)?me.filter(Se=>Se!==V):[...me,V])},[]),Ia=n.useCallback(V=>{Q(me=>me.includes(V)?me.filter(Se=>Se!==V):[...me,V])},[]);if(g)return e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-[var(--color-primary-600)]"})});if(!h)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[e.jsx(l.AlertTriangle,{className:"w-12 h-12 mb-4 text-[var(--text-tertiary)]"}),e.jsx("p",{className:"text-[var(--text-secondary)] mb-4",children:a("error.notFound","Ticket non trouvé")}),e.jsx("button",{onClick:()=>r(-1),className:"btn btn-secondary",children:a("common.goBack","Retour")})]});const La=h.status==="Closed"||h.status==="Rejected",Ze=d||!!h.isExternallyManaged;return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(gd,{ticket:h,isSupport:u,isEditing:k,saving:p,editForm:L,error:w,onEditToggle:R,onSave:ke,onEditFormChange:I,onErrorClear:()=>P(null),t:a}),e.jsxs("div",{className:"flex-shrink-0",children:[e.jsx(fd,{ticket:h,isSupport:u,satisfaction:se,showRatingForm:ue,ratingValue:ve,ratingComment:$e,submittingRating:Le,onShowRatingForm:()=>ae(!0),onRatingChange:be,onCommentChange:Me,onCancelRating:()=>{ae(!1),be(0),Me("")},onSubmitRating:Aa,t:a}),e.jsx(Xc,{currentStatus:h.status,createdAt:h.createdAt,resolvedAt:h.resolvedAt,closedAt:h.closedAt,activities:$.map(V=>({action:V.action,newValue:V.newValue,createdAt:V.createdAt})),isSupport:u,saving:p,assignees:h.assignees,onAssign:Ze?void 0:()=>O(!0),onStatusChange:Ze?void 0:De,onResolve:Ze?void 0:()=>E(!0),onCloseTicket:Ze?void 0:vs,onReopen:Ze?void 0:ys,onEscalate:Ze?void 0:()=>W(!0)})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsx(bd,{activeTab:m,commentCount:h.comments.length,isSupport:u,assigneeCount:h.assignees?.length??0,onTabChange:f,t:a}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(vd,{activeTab:m,ticket:h,activities:$,isSupport:u,isClosed:La,isReadOnly:Ze,isConnected:we,currentUserName:x,saving:p,uploading:j,onAddComment:ka,onDownloadAttachment:Ra,onUploadAttachment:Pa,onStatusChange:De,onAssign:()=>O(!0),onResolve:()=>E(!0),onClose:vs,onReopen:ys,onEscalate:()=>W(!0),getAttachmentUrl:Ta,onProposeSolution:wa,onApproveSolution:Na,onRejectSolution:Sa,t:a})})]}),e.jsx(od,{show:u&&_,resolution:G,saving:p,onResolutionChange:J,onClose:()=>E(!1),onResolve:tt,t:a}),e.jsx(id,{show:u&&C,filteredUsers:Ea,selectedUserIds:le,selectedGroupIds:K,groups:Ne,userSearchQuery:re,groupSearchQuery:he,loadingUsers:U,loadingGroups:Ke,saving:p,activeTab:H,onUserSearchChange:de,onGroupSearchChange:fe,onSelectUser:$a,onSelectGroup:Ia,onTabChange:X,onClose:()=>{O(!1),F([]),Q([]),X("users"),de(""),fe("")},onAssign:pt,t:a}),e.jsx(cd,{show:u&&z,escalationLevel:pe,escalationReason:Y,saving:p,onLevelChange:q,onReasonChange:M,onClose:()=>W(!1),onEscalate:Ca,t:a})]})}const rr="support_tickets_view_mode",Sd={Open:["InProgress","OnHold","Rejected"],InProgress:["OnHold","Resolved","Rejected"],OnHold:["InProgress","Resolved","Open"],Resolved:["Closed","Open"],Closed:["Open"],Rejected:["Open"]};function ar(t,s){return t===s?!1:Sd[t]?.includes(s)??!1}const Yt={Low:"var(--info-bg)",Medium:"var(--warning-bg)",High:"var(--error-bg)",Critical:"var(--error-text)"};function Cd({mode:t,showDrafts:s=!1,basePath:r,title:a,subtitle:o,createPath:c}){const{t:i}=ne.useTranslation(["support","admin","common"]),d=N.useNavigate(),{currentTenant:u,userTenants:x,hasMultipleTenants:m,isGlobalView:f}=Ee(),{isGlpi:h}=ja(),[v,g]=n.useState([]),[y,p]=n.useState(null),[b,j]=n.useState(!0),[S,w]=n.useState(1),[P,$]=n.useState(1),[A,k]=n.useState(0),[R,L]=n.useState(""),[I,C]=n.useState(""),[O,_]=n.useState(""),[E,z]=n.useState(""),[W,G]=n.useState(""),[J,pe]=n.useState(()=>localStorage.getItem(rr)||"table"),[q,Y]=n.useState(!1),[M,te]=n.useState([]),[oe,le]=n.useState(!0),[F,K]=n.useState(null),[Q,U]=n.useState(null),[Z,re]=n.useState(null),de=(t==="admin"||t==="assigned")&&(m||f),he=n.useCallback(async()=>{try{j(!0);const T={page:S,pageSize:20,search:R||void 0,status:I||void 0,type:O||void 0,priority:E||void 0,tenantId:W||void 0};let ce;t==="admin"?ce=await ye.tickets.getAll(T):t==="assigned"?ce=await ye.tickets.getMyTickets(T):ce=await qe.getAll(T),g(ce?.items??[]),$(ce?.totalPages??1),k(ce?.totalCount??0)}catch(T){console.error("Failed to load tickets:",T),g([]),$(1),k(0)}finally{j(!1)}},[t,S,R,I,O,E,W]),fe=n.useCallback(async()=>{try{let T;t==="admin"?T=await ye.tickets.getStats(W||void 0):t==="assigned"?T=await ye.tickets.getMyAssignedStats():T=await qe.getStats(),p(T)}catch(T){console.error("Failed to load stats:",T)}},[t,W]);n.useEffect(()=>{he()},[he]),n.useEffect(()=>{fe()},[fe]),n.useEffect(()=>{if(s){const T=Xe.getAllDrafts();te(T)}},[s]),n.useEffect(()=>{localStorage.setItem(rr,J)},[J]);const Ne=T=>{Xe.deleteDraft(T),te(Xe.getAllDrafts())},Be=T=>{d(`${c}?draft=${T.id}`)},Ke=T=>{const we=new Date().getTime()-T.getTime(),ke=Math.floor(we/6e4),De=Math.floor(we/36e5),pt=Math.floor(we/864e5);return ke<1?i("common:time.justNow","Just now"):ke<60?i("common:time.minutesAgo",{count:ke}):De<24?i("common:time.hoursAgo",{count:De}):i("common:time.daysAgo",{count:pt})},B=T=>{T.preventDefault(),w(1),he()},H=T=>{h||K(T)},X=()=>{K(null),U(null)},se=(T,ce)=>{T.preventDefault(),U(ce)},ee=()=>{U(null)},ue=T=>F?ar(F.status,T):!1,ae=async(T,ce)=>{if(T.preventDefault(),re(null),!F||F.status===ce){K(null),U(null);return}if(!ar(F.status,ce)){re(i("list.invalidTransition",{from:i(`tickets.statuses.${F.status}`),to:i(`tickets.statuses.${ce}`)})),K(null),U(null),setTimeout(()=>re(null),4e3);return}try{g(we=>we.map(ke=>ke.id===F.id?{...ke,status:ce}:ke)),(t==="admin"||t==="assigned")&&await ye.tickets.updateStatus(F.id,ce),fe(),he()}catch(we){console.error("Failed to update ticket status:",we);const ke=we?.response?.data?.message||we?.response?.data?.detail||"";re(ke||i("list.statusUpdateFailed")),setTimeout(()=>re(null),4e3),he()}finally{K(null),U(null)}},ve=async T=>{if(confirm(i("list.confirmDelete",{number:T.ticketNumber})))try{await ye.tickets.delete(T.id),he(),fe()}catch(ce){console.error("Failed to delete ticket:",ce)}},be=T=>`${r}/${T}`,$e=T=>{if(!de)return null;const ce="tenantId"in T?T.tenantId??null:null,we="tenantName"in T?T.tenantName??null:null,ke=Qr(ce,u?.id??null);return ke==="global"?e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 border border-purple-200 dark:border-purple-700",children:"System"}):ke==="current"?e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-[var(--bg-secondary)] text-[var(--text-secondary)] border border-[var(--border-color)] truncate max-w-[120px]",children:we}):e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 border border-blue-200 dark:border-blue-700 font-medium truncate max-w-[120px]",children:we})},Me=()=>{if(!y)return null;const T=y,ce=y,we=t==="admin"||t==="assigned",ke=we?[{label:i("list.stats.total"),value:T.total,color:"blue"},{label:i("list.stats.open"),value:T.open,color:"yellow"},{label:i("list.stats.inProgress"),value:T.inProgress,color:"blue"},{label:i("list.stats.onHold"),value:T.onHold,color:"yellow"},{label:i("list.stats.resolved"),value:T.resolved,color:"green"},{label:i("list.stats.closed"),value:T.closed,color:"neutral"},{label:i("list.stats.critical"),value:T.critical,color:"red"},{label:i("list.stats.highPriority"),value:T.highPriority,color:"yellow"}]:[{label:i("list.stats.total"),value:ce.total,color:"blue"},{label:i("list.stats.open"),value:ce.open,color:"yellow"},{label:i("list.stats.inProgress"),value:ce.inProgress,color:"blue"},{label:i("list.stats.resolved"),value:ce.resolved,color:"green"},{label:i("list.stats.closed"),value:ce.closed,color:"neutral"}],De={blue:"bg-[var(--info-bg)] text-[var(--info-text)] border-[var(--info-border)]",green:"bg-[var(--success-bg)] text-[var(--success-text)] border-[var(--success-border)]",yellow:"bg-[var(--warning-bg)] text-[var(--warning-text)] border-[var(--warning-border)]",red:"bg-[var(--error-bg)] text-[var(--error-text)] border-[var(--error-border)]",neutral:"bg-[var(--bg-secondary)] text-[var(--text-primary)] border-[var(--border-color)]"},pt=we?"lg:grid-cols-8":"lg:grid-cols-5";return e.jsx("div",{className:`grid grid-cols-2 md:grid-cols-4 ${pt} gap-4 mb-6`,children:ke.map(tt=>e.jsxs("div",{className:`card p-4 text-center border ${De[tt.color]}`,children:[e.jsx("div",{className:"text-2xl font-bold",children:tt.value}),e.jsx("div",{className:"text-sm opacity-80",children:tt.label})]},tt.label))})},Le=()=>e.jsxs("div",{className:"card overflow-hidden",children:[e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-color)]",children:[e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.number")}),de&&e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.tenant","Workspace")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.title")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.type")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.status")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.priority")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.assignee")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.comments")}),e.jsx("th",{className:"text-left p-4 font-medium",children:i("list.table.created")}),e.jsx("th",{className:"text-right p-4 font-medium",children:i("list.table.actions")})]})}),e.jsx("tbody",{children:v.map(T=>e.jsxs("tr",{className:"border-b border-[var(--border-color)] hover:bg-[var(--bg-hover)] cursor-pointer",onClick:()=>d(be(T.id)),children:[e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"font-mono text-sm",children:T.ticketNumber})}),de&&e.jsx("td",{className:"p-4",children:$e(T)}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-medium",children:T.title}),T.isExternallyManaged&&e.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--info-bg)] text-[var(--info-text)] border border-[var(--info-border)]",children:"GLPI"})]})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"text-sm",children:i(`tickets.types.${T.type}`,{defaultValue:T.type})})}),e.jsx("td",{className:"p-4",children:e.jsx(ss,{status:as[T.status]||"pending",label:i(`tickets.statuses.${T.status}`,{defaultValue:T.status})})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"px-2 py-1 rounded-[var(--radius-badge)] text-xs font-medium",style:{backgroundColor:Yt[T.priority],color:T.priority==="Critical"?"white":"inherit"},children:i(`tickets.priorities.${T.priority}`,{defaultValue:T.priority})})}),e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm",children:"assignedToName"in T&&T.assignedToName||"-"}),"assigneeCount"in T&&T.assigneeCount>1&&e.jsxs("span",{className:"ml-1 text-xs px-1.5 py-0.5 rounded-full bg-[var(--bg-tertiary)] text-[var(--text-secondary)]",children:["+",T.assigneeCount-1]})]})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"text-sm",children:T.commentCount})}),e.jsx("td",{className:"p-4",children:e.jsx("span",{className:"text-sm text-[var(--text-secondary)]",children:new Date(T.createdAt).toLocaleDateString()})}),e.jsx("td",{className:"p-4 text-right",onClick:ce=>ce.stopPropagation(),children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("button",{onClick:()=>d(be(T.id)),className:"btn btn-ghost p-2",title:i("list.actions.view"),children:e.jsx(l.Eye,{className:"w-4 h-4"})}),T.externalUrl&&e.jsx("a",{href:T.externalUrl,target:"_blank",rel:"noopener noreferrer",className:"btn btn-ghost p-2 text-[var(--info-text)]",title:"Open in GLPI",onClick:ce=>ce.stopPropagation(),children:e.jsx(l.ExternalLink,{className:"w-4 h-4"})}),t==="admin"&&!h&&e.jsx("button",{onClick:()=>ve(T),disabled:T.isExternallyManaged,className:"btn btn-ghost p-2 text-[var(--error-text)] disabled:opacity-50 disabled:cursor-not-allowed",title:T.isExternallyManaged?"Cannot delete externally managed tickets":i("list.actions.delete"),children:e.jsx(l.Trash2,{className:"w-4 h-4"})})]})})]},T.id))})]}),v.length===0&&!b&&e.jsxs("div",{className:"p-8 text-center text-[var(--text-secondary)]",children:[e.jsx(l.Headphones,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsxs("p",{children:[t==="admin"&&i("list.empty.admin"),t==="assigned"&&i("list.empty.assigned"),t==="user"&&i("list.empty.user")]}),t==="user"&&!h&&e.jsxs("button",{onClick:()=>d(c),className:"btn btn-primary mt-4",children:[e.jsx(l.Plus,{className:"w-4 h-4 mr-2"}),i("list.empty.createFirst")]})]})]}),Fe=()=>e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[v.map(T=>e.jsxs("div",{className:"card p-4 hover:shadow-lg cursor-pointer transition-shadow",onClick:()=>d(be(T.id)),children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-sm text-[var(--text-secondary)]",children:T.ticketNumber}),$e(T)]}),e.jsx(ss,{status:as[T.status]||"pending",label:i(`tickets.statuses.${T.status}`,{defaultValue:T.status})})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"font-medium line-clamp-2 flex-1",children:T.title}),T.isExternallyManaged&&e.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--info-bg)] text-[var(--info-text)] border border-[var(--info-border)] whitespace-nowrap",children:"GLPI"})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:"text-xs px-2 py-1 rounded-[var(--radius-badge)] bg-[var(--bg-secondary)]",children:i(`tickets.types.${T.type}`,{defaultValue:T.type})}),e.jsx("span",{className:"text-xs px-2 py-1 rounded-[var(--radius-badge)]",style:{backgroundColor:Yt[T.priority],color:T.priority==="Critical"?"white":"inherit"},children:i(`tickets.priorities.${T.priority}`,{defaultValue:T.priority})})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm text-[var(--text-secondary)]",children:[e.jsx("span",{children:new Date(T.createdAt).toLocaleDateString()}),e.jsx("span",{children:i("list.comments_other",{count:T.commentCount})})]})]},T.id)),v.length===0&&!b&&e.jsxs("div",{className:"col-span-full card p-12 text-center",children:[e.jsx(l.Headphones,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsxs("p",{className:"text-[var(--text-secondary)]",children:[t==="admin"&&i("list.empty.admin"),t==="assigned"&&i("list.empty.assigned"),t==="user"&&i("list.empty.user")]}),t==="user"&&!h&&e.jsxs("button",{onClick:()=>d(c),className:"btn btn-primary mt-4",children:[e.jsx(l.Plus,{className:"w-4 h-4 mr-2"}),i("list.empty.createFirst")]})]})]}),Qe=T=>e.jsxs(Zo,{onClick:()=>d(be(T.id)),isDragging:F?.id===T.id,onDragStart:()=>H(T),onDragEnd:X,children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-[var(--text-secondary)] mb-1",children:[e.jsx("span",{children:T.ticketNumber}),$e(T)]}),e.jsx("div",{className:"font-medium mb-2 line-clamp-2",children:T.title}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-[var(--radius-badge)]",style:{backgroundColor:Yt[T.priority],color:T.priority==="Critical"?"white":"inherit"},children:i(`tickets.priorities.${T.priority}`,{defaultValue:T.priority})}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:i("list.comments_other",{count:T.commentCount})})]})]},T.id),He=()=>{const T=[{status:"Open",label:i("tickets.statuses.Open"),color:"warning"},{status:"InProgress",label:i("tickets.statuses.InProgress"),color:"default"},{status:"OnHold",label:i("tickets.statuses.OnHold"),color:"warning"},{status:"Resolved",label:i("tickets.statuses.Resolved"),color:"success"},{status:"Closed",label:i("tickets.statuses.Closed"),color:"default"}];return e.jsxs("div",{className:"space-y-3",children:[Z&&e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-[var(--radius-card)] bg-[var(--error-bg)] border border-[var(--error-border)]",children:[e.jsx("span",{className:"text-sm text-[var(--error-text)]",children:Z}),e.jsx("button",{onClick:()=>re(null),className:"ml-auto text-[var(--error-text)] hover:opacity-70",children:"×"})]}),e.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4",children:T.map(ce=>{const we=v.filter(De=>De.status===ce.status),ke=F!=null&&!ue(ce.status)&&F.status!==ce.status;return e.jsx(Qo,{title:ce.label,count:we.length,color:ce.color,isDragOver:Q===ce.status,isDropDisabled:ke,onDragOver:De=>se(De,ce.status),onDragLeave:ee,onDrop:De=>ae(De,ce.status),children:we.map(Qe)},ce.status)})})]})},Ce=()=>!s||M.length===0?null:e.jsxs("div",{className:"card p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.FileEdit,{className:"w-5 h-5 text-[var(--warning-text)]"}),e.jsx("h2",{className:"font-semibold",children:i("common:drafts.title","Drafts")}),e.jsx("span",{className:"px-2 py-0.5 text-xs bg-[var(--warning-bg)] text-[var(--warning-text)] rounded-full",children:M.length})]}),e.jsx("button",{onClick:()=>le(!oe),className:"btn btn-ghost text-sm",children:oe?i("common:actions.hide","Hide"):i("common:actions.show","Show")})]}),oe&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:M.map(T=>e.jsx("div",{className:"p-3 bg-[var(--bg-secondary)] rounded-lg border border-[var(--warning-border)] hover:border-[var(--warning-text)] transition-colors cursor-pointer",onClick:()=>Be(T),children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-medium truncate",children:T.title||i("common:drafts.untitled","Untitled draft")}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 text-xs text-[var(--text-secondary)] flex-wrap",children:[T.tenantName&&e.jsx("span",{className:"px-1.5 py-0.5 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded truncate max-w-[120px]",children:T.tenantName}),T.type&&e.jsx("span",{className:"px-1.5 py-0.5 bg-[var(--bg-tertiary)] rounded",children:i(`tickets.types.${T.type}`,{defaultValue:T.type})}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(l.Clock,{className:"w-3 h-3"}),Ke(T.updatedAt)]})]})]}),e.jsx("button",{onClick:ce=>{ce.stopPropagation(),Ne(T.id)},className:"p-1 hover:bg-[var(--error-bg)] rounded text-[var(--text-secondary)] hover:text-[var(--error-text)]",title:i("common:actions.delete","Delete"),children:e.jsx(l.X,{className:"w-4 h-4"})})]})},T.id))})]});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(l.Headphones,{className:"w-6 h-6"}),a]}),e.jsx("p",{className:"text-[var(--text-secondary)]",children:o})]}),!h&&e.jsxs("button",{onClick:()=>d(c),className:"btn btn-primary flex items-center gap-2",children:[e.jsx(l.Plus,{className:"w-4 h-4"}),i("list.newTicket")]})]}),Me(),Ce(),e.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[e.jsxs("form",{onSubmit:B,className:"flex-1 flex gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(l.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--text-secondary)]"}),e.jsx("input",{type:"text",placeholder:i("list.searchPlaceholder"),value:R,onChange:T=>L(T.target.value),className:"input w-full pl-10"})]}),e.jsx("button",{type:"submit",className:"btn btn-secondary",children:i("list.search")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>Y(!q),className:`btn ${q?"btn-primary":"btn-secondary"} flex items-center gap-2`,children:[e.jsx(l.Filter,{className:"w-4 h-4"}),i("list.filters")]}),e.jsx(Jo,{viewMode:J,onChange:pe})]})]}),q&&e.jsxs("div",{className:`card p-4 grid grid-cols-1 ${t==="admin"||t==="assigned"?de?"md:grid-cols-4":"md:grid-cols-3":"md:grid-cols-2"} gap-4`,children:[de&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:i("list.filter.tenant","Workspace")}),e.jsxs("select",{value:W,onChange:T=>{G(T.target.value),w(1)},className:"input w-full",children:[e.jsx("option",{value:"",children:i("list.filter.allTenants","All Workspaces")}),x.filter(T=>T.status==="Active").map(T=>e.jsx("option",{value:T.id,children:T.name},T.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:i("list.filter.status")}),e.jsxs("select",{value:I,onChange:T=>{C(T.target.value),w(1)},className:"input w-full",children:[e.jsx("option",{value:"",children:i("list.filter.allStatuses")}),e.jsx("option",{value:"Open",children:i("tickets.statuses.Open")}),e.jsx("option",{value:"InProgress",children:i("tickets.statuses.InProgress")}),e.jsx("option",{value:"OnHold",children:i("tickets.statuses.OnHold")}),e.jsx("option",{value:"Resolved",children:i("tickets.statuses.Resolved")}),e.jsx("option",{value:"Closed",children:i("tickets.statuses.Closed")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:i("list.filter.type")}),e.jsxs("select",{value:O,onChange:T=>{_(T.target.value),w(1)},className:"input w-full",children:[e.jsx("option",{value:"",children:i("list.filter.allTypes")}),e.jsx("option",{value:"Bug",children:i("tickets.types.Bug")}),e.jsx("option",{value:"FeatureRequest",children:i("tickets.types.FeatureRequest")}),e.jsx("option",{value:"ApplicationRequest",children:i("tickets.types.ApplicationRequest")}),e.jsx("option",{value:"Support",children:i("tickets.types.Support")}),e.jsx("option",{value:"Question",children:i("tickets.types.Question")})]})]}),(t==="admin"||t==="assigned")&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1",children:i("list.filter.priority")}),e.jsxs("select",{value:E,onChange:T=>{z(T.target.value),w(1)},className:"input w-full",children:[e.jsx("option",{value:"",children:i("list.filter.allPriorities")}),e.jsx("option",{value:"Low",children:i("tickets.priorities.Low")}),e.jsx("option",{value:"Medium",children:i("tickets.priorities.Medium")}),e.jsx("option",{value:"High",children:i("tickets.priorities.High")}),e.jsx("option",{value:"Critical",children:i("tickets.priorities.Critical")})]})]})]}),b?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(l.Loader2,{className:"w-8 h-8 animate-spin text-[var(--color-primary-600)]"})}):e.jsxs(e.Fragment,{children:[J==="table"&&Le(),J==="cards"&&Fe(),J==="kanban"&&He()]}),!b&&P>1&&e.jsx(ei,{page:S,totalPages:P,totalCount:A,onPageChange:w})]})}exports.ActivityTimeline=Ql;exports.AdminSidebar=mi;exports.AppHeader=wt;exports.AppLayout=aa;exports.AppSwitcher=Xr;exports.AuthLayout=_o;exports.AuthProvider=xr;exports.Breadcrumb=Vo;exports.CreateTicketButton=ta;exports.DataTable=Xo;exports.DataView=Yo;exports.DocPanelProvider=Kr;exports.DocsLayout=na;exports.DynamicRouter=Xl;exports.EntityCard=si;exports.ErrorFallback=Pr;exports.ExtendablePage=Gn;exports.ExtensionProvider=qr;exports.FavoritesBar=Jl;exports.FavoritesModal=ma;exports.FavoritesProvider=br;exports.FeatureGate=yi;exports.FeatureRouteGuard=fs;exports.Fill=Ur;exports.Footer=gs;exports.GlobalErrorBoundary=Tr;exports.Header=hs;exports.KanbanBoard=ri;exports.LanguageSwitcher=ps;exports.LicenseActivationDialog=ia;exports.LicenseContentBanner=ra;exports.LicenseGuard=ca;exports.LicenseProvider=hr;exports.LicenseStatusBadge=ji;exports.ModuleSidebar=sa;exports.NetworkError=is;exports.NotificationBell=Zr;exports.PAGE_KEYS=Kn;exports.PageHeader=ai;exports.PageRegistry=Te;exports.PermissionMatrix=ni;exports.ProtectedRoute=la;exports.PublicLayout=oa;exports.RouteErrorBoundary=vi;exports.SessionProvider=Rr;exports.SessionWarningModal=Ar;exports.SidebarProvider=jr;exports.SignalRProvider=Sr;exports.SlaBadge=pc;exports.Slot=Or;exports.SlotFillProvider=Fr;exports.SmartStackProvider=Bn;exports.ThemeCustomizer=li;exports.ThemeProvider=ur;exports.ThemeSwitcher=Ot;exports.TicketConversation=pa;exports.TicketDetailView=Nd;exports.TicketSidebar=ha;exports.TicketsListView=Cd;exports.Tooltip=ea;exports.UnderDevelopment=ci;exports.UserSidebar=xi;exports.api=D;exports.apiClient=Ie;exports.authApi=Et;exports.changeLanguage=ls;exports.createSlotFill=Dn;exports.detectDeviceType=da;exports.getClientIpAddress=ua;exports.logService=Pe;exports.useActivePage=zn;exports.useAuth=Ae;exports.useClientContext=Xn;exports.useCollapsibleState=Yn;exports.useDocPanel=Ft;exports.useExtensions=Ct;exports.useFavorites=ze;exports.useFormFieldExtensions=Fn;exports.useHasExtension=On;exports.useLicense=Ge;exports.usePageOverride=Mt;exports.usePageTracking=Ir;exports.usePermissionMatrix=Jn;exports.usePermissionSync=Qn;exports.useRouteConfig=ro;exports.useSessionMonitor=kr;exports.useSidebar=Lt;exports.useSignalR=Hr;exports.useSignalRContext=Cr;exports.useSlotFill=Mr;exports.useSlotHasContent=Ln;exports.useTableColumnExtensions=Mn;exports.useTheme=St;exports.useTicketSignalR=Vr;exports.useUserPermissions=io;exports.userApi=It;exports.withPageOverride=qn;
48
- //# sourceMappingURL=index-CHdBJkh4.cjs.map
48
+ //# sourceMappingURL=index-C6C5XmVj.cjs.map