ultisuite-client/out/_next/static/chunks/app/demo/docs/page-acad723f594cc8f5.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

44 lines
376 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

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([[7138],{1057:(e,t,n)=>{"use strict";n.d(t,{DemoDocsEditor:()=>oF});var r=n(4208),a=n(91356),i=n(64882),s=n(61955),l=n(97022),o=n(60694),c=n(89032),d=n(35855),u=n.n(d),h=n(23778),m=n(20911),p=n(77510),g=n(99833),f=n(48843),x=n(10841),b=n(61554),y=n(6146);function j(){let[e,t]=(0,a.useState)(!1),n=(0,a.useRef)(null),i=(0,y.o)();return(0,r.jsxs)("div",{className:"relative",ref:n,children:[(0,r.jsx)(b.$,{variant:"ghost",size:"icon",className:"size-8 overflow-hidden rounded-full p-0","aria-label":`Compte : ${i?.email??"Utilisateur"}`,"aria-expanded":e,"aria-haspopup":"dialog",onClick:()=>t(e=>!e),children:i?(0,r.jsx)(f.h,{account:{name:i.name,email:i.email,avatarUrl:i.avatarUrl},size:"sm"}):(0,r.jsx)("span",{className:"flex size-8 items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground",children:"?"})}),(0,r.jsx)(x.s,{open:e,onOpenChange:t,containerRef:n})]})}var v=n(58113);function w({value:e,onRename:t,disabled:n=!1,className:i,renameSignal:s}){let[l,o]=(0,a.useState)(!1),[c,d]=(0,a.useState)(e),[u,h]=(0,a.useState)(!1),m=(0,a.useRef)(null),p=(0,a.useRef)(!1);(0,a.useEffect)(()=>{l||d(e)},[e,l]),(0,a.useEffect)(()=>{s&&!n&&o(!0)},[s,n]),(0,a.useEffect)(()=>{if(!l)return;let e=window.setTimeout(()=>{let e=m.current;e&&(e.focus(),e.select())},0);return()=>window.clearTimeout(e)},[l]);let g=async()=>{if(p.current){p.current=!1;return}let n=c.trim();if(!n||n===e){d(e),o(!1);return}h(!0);try{await t(n),o(!1)}catch{d(e),o(!1)}finally{h(!1)}},f=(l?c:e)||" ",x=(0,v.cn)("col-start-1 row-start-1 w-full min-w-0 rounded-md border border-transparent bg-transparent px-2 py-0.5 text-left text-sm font-medium outline-none transition-[background-color,border-color]",i);return(0,r.jsxs)("div",{className:"inline-grid w-fit max-w-[min(480px,45vw)]",children:[(0,r.jsx)("span",{className:(0,v.cn)(x,"invisible whitespace-pre"),"aria-hidden":!0,children:f}),l&&!n?(0,r.jsx)("input",{ref:m,value:c,disabled:u,"aria-label":"Nom du fichier",className:(0,v.cn)(x,"text-foreground focus-visible:border-border focus-visible:ring-0"),onChange:e=>d(e.target.value),onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),g()),"Escape"===t.key&&(t.preventDefault(),p.current=!0,d(e),o(!1))},onBlur:()=>void g()}):(0,r.jsx)("button",{type:"button",disabled:n||u,title:n?void 0:"Renommer",className:(0,v.cn)(x,"truncate text-foreground",n?"cursor-default":"cursor-text hover:bg-muted/70 focus-visible:border-border focus-visible:ring-0"),onClick:()=>{n||u||o(!0)},children:e})]})}var N=n(43135),k=n(69899),C=n(22054);function S({users:e,className:t}){let n=e.filter(e=>!e.isLocal);if(0===n.length)return null;let a=n.slice(0,5),i=n.length-a.length;return(0,r.jsx)(k.Bc,{delayDuration:200,children:(0,r.jsxs)("div",{className:(0,v.cn)("flex items-center -space-x-1.5",t),children:[a.map(e=>(0,r.jsxs)(k.m_,{children:[(0,r.jsx)(k.k$,{asChild:!0,children:(0,r.jsx)("div",{className:"flex size-8 items-center justify-center rounded-full border-2 border-white text-xs font-semibold text-white shadow-sm dark:border-[#202124]",style:{backgroundColor:e.color},"aria-label":e.name,children:(0,C.w7)(e.name)})}),(0,r.jsx)(k.ZI,{side:"bottom",children:e.name})]},e.clientId)),i>0?(0,r.jsxs)(k.m_,{children:[(0,r.jsx)(k.k$,{asChild:!0,children:(0,r.jsxs)("div",{className:"flex size-8 items-center justify-center rounded-full border-2 border-white bg-[#5f6368] text-xs font-semibold text-white shadow-sm dark:border-[#202124]","aria-label":`${i} autre(s) utilisateur(s)`,children:["+",i]})}),(0,r.jsx)(k.ZI,{side:"bottom",children:n.slice(5).map(e=>e.name).join(", ")})]}):null]})})}function A({className:e}){return(0,r.jsxs)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:(0,v.cn)("shrink-0",e),"aria-hidden":!0,children:[(0,r.jsx)("path",{fill:"#4285F4",d:"M8 18h8v-2H8zm0-4h8v-2H8zm-2 8q-.825 0-1.412-.587T4 20V4q0-.825.588-1.412T6 2h8l6 6v12q0 .825-.587 1.413T18 22z"}),(0,r.jsx)("path",{fill:"#ffffff",d:"M8 18h8v-2H8z"}),(0,r.jsx)("path",{fill:"#ffffff",d:"M8 14h8v-2H8z"}),(0,r.jsx)("path",{fill:"#ffffff",d:"M13 7h5l-5-5z",transform:"translate(0 1)"})]})}var M=n(38716),z=n(15550),P=n(1546),I=n(18584),T=n(15203),D=n(66356),L=n(87508),F=n(78606),E=n(44303),R=n(98204),H=n(35019),B=n(26159);function $({className:e,...t}){return(0,r.jsx)(R.bL,{"data-slot":"menubar",className:(0,v.cn)("bg-background flex h-9 items-center gap-1 rounded-md border p-1 shadow-xs",e),...t})}function O({...e}){return(0,r.jsx)(R.W1,{"data-slot":"menubar-menu",...e})}function W({...e}){return(0,r.jsx)(R.ZL,{"data-slot":"menubar-portal",...e})}function _({className:e,...t}){return(0,r.jsx)(R.l9,{"data-slot":"menubar-trigger",className:(0,v.cn)("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex items-center rounded-sm px-2 py-1 text-sm font-medium outline-hidden select-none",e),...t})}function q({className:e,align:t="start",alignOffset:n=-4,sideOffset:a=8,...i}){return(0,r.jsx)(W,{children:(0,r.jsx)(R.UC,{"data-slot":"menubar-content",align:t,alignOffset:n,sideOffset:a,className:(0,v.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in 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 min-w-[12rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-md",e),...i})})}function G({className:e,inset:t,variant:n="default",...a}){return(0,r.jsx)(R.q7,{"data-slot":"menubar-item","data-inset":t,"data-variant":n,className:(0,v.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),...a})}function Y({className:e,children:t,checked:n,...a}){return(0,r.jsxs)(R.H_,{"data-slot":"menubar-checkbox-item",className:(0,v.cn)("focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer items-center gap-2 rounded-xs py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:n,...a,children:[(0,r.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,r.jsx)(R.VF,{children:(0,r.jsx)(H.A,{className:"size-4"})})}),t]})}function U({className:e,...t}){return(0,r.jsx)(R.wv,{"data-slot":"menubar-separator",className:(0,v.cn)("bg-border -mx-1 my-1 h-px",e),...t})}function X({className:e,...t}){return(0,r.jsx)("span",{"data-slot":"menubar-shortcut",className:(0,v.cn)("text-muted-foreground ml-auto text-xs tracking-widest",e),...t})}function J({...e}){return(0,r.jsx)(R.Pb,{"data-slot":"menubar-sub",...e})}function V({className:e,inset:t,children:n,...a}){return(0,r.jsxs)(R.ZP,{"data-slot":"menubar-sub-trigger","data-inset":t,className:(0,v.cn)("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-pointer items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[inset]:pl-8",e),...a,children:[n,(0,r.jsx)(B.A,{className:"ml-auto h-4 w-4"})]})}function K({className:e,...t}){return(0,r.jsx)(W,{children:(0,r.jsx)(R.G5,{"data-slot":"menubar-sub-content",className:(0,v.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 min-w-[8rem] origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})})}var Q=n(46298),Z=n(22029),ee=n(91025);let et=[{id:"file.open",label:"Ouvrir",category:"file",scope:"document",handler:"custom",defaultBinding:{key:"o",mod:!0}},{id:"file.print",label:"Imprimer",category:"file",scope:"document",handler:"custom",defaultBinding:{key:"p",mod:!0}},{id:"edit.undo",label:"Annuler",category:"edit",scope:"editor",handler:"tiptap",defaultBinding:{key:"z",mod:!0}},{id:"edit.redo",label:"R\xe9tablir",category:"edit",scope:"editor",handler:"custom",defaultBinding:{key:"y",mod:!0},altBindings:[{key:"z",mod:!0,shift:!0}]},{id:"edit.cut",label:"Couper",category:"edit",scope:"editor",handler:"browser",defaultBinding:{key:"x",mod:!0}},{id:"edit.copy",label:"Copier",category:"edit",scope:"editor",handler:"browser",defaultBinding:{key:"c",mod:!0}},{id:"edit.paste",label:"Coller",category:"edit",scope:"editor",handler:"browser",defaultBinding:{key:"v",mod:!0}},{id:"edit.pastePlain",label:"Coller sans la mise en forme",category:"edit",scope:"editor",handler:"custom",defaultBinding:{key:"v",mod:!0,shift:!0}},{id:"edit.selectAll",label:"Tout s\xe9lectionner",category:"edit",scope:"editor",handler:"tiptap",defaultBinding:{key:"a",mod:!0}},{id:"edit.findReplace",label:"Rechercher et remplacer",category:"edit",scope:"editor",handler:"custom",defaultBinding:{key:"h",mod:!0,shift:!0}},{id:"view.showNonPrintable",label:"Afficher les caract\xe8res non imprimables",category:"view",scope:"document",handler:"custom",defaultBinding:{key:"p",mod:!0,shift:!0}}],en=Object.fromEntries(et.map(e=>[e.id,e]));function er(){return!("u"<typeof navigator)&&(/Mac|iPhone|iPad|iPod/.test(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document)}function ea(){return er()?"⌘":"Ctrl"}function ei(e){return{key:1===e.key.length?e.key.toLowerCase():e.key,mod:e.mod??!0,shift:e.shift??!1,alt:e.alt??!1}}function es(e,t={}){return t[e]??en[e].defaultBinding}function el(e,t={}){let n=en[e];return[es(e,t),...t[e]?[]:n.altBindings??[]]}function eo(e,t={}){return function(e){let t=ei(e),n=ea(),r=er(),a=1===t.key.length?t.key.toUpperCase():t.key;if(r){let e=[];return(t.shift&&e.push("Maj"),t.alt&&e.push("⌥"),e.length>0)?`${n}+${e.join("+")}+${a}`:t.mod?`${n}${a}`:a}let i=[];return t.shift&&i.push("Shift"),t.alt&&i.push("Alt"),t.mod&&i.push(n),i.push(a),i.join("+")}(es(e,t))}let ec=(0,Q.v)()((0,Z.Zr)((e,t)=>({overrides:{},getBinding:e=>es(e,t().overrides),getBindings:e=>el(e,t().overrides),formatShortcut:e=>eo(e,t().overrides),matchEvent:(e,n)=>(function(e,t={},n){for(let r of et)if((!n||n(r))&&el(r.id,t).some(t=>(function(e,t){let n=ei(t),r=er()?e.metaKey:e.ctrlKey;return(!n.mod||!!r)&&(!!n.mod||!r)&&(1===e.key.length?e.key.toLowerCase():e.key)===n.key&&n.shift===e.shiftKey&&n.alt===e.altKey})(e,t)))return r.id;return null})(e,t().overrides,n),setBinding:(t,n)=>{e(e=>({overrides:{...e.overrides,[t]:n}}))},resetBinding:t=>{e(e=>{let n={...e.overrides};return delete n[t],{overrides:n}})},resetAll:()=>e({overrides:{}}),getCatalog:()=>(function(e={}){return et.map(t=>({...t,binding:es(t.id,e),display:eo(t.id,e),isCustomized:!!e[t.id]}))})(t().overrides)}),{name:"ultidrive-docs-keyboard-shortcuts",storage:ee.$,partialize:e=>({overrides:e.overrides}),merge:(e,t)=>({...t,overrides:function(e){if(!e||"object"!=typeof e)return{};let t={};for(let n of et){let r=e[n.id];r&&"object"==typeof r&&"string"==typeof r.key&&0!==r.key.length&&(null==r.mod||"boolean"==typeof r.mod)&&(null==r.shift||"boolean"==typeof r.shift)&&(null==r.alt||"boolean"==typeof r.alt)&&(t[n.id]=ei(r))}return t}(e?.overrides)})}));function ed({shortcutId:e}){let t=ec(t=>t.formatShortcut(e));return t?(0,r.jsx)(X,{children:t}):null}let eu={align:"start",sideOffset:0,alignOffset:0};function eh({children:e}){return(0,r.jsx)("span",{className:"docs-menu-item-icon",children:e})}function em({actions:e,state:t,disabled:n}){return(0,r.jsxs)(O,{children:[(0,r.jsx)(_,{className:"docs-menu-trigger",children:"\xc9dition"}),(0,r.jsxs)(q,{...eu,className:"docs-menu-content min-w-[300px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n||!t.canUndo,onClick:e.onUndo,children:[(0,r.jsx)(eh,{children:(0,r.jsx)(M.A,{className:"size-4"})}),"Annuler",(0,r.jsx)(ed,{shortcutId:"edit.undo"})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n||!t.canRedo,onClick:e.onRedo,children:[(0,r.jsx)(eh,{children:(0,r.jsx)(z.A,{className:"size-4"})}),"R\xe9tablir",(0,r.jsx)(ed,{shortcutId:"edit.redo"})]}),(0,r.jsx)(U,{}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onCut,children:[(0,r.jsx)(eh,{children:(0,r.jsx)(P.A,{className:"size-4"})}),"Couper",(0,r.jsx)(ed,{shortcutId:"edit.cut"})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onCopy,children:[(0,r.jsx)(eh,{children:(0,r.jsx)(I.A,{className:"size-4"})}),"Copier",(0,r.jsx)(ed,{shortcutId:"edit.copy"})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onPaste,children:[(0,r.jsx)(eh,{children:(0,r.jsx)(T.A,{className:"size-4"})}),"Coller",(0,r.jsx)(ed,{shortcutId:"edit.paste"})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onPastePlain,children:[(0,r.jsx)(eh,{children:(0,r.jsx)(D.A,{className:"size-4"})}),"Coller sans la mise en forme",(0,r.jsx)(ed,{shortcutId:"edit.pastePlain"})]}),(0,r.jsx)(U,{}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onSelectAll,children:[(0,r.jsx)(eh,{children:(0,r.jsx)(L.A,{className:"size-4"})}),"Tout s\xe9lectionner",(0,r.jsx)(ed,{shortcutId:"edit.selectAll"})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onDelete,children:[(0,r.jsx)(eh,{children:(0,r.jsx)(F.A,{className:"size-4"})}),"Supprimer"]}),(0,r.jsx)(U,{}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onFindReplace,children:[(0,r.jsx)(eh,{children:(0,r.jsx)(E.A,{className:"size-4"})}),"Rechercher et remplacer",(0,r.jsx)(ed,{shortcutId:"edit.findReplace"})]})]})]})}var ep=n(41817),eg=n(5312),ef=n(28700),ex=n(12325),eb=n(49731),ey=n(93619),ej=n(8534),ev=n(71809),ew=n(61760),eN=n(90293),ek=n(21467),eC=n(88),eS=n(65153),eA=n(53832),eM=n(5675);let ez=(0,a.createContext)(null);function eP({children:e}){let[t,n]=(0,a.useState)(null);return(0,r.jsx)(ez.Provider,{value:{openId:t,setOpenId:n},children:e})}function eI({id:e,children:t}){let n=(0,a.useContext)(ez),i=(0,a.useId)(),s=e||i,l=n?.openId===s,o=(0,a.useCallback)(e=>{if(n){if(e)return void n.setOpenId(s);n.openId===s&&n.setOpenId(null)}},[n,s]);return n?(0,r.jsx)(J,{open:l,onOpenChange:o,children:a.Children.map(t,e=>(0,a.isValidElement)(e)&&e.type===K?(0,a.cloneElement)(e,{children:(0,r.jsx)(eP,{children:e.props.children})}):e)}):(0,r.jsx)(J,{children:t})}var eT=n(75334);let eD=[{id:"docx",label:"Microsoft Word (.docx)"},{id:"pdf",label:"Document PDF (.pdf)"},{id:"odt",label:"Format OpenDocument (.odt)"},{id:"txt",label:"Texte brut (.txt)"},{id:"rtf",label:"Format texte enrichi (.rtf)"},{id:"html-zip",label:"Page Web (.html, zipp\xe9)"},{id:"epub",label:"Publication EPUB (.epub)"},{id:"md",label:"Markdown (.md)"}];async function eL(e,t,r,a){if(!r&&!t)return"unsupported";let i=(0,eT.Of)(a);switch(e){case"docx":{if(!t)return"unsupported";let{exportDocsToDocx:e}=await n.e(4461).then(n.bind(n,94461)),r=await e(t);return(0,eT.WN)(r,(0,eT.Ie)(a,"docx")),"done"}case"pdf":{if(!t)return"unsupported";let{exportDocsToPdf:e}=await n.e(9114).then(n.bind(n,59114));return await e(t),"done"}case"txt":{if(!r)return"unsupported";let e=r.getText();return(0,eT.WN)(new Blob([e],{type:"text/plain;charset=utf-8"}),`${i}.txt`),"done"}case"md":{if(!r)return"unsupported";let e=r.getText();return(0,eT.WN)(new Blob([e],{type:"text/markdown;charset=utf-8"}),`${i}.md`),"done"}case"html":{if(!r)return"unsupported";let e=`<!DOCTYPE html><html><head><meta charset="utf-8"><title>${i}</title></head><body>${r.getHTML()}</body></html>`;return(0,eT.WN)(new Blob([e],{type:"text/html;charset=utf-8"}),`${i}.html`),"done"}default:return"unsupported"}}function eF({children:e}){return(0,r.jsx)("span",{className:"docs-menu-item-icon",children:e})}function eE({actions:e,disabled:t}){return(0,r.jsxs)(O,{children:[(0,r.jsx)(_,{className:"docs-menu-trigger",children:"Fichier"}),(0,r.jsx)(q,{...eu,className:"docs-menu-content min-w-[280px] overflow-visible","data-docs-menu-surface":!0,children:(0,r.jsxs)(eP,{children:[(0,r.jsxs)(eI,{id:"new",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:t,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(ep.A,{className:"size-4"})}),"Nouveau"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[240px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onNewDocument,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(A,{className:"size-4"})}),"Document"]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onNewFromTemplate,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(eg.A,{className:"size-4"})}),"\xc0 partir de la galerie de mod\xe8les"]})]})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onOpen,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(ef.A,{className:"size-4"})}),"Ouvrir",(0,r.jsx)(ed,{shortcutId:"file.open"})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onMakeCopy,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(I.A,{className:"size-4"})}),"Cr\xe9er une copie"]}),(0,r.jsx)(U,{}),(0,r.jsxs)(eI,{id:"share",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:t,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(ex.A,{className:"size-4"})}),"Partager"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[260px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onShareWithUsers,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(eb.A,{className:"size-4"})}),"Partager avec d'autres utilisateurs"]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onPublishToWeb,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(ey.A,{className:"size-4"})}),"Publier sur le Web"]})]})]}),(0,r.jsxs)(eI,{id:"email",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:t,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(ej.A,{className:"size-4"})}),"Envoyer par e-mail"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[280px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(G,{className:"docs-menu-item",disabled:t,onClick:e.onEmailFile,children:"Envoyer ce fichier par e-mail"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:t,onClick:e.onEmailCollaborators,children:"Envoyer par e-mail aux collaborateurs"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:t,onClick:e.onEmailDraft,children:"Brouillon d'e-mail"})]})]}),(0,r.jsxs)(eI,{id:"download",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:t,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(ev.A,{className:"size-4"})}),"T\xe9l\xe9charger"]}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[280px] overflow-visible","data-docs-menu-surface":!0,children:eD.map(n=>(0,r.jsx)(G,{className:"docs-menu-item",disabled:t,onClick:()=>e.onDownload(n.id),children:n.label},n.id))})]}),(0,r.jsx)(U,{}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onRename,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(eg.A,{className:"size-4"})}),"Renommer"]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onMove,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(ew.A,{className:"size-4"})}),"D\xe9placer"]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onAddShortcut,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(eN.A,{className:"size-4"})}),"Ajouter un raccourci dans Drive"]}),(0,r.jsxs)(G,{className:(0,v.cn)("docs-menu-item","focus:text-destructive"),disabled:t,onClick:e.onMoveToTrash,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(F.A,{className:"size-4"})}),"Placer dans la corbeille"]}),(0,r.jsx)(U,{}),(0,r.jsxs)(eI,{id:"version-history",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:t,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(ek.A,{className:"size-4"})}),"Historique des versions"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[260px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(G,{className:"docs-menu-item",disabled:t,onClick:e.onNameCurrentVersion,children:"Nommer la version actuelle"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:t,onClick:e.onShowVersionHistory,children:"Afficher l'historique des versions"})]})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onToggleOffline,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(eC.A,{className:"size-4"})}),"Rendre disponible hors connexion"]}),(0,r.jsx)(U,{}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onDetails,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(eS.A,{className:"size-4"})}),"D\xe9tails"]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onSecurityLimits,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(eA.A,{className:"size-4"})}),"Limites de s\xe9curit\xe9"]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onPageSetup,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(ep.A,{className:"size-4"})}),"Configuration de la page"]}),e.onPurgeSidecarAndReimport?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(U,{}),(0,r.jsxs)(G,{className:(0,v.cn)("docs-menu-item","text-amber-700 focus:text-amber-800 dark:text-amber-400"),disabled:t,onClick:e.onPurgeSidecarAndReimport,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(F.A,{className:"size-4"})}),"Purger sidecar et r\xe9importer doc"]})]}):null,(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onPrint,children:[(0,r.jsx)(eF,{children:(0,r.jsx)(eM.A,{className:"size-4"})}),"Imprimer",(0,r.jsx)(ed,{shortcutId:"file.print"})]})]})})]})}var eR=n(84834),eH=n(25142),eB=n(35577),e$=n(3643),eO=n(77788),eW=n(77123),e_=n(79624),eq=n(32102),eG=n(6959),eY=n(50117),eU=n(77877);let eX=[{id:"disc",label:"Plein",listStyleType:"disc",marker:null},{id:"circle",label:"Cercle",listStyleType:"circle",marker:null},{id:"square",label:"Carr\xe9",listStyleType:"square",marker:null},{id:"arrow",label:"Fl\xe8che",listStyleType:"none",marker:"➤"},{id:"check",label:"Coche",listStyleType:"none",marker:"✓"},{id:"dash",label:"Tiret",listStyleType:"none",marker:""}],eJ=[{id:"decimal",label:"1. 2. 3.",olType:null},{id:"decimal-paren",label:"1) 2) 3)",olType:null},{id:"outline",label:"1. / 1.1.",olType:null},{id:"upper-alpha",label:"A. B. C.",olType:"A"},{id:"upper-roman",label:"I. II. III.",olType:"I"},{id:"zero-padded",label:"01. 02.",olType:null}],eV="disc",eK="decimal";function eQ(e){let t=String(e??eV);return eX.some(e=>e.id===t)?t:eV}function eZ(e){let t=String(e??eK);return eJ.some(e=>e.id===t)?t:eK}function e0({disabled:e,active:t,onClick:n,children:a,className:i,label:s}){return(0,r.jsx)("button",{type:"button",disabled:e,"aria-label":s,"aria-pressed":t,onClick:n,className:(0,v.cn)("rounded border border-[#dadce0] bg-white p-2 text-left text-[10px] leading-tight text-[#3c4043]","transition-colors hover:bg-[#f1f3f4] disabled:cursor-not-allowed disabled:opacity-50","dark:border-border dark:bg-background dark:text-foreground dark:hover:bg-muted",t&&"border-[#1a73e8] ring-1 ring-[#1a73e8]",i),children:a})}function e1({disabled:e}){return(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2 px-1",children:[1,2,3].map(t=>(0,r.jsx)(e0,{disabled:e,active:1===t,label:`${t} colonne${t>1?"s":""}`,className:"flex h-14 items-stretch justify-center gap-0.5 p-1.5",children:Array.from({length:t},(e,t)=>(0,r.jsxs)("span",{className:"flex flex-1 flex-col justify-center gap-0.5 rounded-sm bg-[#e8eaed] px-0.5 py-1 dark:bg-muted",children:[(0,r.jsx)("span",{className:"block h-px w-full bg-[#9aa0a6]"}),(0,r.jsx)("span",{className:"block h-px w-full bg-[#9aa0a6]"}),(0,r.jsx)("span",{className:"block h-px w-3/4 bg-[#9aa0a6]"})]},t))},t))})}let e2={decimal:["1."," a."," i."],"decimal-paren":["1)"," a)"," i)"],outline:["1."," 1.1."," 1.1.1."],"upper-alpha":["A."," a."," i.","B."],"upper-roman":["I."," A."," 1.","II."],"zero-padded":["01.","02."]};function e4({disabled:e,activeStyleId:t,onSelect:n}){return(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:eJ.map(a=>(0,r.jsx)(e0,{disabled:e,active:"mixed"!==t&&t===a.id,label:`Liste num\xe9rot\xe9e ${a.id}`,onClick:()=>n(a.id),className:"min-h-[72px] font-mono",children:e2[a.id].map(e=>(0,r.jsx)("span",{className:"block whitespace-pre",children:e},e))},a.id))})}function e5({disabled:e,activeStyleId:t,onSelect:n}){let a={disc:"•",circle:"◦",square:"▪",arrow:"➤",check:"✓",dash:""};return(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:eX.map(i=>(0,r.jsxs)(e0,{disabled:e,active:"mixed"!==t&&t===i.id,label:`Liste \xe0 puces ${i.id}`,onClick:()=>n(i.id),className:"min-h-[56px]",children:[(0,r.jsxs)("span",{className:"block",children:[a[i.id]," \xc9l\xe9ment"]}),(0,r.jsxs)("span",{className:"block",children:[a[i.id]," \xc9l\xe9ment"]})]},i.id))})}function e3({disabled:e,activeStyleId:t,onSelect:n}){return(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,r.jsxs)(e0,{disabled:e,active:"mixed"!==t&&"strikethrough"===t,label:"Checklist avec texte barr\xe9",className:"min-h-[56px]",onClick:()=>n("strikethrough"),children:[(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"inline-flex size-3 shrink-0 rounded-sm border border-[#5f6368]"}),"T\xe2che"]}),(0,r.jsxs)("span",{className:"flex items-center gap-1.5 line-through opacity-70",children:[(0,r.jsx)("span",{className:"inline-flex size-3 shrink-0 items-center justify-center rounded-sm border border-[#1a73e8] bg-[#1a73e8] text-[8px] text-white",children:"✓"}),"Termin\xe9"]})]}),(0,r.jsxs)(e0,{disabled:e,active:"mixed"!==t&&"simple"===t,label:"Checklist simple",className:"min-h-[56px]",onClick:()=>n("simple"),children:[(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"inline-flex size-3 shrink-0 rounded-sm border border-[#5f6368]"}),"T\xe2che"]}),(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"inline-flex size-3 shrink-0 rounded-sm border border-[#5f6368]"}),"T\xe2che"]})]})]})}var e8=n(72050);function e6(e){return{fontFamily:e.fontFamily,fontSize:e.fontSizePx?`${e.fontSizePx}px`:void 0,fontWeight:e.bold?700:400,fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":void 0,color:e.color,lineHeight:e.lineHeight}}var e9=n(89342);function e7({value:e,disabled:t,documentStyles:n,userStyles:i,onValueChange:s,triggerClassName:l}){let o=(0,a.useMemo)(()=>(0,e8.Jw)(n,i),[n,i]),c=o.filter(e=>"document"===e.section),d=o.filter(e=>"user"===e.section),u=o.find(t=>t.definition.id===e)?.definition;return(0,r.jsxs)(e9.l6,{disabled:t,value:e,onValueChange:s,children:[(0,r.jsx)(e9.bq,{variant:"ghost",className:(0,v.cn)("docs-toolbar-select docs-toolbar-select--style h-7 w-[120px] shrink-0 border-0 bg-transparent px-1 py-0 shadow-none",l),children:(0,r.jsx)(e9.yv,{placeholder:"Style",children:u?.name??"Texte normal"})}),(0,r.jsxs)(e9.gC,{className:"docs-toolbar-select-content docs-toolbar-select-content--style max-h-[min(70vh,480px)]",children:[(0,r.jsxs)(e9.s3,{children:[(0,r.jsx)(e9.TR,{children:"Styles du document"}),c.map(({definition:e})=>(0,r.jsx)(e9.eb,{value:e.id,className:"docs-toolbar-style-item",children:(0,r.jsx)("span",{className:"docs-toolbar-style-preview",style:e6(e),children:e.name})},e.id))]}),d.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e9.mi,{}),(0,r.jsxs)(e9.s3,{children:[(0,r.jsx)(e9.TR,{children:"Mes styles"}),d.map(({definition:e})=>(0,r.jsx)(e9.eb,{value:e.id,className:"docs-toolbar-style-item",children:(0,r.jsx)("span",{className:"docs-toolbar-style-preview",style:e6(e),children:e.name})},`user-${e.id}`))]})]}):null]})]})}function te({open:e,onOpenChange:t,onCreate:n}){let[i,s]=(0,a.useState)(""),[l,o]=(0,a.useState)("normal");return e?(0,r.jsx)("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/30 p-4",children:(0,r.jsxs)("div",{className:"w-full max-w-md rounded-lg border bg-background p-4 shadow-lg",role:"dialog","aria-modal":"true","aria-labelledby":"docs-create-style-title",children:[(0,r.jsx)("h2",{id:"docs-create-style-title",className:"text-base font-medium",children:"Cr\xe9er un style"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Le nouveau style sera enregistr\xe9 dans vos styles personnels."}),(0,r.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,r.jsxs)("label",{className:"block space-y-1",children:[(0,r.jsx)("span",{className:"text-sm",children:"Nom"}),(0,r.jsx)("input",{className:"flex h-9 w-full rounded-md border bg-background px-3 text-sm",value:i,onChange:e=>s(e.target.value),placeholder:"Mon style"})]}),(0,r.jsxs)("label",{className:"block space-y-1",children:[(0,r.jsx)("span",{className:"text-sm",children:"Bas\xe9 sur"}),(0,r.jsxs)("select",{className:"flex h-9 w-full rounded-md border bg-background px-3 text-sm",value:l,onChange:e=>o(e.target.value),children:[(0,r.jsx)("option",{value:"normal",children:"Normal"}),(0,r.jsx)("option",{value:"title",children:"Titre"}),(0,r.jsx)("option",{value:"subtitle",children:"Sous-titre"}),(0,r.jsx)("option",{value:"heading1",children:"Titre 1"}),(0,r.jsx)("option",{value:"heading2",children:"Titre 2"}),(0,r.jsx)("option",{value:"heading3",children:"Titre 3"}),(0,r.jsx)("option",{value:"heading4",children:"Titre 4"})]})]})]}),(0,r.jsxs)("div",{className:"mt-4 flex justify-end gap-2",children:[(0,r.jsx)("button",{type:"button",className:"rounded-md px-3 py-1.5 text-sm hover:bg-muted",onClick:()=>t(!1),children:"Annuler"}),(0,r.jsx)("button",{type:"button",className:"rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground",onClick:()=>{n({name:i.trim()||"Style personnalis\xe9",basedOn:l}),s(""),o("normal"),t(!1)},children:"Cr\xe9er"})]})]})}):null}var tt=n(18166),tn=n(13746),tr=n(19096);let ta=[{id:"1",value:1,label:"Simple"},{id:"1.15",value:1.15,label:"1,15"},{id:"1.5",value:1.5,label:"1,5"},{id:"2",value:2,label:"Double"}],ti={lineHeight:null,spaceBeforePt:0,spaceAfterPt:0,keepWithNext:!1,keepLinesTogether:!1,preventWidowOrphan:!1,pageBreakBefore:!1};function ts(e){if(null==e)return null;for(let t of ta)if(.001>Math.abs(t.value-e))return t.id;return"custom"}function tl(e){if(null==e||""===e)return null;let t="number"==typeof e?e:Number.parseFloat(String(e));return Number.isFinite(t)&&t>0?t:null}function to(e){if(null==e||""===e)return 0;let t="number"==typeof e?e:Number.parseFloat(String(e));return Number.isFinite(t)&&t>0?Math.round(100*t)/100:0}function tc(e){let t=e.attrs;return{lineHeight:tl(t.lineHeight),spaceBeforePt:to(t.spaceBeforePt),spaceAfterPt:to(t.spaceAfterPt),keepWithNext:!!t.keepWithNext,keepLinesTogether:!!t.keepLinesTogether,preventWidowOrphan:!!t.preventWidowOrphan,pageBreakBefore:!!t.pageBreakBefore}}var td=n(47567);function tu({open:e,onOpenChange:t,initial:n,onApply:i}){let[s,l]=(0,a.useState)("1.15"),[o,c]=(0,a.useState)(String(1.15)),[d,u]=(0,a.useState)("0"),[h,m]=(0,a.useState)("0");return(0,a.useEffect)(()=>{if(!e)return;let t=n.lineHeight??1.15,r=ta.find(e=>.001>Math.abs(e.value-t));l(r?.id??"custom"),c(String(t)),u(String(n.spaceBeforePt)),m(String(n.spaceAfterPt))},[n,e]),(0,r.jsx)(tt.lG,{open:e,onOpenChange:t,children:(0,r.jsxs)(tt.Cf,{className:(0,v.cn)(td.gO,"max-w-md gap-0 p-0"),children:[(0,r.jsx)(tt.c7,{className:td.CU,children:(0,r.jsx)(tt.L3,{className:(0,v.cn)("text-base font-medium",td.Sz),children:"Espacement personnalis\xe9"})}),(0,r.jsxs)("div",{className:(0,v.cn)(td.HD,"space-y-4"),children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(tr.J,{className:td.pe,htmlFor:"docs-line-height-preset",children:"Interligne"}),(0,r.jsxs)(e9.l6,{value:s,onValueChange:l,children:[(0,r.jsx)(e9.bq,{id:"docs-line-height-preset",className:td.Jf,children:(0,r.jsx)(e9.yv,{})}),(0,r.jsxs)(e9.gC,{children:[ta.map(e=>(0,r.jsx)(e9.eb,{value:e.id,children:e.label},e.id)),(0,r.jsx)(e9.eb,{value:"custom",children:"Personnalis\xe9"})]})]}),"custom"===s?(0,r.jsx)(tn.p,{type:"number",min:.5,max:5,step:.05,value:o,onChange:e=>c(e.target.value),className:td.Jf,"aria-label":"Interligne personnalis\xe9"}):null]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(tr.J,{className:td.pe,htmlFor:"docs-space-before",children:"Avant (pt)"}),(0,r.jsx)(tn.p,{id:"docs-space-before",type:"number",min:0,max:108,step:1,value:d,onChange:e=>u(e.target.value),className:td.Jf})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(tr.J,{className:td.pe,htmlFor:"docs-space-after",children:"Apr\xe8s (pt)"}),(0,r.jsx)(tn.p,{id:"docs-space-after",type:"number",min:0,max:108,step:1,value:h,onChange:e=>m(e.target.value),className:td.Jf})]})]})]}),(0,r.jsxs)(tt.Es,{className:td.wi,children:[(0,r.jsx)(b.$,{type:"button",variant:"ghost",className:td.Yr,onClick:()=>t(!1),children:"Annuler"}),(0,r.jsx)(b.$,{type:"button",className:td.Zi,onClick:()=>{i({lineHeight:(()=>{if("custom"===s){let e=Number.parseFloat(o);return Number.isFinite(e)&&e>0?e:1.15}let e=ta.find(e=>e.id===s);return e?.value??1.15})(),spaceBeforePt:Math.max(0,Number.parseFloat(d)||0),spaceAfterPt:Math.max(0,Number.parseFloat(h)||0)}),t(!1)},children:"Appliquer"})]})]})})}function th({open:e,onOpenChange:t,initialStart:n,onApply:i}){let[s,l]=(0,a.useState)(String(n));return(0,a.useEffect)(()=>{e&&l(String(n))},[n,e]),(0,r.jsx)(tt.lG,{open:e,onOpenChange:t,children:(0,r.jsxs)(tt.Cf,{className:(0,v.cn)(td.gO,"max-w-sm gap-0 p-0"),children:[(0,r.jsx)(tt.c7,{className:td.CU,children:(0,r.jsx)(tt.L3,{className:(0,v.cn)("text-base font-medium",td.Sz),children:"Num\xe9ro de d\xe9part"})}),(0,r.jsxs)("div",{className:td.HD,children:[(0,r.jsx)(tr.J,{className:td.pe,htmlFor:"docs-list-start",children:"Commencer la liste \xe0"}),(0,r.jsx)(tn.p,{id:"docs-list-start",type:"number",min:1,max:9999,step:1,value:s,onChange:e=>l(e.target.value),className:(0,v.cn)(td.Jf,"mt-2")})]}),(0,r.jsxs)(tt.Es,{className:td.wi,children:[(0,r.jsx)(b.$,{type:"button",variant:"ghost",className:td.Yr,onClick:()=>t(!1),children:"Annuler"}),(0,r.jsx)(b.$,{type:"button",className:td.Zi,onClick:()=>{i(Math.max(1,Number.parseInt(s,10)||1)),t(!1)},children:"Appliquer"})]})]})})}let tm=(0,a.createContext)(null);function tp({value:e,children:t}){return(0,r.jsx)(tm.Provider,{value:e,children:t})}function tg(){return(0,a.useContext)(tm)}let tf=[{id:"",label:"Aucune",color:""},{id:"white",label:"Blanc",color:"#ffffff"},{id:"gray-100",label:"Gris clair",color:"#f3f3f3"},{id:"gray-300",label:"Gris",color:"#d9d9d9"},{id:"blue-100",label:"Bleu clair",color:"#c9daf8"},{id:"green-100",label:"Vert clair",color:"#d9ead3"},{id:"yellow-100",label:"Jaune clair",color:"#fff2cc"},{id:"red-100",label:"Rouge clair",color:"#f4cccc"}],tx=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#efefef","#1a73e8","#e06666"];function tb({children:e}){return(0,r.jsx)("span",{className:"docs-menu-item-icon",children:e})}function ty({children:e}){return(0,r.jsx)(X,{children:e})}function tj(e,t){let n=ea();if(er()){let r=[];return(t?.shift&&r.push("Maj"),t?.alt&&r.push("⌥"),r.length>0)?`${n}+${r.join("+")}+${e}`:`${n}${e}`}let r=[];return t?.shift&&r.push("Shift"),t?.alt&&r.push("Alt"),r.push(n,e),r.join("+")}function tv({checked:e,onSelect:t,children:n,disabled:a,className:i}){return(0,r.jsxs)(G,{className:(0,v.cn)("docs-menu-item relative pl-8",i),disabled:a,onClick:t,children:[e?(0,r.jsx)(H.A,{className:"absolute left-2 size-4","aria-hidden":!0}):null,n]})}function tw({styleId:e,label:t,disabled:n,onApply:a,onUpdate:i,menuDisabled:s}){return(0,r.jsxs)(eI,{id:`style-${e}`,children:[(0,r.jsx)(V,{className:"docs-menu-item",disabled:n||s,children:t}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[320px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n||s,onClick:()=>a(e),children:["Appliquer le style ",t]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n||s,onClick:()=>i(e),children:['Mettre \xe0 jour "',t,"\" en fonction de la s\xe9lection/l'emplacement du signe d'insertion"]})]})]})}function tN({actions:e,state:t,disabled:n}){let i=tg(),[s,l]=(0,a.useState)(!1),[o,c]=(0,a.useState)(!1),[d,u]=(0,a.useState)(!1),h=(0,a.useMemo)(()=>i?(0,e8.Jw)(i.state.documentStyles,i.state.userStyles):[],[i]),m=n||!t.tableSelected&&!t.graphicSelected&&!t.imageSelected;return(0,r.jsxs)(O,{children:[(0,r.jsx)(_,{className:"docs-menu-trigger",children:"Format"}),(0,r.jsxs)(q,{...eu,className:"docs-menu-content min-w-[320px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(eP,{children:[(0,r.jsxs)(eI,{id:"text",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:n,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eH.A,{className:"size-4"})}),"Texte"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[280px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onBold,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eH.A,{className:"size-4"})}),"Gras",(0,r.jsx)(ty,{children:tj("B")})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onItalic,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eB.A,{className:"size-4"})}),"Italique",(0,r.jsx)(ty,{children:tj("I")})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onUnderline,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(e$.A,{className:"size-4"})}),"Souligner",(0,r.jsx)(ty,{children:tj("U")})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onStrike,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eO.A,{className:"size-4"})}),"Barrer",(0,r.jsx)(ty,{children:tj("X",{shift:!0})})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:!0,children:[(0,r.jsx)(tb,{children:(0,r.jsx)("span",{className:"text-[11px] font-semibold tracking-tight",children:"Sc"})}),"Petites majuscules",(0,r.jsx)(ty,{children:er()?"⌥+Maj+K":"Alt+Shift+K"})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:!0,children:[(0,r.jsx)(tb,{children:(0,r.jsxs)("span",{className:"text-xs leading-none",children:["X",(0,r.jsx)("sup",{className:"text-[9px]",children:"2"})]})}),"Exposant",(0,r.jsx)(ty,{children:tj(".")})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:!0,children:[(0,r.jsx)(tb,{children:(0,r.jsxs)("span",{className:"text-xs leading-none",children:["X",(0,r.jsx)("sub",{className:"text-[9px]",children:"2"})]})}),"Indice",(0,r.jsx)(ty,{children:tj(",")})]}),(0,r.jsx)(U,{}),(0,r.jsxs)(eI,{id:"text-size",children:[(0,r.jsx)(V,{className:"docs-menu-item",disabled:!0,children:"Taille"}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[200px] overflow-visible","data-docs-menu-surface":!0,children:(0,r.jsx)(G,{disabled:!0,className:"docs-menu-item text-muted-foreground",children:"Bient\xf4t disponible"})})]}),(0,r.jsxs)(eI,{id:"text-case",children:[(0,r.jsx)(V,{className:"docs-menu-item",disabled:!0,children:"Minuscules/majuscules"}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[240px] overflow-visible","data-docs-menu-surface":!0,children:(0,r.jsx)(G,{disabled:!0,className:"docs-menu-item text-muted-foreground",children:"Bient\xf4t disponible"})})]})]})]}),(0,r.jsxs)(eI,{id:"paragraph-styles",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:n,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:format-paragraph",className:"size-4"})}),"Styles de paragraphe"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[240px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(G,{className:"docs-menu-item",disabled:!0,children:"Bordures et ombrage"}),(0,r.jsx)(U,{}),h.filter(e=>"document"===e.section).map(({definition:t})=>(0,r.jsx)(tw,{styleId:t.id,label:t.name,menuDisabled:n,onApply:e.onApplyStyle,onUpdate:i?.updateStyleFromSelection??(()=>void 0)},t.id)),h.some(e=>"user"===e.section)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(U,{}),(0,r.jsx)("div",{className:"px-3 py-1.5 text-xs font-medium text-[#5f6368] dark:text-muted-foreground",children:"Mes styles"}),h.filter(e=>"user"===e.section).map(({definition:t})=>(0,r.jsx)(tw,{styleId:t.id,label:t.name,menuDisabled:n,onApply:e.onApplyStyle,onUpdate:i?.updateStyleFromSelection??(()=>void 0)},`user-${t.id}`))]}):null,(0,r.jsx)(U,{}),(0,r.jsxs)(eI,{id:"paragraph-style-options",children:[(0,r.jsx)(V,{className:"docs-menu-item",disabled:n,children:"Options"}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[220px] overflow-visible","data-docs-menu-surface":!0,children:(0,r.jsx)(G,{className:"docs-menu-item",disabled:n,onClick:()=>l(!0),children:"Cr\xe9er un style"})})]})]})]}),(0,r.jsxs)(eI,{id:"align-indent",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:n,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eW.A,{className:"size-4"})}),"Aligner et mettre en retrait"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[300px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(tv,{checked:t.alignLeft,disabled:n,onSelect:e.onAlignLeft,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eW.A,{className:"size-4"})}),"\xc0 gauche",(0,r.jsx)(ty,{children:tj("L",{shift:!0})})]}),(0,r.jsxs)(tv,{checked:t.alignCenter,disabled:n,onSelect:e.onAlignCenter,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(e_.A,{className:"size-4"})}),"Centrer",(0,r.jsx)(ty,{children:tj("E",{shift:!0})})]}),(0,r.jsxs)(tv,{checked:t.alignRight,disabled:n,onSelect:e.onAlignRight,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eq.A,{className:"size-4"})}),"\xc0 droite",(0,r.jsx)(ty,{children:tj("R",{shift:!0})})]}),(0,r.jsxs)(tv,{checked:t.alignJustify,disabled:n,onSelect:e.onAlignJustify,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eG.A,{className:"size-4"})}),"Justifi\xe9",(0,r.jsx)(ty,{children:tj("J",{shift:!0})})]}),(0,r.jsx)(U,{}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onIncreaseIndent,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:format-indent-increase",className:"size-4"})}),"Augmenter le retrait",(0,r.jsx)(ty,{children:tj("]")})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onDecreaseIndent,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:format-indent-decrease",className:"size-4"})}),"Diminuer le retrait",(0,r.jsx)(ty,{children:tj("[")})]}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:!0,children:"Options de mise en retrait"})]})]}),(0,r.jsxs)(eI,{id:"line-spacing",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:n,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:format-line-spacing",className:"size-4"})}),"Interligne et espace entre paragraphes"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[320px] overflow-visible","data-docs-menu-surface":!0,children:[ta.map(a=>(0,r.jsx)(tv,{checked:"mixed"!==t.lineHeightPresetId&&t.lineHeightPresetId===a.id,disabled:n,onSelect:()=>e.onSetLineHeight(a.value),children:a.label},a.id)),(0,r.jsx)(U,{}),(0,r.jsx)(tv,{checked:!0===t.hasSpaceBefore,disabled:n,onSelect:e.onToggleSpaceBefore,children:"Ins\xe9rer un espacement avant le paragraphe"}),(0,r.jsx)(tv,{checked:!0===t.hasSpaceAfter,disabled:n,onSelect:e.onToggleSpaceAfter,children:"Ins\xe9rer un espacement apr\xe8s le paragraphe"}),(0,r.jsx)(U,{}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:n,onClick:()=>c(!0),children:"Espacement personnalis\xe9"}),(0,r.jsx)(U,{}),(0,r.jsx)(tv,{checked:!0===t.keepWithNext,disabled:n,onSelect:e.onToggleKeepWithNext,children:"Rattacher au paragraphe suivant"}),(0,r.jsx)(tv,{checked:!0===t.keepLinesTogether,disabled:n,onSelect:e.onToggleKeepLinesTogether,children:"Ne pas laisser de ligne isol\xe9e"}),(0,r.jsx)(tv,{checked:!0===t.preventWidowOrphan,disabled:n,onSelect:e.onTogglePreventWidowOrphan,children:"Emp\xeacher les lignes isol\xe9es"}),(0,r.jsx)(tv,{checked:!0===t.pageBreakBefore,disabled:n,onSelect:e.onTogglePageBreakBefore,children:"Ajouter un saut de page avant"})]})]}),(0,r.jsxs)(eI,{id:"columns",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:n,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:view-column",className:"size-4"})}),"Colonnes"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[220px] overflow-visible p-2","data-docs-menu-surface":!0,children:[(0,r.jsx)(e1,{disabled:!0}),(0,r.jsx)(U,{className:"my-2"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:!0,children:"Autres options"})]})]}),(0,r.jsxs)(eI,{id:"lists",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:n,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eY.A,{className:"size-4"})}),"Puces et num\xe9ros"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[240px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(eI,{id:"list-options",children:[(0,r.jsx)(V,{className:"docs-menu-item",disabled:n||!t.isOrderedList&&!t.isBulletList&&!t.isTaskList,children:"Options de liste"}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[280px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(G,{className:"docs-menu-item",disabled:n||!t.isOrderedList,onClick:e.onRestartOrderedList,children:"Recommencer la num\xe9rotation"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:n||!t.isOrderedList,onClick:e.onContinueOrderedList,children:"Continuer la num\xe9rotation pr\xe9c\xe9dente"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:n||!t.isOrderedList,onClick:()=>u(!0),children:"Modifier le num\xe9ro de d\xe9part…"})]})]}),(0,r.jsxs)(eI,{id:"ordered-list",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:n,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eU.A,{className:"size-4"})}),"Liste num\xe9rot\xe9e"]}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content overflow-visible p-2","data-docs-menu-surface":!0,children:(0,r.jsx)(e4,{disabled:n,activeStyleId:t.isOrderedList?t.orderedStyleId:null,onSelect:e.onApplyOrderedStyle})})]}),(0,r.jsxs)(eI,{id:"bullet-list",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:n,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eY.A,{className:"size-4"})}),"Liste \xe0 puces"]}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content overflow-visible p-2","data-docs-menu-surface":!0,children:(0,r.jsx)(e5,{disabled:n,activeStyleId:t.isBulletList?t.bulletStyleId:null,onSelect:e.onApplyBulletStyle})})]}),(0,r.jsxs)(eI,{id:"checklist",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:n,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:checklist",className:"size-4"})}),"Menu de type checklist"]}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content overflow-visible p-2","data-docs-menu-surface":!0,children:(0,r.jsx)(e3,{disabled:n,activeStyleId:t.isTaskList?t.checklistStyleId:null,onSelect:e.onApplyChecklistStyle})})]})]})]})]}),(0,r.jsx)(U,{}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:!0,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:page-header",className:"size-4"})}),"En-t\xeates et pieds de page"]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:!0,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:counter-1",className:"size-4"})}),"Num\xe9ros de page"]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n||!e.onPageSetup,onClick:e.onPageSetup,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:screen-rotation",className:"size-4"})}),"Orientation de la page"]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n||!e.onPageSetup,onClick:e.onPageSetup,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:select",className:"size-4"})}),"Passer au format Sans pages"]}),(0,r.jsx)(U,{}),(0,r.jsxs)(eI,{id:"table-format",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:m||!t.tableSelected,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:table",className:"size-4"})}),"Tableau"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[260px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableAddRowBefore,children:"Ins\xe9rer une ligne au-dessus"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableAddRowAfter,children:"Ins\xe9rer une ligne en dessous"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableAddColumnBefore,children:"Ins\xe9rer une colonne \xe0 gauche"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableAddColumnAfter,children:"Ins\xe9rer une colonne \xe0 droite"}),(0,r.jsx)(U,{}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected||!t.tableCanMerge,onClick:e.onTableMergeCells,children:"Fusionner les cellules"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected||!t.tableCanSplit,onClick:e.onTableSplitCell,children:"Scinder la cellule"}),(0,r.jsx)(U,{}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableToggleHeaderRow,children:"Ligne d'en-t\xeate"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableToggleHeaderColumn,children:"Colonne d'en-t\xeate"}),(0,r.jsx)(U,{}),(0,r.jsxs)(eI,{id:"table-cell-color",children:[(0,r.jsx)(V,{className:"docs-menu-item",disabled:m||!t.tableSelected,children:"Couleur de cellule"}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[200px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:()=>e.onTableSetCellBackground(null),children:"Aucune"}),[{label:"Gris clair",color:"#f3f3f3"},{label:"Bleu clair",color:"#c9daf8"},{label:"Vert clair",color:"#d9ead3"},{label:"Jaune clair",color:"#fff2cc"}].map(n=>(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:()=>e.onTableSetCellBackground(n.color),children:n.label},n.color))]})]}),(0,r.jsx)(U,{}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableAlignLeft,children:"Aligner le tableau \xe0 gauche"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableAlignCenter,children:"Centrer le tableau"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableAlignRight,children:"Aligner le tableau \xe0 droite"}),(0,r.jsx)(U,{}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableDeleteRow,children:"Supprimer la ligne"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableDeleteColumn,children:"Supprimer la colonne"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableDelete,children:"Supprimer le tableau"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableFixStructure,children:"R\xe9parer la structure"})]})]}),(0,r.jsxs)(eI,{id:"image-format",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:m||!t.imageSelected,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:image-outline",className:"size-4"})}),"Image"]}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[220px] overflow-visible","data-docs-menu-surface":!0,children:(0,r.jsx)(G,{disabled:!0,className:"docs-menu-item text-muted-foreground",children:"Bient\xf4t disponible"})})]}),(0,r.jsxs)(eI,{id:"borders-lines",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:m||!t.tableSelected,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:horizontal-rule",className:"size-4"})}),"Bordures et lignes"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[220px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:()=>e.onTableSetCellBorders("#000000"),children:"Bordures sur toutes les cellules"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:e.onTableClearCellBorders,children:"Supprimer les bordures"}),(0,r.jsx)(U,{}),(0,r.jsxs)(eI,{id:"table-border-color",children:[(0,r.jsx)(V,{className:"docs-menu-item",disabled:m||!t.tableSelected,children:"Couleur des bordures"}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[180px] overflow-visible","data-docs-menu-surface":!0,children:tx.map(n=>(0,r.jsxs)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:()=>e.onTableSetCellBorders(n),children:[(0,r.jsx)("span",{className:"mr-2 inline-block size-4 rounded-sm border border-border",style:{backgroundColor:n},"aria-hidden":!0}),n]},n))})]}),(0,r.jsx)(U,{}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:()=>e.onTableSetRowHeight("32px"),children:"Hauteur de ligne compacte"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:()=>e.onTableSetRowHeight("48px"),children:"Hauteur de ligne normale"}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:m||!t.tableSelected,onClick:()=>e.onTableSetRowHeight(null),children:"Hauteur de ligne automatique"})]})]}),(0,r.jsx)(U,{}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:e.onClearFormatting,children:[(0,r.jsx)(tb,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:format-clear",className:"size-4"})}),"Supprimer la mise en forme",(0,r.jsx)(ty,{children:tj("\\")})]})]}),(0,r.jsx)(te,{open:s,onOpenChange:l,onCreate:e=>i?.createUserStyle(e)}),(0,r.jsx)(tu,{open:o,onOpenChange:c,initial:t.customSpacingDraft,onApply:e.onApplyCustomSpacing}),(0,r.jsx)(th,{open:d,onOpenChange:u,initialStart:"mixed"===t.orderedListStart?1:t.orderedListStart,onApply:e.onSetOrderedListStart})]})}var tk=n(81231),tC=n(83866),tS=n(61764),tA=n(40230),tM=n(77652),tz=n(93497),tP=n(16007),tI=n(74877),tT=n(1563),tD=n(15208),tL=n(38331),tF=n(68183),tE=n(23017),tR=n(27207);function tH({onInsert:e}){let[t,n]=(0,a.useState)({rows:0,cols:0}),i=t.rows>0&&t.cols>0?`${t.cols} x ${t.rows}`:"Ins\xe9rer un tableau";return(0,r.jsxs)("div",{className:"px-3 py-2",onMouseLeave:()=>n({rows:0,cols:0}),children:[(0,r.jsx)("div",{className:"inline-grid gap-0.5",style:{gridTemplateColumns:"repeat(10, 1fr)"},role:"grid","aria-label":"S\xe9lecteur de tableau",children:Array.from({length:8},(a,i)=>Array.from({length:10},(a,s)=>{let l=i+1,o=s+1,c=l<=t.rows&&o<=t.cols;return(0,r.jsx)("button",{type:"button",className:(0,v.cn)("size-4 rounded-sm border border-[#dadce0] bg-white transition-colors","hover:border-[#1a73e8]",c&&"border-[#1a73e8] bg-[#d2e3fc]"),"aria-label":`${o} colonnes par ${l} lignes`,onMouseEnter:()=>n({rows:l,cols:o}),onClick:()=>e(l,o)},`${l}-${o}`)}))}),(0,r.jsx)("p",{className:"mt-2 text-center text-xs text-[#5f6368] dark:text-muted-foreground",children:i})]})}var tB=n(36042);function t$({children:e}){return(0,r.jsx)("span",{className:"docs-menu-item-icon",children:e})}function tO({children:e}){return(0,r.jsx)("span",{className:"docs-menu-badge ml-auto shrink-0 rounded px-1.5 py-px text-[10px] font-medium leading-tight text-white",children:e})}function tW({icon:e,children:t,badge:n,shortcut:a}){return(0,r.jsxs)(G,{className:"docs-menu-item",disabled:!0,children:[(0,r.jsx)(t$,{children:e}),t,n,a?(0,r.jsx)(X,{children:a}):null]})}function t_(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tW,{icon:(0,r.jsx)(tk.A,{className:"size-4"}),children:"Notes de r\xe9union"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:mail-outline",className:"size-4"}),children:"Brouillon d'email"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:format-list-bulleted",className:"size-4"}),children:"Journal simple des d\xe9cisions"}),(0,r.jsx)(U,{}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:more-vert",className:"size-4"}),children:"Voir plus"})]})}function tq(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tW,{icon:(0,r.jsx)(tk.A,{className:"size-4"}),children:"Date"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:person-outline",className:"size-4"}),children:"Personne"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(ep.A,{className:"size-4"}),children:"Fichier"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:event-outline",className:"size-4"}),children:"\xc9v\xe9nement d'agenda"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:location-on-outline",className:"size-4"}),children:"Lieu"})]})}function tG({actions:e,disabled:t,pageElementsEnabled:n=!0}){let a=t||!n;return(0,r.jsxs)(O,{children:[(0,r.jsx)(_,{className:"docs-menu-trigger",children:"Insertion"}),(0,r.jsxs)(q,{...eu,className:"docs-menu-content min-w-[300px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(eP,{children:[(0,r.jsxs)(eI,{id:"insert-image",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:t,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tC.A,{className:"size-4"})}),"Image"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[260px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onInsertImageFromComputer,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tS.A,{className:"size-4"})}),"Importer depuis l'ordinateur"]}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:search",className:"size-4"}),children:"Rechercher sur le Web"}),(0,r.jsx)(U,{}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onInsertImageFromDrive,children:[(0,r.jsx)(t$,{children:(0,r.jsx)("img",{src:(0,tB.w)("/ultidrive-mark.svg"),alt:"",className:"size-4","aria-hidden":!0})}),"Drive"]}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"logos:google-photos",className:"size-4"}),children:"Photos"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:photo-camera-outline",className:"size-4"}),children:"Appareil photo"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(tA.A,{className:"size-4"}),children:"\xc0 partir d'une URL"})]})]}),(0,r.jsxs)(eI,{id:"insert-table",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:t,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tM.A,{className:"size-4"})}),"Tableau"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[220px] overflow-visible p-0","data-docs-menu-surface":!0,children:[(0,r.jsxs)(eI,{id:"insert-table-building-blocks",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:!0,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(ep.A,{className:"size-4"})}),"Composants de base"]}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[260px] overflow-visible","data-docs-menu-surface":!0,children:(0,r.jsx)(t_,{})})]}),(0,r.jsx)(tH,{onInsert:(n,r)=>{t||e.onInsertTable(n,r)}})]})]}),(0,r.jsxs)(eI,{id:"insert-building-blocks",children:[(0,r.jsxs)(V,{className:"docs-menu-item",children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tz.A,{className:"size-4"})}),"Composants de base"]}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[260px] overflow-visible","data-docs-menu-surface":!0,children:(0,r.jsx)(t_,{})})]}),(0,r.jsxs)(eI,{id:"insert-smart-chips",children:[(0,r.jsxs)(V,{className:"docs-menu-item",children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tP.A,{className:"size-4"})}),"Chips intelligents"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[260px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(tW,{icon:(0,r.jsx)(tk.A,{className:"size-4"}),children:"Date"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:person-outline",className:"size-4"}),children:"Contact"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(ep.A,{className:"size-4"}),children:"Fichier"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:event-outline",className:"size-4"}),children:"\xc9v\xe9nement d'agenda"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:location-on-outline",className:"size-4"}),children:"Lieu"}),(0,r.jsxs)(eI,{id:"insert-placeholder-chips",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:!0,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tP.A,{className:"size-4"})}),"Chips d'espace r\xe9serv\xe9"]}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[240px] overflow-visible","data-docs-menu-surface":!0,children:(0,r.jsx)(tq,{})})]}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:arrow-drop-down-circle-outline",className:"size-4"}),children:"Menu d\xe9roulant"})]})]}),(0,r.jsxs)(eI,{id:"insert-esignatures",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:!0,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tI.A,{className:"size-4"})}),"Signatures \xe9lectroniques",(0,r.jsx)(tO,{children:"Premium"})]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[260px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(tW,{icon:(0,r.jsx)(tI.A,{className:"size-4"}),children:"Ins\xe9rer un champ de signature"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:draw-outline",className:"size-4"}),children:"Demander une signature"})]})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onInsertLink,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tA.A,{className:"size-4"})}),"Lien",(0,r.jsx)(X,{children:"⌘K"})]}),(0,r.jsxs)(eI,{id:"insert-draw",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:t,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tT.A,{className:"size-4"})}),"Dessin"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[220px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onInsertNewDraw,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tz.A,{className:"size-4"})}),"Nouveau"]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onInsertDrawFromDrive,children:[(0,r.jsx)(t$,{children:(0,r.jsx)("img",{src:(0,tB.w)("/ultidrive-mark.svg"),alt:"",className:"size-4","aria-hidden":!0})}),"\xc0 partir de Drive"]})]})]}),(0,r.jsxs)(eI,{id:"insert-chart",children:[(0,r.jsxs)(V,{className:"docs-menu-item",children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tD.A,{className:"size-4"})}),"Graphique"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[200px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:bar-chart",className:"size-4"}),children:"Barres"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:insert-chart-outline",className:"size-4"}),children:"Colonnes"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:show-chart",className:"size-4"}),children:"Lignes"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:pie-chart-outline",className:"size-4"}),children:"Secteurs"}),(0,r.jsx)(U,{}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"logos:google-sheets",className:"size-4"}),children:"Depuis Sheets"})]})]}),(0,r.jsxs)(eI,{id:"insert-symbols",children:[(0,r.jsxs)(V,{className:"docs-menu-item",children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tL.A,{className:"size-4"})}),"Symboles"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[200px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(tW,{icon:(0,r.jsx)(tL.A,{className:"size-4"}),children:"Emoji"}),(0,r.jsx)(tW,{icon:(0,r.jsx)("span",{className:"text-sm font-medium",children:"Ω"}),children:"Caract\xe8res sp\xe9ciaux"}),(0,r.jsx)(tW,{icon:(0,r.jsx)("span",{className:"text-sm font-medium",children:"π\xb2"}),children:"\xc9quation"})]})]})]}),(0,r.jsx)(U,{}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:tab",className:"size-4"}),shortcut:"Maj+F11",children:"Onglet"}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:t,onClick:e.onInsertHorizontalRule,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(tF.A,{className:"size-4"})}),"Ligne horizontale"]}),(0,r.jsxs)(eI,{id:"insert-break",children:[(0,r.jsxs)(V,{className:"docs-menu-item",children:[(0,r.jsx)(t$,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:page-break",className:"size-4"})}),"Saut"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[280px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:page-break",className:"size-4"}),shortcut:"⌘↵",children:"Saut de page"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:view-column",className:"size-4"}),children:"Saut de colonne"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:subdirectory-arrow-right",className:"size-4"}),children:"Saut de section (page suivante)"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:subdirectory-arrow-right",className:"size-4"}),children:"Saut de section (continu)"})]})]}),(0,r.jsx)(tW,{icon:(0,r.jsx)(tE.A,{className:"size-4"}),children:"Signet"}),(0,r.jsxs)(eI,{id:"insert-page-elements",children:[(0,r.jsxs)(V,{className:"docs-menu-item",children:[(0,r.jsx)(t$,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:article-outline",className:"size-4"})}),"\xc9l\xe9ments de page",(0,r.jsx)(tO,{children:"Mise \xe0 jour"})]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[300px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(eI,{id:"insert-toc",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:!0,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:list-alt",className:"size-4"})}),"Table des mati\xe8res"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[280px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:list-alt",className:"size-4"}),children:"Table des mati\xe8res avec liens"}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:format-list-bulleted",className:"size-4"}),children:"Table des mati\xe8res en texte brut"})]})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:a,onClick:e.onInsertHeader,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:vertical-align-top",className:"size-4"})}),"En-t\xeate",(0,r.jsx)("span",{className:"docs-menu-shortcut-sequence ml-auto text-xs text-[#5f6368] dark:text-muted-foreground",children:"Ctrl+⌘O Ctrl+⌘H"})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:a,onClick:e.onInsertFooter,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:vertical-align-bottom",className:"size-4"})}),"Pied de page",(0,r.jsx)("span",{className:"docs-menu-shortcut-sequence ml-auto text-xs text-[#5f6368] dark:text-muted-foreground",children:"Ctrl+⌘O Ctrl+⌘F"})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:a,onClick:e.onInsertWatermark,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:branding-watermark-outline",className:"size-4"})}),"Filigrane"]}),(0,r.jsxs)(eI,{id:"insert-page-numbers",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:a,children:[(0,r.jsx)(t$,{children:(0,r.jsx)("span",{className:"text-sm font-medium",children:"#"})}),"Num\xe9ros de page"]}),(0,r.jsxs)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[240px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(G,{className:"docs-menu-item",disabled:a,onClick:e.onInsertPageNumbersHeader,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:vertical-align-top",className:"size-4"})}),"En haut de page"]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:a,onClick:e.onInsertPageNumbersFooter,children:[(0,r.jsx)(t$,{children:(0,r.jsx)(eR.In,{icon:"material-symbols:vertical-align-bottom",className:"size-4"})}),"En bas de page"]}),(0,r.jsx)(U,{}),(0,r.jsx)(G,{className:"docs-menu-item",disabled:a,onClick:e.onOpenPageNumbersOptions,children:"Options de num\xe9rotation…"})]})]}),(0,r.jsx)(tW,{icon:(0,r.jsx)(eR.In,{icon:"material-symbols:notes",className:"size-4"}),shortcut:"⌘⌥F",children:"Note de bas de page"})]})]}),(0,r.jsx)(U,{}),(0,r.jsx)(tW,{icon:(0,r.jsx)(tR.A,{className:"size-4"}),shortcut:"⌘⌥M",children:"Commentaire"})]})]})}var tY=n(82558),tU=n(13084),tX=n(83876),tJ=n(71952),tV=n(46e3);let tK=[{id:"edit",label:"\xc9dition",description:"Modifier le document directement",icon:eg.A},{id:"suggest",label:"Suggestion",description:"Sugg\xe9rer des modifications",icon:tR.A},{id:"view",label:"Affichage",description:"Lire ou imprimer le document final",icon:tY.A}],tQ=[{id:"hidden",label:"Masquer les commentaires"},{id:"collapsed",label:"R\xe9duire les commentaires"},{id:"expanded",label:"D\xe9velopper les commentaires"},{id:"all",label:"Afficher tous les commentaires"}];function tZ({children:e}){return(0,r.jsx)("span",{className:"docs-menu-item-icon",children:e})}function t0({checked:e,onSelect:t,children:n,disabled:a}){return(0,r.jsxs)(G,{className:"docs-menu-item relative pl-8",disabled:a,onClick:t,children:[e?(0,r.jsx)(H.A,{className:"absolute left-2 size-4","aria-hidden":!0}):null,n]})}function t1({icon:e,label:t,description:n,selected:a,onSelect:i,disabled:s}){return(0,r.jsxs)(G,{className:(0,v.cn)("docs-menu-item docs-menu-mode-item items-start py-2",a&&"bg-accent/60"),disabled:s,onClick:i,children:[(0,r.jsx)(tZ,{children:(0,r.jsx)(e,{className:"size-4"})}),(0,r.jsxs)("span",{className:"flex min-w-0 flex-col gap-0.5 leading-tight",children:[(0,r.jsx)("span",{className:"text-sm font-normal",children:t}),(0,r.jsx)("span",{className:"text-xs text-[#5f6368] dark:text-muted-foreground",children:n})]})]})}function t2({state:e,actions:t,disabled:n}){return(0,r.jsxs)(O,{children:[(0,r.jsx)(_,{className:"docs-menu-trigger",children:"Affichage"}),(0,r.jsxs)(q,{...eu,className:"docs-menu-content min-w-[300px] overflow-visible","data-docs-menu-surface":!0,children:[(0,r.jsxs)(eP,{children:[(0,r.jsxs)(eI,{id:"mode",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:n,children:[(0,r.jsx)(tZ,{children:(0,r.jsx)(eg.A,{className:"size-4"})}),"Mode"]}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[280px] overflow-visible","data-docs-menu-surface":!0,children:tK.map(a=>(0,r.jsx)(t1,{icon:a.icon,label:a.label,description:a.description,selected:e.editorMode===a.id,disabled:n,onSelect:()=>t.onEditorModeChange(a.id)},a.id))})]}),(0,r.jsxs)(eI,{id:"comments",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:n,children:[(0,r.jsx)(tZ,{children:(0,r.jsx)(tU.A,{className:"size-4"})}),"Commentaires"]}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[260px] overflow-visible","data-docs-menu-surface":!0,children:tQ.map(a=>(0,r.jsx)(t0,{checked:e.commentsDisplay===a.id,disabled:n,onSelect:()=>t.onCommentsDisplayChange(a.id),children:a.label},a.id))})]}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:t.onToggleOutlineSidebar,children:[(0,r.jsx)(tZ,{children:(0,r.jsx)(tX.A,{className:"size-4"})}),"D\xe9velopper la barre lat\xe9rale des onglets et sections",(0,r.jsx)("span",{className:"docs-menu-shortcut-sequence ml-auto text-xs text-[#5f6368] dark:text-muted-foreground",children:"Ctrl+⌥A Ctrl+⌥H"})]}),(0,r.jsx)(U,{}),(0,r.jsxs)(eI,{id:"text-width",children:[(0,r.jsxs)(V,{className:"docs-menu-item",disabled:!0,children:[(0,r.jsx)(tZ,{children:(0,r.jsx)(tJ.A,{className:"size-4"})}),"Largeur du texte"]}),(0,r.jsx)(K,{className:"docs-menu-content docs-menu-sub-content min-w-[220px] overflow-visible","data-docs-menu-surface":!0,children:(0,r.jsx)(G,{disabled:!0,className:"docs-menu-item text-muted-foreground",children:"Bient\xf4t disponible"})})]}),(0,r.jsx)(U,{})]}),(0,r.jsx)(Y,{className:"docs-menu-item docs-menu-checkbox-item",checked:e.showLayout,disabled:n,onCheckedChange:()=>t.onToggleShowLayout(),children:"Afficher la mise en page"}),(0,r.jsx)(Y,{className:"docs-menu-item docs-menu-checkbox-item",checked:e.showRuler,disabled:n,onCheckedChange:()=>t.onToggleShowRuler(),children:"Afficher la r\xe8gle"}),(0,r.jsx)(Y,{className:"docs-menu-item docs-menu-checkbox-item",checked:e.showEquationToolbar,disabled:n,onCheckedChange:()=>t.onToggleShowEquationToolbar(),children:"Afficher la barre d'outils d'\xe9quation"}),(0,r.jsxs)(Y,{className:"docs-menu-item docs-menu-checkbox-item",checked:e.showNonPrintableChars,disabled:n,onCheckedChange:()=>t.onToggleShowNonPrintableChars(),children:["Afficher les caract\xe8res non imprimables",(0,r.jsx)(ed,{shortcutId:"view.showNonPrintable"})]}),(0,r.jsx)(U,{}),(0,r.jsxs)(G,{className:"docs-menu-item",disabled:n,onClick:t.onFullscreen,children:[(0,r.jsx)(tZ,{children:(0,r.jsx)(tV.A,{className:"size-4"})}),"Plein \xe9cran"]})]})]})}let t4=["Outils","Aide"];function t5({viewMenuActions:e,viewMenuState:t,viewMenuDisabled:n,fileMenuActions:a,fileMenuDisabled:i,editMenuActions:s,editMenuState:l,editMenuDisabled:o,insertMenuActions:c,insertMenuDisabled:d,insertMenuPageElementsEnabled:u,formatMenuActions:h,formatMenuState:m,formatMenuDisabled:p,className:g}){return(0,r.jsxs)($,{className:(0,v.cn)("docs-menubar h-auto gap-0 border-0 bg-transparent p-0 shadow-none",g),children:[a?(0,r.jsx)(eE,{actions:a,disabled:i}):(0,r.jsxs)(O,{children:[(0,r.jsx)(_,{className:"docs-menu-trigger",children:"Fichier"}),(0,r.jsx)(q,{...eu,"data-docs-menu-surface":!0,children:(0,r.jsx)(G,{disabled:!0,className:"text-muted-foreground",children:"Bient\xf4t disponible"})})]}),s&&l?(0,r.jsx)(em,{actions:s,state:l,disabled:o}):(0,r.jsxs)(O,{children:[(0,r.jsx)(_,{className:"docs-menu-trigger",children:"\xc9dition"}),(0,r.jsx)(q,{...eu,"data-docs-menu-surface":!0,children:(0,r.jsx)(G,{disabled:!0,className:"text-muted-foreground",children:"Bient\xf4t disponible"})})]}),e&&t?(0,r.jsx)(t2,{actions:e,state:t,disabled:n}):(0,r.jsxs)(O,{children:[(0,r.jsx)(_,{className:"docs-menu-trigger",children:"Affichage"}),(0,r.jsx)(q,{...eu,"data-docs-menu-surface":!0,children:(0,r.jsx)(G,{disabled:!0,className:"text-muted-foreground",children:"Bient\xf4t disponible"})})]}),c?(0,r.jsx)(tG,{actions:c,disabled:d,pageElementsEnabled:u}):(0,r.jsxs)(O,{children:[(0,r.jsx)(_,{className:"docs-menu-trigger",children:"Insertion"}),(0,r.jsx)(q,{...eu,"data-docs-menu-surface":!0,children:(0,r.jsx)(G,{disabled:!0,className:"text-muted-foreground",children:"Bient\xf4t disponible"})})]}),h&&m?(0,r.jsx)(tN,{actions:h,state:m,disabled:p}):(0,r.jsxs)(O,{children:[(0,r.jsx)(_,{className:"docs-menu-trigger",children:"Format"}),(0,r.jsx)(q,{...eu,className:"docs-menu-content overflow-visible","data-docs-menu-surface":!0,children:(0,r.jsx)(G,{disabled:!0,className:"text-muted-foreground",children:"Bient\xf4t disponible"})})]}),t4.map(e=>(0,r.jsxs)(O,{children:[(0,r.jsx)(_,{className:"docs-menu-trigger",children:e}),(0,r.jsx)(q,{...eu,className:"docs-menu-content overflow-visible","data-docs-menu-surface":!0,children:(0,r.jsx)(G,{disabled:!0,className:"text-muted-foreground",children:"Bient\xf4t disponible"})})]},e))]})}var t3=n(63429),t8=n(37122);function t6({file:e,onFileMoved:t}){let[n,i]=(0,a.useState)(!1);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground","aria-label":"D\xe9placer le document",title:"D\xe9placer le document",onClick:()=>i(!0),children:(0,r.jsx)(ew.A,{className:"size-4"})}),(0,r.jsx)(t3.m,{open:n,onOpenChange:i,sources:[e],mode:"move",onMoved:n=>{n&&t((0,t8.a3)(n,e.name))}})]})}var t9=n(87741);function t7({kind:e}){return"globe"===e?(0,r.jsx)(h.A,{className:"h-4 w-4","aria-hidden":!0}):"users"===e?(0,r.jsx)(m.A,{className:"h-4 w-4","aria-hidden":!0}):(0,r.jsx)(p.A,{className:"h-4 w-4","aria-hidden":!0})}function ne({title:e,onRename:t,renameDisabled:n,backHref:a,backLabel:i,showBack:s=!0,shares:l=[],onShareClick:o,showShare:c=!1,showAccount:d=!1,saveStatus:h="idle",presenceUsers:m=[],viewMenuActions:p,viewMenuState:f,viewMenuDisabled:x,trailing:y,moveFile:k,onFileMoved:C,fileMenuActions:M,fileMenuDialogs:z,fileMenuDisabled:P,editMenuActions:I,editMenuState:T,editMenuDisabled:D,insertMenuActions:L,insertMenuDialogs:F,insertMenuDisabled:E,insertMenuPageElementsEnabled:R,formatMenuActions:H,formatMenuState:B,formatMenuDisabled:$,renameSignal:O}){let W=0===l.length?"lock":l.some(e=>e.share_type===t9.xz.USER||e.share_type===t9.xz.EMAIL||e.share_type===t9.xz.GROUP)?"users":l.some(e=>e.share_type===t9.xz.LINK&&("public"===e.access_mode||!e.access_mode))?"globe":l.some(e=>e.share_type===t9.xz.LINK)?"users":"lock",_=function(e){switch(e){case"saving":return"Enregistrement…";case"saved":return"Enregistr\xe9 dans UltiDrive";case"error":return"Erreur d'enregistrement";default:return""}}(h),q=!1!==s&&a?a:"/drive",G=!1!==s&&a?i??"Retour au Drive":"Ouvrir le Drive";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("header",{className:"shrink-0 bg-white dark:bg-background",children:(0,r.jsxs)("div",{className:"flex min-h-[72px] items-center gap-0 py-1 pl-2 pr-4",children:[(0,r.jsx)(b.$,{variant:"ghost",size:"icon",className:"mr-1 size-11 shrink-0 self-center rounded-full hover:bg-[#e8eaed] dark:hover:bg-muted",asChild:!0,children:(0,r.jsx)(u(),{href:q,"aria-label":G,children:(0,r.jsx)(A,{className:"size-[38px]"})})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1 self-center",children:[(0,r.jsxs)("div",{className:"docs-chrome-title-row flex min-w-0 items-center gap-0 leading-tight",children:[t?(0,r.jsx)(w,{value:e,onRename:t,disabled:n,renameSignal:O,className:"pr-1 text-base font-normal"}):(0,r.jsx)("span",{className:"block truncate pl-2 pr-1 text-base font-normal",children:e}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center -space-x-0.5",children:[(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground",disabled:!0,"aria-label":"Ajouter aux favoris (bient\xf4t)",children:(0,r.jsx)(g.A,{className:"size-4"})}),k&&C?(0,r.jsx)(t6,{file:k,onFileMoved:C}):null]}),_?(0,r.jsx)("span",{className:(0,v.cn)("ml-1.5 hidden min-w-0 line-clamp-1 overflow-hidden break-all text-ellipsis text-xs text-[#5f6368] sm:inline dark:text-muted-foreground","error"===h&&"text-destructive"),children:_}):null]}),(0,r.jsx)("div",{className:(0,v.cn)("-mt-1 flex min-w-0 items-center overflow-x-auto overflow-y-visible","[scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"),children:(0,r.jsx)(t5,{className:"docs-menubar shrink-0",viewMenuActions:p,viewMenuState:f,viewMenuDisabled:x,fileMenuActions:M,fileMenuDisabled:P,editMenuActions:I,editMenuState:T,editMenuDisabled:D,insertMenuActions:L,insertMenuDisabled:E,insertMenuPageElementsEnabled:R,formatMenuActions:H,formatMenuState:B,formatMenuDisabled:$})})]}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-2 self-center pl-2",children:[y,m.length>0?(0,r.jsx)(S,{users:m}):null,c?(0,r.jsxs)(b.$,{type:"button",size:"sm",className:(0,v.cn)("gap-2 rounded-full border-0 px-5 shadow-none","bg-[#1967d2] text-white hover:bg-[#185abc] hover:text-white","dark:bg-[#e8eaed] dark:text-[#3c4043] dark:hover:bg-[#dadce0] dark:hover:text-[#202124]"),onClick:o,children:[(0,r.jsx)(t7,{kind:W}),"Partager"]}):null,d?(0,r.jsx)(j,{}):null]})]})}),c?(0,r.jsx)(N.G,{}):null,z,F]})}var nt=n(9519),nn=n(68516).Buffer;function nr(e){return e&&"auto"!==e.toLowerCase()?e.startsWith("#")?e:/^[0-9a-f]{6}$/i.test(e)?`#${e}`:"#000000":"#000000"}function na(e){return e?new TextDecoder().decode(e):""}function ni(e,t,n){let r=na(e[t]);if(!r)return null;let a=(function(e){let t=new Map;for(let n of e.matchAll(/<Relationship\b[^>]*\/?>/gi)){let e=n[0].match(/\bId="([^"]+)"/i)?.[1],r=n[0].match(/\bTarget="([^"]+)"/i)?.[1];e&&r&&t.set(e,r)}return t})(r).get(n);if(!a)return null;let i=function(e,t){if(t.startsWith("/"))return t.slice(1);let n=e.split("/").filter(Boolean);for(let e of t.split("/"))".."===e?n.pop():"."!==e&&n.push(e);return n.join("/")}(t.replace(/\/_rels\/[^/]+\.rels$/,""),a),s=e[i];return s?function(e,t){let n="";for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);let r="function"==typeof btoa?btoa(n):nn.from(e).toString("base64");return`data:${t};base64,${r}`}(s,function(e){switch(e.split(".").pop()?.toLowerCase()){case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"webp":return"image/webp";case"bmp":return"image/bmp";default:return"application/octet-stream"}}(i)):null}function ns(e){if(!e)return;let t=e.trim();if(t)return t.startsWith("#")?7===t.length?t:void 0:/^[0-9a-f]{6}$/i.test(t)?`#${t}`:nr(t)}function nl(e){if(!e)return -35;let t=e.match(/(?:rotation|rotate):\s*(-?\d+(?:\.\d+)?)/i)?.[1];if(!t)return -35;let n=Number.parseFloat(t);return Number.isFinite(n)?n:-35}function no(e){if(!e)return .35;let t=Number.parseFloat(e);return Number.isFinite(t)?Math.min(1,Math.max(0,t>1?t/100:t)):.35}let nc=96/25.4,nd=[{id:"a4",label:"A4",widthMm:210,heightMm:297},{id:"letter",label:"Letter",widthMm:216,heightMm:279},{id:"legal",label:"Legal",widthMm:216,heightMm:356},{id:"a5",label:"A5",widthMm:148,heightMm:210},{id:"tabloid",label:"Tabloid",widthMm:279,heightMm:432}];function nu(e){return nd.find(t=>t.id===e)??nd[0]}let nh=1440/25.4;function nm(e){return Math.round(e/nh*100)/100}function np(e){return Math.round(e*nc)}function ng(e){return Math.round(e/nc*100)/100}function nf(){return{top:20,right:20,bottom:20,left:20}}function nx(e){return Math.round(e/10*10)/10}function nb(e){return Math.round(10*e*100)/100}function ny(e){return e&&"#ffffff"!==e.toLowerCase()&&"white"!==e.toLowerCase()?e:"#ffffff"}function nj(e,t){for(let n of nd){let r=2>=Math.abs(n.widthMm-e)&&2>=Math.abs(n.heightMm-t),a=2>=Math.abs(n.widthMm-t)&&2>=Math.abs(n.heightMm-e);if(r||a)return n.id}return null}function nv(e,t="a4"){var n;let r;if(!e){let e=nu(t),n=np(nf().top);return{widthPx:np(e.widthMm),heightPx:np(e.heightMm),marginsPx:{top:n,right:n,bottom:n,left:n},format:e,pageColor:"#ffffff",pageBackgroundLayers:{}}}let a=e.formatId??nj(e.widthMm,e.heightMm),i=a?nu(a):null,s=e.borders&&((r={top:nw((n=e.borders).top),right:nw(n.right),bottom:nw(n.bottom),left:nw(n.left)}).top||r.right||r.bottom||r.left)?"page"===n.offsetFrom?{sheetBorderCss:r}:{textAreaBorderCss:r}:{};return{widthPx:np(e.widthMm),heightPx:np(e.heightMm),marginsPx:{top:np(e.marginsMm.top),right:np(e.marginsMm.right),bottom:np(e.marginsMm.bottom),left:np(e.marginsMm.left)},format:i??{id:t,label:`${e.widthMm} \xd7 ${e.heightMm} mm`,widthMm:e.widthMm,heightMm:e.heightMm},pageColor:ny(e.pageColor),pageBackgroundLayers:function(e){if(!e)return{};let t={};if(e.gradientCss&&(t.gradientCss=e.gradientCss),e.fillImage?.src){let n=e.fillImage.mode;t.fillImageStyle={backgroundImage:`url("${e.fillImage.src}")`,backgroundRepeat:"tile"===n?"repeat":"no-repeat",backgroundSize:"tile"===n?"auto":"frame"===n?"100% 100%":"cover",backgroundPosition:"center"}}return e.watermark&&(t.watermarkStyle={text:"text"===e.watermark.kind?e.watermark.text:void 0,imageSrc:"image"===e.watermark.kind?e.watermark.src:void 0,color:e.watermark.color??"#b4b4b4",opacity:e.watermark.opacity??.35,rotationDeg:e.watermark.rotationDeg??-35}),t}(e.pageBackground),header:e.header??null,footer:e.footer??null,headerFirstPage:e.headerFirstPage??null,footerFirstPage:e.footerFirstPage??null,headerMarginMm:e.headerMarginMm,footerMarginMm:e.footerMarginMm,headerFooterDifferentFirstPage:e.headerFooterDifferentFirstPage??!1,headerFooterDifferentOddEven:e.headerFooterDifferentOddEven??!1,pageNumbers:e.pageNumbers??null,...s}}function nw(e){if("none"!==e.style&&!(e.widthPx<=0))return`${e.widthPx}px ${e.style} ${e.color}`}function nN(e,t){let n=e?.formatId??(e?nj(e.widthMm,e.heightMm):null)??t,r=e?.marginsMm??nf();return{formatId:n,orientation:e?.orientation??"portrait",marginsCm:{top:nx(r.top),right:nx(r.right),bottom:nx(r.bottom),left:nx(r.left)},pageColor:ny(e?.pageColor)}}function nk(e){return Number.isFinite(e)?Math.min(25,Math.max(0,Math.round(10*e)/10)):2}function nC(e,t){let n=nu(e.formatId),r=n.widthMm,a=n.heightMm;"landscape"===e.orientation&&([r,a]=[a,r]);let i=ny(e.pageColor);return{widthMm:r,heightMm:a,marginsMm:{top:nb(nk(e.marginsCm.top)),right:nb(nk(e.marginsCm.right)),bottom:nb(nk(e.marginsCm.bottom)),left:nb(nk(e.marginsCm.left))},formatId:e.formatId,orientation:e.orientation,pageColor:"#ffffff"===i?null:i,pageBackground:t?.pageBackground??null,borders:t?.borders??null,header:t?.header??null,footer:t?.footer??null,headerMarginMm:t?.headerMarginMm,footerMarginMm:t?.footerMarginMm,headerFooterDifferentFirstPage:t?.headerFooterDifferentFirstPage??!1,headerFooterDifferentOddEven:t?.headerFooterDifferentOddEven??!1,pageNumbers:t?.pageNumbers??null}}function nS(e,t){return nC({...nN(t,e),formatId:e},t)}function nA(e,t){let n=e.match(RegExp(`\\bw:${t}="(\\d+)"`,"i"));if(!n)return null;let r=Number.parseInt(n[1]??"",10);return Number.isFinite(r)?r:null}function nM(e){let t=e.match(/<w:pgSz\b[^>]*\/?>/i),n=e.match(/<w:pgMar\b[^>]*\/?>/i);if(!t||!n)return null;let r=nA(t[0],"w"),a=nA(t[0],"h");if(null==r||null==a)return null;let i=nm(r),s=nm(a),l=t[0].match(/\bw:orient="(landscape|portrait)"/i)?.[1]?.toLowerCase();"landscape"===l&&i<s&&([i,s]=[s,i]);let o=nA(n[0],"top"),c=nA(n[0],"right"),d=nA(n[0],"bottom"),u=nA(n[0],"left"),h=nA(n[0],"header"),m=nA(n[0],"footer");if(null==o||null==c||null==d||null==u)return null;let p={top:nm(o),right:nm(c),bottom:nm(d),left:nm(u)};return{widthMm:i,heightMm:s,marginsMm:p,headerMarginMm:null!=h?nm(h):p.top,footerMarginMm:null!=m?nm(m):p.bottom,formatId:nj(i,s),orientation:"landscape"===l?"landscape":"portrait",borders:function(e){let t=e.match(/<w:pgBorders\b[^>]*>[\s\S]*?<\/w:pgBorders>/i)?.[0];if(!t)return null;let n=null!=t.match(/\bw:offsetFrom="page"/i)?"page":"text",r=e=>{var n,r,a;let i,s,l,o=t.match(RegExp(`<w:${e}\\b[^>]*/?>`,"i"));return o?(n=o[0],i=n.match(/\bw:val="([^"]+)"/i)?.[1]??"none",s=Number.parseInt(n.match(/\bw:sz="(\d+)"/i)?.[1]??"0",10),l=(r=n.match(/\bw:color="([^"]+)"/i)?.[1])&&"auto"!==r.toLowerCase()?r.startsWith("#")?r:/^[0-9a-f]{6}$/i.test(r)?`#${r}`:"#000000":"#000000",{style:function(e){switch(e.toLowerCase()){case"nil":case"none":return"none";case"dotted":return"dotted";case"dashed":case"dotdash":case"dotdotdash":return"dashed";case"double":case"triple":return"double";default:return"solid"}}(i),widthPx:(a=Number.isFinite(s)?s:0)<=0?0:Math.max(1,Math.round(a/8*(96/72))),color:l}):{style:"none",widthPx:0,color:"#000000"}},a={top:r("top"),right:r("right"),bottom:r("bottom"),left:r("left"),offsetFrom:n};return[a.top,a.right,a.bottom,a.left].some(e=>"none"!==e.style&&e.widthPx>0)?a:null}(e)}}async function nz(e){try{let{unzipSync:t}=await n.e(6951).then(n.bind(n,86951)),r=t(new Uint8Array(e)),a=r["word/document.xml"];if(!a)return null;let i=new TextDecoder().decode(a),s=[...i.matchAll(/<w:sectPr\b[^>]*>[\s\S]*?<\/w:sectPr>/gi)],l=s.length>0?s[s.length-1][0]:null,o=null;if(l)o=nM(l);else{let e=i.match(/<w:sectPr\b[^>]*\/>/i);if(!e)return null;o=nM(e[0])}if(!o)return null;let c=function(e,t){let n=function(e,t){let n=e.match(/<w:background\b[^>]*>[\s\S]*?<\/w:background>/i)?.[0]??e.match(/<w:background\b[^>]*\/>/i)?.[0];if(!n)return{};let r=nr(n.match(/\bw:color="([^"]+)"/i)?.[1]),a=ns(n.match(/\bfillcolor="([^"]+)"/i)?.[1]),i="#000000"!==r||n.includes('w:color="')?r:a??r,s=n.match(/<v:fill\b[^>]*\/?>/i)?.[0],l=null;if(s){let e=function(e){let t=e.match(/\btype="([^"]+)"/i)?.[1]?.toLowerCase(),n=ns(e.match(/\bcolor="([^"]+)"/i)?.[1]),r=ns(e.match(/\bcolor2="([^"]+)"/i)?.[1]);if(!n||!r)return null;let a=e.match(/\bangle="([^"]+)"/i)?.[1],i=a?Number.parseFloat(a):0;return"gradientradial"===t?`radial-gradient(circle, ${n}, ${r})`:"gradient"===t?`linear-gradient(${Number.isFinite(i)?i:0}deg, ${n}, ${r})`:null}(s);e&&(l={gradientCss:e});let n=s.match(/\br:id="([^"]+)"/i)?.[1];if(n){let e,r=ni(t,"word/_rels/document.xml.rels",n);r&&(l={...l??{},fillImage:{src:r,mode:(e=s.match(/\btype="([^"]+)"/i)?.[1]?.toLowerCase(),"tile"===e?"tile":"frame"===e?"frame":"cover")}})}}return{pageColor:"#000000"!==i||n.includes('w:color="')?i:void 0,background:l}}(t,e),r=null;for(let t of Object.keys(e)){let n=t.match(/^word\/(header\d+)\.xml$/);if(!n)continue;let a=n[1],i=`word/_rels/${a}.xml.rels`,s=function(e,t,n){let r=e.match(/<v:shape\b[^>]*>[\s\S]*?<\/v:shape>/i)?.[0];if(!r)return null;let a=r.match(/<v:textpath\b[^>]*\bw:string="([^"]+)"/i)?.[1]??r.match(/<v:textpath\b[^>]*\bstring="([^"]+)"/i)?.[1];if(a&&a.trim()){let e=r.match(/\bstyle="([^"]+)"/i)?.[1],t=r.match(/<v:fill\b[^>]*\/?>/i)?.[0],n=ns(r.match(/\bfillcolor="([^"]+)"/i)?.[1])??ns(t?.match(/\bcolor="([^"]+)"/i)?.[1])??"#b4b4b4";return{kind:"text",text:a.trim(),color:n,opacity:no(t?.match(/\bopacity="([^"]+)"/i)?.[1]),rotationDeg:nl(e)}}let i=r.match(/<v:imagedata\b[^>]*\/?>/i)?.[0],s=i?.match(/\br:id="([^"]+)"/i)?.[1];if(s){let e=ni(t,n,s);if(e)return{kind:"image",src:e,opacity:no(r.match(/<v:fill\b[^>]*\bopacity="([^"]+)"/i)?.[1]),rotationDeg:nl(r.match(/\bstyle="([^"]+)"/i)?.[1])}}return null}(na(e[t]),e,i);if(s){r=s;break}}let a=n.background||r?{...n.background??{},...r?{watermark:r}:{}}:null;return{pageColor:n.pageColor,background:a}}(r,i);return{...o,pageColor:c.pageColor??null,pageBackground:c.background??null}}catch{return null}}function nP(e){return null!=e.headerMarginMm?np(e.headerMarginMm):0}function nI(e){return null!=e.footerMarginMm?np(e.footerMarginMm):0}function nT(e){return Math.max(24,e.marginsPx.top-nP(e))}function nD(e){return Math.max(24,e.marginsPx.bottom-nI(e))}function nL(e,t){return e?.heightMm!=null&&e.heightMm>0?Math.max(t,np(e.heightMm)):t}function nF(e,t,n){let r=e.headerFooterDifferentFirstPage??!1;return"header"===t?0===n&&r?e.headerFirstPage??null:e.header:0===n&&r?e.footerFirstPage??null:e.footer}function nE(e,t,n){return nL(nF(e,t,n),"header"===t?nT(e):nD(e))}function nR(e,t,n){let r=nP(e),a=nE(e,"header",n),i=t+r;return{zoneTop:i,zoneHeight:a,bottomLine:i+a,offset:r}}function nH(e,t,n,r){let a=nI(e),i=nE(e,"footer",r),s=t+n-a;return{zoneTop:s-i,zoneHeight:i,zoneBottom:s,topLine:s-i,offset:a}}var nB=n(43254),n$=n(50290),nO=n(13937),nW=n(39566),n_=n(82222),nq=n(16221),nG=n(1863),nY=n(8348),nU=n(32292),nX=n(74176),nJ=n(52164),nV=n(67873),nK=n(15881),nQ=n(14796);let nZ={single:"solid",dashed:"dashed",dotted:"dotted",double:"double",dotDash:"dashed",dotDotDash:"dotted",none:"none",nil:"none"};function n0(e){if(!e)return null;if("string"==typeof e)return e.trim()||null;let t=nZ[e.style??""]??"solid";if("none"===t)return"none";let n=e.size?Math.max(.25,e.size/8):.75,r=e.color&&"auto"!==e.color?e.color:"#000000";return`${n}pt ${t} ${r}`}function n1(e){let t=[],n="string"==typeof e.backgroundColor&&e.backgroundColor?e.backgroundColor:null;n&&t.push(`background-color: ${n}`);let r="top"===e.verticalAlign||"middle"===e.verticalAlign||"bottom"===e.verticalAlign?e.verticalAlign:null;r&&t.push(`vertical-align: ${r}`);let a=n0(e.borderTop),i=n0(e.borderRight),s=n0(e.borderBottom),l=n0(e.borderLeft);return a&&t.push(`border-top: ${a}`),i&&t.push(`border-right: ${i}`),s&&t.push(`border-bottom: ${s}`),l&&t.push(`border-left: ${l}`),t.length?t.join("; "):void 0}var n2=n(31132),n4=n(58499);class n5{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=e.getMeta(n3);if(t&&null!=t.setHandle)return new n5(t.setHandle,!1);if(t&&void 0!==t.setDragging)return new n5(this.activeHandle,t.setDragging??!1);if(this.activeHandle>-1&&e.docChanged){let t=e.mapping.map(this.activeHandle,-1);return(0,nQ.NH)(e.doc.resolve(t))||(t=-1),new n5(t,this.dragging)}return this}}let n3=new n2.hs("docsTableColumnResizing");function n8(e,t,n,r,a,i){let s=0,l=!0,o=t.firstChild,c=e.firstChild;if(c){for(let e=0,n=0;e<c.childCount;e++){let{colspan:d,colwidth:u}=c.child(e).attrs;for(let e=0;e<d;e++,n++){let c=a===n?i:u&&u[e],d=c?`${c}px`:"";if(s+=c||r,c||(l=!1),o)o.style.width!==d&&(o.style.width=d),o=o.nextSibling;else{let e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}for(;o;){let e=o.nextSibling;o.parentNode?.removeChild(o),o=e}n.style.width="100%",n.style.minWidth=l?"":`${s}px`}}class n6 extends nQ.Qg{constructor(e,t,n){super(e,t),n8(e,this.colgroup,this.table,t)}update(e){return e.type===this.node.type&&(this.node=e,n8(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}}function n9(e,t,n,r){let a=e.posAtCoords({left:t.clientX+("right"===n?-r:r),top:t.clientY});if(!a)return -1;let{pos:i}=a,s=(0,nQ.KW)(e.state.doc.resolve(i));if(!s)return -1;if("right"===n)return s.pos;let l=nQ.J3.get(s.node(-1)),o=s.start(-1),c=l.map.indexOf(s.pos-o);return c%l.width==0?-1:o+l.map[c-1]}function n7(e,t,n,r){let a=(t.clientX-e.startX)/r;return Math.max(n,e.startWidth+a)}function re(e,t){e.dispatch(e.state.tr.setMeta(n3,{setHandle:t}))}function rt(e,t,n,r){let a=e.state.doc.resolve(t),i=a.node(-1),s=a.start(-1),l=nQ.J3.get(i).colCount(a.pos-s)+(a.nodeAfter?.attrs.colspan??1)-1,o=e.domAtPos(a.start(-1)).node;for(;o&&"TABLE"!==o.nodeName;)o=o.parentNode;o&&"TABLE"===o.nodeName&&n8(i,o.firstChild,o,r,l,n)}function rn(e){return{default:null,parseHTML:t=>{let n=function(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}(t.getAttribute(`data-${e}`));if(n)return n;let r=e.replace(/([A-Z])/g,"-$1").toLowerCase();return t.style.getPropertyValue(r)||null},renderHTML:t=>{let n=t[e];return n?{[`data-${e}`]:JSON.stringify(n)}:{}}}}let rr=()=>({backgroundColor:{default:null,parseHTML:e=>e.getAttribute("data-background-color")||e.style.backgroundColor||null,renderHTML:e=>e.backgroundColor?{"data-background-color":String(e.backgroundColor)}:{}},verticalAlign:{default:null,parseHTML:e=>e.getAttribute("data-vertical-align")||e.style.verticalAlign||null,renderHTML:e=>e.verticalAlign?{"data-vertical-align":String(e.verticalAlign)}:{}},borderTop:rn("borderTop"),borderRight:rn("borderRight"),borderBottom:rn("borderBottom"),borderLeft:rn("borderLeft")}),ra=nJ.n.extend({renderHTML({node:e,HTMLAttributes:t}){let n=n1(e.attrs);return["td",(0,nU.KV)(this.options.HTMLAttributes,t,n?{style:n}:{}),0]},addAttributes(){return{...this.parent?.(),...rr()}}}),ri=nV.A.extend({renderHTML({node:e,HTMLAttributes:t}){let n=n1(e.attrs);return["th",(0,nU.KV)(this.options.HTMLAttributes,t,n?{style:n}:{}),0]},addAttributes(){return{...this.parent?.(),...rr()}}}),rs=nK.H.extend({addAttributes(){return{...this.parent?.(),rowHeight:{default:null,parseHTML:e=>e.getAttribute("data-row-height")||e.style.height||null,renderHTML:e=>e.rowHeight?{"data-row-height":String(e.rowHeight)}:{}},rowHeightRule:{default:null,parseHTML:e=>e.getAttribute("data-row-height-rule"),renderHTML:e=>e.rowHeightRule?{"data-row-height-rule":String(e.rowHeightRule)}:{}},header:{default:!1,parseHTML:e=>"true"===e.getAttribute("data-header-row"),renderHTML:e=>e.header?{"data-header-row":"true"}:{}}}},renderHTML({node:e,HTMLAttributes:t}){let n=function(e){let t="string"==typeof e.rowHeight?e.rowHeight:null;if(t)return`height: ${t}`}(e.attrs);return["tr",(0,nU.KV)(this.options.HTMLAttributes,t,n?{style:n}:{}),0]}}),rl=nX.XI.extend({addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[function({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=n6,lastColumnResizable:a=!0}={}){let i=new n2.k_({key:n3,state:{init(e,t){let a=function(e){for(let t of Object.keys(e.schema.nodes))if("table"===e.schema.nodes[t].spec.tableRole)return t;return"table"}(t);return r&&i.spec.props?.nodeViews&&(i.spec.props.nodeViews[a]=(e,t)=>new r(e,n,t)),new n5(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes(e){let t=n3.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){if(!e.editable)return;let a=n3.getState(e.state);if(!a||a.dragging)return;let i=function(e){let t=e;for(;t&&"TD"!==t.nodeName&&"TH"!==t.nodeName;)t=t.classList?.contains("ProseMirror")?null:t.parentNode;return t}(t.target),s=-1;if(i){let{left:r,right:a}=i.getBoundingClientRect();t.clientX-r<=n?s=n9(e,t,"left",n):a-t.clientX<=n&&(s=n9(e,t,"right",n))}if(s!==a.activeHandle){if(!r&&-1!==s){let t=e.state.doc.resolve(s),n=t.node(-1),r=nQ.J3.get(n),a=t.start(-1);if(r.colCount(t.pos-a)+(t.nodeAfter?.attrs.colspan??1)-1==r.width-1)return}re(e,s)}}(t,n,e,a)},mouseleave:e=>{!function(e){if(!e.editable)return;let t=n3.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&re(e,-1)}(e)},mousedown:(e,r)=>(function(e,t,n,r){if(!e.editable)return!1;let a=e.dom.ownerDocument.defaultView??window,i=n3.getState(e.state);if(!i||-1===i.activeHandle||i.dragging)return!1;let s=e.state.doc.nodeAt(i.activeHandle);if(!s)return!1;let l=function(e,t,{colspan:n,colwidth:r}){let a=r&&r[r.length-1];if(a)return a;let i=e.domAtPos(t),s=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let e=0;e<n;e++)r[e]&&(s-=r[e],l--);return s/l}(e,i.activeHandle,{colspan:s.attrs.colspan,colwidth:s.attrs.colwidth}),o=function(e){let t=e.dom.closest("[data-docs-page-stack]");if(!t)return 1;let n=Number.parseFloat(t.getAttribute("data-docs-page-scale")??"1");return Number.isFinite(n)&&n>0?n:1}(e);e.dispatch(e.state.tr.setMeta(n3,{setDragging:{startX:t.clientX,startWidth:l}}));let c=t=>{a.removeEventListener("mouseup",c),a.removeEventListener("mousemove",d);let r=n3.getState(e.state);r?.dragging&&(!function(e,t,n){let r=e.state.doc.resolve(t),a=r.node(-1),i=nQ.J3.get(a),s=r.start(-1),l=i.colCount(r.pos-s)+(r.nodeAfter?.attrs.colspan??1)-1,o=e.state.tr;for(let e=0;e<i.height;e++){let t=e*i.width+l;if(e&&i.map[t]===i.map[t-i.width])continue;let r=i.map[t],c=a.nodeAt(r).attrs,d=1===c.colspan?0:l-i.colCount(r);if(c.colwidth&&c.colwidth[d]===n)continue;let u=c.colwidth?c.colwidth.slice():Array(c.colspan).fill(0);u[d]=n,o.setNodeMarkup(s+r,null,{...c,colwidth:u})}o.docChanged&&e.dispatch(o)}(e,r.activeHandle,n7(r.dragging,t,n,o)),e.dispatch(e.state.tr.setMeta(n3,{setDragging:null})))},d=t=>{if(!t.buttons)return c(t);let a=n3.getState(e.state);a?.dragging&&rt(e,a.activeHandle,n7(a.dragging,t,n,o),r)};return rt(e,i.activeHandle,l,r),a.addEventListener("mouseup",c),a.addEventListener("mousemove",d),t.preventDefault(),!0})(e,r,t,n)},decorations(e){let t=n3.getState(e);if(t&&t.activeHandle>-1)return function(e,t){let n=[],r=e.doc.resolve(t),a=r.node(-1);if(!a)return n4.zF.empty;let i=nQ.J3.get(a),s=r.start(-1),l=i.colCount(r.pos-s)+(r.nodeAfter?.attrs.colspan??1)-1,o=n3.getState(e);for(let e=0;e<i.height;e++){let t=l+e*i.width;if((l===i.width-1||i.map[t]!==i.map[t+1])&&(0===e||i.map[t]!==i.map[t-i.width])){let e=i.map[t],r=s+e+a.nodeAt(e).nodeSize-1,l=document.createElement("div");l.className="column-resize-handle",o?.dragging&&n.push(n4.NZ.node(s+e,s+e+a.nodeAt(e).nodeSize,{class:"column-resize-dragging"})),n.push(n4.NZ.widget(r,l))}}return n4.zF.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return i}({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:n6,lastColumnResizable:this.options.lastColumnResizable})]:[],(0,nQ.LF)({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addAttributes:()=>({alignment:{default:null,parseHTML:e=>e.getAttribute("data-alignment"),renderHTML:e=>e.alignment?{"data-alignment":String(e.alignment)}:{}},layout:{default:null,parseHTML:e=>e.getAttribute("data-layout"),renderHTML:e=>e.layout?{"data-layout":String(e.layout)}:{}},cellSpacing:{default:null,parseHTML:e=>{let t=e.getAttribute("data-cell-spacing");return t?Number(t):null},renderHTML:e=>null==e.cellSpacing?{}:{"data-cell-spacing":String(e.cellSpacing)}}}),renderHTML({node:e,HTMLAttributes:t}){let n=function(e){let t=[],n="left"===e.alignment||"center"===e.alignment||"right"===e.alignment?e.alignment:null;"center"===n?t.push("margin-left: auto","margin-right: auto"):"right"===n?t.push("margin-left: auto","margin-right: 0"):"left"===n&&t.push("margin-left: 0","margin-right: auto"),"fixed"===e.layout&&t.push("table-layout: fixed");let r="number"==typeof e.cellSpacing?e.cellSpacing:null;if(r&&r>0){let e=Math.round(r/20*96/72);t.push(`border-spacing: ${e}px`)}return t.length?t.join("; "):void 0}(e.attrs);return["table",(0,nU.KV)(this.options.HTMLAttributes,t,n?{style:n}:{}),0]}}),ro={resizable:!0,renderWrapper:!0,cellMinWidth:48,handleWidth:6,lastColumnResizable:!0,allowTableNodeSelection:!0,HTMLAttributes:{class:"docs-table"}};var rc=n(28246),rd=n(32657);function ru(e){e.commands.focus(),e.view.focus()}async function rh(e){if(e)try{let t=await navigator.clipboard.readText();e.chain().focus().deleteSelection().insertContent(t).run()}catch{c.oR.error("Impossible de coller le texte")}}function rm(e){c.oR.info("Rechercher et remplacer — bient\xf4t disponible")}let rp=new n2.hs("docsEditorShortcuts"),rg=nU.YY.create({name:"docsEditorShortcuts",addProseMirrorPlugins(){let e=this.editor;return[new n2.k_({key:rp,props:{handleKeyDown:(t,n)=>{let r=ec.getState().matchEvent(n,e=>"editor"===e.scope&&"custom"===e.handler);return!!r&&!!function(e,t){switch(e){case"edit.redo":return t.commands.redo();case"edit.pastePlain":return rh(t),!0;case"edit.findReplace":return rm(t),!0;default:return!1}}(r,e)&&(n.preventDefault(),!0)}}})]}});var rf=n(86669),rx=n(19321),rb=n(79535);let ry=["nw","n","ne","e","se","s","sw","w"],rj=[0,3,6,12];var rv=n(46002),rw=n(95528);let rN=["nw","n","ne","e","se","s","sw","w"],rk={nw:"docs-crop-handle--corner docs-crop-handle--nw cursor-nwse-resize",n:"docs-crop-handle--edge docs-crop-handle--n cursor-ns-resize",ne:"docs-crop-handle--corner docs-crop-handle--ne cursor-nesw-resize",e:"docs-crop-handle--edge docs-crop-handle--e cursor-ew-resize",se:"docs-crop-handle--corner docs-crop-handle--se cursor-nwse-resize",s:"docs-crop-handle--edge docs-crop-handle--s cursor-ns-resize",sw:"docs-crop-handle--corner docs-crop-handle--sw cursor-nesw-resize",w:"docs-crop-handle--edge docs-crop-handle--w cursor-ew-resize"};function rC(e,t){return`${e/Math.max(t,1)*100}%`}function rS({attrs:e,cropEditBase:t,frameWidth:n,frameHeight:i,imageNaturalWidth:s,imageNaturalHeight:l,onChange:o,onDone:c}){let d=(0,a.useRef)(null),{windowRect:u,cropRect:h}=(0,rb.kq)(e,n,i,s,l,t),m=(0,a.useRef)(null),p=(0,a.useCallback)(()=>{let e=d.current?.getBoundingClientRect();return e&&u.width>0?e.width/u.width:1},[u.width]),g=(0,a.useCallback)((t,n)=>{n.preventDefault(),n.stopPropagation(),n.currentTarget.setPointerCapture(n.pointerId),m.current={handle:t,startX:n.clientX,startY:n.clientY,origin:{cropX:e.cropX,cropY:e.cropY,cropWidth:e.cropWidth,cropHeight:e.cropHeight}}},[e.cropHeight,e.cropWidth,e.cropX,e.cropY]);(0,a.useEffect)(()=>{let e=e=>{if(!m.current)return;let{handle:t,startX:n,startY:r,origin:a}=m.current,i=p(),s=(e.clientX-n)/i,l=(e.clientY-r)/i,c=s/Math.max(u.width,1),d=l/Math.max(u.height,1);o((0,rb.h7)(t,a,c,d))},t=()=>{m.current=null};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[o,p,u.height,u.width]),(0,a.useEffect)(()=>{let e=e=>{("Escape"===e.key||"Enter"===e.key)&&(e.preventDefault(),c())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[c]);let f=h.left-u.left,x=h.top-u.top,b=rC(h.width,u.width),y=rC(h.height,u.height),j=rC(f,u.width),w=rC(x,u.height),N=u.width-(f+h.width),k=u.height-(x+h.height);return(0,r.jsxs)("div",{ref:d,className:"docs-graphic-crop pointer-events-none absolute z-30","aria-label":"Recadrage",style:{left:u.left,top:u.top,width:u.width,height:u.height},onDoubleClick:e=>{e.preventDefault(),e.stopPropagation(),c()},children:[x>0?(0,r.jsx)("div",{className:"pointer-events-none absolute left-0 top-0 bg-black/40",style:{width:"100%",height:rC(x,u.height)}}):null,k>0?(0,r.jsx)("div",{className:"pointer-events-none absolute bottom-0 left-0 bg-black/40",style:{width:"100%",height:rC(k,u.height)}}):null,f>0?(0,r.jsx)("div",{className:"pointer-events-none absolute bg-black/40",style:{left:0,top:w,width:rC(f,u.width),height:y}}):null,N>0?(0,r.jsx)("div",{className:"pointer-events-none absolute bg-black/40",style:{right:0,top:w,width:rC(N,u.width),height:y}}):null,(0,r.jsxs)("div",{className:(0,v.cn)("docs-crop-region pointer-events-none absolute","ellipse"===e.cropShape&&"rounded-full"),style:{left:j,top:w,width:b,height:y},children:[(0,r.jsx)("div",{className:"docs-crop-region__frame pointer-events-none absolute inset-0 border border-dashed border-white/95 shadow-[0_0_0_1px_rgba(0,0,0,0.45)]","aria-hidden":!0}),rN.map(e=>(0,r.jsx)("span",{role:"presentation",className:(0,v.cn)("docs-crop-handle pointer-events-auto absolute z-40",rk[e]),onPointerDown:t=>g(e,t)},e))]})]})}let rA="ultidocs:graphic-crop-start",rM="ultidocs:graphic-crop-apply",rz="ultidocs:graphic-crop-changed";function rP(){window.dispatchEvent(new CustomEvent(rA))}var rI=n(37841),rT=n(7811);let rD="ultidocs:graphic-draw-open";function rL(){window.dispatchEvent(new CustomEvent(rD))}function rF(e){let t=rE(e??null);t?.drawDriveFileId?window.open((0,rT.AW)(t.drawDriveFileId),"_blank","noopener,noreferrer"):rL()}function rE(e){return e?e.isActive("docsGraphic")?(0,rb.Oy)(e.getAttributes("docsGraphic")):e.isActive("docsInlineGraphic")?(0,rb.Oy)(e.getAttributes("docsInlineGraphic")):null:null}function rR({editor:e,children:t,onCrop:n,onOpenOptions:a,onReplaceImage:i}){if(!(e.isActive("docsGraphic")||e.isActive("docsInlineGraphic")))return(0,r.jsx)(r.Fragment,{children:t});let s=e.isActive("docsInlineGraphic")?"docsInlineGraphic":"docsGraphic",l=(0,rb.Oy)(e.getAttributes(s)),o="image"===l.graphicType;return(0,r.jsxs)(rI.tz,{children:[(0,r.jsx)(rI.Rc,{asChild:!0,children:t}),(0,r.jsxs)(rI.Ip,{className:"min-w-52",onCloseAutoFocus:e=>e.preventDefault(),children:[(0,r.jsx)(rI.kt,{onClick:()=>document.execCommand("cut"),children:"Couper"}),(0,r.jsx)(rI.kt,{onClick:()=>document.execCommand("copy"),children:"Copier"}),(0,r.jsx)(rI.kt,{onClick:()=>document.execCommand("paste"),children:"Coller"}),(0,r.jsx)(rI.kt,{onClick:()=>e.chain().focus().deleteSelection().run(),children:"Supprimer"}),(0,r.jsx)(rI.K5,{}),o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(rI.kt,{onClick:i,children:"Remplacer l'image…"}),(0,r.jsx)(rI.kt,{onClick:n,children:"Recadrer"}),(0,r.jsx)(rI.kt,{onClick:a,children:"Options image…"}),(0,r.jsx)(rI.kt,{onClick:()=>{let t=window.prompt("Texte alternatif",l.alt);null!=t&&e.chain().focus().updateDocsGraphic({alt:t}).run()},children:"Texte alternatif…"}),(0,r.jsx)(rI.kt,{onClick:()=>{if(!l.src)return;let e=document.createElement("a");e.href=l.src,e.download="image",e.click()},disabled:!l.src,children:"T\xe9l\xe9charger l'image"})]}):"draw"===l.graphicType?(0,r.jsx)(rI.kt,{onClick:()=>rF(e),children:"Modifier le dessin…"}):"shape"===l.graphicType?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(rI.kt,{onClick:()=>{let t=window.prompt("Couleur de remplissage",l.fill);t&&e.chain().focus().updateDocsGraphic({fill:t}).run()},children:"Modifier le remplissage…"}),(0,r.jsx)(rI.kt,{onClick:()=>{let t=window.prompt("Couleur du contour",l.stroke);t&&e.chain().focus().updateDocsGraphic({stroke:t}).run()},children:"Modifier le contour…"})]}):null,(0,r.jsx)(rI.K5,{}),(0,r.jsxs)(rI.Fj,{children:[(0,r.jsx)(rI.Pd,{children:"Habillage texte"}),(0,r.jsx)(rI.es,{onCloseAutoFocus:e=>e.preventDefault(),children:Object.keys(rb.mC).map(t=>(0,r.jsx)(rI.kt,{onClick:()=>{e.chain().setDocsGraphicWrap(t).run()},children:rb.mC[t]},t))})]}),(0,r.jsx)(rI.K5,{}),(0,r.jsx)(rI.kt,{onClick:()=>e.chain().focus().bringDocsGraphicForward().run(),children:"Avancer"}),(0,r.jsx)(rI.kt,{onClick:()=>e.chain().focus().sendDocsGraphicBackward().run(),children:"Reculer"})]})]})}var rH=n(12551),rB=n(30925),r$=n(10303);function rO({className:e,defaultValue:t,value:n,min:i=0,max:s=100,...l}){let o=a.useMemo(()=>Array.isArray(n)?n:Array.isArray(t)?t:[i,s],[n,t,i,s]);return(0,r.jsxs)(r$.bL,{"data-slot":"slider",defaultValue:t,value:n,min:i,max:s,className:(0,v.cn)("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",e),...l,children:[(0,r.jsx)(r$.CC,{"data-slot":"slider-track",className:"bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5",children:(0,r.jsx)(r$.Q6,{"data-slot":"slider-range",className:"bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"})}),Array.from({length:o.length},(e,t)=>(0,r.jsx)(r$.zi,{"data-slot":"slider-thumb",className:"border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},t))]})}var rW=n(84956),r_=n(39325);function rq({...e}){return(0,r.jsx)(r_.bL,{"data-slot":"accordion",...e})}function rG({className:e,...t}){return(0,r.jsx)(r_.q7,{"data-slot":"accordion-item",className:(0,v.cn)("border-b last:border-b-0",e),...t})}function rY({className:e,children:t,...n}){return(0,r.jsx)(r_.Y9,{className:"flex",children:(0,r.jsxs)(r_.l9,{"data-slot":"accordion-trigger",className:(0,v.cn)("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,(0,r.jsx)(nt.A,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"})]})})}function rU({className:e,children:t,...n}){return(0,r.jsx)(r_.UC,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...n,children:(0,r.jsx)("div",{className:(0,v.cn)("pt-0 pb-4",e),children:t})})}let rX={inline:"material-symbols:text-fields",square:"material-symbols:wrap-text",tight:"material-symbols:wrap-text",through:"material-symbols:wrap-text","top-bottom":"material-symbols:vertical-align-center",behind:"material-symbols:layers-clear","in-front":"material-symbols:layers"},rJ={left:"material-symbols:format-align-left",center:"material-symbols:format-align-center",right:"material-symbols:format-align-right"},rV={left:"Gauche",center:"Centre",right:"Droite"},rK=[{wrap:"top-bottom",label:"Retour \xe0 la ligne"},{wrap:"square",label:"Intercaler le texte"},{wrap:"inline",label:"En ligne avec le texte"}],rQ=[{wrap:"behind",label:"Derri\xe8re le texte"},{wrap:"in-front",label:"Devant le texte"}],rZ=[{wrap:"tight",label:"Rapproch\xe9"},{wrap:"through",label:"\xc0 travers"}],r0={inline:"En ligne",square:"Intercaler",tight:"Rapproch\xe9",through:"\xc0 travers","top-bottom":"Retour ligne",behind:"Derri\xe8re","in-front":"Devant"},r1={"move-with-text":"Avec le texte","fixed-on-page":"Fixe sur la page"},r2={"move-with-text":"L'image se d\xe9place quand vous modifiez le texte.","fixed-on-page":"L'image reste \xe0 la m\xeame place sur la page."};function r4({children:e,className:t}){return(0,r.jsx)("div",{className:(0,v.cn)("docs-graphic-layout-preview relative overflow-hidden rounded border border-muted-foreground/25 bg-background",t),"aria-hidden":!0,children:e})}function r5({count:e=3,className:t,inset:n}){return(0,r.jsx)("div",{className:(0,v.cn)("flex flex-col gap-[3px]",n,t),children:Array.from({length:e}).map((t,n)=>(0,r.jsx)("span",{className:"block h-[3px] rounded-full bg-muted-foreground/35",style:{width:n===e-1?"72%":"100%"}},n))})}function r3({className:e}){return(0,r.jsx)("span",{className:(0,v.cn)("block shrink-0 rounded-[2px] border border-primary/50 bg-primary/25",e)})}function r8({wrap:e}){switch(e){case"inline":return(0,r.jsxs)(r4,{className:"flex h-11 items-center gap-1 px-1.5",children:[(0,r.jsx)(r5,{count:1,className:"w-[22%]"}),(0,r.jsx)(r3,{className:"size-4"}),(0,r.jsx)(r5,{count:1,className:"flex-1"})]});case"square":return(0,r.jsxs)(r4,{className:"flex h-11 gap-1.5 p-1.5",children:[(0,r.jsx)(r3,{className:"h-full w-[34%]"}),(0,r.jsx)(r5,{count:3,className:"flex-1 pt-0.5"})]});case"tight":return(0,r.jsxs)(r4,{className:"flex h-11 gap-0.5 p-1",children:[(0,r.jsx)(r3,{className:"h-full w-[30%]"}),(0,r.jsx)(r5,{count:4,className:"flex-1 gap-[2px] pt-0"})]});case"through":return(0,r.jsxs)(r4,{className:"h-11 p-1.5",children:[(0,r.jsx)(r3,{className:"absolute inset-1.5 opacity-45"}),(0,r.jsx)(r5,{count:3,className:"relative z-10 h-full justify-center"})]});case"top-bottom":return(0,r.jsxs)(r4,{className:"flex h-11 flex-col gap-1 p-1.5",children:[(0,r.jsx)(r3,{className:"h-[42%] w-full"}),(0,r.jsx)(r5,{count:2,className:"flex-1"})]});case"behind":return(0,r.jsxs)(r4,{className:"h-11 p-1.5",children:[(0,r.jsx)(r3,{className:"absolute inset-1.5 opacity-35"}),(0,r.jsx)(r5,{count:3,className:"relative z-10 h-full justify-center"})]});case"in-front":return(0,r.jsxs)(r4,{className:"h-11 p-1.5",children:[(0,r.jsx)(r5,{count:3,className:"absolute inset-x-1.5 top-2"}),(0,r.jsx)(r3,{className:"absolute bottom-1.5 left-1/2 z-10 h-[52%] w-[46%] -translate-x-1/2 opacity-90"})]});default:return(0,r.jsx)(r4,{className:"h-11"})}}function r6({mode:e}){return"move-with-text"===e?(0,r.jsxs)(r4,{className:"flex h-11 flex-col justify-center gap-1 p-1.5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(r5,{count:1,className:"w-[28%]"}),(0,r.jsx)(r3,{className:"size-4"}),(0,r.jsx)(r5,{count:1,className:"flex-1"})]}),(0,r.jsx)(r5,{count:1,className:"w-full"}),(0,r.jsx)(r5,{count:1,className:"w-[80%]"})]}):(0,r.jsxs)(r4,{className:"h-11 p-1",children:[(0,r.jsx)("span",{className:"absolute inset-1 rounded border border-dashed border-muted-foreground/30"}),(0,r.jsx)(r3,{className:"absolute right-2 top-2 h-[38%] w-[32%]"}),(0,r.jsx)(r5,{count:2,className:"absolute bottom-2 left-2 right-2"})]})}function r9({mm:e}){return(0,r.jsx)(r4,{className:"flex h-11 items-start gap-0 p-1.5",children:(0,r.jsxs)("div",{className:"flex h-full items-start",style:{gap:`${0===e?1:e<=3?3:e<=6?5:8}px`},children:[(0,r.jsx)(r3,{className:"h-[70%] w-[38%]"}),(0,r.jsx)(r5,{count:3,className:"w-[52%] pt-0.5"})]})})}function r7({h:e,v:t,active:n}){return(0,r.jsx)("span",{className:(0,v.cn)("flex size-9 rounded-md border p-1",n?"border-primary bg-primary/5":"border-border bg-background hover:border-muted-foreground/50"),children:(0,r.jsx)("span",{className:(0,v.cn)("relative flex size-full rounded-[2px] border border-muted-foreground/30",0===e&&"justify-start",.5===e&&"justify-center",1===e&&"justify-end",0===t&&"items-start",.5===t&&"items-center",1===t&&"items-end"),children:(0,r.jsx)("span",{className:"size-2 rounded-[1px] bg-primary/70"})})})}let ae="ultidocs:graphic-options-open";function at(e){window.dispatchEvent(new CustomEvent(ae,{detail:{section:e}}))}let an=["inline","square","tight","through","top-bottom"],ar=["behind","in-front"];function aa(e){return"move-with-text"===e?an:ar}let ai=[{id:"tl",label:"En haut \xe0 gauche",h:0,v:0},{id:"tc",label:"En haut au centre",h:.5,v:0},{id:"tr",label:"En haut \xe0 droite",h:1,v:0},{id:"ml",label:"Au milieu \xe0 gauche",h:0,v:.5},{id:"mc",label:"Au centre",h:.5,v:.5},{id:"mr",label:"Au milieu \xe0 droite",h:1,v:.5},{id:"bl",label:"En bas \xe0 gauche",h:0,v:1},{id:"bc",label:"En bas au centre",h:.5,v:1},{id:"br",label:"En bas \xe0 droite",h:1,v:1}],as=[{angle:0,label:"→",title:"Gauche \xe0 droite"},{angle:90,label:"↓",title:"Haut vers le bas"},{angle:180,label:"←",title:"Droite \xe0 gauche"},{angle:270,label:"↑",title:"Bas vers le haut"}];function al(e,t){let n=10**t;return Math.round(e*n)/n}function ao({label:e,value:t,unit:n,step:i=.01,min:s,max:l,decimals:o=2,onCommit:c,disabled:d,showSteppers:u=!0}){let h=String(al(t,o)),[m,p]=(0,a.useState)(h),[g,f]=(0,a.useState)(!1);(0,a.useEffect)(()=>{g||p(h)},[h,g]);let x=e=>{let t=e;return null!=s&&(t=Math.max(s,t)),null!=l&&(t=Math.min(l,t)),t},y=()=>{let e=Number.parseFloat(m.replace(",","."));if(!Number.isFinite(e))return void p(h);let t=x(e);c(t),p(String(al(t,o)))},j=e=>{let n=x(t+e);c(n),p(String(al(n,o)))},v=e=>{e.preventDefault()};return(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e," ",(0,r.jsxs)("span",{className:"text-[10px]",children:["(",n,")"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[u?(0,r.jsx)(b.$,{type:"button",variant:"outline",size:"icon",className:"docs-graphic-options-stepper size-8 shrink-0",disabled:d,"aria-label":`Diminuer ${e}`,onPointerDown:v,onClick:()=>j(-i),children:(0,r.jsx)(tF.A,{className:"size-3.5"})}):null,(0,r.jsx)(tn.p,{type:"text",inputMode:"decimal",value:m,disabled:d,className:"docs-graphic-options-number-input h-8 min-w-0 flex-1 px-1 text-center text-sm tabular-nums",onFocus:()=>f(!0),onChange:e=>p(e.target.value),onBlur:()=>{f(!1),y()},onKeyDown:e=>{if("Enter"===e.key){e.preventDefault(),y();return}if("ArrowUp"===e.key){e.preventDefault(),j(e.shiftKey?10*i:i);return}"ArrowDown"===e.key&&(e.preventDefault(),j(e.shiftKey?-(10*i):-i))}}),u?(0,r.jsx)(b.$,{type:"button",variant:"outline",size:"icon",className:"docs-graphic-options-stepper size-8 shrink-0",disabled:d,"aria-label":`Augmenter ${e}`,onPointerDown:v,onClick:()=>j(i),children:(0,r.jsx)(tz.A,{className:"size-3.5"})}):null]})]})}function ac({label:e,value:t,min:n,max:a,onChange:i}){return(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e}),(0,r.jsx)("span",{className:"text-xs tabular-nums text-muted-foreground",children:t})]}),(0,r.jsx)(rO,{value:[t],min:n,max:a,step:1,onValueChange:e=>i(e[0]??t)})]})}let ad=(0,a.memo)(function({editor:e,pageLayout:t,open:n,focusSection:i,onClose:s}){let[,l]=(0,a.useState)(0),o=(0,a.useRef)(null),[c,d]=(0,a.useState)(["size","position","wrap","margin"]),u=(0,a.useCallback)(()=>l(e=>e+1),[]);(0,a.useEffect)(()=>{n&&i&&(d(e=>e.includes(i)?e:[...e,i]),requestAnimationFrame(()=>{document.querySelector(`[data-graphic-section="${i}"]`)?.scrollIntoView({block:"nearest",behavior:"smooth"})}))},[i,n]),(0,a.useEffect)(()=>{if(e)return e.on("selectionUpdate",u),e.on("transaction",u),()=>{e.off("selectionUpdate",u),e.off("transaction",u)}},[e,u]);let h=function(e){if(!e)return null;let t=e.isActive("docsInlineGraphic")?"docsInlineGraphic":e.isActive("docsGraphic")?"docsGraphic":null;return t?(0,rb.Oy)(e.getAttributes(t)):null}(e),m=h?.graphicType==="image",p=h?.graphicType==="gradient";(0,a.useEffect)(()=>{n&&p&&d(e=>e.includes("gradient")?e:[...e,"gradient"])},[n,p]),(0,a.useEffect)(()=>{if(!e)return;let{selection:t}=e.state;if(!(t instanceof n2.nh))return;let n=t.node;("docsGraphic"===n.type.name||"docsInlineGraphic"===n.type.name)&&(o.current=t.from)},[e,h]);let g=(0,a.useMemo)(()=>{let e;return n&&m&&(e=document.querySelector(".docs-graphic--selected img, .ProseMirror-selectednode .docs-graphic img"))&&e.naturalWidth&&e.naturalHeight?{width:e.naturalWidth,height:e.naturalHeight}:null},[n,m,h?.src]);if(!n)return null;let f=t=>{e&&t()},x=t=>{if(!e)return;let n=e.chain(),r=o.current;null!=r&&n.setNodeSelection(r),n.updateDocsGraphic(t).run()},y=e=>{if(!h)return;let t=e.gradientType??h.gradientType,n=e.gradientAngle??h.gradientAngle,r=e.gradientColor1??h.gradientColor1,a=e.gradientColor2??h.gradientColor2;x({...e,gradientCss:(0,rb.if)(n,r,a,t)})},j=h?.lockAspectRatio!==!1;return(0,r.jsxs)("aside",{className:"docs-graphic-options-sidebar flex h-full shrink-0 flex-col border-l border-border bg-background",style:{width:320},"aria-label":"Options du graphique",onMouseDownCapture:e=>{e.target.closest("input, textarea, button, [role=slider]")||e.preventDefault()},children:[(0,r.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2.5",children:[(0,r.jsx)("h2",{className:"text-sm font-medium",children:m?"Options de l'image":p?"Options du d\xe9grad\xe9":"Options du graphique"}),(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"size-7","aria-label":"Fermer",onClick:s,children:(0,r.jsx)(rH.A,{className:"size-4"})})]}),h?(0,r.jsx)("div",{className:"docs-graphic-options-sidebar__scroll min-h-0 flex-1 overflow-y-auto",children:(0,r.jsxs)(rq,{type:"multiple",value:c,onValueChange:d,className:"px-1",children:[(0,r.jsxs)(rG,{value:"size","data-graphic-section":"size",children:[(0,r.jsx)(rY,{className:"px-3 py-3 text-sm",children:"Taille et rotation"}),(0,r.jsxs)(rU,{className:"flex flex-col gap-3 px-3",children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(ao,{label:"Largeur",unit:"cm",value:ng(h.width)/10,min:.2,step:.1,onCommit:e=>{if(!h)return;let t=Math.max(8,np(10*e)),n={width:t};j&&h.width>0&&(n.height=Math.max(8,h.height*(t/h.width))),x(n)}}),(0,r.jsx)(ao,{label:"Hauteur",unit:"cm",value:ng(h.height)/10,min:.2,step:.1,onCommit:e=>{if(!h)return;let t=Math.max(8,np(10*e)),n={height:t};j&&h.height>0&&(n.width=Math.max(8,h.width*(t/h.height))),x(n)}})]}),g?(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(ao,{label:"\xc9chelle de largeur",unit:"%",value:h.width/g.width*100,min:1,decimals:0,step:1,onCommit:e=>{if(!h||!g)return;let t={width:Math.max(8,g.width*e/100)};j&&(t.height=Math.max(8,g.height*e/100)),x(t)}}),(0,r.jsx)(ao,{label:"\xc9chelle de hauteur",unit:"%",value:h.height/g.height*100,min:1,decimals:0,step:1,onCommit:e=>{if(!h||!g)return;let t={height:Math.max(8,g.height*e/100)};j&&(t.width=Math.max(8,g.width*e/100)),x(t)}})]}):null,(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)(rB.S,{checked:j,onCheckedChange:e=>x({lockAspectRatio:!0===e})}),"Verrouiller le format"]}),m?(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Ajustement dans le cadre"}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:[{fit:"contain",label:"Contenir"},{fit:"cover",label:"Remplir"},{fit:"crop",label:"Recadrer"}].map(({fit:t,label:n})=>(0,r.jsx)("button",{type:"button",className:(0,v.cn)("rounded-md border px-2 py-1.5 text-xs font-medium",h.imageFit===t?"border-primary bg-primary/5 text-primary":"border-border hover:border-muted-foreground/40 hover:bg-accent/30"),onClick:()=>{"crop"===t?f(()=>{e.chain().updateDocsGraphic({imageFit:"crop"}).run(),rP()}):x({imageFit:t})},children:n},t))}),"crop"===h.imageFit?(0,r.jsx)(b.$,{type:"button",variant:"outline",size:"sm",className:"h-8 w-full text-xs",onClick:()=>f(()=>rP()),children:"Ajuster le recadrage"}):null,"cover"===h.imageFit?(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Point focal"}),(0,r.jsx)("div",{className:"grid w-fit grid-cols-3 gap-1.5",children:ai.map(e=>(0,r.jsx)("button",{type:"button",className:"rounded-md","aria-label":e.label,title:e.label,onClick:()=>x({imageFitAnchorH:e.h,imageFitAnchorV:e.v}),children:(0,r.jsx)(r7,{h:e.h,v:e.v,active:h.imageFitAnchorH===e.h&&h.imageFitAnchorV===e.v})},e.id))})]}):null]}):null,(0,r.jsxs)("div",{className:"flex items-end gap-2",children:[(0,r.jsx)(ao,{label:"Angle de rotation",unit:"\xb0",value:h.rotationDeg,decimals:0,step:1,onCommit:e=>x({rotationDeg:(e%360+360)%360})}),(0,r.jsxs)(b.$,{type:"button",variant:"outline",size:"sm",className:"h-8 shrink-0 gap-1.5",onClick:()=>x({rotationDeg:(h.rotationDeg+90)%360}),children:[(0,r.jsx)(eR.In,{icon:"material-symbols:rotate-90-degrees-cw-outline",className:"size-4"}),"90\xb0"]})]})]})]}),p?(0,r.jsxs)(rG,{value:"gradient","data-graphic-section":"gradient",children:[(0,r.jsx)(rY,{className:"px-3 py-3 text-sm",children:"D\xe9grad\xe9"}),(0,r.jsxs)(rU,{className:"flex flex-col gap-3 px-3",children:[(0,r.jsx)("div",{className:"h-16 w-full rounded-md border border-border",style:{background:h.gradientCss},"aria-hidden":!0}),(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Type"}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-2",children:[{type:"linear",label:"Lin\xe9aire"},{type:"radial",label:"Radial"}].map(({type:e,label:t})=>(0,r.jsx)("button",{type:"button",className:(0,v.cn)("rounded-md border px-2 py-1.5 text-xs font-medium",h.gradientType===e?"border-primary bg-primary/5 text-primary":"border-border hover:border-muted-foreground/40 hover:bg-accent/30"),onClick:()=>y({gradientType:e}),children:t},e))})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,r.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Couleur 1"}),(0,r.jsx)(tn.p,{type:"color",className:"h-9 cursor-pointer p-1",value:h.gradientColor1,onChange:e=>y({gradientColor1:e.target.value})})]}),(0,r.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Couleur 2"}),(0,r.jsx)(tn.p,{type:"color",className:"h-9 cursor-pointer p-1",value:h.gradientColor2,onChange:e=>y({gradientColor2:e.target.value})})]})]}),"linear"===h.gradientType?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Orientation"}),(0,r.jsx)("div",{className:"grid grid-cols-4 gap-1.5",children:as.map(({angle:e,label:t,title:n})=>(0,r.jsx)("button",{type:"button",className:(0,v.cn)("rounded-md border px-2 py-1.5 text-sm font-medium",h.gradientAngle===e?"border-primary bg-primary/5 text-primary":"border-border hover:border-muted-foreground/40 hover:bg-accent/30"),"aria-label":n,title:n,onClick:()=>y({gradientAngle:e}),children:t},e))})]}),(0,r.jsx)(ao,{label:"Angle",unit:"\xb0",value:h.gradientAngle,decimals:0,step:1,min:0,max:360,onCommit:e=>y({gradientAngle:(e%360+360)%360})})]}):(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Le d\xe9grad\xe9 radial part du centre vers les bords."})]})]}):null,(0,r.jsxs)(rG,{value:"position","data-graphic-section":"position",children:[(0,r.jsx)(rY,{className:"px-3 py-3 text-sm",children:"Position"}),(0,r.jsxs)(rU,{className:"flex flex-col gap-3 px-3",children:[(0,r.jsx)("div",{className:"flex flex-col gap-2",children:["move-with-text","fixed-on-page"].map(t=>(0,r.jsxs)("button",{type:"button",className:(0,v.cn)("docs-graphic-option-card flex w-full flex-col gap-2 rounded-lg border p-2 text-left",h.positionMode===t?"border-primary bg-primary/5 ring-1 ring-primary/30":"border-border hover:border-muted-foreground/40 hover:bg-accent/30"),onClick:()=>f(()=>e.chain().setDocsGraphicPositionMode(t).run()),children:[(0,r.jsx)(r6,{mode:t}),(0,r.jsx)("span",{className:"text-sm font-medium",children:r1[t]}),(0,r.jsx)("span",{className:"text-xs leading-snug text-muted-foreground",children:r2[t]})]},t))}),"fixed-on-page"===h.positionMode?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Placer l'image sur la page"}),(0,r.jsx)("div",{className:"grid w-fit grid-cols-3 gap-1.5",children:ai.map(e=>(0,r.jsx)("button",{type:"button",className:"rounded-md","aria-label":e.label,title:e.label,onClick:()=>((e,n)=>{if(!h)return;let r=t.marginsPx,a=t.widthPx-r.left-r.right,i=t.heightPx-r.top-r.bottom;x({positionMode:"fixed-on-page",pageX:r.left+(a-h.width)*e,pageY:r.top+(i-h.height)*n})})(e.h,e.v),children:(0,r.jsx)(r7,{h:e.h,v:e.v})},e.id))})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(ao,{label:"X",unit:"cm",value:ng(h.pageX)/10,step:.1,onCommit:e=>x({pageX:np(10*e)})}),(0,r.jsx)(ao,{label:"Y",unit:"cm",value:ng(h.pageY)/10,step:.1,onCommit:e=>x({pageY:np(10*e)})})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Distance depuis l'angle sup\xe9rieur gauche de la page."})]}):null]})]}),aa(h.positionMode).length>0?(0,r.jsxs)(rG,{value:"wrap","data-graphic-section":"wrap",children:[(0,r.jsx)(rY,{className:"px-3 py-3 text-sm",children:"move-with-text"===h.positionMode?"Habillage du texte":"Calque par rapport au texte"}),(0,r.jsx)(rU,{className:"px-3",children:(0,r.jsx)("div",{className:"grid grid-cols-2 gap-2",children:aa(h.positionMode).map(t=>(0,r.jsxs)("button",{type:"button",className:(0,v.cn)("docs-graphic-option-card flex flex-col gap-1.5 rounded-lg border p-2 text-left",h.wrap===t?"border-primary bg-primary/5 ring-1 ring-primary/30":"border-border hover:border-muted-foreground/40 hover:bg-accent/30"),"aria-label":rb.mC[t],title:rb.mC[t],onClick:()=>f(()=>e.chain().setDocsGraphicWrap(t).run()),children:[(0,r.jsx)(r8,{wrap:t}),(0,r.jsx)("span",{className:"text-xs font-medium leading-tight",children:r0[t]})]},t))})})]}):null,(0,r.jsxs)(rG,{value:"margin","data-graphic-section":"margin",children:[(0,r.jsx)(rY,{className:"px-3 py-3 text-sm",children:"Marges par rapport au texte"}),(0,r.jsxs)(rU,{className:"flex flex-col gap-2 px-3",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Espace entre l'image et le texte qui l'entoure."}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-2",children:rj.map(t=>(0,r.jsxs)("button",{type:"button",className:(0,v.cn)("docs-graphic-option-card flex flex-col gap-2 rounded-lg border p-2 text-left",h.wrapMarginMm===t?"border-primary bg-primary/5 ring-1 ring-primary/30":"border-border hover:border-muted-foreground/40 hover:bg-accent/30"),onClick:()=>f(()=>e.chain().setDocsGraphicWrapMargin(t).run()),children:[(0,r.jsx)(r9,{mm:t}),(0,r.jsxs)("span",{className:"text-sm font-medium",children:["Marge de ",t," mm"]})]},t))})]})]}),m?(0,r.jsxs)(rG,{value:"recolor","data-graphic-section":"recolor",children:[(0,r.jsx)(rY,{className:"px-3 py-3 text-sm",children:"Recolorier"}),(0,r.jsx)(rU,{className:"px-3",children:(0,r.jsx)("div",{className:"grid grid-cols-4 gap-1.5",children:rb.R.map(e=>(0,r.jsx)("button",{type:"button",className:(0,v.cn)("h-12 overflow-hidden rounded-md border",h.recolor===e.id?"border-primary ring-2 ring-primary/40":"border-border hover:border-muted-foreground/60"),"aria-label":e.label,title:e.label,onClick:()=>x({recolor:e.id}),children:h.src?(0,r.jsx)("img",{src:h.src,alt:"",className:"h-full w-full object-cover",style:{filter:e.filter||void 0}}):(0,r.jsx)("span",{className:"block h-full w-full bg-muted"})},e.id||"none"))})})]}):null,(0,r.jsxs)(rG,{value:"adjust","data-graphic-section":"adjust",children:[(0,r.jsx)(rY,{className:"px-3 py-3 text-sm",children:"Ajustements"}),(0,r.jsxs)(rU,{className:"flex flex-col gap-4 px-3",children:[(0,r.jsx)(ac,{label:"Transparence",value:Math.round((1-h.opacity)*100),min:0,max:100,onChange:e=>x({opacity:1-e/100})}),m?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ac,{label:"Luminosit\xe9",value:Math.round(100*h.brightness),min:-100,max:100,onChange:e=>x({brightness:e/100})}),(0,r.jsx)(ac,{label:"Contraste",value:Math.round(100*h.contrast),min:-100,max:100,onChange:e=>x({contrast:e/100})})]}):null,(0,r.jsx)(b.$,{type:"button",variant:"outline",size:"sm",className:"h-8 w-fit",onClick:()=>x({opacity:1,brightness:0,contrast:0,recolor:""}),children:"R\xe9tablir"})]})]}),(0,r.jsxs)(rG,{value:"alt","data-graphic-section":"alt",className:"border-b-0",children:[(0,r.jsx)(rY,{className:"px-3 py-3 text-sm",children:"Texte alternatif"}),(0,r.jsxs)(rU,{className:"flex flex-col gap-3 px-3",children:[(0,r.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Titre"}),(0,r.jsx)(tn.p,{value:h.altTitle,className:"h-8 text-sm",onChange:e=>x({altTitle:e.target.value})})]}),(0,r.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Description"}),(0,r.jsx)(rW.T,{value:h.alt,rows:3,className:"text-sm",onChange:e=>x({alt:e.target.value})})]})]})]})]})}):(0,r.jsx)("p",{className:"px-4 py-6 text-sm text-muted-foreground",children:"S\xe9lectionnez une image ou un graphisme pour afficher ses options."})]})});function au(e,t){return Math.min(Math.max(e,0),Math.max(0,1-t))}function ah(e){let t=e?.closest("[data-docs-page-stack]");if(!t)return null;let n=Number.parseFloat(t.dataset.docsPageScale??"1")||1,r=Number.parseFloat(t.dataset.docsPageHeight??"0")||0,a=Number.parseFloat(t.dataset.docsPageWidth??"0")||0;return{stack:t,scale:n,pageHeight:r,pageWidth:a}}function am(e,t,n,r){let a=(0,rv.bX)(t.state.doc,n,r);return(0,rv.Jt)(e,a)}function ap(e,t,n,r){0===r.length?(0,rw.qV)():(0,rw.Tx)({pageIndex:e,pageWidth:t,pageHeight:n,guides:r})}function ag({shapeType:e,fill:t,stroke:n,strokeWidth:a}){return"ellipse"===e?(0,r.jsx)("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100","aria-hidden":!0,children:(0,r.jsx)("ellipse",{cx:"50",cy:"50",rx:"46",ry:"40",fill:t,stroke:n,strokeWidth:a})}):"line"===e?(0,r.jsx)("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100","aria-hidden":!0,children:(0,r.jsx)("line",{x1:"8",y1:"50",x2:"92",y2:"50",stroke:n,strokeWidth:a+1})}):"arrow"===e?(0,r.jsxs)("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100","aria-hidden":!0,children:[(0,r.jsx)("line",{x1:"10",y1:"50",x2:"78",y2:"50",stroke:n,strokeWidth:a+1}),(0,r.jsx)("polygon",{points:"78,38 92,50 78,62",fill:n})]}):(0,r.jsx)("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100","aria-hidden":!0,children:(0,r.jsx)("rect",{x:"6",y:"10",width:"88",height:"80",rx:"4",fill:t,stroke:n,strokeWidth:a})})}function af({attrs:e,imageRect:t,windowRect:n,bakedImage:i,panX:s,panY:l,fitStyle:o,filter:c,onImageNaturalSize:d,onCropImagePan:u}){let h=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=e=>{if(!h.current||!u)return;let{startX:t,startY:n,origin:r,scale:a,windowWidth:i,windowHeight:s}=h.current;u((e.clientX-t)/a/Math.max(i,1),(e.clientY-n)/a/Math.max(s,1),r)},t=()=>{h.current=null};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[u]),(0,r.jsx)("div",{className:"docs-graphic-crop-image-layer absolute z-10 touch-none",style:{left:t.left-s*n.width,top:t.top-l*n.height,width:t.width,height:t.height,cursor:"grab"},onPointerDown:t=>{if(!u)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId);let r=t.currentTarget.parentElement,a=r?.getBoundingClientRect(),i=a&&e.width>0?a.width/e.width:1;h.current={startX:t.clientX,startY:t.clientY,origin:{panX:s,panY:l},scale:i,windowWidth:n.width,windowHeight:n.height}},children:(0,r.jsx)("img",{src:e.src,alt:e.alt||"",draggable:!1,className:"docs-graphic__image pointer-events-none block h-full w-full select-none",style:{objectFit:i?void 0:o.objectFit,objectPosition:i?void 0:o.objectPosition,filter:c||void 0},onLoad:e=>{d?.(e.currentTarget.naturalWidth,e.currentTarget.naturalHeight)}})})}function ax({attrs:e,cropMode:t,cropEditBase:n,cropPanX:a,cropPanY:i,imageNaturalWidth:s,imageNaturalHeight:l,onImageNaturalSize:o,onCropImagePan:c}){if("image"===e.graphicType){if(!e.src)return(0,r.jsx)("div",{className:"flex h-full w-full items-center justify-center bg-[#f1f3f4] text-xs text-[#5f6368]",children:"Image"});let d=(0,rb.Fj)(e),u=(0,rb.PC)(e);if(t&&s>0&&l>0){let{imageRect:t,windowRect:h}=(0,rb.kq)(e,e.width,e.height,s,l,n);return(0,r.jsx)(af,{attrs:e,imageRect:t,windowRect:h,bakedImage:!!(n&&(0,rb.Di)(n)),panX:a,panY:i,fitStyle:u,filter:d,onImageNaturalSize:o,onCropImagePan:c})}let h=(0,rb.z)(e.imageFit)?(0,rb.YM)(e,e.width,e.height,s,l):{img:{}},m=Object.keys(h.img).length>0;return(0,r.jsx)("img",{src:e.src,alt:e.alt||"",draggable:!1,className:"docs-graphic__image block h-full w-full",style:{objectFit:m?void 0:u.objectFit,objectPosition:m?void 0:u.objectPosition,...h.img,filter:d||void 0},onLoad:e=>{o?.(e.currentTarget.naturalWidth,e.currentTarget.naturalHeight)}})}return"gradient"===e.graphicType?(0,r.jsx)("div",{className:"h-full w-full",style:{background:e.gradientCss},"aria-hidden":!0}):"draw"===e.graphicType?e.src?(0,r.jsx)("img",{src:e.src,alt:e.alt||"Dessin",draggable:!1,className:"docs-graphic__image block h-full w-full object-contain"}):(0,r.jsx)("div",{className:"flex h-full w-full items-center justify-center bg-[#f8f9fa] text-xs text-[#5f6368]",children:"Dessin"}):(0,r.jsx)(ag,{shapeType:e.shapeType,fill:e.fill,stroke:e.stroke,strokeWidth:e.strokeWidth})}function ab({handle:e,onPointerDown:t}){return(0,r.jsx)("span",{role:"presentation",className:(0,v.cn)("docs-graphic-handle absolute z-20",{nw:"left-0 top-0 cursor-nwse-resize",n:"left-1/2 top-0 -translate-x-1/2 cursor-ns-resize",ne:"right-0 top-0 cursor-nesw-resize",e:"right-0 top-1/2 -translate-y-1/2 cursor-ew-resize",se:"right-0 bottom-0 cursor-nwse-resize",s:"left-1/2 bottom-0 -translate-x-1/2 cursor-ns-resize",sw:"left-0 bottom-0 cursor-nesw-resize",w:"left-0 top-1/2 -translate-y-1/2 cursor-ew-resize"}[e]),onPointerDown:n=>{n.preventDefault(),n.stopPropagation(),t(e,n)}})}function ay({onPointerDown:e}){return(0,r.jsxs)("span",{role:"presentation",className:"docs-graphic-rotate-handle absolute left-1/2 top-0 z-20 flex -translate-x-1/2 -translate-y-[calc(100%+8px)] cursor-grab items-center justify-center",onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),e(t)},children:[(0,r.jsx)("span",{className:"size-2 rounded-none bg-[#1a73e8]"}),(0,r.jsx)("span",{className:"absolute top-full h-2 w-px bg-[#1a73e8]","aria-hidden":!0})]})}let aj=(0,a.memo)(function({node:e,updateAttributes:t,selected:n,editor:i,getPos:l,extension:o}){let c=(0,rb.Oy)(e.attrs),d=(0,a.useRef)(c);d.current=c;let u="number"==typeof l()?l():null,h=(0,a.useRef)(null),m=(0,rx.j8)(c),p=m?(0,rx.vW)(c):null,[g,f]=(0,a.useState)(0),[x,b]=(0,a.useState)(!1);(0,a.useLayoutEffect)(()=>{x||b(!0);let e=ah(h.current);e&&e.pageHeight!==g&&f(e.pageHeight)});let y=x&&p?document.getElementById((0,rx.au)(p)):null,j=x&&m?document.getElementById((0,rx.au)("front")):null,w=function(e,t={}){let n="graphicType"in e&&"string"==typeof e.graphicType?e:(0,rb.Oy)(e),r=n.width,a=n.height,i=n.rotationDeg,s="behind"===n.wrap,l="in-front"===n.wrap,o=(0,rx.j8)(n),c=o||"absolute"===n.placement,d=np(n.wrapMarginMm),u=Math.max(4,Math.round(d/2)),h={},m={width:r,height:a,transform:i?`rotate(${i}deg)`:void 0,transformOrigin:"center center",position:c?"absolute":"relative",zIndex:s?1:l?2:n.zIndex>0?n.zIndex:void 0,pointerEvents:"auto",opacity:n.opacity<1?n.opacity:void 0,boxShadow:n.shadow||void 0};if(o)null!=t.pageHeight&&t.pageHeight>0?(m.left=n.pageX,m.top=(0,rx.dq)(n.pageIndex,t.pageHeight)+n.pageY):(m.left=n.pageX,m.top=n.pageY);else if(c)m.left=n.x,m.top=n.y;else{if(h.width=r,h.height=a,h.maxWidth="100%","inline"===n.placement||"inline"===n.wrap)h.display="inline-block",h.verticalAlign="baseline";else if("top-bottom"===n.wrap)h.display="block",h.clear="both",h.marginBlock=`${d}px`,"center"===n.floatSide&&(h.marginInline="auto");else if("square"===n.wrap||"tight"===n.wrap||"through"===n.wrap){if(h.display="block",h.marginBlock=`${u}px`,"center"===n.floatSide)h.float="none",h.marginInline="auto";else{let e="tight"===n.wrap?Math.max(2,u/2):d;h.float="right"===n.floatSide?"right":"left",h.marginInlineStart="right"===n.floatSide?`${e}px`:void 0,h.marginInlineEnd="right"===n.floatSide?void 0:`${e}px`,"tight"===n.wrap&&(h.shapeOutside="margin-box")}"through"===n.wrap&&(m.opacity=.85,m.mixBlendMode="multiply")}else h.display="block",h.marginBlock=`${d}px`,"center"===n.floatSide&&(h.marginInline="auto");(n.x||n.y)&&(m.left=n.x,m.top=n.y)}return{wrapper:h,inner:m,content:{width:"100%",height:"100%",overflow:"hidden",position:"relative"},behindText:s,inFrontText:l,usePageLayer:o}}(c,{pageHeight:g||void 0}),N=i.isEditable,k="docsInlineGraphic"===o.name,C=(0,a.useRef)(null),S=(0,a.useRef)(null),A=(0,a.useRef)(null),M=(0,a.useRef)(null),z=(0,a.useRef)(null),[P,I]=(0,a.useState)(!1),[T,D]=(0,a.useState)(!1),[L,F]=(0,a.useState)(!1),[E,R]=(0,a.useState)({x:0,y:0}),[H,B]=(0,a.useState)({width:0,height:0}),[$,O]=(0,a.useState)(null),W=(0,a.useCallback)(()=>{R({x:0,y:0});let e=d.current,n=H.width,r=H.height;if((0,rb.z)(e.imageFit)&&(0,rb.Di)(e)){let a={cropX:e.cropX,cropY:e.cropY,cropWidth:e.cropWidth,cropHeight:e.cropHeight};O(a),n>0&&r>0?t((0,rb.PI)(a,e.width,e.height,n,r)):t({cropX:0,cropY:0,cropWidth:1,cropHeight:1})}else O(null),t({cropX:0,cropY:0,cropWidth:1,cropHeight:1});F(!0)},[H.height,H.width,t]),_=(0,a.useCallback)(()=>{let e=d.current,n=H.width,r=H.height;n>0&&r>0?t((0,rb.Iy)(e,E.x,E.y,n,r,$)):t({imageFit:"crop"}),O(null),R({x:0,y:0}),F(!1)},[$,E.x,E.y,H.height,H.width,t]);(0,a.useEffect)(()=>{!n&&L&&_()},[L,_,n]),(0,a.useEffect)(()=>{window.dispatchEvent(new CustomEvent(rz,{detail:{active:L}}))},[L]),(0,a.useEffect)(()=>{let e=()=>{n&&N&&"image"===c.graphicType&&W()},t=()=>{n&&L&&_()};return window.addEventListener(rA,e),window.addEventListener(rM,t),()=>{window.removeEventListener(rA,e),window.removeEventListener(rM,t)}},[c.graphicType,L,N,_,n,W]);let q=(0,a.useCallback)(e=>{if(!N||L||e.target.closest(".docs-graphic-handle, .docs-graphic-rotate-handle, .docs-graphic-crop"))return;e.preventDefault(),e.stopPropagation();let t=h.current?.isConnected?h.current:e.currentTarget;try{t.setPointerCapture(e.pointerId)}catch{}A.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,host:t},D(!0)},[L,N]),G=(0,a.useCallback)((e,t)=>{if(!N||L)return;t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId);let n=d.current;M.current={handle:e,startX:t.clientX,startY:t.clientY,width:n.width,height:n.height,pageX:n.pageX,pageY:n.pageY,offsetX:n.x,offsetY:n.y,onPageLayer:m,lockAspect:"image"===n.graphicType?!1!==n.lockAspectRatio&&2===e.length:t.shiftKey||2===e.length,scale:ah(h.current)?.scale??1},I(!0)},[L,N,m]),Y=(0,a.useCallback)(e=>{if(!N||L)return;e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let t=e.currentTarget.closest(".docs-graphic").getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,a=Math.atan2(e.clientY-r,e.clientX-n);z.current={centerX:n,centerY:r,startAngle:a,originRotation:d.current.rotationDeg},I(!0)},[L,N]);(0,a.useEffect)(()=>{let e=h.current?.closest("[data-docs-page-stack]");return P||T?e?.setAttribute("data-graphic-dragging","true"):e?.removeAttribute("data-graphic-dragging"),()=>e?.removeAttribute("data-graphic-dragging")},[P,T]),(0,a.useEffect)(()=>{if(!P&&!T)return;let e=e=>{if(A.current&&!S.current){let t=A.current;if(t.pointerId!==e.pointerId||4>Math.hypot(e.clientX-t.startX,e.clientY-t.startY))return;let n=h.current?.isConnected?h.current:t.host.isConnected?t.host:null;try{n?.setPointerCapture(e.pointerId)}catch{}let r=d.current;S.current={startX:t.startX,startY:t.startY,pageIndex:r.pageIndex,pageX:r.pageX,pageY:r.pageY,scale:ah(h.current)?.scale??1},A.current=null,I(!0)}if(S.current){let{startX:n,startY:r,pageIndex:a,pageX:s,pageY:o,scale:c}=S.current,u=(e.clientX-n)/c,m=(e.clientY-r)/c,p=d.current,g=ah(h.current),f=am(g?.stack??null,i,a,"number"==typeof l()?l():null),x={x:s+u,y:o+m,width:p.width,height:p.height},b=f?(0,rv.A2)(x,f):{rect:x,guides:[]};ap(a,f?.pageWidth??g?.pageWidth??0,f?.pageHeight??g?.pageHeight??0,b.guides),t({pageIndex:a,pageX:b.rect.x,pageY:b.rect.y})}if(M.current){let{handle:n,startX:r,startY:a,width:s,height:o,pageX:c,pageY:u,offsetX:m,offsetY:p,onPageLayer:g,lockAspect:f,scale:x}=M.current,b=function(e,t,n,r,a,i=24,s=!1){let l=t,o=n,c=0,d=0;if(s){let i=t/Math.max(n,1);Math.abs(r)>=Math.abs(a)?o=(l=t+(e.includes("w")?-r:r))/i:l=(o=n+(e.includes("n")?-a:a))*i,e.includes("w")&&(c=t-l),e.includes("n")&&(d=n-o)}else e.includes("e")&&(l=t+r),e.includes("w")&&(l=t-r,c=r),e.includes("s")&&(o=n+a),e.includes("n")&&(o=n-a,d=a);return l=Math.max(i,l),o=Math.max(i,o),e.includes("w")&&l===i&&(c=t-i),e.includes("n")&&o===i&&(d=n-i),{width:Math.round(l),height:Math.round(o),xOffset:c,yOffset:d}}(n,s,o,(e.clientX-r)/x,(e.clientY-a)/x,24,f||e.shiftKey),y={width:b.width,height:b.height};if(g){let e={x:c+b.xOffset,y:u+b.yOffset,width:b.width,height:b.height},t=d.current,r=ah(h.current),a=am(r?.stack??null,i,t.pageIndex,"number"==typeof l()?l():null),s=a?(0,rv.$Q)(n,e,a):{rect:e,guides:[]};ap(t.pageIndex,a?.pageWidth??r?.pageWidth??0,a?.pageHeight??r?.pageHeight??0,s.guides),y.pageX=s.rect.x,y.pageY=s.rect.y,y.width=s.rect.width,y.height=s.rect.height}else(b.xOffset||b.yOffset)&&(y.x=Math.round(m+b.xOffset),y.y=Math.round(p+b.yOffset));t(y)}if(z.current){let{centerX:n,centerY:r,startAngle:a,originRotation:i}=z.current;t({rotationDeg:Math.round(i+(Math.atan2(e.clientY-r,e.clientX-n)-a)*180/Math.PI)})}},n=()=>{if((0,rw.qV)(),S.current){let e=d.current,n=ah(h.current);if(n&&n.pageHeight>0){let r=(0,rx.DN)(e.pageIndex,e.pageY,n.pageHeight);(r.pageIndex!==e.pageIndex||r.pageY!==e.pageY)&&t(r)}}S.current=null,A.current=null,M.current=null,z.current=null,I(!1),D(!1)};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",n)}},[P,T,t,i,l]);let U=(0,a.useCallback)(()=>{let e=l();if("number"!=typeof e)return;let t=i.state.selection;t instanceof n2.nh&&t.from===e||i.chain().focus().setNodeSelection(e).run()},[i,l]),X=(0,a.useCallback)(e=>{N&&m&&(e.target.closest(".docs-graphic-handle, .docs-graphic-rotate-handle, .docs-graphic-crop")||(U(),q(e)))},[N,q,m,U]),J=(0,a.useCallback)(e=>{!N||m||n||(e.stopPropagation(),U())},[N,m,n,U]),V=(0,a.useCallback)(()=>{C.current?.click()},[]),K=n&&N&&!L,Q=m&&K&&!!j,Z=m?{...w.inner,position:"absolute",pointerEvents:Q&&n?"none":"auto"}:w.inner,ee="image"===c.graphicType&&"ellipse"===c.cropShape&&!L&&(0,rb.z)(c.imageFit)&&(0,rb.Di)(c)?"ellipse(50% 50% at 50% 50%)":void 0,et=!m&&N?{"data-drag-handle":""}:{},en=K?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"docs-graphic-outline","aria-hidden":!0}),(0,r.jsx)(ay,{onPointerDown:Y}),ry.map(e=>(0,r.jsx)(ab,{handle:e,onPointerDown:G},e))]}):null,er=(0,r.jsxs)("div",{ref:h,className:(0,v.cn)("docs-graphic",n&&"docs-graphic--selected",P&&"docs-graphic--interacting",L&&"docs-graphic--cropping",w.behindText&&"docs-graphic--behind",w.inFrontText&&"docs-graphic--front",m&&"docs-graphic--page-layer"),style:Z,"data-graphic-pos":u??void 0,...et,contentEditable:!1,onPointerDown:m?X:void 0,onMouseDown:m||!N||n?void 0:J,onDoubleClick:e=>{N&&"image"===c.graphicType&&(e.preventDefault(),e.stopPropagation(),W())},children:[(0,r.jsx)("div",{className:(0,v.cn)("docs-graphic__content",L&&"docs-graphic__content--cropping"),style:{...w.content,overflow:L?"visible":w.content.overflow,clipPath:L?void 0:ee},children:(0,r.jsx)(ax,{attrs:c,cropMode:L,cropEditBase:$,cropPanX:E.x,cropPanY:E.y,imageNaturalWidth:H.width,imageNaturalHeight:H.height,onImageNaturalSize:(e,t)=>B({width:e,height:t}),onCropImagePan:(e,t,n)=>{let r=d.current;R({x:au(n.panX-e,r.cropWidth),y:au(n.panY-t,r.cropHeight)})}})}),n&&N&&L&&"image"===c.graphicType?(0,r.jsx)(rS,{attrs:c,cropEditBase:$,frameWidth:c.width,frameHeight:c.height,imageNaturalWidth:H.width,imageNaturalHeight:H.height,onChange:t,onDone:_}):null,Q?null:en,(0,r.jsx)("input",{ref:C,type:"file",accept:"image/*",className:"hidden",onChange:e=>{let n=e.target.files?.[0];if(!n)return;let r=new FileReader;r.onload=()=>{t({src:r.result})},r.readAsDataURL(n),e.target.value=""}})]}),ea=Q&&j&&en?(0,rf.createPortal)((0,r.jsx)("div",{className:(0,v.cn)("docs-graphic docs-graphic--selected docs-graphic--selection-chrome docs-graphic--page-layer pointer-events-none"),style:Z,children:(0,r.jsx)("div",{className:"docs-graphic-drag-surface pointer-events-auto relative size-full touch-none cursor-move",onPointerDown:X,children:en})}),j):null,ei=n&&N?(0,r.jsx)(rR,{editor:i,onCrop:W,onOpenOptions:()=>at("gradient"===c.graphicType?"gradient":"size"),onReplaceImage:V,children:er}):er,es=m&&y?(0,rf.createPortal)(ei,y):ei;return(0,r.jsxs)(s.VR,{as:k?"span":"div",className:(0,v.cn)("docs-graphic-host",k&&"docs-graphic-host--inline",m&&"docs-graphic-host--page-layer"),style:m?{width:0,height:0,overflow:"visible",position:"relative"}:w.wrapper,"data-graphic-type":c.graphicType,"data-wrap":c.wrap,"data-placement":c.placement,"data-position-mode":c.positionMode,"data-graphic-pos":u??void 0,children:[es,ea]})}),av={graphicType:{default:rb.m2.graphicType},src:{default:null},alt:{default:""},shapeType:{default:rb.m2.shapeType},fill:{default:rb.m2.fill},stroke:{default:rb.m2.stroke},strokeWidth:{default:rb.m2.strokeWidth},gradientCss:{default:""},gradientType:{default:rb.m2.gradientType},gradientAngle:{default:rb.m2.gradientAngle},gradientColor1:{default:rb.m2.gradientColor1},gradientColor2:{default:rb.m2.gradientColor2},width:{default:rb.m2.width},height:{default:rb.m2.height},placement:{default:rb.m2.placement},wrap:{default:rb.m2.wrap},floatSide:{default:rb.m2.floatSide},x:{default:0},y:{default:0},positionMode:{default:rb.m2.positionMode},anchorPos:{default:-1},pageIndex:{default:0},pageX:{default:0},pageY:{default:0},wrapMarginMm:{default:rb.m2.wrapMarginMm},rotationDeg:{default:0},zIndex:{default:0},cropX:{default:0},cropY:{default:0},cropWidth:{default:1},cropHeight:{default:1},cropShape:{default:"rect"},lockAspectRatio:{default:!0},imageFit:{default:"contain"},imageFitAnchorH:{default:.5},imageFitAnchorV:{default:.5},assetId:{default:null},opacity:{default:1},shadow:{default:""},brightness:{default:0},contrast:{default:0},recolor:{default:""},altTitle:{default:""},drawScene:{default:null,rendered:!1,parseHTML:e=>e.getAttribute("data-draw-scene"),renderHTML:e=>e.drawScene?{"data-draw-scene":e.drawScene}:{}},drawDriveFileId:{default:null,rendered:!1,parseHTML:e=>e.getAttribute("data-draw-drive-file-id"),renderHTML:e=>e.drawDriveFileId?{"data-draw-drive-file-id":e.drawDriveFileId}:{}}};function aw(e){let t=(0,rb.Oy)({...rb.m2,...e});return"gradient"!==t.graphicType||e.gradientCss||(t.gradientCss=(0,rb.if)(t.gradientAngle,t.gradientColor1,t.gradientColor2,t.gradientType)),t}function aN(e){let t=aw(e);return"inline"===t.placement||"inline"===t.wrap?"docsInlineGraphic":"docsGraphic"}function ak(e){return e.isActive("docsInlineGraphic")?"docsInlineGraphic":e.isActive("docsGraphic")?"docsGraphic":null}function aC(e){let t=e.selection;if(!(t instanceof n2.nh))return null;let n=t.node;return"docsGraphic"!==n.type.name&&"docsInlineGraphic"!==n.type.name?null:n}function aS(e){return"docsGraphic"===e||"docsInlineGraphic"===e}function aA({state:e,tr:t,dispatch:n},r){let{selection:a}=e,i=aC(e);if(!i)return!1;let s=i.type.name,l=aw({...i.attrs,...r}),o=aN(l),c=a.from,d=c;if(o===s)t.setNodeMarkup(c,void 0,l);else{let n=e.schema.nodes[o];if(!n)return!1;"docsGraphic"===s&&"docsInlineGraphic"===o?d=function(e,t,n,r,a,i){let s=t.schema.nodes.paragraph;if(!s)return n;let l=i.create(a),o=s.create(null,l);return e.replaceWith(n,n+r.nodeSize,o),n+1}(t,e,c,i,l,n):"docsInlineGraphic"===s&&"docsGraphic"===o?d=function(e,t,n,r,a,i){let s=t.doc.resolve(n),l=s.parent,o=i.create(a);if("paragraph"===l.type.name&&1===l.childCount){let t=s.before(s.depth);return e.replaceWith(t,s.after(s.depth),o),t}let c=s.before(s.depth);e.insert(c,o);let d=e.mapping.map(n);return e.delete(d,d+r.nodeSize),c}(t,e,c,i,l,n):(t.replaceWith(c,c+i.nodeSize,n.create(l)),d=t.mapping.map(c,-1))}return!function(e,t){for(let n of[t,t+1,t-1]){if(n<0||n>e.doc.content.size)continue;let t=e.doc.nodeAt(n);if(t&&aS(t.type.name))return void e.setSelection(n2.nh.create(e.doc,n))}let n=null;e.doc.descendants((e,r)=>{if(!aS(e.type.name))return;let a=Math.abs(r-t);(!n||a<n.dist)&&(n={pos:r,dist:a})}),n&&e.setSelection(n2.nh.create(e.doc,n.pos))}(t,d),n&&n(t),!0}function aM(e,t){if(aC(e.state))return aA(e,t);let n=ak(e.editor);return!!n&&e.chain().updateAttributes(n,t).run()}function az(e){let t={positionMode:"fixed-on-page",placement:"absolute"},n=aC(e.state);return n&&(0,rx.j8)(n.attrs)||Object.assign(t,function(){if("u"<typeof document)return null;let e=document.querySelector(".docs-graphic--selected, .ProseMirror-selectednode .docs-graphic"),t=document.querySelector("[data-docs-page-stack]");if(!e||!t)return null;let n=Number.parseFloat(t.dataset.docsPageScale??"1")||1,r=Number.parseFloat(t.dataset.docsPageHeight??"0")||0;if(r<=0)return null;let a=(0,rx.Ao)(e.getBoundingClientRect(),t.getBoundingClientRect(),n,r);return{pageIndex:a.pageIndex,pageX:a.pageX,pageY:a.pageY}}()),t}function aP(e){let t="behind"===e||"in-front"===e?"square":e??"square";return{positionMode:"move-with-text",placement:"inline"===t?"inline":"block",wrap:t}}let aI=nU.bP.create({name:"docsGraphic",group:"block",atom:!0,draggable:!0,selectable:!0,addAttributes:()=>av,parseHTML:()=>[{tag:'div[data-type="docs-graphic"]'}],renderHTML:({HTMLAttributes:e})=>["div",(0,nU.KV)(e,{"data-type":"docs-graphic"})],addNodeView:()=>(0,s.gu)(aj),addCommands:()=>({insertDocsGraphic:e=>({chain:t,editor:n})=>{let r=e.anchorPos??n.state.selection.from,a=aw({...e,anchorPos:r}),i=aN(a);if(!t().focus().insertContent({type:i,attrs:a}).run())return!1;let s=null,l=1/0;return n.state.doc.descendants((e,t)=>{if(!aS(e.type.name))return;let n=Math.abs(t-r);n<l&&(l=n,s=t)}),null!=s&&n.commands.setNodeSelection(s),!0},updateDocsGraphic:e=>t=>aM(t,e),setDocsGraphicWrap:e=>t=>{let n;return n="behind"===e||"in-front"===e?{...az(t),wrap:e}:{wrap:e,positionMode:"move-with-text",placement:"inline"===e?"inline":"block"},aA(t,n)},setDocsGraphicPlacement:e=>t=>{if("absolute"===e)return aA(t,az(t));let n=aP(aC(t.state)?.attrs?.wrap);return n.placement=e,"inline"===e&&(n.wrap="inline"),aA(t,n)},setDocsGraphicFloatSide:e=>t=>aM(t,{floatSide:e}),setDocsGraphicPositionMode:e=>t=>{if("fixed-on-page"===e)return aA(t,az(t));let n=aC(t.state)?.attrs?.wrap;return aA(t,aP(n))},setDocsGraphicWrapMargin:e=>t=>aM(t,{wrapMarginMm:Math.max(0,e)}),setDocsGraphicAnchor:e=>t=>aM(t,{anchorPos:e}),bringDocsGraphicForward:()=>e=>{let t=ak(e.editor);if(!t)return!1;let n=Number(e.editor.getAttributes(t).zIndex??0);return e.chain().updateAttributes(t,{zIndex:n+1}).run()},sendDocsGraphicBackward:()=>e=>{let t=ak(e.editor);if(!t)return!1;let n=Number(e.editor.getAttributes(t).zIndex??0);return e.chain().updateAttributes(t,{zIndex:Math.max(0,n-1)}).run()}})}),aT=nU.bP.create({name:"docsInlineGraphic",group:"inline",inline:!0,atom:!0,draggable:!0,selectable:!0,addAttributes:()=>av,parseHTML:()=>[{tag:'span[data-type="docs-inline-graphic"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,nU.KV)(e,{"data-type":"docs-inline-graphic"})],addNodeView:()=>(0,s.gu)(aj)});function aD(e,t={}){return aw({...rb.m2,graphicType:e,...t})}async function aL(e){let{computeImageInsertFrameSize:t,readImageNaturalSize:r}=await n.e(955).then(n.bind(n,80955));try{let n=await r(e.src),{width:a,height:i}=t(n.width,n.height);return aD("image",{...e,width:a,height:i,lockAspectRatio:!0})}catch{return aD("image",e)}}function aF(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})}let aE=nU.YY.create({name:"docsGraphicPasteDrop",addProseMirrorPlugins(){let e=this.editor;return[new n2.k_({key:new n2.hs("docsGraphicPasteDrop"),props:{handlePaste(t,n){let r=n.clipboardData?.items;if(!r)return!1;for(let t of r){if(!t.type.startsWith("image/"))continue;let r=t.getAsFile();if(r)return n.preventDefault(),aF(r).then(async t=>{let n=await aL({src:t});e.chain().focus().insertDocsGraphic(n).run()}),!0}return!1},handleDrop(t,n){let r=n.dataTransfer?.files;if(!r?.length)return!1;let a=[...r].find(e=>e.type.startsWith("image/"));return!!a&&(n.preventDefault(),aF(a).then(async r=>{let a=await aL({src:r}),i=t.posAtCoords({left:n.clientX,top:n.clientY}),s=e.chain().focus();i?.pos!=null&&s.setTextSelection(i.pos),s.insertDocsGraphic(a).run()}),!0)}}})]}}),aR=new n2.hs("docsGraphicAnchorSync"),aH=nU.YY.create({name:"docsGraphicAnchorSync",addProseMirrorPlugins(){let e=this.editor;return[new n2.k_({key:aR,props:{handleDOMEvents:{mousedown:(t,n)=>(function(e,t){if(!t.altKey)return!1;for(let n of document.elementsFromPoint(t.clientX,t.clientY)){if(!(n instanceof HTMLElement))continue;let r=n.classList.contains("docs-graphic")?n:n.closest(".docs-graphic"),a=r?.hasAttribute("data-graphic-pos")?r:r?.closest("[data-graphic-pos]");if(!a)continue;let i=a.getAttribute("data-graphic-pos"),s=i?Number(i):NaN;if(Number.isFinite(s))return e.chain().focus().setNodeSelection(s).run(),t.preventDefault(),t.stopPropagation(),!0}return!1})(e,n)}},appendTransaction(e,t,n){if(!e.some(e=>e.docChanged))return null;let r=n.tr,a=!1;return n.doc.descendants((t,n)=>{let i;if("docsGraphic"!==t.type.name&&"docsInlineGraphic"!==t.type.name)return;let s=(0,rb.Oy)(t.attrs);if("move-with-text"!==s.positionMode||s.anchorPos<0)return;let l=e.reduce((e,t)=>t.docChanged?t.mapping.map(e):e,s.anchorPos),o="move-with-text"!==(i=(0,rb.Oy)(t.attrs)).positionMode?null:i.anchorPos<0?{anchorPos:l}:l<0?{positionMode:"fixed-on-page",placement:"absolute",anchorPos:-1}:l!==i.anchorPos?{anchorPos:l}:null;o&&(r=r.setNodeMarkup(n,void 0,{...t.attrs,...o}),a=!0)}),a?r:null}})]}});var aB=n(55848);let a$=new n2.hs("docsGraphicKeyboard"),aO=nU.YY.create({name:"docsGraphicKeyboard",priority:1e3,addProseMirrorPlugins(){let e=this.editor;return[new n2.k_({key:a$,props:{handleKeyDown:(t,n)=>(0,aB.xY)(e,n)}})]}}),aW=new n2.hs("docsPageFlowDecoration"),a_=new Set(["bulletList","orderedList","taskList"]);function aq(e){let t=e.closest(".ultidrive-docs-editor-surface");if(!t)return null;let n=getComputedStyle(t),r=parseFloat(n.getPropertyValue("--docs-body-area-h")),a=parseFloat(n.getPropertyValue("--docs-inter-page-spacer"));return!Number.isFinite(r)||r<=0||!Number.isFinite(a)||a<=0?null:{bodyAreaH:r,interPageSpacer:a}}function aG(e,t,n){let r=e.nodeDOM(t);return r instanceof HTMLElement?r.matches(n)?r:r.closest(n):null}function aY(e){let t=parseFloat(getComputedStyle(e).marginBottom)||0;return e.offsetHeight+t}function aU(e,t,n,r,a,i){if(a<=i)return[{height:a,offset:n}];let s=function(e){let t=e.getBoundingClientRect().top,n=document.createRange(),r=[],a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;a.nextNode();){let e=a.currentNode;if(e.nodeValue?.length)for(let a of(n.selectNodeContents(e),n.getClientRects())){if(a.width<=0||a.height<=0)continue;let e=a.top-t,n=r[r.length-1];!n||Math.abs(n.top-e)>2?r.push({top:e,height:a.height}):n.height=Math.max(n.height,a.height)}}if(0===r.length){let t=e.offsetHeight;t>0&&r.push({top:0,height:t})}return r}(r);if(s.length<=1)return function(e,t,n,r){let a=getComputedStyle(n),i=parseFloat(a.lineHeight);Number.isFinite(i)&&"normal"!==a.lineHeight||(i=1.25*(parseFloat(a.fontSize)||16));let s=Math.max(1,Math.ceil(r/i)),l=Math.max(1,e.content.size),o=[];for(let e=0;e<s;e++){let n=e===s-1?Math.max(1,r-i*(s-1)):i,a=0===e?t:t+Math.min(l-1,Math.floor(l*e/s));o.push({height:n,offset:a})}return o}(t,n,r,a);let l=r.getBoundingClientRect();return s.map((t,r)=>{var a;let i;return{height:t.height,offset:0===r?n:(a=t.top,i=e.posAtCoords({left:l.left+Math.min(Math.max(1,l.width/2),l.width-1),top:l.top+a+1}),i?.pos??null??n)}})}function aX(e,t,n,r,a){let i=function(e,t){let n=e.nodeDOM(t);if(n instanceof HTMLElement){if(n.parentElement===e.dom)return n;let t=n;for(;t&&t.parentElement!==e.dom;)t=t.parentElement;return t}return null}(e,n);if(!i)return;let s=aY(i);s<=0||r.push(...aU(e,t,n,i,s,a))}function aJ(e,t){let n=[],r=e.state.doc,a=0;for(let i=0;i<r.childCount;i++){let s=r.child(i);!function(e,t,n,r,a){if(t.isBlock){if(a_.has(t.type.name)){let i=n+1;for(let n=0;n<t.childCount;n++){let s=t.child(n),l=aG(e,i,"li"),o=l?aY(l):0;o>0&&r.push(...aU(e,s,i,l,o,a)),i+=s.nodeSize}return}if("table"===t.type.name){let i=n+1;for(let n=0;n<t.childCount;n++){let s=t.child(n);if("tableRow"!==s.type.name){i+=s.nodeSize;continue}let l=aG(e,i,"tr"),o=l?aY(l):0;o>0&&r.push(...aU(e,s,i,l,o,a)),i+=s.nodeSize}return}if("blockquote"===t.type.name){let i=n+1;for(let n=0;n<t.childCount;n++){let s=t.child(n);s.isBlock&&aX(e,s,i,r,a),i+=s.nodeSize}return}aX(e,t,n,r,a)}}(e,s,a,n,t),a+=s.nodeSize}return n}function aV(e){if(e.isDestroyed||!e.isInitialized)return!1;let t=e.view,n=function(e){var t;let n,r,a,i,s=aq(e.dom);if(!s)return n4.zF.empty;let{bodyAreaH:l,interPageSpacer:o}=s,c=aJ(e,l),d=(t=c.map(e=>({height:e.height})),n=l+o,r=[],a=0,i=l,t.forEach(({height:e},t)=>{if(!(e<=0)){for(;a+e>i;){let e=i+o;if(a<i){let s=i-a+o;r.push({blockIndex:t,pushPx:s,breakY:i}),a=e,i+=n;break}if(a<e){let s=e-a;r.push({blockIndex:t,pushPx:s,breakY:i}),a=e,i+=n;break}i+=n}a+=e}}),r).map(({blockIndex:e,pushPx:t,breakY:n})=>{let r=c[e];return n4.NZ.widget(r.offset,()=>{let e;return(e=document.createElement("div")).className="docs-page-flow-spacer",e.style.cssText=`display:block;width:100%;height:${t}px;margin:0;padding:0;border:0;flex-shrink:0`,e.setAttribute("aria-hidden","true"),e.contentEditable="false",e},{side:-1,key:`page-flow-spacer-${r.offset}-${n}`,pushPx:t})});return n4.zF.create(e.state.doc,d)}(t);if(function(e,t){if(!e||e===n4.zF.empty)return t===n4.zF.empty||0===t.find(0,Number.MAX_SAFE_INTEGER).length;let n=e.find(0,Number.MAX_SAFE_INTEGER),r=t.find(0,Number.MAX_SAFE_INTEGER);if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++)if(n[e].from!==r[e].from||n[e].spec.pushPx!==r[e].spec.pushPx)return!1;return!0}(aW.getState(t.state),n))return!1;let r=t.state.tr.setMeta(aW,n);return r.setMeta("addToHistory",!1),t.dispatch(r),!0}let aK=nU.YY.create({name:"docsPageFlowDecoration",addProseMirrorPlugins:()=>[new n2.k_({key:aW,state:{init:()=>n4.zF.empty,apply(e,t){let n=e.getMeta(aW);return n instanceof n4.zF?n:t.map(e.mapping,e.doc)}},props:{decorations:e=>aW.getState(e)??n4.zF.empty}})]}),aQ=(0,e8.RW)(),aZ=new Set,a0=[{name:"Arial",stack:"Arial, Helvetica, sans-serif"},{name:"Calibri",stack:"Calibri, Candara, Segoe, sans-serif"},{name:"Comic Sans MS",stack:'"Comic Sans MS", cursive, sans-serif'},{name:"Courier New",stack:'"Courier New", Courier, monospace'},{name:"Georgia",stack:"Georgia, serif"},{name:"Times New Roman",stack:'"Times New Roman", Times, serif'},{name:"Trebuchet MS",stack:'"Trebuchet MS", Helvetica, sans-serif'},{name:"Verdana",stack:"Verdana, Geneva, sans-serif"}],a1="Arial";function a2(e){let t=e.find(e=>"textStyle"===e.type.name),n=t?.attrs.fontFamily;return n?.trim()?n:null}function a4(e){if(!e)return null;let t=e.trim().toLowerCase();for(let e of a0)if(e.stack.toLowerCase()===t||e.name.toLowerCase()===t||t.startsWith(`${e.name.toLowerCase()},`)||t.startsWith(`"${e.name.toLowerCase()}"`))return e.name;return null}function a5(e){let{state:t}=e,{$from:n}=t.selection;if(t.storedMarks){let e=a4(a2(t.storedMarks));if(e)return e}let r=a4(a2(n.marks()));return r||(n.parent.content.size,a1)}function a3(e,t,n,r){var a;if(t>=n)return;let i=e.chain().setTextSelection({from:t,to:n}),s=r.fontFamily?r.fontFamily.includes(",")?r.fontFamily:(a=r.fontFamily,a0.find(e=>e.name===a)?.stack??a):null;i=s?i.setFontFamily(s):i.unsetFontFamily(),i=null!=r.fontSizePx?i.setFontSize(`${r.fontSizePx}px`):i.unsetFontSize(),i=r.bold?i.setMark("bold"):i.unsetMark("bold"),i=r.italic?i.setMark("italic"):i.unsetMark("italic"),i=r.underline?i.setMark("underline"):i.unsetMark("underline"),(i=r.color?i.setColor(r.color):i.unsetColor()).run()}function a8(e,t){let n=aQ,r=(0,e8.v9)(n,t);return!!r&&(!function(e,t){let n="heading"===t.blockType&&t.level?"heading":"paragraph",r=e.chain().focus();if("heading"===n&&t.level?r.setHeading({level:t.level}):r.setParagraph(),r.updateAttributes(n,{styleId:t.id}),t.textAlign&&r.setTextAlign(t.textAlign),r.run(),!function(e,t){let{state:n}=e,{from:r,to:a}=n.selection;n.doc.nodesBetween(r,a,(e,n)=>{if("paragraph"!==e.type.name&&"heading"!==e.type.name)return;let r=n+e.content.size;return t(n+1,r+1,e.type.name),!1})}(e,(n,r)=>{a3(e,n,r,t)}),e.state.selection.empty){let{$from:n}=e.state.selection;("paragraph"===n.parent.type.name||"heading"===n.parent.type.name)&&a3(e,n.start(),n.end(),t)}}(e,r),!0)}function a6(e){let t=e.getAttributes("heading");if(t.styleId)return(0,e8.As)(String(t.styleId));let n=e.getAttributes("paragraph");return n.styleId?(0,e8.As)(String(n.styleId)):(0,e8.J4)({isHeading:e.isActive("heading"),headingLevel:t.level})}let a9=nU.YY.create({name:"docsParagraphStyle",addGlobalAttributes:()=>[{types:["paragraph","heading"],attributes:{styleId:{default:null,parseHTML:e=>e.getAttribute("data-style-id"),renderHTML:e=>{let t=e.styleId;return t?{"data-style-id":t,class:`docs-paragraph-style docs-paragraph-style--${t}`}:{}}}}}],addCommands:()=>({applyDocsParagraphStyle:e=>({editor:t})=>a8(t,e),updateDocsParagraphStyleFromSelection:e=>({editor:t})=>{let n=function(e,t){let n=aQ,r=(0,e8.v9)(n,t)??(0,e8.v9)(n,"normal");if(!r)return null;let{$from:a}=e.state.selection,i=a.parent;if("paragraph"!==i.type.name&&"heading"!==i.type.name)return null;let s=i.attrs,l=e.state.storedMarks??a.marks(),o=l.find(e=>"textStyle"===e.type.name),c=o?.attrs.fontFamily??r.fontFamily,d=o?.attrs.fontSize,u=d?Number.parseFloat(d):r.fontSizePx;return{...r,id:(0,e8.As)(t),name:r.name,scope:r.scope,blockType:"heading"===i.type.name?"heading":"paragraph",level:"heading"===i.type.name?i.attrs.level:void 0,fontFamily:c,fontSizePx:Number.isFinite(u)?u:r.fontSizePx,bold:l.some(e=>"bold"===e.type.name),italic:l.some(e=>"italic"===e.type.name),underline:l.some(e=>"underline"===e.type.name),color:l.find(e=>"textStyle"===e.type.name)?.attrs.color??r.color,textAlign:s.textAlign??r.textAlign}}(t,e);return!!n&&(t.emit("docsParagraphStyleUpdate",{styleId:e,definition:n}),!0)}})});function a7(e){return"paragraph"===e||"heading"===e}function ie(e,t,n){let r=[];if(t===n){let n=e.resolve(t);for(let e=n.depth;e>0;e-=1){let t=n.node(e);if(a7(t.type.name)){r.push({pos:n.before(e),node:t});break}}return r}return e.nodesBetween(t,n,(e,t)=>{a7(e.type.name)&&r.push({pos:t,node:e})}),r}function it(e){return Number.isFinite(e)?Math.max(0,Math.min(8,Math.round(e))):0}function ir(e,t){let{state:n}=e,r=ie(n.doc,n.selection.from,n.selection.to);if(0===r.length)return!1;let a=n.tr,i=!1;for(let{pos:e,node:n}of r){let r=it(n.attrs.indentLevel??0),s=it(r+t);s!==r&&(a=a.setNodeMarkup(e,void 0,{...n.attrs,indentLevel:s}),i=!0)}return!!i&&(e.view.dispatch(a.scrollIntoView()),!0)}let ia=nU.YY.create({name:"docsParagraphIndent",addGlobalAttributes:()=>[{types:["paragraph","heading"],attributes:{indentLevel:{default:0,parseHTML:e=>{let t=e.getAttribute("data-indent-level");if(null!=t)return it(Number.parseInt(t,10));let n=e.style?.marginLeft;if(n?.endsWith("px")){let e=Number.parseFloat(n);if(Number.isFinite(e)&&e>0)return it(Math.round(e/36))}return 0},renderHTML:e=>{let t=it(e.indentLevel??0);return t<=0?{}:{"data-indent-level":String(t),style:`margin-left: ${36*it(t)}px`}}}}}],addCommands:()=>({increaseDocsIndent:()=>({editor:e})=>!!e&&!e.isDestroyed&&(e.isActive("taskItem")?!!e.can().sinkListItem("taskItem")&&e.chain().focus().sinkListItem("taskItem").run():e.isActive("listItem")?!!e.can().sinkListItem("listItem")&&e.chain().focus().sinkListItem("listItem").run():ir(e,1)),decreaseDocsIndent:()=>({editor:e})=>!!e&&!e.isDestroyed&&(e.isActive("taskItem")?!!e.can().liftListItem("taskItem")&&e.chain().focus().liftListItem("taskItem").run():e.isActive("listItem")?!!e.can().liftListItem("listItem")&&e.chain().focus().liftListItem("listItem").run():ir(e,-1))}),addKeyboardShortcuts(){return{"Mod-]":()=>this.editor.commands.increaseDocsIndent(),"Mod-[":()=>this.editor.commands.decreaseDocsIndent()}}});function ii(e){if(0===e.length)return e[0];let t=e[0];return e.every(e=>e===t)?t:"mixed"}function is(e){let{state:t}=e;return ie(t.doc,t.selection.from,t.selection.to).map(({node:e})=>{let t=tc(e);return{attrs:t,effectiveLineHeight:function(e,t){if(null!=e.lineHeight)return e.lineHeight;if(t){let e=aQ,n=(0,e8.v9)(e,t);if(n?.lineHeight)return n.lineHeight}return 1.15}(t,e.attrs.styleId??null)}})}function il(e){if(!e||e.isDestroyed)return{lineHeight:1.15,lineHeightPresetId:"1.15",spaceBeforePt:0,spaceAfterPt:0,hasSpaceBefore:!1,hasSpaceAfter:!1,keepWithNext:!1,keepLinesTogether:!1,preventWidowOrphan:!1,pageBreakBefore:!1};let t=is(e);if(0===t.length){let t=a6(e),n=aQ,r=(0,e8.v9)(n,t),a=r?.lineHeight??1.15;return{lineHeight:a,lineHeightPresetId:ts(a),spaceBeforePt:0,spaceAfterPt:0,hasSpaceBefore:!1,hasSpaceAfter:!1,keepWithNext:!1,keepLinesTogether:!1,preventWidowOrphan:!1,pageBreakBefore:!1}}let n=t.map(e=>e.effectiveLineHeight),r=ii(n),a=ii(n.map(e=>ts(e))),i=t.map(e=>e.attrs.spaceBeforePt),s=t.map(e=>e.attrs.spaceAfterPt);return{lineHeight:"mixed"===r?null:r,lineHeightPresetId:a,spaceBeforePt:ii(i),spaceAfterPt:ii(s),hasSpaceBefore:ii(i.map(e=>e>=12)),hasSpaceAfter:ii(s.map(e=>e>=12)),keepWithNext:ii(t.map(e=>e.attrs.keepWithNext)),keepLinesTogether:ii(t.map(e=>e.attrs.keepLinesTogether)),preventWidowOrphan:ii(t.map(e=>e.attrs.preventWidowOrphan)),pageBreakBefore:ii(t.map(e=>e.attrs.pageBreakBefore))}}function io(e,t){let{state:n}=e,r=ie(n.doc,n.selection.from,n.selection.to);if(0===r.length)return!1;let a=n.tr,i=!1;for(let{pos:e,node:n}of r){let r=tc(n),s={...r,...t};(r.lineHeight!==s.lineHeight||r.spaceBeforePt!==s.spaceBeforePt||r.spaceAfterPt!==s.spaceAfterPt||r.keepWithNext!==s.keepWithNext||r.keepLinesTogether!==s.keepLinesTogether||r.preventWidowOrphan!==s.preventWidowOrphan||r.pageBreakBefore!==s.pageBreakBefore)&&(a=a.setNodeMarkup(e,void 0,{...n.attrs,...s}),i=!0)}return!!i&&(e.view.dispatch(a.scrollIntoView()),!0)}function ic(e,t){return!!e&&!e.isDestroyed&&io(e,t)}function id(e){if(!e||e.isDestroyed)return{...ti};let t=is(e);if(0===t.length)return{...ti};let n=t[0].attrs;return{...ti,...n}}function iu(e){return!0===e||"true"===e||"1"===e}let ih=nU.YY.create({name:"docsParagraphSpacing",addGlobalAttributes:()=>[{types:["paragraph","heading"],attributes:{lineHeight:{default:ti.lineHeight,parseHTML:e=>{let t=e.getAttribute("data-line-height");if(null!=t)return tl(t);let n=e.style?.lineHeight;if(!n)return null;let r=Number.parseFloat(n);return Number.isFinite(r)?r:null},renderHTML:e=>{let t,n,r,a;return t=tc({attrs:e}),n=[],null!=t.lineHeight&&n.push(`line-height: ${t.lineHeight}`),t.spaceBeforePt>0&&n.push(`margin-top: ${t.spaceBeforePt}pt`),t.spaceAfterPt>0&&n.push(`margin-bottom: ${t.spaceAfterPt}pt`),t.keepWithNext&&n.push("break-after: avoid"),t.keepLinesTogether&&n.push("break-inside: avoid"),t.preventWidowOrphan&&n.push("orphans: 2; widows: 2"),t.pageBreakBefore&&n.push("break-before: page"),r=n.join("; "),a={},null!=t.lineHeight&&(a["data-line-height"]=String(t.lineHeight)),t.spaceBeforePt>0&&(a["data-space-before-pt"]=String(t.spaceBeforePt)),t.spaceAfterPt>0&&(a["data-space-after-pt"]=String(t.spaceAfterPt)),t.keepWithNext&&(a["data-keep-with-next"]="true"),t.keepLinesTogether&&(a["data-keep-lines-together"]="true"),t.preventWidowOrphan&&(a["data-prevent-widow-orphan"]="true"),t.pageBreakBefore&&(a["data-page-break-before"]="true"),r&&(a.style=r),t.pageBreakBefore&&(a.class="docs-paragraph-spacing--page-break-before"),a}},spaceBeforePt:{default:0,parseHTML:e=>to(e.getAttribute("data-space-before-pt")),renderHTML:()=>({})},spaceAfterPt:{default:0,parseHTML:e=>to(e.getAttribute("data-space-after-pt")),renderHTML:()=>({})},keepWithNext:{default:!1,parseHTML:e=>iu(e.getAttribute("data-keep-with-next")),renderHTML:()=>({})},keepLinesTogether:{default:!1,parseHTML:e=>iu(e.getAttribute("data-keep-lines-together")),renderHTML:()=>({})},preventWidowOrphan:{default:!1,parseHTML:e=>iu(e.getAttribute("data-prevent-widow-orphan")),renderHTML:()=>({})},pageBreakBefore:{default:!1,parseHTML:e=>iu(e.getAttribute("data-page-break-before")),renderHTML:()=>({})}}}],addCommands:()=>({setDocsLineHeight:e=>({editor:t})=>!!t&&!t.isDestroyed&&io(t,{lineHeight:e}),setDocsCustomSpacing:e=>({editor:t})=>ic(t,e),toggleDocsSpaceBefore:()=>({editor:e})=>(function(e){if(!e||e.isDestroyed)return!1;let t=is(e);return 0!==t.length&&io(e,{spaceBeforePt:12*!t.every(e=>e.attrs.spaceBeforePt>=12)})})(e),toggleDocsSpaceAfter:()=>({editor:e})=>(function(e){if(!e||e.isDestroyed)return!1;let t=is(e);return 0!==t.length&&io(e,{spaceAfterPt:12*!t.every(e=>e.attrs.spaceAfterPt>=12)})})(e),toggleDocsKeepWithNext:()=>({editor:e})=>(function(e){if(!e||e.isDestroyed)return!1;let t=is(e);return 0!==t.length&&io(e,{keepWithNext:!t.every(e=>e.attrs.keepWithNext)})})(e),toggleDocsKeepLinesTogether:()=>({editor:e})=>(function(e){if(!e||e.isDestroyed)return!1;let t=is(e);return 0!==t.length&&io(e,{keepLinesTogether:!t.every(e=>e.attrs.keepLinesTogether)})})(e),toggleDocsPreventWidowOrphan:()=>({editor:e})=>(function(e){if(!e||e.isDestroyed)return!1;let t=is(e);return 0!==t.length&&io(e,{preventWidowOrphan:!t.every(e=>e.attrs.preventWidowOrphan)})})(e),toggleDocsPageBreakBefore:()=>({editor:e})=>(function(e){if(!e||e.isDestroyed)return!1;let t=is(e);return 0!==t.length&&io(e,{pageBreakBefore:!t.every(e=>e.attrs.pageBreakBefore)})})(e)})});function im(e){if(0===e.length)return e[0];let t=e[0];return e.every(e=>e===t)?t:"mixed"}function ip(e,t,n){let r=[],a=(e,t)=>{("bulletList"===t.type.name||"orderedList"===t.type.name||"taskList"===t.type.name)&&r.push({pos:e,node:t,kind:t.type.name})};if(t===n){let n=e.resolve(t);for(let e=n.depth;e>0;e-=1){let t=n.node(e);if("bulletList"===t.type.name||"orderedList"===t.type.name||"taskList"===t.type.name){a(n.before(e),t);break}}return r}return e.nodesBetween(t,n,(e,t)=>{("bulletList"===e.type.name||"orderedList"===e.type.name||"taskList"===e.type.name)&&a(t,e)}),r}function ig(e,t,n){let{state:r}=e,a=ip(r.doc,r.selection.from,r.selection.to).filter(e=>e.kind===t);if(0===a.length)return!1;let i=r.tr,s=!1;for(let{pos:e,node:t}of a)i=i.setNodeMarkup(e,void 0,{...t.attrs,...n}),s=!0;return!!s&&(e.view.dispatch(i.scrollIntoView()),!0)}function ix(e,t){let n=e.chain().focus(),r=!1;return"taskList"!==t&&e.isActive("taskList")&&(n=n.toggleTaskList(),r=!0),"orderedList"!==t&&e.isActive("orderedList")&&(n=n.toggleOrderedList(),r=!0),"bulletList"!==t&&e.isActive("bulletList")&&(n=n.toggleBulletList(),r=!0),r&&n.run(),r}function ib(e){if(!e||e.isDestroyed)return{isBulletList:!1,isOrderedList:!1,isTaskList:!1,bulletStyleId:null,orderedStyleId:null,checklistStyleId:null,orderedStart:1};let t=ip(e.state.doc,e.state.selection.from,e.state.selection.to),n=t.filter(e=>"bulletList"===e.kind),r=t.filter(e=>"orderedList"===e.kind),a=t.filter(e=>"taskList"===e.kind);return{isBulletList:e.isActive("bulletList"),isOrderedList:e.isActive("orderedList"),isTaskList:e.isActive("taskList"),bulletStyleId:0===n.length?null:im(n.map(e=>eQ(e.node.attrs.bulletStyle??eV))),orderedStyleId:0===r.length?null:im(r.map(e=>eZ(e.node.attrs.orderedStyle??eK))),checklistStyleId:0===a.length?null:im(a.map(e=>e.node.attrs.checklistStyle??"simple")),orderedStart:0===r.length?1:im(r.map(e=>e.node.attrs.start??1))}}let iy=nU.YY.create({name:"docsListStyles",addGlobalAttributes:()=>[{types:["bulletList"],attributes:{bulletStyle:{default:eV,parseHTML:e=>eQ(e.getAttribute("data-bullet-style")),renderHTML:e=>{let t=eQ(e.bulletStyle);return{"data-bullet-style":t,class:`docs-bullet-list docs-bullet-list--${t}`}}}}},{types:["orderedList"],attributes:{orderedStyle:{default:eK,parseHTML:e=>eZ(e.getAttribute("data-ordered-style")),renderHTML:e=>{let t=eZ(e.orderedStyle);return{"data-ordered-style":t,class:`docs-ordered-list docs-ordered-list--${t}`}}}}},{types:["taskList"],attributes:{checklistStyle:{default:"simple",parseHTML:e=>"strikethrough"===e.getAttribute("data-checklist-style")?"strikethrough":"simple",renderHTML:e=>{let t=e.checklistStyle??"simple";return{"data-checklist-style":t,class:`docs-task-list docs-task-list--${t}`}}}}}],addCommands:()=>({applyDocsBulletStyle:e=>({editor:t})=>!!t&&!t.isDestroyed&&(ix(t,"bulletList"),t.isActive("bulletList")||t.chain().focus().toggleBulletList().run(),ig(t,"bulletList",{bulletStyle:e})),applyDocsOrderedStyle:e=>({editor:t})=>(function(e,t){if(!e||e.isDestroyed)return!1;let n=e.isActive("orderedList");ix(e,"orderedList"),e.isActive("orderedList")||e.chain().focus().toggleOrderedList().run();let r=eJ.find(e=>e.id===t),a={orderedStyle:t,type:r.olType??null};return n||(a.start=1),ig(e,"orderedList",a)})(t,e),applyDocsChecklistStyle:e=>({editor:t})=>!!t&&!t.isDestroyed&&(ix(t,"taskList"),t.isActive("taskList")||t.chain().focus().toggleTaskList().run(),ig(t,"taskList",{checklistStyle:e})),restartDocsOrderedList:()=>({editor:e})=>!!e&&!e.isDestroyed&&!!e.isActive("orderedList")&&ig(e,"orderedList",{start:1}),continueDocsOrderedList:()=>({editor:e})=>(function(e){if(!e||e.isDestroyed||!e.isActive("orderedList"))return!1;let{state:t}=e,n=ip(t.doc,t.selection.from,t.selection.to).filter(e=>"orderedList"===e.kind);if(0===n.length)return!1;let r=n[0].pos,a=t.doc.resolve(r),i=a.parent,s=a.index(),l=1;for(let e=s-1;e>=0;e-=1){let t=i.child(e);if("orderedList"===t.type.name){l=(t.attrs.start??1)+t.childCount;break}}return ig(e,"orderedList",{start:l})})(e),setDocsOrderedListStart:e=>({editor:t})=>!!t&&!t.isDestroyed&&!!t.isActive("orderedList")&&ig(t,"orderedList",{start:Math.max(1,Math.round(e))})})});var ij=n(53095);let iv="ultidrive-richtext-region-editor max-w-none outline-none focus:outline-none prose prose-sm";function iw(e,t){let n=[];return null!=t&&n.push(`min-height:${t}px`),null!=e&&n.push(`max-height:${e}px`,"overflow-y:auto"),n.length>0?n.join(";"):void 0}function iN({content:e,editable:t,placeholder:n,className:i,maxHeightPx:l,minHeightPx:o,onUpdate:c,onBlur:d,onEditorReady:u,onContentHeightChange:h,autoFocus:m}){let p=(0,a.useRef)(!1),g=(0,a.useRef)(null),f=iw(l,o),x=(0,s.hG)({immediatelyRender:!1,editable:t,extensions:[nB.A.configure({heading:{levels:[1,2,3,4]}}),n$.A,nO.Ay.configure({openOnClick:!1}),n_.xJ,n_.ay,n_.Z4,n_.Q1,n_.i0,nq.Ay.configure({multicolor:!0}),nW.A.configure({types:["heading","paragraph"],alignments:["left","center","right","justify"]}),rl.configure(ro),rs,ra,ri,aI,aT,aE,aO,nG.Ay.configure({inline:!0,allowBase64:!0}),nY.A.configure({placeholder:n??"Saisissez un en-t\xeate ou un pied de page"})],content:e??{type:"doc",content:[{type:"paragraph"}]},editorProps:{attributes:{class:iv,...f?{style:f}:{}}},onUpdate:({editor:e})=>{p.current||c?.(e.getJSON())},onBlur:()=>d?.()});return((0,a.useEffect)(()=>(u?.(x),()=>u?.(null)),[x,u]),(0,a.useEffect)(()=>{x&&e&&(p.current=!0,x.commands.setContent(e,{emitUpdate:!1}),p.current=!1)},[e,x]),(0,a.useEffect)(()=>{x?.setEditable(t),t&&m&&requestAnimationFrame(()=>x?.commands.focus("end"))},[m,t,x]),(0,a.useEffect)(()=>{if(!x)return;let e=iw(l,o);x.setOptions({editorProps:{attributes:{class:iv,...e?{style:e}:{}}}})},[x,l,o]),(0,a.useEffect)(()=>{let e=g.current;if(!e||!h)return;let t=e.querySelector(".ProseMirror");if(!t)return;let n=()=>{requestAnimationFrame(()=>h(t.offsetHeight))};n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[x,h]),x)?(0,r.jsx)("div",{ref:g,className:(0,v.cn)("docs-region-editor-root",null==l&&"docs-region-editor-root--grow"),style:null!=o?{minHeight:o}:void 0,children:(0,r.jsx)(s.$Z,{editor:x,className:(0,v.cn)("docs-region-editor",null==l?"docs-region-editor--grow":"h-full",i),style:null!=l?{height:l,maxHeight:l}:void 0})}):null}function ik({open:e,onOpenChange:t,pageSetup:n,onApply:i}){let s=nx(n?.headerMarginMm??n?.marginsMm.top??20),l=nx(n?.footerMarginMm??n?.marginsMm.bottom??20),[o,c]=(0,a.useState)(s),[d,u]=(0,a.useState)(l),[h,m]=(0,a.useState)(n?.headerFooterDifferentFirstPage??!1),[p,g]=(0,a.useState)(n?.headerFooterDifferentOddEven??!1);return(0,r.jsx)(tt.lG,{open:e,onOpenChange:t,children:(0,r.jsxs)(tt.Cf,{className:"max-w-md",children:[(0,r.jsx)(tt.c7,{children:(0,r.jsx)(tt.L3,{children:"En-t\xeates et pieds de page"})}),(0,r.jsxs)("div",{className:"space-y-4 py-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-2 text-sm font-medium",children:"Marges"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(tr.J,{className:"text-xs text-muted-foreground",children:"En-t\xeate (cm depuis le haut)"}),(0,r.jsx)(tn.p,{type:"number",min:0,step:.1,value:o,onChange:e=>c(Number(e.target.value)||0)})]}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(tr.J,{className:"text-xs text-muted-foreground",children:"Pied de page (cm depuis le bas)"}),(0,r.jsx)(tn.p,{type:"number",min:0,step:.1,value:d,onChange:e=>u(Number(e.target.value)||0)})]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-2 text-sm font-medium",children:"Mise en page"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)(rB.S,{checked:h,onCheckedChange:e=>m(!0===e)}),"Premi\xe8re page diff\xe9rente"]}),(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)(rB.S,{checked:p,onCheckedChange:e=>g(!0===e)}),"Diff\xe9rente pour les pages paires et impaires"]})]})]})]}),(0,r.jsxs)(tt.Es,{children:[(0,r.jsx)(b.$,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Annuler"}),(0,r.jsx)(b.$,{type:"button",onClick:()=>{i({headerMarginMm:nb(o),footerMarginMm:nb(d),headerFooterDifferentFirstPage:h,headerFooterDifferentOddEven:p}),t(!1)},children:"Appliquer"})]})]})})}function iC({open:e,onOpenChange:t,settings:n,onApply:i}){let[s,l]=(0,a.useState)(n?.placement??"header"),[o,c]=(0,a.useState)(n?.startAt??1),[d,u]=(0,a.useState)(n?.showOnFirstPage??!0);return(0,r.jsx)(tt.lG,{open:e,onOpenChange:t,children:(0,r.jsxs)(tt.Cf,{className:"max-w-md",children:[(0,r.jsx)(tt.c7,{children:(0,r.jsx)(tt.L3,{children:"Num\xe9ros de page"})}),(0,r.jsxs)("div",{className:"space-y-4 py-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-2 text-sm font-medium",children:"Position"}),(0,r.jsxs)("div",{className:"flex gap-4 text-sm",children:[(0,r.jsxs)("label",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{type:"radio",name:"page-num-placement",checked:"header"===s,onChange:()=>l("header")}),"En-t\xeate"]}),(0,r.jsxs)("label",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{type:"radio",name:"page-num-placement",checked:"footer"===s,onChange:()=>l("footer")}),"Pied de page"]})]})]}),(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,r.jsx)(rB.S,{checked:d,onCheckedChange:e=>u(!0===e)}),"Afficher sur la premi\xe8re page"]}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(tr.J,{className:"text-xs text-muted-foreground",children:"Commencer \xe0"}),(0,r.jsx)(tn.p,{type:"number",min:0,value:o,onChange:e=>c(Number(e.target.value)||0),className:"w-24"})]})]}),(0,r.jsxs)(tt.Es,{children:[(0,r.jsx)(b.$,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Annuler"}),(0,r.jsx)(b.$,{type:"button",onClick:()=>{i({enabled:!0,placement:s,align:"right",startAt:o,showOnFirstPage:d}),t(!1)},children:"Appliquer"})]})]})})}var iS=n(51551);function iA({label:e,pageWidth:t,barTop:n,placement:a,showFirstPageCheckbox:i,differentFirstPage:s,onDifferentFirstPageChange:l,onFormatOpen:o,onPageNumOpen:c,onRemove:d}){return(0,r.jsx)("div",{className:(0,v.cn)("docs-hf-chrome pointer-events-none absolute","footer"===a&&"docs-hf-chrome--footer"),style:{top:n,left:0,width:t,height:28},children:(0,r.jsxs)("div",{className:(0,v.cn)("docs-hf-chrome__bar pointer-events-auto flex h-full items-center justify-between bg-[#f1f3f4] px-4","header"===a?"border-t border-[#dadce0]":"border-b border-[#dadce0]"),onMouseDown:e=>e.preventDefault(),children:[(0,r.jsx)("span",{className:"docs-hf-chrome__label",children:e}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[i?(0,r.jsxs)("label",{className:"docs-hf-chrome__checkbox-label flex cursor-pointer items-center gap-2",children:[(0,r.jsx)(rB.S,{checked:s,onCheckedChange:e=>l(!0===e),className:"docs-hf-chrome__checkbox"}),"Premi\xe8re page diff\xe9rente"]}):null,(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsxs)(b.$,{type:"button",variant:"ghost",size:"sm",className:"docs-hf-chrome__options h-7 gap-1 px-1.5 hover:bg-transparent dark:hover:bg-transparent",children:["Options",(0,r.jsx)(nt.A,{className:"size-3.5"})]})}),(0,r.jsxs)(iS.SQ,{align:"end",children:[(0,r.jsx)(iS._2,{onClick:o,children:"En-t\xeate"===e?"Format de l'en-t\xeate":"Format du pied de page"}),(0,r.jsx)(iS._2,{onClick:c,children:"Num\xe9ros de page"}),(0,r.jsx)(iS._2,{onClick:d,children:"En-t\xeate"===e?"Supprimer l'en-t\xeate":"Supprimer le pied de page"})]})]})]})]})})}function iM({region:e,pageLayout:t,pageIndex:n,pageTop:i,pageWidth:s,pageHeight:l,margins:o,editable:c,editingTarget:d,onStartEdit:u,onStopEdit:h,onContentChange:m,onPageSetupChange:p,onRegionEditorReady:g,onRegionHeightMeasure:f}){let x="header"===e,b=d?.region===e&&d.pageIndex===n,y=nF(t,e,n),j=t.headerFooterDifferentFirstPage??!1,w=nR(t,i,n),N=nH(t,i,l,n),k=o.left,C=s-o.left-o.right,S=x?w.zoneHeight:N.zoneHeight,A=x?nT(t):nD(t),[M,z]=(0,a.useState)(S),P=(0,a.useRef)(S);P.current=M,(0,a.useEffect)(()=>{b||z(e=>Math.min(e,S))},[b,S]);let I=b?Math.max(A,M):Math.max(20,M),T=x?w.zoneTop:N.zoneBottom-I,D=w.zoneTop+I,L=N.zoneBottom-I-28,F=x?D:L,E=x?T:L,R=I+28,[H,B]=(0,a.useState)(!1),[$,O]=(0,a.useState)(!1),W=(0,a.useRef)(null),_=(0,a.useRef)(null),q=(0,a.useCallback)((t,r=!1)=>{_.current=t,m(e,t,{pageIndex:n,contentHeightPx:Math.max(A,P.current)},r?{immediate:!0}:void 0)},[A,m,n,e]),G=(0,a.useCallback)(e=>{_.current=e,W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{q(e)},800)},[q]),Y=t.pageNumbers?.enabled&&t.pageNumbers.placement===e&&(t.pageNumbers.showOnFirstPage||n>0)?(t.pageNumbers.startAt??1)+n:null,U=(0,a.useCallback)(()=>{m(e,{type:"doc",content:[{type:"paragraph"}]},{pageIndex:n,contentHeightPx:A},{immediate:!0}),p(x?{header:null,headerFirstPage:null}:{footer:null,footerFirstPage:null}),h()},[x,A,m,p,h,n,e]),X={widthMm:t.format.widthMm,heightMm:t.format.heightMm,marginsMm:{top:ng(t.marginsPx.top),right:ng(t.marginsPx.right),bottom:ng(t.marginsPx.bottom),left:ng(t.marginsPx.left)},headerMarginMm:t.headerMarginMm,footerMarginMm:t.footerMarginMm,headerFooterDifferentFirstPage:j,headerFooterDifferentOddEven:t.headerFooterDifferentOddEven,pageNumbers:t.pageNumbers,header:t.header,footer:t.footer,headerFirstPage:t.headerFirstPage,footerFirstPage:t.footerFirstPage},J=y?.content&&function(e){if(!e)return"";let t=[],n=e=>{!e||"object"!=typeof e||("string"==typeof e.text&&t.push(e.text),Array.isArray(e.content)&&e.content.forEach(n))};return n(e),t.join(" ").trim()}(y.content).length>0,V=x?"En-t\xeate":"Pied de page",K=t=>{c&&(t.preventDefault(),t.stopPropagation(),u(e,n))},Q=(0,a.useCallback)(t=>{let r=Math.max(20,t);z(r),f?.({region:e,pageIndex:n,heightPx:r})},[f,n,e]);(0,a.useEffect)(()=>()=>{W.current&&clearTimeout(W.current)},[]);let Z=(0,a.useRef)(!1);return(0,a.useEffect)(()=>{Z.current&&!b&&(W.current&&(clearTimeout(W.current),W.current=null),q(_.current??y?.content??{type:"doc",content:[{type:"paragraph"}]},!0)),Z.current=b},[b,q,y?.content]),(0,r.jsxs)(r.Fragment,{children:[b?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"docs-hf-editing-backdrop pointer-events-none absolute",style:{top:T,left:0,width:s,height:I,backgroundColor:t.pageColor},"aria-hidden":!0}),(0,r.jsx)("div",{className:"docs-hf-lateral-border pointer-events-none absolute border-l border-[#dadce0]",style:{top:E,left:0,height:R},"aria-hidden":!0}),(0,r.jsx)("div",{className:"docs-hf-lateral-border pointer-events-none absolute border-r border-[#dadce0]",style:{top:E,right:0,width:0,height:R},"aria-hidden":!0}),x?(0,r.jsx)("div",{className:"docs-hf-separator pointer-events-none absolute border-t border-[#dadce0]",style:{top:w.zoneTop,left:0,width:s},"aria-hidden":!0}):(0,r.jsx)("div",{className:"docs-hf-separator pointer-events-none absolute border-b border-[#dadce0]",style:{top:N.zoneBottom,left:0,width:s},"aria-hidden":!0}),(0,r.jsx)(iA,{label:V,pageWidth:s,barTop:F,placement:e,showFirstPageCheckbox:0===n,differentFirstPage:j,onDifferentFirstPageChange:e=>{p(e?{headerFooterDifferentFirstPage:!0,headerFirstPage:X.headerFirstPage??X.header??null,footerFirstPage:X.footerFirstPage??X.footer??null}:{headerFooterDifferentFirstPage:!1})},onFormatOpen:()=>B(!0),onPageNumOpen:()=>O(!0),onRemove:U})]}):null,b||J||!c?null:(0,r.jsx)("div",{className:"docs-hf-hit-area absolute cursor-text",style:{top:x?w.zoneTop:N.zoneBottom-A,left:k,width:C,height:A},onDoubleClick:K,"aria-hidden":!0}),b||J?(0,r.jsxs)("div",{className:(0,v.cn)("docs-hf-band absolute",x?"docs-hf-band--header":"docs-hf-band--footer",b&&"docs-hf-band--editing"),style:{top:T,left:k,width:C,height:I,...b?{backgroundColor:t.pageColor,"--docs-hf-page-color":t.pageColor}:{}},onDoubleClick:K,children:[(0,r.jsx)(iN,{content:y?.content,editable:b,autoFocus:b,placeholder:V,minHeightPx:b?A:void 0,onUpdate:b?G:void 0,onBlur:b?()=>{requestAnimationFrame(()=>{let e=document.activeElement;e?.closest(".docs-hf-chrome")||e?.closest('[role="dialog"]')||e?.closest("[data-radix-popper-content-wrapper]")||h()})}:void 0,onEditorReady:b?g:void 0,onContentHeightChange:Q}),null==Y||b?null:(0,r.jsx)("div",{className:(0,v.cn)("pointer-events-none absolute text-[11px] text-[#5f6368]",t.pageNumbers?.align==="center"?"left-1/2 -translate-x-1/2":t.pageNumbers?.align==="left"?"left-0":"right-0",x?"top-0":"bottom-0"),children:Y})]}):null,b?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ik,{open:H,onOpenChange:B,pageSetup:X,onApply:p}),(0,r.jsx)(iC,{open:$,onOpenChange:O,settings:t.pageNumbers,onApply:e=>p({pageNumbers:e})})]}):null]})}var iz=n(83119);function iP({pageCount:e,pageLayout:t,pageWidth:n,pageHeight:a,pageColor:i,pageRegionHeights:s}){return(0,r.jsx)(r.Fragment,{children:Array.from({length:e},(e,l)=>{let o=l*(a+iz.sl),c=nR(t,o,l),d=nH(t,o,a,l),u=s?.[`header-${l}`]??c.zoneHeight,h=s?.[`footer-${l}`]??d.zoneHeight,m=c.zoneTop+u,p=d.zoneBottom-h;return(0,r.jsxs)("div",{"aria-hidden":!0,children:[(0,r.jsx)("div",{className:"docs-body-margin-mask pointer-events-none absolute z-[15] box-border border-l border-r border-[#dadce0] dark:border-[#5f6368]",style:{top:o,left:0,width:n,height:m,backgroundColor:i}}),(0,r.jsx)("div",{className:"docs-body-margin-mask pointer-events-none absolute z-[15] box-border border-l border-r border-[#dadce0] dark:border-[#5f6368]",style:{top:p,left:0,width:n,height:o+a-p,backgroundColor:i}})]},`body-mask-${l}`)})})}function iI({pageCount:e,pageHeight:t,pageWidth:n,margins:a,pageColor:i,interPageSpacer:s}){return e<=1?null:(0,r.jsx)(r.Fragment,{children:Array.from({length:e-1},(e,l)=>{let o=l*(t+iz.sl)+t,c=o-a.bottom;return(0,r.jsxs)("div",{"aria-hidden":!0,children:[(0,r.jsx)("div",{className:"docs-page-inter-margin-gutter pointer-events-none absolute z-[19] border-l border-[#dadce0] dark:border-[#5f6368]",style:{top:c,left:0,width:a.left,height:s,backgroundColor:i}}),(0,r.jsx)("div",{className:"docs-page-inter-margin-gutter pointer-events-none absolute z-[19] border-r border-[#dadce0] dark:border-[#5f6368]",style:{top:c,left:n-a.right,width:a.right,height:s,backgroundColor:i}}),(0,r.jsx)("div",{className:"docs-page-gap-band pointer-events-none absolute z-[20]",style:{top:o,left:0,width:n,height:iz.sl}})]},`page-sep-${l}`)})})}function iT({pageCount:e,pageHeight:t,pageWidth:n,sheetBorderCss:a}){return(0,r.jsx)(r.Fragment,{children:Array.from({length:e},(e,i)=>{let s=i*(t+iz.sl);return(0,r.jsx)("div",{className:(0,v.cn)("docs-page-rim pointer-events-none absolute z-[22] box-border",a&&"docs-page-rim--imported"),style:{top:s,left:0,width:n,height:t,...a?{borderTop:a.top??"none",borderRight:a.right??"none",borderBottom:a.bottom??"none",borderLeft:a.left??"none",boxShadow:"none"}:{}},"aria-hidden":!0},`page-rim-${i}`)})})}let iD="ultidocs:region-edit-start";function iL(e,t=0){window.dispatchEvent(new CustomEvent(iD,{detail:{region:e,pageIndex:t}}))}function iF(e,t){let{bodyAreaHeight:n,interPageSpacer:r}=t;return e*n+Math.max(0,e-1)*r}let iE=25.4*nc,iR=(0,a.memo)(function({pageWidth:e,pageHeight:t}){let n=(0,a.useSyncExternalStore)(rw.p0,rw.BM,()=>null);if(!n||0===n.guides.length)return null;let i=n.pageIndex*(t+iz.sl);return(0,r.jsx)("div",{className:"pointer-events-none absolute left-0 top-0 z-[24]",style:{width:e,height:i+t},"aria-hidden":!0,children:n.guides.map((n,a)=>"x"===n.axis?(0,r.jsx)("div",{className:"docs-graphic-snap-guide docs-graphic-snap-guide--vertical",style:{left:n.position,top:i,height:t}},`v-${n.position}-${a}`):(0,r.jsx)("div",{className:"docs-graphic-snap-guide docs-graphic-snap-guide--horizontal",style:{top:i+n.position,left:0,width:e}},`h-${n.position}-${a}`))})});function iH(e,t,n){if(e.isDestroyed||!e.isInitialized)return;let r=e.view.posAtCoords({left:t,top:n});if(r)return void e.chain().focus().setTextSelection(r.pos).run();let a=e.view.dom,i=a.getBoundingClientRect();if(i.width<=0||i.height<=0)return void e.chain().focus("end").run();let s=Math.min(Math.max(t,i.left+1),i.right-1),l=Math.min(Math.max(n,i.top+1),i.bottom-1),o=e.view.posAtCoords({left:s,top:l});if(o)return void e.chain().focus().setTextSelection(o.pos).run();let c=aq(a);c&&n-i.top>=c.bodyAreaH?e.chain().focus("end").run():e.chain().focus(n<i.top+i.height/2?"start":"end").run()}function iB(e="#000000"){return{size:8,style:"single",color:e}}function i$(e){return!!e&&e.isActive("table")}function iO(e){return!!e&&e.can().mergeCells()}function iW(e){return!!e&&e.can().splitCell()}function i_(e,t){e?.chain().focus().setCellAttribute("backgroundColor",t||null).run()}function iq(e,t){e?.chain().focus().setCellAttribute("verticalAlign",t).run()}function iG(e,t){e&&e.chain().focus().setCellAttribute("borderTop",t).setCellAttribute("borderRight",t).setCellAttribute("borderBottom",t).setCellAttribute("borderLeft",t).run()}function iY(e){iG(e,null)}function iU(e,t){e&&e.isActive("table")&&e.chain().focus().updateAttributes("tableRow",{rowHeight:t}).run()}function iX(e,t){e&&e.isActive("table")&&e.chain().focus().updateAttributes("table",{alignment:t}).run()}function iJ({editor:e,disabled:t,children:n}){let i=(0,a.useRef)(null),[s,l]=(0,a.useState)(!1),o=s&&iO(e),c=s&&iW(e);return(0,r.jsxs)(rI.tz,{onOpenChange:t=>{if(t){let t;(t=i.current)&&iH(e,t.x,t.y),l(e.isActive("table"))}else l(!1)},children:[(0,r.jsx)(rI.Rc,{asChild:!0,disabled:t,onContextMenu:e=>{i.current={x:e.clientX,y:e.clientY}},children:n}),(0,r.jsxs)(rI.Ip,{className:"min-w-56",onCloseAutoFocus:e=>e.preventDefault(),children:[(0,r.jsx)(rI.kt,{onClick:()=>document.execCommand("cut"),children:"Couper"}),(0,r.jsx)(rI.kt,{onClick:()=>document.execCommand("copy"),children:"Copier"}),(0,r.jsx)(rI.kt,{onClick:()=>document.execCommand("paste"),children:"Coller"}),(0,r.jsx)(rI.kt,{onClick:()=>e.chain().focus().deleteSelection().run(),children:"Supprimer"}),s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(rI.K5,{}),(0,r.jsx)(rI.kt,{onClick:()=>e.chain().focus().addRowBefore().run(),children:"Ins\xe9rer une ligne au-dessus"}),(0,r.jsx)(rI.kt,{onClick:()=>e.chain().focus().addRowAfter().run(),children:"Ins\xe9rer une ligne en dessous"}),(0,r.jsx)(rI.kt,{onClick:()=>e.chain().focus().addColumnBefore().run(),children:"Ins\xe9rer une colonne \xe0 gauche"}),(0,r.jsx)(rI.kt,{onClick:()=>e.chain().focus().addColumnAfter().run(),children:"Ins\xe9rer une colonne \xe0 droite"}),(0,r.jsx)(rI.K5,{}),(0,r.jsx)(rI.kt,{disabled:!o,onClick:()=>e.chain().focus().mergeCells().run(),children:"Fusionner les cellules"}),(0,r.jsx)(rI.kt,{disabled:!c,onClick:()=>e.chain().focus().splitCell().run(),children:"Scinder la cellule"}),(0,r.jsx)(rI.K5,{}),(0,r.jsxs)(rI.Fj,{children:[(0,r.jsx)(rI.Pd,{children:"Couleur de cellule"}),(0,r.jsx)(rI.es,{children:tf.map(t=>(0,r.jsx)(rI.kt,{onClick:()=>i_(e,t.color||null),children:t.label},t.id||"none"))})]}),(0,r.jsxs)(rI.Fj,{children:[(0,r.jsx)(rI.Pd,{children:"Bordures"}),(0,r.jsxs)(rI.es,{children:[(0,r.jsx)(rI.kt,{onClick:()=>iG(e,iB("#000000")),children:"Bordures noires"}),(0,r.jsx)(rI.kt,{onClick:()=>iY(e),children:"Supprimer les bordures"}),tx.slice(0,6).map(t=>(0,r.jsx)(rI.kt,{onClick:()=>iG(e,iB(t)),children:t},t))]})]}),(0,r.jsxs)(rI.Fj,{children:[(0,r.jsx)(rI.Pd,{children:"Alignement vertical"}),(0,r.jsxs)(rI.es,{children:[(0,r.jsx)(rI.kt,{onClick:()=>iq(e,"top"),children:"Haut"}),(0,r.jsx)(rI.kt,{onClick:()=>iq(e,"middle"),children:"Milieu"}),(0,r.jsx)(rI.kt,{onClick:()=>iq(e,"bottom"),children:"Bas"})]})]}),(0,r.jsxs)(rI.Fj,{children:[(0,r.jsx)(rI.Pd,{children:"Alignement du tableau"}),(0,r.jsxs)(rI.es,{children:[(0,r.jsx)(rI.kt,{onClick:()=>iX(e,"left"),children:"Gauche"}),(0,r.jsx)(rI.kt,{onClick:()=>iX(e,"center"),children:"Centre"}),(0,r.jsx)(rI.kt,{onClick:()=>iX(e,"right"),children:"Droite"})]})]}),(0,r.jsxs)(rI.Fj,{children:[(0,r.jsx)(rI.Pd,{children:"Hauteur de ligne"}),(0,r.jsxs)(rI.es,{children:[(0,r.jsx)(rI.kt,{onClick:()=>iU(e,"32px"),children:"Compacte"}),(0,r.jsx)(rI.kt,{onClick:()=>iU(e,"48px"),children:"Normale"}),(0,r.jsx)(rI.kt,{onClick:()=>iU(e,null),children:"Automatique"})]})]}),(0,r.jsx)(rI.K5,{}),(0,r.jsx)(rI.kt,{onClick:()=>e.chain().focus().toggleHeaderRow().run(),children:"Ligne d'en-t\xeate"}),(0,r.jsx)(rI.kt,{onClick:()=>e.chain().focus().toggleHeaderColumn().run(),children:"Colonne d'en-t\xeate"}),(0,r.jsx)(rI.K5,{}),(0,r.jsx)(rI.kt,{onClick:()=>e.chain().focus().deleteRow().run(),children:"Supprimer la ligne"}),(0,r.jsx)(rI.kt,{onClick:()=>e.chain().focus().deleteColumn().run(),children:"Supprimer la colonne"}),(0,r.jsx)(rI.kt,{className:"text-destructive focus:text-destructive",onClick:()=>e.chain().focus().deleteTable().run(),children:"Supprimer le tableau"})]}):null]})]})}let iV=(0,a.memo)(function({editor:e,pageLayout:t,zoom:n,editable:i,showLayout:l,showNonPrintableChars:o,editorMode:c,canvasRef:d,onPageCountChange:u,onNarrowViewportChange:h,onCanvasHeightChange:m,onRegionContentChange:p,onPageSetupChange:g,onRegionEditorChange:f}){let x=t.widthPx,b=t.heightPx,y=t.marginsPx,[j,w]=(0,a.useState)(1),[N,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),[A,M]=(0,a.useState)({}),z=(0,a.useCallback)(e=>{let t=`${e.region}-${e.pageIndex}`;M(n=>n[t]===e.heightPx?n:{...n,[t]:e.heightPx})},[]),P=(0,a.useMemo)(()=>{let e=0,t=0;for(let[n,r]of Object.entries(A))n.startsWith("header-")&&(e=Math.max(e,r)),n.startsWith("footer-")&&(t=Math.max(t,r));return{...e>0?{header:e}:{},...t>0?{footer:t}:{}}},[A]),I=(0,a.useMemo)(()=>(function(e,t){let n,r,a,i,s,l,o,c,d=(n=nP(e),r=nT(e),a=nL(e.header,r),i=e.headerFooterDifferentFirstPage?nL(e.headerFirstPage,r):a,Math.max(e.marginsPx.top,n+Math.max(a,i))),u=(s=nI(e),l=nD(e),o=nL(e.footer,l),c=e.headerFooterDifferentFirstPage?nL(e.footerFirstPage,l):o,Math.max(e.marginsPx.bottom,s+Math.max(o,c)));if(t?.header!=null){let n=nP(e);d=Math.max(e.marginsPx.top,n+t.header)}if(t?.footer!=null){let n=nI(e);u=Math.max(e.marginsPx.bottom,n+t.footer)}return{top:d,right:e.marginsPx.right,bottom:u,left:e.marginsPx.left}})(t,C?void 0:P),[t,C,P]),T=(0,a.useMemo)(()=>{var e;let n,r,a,i,s;return n=(e={...t,effectiveMarginsPx:I}).effectiveMarginsPx??e.marginsPx,r=null!=e.headerMarginMm?np(e.headerMarginMm):e.marginsPx.top,a=null!=e.footerMarginMm?np(e.footerMarginMm):e.marginsPx.bottom,i=e.heightPx-n.top-n.bottom,s=n.bottom+iz.sl+n.top,{pageWidth:e.widthPx,pageHeight:e.heightPx,margins:n,headerMarginPx:r,footerMarginPx:a,bodyAreaHeight:Math.max(1,i),interPageSpacer:s}},[t,I]),D=(0,a.useRef)(null),L=d??D,F=(0,a.useRef)(null),E=(0,a.useRef)(u);E.current=u;let R=n/100,H=x*R,B=(0,a.useCallback)(()=>{S(null),f?.(null)},[f]),$=(0,a.useCallback)((e,t)=>{S({region:e,pageIndex:t})},[]),O=(0,a.useCallback)(e=>{f?.(e)},[f]);(0,a.useEffect)(()=>{let e=e=>{"Escape"===e.key&&C&&(e.preventDefault(),B())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[C,B]),(0,a.useEffect)(()=>{let e=e=>{let t=e.detail;t?.region&&$(t.region,t.pageIndex??0)};return window.addEventListener(iD,e),()=>window.removeEventListener(iD,e)},[$]),(0,a.useEffect)(()=>{let e=L.current;if(!e)return;let t=()=>{let t=e.clientWidth<H;k(t),h?.(t),m?.(e.clientHeight)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[m,h,H,L]),(0,a.useEffect)(()=>{if(!l||!F.current)return;let t=null,n=!1,r=()=>{if(n||e.isDestroyed)return;let t=12,r=()=>{n||e.isDestroyed||requestAnimationFrame(()=>{if(n||e.isDestroyed)return;let a=aV(e);(t-=1,a&&t>0)?r():(()=>{if(e.isDestroyed)return;let t=function(e,t){if(e<=0)return 1;let{bodyAreaHeight:n,interPageSpacer:r}=t,a=e,i=1;for(;a>n&&!((a-=n)<=0);)a-=r,i+=1;for(;i>1&&e<=iF(i-1,t);)i-=1;return i}(function(e){let t=aq(e.dom);if(!t)return 0;let n=aJ(e,t.bodyAreaH);if(0===n.length)return 0;let r=function(e,t,n){let r=t+n,a=0,i=t;for(let{height:t}of e)if(!(t<=0)){for(;a+t>i;){let e=i+n;if(a<i||a<e){a=e,i+=r;break}i+=r}a+=t}return a}(n.map(e=>({height:e.height})),t.bodyAreaH,t.interPageSpacer),a=0;for(let t of e.dom.children)a=Math.max(a,t.offsetTop+t.offsetHeight);return Math.max(r,a)}(e.view),T);w(e=>e===t?e:t)})()})};r()},a=!1,i=()=>{a||(a=!0,requestAnimationFrame(()=>{a=!1,r()})),t&&clearTimeout(t),t=setTimeout(()=>{t=null,r()},32)};i();let s=({transaction:e})=>{e.docChanged&&i()};return e.on("transaction",s),()=>{n=!0,t&&clearTimeout(t),e.off("transaction",s)}},[e,T,A,l]),(0,a.useEffect)(()=>{E.current?.(j)},[j]),(0,a.useEffect)(()=>{if(!l||j<=1)return;let t=requestAnimationFrame(()=>{e.isDestroyed||aV(e)});return()=>cancelAnimationFrame(t)},[e,j,l]);let W=j*b+Math.max(0,j-1)*iz.sl,_=iF(j,T),q=W*R,G=N?iz.Wb:iz.iP,Y=iz.iP,U=t.textAreaBorderCss,X=t.sheetBorderCss,J=t.pageColor,V=t.pageBackgroundLayers,K=null!=C;return(0,r.jsx)("div",{ref:L,className:(0,v.cn)("ultidrive-docs-canvas h-full min-h-0 overflow-auto",l?"bg-[#f9fbfd] dark:bg-[#202124]":"bg-white dark:bg-background",o&&"docs-show-non-printable","suggest"===c&&"docs-editor-mode-suggest","view"===c&&"docs-editor-mode-view"),children:(0,r.jsx)("div",{className:"mx-auto",style:{width:H,paddingTop:G,paddingBottom:Y,minHeight:(l?q:_+y.top+y.bottom)+G+Y},children:(0,r.jsx)("div",{className:"relative mx-auto overflow-visible",style:{width:H,height:l?q:void 0},children:(0,r.jsxs)("div",{"data-docs-page-stack":!0,"data-docs-page-height":b,"data-docs-page-width":x,"data-docs-page-scale":R,"data-docs-page-margin-top":I.top,"data-docs-page-margin-right":I.right,"data-docs-page-margin-bottom":I.bottom,"data-docs-page-margin-left":I.left,className:"absolute left-1/2 top-0 -translate-x-1/2 overflow-visible",style:{width:x,height:W,transform:`scale(${R})`,transformOrigin:"top center"},children:[l?Array.from({length:j},(e,t)=>{let n=t*(b+iz.sl);return(0,r.jsx)("div",{className:(0,v.cn)("ultidrive-docs-page ultidrive-docs-page--sheet absolute left-0 overflow-hidden dark:bg-white",X&&"ultidrive-docs-page--imported-border"),style:{top:n,width:x,height:b,backgroundColor:J},"aria-hidden":!0,children:(0,r.jsxs)(r.Fragment,{children:[V?.gradientCss?(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[1]",style:{background:V.gradientCss},"aria-hidden":!0},`bg-gradient-${t}`):null,V?.fillImageStyle?(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[1]",style:V.fillImageStyle,"aria-hidden":!0},`bg-image-${t}`):null,V?.watermarkStyle?(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[2] flex items-center justify-center overflow-hidden","aria-hidden":!0,children:V.watermarkStyle.imageSrc?(0,r.jsx)("img",{src:V.watermarkStyle.imageSrc,alt:"",className:"max-h-[70%] max-w-[70%] select-none object-contain",style:{opacity:V.watermarkStyle.opacity,transform:`rotate(${V.watermarkStyle.rotationDeg}deg)`}}):(0,r.jsx)("span",{className:"select-none whitespace-nowrap text-[72px] font-light leading-none",style:{color:V.watermarkStyle.color,opacity:V.watermarkStyle.opacity,transform:`rotate(${V.watermarkStyle.rotationDeg}deg)`},children:V.watermarkStyle.text})},`bg-watermark-${t}`):null]})},t)}):null,l&&U?Array.from({length:j},(e,t)=>(0,r.jsx)("div",{className:"pointer-events-none absolute z-[5] box-border",style:{top:t*(b+iz.sl)+I.top,left:I.left,width:x-I.left-I.right,height:b-I.top-I.bottom,borderTop:U.top??"none",borderRight:U.right??"none",borderBottom:U.bottom??"none",borderLeft:U.left??"none"},"aria-hidden":!0},`text-border-${t}`)):null,l?(0,r.jsx)(iP,{pageCount:j,pageLayout:t,pageWidth:x,pageHeight:b,pageColor:J,pageRegionHeights:A}):null,l?(0,r.jsx)(iI,{pageCount:j,pageHeight:b,pageWidth:x,margins:I,pageColor:J,interPageSpacer:T.interPageSpacer}):null,l?(0,r.jsx)(iT,{pageCount:j,pageHeight:b,pageWidth:x,sheetBorderCss:X}):null,l?Array.from({length:j},(e,n)=>{let a=n*(b+iz.sl);return(0,r.jsxs)("div",{children:[(0,r.jsx)(iM,{region:"header",pageLayout:t,pageIndex:n,pageTop:a,pageWidth:x,pageHeight:b,margins:y,editable:i,editingTarget:C,onStartEdit:$,onStopEdit:B,onContentChange:(e,t,n)=>p?.(e,t,n),onPageSetupChange:e=>g?.(e),onRegionHeightMeasure:z,onRegionEditorReady:C?.region==="header"&&C.pageIndex===n?O:void 0}),(0,r.jsx)(iM,{region:"footer",pageLayout:t,pageIndex:n,pageTop:a,pageWidth:x,pageHeight:b,margins:y,editable:i,editingTarget:C,onStartEdit:$,onStopEdit:B,onContentChange:(e,t,n)=>p?.(e,t,n),onPageSetupChange:e=>g?.(e),onRegionHeightMeasure:z,onRegionEditorReady:C?.region==="footer"&&C.pageIndex===n?O:void 0})]},`hf-${n}`)}):null,K?(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[12] bg-[#e8eaed]/40",style:{height:W},"aria-hidden":!0}):null,(0,r.jsx)("div",{id:"docs-page-graphic-layer-behind",className:"pointer-events-none absolute left-0 top-0 z-[12]",style:{width:x,height:W}}),(0,r.jsx)("div",{id:"docs-page-graphic-layer-front",className:"pointer-events-none absolute left-0 top-0 z-[18]",style:{width:x,height:W}}),(0,r.jsx)(iR,{pageWidth:x,pageHeight:b}),(0,r.jsx)("div",{ref:F,className:(0,v.cn)("ultidrive-docs-editor-surface relative",l&&"ultidrive-docs-editor-surface--paginated",!l&&"ultidrive-docs-editor-surface--compact",K&&"ultidrive-docs-editor-surface--dimmed"),style:{padding:`${I.top}px ${I.right}px ${I.bottom}px ${I.left}px`,height:l?W:void 0,minHeight:l?void 0:_+I.top+I.bottom,"--docs-stack-height":`${W}px`,"--docs-prose-min-height":`${_}px`,"--docs-body-area-h":`${T.bodyAreaHeight}px`,"--docs-inter-page-spacer":`${T.interPageSpacer}px`},onMouseDown:t=>{if(K){let e=t.target;e.closest(".docs-hf-band")||e.closest(".docs-hf-chrome")||B();return}!i||C||t.target.closest(".ProseMirror")||(t.preventDefault(),iH(e,t.clientX,t.clientY))},children:(0,r.jsx)(iJ,{editor:e,disabled:!i||K,children:(0,r.jsx)("div",{className:"min-h-0 min-w-0",children:(0,r.jsx)(s.$Z,{editor:e,className:(0,v.cn)(!i&&"pointer-events-none select-text")})})})})]})})})})});function iK({pageLayout:e,pageCount:t,currentPage:n=1,className:a}){let i=Math.min(Math.max(1,n),Math.max(1,t));return(0,r.jsxs)("div",{className:(0,v.cn)("docs-status-bar flex shrink-0 items-center justify-between border-t border-[#dadce0] bg-[#edf2fa] px-4 py-1 text-xs text-[#5f6368] dark:border-border dark:bg-muted/40 dark:text-muted-foreground",a),children:[(0,r.jsxs)("span",{children:["Page ",i," sur ",t]}),(0,r.jsxs)("span",{children:[e.format.label," (",e.format.widthMm," \xd7 ",e.format.heightMm," mm)"]})]})}let iQ=10*nc,iZ=new Set(["letter","legal","tabloid"]),i0=new Set(["a4","a5"]);function i1(e){let t=iZ.has(e)?"inch":(i0.has(e),"cm");return"inch"===t?{unit:t,majorStepPx:iE,minorDivisions:8}:{unit:t,majorStepPx:iQ,minorDivisions:10}}function i2(e,t){if(0===e)return"0";let n=Math.abs(e);return"cm"===t?Number.isInteger(n)?String(e):e.toFixed(1).replace(".",","):Number.isInteger(n)?String(e):String(Math.round(10*e)/10)}function i4(e,t,n=0){let{unit:r,majorStepPx:a,minorDivisions:i}=i1(t),s=a/i,l=[],o=-Math.ceil(n/a),c=Math.ceil(e/a);for(let t=o;t<=c;t+=1){let o=t*a;if(o>e+.5)break;let c=t;if(l.push({pos:o,major:!0,label:0!==c||n>0?i2(c,r):void 0}),!(o<0))for(let t=1;t<i;t+=1){let n=o+t*s;if(n>e)break;l.push({pos:n,major:!1})}}return l}let i5=(0,a.memo)(function({tooltip:e}){return!e||"u"<typeof document?null:(0,rf.createPortal)((0,r.jsx)("div",{className:"docs-ruler-margin-tooltip pointer-events-none fixed z-[200] rounded px-2 py-1 text-xs font-medium tabular-nums text-white shadow-md",style:{left:e.x+12,top:e.y+12},role:"status","aria-live":"polite",children:e.label}),document.body)}),i3=(0,a.memo)(function({left:e,className:t}){return(0,r.jsx)("div",{className:t,style:{left:e},"aria-hidden":!0,children:(0,r.jsx)("svg",{width:"8",height:"6",viewBox:"0 0 8 6",className:"block",children:(0,r.jsx)("path",{d:"M0 0 L8 0 L4 6 Z",fill:"#1a73e8"})})})}),i8=(0,a.memo)(function({left:e}){return(0,r.jsx)("div",{className:"pointer-events-none absolute top-0 h-[5px] w-[6px] -translate-x-1/2 rounded-[1px] bg-[#1a73e8]",style:{left:e},"aria-hidden":!0})}),i6=(0,a.memo)(function({top:e}){return(0,r.jsx)("div",{className:"pointer-events-none absolute left-1/2 -translate-x-1/2",style:{top:e},"aria-hidden":!0,children:(0,r.jsx)("svg",{width:"6",height:"8",viewBox:"0 0 6 8",className:"block",children:(0,r.jsx)("path",{d:"M0 8 L6 8 L3 0 Z",fill:"#1a73e8"})})})}),i9=(0,a.memo)(function({top:e}){return(0,r.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 -translate-y-full",style:{top:e},"aria-hidden":!0,children:(0,r.jsx)("svg",{width:"6",height:"8",viewBox:"0 0 6 8",className:"block",children:(0,r.jsx)("path",{d:"M0 0 L6 0 L3 8 Z",fill:"#1a73e8"})})})}),i7=(0,a.memo)(function({style:e,className:t,disabled:n,axis:a,ariaLabel:i,onPointerDown:s,children:l}){return(0,r.jsx)("div",{role:"slider","aria-label":i,"aria-disabled":n||void 0,className:(0,v.cn)("docs-ruler-drag-handle absolute touch-none select-none","horizontal"===a?"bottom-0 -translate-x-1/2 cursor-ew-resize":"left-1/2 -translate-x-1/2 cursor-ns-resize",n?"pointer-events-none":"pointer-events-auto",t),style:e,onPointerDown:n?void 0:s,children:(0,r.jsx)("div",{className:(0,v.cn)("flex items-center justify-center","horizontal"===a?"h-5 w-4 -mb-0.5":"h-4 w-5"),children:l})})});function se({rulerRef:e,axis:t,disabled:n,onDrag:r,onDragEnd:i}){let s=(0,a.useRef)(!1);return{onPointerDown:a=>{if(n)return;a.preventDefault(),a.stopPropagation();let l=a.currentTarget;l.setPointerCapture(a.pointerId),s.current=!0,document.body.style.userSelect="none",document.body.style.cursor="horizontal"===t?"ew-resize":"ns-resize";let o=(n,a)=>{let i=((n,r)=>{let a=e.current;if(!a)return null;let i=a.getBoundingClientRect(),s=a.dataset.docsRulerScale,l=s?Number.parseFloat(s):1;return!Number.isFinite(l)||l<=0?null:"horizontal"===t?(n-i.left)/l:(r-i.top)/l})(n,a);null!=i&&r(i,n,a)};o(a.clientX,a.clientY);let c=e=>o(e.clientX,e.clientY),d=e=>{s.current=!1,document.body.style.userSelect="",document.body.style.cursor="",l.hasPointerCapture(e.pointerId)&&l.releasePointerCapture(e.pointerId),window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),i()};window.addEventListener("pointermove",c),window.addEventListener("pointerup",d),window.addEventListener("pointercancel",d)},draggingRef:s}}let st=(0,a.memo)(function({pageLayout:e,scale:t,indents:n,editable:i,onMarginDragStart:s,onMarginDrag:l,onMarginDragEnd:o}){let c=(0,a.useRef)(null),d=e.widthPx,u=e.marginsPx,h=i4(d,e.format.id,0),m=se({rulerRef:c,axis:"horizontal",disabled:!i,onDrag:(e,t,n)=>l?.("left",e,t,n),onDragEnd:()=>o?.()}),p=se({rulerRef:c,axis:"horizontal",disabled:!i,onDrag:(e,t,n)=>l?.("right",e,t,n),onDragEnd:()=>o?.()}),g=(e,t)=>n=>{s?.(e),t(n)};return(0,r.jsxs)("div",{ref:c,"data-docs-ruler":"horizontal","data-docs-ruler-scale":t,className:"docs-horizontal-ruler relative overflow-visible bg-transparent",style:{width:d*t,height:iz.jW},children:[(0,r.jsx)("div",{className:"absolute top-0 h-full bg-transparent",style:{left:0,width:u.left*t}}),(0,r.jsx)("div",{className:"absolute top-0 h-full bg-transparent",style:{left:(d-u.right)*t,width:u.right*t}}),h.map((e,n)=>(0,r.jsx)("div",{className:"pointer-events-none absolute bottom-0 w-px bg-[#bdc1c6] dark:bg-muted-foreground/70",style:{left:e.pos*t,height:e.major?10:5}},`${e.pos}-${n}`)),h.filter(e=>e.major&&null!=e.label).map(e=>(0,r.jsx)("span",{className:"pointer-events-none absolute top-[2px] -translate-x-1/2 text-[9px] leading-none text-[#9aa0a6] dark:text-muted-foreground",style:{left:e.pos*t},children:e.label},`label-${e.pos}`)),(0,r.jsx)(i7,{style:{left:u.left*t},axis:"horizontal",disabled:!i,ariaLabel:"Marge gauche",onPointerDown:g("left",m.onPointerDown),children:(0,r.jsx)(i3,{left:0,className:"relative"})}),(0,r.jsx)(i7,{style:{left:(d-u.right)*t},axis:"horizontal",disabled:!i,ariaLabel:"Marge droite",onPointerDown:g("right",p.onPointerDown),children:(0,r.jsx)(i3,{left:0,className:"relative"})}),(0,r.jsx)(i3,{left:n.leftPx*t,className:"pointer-events-none absolute bottom-0 -translate-x-1/2"}),Math.abs(n.firstLinePx-n.leftPx)>1?(0,r.jsx)(i8,{left:n.firstLinePx*t}):null]})}),sn=(0,a.memo)(function({pageLayout:e,scale:t,editable:n,onMarginDragStart:i,onMarginDrag:s,onMarginDragEnd:l}){var o;let c=(0,a.useRef)(null),d=e.heightPx,u=e.marginsPx,h=(o=u.top,i4(d,e.format.id,o)),m=se({rulerRef:c,axis:"vertical",disabled:!n,onDrag:(e,t,n)=>s?.("top",e,t,n),onDragEnd:()=>l?.()}),p=se({rulerRef:c,axis:"vertical",disabled:!n,onDrag:(e,t,n)=>s?.("bottom",e,t,n),onDragEnd:()=>l?.()}),g=(e,t)=>n=>{i?.(e),t(n)};return(0,r.jsxs)("div",{ref:c,"data-docs-ruler":"vertical","data-docs-ruler-scale":t,className:"docs-vertical-ruler relative overflow-visible border-r border-[#dadce0] bg-white dark:border-border dark:bg-background",style:{width:iz.cQ,height:d*t},children:[(0,r.jsx)("div",{className:"pointer-events-none absolute left-0 right-0 bg-[#f1f3f4] dark:bg-muted/60",style:{top:0,height:u.top*t}}),(0,r.jsx)("div",{className:"pointer-events-none absolute left-0 right-0 bg-[#f1f3f4] dark:bg-muted/60",style:{top:(d-u.bottom)*t,height:u.bottom*t}}),h.map((e,n)=>(0,r.jsx)("div",{className:"pointer-events-none absolute right-0 h-px bg-[#bdc1c6] dark:bg-muted-foreground/70",style:{top:e.pos*t,width:e.major?10:5}},`${e.pos}-${n}`)),h.filter(e=>e.major&&null!=e.label).map(e=>(0,r.jsx)("span",{className:"pointer-events-none absolute right-[11px] -translate-y-1/2 text-[9px] leading-none text-[#9aa0a6] dark:text-muted-foreground",style:{top:e.pos*t},children:e.label},`vlabel-${e.pos}`)),(0,r.jsx)(i7,{style:{top:u.top*t},axis:"vertical",disabled:!n,ariaLabel:"Marge haute",onPointerDown:g("top",m.onPointerDown),children:(0,r.jsx)(i6,{top:0})}),(0,r.jsx)(i7,{style:{top:(d-u.bottom)*t},axis:"vertical",disabled:!n,ariaLabel:"Marge basse",onPointerDown:g("bottom",p.onPointerDown),children:(0,r.jsx)(i9,{top:0})})]})});function sr({pageLayout:e,scale:t,rulerSync:n,rulerTrackRef:a,contentInsetRight:i=0,outlineExpanded:s,onToggleOutline:l,editable:o,onMarginDragStart:c,onMarginDrag:d,onMarginDragEnd:u}){let h=e.widthPx*t;return(0,r.jsxs)("div",{className:"docs-toolbar-ruler-row flex shrink-0 bg-transparent",style:{height:iz.jW},children:[(0,r.jsx)("div",{className:"flex shrink-0 items-end justify-center border-r border-[#dadce0]/80 bg-transparent pb-0.5 dark:border-border/80",style:{width:iz.cQ,height:iz.jW},children:(0,r.jsx)("button",{type:"button",className:(0,v.cn)("pointer-events-auto flex size-7 items-center justify-center rounded-full border border-[#dadce0] bg-white text-[#5f6368] shadow-sm transition-colors hover:bg-[#e8eaed] dark:border-border dark:bg-background dark:text-muted-foreground dark:hover:bg-muted",s&&"border-[#1a73e8] text-[#1a73e8]"),"aria-label":"Afficher le plan du document","aria-pressed":s,onClick:l,children:(0,r.jsx)(tX.A,{className:"size-3.5"})})}),(0,r.jsx)("div",{ref:a,className:"relative min-w-0 flex-1 overflow-visible",style:{height:iz.jW,paddingRight:n.canvasScrollbarWidth+i},children:(0,r.jsx)("div",{className:"mx-auto",style:{width:h,transform:n.canvasScrollLeft?`translateX(${-n.canvasScrollLeft}px)`:void 0},children:(0,r.jsx)(st,{pageLayout:e,scale:t,indents:n.indents,editable:o,onMarginDragStart:c,onMarginDrag:d,onMarginDragEnd:u})})})]})}function sa({pageLayout:e,scale:t,rulerSync:n,editable:a,onMarginDragStart:i,onMarginDrag:s,onMarginDragEnd:l}){return(0,r.jsx)("div",{className:(0,v.cn)("docs-rulers-left-rail absolute bottom-0 left-0 top-0 z-20 overflow-visible bg-transparent",!a&&"pointer-events-none"),style:{width:iz.cQ},children:(0,r.jsx)("div",{className:"pointer-events-auto absolute left-0",style:{top:n.pageTopInViewport},children:(0,r.jsx)(sn,{pageLayout:e,scale:t,editable:a,onMarginDragStart:i,onMarginDrag:s,onMarginDragEnd:l})})})}let si=e=>({leftPx:e.marginsPx.left,firstLinePx:e.marginsPx.left,rightPx:e.widthPx-e.marginsPx.right});function ss(e,t){return t?{...e,...t}:e}var sl=n(19159),so=n(14784),sc=n(31965),sd=n(3503),su=n(56706),sh=n(26362),sm=n(91505),sp=n(75681),sg=n(63639),sf=n(94658),sx=n(22854),sb=n(71092),sy=n(45041);async function sj(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}function sv({open:e,onOpenChange:t,onPickImage:n}){let[i,s]=(0,a.useState)("/"),[l,o]=(0,a.useState)(null),c=(0,sg.GQ)(i,1,"",e),d=(0,a.useMemo)(()=>(c.data?.files??[]).filter(e=>"directory"===e.type),[c.data?.files]),u=(0,a.useMemo)(()=>(c.data?.files??[]).filter(e=>"file"===e.type&&"image"===(0,sb.tF)(e)),[c.data?.files]),h=(0,a.useMemo)(()=>{let e=(0,sy.x9)(i);if("/"===e)return[{path:"/",label:"Mon Drive"}];let t=e.slice(1).split("/"),n=[{path:"/",label:"Mon Drive"}];for(let e=0;e<t.length;e++){let r="/"+t.slice(0,e+1).join("/");n.push({path:r,label:(0,sx._g)(t[e])})}return n},[i]),m=async e=>{o(e.path);try{let r=await (0,sf.WE)(e),a=await sj(r);await n(a,e),t(!1)}catch{window.alert("Impossible de charger cette image depuis le Drive.")}finally{o(null)}};return(0,r.jsx)(tt.lG,{open:e,onOpenChange:t,children:(0,r.jsxs)(tt.Cf,{overlayClassName:td.RD,className:(0,v.cn)(td.gO,"flex max-h-[min(80vh,560px)] flex-col gap-0 sm:max-w-[480px]"),children:[(0,r.jsxs)(tt.c7,{className:"shrink-0 px-6 pb-3 pt-6",children:[(0,r.jsx)(tt.L3,{className:(0,v.cn)("text-base font-medium",td.Sz),children:"Image depuis Drive"}),(0,r.jsx)(tt.rr,{className:(0,v.cn)("text-sm",td.qj),children:"Choisissez une image dans votre UltiDrive."})]}),(0,r.jsx)("div",{className:(0,v.cn)("shrink-0 px-6 pb-2",td.EM),children:(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1 text-sm",children:h.map((e,t)=>(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[t>0?(0,r.jsx)(B.A,{className:"size-3.5 text-muted-foreground"}):null,(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"sm",className:(0,v.cn)(td.Yr,"h-7 px-2 text-sm"),onClick:()=>s(e.path),children:e.label})]},e.path))})}),(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2",children:c.isLoading?(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)(sm.A,{className:"size-6 animate-spin text-muted-foreground"})}):0===d.length&&0===u.length?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Aucune image dans ce dossier."}):(0,r.jsxs)("ul",{className:"space-y-0.5",children:[d.map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm hover:bg-accent",onClick:()=>s(e.path),children:[(0,r.jsx)(sp.A,{className:"size-4 shrink-0 text-[#5f6368]"}),(0,r.jsx)("span",{className:(0,v.cn)("truncate",td.qp),children:(0,sx._g)(e.name)}),(0,r.jsx)(B.A,{className:"ml-auto size-4 shrink-0 text-muted-foreground"})]})},e.path)),u.map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",disabled:l===e.path,className:"flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm hover:bg-accent disabled:opacity-60",onClick:()=>void m(e),children:[(0,r.jsx)(tC.A,{className:"size-4 shrink-0 text-[#1967d2]"}),(0,r.jsx)("span",{className:(0,v.cn)("truncate",td.qp),children:(0,sx._g)(e.name)}),l===e.path?(0,r.jsx)(sm.A,{className:"ml-auto size-4 shrink-0 animate-spin text-muted-foreground"}):null]})},e.path))]})})]})})}n(83631);let sw=(0,n(7057).default)(async()=>{let{Excalidraw:e,restoreElements:t,restoreAppState:a}=await Promise.all([n.e(2492),n.e(3808),n.e(9383),n.e(8205)]).then(n.bind(n,3339)),{memo:i,useEffect:s,useMemo:l,useRef:o}=await Promise.resolve().then(n.t.bind(n,91356,19));function c(e){if(e)try{let n=JSON.parse(e);return{elements:t(n.elements??[],null),appState:a(n.appState??{},null),files:n.files}}catch{return}}return i(function({drawScene:t,onReady:n}){let a=o(null),i=l(()=>c(t),[t]);return s(()=>{let e=a.current;if(!e||!t)return;let n=c(t);n&&e.updateScene({elements:n.elements??[],appState:n.appState,files:n.files})},[t]),(0,r.jsx)("div",{className:"h-full min-h-0 w-full",children:(0,r.jsx)(e,{excalidrawAPI:e=>{a.current=e,n(e)},initialData:i,langCode:"fr-FR",UIOptions:{canvasActions:{changeViewBackgroundColor:!0,clearCanvas:!0,export:!1,loadScene:!1,saveToActiveFile:!1,toggleTheme:!1}}})})})},{loadableGenerated:{webpack:()=>[91356]},ssr:!1,loading:()=>(0,r.jsx)("div",{className:"flex h-full min-h-[360px] items-center justify-center text-sm text-muted-foreground",children:"Chargement de l'\xe9diteur…"})}),sN=(0,a.memo)(function({drawScene:e,onReady:t}){return(0,r.jsx)(sw,{drawScene:e,onReady:t})}),sk=(0,a.memo)(function({open:e,editor:t,onClose:i}){let[s,l]=(0,a.useState)(null),{exportDrawing:o,saving:c}=function(e){let[t,r]=(0,a.useState)(!1);return{exportDrawing:(0,a.useCallback)(async()=>{if(!e)return null;r(!0);try{let t=e.getSceneElements(),r=e.getAppState(),a=e.getFiles(),{exportToSvg:i,serializeAsJSON:s}=await Promise.all([n.e(2492),n.e(3808),n.e(9383),n.e(8205)]).then(n.bind(n,3339)),l=s(t,r,a,"local"),o=await i({elements:t,appState:r,files:a,skipInliningFonts:!0}),c=new XMLSerializer().serializeToString(o),d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(c)}`,{width:u,height:h}=function(e){let t=e.getAttribute("viewBox");if(t){let e=t.split(/\s+/).map(Number);if(4===e.length&&e.every(e=>Number.isFinite(e)))return{width:Math.max(24,Math.round(e[2])),height:Math.max(24,Math.round(e[3]))}}let n=Number(e.getAttribute("width")),r=Number(e.getAttribute("height"));return Number.isFinite(n)&&Number.isFinite(r)&&n>0&&r>0?{width:Math.round(n),height:Math.round(r)}:{width:320,height:240}}(o);return{drawScene:l,src:d,width:u,height:h}}finally{r(!1)}},[e]),saving:t}}(s),d=e?rE(t):null,u=d?.drawScene??null,h=u?`draw-${u.length}-${u.slice(0,48)}`:"new-draw",m=async()=>{let e=await o();e&&t&&(t.chain().focus().updateDocsGraphic({graphicType:"draw",drawScene:e.drawScene,src:e.src,width:e.width,height:e.height,lockAspectRatio:!0}).run(),window.dispatchEvent(new CustomEvent("ultidocs:graphic-draw-saved")),p())},p=()=>{l(null),i()};return(0,r.jsx)(tt.lG,{open:e,onOpenChange:e=>!e&&p(),children:(0,r.jsxs)(tt.Cf,{overlayClassName:td.Sh,className:(0,v.cn)(td.dn,"flex h-[min(88vh,900px)] max-w-[min(96vw,1200px)] flex-col gap-0 overflow-hidden p-0"),children:[(0,r.jsxs)(tt.c7,{className:"shrink-0 border-b border-border px-4 py-3",children:[(0,r.jsxs)(tt.L3,{className:"flex items-center gap-2 text-base",children:[(0,r.jsx)(tT.A,{className:"size-4"}),"Modifier le dessin"]}),(0,r.jsx)(tt.rr,{className:"sr-only",children:"\xc9diteur vectoriel pour cr\xe9er et modifier un dessin dans le document."})]}),(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?(0,r.jsx)(sN,{drawScene:u,onReady:l},h):null}),(0,r.jsxs)(tt.Es,{className:"shrink-0 border-t border-border px-4 py-3 sm:justify-end",children:[(0,r.jsx)(b.$,{type:"button",variant:"outline",onClick:p,disabled:c,children:"Annuler"}),(0,r.jsx)(b.$,{type:"button",onClick:()=>void m(),disabled:c||!s,children:c?"Export…":"Valider"})]})]})})});function sC({editor:e,disabled:t}){let n=(0,a.useRef)(null),[i,s]=(0,a.useState)(!1);if(!e)return null;let l=(t,n)=>{aL({src:t,alt:n?.alt??"",wrap:n?.wrap??"square",placement:n?.placement??"block"}).then(t=>{e.chain().focus().insertDocsGraphic(t).run()})};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"docs-toolbar-btn size-7 shrink-0",disabled:t,"aria-label":"Ins\xe9rer un \xe9l\xe9ment graphique",children:(0,r.jsx)(eR.In,{icon:"material-symbols:image-outline",className:"size-4"})})}),(0,r.jsxs)(iS.SQ,{align:"start",className:"min-w-64",children:[(0,r.jsxs)(iS._2,{onClick:()=>s(!0),children:[(0,r.jsx)("img",{src:(0,tB.w)("/ultidrive-mark.svg"),alt:"",className:"size-4 shrink-0","aria-hidden":!0}),"Image depuis Drive"]}),(0,r.jsxs)(iS._2,{onClick:()=>n.current?.click(),children:[(0,r.jsx)(tC.A,{className:"size-4 shrink-0"}),"Image depuis l'ordinateur"]}),(0,r.jsxs)(iS._2,{onClick:()=>{e.chain().focus().insertDocsGraphic(aD("draw",{width:320,height:240})).run(),rL()},children:[(0,r.jsx)(eg.A,{className:"size-4 shrink-0"}),"Dessin"]}),(0,r.jsxs)(iS._2,{onClick:()=>e.chain().focus().insertDocsGraphic(aD("gradient")).run(),children:[(0,r.jsx)(sh.A,{className:"size-4 shrink-0"}),"D\xe9grad\xe9"]})]})]}),(0,r.jsx)(sv,{open:i,onOpenChange:s,onPickImage:(e,t)=>{l(e,{alt:t.name})}}),(0,r.jsx)("input",{ref:n,type:"file",accept:"image/*",className:"hidden",onChange:e=>{let t,n=e.target.files?.[0];n&&((t=new FileReader).onload=()=>{l(t.result,void 0)},t.readAsDataURL(n)),e.target.value=""}})]})}function sS(e){return!!e&&(e.isActive("docsGraphic")||e.isActive("docsInlineGraphic"))}function sA(){return(0,r.jsx)("span",{className:"mx-0.5 h-6 w-px shrink-0 bg-border","aria-hidden":!0})}function sM(e){e.preventDefault()}function sz({label:e,active:t,onClick:n,children:a}){return(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:(0,v.cn)("size-8 shrink-0 rounded-full text-popover-foreground hover:bg-accent hover:text-accent-foreground",t&&"bg-accent text-primary hover:bg-accent hover:text-primary"),"aria-label":e,title:e,onClick:n,children:a})}let sP=(0,a.memo)(function({editor:e,canvasRef:t,disabled:n}){let i,[s,l]=(0,a.useState)(null),[o,c]=(0,a.useState)(!1),[,d]=(0,a.useState)(0),u=(0,a.useRef)(null),h=(0,a.useCallback)(()=>{if(d(e=>e+1),!e||!sS(e))return void l(null);let t=document.querySelector(".docs-graphic--selected, .ProseMirror-selectednode .docs-graphic");t?(l(t.getBoundingClientRect()),c(!!document.querySelector(".docs-graphic--cropping"))):l(null)},[e]);if((0,a.useEffect)(()=>{if(!e)return;h(),e.on("selectionUpdate",h),e.on("transaction",h);let n=t.current;return n?.addEventListener("scroll",h,{passive:!0}),window.addEventListener("resize",h),window.addEventListener(rz,h),()=>{e.off("selectionUpdate",h),e.off("transaction",h),n?.removeEventListener("scroll",h),window.removeEventListener("resize",h),window.removeEventListener(rz,h)}},[t,e,h]),!e||n||!sS(e)||!s)return null;let m=(i=e.isActive("docsInlineGraphic")?"docsInlineGraphic":e.isActive("docsGraphic")?"docsGraphic":null)?{name:i,attrs:(0,rb.Oy)(e.getAttributes(i))}:null;if(!m)return null;let{attrs:p}=m,g="image"===p.graphicType,f="gradient"===p.graphicType,x="draw"===p.graphicType||"shape"===p.graphicType,y="move-with-text"===p.positionMode,j=(0,rx.j8)(p),w=t=>{e.chain().setDocsGraphicWrap(t).run()},N=(0,r.jsx)("div",{className:"docs-graphic-floating-toolbar pointer-events-auto fixed z-200 -translate-x-1/2",style:{left:s.left+s.width/2,top:s.bottom+8},role:"toolbar","aria-label":"Options graphique",children:(0,r.jsxs)("div",{className:"flex items-center gap-0.5 rounded-full border border-border bg-popover px-1 py-0.5 text-popover-foreground shadow-md",children:[g||x?(0,r.jsxs)(b.$,{type:"button",variant:g&&o?"default":"ghost",size:"sm",className:(0,v.cn)("h-8 shrink-0 gap-1.5 rounded-full px-2.5 text-xs",g&&o?"bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground":"hover:bg-accent hover:text-accent-foreground"),onClick:()=>{g?o?window.dispatchEvent(new CustomEvent(rM)):rP():rF(e)},children:[g?o?(0,r.jsx)(H.A,{className:"size-3.5"}):(0,r.jsx)(sl.A,{className:"size-3.5"}):(0,r.jsx)(tT.A,{className:"size-3.5"}),g?o?"Appliquer":"Ajuster":"Modifier le dessin"]}):null,y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(sA,{}),(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsxs)(b.$,{type:"button",variant:"ghost",size:"sm",className:"h-8 shrink-0 gap-1 rounded-full px-2 text-xs hover:bg-accent hover:text-accent-foreground",children:[(0,r.jsx)(eR.In,{icon:rJ[p.floatSide],className:"size-[18px]"}),(0,r.jsx)(nt.A,{className:"size-3 opacity-60"})]})}),(0,r.jsx)(iS.SQ,{align:"start",className:"min-w-40",onCloseAutoFocus:sM,children:Object.keys(rV).map(t=>(0,r.jsxs)(iS._2,{onClick:()=>{var n;return n=t,void e.chain().setDocsGraphicFloatSide(n).run()},children:[(0,r.jsx)(eR.In,{icon:rJ[t],className:"mr-2 size-4"}),rV[t],p.floatSide===t?" ✓":""]},t))})]})]}):null,y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(sA,{}),(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsxs)(b.$,{type:"button",variant:"ghost",size:"sm",className:"h-8 max-w-[140px] shrink-0 gap-1 truncate rounded-full px-2 text-xs hover:bg-accent hover:text-accent-foreground",children:[(0,r.jsx)(eR.In,{icon:"material-symbols:wrap-text",className:"size-[18px] shrink-0"}),(0,r.jsx)("span",{className:"truncate",children:rb.mC[p.wrap]??"Habillage"}),(0,r.jsx)(nt.A,{className:"size-3 shrink-0 opacity-60"})]})}),(0,r.jsxs)(iS.SQ,{align:"start",className:"min-w-48",onCloseAutoFocus:sM,children:[rK.map(({wrap:e,label:t})=>(0,r.jsxs)(iS._2,{onClick:()=>w(e),children:[(0,r.jsx)(eR.In,{icon:rX[e],className:"mr-2 size-4"}),t,p.wrap===e?" ✓":""]},e)),(0,r.jsx)(iS.mB,{}),rZ.map(({wrap:e,label:t})=>(0,r.jsxs)(iS._2,{onClick:()=>w(e),children:[(0,r.jsx)(eR.In,{icon:rX[e],className:"mr-2 size-4"}),t,p.wrap===e?" ✓":""]},e))]})]})]}):null,j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(sA,{}),rQ.map(({wrap:e,label:t})=>(0,r.jsx)(sz,{label:t,active:p.wrap===e,onClick:()=>w(e),children:(0,r.jsx)(eR.In,{icon:rX[e],className:"size-[18px]"})},e))]}):null,(0,r.jsx)(sA,{}),(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsxs)(b.$,{type:"button",variant:"ghost",size:"sm",className:"h-8 shrink-0 gap-1 rounded-full px-2 text-xs hover:bg-accent hover:text-accent-foreground",children:[p.wrapMarginMm,"mm",(0,r.jsx)(nt.A,{className:"size-3 opacity-60"})]})}),(0,r.jsx)(iS.SQ,{align:"center",className:"min-w-40",onCloseAutoFocus:sM,children:rj.map(t=>(0,r.jsxs)(iS._2,{onClick:()=>{var n;return n=t,void e.chain().setDocsGraphicWrapMargin(n).run()},children:["Marge de ",t,"mm",p.wrapMarginMm===t?" ✓":""]},t))})]}),(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsxs)(b.$,{type:"button",variant:"ghost",size:"sm",className:"h-8 shrink-0 gap-1 rounded-full px-2 text-xs hover:bg-accent hover:text-accent-foreground",children:[(0,r.jsx)(eR.In,{icon:"material-symbols:pin",className:"size-[18px]"}),r1[p.positionMode],(0,r.jsx)(nt.A,{className:"size-3 opacity-60"})]})}),(0,r.jsx)(iS.SQ,{align:"start",className:"min-w-48",onCloseAutoFocus:sM,children:["move-with-text","fixed-on-page"].map(t=>(0,r.jsxs)(iS._2,{onClick:()=>{var n;return n=t,void e.chain().setDocsGraphicPositionMode(n).run()},children:[r1[t],p.positionMode===t?" ✓":""]},t))})]}),j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(sz,{label:"Avancer",onClick:()=>e.chain().bringDocsGraphicForward().run(),children:(0,r.jsx)(so.A,{className:"size-4"})}),(0,r.jsx)(sz,{label:"Reculer",onClick:()=>e.chain().sendDocsGraphicBackward().run(),children:(0,r.jsx)(sc.A,{className:"size-4"})}),(0,r.jsx)(sA,{})]}):null,(0,r.jsxs)(b.$,{type:"button",variant:"ghost",size:"sm",className:"h-8 shrink-0 gap-1.5 rounded-full px-2.5 text-xs hover:bg-accent hover:text-accent-foreground",onClick:()=>at(g?void 0:f?"gradient":void 0),children:[(0,r.jsx)(sd.A,{className:"size-3.5"}),g?"Options de l'image":f?"Options du d\xe9grad\xe9":"Options"]}),(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 rounded-full hover:bg-accent hover:text-accent-foreground","aria-label":"Plus d'options",children:(0,r.jsx)(su.A,{className:"size-4"})})}),(0,r.jsxs)(iS.SQ,{align:"end",className:"min-w-48",onCloseAutoFocus:sM,children:[g?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(iS._2,{onClick:()=>{let t=window.prompt("Texte alternatif",p.alt);null!=t&&e.chain().updateDocsGraphic({alt:t}).run()},children:"Texte alternatif…"}),(0,r.jsx)(iS.mB,{}),(0,r.jsx)(iS._2,{onClick:()=>u.current?.click(),children:"Remplacer l'image…"}),(0,r.jsx)(iS._2,{onClick:()=>{if(!p.src)return;let e=document.createElement("a");e.href=p.src,e.download="image",e.click()},disabled:!p.src,children:"T\xe9l\xe9charger l'image"})]}):null,(0,r.jsx)(iS.mB,{}),(0,r.jsx)(iS._2,{variant:"destructive",onClick:()=>e.chain().focus().deleteSelection().run(),children:"Supprimer"})]})]}),(0,r.jsx)("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:t=>{let n=t.target.files?.[0];if(!n)return;let r=new FileReader;r.onload=()=>{e.chain().focus().updateDocsGraphic({src:r.result}).run()},r.readAsDataURL(n),t.target.value=""}})]})});return(0,rf.createPortal)(N,document.body)});var sI=n(74183),sT=n(80654),sD=n(84999),sL=n(81847),sF=n(69535),sE=n(76054),sR=n(63048),sH=n(98407);function sB(){return(0,r.jsx)("span",{className:"mx-0.5 h-6 w-px shrink-0 bg-border","aria-hidden":!0})}function s$({label:e,disabled:t,onClick:n,children:a}){return(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 rounded-full text-popover-foreground hover:bg-accent hover:text-accent-foreground","aria-label":e,title:e,disabled:t,onClick:n,children:a})}let sO=(0,a.memo)(function({editor:e,canvasRef:t,disabled:n}){let[i,s]=(0,a.useState)(null),[,l]=(0,a.useState)(0),o=(0,a.useCallback)(()=>{if(l(e=>e+1),!e||!i$(e))return void s(null);let t=e.view.dom.querySelector("td.selectedCell, th.selectedCell, .ProseMirror-selectednode table"),n=t?.closest("table")??e.view.dom.querySelector(".ProseMirror-selectednode table");n?s(n.getBoundingClientRect()):s(null)},[e]);if((0,a.useEffect)(()=>{if(!e)return;o(),e.on("selectionUpdate",o),e.on("transaction",o);let n=t.current;return n?.addEventListener("scroll",o,{passive:!0}),window.addEventListener("resize",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o),n?.removeEventListener("scroll",o),window.removeEventListener("resize",o)}},[t,e,o]),!e||n||!i$(e)||!i)return null;let c=iO(e),d=iW(e),u=(0,r.jsx)("div",{className:"docs-table-floating-toolbar pointer-events-auto fixed z-200 -translate-x-1/2",style:{left:i.left+i.width/2,top:Math.max(8,i.top-44)},role:"toolbar","aria-label":"Options de tableau",children:(0,r.jsxs)("div",{className:"flex items-center gap-0.5 rounded-full border border-border bg-popover px-1 py-0.5 text-popover-foreground shadow-md",children:[(0,r.jsx)(s$,{label:"Ins\xe9rer une ligne au-dessus",onClick:()=>e.chain().focus().addRowBefore().run(),children:(0,r.jsx)(sI.A,{className:"size-3.5"})}),(0,r.jsx)(s$,{label:"Ins\xe9rer une ligne en dessous",onClick:()=>e.chain().focus().addRowAfter().run(),children:(0,r.jsx)(sT.A,{className:"size-3.5"})}),(0,r.jsx)(sB,{}),(0,r.jsx)(s$,{label:"Ins\xe9rer une colonne \xe0 gauche",onClick:()=>e.chain().focus().addColumnBefore().run(),children:(0,r.jsx)(sD.A,{className:"size-3.5 -scale-x-100"})}),(0,r.jsx)(s$,{label:"Ins\xe9rer une colonne \xe0 droite",onClick:()=>e.chain().focus().addColumnAfter().run(),children:(0,r.jsx)(sD.A,{className:"size-3.5"})}),(0,r.jsx)(sB,{}),(0,r.jsx)(s$,{label:"Fusionner les cellules",disabled:!c,onClick:()=>e.chain().focus().mergeCells().run(),children:(0,r.jsx)(sL.A,{className:"size-3.5"})}),(0,r.jsx)(s$,{label:"Scinder la cellule",disabled:!d,onClick:()=>e.chain().focus().splitCell().run(),children:(0,r.jsx)(sF.A,{className:"size-3.5"})}),(0,r.jsx)(sB,{}),(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 rounded-full","aria-label":"Bordures de cellule",title:"Bordures de cellule",children:(0,r.jsx)(sE.A,{className:"size-3.5"})})}),(0,r.jsxs)(iS.SQ,{align:"center",className:"min-w-48",children:[(0,r.jsx)(iS._2,{onClick:()=>iG(e,iB("#000000")),children:"Bordures noires"}),(0,r.jsx)(iS._2,{onClick:()=>iY(e),children:"Supprimer les bordures"}),(0,r.jsx)(iS.mB,{}),tx.slice(0,6).map(t=>(0,r.jsxs)(iS._2,{onClick:()=>iG(e,iB(t)),children:[(0,r.jsx)("span",{className:"mr-2 inline-block size-4 rounded-sm border border-border",style:{backgroundColor:t},"aria-hidden":!0}),t]},t))]})]}),(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 rounded-full","aria-label":"Couleur de cellule",title:"Couleur de cellule",children:(0,r.jsx)(sR.A,{className:"size-3.5"})})}),(0,r.jsx)(iS.SQ,{align:"center",className:"min-w-44",children:tf.map(t=>(0,r.jsxs)(iS._2,{onClick:()=>i_(e,t.color||null),children:[(0,r.jsx)("span",{className:"mr-2 inline-block size-4 rounded-sm border border-border",style:{backgroundColor:t.color||"transparent"},"aria-hidden":!0}),t.label]},t.id||"none"))})]}),(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 rounded-full","aria-label":"Alignement vertical",title:"Alignement vertical",children:(0,r.jsx)(sH.A,{className:"size-3.5"})})}),(0,r.jsxs)(iS.SQ,{align:"center",children:[(0,r.jsx)(iS._2,{onClick:()=>iq(e,"top"),children:"Haut"}),(0,r.jsx)(iS._2,{onClick:()=>iq(e,"middle"),children:"Milieu"}),(0,r.jsx)(iS._2,{onClick:()=>iq(e,"bottom"),children:"Bas"})]})]}),(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:(0,v.cn)("size-8 shrink-0 rounded-full"),"aria-label":"Plus d'options",title:"Plus d'options",children:(0,r.jsx)(eR.In,{icon:"material-symbols:more-horiz",className:"size-4"})})}),(0,r.jsxs)(iS.SQ,{align:"end",className:"min-w-52",children:[(0,r.jsx)(iS._2,{onClick:()=>e.chain().focus().toggleHeaderRow().run(),children:"Ligne d'en-t\xeate"}),(0,r.jsx)(iS._2,{onClick:()=>e.chain().focus().toggleHeaderColumn().run(),children:"Colonne d'en-t\xeate"}),(0,r.jsx)(iS.mB,{}),(0,r.jsx)(iS._2,{onClick:()=>e.chain().focus().deleteRow().run(),children:"Supprimer la ligne"}),(0,r.jsx)(iS._2,{onClick:()=>e.chain().focus().deleteColumn().run(),children:"Supprimer la colonne"}),(0,r.jsxs)(iS._2,{className:"text-destructive focus:text-destructive",onClick:()=>e.chain().focus().deleteTable().run(),children:[(0,r.jsx)(F.A,{className:"mr-2 size-4"}),"Supprimer le tableau"]})]})]})]})});return(0,rf.createPortal)(u,document.body)});function sW({editor:e,pageLayout:t,zoom:n,editable:i,showLayout:s,showRuler:l,showNonPrintableChars:o,editorMode:c,outlineExpanded:d,onToggleOutline:u,onPageCountChange:h,onCurrentPageChange:m,toolbar:p,toolbarShellClassName:g,onRegionContentChange:f,onPageSetupChange:x,onRegionEditorChange:b,onPageStackReady:y}){let j=(0,a.useRef)(null),w=(0,a.useRef)(null),[N,k]=(0,a.useState)(1),[C,S]=(0,a.useState)(!1),[A,M]=(0,a.useState)(!1),[z,P]=(0,a.useState)(null),[I,T]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=e=>{let t=e.detail;P(t?.section??null),M(!0)},t=()=>T(!0);return window.addEventListener(ae,e),window.addEventListener(rD,t),()=>{window.removeEventListener(ae,e),window.removeEventListener(rD,t)}},[]);let D=s&&l,L=n/100,F=!!p||D,E=i&&"view"!==c,R=A&&i&&"view"!==c,{pageLayoutWithMargins:H,beginMarginDrag:B,moveMarginDrag:$,endMarginDrag:O,dragTooltip:W}=function({pageLayout:e,editable:t,onPageSetupChange:n}){let[r,i]=(0,a.useState)(null),[s,l]=(0,a.useState)(null),o=(0,a.useRef)(e.marginsPx),c=(0,a.useRef)(null),d=(0,a.useRef)(e);d.current=e;let u=(0,a.useMemo)(()=>ss(e.marginsPx,r),[e.marginsPx,r]),h=(0,a.useMemo)(()=>({...e,marginsPx:u}),[e,u]),m=(0,a.useCallback)(e=>{t&&(o.current=ss(d.current.marginsPx,c.current),c.current=null)},[t]),p=(0,a.useCallback)((e,n,r,a)=>{var s,u,h,m;let p,g,f;if(!t)return;let x=d.current,{nextPreview:b,clamped:y}=(s=o.current,u=c.current,h=x.widthPx,m=x.heightPx,p=ss(s,u),g=n,"right"===e?g=h-n:"bottom"===e&&(g=m-n),f=function(e,t,n,r,a){switch(e){case"left":return Math.round(Math.max(12,Math.min(t,r-n.right-48)));case"right":return Math.round(Math.max(12,Math.min(t,r-n.left-48)));case"top":return Math.round(Math.max(12,Math.min(t,a-n.bottom-48)));case"bottom":return Math.round(Math.max(12,Math.min(t,a-n.top-48)))}}(e,g,p,h,m),{nextPreview:{...u??{},[e]:f},clamped:f});c.current=b,i(b),l({label:function(e,t){let{unit:n,majorStepPx:r}=i1(t),a=i2(e/r,n);return"inch"===n?`${a}"`:`${a} cm`}(y,x.format.id),x:r,y:a})},[t]);return{marginsPx:u,pageLayoutWithMargins:h,marginDragActive:null!=r,dragTooltip:s,beginMarginDrag:m,moveMarginDrag:p,endMarginDrag:(0,a.useCallback)(()=>{l(null);let e=c.current;if(c.current=null,!t||!e)return void i(null);let r=ss(d.current.marginsPx,e);i(null),n?.({marginsMm:{top:ng(r.top),right:ng(r.right),bottom:ng(r.bottom),left:ng(r.left)}},{immediate:!0})},[t,n]),cancelMarginDrag:(0,a.useCallback)(()=>{c.current=null,i(null),l(null)},[])}}({pageLayout:t,editable:E,onPageSetupChange:x}),_=function({canvasRef:e,rulerTrackRef:t,editor:n,pageLayout:r,zoom:i,pageCount:s}){let l=i/100,o=r.heightPx*l,c=o+iz.sl*l,[d,u]=(0,a.useState)(()=>({currentPage:0,pageTopInViewport:0,pageHeightScaled:o,canvasWidth:0,canvasScrollbarWidth:0,canvasScrollLeft:0,indents:si(r)})),h=(0,a.useCallback)(()=>{let t=e.current;if(!t)return;let a=t.getBoundingClientRect(),i=t.querySelector("[data-docs-page-stack]"),d=0,h=0;if(i){var m;let e=i.getBoundingClientRect().top-a.top;m=t.clientHeight,d=e+(h=s<=1||c<=0||m<=0?0:Math.min(s-1,Math.max(0,Math.floor((m/2-e)/c))))*c}u({currentPage:h,pageTopInViewport:d,pageHeightScaled:o,canvasWidth:t.clientWidth,canvasScrollbarWidth:Math.max(0,t.offsetWidth-t.clientWidth),canvasScrollLeft:t.scrollLeft,indents:function(e,t,n){var r;let a=si(n);if(!e||e.isDestroyed)return a;let i=e.view.dom;if(!i)return a;let{from:s}=e.state.selection,l=e.view.domAtPos(s).node;l.nodeType===Node.TEXT_NODE&&(l=l.parentElement??l);let o=l.closest?.("p, h1, h2, h3, h4, li, blockquote, pre, td, th");if(!o||!i.contains(o))return a;let c=i.closest("[data-docs-page-stack]");if(!c)return a;let d=c.getBoundingClientRect(),u=(r=o.getBoundingClientRect().left-d.left,t<=0?r:r/t),h=parseFloat(getComputedStyle(o).textIndent)||0;return{leftPx:Math.max(n.marginsPx.left,u),firstLinePx:Math.max(n.marginsPx.left,u+h),rightPx:n.widthPx-n.marginsPx.right}}(n,l,r)})},[e,n,s,o,r,c,l]);return(0,a.useEffect)(()=>{h();let n=e.current;if(!n)return;n.addEventListener("scroll",h,{passive:!0});let r=new ResizeObserver(h);r.observe(n);let a=t.current;return a&&r.observe(a),()=>{n.removeEventListener("scroll",h),r.disconnect()}},[e,t,h]),(0,a.useEffect)(()=>{if(!n||n.isDestroyed)return;let e=()=>h();return n.on("selectionUpdate",e),n.on("transaction",e),()=>{n.off("selectionUpdate",e),n.off("transaction",e)}},[n,h]),(0,a.useEffect)(()=>{h()},[r,i,s,h]),d}({canvasRef:j,rulerTrackRef:w,editor:e,pageLayout:H,zoom:n,pageCount:N,narrowViewport:C});return(0,a.useEffect)(()=>{m?.(_.currentPage+1)},[m,_.currentPage]),(0,a.useEffect)(()=>{y?.(()=>j.current?.querySelector("[data-docs-page-stack]")??null)},[y,N,s,n]),(0,r.jsxs)("div",{className:"docs-editor-workspace flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,r.jsx)(i5,{tooltip:W}),(0,r.jsx)(sP,{editor:e,canvasRef:j,disabled:!i||"view"===c}),(0,r.jsx)(sO,{editor:e,canvasRef:j,disabled:!i||"view"===c}),(0,r.jsx)(sk,{editor:e,open:I&&i&&"view"!==c,onClose:()=>T(!1)}),F?(0,r.jsxs)("div",{className:(0,v.cn)("docs-toolbar-shell min-w-0 shrink-0",g),children:[p,D?(0,r.jsx)(sr,{pageLayout:H,scale:L,rulerSync:_,rulerTrackRef:w,contentInsetRight:320*!!R,outlineExpanded:d,onToggleOutline:u,editable:E,onMarginDragStart:B,onMarginDrag:$,onMarginDragEnd:O}):null]}):null,(0,r.jsxs)("div",{className:"relative min-h-0 flex-1 overflow-hidden",children:[D?(0,r.jsx)(sa,{pageLayout:H,scale:L,rulerSync:_,editable:E,onMarginDragStart:B,onMarginDrag:$,onMarginDragEnd:O}):null,(0,r.jsxs)("div",{className:"flex h-full min-h-0 flex-row",style:D?{paddingLeft:iz.cQ}:void 0,children:[(0,r.jsx)("div",{className:"flex h-full min-h-0 min-w-0 flex-1 flex-col",children:(0,r.jsx)(iV,{editor:e,pageLayout:H,zoom:n,editable:i,showLayout:s,showRuler:!1,showNonPrintableChars:o,editorMode:c,canvasRef:j,onPageCountChange:e=>{k(e),h?.(e)},onNarrowViewportChange:S,onRegionContentChange:f,onPageSetupChange:x,onRegionEditorChange:b})}),(0,r.jsx)(ad,{editor:e,pageLayout:H,open:R,focusSection:z,onClose:()=>{M(!1),P(null)}})]})]})]})}let s_={opening:"Ouverture du document…",session:"Pr\xe9paration de l'\xe9diteur…",import:"Import du document…",collaboration:"Connexion \xe0 la collaboration…",connecting:"Chargement…"};function sq({phase:e="connecting",title:t,className:n,overlay:a=!1}){let i=s_[e];return(0,r.jsxs)("div",{className:(0,v.cn)("docs-loading-splash",a&&"docs-loading-splash--overlay",n),role:"status","aria-live":"polite","aria-label":i,"data-drive-app":!0,children:[(0,r.jsx)("div",{className:"docs-loading-splash__aurora","aria-hidden":!0}),(0,r.jsx)("div",{className:"docs-loading-splash__grain","aria-hidden":!0}),(0,r.jsxs)("div",{className:"docs-loading-splash__content",children:[(0,r.jsx)("div",{className:"docs-loading-splash__pill",children:"ULTIDOCS"}),(0,r.jsx)("img",{src:(0,tB.w)("/ultidrive-mark.svg"),alt:"",className:"docs-loading-splash__mark",width:56,height:56,decoding:"async",draggable:!1}),t?(0,r.jsx)("p",{className:"docs-loading-splash__title",title:t,children:t}):null,(0,r.jsx)("p",{className:"docs-loading-splash__subtitle",children:i}),(0,r.jsx)("div",{className:"docs-loading-splash__loader","aria-hidden":!0,children:(0,r.jsx)("span",{})})]})]})}var sG=n(10883),sY=n(96529),sU=n(30758),sX=n(85569);let sJ=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,72],sV={1:28,2:22,3:18,4:16},sK=11;function sQ(e){let t=0,n=1/0;return sJ.forEach((r,a)=>{let i=Math.abs(r-e);i<n&&(n=i,t=a)}),t}function sZ(e){let t=e.find(e=>"textStyle"===e.type.name);var n=t?.attrs.fontSize;if(!n)return null;let r=Number.parseInt(String(n).replace("px",""),10);return Number.isFinite(r)?r:null}function s0(e){for(let t=e.depth;t>0;t--){let n=e.node(t);if("heading"===n.type.name)return n.attrs.level}return null}function s1(e){let{state:t}=e,{$from:n}=t.selection;if(t.storedMarks){let e=sZ(t.storedMarks);if(null!=e)return e}let r=sZ(n.marks());if(null!=r)return r;let a=s0(n);return null!=a?sV[a]??11:0===n.parent.content.size?sK:11}function s2(e){let{from:t,to:n,empty:r}=e.state.selection;if(r)return{kind:"single",size:s1(e)};let a=function(e,t,n){let r=new Set,{state:a}=e;return a.doc.nodesBetween(t,n,(e,i)=>{if(!e.isText||!e.text)return;let s=i+e.text.length,l=Math.max(t,i);l>=Math.min(n,s)||r.add(function(e,t){let n=sZ(t);if(null!=n)return n;let r=s0(e);return null!=r?sV[r]??11:11}(a.doc.resolve(l),e.marks))}),r}(e,t,n);return 0===a.size?{kind:"single",size:s1(e)}:1===a.size?{kind:"single",size:[...a][0]}:{kind:"unset"}}function s4(e){let t=s2(e);return"single"===t.kind?t.size:11}function s5(e,t){sK=t,e.chain().focus().setFontSize(`${t}px`).run()}function s3(e,t){let n=sQ(s4(e)),r=Math.min(sJ.length-1,Math.max(0,n+t));s5(e,sJ[r])}function s8(e,t){let n=sQ(s4(e));return t<0?n>0:n<sJ.length-1}var s6=n(30957),s9=n(19912),s7=n(52258);let le="ultidocs:link-popover-open";var lt=n(94927),ln=n(36041);async function lr(e){if("directory"===e.type){let t=e.is_shared?"shared":"files";return(0,sy.QS)(t,e.path)}if((0,ln.pQ)(e)&&e.external_url)return e.external_url;if((0,sb.lu)(e)){let t=e.file_id;if(!t){let n=e.path.startsWith("/")?e.path:`/${e.path}`;t=(await lt.uE.get(`/drive/files/info${n}`)).file_id}if(t)return(0,rT.Pc)(t)}return(0,sb.db)(e),(0,rT.ec)(e.path)}var la=n(59848);function li({active:e,disabled:t,onPrepareOpen:n}){return(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:(0,v.cn)("docs-toolbar-btn size-7 shrink-0",e&&"docs-toolbar-btn--active"),disabled:t,"aria-label":"Hyperlien",title:"Hyperlien","aria-pressed":e,onMouseDown:e=>{e.preventDefault(),n()},children:(0,r.jsx)(tA.A,{className:"size-4"})})}function ls({item:e,disabled:t,onPick:n}){return(0,r.jsxs)("button",{type:"button",disabled:t,className:"flex w-full min-w-0 items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent disabled:pointer-events-none disabled:opacity-50",onMouseDown:e=>e.preventDefault(),onClick:()=>n(e),children:[(0,r.jsx)(s9._G,{file:e,className:"size-4 shrink-0"}),(0,r.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,r.jsx)("span",{className:"block truncate text-sm",children:(0,sx._g)(e.name)}),(0,r.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:(0,s7.$$)(e.path,e.type)})]})]})}function ll({editor:e,disabled:t,active:n}){let[i,s]=(0,a.useState)(!1),[l,o]=(0,a.useState)(""),[c,d]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1),m=(0,a.useRef)(null),p=(0,a.useRef)(null),g=(0,la.o)(c,250),{data:f,isFetching:x}=(0,sg.tA)(g,"all","/",i),y=f?.files??[],j=(0,a.useCallback)(()=>{let e=p.current;return!!(e&&e.from!==e.to)},[]),v=(0,a.useCallback)(t=>{let n,r=(n=(t??l).trim())?/^(https?:\/\/|mailto:|tel:|\/|#)/i.test(n)?n:`https://${n}`:"",a=p.current,i=e.chain().focus();if(a&&a.from!==a.to)i=i.setTextSelection({from:a.from,to:a.to});else{if(!e.isActive("link"))return;i=i.extendMarkRange("link")}r?i.setLink({href:r}).run():i.unsetLink().run(),s(!1),o(""),d(""),p.current=null},[e,l]),w=(0,a.useCallback)(()=>{let{from:t,to:n}=e.state.selection;p.current={from:t,to:n},o(e.getAttributes("link").href??""),d("")},[e]),N=(0,a.useCallback)(async e=>{h(!0);try{let t=await lr(e);o(t),v(t)}catch{window.alert("Impossible de cr\xe9er le lien vers ce fichier.")}finally{h(!1)}},[v]);(0,a.useEffect)(()=>{if(!i)return;let e=window.requestAnimationFrame(()=>{m.current?.focus(),m.current?.select()});return()=>window.cancelAnimationFrame(e)},[i]),(0,a.useEffect)(()=>{let e=()=>{w(),s(!0)};return window.addEventListener(le,e),()=>window.removeEventListener(le,e)},[w]);let k=j()||e.isActive("link"),C=c.trim();return(0,r.jsxs)(sX.AM,{open:i,onOpenChange:e=>{s(e),e||(o(""),d(""),p.current=null)},children:[(0,r.jsx)(sX.Wv,{asChild:!0,children:(0,r.jsx)(li,{active:n,disabled:t,onPrepareOpen:w})}),(0,r.jsxs)(sX.hl,{className:"w-80 p-0",align:"start",sideOffset:6,children:[(0,r.jsxs)("div",{className:"border-b px-3 py-2",children:[(0,r.jsx)("label",{htmlFor:"docs-link-url",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Adresse du lien"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("input",{ref:m,id:"docs-link-url",type:"text",inputMode:"url",value:l,placeholder:"https:// ou /drive/…",disabled:t||u,className:"h-8 min-w-0 flex-1 rounded-md border border-input bg-background px-2 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),v())}}),(0,r.jsx)(b.$,{type:"button",size:"sm",disabled:t||!k||u,onClick:()=>v(),children:"OK"})]}),k?null:(0,r.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"S\xe9lectionnez du texte pour cr\xe9er un hyperlien."})]}),(0,r.jsxs)("div",{className:"px-3 py-2",children:[(0,r.jsx)("label",{htmlFor:"docs-link-drive-search",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Fichier du Drive"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(s6.A,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,r.jsx)("input",{id:"docs-link-drive-search",type:"search",value:c,placeholder:"Rechercher un fichier…",disabled:t||u,className:"h-8 w-full rounded-md border border-input bg-background py-0 pl-7 pr-2 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",onChange:e=>d(e.target.value)})]})]}),(0,r.jsx)("div",{className:"max-h-48 overflow-y-auto border-t px-1 py-1",children:u?(0,r.jsxs)("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[(0,r.jsx)(sm.A,{className:"size-4 animate-spin"}),"Cr\xe9ation du lien…"]}):C.length<2?(0,r.jsx)("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"Saisissez au moins 2 caract\xe8res pour rechercher dans votre Drive."}):x?(0,r.jsxs)("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[(0,r.jsx)(sm.A,{className:"size-4 animate-spin"}),"Recherche…"]}):0===y.length?(0,r.jsxs)("p",{className:"px-2 py-3 text-sm text-muted-foreground",children:["Aucun fichier pour \xab ",C," \xbb"]}):y.map(e=>(0,r.jsx)(ls,{item:e,disabled:t||!k,onPick:N},e.path))}),e.isActive("link")?(0,r.jsx)("div",{className:"border-t px-2 py-1.5",children:(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 w-full justify-start text-destructive hover:text-destructive",disabled:t,onClick:()=>v(""),children:"Supprimer le lien"})}):null]})]})}var lo=n(98306);let lc=a0.map(e=>({name:e.name,stack:e.stack,source:"system"}));function ld(e,t){return e.find(e=>e.name===t)?.stack??t}function lu({editor:e}){return e?function({editor:e}){let t=function(e){let{storedMarks:t}=e.state;if(t){let e=t.find(e=>"highlight"===e.type.name),n=e?.attrs.color;if(n)return n}return e.isActive("highlight")?e.getAttributes("highlight").color??null:null}(e),n=il(e),r=ib(e);return{canUndo:e.can().chain().focus().undo().run(),canRedo:e.can().chain().focus().redo().run(),styleId:a6(e),fontFamilyState:function(e){let{from:t,to:n,empty:r}=e.state.selection;if(r)return{kind:"single",name:a5(e)};let a=function(e,t,n){let r=new Set,{state:a}=e;return a.doc.nodesBetween(t,n,(e,a)=>{if(!e.isText||!e.text)return;let i=a+e.text.length;Math.max(t,a)>=Math.min(n,i)||r.add(a4(a2(e.marks))??a1)}),r}(e,t,n);return 0===a.size?{kind:"single",name:a5(e)}:1===a.size?{kind:"single",name:[...a][0]}:{kind:"unset"}}(e),fontSizeState:s2(e),canStepFontSizeDown:s8(e,-1),canStepFontSizeUp:s8(e,1),textColor:e.getAttributes("textStyle").color||"#000000",highlightColor:t,isBold:e.isActive("bold"),isItalic:e.isActive("italic"),isUnderline:e.isActive("underline"),isLink:e.isActive("link"),alignLeft:e.isActive({textAlign:"left"}),alignCenter:e.isActive({textAlign:"center"}),alignRight:e.isActive({textAlign:"right"}),alignJustify:e.isActive({textAlign:"justify"}),isBulletList:e.isActive("bulletList"),isOrderedList:e.isActive("orderedList"),isTaskList:r.isTaskList,canIncreaseIndent:!!e&&!e.isDestroyed&&(e.isActive("taskItem")?e.can().sinkListItem("taskItem"):e.isActive("listItem")?e.can().sinkListItem("listItem"):ie(e.state.doc,e.state.selection.from,e.state.selection.to).some(({node:e})=>it((e.attrs.indentLevel??0)+1)!==it(e.attrs.indentLevel??0))),canDecreaseIndent:!!e&&!e.isDestroyed&&(e.isActive("taskItem")?e.can().liftListItem("taskItem"):e.isActive("listItem")?e.can().liftListItem("listItem"):ie(e.state.doc,e.state.selection.from,e.state.selection.to).some(({node:e})=>it(e.attrs.indentLevel??0)>0)),lineHeightPresetId:n.lineHeightPresetId,graphicSelected:e.isActive("docsGraphic")||e.isActive("docsInlineGraphic")}}({editor:e}):null}function lh(e,t){var n,r,a,i;if(null==e||null==t)return e===t;return!!t&&(n=e.fontFamilyState,r=t.fontFamilyState,n.kind===r.kind&&("single"!==n.kind||"single"!==r.kind||n.name===r.name))&&(a=e.fontSizeState,i=t.fontSizeState,a.kind===i.kind&&("single"!==a.kind||"single"!==i.kind||a.size===i.size)&&e.canUndo===t.canUndo&&e.canRedo===t.canRedo&&e.styleId===t.styleId&&e.canStepFontSizeDown===t.canStepFontSizeDown&&e.canStepFontSizeUp===t.canStepFontSizeUp&&e.textColor===t.textColor&&e.highlightColor===t.highlightColor&&e.isBold===t.isBold&&e.isItalic===t.isItalic&&e.isUnderline===t.isUnderline&&e.isLink===t.isLink&&e.alignLeft===t.alignLeft&&e.alignCenter===t.alignCenter&&e.alignRight===t.alignRight&&e.alignJustify===t.alignJustify&&e.isBulletList===t.isBulletList&&e.isOrderedList===t.isOrderedList&&e.isTaskList===t.isTaskList&&e.canIncreaseIndent===t.canIncreaseIndent&&e.canDecreaseIndent===t.canDecreaseIndent&&e.lineHeightPresetId===t.lineHeightPresetId&&e.graphicSelected===t.graphicSelected)}let lm=[50,75,90,100,125,150,200],lp=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#efefef","#f3f3f3","#ffffff","#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff"],lg=["#ffff00","#fff475","#fce8b2","#f4cccc","#ffc8dd","#d9ead3","#b6d7a8","#cfe2f3","#a4c2f4","#d9d2e9","#e6e6e6"],lf=(0,a.memo)(function({editor:e,disabled:t,zoom:n,onZoomChange:i,spellcheck:l,onToggleSpellcheck:o,showChromeToggle:d,chromeCollapsed:u,onToggleChromeCollapsed:h,onPrint:m,embedded:p}){let g=(0,s.er)({editor:e,selector:lu,equalityFn:lh}),f=tg(),x=(0,lo.I)({queryKey:["richtext","fonts"],queryFn:async()=>{try{let e=await lt.uE.get("/richtext/fonts");return e.fonts?.length?e.fonts:lc}catch{return lc}},staleTime:3e5}).data??a0.map(e=>({name:e.name,stack:e.stack})),[y,j]=(0,a.useState)(!1),w=(0,a.useMemo)(()=>{if(!e||!g)return[];let{canUndo:a,canRedo:s,styleId:d,fontFamilyState:u,fontSizeState:h,canStepFontSizeDown:p,canStepFontSizeUp:y,textColor:v,highlightColor:w,isBold:N,isItalic:k,isUnderline:C,isLink:S,alignLeft:A,alignCenter:M,alignRight:z,alignJustify:P,isBulletList:I,isOrderedList:T,isTaskList:D,canIncreaseIndent:L,canDecreaseIndent:F,lineHeightPresetId:E}=g;return[{id:"history",sepAfter:!1,node:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(lb,{disabled:t||!a,onClick:()=>e.chain().focus().undo().run(),label:"Annuler",children:(0,r.jsx)(sG.A,{className:"size-4"})}),(0,r.jsx)(lb,{disabled:t||!s,onClick:()=>e.chain().focus().redo().run(),label:"R\xe9tablir",children:(0,r.jsx)(sY.A,{className:"size-4"})})]})},{id:"print",sepAfter:!1,node:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(lb,{label:"Imprimer",onClick:()=>{m?m():c.oR.error("Impossible d'imprimer le document")},children:(0,r.jsx)(eM.A,{className:"size-4"})}),(0,r.jsx)(lb,{disabled:t,active:l,label:l?"D\xe9sactiver la v\xe9rification orthographique":"Activer la v\xe9rification orthographique",onClick:o,children:(0,r.jsx)(eR.In,{icon:"material-symbols:spellcheck",className:"size-4"})}),(0,r.jsx)(lb,{disabled:!0,label:"Reproduire la mise en forme (bient\xf4t)",children:(0,r.jsx)(eR.In,{icon:"material-symbols:format-paint-outline",className:"size-4"})})]})},{id:"zoom",sepAfter:!0,node:(0,r.jsxs)(e9.l6,{value:String(n),onValueChange:e=>i(Number(e)),disabled:t,children:[(0,r.jsx)(e9.bq,{className:"docs-toolbar-select h-7 w-[72px] shrink-0 border-0 bg-transparent px-1 shadow-none",children:(0,r.jsx)(e9.yv,{})}),(0,r.jsx)(e9.gC,{children:lm.map(e=>(0,r.jsxs)(e9.eb,{value:String(e),children:[e,"%"]},e))})]})},{id:"style",sepAfter:!0,node:f?(0,r.jsx)(e7,{value:d,disabled:t,documentStyles:f.state.documentStyles,userStyles:f.state.userStyles,onValueChange:e=>f.applyStyle(e)}):(0,r.jsx)(e9.l6,{value:d,disabled:!0,children:(0,r.jsx)(e9.bq,{className:"docs-toolbar-select h-7 w-[120px] shrink-0 border-0 bg-transparent px-1 shadow-none",children:(0,r.jsx)(e9.yv,{})})})},{id:"font-family",sepAfter:!0,node:(0,r.jsxs)(e9.l6,{disabled:t,value:"single"===u.kind?u.name:void 0,onValueChange:t=>{e.chain().focus().setFontFamily(ld(x,t)).run()},children:[(0,r.jsx)(e9.bq,{variant:"ghost",className:"docs-toolbar-select docs-toolbar-select--font-family h-7 w-[108px] shrink-0 border-0 bg-transparent px-1 py-0 shadow-none",style:"single"===u.kind?{fontFamily:ld(x,u.name)}:void 0,children:(0,r.jsx)(e9.yv,{placeholder:"Police"})}),(0,r.jsx)(e9.gC,{className:"docs-toolbar-select-content docs-toolbar-select-content--font",children:x.map(e=>(0,r.jsx)(e9.eb,{value:e.name,children:(0,r.jsx)("span",{className:"docs-toolbar-font-preview",style:{fontFamily:e.stack},children:e.name})},e.name))})]})},{id:"font-size",sepAfter:!0,node:(0,r.jsxs)("div",{className:"docs-toolbar-font-size flex shrink-0 items-center",children:[(0,r.jsx)(lb,{disabled:t||!p,label:"Diminuer la taille",className:"docs-toolbar-btn--size-step",onClick:()=>s3(e,-1),children:(0,r.jsx)(tF.A,{className:"size-3.5"})}),(0,r.jsxs)(e9.l6,{disabled:t,value:"single"===h.kind?String(h.size):void 0,onValueChange:t=>s5(e,Number(t)),children:[(0,r.jsx)(e9.bq,{className:"docs-toolbar-select docs-toolbar-select--size shrink-0 bg-transparent shadow-none",children:(0,r.jsx)(e9.yv,{placeholder:""})}),(0,r.jsx)(e9.gC,{children:sJ.map(e=>(0,r.jsx)(e9.eb,{value:String(e),children:e},e))})]}),(0,r.jsx)(lb,{disabled:t||!y,label:"Augmenter la taille",className:"docs-toolbar-btn--size-step",onClick:()=>s3(e,1),children:(0,r.jsx)(tz.A,{className:"size-3.5"})})]})},{id:"marks-basic",sepAfter:!1,node:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(lb,{disabled:t,active:N,onClick:()=>e.chain().focus().toggleMark("bold").run(),label:"Gras",children:(0,r.jsx)(eH.A,{className:"size-4"})}),(0,r.jsx)(lb,{disabled:t,active:k,onClick:()=>e.chain().focus().toggleMark("italic").run(),label:"Italique",children:(0,r.jsx)(eB.A,{className:"size-4"})}),(0,r.jsx)(lb,{disabled:t,active:C,onClick:()=>e.chain().focus().toggleUnderline().run(),label:"Soulign\xe9",children:(0,r.jsx)(e$.A,{className:"size-4"})}),(0,r.jsx)(lj,{disabled:t,label:"Couleur du texte",colors:lp,currentColor:v,onPick:t=>e.chain().focus().setColor(t).run(),icon:"material-symbols:format-color-text"})]})},{id:"highlight",sepAfter:!0,node:(0,r.jsx)(lv,{disabled:t,colors:lg,currentColor:w??"transparent",isActive:null!=w,onPick:t=>{e.chain().focus().setHighlight({color:t}).run()},onClear:()=>e.chain().focus().unsetHighlight().run()})},{id:"insert-link",sepAfter:!1,node:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ll,{editor:e,disabled:t,active:S}),(0,r.jsx)(lb,{disabled:!0,label:"Commentaire (bient\xf4t)",children:(0,r.jsx)(eR.In,{icon:"material-symbols:add-comment-outline",className:"size-4"})})]})},{id:"insert-graphic",sepAfter:!0,node:(0,r.jsx)(sC,{editor:e,disabled:t})},{id:"align",sepAfter:!1,node:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(lb,{disabled:t,active:A,onClick:()=>e.chain().focus().setTextAlign("left").run(),label:"Aligner \xe0 gauche",children:(0,r.jsx)(eW.A,{className:"size-4"})}),(0,r.jsx)(lb,{disabled:t,active:M,onClick:()=>e.chain().focus().setTextAlign("center").run(),label:"Centrer",children:(0,r.jsx)(e_.A,{className:"size-4"})}),(0,r.jsx)(lb,{disabled:t,active:z,onClick:()=>e.chain().focus().setTextAlign("right").run(),label:"Aligner \xe0 droite",children:(0,r.jsx)(eq.A,{className:"size-4"})}),(0,r.jsx)(lb,{disabled:t,active:P,onClick:()=>e.chain().focus().setTextAlign("justify").run(),label:"Justifier",children:(0,r.jsx)(eG.A,{className:"size-4"})}),(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"docs-toolbar-btn size-7 shrink-0",disabled:t,"aria-label":"Interligne et espacement",children:(0,r.jsx)(eR.In,{icon:"material-symbols:format-line-spacing",className:"size-4"})})}),(0,r.jsxs)(iS.SQ,{align:"start",className:"min-w-[220px]",children:[ta.map(n=>(0,r.jsx)(iS._2,{disabled:t,onClick:()=>e.chain().focus().setDocsLineHeight(n.value).run(),children:(0,r.jsxs)("span",{className:"flex w-full items-center justify-between gap-3",children:[n.label,E===n.id?(0,r.jsx)(eR.In,{icon:"material-symbols:check",className:"size-4 opacity-70"}):null]})},n.id)),(0,r.jsx)(iS._2,{disabled:t,onClick:()=>j(!0),children:"Espacement personnalis\xe9…"})]})]})]})},{id:"lists",sepAfter:!1,node:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(lb,{disabled:t,active:I,onClick:()=>{I?e.chain().focus().toggleBulletList().run():e.chain().focus().applyDocsBulletStyle("disc").run()},label:"Liste \xe0 puces",children:(0,r.jsx)(eY.A,{className:"size-4"})}),(0,r.jsx)(lb,{disabled:t,active:T,onClick:()=>{T?e.chain().focus().toggleOrderedList().run():e.chain().focus().applyDocsOrderedStyle("decimal").run()},label:"Liste num\xe9rot\xe9e",children:(0,r.jsx)(eU.A,{className:"size-4"})}),(0,r.jsx)(lb,{disabled:t,active:D,onClick:()=>{D?e.chain().focus().toggleTaskList().run():e.chain().focus().applyDocsChecklistStyle("simple").run()},label:"Liste de contr\xf4le",children:(0,r.jsx)(eR.In,{icon:"material-symbols:checklist",className:"size-4"})}),(0,r.jsx)(lb,{disabled:t||!F,onClick:()=>e.chain().focus().decreaseDocsIndent().run(),label:"Diminuer le retrait",children:(0,r.jsx)(eR.In,{icon:"material-symbols:format-indent-decrease",className:"size-4"})}),(0,r.jsx)(lb,{disabled:t||!L,onClick:()=>e.chain().focus().increaseDocsIndent().run(),label:"Augmenter le retrait",children:(0,r.jsx)(eR.In,{icon:"material-symbols:format-indent-increase",className:"size-4"})})]})},{id:"clear",sepAfter:!1,node:(0,r.jsx)(lb,{disabled:t,label:"Effacer la mise en forme",onClick:()=>e.chain().focus().unsetAllMarks().clearNodes().run(),children:(0,r.jsx)(eR.In,{icon:"material-symbols:format-clear",className:"size-4"})})}]},[e,g,t,n,i,l,o,f,x]),{containerRef:N,measureRef:k,visibleCount:C,hasOverflow:S}=function(e,t=0){let n=(0,a.useRef)(null),r=(0,a.useRef)(null),[i,s]=(0,a.useState)(e);(0,a.useLayoutEffect)(()=>{s(e)},[e]),(0,a.useLayoutEffect)(()=>{let e=n.current,a=r.current;if(!e||!a)return;let i=()=>{let n=Array.from(a.children);if(0===n.length)return void s(0);let r=e.clientWidth;if(r<=0)return;if(n.reduce((e,t)=>e+t.offsetWidth,0)<=r-t)return void s(n.length);let i=r-36-t,l=0,o=0;for(let e of n){let t=e.offsetWidth;if(l+t>i)break;l+=t,o+=1}s(Math.max(1,o))};i();let l=new ResizeObserver(i);for(let t of(l.observe(e),l.observe(a),a.children))l.observe(t);let o=new MutationObserver(i);return o.observe(a,{childList:!0}),()=>{l.disconnect(),o.disconnect()}},[e,t]);let l=i<e;return{containerRef:n,measureRef:r,visibleCount:i,hasOverflow:l}}(w.length,44*!!d);if(!e)return null;let A=w.slice(0,C),M=w.slice(C),z=(0,r.jsxs)("div",{ref:N,className:"docs-toolbar relative flex min-w-0 w-full max-w-full items-center gap-0 overflow-hidden px-1.5 py-0.5",children:[(0,r.jsx)("div",{ref:k,className:"pointer-events-none invisible absolute left-0 top-0 flex h-0 overflow-hidden whitespace-nowrap","aria-hidden":!0,children:w.map(e=>(0,r.jsxs)("div",{className:"flex shrink-0 items-center",children:[(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-0",children:e.node}),e.sepAfter?(0,r.jsx)(lx,{}):null]},e.id))}),(0,r.jsx)("div",{className:"flex min-w-0 flex-1 items-center overflow-hidden",children:A.map(e=>(0,r.jsxs)("div",{className:"flex shrink-0 items-center",children:[(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-0",children:e.node}),e.sepAfter?(0,r.jsx)(lx,{}):null]},e.id))}),S?(0,r.jsxs)(iS.rI,{children:[(0,r.jsx)(iS.ty,{asChild:!0,children:(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"docs-toolbar-btn size-7 shrink-0","aria-label":"Plus d'actions",children:(0,r.jsx)(su.A,{className:"size-4"})})}),(0,r.jsx)(iS.SQ,{align:"end",className:"max-h-[min(70vh,480px)] w-auto overflow-y-auto p-2",children:(0,r.jsx)("div",{className:"flex flex-col gap-1",children:M.map((e,t)=>(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-0.5 border-t border-border pt-1 first:border-t-0 first:pt-0",children:[null,e.node]},e.id))})})]}):null,d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(lx,{}),(0,r.jsx)(lb,{active:u,label:u?"Afficher l'en-t\xeate du document":"Masquer l'en-t\xeate du document",onClick:h,children:u?(0,r.jsx)(nt.A,{className:"size-4"}):(0,r.jsx)(sU.A,{className:"size-4"})})]}):null]});return p?(0,r.jsxs)(r.Fragment,{children:[z,e?(0,r.jsx)(tu,{open:y,onOpenChange:j,initial:id(e),onApply:t=>e.chain().focus().setDocsCustomSpacing(t).run()}):null]}):(0,r.jsxs)("div",{className:(0,v.cn)("docs-toolbar-shell shrink-0",u&&"docs-toolbar-shell--collapsed"),children:[z,e?(0,r.jsx)(tu,{open:y,onOpenChange:j,initial:id(e),onApply:t=>e.chain().focus().setDocsCustomSpacing(t).run()}):null]})});function lx(){return(0,r.jsx)("span",{"aria-hidden":!0,className:"docs-toolbar-sep"})}function lb({ref:e,children:t,onClick:n,active:a,disabled:i,label:s,className:l,...o}){return(0,r.jsx)(b.$,{ref:e,type:"button",variant:"ghost",size:"icon",className:(0,v.cn)("docs-toolbar-btn size-7 shrink-0",a&&"docs-toolbar-btn--active",l),onClick:n,disabled:i,"aria-label":s,title:s,"aria-pressed":a,...o,children:t})}function ly({icon:e,color:t,highlight:n=!1}){return(0,r.jsxs)("span",{className:(0,v.cn)("docs-toolbar-color-glyph",n&&"docs-toolbar-color-glyph--highlight"),"aria-hidden":!0,children:[(0,r.jsx)(eR.In,{icon:e,className:"docs-toolbar-color-glyph__icon docs-toolbar-icon"}),(0,r.jsx)("span",{className:"docs-toolbar-color-glyph__swatch",style:{backgroundColor:t}})]})}function lj({disabled:e,label:t,colors:n,currentColor:a,onPick:i,icon:s}){return(0,r.jsxs)(sX.AM,{children:[(0,r.jsx)(sX.Wv,{asChild:!0,children:(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"docs-toolbar-btn size-7 shrink-0 px-1",disabled:e,"aria-label":t,title:t,children:(0,r.jsx)(ly,{icon:s,color:a})})}),(0,r.jsx)(sX.hl,{className:"w-auto p-2",align:"start",children:(0,r.jsx)("div",{className:"grid grid-cols-5 gap-1",children:n.map(e=>(0,r.jsx)("button",{type:"button",className:(0,v.cn)("size-6 rounded-sm border border-border",a.toLowerCase()===e.toLowerCase()&&"ring-2 ring-[#1967d2]"),style:{backgroundColor:e},"aria-label":e,onClick:()=>i(e)},e))})})]})}function lv({disabled:e,colors:t,currentColor:n,isActive:a,onPick:i,onClear:s}){return(0,r.jsxs)(sX.AM,{children:[(0,r.jsx)(sX.Wv,{asChild:!0,children:(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"docs-toolbar-btn size-7 shrink-0 px-1",disabled:e,"aria-label":"Couleur de surlignage",title:"Couleur de surlignage",children:(0,r.jsx)(ly,{icon:"material-symbols:format-ink-highlighter",color:n,highlight:!0})})}),(0,r.jsx)(sX.hl,{className:"w-auto p-2",align:"start",children:(0,r.jsxs)("div",{className:"grid grid-cols-6 gap-1",children:[(0,r.jsx)("button",{type:"button",className:(0,v.cn)("flex size-6 items-center justify-center rounded-sm border border-border bg-background text-muted-foreground hover:bg-accent hover:text-accent-foreground",!a&&"ring-2 ring-[#1967d2]"),"aria-label":"Retirer le surlignage",title:"Retirer le surlignage",onClick:s,children:(0,r.jsx)(rH.A,{className:"size-3.5"})}),t.map(e=>(0,r.jsx)("button",{type:"button",className:(0,v.cn)("size-6 rounded-sm border border-border",a&&n.toLowerCase()===e.toLowerCase()&&"ring-2 ring-[#1967d2]"),style:{backgroundColor:e},"aria-label":e,onClick:()=>i(e)},e))]})})]})}var lw=n(19984);function lN({label:e,value:t}){return(0,r.jsxs)("div",{className:"grid grid-cols-[120px_1fr] gap-3 py-2 text-sm",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:e}),(0,r.jsx)("span",{className:"break-all",children:t})]})}function lk({open:e,onOpenChange:t,file:n}){var a,i;let s;return(0,r.jsx)(tt.lG,{open:e,onOpenChange:t,children:(0,r.jsxs)(tt.Cf,{overlayClassName:td.RD,className:(0,v.cn)(td.gO,"sm:max-w-[480px]"),children:[(0,r.jsxs)(tt.c7,{className:td.CU,children:[(0,r.jsx)(tt.L3,{className:(0,v.cn)("text-base font-medium",td.Sz),children:"D\xe9tails"}),(0,r.jsx)(tt.rr,{className:(0,v.cn)("text-sm",td.qj),children:"Informations sur le document."})]}),(0,r.jsxs)("div",{className:(0,v.cn)(td.HD,"divide-y divide-border"),children:[(0,r.jsx)(lN,{label:"Nom",value:(0,sx.Dh)(n.name)}),(0,r.jsx)(lN,{label:"Fichier",value:(0,sx._g)(n.name)}),(0,r.jsx)(lN,{label:"Emplacement",value:n.path}),(0,r.jsx)(lN,{label:"Type",value:n.mime_type||"—"}),(0,r.jsx)(lN,{label:"Taille",value:(a=n.size)<1024?`${a} o`:a<1048576?`${(a/1024).toFixed(1)} Ko`:`${(a/1048576).toFixed(1)} Mo`}),(0,r.jsx)(lN,{label:"Modifi\xe9",value:Number.isNaN((s=new Date(i=n.last_modified)).getTime())?i:s.toLocaleString("fr-FR",{dateStyle:"medium",timeStyle:"short"})})]})]})})}var lC=n(28765);function lS({open:e,onOpenChange:t,onOpenFile:n}){let[i,s]=(0,a.useState)("/"),[l,o]=(0,a.useState)(null),c=(0,sg.GQ)(i,1,"",e),d=(0,a.useMemo)(()=>(c.data?.files??[]).filter(e=>"directory"===e.type),[c.data?.files]),u=(0,a.useMemo)(()=>(c.data?.files??[]).filter(e=>"file"===e.type&&(0,lC.ql)(e)),[c.data?.files]),h=(0,a.useMemo)(()=>{let e=(0,sy.x9)(i);if("/"===e)return[{path:"/",label:"Mon Drive"}];let t=e.slice(1).split("/"),n=[{path:"/",label:"Mon Drive"}];for(let e=0;e<t.length;e++){let r="/"+t.slice(0,e+1).join("/");n.push({path:r,label:(0,sx._g)(t[e])})}return n},[i]),m=async e=>{o(e.path);try{await n(e),t(!1)}finally{o(null)}};return(0,r.jsx)(tt.lG,{open:e,onOpenChange:t,children:(0,r.jsxs)(tt.Cf,{overlayClassName:td.RD,className:(0,v.cn)(td.gO,"flex max-h-[min(80vh,560px)] flex-col gap-0 sm:max-w-[480px]"),children:[(0,r.jsxs)(tt.c7,{className:"shrink-0 px-6 pb-3 pt-6",children:[(0,r.jsx)(tt.L3,{className:(0,v.cn)("text-base font-medium",td.Sz),children:"Ouvrir un document"}),(0,r.jsx)(tt.rr,{className:(0,v.cn)("text-sm",td.qj),children:"Choisissez un document texte dans votre Drive."})]}),(0,r.jsx)("div",{className:(0,v.cn)("shrink-0 px-6 pb-2",td.EM),children:(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1 text-sm",children:h.map((e,t)=>(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[t>0?(0,r.jsx)(B.A,{className:"size-3.5 text-muted-foreground"}):null,(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"sm",className:(0,v.cn)(td.Yr,"h-7 px-2 text-sm"),onClick:()=>s(e.path),children:e.label})]},e.path))})}),(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2",children:c.isLoading?(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)(sm.A,{className:"size-6 animate-spin text-muted-foreground"})}):0===d.length&&0===u.length?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Aucun document dans ce dossier."}):(0,r.jsxs)("ul",{className:"space-y-0.5",children:[d.map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm hover:bg-accent",onClick:()=>s(e.path),children:[(0,r.jsx)(sp.A,{className:"size-4 shrink-0 text-[#5f6368]"}),(0,r.jsx)("span",{className:(0,v.cn)("truncate",td.qp),children:(0,sx._g)(e.name)}),(0,r.jsx)(B.A,{className:"ml-auto size-4 shrink-0 text-muted-foreground"})]})},e.path)),u.map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",disabled:l===e.path,className:"flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm hover:bg-accent disabled:opacity-60",onClick:()=>void m(e),children:[(0,r.jsx)(ep.A,{className:"size-4 shrink-0 text-[#1967d2]"}),(0,r.jsx)("span",{className:(0,v.cn)("truncate",td.qp),children:(0,sx.Dh)(e.name)}),l===e.path?(0,r.jsx)(sm.A,{className:"ml-auto size-4 shrink-0 animate-spin text-muted-foreground"}):null]})},e.path))]})})]})})}var lA=n(84417),lM=n(65378);let lz="ultidrive-docs-page-defaults";function lP(e="a4"){return function(){if("u"<typeof localStorage)return null;try{let e=localStorage.getItem(lz);if(!e)return null;let t=JSON.parse(e);if(!t.formatId||!t.marginsCm)return null;return{formatId:t.formatId,orientation:"landscape"===t.orientation?"landscape":"portrait",marginsCm:{top:Number(t.marginsCm.top)||0,right:Number(t.marginsCm.right)||0,bottom:Number(t.marginsCm.bottom)||0,left:Number(t.marginsCm.left)||0},pageColor:t.pageColor??"#ffffff"}}catch{return null}}()??function(e="a4"){return nN(null,e)}(e)}let lI=[{key:"top",label:"Haut"},{key:"bottom",label:"Bas"},{key:"left",label:"Gauche"},{key:"right",label:"Droite"}],lT="text-xs font-medium text-muted-foreground";function lD({open:e,onOpenChange:t,pageSetup:n,fallbackFormatId:i,onApply:s}){let[l,o]=(0,a.useState)(()=>nN(n,i)),[c,d]=(0,a.useState)(()=>lP(i));(0,a.useEffect)(()=>{e&&(o(nN(n,i)),d(lP(i)))},[e,n,i]);let u=(0,a.useMemo)(()=>l.formatId===c.formatId&&l.orientation===c.orientation&&l.pageColor.toLowerCase()===c.pageColor.toLowerCase()&&l.marginsCm.top===c.marginsCm.top&&l.marginsCm.right===c.marginsCm.right&&l.marginsCm.bottom===c.marginsCm.bottom&&l.marginsCm.left===c.marginsCm.left,[l,c]);return(0,r.jsx)(tt.lG,{open:e,onOpenChange:t,children:(0,r.jsxs)(tt.Cf,{overlayClassName:td.RD,className:(0,v.cn)(td.gO,"h-auto max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] gap-0 overflow-y-auto p-0 sm:max-w-[480px]"),children:[(0,r.jsxs)(tt.c7,{className:"space-y-0 px-5 py-3 text-left",children:[(0,r.jsx)(tt.L3,{className:(0,v.cn)("text-lg font-normal",td.Sz),children:"Configuration de la page"}),(0,r.jsx)(tt.rr,{className:"sr-only",children:"Format, orientation, couleur et marges du document."})]}),(0,r.jsxs)(lM.tU,{defaultValue:"pages",className:"gap-0",children:[(0,r.jsx)("div",{className:"px-5",children:(0,r.jsxs)(lM.j7,{className:"h-9 w-full gap-0 rounded-lg bg-[#f1f3f4] p-1 dark:bg-muted",children:[(0,r.jsx)(lM.Xi,{value:"pages",className:"flex-1 rounded-md px-4 text-sm font-medium text-muted-foreground shadow-none data-[state=active]:bg-white data-[state=active]:text-[#1a73e8] data-[state=active]:shadow-sm dark:data-[state=active]:bg-background dark:data-[state=active]:text-[#8ab4f8]",children:"Pages"}),(0,r.jsx)(lM.Xi,{value:"pageless",disabled:!0,className:"flex-1 rounded-md px-4 text-sm font-medium text-muted-foreground/50 shadow-none",children:"Sans pages"})]})}),(0,r.jsx)(lM.av,{value:"pages",className:"mt-0 px-5 py-3",children:(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3",children:[(0,r.jsxs)("div",{className:"col-span-2 space-y-1",children:[(0,r.jsx)(tr.J,{className:lT,children:"Appliquer \xe0"}),(0,r.jsxs)(e9.l6,{value:"document",disabled:!0,children:[(0,r.jsx)(e9.bq,{className:"h-9",children:(0,r.jsx)(e9.yv,{children:"Au document entier"})}),(0,r.jsx)(e9.gC,{children:(0,r.jsx)(e9.eb,{value:"document",children:"Au document entier"})})]})]}),(0,r.jsxs)("div",{className:"col-span-2 space-y-1",children:[(0,r.jsx)(tr.J,{className:lT,children:"Orientation"}),(0,r.jsxs)(lA.z,{value:l.orientation,onValueChange:e=>o(t=>({...t,orientation:e})),className:"flex h-9 items-center gap-5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(lA.C,{value:"portrait",id:"docs-page-orientation-portrait"}),(0,r.jsx)(tr.J,{htmlFor:"docs-page-orientation-portrait",className:"text-sm font-normal",children:"Portrait"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(lA.C,{value:"landscape",id:"docs-page-orientation-landscape"}),(0,r.jsx)(tr.J,{htmlFor:"docs-page-orientation-landscape",className:"text-sm font-normal",children:"Paysage"})]})]})]}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(tr.J,{className:lT,children:"Format de papier"}),(0,r.jsxs)(e9.l6,{value:l.formatId,onValueChange:e=>o(t=>({...t,formatId:e})),children:[(0,r.jsx)(e9.bq,{className:"h-9",children:(0,r.jsx)(e9.yv,{})}),(0,r.jsx)(e9.gC,{children:nd.map(e=>{let t,n,a;return(0,r.jsx)(e9.eb,{value:e.id,children:(t=e.widthMm/10,n=e.heightMm/10,a=e=>e.toLocaleString("fr-FR",{maximumFractionDigits:1}),`${e.label} (${a(t)} x ${a(n)} cm)`)},e.id)})})]})]}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(tr.J,{className:lT,children:"Couleur de la page"}),(0,r.jsx)("div",{className:"flex h-9 items-center",children:(0,r.jsxs)("label",{className:"relative inline-flex h-8 w-8 cursor-pointer items-center justify-center",children:[(0,r.jsx)("span",{className:"block h-7 w-7 rounded-full border border-[#dadce0] dark:border-border",style:{backgroundColor:l.pageColor},"aria-hidden":!0}),(0,r.jsx)("input",{type:"color",value:l.pageColor,onChange:e=>o(t=>({...t,pageColor:e.target.value})),className:"absolute inset-0 h-full w-full cursor-pointer opacity-0","aria-label":"Couleur de la page"})]})})]}),(0,r.jsxs)("div",{className:"col-span-2 space-y-1",children:[(0,r.jsx)(tr.J,{className:lT,children:"Marges (centim\xe8tres)"}),(0,r.jsx)("div",{className:"grid grid-cols-4 gap-2",children:lI.map(({key:e,label:t})=>(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)(tr.J,{htmlFor:`docs-page-margin-${e}`,className:"text-[11px] font-normal text-muted-foreground",children:t}),(0,r.jsx)(tn.p,{id:`docs-page-margin-${e}`,type:"text",inputMode:"decimal",className:(0,v.cn)("h-9","px-2 text-center text-sm"),value:String(l.marginsCm[e]),onChange:t=>{var n;return n=t.target.value,void o(t=>({...t,marginsCm:{...t.marginsCm,[e]:function(e){let t=e.replace(",",".").trim();if(!t)return 0;let n=Number.parseFloat(t);return Number.isFinite(n)?n:0}(n)}}))}})]},e))})]})]})})]}),(0,r.jsxs)(tt.Es,{className:(0,v.cn)(td.wi,"flex flex-wrap items-center justify-end gap-2 px-5 py-3 sm:justify-end"),children:[u?(0,r.jsx)("span",{className:(0,v.cn)("order-1 text-sm",td.qj),children:"Valeurs par d\xe9faut enregistr\xe9es"}):(0,r.jsx)(b.$,{type:"button",variant:"link",className:"order-1 h-8 px-0 text-sm font-normal text-[#1a73e8] hover:text-[#174ea6]",onClick:()=>{"u">typeof localStorage&&localStorage.setItem(lz,JSON.stringify(l)),d({...l})},children:"Enregistrer comme valeurs par d\xe9faut"}),(0,r.jsx)(b.$,{type:"button",variant:"ghost",className:(0,v.cn)(td.Yr,"order-2 h-8 rounded-full px-4 text-[#1a73e8] hover:bg-transparent hover:text-[#174ea6]"),onClick:()=>t(!1),children:"Annuler"}),(0,r.jsx)(b.$,{type:"button",className:(0,v.cn)(td.Zi,"order-3 h-8 rounded-full px-5"),onClick:()=>{s(nC(l,n)),t(!1)},children:"OK"})]})]})})}var lL=n(26715),lF=n(41733),lE=n(15049);let lR="docs-print-iframe";function lH(){document.getElementById(lR)?.remove()}async function lB(e,t,n){let r,a,i,s,l,o=n.widthPx,c=n.heightPx,d=[];e.documentElement.lang="fr",e.head.replaceChildren(),e.body.replaceChildren();let u=e.createElement("style");for(let h of(r=n.widthPx,a=n.heightPx,u.textContent=`
${i=n.format.widthMm,s=n.format.heightMm,l=n.format.widthMm>n.format.heightMm?`${s}mm ${i}mm`:`${i}mm ${s}mm`,`@page { size: ${l}; margin: 0; }`}
html, body {
margin: 0;
padding: 0;
background: white;
}
.docs-print-page {
width: ${r}px;
height: ${a}px;
overflow: hidden;
break-after: page;
page-break-after: always;
print-color-adjust: exact;
-webkit-print-color-adjust: exact;
}
.docs-print-page:last-child {
break-after: auto;
page-break-after: auto;
}
.docs-print-page img {
display: block;
width: 100%;
height: 100%;
}
`,e.head.appendChild(u),t)){let t=await function(e){return new Promise((t,n)=>{e.toBlob(e=>{e?t(e):n(Error("Impossible de convertir la page en image"))},"image/jpeg",.92)})}(h),n=URL.createObjectURL(t);d.push(n);let r=e.createElement("div");r.className="docs-print-page",r.style.width=`${o}px`,r.style.height=`${c}px`;let a=e.createElement("img");a.alt="",a.width=o,a.height=c,a.src=n,r.appendChild(a),e.body.appendChild(r),await a.decode().catch(()=>void 0)}return()=>{for(let e of d)URL.revokeObjectURL(e)}}async function l$(e,t){if(0===e.length)throw Error("Aucune page \xe0 imprimer");lH();let n=document.createElement("iframe");n.id=lR,n.setAttribute("aria-hidden","true"),n.style.cssText="position:fixed;left:-100000px;top:0;width:1px;height:1px;border:0;opacity:0;pointer-events:none";let r=new Promise((e,t)=>{n.onload=()=>{let r=n.contentDocument;r?e(r):t(Error("Impossible de pr\xe9parer la fen\xeatre d'impression"))},n.onerror=()=>t(Error("Impossible de pr\xe9parer la fen\xeatre d'impression"))});n.src="about:blank",document.body.appendChild(n);let a=await r,i=n.contentWindow;if(!i)throw lH(),Error("Impossible de pr\xe9parer la fen\xeatre d'impression");let s=()=>{};try{s=await lB(a,e,t),await new Promise(e=>requestAnimationFrame(()=>e())),a.fonts?.ready&&await a.fonts.ready,await new Promise((e,t)=>{let n=()=>{i.removeEventListener("afterprint",r),s(),lH()},r=()=>{n(),e()};i.addEventListener("afterprint",r);try{i.focus(),i.print()}catch(e){n(),t(e);return}window.setTimeout(()=>{document.getElementById(lR)&&(n(),e())},2e3)})}catch(e){throw s(),lH(),e}}async function lO(e){let t=await (0,lE.u)(e,{scale:2});await l$(t,e.pageLayout)}var lW=n(91060),l_=n(17728);function lq({open:e,onOpenChange:t,onPickDraw:n}){let[i,s]=(0,a.useState)("/"),[l,o]=(0,a.useState)(null),c=(0,sg.GQ)(i,1,"",e),d=(0,a.useMemo)(()=>(c.data?.files??[]).filter(e=>"directory"===e.type),[c.data?.files]),u=(0,a.useMemo)(()=>(c.data?.files??[]).filter(e=>"file"===e.type&&(0,l_.db)(e)),[c.data?.files]),h=(0,a.useMemo)(()=>{let e=(0,sy.x9)(i);if("/"===e)return[{path:"/",label:"Mon Drive"}];let t=e.slice(1).split("/"),n=[{path:"/",label:"Mon Drive"}];for(let e=0;e<t.length;e++){let r="/"+t.slice(0,e+1).join("/");n.push({path:r,label:(0,sx._g)(t[e])})}return n},[i]),m=async e=>{o(e.path);try{await n(e),t(!1)}catch{window.alert("Impossible de charger ce dessin depuis le Drive.")}finally{o(null)}};return(0,r.jsx)(tt.lG,{open:e,onOpenChange:t,children:(0,r.jsxs)(tt.Cf,{overlayClassName:td.RD,className:(0,v.cn)(td.gO,"flex max-h-[min(80vh,560px)] flex-col gap-0 sm:max-w-[480px]"),children:[(0,r.jsxs)(tt.c7,{className:"shrink-0 px-6 pb-3 pt-6",children:[(0,r.jsx)(tt.L3,{className:(0,v.cn)("text-base font-medium",td.Sz),children:"Dessin depuis Drive"}),(0,r.jsx)(tt.rr,{className:(0,v.cn)("text-sm",td.qj),children:"Choisissez un fichier UltiDraw (.excalidraw) dans votre Drive."})]}),(0,r.jsx)("div",{className:(0,v.cn)("shrink-0 px-6 pb-2",td.EM),children:(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1 text-sm",children:h.map((e,t)=>(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[t>0?(0,r.jsx)(B.A,{className:"size-3.5 text-muted-foreground"}):null,(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"sm",className:(0,v.cn)(td.Yr,"h-7 px-2 text-sm"),onClick:()=>s(e.path),children:e.label})]},e.path))})}),(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2",children:c.isLoading?(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)(sm.A,{className:"size-6 animate-spin text-muted-foreground"})}):0===d.length&&0===u.length?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Aucun dessin dans ce dossier."}):(0,r.jsxs)("ul",{className:"space-y-0.5",children:[d.map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm hover:bg-accent",onClick:()=>s(e.path),children:[(0,r.jsx)(sp.A,{className:"size-4 shrink-0 text-[#5f6368]"}),(0,r.jsx)("span",{className:(0,v.cn)("truncate",td.qp),children:(0,sx._g)(e.name)}),(0,r.jsx)(B.A,{className:"ml-auto size-4 shrink-0 text-muted-foreground"})]})},e.path)),u.map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",disabled:l===e.path,className:"flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm hover:bg-accent disabled:opacity-60",onClick:()=>void m(e),children:[(0,r.jsx)(tT.A,{className:"size-4 shrink-0 text-[#1967d2]"}),(0,r.jsx)("span",{className:(0,v.cn)("truncate",td.qp),children:(0,sx._g)(e.name)}),l===e.path?(0,r.jsx)(sm.A,{className:"ml-auto size-4 shrink-0 animate-spin text-muted-foreground"}):null]})},e.path))]})})]})})}async function lG(e){let t=e.file_id;if(t||(t=(await lt.uE.get(`/drive/files/info${e.path.startsWith("/")?e.path:`/${e.path}`}`)).file_id),!t)throw Error("Identifiant du dessin introuvable");return String(t)}async function lY(e){let t=await (0,sf.WE)(e),r=JSON.parse(await t.text()),{restoreElements:a,restoreAppState:i,exportToSvg:s,serializeAsJSON:l}=await Promise.all([n.e(2492),n.e(3808),n.e(9383),n.e(8205)]).then(n.bind(n,3339)),o=a(r.elements??[],null),c=i(r.appState??{},null),d=r.files??{},u=l(o,c,d,"local"),h=await s({elements:o,appState:c,files:d,skipInliningFonts:!0}),m=new XMLSerializer().serializeToString(h),p=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,{width:g,height:f}=function(e){let t=e.getAttribute("viewBox");if(t){let e=t.split(/\s+/).map(Number);if(4===e.length&&e.every(e=>Number.isFinite(e)))return{width:Math.max(24,Math.round(e[2])),height:Math.max(24,Math.round(e[3]))}}let n=Number(e.getAttribute("width")),r=Number(e.getAttribute("height"));return Number.isFinite(n)&&Number.isFinite(r)&&n>0&&r>0?{width:Math.round(n),height:Math.round(r)}:{width:320,height:240}}(h);return{drawScene:u,src:p,width:g,height:f,drawDriveFileId:await lG(e),alt:e.name}}let lU="ultidrive-docs-view-settings",lX={pageFormatId:"a4",zoom:100,spellcheck:!0,chromeCollapsed:!1,editorMode:"edit",commentsDisplay:"expanded",outlineSidebarExpanded:!1,showLayout:!0,showRuler:!0,showEquationToolbar:!1,showNonPrintableChars:!1};function lJ(e){return Math.min(200,Math.max(50,10*Math.round(e/10)))}function lV(e){"u">typeof localStorage&&localStorage.setItem(lU,JSON.stringify(e))}let lK=["#6D28D9","#BE123C","#C2410C","#A16207","#1D4ED8","#0F766E","#15803D","#A21CAF","#4338CA","#B45309"];function lQ(e){return!e||!function e(t){return!!t&&(Array.isArray(t)?t.some(t=>e(t)):"string"==typeof t.text&&""!==t.text.trim()||!!Array.isArray(t.content)&&t.content.some(t=>e(t)))}(e)}function lZ(e){return e&&"doc"===e.type&&Array.isArray(e.content)&&e.content.length>0?e:{type:"doc",content:[{type:"paragraph"}]}}var l0=n(3166);let l1=["src","alt","title","width","height","placement","wrap","floatSide","x","y","rotationDeg","zIndex","cropX","cropY","cropWidth","cropHeight","cropShape","lockAspectRatio","imageFit","imageFitAnchorH","imageFitAnchorV","assetId","opacity","shadow"],l2={inline:"inline",square:"square",tight:"tight",through:"through",topAndBottom:"top-bottom",topbottom:"top-bottom",behind:"behind",infront:"in-front",inFront:"in-front"},l4={inline:"inline",block:"block",absolute:"absolute",anchored:"absolute"};function l5(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function l3(e,t){let n=l5(e.attrs)?e.attrs:{},r=(0,rb.Bm)(n);return t?{type:"docsGraphic",attrs:{...r,placement:"inline"===r.placement?"block":r.placement,wrap:"inline"===r.wrap?"square":r.wrap}}:{type:"docsInlineGraphic",attrs:{...r,placement:"inline",wrap:"square"===r.wrap?"inline":r.wrap}}}function l8(e){let t=e.wrap??e.textWrap??e.layout,n=e.placement??e.position??e.layoutMode,r="string"==typeof t?l2[t]??t:void 0,a="string"==typeof n?l4[n]??n:void 0;return{...e,...r?{wrap:r}:{},...a?{placement:a}:{},floatSide:e.floatSide??e.align??e.horizontalAlign}}function l6(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function l9(e,t){let n=e.match(RegExp(`border-${t}:\\s*([^;]+)`,"i"));if(!n)return null;let r=n[1]?.trim();if(!r||"none"===r||"0"===r)return null;let a=r.split(/\s+/);if(a.length<2)return null;let i=parseFloat(a[0]??""),s=a[1]??"solid",l=a.slice(2).join(" ")||"#000000";return{size:Number.isFinite(i)?Math.round(8*i):6,style:"solid"===s?"single":s,color:l}}function l7(e){if(!l6(e))return null;if("tableCell"!==e.type&&"tableHeader"!==e.type)return e;let t=l6(e.attrs)?{...e.attrs}:{};if(0===t.rowspan)return null;if(("number"!=typeof t.colspan||t.colspan<1)&&(t.colspan=1),("number"!=typeof t.rowspan||t.rowspan<1)&&(t.rowspan=1),Array.isArray(t.colwidth)){let e=t.colwidth.map(e=>"number"==typeof e&&Number.isFinite(e)?e:null).filter(e=>null!=e);e.length?t.colwidth=e:delete t.colwidth}let n=Array.isArray(e.content)?e.content.map(e=>ot(e)).filter(Boolean):[{type:"paragraph"}];return{...e,attrs:t,content:n.length?n:[{type:"paragraph"}]}}function oe(e){if(!l6(e)||"tableRow"!==e.type)return e;let t=Array.isArray(e.content)?e.content.map(e=>l7(e)).filter(e=>!!e):[];return t.length?{...e,content:t}:null}function ot(e){if(!l6(e))return null;if("table"===e.type){if(!l6(e)||"table"!==e.type)return e;let t=Array.isArray(e.content)?e.content.map(e=>oe(e)).filter(e=>!!e):[];return t.length?{...e,content:t}:{type:"table",content:[{type:"tableRow",content:[{type:"tableCell",content:[{type:"paragraph"}]}]}]}}return"tableRow"===e.type?oe(e):"tableCell"===e.type||"tableHeader"===e.type?l7(e):Array.isArray(e.content)?{...e,content:e.content.map(e=>ot(e)).filter(Boolean)}:e}function on(e){if(!e)return;let t=e.trim();return t.startsWith("#")&&7===t.length?t:/^[0-9a-f]{6}$/i.test(t)?`#${t}`:void 0}function or(e){return Math.round(e/9525)}function oa(e,t){let n=e.match(RegExp(`\\b${t}="(-?\\d+)"`,"i"));if(!n)return null;let r=Number.parseInt(n[1]??"",10);return Number.isFinite(r)?r:null}async function oi(e,t){try{let r,a,{unzipSync:i}=await n.e(6951).then(n.bind(n,86951)),s=i(new Uint8Array(e)),l=(function(e){var t;let n=(t=e["word/document.xml"])?new TextDecoder().decode(t):"";if(!n)return[];let r="word/_rels/document.xml.rels",a=[];for(let t of n.matchAll(/<w:drawing\b[^>]*>[\s\S]*?<\/w:drawing>/gi)){let n=function(e,t,n){let r=e.match(/<wp:extent\b[^>]*\/?>/i)?.[0],a=r?oa(r,"cx"):null,i=r?oa(r,"cy"):null,s=null!=a?Math.max(24,or(a)):240,l=null!=i?Math.max(24,or(i)):160,o=0,c=0,d=e.match(/<wp:positionH\b[^>]*>[\s\S]*?<\/wp:positionH>/i)?.[0],u=e.match(/<wp:positionV\b[^>]*>[\s\S]*?<\/wp:positionV>/i)?.[0],h=d?.match(/<wp:posOffset>(-?\d+)<\/wp:posOffset>/i)?.[1],m=u?.match(/<wp:posOffset>(-?\d+)<\/wp:posOffset>/i)?.[1];h&&(o=or(Number(h))),m&&(c=or(Number(m)));let p=e.match(/\brot="(-?\d+)"/i)?.[1],g=p?Math.round(Number(p)/6e4):0,f=/<wp:anchor\b[^>]*\bbehindDoc="1"/i.test(e),x=/<wp:inline\b/i.test(e),b=x?"inline":f?"behind":"square",y=x?"inline":"absolute",j=e.match(/<a:blip\b[^>]*\bembed="([^"]+)"/i)?.[1];if(j){let e=ni(t,n,j);if(e)return{graphicType:"image",src:e,width:s,height:l,x:o,y:c,rotationDeg:g,wrap:b,placement:y}}let v=e.match(/<a:prstGeom\b[^>]*\bprst="([^"]+)"/i)?.[1],w=e.match(/<a:solidFill\b[^>]*>[\s\S]*?<\/a:solidFill>/i)?.[0],N=e.match(/<a:gradFill\b[^>]*>[\s\S]*?<\/a:gradFill>/i)?.[0],k=e.match(/<a:ln\b[^>]*>[\s\S]*?<\/a:ln>/i)?.[0]??e.match(/<a:ln\b[^>]*\/?>/i)?.[0];if(N){let e=N.match(/<a:srgbClr\b[^>]*\bval="([^"]+)"/i)?.[1],t=[...N.matchAll(/<a:srgbClr\b[^>]*\bval="([^"]+)"/gi)][1]?.[1],n=e?`#${e}`:"#4285f4",r=t?`#${t}`:"#34a853",a=Math.round((oa(N,"ang")??18e5)/6e4);return{graphicType:"gradient",gradientCss:(0,rb.if)(a,n,r),gradientAngle:a,gradientColor1:n,gradientColor2:r,width:s,height:l,x:o,y:c,rotationDeg:g,wrap:b,placement:y}}if(v||w){let e=w?.match(/<a:srgbClr\b[^>]*\bval="([^"]+)"/i)?.[1],t=e?`#${e}`:"#4285f4",n=k?.match(/<a:srgbClr\b[^>]*\bval="([^"]+)"/i)?.[1],r=n?`#${n}`:"#1a73e8",a=k?Math.max(1,or(oa(k,"w")??12700)):2;return{graphicType:"shape",shapeType:function(e){switch(e){case"ellipse":case"oval":return"ellipse";case"line":case"straightConnector1":return"line";case"rightArrow":case"leftArrow":case"bentArrow":return"arrow";default:return"rect"}}(v),fill:t,stroke:r,strokeWidth:a,width:s,height:l,x:o,y:c,rotationDeg:g,wrap:b,placement:y}}return null}(t[0],e,r);n?.graphicType!=="image"&&n&&a.push(n)}for(let t of n.matchAll(/<v:shape\b[^>]*>[\s\S]*?<\/v:shape>/gi)){let n=function(e,t,n){let r,a=e.match(/\bstyle="([^"]+)"/i)?.[1]??"",i=a.match(/\bwidth:\s*([\d.]+)pt/i),s=a.match(/\bheight:\s*([\d.]+)pt/i),l=i?Math.round(96*Number(i[1])/72):240,o=s?Math.round(96*Number(s[1])/72):160,c=a.match(/\bleft:\s*([\d.]+)pt/i),d=a.match(/\btop:\s*([\d.]+)pt/i),u=c?Math.round(96*Number(c[1])/72):0,h=d?Math.round(96*Number(d[1])/72):0,m=on(e.match(/\bfillcolor="([^"]+)"/i)?.[1]),p=on(e.match(/\bstrokecolor="([^"]+)"/i)?.[1]),g=(r=a.match(/\brotation:\s*(-?\d+)/i))?Number(r[1]):0,f=e.match(/<v:imagedata\b[^>]*\br:id="([^"]+)"/i)?.[1];if(f){let e=ni(t,n,f);if(e)return{graphicType:"image",src:e,width:l,height:o,x:u,y:h,rotationDeg:g,wrap:"square",placement:"absolute"}}let x=e.match(/\btype="[^"]*#([^"]+)"/i)?.[1]?.toLowerCase(),b="rect";return(x?.includes("oval")||x?.includes("ellipse")?b="ellipse":x?.includes("line")&&(b="line"),m||p)?{graphicType:"shape",shapeType:b,fill:m??"#4285f4",stroke:p??"#1a73e8",strokeWidth:2,width:l,height:o,x:u,y:h,rotationDeg:g,wrap:"square",placement:"absolute"}:null}(t[0],e,r);n&&a.push(n)}return a})(s).filter(e=>"image"!==e.graphicType);if(0===l.length)return t;let o=(r=0,(a=e=>{("image"===e.type||"docsGraphic"===e.type&&e.attrs?.graphicType==="image")&&r++,Array.isArray(e.content)&&e.content.forEach(e=>{e&&"object"==typeof e&&a(e)})})(t),r),c=l.slice(Math.max(0,o));if(0===c.length)return t;let d=Array.isArray(t.content)?[...t.content]:[];for(let e of c)d.push({type:"docsGraphic",attrs:{...rb.m2,graphicType:e.graphicType,src:e.src??null,shapeType:e.shapeType??"rect",fill:e.fill??rb.m2.fill,stroke:e.stroke??rb.m2.stroke,strokeWidth:e.strokeWidth??2,gradientCss:e.gradientCss??"",gradientAngle:e.gradientAngle??180,gradientColor1:e.gradientColor1??rb.m2.gradientColor1,gradientColor2:e.gradientColor2??rb.m2.gradientColor2,width:e.width,height:e.height,x:e.x,y:e.y,rotationDeg:e.rotationDeg,wrap:e.wrap,placement:e.placement,floatSide:"left"}});return{...t,content:d}}catch{return t}}function os(e){return Math.round(e/9525)}function ol(e,t){let n=e.match(RegExp(`\\b${t}="(-?\\d+)"`,"i"));if(!n)return null;let r=Number.parseInt(n[1]??"",10);return Number.isFinite(r)?r:null}async function oo(e,t){try{let r,a,{unzipSync:i}=await n.e(6951).then(n.bind(n,86951)),s=i(new Uint8Array(e)),l=function(e){var t;let n=(t=e["word/document.xml"])?new TextDecoder().decode(t):"";if(!n)return[];let r=[];for(let e of n.matchAll(/<w:drawing\b[^>]*>[\s\S]*?<\/w:drawing>/gi)){let t=e[0],n=/<wp:inline\b/i.test(t),a=/<wp:anchor\b/i.test(t);if(!n&&!a)continue;let i=function(e,t){let n,r,a=e.match(/<wp:extent\b[^>]*\/?>/i)?.[0];if(!a)return null;let i=ol(a,"cx"),s=ol(a,"cy");if(null==i||null==s)return null;let l=/<wp:anchor\b[^>]*\bbehindDoc="1"/i.test(e),o=/<wp:anchor\b[^>]*\blayoutInCell="0"/i.test(e)&&!l,c=0,d=0;if(!t){let t=e.match(/<wp:positionH\b[^>]*>[\s\S]*?<\/wp:positionH>/i)?.[0],n=e.match(/<wp:positionV\b[^>]*>[\s\S]*?<\/wp:positionV>/i)?.[0],r=t?.match(/<wp:posOffset>(-?\d+)<\/wp:posOffset>/i)?.[1],a=n?.match(/<wp:posOffset>(-?\d+)<\/wp:posOffset>/i)?.[1];r&&(c=os(Number(r))),a&&(d=os(Number(a)))}let u=t?"inline":l?"behind":o?"in-front":/<wp:wrapNone\b/i.test(e)||/<wp:wrapTopAndBottom\b/i.test(e)?"top-bottom":/<wp:wrapTight\b/i.test(e)?"tight":/<wp:wrapThrough\b/i.test(e)?"through":(/<wp:wrapSquare\b/i.test(e)||/<wp:wrapNone\b/i.test(e),"square"),h=t?"inline":"absolute",m=function(e){let t=e.match(/<a:srcRect\b[^>]*\/?>/i)?.[0];if(!t)return null;let n=ol(t,"l")??0,r=ol(t,"t")??0,a=ol(t,"r")??0,i=ol(t,"b")??0;return 0===n&&0===r&&0===a&&0===i?null:{cropX:n/1e5,cropY:r/1e5,cropWidth:1-(n+a)/1e5,cropHeight:1-(r+i)/1e5}}(e.match(/<a:blip\b[^>]*\/?>/i)?.[0]??"");return{width:Math.max(24,os(i)),height:Math.max(24,os(s)),x:c,y:d,pageX:c,pageY:d,pageIndex:0,placement:h,wrap:u,floatSide:t?"left":(n=e.match(/<wp:positionH\b[^>]*>[\s\S]*?<wp:align>(\w+)<\/wp:align>/i)?.[1],"right"===n?"right":"center"===n?"center":"left"),rotationDeg:(r=e.match(/\brot="(-?\d+)"/i)?.[1])?Math.round(Number(r)/6e4):0,zIndex:l?0:o?20:1,behindDoc:l,positionMode:function(e,t){if(t)return"move-with-text";let n=e.match(/<wp:positionH\b[^>]*relativeFrom="(\w+)"/i)?.[1],r=e.match(/<wp:positionV\b[^>]*relativeFrom="(\w+)"/i)?.[1];return("page"===n||"margin"===n||"column"===n||"page"===r||"margin"===r||"paragraph"===r)&&("page"===n||"margin"===n||"page"===r||"margin"===r)?"fixed-on-page":"move-with-text"}(e,t),wrapMarginMm:function(e){let t=e.match(/<wp:wrapSquare\b[^>]*\/?>/i)?.[0];if(!t)return 3;let n=ol(t,"distL")??ol(t,"distT");return null==n?3:Math.max(0,Math.round(os(n)/96*25.4))}(e),...m}}(t,n);i&&r.push(i)}return r}(s);if(0===l.length)return t;let o=(r=[],(a=(e,t)=>{("image"===e.type||"docsGraphic"===e.type||"docsInlineGraphic"===e.type)&&r.push({path:t,node:e}),Array.isArray(e.content)&&e.content.forEach((e,n)=>{e&&"object"==typeof e&&a(e,[...t,n])})})(t,[]),r),c=t,d=Math.min(o.length,l.length);for(let e=0;e<d;e++){let{path:t,node:n}=o[e],r=l[e];c=function e(t,n,r){if(0===n.length)return r;let[a,...i]=n,s=Array.isArray(t.content)?[...t.content]:[];return s[a]=e(s[a],i,r),{...t,content:s}}(c,t,function(e,t){let n=e.attrs??{};return{...e,attrs:{...n,width:t.width,height:t.height,x:t.x,y:t.y,pageX:t.pageX,pageY:t.pageY,pageIndex:t.pageIndex,placement:t.placement,wrap:t.wrap,floatSide:t.floatSide,rotationDeg:t.rotationDeg,zIndex:t.zIndex,positionMode:t.positionMode,wrapMarginMm:t.wrapMarginMm,...null!=t.cropX?{cropX:t.cropX}:{},...null!=t.cropY?{cropY:t.cropY}:{},...null!=t.cropWidth?{cropWidth:t.cropWidth}:{},...null!=t.cropHeight?{cropHeight:t.cropHeight}:{}}}}(n,r))}return c}catch{return t}}function oc(e){return e?new TextDecoder().decode(e):""}function od(e,t){let n=oc(e[`word/${t}.xml`]);if(!n)return null;let r=function(e){let t=[],n=[...e.matchAll(/<w:p\b[^>]*>[\s\S]*?<\/w:p>/gi)];if(0===n.length){let n=e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();return n&&t.push({type:"paragraph",content:[{type:"text",text:n}]}),t}for(let e of n){let n=e[0],r=[...n.matchAll(/<w:t\b[^>]*>([^<]*)<\/w:t>/gi)].map(e=>e[1]??"").join(""),a=[];if(r){let e=[];/<w:b\b[^>]*\/>|<w:b\b[^>]*>/.test(n)&&e.push({type:"bold"}),/<w:i\b[^>]*\/>|<w:i\b[^>]*>/.test(n)&&e.push({type:"italic"}),/<w:u\b[^>]*\/>|<w:u\b[^>]*>/.test(n)&&e.push({type:"underline"}),a.push({type:"text",text:r,...e.length?{marks:e}:{}})}t.push({type:"paragraph",content:a})}return t}(n);return 0===r.length?null:{content:{type:"doc",content:r},heightMm:15}}async function ou(e){try{let{unzipSync:t}=await n.e(6951).then(n.bind(n,86951)),r=t(new Uint8Array(e)),a=od(r,"header1")??od(r,"header2"),i=od(r,"footer1")??od(r,"footer2"),s=oc(r["word/document.xml"]),l=null!=s&&/<w:titlePg\b/i.test(s);return{header:a??null,footer:i??null,headerFooterDifferentFirstPage:l}}catch{return{header:null,footer:null,headerFooterDifferentFirstPage:!1}}}function oh(e){let t=e.getAttribute("src");if(!t)return null;let n={src:t,alt:e.getAttribute("alt")??""},r=e.getAttribute("title");r&&(n.title=r);let a=e.getAttribute("width"),i=e.getAttribute("height");return a&&(n.width=Number(a)||a),i&&(n.height=Number(i)||i),{type:"image",attrs:n}}function om(e){let t=[];for(let n of e.childNodes){if(n.nodeType===Node.TEXT_NODE){let e=n.textContent??"";e&&t.push({type:"text",text:e});continue}if(n.nodeType===Node.ELEMENT_NODE){if("img"===n.tagName.toLowerCase()){let e=oh(n);e&&t.push(e);continue}t.push(...om(n))}}return t}function op(e){var t,n;let r,a,i,s;return n=ot(t=(a=(r=e=>{if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(r);if("image"===e.type&&l5(e.attrs)){let t={};for(let n of l1){let r=e.attrs[n];null!=r&&""!==r&&(t[n]=r)}return"string"==typeof t.src&&t.src?{...e,attrs:t}:null}return Array.isArray(e.content)?{...e,content:e.content.map(r).filter(Boolean)}:e})(e))&&"object"==typeof a?a:{type:"doc",content:[{type:"paragraph"}]})??t,(s=(i=e=>{if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(i);if("image"===e.type&&l5(e.attrs)){let t=l8(e.attrs),n=t.placement,r=t.wrap,a="square"===r||"tight"===r||"through"===r||"top-bottom"===r||"behind"===r||"in-front"===r||"block"===n||"absolute"===n;return l3({...e,attrs:t},a)}if(("docsGraphic"===e.type||"docsInlineGraphic"===e.type)&&l5(e.attrs)&&(e.attrs=(0,rb.Oy)(l8(e.attrs))),"paragraph"===e.type&&function(e){if("paragraph"!==e.type||!Array.isArray(e.content)||1!==e.content.length)return!1;let t=e.content[0];return"image"===t.type||"docsInlineGraphic"===t.type}(e)){let t=e.content[0];if("image"===t.type)return l3({...t,attrs:l8(t.attrs??{})},!0)}if(Array.isArray(e.content)){let t=e.content.map(i).filter(Boolean);return e.type,{...e,content:t}}if("image"===e.type||"docsGraphic"===e.type||"docsInlineGraphic"===e.type){let t;return t=l5(e.attrs)?(0,rb.Oy)(e.attrs):rb.m2,"docsGraphic"===e.type?{type:"docsGraphic",attrs:t}:"docsInlineGraphic"===e.type?{type:"docsInlineGraphic",attrs:t}:"image"===e.type?l3(e,!1):e}return e})(n))&&"object"==typeof s?s:{type:"doc",content:[{type:"paragraph"}]}}function og(e){let t="u">typeof DOMParser?new DOMParser:null;if(!t)return{type:"doc",content:[{type:"paragraph",content:[{type:"text",text:e.replace(/<[^>]+>/g," ")}]}]};let n=t.parseFromString(e,"text/html"),r=[],a=e=>{if(e.nodeType===Node.TEXT_NODE){let t=e.textContent??"";t.trim()&&r.push({type:"paragraph",content:[{type:"text",text:t}]});return}if(e.nodeType!==Node.ELEMENT_NODE)return;let t=e.tagName.toLowerCase();if("img"===t){let t=oh(e);t&&r.push({type:"paragraph",content:[t]});return}if("p"===t||"div"===t){let t=om(e);r.push({type:"paragraph",content:t.length?t:[]});return}if(/^h[1-6]$/.test(t)){let n=Number(t[1]);r.push({type:"heading",attrs:{level:n},content:[{type:"text",text:e.textContent??""}]});return}if("ul"===t||"ol"===t){let n="ul"===t?"bulletList":"orderedList",a=Array.from(e.querySelectorAll(":scope > li")).map(e=>({type:"listItem",content:[{type:"paragraph",content:om(e)}]}));r.push({type:n,content:a});return}if("table"===t){let t,n,a,i;return void r.push((t=Array.from(e.querySelectorAll(":scope > tbody > tr, :scope > tr")),n={},e.getAttribute("align")||e.style.margin,"center"===e.getAttribute("align")?n.alignment="center":"right"===e.getAttribute("align")&&(n.alignment="right"),(a=e.getAttribute("width")||e.style.width)&&"auto"!==a&&(n.layout="fixed"),i=t.map((e,t)=>{let n=Array.from(e.querySelectorAll(":scope > th, :scope > td")),r={},a=e.style.height||e.getAttribute("height");return a&&(r.rowHeight=a.endsWith("px")?a:`${a}px`),0===t&&n.every(e=>"th"===e.tagName.toLowerCase())&&(r.header=!0),{type:"tableRow",...Object.keys(r).length?{attrs:r}:{},content:n.map(e=>{let t="th"===e.tagName.toLowerCase(),n=function(e){let t={},n=Number(e.getAttribute("colspan")||"1"),r=Number(e.getAttribute("rowspan")||"1");n>1&&(t.colspan=n),r>1&&(t.rowspan=r);let a=e.getAttribute("width")||e.style.width;if(a){let e=(a.endsWith("px"),parseFloat(a));Number.isFinite(e)&&e>0&&(t.colwidth=[Math.round(e)])}let i=e.getAttribute("bgcolor")||e.getAttribute("data-background-color")||e.style.backgroundColor;i&&(t.backgroundColor=i);let s=e.getAttribute("align")||e.style.textAlign;("left"===s||"center"===s||"right"===s||"justify"===s)&&(t.align=s);let l=e.getAttribute("valign")||e.style.verticalAlign;("top"===l||"middle"===l||"bottom"===l)&&(t.verticalAlign=l);let o=e.getAttribute("style")??"",c=l9(o,"top"),d=l9(o,"right"),u=l9(o,"bottom"),h=l9(o,"left");return c&&(t.borderTop=c),d&&(t.borderRight=d),u&&(t.borderBottom=u),h&&(t.borderLeft=h),t}(e),r=function(e){let t=[];for(let n of e.childNodes){if(n.nodeType===Node.TEXT_NODE){let e=n.textContent??"";e&&t.push({type:"text",text:e});continue}if(n.nodeType!==Node.ELEMENT_NODE)continue;let e=n.tagName.toLowerCase(),r=[];("strong"===e||"b"===e)&&r.push({type:"bold"}),("em"===e||"i"===e)&&r.push({type:"italic"}),"u"===e&&r.push({type:"underline"});let a=n.textContent??"";a&&t.push({type:"text",text:a,...r.length?{marks:r}:{}})}return t}(e);return{type:t?"tableHeader":"tableCell",...Object.keys(n).length?{attrs:n}:{},content:[{type:"paragraph",content:r.length?r:[]}]}})}}),{type:"table",...Object.keys(n).length?{attrs:n}:{},content:i.length?i:[{type:"tableRow",content:[{type:"tableCell",content:[{type:"paragraph"}]}]}]}))}Array.from(e.childNodes).forEach(a)};return Array.from(n.body.childNodes).forEach(a),0===r.length&&r.push({type:"paragraph"}),op({type:"doc",content:r})}async function of(e){let t=await nz(e),r=await ou(e),a=e=>e?.content?{...e,content:op(e.content)}:e,i=t?{...t,header:a(r.header??t.header??null),footer:a(r.footer??t.footer??null),headerFooterDifferentFirstPage:r.headerFooterDifferentFirstPage??t.headerFooterDifferentFirstPage??!1}:r.header||r.footer?{widthMm:210,heightMm:297,marginsMm:{top:25.4,right:25.4,bottom:25.4,left:25.4},header:a(r.header??null),footer:a(r.footer??null),headerFooterDifferentFirstPage:r.headerFooterDifferentFirstPage??!1}:null;try{let{parseDOCX:t}=await Promise.all([n.e(1062),n.e(6727)]).then(n.bind(n,76727)),r=await t(e,{image:{crop:!0}});if(r&&"object"==typeof r){let t=op(r);return t=await oo(e,t),t=await oi(e,t),{content:lZ(t),pageSetup:i}}}catch(e){}let s=og((await l0.convertToHtml({arrayBuffer:e},{convertImage:l0.images.imgElement(e=>e.read("base64").then(t=>({src:`data:${e.contentType};base64,${t}`})))})).value);return s=await oo(e,s),{content:lZ(s=await oi(e,s)),pageSetup:i}}async function ox(e,t){let n=e.split(".").pop()?.toLowerCase()??"";if("docx"===n||"docm"===n)return of(t);let r=new TextDecoder().decode(t);return"html"===n||"htm"===n?{content:og(r)}:{content:{type:"doc",content:r.split(/\r?\n/).map(e=>({type:"paragraph",content:e?[{type:"text",text:e}]:[]}))}}}n(30640);let ob="data:";async function oy(e,t){if(!e.startsWith(ob))return null;try{return await t({dataUrl:e})}catch{return null}}async function oj(e,t){let n,r,a=e;for(let i of[...new Set((n=[],(r=e=>{if(!e||"object"!=typeof e)return;let t=e.attrs;("image"===e.type||"docsGraphic"===e.type||"docsInlineGraphic"===e.type)&&"string"==typeof t?.src&&t.src.startsWith(ob)&&n.push(t.src),Array.isArray(e.content)&&e.content.forEach(r)})(e),n))]){let e=await oy(i,t);e&&(a=function(e,t,n){let r=e=>{if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(r);let a=e.attrs;return a&&a.src===t&&("image"===e.type||"docsGraphic"===e.type||"docsInlineGraphic"===e.type)?{...e,attrs:{...a,src:n.url,assetId:n.assetId}}:Array.isArray(e.content)?{...e,content:e.content.map(r)}:e},a=r(e);return a&&"object"==typeof a?a:e}(a,i,e))}return a}var ov=n(12546),ow=n(65044);let oN=`
UltiDocs utilise TipTap (ProseMirror). Le document est un JSON \`{ type: "doc", content: [...] }\`.
Blocs courants:
- paragraph: { type: "paragraph", content?: inline[] }
- heading: { type: "heading", attrs: { level: 1-6 }, content?: inline[] }
- bulletList / orderedList: { type: "bulletList", content: [listItem...] }
- listItem: { type: "listItem", content: [paragraph|...] }
- blockquote, codeBlock, horizontalRule, table (tableRow > tableCell)
Inline:
- text: { type: "text", text: "...", marks?: [{ type: "bold"|"italic"|"underline"|"link", attrs? }] }
R\xe8gles d'\xe9dition:
- Pr\xe9server la structure doc valide (toujours des blocs dans doc.content).
- Pour modifier: pr\xe9f\xe9rer remplacer la s\xe9lection ou ins\xe9rer du texte/markdown converti en paragraphes.
- Ne pas inventer de nœuds custom (docsGraphic, table) sans conna\xeetre le sch\xe9ma — utiliser les tools docs_save avec JSON valid\xe9.
- Titres: un seul h1 recommand\xe9 en t\xeate de document.
`.trim();function ok(e,t){return e.length<=t?e:e.slice(0,t)+"…"}function oC(e){if(!e||"object"!=typeof e)return null;let t=e.action;return"insert_text"===t&&"string"==typeof e.text||"replace_selection"===t&&"string"==typeof e.text||"append_paragraph"===t&&"string"==typeof e.text?{action:t,text:e.text}:"set_content"===t&&e.document&&"object"==typeof e.document?{action:t,document:e.document}:null}function oS(e,t){if(!e.isEditable)return!1;switch(t.action){case"insert_text":return e.chain().focus().insertContent(t.text).run();case"replace_selection":if(e.state.selection.empty)return e.chain().focus().insertContent(t.text).run();return e.chain().focus().deleteSelection().insertContent(t.text).run();case"append_paragraph":{let n=t.text.split(/\n{2,}/).map(e=>e.trim()).filter(Boolean).map(e=>({type:"paragraph",content:[{type:"text",text:e}]}));if(0===n.length)return!1;return e.chain().focus().insertContentAt(e.state.doc.content.size,n).run()}case"set_content":{let n=lZ(t.document);return e.commands.setContent(n)}default:return!1}}var oA=n(40505),oM=n(95291);let oz=(0,Q.v)(e=>({open:!1,widthPx:380,toggle:()=>e(e=>({open:!e.open})),openPanel:()=>e({open:!0}),closePanel:()=>e({open:!1}),setWidthPx:t=>e({widthPx:Math.min(560,Math.max(280,t))})}));function oP({editor:e,documentPath:t,documentTitle:n,sourcePath:i,editable:s}){let l,o=oz(e=>e.open),c=oz(e=>e.widthPx),d=oz(e=>e.setWidthPx),u=oz(e=>e.closePanel),{data:h}=(0,oA.Y7)(),{data:m}=(0,oA.Yc)(o&&(h?.enabled??!1)),[p,g]=(0,a.useState)(0),f=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!e||!o)return;let t=()=>g(e=>e+1);return e.on("selectionUpdate",t),e.on("update",t),()=>{e.off("selectionUpdate",t),e.off("update",t)}},[e,o]);let x=(0,a.useMemo)(()=>e&&o?function(e,t=!0){return{app:"docs",temporary:t,drivePath:e.documentPath,documentTitle:e.documentTitle,sourcePath:e.sourcePath,documentExcerpt:e.plainText,selectionText:e.selectionText||void 0,documentJson:e.contentJsonTruncated}}(function(e,t){let{from:n,to:r}=e.state.selection,a=e.getText(),i=n===r?"":e.state.doc.textBetween(n,r,"\n","\n"),s=e.getJSON(),l=JSON.stringify(s),o=l.length>8e3?l.slice(0,8e3)+"…":l;return{documentPath:t.path,documentTitle:t.title,sourcePath:t.sourcePath,plainText:ok(a,14e3),selectionText:ok(i,4e3),contentJson:s,contentJsonTruncated:o}}(e,{path:t,title:n,sourcePath:i}),!0):{app:"docs",temporary:!0,drivePath:t,documentTitle:n,sourcePath:i},[e,o,t,n,i,p]),y=(0,a.useCallback)(t=>{if(!e)return;let n=oC(t);n&&oS(e,n)},[e]);return((0,a.useEffect)(()=>{if(!o||!e)return;let t=t=>{if(t.origin!==window.location.origin)return;let n=t.data;if(n?.type==="ULTI_DOCS_APPLY"&&n.payload&&y(n.payload),n?.type==="ULTI_ASSISTANT_TEXT"&&"string"==typeof n.text){let t=function(e){let t=e.match(/```ulti-docs-apply\s*([\s\S]*?)```/i);if(!t?.[1])return null;try{return oC(JSON.parse(t[1].trim()))}catch{return null}}(n.text);t&&oS(e,t)}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[o,e,y]),(0,a.useEffect)(()=>{if(o&&e)return window.__ultiDocsApply=y,()=>{delete window.__ultiDocsApply}},[o,e,y]),h?.enabled&&o)?(0,r.jsxs)("div",{className:"docs-ai-panel relative flex h-full shrink-0 flex-col border-l border-[#dadce0] bg-white dark:border-border dark:bg-background",style:{width:c},"data-docs-ai-panel":!0,children:[(0,r.jsx)("button",{type:"button","aria-label":"Redimensionner le panneau UltiAI",className:"absolute left-0 top-0 z-10 flex h-full w-1.5 cursor-col-resize items-center justify-center hover:bg-[#e8eaed] dark:hover:bg-muted",onPointerDown:e=>{e.preventDefault(),f.current={startX:e.clientX,startW:c};let t=e=>{let t=f.current;if(!t)return;let n=t.startX-e.clientX;d(t.startW+n)},n=()=>{f.current=null,window.removeEventListener("pointermove",t),window.removeEventListener("pointerup",n)};window.addEventListener("pointermove",t),window.addEventListener("pointerup",n)},children:(0,r.jsx)(ov.A,{className:"pointer-events-none h-4 w-4 text-muted-foreground opacity-0 hover:opacity-100"})}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b px-3 py-2",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[(0,r.jsx)(sh.A,{className:"h-4 w-4 shrink-0 text-[#1a73e8]"}),(0,r.jsx)("span",{className:"truncate",children:"UltiAI"})]}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[m?(0,r.jsx)(oM.u,{quota:m,compact:!0,className:"max-w-[140px]"}):null,(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:u,"aria-label":"Fermer UltiAI",children:(0,r.jsx)(rH.A,{className:"h-4 w-4"})})]})]}),s?null:(0,r.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Mode lecture — l'IA peut analyser le document mais pas le modifier."}),(0,r.jsx)("div",{className:"min-h-0 flex-1",children:(0,r.jsx)(ow.z,{publicPath:h.public_path,context:{...x,systemPromptExtra:(l=["Tu \xe9dites un document UltiDocs (TipTap). Tu peux lire le contenu ci-dessous et proposer des modifications.","Pour appliquer une modification c\xf4t\xe9 \xe9diteur, renvoie un bloc JSON fenced:",'```ulti-docs-apply\n{ "action": "insert_text"|"replace_selection"|"append_paragraph"|"set_content", ... }\n```',"",oN],x.documentTitle&&l.push("",`Document: ${x.documentTitle}`),x.drivePath&&l.push(`Chemin sidecar: ${x.drivePath}`),x.sourcePath&&l.push(`Fichier source: ${x.sourcePath}`),x.selectionText&&l.push("","S\xe9lection utilisateur:",x.selectionText),x.documentExcerpt&&l.push("","Contenu (texte):",x.documentExcerpt),x.documentJson&&l.push("","Contenu (JSON tronqu\xe9 si long):",x.documentJson),l.join("\n"))},className:(0,v.cn)("h-full w-full border-0")})})]}):null}function oI({disabled:e,className:t}){let n=oz(e=>e.open),a=oz(e=>e.toggle),{data:i}=(0,oA.Y7)();return i?.enabled?(0,r.jsx)(b.$,{type:"button",variant:"ghost",size:"icon",className:(0,v.cn)("size-9 shrink-0 rounded-full",n&&"bg-[#e8f0fe] text-[#1a73e8] dark:bg-muted",t),disabled:e,onClick:a,"aria-label":"UltiAI",title:"UltiAI",children:(0,r.jsx)(sh.A,{className:"size-4"})}):null}function oT({session:e,mode:t,userName:n,userColor:i,onSaveStatus:d,fetchSourceBytes:u,importApi:h,chrome:m,deferSplash:p=!1,onLoadingChange:g}){var f;let x="edit"===t,b=e.collaboration&&!!(e.wsUrl&&e.token),y=(0,a.useRef)(null);b&&!y.current&&(y.current=new o.JA);let j=b?y.current:null,[w,N]=(0,a.useState)(null),[k,C]=(0,a.useState)(!1),[S,A]=(0,a.useState)(null),[M,z]=(0,a.useState)(!e.importRequired),[P,I]=(0,a.useState)(e.importRequired),[T,D]=(0,a.useState)(null),[L,F]=(0,a.useState)(()=>e.paragraphStyles??(0,e8.RW)()),[E,R]=(0,a.useState)(e.pageSetup??null),[H,B]=(0,a.useState)("idle"),[$,O]=(0,a.useState)(1),[W,_]=(0,a.useState)(1),[q,G]=(0,a.useState)(null),Y=(0,a.useRef)(null),U=(0,a.useRef)(null),X=(0,a.useRef)(null),J=(0,a.useRef)(e.pageSetup??null),V=(0,a.useRef)("idle"),K=(0,a.useRef)(!1),Q=(0,a.useRef)(!1),Z=(0,a.useRef)(null),{settings:ee,setPageFormatId:et,setZoom:en,toggleSpellcheck:er,toggleChromeCollapsed:ea,setEditorMode:ei,setCommentsDisplay:es,toggleOutlineSidebarExpanded:el,toggleShowLayout:eo,toggleShowRuler:ed,toggleShowEquationToolbar:eu,toggleShowNonPrintableChars:eh}=function(){let[e,t]=(0,a.useState)(lX);(0,a.useEffect)(()=>{t(function(){if("u"<typeof localStorage)return lX;try{let e=localStorage.getItem(lU);if(!e)return lX;let t=JSON.parse(e);return{pageFormatId:t.pageFormatId??"a4",zoom:lJ(t.zoom??lX.zoom),spellcheck:t.spellcheck??lX.spellcheck,chromeCollapsed:t.chromeCollapsed??lX.chromeCollapsed,editorMode:t.editorMode??lX.editorMode,commentsDisplay:t.commentsDisplay??lX.commentsDisplay,outlineSidebarExpanded:t.outlineSidebarExpanded??lX.outlineSidebarExpanded,showLayout:t.showLayout??lX.showLayout,showRuler:t.showRuler??lX.showRuler,showEquationToolbar:t.showEquationToolbar??lX.showEquationToolbar,showNonPrintableChars:t.showNonPrintableChars??lX.showNonPrintableChars}}catch{return lX}}())},[]);let n=(0,a.useCallback)(e=>{t(t=>{let n={...t,pageFormatId:e};return lV(n),n})},[]),r=(0,a.useCallback)(e=>{t(t=>{let n={...t,zoom:lJ(e)};return lV(n),n})},[]),i=(0,a.useCallback)(e=>{t(t=>{let n={...t,spellcheck:e};return lV(n),n})},[]),s=(0,a.useCallback)(()=>{t(e=>{let t={...e,spellcheck:!e.spellcheck};return lV(t),t})},[]),l=(0,a.useCallback)(()=>{t(e=>{let t={...e,chromeCollapsed:!e.chromeCollapsed};return lV(t),t})},[]),o=(0,a.useCallback)(e=>{t(t=>{let n={...t,editorMode:e};return lV(n),n})},[]),c=(0,a.useCallback)(e=>{t(t=>{let n={...t,commentsDisplay:e};return lV(n),n})},[]),d=(0,a.useCallback)(()=>{t(e=>{let t={...e,outlineSidebarExpanded:!e.outlineSidebarExpanded};return lV(t),t})},[]),u=(0,a.useCallback)(()=>{t(e=>{let t={...e,showLayout:!e.showLayout};return lV(t),t})},[]),h=(0,a.useCallback)(()=>{t(e=>{let t={...e,showRuler:!e.showRuler};return lV(t),t})},[]);return{settings:e,setPageFormatId:n,setZoom:r,setSpellcheck:i,toggleSpellcheck:s,toggleChromeCollapsed:l,setEditorMode:o,setCommentsDisplay:c,toggleOutlineSidebarExpanded:d,toggleShowLayout:u,toggleShowRuler:h,toggleShowEquationToolbar:(0,a.useCallback)(()=>{t(e=>{let t={...e,showEquationToolbar:!e.showEquationToolbar};return lV(t),t})},[]),toggleShowNonPrintableChars:(0,a.useCallback)(()=>{t(e=>{let t={...e,showNonPrintableChars:!e.showNonPrintableChars};return lV(t),t})},[]),zoomMin:50,zoomMax:200}}(),em=(0,a.useRef)(null),ep=(0,a.useRef)(()=>null),eg=function(e,t){let[n,r]=(0,a.useState)([{clientId:-1,name:t.name,color:t.color,isLocal:!0}]);return(0,a.useEffect)(()=>{if(!e)return void r([{clientId:-1,name:t.name,color:t.color,isLocal:!0}]);let n=e.awareness;if(!n)return;let a=()=>{let e=[];n.getStates().forEach((t,r)=>{let a=t.user,i=a?.name?.trim();i&&e.push({clientId:r,name:i,color:a?.color&&a.color.length>0?a.color:lK[function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}(String(r))%lK.length],isLocal:r===n.clientID})}),e.sort((e,t)=>Number(t.isLocal)-Number(e.isLocal)||e.name.localeCompare(t.name,"fr")),r(e.length>0?e:[{clientId:-1,name:t.name,color:t.color,isLocal:!0}])};return n.on("change",a),a(),()=>{n.off("change",a)}},[e,t.name,t.color]),n}(w,{name:n,color:i}),ef=(0,a.useMemo)(()=>nv(E,ee.pageFormatId),[E,ee.pageFormatId]);ef.format.id;let ex=(0,a.useCallback)(e=>{V.current=e,B(e),d?.(e)},[d]),eb=(0,a.useCallback)(async t=>{if(x)try{let n=JSON.stringify({pageSetup:t});if(e.saveUrl){if(!(await fetch(e.saveUrl,{method:"PUT",headers:{"Content-Type":"application/json"},body:n})).ok)throw Error("save failed")}else await lt.uE.put("/richtext/save",{path:e.canonicalPath,pageSetup:t});ex("saved")}catch{ex("error")}},[x,ex,e.canonicalPath,e.saveUrl]),ey=(0,a.useCallback)((e,t)=>{let n={...J.current??nS(ee.pageFormatId,null),...e};J.current=n,R(n),n.formatId&&et(n.formatId);let r=()=>{let e=J.current;e&&eb(e)};if(t?.immediate){X.current&&clearTimeout(X.current),"idle"===V.current&&ex("saving"),r();return}"idle"===V.current&&ex("saving"),X.current&&clearTimeout(X.current),X.current=setTimeout(r,1500)},[eb,ex,ee.pageFormatId,et]);(0,a.useCallback)(e=>{ey(nS(e,J.current),{immediate:!0})},[ey,ee.pageFormatId]);let ej=(0,a.useCallback)((e,t,n,r)=>{var a,i,s;let l,o,c,d,u,h;ey((a=J.current??nS(ee.pageFormatId,null),i=n.pageIndex,s=n.contentHeightPx,l=a.headerFooterDifferentFirstPage??!1,o=0===i&&l?"header"===e?"headerFirstPage":"footerFirstPage":e,c=np(a.marginsMm.top),d=np(a.marginsMm.bottom),u=null!=a.headerMarginMm?np(a.headerMarginMm):0,h=null!=a.footerMarginMm?np(a.footerMarginMm):0,{[o]:{content:t,heightMm:ng(Math.max("header"===e?Math.max(24,c-u):Math.max(24,d-h),s))}}),r)},[ey,ee.pageFormatId]),ev=(0,a.useCallback)((e,t)=>{ey(e,t)},[ey]);(0,a.useEffect)(()=>{J.current=E},[E]),(0,a.useEffect)(()=>{e.pageSetup&&R(e.pageSetup)},[e.pageSetup]),(0,a.useEffect)(()=>{e.pageSetup||R(e=>{if(e)return e;let t=nC(lP(ee.pageFormatId),null);return t.formatId&&et(t.formatId),t})},[e.pageSetup,ee.pageFormatId,et]);let ew=(0,a.useCallback)(e=>{O(e),_(t=>Math.min(t,e))},[]),eN=(0,a.useCallback)(e=>{_(e)},[]),ek=(0,a.useCallback)(async()=>{if(x){if(!e.sourcePath)return void c.oR.error("Chemin source introuvable — ouvrez le document depuis le fichier DOCX");if((0,lC.Ir)(e.sourcePath))return void c.oR.error("Aucun fichier source \xe0 r\xe9importer");if(window.confirm("Supprimer le sidecar (.ultidoc.json) et r\xe9importer le document source ? Cette action est temporaire (dev).")){ex("saving"),Q.current=!0,K.current=!0;try{Z.current?.destroy(),Z.current=null,N(null),C(!1),y.current&&(y.current.destroy(),y.current=b?new o.JA:null),await lt.uE.delete(`/drive/files${e.canonicalPath}`),R(null),D(null),z(!1),I(!0),c.oR.success("Sidecar purg\xe9 — r\xe9import en cours…")}catch{Q.current=!1,K.current=!1,ex("error"),c.oR.error("Impossible de purger le sidecar")}}}},[b,x,ex,e.canonicalPath,e.sourcePath]),eC=(0,a.useCallback)(()=>{"saving"!==V.current&&ex("saving"),U.current&&clearTimeout(U.current),U.current=setTimeout(()=>{ex("saved")},2e3)},[ex]);(0,a.useEffect)(()=>()=>{Y.current&&clearTimeout(Y.current),U.current&&clearTimeout(U.current),X.current&&clearTimeout(X.current)},[]),(0,a.useEffect)(()=>{I(e.importRequired),z(!e.importRequired)},[e.importRequired,e.canonicalPath]),(0,a.useEffect)(()=>{if(e.importRequired||!e.sourcePath)return;let t=!1;return(async()=>{try{let n;if(e.documentUrl){let t=await fetch(e.documentUrl);if(!t.ok)return;n=JSON.parse(await t.text())}else{let t=await lt.uE.getBlob((0,sf.Cl)(e.canonicalPath));n=JSON.parse(await t.text())}if(t||!lQ(n.content))return;I(!0),z(!1)}catch{}})(),()=>{t=!0}},[e.canonicalPath,e.documentUrl,e.importRequired,e.sourcePath]),(0,a.useEffect)(()=>{if(!P||M)return;let t=!1;return(async()=>{ex("saving");try{let n=e.sourcePath;if(!n)throw Error("Chemin source manquant pour le r\xe9import");let r=u?await u(n):await (await lt.uE.getBlob((0,sf.Cl)(n))).arrayBuffer(),a=await ox(n.split("/").pop()??"file.docx",r);if(t)return;let i=lZ(a.content),s={source_path:n,content:i,pageSetup:a.pageSetup??void 0};if(h?await h(s):await lt.uE.post("/richtext/import",s),!t){if(a.pageSetup&&R(a.pageSetup),K.current){K.current=!1,window.location.reload();return}D(i),I(!1),z(!0),Q.current=!1,ex("saved")}}catch(e){t||(Q.current=!1,K.current=!1,ex("error"),c.oR.error(e instanceof Error?e.message:"R\xe9import \xe9chou\xe9"))}})(),()=>{t=!0}},[P,M,e.sourcePath,u,h,ex]),(0,a.useEffect)(()=>{if(Q.current||!b||!j||!M)return;C(!1),A(null);let t=new l.m({url:e.wsUrl,name:e.roomId,token:e.token,document:j,sessionAwareness:!1,onSynced:()=>C(!0),onAuthenticationFailed:({reason:e})=>{A(e??"Authentification collaboration refus\xe9e"),C(!1)}});return Z.current=t,N(t),()=>{t.destroy(),Z.current=null,N(null),C(!1)}},[b,M,e.roomId,e.token,e.wsUrl,j]);let eS=(0,a.useCallback)(async t=>{let n=t;try{n=await oj(t,async({dataUrl:t})=>{let n=await lt.uE.post("/richtext/assets",{path:e.canonicalPath,dataUrl:t});return{assetId:n.assetId,url:n.url}})}catch{}let r=JSON.stringify({schemaVersion:1,editor:"tiptap",content:n}),a=e.saveUrl?fetch(e.saveUrl,{method:"PUT",headers:{"Content-Type":"application/json"},body:r}).then(e=>{if(!e.ok)throw Error("save failed")}):lt.uE.put("/richtext/save",{path:e.canonicalPath,document:n});await a},[e.canonicalPath,e.saveUrl]),eA=(0,a.useCallback)((e,t)=>{if(!x||b)return;Y.current&&clearTimeout(Y.current),"saving"!==V.current&&ex("saving");let n=()=>{eS(e).then(()=>ex("saved")).catch(()=>ex("error"))};t?.immediate?n():Y.current=setTimeout(n,2e3)},[b,x,eS,ex]),eM=!b||!!w&&k,ez=M&&eM,eP=(0,a.useMemo)(()=>{var e;let t;return e={collaboration:b&&j?{document:j}:void 0,collaborationCaret:b&&w?{provider:w,user:{name:n,color:i}}:void 0,editable:x},t=[nB.A.configure({undoRedo:!e?.collaboration&&void 0,heading:{levels:[1,2,3,4,5,6]}})],e?.collaboration&&t.push(rc.Ay.configure({document:e.collaboration.document,field:"default"})),e?.collaborationCaret&&t.push(rd.A.configure({provider:e.collaborationCaret.provider,user:e.collaborationCaret.user})),t.push(n$.A,nO.Ay.configure({openOnClick:!1}),n_.xJ,n_.ay,n_.Z4,n_.Q1,n_.i0,nq.Ay.configure({multicolor:!0}),nW.A.configure({types:["heading","paragraph"],alignments:["left","center","right","justify"]}),rl.configure(ro),rs,ra,ri,aI,aT,aE,aH,aO,aK,a9,ia,ih,iy,ij._0,ij.L2.configure({nested:!0}),nG.Ay.configure({inline:!0,allowBase64:!0}),nY.A.configure({placeholder:e?.placeholder??"Commencez \xe0 \xe9crire…"}),rg),t},[b,j,w,n,i,x]),eI=(0,s.hG)({immediatelyRender:!1,editable:x,extensions:eP,editorProps:{attributes:{class:"ultidrive-richtext-editor max-w-none outline-none focus:outline-none prose prose-sm"}},onUpdate:({editor:e})=>{b?eC():eA(e.getJSON())}},[ez,eP,b,eC,eA]);(0,a.useEffect)(()=>{if(!eI||eI.isDestroyed)return;let e=()=>{if(!x)return;let e=eI.getJSON();if(b){"saving"!==V.current&&ex("saving"),eS(e).then(()=>ex("saved")).catch(()=>ex("error"));return}eA(e,{immediate:!0})};return window.addEventListener("ultidocs:graphic-draw-saved",e),()=>window.removeEventListener("ultidocs:graphic-draw-saved",e)},[b,x,eI,eS,ex,eA]),(0,a.useEffect)(()=>{if(!eI||eI.isDestroyed)return;let e=()=>{if(eI.isDestroyed||!eI.isInitialized)return;let e=eI.view.dom;e.spellcheck=ee.spellcheck,ee.spellcheck?(e.setAttribute("spellcheck","true"),e.removeAttribute("autocorrect"),e.removeAttribute("autocapitalize")):(e.setAttribute("spellcheck","false"),e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"))};return e(),eI.on("create",e),()=>{eI.off("create",e)}},[eI,ee.spellcheck]);let eT=function({editor:e,disabled:t}){let[n,r]=(0,a.useState)(0);(0,a.useEffect)(()=>{if(!e||t)return;let n=()=>r(e=>e+1);return e.on("transaction",n),e.on("selectionUpdate",n),()=>{e.off("transaction",n),e.off("selectionUpdate",n)}},[t,e]);let i=(0,a.useMemo)(()=>({canUndo:!!e&&e.can().chain().focus().undo().run(),canRedo:!!e&&e.can().chain().focus().redo().run()}),[e,n]);return{actions:(0,a.useMemo)(()=>({onUndo:()=>{e&&e.chain().focus().undo().run()},onRedo:()=>{e&&e.chain().focus().redo().run()},onCut:()=>{e&&(ru(e),document.execCommand("cut"))},onCopy:()=>{e&&(ru(e),document.execCommand("copy"))},onPaste:()=>{e&&(ru(e),document.execCommand("paste"))},onPastePlain:()=>void rh(e),onSelectAll:()=>{e&&e.chain().focus().selectAll().run()},onDelete:()=>(function(e){if(e){if(!e.state.selection.empty)return void e.chain().focus().deleteSelection().run();e.chain().focus().deleteForward().run()}})(e),onFindReplace:()=>rm(e)}),[e]),state:i,disabled:t}}({editor:eI,disabled:!x}),eD=function({editor:e,disabled:t,pageSetup:n,onPageSetupPatch:i}){let s=(0,a.useRef)(null),[l,o]=(0,a.useState)(!1),[c,d]=(0,a.useState)(!1),[u,h]=(0,a.useState)(!1),m=(0,a.useCallback)((t,n)=>{e&&aL({src:t,alt:n?.alt??"",wrap:"square",placement:"block"}).then(t=>{e.chain().focus().insertDocsGraphic(t).run()})},[e]),p=(0,a.useCallback)(e=>{let t=new FileReader;t.onload=()=>{m(t.result,{alt:e.name})},t.readAsDataURL(e)},[m]),g=(0,a.useCallback)(e=>{i?.({pageNumbers:{enabled:!0,placement:e,align:"right",startAt:n?.pageNumbers?.startAt??1,showOnFirstPage:n?.pageNumbers?.showOnFirstPage??!0}}),iL(e)},[i,n?.pageNumbers]),f=(0,a.useMemo)(()=>({onInsertImageFromComputer:()=>s.current?.click(),onInsertImageFromDrive:()=>o(!0),onInsertNewDraw:()=>{e&&(e.chain().focus().insertDocsGraphic(aD("draw",{width:320,height:240,drawDriveFileId:null})).run(),rL())},onInsertDrawFromDrive:()=>d(!0),onInsertLink:()=>void window.dispatchEvent(new CustomEvent(le)),onInsertHorizontalRule:()=>{e?.chain().focus().insertContent({type:"horizontalRule"}).run()},onInsertTable:(t,n)=>{e?.chain().focus().insertTable({rows:t,cols:n,withHeaderRow:!1}).run()},onInsertHeader:()=>iL("header"),onInsertFooter:()=>iL("footer"),onInsertWatermark:()=>{let e=window.prompt("Texte du filigrane",n?.pageBackground?.watermark?.text??"");null!=e&&e.trim()&&i?.({pageBackground:{...n?.pageBackground,watermark:{kind:"text",text:e.trim(),color:n?.pageBackground?.watermark?.color??"#b4b4b4",opacity:n?.pageBackground?.watermark?.opacity??.35,rotationDeg:n?.pageBackground?.watermark?.rotationDeg??-35}}})},onInsertPageNumbersHeader:()=>g("header"),onInsertPageNumbersFooter:()=>g("footer"),onOpenPageNumbersOptions:()=>h(!0)}),[g,e,i,n?.pageBackground]),x=(0,a.useCallback)(async(e,t)=>{m(e,{alt:t.name})},[m]),b=(0,a.useCallback)(async t=>{if(!e)return;let n=await lY(t);e.chain().focus().insertDocsGraphic(aD("draw",{drawScene:n.drawScene,src:n.src,width:n.width,height:n.height,drawDriveFileId:n.drawDriveFileId,alt:n.alt,lockAspectRatio:!0})).run()},[e]);return{actions:f,dialogs:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(sv,{open:l,onOpenChange:o,onPickImage:x}),(0,r.jsx)(lq,{open:c,onOpenChange:d,onPickDraw:b}),(0,r.jsx)(iC,{open:u,onOpenChange:h,settings:n?.pageNumbers,onApply:e=>i?.({pageNumbers:e})}),(0,r.jsx)("input",{ref:s,type:"file",accept:"image/*",className:"hidden",onChange:e=>{let t=e.target.files?.[0];t&&p(t),e.target.value=""}})]}),disabled:t,pageElementsEnabled:!!i}}({editor:eI,disabled:!x,pageSetup:E,onPageSetupPatch:ev}),eF=function({editor:e,initialDocumentStyles:t,editable:n,canonicalPath:r,saveUrl:i}){let[s,l]=(0,a.useState)(()=>t??(0,e8.RW)()),[o,c]=(0,a.useState)(e8.r6),d=(0,a.useRef)(s),u=(0,a.useRef)(null);(0,a.useEffect)(()=>{d.current=s},[s]),(0,a.useEffect)(()=>{t&&l(t)},[t]),(0,a.useEffect)(()=>{let e=!1;return lt.uE.get("/richtext/user-paragraph-styles").then(t=>{e||c(function(e){if(!e||"object"!=typeof e)return null;let t=e.definitions;return t&&"object"==typeof t?{definitions:t}:null}(t)??(0,e8.r6)())}).catch(()=>{e||c((0,e8.r6)())}),()=>{e=!0}},[]);let h=(0,a.useMemo)(()=>(0,e8.op)(s,o),[s,o]);(0,a.useEffect)(()=>{aQ=h;for(let e of(aQ=h,aZ))e(h)},[h]),(0,a.useEffect)(()=>{let e=function(e,t=".ultidrive-richtext-editor"){let n=[];for(let r of Object.values(e.definitions)){let e=`${t} [data-style-id="${r.id}"]`,a=[];r.fontFamily&&a.push(`font-family: ${r.fontFamily}`),r.fontSizePx&&a.push(`font-size: ${r.fontSizePx}px`),r.bold&&a.push("font-weight: 700"),r.italic&&a.push("font-style: italic"),r.underline&&a.push("text-decoration: underline"),r.color&&a.push(`color: ${r.color}`),r.lineHeight&&a.push(`line-height: ${r.lineHeight}`),r.spaceBeforePt&&a.push(`margin-top: ${r.spaceBeforePt}pt`),r.spaceAfterPt&&a.push(`margin-bottom: ${r.spaceAfterPt}pt`),r.textAlign&&a.push(`text-align: ${r.textAlign}`),a.length>0&&n.push(`${e} { ${a.join("; ")}; }`)}return n.join("\n")}(h),t="docs-paragraph-styles-dynamic",n=document.getElementById(t);n||((n=document.createElement("style")).id=t,document.head.appendChild(n)),n.textContent=e},[h]);let m=(0,a.useCallback)(async()=>{if(!n||!r)return;let e={path:r,paragraphStyles:d.current};if(i){if(!(await fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw Error("paragraph styles save failed");return}await lt.uE.put("/richtext/save",e)},[r,n,i]),p=(0,a.useCallback)(()=>{n&&(u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{m().catch(()=>void 0)},600))},[n,m]),g=(0,a.useCallback)(async e=>{c(e),await lt.uE.put("/richtext/user-paragraph-styles",e)},[]),f=(0,a.useCallback)((e,t)=>{l(n=>({definitions:{...n.definitions,[e]:{...t,id:e,scope:"document"}}})),p()},[p]),x=(0,a.useCallback)((e,t)=>{c(n=>{let r={definitions:{...n.definitions,[e]:{...t,id:e,scope:"user"}}};return g(r),r})},[g]),b=(0,a.useCallback)(e=>{let t=h.definitions[e.basedOn??"normal"],n=(0,e8.B4)({...e,template:t});return c(e=>{let t={definitions:{...e.definitions,[n.id]:n}};return g(t),t}),n},[h.definitions,g]);return(0,a.useEffect)(()=>{if(!e)return;let t=({styleId:e,definition:t})=>{"user"===t.scope?x(e,t):f(e,t)};return e.on("docsParagraphStyleUpdate",t),()=>{e.off("docsParagraphStyleUpdate",t)}},[e,f,x]),(0,a.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]),{state:(0,a.useMemo)(()=>({documentStyles:s,userStyles:o,mergedCatalog:h}),[s,h,o]),updateDocumentStyle:f,updateUserStyle:x,createUserStyle:b,applyStyle:t=>{e?.commands.applyDocsParagraphStyle(t)},updateStyleFromSelection:t=>{e?.commands.updateDocsParagraphStyleFromSelection(t)}}}({editor:eI,initialDocumentStyles:L,editable:x,canonicalPath:e.canonicalPath,saveUrl:e.saveUrl});(0,a.useEffect)(()=>{F(eF.state.documentStyles)},[eF.state.documentStyles]),(0,a.useEffect)(()=>{e.paragraphStyles&&F(e.paragraphStyles)},[e.paragraphStyles]);let eE=(0,a.useMemo)(()=>({state:eF.state,applyStyle:eF.applyStyle,updateStyleFromSelection:eF.updateStyleFromSelection,createUserStyle:eF.createUserStyle,updateDocumentStyle:eF.updateDocumentStyle}),[eF]),eR=(0,a.useCallback)(()=>{var e;return eI&&m?.file?(e={editor:eI,sourceName:m.file.name,title:m.title,pageSetup:E,fallbackFormatId:ee.pageFormatId,paragraphStyles:eF.state.mergedCatalog,pageCount:$,getPageStackElement:()=>ep.current()}).editor?{title:e.title??e.sourceName,sourceName:e.sourceName,body:e.editor.getJSON(),pageSetup:e.pageSetup,pageLayout:nv(e.pageSetup,e.fallbackFormatId),paragraphStyles:e.paragraphStyles,pageCount:Math.max(1,e.pageCount),getPageStackElement:e.getPageStackElement}:null:null},[m?.file,m?.title,E,eI,$,eF.state.mergedCatalog,ee.pageFormatId]),eH=(0,a.useCallback)(async()=>{let e=eR();if(!e)return void c.oR.error("Impossible d'imprimer le document");try{await lO(e)}catch(e){console.error("[docs] print failed",e),c.oR.error("Impossible d'imprimer le document")}},[eR]),eB=function({file:e,editor:t,pageSetup:n,fallbackFormatId:i,getExportSnapshot:s,onPageSetupApply:l,onShareClick:o,onRenameRequest:d,onFileMoved:u,onPurgeSidecarAndReimport:h,disabled:m}){let p=(0,lw.useRouter)(),g=(0,sg.c1)(),f=e?(0,t8.at)(e.path):"/",x=(0,sg.GQ)(f,1,"",!1),b=(0,a.useMemo)(()=>(x.data?.files??[]).map(e=>e.name),[x.data?.files]),[y,j]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[N,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),[A,M]=(0,a.useState)(!1),[z,P]=(0,a.useState)(""),I=(0,a.useCallback)(async e=>{let t=await lt.uE.get(`/drive/files/info${e.startsWith("/")?e:`/${e}`}`);if(!t.file_id)throw Error("Identifiant du document introuvable");p.push((0,rT.Pc)(t.file_id))},[p]),T=(0,a.useCallback)(async e=>{let t=e.trim().replace(/\//g,"");if(!t)return;let n=t.endsWith(".docx")?t:`${t}.docx`;try{let{path:e}=await g.createFile.mutateAsync({parent_path:f,name:n,kind:"document"});c.oR.success("Document cr\xe9\xe9"),await I(e)}catch{throw c.oR.error("Impossible de cr\xe9er le document"),Error("create failed")}},[g.createFile,I,f]),D=(0,a.useCallback)(async()=>{if(!e)return;let t=function(e,t){let n=(0,sx._g)(e),r=n.lastIndexOf("."),a=r>0?n.slice(0,r):n,i=r>0?n.slice(r):"",s=t.map(sx._g),l=`Copie de ${a}${i}`;if(!s.includes(l))return l;let o=2;for(;s.includes(`Copie de ${a} (${o})${i}`);)o+=1;return`Copie de ${a} (${o})${i}`}(e.name,b),n=(0,t8.a3)(f,t);try{await g.copy.mutateAsync({source:e.path,destination:n}),c.oR.success("Copie cr\xe9\xe9e"),await I(n)}catch{c.oR.error("Impossible de cr\xe9er la copie")}},[e,g.copy,I,f,b]),L=(0,a.useCallback)(async()=>{if(e)try{await g.deleteFile.mutateAsync(e.path),c.oR.success("Document d\xe9plac\xe9 dans la corbeille"),p.push("/drive")}catch{c.oR.error("Impossible de d\xe9placer dans la corbeille")}},[e,g.deleteFile,p]),F=(0,a.useCallback)(async n=>{if(!e)return;if("html-zip"===n||"odt"===n||"rtf"===n||"epub"===n)return void c.oR.info("Export bient\xf4t disponible pour ce format");let r=s(),a="pdf"===n?c.oR.loading("G\xe9n\xe9ration du PDF…"):void 0;try{let a=await eL(n,r,t,e.name);"unsupported"===a?c.oR.error("Export indisponible"):"pdf"===n&&c.oR.success("PDF t\xe9l\xe9charg\xe9")}catch{c.oR.error("\xc9chec de l'export")}finally{null!=a&&c.oR.dismiss(a)}},[t,e,s]),E=(0,a.useCallback)(async()=>{let e=s();if(!e)return void c.oR.error("Impossible d'imprimer le document");try{await lO(e)}catch(e){console.error("[docs] print failed",e),c.oR.error("Impossible d'imprimer le document")}},[s]),R=(0,a.useCallback)(e=>{c.oR.info(`${e} — bient\xf4t disponible`)},[]),H=m||!e,B=(0,a.useMemo)(()=>({onNewDocument:()=>{P((0,lF.y)(b,"Document",".docx")),k(!0)},onNewFromTemplate:()=>R("Galerie de mod\xe8les"),onOpen:()=>j(!0),onMakeCopy:()=>void D(),onShareWithUsers:()=>o?.(),onPublishToWeb:()=>o?.(),onEmailFile:()=>R("Envoi par e-mail"),onEmailCollaborators:()=>R("Envoi aux collaborateurs"),onEmailDraft:()=>R("Brouillon d'e-mail"),onDownload:e=>void F(e),onRename:()=>d?.(),onMove:()=>w(!0),onAddShortcut:()=>R("Raccourci Drive"),onMoveToTrash:()=>void L(),onNameCurrentVersion:()=>R("Nommer la version actuelle"),onShowVersionHistory:()=>R("Historique des versions"),onToggleOffline:()=>R("Disponible hors connexion"),onDetails:()=>M(!0),onSecurityLimits:()=>R("Limites de s\xe9curit\xe9"),onPageSetup:()=>S(!0),onPrint:()=>void E(),...h?{onPurgeSidecarAndReimport:()=>void h()}:{}}),[F,E,D,L,h,d,o,b,R]);return(0,a.useEffect)(()=>{if(H)return;let e=e=>{let t=ec.getState().matchEvent(e,e=>"document"===e.scope&&"custom"===e.handler);if("file.open"===t){e.preventDefault(),j(!0);return}"file.print"===t&&(e.preventDefault(),E())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[E,H]),{actions:B,dialogs:e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(lS,{open:y,onOpenChange:j,onOpenFile:e=>(0,lW.h)(e,{push:e=>p.push(e)})}),(0,r.jsx)(t3.m,{open:v,onOpenChange:w,sources:[e],mode:"move",onMoved:t=>{t&&u?.((0,t8.a3)(t,e.name))}}),(0,r.jsx)(lL.a,{open:N,onOpenChange:k,title:"Nouveau document",description:"Nom du document \xe0 cr\xe9er dans le dossier actuel.",defaultValue:z,confirmLabel:"Cr\xe9er",onConfirm:T}),(0,r.jsx)(lD,{open:C,onOpenChange:S,pageSetup:n,fallbackFormatId:i,onApply:l}),(0,r.jsx)(lk,{open:A,onOpenChange:M,file:e})]}):null,disabled:H}}({file:m?.file,editor:eI,pageSetup:E,fallbackFormatId:ee.pageFormatId,getExportSnapshot:eR,onPageSetupApply:e=>{J.current=e,ey(e,{immediate:!0})},onPurgeSidecarAndReimport:()=>void ek(),onShareClick:m?.onShareClick,onRenameRequest:m?.onRenameRequest,onFileMoved:m?.onFileMoved,disabled:!x}),e$=function({editor:e,disabled:t,onPageSetup:n}){let[r,i]=(0,a.useState)(0);(0,a.useEffect)(()=>{if(!e||t)return;let n=()=>i(e=>e+1);return e.on("transaction",n),e.on("selectionUpdate",n),()=>{e.off("transaction",n),e.off("selectionUpdate",n)}},[t,e]);let s=(0,a.useMemo)(()=>{if(!e)return{isBold:!1,isItalic:!1,isUnderline:!1,isStrike:!1,alignLeft:!0,alignCenter:!1,alignRight:!1,alignJustify:!1,isBulletList:!1,isOrderedList:!1,styleId:"normal",tableSelected:!1,tableCanMerge:!1,tableCanSplit:!1,graphicSelected:!1,imageSelected:!1,lineHeightPresetId:"1.15",hasSpaceBefore:!1,hasSpaceAfter:!1,keepWithNext:!1,keepLinesTogether:!1,preventWidowOrphan:!1,pageBreakBefore:!1,customSpacingDraft:{...ti},isTaskList:!1,bulletStyleId:null,orderedStyleId:null,checklistStyleId:null,orderedListStart:1};let t=a6(e),n=il(e),r=ib(e);return{isBold:e.isActive("bold"),isItalic:e.isActive("italic"),isUnderline:e.isActive("underline"),isStrike:e.isActive("strike"),alignLeft:e.isActive({textAlign:"left"}),alignCenter:e.isActive({textAlign:"center"}),alignRight:e.isActive({textAlign:"right"}),alignJustify:e.isActive({textAlign:"justify"}),isBulletList:e.isActive("bulletList"),isOrderedList:e.isActive("orderedList"),styleId:t,tableSelected:e.isActive("table"),tableCanMerge:iO(e),tableCanSplit:iW(e),graphicSelected:e.isActive("docsGraphic")||e.isActive("docsInlineGraphic"),imageSelected:e.isActive("image"),lineHeightPresetId:n.lineHeightPresetId,hasSpaceBefore:n.hasSpaceBefore,hasSpaceAfter:n.hasSpaceAfter,keepWithNext:n.keepWithNext,keepLinesTogether:n.keepLinesTogether,preventWidowOrphan:n.preventWidowOrphan,pageBreakBefore:n.pageBreakBefore,customSpacingDraft:id(e),isTaskList:r.isTaskList,bulletStyleId:r.bulletStyleId,orderedStyleId:r.orderedStyleId,checklistStyleId:r.checklistStyleId,orderedListStart:r.orderedStart}},[e,r]);return{actions:(0,a.useMemo)(()=>({onBold:()=>e?.chain().focus().toggleMark("bold").run(),onItalic:()=>e?.chain().focus().toggleMark("italic").run(),onUnderline:()=>e?.chain().focus().toggleUnderline().run(),onStrike:()=>e?.chain().focus().toggleMark("strike").run(),onAlignLeft:()=>e?.chain().focus().setTextAlign("left").run(),onAlignCenter:()=>e?.chain().focus().setTextAlign("center").run(),onAlignRight:()=>e?.chain().focus().setTextAlign("right").run(),onAlignJustify:()=>e?.chain().focus().setTextAlign("justify").run(),onIncreaseIndent:()=>{e&&e.chain().focus().increaseDocsIndent().run()},onDecreaseIndent:()=>{e&&e.chain().focus().decreaseDocsIndent().run()},onToggleBulletList:()=>e?.chain().focus().toggleBulletList().run(),onToggleOrderedList:()=>e?.chain().focus().toggleOrderedList().run(),onApplyStyle:t=>{e&&a8(e,t)},onClearFormatting:()=>e?.chain().focus().unsetAllMarks().clearNodes().run(),onPageSetup:n,onTableAddRowBefore:()=>e?.chain().focus().addRowBefore().run(),onTableAddRowAfter:()=>e?.chain().focus().addRowAfter().run(),onTableAddColumnBefore:()=>e?.chain().focus().addColumnBefore().run(),onTableAddColumnAfter:()=>e?.chain().focus().addColumnAfter().run(),onTableDeleteRow:()=>e?.chain().focus().deleteRow().run(),onTableDeleteColumn:()=>e?.chain().focus().deleteColumn().run(),onTableDelete:()=>e?.chain().focus().deleteTable().run(),onTableMergeCells:()=>e?.chain().focus().mergeCells().run(),onTableSplitCell:()=>e?.chain().focus().splitCell().run(),onTableToggleHeaderRow:()=>e?.chain().focus().toggleHeaderRow().run(),onTableToggleHeaderColumn:()=>e?.chain().focus().toggleHeaderColumn().run(),onTableSetCellBackground:t=>i_(e,t),onTableAlignLeft:()=>iX(e,"left"),onTableAlignCenter:()=>iX(e,"center"),onTableAlignRight:()=>iX(e,"right"),onTableFixStructure:()=>e?.chain().focus().fixTables().run(),onTableSetCellBorders:t=>iG(e,iB(t)),onTableClearCellBorders:()=>iY(e),onTableSetRowHeight:t=>iU(e,t),onSetLineHeight:t=>{e&&e.chain().focus().setDocsLineHeight(t).run()},onToggleSpaceBefore:()=>{e&&e.chain().focus().toggleDocsSpaceBefore().run()},onToggleSpaceAfter:()=>{e&&e.chain().focus().toggleDocsSpaceAfter().run()},onApplyCustomSpacing:t=>{e&&ic(e,t)},onToggleKeepWithNext:()=>{e&&e.chain().focus().toggleDocsKeepWithNext().run()},onToggleKeepLinesTogether:()=>{e&&e.chain().focus().toggleDocsKeepLinesTogether().run()},onTogglePreventWidowOrphan:()=>{e&&e.chain().focus().toggleDocsPreventWidowOrphan().run()},onTogglePageBreakBefore:()=>{e&&e.chain().focus().toggleDocsPageBreakBefore().run()},onApplyBulletStyle:t=>{e&&e.chain().focus().applyDocsBulletStyle(t).run()},onApplyOrderedStyle:t=>{e&&e.chain().focus().applyDocsOrderedStyle(t).run()},onApplyChecklistStyle:t=>{e&&e.chain().focus().applyDocsChecklistStyle(t).run()},onRestartOrderedList:()=>{e&&e.chain().focus().restartDocsOrderedList().run()},onContinueOrderedList:()=>{e&&e.chain().focus().continueDocsOrderedList().run()},onSetOrderedListStart:t=>{e&&e.chain().focus().setDocsOrderedListStart(t).run()}}),[e,n]),state:s,disabled:t}}({editor:eI,disabled:!x,onPageSetup:eB.actions.onPageSetup}),eO=(0,a.useCallback)(()=>{let e=em.current;if(e){if(document.fullscreenElement)return void document.exitFullscreen();e.requestFullscreen?.()}},[]),eW=(0,a.useMemo)(()=>({editorMode:ee.editorMode,commentsDisplay:ee.commentsDisplay,showLayout:ee.showLayout,showRuler:ee.showRuler,showEquationToolbar:ee.showEquationToolbar,showNonPrintableChars:ee.showNonPrintableChars}),[ee]),e_=(0,a.useMemo)(()=>({onEditorModeChange:ei,onCommentsDisplayChange:es,onToggleOutlineSidebar:el,onToggleShowLayout:eo,onToggleShowRuler:ed,onToggleShowEquationToolbar:eu,onToggleShowNonPrintableChars:eh,onFullscreen:eO}),[eO,es,ei,el,eu,eo,eh,ed]),eq=oz(e=>e.closePanel);(0,a.useEffect)(()=>{eq()},[e.canonicalPath,eq]);let eG=m?{...m,trailing:(0,r.jsxs)(r.Fragment,{children:[m.trailing,(0,r.jsx)(oI,{})]}),fileMenuActions:eB.actions,fileMenuDialogs:eB.dialogs,fileMenuDisabled:eB.disabled,editMenuActions:eT.actions,editMenuState:eT.state,editMenuDisabled:eT.disabled,insertMenuActions:eD.actions,insertMenuDialogs:eD.dialogs,insertMenuDisabled:eD.disabled,insertMenuPageElementsEnabled:eD.pageElementsEnabled,formatMenuActions:e$.actions,formatMenuState:e$.state,formatMenuDisabled:e$.disabled,viewMenuActions:e_,viewMenuState:eW,viewMenuDisabled:!1}:void 0;(0,a.useEffect)(()=>{if(!eI||eI.isDestroyed)return;let e=x&&"view"!==ee.editorMode;eI.setEditable(e)},[eI,x,ee.editorMode]),(0,a.useEffect)(()=>{let e=e=>{"view.showNonPrintable"===ec.getState().matchEvent(e,e=>"document"===e.scope&&"custom"===e.handler)&&(e.preventDefault(),eh())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[eh]),(0,a.useEffect)(()=>{if(!eI||b||!M)return;if(T){eI.commands.setContent(T),D(null);return}if(P)return;let t=!1;return(async()=>{try{let n;if(e.documentUrl){let t=await fetch(e.documentUrl);if(!t.ok)throw Error("load failed");n=JSON.parse(await t.text())}else{let t=await lt.uE.getBlob((0,sf.Cl)(e.canonicalPath));n=JSON.parse(await t.text())}!t&&n.pageSetup?R(n.pageSetup):t||R(e=>e??nC(lP(ee.pageFormatId),null)),t||!n.content||lQ(n.content)?!t&&e.sourcePath&&(I(!0),z(!1)):eI.commands.setContent(n.content)}catch{}})(),()=>{t=!0}},[eI,b,M,T,P,e.canonicalPath,e.documentUrl,e.sourcePath,ee.pageFormatId]);let eY=!ez||!eI,eU=(f={contentImportPending:P,importDone:M,importRequired:e.importRequired,collaboration:!!b,collabSynced:k}).contentImportPending&&!f.importDone||f.importRequired&&!f.importDone?"import":f.collaboration&&!f.collabSynced?"collaboration":"connecting";return((0,a.useEffect)(()=>{p&&g?.(eY,eU)},[p,eY,eU,g]),S)?(0,r.jsxs)("div",{className:"flex h-full items-center justify-center p-6 text-sm text-destructive",children:["Collaboration indisponible : ",S]}):!p&&eY?(0,r.jsx)(sq,{phase:eU,title:eG?.title}):p&&eY||!eI?null:(0,r.jsx)(tp,{value:eE,children:(0,r.jsxs)("div",{ref:em,className:(0,v.cn)("flex min-h-0 flex-1 flex-col bg-white dark:bg-background",ee.outlineSidebarExpanded&&"docs-outline-sidebar-expanded"),children:[eG&&!ee.chromeCollapsed?(0,r.jsx)(ne,{...eG,saveStatus:H,presenceUsers:eg}):null,m?(0,r.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-row",children:[(0,r.jsx)(sW,{editor:eI,pageLayout:ef,zoom:ee.zoom,editable:x&&"view"!==ee.editorMode,showLayout:ee.showLayout,showRuler:ee.showRuler,showNonPrintableChars:ee.showNonPrintableChars,editorMode:ee.editorMode,outlineExpanded:ee.outlineSidebarExpanded,onToggleOutline:el,onPageCountChange:ew,onCurrentPageChange:eN,onRegionContentChange:ej,onPageSetupChange:ev,onRegionEditorChange:G,onPageStackReady:e=>{ep.current=e},toolbarShellClassName:ee.chromeCollapsed?"docs-toolbar-shell--collapsed":void 0,toolbar:x?(0,r.jsx)(lf,{editor:q??eI,zoom:ee.zoom,onZoomChange:en,spellcheck:ee.spellcheck,onToggleSpellcheck:er,showChromeToggle:!!m,chromeCollapsed:ee.chromeCollapsed,onToggleChromeCollapsed:ea,onPrint:()=>void eH(),embedded:!0}):null}),(0,r.jsx)(oP,{editor:eI,documentPath:e.canonicalPath,documentTitle:eG?.title??"Document",sourcePath:e.sourcePath,editable:x&&"view"!==ee.editorMode})]}):(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-auto",children:(0,r.jsx)(s.$Z,{editor:eI,className:"h-full"})}),m?(0,r.jsx)(iK,{pageLayout:ef,pageCount:$,currentPage:W}):null]})})}var oD=n(94883);let oL={roomId:"demo-docs",canonicalPath:"/D\xe9mo/Bienvenue dans UltiDocs.ultidoc.json",wsUrl:"",token:"",mode:"edit",importRequired:!1,collaboration:!1,documentUrl:"/demo/ultidoc-sample.json",saveUrl:"/api/demo/richtext-save"};function oF(){(0,a.useEffect)(()=>{document.documentElement.dataset.routeScope="drive"},[]);let e=(0,a.useMemo)(()=>({title:"Bienvenue dans UltiDocs",showBack:!1,showShare:!1,showAccount:!1,trailing:(0,r.jsx)("span",{className:"rounded-full border border-[var(--mail-border)] px-2.5 py-1 text-[11px] font-medium text-muted-foreground",children:"D\xe9mo — z\xe9ro r\xe9tention"})}),[]);return(0,r.jsx)(oD.SuiteThemeShell,{children:(0,r.jsx)(i.K,{children:(0,r.jsx)("div",{className:"flex h-dvh flex-col overflow-hidden",children:(0,r.jsx)(oT,{session:oL,mode:"edit",userName:"Visiteur",userColor:"#4f6df5",chrome:e})})})})}},15049:(e,t,n)=>{"use strict";n.d(t,{u:()=>o});var r=n(83119);async function a(e){let t=e.head,n=[];for(let r of document.querySelectorAll('link[rel="stylesheet"], style')){if(r instanceof HTMLLinkElement){let a=r.href;if(!a)continue;let i=e.createElement("link");i.rel="stylesheet",i.href=a,r.media&&(i.media=r.media),n.push(new Promise(e=>{i.onload=()=>e(),i.onerror=()=>e()})),t.appendChild(i);continue}t.appendChild(r.cloneNode(!0))}e.documentElement.lang=document.documentElement.lang,e.documentElement.className=document.documentElement.className,e.documentElement.classList.remove("dark"),e.documentElement.style.background="#ffffff",await Promise.all(n),e.fonts?.ready&&await e.fonts.ready}async function i(e,t,n){let i=t.widthPx,s=n*t.heightPx,l=document.createElement("iframe");l.setAttribute("aria-hidden","true"),l.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;border:0;opacity:0;pointer-events:none;overflow:hidden";let o=new Promise((e,t)=>{l.onload=()=>{let n=l.contentDocument;n?e(n):t(Error("Impossible de pr\xe9parer la capture"))},l.onerror=()=>t(Error("Impossible de pr\xe9parer la capture"))});l.src="about:blank",document.body.appendChild(l);let c=await o;await a(c);let d=e.cloneNode(!0);!function(e,t,n){let a=t.widthPx,i=t.heightPx+r.sl,s=Math.max(0,n-1)*r.sl;e.style.transform="none",e.style.transformOrigin="top left",e.style.left="0",e.style.marginLeft="0",e.style.position="relative",e.style.width=`${a}px`,e.classList.remove("left-1/2","-translate-x-1/2","top-0"),e.querySelectorAll(".docs-page-gap-band").forEach(e=>{e.style.display="none"}),e.querySelectorAll(".docs-page-inter-margin-gutter").forEach(e=>{e.style.display="none"});let l=parseFloat(e.style.height);Number.isFinite(l)&&s>0&&(e.style.height=`${l-s}px`),e.querySelectorAll("[style]").forEach(e=>{let t=parseFloat(e.style.top);if(!Number.isFinite(t)||t<=0)return;let n=Math.floor(t/i);e.style.top=`${t-n*r.sl}px`}),e.querySelectorAll(".docs-page-flow-spacer").forEach(e=>{let t=parseFloat(e.style.height);Number.isFinite(t)&&t>=r.sl&&(e.style.height=`${t-r.sl}px`)});let o=e.querySelector(".ultidrive-docs-editor-surface");if(o){let e=parseFloat(o.style.height);Number.isFinite(e)&&s>0&&(o.style.height=`${e-s}px`),o.removeAttribute("contenteditable")}e.querySelectorAll(".ProseMirror").forEach(e=>{e.removeAttribute("contenteditable")})}(d,t,n),c.body.replaceChildren(),c.body.style.cssText=`margin:0;padding:0;background:#ffffff;width:${i}px;height:${s}px;overflow:hidden`;let u=c.createElement("div");return u.style.cssText=`position:relative;width:${i}px;height:${s}px;overflow:hidden`,u.appendChild(d),c.body.appendChild(u),await new Promise(e=>requestAnimationFrame(()=>e())),await new Promise(e=>requestAnimationFrame(()=>e())),{root:d,dispose:()=>{l.remove()}}}async function s(e,t,r,a,i){let{default:s}=await n.e(9862).then(n.bind(n,34277)),l=await s(e,{backgroundColor:"#ffffff",scale:i,useCORS:!0,logging:!1,width:t,height:r,x:0,y:a,scrollX:0,scrollY:0,windowWidth:t,windowHeight:e.scrollHeight});if(0===l.width||0===l.height)throw Error("Capture page vide");return l}async function l(e){let t=window.scrollX,n=window.scrollY,r=document.documentElement,a=document.body,i=r.style.overflow,s=a.style.overflow;r.style.overflow="hidden",a.style.overflow="hidden";try{return await e()}finally{r.style.overflow=i,a.style.overflow=s,window.scrollTo(t,n)}}async function o(e,t){let n,r=(n=e.getPageStackElement())?{stack:n,pageWidth:Number(n.dataset.docsPageWidth??e.pageLayout.widthPx),pageHeight:Number(n.dataset.docsPageHeight??e.pageLayout.heightPx),pageCount:e.pageCount}:null;if(!r)throw Error("Page stack introuvable");let{stack:a,pageWidth:o,pageHeight:c,pageCount:d}=r,u=t?.scale??2;return l(async()=>{let{root:t,dispose:n}=await i(a,e.pageLayout,d);try{let e=[];for(let n=0;n<d;n+=1){let r,a=n*c;try{r=await s(t,o,c,a,u)}catch(e){if(1===u)throw e;r=await s(t,o,c,a,1)}e.push(r)}return e}finally{n()}})}},19321:(e,t,n)=>{"use strict";n.d(t,{Ao:()=>d,DN:()=>u,au:()=>l,dq:()=>o,j8:()=>i,vW:()=>s});var r=n(83119),a=n(79535);function i(e){let t="graphicType"in e?e:(0,a.Oy)(e);return"behind"===t.wrap||"in-front"===t.wrap||"fixed-on-page"===t.positionMode}function s(e){return i(e)?"behind"===e.wrap?"behind":"front":null}function l(e){return"behind"===e?"docs-page-graphic-layer-behind":"docs-page-graphic-layer-front"}function o(e,t){return e*(t+r.sl)}function c(e,t){return e<0?0:Math.max(0,Math.floor(e/(t+r.sl)))}function d(e,t,n,r){let a=(e.left-t.left)/n,i=(e.top-t.top)/n,s=c(i,r),l=i-o(s,r);return{pageIndex:s,pageX:Math.round(a),pageY:Math.round(Math.max(0,l))}}function u(e,t,n){if(n<=0)return{pageIndex:Math.max(0,e),pageY:Math.round(t)};let r=o(Math.max(0,e),n)+t,a=c(r,n),i=Math.min(Math.max(0,Math.round(r-o(a,n))),n);return{pageIndex:a,pageY:i}}},30640:(e,t,n)=>{"use strict";n.d(t,{G:()=>function e(t){return a(t)?"table"===t.type?function(t){if(!a(t)||"table"!==t.type)return t;let n=Array.isArray(t.content)?t.content:[],i=n.find(e=>a(e)&&"tableRow"===e.type),s=(Array.isArray(i?.content)?i.content:[]).map(e=>{if(!a(e)||!a(e.attrs))return null;let t=e.attrs.colwidth;return Array.isArray(t)&&"number"==typeof t[0]?t[0]:"number"==typeof t?t:null}).filter(e=>null!=e&&e>0),l=a(t.attrs)?{...t.attrs}:{};"fixed"!==l.layout||s.length||delete l.layout;let o=n.map(t=>{if(!a(t)||"tableRow"!==t.type)return t;let n=a(t.attrs)?{...t.attrs}:{};"string"!=typeof n.rowHeight||n.rowHeight.trim()||delete n.rowHeight,"exact"!==n.rowHeightRule&&"atLeast"!==n.rowHeightRule&&delete n.rowHeightRule;let i=(Array.isArray(t.content)?t.content:[]).map((t,n)=>{if(!a(t)||"tableCell"!==t.type&&"tableHeader"!==t.type)return t;let i=function(e){let t={...e};if("string"==typeof t.backgroundColor&&(t.backgroundColor=t.backgroundColor.trim()||null),Array.isArray(t.colwidth)){let e=t.colwidth.map(e=>"number"==typeof e&&Number.isFinite(e)?e:null).filter(e=>null!=e&&e>0);e.length?t.colwidth=e:delete t.colwidth}for(let e of["borderTop","borderRight","borderBottom","borderLeft"]){let n=function(e){if(!e)return null;if("string"==typeof e)return function(e){let t=e.trim();if(!t||"none"===t||"0"===t)return null;let n=t.split(/\s+/);if(n.length<2)return null;let r=parseFloat(n[0]??""),a=n[1]??"solid",i=n.slice(2).join(" ")||"#000000";return{size:Number.isFinite(r)?Math.max(1,Math.round(8*r)):8,style:"solid"===a?"single":a,color:i}}(e);if(!a(e))return null;let t="string"==typeof e.style?e.style:"single",n="solid"===t?"single":t;if("none"===n||"nil"===n)return null;let i="string"==typeof e.color&&e.color?e.color:"#000000",s={size:"number"==typeof e.size&&Number.isFinite(e.size)?e.size:8,style:r.has(n)?n:"single",color:i};return"number"==typeof e.space&&Number.isFinite(e.space)&&(s.space=e.space),s}(t[e]);n?t[e]=n:delete t[e]}return t}(a(t.attrs)?{...t.attrs}:{});!i.colwidth&&s[n]&&(i.colwidth=[s[n]]);let l=Array.isArray(t.content)?t.content.map(t=>e(t)):[{type:"paragraph"}];return{...t,attrs:Object.keys(i).length?i:void 0,content:l}});return{...t,attrs:Object.keys(n).length?n:void 0,content:i}});return{...t,attrs:Object.keys(l).length?l:void 0,content:o}}(t):Array.isArray(t.content)?{...t,content:t.content.map(t=>e(t))}:t:t}});let r=new Set(["single","dashed","dotted","double","dotDash","dotDotDash","none"]);function a(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}},43996:(e,t,n)=>{"use strict";function r(e){let t=e??window.location.pathname+window.location.search;!t.startsWith("/drive")||t.startsWith("//")||t.includes("://")||sessionStorage.setItem("ultidrive-editor-return-to",t)}n.d(t,{_K:()=>r})},46002:(e,t,n)=>{"use strict";n.d(t,{$Q:()=>u,A2:()=>c,Jt:()=>m,bX:()=>h});var r=n(19321),a=n(79535);function i(e){return[e.x,e.x+e.width/2,e.x+e.width]}function s(e){return[e.y,e.y+e.height/2,e.y+e.height]}function l(e){let{pageWidth:t,pageHeight:n,margins:r,otherRects:a}=e,l=new Set([0,r.left,t/2,t-r.right,t]),o=new Set([0,r.top,n/2,n-r.bottom,n]);for(let e of a){for(let t of i(e))l.add(t);for(let t of s(e))o.add(t)}return{x:[...l],y:[...o]}}function o(e,t,n){let r=n+1,a=0,i=null;for(let s of e)for(let e of t){let t=e-s,l=Math.abs(t);l<=n&&l<r&&(r=l,a=t,i=e)}return{delta:r<=n?a:0,guide:i}}function c(e,t,n=6){let r=l(t),a=[],d=o(i(e),r.x,n),u=o(s(e),r.y,n);return null!=d.guide&&a.push({axis:"x",position:d.guide}),null!=u.guide&&a.push({axis:"y",position:u.guide}),{rect:{...e,x:Math.round(e.x+d.delta),y:Math.round(e.y+u.delta)},guides:a}}function d(e,t,n,r,a){var i,s,l;let o=(i=e,s=t,l=n,"x"===s?"start"===l?i.x:"center"===l?i.x+i.width/2:i.x+i.width:"start"===l?i.y:"center"===l?i.y+i.height/2:i.y+i.height),c=a+1,d=null;for(let e of r){let t=Math.abs(e-o);t<=a&&t<c&&(c=t,d=e)}return null==d?{rect:e,guide:null}:{rect:function(e,t,n,r){let a={...e};if("x"===t)if("start"===n){let t=e.x+e.width;a.x=r,a.width=Math.max(1,t-r)}else"end"===n?a.width=Math.max(1,r-e.x):a.x=r-e.width/2;else if("start"===n){let t=e.y+e.height;a.y=r,a.height=Math.max(1,t-r)}else"end"===n?a.height=Math.max(1,r-e.y):a.y=r-e.height/2;return{x:Math.round(a.x),y:Math.round(a.y),width:Math.round(a.width),height:Math.round(a.height)}}(e,t,n,d),guide:d}}function u(e,t,n,r=6){let a,i,s=l(n),o=(a=[],i=[],e.includes("w")&&a.push("start"),e.includes("e")&&a.push("end"),e.includes("n")&&i.push("start"),e.includes("s")&&i.push("end"),0===a.length&&0===i.length&&(a.push("end"),i.push("end")),{x:a,y:i}),c={...t},h=[];for(let e of o.x){let t=d(c,"x",e,s.x,r);c=t.rect,null!=t.guide&&h.push({axis:"x",position:t.guide})}for(let e of o.y){let t=d(c,"y",e,s.y,r);c=t.rect,null!=t.guide&&h.push({axis:"y",position:t.guide})}return{rect:c,guides:function(e){let t=new Set,n=[];for(let r of e){let e=`${r.axis}:${r.position}`;t.has(e)||(t.add(e),n.push(r))}return n}(h)}}function h(e,t,n){let i=[];return e.descendants((e,s)=>{if("docsGraphic"!==e.type.name)return;let l=(0,a.Oy)(e.attrs);(0,r.j8)(l)&&l.pageIndex===t&&(null==n||s!==n)&&i.push({x:l.pageX,y:l.pageY,width:l.width,height:l.height})}),i}function m(e,t){if(!e)return null;let n=Number.parseFloat(e.dataset.docsPageWidth??"0"),r=Number.parseFloat(e.dataset.docsPageHeight??"0");return n<=0||r<=0?null:{pageWidth:n,pageHeight:r,margins:{top:Number.parseFloat(e.dataset.docsPageMarginTop??"0")||0,right:Number.parseFloat(e.dataset.docsPageMarginRight??"0")||0,bottom:Number.parseFloat(e.dataset.docsPageMarginBottom??"0")||0,left:Number.parseFloat(e.dataset.docsPageMarginLeft??"0")||0},otherRects:t}}},55848:(e,t,n)=>{"use strict";n.d(t,{E0:()=>c,xY:()=>m});var r=n(31132),a=n(79535);function i(e,t){let n=e.parent,r=e.start(e.depth);for(let e=0;e<t;e++)r+=n.child(e).nodeSize;return r}var s=n(19321),l=n(95528),o=n(46002);let c=24,d=["left","center","right"];function u(e){return Math.max(c,Math.round(e))}let h=null;function m(e,t){var n,c;let m;if("u">typeof document&&document.querySelector(".docs-graphic--cropping"))return!1;let p=(m=e.isActive("docsInlineGraphic")?"docsInlineGraphic":e.isActive("docsGraphic")?"docsGraphic":null)?(0,a.Oy)(e.getAttributes(m)):null;if(!p)return!1;let g=function(e){let t=e.shiftKey?10:1,n=e.shiftKey?20:5,r=e.metaKey||e.ctrlKey;if(r&&!e.altKey){if("]"===e.key||"}"===e.key)return{type:"layer",direction:"forward"};if("["===e.key||"{"===e.key)return{type:"layer",direction:"backward"}}if(e.altKey&&!r)switch(e.key){case"ArrowLeft":return{type:"resize",dw:-n,dh:0};case"ArrowRight":return{type:"resize",dw:n,dh:0};case"ArrowUp":return{type:"resize",dw:0,dh:-n};case"ArrowDown":return{type:"resize",dw:0,dh:n};default:return null}if(!e.altKey&&!r)switch(e.key){case"ArrowLeft":return{type:"move",dx:-t,dy:0};case"ArrowRight":return{type:"move",dx:t,dy:0};case"ArrowUp":return{type:"move",dx:0,dy:-t};case"ArrowDown":return{type:"move",dx:0,dy:t};case"[":return{type:"rotate",deltaDeg:e.shiftKey?-15:-5};case"]":return{type:"rotate",deltaDeg:e.shiftKey?15:5}}return null}(t);if(!g)return!1;if("layer"===g.type){let n="forward"===g.direction?e.chain().focus().bringDocsGraphicForward().run():e.chain().focus().sendDocsGraphicBackward().run();return n&&t.preventDefault(),n}if("move-with-text"===p.positionMode&&!(0,s.j8)(p)&&"move"===g.type){if(0!==g.dy)return!function(e,t){let{state:n}=e,s=function(e){let{selection:t}=e;if(!(t instanceof r.nh))return null;let n=t.node;return"docsGraphic"!==n.type.name&&"docsInlineGraphic"!==n.type.name?null:{pos:t.from,node:n}}(n);if(!s)return;let{pos:l,node:o}=s;"docsGraphic"===o.type.name?function(e,t,n,a,s){let l=e.doc.resolve(t),o=l.index(l.depth),c=l.parent;if("up"===a){if(0===o)return;let a=i(l,o-1),c=e.tr;c.delete(t,t+n.nodeSize);let d=c.mapping.map(a);return c.insert(d,n),c.setSelection(r.nh.create(c.doc,d)),s?.(c)}if(o>=c.childCount-1)return;let d=i(l,o+2),u=e.tr;u.delete(t,t+n.nodeSize);let h=u.mapping.map(d);u.insert(h,n),u.setSelection(r.nh.create(u.doc,h)),s?.(u)}(n,l,o,t,e.view.dispatch.bind(e.view)):function(e,t,n,i,s){let l,o,c=function(e,t){let n=e.schema.nodes.docsGraphic;if(!n)return null;let r=(0,a.Oy)(t.attrs),i="inline"===r.wrap?"square":r.wrap;return n.create({...t.attrs,placement:"block",wrap:i})}(e,n);if(!c)return;let d=e.doc.resolve(t),u=d.before(d.depth),h=e.doc.resolve(u);if("up"===i&&0===h.index(h.depth))return;let m=d.after(d.depth);if("down"===i&&m>=e.doc.content.size)return;let p=e.tr;p.delete(t,t+n.nodeSize),l=p.mapping.map(u),o=p.doc.nodeAt(l),o?.type.name==="paragraph"&&0===o.content.size&&p.delete(l,l+o.nodeSize);let g="up"===i?p.mapping.map(u):p.mapping.map(m);p.insert(g,c),p.setSelection(r.nh.create(p.doc,g)),s?.(p)}(n,l,o,t,e.view.dispatch.bind(e.view))}(e,g.dy<0?"up":"down"),t.preventDefault(),!0;if(0!==g.dx){let r,a=(n=p.floatSide,c=g.dx>0?"right":"left",r=d.indexOf(n),d[(r+("right"===c?1:-1)+d.length)%d.length]),i=e.chain().focus().setDocsGraphicFloatSide(a).run();return i&&t.preventDefault(),i}}let f=function(e,t){let n=(0,s.j8)(e);if("move"===t.type)return n?{pageX:Math.round(e.pageX+t.dx),pageY:Math.round(e.pageY+t.dy)}:"absolute"===e.placement?{x:Math.round(e.x+t.dx),y:Math.round(e.y+t.dy)}:null;if("rotate"===t.type)return{rotationDeg:e.rotationDeg+t.deltaDeg};if("resize"===t.type){let r=e.width,a=e.height,i=0,s=0;if(0!==t.dw){let e=u(r+t.dw);t.dw<0&&(i=r-e),r=e}if(0!==t.dh){let e=u(a+t.dh);t.dh<0&&(s=a-e),a=e}let l={width:r,height:a};return n?(0!==i&&(l.pageX=Math.round(e.pageX+i)),0!==s&&(l.pageY=Math.round(e.pageY+s))):(0!==i||0!==s)&&(0!==i&&(l.x=Math.round(e.x+i)),0!==s&&(l.y=Math.round(e.y+s))),l}return null}(p,g);if(!f)return!1;let x=(0,s.j8)(p)&&("move"===g.type||"resize"===g.type)?function(e,t,n,r){var a,i,c,d,u,m;let p=function(e,t){if("u"<typeof document||!(0,s.j8)(t))return null;let n=document.querySelector("[data-docs-page-stack]"),r=e.state.selection.from,a=(0,o.bX)(e.state.doc,t.pageIndex,r);return(0,o.Jt)(n,a)}(n,e);if(!p)return t;let g={x:t.pageX??e.pageX,y:t.pageY??e.pageY,width:t.width??e.width,height:t.height??e.height},f="resize"===r.type?(0,o.$Q)((a=r.dw,i=r.dh,a<0&&i<0?"nw":a>0&&i<0?"ne":a<0&&i>0?"sw":a>0&&i>0?"se":a<0?"w":a>0?"e":i<0?"n":"s"),g,p):(0,o.A2)(g,p);return c=e.pageIndex,d=p.pageWidth,u=p.pageHeight,0===(m=f.guides).length?(0,l.qV)():((0,l.Tx)({pageIndex:c,pageWidth:d,pageHeight:u,guides:m}),h&&clearTimeout(h),h=setTimeout(()=>{(0,l.qV)(),h=null},650)),{...t,pageX:f.rect.x,pageY:f.rect.y,width:f.rect.width,height:f.rect.height}}(p,f,e,g):f,b=e.chain().focus().updateDocsGraphic(x).run();return b&&t.preventDefault(),b}},59848:(e,t,n)=>{"use strict";n.d(t,{o:()=>a});var r=n(91356);function a(e,t=250){let[n,i]=(0,r.useState)(e);return(0,r.useEffect)(()=>{let n=window.setTimeout(()=>i(e),t);return()=>window.clearTimeout(n)},[e,t]),n}},64882:(e,t,n)=>{"use strict";n.d(t,{K:()=>u});var r=n(4208),a=n(91356),i=n(19984),s=n(89032);function l(){s.oR.message("Navigation hors d\xe9mo",{id:"demo-nav-blocked",description:"Cr\xe9ez un compte pour acc\xe9der \xe0 toute la suite — la d\xe9mo reste sur cette application."})}function o(e){return null==e||""===e?null:"string"==typeof e?e:e.toString()}function c(){let e=function(e){if(!e.startsWith("/demo/"))return null;let t=e.split("/").filter(Boolean);return"demo"===t[0]&&t[1]?`demo/${t[1]}`:null}((0,i.usePathname)());return(0,a.useEffect)(()=>{if(!e)return;let t=window.location.origin,n=n=>!n||function(e,t,n=window.location.origin){let r=function(e,t=window.location.origin){let n=e.trim();if(!n||"#"===n||n.startsWith("#")||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("mailto:")||n.startsWith("tel:")||n.startsWith("javascript:"))return null;try{let e=new URL(n,t);if(e.origin!==t)return null;return`${e.pathname}${e.search}${e.hash}`}catch{return null}}(e,n);if(null===r)return!0;let a=`/${t}`;return r===a||r.startsWith(`${a}/`)}(n,e,t),r=history.pushState.bind(history),a=history.replaceState.bind(history);history.pushState=(e,t,a)=>n(o(a))?r(e,t,a):void l(),history.replaceState=(e,t,r)=>n(o(r))?a(e,t,r):void l();let i=e=>{let t=e.target.closest("a[href]");if(!t||"_blank"===t.getAttribute("target"))return;let r=t.getAttribute("href");!r||n(r)||(e.preventDefault(),e.stopPropagation(),l())};return document.addEventListener("click",i,!0),()=>{history.pushState=r,history.replaceState=a,document.removeEventListener("click",i,!0)}},[e]),null}var d=n(58113);function u({children:e,className:t}){return(0,r.jsxs)("div",{className:(0,d.cn)("relative flex h-dvh max-h-dvh flex-col overflow-hidden",t),children:[(0,r.jsx)(c,{}),(0,r.jsx)("div",{className:(0,d.cn)("pointer-events-none absolute inset-x-0 top-0 z-50 flex justify-center pt-2","max-sm:pt-1"),children:(0,r.jsx)("span",{className:"rounded-full border border-[var(--mail-border)] bg-[var(--mail-surface-elevated)]/95 px-3 py-1 text-[11px] font-semibold text-[var(--mail-text-muted)] shadow-sm backdrop-blur-sm",children:"D\xe9mo interactive — z\xe9ro r\xe9tention"})}),e]})}},65378:(e,t,n)=>{"use strict";n.d(t,{Xi:()=>o,av:()=>c,j7:()=>l,tU:()=>s});var r=n(4208);n(91356);var a=n(32536),i=n(58113);function s({className:e,...t}){return(0,r.jsx)(a.bL,{"data-slot":"tabs",className:(0,i.cn)("flex flex-col gap-2",e),...t})}function l({className:e,...t}){return(0,r.jsx)(a.B8,{"data-slot":"tabs-list",className:(0,i.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function o({className:e,...t}){return(0,r.jsx)(a.l9,{"data-slot":"tabs-trigger",className:(0,i.cn)("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function c({className:e,...t}){return(0,r.jsx)(a.UC,{"data-slot":"tabs-content",className:(0,i.cn)("flex-1 outline-none",e),...t})}},72050:(e,t,n)=>{"use strict";n.d(t,{As:()=>a,B4:()=>h,J4:()=>u,Jw:()=>c,RW:()=>i,op:()=>o,r6:()=>s,v9:()=>d});let r=["normal","title","subtitle","heading1","heading2","heading3","heading4","heading5","heading6"];function a(e){return"paragraph"===e?"normal":e}function i(){return{definitions:{normal:{id:"normal",name:"Normal",scope:"document",blockType:"paragraph",fontFamily:"Arial, Helvetica, sans-serif",fontSizePx:11,lineHeight:1.15},title:{id:"title",name:"Titre",scope:"document",blockType:"paragraph",fontFamily:"Arial, Helvetica, sans-serif",fontSizePx:26,lineHeight:1.15},subtitle:{id:"subtitle",name:"Sous-titre",scope:"document",blockType:"paragraph",fontFamily:"Arial, Helvetica, sans-serif",fontSizePx:15,color:"#666666",lineHeight:1.15},heading1:{id:"heading1",name:"Titre 1",scope:"document",blockType:"heading",level:1,fontFamily:"Arial, Helvetica, sans-serif",fontSizePx:20,lineHeight:1.15},heading2:{id:"heading2",name:"Titre 2",scope:"document",blockType:"heading",level:2,fontFamily:"Arial, Helvetica, sans-serif",fontSizePx:16,lineHeight:1.15},heading3:{id:"heading3",name:"Titre 3",scope:"document",blockType:"heading",level:3,fontFamily:"Arial, Helvetica, sans-serif",fontSizePx:14,lineHeight:1.15},heading4:{id:"heading4",name:"Titre 4",scope:"document",blockType:"heading",level:4,fontFamily:"Arial, Helvetica, sans-serif",fontSizePx:12,bold:!0,lineHeight:1.15},heading5:{id:"heading5",name:"Titre 5",scope:"document",blockType:"heading",level:5,fontFamily:"Arial, Helvetica, sans-serif",fontSizePx:11,bold:!0,lineHeight:1.15},heading6:{id:"heading6",name:"Titre 6",scope:"document",blockType:"heading",level:6,fontFamily:"Arial, Helvetica, sans-serif",fontSizePx:11,italic:!0,lineHeight:1.15}}}}function s(){return{definitions:{}}}function l(e){return JSON.stringify({fontFamily:e.fontFamily??"",fontSizePx:e.fontSizePx??null,bold:e.bold??!1,italic:e.italic??!1,underline:e.underline??!1,color:e.color??"",textAlign:e.textAlign??"",lineHeight:e.lineHeight??null,blockType:e.blockType,level:e.level??null})}function o(e,t){return{definitions:{...i().definitions,...e?.definitions??{},...t?.definitions??{}}}}function c(e,t){let n={...i().definitions,...e.definitions},a=[];for(let e of r){let t=n[e];t&&a.push({definition:t,section:"document"})}for(let e of r){let r=t.definitions[e],i=n[e];r&&(i&&r?l(i)!==l(r):!!(i||r))&&a.push({definition:{...r,scope:"user"},section:"user"})}for(let e of Object.values(t.definitions))"user"===e.scope&&(r.includes(e.id)||a.push({definition:e,section:"user"}));return a}function d(e,t){let n=a(t);return e.definitions[n]??i().definitions[n]??null}function u(e){return e.styleId?a(e.styleId):e.isHeading&&e.headingLevel?`heading${e.headingLevel}`:"normal"}function h(e){let t=`custom-${"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10)}`,n=e.template??d(i(),e.basedOn??"normal");return{...n,id:t,name:e.name.trim()||"Style personnalis\xe9",scope:"user",basedOn:e.basedOn??n.id}}},75334:(e,t,n)=>{"use strict";function r(e,t){let n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}function a(e){let t=e.lastIndexOf("/"),n=t>=0?e.slice(t+1):e,r=n.lastIndexOf(".");return r>0?n.slice(0,r):n}function i(e,t){return`${a(e)}.${t}`}function s(e){return a(e)}n.d(t,{Ie:()=>i,Of:()=>s,WN:()=>r})},79535:(e,t,n)=>{"use strict";n.d(t,{Bm:()=>C,Di:()=>f,Fj:()=>i,Iy:()=>N,Oy:()=>c,PC:()=>g,PI:()=>w,R:()=>a,YM:()=>k,h7:()=>b,if:()=>o,kq:()=>v,m2:()=>r,mC:()=>l,z:()=>p});let r={graphicType:"image",src:null,alt:"",assetId:null,shapeType:"rect",fill:"#4285f4",stroke:"#1a73e8",strokeWidth:2,gradientCss:"",gradientType:"linear",gradientAngle:180,gradientColor1:"#4285f4",gradientColor2:"#34a853",width:240,height:160,placement:"block",wrap:"square",floatSide:"left",x:0,y:0,positionMode:"move-with-text",anchorPos:-1,pageIndex:0,pageX:0,pageY:0,wrapMarginMm:3,rotationDeg:0,zIndex:0,cropX:0,cropY:0,cropWidth:1,cropHeight:1,cropShape:"rect",lockAspectRatio:!0,imageFit:"contain",imageFitAnchorH:.5,imageFitAnchorV:.5,opacity:1,shadow:"",brightness:0,contrast:0,recolor:"",altTitle:"",drawScene:null,drawDriveFileId:null},a=[{id:"",label:"Aucune recolorisation",filter:""},{id:"grayscale",label:"Niveaux de gris",filter:"grayscale(1)"},{id:"sepia",label:"S\xe9pia",filter:"sepia(1)"},{id:"washout",label:"D\xe9lav\xe9",filter:"grayscale(0.4) brightness(1.4) saturate(0.6)"},{id:"negative",label:"N\xe9gatif",filter:"invert(1)"},{id:"blue-light",label:"Bleu clair",filter:"grayscale(1) sepia(1) hue-rotate(175deg) saturate(2.4) brightness(1.15)"},{id:"blue-dark",label:"Bleu fonc\xe9",filter:"grayscale(1) sepia(1) hue-rotate(185deg) saturate(3.2) brightness(0.75)"},{id:"teal",label:"Bleu canard",filter:"grayscale(1) sepia(1) hue-rotate(130deg) saturate(2.2)"},{id:"green",label:"Vert",filter:"grayscale(1) sepia(1) hue-rotate(60deg) saturate(2.4)"},{id:"yellow",label:"Jaune",filter:"grayscale(1) sepia(1) hue-rotate(10deg) saturate(2.8) brightness(1.1)"},{id:"orange",label:"Orange",filter:"grayscale(1) sepia(1) hue-rotate(-15deg) saturate(3)"},{id:"red",label:"Rouge",filter:"grayscale(1) sepia(1) hue-rotate(-45deg) saturate(3.4)"},{id:"purple",label:"Violet",filter:"grayscale(1) sepia(1) hue-rotate(220deg) saturate(2.4)"}];function i(e){let t=[],n=a.find(t=>t.id===e.recolor);return n?.filter&&t.push(n.filter),0!==e.brightness&&t.push(`brightness(${s(1+e.brightness,0,2)})`),0!==e.contrast&&t.push(`contrast(${s(1+e.contrast,0,2)})`),t.join(" ")}function s(e,t,n){return Math.min(n,Math.max(t,e))}let l={inline:"En ligne avec le texte",square:"Carr\xe9",tight:"Rapproch\xe9",through:"\xc0 travers","top-bottom":"Haut et bas",behind:"Derri\xe8re le texte","in-front":"Devant le texte"};function o(e,t,n,r="linear"){return"radial"===r?`radial-gradient(circle, ${t}, ${n})`:`linear-gradient(${e}deg, ${t}, ${n})`}function c(e){let t=(t,n)=>{let r=e[t];return"number"==typeof r&&Number.isFinite(r)?r:n},n=(t,n)=>{let r=e[t];return"string"==typeof r?r:n},a=t("gradientAngle",r.gradientAngle),i=n("gradientColor1",r.gradientColor1),s=n("gradientColor2",r.gradientColor2),l=n("gradientCss",""),c="radial"===e.gradientType||"linear"===e.gradientType?e.gradientType:l.includes("radial-gradient")?"radial":r.gradientType,m=l||("gradient"===e.graphicType?o(a,i,s,c):""),p="absolute"===e.placement||"behind"===e.wrap||"in-front"===e.wrap?"fixed-on-page":"fixed-on-page"===e.positionMode||"move-with-text"===e.positionMode?e.positionMode:r.positionMode,g=e.anchorPos,f="number"==typeof g&&Number.isFinite(g)?g:-1,x=t("x",0),b=t("y",0),y="number"==typeof e.pageX&&Number.isFinite(e.pageX)?e.pageX:null,j="number"==typeof e.pageY&&Number.isFinite(e.pageY)?e.pageY:null,v=null!=y&&0!==y||null!=j&&0!==j;return{graphicType:"shape"===e.graphicType||"gradient"===e.graphicType||"image"===e.graphicType||"draw"===e.graphicType?e.graphicType:r.graphicType,src:"string"==typeof e.src?e.src:null,alt:n("alt",""),shapeType:"ellipse"===e.shapeType||"line"===e.shapeType||"arrow"===e.shapeType||"rect"===e.shapeType?e.shapeType:r.shapeType,fill:n("fill",r.fill),stroke:n("stroke",r.stroke),strokeWidth:t("strokeWidth",r.strokeWidth),gradientCss:m,gradientType:c,gradientAngle:a,gradientColor1:i,gradientColor2:s,width:Math.max(24,t("width",r.width)),height:Math.max(24,t("height",r.height)),placement:"inline"===e.placement||"block"===e.placement||"absolute"===e.placement?e.placement:r.placement,wrap:"inline"===e.wrap||"square"===e.wrap||"tight"===e.wrap||"through"===e.wrap||"top-bottom"===e.wrap||"behind"===e.wrap||"in-front"===e.wrap?e.wrap:r.wrap,floatSide:"left"===e.floatSide||"right"===e.floatSide||"center"===e.floatSide?e.floatSide:r.floatSide,assetId:"string"==typeof e.assetId&&e.assetId?e.assetId:null,x:x,y:b,positionMode:p,anchorPos:f,pageIndex:Math.max(0,t("pageIndex",0)),pageX:v?y??0:x||(y??0),pageY:v?j??0:b||(j??0),wrapMarginMm:Math.max(0,t("wrapMarginMm",r.wrapMarginMm)),rotationDeg:t("rotationDeg",0),zIndex:t("zIndex",0),cropX:u(t("cropX",0)),cropY:u(t("cropY",0)),cropWidth:u(t("cropWidth",1),1),cropHeight:u(t("cropHeight",1),1),cropShape:"ellipse"===e.cropShape?"ellipse":"rect",lockAspectRatio:!1!==e.lockAspectRatio,imageFit:"cover"===e.imageFit||"crop"===e.imageFit?e.imageFit:"contain",imageFitAnchorH:h(e.imageFitAnchorH,r.imageFitAnchorH),imageFitAnchorV:h(e.imageFitAnchorV,r.imageFitAnchorV),opacity:u(t("opacity",1),1),shadow:n("shadow",""),brightness:d(t("brightness",0)),contrast:d(t("contrast",0)),recolor:n("recolor",""),altTitle:n("altTitle",""),drawScene:"string"==typeof e.drawScene&&e.drawScene?e.drawScene:null,drawDriveFileId:"string"==typeof e.drawDriveFileId&&e.drawDriveFileId?e.drawDriveFileId:null}}function d(e){return Number.isFinite(e)?Math.min(1,Math.max(-1,e)):0}function u(e,t=0){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):t}function h(e,t){return 0===e||.5===e||1===e?e:"number"==typeof e&&Number.isFinite(e)?e<=.25?0:e>=.75?1:.5:t}function m(e){return"cover"===e?"cover":"contain"}function p(e){return"crop"===e}function g(e){return{objectFit:m(e.imageFit),objectPosition:`${100*e.imageFitAnchorH}% ${100*e.imageFitAnchorV}%`}}function f(e){return e.cropX>0||e.cropY>0||e.cropWidth<1||e.cropHeight<1}function x(e,t,n,r,a="contain",i=.5,s=.5){if(e<=0||t<=0||n<=0||r<=0)return{left:0,top:0,width:Math.max(e,1),height:Math.max(t,1)};let l=e/t,o=n/r;if("cover"===a){if(o>l){let n=t*o;return{left:i*(e-n),top:0,width:n,height:t}}let n=e/o;return{left:0,top:s*(t-n),width:e,height:n}}if(o>l){let n=e/o;return{left:0,top:s*(t-n),width:e,height:n}}let c=t*o;return{left:i*(e-c),top:0,width:c,height:t}}function b(e,t,n,r){let a=t.cropX,i=t.cropY,s=t.cropWidth,l=t.cropHeight;if(e.includes("w")){let e=Math.max(-t.cropX,Math.min(t.cropWidth-.05,n));a=t.cropX+e,s=t.cropWidth-e}else e.includes("e")&&(s=Math.max(.05,Math.min(1-t.cropX,t.cropWidth+n)));if(e.includes("n")){let e=Math.max(-t.cropY,Math.min(t.cropHeight-.05,r));i=t.cropY+e,l=t.cropHeight-e}else e.includes("s")&&(l=Math.max(.05,Math.min(1-t.cropY,t.cropHeight+r)));return{cropX:y(a),cropY:y(i),cropWidth:y(s),cropHeight:y(l)}}function y(e){return Math.round(1e4*e)/1e4}function j(e,t,n,r,a){let i=t/(Math.max(e.cropWidth,.01)*r);return{left:-(e.cropX*r*i),top:-(e.cropY*a*i),width:r*i,height:a*i}}function v(e,t,n,r,a,i){if(i&&f(i)){let s=j(i,t,n,r,a);return{imageRect:s,windowRect:s,cropRect:{left:s.left+e.cropX*s.width,top:s.top+e.cropY*s.height,width:Math.max(1,e.cropWidth*s.width),height:Math.max(1,e.cropHeight*s.height)}}}let s="crop"===e.imageFit?"contain":e.imageFit,l=x(t,n,r,a,m(s),e.imageFitAnchorH,e.imageFitAnchorV),o=function(e,t,n,r,a){if("crop"===e.imageFit)return{left:0,top:0,width:t,height:n};let i=m(e.imageFit),s=x(t,n,r,a,i,e.imageFitAnchorH,e.imageFitAnchorV);return"cover"===i?{left:0,top:0,width:t,height:n}:s}({...e,imageFit:s},t,n,r,a);return{imageRect:l,windowRect:o,cropRect:{left:o.left+e.cropX*o.width,top:o.top+e.cropY*o.height,width:Math.max(1,e.cropWidth*o.width),height:Math.max(1,e.cropHeight*o.height)}}}function w(e,t,n,r,a){let i=j(e,t,n,r,a),s=Math.min(Math.max(-i.left/Math.max(i.width,1),0),1),l=Math.min(Math.max(-i.top/Math.max(i.height,1),0),1),o=Math.min(Math.max(t/Math.max(i.width,1),.05),1-s),c=Math.min(Math.max(n/Math.max(i.height,1),.05),1-l);return{cropX:y(s),cropY:y(l),cropWidth:y(o),cropHeight:y(c)}}function N(e,t,n,r,a,i){var s,l;let o,c,d,u,h,m,p,g,f,x,b={...e,...{cropX:y(Math.min(Math.max(e.cropX+t,0),Math.max(0,1-e.cropWidth))),cropY:y(Math.min(Math.max(e.cropY+n,0),Math.max(0,1-e.cropHeight)))}},j=v(b,e.width,e.height,r,a,i),w=(s=j.imageRect,o=(l=j.windowRect).left+b.cropX*l.width,c=l.top+b.cropY*l.height,d=Math.max(b.cropWidth*l.width,1),u=Math.max(b.cropHeight*l.height,1),h=(o-s.left)/Math.max(s.width,1),m=(c-s.top)/Math.max(s.height,1),p=d/Math.max(s.width,1),g=u/Math.max(s.height,1),f=Math.min(Math.max(h,0),1),x=Math.min(Math.max(m,0),1),{cropX:y(f),cropY:y(x),cropWidth:y(Math.min(Math.max(p,.05),1-f)),cropHeight:y(Math.min(Math.max(g,.05),1-x))});return{cropX:w.cropX,cropY:w.cropY,cropWidth:w.cropWidth,cropHeight:w.cropHeight,width:Math.max(24,Math.round(j.cropRect.width)),height:Math.max(24,Math.round(j.cropRect.height)),imageFit:"crop"}}function k(e,t,n,r,a){if(!f(e)||t<=0||n<=0||r<=0||a<=0)return{img:{}};let i=j(e,t,n,r,a);return{img:{position:"absolute",left:i.left,top:i.top,width:i.width,height:i.height,maxWidth:"none"},clipPath:"ellipse"===e.cropShape?"ellipse(50% 50% at 50% 50%)":void 0}}function C(e){let t="number"==typeof e.width?e.width:"string"==typeof e.width&&Number(e.width)||r.width,n="number"==typeof e.height?e.height:"string"==typeof e.height&&Number(e.height)||r.height;return c({graphicType:"image",src:e.src,alt:e.alt??"",width:t,height:n,placement:e.placement??"inline",wrap:e.wrap??"inline",floatSide:e.floatSide??"left",x:e.x??0,y:e.y??0,rotationDeg:e.rotationDeg??0,zIndex:e.zIndex??0,cropX:e.cropX??0,cropY:e.cropY??0,cropWidth:e.cropWidth??1,cropHeight:e.cropHeight??1,cropShape:e.cropShape??"rect",assetId:e.assetId??null,opacity:e.opacity??1,shadow:e.shadow??""})}},83119:(e,t,n)=>{"use strict";n.d(t,{Wb:()=>i,cQ:()=>l,iP:()=>a,jW:()=>s,sl:()=>r});let r=24,a=32,i=0,s=20,l=28},83631:()=>{},84417:(e,t,n)=>{"use strict";n.d(t,{C:()=>o,z:()=>l});var r=n(4208);n(91356);var a=n(99632),i=n(12837),s=n(58113);function l({className:e,...t}){return(0,r.jsx)(a.bL,{"data-slot":"radio-group",className:(0,s.cn)("grid gap-3",e),...t})}function o({className:e,...t}){return(0,r.jsx)(a.q7,{"data-slot":"radio-group-item",className:(0,s.cn)("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 cursor-pointer rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:(0,r.jsx)(a.C1,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:(0,r.jsx)(i.A,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}},85569:(e,t,n)=>{"use strict";n.d(t,{AM:()=>s,Wv:()=>l,hl:()=>o});var r=n(4208);n(91356);var a=n(80584),i=n(58113);function s({...e}){return(0,r.jsx)(a.bL,{"data-slot":"popover",...e})}function l({...e}){return(0,r.jsx)(a.l9,{"data-slot":"popover-trigger",...e})}function o({className:e,align:t="center",sideOffset:n=4,...s}){return(0,r.jsx)(a.ZL,{children:(0,r.jsx)(a.UC,{"data-slot":"popover-content",align:t,sideOffset:n,className:(0,i.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-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...s})})}},88553:(e,t,n)=>{Promise.resolve().then(n.bind(n,1057))},91060:(e,t,n)=>{"use strict";n.d(t,{h:()=>s});var r=n(94927),a=n(43996),i=n(7811);async function s(e,t){(0,a._K)();let n=e.file_id;if(n||(n=(await r.uE.get(`/drive/files/info${e.path.startsWith("/")?e.path:`/${e.path}`}`)).file_id),!n)throw Error("Identifiant du document introuvable");t.push((0,i.Pc)(n))}},95528:(e,t,n)=>{"use strict";n.d(t,{BM:()=>i,Tx:()=>s,p0:()=>o,qV:()=>l});let r="ultidocs:graphic-snap-guides",a=null;function i(){return a}function s(e){a=e,window.dispatchEvent(new CustomEvent(r,{detail:{state:e}}))}function l(){s(null)}function o(e){let t=()=>e();return window.addEventListener(r,t),()=>window.removeEventListener(r,t)}}},e=>{e.O(0,[1332,2276,6677,3445,5371,1909,2082,3616,798,9032,8306,5855,8023,5179,8992,5260,5814,6559,1729,579,9673,963,1807,3425,4498,7865,3639,7161,5143,7001,1614,1506,7358],()=>e(e.s=88553)),_N_E=e.O()}]);