ultisuite-client/out/_next/static/chunks/app/mail/layout-2c462b8f519b7077.js
R3D347HR4Y d6d18f911b
Some checks failed
E2E / Playwright e2e (push) Has been cancelled
Lots of stuff and mobile app
2026-06-17 00:13:28 +02:00

334 lines
522 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9367],{2818:(e,t,s)=>{"use strict";s.d(t,{I:()=>u});var a=s(98306),n=s(94658),r=s(74101),l=s(18747),i=s(54821),o=s(42491),c=s(7738),d=s(71092);function u(e,t){let{ready:s,authenticated:u}=(0,l.v)(),m=(0,c.$z)(),h=(0,d.tF)(e),x="file"===e.type&&"audio"!==h&&((0,d.ug)(e)||null!==h);return(0,a.I)({queryKey:m?[...i.h,"preview-thumb",e.path,e.etag]:["drive","preview-thumb",e.path,e.etag],enabled:s&&u&&t&&x,queryFn:async({client:t,queryKey:s})=>{let a=t.getQueryData(s);if(m){let t=(0,o.m)(e,{width:400,height:300});if(!t||"text"===t.type)throw Error("preview unavailable");if("svg"===t.type){let e=new Blob([t.markup],{type:"image/svg+xml"});return(0,r.Qh)(a,{url:URL.createObjectURL(e),display:"image"})}return{url:t.url,display:t.display}}if((0,d.ug)(e))try{let t=await (0,n.Yo)(e,400,300),s=(0,n.JX)(t,e.mime_type??"",e.name);return(0,r.Qh)(a,{url:URL.createObjectURL(s),display:"image"})}catch(e){if(!h||"audio"===h||"pdf"===h)throw e}if(!h||"audio"===h||"pdf"===h)throw Error("preview unavailable");let l=await (0,n.WE)({path:e.path,name:e.name,mime_type:e.mime_type??""}),i=(0,n.JX)(l,e.mime_type??"",e.name);return(0,r.Qh)(a,{url:URL.createObjectURL(i),display:"video"===h?"video":"image"})},staleTime:3e5,gcTime:6e5,retry:1})}},5251:(e,t,s)=>{"use strict";s.d(t,{Fm:()=>m,Qs:()=>x,cj:()=>i,h:()=>u,kN:()=>o,qp:()=>h});var a=s(4208);s(91356);var n=s(79531),r=s(12551),l=s(58113);function i({...e}){return(0,a.jsx)(n.bL,{"data-slot":"sheet",...e})}function o({...e}){return(0,a.jsx)(n.bm,{"data-slot":"sheet-close",...e})}function c({...e}){return(0,a.jsx)(n.ZL,{"data-slot":"sheet-portal",...e})}function d({className:e,...t}){return(0,a.jsx)(n.hJ,{"data-slot":"sheet-overlay",className:(0,l.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function u({className:e,children:t,side:s="right",overlayClassName:i,hideClose:o=!1,...m}){return(0,a.jsxs)(c,{children:[(0,a.jsx)(d,{className:i}),(0,a.jsxs)(n.UC,{"data-slot":"sheet-content",className:(0,l.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500","right"===s&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","left"===s&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","top"===s&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===s&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...m,children:[t,o?null:(0,a.jsxs)(n.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,a.jsx)(r.A,{className:"size-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function m({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"sheet-header",className:(0,l.cn)("flex flex-col gap-1.5 p-4",e),...t})}function h({className:e,...t}){return(0,a.jsx)(n.hE,{"data-slot":"sheet-title",className:(0,l.cn)("text-foreground font-semibold",e),...t})}function x({className:e,...t}){return(0,a.jsx)(n.VY,{"data-slot":"sheet-description",className:(0,l.cn)("text-muted-foreground text-sm",e),...t})}},10937:(e,t,s)=>{"use strict";s.d(t,{e:()=>i});var a=s(91356),n=s(18747),r=s(1559),l=s(59680);function i(){let{ready:e,authenticated:t}=(0,n.v)(),{data:s=[],isSuccess:i}=(0,r.sp)();return(0,a.useEffect)(()=>{e&&t?i&&l.TR.getState().hydrateFromApi(s):l.TR.getState().clear()},[e,t,i,s]),null}},12646:(e,t,s)=>{"use strict";s.d(t,{H:()=>m});var a=s(4208),n=s(26362),r=s(12551),l=s(5251),i=s(61554),o=s(65044),c=s(95291),d=s(59352),u=s(40505);function m(){let e=(0,d.b)(e=>e.open),t=(0,d.b)(e=>e.context),s=(0,d.b)(e=>e.closePanel),{data:m}=(0,u.Y7)(),{data:h}=(0,u.Yc)(e&&(m?.enabled??!1));return m?.enabled?(0,a.jsx)(l.cj,{open:e,onOpenChange:e=>!e&&s(),children:(0,a.jsxs)(l.h,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-xl",children:[(0,a.jsxs)(l.Fm,{className:"flex flex-row items-center justify-between border-b px-4 py-3",children:[(0,a.jsxs)(l.qp,{className:"flex items-center gap-2 text-base",children:[(0,a.jsx)(n.A,{className:"h-4 w-4 text-[#1a73e8]"}),"UltiAI"]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[h?(0,a.jsx)(c.u,{quota:h,compact:!0,className:"hidden max-w-[180px] sm:block"}):null,(0,a.jsx)(i.$,{variant:"ghost",size:"icon",onClick:s,"aria-label":"Fermer",children:(0,a.jsx)(r.A,{className:"h-4 w-4"})})]})]}),(0,a.jsx)(o.z,{publicPath:m.public_path,context:t,className:"h-full min-h-0 w-full flex-1 border-0"})]})}):null}},16114:(e,t,s)=>{"use strict";s.d(t,{P2:()=>r,j4:()=>n});let a="ulti_pending_compose";function n(e){try{sessionStorage.setItem(a,JSON.stringify(e))}catch{}}function r(){try{let e=sessionStorage.getItem(a);if(!e)return null;sessionStorage.removeItem(a);let t=JSON.parse(e);if(!Array.isArray(t.to))return null;return t}catch{return null}}},17728:(e,t,s)=>{"use strict";function a(e){let t;if("directory"===e.type)return!1;let s=function(e){let t=e.split("/").pop()??e;if(t.toLowerCase().endsWith(".excalidraw.json"))return"excalidraw.json";let s=t.lastIndexOf(".");return s<=0?"":t.slice(s+1).toLowerCase()}(e.name);return!!s&&("excalidraw"===(t=s.toLowerCase())||"excalidraw.json"===t)||"application/json"===(e.mime_type??"").toLowerCase()&&e.name.toLowerCase().endsWith(".excalidraw")}s.d(t,{db:()=>a})},19682:(e,t,s)=>{"use strict";s.d(t,{MailAppShell:()=>o4});var a=s(4208),n=s(91356),r=s(37570);let l="(hover: none) and (pointer: coarse)";function i(){return window.matchMedia(l).matches}function o(){return(0,r.xM)()||i()}function c(){let[e,t]=(0,n.useState)(!1);return(0,n.useLayoutEffect)(()=>{let e=`(max-width: ${r.mn}px)`,s=window.matchMedia(e),a=window.matchMedia(l),n=()=>t(o());return n(),s.addEventListener("change",n),a.addEventListener("change",n),()=>{s.removeEventListener("change",n),a.removeEventListener("change",n)}},[]),e}var d=s(52590);let u="(min-width: 768px)",m="(orientation: landscape)";var h=s(19984),x=s(39219),f=s(93051);function p(){let e=(0,h.useRouter)(),t=(0,h.usePathname)(),s=(0,f.KA)(),a=(0,h.useSearchParams)(),r=(0,n.useMemo)(()=>(function(e,t){let s=`/${t}`;if(!e?.startsWith(s))return;let a=e.slice(s.length).replace(/^\//,"");return a?a.split("/").filter(Boolean):[]})(t,s),[t,s]),l=(0,n.useMemo)(()=>{let e=(0,x.J_)(r),t=a.get("message")?.trim();return!e.mailId&&t?{...e,mailId:t}:e},[r,a]),i=(0,n.useCallback)(t=>{let n={folderId:t.folderId??l.folderId,inboxTab:void 0!==t.inboxTab&&null!==t.inboxTab?t.inboxTab:l.inboxTab,page:void 0!==t.page?t.page:l.page,mailId:void 0!==t.mailId?t.mailId:l.mailId},r=(0,x.Pu)(n,s);if("search"===n.folderId){let e=new URLSearchParams(a.toString());e.delete("message");let t=e.toString();t&&(r+=`?${t}`)}e.push(r,{scroll:!1})},[e,l,a,s]);return{route:l,navigateRoute:i,pathname:t,searchParams:a,routeRoot:s}}let b={q:"",from:"",to:"",subject:"",hasWords:"",doesNotHave:"",has:[],after:"",before:"",within:"",size:"",sizeUnit:"Mo",sizeOp:"gt",in:"all",excludeChats:!1},g=[{value:"1d",label:"1 jour"},{value:"3d",label:"3 jours"},{value:"1w",label:"7 jours"},{value:"2w",label:"2 semaines"},{value:"1m",label:"1 mois"},{value:"2m",label:"2 mois"},{value:"6m",label:"6 mois"},{value:"1y",label:"1 an"}],v=[{value:"all",label:"Tous les messages"},{value:"all-spam",label:"Tous les messages, Spam et Corbeille inclus"},{value:"inbox",label:"Bo\xeete de r\xe9ception"},{value:"starred",label:"Messages suivis"},{value:"sent",label:"Messages envoy\xe9s"},{value:"drafts",label:"Brouillons"},{value:"spam",label:"Ind\xe9sirables"},{value:"trash",label:"Corbeille"}];function j(e){return{q:e.get("q")??"",from:e.get("from")??"",to:e.get("to")??"",subject:e.get("subject")??"",hasWords:e.get("hasWords")??"",doesNotHave:e.get("doesNotHave")??"",has:e.getAll("has"),after:e.get("after")??"",before:e.get("before")??"",within:e.get("within")??"",size:e.get("size")??"",sizeUnit:e.get("sizeUnit")||"Mo",sizeOp:e.get("sizeOp")||"gt",in:e.get("in")??"all",excludeChats:"true"===e.get("excludeChats")}}function w(e,t="mail"){let s=(function(e){let t=new URLSearchParams;if(e.q&&t.set("q",e.q),e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),e.subject&&t.set("subject",e.subject),e.hasWords&&t.set("hasWords",e.hasWords),e.doesNotHave&&t.set("doesNotHave",e.doesNotHave),e.has?.length)for(let s of e.has)t.append("has",s);return e.after&&t.set("after",e.after),e.before&&t.set("before",e.before),e.within&&t.set("within",e.within),e.size&&(t.set("size",e.size),t.set("sizeUnit",e.sizeUnit??"Mo"),t.set("sizeOp",e.sizeOp??"gt")),e.in&&"all"!==e.in&&t.set("in",e.in),e.excludeChats&&t.set("excludeChats","true"),t})(e).toString(),a=t.split("/").filter(Boolean).join("/");return`/${a}/search${s?`?${s}`:""}`}var y=s(75512),k=s(20461),N=s(61760),C=s(71571),S=s(12551),A=s(1022),M=s(30957),I=s(5312),E=s(61554),z=s(51551),$=s(93652),L=s(1138);function D(e){return(0,L.iN)(e)??T}let T={name:"",email:"",defaultSignatureId:null},_=[{name:"John Jeffrey",email:"john.jeffrey@gmail.com"},{name:"Marie Dupont",email:"marie.dupont@outlook.com"},{name:"Alice Martin",email:"alice.martin@yahoo.fr"},{name:"Bob Wilson",email:"bob.wilson@proton.me"},{name:"Clara Zhang",email:"clara.zhang@gmail.com"},{name:"David Nakamura",email:"david.nakamura@icloud.com"},{name:"Emma Bernard",email:"emma.bernard@hotmail.com"},{name:"Fran\xe7ois Leroy",email:"francois.leroy@free.fr"},{name:"Gabriel Santos",email:"gabriel.santos@gmail.com"},{name:"Hana Kim",email:"hana.kim@naver.com"}],R=0;function P(){R++;let e=D(),t=e.defaultSignatureId,s=(0,$.XE)("",e);return{id:`compose-${Date.now()}-${R}`,from:e,to:[],cc:[],bcc:[],subject:"",bodyHtml:s,attachments:[],signatureId:t,autoInsertSignature:!0,minimized:!1,maximized:!1,showFrom:!1,showCc:!1,showBcc:!1,savedAt:null,placement:"dock",threadEmailId:null,threadKind:void 0,focusToOnMount:!0,focusBodyOnMount:!1,focusSubjectOnMount:!1,threading:null,threadDraftBaseline:null,threadDraftOpenedFromSaved:!1,editingScheduledId:null,scheduledSendAtIso:null}}function F(e){return e.map(e=>({...e}))}function O(e){var t;return{...e,from:{...e.from},to:F(e.to),cc:F(e.cc),bcc:F(e.bcc),attachments:e.attachments.map(e=>({...e})),threading:e.threading?{...e.threading}:null,threadDraftBaseline:e.threadDraftBaseline?{bodyHtml:(t=e.threadDraftBaseline).bodyHtml,subject:t.subject,to:F(t.to),cc:F(t.cc),bcc:F(t.bcc)}:null}}function q(e){return{bodyHtml:e.bodyHtml,subject:e.subject,to:F(e.to),cc:F(e.cc),bcc:F(e.bcc)}}function W(e,t){return e.length===t.length&&e.every((e,s)=>e.email===t[s]?.email&&e.name===(t[s]?.name??""))}function B(e){let t=e.threadDraftBaseline;return!!t&&"inline"===e.placement&&!!e.threadEmailId&&(e.bodyHtml!==t.bodyHtml||e.subject!==t.subject||!W(e.to,t.to)||!W(e.cc,t.cc)||!W(e.bcc,t.bcc))}function U(e,t){return{...e,from:t.from??e.from,to:t.to??e.to,cc:t.cc??e.cc,bcc:t.bcc??e.bcc,subject:t.subject??e.subject,bodyHtml:t.bodyHtml??e.bodyHtml,placement:t.placement??e.placement,threadEmailId:t.threadEmailId??e.threadEmailId,threadKind:t.threadKind??e.threadKind,focusToOnMount:t.focusToOnMount??e.focusToOnMount,focusBodyOnMount:t.focusBodyOnMount??e.focusBodyOnMount,focusSubjectOnMount:t.focusSubjectOnMount??e.focusSubjectOnMount,maximized:t.maximized??e.maximized,threading:void 0!==t.threading?t.threading:e.threading,showCc:t.showCc??e.showCc,showBcc:t.showBcc??e.showBcc,signatureId:void 0!==t.signatureId?t.signatureId:e.signatureId,autoInsertSignature:void 0!==t.autoInsertSignature?t.autoInsertSignature:e.autoInsertSignature,editingScheduledId:void 0!==t.editingScheduledId?t.editingScheduledId:e.editingScheduledId,scheduledSendAtIso:void 0!==t.scheduledSendAtIso?t.scheduledSendAtIso:e.scheduledSendAtIso}}function H(e,t){return"inline"===e.placement&&e.threadEmailId?{...e,threadDraftBaseline:q(e),threadDraftOpenedFromSaved:t}:{...e,threadDraftBaseline:null,threadDraftOpenedFromSaved:!1}}function V(e,t){let s=t.threadEmailId;if(!s||"inline"!==t.placement)return e;let a={...e};if(B(t))a[s]={threadEmailId:t.threadEmailId,threadKind:t.threadKind??"reply",from:t.from,to:F(t.to),cc:F(t.cc),bcc:F(t.bcc),subject:t.subject,bodyHtml:t.bodyHtml,threading:t.threading??null,showCc:t.showCc,showBcc:t.showBcc,signatureId:t.signatureId,autoInsertSignature:t.autoInsertSignature};else t.threadDraftOpenedFromSaved||delete a[s];return a}let K=(0,n.createContext)(null),Q=(0,n.createContext)(null),G=(0,n.createContext)(null);function Y({children:e}){let[t,s]=(0,n.useState)([]),[r,l]=(0,n.useState)({}),i=(0,n.useRef)(new Map),o=(0,n.useRef)(t);o.current=t;let c=(0,n.useCallback)(()=>{let e=P();s(t=>[...t.map(e=>e.minimized?e:{...e,minimized:!1}),e])},[]),d=(0,n.useCallback)(e=>{let t=U(P(),e),a=!0===e.openedFromSavedThreadDraft,n=H(t,a);"inline"===n.placement&&n.threadEmailId&&!a&&l(e=>{let t={...e};return delete t[n.threadEmailId],t});let r=o.current;if("inline"===n.placement&&n.threadEmailId){let e=r.find(e=>"inline"===e.placement&&e.threadEmailId===n.threadEmailId);e&&B(e)&&l(t=>V(t,e))}s(e=>{let t=e;return"inline"===n.placement&&n.threadEmailId&&(t=e.filter(e=>"inline"!==e.placement||e.threadEmailId!==n.threadEmailId)),[...t.map(e=>e.minimized?e:{...e,minimized:!1}),n]})},[]),u=(0,n.useCallback)(e=>{R++;let t=`compose-${Date.now()}-${R}`,a={...e,id:t,minimized:!1,maximized:!1,threadDraftBaseline:"inline"===e.placement&&e.threadEmailId?q(e):null,threadDraftOpenedFromSaved:!1};"inline"===a.placement&&a.threadEmailId&&l(e=>{let t={...e};return delete t[a.threadEmailId],t});let n=o.current;if("inline"===a.placement&&a.threadEmailId){let e=n.find(e=>"inline"===e.placement&&e.threadEmailId===a.threadEmailId);e&&B(e)&&l(t=>V(t,e))}s(e=>{let t=e;return"inline"===a.placement&&a.threadEmailId&&(t=e.filter(e=>"inline"!==e.placement||e.threadEmailId!==a.threadEmailId)),[...t.map(e=>e.minimized?e:{...e,minimized:!1}),a]})},[]),m=(0,n.useCallback)((e,t)=>{s(s=>s.map(s=>{if(s.id!==e)return s;let a=U(s,t);return"inline"===a.placement&&a.threadEmailId?H(a,s.threadDraftOpenedFromSaved):{...a,threadDraftBaseline:null,threadDraftOpenedFromSaved:!1}}))},[]),h=(0,n.useCallback)(()=>{let e=o.current;l(t=>{let s=t;for(let t of e)"inline"===t.placement&&t.threadEmailId&&(s=V(s,t));return s}),s(e=>e.filter(e=>"inline"!==e.placement))},[]),x=(0,n.useCallback)(e=>{let t=o.current;l(s=>{let a=s;for(let s of t)"inline"===s.placement&&s.threadEmailId&&s.threadEmailId!==e&&(a=V(a,s));return a}),s(t=>t.filter(t=>"inline"!==t.placement||t.threadEmailId===e))},[]),f=(0,n.useCallback)((e,t)=>{let a=i.current.get(e);a&&(clearTimeout(a),i.current.delete(e));let n=o.current.find(t=>t.id===e);n?.placement==="inline"&&n.threadEmailId&&(t?.sent||t?.discardThreadReplyDraft?l(e=>{let t={...e};return delete t[n.threadEmailId],t}):l(e=>V(e,n))),s(t=>t.filter(t=>t.id!==e))},[]),p=(0,n.useCallback)((e,t)=>{s(s=>s.map(s=>s.id===e?{...s,...t}:s));let a=i.current.get(e);a&&clearTimeout(a);let n=setTimeout(()=>{s(t=>t.map(t=>t.id===e?{...t,savedAt:Date.now()}:t)),i.current.delete(e)},3e3);i.current.set(e,n)},[]),b=(0,n.useCallback)(e=>{s(t=>t.map(t=>t.id===e?{...t,minimized:!t.minimized,maximized:!1}:t))},[]),g=(0,n.useCallback)(e=>{s(t=>t.map(t=>t.id===e?{...t,maximized:!t.maximized,minimized:!1}:t))},[]),v=(0,n.useCallback)(e=>{s(t=>t.map(t=>t.id===e?{...t,savedAt:Date.now()}:t))},[]),j=(0,n.useMemo)(()=>({openCompose:c,openComposeWithInitial:d,restoreComposeFromSnapshot:u,applyComposePreset:m,closeCompose:f,closeAllInlineComposes:h,pruneInlineComposesToOpenThread:x,updateCompose:p,toggleMinimize:b,toggleMaximize:g,saveDraft:v}),[c,d,u,m,f,h,x,p,b,g,v]),w=(0,n.useMemo)(()=>({savedThreadReplyDrafts:r}),[r]),y=(0,n.useMemo)(()=>({composeWindows:t}),[t]);return(0,a.jsx)(K.Provider,{value:j,children:(0,a.jsx)(Q.Provider,{value:w,children:(0,a.jsx)(G.Provider,{value:y,children:e})})})}function Z(){let e=(0,n.useContext)(K);if(!e)throw Error("useComposeActions must be used inside <ComposeProvider>");return e}function J(){let e=(0,n.useContext)(Q);if(!e)throw Error("useComposeDrafts must be used inside <ComposeProvider>");return e}function X(){let e=(0,n.useContext)(G);if(!e)throw Error("useComposeWindows must be used inside <ComposeProvider>");return e}var ee=s(68047),et=s(10579),es=s(70589),ea=s(65519),en=s(78606),er=s(20945);let el=[{id:"inbox",label:"Bo\xeete de r\xe9ception",icon:(0,a.jsx)(ee.A,{className:"size-4 shrink-0 text-[#5f6368]",strokeWidth:1.5}),depth:0},{id:"sent",label:"Messages envoy\xe9s",icon:(0,a.jsx)(et.A,{className:"size-4 shrink-0 text-[#5f6368]",strokeWidth:1.5}),depth:0},{id:"drafts",label:"Brouillons",icon:(0,a.jsx)(es.A,{className:"size-4 shrink-0 text-[#5f6368]",strokeWidth:1.5}),depth:0},{id:"spam",label:"Spam",icon:(0,a.jsx)(ea.A,{className:"size-4 shrink-0 text-[#5f6368]",strokeWidth:1.5}),depth:0},{id:"trash",label:"Corbeille",icon:(0,a.jsx)(en.A,{className:"size-4 shrink-0 text-[#5f6368]",strokeWidth:1.5}),depth:0}];function ei({targets:e,onMoveTo:t}){return(0,a.jsxs)(a.Fragment,{children:[e.recents.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"px-3 py-1.5 text-[11px] font-medium uppercase tracking-wide text-[#5f6368]",children:"R\xe9cents"}),e.recents.map(e=>(0,a.jsxs)(z._2,{onSelect:()=>t(e.id),children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon,(0,a.jsx)(er.A,{className:"size-3 shrink-0 text-[#9aa0a6]",strokeWidth:1.5})]}),e.label]},`recent-${e.id}`)),(0,a.jsx)(z.mB,{})]}),e.system.map(e=>(0,a.jsxs)(z._2,{onSelect:()=>t(e.id),children:[e.icon,e.label]},e.id)),e.folders.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(z.mB,{}),(0,a.jsx)("div",{className:"px-3 py-1.5 text-[11px] font-medium uppercase tracking-wide text-[#5f6368]",children:"Dossiers"}),e.folders.map(e=>(0,a.jsxs)(z._2,{onSelect:()=>t(e.id),style:{paddingLeft:`${12+16*e.depth}px`},children:[e.icon,e.label]},e.id))]})]})}var eo=s(44410),ec=s(58113);let ed="size-11 shrink-0 rounded-full border border-gray-200 bg-white/80 text-[#444746] shadow-md backdrop-blur hover:bg-white";function eu({sidebarOpen:e,onToggleSidebar:t,xsViewChrome:s=null,onOpenSearch:n,searchQuery:r,onClearSearch:l}){let{openCompose:i}=Z(),o=!!s;return(0,a.jsxs)("div",{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col items-center pb-[env(safe-area-inset-bottom)] sm:hidden",children:[(0,a.jsx)("div",{className:(0,ec.cn)("pointer-events-none absolute inset-0 bg-gradient-to-t to-transparent",o?"dark:from-black/90 dark:via-black/50 from-mail-surface/90 via-mail-surface/50":"from-mail-surface/95 via-mail-surface/70 dark:from-background/95 dark:via-background/70")}),(0,a.jsxs)("div",{className:"relative z-10 flex w-full items-center gap-2 px-3 pb-3 pt-2",children:[o&&s?(0,a.jsxs)("div",{className:"flex shrink-0 overflow-hidden rounded-full border border-gray-200 bg-white/80 shadow-md backdrop-blur",children:[(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"size-11 rounded-none text-[#444746] hover:bg-[#f1f3f4]",onClick:s.onArchive,"aria-label":"Archiver",children:(0,a.jsx)(k.A,{className:"size-5",strokeWidth:1.5})}),(0,a.jsx)("span",{className:"w-px shrink-0 self-stretch bg-gray-200","aria-hidden":!0}),(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"size-11 rounded-none text-[#444746] hover:bg-[#f1f3f4]","aria-label":"D\xe9placer dans un dossier",children:(0,a.jsx)(N.A,{className:"size-5",strokeWidth:1.5})})}),(0,a.jsx)(z.SQ,{align:"start",side:"top",sideOffset:8,className:(0,ec.cn)(eo.hz,"max-h-80 overflow-y-auto"),children:(0,a.jsx)(ei,{targets:s.moveTargets,onMoveTo:s.onMoveTo})})]}),(0,a.jsx)("span",{className:"w-px shrink-0 self-stretch bg-gray-200","aria-hidden":!0}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"size-11 rounded-none text-[#444746] hover:bg-[#f1f3f4]",onClick:s.onReply,"aria-label":"R\xe9pondre",children:(0,a.jsx)(C.A,{className:"size-5",strokeWidth:1.5})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:ed,onClick:t,"aria-label":e?"Fermer le menu":"Ouvrir le menu",children:e?(0,a.jsx)(S.A,{className:"size-5"}):(0,a.jsx)(A.A,{className:"size-5"})}),!e&&(0,a.jsxs)("button",{type:"button",className:"relative flex min-w-0 flex-1 items-center",onClick:n,children:[(0,a.jsx)("div",{className:"pointer-events-none absolute left-3 z-10 flex items-center text-gray-500",children:(0,a.jsx)(M.A,{className:"size-5"})}),(0,a.jsx)("div",{className:"flex h-11 w-full items-center rounded-full border border-gray-200 bg-white/80 pl-10 pr-4 text-left text-sm shadow-md backdrop-blur",children:(0,a.jsx)("span",{className:r?"truncate text-gray-900 dark:text-gray-100":"text-gray-400",children:r||"Rechercher"})})]})]}),!e&&(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:(0,ec.cn)(ed,o&&"ml-auto"),onClick:r?l:i,"aria-label":r?"Quitter la recherche":"Nouveau message",children:r?(0,a.jsx)(S.A,{className:"size-5"}):(0,a.jsx)(I.A,{className:"size-5"})})]})]})}var em=s(604),eh=s(66796),ex=s(29407),ef=s(86466),ep=s(5251),eb=s(29491),eg=s(3913),ev=s(55590);function ej(e,t){if(!e.trim()||0===t.length)return"";let s=t[0],a=(0,eg.$Y)(e);for(let t of(s.kind,[s.email,s.displayName]))if((0,eg.$Y)(t).startsWith(a))return t.slice(e.length);return""}function ew(e,t={}){let s=e.trim();if(!s&&!t.chipAttachment&&!t.chipLast7Days&&!t.chipFromMe)return{};let a={q:s};return t.chipAttachment&&(a.has=["attachment"]),t.chipLast7Days&&(a.within="1w"),t.chipFromMe&&t.fromEmail&&(a.from=t.fromEmail),a}function ey(e,t,s){e.push(w(t,s?.routeRoot),{scroll:s?.scroll??!1}),s?.onAfter?.()}var ek=s(46298);let eN={inputValue:"",dropdownOpen:!1,selectedIndex:-1,advancedOpen:!1,chipAttachment:!1,chipLast7Days:!1,chipFromMe:!1},eC=(0,ek.v)()(e=>({...eN,setInputValue:t=>e({inputValue:t,dropdownOpen:t.length>0,selectedIndex:-1}),setDropdownOpen:t=>e({dropdownOpen:t}),setSelectedIndex:t=>e({selectedIndex:t}),setAdvancedOpen:t=>e({advancedOpen:t,dropdownOpen:!1}),toggleChipAttachment:()=>e(e=>({chipAttachment:!e.chipAttachment})),toggleChipLast7Days:()=>e(e=>({chipLast7Days:!e.chipLast7Days})),toggleChipFromMe:()=>e(e=>({chipFromMe:!e.chipFromMe})),resetChips:()=>e({chipAttachment:!1,chipLast7Days:!1,chipFromMe:!1}),syncChipsFromParams:(t,s)=>e({chipAttachment:t.has?.includes("attachment")??!1,chipLast7Days:"1w"===t.within,chipFromMe:!!(s&&t.from&&t.from.toLowerCase()===s.toLowerCase())}),reset:()=>e(eN)}));var eS=s(22054);function eA(e,t){let[s,a]=(0,n.useState)(t?.from??""),[r,l]=(0,n.useState)(t?.to??""),[i,o]=(0,n.useState)(t?.subject??""),[c,d]=(0,n.useState)(t?.hasWords||t?.q||e),[u,m]=(0,n.useState)(t?.doesNotHave??""),[h,x]=(0,n.useState)(t?.size??""),[f,p]=(0,n.useState)(t?.sizeOp??"gt"),[g,v]=(0,n.useState)(t?.sizeUnit??"Mo"),[j,w]=(0,n.useState)(t?.within??""),[y,k]=(0,n.useState)(t?.after??""),[N,C]=(0,n.useState)(t?.in??"all"),[S,A]=(0,n.useState)(t?.has?.includes("attachment")??!1),[M,I]=(0,n.useState)(t?.excludeChats??!1);return{from:s,setFrom:a,to:r,setTo:l,subject:i,setSubject:o,hasWords:c,setHasWords:d,doesNotHave:u,setDoesNotHave:m,sizeVal:h,setSizeVal:x,sizeOp:f,setSizeOp:p,sizeUnit:g,setSizeUnit:v,within:j,setWithin:w,dateAfter:y,setDateAfter:k,searchIn:N,setSearchIn:C,hasAttachment:S,setHasAttachment:A,excludeChats:M,setExcludeChats:I,buildParams:()=>({...b,q:"",from:s,to:r,subject:i,hasWords:c,doesNotHave:u,size:h,sizeOp:f,sizeUnit:g,within:j,after:y,in:N,has:S?["attachment"]:[],excludeChats:M})}}var eM=s(13746),eI=s(19096),eE=s(30925),ez=s(89342);function e$({form:e,onSubmit:t,onClose:s}){let n="w-36 shrink-0 text-sm text-muted-foreground",r=(0,ec.cn)("h-8 flex-1 px-2 text-sm",eo.hn),l="flex items-center gap-3";return(0,a.jsx)("div",{className:eo.Ww,children:(0,a.jsxs)("div",{className:"space-y-3 p-4",children:[(0,a.jsxs)("div",{className:l,children:[(0,a.jsx)(eI.J,{className:n,children:"De"}),(0,a.jsx)(eM.p,{value:e.from,onChange:t=>e.setFrom(t.target.value),className:r,autoFocus:!0})]}),(0,a.jsxs)("div",{className:l,children:[(0,a.jsx)(eI.J,{className:n,children:"\xc0"}),(0,a.jsx)(eM.p,{value:e.to,onChange:t=>e.setTo(t.target.value),className:r})]}),(0,a.jsxs)("div",{className:l,children:[(0,a.jsx)(eI.J,{className:n,children:"Objet"}),(0,a.jsx)(eM.p,{value:e.subject,onChange:t=>e.setSubject(t.target.value),className:r})]}),(0,a.jsxs)("div",{className:l,children:[(0,a.jsx)(eI.J,{className:n,children:"Contient les mots"}),(0,a.jsx)(eM.p,{value:e.hasWords,onChange:t=>e.setHasWords(t.target.value),className:r})]}),(0,a.jsxs)("div",{className:l,children:[(0,a.jsx)(eI.J,{className:n,children:"Ne contient pas"}),(0,a.jsx)(eM.p,{value:e.doesNotHave,onChange:t=>e.setDoesNotHave(t.target.value),className:r})]}),(0,a.jsx)(eT,{form:e,compact:!1,labelClass:n}),(0,a.jsx)(e_,{form:e,compact:!1,labelClass:n}),(0,a.jsxs)("div",{className:l,children:[(0,a.jsx)(eI.J,{className:n,children:"Rechercher"}),(0,a.jsxs)(ez.l6,{value:e.searchIn,onValueChange:e.setSearchIn,children:[(0,a.jsx)(ez.bq,{className:(0,ec.cn)("h-8 flex-1 text-sm",eo.hn),children:(0,a.jsx)(ez.yv,{})}),(0,a.jsx)(ez.gC,{children:v.map(e=>(0,a.jsx)(ez.eb,{value:e.value,children:e.label},e.value))})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-6 pt-1",children:(0,a.jsx)(eR,{form:e})}),(0,a.jsxs)("div",{className:(0,ec.cn)("flex items-center justify-end gap-3 border-t pt-3",eo.IK),children:[(0,a.jsx)(E.$,{variant:"ghost",className:"text-sm text-blue-600",disabled:!0,children:"Cr\xe9er un filtre"}),(0,a.jsx)(E.$,{className:"bg-[#1a73e8] text-sm text-white hover:bg-[#1765cc]",onClick:t,children:"Rechercher"})]})]})})}function eL({form:e,onSubmit:t}){let s=(0,ec.cn)("h-9 text-sm",eo.hn);return(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-4",children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(eD,{label:"De",children:(0,a.jsx)(eM.p,{value:e.from,onChange:t=>e.setFrom(t.target.value),className:s})}),(0,a.jsx)(eD,{label:"\xc0",children:(0,a.jsx)(eM.p,{value:e.to,onChange:t=>e.setTo(t.target.value),className:s})}),(0,a.jsx)(eD,{label:"Objet",children:(0,a.jsx)(eM.p,{value:e.subject,onChange:t=>e.setSubject(t.target.value),className:s})}),(0,a.jsx)(eD,{label:"Contient les mots",children:(0,a.jsx)(eM.p,{value:e.hasWords,onChange:t=>e.setHasWords(t.target.value),className:s})}),(0,a.jsx)(eD,{label:"Ne contient pas",children:(0,a.jsx)(eM.p,{value:e.doesNotHave,onChange:t=>e.setDoesNotHave(t.target.value),className:s})}),(0,a.jsx)(eT,{form:e,compact:!0,labelClass:""}),(0,a.jsx)(e_,{form:e,compact:!0,labelClass:""}),(0,a.jsx)(eD,{label:"Rechercher dans",children:(0,a.jsxs)(ez.l6,{value:e.searchIn,onValueChange:e.setSearchIn,children:[(0,a.jsx)(ez.bq,{className:s,children:(0,a.jsx)(ez.yv,{})}),(0,a.jsx)(ez.gC,{children:v.map(e=>(0,a.jsx)(ez.eb,{value:e.value,children:e.label},e.value))})]})}),(0,a.jsx)("div",{className:"space-y-3 pt-1",children:(0,a.jsx)(eR,{form:e})}),(0,a.jsx)(E.$,{className:"w-full bg-[#1a73e8] text-sm text-white hover:bg-[#1765cc]",onClick:t,children:"Rechercher"})]})})}function eD({label:e,children:t}){return(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(eI.J,{className:"text-xs text-muted-foreground",children:e}),t]})}function eT({form:e,compact:t,labelClass:s}){let n=(0,ec.cn)(t?"h-9 flex-1 text-sm":"h-8 w-32 text-sm",eo.hn),r=(0,ec.cn)(t?"h-9 w-20 text-sm":"h-8 w-20 text-sm",eo.hn),l=(0,ec.cn)(t?"h-9 w-20 text-sm":"h-8 w-20 px-2 text-sm",eo.hn),i=(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-2",children:[(0,a.jsxs)(ez.l6,{value:e.sizeOp,onValueChange:t=>e.setSizeOp(t),children:[(0,a.jsx)(ez.bq,{className:n,children:(0,a.jsx)(ez.yv,{})}),(0,a.jsxs)(ez.gC,{children:[(0,a.jsx)(ez.eb,{value:"gt",children:"sup\xe9rieure \xe0"}),(0,a.jsx)(ez.eb,{value:"lt",children:"inf\xe9rieure \xe0"})]})]}),(0,a.jsx)(eM.p,{type:"number",value:e.sizeVal,onChange:t=>e.setSizeVal(t.target.value),className:l}),(0,a.jsxs)(ez.l6,{value:e.sizeUnit,onValueChange:t=>e.setSizeUnit(t),children:[(0,a.jsx)(ez.bq,{className:r,children:(0,a.jsx)(ez.yv,{})}),(0,a.jsxs)(ez.gC,{children:[(0,a.jsx)(ez.eb,{value:"Mo",children:"Mo"}),(0,a.jsx)(ez.eb,{value:"Ko",children:"Ko"})]})]})]});return t?(0,a.jsx)(eD,{label:"Taille",children:(0,a.jsx)("div",{className:"flex items-center gap-2",children:i})}):(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(eI.J,{className:s,children:"Taille"}),i]})}function e_({form:e,compact:t,labelClass:s}){let n=(0,ec.cn)(t?"h-9 text-sm":"h-8 w-32 text-sm",eo.hn),r=(0,ec.cn)(t?"h-9 text-sm":"h-8 min-w-0 flex-1 px-2 text-sm",eo.hn),l=(0,a.jsxs)("div",{className:(0,ec.cn)("flex min-w-0 flex-1 flex-wrap items-center gap-2",t&&"flex-col items-stretch gap-2"),children:[(0,a.jsxs)(ez.l6,{value:e.within,onValueChange:e.setWithin,children:[(0,a.jsx)(ez.bq,{className:n,children:(0,a.jsx)(ez.yv,{placeholder:"S\xe9lectionner"})}),(0,a.jsx)(ez.gC,{children:g.map(e=>(0,a.jsx)(ez.eb,{value:e.value,children:e.label},e.value))})]}),!t&&(0,a.jsx)(eM.p,{type:"date",value:e.dateAfter,onChange:t=>e.setDateAfter(t.target.value),className:r})]});return t?(0,a.jsx)(eD,{label:"Plage de dates",children:l}):(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(eI.J,{className:s,children:"Plage de dates"}),l]})}function eR({form:e}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,a.jsx)(eE.S,{className:eo.G7,checked:e.hasAttachment,onCheckedChange:t=>e.setHasAttachment(!0===t)}),"Contenant une pi\xe8ce jointe"]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,a.jsx)(eE.S,{className:eo.G7,checked:e.excludeChats,onCheckedChange:t=>e.setExcludeChats(!0===t)}),"Ne pas inclure les chats"]})]})}function eP({initialQuery:e,onSubmit:t}){let s=eA(e,null);return(0,a.jsx)(eL,{form:s,onSubmit:()=>{t(w(s.buildParams()))}})}function eF({open:e,onClose:t,initialQuery:s=""}){let r=(0,h.useRouter)(),l=(0,f.KA)(),i=(0,ev.LH)(),o=eC(e=>e.inputValue),c=eC(e=>e.selectedIndex),d=eC(e=>e.chipAttachment),u=eC(e=>e.chipLast7Days),m=eC(e=>e.chipFromMe),{data:x}=(0,eb.F4)(o),{setInputValue:p,setSelectedIndex:b,toggleChipAttachment:g,toggleChipLast7Days:v,toggleChipFromMe:j,resetChips:w}=eC.getState(),[y,k]=(0,n.useState)(!1),N=(0,n.useRef)(null);(0,n.useEffect)(()=>{e?(p(s),k(!1),setTimeout(()=>N.current?.focus(),50)):(w(),k(!1))},[e,s,p,w]);let C=(0,n.useMemo)(()=>o.trim()&&x?.length?x.slice(0,6).map(e=>({kind:"contact",contact:{id:e.uid,firstName:e.full_name.split(" ")[0]??"",lastName:e.full_name.split(" ").slice(1).join(" "),emails:e.email?[{value:e.email,label:"primary"}]:[],phones:[],createdAt:0,updatedAt:0},email:e.email??"",displayName:e.full_name,score:(0,eg.Be)(e,o)})):[],[o,x]),A=(0,n.useMemo)(()=>ej(o,C),[o,C]),I=C.length+1,z=(0,n.useCallback)(e=>{let s=ew(e??o,{chipAttachment:d,chipLast7Days:u,chipFromMe:m,fromEmail:i?.email??""});Object.keys(s).length&&ey(r,s,{routeRoot:l,onAfter:t})},[o,d,u,m,i?.email,r,l,t]),$=(0,n.useCallback)(e=>{ey(r,ew(e.email,{chipAttachment:d,chipLast7Days:u,chipFromMe:m,fromEmail:i?.email??""}),{routeRoot:l,onAfter:t})},[d,u,m,i?.email,r,l,t]),L=(0,n.useCallback)(e=>{switch(e.key){case"ArrowDown":e.preventDefault(),b(c<I-1?c+1:0);break;case"ArrowUp":e.preventDefault(),b(c>0?c-1:I-1);break;case"Enter":e.preventDefault(),c>=0&&c<C.length?$(C[c]):z();break;case"Tab":A&&(e.preventDefault(),p(o+A));break;case"Escape":e.preventDefault(),t()}},[c,I,C,A,o,z,$,t]);return(0,a.jsx)(ep.cj,{open:e,onOpenChange:e=>{e||t()},children:(0,a.jsxs)(ep.h,{side:"bottom",hideClose:!0,overlayClassName:"z-[100] bg-black/40",className:eo.TN,children:[(0,a.jsx)(ep.qp,{className:"sr-only",children:"Rechercher dans les messages"}),(0,a.jsxs)("div",{className:(0,ec.cn)("flex shrink-0 items-center gap-2 border-b bg-mail-surface-elevated px-2 py-2",eo.IK),children:[(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:"size-10 shrink-0 text-muted-foreground",onClick:()=>{y?k(!1):t()},"aria-label":"Retour",children:(0,a.jsx)(em.A,{className:"size-5"})}),(0,a.jsxs)("div",{className:"relative flex min-w-0 flex-1 items-center",children:[A&&!y&&(0,a.jsxs)("div",{className:"pointer-events-none absolute left-0 flex items-center text-sm text-muted-foreground","aria-hidden":!0,children:[(0,a.jsx)("span",{className:"invisible",children:o}),(0,a.jsx)("span",{children:A})]}),(0,a.jsx)("input",{ref:N,type:"text",value:o,onChange:e=>{p(e.target.value),b(-1),y&&k(!1)},onKeyDown:L,placeholder:"Rechercher dans les messages",className:"h-10 w-full bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground",autoComplete:"off"})]}),o&&!y&&(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:"size-10 shrink-0 text-muted-foreground",onClick:()=>{p(""),N.current?.focus()},"aria-label":"Effacer",children:(0,a.jsx)(S.A,{className:"size-5"})}),(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:"size-10 shrink-0 text-muted-foreground",onClick:()=>k(!y),"aria-label":"Recherche avanc\xe9e",children:(0,a.jsx)(eh.A,{className:"size-5"})})]}),y?(0,a.jsx)(eP,{initialQuery:o,onSubmit:e=>{r.push(e),t()}}):(0,a.jsxs)("div",{className:(0,ec.cn)("flex min-h-0 flex-1 flex-col",eo.yv),children:[(0,a.jsxs)("div",{className:(0,ec.cn)("flex items-center gap-2 overflow-x-auto border-b px-4 py-2",eo.IK),children:[(0,a.jsxs)("button",{type:"button",onClick:()=>g(),className:(0,ec.cn)("flex shrink-0 items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs transition-colors",d?"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900/30 dark:text-blue-300":eo.j7),children:[(0,a.jsx)(ex.A,{className:"size-3.5"}),"Contient une pi\xe8ce jointe"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>v(),className:(0,ec.cn)("flex shrink-0 items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs transition-colors",u?"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900/30 dark:text-blue-300":eo.j7),children:[(0,a.jsx)(er.A,{className:"size-3.5"}),"7 derniers jours"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>j(),className:(0,ec.cn)("flex shrink-0 items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs transition-colors",m?"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900/30 dark:text-blue-300":eo.j7),children:[(0,a.jsx)(ef.A,{className:"size-3.5"}),"De moi"]})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o.trim()&&(0,a.jsxs)(a.Fragment,{children:[C.map((e,t)=>{let s=t===c;if("contact"===e.kind){let t=(0,eS.w7)(e.displayName),n=(0,eS.V7)(e.displayName);return(0,a.jsxs)("button",{type:"button",className:(0,ec.cn)("flex w-full items-center gap-3 px-4 py-3 text-left text-sm active:bg-mail-nav-hover",s&&"bg-mail-nav-hover"),onClick:()=>$(e),children:[(0,a.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full text-xs font-medium text-white",style:{backgroundColor:n},children:t}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"truncate font-medium text-foreground",children:e.displayName}),(0,a.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:e.email})]})]},`c-${e.contact.id}-${e.email}`)}return(0,a.jsxs)("button",{type:"button",className:(0,ec.cn)("flex w-full items-center gap-3 px-4 py-3 text-left text-sm active:bg-mail-nav-hover",s&&"bg-mail-nav-hover"),onClick:()=>$(e),children:[(0,a.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-full bg-mail-surface-muted text-muted-foreground",children:(0,a.jsx)(ef.A,{className:"size-4"})}),(0,a.jsx)("div",{className:"min-w-0 flex-1",children:(0,a.jsx)("div",{className:"truncate text-foreground",children:e.email})})]},`e-${e.email}`)}),(0,a.jsxs)("button",{type:"button",className:(0,ec.cn)("flex w-full items-center gap-3 px-4 py-3 text-left text-sm active:bg-mail-nav-hover",c===C.length&&"bg-mail-nav-hover"),onClick:()=>z(),children:[(0,a.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center",children:(0,a.jsx)(M.A,{className:"size-5 text-muted-foreground"})}),(0,a.jsxs)("span",{className:"text-muted-foreground",children:["Tous les r\xe9sultats pour \xab\xa0",(0,a.jsx)("span",{className:"font-medium text-foreground",children:o}),"\xa0\xbb"]})]})]})})]})]})})}var eO=s(84834),eq=s(1357),eW=s(18166);function eB({folderDialogOpen:e,setFolderDialogOpen:t,labelDialogOpen:s,setLabelDialogOpen:n,newFolderName:r,setNewFolderName:l,newFolderParent:i,setNewFolderParent:o,newLabelName:c,setNewLabelName:d,newFolderNameInputRef:u,newLabelNameInputRef:m,folderParentOptions:h,onSubmitNewFolder:x,onSubmitNewLabel:f}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eW.lG,{open:e,onOpenChange:t,children:(0,a.jsxs)(eW.Cf,{className:"sm:max-w-md",showCloseButton:!0,onOpenAutoFocus:e=>{e.preventDefault(),window.requestAnimationFrame(()=>u.current?.focus())},children:[(0,a.jsxs)(eW.c7,{children:[(0,a.jsx)(eW.L3,{children:"Nouveau dossier"}),(0,a.jsx)(eW.rr,{children:"Choisissez lemplacement (racine ou dossier parent) puis le nom."})]}),(0,a.jsxs)("div",{className:"grid gap-3 py-1",children:[(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)(eI.J,{htmlFor:"new-folder-parent",children:"Emplacement"}),(0,a.jsxs)(ez.l6,{value:i,onValueChange:o,children:[(0,a.jsx)(ez.bq,{id:"new-folder-parent",className:"w-full min-w-0",size:"sm",children:(0,a.jsx)(ez.yv,{placeholder:"Parent"})}),(0,a.jsx)(ez.gC,{position:"popper",className:"max-h-72",children:h.map(e=>(0,a.jsx)(ez.eb,{value:e.value,children:e.label},e.value))})]})]}),(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)(eI.J,{htmlFor:"new-folder-name",children:"Nom"}),(0,a.jsx)(eM.p,{id:"new-folder-name",ref:u,value:r,onChange:e=>l(e.target.value),placeholder:"Mon dossier",autoComplete:"off",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),x())}})]})]}),(0,a.jsxs)(eW.Es,{children:[(0,a.jsx)(E.$,{variant:"outline",type:"button",onClick:()=>t(!1),children:"Annuler"}),(0,a.jsx)(E.$,{type:"button",onClick:x,children:"Cr\xe9er"})]})]})}),(0,a.jsx)(eW.lG,{open:s,onOpenChange:n,children:(0,a.jsxs)(eW.Cf,{className:"sm:max-w-md",showCloseButton:!0,onOpenAutoFocus:e=>{e.preventDefault(),window.requestAnimationFrame(()=>m.current?.focus())},children:[(0,a.jsxs)(eW.c7,{children:[(0,a.jsx)(eW.L3,{children:"Nouveau libell\xe9"}),(0,a.jsx)(eW.rr,{children:"Nom affich\xe9 dans la barre lat\xe9rale et utilis\xe9 sur les messages."})]}),(0,a.jsxs)("div",{className:"grid gap-2 py-1",children:[(0,a.jsx)(eI.J,{htmlFor:"new-label-name",children:"Nom"}),(0,a.jsx)(eM.p,{id:"new-label-name",ref:m,value:c,onChange:e=>d(e.target.value),placeholder:"Libell\xe9",autoComplete:"off",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),f())}})]}),(0,a.jsxs)(eW.Es,{children:[(0,a.jsx)(E.$,{variant:"outline",type:"button",onClick:()=>n(!1),children:"Annuler"}),(0,a.jsx)(E.$,{type:"button",onClick:f,children:"Cr\xe9er"})]})]})})]})}var eU=s(73190);function eH({splitView:e,isExpanded:t,panelSurfaceClass:s,splitViewLogoHeaderClass:n,splitViewLogoIconClass:r,touchNav:l}){let{openCompose:i}=Z();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:(0,ec.cn)("flex shrink-0 items-center",s,e?(0,ec.cn)(n,t?"justify-between":"justify-start"):"justify-between px-4 pt-4 pb-4 sm:hidden"),children:e&&!t?(0,a.jsx)(eU.X,{variant:"mark",className:r}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eU.X,{className:(0,ec.cn)("shrink-0",e?"max-w-[140px] gap-4 [&_img]:size-9":"min-h-8")}),(e||l)&&t&&(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:"size-9 shrink-0 text-gray-600","aria-label":"R\xe9glages",onClick:()=>d.x.getState().setQuickSettingsOpen(!0),children:(0,a.jsx)(eO.In,{icon:"mdi:cog",className:"size-5 shrink-0","aria-hidden":!0})})]})}),(0,a.jsx)("div",{className:(0,ec.cn)("hidden shrink-0 z-10 pt-1 pl-2 max-sm:pb-3 sm:pb-0 sm:flex",s,t?"pr-3.5":"pr-2",e&&"!hidden"),children:(0,a.jsxs)("button",{type:"button",title:t?void 0:"Nouveau message","aria-label":t?void 0:"Nouveau message",onClick:i,className:(0,ec.cn)("inline-flex h-[52px] min-w-0 shrink-0 cursor-pointer items-center rounded-2xl border border-border bg-mail-surface text-sm font-medium text-foreground shadow-sm outline-none transition-[box-shadow,background-color,border-color,color] duration-200 hover:bg-accent hover:shadow-md focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-offset-2 [&_svg]:pointer-events-none [&_svg]:size-5 [&_svg]:shrink-0",t?"w-auto max-w-full justify-start gap-3 self-start pl-4 pr-8":"w-[52px] justify-center px-0 py-0"),children:[(0,a.jsx)(I.A,{className:"size-5 shrink-0"}),t&&(0,a.jsx)("span",{className:"min-w-0 truncate text-sm font-medium",children:"Nouveau message"})]})})]})}var eV=s(9519),eK=s(93497),eQ=s(30426),eG=s(37341);function eY(e){let t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function eZ(e){let t=e.trim().replace(/^#/,"");if(3===t.length){let e=parseInt(t[0]+t[0],16),s=parseInt(t[1]+t[1],16),a=parseInt(t[2]+t[2],16);return[e,s,a].some(e=>Number.isNaN(e))?null:[e,s,a]}if(6===t.length||8===t.length){let e=parseInt(t.slice(0,2),16),s=parseInt(t.slice(2,4),16),a=parseInt(t.slice(4,6),16);return[e,s,a].some(e=>Number.isNaN(e))?null:[e,s,a]}return null}function eJ(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function eX(e){return"#ffffff"===function(e){let t=eZ(e);if(!t)return"#202124";let s=function(e){let t=eZ(e);if(!t)return .5;let[s,a,n]=t.map(eY);return .2126*s+.7152*a+.0722*n}(e),a=function(e){let[t,s,a]=e;return(Math.max(t,s,a)-Math.min(t,s,a))/255}(t),[n,r,l]=t;return s>=.88&&a<.12?"#202124":s<=.2?"#ffffff":s>=.62&&l<110&&n>185&&r>165&&a>=.18?"#202124":a>=.12&&s<.78?"#ffffff":1.28*eJ(s,1)>=eJ(s,0)?"#ffffff":"#202124"}(e)?"text-white/90":"text-[#202124]"}let e0=new Map([["bg-gray-300","#d1d5db"],["bg-gray-400","#9ca3af"],["bg-gray-500","#6b7280"],["bg-gray-600","#4b5563"],["bg-gray-700","#374151"],["bg-slate-300","#cbd5e1"],["bg-slate-400","#94a3b8"],["bg-slate-500","#64748b"],["bg-slate-600","#475569"],["bg-slate-700","#334155"],["bg-red-300","#fca5a5"],["bg-red-400","#f87171"],["bg-red-500","#ef4444"],["bg-red-600","#dc2626"],["bg-red-700","#b91c1c"],["bg-orange-300","#fdba74"],["bg-orange-400","#fb923c"],["bg-orange-500","#f97316"],["bg-orange-600","#ea580c"],["bg-orange-700","#c2410c"],["bg-amber-300","#fcd34d"],["bg-amber-400","#fbbf24"],["bg-amber-500","#f59e0b"],["bg-amber-600","#d97706"],["bg-amber-700","#b45309"],["bg-yellow-300","#fde047"],["bg-yellow-400","#facc15"],["bg-yellow-500","#eab308"],["bg-yellow-600","#ca8a04"],["bg-yellow-700","#a16207"],["bg-lime-300","#bef264"],["bg-lime-400","#a3e635"],["bg-lime-500","#84cc16"],["bg-lime-600","#65a30d"],["bg-lime-700","#4d7c0f"],["bg-emerald-300","#6ee7b7"],["bg-emerald-400","#34d399"],["bg-emerald-500","#10b981"],["bg-emerald-600","#059669"],["bg-emerald-700","#047857"],["bg-teal-300","#5eead4"],["bg-teal-400","#2dd4bf"],["bg-teal-500","#14b8a6"],["bg-teal-600","#0d9488"],["bg-teal-700","#0f766e"],["bg-cyan-400","#22d3ee"],["bg-cyan-500","#06b6d4"],["bg-sky-300","#7dd3fc"],["bg-sky-400","#38bdf8"],["bg-sky-500","#0ea5e9"],["bg-sky-600","#0284c7"],["bg-sky-700","#0369a1"],["bg-blue-300","#93c5fd"],["bg-blue-400","#60a5fa"],["bg-blue-500","#3b82f6"],["bg-blue-600","#2563eb"],["bg-blue-700","#1d4ed8"],["bg-indigo-300","#a5b4fc"],["bg-indigo-400","#818cf8"],["bg-indigo-500","#6366f1"],["bg-indigo-600","#4f46e5"],["bg-indigo-700","#4338ca"],["bg-violet-400","#a78bfa"],["bg-violet-500","#8b5cf6"],["bg-purple-300","#d8b4fe"],["bg-purple-400","#c084fc"],["bg-purple-500","#a855f7"],["bg-purple-600","#9333ea"],["bg-purple-700","#7e22ce"],["bg-fuchsia-500","#d946ef"],["bg-pink-300","#f9a8d4"],["bg-pink-400","#f472b6"],["bg-pink-500","#ec4899"],["bg-pink-600","#db2777"],["bg-pink-700","#be185d"],["bg-green-400","#4ade80"],["bg-green-500","#22c55e"],["bg-rose-400","#fb7185"],["bg-rose-500","#f43f5e"]]);function e1(e){return e0.get(e.trim())??null}function e2(e){let t=e.trim(),s=e1(t);if(s)return s;let a=t.match(/^bg-\[(#[\da-fA-F]{3,8})\]$/);return a?.[1]?a[1]:"#9ca3af"}function e3(e){let t=e1(e);if(!t){let t=e.toLowerCase();return/(^|-)(gray|slate|zinc|stone|neutral)(-|$)/.test(t)?"text-[#202124]":"text-white/90"}return eX(t)}function e5(e,t){return e?t?"fluent:folder-open-20-filled":"fluent:folder-list-20-filled":"fluent:folder-20-filled"}(0,eO.CQ)(eG.Pt);var e4=s(53497),e6=s(35019),e8=s(12546),e7=s(37841);function e9({checked:e,onPick:t,children:s}){return(0,a.jsxs)(z._2,{onClick:e=>{e.stopPropagation(),t()},className:eo.Sh,children:[(0,a.jsx)("span",{className:"min-w-0 flex-1 text-left",children:s}),(0,a.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center","aria-hidden":!e,children:e?(0,a.jsx)(e6.A,{className:"size-4 text-foreground",strokeWidth:2,"aria-hidden":!0}):null})]})}function te({checked:e,onPick:t,children:s}){return(0,a.jsxs)(e7.kt,{onClick:()=>t(),className:eo.Sh,children:[(0,a.jsx)("span",{className:"min-w-0 flex-1 text-left",children:s}),(0,a.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center","aria-hidden":!e,children:e?(0,a.jsx)(e6.A,{className:"size-4 text-foreground",strokeWidth:2,"aria-hidden":!0}):null})]})}function tt(e){return e?"rounded-r-full":"rounded-r-none hover:rounded-r-full"}function ts({show:e}){return e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"pointer-events-none absolute -right-0.5 -top-0.5 size-2 rounded-full bg-yellow-400 opacity-75 motion-reduce:animate-none animate-ping","aria-hidden":!0}),(0,a.jsx)("span",{className:"pointer-events-none absolute -right-0.5 -top-0.5 size-2 rounded-full bg-yellow-400","aria-hidden":!0})]}):null}function ta({showUnreadDot:e,children:t}){return(0,a.jsxs)("span",{className:"relative flex h-5 w-5 shrink-0 items-center justify-center",children:[t,(0,a.jsx)(ts,{show:!!e})]})}function tn(e,t){e&&(t?e.setAttribute("data-nav-drop",t):e.removeAttribute("data-nav-drop"))}function tr(e,t){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t())}function tl({hasChildren:e,open:t,colorBgClass:s,className:n,style:r}){return(0,a.jsx)(eO.In,{icon:e5(e,t),className:(0,ec.cn)("h-5 w-5 shrink-0",n),style:{color:e2(s),...r},"aria-hidden":!0})}function ti({label:e,onDragStart:t,onDragEnd:s}){return(0,a.jsx)("span",{draggable:!0,title:`R\xe9organiser : ${e}`,"aria-label":`R\xe9organiser : ${e}`,onDragStart:t,onDragEnd:s,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),className:"pointer-events-none absolute left-0 top-1/2 z-10 flex h-8 w-4 -translate-y-1/2 cursor-grab items-center justify-center text-gray-400 opacity-0 transition-opacity hover:opacity-100 active:cursor-grabbing group-hover/folderrow:pointer-events-auto group-hover/folderrow:opacity-100 group-hover/labelrow:pointer-events-auto group-hover/labelrow:opacity-100",children:(0,a.jsx)(e8.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}let to={folderrow:"group-hover/folderrow:opacity-0",labelrow:"group-hover/labelrow:opacity-0",catnav:"group-hover/catnav:opacity-0"},tc={folderrow:"group-hover/folderrow:opacity-100 group-has-[button:focus-visible]/folderrow:opacity-100",labelrow:"group-hover/labelrow:opacity-100 group-has-[button:focus-visible]/labelrow:opacity-100",catnav:"group-hover/catnav:opacity-100 group-has-[button:focus-visible]/catnav:opacity-100"};function td({unread:e,menuOpen:t,hoverGroup:s,isSelected:n,hasUnread:r,className:l,showMenuButton:i=!0,children:o}){return i?(0,a.jsxs)("div",{className:(0,ec.cn)("relative h-8 w-8 shrink-0",l),children:[e>0&&(0,a.jsx)("span",{className:(0,ec.cn)("pointer-events-none absolute inset-0 flex items-center justify-center text-xs tabular-nums leading-none transition-opacity duration-150",n&&"font-medium",r&&!n&&"font-semibold",t?"opacity-0":to[s]),children:(0,ec.B)(e)}),(0,a.jsx)("div",{className:(0,ec.cn)("absolute inset-0 flex items-center justify-center opacity-0 transition-opacity duration-150",t?"opacity-100":tc[s]),children:o})]}):e<=0?null:(0,a.jsx)("div",{className:(0,ec.cn)("relative h-8 w-8 shrink-0",l),children:(0,a.jsx)("span",{className:(0,ec.cn)("flex h-full items-center justify-center text-xs tabular-nums leading-none",n&&"font-medium",r&&!n&&"font-semibold"),children:(0,ec.B)(e)})})}let tu=eo.sF;var tm=s(75681),th=s(65879);let tx=new Set,tf={x:0,y:0},tp=null;function tb(){for(let e of(tp=null,tx))e()}function tg(){return tf}function tv(e){return tx.add(e),()=>{tx.delete(e)}}function tj(e,t){for(let s of(null!==tp&&(globalThis.cancelAnimationFrame(tp),tp=null),tf={x:e,y:t},tx))s()}let tw=(0,n.createContext)(null);function ty({children:e}){let t=(0,r.LZ)(),[s,l]=(0,n.useState)(null),i=(0,n.useRef)(null),o=(0,n.useRef)(null);(0,n.useEffect)(()=>{i.current=s},[s]),(0,n.useEffect)(()=>{t&&(i.current=null,l(null),tj(0,0))},[t]);let c=(0,n.useCallback)((e,s,a,n)=>{if(t||0===e.length)return;let r={ids:e,sourceFolderId:s,hoveredTargetId:null,hoveredTargetLabel:null,pointerX:a,pointerY:n,originX:a,originY:n,phase:"dragging"};i.current=r,tj(a,n),l(r)},[t]),d=(0,n.useCallback)((e,t)=>{l(s=>s&&"dragging"===s.phase&&s.hoveredTargetId!==e?{...s,hoveredTargetId:e,hoveredTargetLabel:t}:s)},[]),u=(0,n.useCallback)(e=>{l(t=>t&&t.hoveredTargetId===e?{...t,hoveredTargetId:null,hoveredTargetLabel:null}:t)},[]),m=(0,n.useCallback)(()=>{let e=i.current;if(!e||"returning"===e.phase)return;let t=tg(),s={...e,phase:"returning",hoveredTargetId:null,hoveredTargetLabel:null,pointerX:t.x,pointerY:t.y};i.current=s,l(s)},[]),h=(0,n.useCallback)((e,t)=>{let s=i.current;if(s&&(i.current=null,l(null),tj(0,0),e!==s.sourceFolderId&&o.current)){let a=o.current,n=s.ids;queueMicrotask(()=>a(e,t,n))}},[]),x=(0,n.useCallback)(e=>(o.current=e,()=>{o.current===e&&(o.current=null)}),[]);(0,n.useEffect)(()=>{if(!s||"dragging"!==s.phase)return;let e=e=>{tf={x:e.clientX,y:e.clientY},null===tp&&(tp=globalThis.requestAnimationFrame(tb))},t=()=>{let e=i.current;if(!e||"returning"===e.phase)return;let t=tg(),s={...e,phase:"returning",hoveredTargetId:null,hoveredTargetLabel:null,pointerX:t.x,pointerY:t.y};i.current=s,l(s)};return window.addEventListener("dragover",e),window.addEventListener("dragend",t),()=>{window.removeEventListener("dragover",e),window.removeEventListener("dragend",t)}},[s]),(0,n.useEffect)(()=>{if(s?.phase!=="returning")return;let e=window.setTimeout(()=>{i.current=null,l(null),tj(0,0)},260);return()=>window.clearTimeout(e)},[s?.phase]);let f=(0,n.useMemo)(()=>({state:s,beginDrag:c,setHoveredTarget:d,clearHoveredTarget:u,completeDrop:h,cancelDrag:m,registerOnDrop:x}),[s,c,d,u,h,m,x]);return(0,a.jsx)(tw.Provider,{value:f,children:e})}function tk(){let e=(0,n.useContext)(tw);if(!e)throw Error("useEmailDrag must be used inside <EmailDragProvider>");return e}let tN={onDragEnter:()=>{},onDragOver:()=>{},onDragLeave:()=>{},onDrop:()=>{}};function tC(e,t){let s=(0,r.LZ)(),{state:a,setHoveredTarget:n,clearHoveredTarget:l,completeDrop:i}=tk();if(s)return{isOver:!1,acceptsDrop:!1,isSource:!1,dropHandlers:tN};let o=null!==a&&"dragging"===a.phase,c=!!a&&a.sourceFolderId===e,d=o&&!c,u=!!a&&a.hoveredTargetId===e;return{isOver:d&&u,acceptsDrop:d,isSource:c,dropHandlers:{onDragEnter:s=>{d&&(s.preventDefault(),n(e,t))},onDragOver:s=>{d&&(s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect="move"),u||n(e,t))},onDragLeave:t=>{if(!d)return;let s=t.relatedTarget;s&&t.currentTarget instanceof Node&&t.currentTarget.contains(s)||l(e)},onDrop:s=>{d&&(s.preventDefault(),i(e,t))}}}}var tS=s(31047),tA=s(163);function tM({color:e,className:t,rounded:s="sm"}){let n=(0,tA.W)(e);return(0,a.jsx)("span",{className:(0,ec.cn)("block size-3 shrink-0 border border-black/10","full"===s?"rounded-full":"rounded-sm",n,t),"aria-hidden":!0})}var tI=s(90582);function tE({children:e,onClick:t,destructive:s}){return(0,a.jsx)("button",{type:"button",className:(0,ec.cn)("flex w-full items-center gap-3 px-4 py-3 text-left text-sm transition-colors active:bg-[#e8eaed]",s?"text-red-600 hover:bg-red-50 active:bg-red-100":"text-[#3c4043] hover:bg-[#f1f3f4]"),onClick:t,children:e})}function tz({children:e}){return(0,a.jsx)("div",{className:"px-4 py-1.5 text-[11px] font-medium uppercase tracking-wide text-[#5f6368]",children:e})}function t$(){return(0,a.jsx)("div",{className:"mx-4 border-b border-[#eceff1]"})}function tL({checked:e,onPick:t,children:s}){return(0,a.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between gap-3 px-4 py-3 text-left text-sm text-[#3c4043] transition-colors hover:bg-[#f1f3f4] active:bg-[#e8eaed]",onClick:t,children:[(0,a.jsx)("span",{className:"min-w-0 flex-1",children:s}),(0,a.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center","aria-hidden":!e,children:e?(0,a.jsx)(e6.A,{className:"size-4 text-gray-900",strokeWidth:2}):null})]})}function tD({title:e,dotClass:t,swatches:s,onPick:n}){return(0,a.jsxs)("div",{className:"px-4 py-2",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-sm text-[#3c4043]",children:[(0,a.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full border border-gray-300 bg-white",children:(0,a.jsx)(tM,{color:t})}),e]}),(0,a.jsx)(tI.P,{variant:"sheet",value:t,swatches:s,onChange:n})]})}function tT({open:e,onOpenChange:t,title:s,colorDotClass:n,children:r}){return(0,a.jsx)(ep.cj,{open:e,onOpenChange:t,children:(0,a.jsxs)(ep.h,{side:"bottom",hideClose:!0,className:"max-h-[min(85vh,560px)] gap-0 overflow-hidden rounded-t-2xl border-[#dadce0] px-0 pb-[max(1rem,env(safe-area-inset-bottom))] pt-0 select-none left-1/2 right-auto w-[calc(100%-2rem)] max-w-md -translate-x-1/2 sm:max-w-lg",children:[(0,a.jsxs)("div",{className:"relative flex items-center gap-3 border-b border-[#eceff1] px-4 py-3 pr-12",children:[n?(0,a.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full border border-gray-300 bg-white","aria-hidden":!0,children:(0,a.jsx)(tM,{color:n})}):null,(0,a.jsx)(ep.qp,{className:"min-w-0 flex-1 truncate text-left text-base font-medium leading-5 text-[#3c4043]",children:s}),(0,a.jsx)(ep.kN,{className:"absolute right-4 top-1/2 flex size-8 -translate-y-1/2 items-center justify-center rounded-xs text-[#5f6368] opacity-80 outline-none transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50","aria-label":"Fermer",children:(0,a.jsx)(S.A,{className:"size-4"})})]}),(0,a.jsx)("div",{className:"flex flex-col overflow-y-auto py-1",children:r})]})})}var t_=s(74036);function tR(e){let[t,s]=(0,n.useState)(!1),a=(0,n.useRef)(0),r=(0,n.useCallback)(()=>{let e=Date.now();e-a.current<400||(a.current=e,s(!0))},[]),l=(0,t_.H)(r,{disabled:!e}),i=e?{onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),r()},onPointerDown:l.onPointerDown,onPointerUp:l.onPointerUp,onPointerLeave:l.onPointerLeave,onPointerCancel:l.onPointerCancel,onClickCapture:l.onClickCapture}:{},o=e?(0,ec.cn)("select-none",l.ackClassName):void 0,c=(0,n.useCallback)(()=>s(!1),[]);return{sheetOpen:t,setSheetOpen:s,touchRowProps:i,touchRowClassName:o,closeSheet:c}}function tP({item:e,isSelected:t,isExpanded:s,unreadCount:r,onSelectFolder:l,onDisableNavLabel:i,onEnableNavLabel:o,touchNav:c,variant:d="listed"}){let{isOver:u,dropHandlers:m}=tC(e.id,e.label),[h,x]=(0,n.useState)(!1),f=(0,n.useRef)(null),p="hidden"===d,b=(0,tS.Y3)(e.id)&&s,g=r>0,{sheetOpen:v,setSheetOpen:j,touchRowProps:w,touchRowClassName:y,closeSheet:k}=tR(c&&(p||b)),N=e=>{x(e),e||queueMicrotask(()=>f.current?.blur())},C=!p&&!t&&!u&&(h||v),S=e.icon?(0,a.jsx)(eO.In,{icon:e.icon,className:(0,ec.cn)("h-5 w-5 shrink-0",p&&"opacity-70",g&&!t&&!p&&"text-gray-900"),"aria-hidden":!0}):(0,a.jsx)(tm.A,{className:(0,ec.cn)("h-5 w-5 shrink-0",p&&"opacity-70",g&&!t&&!p&&"text-gray-900"),"aria-hidden":!0});return p?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{...m,...w,className:(0,ec.cn)("flex h-8 w-full min-w-0 shrink-0 items-center pl-6 pr-2 text-gray-500 transition-colors",u?"rounded-r-full":"rounded-r-none",u&&"bg-mail-nav-drop text-foreground",y),children:[(0,a.jsxs)("button",{type:"button",onClick:()=>l(e.id),className:"flex h-8 min-w-0 flex-1 items-center gap-4 rounded-r-none py-0 pr-1 text-left outline-none hover:rounded-r-full hover:bg-gray-50",children:[S,(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-baseline gap-4",children:[(0,a.jsx)("span",{className:(0,ec.cn)("min-w-0 flex-1 truncate text-sm leading-5",g&&"font-semibold text-gray-900"),children:e.label}),r>0&&(0,a.jsx)("span",{className:(0,ec.cn)("shrink-0 text-xs tabular-nums leading-none text-gray-700",g&&"font-semibold"),children:(0,ec.B)(r)})]})]}),!c&&(0,a.jsxs)(z.rI,{open:h,onOpenChange:N,children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)("button",{ref:f,type:"button",className:tu,"aria-label":`Options pour ${e.label}`,onClick:e=>e.stopPropagation(),children:(0,a.jsx)(th.A,{className:"h-4 w-4"})})}),(0,a.jsx)(z.SQ,{align:"end",className:"min-w-40",children:(0,a.jsx)(z._2,{onClick:()=>{o(e.id),x(!1)},children:"R\xe9activer le libell\xe9"})})]})]}),c&&(0,a.jsx)(tT,{open:v,onOpenChange:j,title:e.label,children:(0,a.jsx)(tE,{onClick:()=>{o(e.id),k()},children:"R\xe9activer le libell\xe9"})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{...m,...w,className:(0,ec.cn)("group/catnav flex h-8 w-full min-w-0 shrink-0 cursor-pointer items-center pl-6 pr-2 transition-colors",tt(t||u||C),t?"bg-mail-nav-selected text-mail-nav-selected font-medium":u?"bg-mail-nav-drop text-foreground":C?"bg-mail-nav-hover text-foreground":g?"text-gray-900 hover:bg-mail-nav-hover":"text-gray-700 hover:bg-mail-nav-hover",y),children:[(0,a.jsxs)("button",{type:"button",onClick:()=>l(e.id),title:s?void 0:e.label,className:(0,ec.cn)("flex h-8 min-w-0 flex-1 cursor-pointer items-center gap-4 py-0 text-left outline-none",b?"pr-1":"pr-3"),children:[(0,a.jsx)(ta,{showUnreadDot:g,children:S}),s&&(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-baseline gap-4",children:[(0,a.jsx)("span",{className:(0,ec.cn)("min-w-0 flex-1 truncate text-sm leading-5",g&&!t&&"font-semibold text-gray-900"),children:e.label}),!b&&r>0&&(0,a.jsx)("span",{className:(0,ec.cn)("shrink-0 text-xs tabular-nums leading-none",t&&"font-medium",g&&!t&&"font-semibold"),children:(0,ec.B)(r)})]})]}),b&&(0,a.jsx)(td,{unread:r,menuOpen:h||v,hoverGroup:"catnav",isSelected:t,hasUnread:g,className:"mr-[-7px]",showMenuButton:!c,children:!c&&(0,a.jsxs)(z.rI,{open:h,onOpenChange:N,children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)("button",{ref:f,type:"button",className:(0,ec.cn)(tu,t&&"text-gray-900"),"aria-label":`Options pour ${e.label}`,onClick:e=>{e.stopPropagation()},children:(0,a.jsx)(th.A,{className:"h-4 w-4"})})}),(0,a.jsxs)(z.SQ,{align:"end",className:"min-w-40",children:[(0,a.jsx)(z._2,{disabled:!0,className:"text-gray-400",children:"Afficher"}),(0,a.jsx)(z._2,{onClick:()=>{i(e.id),x(!1)},children:"D\xe9sactiver le libell\xe9"})]})]})})]}),c&&b&&(0,a.jsxs)(tT,{open:v,onOpenChange:j,title:e.label,children:[(0,a.jsx)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:"Afficher"}),(0,a.jsx)(tE,{onClick:()=>{i(e.id),k()},children:"D\xe9sactiver le libell\xe9"})]})]})}function tF({item:e,isSelected:t,unreadCount:s,isExpanded:n,onSelectFolder:r}){let{isOver:l,dropHandlers:i}=tC(e.id,e.label),o=s>0,c=(0,ec.cn)("h-5 w-5 shrink-0",o&&!t&&"text-gray-900");return(0,a.jsxs)("button",{onClick:()=>r(e.id),title:n?void 0:e.label,...i,className:(0,ec.cn)("flex h-8 w-full min-w-0 shrink-0 cursor-pointer items-center gap-4 pl-6 pr-3 transition-colors",tt(t||l),t?"bg-mail-nav-selected text-mail-nav-selected font-medium":l?"bg-mail-nav-drop text-foreground":o?"text-gray-900 hover:bg-mail-nav-hover":"text-gray-700 hover:bg-mail-nav-hover"),children:["string"==typeof e.icon?(0,a.jsx)(eO.In,{icon:e.icon,className:c,"aria-hidden":!0}):(0,a.jsx)(e.icon,{className:c}),n&&(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-baseline gap-4",children:[(0,a.jsx)("span",{className:(0,ec.cn)("min-w-0 flex-1 truncate text-left text-sm leading-5",o&&!t&&"font-semibold text-gray-900"),children:e.label}),s>0&&(0,a.jsx)("span",{className:(0,ec.cn)("shrink-0 text-xs tabular-nums leading-none",t&&"font-medium",o&&!t&&"font-semibold"),children:(0,ec.B)(s)})]})]})}let tO="application/x-ultimail-sidebar-nav";function tq(e,t){let s=JSON.stringify(t);e.dataTransfer.setData(tO,s),e.dataTransfer.setData("text/plain",s),e.dataTransfer.effectAllowed="move"}function tW(e,t=null){for(let t of[tO,"text/plain"]){let s=e.dataTransfer.getData(t);if(s)try{let e=JSON.parse(s);if((e?.kind==="label"||e?.kind==="folder")&&"string"==typeof e.id&&e.id.length>0)return e}catch{}}return t}function tB(e,t){let s=e.currentTarget.getBoundingClientRect(),a=(e.clientY-s.top)/Math.max(s.height,1);return t?a<.25?"before":a>.75?"after":"inside":a<.5?"before":"after"}function tU({item:e,unreadCount:t,isExpanded:s,selectedFolder:r,touchNav:l,onSelectFolder:i,getNavItemPrefs:o,setNavItemSidebarVisibility:c,setNavItemMessageVisibility:d,updateFolderOrLabelColor:u,renameFolderOrLabel:m,removeFolderOrLabelRow:h,addChildLabelRow:x,navDragRef:f,navDropPlacementRef:p,beginNavDrag:b,clearNavDrag:g,updateNavDropTarget:v,clearNavDropTarget:j,commitNavDrop:w}){let{isOver:y,dropHandlers:k}=tC(e.id,e.label),N=r===e.id,C=t>0,[S,A]=(0,n.useState)(!1),[M,I]=(0,n.useState)(!1),$=(0,n.useRef)(null),[L,D]=(0,n.useState)(!1),[T,_]=(0,n.useState)(e.label),[R,P]=(0,n.useState)(!1),[F,O]=(0,n.useState)(""),q=(0,n.useRef)(null),W=(0,n.useRef)(null),B=s&&!(0,tS.Y3)(e.id),{sheetOpen:U,setSheetOpen:H,touchRowProps:V,touchRowClassName:K,closeSheet:Q}=tR(l&&s);(0,n.useEffect)(()=>{_(e.label)},[e.label]);let G=!N&&!y&&(M||S||U),Y=o(e.id),Z=(0,tA.W)(e.color),J=eo.gS,X=t=>{let s="dropdown"===t?z.lv:e7.Fj,n="dropdown"===t?z.nV:e7.Pd,r="dropdown"===t?z.M5:e7.es;return(0,a.jsxs)(s,{children:[(0,a.jsxs)(n,{className:(0,ec.cn)(eo.Un,"context"===t&&"flex items-center gap-2"),children:[(0,a.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full border border-border bg-mail-surface",children:(0,a.jsx)("span",{className:(0,ec.cn)("block size-3 rounded-sm border border-black/10",Z),"aria-hidden":!0})}),(0,a.jsx)("span",{className:"flex-1 text-left text-sm",children:"Couleur du libell\xe9"})]}),(0,a.jsx)(r,{className:eo.$i,children:(0,a.jsx)(tI.P,{variant:"menu",value:Z,swatches:e4.ef,onChange:t=>{u(e.id,t),A(!1)}})})]})},ee=(0,ec.cn)("group/labelrow relative flex h-8 w-full min-w-0 shrink-0 cursor-default items-center pl-6 pr-2 transition-colors",tt(N||y||G),N?"bg-mail-nav-selected text-mail-nav-selected font-medium":y?"bg-mail-nav-drop text-foreground":G?"bg-mail-nav-hover text-foreground":C?"text-gray-900 hover:bg-mail-nav-hover":"text-gray-700 hover:bg-mail-nav-hover",K),et=s?(0,a.jsx)(td,{unread:t,menuOpen:S||U,hoverGroup:"labelrow",isSelected:N,hasUnread:C,className:"mr-[-7px]",showMenuButton:!l,children:!l&&(0,a.jsxs)(z.rI,{open:S,onOpenChange:e=>{A(e),e||queueMicrotask(()=>$.current?.blur())},children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)("button",{ref:$,type:"button",draggable:!1,className:(0,ec.cn)(tu,N&&"text-gray-900"),"aria-label":`Options pour ${e.label}`,onClick:e=>e.stopPropagation(),children:(0,a.jsx)(th.A,{className:"h-4 w-4"})})}),(0,a.jsxs)(z.SQ,{align:"end",className:J,children:[X("dropdown"),(0,a.jsx)(z.mB,{className:eo.AO}),(0,a.jsx)(z.lp,{className:"px-3 py-1 text-[11px] font-normal normal-case tracking-normal text-muted-foreground",children:"Dans la liste des libell\xe9s"}),(0,a.jsx)(e9,{checked:"show"===Y.sidebar,onPick:()=>c(e.id,"show"),children:"Afficher"}),(0,a.jsx)(e9,{checked:"showUnread"===Y.sidebar,onPick:()=>c(e.id,"showUnread"),children:"Afficher si messages non lus"}),(0,a.jsx)(e9,{checked:"hide"===Y.sidebar,onPick:()=>c(e.id,"hide"),children:"Masquer"}),(0,a.jsx)(z.mB,{className:eo.AO}),(0,a.jsx)(z.lp,{className:"px-3 py-1 text-[11px] font-normal normal-case tracking-normal text-muted-foreground",children:"Dans la liste des messages"}),(0,a.jsx)(e9,{checked:"show"===Y.messages,onPick:()=>d(e.id,"show"),children:"Afficher"}),(0,a.jsx)(e9,{checked:"hide"===Y.messages,onPick:()=>d(e.id,"hide"),children:"Masquer"}),(0,a.jsx)(z.mB,{className:eo.AO}),(0,a.jsx)(z._2,{className:eo.l9,onClick:()=>{_(e.label),D(!0),A(!1)},children:"Renommer…"}),(0,a.jsx)(z._2,{variant:"destructive",className:"mx-1 cursor-pointer px-3 py-2 text-sm focus:bg-destructive/15",onClick:()=>{h(e.id),A(!1)},children:"Supprimer le libell\xe9"}),(0,a.jsx)(z._2,{className:eo.l9,onClick:()=>{O(""),P(!0),A(!1)},children:"Ajouter un sous-libell\xe9"})]})]})}):null,es=l&&s&&(0,a.jsxs)(tT,{open:U,onOpenChange:H,title:e.label,colorDotClass:Z,children:[(0,a.jsx)(tD,{title:"Couleur du libell\xe9",dotClass:Z,swatches:e4.ef,onPick:t=>{u(e.id,t),Q()}}),(0,a.jsx)(t$,{}),(0,a.jsx)(tz,{children:"Dans la liste des libell\xe9s"}),(0,a.jsx)(tL,{checked:"show"===Y.sidebar,onPick:()=>{c(e.id,"show"),Q()},children:"Afficher"}),(0,a.jsx)(tL,{checked:"showUnread"===Y.sidebar,onPick:()=>{c(e.id,"showUnread"),Q()},children:"Afficher si messages non lus"}),(0,a.jsx)(tL,{checked:"hide"===Y.sidebar,onPick:()=>{c(e.id,"hide"),Q()},children:"Masquer"}),(0,a.jsx)(t$,{}),(0,a.jsx)(tz,{children:"Dans la liste des messages"}),(0,a.jsx)(tL,{checked:"show"===Y.messages,onPick:()=>{d(e.id,"show"),Q()},children:"Afficher"}),(0,a.jsx)(tL,{checked:"hide"===Y.messages,onPick:()=>{d(e.id,"hide"),Q()},children:"Masquer"}),(0,a.jsx)(t$,{}),(0,a.jsx)(tE,{onClick:()=>{_(e.label),D(!0),Q()},children:"Renommer…"}),(0,a.jsx)(tE,{destructive:!0,onClick:()=>{h(e.id),Q()},children:"Supprimer le libell\xe9"}),(0,a.jsx)(tE,{onClick:()=>{O(""),P(!0),Q()},children:"Ajouter un sous-libell\xe9"})]}),ea=(0,a.jsxs)("div",{"data-nav-row":!0,...V,onDragEnter:t=>{let s=f.current;s?.kind==="label"&&s.id!==e.id?t.preventDefault():k.onDragEnter(t)},onDragOver:t=>{let s=f.current;if(s?.kind==="label"){if(t.preventDefault(),t.stopPropagation(),s.id===e.id)return;t.dataTransfer.dropEffect="move",v(t.currentTarget,tB(t,!1));return}k.onDragOver(t)},onDragLeave:e=>{if(f.current?.kind==="label"){let t=e.relatedTarget;if(t&&e.currentTarget instanceof Node&&e.currentTarget.contains(t))return;j(e.currentTarget);return}k.onDragLeave(e)},onDrop:t=>{let s=tW(t,f.current);if(s?.kind==="label"){t.preventDefault(),t.stopPropagation();let a=p.current??tB(t,!1);"inside"!==a?w(s,e.id,a,"label"):g();return}k.onDrop(t)},className:ee,children:[B?(0,a.jsx)(ti,{label:e.label,onDragStart:t=>{let s={kind:"label",id:e.id};tq(t,s),b(s,t.currentTarget.closest("[data-nav-row]"))},onDragEnd:g}):null,(0,a.jsxs)("div",{role:"button",tabIndex:0,title:s?void 0:e.label,onClick:()=>i(e.id),onKeyDown:t=>tr(t,()=>i(e.id)),className:(0,ec.cn)("flex h-8 min-w-0 flex-1 cursor-pointer items-center gap-4 py-0 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/50",s?"pr-1":"pr-3"),children:[(0,a.jsx)(ta,{showUnreadDot:C,children:(0,a.jsx)("span",{className:(0,ec.cn)("block h-3 w-3 rounded-sm",e.color??"bg-gray-400")})}),s&&(0,a.jsx)("span",{className:(0,ec.cn)("min-w-0 flex-1 truncate text-sm leading-5",C&&!N&&"font-semibold text-gray-900"),children:e.label})]}),et]});return(0,a.jsxs)(a.Fragment,{children:[l?ea:(0,a.jsxs)(e7.tz,{onOpenChange:I,children:[(0,a.jsx)(e7.Rc,{asChild:!0,children:ea}),(0,a.jsxs)(e7.Ip,{className:J,children:[X("context"),(0,a.jsx)(e7.K5,{className:eo.AO}),(0,a.jsx)(e7.F7,{className:"px-3 py-1 text-[11px] font-normal normal-case tracking-normal text-muted-foreground",children:"Dans la liste des libell\xe9s"}),(0,a.jsx)(te,{checked:"show"===Y.sidebar,onPick:()=>c(e.id,"show"),children:"Afficher"}),(0,a.jsx)(te,{checked:"showUnread"===Y.sidebar,onPick:()=>c(e.id,"showUnread"),children:"Afficher si non lus"}),(0,a.jsx)(te,{checked:"hide"===Y.sidebar,onPick:()=>c(e.id,"hide"),children:"Masquer"}),(0,a.jsx)(e7.K5,{className:eo.AO}),(0,a.jsx)(e7.F7,{className:"px-3 py-1 text-[11px] font-normal normal-case tracking-normal text-muted-foreground",children:"Dans la liste des messages"}),(0,a.jsx)(te,{checked:"show"===Y.messages,onPick:()=>d(e.id,"show"),children:"Afficher"}),(0,a.jsx)(te,{checked:"hide"===Y.messages,onPick:()=>d(e.id,"hide"),children:"Masquer"}),(0,a.jsx)(e7.K5,{className:"my-1.5 bg-gray-200"}),(0,a.jsx)(e7.kt,{className:"mx-1 cursor-pointer px-3 py-2 text-sm",onClick:()=>{_(e.label),D(!0)},children:"Renommer…"}),(0,a.jsx)(e7.kt,{variant:"destructive",className:"mx-1 cursor-pointer px-3 py-2 text-sm",onClick:()=>h(e.id),children:"Supprimer le libell\xe9"}),(0,a.jsx)(e7.kt,{className:"mx-1 cursor-pointer px-3 py-2 text-sm",onClick:()=>{O(""),P(!0)},children:"Ajouter un sous-libell\xe9"})]})]}),es,(0,a.jsx)(eW.lG,{open:L,onOpenChange:D,children:(0,a.jsxs)(eW.Cf,{className:"sm:max-w-md",showCloseButton:!0,onOpenAutoFocus:e=>{e.preventDefault(),window.requestAnimationFrame(()=>q.current?.focus())},children:[(0,a.jsxs)(eW.c7,{children:[(0,a.jsx)(eW.L3,{children:"Renommer le libell\xe9"}),(0,a.jsxs)(eW.rr,{children:["Nouveau nom pour \xab ",e.label," \xbb."]})]}),(0,a.jsx)(eM.p,{ref:q,value:T,onChange:e=>_(e.target.value),autoComplete:"off",onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),m(e.id,T),D(!1))}}),(0,a.jsxs)(eW.Es,{children:[(0,a.jsx)(E.$,{variant:"outline",type:"button",onClick:()=>D(!1),children:"Annuler"}),(0,a.jsx)(E.$,{type:"button",onClick:()=>{m(e.id,T),D(!1)},children:"Enregistrer"})]})]})}),(0,a.jsx)(eW.lG,{open:R,onOpenChange:P,children:(0,a.jsxs)(eW.Cf,{className:"sm:max-w-md",showCloseButton:!0,onOpenAutoFocus:e=>{e.preventDefault(),window.requestAnimationFrame(()=>W.current?.focus())},children:[(0,a.jsxs)(eW.c7,{children:[(0,a.jsx)(eW.L3,{children:"Sous-libell\xe9"}),(0,a.jsxs)(eW.rr,{children:["Sera cr\xe9\xe9 sous \xab ",e.label," \xbb (chemin type Parent/Enfant)."]})]}),(0,a.jsx)(eM.p,{ref:W,value:F,onChange:e=>O(e.target.value),placeholder:"Nom du sous-libell\xe9",autoComplete:"off",onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),x(e.id,F),P(!1))}}),(0,a.jsxs)(eW.Es,{children:[(0,a.jsx)(E.$,{variant:"outline",type:"button",onClick:()=>P(!1),children:"Annuler"}),(0,a.jsx)(E.$,{type:"button",onClick:()=>{x(e.id,F),P(!1)},children:"Cr\xe9er"})]})]})})]})}var tH=s(54589),tV=s(76706);function tK({node:e,depth:t,selectedFolder:s,folderUnreadCounts:r,expandedFolderIds:l,isExpanded:i,isOverlayOpen:o,touchNav:c,folderTree:d,onSelectFolder:u,toggleFolderExpanded:m,getNavItemPrefs:h,setNavItemSidebarVisibility:x,setNavItemMessageVisibility:f,updateFolderOrLabelColor:p,renameFolderOrLabel:b,removeFolderOrLabelRow:g,moveFolder:v,addSubfolder:j,navDragRef:w,navDropPlacementRef:y,beginNavDrag:k,clearNavDrag:N,updateNavDropTarget:C,clearNavDropTarget:S,commitNavDrop:A}){let{isOver:M,dropHandlers:I}=tC(e.id,e.label),$=!!e.children?.length,L=l.has(e.id),D=(0,tA.W)(e.color),T=s===e.id,_=r[e.id]??0,R=_>0,P=$&&L,F=(0,e4.IL)(t),O=(0,e4.vP)(t),[q,W]=(0,n.useState)(!1),[B,U]=(0,n.useState)(!1),H=(0,n.useRef)(null),[V,K]=(0,n.useState)(!1),[Q,G]=(0,n.useState)(e.label),[Y,Z]=(0,n.useState)(!1),[J,X]=(0,n.useState)("__root__"),[ee,et]=(0,n.useState)(!1),[es,ea]=(0,n.useState)(""),en=(0,n.useRef)(null),er=(0,n.useRef)(null),{sheetOpen:el,setSheetOpen:ei,touchRowProps:ed,touchRowClassName:eu,closeSheet:em}=tR(c&&i);(0,n.useEffect)(()=>{G(e.label)},[e.label]);let eh=!T&&!M&&(B||q||el),ex=h(e.id),ef=(0,n.useMemo)(()=>(0,tH.YI)(d,e.id),[d,e.id]),ep=eo.gS,eb=t=>{let s="dropdown"===t?z.lv:e7.Fj,n="dropdown"===t?z.nV:e7.Pd,r="dropdown"===t?z.M5:e7.es;return(0,a.jsxs)(s,{children:[(0,a.jsxs)(n,{className:(0,ec.cn)(eo.Un,"context"===t&&"flex items-center gap-2"),children:[(0,a.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full border border-border bg-mail-surface",children:(0,a.jsx)("span",{className:(0,ec.cn)("block size-3 rounded-sm border border-black/10",D),"aria-hidden":!0})}),(0,a.jsx)("span",{className:"flex-1 text-left text-sm",children:"Couleur du dossier"})]}),(0,a.jsx)(r,{className:eo.$i,children:(0,a.jsx)(tI.P,{variant:"menu",value:D,swatches:e4.ef,onChange:t=>{p(e.id,t),W(!1)}})})]})},eg=(0,ec.cn)("group/folderrow relative flex h-8 w-full min-w-0 shrink-0 cursor-default items-center gap-2 pr-3 text-sm transition-colors",T||M||eh?"rounded-r-full":"rounded-r-none",P&&"sticky border-b border-gray-200/70",P&&eo.wf,T&&"bg-mail-nav-selected font-medium text-mail-nav-selected",!T&&R&&"text-gray-900",M&&"bg-mail-nav-drop text-foreground",eh&&"bg-mail-nav-hover text-foreground",eu),ev={paddingLeft:24+16*t,...P?{top:F,zIndex:O}:{}},ej=(0,a.jsx)(td,{unread:_,menuOpen:q||el,hoverGroup:"folderrow",isSelected:T,hasUnread:R,className:(0,ec.cn)(!i&&"hidden","mr-[-11px]"),showMenuButton:!c,children:!c&&(0,a.jsxs)(z.rI,{open:q,onOpenChange:e=>{W(e),e||queueMicrotask(()=>H.current?.blur())},children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)("button",{ref:H,type:"button",className:(0,ec.cn)(tu,T&&"text-gray-900"),"aria-label":`Options pour ${e.label}`,onClick:e=>e.stopPropagation(),children:(0,a.jsx)(th.A,{className:"h-4 w-4"})})}),(0,a.jsxs)(z.SQ,{align:"end",className:ep,children:[eb("dropdown"),(0,a.jsx)(z.mB,{className:eo.AO}),(0,a.jsx)(z.lp,{className:"px-3 py-1 text-[11px] font-normal normal-case tracking-normal text-muted-foreground",children:"Dans la liste des dossiers"}),(0,a.jsx)(e9,{checked:"show"===ex.sidebar,onPick:()=>x(e.id,"show"),children:"Afficher"}),(0,a.jsx)(e9,{checked:"showUnread"===ex.sidebar,onPick:()=>x(e.id,"showUnread"),children:"Afficher si messages non lus"}),(0,a.jsx)(e9,{checked:"hide"===ex.sidebar,onPick:()=>x(e.id,"hide"),children:"Masquer"}),(0,a.jsx)(z.mB,{className:eo.AO}),(0,a.jsx)(z.lp,{className:"px-3 py-1 text-[11px] font-normal normal-case tracking-normal text-muted-foreground",children:"Dans la liste des messages"}),(0,a.jsx)(e9,{checked:"show"===ex.messages,onPick:()=>f(e.id,"show"),children:"Afficher"}),(0,a.jsx)(e9,{checked:"hide"===ex.messages,onPick:()=>f(e.id,"hide"),children:"Masquer"}),(0,a.jsx)(z.mB,{className:eo.AO}),(0,a.jsx)(z._2,{className:eo.l9,onClick:()=>{G(e.label),K(!0),W(!1)},children:"Renommer…"}),(0,a.jsx)(z._2,{className:eo.l9,onClick:()=>{X("__root__"),Z(!0),W(!1)},children:"D\xe9placer…"}),(0,a.jsx)(z._2,{className:eo.l9,onClick:()=>{ea(""),et(!0),W(!1)},children:"Nouveau sous-dossier…"}),(0,a.jsx)(z._2,{variant:"destructive",className:"mx-1 cursor-pointer px-3 py-2 text-sm focus:bg-destructive/15",onClick:()=>{g(e.id),W(!1)},children:"Supprimer le dossier"})]})]})}),ew=c&&i&&(0,a.jsxs)(tT,{open:el,onOpenChange:ei,title:e.label,colorDotClass:D,children:[(0,a.jsx)(tD,{title:"Couleur du dossier",dotClass:D,swatches:e4.ef,onPick:t=>{p(e.id,t),em()}}),(0,a.jsx)(t$,{}),(0,a.jsx)(tz,{children:"Dans la liste des dossiers"}),(0,a.jsx)(tL,{checked:"show"===ex.sidebar,onPick:()=>{x(e.id,"show"),em()},children:"Afficher"}),(0,a.jsx)(tL,{checked:"showUnread"===ex.sidebar,onPick:()=>{x(e.id,"showUnread"),em()},children:"Afficher si messages non lus"}),(0,a.jsx)(tL,{checked:"hide"===ex.sidebar,onPick:()=>{x(e.id,"hide"),em()},children:"Masquer"}),(0,a.jsx)(t$,{}),(0,a.jsx)(tz,{children:"Dans la liste des messages"}),(0,a.jsx)(tL,{checked:"show"===ex.messages,onPick:()=>{f(e.id,"show"),em()},children:"Afficher"}),(0,a.jsx)(tL,{checked:"hide"===ex.messages,onPick:()=>{f(e.id,"hide"),em()},children:"Masquer"}),(0,a.jsx)(t$,{}),(0,a.jsx)(tE,{onClick:()=>{G(e.label),K(!0),em()},children:"Renommer…"}),(0,a.jsx)(tE,{onClick:()=>{X("__root__"),Z(!0),em()},children:"D\xe9placer…"}),(0,a.jsx)(tE,{onClick:()=>{ea(""),et(!0),em()},children:"Nouveau sous-dossier…"}),(0,a.jsx)(tE,{destructive:!0,onClick:()=>{g(e.id),em()},children:"Supprimer le dossier"})]}),ey=(0,a.jsxs)("div",{"data-nav-row":!0,...ed,onDragEnter:t=>{let s=w.current;s?.kind==="folder"&&s.id!==e.id?t.preventDefault():I.onDragEnter(t)},onDragOver:t=>{let s=w.current;if(s?.kind==="folder"){if(t.preventDefault(),t.stopPropagation(),s.id===e.id)return;let a=(0,tV.CI)(d,e.id);if(a?.includes(s.id))return;t.dataTransfer.dropEffect="move",C(t.currentTarget,tB(t,!0));return}I.onDragOver(t)},onDragLeave:e=>{if(w.current?.kind==="folder"){let t=e.relatedTarget;if(t&&e.currentTarget instanceof Node&&e.currentTarget.contains(t))return;S(e.currentTarget);return}I.onDragLeave(e)},onDrop:t=>{let s=tW(t,w.current);if(s?.kind==="folder"){t.preventDefault(),t.stopPropagation();let a=y.current??tB(t,!0);A(s,e.id,a,"folder");return}I.onDrop(t)},className:eg,style:ev,children:[i?(0,a.jsx)(ti,{label:e.label,onDragStart:t=>{let s={kind:"folder",id:e.id};tq(t,s),k(s,t.currentTarget.closest("[data-nav-row]"))},onDragEnd:N}):null,(0,a.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>u(e.id),onKeyDown:t=>tr(t,()=>u(e.id)),className:(0,ec.cn)("flex h-8 min-w-0 flex-1 cursor-pointer items-center gap-3 py-0 pr-1 text-left transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50",!T&&!M&&!eh&&"rounded-r-none hover:rounded-r-full hover:bg-mail-nav-hover",eh&&!T&&!M&&"rounded-r-full",T||M?"text-gray-900":"text-gray-700"),children:[$?(0,a.jsx)("button",{type:"button",draggable:!1,className:"flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded outline-none hover:bg-black/5 focus-visible:ring-2 focus-visible:ring-ring/50","aria-expanded":L,"aria-label":L?`Replier le dossier ${e.label}`:`D\xe9plier le dossier ${e.label}`,onClick:t=>{t.preventDefault(),t.stopPropagation(),m(e.id)},children:(0,a.jsx)(ta,{showUnreadDot:R,children:(0,a.jsx)(tl,{hasChildren:!0,open:L,colorBgClass:D})})}):(0,a.jsx)(ta,{showUnreadDot:R,children:(0,a.jsx)(tl,{hasChildren:!1,open:!1,colorBgClass:D})}),(0,a.jsx)("div",{className:"flex min-w-0 flex-1 items-baseline gap-3",children:(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate leading-5",children:(0,a.jsx)("span",{className:(0,ec.cn)(R&&!T&&"font-semibold text-gray-900"),children:e.label})})})]}),ej]});return(0,a.jsxs)(a.Fragment,{children:[c?ey:(0,a.jsxs)(e7.tz,{onOpenChange:U,children:[(0,a.jsx)(e7.Rc,{asChild:!0,children:ey}),(0,a.jsxs)(e7.Ip,{className:ep,children:[eb("context"),(0,a.jsx)(e7.K5,{className:eo.AO}),(0,a.jsx)(e7.F7,{className:"px-3 py-1 text-[11px] font-normal normal-case tracking-normal text-muted-foreground",children:"Dans la liste des dossiers"}),(0,a.jsx)(te,{checked:"show"===ex.sidebar,onPick:()=>x(e.id,"show"),children:"Afficher"}),(0,a.jsx)(te,{checked:"showUnread"===ex.sidebar,onPick:()=>x(e.id,"showUnread"),children:"Afficher si non lus"}),(0,a.jsx)(te,{checked:"hide"===ex.sidebar,onPick:()=>x(e.id,"hide"),children:"Masquer"}),(0,a.jsx)(e7.K5,{className:eo.AO}),(0,a.jsx)(e7.F7,{className:"px-3 py-1 text-[11px] font-normal normal-case tracking-normal text-muted-foreground",children:"Dans la liste des messages"}),(0,a.jsx)(te,{checked:"show"===ex.messages,onPick:()=>f(e.id,"show"),children:"Afficher"}),(0,a.jsx)(te,{checked:"hide"===ex.messages,onPick:()=>f(e.id,"hide"),children:"Masquer"}),(0,a.jsx)(e7.K5,{className:"my-1.5 bg-gray-200"}),(0,a.jsx)(e7.kt,{className:"mx-1 cursor-pointer px-3 py-2 text-sm",onClick:()=>{G(e.label),K(!0)},children:"Renommer…"}),(0,a.jsx)(e7.kt,{className:"mx-1 cursor-pointer px-3 py-2 text-sm",onClick:()=>{X("__root__"),Z(!0)},children:"D\xe9placer…"}),(0,a.jsx)(e7.kt,{className:"mx-1 cursor-pointer px-3 py-2 text-sm",onClick:()=>{ea(""),et(!0)},children:"Nouveau sous-dossier…"}),(0,a.jsx)(e7.kt,{variant:"destructive",className:"mx-1 cursor-pointer px-3 py-2 text-sm",onClick:()=>g(e.id),children:"Supprimer le dossier"})]})]}),ew,(0,a.jsx)(eW.lG,{open:V,onOpenChange:K,children:(0,a.jsxs)(eW.Cf,{className:"sm:max-w-md",showCloseButton:!0,onOpenAutoFocus:e=>{e.preventDefault(),window.requestAnimationFrame(()=>en.current?.focus())},children:[(0,a.jsxs)(eW.c7,{children:[(0,a.jsx)(eW.L3,{children:"Renommer le dossier"}),(0,a.jsxs)(eW.rr,{children:["Nouveau nom pour \xab ",e.label," \xbb."]})]}),(0,a.jsx)(eM.p,{ref:en,value:Q,onChange:e=>G(e.target.value),autoComplete:"off",onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),b(e.id,Q),K(!1))}}),(0,a.jsxs)(eW.Es,{children:[(0,a.jsx)(E.$,{variant:"outline",type:"button",onClick:()=>K(!1),children:"Annuler"}),(0,a.jsx)(E.$,{type:"button",onClick:()=>{b(e.id,Q),K(!1)},children:"Enregistrer"})]})]})}),(0,a.jsx)(eW.lG,{open:Y,onOpenChange:Z,children:(0,a.jsxs)(eW.Cf,{className:"sm:max-w-md",showCloseButton:!0,children:[(0,a.jsxs)(eW.c7,{children:[(0,a.jsx)(eW.L3,{children:"D\xe9placer le dossier"}),(0,a.jsx)(eW.rr,{children:"Choisissez le dossier parent."})]}),(0,a.jsxs)(ez.l6,{value:J,onValueChange:X,children:[(0,a.jsx)(ez.bq,{className:"w-full min-w-0",size:"sm",children:(0,a.jsx)(ez.yv,{})}),(0,a.jsx)(ez.gC,{position:"popper",className:"max-h-72",children:ef.map(e=>(0,a.jsx)(ez.eb,{value:e.value,children:e.label},e.value))})]}),(0,a.jsxs)(eW.Es,{children:[(0,a.jsx)(E.$,{variant:"outline",type:"button",onClick:()=>Z(!1),children:"Annuler"}),(0,a.jsx)(E.$,{type:"button",onClick:()=>{v(e.id,"__root__"===J?null:J),Z(!1)},children:"D\xe9placer"})]})]})}),(0,a.jsx)(eW.lG,{open:ee,onOpenChange:et,children:(0,a.jsxs)(eW.Cf,{className:"sm:max-w-md",showCloseButton:!0,onOpenAutoFocus:e=>{e.preventDefault(),window.requestAnimationFrame(()=>er.current?.focus())},children:[(0,a.jsxs)(eW.c7,{children:[(0,a.jsx)(eW.L3,{children:"Nouveau sous-dossier"}),(0,a.jsxs)(eW.rr,{children:["Sous \xab ",e.label," \xbb."]})]}),(0,a.jsx)(eM.p,{ref:er,value:es,onChange:e=>ea(e.target.value),placeholder:"Nom du dossier",autoComplete:"off",onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),j(e.id,es),et(!1))}}),(0,a.jsxs)(eW.Es,{children:[(0,a.jsx)(E.$,{variant:"outline",type:"button",onClick:()=>et(!1),children:"Annuler"}),(0,a.jsx)(E.$,{type:"button",onClick:()=>{j(e.id,es),et(!1)},children:"Cr\xe9er"})]})]})})]})}function tQ({node:e,isExpanded:t,selectedFolder:s,folderUnreadCounts:n,onSelectFolder:r}){let{isOver:l,dropHandlers:i}=tC(e.id,e.label),o=e.color??"bg-gray-400",c=!!e.children?.length,d=(0,tV.xq)(e,s),u=n[e.id]??0,m=u>0;return(0,a.jsx)("button",{type:"button",title:t?void 0:u>0?`${e.label}${u} non lus`:e.label,onClick:()=>r(e.id),...i,className:(0,ec.cn)("relative flex h-8 w-full min-w-0 shrink-0 cursor-pointer items-center gap-4 pl-6 pr-3 text-sm transition-colors",tt(d||l),d?"bg-mail-nav-selected text-mail-nav-selected font-medium":l?"bg-mail-nav-drop text-foreground":m?"text-gray-900 hover:bg-mail-nav-hover":"text-gray-700 hover:bg-mail-nav-hover"),children:(0,a.jsx)(ta,{showUnreadDot:m,children:(0,a.jsx)(tl,{hasChildren:c,open:!1,colorBgClass:o})})})}function tG(e,t,s){return e.filter(e=>{let a=t(e.id);return"hide"!==a.sidebar&&("showUnread"!==a.sidebar||(s[e.id]??0)!==0)})}function tY({selectedFolder:e,onSelectFolder:t,folderUnreadCounts:s,splitView:n=!1,state:r}){let l,{isExpanded:i,navRailInset:o,touchNav:c,visibleMainItems:d,primaryVisibleCategories:u,plusOnlyVisibleCategories:m,disabledSystemNavItems:h,navMoreOpen:x,setNavMoreOpen:f,setLabelRowEnabled:p,folderTree:b,folderRowProps:g,collapsedFolderOpts:v,visibleNavLabelRows:j,labelRowProps:w,setNewFolderParent:y,setNewFolderName:k,setFolderDialogOpen:N,setNewLabelName:C,setLabelDialogOpen:S}=r;return(0,a.jsx)("div",{className:(0,ec.cn)("min-h-0 flex-1 overflow-y-auto overflow-x-hidden","[scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"),children:(0,a.jsxs)("nav",{className:(0,ec.cn)("flex min-h-full flex-col",o,!n&&"sm:pt-3"),children:[d.map(n=>(0,a.jsx)(tF,{item:n,isSelected:e===n.id,unreadCount:s[n.id]??0,isExpanded:i,onSelectFolder:t},n.id)),u.map(n=>(0,a.jsx)(tP,{item:n,isSelected:e===n.id,isExpanded:i,unreadCount:s[n.id]??0,onSelectFolder:t,touchNav:c,onDisableNavLabel:e=>p(e,!1),onEnableNavLabel:e=>p(e,!0)},n.id)),e4.eB&&(0,a.jsxs)("button",{type:"button",title:i?void 0:x?"Moins":"Plus","aria-expanded":x,"aria-label":i?void 0:x?"Moins dentr\xe9es":"Plus dentr\xe9es",onClick:()=>f(s=>!s||(e4.ah.has(e)&&t("inbox"),!1)),className:(0,ec.cn)("flex h-8 w-full shrink-0 cursor-pointer items-center gap-4 pl-6 pr-3 text-gray-700 transition-colors hover:bg-mail-nav-hover",tt(!1)),children:[(0,a.jsx)(eV.A,{className:(0,ec.cn)("h-5 w-5 shrink-0 transition-transform duration-200",x&&"rotate-180")}),i&&(0,a.jsx)("span",{className:"text-sm",children:x?"Moins":"Plus"})]}),x&&(0,a.jsxs)(a.Fragment,{children:[m.map(n=>(0,a.jsx)(tP,{item:n,isSelected:e===n.id,isExpanded:i,unreadCount:s[n.id]??0,onSelectFolder:t,touchNav:c,onDisableNavLabel:e=>p(e,!1),onEnableNavLabel:e=>p(e,!0)},n.id)),i&&(0,a.jsx)("div",{className:"mt-1 flex flex-col gap-px",children:e4.Oh.map(e=>{let t=e.icon;return(0,a.jsxs)("button",{type:"button",className:"flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-md py-1.5 pl-6 pr-3 text-left text-xs text-gray-600 transition-colors hover:bg-gray-50 hover:text-gray-800",children:[(0,a.jsx)(t,{className:"h-3.5 w-3.5 shrink-0 opacity-70","aria-hidden":!0}),(0,a.jsx)("span",{className:"min-w-0 leading-snug",children:e.label})]},e.id)})}),i&&h.length>0&&(0,a.jsxs)("div",{className:"mt-2 pt-2",children:[(0,a.jsx)("div",{className:"mb-1 pl-6 pr-3 text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"D\xe9sactiv\xe9es"}),h.map(e=>(0,a.jsx)(tP,{item:e,isSelected:!1,isExpanded:i,unreadCount:s[e.id]??0,onSelectFolder:t,touchNav:c,onDisableNavLabel:e=>p(e,!1),onEnableNavLabel:e=>p(e,!0),variant:"hidden"},e.id))]})]}),(0,a.jsxs)("div",{className:"mt-3 pt-1",children:[(0,a.jsxs)("div",{className:(0,ec.cn)("sticky top-0 flex h-8 w-full min-w-0 shrink-0 items-center gap-2 pl-6 pr-3",eo.wf),style:{zIndex:e4.XM},title:i?void 0:"Dossiers",children:[(0,a.jsx)(eO.In,{icon:"fluent:folder-mail-20-regular",className:"h-5 w-5 shrink-0 text-gray-600","aria-hidden":!0}),i&&(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate text-left text-sm font-medium text-gray-700",children:"Dossiers"}),i&&(0,a.jsx)("button",{type:"button",className:"flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded-full text-gray-500 hover:bg-mail-nav-hover hover:text-gray-700","aria-label":"Ajouter un dossier",title:"Ajouter un dossier",onClick:()=>{y("__root__"),k(""),N(!0)},children:(0,a.jsx)(eK.A,{className:"h-5 w-5 shrink-0"})})]}),i?function e(t,s,n){let{expandedFolderIds:r,getNavItemPrefs:l,folderUnreadCounts:i}=n;return tG(t,l,i).map(t=>{let l=r.has(t.id),i=t.children;return(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)(tK,{node:t,depth:s,...n}),i?.length&&l?(0,a.jsx)("div",{className:"min-w-0",children:e(i,s+1,n)}):null]},t.id)})}(b,0,g):(l=e=>{let t=[];for(let s of tG(e,v.getNavItemPrefs,v.folderUnreadCounts))t.push((0,a.jsx)(tQ,{node:s,isExpanded:v.isExpanded,selectedFolder:v.selectedFolder,folderUnreadCounts:v.folderUnreadCounts,onSelectFolder:v.onSelectFolder},s.id)),s.children?.length&&v.expandedFolderIds.has(s.id)&&t.push(...l(s.children));return t})(b)]}),(0,a.jsxs)("div",{className:"mt-3 pt-1",children:[(0,a.jsxs)("div",{className:(0,ec.cn)("sticky top-0 z-30 flex h-8 w-full min-w-0 shrink-0 items-center gap-2 pl-6 pr-3",eo.wf),title:i?void 0:"Libell\xe9s",children:[(0,a.jsx)(eO.In,{icon:"mdi:label-outline",className:"h-5 w-5 shrink-0 text-gray-600","aria-hidden":!0}),i&&(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate text-left text-sm font-medium text-gray-700",children:"Libell\xe9s"}),i&&(0,a.jsx)("button",{type:"button",className:"flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded-full text-gray-500 hover:bg-mail-nav-hover hover:text-gray-700","aria-label":"Ajouter un libell\xe9",title:"Ajouter un libell\xe9",onClick:()=>{C(""),S(!0)},children:(0,a.jsx)(eK.A,{className:"h-5 w-5 shrink-0"})})]}),j.map(e=>(0,a.jsx)(tU,{item:e,unreadCount:s[e.id]??0,isExpanded:i,...w},e.id))]}),(0,a.jsx)("div",{className:(0,ec.cn)("relative z-[41] mt-auto pt-2",eo.wf,"max-sm:pb-16 sm:-mr-3.5 sm:w-[calc(100%+0.875rem)] sm:sticky sm:bottom-0 sm:border-t sm:border-gray-200 sm:pb-3"),children:(0,a.jsxs)("button",{type:"button",title:i?void 0:"Sortbot",className:(0,ec.cn)("flex h-8 w-full shrink-0 cursor-pointer items-center gap-4 pl-6 pr-3 text-sm text-gray-700 transition-colors hover:bg-mail-nav-hover",tt(!1)),children:[(0,a.jsx)(eQ.A,{className:"h-5 w-5 shrink-0 text-gray-600","aria-hidden":!0}),i&&(0,a.jsx)("span",{children:"Sortbot"})]})})]})})}function tZ(e){let{splitView:t=!1,folderUnreadCounts:s={},selectedFolder:l,onSelectFolder:i}=e,d=(0,r.LZ)(),u=function({selectedFolder:e,onSelectFolder:t,collapsed:s,folderUnreadCounts:a={}}){let[l,i]=(0,n.useState)(!1),[d,u]=(0,n.useState)(!1),[m,h]=(0,n.useState)(()=>new Set),x=(0,n.useRef)(null),f=(0,n.useRef)(null),p=c(),b=(0,r.LZ)(),g=!s||!p&&l,v=p&&!s,{folderTree:j,labelRows:w,folderIdToLabel:y,addFolder:k,addLabelRowFromSidebar:N,getNavItemPrefs:C,setNavItemSidebarVisibility:S,setNavItemMessageVisibility:A,updateFolderOrLabelColor:M,renameFolderOrLabel:I,removeFolderOrLabelRow:E,moveFolder:z,reorderLabelRows:$,moveFolderRelative:L,addSubfolder:D,addChildLabelRow:T,setLabelRowEnabled:_}=(0,tH.xe)(),R=function(e){let{reorderLabelRows:t,moveFolderRelative:s,setExpandedFolderIds:a}=e,r=(0,n.useRef)(null),l=(0,n.useRef)(null),i=(0,n.useRef)(null),o=(0,n.useRef)(null),c=(0,n.useCallback)((e,t)=>{r.current=e,l.current=t,t?.setAttribute("data-nav-drag-source","true")},[]),d=(0,n.useCallback)(()=>{var e;e=l.current,e?.removeAttribute("data-nav-drag-source"),tn(i.current,null),r.current=null,l.current=null,i.current=null,o.current=null},[]),u=(0,n.useCallback)((e,t)=>{i.current!==e&&tn(i.current,null),i.current=e,o.current=t,tn(e,t)},[]),m=(0,n.useCallback)(e=>{i.current===e&&(tn(e,null),i.current=null,o.current=null)},[]),h=(0,n.useCallback)((e,n,r,l)=>{if(d(),e.id!==n||"inside"===r)if("label"===l&&"label"===e.kind){if("inside"===r)return;t(e.id,n,r)}else"folder"===l&&"folder"===e.kind&&(s(e.id,n,r),"inside"===r&&a(e=>{let t=new Set(e);return t.add(n),t}))},[d,s,t,a]);return{navDragRef:r,navDropPlacementRef:o,beginNavDrag:c,clearNavDrag:d,updateNavDropTarget:u,clearNavDropTarget:m,commitNavDrop:h}}({reorderLabelRows:$,moveFolderRelative:L,setExpandedFolderIds:h}),P=(0,n.useMemo)(()=>w.filter(e=>{if(!1===e.enabled||(0,tS.Y3)(e.id))return!1;let t=C(e.id);return"hide"!==t.sidebar&&("showUnread"!==t.sidebar||(a[e.id]??0)!==0)}),[w,C,a]),F=(0,n.useMemo)(()=>{let e=new Set;for(let t of e4.Eb)e.add(t.id);for(let t of Object.keys(y))e.add(t);return e},[y]);(0,n.useEffect)(()=>{"search"===e||F.has(e)||t("inbox")},[F,e,t]);let[O,q]=(0,n.useState)(!1),[W,B]=(0,n.useState)(!1),[U,H]=(0,n.useState)(""),[V,K]=(0,n.useState)("__root__"),[Q,G]=(0,n.useState)(""),Y=(0,n.useRef)(null),Z=(0,n.useRef)(null),J=(0,n.useMemo)(()=>{let e,t;return e=[{value:"__root__",label:"Racine"}],(t=(s,a)=>{for(let n of s)e.push({value:n.id,label:`${"".repeat(2*a)}${n.label}`}),n.children?.length&&t(n.children,a+1)})(j,0),e},[j]),{primaryVisibleCategories:X,plusOnlyVisibleCategories:ee}=(0,n.useMemo)(()=>{let e=(0,e4.bS)(w.filter(e=>!1!==e.enabled&&(0,tS.Y3)(e.id))).map(e=>({id:e.id,label:e.label,icon:e.icon}));return{primaryVisibleCategories:e.filter(e=>!e4.ah.has(e.id)),plusOnlyVisibleCategories:e.filter(e=>e4.ah.has(e.id))}},[w]),et=(0,n.useMemo)(()=>(0,e4.bS)(w.filter(e=>!1===e.enabled&&(0,tS.Y3)(e.id))).map(e=>({id:e.id,label:e.label,icon:e.icon})),[w]),es=(0,n.useMemo)(()=>(a.scheduled??0)>0?e4.Eb:e4.Eb.filter(e=>"scheduled"!==e.id),[a.scheduled]),ea=e=>{h(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};(0,n.useEffect)(()=>{let s=w.find(t=>t.id===e);s&&!1===s.enabled&&t("inbox")},[w,e,t]),(0,n.useEffect)(()=>{"scheduled"!==e||(a.scheduled??0)>0||t("inbox")},[a.scheduled,e,t]),(0,n.useEffect)(()=>{e4.ah.has(e)&&!d&&u(!0)},[e,d]),(0,n.useEffect)(()=>{let t=(0,tV.CI)(j,e);t?.length&&h(e=>{let s=new Set(e);return t.forEach(e=>s.add(e)),s})},[e,j]),(0,n.useEffect)(()=>{p&&i(!1)},[p,s]),(0,n.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]);let en=(0,n.useMemo)(()=>({navDragRef:R.navDragRef,navDropPlacementRef:R.navDropPlacementRef,beginNavDrag:R.beginNavDrag,clearNavDrag:R.clearNavDrag,updateNavDropTarget:R.updateNavDropTarget,clearNavDropTarget:R.clearNavDropTarget,commitNavDrop:R.commitNavDrop}),[R]),er=(0,n.useMemo)(()=>({...en,selectedFolder:e,folderUnreadCounts:a,expandedFolderIds:m,isExpanded:g,isOverlayOpen:v,touchNav:p,folderTree:j,onSelectFolder:t,toggleFolderExpanded:ea,getNavItemPrefs:C,setNavItemSidebarVisibility:S,setNavItemMessageVisibility:A,updateFolderOrLabelColor:M,renameFolderOrLabel:I,removeFolderOrLabelRow:E,moveFolder:z,addSubfolder:D}),[en,e,a,m,g,v,p,j,t,C,S,A,M,I,E,z,D]),el=(0,n.useMemo)(()=>({getNavItemPrefs:C,folderUnreadCounts:a,expandedFolderIds:m,isExpanded:g,selectedFolder:e,onSelectFolder:t}),[C,a,m,g,e,t]),ei=(0,n.useMemo)(()=>({...en,selectedFolder:e,touchNav:p,onSelectFolder:t,getNavItemPrefs:C,setNavItemSidebarVisibility:S,setNavItemMessageVisibility:A,updateFolderOrLabelColor:M,renameFolderOrLabel:I,removeFolderOrLabelRow:E,addChildLabelRow:T}),[en,e,p,t,C,S,A,M,I,E,T]),ec=v&&b?eo.Q5:eo.DO;return{sidebarRef:f,touchNav:p,hoverExpanded:l,isExpanded:g,isOverlayOpen:v,panelSurfaceClass:ec,navRailInset:"pr-3.5",splitViewLogoIconClass:"size-9 shrink-0",splitViewLogoHeaderClass:"box-border min-h-[80px] pt-3 pl-4 pr-3.5 pb-4",handleMouseEnter:()=>{!o()&&s&&(x.current=setTimeout(()=>{i(!0)},300))},handleMouseLeave:()=>{x.current&&(clearTimeout(x.current),x.current=null),o()||i(!1)},navMoreOpen:d,setNavMoreOpen:u,visibleMainItems:es,primaryVisibleCategories:X,plusOnlyVisibleCategories:ee,disabledSystemNavItems:et,folderTree:j,folderRowProps:er,collapsedFolderOpts:el,visibleNavLabelRows:P,labelRowProps:ei,setLabelRowEnabled:_,folderDialogOpen:O,setFolderDialogOpen:q,labelDialogOpen:W,setLabelDialogOpen:B,newFolderName:U,setNewFolderName:H,newFolderParent:V,setNewFolderParent:K,newLabelName:Q,setNewLabelName:G,newFolderNameInputRef:Y,newLabelNameInputRef:Z,folderParentOptions:J,handleSubmitNewFolder:()=>{let e=U.trim();e&&(k("__root__"===V?null:V,e),H(""),q(!1))},handleSubmitNewLabel:()=>{let e=Q.trim();e&&(N(e),G(""),B(!1))}}}(e);return(0,a.jsxs)("aside",{ref:u.sidebarRef,"data-sidebar":!0,"data-sidebar-overlay":u.isOverlayOpen?"":void 0,onMouseEnter:u.handleMouseEnter,onMouseLeave:u.handleMouseLeave,className:(0,ec.cn)("absolute left-0 top-0 bottom-0 z-40 flex flex-col overflow-x-hidden transition-[width,transform] duration-200 ease-linear select-none",u.panelSurfaceClass,u.isExpanded?"w-60":"w-[68px]",t&&"border-r border-gray-200",!u.touchNav&&u.hoverExpanded&&"shadow-xl border-r border-gray-200 mail-sidebar-hover-frosted",u.isOverlayOpen&&"z-50 shadow-xl border-r border-gray-200",e.collapsed&&d&&"-translate-x-full pointer-events-none"),children:[(0,a.jsx)(eH,{splitView:t,isExpanded:u.isExpanded,panelSurfaceClass:u.panelSurfaceClass,splitViewLogoHeaderClass:u.splitViewLogoHeaderClass,splitViewLogoIconClass:u.splitViewLogoIconClass,touchNav:u.touchNav}),(0,a.jsx)(tY,{selectedFolder:l,onSelectFolder:i,folderUnreadCounts:s,splitView:t,state:u}),(0,a.jsx)(eB,{folderDialogOpen:u.folderDialogOpen,setFolderDialogOpen:u.setFolderDialogOpen,labelDialogOpen:u.labelDialogOpen,setLabelDialogOpen:u.setLabelDialogOpen,newFolderName:u.newFolderName,setNewFolderName:u.setNewFolderName,newFolderParent:u.newFolderParent,setNewFolderParent:u.setNewFolderParent,newLabelName:u.newLabelName,setNewLabelName:u.setNewLabelName,newFolderNameInputRef:u.newFolderNameInputRef,newLabelNameInputRef:u.newLabelNameInputRef,folderParentOptions:u.folderParentOptions,onSubmitNewFolder:u.handleSubmitNewFolder,onSubmitNewLabel:u.handleSubmitNewLabel})]})}function tJ(){let e=(0,f.KA)();return(0,n.useCallback)(t=>w(t,e),[e])}function tX({onClose:e,initialQuery:t,currentParams:s}){let n=(0,h.useRouter)(),r=tJ(),l=eA(t,s);return(0,a.jsx)(e$,{form:l,onSubmit:()=>{n.push(r(l.buildParams())),e()},onClose:e})}function t0({className:e,compact:t=!1}){let s=(0,h.useRouter)(),r=(0,h.usePathname)(),l=(0,f.KA)(),i=r?.includes(`/${l}/search`)??!1,o=(0,h.useSearchParams)(),c=(0,n.useMemo)(()=>j(o),[o]),d=(0,ev.LH)(),u=eC(e=>e.inputValue),m=eC(e=>e.dropdownOpen),p=eC(e=>e.selectedIndex),b=eC(e=>e.advancedOpen),g=eC(e=>e.chipAttachment),v=eC(e=>e.chipLast7Days),w=eC(e=>e.chipFromMe),{data:k}=(0,eb.F4)(u),{setInputValue:N,setDropdownOpen:C,setSelectedIndex:A,setAdvancedOpen:I,toggleChipAttachment:z,toggleChipLast7Days:$,toggleChipFromMe:L,resetChips:D,syncChipsFromParams:T,reset:_}=eC.getState(),R=(0,n.useRef)(null),P=(0,n.useRef)(null),[F,O]=(0,n.useState)(!1);(0,n.useEffect)(()=>{i?(N((0,y.uK)(c)),T(c,d?.email)):D()},[i,c,d?.email,N,D,T]);let q=(0,n.useMemo)(()=>u.trim()&&k?.length?k.slice(0,8).map(e=>({kind:"contact",contact:{id:e.uid,firstName:e.full_name.split(" ")[0]??"",lastName:e.full_name.split(" ").slice(1).join(" "),emails:e.email?[{value:e.email,label:"primary"}]:[],phones:[],createdAt:0,updatedAt:0},email:e.email??"",displayName:e.full_name,score:(0,eg.Be)(e,u)})):[],[u,k]),W=(0,n.useMemo)(()=>ej(u,q),[u,q]),B=q.length+1,U=(0,n.useCallback)(e=>{let t=e??u,a=ew(t,{chipAttachment:g,chipLast7Days:v,chipFromMe:w,fromEmail:d?.email??""});Object.keys(a).length&&ey(s,a,{routeRoot:l,onAfter:()=>{N(t.trim()),C(!1),R.current?.blur()}})},[u,g,v,w,d?.email,s,l]),H=(0,n.useCallback)(e=>{ey(s,ew(e.email,{chipAttachment:g,chipLast7Days:v,chipFromMe:w,fromEmail:d?.email??""}),{routeRoot:l,onAfter:()=>{N(e.email),C(!1),R.current?.blur()}})},[g,v,w,d?.email,s]),V=(0,n.useCallback)(e=>{if(m||"Enter"===e.key)switch(e.key){case"ArrowDown":e.preventDefault(),A(p<B-1?p+1:0);break;case"ArrowUp":e.preventDefault(),A(p>0?p-1:B-1);break;case"Enter":e.preventDefault(),p>=0&&p<q.length?H(q[p]):U();break;case"Tab":W&&(e.preventDefault(),N(u+W));break;case"Escape":e.preventDefault(),C(!1),I(!1),R.current?.blur()}},[m,p,B,q,W,u,U,H]);(0,n.useEffect)(()=>{let e=e=>{let t=e.target;!t||P.current?.contains(t)||t.closest("[data-radix-popper-content-wrapper]")||(C(!1),I(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let K=m&&u.trim().length>0&&F;return(0,a.jsxs)("div",{ref:P,className:(0,ec.cn)("relative flex w-full min-w-0 flex-col overflow-visible",e),children:[(0,a.jsxs)("div",{className:"relative flex w-full min-w-0 items-center text-[#5f6368] dark:text-[#9aa0a6]",children:[(0,a.jsx)("div",{className:(0,ec.cn)("pointer-events-none absolute flex items-center",t?"left-4":"left-3.5"),children:(0,a.jsx)(M.A,{className:"size-5 shrink-0"})}),W&&F&&(0,a.jsxs)("div",{className:(0,ec.cn)("pointer-events-none absolute flex items-center text-sm text-gray-400","left-[44px]"),"aria-hidden":!0,children:[(0,a.jsx)("span",{className:"invisible",children:u}),(0,a.jsx)("span",{children:W})]}),(0,a.jsx)("input",{ref:R,type:"text",placeholder:"Rechercher dans les messages",value:u,onChange:e=>N(e.target.value),onFocus:()=>{O(!0),u.trim()&&C(!0)},onBlur:()=>O(!1),onKeyDown:V,className:(0,ec.cn)("h-12 w-full rounded-full border-0 bg-muted text-sm text-foreground outline-none placeholder-shown:text-inherit placeholder:opacity-100",F||b?"bg-white shadow-md ring-1 ring-gray-300 dark:bg-gray-900 dark:ring-gray-600":"","pl-11 pr-20"),role:"combobox","aria-expanded":K,"aria-autocomplete":"list","aria-controls":"search-suggestions",autoComplete:"off"}),u&&(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:"absolute right-10 text-gray-600",onClick:()=>{_(),i?s.push((0,x.Pu)({folderId:"inbox",inboxTab:x.ZO,page:1,mailId:null},l)):R.current?.focus()},"aria-label":"Effacer la recherche",children:(0,a.jsx)(S.A,{className:"h-5 w-5"})}),(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:(0,ec.cn)("absolute text-gray-600",t?"right-3":"right-2"),"aria-label":"Filtres de recherche",onMouseDown:e=>e.preventDefault(),onClick:()=>{I(!eC.getState().advancedOpen)},children:(0,a.jsx)(eh.A,{className:"h-5 w-5"})})]}),K&&!b&&(0,a.jsxs)("div",{id:"search-suggestions",role:"listbox",className:eo.Yh,children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 overflow-x-auto border-b border-gray-100 px-4 py-2 whitespace-nowrap dark:border-gray-800",children:[(0,a.jsxs)("button",{type:"button",onClick:e=>{e.preventDefault(),z()},onMouseDown:e=>e.preventDefault(),className:(0,ec.cn)("flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs transition-colors",g?"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"border-gray-200 text-gray-600 hover:bg-gray-50 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800"),children:[(0,a.jsx)(ex.A,{className:"size-3.5"}),"Contient une pi\xe8ce jointe"]}),(0,a.jsxs)("button",{type:"button",onClick:e=>{e.preventDefault(),$()},onMouseDown:e=>e.preventDefault(),className:(0,ec.cn)("flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs transition-colors",v?"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"border-gray-200 text-gray-600 hover:bg-gray-50 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800"),children:[(0,a.jsx)(er.A,{className:"size-3.5"}),"7 derniers jours"]}),(0,a.jsxs)("button",{type:"button",onClick:e=>{e.preventDefault(),L()},onMouseDown:e=>e.preventDefault(),className:(0,ec.cn)("flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs transition-colors",w?"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"border-gray-200 text-gray-600 hover:bg-gray-50 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800"),children:[(0,a.jsx)(ef.A,{className:"size-3.5"}),"De moi"]})]}),q.map((e,t)=>{let s=t===p;if("contact"===e.kind){let n=(0,eS.w7)(e.displayName),r=(0,eS.V7)(e.displayName);return(0,a.jsxs)("button",{type:"button",role:"option","aria-selected":s,className:(0,ec.cn)("flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm transition-colors",s?"bg-gray-100 dark:bg-gray-800":"hover:bg-gray-50 dark:hover:bg-gray-800/50"),onMouseDown:e=>e.preventDefault(),onClick:()=>H(e),onMouseEnter:()=>A(t),children:[(0,a.jsx)("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-full text-xs font-medium text-white",style:{backgroundColor:r},children:n}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"truncate font-medium text-gray-900 dark:text-gray-100",children:e.displayName}),(0,a.jsx)("div",{className:"truncate text-xs text-gray-500",children:e.email})]})]},`c-${e.contact.id}-${e.email}`)}return(0,a.jsxs)("button",{type:"button",role:"option","aria-selected":s,className:(0,ec.cn)("flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm transition-colors",s?"bg-gray-100 dark:bg-gray-800":"hover:bg-gray-50 dark:hover:bg-gray-800/50"),onMouseDown:e=>e.preventDefault(),onClick:()=>H(e),onMouseEnter:()=>A(t),children:[(0,a.jsx)("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-gray-200 text-gray-500 dark:bg-gray-700",children:(0,a.jsx)(ef.A,{className:"size-4"})}),(0,a.jsx)("div",{className:"min-w-0 flex-1",children:(0,a.jsx)("div",{className:"truncate text-gray-700 dark:text-gray-300",children:e.email})})]},`e-${e.email}`)}),(0,a.jsxs)("button",{type:"button",role:"option","aria-selected":p===q.length,className:(0,ec.cn)("flex w-full items-center gap-3 border-t border-gray-100 px-4 py-2.5 text-left text-sm transition-colors dark:border-gray-800",p===q.length?"bg-gray-100 dark:bg-gray-800":"hover:bg-gray-50 dark:hover:bg-gray-800/50"),onMouseDown:e=>e.preventDefault(),onClick:()=>U(),onMouseEnter:()=>A(q.length),children:[(0,a.jsx)("div",{className:"flex size-8 shrink-0 items-center justify-center",children:(0,a.jsx)(M.A,{className:"size-5 text-gray-400"})}),(0,a.jsxs)("span",{className:"text-gray-600 dark:text-gray-400",children:["Tous les r\xe9sultats de recherche pour \xab\xa0",(0,a.jsx)("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:u}),"\xa0\xbb"]}),(0,a.jsx)("span",{className:"ml-auto text-xs text-gray-400",children:"Appuyer sur ENTR\xc9E"})]})]}),b&&(0,a.jsx)(tX,{onClose:()=>I(!1),initialQuery:u,currentParams:c})]})}(0,eO.CQ)(eq.Pt);var t1=s(88477);function t2({onToggleSidebar:e,sidebarCollapsed:t,isXs:s=!1,hideSearch:n=!1,onOpenMobileSearch:r}){let l=(0,d.x)(e=>e.setQuickSettingsOpen);return(0,a.jsxs)("header",{className:"flex h-16 w-full min-w-0 items-center gap-0 bg-app-canvas pl-0 pr-4 sm:gap-2",children:[(0,a.jsxs)("div",{className:(0,ec.cn)("flex h-full min-w-0 shrink-0 items-center",s?"w-auto justify-start gap-0 pl-2":t?"w-[68px] justify-center px-0":"w-60 gap-2 pl-4"),children:[(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:"shrink-0 text-gray-600",onClick:e,children:(0,a.jsx)(A.A,{className:"h-5 w-5"})}),!t&&!s&&(0,a.jsxs)("div",{className:"flex min-w-0 items-center",children:[(0,a.jsx)(eU.X,{variant:"mark",className:"h-8 w-8 shrink-0 sm:hidden"}),(0,a.jsx)(eU.X,{className:"min-h-8 shrink-0 hidden sm:flex"})]})]}),(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:"size-12 shrink-0 rounded-full border border-[#d3e3fd] bg-[#eaf1fb] text-gray-500 hover:bg-[#dfe9f7] sm:hidden","aria-label":"Rechercher dans les messages",onClick:r,children:(0,a.jsx)(M.A,{className:"size-5 shrink-0 ml-0.5"})}),n?(0,a.jsx)("div",{className:"hidden min-w-0 flex-1 sm:block","aria-hidden":!0}):(0,a.jsx)("div",{className:"hidden min-w-0 flex-1 max-w-3xl overflow-visible sm:flex",children:(0,a.jsx)(t0,{})}),(0,a.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1 pl-4",children:[t&&(0,a.jsxs)("div",{className:"mr-1 flex min-w-0 max-w-[min(100%,400px)] items-center pr-2",children:[(0,a.jsx)(eU.X,{variant:"mark",className:"h-8 w-8 shrink-0 sm:hidden"}),(0,a.jsx)(eU.X,{className:"min-h-8 shrink-0 hidden sm:flex"})]}),(0,a.jsx)(t1._,{onSettingsClick:()=>l(!0)})]})]})}var t3=s(39927);let t5=new Set(["inbox","sent","drafts","spam","starred","snoozed","trash","important","scheduled"]);function t4(e,t,s,a){let n;if(t5.has(e.toLowerCase()))return!1;let r=t[e];return r&&(n=a?.find(e=>e.id===r)),!n&&a?.length&&(n=a.find(t=>t.label.toLowerCase()===e.toLowerCase())),(!n||!1!==n.enabled&&!1!==n.showInMessageList)&&(!r||"hide"!==s(r).messages)}let t6="shrink-0 whitespace-nowrap rounded font-semibold leading-snug opacity-[0.96] transition-[filter,opacity] duration-150 hover:opacity-100 hover:brightness-[0.98]";function t8({label:e,displayText:t,bgClass:s,size:n,onClick:r,onRemoveClick:l}){return(0,a.jsxs)("button",{type:"button",title:e,className:(0,ec.cn)(t6,"list"===n?"px-1 py-px text-[11px]":"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-xs",s?(0,ec.cn)(s,e3(s)):(0,ec.cn)("border border-transparent bg-[#e8eaed] hover:bg-[#dadce0]",eX("#e8eaed"))),onClick:r,children:[t,l?(0,a.jsx)("span",{role:"button",tabIndex:0,className:(0,ec.cn)("text-inherit opacity-70 hover:opacity-100","ml-0.5"),"aria-label":`Retirer le libell\xe9 ${t}`,onClick:l,onKeyDown:e=>{"Enter"===e.key&&l(e)},children:"\xd7"}):null]})}function t7({labels:e,labelBgByText:t,emailLabelToSidebarFolderId:s,getNavItemPrefs:r,onLabelNavigate:l,variant:i,showLabel:o,resolveDisplayName:c,spamChip:d,showRemoveOnPills:u,currentFolderId:m,folderTree:h,labelRows:x}){let f=(0,n.useMemo)(()=>m&&h?function e(t,s){for(let a of t){if(a.id===s)return a.label;if(a.children?.length){let t=e(a.children,s);if(t)return t}}return null}(h,m):null,[m,h]),p=(0,n.useMemo)(()=>{let e,t;return h?(e=new Set,(t=s=>{for(let a of s)e.add(a.label.toLowerCase()),a.children?.length&&t(a.children)})(h),e):new Set},[h]),b=(0,n.useMemo)(()=>{let t=(e??[]).filter(e=>"list"===i?!!t4(e,s,r,x)&&(!f||e.toLowerCase()!==f.toLowerCase()):!!t4(e,s,r,x)&&("spam"!==e||!d)&&(!o||!!o(e)));return"list"===i&&h&&t.sort((e,t)=>{let s=p.has(e.toLowerCase()),a=p.has(t.toLowerCase());return s&&!a?-1:!s&&a?1:0}),t},[e,i,s,r,x,f,h,p,d,o]),g="header"===i&&d;return 0!==b.length||g?(0,a.jsxs)("span",{className:"list"===i?"flex shrink-0 items-center gap-1":"contents",children:[g?(0,a.jsxs)("button",{type:"button",onClick:()=>d.onNotSpam(),className:(0,ec.cn)(t6,"inline-flex items-center gap-0.5 border border-transparent bg-[#e8eaed] px-1.5 py-0.5 text-xs hover:bg-[#dadce0]",eX("#e8eaed")),title:"Signaler comme non-spam et retirer ce libell\xe9",children:["Spam",(0,a.jsx)("span",{className:"opacity-70 hover:opacity-100","aria-hidden":!0,children:"\xd7"})]}):null,b.map(e=>{let s=t.get(e.toLowerCase()),n=c?.(e)??e;return(0,a.jsx)(t8,{label:e,displayText:n,bgClass:s,size:"list"===i?"list":"header",onClick:t=>{t.stopPropagation(),l(e)},onRemoveClick:u?e=>{e.stopPropagation()}:void 0},e)})]}):null}var t9=s(79117),se=s(90324),st=s(17745),ss=s(94927),sa=s(52002),sn=s(55149);function sr(e){return e?["demo","message"]:["message"]}function sl(){let e=(0,t3.jE)(),t=(0,f.S4)();return(0,st.n)({mutationFn:async({id:e,flags:s})=>{if(t){let t=t9.d.getState().updateFlags(e,s);if(!t)throw Error("Message introuvable");return t}try{return await ss.uE.put(`/mail/messages/${e}/flags`,{flags:s})}catch(t){if(t instanceof ss.M_)return void await (0,sa.Z2)({id:`flags-${e}-${Date.now()}`,timestamp:Date.now(),type:"update_flags",payload:{message_id:e,flags:s},retries:0});throw t}},onMutate:async({id:s,flags:a})=>{let n=(0,se.S3)(!!t),r=sr(!!t);await e.cancelQueries({queryKey:n}),await e.cancelQueries({queryKey:[...r,s]});let l=e.getQueriesData({queryKey:n});return e.setQueriesData({queryKey:n},e=>e?{...e,data:e.data.map(e=>e.id===s?{...e,flags:a}:e)}:e),e.setQueriesData({queryKey:[...r,s]},e=>e?{...e,flags:a}:e),{previousMessages:l}},onError:(t,s,a)=>{a?.previousMessages?.forEach(([t,s])=>e.setQueryData(t,s))},onSettled:()=>{t&&t9.d.getState().bump(),e.invalidateQueries({queryKey:(0,se.S3)(!!t)})}})}function si(){let e=(0,t3.jE)(),t=(0,f.S4)();return(0,st.n)({mutationFn:async({id:e,labels:s})=>{if(t){let t=t9.d.getState().updateLabels(e,s);if(!t)throw Error("Message introuvable");return t}try{return await ss.uE.put(`/mail/messages/${e}/labels`,{labels:s})}catch(t){if(t instanceof ss.M_)return void await (0,sa.Z2)({id:`labels-${e}-${Date.now()}`,timestamp:Date.now(),type:"update_labels",payload:{message_id:e,labels:s},retries:0});throw t}},onMutate:async({id:s,labels:a})=>{let n=(0,se.S3)(!!t),r=sr(!!t);await e.cancelQueries({queryKey:n}),await e.cancelQueries({queryKey:[...r,s]});let l=e.getQueriesData({queryKey:n});return e.setQueriesData({queryKey:n},e=>e?{...e,data:e.data.map(e=>e.id===s?{...e,labels:a}:e)}:e),e.setQueriesData({queryKey:[...r,s]},e=>e?{...e,labels:a}:e),{previousMessages:l}},onError:(t,s,a)=>{a?.previousMessages?.forEach(([t,s])=>e.setQueryData(t,s))},onSettled:()=>{t&&t9.d.getState().bump(),e.invalidateQueries({queryKey:(0,se.S3)(!!t)})}})}function so(e){return e.threadHeadId??e.id}function sc(e){return!1!==e.isThreadHead&&(!0===e.isThreadHead||!e.threadHeadId||e.threadHeadId===e.id)}function sd(e,t,s,a){return a&&e.threadMessageIds&&e.threadMessageIds.length>1?e.threadMessageIds.every(e=>{let a=s.get(e);return!a||(t[e]??a.read)}):t[e.id]??e.read}var su=s(33861),sm=s(22029),sh=s(91025);let sx=(0,ek.v)()((0,sm.Zr)(e=>({scheduledEmails:[],snoozedEmails:[],addScheduledEmail:t=>e(e=>({scheduledEmails:[t,...e.scheduledEmails.filter(e=>e.id!==t.id)]})),updateScheduledStatus:(t,s)=>e(e=>({scheduledEmails:e.scheduledEmails.map(e=>e.id===t?{...e,status:s}:e)})),removeScheduled:t=>e(e=>({scheduledEmails:e.scheduledEmails.filter(e=>e.id!==t)})),snoozeMailboxEmail:t=>e(e=>{let s=t.id.startsWith("snz-")?t.id:`snz-${t.id}`,a=new Date(Date.now()+864e5).toISOString();return{snoozedEmails:[{...t,id:s,labels:["snoozed"],snoozeWakeAt:a,scheduledSendAt:void 0,scheduledToName:void 0,read:!0},...e.snoozedEmails.filter(e=>e.id!==s)]}}),restoreSnoozedToInbox:t=>e(e=>({snoozedEmails:e.snoozedEmails.filter(e=>e.id!==t.id)}))}),{name:"ultimail-scheduled-state",storage:sh.$,version:2,migrate:e=>({scheduledEmails:[],snoozedEmails:Array.isArray(e.snoozedEmails)?e.snoozedEmails:[]})})),sf=(0,n.createContext)(null);function sp({children:e}){let t,s,r,l,i=sx(e=>e.scheduledEmails),o=sx(e=>e.snoozedEmails),c=(0,ev.LH)(),d=(t=(0,t3.jE)(),(0,st.n)({mutationFn:async e=>{try{return await ss.uE.post("/mail/send",e)}catch(t){if(t instanceof ss.M_)return await (0,sa.Z2)({id:e.idempotency_key,timestamp:Date.now(),type:"schedule_send",payload:e,retries:0}),null;throw t}},onSuccess:()=>{t.invalidateQueries({queryKey:["outbox"]})}})),u=(s=(0,t3.jE)(),(0,st.n)({mutationFn:async({id:e,scheduled_at:t})=>await ss.uE.post(`/mail/outbox/${e}/reschedule`,{scheduled_at:t}),onSuccess:()=>{s.invalidateQueries({queryKey:["outbox"]})}})),m=(r=(0,t3.jE)(),(0,st.n)({mutationFn:async({id:e})=>await ss.uE.post(`/mail/outbox/${e}/cancel`),onSuccess:()=>{r.invalidateQueries({queryKey:["outbox"]})}})),h=(l=(0,t3.jE)(),(0,st.n)({mutationFn:async({id:e})=>await ss.uE.post(`/mail/outbox/${e}/send-now`),onSuccess:()=>{l.invalidateQueries({queryKey:["outbox"]}),l.invalidateQueries({queryKey:["messages","sent"]})}})),x=(0,n.useCallback)(async e=>{let t=c?.id??"",s=await d.mutateAsync({account_id:t,to:e.to.map(e=>({name:e.name,address:e.email})),subject:e.subject,body_html:e.bodyHtml,idempotency_key:`sched-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,scheduled_at:e.sendAtIso}),a=s?.id??`local-${Date.now()}`,n={id:a,account_id:t,status:"scheduled",subject:e.subject,to:e.to.map(e=>({name:e.name,address:e.email})),scheduled_at:e.sendAtIso,created_at:new Date().toISOString()};return sx.getState().addScheduledEmail(n),{id:a}},[d,c?.id]),f=(0,n.useCallback)(e=>{sx.getState().removeScheduled(e)},[]),p=(0,n.useCallback)(async e=>{await m.mutateAsync({id:e}),sx.getState().removeScheduled(e)},[m]),b=(0,n.useCallback)(async e=>{await m.mutateAsync({id:e}),sx.getState().removeScheduled(e)},[m]),g=(0,n.useCallback)(async e=>{await m.mutateAsync({id:e}),sx.getState().removeScheduled(e)},[m]),v=(0,n.useCallback)(async(e,t)=>{},[]),j=(0,n.useCallback)(async(e,t)=>{await u.mutateAsync({id:e,scheduled_at:t});let s=sx.getState(),a=s.scheduledEmails.find(t=>t.id===e);a&&s.addScheduledEmail({...a,scheduled_at:t})},[u]),w=(0,n.useCallback)(async e=>{let t=sx.getState().scheduledEmails.find(t=>t.id===e);return t?{sendAtIso:t.scheduled_at??new Date().toISOString(),to:t.to.map(e=>({name:e.name,email:e.address})),subject:t.subject,previewText:"",bodyHtml:""}:null},[]),y=(0,n.useCallback)(async(e,t)=>{await u.mutateAsync({id:e,scheduled_at:t.sendAtIso});let s={id:e,account_id:c?.id??"",status:"scheduled",subject:t.subject,to:t.to.map(e=>({name:e.name,address:e.email})),scheduled_at:t.sendAtIso,created_at:new Date().toISOString()};sx.getState().addScheduledEmail(s)},[u,c?.id]),k=(0,n.useCallback)(async e=>{await h.mutateAsync({id:e}),sx.getState().removeScheduled(e)},[h]),N=(0,n.useCallback)(async e=>{sx.getState().snoozeMailboxEmail(e)},[]),C=(0,n.useCallback)(async e=>{sx.getState().restoreSnoozedToInbox(e)},[]),S=(0,n.useMemo)(()=>({scheduledEmails:i,snoozedEmails:o,scheduleSend:x,removeScheduledLocal:f,requestDeleteScheduled:p,requestArchiveScheduled:b,requestSnoozeScheduled:g,requestToggleReadScheduled:v,requestRescheduleScheduled:j,requestGetScheduledEditPayload:w,requestUpdateScheduledSend:y,requestSendScheduledNow:k,requestSnoozeMailboxEmail:N,requestRestoreSnoozedToInbox:C}),[i,o,x,f,p,b,g,v,j,w,y,k,N,C]);return(0,a.jsx)(sf.Provider,{value:S,children:e})}function sb(){let e=(0,n.useContext)(sf);if(!e)throw Error("useScheduledMail must be used within ScheduledMailProvider");return e}let sg=(0,ek.v)()((0,sm.Zr)(e=>({seenEmailIds:[],recentMoveTargets:[],recentFolderVisits:[],markSeen:t=>e(e=>({seenEmailIds:e.seenEmailIds.includes(t)?e.seenEmailIds:[...e.seenEmailIds,t]})),pushRecentMoveTarget:t=>e(e=>{let s=e.recentMoveTargets.filter(e=>e!==t);return{recentMoveTargets:[t,...s].slice(0,5)}}),pushRecentFolderVisit:t=>e(e=>{let s=e.recentFolderVisits.filter(e=>e!==t);return{recentFolderVisits:[t,...s].slice(0,4)}})}),{name:"ultimail-mail-state",storage:sh.$,version:4,migrate:e=>({seenEmailIds:e.seenEmailIds??[],recentMoveTargets:e.recentMoveTargets??[],recentFolderVisits:e.recentFolderVisits??[]})}));var sv=s(53053);function sj(e){let t=new Date(e.date).getTime();return Number.isFinite(t)?t:0}function sw(e,t){return sj(t)-sj(e)}function sy(e,t,s){return!sd(e,t.readOverrides,s.byId,s.conversationMode)}function sk(e,t){let s=e.threadHeadId??e.id;return t.starredIds.includes(s)||e.starred}function sN(e,t){let s=e.threadHeadId??e.id;return t.importantIds.includes(s)||e.important}function sC(e,t,s,a){let n=[...e];return"default"===t?n.sort(sw):n.sort((e,n)=>{let r=0;switch(t){case"important":r=Number(sN(n,s))-Number(sN(e,s));break;case"unread":r=Number(sy(n,s,a))-Number(sy(e,s,a));break;case"starred":r=Number(sk(n,s))-Number(sk(e,s))}return 0!==r?r:sw(e,n)}),n}var sS=s(53919);function sA(e,t){return(0,x.gD)(e)===x.tZ?"var(--foreground)":e2(t)}function sM(e){return[{id:x.ZO,label:"Principale",icon:"mdi:account",badgeColor:"bg-[#0b57d0]"},...(0,tS.Ap)(e).map(e=>({id:e.id,label:e.label,icon:e.icon??"mdi:label-outline",badgeColor:e.color}))]}var sI=s(64266),sE=s.n(sI),sz=s(83025),s$=s.n(sz),sL=s(57412),sD=s.n(sL);s(49642),s(96397),sE().extend(s$()),sE().extend(sD());let sT=new Set(["fr","en","de","es","it","pt","nl","pl","ja","zh"]),s_=null;function sR(){let e=function(){if("u"<typeof navigator)return"fr";let e=navigator.language.split("-")[0]?.toLowerCase()??"fr";return sT.has(e)?e:"en"}();s_!==e&&(sE().locale(e),s_=e)}function sP(e){if(!e?.trim())return null;let t=sE()(e);return t.isValid()?t:null}function sF(e,t){return e.isAfter(t)?"":` (${e.fromNow()})`}function sO(e,t=sE()()){sR();let s=sP(e);if(!s)return"—";let a=s.format("LT"),n=s.format("ddd D MMM");return s.isSame(t,"year")?`${n} ${a}`:`${s.format("ddd D MMM YYYY")} ${a}`}let sq="animate-[spin_0.55s_linear_infinite]";function sW(e){return e?sO(e):"—"}function sB(e){if(!e)return"";let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let s=e=>String(e).padStart(2,"0");return`${t.getFullYear()}-${s(t.getMonth()+1)}-${s(t.getDate())}T${s(t.getHours())}:${s(t.getMinutes())}`}function sU(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString()}function sH(e,t,s,a){let n=t.includes(e)?t:[e];if("scheduled"!==s)return n;let r=n.filter(e=>a.some(t=>t.id===e&&t.labels?.includes("scheduled")));return r.length>0?r:[e]}function sV(e,t){return e?"mdi:flag-outline":t?"mdi:label-variant":"mdi:label-variant-outline"}let sK="h-4 w-4 shrink-0";function sQ(e,t){return e?"bg-mail-row-selected":t?"bg-mail-row-read":"bg-mail-row-unread"}var sG=s(3207),sY=s(82984);let sZ=JSON.parse('{"prefix":"logos","icons":{"google-meet":{"body":"<path fill=\\"#00832d\\" d=\\"m144.822 105.322l24.957 28.527l33.562 21.445l5.838-49.792l-5.838-48.669l-34.205 18.839z\\"/><path fill=\\"#0066da\\" d=\\"M0 150.66v42.43c0 9.688 7.864 17.554 17.554 17.554h42.43l8.786-32.059l-8.786-27.925l-29.11-8.786z\\"/><path fill=\\"#e94235\\" d=\\"M59.984 0L0 59.984l30.876 8.765l29.108-8.765l8.626-27.545z\\"/><path fill=\\"#2684fc\\" d=\\"M.001 150.679h59.983V59.983H.001z\\"/><path fill=\\"#00ac47\\" d=\\"M241.659 25.398L203.34 56.834v98.46l38.477 31.558c5.76 4.512 14.186.4 14.186-6.922V32.18c0-7.403-8.627-11.495-14.345-6.781\\"/><path fill=\\"#00ac47\\" d=\\"M144.822 105.322v45.338H59.984v59.984h125.804c9.69 0 17.553-7.866 17.553-17.554v-37.796z\\"/><path fill=\\"#ffba00\\" d=\\"M185.788 0H59.984v59.984h84.838v45.338l58.52-48.49V17.555c0-9.69-7.864-17.554-17.554-17.554\\"/>","height":211},"microsoft-teams":{"body":"<defs><linearGradient id=\\"SVGCo9xpmZW\\" x1=\\"17.372%\\" x2=\\"82.628%\\" y1=\\"-6.51%\\" y2=\\"106.51%\\"><stop offset=\\"0%\\" stop-color=\\"#5a62c3\\"/><stop offset=\\"50%\\" stop-color=\\"#4d55bd\\"/><stop offset=\\"100%\\" stop-color=\\"#3940ab\\"/></linearGradient><path id=\\"SVGhJCUgeMn\\" d=\\"M136.93 64.476v12.8a32.7 32.7 0 0 1-5.953-.952a38.7 38.7 0 0 1-26.79-22.742h21.848c6.008.022 10.872 4.887 10.895 10.894\\"/></defs><path fill=\\"#5059c9\\" d=\\"M178.563 89.302h66.125c6.248 0 11.312 5.065 11.312 11.312v60.231c0 22.96-18.613 41.574-41.573 41.574h-.197c-22.96.003-41.576-18.607-41.579-41.568V95.215a5.91 5.91 0 0 1 5.912-5.913\\"/><circle cx=\\"223.256\\" cy=\\"50.605\\" r=\\"26.791\\" fill=\\"#5059c9\\"/><circle cx=\\"139.907\\" cy=\\"38.698\\" r=\\"38.698\\" fill=\\"#7b83eb\\"/><path fill=\\"#7b83eb\\" d=\\"M191.506 89.302H82.355c-6.173.153-11.056 5.276-10.913 11.449v68.697c-.862 37.044 28.445 67.785 65.488 68.692c37.043-.907 66.35-31.648 65.489-68.692v-68.697c.143-6.173-4.74-11.296-10.913-11.449\\"/><path d=\\"M142.884 89.302v96.268a10.96 10.96 0 0 1-6.787 10.062c-1.3.55-2.697.833-4.108.833H76.68c-.774-1.965-1.488-3.93-2.084-5.953a72.5 72.5 0 0 1-3.155-21.076v-68.703c-.143-6.163 4.732-11.278 10.895-11.43z\\" opacity=\\".1\\"/><path d=\\"M136.93 89.302v102.222c0 1.411-.283 2.808-.833 4.108a10.96 10.96 0 0 1-10.062 6.787H79.48c-1.012-1.965-1.965-3.93-2.798-5.954a59 59 0 0 1-2.084-5.953a72.5 72.5 0 0 1-3.155-21.076v-68.703c-.143-6.163 4.732-11.278 10.895-11.43z\\" opacity=\\".2\\"/><path d=\\"M136.93 89.302v90.315c-.045 5.998-4.896 10.85-10.895 10.895H74.597a72.5 72.5 0 0 1-3.155-21.076v-68.703c-.143-6.163 4.732-11.278 10.895-11.43z\\" opacity=\\".2\\"/><path d=\\"M130.977 89.302v90.315c-.046 5.998-4.897 10.85-10.895 10.895H74.597a72.5 72.5 0 0 1-3.155-21.076v-68.703c-.143-6.163 4.732-11.278 10.895-11.43z\\" opacity=\\".2\\"/><path d=\\"M142.884 58.523v18.753c-1.012.06-1.965.12-2.977.12s-1.965-.06-2.977-.12a32.7 32.7 0 0 1-5.953-.952a38.7 38.7 0 0 1-26.791-22.742a33 33 0 0 1-1.905-5.954h29.708c6.007.023 10.872 4.887 10.895 10.895\\" opacity=\\".1\\"/><use href=\\"#SVGhJCUgeMn\\" opacity=\\".2\\"/><use href=\\"#SVGhJCUgeMn\\" opacity=\\".2\\"/><path d=\\"M130.977 64.476v11.848a38.7 38.7 0 0 1-26.791-22.743h15.896c6.008.023 10.872 4.888 10.895 10.895\\" opacity=\\".2\\"/><path fill=\\"url(#SVGCo9xpmZW)\\" d=\\"M10.913 53.581h109.15c6.028 0 10.914 4.886 10.914 10.913v109.151c0 6.027-4.886 10.913-10.913 10.913H10.913C4.886 184.558 0 179.672 0 173.645V64.495C0 58.466 4.886 53.58 10.913 53.58\\"/><path fill=\\"#fff\\" d=\\"M94.208 95.125h-21.82v59.416H58.487V95.125H36.769V83.599h57.439z\\"/>","height":239},"skype":{"body":"<defs><linearGradient id=\\"SVGqnYbCynC\\" x1=\\"42.173%\\" x2=\\"57.827%\\" y1=\\".584%\\" y2=\\"99.416%\\"><stop offset=\\"1%\\" stop-color=\\"#00b7f0\\"/><stop offset=\\"34%\\" stop-color=\\"#009de5\\"/><stop offset=\\"76%\\" stop-color=\\"#0082d9\\"/><stop offset=\\"100%\\" stop-color=\\"#0078d4\\"/></linearGradient><linearGradient id=\\"SVGitzdbVyt\\" x1=\\"6.659%\\" x2=\\"93.341%\\" y1=\\"75%\\" y2=\\"25%\\"><stop offset=\\"0%\\" stop-color=\\"#0078d4\\"/><stop offset=\\"37%\\" stop-color=\\"#007ad5\\"/><stop offset=\\"57%\\" stop-color=\\"#0082d9\\"/><stop offset=\\"74%\\" stop-color=\\"#0090df\\"/><stop offset=\\"88%\\" stop-color=\\"#00a3e7\\"/><stop offset=\\"100%\\" stop-color=\\"#00bcf2\\"/></linearGradient><linearGradient id=\\"SVGi9NpgdLd\\" x1=\\"30.436%\\" x2=\\"80.436%\\" y1=\\"16.124%\\" y2=\\"102.737%\\"><stop offset=\\"0%\\" stop-color=\\"#00b7f0\\"/><stop offset=\\"100%\\" stop-color=\\"#007cc1\\"/></linearGradient><linearGradient id=\\"SVGWrzseb8A\\" x1=\\"45.636%\\" x2=\\"54.364%\\" y1=\\"99.815%\\" y2=\\".185%\\"><stop offset=\\"0%\\" stop-color=\\"#0078d4\\"/><stop offset=\\"100%\\" stop-color=\\"#00bcf2\\"/></linearGradient><radialGradient id=\\"SVG0S4yqeVs\\" cx=\\"48.539%\\" cy=\\"50%\\" r=\\"50.021%\\" fx=\\"48.539%\\" fy=\\"50%\\"><stop offset=\\"0%\\"/><stop offset=\\"100%\\" stop-opacity=\\"0\\"/></radialGradient><path id=\\"SVGoMjHpbTa\\" d=\\"M179.903 104.187a75.7 75.7 0 0 0-38.567 10.55c19.535-32.94 11.499-75.273-18.749-98.764C92.34-7.52 49.337-4.827 22.255 22.255C-4.826 49.336-7.519 92.34 15.973 122.587c23.491 30.248 65.823 38.284 98.765 18.749c-17.49 29.642-12.843 67.344 11.322 91.852c24.166 24.508 61.798 29.685 91.684 12.613s44.542-52.118 35.705-85.382c-8.836-33.265-38.95-56.418-73.37-56.409z\\"/></defs><path fill=\\"#fff\\" d=\\"M246.663 143.907a115 115 0 0 0 1.153-15.782A119.87 119.87 0 0 0 127.948 8.258c-5.28.022-10.553.407-15.781 1.152C82.62-6.514 46.125-1.165 22.392 22.57S-6.691 82.797 9.233 112.344c-.745 5.228-1.13 10.5-1.153 15.781c0 66.202 53.667 119.868 119.868 119.868c5.28-.022 10.554-.407 15.782-1.152c29.546 15.924 66.04 10.575 89.775-13.16c23.733-23.733 29.083-60.228 13.158-89.774\\"/><circle cx=\\"75.994\\" cy=\\"76.171\\" r=\\"75.893\\" fill=\\"url(#SVGqnYbCynC)\\"/><circle cx=\\"179.903\\" cy=\\"180.08\\" r=\\"75.893\\" fill=\\"url(#SVGitzdbVyt)\\"/><mask id=\\"SVG8vSaYcHP\\" fill=\\"#fff\\"><use href=\\"#SVGoMjHpbTa\\"/></mask><circle cx=\\"125.547\\" cy=\\"133.578\\" r=\\"141.812\\" fill=\\"url(#SVG0S4yqeVs)\\" mask=\\"url(#SVG8vSaYcHP)\\"/><circle cx=\\"127.948\\" cy=\\"128.125\\" r=\\"119.868\\" fill=\\"url(#SVGi9NpgdLd)\\"/><circle cx=\\"127.948\\" cy=\\"128.125\\" r=\\"119.868\\" fill=\\"url(#SVGWrzseb8A)\\"/><path fill=\\"#fff\\" d=\\"M84.239 113.408a34.76 34.76 0 0 1-4.078-17.2a31.12 31.12 0 0 1 7.27-20.746a44.33 44.33 0 0 1 18.973-12.59a73.1 73.1 0 0 1 24.736-4.167a101 101 0 0 1 16.49 1.241a70 70 0 0 1 11.438 2.926a21.9 21.9 0 0 1 8.866 5.763a11.26 11.26 0 0 1 2.837 7.625a11.17 11.17 0 0 1-2.926 8.068a9.57 9.57 0 0 1-7.27 3.014a13.7 13.7 0 0 1-5.497-1.241a103 103 0 0 0-12.856-4.7a46.5 46.5 0 0 0-12.5-1.506a29.26 29.26 0 0 0-15.605 3.9a12.94 12.94 0 0 0-6.206 11.704a11.7 11.7 0 0 0 3.192 8.156a29.8 29.8 0 0 0 8.866 6.295c3.635 1.773 8.866 4.167 16.313 7.182l2.305.886a111.4 111.4 0 0 1 20.126 10.107a40.8 40.8 0 0 1 12.501 12.767a33.6 33.6 0 0 1 4.522 17.732a35.46 35.46 0 0 1-6.295 21.367a36.7 36.7 0 0 1-17.732 12.945a73.5 73.5 0 0 1-26.155 4.255a82.4 82.4 0 0 1-35.464-6.738a20.04 20.04 0 0 1-7.358-5.674a13.5 13.5 0 0 1-2.305-7.802a9.93 9.93 0 0 1 3.103-7.89a11.35 11.35 0 0 1 8.068-2.838a21.2 21.2 0 0 1 9.486 2.394c3.635 1.773 6.472 3.192 8.866 4.078a40 40 0 0 0 7.359 2.305a39.5 39.5 0 0 0 9.487.976a25.18 25.18 0 0 0 15.958-4.256a13.83 13.83 0 0 0 5.408-11.614a12.5 12.5 0 0 0-3.369-8.866a37.9 37.9 0 0 0-9.93-7.27c-4.344-2.306-10.55-5.054-18.44-8.423a118 118 0 0 1-20.304-10.462c-4.796-3.19-8.977-6.727-11.88-11.703\\"/>"},"zoom":{"body":"<path fill=\\"#0b5cff\\" d=\\"M107.472 114.706H16.348c-5.968 0-11.791-3.203-14.557-8.589C-1.41 99.858-.247 92.434 4.702 87.63L68.17 24.164H22.607C10.088 24.164.044 13.974.044 1.6h83.992c5.968 0 11.79 3.203 14.556 8.589c3.203 6.259 2.038 13.683-2.911 18.486L32.214 92.143h52.55c12.518 0 22.708 10.19 22.708 22.563M468.183 0c-13.1 0-24.746 5.677-32.898 14.702C427.134 5.677 415.488 0 402.388 0c-24.164 0-43.961 20.67-43.961 44.834v69.872c12.518 0 22.562-10.19 22.562-22.563V44.689c0-11.646 9.025-21.544 20.67-21.98c12.228-.437 22.272 9.315 22.272 21.397v48.037c0 12.519 10.19 22.563 22.563 22.563V44.543c0-11.645 9.025-21.544 20.67-21.98c12.228-.437 22.272 9.316 22.272 21.398v48.036c0 12.52 10.19 22.563 22.563 22.563V44.69C512.144 20.67 492.347 0 468.183 0M221.595 58.226c0 32.17-26.056 58.226-58.226 58.226s-58.226-26.056-58.226-58.226S131.199 0 163.369 0s58.226 26.056 58.226 58.226m-22.563 0c0-19.651-16.012-35.663-35.663-35.663s-35.664 16.012-35.664 35.663c0 19.652 16.013 35.664 35.664 35.664s35.663-16.012 35.663-35.664m148.04 0c0 32.17-26.056 58.226-58.226 58.226S230.62 90.396 230.62 58.226S256.676 0 288.846 0s58.227 26.056 58.227 58.226m-22.562 0c0-19.651-16.012-35.663-35.664-35.663c-19.65 0-35.663 16.012-35.663 35.663c0 19.652 16.012 35.664 35.663 35.664c19.652 0 35.664-16.012 35.664-35.664\\"/>","width":512,"height":117},"zoom-icon":{"body":"<defs><linearGradient id=\\"SVGElB4fdaE\\" x1=\\"23.666%\\" x2=\\"76.334%\\" y1=\\"95.612%\\" y2=\\"4.388%\\"><stop offset=\\"0%\\" stop-color=\\"#0845bf\\"/><stop offset=\\"19.11%\\" stop-color=\\"#0950de\\"/><stop offset=\\"38.23%\\" stop-color=\\"#0b59f6\\"/><stop offset=\\"50%\\" stop-color=\\"#0b5cff\\"/><stop offset=\\"67.32%\\" stop-color=\\"#0e5efe\\"/><stop offset=\\"77.74%\\" stop-color=\\"#1665fc\\"/><stop offset=\\"86.33%\\" stop-color=\\"#246ff9\\"/><stop offset=\\"93.88%\\" stop-color=\\"#387ff4\\"/><stop offset=\\"100%\\" stop-color=\\"#4f90ee\\"/></linearGradient></defs><path fill=\\"url(#SVGElB4fdaE)\\" d=\\"M256 128c0 13.568-1.024 27.136-3.328 40.192c-6.912 43.264-41.216 77.568-84.48 84.48C155.136 254.976 141.568 256 128 256s-27.136-1.024-40.192-3.328c-43.264-6.912-77.568-41.216-84.48-84.48C1.024 155.136 0 141.568 0 128s1.024-27.136 3.328-40.192c6.912-43.264 41.216-77.568 84.48-84.48C100.864 1.024 114.432 0 128 0s27.136 1.024 40.192 3.328c43.264 6.912 77.568 41.216 84.48 84.48C254.976 100.864 256 114.432 256 128\\"/><path fill=\\"#fff\\" d=\\"M204.032 207.872H75.008c-8.448 0-16.64-4.608-20.48-12.032c-4.608-8.704-2.816-19.2 4.096-26.112l89.856-89.856H83.968c-17.664 0-32-14.336-32-32h118.784c8.448 0 16.64 4.608 20.48 12.032c4.608 8.704 2.816 19.2-4.096 26.112l-89.6 90.112h74.496c17.664 0 32 14.08 32 31.744\\"/>"},"whatsapp-icon":{"body":"<defs><linearGradient id=\\"SVGK3KZq49U\\" x1=\\"50%\\" x2=\\"50%\\" y1=\\"100%\\" y2=\\"0%\\"><stop offset=\\"0%\\" stop-color=\\"#1faf38\\"/><stop offset=\\"100%\\" stop-color=\\"#60d669\\"/></linearGradient><linearGradient id=\\"SVGefMkoEOd\\" x1=\\"50%\\" x2=\\"50%\\" y1=\\"100%\\" y2=\\"0%\\"><stop offset=\\"0%\\" stop-color=\\"#f9f9f9\\"/><stop offset=\\"100%\\" stop-color=\\"#fff\\"/></linearGradient></defs><path fill=\\"url(#SVGK3KZq49U)\\" d=\\"M5.463 127.456c-.006 21.677 5.658 42.843 16.428 61.499L4.433 252.697l65.232-17.104a123 123 0 0 0 58.8 14.97h.054c67.815 0 123.018-55.183 123.047-123.01c.013-32.867-12.775-63.773-36.009-87.025c-23.23-23.25-54.125-36.061-87.043-36.076c-67.823 0-123.022 55.18-123.05 123.004\\"/><path fill=\\"url(#SVGefMkoEOd)\\" d=\\"M1.07 127.416c-.007 22.457 5.86 44.38 17.014 63.704L0 257.147l67.571-17.717c18.618 10.151 39.58 15.503 60.91 15.511h.055c70.248 0 127.434-57.168 127.464-127.423c.012-34.048-13.236-66.065-37.3-90.15C194.633 13.286 162.633.014 128.536 0C58.276 0 1.099 57.16 1.071 127.416m40.24 60.376l-2.523-4.005c-10.606-16.864-16.204-36.352-16.196-56.363C22.614 69.029 70.138 21.52 128.576 21.52c28.3.012 54.896 11.044 74.9 31.06c20.003 20.018 31.01 46.628 31.003 74.93c-.026 58.395-47.551 105.91-105.943 105.91h-.042c-19.013-.01-37.66-5.116-53.922-14.765l-3.87-2.295l-40.098 10.513z\\"/><path fill=\\"#fff\\" d=\\"M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64\\"/>","height":258},"signal":{"body":"<path fill=\\"#3a76f0\\" d=\\"m97.28 3.74l2.88 11.639A115.7 115.7 0 0 0 68 28.678l-6.16-10.28A127.5 127.5 0 0 1 97.28 3.74m61.44 0l-2.88 11.639A115.7 115.7 0 0 1 188 28.678l6.2-10.28A127.5 127.5 0 0 0 158.72 3.74M18.4 61.835A127.5 127.5 0 0 0 3.74 97.272l11.64 2.88a115.7 115.7 0 0 1 13.3-32.157zM12 127.99a116 116 0 0 1 1.3-17.379l-11.86-1.8a128.4 128.4 0 0 0 0 38.358l11.86-1.8A116 116 0 0 1 12 127.99m182.16 109.592l-6.16-10.28a115.7 115.7 0 0 1-32.12 13.3l2.88 11.638a127.5 127.5 0 0 0 35.4-14.658M244 127.99a116 116 0 0 1-1.3 17.379l11.86 1.8a128.4 128.4 0 0 0 0-38.357l-11.86 1.8a116 116 0 0 1 1.3 17.378m8.26 30.718l-11.64-2.88a115.7 115.7 0 0 1-13.3 32.157l10.28 6.2a127.5 127.5 0 0 0 14.66-35.477M145.38 242.7a116.8 116.8 0 0 1-34.76 0l-1.8 11.86a128.5 128.5 0 0 0 38.36 0zm76-45.896a116.4 116.4 0 0 1-24.58 24.558l7.12 9.659a128.2 128.2 0 0 0 27.12-27.038zM196.8 34.617a116.4 116.4 0 0 1 24.58 24.578l9.66-7.2A128.2 128.2 0 0 0 204 24.959zM34.62 59.195A116.4 116.4 0 0 1 59.2 34.617L52 24.958a128.2 128.2 0 0 0-27.04 27.038zm202.98 2.64l-10.28 6.16a115.7 115.7 0 0 1 13.3 32.117l11.64-2.88a127.5 127.5 0 0 0-14.66-35.397M110.62 13.3a116.8 116.8 0 0 1 34.76 0l1.8-11.86a128.5 128.5 0 0 0-38.36 0zM40.78 234.202L16 239.982l5.78-24.779l-11.68-2.74l-5.78 24.779a11.998 11.998 0 0 0 14.42 14.418l24.76-5.68zM12.6 201.764l11.68 2.72l4-17.179a115.5 115.5 0 0 1-12.9-31.477l-11.64 2.88a127 127 0 0 0 11.8 30.417zm56 25.998l-17.18 4l2.72 11.68l12.64-2.94A127 127 0 0 0 97.2 252.3l2.88-11.639a115.5 115.5 0 0 1-31.4-12.979zM128 23.998c-37.843.02-72.69 20.593-90.985 53.717C18.72 110.84 19.863 151.287 40 183.325l-10 42.657l42.66-9.999c37.418 23.566 85.647 20.894 120.233-6.66s47.963-73.965 33.35-115.698C211.63 51.89 172.22 23.962 128 23.998\\"/>"},"instagram":{"body":"<path fill=\\"#343433\\" d=\\"M27.127.902C16.68 5.278 5.197 17.625 1.57 33.135C-3.024 52.78 16.09 61.09 17.659 58.369c1.845-3.201-3.425-4.283-4.51-14.477c-1.402-13.166 4.719-27.877 12.423-34.332c1.43-1.2 1.363.47 1.363 3.557c0 5.521-.305 55.085-.305 65.429c0 13.996-.578 18.416-1.617 22.784c-1.051 4.425-2.743 7.416-1.462 8.568c1.432 1.288 7.546-1.777 11.085-6.716c4.244-5.924 5.73-13.04 5.997-20.765c.322-9.314.308-24.094.322-32.524c.012-7.731.13-30.37-.136-43.98c-.065-3.34-9.323-6.842-13.692-5.011M398.07 66.405c-.337 7.277-1.948 12.964-3.947 16.976c-3.87 7.767-11.9 10.178-15.31-.986c-1.858-6.086-1.945-16.25-.61-24.743c1.36-8.651 5.158-15.185 11.445-14.596c6.202.583 9.105 8.574 8.422 23.35m-104.55 45.146c-.084 12.09-1.987 22.69-6.067 25.77c-5.788 4.366-13.567 1.09-11.956-7.732c1.425-7.807 8.166-15.78 18.04-25.522c0 0 .02 2.222-.017 7.484m-1.58-45.217c-.354 6.628-2.072 13.285-3.947 17.047c-3.87 7.767-11.958 10.195-15.31-.986c-2.292-7.64-1.743-17.526-.61-23.756c1.472-8.083 5.04-15.582 11.445-15.582c6.228 0 9.3 6.833 8.422 23.277m-60.565-.1c-.38 7.018-1.749 12.885-3.946 17.147c-3.976 7.714-11.842 10.16-15.31-.986c-2.501-8.037-1.65-18.995-.61-24.915c1.544-8.785 5.41-15.013 11.445-14.423c6.199.606 9.212 8.573 8.421 23.177m277.553 8.198c-1.515 0-2.207 1.562-2.78 4.19c-1.983 9.144-4.07 11.207-6.759 11.207c-3.005 0-5.705-4.526-6.4-13.588c-.545-7.126-.457-20.244.24-33.293c.143-2.681-.597-5.334-7.788-7.946c-3.094-1.124-7.592-2.779-9.832 2.627c-6.327 15.274-8.803 27.4-9.386 32.324c-.03.255-.343.308-.397-.288c-.372-3.945-1.201-11.115-1.305-26.177c-.02-2.939-.642-5.44-3.886-7.488c-2.105-1.33-8.496-3.68-10.797-.883c-1.994 2.286-4.304 8.44-6.703 15.736c-1.95 5.93-3.308 9.94-3.308 9.94s.026-15.998.049-22.067c.01-2.289-1.56-3.052-2.034-3.19c-2.13-.618-6.33-1.651-8.112-1.651c-2.2 0-2.738 1.228-2.738 3.02c0 .235-.347 21.063-.347 35.627c0 .633 0 1.323.003 2.057c-1.216 6.694-5.161 15.78-9.451 15.78c-4.296 0-6.322-3.798-6.322-21.161c0-10.129.304-14.534.453-21.86c.087-4.22.255-7.46.245-8.195c-.032-2.255-3.93-3.392-5.745-3.812c-1.823-.423-3.407-.588-4.644-.517c-1.751.1-2.99 1.247-2.99 2.827c0 .848.01 2.458.01 2.458c-2.255-3.544-5.882-6.01-8.295-6.725c-6.5-1.93-13.282-.22-18.398 6.939c-4.066 5.687-6.517 12.13-7.482 21.385c-.705 6.767-.475 13.628.779 19.431c-1.515 6.548-4.326 9.23-7.405 9.23c-4.47 0-7.71-7.294-7.334-19.912c.248-8.299 1.909-14.123 3.724-22.549c.774-3.592.145-5.472-1.432-7.274c-1.447-1.653-4.53-2.498-8.96-1.46c-3.156.741-7.669 1.538-11.798 2.15c0 0 .25-.995.454-2.747c1.074-9.19-8.913-8.445-12.1-5.51c-1.901 1.753-3.196 3.82-3.687 7.536c-.78 5.898 4.03 8.68 4.03 8.68c-1.577 7.224-5.446 16.66-9.44 23.483c-2.139 3.655-3.775 6.364-5.888 9.243a1388 1388 0 0 1 .226-34.66c.087-4.22.256-7.374.247-8.11c-.024-1.648-.987-2.272-2.99-3.06c-1.772-.698-3.866-1.18-6.039-1.35c-2.742-.212-4.394 1.241-4.35 2.961c.008.325.008 2.319.008 2.319c-2.255-3.544-5.882-6.01-8.295-6.725c-6.5-1.93-13.282-.22-18.398 6.939c-4.065 5.687-6.727 13.669-7.482 21.315c-.702 7.125-.573 13.18.385 18.282c-1.033 5.108-4.005 10.45-7.364 10.45c-4.296 0-6.74-3.799-6.74-21.162c0-10.129.304-14.534.454-21.86c.087-4.219.254-7.46.245-8.195c-.032-2.255-3.931-3.391-5.746-3.812c-1.898-.44-3.537-.6-4.796-.507c-1.66.123-2.828 1.61-2.828 2.719v2.556c-2.255-3.544-5.882-6.01-8.295-6.725c-6.5-1.93-13.244-.192-18.398 6.939c-3.36 4.649-6.081 9.803-7.481 21.213c-.405 3.297-.584 6.386-.56 9.271c-1.34 8.196-7.26 17.642-12.101 17.642c-2.833 0-5.532-5.496-5.532-17.207c0-15.6.966-37.812 1.13-39.952c0 0 6.117-.104 7.301-.118c3.052-.034 5.815.039 9.88-.17c2.038-.103 4.002-7.42 1.898-8.325c-.954-.41-7.693-.768-10.365-.825c-2.246-.05-8.5-.514-8.5-.514s.561-14.743.692-16.3c.11-1.299-1.57-1.967-2.532-2.372c-2.342-.99-4.437-1.465-6.92-1.977c-3.432-.708-4.988-.015-5.292 2.88c-.458 4.395-.695 17.268-.695 17.268c-2.518 0-11.12-.492-13.638-.492c-2.34 0-4.866 10.064-1.63 10.188c3.722.144 10.209.27 14.509.398c0 0-.192 22.578-.192 29.55q.001 1.11.008 2.148c-2.367 12.335-10.703 18.999-10.703 18.999c1.79-8.161-1.867-14.29-8.454-19.478c-2.427-1.911-7.218-5.53-12.578-9.496c0 0 3.104-3.06 5.858-9.216c1.95-4.362 2.035-9.351-2.754-10.452c-7.912-1.82-14.435 3.991-16.381 10.195c-1.508 4.806-.704 8.371 2.25 12.075c.215.271.45.548.69.826c-1.785 3.442-4.239 8.077-6.317 11.671c-5.768 9.98-10.125 17.872-13.418 17.872c-2.632 0-2.597-8.014-2.597-15.517c0-6.468.478-16.193.86-26.26c.126-3.33-1.54-5.227-4.33-6.945c-1.696-1.044-5.315-3.096-7.411-3.096c-3.138 0-12.19.427-20.742 25.167c-1.078 3.118-3.196 8.8-3.196 8.8l.183-29.751c0-.698-.372-1.372-1.223-1.833c-1.441-.783-5.29-2.383-8.713-2.383q-2.445.001-2.445 2.27l-.298 46.546c0 3.537.092 7.663.442 9.467c.348 1.806.913 3.276 1.611 4.15c.699.873 1.506 1.54 2.837 1.814c1.239.255 8.023 1.126 8.376-1.466c.422-3.108.439-6.468 4.001-19.002C75.89 58.072 83.12 48.552 86.52 45.17c.595-.59 1.273-.626 1.24.341c-.144 4.278-.655 14.97-.998 24.05c-.921 24.305 3.5 28.81 9.819 28.81c4.834 0 11.648-4.803 18.952-16.961a4281 4281 0 0 0 12.153-20.36c2.213 2.049 4.698 4.254 7.18 6.61c5.77 5.476 7.664 10.68 6.407 15.616c-.96 3.773-4.581 7.662-11.024 3.883c-1.878-1.103-2.68-1.956-4.568-3.199c-1.014-.667-2.563-.867-3.492-.167c-2.412 1.818-3.792 4.132-4.58 6.996c-.766 2.787 2.025 4.26 4.919 5.549c2.491 1.109 7.846 2.114 11.26 2.228c13.305.445 23.964-6.424 31.384-24.143c1.328 15.303 6.98 23.962 16.801 23.962c6.566 0 13.149-8.487 16.028-16.836c.826 3.403 2.05 6.363 3.63 8.866c7.567 11.99 22.247 9.41 29.621-.772c2.28-3.146 2.627-4.276 2.627-4.276c1.076 9.613 8.818 12.972 13.25 12.972c4.965 0 10.09-2.347 13.683-10.435q.63 1.319 1.383 2.511c7.567 11.99 22.248 9.41 29.622-.772q.52-.716.913-1.3l.216 6.315l-6.789 6.227c-11.38 10.43-20.024 18.34-20.66 27.553c-.81 11.747 8.712 16.113 15.926 16.685c7.647.607 14.208-3.621 18.234-9.538c3.544-5.209 5.864-16.419 5.693-27.49c-.067-4.434-.18-10.071-.267-16.114c3.995-4.639 8.496-10.503 12.64-17.365c4.516-7.479 9.356-17.523 11.834-25.34c0 0 4.205.037 8.693-.257c1.435-.094 1.848.2 1.582 1.251c-.32 1.272-5.67 21.905-.787 35.65c3.341 9.41 10.874 12.436 15.34 12.436c5.229 0 10.23-3.948 12.91-9.81c.324.653.661 1.285 1.03 1.87c7.567 11.99 22.196 9.393 29.622-.773c1.676-2.294 2.627-4.276 2.627-4.276c1.593 9.95 9.331 13.023 13.763 13.023c4.616 0 8.998-1.893 12.552-10.304c.15 3.704.383 6.732.752 7.686c.225.585 1.537 1.317 2.491 1.671c4.224 1.566 8.53.826 10.124.504c1.104-.224 1.965-1.11 2.083-3.396c.31-6.005.12-16.094 1.94-23.593c3.055-12.583 5.906-17.464 7.258-19.88c.757-1.355 1.61-1.578 1.641-.145c.064 2.9.208 11.413 1.392 22.853c.87 8.412 2.03 13.385 2.923 14.96c2.548 4.5 5.693 4.713 8.255 4.713c1.63 0 5.038-.45 4.733-3.314c-.149-1.396.111-10.024 3.124-22.421c1.967-8.096 5.247-15.41 6.43-18.085c.437-.986.64-.209.632-.057c-.249 5.575-.808 23.811 1.463 33.785c3.08 13.511 11.986 15.023 15.09 15.023c6.626 0 12.045-5.04 13.87-18.302c.44-3.192-.211-5.656-2.162-5.656\\"/>","width":512,"height":146},"instagram-icon":{"body":"<path fill=\\"#0a0a08\\" d=\\"M128 23.064c34.177 0 38.225.13 51.722.745c12.48.57 19.258 2.655 23.769 4.408c5.974 2.322 10.238 5.096 14.717 9.575s7.253 8.743 9.575 14.717c1.753 4.511 3.838 11.289 4.408 23.768c.615 13.498.745 17.546.745 51.723s-.13 38.226-.745 51.723c-.57 12.48-2.655 19.257-4.408 23.768c-2.322 5.974-5.096 10.239-9.575 14.718s-8.743 7.253-14.717 9.574c-4.511 1.753-11.289 3.839-23.769 4.408c-13.495.616-17.543.746-51.722.746s-38.228-.13-51.723-.746c-12.48-.57-19.257-2.655-23.768-4.408c-5.974-2.321-10.239-5.095-14.718-9.574c-4.479-4.48-7.253-8.744-9.574-14.718c-1.753-4.51-3.839-11.288-4.408-23.768c-.616-13.497-.746-17.545-.746-51.723s.13-38.225.746-51.722c.57-12.48 2.655-19.258 4.408-23.769c2.321-5.974 5.095-10.238 9.574-14.717c4.48-4.48 8.744-7.253 14.718-9.575c4.51-1.753 11.288-3.838 23.768-4.408c13.497-.615 17.545-.745 51.723-.745M128 0C93.237 0 88.878.147 75.226.77c-13.625.622-22.93 2.786-31.071 5.95c-8.418 3.271-15.556 7.648-22.672 14.764S9.991 35.738 6.72 44.155C3.555 52.297 1.392 61.602.77 75.226C.147 88.878 0 93.237 0 128s.147 39.122.77 52.774c.622 13.625 2.785 22.93 5.95 31.071c3.27 8.417 7.647 15.556 14.763 22.672s14.254 11.492 22.672 14.763c8.142 3.165 17.446 5.328 31.07 5.95c13.653.623 18.012.77 52.775.77s39.122-.147 52.774-.77c13.624-.622 22.929-2.785 31.07-5.95c8.418-3.27 15.556-7.647 22.672-14.763s11.493-14.254 14.764-22.672c3.164-8.142 5.328-17.446 5.95-31.07c.623-13.653.77-18.012.77-52.775s-.147-39.122-.77-52.774c-.622-13.624-2.786-22.929-5.95-31.07c-3.271-8.418-7.648-15.556-14.764-22.672S220.262 9.99 211.845 6.72c-8.142-3.164-17.447-5.328-31.071-5.95C167.122.147 162.763 0 128 0m0 62.27c-36.302 0-65.73 29.43-65.73 65.73s29.428 65.73 65.73 65.73c36.301 0 65.73-29.428 65.73-65.73c0-36.301-29.429-65.73-65.73-65.73m0 108.397c-23.564 0-42.667-19.103-42.667-42.667S104.436 85.333 128 85.333s42.667 19.103 42.667 42.667s-19.103 42.667-42.667 42.667m83.686-110.994c0 8.484-6.876 15.36-15.36 15.36s-15.36-6.876-15.36-15.36s6.877-15.36 15.36-15.36s15.36 6.877 15.36 15.36\\"/>"},"discord":{"body":"<path fill=\\"#5865f2\\" d=\\"M82.003 0a104.2 104.2 0 0 1 26.402 8.297c14.484 21.63 21.68 46.025 19.023 74.163c-11.082 8.286-21.831 13.313-32.4 16.603a80 80 0 0 1-6.935-11.421a68 68 0 0 0 10.94-5.326a66 66 0 0 1-2.677-2.118c-20.805 9.85-43.684 9.85-64.74 0c-.866.73-1.762 1.44-2.678 2.118a68 68 0 0 0 10.921 5.315a80.5 80.5 0 0 1-6.935 11.422C22.365 95.763 11.626 90.736.544 82.46C-1.722 58.188 2.807 33.566 19.516 8.317A104 104 0 0 1 45.939 0c1.147 2.056 2.506 4.822 3.422 7.022q14.494-2.22 29.26 0A77 77 0 0 1 82.003 0m253.933 31.687q10.567 0 17.544 4.533v13.17q-2.461-1.727-5.738-2.807q-3.274-1.08-7.016-1.08c-4.368 0-7.78.813-10.246 2.447s-3.703 3.763-3.703 6.405c0 2.59 1.196 4.709 3.592 6.374c2.397 1.655 5.868 2.488 10.428 2.488c2.345 0 4.66-.35 6.945-1.038c2.275-.7 4.238-1.553 5.878-2.56v12.737q-7.745 4.75-17.967 4.75c-5.736-.02-10.629-1.028-14.665-3.043s-7.086-4.75-9.119-8.204s-3.06-7.34-3.06-11.658s1.057-8.183 3.17-11.586q3.17-5.104 9.302-8.02c4.085-1.942 8.967-2.908 14.655-2.908m-52.917-.01c3.945 0 7.559.431 10.852 1.295c3.29.864 6.008 1.964 8.173 3.31v11.299c-2.216-1.347-4.753-2.406-7.65-3.208a33.6 33.6 0 0 0-8.92-1.182c-4.418 0-6.621.77-6.621 2.303c0 .72.342 1.254 1.026 1.614s1.942.73 3.764 1.12l7.045 1.296q6.904 1.22 10.287 4.276q3.383 3.054 3.382 9.037c0 4.37-1.86 7.834-5.596 10.404q-5.599 3.855-15.893 3.855c-4.037-.01-7.96-.514-11.766-1.522c-3.805-1.007-7.238-2.467-10.287-4.39V59.24q3.457 2.73 9.27 4.503c3.875 1.172 7.62 1.758 11.243 1.758q2.536 0 3.835-.679c.866-.452 1.3-.997 1.3-1.624c0-.72-.232-1.316-.706-1.8c-.473-.483-1.39-.884-2.747-1.223l-8.455-1.943c-4.842-1.151-8.275-2.745-10.317-4.79c-2.044-2.036-3.061-4.709-3.061-8.02c0-2.785.886-5.201 2.678-7.268q2.672-3.1 7.609-4.78c3.292-1.13 7.136-1.696 11.555-1.696M512 23.833v51.813h-17.263V66.22c-1.46 3.547-3.674 6.25-6.653 8.101c-2.98 1.84-6.664 2.766-11.032 2.766c-3.905 0-7.306-.967-10.217-2.91q-4.362-2.914-6.732-7.988c-1.57-3.382-2.367-7.206-2.367-11.483q-.075-6.615 2.507-11.874c1.712-3.506 4.136-6.24 7.257-8.204c3.12-1.963 6.684-2.95 10.68-2.95c8.082 0 13.548 3.524 16.408 10.564l.148.373V23.833zm-126.533 7.833c5.587 0 10.407.956 14.444 2.879c4.036 1.922 7.117 4.554 9.23 7.916c2.115 3.362 3.17 7.217 3.17 11.586c0 4.318-1.055 8.225-3.17 11.73c-2.113 3.506-5.204 6.26-9.27 8.276c-4.067 2.015-8.868 3.022-14.413 3.022c-5.547 0-10.348-.997-14.404-3.012c-4.067-2.015-7.166-4.77-9.301-8.276c-2.133-3.505-3.21-7.412-3.21-11.73c0-4.317 1.066-8.173 3.21-11.555c2.143-3.382 5.224-6.035 9.27-7.957c4.036-1.923 8.858-2.879 14.444-2.879m-132.36 11.802v32.404h-17.21V43.468c5.273 2.323 11.816 2.426 17.21 0m195.128-10.856c2.486 0 4.62.576 6.412 1.727v15.544c-1.791-1.203-4.107-1.799-6.975-1.799c-3.756 0-6.654 1.162-8.668 3.485c-2.022 2.324-3.03 5.942-3.03 10.836v13.241h-17.261V33.548h16.91v13.385c.936-4.894 2.457-8.502 4.55-10.836c2.084-2.323 4.78-3.485 8.062-3.485m-248.79-7.34c6.624 0 12.22 1.059 16.81 3.166c4.58 2.108 8.013 5.048 10.288 8.81c2.273 3.763 3.42 8.07 3.42 12.923c0 4.75-1.187 9.057-3.562 12.912c-2.376 3.866-5.99 6.92-10.85 9.17c-4.861 2.252-10.882 3.383-18.078 3.383h-25.506V25.272zM42.728 41.348c-6.432 0-11.505 5.912-11.505 13.098s5.184 13.087 11.505 13.087c6.432 0 11.515-5.901 11.505-13.087c.11-7.197-5.073-13.098-11.505-13.098m42.516 0c-6.432 0-11.505 5.912-11.505 13.098s5.184 13.087 11.505 13.087c6.432 0 11.505-5.901 11.505-13.087c.11-7.197-5.073-13.098-11.505-13.098m300.214 3.58c-3.01 0-5.366.853-7.087 2.56c-1.71 1.707-2.567 3.989-2.567 6.868q0 4.317 2.567 6.939c1.712 1.748 4.076 2.632 7.087 2.632c2.957-.01 5.294-.884 7.004-2.632c1.713-1.748 2.577-4.06 2.577-6.94c0-2.878-.856-5.17-2.577-6.867q-2.567-2.56-7.004-2.56m99.767.216q-4.363 0-6.975 2.56c-1.742 1.707-2.607 3.917-2.607 6.652c0 2.734.865 4.965 2.607 6.692s4.037 2.59 6.905 2.59c2.908-.01 5.243-.883 7.006-2.63c1.762-1.749 2.637-4.02 2.637-6.796c0-2.684-.856-4.873-2.567-6.55c-1.712-1.675-4.057-2.518-7.006-2.518m-287.038-7.063h-8.596v24.756h7.6c4.46 0 7.892-1.141 10.287-3.413c2.396-2.283 3.594-5.387 3.594-9.325c0-3.65-1.068-6.559-3.201-8.738c-2.134-2.18-5.365-3.28-9.684-3.28M244.51 22.24c4.752 0 8.606 3.534 8.606 7.895s-3.854 7.896-8.606 7.896c-4.754 0-8.607-3.535-8.607-7.896s3.853-7.895 8.607-7.895\\"/>","width":512,"height":100},"discord-icon":{"body":"<path fill=\\"#5865f2\\" d=\\"M216.856 16.597A208.5 208.5 0 0 0 164.042 0c-2.275 4.113-4.933 9.645-6.766 14.046q-29.538-4.442-58.533 0c-1.832-4.4-4.55-9.933-6.846-14.046a207.8 207.8 0 0 0-52.855 16.638C5.618 67.147-3.443 116.4 1.087 164.956c22.169 16.555 43.653 26.612 64.775 33.193A161 161 0 0 0 79.735 175.3a136.4 136.4 0 0 1-21.846-10.632a109 109 0 0 0 5.356-4.237c42.122 19.702 87.89 19.702 129.51 0a132 132 0 0 0 5.355 4.237a136 136 0 0 1-21.886 10.653c4.006 8.02 8.638 15.67 13.873 22.848c21.142-6.58 42.646-16.637 64.815-33.213c5.316-56.288-9.08-105.09-38.056-148.36M85.474 135.095c-12.645 0-23.015-11.805-23.015-26.18s10.149-26.2 23.015-26.2s23.236 11.804 23.015 26.2c.02 14.375-10.148 26.18-23.015 26.18m85.051 0c-12.645 0-23.014-11.805-23.014-26.18s10.148-26.2 23.014-26.2c12.867 0 23.236 11.804 23.015 26.2c0 14.375-10.148 26.18-23.015 26.18\\"/>","height":199},"slack":{"body":"<path d=\\"m163.593 101.885l6.387-14.835c6.902 5.151 16.07 7.83 25.136 7.83c6.696 0 10.92-2.576 10.92-6.49c-.103-10.92-40.074-2.37-40.383-29.773c-.103-13.907 12.26-24.621 29.772-24.621c10.405 0 20.81 2.575 28.227 8.447l-5.975 15.144c-6.799-4.327-15.246-7.417-23.282-7.417c-5.46 0-9.065 2.575-9.065 5.872c.103 10.714 40.383 4.842 40.795 31.008c0 14.217-12.053 24.21-29.36 24.21c-12.672 0-24.313-2.988-33.172-9.375m245.08-20.192l17.616 9.787c-6.593 11.847-19.161 19.78-33.687 19.78c-21.325 0-38.632-17.307-38.632-38.632s17.307-38.632 38.632-38.632c14.423 0 27.094 8.035 33.687 19.78l-17.616 9.786c-3.194-5.563-9.169-9.374-16.071-9.374c-10.199 0-18.44 8.241-18.44 18.44s8.241 18.44 18.44 18.44c6.902 0 12.877-3.812 16.07-9.375M234.984 1.957h22.046v107.86h-22.046zm199.958 0h22.046v63.356l24.93-29.772h26.991l-30.802 35.85l33.275 38.426h-28.227L456.988 77.47v32.347h-22.046zM322.55 81.9V63.665c-3.194-5.357-9.787-9.477-17.204-9.477c-10.2 0-18.44 8.241-18.44 18.44s8.24 18.44 18.44 18.44c7.417 0 14.01-3.915 17.204-9.169m0-46.358h22.046v74.173H322.55v-8.756c-3.606 6.078-12.569 10.302-21.943 10.302c-19.368 0-34.614-17.307-34.614-38.735s15.246-38.529 34.614-38.529c9.374 0 18.337 4.224 21.943 10.302z\\"/><path fill=\\"#e01e5a\\" d=\\"M27.3 81.796c0 7.52-6.078 13.599-13.599 13.599A13.585 13.585 0 0 1 .103 81.796c0-7.52 6.078-13.598 13.598-13.598H27.3zm6.799 0c0-7.52 6.078-13.598 13.598-13.598s13.599 6.078 13.599 13.598v33.996c0 7.52-6.078 13.599-13.599 13.599A13.585 13.585 0 0 1 34.1 115.792z\\"/><path fill=\\"#36c5f0\\" d=\\"M47.697 27.197A13.585 13.585 0 0 1 34.1 13.598C34.099 6.078 40.177 0 47.697 0s13.599 6.078 13.599 13.598v13.599zm0 6.902c7.52 0 13.599 6.078 13.599 13.598s-6.078 13.599-13.599 13.599H13.598A13.585 13.585 0 0 1 0 47.697C0 40.177 6.078 34.1 13.598 34.1z\\"/><path fill=\\"#2eb67d\\" d=\\"M102.194 47.697c0-7.52 6.078-13.598 13.598-13.598s13.599 6.078 13.599 13.598s-6.078 13.599-13.599 13.599h-13.598zm-6.8 0c0 7.52-6.077 13.599-13.598 13.599a13.585 13.585 0 0 1-13.598-13.599V13.598C68.198 6.078 74.276 0 81.796 0s13.599 6.078 13.599 13.598z\\"/><path fill=\\"#ecb22e\\" d=\\"M81.796 102.194c7.52 0 13.599 6.078 13.599 13.598s-6.078 13.599-13.599 13.599a13.585 13.585 0 0 1-13.598-13.599v-13.598zm0-6.8a13.585 13.585 0 0 1-13.598-13.598c0-7.52 6.078-13.598 13.598-13.598h34.1c7.52 0 13.598 6.078 13.598 13.598s-6.078 13.599-13.599 13.599z\\"/>","width":512,"height":130},"slack-icon":{"body":"<path fill=\\"#e01e5a\\" d=\\"M53.841 161.32c0 14.832-11.987 26.82-26.819 26.82S.203 176.152.203 161.32c0-14.831 11.987-26.818 26.82-26.818H53.84zm13.41 0c0-14.831 11.987-26.818 26.819-26.818s26.819 11.987 26.819 26.819v67.047c0 14.832-11.987 26.82-26.82 26.82c-14.83 0-26.818-11.988-26.818-26.82z\\"/><path fill=\\"#36c5f0\\" d=\\"M94.07 53.638c-14.832 0-26.82-11.987-26.82-26.819S79.239 0 94.07 0s26.819 11.987 26.819 26.819v26.82zm0 13.613c14.832 0 26.819 11.987 26.819 26.819s-11.987 26.819-26.82 26.819H26.82C11.987 120.889 0 108.902 0 94.069c0-14.83 11.987-26.818 26.819-26.818z\\"/><path fill=\\"#2eb67d\\" d=\\"M201.55 94.07c0-14.832 11.987-26.82 26.818-26.82s26.82 11.988 26.82 26.82s-11.988 26.819-26.82 26.819H201.55zm-13.41 0c0 14.832-11.988 26.819-26.82 26.819c-14.831 0-26.818-11.987-26.818-26.82V26.82C134.502 11.987 146.489 0 161.32 0s26.819 11.987 26.819 26.819z\\"/><path fill=\\"#ecb22e\\" d=\\"M161.32 201.55c14.832 0 26.82 11.987 26.82 26.818s-11.988 26.82-26.82 26.82c-14.831 0-26.818-11.988-26.818-26.82V201.55zm0-13.41c-14.831 0-26.818-11.988-26.818-26.82c0-14.831 11.987-26.818 26.819-26.818h67.25c14.832 0 26.82 11.987 26.82 26.819s-11.988 26.819-26.82 26.819z\\"/>"},"telegram":{"body":"<defs><linearGradient id=\\"SVG6DaOZcwt\\" x1=\\"50%\\" x2=\\"50%\\" y1=\\"0%\\" y2=\\"100%\\"><stop offset=\\"0%\\" stop-color=\\"#2aabee\\"/><stop offset=\\"100%\\" stop-color=\\"#229ed9\\"/></linearGradient></defs><path fill=\\"url(#SVG6DaOZcwt)\\" d=\\"M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0\\"/><path fill=\\"#fff\\" d=\\"M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072\\"/>"},"messenger":{"body":"<defs><radialGradient id=\\"SVGhphmYc3G\\" cx=\\"19.247%\\" cy=\\"99.465%\\" r=\\"108.96%\\" fx=\\"19.247%\\" fy=\\"99.465%\\"><stop offset=\\"0%\\" stop-color=\\"#09f\\"/><stop offset=\\"60.975%\\" stop-color=\\"#a033ff\\"/><stop offset=\\"93.482%\\" stop-color=\\"#ff5280\\"/><stop offset=\\"100%\\" stop-color=\\"#ff7061\\"/></radialGradient></defs><path fill=\\"url(#SVGhphmYc3G)\\" d=\\"M128 0C55.894 0 0 52.818 0 124.16c0 37.317 15.293 69.562 40.2 91.835c2.09 1.871 3.352 4.493 3.438 7.298l.697 22.77c.223 7.262 7.724 11.988 14.37 9.054L84.111 243.9a10.22 10.22 0 0 1 6.837-.501c11.675 3.21 24.1 4.92 37.052 4.92c72.106 0 128-52.818 128-124.16S200.106 0 128 0\\"/><path fill=\\"#fff\\" d=\\"m51.137 160.47l37.6-59.653c5.98-9.49 18.788-11.853 27.762-5.123l29.905 22.43a7.68 7.68 0 0 0 9.252-.027l40.388-30.652c5.39-4.091 12.428 2.36 8.82 8.085l-37.6 59.654c-5.981 9.489-18.79 11.852-27.763 5.122l-29.906-22.43a7.68 7.68 0 0 0-9.25.027l-40.39 30.652c-5.39 4.09-12.427-2.36-8.818-8.085\\"/>"},"webrtc":{"body":"<path fill=\\"#f60\\" d=\\"M142.077 191.087c0 31.806-25.782 57.592-57.588 57.592c-31.81 0-57.593-25.786-57.593-57.592s25.782-57.592 57.593-57.592c31.806 0 57.588 25.786 57.588 57.592\\"/><path fill=\\"#fc0\\" d=\\"M255.98 110.459c0 31.802-25.782 57.592-57.588 57.592c-31.81 0-57.592-25.79-57.592-57.592c0-31.807 25.781-57.597 57.592-57.597c31.806 0 57.588 25.79 57.588 57.597\\"/><path fill=\\"#0089cc\\" d=\\"M115.2 109.18c0 31.802-25.781 57.593-57.592 57.593c-31.802 0-57.588-25.79-57.588-57.592c0-31.807 25.786-57.597 57.588-57.597c31.81 0 57.592 25.79 57.592 57.597\\"/><path fill=\\"#009939\\" d=\\"M230.386 191.087c0 31.806-25.782 57.592-57.597 57.592c-31.802 0-57.588-25.786-57.588-57.592s25.786-57.592 57.588-57.592c31.815 0 57.597 25.786 57.597 57.592\\"/><path fill=\\"#bf0000\\" d=\\"M185.592 57.985c0 31.806-25.786 57.592-57.592 57.592S70.408 89.79 70.408 57.985S96.194.392 128 .392s57.592 25.787 57.592 57.593\\"/><path fill=\\"#fc0007\\" d=\\"M140.799 110.458c0 1.212.105 2.398.181 3.593c25.546-5.894 44.61-28.733 44.61-56.068c0-1.212-.105-2.402-.18-3.597c-25.546 5.897-44.611 28.737-44.611 56.072\\"/><path fill=\\"#1cd306\\" d=\\"M148.397 138.975c9.925 17.352 28.576 29.075 49.997 29.075c8.73 0 16.976-2.001 24.393-5.48c-9.92-17.35-28.572-29.074-49.997-29.074c-8.73 0-16.976 2-24.393 5.48\\"/><path fill=\\"#0f7504\\" d=\\"M115.2 191.087c0 14.071 5.058 26.947 13.442 36.948c8.376-10 13.434-22.877 13.434-36.948c0-14.07-5.058-26.947-13.434-36.948c-8.384 10.001-13.442 22.877-13.442 36.948\\"/><path fill=\\"#0c5e87\\" d=\\"M34.807 162.057a57.3 57.3 0 0 0 22.801 4.716c21.21 0 39.688-11.496 49.685-28.564a57.3 57.3 0 0 0-22.801-4.711c-21.21 0-39.692 11.495-49.685 28.56\\"/><path fill=\\"#6b0001\\" d=\\"M70.655 53.126c-.136 1.604-.25 3.217-.25 4.86c0 27.313 19.036 50.132 44.552 56.05c.13-1.604.245-3.217.245-4.855c0-27.314-19.032-50.14-44.547-56.055\\"/><path fill=\\"#fff\\" d=\\"M76.03 183.96h-9.009c-7.953 0-14.42-6.446-14.42-14.379V88.035c0-7.932 6.467-14.383 14.42-14.383H179.99c7.954 0 14.417 6.45 14.417 14.383v81.546c0 7.933-6.463 14.38-14.417 14.38h-38.484L64.29 221.81z\\"/>","height":249},"twilio":{"body":"<path fill=\\"#f12e45\\" d=\\"M77.016 0c42.512 0 77.015 34.503 77.015 77.016c0 42.512-34.503 77.015-77.015 77.015S0 119.528 0 77.016S34.503 0 77.016 0m0 20.332c-31.423 0-56.684 25.261-56.684 56.684s25.261 56.683 56.684 56.683s56.683-25.261 56.683-56.683s-25.261-56.684-56.683-56.684m395.86 31.73c22.797 0 39.124 16.636 39.124 36.352v.308c0 19.716-16.327 36.66-39.432 36.66c-22.797 0-39.124-16.636-39.124-36.352v-.308c0-19.716 16.327-36.66 39.432-36.66M207.634 30.499c.924-.308 1.849.616 1.849 1.232v22.181h40.972c.924 0 1.54.616 1.848 1.232l3.389 12.63l3.08 12.631l.309.616l.308-1.232l7.701-25.569c.308-.616 1.233-1.232 1.849-1.232h20.332c.924 0 1.54.616 1.848 1.232l8.01 27.418l.308-1.233l6.777-25.569c.308-.616 1.232-1.232 1.849-1.232h52.37c.616 0 1.232.616 1.232 1.54v67.158c0 .616-.616 1.232-1.232 1.232h-26.185c-.616 0-1.232-.616-1.232-1.232V57.608L313.3 122.3c-.308.616-1.233 1.232-1.849 1.232h-21.564c-.924 0-1.54-.616-1.848-1.232l-4.313-13.555l-4.621-14.787l-9.242 28.65c-.308.616-1.232 1.232-1.849 1.232H246.45c-.924 0-1.54-.616-1.848-1.232l-19.408-64.385v16.635c0 .616-.616 1.232-1.233 1.232h-14.787v17.56c0 5.237 2.465 7.085 7.086 7.085c2.464 0 4.62-.308 7.393-1.54c.617 0 1.54.308 1.54 1.232v20.333c-4.62 2.464-11.398 4.004-18.483 4.004c-16.943 0-26.185-8.01-26.185-24.953V75.783h-6.778c-.616 0-1.232-.616-1.232-1.232V54.835c0-.616.616-1.232 1.232-1.232h6.778V39.74c0-.616.308-.924 1.232-1.232Zm187.302-.308c.616 0 1.232.616 1.232 1.232v90.879c0 .616-.616 1.232-1.232 1.232h-26.185c-.616 0-1.232-.616-1.232-1.232v-90.88c0-.616.616-1.232 1.232-1.232Zm34.503 23.413c.616 0 1.232.616 1.232 1.54v67.158c0 .616-.616 1.232-1.232 1.232h-26.185c-.616 0-1.232-.616-1.232-1.232V54.835c0-.616.616-1.232 1.232-1.232ZM96.116 80.096c8.847 0 16.019 7.172 16.019 16.02s-7.172 16.019-16.02 16.019s-16.019-7.172-16.019-16.02s7.172-16.019 16.02-16.019m-38.2 0c8.847 0 16.019 7.172 16.019 16.02s-7.172 16.019-16.02 16.019c-8.846 0-16.018-7.172-16.018-16.02s7.172-16.019 16.019-16.019m414.652-4.005c-6.47 0-11.09 5.238-11.09 12.015v.308c0 6.777 4.929 12.322 11.398 12.322c6.47 0 11.09-5.237 11.09-12.014c0-7.085-4.929-12.63-11.398-12.63M96.116 41.897c8.847 0 16.019 7.172 16.019 16.019s-7.172 16.019-16.02 16.019s-16.019-7.172-16.019-16.02c0-8.846 7.172-16.018 16.02-16.018m-38.2 0c8.847 0 16.019 7.172 16.019 16.019s-7.172 16.019-16.02 16.019c-8.846 0-16.018-7.172-16.018-16.02c0-8.846 7.172-16.018 16.019-16.018M360.74 30.19c.924 0 1.54.616 1.233 1.232v15.712c0 .616-.617 1.232-1.233 1.232h-27.11c-.615 0-1.231-.616-1.231-1.232V31.422c0-.616.616-1.232 1.232-1.232Zm69.006 0c.924 0 1.54.616 1.233 1.232v15.712c0 .616-.617 1.232-1.233 1.232h-27.11c-.615 0-1.231-.616-1.231-1.232V31.422c0-.616.616-1.232 1.232-1.232Z\\"/>","width":512,"height":155},"twilio-icon":{"body":"<path fill=\\"#f12e45\\" d=\\"M128 0c70.656 0 128 57.344 128 128s-57.344 128-128 128S0 198.656 0 128S57.344 0 128 0m0 33.792c-52.224 0-94.208 41.984-94.208 94.208S75.776 222.208 128 222.208s94.208-41.984 94.208-94.208S180.224 33.792 128 33.792m31.744 99.328c14.704 0 26.624 11.92 26.624 26.624s-11.92 26.624-26.624 26.624s-26.624-11.92-26.624-26.624s11.92-26.624 26.624-26.624m-63.488 0c14.704 0 26.624 11.92 26.624 26.624s-11.92 26.624-26.624 26.624s-26.624-11.92-26.624-26.624s11.92-26.624 26.624-26.624m63.488-63.488c14.704 0 26.624 11.92 26.624 26.624s-11.92 26.624-26.624 26.624s-26.624-11.92-26.624-26.624s11.92-26.624 26.624-26.624m-63.488 0c14.704 0 26.624 11.92 26.624 26.624s-11.92 26.624-26.624 26.624s-26.624-11.92-26.624-26.624s11.92-26.624 26.624-26.624\\"/>"},"apple":{"body":"<path d=\\"M213.803 167.03c.442 47.58 41.74 63.413 42.197 63.615c-.35 1.116-6.599 22.563-21.757 44.716c-13.104 19.153-26.705 38.235-48.13 38.63c-21.05.388-27.82-12.483-51.888-12.483c-24.061 0-31.582 12.088-51.51 12.871c-20.68.783-36.428-20.71-49.64-39.793c-27-39.033-47.633-110.3-19.928-158.406c13.763-23.89 38.36-39.017 65.056-39.405c20.307-.387 39.475 13.662 51.889 13.662c12.406 0 35.699-16.895 60.186-14.414c10.25.427 39.026 4.14 57.503 31.186c-1.49.923-34.335 20.044-33.978 59.822M174.24 50.199c10.98-13.29 18.369-31.79 16.353-50.199c-15.826.636-34.962 10.546-46.314 23.828c-10.173 11.763-19.082 30.589-16.678 48.633c17.64 1.365 35.66-8.964 46.64-22.262\\"/>","height":315},"google-calendar":{"body":"<path fill=\\"#fff\\" d=\\"M195.368 60.632H60.632v134.736h134.736z\\"/><path fill=\\"#ea4335\\" d=\\"M195.368 256L256 195.368l-30.316-5.172l-30.316 5.172l-5.533 27.73z\\"/><path fill=\\"#188038\\" d=\\"M0 195.368v40.421C0 246.956 9.044 256 20.21 256h40.422l6.225-30.316l-6.225-30.316l-33.033-5.172z\\"/><path fill=\\"#1967d2\\" d=\\"M256 60.632V20.21C256 9.044 246.956 0 235.79 0h-40.422q-5.532 22.554-5.533 33.196q0 10.641 5.533 27.436q20.115 5.76 30.316 5.76T256 60.631\\"/><path fill=\\"#fbbc04\\" d=\\"M256 60.632h-60.632v134.736H256z\\"/><path fill=\\"#34a853\\" d=\\"M195.368 195.368H60.632V256h134.736z\\"/><path fill=\\"#4285f4\\" d=\\"M195.368 0H20.211C9.044 0 0 9.044 0 20.21v175.158h60.632V60.632h134.736z\\"/><path fill=\\"#4285f4\\" d=\\"M88.27 165.154c-5.036-3.402-8.523-8.37-10.426-14.94l11.689-4.816q1.59 6.063 5.558 9.398c2.627 2.223 5.827 3.318 9.566 3.318q5.734 0 9.852-3.487c2.746-2.324 4.127-5.288 4.127-8.875q0-5.508-4.345-8.994c-2.897-2.324-6.535-3.486-10.88-3.486h-6.754v-11.57h6.063q5.608 0 9.448-3.033c2.56-2.02 3.84-4.783 3.84-8.303c0-3.132-1.145-5.625-3.435-7.494c-2.29-1.87-5.188-2.813-8.708-2.813c-3.436 0-6.164.91-8.185 2.745a16.1 16.1 0 0 0-4.413 6.754l-11.57-4.817c1.532-4.345 4.345-8.185 8.471-11.503s9.398-4.985 15.798-4.985c4.733 0 8.994.91 12.767 2.745c3.772 1.836 6.736 4.379 8.875 7.613c2.14 3.25 3.2 6.888 3.2 10.93c0 4.126-.993 7.613-2.98 10.476s-4.43 5.052-7.327 6.585v.69a22.25 22.25 0 0 1 9.398 7.327c2.442 3.284 3.672 7.208 3.672 11.79c0 4.58-1.163 8.673-3.487 12.26c-2.324 3.588-5.54 6.417-9.617 8.472c-4.092 2.055-8.69 3.1-13.793 3.1c-5.912.016-11.369-1.685-16.405-5.087m71.797-58.005l-12.833 9.28l-6.417-9.734l23.023-16.607h8.825v78.333h-12.598z\\"/>"}},"width":256,"height":256}'),sJ=!1;function sX(){if(sJ)return;(0,eO.CQ)(sZ);let e=sG.Pt.icons?.iosfacetime;e&&(0,eO.CQ)({prefix:"cbi",icons:{iosfacetime:e},width:sG.Pt.width??24,height:sG.Pt.height??24});let t=sY.Pt.icons?.jitsi;t&&(0,eO.CQ)({prefix:"simple-icons",icons:{jitsi:t},width:sY.Pt.width??24,height:sY.Pt.height??24}),sJ=!0}function s0(e){return e.attachments?.length?e.attachments.filter(e=>!e.name.toLowerCase().endsWith(".ics")):e.hasAttachment&&!0!==e.hasInvitation?[{name:"Pi\xe8ce jointe",kind:"other"}]:[]}let s1=/\.(mp4|mpe?g|webm|mov|avi|mkv|m4v|wmv|flv|xls|xlsx|xlsm|ods|numbers|ppt|pptx|key|odp|doc|docx|odt|rtf)$/i;function s2(e,t){if(t)return t;let s=e.toLowerCase();return s.endsWith(".pdf")?"pdf":/\.(png|jpe?g|gif|webp|svg|avif|bmp|heic)$/.test(s)?"image":"other"}function s3(e){return 0!==e.length&&e.every(e=>{var t,s;let a;return!("pdf"===(a=s2(t=e.name,e.kind))||"image"===a||s1.test(t.toLowerCase()))&&(void 0===(s=e.sizeBytes)||s>=0&&s<=2097152)})}function s5(e){return String(e).replace(".",",")}function s4(e,t){return void 0===t?e:`${e}
${function(e){if(!Number.isFinite(e)||e<0)return"—";if(e<1e3)return`${Math.round(e)}\u00a0o`;let t=e/1024;if(t<1024){let e=t>=10?Math.round(t):Math.round(10*t)/10;return`${s5(e)}\u00a0Ko`}let s=t/1024,a=s>=10?Math.round(s):Math.round(10*s)/10;return`${s5(a)}\u00a0Mo`}(t)}`}var s6=s(5807),s8=s(18747);function s7(e){let{ready:t,authenticated:s}=(0,s8.v)(),a=(0,n.useMemo)(()=>[...new Set(e)].sort(),[e]),r=(0,s6.E)({queries:a.map(e=>({queryKey:["message-attachments",e],queryFn:()=>ss.uE.get(`/mail/messages/${e}/attachments`).then(e=>{var t;return t=e.attachments,t?.length?t.filter(e=>!e.is_inline).map(e=>{let t;return{id:e.id,name:e.filename||"Pi\xe8ce jointe",kind:s2(e.filename,(t=e.content_type.toLowerCase()).includes("pdf")?"pdf":t.startsWith("image/")?"image":void 0),contentType:e.content_type||void 0,drivePath:e.drive_path||void 0,sizeBytes:e.size>0?e.size:void 0,virusScanStatus:e.virus_scan_status}}):[]}),enabled:t&&s,staleTime:3e5}))});return(0,n.useMemo)(()=>{let e=new Map,t=new Map;return a.forEach((s,a)=>{let n=r[a];n?n.isPending||n.isFetching?t.set(s,"loading"):(t.set(s,"done"),n.data?.length&&e.set(s,n.data)):t.set(s,"idle")}),{byId:e,stateById:t}},[a,r])}var s9=s(49658),ae=s(4414),at=s(81654),as=s(89012),aa=s(7556),an=s(18028);let ar={ultimeet:"simple-icons:jitsi",meet:"logos:google-meet",teams:"logos:microsoft-teams",skype:"logos:skype",zoom:"logos:zoom-icon",whatsapp:"logos:whatsapp-icon",signal:"logos:signal",instagram:"logos:instagram-icon",discord:"logos:discord-icon",slack:"logos:slack-icon",telegram:"logos:telegram",messenger:"logos:messenger",jitsi:"simple-icons:jitsi",phone:"logos:twilio-icon",facetime:"cbi:iosfacetime",other:"logos:webrtc"};function al(e){return e.replace(/\\n/gi,"\n").replace(/\\,/g,",").replace(/\\;/g,";").replace(/\\\\/g,"\\")}function ai(e){return e.replace(/\r\n/g,"\n").replace(/\n[\t ]/g,"")}function ao(e,t){let s=e.trim(),a=s.match(/^(\d{4})(\d{2})(\d{2})$/);if(a)return new Date(Number(a[1]),Number(a[2])-1,Number(a[3]),9,0,0,0);let n=s.match(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(Z)?$/);if(!n)return null;let[,r,l,i,o,c,d,u]=n,m=`${r}-${l}-${i}T${o}:${c}:${d}`;if(u)return new Date(`${m}Z`);if(t)try{return(0,an.ay)(m,{timeZone:t})}catch{}return new Date(m)}function ac(e,t){let s=e.match(/^MAILTO:(.+)$/i);return{email:s?.[1]?.toLowerCase()||void 0,name:t.CN||void 0}}let ad=[{id:"ultimeet",patterns:[/\/meet\/[^/?#\s]+/i]},{id:"meet",patterns:[/meet\.google\.com/i,/video\.google\.com/i]},{id:"teams",patterns:[/teams\.microsoft\.com/i,/teams\.live\.com/i]},{id:"zoom",patterns:[/zoom\.us/i,/\.zoom\.us/i]},{id:"other",patterns:[/webex\.com/i,/ciscowebex\.com/i]},{id:"skype",patterns:[/join\.skype\.com/i,/skype:\/\//i]},{id:"jitsi",patterns:[/meet\.jit\.si/i,/8x8\.vc/i,/jitsi\.org/i]},{id:"whatsapp",patterns:[/wa\.me/i,/whatsapp\.com\/call/i,/chat\.whatsapp\.com/i]},{id:"signal",patterns:[/signal\.me/i,/signal\.group/i]},{id:"instagram",patterns:[/instagram\.com/i]},{id:"discord",patterns:[/discord\.gg/i,/discord\.com\/channels/i]},{id:"slack",patterns:[/slack\.com\/call/i,/slack\.com\/huddle/i]},{id:"telegram",patterns:[/t\.me\//i,/telegram\.me\//i]},{id:"messenger",patterns:[/m\.me\//i,/messenger\.com/i]},{id:"facetime",patterns:[/facetime:/i]},{id:"phone",patterns:[/tel:/i]}];function au(e){for(let t of function(e){let t=[];for(let s of(e.calendarInvitation?.ics&&t.push(e.calendarInvitation.ics),e.attachments??[]))s.name.toLowerCase().endsWith(".ics")&&s.inlineText&&t.push(s.inlineText);if(e.body){let s,a=(s=e.body.match(/BEGIN:VCALENDAR[\s\S]*?END:VCALENDAR/i))?ai(s[0].replace(/<br\s*\/?>/gi,"\n").replace(/<\/(p|div|tr)>/gi,"\n").replace(/<[^>]+>/g,"").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"')):null;a&&t.push(a)}return t}(e)){let e=function(e){let t,s,a,n,r,l=function(e){let t=ai(e),s=t.search(/BEGIN:VEVENT/i);if(-1===s)return null;let a=t.indexOf("END:VEVENT",s);return -1===a?null:t.slice(s,a+10)}(e);if(!l)return null;let i="\xc9v\xe9nement",o=null,c=null,d=[];for(let e of l.split("\n")){if(!e||e.startsWith("BEGIN:")||e.startsWith("END:"))continue;let r=e.indexOf(":");if(-1===r)continue;let l=e.slice(0,r),u=e.slice(r+1),{name:m,params:h}=function(e){let t=e.indexOf(";");if(-1===t)return{name:e.toUpperCase(),params:{}};let s=e.slice(0,t).toUpperCase(),a={};for(let s of e.slice(t+1).split(";")){let e=s.indexOf("=");if(-1===e)continue;let t=s.slice(0,e).toUpperCase(),n=s.slice(e+1);(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))&&(n=n.slice(1,-1)),a[t]=al(n)}return{name:s,params:a}}(l),x=al(u);"SUMMARY"===m?i=x||i:"DTSTART"===m||"DTSTART;VALUE=DATE"===m?o={value:x,tzid:h.TZID}:"DTEND"===m||"DTEND;VALUE=DATE"===m?c={value:x,tzid:h.TZID}:"ORGANIZER"===m?t=ac(x,h):"ATTENDEE"===m?d.push(ac(x,h)):"LOCATION"===m?s=x:"DESCRIPTION"===m?a=x:m.startsWith("X-GOOGLE-CONFERENCE")&&(n=x)}if(!o)return null;let u=ao(o.value,o.tzid);if(!u||Number.isNaN(u.getTime()))return null;if(c){let e=ao(c.value,c.tzid??o.tzid);r=e&&!Number.isNaN(e.getTime())?e:new Date(u.getTime()+36e5)}else r=new Date(u.getTime()+36e5);let m=function(e){let t=e.toLowerCase();for(let{id:e,patterns:s}of ad)for(let a of s)if(a.test(t))return e;return"other"}([n,s,a,i].filter(Boolean).join("\n"));return{summary:i,start:u,end:r,organizer:t,attendees:d,location:s,description:a,conferenceProvider:m}}(t);if(e)return e}return null}var am=s(19916);function ah(e){let t=e.from[0]?.name||e.from[0]?.address||"",s=e.from[0]?.address||"";return{id:e.id,sender:t,senderEmail:s,subject:e.subject,preview:(0,su.D)(e.snippet)??e.snippet,date:e.date,read:(0,sn.EP)(e.flags),starred:(0,sn.BB)(e.flags),important:(0,sn.I)(e.flags,e.labels),spam:e.labels.includes("spam"),hasAttachment:e.has_attachments,labels:e.labels,threadHeadId:e.thread_id??e.id,threadMessageIds:[e.id],isThreadHead:!0}}var ax=s(79060);let af=new Set(["inbox","sent","drafts","spam","starred"]);function ap(e,t){return"inbox"===e&&t&&"primary"!==t?`inbox::${t}`:e}function ab(e){return e.startsWith("inbox::")?{folderId:"inbox",inboxTab:e.slice(7)}:{folderId:e}}function ag(e){return(0,$.XE)(e,D())}function av(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function aj(e){let t=(0,$.G_)((0,L.RJ)()),s=new Set,a=[],n=(e,n)=>{let r=n.trim();if(!r)return;let l=r.trim().toLowerCase();t.has(l)||s.has(l)||(s.add(l),a.push({name:(0,eS.ms)(e)||r,email:r}))};for(let t of e.conversation??[])n(t.sender,t.senderEmail);let r=e.senderEmail??`${(0,eS.ms)(e.sender).toLowerCase().replace(/\s+/g,".")}@example.com`;return n(e.sender,r),a}function aw(e){let t=e.conversation??[];return 0===t.length?null:t[t.length-1]}function ay(e){let t=e.trim();return/^re\s*:/i.test(t)?t:`Re: ${t}`}function ak(e,t,s){let a=s&&s!==t?`${av(s)} &lt;${av(t)}&gt;`:av(t);return`Le ${av(sO(e))}, ${a} a \xe9crit :`}function aN(e){return`<blockquote type="cite" style="margin:0 0 0 0.8ex;border-left:1px solid #ccc;padding-left:1ex;color:#500">${e}</blockquote>`}function aC(e){let t=aw(e);if(t){let e=ak(t.date,t.senderEmail,(0,eS.ms)(t.sender));return`<p><br></p><div style="color:#666;font-size:13px">${e}</div>${aN(t.body)}`}let s=e.senderEmail??`${(0,eS.ms)(e.sender).toLowerCase().replace(/\s+/g,".")}@example.com`,a=ak(e.date,s,(0,eS.ms)(e.sender)),n=e.body??`<p style="color:#5f6368">${av(e.preview)}</p>`;return`<p><br></p><div style="color:#666;font-size:13px">${a}</div>${aN(n)}`}function aS(e){return i()?{...e,placement:"dock",maximized:!0}:e}function aA(e,t){let s,a=D(),n=aj(e),r=aw(e),l=r?{name:(0,eS.ms)(r.sender),email:r.senderEmail}:n.length>0?n[n.length-1]:null,i={inReplyTo:(s=aw(e))?`<thread-msg-${s.id}@local>`:`<thread-msg-${e.id}@local>`,references:function(e){let t=[];for(let s of e.conversation??[])t.push(`<thread-msg-${s.id}@local>`);return t.push(`<thread-msg-${e.id}@local>`),t}(e)};if("forward"===t){var o;let t,s,n,r,l=function(e){let t=D().signatureHtml;if(!t?.trim())return e;let s=`<div id="ultimail-signature"><p>--</p>${t}</div>`,a="<p></p>";return e.startsWith(a)?`${a}${s}${e.slice(a.length)}`:`${a}${s}${e}`}((s=(o=e).senderEmail??`${(0,eS.ms)(o.sender).toLowerCase().replace(/\s+/g,".")}@example.com`,n=`<p>---------- Forwarded message ---------</p><p style="color:#222;font-size:13px;line-height:1.5"><strong>De :</strong> ${av((0,eS.ms)(o.sender))} &lt;${av(s)}&gt;<br/><strong>Date :</strong> ${av(sO(o.date))}<br/><strong>Objet :</strong> ${av(o.subject)}<br/><strong>${av(0===(t=aj(o)).length?"To: (inconnu)":`To: ${t.map(e=>`${e.name} <${e.email}>`).join(", ")}`)}</strong></p>`,`<p></p>${n}${function(e){let t=[];for(let s of e.conversation??[])t.push(`<div style="margin-top:12px;padding-top:12px;border-top:1px solid #e0e0e0"><div style="color:#666;font-size:12px;margin-bottom:8px"><strong>De :</strong> ${av((0,eS.ms)(s.sender))} &lt;${av(s.senderEmail)}&gt;<br/><strong>Date :</strong> ${av(sO(s.date))}</div>${s.body}</div>`);let s=e.senderEmail??`${(0,eS.ms)(e.sender).toLowerCase().replace(/\s+/g,".")}@example.com`;return t.push(`<div style="margin-top:12px;padding-top:12px;border-top:1px solid #e0e0e0"><div style="color:#666;font-size:12px;margin-bottom:8px"><strong>De :</strong> ${av((0,eS.ms)(e.sender))} &lt;${av(s)}&gt;<br/><strong>Date :</strong> ${av(sO(e.date))}</div>${e.body??`<p style="color:#5f6368">${av(e.preview)}</p>`}</div>`),t.join("")}(o)}`));return{from:a,to:[],cc:[],bcc:[],subject:(r=e.subject.trim(),/^(fwd|fw|tr)\s*:/i.test(r)?r:`Fwd: ${r}`),bodyHtml:l,placement:"inline",threadEmailId:e.id,threadKind:"forward",focusToOnMount:!0,focusBodyOnMount:!1,threading:i}}if("reply"===t)return{from:a,to:l?[l]:[],cc:[],bcc:[],subject:ay(e.subject),bodyHtml:ag(aC(e)),placement:"inline",threadEmailId:e.id,threadKind:"reply",focusToOnMount:!1,focusBodyOnMount:!0,threading:i};let c=[],d=[];if(l)for(let e of(c.push(l),n))e.email!==l.email&&d.push(e);else if(n.length>0){c.push(n[0]);for(let e=1;e<n.length;e++)d.push(n[e])}return{from:a,to:c,cc:d,bcc:[],subject:ay(e.subject),bodyHtml:ag(aC(e)),placement:"inline",threadEmailId:e.id,threadKind:"replyAll",focusToOnMount:!1,focusBodyOnMount:!0,threading:i,showCc:d.length>0}}let aM=(0,ek.v)()((e,t)=>({sidebarCollapsed:!0,mobileSearchOpen:!1,folderUnreadCounts:{},suppressSplitAutoOpenOnce:!1,setSidebarCollapsed:t=>e({sidebarCollapsed:t}),toggleSidebarCollapsed:()=>e(e=>({sidebarCollapsed:!e.sidebarCollapsed})),setMobileSearchOpen:t=>e({mobileSearchOpen:t}),setFolderUnreadCounts:t=>e({folderUnreadCounts:t}),requestSuppressSplitAutoOpen:()=>e({suppressSplitAutoOpenOnce:!0}),consumeSuppressSplitAutoOpen:()=>!!t().suppressSplitAutoOpenOnce&&(e({suppressSplitAutoOpenOnce:!1}),!0)}));var aI=s(78199),aE=s(20848);function az({children:e,onClick:t,className:s,style:n}){return(0,a.jsx)("button",{type:"button",className:(0,ec.cn)("flex w-full items-center gap-3 px-4 py-3 text-left text-sm text-[#3c4043] transition-colors hover:bg-[#f1f3f4] active:bg-[#e8eaed]",s),style:n,onClick:t,children:e})}let a$=({children:e,onSelect:t,className:s})=>(0,a.jsx)("div",{role:"button",tabIndex:0,className:(0,ec.cn)("flex w-full cursor-pointer items-center gap-3 px-4 py-2.5 text-left text-sm text-[#3c4043] transition-colors hover:bg-[#f1f3f4] active:bg-[#e8eaed] outline-none focus-visible:bg-[#f1f3f4] focus-visible:ring-2 focus-visible:ring-[#1a73e8]/30",s),onClick:e=>t?.(e),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t?.(e))},children:e});function aL({moveSheetOpen:e,onMoveSheetOpenChange:t,labelSheetOpen:s,onLabelSheetOpenChange:n,labelPickerQuery:r,onLabelPickerQueryChange:l,catalogLabels:i,resolveLabelVisual:o,moveTargets:c,onMoveTo:d,getLabelPresence:u,onToggleCatalogLabel:m,onCreateLabel:h}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ep.cj,{open:e,onOpenChange:t,children:(0,a.jsxs)(ep.h,{side:"bottom",className:"max-h-[min(85vh,520px)] gap-0 overflow-hidden rounded-t-2xl border-[#dadce0] px-0 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2 [&>button]:top-3.5 [&>button]:right-3.5",children:[(0,a.jsx)(ep.Fm,{className:"border-b border-[#eceff1] px-4 pb-3 text-left",children:(0,a.jsx)(ep.qp,{className:"text-base font-medium text-[#3c4043]",children:"D\xe9placer vers"})}),(0,a.jsxs)("div",{className:"flex flex-col overflow-y-auto py-1",children:[c.recents.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"px-4 py-1.5 text-[11px] font-medium uppercase tracking-wide text-[#5f6368]",children:"R\xe9cents"}),c.recents.map(e=>(0,a.jsxs)(az,{onClick:()=>{d(e.id),t(!1)},children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon??(0,a.jsx)(N.A,{className:"size-[18px] shrink-0 text-[#5f6368]",strokeWidth:1.5}),(0,a.jsx)(er.A,{className:"size-3 shrink-0 text-[#9aa0a6]",strokeWidth:1.5})]}),e.label]},`recent-${e.id}`)),(0,a.jsx)("div",{className:"mx-4 border-b border-[#eceff1]"})]}),c.system.map(e=>(0,a.jsxs)(az,{onClick:()=>{d(e.id),t(!1)},children:[e.icon??(0,a.jsx)(N.A,{className:"size-[18px] shrink-0 text-[#5f6368]",strokeWidth:1.5}),e.label]},e.id)),c.folders.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mx-4 border-b border-[#eceff1]"}),(0,a.jsx)("div",{className:"px-4 py-1.5 text-[11px] font-medium uppercase tracking-wide text-[#5f6368]",children:"Dossiers"}),c.folders.map(e=>(0,a.jsxs)(az,{onClick:()=>{d(e.id),t(!1)},style:e.depth>0?{paddingLeft:`${16+16*e.depth}px`}:void 0,children:[e.icon??(0,a.jsx)(N.A,{className:"size-[18px] shrink-0 text-[#5f6368]",strokeWidth:1.5}),e.label]},e.id))]})]})]})}),(0,a.jsx)(ep.cj,{open:s,onOpenChange:e=>{n(e),e||l("")},children:(0,a.jsxs)(ep.h,{side:"bottom",className:"max-h-[min(85vh,520px)] gap-0 overflow-hidden rounded-t-2xl border-[#dadce0] px-0 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2 [&>button]:top-3.5 [&>button]:right-3.5",onOpenAutoFocus:e=>e.preventDefault(),children:[(0,a.jsx)(ep.Fm,{className:"shrink-0 border-b border-[#eceff1] px-4 pb-3 text-left",children:(0,a.jsxs)(ep.qp,{className:"flex items-center gap-2 text-base font-medium text-[#3c4043]",children:[(0,a.jsx)(aI.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Ajouter le libell\xe9"]})}),(0,a.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:(0,a.jsx)(aE.U,{query:r,onQueryChange:l,catalogLabels:i,resolveLabelVisual:o,Item:a$,getLabelPresence:u,onToggleCatalogLabel:m,onCreateLabel:h,listClassName:"max-h-[min(50vh,280px)] flex-1"})})]})})]})}var aD=s(8534),aT=s(19641),a_=s(69446),aR=s(26159),aP=s(14948),aF=s(57026),aO=s(93e3),aq=s(86556),aW=s(90773),aB=s(88117),aU=s(69899);let aH=(0,n.memo)(function({tabs:e,activeTabId:t,unseenInTabById:s,onTabClick:r}){let l=(0,n.useRef)(null),[i,o]=(0,n.useState)({x:0,width:0,ready:!1}),[c,d]=(0,n.useState)(null),u=c??t;(0,n.useEffect)(()=>{d(null)},[t]),(0,n.useLayoutEffect)(()=>{let e=l.current;if(!e)return;let t=0,s=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(()=>{let t=e.querySelector(`[data-inbox-tab="${u}"]`);if(!t)return;let s=e.getBoundingClientRect(),a=t.getBoundingClientRect(),n=a.left-s.left,r=a.width;o(e=>e.ready&&e.x===n&&e.width===r?e:{x:n,width:r,ready:!0})})};s();let a=()=>s();window.addEventListener("resize",a,{passive:!0});let n="u">typeof ResizeObserver?new ResizeObserver(a):null;return n?.observe(e),()=>{cancelAnimationFrame(t),window.removeEventListener("resize",a),n?.disconnect()}},[u,e]);let m=e.find(e=>e.id===u),h=m?sA(m.id,m.badgeColor):"#0b57d0";return(0,a.jsxs)("div",{ref:l,className:"relative flex w-full min-w-0",children:[(0,a.jsx)("span",{"aria-hidden":!0,className:(0,ec.cn)("pointer-events-none absolute bottom-0 left-0 z-[2] h-[3px] origin-left rounded-t-sm","will-change-[transform,width] transition-[transform,width,background-color] duration-300 ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none",i.ready?"opacity-100":"opacity-0"),style:{width:i.width,transform:`translate3d(${i.x}px, 0, 0)`,backgroundColor:h}}),e.map(e=>{var n;let l=u===e.id,i=l?sA(e.id,e.badgeColor):void 0,o=s[e.id]??0,c=(0,x.AP)(e.id)&&!l&&o>0;return(0,a.jsx)("button",{type:"button","data-inbox-tab":e.id,title:l?void 0:e.label,"aria-label":e.label,"aria-current":l?"true":void 0,onClick:()=>{e.id!==t&&d(e.id),r(e.id)},className:(0,ec.cn)("relative z-[1] flex min-h-10 cursor-pointer items-center justify-center px-1","transition-colors duration-200 motion-reduce:transition-none",l?"shrink-0 flex-none":"min-w-0 flex-1 overflow-hidden",!l&&"hover:bg-mail-nav-hover"),children:(0,a.jsxs)("div",{className:(0,ec.cn)("flex h-10 items-center justify-center gap-1.5",l?"shrink-0 px-0.5":"w-full min-w-0"),children:[(0,a.jsxs)("div",{className:"relative inline-flex shrink-0",children:[(0,a.jsx)(eO.In,{icon:e.icon,className:(0,ec.cn)("h-4 w-4 shrink-0","transition-colors duration-200 motion-reduce:transition-none",eo.a9,!l&&"text-muted-foreground"),style:i?{color:i}:void 0,"aria-hidden":!0}),c&&o>0?(0,a.jsx)("span",{className:(n=e.badgeColor,(0,ec.cn)("absolute -right-0.5 -top-0.5 size-2 rounded-full ring-2 ring-mail-surface",n)),"aria-hidden":!0}):null]}),l?(0,a.jsx)("span",{className:(0,ec.cn)("shrink-0 whitespace-nowrap text-[13px] font-semibold leading-tight",eo.a9,i?void 0:"text-foreground"),style:i?{color:i}:void 0,children:e.label}):null]})},e.id)})]})});function aV({children:e}){return(0,a.jsx)("div",{className:"px-3 py-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e})}function aK({targets:e,onMoveTo:t}){return(0,a.jsxs)(a.Fragment,{children:[e.recents.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(aV,{children:"R\xe9cents"}),e.recents.map(e=>(0,a.jsxs)(z._2,{onSelect:()=>t(e.id),children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon,(0,a.jsx)(er.A,{className:"size-3 shrink-0 text-muted-foreground/80",strokeWidth:1.5})]}),e.label]},`recent-${e.id}`)),(0,a.jsx)(z.mB,{})]}),e.system.map(e=>(0,a.jsxs)(z._2,{onSelect:()=>t(e.id),children:[e.icon,e.label]},e.id)),e.folders.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(z.mB,{}),(0,a.jsx)(aV,{children:"Dossiers"}),e.folders.map(e=>(0,a.jsxs)(z._2,{onSelect:()=>t(e.id),style:{paddingLeft:`${12+16*e.depth}px`},children:[e.icon,e.label]},e.id))]})]})}function aQ({targets:e,onMoveTo:t}){return(0,a.jsxs)(a.Fragment,{children:[e.recents.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(aV,{children:"R\xe9cents"}),e.recents.map(e=>(0,a.jsxs)(e7.kt,{onSelect:()=>t(e.id),children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[e.icon,(0,a.jsx)(er.A,{className:"size-3 shrink-0 text-muted-foreground/80",strokeWidth:1.5})]}),e.label]},`recent-${e.id}`)),(0,a.jsx)(e7.K5,{})]}),e.system.map(e=>(0,a.jsxs)(e7.kt,{onSelect:()=>t(e.id),children:[e.icon,e.label]},e.id)),e.folders.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(e7.K5,{}),(0,a.jsx)(aV,{children:"Dossiers"}),e.folders.map(e=>(0,a.jsxs)(e7.kt,{onSelect:()=>t(e.id),style:{paddingLeft:`${12+16*e.depth}px`},children:[e.icon,e.label]},e.id))]})]})}function aG(e){let{isViewMode:t,splitView:s,listToolbarMode:r,compactInboxTabs:l,isSearchMode:i,selectedFolder:o,mobileFolderLabel:c,displayListEmails:d,mobileUnreadCount:u,mobileSelectionMode:m,setMobileSelectionMode:h,setSelectedEmails:f,mobileXsMoreMenuOpen:p,setMobileXsMoreMenuOpen:b,showBulkToolbar:v,bulkSelectMenuOpen:j,setBulkSelectMenuOpen:w,selectAllChecked:y,handleSelectAllChange:C,selectMenuAll:M,selectMenuNone:I,selectMenuRead:$,selectMenuUnread:L,selectMenuStarred:D,selectMenuUnstarred:T,bulkArchive:_,bulkDelete:R,bulkSpam:P,hasUnreadInSelection:F,bulkMarkRead:O,bulkMarkUnread:q,moveTargets:W,bulkMoveTo:B,labelPickerQuery:U,setLabelPickerQuery:H,catalogLabels:V,resolveLabelVisual:K,bulkTargetIds:Q,getCatalogLabelPresence:G,toggleLabelOnEmails:Y,addLabelToEmails:Z,isRefreshing:J,handleManualRefresh:X,markAllInViewAsRead:ee,openMobileXsMoveSheet:es,openMobileXsLabelSheet:el,listPage:ei,totalPages:ed,paginationTotal:eu,listPageSize:eh,paginationRangeStart:ep,paginationRangeEnd:eb,infiniteScroll:eg,onListPageSizeChange:ev,openMailIndex:ej,goListPrevPage:ew,goListNextPage:ey,goToPrev:ek,goToNext:eN,goBack:eC,openEmail:eS,viewModeIsRead:eA,singleArchive:eM,singleDelete:eI,singleNotSpam:ez,singleSpam:e$,singleToggleRead:eL,singleMoveTo:eD,onToggleSidebar:eT,inboxTabBarItems:e_,activeInboxTabId:eR,unseenInTabById:eP,tabUnseenSenderLineById:eF,handleCategoryInboxTabClick:eq,searchParams:eW,searchAccount:eB,allEmails:eU,setSearchFilter:eH,toggleSearchFilter:eK,setAdvancedOpen:eQ,searchRouter:eG,buildSearchUrl:eY,variant:eZ="list",part:eJ="all"}=e,[eX,e0]=(0,n.useState)(!1);(0,n.useEffect)(()=>e0(!0),[]);let e1=eo.hz,e2=e=>(0,a.jsxs)(a.Fragment,{children:[e?(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Retour \xe0 la bo\xeete de r\xe9ception",onClick:eC,children:(0,a.jsx)(em.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Retour \xe0 la bo\xeete de r\xe9ception"})]}):null,(0,a.jsx)("div",{className:"flex min-w-0 flex-wrap items-center gap-0.5 pl-1",children:eS?.spam===!0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex min-w-0 shrink-0 flex-wrap items-center gap-0.5",children:[(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"sm",className:"h-9 shrink-0 px-2.5 text-sm font-medium text-[#444746] hover:bg-[#f1f3f4]",onClick:eI,children:"Supprimer d\xe9finitivement"}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"sm",className:"h-9 shrink-0 px-2.5 text-sm font-medium text-[#444746] hover:bg-[#f1f3f4]",onClick:ez,children:"Non-spam"})]}),(0,a.jsx)("span",{className:"mx-1 h-6 w-px shrink-0 bg-[#dadce0]","aria-hidden":!0}),(0,a.jsx)("div",{className:"flex shrink-0 items-center gap-0.5",children:(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Archiver",onClick:eM,children:(0,a.jsx)(k.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Archiver"})]})}),(0,a.jsx)("span",{className:"mx-1 h-6 w-px shrink-0 bg-[#dadce0]","aria-hidden":!0}),(0,a.jsxs)("div",{className:"flex min-w-0 shrink-0 items-center gap-0.5",children:[(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":eA?"Marquer comme non lu":"Marquer comme lu",onClick:eL,children:eA?(0,a.jsx)(aD.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5}):(0,a.jsx)(aT.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:eA?"Marquer comme non lu":"Marquer comme lu"})]}),(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsxs)(E.$,{type:"button",variant:"ghost",size:"sm",className:"h-9 w-9 shrink-0 gap-1 px-0 text-[#444746] hover:bg-[#f1f3f4] lg:h-9 lg:w-auto lg:px-2","aria-label":"D\xe9placer vers",children:[(0,a.jsx)(N.A,{className:"h-[18px] w-[18px] shrink-0",strokeWidth:1.5}),(0,a.jsx)("span",{className:"hidden max-w-32 truncate lg:inline",children:"D\xe9placer vers"}),(0,a.jsx)(eV.A,{className:"hidden h-3.5 w-3.5 shrink-0 opacity-70 lg:block"})]})}),(0,a.jsx)(z.SQ,{align:"start",className:(0,ec.cn)(e1,"max-h-80 overflow-y-auto"),children:(0,a.jsx)(aK,{targets:W,onMoveTo:eD})})]})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Archiver",onClick:eM,children:(0,a.jsx)(k.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Archiver"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Signaler comme spam",onClick:e$,children:(0,a.jsx)(ea.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Signaler comme spam"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Supprimer",onClick:eI,children:(0,a.jsx)(en.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Supprimer"})]})]}),(0,a.jsx)("span",{className:"mx-1 h-6 w-px shrink-0 bg-[#dadce0]","aria-hidden":!0}),(0,a.jsxs)("div",{className:"flex min-w-0 shrink-0 items-center gap-0.5",children:[(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":eA?"Marquer comme non lu":"Marquer comme lu",onClick:eL,children:eA?(0,a.jsx)(aD.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5}):(0,a.jsx)(aT.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:eA?"Marquer comme non lu":"Marquer comme lu"})]}),(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsxs)(E.$,{type:"button",variant:"ghost",size:"sm",className:"h-9 w-9 shrink-0 gap-1 px-0 text-[#444746] hover:bg-[#f1f3f4] lg:h-9 lg:w-auto lg:px-2","aria-label":"D\xe9placer vers",children:[(0,a.jsx)(N.A,{className:"h-[18px] w-[18px] shrink-0",strokeWidth:1.5}),(0,a.jsx)("span",{className:"hidden max-w-32 truncate lg:inline",children:"D\xe9placer vers"}),(0,a.jsx)(eV.A,{className:"hidden h-3.5 w-3.5 shrink-0 opacity-70 lg:block"})]})}),(0,a.jsx)(z.SQ,{align:"start",className:(0,ec.cn)(e1,"max-h-80 overflow-y-auto"),children:(0,a.jsx)(aK,{targets:W,onMoveTo:eD})})]})]})]})})]}),e5=e=>{let t=eu??("view"===e?d.length:eb);return(0,a.jsxs)("div",{className:(0,ec.cn)("flex shrink-0 items-center gap-2 whitespace-nowrap text-sm text-gray-600","list"===e&&"max-sm:hidden sm:flex"),children:[0===d.length?(0,a.jsx)("span",{children:"Aucun r\xe9sultat"}):"view"===e?(0,a.jsxs)("span",{className:"hidden sm:inline",children:[ej>=0?ej+1:""," sur ",d.length]}):(0,a.jsxs)("span",{className:"inline-flex items-center gap-1",children:[ep," \xe0"," ",(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)("button",{type:"button",className:"rounded px-0.5 font-medium text-foreground underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Choisir le nombre de messages par page",children:eb})}),(0,a.jsx)(z.SQ,{align:"center",className:e1,children:am.O5.map(e=>(0,a.jsxs)(z._2,{onSelect:()=>ev(e),className:(0,ec.cn)(e===eh&&"font-medium"),children:[e," par page"]},e))})]})," ","sur ",t]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:(0,ec.cn)("h-9 w-9","view"===e&&ej>0||"list"===e&&ei>1?"text-gray-600":"text-gray-400"),disabled:"view"===e?ej<=0:ei<=1,onClick:"view"===e?ek:ew,"aria-label":"view"===e?"Plus r\xe9cent":"Page pr\xe9c\xe9dente",children:(0,a.jsx)(a_.A,{className:"h-4 w-4"})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"view"===e?"Plus r\xe9cent":"Page pr\xe9c\xe9dente"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:(0,ec.cn)("h-9 w-9","view"===e&&ej<d.length-1||"list"===e&&ei<ed?"text-gray-600":"text-gray-400"),disabled:"view"===e?ej>=d.length-1:ei>=ed,onClick:"view"===e?eN:ey,"aria-label":"view"===e?"Plus ancien":"Page suivante",children:(0,a.jsx)(aR.A,{className:"h-4 w-4"})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"view"===e?"Plus ancien":"Page suivante"})]})]})};return"reading-pane"===eZ?(0,a.jsxs)("div",{className:"relative z-20 flex shrink-0 min-h-12 items-start gap-2 border-b border-gray-200 py-1.5 pl-2 pr-4",children:[e2(!1),(0,a.jsx)("div",{className:"flex-1"}),eX?e5("view"):null]}):(0,a.jsxs)(a.Fragment,{children:["list"!==eJ&&!t&&(0,a.jsxs)("div",{className:"relative z-20 flex shrink-0 items-center gap-2 border-b border-border bg-mail-surface px-4 py-2.5 sm:hidden",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h1",{className:"truncate text-base font-semibold text-[#1f1f1f] leading-tight",children:c}),(0,a.jsx)("p",{className:"text-xs text-[#5f6368] leading-snug",children:eX?(0,a.jsxs)(a.Fragment,{children:[d.length," message",1!==d.length?"s":"",u>0&&` \xb7 ${u} non lu${1!==u?"s":""}`]}):"…"})]}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:m?"icon":"sm",className:(0,ec.cn)("shrink-0 text-[#444746]",m?"size-9 rounded-full border border-gray-200 bg-white/80 shadow-md backdrop-blur hover:bg-white":"h-9 min-h-9 gap-1.5 rounded-full border border-gray-200 bg-white/80 px-3 text-xs font-medium shadow-md backdrop-blur hover:bg-white"),onClick:()=>{h(e=>!e),m&&f([])},"aria-label":m?"Annuler la s\xe9lection":"S\xe9lection",children:m?(0,a.jsx)(S.A,{className:"size-[18px]",strokeWidth:1.5}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(aP.A,{className:"size-4",strokeWidth:1.5}),(0,a.jsx)("span",{children:"S\xe9lection"})]})}),(0,a.jsxs)(z.rI,{open:p,onOpenChange:b,children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0 rounded-full border border-gray-200 bg-white/80 text-[#444746] shadow-md backdrop-blur hover:bg-white","aria-label":"Plus d'actions",children:(0,a.jsx)(th.A,{className:"size-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(z.SQ,{align:"end",sideOffset:4,className:(0,ec.cn)(e1,"min-w-[260px]"),children:v?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(z._2,{onSelect:_,children:[(0,a.jsx)(k.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Archiver"]}),(0,a.jsxs)(z._2,{onSelect:R,children:[(0,a.jsx)(en.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Supprimer"]}),(0,a.jsxs)(z._2,{onSelect:P,children:[(0,a.jsx)(ea.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Signaler comme spam"]}),(0,a.jsx)(z._2,{onSelect:F?O:q,children:F?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(aT.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Marquer comme lu"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(aD.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Marquer comme non lu"]})}),(0,a.jsx)(z.mB,{}),(0,a.jsxs)(z._2,{onSelect:e=>{e.preventDefault(),es()},children:[(0,a.jsx)(N.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),(0,a.jsx)("span",{className:"flex-1",children:"D\xe9placer vers"}),(0,a.jsx)(aR.A,{className:"ml-auto size-4 text-[#5f6368]",strokeWidth:1.5})]}),(0,a.jsxs)(z._2,{onSelect:e=>{e.preventDefault(),el()},children:[(0,a.jsx)(aI.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),(0,a.jsx)("span",{className:"flex-1",children:"Ajouter le libell\xe9"}),(0,a.jsx)(aR.A,{className:"ml-auto size-4 text-[#5f6368]",strokeWidth:1.5})]}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(aF.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Ignorer la conversation"]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(z._2,{onSelect:ee,children:[(0,a.jsx)(aT.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Tout marquer comme lu"]}),(0,a.jsx)(z.mB,{}),(0,a.jsx)("div",{className:"px-3 py-2 text-sm leading-snug text-[#5f6368] select-none",role:"note",children:"S\xe9lectionnez des messages pour plus d'actions"})]})})]})]}),"mobile"!==eJ&&(0,a.jsxs)(a.Fragment,{children:[s?(0,a.jsxs)("div",{className:"flex max-sm:hidden shrink-0 items-center gap-2 border-b border-border bg-mail-surface px-2 py-2",children:[eT?(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"size-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Ouvrir le menu",onClick:eT,children:(0,a.jsx)(A.A,{className:"size-5",strokeWidth:1.5})}):null,(0,a.jsx)(t0,{compact:!0,className:"min-w-0 flex-1"})]}):null,(0,a.jsxs)("div",{className:(0,ec.cn)("relative z-20 flex shrink-0 min-h-12 gap-2 border-b border-border bg-mail-surface py-1.5 pl-2 pr-4",s?"rounded-none":"sm:rounded-t-2xl",t?"items-start":"items-center",(!t||!r)&&"max-sm:hidden"),children:[!s&&t?e2(!0):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(z.rI,{open:j,onOpenChange:w,children:[(0,a.jsxs)("div",{className:(0,ec.cn)("flex items-center overflow-hidden rounded-md border pr-0 transition-[background-color,box-shadow,border-color]",j?"border-[#dadce0] bg-[#f1f3f4] shadow-sm":"border-transparent"),children:[(0,a.jsx)("div",{className:"flex h-9 shrink-0 items-center pl-1 pr-0.5 md:pl-0",children:(0,a.jsx)(eE.S,{checked:y,onCheckedChange:C,className:"size-4 min-h-4 min-w-4 shrink-0 rounded-[2.5px] border-[1.5px] border-[#c2c2c2] bg-transparent shadow-none dark:bg-transparent focus-visible:ring-[#c2c2c2]/30 data-[state=checked]:border-[#1a73e8] data-[state=checked]:bg-[#1a73e8] data-[state=checked]:text-white data-[state=indeterminate]:border-[#1a73e8] data-[state=indeterminate]:bg-[#1a73e8] data-[state=indeterminate]:text-white"})}),(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:(0,ec.cn)("h-9 w-7 shrink-0 rounded-none p-0 text-[#5f6368]",j?"border-l border-[#dadce0] hover:bg-[#e8eaed]":"hover:bg-[#f1f3f4]"),"aria-label":"Options de s\xe9lection",children:(0,a.jsx)(eV.A,{className:"h-4 w-4"})})})]}),(0,a.jsxs)(z.SQ,{align:"start",sideOffset:4,className:(0,ec.cn)(e1,"min-w-[180px]"),children:[(0,a.jsx)(z._2,{onSelect:M,children:"Tous"}),(0,a.jsx)(z._2,{onSelect:I,children:"Aucun"}),(0,a.jsx)(z._2,{onSelect:$,children:"Lus"}),(0,a.jsx)(z._2,{onSelect:L,children:"Non lus"}),(0,a.jsx)(z._2,{onSelect:D,children:"Suivis"}),(0,a.jsx)(z._2,{onSelect:T,children:"Non suivis"})]})]}),v?(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-0.5 pl-1",children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Archiver",onClick:_,children:(0,a.jsx)(k.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Archiver"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Signaler comme spam",onClick:P,children:(0,a.jsx)(ea.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Signaler comme spam"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Supprimer",onClick:R,children:(0,a.jsx)(en.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Supprimer"})]})]}),(0,a.jsx)("span",{className:"mx-1 h-6 w-px shrink-0 bg-[#dadce0]","aria-hidden":!0}),(0,a.jsxs)("div",{className:"flex min-w-0 shrink-0 items-center gap-0.5",children:[(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":F?"Marquer comme lu":"Marquer comme non lu",onClick:()=>F?O():q(),children:F?(0,a.jsx)(aT.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5}):(0,a.jsx)(aD.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:F?"Marquer comme lu":"Marquer comme non lu"})]}),(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsxs)(E.$,{type:"button",variant:"ghost",size:"sm",className:"h-9 w-9 shrink-0 gap-1 px-0 text-[#444746] hover:bg-[#f1f3f4] lg:h-9 lg:w-auto lg:px-2","aria-label":"D\xe9placer vers",children:[(0,a.jsx)(N.A,{className:"h-[18px] w-[18px] shrink-0",strokeWidth:1.5}),(0,a.jsx)("span",{className:"hidden max-w-32 truncate lg:inline",children:"D\xe9placer vers"}),(0,a.jsx)(eV.A,{className:"hidden h-3.5 w-3.5 shrink-0 opacity-70 lg:block"})]})}),(0,a.jsx)(z.SQ,{align:"start",className:(0,ec.cn)(e1,"max-h-80 overflow-y-auto"),children:(0,a.jsx)(aK,{targets:W,onMoveTo:B})})]})]}),(0,a.jsx)("span",{className:"mx-1 h-6 w-px shrink-0 bg-[#dadce0]","aria-hidden":!0}),(0,a.jsxs)(z.rI,{onOpenChange:e=>{e||H("")},children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Plus d'actions",children:(0,a.jsx)(th.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsxs)(z.SQ,{align:"start",className:(0,ec.cn)(e1,"overflow-visible"),children:[(0,a.jsxs)(z._2,{children:[(0,a.jsx)(er.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Mettre en attente"]}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(aO.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Ajouter \xe0 Tasks"]}),(0,a.jsx)(z.mB,{}),(0,a.jsxs)(z.lv,{children:[(0,a.jsxs)(z.nV,{className:"[&>svg:last-child]:text-[#5f6368]",children:[(0,a.jsx)(aI.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Ajouter le libell\xe9"]}),(0,a.jsx)(z.M5,{className:(0,ec.cn)(e1,"z-[100] flex max-h-72 min-w-[260px] flex-col overflow-hidden p-0 py-0"),children:(0,a.jsx)(aE.U,{query:U,onQueryChange:H,catalogLabels:V,resolveLabelVisual:K,Item:z._2,getLabelPresence:e=>G(Q,e),onToggleCatalogLabel:e=>Y(Q,e),onCreateLabel:e=>{Z(Q,e),H("")}})})]}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(aF.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Ignorer la conversation"]}),(0,a.jsx)(z.mB,{}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(aq.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Ouvrir dans une nouvelle fen\xeatre"]})]})]})]})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"hidden h-9 w-9 text-gray-600 sm:inline-flex","aria-label":"Rafra\xeechir","aria-busy":J,disabled:J,onClick:()=>void X(),children:(0,a.jsx)(aW.A,{className:(0,ec.cn)("h-4 w-4",J&&sq)})}),(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Plus d'actions",children:(0,a.jsx)(th.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsxs)(z.SQ,{align:"start",sideOffset:4,className:(0,ec.cn)(e1,"min-w-[260px]"),children:[(0,a.jsxs)(z._2,{onSelect:ee,children:[(0,a.jsx)(aT.A,{className:"size-[18px] text-[#5f6368]",strokeWidth:1.5}),"Tout marquer comme lu"]}),(0,a.jsx)(z.mB,{}),(0,a.jsx)("div",{className:"px-3 py-2 text-sm leading-snug text-[#5f6368] select-none",role:"note",children:"S\xe9lectionnez des messages pour afficher plus d'actions"})]})]})]})]}),(0,a.jsx)("div",{className:"flex-1"}),r&&!eg&&eX?e5("list"):null,s||r||!eX?null:e5("view")]}),"inbox"===o&&(0,a.jsx)("div",{className:"relative z-10 w-full shrink-0 bg-mail-surface after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:z-0 after:h-px after:bg-border",children:r&&(l?(0,a.jsx)(aH,{tabs:e_,activeTabId:eR,unseenInTabById:eP,onTabClick:eq}):(0,a.jsx)("div",{className:"grid w-full min-w-0 max-w-[1260px]",style:{gridTemplateColumns:`repeat(${e_.length}, minmax(0, 1fr))`},children:e_.map(e=>{var t,s;let n=eR===e.id,r=n?sA(e.id,e.badgeColor):void 0,l=eP[e.id]??0,i=eF[e.id]??"",o=(0,x.AP)(e.id)&&!n&&l>0,c=o&&!!i;return(0,a.jsx)("button",{type:"button","aria-label":e.label,"aria-current":n?"true":void 0,onClick:()=>eq(e.id),style:r?{boxShadow:`inset 0 -3px 0 0 ${r}`}:void 0,className:(0,ec.cn)("relative z-[1] flex cursor-pointer transition-colors","min-w-0 w-full overflow-hidden max-sm:min-h-10 max-sm:items-center max-sm:justify-center","sm:min-h-14 sm:items-center sm:py-2 sm:text-left",!n&&"hover:bg-[#f1f3f4]"),children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex h-10 w-full items-center justify-center sm:hidden",children:(0,a.jsxs)("div",{className:"relative inline-flex shrink-0",children:[(0,a.jsx)(eO.In,{icon:e.icon,className:(0,ec.cn)(sK,eo.a9,!n&&"text-[#5f6368]"),style:r?{color:r}:void 0,"aria-hidden":!0}),o&&l>0?(0,a.jsx)("span",{className:(t=e.badgeColor,(0,ec.cn)("absolute -right-0.5 -top-0.5 size-2 rounded-full ring-2 ring-mail-surface",t)),"aria-hidden":!0}):null]})}),(0,a.jsxs)("div",{className:"hidden min-w-0 flex-1 items-center gap-2 mx-2 sm:mx-3 sm:flex",children:[(0,a.jsx)(eO.In,{icon:e.icon,className:(0,ec.cn)(sK,"self-center",eo.a9,!n&&"text-[#5f6368]"),style:r?{color:r}:void 0,"aria-hidden":!0}),(0,a.jsxs)("div",{className:"flex min-w-0 w-0 flex-1 flex-col gap-px",children:[(0,a.jsxs)("div",{className:(0,ec.cn)("flex min-w-0 items-center gap-1.5",c&&"min-h-5"),children:[(0,a.jsx)("span",{className:(0,ec.cn)("min-w-0 flex-1 truncate text-[13px] font-semibold leading-tight",eo.a9,!n&&"text-[#3c4043]"),style:r?{color:r}:void 0,children:e.label}),o&&l>0?(0,a.jsxs)("span",{className:(s=e.badgeColor,(0,ec.cn)("shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium leading-none",s,e3(s))),children:[l,(0,a.jsxs)("span",{className:"hidden md:inline",children:[" ",1===l?"nouveau":"nouveaux"]})]}):null]}),c?(0,a.jsx)("span",{className:(0,ec.cn)("block min-h-4 min-w-0 truncate text-[11px] leading-snug text-[#5f6368]",eo.a9),children:i}):null]})]})]})},e.id)})}))}),i&&eW&&r&&(0,a.jsxs)("div",{className:"flex w-full shrink-0 items-center gap-1.5 overflow-x-auto border-b border-[#dadce0] bg-mail-surface px-3 py-1.5 text-xs dark:border-gray-700",children:[(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",className:(0,ec.cn)("flex shrink-0 items-center gap-1 rounded-full border px-2.5 py-1 transition-colors",eW.from?"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"border-[#dadce0] text-[#5f6368] hover:bg-[#f1f3f4] dark:border-gray-600 dark:text-gray-400"),children:[(0,a.jsx)(ef.A,{className:"size-3",strokeWidth:2}),"De",eW.from?` : ${eW.from}`:"",(0,a.jsx)(eV.A,{className:"size-3"})]})}),(0,a.jsxs)(z.SQ,{align:"start",className:eo.hz,children:[(0,a.jsx)(z._2,{onSelect:()=>eH({from:""}),children:"N'importe qui"}),(0,a.jsxs)(z._2,{onSelect:()=>eH({from:eB?.email??""}),children:["De moi (",eB?.email,")"]}),(0,a.jsx)(z.mB,{}),Array.from(new Set(eU.map(e=>e.senderEmail).filter(Boolean))).slice(0,8).map(e=>(0,a.jsx)(z._2,{onSelect:()=>eH({from:e}),children:e},e))]})]}),(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",className:(0,ec.cn)("flex shrink-0 items-center gap-1 rounded-full border px-2.5 py-1 transition-colors",eW.within?"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"border-[#dadce0] text-[#5f6368] hover:bg-[#f1f3f4] dark:border-gray-600 dark:text-gray-400"),children:[(0,a.jsx)(er.A,{className:"size-3",strokeWidth:2}),eW.within?g.find(e=>e.value===eW.within)?.label??eW.within:"Indiff\xe9rente",(0,a.jsx)(eV.A,{className:"size-3"})]})}),(0,a.jsxs)(z.SQ,{align:"start",className:eo.hz,children:[(0,a.jsx)(z._2,{onSelect:()=>eH({within:""}),children:"Indiff\xe9rente"}),(0,a.jsx)(z.mB,{}),g.map(e=>(0,a.jsx)(z._2,{onSelect:()=>eH({within:e.value}),children:e.label},e.value))]})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>eK("has","attachment"),className:(0,ec.cn)("flex shrink-0 items-center gap-1 rounded-full border px-2.5 py-1 transition-colors",eW.has.includes("attachment")?"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"border-[#dadce0] text-[#5f6368] hover:bg-[#f1f3f4] dark:border-gray-600 dark:text-gray-400"),children:[(0,a.jsx)(ex.A,{className:"size-3",strokeWidth:2}),"Pi\xe8ces jointes"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>eK("excludeChats","true"),className:(0,ec.cn)("flex shrink-0 items-center gap-1 rounded-full border px-2.5 py-1 transition-colors",eW.excludeChats?"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"border-[#dadce0] text-[#5f6368] hover:bg-[#f1f3f4] dark:border-gray-600 dark:text-gray-400"),children:[(0,a.jsx)(aB.A,{className:"size-3",strokeWidth:2}),"Exclure les mises \xe0 jour d'agenda"]}),(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",className:(0,ec.cn)("flex shrink-0 items-center gap-1 rounded-full border px-2.5 py-1 transition-colors",eW.to?"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"border-[#dadce0] text-[#5f6368] hover:bg-[#f1f3f4] dark:border-gray-600 dark:text-gray-400"),children:[(0,a.jsx)(et.A,{className:"size-3",strokeWidth:2}),"\xc0",eW.to?` : ${eW.to}`:"",(0,a.jsx)(eV.A,{className:"size-3"})]})}),(0,a.jsxs)(z.SQ,{align:"start",className:eo.hz,children:[(0,a.jsx)(z._2,{onSelect:()=>eH({to:""}),children:"N'importe qui"}),(0,a.jsxs)(z._2,{onSelect:()=>eH({to:eB?.email??""}),children:["\xc0 moi (",eB?.email,")"]})]})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{if(!eW)return;let e={...eW};e.q.includes("is:unread")?e.q=e.q.replace(/\s*is:unread\s*/g,"").trim():e.q=(e.q+" is:unread").trim(),eG.push(eY(e))},className:(0,ec.cn)("flex shrink-0 items-center gap-1 rounded-full border px-2.5 py-1 transition-colors",eW.q.includes("is:unread")?"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"border-[#dadce0] text-[#5f6368] hover:bg-[#f1f3f4] dark:border-gray-600 dark:text-gray-400"),children:[(0,a.jsx)(aT.A,{className:"size-3",strokeWidth:2}),"Non lu"]}),(0,a.jsx)("button",{type:"button",onClick:()=>eQ(!0),className:"ml-auto shrink-0 px-2 py-1 text-xs font-medium text-[#1a73e8] hover:text-[#1765cc] dark:text-blue-400",children:"Recherche avanc\xe9e"})]})]})]})}var aY=s(30758),aZ=s(99833),aJ=s(41817),aX=s(7377);let a0={inbox:ee.A,starred:aZ.A,snoozed:er.A,sent:et.A,drafts:aJ.A,scheduled:aX.A,spam:ea.A,trash:en.A,search:M.A};function a1({visitKey:e,folderTree:t,labelRows:s}){let r=(0,n.useMemo)(()=>(function(e,t,s=tS.WF){let{folderId:a,inboxTab:n}=ab(e);if("inbox"===a){let e=(0,x.gD)(n??"primary");if("primary"===e)return{kind:"lucide",Icon:ef.A};if("all"===e)return{kind:"lucide",Icon:ee.A};let t=(0,tS.dX)(s,e);return t?.icon?{kind:"iconify",icon:t.icon}:{kind:"lucide",Icon:ee.A}}if("important"===a)return{kind:"iconify",icon:"mdi:label-variant-outline"};let r=a0[a];if(r)return{kind:"lucide",Icon:r};let l=(0,tS.dX)(s,a);if(l?.icon)return{kind:"iconify",icon:l.icon};let i=(0,ax.dG)(t,a);if(i?.length){let e=i[i.length-1];return{kind:"folder",icon:e5(!!e.children?.length,!1),color:e2(e.color??"bg-slate-400")}}return{kind:"folder",icon:e5(!1,!1),color:e2("bg-slate-400")}})(e,t,s),[e,t,s]);if("folder"===r.kind)return(0,a.jsx)(eO.In,{icon:r.icon,className:"size-4 shrink-0",style:{color:r.color},"aria-hidden":!0});if("iconify"===r.kind)return(0,a.jsx)(eO.In,{icon:r.icon,className:"size-4 shrink-0 text-[#5f6368]","aria-hidden":!0});let{Icon:l}=r;return(0,a.jsx)(l,{className:"size-4 shrink-0 text-[#5f6368]",strokeWidth:1.5,"aria-hidden":!0})}function a2({currentKey:e,folderTree:t,folderIdToLabel:s,labelRows:r,className:l,onNavigate:i}){let o=(0,n.useMemo)(()=>(function(e,t,s,a=tS.WF){let{folderId:n,inboxTab:r}=ab(e),l="inbox"===n&&r&&"primary"!==r?{tabId:r,label:(0,tS.Qm)(r,a,s??{})}:null;if("inbox"===n){let e=(0,tS.vF)(n,s);return l&&"Principale"!==l.label?[{label:e,visitKey:ap("inbox")},{label:l.label,visitKey:ap("inbox",l.tabId)}]:[{label:e,visitKey:ap(n)}]}let i=(0,ax.dG)(t,n);return i?.length?i.map(e=>({label:e.label,visitKey:e.id})):[{label:(0,tS.vF)(n,s),visitKey:n}]})(e,t,s,r),[e,t,s,r]),c=o.map(e=>e.label).join(" \xb7 ");return(0,a.jsx)("nav",{"aria-label":`Fil d'Ariane : ${c}`,className:(0,ec.cn)("flex max-w-[min(360px,calc(100vw-1rem))] items-center","border-t border-r border-[#dadce0]/90","bg-mail-surface/90 px-3.5 py-2.5 text-sm font-medium leading-snug text-foreground","rounded-tr-2xl shadow-sm backdrop-blur-md",l),children:(0,a.jsx)("span",{className:"flex min-w-0 items-center gap-1.5",children:o.map((s,l)=>{let o=s.visitKey===e,c=(0,ec.cn)("flex min-w-0 items-center gap-1.5 rounded-sm outline-none",i&&!o&&"cursor-pointer hover:bg-[#f1f3f4] focus-visible:ring-2 focus-visible:ring-[#0b57d0]/40",i&&o&&"cursor-default"),d=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(a1,{visitKey:s.visitKey,folderTree:t,labelRows:r}),(0,a.jsx)("span",{className:"truncate",children:s.label})]});return(0,a.jsxs)(n.Fragment,{children:[l>0?(0,a.jsx)("span",{className:"shrink-0 text-xs leading-none text-[#9aa0a6]","aria-hidden":!0,children:"\xb7"}):null,i?(0,a.jsx)("button",{type:"button",className:c,"aria-current":o?"page":void 0,onClick:()=>i(s.visitKey),children:d}):(0,a.jsx)("span",{className:c,children:d})]},`${s.visitKey}-${l}`)})})})}var a3=s(89536),a5=s(13957),a4=s(43138),a6=s(85569),a8=s(83036);function a7({...e}){return(0,a.jsx)(a8.bL,{"data-slot":"hover-card",...e})}function a9({...e}){return(0,a.jsx)(a8.l9,{"data-slot":"hover-card-trigger",...e})}function ne({className:e,align:t="center",sideOffset:s=4,...n}){return(0,a.jsx)(a8.ZL,{"data-slot":"hover-card-portal",children:(0,a.jsx)(a8.UC,{"data-slot":"hover-card-content",align:t,sideOffset:s,className:(0,ec.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...n})})}var nt=s(83984),ns=s(12325),na=s(13084),nn=s(62500),nr=s(81231),nl=s(81613),ni=s(78699),no=s(80936),nc=s(62228);function nd({displayName:e,email:t,children:s,className:r,onTriggerClick:o,align:c="start",side:d="bottom"}){let{openComposeWithInitial:u}=Z(),{contacts:m}=(0,no.D)(),h=(0,ni.Y)(e=>e.openContactDetail),x=(0,ni.Y)(e=>e.openCreateContact),[f,p]=(0,n.useState)(!1),b=function(){let[e,t]=(0,n.useState)(!1);return(0,n.useLayoutEffect)(()=>{let e=window.matchMedia(l),s=()=>t(i());return s(),e.addEventListener("change",s),()=>e.removeEventListener("change",s)},[]),e}(),g=(0,n.useRef)(null),v=(0,n.useRef)(null),j=(0,n.useRef)(!1),w=(0,eS.ms)(e),y=(0,eS.k6)(e,t),k=(0,n.useMemo)(()=>(0,nc.VY)(m,y),[m,y]),N=(0,n.useCallback)(()=>{if(p(!1),k)return void h(k.id);let{firstName:e,lastName:t}=(0,nc.VT)(w);x({firstName:e,lastName:t,emails:y?[{value:y,label:"Domicile"}]:void 0})},[k,w,y,h,x]),C=(0,n.useCallback)(()=>{j.current=!0,p(!0),queueMicrotask(()=>{j.current=!1})},[]),S=(0,t_.H)(C,{disabled:!b,delay:1e3}),A=(0,n.useCallback)(e=>{b&&e&&!j.current||p(e)},[b]);return(0,n.useEffect)(()=>{if(!f)return;let e=()=>p(!1),t={capture:!0,passive:!0};return window.addEventListener("scroll",e,t),window.addEventListener("wheel",e,t),window.addEventListener("touchmove",e,t),()=>{window.removeEventListener("scroll",e,t),window.removeEventListener("wheel",e,t),window.removeEventListener("touchmove",e,t)}},[f]),(0,n.useEffect)(()=>{if(!f||!b)return;let e=e=>{let t=e.target;g.current?.contains(t)||v.current?.contains(t)||p(!1)};return document.addEventListener("pointerdown",e,{capture:!0}),()=>document.removeEventListener("pointerdown",e,{capture:!0})},[f,b]),(0,a.jsxs)(a7,{open:f,onOpenChange:A,openDelay:b?1e6:1e3,closeDelay:150,children:[(0,a.jsx)(a9,{asChild:!0,children:(0,a.jsx)("span",{ref:g,role:"presentation",tabIndex:0,className:(0,ec.cn)("inline-block min-w-0 max-w-full cursor-default text-inherit align-middle outline-none focus-visible:ring-2 focus-visible:ring-[#1a73e8]/30 focus-visible:ring-offset-1 rounded-sm",S.ackClassName,r),onClick:e=>{o?.(e)},onPointerDown:b?S.onPointerDown:void 0,onPointerUp:b?S.onPointerUp:void 0,onPointerLeave:b?S.onPointerLeave:void 0,onPointerCancel:b?S.onPointerCancel:void 0,onClickCapture:b?S.onClickCapture:void 0,children:s})}),(0,a.jsxs)(ne,{ref:v,"data-contact-hover-card":!0,side:d,align:c,sideOffset:8,className:(0,ec.cn)("min-w-[380px] w-max max-w-[min(440px,calc(100vw-24px))] rounded-2xl border border-border bg-popover p-0 text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 outline-hidden"),children:[(0,a.jsx)("div",{className:"p-4 pb-3",children:(0,a.jsxs)("div",{className:"relative flex items-start gap-3",children:[(0,a.jsx)(nt.q,{contact:k,name:w,email:y,size:"md"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 pr-8",children:[(0,a.jsx)("p",{className:"truncate text-base font-semibold leading-tight text-[#202124]",children:w}),(0,a.jsx)("p",{className:"truncate text-sm leading-tight text-[#5f6368]",children:y})]}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-8 w-8 shrink-0 text-[#5f6368] hover:bg-[#f1f3f4]","aria-label":k?"Voir le contact":"Ajouter aux contacts",onClick:e=>{e.stopPropagation(),N()},children:(0,a.jsx)(ns.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})]})}),(0,a.jsxs)("div",{className:"flex flex-nowrap items-center gap-2 px-4 pb-4",children:[(0,a.jsxs)("button",{type:"button",className:"inline-flex h-9 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-full bg-[#d3e3fd] px-5 text-sm font-medium text-[#001d35] transition-colors hover:bg-[#c4d9fc]",onClick:e=>{e.stopPropagation(),u({to:[{name:w,email:y}]})},children:[(0,a.jsx)(aD.A,{className:"h-[18px] w-[18px] shrink-0",strokeWidth:1.5}),"Envoyer un e-mail"]}),(0,a.jsx)("button",{type:"button",className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-border bg-mail-surface text-muted-foreground transition-colors hover:bg-accent","aria-label":"Message",children:(0,a.jsx)(na.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})}),(0,a.jsx)("button",{type:"button",className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-border bg-mail-surface text-muted-foreground transition-colors hover:bg-accent","aria-label":"Visioconf\xe9rence",children:(0,a.jsx)(nn.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})}),(0,a.jsxs)("button",{type:"button",className:"relative flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-border bg-mail-surface text-muted-foreground transition-colors hover:bg-accent","aria-label":"Planifier un \xe9v\xe9nement",onClick:e=>{e.stopPropagation(),window.location.href=`/agenda?new=1&guest=${encodeURIComponent(y)}&guest_name=${encodeURIComponent(w)}`},children:[(0,a.jsx)(nr.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5}),(0,a.jsx)("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-[#1a73e8]","aria-hidden":!0})]})]}),(0,a.jsx)("div",{className:"border-t border-[#eceff1] px-3 pb-3 pt-2",children:(0,a.jsx)("button",{type:"button",className:"flex w-full items-center justify-center gap-2 rounded-lg bg-[#f1f3f4] px-3 py-2.5 text-sm font-medium text-[#1a73e8] transition-colors hover:bg-[#e8eaed]",onClick:e=>{e.stopPropagation(),N()},children:k?(0,a.jsxs)(a.Fragment,{children:["Ouvrir la vue d\xe9taill\xe9e",(0,a.jsx)(nl.A,{className:"h-4 w-4 shrink-0",strokeWidth:1.5})]}):(0,a.jsxs)(a.Fragment,{children:["Ajouter aux contacts",(0,a.jsx)(ns.A,{className:"h-4 w-4 shrink-0",strokeWidth:1.5})]})})})]})]})}let nu=(0,n.memo)(function({tabs:e,onTabClick:t,className:s,iconClassName:n="size-4 shrink-0"}){if(0===e.length)return null;let r=e.map(e=>e.label).join(", ");return(0,a.jsx)("span",{className:(0,ec.cn)("inline-flex shrink-0 items-center gap-0.5",s),"aria-label":`Cat\xe9gories : ${r}`,children:e.map(e=>{let s=e2(e.badgeColor),r=(0,a.jsx)(eO.In,{icon:e.icon,className:n,style:{color:s},"aria-hidden":!0});return t?(0,a.jsx)("button",{type:"button",title:e.label,"aria-label":e.label,onClick:s=>{s.stopPropagation(),t(e.id)},className:"inline-flex cursor-pointer items-center justify-center rounded-full p-0.5 hover:bg-black/6",children:r},e.id):(0,a.jsx)("span",{title:e.label,className:"inline-flex items-center justify-center p-0.5",children:r},e.id)})})}),nm="cubic-bezier(0.25, 0.46, 0.45, 0.94)",nh=(0,n.memo)(function({enabled:e,emailId:t,isOpen:s,onOpenChange:r,onArchive:l,onDelete:i,onStar:o,onLabel:c,className:d,children:u}){let m=(0,n.useRef)(null),h=(0,n.useRef)(null),x=(0,n.useRef)(null),f=(0,n.useRef)(null),p=(0,n.useRef)(0),b=(0,n.useRef)("none"),g=(0,n.useRef)(null),v=(0,n.useRef)(0),j=(0,n.useCallback)(e=>{p.current=e;let t=h.current;if(!t)return;t.style.transform=`translate3d(${e}px,0,0)`;let s=x.current,a=f.current;s&&(s.style.visibility=e>0?"visible":"hidden"),a&&(a.style.visibility=e<0?"visible":"hidden")},[]),w=(0,n.useCallback)(e=>{let t=h.current;t&&(t.style.transition=`transform 200ms ${nm}`,j(e),window.setTimeout(()=>{t&&(t.style.transition="none")},210))},[j]),y=(0,n.useCallback)(()=>{w(0),b.current="none",s&&r(!1)},[w,s,r]),N=(0,n.useCallback)(t=>{if(!e)return;let s=t.touches[0];if(!s)return;let a=h.current;a&&(a.style.transition="none"),g.current={startX:s.clientX,startY:s.clientY,startOffset:p.current,active:!0,axis:"none",startTime:performance.now(),prevX:s.clientX,prevT:performance.now()}},[e]),C=(0,n.useCallback)(e=>{let t=g.current;if(!t?.active)return;let s=e.touches[0];if(!s)return;let a=s.clientX-t.startX,n=s.clientY-t.startY;if("none"===t.axis){if(6>Math.abs(a)&&6>Math.abs(n))return;if(Math.abs(n)>Math.abs(a)){t.axis="y",t.active=!1;return}t.axis="x"}if("x"!==t.axis)return;e.preventDefault();let r=t.startOffset+a;r>240&&(r=240),r<-100&&(r=-100),t.prevX=s.clientX,t.prevT=performance.now(),j(r)},[j]),S=(0,n.useCallback)(()=>{let e=g.current;if(g.current=null,!e?.active||"x"!==e.axis)return;v.current=performance.now()+350;let t=p.current,a=Math.max(1,performance.now()-e.startTime),n=(e.prevX-e.startX)/a;if("right"===b.current&&t<=0||"left"===b.current&&t>=0){w(0),b.current="none",s&&r(!1);return}let l=s&&("right"===b.current&&t<240||"left"===b.current&&100>-t);t>0?l?t>=220.8&&n>=-.12?w(240):(w(0),b.current="none",r(!1)):t>=36||n>.28&&t>20?(w(240),b.current="right",s||r(!0)):(w(0),b.current="none",s&&r(!1)):t<0?l?-t>=92&&n<=.12?w(-100):(w(0),b.current="none",r(!1)):-t>=15||n<-.28&&t<-20?(w(-100),b.current="left",s||r(!0)):(w(0),b.current="none",s&&r(!1)):(b.current="none",s&&r(!1))},[w,s,r]),A=(0,n.useCallback)(()=>{let e=g.current;g.current=null,e?.active&&"x"===e.axis&&(w(0),b.current="none",s&&r(!1))},[w,s,r]),M=(0,n.useCallback)(t=>{if(e){if(performance.now()<v.current){t.preventDefault(),t.stopPropagation();return}0!==p.current&&(t.preventDefault(),t.stopPropagation(),y())}},[y,e]);if(!s&&0!==p.current&&!g.current?.active){let e=h.current;e&&(e.style.transition=`transform 200ms ${nm}`,j(0),b.current="none",window.setTimeout(()=>{e&&(e.style.transition="none")},210))}return e?(0,a.jsxs)("div",{ref:m,className:(0,ec.cn)("relative overflow-hidden",d),"data-swipe-row-id":t,children:[(0,a.jsxs)("div",{className:"invisible absolute inset-y-0 left-0 flex",ref:x,children:[(0,a.jsxs)("button",{type:"button","aria-label":"Mettre en suivi",className:"flex h-full w-20 shrink-0 flex-col items-center justify-center gap-1 bg-[#f4b400] px-1 text-[11px] font-medium text-white",onClick:e=>{e.stopPropagation(),o(),y()},children:[(0,a.jsx)(aZ.A,{className:"size-5 fill-white text-white",strokeWidth:0}),(0,a.jsx)("span",{className:"max-w-full truncate text-center",children:"Suivi"})]}),(0,a.jsxs)("button",{type:"button","aria-label":"Ajouter un libell\xe9",className:"flex h-full w-20 shrink-0 flex-col items-center justify-center gap-1 bg-[#34a853] px-1 text-[11px] font-medium text-white",onClick:e=>{e.stopPropagation(),c(),y()},children:[(0,a.jsx)(aI.A,{className:"size-5 text-white",strokeWidth:1.75}),(0,a.jsx)("span",{className:"max-w-full truncate text-center",children:"Libell\xe9"})]}),(0,a.jsxs)("button",{type:"button","aria-label":"Archiver",className:"flex h-full w-20 shrink-0 flex-col items-center justify-center gap-1 bg-[#1a73e8] px-1 text-[11px] font-medium text-white",onClick:e=>{e.stopPropagation(),l(),y()},children:[(0,a.jsx)(k.A,{className:"size-5 text-white",strokeWidth:1.75}),(0,a.jsx)("span",{className:"max-w-full truncate text-center",children:"Archiver"})]})]}),(0,a.jsx)("div",{className:"invisible absolute inset-y-0 right-0 flex",ref:f,children:(0,a.jsxs)("button",{type:"button","aria-label":"Supprimer",className:"flex h-full w-[100px] shrink-0 flex-col items-center justify-center gap-1 bg-[#d93025] px-2 text-[11px] font-medium text-white",onClick:e=>{e.stopPropagation(),i(),y()},children:[(0,a.jsx)(en.A,{className:"size-5 text-white",strokeWidth:1.75}),(0,a.jsx)("span",{className:"max-w-full truncate text-center",children:"Supprimer"})]})}),(0,a.jsx)("div",{ref:h,className:"relative z-1 bg-inherit will-change-transform",style:{transform:"translate3d(0,0,0)"},onTouchStart:N,onTouchMove:C,onTouchEnd:S,onTouchCancel:A,onClickCapture:M,children:u})]}):(0,a.jsx)("div",{className:d,children:u})});function nx({iso:e,variant:t,className:s}){let[r,l]=(0,n.useState)("\xa0");return(0,n.useEffect)(()=>{e?.trim()?l(function(e,t){switch(t){case"list":case"previewShort":return function(e,t=sE()()){sR();let s=sP(e);return s?s.isSame(t,"day")?s.format("LT"):s.isSame(t,"year")?s.format("D MMM"):s.format("L"):"—"}(e);case"preview":return function(e,t=sE()()){sR();let s=sP(e);if(!s)return"—";let a=s.format("LT");if(s.isSame(t,"day"))return`${a}${sF(s,t)}`;let n=t.valueOf()-s.valueOf(),r=s.format("ddd D MMM");return n>=0&&n<12096e5?`${r} ${a}${sF(s,t)}`:s.isSame(t,"year")?`${r} ${a}`:`${s.format("ddd D MMM YYYY")} ${a}`}(e);case"detail":return sO(e)}}(e,t)):l("—")},[e,t]),(0,a.jsx)("span",{className:(0,ec.cn)(s),suppressHydrationWarning:!0,children:r})}var nf=s(61963),np=s(83866),nb=s(90293),ng=s(89032),nv=s(71092),nj=s(93510);function nw(e,t){if(t)return t;let s=e.toLowerCase();return s.endsWith(".pdf")?"application/pdf":/\.(jpe?g|png|gif|webp|svg|bmp|avif|heic)$/.test(s)?"image/*":/\.(mp4|webm|mov|mkv)$/.test(s)?"video/*":/\.(mp3|wav|ogg|flac|m4a)$/.test(s)?"audio/*":/\.(txt|md|json|yaml|yml|log)$/.test(s)?"text/plain":"application/octet-stream"}function ny(e){return null!==(0,nv.tF)({name:e.name,mime_type:nw(e.name,e.contentType)})}function nk(e,t,s){let a=t.filter(e=>e.id).map(e=>({path:e.drivePath??`mail:${e.id}`,name:e.name,mime_type:nw(e.name,e.contentType),is_favorite:!1,mailAttachmentId:e.id,mailMessageId:void 0})).map(t=>({...t,mailMessageId:e}));if(0===a.length)return;let n=Math.min(Math.max(s,0),a.length-1);nj.J.getState().openPreview(a,n,{allowShare:!1,isTrash:!1,mailSource:!0,mailMessageId:e})}function nN({att:e,messageId:t,attachments:s,attachmentIndex:n}){return(0,a.jsxs)("button",{type:"button",onClick:a=>{(a.preventDefault(),a.stopPropagation(),e.id)?ny(e)?nk(t,s,n):ng.oR.message("Aper\xe7u non disponible"):ng.oR.message("Pi\xe8ce jointe non disponible")},className:"inline-flex max-w-[min(100%,280px)] min-w-0 shrink items-center gap-1.5 rounded-full border border-mail-list-chip-border bg-transparent px-2.5 py-1 text-[13px] leading-snug text-mail-list-chip-text hover:bg-mail-list-chip-muted",children:["pdf"===e.kind?(0,a.jsx)(nf.A,{className:"size-4 shrink-0 fill-destructive",strokeWidth:0,"aria-hidden":!0}):"image"===e.kind?(0,a.jsx)(np.A,{className:"size-4 shrink-0 text-muted-foreground [&_circle]:fill-none [&_path]:fill-none [&_path]:stroke-current [&_rect]:fill-current [&_rect]:opacity-[0.32]",strokeWidth:1.5,"aria-hidden":!0}):(0,a.jsx)(nf.A,{className:"size-4 shrink-0 fill-muted-foreground",strokeWidth:0,"aria-hidden":!0}),(0,a.jsx)("span",{className:"min-w-0 truncate",children:e.name}),e.drivePath?(0,a.jsx)(nb.A,{className:"size-3.5 shrink-0 text-primary","aria-label":"Dans UltiDrive"}):null]})}function nC({emailId:e,attachments:t}){let s=(0,n.useRef)(null),r=(0,n.useRef)(null),[l,i]=(0,n.useState)(!1),o=t.map(e=>`${e.name}\u0001${e.kind??""}`).join("\x02"),c=(0,n.useCallback)(()=>{let e=s.current,a=r.current;if(!e||!a||t.length<=1)return void i(!1);let n=e.clientWidth;i(a.scrollWidth>n+1)},[o,t.length]);(0,n.useLayoutEffect)(()=>{c()},[c]),(0,n.useEffect)(()=>{let e=s.current;if(!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(()=>c());return t.observe(e),()=>t.disconnect()},[c]);let d=t.length-1==1?"1 autre":`${t.length-1} autres`,u=t.slice(1).map(e=>e.name).join(", ");return(0,a.jsxs)("div",{ref:s,className:"relative min-w-0 w-full",children:[t.length>1&&(0,a.jsx)("div",{ref:r,className:"pointer-events-none invisible absolute left-0 top-0 z-[-1] flex w-max flex-nowrap gap-1.5","aria-hidden":!0,children:t.map((s,n)=>(0,a.jsx)(nN,{att:s,messageId:e,attachments:t,attachmentIndex:n},`${e}-m-${n}`))}),(0,a.jsx)("div",{className:"flex min-w-0 flex-nowrap items-center gap-1.5 overflow-hidden",children:l&&t.length>1?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(nN,{att:t[0],messageId:e,attachments:t,attachmentIndex:0}),(0,a.jsx)("span",{className:"shrink-0 rounded-full border border-mail-list-chip-border bg-mail-list-chip-muted px-2.5 py-1 text-[13px] leading-snug text-muted-foreground",title:u,children:d})]}):t.map((s,n)=>(0,a.jsx)(nN,{att:s,messageId:e,attachments:t,attachmentIndex:n},`${e}-v-${n}`))})]})}let nS=(0,n.memo)(function(e){let{email:t,allEmails:s,emailById:n,listMailIndex:l,listRowExtras:i,starredEmails:o,importantEmails:c,readOverrides:d,conversationMode:u,savedThreadReplyDrafts:m,selectedEmails:h,selectedFolder:x,splitView:f,openMailId:p,isXs:b,isMd:g,density:v,mobileSelectionMode:j,touchListSwipeEnabled:w,openSwipeRowId:y,setOpenSwipeRowId:S,listRowLabelBgByTextLower:A,sidebarNav:z,rescheduleTarget:$,setRescheduleTarget:L,rescheduleDismissTimeoutsRef:D,scheduleReschedulePopoverDismiss:T,rowContextMenuOpenedAtRef:_,contextMenuTargetIdsRef:R,lastSelectionAnchorIdRef:P,setSelectedEmails:F,setLabelPickerQuery:O,labelPickerQuery:q,catalogLabels:W,resolveLabelVisual:B,getCatalogLabelPresence:U,toggleLabelOnEmails:H,addLabelToEmails:V,moveTargets:K,moveEmailsToTarget:Q,cmScheduledRescheduleValue:G,setCmScheduledRescheduleValue:Y,mailActions:Z,setReadOverrides:J,onSelectFolder:X,toggleSelect:es,handleRowCheckboxClickCapture:ea,handleRowActivate:el,startRowDrag:ei,archiveListRow:ed,deleteListRow:eu,toggleStar:em,toggleImportant:eh,openSwipeRowLabelSheet:ef,handleNavigateToLabel:ep,handleCategoryInboxTabClick:eb,closeViewIfShowingEmail:eg,restoreSnoozedRowToMailbox:ev,handleEditScheduledMail:ej,requestArchiveScheduled:ew,requestDeleteScheduled:ey,requestToggleReadScheduled:ek,requestSnoozeScheduled:eN,requestRescheduleScheduled:eC,requestSendScheduledNow:eA,requestSnoozeMailboxEmail:eM}=e,eI=so(t),ez=o.includes(eI)||t.starred,e$=c.includes(eI)||t.important,eL=!0===t.spam,eD=t.labels?.includes("drafts")===!0,eT=void 0!==m[eI],e_=eD||eT,eR=sd(t,d,n,u),eP=(0,eS.k6)(t.sender,t.senderEmail),eF=u?t.threadMessageIds?.length?t.threadMessageIds.length:1+(t.conversation?.length??0):0,eq=t.sender.replace(/\s+/g," ").trim(),eW=h.includes(t.id),eB=f&&p===t.id,eU=!0===t.hasInvitation,eH=i.invitationById.get(t.id)??null,eV=i.attachmentsById.get(t.id)??[],eK=eV.length>0&&(!g||"default"===v),eQ=eV.length>0&&g&&"default"!==v,eG=g&&"compact"===v,eY=eK?eG?"pt-0":"pt-0.5":eG?"pt-0":"pt-1",eZ=t.labels?.includes("scheduled")===!0,eJ=sH(t.id,h,x,s),eX=eJ.length>0&&eJ.every(e=>l.scheduledIds.has(e)),e0=eX&&eJ.some(e=>{let t=l.emailById.get(e);return!!t&&!(d[e]??t.read)}),e1=$?.id===t.id,e2="spam"===x,e3="snoozed"===x;return(0,a.jsxs)(e7.tz,{modal:!1,onOpenChange:e=>{e?(_.current=Date.now(),F(e=>{let a=sH(t.id,e,x,s);return R.current=[...a],a})):O("")},children:[(0,a.jsx)(e7.Rc,{asChild:!0,children:(0,a.jsx)(nh,{enabled:w,emailId:t.id,isOpen:y===t.id,onOpenChange:e=>{e?S(t.id):y===t.id&&S(null)},onArchive:()=>ed(t),onDelete:()=>eu(t),onStar:()=>em(t.id),onLabel:()=>ef(t.id),children:(0,a.jsxs)("div",{"data-email-row-id":t.id,"data-split-active":eB?"":void 0,"aria-current":eB?"true":void 0,draggable:!b,onDragStart:b?void 0:e=>ei(t.id,e),onClick:()=>{if((0,r.xM)()&&j){es(t.id),P.current=t.id;return}el(t)},className:(0,ec.cn)("group relative z-0 w-full cursor-pointer pl-3 pr-2 py-2 transition-[background-color,box-shadow] duration-[50ms] ease-out",!f&&"md:flex md:gap-2 md:px-2 md:py-1.5",!f&&(eG&&!eK?"md:items-center":"md:items-start"),eG&&"md:!py-1 md:text-[13px]",eB?"z-[1] bg-mail-row-active-split shadow-[inset_3px_0_0_0_#669df6]":eW?"bg-mail-row-selected":eR?"bg-mail-row-read":"bg-mail-row-unread",!eB&&"hover:z-1 hover:shadow-[inset_1px_0_0_#d2d5da,inset_-1px_0_0_#d2d5da,0_4px_10px_-3px_rgba(60,64,67,.16),0_2px_5px_0_rgba(60,64,67,.09)]"),children:[(0,a.jsxs)("div",{className:(0,ec.cn)("flex w-full min-w-0 flex-col gap-0.5",!f&&"md:hidden",j&&"max-sm:flex-row max-sm:items-center max-sm:gap-2"),children:[j&&(0,a.jsx)("div",{className:"flex shrink-0 self-center sm:hidden",onClick:e=>e.stopPropagation(),onClickCapture:e=>ea(t.id,e),children:(0,a.jsx)(eE.S,{className:eo.Fr,checked:eW,onCheckedChange:()=>{es(t.id),P.current=t.id}})}),(0,a.jsxs)("div",{className:(0,ec.cn)("flex min-w-0 flex-1 flex-col gap-0.5",j&&"max-sm:pointer-events-none"),"data-selectable-text":!0,children:[(0,a.jsxs)("div",{className:"flex w-full min-w-0 items-center gap-2",children:[(0,a.jsx)("div",{className:"hidden shrink-0 items-center sm:flex",onClick:e=>e.stopPropagation(),onClickCapture:e=>ea(t.id,e),children:(0,a.jsx)(eE.S,{className:eo.pK,checked:eW,onCheckedChange:()=>{es(t.id),P.current=t.id}})}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),eh(t.id)},className:(0,ec.cn)("flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-full",eL?"text-[#d93025] hover:bg-[#d93025]/10 hover:text-[#b3261e]":"text-[#c2c2c2] hover:bg-black/4 hover:text-[#5f6368]"),"aria-label":eL?"Marqu\xe9 comme spam":e$?"Retirer important":"Marquer important",children:(0,a.jsx)(eO.In,{icon:sV(eL,e$),className:(0,ec.cn)("size-4 shrink-0",eL&&"text-[#d93025]",!eL&&(e$?"text-[#f4cc70]":"text-[#c2c2c2]")),"aria-hidden":!0})}),eZ&&(0,a.jsx)("span",{className:"flex h-7 w-6 shrink-0 items-center justify-center text-[#5f6368]","aria-hidden":!0,children:(0,a.jsx)(et.A,{className:"size-3.5",strokeWidth:2})}),eZ?(0,a.jsxs)("span",{className:(0,ec.cn)("min-w-0 truncate text-sm",eR?"font-normal text-gray-700":"font-semibold text-gray-900"),children:["\xc0 : ",t.scheduledToName??t.sender]}):(0,a.jsx)(nd,{displayName:t.sender,email:eP,children:(0,a.jsxs)("span",{className:(0,ec.cn)("min-w-0 truncate text-sm",eR?"font-normal text-gray-700":"font-semibold text-gray-900"),children:[e_&&(0,a.jsx)("span",{className:"font-medium text-[#d93025]",children:"Brouillon "}),t.sender]})}),eF>1&&(0,a.jsx)("span",{className:"shrink-0 text-sm font-normal text-gray-500",children:eF})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(eH||eU)&&(0,a.jsx)(eO.In,{icon:eH?ar[eH.conferenceProvider]:"mdi:calendar",className:"size-4 shrink-0 text-[#5f6368]","aria-label":eH?"Invitation visioconf\xe9rence":"Invitation calendrier"}),eV.length>0&&(0,a.jsx)(ex.A,{className:"size-4 shrink-0 text-[#5f6368]",strokeWidth:1.75,"aria-label":"Pi\xe8ces jointes"}),i.categoryTabsById.get(t.id)?(0,a.jsx)(nu,{tabs:i.categoryTabsById.get(t.id),onTabClick:eb}):null,(0,a.jsx)("span",{className:(0,ec.cn)("shrink-0 text-sm font-semibold tabular-nums tracking-tight",eR?"text-gray-700":"text-gray-900"),children:eZ?sW(t.scheduledSendAt):(0,a.jsx)(nx,{iso:t.date,variant:"list"})})]})]})]}),(0,a.jsxs)("div",{className:(0,ec.cn)("flex min-w-0 flex-wrap items-center gap-1 sm:pl-6"),children:[t.tag&&(0,a.jsx)("span",{className:"shrink-0 rounded bg-gray-200 px-1.5 py-0.5 text-xs text-gray-600 opacity-[0.92]",children:t.tag}),(0,a.jsx)(t7,{variant:"list",labels:t.labels,labelBgByText:A,emailLabelToSidebarFolderId:z.emailLabelToSidebarFolderId,getNavItemPrefs:z.getNavItemPrefs,labelRows:z.labelRows,onLabelNavigate:ep,currentFolderId:x,folderTree:z.folderTree}),(0,a.jsx)("span",{className:(0,ec.cn)("min-w-0 flex-1 text-sm leading-snug line-clamp-1",eR?"font-semibold text-[#202124]":"font-semibold text-gray-900"),children:t.subject})]}),(0,a.jsxs)("div",{className:(0,ec.cn)("flex min-w-0 items-start gap-1.5 sm:pl-6"),children:[(0,a.jsx)("p",{className:"min-w-0 flex-1 text-sm leading-snug text-[#5f6368] line-clamp-1",children:t.preview}),(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),em(t.id)},className:"mt-0.5 flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-full text-[#c2c2c2] hover:bg-black/4 hover:text-[#5f6368]","aria-label":ez?"Retirer des favoris":"Marquer comme favori",children:(0,a.jsx)(aZ.A,{strokeWidth:1.25*!ez,className:(0,ec.cn)("size-4",ez?"fill-[#f4cc70] stroke-none text-[#f4cc70]":"fill-transparent stroke-[#c2c2c2]")})})]})]})]}),(0,a.jsxs)("div",{className:(0,ec.cn)("hidden w-full items-start gap-2",!f&&"md:flex"),children:[(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,a.jsx)("div",{className:"flex shrink-0",onClick:e=>e.stopPropagation(),onClickCapture:e=>ea(t.id,e),children:(0,a.jsx)(eE.S,{className:"size-4 min-h-4 min-w-4 shrink-0 rounded-[2.5px] border-[1.5px] border-[#c2c2c2] bg-transparent shadow-none dark:bg-transparent focus-visible:ring-[#c2c2c2]/30 data-[state=checked]:border-[#1a73e8] data-[state=checked]:bg-[#1a73e8] data-[state=checked]:text-white",checked:eW,onCheckedChange:()=>{es(t.id),P.current=t.id}})}),(0,a.jsxs)("div",{className:"flex items-center gap-0",children:[(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),em(t.id)},className:"flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-full text-[#c2c2c2] hover:bg-black/4 hover:text-[#5f6368]","aria-label":ez?"Retirer des favoris":"Marquer comme favori",children:(0,a.jsx)(aZ.A,{strokeWidth:1.25*!ez,className:(0,ec.cn)("size-4",ez?"fill-[#f4cc70] stroke-none text-[#f4cc70]":"fill-transparent stroke-[#c2c2c2]")})}),(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),eh(t.id)},className:(0,ec.cn)("flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-full",eL?"text-[#d93025] hover:bg-[#d93025]/10 hover:text-[#b3261e]":"text-[#c2c2c2] hover:bg-black/4 hover:text-[#5f6368]"),"aria-label":eL?"Marqu\xe9 comme spam":e$?"Retirer important":"Marquer important",children:(0,a.jsx)(eO.In,{icon:sV(eL,e$),className:(0,ec.cn)("size-4 shrink-0",eL&&"text-[#d93025]",!eL&&(e$?"text-[#f4cc70]":"text-[#c2c2c2]")),"aria-hidden":!0})}),eZ&&(0,a.jsx)("span",{className:"flex h-7 w-6 shrink-0 items-center justify-center text-[#5f6368]","aria-hidden":!0,children:(0,a.jsx)(et.A,{className:"size-3.5",strokeWidth:2})})]})]}),(0,a.jsxs)("div",{className:(0,ec.cn)("flex w-44 shrink-0 items-center gap-1 pl-2 lg:w-40",eY,eG&&"min-h-7 leading-tight"),"data-selectable-text":!0,children:[eZ?(0,a.jsxs)("span",{className:(0,ec.cn)("min-w-0 truncate text-sm leading-5",eR?"text-gray-700":"font-semibold text-gray-900"),children:["\xc0 : ",t.scheduledToName??t.sender]}):(0,a.jsx)(nd,{displayName:t.sender,email:eP,className:"min-w-0 flex-1 truncate leading-5",children:(0,a.jsxs)("span",{className:(0,ec.cn)("block truncate text-sm leading-5",eR?"text-gray-700":"font-semibold text-gray-900"),children:[e_&&(0,a.jsx)("span",{className:"font-medium text-[#d93025]",children:"Brouillon "}),t.sender]})}),eF>1&&(0,a.jsx)("span",{className:"shrink-0 text-sm leading-5 text-gray-500",children:eF})]}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col justify-start gap-0.5 px-2 pb-0.5","data-selectable-text":!0,children:[(0,a.jsxs)("div",{className:(0,ec.cn)("flex min-w-0 items-center gap-1",eY,eG&&"leading-tight"),children:[t.tag&&(0,a.jsx)("span",{className:"shrink-0 rounded bg-gray-200 px-1.5 py-0.5 text-xs text-gray-600 opacity-[0.92]",children:t.tag}),(0,a.jsx)(t7,{variant:"list",labels:t.labels,labelBgByText:A,emailLabelToSidebarFolderId:z.emailLabelToSidebarFolderId,getNavItemPrefs:z.getNavItemPrefs,labelRows:z.labelRows,onLabelNavigate:ep,currentFolderId:x,folderTree:z.folderTree}),(0,a.jsx)("span",{className:(0,ec.cn)("min-w-0 shrink truncate text-sm leading-5",eR?"font-normal text-[#3c4043]":"font-semibold text-gray-900"),children:t.subject}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm leading-5 text-gray-500",children:t.preview})]}),eK&&(0,a.jsx)(nC,{emailId:t.id,attachments:eV})]}),(0,a.jsx)("div",{className:(0,ec.cn)("flex shrink-0 flex-col items-end gap-1 pr-2 text-right md:max-w-[150px] md:min-w-0",eY,eG&&!eK?"self-center":"self-start"),children:eZ?(0,a.jsxs)("div",{className:"relative flex w-full min-w-0 shrink-0 items-center justify-end",children:[(0,a.jsx)("span",{className:(0,ec.cn)("block max-w-full truncate text-sm font-semibold tabular-nums text-[#c65308]","transition-opacity duration-[50ms] ease-out",e1?"opacity-0":"opacity-100 group-hover:opacity-0"),children:sW(t.scheduledSendAt)}),(0,a.jsxs)("div",{className:(0,ec.cn)("pointer-events-none absolute right-0 top-1/2 z-[1] flex w-max -translate-y-1/2 flex-nowrap items-center gap-0.5 rounded-md py-0.5 pl-1 opacity-0 transition-opacity duration-[50ms] ease-out",sQ(eW,eR),e1?"pointer-events-auto opacity-100":"group-hover:pointer-events-auto group-hover:opacity-100"),children:[!e2&&(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Archiver",onClick:e=>{e.stopPropagation(),ew(t.id)},children:(0,a.jsx)(k.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Archiver"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Supprimer",onClick:e=>{e.stopPropagation(),ey(t.id)},children:(0,a.jsx)(en.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Supprimer"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":eR?"Marquer comme non lu":"Marquer comme lu",onClick:e=>{e.stopPropagation();let s=!eR;J(e=>({...e,[t.id]:s})),ek(t.id,s)},children:eR?(0,a.jsx)(aD.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5}):(0,a.jsx)(aT.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:eR?"Marquer comme non lu":"Marquer comme lu"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Mettre en attente",onClick:e=>{e.stopPropagation(),eN(t.id)},children:(0,a.jsx)(er.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Mettre en attente"})]}),(0,a.jsxs)(a6.AM,{open:$?.id===t.id&&$.panelOpen,onOpenChange:e=>{if(e){let e=D.current.get(t.id);e&&(clearTimeout(e),D.current.delete(t.id)),L({id:t.id,value:sB(t.scheduledSendAt),panelOpen:!0})}else L(e=>e?.id===t.id?{...e,panelOpen:!1}:e),T(t.id)},children:[(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(a6.Wv,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Reprogrammer",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(a3.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Reprogrammer"})]}),(0,a.jsxs)(a6.hl,{className:"w-[min(100vw-2rem,280px)] p-3",align:"end",side:"bottom",sideOffset:6,collisionPadding:12,onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("p",{className:"mb-2 text-xs font-medium text-[#3c4043]",children:"Nouvelle date d'envoi"}),(0,a.jsx)("input",{type:"datetime-local",className:"mb-3 w-full rounded border border-[#dadce0] px-2 py-1.5 text-sm text-[#3c4043]",value:$?.id===t.id?$.value:"",onChange:e=>L(s=>s?.id===t.id?{...s,value:e.target.value,panelOpen:!0}:s)}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(E.$,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{L(e=>e?.id===t.id?{...e,panelOpen:!1}:e),T(t.id)},children:"Annuler"}),(0,a.jsx)(E.$,{type:"button",size:"sm",className:"h-8 text-xs",onClick:()=>{if($?.id!==t.id)return;let e=sU($.value);e&&(eC(t.id,e),L(e=>e?.id===t.id?{...e,panelOpen:!1}:e),T(t.id))},children:"Valider"})]})]})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Modifier le mail",onClick:e=>{e.stopPropagation(),ej(t.id)},children:(0,a.jsx)(I.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Modifier le mail"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Envoyer maintenant",onClick:e=>{e.stopPropagation(),eA(t.id)},children:(0,a.jsx)(et.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Envoyer maintenant"})]})]})]}):(0,a.jsxs)("div",{className:"relative flex w-full min-w-0 shrink-0 items-center justify-end",children:[(0,a.jsxs)("div",{className:(0,ec.cn)("flex min-w-0 max-w-full items-center justify-end gap-1.5 overflow-hidden","transition-opacity duration-[50ms] ease-out","group-hover:opacity-0"),children:[(eH||eU)&&(0,a.jsx)(eO.In,{icon:eH?ar[eH.conferenceProvider]:"mdi:calendar",className:"size-[18px] shrink-0 text-[#5f6368]","aria-label":eH?"Invitation visioconf\xe9rence":"Invitation calendrier"}),i.categoryTabsById.get(t.id)?(0,a.jsx)(nu,{tabs:i.categoryTabsById.get(t.id),onTabClick:eb,iconClassName:"size-[18px] shrink-0"}):null,eQ&&(0,a.jsx)(ex.A,{className:"size-[18px] shrink-0 text-[#5f6368]",strokeWidth:1.75,"aria-label":"Pi\xe8ces jointes"}),(0,a.jsx)("span",{className:(0,ec.cn)("min-w-0 truncate text-sm tabular-nums",eR?"text-gray-600":"font-semibold text-gray-900"),children:(0,a.jsx)(nx,{iso:t.date,variant:"list"})})]}),(0,a.jsxs)("div",{className:(0,ec.cn)("pointer-events-none absolute right-0 top-1/2 z-[1] flex w-max -translate-y-1/2 flex-nowrap items-center gap-0.5 rounded-md py-0.5 pl-1 opacity-0 transition-opacity duration-[50ms] ease-out",sQ(eW,eR),"group-hover:pointer-events-auto group-hover:opacity-100"),children:[!e2&&(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Archiver",onClick:e=>{e.stopPropagation(),Z.hideEmail(t.id),eg(t.id)},children:(0,a.jsx)(k.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Archiver"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Supprimer",onClick:e=>{e.stopPropagation(),Z.hideEmail(t.id),eg(t.id)},children:(0,a.jsx)(en.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Supprimer"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":eR?"Marquer comme non lu":"Marquer comme lu",onClick:e=>{e.stopPropagation();let s=!eR;J(e=>({...e,[t.id]:s}))},children:eR?(0,a.jsx)(aD.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5}):(0,a.jsx)(aT.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:eR?"Marquer comme non lu":"Marquer comme lu"})]}),e2&&(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"D\xe9placer vers la bo\xeete de r\xe9ception",onClick:e=>{e.stopPropagation(),Z.markNotSpam(t.id),X?.("inbox"),eg(t.id)},children:(0,a.jsx)(ee.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Bo\xeete de r\xe9ception"})]}),!e2&&(e3?(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":t.id.startsWith("snz-")?"D\xe9placer vers la bo\xeete de r\xe9ception":"Remettre dans les mails planifi\xe9s",onClick:e=>{e.stopPropagation(),ev(t)},children:(0,a.jsx)(ee.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:t.id.startsWith("snz-")?"Bo\xeete de r\xe9ception":"Planifi\xe9s"})]}):(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-[#444746] hover:bg-[#f1f3f4]","aria-label":"Mettre en attente",onClick:e=>{e.stopPropagation(),eM(t),t.labels?.includes("snoozed")||(Z.hideEmail(t.id),eg(t.id))},children:(0,a.jsx)(er.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:"text-xs",children:"Mettre en attente"})]}))]})]})})]})]})})}),(0,a.jsx)(e7.Ip,{onCloseAutoFocus:e=>e.preventDefault(),onPointerDownOutside:e=>{let t=e.detail.originalEvent;"mouse"===t.pointerType&&2===t.button&&Date.now()-_.current<450&&e.preventDefault()},className:(0,ec.cn)((0,ec.cn)(eo.nr,"overflow-visible"),"[&_[data-slot=context-menu-item]]:gap-3 [&_[data-slot=context-menu-item]]:rounded-none [&_[data-slot=context-menu-item]]:px-3 [&_[data-slot=context-menu-item]]:py-2 [&_[data-slot=context-menu-item]]:text-sm","[&_[data-slot=context-menu-item]:focus]:bg-[#f1f3f4] [&_[data-slot=context-menu-item]:focus]:text-[#3c4043]","[&_[data-slot=context-menu-sub-trigger]]:gap-3 [&_[data-slot=context-menu-sub-trigger]]:rounded-none [&_[data-slot=context-menu-sub-trigger]]:px-3 [&_[data-slot=context-menu-sub-trigger]]:py-2 [&_[data-slot=context-menu-sub-trigger]]:text-sm","[&_[data-slot=context-menu-sub-trigger]:focus]:bg-[#f1f3f4] [&_[data-slot=context-menu-sub-trigger]:focus]:text-[#3c4043]","[&_[data-slot=context-menu-separator]]:mx-0 [&_[data-slot=context-menu-separator]]:my-1 [&_[data-slot=context-menu-separator]]:h-px [&_[data-slot=context-menu-separator]]:bg-[#eceff1]","[&_[data-slot=context-menu-sub-content]]:min-w-[200px] [&_[data-slot=context-menu-sub-content]]:rounded-lg [&_[data-slot=context-menu-sub-content]]:border [&_[data-slot=context-menu-sub-content]]:border-border [&_[data-slot=context-menu-sub-content]]:bg-popover [&_[data-slot=context-menu-sub-content]]:shadow-lg"),children:eX?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(e7.kt,{onSelect:()=>{Promise.all([...R.current].map(e=>ew(e)))},children:[(0,a.jsx)(k.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Archiver"]}),(0,a.jsxs)(e7.kt,{onSelect:()=>{Promise.all([...R.current].map(e=>ey(e)))},children:[(0,a.jsx)(en.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Supprimer"]}),(0,a.jsxs)(e7.kt,{onSelect:()=>{let e=[...R.current];J(t=>{let s={...t};for(let t of e)s[t]=e0;return s}),Promise.all(e.map(e=>ek(e,e0)))},children:[e0?(0,a.jsx)(aD.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}):(0,a.jsx)(aT.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),e0?"Marquer comme lu":"Marquer comme non lu"]}),(0,a.jsxs)(e7.kt,{onSelect:()=>{Promise.all([...R.current].map(e=>eN(e)))},children:[(0,a.jsx)(er.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Mettre en attente"]}),(0,a.jsx)(e7.K5,{}),(0,a.jsxs)(e7.Fj,{onOpenChange:e=>{if(!e)return;let t=R.current,a=s.find(e=>e.id===t[0]);Y(sB(a?.scheduledSendAt))},children:[(0,a.jsxs)(e7.Pd,{className:"[&>svg:last-child]:text-[#5f6368]",children:[(0,a.jsx)(a3.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Reprogrammer"]}),(0,a.jsx)(e7.es,{className:(0,ec.cn)("min-w-[288px] rounded-lg border border-border bg-popover px-4 py-3.5 text-[#3c4043] shadow-lg"),children:(0,a.jsxs)("div",{className:"flex flex-col gap-3.5",onPointerDown:e=>e.stopPropagation(),children:[(0,a.jsxs)("p",{className:"text-xs font-medium leading-snug text-[#3c4043]",children:["Nouvelle date d'envoi",eJ.length>1?` (${eJ.length} messages)`:null]}),(0,a.jsx)("input",{type:"datetime-local",className:"w-full rounded border border-[#dadce0] px-2.5 py-1.5 text-sm text-[#3c4043]",value:G,onChange:e=>Y(e.target.value),onPointerDown:e=>e.stopPropagation()}),(0,a.jsx)("button",{type:"button",className:"rounded bg-[#0b57d0] px-3 py-1.5 text-xs font-medium text-white hover:bg-[#0842a0]",onPointerDown:e=>{e.stopPropagation(),e.preventDefault()},onClick:e=>{e.stopPropagation();let t=sU(G);t&&Promise.all([...R.current].map(e=>eC(e,t)))},children:"Valider"})]})})]}),(0,a.jsxs)(e7.kt,{disabled:eJ.length>1,onSelect:()=>{1===eJ.length&&ej(eJ[0])},children:[(0,a.jsx)(I.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Modifier le mail"]}),(0,a.jsxs)(e7.kt,{onSelect:()=>{Promise.all([...R.current].map(e=>eA(e)))},children:[(0,a.jsx)(et.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Envoyer maintenant"]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(e7.kt,{children:[(0,a.jsx)(C.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"R\xe9pondre"]}),(0,a.jsxs)(e7.kt,{children:[(0,a.jsx)(a5.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"R\xe9pondre \xe0 tous"]}),(0,a.jsxs)(e7.kt,{children:[(0,a.jsx)(a4.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Transf\xe9rer"]}),(0,a.jsxs)(e7.kt,{children:[(0,a.jsx)(ex.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Transf\xe9rer en tant que pi\xe8ce jointe"]}),(0,a.jsx)(e7.K5,{}),(0,a.jsxs)(e7.kt,{children:[(0,a.jsx)(k.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Archiver"]}),(0,a.jsxs)(e7.kt,{children:[(0,a.jsx)(en.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Supprimer"]}),(0,a.jsxs)(e7.kt,{onSelect:()=>{let e=!eR,t=R.current;J(s=>{let a={...s};for(let s of t)a[s]=e;return a})},children:[eR?(0,a.jsx)(aT.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}):(0,a.jsx)(aD.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),eR?"Marquer comme non lu":"Marquer comme lu"]}),(0,a.jsxs)(e7.kt,{children:[(0,a.jsx)(er.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Mettre en attente"]}),(0,a.jsxs)(e7.kt,{children:[(0,a.jsx)(aO.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Ajouter \xe0 Tasks"]}),(0,a.jsx)(e7.K5,{}),(0,a.jsxs)(e7.Fj,{children:[(0,a.jsxs)(e7.Pd,{className:"[&>svg:last-child]:text-[#5f6368]",children:[(0,a.jsx)(N.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"D\xe9placer vers"]}),(0,a.jsx)(e7.es,{className:(0,ec.cn)((0,ec.cn)(eo.hz,"max-h-80 overflow-y-auto"),"[&_[data-slot=context-menu-item]]:gap-3 [&_[data-slot=context-menu-item]]:rounded-none [&_[data-slot=context-menu-item]]:px-3 [&_[data-slot=context-menu-item]]:py-2 [&_[data-slot=context-menu-item]]:text-sm","[&_[data-slot=context-menu-item]:focus]:bg-[#f1f3f4]"),children:(0,a.jsx)(aQ,{targets:K,onMoveTo:e=>{Q(eJ,e),"inbox"!==e&&F(e=>e.filter(e=>!eJ.includes(e)))}})})]}),(0,a.jsxs)(e7.Fj,{children:[(0,a.jsxs)(e7.Pd,{className:"[&>svg:last-child]:text-[#5f6368]",children:[(0,a.jsx)(aI.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Ajouter le libell\xe9"]}),(0,a.jsx)(e7.es,{className:(0,ec.cn)("z-[100] flex max-h-72 min-w-[260px] flex-col overflow-hidden rounded-lg border border-border bg-popover p-0 py-0 text-[#3c4043] shadow-lg","[&_[data-slot=context-menu-item]]:gap-3 [&_[data-slot=context-menu-item]]:rounded-none [&_[data-slot=context-menu-item]]:px-3 [&_[data-slot=context-menu-item]]:py-2 [&_[data-slot=context-menu-item]]:text-sm","[&_[data-slot=context-menu-item]:focus]:bg-[#f1f3f4]"),children:(0,a.jsx)(aE.U,{query:q,onQueryChange:O,catalogLabels:W,resolveLabelVisual:B,Item:e7.kt,getLabelPresence:e=>U(eJ,e),onToggleCatalogLabel:e=>H(eJ,e),onCreateLabel:e=>{V(eJ,e),O("")}})})]}),(0,a.jsxs)(e7.kt,{children:[(0,a.jsx)(aF.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Ignorer la conversation"]}),(0,a.jsx)(e7.K5,{}),(0,a.jsxs)(e7.kt,{title:`Recherche : ${eq}`,children:[(0,a.jsx)(M.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),(0,a.jsxs)("span",{className:"min-w-0 truncate",children:["Rech. e-mails de ",eq]})]}),(0,a.jsx)(e7.K5,{}),(0,a.jsxs)(e7.kt,{children:[(0,a.jsx)(aq.A,{strokeWidth:1.5,className:"size-[18px] text-[#5f6368]"}),"Ouvrir dans une nouvelle fen\xeatre"]})]})})]},t.id)});function nA({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"empty",className:(0,ec.cn)("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12",e),...t})}function nM({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"empty-header",className:(0,ec.cn)("flex max-w-sm flex-col items-center gap-2 text-center",e),...t})}let nI=(0,s(57542).F)("flex shrink-0 items-center justify-center mb-2 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6"}},defaultVariants:{variant:"default"}});function nE({className:e,variant:t="default",...s}){return(0,a.jsx)("div",{"data-slot":"empty-icon","data-variant":t,className:(0,ec.cn)(nI({variant:t,className:e})),...s})}function nz({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"empty-title",className:(0,ec.cn)("text-lg font-medium tracking-tight",e),...t})}function n$({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"empty-description",className:(0,ec.cn)("text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4",e),...t})}function nL({variant:e,selectedFolder:t="inbox",inboxCategoryTabLabel:s="",folderIdToLabel:n={},searchParams:r=null}){return"scheduled"===e?(0,a.jsx)("div",{className:"flex min-h-[220px] flex-col items-center justify-center px-4 py-12 text-center",children:(0,a.jsx)("p",{className:"text-sm text-[#5f6368]",children:"Aucun message planifi\xe9."})}):"search"===e&&r?(0,a.jsx)(nA,{className:"min-h-[240px] flex-1 border-0 bg-mail-surface py-10 shadow-none",children:(0,a.jsxs)(nM,{className:"max-w-md",children:[(0,a.jsx)(nE,{variant:"icon",className:"mb-1 border-0 bg-[#f1f3f4] text-[#5f6368] [&_svg]:size-6",children:(0,a.jsx)(M.A,{className:"size-6",strokeWidth:1.5,"aria-hidden":!0})}),(0,a.jsx)(nz,{className:"text-[15px] font-medium text-[#3c4043]",children:"Aucun r\xe9sultat"}),(0,a.jsxs)(n$,{className:"text-[13px] text-[#5f6368]",children:["Pas de r\xe9sultats pour"," ",(0,a.jsx)("span",{className:"font-medium text-[#3c4043]",children:r.q||r.hasWords||r.from||r.subject||"votre recherche"}),r.has.length>0||r.within||r.from||r.to||r.subject?(0,a.jsx)(a.Fragment,{children:" avec les filtres choisis"}):null,"."]})]})}):"split-pane"===e?(0,a.jsx)(nA,{className:"min-h-[240px] flex-1 border-0 bg-mail-surface py-10 shadow-none",children:(0,a.jsxs)(nM,{className:"max-w-md",children:[(0,a.jsx)(nE,{variant:"icon",className:"mb-1 border-0 bg-[#f1f3f4] text-[#5f6368] [&_svg]:size-6",children:(0,a.jsx)(aD.A,{className:"size-6",strokeWidth:1.5,"aria-hidden":!0})}),(0,a.jsx)(nz,{className:"text-[15px] font-medium text-[#3c4043]",children:"Aucun message s\xe9lectionn\xe9"}),(0,a.jsx)(n$,{className:"text-[13px] text-[#5f6368]",children:"Choisissez un message dans la liste ou ouvrez une bo\xeete contenant des messages."})]})}):(0,a.jsx)(nA,{className:"min-h-[240px] flex-1 border-0 bg-mail-surface py-10 shadow-none",children:(0,a.jsxs)(nM,{className:"max-w-md",children:[(0,a.jsx)(nE,{variant:"icon",className:"mb-1 border-0 bg-[#f1f3f4] text-[#5f6368] [&_svg]:size-6",children:(0,a.jsx)(aD.A,{className:"size-6",strokeWidth:1.5,"aria-hidden":!0})}),(0,a.jsx)(nz,{className:"text-[15px] font-medium text-[#3c4043]",children:"Aucun message"}),(0,a.jsx)(n$,{className:"text-[13px] text-[#5f6368]",children:"inbox"===t?(0,a.jsxs)(a.Fragment,{children:["Aucun message dans l'onglet"," ",(0,a.jsx)("span",{className:"font-medium text-[#3c4043]",children:s})," ","de la bo\xeete de r\xe9ception."]}):(0,a.jsxs)(a.Fragment,{children:["Aucun message dans"," ",(0,a.jsx)("span",{className:"font-medium text-[#3c4043]",children:(0,tS.vF)(t,n)}),"."]})})]})})}function nD(){return(0,a.jsxs)("div",{className:"flex shrink-0 items-start gap-3 border-b border-[#eceff1] bg-[#f8f9fa] px-4 py-3",children:[(0,a.jsx)(er.A,{className:"h-5 w-5 shrink-0 text-[#5f6368]",strokeWidth:1.5,"aria-hidden":!0}),(0,a.jsx)("p",{className:"text-sm leading-snug text-[#3c4043]",children:"Les messages de la liste \xab\xa0Envois programm\xe9s\xa0\xbb seront envoy\xe9s \xe0 l'heure pr\xe9vue pour chacun d'eux."})]})}var nT=s(86227);function n_(e){return e.trim().toLowerCase().replace(/^<|>$/g,"")}function nR(e){let t=e.trim(),s=t.match(/^(.*?)\s*<([^>]+)>$/);return s?{name:s[1]?.trim()??"",email:s[2]?.trim()??""}:t.includes("@")&&!t.includes(" ")?{name:"",email:t.replace(/^<|>$/g,"")}:{name:t,email:""}}function nP(e,t){let s=e?.[0],a=s?.name?.trim()??"",n=s?.address?.trim()??"";if(!n&&a){let e=nR(a);a=e.name,n=e.email}if(!a&&n){let e=nR(n);e.email&&(n=e.email,a=e.name)}n=n.replace(/^<|>$/g,"");let r=new Set(t?.selfEmails?[...t.selfEmails].map(n_).filter(Boolean):[]);return n&&r.has(n_(n))&&t?.selfDisplayName?a=t.selfDisplayName:n&&!a&&(a=(n.split("@")[0]??n).replace(/[._-]/g," ").replace(/\b\w/g,e=>e.toUpperCase())),{name:(0,eS.ms)(a||n),email:n}}function nF(e){let t=e.name?.trim();if(t)return(0,eS.ms)(t);let s=e.address?.trim().replace(/^<|>$/g,"");if(!s)return"";let a=s.split("@")[0]??s;return(0,eS.ms)(a.replace(/[._-]/g," ").replace(/\b\w/g,e=>e.toUpperCase()))}function nO(e){return new Set([...e].map(n_).filter(Boolean))}function nq(e,t,s){let a=nO(s),n=new Set,r=[];for(let s of[...e??[],...t??[]]){if(!s.address)continue;let e=n_(s.address);!a.has(e)||n.has(e)||(n.add(e),r.push(s))}return r}function nW(e){let t=e.address?.trim().replace(/^<|>$/g,"");return t?`moi <${t}>`:"moi"}function nB(e){let{name:t,email:s}=nP([e]);return t&&s?`${t} <${s}>`:s||t}function nU(){let{data:e}=(0,se.HM)(),t=(0,nT.nc)(e=>e.user?.email),s=(0,L.zm)(e=>e.identities);return(0,n.useMemo)(()=>(function(e,t,s){let a=new Set;for(let t of e??[])t.email&&a.add(n_(t.email));for(let e of t??[])e.email&&a.add(n_(e.email));return s&&a.add(n_(s)),[...a]})(e,s.map(e=>({email:e.email})),t),[e,s,t])}var nH=s(6146);let nV=/unsubscribe|désabonner|desabonner|préférences|preferences/i,nK=/unsub/i;function nQ(e){let t=e.trim();return!!t&&(nK.test(t)||nV.test(t))}function nG(e){let t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1).trim():t}function nY(e){let t=nG(e);if(!/^mailto:/i.test(t))return null;try{let e=new URL(t),s=decodeURIComponent(e.pathname.replace(/^\/+/,"")),a=s.includes("@")?s:decodeURIComponent(t.replace(/^mailto:/i,"").split("?")[0]??"");if(!a.includes("@"))return null;return{address:a,subject:e.searchParams.get("subject")??void 0,body:e.searchParams.get("body")??void 0}}catch{let e=t.replace(/^mailto:/i,"").split("?")[0]?.trim();if(!e?.includes("@"))return null;return{address:e}}}function nZ(e){let t,s=/https?:\/\/[^\s)]+/gi;for(;null!==(t=s.exec(e));){let s=t[0],a=Math.max(0,(t.index??0)-40),n=e.slice(a,(t.index??0)+s.length+40);if(nK.test(s)||nV.test(n))return s}return null}function nJ(e,t){let s,a=nP(e.from,{selfEmails:t.selfEmails,selfDisplayName:t.selfDisplayName}),n=!function(e,t){let{email:s}=nP(e);if(!s)return!1;let a=n_(s);for(let e of t)if(a===n_(e))return!0;return!1}(e.from,t.selfEmails)?a.name&&a.email?`${a.name} <${a.email}>`:a.email||a.name:a.email?`moi <${a.email}>`:"moi",r=e.auth_info??{},l=function(e,t,s){if(s?.trim()){let{mailto:e,http:t}=function(e){let t=null,s=null;for(let a of function(e){let t=[],s="",a=0;for(let n of e)"<"===n?a++:">"===n&&(a=Math.max(0,a-1)),","===n&&0===a?(s.trim()&&t.push(s.trim()),s=""):s+=n;return s.trim()&&t.push(s.trim()),t}(e)){let e=nG(a),n=nY(e);if(n&&!t){t=n;continue}/^https?:\/\//i.test(e)&&!s&&(s=e)}return{mailto:t,http:s}}(s);if(e)return{kind:"mailto",mailto:e};if(t)return{kind:"http",url:t}}let a=e?.trim()??"",n=t?.trim()??"",r=function(e){let t,s=/<a\b[^>]*href=["']([^"']+)["'][^>]*>([\s\S]*?)<\/a>/gi;for(;null!==(t=s.exec(e));){let e=t[1]??"",s=t[2]??"",a=nY(e);if(a&&(nV.test(s)||nQ(e)))return a}return null}(a);if(r)return{kind:"mailto",mailto:r};let l=function(e){let t,s=/<a\b[^>]*href=["']([^"']+)["'][^>]*>([\s\S]*?)<\/a>/gi;for(;null!==(t=s.exec(e));){let e=t[1]??"",s=t[2]??"";if(/^https?:\/\//i.test(e)&&(nQ(e)||nV.test(s)))return e}return null}(a);return l?{kind:"http",url:l}:nZ(n)?{kind:"http",url:nZ(n)}:null}(e.body_html,e.body_text,r.list_unsubscribe);return e.reply_to?.length&&(s=e.reply_to.map(nB).join(", ")),{recipientSummary:function(e,t,s){let a,n=(a=nO(s),[...e??[],...t??[]].filter(e=>e.address&&!a.has(n_(e.address)))),r=nq(e,t,s);if(0===n.length)return 1===r.length?`\xe0 ${nW(r[0])}`:r.length>1?`\xe0 ${r.map(nW).join(", ")}`:"\xe0 moi";if(1===n.length){let e=nF(n[0]);return e?`\xe0 ${e}`:"\xe0 moi"}if(n.length<=3)return`\xe0 ${n.map(e=>nF(e)).join(", ")}`;let l=n.slice(0,3).map(e=>nF(e)).join(", "),i=n.length-3;return`\xe0 ${l} + ${i} autre${i>1?"s":""}`}(e.to,e.cc,t.selfEmails),fromLine:n,replyToLine:s,toLine:function(e,t,s){let a=new Set([...s].map(n_).filter(Boolean)),n=[];for(let t of e??[])t.address&&(a.has(n_(t.address))?n.push(nW(t)):n.push(nB(t)));for(let e of t??[]){if(!e.address)continue;let t=nB(e);n.push(n.length?`Cc: ${t}`:t)}if(n.length>0)return n.join(", ");let r=nq(e,t,s);return r[0]?nW(r[0]):"moi"}(e.to,e.cc,t.selfEmails),dateIso:e.date,subject:t.subject??e.subject??"",mailedBy:r.mailed_by,signedBy:r.signed_by,dkimPass:r.dkim_pass,tls:!!r.tls,unsubscribe:l??void 0}}function nX(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var n0=s(61955),n1=s(46e3),n2=s(71869);function n3({label:e,contacts:t,onChange:s,placeholder:r,onActivate:l,autoFocus:i,onAutoFocusDone:o}){let[c,d]=(0,n.useState)(""),[u,m]=(0,n.useState)(!1),[h,x]=(0,n.useState)(0),f=(0,n.useRef)(null),p=(0,n.useRef)(null),b=(0,n.useMemo)(()=>{if(!c.trim())return[];let e=c.toLowerCase();return _.filter(s=>!t.some(e=>e.email===s.email)&&(s.name.toLowerCase().includes(e)||s.email.toLowerCase().includes(e))).slice(0,6)},[c,t]);(0,n.useEffect)(()=>{x(0)},[b.length]),(0,n.useEffect)(()=>{if(!i)return;let e=window.requestAnimationFrame(()=>{f.current?.focus(),o?.()});return()=>window.cancelAnimationFrame(e)},[i,o]);let g=(0,n.useCallback)(e=>{t.some(t=>t.email===e.email)||s([...t,e]),d(""),m(!1)},[t,s]),v=(0,n.useCallback)(e=>{let t=e.trim().replace(/,$/,"");if(!t)return;let s=_.find(e=>e.email.toLowerCase()===t.toLowerCase());s?g(s):n2.Xw.test(t)&&g({name:t,email:t})},[g]),j=(0,n.useCallback)(e=>{s(t.filter(t=>t.email!==e))},[t,s]),w=e=>{let t=e.split(" ").filter(Boolean);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():(t[0]?.[0]??"").toUpperCase()},y=["bg-blue-600","bg-purple-600","bg-emerald-600","bg-amber-600","bg-rose-600","bg-teal-600","bg-indigo-600"],k=e=>{let t=0;for(let s=0;s<e.length;s++)t=e.charCodeAt(s)+((t<<5)-t);return y[Math.abs(t)%y.length]};return(0,a.jsxs)("div",{className:"relative",ref:p,children:[(0,a.jsxs)("div",{className:"flex min-h-[32px] cursor-text flex-wrap items-center gap-1 px-3 py-1",onClick:()=>{f.current?.focus(),l?.()},children:[(0,a.jsx)("span",{className:"shrink-0 select-none text-sm text-muted-foreground",children:e}),t.map(e=>(0,a.jsxs)("span",{className:eo.hf,children:[(0,a.jsx)("span",{className:(0,ec.cn)("flex h-6 w-6 items-center justify-center rounded-full text-[10px] font-bold text-white",k(e.email)),children:w(e.name)}),(0,a.jsx)("span",{className:"max-w-[150px] truncate text-sm",children:e.name===e.email?e.email:e.name}),(0,a.jsx)("button",{type:"button",onClick:()=>j(e.email),className:"ml-0.5 flex h-4 w-4 items-center justify-center rounded-full hover:bg-black/10",children:(0,a.jsx)(S.A,{className:"h-3 w-3"})})]},e.email)),(0,a.jsx)("input",{ref:f,type:"text",value:c,onChange:e=>{d(e.target.value),m(!0)},onKeyDown:e=>{if(("Enter"===e.key||"Tab"===e.key||","===e.key||" "===e.key)&&c.trim()){e.preventDefault(),u&&b.length>0?g(b[h]):v(c);return}"Backspace"===e.key&&!c&&t.length>0?s(t.slice(0,-1)):(u&&b.length>0&&("ArrowDown"===e.key?(e.preventDefault(),x(e=>e<b.length-1?e+1:0)):"ArrowUp"===e.key&&(e.preventDefault(),x(e=>e>0?e-1:b.length-1))),"Escape"===e.key&&m(!1))},onFocus:()=>{m(!0),l?.()},onBlur:()=>{setTimeout(()=>{m(!1),c.trim()&&v(c)},200)},placeholder:0===t.length?r:void 0,className:"min-w-[120px] flex-1 border-none bg-transparent py-1 text-sm text-foreground outline-none placeholder:text-muted-foreground"})]}),u&&b.length>0&&(0,a.jsx)("div",{className:"absolute left-0 right-0 top-full z-50 mt-1 max-h-[240px] overflow-y-auto rounded-lg border border-border bg-popover py-1 text-popover-foreground shadow-lg",children:b.map((e,t)=>(0,a.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),g(e)},className:(0,ec.cn)("flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors",t===h?eo.I8:eo.th),children:[(0,a.jsx)("span",{className:(0,ec.cn)("flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-xs font-bold text-white",k(e.email)),children:w(e.name)}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"truncate font-medium text-foreground",children:e.name}),(0,a.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:e.email})]})]},e.email))})]})}function n5({compose:e,isInline:t,showFromField:s,identities:n=[],updateCompose:r,handleIdentityChange:l,clearFocusToMount:i,subjectInputRef:o,onRecipientsActivate:c}){let d=!t&&!e.threadEmailId&&!e.threadKind,u=!t&&"forward"===e.threadKind;return(0,a.jsxs)(a.Fragment,{children:[s&&(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden px-3 py-1.5",children:[(0,a.jsx)("span",{className:"shrink-0 text-sm text-muted-foreground",children:"De"}),(0,a.jsxs)(z.rI,{modal:!1,children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",className:"flex min-w-0 items-center gap-1 rounded px-1 py-0.5 text-sm text-foreground hover:bg-accent",children:[(0,a.jsx)("span",{className:"min-w-0 truncate font-medium",children:e.from.name}),(0,a.jsxs)("span",{className:"min-w-0 shrink truncate text-muted-foreground",children:["<",e.from.email,">"]}),(0,a.jsx)(eV.A,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]})}),(0,a.jsx)(z.SQ,{align:"start",className:(0,ec.cn)("min-w-[300px]",n2.jk),children:0===n.length?(0,a.jsx)(z._2,{disabled:!0,children:(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:"Aucune identit\xe9 d'envoi — ajoutez un compte mail dans les r\xe9glages."})}):n.map(e=>(0,a.jsx)(z._2,{onSelect:()=>l(e),children:(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-medium",children:e.name}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:e.email})]})},e.id??e.email))})]})]}),s&&!t&&(0,a.jsx)("div",{className:eo.LQ}),(0,a.jsxs)("div",{className:"relative flex items-start",children:[(0,a.jsx)("div",{className:"min-w-0 flex-1",children:(0,a.jsx)(n3,{label:s||e.to.length>0?"\xc0":"Destinataires",contacts:e.to,onChange:t=>r(e.id,{to:t}),onActivate:c,autoFocus:!!e.focusToOnMount,onAutoFocusDone:i})}),s&&(!e.showCc||!e.showBcc)&&(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1 px-2 py-1.5",children:[!e.showCc&&(0,a.jsx)("button",{type:"button",tabIndex:d?-1:void 0,onClick:()=>r(e.id,{showCc:!0}),className:"text-sm text-muted-foreground hover:text-foreground hover:underline",children:"Cc"}),!e.showBcc&&(0,a.jsx)("button",{type:"button",tabIndex:d?-1:void 0,onClick:()=>r(e.id,{showBcc:!0}),className:"text-sm text-muted-foreground hover:text-foreground hover:underline",children:"Cci"})]})]}),!t&&(0,a.jsx)("div",{className:eo.LQ}),e.showCc&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n3,{label:"Cc",contacts:e.cc,onChange:t=>r(e.id,{cc:t})}),!t&&(0,a.jsx)("div",{className:eo.LQ})]}),e.showBcc&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n3,{label:"Cci",contacts:e.bcc,onChange:t=>r(e.id,{bcc:t})}),!t&&(0,a.jsx)("div",{className:eo.LQ})]}),!t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("input",{ref:o,type:"text",value:e.subject,onChange:t=>r(e.id,{subject:t.target.value}),placeholder:"Objet",tabIndex:u?-1:void 0,className:"h-8 w-full border-none bg-transparent px-3 text-sm text-foreground outline-none placeholder:text-muted-foreground"}),(0,a.jsx)("div",{className:eo.LQ})]})]})}var n4=s(10883),n6=s(96529),n8=s(25142),n7=s(35577),n9=s(3643),re=s(77877),rt=s(50117),rs=s(76241),ra=s(97953),rn=s(71435),rr=s(79624),rl=s(32102),ri=s(6959),ro=s(77123),rc=s(1768),rd=s(18476),ru=s(51264);let rm=[{label:"Sans Serif",value:"sans-serif"},{label:"Serif",value:"serif"},{label:"Monospace",value:"monospace"},{label:"Cursive",value:"cursive"},{label:"Comic Sans MS",value:"Comic Sans MS, cursive"},{label:"Garamond",value:"Garamond, serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Impact",value:"Impact, sans-serif"},{label:"Tahoma",value:"Tahoma, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Verdana",value:"Verdana, sans-serif"}],rh=[{label:"Tr\xe8s petit",value:"10px"},{label:"Petit",value:"13px"},{label:"Normal",value:""},{label:"Grand",value:"18px"},{label:"Tr\xe8s grand",value:"24px"},{label:"\xc9norme",value:"32px"}],rx=["#000000","#434343","#666666","#999999","#cccccc","#efefef","#f3f3f3","#ffffff","#fb4934","#fe8019","#fabd2f","#b8bb26","#8ec07c","#83a598","#d3869b","#ebdbb2","#cc241d","#d65d0e","#d79921","#98971a","#689d6a","#458588","#b16286","#a89984","#9d0006","#af3a03","#b57614","#79740e","#427b58","#076678","#8f3f71","#7c6f64"];function rf({editor:e,btnClass:t,activeClass:s}){let n=e.isActive({textAlign:"center"})?rr.A:e.isActive({textAlign:"right"})?rl.A:e.isActive({textAlign:"justify"})?ri.A:ro.A;return(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",className:(0,ec.cn)(t,"w-auto gap-0.5 px-1"),title:"Alignement",children:[(0,a.jsx)(n,{className:"h-4 w-4"}),(0,a.jsx)(eV.A,{className:"h-3 w-3"})]})}),(0,a.jsxs)(z.SQ,{align:"start",className:(0,ec.cn)("min-w-[160px]",n2.jk),children:[(0,a.jsxs)(z._2,{onSelect:()=>e.chain().focus().setTextAlign("left").run(),className:(0,ec.cn)(e.isActive({textAlign:"left"})&&eo.E1),children:[(0,a.jsx)(ro.A,{className:"h-4 w-4"})," Aligner \xe0 gauche"]}),(0,a.jsxs)(z._2,{onSelect:()=>e.chain().focus().setTextAlign("center").run(),className:(0,ec.cn)(e.isActive({textAlign:"center"})&&eo.E1),children:[(0,a.jsx)(rr.A,{className:"h-4 w-4"})," Centrer"]}),(0,a.jsxs)(z._2,{onSelect:()=>e.chain().focus().setTextAlign("right").run(),className:(0,ec.cn)(e.isActive({textAlign:"right"})&&eo.E1),children:[(0,a.jsx)(rl.A,{className:"h-4 w-4"})," Aligner \xe0 droite"]}),(0,a.jsxs)(z._2,{onSelect:()=>e.chain().focus().setTextAlign("justify").run(),className:(0,ec.cn)(e.isActive({textAlign:"justify"})&&eo.h6),children:[(0,a.jsx)(ri.A,{className:"h-4 w-4"})," Justifier"]})]})]})}function rp({editor:e,btnClass:t}){return(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",className:(0,ec.cn)(t,"w-auto gap-0.5 px-1"),title:"Police",children:[(0,a.jsx)(rc.A,{className:"h-4 w-4"}),(0,a.jsx)(eV.A,{className:"h-3 w-3"})]})}),(0,a.jsx)(z.SQ,{align:"start",className:(0,ec.cn)("max-h-[280px] min-w-[180px] overflow-y-auto",n2.jk),children:rm.map(t=>(0,a.jsx)(z._2,{onSelect:()=>e.chain().focus().setMark("textStyle",{fontFamily:t.value}).run(),style:{fontFamily:t.value},className:(0,ec.cn)(e.isActive("textStyle",{fontFamily:t.value})&&eo.h6),children:t.label},t.value))})]})}function rb({editor:e,btnClass:t}){return(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",className:(0,ec.cn)(t,"w-auto gap-0.5 px-1"),title:"Taille du texte",children:[(0,a.jsx)(rd.A,{className:"h-4 w-4"}),(0,a.jsx)(eV.A,{className:"h-3 w-3"})]})}),(0,a.jsx)(z.SQ,{align:"start",className:(0,ec.cn)("min-w-[140px]",n2.jk),children:rh.map(t=>(0,a.jsx)(z._2,{onSelect:()=>{t.value?e.chain().focus().setMark("textStyle",{fontSize:t.value}).run():e.chain().focus().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()},style:t.value?{fontSize:t.value}:void 0,className:(0,ec.cn)(t.value&&e.isActive("textStyle",{fontSize:t.value})&&eo.h6),children:t.label},t.label))})]})}function rg({editor:e,btnClass:t}){let[s,r]=(0,n.useState)("text");return(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",className:(0,ec.cn)(t,"w-auto gap-0.5 px-1"),title:"Couleur du texte",children:[(0,a.jsx)(ru.A,{className:"h-4 w-4"}),(0,a.jsx)(eV.A,{className:"h-3 w-3"})]})}),(0,a.jsxs)(z.SQ,{align:"start",className:(0,ec.cn)("w-[268px] p-2",n2.jk),onCloseAutoFocus:e=>e.preventDefault(),children:[(0,a.jsxs)("div",{className:"mb-2 flex gap-1 border-b border-border pb-2",children:[(0,a.jsx)("button",{type:"button",className:(0,ec.cn)("flex-1 rounded px-2 py-1 text-xs font-medium transition-colors","text"===s?eo.h6:"text-[#5f6368] hover:bg-[#f1f3f4]"),onClick:()=>r("text"),children:"Couleur du texte"}),(0,a.jsx)("button",{type:"button",className:(0,ec.cn)("flex-1 rounded px-2 py-1 text-xs font-medium transition-colors","bg"===s?eo.h6:"text-[#5f6368] hover:bg-[#f1f3f4]"),onClick:()=>r("bg"),children:"Couleur de fond"})]}),(0,a.jsx)("div",{className:"grid grid-cols-8 gap-1",children:rx.map(t=>(0,a.jsx)("button",{type:"button",className:"h-6 w-6 rounded border border-border hover:scale-110 transition-transform",style:{backgroundColor:t},title:t,onClick:()=>{"text"===s?e.chain().focus().setColor(t).run():e.chain().focus().setMark("textStyle",{backgroundColor:t}).run()}},`${s}-${t}`))}),(0,a.jsx)("button",{type:"button",className:"mt-2 w-full rounded px-2 py-1 text-xs text-muted-foreground hover:bg-accent transition-colors",onClick:()=>{"text"===s?e.chain().focus().unsetColor().run():e.chain().focus().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()},children:"R\xe9initialiser"})]})]})}function rv({editor:e}){if(!e)return null;let t=eo.QU,s=eo.h6,n=(0,a.jsx)("span",{className:eo.i1,"aria-hidden":!0});return(0,a.jsxs)("div",{className:"compose-toolbar flex flex-wrap items-center border-t border-border bg-muted px-1 py-1",children:[(0,a.jsx)("button",{type:"button",className:t,onClick:()=>e.chain().focus().undo().run(),disabled:!e.can().undo(),title:"Annuler",children:(0,a.jsx)(n4.A,{className:"h-4 w-4"})}),(0,a.jsx)("button",{type:"button",className:t,onClick:()=>e.chain().focus().redo().run(),disabled:!e.can().redo(),title:"R\xe9tablir",children:(0,a.jsx)(n6.A,{className:"h-4 w-4"})}),n,(0,a.jsx)(rp,{editor:e,btnClass:t}),n,(0,a.jsx)(rb,{editor:e,btnClass:t}),n,(0,a.jsx)("button",{type:"button",className:(0,ec.cn)(t,e.isActive("bold")&&s),onClick:()=>e.chain().focus().toggleMark("bold").run(),title:"Gras",children:(0,a.jsx)(n8.A,{className:"h-4 w-4"})}),(0,a.jsx)("button",{type:"button",className:(0,ec.cn)(t,e.isActive("italic")&&s),onClick:()=>e.chain().focus().toggleMark("italic").run(),title:"Italique",children:(0,a.jsx)(n7.A,{className:"h-4 w-4"})}),(0,a.jsx)("button",{type:"button",className:(0,ec.cn)(t,e.isActive("underline")&&s),onClick:()=>e.chain().focus().toggleUnderline().run(),title:"Soulign\xe9",children:(0,a.jsx)(n9.A,{className:"h-4 w-4"})}),(0,a.jsx)(rg,{editor:e,btnClass:t}),n,(0,a.jsx)(rf,{editor:e,btnClass:t,activeClass:s}),(0,a.jsx)("button",{type:"button",className:(0,ec.cn)(t,e.isActive("orderedList")&&s),onClick:()=>e.chain().focus().toggleOrderedList().run(),title:"Liste num\xe9rot\xe9e",children:(0,a.jsx)(re.A,{className:"h-4 w-4"})}),(0,a.jsx)("button",{type:"button",className:(0,ec.cn)(t,e.isActive("bulletList")&&s),onClick:()=>e.chain().focus().toggleBulletList().run(),title:"Liste \xe0 puces",children:(0,a.jsx)(rt.A,{className:"h-4 w-4"})}),(0,a.jsx)("button",{type:"button",className:t,onClick:()=>{try{e.chain().focus().liftListItem("listItem").run()}catch{}},title:"D\xe9sindenter",children:(0,a.jsx)(rs.A,{className:"h-4 w-4"})}),(0,a.jsx)("button",{type:"button",className:t,onClick:()=>{try{e.chain().focus().sinkListItem("listItem").run()}catch{}},title:"Indenter",children:(0,a.jsx)(ra.A,{className:"h-4 w-4"})}),(0,a.jsx)("button",{type:"button",className:t,onClick:()=>e.chain().focus().clearNodes().unsetAllMarks().run(),title:"Supprimer la mise en forme",children:(0,a.jsx)(rn.A,{className:"h-4 w-4"})})]})}var rj=s(39465),rw=s(26173),ry=s(61253),rk=s(77510),rN=s(59680),rC=s(38331),rS=s(17996),rA=s(41243);let rM=(0,n.lazy)(()=>Promise.all([s.e(7326),s.e(3897)]).then(s.bind(s,93897)));function rI({onSelect:e}){let{resolvedTheme:t}=(0,rS.D)();return(0,a.jsx)(n.Suspense,{fallback:(0,a.jsx)("div",{className:"h-[435px] w-[352px]","aria-hidden":!0}),children:(0,a.jsx)(rM,{data:rA,onEmojiSelect:e,locale:"fr",theme:"dark"===t?"dark":"light",previewPosition:"none",skinTonePosition:"search",set:"native"})})}function rE({editor:e}){let[t,s]=(0,n.useState)(!1),r=(0,n.useCallback)(t=>{e?.chain().focus().insertContent(t.native).run(),s(!1)},[e]);return e?(0,a.jsxs)(a6.AM,{open:t,onOpenChange:s,children:[(0,a.jsx)(a6.Wv,{asChild:!0,children:(0,a.jsx)("button",{type:"button",className:eo.Mz,title:"Ins\xe9rer un emoji",children:(0,a.jsx)(rC.A,{className:"h-[18px] w-[18px]"})})}),(0,a.jsx)(a6.hl,{align:"start",side:"top",className:(0,ec.cn)("w-auto border-0 bg-popover p-0 shadow-xl",n2.jk),onOpenAutoFocus:e=>e.preventDefault(),children:(0,a.jsx)(rI,{onSelect:r})})]}):null}function rz({editor:e}){let[t,s]=(0,n.useState)(!1),[r,l]=(0,n.useState)(""),[i,o]=(0,n.useState)("");if(!e)return null;let c=e.isActive("link"),d=()=>{if(!r.trim())return;let t=r.match(/^https?:\/\//)?r:`https://${r}`,{empty:a}=e.state.selection;if(a&&!c){let s=i.trim()||t;e.chain().focus().insertContent(`<a href="${t}">${s}</a>`).run()}else i.trim()&&i.trim()!==e.state.doc.textBetween(e.state.selection.from,e.state.selection.to," ")?e.chain().focus().deleteSelection().insertContent(`<a href="${t}">${i.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").setLink({href:t}).run();s(!1),l(""),o("")};return(0,a.jsxs)(a6.AM,{open:t,onOpenChange:t=>{if(t){let{from:t,to:s,empty:a}=e.state.selection;c?(l(e.getAttributes("link").href||""),o(e.state.doc.textBetween(t,s," "))):(a?o(""):o(e.state.doc.textBetween(t,s," ")),l(""))}s(t)},children:[(0,a.jsx)(a6.Wv,{asChild:!0,children:(0,a.jsx)("button",{type:"button",onClick:t=>{c&&(t.preventDefault(),c?e.chain().focus().extendMarkRange("link").unsetLink().run():s(!0))},className:(0,ec.cn)(eo.Mz,c&&eo.PG),title:c?"Supprimer le lien":"Ins\xe9rer un lien",children:(0,a.jsx)(rj.A,{className:"h-[18px] w-[18px]"})})}),(0,a.jsx)(a6.hl,{align:"start",side:"top",className:(0,ec.cn)("w-[340px]",eo.uU,n2.jk),onOpenAutoFocus:e=>e.preventDefault(),children:(0,a.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-foreground",children:c?"Modifier le lien":"Ins\xe9rer un lien"}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{className:"text-xs text-muted-foreground",children:"Texte \xe0 afficher"}),(0,a.jsx)("input",{type:"text",value:i,onChange:e=>o(e.target.value),placeholder:"Texte du lien",className:"h-8 rounded border border-border bg-mail-surface px-2 text-sm text-foreground outline-none focus:border-ring focus:ring-1 focus:ring-ring"})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{className:"text-xs text-muted-foreground",children:"URL"}),(0,a.jsx)("input",{type:"text",value:r,onChange:e=>l(e.target.value),placeholder:"https://example.com",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d())},className:"h-8 rounded border border-border bg-mail-surface px-2 text-sm text-foreground outline-none focus:border-ring focus:ring-1 focus:ring-ring",autoFocus:!0})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[c?(0,a.jsx)("button",{type:"button",onClick:()=>{e.chain().focus().extendMarkRange("link").unsetLink().run(),s(!1),l(""),o("")},className:"text-sm text-destructive hover:text-destructive/90 transition-colors",children:"Supprimer le lien"}):(0,a.jsx)("span",{}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:()=>s(!1),className:"rounded px-3 py-1.5 text-sm text-muted-foreground hover:bg-accent transition-colors",children:"Annuler"}),(0,a.jsx)("button",{type:"button",onClick:d,disabled:!r.trim(),className:(0,ec.cn)("rounded px-3 py-1.5 text-sm font-medium disabled:opacity-50",eo.wJ),children:c?"Modifier":"Ins\xe9rer"})]})]})]})})]})}function r$({editor:e,compose:t}){let s=(0,rN.TR)(e=>e.signatures),{updateCompose:r}=Z(),l=(0,n.useCallback)(s=>{if(!e)return;let a=(0,n2.Vv)(e.getHTML(),s);e.commands.setContent(a),r(t.id,{bodyHtml:a,signatureId:s})},[e,t.id,r]),i=(0,n.useCallback)(()=>{let e=!t.autoInsertSignature;if(r(t.id,{autoInsertSignature:e}),e){let e=t.from.defaultSignatureId;e&&l(e)}else l(null)},[t.autoInsertSignature,t.from.defaultSignatureId,t.id,r,l]);return e?(0,a.jsxs)(z.rI,{modal:!1,children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)("button",{type:"button",className:eo.Mz,title:"Ins\xe9rer une signature",children:(0,a.jsx)(rw.A,{className:"h-[18px] w-[18px]"})})}),(0,a.jsxs)(z.SQ,{align:"start",side:"top",className:(0,ec.cn)(eo.hz,"min-w-[220px]",n2.jk),children:[(0,a.jsxs)(z._2,{onSelect:e=>{e.preventDefault(),i()},className:"gap-2",children:[(0,a.jsx)("span",{className:"flex h-4 w-4 items-center justify-center",children:t.autoInsertSignature&&(0,a.jsx)("span",{className:"text-xs",children:"✓"})}),"Ins\xe9rer automatiquement"]}),(0,a.jsx)(z.mB,{}),(0,a.jsxs)(z._2,{onSelect:()=>l(null),className:(0,ec.cn)("gap-2",!t.signatureId&&eo.E1),children:[(0,a.jsx)("span",{className:"flex h-4 w-4 items-center justify-center",children:!t.signatureId&&(0,a.jsx)("span",{className:"text-xs",children:"✓"})}),"Aucune signature"]}),s.map(e=>(0,a.jsxs)(z._2,{onSelect:()=>l(e.id),className:(0,ec.cn)("gap-2",t.signatureId===e.id&&eo.E1),children:[(0,a.jsx)("span",{className:"flex h-4 w-4 items-center justify-center",children:t.signatureId===e.id&&(0,a.jsx)("span",{className:"text-xs",children:"✓"})}),e.name]},e.id))]})]}):null}function rL(e){let{compose:t,editor:s,isEditingScheduled:n,showFormatting:r,sendMenuOpen:l,setShowFormatting:i,setSendMenuOpen:o,handleSend:c,saveScheduledEdit:d,sendScheduledFromEditNow:u,applyScheduledPlanAt:m,submitScheduledSendAt:h,handleClose:x,fileInputRef:f,imageInputRef:p}=e;return(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-t border-border px-2 py-1.5",children:[(0,a.jsx)("div",{className:"flex items-center",children:n?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",onClick:()=>void d(),className:(0,ec.cn)("rounded-l-full px-5 text-sm font-medium",eo.wJ),children:"Enregistrer"}),(0,a.jsxs)(z.rI,{modal:!1,open:l,onOpenChange:o,children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)("button",{type:"button",className:(0,ec.cn)("rounded-r-full border-l border-primary-foreground/30 px-1.5",eo.wJ),children:(0,a.jsx)(eV.A,{className:"h-4 w-4"})})}),(0,a.jsxs)(z.SQ,{align:"start",className:(0,ec.cn)("min-w-[220px]",n2.jk),children:[(0,a.jsxs)(z._2,{onSelect:()=>{u()},children:[(0,a.jsx)(et.A,{className:"h-4 w-4 text-muted-foreground",strokeWidth:1.5}),"Envoyer maintenant"]}),(0,a.jsxs)(z.lv,{children:[(0,a.jsxs)(z.nV,{className:"[&>svg:last-child]:text-muted-foreground",children:[(0,a.jsx)(er.A,{className:"h-4 w-4 text-muted-foreground",strokeWidth:1.5}),"Planifier"]}),(0,a.jsxs)(z.M5,{className:(0,ec.cn)("min-w-[220px]",n2.jk),children:[(0,a.jsxs)(z._2,{onSelect:()=>{m(new Date(Date.now()+36e5))},children:[(0,a.jsx)(er.A,{className:"h-4 w-4 text-muted-foreground",strokeWidth:1.5}),"Envoyer dans une heure"]}),(0,a.jsxs)(z._2,{onSelect:()=>{m((0,ec.L)(9,0))},children:[(0,a.jsx)(er.A,{className:"h-4 w-4 text-muted-foreground",strokeWidth:1.5}),"Envoyer \xe0 9h"]})]})]})]})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",onClick:c,className:(0,ec.cn)("rounded-l-full px-5 text-sm font-medium",eo.wJ),children:"Envoyer"}),(0,a.jsxs)(z.rI,{modal:!1,open:l,onOpenChange:o,children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)("button",{type:"button",className:(0,ec.cn)("rounded-r-full border-l border-primary-foreground/30 px-1.5",eo.wJ),children:(0,a.jsx)(eV.A,{className:"h-4 w-4"})})}),(0,a.jsxs)(z.SQ,{align:"start",className:(0,ec.cn)("min-w-[220px]",n2.jk),children:[(0,a.jsxs)(z._2,{onSelect:()=>{h(new Date(Date.now()+36e5))},children:[(0,a.jsx)(er.A,{className:"h-4 w-4 text-muted-foreground"}),"Envoyer dans une heure"]}),(0,a.jsxs)(z._2,{onSelect:()=>{h((0,ec.L)(9,0))},children:[(0,a.jsx)(er.A,{className:"h-4 w-4 text-muted-foreground"}),"Envoyer \xe0 9h"]}),(0,a.jsxs)(z._2,{onSelect:()=>o(!1),children:[(0,a.jsx)(er.A,{className:"h-4 w-4 text-muted-foreground"}),"Programmer l'envoi"]})]})]})]})}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5 ml-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>i(!r),className:(0,ec.cn)(eo.Mz,r&&eo.PG),title:"Options de mise en forme",children:(0,a.jsx)(ry.A,{className:"h-[18px] w-[18px]"})}),(0,a.jsx)("button",{type:"button",className:eo.Mz,title:"Joindre des fichiers",onClick:()=>f.current?.click(),children:(0,a.jsx)(ex.A,{className:"h-[18px] w-[18px]"})}),(0,a.jsx)(rz,{editor:s}),(0,a.jsx)(rE,{editor:s}),(0,a.jsx)("button",{type:"button",className:eo.Mz,title:"Ins\xe9rer des fichiers depuis UltiDrive",children:(0,a.jsx)(nb.A,{className:"h-[18px] w-[18px]"})}),(0,a.jsx)("button",{type:"button",className:eo.Mz,title:"Ins\xe9rer une photo",onClick:()=>p.current?.click(),children:(0,a.jsx)(np.A,{className:"h-[18px] w-[18px]"})}),(0,a.jsx)("button",{type:"button",className:eo.Mz,title:"Activer le mode confidentiel",children:(0,a.jsx)(rk.A,{className:"h-[18px] w-[18px]"})}),(0,a.jsx)(r$,{editor:s,compose:t}),(0,a.jsx)("button",{type:"button",className:eo.Mz,title:"Plus d'options",children:(0,a.jsx)(th.A,{className:"h-[18px] w-[18px]"})})]}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsx)("button",{type:"button",onClick:x,className:eo.Mz,title:"Supprimer le brouillon",children:(0,a.jsx)(en.A,{className:"h-[18px] w-[18px]"})})]})}var rD=s(3538);function rT(){return(0,a.jsx)("div",{className:eo.lK,children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(ex.A,{className:"mx-auto h-8 w-8 text-primary"}),(0,a.jsx)("p",{className:"mt-2 text-sm font-medium text-primary",children:"D\xe9poser les fichiers ici"})]})})}function r_({compose:e,threadSourceEmail:t,recipientSummary:s,recipientsFocused:n,showReplyAllInMenu:r,ThreadKindIcon:l,onOpenInlinePreset:i,onOpenDockFromInline:o,onActivateRecipients:c,updateCompose:d,recipientFieldsProps:u,fieldsRef:m,inlineRecipientShellRef:h}){return(0,a.jsxs)("div",{ref:h,className:"flex shrink-0 flex-col",children:[(0,a.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 bg-mail-surface px-2",title:e.threading?`In-Reply-To: ${e.threading.inReplyTo}
References: ${e.threading.references.join(" ")}`:void 0,children:[(0,a.jsxs)(z.rI,{modal:!1,children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",className:"flex h-8 shrink-0 items-center gap-0.5 rounded-full px-1.5 text-muted-foreground transition-colors hover:bg-accent",title:"Type de message",children:[(0,a.jsx)(l,{className:"h-[18px] w-[18px] shrink-0",strokeWidth:1.75}),(0,a.jsx)(eV.A,{className:"h-4 w-4 shrink-0"})]})}),(0,a.jsxs)(z.SQ,{align:"start",className:(0,ec.cn)("min-w-[260px]",n2.jk),onCloseAutoFocus:e=>e.preventDefault(),children:[(0,a.jsxs)(z._2,{disabled:!t,onSelect:()=>i("reply"),children:[(0,a.jsx)(C.A,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground",strokeWidth:1.75}),"R\xe9pondre"]}),r?(0,a.jsxs)(z._2,{disabled:!t,onSelect:()=>i("replyAll"),children:[(0,a.jsx)(a5.A,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground",strokeWidth:1.75}),"R\xe9pondre \xe0 tous"]}):null,(0,a.jsxs)(z._2,{disabled:!t,onSelect:()=>i("forward"),children:[(0,a.jsx)(a4.A,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground",strokeWidth:1.75}),"Transf\xe9rer"]}),(0,a.jsx)(z.mB,{}),(0,a.jsxs)(z._2,{onSelect:()=>o({focusSubject:!0}),children:[(0,a.jsx)(I.A,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground",strokeWidth:1.75}),"Modifier l'objet"]}),(0,a.jsxs)(z._2,{onSelect:()=>o(),children:[(0,a.jsx)(aq.A,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground",strokeWidth:1.75}),"Ouvrir une fen\xeatre de r\xe9ponse"]})]})]}),(0,a.jsx)("button",{type:"button",className:"min-w-0 flex-1 truncate rounded px-1 py-1 text-left text-sm text-foreground hover:bg-accent/70",onClick:c,children:s}),n||e.showCc&&e.showBcc?null:(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[e.showCc?null:(0,a.jsx)("button",{type:"button",onClick:()=>{d(e.id,{showCc:!0}),c()},className:"text-sm text-muted-foreground hover:text-foreground hover:underline",children:"Cc"}),e.showBcc?null:(0,a.jsx)("button",{type:"button",onClick:()=>{d(e.id,{showBcc:!0}),c()},className:"text-sm text-muted-foreground hover:text-foreground hover:underline",children:"Cci"})]}),(0,a.jsx)("button",{type:"button",className:(0,ec.cn)("flex h-8 w-8 shrink-0 items-center justify-center rounded-full",eo.RA),title:"Ouvrir dans une fen\xeatre",onClick:()=>o(),children:(0,a.jsx)(aq.A,{className:"h-[18px] w-[18px]",strokeWidth:1.75})})]}),(0,a.jsx)("div",{ref:m,className:(0,ec.cn)("flex shrink-0 flex-col",!n&&"hidden"),children:(0,a.jsx)(n5,{...u})})]})}function rR({titleText:e,onClose:t}){return(0,a.jsxs)("div",{className:(0,ec.cn)("flex h-11 shrink-0 items-center border-b border-border bg-muted px-3","pt-[max(_0.25rem,env(safe-area-inset-top))]"),children:[(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:e}),(0,a.jsx)("button",{type:"button",onClick:t,className:(0,ec.cn)("flex h-8 w-8 items-center justify-center rounded-full",eo.RA),title:"Fermer",children:(0,a.jsx)(S.A,{className:"h-4 w-4"})})]})}function rP({titleText:e,maximized:t,onMinimize:s,onMaximize:n,onClose:r}){return(0,a.jsxs)("div",{className:eo.il,onClick:s,children:[(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:e}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),s()},className:(0,ec.cn)("flex h-6 w-6 items-center justify-center rounded-full",eo.RA),title:"R\xe9duire",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",className:"shrink-0","aria-hidden":!0,children:(0,a.jsx)("line",{x1:"5",y1:"17",x2:"19",y2:"17"})})}),(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),n()},className:(0,ec.cn)("flex h-6 w-6 items-center justify-center rounded-full",eo.RA),title:t?"R\xe9duire la fen\xeatre":"Plein \xe9cran",children:t?(0,a.jsx)(rD.A,{className:"h-3.5 w-3.5"}):(0,a.jsx)(n1.A,{className:"h-3.5 w-3.5"})}),(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),r()},className:(0,ec.cn)("flex h-6 w-6 items-center justify-center rounded-full",eo.RA),title:"Fermer",children:(0,a.jsx)(S.A,{className:"h-3.5 w-3.5"})})]})]})}function rF({attachments:e,onRemove:t}){return 0===e.length?null:(0,a.jsx)("div",{className:"flex max-h-[120px] shrink-0 flex-col gap-1 overflow-y-auto border-t border-border px-3 py-2",children:e.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted px-3 py-1.5",children:[e.type.startsWith("image/")?(0,a.jsx)(np.A,{className:"h-4 w-4 shrink-0 text-primary"}):(0,a.jsx)(ex.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:e.name}),(0,a.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.size<1024?`${e.size} o`:e.size<1048576?`${(e.size/1024).toFixed(1)} Ko`:`${(e.size/1048576).toFixed(1)} Mo`}),(0,a.jsx)("button",{type:"button",onClick:()=>t(e.id),className:(0,ec.cn)("flex h-5 w-5 shrink-0 items-center justify-center rounded-full",eo.RA),title:"Supprimer",children:(0,a.jsx)(S.A,{className:"h-3.5 w-3.5"})})]},e.id))})}var rO=s(43254),rq=s(50290),rW=s(13937),rB=s(39566),rU=s(82222),rH=s(42364),rV=s(42125),rK=s(91505),rQ=s(14410);function rG(e){let t=e.durationMs??3e3,s={current:!1},n={current:null};ng.oR.custom(r=>(0,a.jsx)(rY,{toastId:r,durationMs:t,committedRef:s,timerRef:n,onCommit:e.onCommit,onCancel:e.onCancel}),{duration:1/0,onDismiss:()=>{null!=n.current&&(clearTimeout(n.current),n.current=null),s.current||(s.current=!0,e.onCancel())}})}function rY({toastId:e,durationMs:t,committedRef:s,timerRef:r,onCommit:l,onCancel:i}){let o=(0,n.useRef)(l),c=(0,n.useRef)(i);o.current=l,c.current=i;let[d,u]=(0,n.useState)(!1),m=(0,n.useRef)(()=>{});return m.current=t=>{s.current||(t?.manual&&u(!0),s.current=!0,null!=r.current&&(clearTimeout(r.current),r.current=null),(async()=>{try{await o.current(),ng.oR.success("Message envoy\xe9")}catch{ng.oR.error("L'envoi a \xe9chou\xe9"),c.current()}finally{ng.oR.dismiss(e)}})())},(0,n.useEffect)(()=>(r.current=window.setTimeout(()=>{m.current()},t),()=>{null!=r.current&&(clearTimeout(r.current),r.current=null)}),[t,r]),(0,a.jsxs)("div",{className:(0,ec.cn)(eo.E7,"backdrop-blur-sm"),children:[(0,a.jsxs)("div",{className:"px-3.5 pb-2.5 pt-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/15 text-primary","aria-hidden":!0,children:(0,a.jsx)(rK.A,{className:"h-4 w-4 animate-spin",strokeWidth:2})}),(0,a.jsx)("div",{className:"min-w-0",children:(0,a.jsx)("p",{className:"text-[13px] font-semibold leading-snug tracking-tight text-foreground",children:"Envoi en cours…"})})]}),(0,a.jsxs)("div",{className:"mt-2.5 grid grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)] gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{m.current({manual:!0})},className:"inline-flex min-h-9 min-w-0 items-center justify-center gap-1.5 whitespace-nowrap rounded-lg bg-[#1a73e8] px-2.5 py-2 text-xs font-semibold leading-tight text-white shadow-sm transition-colors hover:bg-[#1765cc] active:bg-[#1557b0]",children:[(0,a.jsx)(et.A,{className:"h-3.5 w-3.5 shrink-0 opacity-95",strokeWidth:2,"aria-hidden":!0}),(0,a.jsx)("span",{children:"Envoyer maintenant"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{s.current||(s.current=!0,null!=r.current&&(clearTimeout(r.current),r.current=null),c.current(),ng.oR.dismiss(e))},className:"inline-flex min-h-9 min-w-0 items-center justify-center gap-1.5 whitespace-nowrap rounded-lg border border-border bg-mail-surface px-2.5 py-2 text-xs font-semibold leading-tight text-muted-foreground shadow-sm transition-colors hover:border-border hover:bg-accent hover:text-foreground",children:[(0,a.jsx)(rQ.A,{className:"h-3.5 w-3.5 shrink-0",strokeWidth:2,"aria-hidden":!0}),(0,a.jsx)("span",{children:"Annuler l'envoi"})]})]})]}),(0,a.jsx)("div",{className:"relative h-1 w-full shrink-0 bg-muted",children:(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 bg-linear-to-r from-[#1a73e8] to-[#4285f4]",style:d?{width:"100%"}:{width:"0%",animation:`ultimail-pending-send-progress ${t}ms linear forwards`}})}),(0,a.jsx)("style",{children:`
@keyframes ultimail-pending-send-progress {
from { width: 0%; }
to { width: 100%; }
}
`})]})}function rZ({compose:e,threadSourceEmail:t=null,isXsSheet:s=!1,bindXsSheetClose:r}){let{isInline:l,isEditingScheduled:o,editor:c,titleText:d,showFormatting:u,setShowFormatting:m,recipientsFocused:h,setRecipientsFocused:x,sendMenuOpen:f,setSendMenuOpen:p,isDragOver:b,fieldsRef:g,inlineRecipientShellRef:v,fileInputRef:j,imageInputRef:w,handleClose:y,handleSend:k,saveScheduledEdit:N,sendScheduledFromEditNow:A,applyScheduledPlanAt:M,submitScheduledSendAt:I,addFiles:E,removeAttachment:z,handleDrop:$,handleDragOver:L,handleDragLeave:D,recipientSummary:T,showReplyAllInMenu:_,ThreadKindIcon:R,openInlinePreset:P,openDockFromInline:F,recipientFieldsProps:q,toggleMinimize:W,toggleMaximize:B,updateCompose:U}=function(e,t=null,s=!1,a){let{closeCompose:r,updateCompose:l,applyComposePreset:i,toggleMinimize:o,toggleMaximize:c,restoreComposeFromSnapshot:d}=Z(),{scheduleSend:u,requestUpdateScheduledSend:m,requestSendScheduledNow:h}=sb(),x=(0,ev.LH)(),{identities:f}=(0,rV.g)(x?.id),p="inline"===e.placement,b=null!=e.editingScheduledId,[g,v]=(0,n.useState)(!1),[j,w]=(0,n.useState)(!1),[y,k]=(0,n.useState)(!1),[N,S]=(0,n.useState)(!1),A=(0,n.useRef)(null),M=(0,n.useRef)(null),I=(0,n.useRef)(null),E=(0,n.useRef)(null),z=(0,n.useRef)(null),$=!p&&!e.threadEmailId&&!e.threadKind&&!e.editingScheduledId,L=(0,n0.hG)({immediatelyRender:!1,extensions:[rO.A,rq.A,rW.Ay.configure({openOnClick:!1}),rU.xJ,rH.A,rU.i0,rU.ay,rU.Z4,rB.A.configure({types:["heading","paragraph"],alignments:["left","center","right","justify"]}),n2.Gf],content:e.bodyHtml,onUpdate:({editor:t})=>{l(e.id,{bodyHtml:t.getHTML()})},onFocus:({editor:e,event:t})=>{if(!$)return;let s=t.relatedTarget;s&&A.current?.contains(s)&&window.requestAnimationFrame(()=>{if(e.view.hasFocus())try{e.chain().setTextSelection(1).run()}catch{}})},editorProps:{attributes:{class:(0,ec.cn)("prose prose-sm max-w-none px-3 py-2 text-sm text-foreground outline-none focus:outline-none",p?"min-h-[200px]":s?"min-h-[min(36vh,280px)]":"min-h-[150px]")}}}),D=e.subject||"Nouveau message",T=(0,n2.pQ)(e.bodyHtml).replace(/<p><\/p>/g,"").trim(),_=""!==e.subject.trim()||e.to.length>0||e.cc.length>0||e.bcc.length>0||e.attachments.length>0||""!==T,R=(0,n.useCallback)(t=>{let s=t.signatureHtml??(t.defaultSignatureId?t.defaultSignatureId:null);if(e.autoInsertSignature&&L){let a=(0,n2.Vv)(L.getHTML(),s);L.commands.setContent(a),l(e.id,{from:t,bodyHtml:a,signatureId:t.defaultSignatureId})}else l(e.id,{from:t})},[e.id,e.autoInsertSignature,L,l]),P=()=>{let t=p&&e.threadEmailId?{discardThreadReplyDraft:!0}:void 0;_&&l(e.id,{savedAt:Date.now()}),r(e.id,t)},F=(0,n.useRef)(P);F.current=P,(0,n.useLayoutEffect)(()=>{if(s&&a)return a(()=>{F.current()}),()=>a(null)},[s,a,e.id]);let q=(0,n.useCallback)(e=>e.replace(/<style[^>]*>[\s\S]*?<\/style>/gi," ").replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim(),[]),W=(0,n.useCallback)(()=>{if(0===e.to.length)return;let t=L?.getHTML()??e.bodyHtml,s=O({...e,bodyHtml:t});r(e.id,{sent:!0}),rG({onCommit:async()=>{},onCancel:()=>d(s)})},[r,e,L,d]),B=(0,n.useCallback)(async t=>{if(b||0===e.to.length)return;k(!1);let s=L?.getHTML()??e.bodyHtml;await u({sendAtIso:t.toISOString(),to:e.to.map(e=>({name:e.name,email:e.email})),subject:e.subject,previewText:q(s).slice(0,500),bodyHtml:s});let a=t.toLocaleString("fr-FR",{dateStyle:"medium",timeStyle:"short"});ng.oR.message(`Ce mail sera envoy\xe9 le ${a}`),r(e.id,{sent:!0})},[b,e.bodyHtml,e.id,e.subject,e.to,r,L,q,u]),U=(0,n.useCallback)(t=>{if(0===e.to.length)return null;let s=L?.getHTML()??e.bodyHtml;return{sendAtIso:t,to:e.to.map(e=>({name:e.name,email:e.email})),subject:e.subject,previewText:q(s).slice(0,500),bodyHtml:s}},[e.to,e.subject,e.bodyHtml,L,q]),H=(0,n.useCallback)(async()=>{let t=e.editingScheduledId;if(!t)return;let s=U(e.scheduledSendAtIso??new Date().toISOString());s&&(await m(t,s),ng.oR.message("Modifications enregistr\xe9es"),r(e.id))},[U,r,e.editingScheduledId,e.id,e.scheduledSendAtIso,m]),V=(0,n.useCallback)(async()=>{if(!e.editingScheduledId)return;k(!1);let t=L?.getHTML()??e.bodyHtml,s=O({...e,bodyHtml:t});r(e.id,{sent:!0}),rG({onCommit:async()=>{let e=s.editingScheduledId;if(!e||0===s.to.length)return;let t=s.scheduledSendAtIso??new Date().toISOString(),a=s.bodyHtml,n={sendAtIso:t,to:s.to.map(e=>({name:e.name,email:e.email})),subject:s.subject,previewText:q(a).slice(0,500),bodyHtml:a};await m(e,n),await h(e)},onCancel:()=>d(s)})},[r,e,L,q,h,m,d]),K=(0,n.useCallback)(async t=>{let s=e.editingScheduledId;if(!s)return;k(!1);let a=t.toISOString(),n=U(a);if(!n)return;await m(s,n),l(e.id,{scheduledSendAtIso:a});let r=t.toLocaleString("fr-FR",{dateStyle:"medium",timeStyle:"short"});ng.oR.message(`Envoi planifi\xe9 le ${r}`)},[U,e.editingScheduledId,e.id,m,l]),Q=(0,n.useCallback)(t=>{let s=Array.from(t).map(e=>({id:`att-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,file:e,name:e.name,size:e.size,type:e.type}));l(e.id,{attachments:[...e.attachments,...s]})},[e.id,e.attachments,l]),G=(0,n.useCallback)(t=>{l(e.id,{attachments:e.attachments.filter(e=>e.id!==t)})},[e.id,e.attachments,l]),Y=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),S(!1),e.dataTransfer.files.length>0&&Q(e.dataTransfer.files)},[Q]),J=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),S(!0)},[]),X=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),e.currentTarget!==e.target&&e.currentTarget.contains(e.relatedTarget)||S(!1)},[]),ee=j||s;(0,n.useLayoutEffect)(()=>{p&&e.focusToOnMount&&w(!0)},[p,e.focusToOnMount]),(0,n.useEffect)(()=>{if(!j)return;let t=t=>{let s=t.target,a=p?M.current:A.current;if(a&&!a.contains(s)){let s=t.target;if(s?.closest?.("[data-radix-popper-content-wrapper], [data-radix-dropdown-menu-content], [data-slot='dropdown-menu-content'], [data-slot='popover-content']"))return;w(!1),e.showCc&&0===e.cc.length&&l(e.id,{showCc:!1}),e.showBcc&&0===e.bcc.length&&l(e.id,{showBcc:!1})}};return document.addEventListener("pointerdown",t),()=>document.removeEventListener("pointerdown",t)},[j,p,e.showCc,e.showBcc,e.cc.length,e.bcc.length,e.id,l]),(0,n.useEffect)(()=>{if(!L||L.isDestroyed)return;let t=e.bodyHtml;L.getHTML()!==t&&L.commands.setContent(t,{emitUpdate:!1})},[e.bodyHtml,e.threadKind,L]),(0,n.useEffect)(()=>{if(!e.focusSubjectOnMount||p)return;let t=window.requestAnimationFrame(()=>{I.current?.focus(),l(e.id,{focusSubjectOnMount:!1})});return()=>window.cancelAnimationFrame(t)},[e.focusSubjectOnMount,p,e.id,l]),(0,n.useEffect)(()=>{if(!e.focusBodyOnMount||!L||L.isDestroyed)return;let t=!1,s=window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{if(!t&&L&&!L.isDestroyed){try{L.chain().focus().setTextSelection(1).run()}catch{L.chain().focus().run()}l(e.id,{focusBodyOnMount:!1})}})});return()=>{t=!0,window.cancelAnimationFrame(s)}},[e.focusBodyOnMount,e.id,L,l]);let et=(0,n.useCallback)(()=>{l(e.id,{focusToOnMount:!1})},[e.id,l]),es="forward"===e.threadKind?a4.A:"replyAll"===e.threadKind?a5.A:C.A,ea=0===e.to.length?"Destinataires":1===e.to.length&&e.to[0]?e.to[0].name===e.to[0].email?e.to[0].email:`${e.to[0].name} <${e.to[0].email}>`:`${e.to.length} destinataires`,en=(0,n.useMemo)(()=>!!(t&&aj(t).length>1),[t]),er=(0,n.useCallback)(s=>{t&&i(e.id,aA(t,s))},[t,i,e.id]),el=(0,n.useCallback)(t=>{w(!1),l(e.id,{placement:"dock",threadEmailId:null,focusToOnMount:!1,focusBodyOnMount:!1,minimized:!1,maximized:!1,focusSubjectOnMount:!!t?.focusSubject})},[e.id,l]);return{compose:e,threadSourceEmail:t,isXsSheet:s,isInline:p,isEditingScheduled:b,editor:L,titleText:D,showFormatting:g,setShowFormatting:v,recipientsFocused:j,setRecipientsFocused:w,sendMenuOpen:y,setSendMenuOpen:k,isDragOver:N,fieldsRef:A,inlineRecipientShellRef:M,subjectInputRef:I,fileInputRef:E,imageInputRef:z,showFromField:ee,handleClose:P,handleSend:W,saveScheduledEdit:H,sendScheduledFromEditNow:V,applyScheduledPlanAt:K,submitScheduledSendAt:B,addFiles:Q,removeAttachment:G,handleDrop:Y,handleDragOver:J,handleDragLeave:X,recipientSummary:ea,showReplyAllInMenu:en,ThreadKindIcon:es,openInlinePreset:er,openDockFromInline:el,recipientFieldsProps:{compose:e,isInline:p,showFromField:ee,identities:f,updateCompose:l,handleIdentityChange:R,clearFocusToMount:et,subjectInputRef:I,onRecipientsActivate:()=>w(!0)},toggleMinimize:o,toggleMaximize:c,updateCompose:l}}(e,t,s,r),H=(0,a.jsxs)("div",{"data-compose-window":!0,className:(0,ec.cn)("relative flex flex-col overflow-hidden bg-mail-surface text-foreground",l?"min-h-[360px] w-full rounded-xl border border-border shadow-none transition-shadow focus-within:shadow-[0_1px_4px_rgba(60,64,67,0.12)]":s?"h-full min-h-0 w-full max-w-none flex-1 rounded-none shadow-none":(0,ec.cn)("rounded-t-lg shadow-[0_-2px_8px_rgba(0,0,0,0.08),_-4px_0_12px_rgba(0,0,0,0.12),_4px_0_12px_rgba(0,0,0,0.12)]",e.maximized?i()?"fixed inset-0 z-60 rounded-none":"fixed inset-12 z-60 rounded-lg":"h-[480px] w-[500px]")),onDrop:$,onDragOver:L,onDragLeave:D,children:[(0,a.jsx)("input",{ref:j,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&e.target.files.length>0&&(E(e.target.files),e.target.value="")}}),(0,a.jsx)("input",{ref:w,type:"file",multiple:!0,accept:"image/*",className:"hidden",onChange:e=>{e.target.files&&e.target.files.length>0&&(E(e.target.files),e.target.value="")}}),b?(0,a.jsx)(rT,{}):null,l?(0,a.jsx)(r_,{compose:e,threadSourceEmail:t,recipientSummary:T,recipientsFocused:h,showReplyAllInMenu:_,ThreadKindIcon:R,onOpenInlinePreset:P,onOpenDockFromInline:F,onActivateRecipients:()=>x(!0),updateCompose:U,recipientFieldsProps:q,fieldsRef:g,inlineRecipientShellRef:v}):s?(0,a.jsx)(rR,{titleText:d,onClose:y}):(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(rP,{titleText:d,maximized:e.maximized,onMinimize:()=>W(e.id),onMaximize:()=>B(e.id),onClose:y})}),!l&&(0,a.jsx)("div",{ref:g,className:"flex shrink-0 flex-col",children:(0,a.jsx)(n5,{...q})}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:(0,a.jsx)(n0.$Z,{editor:c})}),(0,a.jsx)(rF,{attachments:e.attachments,onRemove:z}),u?(0,a.jsx)(rv,{editor:c}):null,(0,a.jsx)(rL,{compose:e,editor:c,isEditingScheduled:o,showFormatting:u,sendMenuOpen:f,setShowFormatting:m,setSendMenuOpen:p,handleSend:k,saveScheduledEdit:N,sendScheduledFromEditNow:A,applyScheduledPlanAt:M,submitScheduledSendAt:I,handleClose:y,fileInputRef:j,imageInputRef:w})]});return!e.minimized||l||s?!e.maximized||l||s?H:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"fixed inset-0 z-55 bg-black/50",onClick:()=>B(e.id)}),H]}):(0,a.jsxs)("div",{className:(0,ec.cn)(eo.il,"h-9 w-[280px] cursor-pointer shadow-lg transition-shadow hover:shadow-xl"),onClick:()=>W(e.id),children:[(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:d}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,a.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),B(e.id)},className:(0,ec.cn)("flex h-6 w-6 items-center justify-center rounded-full",eo.RA),children:(0,a.jsx)(n1.A,{className:"h-3.5 w-3.5"})}),(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),y()},className:(0,ec.cn)("flex h-6 w-6 items-center justify-center rounded-full",eo.RA),children:(0,a.jsx)(S.A,{className:"h-3.5 w-3.5"})})]})]})}function rJ(){let{composeWindows:e}=X(),t=(0,r.LZ)(),s=e.filter(e=>!e.maximized&&"inline"!==e.placement),l=e.filter(e=>e.maximized&&"inline"!==e.placement),i=(0,n.useRef)(null),o=(0,n.useCallback)(e=>{i.current=e},[]),c=t&&s.length>0?s[s.length-1]:null,d=(0,n.useCallback)(e=>{e||i.current?.()},[]),u=(0,n.useMemo)(()=>{let e=[...s].reverse(),t=[],a=80;for(let s=0;s<e.length;s++){let n=e[s],r=n.minimized?280:500;t.push({id:n.id,right:a,hidden:s>=2&&!n.minimized}),a+=r+12}return t},[s]);return t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ep.cj,{open:null!=c,onOpenChange:d,children:(0,a.jsxs)(ep.h,{side:"bottom",hideClose:!0,overlayClassName:"z-[60]",className:"z-[61] h-[100dvh] max-h-[100dvh] w-full gap-0 rounded-none border-0 p-0 shadow-none duration-300 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom overflow-hidden pb-[env(safe-area-inset-bottom)]",children:[(0,a.jsx)(ep.qp,{className:"sr-only",children:(c?.subject??"").trim()||"Nouveau message"}),c?(0,a.jsx)(rZ,{compose:c,isXsSheet:!0,bindXsSheetClose:o},c.id):null]})}),l.map(e=>(0,a.jsx)("div",{className:"pointer-events-auto",children:(0,a.jsx)(rZ,{compose:e})},e.id))]}):(0,a.jsxs)(a.Fragment,{children:[s.map(e=>{let t=u.find(t=>t.id===e.id);return t?(0,a.jsx)("div",{className:(0,ec.cn)("pointer-events-auto fixed bottom-0 z-50 transition-all duration-300",t.hidden&&"invisible"),style:{right:t.right},children:(0,a.jsx)(rZ,{compose:e})},e.id):null}),l.map(e=>(0,a.jsx)("div",{className:"pointer-events-auto",children:(0,a.jsx)(rZ,{compose:e})},e.id))]})}function rX({start:e,end:t}){let[s,r]=(0,n.useState)("\xa0");return(0,n.useEffect)(()=>{let s,a,n,l,i,o,c,d;r((a=aa.fr,n=Intl.DateTimeFormat().resolvedOptions().timeZone,l="HH:mm",i=(0,s9.GP)(e,l,{locale:a}),o=(0,s9.GP)(t,l,{locale:a}),s=(0,ae.c)(e)?"Aujourd'hui":(0,at.e)(e)?"Demain":(0,as.e)(e)?(0,s9.GP)(e,"EEE d MMM",{locale:a}):(0,s9.GP)(e,"EEE d MMM yyyy",{locale:a}),c=function(e,t){let s=(new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).formatToParts(e).find(e=>"timeZoneName"===e.type)?.value??"").replace(/^GMT/i,"UTC"),a=s.match(/^UTC([+-])(\d{1,2})(?::(\d{2}))?$/i);if(!a)return s;let n=a[1],r=Number(a[2]),l=a[3]?Number(a[3]):0;return 0===l?`UTC${n}${r}`:`UTC${n}${String(r).padStart(2,"0")}:${String(l).padStart(2,"0")}`}(e,n),d=`${i} ${o}`,c?`${s} ${d} (${c})`:`${s} ${d}`))},[e,t]),(0,a.jsx)("span",{suppressHydrationWarning:!0,children:s})}var r0=s(78224),r1=s(20911),r2=s(45798),r3=s(21871);let r5="rounded-full border border-border bg-mail-surface px-4 py-2 text-sm font-medium text-primary transition-colors hover:bg-accent";function r4({invitation:e,className:t}){sX();let{organizerLine:s,othersLine:r}=(0,n.useMemo)(()=>{let t,s,a;return s=(t=e.organizer?.email)||e.organizer?.name?`${t??e.organizer?.name} Organisateur`:void 0,{organizerLine:s,othersLine:function(e,t=3){let s=e.map(e=>e.email||e.name).filter(Boolean),a=s.slice(0,t),n=s.length-a.length;return n<=0?a.join(", "):`${a.join(", ")} et ${n} autre${n>1?"s":""}`}((a=e.attendees.filter(e=>{let s=e.email?.toLowerCase();return s&&s!==t?.toLowerCase()})).length>0?a:e.attendees,4)||void 0}},[e]),l=ar[e.conferenceProvider],[i,o]=(0,n.useState)(null);return(0,a.jsxs)("div",{className:(0,ec.cn)(eo.c7,t),children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between md:gap-4",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,a.jsx)(eO.In,{icon:l,className:"size-5 shrink-0","aria-hidden":!0}),(0,a.jsx)(rX,{start:e.start,end:e.end})]}),(0,a.jsx)("h2",{className:"text-xl font-normal leading-snug text-foreground",children:e.summary}),s&&(0,a.jsx)("p",{className:"text-sm text-foreground/90",children:s}),r&&(0,a.jsxs)("p",{className:"flex flex-wrap items-start gap-1.5 text-sm text-foreground/90",children:[(0,a.jsx)(r1.A,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),(0,a.jsx)("span",{children:r})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 flex-row items-start gap-3 md:flex-col md:items-end",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg border border-border bg-mail-surface shadow-sm",children:(0,a.jsx)(r0.q,{className:"size-9 object-contain"})}),(0,a.jsxs)("div",{className:"min-w-0 text-right text-sm leading-snug text-muted-foreground",children:[(0,a.jsx)("p",{className:"font-medium text-foreground",children:"Dans votre agenda"}),(0,a.jsx)("p",{className:"mt-0.5",children:"Aucun autre \xe9v\xe9nement \xe0 cette date"})]})]})]}),(0,a.jsxs)("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[["Oui","Non","Peut-\xeatre"].map(e=>(0,a.jsx)("button",{type:"button",className:(0,ec.cn)("rounded-full bg-[#1a73e8] px-4 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-[#1557b0]",i===e&&"ring-2 ring-[#202124]/30"),onClick:()=>o(e),children:e},e)),(0,a.jsx)("button",{type:"button",className:r5,children:"Proposer un autre horaire"}),(0,a.jsx)("a",{href:`/agenda/day/${(0,s9.GP)(e.start,"yyyy-MM-dd")}`,className:r5,children:"Ouvrir dans Agenda"}),(0,a.jsx)("button",{type:"button",className:"ml-auto flex size-10 items-center justify-center rounded-full border border-border bg-mail-surface text-muted-foreground hover:bg-accent md:ml-0","aria-label":"Plus doptions",children:(0,a.jsx)(th.A,{className:"size-[18px]",strokeWidth:1.5})})]}),(0,a.jsxs)("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-2 border-t border-border/60 pt-3 text-xs text-muted-foreground",children:[(0,a.jsx)("span",{children:"Dapr\xe8s cet e-mail"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{children:"Correct ?"}),(0,a.jsx)("button",{type:"button",className:"rounded p-1 text-[#5f6368] hover:bg-black/5","aria-label":"Oui, correct",children:(0,a.jsx)(r2.A,{className:"size-4",strokeWidth:1.5})}),(0,a.jsx)("button",{type:"button",className:"rounded p-1 text-[#5f6368] hover:bg-black/5","aria-label":"Non, incorrect",children:(0,a.jsx)(r3.A,{className:"size-4",strokeWidth:1.5})})]})]})]})}var r6=s(5675),r8=s(19054);let r7="#e8eaed",r9="#8ab4f8",le="#3c4043",lt="#202124",ls="#1a73e8",la="'Geist', 'Geist Fallback', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",ln=`
html, body {
height: auto !important;
min-height: 0 !important;
max-height: none !important;
}
[data-ultimail-measure-root] {
display: flow-root;
height: auto !important;
min-height: 0 !important;
}
`;function lr(){return`
:root { color-scheme: dark; }
body,
body div, body p, body span, body td, body th, body li, body font,
body h1, body h2, body h3, body h4, body h5, body h6,
body label, body strong, body b, body em, body i, body u,
body center, body table, body tbody, body thead, body tfoot, body tr {
color: ${r7} !important;
}
body a, body a * {
color: ${r9} !important;
}
[bgcolor="#ffffff"], [bgcolor="#FFFFFF"], [bgcolor="white"],
[bgcolor="#f8f9fa"], [bgcolor="#F8F9FA"], [bgcolor="#f1f3f4"], [bgcolor="#F1F3F4"],
[bgcolor="#e8eaed"], [bgcolor="#E8EAED"], [bgcolor="#f6f8fc"], [bgcolor="#F6F8FC"],
[bgcolor="#fafafa"], [bgcolor="#FAFAFA"], [bgcolor="#eeeeee"], [bgcolor="#EEEEEE"],
[bgcolor="#fcfcfc"], [bgcolor="#FCFCFC"], [bgcolor="#fff"], [bgcolor="#FFF"] {
background-color: transparent !important;
background: transparent !important;
}
[color="#000000"], [color="#000"], [color="#111111"], [color="#202124"],
[color="#3c4043"], [color="#5f6368"], [color="#444746"], [color="#1f1f1f"],
[color="#333333"], [color="#333"], [color="#666666"], [color="#666"],
[color="#757575"], [color="#80868b"], [color="#9aa0a6"] {
color: ${r7} !important;
}
font[color] {
color: ${r7} !important;
}
[bgcolor="#000000"], [bgcolor="#000"], [bgcolor="#202124"], [bgcolor="#3c4043"],
[bgcolor="#1a1a1a"], [bgcolor="#2d2d2d"] {
background-color: #3c4043 !important;
}
div, td, th, p, span, li, h1, h2, h3, h4, h5, h6, table {
border-color: color-mix(in srgb, ${r7} 25%, transparent) !important;
}
`}function ll(){return`
body p, body span, body div, body td, body th, body li, body font,
body h1, body h2, body h3, body h4, body h5, body h6,
body label, body strong, body b, body em, body i, body u,
body center, body blockquote, body pre {
color: ${r7} !important;
}
body a, body a * {
color: ${r9} !important;
}
[color], font[color] {
color: ${r7} !important;
}
`}let li=/background(?:-color)?\s*:\s*(?:#(?:fff(?:fff)?|fefefe|f[ef][ef][ef](?:ff)?)|white|rgb\(\s*255\s*,\s*255\s*,\s*255\s*\)|rgba\(\s*255\s*,\s*255\s*,\s*255\s*,[^)]+\))/gi,lo=/background(?:-color)?\s*:\s*(?:#(?:000(?:000)?|202124|3c4043|1a1a1a|2d2d2d)|black|rgb\(\s*0\s*,\s*0\s*,\s*0\s*\))/gi,lc=/(?<!background-)(?<!border-)color\s*:\s*(?:#[0-9a-f]{3,8}\b|rgb\(\s*[\d.,\s%]+\s*\)|rgba\(\s*[\d.,\s%]+\s*\)|[a-z]{3,20})\b/gi,ld=/background(?:-color)?\s*:\s*(?:#[0-9a-f]{3,8}\b|rgb\(\s*[\d.,\s%]+\s*\)|rgba\(\s*[\d.,\s%]+\s*\)|[a-z]{3,20})\b/gi,lu={display:"block",background:"transparent"};function lm({text:e}){let t=(0,n.useRef)(null),{resolvedTheme:s}=(0,rS.D)();return(0,n.useEffect)(()=>{let s=t.current;if(!s)return;let a=s.contentDocument;if(!a)return;let n=document.documentElement.classList.contains("dark");a.open(),a.write(`<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline';">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
color-scheme: ${n?"dark":"light"};
background: transparent !important;
}
html, body {
background: transparent !important;
overflow: hidden;
white-space: normal;
word-wrap: break-word;
}
body {
font-family: ${la};
font-size: 22px;
line-height: 1.3;
color: ${n?r7:le} !important;
padding: 0;
}
</style>
</head>
<body>${e.replace(/</g,"&lt;").replace(/>/g,"&gt;")}</body>
</html>`),a.close()},[e,s]),(0,a.jsx)("iframe",{ref:t,sandbox:"allow-same-origin",title:"Sujet du message",className:"pointer-events-none w-full border-0 bg-transparent",style:{...lu,height:"32px"},tabIndex:-1})}let lh={inbox:"Bo\xeete de r\xe9ception",starred:"Suivis",snoozed:"En attente",important:"Important",sent:"Messages envoy\xe9s",drafts:"Brouillons",spam:"Spam",trash:"Corbeille"};function lx({email:e,isSpamMessage:t,onNotSpam:s,onPrint:n,onNavigateToLabel:r,showLabelChip:l,labelBgByText:i,emailLabelToSidebarFolderId:o={},getNavItemPrefs:c=()=>({messages:"show"}),folderTree:d,labelRows:u,currentFolderId:m}){return(0,a.jsxs)("div",{className:(0,ec.cn)("flex items-start gap-3 px-6 py-4 max-sm:px-4",eo.$p),children:[(0,a.jsx)("div",{className:"min-w-0 flex-1",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(lm,{text:e.subject}),i&&r?(0,a.jsx)(t7,{variant:"header",labels:e.labels,labelBgByText:i,emailLabelToSidebarFolderId:o,getNavItemPrefs:c,labelRows:u,folderTree:d,currentFolderId:m,onLabelNavigate:r,showLabel:l,resolveDisplayName:e=>lh[e]??e,showRemoveOnPills:!0,spamChip:t&&s?{onNotSpam:s}:void 0}):null]})}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:(0,ec.cn)("h-8 w-8",eo.RA),"aria-label":"Imprimer",onClick:()=>n?.(),children:(0,a.jsx)(r6.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:(0,ec.cn)(eo.Bh,"text-xs"),children:"Imprimer tout"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:(0,ec.cn)("h-8 w-8",eo.RA),"aria-label":"Ouvrir dans une nouvelle fen\xeatre",children:(0,a.jsx)(nl.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:(0,ec.cn)(eo.Bh,"text-xs"),children:"Dans une nouvelle fen\xeatre"})]})]})]})}var lf=s(65153),lp=s(14310),lb=s(85911),lg=s(20507),lv=s(61856),lj=s(71809),lw=s(20804),ly=s(73890);function lk({action:e,messageId:t}){let s=(0,st.n)({mutationFn:e=>ss.uE.post(`/mail/messages/${e}/list-unsubscribe-mailto`)}),[r,l]=(0,n.useState)(!1),[i,o]=(0,n.useState)(null);if("http"===e.kind)return(0,a.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Se d\xe9sabonner de cet exp\xe9diteur"});let c=async()=>{o(null);try{await s.mutateAsync(t),l(!0)}catch(e){o(e instanceof Error?e.message:"\xc9chec de lenvoi")}};return r?(0,a.jsxs)("span",{className:"text-muted-foreground",children:["Demande de d\xe9sinscription envoy\xe9e \xe0 ",e.mailto.address]}):(0,a.jsxs)("span",{className:"inline-flex flex-col gap-1",children:[(0,a.jsx)("button",{type:"button",onClick:()=>void c(),disabled:s.isPending,className:"text-left text-primary hover:underline disabled:opacity-60",children:s.isPending?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)(rK.A,{className:"size-3.5 animate-spin"}),"Envoi"]}):"Se d\xe9sabonner de cet exp\xe9diteur"}),i?(0,a.jsx)("span",{className:"text-destructive",children:i}):null]})}function lN({label:e,children:t}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("dt",{className:"text-right text-muted-foreground",children:e}),(0,a.jsx)("dd",{className:"min-w-0 text-foreground",children:t})]})}function lC({summary:e,details:t,open:s,onOpenChange:r,isSpam:l,messageId:i}){let o=(0,n.useRef)(null),c=()=>{o.current&&(clearTimeout(o.current),o.current=null)},d=()=>{c(),o.current=setTimeout(()=>r(!1),150)},u=()=>{c()};return(0,n.useEffect)(()=>()=>c(),[]),(0,n.useEffect)(()=>{s||c()},[s]),(0,a.jsxs)(a6.AM,{open:s,onOpenChange:r,children:[(0,a.jsx)(a6.Wv,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",className:"flex min-w-0 max-w-full items-center gap-0.5 text-xs text-muted-foreground hover:text-foreground",onClick:e=>e.stopPropagation(),onMouseEnter:u,onMouseLeave:()=>{s&&d()},children:[(0,a.jsx)("span",{className:"min-w-0 truncate",children:e}),(0,a.jsx)(eV.A,{className:(0,ec.cn)("h-3 w-3 shrink-0 transition-transform",s&&"rotate-180"),"aria-hidden":!0})]})}),(0,a.jsx)(a6.hl,{align:"start",side:"bottom",className:"w-[min(100vw-2rem,28rem)] p-4",onClick:e=>e.stopPropagation(),onPointerDownOutside:()=>r(!1),onInteractOutside:()=>r(!1),onEscapeKeyDown:()=>r(!1),onMouseEnter:u,onMouseLeave:d,children:(0,a.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-xs leading-snug",children:[(0,a.jsx)(lN,{label:"de :",children:t.fromLine}),t.replyToLine?(0,a.jsx)(lN,{label:"r\xe9pondre \xe0 :",children:t.replyToLine}):null,(0,a.jsx)(lN,{label:"\xe0 :",children:t.toLine}),(0,a.jsx)(lN,{label:"date :",children:(0,a.jsx)(nx,{iso:t.dateIso,variant:"detail"})}),(0,a.jsx)(lN,{label:"objet :",children:t.subject}),t.mailedBy?(0,a.jsx)(lN,{label:"envoy\xe9 par :",children:t.mailedBy}):null,t.signedBy?(0,a.jsx)(lN,{label:"sign\xe9 par :",children:t.signedBy}):null,t.unsubscribe?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("dt",{className:"text-right text-muted-foreground",children:"se d\xe9sabonner :"}),(0,a.jsx)("dd",{children:(0,a.jsx)(lk,{action:t.unsubscribe,messageId:i})})]}):null,(0,a.jsx)("dt",{className:"text-right text-muted-foreground",children:"s\xe9curit\xe9 :"}),(0,a.jsxs)("dd",{className:"space-y-1",children:[!0===t.dkimPass?(0,a.jsx)("p",{children:"Signature DKIM conforme"}):!1===t.dkimPass?(0,a.jsx)("p",{className:"text-amber-700 dark:text-amber-400",children:"Signature DKIM non conforme"}):null,t.tls?(0,a.jsxs)("p",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(rk.A,{className:"size-3.5 shrink-0 text-muted-foreground"}),"Chiffrement standard (TLS)"]}):null,(0,a.jsx)("p",{className:"text-muted-foreground",children:"Chiffrement PGP : non disponible pour l'instant"}),l?(0,a.jsx)("p",{className:"text-destructive",children:"Ce message est marqu\xe9 comme spam"}):null]})]})})]})}let lS=eo.nr,lA="size-[18px] shrink-0 text-muted-foreground";function lM({sender:e,senderEmail:t,headerDetails:s,dateIso:r,isSpam:l,isLast:i,starred:o,onToggleStar:c,onCollapse:d,onPrintConversation:u,onReply:m,onForward:h,detailsOpen:x,onDetailsOpenChange:f,messageId:p}){let b=(0,eS.ms)(e),[g,v]=(0,n.useState)(!1),j=f??v;return(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:(0,ec.cn)("flex items-start gap-3 px-4 py-3",!i&&"cursor-pointer"),onClick:i?void 0:()=>{j(!1),d?.()},children:[l?(0,a.jsx)("div",{className:"flex h-10 w-10 shrink-0 self-start items-center justify-center rounded-full bg-muted text-amber-600","aria-label":"Exp\xe9diteur ou message suspect (spam)",children:(0,a.jsx)(lp.A,{className:"size-[22px]",strokeWidth:2,"aria-hidden":!0})}):(0,a.jsx)("div",{className:"flex h-10 w-10 shrink-0 self-start items-center justify-center rounded-full text-sm font-bold text-white",style:{backgroundColor:(0,eS.V7)(b)},children:(0,eS.w7)(b)}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 flex flex-col gap-1","data-selectable-text":!0,children:[(0,a.jsx)("div",{className:"min-w-0 truncate text-sm leading-snug",children:(0,a.jsxs)(nd,{displayName:e,email:t,onTriggerClick:i?void 0:e=>e.stopPropagation(),className:"inline min-w-0 max-w-full align-baseline",children:[(0,a.jsx)("span",{className:"font-semibold text-foreground",children:b}),t?(0,a.jsxs)("span",{className:"text-muted-foreground",children:[" <",t,">"]}):null]})}),(0,a.jsx)("div",{className:"flex min-w-0 items-center gap-1",children:(0,a.jsx)(lC,{summary:s.recipientSummary,details:s,open:x??g,onOpenChange:j,isSpam:l,messageId:p})})]}),(0,a.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-1 self-start pt-0.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(nx,{iso:r,variant:"preview",className:"hidden text-xs text-muted-foreground sm:inline"}),c?(0,a.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),c()},className:"flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground/60 hover:bg-black/4 hover:text-muted-foreground","aria-label":o?"Retirer des favoris":"Marquer comme favori",children:(0,a.jsx)(aZ.A,{strokeWidth:1.25*!o,className:(0,ec.cn)("size-4",o?"fill-amber-300 stroke-none text-amber-300":"fill-transparent stroke-muted-foreground/60")})}):(0,a.jsx)(aZ.A,{strokeWidth:1.25,className:"ml-1 size-4 fill-transparent stroke-muted-foreground/60"}),(0,a.jsxs)(aU.m_,{delayDuration:400,children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:(0,ec.cn)("h-8 w-8",eo.RA),"aria-label":"R\xe9pondre",onClick:e=>{e.stopPropagation(),m?.()},children:(0,a.jsx)(C.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:(0,ec.cn)(eo.Bh,"text-xs"),children:"R\xe9pondre"})]}),(0,a.jsxs)(z.rI,{children:[(0,a.jsx)(z.ty,{asChild:!0,children:(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:(0,ec.cn)("h-8 w-8",eo.RA),"aria-label":"Plus d'actions",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(th.A,{className:"h-[18px] w-[18px]",strokeWidth:1.5})})}),(0,a.jsxs)(z.SQ,{align:"end",sideOffset:4,className:lS,children:[(0,a.jsxs)(z._2,{onSelect:()=>{m?.()},children:[(0,a.jsx)(C.A,{className:lA,strokeWidth:1.5}),"R\xe9pondre"]}),(0,a.jsxs)(z._2,{onSelect:()=>{h?.()},children:[(0,a.jsx)(a4.A,{className:lA,strokeWidth:1.5}),"Transf\xe9rer"]}),(0,a.jsx)(z.mB,{}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(en.A,{className:lA,strokeWidth:1.5}),"Supprimer"]}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(aD.A,{className:lA,strokeWidth:1.5}),"Marquer comme non lus \xe0 partir d'ici"]}),(0,a.jsx)(z.mB,{}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(rQ.A,{className:lA,strokeWidth:1.5}),"Bloquer \xab ",b," \xbb"]}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(ea.A,{className:lA,strokeWidth:1.5}),"Signaler comme spam"]}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(lb.A,{className:lA,strokeWidth:1.5}),"Signaler comme hame\xe7onnage"]}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(lg.A,{className:lA,strokeWidth:1.5}),"Signaler un contenu ill\xe9gal"]}),(0,a.jsx)(z.mB,{}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(eh.A,{className:lA,strokeWidth:1.5}),"Filtrer les messages similaires"]}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(lv.A,{className:lA,strokeWidth:1.5}),"Traduire"]}),(0,a.jsxs)(z._2,{onSelect:()=>{u?.()},children:[(0,a.jsx)(r6.A,{className:lA,strokeWidth:1.5}),"Imprimer"]}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(lj.A,{className:lA,strokeWidth:1.5}),"T\xe9l\xe9charger le message"]}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(lw.A,{className:lA,strokeWidth:1.5}),"Afficher l'original"]}),(0,a.jsxs)(z._2,{children:[(0,a.jsx)(ly.A,{className:lA,strokeWidth:1.5}),"Partager pour aider \xe0 am\xe9liorer Google"]})]})]})]}),(0,a.jsx)(nx,{iso:r,variant:"previewShort",className:"text-xs text-muted-foreground sm:hidden"})]})]})})}let lI=/(^|\n)\s*(Le\s.+a\sécrit\s*:|On\s.+wrote:|Am\s.+schrieb|El\s.+escribió|Il\s.+ha\s+scritto|.+a écrit\s*:)/i,lE=/(?:^|[\s.])(Le\s.+?a\s+écrit\s*:|On\s+.+?\bwrote:|Am\s+.+?\bschrieb|El\s+.+?\bescribió|Il\s+.+?\bha\s+scritto|.+?\ba\s+écrit\s*:)/i,lz='.gmail_quote,.gmail_extra,.protonmail_quote,.yahoo_quoted,.moz-cite-prefix,#divRplyFwdMsg,blockquote[type="cite"],blockquote.gmail_quote';function l$(e){return!!e?.trim()&&lI.test(e.trim())}function lL(e,t){let s=e.createElement("div");return s.appendChild(t),s.innerHTML.trim()}function lD(e){let t=lE.exec(e);if(!t||void 0===t.index)return -1;let s=t.index,a=t[0][0];return a&&/\s/.test(a)&&(s+=1),s}let lT=/\s(?:src|srcset|data-src|data-original|data-srcset|poster|background|data)\s*=\s*["']?(?:https?:\/\/|\/\/)/i,l_=/\s(?:src|srcset|data-src|data-original|href|background|poster)\s*=\s*["'](?!https?:|\/\/|data:|cid:|mailto:|#|javascript:)([^"']+)["']/i,lR=/<link[^>]+href\s*=\s*["']?(?:https?:\/\/|\/\/)/i,lP=/url\s*\(\s*['"]?(?:https?:\/\/|\/\/|[^'"data:#][^'")]*)/i;function lF(e){return!!e?.trim()&&(!!(lT.test(e)||l_.test(e)||lR.test(e)||lP.test(e))||!!/<!DOCTYPE|<html[\s>]/i.test(e)&&(/<img\b/i.test(e)||/<link[^>]+rel=["']?stylesheet/i.test(e)||/<style\b/i.test(e)))}var lO=s(84398);let lq=(0,ek.v)()((0,sm.Zr)((e,t)=>({trustedSenderEmails:[],allowedMessageIds:[],trustSender:s=>{let a=(0,nc.e0)(s);!a||t().trustedSenderEmails.includes(a)||e(e=>({trustedSenderEmails:[...e.trustedSenderEmails,a]}))},allowMessageRemoteContent:s=>{let a=s.trim();!a||t().allowedMessageIds.includes(a)||e(e=>({allowedMessageIds:[...e.allowedMessageIds,a]}))}}),{name:"ultimail-trusted-senders",storage:sh.$}));var lW=s(98306);let lB="data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="120" height="80" viewBox="0 0 120 80"><rect width="120" height="80" fill="#e8eaed"/><path d="M36 52l14-18 12 14 10-12 22 26H36z" fill="#9aa0a6"/><circle cx="46" cy="32" r="8" fill="#9aa0a6"/></svg>');function lU(e){let t=e.trim();return t.toLowerCase().startsWith("cid:")&&(t=t.slice(4).trim()),t=t.replace(/^<|>$/g,"").trim()}async function lH(e){let[t,s]=await Promise.all([ss.uE.get(`/mail/messages/${e}/attachments/cid-map`),ss.uE.get(`/mail/messages/${e}/attachments`)]),a={...t?.cid_map??{}};for(let e of s?.attachments??[])!function(e,t){if(t.is_inline&&t.id){if(t.content_id){let s=lU(t.content_id);e[s]=t.id,e[s.toLowerCase()]=t.id,e[`cid:${s}`]=t.id,e[`cid:${s.toLowerCase()}`]=t.id}if(t.filename){let s=lU(t.filename.includes("/")?t.filename.split("/").pop():t.filename);e[s]=t.id,e[s.toLowerCase()]=t.id,e[`cid:${s}`]=t.id,e[`cid:${s.toLowerCase()}`]=t.id}}}(a,e);return a}function lV(e){return Math.max(120,4*Math.ceil(e/4)+8)}function lK(e){return e.querySelector("[data-ultimail-measure-root]")??e.body}let lQ=/^on/i,lG=/^(?:href|src|srcset|data|action|formaction|xlink:href)$/i,lY=/^javascript:/i,lZ=/^https?:\/\//i,lJ=/^\/\//;function lX(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function l0(e,t){let s=e.trim();if(!s||s.startsWith("data:")||s.startsWith("cid:")||s.startsWith("mailto:")||s.startsWith("#"))return s;if(lZ.test(s))return s.startsWith("http://")?`https://${s.slice(7)}`:s;if(lJ.test(s))return`https:${s}`;if(!t)return s;try{let e=new URL(s,t).href;return e.startsWith("http://")?`https://${e.slice(7)}`:e}catch{return s}}function l1(e){if("link"!==e.tagName.toLowerCase())return!1;let t=(e.getAttribute("rel")??"").toLowerCase(),s=(e.getAttribute("type")??"").toLowerCase();return t.includes("stylesheet")||"text/css"===s}let l2=["data-src","data-original","data-lazy-src","data-url","data-href","data-image","originalsrc"];function l3(e){for(let t of l2){let s=e.getAttribute(t)?.trim();if(s)return s}return null}function l5(e,t){if(!e.trim())return{headMarkup:"",bodyHtml:""};if("u"<typeof DOMParser)return{headMarkup:"",bodyHtml:e};try{let s=new DOMParser().parseFromString(e,"text/html"),a=s.querySelector("base[href]")?.getAttribute("href")??void 0,n=a?l0(a,void 0):void 0;s.querySelector("base[href]")?.remove();let r=function(e,t){let s=[];for(let a of[...e.head.querySelectorAll("style, link[rel]"),...e.body.querySelectorAll("style, link[rel]")]){if("style"===a.tagName.toLowerCase()){s.push(a.outerHTML),a.remove();continue}if(l1(a)){let e=a.getAttribute("href");e&&t&&a.setAttribute("href",l0(e,t)),s.push(a.outerHTML),a.remove()}}return s.join("\n")}(s,t),l=s.body?.innerHTML?.trim()??"";return l||(l=e.trim()),{headMarkup:r,bodyHtml:l,documentBaseHref:n,resolveBaseHref:t}}catch{return{headMarkup:"",bodyHtml:e}}}function l4(e,t){return e.split(",").map(e=>{let s=e.trim(),a=s.indexOf(" "),n=-1===a?s:s.slice(0,a),r=-1===a?"":s.slice(a+1),l=l0(n,t);return r?`${l} ${r}`:l}).join(", ")}function l6(e,t){return e.replace(/url\s*\(\s*['"]?([^'")]+)['"]?\s*\)/gi,(e,s)=>{let a=s.trim();return a.startsWith("data:")||a.startsWith("#")||a.startsWith("cid:")?`url(${a})`:`url(${l0(a,t)})`})}let l8=/url\s*\(\s*['"]?(?:https?:\/\/|\/\/|[^'"data:#][^'")]*)/i;function l7(e){return e.replace(/url\s*\(\s*['"]?([^'")]+)['"]?\s*\)/gi,(e,t)=>{let s=t.trim();return s.startsWith("data:")||s.startsWith("#")||s.startsWith("cid:")?`url(${s})`:lZ.test(s)||lJ.test(s)?"url(about:blank)":`url(${s})`})}function l9(e){let t=e.trim();if(!t)return"";let s=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`<div class="ultimail-plain-fallback" style="margin:0 0 16px;padding:12px 14px;border-radius:8px;background:var(--muted,#f1f3f4);color:inherit"><pre style="white-space:pre-wrap;font:14px/1.5 inherit;margin:0">${s}</pre></div>`}function ie(e){let t=e.trim();return lZ.test(t)||lJ.test(t)||!t.startsWith("data:")&&!t.startsWith("cid:")&&!t.startsWith("mailto:")&&!t.startsWith("#")&&!t.startsWith("javascript:")}function it(e,t){if(!e.trim()||"u"<typeof DOMParser||!e.includes("cid:"))return e;let s=e=>{let s;return(s=e.trim()).toLowerCase().startsWith("cid:")?function(e,t){let s=lU(t);if(s)return e[s]??e[s.toLowerCase()]??e[`cid:${s}`]??e[`cid:${s.toLowerCase()}`]}(t??{},s)??lB:s},a=["src","data-src","data-original","data-lazy-src","background","poster"];try{let t=new DOMParser().parseFromString(e,"text/html");for(let e of t.querySelectorAll("img, video, source, table, td, th, div, span")){for(let t of a){let a=e.getAttribute(t);a?.toLowerCase().includes("cid:")&&e.setAttribute(t,a.replace(/cid:[^\s'")]+/gi,e=>s(e)))}let t=e.getAttribute("srcset");t?.includes("cid:")&&e.setAttribute("srcset",t.replace(/cid:[^\s,]+/gi,e=>s(e)))}for(let e of t.querySelectorAll("[style]")){let t=e.getAttribute("style");t?.includes("cid:")&&e.setAttribute("style",t.replace(/cid:[^\s'")]+/gi,e=>s(e)))}return t.body.innerHTML}catch{return e}}function is(e,t){let s=t?.trim();return!s||function(e,t=24){if(!e.trim()||"u"<typeof DOMParser)return e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().length>=t;try{let s=new DOMParser().parseFromString(e,"text/html");return(s.body?.textContent??"").replace(/\s+/g," ").trim().length>=t}catch{return!1}}(e)?e:l9(s)+(e||"")}var ia=s(82108);let ir="div,p,span,td,th,li,h1,h2,h3,h4,h5,h6,font,label,strong,b,em,i,u,center,table",il="p,span,td,th,div,li,a,h1,h2,h3,h4,h5,h6,font,label,strong,b,em",ii={white:[255,255,255],black:[0,0,0],transparent:[0,0,0]};function io(e){let t=e.trim().toLowerCase();if(!t||"transparent"===t)return null;let s=ii[t];if(s)return s;let a=t.match(/^#([0-9a-f]{3,8})$/);if(a){let e=a[1];if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}let n=t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)$/);return n?(void 0!==n[4]?Number(n[4]):1)<.08?null:[Number(n[1]),Number(n[2]),Number(n[3])]:null}function ic([e,t,s]){let a=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*a(e)+.7152*a(t)+.0722*a(s)}function id(e,t){let s=ic(e),a=ic(t);return(Math.max(s,a)+.05)/(Math.min(s,a)+.05)}function iu(e,t){let s,a=t.getComputedStyle(e),n=io(a.backgroundColor);if(n)return{rgb:n,css:a.backgroundColor};let r=(s=e.getAttribute("bgcolor")?.trim())?io(s.startsWith("#")?s:`#${s}`)??io(s):null;return r?{rgb:r,css:e.getAttribute("bgcolor")??""}:!function(e){if(!e||"none"===e)return!1;let t=e.toLowerCase();return!(t.includes("url(")||!t.includes("gradient")||t.includes("#000")||t.includes("rgb(0,")||t.includes("rgb(0 ")||t.includes(", 0,")||t.includes("black"))&&(t.includes("#fff")||t.includes("white")||t.includes("rgb(255")||/#[ef][0-9a-f]{5}/i.test(t)||t.includes("#f")||t.includes("rgb(24")||t.includes("rgb(23")||t.includes("rgb(22")||t.includes("rgb(236")||t.includes("rgb(239")||t.includes("rgb(245"))}(a.backgroundImage)?null:{rgb:[245,247,250],css:a.backgroundImage}}function im(e,t,s){return Math.min(Math.max(e,t),s)}function ih(e,t,s,a){let n=function(e,t,s){let a=e.getBoundingClientRect();if(a.width<1||a.height<1)return null;let n=im(a.left+a.width/2,0,Math.max(0,s.innerWidth-1)),r=im(a.top+Math.min(14,.2*a.height),0,Math.max(0,s.innerHeight-1)),l=t.elementFromPoint(n,r);if(!l||l===t.documentElement)return null;for(;l&&l!==t.body;){let e=iu(l,s);if(e)return{...e,source:l};l=l.parentElement}return null}(e,t,s);if(n)return n;let r=function(e,t,s){let a=e;for(;a&&a!==t.documentElement;){let e=iu(a,s);if(e)return{...e,source:a};a=a.parentElement}let n=iu(t.body,s);return n?{...n,source:t.body}:null}(e,t,s);return r?r:{rgb:!0===a.newsletterLightCanvas?[255,255,255]:a.assumedCanvasRgb??[32,33,36],css:"(assumed-canvas)",source:t.body,isAssumedCanvas:!0}}function ix(e,t,s=3){let a=ic(e),n=ic(t),r=id(e,t);if(n>.8&&a>.55)return"light-surface";if(n<.22&&a<.48)return"dark-surface";if(r<s){if(n>.72&&a>.5)return"light-surface";if(n<.28&&a<.52)return"dark-surface"}return null}let ip="ultimail-contrast-repair";function ib(){return"1"===ia.env.NEXT_PUBLIC_EMAIL_PREVIEW_CONTRAST_DEBUG}let ig={display:"block",background:"transparent",overflow:"hidden"};function iv({html:e,blockRemoteContent:t,restrictPopups:s=!1,senderEmail:r,cidUrlMap:l,plainTextFallback:i,messageId:o,previewPart:c="body"}){let d=(0,n.useRef)(null),u=(0,n.useRef)(null),m=(0,n.useRef)(null),h=(0,n.useRef)(null),x=(0,n.useRef)(null),f=(0,n.useRef)(0),p=(0,n.useRef)(120),b=(0,n.useRef)(null),[g,v]=(0,n.useState)(120),{resolvedTheme:j}=(0,rS.D)(),w="dark"===j||("system"===j||void 0===j)&&"u">typeof document&&document.documentElement.classList.contains("dark"),y=(0,n.useMemo)(()=>(function(e,t){var s,a,n,r,l;if(!e.trim()){let e=t.plainTextFallback?.trim();return e?{headMarkup:"",bodyHtml:l9(e)}:{headMarkup:"",bodyHtml:""}}let i=function(e){let t=e.match(/<base[^>]+href=["']([^"']+)["']/i);if(t?.[1])try{return new URL(t[1]).href}catch{return t[1]}let s=e.match(/<link[^>]+rel=["'][^"']*stylesheet[^"']*["'][^>]+href=["']([^"']+)["']/i)??e.match(/<link[^>]+href=["']([^"']+)["'][^>]+rel=["'][^"']*stylesheet/i);if(s?.[1])try{let e=new URL(s[1],"https://example.com/");if(s[1].startsWith("http")||s[1].startsWith("//"))return`${e.origin}${e.pathname.replace(/\/[^/]*$/,"/")}`}catch{}let a=e.match(/(?:src|href)=["'](https?:\/\/[^/"']+)[^"']*["']/i);if(a?.[1])try{let e=new URL(a[1]);return`${e.origin}/`}catch{}}(e)??(t.senderEmail?`https://${t.senderEmail.split("@")[1]?.trim().toLowerCase()}/`:void 0);if(t.blockRemoteContent){let l,o=l5(e,i),c=(0,r8.E)(o.bodyHtml||e);return c=it((s=c=function(e){if(!e.trim()||"u"<typeof DOMParser)return e;try{let t=new DOMParser().parseFromString(e,"text/html");for(let e of t.querySelectorAll("link"))l1(e)&&e.remove();for(let e of t.querySelectorAll("[style]")){let t=e.getAttribute("style");t&&l8.test(t)&&e.setAttribute("style",l7(t))}for(let e of t.querySelectorAll("[background]")){let t=e.getAttribute("background")?.trim()??"";t&&ie(t)&&e.removeAttribute("background")}for(let e of t.querySelectorAll("img")){let s=e.getAttribute("src")??"",a=l3(e);if(!(s.trim()&&ie(s)&&!s.startsWith("cid:")||a&&ie(a)))continue;let n=e.getAttribute("alt")?.trim();for(let t of["src","srcset","sizes","background",...l2])e.removeAttribute(t);if(e.setAttribute("style",`${e.getAttribute("style")??""};max-width:100%;height:auto;object-fit:contain;background:#e8eaed;border-radius:4px;`.replace(/^;/,"")),n){let s=t.createElement("p");s.setAttribute("style","margin:4px 0 12px;font:13px/1.4 sans-serif;color:#5f6368"),s.textContent=n,e.insertAdjacentElement("afterend",s)}}return t.body.innerHTML}catch{return e}}(c),a=t.isDark,n=l=(0,r8.E)(s),r=l=n.replace(/\sstyle=(["'])([\s\S]*?)\1/gi,(e,t,s)=>{let n,r=(n=s,(n=a?n.replace(ld,"background:transparent").replace(lc,`color:${r7}`):n.replace(lo,"background:#f1f3f4").replace(/(?<!background-)(?<!border-)color\s*:\s*(?:#(?:fff(?:fff)?|e8eaed|f8f9fa)|white|rgb\(\s*255\s*,)/gi,`color:${lt}`)).replace(/;\s*;/g,";").replace(/^;|;$/g,"").trim());return r?` style=${t}${r}${t}`:""}),l=a?r.replace(/\s(color)=(["'])([^"']*)\2/gi,(e,t,s,a)=>"color"!==t.toLowerCase()||!function(e){let t,s=(t=e.trim(),/^#?[0-9a-f]{3,8}$/i.test(t)?t.startsWith("#")?t:`#${t}`:t).toLowerCase();if("black"===s)return!0;let a=s.match(/^#([0-9a-f]{3,8})$/i);if(a){let e=a[1];if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),e.length>=6)return .2126*parseInt(e.slice(0,2),16)+.7152*parseInt(e.slice(2,4),16)+.0722*parseInt(e.slice(4,6),16)<120}let n=s.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return!!n&&.2126*Number(n[1])+.7152*Number(n[2])+.0722*Number(n[3])<120}(a)?e:` color=${s}${r7}${s}`):r,a&&(l=(l=l.replace(li,"background:transparent")).replace(/\sbgcolor=(["'])(?:#?(?:fff(?:fff)?|ffffff|white)|#f[0-9a-f]{5})\1/gi,"")),l),t.cidUrlMap),{headMarkup:it(function(e){if(!e.trim()||"u"<typeof DOMParser)return e.replace(/<link\b[^>]*>/gi,"");try{let t=new DOMParser().parseFromString(`<div id="head-root">${e}</div>`,"text/html").getElementById("head-root");if(!t)return e;for(let e of t.querySelectorAll("link"))l1(e)&&e.remove();for(let e of t.querySelectorAll("style")){let t=e.textContent??"";t&&(e.textContent=l7(t))}return t.innerHTML.trim()}catch{return e.replace(/<link\b[^>]*>/gi,"")}}(o.headMarkup),t.cidUrlMap),bodyHtml:c=is(c,t.plainTextFallback),resolveBaseHref:i}}let o=l5(e,i),c=(0,r8.E)(o.bodyHtml);return c=is(c=it(c=function(e,t={}){let{baseHref:s}=t;if(!e.trim()||"u"<typeof DOMParser)return e;try{let t=new DOMParser().parseFromString(e,"text/html");for(let e of t.querySelectorAll("img")){let t=l3(e),a=e.getAttribute("src")??"",n=!!a.trim()&&!function(e){let t=e.trim().toLowerCase();if(!t||"about:blank"===t||"#"===t)return!0;if(t.startsWith("data:"))return!1;try{let e=new URL(t,"https://example.invalid/").pathname.split("/").pop()??"";return/^(?:spacer|blank|pixel|1x1|clear|dot|transparent|spacer\.gif)\.(?:gif|png|jpe?g|svg|webp)$/i.test(e)}catch{return/(?:^|\/)(?:spacer|blank|pixel|1x1)\.(?:gif|png|jpe?g)/i.test(t)}}(a)&&(a.startsWith("data:")||a.startsWith("cid:")||ie(a));t&&ie(t)&&!n?e.setAttribute("src",l0(t,s)):a.trim()&&(a.startsWith("data:")||a.startsWith("cid:"))||(a&&ie(a)?e.setAttribute("src",l0(a,s)):t&&ie(t)&&e.setAttribute("src",l0(t,s)));let r=e.getAttribute("srcset");r&&e.setAttribute("srcset",l4(r,s));let l=e.getAttribute("data-srcset");l&&!e.getAttribute("srcset")&&e.setAttribute("srcset",l4(l,s)),e.setAttribute("referrerpolicy","no-referrer")}for(let e of t.querySelectorAll("[background]")){let t=e.getAttribute("background");if(!t||!ie(t))continue;let a=l0(t,s);e.removeAttribute("background");let n=e.getAttribute("style")?.trim()??"",r=`background-image:url(${a})`,l=n?n.endsWith(";")?`${n}${r}`:`${n};${r}`:r;e.setAttribute("style",l)}for(let e of t.querySelectorAll("[style]")){let t=e.getAttribute("style");t?.includes("url(")&&e.setAttribute("style",l6(t,s))}for(let e of t.querySelectorAll("source[src], source[srcset]")){let t=e.getAttribute("src");t&&ie(t)&&e.setAttribute("src",l0(t,s));let a=e.getAttribute("srcset");a&&e.setAttribute("srcset",l4(a,s))}return t.body.innerHTML}catch{return e}}(c,{baseHref:i}),t.cidUrlMap),t.plainTextFallback),{headMarkup:it((l=o.headMarkup,l.trim()&&i?l.replace(/(<link[^>]+href=)(["'])([^"']+)\2/gi,(e,t,s,a)=>`${t}${s}${l0(a,i)}${s}`).replace(/(<style[^>]*>)([\s\S]*?)(<\/style>)/gi,(e,t,s,a)=>`${t}${l6(s,i)}${a}`):l),t.cidUrlMap),bodyHtml:c,documentBaseHref:o.documentBaseHref,resolveBaseHref:i}})(e,{blockRemoteContent:t,isDark:w,senderEmail:r,cidUrlMap:l,plainTextFallback:i}),[e,t,w,r,l,i]),k=(0,n.useMemo)(()=>{if(!t){let e=function(e=!1){return`
html {
color-scheme: ${e?"dark":"light"};
background: transparent !important;
}
${ln}
html, body {
margin: 0;
padding: 0;
background: transparent !important;
}
body {
overflow: visible;
word-wrap: break-word;
overflow-wrap: break-word;
font-family: ${la};
font-size: 14px;
line-height: 1.6;
color: ${e?r7:le};
}
a, a * {
color: ${e?r9:ls};
}
img {
max-width: 100%;
height: auto;
}
`}(w);return w?`${e}${lr()}`:e}return`
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
color-scheme: ${w?"dark":"light"};
background: transparent !important;
}
${ln}
html, body {
background: transparent !important;
overflow: visible;
word-wrap: break-word;
overflow-wrap: break-word;
}
body {
font-family: ${la};
font-size: 14px;
line-height: 1.6;
color: ${w?r7:le} !important;
padding: 0;
}
a, a * { color: ${w?r9:ls} !important; }
img { max-width: 100%; height: auto; }
blockquote {
border-left: 3px solid ${w?"#5f6368":"#dadce0"};
padding-left: 12px;
margin: 8px 0;
color: ${w?"#9aa0a6":"#5f6368"} !important;
}
pre, code {
background: ${w?"#3c4043":"#f6f8fa"} !important;
color: ${w?r7:lt} !important;
border-radius: 3px;
font-size: 13px;
}
pre { padding: 12px; overflow-x: auto; }
code { padding: 2px 6px; }
${w?lr():`
[bgcolor="#000000"], [bgcolor="#000"], [bgcolor="#202124"], [bgcolor="#3c4043"],
[bgcolor="#1a1a1a"], [bgcolor="#2d2d2d"] {
background-color: #f1f3f4 !important;
}
[color="#ffffff"], [color="#FFFFFF"], [color="#e8eaed"], [color="#f8f9fa"],
[color="#dadce0"] {
color: ${lt} !important;
}
font[color="#ffffff"], font[color="#FFFFFF"], font[color="#e8eaed"] {
color: ${lt} !important;
}
`}`},[t,w]),N=(0,n.useMemo)(()=>{let e;return e="script-src 'none'",t?`default-src 'none'; ${e}; style-src 'unsafe-inline'; img-src data: blob:;`:["default-src 'none'",e,"style-src 'unsafe-inline' https: http:","style-src-elem 'unsafe-inline' https: http:","style-src-attr 'unsafe-inline' https: http:","img-src https: http: data: blob: cid:","font-src https: http: data:","media-src https: http:","child-src https: http:"].join("; ")},[t]),C=(0,n.useMemo)(()=>{var e;let s,a,n,r,l,o,c;return e={csp:N,wrapperCss:k,plainTextFallback:i,loadAppFont:!t,bodyTailCss:w?t?ll():(s="p,span,div,td,th,li,h1,h2,h3,h4,h5,h6,font,label,strong,b,em,i,u,center,blockquote,pre".split(",").map(e=>`[data-ultimail-light-surface] ${e}`).join(", "),`
${ll()}
${s},
[data-ultimail-light-surface] {
color: ${lt} !important;
}
[data-ultimail-light-surface] a,
[data-ultimail-light-surface] a * {
color: ${ls} !important;
}
`):void 0},a=y.documentBaseHref??y.resolveBaseHref,n=(y.headMarkup??"").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/<script\b[^>]*\/>/gi,""),!(r=function(e){if(!e||!e.trim()||"u"<typeof DOMParser)return e;try{let t=new DOMParser().parseFromString(e,"text/html");for(let e of(t.querySelectorAll("script, iframe, object, embed, frame, frameset, link[rel='import'], link[as='script']").forEach(e=>e.remove()),t.querySelectorAll("svg script").forEach(e=>e.remove()),t.querySelectorAll("noscript"))){let s=t.createDocumentFragment(),a=t.createElement("template");a.innerHTML=e.textContent??"",s.append(...Array.from(a.content.childNodes)),e.replaceWith(s)}for(let e of t.querySelectorAll("*")){for(let t of[...e.attributes]){if(lQ.test(t.name)){e.removeAttribute(t.name);continue}lG.test(t.name)&&lY.test(t.value.trim())&&e.removeAttribute(t.name)}let t=e.getAttribute("style");t&&lY.test(t)&&e.setAttribute("style",t.replace(/javascript:[^;'")]+/gi,"about:blank"))}for(let e of t.querySelectorAll("meta[http-equiv]")){if(e.getAttribute("http-equiv")?.toLowerCase()!=="refresh")continue;let t=e.getAttribute("content")??"";lY.test(t)&&e.remove()}return t.body?.innerHTML??e}catch{return e}}(y.bodyHtml)).trim()&&e.plainTextFallback?.trim()&&(r=l9(e.plainTextFallback)),r.trim()||(r='<p style="color:#3c4043;font:14px ui-sans-serif,system-ui,sans-serif;margin:0">Ce message n\'a pas de contenu affichable.</p>'),l=a?`<base href="${lX(a)}" target="_blank">`:"",o=e.bodyTailCss?`<style data-ultimail-tail="true">${e.bodyTailCss}</style>`:"",c=e.loadAppFont?'<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&display=swap">':"",`<!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${lX(e.csp)}">`+l+c+`<style data-ultimail-wrapper="true">${e.wrapperCss}</style>`+n+"</head><body>"+`<div data-ultimail-measure-root>${r}</div>`+o+"</body></html>"},[y,N,k,i,w,t]),S=`${o??"no-id"}:${c}:${t?"remote-blocked":"remote-allowed"}:${w?"dark":"light"}`,A=(0,n.useCallback)(e=>{if(e!==f.current)return;let t=d.current?.contentDocument;if(!t)return;let s=function(e){let t=lK(e),s=e.defaultView;if(!t||!s)return 120;let a=Math.max(t.scrollHeight,t.offsetHeight,e.body?.scrollHeight??0,e.body?.offsetHeight??0,e.documentElement?.scrollHeight??0,e.documentElement?.offsetHeight??0),n=t.getBoundingClientRect().top,r=n;for(let e of t.querySelectorAll("p,div,span,td,th,li,h1,h2,h3,h4,h5,h6,table,img,blockquote,pre,hr,a,section,article,footer,header")){let t=s.getComputedStyle(e);if("none"===t.display||"hidden"===t.visibility)continue;let a=e.getBoundingClientRect();a.height<1&&a.width<1||(r=Math.max(r,a.bottom))}if(r>n+8){let e=Math.ceil(r-n)+4;return lV(Math.max(e,Math.min(a,e+48)))}return lV(a+2)}(t);p.current!==s&&(p.current=s,v(s))},[]),M=(0,n.useCallback)(e=>{null!==b.current&&cancelAnimationFrame(b.current),b.current=requestAnimationFrame(()=>{b.current=requestAnimationFrame(()=>{b.current=null,A(e)})})},[A]),I=(0,n.useCallback)((e,s,a)=>{if(!w||a!==f.current)return;let n=function(e,t={}){if(!1===t.isDark)return null;let s=e.defaultView,a=e.body;if(!s||!a)return null;let n=t.minRatio??3,r=t.maxScan??800,l=t.repairMode??"all",i={...t,newsletterLightCanvas:t.newsletterLightCanvas??!1,assumedCanvasRgb:t.assumedCanvasRgb??[32,33,36]},o=t.textSelectors??il,c=new Set,d=new Set,u=0;for(let t of a.querySelectorAll(o)){if(u>=r)break;if(u+=1,(t.textContent??"").replace(/\s+/g," ").trim().length<2)continue;let a=io(s.getComputedStyle(t).color);if(!a)continue;let o=ih(t,e,s,i),m=ix(a,o.rgb,n);if(!m||o.isAssumedCanvas&&"light-surface"===m||"dark-only"===l&&"light-surface"===m||"light-only"===l&&"dark-surface"===m)continue;let h="light-surface"===m?c:d;h.size>=48||h.add(t)}if(0===c.size&&0===d.size)return{lightSurfaces:0,darkSurfaces:0};for(let e of c)e.setAttribute("data-ultimail-light-surface","true"),e.removeAttribute("data-ultimail-dark-surface");for(let e of d)e.setAttribute("data-ultimail-dark-surface","true"),e.removeAttribute("data-ultimail-light-surface");return!function(e){let t,s;if(e.getElementById(ip))return;let a=e.createElement("style");a.id=ip,a.setAttribute("data-ultimail-contrast-repair","true"),t=ir.split(",").map(e=>`[data-ultimail-light-surface] ${e}`).join(", "),s=ir.split(",").map(e=>`[data-ultimail-dark-surface] ${e}`).join(", "),a.textContent=`
${t},
[data-ultimail-light-surface] {
color: #202124 !important;
}
[data-ultimail-light-surface] a,
[data-ultimail-light-surface] a * {
color: #1a73e8 !important;
}
${s},
[data-ultimail-dark-surface] {
color: #e8eaed !important;
}
[data-ultimail-dark-surface] a,
[data-ultimail-dark-surface] a * {
color: #8ab4f8 !important;
}
[data-ultimail-light-surface] blockquote {
color: #5f6368 !important;
border-left-color: #dadce0 !important;
}
[data-ultimail-dark-surface] blockquote {
color: #9aa0a6 !important;
border-left-color: #5f6368 !important;
}
`,e.head.appendChild(a)}(e),{lightSurfaces:c.size,darkSurfaces:d.size}}(e,{isDark:!0,repairMode:t?"dark-only":"all",newsletterLightCanvas:!1,assumedCanvasRgb:[32,33,36]});if(n&&(n.lightSurfaces>0||n.darkSurfaces>0)&&(M(a),ib()&&console.info("[email-preview:contrast-repaired]",{messageId:o,part:c,pass:s,blockRemoteContent:t,...n})),!ib())return;let l=`${o??"no-id"}:${c}:${t}:${w}:${C.length}:${s}`;u.current!==l&&(u.current=l,function(e,t,s){if(!ib())return;let a=function(e,t={}){let s=e.defaultView,a=e.body;if(!s||!a)return{issueCount:0,issues:[],hasExternalStyles:!1,scannedElements:0};let n=t.minRatio??3,r=t.maxIssues??20,l=t.maxScan??800,i={...t,newsletterLightCanvas:t.newsletterLightCanvas??!1,assumedCanvasRgb:t.assumedCanvasRgb??[32,33,36]},o=t.textSelectors??il,c=[],d=0;for(let t of a.querySelectorAll(o)){if(d>=l||c.length>=r)break;d+=1;let a=(t.textContent??"").replace(/\s+/g," ").trim();if(a.length<2)continue;let o=s.getComputedStyle(t),u=io(o.color);if(!u)continue;let m=ih(t,e,s,i),h=id(u,m.rgb),x=ix(u,m.rgb,n);(!m.isAssumedCanvas||"light-surface"!==x)&&(h>=n&&"light-surface"!==x||c.push({tag:t.tagName,contrastRatio:Math.round(100*h)/100,color:o.color,backgroundColor:o.backgroundColor,effectiveBackground:m.css,sample:a.slice(0,80),selectorHint:function(e){let t=e.tagName.toLowerCase(),s=e.id?`#${e.id}`:"",a="string"==typeof e.className&&e.className.trim()?`.${e.className.trim().split(/\s+/).slice(0,2).join(".")}`:"";return`${t}${s}${a}`}(t)}))}return{issueCount:c.length,hasExternalStyles:!!(e.querySelector('link[rel~="stylesheet" i]')||e.querySelector("style:not([data-ultimail-wrapper])")),issues:c,scannedElements:d}}(t,{...s,newsletterLightCanvas:e.isDark,assumedCanvasRgb:s?.assumedCanvasRgb??(e.isDark,[255,255,255])});0===a.issueCount||console.warn("[email-preview:low-contrast]",{messageId:e.messageId,part:e.part??"body",blockRemoteContent:e.blockRemoteContent,isDark:e.isDark,senderEmail:e.senderEmail,hasExternalStyles:a.hasExternalStyles,scannedElements:a.scannedElements,issueCount:a.issueCount,issues:a.issues,hint:a.hasExternalStyles&&!e.blockRemoteContent?"Styles exp\xe9diteur apr\xe8s data-ultimail-wrapper — voir fixtures/email-preview/":"Texte clair Ultimail sur fond clair exp\xe9diteur — repair runtime data-ultimail-light-surface"})}({messageId:o,part:c,blockRemoteContent:t,isDark:w,senderEmail:r},e,{newsletterLightCanvas:!1,assumedCanvasRgb:[32,33,36]}))},[o,c,t,w,r,C,M]),E=(0,n.useCallback)(()=>{let e=f.current,t=d.current?.contentDocument,s=t?lK(t):null;h.current?.disconnect(),x.current?.(),x.current=null,s&&(h.current=new ResizeObserver(()=>{M(e)}),h.current.observe(s),x.current=function(e,t){let s=e.querySelectorAll("img");if(0===s.length)return()=>{};let a=0,n=()=>{(a-=1)<=0&&t()};for(let e of s)e.complete||(a+=1,e.addEventListener("load",n,{once:!0}),e.addEventListener("error",n,{once:!0}));return 0===a?()=>{}:()=>{for(let e of s)e.removeEventListener("load",n),e.removeEventListener("error",n)}}(s,()=>{M(e)})),M(e),t&&I(t,"initial",e),null!==m.current&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>{if(m.current=null,e!==f.current)return;let t=d.current?.contentDocument;t&&(M(e),I(t,"delayed",e))},1e3)},[M,I]);return(0,n.useLayoutEffect)(()=>{f.current+=1,p.current=120,v(120),u.current=null,h.current?.disconnect(),h.current=null,x.current?.(),x.current=null,null!==b.current&&(cancelAnimationFrame(b.current),b.current=null),null!==m.current&&(window.clearTimeout(m.current),m.current=null)},[C,o]),(0,a.jsx)("iframe",{ref:d,sandbox:s?"allow-same-origin":"allow-same-origin allow-popups",scrolling:"no",title:"Contenu du message",className:"w-full border-0 bg-transparent",style:{...ig,height:`${g}px`},srcDoc:C,onLoad:E,tabIndex:-1},S)}function ij({onShowOnce:e,onAlwaysShow:t}){return(0,a.jsxs)("p",{className:"mb-3 text-sm leading-snug text-muted-foreground",children:["Le contenu distant a \xe9t\xe9 masqu\xe9\xa0:"," ",(0,a.jsx)("button",{type:"button",onClick:e,className:"text-primary hover:underline",children:"afficher le contenu distant"})," — ",(0,a.jsx)("button",{type:"button",onClick:t,className:"text-primary hover:underline",children:"toujours afficher le contenu distant de cet exp\xe9diteur"})]})}function iw({html:e,isSpam:t,senderEmail:s,messageId:r,collapseQuotedReplies:l=!1,plainTextFallback:i}){let o,c,d,[u,m]=(0,n.useState)(!1),h=nU(),{contacts:x}=(0,no.D)(),f=lq(e=>e.trustedSenderEmails),p=(0,lO.j)(e=>e.blockedSenderEmails),b=lq(e=>e.allowedMessageIds),g=lq(e=>e.trustSender),v=lq(e=>e.allowMessageRemoteContent),j=(0,n.useMemo)(()=>{let e=n_(s);return!!e&&h.some(t=>n_(t)===e)},[s,h]),w=!!(0,nc.VY)(x,s),y=!!(o=(0,nc.e0)(s))&&f.includes(o),k=(0,lO.C)(p,s),N=!!(c=r.trim())&&b.includes(c),{mainHtml:C,quotedHtml:S}=(0,n.useMemo)(()=>{let t;if(!l)return{mainHtml:e,quotedHtml:null};let s=e.trim();if(!s)return{mainHtml:e,quotedHtml:null};if(/^<pre\b/i.test(s)||/<pre\b/i.test(s))return function(e){let t=e.match(/^<pre[^>]*>([\s\S]*)<\/pre>$/i);if(!t)return{mainHtml:e,quotedHtml:null};let s=function(e){let t=e.replace(/ > /g,"\n> "),s=lD(t);if(s>0){let e=t.slice(0,s).trimEnd(),a=t.slice(s).trimStart();e&&a&&(t=`${e}
${a}`)}return t}(t[1].replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")),a=s.split("\n"),n=-1;for(let e=0;e<a.length;e++){let t=a[e];if(/^>/.test(t.trim())||lI.test(t)){n=e;break}}if(n<0){let t=lD(s);if(t<0)return{mainHtml:e,quotedHtml:null};let a=s.slice(0,t).trimEnd(),n=s.slice(t).trimStart();if(!n)return{mainHtml:e,quotedHtml:null};let r=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),l=e=>`<pre style="white-space:pre-wrap;font-family:inherit;margin:0;">${e}</pre>`;return{mainHtml:l(r(a)),quotedHtml:l(r(n))}}let r=a.slice(0,n),l=a.slice(n),i=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),o=i(r.join("\n").trimEnd()),c=i(l.join("\n").trimStart());if(!c.trim())return{mainHtml:e,quotedHtml:null};let d=e=>`<pre style="white-space:pre-wrap;font-family:inherit;margin:0;">${e}</pre>`;return{mainHtml:d(o),quotedHtml:d(c)}}(s);if("u"<typeof DOMParser)return{mainHtml:e,quotedHtml:null};let a=new DOMParser().parseFromString(`<div id="mail-body-root">${s}</div>`,"text/html").getElementById("mail-body-root");return a?(t=function(e){for(let t of lz.split(",")){let s=e.querySelector(t.trim());if(s)return s}for(let t of e.querySelectorAll("blockquote"))if(function(e){if("BLOCKQUOTE"!==e.tagName)return!1;if("cite"===e.getAttribute("type")?.toLowerCase())return!0;let t=e.className?.toString().toLowerCase()??"";if(t.includes("gmail_quote")||t.includes("protonmail"))return!0;let s=e.previousElementSibling;return!!(s&&l$(s.textContent))}(t))return t;for(let t of e.children)if(l$(t.textContent)&&t.textContent.length<500){let e=t.nextElementSibling;if(e&&("BLOCKQUOTE"===e.tagName||e.matches(lz)))return t}return null}(a))?function(e,t){let s,a=e.ownerDocument;if(!a||!e.firstChild)return{mainHtml:e.innerHTML,quotedHtml:null};let n=(s=t.previousElementSibling)&&(l$(s.textContent)||s.classList.contains("gmail_attr"))?s:t;try{let t=a.createRange();t.setStartBefore(e.firstChild),t.setEndBefore(n);let s=t.cloneContents();t.setStartBefore(n);let r=e.lastChild;if(!r)return{mainHtml:e.innerHTML,quotedHtml:null};t.setEndAfter(r);let l=t.cloneContents(),i=lL(a,s),o=lL(a,l);if(!o||!i)return{mainHtml:e.innerHTML,quotedHtml:null};return{mainHtml:i,quotedHtml:o}}catch{return{mainHtml:e.innerHTML,quotedHtml:null}}}(a,t):{mainHtml:a.innerHTML,quotedHtml:null}:{mainHtml:e,quotedHtml:null}},[e,l]),{data:A}=function(e){let{ready:t,authenticated:s}=(0,s8.v)();return(0,lW.I)({queryKey:["message-cid-map",e],enabled:t&&s&&!!e,staleTime:3e5,queryFn:()=>lH(e)})}(r),{mutate:M,isPending:I,isSuccess:E,isError:z}=(d=(0,t3.jE)(),(0,st.n)({mutationFn:()=>ss.uE.post(`/mail/messages/${r}/attachments/reindex`),onSuccess:()=>{r&&(d.invalidateQueries({queryKey:["message-cid-map",r]}),d.invalidateQueries({queryKey:["message-attachments",r]}),d.invalidateQueries({queryKey:["message",r]}))}})),$=function(e){let[t,s]=(0,n.useState)({});return(0,n.useEffect)(()=>{if(!e||0===Object.keys(e).length)return void s({});let t=!1,a=[];return(async()=>{let n={},r=new Map;for(let[t,s]of Object.entries(e)){if(!s)continue;let e=r.get(s);if(!e)try{let t=await ss.uE.getBlob(`/mail/attachments/${encodeURIComponent(s)}/inline`);e=URL.createObjectURL(t),r.set(s,e),a.push(e)}catch{continue}!function(e,t,s){let a=lU(t);a&&(e[a]=s,e[a.toLowerCase()]=s,e[`cid:${a}`]=s,e[`cid:${a.toLowerCase()}`]=s)}(n,t,e)}if(t)for(let e of a)URL.revokeObjectURL(e);else s(n)})(),()=>{for(let e of(t=!0,a))URL.revokeObjectURL(e)}},[e]),t}(A);(0,n.useEffect)(()=>{!/cid:/i.test(C)||Object.keys(A??{}).length>0||I||E||z||M()},[C,A,I,E,z,M]);let L=(0,n.useMemo)(()=>lF(C)||!!S&&lF(S),[C,S]),D=j||w||y||N,T=!j&&!t&&L&&!D,_=!!S&&!u,R={blockRemoteContent:!j&&(t||k||L&&!D),restrictPopups:t,senderEmail:s,cidUrlMap:$,plainTextFallback:i,messageId:r};return(0,a.jsxs)("div",{className:"min-w-0",children:[T?(0,a.jsx)(ij,{onShowOnce:()=>v(r),onAlwaysShow:()=>{g(s),v(r)}}):null,(0,a.jsx)(iv,{html:C,previewPart:"body",...R}),_?(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)("button",{type:"button",onClick:()=>m(!0),className:(0,ec.cn)("inline-flex h-6 min-w-[2rem] items-center justify-center rounded-full","border border-border bg-muted/80 px-2 text-sm font-medium leading-none text-muted-foreground","hover:bg-accent hover:text-foreground"),"aria-label":"Afficher les messages cit\xe9s inclus",children:""})}):null,S&&u?(0,a.jsx)("div",{className:"mt-2 border-t border-border/60 pt-2",children:(0,a.jsx)(iv,{html:S,previewPart:"quoted",...R})}):null]})}var iy=s(35855),ik=s.n(iy),iN=s(91725),iC=s(74230),iS=s(29502),iA=s(24079),iM=s(94658),iI=s(74101),iE=s(2818);function iz(e){if(!e.id||void 0!==e.sizeBytes&&e.sizeBytes>0xf00000)return!1;let t=nw(e.name,e.contentType),s=(0,nv.tF)({name:e.name,mime_type:t});return!!s&&"audio"!==s&&"text"!==s&&("pdf"===s||"image"===s||"video"===s)}function i$(e,t){let a=nw(e.name,e.contentType),r=(0,n.useMemo)(()=>({path:e.drivePath??"/",name:e.name,type:"file",size:e.sizeBytes??0,mime_type:a,last_modified:"",etag:e.id??e.name,is_favorite:!1}),[e.drivePath,e.name,e.sizeBytes,e.id,a]),l=!!e.drivePath&&iz(e)&&((0,nv.ug)(r)||null!==(0,nv.tF)(r)),i=(0,iE.I)(r,t&&l),o=function(e,t){let{ready:a,authenticated:n}=(0,s8.v)(),r=nw(e.name,e.contentType),l=(0,nv.tF)({name:e.name,mime_type:r});return(0,lW.I)({queryKey:["mail","attachment-thumb",e.id,e.name,e.sizeBytes],enabled:a&&n&&t&&iz(e),queryFn:async({client:t,queryKey:a})=>{let n=t.getQueryData(a),i=await ss.uE.getBlob(`/mail/attachments/${e.id}`),o=(0,iM.JX)(i,r,e.name);if("pdf"===l){let{renderMailPdfThumb:e}=await s.e(9965).then(s.bind(s,59965)),t=await e(o);return(0,iI.Qh)(n,{url:t,display:"image"})}return(0,iI.Qh)(n,{url:URL.createObjectURL(o),display:"video"===l?"video":"image"})},staleTime:3e5,gcTime:6e5,retry:1})}(e,t&&!l);return l?i:o}function iL(e="120px"){let t=(0,n.useRef)(null),[s,a]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let s=t.current;if(!s)return;let n=new IntersectionObserver(([e])=>{e?.isIntersecting&&(a(!0),n.disconnect())},{rootMargin:e});return n.observe(s),()=>n.disconnect()},[e]),{ref:t,inView:s}}function iD({kind:e}){return"image"===e?(0,a.jsx)(np.A,{className:"size-11 text-[#9aa0a6]",strokeWidth:1.25,"aria-hidden":!0}):"pdf"===e?(0,a.jsx)("div",{className:"rounded border border-border bg-mail-surface px-4 py-5 shadow-sm","aria-hidden":!0,children:(0,a.jsx)("span",{className:"text-[11px] font-bold leading-none text-[#d93025]",children:"PDF"})}):(0,a.jsx)(nf.A,{className:"size-11 text-[#9aa0a6]",strokeWidth:1.25,"aria-hidden":!0})}function iT({url:e,display:t,onError:s}){return"video"===t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("video",{src:e,muted:!0,playsInline:!0,preload:"metadata",className:"h-full w-full object-cover",onLoadedData:e=>{let t=e.currentTarget;0===t.currentTime&&(t.currentTime=.1)},onError:s}),(0,a.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-black/15","aria-hidden":!0,children:(0,a.jsx)("div",{className:"flex size-9 items-center justify-center rounded-full bg-black/50 shadow-md",children:(0,a.jsx)(iA.A,{className:"ml-0.5 size-4 fill-white text-white"})})})]}):(0,a.jsx)("img",{src:e,alt:"",className:"h-full w-full object-cover",draggable:!1,onError:s})}function i_({attachment:e,className:t}){let s=s2(e.name,e.kind),{ref:r,inView:l}=iL(),[i,o]=(0,n.useState)(!1),c=(0,n.useRef)(!1),d=(0,t3.jE)(),u=iz(e)&&!i,{data:m,isLoading:h}=i$(e,l&&u);(0,n.useEffect)(()=>{c.current=!1,o(!1)},[e.id,e.drivePath,e.name]);let x=!u||i||!m&&!h;return(0,a.jsxs)("div",{ref:r,className:(0,ec.cn)("relative flex h-[132px] shrink-0 flex-col items-center justify-center overflow-hidden bg-linear-to-b from-muted to-muted/70 dark:from-[#3c4043] dark:to-[#303134]",t),children:[x?(0,a.jsx)("div",{className:(0,ec.cn)("flex items-center justify-center",h&&u&&"opacity-40"),children:(0,a.jsx)(iD,{kind:s})}):null,u&&h?(0,a.jsx)("div",{className:"absolute inset-0 animate-pulse bg-muted/80","aria-hidden":!0}):null,u&&m?(0,a.jsx)("div",{className:"absolute inset-0 overflow-hidden bg-[#e8eaed] dark:bg-[#303134]",children:(0,a.jsx)(iT,{url:m.url,display:m.display,onError:()=>{if(!c.current&&m?.url.startsWith("blob:")){c.current=!0,d.invalidateQueries({queryKey:["mail","attachment-thumb",e.id]});return}o(!0)}})}):null]})}function iR({attachment:e,className:t}){let s=s2(e.name,e.kind),{ref:r,inView:l}=iL("80px"),[i,o]=(0,n.useState)(!1),c=iz(e)&&"image"===s,{data:d,isLoading:u}=i$(e,l&&c&&!i);return!c||i?"pdf"===s?(0,a.jsx)(aJ.A,{className:(0,ec.cn)("size-4 shrink-0 text-[#d93025]",t),strokeWidth:1.5,"aria-hidden":!0}):"image"===s?(0,a.jsx)(np.A,{className:(0,ec.cn)("size-4 shrink-0 text-muted-foreground [&_circle]:fill-none [&_path]:fill-none [&_path]:stroke-current [&_rect]:fill-current [&_rect]:opacity-[0.32]",t),strokeWidth:1.5,"aria-hidden":!0}):(0,a.jsx)(nf.A,{className:(0,ec.cn)("size-4 shrink-0 text-[#5f6368]",t),strokeWidth:1.5,"aria-hidden":!0}):(0,a.jsx)("span",{ref:r,className:(0,ec.cn)("relative flex size-6 shrink-0 overflow-hidden rounded-full bg-muted",u&&"animate-pulse",t),children:d?(0,a.jsx)("img",{src:d.url,alt:"",className:"size-full object-cover",draggable:!1,onError:()=>o(!0)}):null})}function iP({attachment:e,kind:t}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i_,{attachment:e}),(0,a.jsxs)("div",{className:"flex min-h-[38px] items-center gap-2 border-t border-border bg-muted px-2 py-1.5",children:["pdf"===t?(0,a.jsx)(aJ.A,{className:"size-4 shrink-0 text-[#d93025]",strokeWidth:1.5,"aria-hidden":!0}):"image"===t?(0,a.jsx)(np.A,{className:"size-4 shrink-0 text-[#1a73e8]",strokeWidth:1.5,"aria-hidden":!0}):(0,a.jsx)(nf.A,{className:"size-4 shrink-0 text-[#5f6368]",strokeWidth:1.5,"aria-hidden":!0}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs leading-tight text-[#3c4043]",children:e.name})]})]})}function iF({folderPath:e}){let t=(0,iS.$9)(e);return(0,a.jsxs)(ik(),{href:(0,iS.PI)(e),className:"inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-md py-1 pl-1 pr-2 text-sm text-primary hover:bg-accent",title:e,children:[(0,a.jsx)(nb.A,{className:"size-[18px] shrink-0",strokeWidth:1.5,"aria-hidden":!0}),(0,a.jsx)("span",{className:"min-w-0 truncate",children:t}),(0,a.jsx)(nl.A,{className:"size-3.5 shrink-0 opacity-70","aria-hidden":!0})]})}function iO(e){return e.some(e=>"clean"===e.virusScanStatus)}function iq(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{"aria-hidden":!0,children:" \xb7 "}),(0,a.jsx)("span",{children:"Analys\xe9 par VirusTotal"}),(0,a.jsxs)(aU.m_,{delayDuration:400,children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-accent","aria-label":"Informations sur l'analyse VirusTotal des pi\xe8ces jointes",children:(0,a.jsx)(lf.A,{className:"size-4",strokeWidth:1.75})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:(0,ec.cn)(eo.Bh,"max-w-xs text-xs"),children:"VirusTotal analyse les pi\xe8ces jointes et les compare \xe0 une base de signatures pour rep\xe9rer les virus et logiciels malveillants."})]})]})}function iW({messageId:e,attachments:t}){let s=t.length,r=(0,h.useRouter)(),[l,i]=(0,n.useState)(!1),o=(0,iC.p)(e),c=t.filter(e=>e.drivePath).length,d=s>0&&c===s,u=0===c,m=(0,n.useMemo)(()=>[...new Set(t.map(e=>e.drivePath).filter(Boolean).map(e=>{let t=e.lastIndexOf("/");return t>0?e.slice(0,t):e}))],[t]);if(0===s)return null;let x=1===s?"Une pi\xe8ce jointe":`${s} pi\xe8ces jointes`,f=s3(t),p=iO(t),b=s=>{t.some(e=>e.id)?ny(t[s])?nk(e,t,s):ng.oR.message("Aper\xe7u non disponible t\xe9l\xe9chargez la pi\xe8ce jointe"):ng.oR.message("Pi\xe8ce jointe non disponible")},g=async e=>{try{await o.mutateAsync(e),i(!1);let t=(0,iS.$9)(e);ng.oR.success(1===s?(0,iS.hM)(e):`${s} pi\xe8ces jointes enregistr\xe9es dans ${t}`,{action:{label:"Ouvrir le dossier",onClick:()=>r.push((0,iS.PI)(e))}})}catch(e){ng.oR.error((0,iS.e5)(e))}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(iN.I,{open:l,onOpenChange:i,title:1===s?"Enregistrer dans UltiDrive":`Enregistrer ${s} pi\xe8ces jointes`,description:"Choisissez un dossier dans votre Drive.",confirmLabel:"Enregistrer ici",pending:o.isPending,onConfirm:g}),(0,a.jsxs)("div",{className:"mt-4 border-t border-border px-4 pb-4 pl-[68px] pt-4 max-sm:pl-4 max-sm:pr-4",children:[(0,a.jsxs)("div",{className:"mb-3 flex min-w-0 flex-wrap items-center justify-between gap-x-3 gap-y-2",children:[(0,a.jsx)("div",{className:"flex min-w-0 max-w-[min(100%,28rem)] items-center gap-1 text-sm text-muted-foreground",children:(0,a.jsxs)("span",{className:"min-w-0 truncate",children:[x,p?(0,a.jsx)(iq,{}):null]})}),d&&1===m.length?(0,a.jsx)(iF,{folderPath:m[0]}):d&&m.length>1?(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2 text-sm text-muted-foreground",children:[(0,a.jsx)(nb.A,{className:"size-[18px] shrink-0 text-primary",strokeWidth:1.5,"aria-hidden":!0}),"Enregistr\xe9 dans UltiDrive (",c,"/",s,")"]}):(0,a.jsxs)("button",{type:"button",className:"flex shrink-0 items-center gap-2 rounded-md py-1 pl-1 pr-2 text-sm font-medium text-primary hover:bg-accent disabled:opacity-50","aria-label":"Ajouter \xe0 UltiDrive",disabled:o.isPending,onClick:()=>i(!0),children:[(0,a.jsx)(nb.A,{className:"size-[18px] shrink-0",strokeWidth:1.5,"aria-hidden":!0}),u?"Ajouter \xe0 UltiDrive":`Ajouter le reste \xe0 UltiDrive (${s-c})`]})]}),(0,a.jsx)("div",{className:f?"flex flex-wrap gap-2 pb-1":"flex flex-nowrap gap-3 overflow-x-auto overflow-y-hidden pb-1 [-webkit-overflow-scrolling:touch]",role:"list","aria-label":"Pi\xe8ces jointes",children:t.map((e,t)=>{let s=s2(e.name,e.kind),n=s4(e.name,e.sizeBytes),r=ny(e);return f?(0,a.jsx)("div",{className:"shrink-0",role:"listitem",children:(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",onClick:()=>b(t),className:"inline-flex max-w-[min(100%,320px)] min-w-0 shrink-0 items-center gap-2 rounded-full border border-border bg-muted py-1.5 pl-2.5 pr-3 text-left text-sm text-foreground shadow-sm transition hover:border-border hover:bg-accent hover:shadow focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",children:[(0,a.jsx)(iR,{attachment:e}),(0,a.jsx)("span",{className:"min-w-0 truncate font-medium",children:e.name}),e.drivePath?(0,a.jsx)(nb.A,{className:"size-3.5 shrink-0 text-primary","aria-label":"Dans UltiDrive"}):null]})}),(0,a.jsxs)(aU.ZI,{side:"bottom",className:(0,ec.cn)(eo.Bh,"max-w-xs whitespace-pre-line text-xs"),children:[n,r?"\nCliquer pour pr\xe9visualiser":"",e.drivePath?`
${(0,iS.c9)(e.drivePath)}`:""]})]})},`${e.id??e.name}-${t}`):(0,a.jsx)("div",{className:"shrink-0",role:"listitem",children:(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",onClick:()=>b(t),className:"flex w-[200px] flex-col overflow-hidden rounded border border-border bg-mail-surface text-left shadow-sm transition hover:border-border hover:shadow-md focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",children:(0,a.jsx)(iP,{attachment:e,kind:s})})}),(0,a.jsxs)(aU.ZI,{side:"bottom",className:(0,ec.cn)(eo.Bh,"max-w-xs whitespace-pre-line text-xs"),children:[n,r?"\nCliquer pour pr\xe9visualiser":"",e.drivePath?`
${(0,iS.c9)(e.drivePath)}`:""]})]})},`${e.id??e.name}-${t}`)})})]})]})}function iB({entries:e}){let t=(0,n.useMemo)(()=>{let t=[];for(let s of e)s.attachments.forEach((e,a)=>{t.push({messageId:s.messageId,senderName:s.senderName,attachments:s.attachments,index:a,attachment:e})});return t},[e]),s=t.length;if(0===s)return null;let r=1===s?"Une pi\xe8ce jointe dans cette conversation":`${s} pi\xe8ces jointes dans cette conversation`,l=s3(t.map(e=>e.attachment)),i=iO(t.map(e=>e.attachment)),o=(e,t,s)=>{if(!t.some(e=>e.id))return void ng.oR.message("Pi\xe8ce jointe non disponible");let a=t[s];a&&ny(a)?nk(e,t,s):ng.oR.message("Aper\xe7u non disponible — t\xe9l\xe9chargez la pi\xe8ce jointe")};return(0,a.jsxs)("div",{className:"mt-2 border-t border-border px-4 pb-4 pl-[68px] pt-4 max-sm:pl-4 max-sm:pr-4",children:[(0,a.jsx)("div",{className:"mb-3 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2",children:(0,a.jsx)("div",{className:"flex min-w-0 max-w-[min(100%,28rem)] items-center gap-1 text-sm text-muted-foreground",children:(0,a.jsxs)("span",{className:"min-w-0 truncate",children:[r,i?(0,a.jsx)(iq,{}):null]})})}),(0,a.jsx)("div",{className:l?"flex flex-wrap gap-2 pb-1":"flex flex-nowrap gap-3 overflow-x-auto overflow-y-hidden pb-1 [-webkit-overflow-scrolling:touch]",role:"list","aria-label":"Pi\xe8ces jointes de la conversation",children:t.map((e,t)=>{let s=s2(e.attachment.name,e.attachment.kind),n=ny(e.attachment),r=[e.senderName,s4(e.attachment.name,e.attachment.sizeBytes),n?"Cliquer pour pr\xe9visualiser":"",e.attachment.drivePath?(0,iS.c9)(e.attachment.drivePath):""].filter(Boolean).join("\n");return l?(0,a.jsx)("div",{className:"shrink-0",role:"listitem",children:(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",onClick:()=>o(e.messageId,e.attachments,e.index),className:"inline-flex max-w-[min(100%,320px)] min-w-0 shrink-0 items-center gap-2 rounded-full border border-border bg-muted py-1.5 pl-2.5 pr-3 text-left text-sm text-foreground shadow-sm transition hover:border-border hover:bg-accent hover:shadow focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",children:[(0,a.jsx)(iR,{attachment:e.attachment}),(0,a.jsx)("span",{className:"min-w-0 truncate font-medium",children:e.attachment.name}),e.attachment.drivePath?(0,a.jsx)(nb.A,{className:"size-3.5 shrink-0 text-primary","aria-label":"Dans UltiDrive"}):null]})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:(0,ec.cn)(eo.Bh,"max-w-xs whitespace-pre-line text-xs"),children:r})]})},`${e.messageId}-${e.attachment.id??e.attachment.name}-${t}`):(0,a.jsx)("div",{className:"shrink-0",role:"listitem",children:(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",onClick:()=>o(e.messageId,e.attachments,e.index),className:"flex w-[200px] flex-col overflow-hidden rounded border border-border bg-mail-surface text-left shadow-sm transition hover:border-border hover:shadow-md focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",children:(0,a.jsx)(iP,{attachment:e.attachment,kind:s})})}),(0,a.jsx)(aU.ZI,{side:"bottom",className:(0,ec.cn)(eo.Bh,"max-w-xs whitespace-pre-line text-xs"),children:r})]})},`${e.messageId}-${e.attachment.id??e.attachment.name}-${t}`)})})]})}let iU=/https?:\/\/[^\s<>"')\]]+/gi;function iH(e){let{bodyText:t}=(0,su.i)(e?.body_text,e?.body_html);return t?.trim()||void 0}function iV(e,t,s){let a=t?.trim()?`<p style="color:var(--muted-foreground);">${t.trim()}</p>`:"";if(s)return a;let n=(0,su.i)(e?.body_text,e?.body_html),r=n.bodyHtml?.trim();if(r)return r;let l=n.bodyText?.trim();if(l){var i;let e=function(e){let t="",s=0;for(let a of e.matchAll(iU)){let n=a.index??0;t+=e.slice(s,n);let r=a[0];t+=`<a href="${r}" target="_blank" rel="noopener noreferrer">${r}</a>`,s=n+r.length}return t+e.slice(s)}(((i=l.trim()).includes("\n")?i:i.replace(/,\s*(Cher(?:e)?\s)/gi,",\n\n$1").replace(/,\s*(Le \d{2}\/\d{2}\/\d{4})/g,",\n\n$1").replace(/\.\s+(Nous restons)/g,".\n\n$1").replace(/\.\s+(L[']équipe)/g,".\n\n$1").replace(/\.\s+(Pour obtenir)/g,".\n\n$1").replace(/\.\s+(Vous pouvez)/g,".\n\n$1")).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"));return`<pre style="white-space:pre-wrap;font-family:inherit;margin:0;line-height:1.5;">${e}</pre>`}if(e){let e=t?.trim();return e?`<p style="color:var(--muted-foreground);">${e}</p>`:'<p style="color:var(--muted-foreground);">Ce message na pas de contenu.</p>'}let o=t?.trim();return o?`<p style="color:var(--muted-foreground);">${o}</p>`:""}function iK({message:e,isExpanded:t,onToggle:s,onPrintConversation:r,onReply:l,onForward:i,selfEmails:o,selfDisplayName:c,collapseQuotedReplies:d=!1,attachments:u=[]}){let[m,h]=(0,n.useState)(!1),x=t||m,{data:f,isPending:p}=(0,se.JX)(x?e.id:null),b=f??e,g=(0,n.useMemo)(()=>nP(b.from,{selfEmails:o,selfDisplayName:c}),[b.from,o,c]),v=(0,n.useMemo)(()=>nJ(b,{selfEmails:o,selfDisplayName:c,subject:e.subject}),[b,o,c,e.subject]),j=(0,n.useMemo)(()=>iV(f,e.snippet,t&&p&&!f),[f,e.snippet,t,p]),w=(0,n.useMemo)(()=>iH(f),[f]),y=(0,sn.XX)(b.flags,b.labels);return t?(0,a.jsx)(iG,{sender:g.name,senderEmail:g.email,headerDetails:v,dateIso:e.date,body:j,isSpam:y,isLast:!1,starred:(0,sn.BB)(e.flags??[]),attachments:u,onCollapse:s,onPrintConversation:r,onReply:l,onForward:i,detailsOpen:m,onDetailsOpenChange:h,collapseQuotedReplies:d,messageId:e.id,plainTextFallback:w}):(0,a.jsx)(iQ,{message:e,senderName:g.name,senderEmail:g.email,attachmentCount:u.length>0?u.length:+!!e.has_attachments,onClick:s})}function iQ({message:e,senderName:t,senderEmail:s,attachmentCount:n=0,onClick:r}){let l=t??e.from[0]?.name??"",i=s??e.from[0]?.address??"",o=(0,eS.ms)(l||i),c=(0,eS.V7)(o);return(0,a.jsxs)("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),r())},className:(0,ec.cn)("group flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors",eo.Cc),children:[(0,a.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-sm font-bold text-white",style:{backgroundColor:c},children:(0,eS.w7)(o)}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 flex flex-col gap-1","data-selectable-text":!0,children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[(0,a.jsx)(nd,{displayName:l,email:i,className:"min-w-0",children:(0,a.jsx)("span",{className:"truncate text-sm font-semibold text-foreground",children:o})}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[n>0?(0,a.jsxs)("span",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",title:1===n?"Une pi\xe8ce jointe":`${n} pi\xe8ces jointes`,children:[(0,a.jsx)(ex.A,{className:"size-3.5 shrink-0",strokeWidth:1.75,"aria-hidden":!0}),n>1?(0,a.jsx)("span",{children:n}):null]}):null,(0,a.jsx)(nx,{iso:e.date,variant:"preview",className:"text-xs text-muted-foreground"}),(0,a.jsx)(aZ.A,{strokeWidth:1.25,className:"ml-1 size-4 fill-transparent stroke-[#c2c2c2]"})]})]}),(0,a.jsx)("p",{className:"min-w-0 truncate text-sm leading-snug text-muted-foreground",children:e.snippet})]})]})}function iG({sender:e,senderEmail:t,headerDetails:s,dateIso:n,body:r,isSpam:l,isLast:i,starred:o,attachments:c=[],onToggleStar:d,onCollapse:u,onPrintConversation:m,onReply:h,onForward:x,detailsOpen:f,onDetailsOpenChange:p,collapseQuotedReplies:b=!1,messageId:g,plainTextFallback:v}){return(0,a.jsxs)("div",{children:[(0,a.jsx)(lM,{sender:e,senderEmail:t,headerDetails:s,dateIso:n,isSpam:l,isLast:i,starred:o,onToggleStar:d,onCollapse:u,onPrintConversation:m,onReply:h,onForward:x,detailsOpen:f,onDetailsOpenChange:p,messageId:g}),(0,a.jsx)("div",{className:(0,ec.cn)("px-4 pl-[68px] max-sm:pl-4 max-sm:pr-4",c.length>0?"pb-0":"pb-4"),"data-selectable-text":!0,children:(0,a.jsx)(iw,{html:r,isSpam:l,senderEmail:t,messageId:g,collapseQuotedReplies:b,plainTextFallback:v})}),c.length>0&&(0,a.jsx)(iW,{messageId:g,attachments:c})]})}function iY({onNotSpam:e}){return(0,a.jsxs)("div",{className:"mx-6 mb-4 flex items-start gap-3 rounded-lg border border-border bg-muted px-4 py-3.5 max-sm:mx-4",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-3",children:[(0,a.jsxs)("p",{className:"text-sm leading-snug text-foreground/80",children:[(0,a.jsx)("span",{className:"font-medium text-foreground",children:"Pourquoi ce message est-il dans le spam ?"})," ","Ce message est semblable \xe0 des messages identifi\xe9s comme spam par le pass\xe9."]}),e&&(0,a.jsx)("button",{type:"button",onClick:e,className:"rounded-md border border-border bg-mail-surface px-4 py-2 text-sm font-medium text-primary shadow-sm transition-colors hover:bg-accent",children:"Signaler comme non-spam"})]}),(0,a.jsxs)(aU.m_,{children:[(0,a.jsx)(aU.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-accent","aria-label":"En savoir plus sur le filtre anti-spam",children:(0,a.jsx)(lf.A,{className:"h-[18px] w-[18px]",strokeWidth:1.75})})}),(0,a.jsx)(aU.ZI,{side:"left",className:(0,ec.cn)(eo.Bh,"max-w-xs text-xs"),children:"Les filtres peuvent se tromper. Si le message est l\xe9gitime, signalez-le comme non-spam pour l'am\xe9liorer."})]})]})}function iZ({email:e,onNavigateToLabel:t,showLabelChip:s,labelBgByText:r,emailLabelToSidebarFolderId:l={},getNavItemPrefs:i=()=>({messages:"show"}),folderTree:o,labelRows:c,currentFolderId:d,isSingleMessageView:u=!1}){let m,{data:h,isPending:x}=(0,se.JX)(e.id),{data:f}=(0,se._W)(e.thread_id??null),p=nU(),b=(0,nH.o)(),g=b?.name,v=(m=sl(),(0,st.n)({mutationFn:async({id:e,flags:t,starred:s})=>{let a=(0,sn.U$)(t,!s);return m.mutateAsync({id:e,flags:a})}})),j=sl(),w=si(),y=h?.flags??e.flags,k=(0,sn.BB)(y),N=(0,sn.XX)(y,h?.labels??e.labels),S=(0,n.useMemo)(()=>iV(h,e.snippet,x&&!h),[h,x,e.snippet]),A=(0,n.useMemo)(()=>iH(h),[h]),[M,I]=(0,n.useState)(!1),[E,z]=(0,n.useState)(!1),$=(0,n.useMemo)(()=>(0,se.Cj)(f),[f]),{before:L,after:T}=(0,n.useMemo)(()=>{var t;let s,a;return t=e.id,(a=(s=[...$].sort((e,t)=>new Date(e.date).getTime()-new Date(t.date).getTime())).findIndex(e=>e.id===t))<0?{before:s.filter(e=>e.id!==t),after:[]}:{before:s.slice(0,a),after:s.slice(a+1)}},[$,e.id]),_=L.length+T.length,R=!u||M,P=R?L:[],F=R?T:[],[O,q]=(0,n.useState)(new Set),W=(0,n.useCallback)(e=>O.has(e),[O]),B=e=>{q(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},U=(0,n.useMemo)(()=>nP(h?.from??e.from,{selfEmails:p,selfDisplayName:g}),[h?.from,e.from,p,g]),H=(0,n.useMemo)(()=>nJ({...e,...h,from:h?.from??e.from,to:h?.to??e.to,cc:h?.cc,subject:e.subject},{selfEmails:p,selfDisplayName:g,subject:e.subject}),[e,h,p,g]),V=(0,n.useMemo)(()=>{var t;let s;return t=(0,se.Cj)(f),s=e.from[0]?.name??"",{id:e.id,sender:s,senderEmail:e.from[0]?.address,subject:e.subject,preview:(0,su.D)(e.snippet)??e.snippet,body:h?.body_html??h?.body_text,date:e.date,read:(0,sn.EP)(e.flags),starred:(0,sn.BB)(e.flags),important:(0,sn.I)(e.flags,e.labels),spam:(0,sn.XX)(e.flags,e.labels),labels:e.labels,hasAttachment:e.has_attachments,conversation:t?.filter(t=>t.id!==e.id).map(e=>({id:e.id,sender:e.from[0]?.name??"",senderEmail:e.from[0]?.address??"",date:e.date,body:e.body_html??e.body_text??"",preview:e.snippet}))}},[e,h,f]),K=(0,n.useMemo)(()=>[...L,h?{...e,...h}:{...e},...T],[L,T,e,h]),{byId:Q,stateById:G}=s7((0,n.useMemo)(()=>K.filter(e=>!1!==e.has_attachments).map(e=>e.id),[K]));!function(e,t,s){let{ready:a,authenticated:r}=(0,s8.v)(),l=(0,t3.jE)(),i=(0,n.useRef)(new Set);(0,n.useEffect)(()=>{if(a&&r)for(let a of e)!(!a.has_attachments||"done"!==s.get(a.id)||(t.get(a.id)?.length??0)>0)&&(i.current.has(a.id)||(i.current.add(a.id),ss.uE.post(`/mail/messages/${a.id}/attachments/reindex`).then(()=>l.invalidateQueries({queryKey:["message-attachments",a.id]})).catch(()=>{})))},[e,t,s,a,r,l])}(K,Q,G);let Y=(0,n.useCallback)(e=>{var t,s;return t={hasAttachment:e.has_attachments},s=Q.get(e.id),G.get(e.id)??"idle",t.attachments?.length?s0(t):s?.length?s0({...t,attachments:s}):(t.hasAttachment,[])},[Q,G]),ee=(0,n.useMemo)(()=>Y(e),[Y,e]),et=(0,n.useMemo)(()=>K.map(e=>{let t=Y(e);if(0===t.length)return null;let s=nP(e.from,{selfEmails:p,selfDisplayName:g});return{messageId:e.id,senderName:s.name,attachments:t}}).filter(e=>null!==e),[K,Y,p,g]),{composeWindows:es}=X(),{savedThreadReplyDrafts:ea}=J(),{openComposeWithInitial:en}=Z(),er=(0,n.useMemo)(()=>es.find(t=>"inline"===t.placement&&t.threadEmailId===e.id),[es,e.id]),el=!!er,ei=!er,ed=(0,n.useRef)(null),eu=(0,n.useRef)(null),em=(0,n.useCallback)(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{eu.current?.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})})})},[]),eh=(0,n.useCallback)(e=>{let t=aS(e);en(t),"inline"===t.placement&&em()},[en,em]),ex=ea[e.id];(0,n.useEffect)(()=>{ex&&!el&&eh({from:ex.from,to:ex.to,cc:ex.cc,bcc:ex.bcc,subject:ex.subject,bodyHtml:ex.bodyHtml,placement:"inline",threadEmailId:ex.threadEmailId,threadKind:ex.threadKind,threading:ex.threading??void 0,showCc:ex.showCc,showBcc:ex.showBcc,signatureId:ex.signatureId??void 0,autoInsertSignature:ex.autoInsertSignature,focusToOnMount:"forward"===ex.threadKind,focusBodyOnMount:"forward"!==ex.threadKind,openedFromSavedThreadDraft:!0})},[e.id,ex,el,eh]);let ef=(0,n.useCallback)(e=>{eh(aA(V,e))},[V,eh]),ep=(0,n.useCallback)(()=>ef("reply"),[ef]),eb=(0,n.useCallback)(()=>ef("forward"),[ef]),eg=D(),ev=(0,eS.ms)(eg.name),ej=(0,n.useMemo)(()=>au(V),[V]),ew=(0,n.useCallback)(()=>{v.mutate({id:e.id,flags:y,starred:k})},[e.id,y,k,v]),ey=(0,n.useCallback)(()=>{(0,sn.Kj)(y,"spam")&&j.mutate({id:e.id,flags:y.filter(e=>"spam"!==e.toLowerCase())}),(0,sn.Ch)(e.labels,"spam")&&w.mutate({id:e.id,labels:(e.labels??[]).filter(e=>"spam"!==e.toLowerCase())})},[e.id,y,e.labels,j,w]),ek=(0,n.useCallback)(()=>{!function(e){let t,s,a=(t=nX(e.subject),s=(function(e){let t=e.conversation??[],s=[];for(let e of t)s.push({fromName:(0,eS.ms)(e.sender),fromEmail:e.senderEmail,date:sO(e.date),bodyHtml:e.body});let a=(0,eS.ms)(e.sender),n=e.senderEmail||`${a.toLowerCase().replace(/\s+/g,".")}@example.com`;return s.push({fromName:a,fromEmail:n,date:sO(e.date),bodyHtml:e.body??`<p style="color:#5f6368;margin:0;">${nX(e.preview)}</p>`}),s})(e).map(e=>`
<article class="msg">
<header class="msg-hdr">
<div class="row"><span class="lbl">De</span><span class="val">${nX(e.fromName)} &lt;${nX(e.fromEmail)}&gt;</span></div>
<div class="row"><span class="lbl">\xc0</span><span class="val">moi</span></div>
<div class="row"><span class="lbl">Date</span><span class="val">${nX(e.date)}</span></div>
</header>
<div class="msg-body">${e.bodyHtml}</div>
</article>`).join(""),`<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>${t}</title>
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src https: data:;">
<style>
* { box-sizing: border-box; }
body {
margin: 0;
padding: 20px 24px 32px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-size: 14px;
line-height: 1.5;
color: #202124;
background: #fff;
}
.thread-subject {
font-size: 18px;
font-weight: 600;
margin: 0 0 20px;
padding-bottom: 14px;
border-bottom: 1px solid #dadce0;
}
.msg {
margin: 0 0 28px;
padding: 0 0 22px;
border-bottom: 1px solid #eceff1;
page-break-inside: avoid;
}
.msg:last-of-type { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.msg-hdr {
font-size: 12px;
color: #5f6368;
margin-bottom: 14px;
}
.msg-hdr .row {
display: flex;
gap: 10px;
margin-bottom: 4px;
align-items: baseline;
}
.msg-hdr .lbl {
flex: 0 0 52px;
font-weight: 600;
color: #3c4043;
}
.msg-hdr .val { flex: 1; min-width: 0; word-break: break-word; }
.msg-body {
font-size: 14px;
line-height: 1.6;
color: #202124;
}
.msg-body a { color: #1a73e8; }
.msg-body img { max-width: 100%; height: auto; }
.msg-body pre, .msg-body code { background: #f6f8fa; border-radius: 3px; font-size: 13px; }
.msg-body pre { padding: 10px; overflow-x: auto; }
.msg-body code { padding: 2px 5px; }
@media print {
body { padding: 12px 16px; }
.msg-body a { color: #000; text-decoration: underline; }
}
</style>
</head>
<body>
<h1 class="thread-subject">${t}</h1>
${s}
</body>
</html>`),n=window.open("","_blank","noopener,noreferrer");if(!n)return window.alert("Impossible douvrir la fen\xeatre dimpression. V\xe9rifiez que les fen\xeatres pop-up ne sont pas bloqu\xe9es pour ce site.");n.document.open(),n.document.write(a),n.document.close();let r=()=>{try{n.focus(),n.print()}catch{}};"complete"===n.document.readyState?window.setTimeout(r,0):n.addEventListener("load",()=>window.setTimeout(r,0),{once:!0})}(V)},[V]);return(0,a.jsx)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:(0,a.jsxs)("div",{ref:ed,className:eo.Yj,children:[(0,a.jsx)("div",{className:"h-[52px] shrink-0 bg-mail-surface sm:hidden","aria-hidden":!0}),(0,a.jsx)(lx,{email:e,isSpamMessage:N,onNotSpam:N?ey:void 0,onPrint:ek,onNavigateToLabel:t,showLabelChip:s,labelBgByText:r,emailLabelToSidebarFolderId:l,getNavItemPrefs:i,folderTree:o,labelRows:c,currentFolderId:d}),ej?(0,a.jsx)(r4,{invitation:ej}):null,N&&(0,a.jsx)(iY,{onNotSpam:ey}),u&&!M&&_>0?(0,a.jsx)("div",{className:"border-b border-border px-6 py-3 max-sm:px-4",children:(0,a.jsx)("button",{type:"button",onClick:()=>I(!0),className:"text-sm font-medium text-primary hover:underline",children:1===_?"Afficher l'autre message du fil":`Afficher les ${_} autres messages du fil`})}):null,P.map(e=>(0,a.jsx)("div",{className:"border-b border-[#eceff1]",children:(0,a.jsx)(iK,{message:e,isExpanded:W(e.id),onToggle:()=>B(e.id),onPrintConversation:ek,onReply:ep,onForward:eb,selfEmails:p,selfDisplayName:g,collapseQuotedReplies:_>0,attachments:Y(e)})},e.id)),(0,a.jsx)(iG,{sender:U.name,senderEmail:U.email,headerDetails:H,dateIso:e.date,body:S,isSpam:N,isLast:0===F.length,starred:k,attachments:ee,onToggleStar:ew,onPrintConversation:ek,onReply:ep,onForward:eb,detailsOpen:E,onDetailsOpenChange:z,collapseQuotedReplies:_>0,messageId:e.id,plainTextFallback:A}),F.map(e=>(0,a.jsx)("div",{className:"border-b border-[#eceff1]",children:(0,a.jsx)(iK,{message:e,isExpanded:W(e.id),onToggle:()=>B(e.id),onPrintConversation:ek,onReply:ep,onForward:eb,selfEmails:p,selfDisplayName:g,collapseQuotedReplies:_>0,attachments:Y(e)})},e.id)),_>0&&et.length>0?(0,a.jsx)(iB,{entries:et}):null,ei?(0,a.jsxs)("div",{className:(0,ec.cn)("z-10 mt-4 hidden flex-wrap items-center gap-x-3 gap-y-2 px-4 pb-6 pl-[68px] sm:flex","max-sm:static sm:sticky sm:bottom-0",eo.Az),children:[(0,a.jsxs)("button",{type:"button",onClick:()=>ef("reply"),className:eo.l_,children:[(0,a.jsx)(C.A,{className:"h-[18px] w-[18px] shrink-0 text-muted-foreground",strokeWidth:1.5}),"R\xe9pondre"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>ef("replyAll"),className:eo.l_,children:[(0,a.jsx)(a5.A,{className:"h-[18px] w-[18px] shrink-0 text-muted-foreground",strokeWidth:1.5}),"R\xe9pondre \xe0 tous"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>ef("forward"),className:eo.l_,children:[(0,a.jsx)(a4.A,{className:"h-[18px] w-[18px] shrink-0 text-muted-foreground",strokeWidth:1.5}),"Transf\xe9rer"]})]}):null,er?(0,a.jsx)("div",{ref:eu,className:"mt-6 px-4 pb-6 max-sm:px-4",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-sm font-bold text-white",style:{backgroundColor:(0,eS.V7)(ev)},"aria-hidden":!0,children:(0,eS.w7)(ev)}),(0,a.jsx)("div",{className:"min-w-0 flex-1",children:(0,a.jsx)(rZ,{compose:er,threadSourceEmail:V},er.id)})]})}):null]})})}function iJ({data:e,reading:t,selection:s}){let{openEmail:r,isSingleMessageView:l,handleNavigateToLabel:i}=t,{listRowLabelBgByTextLower:o,sidebarNav:c,selectedFolder:d}=e,u=(0,n.useMemo)(()=>{let e;return r?(e=[],r.read&&e.push("read"),r.starred&&e.push("starred"),r.important&&e.push("important"),r.spam&&e.push("spam"),{id:r.id,message_id:r.id,thread_id:r.threadHeadId,account_id:"",subject:r.subject,from:[{name:r.sender,address:r.senderEmail??""}],to:[],date:r.date,snippet:r.preview,flags:e,labels:r.labels??[],has_attachments:r.hasAttachment??!1}):null},[r]);return r&&u?(0,a.jsx)(iZ,{email:u,isSingleMessageView:l,onNavigateToLabel:i,labelBgByText:o,emailLabelToSidebarFolderId:c.emailLabelToSidebarFolderId,getNavItemPrefs:c.getNavItemPrefs,folderTree:c.folderTree,labelRows:c.labelRows,currentFolderId:d,showLabelChip:e=>!!af.has(e)||t4(e,c.emailLabelToSidebarFolderId,c.getNavItemPrefs,c.labelRows)}):null}function iX({data:e,labels:t,selection:s,reading:n,onSelectFolder:r}){let{splitView:l,isViewMode:i,isSearchMode:o,selectedFolder:c,listToolbarMode:d,isRefreshing:u,listViewportRef:m,pullContentRef:h,pullIconRef:x,displayListEmails:f,listEmails:p,inboxCategoryTabLabel:b,sidebarNav:g,searchParams:v}=e,{openEmail:j,openMailIndex:w,goBack:y,goToPrev:k,goToNext:N,handleBreadcrumbNavigate:C,handleCategoryInboxTabClick:S}=n,A={allEmails:e.allEmails,emailById:e.emailById,listMailIndex:e.listMailIndex,listRowExtras:e.listRowExtras,starredEmails:e.starredEmails,importantEmails:e.importantEmails,readOverrides:e.readOverrides,conversationMode:e.conversationMode,savedThreadReplyDrafts:e.savedThreadReplyDrafts,selectedEmails:s.selectedEmails,selectedFolder:e.selectedFolder,splitView:e.splitView,openMailId:e.openMailId,isXs:e.isXs,isMd:e.isMd,density:e.density,mobileSelectionMode:s.mobileSelectionMode,touchListSwipeEnabled:s.touchListSwipeEnabled,openSwipeRowId:s.openSwipeRowId,setOpenSwipeRowId:s.setOpenSwipeRowId,listRowLabelBgByTextLower:e.listRowLabelBgByTextLower,sidebarNav:e.sidebarNav,rescheduleTarget:e.rescheduleTarget,setRescheduleTarget:e.setRescheduleTarget,rescheduleDismissTimeoutsRef:e.rescheduleDismissTimeoutsRef,scheduleReschedulePopoverDismiss:e.scheduleReschedulePopoverDismiss,rowContextMenuOpenedAtRef:s.rowContextMenuOpenedAtRef,contextMenuTargetIdsRef:s.contextMenuTargetIdsRef,lastSelectionAnchorIdRef:s.lastSelectionAnchorIdRef,setSelectedEmails:s.setSelectedEmails,setLabelPickerQuery:e.setLabelPickerQuery,labelPickerQuery:e.labelPickerQuery,catalogLabels:t.catalogLabels,resolveLabelVisual:t.resolveLabelVisual,getCatalogLabelPresence:t.getCatalogLabelPresence,toggleLabelOnEmails:t.toggleLabelOnEmails,addLabelToEmails:t.addLabelToEmails,moveTargets:e.moveTargets,moveEmailsToTarget:t.moveEmailsToTarget,cmScheduledRescheduleValue:e.cmScheduledRescheduleValue,setCmScheduledRescheduleValue:e.setCmScheduledRescheduleValue,mailActions:e.mailActions,setReadOverrides:e.setReadOverrides,onSelectFolder:r,toggleSelect:s.toggleSelect,handleRowCheckboxClickCapture:s.handleRowCheckboxClickCapture,handleRowActivate:n.handleRowActivate,startRowDrag:s.startRowDrag,archiveListRow:n.archiveListRow,deleteListRow:n.deleteListRow,toggleStar:s.toggleStar,toggleImportant:s.toggleImportant,openSwipeRowLabelSheet:s.openSwipeRowLabelSheet,handleNavigateToLabel:n.handleNavigateToLabel,handleCategoryInboxTabClick:S,closeViewIfShowingEmail:n.closeViewIfShowingEmail,restoreSnoozedRowToMailbox:n.restoreSnoozedRowToMailbox,handleEditScheduledMail:e.handleEditScheduledMail,requestArchiveScheduled:e.requestArchiveScheduled,requestDeleteScheduled:e.requestDeleteScheduled,requestToggleReadScheduled:e.requestToggleReadScheduled,requestSnoozeScheduled:e.requestSnoozeScheduled,requestRescheduleScheduled:e.requestRescheduleScheduled,requestSendScheduledNow:e.requestSendScheduledNow,requestSnoozeMailboxEmail:e.requestSnoozeMailboxEmail};return(0,a.jsxs)("div",{className:(0,ec.cn)("relative flex min-h-0 flex-1 flex-col"),children:[(0,a.jsxs)("div",{ref:m,className:(0,ec.cn)("max-sm:pb-16",!l&&i&&j?"relative flex min-h-0 flex-1 flex-col overflow-hidden":"min-h-0 flex-1 overflow-y-auto overflow-x-hidden border-0 bg-mail-surface shadow-none outline-none sm:rounded-b-2xl [scrollbar-color:#9aa0a6_#ffffff] [scrollbar-width:auto] [&::-webkit-scrollbar]:w-2.5 [&::-webkit-scrollbar]:border-0 [&::-webkit-scrollbar]:bg-white [&::-webkit-scrollbar-track]:border-0 [&::-webkit-scrollbar-track]:bg-white [&::-webkit-scrollbar-track]:shadow-none [&::-webkit-scrollbar-thumb]:rounded-none [&::-webkit-scrollbar-thumb]:border-0 [&::-webkit-scrollbar-thumb]:shadow-none [&::-webkit-scrollbar-thumb]:bg-[#9aa0a6] hover:[&::-webkit-scrollbar-thumb]:bg-[#5f6368] [&::-webkit-scrollbar-corner]:border-0 [&::-webkit-scrollbar-corner]:bg-white","relative min-h-0 flex-1 overscroll-y-none"),children:[d&&(0,a.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-10 flex items-center justify-center pt-2 sm:hidden",style:{height:48},"aria-hidden":!0,children:(0,a.jsx)(aW.A,{ref:x,className:(0,ec.cn)("h-5 w-5 text-[#5f6368]",u&&sq),style:{opacity:0}})}),(0,a.jsx)("div",{ref:h,className:(0,ec.cn)(!l&&i&&j&&"relative flex min-h-0 flex-1 flex-col ",d&&"max-sm:[transform:translateZ(0)]"),children:!l&&i&&j?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-30 flex items-center justify-between gap-2 px-3 py-2 sm:hidden",children:[(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"pointer-events-auto size-9 shrink-0 rounded-full border border-gray-200 bg-white/80 text-[#444746] shadow-md backdrop-blur hover:bg-white","aria-label":"Retour \xe0 la bo\xeete de r\xe9ception",onClick:y,children:(0,a.jsx)(a_.A,{className:"size-5",strokeWidth:1.5})}),(0,a.jsxs)("div",{className:"pointer-events-auto flex shrink-0 overflow-hidden rounded-full border border-gray-200 bg-white/80 shadow-md backdrop-blur",children:[(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"size-9 rounded-none text-[#444746] hover:bg-[#f1f3f4] disabled:opacity-40",disabled:w<=0,onClick:k,"aria-label":"Message plus r\xe9cent",children:(0,a.jsx)(aY.A,{className:"size-5",strokeWidth:1.5})}),(0,a.jsx)("span",{className:"w-px shrink-0 self-stretch bg-border","aria-hidden":!0}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"size-9 rounded-none text-[#444746] hover:bg-[#f1f3f4] disabled:opacity-40",disabled:w>=f.length-1,onClick:N,"aria-label":"Message plus ancien",children:(0,a.jsx)(eV.A,{className:"size-5",strokeWidth:1.5})})]})]}),(0,a.jsx)(iJ,{data:e,reading:n,selection:s})]}):(0,a.jsxs)(a.Fragment,{children:["scheduled"===c&&(0,a.jsx)(nD,{}),0===f.length?"scheduled"===c?(0,a.jsx)(nL,{variant:"scheduled"}):o&&v?(0,a.jsx)(nL,{variant:"search",searchParams:v}):(0,a.jsx)(nL,{variant:"folder",selectedFolder:c,inboxCategoryTabLabel:b,folderIdToLabel:g.folderIdToLabel}):(0,a.jsxs)("div",{className:(0,ec.cn)(eo.lQ,d&&"sm:pb-14"),children:[p.map(e=>(0,a.jsx)(nS,{email:e,...A},e.id)),e.scrollInfiniteList&&e.hasMoreInfinite?(0,a.jsx)("div",{ref:e.loadMoreSentinelRef,className:"h-px w-full shrink-0","aria-hidden":!0}):null,e.isFetchingNextInfinitePage?(0,a.jsx)("div",{className:"flex justify-center py-3 text-xs text-muted-foreground",children:"Chargement"}):null]})]})})]}),d?(0,a.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-20 hidden sm:flex sm:justify-start",children:(0,a.jsx)(a2,{currentKey:ap(c,e.inboxTab),folderTree:g.folderTree,folderIdToLabel:g.folderIdToLabel,labelRows:g.labelRows,onNavigate:C,className:"pointer-events-auto"})}):null]})}function i0({props:e,data:t,labels:s,selection:n,reading:r}){let l=tJ(),{onToggleSidebar:i}=e,{splitView:o,isViewMode:c,isXs:d,touchNav:u,openCompose:m}=t,{mobileXsMoveSheetOpen:h,mobileXsLabelSheetOpen:x,handleMobileXsMoveSheetOpenChange:f,handleLabelSheetOpenChange:p,labelSheetTargetIds:b,bulkMoveTo:g,openMobileXsMoveSheet:v,openMobileXsLabelSheet:j}=n,{openEmail:w}=r,y={isViewMode:t.isViewMode,splitView:t.splitView,listToolbarMode:t.listToolbarMode,compactInboxTabs:t.compactInboxTabs,isSearchMode:t.isSearchMode,selectedFolder:t.selectedFolder,mobileFolderLabel:t.mobileFolderLabel,displayListEmails:t.displayListEmails,mobileUnreadCount:t.mobileUnreadCount,mobileSelectionMode:n.mobileSelectionMode,setMobileSelectionMode:n.setMobileSelectionMode,setSelectedEmails:n.setSelectedEmails,mobileXsMoreMenuOpen:n.mobileXsMoreMenuOpen,setMobileXsMoreMenuOpen:n.setMobileXsMoreMenuOpen,showBulkToolbar:n.showBulkToolbar,bulkSelectMenuOpen:n.bulkSelectMenuOpen,setBulkSelectMenuOpen:n.setBulkSelectMenuOpen,selectAllChecked:n.selectAllChecked,handleSelectAllChange:n.handleSelectAllChange,selectMenuAll:n.selectMenuAll,selectMenuNone:n.selectMenuNone,selectMenuRead:n.selectMenuRead,selectMenuUnread:n.selectMenuUnread,selectMenuStarred:n.selectMenuStarred,selectMenuUnstarred:n.selectMenuUnstarred,bulkArchive:n.bulkArchive,bulkDelete:n.bulkDelete,bulkSpam:n.bulkSpam,hasUnreadInSelection:n.hasUnreadInSelection,bulkMarkRead:n.bulkMarkRead,bulkMarkUnread:n.bulkMarkUnread,moveTargets:t.moveTargets,bulkMoveTo:n.bulkMoveTo,labelPickerQuery:t.labelPickerQuery,setLabelPickerQuery:t.setLabelPickerQuery,catalogLabels:s.catalogLabels,resolveLabelVisual:s.resolveLabelVisual,bulkTargetIds:n.bulkTargetIds,getCatalogLabelPresence:s.getCatalogLabelPresence,toggleLabelOnEmails:s.toggleLabelOnEmails,addLabelToEmails:s.addLabelToEmails,isRefreshing:t.isRefreshing,handleManualRefresh:t.handleManualRefresh,markAllInViewAsRead:t.markAllInViewAsRead,openMobileXsMoveSheet:v,openMobileXsLabelSheet:j,listPage:t.listPage,totalPages:t.totalPages,paginationTotal:t.paginationTotal,listPageSize:t.listPageSize,paginationRangeStart:t.paginationRangeStart,paginationRangeEnd:t.paginationRangeEnd,infiniteScroll:t.infiniteScroll,onListPageSizeChange:t.handleListPageSizeChange,openMailIndex:r.openMailIndex,goListPrevPage:r.goListPrevPage,goListNextPage:r.goListNextPage,goToPrev:r.goToPrev,goToNext:r.goToNext,goBack:r.goBack,openEmail:r.openEmail,viewModeIsRead:r.viewModeIsRead,singleArchive:r.singleArchive,singleDelete:r.singleDelete,singleNotSpam:r.singleNotSpam,singleSpam:r.singleSpam,singleToggleRead:r.singleToggleRead,singleMoveTo:r.singleMoveTo,onToggleSidebar:i,inboxTabBarItems:t.inboxTabBarItems,activeInboxTabId:t.activeInboxTabId,unseenInTabById:t.unseenInTabById,tabUnseenSenderLineById:t.tabUnseenSenderLineById,handleCategoryInboxTabClick:r.handleCategoryInboxTabClick,searchParams:t.searchParams,searchAccount:t.searchAccount,allEmails:t.allEmails,setSearchFilter:t.setSearchFilter,toggleSearchFilter:t.toggleSearchFilter,setAdvancedOpen:t.setAdvancedOpen,searchRouter:t.searchRouter,buildSearchUrl:l};return(0,a.jsx)(aU.Bc,{delayDuration:400,children:(0,a.jsxs)("div",{className:"flex h-full min-h-0 flex-1 flex-col",children:[(0,a.jsx)(aG,{...y,part:"mobile"}),!c&&u&&(0,a.jsx)(aL,{moveSheetOpen:d&&h,onMoveSheetOpenChange:f,labelSheetOpen:x,onLabelSheetOpenChange:p,labelPickerQuery:t.labelPickerQuery,onLabelPickerQueryChange:t.setLabelPickerQuery,catalogLabels:s.catalogLabels,resolveLabelVisual:s.resolveLabelVisual,moveTargets:t.moveTargets,onMoveTo:g,getLabelPresence:e=>s.getCatalogLabelPresence(b,e),onToggleCatalogLabel:e=>s.toggleLabelOnEmails(b,e),onCreateLabel:e=>{s.addLabelToEmails(b,e),t.setLabelPickerQuery("")}}),(0,a.jsxs)("div",{className:(0,ec.cn)("flex min-h-0 flex-1 flex-col",o&&"min-h-0 flex-row overflow-hidden"),children:[(0,a.jsxs)("div",{className:(0,ec.cn)("flex min-h-0 min-w-0 flex-col",o?"relative w-[min(42%,480px)] min-w-[280px] max-w-[480px] shrink-0 border-r border-gray-200":"min-h-0 flex-1"),children:[(0,a.jsx)(aG,{...y,part:"list"}),(0,a.jsx)(iX,{data:t,labels:s,selection:n,reading:r,onSelectFolder:e.onSelectFolder}),o?(0,a.jsx)("button",{type:"button",onClick:m,className:"absolute bottom-4 right-4 z-30 flex size-14 cursor-pointer items-center justify-center rounded-2xl border border-border bg-mail-surface text-[#444746] shadow-[0_1px_3px_rgba(60,64,67,.3),0_4px_8px_rgba(60,64,67,.15)] transition-[box-shadow,background-color] hover:bg-[#f6f8fc] hover:shadow-[0_1px_3px_rgba(60,64,67,.35),0_6px_12px_rgba(60,64,67,.2)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/40","aria-label":"Nouveau message",children:(0,a.jsx)(I.A,{className:"size-6",strokeWidth:1.5})}):null]}),o?(0,a.jsx)("section",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-mail-surface",children:w?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(aG,{...y,variant:"reading-pane"}),(0,a.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-none",children:(0,a.jsx)(iJ,{data:t,reading:r,selection:n})})]}):(0,a.jsx)(nL,{variant:"split-pane"})}):null]})]})})}function i1(e){let t=function({selectedFolder:e,inboxTab:t,listPage:s,openMailId:l,splitView:i=!1,onMailRouteNavigate:o,onFolderUnreadCountsChange:u}){let m,p,b=null!==l&&!i,g=i&&null!==l,v=e===x.o8,w=(0,h.useRouter)(),k=tJ(),N=(0,ev.LH)(),C=eC(e=>e.setAdvancedOpen),S=(0,h.useSearchParams)(),A=(0,n.useMemo)(()=>v?j(S):null,[v,S]),M=(0,n.useCallback)(e=>{A&&w.push(k({...A,...e}))},[A,w,k]),I=(0,n.useCallback)((e,t)=>{if(!A)return;let s={...A};if("has"===e){let e=[...s.has];e.includes(t)?s.has=e.filter(e=>e!==t):s.has=[...e,t]}else if("excludeChats"===e)s.excludeChats=!s.excludeChats;else{let a=s[e];s[e]=a===t?"":t}w.push(k(s))},[A,w,k]),{savedThreadReplyDrafts:E}=J(),{openCompose:z,openComposeWithInitial:$,closeAllInlineComposes:L,pruneInlineComposesToOpenThread:D}=Z(),{scheduledEmails:T,snoozedEmails:_,requestDeleteScheduled:R,requestArchiveScheduled:P,requestSnoozeScheduled:F,requestToggleReadScheduled:O,requestRescheduleScheduled:q,requestGetScheduledEditPayload:W,requestSendScheduledNow:B,requestSnoozeMailboxEmail:U,requestRestoreSnoozedToInbox:H}=sb(),V=(0,sv.v)(sx),K=(0,f.qU)(),Q=(0,t9.d)(e=>e.version),G=N?.id,Y=(0,t3.jE)(),X=(0,d.x)(e=>e.listPageSize),ee=(0,d.x)(e=>e.setListPageSize),et=(0,d.x)(e=>e.infiniteScroll),es=(0,r.LZ)(),ea=c(),en=(0,n.useMemo)(()=>v?"__search__":"scheduled"===e||"snoozed"===e?"__local__":"inbox"===e?"inbox":e,[e,v]),er=(0,n.useMemo)(()=>v&&A?(0,y.fK)(A,G):null,[v,A,G]),ei=(es||et)&&!b,eo=ei&&"__local__"!==en&&!v,ec="__search__"===en||"__local__"===en?"inbox":en,ed=(0,n.useMemo)(()=>`${ec}:${G??""}:${X}:${K?`demo-${Q}`:"live"}`,[ec,G,X,K,Q]),eu=eo?1:s,em=(0,se.ot)(ec,G,eu,X),eh=(0,se.ji)(er),ex=sl(),ef=si(),ep=(m=(0,t3.jE)(),p=(0,f.S4)(),(0,st.n)({mutationFn:async({id:e})=>{if(p){if(!t9.d.getState().deleteMessage(e))throw Error("Message introuvable");p.notify("Message plac\xe9 dans la corbeille");return}try{await ss.uE.delete(`/mail/messages/${e}`)}catch(t){if(t instanceof ss.M_)return void await (0,sa.Z2)({id:`delete-${e}-${Date.now()}`,timestamp:Date.now(),type:"delete_message",payload:{message_id:e},retries:0});throw t}},onMutate:async({id:e})=>{let t=(0,se.S3)(!!p),s=sr(!!p);await m.cancelQueries({queryKey:t});let a=m.getQueriesData({queryKey:t});return m.setQueriesData({queryKey:t},t=>t?{...t,data:t.data.filter(t=>t.id!==e)}:t),m.removeQueries({queryKey:[...s,e]}),{previousMessages:a}},onError:(e,t,s)=>{s?.previousMessages?.forEach(([e,t])=>m.setQueryData(e,t))},onSettled:()=>{p&&t9.d.getState().bump(),m.invalidateQueries({queryKey:(0,se.S3)(!!p)})}})),eb=(0,n.useMemo)(()=>v?eh.data?.data??[]:"__local__"===en?[]:em.data?.data??[],[v,en,eh.data,em.data]),eg=(0,n.useMemo)(()=>eb.map(ah),[eb]),ej=(0,n.useMemo)(()=>new Map(eb.map(e=>[e.id,e])),[eb]),ew=(0,n.useMemo)(()=>"scheduled"===e&&V?T.map(e=>({id:e.id,sender:e.to[0]?.name??"Destinataire",senderEmail:e.to[0]?.address,subject:e.subject||"(Sans objet)",preview:"",body:"",date:e.scheduled_at??e.created_at,read:!0,starred:!1,important:!1,labels:["scheduled"],scheduledSendAt:e.scheduled_at,scheduledToName:e.to[0]?.name})):"snoozed"===e&&V?_:eg,[e,V,T,_,eg]),ey=(0,n.useMemo)(()=>new Map(ew.map(e=>[e.id,e])),[ew]),ek=v?eh.isLoading:em.isLoading,eN=v?eh.error:em.error,eA=v?eh.isFetching:em.isFetching,eM=(0,tH.xe)(),eI=(0,n.useMemo)(()=>({folderIdToLabel:eM.folderIdToLabel,folderTree:eM.folderTree,labelRows:eM.labelRows}),[eM.folderIdToLabel,eM.folderTree,eM.labelRows]),eE=(0,n.useMemo)(()=>sM(eM.labelRows),[eM.labelRows]),ez=(0,n.useMemo)(()=>[...sM(eM.labelRows),{id:x.tZ,label:"Tous les messages",icon:"mdi:inbox",badgeColor:"bg-[#0b57d0]"}],[eM.labelRows]),e$=(0,n.useMemo)(()=>(function(e,t){let s=new Map,a=(e,t)=>{t&&s.set(e.toLowerCase(),t)},n=e=>{for(let t of e)a(t.label,t.color),t.children?.length&&n(t.children)};for(let s of(n(e),t))a(s.label,s.color);return s})(eM.folderTree,eM.labelRows),[eM.folderTree,eM.labelRows]),[eL,eD]=(0,n.useState)(null),eT=(0,n.useRef)(new Map),e_=(0,n.useCallback)(e=>{let t=eT.current.get(e);t&&clearTimeout(t);let s=setTimeout(()=>{eT.current.delete(e),eD(t=>t?.id===e?null:t)},280);eT.current.set(e,s)},[]);(0,n.useEffect)(()=>{let e=eT.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear()}},[]),(0,n.useEffect)(()=>{sX()},[]);let[eR,eP]=(0,n.useState)(""),eF=(0,n.useCallback)(async e=>{let t=await W(e);t&&$({to:t.to,subject:t.subject,bodyHtml:t.bodyHtml,editingScheduledId:e,scheduledSendAtIso:t.sendAtIso,focusToOnMount:!1,focusBodyOnMount:!0})},[W,$]);(0,n.useEffect)(()=>{if(l){let e=ey.get(l);D(e?so(e):l)}else L()},[l,ey,L,D]);let eO=(0,d.x)(e=>e.conversationMode),eq=(0,d.x)(e=>e.inboxSort),eW=(0,d.x)(e=>e.density),eB=function(){let[e,t]=(0,n.useState)(!1);return(0,n.useLayoutEffect)(()=>{let e=window.matchMedia("(min-width: 768px)"),s=()=>t(e.matches);return s(),e.addEventListener("change",s),()=>e.removeEventListener("change",s)},[]),e}(),eU=(0,n.useMemo)(()=>({}),[]),eH=(0,n.useMemo)(()=>[],[]),eV=(0,n.useMemo)(()=>[],[]),eK=(0,n.useMemo)(()=>({additions:{},removals:{}}),[]),eQ=(0,n.useMemo)(()=>[],[]),eG=(0,n.useMemo)(()=>[],[]),eY=(0,n.useCallback)(e=>{for(let[t,s]of Object.entries(e({}))){let e=ej.get(t);if(!e||s===(0,sn.EP)(e.flags))continue;let a=(0,sn.hy)(e.flags,s);ex.mutate({id:t,flags:a})}},[ej,ex]),eZ=(0,n.useCallback)(e=>{let t=e({additions:{},removals:{}});for(let[e,s]of Object.entries(t.additions)){let a=ej.get(e);if(!a)continue;let n=[...new Set([...a.labels,...s])],r=t.removals[e]??[],l=n.filter(e=>!r.some(t=>t.toLowerCase()===e.toLowerCase()));ef.mutate({id:e,labels:l})}for(let[e,s]of Object.entries(t.removals)){if(t.additions[e])continue;let a=ej.get(e);if(!a)continue;let n=a.labels.filter(e=>!s.some(t=>t.toLowerCase()===e.toLowerCase()));ef.mutate({id:e,labels:n})}},[ej,ef]),eJ=(0,n.useMemo)(()=>({markSeen:e=>sg.getState().markSeen(e),pushRecentMoveTarget:e=>sg.getState().pushRecentMoveTarget(e),hideEmail:e=>ep.mutate({id:e}),hideEmails:e=>{for(let t of e)ep.mutate({id:t})},markNotSpam:e=>{let t=ej.get(e);if(!t)return;let s=t.labels.filter(e=>"spam"!==e);s.includes("inbox")||s.push("inbox"),ef.mutate({id:e,labels:s})},unhideEmail:e=>{},toggleStar:e=>{let t=ej.get(e);if(!t)return;let s=(0,sn.BB)(t.flags);ex.mutate({id:e,flags:(0,sn.U$)(t.flags,!s)})},toggleImportant:e=>{let t=ej.get(e);if(!t)return;let s=(0,sn.I)(t.flags,t.labels);ex.mutate({id:e,flags:(0,sn.VK)(t.flags,!s)})}}),[ep,ef,ex,ej]);(0,n.useEffect)(()=>((0,tH.IL)({renameLabel:(e,t)=>{Y.invalidateQueries({queryKey:["messages"]})},removeLabel:e=>{Y.invalidateQueries({queryKey:["messages"]})}}),()=>(0,tH.IL)(null)),[Y]);let[eX,e0]=(0,n.useState)(""),e1=sg(e=>e.recentMoveTargets),[e2,e3]=(0,n.useState)(am.Lw),[e5,e4]=(0,n.useState)([]),[e6,e8]=(0,n.useState)(1),[e7,e9]=(0,n.useState)(!1),te=(0,n.useRef)(null),tt=(0,n.useRef)(""),ts=sg(e=>e.seenEmailIds),ta=(0,n.useMemo)(()=>new Set(ts),[ts]),tn=(0,n.useCallback)(async()=>{await Y.invalidateQueries({queryKey:["messages"]})},[Y]),{isRefreshing:tr,setIsRefreshing:tl,listViewportRef:ti,pullContentRef:to,pullIconRef:tc}=function(e){let{enabled:t,isViewMode:s,onRefresh:a}=e,[r,l]=(0,n.useState)(!1),i=(0,n.useRef)(0),o=(0,n.useRef)(!1),c=(0,n.useRef)(null),d=(0,n.useRef)(null),u=(0,n.useRef)(null),m=(0,n.useCallback)((e,t)=>{let s=c.current,a=d.current;if(s&&(s.style.transition=t?"transform 0.24s cubic-bezier(0.32, 0.72, 0, 1)":"none",s.style.transform=e>0?`translateY(${e}px)`:"",a)){let s=e<=26?0:Math.min(1,(e-26)/30*1.35);a.style.opacity=String(s),a.style.transform=`rotate(${360*s}deg)`,a.style.transition=t?"opacity 120ms ease-out, transform 120ms ease-out":"none"}},[]),h=(0,n.useCallback)(()=>{i.current=0,m(0,!0)},[m]),x=(0,n.useCallback)(async()=>{let e=i.current;if(o.current=!1,e>=56){i.current=48,m(48,!1),l(!0);try{await a()}finally{l(!1),i.current=0,m(0,!0)}}else h()},[m,a,h]);return(0,n.useEffect)(()=>{if(s||!t||r)return;let e=u.current;if(!e)return;let a=0,n=t=>{e.scrollTop>0||r||(a=t.touches[0]?.clientY??0,o.current=!0)},l=t=>{if(!o.current||r)return;let s=(t.touches[0]?.clientY??0)-a;if(s<=0){i.current=0,m(0,!1);return}if(e.scrollTop>0)return;t.preventDefault();let n=function(e){if(e<=0)return 0;let t=Math.min(112,.48*e);return t*(1-t/112*.12)}(s);i.current=n,m(n,!1)},c=()=>{o.current&&x()};return e.addEventListener("touchstart",n,{passive:!0}),e.addEventListener("touchmove",l,{passive:!1}),e.addEventListener("touchend",c),e.addEventListener("touchcancel",c),()=>{e.removeEventListener("touchstart",n),e.removeEventListener("touchmove",l),e.removeEventListener("touchend",c),e.removeEventListener("touchcancel",c)}},[t,r,s,m,x]),{isRefreshing:r,setIsRefreshing:l,listViewportRef:u,pullContentRef:c,pullIconRef:d,resetPullVisual:h}}({enabled:es&&!b,isViewMode:b,onRefresh:tn}),td=(0,n.useCallback)(async()=>{if(!tr){tl(!0);try{await tn()}finally{tl(!1)}}},[tr,tn,tl]),tu=(0,n.useCallback)(e=>{sg.getState().markSeen(e)},[]),tm=(0,n.useMemo)(()=>({starredEmailIds:eH,importantEmailIds:eV}),[eH,eV]),th=(0,n.useMemo)(()=>"inbox"!==e?ew:ew.filter(e=>(0,sS.Jn)(e,t,tm,eI)),[ew,e,t,tm,eI]),tx=(0,n.useMemo)(()=>{let e=th;return eO&&(e=e.filter(sc)),sC(e,eq,{readOverrides:{},starredIds:[],importantIds:[]},{conversationMode:eO,byId:ey})},[th,eO,eq,ey]),tf=(0,n.useMemo)(()=>(0,tS.Qm)(t,eM.labelRows,eM.folderIdToLabel),[t,eM.labelRows,eM.folderIdToLabel]),tp=(0,n.useMemo)(()=>tx.filter(e=>!e.read).length,[tx]),tb=(0,n.useMemo)(()=>{if(v)return"R\xe9sultats de recherche";let s=(0,x.gD)(t);return"inbox"===e&&"primary"!==s?tf:(0,tS.vF)(e,eM.folderIdToLabel)},[e,t,tf,eM.folderIdToLabel,v]),tg=(0,n.useMemo)(()=>v?eh.data?.pagination?.total:"__local__"===en?ew.length:em.data?.pagination?.total,[v,en,eh.data,em.data,ew.length]),tv=(0,n.useMemo)(()=>Math.max(1,Math.ceil((tg??tx.length)/X)),[tg,tx.length,X]),tj=(0,n.useMemo)(()=>0===tx.length?0:(s-1)*X+1,[tx.length,s,X]),tw=(0,n.useMemo)(()=>0===tx.length?0:"__local__"===en||v?Math.min(s*X,tx.length):Math.min(s*X,tg??tx.length),[tx.length,s,X,tg,en,v]),ty=(0,n.useCallback)(e=>{e!==X&&(ee(e),o({page:1}))},[X,ee,o]),tk=(0,n.useCallback)(s=>{let a="inbox"!==e?s:s.filter(e=>(0,sS.Jn)(e,t,tm,eI));return eO&&(a=a.filter(sc)),sC(a,eq,{readOverrides:{},starredIds:[],importantIds:[]},{conversationMode:eO,byId:new Map(s.map(e=>[e.id,e]))})},[e,t,tm,eI,eO,eq]),tN=`${e}:${t}:${G??""}:${ec}`;(0,n.useEffect)(()=>{if(!eo){e4([]),e8(1),tt.current="";return}if(tt.current!==tN){tt.current=tN,e4(tx),e8(1),e3(am.Lw),ti.current?.scrollTo(0,0);return}1===e6&&e4(tx)},[eo,tN,tx,e6,ti]);let tC=(0,n.useCallback)(async()=>{if(!eo||e7||e6>=tv)return;let e=e6+1;e9(!0);try{let t=await Y.fetchQuery({queryKey:(0,se.s0)(ec,G,e,X,K,Q),queryFn:()=>(0,se.g7)(ec,G,e,X,K),staleTime:6e4}),s=tk(t.data.map(ah));e4(e=>{let t=new Set(e.map(e=>e.id)),a=s.filter(e=>!t.has(e.id));return 0===a.length?e:[...e,...a]}),e8(e),e<tv&&Y.prefetchQuery({queryKey:(0,se.s0)(ec,G,e+1,X,K,Q),queryFn:()=>(0,se.g7)(ec,G,e+1,X,K),staleTime:6e4})}finally{e9(!1)}},[eo,e7,e6,tv,Y,ed,tk]);(0,n.useEffect)(()=>{eo&&1===e6&&!(tv<=1)&&Y.prefetchQuery({queryKey:(0,se.s0)(ec,G,2,X,K,Q),queryFn:()=>(0,se.g7)(ec,G,2,X,K),staleTime:6e4})},[eo,e6,tv,Y,ed]);let tA=eo?e5:tx,tM=(0,n.useMemo)(()=>{if("__local__"!==en&&!v)return tx;let e=(s-1)*X;return tx.slice(e,e+X)},[tx,s,en,v,X]),tI=(0,n.useMemo)(()=>ei?eo?es?tA.slice(0,e2):tA:tx.slice(0,e2):tM,[ei,eo,es,tA,e2,tx,tM]),tE=!!ei&&(eo?es&&e2<tA.length||e6<tv:e2<tx.length),tz=(0,n.useRef)(e2);tz.current=e2;let t$=(0,n.useCallback)(()=>{if(ei){if(eo){let e=tA.length;return es&&tz.current<e?void e3(t=>Math.min(t+am.Lw,e)):void tC()}e3(e=>Math.min(e+am.Lw,tx.length))}},[ei,eo,es,tA.length,tC,tx.length]);!function({enabled:e,sentinelRef:t,scrollRootRef:s,hasMore:a,isLoadingMore:r,onLoadMore:l,rootMargin:i="480px"}){(0,n.useEffect)(()=>{if(!e||!a)return;let n=t.current,o=s.current;if(!n||!o)return;let c=new IntersectionObserver(([e])=>{e?.isIntersecting&&!r&&l()},{root:o,rootMargin:i,threshold:0});return c.observe(n),()=>c.disconnect()},[e,a,r,l,i,t,s])}({enabled:ei,sentinelRef:te,scrollRootRef:ti,hasMore:tE,isLoadingMore:e7,onLoadMore:t$});let tL=(0,n.useMemo)(()=>(function(e){let t=new Map,s=new Set;for(let a of e)t.set(a.id,a),a.labels?.includes("scheduled")&&s.add(a.id);return{emailById:t,scheduledIds:s}})(ew),[ew]),{byId:tD,stateById:tT}=s7((0,n.useMemo)(()=>tI.filter(e=>e.hasAttachment&&!e.attachments?.length).map(e=>e.id),[tI])),t_=(0,n.useMemo)(()=>{let s=new Map,a=new Map,n=new Map,r=new Map,l="inbox"===e&&(0,x.gD)(t)===x.tZ;for(let e of tI){var i;s.set(e.id,au(e));let t=tT.get(e.id)??"idle";if(a.set(e.id,(i=tD.get(e.id),e.attachments?.length?s0(e):i?.length?s0({...e,attachments:i}):e.hasAttachment&&"loading"===t?[]:s0(e))),l){let t=function(e,t,s,a,n){let r=[];for(let l of a)l.id!==x.tZ&&l.id!==x.ZO&&(0,sS.i0)(e,"inbox",t,s,n)&&(0,sS.i0)(e,l.id,t,s,n)&&r.push(l);return r}(e,tm,eI,eE,r);t.length>0&&n.set(e.id,t)}}return{invitationById:s,attachmentsById:a,categoryTabsById:n}},[tI,tD,tT,e,t,tm,eI,eE]),tR=(0,n.useRef)(et);(0,n.useEffect)(()=>{let e=et&&!tR.current;tR.current=et,e&&!es&&(e4([]),e8(1),e3(am.Lw),1!==s&&o({page:1}))},[et,es,s,o]),(0,n.useEffect)(()=>{es||et||s>tv&&o({page:tv})},[es,et,s,tv,o]),(0,n.useEffect)(()=>{ei||ti.current?.scrollTo(0,0)},[s,e,t,ei,ti]),(0,n.useEffect)(()=>{ei&&!eo&&(e3(am.Lw),ti.current?.scrollTo(0,0))},[e,t,ei,eo,ti]);let tP=function({folderTree:e,recentMoveTargets:t,currentFolderId:s}){return(0,n.useMemo)(()=>{let n=el.filter(e=>e.id!==s),r=(function e(t,s=0){let n=[];for(let r of t)n.push({id:r.id,label:r.label,icon:(0,a.jsx)("span",{className:`inline-block size-3 shrink-0 rounded-sm ${r.color??"bg-slate-400"}`}),depth:s,isFolder:!0,color:r.color}),r.children?.length&&n.push(...e(r.children,s+1));return n})(e).filter(e=>e.id!==s),l=new Map;for(let e of n)l.set(e.id,e);for(let e of r)l.set(e.id,e);let i=[];for(let e of t){if(e===s)continue;let t=l.get(e);t&&i.push({...t,isRecent:!0,depth:0})}return{recents:i,system:n,folders:r}},[e,t,s])}({folderTree:eM.folderTree,recentMoveTargets:e1,currentFolderId:e}),tF=(0,n.useMemo)(()=>({}),[]),tO=(0,n.useMemo)(()=>[...ta].sort().join(","),[ta]),{unseenInTabById:tq,tabUnseenSenderLineById:tW}=(0,n.useMemo)(()=>{let e=new Set(tO.length>0?tO.split(","):[]),t=new Map,s={},a={};for(let n of ez){let r=[];for(let s of ew)!e.has(s.id)&&(0,sS.Jn)(s,n.id,tm,eI,t)&&r.push(s);if(s[n.id]=r.length,(0,x.AP)(n.id)){let e=[],t=new Set;for(let s of r){let a=(0,eS.ms)(s.sender).trim();if(!(!a||t.has(a))&&(t.add(a),e.push(a),e.length>=6))break}a[n.id]=e.join(", ")}}return{unseenInTabById:s,tabUnseenSenderLineById:a}},[tO,ew,ez,tm,eI]);(0,n.useEffect)(()=>{u?.(tF)},[tF,u]);let tB=i||!b,tU=es||i,tV=(0,n.useMemo)(()=>(0,x.gD)(t),[t]),tK=(0,n.useMemo)(()=>tI.map(e=>e.id),[tI]),tQ=tI.map(e=>e.id).join(","),tG=(0,n.useCallback)(e=>e.read,[]),tY=(0,n.useCallback)(e=>e.starred,[]),tZ=(0,n.useCallback)(()=>{for(let e of tx){if(e.read)continue;let t=ej.get(e.id);t&&((0,sn.EP)(t.flags)||ex.mutate({id:e.id,flags:(0,sn.hy)(t.flags,!0)}))}},[tx,ej,ex]);return{selectedFolder:e,inboxTab:t,listPage:s,openMailId:l,splitView:i,isViewMode:b,showSplitReadingPane:g,isSearchMode:v,searchRouter:w,searchAccount:N,setAdvancedOpen:C,searchParams:A,setSearchFilter:M,toggleSearchFilter:I,savedThreadReplyDrafts:E,openCompose:z,openComposeWithInitial:$,allEmails:ew,emailById:ey,sidebarNav:eM,navMaps:eI,inboxCategoryTabIconsCatalog:eE,inboxTabBarItems:ez,listRowLabelBgByTextLower:e$,rescheduleTarget:eL,setRescheduleTarget:eD,rescheduleDismissTimeoutsRef:eT,scheduleReschedulePopoverDismiss:e_,cmScheduledRescheduleValue:eR,setCmScheduledRescheduleValue:eP,handleEditScheduledMail:eF,starredEmails:eH,importantEmails:eV,readOverrides:eU,conversationMode:eO,inboxSort:eq,density:eW,isMd:eB,labelEdits:eK,mailActions:eJ,setReadOverrides:eY,setLabelEdits:eZ,labelPickerQuery:eX,setLabelPickerQuery:e0,hiddenEmailIds:eQ,notSpamEmailIds:eG,recentMoveTargets:e1,mobileVisibleCount:e2,infiniteScroll:et,scrollInfiniteList:ei,hasMoreInfinite:tE,loadMoreSentinelRef:te,isFetchingNextInfinitePage:e7,isXs:es,touchNav:ea,seenEmailIds:ta,isRefreshing:tr,listViewportRef:ti,pullContentRef:to,pullIconRef:tc,handleManualRefresh:td,markEmailSeen:tu,folderFilterCtx:tm,filteredEmails:th,displayListEmails:tx,inboxCategoryTabLabel:tf,mobileUnreadCount:tp,mobileFolderLabel:tb,paginationTotal:tg,listPageSize:X,paginationRangeStart:tj,paginationRangeEnd:tw,handleListPageSizeChange:ty,totalPages:tv,pagedEmails:tM,listEmails:tI,listMailIndex:tL,listRowExtras:t_,moveTargets:tP,folderUnreadCounts:tF,unseenInTabById:tq,tabUnseenSenderLineById:tW,listToolbarMode:tB,compactInboxTabs:tU,activeInboxTabId:tV,pageIds:tK,listRowsDep:tQ,effectiveRead:tG,effectiveStarred:tY,markAllInViewAsRead:tZ,requestDeleteScheduled:R,requestArchiveScheduled:P,requestSnoozeScheduled:F,requestToggleReadScheduled:O,requestRescheduleScheduled:q,requestSendScheduledNow:B,requestSnoozeMailboxEmail:U,requestRestoreSnoozedToInbox:H,isLoading:ek,error:eN,isFetching:eA}}(e),s=function(e){let{allEmails:t,sidebarNav:s,setLabelEdits:a,mailActions:r}=e,l=(0,n.useCallback)(()=>{let e=new Set,t=s=>{for(let a of s)e.add(a.label.toLowerCase()),a.children?.length&&t(a.children)};return t(s.folderTree),e},[s.folderTree]),i=(0,n.useCallback)((e,n)=>{if(0===e.length)return;let i=s.folderIdToLabel[n],o=["inbox","sent","drafts","spam","trash"].includes(n),c=l();a(s=>{let a={...s.additions},r={...s.removals};for(let s of e){let e=t.find(e=>e.id===s),l=e?.labels??[];if(o){if("inbox"===n){for(let e of l)if(c.has(e.toLowerCase())){let t=r[s]??[];t.some(t=>t.toLowerCase()===e.toLowerCase())||(r[s]=[...t,e])}}}else if(i){for(let e of l)if(c.has(e.toLowerCase())&&e.toLowerCase()!==i.toLowerCase()){let t=r[s]??[];t.some(t=>t.toLowerCase()===e.toLowerCase())||(r[s]=[...t,e])}if(l.some(e=>e.toLowerCase()===i.toLowerCase())||(a[s]=[...a[s]??[],i]),l.findIndex(e=>"inbox"===e.toLowerCase())>=0||!e?.labels?.length||e.labels.includes("inbox")){let e=r[s]??[];e.some(e=>"inbox"===e.toLowerCase())||(r[s]=[...e,"inbox"])}}}return{additions:a,removals:r}}),o&&"inbox"!==n||r.pushRecentMoveTarget(n),o&&"inbox"!==n&&(r.hideEmails(e),r.pushRecentMoveTarget(n))},[t,s.folderIdToLabel,l,a,r]),o=(0,n.useMemo)(()=>{let e=new Set;for(let t of function e(t){let s=[];for(let a of t)s.push(a.label),a.children?.length&&s.push(...e(a.children));return s}(s.folderTree))e.add(t);for(let t of s.labelRows)e.add(t.label);for(let s of t)for(let t of s.labels??[])af.has(t)||e.add(t);return[...e].sort((e,t)=>e.localeCompare(t,"fr"))},[s.folderTree,s.labelRows,t]),c=(0,n.useCallback)(e=>(function(e,t){let s,{folderTree:a,labelRows:n,emailLabelToSidebarFolderId:r}=t,l=r[e];if(l){let e=(0,tS.dX)(n,l);if(e?.icon)return{kind:"iconify",icon:e.icon};if(e?.color)return{kind:"dot",colorClass:e.color};let t=(0,ax.dG)(a,l);if(t?.length)return{kind:"dot",colorClass:t[t.length-1].color??"bg-gray-400"}}let i=(s=e.toLowerCase(),n.find(t=>t.label===e||t.label.toLowerCase()===s));if(i?.icon)return{kind:"iconify",icon:i.icon};if(i?.color)return{kind:"dot",colorClass:i.color};let o=function e(t,s){let a=s.toLowerCase();for(let n of t){if(n.label===s||n.label.toLowerCase()===a)return n;if(n.children?.length){let t=e(n.children,s);if(t)return t}}}(a,e);return o?.color?{kind:"dot",colorClass:o.color}:{kind:"dot",colorClass:"bg-gray-400"}})(e,{folderTree:s.folderTree,labelRows:s.labelRows,emailLabelToSidebarFolderId:s.emailLabelToSidebarFolderId}),[s.folderTree,s.labelRows,s.emailLabelToSidebarFolderId]),d=(0,n.useCallback)(e=>{let t=e.trim();return t?o.find(e=>e.toLowerCase()===t.toLowerCase())??t:""},[o]),u=(0,n.useCallback)((e,n)=>{let r=d(n);r&&0!==e.length&&(s.ensureLabelRowForLabelText(r),a(s=>{let a={...s.additions},n={...s.removals};for(let s of e){let e=t.find(e=>e.id===s);(e?.labels??[]).some(e=>e.toLowerCase()===r.toLowerCase())||(a[s]=[...a[s]??[],r])}return{additions:a,removals:n}}))},[d,t,s,a]),m=(0,n.useCallback)((e,s)=>{let a=d(s);if(!a||0===e.length)return"none";let n=a.toLowerCase(),r=0;for(let s of e){let e=t.find(e=>e.id===s);(e?.labels??[]).some(e=>e.toLowerCase()===n)&&r++}return 0===r?"none":r===e.length?"all":"some"},[t,d]),h=(0,n.useCallback)((e,n)=>{let r=d(n);r&&0!==e.length&&a(a=>{let n=e=>{let s=t.find(t=>t.id===e);return!!s&&(s.labels??[]).some(e=>e.toLowerCase()===r.toLowerCase())},l=e.every(e=>n(e)),i={...a.additions},o={...a.removals};if(l)for(let t of e)o[t]=[...o[t]??[],r];else for(let t of(e.some(e=>!n(e))&&queueMicrotask(()=>s.ensureLabelRowForLabelText(r)),e))n(t)||(i[t]=[...i[t]??[],r]);return{additions:i,removals:o}})},[t,d,s,a]);return{collectAllFolderLabels:l,moveEmailsToTarget:i,catalogLabels:o,resolveLabelVisual:c,resolveLabelCasing:d,addLabelToEmails:u,toggleLabelOnEmails:h,getCatalogLabelPresence:m}}(t),l=function(e,t){let{selectedFolder:s,isViewMode:a,isXs:r,touchNav:l,pageIds:i,listEmails:o,effectiveRead:c,effectiveStarred:d,readOverrides:u,allEmails:m,setReadOverrides:h,mailActions:x}=e,{moveEmailsToTarget:f}=t,{beginDrag:p,registerOnDrop:b}=tk(),[g,v]=(0,n.useState)([]),j=(0,n.useRef)(0),w=(0,n.useRef)([]),y=(0,n.useRef)(null),[k,N]=(0,n.useState)(!1),[C,S]=(0,n.useState)(!1),[A,M]=(0,n.useState)(!1),[I,E]=(0,n.useState)(!1),[z,$]=(0,n.useState)(!1),[L,D]=(0,n.useState)(null),[T,_]=(0,n.useState)(null);(0,n.useEffect)(()=>{S(!1),v([])},[s,e.inboxTab]),(0,n.useEffect)(()=>{if(!T)return;let e=e=>{let t=e.target;!t||t.closest(`[data-swipe-row-id="${T}"]`)||_(null)};return document.addEventListener("touchstart",e,{passive:!0}),()=>document.removeEventListener("touchstart",e)},[T]);let R=(0,n.useCallback)(()=>{M(!1),window.setTimeout(()=>E(!0),0)},[]),P=(0,n.useCallback)(e=>{E(e),e||(S(!1),v([]))},[]),F=(0,n.useCallback)(()=>{M(!1),D(null),window.setTimeout(()=>$(!0),0)},[]),O=(0,n.useCallback)(e=>{$(e),e||D(null)},[]),q=(0,n.useMemo)(()=>i.filter(e=>g.includes(e)).length,[i,g]),W=i.length>0&&q===i.length,B=!!W||!!(q>0&&!W)&&"indeterminate",U=e=>{v(t=>[...new Set([...t.filter(e=>!i.includes(e)),...e])])},H=(0,n.useMemo)(()=>i.filter(e=>g.includes(e)),[i,g]),V=(0,n.useMemo)(()=>{for(let e of H){let t=m.find(t=>t.id===e);if(t&&!(void 0!==u[e]?u[e]:t.read))return!0}return!1},[H,u,m]),K=H.length>0,Q=(0,n.useMemo)(()=>L?[L]:H,[L,H]),G=e=>{0!==e.length&&(x.hideEmails(e),v(t=>t.filter(t=>!e.includes(t))))},Y=(0,n.useCallback)((e,t,s)=>{0!==s.length&&(f(s,e),v(e=>e.filter(e=>!s.includes(e))))},[f]);(0,n.useEffect)(()=>b(Y),[b,Y]);let Z=(0,n.useCallback)((e,t)=>{if(r)return;let a=g.includes(e)&&H.length>0?H:[e];if(t.dataTransfer){t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",a.join(","))}catch{}let e=document.createElement("div");e.style.position="fixed",e.style.top="-1000px",e.style.left="-1000px",e.style.width="1px",e.style.height="1px",e.style.opacity="0",document.body.appendChild(e),t.dataTransfer.setDragImage(e,0,0),window.setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},0)}p(a,s,t.clientX,t.clientY)},[p,r,g,H,s]),J=(0,n.useCallback)(e=>{0!==H.length&&(f(H,e),"inbox"!==e&&v(e=>e.filter(e=>!H.includes(e))))},[H,f]);return{selectedEmails:g,setSelectedEmails:v,rowContextMenuOpenedAtRef:j,contextMenuTargetIdsRef:w,lastSelectionAnchorIdRef:y,bulkSelectMenuOpen:k,setBulkSelectMenuOpen:N,mobileSelectionMode:C,setMobileSelectionMode:S,mobileXsMoreMenuOpen:A,setMobileXsMoreMenuOpen:M,mobileXsMoveSheetOpen:I,mobileXsLabelSheetOpen:z,swipeLabelEmailId:L,openSwipeRowId:T,setOpenSwipeRowId:_,touchListSwipeEnabled:l&&!C&&!a,openMobileXsMoveSheet:R,handleMobileXsMoveSheetOpenChange:P,openMobileXsLabelSheet:F,handleLabelSheetOpenChange:O,selectAllChecked:B,handleSelectAllChange:e=>{!0===e?v(e=>[...new Set([...e,...i])]):v(e=>e.filter(e=>!i.includes(e)))},selectMenuAll:()=>U(i),selectMenuNone:()=>v(e=>e.filter(e=>!i.includes(e))),selectMenuRead:()=>U(o.filter(e=>c(e)).map(e=>e.id)),selectMenuUnread:()=>U(o.filter(e=>!c(e)).map(e=>e.id)),selectMenuStarred:()=>U(o.filter(e=>d(e)).map(e=>e.id)),selectMenuUnstarred:()=>U(o.filter(e=>!d(e)).map(e=>e.id)),toggleStar:e=>{x.toggleStar(e)},toggleImportant:e=>{x.toggleImportant(e)},toggleSelect:e=>{v(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},handleRowCheckboxClickCapture:(e,t)=>{t.shiftKey&&null!=y.current&&(t.preventDefault(),t.stopPropagation(),((e,t)=>{let s=i.indexOf(e),a=i.indexOf(t);if(-1===s||-1===a)return;let n=Math.min(s,a),r=Math.max(s,a),l=i.slice(n,r+1);v(e=>[...new Set([...e,...l])])})(y.current,e),y.current=e)},bulkTargetIds:H,hasUnreadInSelection:V,showBulkToolbar:K,labelSheetTargetIds:Q,bulkArchive:()=>G(H),bulkDelete:()=>G(H),bulkSpam:()=>G(H),bulkMarkRead:()=>{0!==H.length&&h(e=>{let t={...e};for(let e of H)t[e]=!0;return t})},bulkMarkUnread:()=>{0!==H.length&&h(e=>{let t={...e};for(let e of H)t[e]=!1;return t})},bulkMoveTo:J,startRowDrag:Z,openSwipeRowLabelSheet:(0,n.useCallback)(e=>{D(e),$(!0)},[])}}(t,s),i=function(e,t,s){let{onMailRouteNavigate:a,onSelectFolder:r,onXsViewChromeChange:l}=e,{openMailId:i,splitView:o,isViewMode:c,showSplitReadingPane:d,isXs:u,allEmails:m,emailById:h,displayListEmails:f,listPage:p,listPageSize:b,listRowsDep:g,listViewportRef:v,conversationMode:j,setReadOverrides:w,markEmailSeen:y,mailActions:k,moveTargets:N,selectedFolder:C,inboxTab:S,openComposeWithInitial:A}=t,{moveEmailsToTarget:M}=s,I=(0,n.useMemo)(()=>{if(!i)return null;let e=function(e,t,s){let a,n,r,l=new Map(t.map(e=>[e.id,e])),i=l.get(e);if(!i)return null;let o=(a=i.threadHeadId??i.id,r=((n=l.get(a)??i).threadMessageIds??[a]).slice(0,-1).map(e=>{let t=l.get(e);return{id:t.id,sender:t.sender,senderEmail:t.senderEmail??"",date:t.date,body:t.body??"",preview:t.preview,attachments:t.attachments}}),{...n,conversation:r});return s&&sc(i)?{email:o,threadRoot:o,isSingleMessageView:!1}:s?null:{email:void 0===i.conversation?i:{...i,conversation:void 0},threadRoot:o,isSingleMessageView:(i.threadMessageIds?.length??1)>1}}(i,m,j);return!e||e.email.labels?.includes("scheduled")?null:{email:e.email,threadRoot:e.threadRoot,isSingleMessageView:e.isSingleMessageView}},[i,m,j]),E=I?.email??null,z=I?.threadRoot??null,$=I?.isSingleMessageView??!1,L=(0,n.useMemo)(()=>i?f.findIndex(e=>e.id===i):-1,[i,f]),D=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!i){D.current=null;return}if(D.current===i)return;let e=h.get(i);if(!e)return;D.current=i;let t=j&&e.threadMessageIds&&e.threadMessageIds.length>1?[...e.threadMessageIds]:[e.id];for(let e of t)y(e);w(e=>{let s={...e};for(let e of t)s[e]=!0;return s})},[i,y,h,j,w]);let T=(0,n.useCallback)(e=>{null===e&&aM.getState().requestSuppressSplitAutoOpen(),(0,n.startTransition)(()=>{if(e&&o){let t=f.findIndex(t=>t.id===e);if(t>=0)return void a({mailId:e,page:Math.floor(t/b)+1})}a({mailId:e})})},[o,f,a,b]);(0,n.useEffect)(()=>{if(!i)return;let e=m.find(e=>e.id===i);e?.labels?.includes("scheduled")&&T(null)},[i,m,T]);let _=(0,n.useCallback)(e=>{let t=f.findIndex(t=>t.id===e);return t<0?f[0]?.id??null:t<f.length-1?f[t+1].id:t>0?f[t-1].id:null},[f]);(0,n.useCallback)(()=>{o?i&&T(_(i)):T(null)},[o,i,T,_]);let R=(0,n.useCallback)(()=>{T(null)},[o,T]),P=(0,n.useCallback)(e=>{i===e&&R()},[i,R]),F=(0,n.useCallback)(e=>{e.labels?.includes("scheduled")?t.requestArchiveScheduled(e.id):(k.hideEmail(e.id),P(e.id))},[P,k,t]),O=(0,n.useCallback)(e=>{e.labels?.includes("scheduled")?t.requestDeleteScheduled(e.id):(k.hideEmail(e.id),P(e.id))},[P,k,t]),q=(0,n.useCallback)(e=>{t.requestRestoreSnoozedToInbox(e),e.id.startsWith("snz-")?r?.("inbox"):r?.("scheduled"),P(e.id)},[t,P,r]),W=(0,n.useCallback)(e=>{aM.getState().requestSuppressSplitAutoOpen(),(0,n.startTransition)(()=>{a({inboxTab:e,page:1,mailId:null})})},[a]),B=(0,n.useCallback)(e=>{if(e===ap(C,S))return;let{folderId:t,inboxTab:s}=ab(e);(0,n.startTransition)(()=>{"inbox"===t&&s&&s!==x.ZO?a({folderId:"inbox",inboxTab:s,page:1,mailId:null}):r?r(t):a({folderId:t,inboxTab:x.ZO,page:1,mailId:null})})},[C,S,a,r]),U=(0,n.useCallback)(()=>{p<=1||a({page:p-1})},[p,a]),H=(0,n.useCallback)(()=>{p>=t.totalPages||a({page:p+1})},[p,t.totalPages,a]),V=(0,n.useCallback)(()=>{if(L>0){let e=f[L-1].id;y(e),w(()=>({[e]:!0})),T(e)}},[L,f,T,y,w]),K=(0,n.useCallback)(()=>{if(L>=0&&L<f.length-1){let e=f[L+1].id;y(e),w(()=>({[e]:!0})),T(e)}},[L,f,T,y,w]),Q=(0,n.useCallback)(e=>{let t=m.find(t=>t.id===e);t?.labels?.includes("scheduled")||(y(e),w(()=>({[e]:!0})),T(e))},[T,y,m,w]),G=(0,n.useCallback)(e=>{y(e.id),w(()=>({[e.id]:!0}));let t=e.senderEmail?[{name:e.sender.trim(),email:e.senderEmail}]:[],s=e.body??(e.preview?`<p style="color:#5f6368">${e.preview.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}</p>`:"<p></p>");A({to:t,subject:e.subject,bodyHtml:s,focusToOnMount:!1,focusBodyOnMount:!0})},[y,A,w]),Y=(0,n.useCallback)(e=>{if(!e.labels?.includes("scheduled")){if(e.labels?.includes("drafts"))return void G(e);Q(e.id)}},[Q,G]),Z=(0,n.useMemo)(()=>!E||E.read,[E]),J=(0,n.useCallback)(e=>{o?T(_(e)):T(null)},[o,T,_]),X=(0,n.useCallback)(()=>{i&&(k.hideEmail(i),J(i))},[i,J,k]),ee=(0,n.useCallback)(()=>{i&&(k.hideEmail(i),J(i))},[i,J,k]),et=(0,n.useCallback)(()=>{i&&(k.hideEmail(i),J(i))},[i,J,k]),es=(0,n.useCallback)(()=>{i&&(k.markNotSpam(i),r?.("inbox"),J(i))},[i,J,r,k]),ea=(0,n.useCallback)(()=>{if(!i)return;let e=!Z;w(()=>({[i]:e}))},[i,Z,w]),en=(0,n.useCallback)(e=>{!i||(M([i],e),(["sent","drafts","spam","trash"].includes(e)||"inbox"!==e)&&J(i))},[i,J,M]),er=(0,n.useCallback)(()=>{E&&A(aS(aA(E,"reply")))},[E,A]),el=(0,n.useRef)({onArchive:X,onReply:er,moveTargets:N,onMoveTo:en});el.current={onArchive:X,onReply:er,moveTargets:N,onMoveTo:en},(0,n.useEffect)(()=>{if(l)return u&&c&&i?(l({onArchive:()=>el.current.onArchive(),onReply:()=>el.current.onReply(),moveTargets:el.current.moveTargets,onMoveTo:e=>el.current.onMoveTo(e)}),()=>l(null)):void l(null)},[l,u,c,i,N]),(0,n.useEffect)(()=>{if(!o||aM.getState().consumeSuppressSplitAutoOpen())return;let e=f[0]?.id??null;if(!i){e&&T(e);return}let t=m.find(e=>e.id===i);t?.labels?.includes("scheduled")?T(e):f.some(e=>e.id===i)||T(e)},[o,C,S,p,f,i,T,m]);let ei=(0,n.useCallback)(e=>{let s=t.sidebarNav.emailLabelToSidebarFolderId[e]??e;r?.(s)},[r,t.sidebarNav.emailLabelToSidebarFolderId]);return(0,n.useLayoutEffect)(()=>{if(!o||!i)return;let e=()=>{let e=v.current;if(!e)return;let t=e.querySelector(`[data-email-row-id="${i}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})};e();let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},[o,i,p,g,v]),(0,n.useEffect)(()=>{let e=v.current;if(!e)return;let t=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=t.target.dataset.emailRowId;e&&y(e)}},{root:e,threshold:.12,rootMargin:"0px"}),s=()=>{e.querySelectorAll("[data-email-row-id]").forEach(e=>{"1"!==e.dataset.seenObserved&&(e.dataset.seenObserved="1",t.observe(e))})};s();let a=new MutationObserver(s);return a.observe(e,{childList:!0,subtree:!0}),()=>{a.disconnect(),t.disconnect()}},[y,v]),(0,n.useEffect)(()=>{if(!c&&!d)return;let e=e=>{if("Escape"===e.key){o||R();return}"ArrowLeft"===e.key||"k"===e.key?V():("ArrowRight"===e.key||"j"===e.key)&&K()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c,d,o,R,V,K]),{openEmail:E,openEmailThreadRoot:z,isSingleMessageView:$,openMailIndex:L,navigateToMail:T,goBack:R,closeViewIfShowingEmail:P,archiveListRow:F,deleteListRow:O,restoreSnoozedRowToMailbox:q,handleCategoryInboxTabClick:W,handleBreadcrumbNavigate:B,goListPrevPage:U,goListNextPage:H,goToPrev:V,goToNext:K,handleOpenEmail:Q,handleRowActivate:Y,viewModeIsRead:Z,singleArchive:X,singleDelete:ee,singleSpam:et,singleNotSpam:es,singleToggleRead:ea,singleMoveTo:en,singleReply:er,handleNavigateToLabel:ei}}(e,t,s);return(0,a.jsx)(i0,{props:e,data:t,labels:s,selection:l,reading:i})}var i2=s(26362),i3=s(59352);function i5(){let{panelOpen:e,togglePanel:t}=(0,ni.Y)(),s=(0,i3.b)(e=>e.open),n=(0,i3.b)(e=>e.openPanel);return(0,a.jsxs)("aside",{className:"hidden w-10 shrink-0 flex-col items-center gap-2 bg-transparent py-3 sm:flex",children:[(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:"h-9 w-9 text-gray-600 rounded-full","aria-label":"Ouvrir l'agenda",asChild:!0,children:(0,a.jsx)(ik(),{href:"/agenda",children:(0,a.jsx)(nr.A,{className:"h-4 w-4"})})}),(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:"h-9 w-9 text-gray-600 rounded-full",children:(0,a.jsx)(aP.A,{className:"h-4 w-4"})}),(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:(0,ec.cn)("h-9 w-9 rounded-full",s?"bg-blue-100 text-[#1a73e8]":"text-gray-600"),onClick:()=>n({app:"mail",temporary:!0}),"aria-label":"UltiAI",children:(0,a.jsx)(i2.A,{className:"h-4 w-4"})}),(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:(0,ec.cn)("h-9 w-9 rounded-full",e?"bg-blue-100 text-[#1a73e8]":"text-gray-600"),onClick:t,"aria-label":"Contacts",children:(0,a.jsx)(r1.A,{className:"h-4 w-4"})}),(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:"h-9 w-9 text-gray-600 rounded-full",children:(0,a.jsx)(eK.A,{className:"h-4 w-4"})})]})}var i4=s(61232);function i6({className:e,children:t,...s}){return(0,a.jsxs)(i4.bL,{"data-slot":"scroll-area",className:(0,ec.cn)("relative",e),...s,children:[(0,a.jsx)(i4.LM,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),(0,a.jsx)(i8,{}),(0,a.jsx)(i4.OK,{})]})}function i8({className:e,orientation:t="vertical",...s}){return(0,a.jsx)(i4.VM,{"data-slot":"scroll-area-scrollbar",orientation:t,className:(0,ec.cn)("flex touch-none p-px transition-colors select-none","vertical"===t&&"h-full w-2.5 border-l border-l-transparent","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent",e),...s,children:(0,a.jsx)(i4.lr,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}var i7=s(57669),i9=s(7651),oe=s(55883);function ot({contact:e,onClick:t}){let s=(0,i9.t)(e),n=s||e.emails[0]?.value||e.phones[0]?.value||"?",r=e.emails[0]?.value||e.phones[0]?.value||"";return(0,a.jsxs)("button",{type:"button",onClick:t,className:(0,ec.cn)("flex h-14 w-full items-center gap-3 px-4 text-left",oe.xk),children:[(0,a.jsx)(nt.q,{contact:e,name:n,size:"sm"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{className:(0,ec.cn)("truncate text-sm",oe.NS),children:n}),r&&s?(0,a.jsx)("p",{className:(0,ec.cn)("truncate text-xs",oe.YS),children:r}):null]})]})}var os=s(80964),oa=s(56630);function on(){let{searchMode:e,searchQuery:t,setSearchMode:s,setSearchQuery:r,setView:l,showContactsList:i,closePanel:o}=(0,ni.Y)(),{contacts:c,isLoading:d,isError:u,error:m,refetch:h}=(0,no.D)(),x=(0,n.useRef)(null);(0,n.useEffect)(()=>{e&&x.current?.focus()},[e]);let f=(0,n.useMemo)(()=>e&&t?(0,i7.w)(c,t):c,[c,e,t]),p=(0,n.useMemo)(()=>{let e=[...f].sort((e,t)=>{let s=(0,i9.t)(e)||e.emails[0]?.value||"",a=(0,i9.t)(t)||t.emails[0]?.value||"";return s.localeCompare(a,"fr")}),t=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toUpperCase()||"?",s=[];for(let a of e){let e=t(((0,i9.t)(a)||a.emails[0]?.value||"?").charAt(0)),n=s[s.length-1];n&&n.letter===e?n.items.push(a):s.push({letter:e,items:[a]})}return s},[f]);function b(){i()}return e?(0,a.jsxs)("div",{className:oe.RJ,children:[(0,a.jsxs)("div",{className:(0,ec.cn)(oe.Pe,"gap-2"),children:[(0,a.jsx)(os.L,{onClick:b,className:"-ml-1 shrink-0"}),(0,a.jsx)(M.A,{className:`h-4 w-4 shrink-0 ${oe._w}`}),(0,a.jsx)("input",{ref:x,type:"text",value:t,onChange:e=>r(e.target.value),placeholder:"Recherche...",className:oe.Um}),(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:b,children:(0,a.jsx)(S.A,{className:"h-4 w-4"})})]}),(0,a.jsxs)(i6,{className:"min-h-0 flex-1",children:[(0,a.jsx)(or,{onClick:()=>l("create")}),f.map(e=>(0,a.jsx)(ot,{contact:e,onClick:()=>l("view",e.id)},e.id))]})]}):(0,a.jsxs)("div",{className:oe.RJ,children:[(0,a.jsxs)("div",{className:oe.us,children:[(0,a.jsx)(os.L,{onClick:i,className:"-ml-1"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:oe.BP,onClick:()=>s(!0),children:(0,a.jsx)(M.A,{className:"h-4 w-4"})}),(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:oe.BP,asChild:!0,children:(0,a.jsx)(ik(),{href:"/contacts",children:(0,a.jsx)(nl.A,{className:"h-4 w-4"})})}),(0,a.jsx)(E.$,{variant:"ghost",size:"icon",className:oe.BP,onClick:o,children:(0,a.jsx)(S.A,{className:"h-4 w-4"})})]})]}),(0,a.jsxs)(i6,{className:"min-h-0 flex-1",children:[(0,a.jsx)(or,{onClick:()=>l("create")}),(0,a.jsxs)("div",{className:oe.Rd,children:["Contacts (",d?"":c.length,")"]}),(d||u)&&(0,a.jsx)(oa.d,{isLoading:d,isError:u,error:m,onRetry:h}),!d&&!u&&p.map(e=>(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:oe.Bu,children:e.letter}),e.items.map(e=>(0,a.jsx)(ot,{contact:e,onClick:()=>l("view",e.id)},e.id))]},e.letter))]})]})}function or({onClick:e}){return(0,a.jsxs)("button",{type:"button",onClick:e,className:oe.c0,children:[(0,a.jsx)("div",{className:"flex h-10 w-10 items-center justify-center",children:(0,a.jsx)(eK.A,{className:"h-5 w-5 text-primary"})}),(0,a.jsx)("span",{className:oe.Dw,children:"Cr\xe9er un contact"})]})}var ol=s(93323),oi=s(8442),oo=s(40743),oc=s(80622),od=s(98111),ou=s(36735),om=s(33825),oh=s(2395),ox=s(83233),of=s(10165),op=s(2259),ob=s(45328);let og=["Janvier","F\xe9vrier","Mars","Avril","Mai","Juin","Juillet","Ao\xfbt","Septembre","Octobre","Novembre","D\xe9cembre"],ov=["Domicile","Travail","Autre"],oj=["Mobile","Domicile","Travail"],ow=["Domicile","Travail","Autre"],oy=oi.Ik({street:oi.Yj().optional().default(""),city:oi.Yj().optional().default(""),region:oi.Yj().optional().default(""),postalCode:oi.Yj().optional().default(""),country:oi.Yj().optional().default(""),label:oi.Yj().default("Domicile")}),ok=oi.Ik({namePrefix:oi.Yj().optional().default(""),firstName:oi.Yj().optional().default(""),middleName:oi.Yj().optional().default(""),lastName:oi.Yj().optional().default(""),nameSuffix:oi.Yj().optional().default(""),phoneticFirstName:oi.Yj().optional().default(""),phoneticLastName:oi.Yj().optional().default(""),company:oi.Yj().optional().default(""),department:oi.Yj().optional().default(""),jobTitle:oi.Yj().optional().default(""),emails:oi.YO(oi.Ik({value:oi.Yj(),label:oi.Yj()})),phones:oi.YO(oi.Ik({value:oi.Yj(),label:oi.Yj()})),addresses:oi.YO(oy),birthday:oi.Ik({day:oi.bz().optional(),month:oi.bz().optional(),year:oi.bz().optional()}).optional(),notes:oi.Yj().optional().default(""),labels:oi.YO(oi.Yj()).optional().default([]),avatarUrl:oi.Yj().optional()});function oN({mode:e,contactId:t}){let{setView:s,showContactsList:r,closePanel:l,createDraft:i,clearCreateDraft:o}=(0,ni.Y)(),{contacts:c,bookId:d}=(0,no.D)(),u=(0,oh.oH)(),m=(0,oh.LU)(),h=(0,ob.w)(e=>e.labelRows),[x,f]=(0,n.useState)(!1),[p,b]=(0,n.useState)(!1),[g,v]=(0,n.useState)(!1),j=(0,n.useRef)(null),w="edit"===e?c.find(e=>e.id===t):null,{register:y,handleSubmit:k,control:N,watch:C,reset:A,setValue:M,formState:{isDirty:I}}=(0,ol.mN)({resolver:(0,oo.u)(ok),defaultValues:{namePrefix:"",firstName:"",middleName:"",lastName:"",nameSuffix:"",phoneticFirstName:"",phoneticLastName:"",company:"",department:"",jobTitle:"",emails:[{value:"",label:"Domicile"}],phones:[{value:"",label:"Mobile"}],addresses:[],birthday:{day:void 0,month:void 0,year:void 0},notes:"",labels:[],avatarUrl:void 0}}),{fields:z,append:$,remove:L}=(0,ol.jz)({control:N,name:"emails"}),{fields:D,append:T,remove:_}=(0,ol.jz)({control:N,name:"phones"}),{fields:R,append:P,remove:F}=(0,ol.jz)({control:N,name:"addresses"});(0,n.useEffect)(()=>{"create"===e&&i&&(A({namePrefix:"",firstName:i.firstName??"",middleName:"",lastName:i.lastName??"",nameSuffix:"",phoneticFirstName:"",phoneticLastName:"",company:"",department:"",jobTitle:"",emails:i.emails?.length?i.emails:[{value:"",label:"Domicile"}],phones:[{value:"",label:"Mobile"}],addresses:[],birthday:{day:void 0,month:void 0,year:void 0},notes:"",labels:[],avatarUrl:void 0}),o())},[e,i,A,o]),(0,n.useEffect)(()=>{if("edit"!==e||!t){j.current=null;return}if(j.current===t)return;let s=c.find(e=>e.id===t);s&&(j.current=t,(s.namePrefix||s.middleName||s.nameSuffix||s.phoneticFirstName||s.phoneticLastName)&&b(!0),s.department&&v(!0),A({namePrefix:s.namePrefix??"",firstName:s.firstName,middleName:s.middleName??"",lastName:s.lastName,nameSuffix:s.nameSuffix??"",phoneticFirstName:s.phoneticFirstName??"",phoneticLastName:s.phoneticLastName??"",company:s.company??"",department:s.department??"",jobTitle:s.jobTitle??"",emails:s.emails.length?s.emails:[{value:"",label:"Domicile"}],phones:s.phones.length?s.phones:[{value:"",label:"Mobile"}],addresses:s.addresses??[],birthday:s.birthday??{day:void 0,month:void 0,year:void 0},notes:s.notes??"",labels:s.labels??[],avatarUrl:s.avatarUrl}))},[e,t,c,A]);let O=C("firstName"),q=C("lastName"),W=C("emails"),B=C("avatarUrl"),U=C("labels")??[],H=`${O??""} ${q??""}`.trim(),V=I||"create"===e&&!!(O?.trim()||q?.trim()||W?.some(e=>e.value?.trim())),K=(0,n.useCallback)(e=>{M("labels",U.includes(e)?U.filter(t=>t!==e):[...U,e],{shouldDirty:!0})},[U,M]),Q=h.filter(e=>!1!==e.enabled);return(0,a.jsxs)("form",{onSubmit:k(function(a){let n={namePrefix:a.namePrefix||void 0,firstName:a.firstName??"",middleName:a.middleName||void 0,lastName:a.lastName??"",nameSuffix:a.nameSuffix||void 0,phoneticFirstName:a.phoneticFirstName||void 0,phoneticLastName:a.phoneticLastName||void 0,company:a.company||void 0,department:a.department||void 0,jobTitle:a.jobTitle||void 0,emails:a.emails.filter(e=>e.value),phones:a.phones.filter(e=>e.value),addresses:a.addresses.filter(e=>e.street||e.city||e.region||e.postalCode||e.country),birthday:a.birthday?.day||a.birthday?.month||a.birthday?.year?a.birthday:void 0,notes:a.notes||void 0,labels:a.labels?.length?a.labels:void 0,avatarUrl:a.avatarUrl||void 0};if("create"===e){let e=crypto.randomUUID(),t={id:e,...n,firstName:n.firstName??"",lastName:n.lastName??"",emails:n.emails??[],phones:n.phones??[],createdAt:Date.now(),updatedAt:Date.now()};u.mutate({bookId:d,contact:(0,ox.h0)(t)},{onSuccess:t=>{s("view",t?.uid??e)},onError:e=>{let t=e instanceof Error&&e.message?e.message:"Impossible d'enregistrer le contact";ng.oR.error(t)}})}else if(t&&w){let e={id:t,path:w.path,etag:w.etag,...n,firstName:n.firstName??"",lastName:n.lastName??"",emails:n.emails??[],phones:n.phones??[],createdAt:w.createdAt,updatedAt:Date.now()};if(!w.etag)return void ng.oR.error("Impossible d'enregistrer : version du contact inconnue. Rechargez la liste.");m.mutate({path:(0,of.Y)(e),etag:w.etag,contact:(0,ox.h0)(e)},{onSuccess:()=>s("view",t),onError:e=>{let t=e instanceof Error&&e.message?e.message:"Impossible d'enregistrer les modifications";ng.oR.error(t)}})}}),className:(0,ec.cn)("flex h-full flex-col",oe.RJ),children:[(0,a.jsxs)("div",{className:oe.us,children:[(0,a.jsx)(os.L,{onClick:r,className:"-ml-1"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",onClick:()=>f(e=>!e),children:(0,a.jsx)(aZ.A,{className:(0,ec.cn)("h-4 w-4",x?"fill-yellow-400 text-yellow-400":oe._w)})}),(0,a.jsx)("button",{type:"submit",disabled:!V,className:oe.ZT,children:"Enregistrer"}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:oe.BP,onClick:l,children:(0,a.jsx)(S.A,{className:"h-4 w-4"})})]})]}),(0,a.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[(0,a.jsx)("div",{className:"flex flex-col items-center py-6",children:(0,a.jsx)(op.y,{variant:"panel",avatarUrl:B,displayName:H,email:W?.find(e=>e.value?.trim())?.value,onChange:e=>M("avatarUrl",e,{shouldDirty:!0})})}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-1.5 px-4 pb-4",children:[U.map(e=>{let t=h.find(t=>t.id===e);return(0,a.jsxs)("span",{className:oe.Th,children:[t&&(0,a.jsx)("span",{className:`inline-block h-2 w-2 rounded-full ${t.color}`}),t?.label??e,(0,a.jsx)("button",{type:"button",onClick:()=>K(e),className:"text-muted-foreground hover:text-foreground",children:(0,a.jsx)(S.A,{className:"h-3 w-3"})})]},e)}),(0,a.jsxs)(a6.AM,{children:[(0,a.jsx)(a6.Wv,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",className:oe.qL,children:[(0,a.jsx)(eK.A,{className:"h-3 w-3"}),"Libell\xe9"]})}),(0,a.jsxs)(a6.hl,{"data-contacts-menu-surface":!0,className:(0,ec.cn)("w-52 p-1",oe.XF),align:"center",children:[(0,a.jsx)("p",{className:(0,ec.cn)("px-2 py-1.5 text-xs font-medium",oe.YS),children:"Libell\xe9s"}),(0,a.jsx)("div",{className:"max-h-48 overflow-y-auto",children:Q.map(e=>{let t=U.includes(e.id);return(0,a.jsxs)("button",{type:"button",onClick:()=>K(e.id),className:oe.Iz,children:[(0,a.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${e.color}`}),(0,a.jsx)("span",{className:"flex-1 truncate",children:e.label}),t&&(0,a.jsx)(e6.A,{className:"h-3.5 w-3.5 text-blue-600"})]},e.id)})})]})]})]}),(0,a.jsxs)(oC,{icon:(0,a.jsx)(ef.A,{className:(0,ec.cn)("h-5 w-5",oe._w)}),children:[p&&(0,a.jsx)(oA,{label:"Titre (M., Mme...)",...y("namePrefix")}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(oA,{label:"Pr\xe9nom",...y("firstName")})}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:(0,ec.cn)("h-8 w-8 shrink-0 rounded-full",oe.BP),onClick:()=>b(e=>!e),children:p?(0,a.jsx)(aY.A,{className:"h-4 w-4"}):(0,a.jsx)(eV.A,{className:"h-4 w-4"})})]}),p&&(0,a.jsx)(oA,{label:"Deuxi\xe8me pr\xe9nom",...y("middleName")}),(0,a.jsx)(oA,{label:"Nom",...y("lastName")}),p&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(oA,{label:"Suffixe (Jr., Sr...)",...y("nameSuffix")}),(0,a.jsx)(oA,{label:"Pr\xe9nom phon\xe9tique",...y("phoneticFirstName")}),(0,a.jsx)(oA,{label:"Nom phon\xe9tique",...y("phoneticLastName")})]})]}),(0,a.jsxs)(oC,{icon:(0,a.jsx)(oc.A,{className:(0,ec.cn)("h-5 w-5",oe._w)}),children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(oA,{label:"Entreprise",...y("company")})}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:(0,ec.cn)("h-8 w-8 shrink-0 rounded-full",oe.BP),onClick:()=>v(e=>!e),children:g?(0,a.jsx)(aY.A,{className:"h-4 w-4"}):(0,a.jsx)(eV.A,{className:"h-4 w-4"})})]}),g&&(0,a.jsx)(oA,{label:"Service",...y("department")}),(0,a.jsx)(oA,{label:"Fonction",...y("jobTitle")})]}),(0,a.jsxs)(oC,{icon:(0,a.jsx)(aD.A,{className:(0,ec.cn)("h-5 w-5",oe._w)}),children:[z.map((e,t)=>(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(oA,{label:"E-mail",type:"email",...y(`emails.${t}.value`)})}),z.length>1&&(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:(0,ec.cn)("h-8 w-8 shrink-0 rounded-full",oe.BP),onClick:()=>L(t),children:(0,a.jsx)(S.A,{className:"h-3.5 w-3.5"})})]}),(0,a.jsx)(ol.xI,{control:N,name:`emails.${t}.label`,render:({field:e})=>(0,a.jsx)(oI,{value:e.value,onValueChange:e.onChange,options:ov.map(e=>({value:e,label:e}))})})]},e.id)),(0,a.jsx)(oS,{onClick:()=>$({value:"",label:"Domicile"}),children:"Ajouter une adresse e-mail"})]}),(0,a.jsxs)(oC,{icon:(0,a.jsx)(od.A,{className:(0,ec.cn)("h-5 w-5",oe._w)}),children:[D.map((e,t)=>(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded text-sm",children:"\uD83C\uDDEB\uD83C\uDDF7"}),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(oA,{label:"T\xe9l\xe9phone",type:"tel",...y(`phones.${t}.value`)})}),D.length>1&&(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:(0,ec.cn)("h-8 w-8 shrink-0 rounded-full",oe.BP),onClick:()=>_(t),children:(0,a.jsx)(S.A,{className:"h-3.5 w-3.5"})})]}),(0,a.jsx)(ol.xI,{control:N,name:`phones.${t}.label`,render:({field:e})=>(0,a.jsx)(oI,{value:e.value,onValueChange:e.onChange,options:oj.map(e=>({value:e,label:e}))})})]},e.id)),(0,a.jsx)(oS,{onClick:()=>T({value:"",label:"Mobile"}),children:"Ajouter un num\xe9ro de t\xe9l\xe9phone"})]}),(0,a.jsxs)(oC,{icon:(0,a.jsx)(ou.A,{className:(0,ec.cn)("h-5 w-5",oe._w)}),children:[R.map((e,t)=>(0,a.jsxs)("div",{className:oe.dn,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)(ol.xI,{control:N,name:`addresses.${t}.label`,render:({field:e})=>(0,a.jsx)(oI,{value:e.value,onValueChange:e.onChange,options:ow.map(e=>({value:e,label:e}))})}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:(0,ec.cn)("h-7 w-7 shrink-0 rounded-full",oe.BP),onClick:()=>F(t),children:(0,a.jsx)(S.A,{className:"h-3.5 w-3.5"})})]}),(0,a.jsx)(oA,{label:"Rue",...y(`addresses.${t}.street`)}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("div",{className:"w-24",children:(0,a.jsx)(oA,{label:"Code postal",...y(`addresses.${t}.postalCode`)})}),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(oA,{label:"Ville",...y(`addresses.${t}.city`)})})]}),(0,a.jsx)(oA,{label:"R\xe9gion / Province",...y(`addresses.${t}.region`)}),(0,a.jsx)(oA,{label:"Pays",...y(`addresses.${t}.country`)})]},e.id)),(0,a.jsx)(oS,{onClick:()=>P({street:"",city:"",region:"",postalCode:"",country:"",label:"Domicile"}),children:"Ajouter une adresse"})]}),(0,a.jsx)(oC,{icon:(0,a.jsx)(om.A,{className:(0,ec.cn)("h-5 w-5",oe._w)}),children:(0,a.jsxs)("div",{className:"flex items-stretch gap-2",children:[(0,a.jsx)("div",{className:"w-[72px]",children:(0,a.jsx)(oA,{label:"Jour",type:"number",min:1,max:31,...y("birthday.day",{valueAsNumber:!0})})}),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)(ol.xI,{control:N,name:"birthday.month",render:({field:e})=>(0,a.jsx)(oI,{value:e.value?String(e.value):"",onValueChange:t=>e.onChange(t?Number(t):void 0),options:og.map((e,t)=>({value:String(t+1),label:e})),placeholder:"Mois"})})}),(0,a.jsx)("div",{className:"w-24",children:(0,a.jsx)(oA,{label:"Ann\xe9e",type:"number",min:1900,max:2100,...y("birthday.year",{valueAsNumber:!0})})})]})}),(0,a.jsx)(oC,{icon:(0,a.jsx)(aJ.A,{className:(0,ec.cn)("h-5 w-5",oe._w)}),children:(0,a.jsx)(oM,{label:"Notes",...y("notes")})}),(0,a.jsx)("div",{className:"h-8"})]})]})}function oC({icon:e,children:t}){return(0,a.jsxs)("div",{className:"flex gap-3 px-4 py-2",children:[(0,a.jsx)("div",{className:"flex w-5 shrink-0 pt-2",children:e}),(0,a.jsx)("div",{className:"flex-1 space-y-2",children:t})]})}function oS({onClick:e,children:t}){return(0,a.jsxs)("button",{type:"button",onClick:e,className:(0,ec.cn)("flex items-center gap-2 py-1",oe.Dw,"hover:text-primary/80"),children:[(0,a.jsx)(eK.A,{className:"h-4 w-4"}),t]})}let oA=(0,n.forwardRef)(function({label:e,className:t,defaultValue:s,...r},l){let i=(0,n.useId)(),[o,c]=(0,n.useState)(!1),[d,u]=(0,n.useState)(()=>!!s),m=(0,n.useRef)(null);(0,n.useEffect)(()=>{m.current?.value&&u(!0)},[s]);let h=(0,n.useCallback)(e=>{m.current=e,"function"==typeof l?l(e):l&&(l.current=e),e&&e.value&&u(!0)},[l]);return(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{ref:h,id:i,...r,defaultValue:s,className:(0,ec.cn)(oe.mI,t),onFocus:e=>{c(!0),r.onFocus?.(e)},onBlur:e=>{c(!1),u(!!e.target.value),r.onBlur?.(e)},onChange:e=>{u(!!e.target.value),r.onChange?.(e)}}),(0,a.jsx)("label",{htmlFor:i,className:(0,ec.cn)(oe.mB,o||d?"top-0.5 px-0.5 text-[10px] leading-tight":"top-[11px] text-sm",o?"text-primary":"text-muted-foreground"),children:e})]})}),oM=(0,n.forwardRef)(function({label:e,className:t,...s},r){let l=(0,n.useId)(),[i,o]=(0,n.useState)(!1),[c,d]=(0,n.useState)(!1),u=(0,n.useRef)(null);(0,n.useEffect)(()=>{u.current?.value&&d(!0)},[]);let m=(0,n.useCallback)(e=>{u.current=e,"function"==typeof r?r(e):r&&(r.current=e),e&&e.value&&d(!0)},[r]);return(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("textarea",{ref:m,id:l,rows:3,...s,className:(0,ec.cn)(oe.AT,t),onFocus:e=>{o(!0),s.onFocus?.(e)},onBlur:e=>{o(!1),d(!!e.target.value),s.onBlur?.(e)},onChange:e=>{d(!!e.target.value),s.onChange?.(e)}}),(0,a.jsx)("label",{htmlFor:l,className:(0,ec.cn)(oe.mB,i||c?"top-1 px-0.5 text-[10px] leading-tight":"top-2.5 text-sm",i?"text-primary":"text-muted-foreground"),children:e})]})});function oI({value:e,onValueChange:t,options:s,placeholder:n}){return(0,a.jsxs)(ez.l6,{value:e,onValueChange:t,children:[(0,a.jsx)(ez.bq,{className:oe.Op,children:(0,a.jsx)(ez.yv,{placeholder:n??"Choisir..."})}),(0,a.jsx)(ez.gC,{"data-contacts-menu-surface":!0,className:oe.XF,children:s.map(e=>(0,a.jsx)(ez.eb,{value:e.value,children:e.label},e.value))})]})}var oE=s(95421),oz=s(55133),o$=s(3424);let oL=["janvier","f\xe9vrier","mars","avril","mai","juin","juillet","ao\xfbt","septembre","octobre","novembre","d\xe9cembre"];function oD({contactId:e}){var t;let s,{setView:r,showContactsList:l,closePanel:i}=(0,ni.Y)(),{contacts:o}=(0,no.D)(),{openComposeWithInitial:c}=Z(),d=(0,ob.w)(e=>e.labelRows),{data:u}=(0,oE.Y0)(),[m,h]=(0,n.useState)(!1),x=(0,oz._)(u),f=o.find(t=>t.id===e),p=f?.emails[0]?.value,{data:b}=(0,se.ji)(p?{from:p}:null),g=(0,n.useMemo)(()=>b?.data?b.data.slice(0,10).map(e=>({id:e.id,subject:e.subject,preview:e.snippet,date:e.date})):[],[b]);if(!f)return(0,a.jsx)("div",{className:(0,ec.cn)("flex h-full items-center justify-center text-sm",oe.YS),children:"Contact introuvable"});let v=(0,i9.t)(f),j=v||f.emails[0]?.value||f.phones[0]?.value||"?",w=f.emails[0]?.value;return(0,a.jsxs)("div",{className:(0,ec.cn)("flex h-full min-w-0 flex-col overflow-hidden",oe.RJ),children:[(0,a.jsxs)("div",{className:oe.us,children:[(0,a.jsx)(os.L,{onClick:l,className:"-ml-1"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:oe.BP,onClick:()=>h(!0),disabled:!x,"aria-label":"Am\xe9lioration IA",title:x?"Am\xe9liorer la fiche avec l'IA":"Configurez un fournisseur LLM dans les r\xe9glages contacts",children:(0,a.jsx)(i2.A,{className:"h-4 w-4 text-amber-500"})}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:oe.BP,onClick:()=>r("edit",e),"aria-label":"Modifier",children:(0,a.jsx)(I.A,{className:"h-4 w-4"})}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:oe.BP,children:(0,a.jsx)(aZ.A,{className:"h-4 w-4"})}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:oe.BP,onClick:i,children:(0,a.jsx)(S.A,{className:"h-4 w-4"})})]})]}),(0,a.jsx)(i6,{className:"min-h-0 min-w-0 flex-1 overflow-hidden [&_[data-slot=scroll-area-viewport]>div]:!block [&_[data-slot=scroll-area-viewport]>div]:min-w-0 [&_[data-slot=scroll-area-viewport]>div]:max-w-full",children:(0,a.jsxs)("div",{className:"w-full min-w-0 max-w-full overflow-x-hidden",children:[(0,a.jsxs)("div",{className:"flex flex-col items-center px-4 pt-6 pb-4",children:[(0,a.jsx)(nt.q,{contact:f,name:j,size:"lg"}),(0,a.jsx)("h2",{className:(0,ec.cn)("mt-3 max-w-full truncate px-2 text-center text-lg font-medium",oe.NS),children:j}),f.company&&(0,a.jsxs)("p",{className:(0,ec.cn)("max-w-full truncate px-2 text-center text-sm",oe.YS),children:[f.jobTitle?`${f.jobTitle} `:"",f.company]}),f.labels&&f.labels.length>0&&(0,a.jsx)("div",{className:"mt-2 flex flex-wrap gap-1",children:f.labels.map(e=>{let t=d.find(t=>t.id===e);return(0,a.jsxs)("span",{className:oe.Th,children:[t&&(0,a.jsx)("span",{className:`inline-block h-2 w-2 rounded-full ${t.color}`}),t?.label??e]},e)})})]}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col items-center gap-2 px-4 pb-4",children:[(0,a.jsxs)(E.$,{type:"button",variant:"outline",size:"sm",className:"w-full max-w-xs rounded-full",onClick:()=>h(!0),disabled:!x,title:x?void 0:"Configurez un fournisseur LLM dans les r\xe9glages contacts",children:[(0,a.jsx)(i2.A,{className:"mr-1.5 h-4 w-4 text-amber-500"}),"Am\xe9lioration IA"]}),w&&(0,a.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-center gap-2",children:[(0,a.jsxs)("button",{type:"button",className:oe.MZ,onClick:()=>c({to:[{name:v,email:w}]}),children:[(0,a.jsx)(aD.A,{className:"h-4 w-4"}),"Envoyer un e-mail"]}),(0,a.jsx)("button",{type:"button",className:oe.mQ,children:(0,a.jsx)(na.A,{className:"h-4 w-4"})}),(0,a.jsx)("button",{type:"button",className:oe.mQ,children:(0,a.jsx)(nn.A,{className:"h-4 w-4"})})]})]}),(0,a.jsxs)("div",{className:(0,ec.cn)("min-w-0",oe.Se),children:[f.emails.length>0&&(0,a.jsx)(oT,{icon:(0,a.jsx)(aD.A,{className:(0,ec.cn)("h-4.5 w-4.5",oe._w)}),children:f.emails.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"truncate text-sm text-primary",children:e.value}),(0,a.jsx)("p",{className:(0,ec.cn)("text-xs",oe.YS),children:e.label})]},t))}),f.phones.length>0&&(0,a.jsx)(oT,{icon:(0,a.jsx)(od.A,{className:(0,ec.cn)("h-4.5 w-4.5",oe._w)}),children:f.phones.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm text-primary",children:e.value}),(0,a.jsx)("p",{className:(0,ec.cn)("text-xs",oe.YS),children:e.label})]},t))}),f.company&&(0,a.jsx)(oT,{icon:(0,a.jsx)(oc.A,{className:(0,ec.cn)("h-4.5 w-4.5",oe._w)}),children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:(0,ec.cn)("text-sm",oe.NS),children:f.company}),f.department&&(0,a.jsx)("p",{className:(0,ec.cn)("text-xs",oe.YS),children:f.department}),f.jobTitle&&(0,a.jsx)("p",{className:(0,ec.cn)("text-xs",oe.YS),children:f.jobTitle})]})}),f.addresses&&f.addresses.length>0&&(0,a.jsx)(oT,{icon:(0,a.jsx)(ou.A,{className:(0,ec.cn)("h-4.5 w-4.5",oe._w)}),children:f.addresses.map((e,t)=>(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:(0,ec.cn)("break-words text-sm [overflow-wrap:anywhere]",oe.NS),children:[e.street,[e.postalCode,e.city].filter(Boolean).join(" "),e.region,e.country].filter(Boolean).join(", ")}),(0,a.jsx)("p",{className:(0,ec.cn)("text-xs",oe.YS),children:e.label})]},t))}),f.birthday&&(f.birthday.day||f.birthday.month)&&(0,a.jsx)(oT,{icon:(0,a.jsx)(om.A,{className:(0,ec.cn)("h-4.5 w-4.5",oe._w)}),children:(0,a.jsx)("p",{className:(0,ec.cn)("text-sm",oe.NS),children:(t=f.birthday,s=[],t.day&&s.push(String(t.day)),t.month&&s.push(oL[t.month-1]??""),t.year&&s.push(String(t.year)),s.join(" "))})}),f.notes&&(0,a.jsx)(oT,{icon:(0,a.jsx)(aJ.A,{className:(0,ec.cn)("h-4.5 w-4.5",oe._w)}),children:(0,a.jsx)("p",{className:(0,ec.cn)("whitespace-pre-wrap text-sm",oe.NS),children:f.notes})})]}),g.length>0&&(0,a.jsxs)("div",{className:(0,ec.cn)("min-w-0 overflow-hidden pt-3 pb-4",oe.Se),children:[(0,a.jsx)("h3",{className:(0,ec.cn)("px-4 pb-2 text-xs font-medium uppercase",oe.YS),children:"Interactions r\xe9centes"}),g.map(e=>{let t,s;return(0,a.jsxs)("div",{className:(0,ec.cn)("flex min-w-0 gap-3 overflow-hidden px-4 py-2",oe.xk),children:[(0,a.jsx)(aD.A,{className:(0,ec.cn)("mt-0.5 h-4 w-4 shrink-0",oe._w)}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 overflow-hidden",children:[(0,a.jsx)("p",{className:(0,ec.cn)("truncate text-sm",oe.NS),children:e.subject}),(0,a.jsx)("p",{className:(0,ec.cn)("line-clamp-2 break-words [overflow-wrap:anywhere] text-xs",oe.YS),children:e.preview}),(0,a.jsx)("p",{className:(0,ec.cn)("mt-0.5 text-xs",oe.YS),children:(t=new Date(e.date),0===(s=Math.floor((new Date().getTime()-t.getTime())/864e5))?"Aujourd'hui":1===s?"Hier":s<7?`Il y a ${s} jours`:t.toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"}))})]})]},e.id)})]})]})}),(0,a.jsx)(o$.Z,{contact:f,open:m,onOpenChange:h})]})}function oT({icon:e,children:t}){return(0,a.jsxs)("div",{className:"flex min-w-0 gap-3 px-4 py-3",children:[(0,a.jsx)("div",{className:"flex w-5 shrink-0 pt-0.5",children:e}),(0,a.jsx)("div",{className:"min-w-0 flex-1 space-y-2 overflow-hidden",children:t})]})}function o_(){let{panelOpen:e,view:t,activeContactId:s,closePanel:r,setSearchMode:l,setSearchQuery:i,searchMode:o}=(0,ni.Y)(),c=(0,n.useCallback)(s=>{if(!e||"list"!==t||o||s.metaKey||s.ctrlKey||s.altKey)return;let a=s.target;"INPUT"!==a.tagName&&"TEXTAREA"!==a.tagName&&!a.isContentEditable&&1===s.key.length&&/\S/.test(s.key)&&(s.preventDefault(),l(!0),i(s.key))},[e,t,o,l,i]);return(0,n.useEffect)(()=>(document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)),[c]),(0,a.jsx)(ep.cj,{open:e,onOpenChange:e=>!e&&r(),children:(0,a.jsxs)(ep.h,{side:"right",hideClose:!0,overlayClassName:"bg-transparent","data-contacts-panel":!0,className:"w-[360px] sm:max-w-[360px] gap-0 border-border bg-mail-surface p-0 text-foreground",children:[(0,a.jsx)(ep.qp,{className:"sr-only",children:"Contacts"}),"list"===t&&(0,a.jsx)(on,{}),"view"===t&&(0,a.jsx)(oD,{contactId:s}),"create"===t&&(0,a.jsx)(oN,{mode:"create"}),"edit"===t&&(0,a.jsx)(oN,{mode:"edit",contactId:s})]})})}var oR=s(86669);let oP={x:0,y:0};function oF(){let e=(0,r.LZ)(),{state:t}=tk(),[s,l]=(0,n.useState)(!1),i=(0,n.useRef)(null),o=(0,n.useSyncExternalStore)(tv,tg,()=>oP);if((0,n.useEffect)(()=>{l(!0)},[]),(0,n.useLayoutEffect)(()=>{if(!t||"returning"!==t.phase)return;let e=i.current;if(!e)return;let s=t.originX-t.pointerX,a=t.originY-t.pointerY,n=e.animate([{translate:"0px 0px",opacity:1},{translate:`${s}px ${a}px`,opacity:0}],{duration:240,easing:"cubic-bezier(0.22, 0.61, 0.36, 1)",fill:"forwards"});return()=>{n.cancel()}},[t?.phase,t?.originX,t?.originY,t?.pointerX,t?.pointerY]),e||!s||!t)return null;let c=t.ids.length,d=c>1?`D\xe9placer ${c} conversations`:"D\xe9placer 1 conversation",u="returning"===t.phase?t.pointerX:o.x,m="returning"===t.phase?t.pointerY:o.y;return(0,oR.createPortal)((0,a.jsx)("div",{ref:i,"aria-hidden":!0,className:"pointer-events-none fixed z-100 select-none",style:{left:u,top:m,transform:"translate(-50%, -50%)",willChange:"translate, opacity"},children:(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-[#1a73e8] px-4 py-3 text-sm font-medium text-white shadow-lg",children:[(0,a.jsx)(aD.A,{className:"size-5 shrink-0",strokeWidth:1.75}),(0,a.jsx)("span",{className:"whitespace-nowrap",children:d})]})}),document.body)}var oO=s(16114);function oq(){let{openComposeWithInitial:e}=Z();return(0,n.useEffect)(()=>{let t=(0,oO.P2)();t&&0!==t.to.length&&e({to:t.to,subject:t.subject??"",bodyHtml:t.bodyText?`<p>${t.bodyText.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\n/g,"<br/>")}</p>`:void 0,focusBodyOnMount:!0})},[]),null}var oW=s(28292);function oB(){let{route:e}=p(),t=(0,t3.jE)(),{data:s}=(0,se.JX)(e.mailId);return(0,n.useEffect)(()=>{let a=e.mailId?function(e,t){for(let[,s]of e.getQueriesData({queryKey:["messages"]})){let e=s?.data?.find(e=>e.id===t);if(e?.subject?.trim())return e.subject}return null}(t,e.mailId):null,n=s?.subject??a;document.title=(0,oW.d5)(e.mailId?n:null)},[e.mailId,s?.subject,t]),null}var oU=s(60142),oH=s(83833),oV=s(1881),oK=s(49845);function oQ(){let e=(0,d.x)(e=>e.quickSettingsOpen),t=(0,d.x)(e=>e.themeDialogOpen),s=(0,d.x)(e=>e.setQuickSettingsOpen),n=(0,d.x)(e=>e.setThemeDialogOpen);return(0,a.jsx)(ep.cj,{open:e,onOpenChange:e=>!e&&s(!1),children:(0,a.jsxs)(ep.h,{side:"right",hideClose:!0,overlayClassName:(0,ec.cn)("bg-black/20",t&&"hidden"),"aria-label":"Configuration rapide","aria-describedby":void 0,className:"w-full gap-0 border-border bg-mail-surface p-0 text-foreground sm:max-w-[360px]",onInteractOutside:e=>{t&&e.preventDefault()},onEscapeKeyDown:e=>{t&&e.preventDefault()},children:[(0,a.jsxs)("header",{className:"flex shrink-0 items-center justify-between gap-2 px-4 pt-5 pb-3",children:[(0,a.jsx)(ep.qp,{className:"text-base font-normal text-foreground dark:text-white",children:"Configuration rapide"}),(0,a.jsx)(E.$,{type:"button",variant:"ghost",size:"icon",className:"size-9 text-muted-foreground","aria-label":"Fermer",onClick:()=>s(!1),children:(0,a.jsx)(S.A,{className:"size-5"})})]}),(0,a.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsx)(E.$,{variant:"outline",className:"h-10 w-full rounded-full border-[#1a73e8] text-[#1a73e8] hover:bg-[#e8f0fe]/50 dark:border-[#9aa0a6] dark:text-white dark:hover:bg-[#3c4043]/50",asChild:!0,children:(0,a.jsx)(ik(),{href:oK.gH,onClick:()=>s(!1),children:"Voir tous les param\xe8tres"})})}),(0,a.jsx)(oV.S,{variant:"panel",onOpenThemeDialog:()=>n(!0)})]})]})})}var oG=s(60428);function oY(){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(oQ,{}),(0,a.jsx)(oG.h,{})]})}var oZ=s(74575),oJ=s(93079),oX=s(10937),o0=s(61504),o1=s(58411),o2=s(28502),o3=s(12646);function o5(){let{route:e,navigateRoute:t,searchParams:s}=p(),l="search"===e.folderId?(0,y.uK)(j(s)):"",h=(0,r.LZ)(),f=c(),b=function(){let e=(0,d.x)(e=>e.readingPane),[t,s]=(0,n.useState)(!1);return(0,n.useLayoutEffect)(()=>{let t=window.matchMedia(u),a=window.matchMedia(m),n=window.matchMedia("(hover: none) and (pointer: coarse)"),r=window.matchMedia("(min-width: 1024px)"),l=0,o=()=>{cancelAnimationFrame(l),l=requestAnimationFrame(()=>{let t=function(e="none"){if(!window.matchMedia(u).matches)return!1;let t=i()&&window.matchMedia(m).matches;return window.matchMedia("(min-width: 1024px)").matches?"right"===e||"none"===e&&t:t}(e);s(e=>e===t?e:t)})};return o(),t.addEventListener("change",o),a.addEventListener("change",o),n.addEventListener("change",o),r.addEventListener("change",o),()=>{t.removeEventListener("change",o),a.removeEventListener("change",o),n.removeEventListener("change",o),r.removeEventListener("change",o),cancelAnimationFrame(l)}},[e]),t}(),g=sg(e=>e.pushRecentFolderVisit),v=aM(e=>e.sidebarCollapsed),w=aM(e=>e.setSidebarCollapsed),k=aM(e=>e.mobileSearchOpen),N=aM(e=>e.setMobileSearchOpen),C=aM(e=>e.folderUnreadCounts),S=aM(e=>e.setFolderUnreadCounts),[A,M]=(0,n.useState)(null);(0,n.useLayoutEffect)(()=>{o()||w(!1)},[w]),(0,n.useEffect)(()=>{h&&w(!0)},[h,w]),(0,n.useEffect)(()=>{"search"!==e.folderId&&g(ap(e.folderId,e.inboxTab))},[e.folderId,e.inboxTab,g]);let I=(0,n.useCallback)(e=>{aM.getState().requestSuppressSplitAutoOpen(),t({folderId:e,inboxTab:x.ZO,page:1,mailId:null}),o()&&w(!0)},[t,w]);return(0,a.jsxs)(tH.RE,{routeFolderId:e.folderId,onRouteFolderIdChange:e=>{aM.getState().requestSuppressSplitAutoOpen(),t({folderId:e,inboxTab:x.ZO,page:1,mailId:null})},children:[(0,a.jsx)(oB,{}),(0,a.jsxs)("div",{className:"ultimail-app flex h-dvh max-h-dvh flex-col overflow-hidden bg-app-canvas",children:[b?null:(0,a.jsx)("div",{className:"hidden sm:block",children:(0,a.jsx)(t2,{isXs:!1,sidebarCollapsed:v||f,onToggleSidebar:()=>w(!v),onOpenMobileSearch:()=>N(!0)})}),(0,a.jsxs)("div",{className:(0,ec.cn)("relative flex min-h-0 flex-1 gap-0 overflow-hidden pl-0 pr-0",b?"bg-mail-surface p-0":"bg-app-canvas sm:gap-1 sm:pb-1 sm:pl-1 sm:pt-1"),children:[!v&&f&&(0,a.jsx)("button",{type:"button","aria-label":"Fermer le menu",className:"absolute inset-0 z-30 bg-black/20",onClick:()=>w(!0)}),(0,a.jsx)("div",{className:(0,ec.cn)("shrink-0 transition-[width] duration-200 ease-linear",h?"w-0":v?"w-[68px]":"w-60"),"aria-hidden":!0}),(0,a.jsx)(tZ,{selectedFolder:e.folderId,onSelectFolder:I,collapsed:v,folderUnreadCounts:C,splitView:b}),(0,a.jsx)("main",{className:(0,ec.cn)("flex min-h-0 flex-1 flex-col overflow-hidden bg-mail-surface",b?"rounded-none shadow-none":"rounded-none shadow-none sm:rounded-2xl sm:shadow-sm"),children:(0,a.jsx)(n.Suspense,{children:(0,a.jsx)(i1,{selectedFolder:e.folderId,inboxTab:e.inboxTab,listPage:e.page,openMailId:e.mailId,splitView:b,onToggleSidebar:()=>aM.getState().toggleSidebarCollapsed(),onMailRouteNavigate:t,onSelectFolder:I,onFolderUnreadCountsChange:S,onXsViewChromeChange:M})})}),(0,a.jsx)("div",{className:(0,ec.cn)("flex shrink-0 flex-col",b&&"border-l border-gray-200"),children:(0,a.jsx)(i5,{})}),(0,a.jsx)(o_,{}),(0,a.jsx)(o3.H,{})]}),b?null:(0,a.jsx)(eu,{sidebarOpen:!v,onToggleSidebar:()=>aM.getState().toggleSidebarCollapsed(),xsViewChrome:A,onOpenSearch:()=>N(!0),searchQuery:l,onClearSearch:()=>t({folderId:"inbox",inboxTab:x.ZO,page:1,mailId:null})}),(0,a.jsx)(eF,{open:k,onClose:()=>N(!1),initialQuery:l})]})]})}function o4({children:e}){return(0,o1.h3)(),(0,n.useEffect)(()=>{let e=e=>e.preventDefault();return document.addEventListener("gesturestart",e,{passive:!1}),document.addEventListener("gesturechange",e,{passive:!1}),document.addEventListener("gestureend",e,{passive:!1}),()=>{document.removeEventListener("gesturestart",e),document.removeEventListener("gesturechange",e),document.removeEventListener("gestureend",e)}},[]),(0,a.jsx)(oU.N,{attribute:"class",defaultTheme:"system",enableSystem:!0,children:(0,a.jsx)(Y,{children:(0,a.jsx)(sp,{children:(0,a.jsxs)(ty,{children:[(0,a.jsx)(n.Suspense,{fallback:(0,a.jsxs)("div",{className:"flex h-dvh max-h-dvh flex-col overflow-hidden bg-app-canvas",children:[(0,a.jsx)("div",{className:"hidden h-14 shrink-0 border-b border-gray-200 bg-white sm:block"}),(0,a.jsx)("div",{className:"min-h-0 flex-1 bg-app-canvas"})]}),children:(0,a.jsx)(o5,{})}),(0,a.jsx)(oH.C,{}),(0,a.jsx)(oZ.O,{}),(0,a.jsx)(oJ.k,{}),(0,a.jsx)(rV._,{}),(0,a.jsx)(oX.e,{}),(0,a.jsx)(o0.D,{}),(0,a.jsx)(oY,{}),(0,a.jsx)(oF,{}),(0,a.jsx)(oq,{}),(0,a.jsx)(rJ,{}),(0,a.jsx)(o2.d,{})]})})})})}},28502:(e,t,s)=>{"use strict";s.d(t,{d:()=>U});var a=s(4208),n=s(7057),r=s(19984),l=s(91356),i=s(91505),o=s(12325),c=s(99833),d=s(61760),u=s(18584),m=s(90293),h=s(81613),x=s(71809),f=s(78606),p=s(12551),b=s(69446),g=s(26159),v=s(35855),j=s.n(v),w=s(89032),y=s(18166),k=s(61554),N=s(63429),C=s(94658),S=s(46794),A=s(42491),M=s(7738),I=s(71092);async function E(e,t,s){let a=await (0,S.K3)(e,t,s),n=URL.createObjectURL(a),r=document.createElement("a");r.href=n,r.download=t.name,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}var z=s(63639),$=s(94927),L=s(22854),D=s(58113);function T({markup:e,name:t,className:s}){let n,r;return(0,a.jsx)("iframe",{title:(0,L._g)(t),srcDoc:(r=(n=e.trim()).toLowerCase()).startsWith("<!doctype")||r.startsWith("<html")?n:`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:transparent}svg{max-width:100%;max-height:100%;width:auto;height:auto}</style></head><body>${n}</body></html>`,sandbox:"",className:(0,D.cn)("h-full min-h-[120px] w-full max-w-full flex-1 border-0 bg-transparent",s)})}var _=s(93510),R=s(91725),P=s(74230),F=s(29502);let O=(0,n.default)(()=>Promise.all([s.e(2859),s.e(2084)]).then(s.bind(s,92084)).then(e=>e.PdfPreviewViewer),{loadableGenerated:{webpack:()=>[92084]},ssr:!1,loading:()=>(0,a.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-zinc-400",children:[(0,a.jsx)(i.A,{className:"h-10 w-10 animate-spin","aria-hidden":!0}),(0,a.jsx)("span",{className:"text-sm",children:"Ouverture du PDF"})]})}),q="cursor-pointer text-zinc-300 hover:bg-white/10 hover:text-white disabled:pointer-events-none disabled:opacity-40";function W({label:e,onClick:t,disabled:s,className:n,children:r}){return(0,a.jsx)(k.$,{type:"button",variant:"ghost",size:"icon",className:(0,D.cn)(q,n),onClick:t,disabled:s,"aria-label":e,children:r})}function B({kind:e,blobUrl:t,name:s,textContent:n,svgMarkup:r,onImageError:l}){return"text"===e?(0,a.jsx)("pre",{className:"h-full w-full overflow-auto rounded-md bg-zinc-900 p-4 text-left font-mono text-sm leading-relaxed whitespace-pre-wrap break-words text-zinc-100",children:n??""}):r?(0,a.jsx)(T,{markup:r,name:s}):"image"===e?(0,a.jsx)("img",{src:t,alt:(0,L._g)(s),className:"max-h-full max-w-full object-contain",onError:l}):"video"===e?(0,a.jsx)("video",{src:t,controls:!0,autoPlay:!0,className:"max-h-full max-w-full rounded-md bg-black",playsInline:!0,children:(0,a.jsx)("track",{kind:"captions"})}):"audio"===e?(0,a.jsx)("audio",{src:t,controls:!0,autoPlay:!0,className:"w-full max-w-lg",children:(0,a.jsx)("track",{kind:"captions"})}):(0,a.jsx)(O,{blobUrl:t,name:s},t)}function U(){let e=(0,_.J)(e=>e.previewFiles),t=(0,_.J)(e=>e.previewIndex),s=(0,_.J)(e=>e.previewContext),n=(0,_.J)(e=>e.closePreview),v=(0,_.J)(e=>e.stepPreview),T=(0,_.J)(e=>e.setSharePath),O=(0,_.J)(e=>e.updatePreviewFavorite),U=(0,_.J)(e=>e.removePreviewFile),H=(0,z.c1)(),[V,K]=(0,l.useState)(null),[Q,G]=(0,l.useState)(!1),Y=t>=0?e[t]??null:null,Z=(0,l.useMemo)(()=>Y?(0,I.D9)(Y):null,[Y]),J=s?.allowShare??!0,X=s?.isTrash??!1,ee=s?.publicShare,et=s?.mailSource??!1,es=s?.mailMessageId??Y?.mailMessageId??"",ea=(0,r.useRouter)(),en=(0,M.$z)(),er=(0,P.V)(es),el=et&&!!Y?.mailAttachmentId,ei=!X&&!ee&&!el,eo=el&&Y?.path.startsWith("/")?Y.path:void 0,[ec,ed]=(0,l.useState)(null),[eu,em]=(0,l.useState)(null),[eh,ex]=(0,l.useState)(null),[ef,ep]=(0,l.useState)(!1),[eb,eg]=(0,l.useState)(null),[ev,ej]=(0,l.useState)(!1),[ew,ey]=(0,l.useState)(!1),ek=(0,l.useRef)(null),eN=Y?(0,I.tF)(Y):null,eC=!!Y&&(0,I.dJ)(Y),eS=t>=0&&t<e.length-1,eA=e.length>1?`${t+1} / ${e.length}`:null,eM=()=>{ek.current&&(URL.revokeObjectURL(ek.current),ek.current=null),ed(null)};(0,l.useEffect)(()=>{if(!Y||!eN){eM(),ep(!1),eg(null),ej(!1),em(null),ex(null);return}let e=!1;return ep(!0),eg(null),ej(!1),ey(!1),em(null),ex(null),(async()=>{try{if(en&&!ee&&!Y.mailAttachmentId){let t=(0,A.m)(Y,{width:1600,height:1200});if(!t)throw Error("Aper\xe7u indisponible en mode d\xe9mo.");if(e)return;if("text"===t.type){ek.current&&(URL.revokeObjectURL(ek.current),ek.current=null),ed(null),ex(null),em(t.content);return}if("svg"===t.type){ek.current&&(URL.revokeObjectURL(ek.current),ek.current=null),ed(null),ex(t.markup);return}em(null),ex(null),ed(t.url),ey(!0);return}let t=Y.mailAttachmentId?await $.uE.getBlob(`/mail/attachments/${Y.mailAttachmentId}`):ee?await (0,S.K3)(ee.token,{path:Y.path,name:Y.name,mime_type:Y.mime_type},ee.password):await (0,C.WE)(Y);if(e)return;if("text"===eN){if(ek.current&&(URL.revokeObjectURL(ek.current),ek.current=null),ed(null),ex(null),t.size>2097152)return void eg("Fichier trop volumineux pour laper\xe7u texte. T\xe9l\xe9chargez-le.");em(await t.text());return}if(eC){ek.current&&(URL.revokeObjectURL(ek.current),ek.current=null),ed(null),ex(await t.text());return}let s=URL.createObjectURL(t),a=ek.current;ek.current=s,ed(s),a&&a!==s&&URL.revokeObjectURL(a)}catch(t){e||eg(t instanceof $.UQ?t.message:"Impossible de charger laper\xe7u.")}finally{e||ep(!1)}})(),()=>{e=!0}},[Y?.path,Y?.mime_type,Y?.mailAttachmentId,eN,eC,ee?.token,ee?.password,en]);let eI="text"===eN?null!==eu:eC?null!==eh:!!ec;(0,l.useEffect)(()=>{if(0===e.length)return;let t=e=>{"ArrowLeft"===e.key?(e.preventDefault(),v(-1)):"ArrowRight"===e.key&&(e.preventDefault(),v(1))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e.length,v]),(0,l.useEffect)(()=>()=>eM(),[]);let eE=Y?(0,L._g)(Y.name):"",ez=!!(Y&&eN),e$=async()=>{if(!Y)return;let e=!Y.is_favorite;try{await H.favorite.mutateAsync({path:Y.path,favorite:e}),O(Y.path,e),w.oR.success(e?"Ajout\xe9 aux favoris":"Retir\xe9 des favoris")}catch{w.oR.error("Impossible de modifier les favoris")}},eL=async()=>{if(Y)try{await H.deleteFile.mutateAsync(Y.path),U(Y.path),w.oR.success("Supprim\xe9")}catch{w.oR.error("Impossible de supprimer")}},eD=Y?.is_favorite?"Retirer des favoris":"Ajouter aux favoris",eT=async e=>{if(Y?.mailAttachmentId&&es)try{let t=await er.mutateAsync({attachmentId:Y.mailAttachmentId,folderPath:e});_.J.setState(e=>({previewFiles:e.previewFiles.map(e=>e.mailAttachmentId===Y.mailAttachmentId?{...e,path:t}:e)})),G(!1),w.oR.success((0,F.hM)(e),{action:{label:"Ouvrir le dossier",onClick:()=>ea.push((0,F.PI)(e))}})}catch(e){w.oR.error((0,F.e5)(e))}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(R.I,{open:Q,onOpenChange:G,title:"Enregistrer dans UltiDrive",description:"Choisissez un dossier dans votre Drive.",confirmLabel:"Enregistrer ici",pending:er.isPending,onConfirm:eT}),(0,a.jsx)(N.m,{open:null!==V,onOpenChange:e=>{e||K(null)},mode:V??"move",sources:Z?[Z]:[],onMoved:()=>{"move"===V&&Y&&U(Y.path),K(null)}}),(0,a.jsx)(y.lG,{open:ez,onOpenChange:e=>{e||n()},children:(0,a.jsxs)(y.Cf,{"aria-describedby":void 0,showCloseButton:!1,overlayClassName:"bg-black/90",className:(0,D.cn)("flex h-[min(92dvh,920px)] w-[min(96vw,1280px)] max-w-none flex-col gap-0 overflow-hidden","border-0 bg-zinc-950 p-0 text-zinc-100 shadow-2xl sm:max-w-none"),children:[(0,a.jsxs)("div",{className:"flex h-14 shrink-0 items-center gap-2 border-b border-white/10 px-4",children:[(0,a.jsx)(y.L3,{className:"min-w-0 flex-1 truncate text-left text-base font-medium text-zinc-100",children:eE}),eA?(0,a.jsx)("span",{className:"shrink-0 text-sm tabular-nums text-zinc-400",children:eA}):null,Y?(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[ei&&J?(0,a.jsx)(W,{label:"Partager",onClick:()=>{Y&&T(Y.path,"file")},children:(0,a.jsx)(o.A,{className:"h-5 w-5"})}):null,ei?(0,a.jsx)(W,{label:eD,onClick:()=>void e$(),disabled:H.favorite.isPending,className:(0,D.cn)(Y.is_favorite&&"text-amber-400 hover:bg-amber-400/10 hover:text-amber-300"),children:(0,a.jsx)(c.A,{className:"h-5 w-5",fill:Y.is_favorite?"currentColor":"none"})}):null,ei?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(W,{label:"D\xe9placer vers",onClick:()=>K("move"),children:(0,a.jsx)(d.A,{className:"h-5 w-5"})}),(0,a.jsx)(W,{label:"Copier vers",onClick:()=>K("copy"),className:"max-sm:hidden",children:(0,a.jsx)(u.A,{className:"h-5 w-5"})})]}):null,el&&!eo?(0,a.jsx)(W,{label:"Enregistrer dans UltiDrive",onClick:()=>G(!0),disabled:er.isPending,children:(0,a.jsx)(m.A,{className:"h-5 w-5"})}):null,el&&eo?(0,a.jsx)(W,{label:`Emplacement : ${(0,F.c9)(eo)}`,onClick:()=>{},disabled:!0,className:"!w-auto max-w-[min(40vw,16rem)] px-2 opacity-100",children:(0,a.jsxs)(j(),{href:(0,F.nT)(eo),className:"inline-flex min-w-0 items-center gap-1.5 text-zinc-300 hover:text-white",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)(h.A,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{className:"truncate text-xs font-normal",children:(0,F.c9)(eo)})]})}):null,(0,a.jsx)(W,{label:"T\xe9l\xe9charger",onClick:()=>void(el?Y?.mailAttachmentId&&$.uE.getBlob(`/mail/attachments/${Y.mailAttachmentId}`).then(e=>{let t=URL.createObjectURL(e),s=document.createElement("a");s.href=t,s.download=(0,L._g)(Y.name),s.click(),URL.revokeObjectURL(t)}):ee?E(ee.token,{path:Y.path,name:Y.name,mime_type:Y.mime_type,type:"file",size:0,last_modified:"",is_favorite:!1,is_shared:!1},ee.password):(0,C.jj)(Y.path,Y.name,Y.name)),children:(0,a.jsx)(x.A,{className:"h-5 w-5"})}),ei?(0,a.jsx)(W,{label:"Supprimer",onClick:()=>void eL(),disabled:H.deleteFile.isPending,className:"hover:bg-red-500/10 hover:text-red-400",children:(0,a.jsx)(f.A,{className:"h-5 w-5"})}):null,(0,a.jsx)(y.HM,{asChild:!0,children:(0,a.jsx)(k.$,{type:"button",variant:"ghost",size:"icon",className:q,"aria-label":"Fermer",children:(0,a.jsx)(p.A,{className:"h-5 w-5"})})})]}):null]}),(0,a.jsxs)("div",{className:"relative flex min-h-0 flex-1 overflow-hidden",children:[t>0?(0,a.jsx)(k.$,{type:"button",variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 z-10 h-10 w-10 -translate-y-1/2 cursor-pointer rounded-full bg-black/40 text-white hover:bg-black/60",onClick:()=>v(-1),"aria-label":"Fichier pr\xe9c\xe9dent",children:(0,a.jsx)(b.A,{className:"h-6 w-6"})}):null,eS?(0,a.jsx)(k.$,{type:"button",variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 z-10 h-10 w-10 -translate-y-1/2 cursor-pointer rounded-full bg-black/40 text-white hover:bg-black/60",onClick:()=>v(1),"aria-label":"Fichier suivant",children:(0,a.jsx)(g.A,{className:"h-6 w-6"})}):null,(0,a.jsxs)("div",{className:(0,D.cn)("flex min-h-0 flex-1 overflow-hidden","pdf"===eN?"flex-col p-0":"text"===eN?"flex-col p-4":"audio"===eN?"flex-col items-center justify-center p-8":"items-center justify-center p-4"),children:[ef?(0,a.jsxs)("div",{className:"flex flex-col items-center gap-2 text-zinc-400",children:[(0,a.jsx)(i.A,{className:"h-10 w-10 animate-spin","aria-hidden":!0}),(0,a.jsx)("span",{className:"text-sm",children:"Chargement"})]}):null,!ef&&eb?(0,a.jsx)("p",{className:"text-center text-sm text-zinc-400",children:eb}):null,ef||eb||!ev?null:(0,a.jsx)("p",{className:"text-center text-sm text-zinc-400",children:"Aper\xe7u non pris en charge par le navigateur (ex. HEIC). T\xe9l\xe9chargez le fichier."}),!ef&&!eb&&!ev&&eN&&Y&&eI?(0,a.jsx)(B,{kind:ew?"image":eN,blobUrl:ec??"",name:Y.name,textContent:eu,svgMarkup:eh,onImageError:()=>ej(!0)}):null]})]})]})})]})}},28765:(e,t,s)=>{"use strict";s.d(t,{Ir:()=>i,ql:()=>l});let a=new Set(["doc","docm","docx","dot","dotm","dotx","epub","fb2","fodt","htm","html","hwp","hwpx","md","mht","mhtml","odt","ott","rtf","stw","sxw","txt","wps","wpt","xml","ultidoc"]),n="ultidoc.json",r=["wordprocessingml","msword","opendocument.text","text/html","text/plain","text/markdown","application/rtf","application/epub"];function l(e){let t,s,l=function(e){let t=e.split("/").pop()??e;if(t.toLowerCase().endsWith(`.${n}`))return n;let s=t.lastIndexOf(".");return s<=0?"":t.slice(s+1).toLowerCase()}(e.name);if(l&&((t=l.toLowerCase())===n||a.has(t)))return!0;let i=(e.mime_type??"").toLowerCase();return!!(i&&(s=i.toLowerCase(),r.some(e=>s.includes(e))))}function i(e){return e.toLowerCase().endsWith(`.${n}`)}},29502:(e,t,s)=>{"use strict";s.d(t,{$9:()=>i,AZ:()=>r,PI:()=>c,XV:()=>l,c9:()=>o,e5:()=>u,hM:()=>d,nT:()=>m});var a=s(94927),n=s(22854);let r="/";function l(e){let t=e.trim()||r,s=(t.startsWith("/")?t:`/${t}`).replace(/\/+/g,"/");return""===s||"//"===s?r:s.replace(/\/$/,"")||r}function i(e){let t=l(e);return"/"===t?"Mon Drive":t.slice(1).split("/").map(e=>(0,n._g)(e)).join(" / ")}function o(e){let t=e.replace(/\/+/g,"/"),s=t.lastIndexOf("/");return s<=0?"Mon Drive":i(t.slice(0,s))}function c(e){let t=l(e).replace(/^\//,"").split("/").filter(Boolean);return 0===t.length?"/drive":`/drive/folders/${t.map(e=>encodeURIComponent(e)).join("/")}`}function d(e){let t=i(e);return"Mon Drive"===t?"Pi\xe8ce jointe enregistr\xe9e \xe0 la racine de Mon Drive":`Pi\xe8ce jointe enregistr\xe9e dans ${t}`}function u(e){if(e instanceof a.UQ){if("drive.quota_exceeded"===e.code||507===e.status)return"Espace de stockage Drive insuffisant";if("drive_unavailable"===e.code)return"UltiDrive est indisponible"}return"Impossible d'enregistrer dans UltiDrive"}function m(e){let t=e.replace(/\/+/g,"/"),s=t.lastIndexOf("/");return s<=0?"/drive":c(t.slice(0,s))}},30004:(e,t,s)=>{Promise.resolve().then(s.bind(s,19682))},37122:(e,t,s)=>{"use strict";s.d(t,{$z:()=>c,IV:()=>l,Jd:()=>i,a3:()=>r,at:()=>n,zR:()=>o});var a=s(45041);function n(e){let t=e.replace(/\/+$/,""),s=t.lastIndexOf("/");return s<=0?"/":t.slice(0,s)||"/"}function r(e,t){let s=(0,a.x9)(e);return"/"===s?`/${t}`:`${s}/${t}`.replace(/\/+/g,"/")}function l(e,t){let s=(0,a.x9)(t);return e.some(e=>{if("directory"!==e.type)return!1;let t=(0,a.x9)(e.path);return s===t||s.startsWith(`${t}/`)})}function i(e,t){let s=(0,a.x9)(t);return e.every(e=>n(e.path)===s)}async function o(e,t,s){for(let a of e){let e=r(t,a.name);await s({source:a.path,destination:e})}}async function c(e,t,s){for(let a of e){let e=r(t,a.name);await s({source:a.path,destination:e})}}},37570:(e,t,s)=>{"use strict";s.d(t,{mn:()=>n,xM:()=>l,LZ:()=>i});var a=s(91356);let n=639,r=`(max-width: ${n}px)`;function l(){return window.matchMedia(r).matches}function i(){return function(e){let[t,s]=(0,a.useState)(!1);return(0,a.useLayoutEffect)(()=>{let t=window.matchMedia(e),a=0,n=()=>{cancelAnimationFrame(a),a=requestAnimationFrame(()=>{let e=t.matches;s(t=>t===e?t:e)})};return n(),t.addEventListener("change",n),()=>{t.removeEventListener("change",n),cancelAnimationFrame(a)}},[e]),t}(r)}},37841:(e,t,s)=>{"use strict";s.d(t,{F7:()=>x,Fj:()=>c,Ip:()=>m,K5:()=>f,Pd:()=>d,Rc:()=>o,es:()=>u,kt:()=>h,tz:()=>i});var a=s(4208);s(91356);var n=s(4484),r=s(26159),l=s(58113);function i({...e}){return(0,a.jsx)(n.bL,{"data-slot":"context-menu",...e})}function o({...e}){return(0,a.jsx)(n.l9,{"data-slot":"context-menu-trigger",...e})}function c({...e}){return(0,a.jsx)(n.Pb,{"data-slot":"context-menu-sub",...e})}function d({className:e,inset:t,children:s,...i}){return(0,a.jsxs)(n.ZP,{"data-slot":"context-menu-sub-trigger","data-inset":t,className:(0,l.cn)("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-pointer items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i,children:[s,(0,a.jsx)(r.A,{className:"ml-auto"})]})}function u({className:e,...t}){return(0,a.jsx)(n.ZL,{children:(0,a.jsx)(n.G5,{"data-slot":"context-menu-sub-content",className:(0,l.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[100] min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})})}function m({className:e,...t}){return(0,a.jsx)(n.ZL,{children:(0,a.jsx)(n.UC,{"data-slot":"context-menu-content",className:(0,l.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...t})})}function h({className:e,inset:t,variant:s="default",onPointerUp:r,...i}){return(0,a.jsx)(n.q7,{"data-slot":"context-menu-item","data-inset":t,"data-variant":s,className:(0,l.cn)("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i,onPointerUp:e=>{r?.(e),"mouse"===e.pointerType&&0!==e.button&&e.preventDefault()}})}function x({className:e,inset:t,...s}){return(0,a.jsx)(n.JU,{"data-slot":"context-menu-label","data-inset":t,className:(0,l.cn)("text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...s})}function f({className:e,...t}){return(0,a.jsx)(n.wv,{"data-slot":"context-menu-separator",className:(0,l.cn)("bg-border -mx-1 my-1 h-px",e),...t})}},42125:(e,t,s)=>{"use strict";s.d(t,{_:()=>h,g:()=>x});var a=s(91356),n=s(5807),r=s(18747),l=s(93051),i=s(90324),o=s(94927),c=s(1559),d=s(93652),u=s(1138);async function m(e){let t=await o.uE.get(`/mail/accounts/${e}/identities`);return Array.isArray(t)?t:t.identities??[]}function h(){let e=(0,l.qU)(),{ready:t,authenticated:s}=(0,r.v)(),{data:o=[],isSuccess:h}=(0,i.HM)(),{data:x=[],isSuccess:f}=(0,c.sp)(),p=(0,a.useMemo)(()=>new Map(x.map(e=>[e.id,e])),[x]),b=(0,n.E)({queries:o.map(e=>({queryKey:["identities",e.id],queryFn:()=>m(e.id),enabled:t&&s&&!!e.id,staleTime:3e5}))}),g=b.map(e=>e.dataUpdatedAt).join("|"),v=(0,a.useMemo)(()=>t&&s&&h&&f&&0!==o.length?b.some(e=>e.isPending&&"idle"!==e.fetchStatus)?null:(0,d.A1)(b.flatMap(e=>(e.data??[]).map(e=>(0,d.U9)(e,p)))):[],[t,s,h,f,o.length,g,b,p]);return(0,a.useEffect)(()=>{e||(t&&s?null!==v&&u.zm.getState().hydrateFromApi(v):u.zm.getState().clear())},[e,t,s,v]),null}function x(e){let t=(0,u.zm)(e=>e.identities),s=(0,u.zm)(e=>e.hydrated),a=e?t.filter(t=>t.accountId===e):t,n=a.length>0?a:t,r=n.find(e=>e.isDefault)??n[0]??null;return{identities:n,defaultIdentity:r,hydrated:s}}},42491:(e,t,s)=>{"use strict";s.d(t,{m:()=>l});var a=s(71092);function n(e,t=400,s=300){return`https://picsum.photos/seed/${encodeURIComponent(e.file_id?`ultimail-drive-${e.file_id}`:`ultimail-drive-${e.path}`)}/${t}/${s}`}let r={"/Perso/Notes r\xe9union.txt":`# Notes r\xe9union 9 juin
- Roadmap Q3 valid\xe9e en comit\xe9
- Beta agenda : livraison cible vendredi
- Design system : tokens couleur \xe0 figer
- Prochaine d\xe9mo interne jeudi 11h`,"/Release notes v2.3.txt":`# Ultimail v2.3
## Nouveaut\xe9s
- UltiCal : visio UltiMeet int\xe9gr\xe9e aux \xe9v\xe9nements
- UltiDrive : favoris et corbeille unifi\xe9s
- Contacts : fusion et labels personnalis\xe9s
## Corrections
- Sync calendrier CalDAV sur \xe9v\xe9nements r\xe9currents
- Aper\xe7u PDF plus rapide sur gros fichiers`};function l(e,t){var s,l;let i=t?.width??1200,o=t?.height??900;if((0,a.dJ)(e)){let t;return{type:"svg",markup:(t=(s=e.name).replace(/\.svg$/i,""),/logo/i.test(s)?`<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 80" role="img">
<rect width="320" height="80" rx="12" fill="#f1f3f4"/>
<circle cx="40" cy="40" r="22" fill="#1967d2"/>
<text x="40" y="46" text-anchor="middle" fill="#fff" font-family="system-ui,sans-serif" font-size="18" font-weight="700">U</text>
<text x="78" y="48" fill="#202124" font-family="system-ui,sans-serif" font-size="22" font-weight="600">${t}</text>
</svg>`:`<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 360" role="img">
<defs>
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#e8f0fe"/>
<stop offset="100%" stop-color="#fce8e6"/>
</linearGradient>
</defs>
<rect width="640" height="360" fill="url(#bg)"/>
<rect x="48" y="48" width="140" height="72" rx="8" fill="#1967d2" opacity="0.9"/>
<rect x="220" y="48" width="140" height="72" rx="8" fill="#34a853" opacity="0.9"/>
<rect x="392" y="48" width="200" height="72" rx="8" fill="#fbbc04" opacity="0.9"/>
<rect x="120" y="160" width="400" height="56" rx="8" fill="#fff" stroke="#dadce0"/>
<rect x="180" y="248" width="280" height="56" rx="8" fill="#fff" stroke="#dadce0"/>
<text x="320" y="28" text-anchor="middle" fill="#5f6368" font-family="system-ui,sans-serif" font-size="14">${t}</text>
</svg>`)}}let c=(0,a.tF)(e);if("text"===c)return{type:"text",content:r[e.path]??(l=e.name,`# ${l.replace(/\.[^.]+$/,"")}
Contenu de d\xe9monstration fichier fictif pour la landing page Ultimail.`)};if("image"===c||"pdf"===c)return{type:"url",url:n(e,i,o),display:"image"};let d=(e.mime_type??"").toLowerCase();return d.includes("officedocument")||d.includes("spreadsheet")||d.includes("presentation")||d.includes("msword")?{type:"url",url:n(e,i,o),display:"image"}:null}},46424:(e,t,s)=>{"use strict";s.d(t,{_X:()=>c,b0:()=>o,d7:()=>u,gr:()=>m,j9:()=>d,yx:()=>h});var a=s(98306),n=s(39927),r=s(17745),l=s(94927),i=s(18747);function o(){let{ready:e,authenticated:t}=(0,i.v)();return(0,a.I)({queryKey:["labels"],queryFn:async()=>{let e=await l.uE.get("/mail/labels");return Array.isArray(e)?e:e.labels??[]},staleTime:3e5,enabled:e&&t,retry:1})}function c(){let e=(0,n.jE)();return(0,r.n)({mutationFn:e=>l.uE.post("/mail/labels",e),onSuccess:()=>{e.invalidateQueries({queryKey:["labels"]})}})}function d(){let e=(0,n.jE)();return(0,r.n)({mutationFn:({id:e,...t})=>l.uE.put(`/mail/labels/${e}`,t),onSuccess:()=>{e.invalidateQueries({queryKey:["labels"]})}})}function u(){let e=(0,n.jE)();return(0,r.n)({mutationFn:e=>l.uE.delete(`/mail/labels/${e}`),onMutate:async t=>{await e.cancelQueries({queryKey:["labels"]});let s=e.getQueryData(["labels"]);return e.setQueryData(["labels"],e=>e?.filter(e=>e.id!==t)),{previous:s}},onError:(t,s,a)=>{a?.previous&&e.setQueryData(["labels"],a.previous)},onSettled:()=>{e.invalidateQueries({queryKey:["labels"]})}})}function m(){let e=(0,n.jE)();return(0,r.n)({mutationFn:e=>l.uE.post("/mail/labels/reorder",{items:e}),onSuccess:()=>{e.invalidateQueries({queryKey:["labels"]})}})}function h(e){return(0,a.I)({queryKey:["identities",e],queryFn:async()=>{let t=await l.uE.get(`/mail/accounts/${e}/identities`);return Array.isArray(t)?t:t.identities??[]},enabled:!!e})}},46794:(e,t,s)=>{"use strict";s.d(t,{K3:()=>i,Yj:()=>r,zx:()=>n});var a=s(94658);function n(e,t,s){let a=t?.trim()||function(e){let t=e.trim();if(!t)return null;try{let e=new URL(t,"http://localhost"),s=e.pathname.match(/\/index\.php\/s\/([^/]+)/)??e.pathname.match(/\/drive\/s\/([^/]+)/)??e.pathname.match(/\/s\/([^/]+)/);return s?decodeURIComponent(s[1]):null}catch{return null}}(e);if(!a)return e;let n=function(e,t="/"){let s=`/drive/s/${encodeURIComponent(e)}`,a=t.replace(/^\/+|\/+$/g,"");return a?`${s}/${a.split("/").map(encodeURIComponent).join("/")}`:s}(a),r=s??window.location.origin;return r?`${r.replace(/\/$/,"")}${n}`:n}function r(e,t,s,a=400,n=300){let i=new URLSearchParams({path:l(t),w:String(a),h:String(n)});return s&&i.set("password",s),`/api/v1/drive/public/shares/${encodeURIComponent(e)}/preview?${i.toString()}`}function l(e){let t=(e.path??"").trim()||"/";return"/"===t?"/":t.endsWith(`/${e.name}`)||t===`/${e.name}`?t:`${t.replace(/\/$/,"")}/${e.name}`.replace(/\/+/g,"/")}async function i(e,t,s){let n,r,i=l(t),o=await fetch((n=i.replace(/^\/+/,"").split("/").filter(Boolean).map(e=>encodeURIComponent(e)),r=`/api/v1/drive/public/shares/${encodeURIComponent(e)}/download/${n.join("/")}`,!s?r:`${r}?password=${encodeURIComponent(s)}`));if(!o.ok)throw Error("download_failed");let c=await o.blob();return(0,a.JX)(c,t.mime_type??"",t.name)}},47567:(e,t,s)=>{"use strict";s.d(t,{CU:()=>l,EM:()=>c,HD:()=>i,HF:()=>u,Jf:()=>d,PZ:()=>y,QI:()=>p,RD:()=>n,Sh:()=>v,Sz:()=>f,Yr:()=>b,Zi:()=>g,dn:()=>j,gO:()=>r,mW:()=>w,pe:()=>m,qj:()=>x,qp:()=>h,wi:()=>o});var a=s(58113);let n="bg-[#3c4043]/40 backdrop-blur-[2px] dark:bg-[#202124]/60",r=(0,a.cn)("drive-dialog gap-0 overflow-hidden border-[#e8eaed] bg-white p-0 shadow-xl dark:border-[#3c4043] dark:bg-[#292a2d]"),l=(0,a.cn)("space-y-1 border-b border-[#e8eaed] px-6 py-5 text-left dark:border-[#3c4043]"),i="px-6 py-5",o=(0,a.cn)("flex-row justify-end gap-2 border-t border-[#e8eaed] bg-[#f8f9fa] px-6 py-4 dark:border-[#3c4043] dark:bg-[#252628]"),c="border-[#e8eaed] dark:border-[#3c4043]",d="h-10 rounded-lg border border-[#dadce0] bg-[#f1f3f4] text-sm text-[#3c4043] shadow-none placeholder:text-[#80868b] focus-visible:border-[#1a73e8] focus-visible:ring-2 focus-visible:ring-[#1a73e8]/20 dark:border-[#5f6368]/40 dark:bg-[#35363a] dark:text-[#e8eaed] dark:placeholder:text-[#9aa0a6] dark:focus-visible:border-[#8ab4f8] dark:focus-visible:ring-[#8ab4f8]/25",u="min-h-[72px] resize-none rounded-lg border border-[#dadce0] bg-[#f1f3f4] text-sm text-[#3c4043] shadow-none placeholder:text-[#80868b] focus-visible:border-[#1a73e8] focus-visible:ring-2 focus-visible:ring-[#1a73e8]/20 dark:border-[#5f6368]/40 dark:bg-[#35363a] dark:text-[#e8eaed] dark:placeholder:text-[#9aa0a6] dark:focus-visible:border-[#8ab4f8] dark:focus-visible:ring-[#8ab4f8]/25",m="text-sm font-medium text-[#5f6368] dark:text-[#9aa0a6]",h="text-[#3c4043] dark:text-[#e8eaed]",x="text-[#5f6368] dark:text-[#9aa0a6]",f="text-[#202124] dark:text-[#e8eaed]",p=(0,a.cn)("rounded-xl border border-[#e8eaed] bg-[#f8f9fa] dark:border-[#3c4043] dark:bg-[#35363a]");(0,a.cn)("border-[#e8eaed] bg-[#f8f9fa] hover:bg-[#f1f3f4] dark:border-[#5f6368]/30 dark:bg-[#35363a]/50 dark:hover:bg-[#3c4043]/45"),(0,a.cn)("border-[#1a73e8] bg-[#e8f0fe] ring-1 ring-[#1a73e8]/20 dark:border-[#8ab4f8]/60 dark:bg-[#1a377a]/35 dark:ring-[#8ab4f8]/20");let b=(0,a.cn)(x,"hover:bg-[#e8eaed]/80 hover:text-[#3c4043] dark:hover:bg-[#3c4043]/50 dark:hover:text-[#e8eaed]"),g="bg-[#1a73e8] text-white hover:bg-[#1765cc] dark:bg-[#8ab4f8] dark:text-[#202124] dark:hover:bg-[#aecbfa]",v="z-[300]",j="z-[301]",w="z-[100] bg-[#3c4043]/40 backdrop-blur-[2px] dark:bg-[#202124]/60",y=(0,a.cn)("drive-dialog z-[100] rounded-t-2xl border-t border-[#e8eaed] bg-white p-0 pb-[env(safe-area-inset-bottom)] dark:border-[#3c4043] dark:bg-[#292a2d]")},58411:(e,t,s)=>{"use strict";s.d(t,{h3:()=>u,sO:()=>m});var a=s(91356),n=s(39927),r=s(72858),l=s(86227),i=s(6224),o=s(29994);class c{init(e){this.queryClient=e,this.loadLastSeq()}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}connect(e){if(this.ws?.readyState===WebSocket.OPEN)return;let t=(0,o.mR)()??"";if(!t)return;let s=`${t}?token=${encodeURIComponent(e)}&since=${this.lastSeq}`;this.ws=new WebSocket(s),this.ws.onopen=()=>{this.reconnectAttempts=0},this.ws.onmessage=e=>this.handleMessage(e),this.ws.onclose=()=>this.scheduleReconnect(e),this.ws.onerror=()=>{}}disconnect(){this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.ws?.close(),this.ws=null}handleMessage(e){try{let t=JSON.parse(e.data);if("ws.ping"===t.type)return void this.send({type:"ws.pong",payload:{}});for(let e of(t.seq&&(this.lastSeq=t.seq,this.saveLastSeq()),this.handleEvent(t),this.listeners))e(t)}catch{}}send(e){this.ws?.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(e))}handleEvent(e){if(!this.queryClient)return;let t=function(e){let t=e.payload;if(!t||"object"!=typeof t)return null;let s="message_id"in t?String(t.message_id??""):"",a="account_id"in t?String(t.account_id??""):"";return s?{message_id:s,account_id:a}:null}(e);switch(e.type){case"mail.created":this.queryClient.invalidateQueries({queryKey:["messages"]});break;case"mail.updated":this.queryClient.invalidateQueries({queryKey:["messages"]}),t?.message_id&&this.queryClient.invalidateQueries({queryKey:["message",t.message_id]});break;case"mail.deleted":this.queryClient.invalidateQueries({queryKey:["messages"]}),t?.message_id&&this.queryClient.removeQueries({queryKey:["message",t.message_id]});break;case"outbox.updated":this.queryClient.invalidateQueries({queryKey:["outbox"]});break;case"contact.updated":this.queryClient.invalidateQueries({queryKey:["contacts"]})}}scheduleReconnect(e){let t=Math.min(1e3*2**this.reconnectAttempts,this.maxReconnectDelay);this.reconnectAttempts++,this.reconnectTimer=setTimeout(()=>this.connect(e),t)}loadLastSeq(){let e=localStorage.getItem("ultimail-ws-seq");e&&(this.lastSeq=parseInt(e,10)||0)}saveLastSeq(){localStorage.setItem("ultimail-ws-seq",String(this.lastSeq))}constructor(){this.ws=null,this.reconnectAttempts=0,this.maxReconnectDelay=3e4,this.reconnectTimer=null,this.lastSeq=0,this.queryClient=null,this.listeners=new Set}}let d=new c;function u(){let e=(0,n.jE)(),t=(0,l.nc)(e=>e.accessToken),s=(0,i.g)();(0,a.useEffect)(()=>{s||d.init(e)},[e,s]),(0,a.useEffect)(()=>{if(s)return;let e=!1;return(async()=>{let s=t?await (0,r.A)():null;e||(s?d.connect(s):d.disconnect())})(),()=>{e=!0,d.disconnect()}},[t,s])}function m(e){(0,a.useEffect)(()=>d.subscribe(e),[e])}},59352:(e,t,s)=>{"use strict";s.d(t,{b:()=>r});var a=s(46298);let n={app:"standalone",temporary:!0},r=(0,a.v)(e=>({open:!1,context:n,openPanel:t=>e(e=>({open:!0,context:{...e.context,...t,temporary:t?.temporary??!0}})),closePanel:()=>e({open:!1}),setContext:t=>e(e=>({context:{...e.context,...t}}))}))},59680:(e,t,s)=>{"use strict";s.d(t,{CN:()=>n,TR:()=>a});let a=(0,s(46298).v)()(e=>({signatures:[],hydrated:!1,hydrateFromApi:t=>e({signatures:t,hydrated:!0}),clear:()=>e({signatures:[],hydrated:!1})}));function n(e){if(!e)return null;let t=a.getState().signatures.find(t=>t.id===e);return t?.html?.trim()?t.html:null}},60428:(e,t,s)=>{"use strict";s.d(t,{h:()=>o});var a=s(4208),n=s(18166),r=s(58113),l=s(81893),i=s(52590);function o(){let e=(0,i.x)(e=>e.themeDialogOpen),t=(0,i.x)(e=>e.setThemeDialogOpen),s=(0,i.x)(e=>e.backgroundId),o=(0,i.x)(e=>e.setBackgroundId),c=(0,l.y9)(s);return(0,a.jsx)(n.lG,{open:e,onOpenChange:t,children:(0,a.jsxs)(n.Cf,{overlayClassName:"z-[70]",className:"z-[70] max-w-md gap-5 border-border bg-background sm:max-w-lg",children:[(0,a.jsx)(n.c7,{children:(0,a.jsx)(n.L3,{className:"text-left text-base font-normal text-foreground",children:"Arri\xe8re-plan"})}),(0,a.jsx)("section",{children:(0,a.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4",children:l.UT.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>o(e.id),className:(0,r.cn)("flex flex-col items-center gap-1 rounded-lg p-1 transition-colors",c===e.id&&"ring-2 ring-[#1a73e8] ring-offset-1 ring-offset-background"),title:e.label,children:[(0,a.jsx)("span",{className:"block h-14 w-full rounded-md border border-border bg-cover bg-center",style:"none"===e.background?{backgroundColor:"var(--app-canvas)"}:{backgroundColor:e.fallbackColor,background:e.background}}),(0,a.jsx)("span",{className:(0,r.cn)("max-w-full truncate text-[10px]",c===e.id?"font-bold text-foreground dark:text-white":"text-muted-foreground dark:text-mail-text"),children:e.label})]},e.id))})})]})})}},61504:(e,t,s)=>{"use strict";s.d(t,{D:()=>d});var a=s(91356),n=s(19984),r=s(39219),l=s(58411),i=s(94927),o=s(52590),c=s(37606);function d(){let e=(0,n.useRouter)(),t=(0,o.x)(e=>e.desktopNewMail),s=(0,o.x)(e=>e.desktopMentions),d=(0,o.x)(e=>e.soundEnabled),u=(0,a.useCallback)(async a=>{if("mail.created"!==a.type||!t&&!s)return;let n=function(e){let t=e.payload;if(!t||"object"!=typeof t||!("message_id"in t))return null;let s=String(t.message_id??"");return s?{message_id:s,account_id:String(t.account_id??"")}:null}(a);if(!n)return;let l="Nouveau message",o="";try{let e=await i.uE.get(`/mail/messages/${n.message_id}`);l=e.subject?.trim()||l,o=e.from?.[0]?.name||e.from?.[0]?.address||""}catch{}let u=(0,c.kv)(l);u&&!s||(u||t)&&(0,c.Lw)({title:l,body:o?`De ${o}`:void 0,tag:n.message_id,playSound:d,onClick:()=>{e.push((0,r.Pu)({folderId:"inbox",inboxTab:"primary",page:1,mailId:n.message_id}))}})},[s,t,e,d]);return(0,l.sO)(u),null}},63429:(e,t,s)=>{"use strict";s.d(t,{m:()=>p});var a=s(4208),n=s(91356),r=s(26159),l=s(75681),i=s(89032),o=s(61554),c=s(18166),d=s(63639),u=s(22854),m=s(47567),h=s(37122),x=s(45041),f=s(58113);function p({open:e,onOpenChange:t,sources:s,onMoved:b,mode:g="move"}){let[v,j]=(0,n.useState)("/"),w=(0,d.c1)(),y=(0,d.GQ)(v,1,"",e),k=(0,n.useMemo)(()=>new Set(s.map(e=>e.path)),[s]),N="copy"===g,C=(0,n.useMemo)(()=>(y.data?.files??[]).filter(e=>"directory"===e.type&&!k.has(e.path)),[y.data?.files,k]),S=(0,n.useMemo)(()=>{let e=(0,x.x9)(v);if("/"===e)return[{path:"/",label:"Mon Drive"}];let t=e.slice(1).split("/"),s=[{path:"/",label:"Mon Drive"}];for(let e=0;e<t.length;e++){let a="/"+t.slice(0,e+1).join("/");s.push({path:a,label:(0,u._g)(t[e])})}return s},[v]),A=(0,h.IV)(s,v),M=async()=>{if(A)return void i.oR.error(N?"Impossible de copier un dossier dans lui-m\xeame":"Impossible de d\xe9placer un dossier dans lui-m\xeame");try{N?(await (0,h.zR)(s,v,e=>w.copy.mutateAsync(e)),i.oR.success(s.length>1?"\xc9l\xe9ments copi\xe9s":"\xc9l\xe9ment copi\xe9")):(await (0,h.$z)(s,v,e=>w.move.mutateAsync(e)),i.oR.success(s.length>1?"\xc9l\xe9ments d\xe9plac\xe9s":"\xc9l\xe9ment d\xe9plac\xe9")),t(!1),b?.(v)}catch{i.oR.error(N?"Impossible de copier":"Impossible de d\xe9placer")}},I=N?w.copy.isPending:w.move.isPending,E=s.length>1?`${s.length} \xe9l\xe9ments`:"l'\xe9l\xe9ment";return(0,a.jsx)(c.lG,{open:e,onOpenChange:e=>{e&&j("/"),t(e)},children:(0,a.jsxs)(c.Cf,{overlayClassName:m.RD,className:(0,f.cn)(m.gO,"sm:max-w-[420px]"),children:[(0,a.jsxs)(c.c7,{className:(0,f.cn)("border-b px-5 py-4 text-left",m.EM),children:[(0,a.jsxs)(c.L3,{className:(0,f.cn)("text-base font-medium",m.Sz),children:[N?"Copier":"D\xe9placer"," ",E]}),(0,a.jsx)(c.rr,{className:"sr-only",children:N?`Choisir le dossier de destination pour copier ${E}.`:`Choisir le dossier de destination pour d\xe9placer ${E}.`})]}),(0,a.jsxs)("div",{className:"flex min-h-[280px] flex-col",children:[(0,a.jsx)("div",{className:(0,f.cn)("flex flex-wrap items-center gap-1 border-b px-4 py-2 text-sm",m.EM),children:S.map((e,t)=>(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[t>0?(0,a.jsx)(r.A,{className:(0,f.cn)("h-3.5 w-3.5 shrink-0",m.qj)}):null,(0,a.jsx)("button",{type:"button",className:(0,f.cn)("truncate rounded px-1 py-0.5 hover:bg-[#f1f3f4] dark:hover:bg-[#3c4043]/50",t===S.length-1?(0,f.cn)("font-medium",m.qp):m.qj),onClick:()=>j(e.path),children:e.label})]},e.path))}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:y.isLoading?(0,a.jsx)("p",{className:(0,f.cn)("px-4 py-6 text-sm",m.qj),children:"Chargement…"}):0===C.length?(0,a.jsx)("p",{className:(0,f.cn)("px-4 py-6 text-sm",m.qj),children:"Aucun sous-dossier"}):C.map(e=>(0,a.jsxs)("button",{type:"button",className:(0,f.cn)("flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm hover:bg-[#f1f3f4] dark:hover:bg-[#3c4043]/50",m.qp),onClick:()=>j((0,x.x9)(e.path)),children:[(0,a.jsx)(l.A,{className:(0,f.cn)("h-4 w-4 shrink-0",m.qj)}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate",children:(0,u._g)(e.name)}),(0,a.jsx)(r.A,{className:(0,f.cn)("h-4 w-4 shrink-0",m.qj)})]},e.path))})]}),(0,a.jsxs)(c.Es,{className:(0,f.cn)(m.wi,"px-4 py-3"),children:[(0,a.jsx)(o.$,{type:"button",variant:"ghost",className:m.Yr,onClick:()=>t(!1),children:"Annuler"}),(0,a.jsx)(o.$,{type:"button",className:m.Zi,disabled:I||A,onClick:()=>void M(),children:I?N?"Copie…":"D\xe9placement…":N?"Copier ici":"D\xe9placer ici"})]})]})})}},71092:(e,t,s)=>{"use strict";s.d(t,{tF:()=>w,ug:()=>y,gg:()=>b,Gc:()=>k,dJ:()=>p,D9:()=>N,db:()=>j,lu:()=>g,qs:()=>v,rV:()=>C});let a=["dps","dpt","fodp","odg","odp","otp","pot","potm","potx","pps","ppsm","ppsx","ppt","pptm","pptx","sxi"],n=["vsdm","vsdx","vssm","vssx","vstm","vstx"],r=new Set(["doc","docm","docx","dot","dotm","dotx","epub","fb2","fodt","htm","html","hwp","hwpx","md","mht","mhtml","odt","ott","rtf","stw","sxw","txt","wps","wpt","xml","csv","et","ett","fods","ods","ots","sxc","tsv","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx",...a,...n]),l=["wordprocessingml","spreadsheetml","presentationml","msword","ms-excel","ms-powerpoint","opendocument","visio"];function i(e){let t=e.split("/").pop()??e,s=t.lastIndexOf(".");return s<=0?"":t.slice(s+1).toLowerCase()}function o(e){return r.has(e.toLowerCase())}[...a,...n];var c=s(28765),d=s(17728);let u=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","avif","heic","heif","ico","tif","tiff","apng","jfif"]),m=new Set(["mp4","webm","mov","mkv","ogv","m4v","3gp","avi"]),h=new Set(["mp3","wav","ogg","flac","m4a","aac","opus","weba","aiff","mid","midi"]),x=new Set(["md","markdown","txt","json","yaml","yml","log","ini","conf","cfg","env"]);function f(e){return e.split(".").pop()?.toLowerCase()??""}function p(e){let t=(e.mime_type??"").toLowerCase();return"image/svg+xml"===t||"application/svg+xml"===t||"svg"===f(e.name)}function b(e){let t,s=(e.mime_type??"").toLowerCase();return!!(s&&"application/pdf"!==(t=s.toLowerCase())&&l.some(e=>t.includes(e)))||o(i(e.name))}function g(e){if("directory"===e.type)return!1;if((0,c.Ir)(e.name))return!0;if("text"===w(e)){let t=i(e.name);return"md"===t||"markdown"===t||"txt"===t||"html"===t||"htm"===t}return!w(e)&&(0,c.ql)(e)}function v(e){return"directory"!==e.type&&(0,d.db)(e)}function j(e){return!("directory"===e.type||v(e)||g(e)||w(e))&&!!b(e)&&o(i(e.name))&&!(0,c.ql)(e)}function w(e){let t=(e.mime_type??"").toLowerCase();if(t.startsWith("image/")||"application/svg+xml"===t)return"image";if(t.startsWith("video/"))return"video";if(t.startsWith("audio/"))return"audio";if("application/pdf"===t)return"pdf";if(!(!t.startsWith("text/")||t.includes("html")||t.includes("calendar"))&&1||"application/json"===t||"application/x-yaml"===t)return"text";let s=f(e.name);return u.has(s)?"image":m.has(s)?"video":h.has(s)?"audio":"pdf"===s?"pdf":x.has(s)?"text":null}function y(e){if("directory"===e.type)return!1;if(b(e))return!0;let t=w(e);return!("pdf"!==t&&("image"!==t||p(e)))}function k(e){return"directory"!==e.type&&null!==w(e)}function N(e){return{path:e.path,name:e.name,type:"file",size:0,mime_type:e.mime_type,last_modified:"",etag:"",is_favorite:e.is_favorite}}function C(e){return{path:e.path,name:e.name,mime_type:e.mime_type??"",is_favorite:e.is_favorite??!1}}},71869:(e,t,s)=>{"use strict";s.d(t,{Gf:()=>i,Vv:()=>d,Xw:()=>l,jk:()=>r,pQ:()=>c});var a=s(32292),n=s(59680);let r="z-[100]",l=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,i=a.bP.create({name:"signatureBlock",group:"block",content:"block+",defining:!0,isolating:!0,parseHTML:()=>[{tag:'div[id="ultimail-signature"]'}],renderHTML:({HTMLAttributes:e})=>["div",(0,a.KV)(e,{id:"ultimail-signature"}),0]}),o=/<div id="ultimail-signature">[\s\S]*<\/div>/;function c(e){return e.replace(o,"")}function d(e,t){let s=c(e);if(!t)return s;let a=(0,n.CN)(t)??(t.trimStart().startsWith("<")?t:null);return a?.trim()?`${s}<div id="ultimail-signature"><p>--</p>${a}</div>`:s}},73190:(e,t,s)=>{"use strict";s.d(t,{X:()=>c});var a=s(4208),n=s(35855),r=s.n(n),l=s(30273),i=s(58113);let o="h-[11.25rem] w-auto max-w-none shrink-0 object-contain select-none sm:h-[12rem]";function c({className:e,variant:t="horizontal",href:s="/mail/inbox"}){let n=(0,a.jsx)("img",{src:"/ultimail-mark.svg",alt:"",width:288,height:288,draggable:!1,className:(0,i.cn)(l.wQ,"mark"===t&&"h-10 w-10"),"aria-hidden":!0});if("mark"===t)return null===s?(0,a.jsx)("div",{className:(0,i.cn)("shrink-0",e),children:n}):(0,a.jsx)(r(),{href:s,className:(0,i.cn)("shrink-0 rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring/50",e),"aria-label":"Ultimail Bo\xeete de r\xe9ception",children:n});if("stacked"===t){let t=(0,a.jsxs)("div",{className:"flex h-[6.25rem] items-center justify-center overflow-hidden sm:h-[6.75rem]",children:[(0,a.jsx)("img",{src:"/brand/ultimail-wordmark-stacked.png",alt:"Ultimail",width:320,height:320,draggable:!1,className:(0,i.cn)(o,"dark:hidden")}),(0,a.jsx)("img",{src:"/brand/ultimail-wordmark-stacked-dark.png",alt:"Ultimail",width:320,height:320,draggable:!1,"aria-hidden":!0,className:(0,i.cn)(o,"hidden dark:block")})]});return null===s?(0,a.jsx)("div",{className:(0,i.cn)("flex justify-center",e),children:t}):(0,a.jsx)(r(),{href:s,className:(0,i.cn)("flex justify-center rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring/50",e),"aria-label":"Ultimail Bo\xeete de r\xe9ception",children:t})}let d=(0,a.jsxs)("div",{role:"img","aria-label":"Ultimail",className:(0,i.cn)(l.pi,"min-w-0 text-foreground"),children:[n,(0,a.jsx)("span",{className:l.Su,children:"Ultimail"})]});return null===s?(0,a.jsx)("div",{className:(0,i.cn)("min-w-0",e),children:d}):(0,a.jsx)(r(),{href:s,className:(0,i.cn)("flex min-w-0 items-center rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring/50",e),"aria-label":"Ultimail Bo\xeete de r\xe9ception",children:d})}},74036:(e,t,s)=>{"use strict";s.d(t,{H:()=>n});var a=s(91356);function n(e,t){let s=(0,a.useRef)(null),n=(0,a.useRef)(null),r=(0,a.useRef)(!1),l=t?.delay??500,i=t?.disabled??!1,o=t?.ack??!0,[c,d]=(0,a.useState)(!1),u=(0,a.useCallback)(()=>{n.current&&(clearTimeout(n.current),n.current=null),d(!1)},[]),m=(0,a.useCallback)(()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]),h=(0,a.useCallback)(()=>{o&&(u(),d(!0),n.current=setTimeout(()=>{d(!1),n.current=null},280))},[u,o]);return{onPointerDown:(0,a.useCallback)(t=>{i||("mouse"!==t.pointerType||0===t.button)&&(r.current=!1,m(),s.current=setTimeout(()=>{r.current=!0,h(),e()},l))},[m,l,i,e,h]),onPointerUp:m,onPointerLeave:m,onPointerCancel:m,onClickCapture:(0,a.useCallback)(e=>{r.current&&(e.preventDefault(),e.stopPropagation(),r.current=!1)},[]),ackActive:c,ackClassName:c?"long-press-ack":void 0}}},74101:(e,t,s)=>{"use strict";function a(e){return e.includes("preview-thumb")||e.includes("attachment-thumb")}function n(e){e?.startsWith("blob:")&&URL.revokeObjectURL(e)}function r(e){n(e?.url)}function l(e,t){return e?.url&&e.url!==t.url&&n(e.url),t}s.d(t,{Qh:()=>l,eR:()=>a,u$:()=>r})},74230:(e,t,s)=>{"use strict";s.d(t,{V:()=>i,p:()=>o});var a=s(39927),n=s(17745),r=s(94927),l=s(29502);function i(e){let t=(0,a.jE)();return(0,n.n)({mutationFn:async({attachmentId:t,folderPath:s=l.AZ})=>(await r.uE.post(`/mail/messages/${e}/attachments/${t}/save-to-drive`,{folder_path:s})).drive_path,onSuccess:(s,a)=>{t.invalidateQueries({queryKey:["message-attachments",e]}),c(t,a.folderPath)}})}function o(e){let t=(0,a.jE)();return(0,n.n)({mutationFn:async(t=l.AZ)=>(await r.uE.post(`/mail/messages/${e}/attachments/save-to-drive`,{folder_path:t})).attachments??[],onSuccess:(s,a)=>{t.invalidateQueries({queryKey:["message-attachments",e]}),c(t,a)}})}function c(e,t){e.invalidateQueries({queryKey:["drive"]});let s=(0,l.XV)(t??l.AZ);e.invalidateQueries({queryKey:["drive","files",s]}),e.invalidateQueries({queryKey:["drive","recent"]})}},74575:(e,t,s)=>{"use strict";s.d(t,{O:()=>c});var a=s(91356),n=s(86227),r=s(81465),l=s(65367),i=s(52590);function o(e){return{density:e.density,themeMode:e.themeMode,backgroundId:e.backgroundId,inboxSort:e.inboxSort,readingPane:e.readingPane,conversationMode:e.conversationMode,desktopNewMail:e.desktopNewMail,desktopMentions:e.desktopMentions,emailDigest:e.emailDigest,soundEnabled:e.soundEnabled}}function c(){let e=(0,n.nc)(e=>e.isAuthenticated()),{data:t}=(0,r.C)(e),s=(0,r.Z)(),c=(0,a.useRef)(!1),d=(0,a.useRef)(null),u=(0,a.useRef)(o(i.x.getState()));return(0,a.useEffect)(()=>{if(!t)return;c.current=!0;let e=(0,l.IX)(t);i.x.getState().hydrateFromApi(e),u.current=o(i.x.getState()),queueMicrotask(()=>{c.current=!1})},[t]),(0,a.useEffect)(()=>{let e=i.x.subscribe(e=>{var t;let a;if(c.current)return;let n=o(e),r=(t=u.current,a={},t.density!==n.density&&(a.density=n.density),t.themeMode!==n.themeMode&&(a.themeMode=n.themeMode),t.backgroundId!==n.backgroundId&&(a.backgroundId=n.backgroundId),t.inboxSort!==n.inboxSort&&(a.inboxSort=n.inboxSort),t.readingPane!==n.readingPane&&(a.readingPane=n.readingPane),t.conversationMode!==n.conversationMode&&(a.conversationMode=n.conversationMode),t.desktopNewMail!==n.desktopNewMail&&(a.desktopNewMail=n.desktopNewMail),t.desktopMentions!==n.desktopMentions&&(a.desktopMentions=n.desktopMentions),t.emailDigest!==n.emailDigest&&(a.emailDigest=n.emailDigest),t.soundEnabled!==n.soundEnabled&&(a.soundEnabled=n.soundEnabled),a);0!==Object.keys(r).length&&(u.current=n,d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{s.mutate((0,l.Sm)(r))},500))});return()=>{e(),d.current&&clearTimeout(d.current)}},[s]),null}},79741:(e,t,s)=>{"use strict";s.d(t,{L:()=>k});var a=s(4208),n=s(91356),r=s(35855),l=s.n(r),i=s(84834),o=s(37094),c=s(5312),d=s(61554),u=s(28292),m=s(36042);let h=[{name:u.tg,icon:(0,m.w)("/agenda-mark.svg"),iconDark:(0,m.w)("/agenda-mark-dark.svg"),href:"/agenda"},{name:"Photos",icon:(0,m.w)("/photos-mark.svg")},{name:"Ultimail",icon:(0,m.w)("/ultimail-mark.svg"),href:"/mail"},{name:"UltiDrive",icon:(0,m.w)("/ultidrive-mark.svg"),href:"/drive"},{name:"Contacts",icon:(0,m.w)("/contacts-mark.svg"),href:"/contacts"},{name:"UltiMeet",icon:(0,m.w)("/ultimeet-mark.svg"),href:"/meet"},{name:"Administration",icon:(0,m.w)("/admin-mark.svg"),href:"/admin/settings"},{name:"OpenMaps",icon:(0,m.w)("/openstreetmap-mark.svg"),href:"https://www.openstreetmap.org/",external:!0},{name:"UltiAI",icon:(0,m.w)("/ultiai-mark.svg"),href:"/chat"},{name:"Qwant",icon:(0,m.w)("/qwant-mark.svg"),href:"https://www.qwant.com/",external:!0,whiteLogoInDark:!0},{name:"Ground News",icon:(0,m.w)("/ground-news-mark.svg"),href:"https://ground.news/",external:!0,whiteLogoInDark:!0}];var x=s(49845),f=s(81887),p=s(24717);async function b(e,t){let a,n=(a=t.startsWith("/")?t.slice(1):t,`${(0,f.hF)(e)}://go/${a}`);if((0,f.oX)())try{let e=await s.e(2828).then(s.bind(s,92828));await e.openUrl(n);return}catch{await (0,p.l)("plugin:ulti-core|app_open_url",{url:n});return}window.location.href=t}var g=s(30273),v=s(58113);let j="flex flex-col items-center gap-2 rounded-lg p-3 transition-colors hover:bg-accent",w=(0,v.cn)("rounded-full",g.ax,"hover:text-accent-foreground");function y({app:e,onNavigate:t}){let s=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex h-10 w-10 items-center justify-center",children:e.iconDark?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("img",{src:e.icon,alt:"",className:"h-10 w-10 object-contain dark:hidden",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("img",{src:e.iconDark,alt:"",className:"hidden h-10 w-10 object-contain dark:block",onError:e=>{e.target.style.display="none"}})]}):(0,a.jsx)("img",{src:e.icon,alt:"",className:(0,v.cn)("h-10 w-10 object-contain",e.whiteLogoInDark&&"dark:invert dark:hue-rotate-180"),onError:t=>{let s=t.target;s.style.display="none",s.parentElement.innerHTML=`<div class="flex h-10 w-10 items-center justify-center rounded-full bg-blue-500 font-bold text-white">${e.name[0]}</div>`}})}),(0,a.jsx)("span",{className:"w-full text-center text-xs text-muted-foreground",children:e.name})]});if(!e.href)return(0,a.jsx)("button",{type:"button",className:j,disabled:!0,children:s});if(e.external)return(0,a.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:j,onClick:t,children:s});let n=(0,f.O5)(e.href);return(0,f.B8)()&&n&&n!==f.fk?(0,a.jsx)("button",{type:"button",className:j,onClick:()=>{t?.(),b(n,e.href)},children:s}):(0,a.jsx)(l(),{href:e.href,className:j,onClick:t,children:s})}function k({className:e,iconButtonClass:t=w,dropdownClass:s=g._w,onOpen:r}){let[u,m]=(0,n.useState)(!1),f=(0,n.useRef)(null);return(0,n.useEffect)(()=>{function e(e){f.current&&!f.current.contains(e.target)&&m(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,a.jsxs)("div",{className:(0,v.cn)("relative hidden sm:block",e),ref:f,children:[(0,a.jsx)(d.$,{variant:"ghost",size:"icon",className:t,"aria-label":"Applications","aria-expanded":u,"aria-haspopup":"dialog",onClick:()=>{let e=!u;m(e),e&&r?.()},children:(0,a.jsx)(o.A,{className:"size-6 shrink-0","aria-hidden":!0})}),u?(0,a.jsxs)("div",{className:(0,v.cn)("absolute right-0 top-12 z-50 w-96 rounded-2xl",s),role:"dialog","aria-label":"Vos favoris",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between border-b border-border p-4",children:[(0,a.jsx)("span",{className:"text-lg font-normal text-foreground",children:"Vos favoris"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(d.$,{variant:"ghost",size:"icon",className:(0,v.cn)("h-8 w-8",t),"aria-label":"R\xe9glages",asChild:!0,children:(0,a.jsx)(l(),{href:x.gH,onClick:()=>m(!1),children:(0,a.jsx)(i.In,{icon:"mdi:cog-outline",className:"size-5 shrink-0","aria-hidden":!0})})}),(0,a.jsx)(d.$,{variant:"ghost",size:"icon",className:(0,v.cn)("h-8 w-8",t),"aria-label":"Personnaliser les favoris",disabled:!0,children:(0,a.jsx)(c.A,{className:"h-4 w-4"})})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-3 gap-1 p-3",children:h.map(e=>(0,a.jsx)(y,{app:e,onNavigate:()=>m(!1)},e.name))})]}):null]})}},91725:(e,t,s)=>{"use strict";s.d(t,{I:()=>f});var a=s(4208),n=s(91356),r=s(26159),l=s(75681),i=s(61554),o=s(18166),c=s(63639),d=s(22854),u=s(47567),m=s(45041),h=s(29502),x=s(58113);function f({open:e,onOpenChange:t,title:s,description:p,confirmLabel:b,pending:g,onConfirm:v}){let[j,w]=(0,n.useState)(h.AZ),y=(0,c.GQ)(j,1,"",e),k=(0,n.useMemo)(()=>(y.data?.files??[]).filter(e=>"directory"===e.type),[y.data?.files]),N=(0,n.useMemo)(()=>{let e=(0,m.x9)(j);if("/"===e)return[{path:"/",label:"Mon Drive"}];let t=e.slice(1).split("/"),s=[{path:"/",label:"Mon Drive"}];for(let e=0;e<t.length;e++){let a="/"+t.slice(0,e+1).join("/");s.push({path:a,label:(0,d._g)(t[e])})}return s},[j]);return(0,a.jsx)(o.lG,{open:e,onOpenChange:e=>{e&&w(h.AZ),t(e)},children:(0,a.jsxs)(o.Cf,{overlayClassName:u.RD,className:(0,x.cn)(u.gO,"sm:max-w-[420px]"),children:[(0,a.jsxs)(o.c7,{className:(0,x.cn)("border-b px-5 py-4 text-left",u.EM),children:[(0,a.jsx)(o.L3,{className:(0,x.cn)("text-base font-medium",u.Sz),children:s}),p?(0,a.jsx)(o.rr,{className:(0,x.cn)("text-sm",u.qj),children:p}):(0,a.jsx)(o.rr,{className:"sr-only",children:s})]}),(0,a.jsxs)("div",{className:"flex min-h-[280px] flex-col",children:[(0,a.jsx)("div",{className:(0,x.cn)("flex flex-wrap items-center gap-1 border-b px-4 py-2 text-sm",u.EM),children:N.map((e,t)=>(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[t>0?(0,a.jsx)(r.A,{className:(0,x.cn)("h-3.5 w-3.5 shrink-0",u.qj)}):null,(0,a.jsx)("button",{type:"button",className:(0,x.cn)("truncate rounded px-1 py-0.5 hover:bg-accent",t===N.length-1?(0,x.cn)("font-medium",u.qp):u.qj),onClick:()=>w(e.path),children:e.label})]},e.path))}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:y.isLoading?(0,a.jsx)("p",{className:(0,x.cn)("px-4 py-6 text-sm",u.qj),children:"Chargement"}):0===k.length?(0,a.jsx)("p",{className:(0,x.cn)("px-4 py-6 text-sm",u.qj),children:"Enregistrer dans ce dossier"}):k.map(e=>(0,a.jsxs)("button",{type:"button",className:(0,x.cn)("flex w-full items-center gap-3 px-4 py-2.5 text-left text-sm hover:bg-accent",u.qp),onClick:()=>w((0,m.x9)(e.path)),children:[(0,a.jsx)(l.A,{className:(0,x.cn)("h-4 w-4 shrink-0",u.qj)}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate",children:(0,d._g)(e.name)}),(0,a.jsx)(r.A,{className:(0,x.cn)("h-4 w-4 shrink-0",u.qj)})]},e.path))})]}),(0,a.jsxs)(o.Es,{className:(0,x.cn)(u.wi,"px-4 py-3"),children:[(0,a.jsx)(i.$,{type:"button",variant:"ghost",className:u.Yr,onClick:()=>t(!1),children:"Annuler"}),(0,a.jsx)(i.$,{type:"button",className:u.Zi,disabled:g,onClick:()=>void v(j),children:g?"Enregistrement":b})]})]})})}},93079:(e,t,s)=>{"use strict";s.d(t,{k:()=>h});var a=s(91356),n=s(18747),r=s(46424),l=s(57070),i=s(59557),o=s(81465),c=s(45328),d=s(81912),u=s(79197),m=s(31047);function h(){let{ready:e,authenticated:t}=(0,n.v)(),{data:s}=(0,r.b0)(),{data:h}=(0,l.FL)("global"),{data:x}=(0,l.FL)("all"),{folders:f,isFetched:p}=(0,i.Q)();return(0,o.C)(t),(0,a.useEffect)(()=>{if(!e||!t||!s)return;let a=[...s].sort((e,t)=>(e.sort_order??0)-(t.sort_order??0)||e.name.localeCompare(t.name)).map(e=>(0,m.Uo)({id:e.id,label:e.name,color:e.color||"bg-gray-500",tabbed:!1,favorite:!1,excludeFromPrincipal:!1,showInMessageList:!0,enabled:!0}));c.w.getState().hydrateLabelRowsFromApi(a)},[e,t,s]),(0,a.useEffect)(()=>{if(!e||!t||!x||!p)return;let s=h??x.filter(e=>"global"===e.scope),a=[...(0,d.l)(s),...(0,u._e)(f)];0!==a.length&&c.w.getState().hydrateFolderTreeFromApi(a)},[e,t,x,h,f,p]),null}},93510:(e,t,s)=>{"use strict";s.d(t,{J:()=>a});let a=(0,s(46298).v)((e,t)=>({sidebarCollapsed:!1,selectionMode:!1,selectedPaths:new Set,selectionAnchorPath:null,expandedSidebarPaths:new Set(["/","/__shared_root__"]),sharePath:null,shareItemType:null,previewFiles:[],previewIndex:-1,previewContext:null,suppressCardOpenUntil:0,draggingItems:null,setSidebarCollapsed:t=>e({sidebarCollapsed:t}),setSelectionMode:t=>e({selectionMode:t}),enterSelectionMode:t=>e({selectionMode:!0,selectedPaths:new Set([t]),selectionAnchorPath:t}),blockCardOpen:(t=700)=>e({suppressCardOpenUntil:Date.now()+t}),toggleSelect:(s,a)=>{let n=new Set(t().selectedPaths);a?n.add(s):n.delete(s),e({selectedPaths:n})},setSelectedPaths:t=>e({selectedPaths:new Set(t)}),setSelectionAnchor:t=>e({selectionAnchorPath:t}),clearSelection:()=>e({selectedPaths:new Set,selectionAnchorPath:null,selectionMode:!1}),setDraggingItems:t=>e({draggingItems:t}),toggleSidebarPath:s=>{let a=new Set(t().expandedSidebarPaths);a.has(s)?a.delete(s):a.add(s),e({expandedSidebarPaths:a})},ensureSidebarPathsExpanded:s=>{let a=new Set(t().expandedSidebarPaths),n=!1;for(let e of s)a.has(e)||(a.add(e),n=!0);n&&e({expandedSidebarPaths:a})},setSharePath:(t,s=null)=>e({sharePath:t,shareItemType:s}),openPreview:(t,s,a)=>e({previewFiles:t,previewIndex:s,previewContext:{allowShare:a?.allowShare??!0,isTrash:a?.isTrash??!1,publicShare:a?.publicShare,mailSource:a?.mailSource??!1,mailMessageId:a?.mailMessageId}}),closePreview:()=>e({previewFiles:[],previewIndex:-1,previewContext:null}),stepPreview:s=>{let{previewFiles:a,previewIndex:n}=t();if(0===a.length)return;let r=n+s;r<0||r>=a.length||e({previewIndex:r})},updatePreviewFavorite:(s,a)=>e({previewFiles:t().previewFiles.map(e=>e.path===s?{...e,is_favorite:a}:e)}),removePreviewFile:s=>{let{previewFiles:a,previewIndex:n}=t(),r=a.findIndex(e=>e.path===s);if(r<0)return;let l=a.filter(e=>e.path!==s);if(0===l.length)return void e({previewFiles:[],previewIndex:-1,previewContext:null});let i=n;r<n?i=n-1:r===n&&(i=Math.min(n,l.length-1)),e({previewFiles:l,previewIndex:i})}}))},93652:(e,t,s)=>{"use strict";s.d(t,{A1:()=>o,G_:()=>i,U9:()=>r,XE:()=>l});var a=s(71869),n=s(59680);function r(e,t){let s,a=e.default_signature_id??null,r=(s=e.default_signature_id?t?.get(e.default_signature_id)?.html??(0,n.CN)(e.default_signature_id):null,s?.trim()?s:e.signature_html?.trim()||null);return{id:e.id,accountId:e.account_id,name:e.name,email:e.email,defaultSignatureId:a,signatureHtml:r,isDefault:e.is_default}}function l(e,t){let s=t.signatureHtml??null;return s?.trim()?(0,a.Vv)(e,s):e}function i(e){return new Set(e.map(e=>e.email.trim().toLowerCase()).filter(Boolean))}function o(e){let t=new Set,s=[];for(let a of e){let e=`${a.accountId??""}:${a.email.trim().toLowerCase()}`;t.has(e)||(t.add(e),s.push(a))}return s}}},e=>{e.O(0,[2276,6677,3445,1270,1145,6655,881,4051,8733,1909,2082,3616,798,9032,8306,5855,8023,5179,8992,5260,5814,6559,1729,579,9673,1820,6712,963,3132,4498,7865,3639,3777,4382,5143,294,1614,1506,7358],()=>e(e.s=30004)),_N_E=e.O()}]);