@docx-editor.dev/react 2.7.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- 'use strict';var je=require('react'),editor=require('@docx-editor.dev/core/editor'),i18n=require('@docx-editor.dev/i18n'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom'),classVarianceAuthority=require('class-variance-authority'),clsx=require('clsx'),pe=require('@radix-ui/react-select'),editor$1=require('@docx-editor.dev/core/contracts/editor');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var je__namespace=/*#__PURE__*/_interopNamespace(je);var pe__namespace=/*#__PURE__*/_interopNamespace(pe);var Dc={version:"2.7.0"};var x0=Dc.version;var Nc="(prefers-color-scheme: dark)";function Lc(){return typeof window<"u"&&typeof window.matchMedia=="function"}function Hc(){return Lc()?window.matchMedia(Nc).matches:false}function Ac(e,t){return e==="dark"||e==="system"&&t}function Fc(e){if(!Lc())return ()=>{};let t=window.matchMedia(Nc);e(t.matches);let n=o=>e(o.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}var Li=je.createContext(null);function F(){return je.useContext(Li)}var rt=je.createContext(null);var Hi=je.createContext(i18n.en),Ai=je.createContext("en");function _o({i18n:e,children:t}){let n=je.useContext(Hi),o=je.useContext(Ai),r=typeof e?._lang=="string"?e._lang:o,i=je.useMemo(()=>i18n.deepMerge(n,e),[n,e]);return jsxRuntime.jsx(Ai.Provider,{value:r,children:jsxRuntime.jsx(Hi.Provider,{value:i,children:t})})}function _(){let e=je.useContext(Hi),t=je.useContext(Ai);return {t:je.useMemo(()=>i18n.createT(e,t),[e,t]),catalogue:e}}function Kc(e){let{t}=_();return je.useCallback((n,o)=>e?.get(n)??t(n,o),[e,t])}var Fi=0,Oi=false,Zi=false;function zc(){let e=globalThis.navigator?.scheduling;return typeof e?.isInputPending!="function"?false:e.isInputPending({includeContinuous:true})?true:(Oi||(Oi=true,Fi+=1,queueMicrotask(()=>{Oi=false;}),Zi||(Zi=true,setTimeout(()=>{Zi=false,Fi=0;},0))),Fi>16)}function Vc(e){let t=false;return ()=>{if(t)return;t=true;let n=()=>{t=false,e();};zc()?setTimeout(n,0):queueMicrotask(n);}}var R0=()=>{},qi=0;function I0(){return qi}function Ki(e){return Vc(e)}function B(e,t=Object.is,n){let o=F(),r=n?.onSubscribe,i=n?.onUnsubscribe,a=je.useCallback(d=>{if(!o)return R0;let u=false;qi++,r?.();let m=Ki(()=>{u||d();}),g=[o.on("change",m),o.on("selectionChange",m),o.on("error",m)];return ()=>{u=true,qi--,i?.();for(let p of g)p();}},[o,r,i]),l=je.useMemo(()=>{let d=false,u,m;return g=>{if(d&&g===u)return m;let p=e(g);return d&&t(m,p)?(u=g,m):(d=true,u=g,m=p,p)}},[o,e,t]),c=je.useCallback(()=>l(o?o.snapshot():editor.LOADING_SNAPSHOT),[o,l]),s=je.useCallback(()=>l(editor.LOADING_SNAPSHOT),[l]);return je.useSyncExternalStore(a,c,s)}var $c=12700,Wc=96;function N0(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function L0(e,t,n,o){let r=e*72/n,i=t*72/o;return {widthPoints:Math.max(1,Math.round(r*100)/100),heightPoints:Math.max(1,Math.round(i*100)/100)}}function Br(e){let t=editor.DEFAULT_IMAGE_RESOURCE_LIMITS;if(e.byteLength===0)return {ok:false,reasonKey:"imageInsert.errors.emptyFile"};if(e.byteLength>t.maxEncodedBytes)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let n=editor.sniffImageMime(e);if(!N0(n))return n==="image/svg+xml"||n==="image/tiff"?{ok:false,reasonKey:"imageInsert.errors.unsupportedFormat"}:{ok:false,reasonKey:"imageInsert.errors.invalidSignature"};let o=editor.validateRasterHeader(e,n);if(!o)return {ok:false,reasonKey:"imageInsert.errors.invalidSignature"};if(o.pixelWidth*o.pixelHeight>t.maxPixels||o.pixelWidth>t.maxDimension||o.pixelHeight>t.maxDimension)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let{widthPoints:i,heightPoints:a}=L0(o.pixelWidth,o.pixelHeight,Wc,Wc);return Object.freeze({ok:true,bytes:e,mime:n,widthPoints:i,heightPoints:a})}function kt(e){return Math.round(e/$c*100)/100}function gn(e){return Math.round(e*$c)}var jt=je.createContext({t:void 0,onSave:void 0});function A0(){return je.useContext(jt)}function qr(e){let{t}=_();return n=>e?.(n)??t(n)}function j(){let{t:e}=je.useContext(jt);return qr(e)}function K0(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function zi(e){return typeof e=="string"}function ne(e){let t=F(),{t:n}=_(),o=zi(e)?e:editor.editorCommandKey(e),r=je.useRef(e);r.current=e;let i=je.useCallback(c=>{let s=r.current;if(zi(s)){let u=editor.toolbarCommandState(t,s);return {active:u.active,enabled:u.enabled,disabledReason:i18n.localizeDisabledReason(u.disabledReason,n)}}if(!t)return {active:false,enabled:false,disabledReason:null};let d=t.can(s);return {active:t.isActive(s),enabled:d.ok,disabledReason:d.ok?null:i18n.localizeDisabledReason(d.reason??null,n)}},[t,o,n]),a=B(i,K0),l=je.useCallback(()=>{let c=r.current;return zi(c)?editor.runToolbarCommand(t,c).ok:t?t.exec(c).ok:false},[t,o]);return je.useMemo(()=>({execute:l,isActive:a.active,isEnabled:a.enabled,disabledReason:a.disabledReason}),[l,a])}function $0(e,t){return typeof t!="function"?e:typeof e!="function"?t:n=>{e(n),n.defaultPrevented||t(n);}}function U0(e,t){let n={...e,...t};for(let o of Object.keys(e))/^on[A-Z]/.test(o)?n[o]=$0(t[o],e[o]):o==="className"?n[o]=[e[o],t[o]].filter(Boolean).join(" "):o==="style"&&(n[o]={...e[o],...t[o]});return n}function $({children:e,...t}){let n=je.Children.only(e);if(!je.isValidElement(n))return null;let o=n.props,r=U0(t,o),i=n.ref,a=t.ref;return (i||a)&&(r.ref=l=>{for(let c of [i,a])typeof c=="function"?c(l):c&&typeof c=="object"&&(c.current=l);}),je.cloneElement(n,r)}function X(e){for(let t of editor.CHROME_GROUPS)for(let n of t.controls)if(editor.chromeSlotId(t,n)===e)return n;return null}function te(e){return e?jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:e.map(t=>jsxRuntime.jsx("path",{d:t,fill:"currentColor"},t))}):null}function O(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Xt(e){let{slot:t,icon:n,asChild:o,className:r,children:i,hidden:a}=e,{execute:l,isActive:c,isEnabled:s,disabledReason:d}=ne(t),u=j();if(a)return null;let m=X(t),g=u(m?.labelKey??t),p=editor.commandForSlot(t),f=p?.type==="toggleMark"||p?.type==="setAlignment",b={onClick:()=>l(),onMouseDown:O,disabled:!s,"data-slot":t,className:`docx-toolbar__button${r?` ${r}`:""}`,...c?{"data-active":""}:{},...s?{}:{"data-disabled":""},...f?{"aria-pressed":c}:{},"aria-label":g,title:d??g};return o?jsxRuntime.jsx($,{...b,children:i}):jsxRuntime.jsx("button",{type:"button",...b,children:n??i??te(m?.paths)})}Xt.docxToolbarPart=true;var og="image/png,image/jpeg,image/gif",Wi=je.createContext(null);function zr(){let e=je.useContext(Wi);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function $i(){return je.useContext(Wi)}function Vr({children:e}){let t=F(),{t:n}=_(),o=je.useRef(null),r=je.useRef(false),i=je.useCallback(()=>editor.toolbarCommandState(t,"image.insert"),[t]),a=B(i,(f,b)=>f.enabled===b.enabled&&f.disabledReason===b.disabledReason),l=a.enabled,c=i18n.localizeDisabledReason(a.disabledReason,n),s=je.useCallback(async f=>{if(!t||r.current)return;let b=Br(f);if(!b.ok){window.alert(n(b.reasonKey));return}let h={type:"insertImage",data:b.bytes,mime:b.mime,widthPoints:b.widthPoints,heightPoints:b.heightPoints},P=t.canExecuteImageCommand?.(h);if(P&&!P.ok){window.alert(P.reason??n("imageInsert.errors.refused"));return}r.current=true;try{let x=await editor.executeImageCommand(t,h);x.ok?t.focus():window.alert(x.reason??n("imageInsert.errors.refused"));}finally{r.current=false;}},[t,n]),d=je.useCallback(async f=>{let b=f?.[0];if(!b)return;let h=await b.arrayBuffer();await s(new Uint8Array(h));},[s]),u=je.useCallback(async f=>{if(!f)return;let b=[...f.files].find(h=>h.type.startsWith("image/"));if(b){await d([b]);return}for(let h of f.items){if(h.kind!=="file"||!h.type.startsWith("image/"))continue;let P=h.getAsFile();if(!P)continue;let x=await P.arrayBuffer();await s(new Uint8Array(x));return}},[s,d]),m=je.useCallback(()=>{l&&o.current?.click();},[l]),g=je.useCallback(async f=>{let b=f.currentTarget;await d(b.files),b.value="";},[d]),p=je.useMemo(()=>({openFilePicker:m,insertFromFileList:d,insertFromDataTransfer:u,isEnabled:l,disabledReason:c,inputRef:o,onInputChange:g}),[m,d,u,l,c,g]);return jsxRuntime.jsxs(Wi.Provider,{value:p,children:[jsxRuntime.jsx("input",{ref:o,type:"file",accept:og,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:g,onMouseDown:f=>f.stopPropagation()}),e]})}function Wr({className:e,hidden:t,asChild:n,children:o}){let{openFilePicker:r,isEnabled:i,disabledReason:a}=zr(),l=j();if(t)return null;let c=X("image.insert"),s=l(c?.labelKey??"toolbar.image"),d={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.insert",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":s,title:a??s,onMouseDown:O,onClick:r};return n?jsxRuntime.jsx($,{...d,children:o}):jsxRuntime.jsx("button",{...d,children:o??te(c?.paths)})}Wr.docxSlot="image.insert";var bn=Object.assign(Wr,{docxSlot:"image.insert"});var fg=["nw","n","ne","e","se","s","sw","w"],od=40,nd=12;function gg(e){return `imageOverlay.handle.${e}`}function bg(e){switch(e){case "nw":case "se":return "nwse-resize";case "ne":case "sw":return "nesw-resize";case "n":case "s":return "ns-resize";default:return "ew-resize"}}function hg(e){return {nw:{x:"0%",y:"0%"},n:{x:"50%",y:"0%"},ne:{x:"100%",y:"0%"},e:{x:"100%",y:"50%"},se:{x:"100%",y:"100%"},s:{x:"50%",y:"100%"},sw:{x:"0%",y:"100%"},w:{x:"0%",y:"50%"}}[e]}function vg(e,t){return e>0&&t>0?"se":e>0&&t<0?"ne":e<0&&t>0?"sw":e<0&&t<0?"nw":e>0?"e":e<0?"w":t>0?"s":"n"}function Ui({containerRef:e,portalRef:t,scrollPort:n}){let o=F(),{t:r}=_(),[i,a]=je.useState(null),[l,c]=je.useState(null),s=je.useRef(null);s.current=l;let d=je.useRef(null),u=je.useRef(null),m=je.useRef(null),g=je.useRef(null),p=je.useRef(null);je.useEffect(()=>{let v=e.current;if(!v)return;let y=T=>{let w=(T.target instanceof Element?T.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");g.current=w??null,w&&w===i?.id&&queueMicrotask(()=>m.current?.focus({preventScroll:true}));};return v.addEventListener("pointerdown",y,{capture:true}),()=>v.removeEventListener("pointerdown",y,{capture:true})},[e,i?.id]),je.useEffect(()=>{if(!o){a(null);return}let v=()=>{a(editor.selectedDrawingOverlayTargetOf(o.surface));},y=()=>{queueMicrotask(v);};v();let T=[o.on("change",y),o.on("selectionChange",v)];return ()=>{for(let M of T)M();}},[o]),je.useEffect(()=>{if(n){p.current=n;return}let v=e.current;if(!v||!o?.surface)return;let y=v.closest(".docx-editor__scroll-container");if(!y)return;let T=o.surface.overlayCoordinates();return p.current=editor.createImageOverlayScrollPort(y,T.paintScale),()=>{p.current=null;}},[e,o,n]);let f=je.useCallback(()=>{c(null),d.current=null;let v=u.current;if(u.current=null,v)try{v.releasePointerCapture(v._lastPointerId??0);}catch{}},[]),b=je.useCallback((v,y,T,M,w,E,D)=>{if(!o?.surface)return;let A=editor.captureImageMutationPreconditions(o);if(!A)return;let H=o.surface.publishedLayout();d.current=Object.freeze({x:M,y:w}),u.current=E,E._lastPointerId=D;try{E.setPointerCapture(D);}catch{}c({session:Object.freeze({drawingNodeId:T.id,startBounds:Object.freeze({x:T.x,y:T.y,width:T.width,height:T.height}),startWidthEmu:T.widthEmu,startHeightEmu:T.heightEmu,startPosition:T.position,anchorFrameOrigin:T.anchorFrameOrigin,transform:T.transform,mode:v,handle:y,preconditions:A,layoutRevision:H.revision,packageRevision:o.surface.session.packageRevision(),kind:T.kind}),bounds:T,accumulatedScrollPt:0}),m.current?.focus({preventScroll:true});},[o]),h=je.useCallback((v,y,T,M,w)=>{if(!o)return;if(editor.isStaleImageInteractionCommit(o,v)){f();return}v.mode==="resize"?o.exec({type:"setImageProperties",widthEmu:y,heightEmu:T,...w?.mode==="simple"?{horizontalEmu:w.horizontalEmu,verticalEmu:w.verticalEmu}:{},...w?.mode==="frame"?{...w.horizontalEmu!==void 0?{horizontalEmu:w.horizontalEmu}:{},...w.verticalEmu!==void 0?{verticalEmu:w.verticalEmu}:{}}:{}}):v.mode==="move"&&w&&o.exec({type:"setImagePosition",...w}),f();},[f,o]),P=je.useCallback(v=>{if(!o)return;let y=s.current?.bounds??editor.selectedDrawingOverlayTargetOf(o.surface);if(!y)return;if(s.current&&v.key==="Escape"){v.preventDefault(),v.stopPropagation(),f();return}if(s.current)return;let T=v.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(v.key==="Delete"||v.key==="Backspace"){v.preventDefault(),v.stopPropagation(),o.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(v.key))return;v.preventDefault(),v.stopPropagation();let M=v.key==="ArrowLeft"?-T:v.key==="ArrowRight"?T:0,w=v.key==="ArrowUp"?-T:v.key==="ArrowDown"?T:0;if(v.altKey){if(!y.canResize)return;let D=vg(M,w),A=editor.computeImageResizeResult({handle:D,startWidthEmu:y.widthEmu,startHeightEmu:y.heightEmu,startBounds:{x:y.x,y:y.y,width:y.width,height:y.height},startPosition:y.position,anchorFrameOrigin:y.anchorFrameOrigin,deltaXPt:M,deltaYPt:w,transform:y.transform,preserveAspect:editor.resizePreservesAspect(D,y.aspectLocked,v.shiftKey),kind:y.kind});o.exec({type:"setImageProperties",widthEmu:A.widthEmu,heightEmu:A.heightEmu,...A.position?.mode==="simple"?{horizontalEmu:A.position.horizontalEmu,verticalEmu:A.position.verticalEmu}:{},...A.position?.mode==="frame"?{...A.position.horizontalEmu!==void 0?{horizontalEmu:A.position.horizontalEmu}:{},...A.position.verticalEmu!==void 0?{verticalEmu:A.position.verticalEmu}:{}}:{}});return}if(y.kind!=="anchored"||!y.canMove||!y.position)return;let E=editor.computeMovedImagePosition(y.position,M,w);o.exec({type:"setImagePosition",...E});},[f,o]);je.useEffect(()=>{if(!l||!o?.surface)return;let v=o.surface.overlayCoordinates(),y=M=>{let w=s.current,E=d.current;if(!w||!E)return;let D=editor.cssPixelsToLayoutPoints(M.clientX-E.x,v.paintScale),A=editor.cssPixelsToLayoutPoints(M.clientY-E.y,v.paintScale);if(w.session.mode==="move"){let k=0,L=p.current,R=e.current?.closest(".docx-editor__scroll-container");if(L&&R){let z=R.getBoundingClientRect();M.clientY>z.bottom-od?k=nd:M.clientY<z.top+od&&(k=-nd),k!==0&&(k=L.scrollBy(k));}let I=w.accumulatedScrollPt+k;c({...w,accumulatedScrollPt:I,bounds:Object.freeze({...w.bounds,x:w.session.startBounds.x+D,y:w.session.startBounds.y+A+I})});return}if(!w.session.handle)return;let H=editor.computeImageResizeResult({handle:w.session.handle,startWidthEmu:w.session.startWidthEmu,startHeightEmu:w.session.startHeightEmu,startBounds:w.session.startBounds,startPosition:w.session.startPosition,anchorFrameOrigin:w.session.anchorFrameOrigin,deltaXPt:D,deltaYPt:A,transform:w.session.transform,preserveAspect:editor.resizePreservesAspect(w.session.handle,w.bounds.aspectLocked,M.shiftKey),kind:w.session.kind});c({...w,bounds:Object.freeze({...w.bounds,x:H.previewBounds.x,y:H.previewBounds.y,width:H.previewBounds.width,height:H.previewBounds.height,widthEmu:H.widthEmu,heightEmu:H.heightEmu})});},T=M=>{let w=s.current;if(w)if(M.type==="pointerup"){let E=editor.cssPixelsToLayoutPoints(M.clientX-(d.current?.x??M.clientX),v.paintScale),D=editor.cssPixelsToLayoutPoints(M.clientY-(d.current?.y??M.clientY),v.paintScale),A=editor.finalizeImageOverlayInteraction({session:w.session,deltaXPt:E,deltaYPt:D,accumulatedScrollPt:w.accumulatedScrollPt,aspectLocked:w.bounds.aspectLocked,shiftKey:M.shiftKey,anchorFrameOrigin:w.session.anchorFrameOrigin});h(w.session,A.widthEmu,A.heightEmu,A.previewBounds,A.position);}else f();};return window.addEventListener("pointermove",y),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",T),()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",T);}},[f,h,e,o,l]),je.useEffect(()=>{!i||g.current!==i.id||(g.current=null,m.current?.focus({preventScroll:true}));},[i]);let x=l?.bounds??i,C=je.useMemo(()=>{if(!o?.surface||!x)return null;let v=o.surface.publishedLayout(),y=o.surface.overlayCoordinates(),T=editor.overlayFrameToSheetCssPixels(v,{pageIndex:x.pageIndex,x:x.x,y:x.y,width:x.width,height:x.height},y),M=x.canResize,w=x.kind==="anchored"&&x.canMove;return jsxRuntime.jsxs("div",{ref:m,className:"docx-image-selection-overlay","data-drawing-node-id":x.id,tabIndex:0,onKeyDown:P,children:[jsxRuntime.jsx("div",{className:`docx-image-selection-overlay__frame${w?" docx-editor-one-surface__overlay-control":""}`,role:"group","aria-label":r("imageOverlay.selection"),style:{left:`${T.left}px`,top:`${T.top}px`,width:`${T.width}px`,height:`${T.height}px`,cursor:w?"move":"default"},onPointerDown:E=>{O(E),!(!w||!x.position)&&E.button===0&&(E.preventDefault(),E.stopPropagation(),b("move",null,x,E.clientX,E.clientY,E.currentTarget,E.pointerId));}}),M?fg.map(E=>{let D=hg(E);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(gg(E)),tabIndex:0,style:{left:`calc(${T.left}px + ${T.width}px * ${parseFloat(D.x)/100} - 5px)`,top:`calc(${T.top}px + ${T.height}px * ${parseFloat(D.y)/100} - 5px)`,cursor:bg(E)},onPointerDown:A=>{O(A),A.button===0&&(A.preventDefault(),A.stopPropagation(),b("resize",E,x,A.clientX,A.clientY,A.currentTarget,A.pointerId));}},E)}):null]})},[x,b,o,P,r]);return !C||!t.current?null:reactDom.createPortal(C,t.current)}function Yi(e){return [...e.items].some(t=>t.kind==="file"&&t.type.startsWith("image/"))}function Gr({className:e}){let t=F(),n=$i(),o=je.useRef(null),r=je.useRef(null);je.useLayoutEffect(()=>{let c=o.current;if(!(!t||!c))return t.attach(c),()=>{t.detach();}},[t]);let i=je.useCallback(c=>{if(!n?.isEnabled)return;let s=c.clipboardData;s&&Yi(s)&&(c.preventDefault(),n.insertFromDataTransfer(s));},[n]),a=je.useCallback(c=>{!n?.isEnabled||!Yi(c.dataTransfer)||c.preventDefault();},[n]),l=je.useCallback(c=>{n?.isEnabled&&Yi(c.dataTransfer)&&(c.preventDefault(),n.insertFromDataTransfer(c.dataTransfer));},[n]);return jsxRuntime.jsxs("div",{ref:r,className:"docx-content-mount",children:[jsxRuntime.jsx("div",{ref:o,className:`docx-paginated-surface${e?` ${e}`:""}`,onPaste:i,onDragOver:a,onDrop:l}),t?jsxRuntime.jsx(Ui,{containerRef:o,portalRef:r}):null]})}var Sg=e=>e.isLoading||e.isOpening===true;function ji({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}function Cg({when:e=false,overlay:t=false,className:n,style:o,children:r}){let i=B(Sg),{t:a}=_();if(!e&&!i)return null;let l=`docx-editor docx-editor__loading${t?" docx-editor__loading--overlay":""}${n?` ${n}`:""}`;return jsxRuntime.jsx("div",{className:l,style:o,role:"status","aria-live":"polite",children:r??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ji,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:a("loading.label")})]})})}var jr=Object.assign(Cg,{Spinner:ji});function ld(){let e=new Set,t=new Map,n=new Map,o=0,r=null,i=false;function a(){if(e.size===0&&t.size===0)return;if(t.size===0)return "kind";let m=Object.create(null),g=[...t].sort((p,f)=>(n.get(p[0])??0)-(n.get(f[0])??0));for(let[,{author:p,style:f}]of g)m[p]=f;return {authors:m,others:e.size>0?"kind":"author"}}let l=null,c=false;function s(m){if(m===void 0)return "none";if(typeof m=="string")return m;let g=Object.entries(m.authors).map(([p,f])=>`${p}\0${JSON.stringify(f)}`).sort();return `${m.others??"kind"}${g.join("")}`}function d(){if(!r)return;let m=a(),g=s(m);if(g!==l){if(m===void 0){i&&(r.setRevisionStyles("author"),i=false,l=g);return}r.setRevisionStyles(m),i=true,l=g;}}function u(){!r||c||(c=true,queueMicrotask(()=>{c=false,d();}));}return {registerScheme(m){e.add(m),u();},register(m,g,p){n.has(m)||n.set(m,o++),t.set(m,{author:g,style:p}),u();},unregister(m){(e.delete(m)||t.delete(m))&&u();},connect(m){r=m;let g=a();i=m!==null&&g!==void 0,l=m===null?null:s(g),u();},current:a}}var vn=je.createContext(null);function dd(){let e=je.useRef(null);return e.current===null&&(e.current=Symbol("revision-style-declaration")),e.current}function Xi(){let e=je.useContext(vn),t=dd();return je.useEffect(()=>{if(e)return e.registerScheme(t),()=>e.unregister(t)},[e,t]),null}function Qi(e){let{author:t,color:n,background:o,spanClassName:r,avatarUrl:i}=e,a=je.useContext(vn),l=dd();return je.useEffect(()=>{if(a)return a.register(l,t,{...n!==void 0?{color:n}:{},...o!==void 0?{background:o}:{},...r!==void 0?{spanClassName:r}:{},...i!==void 0?{avatarUrl:i}:{}}),()=>a.unregister(l)},[a,l,t,n,o,r,i]),null}function yn(e){return e.paragraphId===""}var Qt=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),Dg=e=>e;function Ng(){let e=n=>!!n&&(n.width>0||n.height>0);if(typeof document<"u"){let o=document.querySelector("[data-docx-caret]")?.getBoundingClientRect();if(e(o))return {left:o.left,top:o.bottom}}let t=typeof window>"u"?null:window.getSelection();if(t&&t.rangeCount>0){let n=t.getRangeAt(0),o=n.getBoundingClientRect();if(e(o))return {left:o.left,top:o.bottom};let r=n.startContainer,a=(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.getBoundingClientRect();if(e(a))return {left:a.left,top:a.bottom}}return null}var xn=je.createContext(null);function Ji(){let e=je.useContext(xn),t=Qr(e===null);return e??t}function Qr(e=true){let t=F(),[n,o]=je.useState(Qt),r=je.useRef(null),i=je.useRef(n);i.current=n;let a=B(Dg),l=t?t.can({type:"insertText",text:""}).ok:false,c=je.useCallback(()=>{let x=r.current;x&&(x.editor.releaseSelection(x.pin),r.current=null);},[]),s=je.useCallback((x,C)=>{c(),o({mode:x?"reading":"editing",link:x??null,anchor:C??null,text:x?.text??"",url:x?x.kind==="internal"?`#${x.anchor??""}`:x.authored:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,c]),d=je.useCallback(()=>{c(),o(Qt);},[c]);je.useEffect(()=>c,[c]);let u=je.useCallback(()=>{let x=Ng();c();let C=t?.surface?.hyperlinks.linkAtCaret()??t?.surface?.hyperlinks.fieldLinkAtCaret()??null;if(C&&yn(C)){s(C,x);return}if(C){o({mode:"editing",link:C,anchor:x,text:C.text,url:C.kind==="internal"?`#${C.anchor??""}`:C.authored,copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});return}let v=t?.query({type:"selectedText"})??"",y=t?.retainSelection()??null;t&&y&&(r.current={editor:t,pin:y}),o({mode:"editing",link:null,anchor:x,text:v,url:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,s,c]);je.useEffect(()=>{if(!(!t||!e))return t.setHyperlinkChrome({onPopover:x=>s(x.link,{left:x.rect.left,top:x.rect.bottom}),onRequest:u})},[t,e,s,u]),je.useEffect(()=>{let x=i.current;if(x.mode!=="reading"||!x.link)return;let C=yn(x.link)?t?.surface?.hyperlinks.fieldLinkAtCaret()??null:t?.surface?.hyperlinks.linkAtCaret()??null;C&&C.id===x.link.id||o(Qt);},[a,t]),je.useEffect(()=>{let x=i.current;if(x.mode!=="editing"||x.link)return;let C=t?.surface;!C||C.retainedSelection()||o(Qt);},[a,t]);let m=je.useCallback(async()=>{let x=i.current.link?.href;if(!x)return false;try{await navigator.clipboard.writeText(x);}catch{return false}return o(C=>({...C,copied:true})),true},[]),g=je.useCallback(()=>{o(x=>({...x,mode:"editing",copied:false,error:false}));},[]),p=je.useCallback(x=>{o(C=>({...C,text:x,copied:false,error:false}));},[]),f=je.useCallback(x=>{o(C=>({...C,url:x,copied:false,error:false}));},[]),b=je.useCallback(()=>{let x=i.current,C=t?.surface?.hyperlinks;if(!C)return false;let v=x.url.trim();if(v.length===0)return o(M=>({...M,error:true})),false;let y=v.startsWith("#");return C.applyHyperlink({...y?{anchor:v.slice(1)}:{url:v},...x.text.trim().length>0?{text:x.text}:{}})?(d(),true):(o(M=>({...M,error:true})),false)},[t,d]),h=je.useCallback(()=>{let x=t?.surface?.hyperlinks,C=i.current.link;if(!x)return false;let v=x.removeHyperlink(C?.id);return v&&d(),v},[t,d]),P=je.useCallback(()=>{let x=t?.surface?.navigation,C=i.current.link;if(!x||!C)return false;if(C.kind==="internal"){let y=C.anchor?x.goToBookmark(C.anchor):false;return y&&o(Qt),y}let v=x.openExternal(C.href);return v&&o(Qt),v},[t]);return je.useMemo(()=>({state:n.mode==="closed"?Qt:{...n,canEdit:l},open:s,openAtCaret:u,close:d,copy:m,beginEdit:g,setText:p,setUrl:f,commitEdit:b,unlink:h,openTarget:P}),[n,l,s,u,d,m,g,p,f,b,h,P])}var Be={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function Fg(e){return e==="sdtLocked"||e==="sdtContentLocked"}function Og(e){return e==="contentLocked"||e==="sdtContentLocked"}function tl(e,t){return !e.ok&&e.code===t}function mt(){let e=je.useContext(ol),t=Jr();return e??t}function Jr(){let e=F(),[t,n]=je.useState(false),[o,r]=je.useState(false),[i,a]=je.useState(false),l=B(T=>T),c=e?.surface??null,s=c?.contentControls;je.useEffect(()=>{r(s?.showAll()??c?.state().contentControls.showAll??false),a(s?.formFill()??c?.state().contentControls.formFill??false);},[l,s,c]);let d=je.useMemo(()=>{if(!e)return null;let T=s?.atCaret()??null;if(T){let R=s?.disabledReason(T.id,"edit")??null,I=s?.disabledReason(T.id,"remove")??null;return {id:T.id,tag:T.tag??null,alias:T.alias??null,controlType:T.controlType,locked:Og(T.effectiveLock)||R==="locked",removalLocked:Fg(T.effectiveLock)||I==="locked",placeholder:T.placeholder,bound:T.bound||R==="bound",effectiveLock:T.effectiveLock}}let M=e.query({type:"contentControlAt"});if(!M)return null;let w=s?.disabledReason(M.id,"edit")??null,E=s?.disabledReason(M.id,"remove")??null,D=e.can({type:"setContentControlValue",value:""}),A=e.can({type:"removeContentControl"}),H=M.locked===true||w==="locked"||tl(D,"locked"),k=w==="bound"||tl(D,"bound"),L=E==="locked"||tl(A,"locked");return {id:M.id,tag:M.tag??null,alias:M.alias??null,controlType:M.controlType,locked:H,removalLocked:L,placeholder:false,bound:k,effectiveLock:null}},[e,l,s]),u=je.useMemo(()=>e?e.query({type:"contentControls"}):[],[e,l]),m=je.useCallback(T=>{s?.setShowAll(T),r(T);},[s]),g=je.useCallback(T=>{s?.setFormFill(T),a(T);},[s]),p=je.useCallback(()=>m(!o),[m,o]),f=je.useCallback(()=>g(!i),[g,i]),b=je.useCallback(()=>n(true),[]),h=je.useCallback(()=>n(false),[]),P=je.useCallback(()=>n(T=>!T),[]),x=je.useMemo(()=>{if(!d)return "no content control at the current selection";if(s){let M=s.disabledReason(d.id,"edit");return M==="locked"?"the content control is locked":M==="bound"?"the content control is bound to external data":M==="notFound"?"the content control was not found":M}if(d.locked)return "the content control is locked";if(d.bound)return "the content control is bound to external data";if(!e)return "no document is loaded";let T=e.can({type:"setContentControlValue",value:""});return T.ok?null:T.reason},[d,s,e]),C=je.useMemo(()=>{if(!d)return "no content control at the current selection";if(s){let M=s.disabledReason(d.id,"remove");return M==="locked"?"the content control is locked":M==="notFound"?"the content control was not found":M}if(d.removalLocked)return "the content control is locked";if(!e)return "no document is loaded";let T=e.can({type:"removeContentControl"});return T.ok?null:T.reason},[d,s,e]),v=je.useCallback(T=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(s&&d){let M=s.disabledReason(d.id,"edit");if(M)return {ok:false,code:M==="bound"?"bound":M==="locked"?"locked":"notFound",reason:M==="bound"?"the content control is bound to external data":M==="locked"?"the content control is locked":"the content control was not found"}}return e.exec({type:"setContentControlValue",value:T})},[e,s,d]),y=je.useCallback(()=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(s){let T=d?.id;if(!T)return {ok:false,code:"notFound",reason:"no content control at the current selection"};let M=s.disabledReason(T,"remove");return M?{ok:false,code:M==="locked"?"locked":"notFound",reason:M==="locked"?"the content control is locked":"the content control was not found"}:s.remove(T)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:"the edit was refused"}}return e.exec({type:"removeContentControl"})},[e,s,d]);return je.useMemo(()=>({control:d,controls:u,showAll:o,formFill:i,inspectorOpen:t,canSetValue:x===null&&d!==null,canRemove:C===null&&d!==null,setValueDisabledReason:x,removeDisabledReason:C,setShowAll:m,toggleShowAll:p,setFormFill:g,toggleFormFill:f,openInspector:b,closeInspector:h,toggleInspector:P,remove:y,setValue:v}),[d,u,o,i,t,x,C,m,p,g,f,b,h,P,y,v])}var ol=je.createContext(null);function pd(){let e=0,t=0,n=null,o=new Set,r=new Set,i=new Set,a=l=>{for(let c of [...l])c();};return {getShift:()=>e,setShift(l){let c=Math.max(0,Math.round(l));c!==e&&(e=c,a(o));},subscribeShift(l){return o.add(l),()=>o.delete(l)},getReservation:()=>t,setReservation(l){let c=Math.max(0,Math.round(l));c!==t&&(t=c,a(r));},subscribeReservation(l){return r.add(l),()=>r.delete(l)},getViewport:()=>n,setViewport(l){l!==n&&(n=l,a(i));},subscribeViewport(l){return i.add(l),()=>i.delete(l)}}}var rl=je.createContext(null);function eo(){return je.useContext(rl)}var md=()=>0,al=()=>()=>{};function to(){let e=eo(),t=je.useCallback(o=>e?e.subscribeShift(o):al(),[e]),n=je.useCallback(()=>e?e.getShift():0,[e]);return je.useSyncExternalStore(t,n,md)}function fd(){let e=eo(),t=je.useCallback(o=>e?e.subscribeReservation(o):al(),[e]),n=je.useCallback(()=>e?e.getReservation():0,[e]);return je.useSyncExternalStore(t,n,md)}function St(){let e=eo(),t=je.useCallback(r=>e?e.subscribeViewport(r):al(),[e]),n=je.useCallback(()=>e?e.getViewport():null,[e]),o=je.useCallback(()=>null,[]);return je.useSyncExternalStore(t,n,o)}function Wg(e,t){if(e===t)return true;let n=editor.resolveZoomMode(e),o=editor.resolveZoomMode(t);return n!==null&&o!==null&&editor.sameZoomMode(n,o)}function $g(e){let t=je.useRef(e);t.current=e;let[n,o]=je.useState(null),{onReady:r,onChange:i,onFontError:a,...l}=e,c=je.useMemo(()=>({onReady:s=>{o(s),t.current.onReady?.(s);},onChange:s=>t.current.onChange?.(s),onFontError:s=>t.current.onFontError?.(s)}),[]);return {DocxEditorRoot:Pn,rootProps:l,rootListeners:c,editorRef:n}}function Pn(e){let{document:t,fonts:n,zoom:o,zoomMode:r,tableInteractionLabel:i,imageDecodePort:a,children:l}=e,{t:c}=_(),s=je.useCallback((v,y)=>c(v,y),[c]),d=je.useRef(e);d.current=e;let[u,m]=je.useState(null),g=je.useRef(null);g.current??=ld();let p=g.current;je.useEffect(()=>{let v=d.current,y=v.translate??s,T=p.current(),M=editor.createDocxEditor({...v.document!==void 0?{document:v.document}:{},...v.fonts?{fonts:v.fonts}:{},...v.author!==void 0?{author:v.author}:{},...v.locale!==void 0?{locale:v.locale}:{},translate:y,...v.mode!==void 0?{mode:v.mode}:{},...T!==void 0?{revisionStyles:T}:{},...v.modules!==void 0?{modules:v.modules}:{},...v.zoom!==void 0?{zoom:v.zoom}:{},...v.zoomMode!==void 0?{zoomMode:v.zoomMode}:{},...v.tableInteractionLabel?{tableInteractionLabel:v.tableInteractionLabel}:{},...v.imageDecodePort?{imageDecodePort:v.imageDecodePort}:{},onFontError:E=>d.current.onFontError?.(E)}),w=M.on("change",E=>d.current.onChange?.(E));return m(M),()=>{w(),M.destroy(),m(E=>E===M?null:E);}},[t,n,s,a,p]),je.useEffect(()=>{if(!u)return;if(!u.snapshot().isOpening){d.current.onReady?.(u);return}let v=u.on("change",()=>{v(),d.current.onReady?.(u);});return v},[u]);let f=je.useRef({editor:null,zoom:void 0,mode:void 0});je.useEffect(()=>{if(!u)return;f.current.editor!==u&&(f.current={editor:u,zoom:void 0,mode:void 0});let y=false;o!==void 0&&o!==f.current.zoom&&(f.current.zoom=o,u.setZoom(o),y=true);let T=f.current.mode,M=r!==void 0&&(T===void 0||!Wg(T,r)),w=r===void 0?null:editor.resolveZoomMode(r),E=y&&r!==void 0&&w!==null&&w.type==="fit";(M||E)&&(f.current.mode=r,u.setZoomMode(r));},[u,o,r]),je.useEffect(()=>{u&&u.setTableInteractionLabel(i??editor.defaultTableLabel);},[u,i]);let[b,h]=je.useState(0),P=je.useRef([]),x=je.useMemo(()=>({mounted:b,register:()=>(h(v=>v+1),()=>h(v=>Math.max(0,v-1))),registerCommentDraft:v=>(P.current.push(v),()=>{let y=P.current.indexOf(v);y!==-1&&P.current.splice(y,1);}),requestCommentDraft:()=>{let v=P.current.at(-1);return v?(v(),true):false}}),[b]),C=je.useMemo(pd,[]);return je.useEffect(()=>(p.connect(u),()=>p.connect(null)),[p,u]),jsxRuntime.jsx(rt.Provider,{value:x,children:jsxRuntime.jsx(Li.Provider,{value:u,children:jsxRuntime.jsx(rl.Provider,{value:C,children:jsxRuntime.jsx(vn.Provider,{value:p,children:jsxRuntime.jsx(Ug,{children:jsxRuntime.jsx(Gg,{children:jsxRuntime.jsx(Vr,{children:l})})})})})})})}function Ug({children:e}){let t=Qr(true);return jsxRuntime.jsx(xn.Provider,{value:t,children:e})}function Gg({children:e}){let t=Jr();return jsxRuntime.jsx(ol.Provider,{value:t,children:e})}function xe(e){return e/1440*96}function ea(e){return e/96*1440}function qe(e){return `${Math.round(e*100)/100}px`}function cl(e){return e/2}var ul=316,dl=44,Jg=24,ta={inlineStart:0,inlineEnd:ul},gd={inlineStart:dl,inlineEnd:dl},eb={inlineStart:0,inlineEnd:0};function vd({open:e,viewportWidth:t,pageWidthPx:n,inlineStartReservation:o=0,docked:r=false}){if(!e)return gd;if(r||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0)return ta;let i=Number.isFinite(o)&&o>0?o:0;return t-i-n-2*Jg>=ul?ta:gd}var tb=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,reviewPaneOpen:e.reviewPaneOpen??true,entitledZoom:t?.type==="fit"?t.maxZoom!==void 0&&t.maxZoom<editor.ZOOM_MAX?t.maxZoom:null:e.zoom}},ob=(e,t)=>e.reviewPaneOpen===t.reviewPaneOpen&&e.entitledZoom===t.entitledZoom&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function yd(){let e=St(),[t,n]=je.useState(null);return je.useEffect(()=>{if(!e){n(null);return}let o=()=>n(e.clientWidth);if(o(),typeof ResizeObserver>"u")return;let r=new ResizeObserver(o);return r.observe(e),()=>r.disconnect()},[e]),t}function Ho(){let e=je.useContext(rt),{pageSetup:t,reviewPaneOpen:n,entitledZoom:o}=B(tb,ob),r=St(),i=fd(),a=je.useRef(null);t&&(a.current=t.pageWidthTwips);let l=t?.pageWidthTwips??a.current,c=(e?.mounted??0)>0,s=je.useCallback(m=>c?vd({open:n,viewportWidth:m??0,pageWidthPx:l===null||o===null?0:xe(l)*o,inlineStartReservation:i,docked:o===null}):eb,[c,n,l,o,i]),[d,u]=je.useState(()=>s(r?r.clientWidth:null));return je.useEffect(()=>{let m=()=>u(s(r?r.clientWidth:null));if(m(),!r||typeof ResizeObserver>"u")return;let g=new ResizeObserver(m);return g.observe(r),()=>g.disconnect()},[r,s]),d}var oa=[.25,.5,.75,1,1.25,1.5,2];function En(e,t){return t==="in"?oa.find(o=>o>e+.001)??null:[...oa].reverse().find(o=>o<e-.001)??null}function xd(e,t){return e==="0"?1:e==="+"||e==="="?En(t,"in")??t:e==="-"?En(t,"out")??t:null}var oo=je.createContext(false);function Ye(){return je.useContext(oo)?"":"docx-editor "}var ib=e=>e.reviewPaneOpen??true,lb=e=>e.zoomMode?.type==="fit";function na({className:e,style:t,children:n}){let o=Ye(),r=F(),i=B(ib),a=Ho(),l=B(lb),s=(je.useContext(rt)?.mounted??0)>0,d=eo(),u=to(),m=je.useCallback(p=>d?.setViewport(p),[d]),g=je.useCallback(p=>{if(!r||!(p.metaKey||p.ctrlKey)||p.altKey)return;let f=p.target;if(f instanceof Element&&f.closest('input, textarea, select, [role="dialog"]'))return;let b=xd(p.key,r.getZoom());b!==null&&(p.preventDefault(),r.setZoom(b));},[r]);return jsxRuntime.jsx("div",{ref:m,"data-testid":"docx-editor-scroll",onKeyDownCapture:g,...s?{"data-review-pane":i?"open":"closed"}:{},...l?{"data-zoom-fit":""}:{},className:`${o}docx-editor-one-surface docx-editor-one-surface__viewport docx-editor__scroll-container${e?` ${e}`:""}`,style:{...t,"--docx-nav-shift":`${u}px`,...s?{"--docx-review-gutter":`${a.inlineEnd}px`,"--docx-review-gutter-start":`${a.inlineStart}px`}:{}},children:jsxRuntime.jsx(oo.Provider,{value:true,children:n})})}var cb=editor.LOADING_SNAPSHOT;function Cd({ref:e,editorRef:t}){je.useImperativeHandle(e,()=>({load:n=>t.current?.load(n),save:()=>t.current?.save()??Promise.resolve(null),getDocumentHandle:()=>t.current?.getDocumentHandle()??null,getEditor:()=>t.current,focus:()=>{t.current?.focus();},exec:(n,o)=>t.current?.exec(n,o)??{ok:false,code:"notFound",reason:"no editor is mounted"},snapshot:n=>t.current?.snapshot(n)??cb}),[t]);}var gb=e=>e.editingMode??"editing",ml=[{mode:"editing",labelKey:"editingMode.editing",hintKey:"editingMode.editingHint",path:"M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"},{mode:"suggesting",labelKey:"editingMode.suggesting",hintKey:"editingMode.suggestingHint",path:"M240-400h122l40-40H240v40Zm0-100h222l40-40H240v40Zm0-100h322l40-40H240v40ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v320h-80v-320H160v525l46-45h274v80H240L80-80Zm520-80v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T943-380L723-160H600Zm300-263-37-37 37 37ZM660-220h38l121-122-19-18-18-19-122 121v38Zm140-141-18-19 37 37-19-18Z"},{mode:"viewing",labelKey:"editingMode.viewing",hintKey:"editingMode.viewingHint",path:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Z"}],bb="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function aa({className:e,hidden:t}){let n=F(),o=B(gb),r=j(),{t:i}=_(),[a,l]=je.useState(false),c=je.useRef(null),s=je.useRef(null),d=je.useRef(null);je.useEffect(()=>{if(!a)return;let h=d.current?.querySelectorAll('[role="menuitemradio"]');(d.current?.querySelector('[aria-checked="true"]')??h?.[0]??void 0)?.focus();},[a]);let u=je.useCallback(h=>{let P=[...d.current?.querySelectorAll('[role="menuitemradio"]')??[]],x=P.indexOf(document.activeElement),C=v=>{h.preventDefault(),P[(v+P.length)%P.length]?.focus();};h.key==="ArrowDown"?C(x+1):h.key==="ArrowUp"?C(x-1):h.key==="Home"?C(0):h.key==="End"&&C(P.length-1);},[]);je.useEffect(()=>{if(!a)return;let h=x=>{let C=c.current;C&&x.target instanceof Node&&C.contains(x.target)||l(false);},P=x=>{x.key==="Escape"&&(x.preventDefault(),l(false));};return document.addEventListener("mousedown",h,true),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",h,true),document.removeEventListener("keydown",P);}},[a]);let m=je.useCallback(h=>{l(false),editor.runToolbarCommand(n,"review.editingMode",h),n?.focus();},[n]),g=editor.toolbarCommandState(n,"review.editingMode"),p=i18n.localizeDisabledReason(g.disabledReason,i),f=je.useMemo(()=>ml.find(h=>h.mode===o)??ml[0],[o]);if(t)return null;let b=X("review.editingMode");return jsxRuntime.jsxs("div",{ref:c,className:`docx-toolbar__mode${e?` ${e}`:""}`,"data-slot":"review.editingMode",children:[jsxRuntime.jsxs("button",{ref:s,type:"button",className:"docx-toolbar__picker","data-testid":"editing-mode-trigger","data-mode":o,"aria-haspopup":"menu","aria-expanded":a,"aria-label":r(b?.labelKey??"editingMode.label"),disabled:!g.enabled,...p?{title:p}:{},onMouseDown:O,onClick:()=>l(h=>!h),children:[fl(f.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:r(f.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),a?jsxRuntime.jsx("div",{ref:d,className:"docx-toolbar__mode-menu",role:"menu","aria-label":r(b?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:u,children:ml.map(h=>jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h.mode===o,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${h.mode}`,onMouseDown:O,onClick:()=>m(h.mode),children:[fl(h.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:r(h.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:r(h.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:h.mode===o?fl(bb):null})]},h.mode))}):null]})}aa.docxSlot="review.editingMode";function fl(e){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})})}function Ao(e,t){if(!je.isValidElement(e)||e.type!==je.Fragment)return null;let o=je.Children.toArray(e.props.children).map(t).filter(r=>r!==null);return o.length===1?o[0]:null}function la({entries:e,children:t,preset:n,keyOfEntry:o,keyOfChild:r,renderEntry:i}){if(!n)return t;let a=new Map,l=[];for(let u of je.Children.toArray(t)){let m=r(u);m?a.set(m,u):l.push(u);}let c=e.map((u,m)=>{let g=o(u,m),p=a.get(g);return p?jsxRuntime.jsx(je.Fragment,{children:p},g):jsxRuntime.jsx(je.Fragment,{children:i(u,m)},g)}),s=new Set(e.map(o)),d=[...a.entries()].filter(([u])=>!s.has(u)).map(([u,m])=>jsxRuntime.jsx(je.Fragment,{children:m},u));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,d,l]})}var xb=["zoom","script","format","list","alignment","styles","font","text","history"],bl=new Set(["review"]),hl=24,Rd=new Set;function Id(e,t=xb){let n=t.filter(r=>e.includes(r));return [...e.filter(r=>!t.includes(r)).reverse(),...n]}function Md(e,t){let{widths:n,groups:o,order:r,fixed:i,more:a}=e,l=i;for(let s of o)l+=n.get(s)??0;if(l<=t)return Rd;l+=a;let c=new Set;for(let s of r){if(l<=t)break;let d=n.get(s);d===void 0||c.has(s)||(c.add(s),l-=d);}return c}function kd(e,t){if(e===t)return true;if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}var _d=kd;function Dd(e){if(!(e.available>0))return Rd;let t=Md(e,e.available),n=e.previous;if(!n||n.size===0||t.size>=n.size)return t;let o=Md(e,e.available-(e.hysteresis));return kd(o,n)?n:o}function Nd(e,t,n,o){return e+t+n+o*2}function Ld(e,t){return e+t}function yl(e,t){return e+t}function Hd(e){let t=Number.parseFloat(e.marginInlineStart||e.marginLeft),n=Number.parseFloat(e.marginInlineEnd||e.marginRight);return {start:Number.isFinite(t)?t:0,end:Number.isFinite(n)?n:0}}function vl(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Ad(e){return vl(e.columnGap)}function Fd(e,t){return e.clientWidth-vl(t.paddingLeft)-vl(t.paddingRight)}var Mn="data-toolbar-group",Rn="data-toolbar-fixed",Tl="data-toolbar-more",Pb=34,xl=new Set;function Zd(e,t,n){let o=je.useRef(null),r=je.useRef(new Map),i=je.useRef(Pb),[a,l]=je.useState(xl),c=je.useRef(a);c.current=a;let s=je.useRef({groups:t,order:n});s.current={groups:t,order:n};let d=je.useCallback(()=>{let m=o.current;if(!m||!e)return;let g=getComputedStyle(m),p=Ad(g),f=Fd(m,g),b=m.querySelector(".docx-toolbar__separator"),h=p*2;if(b){let y=getComputedStyle(b),T=Hd(y);h=Nd(b.offsetWidth,T.start,T.end,p);}for(let y of m.querySelectorAll(`[${Mn}]`)){let T=y.getAttribute(Mn);T&&y.offsetWidth>0&&r.current.set(T,Ld(y.offsetWidth,h));}let P=0;for(let y of m.querySelectorAll(`[${Rn}]`))y.offsetWidth>0&&(P+=yl(y.offsetWidth,p));let x=m.querySelector(`[${Tl}]`);x&&x.offsetWidth>0&&(i.current=yl(x.offsetWidth,p));let C={available:f,widths:r.current,groups:s.current.groups,order:s.current.order,fixed:P,more:i.current,previous:c.current,hysteresis:hl},v=Dd(C);_d(v,c.current)||(c.current=v,l(v));},[e]),u=je.useCallback(m=>{o.current=m;},[]);return je.useLayoutEffect(()=>{if(!e){c.current.size>0&&(c.current=xl,l(xl));return}d();},[e,d]),je.useEffect(()=>{let m=o.current;if(!e||!m||typeof ResizeObserver>"u")return;let g=0,p=new ResizeObserver(()=>{g===0&&(g=requestAnimationFrame(()=>{g=0,d();}));});p.observe(m);for(let f of m.querySelectorAll(`[${Mn}], [${Rn}]`))p.observe(f);return ()=>{g!==0&&cancelAnimationFrame(g),p.disconnect();}},[e,d,a]),{attach:u,overflow:a}}var Db=["M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z"],qd=je.createContext({close:()=>{}});function Nb(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function Kd({label:e,children:t}){return jsxRuntime.jsxs("div",{className:"docx-toolbar__more-control",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-control-label",children:e}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-control-body",children:t})]})}function zd({slot:e}){let t=j(),{close:n}=je.useContext(qd),{execute:o,isActive:r,isEnabled:i,disabledReason:a}=ne(e),l=X(e),c=editor.commandForSlot(e),s=c?.type==="toggleMark"||c?.type==="setAlignment",d=t(l?.labelKey??e);return jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__more-command","data-slot":e,disabled:!i,...a?{title:a}:{},...s?{"aria-pressed":r}:{},...r?{"data-active":""}:{},onMouseDown:O,onClick:u=>{o(),n(u.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:te(l?.paths)}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:d})]})}function Vd({sections:e,className:t}){let n=j(),[o,r]=je.useState(false),i=je.useRef(null),a=je.useRef(null),l=je.useRef(null),c=je.useRef(false),s=je.useId(),d=n("formattingBar.more"),u=je.useCallback(p=>{r(false),p&&a.current?.focus();},[]),m=je.useMemo(()=>({close:u}),[u]);je.useEffect(()=>{if(!o)return;let p=f=>{let b=f.target;b instanceof Node&&i.current?.contains(b)||r(false);};return document.addEventListener("mousedown",p,true),()=>document.removeEventListener("mousedown",p,true)},[o]),je.useEffect(()=>{if(!o||!c.current)return;c.current=false;let p=l.current;p&&Nb(p);},[o]);let g=p=>{p.key!=="Escape"||p.defaultPrevented||(p.preventDefault(),u(true));};return jsxRuntime.jsxs("div",{ref:i,className:`docx-toolbar__more${t?` ${t}`:""}`,[Tl]:"",children:[jsxRuntime.jsx("button",{ref:a,type:"button",className:"docx-toolbar__button docx-toolbar__more-trigger","data-slot":"toolbar.more","aria-haspopup":"dialog","aria-expanded":o,"aria-controls":o?s:void 0,"aria-label":d,title:d,...o?{"data-active":""}:{},onMouseDown:O,onClick:()=>r(p=>!p),onKeyDown:p=>{p.key==="ArrowDown"&&(p.preventDefault(),c.current=true,r(true));},children:te(Db)}),o?jsxRuntime.jsx(qd.Provider,{value:m,children:jsxRuntime.jsx("div",{ref:l,id:s,role:"dialog","aria-label":d,className:"docx-toolbar__more-panel","data-testid":"toolbar-overflow-panel",onKeyDown:g,children:e.map(p=>jsxRuntime.jsxs("div",{className:"docx-toolbar__more-section",role:"group","aria-label":n(p.labelKey),children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-heading","aria-hidden":"true",children:n(p.labelKey)}),p.children]},p.id))})}):null]})}function Ob(e,t){return e.value===t.value&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function In(e){let t=F(),n=je.useRef(e);n.current=e;let o=je.useCallback(l=>{let c=n.current,s=editor.toolbarCommandState(t,c);return {value:s.value??null,enabled:s.enabled,disabledReason:s.disabledReason}},[t,e]),r=B(o,Ob),i=je.useMemo(()=>({execute:l=>editor.runToolbarCommand(t,"image.wrap",l),value:r.value??null,options:editor.IMAGE_WRAP_TARGETS,isEnabled:r.enabled,disabledReason:r.disabledReason}),[t,r]),a=je.useMemo(()=>({execute:l=>editor.runToolbarCommand(t,"image.altText",l),value:r.value,options:[],isEnabled:r.enabled,disabledReason:r.disabledReason}),[t,r]);return e==="image.wrap"?i:a}var Cl=[{value:"inline",labelKey:"imageWrap.menu.inLineWithText",iconName:"wrap_text"},{value:"square",labelKey:"imageWrap.square",iconName:"crop_square"},{value:"squareLeft",labelKey:"imageWrap.menu.squareLeft",iconName:"format_image_left"},{value:"squareRight",labelKey:"imageWrap.menu.squareRight",iconName:"format_image_right"},{value:"tight",labelKey:"imageWrap.tight",iconName:"wrap_text"},{value:"through",labelKey:"imageWrap.through",iconName:"wrap_text"},{value:"topAndBottom",labelKey:"imageWrap.topAndBottom",iconName:"vertical_align_center"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function ua({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),i=j(),{execute:a,value:l,isEnabled:c,disabledReason:s}=In("image.wrap"),[d,u]=je.useState(false),m=je.useRef(null),g=je.useRef(null),p=je.useRef(null),f=je.useId(),b=je.useMemo(()=>Cl.find(y=>y.value===l)??Cl[0],[l]),h=X("image.wrap"),P=i(h?.labelKey??"formattingBar.imageWrap");je.useEffect(()=>{if(!d)return;let y=M=>{let w=m.current;w&&M.target instanceof Node&&w.contains(M.target)||u(false);},T=M=>{M.key==="Escape"&&(M.preventDefault(),u(false),g.current?.focus());};return document.addEventListener("mousedown",y,true),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",y,true),document.removeEventListener("keydown",T);}},[d]);let x=je.useCallback(y=>{u(false),a(y);},[a]);if(t)return null;let C=r("imageWrap.tooltipPrefix",{label:r(b.labelKey)}),v={type:"button",ref:g,className:`docx-toolbar__button docx-toolbar__image-wrap-trigger${e?` ${e}`:""}`,"data-slot":"image.wrap",disabled:!c,...c?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?f:void 0,"aria-label":P,title:s??C,onMouseDown:O,onClick:()=>u(y=>!y)};return jsxRuntime.jsxs("div",{ref:m,className:"docx-toolbar__image-wrap",children:[n?jsxRuntime.jsx($,{...v,children:o}):jsxRuntime.jsx("button",{...v,children:o??te(h?.paths)}),d?jsxRuntime.jsx("div",{ref:p,id:f,role:"menu",className:"docx-toolbar__image-wrap-menu","aria-label":r("imageWrap.menu.ariaLabel"),onMouseDown:y=>y.stopPropagation(),children:Cl.map(y=>jsxRuntime.jsx("button",{type:"button",role:"menuitemradio",className:"docx-toolbar__image-wrap-item","aria-checked":l===y.value,...l===y.value?{"data-active":""}:{},onMouseDown:O,onClick:()=>x(y.value),children:r(y.labelKey)},y.value))}):null]})}ua.docxSlot="image.wrap";var kn=Object.assign(ua,{docxSlot:"image.wrap"});function pa({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),i=j(),{execute:a,value:l,isEnabled:c,disabledReason:s}=In("image.altText"),[d,u]=je.useState(false),[m,g]=je.useState(""),p=je.useRef(null),f=je.useRef(null),b=je.useId();je.useEffect(()=>{d&&g(l??"");},[d,l]),je.useEffect(()=>{if(!d)return;let v=T=>{let M=p.current;M&&T.target instanceof Node&&M.contains(T.target)||u(false);},y=T=>{T.key==="Escape"&&(T.preventDefault(),u(false),f.current?.focus());};return document.addEventListener("mousedown",v,true),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",v,true),document.removeEventListener("keydown",y);}},[d]);let h=je.useCallback(()=>{a(m),u(false);},[m,a]);if(t)return null;let P=X("image.altText"),x=i(P?.labelKey??"formattingBar.altText"),C={type:"button",ref:f,className:`docx-toolbar__button docx-toolbar__alt-text-trigger${e?` ${e}`:""}`,"data-slot":"image.altText",disabled:!c,...c?{}:{"data-disabled":""},"aria-haspopup":"dialog","aria-expanded":d,"aria-controls":d?b:void 0,"aria-label":x,title:s??x,onMouseDown:O,onClick:()=>u(v=>!v)};return jsxRuntime.jsxs("div",{ref:p,className:"docx-toolbar__alt-text",children:[n?jsxRuntime.jsx($,{...C,children:o}):jsxRuntime.jsx("button",{...C,children:o??x}),d?jsxRuntime.jsxs("div",{id:b,role:"dialog","aria-label":r("imageAltText.panelTitle"),className:"docx-toolbar__alt-text-panel",onMouseDown:v=>v.stopPropagation(),children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${b}-description`,children:r("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:`${b}-description`,className:"docx-dialog__textarea",value:m,onChange:v=>g(v.target.value),placeholder:r("dialogs.imageProperties.altTextPlaceholder")}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>u(false),children:r("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:h,children:r("common.apply")})]})]}):null]})}pa.docxSlot="image.altText";var _n=Object.assign(pa,{docxSlot:"image.altText"});var Qd=e=>e.image;function Xd(e){return Array.from(e.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(t=>t.offsetParent!==null||t===document.activeElement)}function Jb(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Rl(e){let t=e.position;return !t||e.kind!=="anchored"?{positionMode:"frame",horizontalPoints:"",verticalPoints:"",relativeToH:"page",relativeToV:"line"}:t.mode==="simple"?{positionMode:"simple",horizontalPoints:t.horizontalEmu!==void 0?String(kt(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(kt(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String(kt(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(kt(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function eh(e,t){let n=Rl(t);return e.horizontalPoints!==n.horizontalPoints||e.verticalPoints!==n.verticalPoints||e.relativeToH!==n.relativeToH||e.relativeToV!==n.relativeToV}function ma(e){if(e.trim()==="")return null;let t=Number(e);if(!Number.isFinite(t))return null;let n=gn(t);return Number.isInteger(n)?n:null}function th(e,t){let n=Rl(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let s=e.horizontalPoints!==n.horizontalPoints,d=e.verticalPoints!==n.verticalPoints,u=s?ma(e.horizontalPoints):t.position?.horizontalEmu,m=d?ma(e.verticalPoints):t.position?.verticalEmu;return s&&u===null?{ok:false}:d&&m===null?{ok:false}:u===void 0||m===void 0?{ok:false}:{ok:true,value:{horizontalEmu:u,verticalEmu:m}}}let o=e.horizontalPoints!==n.horizontalPoints,r=e.verticalPoints!==n.verticalPoints,i=e.relativeToH!==n.relativeToH,a=e.relativeToV!==n.relativeToV,l=o?ma(e.horizontalPoints):t.position?.horizontalEmu,c=r?ma(e.verticalPoints):t.position?.verticalEmu;return o&&l===null?{ok:false}:r&&c===null?{ok:false}:{ok:true,value:{...typeof l=="number"?{horizontalEmu:l}:{},...typeof c=="number"?{verticalEmu:c}:{},...i||o||r?{relativeToH:e.relativeToH}:{},...a||o||r?{relativeToV:e.relativeToV}:{}}}}function fa(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function ga(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function Il({open:e,onClose:t,className:n,triggerRef:o}){let r=F(),{t:i}=_(),a=B(Qd),l=je.useId(),c=je.useId(),s=je.useId(),d=je.useRef(null),u=je.useRef(null),m=je.useRef(null),g=je.useRef(null),[p,f]=je.useState(null),[b,h]=je.useState(null),P=u.current,x=P?.canCrop===false,C=P?.canResize===false,v=P?.locks.changeAspect===true,y=P?.kind==="anchored"&&P.canMove===true,T=P?.kind==="inline",M=P?.kind==="anchored"&&P.canMove===false;je.useEffect(()=>{if(!e){u.current=null,m.current=null,g.current=null;return}if(!a)return;if(u.current=a,r?.surface){let{anchor:z}=r.surface.state().selection;m.current={paragraphId:z.paragraphId,offset:z.offset},g.current=r.surface.session.packageRevision();}h(null);let R=Rl(a),I=a.crop;f({widthPoints:String(kt(a.widthEmu)),heightPoints:String(kt(a.heightEmu)),cropLeft:String(I.left),cropTop:String(I.top),cropRight:String(I.right),cropBottom:String(I.bottom),title:a.title,description:a.description,hyperlink:a.hyperlink??"",wrap:a.wrap,lockAspect:a.locks.changeAspect,...R});},[e,a?.id,a?.widthEmu,a?.heightEmu,r]);let w=je.useCallback(()=>{o?.current?.focus(),r?.focus();},[r,o]),E=je.useCallback(()=>{t(),w();},[t,w]);je.useEffect(()=>{if(!e)return;let R=d.current;if(!R)return;let I=Xd(R);(I.find(V=>V.id==="image-prop-width"&&!V.hasAttribute("disabled"))??I.find(V=>!V.hasAttribute("disabled"))??R).focus();let Z=V=>{if(V.key==="Escape"){V.preventDefault(),E();return}if(V.key!=="Tab")return;let Y=Xd(R);if(Y.length===0)return;let Re=document.activeElement,se=Y.findIndex(Pe=>Pe===Re);if(se===-1)return;V.preventDefault();let Se=V.shiftKey?(se-1+Y.length)%Y.length:(se+1)%Y.length;Y[Se]?.focus();};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[e,E]);let D=je.useMemo(()=>{let R=P??a;return !R||R.widthEmu<=0?1:R.widthEmu/R.heightEmu},[a,P]),A=je.useCallback(R=>{f(I=>{if(!I)return I;if(!I.lockAspect)return {...I,widthPoints:R};let z=ga(R);if(z===null)return {...I,widthPoints:R};let Z=Math.round(z/D*100)/100;return {...I,widthPoints:R,heightPoints:String(Z)}});},[D]),H=je.useCallback(R=>{f(I=>{if(!I)return I;if(!I.lockAspect)return {...I,heightPoints:R};let z=ga(R);if(z===null)return {...I,heightPoints:R};let Z=Math.round(z*D*100)/100;return {...I,widthPoints:String(Z),heightPoints:R}});},[D]),k=je.useCallback(()=>{let R=u.current;if(!R?.intrinsic)return;let I=R.intrinsic.pixelWidth*72/R.intrinsic.dpiX,z=R.intrinsic.pixelHeight*72/R.intrinsic.dpiY;f(Z=>Z&&{...Z,widthPoints:String(Math.round(I*100)/100),heightPoints:String(Math.round(z*100)/100)});},[a]),L=je.useCallback(()=>{let R=u.current,I=m.current,z=g.current;if(!r||!R||!p||!I||z===null)return;let Z={type:"setImageProperties",drawingNodeId:R.id,expectedPackageRevision:z,selectionParagraphId:I.paragraphId,selectionOffset:I.offset};if(!C){let Pe=ga(p.widthPoints),G=ga(p.heightPoints);if(Pe===null||G===null){h("imageProperties.errors.invalidDimensions");return}let q=gn(Pe),Ee=gn(G);q!==R.widthEmu&&(Z.widthEmu=q),Ee!==R.heightEmu&&(Z.heightEmu=Ee);}if(R.canCrop&&!x){let Pe=fa(p.cropLeft),G=fa(p.cropTop),q=fa(p.cropRight),Ee=fa(p.cropBottom);if(Pe===null||G===null||q===null||Ee===null){h("imageProperties.errors.invalidCrop");return}let Ue=R.crop;(Pe!==Ue.left||G!==Ue.top||q!==Ue.right||Ee!==Ue.bottom)&&(Z.crop={left:Pe,top:G,right:q,bottom:Ee});}p.title!==R.title&&(Z.title=p.title),p.description!==R.description&&(Z.description=p.description);let V=p.hyperlink.trim();if(V!==(R.hyperlink??"")&&(Z.hyperlink=V===""?null:V),R.canChangeWrap&&p.wrap!==R.wrap&&(Z.wrap=p.wrap),R.kind==="anchored"&&R.canMove&&eh(p,R)){let Pe=th(p,R);if(!Pe.ok){h("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(Pe.value,R))){h("imageProperties.errors.invalidPosition");return}Object.assign(Z,Pe.value);}if(!(Z.widthEmu!==void 0||Z.heightEmu!==void 0||Z.title!==void 0||Z.description!==void 0||Z.hyperlink!==void 0||Z.crop!==void 0||Z.wrap!==void 0||Z.horizontalEmu!==void 0||Z.verticalEmu!==void 0||Z.relativeToH!==void 0||Z.relativeToV!==void 0)){E();return}if(!r.can(Z).ok){h("imageProperties.errors.refused");return}if(!r.exec(Z).ok){h("imageProperties.errors.refused");return}E();},[r,p,x,C,E]);return !e||!p?null:jsxRuntime.jsx("div",{className:`docx-dialog-overlay${n?` ${n}`:""}`,onClick:E,onMouseDown:R=>{R.stopPropagation(),Jb(R);},children:jsxRuntime.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-labelledby":l,className:"docx-dialog docx-image-properties-dialog",onClick:R=>R.stopPropagation(),onMouseDown:R=>R.stopPropagation(),children:[jsxRuntime.jsx("div",{id:l,className:"docx-dialog__header",children:i("dialogs.imageProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-dialog__body",children:[b?jsxRuntime.jsx("p",{className:"docx-dialog__error",children:i(b)}):null,jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.dimensions")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-width",children:i("dialogs.imageProperties.widthLabel")}),jsxRuntime.jsx("input",{id:"image-prop-width",className:"docx-dialog__input",value:p.widthPoints,disabled:C,onChange:R=>A(R.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-height",children:i("dialogs.imageProperties.heightLabel")}),jsxRuntime.jsx("input",{id:"image-prop-height",className:"docx-dialog__input",value:p.heightPoints,disabled:C,onChange:R=>H(R.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:p.lockAspect,disabled:v,onChange:R=>f(I=>I&&{...I,lockAspect:R.target.checked})}),i("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:x||!P?.intrinsic,onClick:k,children:i("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.position")}),T?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionUnavailable")}):null,M?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionLocked")}):null,y?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[p.positionMode==="frame"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-h",children:i("imageProperties.relativeToHorizontal")}),jsxRuntime.jsx("select",{id:"image-pos-rel-h",className:"docx-dialog__select",value:p.relativeToH??"page",onChange:R=>f(I=>I&&{...I,relativeToH:R.target.value}),children:editor.DRAWING_REL_FROM_H.map(R=>jsxRuntime.jsx("option",{value:R,children:i(`dialogs.imagePosition.relativeOptions.${R}`)},R))})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-v",children:i("imageProperties.relativeToVertical")}),jsxRuntime.jsx("select",{id:"image-pos-rel-v",className:"docx-dialog__select",value:p.relativeToV??"line",onChange:R=>f(I=>I&&{...I,relativeToV:R.target.value}),children:editor.DRAWING_REL_FROM_V.map(R=>jsxRuntime.jsx("option",{value:R,children:i(`dialogs.imagePosition.relativeOptions.${R}`)},R))})]})]}):null,jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-h",children:i("imageProperties.horizontalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-h",className:"docx-dialog__input",value:p.horizontalPoints,onChange:R=>f(I=>I&&{...I,horizontalPoints:R.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-v",children:i("imageProperties.verticalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-v",className:"docx-dialog__input",value:p.verticalPoints,onChange:R=>f(I=>I&&{...I,verticalPoints:R.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]})]}):null]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.altText")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-title",children:i("imageAltText.title")}),jsxRuntime.jsx("input",{id:"image-prop-title",className:"docx-dialog__input",value:p.title,onChange:R=>f(I=>I&&{...I,title:R.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-description",children:i("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:"image-prop-description",className:"docx-dialog__textarea",value:p.description,onChange:R=>f(I=>I&&{...I,description:R.target.value}),placeholder:i("dialogs.imageProperties.altTextPlaceholder")})]})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.hyperlink")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:s,children:i("hyperlinkPopup.urlLabel")}),jsxRuntime.jsx("input",{id:s,className:"docx-dialog__input docx-dialog__input--full",value:p.hyperlink,onChange:R=>f(I=>I&&{...I,hyperlink:R.target.value}),placeholder:i("hyperlinkPopup.urlPlaceholder")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.textWrapping")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:c,children:i("formattingBar.imageWrap")}),jsxRuntime.jsx("select",{id:c,className:"docx-dialog__select docx-dialog__input--full",value:p.wrap,disabled:P?.canChangeWrap===false,onChange:R=>f(I=>I&&{...I,wrap:R.target.value}),children:editor.IMAGE_WRAP_TARGETS.map(R=>jsxRuntime.jsx("option",{value:R,children:i(`imageWrap.targets.${R}`)},R))})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.crop")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-left",children:i("imageProperties.cropLeft")}),jsxRuntime.jsx("input",{id:"image-crop-left",className:"docx-dialog__input",disabled:x,value:p.cropLeft,onChange:R=>f(I=>I&&{...I,cropLeft:R.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-top",children:i("imageProperties.cropTop")}),jsxRuntime.jsx("input",{id:"image-crop-top",className:"docx-dialog__input",disabled:x,value:p.cropTop,onChange:R=>f(I=>I&&{...I,cropTop:R.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-right",children:i("imageProperties.cropRight")}),jsxRuntime.jsx("input",{id:"image-crop-right",className:"docx-dialog__input",disabled:x,value:p.cropRight,onChange:R=>f(I=>I&&{...I,cropRight:R.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-bottom",children:i("imageProperties.cropBottom")}),jsxRuntime.jsx("input",{id:"image-crop-bottom",className:"docx-dialog__input",disabled:x,value:p.cropBottom,onChange:R=>f(I=>I&&{...I,cropBottom:R.target.value})})]}),x?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.nonPictureHint")}):null]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:E,children:i("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:L,children:i("common.apply")})]})]})})}function ba({className:e,hidden:t,asChild:n,children:o}){let r=F(),{t:i}=_(),a=B(Qd),[l,c]=je.useState(false),s=je.useRef(null),d={type:"setImageProperties",description:"probe"},u=r&&a?r.can(d):null,m=u?.ok===true,g=u&&!u.ok?u.reason:null;if(t)return null;let p=X("image.properties"),f={type:"button",ref:s,className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.properties",disabled:!m,...m?{}:{"data-disabled":""},"aria-label":i("formattingBar.imagePropertiesShortcut"),title:g??i("formattingBar.imagePropertiesShortcut"),onMouseDown:O,onClick:()=>c(true)};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n?jsxRuntime.jsx($,{...f,children:o}):jsxRuntime.jsx("button",{...f,children:o??te(p?.paths)}),jsxRuntime.jsx(Il,{open:l,onClose:()=>c(false),triggerRef:s})]})}ba.docxSlot="image.properties";var Zo=Object.assign(ba,{docxSlot:"image.properties"});function we(e){return Object.assign(n=>jsxRuntime.jsx(Xt,{slot:e,...n}),{docxSlot:e})}var Jd=we("history.undo"),eu=we("history.redo"),tu=we("text.bold"),ou=we("text.italic"),nu=we("text.underline"),ru=we("text.strike"),au=we("format.clear"),iu=we("script.super"),lu=we("script.sub"),su=we("alignment.left"),cu=we("alignment.center"),du=we("alignment.right"),uu=we("alignment.justify"),pu=we("list.bullet"),mu=we("list.numbered"),fu=we("list.outdent"),gu=we("list.indent");var bu=we("table.insert"),hu=we("review.comments");function ah({className:e,hidden:t,icon:n,asChild:o,children:r}){let i=F(),{openAtCaret:a}=Ji(),l=editor.chromeProbeForSlot("text.link"),c=i&&l?i.can(l):null,s=c?.ok===true,{t:d}=_(),u=i18n.localizeDisabledReason(c&&!c.ok?c.reason:null,d),m=j();if(t)return null;let g=X("text.link"),p=m(g?.labelKey??"text.link"),f={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"text.link",disabled:!s,...s?{}:{"data-disabled":""},"aria-label":p,title:u??p,onMouseDown:O,onClick:()=>a()};return o?jsxRuntime.jsx($,{...f,children:r}):jsxRuntime.jsx("button",{...f,children:n??r??te(g?.paths)})}var kl=Object.assign(ah,{docxSlot:"text.link"});function ih({className:e,hidden:t}){let n=F(),{onSave:o}=je.useContext(jt),r=j();if(t)return null;let i=X("file.save"),a=r(i?.labelKey??"file.save"),l=!n||!o;return jsxRuntime.jsx("button",{type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"file.save",disabled:l,...l?{"data-disabled":""}:{},"aria-label":a,title:a,onMouseDown:O,onClick:()=>o?.(),children:te(i?.paths)})}var _l=Object.assign(ih,{docxSlot:"file.save"});function Bo({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}function qo(e){let t=e?.closest(".docx-editor")??null;for(;t&&!t.querySelector(".docx-pages");)t=t.parentElement?.closest(".docx-editor")??null;return t}var ch=e=>({zoom:e.zoom,mode:e.zoomMode}),dh=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,yu={type:"fixed"};function Dl(){let e=F(),{zoom:t,mode:n}=B(ch,dh),o=je.useCallback(i=>{e?.setZoom(i);},[e]),r=je.useCallback(i=>{e?.setZoomMode(i);},[e]);return je.useMemo(()=>{let i=n??yu,a=En(t,"out"),l=En(t,"in");return {zoom:t,mode:i,isFit:i.type==="fit",setZoom:o,setMode:r,fitToWidth:()=>r(editor.FIT_WIDTH_ZOOM_MODE),auto:()=>r("auto"),reset:()=>{r(yu),o(1);},zoomIn:()=>l!==null&&o(l),zoomOut:()=>a!==null&&o(a),canZoomIn:!!e&&l!==null,canZoomOut:!!e&&a!==null,levels:oa}},[e,t,n,o,r])}var Hn=2,An=3276,Ln=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],mh=e=>e.formatting?.fontSizePt??null;function Su(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Cu(e,t,n){for(let o=t.length-1;o>=0;o-=1)if(t[o]<e)return t[o];return Math.max(e-1,n)}function Eu(e){return jsxRuntime.jsxs("span",{className:`docx-toolbar__stepper${e.className?` ${e.className}`:""}`,...e.slot!==void 0?{"data-slot":e.slot}:{},role:"group","aria-label":e.groupLabel,title:e.title??e.groupLabel,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canDecrease,"aria-label":e.decreaseLabel,onMouseDown:O,onClick:e.onDecrease,children:"\u2212"}),e.middle,jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canIncrease,"aria-label":e.increaseLabel,onMouseDown:O,onClick:e.onIncrease,children:"+"})]})}function fh(e){let t=e.trim().replace(/pt$/i,"").trim();if(t==="")return null;let n=Number(t);if(!Number.isFinite(n))return null;let o=Math.round(n*2);return o<Hn||o>An?null:o}function gh({className:e,hidden:t}){let n=F(),o=B(mh),{isEnabled:r,disabledReason:i}=ne("font.size"),a=j(),[l,c]=je.useState(false),[s,d]=je.useState(null),u=je.useRef(null),m=je.useRef(null),g=je.useCallback(v=>{if(!n)return;let y=editor.commandForSlotValue("font.size",v);y&&n.can(y).ok&&n.exec(y);},[n]),p=je.useCallback(v=>{g(Math.min(An,Math.max(Hn,Math.round(v*2))));},[g]),f=je.useCallback(v=>{c(false),d(null),m.current?.blur(),v&&bh(u.current);},[]);if(je.useEffect(()=>{if(!l)return;let v=y=>{let T=u.current;T&&y.target instanceof Node&&T.contains(y.target)||(c(false),d(null));};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[l]),t)return null;let b=r&&o!==null,h=o===null?"\u2014":String(Math.round(o*2)/2),P=s??h,x=o===null?null:Math.round(o*2)/2,C=()=>{if(s===null)return;let v=fh(s);v!==null&&g(v);};return jsxRuntime.jsxs("span",{ref:u,className:"docx-toolbar__font-size","data-slot":"font.size",title:i??void 0,children:[jsxRuntime.jsx(Eu,{className:e,groupLabel:a("fontSize.label"),decreaseLabel:a("fontSize.decrease"),increaseLabel:a("fontSize.increase"),middle:jsxRuntime.jsx("input",{ref:m,type:"text",inputMode:"decimal",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--boxed docx-toolbar__font-size-input",value:P,disabled:!r,role:"combobox","aria-expanded":l,"aria-haspopup":"listbox","aria-label":a("fontSize.label"),autoComplete:"off",onChange:v=>{d(v.target.value),c(true);},onFocus:v=>{v.target.select(),c(true);},onClick:()=>c(true),onKeyDown:v=>{v.key==="Enter"?(v.preventDefault(),C(),f(true)):v.key==="Escape"?(v.preventDefault(),f(true)):(v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),c(true),o!==null&&p(v.key==="ArrowDown"?Cu(o,Ln,Hn/2):Su(o,Ln,An/2)));},onBlur:()=>{C(),d(null);}}),canDecrease:b&&Math.round(o*2)>Hn,canIncrease:b&&Math.round(o*2)<An,onDecrease:()=>p(Cu(o??0,Ln,Hn/2)),onIncrease:()=>p(Su(o??0,Ln,An/2))}),l&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox","aria-label":a("fontSize.listLabel"),children:Ln.map(v=>{let y=x===v;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":y,...y?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>{p(v),f(true);},children:v},v)})}):null]})}function bh(e){(qo(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}var Hl=Object.assign(gh,{docxSlot:"font.size"});function hh({className:e,hidden:t}){let n=F(),{zoom:o,isFit:r,mode:i,setZoom:a,setMode:l,zoomIn:c,zoomOut:s,canZoomIn:d,canZoomOut:u,levels:m}=Dl(),g=j(),[p,f]=je.useState(false),b=je.useRef(null);je.useEffect(()=>{if(!p)return;let y=T=>{let M=b.current;M&&T.target instanceof Node&&M.contains(T.target)||f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[p]);let h=je.useCallback(y=>{f(false),a(y);},[a]),P=je.useCallback(y=>{f(false),l(y==="auto"?"auto":editor.FIT_WIDTH_ZOOM_MODE);},[l]);if(t)return null;let x=`${Math.round(o*100)}%`,C=editor.sameZoomMode(i,editor.AUTO_ZOOM_MODE),v=editor.sameZoomMode(i,editor.FIT_WIDTH_ZOOM_MODE);return jsxRuntime.jsxs("span",{ref:b,className:"docx-toolbar__zoom","data-slot":"zoom.level",children:[jsxRuntime.jsx(Eu,{className:e,groupLabel:g("zoom.zoomLevel"),decreaseLabel:g("zoom.zoomOut"),increaseLabel:g("zoom.zoomIn"),middle:jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--menu",disabled:!n,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":g("zoom.zoomLevel"),onMouseDown:O,onClick:()=>f(y=>!y),children:[x,jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),canDecrease:u,canIncrease:d,onDecrease:s,onIncrease:c}),p?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__zoom-menu",role:"listbox","aria-label":g("zoom.zoomLevel"),children:[jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":C,...C?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>P("auto"),children:g("zoom.automatic")}),jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":v,...v?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>P("fit-width"),children:g("zoom.fitWidth")}),jsxRuntime.jsx("hr",{className:"docx-toolbar__menu-separator",role:"presentation"}),m.map(y=>{let T=!r&&Math.abs(y-o)<.001;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":T,...T?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>h(y),children:`${Math.round(y*100)}%`},y)})]}):null]})}var Al=Object.assign(hh,{docxSlot:"zoom.level"});var Sh=[1,1.15,1.5,2,2.5,3],Mu=10,Ru=0,Ch=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),Ph=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function Eh({className:e,hidden:t}){let n=F(),o=B(Ch,Ph),{isEnabled:r,disabledReason:i}=ne("list.lineSpacing"),a=j(),[l,c]=je.useState(false),s=je.useRef(null);je.useEffect(()=>{if(!l)return;let b=h=>{let P=s.current;P&&h.target instanceof Node&&P.contains(h.target)||c(false);};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]);let d=je.useCallback(b=>{if(c(false),!n)return;let h=editor.commandForSlotValue("list.lineSpacing",b);h&&n.can(h).ok&&n.exec(h);},[n]),u=je.useCallback((b,h)=>{if(c(false),!n)return;let P={type:"setParagraphSpacing",[b]:h};n.can(P).ok&&n.exec(P);},[n]);if(t)return null;let m=X("list.lineSpacing"),g=(o.spaceBeforePt??0)>0,p=(o.spaceAfterPt??0)>0,f=o.lineSpacing?.rule==="multiple"?o.lineSpacing?.value??null:null;return jsxRuntime.jsxs("span",{ref:s,className:"docx-toolbar__line-spacing","data-slot":"list.lineSpacing",children:[jsxRuntime.jsxs("button",{type:"button",className:`docx-toolbar__button docx-toolbar__line-spacing-trigger${e?` ${e}`:""}`,disabled:!r,...r?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":l,"aria-label":a("lineSpacing.label"),title:i??a("lineSpacing.label"),onMouseDown:O,onClick:()=>c(b=>!b),children:[te(m?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),l&&r?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__line-spacing-menu",role:"menu",children:[Sh.map(b=>{let h=f===b;return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":h,...h?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>d(b),children:Number.isInteger(b*10)?b.toFixed(1):b.toFixed(2)},b)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>u("beforePt",g?Ru:Mu),children:a(g?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>u("afterPt",p?Ru:Mu),children:a(p?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var Ol=Object.assign(Eh,{docxSlot:"list.lineSpacing"});var _h=[{value:"C00000",labelKey:"colorPicker.colors.darkRed",css:"#c00000"},{value:"FF0000",labelKey:"colorPicker.colors.red",css:"#ff0000"},{value:"FFC000",labelKey:"colorPicker.colors.orange",css:"#ffc000"},{value:"FFFF00",labelKey:"colorPicker.colors.yellow",css:"#ffff00"},{value:"92D050",labelKey:"colorPicker.colors.lightGreen",css:"#92d050"},{value:"00B050",labelKey:"colorPicker.colors.green",css:"#00b050"},{value:"00B0F0",labelKey:"colorPicker.colors.lightBlue",css:"#00b0f0"},{value:"0070C0",labelKey:"colorPicker.colors.blue",css:"#0070c0"},{value:"002060",labelKey:"colorPicker.colors.darkBlue",css:"#002060"},{value:"7030A0",labelKey:"colorPicker.colors.purple",css:"#7030a0"}],Iu=[{value:"yellow",labelKey:"colorPicker.colors.yellow",css:"#ffff00"},{value:"green",labelKey:"colorPicker.colors.brightGreen",css:"#00ff00"},{value:"cyan",labelKey:"colorPicker.colors.cyan",css:"#00ffff"},{value:"magenta",labelKey:"colorPicker.colors.magenta",css:"#ff00ff"},{value:"blue",labelKey:"colorPicker.colors.blue",css:"#0000ff"},{value:"red",labelKey:"colorPicker.colors.red",css:"#ff0000"},{value:"darkBlue",labelKey:"colorPicker.colors.darkBlue",css:"#000080"},{value:"darkCyan",labelKey:"colorPicker.colors.darkCyan",css:"#008080"},{value:"darkGreen",labelKey:"colorPicker.colors.darkGreen",css:"#008000"},{value:"darkMagenta",labelKey:"colorPicker.colors.darkMagenta",css:"#800080"},{value:"darkRed",labelKey:"colorPicker.colors.darkRed",css:"#800000"},{value:"darkYellow",labelKey:"colorPicker.colors.darkYellow",css:"#808000"},{value:"darkGray",labelKey:"colorPicker.colors.darkGray",css:"#808080"},{value:"lightGray",labelKey:"colorPicker.colors.lightGray",css:"#c0c0c0"},{value:"black",labelKey:"colorPicker.colors.black",css:"#000000"},{value:"white",labelKey:"colorPicker.colors.white",css:"#ffffff"}],ku=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],ha=["colorPicker.theme.background1","colorPicker.theme.text1","colorPicker.theme.background2","colorPicker.theme.text2","colorPicker.theme.accent1","colorPicker.theme.accent2","colorPicker.theme.accent3","colorPicker.theme.accent4","colorPicker.theme.accent5","colorPicker.theme.accent6"],Nt=e=>({labelKey:`colorPicker.theme.lighter${e}`,apply:t=>t+(255-t)*(e/100)}),Qe=e=>({labelKey:`colorPicker.theme.darker${e}`,apply:t=>t*(1-e/100)});function Dh(e){let t=[0,2,4].map(o=>parseInt(e.slice(o,o+2),16)),n=(Math.max(...t)+Math.min(...t))/2/255;return n===1?[Qe(5),Qe(15),Qe(25),Qe(35),Qe(50)]:n===0?[Nt(50),Nt(35),Nt(25),Nt(15),Nt(5)]:n>=.8?[Qe(10),Qe(25),Qe(50),Qe(75),Qe(90)]:[Nt(80),Nt(60),Nt(40),Qe(25),Qe(50)]}var Nh=/^[0-9A-Fa-f]{6}$/;function Lh(e,t){let n="";for(let o=0;o<6;o+=2){let r=Math.round(t(parseInt(e.slice(o,o+2),16)));n+=Math.max(0,Math.min(255,r)).toString(16).padStart(2,"0");}return n.toUpperCase()}function Hh(e){let t=parseInt(e.slice(0,2),16),n=parseInt(e.slice(2,4),16),o=parseInt(e.slice(4,6),16);return .299*t+.587*n+.114*o>230}function va({value:e,css:t,title:n,selected:o,apply:r}){return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch",style:{backgroundColor:t},"aria-label":n,title:n,"data-value":e,...o?{"data-selected":""}:{},...Hh(t.replace("#",""))?{"data-light":""}:{},onMouseDown:O,onClick:()=>r(e)})}function Ah({apply:e,label:t,current:n,themeHexes:o}){let r=o.map(Dh),i=[0,1,2,3,4];return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.themeColors")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--theme",role:"group",children:[o.map((a,l)=>jsxRuntime.jsx(va,{value:a,css:`#${a.toLowerCase()}`,title:t(ha[l]),selected:n===a,apply:e},`base-${l}`)),i.map(a=>o.map((l,c)=>{let s=r[c][a],d=Lh(l,s.apply);return jsxRuntime.jsx(va,{value:d,css:`#${d.toLowerCase()}`,title:`${t(ha[c])}, ${t(s.labelKey)}`,selected:n===d,apply:e},`${a}-${c}`)}))]})]})}function Fh(e){let{apply:t,label:n,current:o}=e,[r,i]=je.useState(""),a=Nh.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ah,{...e}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:n("colorPicker.standardColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid",role:"group",children:_h.map(l=>jsxRuntime.jsx(va,{value:l.value,css:l.css,title:n(l.labelKey),selected:o===l.value,apply:t},l.value))})]}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:n("colorPicker.customColor")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-custom",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-hash","aria-hidden":"true",children:"#"}),jsxRuntime.jsx("input",{type:"text",className:"docx-toolbar__swatch-hex",value:r,maxLength:6,spellCheck:false,"aria-label":n("colorPicker.customColor"),onChange:l=>i(l.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:l=>{l.key==="Enter"&&a&&t(r.toUpperCase());}}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch-apply",disabled:!a,onMouseDown:O,onClick:()=>t(r.toUpperCase()),children:n("colorPicker.apply")})]})]})]})}function Bl({apply:e,current:t}){let n=F(),o=j(),r=n?.getDocumentThemeColors()??[],i=r.length===ha.length?r.map(l=>l.hex):ku,a=t?.toUpperCase()??null;return jsxRuntime.jsx(Fh,{apply:e,label:o,current:a,themeHexes:i})}var Oh=Iu.filter(e=>e.value!=="white");function Zh({apply:e,label:t,current:n}){return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.highlightColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--highlight",role:"group",children:Oh.map(o=>jsxRuntime.jsx(va,{value:o.value,css:o.css,title:t(o.labelKey),selected:n===o.value,apply:e},o.value))})]})}function _u(e){let{slot:t,defaultValue:n,cssOf:o,clear:r,body:i}=e,a=t==="text.color";return Object.assign(({className:c,hidden:s,icon:d})=>{let u=F(),{isEnabled:m,disabledReason:g}=ne(t),p=j(),[f,b]=je.useState(false),[h,P]=je.useState(n),x=je.useRef(null),C=B(E=>{if(a){let D=E.formatting?.color;return D&&D.kind==="hex"?D.value.toUpperCase():null}return E.formatting?.highlight??null}),v=u?.getDocumentThemeColors()??[],y=v.length===ha.length?v.map(E=>E.hex):ku;je.useEffect(()=>{if(!f)return;let E=D=>{let A=x.current;A&&D.target instanceof Node&&A.contains(D.target)||b(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[f]);let T=je.useCallback(E=>{if(b(false),!u)return;let D=editor.commandForSlotValue(t,E);D&&u.can(D).ok&&(u.exec(D),E!==r.value&&P(E));},[u]),M=je.useMemo(()=>X(t),[]);if(s)return null;let w=p(M?.labelKey??t);return jsxRuntime.jsxs("div",{ref:x,className:`docx-toolbar__colorsplit${c?` ${c}`:""}`,"data-slot":t,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__colorsplit-main",disabled:!m,...m?{}:{"data-disabled":""},"aria-label":w,title:g??w,onMouseDown:O,onClick:()=>T(h),children:[d??te(M?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:o(h)},"aria-hidden":"true"})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__colorsplit-caret",disabled:!m,...m?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":f,"aria-label":w,title:g??w,onMouseDown:O,onClick:()=>b(E=>!E),children:"\u25BE"}),f?jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-popup",role:"dialog","aria-label":w,onMouseDown:O,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:O,onClick:()=>T(r.value),children:[jsxRuntime.jsx("span",{className:`docx-toolbar__swatch-clear-chip${r.value==="none"?" docx-toolbar__swatch-clear-chip--none":""}`,"aria-hidden":"true"}),p(r.labelKey)]}),i({apply:T,label:p,current:C,themeHexes:y})]}):null]})},{docxSlot:t})}var Bh=new Map(Iu.map(e=>[e.value,e.css])),ql=_u({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(Bl,{apply:e.apply,current:e.current})}),Kl=_u({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>Bh.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(Zh,{...e})});var Wh=["alignment.left","alignment.center","alignment.right","alignment.justify"];function $h({className:e,hidden:t}){let n=ne("alignment.left"),o=ne("alignment.center"),r=ne("alignment.right"),i=ne("alignment.justify"),a=j(),[l,c]=je.useState(false),s=je.useRef(null);if(je.useEffect(()=>{if(!l)return;let f=b=>{let h=s.current;h&&b.target instanceof Node&&h.contains(b.target)||c(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[l]),t)return null;let d=[n,o,r,i],u=Wh.map((f,b)=>({slot:f,control:X(f),state:d[b]})),m=u.find(f=>f.state.isActive)??u[0],g=u.some(f=>f.state.isEnabled),p=a(m.control?.labelKey??m.slot);return jsxRuntime.jsxs("div",{ref:s,className:`docx-toolbar__alignment${e?` ${e}`:""}`,"data-slot":"alignment",children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-trigger",disabled:!g,...g?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":l,"aria-label":p,title:g?p:m.state.disabledReason??p,onMouseDown:O,onClick:()=>c(f=>!f),children:[te(m.control?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),l?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__alignment-popup",children:u.map(f=>{let b=a(f.control?.labelKey??f.slot);return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-option","data-slot":f.slot,disabled:!f.state.isEnabled,...f.state.isActive?{"data-active":""}:{},"aria-pressed":f.state.isActive,"aria-label":b,title:f.state.disabledReason??b,onMouseDown:O,onClick:()=>{f.state.execute(),c(false);},children:te(f.control?.paths)},f.slot)})}):null]})}var ya=Object.assign($h,{docxSlot:"alignment"});function Vl(e){let{label:t,icon:n,active:o,disabled:r,disabledReason:i,onSelect:a,asChild:l,className:c,children:s}=e,d={type:"button",className:`docx-toolbar__button${c?` ${c}`:""}`,disabled:r,...o?{"data-active":""}:{},...r?{"data-disabled":""}:{},...o!==void 0?{"aria-pressed":o}:{},"aria-label":t,title:r?i??t:t,onMouseDown:u=>O(u),onClick:r?void 0:a};return l?jsxRuntime.jsx($,{...d,children:s}):jsxRuntime.jsx("button",{...d,children:n??s})}var ev=Object.freeze([]),tv=e=>e.formatting?.fontFamily??null,ov=e=>e;function xa(){let e=F(),t=B(tv),n=B(ov),o=je.useMemo(()=>e&&!n.isLoading?e.getAvailableFonts():ev,[e,n]),{isEnabled:r}=ne("font.family"),i=je.useCallback(a=>{if(!e)return;let l=editor.commandForSlotValue("font.family",a);l&&e.can(l).ok&&e.exec(l);},[e]);return je.useMemo(()=>({value:t,setValue:i,options:o,isEnabled:r}),[t,i,o,r])}var Lu=je.createContext(null);function $l(){return je.useContext(Lu)}function Ul({asChild:e,className:t,children:n}){let o=$l(),r=j();if(!o)return null;let i=r(X("font.family")?.labelKey??"font.family"),a={onClick:()=>o.setOpen(!o.open),onMouseDown:O,disabled:!o.isEnabled,className:`docx-toolbar__font-family-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":i,title:i},l=n??jsxRuntime.jsx("span",{children:o.value??"\u2014"});return e?jsxRuntime.jsx($,{...a,children:l}):jsxRuntime.jsx("button",{type:"button",...a,children:l})}Ul.docxToolbarPart=true;var nv=new Map([["arial","sansSerif"],["calibri","sansSerif"],["helvetica","sansSerif"],["verdana","sansSerif"],["open sans","sansSerif"],["roboto","sansSerif"],["times new roman","serif"],["georgia","serif"],["cambria","serif"],["garamond","serif"],["courier new","monospace"],["consolas","monospace"]]),rv=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function Hu({asChild:e,className:t,children:n}){let o=$l(),r=j();if(!o||!o.open)return null;let i={role:"listbox",className:`docx-toolbar__menu docx-toolbar__font-family-content${t?` ${t}`:""}`,style:{position:"absolute",top:"100%",left:0,zIndex:30,minWidth:"100%",maxHeight:300,overflowY:"auto"}},a;return n!==void 0?a=n:a=rv.map(c=>({...c,fonts:o.options.filter(s=>(nv.get(s.toLowerCase())??"other")===c.category)})).filter(c=>c.fonts.length>0).map((c,s)=>jsxRuntime.jsxs("div",{role:"group",children:[s>0?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}):null,c.labelKey?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-label",children:r(c.labelKey)}):null,c.fonts.map(d=>jsxRuntime.jsx(Au,{value:d},d))]},c.category)),e?jsxRuntime.jsx($,{...i,children:a}):jsxRuntime.jsx("div",{...i,children:a})}function Au({value:e,asChild:t,className:n,children:o}){let r=$l();if(!r)return null;let i=r.value===e,a={role:"option","aria-selected":i,...i?{"data-selected":""}:{},onMouseDown:O,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__font-family-item${n?` ${n}`:""}`},l=o??jsxRuntime.jsx("span",{style:{fontFamily:e},children:e});return t?jsxRuntime.jsx($,{...a,children:l}):jsxRuntime.jsxs("button",{type:"button",...a,children:[l,i?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function av({hidden:e,asChild:t,className:n,children:o}){let r=xa(),[i,a]=je.useState(false),l=je.useRef(null);je.useEffect(()=>{if(!i)return;let u=m=>{let g=l.current;g&&m.target instanceof Node&&g.contains(m.target)||a(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]);let c=je.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let s={className:`docx-toolbar__font-family${n?` ${n}`:""}`,"data-slot":"font.family",style:{position:"relative",display:"inline-block"}},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ul,{}),jsxRuntime.jsx(Hu,{})]});return jsxRuntime.jsx(Lu.Provider,{value:c,children:t?jsxRuntime.jsx($,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var Gl=Object.assign(av,{docxSlot:"font.family",Trigger:Ul,Content:Hu,Item:Au});function fv(e){let t=e.fontSizePt;return {...e.fontFamily?{fontFamily:e.fontFamily}:{},...t?{fontSize:`${Math.min(Math.max(t,9),20)}px`}:{},...e.bold?{fontWeight:700}:{},...e.italic?{fontStyle:"italic"}:{},...e.color?{color:`#${e.color}`}:{}}}var gv=Object.freeze([]),bv=e=>e.formatting?.styleId??null,hv=e=>e;function Ta(){let e=F(),t=B(bv),n=B(hv),o=je.useMemo(()=>e&&!n.isLoading?e.getDocumentStyles().filter(a=>a.type==="paragraph").map(a=>({styleId:a.styleId,name:a.name,preview:a.preview})):gv,[e,n]),{isEnabled:r}=ne("styles.style"),i=je.useCallback(a=>{if(!e)return;let l=editor.commandForSlotValue("styles.style",a);l&&e.can(l).ok&&e.exec(l);},[e]);return je.useMemo(()=>({value:t,setValue:i,options:o,isEnabled:r}),[t,i,o,r])}var Fu=je.createContext(null);function Xl(){return je.useContext(Fu)}function Ql({asChild:e,className:t,children:n}){let o=Xl(),r=j();if(!o)return null;let i=X("styles.style"),a=r(i?.labelKey??"styles.style"),l={onClick:()=>o.setOpen(!o.open),onMouseDown:O,disabled:!o.isEnabled,className:`docx-toolbar__style-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":a,title:a},c=o.options.find(d=>d.styleId===o.value),s=n??(o.value===null?jsxRuntime.jsx("span",{children:i?.valueKey?r(i.valueKey):"\u2014"}):jsxRuntime.jsx("span",{children:c?.name??o.value}));return e?jsxRuntime.jsx($,{...l,children:s}):jsxRuntime.jsx("button",{type:"button",...l,children:s})}Ql.docxToolbarPart=true;function Ou({asChild:e,className:t,children:n}){let o=Xl();if(!o||!o.open)return null;let r={role:"listbox",className:`docx-toolbar__menu docx-toolbar__style-content${t?` ${t}`:""}`,style:{position:"absolute",top:"100%",left:0,zIndex:30,minWidth:"100%",maxHeight:300,overflowY:"auto"}},i=n??o.options.map(a=>jsxRuntime.jsx(Zu,{value:a.styleId},a.styleId));return e?jsxRuntime.jsx($,{...r,children:i}):jsxRuntime.jsx("div",{...r,children:i})}function Zu({value:e,asChild:t,className:n,children:o}){let r=Xl();if(!r)return null;let i=r.value===e,a=r.options.find(s=>s.styleId===e),l={role:"option","aria-selected":i,...i?{"data-selected":""}:{},onMouseDown:O,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__style-item${n?` ${n}`:""}`},c=o??jsxRuntime.jsx("span",{style:a?fv(a.preview):void 0,children:a?.name??e});return t?jsxRuntime.jsx($,{...l,children:c}):jsxRuntime.jsxs("button",{type:"button",...l,children:[c,i?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function vv({hidden:e,asChild:t,className:n,children:o}){let r=Ta(),[i,a]=je.useState(false),l=je.useRef(null);je.useEffect(()=>{if(!i)return;let u=m=>{let g=l.current;g&&m.target instanceof Node&&g.contains(m.target)||a(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]);let c=je.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let s={className:`docx-toolbar__style${n?` ${n}`:""}`,"data-slot":"styles.style",style:{position:"relative",display:"inline-block"}},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ql,{}),jsxRuntime.jsx(Ou,{})]});return jsxRuntime.jsx(Fu.Provider,{value:c,children:t?jsxRuntime.jsx($,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var Jl=Object.assign(vv,{docxSlot:"styles.style",Trigger:Ql,Content:Ou,Item:Zu});function qu(e,t){let n=e;return Object.assign(({className:r,hidden:i,icon:a,asChild:l,children:c})=>{let{isEnabled:s,disabledReason:d}=ne(n),u=mt(),m=t==="showAll"?u.showAll:u.formFill,g=j();if(i)return null;let p=X(n),f=g(p?.labelKey??e),b={type:"button",className:`docx-toolbar__button${r?` ${r}`:""}`,"data-slot":e,disabled:!s,...s?{}:{"data-disabled":""},...m?{"data-active":""}:{},"aria-pressed":m,"aria-label":f,title:d??f,onMouseDown:O,onClick:()=>{t==="showAll"?u.toggleShowAll():u.toggleFormFill();}};return l?jsxRuntime.jsx($,{...b,children:c}):jsxRuntime.jsx("button",{...b,children:a??c??te(p?.paths)})},{docxSlot:n})}function xv({className:e,hidden:t,icon:n,asChild:o,children:r}){let i=Be.inspector,{isEnabled:a,disabledReason:l}=ne(i),{inspectorOpen:c,openInspector:s}=mt(),d=j();if(t)return null;let u=X(i),m=d(u?.labelKey??"contentControl.inspector"),g={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Be.inspector,disabled:!a,...a?{}:{"data-disabled":""},...c?{"data-active":""}:{},"aria-pressed":c,"aria-label":m,title:l??m,onMouseDown:O,onClick:()=>s()};return o?jsxRuntime.jsx($,{...g,children:r}):jsxRuntime.jsx("button",{...g,children:n??r??te(u?.paths)})}function Tv({className:e,hidden:t,icon:n,asChild:o,children:r}){let{canRemove:i,removeDisabledReason:a,remove:l}=mt(),c=j();if(t)return null;let s=Be.remove,d=X(s),u=c(d?.labelKey??"contentControl.remove"),m={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Be.remove,disabled:!i,...i?{}:{"data-disabled":""},"aria-label":u,title:a??u,onMouseDown:O,onClick:()=>{l();}};return o?jsxRuntime.jsx($,{...m,children:r}):jsxRuntime.jsx("button",{...m,children:n??r??te(d?.paths)})}var Sa=qu(Be.showAll,"showAll"),Ca=qu(Be.formFill,"formFill"),Pa=Object.assign(Tv,{docxSlot:Be.remove}),Ea=Object.assign(xv,{docxSlot:Be.inspector}),Ku={[Be.showAll]:Sa,[Be.formFill]:Ca,[Be.inspector]:Ea,[Be.remove]:Pa};function es(e,t){let n=F(),o=je.useRef(t);o.current=t,je.useEffect(()=>{if(!n)return;let r=((...i)=>{o.current(...i);});return n.on(e,r)},[n,e]);}var Rv=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],os=je.createContext(null);function Yu(){let e=je.useContext(os);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function kv(e,t){let n=t.table,r=(e?.getSelectedTable()??null)?.blockId??"",i=n?`${r}|${n.rows}|${n.columns}|${n.rowIndex}|${n.columnIndex}`:"",a=t.selection,l=a?`${a.from&&"paraId"in a.from?a.from.paraId:""}|${a.to&&"paraId"in a.to?a.to.paraId:""}|${t.selectionCollapsed}`:"",c=e?.getTableCellSelection()??null,s=c?`${c.tableId}|${c.rows.from}-${c.rows.to}|${c.columns.from}-${c.columns.to}|${c.cellIds.join(",")}`:"";return {tableKey:i,selectionKey:l,cellSelectionKey:s,editable:t.editable,editingMode:t.editingMode??"editing"}}function _v(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function Dv(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var Uu={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function Nv(e,t){let n={};for(let o of Rv){let r=editor.tableChromeToolbarState(e,o,t);n[o]={enabled:r.enabled,disabledReason:r.disabledReason};}return n}function ns({children:e}){let t=F(),[n,o]=je.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,i]=je.useState(Uu);je.useEffect(()=>(()=>{}),[]);let a=B(je.useCallback(m=>({table:m.table,editable:m.editable,editingMode:m.editingMode??"editing",headParagraphId:m.selection?.to&&"paraId"in m.selection.to?m.selection.to.paraId:m.selection?.from&&"paraId"in m.selection.from?m.selection.from.paraId:""}),[]),_v,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),l=je.useCallback(()=>{if(!t){i(Uu);return}let m=kv(t,t.snapshot());i(g=>Dv(g,m)?g:m);},[t]);je.useEffect(()=>{l();},[l,a]),es("selectionChange",je.useCallback(()=>{l();},[l]));let c=r.tableKey!=="",s=je.useMemo(()=>t?Nv(t,n):{},[t,n,r.tableKey,r.selectionKey,r.cellSelectionKey,r.editable,r.editingMode]),d=je.useCallback((m,g)=>{if(!t)return;let{result:p,nextDraft:f}=editor.runTableChromeCommand(t,m,g,n);p.ok&&f&&o(f);},[t,n]),u=je.useMemo(()=>({visible:c,draft:n,setDraft:o,slotState:m=>s[m]??{enabled:false,disabledReason:"editor is not ready"},apply:d}),[c,n,s,d]);return jsxRuntime.jsx(os.Provider,{value:u,children:e})}function Lv(){let e=je.useContext(os);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function Ma(e){let t=Lv(),n=t.slotState(e);return je.useMemo(()=>({visible:t.visible,enabled:n.enabled,disabledReason:n.disabledReason,draft:t.draft,apply:o=>t.apply(e,o)}),[t,e,n])}var Av='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function no(e){return [...e.querySelectorAll(Av)].filter(t=>t.closest('[role="menu"]')===e)}function rs(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function lt(e,t,n){if(e.length===0)return false;let o=t?e.indexOf(t):-1,r=o===-1?n>0?0:e.length-1:(o+n+e.length)%e.length;return e[r]?.focus(),true}function st(e,t){let n=t==="first"?e[0]:e[e.length-1];return n?(n.focus(),true):false}function Ra(e){(qo(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function is(e,t,n){je.useEffect(()=>{if(!e)return;let o=r=>{let i=n.current;i&&r.target instanceof Node&&i.contains(r.target)||t(false);};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,t,n]);}function Ia({enabled:e,disabledReason:t,ariaLabel:n}){let{t:o}=_(),r=i18n.localizeDisabledReason(t,o),i=je.useId(),a=!e&&r?i:void 0;return {reasonId:i,shared:{type:"button",onMouseDown:O,"aria-label":n,...a?{"aria-describedby":a}:{},...r?{title:r}:{},...e?{}:{"data-disabled":"","aria-disabled":true}},reasonNode:a&&r?jsxRuntime.jsx("span",{id:i,className:"docx-editor-sr-only",children:r}):null}}var Zv='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function ju(e,t,n,o){je.useEffect(()=>{if(!e)return;let r=n.current,i=o.current;if(!r)return;let a=()=>[...r.querySelectorAll(Zv)].filter(s=>s.closest('[role="menu"]')===r);queueMicrotask(()=>{let s=a();(s.find(u=>u.hasAttribute("data-selected")||u.hasAttribute("data-active"))??s[0])?.focus();});let c=s=>{let d=a();if(s.key==="Escape"){s.preventDefault(),t(false),i?.focus();return}if(s.key==="ArrowDown"){s.preventDefault(),lt(d,document.activeElement,1);return}if(s.key==="ArrowUp"){s.preventDefault(),lt(d,document.activeElement,-1);return}if(s.key==="Home"){s.preventDefault(),st(d,"first");return}if(s.key==="End"){s.preventDefault(),st(d,"last");return}if(s.key==="Enter"||s.key===" "){let u=document.activeElement;u instanceof HTMLElement&&d.includes(u)&&(s.preventDefault(),u.click());}};return r.addEventListener("keydown",c),()=>r.removeEventListener("keydown",c)},[e,t,n,o]);}function Xu(e,t,n,o){je.useEffect(()=>{if(!e)return;let r=n.current,i=o.current;if(!r)return;let a=()=>[...r.querySelectorAll('button:not([aria-disabled="true"])')].filter(c=>c.closest('[role="dialog"]')===r);queueMicrotask(()=>{a()[0]?.focus();});let l=c=>{if(c.key==="Escape"){c.preventDefault(),t(false),i?.focus();return}if(c.key==="Enter"||c.key===" "){let s=document.activeElement,d=a();s instanceof HTMLElement&&d.includes(s)&&(c.preventDefault(),s.click());}};return r.addEventListener("keydown",l),()=>r.removeEventListener("keydown",l)},[e,t,n,o]);}function op(e,t,n){if(e)return o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(!t));}}function $v(e){return te(editor.tableChromeIconPaths(e))}function np(){return je.createContext(null)}function Pt(e){let t=je.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function ss(e,t,n){let o=np();function r({hidden:l,asChild:c,className:s,children:d}){let{visible:u,enabled:m,disabledReason:g,draft:p,apply:f}=Ma(e),[b,h]=je.useState(false),P=je.useRef(null),x=je.useRef(null);is(b,h,P);let C=je.useMemo(()=>({open:b,setOpen:h,enabled:m,disabledReason:g,apply:f,draft:p,triggerRef:x}),[b,m,g,f,p]);if(l||!u)return null;let v={className:`${t}${s?` ${s}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},y=d??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(i,{}),jsxRuntime.jsx(a,{})]});return jsxRuntime.jsx(o.Provider,{value:C,children:c?jsxRuntime.jsx($,{...v,ref:P,children:y}):jsxRuntime.jsx("div",{ref:P,...v,children:y})})}function i({asChild:l,className:c,children:s}){let{open:d,setOpen:u,enabled:m,disabledReason:g,triggerRef:p}=Pt(o),f=j(),b=X(e),h=f(b?.labelKey??n),{shared:P,reasonNode:x}=Ia({enabled:m,disabledReason:g,ariaLabel:h}),C={...P,ref:p,className:`docx-toolbar__button docx-table-chrome__trigger${c?` ${c}`:""}`,"aria-haspopup":"menu","aria-expanded":d,onClick:m?()=>u(!d):void 0,...l?{tabIndex:m?0:-1,role:"button",onKeyDown:op(m,d,u)}:{}},v=s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[te(b?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]});return l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx($,{...C,children:v}),x]}):jsxRuntime.jsxs("button",{...C,children:[v,x]})}i.docxToolbarPart=true;function a({asChild:l,className:c,children:s}){let{open:d,setOpen:u,enabled:m,triggerRef:g}=Pt(o),p=j(),f=je.useRef(null);if(ju(d&&m,u,f,g),!d||!m)return null;let b=X(e),h=p(b?.labelKey??n),P={ref:f,role:"menu","aria-label":h,className:`docx-table-chrome__panel${c?` ${c}`:""}`,onMouseDown:O};return l?jsxRuntime.jsx($,{...P,children:s}):jsxRuntime.jsx("div",{...P,children:s})}return {Root:r,Trigger:i,Content:a,Ctx:o}}var Bn=ss("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function rp({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Pt(Bn.Ctx),l=j(),c=editor.TABLE_BORDER_TARGET_OPTIONS.find(m=>m.value===e);if(!c)return null;let s=c.value==="none"?false:c.value===a.activeTarget,d={type:"button",role:"menuitemradio","aria-checked":s,"data-value":c.value,className:`docx-table-chrome__target-btn${n?` ${n}`:""}`,...s?{"data-active":""}:{},"aria-label":l(c.labelKey),title:l(c.labelKey),onMouseDown:O,onClick:()=>{i(false),r(c.value);}},u=o??$v(c.icon);return t?jsxRuntime.jsx($,{...d,children:u}):jsxRuntime.jsx("button",{...d,children:u})}function ap(e){let{children:t}=e;return jsxRuntime.jsx(Bn.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(n=>jsxRuntime.jsx(rp,{value:n.value},n.value))})})}function Uv(e){let{children:t}=e,n=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Bn.Trigger,{}),jsxRuntime.jsx(ap,{})]});return jsxRuntime.jsx(Bn.Root,{...e,children:n})}var Wn=Object.assign(Uv,{docxSlot:"table.borderTarget",Trigger:Bn.Trigger,Content:ap,Item:rp}),qn=ss("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function ip({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Pt(qn.Ctx),l=j(),c=editor.TABLE_BORDER_STYLE_OPTIONS.find(m=>m.value===e);if(!c)return null;let s=c.value===a.spec.style,d={type:"button",role:"menuitemradio","aria-checked":s,...s?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{i(false),r(c.value);}},u=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:`docx-table-line ${c.previewClass}`,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:l(c.labelKey)})]});return t?jsxRuntime.jsx($,{...d,children:u}):jsxRuntime.jsx("button",{...d,children:u})}function lp(e){let{children:t}=e;return jsxRuntime.jsx(qn.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(n=>jsxRuntime.jsx(ip,{value:n.value},n.value))})}function Gv(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qn.Trigger,{}),jsxRuntime.jsx(lp,{})]});return jsxRuntime.jsx(qn.Root,{...e,children:t})}var $n=Object.assign(Gv,{docxSlot:"table.borderStyle",Trigger:qn.Trigger,Content:lp,Item:ip}),Kn=ss("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function sp({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Pt(Kn.Ctx),l=j(),c=Number(e),s=editor.TABLE_BORDER_WIDTH_OPTIONS.find(g=>g.size===c);if(!s)return null;let d=s.size===a.spec.size,u={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{i(false),r(s.size);}},m=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"docx-table-line docx-table-line--single",style:{height:`${s.previewThickness}px`},"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:l(s.labelKey)})]});return t?jsxRuntime.jsx($,{...u,children:m}):jsxRuntime.jsx("button",{...u,children:m})}function cp(e){let{children:t}=e;return jsxRuntime.jsx(Kn.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(n=>jsxRuntime.jsx(sp,{value:String(n.size)},n.size))})}function Yv(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Kn.Trigger,{}),jsxRuntime.jsx(cp,{})]});return jsxRuntime.jsx(Kn.Root,{...e,children:t})}var Un=Object.assign(Yv,{docxSlot:"table.borderWidth",Trigger:Kn.Trigger,Content:cp,Item:sp});function dp(e,t,n){let o=n?.defaultHex??"FF0000",r=np();function i({hidden:d,asChild:u,className:m,children:g}){let{visible:p,enabled:f,disabledReason:b,draft:h,apply:P}=Ma(e),[x,C]=je.useState(false),[v,y]=je.useState(o),T=je.useRef(null),M=je.useRef(null);is(x,C,T);let w=je.useMemo(()=>({open:x,setOpen:C,enabled:f,disabledReason:b,apply:P,draft:h,triggerRef:M,lastHex:v,setLastHex:y}),[x,f,b,P,h,v]);if(d||!p)return null;let E={className:`docx-toolbar__colorsplit docx-table-chrome${m?` ${m}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},D=g??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a,{}),jsxRuntime.jsx(l,{}),jsxRuntime.jsx(c,{clearFill:n?.clearFill??false})]});return jsxRuntime.jsx(r.Provider,{value:w,children:u?jsxRuntime.jsx($,{...E,ref:T,children:D}):jsxRuntime.jsx("div",{ref:T,...E,children:D})})}function a({asChild:d,className:u,children:m}){let{enabled:g,disabledReason:p,apply:f,draft:b,lastHex:h}=Pt(r),P=j(),x=X(e),C=P(x?.labelKey??t),{shared:v,reasonNode:y}=Ia({enabled:g,disabledReason:p,ariaLabel:C}),T=e==="table.borderColor"&&b.spec.color.kind==="hex"?b.spec.color.value:h??o,M={...v,className:`docx-toolbar__button docx-toolbar__colorsplit-main${u?` ${u}`:""}`,onClick:g?()=>f({kind:"hex",value:T}):void 0},w=m??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[te(x?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:`#${T.toLowerCase()}`},"aria-hidden":"true"})]});return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx($,{...M,children:w}),y]}):jsxRuntime.jsxs("button",{...M,children:[w,y]})}a.docxToolbarPart=true;function l({asChild:d,className:u,children:m}){let{open:g,setOpen:p,enabled:f,disabledReason:b,triggerRef:h}=Pt(r),P=j(),x=X(e),C=P(x?.labelKey??t),{shared:v,reasonNode:y}=Ia({enabled:f,disabledReason:b,ariaLabel:C}),T={...v,ref:h,className:`docx-toolbar__colorsplit-caret${u?` ${u}`:""}`,"aria-haspopup":"dialog","aria-expanded":g,onClick:f?()=>p(!g):void 0,...d?{tabIndex:f?0:-1,role:"button",onKeyDown:op(f,g,p)}:{}},M=m??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx($,{...T,children:M}),y]}):jsxRuntime.jsxs("button",{...T,children:[M,y]})}l.docxToolbarPart=true;function c({asChild:d,className:u,children:m,clearFill:g}){let{open:p,setOpen:f,enabled:b,apply:h,draft:P,triggerRef:x,lastHex:C,setLastHex:v}=Pt(r),y=j(),T=je.useRef(null);if(Xu(p&&b,f,T,x),!p||!b)return null;let M=y(t),w=e==="table.borderColor"&&P.spec.color.kind==="hex"?P.spec.color.value:C??o,E={ref:T,role:"dialog","aria-label":M,className:`docx-toolbar__swatch-popup docx-table-chrome__panel${u?` ${u}`:""}`,onMouseDown:O},D=m??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g?jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:O,onClick:()=>{f(false),h(null),Ra(x.current);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-clear-chip docx-toolbar__swatch-clear-chip--none","aria-hidden":"true"}),y("table.clearCellFill")]}):null,jsxRuntime.jsx(Bl,{apply:A=>{f(false),v?.(A),h({kind:"hex",value:A}),Ra(x.current);},current:w})]});return d?jsxRuntime.jsx($,{...E,children:D}):jsxRuntime.jsx("div",{...E,children:D})}function s({value:d,css:u,labelKey:m,asChild:g,className:p,children:f}){let{apply:b,setOpen:h,setLastHex:P,triggerRef:x}=Pt(r),C=j(),v=u??`#${d.toLowerCase()}`,y=m?C(m):d,T={type:"button",className:`docx-toolbar__swatch docx-table-chrome__swatch${p?` ${p}`:""}`,style:{backgroundColor:v},"data-value":d,"aria-label":y,title:y,onMouseDown:O,onClick:()=>{h(false),P?.(d),b({kind:"hex",value:d}),Ra(x.current);}};return g?jsxRuntime.jsx($,{...T,children:f}):jsxRuntime.jsx("button",{...T,children:f})}return {Root:i,Main:a,Trigger:l,Content:c,Item:s,Ctx:r}}var zn=dp("table.borderColor","table.borderColor",{defaultHex:"000000"});function jv(e){return jsxRuntime.jsx(zn.Content,{...e,clearFill:false})}function Xv(e){return jsxRuntime.jsx(zn.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function Qv(e){return jsxRuntime.jsx(zn.Root,{...e})}var Gn=Object.assign(Qv,{docxSlot:"table.borderColor",Trigger:zn.Trigger,Content:jv,Item:Xv,Main:zn.Main}),Vn=dp("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function Jv(e){return jsxRuntime.jsx(Vn.Content,{...e,clearFill:true})}function ey(e){return jsxRuntime.jsx(Vn.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function ty(e){return jsxRuntime.jsx(Vn.Root,{...e})}var Yn=Object.assign(ty,{docxSlot:"table.cellFill",Trigger:Vn.Trigger,Content:Jv,Item:ey,Main:Vn.Main});function up({overrides:e=new Map}){return Yu()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Bo,{}),[Wn,Gn,$n,Un,Yn].map(o=>{let r=e.get(o.docxSlot);return r?jsxRuntime.jsx(je.Fragment,{children:r},o.docxSlot):jsxRuntime.jsx(o,{},o.docxSlot)})]}):null}function pp(){let e=j(),{draft:t}=Ma("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var bp=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],hp={"zoom.level":Al,"styles.style":Jl,"font.family":Gl,"font.size":Hl,"text.color":ql,"text.highlight":Kl,"text.link":kl,"list.lineSpacing":Ol,"review.editingMode":aa,"file.save":_l,...Ku,"table.borderTarget":Wn,"table.borderColor":Gn,"table.borderStyle":$n,"table.borderWidth":Un,"table.cellFill":Yn,"image.insert":bn,"image.properties":Zo,"image.wrap":kn,"image.altText":_n},fp=new Map;function ry(e){let t=fp.get(e);return t||(t=n=>jsxRuntime.jsx(Xt,{slot:e,...n}),fp.set(e,t)),t}function ay(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:ya}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(n=>{let o=editor.chromeSlotId(t,n);return {slot:o,Part:hp[o]??ry(o)}})})}var iy=e=>e.image;function ly(e){return e==="alignment"||e in hp}function us(e){let t=Ao(e,us);if(t!==null)return t;if(!je.isValidElement(e))return null;let n=e.type;if(typeof n!="function"&&typeof n!="object")return null;if(typeof n.docxSlot=="string")return n.docxSlot;if(n.docxToolbarPart===true){let o=e.props.slot;if(typeof o=="string")return o}return null}function cs(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(cs);let t=us(e);return t!=null&&bp.includes(t)?true:je.isValidElement(e)?je.Children.toArray(e.props.children).some(cs):false}function sy(e,t){return t?true:je.Children.toArray(e).some(cs)}function cy(e){let t=Ye(),{className:n,t:o,onSave:r,preset:i=true,overflow:a=true,children:l}=e,c=je.useMemo(()=>({t:o,onSave:r}),[o,r]),s=qr(o),d=B(iy),u=je.useMemo(()=>ay(d),[d]),m=je.useMemo(()=>new Set(u.flatMap(x=>x.entries.map(C=>C.slot))),[u]),g=je.useMemo(()=>u.map(x=>x.id).filter(x=>!bl.has(x)),[u]),p=je.useMemo(()=>Id(g),[g]),f=i&&a,{attach:b,overflow:h}=Zd(f,g,p),P;if(!i)P=l;else {let x=je.Children.toArray(l),C=new Map,v=new Map,y=[];for(let D of x){let A=us(D);A&&m.has(A)?C.set(A,D):A&&bp.includes(A)?v.set(A,D):y.push(D);}let T=D=>{let A=C.get(D.slot);if(A)return A;let H=D.Part;return jsxRuntime.jsx(H,{})},M=[],w=[],E=0;for(let D of u){if(h.has(D.id)){let H=D.entries.flatMap(k=>{let L=uy(k,C,s,D.labelKey,T);return L===null?[]:[jsxRuntime.jsx(je.Fragment,{children:L},k.slot)]});if(H.length===0)continue;w.push({id:D.id,labelKey:D.labelKey,children:H});continue}E>0&&M.push(jsxRuntime.jsx(Bo,{},`separator-${D.id}`)),E+=1;let A=bl.has(D.id);M.push(jsxRuntime.jsx("div",{className:"docx-toolbar__group",...A?{[Rn]:""}:{[Mn]:D.id},children:D.entries.map(H=>jsxRuntime.jsx(je.Fragment,{children:T(H)},H.slot))},D.id));}P=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[M,jsxRuntime.jsx(up,{overrides:v}),y.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[Rn]:"",children:y}):null,w.length>0?jsxRuntime.jsx(Vd,{sections:w}):null]});}return jsxRuntime.jsx(jt.Provider,{value:c,children:jsxRuntime.jsx("div",{ref:b,role:"toolbar","data-testid":"docx-toolbar",className:`${t}docx-toolbar${n?` ${n}`:""}`,...f?{"data-overflow":""}:{},onMouseDown:O,children:sy(l,i)?jsxRuntime.jsx(ns,{children:P}):P})})}function dy(e){return e?!!e.props.hidden:false}function uy(e,t,n,o,r){let i=t.get(e.slot);return dy(i)?null:i||ly(e.slot)?jsxRuntime.jsx(Kd,{label:py(n,e,o),children:r(e)}):jsxRuntime.jsx(zd,{slot:e.slot})}function py(e,t,n){let o=t.slot==="alignment"?null:X(t.slot);return e(o?.labelKey??n)}var Xn=Object.assign(cy,{Button:Xt,Action:Vl,Separator:Bo,Undo:Jd,Redo:eu,Bold:tu,Italic:ou,Underline:nu,Strike:ru,Link:kl,ClearFormatting:au,Superscript:iu,Subscript:lu,Alignment:ya,AlignLeft:su,AlignCenter:cu,AlignRight:du,AlignJustify:uu,LineSpacing:Ol,BulletList:pu,NumberedList:mu,Outdent:fu,Indent:gu,ImageInsert:bn,ImageProperties:Zo,ImageWrap:kn,ImageAltText:_n,TableInsert:bu,TableBorderTarget:Wn,TableBorderColor:Gn,TableBorderStyle:$n,TableBorderWidth:Un,TableCellFill:Yn,Comments:hu,FontFamily:Gl,FontSize:Hl,FontColor:ql,Highlight:Kl,Zoom:Al,StylePicker:Jl,EditingMode:aa,Save:_l,ContentControlShowAll:Sa,ContentControlFormFill:Ca,ContentControlInspector:Ea,ContentControlRemove:Pa});var by=e=>e.pageSetup??null,hy=e=>e.editable;function ro(){let e=F(),t=B(by),n=B(hy),o=je.useMemo(()=>n&&e!==null&&e.can({type:"setPageSetup",marginTop:0}).ok,[e,n]),r=je.useCallback(i=>e?e.exec({...i.pageWidthTwips!==void 0?{pageWidth:i.pageWidthTwips}:{},...i.pageHeightTwips!==void 0?{pageHeight:i.pageHeightTwips}:{},...i.orientation!==void 0?{orientation:i.orientation}:{},...i.marginTopTwips!==void 0?{marginTop:i.marginTopTwips}:{},...i.marginRightTwips!==void 0?{marginRight:i.marginRightTwips}:{},...i.marginBottomTwips!==void 0?{marginBottom:i.marginBottomTwips}:{},...i.marginLeftTwips!==void 0?{marginLeft:i.marginLeftTwips}:{},...i.scope!==void 0?{scope:i.scope}:{},type:"setPageSetup"}).ok:false,[e]);return je.useMemo(()=>({pageSetup:t,isEnabled:o,apply:r}),[t,o,r])}var ms=[{labelKey:"dialogs.pageSetup.pageSizes.letter",width:12240,height:15840},{labelKey:"dialogs.pageSetup.pageSizes.a4",width:11906,height:16838},{labelKey:"dialogs.pageSetup.pageSizes.legal",width:12240,height:20160},{labelKey:"dialogs.pageSetup.pageSizes.a3",width:16838,height:23811},{labelKey:"dialogs.pageSetup.pageSizes.a5",width:8391,height:11906},{labelKey:"dialogs.pageSetup.pageSizes.b5",width:9979,height:14175},{labelKey:"dialogs.pageSetup.pageSizes.executive",width:10440,height:15120}],Ep=1440,vy=e=>Math.round(e/Ep*100)/100,yy=e=>Math.round(e*Ep);function xy(e,t){let n=Math.min(e,t),o=Math.max(e,t);return ms.findIndex(r=>Math.abs(r.width-n)<20&&Math.abs(r.height-o)<20)}var Ty={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Sy={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},Cy={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600,color:"var(--doc-text)"},Py={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},Tp={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},ka={display:"flex",alignItems:"center",gap:12},_a={width:80,fontSize:13,color:"var(--doc-text-muted)"},Da={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13,backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},Ey={fontSize:11,color:"var(--doc-text-muted)",width:16},wy={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},Sp={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},Cp=12240,Pp=15840,Ht=1440;function Qn({open:e,onClose:t,className:n}){let{t:o}=_(),{pageSetup:r,isEnabled:i,apply:a}=ro(),[l,c]=je.useState(Cp),[s,d]=je.useState(Pp),[u,m]=je.useState("portrait"),[g,p]=je.useState(Ht),[f,b]=je.useState(Ht),[h,P]=je.useState(Ht),[x,C]=je.useState(Ht),[v,y]=je.useState("document"),T=je.useRef(null),M=je.useRef("no");je.useEffect(()=>{if(!e){M.current="no";return}if(M.current==="yes"&&r===null){M.current="no";return}M.current==="yes"||M.current==="loading"&&r===null||(c(r?.pageWidthTwips??Cp),d(r?.pageHeightTwips??Pp),m(r?.orientation??"portrait"),p(r?.marginsTwips.top??Ht),b(r?.marginsTwips.bottom??Ht),P(r?.marginsTwips.left??Ht),C(r?.marginsTwips.right??Ht),y("document"),M.current=r===null?"loading":"yes");},[e,r]),je.useEffect(()=>{e&&T.current?.focus();},[e]);let w=je.useCallback(k=>{let L=ms[k];L&&(c(u==="landscape"?L.height:L.width),d(u==="landscape"?L.width:L.height));},[u]),E=je.useCallback(k=>{k!==u&&(m(k),c(s),d(l));},[u,l,s]),D=je.useCallback(()=>{a({pageWidthTwips:l,pageHeightTwips:s,orientation:u,marginTopTwips:g,marginRightTwips:x,marginBottomTwips:f,marginLeftTwips:h,scope:v})&&t();},[a,l,s,u,g,x,f,h,v,t]);if(!e)return null;let A=xy(l,s),H=(k,L,R)=>jsxRuntime.jsxs("div",{style:ka,children:[jsxRuntime.jsx("label",{style:_a,children:o(`dialogs.pageSetup.${k}`)}),jsxRuntime.jsx("input",{type:"number",style:Da,min:0,max:22,step:.1,value:vy(L),onChange:I=>R(Math.max(0,yy(Number(I.target.value)||0))),"aria-label":o(`dialogs.pageSetup.${k}`)}),jsxRuntime.jsx("span",{style:Ey,children:"in"})]});return jsxRuntime.jsx("div",{className:n,style:Ty,onClick:t,onKeyDown:k=>{k.key==="Escape"&&t(),k.key==="Enter"&&D();},children:jsxRuntime.jsxs("div",{ref:T,tabIndex:-1,style:Sy,onClick:k=>k.stopPropagation(),onMouseDown:k=>k.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o("dialogs.pageSetup.title"),children:[jsxRuntime.jsx("div",{style:Cy,children:o("dialogs.pageSetup.title")}),jsxRuntime.jsxs("div",{style:Py,children:[jsxRuntime.jsx("div",{style:Tp,children:o("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{style:ka,children:[jsxRuntime.jsx("label",{style:_a,children:o("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{style:Da,value:A,onChange:k=>w(Number(k.target.value)),"aria-label":o("dialogs.pageSetup.sizeLabel"),children:[ms.map((k,L)=>jsxRuntime.jsx("option",{value:L,children:o(k.labelKey)},k.labelKey)),A<0&&jsxRuntime.jsx("option",{value:-1,children:o("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{style:ka,children:[jsxRuntime.jsx("label",{style:_a,children:o("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{style:Da,value:u,onChange:k=>E(k.target.value),"aria-label":o("dialogs.pageSetup.orientation"),children:[jsxRuntime.jsx("option",{value:"portrait",children:o("dialogs.pageSetup.portrait")}),jsxRuntime.jsx("option",{value:"landscape",children:o("dialogs.pageSetup.landscape")})]})]}),jsxRuntime.jsx("div",{style:{...Tp,marginTop:4},children:o("dialogs.pageSetup.margins")}),H("top",g,p),H("bottom",f,b),H("left",h,P),H("right",x,C),jsxRuntime.jsxs("div",{style:ka,children:[jsxRuntime.jsx("label",{style:_a,children:o("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{style:Da,value:v,onChange:k=>y(k.target.value),"aria-label":o("dialogs.pageSetup.applyTo"),children:[jsxRuntime.jsx("option",{value:"document",children:o("dialogs.pageSetup.applyToDocument")}),jsxRuntime.jsx("option",{value:"section",children:o("dialogs.pageSetup.applyToSection")})]})]})]}),jsxRuntime.jsxs("div",{style:wy,children:[jsxRuntime.jsx("button",{type:"button",style:Sp,onClick:t,children:o("common.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...Sp,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)",opacity:i?1:.5},disabled:!i,onClick:D,children:o("common.apply")})]})]})})}var Jn=je.createContext({t:void 0,openMenu:null,setOpenMenu:()=>{},activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onReportIssue:void 0,reportIssue:void 0});function Je(){return je.useContext(Jn)}function _e(){let{t:e}=Je(),{t}=_();return n=>e?.(n)??t(n)}var Iy=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i,ky=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var wp=new TextEncoder;function _y(e,t){if(wp.encode(e).length<=t)return e;let n=0,o="";for(let r of e){let i=wp.encode(r).length;if(n+i>t)break;n+=i,o+=r;}return o}function Mp(e){let t=_y((e??"").replace(/\.docx$/i,"").replace(ky," ").replace(/\s+/g," ").trim().replace(/^[.\s]+/,"").replace(/[.\s]+$/,""),200).trim();return !t||Iy.test(t)?"document.docx":`${t}.docx`}function Rp(e,t){let n=URL.createObjectURL(new Blob([e],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})),o=document.createElement("a");o.href=n,o.download=t,o.click(),setTimeout(()=>URL.revokeObjectURL(n),0);}var Dy="https://github.com/eigenpal/docx-editor/issues/new";function Ny(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function Ip(e={}){let t=e.userAgent??(typeof navigator<"u"?navigator.userAgent:"unknown"),n=e.viewport??(typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0}),r=["### What happened","","### Steps to reproduce","1. ","2. ","3. ","","### Expected","","### Actual","","### Attach the DOCX","Please drag the `.docx` file that reproduces this onto the issue (below this text box). Bugs are much faster to fix with a real file.","","### Environment",`- URL: ${e.pageUrl??Ny()}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${t}`,""].join(`
2
- `),i=new URLSearchParams({title:"[Bug] ",body:r});return `${Dy}?${i.toString()}`}function er(e){typeof window>"u"||window.open(Ip(e),"_blank","noopener,noreferrer");}var fs=6,_p=6;function Ne(e){let{icon:t,shortcut:n,disabled:o,title:r,active:i,selected:a,slot:l,onSelect:c,className:s,children:d}=e,u=je.useId(),m=o&&r?u:void 0;return jsxRuntime.jsxs("button",{type:"button",role:i===void 0?"menuitem":a===void 0?"menuitemcheckbox":"menuitemradio",className:`docx-toolbar__menu-item docx-menubar__item${s?` ${s}`:""}`,tabIndex:-1,...l?{"data-slot":l}:{},...i?{"data-active":""}:{},...o?{"data-disabled":"","aria-disabled":true}:{},...i!==void 0?{"aria-checked":i}:{},...m?{"aria-describedby":m}:{},...r?{title:r}:{},onMouseDown:O,onClick:o?void 0:c,children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:t}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),n?jsxRuntime.jsx("span",{className:"docx-menubar__item-shortcut",children:n}):null,m?jsxRuntime.jsx("span",{id:u,className:"docx-editor-sr-only",children:r}):null]})}function or({label:e,labelKey:t,className:n,hidden:o,children:r}){let i=_e();if(o)return null;let a=e??(t===void 0?void 0:i(t));return jsxRuntime.jsxs("div",{role:"group",className:`docx-menubar__group${n?` ${n}`:""}`,...a?{"aria-label":a}:{},children:[a?jsxRuntime.jsx("div",{className:"docx-menubar__group-label","aria-hidden":"true",children:a}):null,r]})}function Et({slot:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let{execute:i,isActive:a,isEnabled:l,disabledReason:c}=ne(e),{setOpenMenu:s}=Je(),d=_e();if(r)return null;let u=X(e),m=d(t??u?.labelKey??e),g=editor.commandForSlot(e),p=g?.type==="toggleMark"||g?.type==="setAlignment",f=g?.type==="setAlignment";return jsxRuntime.jsx(Ne,{slot:e,icon:te(u?.paths),...n?{shortcut:d(n)}:{},disabled:!l,...c?{title:c}:{},...p?{active:a}:{},...f?{selected:true}:{},onSelect:()=>{i(),s(null);},...o?{className:o}:{},children:m})}Et.docxMenuRow=true;function Dp(e,t,n,o){return Object.assign(({className:i,hidden:a})=>{let l=Je(),c=_e(),s=o(l);if(a)return null;let d=X(e),u=c(t??d?.labelKey??e);return jsxRuntime.jsx(Ne,{slot:e,icon:te(d?.paths),...n?{shortcut:c(n)}:{},disabled:!s,onSelect:()=>{s?.(),l.setOpenMenu(null);},...i?{className:i}:{},children:u})},{docxSlot:e})}var bs=Dp("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),hs=Dp("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave);function Zy({className:e,hidden:t}){let n=F(),o=Je(),r=_e(),i=editor.chromeProbeForSlot("file.pageSetup"),a=n&&i?n.can(i):null,l=a?.ok===true,c=a&&!a.ok?a.reason:null;if(t)return null;let s=X("file.pageSetup"),d=r(s?.labelKey??"file.pageSetup"),u=l&&!!o.onPageSetup;return jsxRuntime.jsx(Ne,{slot:"file.pageSetup",icon:te(s?.paths),disabled:!u,...c?{title:c}:{},onSelect:()=>{o.onPageSetup?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}var vs=Object.assign(Zy,{docxSlot:"file.pageSetup"});function By({className:e,hidden:t}){let{openFilePicker:n,isEnabled:o,disabledReason:r}=zr(),i=Je(),a=_e();if(t)return null;let l=X("image.insert"),c=a(l?.labelKey??"toolbar.image");return jsxRuntime.jsx(Ne,{slot:"image.insert",icon:te(l?.paths),disabled:!o,...r?{title:r}:{},onSelect:()=>{n(),i.setOpenMenu(null);},...e?{className:e}:{},children:c})}var qy=Object.assign(By,{docxSlot:"image.insert"}),tr=8;function io({labelKey:e,paths:t,className:n,children:o}){let r=_e(),[i,a]=je.useState(false),l=je.useRef(null),c=je.useRef(null),s=je.useId(),d=r(e),[u,m]=je.useState(null);return je.useLayoutEffect(()=>{if(!i){m(null);return}let g=l.current,p=c.current,f=g?.ownerDocument.defaultView;if(!g||!p||!f)return;let b=g.getBoundingClientRect(),h=p.offsetWidth,P=p.offsetHeight,x=b.right+h>f.innerWidth-tr;m({left:x?Math.max(tr,b.left-h):Math.min(b.right,f.innerWidth-h-tr),top:Math.max(tr,Math.min(b.top-4,f.innerHeight-P-tr))});},[i]),jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__submenu${n?` ${n}`:""}`,onMouseEnter:()=>a(true),onMouseLeave:()=>a(false),onKeyDown:g=>{g.key==="ArrowRight"&&document.activeElement===l.current?(g.preventDefault(),a(true),queueMicrotask(()=>{c.current&&st(no(c.current),"first");})):(g.key==="ArrowLeft"||g.key==="Escape")&&i&&(g.preventDefault(),g.stopPropagation(),a(false),l.current?.focus());},onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||a(false);},children:[jsxRuntime.jsxs("button",{ref:l,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?s:void 0,className:"docx-toolbar__menu-item docx-menubar__item",tabIndex:-1,...i?{"data-open":""}:{},onMouseDown:O,onFocus:()=>a(true),onClick:()=>a(true),children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:te(t)}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),jsxRuntime.jsx("span",{className:"docx-menubar__item-caret","aria-hidden":"true",children:"\u203A"})]}),i?jsxRuntime.jsx("div",{ref:c,id:s,className:"docx-toolbar__menu docx-menubar__menu docx-menubar__submenu-panel",role:"menu","aria-label":d,style:u?{position:"fixed",left:u.left,top:u.top}:{position:"fixed",visibility:"hidden"},onKeyDown:g=>{let p=c.current;if(!p)return;let f=no(p);g.key==="ArrowDown"?(g.preventDefault(),g.stopPropagation(),lt(f,document.activeElement,1)):g.key==="ArrowUp"&&(g.preventDefault(),g.stopPropagation(),lt(f,document.activeElement,-1));},children:o}):null]})}function La({slot:e="table.insert",className:t}){let n=F(),{isEnabled:o}=ne(e),{setOpenMenu:r}=Je(),i=_e(),[a,l]=je.useState(null),[c,s]=je.useState({rows:1,cols:1}),d=je.useRef(null),u=je.useCallback((p,f)=>{if(!n||!o)return;let b={type:"insertTable",rows:p,cols:f};n.can(b).ok&&(n.exec(b),r(null),n.focus());},[n,o,r]),m=je.useCallback(p=>{s(f=>{let b={rows:Math.min(_p,Math.max(1,f.rows+(p.rows??0))),cols:Math.min(fs,Math.max(1,p.toCol??f.cols+(p.cols??0)))};return l(b),queueMicrotask(()=>d.current?.querySelector(`[data-cell="${b.rows}x${b.cols}"]`)?.focus()),b});},[]),g=[];for(let p=1;p<=_p;p+=1){let f=[];for(let b=1;b<=fs;b+=1){let h=!!a&&p<=a.rows&&b<=a.cols;f.push(jsxRuntime.jsx("button",{type:"button",role:"gridcell","data-cell":`${p}x${b}`,className:"docx-menubar__grid-cell",tabIndex:c.rows===p&&c.cols===b?0:-1,...h?{"data-filled":""}:{},"aria-label":`${b} \xD7 ${p}`,onMouseDown:O,onMouseEnter:()=>l({rows:p,cols:b}),onFocus:()=>l({rows:p,cols:b}),onClick:()=>u(p,b)},b));}g.push(jsxRuntime.jsx("div",{role:"row",className:"docx-menubar__grid-row",children:f},p));}return jsxRuntime.jsxs("div",{ref:d,role:"grid","aria-label":i("toolbar.insertTable"),className:`docx-menubar__grid${t?` ${t}`:""}`,onMouseLeave:()=>l(null),onKeyDown:p=>{if(p.key==="ArrowRight")m({cols:1});else if(p.key==="ArrowLeft")m({cols:-1});else if(p.key==="ArrowDown")m({rows:1});else if(p.key==="ArrowUp")m({rows:-1});else if(p.key==="Home")m({toCol:1});else if(p.key==="End")m({toCol:fs});else return;p.preventDefault(),p.stopPropagation();},children:[jsxRuntime.jsx("div",{className:"docx-menubar__grid-cells",children:g}),jsxRuntime.jsx("div",{className:"docx-menubar__grid-caption","aria-hidden":"true",children:a?`${a.cols} \xD7 ${a.rows}`:""})]})}function Ky({entry:e}){let{isEnabled:t}=ne(e.slot),n=X(e.slot);return t?jsxRuntime.jsx(io,{labelKey:e.labelKey??n?.labelKey??e.slot,paths:n?.paths,children:jsxRuntime.jsx(La,{slot:e.slot})}):jsxRuntime.jsx(Et,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function lo({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function nr({entry:e}){return e.kind==="separator"?jsxRuntime.jsx(lo,{}):e.kind==="submenu"?jsxRuntime.jsx(io,{labelKey:e.labelKey,paths:e.paths,children:e.items.map((t,n)=>jsxRuntime.jsx(nr,{entry:t},n))}):e.slot==="file.open"?jsxRuntime.jsx(bs,{}):e.slot==="file.save"?jsxRuntime.jsx(hs,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(vs,{}):e.slot==="image.insert"?jsxRuntime.jsx(qy,{}):e.picker==="tableGrid"?jsxRuntime.jsx(Ky,{entry:e}):jsxRuntime.jsx(Et,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function Np(e){if(!je.isValidElement(e))return null;let t=Ao(e,Np);if(t!==null)return t;let n=e.type;if(typeof n!="function"&&typeof n!="object")return null;if(typeof n.docxSlot=="string")return n.docxSlot;if(n.docxMenuRow===true){let o=e.props.slot;if(typeof o=="string")return o}return null}function zy(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function Vy(e,t,n){return la({entries:e??[],children:t,preset:n,keyOfEntry:zy,keyOfChild:Np,renderEntry:o=>jsxRuntime.jsx(nr,{entry:o})})}function Vo({id:e,labelKey:t,label:n,icon:o,className:r,hidden:i,preset:a=true,children:l}){let{openMenu:c,setOpenMenu:s,activeMenu:d}=Je(),u=_e(),m=je.useId(),g=je.useRef(null),p=je.useRef(null),f=je.useRef(false),b=je.useRef(false),h=editor.CHROME_MENUS.find(y=>y.id===e),P=c===e;if(i)return null;let x=n??u(t??h?.labelKey??e),C=Vy(h?.entries,l,a),v=()=>{s(null),g.current?.focus();};return jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__menu-root${r?` ${r}`:""}`,"data-menu":e,children:[jsxRuntime.jsxs("button",{ref:g,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":P,"aria-controls":P?m:void 0,className:"docx-menubar__trigger",tabIndex:d===e?0:-1,...P?{"data-open":""}:{},onMouseDown:O,onKeyDown:y=>{y.key==="ArrowDown"||y.key==="Enter"||y.key===" "||y.key==="ArrowUp"?(y.preventDefault(),f.current=true,s(e)):y.key==="Escape"&&P&&(y.preventDefault(),v());},onClick:()=>{if(b.current){b.current=false;return}s(P?null:e);},onMouseEnter:()=>{c!==null&&c!==e&&(b.current=true,s(e));},onMouseLeave:()=>{b.current=false;},children:[o?jsxRuntime.jsx("span",{className:"docx-menubar__trigger-icon","aria-hidden":"true",children:o}):null,x]}),P?jsxRuntime.jsx("div",{ref:y=>{p.current=y,y&&f.current&&(f.current=false,st(no(y),"first"));},id:m,role:"menu","aria-label":x,className:"docx-toolbar__menu docx-menubar__menu",onKeyDown:y=>{let T=p.current;if(!T)return;let M=no(T),w=document.activeElement;y.key==="ArrowDown"?(y.preventDefault(),lt(M,w,1)):y.key==="ArrowUp"?(y.preventDefault(),lt(M,w,-1)):y.key==="Home"?(y.preventDefault(),st(M,"first")):y.key==="End"?(y.preventDefault(),st(M,"last")):y.key==="Escape"?(y.preventDefault(),y.stopPropagation(),v()):y.key==="Tab"&&s(null);},children:C}):null]})}function ys(e){return Object.assign(n=>jsxRuntime.jsx(Vo,{id:e,...n}),{docxMenu:e})}var xs=ys("file"),Ts=ys("format"),Ss=ys("insert");function Wy({className:e,hidden:t,onSelect:n}){let{setOpenMenu:o,onReportIssue:r,reportIssue:i}=Je(),a=_e();if(t||i===false)return null;let l=n??r??er;return jsxRuntime.jsx(Ne,{slot:"help.reportIssue",onSelect:()=>{l(),o(null);},...e?{className:e}:{},children:a("toolbar.reportIssue")})}var Ha=Object.assign(Wy,{docxSlot:"help.reportIssue"});function $y({children:e,...t}){let{reportIssue:n}=Je();return e===void 0&&n===false?null:jsxRuntime.jsxs(Vo,{id:"help",...t,children:[jsxRuntime.jsx(Ha,{}),e]})}var Cs=Object.assign($y,{docxMenu:"help"});var Yy={file:xs,format:Ts,insert:Ss,help:Cs},jy=new Set(editor.CHROME_MENUS.map(e=>e.id));function Bp(e){if(!je.isValidElement(e))return null;if(e.type===je.Fragment){let o=je.Children.toArray(e.props.children).map(Bp).filter(r=>r!==null);return o.length===1?o[0]:null}let t=e.type;if((typeof t=="function"||typeof t=="object")&&typeof t.docxMenu=="string")return t.docxMenu;if(e.type===Vo){let n=e.props.id;if(typeof n=="string"&&jy.has(n))return n}return null}function Xy(e){let t=Ye(),{className:n,t:o,fileName:r,onOpen:i,onOpenFile:a,onSave:l,onPageSetup:c,onReportIssue:s,reportIssue:d,preset:u=true,children:m}=e,g=F(),{t:p}=_(),[f,b]=je.useState(null),[h,P]=je.useState(null),[x,C]=je.useState(null),[v,y]=je.useState(false),T=je.useRef(null),M=je.useRef(null);je.useEffect(()=>{if(f===null)return;let z=V=>{let Y=T.current;Y&&V.target instanceof Node&&Y.contains(V.target)||b(null);},Z=V=>{V.key==="Escape"&&b(null);};return document.addEventListener("mousedown",z),document.addEventListener("keydown",Z),()=>{document.removeEventListener("mousedown",z),document.removeEventListener("keydown",Z);}},[f]);let w=je.useCallback(z=>{b(z),z!==null&&C(z);},[]),E=je.useCallback(()=>M.current?.click(),[]),D=je.useCallback(()=>{g&&g.save().then(z=>Rp(z,Mp(r??h??void 0))).catch(z=>{console.error("[docx-editor] save failed",z);});},[g,r,h]),A=je.useCallback(()=>y(true),[]),H=g?i??E:void 0,k=g?l??D:void 0,L=g?c??A:void 0;je.useEffect(()=>{let z=Z=>{if(!(Z.metaKey||Z.ctrlKey)||Z.altKey||Z.shiftKey)return;let V=Z.key.toLowerCase();if(V!=="s"&&V!=="o")return;let Y=Z.target,Re=qo(T.current)??T.current;!Y||!Re?.contains(Y)||(V==="s"&&k?(Z.preventDefault(),k()):V==="o"&&H&&(Z.preventDefault(),H()));};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[H,k]);let R=je.useMemo(()=>({t:o,openMenu:f,setOpenMenu:w,activeMenu:x,onOpen:H,onSave:k,onPageSetup:L,onReportIssue:s,reportIssue:d}),[o,f,w,x,H,k,L,s,d]),I;if(!u)I=m;else {let z=new Map,Z=[];for(let V of je.Children.toArray(m)){let Y=Bp(V);Y?z.set(Y,V):Z.push(V);}I=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[editor.CHROME_MENUS.map(V=>{let Y=z.get(V.id);if(Y)return jsxRuntime.jsx(je.Fragment,{children:Y},V.id);let Re=Yy[V.id];return jsxRuntime.jsx(Re,{},V.id)}),Z]});}return jsxRuntime.jsxs(Jn.Provider,{value:R,children:[jsxRuntime.jsx("div",{ref:z=>{if(T.current=z,z&&x===null){let Z=rs(z)[0]?.closest("[data-menu]")?.getAttribute("data-menu");Z&&C(Z);}},role:"menubar","aria-label":o?.("titleBar.menuBarAriaLabel")??p("titleBar.menuBarAriaLabel"),"data-testid":"docx-menubar",className:`${t}docx-menubar${n?` ${n}`:""}`,onMouseDown:O,onKeyDown:z=>{if(z.key!=="ArrowLeft"&&z.key!=="ArrowRight")return;let Z=T.current;if(!Z)return;let V=rs(Z),Y=V.indexOf(document.activeElement);if(Y===-1)return;z.preventDefault();let Re=z.key==="ArrowRight"?1:-1,se=V[(Y+Re+V.length)%V.length],Se=se?.closest("[data-menu]")?.getAttribute("data-menu");Se&&(C(Se),se?.focus(),f!==null&&b(Se));},children:I}),jsxRuntime.jsx("input",{ref:M,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:z=>{let Z=z.target.files?.[0];z.target.value="",!(!Z||!g)&&(P(Z.name),a?.(Z),Z.arrayBuffer().then(V=>g.load(new Uint8Array(V))).catch(V=>{console.error("[docx-editor] could not open the file",V);}));}}),jsxRuntime.jsx(Qn,{open:v,onClose:()=>y(false)})]})}var ar=Object.assign(Xy,{Menu:Vo,File:xs,Format:Ts,Insert:Ss,Help:Cs,Item:Et,Row:Ne,Group:or,Separator:lo,Submenu:io,TableGrid:La,Entry:nr,Open:bs,Save:hs,PageSetup:vs,ReportIssue:Ha});var ox=12240,zp=1440,$p=1440,Up=567,so=20,Es=6,nx=so+Es+2,rx="var(--doc-text-muted)",ax="var(--doc-text-subtle)",Vp="var(--doc-shadow-subtle)",ix="var(--doc-primary)",lx="var(--doc-primary-hover)",sx="var(--doc-text-subtle)",lr=5,ir=7,cx={left:0,right:0,firstLine:0};function Wp(e,t){return t==="inch"?(e/$p).toFixed(2)+'"':(e/Up).toFixed(1)+" cm"}function dx(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function co({pageSetup:e,zoom:t=1,editable:n=false,onLeftMarginChange:o,onRightMarginChange:r,onMarginDragEnd:i,showIndentHandles:a=false,indent:l,indentEditable:c=false,onIndentChange:s,onIndentDragEnd:d,unit:u="inch",className:m="",style:g,tabMarks:p,onTabMarkRemove:f}){let{t:b}=_(),[h,P]=je.useState(null),[x,C]=je.useState(null),[v,y]=je.useState(null),[T,M]=je.useState(null),w=je.useRef(null),E=e?.pageWidthTwips??ox,D=e?.marginsTwips.left??zp,A=e?.marginsTwips.right??zp,H=e?.gutterTwips??0,k={pageWidth:E,leftMargin:D,rightMargin:A},L=l??cx,R=xe(E)*t,I=xe(D)*t,z=xe(A)*t,Z=je.useCallback(q=>{let Ee=w.current?.getBoundingClientRect();return Ee?ea((q-Ee.left)/t):null},[t]),V=je.useCallback((q,Ee,Ue)=>{let ce=Z(Ee);if(ce===null)return;if(M(xe(ce)*t),q==="leftMargin"||q==="rightMargin"){if(q==="leftMargin"){let pn=E-A-H-720,ko=Math.round(Math.max(0,Math.min(ce,pn)));y(ko),o?.(ko);}else {let pn=E-ce,ko=E-D-H-720,Or=Math.round(Math.max(0,Math.min(pn,ko)));y(Or),r?.(Or);}return}let Ge=editor.dragIndent(q,ce,L,k,{unit:u,precise:Ue});y(q==="right"?Ge.right:q==="firstLine"?Ge.firstLine:Ge.left),s?.(Ge);},[Z,t,E,D,A,H,o,r,s,L,k,u]),Y=je.useCallback(q=>{q==="leftMargin"||q==="rightMargin"?i?.():d?.(),P(null),y(null),M(null);},[i,d]),Re=je.useCallback((q,Ee,Ue)=>{let ce=editor.handlePosition(q,L,k),Ge=editor.dragIndent(q,ce+Ee*dx(u,Ue),L,k,{unit:u,precise:true});s?.(Ge),d?.();},[L,k,u,s,d]),se=bx(E,t,u),Se=a&&c&&s!==void 0,Pe=q=>xe(editor.handlePosition(q,L,k))*t,G=(q,Ee,Ue)=>({positionPx:Pe(q),editable:Se,isDragging:h===q,isHovered:x===q,onPointerEnter:()=>C(q),onPointerLeave:()=>C(null),onPointerDown:ce=>{Se&&(ce.preventDefault(),ce.stopPropagation(),ce.currentTarget.setPointerCapture(ce.pointerId),P(q));},onPointerMove:ce=>{h===q&&V(q,ce.clientX,ce.altKey);},onPointerUp:ce=>{h===q&&(ce.currentTarget.releasePointerCapture(ce.pointerId),Y(q));},onKeyDown:ce=>{Se&&(ce.key!=="ArrowLeft"&&ce.key!=="ArrowRight"||(ce.preventDefault(),Re(q,ce.key==="ArrowLeft"?-1:1,ce.shiftKey)));},label:b(Ee),valueNow:Ue,valueText:Wp(Ue,u),pageWidthTwips:E});return jsxRuntime.jsxs("div",{ref:w,className:`docx-horizontal-ruler ${m}`,style:{position:"relative",width:qe(R),height:nx,backgroundColor:"transparent",overflow:"visible",userSelect:"none",touchAction:"none",cursor:h?"ew-resize":"default",flexShrink:0,marginInline:"auto",...g},role:"group","aria-label":b("ruler.horizontal"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:qe(I),height:so,backgroundColor:Vp,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&o?q=>{q.preventDefault(),q.currentTarget.setPointerCapture(q.pointerId),P("leftMargin");}:void 0,onPointerMove:q=>h==="leftMargin"&&V("leftMargin",q.clientX,q.altKey),onPointerUp:q=>{h==="leftMargin"&&(q.currentTarget.releasePointerCapture(q.pointerId),Y("leftMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:qe(z),height:so,backgroundColor:Vp,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&r?q=>{q.preventDefault(),q.currentTarget.setPointerCapture(q.pointerId),P("rightMargin");}:void 0,onPointerMove:q=>h==="rightMargin"&&V("rightMargin",q.clientX,q.altKey),onPointerUp:q=>{h==="rightMargin"&&(q.currentTarget.releasePointerCapture(q.pointerId),Y("rightMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:so,pointerEvents:"none"},children:se.map((q,Ee)=>jsxRuntime.jsx(ux,{tick:q},Ee))}),p?.map(q=>jsxRuntime.jsx(gx,{tabMark:q,positionPx:xe(q.position)*t,onDoubleClick:()=>f?.(q.position)},q.position)),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ps,{direction:"down",anchor:"top",...G("firstLine","ruler.firstLineIndent",L.firstLine)}),jsxRuntime.jsx(Ps,{direction:"up",anchor:"strip",...G("hanging","ruler.hangingIndent",L.left)}),jsxRuntime.jsx(px,{...G("left","ruler.leftIndent",L.left)}),jsxRuntime.jsx(Ps,{direction:"up",anchor:"strip",...G("right","ruler.rightIndent",L.right)})]}),h&&v!==null&&T!==null&&jsxRuntime.jsx(mx,{value:Wp(v,u),positionPx:T})]})}function ux({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:qe(e.position),bottom:0,width:1,height:e.height,backgroundColor:ax}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:qe(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:rx,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Gp(e){return e.editable?e.isDragging||e.isHovered?lx:ix:sx}function Yp(e,t,n){return {position:"absolute",left:qe(e.positionPx-t/2),width:t,cursor:e.editable?"ew-resize":"default",zIndex:e.isDragging?10:4,touchAction:"none",...n}}function jp(e){return {role:"slider","aria-label":e.label,"aria-orientation":"horizontal","aria-valuenow":e.valueNow,"aria-valuemin":-e.pageWidthTwips,"aria-valuemax":e.pageWidthTwips,"aria-valuetext":e.valueText,"aria-disabled":e.editable?void 0:true,tabIndex:e.editable?0:-1}}function Ps({direction:e,anchor:t,...n}){let o=Gp(n),r=t==="top"?{top:0,height:ir+1}:{top:so-ir,height:ir};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:Yp(n,lr*2,r),onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,onPointerDown:n.onPointerDown,onPointerMove:n.onPointerMove,onPointerUp:n.onPointerUp,onKeyDown:n.onKeyDown,...jp(n),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${lr}px solid transparent`,borderRight:`${lr}px solid transparent`,...e==="down"?{top:0,borderTop:`${ir}px solid ${o}`}:{bottom:0,borderBottom:`${ir}px solid ${o}`},transition:"border-color 0.1s"}})})}function px(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:Yp(e,lr*2,{top:so+1,height:Es}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...jp(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:lr*2-2,height:Es,backgroundColor:Gp(e),borderRadius:1,transition:"background-color 0.1s"}})})}function mx({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:qe(t),top:-22,transform:"translateX(-50%)",backgroundColor:"var(--doc-text)",color:"var(--doc-on-primary)",fontSize:"10px",fontFamily:"sans-serif",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap",pointerEvents:"none",zIndex:20},children:e})}var fx={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function gx({tabMark:e,positionPx:t,onDoubleClick:n}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:qe(t-5),top:so-12,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"var(--doc-text-muted)",cursor:"pointer",userSelect:"none"},onDoubleClick:o=>{o.stopPropagation(),n();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:fx[e.alignment]||"L"})}function bx(e,t,n){let o=[];if(n==="inch"){let r=$p/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=xe(l)*t;a%8===0?o.push({position:c,height:8,label:a/8>0?String(a/8):void 0}):a%4===0?o.push({position:c,height:5}):a%2===0?o.push({position:c,height:3}):o.push({position:c,height:2});}}else {let r=Up/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=xe(l)*t;a%10===0?o.push({position:c,height:8,label:a/10>0?String(a/10):void 0}):a%5===0?o.push({position:c,height:5}):o.push({position:c,height:3});}}return o}var yx=15840,Jp=1440,xx=1440,Tx=567,Wo=20,Sx="var(--doc-text-muted)",Cx="var(--doc-text-subtle)",Px="var(--doc-primary)",Ex="var(--doc-primary)",wx="var(--doc-primary-hover)";function sr({pageSetup:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,onMarginDragEnd:i,unit:a="inch",className:l="",style:c}){let{t:s}=_(),[d,u]=je.useState(null),[m,g]=je.useState(null),p=je.useRef(null),f=e?.pageHeightTwips??yx,b=e?.marginsTwips.top??Jp,h=e?.marginsTwips.bottom??Jp,P=xe(f)*t,x=xe(b)*t,C=xe(h)*t,v=je.useCallback((E,D)=>{n&&(E.preventDefault(),u(D));},[n]),y=je.useCallback(E=>{if(!d||!p.current)return;let D=p.current.getBoundingClientRect(),A=E.clientY-D.top,H=ea(A/t);if(d==="topMargin"){let k=f-h-720,L=Math.max(0,Math.min(H,k));o?.(Math.round(L));}else if(d==="bottomMargin"){let k=f-H,L=f-b-720,R=Math.max(0,Math.min(k,L));r?.(Math.round(R));}},[d,t,f,b,h,o,r]),T=je.useCallback(()=>{d!==null&&i?.(),u(null);},[d,i]);je.useEffect(()=>{if(d)return document.addEventListener("mousemove",y),document.addEventListener("mouseup",T),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",T);}},[d,y,T]);let M=Rx(f,t,a),w={position:"relative",width:Wo,height:qe(P),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ns-resize":"default",...c};return jsxRuntime.jsxs("div",{ref:p,className:`docx-vertical-ruler ${l}`,style:w,role:"slider","aria-label":s("ruler.vertical"),"aria-orientation":"vertical",children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:M.map((E,D)=>jsxRuntime.jsx(Mx,{tick:E},D))}),jsxRuntime.jsx(em,{type:"topMargin",position:x,editable:n,isDragging:d==="topMargin",isHovered:m==="topMargin",onMouseEnter:()=>g("topMargin"),onMouseLeave:()=>g(null),onMouseDown:E=>v(E,"topMargin")}),jsxRuntime.jsx(em,{type:"bottomMargin",position:P-C,editable:n,isDragging:d==="bottomMargin",isHovered:m==="bottomMargin",onMouseEnter:()=>g("bottomMargin"),onMouseLeave:()=>g(null),onMouseDown:E=>v(E,"bottomMargin")})]})}function Mx({tick:e}){let t={position:"absolute",top:qe(e.position),right:0,height:1,width:e.width,backgroundColor:Cx},n={position:"absolute",top:qe(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:Sx,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:n,children:e.label})]})}function em({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:l}){let{t:c}=_(),s=o?wx:r?Ex:Px,d={position:"absolute",top:qe(t-5),right:0,width:Wo,height:10,cursor:n?"ns-resize":"default",zIndex:o?10:1},u={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${s}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:d,onMouseEnter:i,onMouseLeave:a,onMouseDown:l,role:"slider","aria-label":c(e==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical",tabIndex:n?0:-1,children:jsxRuntime.jsx("div",{style:u})})}function Rx(e,t,n){let o=[];if(n==="inch"){let r=xx/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=xe(l)*t;if(a%8===0){let s=a/8;o.push({position:c,width:10,label:s>0?String(s):void 0});}else a%4===0?o.push({position:c,width:6}):a%2===0?o.push({position:c,width:4}):o.push({position:c,width:2});}}else {let r=Tx/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=xe(l)*t;if(a%10===0){let s=a/10;o.push({position:c,width:10,label:s>0?String(s):void 0});}else a%5===0?o.push({position:c,width:6}):o.push({position:c,width:3});}}return o}var uo=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var _x=e=>e.formatting?.indent??null,Dx=e=>e.editable;function Rs(){let e=F(),t=B(_x),n=B(Dx),o=je.useMemo(()=>n&&e!==null&&e.can({type:"setIndent",left:0}).ok,[e,n]),r=je.useCallback(i=>e?e.exec({...i.left!==void 0?{left:i.left}:{},...i.right!==void 0?{right:i.right}:{},...i.firstLine!==void 0?{firstLine:i.firstLine}:{},type:"setIndent"}).ok:false,[e]);return je.useMemo(()=>({indent:t,isEnabled:o,apply:r}),[t,o,r])}var am=e=>e.zoom;function im(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function lm(){let{apply:e}=ro(),[t,n]=je.useState({}),o=je.useRef({}),r=je.useCallback(a=>l=>{o.current={...o.current,[a]:Math.round(l)},n(o.current);},[]),i=je.useCallback(()=>{let a=o.current;o.current={},n({}),Object.keys(a).length!==0&&e({...a.top!==void 0?{marginTopTwips:a.top}:{},...a.right!==void 0?{marginRightTwips:a.right}:{},...a.bottom!==void 0?{marginBottomTwips:a.bottom}:{},...a.left!==void 0?{marginLeftTwips:a.left}:{},scope:"section"});},[e]);return {pending:t,preview:r,commit:i}}function rm(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function Lx(){let e=F(),{indent:t,isEnabled:n,apply:o}=Rs(),[r,i]=je.useState(null),a=je.useRef(null),l=je.useRef(null),c=je.useCallback(u=>{l.current===null&&(l.current=rm(e)),a.current=u,i(u);},[e]),s=je.useCallback(()=>{let u=a.current,m=l.current;a.current=null,l.current=null,i(null),u&&(m!==null&&m!==rm(e)||o({left:u.left,right:u.right,firstLine:u.firstLine}));},[e,o]),d=je.useMemo(()=>r??(t?{left:t.left,right:t.right,firstLine:t.firstLine}:null),[r,t]);return je.useMemo(()=>({indent:d,isEnabled:n,preview:c,commit:s}),[d,n,c,s])}function Hx(){let e=St(),[t,n]=je.useState(0);return je.useEffect(()=>{if(!e){n(0);return}let o=()=>n(e.scrollLeft);return o(),e.addEventListener("scroll",o,{passive:true}),()=>e.removeEventListener("scroll",o)},[e]),t}function qa(e){let t=B(uo),{pageSetup:n,isEnabled:o}=ro(),r=B(am),{pending:i,preview:a,commit:l}=lm(),c=Lx(),s=to(),d=Ho(),u=Hx();return t?null:jsxRuntime.jsx("div",{className:"docx-ruler-frame",style:{paddingInlineStart:s+d.inlineStart,paddingRight:d.inlineEnd},children:jsxRuntime.jsx(co,{pageSetup:im(n,i),zoom:r,editable:o,onLeftMarginChange:a("left"),onRightMarginChange:a("right"),onMarginDragEnd:l,showIndentHandles:c.indent!==null,indent:c.indent,indentEditable:c.isEnabled,onIndentChange:c.preview,onIndentDragEnd:c.commit,unit:e.unit??"inch",className:e.className??"",style:{...e.style,transform:`${e.style?.transform?`${e.style.transform} `:""}translateX(${-u}px)`,clipPath:s>0&&u>0?`inset(0 0 0 ${u}px)`:e.style?.clipPath}})})}function Ka(e){let t=B(uo),{pageSetup:n,isEnabled:o}=ro(),r=B(am),{pending:i,preview:a,commit:l}=lm(),c=to(),s=Ho(),d=yd();return t||d!==null&&d>0&&n&&xe(n.pageWidthTwips)*r>d-c-s.inlineStart-s.inlineEnd?null:jsxRuntime.jsx(sr,{pageSetup:im(n,i),zoom:r,editable:o,onTopMarginChange:a("top"),onBottomMarginChange:a("bottom"),onMarginDragEnd:l,unit:e.unit??"inch",className:e.className??"",style:e.style})}function N({size:e=20,className:t="",style:n,children:o}){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 -960 960 960",fill:"currentColor",className:t,style:{display:"inline-flex",flexShrink:0,...n},"aria-hidden":"true",children:o})}function Fx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"})})}function Ox(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"})})}function Zx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"})})}function Bx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function qx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function Kx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})})}function zx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function Vx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"})})}function Wx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"})})}function $x(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"})})}function Ux(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"})})}function Gx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"})})}function Yx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"})})}function jx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function Xx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function Qx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function Jx(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function Ds(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"})})}function eT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"})})}function tT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})})}function oT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function nT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function rT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"})})}function aT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"})})}function iT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"})})}function lT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function sT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"})})}function cT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"})})}function dT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"})})}function uT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"})})}function pT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"})})}function sm(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function mT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"})})}function fT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"})})}function gT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function bT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function hT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function vT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"})})}function yT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"})})}function xT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"})})}function TT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function ST(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"})})}function CT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"})})}function PT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function ET(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function wT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function MT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function RT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function IT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"})})}function kT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"})})}function _T(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"})})}function DT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"})})}function NT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"})})}function LT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"})})}function HT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"})})}function AT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"})})}function FT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function OT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function ZT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function BT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function qT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function KT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"})})}function zT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function VT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function WT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"})})}function $T(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"})})}function UT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"})})}function GT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"})})}function YT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function jT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"})})}function XT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"})})}function QT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"})})}function JT(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function eS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"})})}function tS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function oS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function nS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function rS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function aS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function iS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function lS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"})})}function sS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"})})}function cS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"})})}function dS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function uS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"})})}function pS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function mS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"})})}function fS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"})})}function gS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function bS(e){return jsxRuntime.jsxs(N,{...e,children:[jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"}),jsxRuntime.jsx("path",{fill:"var(--doc-success)",d:"m421-380 227-227-45-45-182 182-92-91-45 45 137 136Z"})]})}function hS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function vS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}function yS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function xS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function TS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"})})}function SS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function CS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"})})}function PS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"})})}function ES(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"})})}function wS(e){return jsxRuntime.jsx(N,{...e,children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}var MS={undo:Fx,redo:Ox,print:Zx,file_download:Bx,file_upload:qx,format_bold:Kx,format_italic:zx,format_underlined:Vx,strikethrough_s:Wx,superscript:$x,subscript:Ux,link:Gx,format_clear:Yx,format_align_left:jx,format_align_center:Xx,format_align_right:Qx,format_align_justify:Jx,format_line_spacing:Ds,format_list_bulleted:eT,format_list_numbered:tT,format_indent_increase:oT,format_indent_decrease:nT,format_color_text:rT,ink_highlighter:aT,format_color_reset:iT,arrow_drop_down:lT,table:sT,table_chart:cT,grid_on:dT,table_rows:uT,view_column:pT,border_all:sm,select_all:sm,border_outer:mT,border_inner:fT,border_clear:gT,add:bT,remove:hT,delete:vT,delete_sweep:yT,call_merge:xT,call_split:TT,drag_indicator:ST,image:CT,format_image_left:PT,format_image_right:ET,horizontal_rule:wT,flip_to_back:MT,flip_to_front:RT,open_with:IT,tune:kT,rotate_right:_T,rotate_left:DT,swap_horiz:NT,swap_vert:LT,shapes:HT,format_paint:AT,expand_more:FT,expand_less:OT,border_top:ZT,border_bottom:BT,border_left:qT,border_right:KT,border_horizontal:zT,border_vertical:VT,padding:WT,text_rotation_none:$T,wrap_text:UT,height:GT,fit_width:YT,settings:jT,border_color:XT,format_color_fill:QT,vertical_align_top:JT,vertical_align_center:eS,vertical_align_bottom:tS,line_weight:oS,keyboard_arrow_up:nS,keyboard_arrow_down:rS,keyboard_arrow_left:aS,keyboard_arrow_right:iS,more_vert:lS,page_break:sS,branding_watermark:cS,arrow_back:dS,search:uS,toc:pS,done_all:mS,check_circle:fS,chat_bubble_outline:gS,chat_bubble_check:bS,check:hS,close:vS,add_comment:yS,comment:xS,edit_note:TS,rate_review:SS,visibility:CS,format_textdirection_l_to_r:PS,format_textdirection_r_to_l:ES,"agent-sparkle":wS};function K({name:e,size:t=20,className:n="",style:o}){let r=MS[e];return r?jsxRuntime.jsx(r,{size:t,className:n,style:o}):(console.warn(`Icon not found: ${e}`),jsxRuntime.jsx("span",{className:n,style:{fontSize:t,width:t,height:t,...o},children:e}))}var cr=12,Ns=240,dm=16,DS=24,NS=cr+Ns+dm,$o=12,LS=36,HS=$o+LS+dm,dr=je__namespace.default.memo(function({headings:t,onHeadingClick:n,onClose:o,topOffset:r=0,scrollLeft:i=0,leftOffset:a=cr}){let{t:l}=_(),[c,s]=je.useState(false),d=t.length?Math.min(...t.map(u=>u.level)):0;return je.useEffect(()=>{requestAnimationFrame(()=>s(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":l("documentOutline.ariaLabel"),style:{position:"absolute",top:r,left:a-i,bottom:0,width:Ns,paddingTop:DS,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:c?"translateX(0)":`translateX(-${a+Ns}px)`,transition:"transform 0.15s ease-out"},onMouseDown:u=>u.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px 0"},children:[jsxRuntime.jsx("button",{onClick:o,"aria-label":l("documentOutline.closeAriaLabel"),style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"var(--doc-text-muted)"},title:l("documentOutline.closeTitle"),children:jsxRuntime.jsx(K,{name:"arrow_back",size:20})}),jsxRuntime.jsx("span",{style:{fontWeight:400,fontSize:14,color:"var(--doc-text)",letterSpacing:"0.01em"},children:l("documentOutline.title")})]}),jsxRuntime.jsx("div",{style:{overflowY:"auto",flex:1,paddingLeft:4},children:t.length===0?jsxRuntime.jsx("div",{style:{padding:"8px 16px",color:"var(--doc-text-subtle)",fontSize:13,lineHeight:"20px"},children:l("documentOutline.noHeadings")}):t.map((u,m)=>jsxRuntime.jsx("div",{style:{marginLeft:(u.level-d)*16},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>n(u.blockId),style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 8px",fontSize:13,fontWeight:400,color:"var(--doc-text)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:0,letterSpacing:"0.01em"},title:u.text,children:u.text})},`${u.blockId}-${m}`))})]})});var OS=e=>e,ZS=Object.freeze([]),BS=()=>{};function Ls(e){let t=F(),n=B(OS),o=je.useMemo(()=>t&&!n.isLoading?t.getOutline():ZS,[t,n]),r=je.useCallback(i=>{if(!t)return;t.focus();let a={paragraphId:i,offset:0};t.exec({type:"setSelection",range:{anchor:a,head:a}}),t.scrollToBlock(i);},[t]);return uo(n)?null:jsxRuntime.jsx(dr,{headings:o,onHeadingClick:r,onClose:e.onClose??BS,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var Hs=je.createContext(null);function Ot(e){let t=je.useContext(Hs);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var Uo=280,za=32,um=16;function mo(e=280){return 32+e+16}function Va({viewportWidth:e,pageWidthPx:t,reservation:n,inlineEndReservation:o=0,inlineStartReservation:r=0,docked:i=false}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0||!Number.isFinite(o)||o<0||!Number.isFinite(r)||r<0)return 0;let a=(e-o-t)/2,l=a>=n?0:!i&&n<=2*a?2*(n-a):n;return Math.ceil(Math.max(0,l-r))}var $S=Object.freeze([]),US=e=>e;function Wa(){let e=F(),t=B(US),[n,o]=je.useState(null),r=je.useMemo(()=>e&&!t.isLoading?e.getOutline():$S,[e,t]),i=je.useMemo(()=>{if(r.length===0)return [];let l=r[0].level;for(let c of r)c.level<l&&(l=c.level);return r.map(c=>({heading:c,depth:c.level-l}))},[r]),a=je.useCallback(l=>{if(!e||typeof l!="string"||l.length===0)return;e.focus();let c={paragraphId:l,offset:0};e.exec({type:"setSelection",range:{anchor:c,head:c}}),e.scrollToBlock(l),o(l);},[e]);return {headings:r,items:i,selectedBlockId:n,goTo:a,isEmpty:r.length===0}}var Os=150,Zs=2e3,Fs=Object.freeze([]),jS=e=>e;function $a(){let e=F(),t=B(jS),[n,o]=je.useState(""),[r,i]=je.useState(""),[a,l]=je.useState(false),[c,s]=je.useState(false),[d,u]=je.useState(Fs),[m,g]=je.useState(-1);je.useEffect(()=>{if(n===r)return;let y=setTimeout(()=>i(n),Os);return ()=>clearTimeout(y)},[n,r]);let p=je.useMemo(()=>({matchCase:a,wholeWord:c}),[a,c]);je.useEffect(()=>{if(!e||r.length===0){u(Fs),g(-1);return}let y=e.findMatches(r,p);u(T=>T===y?T:y);},[e,r,p,t]);let f=je.useRef(d);je.useEffect(()=>{f.current!==d&&(f.current=d,g(y=>y>=0&&y<d.length?y:-1));},[d]);let b=je.useCallback(y=>{if(!e)return;let T=d[y];if(!T)return;e.focus(),e.selectMatch(T).ok&&g(y);},[e,d]),h=je.useCallback(y=>{if(d.length===0)return;let M=((m<0?y>0?-1:0:m)+y+d.length)%d.length;b(M);},[m,b,d.length]),P=je.useCallback(()=>h(1),[h]),x=je.useCallback(()=>h(-1),[h]),C=je.useCallback(y=>o(y),[]),v=je.useCallback(()=>{o(""),i(""),u(Fs),g(-1);},[]);return {query:n,setQuery:C,matchCase:a,setMatchCase:l,wholeWord:c,setWholeWord:s,matches:d,truncated:d.length>=Zs,activeIndex:m,goTo:b,next:P,previous:x,clear:v,isPending:n!==r}}var oC=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,zoom:e.zoom,reviewPaneOpen:e.reviewPaneOpen??true,fitting:t?.type==="fit"&&e.zoom<(t.maxZoom??editor.ZOOM_MAX)&&e.zoom>(t.minZoom??editor.ZOOM_MIN)}},nC=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Ua(e={}){let{defaultOpen:t=false,defaultTab:n="headings",paneWidth:o=280}=e,[r,i]=je.useState(t),[a,l]=je.useState(n),c=e.open??r,s=e.tab??a,{onOpenChange:d,onTabChange:u}=e,m=e.open!==void 0,g=e.tab!==void 0,p=je.useCallback(I=>{m||i(I),d?.(I);},[m,d]),f=je.useCallback(()=>p(!c),[c,p]),b=je.useCallback(I=>{g||l(I),u?.(I);},[g,u]),h=eo(),P=St(),x=je.useContext(rt),{pageSetup:C,zoom:v,reviewPaneOpen:y,fitting:T}=B(oC,nC),[M,w]=je.useState(0),[E,D]=je.useState(0),[A,H]=je.useState(0);je.useEffect(()=>{if(!P){w(0),D(0),H(0);return}let I=()=>{w(P.clientWidth);let Z=getComputedStyle(P),V=Number.parseFloat(Z.paddingInlineEnd);D(Number.isFinite(V)?V:0);let Y=Number.parseFloat(Z.getPropertyValue("--docx-review-gutter-start"));H(Number.isFinite(Y)?Y:0);};if(I(),typeof ResizeObserver>"u")return;let z=new ResizeObserver(I);return z.observe(P),()=>z.disconnect()},[P,c,y,x?.mounted]);let k=je.useRef(null);C&&(k.current=C.pageWidthTwips);let L=C?.pageWidthTwips??k.current,R=je.useMemo(()=>!c||L===null?0:Va({viewportWidth:M,pageWidthPx:xe(L)*v,reservation:mo(o),inlineEndReservation:E,inlineStartReservation:A,docked:T}),[c,L,v,M,o,E,A,T]);return je.useEffect(()=>{if(h)return h.setShift(R),()=>h.setShift(0)},[h,R]),je.useEffect(()=>{if(h)return h.setReservation(c?mo(o):0),()=>h.setReservation(0)},[h,c,o]),{open:c,setOpen:p,toggle:f,tab:s,setTab:b,paneWidth:o,shift:R}}var pr=["headings","find"],bt=(...e)=>e.filter(Boolean).join(" ");function mr({className:e,style:t,children:n}){return jsxRuntime.jsx("div",{className:bt("docx-nav__header",e),style:t,children:n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fr,{}),jsxRuntime.jsx(gr,{})]})})}function fr({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Close");return jsxRuntime.jsx("button",{type:"button",className:bt("docx-nav__close",e),style:t,"aria-label":r("navigation.closeAriaLabel"),title:r("navigation.closeTitle"),onClick:()=>o.setOpen(false),children:n??jsxRuntime.jsx(K,{name:"arrow_back",size:20})})}function gr({className:e,style:t,children:n}){let{t:o}=Ot("Title");return jsxRuntime.jsx("h2",{className:bt("docx-nav__title",e),style:t,children:n??o("navigation.title")})}function br({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Tabs"),i=je.useCallback(a=>{let l=a.key==="ArrowRight"?1:a.key==="ArrowLeft"?-1:0;if(l===0)return;a.preventDefault();let c=pr.indexOf(o.tab);o.setTab(pr[(c+l+pr.length)%pr.length]);},[o]);return jsxRuntime.jsx("div",{className:bt("docx-nav__tabs",e),style:t,role:"tablist","aria-label":r("navigation.title"),onKeyDown:i,children:n??pr.map(a=>jsxRuntime.jsx(hr,{value:a},a))})}function hr({value:e,className:t,style:n,children:o}){let{pane:r,t:i}=Ot("Tab"),a=r.tab===e;return jsxRuntime.jsx("button",{type:"button",role:"tab",id:`docx-nav-tab-${e}`,"aria-selected":a,"aria-controls":`docx-nav-panel-${e}`,tabIndex:a?0:-1,className:bt("docx-nav__tab",a&&"docx-nav__tab--selected",t),style:n,onClick:()=>r.setTab(e),children:o??i(`navigation.tabs.${e}`)})}function mm({value:e,onChange:t,onClear:n,placeholder:o,label:r,clearLabel:i,autoFocus:a}){return jsxRuntime.jsxs("div",{className:"docx-nav__searchbox",children:[jsxRuntime.jsx(K,{name:"search",size:18,className:"docx-nav__search-icon"}),jsxRuntime.jsx("input",{type:"search",className:"docx-nav__search-input",value:e,placeholder:o,"aria-label":r,autoFocus:a,onChange:l=>t(l.target.value)}),e.length>0&&jsxRuntime.jsx("button",{type:"button",className:"docx-nav__search-clear","aria-label":i,onClick:n,children:jsxRuntime.jsx(K,{name:"close",size:16})})]})}function vr({className:e,style:t}){let{pane:n,outline:o,t:r}=Ot("Headings"),[i,a]=je.useState(""),l=B(uo),c=je.useMemo(()=>{let d=i.trim().toLowerCase();return d.length===0?o.items:o.items.filter(u=>u.heading.text.toLowerCase().includes(d))},[o.items,i]),s=n.tab!=="headings";return jsxRuntime.jsxs("div",{className:bt("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-headings","aria-labelledby":"docx-nav-tab-headings",hidden:s,children:[jsxRuntime.jsx(mm,{value:i,onChange:a,onClear:()=>a(""),placeholder:r("navigation.find.placeholder"),label:r("navigation.find.inputAriaLabel"),clearLabel:r("navigation.find.clearAriaLabel")}),l?null:o.isEmpty?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:r("navigation.headings.noHeadings")}):c.length===0?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:r("navigation.find.noResults")}):jsxRuntime.jsx("ul",{className:"docx-nav__list",children:c.map((d,u)=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:bt("docx-nav__heading",o.selectedBlockId===d.heading.blockId&&"docx-nav__heading--current"),style:{paddingInlineStart:`${8+d.depth*14}px`},title:d.heading.text,onClick:()=>o.goTo(d.heading.blockId),children:d.heading.text})},`${d.heading.blockId}-${u}`))})]})}function lC({match:e,active:t,onSelect:n}){return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:bt("docx-nav__result",t&&"docx-nav__result--active"),"aria-current":t?"true":void 0,onClick:n,children:jsxRuntime.jsxs("span",{className:"docx-nav__result-text",children:[e.contextBefore,jsxRuntime.jsx("mark",{className:"docx-nav__result-hit",children:e.text}),e.contextAfter]})})})}function yr({className:e,style:t}){let{pane:n,search:o,t:r}=Ot("Find"),i=n.tab!=="find",a=o.query.trim().length>0,l=o.matches.length===0?null:o.activeIndex<0?r(o.truncated?"navigation.find.totalTruncated":"navigation.find.total",{total:o.matches.length}):r(o.truncated?"navigation.find.counterTruncated":"navigation.find.counter",{current:o.activeIndex+1,total:o.matches.length});return jsxRuntime.jsxs("div",{className:bt("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-find","aria-labelledby":"docx-nav-tab-find",hidden:i,children:[jsxRuntime.jsx(mm,{value:o.query,onChange:o.setQuery,onClear:o.clear,placeholder:r("navigation.find.placeholder"),label:r("navigation.find.inputAriaLabel"),clearLabel:r("navigation.find.clearAriaLabel")}),jsxRuntime.jsxs("div",{className:"docx-nav__options",role:"group","aria-label":r("navigation.find.optionsAriaLabel"),children:[jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:o.matchCase,onChange:c=>o.setMatchCase(c.target.checked)}),r("navigation.find.matchCase")]}),jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:o.wholeWord,onChange:c=>o.setWholeWord(c.target.checked)}),r("navigation.find.wholeWord")]})]}),jsxRuntime.jsxs("div",{className:"docx-nav__resultbar",children:[jsxRuntime.jsx("span",{className:"docx-nav__count","aria-live":"polite",children:a?o.isPending?r("navigation.find.searching"):l??r("navigation.find.noResults"):""}),jsxRuntime.jsxs("span",{className:"docx-nav__steppers",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":r("navigation.find.previousAriaLabel"),disabled:o.matches.length===0,onClick:o.previous,children:jsxRuntime.jsx(K,{name:"keyboard_arrow_up",size:18})}),jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":r("navigation.find.nextAriaLabel"),disabled:o.matches.length===0,onClick:o.next,children:jsxRuntime.jsx(K,{name:"keyboard_arrow_down",size:18})})]})]}),o.matches.length>0&&jsxRuntime.jsx("ul",{className:"docx-nav__list","aria-label":r("navigation.find.resultsAriaLabel"),children:o.matches.map((c,s)=>jsxRuntime.jsx(lC,{match:c,active:s===o.activeIndex,onSelect:()=>o.goTo(s)},`${c.blockId}-${c.start}-${s}`))})]})}function xr({className:e,style:t,children:n}){let{pane:o,t:r}=Ot("Toggle");return jsxRuntime.jsx("button",{type:"button",className:bt("docx-nav__toggle",e),style:t,"aria-label":r("navigation.openAriaLabel"),"aria-expanded":o.open,title:r("navigation.openTitle"),onMouseDown:i=>i.preventDefault(),onClick:o.toggle,children:n??jsxRuntime.jsx(K,{name:"toc",size:20})})}function Ks(e){let t=Ye(),{t:n,toggle:o=true,className:r,style:i,children:a,...l}=e,c=Ua(l),s=Wa(),d=$a(),{t:u}=_(),m=je.useMemo(()=>({pane:c,outline:s,search:d,t:n??((p,f)=>u(p,f))}),[c,s,d,n,u]),g=e.paneWidth??280;return jsxRuntime.jsx(Hs.Provider,{value:m,children:jsxRuntime.jsxs("div",{className:`${t}docx-nav${c.open?" docx-nav--open":""}${r?` ${r}`:""}`,"data-open":c.open?"true":"false",style:{"--docx-nav-width":`${g}px`,"--docx-nav-inset":`${32}px`,"--docx-nav-reservation":`${mo(g)}px`,...i},children:[o!==false&&!c.open&&jsxRuntime.jsx(xr,{...typeof o=="object"?o:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":m.t("navigation.ariaLabel"),inert:!c.open,children:a??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(mr,{}),jsxRuntime.jsx(br,{}),jsxRuntime.jsx(vr,{}),jsxRuntime.jsx(yr,{})]})})]})})}var Ga=Object.assign(Ks,{Header:mr,Close:fr,Title:gr,Tabs:br,Tab:hr,Headings:vr,Find:yr,Toggle:xr});var fC=600,gC=e=>e.page.total,Ya=je.createContext(null);function ja({className:e,style:t}){let n=Ye(),o=F(),r=St(),i=B(gC),{t:a}=_(),l=je.useContext(Ya),[c,s]=je.useState(1),[d,u]=je.useState(false);if(je.useEffect(()=>{if(u(false),!o||!r||i<=1)return;s(o.getCurrentPage("viewport"));let g=null,p=()=>{s(o.getCurrentPage("viewport")),u(true),g&&clearTimeout(g),g=setTimeout(()=>u(false),fC);};return r.addEventListener("scroll",p,{passive:true}),()=>{r.removeEventListener("scroll",p),g&&clearTimeout(g);}},[o,i,r]),i<=1)return null;let m=l?l("viewer.pageIndicator").replace(/\{current\}/g,String(c)).replace(/\{total\}/g,String(i)):a("viewer.pageIndicator",{current:c,total:i});return jsxRuntime.jsx("div",{className:`${n}docx-editor-shell__page-indicator-chip docx-editor__page-number${e?` ${e}`:""}`,style:t,"data-visible":d?"true":"false",role:"status","aria-live":"polite",children:m})}var vC=[],yC=e=>e.fontSubstitutions??vC;function Xa({className:e,style:t,t:n}){let o=B(yC),{t:r}=_(),i=n??r,[a,l]=je.useState(null);if(o.length===0)return null;let c=o.join("\0");return a===c?null:jsxRuntime.jsxs("div",{className:e?`docx-font-notice ${e}`:"docx-font-notice",role:"status",...t?{style:t}:{},children:[jsxRuntime.jsx("span",{className:"docx-font-notice__text",children:i("editor.fontSubstitutionNotice",{fonts:o.join(", ")}).replace("{fonts}",o.join(", "))}),jsxRuntime.jsx("button",{type:"button",className:"docx-font-notice__dismiss",onClick:()=>l(c),children:i("common.dismiss")})]})}var Ve={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function zs(e){return Math.round(e/1440*100)/100}function hm(e){return Math.round(e*1440)}function SC(e,t){return e===t?true:!e||!t?false:e.editing===t.editing&&e.sectionIndex===t.sectionIndex&&e.variant===t.variant&&e.rId===t.rId&&e.partName===t.partName&&e.inherited===t.inherited&&e.titlePage===t.titlePage&&e.evenAndOddHeaders===t.evenAndOddHeaders&&e.headerDistanceTwips===t.headerDistanceTwips&&e.footerDistanceTwips===t.footerDistanceTwips}function Vs(){let e=F(),t=je.useCallback(n=>e?.getHeaderFooterState()??null,[e]);return B(t,SC)}function Qa(e,t,n){let o=e.getBoundingClientRect();return {left:t-o.left-e.clientLeft+e.scrollLeft,top:n-o.top-e.clientTop+e.scrollTop}}function Tr(e,t){let[n,o]=je.useState(null),r=je.useCallback(l=>o(l),[]),[i,a]=je.useState({visibility:"hidden"});return je.useLayoutEffect(()=>{let l=n?.closest(".docx-editor__scroll-container"),c=l??n?.parentElement?.querySelector(".docx-editor__scroll-container");if(!n||!c)return;let s=0,d=null,u=new ResizeObserver(()=>g()),m=()=>{s=0;let f=e(c);if(f!==d&&(u.disconnect(),u.observe(c),u.observe(n),f&&u.observe(f),d=f),!f||!f.isConnected){a({visibility:"hidden"});return}let b=f.getBoundingClientRect(),h=t==="story-label"?Math.max(n.offsetHeight,28):n.offsetHeight,P=t==="story-label"?6:4,x=l===c,C=t==="after"?b.bottom+6:b.top-h-P,v=x?Qa(c,b.left,C):{left:b.left,top:C},y=v.left,T=v.top,M=x?c.scrollLeft+8:8;a({position:x?"absolute":"fixed",left:t==="story-label"?y:Math.max(M,y+8),top:t==="story-label"?T:Math.max(x?c.scrollTop+8:8,T),...t==="story-label"?{width:Math.max(240,Math.min(b.width,c.clientWidth-16))}:{maxWidth:Math.max(240,Math.min(b.width-16,c.clientWidth-16))},visibility:"visible"});},g=()=>{s||(s=requestAnimationFrame(m));};u.observe(c),u.observe(n);let p=new MutationObserver(g);return p.observe(c,{subtree:true,childList:true,attributes:true,attributeFilter:["data-docx-hf-active","data-docx-note-scope"]}),c.addEventListener("scroll",g,{passive:true}),window.addEventListener("resize",g),m(),()=>{s&&cancelAnimationFrame(s),u.disconnect(),p.disconnect(),c.removeEventListener("scroll",g),window.removeEventListener("resize",g);}},[n,e,t]),{ref:r,style:i}}function MC(e,t){return t==="first"?e==="header"?"headerFooter.firstPageHeader":"headerFooter.firstPageFooter":t==="even"?e==="header"?"headerFooter.evenPageHeader":"headerFooter.evenPageFooter":e==="header"?"headerFooter.header":"headerFooter.footer"}var RC=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function Sr(e){let t=F();return je.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let n=t.can(e);return n.ok?{enabled:true,reason:null}:{enabled:false,reason:n.reason}},[t,e])}function IC(e){let{state:t,onMouseDown:n}=e,{t:o}=_(),r=F(),[i,a]=je.useState(false),l=je.useRef(null),[c,s]=je.useState(""),[d,u]=je.useState("");je.useEffect(()=>{i&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(s(String(zs(t.headerDistanceTwips))),u(String(zs(t.footerDistanceTwips)))));},[i,t.headerDistanceTwips,t.footerDistanceTwips]),je.useEffect(()=>{if(!i)return;let T=M=>{l.current?.contains(M.target)||a(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]);let m=je.useMemo(()=>({type:"setHeaderFooterOptions",titlePage:!t.titlePage}),[t.titlePage]),g=je.useMemo(()=>({type:"setHeaderFooterOptions",evenAndOddHeaders:!t.evenAndOddHeaders}),[t.evenAndOddHeaders]),p=je.useMemo(()=>({type:"linkHeaderFooterToPrevious"}),[]),f=je.useMemo(()=>({type:"unlinkHeaderFooterFromPrevious"}),[]),b=je.useMemo(()=>({type:"removeHeaderFooter",position:t.editing}),[t.editing]),h=Sr(m),P=Sr(g),x=Sr(p),C=Sr(f),v=Sr(b),y=(T,M)=>{if(!r)return;let w=Number.parseFloat(M);Number.isFinite(w)&&r.exec({type:"setHeaderFooterOptions",[T]:hm(w)});};return jsxRuntime.jsxs("div",{ref:l,className:"docx-hf-chrome__options",onMouseDown:n,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","aria-expanded":i,"aria-haspopup":"menu",onClick:()=>a(T=>!T),onMouseDown:n,children:o("headerFooter.options")}),i?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:n,children:[RC.map(T=>{let M={type:"insertPageField",field:T.field},w=r?.can(M);return jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!w?.ok,title:w&&!w.ok?w.reason:void 0,onClick:()=>{r?.exec(M),a(false);},onMouseDown:n,children:o(T.labelKey)},T.field)}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.titlePage===true,disabled:!h.enabled,title:h.reason??void 0,onChange:()=>r?.exec(m)}),jsxRuntime.jsx("span",{children:o("headerFooter.differentFirstPage")})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.evenAndOddHeaders===true,disabled:!P.enabled,title:P.reason??void 0,onChange:()=>r?.exec(g)}),jsxRuntime.jsxs("span",{children:[o("headerFooter.differentOddEven"),jsxRuntime.jsx("span",{className:"docx-hf-chrome__menu-hint",children:o("headerFooter.differentOddEvenHint")})]})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),t.inherited?jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!C.enabled,title:C.reason??void 0,onClick:()=>r?.exec(f),onMouseDown:n,children:o("headerFooter.unlinkFromPrevious")}):jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!x.enabled,title:x.reason??void 0,onClick:()=>r?.exec(p),onMouseDown:n,children:o("headerFooter.linkToPrevious")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:o("headerFooter.headerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":o("headerFooter.headerDistance"),value:c,onChange:T=>s(T.target.value),onBlur:()=>y("headerDistanceTwips",c)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:o("headerFooter.footerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":o("headerFooter.footerDistance"),value:d,onChange:T=>u(T.target.value),onBlur:()=>y("footerDistanceTwips",d)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!v.enabled,title:v.reason??void 0,onClick:()=>r?.exec(b),onMouseDown:n,children:t.editing==="header"?o("headerFooter.removeHeader"):o("headerFooter.removeFooter")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-hf-close",onClick:()=>{r?.exec({type:"exitHeaderFooter"}),a(false);},onMouseDown:n,children:o("common.close")})]}):null]})}function Ja({className:e}){let{t}=_(),n=Vs(),o=je.useCallback(l=>l.querySelector("[data-docx-hf-active]"),[]),r=Tr(o,"story-label"),i=O;if(!n?.editing)return null;let a=MC(n.editing,n.variant);return jsxRuntime.jsxs("div",{ref:r.ref,className:`docx-context-bar docx-hf-chrome${e?` ${e}`:""}`,role:"region","aria-label":t("headerFooter.chromeAriaLabel"),"data-testid":"docx-hf-chrome",onMouseDown:i,style:{...r.style,zIndex:Ve.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(a)}),n.inherited?jsxRuntime.jsx("span",{className:"docx-context-bar__status","data-testid":"docx-hf-inherited",title:t("headerFooter.sameAsPreviousHint"),children:t("headerFooter.sameAsPrevious")}):null]}),jsxRuntime.jsx(IC,{state:n,onMouseDown:i})]})}function bo(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var ei=e=>jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:16,height:16,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})}),AC="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z",FC="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z",OC="M770-302 656-416l57-57 114 114-57 57ZM603-469 469-603l57-57 134 134-57 57ZM280-280h133v80H280q-83 0-141.5-58.5T80-400q0-83 58.5-141.5T280-600h133v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35Zm40-80v-80h101l80 80H320Zm493-15-57-57q23-11 33.5-32t10.5-36q0-50-35-85t-85-35H547v-80h133q83 0 141.5 58.5T880-400q0 32-11 61.5T813-375ZM792-56 56-792l56-56 736 736-56 56Z",ZC="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z";function BC({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let i=ht(),a=je.useRef(null),{state:l,close:c}=i;je.useEffect(()=>{if(l.mode==="closed")return;let f=h=>{h.key==="Escape"&&(h.preventDefault(),c());},b=h=>{let P=a.current;P&&h.target instanceof Node&&P.contains(h.target)||c();};return document.addEventListener("keydown",f),document.addEventListener("mousedown",b,true),()=>{document.removeEventListener("keydown",f),document.removeEventListener("mousedown",b,true);}},[l.mode,c]);let[s,d]=je.useState(null);je.useLayoutEffect(()=>{let f=l.anchor,b=a.current;if(!f||!b){d(null);return}let h=b.offsetParent;if(!h){d(null);return}let{left:P,top:x}=Qa(h,f.left,f.top),C=Math.max(0,h.scrollWidth-b.offsetWidth);d({left:Math.max(0,Math.min(P,C)),top:x});},[l.anchor]);let{t:u}=_(),m=l.mode==="editing"?u(l.link?"hyperlinkPopup.editTitle":"hyperlinkPopup.insertTitle"):u("hyperlinkPopup.editLink"),g=r?jsxRuntime.jsx(qC,{children:o}):o;if(n)return l.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:o});let p={ref:a,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":l.mode,role:"dialog","aria-modal":false,onMouseDown:bo,style:s??void 0,"aria-label":m};return l.mode==="closed"?null:t?jsxRuntime.jsx($,{...p,children:o}):jsxRuntime.jsx("div",{...p,children:g})}function qC({children:e}){let{state:t}=ht(),n=je.useMemo(()=>KC(e),[e]),o=(i,a)=>i in n?n[i]:a;if(t.mode==="editing")return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Fields",jsxRuntime.jsx(Xs,{})),o("Error",jsxRuntime.jsx(Js,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Apply",jsxRuntime.jsx(Qs,{})),o("Cancel",jsxRuntime.jsx(ec,{}))]}),n.__extra]});let r=t.canEdit&&!(t.link&&yn(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Url",jsxRuntime.jsx(Us,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Copy",jsxRuntime.jsx(Gs,{})),r?o("Edit",jsxRuntime.jsx(Ys,{})):null,r?o("Unlink",jsxRuntime.jsx(js,{})):null]}),n.__extra]})}function KC(e){let t={},n=[],o=r=>{if(Array.isArray(r)){r.forEach(o);return}if(!r||typeof r!="object"||!("type"in r)){r&&n.push(r);return}if(r.type===je.Fragment){o(r.props.children);return}let i=r.type.docxHyperLinkPart;i?t[i]=r:n.push(r);};return o(e),n.length>0&&(t.__extra=n),t}function ht(){return je.useContext(xn)??zC}var zC={state:{mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:false},open:()=>{},openAtCaret:()=>{},close:()=>{},copy:async()=>false,beginEdit:()=>{},setText:()=>{},setUrl:()=>{},commitEdit:()=>false,unlink:()=>false,openTarget:()=>false};function Us({className:e,asChild:t,hidden:n,children:o}){let{state:r,openTarget:i}=ht(),{t:a}=_();if(n||!r.link)return null;let l=!r.link.href,c=r.link.kind==="internal",s=c?`#${r.link.anchor??""}`:r.link.authored,d=a(l?"hyperlinkPopup.inertTarget":c?"hyperlinkPopup.bookmarkTarget":"hyperlinkPopup.openLink"),u={className:`docx-hyperlink-popup__url${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-url",...l?{"data-inert":""}:{},title:d,onMouseDown:bo,...l?{}:{onClick:()=>i(),type:"button"}};return t?jsxRuntime.jsx($,{...u,children:o}):l?jsxRuntime.jsxs("span",{...u,children:[o??s,jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:d})]}):jsxRuntime.jsxs("button",{...u,children:[o??s,ei(ZC)]})}Us.docxHyperLinkPart="Url";function Gs({className:e,asChild:t,hidden:n,children:o,icon:r}){let{state:i,copy:a}=ht(),{t:l}=_();if(n||!i.link?.href)return null;let c=i.copied?l("editor.linkCopied"):l("hyperlinkPopup.copyLink"),s={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-copy",...i.copied?{"data-copied":""}:{},"aria-label":c,title:c,onMouseDown:bo,onClick:()=>{a();}};return t?jsxRuntime.jsx($,{...s,children:o}):jsxRuntime.jsx("button",{...s,children:r??o??ei(AC)})}Gs.docxHyperLinkPart="Copy";function Ys({className:e,asChild:t,hidden:n,children:o,icon:r}){let{beginEdit:i}=ht(),{t:a}=_();if(n)return null;let l=a("hyperlinkPopup.editLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-edit","aria-label":l,title:l,onMouseDown:bo,onClick:()=>i()};return t?jsxRuntime.jsx($,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??ei(FC)})}Ys.docxHyperLinkPart="Edit";function js({className:e,asChild:t,hidden:n,children:o,icon:r}){let{unlink:i}=ht(),{t:a}=_();if(n)return null;let l=a("hyperlinkPopup.removeLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-unlink","aria-label":l,title:l,onMouseDown:bo,onClick:()=>i()};return t?jsxRuntime.jsx($,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??ei(OC)})}js.docxHyperLinkPart="Unlink";function Xs({className:e,hidden:t}){let{state:n,setText:o,setUrl:r,commitEdit:i,close:a}=ht(),{t:l}=_(),c=je.useRef(null),s=je.useId(),d=je.useId();je.useEffect(()=>{n.mode==="editing"&&(c.current?.focus({preventScroll:true}),c.current?.select());},[n.mode]);let u=je.useCallback(m=>{if(m.key==="Enter"){m.preventDefault(),i();return}m.key==="Escape"&&(m.preventDefault(),a());},[i,a]);return t?null:jsxRuntime.jsxs("div",{className:`docx-hyperlink-popup__fields${e?` ${e}`:""}`,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:s,children:l("hyperlinkPopup.displayTextPlaceholder")}),jsxRuntime.jsx("input",{id:s,"data-testid":"hyperlink-popup-text",className:"docx-hyperlink-popup__input",value:n.text,placeholder:l("hyperlinkPopup.displayTextPlaceholder"),onChange:m=>o(m.target.value),onKeyDown:u}),jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:d,children:l("hyperlinkPopup.urlPlaceholder")}),jsxRuntime.jsx("input",{id:d,ref:c,"data-testid":"hyperlink-popup-url-input",className:"docx-hyperlink-popup__input",value:n.url,placeholder:l("hyperlinkPopup.urlPlaceholder"),onChange:m=>r(m.target.value),onKeyDown:u})]})}Xs.docxHyperLinkPart="Fields";function Qs({className:e,asChild:t,hidden:n,children:o}){let{state:r,commitEdit:i}=ht(),{t:a}=_();if(n)return null;let l=a("hyperlinkPopup.apply"),c={type:"button",className:`docx-hyperlink-popup__apply${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-apply",disabled:r.url.trim().length===0,onMouseDown:bo,onClick:()=>i()};return t?jsxRuntime.jsx($,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:o??l})}function Js({className:e,hidden:t}){let{state:n}=ht(),{t:o}=_();return t||!n.error?null:jsxRuntime.jsx("div",{className:`docx-hyperlink-popup__error${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-error",role:"alert",children:o("hyperlinkPopup.refused")})}Js.docxHyperLinkPart="Error";Qs.docxHyperLinkPart="Apply";function ec({className:e,asChild:t,hidden:n,children:o}){let{close:r}=ht(),{t:i}=_();if(n)return null;let a=i("hyperlinkPopup.cancel"),l={type:"button",className:`docx-hyperlink-popup__cancel${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-cancel",onMouseDown:bo,onClick:()=>r()};return t?jsxRuntime.jsx($,{...l,children:o}):jsxRuntime.jsx("button",{...l,children:o??a})}ec.docxHyperLinkPart="Cancel";var ti=Object.assign(BC,{Url:Us,Copy:Gs,Edit:Ys,Unlink:js,Fields:Xs,Error:Js,Apply:Qs,Cancel:ec});function VC(e,t){return e===t?true:!e||!t||e.kind!==t.kind?false:e.kind==="note"&&t.kind==="note"?e.id===t.id:e.kind==="headerFooter"&&t.kind==="headerFooter"?e.rId===t.rId:true}function tc(){let e=F(),t=je.useCallback(o=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),n=B(t,VC);return n?.kind==="note"?n:null}function Cm(e,t){return e===t?true:!e||!t?false:e.pos===t.pos&&e.numFmt===t.numFmt&&e.numStart===t.numStart&&e.numRestart===t.numRestart}function Pm(e,t){return e.resolved.pos===t.resolved.pos&&e.resolved.numFmt===t.resolved.numFmt&&e.resolved.numStart===t.resolved.numStart&&e.resolved.numRestart===t.resolved.numRestart&&Cm(e.documentAuthored,t.documentAuthored)&&Cm(e.sectionAuthored,t.sectionAuthored)}function WC(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&Pm(e.footnote,t.footnote)&&Pm(e.endnote,t.endnote)}function oc(){let e=F(),t=je.useCallback(n=>e?.getNotePropertiesState()??null,[e]);return B(t,WC)}var $C=/^(footnote|endnote):(-?\d{1,10})$/;function wm(e){let t=$C.exec(e);if(!t)return null;let n=Number(t[2]);return Number.isInteger(n)?{noteKind:t[1],noteId:n}:null}function UC(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function rc(e){let t=F();return je.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let n=t.can(e);return n.ok?{enabled:true,reason:null}:{enabled:false,reason:n.reason}},[t,e])}function GC(e){let{t}=_(),[n,o]=je.useState(false),r=je.useRef(null);return je.useEffect(()=>{if(!n)return;let i=a=>{r.current?.contains(a.target)||o(false);};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),jsxRuntime.jsxs("div",{ref:r,className:"docx-hf-chrome__options",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","data-testid":"docx-notes-options","aria-expanded":n,"aria-haspopup":"menu",onMouseDown:O,onClick:()=>o(i=>!i),children:t("headerFooter.options")}),n?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:O,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-properties",onClick:()=>{e.onOpenProperties(),o(false);},children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-close",onClick:()=>{e.onClose(),o(false);},children:t("common.close")})]}):null]})}function oi({className:e}){let{t}=_(),n=F(),o=tc(),[r,i]=je.useState(null),[a,l]=je.useState(null),[c,s]=je.useState(false),d=je.useRef(null),u=je.useCallback(w=>{if(!o)return null;let D=[...w.querySelectorAll("[data-docx-note-scope]")].find(A=>A.matches("[data-docx-note]")&&A.dataset.docxNoteScope===o.id)??null;return D?.closest("[data-docx-notes]")??D},[o]),m=Tr(u,"story-label"),g=je.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=null,i(null);},[]);je.useEffect(()=>{if(!n)return;let w=document.querySelector(".docx-pages");if(!w)return;let E=H=>{let k=H.target;if(!k)return;let L=k.closest("[data-docx-note-ref]");if(L?.dataset.docxNoteScope){H.preventDefault(),g(),l(null),n.setActiveScope({kind:"note",id:L.dataset.docxNoteScope});return}k.closest("[data-docx-note-mark-back]")&&(H.preventDefault(),g(),l(null),n.setActiveScope({kind:"body"}));},D=H=>{let k=H,R=k.target?.closest("[data-docx-note-scope]");R?.dataset.docxNoteScope&&(k.preventDefault(),l({scopeId:R.dataset.docxNoteScope,x:k.clientX,y:k.clientY}));},A=H=>{if(UC())return;let L=H.target?.closest("[data-docx-note-ref]");if(!L?.dataset.docxNoteScope){g();return}let R=L.dataset.docxNoteScope,z=n.getNotePreviewText(R)??L.getAttribute("aria-description")??t("notes.previewFallback"),Z=L.getBoundingClientRect();d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{i({scopeId:R,text:z,x:Z.left,y:Z.bottom+4});},400);};return w.addEventListener("click",E),w.addEventListener("contextmenu",D),w.addEventListener("pointerover",A),w.addEventListener("scroll",g,true),()=>{w.removeEventListener("click",E),w.removeEventListener("contextmenu",D),w.removeEventListener("pointerover",A),w.removeEventListener("scroll",g,true),g();}},[n,g,t]);let p=je.useCallback(w=>{n&&(n.exec(w),l(null));},[n]),f=a?wm(a.scopeId):null,b=je.useMemo(()=>f?{type:"deleteNote",noteKind:f.noteKind,noteId:f.noteId}:null,[f]),h=je.useMemo(()=>f?{type:"convertNote",fromKind:f.noteKind,noteId:f.noteId}:null,[f]),P=je.useMemo(()=>f?{type:"convertAllNotes",fromKind:f.noteKind}:null,[f]),x=rc(b??{type:"deleteNote",noteKind:"footnote",noteId:0}),C=rc(h??{type:"convertNote",fromKind:"footnote",noteId:0}),v=rc(P??{type:"convertAllNotes",fromKind:"footnote"}),y=je.useMemo(()=>({position:"fixed",left:r?.x??0,top:r?.y??0,zIndex:Ve.popover,maxWidth:280,maxHeight:"40vh",overflowY:"auto",padding:"8px 10px",background:"var(--doc-popover-bg, #fff)",color:"var(--doc-popover-fg, #111)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",fontSize:12,lineHeight:1.4,pointerEvents:"none"}),[r]),T=o?wm(o.id):null,M=T?t("notes.editingRegion",{kind:T.noteKind==="footnote"?t("notes.footnoteKind"):t("notes.endnoteKind"),number:T.noteId}):null;return n?jsxRuntime.jsxs("div",{className:e,"data-docx-notes-chrome":"","data-testid":"docx-notes-chrome","aria-hidden":o?void 0:true,children:[o&&T?jsxRuntime.jsxs("div",{ref:m.ref,className:"docx-context-bar docx-notes-chrome__banner",role:"region","aria-label":t("notes.chromeAriaLabel"),"data-testid":"docx-notes-banner","data-note-scope":o.id,style:{...m.style,zIndex:Ve.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:M}),jsxRuntime.jsx(GC,{onOpenProperties:()=>s(true),onClose:()=>n.setActiveScope({kind:"body"})})]}):null,r?jsxRuntime.jsx("div",{role:"tooltip","data-testid":"docx-notes-preview",style:y,onMouseDown:w=>{w.preventDefault(),w.stopPropagation();},children:r.text}):null,a&&f?jsxRuntime.jsxs("div",{role:"menu","data-testid":"docx-notes-menu",style:{position:"fixed",left:a.x,top:a.y,zIndex:Ve.popover,minWidth:160,background:"var(--doc-popover-bg, #fff)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",padding:4},onMouseDown:O,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-delete",disabled:!x.enabled,title:x.reason??void 0,onClick:()=>b&&p(b),children:t("notes.delete")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert",disabled:!C.enabled,title:C.reason??void 0,onClick:()=>h&&p(h),children:f.noteKind==="footnote"?t("notes.convertToEndnote"):t("notes.convertToFootnote")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert-all",disabled:!v.enabled,title:v.reason??void 0,onClick:()=>P&&p(P),children:f.noteKind==="footnote"?t("notes.convertAllFootnotes"):t("notes.convertAllEndnotes")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",onClick:()=>s(true),children:t("dialogs.footnoteProperties.title")})]}):null,c?jsxRuntime.jsx(YC,{onClose:()=>s(false),onApply:w=>{p(w),s(false);}}):null]}):null}function YC(e){let{t}=_(),n=F(),o=oc(),[r,i]=je.useState("document"),[a,l]=je.useState("decimal"),[c,s]=je.useState("continuous"),[d,u]=je.useState("pageBottom"),[m,g]=je.useState("decimal"),[p,f]=je.useState("continuous"),[b,h]=je.useState("docEnd");je.useEffect(()=>{o&&(l(o.footnote.resolved.numFmt),s(o.footnote.resolved.numRestart),u(o.footnote.resolved.pos),g(o.endnote.resolved.numFmt),f(o.endnote.resolved.numRestart),h(o.endnote.resolved.pos));},[o]);let P=!o?.footnote.documentAuthored&&!o?.footnote.sectionAuthored,x=!o?.endnote.documentAuthored&&!o?.endnote.sectionAuthored;return jsxRuntime.jsx("div",{className:"docx-note-properties",role:"dialog","aria-modal":"true","aria-label":t("dialogs.footnoteProperties.title"),"data-testid":"docx-notes-properties-dialog",style:{zIndex:Ve.modal},onClick:e.onClose,onKeyDown:C=>{C.key==="Escape"&&e.onClose();},children:jsxRuntime.jsxs("div",{className:"docx-note-properties__panel",onClick:C=>C.stopPropagation(),onMouseDown:C=>C.stopPropagation(),children:[jsxRuntime.jsx("h2",{className:"docx-note-properties__title",children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-note-properties__body",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__scope",children:[jsxRuntime.jsx("span",{children:t("notes.scope")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:r,onChange:C=>i(C.target.value),children:[jsxRuntime.jsx("option",{value:"document",children:t("notes.scopeDocument")}),jsxRuntime.jsx("option",{value:"section",children:t("notes.scopeSection")})]})]}),jsxRuntime.jsxs("fieldset",{className:"docx-note-properties__section",children:[jsxRuntime.jsxs("legend",{className:"docx-note-properties__legend",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.footnotes")}),P?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:a,onChange:C=>l(C.target.value),children:[jsxRuntime.jsx("option",{value:"decimal",children:t("dialogs.footnoteProperties.formats.decimal")}),jsxRuntime.jsx("option",{value:"lowerRoman",children:t("dialogs.footnoteProperties.formats.lowerRoman")}),jsxRuntime.jsx("option",{value:"upperRoman",children:t("dialogs.footnoteProperties.formats.upperRoman")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numbering")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:c,onChange:C=>s(C.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsxRuntime.jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsxRuntime.jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.position")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:d,onChange:C=>u(C.target.value),children:[jsxRuntime.jsx("option",{value:"pageBottom",children:t("dialogs.footnoteProperties.footnotePositions.bottomOfPage")}),jsxRuntime.jsx("option",{value:"beneathText",children:t("dialogs.footnoteProperties.footnotePositions.belowText")})]})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"docx-note-properties__section",children:[jsxRuntime.jsxs("legend",{className:"docx-note-properties__legend",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.endnotes")}),x?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:m,onChange:C=>g(C.target.value),children:[jsxRuntime.jsx("option",{value:"decimal",children:t("dialogs.footnoteProperties.formats.decimal")}),jsxRuntime.jsx("option",{value:"lowerRoman",children:t("dialogs.footnoteProperties.formats.lowerRoman")}),jsxRuntime.jsx("option",{value:"upperRoman",children:t("dialogs.footnoteProperties.formats.upperRoman")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numbering")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:p,onChange:C=>f(C.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsxRuntime.jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsxRuntime.jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.position")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:b,"data-testid":"docx-notes-endnote-position",onChange:C=>h(C.target.value),children:[jsxRuntime.jsx("option",{value:"docEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfDocument")}),jsxRuntime.jsx("option",{value:"sectEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfSection")})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__footer",children:[jsxRuntime.jsx("button",{className:"docx-note-properties__button",type:"button",onClick:e.onClose,children:t("common.cancel")}),jsxRuntime.jsx("button",{className:"docx-note-properties__button docx-note-properties__button--primary",type:"button","data-testid":"docx-notes-properties-apply",onClick:()=>{if(!n)return;let C={type:"setNoteProperties",scope:r,sectionIndex:r==="section"?o?.sectionIndex:void 0,footnote:{numFmt:a,numRestart:c,position:d},endnote:{numFmt:m,numRestart:p,position:b}};n.can(C).ok&&e.onApply(C);},children:t("common.apply")})]})]})})}var ni=je.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function ho(){return je.useContext(ni)}function Im(){return je.useContext(ni).target}var km=["M760-120 480-400l-94 94q8 15 11 32t3 34q0 66-47 113T240-80q-66 0-113-47T80-240q0-66 47-113t113-47q17 0 34 3t32 11l94-94-94-94q-15 8-32 11t-34 3q-66 0-113-47T80-720q0-66 47-113t113-47q66 0 113 47t47 113q0 17-3 34t-11 32l494 494v40H760ZM600-560l-80-80 240-240h120v40L600-560ZM240-640q33 0 56.5-23.5T320-720q0-33-23.5-56.5T240-800q-33 0-56.5 23.5T160-720q0 33 23.5 56.5T240-640Zm240 180q8 0 14-6t6-14q0-8-6-14t-14-6q-8 0-14 6t-6 14q0 8 6 14t14 6Zm-240 300q33 0 56.5-23.5T320-240q0-33-23.5-56.5T240-320q-33 0-56.5 23.5T160-240q0 33 23.5 56.5T240-160Z"],_m=["M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"],Dm=["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h168q13-36 43.5-58t68.5-22q38 0 68.5 22t43.5 58h168q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm280-560q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z"],Nm=["M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"],Lm=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],Hm=["M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"],Am=["M280-280v-400h400v400H280Zm80-80h240v-240H360v240ZM200-120q-33 0-56.5-23.5T120-200h80v80Zm-80-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160q0-33 23.5-56.5T200-840v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80q0 33-23.5 56.5T760-120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80q33 0 56.5 23.5T840-760h-80Z"];function ri(e,t,n){return Object.assign(({icon:r,labelKey:i,shortcutKey:a,className:l,hidden:c})=>{let s=F(),{close:d}=ho(),u=_e(),{isEnabled:m,disabledReason:g}=ne(t);return c?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??te(n.paths),shortcut:u(a??n.shortcutKey),disabled:!m,...g?{title:g}:{},onSelect:()=>{s?.exec(t),d(true);},...l?{className:l}:{},children:u(i??n.labelKey)})},{docxRow:e})}var Pr=ri("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:km}),Er=ri("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:_m}),wr=ri("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:Nm}),Mr=ri("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:Am});function Xo({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let i=F(),{close:a,clipboardRefusal:l,reportClipboardRefusal:c}=ho(),s=_e(),d=je.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:u,disabledReason:m}=ne(d);if(r)return null;let g=l!==null;return jsxRuntime.jsx(Ne,{slot:"edit.paste",icon:e??te(Dm),shortcut:s(n??"contextMenu.pasteShortcut"),disabled:!u||g,...l??m?{title:l??m??""}:{},onSelect:()=>{(async()=>{try{let p=await navigator.clipboard.readText();p&&i?.exec({type:"paste",text:p});}catch(p){c(p instanceof Error?p.message:"the clipboard is not readable");}finally{a(true);}})();},...o?{className:o}:{},children:s(t??"contextMenu.paste")})}Xo.docxRow="edit.paste";function vo(e,t,n){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l,destructive:c})=>{let{close:s}=ho(),d=_e(),u=ai(),{isEnabled:m,disabledReason:g,execute:p}=ne(t);return l||!u?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??te(n.paths),disabled:!m,...g?{title:g}:{},className:`${c??n.destructive?"docx-table-chrome__destructive-row":""}${a?` ${a}`:""}`,onSelect:()=>{p()&&s(true);},children:d(i??n.labelKey)})},{docxRow:e})}var Qo=vo("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),Jo=vo("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),en=vo("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),tn=vo("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),on=vo("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),nn=vo("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),rn=vo("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),QC=[{alignment:"top",labelKey:"tableAdvanced.top",icon:"vertical_align_top"},{alignment:"center",labelKey:"tableAdvanced.middle",icon:"vertical_align_center"},{alignment:"bottom",labelKey:"tableAdvanced.bottom",icon:"vertical_align_bottom"}];function yo({hidden:e}){let{close:t}=ho(),n=_e(),o=ai(),r=ne({type:"setTableCellVerticalAlignment",alignment:"top"}),i=ne({type:"setTableCellVerticalAlignment",alignment:"center"}),a=ne({type:"setTableCellVerticalAlignment",alignment:"bottom"}),l=[r,i,a];return e||!o?null:jsxRuntime.jsxs("div",{className:"docx-contextmenu__table-align",children:[jsxRuntime.jsx("span",{className:"docx-contextmenu__table-align-label",children:n("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{className:"docx-contextmenu__table-align-buttons",role:"group","aria-label":n("tableAdvanced.verticalAlignment"),children:QC.map((c,s)=>{let d=l[s];return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":false,"aria-label":n(c.labelKey),title:d.disabledReason??n(c.labelKey),"aria-disabled":!d.isEnabled,className:"docx-contextmenu__table-align-button",onMouseDown:u=>{u.preventDefault(),u.stopPropagation();},onClick:()=>{d.execute()&&t(true);},children:te(editor.tableChromeIconPaths(c.icon))},c.alignment)})})]})}yo.docxRow="table.cellVerticalAlignment";function Om(e,t,n){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l})=>{let c=F(),{close:s,tocId:d}=ho(),u=_e(),m=je.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:g,disabledReason:p}=ne(m);return l||d===null?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??te(n.paths),disabled:!g,...p?{title:p}:{},onSelect:()=>{c?.exec(m),s(true);},...a?{className:a}:{},children:u(i??n.labelKey)})},{docxRow:e})}var an=Om("toc.refresh","entire",{labelKey:"toc.refresh",paths:Lm}),ln=Om("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:Hm});function ai(){return B(je.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function ii({label:e,icon:t,shortcut:n,disabled:o,disabledReason:r,active:i,onSelect:a,className:l}){let{close:c}=ho();return jsxRuntime.jsx(Ne,{...t?{icon:t}:{},...n?{shortcut:n}:{},...o?{disabled:o}:{},...o&&r?{title:r}:{},...i!==void 0?{active:i}:{},onSelect:()=>{a?.(),c(true);},...l?{className:l}:{},children:e})}var ci=8,oP=e=>e.editingMode==="viewing";function nP(){let e=F(),t=je.useContext(rt),n=Je(),o=_e(),r=e?.can({type:"toggleReviewPane"}),i=B(oP),a=!r?.ok||i||(t?.mounted??0)===0||e?.getSelectionPlacement()===null,l=X("review.comments");return jsxRuntime.jsx(Ne,{icon:te(l?.paths),slot:"review.comments",disabled:a,title:r&&!r.ok?r.reason:i?o("editingMode.viewingHint"):void 0,onSelect:()=>{t?.requestCommentDraft()&&n.setOpenMenu(null);},children:o("comments.addComment")})}var rP=[{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(Pr,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(Er,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(Xo,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(wr,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(Mr,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(Et,{slot:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.comments",render:()=>jsxRuntime.jsx(nP,{})}];function aP(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:Qo.docxRow,render:()=>jsxRuntime.jsx(Qo,{})},{kind:"row",id:Jo.docxRow,render:()=>jsxRuntime.jsx(Jo,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:en.docxRow,render:()=>jsxRuntime.jsx(en,{})},{kind:"row",id:tn.docxRow,render:()=>jsxRuntime.jsx(tn,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:on.docxRow,render:()=>jsxRuntime.jsx(on,{})},{kind:"row",id:nn.docxRow,render:()=>jsxRuntime.jsx(nn,{})},{kind:"row",id:rn.docxRow,render:()=>jsxRuntime.jsx(rn,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:yo.docxRow,render:()=>jsxRuntime.jsx(yo,{})}]}function iP(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:an.docxRow,render:()=>jsxRuntime.jsx(an,{})},{kind:"row",id:ln.docxRow,render:()=>jsxRuntime.jsx(ln,{})}]}function lP(e,t=false){return [...rP,...e?aP():[],...t?iP():[]]}function zm(e){if(!je.isValidElement(e))return null;let t=Ao(e,zm);if(t!==null)return t;let n=e.type;if(typeof n!="function"&&typeof n!="object")return null;if(typeof n.docxRow=="string")return n.docxRow;if(typeof n.docxSlot=="string")return n.docxSlot;if(n.docxMenuRow===true){let o=e.props.slot;if(typeof o=="string")return o}return null}function qm(e){if(!je.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function sP(e){return e?.closest(".docx-editor__scroll-container")??null}function Ir({className:e,t,preset:n=true,disabled:o,onOpenChange:r,children:i}){let a=Ye(),l=F(),{t:c}=_(),s=ai(),d=je.useRef(null),u=je.useRef(null),[m,g]=je.useState(null),[p,f]=je.useState(null),[b,h]=je.useState(null),P=je.useMemo(()=>lP(s,p!==null),[s,p]),[x,C]=je.useState(null),v=je.useCallback((H=false)=>{g(null),C(null),f(null),h(null),H&&l?.focus();},[l]);je.useEffect(()=>{if(o)return;let H=sP(d.current);if(!H)return;let k=L=>{L.preventDefault();let R=L.button===-1||L.clientX===0&&L.clientY===0,I=H.getBoundingClientRect();f(l?.snapshot().tocContext?.id??null),h(R||!(L.target instanceof HTMLElement)?null:L.target),g(R?{x:I.left+16,y:I.top+16}:{x:L.clientX,y:L.clientY});};return H.addEventListener("contextmenu",k),()=>H.removeEventListener("contextmenu",k)},[o,l]),je.useEffect(()=>{o&&v();},[o,v]),je.useEffect(()=>{if(!m)return;let H=R=>{u.current?.contains(R.target)||v();},k=R=>{R.key==="Escape"?(R.preventDefault(),v(true)):R.key==="Tab"&&v();},L=()=>v();return document.addEventListener("pointerdown",H,true),document.addEventListener("keydown",k),document.addEventListener("scroll",L,{capture:true,passive:true}),window.addEventListener("blur",L),window.addEventListener("resize",L),()=>{document.removeEventListener("pointerdown",H,true),document.removeEventListener("keydown",k),document.removeEventListener("scroll",L,true),window.removeEventListener("blur",L),window.removeEventListener("resize",L);}},[m,v]),je.useLayoutEffect(()=>{let H=u.current;if(!m||!H)return;let{width:k,height:L}=H.getBoundingClientRect(),R=window.innerWidth-k-ci,I=window.innerHeight-L-ci,z=Math.max(ci,m.x>R?m.x-k:m.x),Z=Math.max(ci,m.y>I?m.y-L:m.y);C({x:z,y:Z});},[m]),je.useLayoutEffect(()=>{x&&u.current?.focus({preventScroll:true});},[x]);let y=je.useRef(r);y.current=r;let T=je.useRef(false);je.useEffect(()=>{let H=m!==null;H!==T.current&&(T.current=H,y.current?.(H));},[m]);let M=je.useMemo(()=>({t,openMenu:null,setOpenMenu:()=>v(true),activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onReportIssue:void 0,reportIssue:void 0}),[t,v]),[w,E]=je.useState(null),D=je.useMemo(()=>({close:v,anchor:m,tocId:p,target:b,clipboardRefusal:w,reportClipboardRefusal:E}),[v,m,p,b,w]),A={position:"fixed",left:(x??m)?.x??0,top:(x??m)?.y??0,visibility:x?"visible":"hidden"};return jsxRuntime.jsx("div",{ref:d,style:{display:"contents"},children:m?jsxRuntime.jsx(Jn.Provider,{value:M,children:jsxRuntime.jsx(ni.Provider,{value:D,children:jsxRuntime.jsxs("div",{ref:u,role:"menu","aria-label":t?.("contextMenu.ariaLabel")??c("contextMenu.ariaLabel"),tabIndex:-1,className:`${a}docx-toolbar__menu docx-contextmenu${e?` ${e}`:""}`,style:A,onKeyDown:H=>{let k=u.current;if(!k)return;let L=no(k);H.key==="ArrowDown"?(H.preventDefault(),lt(L,document.activeElement,1)):H.key==="ArrowUp"?(H.preventDefault(),lt(L,document.activeElement,-1)):H.key==="Home"?(H.preventDefault(),st(L,"first")):H.key==="End"&&(H.preventDefault(),st(L,"last"));},children:[je.Children.toArray(i).filter(qm),la({entries:P,children:je.Children.toArray(i).filter(H=>!qm(H)),preset:n,keyOfEntry:H=>H.id,keyOfChild:zm,renderEntry:H=>H.kind==="separator"?jsxRuntime.jsx(lo,{}):H.render()})]})})}):null})}var lc=Object.assign(Ir,{Cut:Pr,Copy:Er,Paste:Xo,Delete:wr,SelectAll:Mr,InsertRowAbove:Qo,InsertRowBelow:Jo,InsertColumnLeft:en,InsertColumnRight:tn,DeleteTableRow:on,DeleteTableColumn:nn,DeleteTable:rn,CellVerticalAlignment:yo,RefreshToc:an,RefreshTocPageNumbers:ln,Item:ii,Slot:Et,Row:Ne,Group:or,Separator:lo,Submenu:io});function sc(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var Wm=e=>jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:16,height:16,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})}),pP="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z",mP="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z",fP={position:"absolute",zIndex:20,minWidth:240,maxWidth:320,top:12,right:12,padding:12,borderRadius:8,border:"1px solid var(--doc-border)",backgroundColor:"var(--doc-surface)",boxShadow:"0 4px 16px var(--doc-shadow)",color:"var(--doc-text)",fontSize:13,display:"flex",flexDirection:"column",gap:10},gP={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},bP={color:"var(--doc-text-muted)",flexShrink:0},hP={textAlign:"right",wordBreak:"break-word"},vP={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},yP={display:"flex",gap:8,marginTop:4},$m={display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:4,border:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",color:"var(--doc-text)",font:"inherit",cursor:"pointer"};function xP(e){switch(e){case "plainText":return "contentControl.types.plainText";case "checkbox":return "contentControl.types.checkbox";case "dropdown":return "contentControl.types.dropdown";case "comboBox":return "contentControl.types.comboBox";case "date":return "contentControl.types.date";case "picture":return "contentControl.types.picture";case "repeatingSection":return "contentControl.types.repeatingSection";default:return "contentControl.types.richText"}}function TP(e){return e.effectiveLock==="sdtContentLocked"?"contentControl.lock.sdtContentLocked":e.effectiveLock==="contentLocked"||e.locked?"contentControl.lock.contentLocked":e.effectiveLock==="sdtLocked"||e.removalLocked?"contentControl.lock.sdtLocked":"contentControl.lock.unlocked"}function sn({label:e,value:t,testId:n}){return jsxRuntime.jsxs("div",{style:gP,"data-testid":n,children:[jsxRuntime.jsx("span",{style:bP,children:e}),jsxRuntime.jsx("span",{style:hP,children:t})]})}function SP({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let i=mt(),a=je.useRef(null),l=je.useId(),{t:c}=_(),{control:s,inspectorOpen:d,closeInspector:u}=i;if(je.useEffect(()=>{if(!d)return;let f=h=>{h.key==="Escape"&&(h.preventDefault(),u());},b=h=>{let P=a.current;P&&h.target instanceof Node&&P.contains(h.target)||u();};return document.addEventListener("keydown",f),document.addEventListener("mousedown",b,true),()=>{document.removeEventListener("keydown",f),document.removeEventListener("mousedown",b,true);}},[d,u]),je.useEffect(()=>{d&&!s&&u();},[d,s,u]),n||!d||!s)return null;let m=r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Um,{}),jsxRuntime.jsx(Gm,{}),jsxRuntime.jsx("div",{style:yP,children:jsxRuntime.jsx(Ym,{})}),o]}):o,g={ref:a,role:"dialog","aria-modal":false,"aria-labelledby":l,"data-testid":"content-control-inspector","data-control-id":s.id,"data-control-type":s.controlType,...s.locked?{"data-locked":""}:{},...s.bound?{"data-bound":""}:{},...s.placeholder?{"data-placeholder":""}:{},className:`docx-content-control-inspector${e?` ${e}`:""}`,style:fP,onMouseDown:f=>{sc(f),f.stopPropagation();}},p=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{id:l,className:"docx-editor-sr-only",children:c("contentControl.inspectorPanel.title")}),m]});return t?jsxRuntime.jsx($,{...g,children:p}):jsxRuntime.jsx("div",{...g,children:p})}function Um({className:e,asChild:t,hidden:n,children:o}){let{closeInspector:r}=mt(),{t:i}=_();if(n)return null;let a={style:vP,className:e??void 0,"data-testid":"content-control-inspector-header"},l=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:o??i("contentControl.inspectorPanel.title")}),jsxRuntime.jsx("button",{type:"button","data-testid":"content-control-inspector-close","aria-label":i("common.close"),title:i("common.close"),style:{...$m,padding:4,border:"none",background:"transparent"},onMouseDown:sc,onClick:()=>r(),children:Wm(pP)})]});return t?jsxRuntime.jsx($,{...a,children:l}):jsxRuntime.jsx("div",{...a,children:l})}function Gm({className:e,asChild:t,hidden:n,children:o}){let{control:r}=mt(),{t:i}=_();if(n||!r)return null;let a=i("contentControl.inspectorPanel.empty"),l=i("contentControl.inspectorPanel.yes"),c=i("contentControl.inspectorPanel.no"),s=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(sn,{label:i("contentControl.inspectorPanel.alias"),value:r.alias??a,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(sn,{label:i("contentControl.inspectorPanel.tag"),value:r.tag??a,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(sn,{label:i("contentControl.inspectorPanel.type"),value:i(xP(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(sn,{label:i("contentControl.inspectorPanel.lock"),value:i(TP(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(sn,{label:i("contentControl.inspectorPanel.placeholder"),value:r.placeholder?l:c,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(sn,{label:i("contentControl.inspectorPanel.bound"),value:r.bound?l:c,testId:"content-control-inspector-bound"}),r.bound?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-bound-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},children:i("contentControl.inspectorPanel.boundNote")}):null,r.locked?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-locked-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},"aria-live":"polite",children:i("contentControl.inspectorPanel.lockedNote")}):null]}),d={className:e??void 0,"data-testid":"content-control-inspector-fields",style:{display:"flex",flexDirection:"column",gap:8}};return t?jsxRuntime.jsx($,{...d,children:s}):jsxRuntime.jsx("div",{...d,children:s})}function Ym({className:e,asChild:t,hidden:n,icon:o,children:r}){let{canRemove:i,removeDisabledReason:a,remove:l,closeInspector:c}=mt(),{t:s}=_();if(n)return null;let d=s("contentControl.remove"),u={type:"button",className:`docx-content-control-inspector__remove${e?` ${e}`:""}`,"data-testid":"content-control-inspector-remove","data-slot":"contentControl.remove",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":d,title:a??d,style:$m,onMouseDown:sc,onClick:()=>{l().ok&&c();}},m=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o??r??Wm(mP),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx($,{...u,children:m}):jsxRuntime.jsx("button",{...u,children:m})}var di=Object.assign(SP,{Header:Um,Fields:Gm,Remove:Ym});var wP={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},MP={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},RP={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},IP={flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",scrollbarGutter:"stable both-edges",backgroundColor:"var(--doc-bg)"},kP={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},_P={flex:"none",display:"flex",flexDirection:"column",position:"relative",zIndex:30,backgroundColor:"var(--doc-surface)",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:"var(--doc-border)",boxShadow:"0 1px 3px var(--doc-shadow-subtle)"},DP={padding:"8px 12px"},NP={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},LP={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},HP={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function AP({forwardedRef:e}){let t=F(),n=je.useRef(null);return n.current=t,Cd({ref:e,editorRef:n}),null}var FP=je.forwardRef(function(t,n){let{document:o,fonts:r,className:i,t:a,chrome:l=true,title:c,onTitleChange:s,renderTitleBarLeft:d,renderTitleBarRight:u,colorMode:m="light",author:g,locale:p,mode:f="edit",modules:b,zoom:h,zoomMode:P,onReady:x,onChange:C,onFontError:v,onOpen:y,onSave:T,hyperlinkPopup:M,contextMenu:w=true,menu:E=true,navigation:D=true,rulers:A=true}=t,[H,k]=je.useState(Hc);je.useEffect(()=>{if(m==="system")return Fc(k)},[m]);let L=Ac(m,H),{t:R}=_(),I=je.useCallback((Y,Re)=>a?a(Y,Re):R(Y,Re),[a,R]),z=jsxRuntime.jsxs(na,{className:l?L?"dark":void 0:i,style:l?MP:void 0,children:[l?jsxRuntime.jsx(Ja,{}):null,l?jsxRuntime.jsx(oi,{}):null,jsxRuntime.jsx(Gr,{}),jsxRuntime.jsx(ti,{hidden:M===false}),w===false?null:jsxRuntime.jsx(Ir,{t:I,...typeof w=="object"?w:{}}),jsxRuntime.jsx(di,{}),A&&l?jsxRuntime.jsx("div",{style:kP,"aria-hidden":"true",children:jsxRuntime.jsx(Ka,{})}):null,t.children]}),Z=l?jsxRuntime.jsxs("div",{className:`docx-editor${L?" dark":""}${i?` ${i}`:""}`,style:wP,children:[jsxRuntime.jsxs("div",{style:_P,children:[jsxRuntime.jsxs("div",{style:NP,children:[d?.(),jsxRuntime.jsxs("div",{style:LP,children:[s?jsxRuntime.jsx("input",{"aria-label":I("titleBar.documentNameAriaLabel"),value:c??"",placeholder:I("titleBar.untitled"),onChange:Y=>s(Y.target.value),style:HP}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??I("titleBar.untitled")}),E!==false?jsxRuntime.jsx(ar,{t:I,...c!==void 0?{fileName:c}:{},...y?{onOpen:y}:{},...T?{onSave:T}:{},...typeof E=="object"?E:{}}):null]}),u?.()]}),jsxRuntime.jsx("div",{style:DP,children:jsxRuntime.jsx(Xn,{t:I})})]}),A?jsxRuntime.jsx("div",{style:IP,"data-testid":"docx-editor-ruler-row",children:jsxRuntime.jsx(qa,{})}):null,jsxRuntime.jsx(Xa,{t:I}),jsxRuntime.jsxs("div",{style:RP,children:[D?jsxRuntime.jsx(Ga,{t:I}):null,z,jsxRuntime.jsx(Ya.Provider,{value:I,children:jsxRuntime.jsx(ja,{})}),jsxRuntime.jsx(jr,{overlay:true})]})]}):z,V=je.useCallback(Y=>I(Y),[I]);return jsxRuntime.jsxs(Pn,{...o!==void 0?{document:o}:{},...r?{fonts:r}:{},...g!==void 0?{author:g}:{},...p!==void 0?{locale:p}:{},translate:I,mode:f,...b!==void 0?{modules:b}:{},...h!==void 0?{zoom:h}:{},...P!==void 0?{zoomMode:P}:{},tableInteractionLabel:V,...x?{onReady:x}:{},...C?{onChange:C}:{},...v?{onFontError:v}:{},children:[jsxRuntime.jsx(AP,{forwardedRef:n}),jsxRuntime.jsx(oo.Provider,{value:l,children:Z})]})}),OP=je.forwardRef(function(t,n){return jsxRuntime.jsx(_o,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(FP,{...t,ref:n})})}),ZP=Object.assign(OP,{Root:Pn,Viewport:na,Content:Gr,Toolbar:Xn,Menu:ar,Loading:jr,ColorByChangeType:Xi,AuthorStyle:Qi,HorizontalRuler:qa,VerticalRuler:Ka,DocumentOutline:Ls,Navigation:Ga,PageSetupDialog:Qn,PageNumber:ja,FontNotice:Xa,HeaderFooterChrome:Ja,NotesChrome:oi,HyperLink:ti,ContextMenu:lc,ContentControl:di});function KP(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}async function zP(e){return typeof e=="function"?e():e}function VP(e,t={}){let[n,o]=je.useState(void 0),[r,i]=je.useState(void 0),[a,l]=je.useState(null),[c,s]=je.useState(e!=null),[d,u]=je.useState(t.fonts===void 0),m=je.useRef(t);return m.current=t,je.useEffect(()=>{let g=m.current.fonts;if(g===void 0)return;let p=true;return (async()=>{try{let f=await zP(g);p&&i(editor.composeFontConfiguration(f));}catch{}finally{p&&u(true);}})(),()=>{p=false;}},[]),je.useEffect(()=>{if(e==null){o(void 0),l(null),s(false);return}let g=KP(e);if(g){o(g),l(null),s(false);return}let p=true,f=new AbortController;return s(true),l(null),(async()=>{try{let b=await fetch(String(e),{...m.current.fetchOptions,signal:f.signal});if(!b.ok)throw new Error(`could not open the document: ${b.status} ${b.statusText}`);let h=new Uint8Array(await b.arrayBuffer());if(!p)return;o(h),s(!1);}catch(b){if(!p||b instanceof Error&&b.name==="AbortError")return;l(b instanceof Error?b:new Error("could not open the document")),s(false);}})(),()=>{p=false,f.abort();}},[e]),{document:d?n:void 0,fonts:r,error:a,isLoading:c||!d}}function GP(e,...t){let n=je.useRef({source:e,fragments:t});return n.current={source:e,fragments:t},je.useMemo(()=>async o=>{let r=n.current,a=[typeof r.source=="function"?await r.source(o):await r.source,...r.fragments].filter(s=>s!==void 0);if(a.length===0)return;let{epoch:l,...c}=editor.composeFontConfiguration(a[0],...a.slice(1));return c},[])}var Jm=[],XP=()=>{};function QP(){let e=F(),t=je.useCallback(n=>{if(!e)return XP;let o=Ki(n),r=e.on("change",o),i=e.on("selectionChange",o);return ()=>{r(),i();}},[e]);return je.useSyncExternalStore(t,()=>e?.getReviewAuthors()??Jm,()=>Jm)}function t1(e){let n=e?.surface?.state?.().selection?.head;return n&&typeof n.paragraphId=="string"&&Number.isFinite(n.offset)?n:null}function o1(){let e=F(),t=je.useRef(null),n=je.useCallback(r=>{if(!e)return ()=>{};let i=e.on("selectionChange",r),a=e.on("change",r);return ()=>{i(),a();}},[e]),o=je.useCallback(()=>{let r=t1(e),i=t.current;return (r===null?i===null:i!==null&&n1(i,r))?i:(t.current=r,r)},[e]);return je.useSyncExternalStore(n,o,()=>null)}function n1(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}function cc({source:e,scale:t,measurer:n,onStateChange:o,onError:r,className:i,documentFontFamily:a,ref:l}){let c=je.useRef(null),s=je.useRef(null),[d,u]=je.useState(null),m=je.useRef(o);m.current=o;let g=je.useRef(r);return g.current=r,je.useEffect(()=>{let p=c.current;if(!p)return;let f=editor.mountPaginatedSurface(p,e,{...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onChange:h=>{u(h),m.current?.(h);}});if(!f.ok){g.current?.(f.reason,f.detail);return}s.current=f.surface;let b=f.surface.state();return u(b),m.current?.(b),()=>{f.surface.destroy(),s.current=null;}},[e,n]),je.useImperativeHandle(l,()=>({focus:()=>s.current?.focus(),type:p=>s.current?.type(p),undo:()=>s.current?.undo(),redo:()=>s.current?.redo(),selectAll:()=>s.current?.selectAll(),navigate:(p,f)=>s.current?.navigate(p,f),toggleRunProperty:(p,f)=>s.current?.toggleRunProperty(p,f),setRunProperty:(p,f)=>s.current?.setRunProperty(p,f),setParagraphProperty:(p,f,b)=>s.current?.setParagraphProperty(p,f,b),formatting:()=>s.current?.formatting()??null,sectionProperties:()=>s.current?.sectionProperties()??null,save:()=>{let p=s.current;return p?(p.flushPendingInput(),p.session.save()):null}}),[]),jsxRuntime.jsx("div",{ref:c,style:{margin:"24px auto",...a?{fontFamily:a}:{}},className:i?`docx-paginated-surface ${i}`:"docx-paginated-surface","data-revision":d?.revision??0,"data-page-count":d?.pageCount??0})}var Dr=je.createContext(null);function tf(){let e=je.useContext(Dr);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function p1(e){return "type"in e&&e.type==="separator"}var rf={display:"flex",alignItems:"center",gap:2,padding:"2px 8px",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text)",whiteSpace:"nowrap",height:28,lineHeight:"28px"},m1={...rf,background:"var(--doc-bg-hover)"},af={display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap"},f1={...af,opacity:.4,cursor:"default"},g1={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},b1={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},h1={position:"absolute",left:"100%",top:-4,marginLeft:2,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:8,zIndex:1001};function Nr({label:e,items:t,disabled:n,showChevron:o=false}){let[r,i]=je.useState(false),[a,l]=je.useState(null),c=je.useRef(null),s=je.useRef(null),[d,u]=je.useState({top:0,left:0}),m=je.useCallback(()=>{i(false),l(null);},[]);je.useEffect(()=>{if(!r||!c.current)return;let p=c.current.getBoundingClientRect();u({top:p.bottom+2,left:p.left});},[r]),je.useEffect(()=>{if(!r)return;function p(h){let P=h.target;c.current&&!c.current.contains(P)&&s.current&&!s.current.contains(P)&&m();}function f(h){h.key==="Escape"&&m();}function b(){m();}return document.addEventListener("mousedown",p),document.addEventListener("keydown",f),window.addEventListener("scroll",b,true),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",f),window.removeEventListener("scroll",b,true);}},[r,m]);let g=p=>{p.disabled||p.submenuContent||p.onClick&&(p.onClick(),m());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:c,type:"button",onClick:()=>!n&&i(!r),onMouseDown:p=>p.preventDefault(),disabled:n,style:r?m1:rf,children:[e,o&&jsxRuntime.jsx(K,{name:"arrow_drop_down",size:16})]}),r&&jsxRuntime.jsx("div",{ref:s,style:{position:"fixed",top:d.top,left:d.left,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:"4px 0",zIndex:1e4,minWidth:200},onMouseDown:p=>p.preventDefault(),children:t.map((p,f)=>{if(p1(p))return jsxRuntime.jsx("div",{style:g1},`sep-${f}`);let b=p;if(b.customContent)return jsxRuntime.jsx("div",{onMouseDown:x=>x.preventDefault(),children:b.customContent},b.label);let h=!!b.submenuContent,P=a===b.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>h&&l(b.label),onMouseLeave:()=>h&&l(null),children:[jsxRuntime.jsxs("button",{type:"button",style:b.disabled?f1:af,onClick:()=>g(b),onMouseDown:x=>x.preventDefault(),onMouseOver:x=>{b.disabled||(x.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:x=>{x.currentTarget.style.backgroundColor="transparent";},disabled:b.disabled,children:[b.icon&&jsxRuntime.jsx(K,{name:b.icon,size:18}),jsxRuntime.jsx("span",{children:b.label}),b.shortcut&&jsxRuntime.jsx("span",{style:b1,children:b.shortcut}),h&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(K,{name:"keyboard_arrow_right",size:16})})]}),h&&P&&jsxRuntime.jsx("div",{style:h1,onMouseDown:x=>x.preventDefault(),children:b.submenuContent(m)})]},b.label)})})]})}var pc=18,y1=2,sf={width:pc,height:pc,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},x1={...sf,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},T1={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function cf({onInsert:e,gridRows:t=6,gridColumns:n=6}){let[o,r]=je.useState(0),[i,a]=je.useState(0),l=je.useCallback(()=>{o>0&&i>0&&e(o,i);},[o,i,e]),c=[];for(let d=1;d<=t;d++)for(let u=1;u<=n;u++){let m=d<=o&&u<=i;c.push(jsxRuntime.jsx("div",{style:m?x1:sf,onMouseEnter:()=>{r(d),a(u);},onClick:l,role:"gridcell","aria-selected":m},`${d}-${u}`));}let s=o>0&&i>0?`${i} \xD7 ${o}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:y1,gridTemplateColumns:`repeat(${n}, ${pc}px)`},onMouseLeave:()=>{r(0),a(0);},role:"grid","aria-label":"Table size selector",children:c}),jsxRuntime.jsx("div",{style:T1,children:s})]})}function E1({items:e,closeMenu:t}){return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",minWidth:220},children:e.map(n=>{let o=!n.onClick;return jsxRuntime.jsxs("button",{type:"button",disabled:o,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:o?"default":"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap",opacity:o?.4:1},onMouseDown:r=>r.preventDefault(),onClick:()=>{o||(n.onClick?.(),t());},onMouseOver:r=>{o||(r.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:r=>{r.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx(K,{name:n.icon,size:18}),jsxRuntime.jsx("span",{children:n.label})]},n.label)})})}function w1(){return jsxRuntime.jsxs("svg",{width:"32",height:"40",viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 0C0.9 0 0 0.9 0 2V38C0 39.1 0.9 40 2 40H30C31.1 40 32 39.1 32 38V10L22 0H2Z",fill:"#cbd5e1"}),jsxRuntime.jsx("path",{d:"M22 0L32 10H24C22.9 10 22 9.1 22 8V0Z",fill:"#94a3b8"}),jsxRuntime.jsx("rect",{x:"7",y:"18",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"23",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"28",width:"12",height:"2",rx:"1",fill:"#fff"})]})}function mi({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function M1(e){return e.replace(/\.docx$/i,"")}function fc({value:e,onChange:t,placeholder:n,editable:o=true}){let{t:r}=_(),i=n??r("titleBar.untitled"),a=M1(e)??"";return o?jsxRuntime.jsx("input",{type:"text",value:a,onChange:l=>{let c=l.target.value;t?.(c.endsWith(".docx")?c:c+".docx");},placeholder:i,className:"text-base font-normal text-foreground bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-muted focus:bg-doc-bg-input focus:ring-1 focus:ring-ring min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":r("titleBar.documentNameAriaLabel")}):jsxRuntime.jsx("span",{className:"text-base font-normal text-foreground px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:a||i})}function fi({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function gi(){let{t:e}=_(),t=tf(),{disabled:n=false,onFormat:o,onPrint:r,onOpen:i,onSave:a,onPageSetup:l,onInsertImage:c,onInsertTable:s,showTableInsert:d=true,showHelpMenu:u=true,onInsertPageBreak:m,onInsertSectionBreakNextPage:g,onInsertSectionBreakContinuous:p,onInsertTOC:f,onWatermark:b,onRefocusEditor:h}=t,P=je.useCallback(y=>{!n&&o&&o(y);},[n,o]),x=je.useCallback((y,T)=>{!n&&s&&(s(y,T),requestAnimationFrame(()=>h?.()));},[n,s,h]),C=!!r||!!l,v=C||i||a;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[v&&jsxRuntime.jsx(Nr,{label:e("toolbar.file"),disabled:n,items:[...i?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:i}]:[],...a?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:a}]:[],...(i||a)&&C?[{type:"separator"}]:[],...r?[{icon:"print",label:e("toolbar.print"),shortcut:e("toolbar.printShortcut"),onClick:r}]:[],...l?[{icon:"settings",label:e("toolbar.pageSetup"),onClick:l}]:[]]}),jsxRuntime.jsx(Nr,{label:e("toolbar.format"),disabled:n,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>P("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>P("setRtl")}]}),jsxRuntime.jsx(Nr,{label:e("toolbar.insert"),disabled:n,items:[...c?[{icon:"image",label:e("toolbar.image"),onClick:c}]:[],...d&&s?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:y=>jsxRuntime.jsx(cf,{onInsert:(T,M)=>{x(T,M),y();}})}]:[],...c||d&&s?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:y=>jsxRuntime.jsx(E1,{closeMenu:y,items:[{icon:"page_break",label:e("toolbar.pageBreak"),onClick:m},{icon:"horizontal_rule",label:e("toolbar.sectionBreakNextPage"),onClick:g},{icon:"border_horizontal",label:e("toolbar.sectionBreakContinuous"),onClick:p}]})},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:f,disabled:!f},...b?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:b}]:[]]}),u&&jsxRuntime.jsx(Nr,{label:e("toolbar.help"),disabled:n,items:[{label:e("toolbar.reportIssue"),onClick:()=>er()}]})]})}function gc({children:e}){let t=null,n=null,o=[],r=[];je.Children.forEach(e,a=>{je.isValidElement(a)&&(a.type===mi?t=a:a.type===fi?n=a:a.type===gi?r.push(a):o.push(a));});let i=je.useCallback(a=>{let l=a.target;l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.tagName==="SELECT"||l.tagName==="OPTION"||a.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-doc-surface pt-2 pb-1",onMouseDown:i,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx(w1,{})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[o.length>0&&jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-1",children:o}),r.length>0&&jsxRuntime.jsx("div",{className:"flex items-center px-1",children:r})]}),n&&jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:n})]})}var bi={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},_1={black:"000000",blue:"0000FF",cyan:"00FFFF",darkBlue:"00008B",darkCyan:"008B8B",darkGray:"A9A9A9",darkGreen:"006400",darkMagenta:"8B008B",darkRed:"8B0000",darkYellow:"808000",green:"00FF00",lightGray:"D3D3D3",magenta:"FF00FF",red:"FF0000",white:"FFFFFF",yellow:"FFFF00",none:""},df={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedHyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"};function D1(e,t){let n=df[t]??df[t.toLowerCase()]??t,r=e?.colorScheme?.[n];return typeof r=="string"&&r?r:bi[n]??"000000"}function uf(e){let t=e.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/.test(t))return t;if(/^[0-9A-F]{3}$/.test(t))return t.split("").map(n=>n+n).join("")}function bc(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex")return `#${uf(e.value)??n}`;let o=Object.entries(t?.colorScheme??bi).map(([i,a])=>({slot:i,hex:String(a)})),r=editor.resolveThemeColorHex(e,o);return `#${r.ok?r.hex:D1(t,e.slot)}`}function Mt(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?uf(e.value):bc(e,t).slice(1)}function pf(e){if(!e||e==="none")return "";let t=_1[e];return t?`#${t}`:""}var N1=[{slot:"lt1",name:"Background 1"},{slot:"dk1",name:"Text 1"},{slot:"lt2",name:"Background 2"},{slot:"dk2",name:"Text 2"},{slot:"accent1",name:"Accent 1"},{slot:"accent2",name:"Accent 2"},{slot:"accent3",name:"Accent 3"},{slot:"accent4",name:"Accent 4"},{slot:"accent5",name:"Accent 5"},{slot:"accent6",name:"Accent 6"}],L1=[{type:"base",keep:1,labelSuffix:""},{type:"tint",keep:.2,labelSuffix:", Lighter 80%"},{type:"tint",keep:.4,labelSuffix:", Lighter 60%"},{type:"tint",keep:.6,labelSuffix:", Lighter 40%"},{type:"shade",keep:.75,labelSuffix:", Darker 25%"},{type:"shade",keep:.5,labelSuffix:", Darker 50%"}];function mf(e){let t=e??bi;return L1.map(n=>N1.map(o=>{let r=t[o.slot]??bi[o.slot]??"000000",a={hex:n.type==="base"?r.toUpperCase():n.type==="tint"?editor.applyThemeTint(r,n.keep):editor.applyThemeShade(r,n.keep),themeSlot:o.slot,label:`${o.name}${n.labelSuffix}`};return n.type==="tint"?a.tint=n.keep:n.type==="shade"&&(a.shade=n.keep),a}))}function J(...e){return clsx.clsx(e)}var F1=classVarianceAuthority.cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),Me=je__namespace.forwardRef(({className:e,variant:t,size:n,...o},r)=>jsxRuntime.jsx("button",{className:J(F1({variant:t,size:n,className:e})),ref:r,...o}));Me.displayName="Button";function et({content:e,children:t,side:n="bottom",delayMs:o=400}){let[r,i]=je__namespace.useState(false),[a,l]=je__namespace.useState({x:0,y:0}),c=je__namespace.useRef(null),s=je__namespace.useRef(null),d=je__namespace.useCallback(()=>{s.current=setTimeout(()=>{if(c.current){let p=c.current.getBoundingClientRect(),f=p.left+p.width/2,b=n==="top"?p.top-8:p.bottom+8;l({x:f,y:b});}i(true);},o);},[o,n]),u=je__namespace.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),i(false);},[]);je__namespace.useEffect(()=>()=>{s.current&&clearTimeout(s.current);},[]);let m=t.props,g=je__namespace.cloneElement(t,{ref:c,onMouseEnter:p=>{d(),m.onMouseEnter?.(p);},onMouseLeave:p=>{u(),m.onMouseLeave?.(p);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g,r&&jsxRuntime.jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-foreground dark:bg-muted dark:text-foreground rounded-md shadow-lg",style:{left:a.x,top:a.y,transform:n==="top"?"translate(-50%, -100%)":n==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var qt=pe__namespace.Root,Kt=pe__namespace.Group,hi=pe__namespace.Value;function zt({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(pe__namespace.Trigger,{className:J("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-foreground bg-transparent","hover:bg-muted/80 focus:outline-none focus:bg-muted/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",e),onMouseDown:r=>{r.preventDefault(),n?.(r);},...o,children:[t,jsxRuntime.jsx(pe__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(K1,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function Vt({className:e,children:t,position:n="popper",onCloseAutoFocus:o,...r}){let i=typeof document<"u"&&!!document.querySelector(".docx-editor.dark");return jsxRuntime.jsx(pe__namespace.Portal,{children:jsxRuntime.jsx("div",{className:J("docx-editor",i&&"dark"),children:jsxRuntime.jsx(pe__namespace.Content,{className:J("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-border bg-popover text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:n,onCloseAutoFocus:a=>{a.preventDefault(),o?.(a);},...r,children:jsxRuntime.jsx(pe__namespace.Viewport,{className:J("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:a=>a.preventDefault(),children:t})})})})}function To({className:e,...t}){return jsxRuntime.jsx(pe__namespace.Label,{className:J("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t})}function tt({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(pe__namespace.Item,{className:J("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-foreground outline-none","hover:bg-muted focus:bg-muted","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:r=>{r.preventDefault(),n?.(r);},...o,children:[jsxRuntime.jsx(pe__namespace.ItemText,{children:t}),jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(pe__namespace.ItemIndicator,{children:jsxRuntime.jsx(z1,{className:"h-4 w-4"})})})]})}function So({className:e,...t}){return jsxRuntime.jsx(pe__namespace.Separator,{className:J("-mx-1 my-1 h-px bg-muted",e),...t})}function K1({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})})}function z1({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}function hc(e){let t=e.trim();if(!t)return "";let n=null,o="";for(let r of t){if((r==='"'||r==="'")&&n===null){n=r,o+=r;continue}if(r===n){n=null,o+=r;continue}if(r===","&&n===null)break;o+=r;}return o.trim().replace(/^['"]|['"]$/g,"")}var V1=[{name:"Arial",fontFamily:"Arial, Helvetica, sans-serif",category:"sans-serif"},{name:"Calibri",fontFamily:'"Calibri", Arial, sans-serif',category:"sans-serif"},{name:"Helvetica",fontFamily:"Helvetica, Arial, sans-serif",category:"sans-serif"},{name:"Verdana",fontFamily:"Verdana, Geneva, sans-serif",category:"sans-serif"},{name:"Open Sans",fontFamily:'"Open Sans", sans-serif',category:"sans-serif"},{name:"Roboto",fontFamily:"Roboto, sans-serif",category:"sans-serif"},{name:"Times New Roman",fontFamily:'"Times New Roman", Times, serif',category:"serif"},{name:"Georgia",fontFamily:"Georgia, serif",category:"serif"},{name:"Cambria",fontFamily:"Cambria, Georgia, serif",category:"serif"},{name:"Garamond",fontFamily:"Garamond, serif",category:"serif"},{name:"Courier New",fontFamily:'"Courier New", Courier, monospace',category:"monospace"},{name:"Consolas",fontFamily:"Consolas, monospace",category:"monospace"}];function bf({value:e,onChange:t,fonts:n=V1,documentFonts:o,disabled:r=false,className:i,placeholder:a="Arial",width:l=120,showPreview:c=true}){let{t:s}=_(),d=je__namespace.useMemo(()=>{if(!o)return [];let f=new Set(n.map(b=>b.name.toLowerCase()));return o.filter(b=>!f.has(b.name.toLowerCase()))},[o,n]),u=je__namespace.useMemo(()=>[...d,...n],[d,n]),m=je__namespace.useMemo(()=>e?u.find(b=>b.fontFamily===e||b.name.toLowerCase()===e.toLowerCase()||hc(b.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:a,[e,u,a]),g=je__namespace.useCallback(f=>{let b=u.find(h=>h.name===f);b&&t?.(hc(b.fontFamily)||b.name);},[t,u]),p=je__namespace.useMemo(()=>{let f={"sans-serif":[],serif:[],monospace:[],other:[]};return n.forEach(b=>{let h=b.category||"other";f[h].push(b);}),f},[n]);return jsxRuntime.jsxs(qt,{value:m,onValueChange:g,disabled:r,children:[jsxRuntime.jsx(zt,{className:J("h-8 text-sm",i),style:{minWidth:typeof l=="number"?`${l}px`:l},"aria-label":s("font.selectAriaLabel"),children:jsxRuntime.jsx(hi,{placeholder:a,children:m})}),jsxRuntime.jsxs(Vt,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(To,{children:s("font.documentFonts")}),d.map(f=>jsxRuntime.jsx(tt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},`doc-${f.name}`))]}),jsxRuntime.jsx(So,{})]}),p["sans-serif"].length>0&&jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(To,{children:s("font.sansSerif")}),p["sans-serif"].map(f=>jsxRuntime.jsx(tt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]}),p.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(So,{}),jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(To,{children:s("font.serif")}),p.serif.map(f=>jsxRuntime.jsx(tt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]})]}),p.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(So,{}),jsxRuntime.jsxs(Kt,{children:[jsxRuntime.jsx(To,{children:s("font.monospace")}),p.monospace.map(f=>jsxRuntime.jsx(tt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]})]}),p.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(So,{}),jsxRuntime.jsx(Kt,{children:p.other.map(f=>jsxRuntime.jsx(tt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))})]})]})]})}function vc(e){if(e===void 0)return;let t=e.map(n=>typeof n=="string"?{name:n,fontFamily:n,category:"other"}:n);return t}function G1(e,t,n,o){let i=Math.max(8,window.innerWidth-n-8),a=Math.max(8,window.innerHeight-o-8);return {top:Math.min(Math.max(8,e),a),left:Math.min(Math.max(8,t),i)}}function We({isOpen:e,onClose:t,align:n="left"}){let o=je.useRef(null),r=je.useRef(null),[i,a]=je.useState({top:0,left:0});je.useEffect(()=>{if(!e||!o.current)return;let s=o.current.getBoundingClientRect();n==="right"?requestAnimationFrame(()=>{if(r.current){let d=r.current.getBoundingClientRect(),u=G1(s.bottom+4,s.right-d.width,d.width,d.height);a(u);}else a({top:s.bottom+4,left:s.left});}):a({top:s.bottom+4,left:s.left});},[e,n]),je.useEffect(()=>{if(!e)return;let s=performance.now()+150,d=g=>{let p=g.target;o.current&&!o.current.contains(p)&&r.current&&!r.current.contains(p)&&t();},u=g=>{g.key==="Escape"&&t();},m=g=>{if(performance.now()<s)return;let p=g.target;p&&r.current&&r.current.contains(p)||p instanceof Element&&p!==document.documentElement&&p!==document.body&&o.current&&p.contains(o.current)||t();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",u),window.addEventListener("scroll",m,true),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",u),window.removeEventListener("scroll",m,true);}},[e,t]);let l=je.useCallback(s=>{s.preventDefault(),s.stopPropagation();},[]),c={position:"fixed",top:i.top,left:i.left,zIndex:1e4};return {containerRef:o,dropdownRef:r,dropdownStyle:c,handleMouseDown:l}}var X1=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Q1=1,J1=400;function yf(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function xf(e,t,n){for(let o=t.length-1;o>=0;o--)if(t[o]<e)return t[o];return Math.max(e-1,n)}function Tf({value:e,onChange:t,sizes:n=X1,disabled:o=false,className:r,placeholder:i="11",minSize:a=Q1,maxSize:l=J1}){let{t:c}=_(),[s,d]=je.useState(false),[u,m]=je.useState(""),[g,p]=je.useState(false),f=je.useRef(null),b=je.useCallback(()=>{p(false),d(false);},[]),{containerRef:h,dropdownRef:P,dropdownStyle:x}=We({isOpen:g,onClose:b}),C=e??(parseInt(i,10)||11),v=e!==void 0?e.toString():i,y=je.useCallback(k=>{if(k.preventDefault(),o)return;let L=xf(C,n,a);t?.(L);},[C,n,a,o,t]),T=je.useCallback(k=>{if(k.preventDefault(),o)return;let L=yf(C,n,l);t?.(L);},[C,n,l,o,t]),M=je.useCallback(k=>{k.preventDefault(),!o&&(d(true),m(v),p(true),requestAnimationFrame(()=>{f.current?.focus(),f.current?.select();}));},[o,v]),w=je.useCallback(k=>{m(k.target.value);},[]),E=je.useCallback(()=>{d(false);let k=parseFloat(u);if(!isNaN(k)&&k>=a&&k<=l){let L=Math.round(k*2)/2;t?.(L);}},[u,a,l,t]),D=je.useCallback(k=>{if(k.key==="Enter")k.preventDefault(),E(),p(false);else if(k.key==="Escape")d(false),p(false);else if(k.key==="ArrowUp"){k.preventDefault();let L=yf(C,n,l);m(L.toString()),t?.(L);}else if(k.key==="ArrowDown"){k.preventDefault();let L=xf(C,n,a);m(L.toString()),t?.(L);}},[E,C,n,l,a,t]),A=je.useCallback(k=>{t?.(k),p(false),d(false);},[t]),H=je.useCallback(k=>{k.target.tagName!=="INPUT"&&k.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:h,className:J("flex items-center",r),onMouseDown:H,children:[jsxRuntime.jsx(Me,{variant:"ghost",size:"icon-sm",className:J("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:y,disabled:o||C<=a,"aria-label":c("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:s?jsxRuntime.jsx("input",{ref:f,type:"text",value:u,onChange:w,onBlur:E,onKeyDown:D,className:J("h-7 w-10 text-center text-sm border border-input bg-doc-bg-input text-doc-text","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none"),"aria-label":c("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:M,className:J("h-7 w-10 text-center text-sm border border-border bg-doc-bg-input text-doc-text","hover:border-input hover:bg-doc-bg-hover","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none",o&&"opacity-50 cursor-not-allowed"),disabled:o,"aria-label":c("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":g,"data-testid":"font-size-display",children:v})}),g&&jsxRuntime.jsx("div",{ref:P,style:{...x,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":c("fontSize.listLabel"),children:n.map(k=>jsxRuntime.jsx("button",{type:"button",onClick:()=>A(k),className:J("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",k===C&&"bg-muted font-medium"),role:"option","aria-selected":k===C,children:k},k))}),jsxRuntime.jsx(Me,{variant:"ghost",size:"icon-sm",className:J("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:T,disabled:o||C>=l,"aria-label":c("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var oE=[{name:"Dark Red",nameKey:"colorPicker.colors.darkRed",hex:"C00000"},{name:"Red",nameKey:"colorPicker.colors.red",hex:"FF0000"},{name:"Orange",nameKey:"colorPicker.colors.orange",hex:"FFC000"},{name:"Yellow",nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{name:"Light Green",nameKey:"colorPicker.colors.lightGreen",hex:"92D050"},{name:"Green",nameKey:"colorPicker.colors.green",hex:"00B050"},{name:"Light Blue",nameKey:"colorPicker.colors.lightBlue",hex:"00B0F0"},{name:"Blue",nameKey:"colorPicker.colors.blue",hex:"0070C0"},{name:"Dark Blue",nameKey:"colorPicker.colors.darkBlue",hex:"002060"},{name:"Purple",nameKey:"colorPicker.colors.purple",hex:"7030A0"}],yi=18,nE=2,rE={position:"relative",display:"inline-block"},aE={display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"32px",padding:"2px 6px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},iE={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},Tc={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},Sc={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},Pf={display:"grid",gap:`${nE}px`},xi={width:`${yi}px`,height:`${yi}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},Ef={...xi,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},wf={...xi,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},lE={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"5px 8px",border:"1px solid var(--doc-border-dark)",borderRadius:"4px",backgroundColor:"var(--doc-surface)",cursor:"pointer",fontSize:"12px",color:"var(--doc-text)"},sE={display:"flex",alignItems:"center",gap:"6px"},cE={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},dE={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},Sf={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},uE={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},pE={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:0,width:"28px",padding:"2px 4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},mE={display:"flex",alignItems:"center",justifyContent:"center",width:"18px",padding:0,border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"};function Cc(e,t,n){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let o=pf(e);return o||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return bc(e,n)}function Cf(e){let t=e.replace(/^#/,"");if(t.length!==6)return false;let n=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return (n*299+o*587+r*114)/1e3>230}function Mf(e,t,n){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():Mt(e,n))===t.toUpperCase():false}function fE({matrix:e,selectedColor:t,theme:n,onSelect:o}){let[r,i]=je.useState(null);return jsxRuntime.jsx("div",{style:{...Pf,gridTemplateColumns:`repeat(10, ${yi}px)`},children:e.flatMap((a,l)=>a.map((c,s)=>{let d=`${l}-${s}`,u=r===d,m=Mf(t,c.hex,n);return jsxRuntime.jsx("button",{type:"button",style:{...m?wf:u?Ef:xi,backgroundColor:`#${c.hex}`},title:c.label,"aria-label":c.label,"aria-selected":m,onClick:()=>o(c),onMouseDown:g=>g.preventDefault(),onMouseEnter:()=>i(d),onMouseLeave:()=>i(null)},d)}))})}function gE({selectedColor:e,theme:t,onSelect:n}){let[o,r]=je.useState(null),{t:i}=_();return jsxRuntime.jsx("div",{style:{...Pf,gridTemplateColumns:`repeat(10, ${yi}px)`},children:oE.map((a,l)=>{let c=o===l,s=Mf(e,a.hex,t),d=i(a.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...s?wf:c?Ef:xi,backgroundColor:`#${a.hex}`},title:d,"aria-label":d,"aria-selected":s,onClick:()=>n(a.hex),onMouseDown:u=>u.preventDefault(),onMouseEnter:()=>r(l),onMouseLeave:()=>r(null)},a.hex)})})}function Eo({mode:e,value:t,onChange:n,theme:o,disabled:r=false,className:i,style:a,title:l,icon:c,autoLabel:s,splitButton:d=true,defaultColor:u}){let[m,g]=je.useState(false),[p,f]=je.useState(false),[b,h]=je.useState(false),[P,x]=je.useState(false),[C,v]=je.useState(""),[y,T]=je.useState(()=>u??(e==="highlight"?"FFFF00":e==="border"?{kind:"hex",value:"000000"}:{kind:"hex",value:"FF0000"})),{t:M}=_();je.useEffect(()=>{let G=Cc(t,e,o).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(G)&&v(G.toUpperCase());},[t,e,o]);let w=je.useCallback(()=>g(false),[]),{containerRef:E,dropdownRef:D,dropdownStyle:A}=We({isOpen:m,onClose:w}),H=o?.colorScheme??null,k=je.useMemo(()=>mf(H),[H]),L=je.useMemo(()=>Cc(t,e,o),[t,e,o]),R=je.useMemo(()=>Cc(y,e,o),[y,e,o]),I=je.useCallback(()=>{r||g(G=>!G);},[r]),z=je.useCallback(G=>{let q;e==="highlight"?q=G.hex:q={kind:"theme",slot:G.themeSlot,...G.tint!==void 0?{tint:G.tint}:{},...G.shade!==void 0?{shade:G.shade}:{}},T(q),n?.(q),g(false);},[e,n]),Z=je.useCallback(G=>{let q=e==="highlight"?G:{kind:"hex",value:G};T(q),n?.(q),g(false);},[e,n]),V=je.useCallback(()=>{n?.(e==="highlight"?"none":{kind:"auto"}),g(false);},[e,n]),Y=je.useCallback(()=>{let G=C.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(G)){let q=e==="highlight"?G:{kind:"hex",value:G};T(q),n?.(q),g(false),v("");}},[e,C,n]),Re=je.useCallback(()=>{r||n?.(y);},[r,y,n]),se={...aE,...r?{cursor:"default",opacity:.38}:m?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:p?{backgroundColor:"var(--doc-bg-hover)"}:{}},Se=M(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),Pe=c??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:E,className:`docx-color-picker ${i||""}`,style:{...rE,...a},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...uE,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...pE,...r?{cursor:"default"}:b?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:Re,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),disabled:r,title:l||Se,"aria-label":l||Se,children:[jsxRuntime.jsx(K,{name:Pe,size:18}),jsxRuntime.jsx("div",{style:{...Sf,backgroundColor:R==="transparent"?"#fff":R,outline:R==="transparent"||Cf(R)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...mE,...r?{cursor:"default"}:m?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:P?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:I,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),disabled:r,title:l||Se,"aria-label":l||Se,"aria-haspopup":"true","aria-expanded":m,children:jsxRuntime.jsx(K,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:se,onClick:I,onMouseDown:G=>G.preventDefault(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),disabled:r,title:l||Se,"aria-label":l||Se,"aria-haspopup":"true","aria-expanded":m,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(K,{name:Pe,size:18}),jsxRuntime.jsx("div",{style:{...Sf,backgroundColor:L==="transparent"?"#fff":L,outline:L==="transparent"||Cf(L)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14})]}),m&&jsxRuntime.jsx("div",{ref:D,className:"docx-color-picker-dropdown",style:{...A,...iE},role:"dialog","aria-label":`${Se} picker`,onMouseDown:G=>{G.target.tagName!=="INPUT"&&G.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:lE,onClick:V,onMouseDown:G=>G.preventDefault(),children:[e==="highlight"?jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px",position:"relative",backgroundColor:"#fff"},children:jsxRuntime.jsx("span",{style:{position:"absolute",top:"50%",left:"-1px",right:"-1px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"}})}):jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",backgroundColor:"#000",borderRadius:"2px"}}),s??M(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:Sc}),jsxRuntime.jsx("div",{style:Tc,children:M("colorPicker.themeColors")}),jsxRuntime.jsx(fE,{matrix:k,selectedColor:t,theme:o,onSelect:z}),jsxRuntime.jsx("div",{style:Sc}),jsxRuntime.jsx("div",{style:Tc,children:M("colorPicker.standardColors")}),jsxRuntime.jsx(gE,{selectedColor:t,theme:o,onSelect:Z}),jsxRuntime.jsx("div",{style:Sc}),jsxRuntime.jsx("div",{style:Tc,children:M("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:sE,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:cE,value:C,onChange:G=>v(G.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:G=>{G.key==="Enter"&&Y();},onMouseDown:G=>{G.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...dE,opacity:/^[0-9A-Fa-f]{6}$/.test(C)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(C)?"pointer":"default"},onClick:Y,onMouseDown:G=>G.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(C),children:M("common.apply")})]})]})})]})}var Hr=20,Pc=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_left",size:Hr}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_center",size:Hr}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_right",size:Hr}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_justify",size:Hr}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function kf({value:e="left",onChange:t,disabled:n=false}){let{t:o}=_(),[r,i]=je.useState(false),a=je.useCallback(()=>i(false),[]),{containerRef:l,dropdownRef:c,dropdownStyle:s,handleMouseDown:d}=We({isOpen:r,onClose:a}),u=je.useCallback(h=>{n||t?.(h),i(false);},[n,t]),m=Pc.find(h=>h.value===e)||Pc[0],g=o(m.labelKey),p=m.shortcutKey?o(m.shortcutKey):void 0,f=`${g}${p?` (${p})`:""}`,b=jsxRuntime.jsxs(Me,{variant:"ghost",size:"icon-sm",className:J("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",n&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!n&&i(h=>!h),disabled:n,"aria-label":f,"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(K,{name:m.iconName,size:Hr}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:l,style:{position:"relative",display:"inline-block"},children:[r?b:jsxRuntime.jsx(et,{content:f,children:b}),r&&!n&&jsxRuntime.jsx("div",{ref:c,style:{...s,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:h=>h.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:Pc.map(h=>{let P=e===h.value,x=o(h.labelKey),C=h.shortcutKey?o(h.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${x}${C?` (${C})`:""}`,"data-testid":`alignment-${h.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:P?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:P?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:v=>v.preventDefault(),onMouseEnter:v=>{P||(v.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=P?"var(--doc-primary-light)":"transparent";},onClick:()=>u(h.value),children:jsxRuntime.jsx(K,{name:h.iconName,size:18})},h.value)})})})]})}function Ti(){return {type:"none",level:0,isInList:false}}var xE={display:"inline-flex",alignItems:"center",gap:"4px"},_f={display:"inline-flex",alignItems:"center",gap:"4px"},Ei={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",padding:"4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},TE={...Ei,backgroundColor:"var(--doc-bg-hover)"},SE={...Ei,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},CE={...Ei,cursor:"default",opacity:.38},PE={width:"28px",height:"28px",padding:"2px"},EE={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},Si=20;function Ci({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,style:a}){let[l,c]=je.useState(false),s={...t?CE:e?SE:l?TE:Ei,...a},d=u=>{u.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${i||""}`,style:s,onMouseDown:d,onClick:t?void 0:o,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-disabled":t||void 0,tabIndex:t?-1:void 0,title:n,"aria-label":n,"aria-pressed":e,role:"button",children:r})}function Df({listState:e,onBulletList:t,onNumberedList:n,onIndent:o,onOutdent:r,disabled:i=false,className:a,style:l,showIndentButtons:c=true,compact:s=false,hasIndent:d=false}){let{t:u}=_(),m=je.useCallback(()=>s?{...PE}:{},[s]),g=e?.type==="bullet",p=e?.type==="numbered",b=(e?.isInList||g||p)&&(e?.level??0)>0||d;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${a||""}`,style:{...xE,...l},role:"group","aria-label":u("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:_f,role:"group","aria-label":u("lists.typeAriaLabel"),children:[jsxRuntime.jsx(Ci,{active:g,disabled:i,title:u("lists.bulletList"),onClick:t,style:m(),children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:Si})}),jsxRuntime.jsx(Ci,{active:p,disabled:i,title:u("lists.numberedList"),onClick:n,style:m(),children:jsxRuntime.jsx(K,{name:"format_list_numbered",size:Si})})]}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:EE,role:"separator"}),jsxRuntime.jsxs("div",{style:_f,role:"group","aria-label":u("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(Ci,{active:false,disabled:i||!b,title:u("lists.decreaseIndent"),onClick:r,style:m(),children:jsxRuntime.jsx(K,{name:"format_indent_decrease",size:Si})}),jsxRuntime.jsx(Ci,{active:false,disabled:i,title:u("lists.increaseIndent"),onClick:o,style:m(),children:jsxRuntime.jsx(K,{name:"format_indent_increase",size:Si})})]})]})]})}var ME=[{label:"Single",labelKey:"lineSpacing.single",value:1,twipsValue:240},{label:"1.15",value:1.15,twipsValue:276},{label:"1.5",value:1.5,twipsValue:360},{label:"Double",labelKey:"lineSpacing.double",value:2,twipsValue:480}];function Lf({value:e,onChange:t,options:n=ME,disabled:o=false,className:r}){let{t:i}=_(),a=je__namespace.useMemo(()=>e===void 0?n[0]:n.find(s=>s.twipsValue===e)||n[0],[e,n]),l=je__namespace.useCallback(s=>{let d=parseInt(s,10);isNaN(d)||t?.(d);},[t]),c=s=>s.labelKey?i(s.labelKey):s.label;return jsxRuntime.jsxs(qt,{value:a.twipsValue.toString(),onValueChange:l,disabled:o,children:[jsxRuntime.jsx(zt,{className:J("h-8 text-sm gap-0.5 px-2",r),style:{width:"auto"},"aria-label":i("lineSpacing.label"),title:i("lineSpacing.lineSpacingTitle",{label:c(a)}),children:jsxRuntime.jsx(Ds,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(Vt,{children:[n.map(s=>jsxRuntime.jsx(tt,{value:s.twipsValue.toString(),children:c(s)},s.twipsValue)),jsxRuntime.jsx(So,{}),jsxRuntime.jsx(Kt,{children:jsxRuntime.jsx(To,{children:i("lineSpacing.blockSpacingRules")})})]})]})}var RE={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},IE=new Set(["Title","Heading1","Heading2","Heading3"]),kE={Subtitle:"666666"},_E="#4a6c8c";function Hf(e){let t=RE[e.styleId],o={fontSize:t?`${t}px`:`${Math.min(Math.max(e.fontSize?e.fontSize/2:11,11),20)}px`,lineHeight:"1.3"};(e.bold??IE.has(e.styleId))&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let r=e.color??kE[e.styleId];return r?o.color=`#${r}`:e.styleId.startsWith("Heading")&&(o.color=_E),o}function Af(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:t.name||t.styleId,priority:99}))}var Ff=[{styleId:"Normal",name:"Normal text",nameKey:"styles.normalText",type:"paragraph",isDefault:true,priority:0,qFormat:true,fontSize:22},{styleId:"Title",name:"Title",nameKey:"styles.title",type:"paragraph",priority:1,qFormat:true,fontSize:52,bold:true},{styleId:"Subtitle",name:"Subtitle",nameKey:"styles.subtitle",type:"paragraph",priority:2,qFormat:true,fontSize:30,color:"666666"},{styleId:"Heading1",name:"Heading 1",nameKey:"styles.heading1",type:"paragraph",priority:3,qFormat:true,fontSize:40,bold:true},{styleId:"Heading2",name:"Heading 2",nameKey:"styles.heading2",type:"paragraph",priority:4,qFormat:true,fontSize:32,bold:true},{styleId:"Heading3",name:"Heading 3",nameKey:"styles.heading3",type:"paragraph",priority:5,qFormat:true,fontSize:28,bold:true}];function Of({value:e,onChange:t,styles:n,disabled:o=false,className:r,width:i=120}){let{t:a}=_(),l=je__namespace.useMemo(()=>{let g=Af(n);return g.length===0?Ff:g.map(p=>({...p,type:"paragraph",nameKey:Ff.find(f=>f.styleId===p.styleId)?.nameKey}))},[n]),c=je__namespace.useCallback(g=>{t?.(g);},[t]),s=g=>g.nameKey?a(g.nameKey):g.name,d=e||"Normal",u=l.find(g=>g.styleId===d),m=u?s(u):d;return jsxRuntime.jsxs(qt,{value:d,onValueChange:c,disabled:o,children:[jsxRuntime.jsx(zt,{className:J("h-8 text-sm",r),style:{width:typeof i=="number"?`${i}px`:i},"aria-label":a("styles.selectAriaLabel"),children:jsxRuntime.jsx("span",{className:"truncate",children:m})}),jsxRuntime.jsx(Vt,{className:"min-w-[260px] max-h-[400px]",children:l.map(g=>jsxRuntime.jsx(tt,{value:g.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:Hf(g),children:s(g)})},g.styleId))})]})}var NE=[{value:.5,label:"50%"},{value:.75,label:"75%"},{value:1,label:"100%"},{value:1.25,label:"125%"},{value:1.5,label:"150%"},{value:2,label:"200%"}];function Bf({value:e=1,onChange:t,levels:n=NE,disabled:o=false,className:r,compact:i=false}){let{t:a}=_(),l=je__namespace.useMemo(()=>{let g=n.find(p=>Math.abs(p.value-e)<.001);return g?g.label:`${Math.round(e*100)}%`},[n,e]),c=je__namespace.useCallback(g=>{let p=parseFloat(g);isNaN(p)||t?.(p);},[t]),s=je__namespace.useMemo(()=>[...n].sort((g,p)=>g.value-p.value),[n]),d=je__namespace.useMemo(()=>[...s].reverse().find(g=>g.value<e-.001),[s,e]),u=je__namespace.useMemo(()=>s.find(g=>g.value>e+.001),[s,e]),m=i?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Me,{variant:"ghost",size:"icon-sm",className:J(m,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",(o||!d)&&"opacity-30 cursor-not-allowed"),onClick:()=>d&&t?.(d.value),disabled:o||!d,"aria-label":a("zoom.zoomOut"),children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsxs(qt,{value:e.toString(),onValueChange:c,disabled:o,children:[jsxRuntime.jsx(zt,{className:J(i?"h-7 min-w-[55px] text-xs":"h-8 min-w-[64px] text-sm","rounded-none",r),"aria-label":a("zoom.ariaLabel",{label:l}),children:jsxRuntime.jsx(hi,{placeholder:"100%",children:l})}),jsxRuntime.jsx(Vt,{children:n.map(g=>jsxRuntime.jsx(tt,{value:g.value.toString(),children:g.label},g.value))})]}),jsxRuntime.jsx(Me,{variant:"ghost",size:"icon-sm",className:J(m,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(o||!u)&&"opacity-30 cursor-not-allowed"),onClick:()=>u&&t?.(u.value),disabled:o||!u,"aria-label":a("zoom.zoomIn"),children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var HE=[{action:"borderAll",icon:"border_all",labelKey:"table.borders.all"},{action:"borderOutside",icon:"border_outer",labelKey:"table.borders.outside"},{action:"borderInside",icon:"border_inner",labelKey:"table.borders.inside"},{action:"borderTop",icon:"border_top",labelKey:"table.borders.top"},{action:"borderBottom",icon:"border_bottom",labelKey:"table.borders.bottom"},{action:"borderLeft",icon:"border_left",labelKey:"table.borders.left"},{action:"borderRight",icon:"border_right",labelKey:"table.borders.right"},{action:"borderNone",icon:"border_clear",labelKey:"table.borders.none"}];function zf({onAction:e,disabled:t=false}){let{t:n}=_(),[o,r]=je.useState(false),i=je.useCallback(()=>r(false),[]),{containerRef:a,dropdownRef:l,dropdownStyle:c,handleMouseDown:s}=We({isOpen:o,onClose:i}),d=je.useCallback(m=>{e(m),r(false);},[e]),u=jsxRuntime.jsxs(Me,{variant:"ghost",size:"icon-sm",className:J("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:s,onClick:()=>!t&&r(m=>!m),disabled:t,"aria-label":n("table.borders.styleAriaLabel"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(K,{name:"border_all",size:20}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[o?u:jsxRuntime.jsx(et,{content:n("table.borders.tooltip"),children:u}),o&&!t&&jsxRuntime.jsx("div",{ref:l,style:{...c,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:m=>m.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:HE.map(({action:m,icon:g,labelKey:p})=>jsxRuntime.jsx("button",{type:"button",title:n(p),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text)"},onMouseDown:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(m),children:jsxRuntime.jsx(K,{name:g,size:18})},typeof m=="string"?m:m.type))})})]})}function Vf({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=_(),i=je.useCallback(a=>{if(typeof a=="string"){e({type:"borderColor",color:a.replace(/^#/,"")});return}let l=a.kind==="auto"?"000000":Mt(a,n);l&&e({type:"borderColor",color:l});},[e,n]);return jsxRuntime.jsx(Eo,{mode:"border",value:o,onChange:i,theme:n,disabled:t,title:r("table.borderColor")})}var ZE=[{size:4,label:"0.5 pt",thickness:.5},{size:8,label:"1 pt",thickness:1},{size:12,label:"1.5 pt",thickness:1.5},{size:16,label:"2 pt",thickness:2},{size:24,label:"3 pt",thickness:3}];function $f({onAction:e,disabled:t=false}){let[n,o]=je.useState(false),{t:r}=_(),i=je.useCallback(()=>o(false),[]),{containerRef:a,dropdownRef:l,dropdownStyle:c,handleMouseDown:s}=We({isOpen:n,onClose:i}),d=je.useCallback(m=>{e({type:"borderWidth",size:m}),o(false);},[e]),u=jsxRuntime.jsxs(Me,{variant:"ghost",size:"icon-sm",className:J("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:s,onClick:()=>!t&&o(m=>!m),disabled:t,"aria-label":r("table.borderWidth"),"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(K,{name:"line_weight",size:20}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[n?u:jsxRuntime.jsx(et,{content:r("table.borderWidth"),children:u}),n&&!t&&jsxRuntime.jsx("div",{ref:l,style:{...c,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:120},onMouseDown:m=>m.stopPropagation(),children:ZE.map(({size:m,label:g,thickness:p})=>jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",width:"100%",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:12,color:"var(--doc-text)"},onMouseDown:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(m),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(p,1),backgroundColor:"#000",borderRadius:p>2?1:0}}),jsxRuntime.jsx("span",{children:g})]},m))})]})}function Gf({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=_(),i=je.useCallback(a=>{typeof a=="string"&&e(a==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:a.replace(/^#/,"")});},[e]);return jsxRuntime.jsx("div",{"data-testid":"toolbar-table-cell-fill",style:{display:"inline-block"},children:jsxRuntime.jsx(Eo,{mode:"highlight",value:o,onChange:i,theme:n,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var qE={display:"flex",alignItems:"center",gap:10,padding:"7px 14px",fontSize:13,color:"var(--doc-text)",cursor:"pointer",border:"none",backgroundColor:"transparent",width:"100%",textAlign:"left"},Ro={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},Xf={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function Qf({onAction:e,disabled:t=false,tableContext:n}){let{t:o}=_(),[r,i]=je.useState(false),[a,l]=je.useState(null),c=je.useCallback(()=>i(false),[]),{containerRef:s,dropdownRef:d,dropdownStyle:u,handleMouseDown:m}=We({isOpen:r,onClose:c,align:"right"}),g=n?.table?.attrs?.justification??"left",p=je.useCallback(h=>{e(h),i(false);},[e]),f=(h,P,x,C,v)=>{let y=t||v?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...qE,backgroundColor:a===h&&!y?"var(--doc-bg-hover)":"transparent",color:y?"var(--doc-text-muted)":v?.danger?"var(--doc-error)":"var(--doc-text)",cursor:y?"not-allowed":"pointer"},onClick:()=>!y&&p(C),onMouseEnter:()=>l(h),onMouseLeave:()=>l(null),disabled:y,children:[jsxRuntime.jsx(K,{name:P,size:16,className:v?.danger&&!y?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:x})]},h)},b=jsxRuntime.jsx(Me,{variant:"ghost",size:"icon-sm",className:J("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:m,onClick:()=>!t&&i(h=>!h),disabled:t,"aria-label":o("table.moreOptions"),"aria-expanded":r,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:jsxRuntime.jsx(K,{name:"more_vert",size:20})});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block"},children:[r?b:jsxRuntime.jsx(et,{content:o("table.moreOptions"),children:b}),r&&!t&&jsxRuntime.jsxs("div",{ref:d,style:{...u,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:h=>h.stopPropagation(),children:[f("addRowAbove","add",o("table.insertRowAbove"),"addRowAbove"),f("addRowBelow","add",o("table.insertRowBelow"),"addRowBelow"),f("addColumnLeft","add",o("table.insertColumnLeft"),"addColumnLeft"),f("addColumnRight","add",o("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),f("mergeCells","call_merge",o("table.mergeCells"),"mergeCells",{itemDisabled:!n?.hasMultiCellSelection}),f("splitCell","call_split",o("table.splitCell"),"splitCell",{itemDisabled:!n?.canSplitCell}),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),f("selectTable","select_all",o("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),f("deleteRow","delete",o("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(n?.rowCount??0)<=1}),f("deleteColumn","delete",o("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(n?.columnCount??0)<=1}),f("deleteTable","delete",o("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),jsxRuntime.jsx("div",{style:Xf,children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(h=>{let P={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:o({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[h]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:C=>C.preventDefault(),onMouseEnter:C=>{C.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:C=>{C.currentTarget.style.backgroundColor="transparent";},onClick:()=>p({type:"cellVerticalAlign",align:h}),children:jsxRuntime.jsx(K,{name:P[h],size:16})},h)})}),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),jsxRuntime.jsx("div",{style:Xf,children:o("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(h=>{let P={left:"format_align_left",center:"format_align_center",right:"format_align_right"},x=g===h;return jsxRuntime.jsx("button",{type:"button",title:o({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[h]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:x?"var(--doc-primary-light)":"transparent",borderColor:x?"var(--doc-primary)":"var(--doc-border)",color:x?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:C=>C.preventDefault(),onClick:()=>p({type:"tableProperties",props:{justification:h}}),children:jsxRuntime.jsx(K,{name:P[h],size:16})},h)})}),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),f("headerRow","table_rows",o("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),f("distribute","view_column",o("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),f("autoFit","fit_width",o("tableAdvanced.autoFit"),{type:"autoFitContents"}),f("noWrap","wrap_text",o("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Ro,role:"separator"}),f("properties","settings",o("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var zE=20;function Ri({options:e,activeValue:t,triggerIcon:n,tooltipContent:o,onSelect:r,disabled:i=false,ariaLabel:a,testId:l,showLabels:c=false}){let[s,d]=je.useState(false),u=je.useCallback(()=>d(false),[]),{containerRef:m,dropdownRef:g,dropdownStyle:p,handleMouseDown:f}=We({isOpen:s,onClose:u}),b=je.useCallback(P=>{i||r(P),d(false);},[i,r]),h=jsxRuntime.jsxs(Me,{variant:"ghost",size:"icon-sm",className:J("text-muted-foreground hover:text-foreground hover:bg-muted/80",s&&"bg-muted",i&&"opacity-30 cursor-not-allowed"),onMouseDown:f,onClick:()=>!i&&d(P=>!P),disabled:i,"aria-label":a??o,"aria-expanded":s,"aria-haspopup":"true","data-testid":l,children:[jsxRuntime.jsx(K,{name:n,size:zE}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:m,style:{position:"relative",display:"inline-block"},children:[s?h:jsxRuntime.jsx(et,{content:o,children:h}),s&&!i&&jsxRuntime.jsx("div",{ref:g,style:{...p,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:P=>P.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:c?"column":"row",gap:c?1:2,minWidth:c?200:void 0},children:e.map(P=>{let x=t===P.value;return jsxRuntime.jsxs("button",{type:"button",title:P.label,"data-testid":l?`${l}-${P.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:x?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:x?"var(--doc-primary)":"var(--doc-text)",...c?{width:"100%",gap:10,padding:"0 10px",justifyContent:"flex-start",fontSize:13,textAlign:"left"}:{width:32,justifyContent:"center"}},onMouseDown:C=>C.preventDefault(),onMouseEnter:C=>{x||(C.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=x?"var(--doc-primary-light)":"transparent";},onClick:()=>b(P.value),children:[jsxRuntime.jsx(K,{name:P.iconName,size:18}),c&&jsxRuntime.jsx("span",{style:{flex:1},children:P.label})]},P.value)})})})]})}var VE=[{value:"inline",labelKey:"imageWrap.inline",iconName:"wrap_text"},{value:"wrapRight",labelKey:"imageWrap.floatLeft",iconName:"format_image_left"},{value:"wrapLeft",labelKey:"imageWrap.floatRight",iconName:"format_image_right"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function WE(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function e0({imageContext:e,onChange:t,disabled:n=false}){let{t:o}=_(),r=VE.map(l=>({...l,label:o(l.labelKey)})),i=WE(e),a=r.find(l=>l.value===i)||r[0];return jsxRuntime.jsx(Ri,{options:r,activeValue:i,triggerIcon:a.iconName,tooltipContent:`Wrap: ${a.label}`,onSelect:t,disabled:n,testId:"toolbar-image-wrap",showLabels:true})}var UE=[{value:"rotateCW",labelKey:"imageTransform.rotateClockwise",iconName:"rotate_right"},{value:"rotateCCW",labelKey:"imageTransform.rotateCounterClockwise",iconName:"rotate_left"},{value:"flipH",labelKey:"imageTransform.flipHorizontal",iconName:"swap_horiz"},{value:"flipV",labelKey:"imageTransform.flipVertical",iconName:"swap_vert"}];function t0({onTransform:e,disabled:t=false}){let{t:n}=_(),o=UE.map(r=>({...r,label:n(r.labelKey)}));return jsxRuntime.jsx(Ri,{options:o,triggerIcon:"rotate_right",tooltipContent:n("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var ut=18;function ot({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,ariaLabel:a}){let l=a?.toLowerCase().replace(/\s+/g,"-")||n?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),c=d=>{d.preventDefault();},s=jsxRuntime.jsx(Me,{variant:"ghost",size:"icon-sm",className:J("docx-editor-toolbar-toggle text-muted-foreground",t&&"opacity-30 cursor-not-allowed",i),"data-active":e?"true":void 0,onMouseDown:c,onClick:t?void 0:o,"aria-disabled":t||void 0,tabIndex:t?-1:void 0,"aria-pressed":!!e,"aria-label":a||n,"data-testid":l?`toolbar-${l}`:void 0,children:r});return n?jsxRuntime.jsx(et,{content:n,children:s}):s}function pt({label:e,children:t,className:n}){return jsxRuntime.jsx("div",{className:J("flex items-center gap-px px-1.5 border-r border-border/50 last:border-r-0 first:pl-0",n),role:"group","aria-label":e,children:t})}function QE(e){let t=je__namespace.default.useContext(Dr);return t?{...t,...JE(e)}:e}function JE(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function Rc(e){let{t}=_(),n=QE(e),{currentFormatting:o={},onFormat:r,onUndo:i,onRedo:a,canUndo:l=false,canRedo:c=false,disabled:s=false,className:d,style:u,enableShortcuts:m=true,editorRef:g,children:p,showFontPicker:f=true,fontFamilies:b,documentFonts:h,showFontSizePicker:P=true,showTextColorPicker:x=true,showHighlightColorPicker:C=true,showAlignmentButtons:v=true,showListButtons:y=true,showLineSpacingPicker:T=true,showStylePicker:M=true,documentStyles:w,theme:E,showZoomControl:D=true,zoom:A,onZoomChange:H,onRefocusEditor:k,imageContext:L,onImageWrapType:R,onImageTransform:I,onOpenImageProperties:z,tableContext:Z,onTableAction:V,inline:Y=false}=n,Re=je.useRef(null),se=je.useCallback(de=>{!s&&r&&r(de);},[s,r]),Se=je.useCallback(()=>{!s&&l&&i&&i();},[s,l,i]),Pe=je.useCallback(()=>{!s&&c&&a&&a();},[s,c,a]),G=je.useCallback(de=>{!s&&r&&r({type:"fontFamily",value:de});},[s,r]),q=je__namespace.default.useMemo(()=>vc(b),[b]),Ee=je.useCallback(de=>{!s&&r&&r({type:"fontSize",value:de});},[s,r]),Ue=je.useCallback(de=>{!s&&r&&r({type:"textColor",value:de});},[s,r]),ce=je.useCallback(de=>{!s&&r&&r({type:"highlightColor",value:typeof de=="string"?de:""});},[s,r]),Ge=je.useCallback(de=>{!s&&r&&r({type:"alignment",value:de});},[s,r]),pn=je.useCallback(()=>{!s&&r&&r("bulletList");},[s,r]),ko=je.useCallback(()=>{!s&&r&&r("numberedList");},[s,r]),Or=je.useCallback(()=>{!s&&r&&r("indent");},[s,r]),u0=je.useCallback(()=>{!s&&r&&r("outdent");},[s,r]),p0=je.useCallback(de=>{!s&&r&&(r({type:"lineSpacing",value:de}),requestAnimationFrame(()=>k?.()));},[s,r,k]),m0=je.useCallback(de=>{!s&&r&&r({type:"applyStyle",value:de});},[s,r]),mn=je.useCallback(de=>{!s&&V&&(V(de),requestAnimationFrame(()=>k?.()));},[s,V,k]);je.useEffect(()=>{if(!m)return;let de=ue=>{if(ue.defaultPrevented)return;let fn=ue.target,_c=g?.current,b0=Re.current,h0=_c?.contains(fn),v0=b0?.contains(fn);if(!h0&&!v0)return;if((ue.ctrlKey||ue.metaKey)&&!ue.altKey)switch(ue.key.toLowerCase()){case "b":ue.preventDefault(),se("bold");break;case "i":ue.preventDefault(),se("italic");break;case "u":ue.preventDefault(),se("underline");break;case "=":ue.shiftKey?(ue.preventDefault(),se("superscript")):(ue.preventDefault(),se("subscript"));break;case "l":ue.preventDefault(),Ge("left");break;case "e":ue.preventDefault(),Ge("center");break;case "r":ue.preventDefault(),Ge("right");break;case "j":ue.preventDefault(),Ge("both");break;case "k":ue.preventDefault(),se("insertLink");break}};return document.addEventListener("keydown",de),()=>{document.removeEventListener("keydown",de);}},[m,se,Ge,g]);let f0=je.useCallback(de=>{let ue=de.target;ue.tagName==="INPUT"||ue.tagName==="TEXTAREA"||ue.tagName==="SELECT"||ue.tagName==="OPTION"||de.preventDefault();},[]),g0=je.useCallback(de=>{let ue=de.target,fn=document.activeElement;ue.tagName==="SELECT"||ue.tagName==="OPTION"||fn?.tagName==="SELECT"||requestAnimationFrame(()=>{k?.();});},[k]);return jsxRuntime.jsxs("div",{ref:Re,className:J(!Y&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",d),style:Y?{display:"contents",...u}:u,role:Y?void 0:"toolbar","aria-label":Y?void 0:t("toolbar.ariaLabel"),"data-testid":Y?void 0:"formatting-bar",onMouseDown:Y?void 0:f0,onMouseUp:Y?void 0:g0,children:[jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx(ot,{onClick:Se,disabled:s||!l,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(K,{name:"undo",size:ut})}),jsxRuntime.jsx(ot,{onClick:Pe,disabled:s||!c,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(K,{name:"redo",size:ut})})]}),D&&jsxRuntime.jsx(pt,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(Bf,{value:A,onChange:H,disabled:s,compact:true})}),M&&jsxRuntime.jsx(pt,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(Of,{value:o.styleId||"Normal",onChange:m0,styles:w,theme:E,disabled:s,width:120})}),(f||P)&&jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.font"),children:[f&&jsxRuntime.jsx(bf,{value:o.fontFamily||"Arial",onChange:G,fonts:q,documentFonts:h,disabled:s,width:60,placeholder:"Arial"}),P&&jsxRuntime.jsx(Tf,{value:o.fontSize!==void 0?cl(o.fontSize):11,onChange:Ee,disabled:s,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(ot,{onClick:()=>se("bold"),active:o.bold,disabled:s,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(K,{name:"format_bold",size:ut})}),jsxRuntime.jsx(ot,{onClick:()=>se("italic"),active:o.italic,disabled:s,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(K,{name:"format_italic",size:ut})}),jsxRuntime.jsx(ot,{onClick:()=>se("underline"),active:o.underline,disabled:s,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(K,{name:"format_underlined",size:ut})}),jsxRuntime.jsx(ot,{onClick:()=>se("strikethrough"),active:o.strike,disabled:s,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(K,{name:"strikethrough_s",size:ut})}),x&&jsxRuntime.jsx(Eo,{mode:"text",value:o.color?.replace(/^#/,""),onChange:Ue,theme:E,disabled:s,title:t("formattingBar.fontColor")}),C&&jsxRuntime.jsx(Eo,{mode:"highlight",value:o.highlight,onChange:ce,theme:E,disabled:s,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(ot,{onClick:()=>se("insertLink"),disabled:s,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(K,{name:"link",size:ut})})]}),jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(ot,{onClick:()=>se("superscript"),active:o.superscript,disabled:s,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(K,{name:"superscript",size:ut})}),jsxRuntime.jsx(ot,{onClick:()=>se("subscript"),active:o.subscript,disabled:s,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(K,{name:"subscript",size:ut})})]}),v&&jsxRuntime.jsx(pt,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(kf,{value:o.alignment||"left",onChange:Ge,disabled:s})}),(y||T)&&jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.listFormatting"),children:[y&&jsxRuntime.jsx(Df,{listState:o.listState||Ti(),onBulletList:pn,onNumberedList:ko,onIndent:Or,onOutdent:u0,disabled:s,showIndentButtons:true,compact:true,hasIndent:(o.indentLeft??0)>0}),T&&jsxRuntime.jsx(Lf,{value:o.lineSpacing,onChange:p0,disabled:s})]}),L&&R&&jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(e0,{imageContext:L,onChange:R,disabled:s}),I&&jsxRuntime.jsx(t0,{onTransform:I,disabled:s}),z&&jsxRuntime.jsx(ot,{onClick:z,disabled:s,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx(K,{name:"tune",size:ut})})]}),Z?.isInTable&&V&&jsxRuntime.jsxs(pt,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(zf,{onAction:mn,disabled:s}),jsxRuntime.jsx(Vf,{onAction:mn,disabled:s,theme:E,value:Mt(Z?.cellBorderColor,E)}),jsxRuntime.jsx($f,{onAction:mn,disabled:s}),jsxRuntime.jsx(Gf,{onAction:mn,disabled:s,theme:E,value:Z?.cellBackgroundColor}),jsxRuntime.jsx(Qf,{onAction:mn,disabled:s,tableContext:Z})]}),jsxRuntime.jsx(ot,{onClick:()=>se("clearFormatting"),disabled:s,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(K,{name:"format_clear",size:ut})}),p]})}function e2({children:e,className:t,style:n,...o}){return jsxRuntime.jsx(Dr.Provider,{value:o,children:jsxRuntime.jsx("div",{className:J("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:Ve.toolbar,...n},"data-testid":"editor-toolbar",children:e})})}var $e=e2;$e.TitleBar=gc;$e.Logo=mi;$e.DocumentName=fc;$e.MenuBar=gi;$e.TitleBarRight=fi;$e.Toolbar=Rc;var n2=new Map([["#ffff00","yellow"],["#00ff00","green"],["#00ffff","cyan"],["#ff00ff","magenta"],["#0000ff","blue"],["#ff0000","red"],["#000080","darkBlue"],["#008080","darkCyan"],["#008000","darkGreen"],["#800080","darkMagenta"],["#800000","darkRed"],["#808000","darkYellow"],["#808080","darkGray"],["#c0c0c0","lightGray"],["#ffffff","white"]]),r2=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function a2({source:e,scale:t,measurer:n,documentName:o,onStateChange:r,onError:i,onSave:a,renderTitleBarLeft:l,renderTitleBarRight:c,ref:s,colorMode:d,onZoomChange:u,documentFontFamily:m,className:g}){let p=je.useRef(null),[f,b]=je.useState(null),[h,P]=je.useState({}),[x,C]=je.useState(null),v=je.useCallback(w=>{b(w);let E=p.current?.formatting();E&&P({bold:E.bold,italic:E.italic,underline:E.underline,strike:E.strikethrough,superscript:E.superscript,subscript:E.subscript,...E.fontFamily?{fontFamily:E.fontFamily}:{},...E.fontSizeHalfPoints?{fontSize:E.fontSizeHalfPoints}:{},...E.alignment?{alignment:E.alignment}:{},...E.styleId?{styleId:E.styleId}:{},...E.color?{color:`#${E.color}`}:{},...E.highlight?{highlight:E.highlight}:{}}),C(p.current?.sectionProperties()??null),r?.(w);},[r]),y=je.useCallback(w=>{let E=p.current;if(E){if(typeof w=="string")switch(w){case "bold":return E.toggleRunProperty("b");case "italic":return E.toggleRunProperty("i");case "underline":return E.toggleRunProperty("u",{val:"single"});case "strikethrough":return E.toggleRunProperty("strike");case "superscript":return E.setRunProperty("vertAlign",{val:"superscript"});case "subscript":return E.setRunProperty("vertAlign",{val:"subscript"});case "clearFormatting":E.setRunProperty("b",{val:"0"}),E.setRunProperty("i",{val:"0"}),E.setRunProperty("u",{val:"none"}),E.setRunProperty("strike",{val:"0"}),E.setRunProperty("vertAlign",{val:"baseline"});return;default:return}switch(w.type){case "fontFamily":return E.setRunProperty("rFonts",{ascii:w.value,hAnsi:w.value});case "fontSize":return E.setRunProperty("sz",{val:String(Math.round(w.value*2))});case "textColor":{let D=w.value,A=typeof D=="string"?r2(D):Mt(D,null)??null;return A?E.setRunProperty("color",{val:A}):void 0}case "highlightColor":{let D=w.value.trim().toLowerCase();if(D==="none"||D==="")return E.setRunProperty("highlight",{val:"none"});let A=n2.get(D.startsWith("#")?D:`#${D}`);return A?E.setRunProperty("highlight",{val:A}):void 0}case "alignment":return E.setParagraphProperty("jc",{val:String(w.value)});case "lineSpacing":return E.setParagraphProperty("spacing",{line:String(Math.round(w.value)),lineRule:"auto"},{mergeAttributes:true});case "applyStyle":return E.setParagraphProperty("pStyle",{val:w.value});default:return}}},[]);je.useImperativeHandle(s,()=>p.current,[]);let T=t===void 0?1:t/(96/72),M=x?{pageWidthTwips:x.pageSize.widthTwips,pageHeightTwips:x.pageSize.heightTwips,orientation:x.landscape?"landscape":"portrait",marginsTwips:{top:x.margins.topTwips,right:x.margins.rightTwips,bottom:x.margins.bottomTwips,left:x.margins.leftTwips}}:null;return jsxRuntime.jsxs("div",{className:["docx-editor docx-paginated-shell",d==="dark"?"dark":"",g??""].filter(Boolean).join(" "),style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,background:"var(--doc-bg)",color:"var(--doc-text)"},"data-testid":"paginated-shell",children:[jsxRuntime.jsxs($e,{currentFormatting:h,onFormat:y,onUndo:()=>p.current?.undo(),onRedo:()=>p.current?.redo(),canUndo:f?.canUndo??false,canRedo:f?.canRedo??false,zoom:T,onZoomChange:u,onSave:()=>{let w=p.current?.save();w&&a?.(w);},children:[jsxRuntime.jsxs($e.TitleBar,{children:[l&&jsxRuntime.jsx($e.Logo,{children:l()}),jsxRuntime.jsx($e.DocumentName,{value:o??"Document",editable:false}),c&&jsxRuntime.jsx($e.TitleBarRight,{children:c()}),jsxRuntime.jsx($e.MenuBar,{})]}),jsxRuntime.jsx($e.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[M?jsxRuntime.jsx("div",{style:{padding:"4px 0"},children:jsxRuntime.jsx(co,{pageSetup:M,zoom:T})}):null,jsxRuntime.jsx(cc,{ref:p,source:e,...m?{documentFontFamily:m}:{},...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onStateChange:v,...i?{onError:i}:{}})]})]})}var ki=class{listeners=new Set;snapshot;constructor(t){this.snapshot=t;}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t);});getSnapshot=()=>this.snapshot;setSnapshot(t){this.snapshot=t,this.notify();}notify(){for(let t of this.listeners)t();}};var _i=class extends ki{notifications=[];idCounter=0;timers=new Set;constructor(){super({notifications:[]});}showError(t,n){return this.addNotification(t,"error",n)}showWarning(t,n){return this.addNotification(t,"warning",n)}showInfo(t,n){return this.addNotification(t,"info",n)}dismiss(t){this.notifications=this.notifications.map(o=>o.id===t?{...o,dismissed:true}:o),this.emitSnapshot();let n=setTimeout(()=>{this.timers.delete(n),this.notifications=this.notifications.filter(o=>o.id!==t),this.emitSnapshot();},300);this.timers.add(n);}clearAll(){this.notifications=[];for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.emitSnapshot();}destroy(){for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.notifications=[];}addNotification(t,n,o){let r=`error-${++this.idCounter}-${Date.now()}`,i={id:r,message:t,severity:n,details:o,timestamp:Date.now()};if(this.notifications=[...this.notifications,i],this.emitSnapshot(),n!=="error"){let a=setTimeout(()=>{this.timers.delete(a),this.dismiss(r);},5e3);this.timers.add(a);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var u2=je.createContext(null);function i0({children:e}){let t=je.useMemo(()=>new _i,[]),n=je.useSyncExternalStore(t.subscribe,t.getSnapshot),o=je.useCallback((s,d)=>{t.showError(s,d);},[t]),r=je.useCallback((s,d)=>{t.showWarning(s,d);},[t]),i=je.useCallback((s,d)=>{t.showInfo(s,d);},[t]),a=je.useCallback(s=>{t.dismiss(s);},[t]),l=je.useCallback(()=>{t.clearAll();},[t]),c=je.useMemo(()=>({notifications:n.notifications,showError:o,showWarning:r,showInfo:i,dismissNotification:a,clearNotifications:l}),[n.notifications,o,r,i,a,l]);return jsxRuntime.jsxs(u2.Provider,{value:c,children:[e,jsxRuntime.jsx(p2,{notifications:n.notifications,onDismiss:a})]})}function p2({notifications:e,onDismiss:t}){let n=e.filter(r=>!r.dismissed);return n.length===0?null:jsxRuntime.jsx("div",{className:"docx-notification-container",style:{position:"fixed",top:"16px",right:"16px",zIndex:10001,display:"flex",flexDirection:"column",gap:"8px",maxWidth:"400px"},children:n.map(r=>jsxRuntime.jsx(m2,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function m2({notification:e,onDismiss:t}){let{t:n}=_(),[o,r]=je.useState(false),a=(f=>{switch(f){case "error":return {bg:"var(--doc-error-bg)",border:"var(--doc-error)",text:"var(--doc-error)",icon:"var(--doc-error)"};case "warning":return {bg:"var(--doc-warning-bg)",border:"var(--doc-warning)",text:"var(--doc-warning-text)",icon:"var(--doc-warning)"};case "info":return {bg:"var(--doc-primary-light)",border:"var(--doc-primary)",text:"var(--doc-primary)",icon:"var(--doc-primary)"}}})(e.severity),l={background:a.bg,border:`1px solid ${a.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px var(--doc-shadow)",animation:"slideIn 0.3s ease-out"},c={display:"flex",alignItems:"flex-start",gap:"8px"},s={color:a.icon,flexShrink:0},d={flex:1,minWidth:0},u={color:a.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},m={marginTop:"8px",padding:"8px",background:"var(--doc-shadow-subtle)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:a.text,maxHeight:"200px",overflow:"auto"},g={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:a.text},p=f=>{switch(f){case "error":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "warning":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "info":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return jsxRuntime.jsxs("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:l,children:[jsxRuntime.jsx("style",{children:`
1
+ 'use strict';var rt=require('react'),editor=require('@docx-editor.dev/core/editor'),i18n=require('@docx-editor.dev/i18n'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom'),classVarianceAuthority=require('class-variance-authority'),clsx=require('clsx'),ye=require('@radix-ui/react-select'),editor$1=require('@docx-editor.dev/core/contracts/editor');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var rt__namespace=/*#__PURE__*/_interopNamespace(rt);var ye__namespace=/*#__PURE__*/_interopNamespace(ye);var cd={version:"2.8.0"};var ng=cd.version;var dd="(prefers-color-scheme: dark)";function ud(){return typeof window<"u"&&typeof window.matchMedia=="function"}function pd(){return ud()?window.matchMedia(dd).matches:false}function md(e,t){return e==="dark"||e==="system"&&t}function fd(e){if(!ud())return ()=>{};let t=window.matchMedia(dd);e(t.matches);let n=o=>e(o.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}var ll=rt.createContext(null);function H(){return rt.useContext(ll)}var ft=rt.createContext(null);var sl=rt.createContext(i18n.en),cl=rt.createContext("en");function Yo({i18n:e,children:t}){let n=rt.useContext(sl),o=rt.useContext(cl),r=typeof e?._lang=="string"?e._lang:o,i=rt.useMemo(()=>i18n.deepMerge(n,e),[n,e]);return jsxRuntime.jsx(cl.Provider,{value:r,children:jsxRuntime.jsx(sl.Provider,{value:i,children:t})})}function _(){let e=rt.useContext(sl),t=rt.useContext(cl);return {t:rt.useMemo(()=>i18n.createT(e,t),[e,t]),catalogue:e}}function yd(e){let{t}=_();return rt.useCallback((n,o)=>e?.get(n)??t(n,o),[e,t])}var dl=0,ul=false,pl=false;function xd(){let e=globalThis.navigator?.scheduling;return typeof e?.isInputPending!="function"?false:e.isInputPending({includeContinuous:true})?true:(ul||(ul=true,dl+=1,queueMicrotask(()=>{ul=false;}),pl||(pl=true,setTimeout(()=>{pl=false,dl=0;},0))),dl>16)}function Sd(e){let t=false;return ()=>{if(t)return;t=true;let n=()=>{t=false,e();};xd()?setTimeout(n,0):queueMicrotask(n);}}var ug=()=>{},fl=0;function pg(){return fl}function gl(e){return Sd(e)}function q(e,t=Object.is,n){let o=H(),r=n?.onSubscribe,i=n?.onUnsubscribe,a=rt.useCallback(d=>{if(!o)return ug;let u=false;fl++,r?.();let m=gl(()=>{u||d();}),g=[o.on("change",m),o.on("selectionChange",m),o.on("error",m)];return ()=>{u=true,fl--,i?.();for(let p of g)p();}},[o,r,i]),l=rt.useMemo(()=>{let d=false,u,m;return g=>{if(d&&g===u)return m;let p=e(g);return d&&t(m,p)?(u=g,m):(d=true,u=g,m=p,p)}},[o,e,t]),c=rt.useCallback(()=>l(o?o.snapshot():editor.LOADING_SNAPSHOT),[o,l]),s=rt.useCallback(()=>l(editor.LOADING_SNAPSHOT),[l]);return rt.useSyncExternalStore(a,c,s)}var Cd=12700,Td=96;function bg(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function hg(e,t,n,o){let r=e*72/n,i=t*72/o;return {widthPoints:Math.max(1,Math.round(r*100)/100),heightPoints:Math.max(1,Math.round(i*100)/100)}}function da(e){let t=editor.DEFAULT_IMAGE_RESOURCE_LIMITS;if(e.byteLength===0)return {ok:false,reasonKey:"imageInsert.errors.emptyFile"};if(e.byteLength>t.maxEncodedBytes)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let n=editor.sniffImageMime(e);if(!bg(n))return n==="image/svg+xml"||n==="image/tiff"?{ok:false,reasonKey:"imageInsert.errors.unsupportedFormat"}:{ok:false,reasonKey:"imageInsert.errors.invalidSignature"};let o=editor.validateRasterHeader(e,n);if(!o)return {ok:false,reasonKey:"imageInsert.errors.invalidSignature"};if(o.pixelWidth*o.pixelHeight>t.maxPixels||o.pixelWidth>t.maxDimension||o.pixelHeight>t.maxDimension)return {ok:false,reasonKey:"imageInsert.errors.oversize"};let{widthPoints:i,heightPoints:a}=hg(o.pixelWidth,o.pixelHeight,Td,Td);return Object.freeze({ok:true,bytes:e,mime:n,widthPoints:i,heightPoints:a})}function $t(e){return Math.round(e/Cd*100)/100}function An(e){return Math.round(e*Cd)}var fo=rt.createContext({t:void 0,onSave:void 0});function yg(){return rt.useContext(fo)}function ua(e){let{t}=_();return n=>e?.(n)??t(n)}function X(){let{t:e}=rt.useContext(fo);return ua(e)}function Eg(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function bl(e){return typeof e=="string"}function le(e){let t=H(),{t:n}=_(),o=bl(e)?e:editor.editorCommandKey(e),r=rt.useRef(e);r.current=e;let i=rt.useCallback(c=>{let s=r.current;if(bl(s)){let u=editor.toolbarCommandState(t,s);return {active:u.active,enabled:u.enabled,disabledReason:i18n.localizeDisabledReason(u.disabledReason,n)}}if(!t)return {active:false,enabled:false,disabledReason:null};let d=t.can(s);return {active:t.isActive(s),enabled:d.ok,disabledReason:d.ok?null:i18n.localizeDisabledReason(d.reason??null,n)}},[t,o,n]),a=q(i,Eg),l=rt.useCallback(()=>{let c=r.current;return bl(c)?editor.runToolbarCommand(t,c).ok:t?t.exec(c).ok:false},[t,o]);return rt.useMemo(()=>({execute:l,isActive:a.active,isEnabled:a.enabled,disabledReason:a.disabledReason}),[l,a])}function Mg(e,t){return typeof t!="function"?e:typeof e!="function"?t:n=>{e(n),n.defaultPrevented||t(n);}}function Ig(e,t){let n={...e,...t};for(let o of Object.keys(e))/^on[A-Z]/.test(o)?n[o]=Mg(t[o],e[o]):o==="className"?n[o]=[e[o],t[o]].filter(Boolean).join(" "):o==="style"&&(n[o]={...e[o],...t[o]});return n}function j({children:e,...t}){let n=rt.Children.only(e);if(!rt.isValidElement(n))return null;let o=n.props,r=Ig(t,o),i=n.ref,a=t.ref;return (i||a)&&(r.ref=l=>{for(let c of [i,a])typeof c=="function"?c(l):c&&typeof c=="object"&&(c.current=l);}),rt.cloneElement(n,r)}function J(e){for(let t of editor.CHROME_GROUPS)for(let n of t.controls)if(editor.chromeSlotId(t,n)===e)return n;return null}function re(e){return e?jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:e.map(t=>jsxRuntime.jsx("path",{d:t,fill:"currentColor"},t))}):null}function O(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function go(e){let{slot:t,icon:n,asChild:o,className:r,children:i,hidden:a}=e,{execute:l,isActive:c,isEnabled:s,disabledReason:d}=le(t),u=X();if(a)return null;let m=J(t),g=u(m?.labelKey??t),p=editor.commandForSlot(t),f=p?.type==="toggleMark"||p?.type==="setAlignment",b={onClick:()=>l(),onMouseDown:O,disabled:!s,"data-slot":t,className:`docx-toolbar__button${r?` ${r}`:""}`,...c?{"data-active":""}:{},...s?{}:{"data-disabled":""},...f?{"aria-pressed":c}:{},"aria-label":g,title:d??g};return o?jsxRuntime.jsx(j,{...b,children:i}):jsxRuntime.jsx("button",{type:"button",...b,children:n??i??re(m?.paths)})}go.docxToolbarPart=true;var Bg="image/png,image/jpeg,image/gif",vl=rt.createContext(null);function ma(){let e=rt.useContext(vl);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function yl(){return rt.useContext(vl)}function fa({children:e}){let t=H(),{t:n}=_(),o=rt.useRef(null),r=rt.useRef(false),i=rt.useCallback(()=>editor.toolbarCommandState(t,"image.insert"),[t]),a=q(i,(f,b)=>f.enabled===b.enabled&&f.disabledReason===b.disabledReason),l=a.enabled,c=i18n.localizeDisabledReason(a.disabledReason,n),s=rt.useCallback(async f=>{if(!t||r.current)return;let b=da(f);if(!b.ok){window.alert(n(b.reasonKey));return}let v={type:"insertImage",data:b.bytes,mime:b.mime,widthPoints:b.widthPoints,heightPoints:b.heightPoints},P=t.canExecuteImageCommand?.(v);if(P&&!P.ok){window.alert(P.reason??n("imageInsert.errors.refused"));return}r.current=true;try{let y=await editor.executeImageCommand(t,v);y.ok?t.focus():window.alert(y.reason??n("imageInsert.errors.refused"));}finally{r.current=false;}},[t,n]),d=rt.useCallback(async f=>{let b=f?.[0];if(!b)return;let v=await b.arrayBuffer();await s(new Uint8Array(v));},[s]),u=rt.useCallback(async f=>{if(!f)return;let b=[...f.files].find(v=>v.type.startsWith("image/"));if(b){await d([b]);return}for(let v of f.items){if(v.kind!=="file"||!v.type.startsWith("image/"))continue;let P=v.getAsFile();if(!P)continue;let y=await P.arrayBuffer();await s(new Uint8Array(y));return}},[s,d]),m=rt.useCallback(()=>{l&&o.current?.click();},[l]),g=rt.useCallback(async f=>{let b=f.currentTarget;await d(b.files),b.value="";},[d]),p=rt.useMemo(()=>({openFilePicker:m,insertFromFileList:d,insertFromDataTransfer:u,isEnabled:l,disabledReason:c,inputRef:o,onInputChange:g}),[m,d,u,l,c,g]);return jsxRuntime.jsxs(vl.Provider,{value:p,children:[jsxRuntime.jsx("input",{ref:o,type:"file",accept:Bg,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:g,onMouseDown:f=>f.stopPropagation()}),e]})}function ga({className:e,hidden:t,asChild:n,children:o}){let{openFilePicker:r,isEnabled:i,disabledReason:a}=ma(),l=X();if(t)return null;let c=J("image.insert"),s=l(c?.labelKey??"toolbar.image"),d={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.insert",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":s,title:a??s,onMouseDown:O,onClick:r};return n?jsxRuntime.jsx(j,{...d,children:o}):jsxRuntime.jsx("button",{...d,children:o??re(c?.paths)})}ga.docxSlot="image.insert";var Hn=Object.assign(ga,{docxSlot:"image.insert"});var Xg=["nw","n","ne","e","se","s","sw","w"],Nd=40,Ld=12;function Jg(e){return `imageOverlay.handle.${e}`}function Qg(e){switch(e){case "nw":case "se":return "nwse-resize";case "ne":case "sw":return "nesw-resize";case "n":case "s":return "ns-resize";default:return "ew-resize"}}function eb(e){return {nw:{x:"0%",y:"0%"},n:{x:"50%",y:"0%"},ne:{x:"100%",y:"0%"},e:{x:"100%",y:"50%"},se:{x:"100%",y:"100%"},s:{x:"50%",y:"100%"},sw:{x:"0%",y:"100%"},w:{x:"0%",y:"50%"}}[e]}function tb(e,t){return e>0&&t>0?"se":e>0&&t<0?"ne":e<0&&t>0?"sw":e<0&&t<0?"nw":e>0?"e":e<0?"w":t>0?"s":"n"}function xl({containerRef:e,portalRef:t,scrollPort:n}){let o=H(),{t:r}=_(),[i,a]=rt.useState(null),[l,c]=rt.useState(null),s=rt.useRef(null);s.current=l;let d=rt.useRef(null),u=rt.useRef(null),m=rt.useRef(null),g=rt.useRef(null),p=rt.useRef(null);rt.useEffect(()=>{let h=e.current;if(!h)return;let x=T=>{let E=(T.target instanceof Element?T.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");g.current=E??null,E&&E===i?.id&&queueMicrotask(()=>m.current?.focus({preventScroll:true}));};return h.addEventListener("pointerdown",x,{capture:true}),()=>h.removeEventListener("pointerdown",x,{capture:true})},[e,i?.id]),rt.useEffect(()=>{if(!o){a(null);return}let h=()=>{a(editor.selectedDrawingOverlayTargetOf(o.surface));},x=()=>{queueMicrotask(h);};h();let T=[o.on("change",x),o.on("selectionChange",h)];return ()=>{for(let k of T)k();}},[o]),rt.useEffect(()=>{if(n){p.current=n;return}let h=e.current;if(!h||!o?.surface)return;let x=h.closest(".docx-editor__scroll-container");if(!x)return;let T=o.surface.overlayCoordinates();return p.current=editor.createImageOverlayScrollPort(x,T.paintScale),()=>{p.current=null;}},[e,o,n]);let f=rt.useCallback(()=>{c(null),d.current=null;let h=u.current;if(u.current=null,h)try{h.releasePointerCapture(h._lastPointerId??0);}catch{}},[]),b=rt.useCallback((h,x,T,k,E,w,D)=>{if(!o?.surface)return;let F=editor.captureImageMutationPreconditions(o);if(!F)return;let A=o.surface.publishedLayout();d.current=Object.freeze({x:k,y:E}),u.current=w,w._lastPointerId=D;try{w.setPointerCapture(D);}catch{}c({session:Object.freeze({drawingNodeId:T.id,startBounds:Object.freeze({x:T.x,y:T.y,width:T.width,height:T.height}),startWidthEmu:T.widthEmu,startHeightEmu:T.heightEmu,startPosition:T.position,anchorFrameOrigin:T.anchorFrameOrigin,transform:T.transform,mode:h,handle:x,preconditions:F,layoutRevision:A.revision,packageRevision:o.surface.session.packageRevision(),kind:T.kind}),bounds:T,accumulatedScrollPt:0}),m.current?.focus({preventScroll:true});},[o]),v=rt.useCallback((h,x,T,k,E)=>{if(!o)return;if(editor.isStaleImageInteractionCommit(o,h)){f();return}h.mode==="resize"?o.exec({type:"setImageProperties",widthEmu:x,heightEmu:T,...E?.mode==="simple"?{horizontalEmu:E.horizontalEmu,verticalEmu:E.verticalEmu}:{},...E?.mode==="frame"?{...E.horizontalEmu!==void 0?{horizontalEmu:E.horizontalEmu}:{},...E.verticalEmu!==void 0?{verticalEmu:E.verticalEmu}:{}}:{}}):h.mode==="move"&&E&&o.exec({type:"setImagePosition",...E}),f();},[f,o]),P=rt.useCallback(h=>{if(!o)return;let x=s.current?.bounds??editor.selectedDrawingOverlayTargetOf(o.surface);if(!x)return;if(s.current&&h.key==="Escape"){h.preventDefault(),h.stopPropagation(),f();return}if(s.current)return;let T=h.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(h.key==="Delete"||h.key==="Backspace"){h.preventDefault(),h.stopPropagation(),o.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(h.key))return;h.preventDefault(),h.stopPropagation();let k=h.key==="ArrowLeft"?-T:h.key==="ArrowRight"?T:0,E=h.key==="ArrowUp"?-T:h.key==="ArrowDown"?T:0;if(h.altKey){if(!x.canResize)return;let D=tb(k,E),F=editor.computeImageResizeResult({handle:D,startWidthEmu:x.widthEmu,startHeightEmu:x.heightEmu,startBounds:{x:x.x,y:x.y,width:x.width,height:x.height},startPosition:x.position,anchorFrameOrigin:x.anchorFrameOrigin,deltaXPt:k,deltaYPt:E,transform:x.transform,preserveAspect:editor.resizePreservesAspect(D,x.aspectLocked,h.shiftKey),kind:x.kind});o.exec({type:"setImageProperties",widthEmu:F.widthEmu,heightEmu:F.heightEmu,...F.position?.mode==="simple"?{horizontalEmu:F.position.horizontalEmu,verticalEmu:F.position.verticalEmu}:{},...F.position?.mode==="frame"?{...F.position.horizontalEmu!==void 0?{horizontalEmu:F.position.horizontalEmu}:{},...F.position.verticalEmu!==void 0?{verticalEmu:F.position.verticalEmu}:{}}:{}});return}if(x.kind!=="anchored"||!x.canMove||!x.position)return;let w=editor.computeMovedImagePosition(x.position,k,E);o.exec({type:"setImagePosition",...w});},[f,o]);rt.useEffect(()=>{if(!l||!o?.surface)return;let h=o.surface.overlayCoordinates(),x=k=>{let E=s.current,w=d.current;if(!E||!w)return;let D=editor.cssPixelsToLayoutPoints(k.clientX-w.x,h.paintScale),F=editor.cssPixelsToLayoutPoints(k.clientY-w.y,h.paintScale);if(E.session.mode==="move"){let I=0,N=p.current,R=e.current?.closest(".docx-editor__scroll-container");if(N&&R){let ae=R.getBoundingClientRect();k.clientY>ae.bottom-Nd?I=Ld:k.clientY<ae.top+Nd&&(I=-Ld),I!==0&&(I=N.scrollBy(I));}let M=E.accumulatedScrollPt+I;c({...E,accumulatedScrollPt:M,bounds:Object.freeze({...E.bounds,x:E.session.startBounds.x+D,y:E.session.startBounds.y+F+M})});return}if(!E.session.handle)return;let A=editor.computeImageResizeResult({handle:E.session.handle,startWidthEmu:E.session.startWidthEmu,startHeightEmu:E.session.startHeightEmu,startBounds:E.session.startBounds,startPosition:E.session.startPosition,anchorFrameOrigin:E.session.anchorFrameOrigin,deltaXPt:D,deltaYPt:F,transform:E.session.transform,preserveAspect:editor.resizePreservesAspect(E.session.handle,E.bounds.aspectLocked,k.shiftKey),kind:E.session.kind});c({...E,bounds:Object.freeze({...E.bounds,x:A.previewBounds.x,y:A.previewBounds.y,width:A.previewBounds.width,height:A.previewBounds.height,widthEmu:A.widthEmu,heightEmu:A.heightEmu})});},T=k=>{let E=s.current;if(E)if(k.type==="pointerup"){let w=editor.cssPixelsToLayoutPoints(k.clientX-(d.current?.x??k.clientX),h.paintScale),D=editor.cssPixelsToLayoutPoints(k.clientY-(d.current?.y??k.clientY),h.paintScale),F=editor.finalizeImageOverlayInteraction({session:E.session,deltaXPt:w,deltaYPt:D,accumulatedScrollPt:E.accumulatedScrollPt,aspectLocked:E.bounds.aspectLocked,shiftKey:k.shiftKey,anchorFrameOrigin:E.session.anchorFrameOrigin});v(E.session,F.widthEmu,F.heightEmu,F.previewBounds,F.position);}else f();};return window.addEventListener("pointermove",x),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",T),()=>{window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",T);}},[f,v,e,o,l]),rt.useEffect(()=>{!i||g.current!==i.id||(g.current=null,m.current?.focus({preventScroll:true}));},[i]);let y=l?.bounds??i,S=rt.useMemo(()=>{if(!o?.surface||!y)return null;let h=o.surface.publishedLayout(),x=o.surface.overlayCoordinates(),T=editor.overlayFrameToSheetCssPixels(h,{pageIndex:y.pageIndex,x:y.x,y:y.y,width:y.width,height:y.height},x),k=y.canResize,E=y.kind==="anchored"&&y.canMove;return jsxRuntime.jsxs("div",{ref:m,className:"docx-image-selection-overlay","data-drawing-node-id":y.id,tabIndex:0,onKeyDown:P,children:[jsxRuntime.jsx("div",{className:`docx-image-selection-overlay__frame${E?" docx-editor-one-surface__overlay-control":""}`,role:"group","aria-label":r("imageOverlay.selection"),style:{left:`${T.left}px`,top:`${T.top}px`,width:`${T.width}px`,height:`${T.height}px`,cursor:E?"move":"default"},onPointerDown:w=>{O(w),!(!E||!y.position)&&w.button===0&&(w.preventDefault(),w.stopPropagation(),b("move",null,y,w.clientX,w.clientY,w.currentTarget,w.pointerId));}}),k?Xg.map(w=>{let D=eb(w);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(Jg(w)),tabIndex:0,style:{left:`calc(${T.left}px + ${T.width}px * ${parseFloat(D.x)/100} - 5px)`,top:`calc(${T.top}px + ${T.height}px * ${parseFloat(D.y)/100} - 5px)`,cursor:Qg(w)},onPointerDown:F=>{O(F),F.button===0&&(F.preventDefault(),F.stopPropagation(),b("resize",w,y,F.clientX,F.clientY,F.currentTarget,F.pointerId));}},w)}):null]})},[y,b,o,P,r]);return !S||!t.current?null:reactDom.createPortal(S,t.current)}function Tl(e){return [...e.items].some(t=>t.kind==="file"&&t.type.startsWith("image/"))}function va({className:e}){let t=H(),n=yl(),o=rt.useRef(null),r=rt.useRef(null);rt.useLayoutEffect(()=>{let c=o.current;if(!(!t||!c))return t.attach(c),()=>{t.detach();}},[t]);let i=rt.useCallback(c=>{if(!n?.isEnabled)return;let s=c.clipboardData;s&&Tl(s)&&(c.preventDefault(),n.insertFromDataTransfer(s));},[n]),a=rt.useCallback(c=>{!n?.isEnabled||!Tl(c.dataTransfer)||c.preventDefault();},[n]),l=rt.useCallback(c=>{n?.isEnabled&&Tl(c.dataTransfer)&&(c.preventDefault(),n.insertFromDataTransfer(c.dataTransfer));},[n]);return jsxRuntime.jsxs("div",{ref:r,className:"docx-content-mount",children:[jsxRuntime.jsx("div",{ref:o,className:`docx-paginated-surface${e?` ${e}`:""}`,onPaste:i,onDragOver:a,onDrop:l}),t?jsxRuntime.jsx(xl,{containerRef:o,portalRef:r}):null]})}var ab=e=>e.isLoading||e.isOpening===true;function Cl({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}function ib({when:e=false,overlay:t=false,className:n,style:o,children:r}){let i=q(ab),{t:a}=_();if(!e&&!i)return null;let l=`docx-editor docx-editor__loading${t?" docx-editor__loading--overlay":""}${n?` ${n}`:""}`;return jsxRuntime.jsx("div",{className:l,style:o,role:"status","aria-live":"polite",children:r??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Cl,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:a("loading.label")})]})})}var xa=Object.assign(ib,{Spinner:Cl});function Od(){let e=new Set,t=new Map,n=new Map,o=0,r=null,i=false;function a(){if(e.size===0&&t.size===0)return;if(t.size===0)return "kind";let m=Object.create(null),g=[...t].sort((p,f)=>(n.get(p[0])??0)-(n.get(f[0])??0));for(let[,{author:p,style:f}]of g)m[p]=f;return {authors:m,others:e.size>0?"kind":"author"}}let l=null,c=false;function s(m){if(m===void 0)return "none";if(typeof m=="string")return m;let g=Object.entries(m.authors).map(([p,f])=>`${p}\0${JSON.stringify(f)}`).sort();return `${m.others??"kind"}${g.join("")}`}function d(){if(!r)return;let m=a(),g=s(m);if(g!==l){if(m===void 0){i&&(r.setRevisionStyles("author"),i=false,l=g);return}r.setRevisionStyles(m),i=true,l=g;}}function u(){!r||c||(c=true,queueMicrotask(()=>{c=false,d();}));}return {registerScheme(m){e.add(m),u();},register(m,g,p){n.has(m)||n.set(m,o++),t.set(m,{author:g,style:p}),u();},unregister(m){(e.delete(m)||t.delete(m))&&u();},connect(m){r=m;let g=a();i=m!==null&&g!==void 0,l=m===null?null:s(g),u();},current:a}}var Bn=rt.createContext(null);function qd(){let e=rt.useRef(null);return e.current===null&&(e.current=Symbol("revision-style-declaration")),e.current}function Pl(){let e=rt.useContext(Bn),t=qd();return rt.useEffect(()=>{if(e)return e.registerScheme(t),()=>e.unregister(t)},[e,t]),null}function El(e){let{author:t,color:n,background:o,spanClassName:r,avatarUrl:i}=e,a=rt.useContext(Bn),l=qd();return rt.useEffect(()=>{if(a)return a.register(l,t,{...n!==void 0?{color:n}:{},...o!==void 0?{background:o}:{},...r!==void 0?{spanClassName:r}:{},...i!==void 0?{avatarUrl:i}:{}}),()=>a.unregister(l)},[a,l,t,n,o,r,i]),null}function Zn(e){return e.paragraphId===""}var bo=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),gb=e=>e;function bb(){let e=n=>!!n&&(n.width>0||n.height>0);if(typeof document<"u"){let o=document.querySelector("[data-docx-caret]")?.getBoundingClientRect();if(e(o))return {left:o.left,top:o.bottom}}let t=typeof window>"u"?null:window.getSelection();if(t&&t.rangeCount>0){let n=t.getRangeAt(0),o=n.getBoundingClientRect();if(e(o))return {left:o.left,top:o.bottom};let r=n.startContainer,a=(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.getBoundingClientRect();if(e(a))return {left:a.left,top:a.bottom}}return null}var qn=rt.createContext(null);function wl(){let e=rt.useContext(qn),t=Ta(e===null);return e??t}function Ta(e=true){let t=H(),[n,o]=rt.useState(bo),r=rt.useRef(null),i=rt.useRef(n);i.current=n;let a=q(gb),l=t?t.can({type:"insertText",text:""}).ok:false,c=rt.useCallback(()=>{let y=r.current;y&&(y.editor.releaseSelection(y.pin),r.current=null);},[]),s=rt.useCallback((y,S)=>{c(),o({mode:y?"reading":"editing",link:y??null,anchor:S??null,text:y?.text??"",url:y?y.kind==="internal"?`#${y.anchor??""}`:y.authored:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,c]),d=rt.useCallback(()=>{c(),o(bo);},[c]);rt.useEffect(()=>c,[c]);let u=rt.useCallback(()=>{let y=bb();c();let S=t?.surface?.hyperlinks.linkAtCaret()??t?.surface?.hyperlinks.fieldLinkAtCaret()??null;if(S&&Zn(S)){s(S,y);return}if(S){o({mode:"editing",link:S,anchor:y,text:S.text,url:S.kind==="internal"?`#${S.anchor??""}`:S.authored,copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});return}let h=t?.query({type:"selectedText"})??"",x=t?.retainSelection()??null;t&&x&&(r.current={editor:t,pin:x}),o({mode:"editing",link:null,anchor:y,text:h,url:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,s,c]);rt.useEffect(()=>{if(!(!t||!e))return t.setHyperlinkChrome({onPopover:y=>s(y.link,{left:y.rect.left,top:y.rect.bottom}),onRequest:u})},[t,e,s,u]),rt.useEffect(()=>{let y=i.current;if(y.mode!=="reading"||!y.link)return;let S=Zn(y.link)?t?.surface?.hyperlinks.fieldLinkAtCaret()??null:t?.surface?.hyperlinks.linkAtCaret()??null;S&&S.id===y.link.id||o(bo);},[a,t]),rt.useEffect(()=>{let y=i.current;if(y.mode!=="editing"||y.link)return;let S=t?.surface;!S||S.retainedSelection()||o(bo);},[a,t]);let m=rt.useCallback(async()=>{let y=i.current.link?.href;if(!y)return false;try{await navigator.clipboard.writeText(y);}catch{return false}return o(S=>({...S,copied:true})),true},[]),g=rt.useCallback(()=>{o(y=>({...y,mode:"editing",copied:false,error:false}));},[]),p=rt.useCallback(y=>{o(S=>({...S,text:y,copied:false,error:false}));},[]),f=rt.useCallback(y=>{o(S=>({...S,url:y,copied:false,error:false}));},[]),b=rt.useCallback(()=>{let y=i.current,S=t?.surface?.hyperlinks;if(!S)return false;let h=y.url.trim();if(h.length===0)return o(k=>({...k,error:true})),false;let x=h.startsWith("#");return S.applyHyperlink({...x?{anchor:h.slice(1)}:{url:h},...y.text.trim().length>0?{text:y.text}:{}})?(d(),true):(o(k=>({...k,error:true})),false)},[t,d]),v=rt.useCallback(()=>{let y=t?.surface?.hyperlinks,S=i.current.link;if(!y)return false;let h=y.removeHyperlink(S?.id);return h&&d(),h},[t,d]),P=rt.useCallback(()=>{let y=t?.surface?.navigation,S=i.current.link;if(!y||!S)return false;if(S.kind==="internal"){let x=S.anchor?y.goToBookmark(S.anchor):false;return x&&o(bo),x}let h=y.openExternal(S.href);return h&&o(bo),h},[t]);return rt.useMemo(()=>({state:n.mode==="closed"?bo:{...n,canEdit:l},open:s,openAtCaret:u,close:d,copy:m,beginEdit:g,setText:p,setUrl:f,commitEdit:b,unlink:v,openTarget:P}),[n,l,s,u,d,m,g,p,f,b,v,P])}var Ye={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function xb(e){return e==="sdtLocked"||e==="sdtContentLocked"}function Sb(e){return e==="contentLocked"||e==="sdtContentLocked"}function Rl(e,t){return !e.ok&&e.code===t}function Et(){let e=rt.useContext(Ml),t=Ca();return e??t}function Ca(){let e=H(),[t,n]=rt.useState(false),[o,r]=rt.useState(false),[i,a]=rt.useState(false),l=q(T=>T),c=e?.surface??null,s=c?.contentControls;rt.useEffect(()=>{r(s?.showAll()??c?.state().contentControls.showAll??false),a(s?.formFill()??c?.state().contentControls.formFill??false);},[l,s,c]);let d=rt.useMemo(()=>{if(!e)return null;let T=s?.atCaret()??null;if(T){let R=s?.disabledReason(T.id,"edit")??null,M=s?.disabledReason(T.id,"remove")??null;return {id:T.id,tag:T.tag??null,alias:T.alias??null,controlType:T.controlType,locked:Sb(T.effectiveLock)||R==="locked",removalLocked:xb(T.effectiveLock)||M==="locked",placeholder:T.placeholder,bound:T.bound||R==="bound",effectiveLock:T.effectiveLock}}let k=e.query({type:"contentControlAt"});if(!k)return null;let E=s?.disabledReason(k.id,"edit")??null,w=s?.disabledReason(k.id,"remove")??null,D=e.can({type:"setContentControlValue",value:""}),F=e.can({type:"removeContentControl"}),A=k.locked===true||E==="locked"||Rl(D,"locked"),I=E==="bound"||Rl(D,"bound"),N=w==="locked"||Rl(F,"locked");return {id:k.id,tag:k.tag??null,alias:k.alias??null,controlType:k.controlType,locked:A,removalLocked:N,placeholder:false,bound:I,effectiveLock:null}},[e,l,s]),u=rt.useMemo(()=>e?e.query({type:"contentControls"}):[],[e,l]),m=rt.useCallback(T=>{s?.setShowAll(T),r(T);},[s]),g=rt.useCallback(T=>{s?.setFormFill(T),a(T);},[s]),p=rt.useCallback(()=>m(!o),[m,o]),f=rt.useCallback(()=>g(!i),[g,i]),b=rt.useCallback(()=>n(true),[]),v=rt.useCallback(()=>n(false),[]),P=rt.useCallback(()=>n(T=>!T),[]),y=rt.useMemo(()=>{if(!d)return "no content control at the current selection";if(s){let k=s.disabledReason(d.id,"edit");return k==="locked"?"the content control is locked":k==="bound"?"the content control is bound to external data":k==="notFound"?"the content control was not found":k}if(d.locked)return "the content control is locked";if(d.bound)return "the content control is bound to external data";if(!e)return "no document is loaded";let T=e.can({type:"setContentControlValue",value:""});return T.ok?null:T.reason},[d,s,e]),S=rt.useMemo(()=>{if(!d)return "no content control at the current selection";if(s){let k=s.disabledReason(d.id,"remove");return k==="locked"?"the content control is locked":k==="notFound"?"the content control was not found":k}if(d.removalLocked)return "the content control is locked";if(!e)return "no document is loaded";let T=e.can({type:"removeContentControl"});return T.ok?null:T.reason},[d,s,e]),h=rt.useCallback(T=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(s&&d){let k=s.disabledReason(d.id,"edit");if(k)return {ok:false,code:k==="bound"?"bound":k==="locked"?"locked":"notFound",reason:k==="bound"?"the content control is bound to external data":k==="locked"?"the content control is locked":"the content control was not found"}}return e.exec({type:"setContentControlValue",value:T})},[e,s,d]),x=rt.useCallback(()=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(s){let T=d?.id;if(!T)return {ok:false,code:"notFound",reason:"no content control at the current selection"};let k=s.disabledReason(T,"remove");return k?{ok:false,code:k==="locked"?"locked":"notFound",reason:k==="locked"?"the content control is locked":"the content control was not found"}:s.remove(T)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:"the edit was refused"}}return e.exec({type:"removeContentControl"})},[e,s,d]);return rt.useMemo(()=>({control:d,controls:u,showAll:o,formFill:i,inspectorOpen:t,canSetValue:y===null&&d!==null,canRemove:S===null&&d!==null,setValueDisabledReason:y,removeDisabledReason:S,setShowAll:m,toggleShowAll:p,setFormFill:g,toggleFormFill:f,openInspector:b,closeInspector:v,toggleInspector:P,remove:x,setValue:h}),[d,u,o,i,t,y,S,m,p,g,f,b,v,P,x,h])}var Ml=rt.createContext(null);function zd(){let e=0,t=0,n=null,o=new Set,r=new Set,i=new Set,a=l=>{for(let c of [...l])c();};return {getShift:()=>e,setShift(l){let c=Math.max(0,Math.round(l));c!==e&&(e=c,a(o));},subscribeShift(l){return o.add(l),()=>o.delete(l)},getReservation:()=>t,setReservation(l){let c=Math.max(0,Math.round(l));c!==t&&(t=c,a(r));},subscribeReservation(l){return r.add(l),()=>r.delete(l)},getViewport:()=>n,setViewport(l){l!==n&&(n=l,a(i));},subscribeViewport(l){return i.add(l),()=>i.delete(l)}}}var _l=rt.createContext(null);function vo(){return rt.useContext(_l)}var $d=()=>0,Dl=()=>()=>{};function yo(){let e=vo(),t=rt.useCallback(o=>e?e.subscribeShift(o):Dl(),[e]),n=rt.useCallback(()=>e?e.getShift():0,[e]);return rt.useSyncExternalStore(t,n,$d)}function Vd(){let e=vo(),t=rt.useCallback(o=>e?e.subscribeReservation(o):Dl(),[e]),n=rt.useCallback(()=>e?e.getReservation():0,[e]);return rt.useSyncExternalStore(t,n,$d)}function Ft(){let e=vo(),t=rt.useCallback(r=>e?e.subscribeViewport(r):Dl(),[e]),n=rt.useCallback(()=>e?e.getViewport():null,[e]),o=rt.useCallback(()=>null,[]);return rt.useSyncExternalStore(t,n,o)}function Rb(e,t){if(e===t)return true;let n=editor.resolveZoomMode(e),o=editor.resolveZoomMode(t);return n!==null&&o!==null&&editor.sameZoomMode(n,o)}function Mb(e){let t=rt.useRef(e);t.current=e;let[n,o]=rt.useState(null),{onReady:r,onChange:i,onFontError:a,...l}=e,c=rt.useMemo(()=>({onReady:s=>{o(s),t.current.onReady?.(s);},onChange:s=>t.current.onChange?.(s),onFontError:s=>t.current.onFontError?.(s)}),[]);return {DocxEditorRoot:Vn,rootProps:l,rootListeners:c,editorRef:n}}function Vn(e){let{document:t,fonts:n,zoom:o,zoomMode:r,tableInteractionLabel:i,imageDecodePort:a,children:l}=e,{t:c}=_(),s=rt.useCallback((h,x)=>c(h,x),[c]),d=rt.useRef(e);d.current=e;let[u,m]=rt.useState(null),g=rt.useRef(null);g.current??=Od();let p=g.current;rt.useEffect(()=>{let h=d.current,x=h.translate??s,T=p.current(),k=editor.createDocxEditor({...h.document!==void 0?{document:h.document}:{},...h.fonts?{fonts:h.fonts}:{},...h.author!==void 0?{author:h.author}:{},...h.locale!==void 0?{locale:h.locale}:{},translate:x,...h.mode!==void 0?{mode:h.mode}:{},...T!==void 0?{revisionStyles:T}:{},...h.modules!==void 0?{modules:h.modules}:{},...h.zoom!==void 0?{zoom:h.zoom}:{},...h.zoomMode!==void 0?{zoomMode:h.zoomMode}:{},...h.tableInteractionLabel?{tableInteractionLabel:h.tableInteractionLabel}:{},...h.imageDecodePort?{imageDecodePort:h.imageDecodePort}:{},onFontError:w=>d.current.onFontError?.(w)}),E=k.on("change",w=>d.current.onChange?.(w));return m(k),()=>{E(),k.destroy(),m(w=>w===k?null:w);}},[t,n,s,a,p]),rt.useEffect(()=>{if(!u)return;if(!u.snapshot().isOpening){d.current.onReady?.(u);return}let h=u.on("change",()=>{h(),d.current.onReady?.(u);});return h},[u]);let f=rt.useRef({editor:null,zoom:void 0,mode:void 0});rt.useEffect(()=>{if(!u)return;f.current.editor!==u&&(f.current={editor:u,zoom:void 0,mode:void 0});let x=false;o!==void 0&&o!==f.current.zoom&&(f.current.zoom=o,u.setZoom(o),x=true);let T=f.current.mode,k=r!==void 0&&(T===void 0||!Rb(T,r)),E=r===void 0?null:editor.resolveZoomMode(r),w=x&&r!==void 0&&E!==null&&E.type==="fit";(k||w)&&(f.current.mode=r,u.setZoomMode(r));},[u,o,r]),rt.useEffect(()=>{u&&u.setTableInteractionLabel(i??editor.defaultTableLabel);},[u,i]);let[b,v]=rt.useState(0),P=rt.useRef([]),y=rt.useMemo(()=>({mounted:b,register:()=>(v(h=>h+1),()=>v(h=>Math.max(0,h-1))),registerCommentDraft:h=>(P.current.push(h),()=>{let x=P.current.indexOf(h);x!==-1&&P.current.splice(x,1);}),requestCommentDraft:()=>{let h=P.current.at(-1);return h?(h(),true):false}}),[b]),S=rt.useMemo(zd,[]);return rt.useEffect(()=>(p.connect(u),()=>p.connect(null)),[p,u]),jsxRuntime.jsx(ft.Provider,{value:y,children:jsxRuntime.jsx(ll.Provider,{value:u,children:jsxRuntime.jsx(_l.Provider,{value:S,children:jsxRuntime.jsx(Bn.Provider,{value:p,children:jsxRuntime.jsx(Ib,{children:jsxRuntime.jsx(_b,{children:jsxRuntime.jsx(fa,{children:l})})})})})})})}function Ib({children:e}){let t=Ta(true);return jsxRuntime.jsx(qn.Provider,{value:t,children:e})}function _b({children:e}){let t=Ca();return jsxRuntime.jsx(Ml.Provider,{value:t,children:e})}function _e(e){return e/1440*96}function Pa(e){return e/96*1440}function Xe(e){return `${Math.round(e*100)/100}px`}function Al(e){return e/2}var Ol=316,Hl=44,Ab=24,Ea={inlineStart:0,inlineEnd:Ol},Ud={inlineStart:Hl,inlineEnd:Hl},Hb={inlineStart:0,inlineEnd:0};function jd({open:e,viewportWidth:t,pageWidthPx:n,inlineStartReservation:o=0,docked:r=false}){if(!e)return Ud;if(r||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0)return Ea;let i=Number.isFinite(o)&&o>0?o:0;return t-i-n-2*Ab>=Ol?Ea:Ud}var Ob=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,reviewPaneOpen:e.reviewPaneOpen??true,entitledZoom:t?.type==="fit"?t.maxZoom!==void 0&&t.maxZoom<editor.ZOOM_MAX?t.maxZoom:null:e.zoom}},Bb=(e,t)=>e.reviewPaneOpen===t.reviewPaneOpen&&e.entitledZoom===t.entitledZoom&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Yd(){let e=Ft(),[t,n]=rt.useState(null);return rt.useEffect(()=>{if(!e){n(null);return}let o=()=>n(e.clientWidth);if(o(),typeof ResizeObserver>"u")return;let r=new ResizeObserver(o);return r.observe(e),()=>r.disconnect()},[e]),t}function en(){let e=rt.useContext(ft),{pageSetup:t,reviewPaneOpen:n,entitledZoom:o}=q(Ob,Bb),r=Ft(),i=Vd(),a=rt.useRef(null);t&&(a.current=t.pageWidthTwips);let l=t?.pageWidthTwips??a.current,c=(e?.mounted??0)>0,s=rt.useCallback(m=>c?jd({open:n,viewportWidth:m??0,pageWidthPx:l===null||o===null?0:_e(l)*o,inlineStartReservation:i,docked:o===null}):Hb,[c,n,l,o,i]),[d,u]=rt.useState(()=>s(r?r.clientWidth:null));return rt.useEffect(()=>{let m=()=>u(s(r?r.clientWidth:null));if(m(),!r||typeof ResizeObserver>"u")return;let g=new ResizeObserver(m);return g.observe(r),()=>g.disconnect()},[r,s]),d}var wa=[.25,.5,.75,1,1.25,1.5,2];function Un(e,t){return t==="in"?wa.find(o=>o>e+.001)??null:[...wa].reverse().find(o=>o<e-.001)??null}function Xd(e,t){return e==="0"?1:e==="+"||e==="="?Un(t,"in")??t:e==="-"?Un(t,"out")??t:null}var xo=rt.createContext(false);function ot(){return rt.useContext(xo)?"":"docx-editor "}var zb=e=>e.reviewPaneOpen??true,$b=e=>e.zoomMode?.type==="fit";function ka({className:e,style:t,children:n}){let o=ot(),r=H(),i=q(zb),a=en(),l=q($b),s=(rt.useContext(ft)?.mounted??0)>0,d=vo(),u=yo(),m=rt.useCallback(p=>d?.setViewport(p),[d]),g=rt.useCallback(p=>{if(!r||!(p.metaKey||p.ctrlKey)||p.altKey)return;let f=p.target;if(f instanceof Element&&f.closest('input, textarea, select, [role="dialog"]'))return;let b=Xd(p.key,r.getZoom());b!==null&&(p.preventDefault(),r.setZoom(b));},[r]);return jsxRuntime.jsx("div",{ref:m,"data-testid":"docx-editor-scroll",onKeyDownCapture:g,...s?{"data-review-pane":i?"open":"closed"}:{},...l?{"data-zoom-fit":""}:{},className:`${o}docx-editor-one-surface docx-editor-one-surface__viewport docx-editor__scroll-container${e?` ${e}`:""}`,style:{...t,"--docx-nav-shift":`${u}px`,...s?{"--docx-review-gutter":`${a.inlineEnd}px`,"--docx-review-gutter-start":`${a.inlineStart}px`}:{}},children:jsxRuntime.jsx(xo.Provider,{value:true,children:n})})}var Ub=editor.LOADING_SNAPSHOT;function eu({ref:e,editorRef:t}){rt.useImperativeHandle(e,()=>({load:n=>t.current?.load(n),save:()=>t.current?.save()??Promise.resolve(null),getDocumentHandle:()=>t.current?.getDocumentHandle()??null,getEditor:()=>t.current,focus:()=>{t.current?.focus();},exec:(n,o)=>t.current?.exec(n,o)??{ok:false,code:"notFound",reason:"no editor is mounted"},snapshot:n=>t.current?.snapshot(n)??Ub}),[t]);}var Jb=e=>e.editingMode??"editing",Zl=[{mode:"editing",labelKey:"editingMode.editing",hintKey:"editingMode.editingHint",path:"M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z"},{mode:"suggesting",labelKey:"editingMode.suggesting",hintKey:"editingMode.suggestingHint",path:"M240-400h122l40-40H240v40Zm0-100h222l40-40H240v40Zm0-100h322l40-40H240v40ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v320h-80v-320H160v525l46-45h274v80H240L80-80Zm520-80v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T943-380L723-160H600Zm300-263-37-37 37 37ZM660-220h38l121-122-19-18-18-19-122 121v38Zm140-141-18-19 37 37-19-18Z"},{mode:"viewing",labelKey:"editingMode.viewing",hintKey:"editingMode.viewingHint",path:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Z"}],Qb="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function Ma({className:e,hidden:t}){let n=H(),o=q(Jb),r=X(),{t:i}=_(),[a,l]=rt.useState(false),c=rt.useRef(null),s=rt.useRef(null),d=rt.useRef(null);rt.useEffect(()=>{if(!a)return;let v=d.current?.querySelectorAll('[role="menuitemradio"]');(d.current?.querySelector('[aria-checked="true"]')??v?.[0]??void 0)?.focus();},[a]);let u=rt.useCallback(v=>{let P=[...d.current?.querySelectorAll('[role="menuitemradio"]')??[]],y=P.indexOf(document.activeElement),S=h=>{v.preventDefault(),P[(h+P.length)%P.length]?.focus();};v.key==="ArrowDown"?S(y+1):v.key==="ArrowUp"?S(y-1):v.key==="Home"?S(0):v.key==="End"&&S(P.length-1);},[]);rt.useEffect(()=>{if(!a)return;let v=y=>{let S=c.current;S&&y.target instanceof Node&&S.contains(y.target)||l(false);},P=y=>{y.key==="Escape"&&(y.preventDefault(),l(false));};return document.addEventListener("mousedown",v,true),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",v,true),document.removeEventListener("keydown",P);}},[a]);let m=rt.useCallback(v=>{l(false),editor.runToolbarCommand(n,"review.editingMode",v),n?.focus();},[n]),g=editor.toolbarCommandState(n,"review.editingMode"),p=i18n.localizeDisabledReason(g.disabledReason,i),f=rt.useMemo(()=>Zl.find(v=>v.mode===o)??Zl[0],[o]);if(t)return null;let b=J("review.editingMode");return jsxRuntime.jsxs("div",{ref:c,className:`docx-toolbar__mode${e?` ${e}`:""}`,"data-slot":"review.editingMode",children:[jsxRuntime.jsxs("button",{ref:s,type:"button",className:"docx-toolbar__picker","data-testid":"editing-mode-trigger","data-mode":o,"aria-haspopup":"menu","aria-expanded":a,"aria-label":r(b?.labelKey??"editingMode.label"),disabled:!g.enabled,...p?{title:p}:{},onMouseDown:O,onClick:()=>l(v=>!v),children:[ql(f.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:r(f.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),a?jsxRuntime.jsx("div",{ref:d,className:"docx-toolbar__mode-menu",role:"menu","aria-label":r(b?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:u,children:Zl.map(v=>jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":v.mode===o,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${v.mode}`,onMouseDown:O,onClick:()=>m(v.mode),children:[ql(v.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:r(v.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:r(v.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:v.mode===o?ql(Qb):null})]},v.mode))}):null]})}Ma.docxSlot="review.editingMode";function ql(e){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:18,height:18,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})})}function tn(e,t){if(!rt.isValidElement(e)||e.type!==rt.Fragment)return null;let o=rt.Children.toArray(e.props.children).map(t).filter(r=>r!==null);return o.length===1?o[0]:null}function _a({entries:e,children:t,preset:n,keyOfEntry:o,keyOfChild:r,renderEntry:i}){if(!n)return t;let a=new Map,l=[];for(let u of rt.Children.toArray(t)){let m=r(u);m?a.set(m,u):l.push(u);}let c=e.map((u,m)=>{let g=o(u,m),p=a.get(g);return p?jsxRuntime.jsx(rt.Fragment,{children:p},g):jsxRuntime.jsx(rt.Fragment,{children:i(u,m)},g)}),s=new Set(e.map(o)),d=[...a.entries()].filter(([u])=>!s.has(u)).map(([u,m])=>jsxRuntime.jsx(rt.Fragment,{children:m},u));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,d,l]})}var ah={contextualSpacing:null,keepNext:null,keepLines:null,widowControl:null,pageBreakBefore:null},ih=e=>{let t=e.formatting??null;if(!t)return null;let n=t.indent,o=t.paragraphFlags??ah;return {alignment:t.alignment==="both"?"justify":t.alignment??null,spaceBeforePt:t.spaceBeforePt??null,spaceAfterPt:t.spaceAfterPt??null,lineSpacing:t.lineSpacing??null,indentLeftTwips:n&&!n.mixed.left?n.left:null,indentRightTwips:n&&!n.mixed.right?n.right:null,indentFirstLineTwips:n&&!n.mixed.firstLine?n.firstLine:null,contextualSpacing:o.contextualSpacing,keepNext:o.keepNext,keepLines:o.keepLines,widowControl:o.widowControl,pageBreakBefore:o.pageBreakBefore,tabStops:t.tabStops??null,indentUnknown:!n,disagrees:{alignment:t.disagrees?.alignment??false,spaceBeforePt:t.disagrees?.spaceBeforePt??false,spaceAfterPt:t.disagrees?.spaceAfterPt??false,lineSpacing:t.disagrees?.lineSpacing??false,tabStops:t.disagrees?.tabStops??false,indentLeft:n?.mixed.left??false,indentRight:n?.mixed.right??false,indentFirstLine:n?.mixed.firstLine??false}}},lh=["alignment","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops","indentLeft","indentRight","indentFirstLine"],sh=(e,t)=>lh.every(n=>e.disagrees[n]===t.disagrees[n]),ch=(e,t)=>e===null||t===null?e===t:e.alignment===t.alignment&&e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value&&e.indentLeftTwips===t.indentLeftTwips&&e.indentRightTwips===t.indentRightTwips&&e.indentFirstLineTwips===t.indentFirstLineTwips&&e.contextualSpacing===t.contextualSpacing&&e.keepNext===t.keepNext&&e.keepLines===t.keepLines&&e.widowControl===t.widowControl&&e.pageBreakBefore===t.pageBreakBefore&&sh(e,t)&&e.indentUnknown===t.indentUnknown&&e.tabStops?.length===t.tabStops?.length&&(e.tabStops??[]).every((n,o)=>n.positionTwips===t.tabStops?.[o]?.positionTwips&&n.alignment===t.tabStops?.[o]?.alignment&&(n.leader??"none")===(t.tabStops?.[o]?.leader??"none")),dh=e=>e.editable;function zl(){let e=H(),t=q(ih,ch),n=q(dh),o=rt.useMemo(()=>n&&e!==null&&e.can({type:"setParagraphFormat",alignment:"left"}).ok,[e,n]),r=rt.useCallback(i=>{if(!e)return false;let a={type:"setParagraphFormat",...i};return e.can(a).ok?e.exec(a).ok:false},[e]);return {format:t,isEnabled:o,apply:r}}var Wn=e=>Math.round(e/1440*100)/100,$l=e=>Wn(e).toLocaleString(void 0,{maximumFractionDigits:2}),Da=e=>Math.round(e*1440),ru={left:"dialogs.paragraph.tabAlignLeft",center:"dialogs.paragraph.tabAlignCenter",right:"dialogs.paragraph.tabAlignRight",decimal:"dialogs.paragraph.tabAlignDecimal",bar:"dialogs.paragraph.tabAlignBar"},uh=e=>e===null||e===0?"none":e<0?"hanging":"firstLine",ph=(e,t)=>e==="none"?0:e==="hanging"?-Math.abs(t):Math.abs(t);function au(e){let t=e.indentFirstLineTwips;return {alignment:e.alignment??"left",indentLeft:e.indentLeftTwips??0,indentRight:e.indentRightTwips??0,special:uh(t),specialBy:Math.abs(t??0),spaceBefore:e.spaceBeforePt??0,spaceAfter:e.spaceAfterPt??0,lineRule:e.lineSpacing?.rule??"multiple",lineValue:e.lineSpacing?.value??1.08,contextualSpacing:e.contextualSpacing===true,keepNext:e.keepNext===true,keepLines:e.keepLines===true,widowControl:e.widowControl!==false,pageBreakBefore:e.pageBreakBefore===true,tabStops:e.tabStops??[],clearedAllTabStops:false}}var Na={contextualSpacing:false,keepNext:false,keepLines:false,widowControl:false,pageBreakBefore:false,tabStops:false,alignment:false,indentLeft:false,indentRight:false,special:false,spaceBefore:false,spaceAfter:false,lineSpacing:false};function iu(e){return {contextualSpacing:e.contextualSpacing===null,keepNext:e.keepNext===null,keepLines:e.keepLines===null,widowControl:e.widowControl===null,pageBreakBefore:e.pageBreakBefore===null,tabStops:e.disagrees.tabStops,alignment:e.disagrees.alignment,indentLeft:e.disagrees.indentLeft||e.indentUnknown,indentRight:e.disagrees.indentRight||e.indentUnknown,special:e.disagrees.indentFirstLine||e.indentUnknown,spaceBefore:e.disagrees.spaceBeforePt,spaceAfter:e.disagrees.spaceAfterPt,lineSpacing:e.disagrees.lineSpacing}}function mh(e,t){return e===t?true:e.length!==t.length?false:e.every((n,o)=>{let r=t[o];return r!==void 0&&n.positionTwips===r.positionTwips&&n.alignment===r.alignment&&(n.leader??"none")===(r.leader??"none")})}function lu(e,t,n=Na,o=n){let r={},i=false,a=(c,s)=>{r[c]=s,i=true;},l=c=>n[c]&&!o[c];return (e.alignment!==t.alignment||l("alignment"))&&a("alignment",t.alignment),(e.indentLeft!==t.indentLeft||l("indentLeft"))&&a("indentLeftTwips",t.indentLeft),(e.indentRight!==t.indentRight||l("indentRight"))&&a("indentRightTwips",t.indentRight),(e.special!==t.special||e.specialBy!==t.specialBy||l("special"))&&a("indentFirstLineTwips",ph(t.special,t.specialBy)),(e.spaceBefore!==t.spaceBefore||l("spaceBefore"))&&a("spaceBeforePt",t.spaceBefore),(e.spaceAfter!==t.spaceAfter||l("spaceAfter"))&&a("spaceAfterPt",t.spaceAfter),!o.lineSpacing&&(e.lineRule!==t.lineRule||e.lineValue!==t.lineValue||l("lineSpacing"))&&a("lineSpacing",{rule:t.lineRule,value:t.lineValue}),(e.contextualSpacing!==t.contextualSpacing||l("contextualSpacing"))&&a("contextualSpacing",t.contextualSpacing),(e.keepNext!==t.keepNext||l("keepNext"))&&a("keepNext",t.keepNext),(e.keepLines!==t.keepLines||l("keepLines"))&&a("keepLines",t.keepLines),(e.widowControl!==t.widowControl||l("widowControl"))&&a("widowControl",t.widowControl),(e.pageBreakBefore!==t.pageBreakBefore||l("pageBreakBefore"))&&a("pageBreakBefore",t.pageBreakBefore),(!mh(e.tabStops,t.tabStops)||l("tabStops")&&t.clearedAllTabStops)&&a("tabStops",t.tabStops),i?r:null}function su(e,t){return [...e.filter(o=>o.positionTwips!==t.positionTwips),t].sort((o,r)=>o.positionTwips-r.positionTwips)}function cu(e,t){if(t.key!=="Tab")return false;let n=[...e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(a=>!a.hasAttribute("disabled")&&a.tabIndex!==-1);if(n.length===0)return false;let o=n[0],r=n[n.length-1],i=e.ownerDocument.activeElement;return t.shiftKey&&(i===o||i===e)?(r.focus(),true):!t.shiftKey&&i===r?(o.focus(),true):false}var bh={marginRight:"auto",fontSize:"12px",color:"var(--doc-danger)"},hh={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},vh={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:620,maxWidth:720,width:"100%",margin:20,maxHeight:"90vh",display:"flex",flexDirection:"column",minHeight:0},yh={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",flexShrink:0,fontSize:16,fontWeight:600,color:"var(--doc-text)"},xh={padding:"16px 20px",overflowY:"auto",minHeight:0},Sh={display:"grid",gridTemplateColumns:"1fr 1fr",gap:28},pu={display:"flex",flexDirection:"column",gap:14,minWidth:0},Gn={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},it={display:"flex",alignItems:"center",gap:12},bt={width:92,fontSize:13,color:"var(--doc-text-muted)"},wt={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13,backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},jn={fontSize:11,color:"var(--doc-text-muted)",width:20},Th={display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--doc-text)"},Ch={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,flexShrink:0},Yn={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"};function So({open:e,onClose:t,className:n}){let{t:o}=_(),{format:r,isEnabled:i,apply:a}=zl(),[l,c]=rt.useState("left"),[s,d]=rt.useState(0),[u,m]=rt.useState(0),[g,p]=rt.useState("none"),[f,b]=rt.useState(0),[v,P]=rt.useState(0),[y,S]=rt.useState(0),[h,x]=rt.useState("multiple"),[T,k]=rt.useState(1.08),[E,w]=rt.useState(false),[D,F]=rt.useState(false),[A,I]=rt.useState(false),[N,R]=rt.useState(true),[M,ae]=rt.useState(false),[z,$]=rt.useState([]),[V,oe]=rt.useState(false),[ne,be]=rt.useState(0),[he,W]=rt.useState("left"),[B,Ee]=rt.useState("none"),[ce,de]=rt.useState(Na),[Ve,uo]=rt.useState(false),mt=Z=>o(Ve&&(Z==="indentLeft"||Z==="indentRight"||Z==="special")?"dialogs.paragraph.notShown":"dialogs.paragraph.mixed"),po=rt.useRef(Na),Re=rt.useId(),[il,Dn]=rt.useState(false),Pt=rt.useRef(null),Nn=rt.useRef(false),jo=rt.useRef(null);rt.useEffect(()=>{if(!e){Nn.current=false;return}if(Nn.current||r===null)return;let Z=au(r);c(Z.alignment),d(Z.indentLeft),m(Z.indentRight),p(Z.special),b(Z.specialBy),P(Z.spaceBefore),S(Z.spaceAfter),x(Z.lineRule),k(Z.lineValue),w(Z.contextualSpacing),F(Z.keepNext),I(Z.keepLines),R(Z.widowControl),ae(Z.pageBreakBefore),$(Z.tabStops),oe(false);let ve=iu(r);de(ve),uo(r.indentUnknown),be(0),W("left"),Ee("none"),po.current=ve,Dn(false),jo.current=Z,Nn.current=true;},[e,r]),rt.useEffect(()=>{e&&Pt.current?.focus();},[e]);let pe=rt.useCallback(()=>{let Z=jo.current,ve=Z===null?null:lu(Z,{alignment:l,indentLeft:s,indentRight:u,special:g,specialBy:f,spaceBefore:v,spaceAfter:y,lineRule:h,lineValue:T,contextualSpacing:E,keepNext:D,keepLines:A,widowControl:N,pageBreakBefore:M,tabStops:z,clearedAllTabStops:V},po.current,ce);if(ve===null){t();return}if(a(ve)){Dn(false),t();return}Dn(true);},[a,t,ce,V,l,s,u,g,f,v,y,h,T,E,D,A,N,M,z]),me=rt.useCallback(()=>{let Z=Math.round(ne);return Z<=0?false:(de(ve=>({...ve,tabStops:false})),$(su(z,{positionTwips:Z,alignment:he,...B!=="none"?{leader:B}:{}})),be(0),W("left"),Ee("none"),true)},[z,ne,he,B]);if(!e)return null;let at=Z=>de(ve=>({...ve,[Z]:false})),Ln=(Z,ve,zt,Ue)=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:bt,htmlFor:`${Re}-${Z}`,children:o(`dialogs.paragraph.${Z}`)}),jsxRuntime.jsx("input",{id:`${Re}-${Z}`,type:"number",style:wt,min:0,step:.1,value:ce[Ue]?"":Wn(ve),placeholder:ce[Ue]?mt(Ue):void 0,onChange:Fn=>{at(Ue),zt(Da(Number(Fn.target.value)||0));},"aria-label":o(`dialogs.paragraph.${Z}`)}),jsxRuntime.jsx("span",{style:jn,children:o("dialogs.paragraph.unitInches")})]}),sa=(Z,ve,zt,Ue)=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:bt,htmlFor:`${Re}-${Z}`,children:o(`dialogs.paragraph.${Z}`)}),jsxRuntime.jsx("input",{id:`${Re}-${Z}`,type:"number",style:wt,min:0,step:1,value:ce[Ue]?"":ve,placeholder:ce[Ue]?mt(Ue):void 0,onChange:Fn=>{at(Ue),zt(Math.max(0,Number(Fn.target.value)||0));},"aria-label":o(`dialogs.paragraph.${Z}`)}),jsxRuntime.jsx("span",{style:jn,children:o("dialogs.paragraph.unitPoints")})]}),mo=(Z,ve,zt)=>jsxRuntime.jsxs("label",{style:Th,children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ve,ref:Ue=>{Ue&&(Ue.indeterminate=ce[Z]);},onChange:Ue=>{de(Fn=>({...Fn,[Z]:false})),zt(Ue.target.checked);}}),o(`dialogs.paragraph.${Z}`)]}),sd=`docx-editor${document.querySelector(".docx-editor")?.classList.contains("dark")?" dark":""}`;return reactDom.createPortal(jsxRuntime.jsx("div",{className:sd,style:{display:"contents"},children:jsxRuntime.jsx("div",{className:n,style:hh,onClick:t,onKeyDown:Z=>{Z.key==="Escape"&&t(),Pt.current&&cu(Pt.current,Z.nativeEvent)&&Z.preventDefault();let ve=Z.target instanceof HTMLButtonElement||Z.target instanceof HTMLSelectElement;if(Z.key==="Enter"&&!ve){let zt=Z.target;if(zt instanceof HTMLElement&&zt.dataset.docxTabEntry!==void 0){me();return}i&&pe();}},children:jsxRuntime.jsxs("div",{ref:Pt,role:"dialog","aria-modal":"true","aria-label":o("dialogs.paragraph.title"),tabIndex:-1,style:vh,onClick:Z=>Z.stopPropagation(),onMouseDown:Z=>Z.stopPropagation(),children:[jsxRuntime.jsx("div",{style:yh,children:o("dialogs.paragraph.title")}),jsxRuntime.jsx("div",{style:xh,children:jsxRuntime.jsxs("div",{style:Sh,children:[jsxRuntime.jsxs("div",{style:pu,children:[jsxRuntime.jsx("div",{style:Gn,children:o("dialogs.paragraph.general")}),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:bt,htmlFor:`${Re}-alignment`,children:o("dialogs.paragraph.alignment")}),jsxRuntime.jsxs("select",{id:`${Re}-alignment`,style:wt,value:ce.alignment?"":l,onChange:Z=>{at("alignment"),c(Z.target.value);},"aria-label":o("dialogs.paragraph.alignment"),children:[ce.alignment?jsxRuntime.jsx("option",{value:"",children:o("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"left",children:o("dialogs.paragraph.alignLeft")}),jsxRuntime.jsx("option",{value:"center",children:o("dialogs.paragraph.alignCenter")}),jsxRuntime.jsx("option",{value:"right",children:o("dialogs.paragraph.alignRight")}),jsxRuntime.jsx("option",{value:"justify",children:o("dialogs.paragraph.alignJustify")})]})]}),jsxRuntime.jsx("div",{style:Gn,children:o("dialogs.paragraph.indentation")}),Ln("beforeText",s,d,"indentLeft"),Ln("afterText",u,m,"indentRight"),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:bt,htmlFor:`${Re}-special`,children:o("dialogs.paragraph.special")}),jsxRuntime.jsxs("select",{id:`${Re}-special`,style:wt,value:ce.special?"":g,onChange:Z=>{at("special"),p(Z.target.value);},"aria-label":o("dialogs.paragraph.special"),children:[ce.special?jsxRuntime.jsx("option",{value:"",children:mt("special")}):null,jsxRuntime.jsx("option",{value:"none",children:o("dialogs.paragraph.specialNone")}),jsxRuntime.jsx("option",{value:"firstLine",children:o("dialogs.paragraph.specialFirstLine")}),jsxRuntime.jsx("option",{value:"hanging",children:o("dialogs.paragraph.specialHanging")})]})]}),g!=="none"?jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:bt,htmlFor:`${Re}-by`,children:o("dialogs.paragraph.by")}),jsxRuntime.jsx("input",{id:`${Re}-by`,type:"number",style:wt,min:0,step:.1,value:ce.special?"":Wn(f),placeholder:ce.special?mt("special"):void 0,onChange:Z=>{at("special"),b(Math.max(0,Da(Number(Z.target.value)||0)));},"aria-label":o("dialogs.paragraph.by")}),jsxRuntime.jsx("span",{style:jn,children:o("dialogs.paragraph.unitInches")})]}):null,jsxRuntime.jsx("div",{style:Gn,children:o("dialogs.paragraph.tabStops")}),z.length===0?jsxRuntime.jsx("div",{style:{fontSize:12,color:"var(--doc-text-muted)"},children:o(ce.tabStops?"dialogs.paragraph.tabMixed":"dialogs.paragraph.tabEmpty")}):z.map(Z=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("span",{style:{...bt,color:"var(--doc-text)"},children:o("dialogs.paragraph.tabPositionLabel",{position:$l(Z.positionTwips)})}),jsxRuntime.jsx("span",{style:{flex:1,fontSize:13,color:"var(--doc-text-muted)"},children:o(ru[Z.alignment])}),jsxRuntime.jsx("button",{type:"button",style:Yn,onClick:()=>$(z.filter(ve=>ve!==Z)),"aria-label":o("dialogs.paragraph.tabRemoveAt",{position:$l(Z.positionTwips)}),children:o("dialogs.paragraph.tabRemove")})]},Z.positionTwips)),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:bt,htmlFor:`${Re}-tabPosition`,children:o("dialogs.paragraph.tabPosition")}),jsxRuntime.jsx("input",{id:`${Re}-tabPosition`,type:"number",style:wt,min:0,step:.1,value:Wn(ne),onChange:Z=>be(Math.max(0,Da(Number(Z.target.value)||0))),"aria-label":o("dialogs.paragraph.tabPosition"),"data-docx-tab-entry":""}),jsxRuntime.jsx("span",{style:jn,children:o("dialogs.paragraph.unitInches")})]}),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:bt,htmlFor:`${Re}-tabAlignment`,children:o("dialogs.paragraph.tabAlignment")}),jsxRuntime.jsxs("select",{id:`${Re}-tabAlignment`,style:wt,value:he,onChange:Z=>W(Z.target.value),"aria-label":o("dialogs.paragraph.tabAlignment"),"data-docx-tab-entry":"",children:[jsxRuntime.jsx("option",{value:"left",children:o("dialogs.paragraph.tabAlignLeft")}),jsxRuntime.jsx("option",{value:"center",children:o("dialogs.paragraph.tabAlignCenter")}),jsxRuntime.jsx("option",{value:"right",children:o("dialogs.paragraph.tabAlignRight")}),jsxRuntime.jsx("option",{value:"decimal",children:o("dialogs.paragraph.tabAlignDecimal")})]})]}),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:bt,htmlFor:`${Re}-tabLeader`,children:o("dialogs.paragraph.tabLeader")}),jsxRuntime.jsxs("select",{id:`${Re}-tabLeader`,style:wt,value:B,onChange:Z=>Ee(Z.target.value),"aria-label":o("dialogs.paragraph.tabLeader"),"data-docx-tab-entry":"",children:[jsxRuntime.jsx("option",{value:"none",children:o("dialogs.paragraph.tabNone")}),jsxRuntime.jsx("option",{value:"dot",children:o("dialogs.paragraph.tabLeaderDot")}),jsxRuntime.jsx("option",{value:"hyphen",children:o("dialogs.paragraph.tabLeaderHyphen")}),jsxRuntime.jsx("option",{value:"underscore",children:o("dialogs.paragraph.tabLeaderUnderscore")})]})]}),jsxRuntime.jsxs("div",{style:{...it,justifyContent:"flex-end"},children:[jsxRuntime.jsx("button",{type:"button",style:Yn,onClick:me,children:o("dialogs.paragraph.tabAdd")}),jsxRuntime.jsx("button",{type:"button",style:Yn,onClick:()=>{de(Z=>({...Z,tabStops:false})),oe(true),$([]);},children:o("dialogs.paragraph.tabClearAll")})]})]}),jsxRuntime.jsxs("div",{style:pu,children:[jsxRuntime.jsx("div",{style:Gn,children:o("dialogs.paragraph.spacing")}),sa("spaceBefore",v,P,"spaceBefore"),sa("spaceAfter",y,S,"spaceAfter"),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:bt,htmlFor:`${Re}-lineSpacing`,children:o("dialogs.paragraph.lineSpacing")}),jsxRuntime.jsxs("select",{id:`${Re}-lineSpacing`,style:wt,value:ce.lineSpacing?"":h,onChange:Z=>{let ve=Z.target.value;at("lineSpacing"),x(ve),k(ve===jo.current?.lineRule?jo.current.lineValue:ve==="multiple"?1.08:12);},"aria-label":o("dialogs.paragraph.lineSpacing"),children:[ce.lineSpacing?jsxRuntime.jsx("option",{value:"",children:o("dialogs.paragraph.mixed")}):null,jsxRuntime.jsx("option",{value:"multiple",children:o("dialogs.paragraph.ruleMultiple")}),jsxRuntime.jsx("option",{value:"atLeast",children:o("dialogs.paragraph.ruleAtLeast")}),jsxRuntime.jsx("option",{value:"exact",children:o("dialogs.paragraph.ruleExactly")})]})]}),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:bt,htmlFor:`${Re}-at`,children:o("dialogs.paragraph.at")}),jsxRuntime.jsx("input",{id:`${Re}-at`,type:"number",style:wt,min:.01,step:h==="multiple"?.01:1,value:ce.lineSpacing?"":T,disabled:ce.lineSpacing,onChange:Z=>{let ve=Z.target.value.trim();k(ve===""?h==="multiple"?1.08:12:Number(ve)||0);},"aria-label":o("dialogs.paragraph.at")}),jsxRuntime.jsx("span",{style:jn,children:h==="multiple"?"":o("dialogs.paragraph.unitPoints")})]}),mo("contextualSpacing",E,w),jsxRuntime.jsx("div",{style:Gn,children:o("dialogs.paragraph.pagination")}),mo("keepNext",D,F),mo("widowControl",N,R),mo("keepLines",A,I),mo("pageBreakBefore",M,ae)]})]})}),jsxRuntime.jsxs("div",{style:Ch,children:[il?jsxRuntime.jsx("span",{role:"alert",style:bh,children:o("dialogs.paragraph.refused")}):null,jsxRuntime.jsx("button",{type:"button",style:Yn,onClick:t,children:o("dialogs.paragraph.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...Yn,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)",opacity:i?1:.5},disabled:!i,onClick:pe,children:o("dialogs.paragraph.ok")})]})]})})}),document.body)}var mu=rt.createContext(null);function fu({children:e}){let[t,n]=rt.useState(false),o=rt.useRef(null),r=rt.useMemo(()=>({open:a=>{o.current=a??document.activeElement,n(true);}}),[]),i=rt.useCallback(()=>{n(false);let a=o.current;o.current=null,a instanceof HTMLElement&&a.isConnected&&a.focus({preventScroll:true});},[]);return jsxRuntime.jsxs(mu.Provider,{value:r,children:[e,jsxRuntime.jsx(So,{open:t,onClose:i})]})}function gu(){return rt.useContext(mu)}var Dh=["zoom","script","format","list","alignment","styles","font","text","history"],Vl=new Set(["review"]),Ul=24,hu=new Set;function vu(e,t=Dh){let n=t.filter(r=>e.includes(r));return [...e.filter(r=>!t.includes(r)).reverse(),...n]}function bu(e,t){let{widths:n,groups:o,order:r,fixed:i,more:a}=e,l=i;for(let s of o)l+=n.get(s)??0;if(l<=t)return hu;l+=a;let c=new Set;for(let s of r){if(l<=t)break;let d=n.get(s);d===void 0||c.has(s)||(c.add(s),l-=d);}return c}function yu(e,t){if(e===t)return true;if(e.size!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}var xu=yu;function Su(e){if(!(e.available>0))return hu;let t=bu(e,e.available),n=e.previous;if(!n||n.size===0||t.size>=n.size)return t;let o=bu(e,e.available-(e.hysteresis));return yu(o,n)?n:o}function Tu(e,t,n,o){return e+t+n+o*2}function Cu(e,t){return e+t}function Gl(e,t){return e+t}function Pu(e){let t=Number.parseFloat(e.marginInlineStart||e.marginLeft),n=Number.parseFloat(e.marginInlineEnd||e.marginRight);return {start:Number.isFinite(t)?t:0,end:Number.isFinite(n)?n:0}}function Wl(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Eu(e){return Wl(e.columnGap)}function wu(e,t){return e.clientWidth-Wl(t.paddingLeft)-Wl(t.paddingRight)}var Jn="data-toolbar-group",Qn="data-toolbar-fixed",Yl="data-toolbar-more",Ah=34,jl=new Set;function Ru(e,t,n){let o=rt.useRef(null),r=rt.useRef(new Map),i=rt.useRef(Ah),[a,l]=rt.useState(jl),c=rt.useRef(a);c.current=a;let s=rt.useRef({groups:t,order:n});s.current={groups:t,order:n};let d=rt.useCallback(()=>{let m=o.current;if(!m||!e)return;let g=getComputedStyle(m),p=Eu(g),f=wu(m,g),b=m.querySelector(".docx-toolbar__separator"),v=p*2;if(b){let x=getComputedStyle(b),T=Pu(x);v=Tu(b.offsetWidth,T.start,T.end,p);}for(let x of m.querySelectorAll(`[${Jn}]`)){let T=x.getAttribute(Jn);T&&x.offsetWidth>0&&r.current.set(T,Cu(x.offsetWidth,v));}let P=0;for(let x of m.querySelectorAll(`[${Qn}]`))x.offsetWidth>0&&(P+=Gl(x.offsetWidth,p));let y=m.querySelector(`[${Yl}]`);y&&y.offsetWidth>0&&(i.current=Gl(y.offsetWidth,p));let S={available:f,widths:r.current,groups:s.current.groups,order:s.current.order,fixed:P,more:i.current,previous:c.current,hysteresis:Ul},h=Su(S);xu(h,c.current)||(c.current=h,l(h));},[e]),u=rt.useCallback(m=>{o.current=m;},[]);return rt.useLayoutEffect(()=>{if(!e){c.current.size>0&&(c.current=jl,l(jl));return}d();},[e,d]),rt.useEffect(()=>{let m=o.current;if(!e||!m||typeof ResizeObserver>"u")return;let g=0,p=new ResizeObserver(()=>{g===0&&(g=requestAnimationFrame(()=>{g=0,d();}));});p.observe(m);for(let f of m.querySelectorAll(`[${Jn}], [${Qn}]`))p.observe(f);return ()=>{g!==0&&cancelAnimationFrame(g),p.disconnect();}},[e,d,a]),{attach:u,overflow:a}}var $h=["M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z"],Iu=rt.createContext({close:()=>{}});function Vh(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function _u({label:e,children:t}){return jsxRuntime.jsxs("div",{className:"docx-toolbar__more-control",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-control-label",children:e}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-control-body",children:t})]})}function Du({slot:e}){let t=X(),{close:n}=rt.useContext(Iu),{execute:o,isActive:r,isEnabled:i,disabledReason:a}=le(e),l=J(e),c=editor.commandForSlot(e),s=c?.type==="toggleMark"||c?.type==="setAlignment",d=t(l?.labelKey??e);return jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__more-command","data-slot":e,disabled:!i,...a?{title:a}:{},...s?{"aria-pressed":r}:{},...r?{"data-active":""}:{},onMouseDown:O,onClick:u=>{o(),n(u.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:re(l?.paths)}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:d})]})}function Nu({sections:e,className:t}){let n=X(),[o,r]=rt.useState(false),i=rt.useRef(null),a=rt.useRef(null),l=rt.useRef(null),c=rt.useRef(false),s=rt.useId(),d=n("formattingBar.more"),u=rt.useCallback(p=>{r(false),p&&a.current?.focus();},[]),m=rt.useMemo(()=>({close:u}),[u]);rt.useEffect(()=>{if(!o)return;let p=f=>{let b=f.target;b instanceof Node&&i.current?.contains(b)||r(false);};return document.addEventListener("mousedown",p,true),()=>document.removeEventListener("mousedown",p,true)},[o]),rt.useEffect(()=>{if(!o||!c.current)return;c.current=false;let p=l.current;p&&Vh(p);},[o]);let g=p=>{p.key!=="Escape"||p.defaultPrevented||(p.preventDefault(),u(true));};return jsxRuntime.jsxs("div",{ref:i,className:`docx-toolbar__more${t?` ${t}`:""}`,[Yl]:"",children:[jsxRuntime.jsx("button",{ref:a,type:"button",className:"docx-toolbar__button docx-toolbar__more-trigger","data-slot":"toolbar.more","aria-haspopup":"dialog","aria-expanded":o,"aria-controls":o?s:void 0,"aria-label":d,title:d,...o?{"data-active":""}:{},onMouseDown:O,onClick:()=>r(p=>!p),onKeyDown:p=>{p.key==="ArrowDown"&&(p.preventDefault(),c.current=true,r(true));},children:re($h)}),o?jsxRuntime.jsx(Iu.Provider,{value:m,children:jsxRuntime.jsx("div",{ref:l,id:s,role:"dialog","aria-label":d,className:"docx-toolbar__more-panel","data-testid":"toolbar-overflow-panel",onKeyDown:g,children:e.map(p=>jsxRuntime.jsxs("div",{className:"docx-toolbar__more-section",role:"group","aria-label":n(p.labelKey),children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-heading","aria-hidden":"true",children:n(p.labelKey)}),p.children]},p.id))})}):null]})}function Yh(e,t){return e.value===t.value&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function er(e){let t=H(),n=rt.useRef(e);n.current=e;let o=rt.useCallback(l=>{let c=n.current,s=editor.toolbarCommandState(t,c);return {value:s.value??null,enabled:s.enabled,disabledReason:s.disabledReason}},[t,e]),r=q(o,Yh),i=rt.useMemo(()=>({execute:l=>editor.runToolbarCommand(t,"image.wrap",l),value:r.value??null,options:editor.IMAGE_WRAP_TARGETS,isEnabled:r.enabled,disabledReason:r.disabledReason}),[t,r]),a=rt.useMemo(()=>({execute:l=>editor.runToolbarCommand(t,"image.altText",l),value:r.value,options:[],isEnabled:r.enabled,disabledReason:r.disabledReason}),[t,r]);return e==="image.wrap"?i:a}var Jl=[{value:"inline",labelKey:"imageWrap.menu.inLineWithText",iconName:"wrap_text"},{value:"square",labelKey:"imageWrap.square",iconName:"crop_square"},{value:"squareLeft",labelKey:"imageWrap.menu.squareLeft",iconName:"format_image_left"},{value:"squareRight",labelKey:"imageWrap.menu.squareRight",iconName:"format_image_right"},{value:"tight",labelKey:"imageWrap.tight",iconName:"wrap_text"},{value:"through",labelKey:"imageWrap.through",iconName:"wrap_text"},{value:"topAndBottom",labelKey:"imageWrap.topAndBottom",iconName:"vertical_align_center"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function Oa({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),i=X(),{execute:a,value:l,isEnabled:c,disabledReason:s}=er("image.wrap"),[d,u]=rt.useState(false),m=rt.useRef(null),g=rt.useRef(null),p=rt.useRef(null),f=rt.useId(),b=rt.useMemo(()=>Jl.find(x=>x.value===l)??Jl[0],[l]),v=J("image.wrap"),P=i(v?.labelKey??"formattingBar.imageWrap");rt.useEffect(()=>{if(!d)return;let x=k=>{let E=m.current;E&&k.target instanceof Node&&E.contains(k.target)||u(false);},T=k=>{k.key==="Escape"&&(k.preventDefault(),u(false),g.current?.focus());};return document.addEventListener("mousedown",x,true),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",x,true),document.removeEventListener("keydown",T);}},[d]);let y=rt.useCallback(x=>{u(false),a(x);},[a]);if(t)return null;let S=r("imageWrap.tooltipPrefix",{label:r(b.labelKey)}),h={type:"button",ref:g,className:`docx-toolbar__button docx-toolbar__image-wrap-trigger${e?` ${e}`:""}`,"data-slot":"image.wrap",disabled:!c,...c?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":d,"aria-controls":d?f:void 0,"aria-label":P,title:s??S,onMouseDown:O,onClick:()=>u(x=>!x)};return jsxRuntime.jsxs("div",{ref:m,className:"docx-toolbar__image-wrap",children:[n?jsxRuntime.jsx(j,{...h,children:o}):jsxRuntime.jsx("button",{...h,children:o??re(v?.paths)}),d?jsxRuntime.jsx("div",{ref:p,id:f,role:"menu",className:"docx-toolbar__image-wrap-menu","aria-label":r("imageWrap.menu.ariaLabel"),onMouseDown:x=>x.stopPropagation(),children:Jl.map(x=>jsxRuntime.jsx("button",{type:"button",role:"menuitemradio",className:"docx-toolbar__image-wrap-item","aria-checked":l===x.value,...l===x.value?{"data-active":""}:{},onMouseDown:O,onClick:()=>y(x.value),children:r(x.labelKey)},x.value))}):null]})}Oa.docxSlot="image.wrap";var tr=Object.assign(Oa,{docxSlot:"image.wrap"});function Ba({className:e,hidden:t,asChild:n,children:o}){let{t:r}=_(),i=X(),{execute:a,value:l,isEnabled:c,disabledReason:s}=er("image.altText"),[d,u]=rt.useState(false),[m,g]=rt.useState(""),p=rt.useRef(null),f=rt.useRef(null),b=rt.useId();rt.useEffect(()=>{d&&g(l??"");},[d,l]),rt.useEffect(()=>{if(!d)return;let h=T=>{let k=p.current;k&&T.target instanceof Node&&k.contains(T.target)||u(false);},x=T=>{T.key==="Escape"&&(T.preventDefault(),u(false),f.current?.focus());};return document.addEventListener("mousedown",h,true),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",h,true),document.removeEventListener("keydown",x);}},[d]);let v=rt.useCallback(()=>{a(m),u(false);},[m,a]);if(t)return null;let P=J("image.altText"),y=i(P?.labelKey??"formattingBar.altText"),S={type:"button",ref:f,className:`docx-toolbar__button docx-toolbar__alt-text-trigger${e?` ${e}`:""}`,"data-slot":"image.altText",disabled:!c,...c?{}:{"data-disabled":""},"aria-haspopup":"dialog","aria-expanded":d,"aria-controls":d?b:void 0,"aria-label":y,title:s??y,onMouseDown:O,onClick:()=>u(h=>!h)};return jsxRuntime.jsxs("div",{ref:p,className:"docx-toolbar__alt-text",children:[n?jsxRuntime.jsx(j,{...S,children:o}):jsxRuntime.jsx("button",{...S,children:o??y}),d?jsxRuntime.jsxs("div",{id:b,role:"dialog","aria-label":r("imageAltText.panelTitle"),className:"docx-toolbar__alt-text-panel",onMouseDown:h=>h.stopPropagation(),children:[jsxRuntime.jsx("label",{className:"docx-dialog__label",htmlFor:`${b}-description`,children:r("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:`${b}-description`,className:"docx-dialog__textarea",value:m,onChange:h=>g(h.target.value),placeholder:r("dialogs.imageProperties.altTextPlaceholder")}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:()=>u(false),children:r("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:v,children:r("common.apply")})]})]}):null]})}Ba.docxSlot="image.altText";var or=Object.assign(Ba,{docxSlot:"image.altText"});var qu=e=>e.image;function Zu(e){return Array.from(e.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(t=>t.offsetParent!==null||t===document.activeElement)}function uv(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function ns(e){let t=e.position;return !t||e.kind!=="anchored"?{positionMode:"frame",horizontalPoints:"",verticalPoints:"",relativeToH:"page",relativeToV:"line"}:t.mode==="simple"?{positionMode:"simple",horizontalPoints:t.horizontalEmu!==void 0?String($t(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String($t(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String($t(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String($t(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function pv(e,t){let n=ns(t);return e.horizontalPoints!==n.horizontalPoints||e.verticalPoints!==n.verticalPoints||e.relativeToH!==n.relativeToH||e.relativeToV!==n.relativeToV}function Za(e){if(e.trim()==="")return null;let t=Number(e);if(!Number.isFinite(t))return null;let n=An(t);return Number.isInteger(n)?n:null}function mv(e,t){let n=ns(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let s=e.horizontalPoints!==n.horizontalPoints,d=e.verticalPoints!==n.verticalPoints,u=s?Za(e.horizontalPoints):t.position?.horizontalEmu,m=d?Za(e.verticalPoints):t.position?.verticalEmu;return s&&u===null?{ok:false}:d&&m===null?{ok:false}:u===void 0||m===void 0?{ok:false}:{ok:true,value:{horizontalEmu:u,verticalEmu:m}}}let o=e.horizontalPoints!==n.horizontalPoints,r=e.verticalPoints!==n.verticalPoints,i=e.relativeToH!==n.relativeToH,a=e.relativeToV!==n.relativeToV,l=o?Za(e.horizontalPoints):t.position?.horizontalEmu,c=r?Za(e.verticalPoints):t.position?.verticalEmu;return o&&l===null?{ok:false}:r&&c===null?{ok:false}:{ok:true,value:{...typeof l=="number"?{horizontalEmu:l}:{},...typeof c=="number"?{verticalEmu:c}:{},...i||o||r?{relativeToH:e.relativeToH}:{},...a||o||r?{relativeToV:e.relativeToV}:{}}}}function qa(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function Ka(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function rs({open:e,onClose:t,className:n,triggerRef:o}){let r=H(),{t:i}=_(),a=q(qu),l=rt.useId(),c=rt.useId(),s=rt.useId(),d=rt.useRef(null),u=rt.useRef(null),m=rt.useRef(null),g=rt.useRef(null),[p,f]=rt.useState(null),[b,v]=rt.useState(null),P=u.current,y=P?.canCrop===false,S=P?.canResize===false,h=P?.locks.changeAspect===true,x=P?.kind==="anchored"&&P.canMove===true,T=P?.kind==="inline",k=P?.kind==="anchored"&&P.canMove===false;rt.useEffect(()=>{if(!e){u.current=null,m.current=null,g.current=null;return}if(!a)return;if(u.current=a,r?.surface){let{anchor:ae}=r.surface.state().selection;m.current={paragraphId:ae.paragraphId,offset:ae.offset},g.current=r.surface.session.packageRevision();}v(null);let R=ns(a),M=a.crop;f({widthPoints:String($t(a.widthEmu)),heightPoints:String($t(a.heightEmu)),cropLeft:String(M.left),cropTop:String(M.top),cropRight:String(M.right),cropBottom:String(M.bottom),title:a.title,description:a.description,hyperlink:a.hyperlink??"",wrap:a.wrap,lockAspect:a.locks.changeAspect,...R});},[e,a?.id,a?.widthEmu,a?.heightEmu,r]);let E=rt.useCallback(()=>{o?.current?.focus(),r?.focus();},[r,o]),w=rt.useCallback(()=>{t(),E();},[t,E]);rt.useEffect(()=>{if(!e)return;let R=d.current;if(!R)return;let M=Zu(R);(M.find($=>$.id==="image-prop-width"&&!$.hasAttribute("disabled"))??M.find($=>!$.hasAttribute("disabled"))??R).focus();let z=$=>{if($.key==="Escape"){$.preventDefault(),w();return}if($.key!=="Tab")return;let V=Zu(R);if(V.length===0)return;let oe=document.activeElement,ne=V.findIndex(he=>he===oe);if(ne===-1)return;$.preventDefault();let be=$.shiftKey?(ne-1+V.length)%V.length:(ne+1)%V.length;V[be]?.focus();};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[e,w]);let D=rt.useMemo(()=>{let R=P??a;return !R||R.widthEmu<=0?1:R.widthEmu/R.heightEmu},[a,P]),F=rt.useCallback(R=>{f(M=>{if(!M)return M;if(!M.lockAspect)return {...M,widthPoints:R};let ae=Ka(R);if(ae===null)return {...M,widthPoints:R};let z=Math.round(ae/D*100)/100;return {...M,widthPoints:R,heightPoints:String(z)}});},[D]),A=rt.useCallback(R=>{f(M=>{if(!M)return M;if(!M.lockAspect)return {...M,heightPoints:R};let ae=Ka(R);if(ae===null)return {...M,heightPoints:R};let z=Math.round(ae*D*100)/100;return {...M,widthPoints:String(z),heightPoints:R}});},[D]),I=rt.useCallback(()=>{let R=u.current;if(!R?.intrinsic)return;let M=R.intrinsic.pixelWidth*72/R.intrinsic.dpiX,ae=R.intrinsic.pixelHeight*72/R.intrinsic.dpiY;f(z=>z&&{...z,widthPoints:String(Math.round(M*100)/100),heightPoints:String(Math.round(ae*100)/100)});},[a]),N=rt.useCallback(()=>{let R=u.current,M=m.current,ae=g.current;if(!r||!R||!p||!M||ae===null)return;let z={type:"setImageProperties",drawingNodeId:R.id,expectedPackageRevision:ae,selectionParagraphId:M.paragraphId,selectionOffset:M.offset};if(!S){let he=Ka(p.widthPoints),W=Ka(p.heightPoints);if(he===null||W===null){v("imageProperties.errors.invalidDimensions");return}let B=An(he),Ee=An(W);B!==R.widthEmu&&(z.widthEmu=B),Ee!==R.heightEmu&&(z.heightEmu=Ee);}if(R.canCrop&&!y){let he=qa(p.cropLeft),W=qa(p.cropTop),B=qa(p.cropRight),Ee=qa(p.cropBottom);if(he===null||W===null||B===null||Ee===null){v("imageProperties.errors.invalidCrop");return}let ce=R.crop;(he!==ce.left||W!==ce.top||B!==ce.right||Ee!==ce.bottom)&&(z.crop={left:he,top:W,right:B,bottom:Ee});}p.title!==R.title&&(z.title=p.title),p.description!==R.description&&(z.description=p.description);let $=p.hyperlink.trim();if($!==(R.hyperlink??"")&&(z.hyperlink=$===""?null:$),R.canChangeWrap&&p.wrap!==R.wrap&&(z.wrap=p.wrap),R.kind==="anchored"&&R.canMove&&pv(p,R)){let he=mv(p,R);if(!he.ok){v("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(he.value,R))){v("imageProperties.errors.invalidPosition");return}Object.assign(z,he.value);}if(!(z.widthEmu!==void 0||z.heightEmu!==void 0||z.title!==void 0||z.description!==void 0||z.hyperlink!==void 0||z.crop!==void 0||z.wrap!==void 0||z.horizontalEmu!==void 0||z.verticalEmu!==void 0||z.relativeToH!==void 0||z.relativeToV!==void 0)){w();return}if(!r.can(z).ok){v("imageProperties.errors.refused");return}if(!r.exec(z).ok){v("imageProperties.errors.refused");return}w();},[r,p,y,S,w]);return !e||!p?null:jsxRuntime.jsx("div",{className:`docx-dialog-overlay${n?` ${n}`:""}`,onClick:w,onMouseDown:R=>{R.stopPropagation(),uv(R);},children:jsxRuntime.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-labelledby":l,className:"docx-dialog docx-image-properties-dialog",onClick:R=>R.stopPropagation(),onMouseDown:R=>R.stopPropagation(),children:[jsxRuntime.jsx("div",{id:l,className:"docx-dialog__header",children:i("dialogs.imageProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-dialog__body",children:[b?jsxRuntime.jsx("p",{className:"docx-dialog__error",children:i(b)}):null,jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.dimensions")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-width",children:i("dialogs.imageProperties.widthLabel")}),jsxRuntime.jsx("input",{id:"image-prop-width",className:"docx-dialog__input",value:p.widthPoints,disabled:S,onChange:R=>F(R.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-height",children:i("dialogs.imageProperties.heightLabel")}),jsxRuntime.jsx("input",{id:"image-prop-height",className:"docx-dialog__input",value:p.heightPoints,disabled:S,onChange:R=>A(R.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:p.lockAspect,disabled:h,onChange:R=>f(M=>M&&{...M,lockAspect:R.target.checked})}),i("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:y||!P?.intrinsic,onClick:I,children:i("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.position")}),T?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionUnavailable")}):null,k?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionLocked")}):null,x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[p.positionMode==="frame"?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-h",children:i("imageProperties.relativeToHorizontal")}),jsxRuntime.jsx("select",{id:"image-pos-rel-h",className:"docx-dialog__select",value:p.relativeToH??"page",onChange:R=>f(M=>M&&{...M,relativeToH:R.target.value}),children:editor.DRAWING_REL_FROM_H.map(R=>jsxRuntime.jsx("option",{value:R,children:i(`dialogs.imagePosition.relativeOptions.${R}`)},R))})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-v",children:i("imageProperties.relativeToVertical")}),jsxRuntime.jsx("select",{id:"image-pos-rel-v",className:"docx-dialog__select",value:p.relativeToV??"line",onChange:R=>f(M=>M&&{...M,relativeToV:R.target.value}),children:editor.DRAWING_REL_FROM_V.map(R=>jsxRuntime.jsx("option",{value:R,children:i(`dialogs.imagePosition.relativeOptions.${R}`)},R))})]})]}):null,jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-h",children:i("imageProperties.horizontalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-h",className:"docx-dialog__input",value:p.horizontalPoints,onChange:R=>f(M=>M&&{...M,horizontalPoints:R.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-v",children:i("imageProperties.verticalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-v",className:"docx-dialog__input",value:p.verticalPoints,onChange:R=>f(M=>M&&{...M,verticalPoints:R.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:i("imageProperties.units.points")})]})]}):null]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.altText")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-title",children:i("imageAltText.title")}),jsxRuntime.jsx("input",{id:"image-prop-title",className:"docx-dialog__input",value:p.title,onChange:R=>f(M=>M&&{...M,title:R.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-description",children:i("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:"image-prop-description",className:"docx-dialog__textarea",value:p.description,onChange:R=>f(M=>M&&{...M,description:R.target.value}),placeholder:i("dialogs.imageProperties.altTextPlaceholder")})]})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.hyperlink")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:s,children:i("hyperlinkPopup.urlLabel")}),jsxRuntime.jsx("input",{id:s,className:"docx-dialog__input docx-dialog__input--full",value:p.hyperlink,onChange:R=>f(M=>M&&{...M,hyperlink:R.target.value}),placeholder:i("hyperlinkPopup.urlPlaceholder")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("dialogs.imageProperties.textWrapping")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:c,children:i("formattingBar.imageWrap")}),jsxRuntime.jsx("select",{id:c,className:"docx-dialog__select docx-dialog__input--full",value:p.wrap,disabled:P?.canChangeWrap===false,onChange:R=>f(M=>M&&{...M,wrap:R.target.value}),children:editor.IMAGE_WRAP_TARGETS.map(R=>jsxRuntime.jsx("option",{value:R,children:i(`imageWrap.targets.${R}`)},R))})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.crop")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-left",children:i("imageProperties.cropLeft")}),jsxRuntime.jsx("input",{id:"image-crop-left",className:"docx-dialog__input",disabled:y,value:p.cropLeft,onChange:R=>f(M=>M&&{...M,cropLeft:R.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-top",children:i("imageProperties.cropTop")}),jsxRuntime.jsx("input",{id:"image-crop-top",className:"docx-dialog__input",disabled:y,value:p.cropTop,onChange:R=>f(M=>M&&{...M,cropTop:R.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-right",children:i("imageProperties.cropRight")}),jsxRuntime.jsx("input",{id:"image-crop-right",className:"docx-dialog__input",disabled:y,value:p.cropRight,onChange:R=>f(M=>M&&{...M,cropRight:R.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-bottom",children:i("imageProperties.cropBottom")}),jsxRuntime.jsx("input",{id:"image-crop-bottom",className:"docx-dialog__input",disabled:y,value:p.cropBottom,onChange:R=>f(M=>M&&{...M,cropBottom:R.target.value})})]}),y?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.nonPictureHint")}):null]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:w,children:i("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:N,children:i("common.apply")})]})]})})}function za({className:e,hidden:t,asChild:n,children:o}){let r=H(),{t:i}=_(),a=q(qu),[l,c]=rt.useState(false),s=rt.useRef(null),d={type:"setImageProperties",description:"probe"},u=r&&a?r.can(d):null,m=u?.ok===true,g=u&&!u.ok?u.reason:null;if(t)return null;let p=J("image.properties"),f={type:"button",ref:s,className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.properties",disabled:!m,...m?{}:{"data-disabled":""},"aria-label":i("formattingBar.imagePropertiesShortcut"),title:g??i("formattingBar.imagePropertiesShortcut"),onMouseDown:O,onClick:()=>c(true)};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n?jsxRuntime.jsx(j,{...f,children:o}):jsxRuntime.jsx("button",{...f,children:o??re(p?.paths)}),jsxRuntime.jsx(rs,{open:l,onClose:()=>c(false),triggerRef:s})]})}za.docxSlot="image.properties";var rn=Object.assign(za,{docxSlot:"image.properties"});function Le(e){return Object.assign(n=>jsxRuntime.jsx(go,{slot:e,...n}),{docxSlot:e})}var Ku=Le("history.undo"),zu=Le("history.redo"),$u=Le("text.bold"),Vu=Le("text.italic"),Uu=Le("text.underline"),Wu=Le("text.strike"),Gu=Le("format.clear"),ju=Le("script.super"),Yu=Le("script.sub"),Xu=Le("alignment.left"),Ju=Le("alignment.center"),Qu=Le("alignment.right"),ep=Le("alignment.justify"),tp=Le("list.bullet"),op=Le("list.numbered"),np=Le("list.outdent"),rp=Le("list.indent");var ap=Le("table.insert"),ip=Le("review.comments");function hv({className:e,hidden:t,icon:n,asChild:o,children:r}){let i=H(),{openAtCaret:a}=wl(),l=editor.chromeProbeForSlot("text.link"),c=i&&l?i.can(l):null,s=c?.ok===true,{t:d}=_(),u=i18n.localizeDisabledReason(c&&!c.ok?c.reason:null,d),m=X();if(t)return null;let g=J("text.link"),p=m(g?.labelKey??"text.link"),f={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"text.link",disabled:!s,...s?{}:{"data-disabled":""},"aria-label":p,title:u??p,onMouseDown:O,onClick:()=>a()};return o?jsxRuntime.jsx(j,{...f,children:r}):jsxRuntime.jsx("button",{...f,children:n??r??re(g?.paths)})}var as=Object.assign(hv,{docxSlot:"text.link"});function vv({className:e,hidden:t}){let n=H(),{onSave:o}=rt.useContext(fo),r=X();if(t)return null;let i=J("file.save"),a=r(i?.labelKey??"file.save"),l=!n||!o;return jsxRuntime.jsx("button",{type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"file.save",disabled:l,...l?{"data-disabled":""}:{},"aria-label":a,title:a,onMouseDown:O,onClick:()=>o?.(),children:re(i?.paths)})}var is=Object.assign(vv,{docxSlot:"file.save"});function an({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}function ln(e){let t=e?.closest(".docx-editor")??null;for(;t&&!t.querySelector(".docx-pages");)t=t.parentElement?.closest(".docx-editor")??null;return t}var Sv=e=>({zoom:e.zoom,mode:e.zoomMode}),Tv=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,sp={type:"fixed"};function ls(){let e=H(),{zoom:t,mode:n}=q(Sv,Tv),o=rt.useCallback(i=>{e?.setZoom(i);},[e]),r=rt.useCallback(i=>{e?.setZoomMode(i);},[e]);return rt.useMemo(()=>{let i=n??sp,a=Un(t,"out"),l=Un(t,"in");return {zoom:t,mode:i,isFit:i.type==="fit",setZoom:o,setMode:r,fitToWidth:()=>r(editor.FIT_WIDTH_ZOOM_MODE),auto:()=>r("auto"),reset:()=>{r(sp),o(1);},zoomIn:()=>l!==null&&o(l),zoomOut:()=>a!==null&&o(a),canZoomIn:!!e&&l!==null,canZoomOut:!!e&&a!==null,levels:wa}},[e,t,n,o,r])}var ir=2,lr=3276,ar=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Ev=e=>e.formatting?.fontSizePt??null;function up(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function pp(e,t,n){for(let o=t.length-1;o>=0;o-=1)if(t[o]<e)return t[o];return Math.max(e-1,n)}function fp(e){return jsxRuntime.jsxs("span",{className:`docx-toolbar__stepper${e.className?` ${e.className}`:""}`,...e.slot!==void 0?{"data-slot":e.slot}:{},role:"group","aria-label":e.groupLabel,title:e.title??e.groupLabel,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canDecrease,"aria-label":e.decreaseLabel,onMouseDown:O,onClick:e.onDecrease,children:"\u2212"}),e.middle,jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__stepper-button",disabled:!e.canIncrease,"aria-label":e.increaseLabel,onMouseDown:O,onClick:e.onIncrease,children:"+"})]})}function wv(e){let t=e.trim().replace(/pt$/i,"").trim();if(t==="")return null;let n=Number(t);if(!Number.isFinite(n))return null;let o=Math.round(n*2);return o<ir||o>lr?null:o}function kv({className:e,hidden:t}){let n=H(),o=q(Ev),{isEnabled:r,disabledReason:i}=le("font.size"),a=X(),[l,c]=rt.useState(false),[s,d]=rt.useState(null),u=rt.useRef(null),m=rt.useRef(null),g=rt.useCallback(h=>{if(!n)return;let x=editor.commandForSlotValue("font.size",h);x&&n.can(x).ok&&n.exec(x);},[n]),p=rt.useCallback(h=>{g(Math.min(lr,Math.max(ir,Math.round(h*2))));},[g]),f=rt.useCallback(h=>{c(false),d(null),m.current?.blur(),h&&Rv(u.current);},[]);if(rt.useEffect(()=>{if(!l)return;let h=x=>{let T=u.current;T&&x.target instanceof Node&&T.contains(x.target)||(c(false),d(null));};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[l]),t)return null;let b=r&&o!==null,v=o===null?"\u2014":String(Math.round(o*2)/2),P=s??v,y=o===null?null:Math.round(o*2)/2,S=()=>{if(s===null)return;let h=wv(s);h!==null&&g(h);};return jsxRuntime.jsxs("span",{ref:u,className:"docx-toolbar__font-size","data-slot":"font.size",title:i??void 0,children:[jsxRuntime.jsx(fp,{className:e,groupLabel:a("fontSize.label"),decreaseLabel:a("fontSize.decrease"),increaseLabel:a("fontSize.increase"),middle:jsxRuntime.jsx("input",{ref:m,type:"text",inputMode:"decimal",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--boxed docx-toolbar__font-size-input",value:P,disabled:!r,role:"combobox","aria-expanded":l,"aria-haspopup":"listbox","aria-label":a("fontSize.label"),autoComplete:"off",onChange:h=>{d(h.target.value),c(true);},onFocus:h=>{h.target.select(),c(true);},onClick:()=>c(true),onKeyDown:h=>{h.key==="Enter"?(h.preventDefault(),S(),f(true)):h.key==="Escape"?(h.preventDefault(),f(true)):(h.key==="ArrowDown"||h.key==="ArrowUp")&&(h.preventDefault(),c(true),o!==null&&p(h.key==="ArrowDown"?pp(o,ar,ir/2):up(o,ar,lr/2)));},onBlur:()=>{S(),d(null);}}),canDecrease:b&&Math.round(o*2)>ir,canIncrease:b&&Math.round(o*2)<lr,onDecrease:()=>p(pp(o??0,ar,ir/2)),onIncrease:()=>p(up(o??0,ar,lr/2))}),l&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox","aria-label":a("fontSize.listLabel"),children:ar.map(h=>{let x=y===h;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":x,...x?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>{p(h),f(true);},children:h},h)})}):null]})}function Rv(e){(ln(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}var ds=Object.assign(kv,{docxSlot:"font.size"});function Mv({className:e,hidden:t}){let n=H(),{zoom:o,isFit:r,mode:i,setZoom:a,setMode:l,zoomIn:c,zoomOut:s,canZoomIn:d,canZoomOut:u,levels:m}=ls(),g=X(),[p,f]=rt.useState(false),b=rt.useRef(null);rt.useEffect(()=>{if(!p)return;let x=T=>{let k=b.current;k&&T.target instanceof Node&&k.contains(T.target)||f(false);};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[p]);let v=rt.useCallback(x=>{f(false),a(x);},[a]),P=rt.useCallback(x=>{f(false),l(x==="auto"?"auto":editor.FIT_WIDTH_ZOOM_MODE);},[l]);if(t)return null;let y=`${Math.round(o*100)}%`,S=editor.sameZoomMode(i,editor.AUTO_ZOOM_MODE),h=editor.sameZoomMode(i,editor.FIT_WIDTH_ZOOM_MODE);return jsxRuntime.jsxs("span",{ref:b,className:"docx-toolbar__zoom","data-slot":"zoom.level",children:[jsxRuntime.jsx(fp,{className:e,groupLabel:g("zoom.zoomLevel"),decreaseLabel:g("zoom.zoomOut"),increaseLabel:g("zoom.zoomIn"),middle:jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--menu",disabled:!n,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":g("zoom.zoomLevel"),onMouseDown:O,onClick:()=>f(x=>!x),children:[y,jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),canDecrease:u,canIncrease:d,onDecrease:s,onIncrease:c}),p?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__zoom-menu",role:"listbox","aria-label":g("zoom.zoomLevel"),children:[jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":S,...S?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>P("auto"),children:g("zoom.automatic")}),jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":h,...h?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>P("fit-width"),children:g("zoom.fitWidth")}),jsxRuntime.jsx("hr",{className:"docx-toolbar__menu-separator",role:"presentation"}),m.map(x=>{let T=!r&&Math.abs(x-o)<.001;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":T,...T?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>v(x),children:`${Math.round(x*100)}%`},x)})]}):null]})}var us=Object.assign(Mv,{docxSlot:"zoom.level"});var Nv=[1,1.15,1.5,2,2.5,3],hp=10,vp=0,Lv=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),Fv=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function Av({className:e,hidden:t}){let n=H(),o=q(Lv,Fv),{isEnabled:r,disabledReason:i}=le("list.lineSpacing"),a=le("paragraph.dialog"),l=gu(),c=X(),[s,d]=rt.useState(false),u=rt.useRef(null),m=rt.useRef(null);rt.useEffect(()=>{if(!s)return;let y=S=>{let h=u.current;h&&S.target instanceof Node&&h.contains(S.target)||d(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]);let g=rt.useCallback(y=>{if(d(false),!n)return;let S=editor.commandForSlotValue("list.lineSpacing",y);S&&n.can(S).ok&&n.exec(S);},[n]),p=rt.useCallback((y,S)=>{if(d(false),!n)return;let h={type:"setParagraphSpacing",[y]:S};n.can(h).ok&&n.exec(h);},[n]);if(t)return null;let f=J("list.lineSpacing"),b=(o.spaceBeforePt??0)>0,v=(o.spaceAfterPt??0)>0,P=o.lineSpacing?.rule==="multiple"?o.lineSpacing?.value??null:null;return jsxRuntime.jsxs("span",{ref:u,className:"docx-toolbar__line-spacing","data-slot":"list.lineSpacing",children:[jsxRuntime.jsxs("button",{ref:m,type:"button",className:`docx-toolbar__button docx-toolbar__line-spacing-trigger${e?` ${e}`:""}`,disabled:!r,...r?{}:{"data-disabled":""},"aria-haspopup":"menu","aria-expanded":s,"aria-label":c("lineSpacing.label"),title:i??c("lineSpacing.label"),onMouseDown:O,onClick:()=>d(y=>!y),children:[re(f?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),s&&r?jsxRuntime.jsxs("div",{className:"docx-toolbar__menu docx-toolbar__line-spacing-menu",role:"menu",children:[Nv.map(y=>{let S=P===y;return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":S,...S?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>g(y),children:Number.isInteger(y*10)?y.toFixed(1):y.toFixed(2)},y)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item","data-slot":"paragraph.dialog",disabled:!a.isEnabled,title:a.disabledReason??void 0,onMouseDown:O,onClick:()=>{d(false),l?.open(m.current);},children:c("lineSpacing.options")}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>p("beforePt",b?vp:hp),children:c(b?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:O,onClick:()=>p("afterPt",v?vp:hp),children:c(v?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var ms=Object.assign(Av,{docxSlot:"list.lineSpacing"});var Kv=[{value:"C00000",labelKey:"colorPicker.colors.darkRed",css:"#c00000"},{value:"FF0000",labelKey:"colorPicker.colors.red",css:"#ff0000"},{value:"FFC000",labelKey:"colorPicker.colors.orange",css:"#ffc000"},{value:"FFFF00",labelKey:"colorPicker.colors.yellow",css:"#ffff00"},{value:"92D050",labelKey:"colorPicker.colors.lightGreen",css:"#92d050"},{value:"00B050",labelKey:"colorPicker.colors.green",css:"#00b050"},{value:"00B0F0",labelKey:"colorPicker.colors.lightBlue",css:"#00b0f0"},{value:"0070C0",labelKey:"colorPicker.colors.blue",css:"#0070c0"},{value:"002060",labelKey:"colorPicker.colors.darkBlue",css:"#002060"},{value:"7030A0",labelKey:"colorPicker.colors.purple",css:"#7030a0"}],yp=[{value:"yellow",labelKey:"colorPicker.colors.yellow",css:"#ffff00"},{value:"green",labelKey:"colorPicker.colors.brightGreen",css:"#00ff00"},{value:"cyan",labelKey:"colorPicker.colors.cyan",css:"#00ffff"},{value:"magenta",labelKey:"colorPicker.colors.magenta",css:"#ff00ff"},{value:"blue",labelKey:"colorPicker.colors.blue",css:"#0000ff"},{value:"red",labelKey:"colorPicker.colors.red",css:"#ff0000"},{value:"darkBlue",labelKey:"colorPicker.colors.darkBlue",css:"#000080"},{value:"darkCyan",labelKey:"colorPicker.colors.darkCyan",css:"#008080"},{value:"darkGreen",labelKey:"colorPicker.colors.darkGreen",css:"#008000"},{value:"darkMagenta",labelKey:"colorPicker.colors.darkMagenta",css:"#800080"},{value:"darkRed",labelKey:"colorPicker.colors.darkRed",css:"#800000"},{value:"darkYellow",labelKey:"colorPicker.colors.darkYellow",css:"#808000"},{value:"darkGray",labelKey:"colorPicker.colors.darkGray",css:"#808080"},{value:"lightGray",labelKey:"colorPicker.colors.lightGray",css:"#c0c0c0"},{value:"black",labelKey:"colorPicker.colors.black",css:"#000000"},{value:"white",labelKey:"colorPicker.colors.white",css:"#ffffff"}],xp=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],$a=["colorPicker.theme.background1","colorPicker.theme.text1","colorPicker.theme.background2","colorPicker.theme.text2","colorPicker.theme.accent1","colorPicker.theme.accent2","colorPicker.theme.accent3","colorPicker.theme.accent4","colorPicker.theme.accent5","colorPicker.theme.accent6"],Wt=e=>({labelKey:`colorPicker.theme.lighter${e}`,apply:t=>t+(255-t)*(e/100)}),st=e=>({labelKey:`colorPicker.theme.darker${e}`,apply:t=>t*(1-e/100)});function zv(e){let t=[0,2,4].map(o=>parseInt(e.slice(o,o+2),16)),n=(Math.max(...t)+Math.min(...t))/2/255;return n===1?[st(5),st(15),st(25),st(35),st(50)]:n===0?[Wt(50),Wt(35),Wt(25),Wt(15),Wt(5)]:n>=.8?[st(10),st(25),st(50),st(75),st(90)]:[Wt(80),Wt(60),Wt(40),st(25),st(50)]}var $v=/^[0-9A-Fa-f]{6}$/;function Vv(e,t){let n="";for(let o=0;o<6;o+=2){let r=Math.round(t(parseInt(e.slice(o,o+2),16)));n+=Math.max(0,Math.min(255,r)).toString(16).padStart(2,"0");}return n.toUpperCase()}function Uv(e){let t=parseInt(e.slice(0,2),16),n=parseInt(e.slice(2,4),16),o=parseInt(e.slice(4,6),16);return .299*t+.587*n+.114*o>230}function Va({value:e,css:t,title:n,selected:o,apply:r}){return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch",style:{backgroundColor:t},"aria-label":n,title:n,"data-value":e,...o?{"data-selected":""}:{},...Uv(t.replace("#",""))?{"data-light":""}:{},onMouseDown:O,onClick:()=>r(e)})}function Wv({apply:e,label:t,current:n,themeHexes:o}){let r=o.map(zv),i=[0,1,2,3,4];return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.themeColors")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--theme",role:"group",children:[o.map((a,l)=>jsxRuntime.jsx(Va,{value:a,css:`#${a.toLowerCase()}`,title:t($a[l]),selected:n===a,apply:e},`base-${l}`)),i.map(a=>o.map((l,c)=>{let s=r[c][a],d=Vv(l,s.apply);return jsxRuntime.jsx(Va,{value:d,css:`#${d.toLowerCase()}`,title:`${t($a[c])}, ${t(s.labelKey)}`,selected:n===d,apply:e},`${a}-${c}`)}))]})]})}function Gv(e){let{apply:t,label:n,current:o}=e,[r,i]=rt.useState(""),a=$v.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Wv,{...e}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:n("colorPicker.standardColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid",role:"group",children:Kv.map(l=>jsxRuntime.jsx(Va,{value:l.value,css:l.css,title:n(l.labelKey),selected:o===l.value,apply:t},l.value))})]}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:n("colorPicker.customColor")}),jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-custom",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-hash","aria-hidden":"true",children:"#"}),jsxRuntime.jsx("input",{type:"text",className:"docx-toolbar__swatch-hex",value:r,maxLength:6,spellCheck:false,"aria-label":n("colorPicker.customColor"),onChange:l=>i(l.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:l=>{l.key==="Enter"&&a&&t(r.toUpperCase());}}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch-apply",disabled:!a,onMouseDown:O,onClick:()=>t(r.toUpperCase()),children:n("colorPicker.apply")})]})]})]})}function gs({apply:e,current:t}){let n=H(),o=X(),r=n?.getDocumentThemeColors()??[],i=r.length===$a.length?r.map(l=>l.hex):xp,a=t?.toUpperCase()??null;return jsxRuntime.jsx(Gv,{apply:e,label:o,current:a,themeHexes:i})}var jv=yp.filter(e=>e.value!=="white");function Yv({apply:e,label:t,current:n}){return jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-section",children:[jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-heading",children:t("colorPicker.highlightColors")}),jsxRuntime.jsx("div",{className:"docx-toolbar__swatch-grid docx-toolbar__swatch-grid--highlight",role:"group",children:jv.map(o=>jsxRuntime.jsx(Va,{value:o.value,css:o.css,title:t(o.labelKey),selected:n===o.value,apply:e},o.value))})]})}function Sp(e){let{slot:t,defaultValue:n,cssOf:o,clear:r,body:i}=e,a=t==="text.color";return Object.assign(({className:c,hidden:s,icon:d})=>{let u=H(),{isEnabled:m,disabledReason:g}=le(t),p=X(),[f,b]=rt.useState(false),[v,P]=rt.useState(n),y=rt.useRef(null),S=q(w=>{if(a){let D=w.formatting?.color;return D&&D.kind==="hex"?D.value.toUpperCase():null}return w.formatting?.highlight??null}),h=u?.getDocumentThemeColors()??[],x=h.length===$a.length?h.map(w=>w.hex):xp;rt.useEffect(()=>{if(!f)return;let w=D=>{let F=y.current;F&&D.target instanceof Node&&F.contains(D.target)||b(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[f]);let T=rt.useCallback(w=>{if(b(false),!u)return;let D=editor.commandForSlotValue(t,w);D&&u.can(D).ok&&(u.exec(D),w!==r.value&&P(w));},[u]),k=rt.useMemo(()=>J(t),[]);if(s)return null;let E=p(k?.labelKey??t);return jsxRuntime.jsxs("div",{ref:y,className:`docx-toolbar__colorsplit${c?` ${c}`:""}`,"data-slot":t,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__colorsplit-main",disabled:!m,...m?{}:{"data-disabled":""},"aria-label":E,title:g??E,onMouseDown:O,onClick:()=>T(v),children:[d??re(k?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:o(v)},"aria-hidden":"true"})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__colorsplit-caret",disabled:!m,...m?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":f,"aria-label":E,title:g??E,onMouseDown:O,onClick:()=>b(w=>!w),children:"\u25BE"}),f?jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-popup",role:"dialog","aria-label":E,onMouseDown:O,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:O,onClick:()=>T(r.value),children:[jsxRuntime.jsx("span",{className:`docx-toolbar__swatch-clear-chip${r.value==="none"?" docx-toolbar__swatch-clear-chip--none":""}`,"aria-hidden":"true"}),p(r.labelKey)]}),i({apply:T,label:p,current:S,themeHexes:x})]}):null]})},{docxSlot:t})}var Xv=new Map(yp.map(e=>[e.value,e.css])),bs=Sp({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(gs,{apply:e.apply,current:e.current})}),hs=Sp({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>Xv.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(Yv,{...e})});var oy=["alignment.left","alignment.center","alignment.right","alignment.justify"];function ny({className:e,hidden:t}){let n=le("alignment.left"),o=le("alignment.center"),r=le("alignment.right"),i=le("alignment.justify"),a=X(),[l,c]=rt.useState(false),s=rt.useRef(null);if(rt.useEffect(()=>{if(!l)return;let f=b=>{let v=s.current;v&&b.target instanceof Node&&v.contains(b.target)||c(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[l]),t)return null;let d=[n,o,r,i],u=oy.map((f,b)=>({slot:f,control:J(f),state:d[b]})),m=u.find(f=>f.state.isActive)??u[0],g=u.some(f=>f.state.isEnabled),p=a(m.control?.labelKey??m.slot);return jsxRuntime.jsxs("div",{ref:s,className:`docx-toolbar__alignment${e?` ${e}`:""}`,"data-slot":"alignment",children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-trigger",disabled:!g,...g?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":l,"aria-label":p,title:g?p:m.state.disabledReason??p,onMouseDown:O,onClick:()=>c(f=>!f),children:[re(m.control?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),l?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__alignment-popup",children:u.map(f=>{let b=a(f.control?.labelKey??f.slot);return jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__button docx-toolbar__alignment-option","data-slot":f.slot,disabled:!f.state.isEnabled,...f.state.isActive?{"data-active":""}:{},"aria-pressed":f.state.isActive,"aria-label":b,title:f.state.disabledReason??b,onMouseDown:O,onClick:()=>{f.state.execute(),c(false);},children:re(f.control?.paths)},f.slot)})}):null]})}var Ua=Object.assign(ny,{docxSlot:"alignment"});function ys(e){let{label:t,icon:n,active:o,disabled:r,disabledReason:i,onSelect:a,asChild:l,className:c,children:s}=e,d={type:"button",className:`docx-toolbar__button${c?` ${c}`:""}`,disabled:r,...o?{"data-active":""}:{},...r?{"data-disabled":""}:{},...o!==void 0?{"aria-pressed":o}:{},"aria-label":t,title:r?i??t:t,onMouseDown:u=>O(u),onClick:r?void 0:a};return l?jsxRuntime.jsx(j,{...d,children:s}):jsxRuntime.jsx("button",{...d,children:n??s})}var uy=Object.freeze([]),py=e=>e.formatting?.fontFamily??null,my=e=>e;function Wa(){let e=H(),t=q(py),n=q(my),o=rt.useMemo(()=>e&&!n.isLoading?e.getAvailableFonts():uy,[e,n]),{isEnabled:r}=le("font.family"),i=rt.useCallback(a=>{if(!e)return;let l=editor.commandForSlotValue("font.family",a);l&&e.can(l).ok&&e.exec(l);},[e]);return rt.useMemo(()=>({value:t,setValue:i,options:o,isEnabled:r}),[t,i,o,r])}var Pp=rt.createContext(null);function Ss(){return rt.useContext(Pp)}function Ts({asChild:e,className:t,children:n}){let o=Ss(),r=X();if(!o)return null;let i=r(J("font.family")?.labelKey??"font.family"),a={onClick:()=>o.setOpen(!o.open),onMouseDown:O,disabled:!o.isEnabled,className:`docx-toolbar__font-family-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":i,title:i},l=n??jsxRuntime.jsx("span",{children:o.value??"\u2014"});return e?jsxRuntime.jsx(j,{...a,children:l}):jsxRuntime.jsx("button",{type:"button",...a,children:l})}Ts.docxToolbarPart=true;var fy=new Map([["arial","sansSerif"],["calibri","sansSerif"],["helvetica","sansSerif"],["verdana","sansSerif"],["open sans","sansSerif"],["roboto","sansSerif"],["times new roman","serif"],["georgia","serif"],["cambria","serif"],["garamond","serif"],["courier new","monospace"],["consolas","monospace"]]),gy=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function Ep({asChild:e,className:t,children:n}){let o=Ss(),r=X();if(!o||!o.open)return null;let i={role:"listbox",className:`docx-toolbar__menu docx-toolbar__font-family-content${t?` ${t}`:""}`,style:{position:"absolute",top:"100%",left:0,zIndex:30,minWidth:"100%",maxHeight:300,overflowY:"auto"}},a;return n!==void 0?a=n:a=gy.map(c=>({...c,fonts:o.options.filter(s=>(fy.get(s.toLowerCase())??"other")===c.category)})).filter(c=>c.fonts.length>0).map((c,s)=>jsxRuntime.jsxs("div",{role:"group",children:[s>0?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}):null,c.labelKey?jsxRuntime.jsx("div",{className:"docx-toolbar__menu-label",children:r(c.labelKey)}):null,c.fonts.map(d=>jsxRuntime.jsx(wp,{value:d},d))]},c.category)),e?jsxRuntime.jsx(j,{...i,children:a}):jsxRuntime.jsx("div",{...i,children:a})}function wp({value:e,asChild:t,className:n,children:o}){let r=Ss();if(!r)return null;let i=r.value===e,a={role:"option","aria-selected":i,...i?{"data-selected":""}:{},onMouseDown:O,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__font-family-item${n?` ${n}`:""}`},l=o??jsxRuntime.jsx("span",{style:{fontFamily:e},children:e});return t?jsxRuntime.jsx(j,{...a,children:l}):jsxRuntime.jsxs("button",{type:"button",...a,children:[l,i?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function by({hidden:e,asChild:t,className:n,children:o}){let r=Wa(),[i,a]=rt.useState(false),l=rt.useRef(null);rt.useEffect(()=>{if(!i)return;let u=m=>{let g=l.current;g&&m.target instanceof Node&&g.contains(m.target)||a(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]);let c=rt.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let s={className:`docx-toolbar__font-family${n?` ${n}`:""}`,"data-slot":"font.family",style:{position:"relative",display:"inline-block"}},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ts,{}),jsxRuntime.jsx(Ep,{})]});return jsxRuntime.jsx(Pp.Provider,{value:c,children:t?jsxRuntime.jsx(j,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var Cs=Object.assign(by,{docxSlot:"font.family",Trigger:Ts,Content:Ep,Item:wp});var vy={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},yy=new Set(["Title","Heading1","Heading2","Heading3"]),xy={Subtitle:"666666"},Sy="#4a6c8c";function kp(e){let t=vy[e.styleId],o={fontSize:t?`${t}px`:`${Math.min(Math.max(e.fontSize?e.fontSize/2:11,11),20)}px`,lineHeight:"1.3"};(e.bold??yy.has(e.styleId))&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let r=e.color??xy[e.styleId];return r?o.color=`#${r}`:e.styleId.startsWith("Heading")&&(o.color=Sy),o}var Ty=/^heading ([1-9])$/;function Es(e,t){let n=e||t,o=Ty.exec(n);return o?`Heading ${o[1]}`:n}function Rp(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:Es(t.name,t.styleId),priority:99}))}function Iy(e){let t=e.fontSizePt;return {...e.fontFamily?{fontFamily:e.fontFamily}:{},...t?{fontSize:`${Math.min(Math.max(t,9),20)}px`}:{},...e.bold?{fontWeight:700}:{},...e.italic?{fontStyle:"italic"}:{},...e.color?{color:`#${e.color}`}:{}}}var _y=Object.freeze([]),Dy=e=>e.formatting?.styleId??null,Ny=e=>e;function Ga(){let e=H(),t=q(Dy),n=q(Ny),o=rt.useMemo(()=>e&&!n.isLoading?e.getDocumentStyles().filter(a=>a.type==="paragraph").map(a=>({styleId:a.styleId,name:Es(a.name,a.styleId),preview:a.preview})):_y,[e,n]),{isEnabled:r}=le("styles.style"),i=rt.useCallback(a=>{if(!e)return;let l=editor.commandForSlotValue("styles.style",a);l&&e.can(l).ok&&e.exec(l);},[e]);return rt.useMemo(()=>({value:t,setValue:i,options:o,isEnabled:r}),[t,i,o,r])}var Mp=rt.createContext(null);function ks(){return rt.useContext(Mp)}function Rs({asChild:e,className:t,children:n}){let o=ks(),r=X();if(!o)return null;let i=J("styles.style"),a=r(i?.labelKey??"styles.style"),l={onClick:()=>o.setOpen(!o.open),onMouseDown:O,disabled:!o.isEnabled,className:`docx-toolbar__style-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":a,title:a},c=o.options.find(d=>d.styleId===o.value),s=n??(o.value===null?jsxRuntime.jsx("span",{children:i?.valueKey?r(i.valueKey):"\u2014"}):jsxRuntime.jsx("span",{children:c?.name??o.value}));return e?jsxRuntime.jsx(j,{...l,children:s}):jsxRuntime.jsx("button",{type:"button",...l,children:s})}Rs.docxToolbarPart=true;function Ip({asChild:e,className:t,children:n}){let o=ks();if(!o||!o.open)return null;let r={role:"listbox",className:`docx-toolbar__menu docx-toolbar__style-content${t?` ${t}`:""}`,style:{position:"absolute",top:"100%",left:0,zIndex:30,minWidth:"100%",maxHeight:300,overflowY:"auto"}},i=n??o.options.map(a=>jsxRuntime.jsx(_p,{value:a.styleId},a.styleId));return e?jsxRuntime.jsx(j,{...r,children:i}):jsxRuntime.jsx("div",{...r,children:i})}function _p({value:e,asChild:t,className:n,children:o}){let r=ks();if(!r)return null;let i=r.value===e,a=r.options.find(s=>s.styleId===e),l={role:"option","aria-selected":i,...i?{"data-selected":""}:{},onMouseDown:O,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__style-item${n?` ${n}`:""}`},c=o??jsxRuntime.jsx("span",{style:a?Iy(a.preview):void 0,children:a?.name??e});return t?jsxRuntime.jsx(j,{...l,children:c}):jsxRuntime.jsxs("button",{type:"button",...l,children:[c,i?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function Ly({hidden:e,asChild:t,className:n,children:o}){let r=Ga(),[i,a]=rt.useState(false),l=rt.useRef(null);rt.useEffect(()=>{if(!i)return;let u=m=>{let g=l.current;g&&m.target instanceof Node&&g.contains(m.target)||a(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]);let c=rt.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let s={className:`docx-toolbar__style${n?` ${n}`:""}`,"data-slot":"styles.style",style:{position:"relative",display:"inline-block"}},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Rs,{}),jsxRuntime.jsx(Ip,{})]});return jsxRuntime.jsx(Mp.Provider,{value:c,children:t?jsxRuntime.jsx(j,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var Ms=Object.assign(Ly,{docxSlot:"styles.style",Trigger:Rs,Content:Ip,Item:_p});function Np(e,t){let n=e;return Object.assign(({className:r,hidden:i,icon:a,asChild:l,children:c})=>{let{isEnabled:s,disabledReason:d}=le(n),u=Et(),m=t==="showAll"?u.showAll:u.formFill,g=X();if(i)return null;let p=J(n),f=g(p?.labelKey??e),b={type:"button",className:`docx-toolbar__button${r?` ${r}`:""}`,"data-slot":e,disabled:!s,...s?{}:{"data-disabled":""},...m?{"data-active":""}:{},"aria-pressed":m,"aria-label":f,title:d??f,onMouseDown:O,onClick:()=>{t==="showAll"?u.toggleShowAll():u.toggleFormFill();}};return l?jsxRuntime.jsx(j,{...b,children:c}):jsxRuntime.jsx("button",{...b,children:a??c??re(p?.paths)})},{docxSlot:n})}function Ay({className:e,hidden:t,icon:n,asChild:o,children:r}){let i=Ye.inspector,{isEnabled:a,disabledReason:l}=le(i),{inspectorOpen:c,openInspector:s}=Et(),d=X();if(t)return null;let u=J(i),m=d(u?.labelKey??"contentControl.inspector"),g={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Ye.inspector,disabled:!a,...a?{}:{"data-disabled":""},...c?{"data-active":""}:{},"aria-pressed":c,"aria-label":m,title:l??m,onMouseDown:O,onClick:()=>s()};return o?jsxRuntime.jsx(j,{...g,children:r}):jsxRuntime.jsx("button",{...g,children:n??r??re(u?.paths)})}function Hy({className:e,hidden:t,icon:n,asChild:o,children:r}){let{canRemove:i,removeDisabledReason:a,remove:l}=Et(),c=X();if(t)return null;let s=Ye.remove,d=J(s),u=c(d?.labelKey??"contentControl.remove"),m={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Ye.remove,disabled:!i,...i?{}:{"data-disabled":""},"aria-label":u,title:a??u,onMouseDown:O,onClick:()=>{l();}};return o?jsxRuntime.jsx(j,{...m,children:r}):jsxRuntime.jsx("button",{...m,children:n??r??re(d?.paths)})}var ja=Np(Ye.showAll,"showAll"),Ya=Np(Ye.formFill,"formFill"),Xa=Object.assign(Hy,{docxSlot:Ye.remove}),Ja=Object.assign(Ay,{docxSlot:Ye.inspector}),Lp={[Ye.showAll]:ja,[Ye.formFill]:Ya,[Ye.inspector]:Ja,[Ye.remove]:Xa};function Is(e,t){let n=H(),o=rt.useRef(t);o.current=t,rt.useEffect(()=>{if(!n)return;let r=((...i)=>{o.current(...i);});return n.on(e,r)},[n,e]);}var $y=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Ds=rt.createContext(null);function qp(){let e=rt.useContext(Ds);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function Uy(e,t){let n=t.table,r=(e?.getSelectedTable()??null)?.blockId??"",i=n?`${r}|${n.rows}|${n.columns}|${n.rowIndex}|${n.columnIndex}`:"",a=t.selection,l=a?`${a.from&&"paraId"in a.from?a.from.paraId:""}|${a.to&&"paraId"in a.to?a.to.paraId:""}|${t.selectionCollapsed}`:"",c=e?.getTableCellSelection()??null,s=c?`${c.tableId}|${c.rows.from}-${c.rows.to}|${c.columns.from}-${c.columns.to}|${c.cellIds.join(",")}`:"";return {tableKey:i,selectionKey:l,cellSelectionKey:s,editable:t.editable,editingMode:t.editingMode??"editing"}}function Wy(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function Gy(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var Bp={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function jy(e,t){let n={};for(let o of $y){let r=editor.tableChromeToolbarState(e,o,t);n[o]={enabled:r.enabled,disabledReason:r.disabledReason};}return n}function Ns({children:e}){let t=H(),[n,o]=rt.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,i]=rt.useState(Bp);rt.useEffect(()=>(()=>{}),[]);let a=q(rt.useCallback(m=>({table:m.table,editable:m.editable,editingMode:m.editingMode??"editing",headParagraphId:m.selection?.to&&"paraId"in m.selection.to?m.selection.to.paraId:m.selection?.from&&"paraId"in m.selection.from?m.selection.from.paraId:""}),[]),Wy,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),l=rt.useCallback(()=>{if(!t){i(Bp);return}let m=Uy(t,t.snapshot());i(g=>Gy(g,m)?g:m);},[t]);rt.useEffect(()=>{l();},[l,a]),Is("selectionChange",rt.useCallback(()=>{l();},[l]));let c=r.tableKey!=="",s=rt.useMemo(()=>t?jy(t,n):{},[t,n,r.tableKey,r.selectionKey,r.cellSelectionKey,r.editable,r.editingMode]),d=rt.useCallback((m,g)=>{if(!t)return;let{result:p,nextDraft:f}=editor.runTableChromeCommand(t,m,g,n);p.ok&&f&&o(f);},[t,n]),u=rt.useMemo(()=>({visible:c,draft:n,setDraft:o,slotState:m=>s[m]??{enabled:false,disabledReason:"editor is not ready"},apply:d}),[c,n,s,d]);return jsxRuntime.jsx(Ds.Provider,{value:u,children:e})}function Yy(){let e=rt.useContext(Ds);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function ei(e){let t=Yy(),n=t.slotState(e);return rt.useMemo(()=>({visible:t.visible,enabled:n.enabled,disabledReason:n.disabledReason,draft:t.draft,apply:o=>t.apply(e,o)}),[t,e,n])}var Jy='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function Co(e){return [...e.querySelectorAll(Jy)].filter(t=>t.closest('[role="menu"]')===e)}function Ls(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function vt(e,t,n){if(e.length===0)return false;let o=t?e.indexOf(t):-1,r=o===-1?n>0?0:e.length-1:(o+n+e.length)%e.length;return e[r]?.focus(),true}function yt(e,t){let n=t==="first"?e[0]:e[e.length-1];return n?(n.focus(),true):false}function ti(e){(ln(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function As(e,t,n){rt.useEffect(()=>{if(!e)return;let o=r=>{let i=n.current;i&&r.target instanceof Node&&i.contains(r.target)||t(false);};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,t,n]);}function oi({enabled:e,disabledReason:t,ariaLabel:n}){let{t:o}=_(),r=i18n.localizeDisabledReason(t,o),i=rt.useId(),a=!e&&r?i:void 0;return {reasonId:i,shared:{type:"button",onMouseDown:O,"aria-label":n,...a?{"aria-describedby":a}:{},...r?{title:r}:{},...e?{}:{"data-disabled":"","aria-disabled":true}},reasonNode:a&&r?jsxRuntime.jsx("span",{id:i,className:"docx-editor-sr-only",children:r}):null}}var tx='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function Kp(e,t,n,o){rt.useEffect(()=>{if(!e)return;let r=n.current,i=o.current;if(!r)return;let a=()=>[...r.querySelectorAll(tx)].filter(s=>s.closest('[role="menu"]')===r);queueMicrotask(()=>{let s=a();(s.find(u=>u.hasAttribute("data-selected")||u.hasAttribute("data-active"))??s[0])?.focus();});let c=s=>{let d=a();if(s.key==="Escape"){s.preventDefault(),t(false),i?.focus();return}if(s.key==="ArrowDown"){s.preventDefault(),vt(d,document.activeElement,1);return}if(s.key==="ArrowUp"){s.preventDefault(),vt(d,document.activeElement,-1);return}if(s.key==="Home"){s.preventDefault(),yt(d,"first");return}if(s.key==="End"){s.preventDefault(),yt(d,"last");return}if(s.key==="Enter"||s.key===" "){let u=document.activeElement;u instanceof HTMLElement&&d.includes(u)&&(s.preventDefault(),u.click());}};return r.addEventListener("keydown",c),()=>r.removeEventListener("keydown",c)},[e,t,n,o]);}function zp(e,t,n,o){rt.useEffect(()=>{if(!e)return;let r=n.current,i=o.current;if(!r)return;let a=()=>[...r.querySelectorAll('button:not([aria-disabled="true"])')].filter(c=>c.closest('[role="dialog"]')===r);queueMicrotask(()=>{a()[0]?.focus();});let l=c=>{if(c.key==="Escape"){c.preventDefault(),t(false),i?.focus();return}if(c.key==="Enter"||c.key===" "){let s=document.activeElement,d=a();s instanceof HTMLElement&&d.includes(s)&&(c.preventDefault(),s.click());}};return r.addEventListener("keydown",l),()=>r.removeEventListener("keydown",l)},[e,t,n,o]);}function Gp(e,t,n){if(e)return o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(!t));}}function sx(e){return re(editor.tableChromeIconPaths(e))}function jp(){return rt.createContext(null)}function Ht(e){let t=rt.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function Os(e,t,n){let o=jp();function r({hidden:l,asChild:c,className:s,children:d}){let{visible:u,enabled:m,disabledReason:g,draft:p,apply:f}=ei(e),[b,v]=rt.useState(false),P=rt.useRef(null),y=rt.useRef(null);As(b,v,P);let S=rt.useMemo(()=>({open:b,setOpen:v,enabled:m,disabledReason:g,apply:f,draft:p,triggerRef:y}),[b,m,g,f,p]);if(l||!u)return null;let h={className:`${t}${s?` ${s}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},x=d??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(i,{}),jsxRuntime.jsx(a,{})]});return jsxRuntime.jsx(o.Provider,{value:S,children:c?jsxRuntime.jsx(j,{...h,ref:P,children:x}):jsxRuntime.jsx("div",{ref:P,...h,children:x})})}function i({asChild:l,className:c,children:s}){let{open:d,setOpen:u,enabled:m,disabledReason:g,triggerRef:p}=Ht(o),f=X(),b=J(e),v=f(b?.labelKey??n),{shared:P,reasonNode:y}=oi({enabled:m,disabledReason:g,ariaLabel:v}),S={...P,ref:p,className:`docx-toolbar__button docx-table-chrome__trigger${c?` ${c}`:""}`,"aria-haspopup":"menu","aria-expanded":d,onClick:m?()=>u(!d):void 0,...l?{tabIndex:m?0:-1,role:"button",onKeyDown:Gp(m,d,u)}:{}},h=s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[re(b?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]});return l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...S,children:h}),y]}):jsxRuntime.jsxs("button",{...S,children:[h,y]})}i.docxToolbarPart=true;function a({asChild:l,className:c,children:s}){let{open:d,setOpen:u,enabled:m,triggerRef:g}=Ht(o),p=X(),f=rt.useRef(null);if(Kp(d&&m,u,f,g),!d||!m)return null;let b=J(e),v=p(b?.labelKey??n),P={ref:f,role:"menu","aria-label":v,className:`docx-table-chrome__panel${c?` ${c}`:""}`,onMouseDown:O};return l?jsxRuntime.jsx(j,{...P,children:s}):jsxRuntime.jsx("div",{...P,children:s})}return {Root:r,Trigger:i,Content:a,Ctx:o}}var dr=Os("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function Yp({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Ht(dr.Ctx),l=X(),c=editor.TABLE_BORDER_TARGET_OPTIONS.find(m=>m.value===e);if(!c)return null;let s=c.value==="none"?false:c.value===a.activeTarget,d={type:"button",role:"menuitemradio","aria-checked":s,"data-value":c.value,className:`docx-table-chrome__target-btn${n?` ${n}`:""}`,...s?{"data-active":""}:{},"aria-label":l(c.labelKey),title:l(c.labelKey),onMouseDown:O,onClick:()=>{i(false),r(c.value);}},u=o??sx(c.icon);return t?jsxRuntime.jsx(j,{...d,children:u}):jsxRuntime.jsx("button",{...d,children:u})}function Xp(e){let{children:t}=e;return jsxRuntime.jsx(dr.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(n=>jsxRuntime.jsx(Yp,{value:n.value},n.value))})})}function cx(e){let{children:t}=e,n=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(dr.Trigger,{}),jsxRuntime.jsx(Xp,{})]});return jsxRuntime.jsx(dr.Root,{...e,children:n})}var gr=Object.assign(cx,{docxSlot:"table.borderTarget",Trigger:dr.Trigger,Content:Xp,Item:Yp}),ur=Os("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function Jp({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Ht(ur.Ctx),l=X(),c=editor.TABLE_BORDER_STYLE_OPTIONS.find(m=>m.value===e);if(!c)return null;let s=c.value===a.spec.style,d={type:"button",role:"menuitemradio","aria-checked":s,...s?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{i(false),r(c.value);}},u=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:`docx-table-line ${c.previewClass}`,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:l(c.labelKey)})]});return t?jsxRuntime.jsx(j,{...d,children:u}):jsxRuntime.jsx("button",{...d,children:u})}function Qp(e){let{children:t}=e;return jsxRuntime.jsx(ur.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(n=>jsxRuntime.jsx(Jp,{value:n.value},n.value))})}function dx(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ur.Trigger,{}),jsxRuntime.jsx(Qp,{})]});return jsxRuntime.jsx(ur.Root,{...e,children:t})}var br=Object.assign(dx,{docxSlot:"table.borderStyle",Trigger:ur.Trigger,Content:Qp,Item:Jp}),pr=Os("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function em({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Ht(pr.Ctx),l=X(),c=Number(e),s=editor.TABLE_BORDER_WIDTH_OPTIONS.find(g=>g.size===c);if(!s)return null;let d=s.size===a.spec.size,u={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:O,onClick:()=>{i(false),r(s.size);}},m=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"docx-table-line docx-table-line--single",style:{height:`${s.previewThickness}px`},"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:l(s.labelKey)})]});return t?jsxRuntime.jsx(j,{...u,children:m}):jsxRuntime.jsx("button",{...u,children:m})}function tm(e){let{children:t}=e;return jsxRuntime.jsx(pr.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(n=>jsxRuntime.jsx(em,{value:String(n.size)},n.size))})}function ux(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(pr.Trigger,{}),jsxRuntime.jsx(tm,{})]});return jsxRuntime.jsx(pr.Root,{...e,children:t})}var hr=Object.assign(ux,{docxSlot:"table.borderWidth",Trigger:pr.Trigger,Content:tm,Item:em});function om(e,t,n){let o=n?.defaultHex??"FF0000",r=jp();function i({hidden:d,asChild:u,className:m,children:g}){let{visible:p,enabled:f,disabledReason:b,draft:v,apply:P}=ei(e),[y,S]=rt.useState(false),[h,x]=rt.useState(o),T=rt.useRef(null),k=rt.useRef(null);As(y,S,T);let E=rt.useMemo(()=>({open:y,setOpen:S,enabled:f,disabledReason:b,apply:P,draft:v,triggerRef:k,lastHex:h,setLastHex:x}),[y,f,b,P,v,h]);if(d||!p)return null;let w={className:`docx-toolbar__colorsplit docx-table-chrome${m?` ${m}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},D=g??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a,{}),jsxRuntime.jsx(l,{}),jsxRuntime.jsx(c,{clearFill:n?.clearFill??false})]});return jsxRuntime.jsx(r.Provider,{value:E,children:u?jsxRuntime.jsx(j,{...w,ref:T,children:D}):jsxRuntime.jsx("div",{ref:T,...w,children:D})})}function a({asChild:d,className:u,children:m}){let{enabled:g,disabledReason:p,apply:f,draft:b,lastHex:v}=Ht(r),P=X(),y=J(e),S=P(y?.labelKey??t),{shared:h,reasonNode:x}=oi({enabled:g,disabledReason:p,ariaLabel:S}),T=e==="table.borderColor"&&b.spec.color.kind==="hex"?b.spec.color.value:v??o,k={...h,className:`docx-toolbar__button docx-toolbar__colorsplit-main${u?` ${u}`:""}`,onClick:g?()=>f({kind:"hex",value:T}):void 0},E=m??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[re(y?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:`#${T.toLowerCase()}`},"aria-hidden":"true"})]});return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...k,children:E}),x]}):jsxRuntime.jsxs("button",{...k,children:[E,x]})}a.docxToolbarPart=true;function l({asChild:d,className:u,children:m}){let{open:g,setOpen:p,enabled:f,disabledReason:b,triggerRef:v}=Ht(r),P=X(),y=J(e),S=P(y?.labelKey??t),{shared:h,reasonNode:x}=oi({enabled:f,disabledReason:b,ariaLabel:S}),T={...h,ref:v,className:`docx-toolbar__colorsplit-caret${u?` ${u}`:""}`,"aria-haspopup":"dialog","aria-expanded":g,onClick:f?()=>p(!g):void 0,...d?{tabIndex:f?0:-1,role:"button",onKeyDown:Gp(f,g,p)}:{}},k=m??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...T,children:k}),x]}):jsxRuntime.jsxs("button",{...T,children:[k,x]})}l.docxToolbarPart=true;function c({asChild:d,className:u,children:m,clearFill:g}){let{open:p,setOpen:f,enabled:b,apply:v,draft:P,triggerRef:y,lastHex:S,setLastHex:h}=Ht(r),x=X(),T=rt.useRef(null);if(zp(p&&b,f,T,y),!p||!b)return null;let k=x(t),E=e==="table.borderColor"&&P.spec.color.kind==="hex"?P.spec.color.value:S??o,w={ref:T,role:"dialog","aria-label":k,className:`docx-toolbar__swatch-popup docx-table-chrome__panel${u?` ${u}`:""}`,onMouseDown:O},D=m??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g?jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:O,onClick:()=>{f(false),v(null),ti(y.current);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-clear-chip docx-toolbar__swatch-clear-chip--none","aria-hidden":"true"}),x("table.clearCellFill")]}):null,jsxRuntime.jsx(gs,{apply:F=>{f(false),h?.(F),v({kind:"hex",value:F}),ti(y.current);},current:E})]});return d?jsxRuntime.jsx(j,{...w,children:D}):jsxRuntime.jsx("div",{...w,children:D})}function s({value:d,css:u,labelKey:m,asChild:g,className:p,children:f}){let{apply:b,setOpen:v,setLastHex:P,triggerRef:y}=Ht(r),S=X(),h=u??`#${d.toLowerCase()}`,x=m?S(m):d,T={type:"button",className:`docx-toolbar__swatch docx-table-chrome__swatch${p?` ${p}`:""}`,style:{backgroundColor:h},"data-value":d,"aria-label":x,title:x,onMouseDown:O,onClick:()=>{v(false),P?.(d),b({kind:"hex",value:d}),ti(y.current);}};return g?jsxRuntime.jsx(j,{...T,children:f}):jsxRuntime.jsx("button",{...T,children:f})}return {Root:i,Main:a,Trigger:l,Content:c,Item:s,Ctx:r}}var mr=om("table.borderColor","table.borderColor",{defaultHex:"000000"});function px(e){return jsxRuntime.jsx(mr.Content,{...e,clearFill:false})}function mx(e){return jsxRuntime.jsx(mr.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function fx(e){return jsxRuntime.jsx(mr.Root,{...e})}var vr=Object.assign(fx,{docxSlot:"table.borderColor",Trigger:mr.Trigger,Content:px,Item:mx,Main:mr.Main}),fr=om("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function gx(e){return jsxRuntime.jsx(fr.Content,{...e,clearFill:true})}function bx(e){return jsxRuntime.jsx(fr.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function hx(e){return jsxRuntime.jsx(fr.Root,{...e})}var yr=Object.assign(hx,{docxSlot:"table.cellFill",Trigger:fr.Trigger,Content:gx,Item:bx,Main:fr.Main});function nm({overrides:e=new Map}){return qp()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(an,{}),[gr,vr,br,hr,yr].map(o=>{let r=e.get(o.docxSlot);return r?jsxRuntime.jsx(rt.Fragment,{children:r},o.docxSlot):jsxRuntime.jsx(o,{},o.docxSlot)})]}):null}function rm(){let e=X(),{draft:t}=ei("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var sm=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],cm={"zoom.level":us,"styles.style":Ms,"font.family":Cs,"font.size":ds,"text.color":bs,"text.highlight":hs,"text.link":as,"list.lineSpacing":ms,"review.editingMode":Ma,"file.save":is,...Lp,"table.borderTarget":gr,"table.borderColor":vr,"table.borderStyle":br,"table.borderWidth":hr,"table.cellFill":yr,"image.insert":Hn,"image.properties":rn,"image.wrap":tr,"image.altText":or},im=new Map;function xx(e){let t=im.get(e);return t||(t=n=>jsxRuntime.jsx(go,{slot:e,...n}),im.set(e,t)),t}function Sx(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:Ua}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(n=>{let o=editor.chromeSlotId(t,n);return {slot:o,Part:cm[o]??xx(o)}})})}var Tx=e=>e.image;function Cx(e){return e==="alignment"||e in cm}function qs(e){let t=tn(e,qs);if(t!==null)return t;if(!rt.isValidElement(e))return null;let n=e.type;if(typeof n!="function"&&typeof n!="object")return null;if(typeof n.docxSlot=="string")return n.docxSlot;if(n.docxToolbarPart===true){let o=e.props.slot;if(typeof o=="string")return o}return null}function Bs(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(Bs);let t=qs(e);return t!=null&&sm.includes(t)?true:rt.isValidElement(e)?rt.Children.toArray(e.props.children).some(Bs):false}function Px(e,t){return t?true:rt.Children.toArray(e).some(Bs)}function Ex(e){let t=ot(),{className:n,t:o,onSave:r,preset:i=true,overflow:a=true,children:l}=e,c=rt.useMemo(()=>({t:o,onSave:r}),[o,r]),s=ua(o),d=q(Tx),u=rt.useMemo(()=>Sx(d),[d]),m=rt.useMemo(()=>new Set(u.flatMap(y=>y.entries.map(S=>S.slot))),[u]),g=rt.useMemo(()=>u.map(y=>y.id).filter(y=>!Vl.has(y)),[u]),p=rt.useMemo(()=>vu(g),[g]),f=i&&a,{attach:b,overflow:v}=Ru(f,g,p),P;if(!i)P=l;else {let y=rt.Children.toArray(l),S=new Map,h=new Map,x=[];for(let D of y){let F=qs(D);F&&m.has(F)?S.set(F,D):F&&sm.includes(F)?h.set(F,D):x.push(D);}let T=D=>{let F=S.get(D.slot);if(F)return F;let A=D.Part;return jsxRuntime.jsx(A,{})},k=[],E=[],w=0;for(let D of u){if(v.has(D.id)){let A=D.entries.flatMap(I=>{let N=kx(I,S,s,D.labelKey,T);return N===null?[]:[jsxRuntime.jsx(rt.Fragment,{children:N},I.slot)]});if(A.length===0)continue;E.push({id:D.id,labelKey:D.labelKey,children:A});continue}w>0&&k.push(jsxRuntime.jsx(an,{},`separator-${D.id}`)),w+=1;let F=Vl.has(D.id);k.push(jsxRuntime.jsx("div",{className:"docx-toolbar__group",...F?{[Qn]:""}:{[Jn]:D.id},children:D.entries.map(A=>jsxRuntime.jsx(rt.Fragment,{children:T(A)},A.slot))},D.id));}P=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[k,jsxRuntime.jsx(nm,{overrides:h}),x.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[Qn]:"",children:x}):null,E.length>0?jsxRuntime.jsx(Nu,{sections:E}):null]});}return jsxRuntime.jsx(fo.Provider,{value:c,children:jsxRuntime.jsx(fu,{children:jsxRuntime.jsx("div",{ref:b,role:"toolbar","data-testid":"docx-toolbar",className:`${t}docx-toolbar${n?` ${n}`:""}`,...f?{"data-overflow":""}:{},onMouseDown:O,children:Px(l,i)?jsxRuntime.jsx(Ns,{children:P}):P})})})}function wx(e){return e?!!e.props.hidden:false}function kx(e,t,n,o,r){let i=t.get(e.slot);return wx(i)?null:i||Cx(e.slot)?jsxRuntime.jsx(_u,{label:Rx(n,e,o),children:r(e)}):jsxRuntime.jsx(Du,{slot:e.slot})}function Rx(e,t,n){let o=t.slot==="alignment"?null:J(t.slot);return e(o?.labelKey??n)}var Sr=Object.assign(Ex,{Button:go,Action:ys,Separator:an,Undo:Ku,Redo:zu,Bold:$u,Italic:Vu,Underline:Uu,Strike:Wu,Link:as,ClearFormatting:Gu,Superscript:ju,Subscript:Yu,Alignment:Ua,AlignLeft:Xu,AlignCenter:Ju,AlignRight:Qu,AlignJustify:ep,LineSpacing:ms,BulletList:tp,NumberedList:op,Outdent:np,Indent:rp,ImageInsert:Hn,ImageProperties:rn,ImageWrap:tr,ImageAltText:or,TableInsert:ap,TableBorderTarget:gr,TableBorderColor:vr,TableBorderStyle:br,TableBorderWidth:hr,TableCellFill:yr,Comments:ip,FontFamily:Cs,FontSize:ds,FontColor:bs,Highlight:hs,Zoom:us,StylePicker:Ms,EditingMode:Ma,Save:is,ContentControlShowAll:ja,ContentControlFormFill:Ya,ContentControlInspector:Ja,ContentControlRemove:Xa});var Dx=e=>e.pageSetup??null,Nx=e=>e.editable;function Po(){let e=H(),t=q(Dx),n=q(Nx),o=rt.useMemo(()=>n&&e!==null&&e.can({type:"setPageSetup",marginTop:0}).ok,[e,n]),r=rt.useCallback(i=>e?e.exec({...i.pageWidthTwips!==void 0?{pageWidth:i.pageWidthTwips}:{},...i.pageHeightTwips!==void 0?{pageHeight:i.pageHeightTwips}:{},...i.orientation!==void 0?{orientation:i.orientation}:{},...i.marginTopTwips!==void 0?{marginTop:i.marginTopTwips}:{},...i.marginRightTwips!==void 0?{marginRight:i.marginRightTwips}:{},...i.marginBottomTwips!==void 0?{marginBottom:i.marginBottomTwips}:{},...i.marginLeftTwips!==void 0?{marginLeft:i.marginLeftTwips}:{},...i.scope!==void 0?{scope:i.scope}:{},type:"setPageSetup"}).ok:false,[e]);return rt.useMemo(()=>({pageSetup:t,isEnabled:o,apply:r}),[t,o,r])}var zs=[{labelKey:"dialogs.pageSetup.pageSizes.letter",width:12240,height:15840},{labelKey:"dialogs.pageSetup.pageSizes.a4",width:11906,height:16838},{labelKey:"dialogs.pageSetup.pageSizes.legal",width:12240,height:20160},{labelKey:"dialogs.pageSetup.pageSizes.a3",width:16838,height:23811},{labelKey:"dialogs.pageSetup.pageSizes.a5",width:8391,height:11906},{labelKey:"dialogs.pageSetup.pageSizes.b5",width:9979,height:14175},{labelKey:"dialogs.pageSetup.pageSizes.executive",width:10440,height:15120}],hm=1440,Lx=e=>Math.round(e/hm*100)/100,Fx=e=>Math.round(e*hm);function Ax(e,t){let n=Math.min(e,t),o=Math.max(e,t);return zs.findIndex(r=>Math.abs(r.width-n)<20&&Math.abs(r.height-o)<20)}var Hx={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Ox={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},Bx={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600,color:"var(--doc-text)"},Zx={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},mm={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},ni={display:"flex",alignItems:"center",gap:12},ri={width:80,fontSize:13,color:"var(--doc-text-muted)"},ai={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13,backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},qx={fontSize:11,color:"var(--doc-text-muted)",width:16},Kx={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},fm={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},gm=12240,bm=15840,jt=1440;function Tr({open:e,onClose:t,className:n}){let{t:o}=_(),{pageSetup:r,isEnabled:i,apply:a}=Po(),[l,c]=rt.useState(gm),[s,d]=rt.useState(bm),[u,m]=rt.useState("portrait"),[g,p]=rt.useState(jt),[f,b]=rt.useState(jt),[v,P]=rt.useState(jt),[y,S]=rt.useState(jt),[h,x]=rt.useState("document"),T=rt.useRef(null),k=rt.useRef("no");rt.useEffect(()=>{if(!e){k.current="no";return}if(k.current==="yes"&&r===null){k.current="no";return}k.current==="yes"||k.current==="loading"&&r===null||(c(r?.pageWidthTwips??gm),d(r?.pageHeightTwips??bm),m(r?.orientation??"portrait"),p(r?.marginsTwips.top??jt),b(r?.marginsTwips.bottom??jt),P(r?.marginsTwips.left??jt),S(r?.marginsTwips.right??jt),x("document"),k.current=r===null?"loading":"yes");},[e,r]),rt.useEffect(()=>{e&&T.current?.focus();},[e]);let E=rt.useCallback(I=>{let N=zs[I];N&&(c(u==="landscape"?N.height:N.width),d(u==="landscape"?N.width:N.height));},[u]),w=rt.useCallback(I=>{I!==u&&(m(I),c(s),d(l));},[u,l,s]),D=rt.useCallback(()=>{a({pageWidthTwips:l,pageHeightTwips:s,orientation:u,marginTopTwips:g,marginRightTwips:y,marginBottomTwips:f,marginLeftTwips:v,scope:h})&&t();},[a,l,s,u,g,y,f,v,h,t]);if(!e)return null;let F=Ax(l,s),A=(I,N,R)=>jsxRuntime.jsxs("div",{style:ni,children:[jsxRuntime.jsx("label",{style:ri,children:o(`dialogs.pageSetup.${I}`)}),jsxRuntime.jsx("input",{type:"number",style:ai,min:0,max:22,step:.1,value:Lx(N),onChange:M=>R(Math.max(0,Fx(Number(M.target.value)||0))),"aria-label":o(`dialogs.pageSetup.${I}`)}),jsxRuntime.jsx("span",{style:qx,children:"in"})]});return jsxRuntime.jsx("div",{className:n,style:Hx,onClick:t,onKeyDown:I=>{I.key==="Escape"&&t(),I.key==="Enter"&&D();},children:jsxRuntime.jsxs("div",{ref:T,tabIndex:-1,style:Ox,onClick:I=>I.stopPropagation(),onMouseDown:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o("dialogs.pageSetup.title"),children:[jsxRuntime.jsx("div",{style:Bx,children:o("dialogs.pageSetup.title")}),jsxRuntime.jsxs("div",{style:Zx,children:[jsxRuntime.jsx("div",{style:mm,children:o("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{style:ni,children:[jsxRuntime.jsx("label",{style:ri,children:o("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{style:ai,value:F,onChange:I=>E(Number(I.target.value)),"aria-label":o("dialogs.pageSetup.sizeLabel"),children:[zs.map((I,N)=>jsxRuntime.jsx("option",{value:N,children:o(I.labelKey)},I.labelKey)),F<0&&jsxRuntime.jsx("option",{value:-1,children:o("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{style:ni,children:[jsxRuntime.jsx("label",{style:ri,children:o("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{style:ai,value:u,onChange:I=>w(I.target.value),"aria-label":o("dialogs.pageSetup.orientation"),children:[jsxRuntime.jsx("option",{value:"portrait",children:o("dialogs.pageSetup.portrait")}),jsxRuntime.jsx("option",{value:"landscape",children:o("dialogs.pageSetup.landscape")})]})]}),jsxRuntime.jsx("div",{style:{...mm,marginTop:4},children:o("dialogs.pageSetup.margins")}),A("top",g,p),A("bottom",f,b),A("left",v,P),A("right",y,S),jsxRuntime.jsxs("div",{style:ni,children:[jsxRuntime.jsx("label",{style:ri,children:o("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{style:ai,value:h,onChange:I=>x(I.target.value),"aria-label":o("dialogs.pageSetup.applyTo"),children:[jsxRuntime.jsx("option",{value:"document",children:o("dialogs.pageSetup.applyToDocument")}),jsxRuntime.jsx("option",{value:"section",children:o("dialogs.pageSetup.applyToSection")})]})]})]}),jsxRuntime.jsxs("div",{style:Kx,children:[jsxRuntime.jsx("button",{type:"button",style:fm,onClick:t,children:o("common.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...fm,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)",opacity:i?1:.5},disabled:!i,onClick:D,children:o("common.apply")})]})]})})}var Cr=rt.createContext({t:void 0,openMenu:null,setOpenMenu:()=>{},activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onParagraphDialog:void 0,onReportIssue:void 0,reportIssue:void 0});function nt(){return rt.useContext(Cr)}function Fe(){let{t:e}=nt(),{t}=_();return n=>e?.(n)??t(n)}var Vx=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i,Ux=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var vm=new TextEncoder;function Wx(e,t){if(vm.encode(e).length<=t)return e;let n=0,o="";for(let r of e){let i=vm.encode(r).length;if(n+i>t)break;n+=i,o+=r;}return o}function ym(e){let t=Wx((e??"").replace(/\.docx$/i,"").replace(Ux," ").replace(/\s+/g," ").trim().replace(/^[.\s]+/,"").replace(/[.\s]+$/,""),200).trim();return !t||Vx.test(t)?"document.docx":`${t}.docx`}function xm(e,t){let n=URL.createObjectURL(new Blob([e],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})),o=document.createElement("a");o.href=n,o.download=t,o.click(),setTimeout(()=>URL.revokeObjectURL(n),0);}var Gx="https://github.com/eigenpal/docx-editor/issues/new";function jx(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function Sm(e={}){let t=e.userAgent??(typeof navigator<"u"?navigator.userAgent:"unknown"),n=e.viewport??(typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0}),r=["### What happened","","### Steps to reproduce","1. ","2. ","3. ","","### Expected","","### Actual","","### Attach the DOCX","Please drag the `.docx` file that reproduces this onto the issue (below this text box). Bugs are much faster to fix with a real file.","","### Environment",`- URL: ${e.pageUrl??jx()}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${t}`,""].join(`
2
+ `),i=new URLSearchParams({title:"[Bug] ",body:r});return `${Gx}?${i.toString()}`}function Pr(e){typeof window>"u"||window.open(Sm(e),"_blank","noopener,noreferrer");}var $s=6,Cm=6;function Be(e){let{icon:t,shortcut:n,disabled:o,title:r,active:i,selected:a,slot:l,onSelect:c,className:s,children:d}=e,u=rt.useId(),m=o&&r?u:void 0;return jsxRuntime.jsxs("button",{type:"button",role:i===void 0?"menuitem":a===void 0?"menuitemcheckbox":"menuitemradio",className:`docx-toolbar__menu-item docx-menubar__item${s?` ${s}`:""}`,tabIndex:-1,...l?{"data-slot":l}:{},...i?{"data-active":""}:{},...o?{"data-disabled":"","aria-disabled":true}:{},...i!==void 0?{"aria-checked":i}:{},...m?{"aria-describedby":m}:{},...r?{title:r}:{},onMouseDown:O,onClick:o?void 0:c,children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:t}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),n?jsxRuntime.jsx("span",{className:"docx-menubar__item-shortcut",children:n}):null,m?jsxRuntime.jsx("span",{id:u,className:"docx-editor-sr-only",children:r}):null]})}function wr({label:e,labelKey:t,className:n,hidden:o,children:r}){let i=Fe();if(o)return null;let a=e??(t===void 0?void 0:i(t));return jsxRuntime.jsxs("div",{role:"group",className:`docx-menubar__group${n?` ${n}`:""}`,...a?{"aria-label":a}:{},children:[a?jsxRuntime.jsx("div",{className:"docx-menubar__group-label","aria-hidden":"true",children:a}):null,r]})}function Ot({slot:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let{execute:i,isActive:a,isEnabled:l,disabledReason:c}=le(e),{setOpenMenu:s}=nt(),d=Fe();if(r)return null;let u=J(e),m=d(t??u?.labelKey??e),g=editor.commandForSlot(e),p=g?.type==="toggleMark"||g?.type==="setAlignment",f=g?.type==="setAlignment";return jsxRuntime.jsx(Be,{slot:e,icon:re(u?.paths),...n?{shortcut:d(n)}:{},disabled:!l,...c?{title:c}:{},...p?{active:a}:{},...f?{selected:true}:{},onSelect:()=>{i(),s(null);},...o?{className:o}:{},children:m})}Ot.docxMenuRow=true;function Em(e,t,n,o){return Object.assign(({className:i,hidden:a})=>{let l=nt(),c=Fe(),s=o(l);if(a)return null;let d=J(e),u=c(t??d?.labelKey??e);return jsxRuntime.jsx(Be,{slot:e,icon:re(d?.paths),...n?{shortcut:c(n)}:{},disabled:!s,onSelect:()=>{s?.(),l.setOpenMenu(null);},...i?{className:i}:{},children:u})},{docxSlot:e})}var Us=Em("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),Ws=Em("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave);function eS({className:e,hidden:t}){let n=H(),o=nt(),r=Fe(),i=editor.chromeProbeForSlot("file.pageSetup"),a=n&&i?n.can(i):null,l=a?.ok===true,c=a&&!a.ok?a.reason:null;if(t)return null;let s=J("file.pageSetup"),d=r(s?.labelKey??"file.pageSetup"),u=l&&!!o.onPageSetup;return jsxRuntime.jsx(Be,{slot:"file.pageSetup",icon:re(s?.paths),disabled:!u,...c?{title:c}:{},onSelect:()=>{o.onPageSetup?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}function tS({className:e,hidden:t}){let n=H(),o=nt(),r=Fe(),i=editor.chromeProbeForSlot("paragraph.dialog"),a=n&&i?n.can(i):null,l=a?.ok===true,c=a&&!a.ok?a.reason:null;if(t)return null;let s=J("paragraph.dialog"),d=r(s?.labelKey??"lineSpacing.options"),u=l&&!!o.onParagraphDialog;return jsxRuntime.jsx(Be,{slot:"paragraph.dialog",icon:re(s?.paths),disabled:!u,...c?{title:c}:{},onSelect:()=>{o.onParagraphDialog?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}var oS=Object.assign(tS,{docxSlot:"paragraph.dialog"}),Gs=Object.assign(eS,{docxSlot:"file.pageSetup"});function nS({className:e,hidden:t}){let{openFilePicker:n,isEnabled:o,disabledReason:r}=ma(),i=nt(),a=Fe();if(t)return null;let l=J("image.insert"),c=a(l?.labelKey??"toolbar.image");return jsxRuntime.jsx(Be,{slot:"image.insert",icon:re(l?.paths),disabled:!o,...r?{title:r}:{},onSelect:()=>{n(),i.setOpenMenu(null);},...e?{className:e}:{},children:c})}var rS=Object.assign(nS,{docxSlot:"image.insert"}),Er=8;function wo({labelKey:e,paths:t,className:n,children:o}){let r=Fe(),[i,a]=rt.useState(false),l=rt.useRef(null),c=rt.useRef(null),s=rt.useId(),d=r(e),[u,m]=rt.useState(null);return rt.useLayoutEffect(()=>{if(!i){m(null);return}let g=l.current,p=c.current,f=g?.ownerDocument.defaultView;if(!g||!p||!f)return;let b=g.getBoundingClientRect(),v=p.offsetWidth,P=p.offsetHeight,y=b.right+v>f.innerWidth-Er;m({left:y?Math.max(Er,b.left-v):Math.min(b.right,f.innerWidth-v-Er),top:Math.max(Er,Math.min(b.top-4,f.innerHeight-P-Er))});},[i]),jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__submenu${n?` ${n}`:""}`,onMouseEnter:()=>a(true),onMouseLeave:()=>a(false),onKeyDown:g=>{g.key==="ArrowRight"&&document.activeElement===l.current?(g.preventDefault(),a(true),queueMicrotask(()=>{c.current&&yt(Co(c.current),"first");})):(g.key==="ArrowLeft"||g.key==="Escape")&&i&&(g.preventDefault(),g.stopPropagation(),a(false),l.current?.focus());},onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||a(false);},children:[jsxRuntime.jsxs("button",{ref:l,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?s:void 0,className:"docx-toolbar__menu-item docx-menubar__item",tabIndex:-1,...i?{"data-open":""}:{},onMouseDown:O,onFocus:()=>a(true),onClick:()=>a(true),children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:re(t)}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),jsxRuntime.jsx("span",{className:"docx-menubar__item-caret","aria-hidden":"true",children:"\u203A"})]}),i?jsxRuntime.jsx("div",{ref:c,id:s,className:"docx-toolbar__menu docx-menubar__menu docx-menubar__submenu-panel",role:"menu","aria-label":d,style:u?{position:"fixed",left:u.left,top:u.top}:{position:"fixed",visibility:"hidden"},onKeyDown:g=>{let p=c.current;if(!p)return;let f=Co(p);g.key==="ArrowDown"?(g.preventDefault(),g.stopPropagation(),vt(f,document.activeElement,1)):g.key==="ArrowUp"&&(g.preventDefault(),g.stopPropagation(),vt(f,document.activeElement,-1));},children:o}):null]})}function li({slot:e="table.insert",className:t}){let n=H(),{isEnabled:o}=le(e),{setOpenMenu:r}=nt(),i=Fe(),[a,l]=rt.useState(null),[c,s]=rt.useState({rows:1,cols:1}),d=rt.useRef(null),u=rt.useCallback((p,f)=>{if(!n||!o)return;let b={type:"insertTable",rows:p,cols:f};n.can(b).ok&&(n.exec(b),r(null),n.focus());},[n,o,r]),m=rt.useCallback(p=>{s(f=>{let b={rows:Math.min(Cm,Math.max(1,f.rows+(p.rows??0))),cols:Math.min($s,Math.max(1,p.toCol??f.cols+(p.cols??0)))};return l(b),queueMicrotask(()=>d.current?.querySelector(`[data-cell="${b.rows}x${b.cols}"]`)?.focus()),b});},[]),g=[];for(let p=1;p<=Cm;p+=1){let f=[];for(let b=1;b<=$s;b+=1){let v=!!a&&p<=a.rows&&b<=a.cols;f.push(jsxRuntime.jsx("button",{type:"button",role:"gridcell","data-cell":`${p}x${b}`,className:"docx-menubar__grid-cell",tabIndex:c.rows===p&&c.cols===b?0:-1,...v?{"data-filled":""}:{},"aria-label":`${b} \xD7 ${p}`,onMouseDown:O,onMouseEnter:()=>l({rows:p,cols:b}),onFocus:()=>l({rows:p,cols:b}),onClick:()=>u(p,b)},b));}g.push(jsxRuntime.jsx("div",{role:"row",className:"docx-menubar__grid-row",children:f},p));}return jsxRuntime.jsxs("div",{ref:d,role:"grid","aria-label":i("toolbar.insertTable"),className:`docx-menubar__grid${t?` ${t}`:""}`,onMouseLeave:()=>l(null),onKeyDown:p=>{if(p.key==="ArrowRight")m({cols:1});else if(p.key==="ArrowLeft")m({cols:-1});else if(p.key==="ArrowDown")m({rows:1});else if(p.key==="ArrowUp")m({rows:-1});else if(p.key==="Home")m({toCol:1});else if(p.key==="End")m({toCol:$s});else return;p.preventDefault(),p.stopPropagation();},children:[jsxRuntime.jsx("div",{className:"docx-menubar__grid-cells",children:g}),jsxRuntime.jsx("div",{className:"docx-menubar__grid-caption","aria-hidden":"true",children:a?`${a.cols} \xD7 ${a.rows}`:""})]})}function aS({entry:e}){let{isEnabled:t}=le(e.slot),n=J(e.slot);return t?jsxRuntime.jsx(wo,{labelKey:e.labelKey??n?.labelKey??e.slot,paths:n?.paths,children:jsxRuntime.jsx(li,{slot:e.slot})}):jsxRuntime.jsx(Ot,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function ko({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function kr({entry:e}){return e.kind==="separator"?jsxRuntime.jsx(ko,{}):e.kind==="submenu"?jsxRuntime.jsx(wo,{labelKey:e.labelKey,paths:e.paths,children:e.items.map((t,n)=>jsxRuntime.jsx(kr,{entry:t},n))}):e.slot==="file.open"?jsxRuntime.jsx(Us,{}):e.slot==="file.save"?jsxRuntime.jsx(Ws,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(Gs,{}):e.slot==="paragraph.dialog"?jsxRuntime.jsx(oS,{}):e.slot==="image.insert"?jsxRuntime.jsx(rS,{}):e.picker==="tableGrid"?jsxRuntime.jsx(aS,{entry:e}):jsxRuntime.jsx(Ot,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function wm(e){if(!rt.isValidElement(e))return null;let t=tn(e,wm);if(t!==null)return t;let n=e.type;if(typeof n!="function"&&typeof n!="object")return null;if(typeof n.docxSlot=="string")return n.docxSlot;if(n.docxMenuRow===true){let o=e.props.slot;if(typeof o=="string")return o}return null}function iS(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function lS(e,t,n){return _a({entries:e??[],children:t,preset:n,keyOfEntry:iS,keyOfChild:wm,renderEntry:o=>jsxRuntime.jsx(kr,{entry:o})})}function dn({id:e,labelKey:t,label:n,icon:o,className:r,hidden:i,preset:a=true,children:l}){let{openMenu:c,setOpenMenu:s,activeMenu:d}=nt(),u=Fe(),m=rt.useId(),g=rt.useRef(null),p=rt.useRef(null),f=rt.useRef(false),b=rt.useRef(false),v=editor.CHROME_MENUS.find(x=>x.id===e),P=c===e;if(i)return null;let y=n??u(t??v?.labelKey??e),S=lS(v?.entries,l,a),h=()=>{s(null),g.current?.focus();};return jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__menu-root${r?` ${r}`:""}`,"data-menu":e,children:[jsxRuntime.jsxs("button",{ref:g,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":P,"aria-controls":P?m:void 0,className:"docx-menubar__trigger",tabIndex:d===e?0:-1,...P?{"data-open":""}:{},onMouseDown:O,onKeyDown:x=>{x.key==="ArrowDown"||x.key==="Enter"||x.key===" "||x.key==="ArrowUp"?(x.preventDefault(),f.current=true,s(e)):x.key==="Escape"&&P&&(x.preventDefault(),h());},onClick:()=>{if(b.current){b.current=false;return}s(P?null:e);},onMouseEnter:()=>{c!==null&&c!==e&&(b.current=true,s(e));},onMouseLeave:()=>{b.current=false;},children:[o?jsxRuntime.jsx("span",{className:"docx-menubar__trigger-icon","aria-hidden":"true",children:o}):null,y]}),P?jsxRuntime.jsx("div",{ref:x=>{p.current=x,x&&f.current&&(f.current=false,yt(Co(x),"first"));},id:m,role:"menu","aria-label":y,className:"docx-toolbar__menu docx-menubar__menu",onKeyDown:x=>{let T=p.current;if(!T)return;let k=Co(T),E=document.activeElement;x.key==="ArrowDown"?(x.preventDefault(),vt(k,E,1)):x.key==="ArrowUp"?(x.preventDefault(),vt(k,E,-1)):x.key==="Home"?(x.preventDefault(),yt(k,"first")):x.key==="End"?(x.preventDefault(),yt(k,"last")):x.key==="Escape"?(x.preventDefault(),x.stopPropagation(),h()):x.key==="Tab"&&s(null);},children:S}):null]})}function js(e){return Object.assign(n=>jsxRuntime.jsx(dn,{id:e,...n}),{docxMenu:e})}var Ys=js("file"),Xs=js("format"),Js=js("insert");function sS({className:e,hidden:t,onSelect:n}){let{setOpenMenu:o,onReportIssue:r,reportIssue:i}=nt(),a=Fe();if(t||i===false)return null;let l=n??r??Pr;return jsxRuntime.jsx(Be,{slot:"help.reportIssue",onSelect:()=>{l(),o(null);},...e?{className:e}:{},children:a("toolbar.reportIssue")})}var si=Object.assign(sS,{docxSlot:"help.reportIssue"});function cS({children:e,...t}){let{reportIssue:n}=nt();return e===void 0&&n===false?null:jsxRuntime.jsxs(dn,{id:"help",...t,children:[jsxRuntime.jsx(si,{}),e]})}var Qs=Object.assign(cS,{docxMenu:"help"});var pS={file:Ys,format:Xs,insert:Js,help:Qs},mS=new Set(editor.CHROME_MENUS.map(e=>e.id));function Nm(e){if(!rt.isValidElement(e))return null;if(e.type===rt.Fragment){let o=rt.Children.toArray(e.props.children).map(Nm).filter(r=>r!==null);return o.length===1?o[0]:null}let t=e.type;if((typeof t=="function"||typeof t=="object")&&typeof t.docxMenu=="string")return t.docxMenu;if(e.type===dn){let n=e.props.id;if(typeof n=="string"&&mS.has(n))return n}return null}function fS(e){let t=ot(),{className:n,t:o,fileName:r,onOpen:i,onOpenFile:a,onSave:l,onPageSetup:c,onReportIssue:s,reportIssue:d,preset:u=true,children:m}=e,g=H(),{t:p}=_(),[f,b]=rt.useState(null),[v,P]=rt.useState(null),[y,S]=rt.useState(null),[h,x]=rt.useState(false),[T,k]=rt.useState(false),E=rt.useRef(null),w=rt.useRef(null);rt.useEffect(()=>{if(f===null)return;let $=oe=>{let ne=E.current;ne&&oe.target instanceof Node&&ne.contains(oe.target)||b(null);},V=oe=>{oe.key==="Escape"&&b(null);};return document.addEventListener("mousedown",$),document.addEventListener("keydown",V),()=>{document.removeEventListener("mousedown",$),document.removeEventListener("keydown",V);}},[f]);let D=rt.useCallback($=>{b($),$!==null&&S($);},[]),F=rt.useCallback(()=>w.current?.click(),[]),A=rt.useCallback(()=>{g&&g.save().then($=>xm($,ym(r??v??void 0))).catch($=>{console.error("[docx-editor] save failed",$);});},[g,r,v]),I=rt.useCallback(()=>x(true),[]),N=g?i??F:void 0,R=g?l??A:void 0,M=g?c??I:void 0;rt.useEffect(()=>{let $=V=>{if(!(V.metaKey||V.ctrlKey)||V.altKey||V.shiftKey)return;let oe=V.key.toLowerCase();if(oe!=="s"&&oe!=="o")return;let ne=V.target,be=ln(E.current)??E.current;!ne||!be?.contains(ne)||(oe==="s"&&R?(V.preventDefault(),R()):oe==="o"&&N&&(V.preventDefault(),N()));};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[N,R]);let ae=rt.useMemo(()=>({t:o,openMenu:f,setOpenMenu:D,activeMenu:y,onOpen:N,onSave:R,onPageSetup:M,onParagraphDialog:()=>k(true),onReportIssue:s,reportIssue:d}),[o,f,D,y,N,R,M,s,d]),z;if(!u)z=m;else {let $=new Map,V=[];for(let oe of rt.Children.toArray(m)){let ne=Nm(oe);ne?$.set(ne,oe):V.push(oe);}z=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[editor.CHROME_MENUS.map(oe=>{let ne=$.get(oe.id);if(ne)return jsxRuntime.jsx(rt.Fragment,{children:ne},oe.id);let be=pS[oe.id];return jsxRuntime.jsx(be,{},oe.id)}),V]});}return jsxRuntime.jsxs(Cr.Provider,{value:ae,children:[jsxRuntime.jsx("div",{ref:$=>{if(E.current=$,$&&y===null){let V=Ls($)[0]?.closest("[data-menu]")?.getAttribute("data-menu");V&&S(V);}},role:"menubar","aria-label":o?.("titleBar.menuBarAriaLabel")??p("titleBar.menuBarAriaLabel"),"data-testid":"docx-menubar",className:`${t}docx-menubar${n?` ${n}`:""}`,onMouseDown:O,onKeyDown:$=>{if($.key!=="ArrowLeft"&&$.key!=="ArrowRight")return;let V=E.current;if(!V)return;let oe=Ls(V),ne=oe.indexOf(document.activeElement);if(ne===-1)return;$.preventDefault();let be=$.key==="ArrowRight"?1:-1,he=oe[(ne+be+oe.length)%oe.length],W=he?.closest("[data-menu]")?.getAttribute("data-menu");W&&(S(W),he?.focus(),f!==null&&b(W));},children:z}),jsxRuntime.jsx("input",{ref:w,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:$=>{let V=$.target.files?.[0];$.target.value="",!(!V||!g)&&(P(V.name),a?.(V),V.arrayBuffer().then(oe=>g.load(new Uint8Array(oe))).catch(oe=>{console.error("[docx-editor] could not open the file",oe);}));}}),jsxRuntime.jsx(Tr,{open:h,onClose:()=>x(false)}),jsxRuntime.jsx(So,{open:T,onClose:()=>k(false)})]})}var Mr=Object.assign(fS,{Menu:dn,File:Ys,Format:Xs,Insert:Js,Help:Qs,Item:Ot,Row:Be,Group:wr,Separator:ko,Submenu:wo,TableGrid:li,Entry:kr,Open:Us,Save:Ws,PageSetup:Gs,ReportIssue:si});var yS=12240,Am=1440,Bm=1440,Zm=567,Ro=20,tc=6,xS=Ro+tc+2,SS="var(--doc-text-muted)",TS="var(--doc-text-subtle)",Hm="var(--doc-shadow-subtle)",CS="var(--doc-primary)",PS="var(--doc-primary-hover)",ES="var(--doc-text-subtle)",_r=5,Ir=7,wS={left:0,right:0,firstLine:0};function Om(e,t){return t==="inch"?(e/Bm).toFixed(2)+'"':(e/Zm).toFixed(1)+" cm"}function kS(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function Mo({pageSetup:e,zoom:t=1,editable:n=false,onLeftMarginChange:o,onRightMarginChange:r,onMarginDragEnd:i,showIndentHandles:a=false,indent:l,indentEditable:c=false,onIndentChange:s,onIndentDragEnd:d,unit:u="inch",className:m="",style:g,tabMarks:p,onTabMarkRemove:f}){let{t:b}=_(),[v,P]=rt.useState(null),[y,S]=rt.useState(null),[h,x]=rt.useState(null),[T,k]=rt.useState(null),E=rt.useRef(null),w=e?.pageWidthTwips??yS,D=e?.marginsTwips.left??Am,F=e?.marginsTwips.right??Am,A=e?.gutterTwips??0,I={pageWidth:w,leftMargin:D,rightMargin:F},N=l??wS,R=_e(w)*t,M=_e(D)*t,ae=_e(F)*t,z=rt.useCallback(B=>{let Ee=E.current?.getBoundingClientRect();return Ee?Pa((B-Ee.left)/t):null},[t]),$=rt.useCallback((B,Ee,ce)=>{let de=z(Ee);if(de===null)return;if(k(_e(de)*t),B==="leftMargin"||B==="rightMargin"){if(B==="leftMargin"){let uo=w-F-A-720,mt=Math.round(Math.max(0,Math.min(de,uo)));x(mt),o?.(mt);}else {let uo=w-de,mt=w-D-A-720,po=Math.round(Math.max(0,Math.min(uo,mt)));x(po),r?.(po);}return}let Ve=editor.dragIndent(B,de,N,I,{unit:u,precise:ce});x(B==="right"?Ve.right:B==="firstLine"?Ve.firstLine:Ve.left),s?.(Ve);},[z,t,w,D,F,A,o,r,s,N,I,u]),V=rt.useCallback(B=>{B==="leftMargin"||B==="rightMargin"?i?.():d?.(),P(null),x(null),k(null);},[i,d]),oe=rt.useCallback((B,Ee,ce)=>{let de=editor.handlePosition(B,N,I),Ve=editor.dragIndent(B,de+Ee*kS(u,ce),N,I,{unit:u,precise:true});s?.(Ve),d?.();},[N,I,u,s,d]),ne=NS(w,t,u),be=a&&c&&s!==void 0,he=B=>_e(editor.handlePosition(B,N,I))*t,W=(B,Ee,ce)=>({positionPx:he(B),editable:be,isDragging:v===B,isHovered:y===B,onPointerEnter:()=>S(B),onPointerLeave:()=>S(null),onPointerDown:de=>{be&&(de.preventDefault(),de.stopPropagation(),de.currentTarget.setPointerCapture(de.pointerId),P(B));},onPointerMove:de=>{v===B&&$(B,de.clientX,de.altKey);},onPointerUp:de=>{v===B&&(de.currentTarget.releasePointerCapture(de.pointerId),V(B));},onKeyDown:de=>{be&&(de.key!=="ArrowLeft"&&de.key!=="ArrowRight"||(de.preventDefault(),oe(B,de.key==="ArrowLeft"?-1:1,de.shiftKey)));},label:b(Ee),valueNow:ce,valueText:Om(ce,u),pageWidthTwips:w});return jsxRuntime.jsxs("div",{ref:E,className:`docx-horizontal-ruler ${m}`,style:{position:"relative",width:Xe(R),height:xS,backgroundColor:"transparent",overflow:"visible",userSelect:"none",touchAction:"none",cursor:v?"ew-resize":"default",flexShrink:0,marginInline:"auto",...g},role:"group","aria-label":b("ruler.horizontal"),children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,width:Xe(M),height:Ro,backgroundColor:Hm,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&o?B=>{B.preventDefault(),B.currentTarget.setPointerCapture(B.pointerId),P("leftMargin");}:void 0,onPointerMove:B=>v==="leftMargin"&&$("leftMargin",B.clientX,B.altKey),onPointerUp:B=>{v==="leftMargin"&&(B.currentTarget.releasePointerCapture(B.pointerId),V("leftMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:Xe(ae),height:Ro,backgroundColor:Hm,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&r?B=>{B.preventDefault(),B.currentTarget.setPointerCapture(B.pointerId),P("rightMargin");}:void 0,onPointerMove:B=>v==="rightMargin"&&$("rightMargin",B.clientX,B.altKey),onPointerUp:B=>{v==="rightMargin"&&(B.currentTarget.releasePointerCapture(B.pointerId),V("rightMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:Ro,pointerEvents:"none"},children:ne.map((B,Ee)=>jsxRuntime.jsx(RS,{tick:B},Ee))}),p?.map(B=>jsxRuntime.jsx(DS,{tabMark:B,positionPx:_e(B.position)*t,onDoubleClick:()=>f?.(B.position)},B.position)),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ec,{direction:"down",anchor:"top",...W("firstLine","ruler.firstLineIndent",N.firstLine)}),jsxRuntime.jsx(ec,{direction:"up",anchor:"strip",...W("hanging","ruler.hangingIndent",N.left)}),jsxRuntime.jsx(MS,{...W("left","ruler.leftIndent",N.left)}),jsxRuntime.jsx(ec,{direction:"up",anchor:"strip",...W("right","ruler.rightIndent",N.right)})]}),v&&h!==null&&T!==null&&jsxRuntime.jsx(IS,{value:Om(h,u),positionPx:T})]})}function RS({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:Xe(e.position),bottom:0,width:1,height:e.height,backgroundColor:TS}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:Xe(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:SS,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function qm(e){return e.editable?e.isDragging||e.isHovered?PS:CS:ES}function Km(e,t,n){return {position:"absolute",left:Xe(e.positionPx-t/2),width:t,cursor:e.editable?"ew-resize":"default",zIndex:e.isDragging?10:4,touchAction:"none",...n}}function zm(e){return {role:"slider","aria-label":e.label,"aria-orientation":"horizontal","aria-valuenow":e.valueNow,"aria-valuemin":-e.pageWidthTwips,"aria-valuemax":e.pageWidthTwips,"aria-valuetext":e.valueText,"aria-disabled":e.editable?void 0:true,tabIndex:e.editable?0:-1}}function ec({direction:e,anchor:t,...n}){let o=qm(n),r=t==="top"?{top:0,height:Ir+1}:{top:Ro-Ir,height:Ir};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:Km(n,_r*2,r),onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,onPointerDown:n.onPointerDown,onPointerMove:n.onPointerMove,onPointerUp:n.onPointerUp,onKeyDown:n.onKeyDown,...zm(n),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${_r}px solid transparent`,borderRight:`${_r}px solid transparent`,...e==="down"?{top:0,borderTop:`${Ir}px solid ${o}`}:{bottom:0,borderBottom:`${Ir}px solid ${o}`},transition:"border-color 0.1s"}})})}function MS(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:Km(e,_r*2,{top:Ro+1,height:tc}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...zm(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:_r*2-2,height:tc,backgroundColor:qm(e),borderRadius:1,transition:"background-color 0.1s"}})})}function IS({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:Xe(t),top:-22,transform:"translateX(-50%)",backgroundColor:"var(--doc-text)",color:"var(--doc-on-primary)",fontSize:"10px",fontFamily:"sans-serif",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap",pointerEvents:"none",zIndex:20},children:e})}var _S={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function DS({tabMark:e,positionPx:t,onDoubleClick:n}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:Xe(t-5),top:Ro-12,width:10,height:12,display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,fontWeight:700,color:"var(--doc-text-muted)",cursor:"pointer",userSelect:"none"},onDoubleClick:o=>{o.stopPropagation(),n();},title:`${e.alignment} tab at ${(e.position/1440).toFixed(2)}"`,children:_S[e.alignment]||"L"})}function NS(e,t,n){let o=[];if(n==="inch"){let r=Bm/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=_e(l)*t;a%8===0?o.push({position:c,height:8,label:a/8>0?String(a/8):void 0}):a%4===0?o.push({position:c,height:5}):a%2===0?o.push({position:c,height:3}):o.push({position:c,height:2});}}else {let r=Zm/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=_e(l)*t;a%10===0?o.push({position:c,height:8,label:a/10>0?String(a/10):void 0}):a%5===0?o.push({position:c,height:5}):o.push({position:c,height:3});}}return o}var AS=15840,Um=1440,HS=1440,OS=567,pn=20,BS="var(--doc-text-muted)",ZS="var(--doc-text-subtle)",qS="var(--doc-primary)",KS="var(--doc-primary)",zS="var(--doc-primary-hover)";function Dr({pageSetup:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,onMarginDragEnd:i,unit:a="inch",className:l="",style:c}){let{t:s}=_(),[d,u]=rt.useState(null),[m,g]=rt.useState(null),p=rt.useRef(null),f=e?.pageHeightTwips??AS,b=e?.marginsTwips.top??Um,v=e?.marginsTwips.bottom??Um,P=_e(f)*t,y=_e(b)*t,S=_e(v)*t,h=rt.useCallback((w,D)=>{n&&(w.preventDefault(),u(D));},[n]),x=rt.useCallback(w=>{if(!d||!p.current)return;let D=p.current.getBoundingClientRect(),F=w.clientY-D.top,A=Pa(F/t);if(d==="topMargin"){let I=f-v-720,N=Math.max(0,Math.min(A,I));o?.(Math.round(N));}else if(d==="bottomMargin"){let I=f-A,N=f-b-720,R=Math.max(0,Math.min(I,N));r?.(Math.round(R));}},[d,t,f,b,v,o,r]),T=rt.useCallback(()=>{d!==null&&i?.(),u(null);},[d,i]);rt.useEffect(()=>{if(d)return document.addEventListener("mousemove",x),document.addEventListener("mouseup",T),()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",T);}},[d,x,T]);let k=VS(f,t,a),E={position:"relative",width:pn,height:Xe(P),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ns-resize":"default",...c};return jsxRuntime.jsxs("div",{ref:p,className:`docx-vertical-ruler ${l}`,style:E,role:"slider","aria-label":s("ruler.vertical"),"aria-orientation":"vertical",children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,pointerEvents:"none"},children:k.map((w,D)=>jsxRuntime.jsx($S,{tick:w},D))}),jsxRuntime.jsx(Wm,{type:"topMargin",position:y,editable:n,isDragging:d==="topMargin",isHovered:m==="topMargin",onMouseEnter:()=>g("topMargin"),onMouseLeave:()=>g(null),onMouseDown:w=>h(w,"topMargin")}),jsxRuntime.jsx(Wm,{type:"bottomMargin",position:P-S,editable:n,isDragging:d==="bottomMargin",isHovered:m==="bottomMargin",onMouseEnter:()=>g("bottomMargin"),onMouseLeave:()=>g(null),onMouseDown:w=>h(w,"bottomMargin")})]})}function $S({tick:e}){let t={position:"absolute",top:Xe(e.position),right:0,height:1,width:e.width,backgroundColor:ZS},n={position:"absolute",top:Xe(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:BS,fontFamily:"sans-serif",whiteSpace:"nowrap"};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:t}),e.label&&jsxRuntime.jsx("div",{style:n,children:e.label})]})}function Wm({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:l}){let{t:c}=_(),s=o?zS:r?KS:qS,d={position:"absolute",top:Xe(t-5),right:0,width:pn,height:10,cursor:n?"ns-resize":"default",zIndex:o?10:1},u={position:"absolute",top:0,right:2,width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderRight:`8px solid ${s}`,transition:"border-right-color 0.1s"};return jsxRuntime.jsx("div",{className:`docx-ruler-marker docx-ruler-marker-${e}`,style:d,onMouseEnter:i,onMouseLeave:a,onMouseDown:l,role:"slider","aria-label":c(e==="topMargin"?"ruler.topMargin":"ruler.bottomMargin"),"aria-orientation":"vertical",tabIndex:n?0:-1,children:jsxRuntime.jsx("div",{style:u})})}function VS(e,t,n){let o=[];if(n==="inch"){let r=HS/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=_e(l)*t;if(a%8===0){let s=a/8;o.push({position:c,width:10,label:s>0?String(s):void 0});}else a%4===0?o.push({position:c,width:6}):a%2===0?o.push({position:c,width:4}):o.push({position:c,width:2});}}else {let r=OS/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=_e(l)*t;if(a%10===0){let s=a/10;o.push({position:c,width:10,label:s>0?String(s):void 0});}else a%5===0?o.push({position:c,width:6}):o.push({position:c,width:3});}}return o}var Io=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var GS=e=>e.formatting?.indent??null,jS=e=>e.editable;function rc(){let e=H(),t=q(GS),n=q(jS),o=rt.useMemo(()=>n&&e!==null&&e.can({type:"setIndent",left:0}).ok,[e,n]),r=rt.useCallback(i=>e?e.exec({...i.left!==void 0?{left:i.left}:{},...i.right!==void 0?{right:i.right}:{},...i.firstLine!==void 0?{firstLine:i.firstLine}:{},type:"setIndent"}).ok:false,[e]);return rt.useMemo(()=>({indent:t,isEnabled:o,apply:r}),[t,o,r])}var Jm=e=>e.zoom;function Qm(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function ef(){let{apply:e}=Po(),[t,n]=rt.useState({}),o=rt.useRef({}),r=rt.useCallback(a=>l=>{o.current={...o.current,[a]:Math.round(l)},n(o.current);},[]),i=rt.useCallback(()=>{let a=o.current;o.current={},n({}),Object.keys(a).length!==0&&e({...a.top!==void 0?{marginTopTwips:a.top}:{},...a.right!==void 0?{marginRightTwips:a.right}:{},...a.bottom!==void 0?{marginBottomTwips:a.bottom}:{},...a.left!==void 0?{marginLeftTwips:a.left}:{},scope:"section"});},[e]);return {pending:t,preview:r,commit:i}}function Xm(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function XS(){let e=H(),{indent:t,isEnabled:n,apply:o}=rc(),[r,i]=rt.useState(null),a=rt.useRef(null),l=rt.useRef(null),c=rt.useCallback(u=>{l.current===null&&(l.current=Xm(e)),a.current=u,i(u);},[e]),s=rt.useCallback(()=>{let u=a.current,m=l.current;a.current=null,l.current=null,i(null),u&&(m!==null&&m!==Xm(e)||o({left:u.left,right:u.right,firstLine:u.firstLine}));},[e,o]),d=rt.useMemo(()=>r??(t?{left:t.left,right:t.right,firstLine:t.firstLine}:null),[r,t]);return rt.useMemo(()=>({indent:d,isEnabled:n,preview:c,commit:s}),[d,n,c,s])}function JS(){let e=Ft(),[t,n]=rt.useState(0);return rt.useEffect(()=>{if(!e){n(0);return}let o=()=>n(e.scrollLeft);return o(),e.addEventListener("scroll",o,{passive:true}),()=>e.removeEventListener("scroll",o)},[e]),t}function mi(e){let t=q(Io),{pageSetup:n,isEnabled:o}=Po(),r=q(Jm),{pending:i,preview:a,commit:l}=ef(),c=XS(),s=yo(),d=en(),u=JS();return t?null:jsxRuntime.jsx("div",{className:"docx-ruler-frame",style:{paddingInlineStart:s+d.inlineStart,paddingRight:d.inlineEnd},children:jsxRuntime.jsx(Mo,{pageSetup:Qm(n,i),zoom:r,editable:o,onLeftMarginChange:a("left"),onRightMarginChange:a("right"),onMarginDragEnd:l,showIndentHandles:c.indent!==null,indent:c.indent,indentEditable:c.isEnabled,onIndentChange:c.preview,onIndentDragEnd:c.commit,unit:e.unit??"inch",className:e.className??"",style:{...e.style,transform:`${e.style?.transform?`${e.style.transform} `:""}translateX(${-u}px)`,clipPath:s>0&&u>0?`inset(0 0 0 ${u}px)`:e.style?.clipPath}})})}function fi(e){let t=q(Io),{pageSetup:n,isEnabled:o}=Po(),r=q(Jm),{pending:i,preview:a,commit:l}=ef(),c=yo(),s=en(),d=Yd();return t||d!==null&&d>0&&n&&_e(n.pageWidthTwips)*r>d-c-s.inlineStart-s.inlineEnd?null:jsxRuntime.jsx(Dr,{pageSetup:Qm(n,i),zoom:r,editable:o,onTopMarginChange:a("top"),onBottomMarginChange:a("bottom"),onMarginDragEnd:l,unit:e.unit??"inch",className:e.className??"",style:e.style})}function L({size:e=20,className:t="",style:n,children:o}){return jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 -960 960 960",fill:"currentColor",className:t,style:{display:"inline-flex",flexShrink:0,...n},"aria-hidden":"true",children:o})}function eT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M280-200v-80h284q63 0 109.5-40T720-420q0-60-46.5-100T564-560H312l104 104-56 56-200-200 200-200 56 56-104 104h252q97 0 166.5 63T800-420q0 94-69.5 157T564-200H280Z"})})}function tT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M396-200q-97 0-166.5-63T160-420q0-94 69.5-157T396-640h252L544-744l56-56 200 200-200 200-56-56 104-104H396q-63 0-109.5 40T240-420q0 60 46.5 100T396-280h284v80H396Z"})})}function oT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M640-640v-120H320v120h-80v-200h480v200h-80Zm-480 80h640-640Zm560 100q17 0 28.5-11.5T760-500q0-17-11.5-28.5T720-540q-17 0-28.5 11.5T680-500q0 17 11.5 28.5T720-460Zm-80 260v-160H320v160h320Zm80 80H240v-160H80v-240q0-51 35-85.5t85-34.5h560q51 0 85.5 34.5T880-520v240H720v160Zm80-240v-160q0-17-11.5-28.5T760-560H200q-17 0-28.5 11.5T160-520v160h80v-80h480v80h80Z"})})}function nT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-320 280-520l56-58 104 104v-326h80v326l104-104 56 58-200 200ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function rT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-320v-326L336-542l-56-58 200-200 200 200-56 58-104-104v326h-80ZM240-160q-33 0-56.5-23.5T160-240v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-160H240Z"})})}function aT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"})})}function iT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function lT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120v-80h560v80H200Zm123-223q-56-63-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63q-101 0-157-63Z"})})}function sT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"})})}function cT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M760-600v-80q0-17 11.5-28.5T800-720h80v-40H760v-40h120q17 0 28.5 11.5T920-760v40q0 17-11.5 28.5T880-680h-80v40h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L539-451l186 291H618L482-377h-4L342-160H235Z"})})}function dT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M760-160v-80q0-17 11.5-28.5T800-280h80v-40H760v-40h120q17 0 28.5 11.5T920-320v40q0 17-11.5 28.5T880-240h-80v40h120v40H760Zm-525-80 185-291-172-269h106l124 200h4l123-200h107L539-531l186 291H618L482-457h-4L342-240H235Z"})})}function uT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"})})}function pT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"})})}function mT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function fT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function gT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function bT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function sc(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M240-160 80-320l56-56 64 62v-332l-64 62-56-56 160-160 160 160-56 56-64-62v332l64-62 56 56-160 160Zm240-40v-80h400v80H480Zm0-240v-80h400v80H480Zm0-240v-80h400v80H480Z"})})}function hT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm-56.5-263.5Q120-687 120-720t23.5-56.5Q167-800 200-800t56.5 23.5Q280-753 280-720t-23.5 56.5Q233-640 200-640t-56.5-23.5Z"})})}function vT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"})})}function yT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function xT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function ST(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm140-280 210-560h100l210 560h-96l-50-144H368l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"})})}function TT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M544-400 440-504 240-304l104 104 200-200Zm-47-161 104 104 199-199-104-104-199 199Zm-84-28 216 216-229 229q-24 24-56 24t-56-24l-2-2-26 26H60l126-126-2-2q-24-24-24-56t24-56l229-229Zm0 0 227-227q24-24 56-24t56 24l104 104q24 24 24 56t-24 56L629-373 413-589Z"})})}function CT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M800-436q0 36-8 69t-22 63l-62-60q6-17 9-34.5t3-37.5q0-47-17.5-89T650-600L480-768l-88 86-56-56 144-142 226 222q44 42 69 99.5T800-436Zm-8 380L668-180q-41 29-88 44.5T480-120q-133 0-226.5-92.5T160-436q0-51 16-98t48-90L56-792l56-56 736 736-56 56ZM480-200q36 0 68.5-10t61.5-28L280-566q-21 32-30.5 64t-9.5 66q0 98 70 167t170 69Zm-37-204Zm110-116Z"})})}function PT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function ET(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"})})}function wT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120ZM200-640h560v-120H200v120Zm100 80H200v360h100v-360Zm360 0v360h100v-360H660Zm-80 0H380v360h200v-360Z"})})}function kT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133ZM200-413h133v-134H200v134Zm213 0h134v-134H413v134Zm214 0h133v-134H627v134ZM200-627h133v-133H200v133Zm213 0h134v-133H413v133Zm214 0h133v-133H627v133Z"})})}function RT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M760-200v-120H200v120h560Zm0-200v-160H200v160h560Zm0-240v-120H200v120h560ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Z"})})}function MT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M121-280v-400q0-33 23.5-56.5T201-760h559q33 0 56.5 23.5T840-680v400q0 33-23.5 56.5T760-200H201q-33 0-56.5-23.5T121-280Zm79 0h133v-400H200v400Zm213 0h133v-400H413v400Zm213 0h133v-400H626v400Z"})})}function tf(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function IT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-200h560v-560H200v560Zm-80 80v-720h720v720H120Zm160-320v-80h80v80h-80Zm160 160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 160v-80h80v80h-80Z"})})}function _T(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm320 640v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm-160 0v-80h80v80h-80ZM440-120v-320H120v-80h320v-320h80v320h320v80H520v320h-80Z"})})}function DT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function NT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function LT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function FT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"})})}function AT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M600-240v-80h160v80H600Zm0-320v-80h280v80H600Zm0 160v-80h240v80H600ZM120-640H80v-80h160v-60h160v60h160v80h-40v360q0 33-23.5 56.5T440-200H200q-33 0-56.5-23.5T120-280v-360Zm80 0v360h240v-360H200Zm0 0v360-360Z"})})}function HT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m296-160-56-56 200-200v-269L337-582l-57-57 200-200 201 201-57 57-104-104v301L296-160Zm368 1L536-286l57-57 127 128-56 56Z"})})}function OT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function BT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-160q-33 0-56.5-23.5T280-240q0-33 23.5-56.5T360-320q33 0 56.5 23.5T440-240q0 33-23.5 56.5T360-160Zm240 0q-33 0-56.5-23.5T520-240q0-33 23.5-56.5T600-320q33 0 56.5 23.5T680-240q0 33-23.5 56.5T600-160ZM360-400q-33 0-56.5-23.5T280-480q0-33 23.5-56.5T360-560q33 0 56.5 23.5T440-480q0 33-23.5 56.5T360-400Zm240 0q-33 0-56.5-23.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 33-23.5 56.5T600-400ZM360-640q-33 0-56.5-23.5T280-720q0-33 23.5-56.5T360-800q33 0 56.5 23.5T440-720q0 33-23.5 56.5T360-640Zm240 0q-33 0-56.5-23.5T520-720q0-33 23.5-56.5T600-800q33 0 56.5 23.5T680-720q0 33-23.5 56.5T600-640Z"})})}function ZT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"})})}function qT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function KT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function zT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function $T(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M200-120q-33 0-56.5-23.5T120-200v-480h80v480h480v80H200Zm160-240v80q-33 0-56.5-23.5T280-360h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm80-160h-80q0-33 23.5-56.5T360-840v80Zm80 480v-80h80v80h-80Zm0-480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm0 480v-80h80v80h-80Zm160-480v-80q33 0 56.5 23.5T840-760h-80Zm0 400h80q0 33-23.5 56.5T760-280v-80Zm0-80v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function VT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-280q-33 0-56.5-23.5T280-360v-400q0-33 23.5-56.5T360-840h400q33 0 56.5 23.5T840-760v400q0 33-23.5 56.5T760-280H360Zm0-80h400v-400H360v400ZM200-200v80q-33 0-56.5-23.5T120-200h80Zm-80-80v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function UT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-80 310-250l57-57 73 73v-166h80v165l72-73 58 58L480-80ZM250-310 80-480l169-169 57 57-72 72h166v80H235l73 72-58 58Zm460 0-57-57 73-73H560v-80h165l-73-72 58-58 170 170-170 170ZM440-560v-166l-73 73-57-57 170-170 170 170-57 57-73-73v166h-80Z"})})}function WT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-120v-240h80v80h320v80H520v80h-80Zm-320-80v-80h240v80H120Zm160-160v-80H120v-80h160v-80h80v240h-80Zm160-80v-80h400v80H440Zm160-160v-240h80v80h160v80H680v80h-80Zm-480-80v-80h400v80H120Z"})})}function GT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M522-80v-82q34-5 66.5-18t61.5-34l56 58q-42 32-88 51.5T522-80Zm-80 0Q304-98 213-199.5T122-438q0-75 28.5-140.5t77-114q48.5-48.5 114-77T482-798h6l-62-62 56-58 160 160-160 160-56-56 64-64h-8q-117 0-198.5 81.5T202-438q0 104 68 182.5T442-162v82Zm322-134-58-56q21-29 34-61.5t18-66.5h82q-5 50-24.5 96T764-214Zm76-264h-82q-5-34-18-66.5T706-606l58-56q32 39 51 86t25 98Z"})})}function jT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-50-5-96-24.5T256-156l56-58q29 21 61.5 34t66.5 18v82Zm80 0v-82q104-15 172-93.5T760-438q0-117-81.5-198.5T480-718h-8l64 64-56 56-160-160 160-160 56 58-62 62h6q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-438q0 137-91 238.5T520-80ZM198-214q-32-42-51.5-88T122-398h82q5 34 18 66.5t34 61.5l-58 56Zm-76-264q6-51 25-98t51-86l58 56q-21 29-34 61.5T204-478h-82Z"})})}function YT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M280-160 80-360l200-200 56 57-103 103h287v80H233l103 103-56 57Zm400-240-56-57 103-103H440v-80h287L624-743l56-57 200 200-200 200Z"})})}function XT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M320-440v-287L217-624l-57-56 200-200 200 200-57 56-103-103v287h-80ZM600-80 400-280l57-56 103 103v-287h80v287l103-103 57 56L600-80Z"})})}function JT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M600-360ZM320-242q10 1 19.5 1.5t20.5.5q11 0 20.5-.5T400-242v82h400v-400h-82q1-10 1.5-19.5t.5-20.5q0-11-.5-20.5T718-640h82q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400q-33 0-56.5-23.5T320-160v-82Zm40-78q-117 0-198.5-81.5T80-600q0-117 81.5-198.5T360-880q117 0 198.5 81.5T640-600q0 117-81.5 198.5T360-320Zm0-80q83 0 141.5-58.5T560-600q0-83-58.5-141.5T360-800q-83 0-141.5 58.5T160-600q0 83 58.5 141.5T360-400Zm0-200Z"})})}function QT(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-80q-33 0-56.5-23.5T360-160v-160H240q-33 0-56.5-23.5T160-400v-280q0-66 47-113t113-47h480v440q0 33-23.5 56.5T720-320H600v160q0 33-23.5 56.5T520-80h-80ZM240-560h480v-200h-40v160h-80v-160h-40v80h-80v-80H320q-33 0-56.5 23.5T240-680v120Zm0 160h480v-80H240v80Zm0 0v-80 80Z"})})}function eC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function tC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function oC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h720v80H120Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function nC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 480v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function rC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm160 0v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Z"})})}function aC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-320v-80h80v80h-80Zm0-320v-80h80v80h-80Zm160 640v-720h80v720h-80Z"})})}function iC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h720v60H120Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-660v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function lC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-720h60v720h-60Zm165 0v-60h60v60h-60Zm0-330v-60h60v60h-60Zm0-330v-60h60v60h-60Zm165 660v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Zm0-165v-60h60v60h-60Z"})})}function sC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M320-600q17 0 28.5-11.5T360-640q0-17-11.5-28.5T320-680q-17 0-28.5 11.5T280-640q0 17 11.5 28.5T320-600Zm160 0q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm160 0q17 0 28.5-11.5T680-640q0-17-11.5-28.5T640-680q-17 0-28.5 11.5T600-640q0 17 11.5 28.5T640-600ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"})})}function cC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-200v-80h528l-42-42 56-56 138 138-138 138-56-56 42-42H160Zm116-200 164-440h80l164 440h-76l-38-112H392l-40 112h-76Zm138-176h132l-64-182h-4l-64 182Z"})})}function dC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M588-132 440-280l148-148 56 58-50 50h96q29 0 49.5-20.5T760-390q0-29-20.5-49.5T690-460H160v-80h530q63 0 106.5 43.5T840-390q0 63-43.5 106.5T690-240h-96l50 50-56 58ZM160-240v-80h200v80H160Zm0-440v-80h640v80H160Z"})})}function uC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-120 320-280l56-56 64 63v-414l-64 63-56-56 160-160 160 160-56 57-64-64v414l64-63 56 56-160 160Z"})})}function pC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function mC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"})})}function fC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M80 0v-160h800V0H80Zm160-320h56l312-311-29-29-28-28-311 312v56Zm-80 80v-170l448-447q11-11 25.5-17t30.5-6q16 0 31 6t27 18l55 56q12 11 17.5 26t5.5 31q0 15-5.5 29.5T777-687L330-240H160Zm560-504-56-56 56 56ZM608-631l-29-29-28-28 57 57Z"})})}function gC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m247-904 57-56 343 343q23 23 23 57t-23 57L457-313q-23 23-57 23t-57-23L153-503q-23-23-23-57t23-57l190-191-96-96Zm153 153L209-560h382L400-751Zm360 471q-33 0-56.5-23.5T680-360q0-21 12.5-45t27.5-45q9-12 19-25t21-25q11 12 21 25t19 25q15 21 27.5 45t12.5 45q0 33-23.5 56.5T760-280ZM80 0v-160h800V0H80Z"})})}function bC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function hC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-80v-168l-64 64-56-56 160-160 160 160-56 56-64-64v168h-80ZM160-440v-80h640v80H160Zm320-120L320-720l56-56 64 64v-168h80v168l64-64 56 56-160 160Z"})})}function vC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function yC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function xC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function SC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function TC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function CC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function PC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"})})}function EC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-440v-80h160v80H120Zm200 0v-80h160v80H320Zm200 0v-80h160v80H520Zm200 0v-80h120v80H720ZM240-120q-33 0-56.5-23.5T160-200v-120h80v120h480v-120h80v120q0 33-23.5 56.5T720-120H240Zm-80-520v-120q0-33 23.5-56.5T240-840h480q33 0 56.5 23.5T800-760v120h-80v-120H240v120h-80Z"})})}function wC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm0-80h640v-480H160v480Zm320-60q66 0 113-37t47-93q0-29-13-58t-34-55q-21-26-50-49t-50-31q-21 8-50 31t-50 49q-21 26-34 55t-13 58q0 56 47 93t140 37Z"})})}function kC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function RC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"})})}function MC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function IC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M268-240 42-466l57-56 170 170 56 56-57 56Zm226 0L268-466l56-57 170 170 368-368 57 57-425 424Zm0-226-57-56 198-198 57 56-198 198Z"})})}function _C(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m424-296 282-282-56-56-226 226-114-114-56 56 170 170Zm56 216q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"})})}function DC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function NC(e){return jsxRuntime.jsxs(L,{...e,children:[jsxRuntime.jsx("path",{d:"M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"}),jsxRuntime.jsx("path",{fill:"var(--doc-success)",d:"m421-380 227-227-45-45-182 182-92-91-45 45 137 136Z"})]})}function LC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function FC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}function AC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M440-400h80v-120h120v-80H520v-120h-80v120H320v80h120v120ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function HC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h480v-80H240v80Zm0-120h480v-80H240v80Zm0-120h480v-80H240v80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function OC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M160-400h280v-80H160v80Zm0-160h440v-80H160v80Zm0-160h440v-80H160v80Zm360 360v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q8 9 12.5 20t4.5 22q0 11-4 22.5T863-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z"})})}function BC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M240-400h122l200-200q9-9 13.5-20.5T580-643q0-11-5-21.5T562-684l-36-38q-9-9-20-13.5t-23-4.5q-11 0-22.5 4.5T440-722L240-522v122Zm280-243-37-37 37 37ZM300-460v-38l101-101 20 18 18 20-101 101h-38Zm121-121 18 20-38-38 20 18Zm26 181h273v-80H527l-80 80ZM80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"})})}function ZC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M480-320q75 0 127.5-52.5T660-500q0-75-52.5-127.5T480-680q-75 0-127.5 52.5T300-500q0 75 52.5 127.5T480-320Zm0-72q-45 0-76.5-31.5T372-500q0-45 31.5-76.5T480-608q45 0 76.5 31.5T588-500q0 45-31.5 76.5T480-392Zm0 192q-146 0-266-81.5T40-500q54-137 174-218.5T480-800q146 0 266 81.5T920-500q-54 137-174 218.5T480-200Zm0-300Zm0 220q113 0 207.5-59.5T832-500q-50-101-144.5-160.5T480-720q-113 0-207.5 59.5T128-500q50 101 144.5 160.5T480-280Z"})})}function qC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm0-280v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80ZM680-80l-56-56 64-64H120v-80h568l-64-64 56-56 160 160L680-80Z"})})}function KC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"M360-360v-200q-66 0-113-47t-47-113q0-66 47-113t113-47h320v80h-80v440h-80v-440h-80v440h-80Zm-88 160 64 64-56 56-160-160 160-160 56 56-64 64h568v80H272Zm88-440v-160q-33 0-56.5 23.5T280-720q0 33 23.5 56.5T360-640Zm0-80Z"})})}function zC(e){return jsxRuntime.jsx(L,{...e,children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}var $C={undo:eT,redo:tT,print:oT,file_download:nT,file_upload:rT,format_bold:aT,format_italic:iT,format_underlined:lT,strikethrough_s:sT,superscript:cT,subscript:dT,link:uT,format_clear:pT,format_align_left:mT,format_align_center:fT,format_align_right:gT,format_align_justify:bT,format_line_spacing:sc,format_list_bulleted:hT,format_list_numbered:vT,format_indent_increase:yT,format_indent_decrease:xT,format_color_text:ST,ink_highlighter:TT,format_color_reset:CT,arrow_drop_down:PT,table:ET,table_chart:wT,grid_on:kT,table_rows:RT,view_column:MT,border_all:tf,select_all:tf,border_outer:IT,border_inner:_T,border_clear:DT,add:NT,remove:LT,delete:FT,delete_sweep:AT,call_merge:HT,call_split:OT,drag_indicator:BT,image:ZT,format_image_left:qT,format_image_right:KT,horizontal_rule:zT,flip_to_back:$T,flip_to_front:VT,open_with:UT,tune:WT,rotate_right:GT,rotate_left:jT,swap_horiz:YT,swap_vert:XT,shapes:JT,format_paint:QT,expand_more:eC,expand_less:tC,border_top:oC,border_bottom:nC,border_left:rC,border_right:aC,border_horizontal:iC,border_vertical:lC,padding:sC,text_rotation_none:cC,wrap_text:dC,height:uC,fit_width:pC,settings:mC,border_color:fC,format_color_fill:gC,vertical_align_top:bC,vertical_align_center:hC,vertical_align_bottom:vC,line_weight:yC,keyboard_arrow_up:xC,keyboard_arrow_down:SC,keyboard_arrow_left:TC,keyboard_arrow_right:CC,more_vert:PC,page_break:EC,branding_watermark:wC,arrow_back:kC,search:RC,toc:MC,done_all:IC,check_circle:_C,chat_bubble_outline:DC,chat_bubble_check:NC,check:LC,close:FC,add_comment:AC,comment:HC,edit_note:OC,rate_review:BC,visibility:ZC,format_textdirection_l_to_r:qC,format_textdirection_r_to_l:KC,"agent-sparkle":zC};function K({name:e,size:t=20,className:n="",style:o}){let r=$C[e];return r?jsxRuntime.jsx(r,{size:t,className:n,style:o}):(console.warn(`Icon not found: ${e}`),jsxRuntime.jsx("span",{className:n,style:{fontSize:t,width:t,height:t,...o},children:e}))}var Nr=12,cc=240,nf=16,jC=24,YC=Nr+cc+nf,mn=12,XC=36,JC=mn+XC+nf,Lr=rt__namespace.default.memo(function({headings:t,onHeadingClick:n,onClose:o,topOffset:r=0,scrollLeft:i=0,leftOffset:a=Nr}){let{t:l}=_(),[c,s]=rt.useState(false),d=t.length?Math.min(...t.map(u=>u.level)):0;return rt.useEffect(()=>{requestAnimationFrame(()=>s(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":l("documentOutline.ariaLabel"),style:{position:"absolute",top:r,left:a-i,bottom:0,width:cc,paddingTop:jC,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:c?"translateX(0)":`translateX(-${a+cc}px)`,transition:"transform 0.15s ease-out"},onMouseDown:u=>u.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"16px 16px 12px 0"},children:[jsxRuntime.jsx("button",{onClick:o,"aria-label":l("documentOutline.closeAriaLabel"),style:{background:"none",border:"none",cursor:"pointer",padding:4,borderRadius:"50%",display:"flex",alignItems:"center",color:"var(--doc-text-muted)"},title:l("documentOutline.closeTitle"),children:jsxRuntime.jsx(K,{name:"arrow_back",size:20})}),jsxRuntime.jsx("span",{style:{fontWeight:400,fontSize:14,color:"var(--doc-text)",letterSpacing:"0.01em"},children:l("documentOutline.title")})]}),jsxRuntime.jsx("div",{style:{overflowY:"auto",flex:1,paddingLeft:4},children:t.length===0?jsxRuntime.jsx("div",{style:{padding:"8px 16px",color:"var(--doc-text-subtle)",fontSize:13,lineHeight:"20px"},children:l("documentOutline.noHeadings")}):t.map((u,m)=>jsxRuntime.jsx("div",{style:{marginLeft:(u.level-d)*16},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>n(u.blockId),style:{display:"block",width:"100%",textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"5px 8px",fontSize:13,fontWeight:400,color:"var(--doc-text)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:0,letterSpacing:"0.01em"},title:u.text,children:u.text})},`${u.blockId}-${m}`))})]})});var tP=e=>e,oP=Object.freeze([]),nP=()=>{};function dc(e){let t=H(),n=q(tP),o=rt.useMemo(()=>t&&!n.isLoading?t.getOutline():oP,[t,n]),r=rt.useCallback(i=>{if(!t)return;t.focus();let a={paragraphId:i,offset:0};t.exec({type:"setSelection",range:{anchor:a,head:a}}),t.scrollToBlock(i);},[t]);return Io(n)?null:jsxRuntime.jsx(Lr,{headings:o,onHeadingClick:r,onClose:e.onClose??nP,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var uc=rt.createContext(null);function Jt(e){let t=rt.useContext(uc);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var fn=280,gi=32,rf=16;function Do(e=280){return 32+e+16}function bi({viewportWidth:e,pageWidthPx:t,reservation:n,inlineEndReservation:o=0,inlineStartReservation:r=0,docked:i=false}){if(!Number.isFinite(e)||e<=0||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0||!Number.isFinite(o)||o<0||!Number.isFinite(r)||r<0)return 0;let a=(e-o-t)/2,l=a>=n?0:!i&&n<=2*a?2*(n-a):n;return Math.ceil(Math.max(0,l-r))}var cP=Object.freeze([]),dP=e=>e;function hi(){let e=H(),t=q(dP),[n,o]=rt.useState(null),r=rt.useMemo(()=>e&&!t.isLoading?e.getOutline():cP,[e,t]),i=rt.useMemo(()=>{if(r.length===0)return [];let l=r[0].level;for(let c of r)c.level<l&&(l=c.level);return r.map(c=>({heading:c,depth:c.level-l}))},[r]),a=rt.useCallback(l=>{if(!e||typeof l!="string"||l.length===0)return;e.focus();let c={paragraphId:l,offset:0};e.exec({type:"setSelection",range:{anchor:c,head:c}}),e.scrollToBlock(l),o(l);},[e]);return {headings:r,items:i,selectedBlockId:n,goTo:a,isEmpty:r.length===0}}var fc=150,gc=2e3,mc=Object.freeze([]),mP=e=>e;function vi(){let e=H(),t=q(mP),[n,o]=rt.useState(""),[r,i]=rt.useState(""),[a,l]=rt.useState(false),[c,s]=rt.useState(false),[d,u]=rt.useState(mc),[m,g]=rt.useState(-1);rt.useEffect(()=>{if(n===r)return;let x=setTimeout(()=>i(n),fc);return ()=>clearTimeout(x)},[n,r]);let p=rt.useMemo(()=>({matchCase:a,wholeWord:c}),[a,c]);rt.useEffect(()=>{if(!e||r.length===0){u(mc),g(-1);return}let x=e.findMatches(r,p);u(T=>T===x?T:x);},[e,r,p,t]);let f=rt.useRef(d);rt.useEffect(()=>{f.current!==d&&(f.current=d,g(x=>x>=0&&x<d.length?x:-1));},[d]);let b=rt.useCallback(x=>{if(!e)return;let T=d[x];if(!T)return;e.focus(),e.selectMatch(T).ok&&g(x);},[e,d]),v=rt.useCallback(x=>{if(d.length===0)return;let k=((m<0?x>0?-1:0:m)+x+d.length)%d.length;b(k);},[m,b,d.length]),P=rt.useCallback(()=>v(1),[v]),y=rt.useCallback(()=>v(-1),[v]),S=rt.useCallback(x=>o(x),[]),h=rt.useCallback(()=>{o(""),i(""),u(mc),g(-1);},[]);return {query:n,setQuery:S,matchCase:a,setMatchCase:l,wholeWord:c,setWholeWord:s,matches:d,truncated:d.length>=gc,activeIndex:m,goTo:b,next:P,previous:y,clear:h,isPending:n!==r}}var yP=e=>{let t=e.zoomMode;return {pageSetup:e.pageSetup??null,zoom:e.zoom,reviewPaneOpen:e.reviewPaneOpen??true,fitting:t?.type==="fit"&&e.zoom<(t.maxZoom??editor.ZOOM_MAX)&&e.zoom>(t.minZoom??editor.ZOOM_MIN)}},xP=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function yi(e={}){let{defaultOpen:t=false,defaultTab:n="headings",paneWidth:o=280}=e,[r,i]=rt.useState(t),[a,l]=rt.useState(n),c=e.open??r,s=e.tab??a,{onOpenChange:d,onTabChange:u}=e,m=e.open!==void 0,g=e.tab!==void 0,p=rt.useCallback(M=>{m||i(M),d?.(M);},[m,d]),f=rt.useCallback(()=>p(!c),[c,p]),b=rt.useCallback(M=>{g||l(M),u?.(M);},[g,u]),v=vo(),P=Ft(),y=rt.useContext(ft),{pageSetup:S,zoom:h,reviewPaneOpen:x,fitting:T}=q(yP,xP),[k,E]=rt.useState(0),[w,D]=rt.useState(0),[F,A]=rt.useState(0);rt.useEffect(()=>{if(!P){E(0),D(0),A(0);return}let M=()=>{E(P.clientWidth);let z=getComputedStyle(P),$=Number.parseFloat(z.paddingInlineEnd);D(Number.isFinite($)?$:0);let V=Number.parseFloat(z.getPropertyValue("--docx-review-gutter-start"));A(Number.isFinite(V)?V:0);};if(M(),typeof ResizeObserver>"u")return;let ae=new ResizeObserver(M);return ae.observe(P),()=>ae.disconnect()},[P,c,x,y?.mounted]);let I=rt.useRef(null);S&&(I.current=S.pageWidthTwips);let N=S?.pageWidthTwips??I.current,R=rt.useMemo(()=>!c||N===null?0:bi({viewportWidth:k,pageWidthPx:_e(N)*h,reservation:Do(o),inlineEndReservation:w,inlineStartReservation:F,docked:T}),[c,N,h,k,o,w,F,T]);return rt.useEffect(()=>{if(v)return v.setShift(R),()=>v.setShift(0)},[v,R]),rt.useEffect(()=>{if(v)return v.setReservation(c?Do(o):0),()=>v.setReservation(0)},[v,c,o]),{open:c,setOpen:p,toggle:f,tab:s,setTab:b,paneWidth:o,shift:R}}var Ar=["headings","find"],Mt=(...e)=>e.filter(Boolean).join(" ");function Hr({className:e,style:t,children:n}){return jsxRuntime.jsx("div",{className:Mt("docx-nav__header",e),style:t,children:n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Or,{}),jsxRuntime.jsx(Br,{})]})})}function Or({className:e,style:t,children:n}){let{pane:o,t:r}=Jt("Close");return jsxRuntime.jsx("button",{type:"button",className:Mt("docx-nav__close",e),style:t,"aria-label":r("navigation.closeAriaLabel"),title:r("navigation.closeTitle"),onClick:()=>o.setOpen(false),children:n??jsxRuntime.jsx(K,{name:"arrow_back",size:20})})}function Br({className:e,style:t,children:n}){let{t:o}=Jt("Title");return jsxRuntime.jsx("h2",{className:Mt("docx-nav__title",e),style:t,children:n??o("navigation.title")})}function Zr({className:e,style:t,children:n}){let{pane:o,t:r}=Jt("Tabs"),i=rt.useCallback(a=>{let l=a.key==="ArrowRight"?1:a.key==="ArrowLeft"?-1:0;if(l===0)return;a.preventDefault();let c=Ar.indexOf(o.tab);o.setTab(Ar[(c+l+Ar.length)%Ar.length]);},[o]);return jsxRuntime.jsx("div",{className:Mt("docx-nav__tabs",e),style:t,role:"tablist","aria-label":r("navigation.title"),onKeyDown:i,children:n??Ar.map(a=>jsxRuntime.jsx(qr,{value:a},a))})}function qr({value:e,className:t,style:n,children:o}){let{pane:r,t:i}=Jt("Tab"),a=r.tab===e;return jsxRuntime.jsx("button",{type:"button",role:"tab",id:`docx-nav-tab-${e}`,"aria-selected":a,"aria-controls":`docx-nav-panel-${e}`,tabIndex:a?0:-1,className:Mt("docx-nav__tab",a&&"docx-nav__tab--selected",t),style:n,onClick:()=>r.setTab(e),children:o??i(`navigation.tabs.${e}`)})}function lf({value:e,onChange:t,onClear:n,placeholder:o,label:r,clearLabel:i,autoFocus:a}){return jsxRuntime.jsxs("div",{className:"docx-nav__searchbox",children:[jsxRuntime.jsx(K,{name:"search",size:18,className:"docx-nav__search-icon"}),jsxRuntime.jsx("input",{type:"search",className:"docx-nav__search-input",value:e,placeholder:o,"aria-label":r,autoFocus:a,onChange:l=>t(l.target.value)}),e.length>0&&jsxRuntime.jsx("button",{type:"button",className:"docx-nav__search-clear","aria-label":i,onClick:n,children:jsxRuntime.jsx(K,{name:"close",size:16})})]})}function Kr({className:e,style:t}){let{pane:n,outline:o,t:r}=Jt("Headings"),[i,a]=rt.useState(""),l=q(Io),c=rt.useMemo(()=>{let d=i.trim().toLowerCase();return d.length===0?o.items:o.items.filter(u=>u.heading.text.toLowerCase().includes(d))},[o.items,i]),s=n.tab!=="headings";return jsxRuntime.jsxs("div",{className:Mt("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-headings","aria-labelledby":"docx-nav-tab-headings",hidden:s,children:[jsxRuntime.jsx(lf,{value:i,onChange:a,onClear:()=>a(""),placeholder:r("navigation.find.placeholder"),label:r("navigation.find.inputAriaLabel"),clearLabel:r("navigation.find.clearAriaLabel")}),l?null:o.isEmpty?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:r("navigation.headings.noHeadings")}):c.length===0?jsxRuntime.jsx("p",{className:"docx-nav__empty",children:r("navigation.find.noResults")}):jsxRuntime.jsx("ul",{className:"docx-nav__list",children:c.map((d,u)=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:Mt("docx-nav__heading",o.selectedBlockId===d.heading.blockId&&"docx-nav__heading--current"),style:{paddingInlineStart:`${8+d.depth*14}px`},title:d.heading.text,onClick:()=>o.goTo(d.heading.blockId),children:d.heading.text})},`${d.heading.blockId}-${u}`))})]})}function PP({match:e,active:t,onSelect:n}){return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:Mt("docx-nav__result",t&&"docx-nav__result--active"),"aria-current":t?"true":void 0,onClick:n,children:jsxRuntime.jsxs("span",{className:"docx-nav__result-text",children:[e.contextBefore,jsxRuntime.jsx("mark",{className:"docx-nav__result-hit",children:e.text}),e.contextAfter]})})})}function zr({className:e,style:t}){let{pane:n,search:o,t:r}=Jt("Find"),i=n.tab!=="find",a=o.query.trim().length>0,l=o.matches.length===0?null:o.activeIndex<0?r(o.truncated?"navigation.find.totalTruncated":"navigation.find.total",{total:o.matches.length}):r(o.truncated?"navigation.find.counterTruncated":"navigation.find.counter",{current:o.activeIndex+1,total:o.matches.length});return jsxRuntime.jsxs("div",{className:Mt("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-find","aria-labelledby":"docx-nav-tab-find",hidden:i,children:[jsxRuntime.jsx(lf,{value:o.query,onChange:o.setQuery,onClear:o.clear,placeholder:r("navigation.find.placeholder"),label:r("navigation.find.inputAriaLabel"),clearLabel:r("navigation.find.clearAriaLabel")}),jsxRuntime.jsxs("div",{className:"docx-nav__options",role:"group","aria-label":r("navigation.find.optionsAriaLabel"),children:[jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:o.matchCase,onChange:c=>o.setMatchCase(c.target.checked)}),r("navigation.find.matchCase")]}),jsxRuntime.jsxs("label",{className:"docx-nav__option",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:o.wholeWord,onChange:c=>o.setWholeWord(c.target.checked)}),r("navigation.find.wholeWord")]})]}),jsxRuntime.jsxs("div",{className:"docx-nav__resultbar",children:[jsxRuntime.jsx("span",{className:"docx-nav__count","aria-live":"polite",children:a?o.isPending?r("navigation.find.searching"):l??r("navigation.find.noResults"):""}),jsxRuntime.jsxs("span",{className:"docx-nav__steppers",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":r("navigation.find.previousAriaLabel"),disabled:o.matches.length===0,onClick:o.previous,children:jsxRuntime.jsx(K,{name:"keyboard_arrow_up",size:18})}),jsxRuntime.jsx("button",{type:"button",className:"docx-nav__stepper","aria-label":r("navigation.find.nextAriaLabel"),disabled:o.matches.length===0,onClick:o.next,children:jsxRuntime.jsx(K,{name:"keyboard_arrow_down",size:18})})]})]}),o.matches.length>0&&jsxRuntime.jsx("ul",{className:"docx-nav__list","aria-label":r("navigation.find.resultsAriaLabel"),children:o.matches.map((c,s)=>jsxRuntime.jsx(PP,{match:c,active:s===o.activeIndex,onSelect:()=>o.goTo(s)},`${c.blockId}-${c.start}-${s}`))})]})}function $r({className:e,style:t,children:n}){let{pane:o,t:r}=Jt("Toggle");return jsxRuntime.jsx("button",{type:"button",className:Mt("docx-nav__toggle",e),style:t,"aria-label":r("navigation.openAriaLabel"),"aria-expanded":o.open,title:r("navigation.openTitle"),onMouseDown:i=>i.preventDefault(),onClick:o.toggle,children:n??jsxRuntime.jsx(K,{name:"toc",size:20})})}function vc(e){let t=ot(),{t:n,toggle:o=true,className:r,style:i,children:a,...l}=e,c=yi(l),s=hi(),d=vi(),{t:u}=_(),m=rt.useMemo(()=>({pane:c,outline:s,search:d,t:n??((p,f)=>u(p,f))}),[c,s,d,n,u]),g=e.paneWidth??280;return jsxRuntime.jsx(uc.Provider,{value:m,children:jsxRuntime.jsxs("div",{className:`${t}docx-nav${c.open?" docx-nav--open":""}${r?` ${r}`:""}`,"data-open":c.open?"true":"false",style:{"--docx-nav-width":`${g}px`,"--docx-nav-inset":`${32}px`,"--docx-nav-reservation":`${Do(g)}px`,...i},children:[o!==false&&!c.open&&jsxRuntime.jsx($r,{...typeof o=="object"?o:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":m.t("navigation.ariaLabel"),inert:!c.open,children:a??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Hr,{}),jsxRuntime.jsx(Zr,{}),jsxRuntime.jsx(Kr,{}),jsxRuntime.jsx(zr,{})]})})]})})}var xi=Object.assign(vc,{Header:Hr,Close:Or,Title:Br,Tabs:Zr,Tab:qr,Headings:Kr,Find:zr,Toggle:$r});var _P=600,DP=e=>e.page.total,Si=rt.createContext(null);function Ti({className:e,style:t}){let n=ot(),o=H(),r=Ft(),i=q(DP),{t:a}=_(),l=rt.useContext(Si),[c,s]=rt.useState(1),[d,u]=rt.useState(false);if(rt.useEffect(()=>{if(u(false),!o||!r||i<=1)return;s(o.getCurrentPage("viewport"));let g=null,p=()=>{s(o.getCurrentPage("viewport")),u(true),g&&clearTimeout(g),g=setTimeout(()=>u(false),_P);};return r.addEventListener("scroll",p,{passive:true}),()=>{r.removeEventListener("scroll",p),g&&clearTimeout(g);}},[o,i,r]),i<=1)return null;let m=l?l("viewer.pageIndicator").replace(/\{current\}/g,String(c)).replace(/\{total\}/g,String(i)):a("viewer.pageIndicator",{current:c,total:i});return jsxRuntime.jsx("div",{className:`${n}docx-editor-shell__page-indicator-chip docx-editor__page-number${e?` ${e}`:""}`,style:t,"data-visible":d?"true":"false",role:"status","aria-live":"polite",children:m})}var FP=[],AP=e=>e.fontSubstitutions??FP;function Ci({className:e,style:t,t:n}){let o=q(AP),{t:r}=_(),i=n??r,[a,l]=rt.useState(null);if(o.length===0)return null;let c=o.join("\0");return a===c?null:jsxRuntime.jsxs("div",{className:e?`docx-font-notice ${e}`:"docx-font-notice",role:"status",...t?{style:t}:{},children:[jsxRuntime.jsx("span",{className:"docx-font-notice__text",children:i("editor.fontSubstitutionNotice",{fonts:o.join(", ")}).replace("{fonts}",o.join(", "))}),jsxRuntime.jsx("button",{type:"button",className:"docx-font-notice__dismiss",onClick:()=>l(c),children:i("common.dismiss")})]})}var Qe={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function yc(e){return Math.round(e/1440*100)/100}function uf(e){return Math.round(e*1440)}function BP(e,t){return e===t?true:!e||!t?false:e.editing===t.editing&&e.sectionIndex===t.sectionIndex&&e.variant===t.variant&&e.rId===t.rId&&e.partName===t.partName&&e.inherited===t.inherited&&e.titlePage===t.titlePage&&e.evenAndOddHeaders===t.evenAndOddHeaders&&e.headerDistanceTwips===t.headerDistanceTwips&&e.footerDistanceTwips===t.footerDistanceTwips}function xc(){let e=H(),t=rt.useCallback(n=>e?.getHeaderFooterState()??null,[e]);return q(t,BP)}function Pi(e,t,n){let o=e.getBoundingClientRect();return {left:t-o.left-e.clientLeft+e.scrollLeft,top:n-o.top-e.clientTop+e.scrollTop}}function Vr(e,t){let[n,o]=rt.useState(null),r=rt.useCallback(l=>o(l),[]),[i,a]=rt.useState({visibility:"hidden"});return rt.useLayoutEffect(()=>{let l=n?.closest(".docx-editor__scroll-container"),c=l??n?.parentElement?.querySelector(".docx-editor__scroll-container");if(!n||!c)return;let s=0,d=null,u=new ResizeObserver(()=>g()),m=()=>{s=0;let f=e(c);if(f!==d&&(u.disconnect(),u.observe(c),u.observe(n),f&&u.observe(f),d=f),!f||!f.isConnected){a({visibility:"hidden"});return}let b=f.getBoundingClientRect(),v=t==="story-label"?Math.max(n.offsetHeight,28):n.offsetHeight,P=t==="story-label"?6:4,y=l===c,S=t==="after"?b.bottom+6:b.top-v-P,h=y?Pi(c,b.left,S):{left:b.left,top:S},x=h.left,T=h.top,k=y?c.scrollLeft+8:8;a({position:y?"absolute":"fixed",left:t==="story-label"?x:Math.max(k,x+8),top:t==="story-label"?T:Math.max(y?c.scrollTop+8:8,T),...t==="story-label"?{width:Math.max(240,Math.min(b.width,c.clientWidth-16))}:{maxWidth:Math.max(240,Math.min(b.width-16,c.clientWidth-16))},visibility:"visible"});},g=()=>{s||(s=requestAnimationFrame(m));};u.observe(c),u.observe(n);let p=new MutationObserver(g);return p.observe(c,{subtree:true,childList:true,attributes:true,attributeFilter:["data-docx-hf-active","data-docx-note-scope"]}),c.addEventListener("scroll",g,{passive:true}),window.addEventListener("resize",g),m(),()=>{s&&cancelAnimationFrame(s),u.disconnect(),p.disconnect(),c.removeEventListener("scroll",g),window.removeEventListener("resize",g);}},[n,e,t]),{ref:r,style:i}}function $P(e,t){return t==="first"?e==="header"?"headerFooter.firstPageHeader":"headerFooter.firstPageFooter":t==="even"?e==="header"?"headerFooter.evenPageHeader":"headerFooter.evenPageFooter":e==="header"?"headerFooter.header":"headerFooter.footer"}var VP=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function Ur(e){let t=H();return rt.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let n=t.can(e);return n.ok?{enabled:true,reason:null}:{enabled:false,reason:n.reason}},[t,e])}function UP(e){let{state:t,onMouseDown:n}=e,{t:o}=_(),r=H(),[i,a]=rt.useState(false),l=rt.useRef(null),[c,s]=rt.useState(""),[d,u]=rt.useState("");rt.useEffect(()=>{i&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(s(String(yc(t.headerDistanceTwips))),u(String(yc(t.footerDistanceTwips)))));},[i,t.headerDistanceTwips,t.footerDistanceTwips]),rt.useEffect(()=>{if(!i)return;let T=k=>{l.current?.contains(k.target)||a(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]);let m=rt.useMemo(()=>({type:"setHeaderFooterOptions",titlePage:!t.titlePage}),[t.titlePage]),g=rt.useMemo(()=>({type:"setHeaderFooterOptions",evenAndOddHeaders:!t.evenAndOddHeaders}),[t.evenAndOddHeaders]),p=rt.useMemo(()=>({type:"linkHeaderFooterToPrevious"}),[]),f=rt.useMemo(()=>({type:"unlinkHeaderFooterFromPrevious"}),[]),b=rt.useMemo(()=>({type:"removeHeaderFooter",position:t.editing}),[t.editing]),v=Ur(m),P=Ur(g),y=Ur(p),S=Ur(f),h=Ur(b),x=(T,k)=>{if(!r)return;let E=Number.parseFloat(k);Number.isFinite(E)&&r.exec({type:"setHeaderFooterOptions",[T]:uf(E)});};return jsxRuntime.jsxs("div",{ref:l,className:"docx-hf-chrome__options",onMouseDown:n,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","aria-expanded":i,"aria-haspopup":"menu",onClick:()=>a(T=>!T),onMouseDown:n,children:o("headerFooter.options")}),i?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:n,children:[VP.map(T=>{let k={type:"insertPageField",field:T.field},E=r?.can(k);return jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!E?.ok,title:E&&!E.ok?E.reason:void 0,onClick:()=>{r?.exec(k),a(false);},onMouseDown:n,children:o(T.labelKey)},T.field)}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.titlePage===true,disabled:!v.enabled,title:v.reason??void 0,onChange:()=>r?.exec(m)}),jsxRuntime.jsx("span",{children:o("headerFooter.differentFirstPage")})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t.evenAndOddHeaders===true,disabled:!P.enabled,title:P.reason??void 0,onChange:()=>r?.exec(g)}),jsxRuntime.jsxs("span",{children:[o("headerFooter.differentOddEven"),jsxRuntime.jsx("span",{className:"docx-hf-chrome__menu-hint",children:o("headerFooter.differentOddEvenHint")})]})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),t.inherited?jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!S.enabled,title:S.reason??void 0,onClick:()=>r?.exec(f),onMouseDown:n,children:o("headerFooter.unlinkFromPrevious")}):jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!y.enabled,title:y.reason??void 0,onClick:()=>r?.exec(p),onMouseDown:n,children:o("headerFooter.linkToPrevious")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:o("headerFooter.headerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":o("headerFooter.headerDistance"),value:c,onChange:T=>s(T.target.value),onBlur:()=>x("headerDistanceTwips",c)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsxs("label",{className:"docx-hf-chrome__menu-row docx-hf-chrome__menu-row--distance",children:[jsxRuntime.jsx("span",{children:o("headerFooter.footerDistance")}),jsxRuntime.jsx("input",{type:"number",min:0,step:.01,"aria-label":o("headerFooter.footerDistance"),value:d,onChange:T=>u(T.target.value),onBlur:()=>x("footerDistanceTwips",d)}),jsxRuntime.jsx("span",{className:"docx-hf-chrome__unit",children:"in"})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!h.enabled,title:h.reason??void 0,onClick:()=>r?.exec(b),onMouseDown:n,children:t.editing==="header"?o("headerFooter.removeHeader"):o("headerFooter.removeFooter")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-hf-close",onClick:()=>{r?.exec({type:"exitHeaderFooter"}),a(false);},onMouseDown:n,children:o("common.close")})]}):null]})}function Ei({className:e}){let{t}=_(),n=xc(),o=rt.useCallback(l=>l.querySelector("[data-docx-hf-active]"),[]),r=Vr(o,"story-label"),i=O;if(!n?.editing)return null;let a=$P(n.editing,n.variant);return jsxRuntime.jsxs("div",{ref:r.ref,className:`docx-context-bar docx-hf-chrome${e?` ${e}`:""}`,role:"region","aria-label":t("headerFooter.chromeAriaLabel"),"data-testid":"docx-hf-chrome",onMouseDown:i,style:{...r.style,zIndex:Qe.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(a)}),n.inherited?jsxRuntime.jsx("span",{className:"docx-context-bar__status","data-testid":"docx-hf-inherited",title:t("headerFooter.sameAsPreviousHint"),children:t("headerFooter.sameAsPrevious")}):null]}),jsxRuntime.jsx(UP,{state:n,onMouseDown:i})]})}function Fo(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var wi=e=>jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:16,height:16,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})}),QP="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z",e1="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z",t1="M770-302 656-416l57-57 114 114-57 57ZM603-469 469-603l57-57 134 134-57 57ZM280-280h133v80H280q-83 0-141.5-58.5T80-400q0-83 58.5-141.5T280-600h133v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35Zm40-80v-80h101l80 80H320Zm493-15-57-57q23-11 33.5-32t10.5-36q0-50-35-85t-85-35H547v-80h133q83 0 141.5 58.5T880-400q0 32-11 61.5T813-375ZM792-56 56-792l56-56 736 736-56 56Z",o1="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z";function n1({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let i=It(),a=rt.useRef(null),{state:l,close:c}=i;rt.useEffect(()=>{if(l.mode==="closed")return;let f=v=>{v.key==="Escape"&&(v.preventDefault(),c());},b=v=>{let P=a.current;P&&v.target instanceof Node&&P.contains(v.target)||c();};return document.addEventListener("keydown",f),document.addEventListener("mousedown",b,true),()=>{document.removeEventListener("keydown",f),document.removeEventListener("mousedown",b,true);}},[l.mode,c]);let[s,d]=rt.useState(null);rt.useLayoutEffect(()=>{let f=l.anchor,b=a.current;if(!f||!b){d(null);return}let v=b.offsetParent;if(!v){d(null);return}let{left:P,top:y}=Pi(v,f.left,f.top),S=Math.max(0,v.scrollWidth-b.offsetWidth);d({left:Math.max(0,Math.min(P,S)),top:y});},[l.anchor]);let{t:u}=_(),m=l.mode==="editing"?u(l.link?"hyperlinkPopup.editTitle":"hyperlinkPopup.insertTitle"):u("hyperlinkPopup.editLink"),g=r?jsxRuntime.jsx(r1,{children:o}):o;if(n)return l.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:o});let p={ref:a,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":l.mode,role:"dialog","aria-modal":false,onMouseDown:Fo,style:s??void 0,"aria-label":m};return l.mode==="closed"?null:t?jsxRuntime.jsx(j,{...p,children:o}):jsxRuntime.jsx("div",{...p,children:g})}function r1({children:e}){let{state:t}=It(),n=rt.useMemo(()=>a1(e),[e]),o=(i,a)=>i in n?n[i]:a;if(t.mode==="editing")return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Fields",jsxRuntime.jsx(kc,{})),o("Error",jsxRuntime.jsx(Mc,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Apply",jsxRuntime.jsx(Rc,{})),o("Cancel",jsxRuntime.jsx(Ic,{}))]}),n.__extra]});let r=t.canEdit&&!(t.link&&Zn(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Url",jsxRuntime.jsx(Cc,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Copy",jsxRuntime.jsx(Pc,{})),r?o("Edit",jsxRuntime.jsx(Ec,{})):null,r?o("Unlink",jsxRuntime.jsx(wc,{})):null]}),n.__extra]})}function a1(e){let t={},n=[],o=r=>{if(Array.isArray(r)){r.forEach(o);return}if(!r||typeof r!="object"||!("type"in r)){r&&n.push(r);return}if(r.type===rt.Fragment){o(r.props.children);return}let i=r.type.docxHyperLinkPart;i?t[i]=r:n.push(r);};return o(e),n.length>0&&(t.__extra=n),t}function It(){return rt.useContext(qn)??i1}var i1={state:{mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:false},open:()=>{},openAtCaret:()=>{},close:()=>{},copy:async()=>false,beginEdit:()=>{},setText:()=>{},setUrl:()=>{},commitEdit:()=>false,unlink:()=>false,openTarget:()=>false};function Cc({className:e,asChild:t,hidden:n,children:o}){let{state:r,openTarget:i}=It(),{t:a}=_();if(n||!r.link)return null;let l=!r.link.href,c=r.link.kind==="internal",s=c?`#${r.link.anchor??""}`:r.link.authored,d=a(l?"hyperlinkPopup.inertTarget":c?"hyperlinkPopup.bookmarkTarget":"hyperlinkPopup.openLink"),u={className:`docx-hyperlink-popup__url${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-url",...l?{"data-inert":""}:{},title:d,onMouseDown:Fo,...l?{}:{onClick:()=>i(),type:"button"}};return t?jsxRuntime.jsx(j,{...u,children:o}):l?jsxRuntime.jsxs("span",{...u,children:[o??s,jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:d})]}):jsxRuntime.jsxs("button",{...u,children:[o??s,wi(o1)]})}Cc.docxHyperLinkPart="Url";function Pc({className:e,asChild:t,hidden:n,children:o,icon:r}){let{state:i,copy:a}=It(),{t:l}=_();if(n||!i.link?.href)return null;let c=i.copied?l("editor.linkCopied"):l("hyperlinkPopup.copyLink"),s={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-copy",...i.copied?{"data-copied":""}:{},"aria-label":c,title:c,onMouseDown:Fo,onClick:()=>{a();}};return t?jsxRuntime.jsx(j,{...s,children:o}):jsxRuntime.jsx("button",{...s,children:r??o??wi(QP)})}Pc.docxHyperLinkPart="Copy";function Ec({className:e,asChild:t,hidden:n,children:o,icon:r}){let{beginEdit:i}=It(),{t:a}=_();if(n)return null;let l=a("hyperlinkPopup.editLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-edit","aria-label":l,title:l,onMouseDown:Fo,onClick:()=>i()};return t?jsxRuntime.jsx(j,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??wi(e1)})}Ec.docxHyperLinkPart="Edit";function wc({className:e,asChild:t,hidden:n,children:o,icon:r}){let{unlink:i}=It(),{t:a}=_();if(n)return null;let l=a("hyperlinkPopup.removeLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-unlink","aria-label":l,title:l,onMouseDown:Fo,onClick:()=>i()};return t?jsxRuntime.jsx(j,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??wi(t1)})}wc.docxHyperLinkPart="Unlink";function kc({className:e,hidden:t}){let{state:n,setText:o,setUrl:r,commitEdit:i,close:a}=It(),{t:l}=_(),c=rt.useRef(null),s=rt.useId(),d=rt.useId();rt.useEffect(()=>{n.mode==="editing"&&(c.current?.focus({preventScroll:true}),c.current?.select());},[n.mode]);let u=rt.useCallback(m=>{if(m.key==="Enter"){m.preventDefault(),i();return}m.key==="Escape"&&(m.preventDefault(),a());},[i,a]);return t?null:jsxRuntime.jsxs("div",{className:`docx-hyperlink-popup__fields${e?` ${e}`:""}`,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:s,children:l("hyperlinkPopup.displayTextPlaceholder")}),jsxRuntime.jsx("input",{id:s,"data-testid":"hyperlink-popup-text",className:"docx-hyperlink-popup__input",value:n.text,placeholder:l("hyperlinkPopup.displayTextPlaceholder"),onChange:m=>o(m.target.value),onKeyDown:u}),jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:d,children:l("hyperlinkPopup.urlPlaceholder")}),jsxRuntime.jsx("input",{id:d,ref:c,"data-testid":"hyperlink-popup-url-input",className:"docx-hyperlink-popup__input",value:n.url,placeholder:l("hyperlinkPopup.urlPlaceholder"),onChange:m=>r(m.target.value),onKeyDown:u})]})}kc.docxHyperLinkPart="Fields";function Rc({className:e,asChild:t,hidden:n,children:o}){let{state:r,commitEdit:i}=It(),{t:a}=_();if(n)return null;let l=a("hyperlinkPopup.apply"),c={type:"button",className:`docx-hyperlink-popup__apply${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-apply",disabled:r.url.trim().length===0,onMouseDown:Fo,onClick:()=>i()};return t?jsxRuntime.jsx(j,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:o??l})}function Mc({className:e,hidden:t}){let{state:n}=It(),{t:o}=_();return t||!n.error?null:jsxRuntime.jsx("div",{className:`docx-hyperlink-popup__error${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-error",role:"alert",children:o("hyperlinkPopup.refused")})}Mc.docxHyperLinkPart="Error";Rc.docxHyperLinkPart="Apply";function Ic({className:e,asChild:t,hidden:n,children:o}){let{close:r}=It(),{t:i}=_();if(n)return null;let a=i("hyperlinkPopup.cancel"),l={type:"button",className:`docx-hyperlink-popup__cancel${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-cancel",onMouseDown:Fo,onClick:()=>r()};return t?jsxRuntime.jsx(j,{...l,children:o}):jsxRuntime.jsx("button",{...l,children:o??a})}Ic.docxHyperLinkPart="Cancel";var ki=Object.assign(n1,{Url:Cc,Copy:Pc,Edit:Ec,Unlink:wc,Fields:kc,Error:Mc,Apply:Rc,Cancel:Ic});function l1(e,t){return e===t?true:!e||!t||e.kind!==t.kind?false:e.kind==="note"&&t.kind==="note"?e.id===t.id:e.kind==="headerFooter"&&t.kind==="headerFooter"?e.rId===t.rId:true}function _c(){let e=H(),t=rt.useCallback(o=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),n=q(t,l1);return n?.kind==="note"?n:null}function hf(e,t){return e===t?true:!e||!t?false:e.pos===t.pos&&e.numFmt===t.numFmt&&e.numStart===t.numStart&&e.numRestart===t.numRestart}function vf(e,t){return e.resolved.pos===t.resolved.pos&&e.resolved.numFmt===t.resolved.numFmt&&e.resolved.numStart===t.resolved.numStart&&e.resolved.numRestart===t.resolved.numRestart&&hf(e.documentAuthored,t.documentAuthored)&&hf(e.sectionAuthored,t.sectionAuthored)}function s1(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&vf(e.footnote,t.footnote)&&vf(e.endnote,t.endnote)}function Dc(){let e=H(),t=rt.useCallback(n=>e?.getNotePropertiesState()??null,[e]);return q(t,s1)}var c1=/^(footnote|endnote):(-?\d{1,10})$/;function xf(e){let t=c1.exec(e);if(!t)return null;let n=Number(t[2]);return Number.isInteger(n)?{noteKind:t[1],noteId:n}:null}function d1(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function Lc(e){let t=H();return rt.useMemo(()=>{if(!t)return {enabled:false,reason:"editor is not ready"};let n=t.can(e);return n.ok?{enabled:true,reason:null}:{enabled:false,reason:n.reason}},[t,e])}function u1(e){let{t}=_(),[n,o]=rt.useState(false),r=rt.useRef(null);return rt.useEffect(()=>{if(!n)return;let i=a=>{r.current?.contains(a.target)||o(false);};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),jsxRuntime.jsxs("div",{ref:r,className:"docx-hf-chrome__options",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-context-bar__options-trigger","data-testid":"docx-notes-options","aria-expanded":n,"aria-haspopup":"menu",onMouseDown:O,onClick:()=>o(i=>!i),children:t("headerFooter.options")}),n?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:O,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-properties",onClick:()=>{e.onOpenProperties(),o(false);},children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item","data-testid":"docx-notes-close",onClick:()=>{e.onClose(),o(false);},children:t("common.close")})]}):null]})}function Ri({className:e}){let{t}=_(),n=H(),o=_c(),[r,i]=rt.useState(null),[a,l]=rt.useState(null),[c,s]=rt.useState(false),d=rt.useRef(null),u=rt.useCallback(E=>{if(!o)return null;let D=[...E.querySelectorAll("[data-docx-note-scope]")].find(F=>F.matches("[data-docx-note]")&&F.dataset.docxNoteScope===o.id)??null;return D?.closest("[data-docx-notes]")??D},[o]),m=Vr(u,"story-label"),g=rt.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=null,i(null);},[]);rt.useEffect(()=>{if(!n)return;let E=document.querySelector(".docx-pages");if(!E)return;let w=A=>{let I=A.target;if(!I)return;let N=I.closest("[data-docx-note-ref]");if(N?.dataset.docxNoteScope){A.preventDefault(),g(),l(null),n.setActiveScope({kind:"note",id:N.dataset.docxNoteScope});return}I.closest("[data-docx-note-mark-back]")&&(A.preventDefault(),g(),l(null),n.setActiveScope({kind:"body"}));},D=A=>{let I=A,R=I.target?.closest("[data-docx-note-scope]");R?.dataset.docxNoteScope&&(I.preventDefault(),l({scopeId:R.dataset.docxNoteScope,x:I.clientX,y:I.clientY}));},F=A=>{if(d1())return;let N=A.target?.closest("[data-docx-note-ref]");if(!N?.dataset.docxNoteScope){g();return}let R=N.dataset.docxNoteScope,ae=n.getNotePreviewText(R)??N.getAttribute("aria-description")??t("notes.previewFallback"),z=N.getBoundingClientRect();d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{i({scopeId:R,text:ae,x:z.left,y:z.bottom+4});},400);};return E.addEventListener("click",w),E.addEventListener("contextmenu",D),E.addEventListener("pointerover",F),E.addEventListener("scroll",g,true),()=>{E.removeEventListener("click",w),E.removeEventListener("contextmenu",D),E.removeEventListener("pointerover",F),E.removeEventListener("scroll",g,true),g();}},[n,g,t]);let p=rt.useCallback(E=>{n&&(n.exec(E),l(null));},[n]),f=a?xf(a.scopeId):null,b=rt.useMemo(()=>f?{type:"deleteNote",noteKind:f.noteKind,noteId:f.noteId}:null,[f]),v=rt.useMemo(()=>f?{type:"convertNote",fromKind:f.noteKind,noteId:f.noteId}:null,[f]),P=rt.useMemo(()=>f?{type:"convertAllNotes",fromKind:f.noteKind}:null,[f]),y=Lc(b??{type:"deleteNote",noteKind:"footnote",noteId:0}),S=Lc(v??{type:"convertNote",fromKind:"footnote",noteId:0}),h=Lc(P??{type:"convertAllNotes",fromKind:"footnote"}),x=rt.useMemo(()=>({position:"fixed",left:r?.x??0,top:r?.y??0,zIndex:Qe.popover,maxWidth:280,maxHeight:"40vh",overflowY:"auto",padding:"8px 10px",background:"var(--doc-popover-bg, #fff)",color:"var(--doc-popover-fg, #111)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",fontSize:12,lineHeight:1.4,pointerEvents:"none"}),[r]),T=o?xf(o.id):null,k=T?t("notes.editingRegion",{kind:T.noteKind==="footnote"?t("notes.footnoteKind"):t("notes.endnoteKind"),number:T.noteId}):null;return n?jsxRuntime.jsxs("div",{className:e,"data-docx-notes-chrome":"","data-testid":"docx-notes-chrome","aria-hidden":o?void 0:true,children:[o&&T?jsxRuntime.jsxs("div",{ref:m.ref,className:"docx-context-bar docx-notes-chrome__banner",role:"region","aria-label":t("notes.chromeAriaLabel"),"data-testid":"docx-notes-banner","data-note-scope":o.id,style:{...m.style,zIndex:Qe.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:k}),jsxRuntime.jsx(u1,{onOpenProperties:()=>s(true),onClose:()=>n.setActiveScope({kind:"body"})})]}):null,r?jsxRuntime.jsx("div",{role:"tooltip","data-testid":"docx-notes-preview",style:x,onMouseDown:E=>{E.preventDefault(),E.stopPropagation();},children:r.text}):null,a&&f?jsxRuntime.jsxs("div",{role:"menu","data-testid":"docx-notes-menu",style:{position:"fixed",left:a.x,top:a.y,zIndex:Qe.popover,minWidth:160,background:"var(--doc-popover-bg, #fff)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",padding:4},onMouseDown:O,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-delete",disabled:!y.enabled,title:y.reason??void 0,onClick:()=>b&&p(b),children:t("notes.delete")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert",disabled:!S.enabled,title:S.reason??void 0,onClick:()=>v&&p(v),children:f.noteKind==="footnote"?t("notes.convertToEndnote"):t("notes.convertToFootnote")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert-all",disabled:!h.enabled,title:h.reason??void 0,onClick:()=>P&&p(P),children:f.noteKind==="footnote"?t("notes.convertAllFootnotes"):t("notes.convertAllEndnotes")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",onClick:()=>s(true),children:t("dialogs.footnoteProperties.title")})]}):null,c?jsxRuntime.jsx(p1,{onClose:()=>s(false),onApply:E=>{p(E),s(false);}}):null]}):null}function p1(e){let{t}=_(),n=H(),o=Dc(),[r,i]=rt.useState("document"),[a,l]=rt.useState("decimal"),[c,s]=rt.useState("continuous"),[d,u]=rt.useState("pageBottom"),[m,g]=rt.useState("decimal"),[p,f]=rt.useState("continuous"),[b,v]=rt.useState("docEnd");rt.useEffect(()=>{o&&(l(o.footnote.resolved.numFmt),s(o.footnote.resolved.numRestart),u(o.footnote.resolved.pos),g(o.endnote.resolved.numFmt),f(o.endnote.resolved.numRestart),v(o.endnote.resolved.pos));},[o]);let P=!o?.footnote.documentAuthored&&!o?.footnote.sectionAuthored,y=!o?.endnote.documentAuthored&&!o?.endnote.sectionAuthored;return jsxRuntime.jsx("div",{className:"docx-note-properties",role:"dialog","aria-modal":"true","aria-label":t("dialogs.footnoteProperties.title"),"data-testid":"docx-notes-properties-dialog",style:{zIndex:Qe.modal},onClick:e.onClose,onKeyDown:S=>{S.key==="Escape"&&e.onClose();},children:jsxRuntime.jsxs("div",{className:"docx-note-properties__panel",onClick:S=>S.stopPropagation(),onMouseDown:S=>S.stopPropagation(),children:[jsxRuntime.jsx("h2",{className:"docx-note-properties__title",children:t("dialogs.footnoteProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-note-properties__body",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__scope",children:[jsxRuntime.jsx("span",{children:t("notes.scope")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:r,onChange:S=>i(S.target.value),children:[jsxRuntime.jsx("option",{value:"document",children:t("notes.scopeDocument")}),jsxRuntime.jsx("option",{value:"section",children:t("notes.scopeSection")})]})]}),jsxRuntime.jsxs("fieldset",{className:"docx-note-properties__section",children:[jsxRuntime.jsxs("legend",{className:"docx-note-properties__legend",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.footnotes")}),P?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:a,onChange:S=>l(S.target.value),children:[jsxRuntime.jsx("option",{value:"decimal",children:t("dialogs.footnoteProperties.formats.decimal")}),jsxRuntime.jsx("option",{value:"lowerRoman",children:t("dialogs.footnoteProperties.formats.lowerRoman")}),jsxRuntime.jsx("option",{value:"upperRoman",children:t("dialogs.footnoteProperties.formats.upperRoman")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numbering")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:c,onChange:S=>s(S.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsxRuntime.jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsxRuntime.jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.position")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:d,onChange:S=>u(S.target.value),children:[jsxRuntime.jsx("option",{value:"pageBottom",children:t("dialogs.footnoteProperties.footnotePositions.bottomOfPage")}),jsxRuntime.jsx("option",{value:"beneathText",children:t("dialogs.footnoteProperties.footnotePositions.belowText")})]})]})]})]}),jsxRuntime.jsxs("fieldset",{className:"docx-note-properties__section",children:[jsxRuntime.jsxs("legend",{className:"docx-note-properties__legend",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.endnotes")}),y?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:m,onChange:S=>g(S.target.value),children:[jsxRuntime.jsx("option",{value:"decimal",children:t("dialogs.footnoteProperties.formats.decimal")}),jsxRuntime.jsx("option",{value:"lowerRoman",children:t("dialogs.footnoteProperties.formats.lowerRoman")}),jsxRuntime.jsx("option",{value:"upperRoman",children:t("dialogs.footnoteProperties.formats.upperRoman")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numbering")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:p,onChange:S=>f(S.target.value),children:[jsxRuntime.jsx("option",{value:"continuous",children:t("dialogs.footnoteProperties.numberingOptions.continuous")}),jsxRuntime.jsx("option",{value:"eachSect",children:t("dialogs.footnoteProperties.numberingOptions.restartSection")}),jsxRuntime.jsx("option",{value:"eachPage",children:t("dialogs.footnoteProperties.numberingOptions.restartPage")})]})]}),jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.position")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:b,"data-testid":"docx-notes-endnote-position",onChange:S=>v(S.target.value),children:[jsxRuntime.jsx("option",{value:"docEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfDocument")}),jsxRuntime.jsx("option",{value:"sectEnd",children:t("dialogs.footnoteProperties.endnotePositions.endOfSection")})]})]})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__footer",children:[jsxRuntime.jsx("button",{className:"docx-note-properties__button",type:"button",onClick:e.onClose,children:t("common.cancel")}),jsxRuntime.jsx("button",{className:"docx-note-properties__button docx-note-properties__button--primary",type:"button","data-testid":"docx-notes-properties-apply",onClick:()=>{if(!n)return;let S={type:"setNoteProperties",scope:r,sectionIndex:r==="section"?o?.sectionIndex:void 0,footnote:{numFmt:a,numRestart:c,position:d},endnote:{numFmt:m,numRestart:p,position:b}};n.can(S).ok&&e.onApply(S);},children:t("common.apply")})]})]})})}var Mi=rt.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function Ao(){return rt.useContext(Mi)}function Cf(){return rt.useContext(Mi).target}var Pf=["M760-120 480-400l-94 94q8 15 11 32t3 34q0 66-47 113T240-80q-66 0-113-47T80-240q0-66 47-113t113-47q17 0 34 3t32 11l94-94-94-94q-15 8-32 11t-34 3q-66 0-113-47T80-720q0-66 47-113t113-47q66 0 113 47t47 113q0 17-3 34t-11 32l494 494v40H760ZM600-560l-80-80 240-240h120v40L600-560ZM240-640q33 0 56.5-23.5T320-720q0-33-23.5-56.5T240-800q-33 0-56.5 23.5T160-720q0 33 23.5 56.5T240-640Zm240 180q8 0 14-6t6-14q0-8-6-14t-14-6q-8 0-14 6t-6 14q0 8 6 14t14 6Zm-240 300q33 0 56.5-23.5T320-240q0-33-23.5-56.5T240-320q-33 0-56.5 23.5T160-240q0 33 23.5 56.5T240-160Z"],Ef=["M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"],wf=["M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h168q13-36 43.5-58t68.5-22q38 0 68.5 22t43.5 58h168q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560h-80v120H280v-120h-80v560Zm280-560q17 0 28.5-11.5T520-800q0-17-11.5-28.5T480-840q-17 0-28.5 11.5T440-800q0 17 11.5 28.5T480-760Z"],kf=["M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"],Rf=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],Mf=["M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"],If=["M280-280v-400h400v400H280Zm80-80h240v-240H360v240ZM200-120q-33 0-56.5-23.5T120-200h80v80Zm-80-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160q0-33 23.5-56.5T200-840v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80v80h-80Zm0-640v-80h80v80h-80Zm160 640v-80h80q0 33-23.5 56.5T760-120Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80h80v80h-80Zm0-160v-80q33 0 56.5 23.5T840-760h-80Z"];function Ii(e,t,n){return Object.assign(({icon:r,labelKey:i,shortcutKey:a,className:l,hidden:c})=>{let s=H(),{close:d}=Ao(),u=Fe(),{isEnabled:m,disabledReason:g}=le(t);return c?null:jsxRuntime.jsx(Be,{slot:e,icon:r??re(n.paths),shortcut:u(a??n.shortcutKey),disabled:!m,...g?{title:g}:{},onSelect:()=>{s?.exec(t),d(true);},...l?{className:l}:{},children:u(i??n.labelKey)})},{docxRow:e})}var Gr=Ii("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:Pf}),jr=Ii("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:Ef}),Yr=Ii("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:kf}),Xr=Ii("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:If});function vn({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let i=H(),{close:a,clipboardRefusal:l,reportClipboardRefusal:c}=Ao(),s=Fe(),d=rt.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:u,disabledReason:m}=le(d);if(r)return null;let g=l!==null;return jsxRuntime.jsx(Be,{slot:"edit.paste",icon:e??re(wf),shortcut:s(n??"contextMenu.pasteShortcut"),disabled:!u||g,...l??m?{title:l??m??""}:{},onSelect:()=>{(async()=>{try{let p=await navigator.clipboard.readText();p&&i?.exec({type:"paste",text:p});}catch(p){c(p instanceof Error?p.message:"the clipboard is not readable");}finally{a(true);}})();},...o?{className:o}:{},children:s(t??"contextMenu.paste")})}vn.docxRow="edit.paste";function Ho(e,t,n){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l,destructive:c})=>{let{close:s}=Ao(),d=Fe(),u=_i(),{isEnabled:m,disabledReason:g,execute:p}=le(t);return l||!u?null:jsxRuntime.jsx(Be,{slot:e,icon:r??re(n.paths),disabled:!m,...g?{title:g}:{},className:`${c??n.destructive?"docx-table-chrome__destructive-row":""}${a?` ${a}`:""}`,onSelect:()=>{p()&&s(true);},children:d(i??n.labelKey)})},{docxRow:e})}var yn=Ho("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),xn=Ho("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),Sn=Ho("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),Tn=Ho("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),Cn=Ho("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),Pn=Ho("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),En=Ho("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),g1=[{alignment:"top",labelKey:"tableAdvanced.top",icon:"vertical_align_top"},{alignment:"center",labelKey:"tableAdvanced.middle",icon:"vertical_align_center"},{alignment:"bottom",labelKey:"tableAdvanced.bottom",icon:"vertical_align_bottom"}];function Oo({hidden:e}){let{close:t}=Ao(),n=Fe(),o=_i(),r=le({type:"setTableCellVerticalAlignment",alignment:"top"}),i=le({type:"setTableCellVerticalAlignment",alignment:"center"}),a=le({type:"setTableCellVerticalAlignment",alignment:"bottom"}),l=[r,i,a];return e||!o?null:jsxRuntime.jsxs("div",{className:"docx-contextmenu__table-align",children:[jsxRuntime.jsx("span",{className:"docx-contextmenu__table-align-label",children:n("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{className:"docx-contextmenu__table-align-buttons",role:"group","aria-label":n("tableAdvanced.verticalAlignment"),children:g1.map((c,s)=>{let d=l[s];return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":false,"aria-label":n(c.labelKey),title:d.disabledReason??n(c.labelKey),"aria-disabled":!d.isEnabled,className:"docx-contextmenu__table-align-button",onMouseDown:u=>{u.preventDefault(),u.stopPropagation();},onClick:()=>{d.execute()&&t(true);},children:re(editor.tableChromeIconPaths(c.icon))},c.alignment)})})]})}Oo.docxRow="table.cellVerticalAlignment";function Df(e,t,n){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l})=>{let c=H(),{close:s,tocId:d}=Ao(),u=Fe(),m=rt.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:g,disabledReason:p}=le(m);return l||d===null?null:jsxRuntime.jsx(Be,{slot:e,icon:r??re(n.paths),disabled:!g,...p?{title:p}:{},onSelect:()=>{c?.exec(m),s(true);},...a?{className:a}:{},children:u(i??n.labelKey)})},{docxRow:e})}var wn=Df("toc.refresh","entire",{labelKey:"toc.refresh",paths:Rf}),kn=Df("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:Mf});function _i(){return q(rt.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function Di({label:e,icon:t,shortcut:n,disabled:o,disabledReason:r,active:i,onSelect:a,className:l}){let{close:c}=Ao();return jsxRuntime.jsx(Be,{...t?{icon:t}:{},...n?{shortcut:n}:{},...o?{disabled:o}:{},...o&&r?{title:r}:{},...i!==void 0?{active:i}:{},onSelect:()=>{a?.(),c(true);},...l?{className:l}:{},children:e})}var Fi=8,y1=e=>e.editingMode==="viewing";function x1(){let e=H(),t=rt.useContext(ft),n=nt(),o=Fe(),r=e?.can({type:"toggleReviewPane"}),i=q(y1),a=!r?.ok||i||(t?.mounted??0)===0||e?.getSelectionPlacement()===null,l=J("review.comments");return jsxRuntime.jsx(Be,{icon:re(l?.paths),slot:"review.comments",disabled:a,title:r&&!r.ok?r.reason:i?o("editingMode.viewingHint"):void 0,onSelect:()=>{t?.requestCommentDraft()&&n.setOpenMenu(null);},children:o("comments.addComment")})}var S1=[{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(Gr,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(jr,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(vn,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(Yr,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(Xr,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(Ot,{slot:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.comments",render:()=>jsxRuntime.jsx(x1,{})}];function T1(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:yn.docxRow,render:()=>jsxRuntime.jsx(yn,{})},{kind:"row",id:xn.docxRow,render:()=>jsxRuntime.jsx(xn,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:Sn.docxRow,render:()=>jsxRuntime.jsx(Sn,{})},{kind:"row",id:Tn.docxRow,render:()=>jsxRuntime.jsx(Tn,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:Cn.docxRow,render:()=>jsxRuntime.jsx(Cn,{})},{kind:"row",id:Pn.docxRow,render:()=>jsxRuntime.jsx(Pn,{})},{kind:"row",id:En.docxRow,render:()=>jsxRuntime.jsx(En,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:Oo.docxRow,render:()=>jsxRuntime.jsx(Oo,{})}]}function C1(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:wn.docxRow,render:()=>jsxRuntime.jsx(wn,{})},{kind:"row",id:kn.docxRow,render:()=>jsxRuntime.jsx(kn,{})}]}function P1(e,t=false){return [...S1,...e?T1():[],...t?C1():[]]}function Hf(e){if(!rt.isValidElement(e))return null;let t=tn(e,Hf);if(t!==null)return t;let n=e.type;if(typeof n!="function"&&typeof n!="object")return null;if(typeof n.docxRow=="string")return n.docxRow;if(typeof n.docxSlot=="string")return n.docxSlot;if(n.docxMenuRow===true){let o=e.props.slot;if(typeof o=="string")return o}return null}function Ff(e){if(!rt.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function E1(e){return e?.closest(".docx-editor__scroll-container")??null}function Qr({className:e,t,preset:n=true,disabled:o,onOpenChange:r,children:i}){let a=ot(),l=H(),{t:c}=_(),s=_i(),d=rt.useRef(null),u=rt.useRef(null),[m,g]=rt.useState(null),[p,f]=rt.useState(null),[b,v]=rt.useState(null),P=rt.useMemo(()=>P1(s,p!==null),[s,p]),[y,S]=rt.useState(null),h=rt.useCallback((A=false)=>{g(null),S(null),f(null),v(null),A&&l?.focus();},[l]);rt.useEffect(()=>{if(o)return;let A=E1(d.current);if(!A)return;let I=N=>{N.preventDefault();let R=N.button===-1||N.clientX===0&&N.clientY===0,M=A.getBoundingClientRect();f(l?.snapshot().tocContext?.id??null),v(R||!(N.target instanceof HTMLElement)?null:N.target),g(R?{x:M.left+16,y:M.top+16}:{x:N.clientX,y:N.clientY});};return A.addEventListener("contextmenu",I),()=>A.removeEventListener("contextmenu",I)},[o,l]),rt.useEffect(()=>{o&&h();},[o,h]),rt.useEffect(()=>{if(!m)return;let A=R=>{u.current?.contains(R.target)||h();},I=R=>{R.key==="Escape"?(R.preventDefault(),h(true)):R.key==="Tab"&&h();},N=()=>h();return document.addEventListener("pointerdown",A,true),document.addEventListener("keydown",I),document.addEventListener("scroll",N,{capture:true,passive:true}),window.addEventListener("blur",N),window.addEventListener("resize",N),()=>{document.removeEventListener("pointerdown",A,true),document.removeEventListener("keydown",I),document.removeEventListener("scroll",N,true),window.removeEventListener("blur",N),window.removeEventListener("resize",N);}},[m,h]),rt.useLayoutEffect(()=>{let A=u.current;if(!m||!A)return;let{width:I,height:N}=A.getBoundingClientRect(),R=window.innerWidth-I-Fi,M=window.innerHeight-N-Fi,ae=Math.max(Fi,m.x>R?m.x-I:m.x),z=Math.max(Fi,m.y>M?m.y-N:m.y);S({x:ae,y:z});},[m]),rt.useLayoutEffect(()=>{y&&u.current?.focus({preventScroll:true});},[y]);let x=rt.useRef(r);x.current=r;let T=rt.useRef(false);rt.useEffect(()=>{let A=m!==null;A!==T.current&&(T.current=A,x.current?.(A));},[m]);let k=rt.useMemo(()=>({t,openMenu:null,setOpenMenu:()=>h(true),activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onParagraphDialog:void 0,onReportIssue:void 0,reportIssue:void 0}),[t,h]),[E,w]=rt.useState(null),D=rt.useMemo(()=>({close:h,anchor:m,tocId:p,target:b,clipboardRefusal:E,reportClipboardRefusal:w}),[h,m,p,b,E]),F={position:"fixed",left:(y??m)?.x??0,top:(y??m)?.y??0,visibility:y?"visible":"hidden"};return jsxRuntime.jsx("div",{ref:d,style:{display:"contents"},children:m?jsxRuntime.jsx(Cr.Provider,{value:k,children:jsxRuntime.jsx(Mi.Provider,{value:D,children:jsxRuntime.jsxs("div",{ref:u,role:"menu","aria-label":t?.("contextMenu.ariaLabel")??c("contextMenu.ariaLabel"),tabIndex:-1,className:`${a}docx-toolbar__menu docx-contextmenu${e?` ${e}`:""}`,style:F,onKeyDown:A=>{let I=u.current;if(!I)return;let N=Co(I);A.key==="ArrowDown"?(A.preventDefault(),vt(N,document.activeElement,1)):A.key==="ArrowUp"?(A.preventDefault(),vt(N,document.activeElement,-1)):A.key==="Home"?(A.preventDefault(),yt(N,"first")):A.key==="End"&&(A.preventDefault(),yt(N,"last"));},children:[rt.Children.toArray(i).filter(Ff),_a({entries:P,children:rt.Children.toArray(i).filter(A=>!Ff(A)),preset:n,keyOfEntry:A=>A.id,keyOfChild:Hf,renderEntry:A=>A.kind==="separator"?jsxRuntime.jsx(ko,{}):A.render()})]})})}):null})}var Hc=Object.assign(Qr,{Cut:Gr,Copy:jr,Paste:vn,Delete:Yr,SelectAll:Xr,InsertRowAbove:yn,InsertRowBelow:xn,InsertColumnLeft:Sn,InsertColumnRight:Tn,DeleteTableRow:Cn,DeleteTableColumn:Pn,DeleteTable:En,CellVerticalAlignment:Oo,RefreshToc:wn,RefreshTocPageNumbers:kn,Item:Di,Slot:Ot,Row:Be,Group:wr,Separator:ko,Submenu:wo});function Oc(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var Bf=e=>jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:16,height:16,"aria-hidden":"true",focusable:"false",children:jsxRuntime.jsx("path",{d:e,fill:"currentColor"})}),M1="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z",I1="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z",_1={position:"absolute",zIndex:20,minWidth:240,maxWidth:320,top:12,right:12,padding:12,borderRadius:8,border:"1px solid var(--doc-border)",backgroundColor:"var(--doc-surface)",boxShadow:"0 4px 16px var(--doc-shadow)",color:"var(--doc-text)",fontSize:13,display:"flex",flexDirection:"column",gap:10},D1={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},N1={color:"var(--doc-text-muted)",flexShrink:0},L1={textAlign:"right",wordBreak:"break-word"},F1={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},A1={display:"flex",gap:8,marginTop:4},Zf={display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:4,border:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",color:"var(--doc-text)",font:"inherit",cursor:"pointer"};function H1(e){switch(e){case "plainText":return "contentControl.types.plainText";case "checkbox":return "contentControl.types.checkbox";case "dropdown":return "contentControl.types.dropdown";case "comboBox":return "contentControl.types.comboBox";case "date":return "contentControl.types.date";case "picture":return "contentControl.types.picture";case "repeatingSection":return "contentControl.types.repeatingSection";default:return "contentControl.types.richText"}}function O1(e){return e.effectiveLock==="sdtContentLocked"?"contentControl.lock.sdtContentLocked":e.effectiveLock==="contentLocked"||e.locked?"contentControl.lock.contentLocked":e.effectiveLock==="sdtLocked"||e.removalLocked?"contentControl.lock.sdtLocked":"contentControl.lock.unlocked"}function Rn({label:e,value:t,testId:n}){return jsxRuntime.jsxs("div",{style:D1,"data-testid":n,children:[jsxRuntime.jsx("span",{style:N1,children:e}),jsxRuntime.jsx("span",{style:L1,children:t})]})}function B1({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let i=Et(),a=rt.useRef(null),l=rt.useId(),{t:c}=_(),{control:s,inspectorOpen:d,closeInspector:u}=i;if(rt.useEffect(()=>{if(!d)return;let f=v=>{v.key==="Escape"&&(v.preventDefault(),u());},b=v=>{let P=a.current;P&&v.target instanceof Node&&P.contains(v.target)||u();};return document.addEventListener("keydown",f),document.addEventListener("mousedown",b,true),()=>{document.removeEventListener("keydown",f),document.removeEventListener("mousedown",b,true);}},[d,u]),rt.useEffect(()=>{d&&!s&&u();},[d,s,u]),n||!d||!s)return null;let m=r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qf,{}),jsxRuntime.jsx(Kf,{}),jsxRuntime.jsx("div",{style:A1,children:jsxRuntime.jsx(zf,{})}),o]}):o,g={ref:a,role:"dialog","aria-modal":false,"aria-labelledby":l,"data-testid":"content-control-inspector","data-control-id":s.id,"data-control-type":s.controlType,...s.locked?{"data-locked":""}:{},...s.bound?{"data-bound":""}:{},...s.placeholder?{"data-placeholder":""}:{},className:`docx-content-control-inspector${e?` ${e}`:""}`,style:_1,onMouseDown:f=>{Oc(f),f.stopPropagation();}},p=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{id:l,className:"docx-editor-sr-only",children:c("contentControl.inspectorPanel.title")}),m]});return t?jsxRuntime.jsx(j,{...g,children:p}):jsxRuntime.jsx("div",{...g,children:p})}function qf({className:e,asChild:t,hidden:n,children:o}){let{closeInspector:r}=Et(),{t:i}=_();if(n)return null;let a={style:F1,className:e??void 0,"data-testid":"content-control-inspector-header"},l=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:o??i("contentControl.inspectorPanel.title")}),jsxRuntime.jsx("button",{type:"button","data-testid":"content-control-inspector-close","aria-label":i("common.close"),title:i("common.close"),style:{...Zf,padding:4,border:"none",background:"transparent"},onMouseDown:Oc,onClick:()=>r(),children:Bf(M1)})]});return t?jsxRuntime.jsx(j,{...a,children:l}):jsxRuntime.jsx("div",{...a,children:l})}function Kf({className:e,asChild:t,hidden:n,children:o}){let{control:r}=Et(),{t:i}=_();if(n||!r)return null;let a=i("contentControl.inspectorPanel.empty"),l=i("contentControl.inspectorPanel.yes"),c=i("contentControl.inspectorPanel.no"),s=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Rn,{label:i("contentControl.inspectorPanel.alias"),value:r.alias??a,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(Rn,{label:i("contentControl.inspectorPanel.tag"),value:r.tag??a,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(Rn,{label:i("contentControl.inspectorPanel.type"),value:i(H1(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(Rn,{label:i("contentControl.inspectorPanel.lock"),value:i(O1(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(Rn,{label:i("contentControl.inspectorPanel.placeholder"),value:r.placeholder?l:c,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(Rn,{label:i("contentControl.inspectorPanel.bound"),value:r.bound?l:c,testId:"content-control-inspector-bound"}),r.bound?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-bound-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},children:i("contentControl.inspectorPanel.boundNote")}):null,r.locked?jsxRuntime.jsx("p",{"data-testid":"content-control-inspector-locked-note",style:{margin:0,color:"var(--doc-text-muted)",fontSize:12},"aria-live":"polite",children:i("contentControl.inspectorPanel.lockedNote")}):null]}),d={className:e??void 0,"data-testid":"content-control-inspector-fields",style:{display:"flex",flexDirection:"column",gap:8}};return t?jsxRuntime.jsx(j,{...d,children:s}):jsxRuntime.jsx("div",{...d,children:s})}function zf({className:e,asChild:t,hidden:n,icon:o,children:r}){let{canRemove:i,removeDisabledReason:a,remove:l,closeInspector:c}=Et(),{t:s}=_();if(n)return null;let d=s("contentControl.remove"),u={type:"button",className:`docx-content-control-inspector__remove${e?` ${e}`:""}`,"data-testid":"content-control-inspector-remove","data-slot":"contentControl.remove",disabled:!i,...i?{}:{"data-disabled":""},"aria-label":d,title:a??d,style:Zf,onMouseDown:Oc,onClick:()=>{l().ok&&c();}},m=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o??r??Bf(I1),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(j,{...u,children:m}):jsxRuntime.jsx("button",{...u,children:m})}var Ai=Object.assign(B1,{Header:qf,Fields:Kf,Remove:zf});var z1={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},$1={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},V1={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},U1={flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",scrollbarGutter:"stable both-edges",backgroundColor:"var(--doc-bg)"},W1={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},G1={flex:"none",display:"flex",flexDirection:"column",position:"relative",zIndex:30,backgroundColor:"var(--doc-surface)",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:"var(--doc-border)",boxShadow:"0 1px 3px var(--doc-shadow-subtle)"},j1={padding:"8px 12px"},Y1={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},X1={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},J1={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function Q1({forwardedRef:e}){let t=H(),n=rt.useRef(null);return n.current=t,eu({ref:e,editorRef:n}),null}var eE=rt.forwardRef(function(t,n){let{document:o,fonts:r,className:i,t:a,chrome:l=true,title:c,onTitleChange:s,renderTitleBarLeft:d,renderTitleBarRight:u,colorMode:m="light",author:g,locale:p,mode:f="edit",modules:b,zoom:v,zoomMode:P,onReady:y,onChange:S,onFontError:h,onOpen:x,onSave:T,hyperlinkPopup:k,contextMenu:E=true,menu:w=true,navigation:D=true,rulers:F=true}=t,[A,I]=rt.useState(pd);rt.useEffect(()=>{if(m==="system")return fd(I)},[m]);let N=md(m,A),{t:R}=_(),M=rt.useCallback((V,oe)=>a?a(V,oe):R(V,oe),[a,R]),ae=jsxRuntime.jsxs(ka,{className:l?N?"dark":void 0:i,style:l?$1:void 0,children:[l?jsxRuntime.jsx(Ei,{}):null,l?jsxRuntime.jsx(Ri,{}):null,jsxRuntime.jsx(va,{}),jsxRuntime.jsx(ki,{hidden:k===false}),E===false?null:jsxRuntime.jsx(Qr,{t:M,...typeof E=="object"?E:{}}),jsxRuntime.jsx(Ai,{}),F&&l?jsxRuntime.jsx("div",{style:W1,"aria-hidden":"true",children:jsxRuntime.jsx(fi,{})}):null,t.children]}),z=l?jsxRuntime.jsxs("div",{className:`docx-editor${N?" dark":""}${i?` ${i}`:""}`,style:z1,children:[jsxRuntime.jsxs("div",{style:G1,children:[jsxRuntime.jsxs("div",{style:Y1,children:[d?.(),jsxRuntime.jsxs("div",{style:X1,children:[s?jsxRuntime.jsx("input",{"aria-label":M("titleBar.documentNameAriaLabel"),value:c??"",placeholder:M("titleBar.untitled"),onChange:V=>s(V.target.value),style:J1}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??M("titleBar.untitled")}),w!==false?jsxRuntime.jsx(Mr,{t:M,...c!==void 0?{fileName:c}:{},...x?{onOpen:x}:{},...T?{onSave:T}:{},...typeof w=="object"?w:{}}):null]}),u?.()]}),jsxRuntime.jsx("div",{style:j1,children:jsxRuntime.jsx(Sr,{t:M})})]}),F?jsxRuntime.jsx("div",{style:U1,"data-testid":"docx-editor-ruler-row",children:jsxRuntime.jsx(mi,{})}):null,jsxRuntime.jsx(Ci,{t:M}),jsxRuntime.jsxs("div",{style:V1,children:[D?jsxRuntime.jsx(xi,{t:M}):null,ae,jsxRuntime.jsx(Si.Provider,{value:M,children:jsxRuntime.jsx(Ti,{})}),jsxRuntime.jsx(xa,{overlay:true})]})]}):ae,$=rt.useCallback(V=>M(V),[M]);return jsxRuntime.jsxs(Vn,{...o!==void 0?{document:o}:{},...r?{fonts:r}:{},...g!==void 0?{author:g}:{},...p!==void 0?{locale:p}:{},translate:M,mode:f,...b!==void 0?{modules:b}:{},...v!==void 0?{zoom:v}:{},...P!==void 0?{zoomMode:P}:{},tableInteractionLabel:$,...y?{onReady:y}:{},...S?{onChange:S}:{},...h?{onFontError:h}:{},children:[jsxRuntime.jsx(Q1,{forwardedRef:n}),jsxRuntime.jsx(xo.Provider,{value:l,children:z})]})}),tE=rt.forwardRef(function(t,n){return jsxRuntime.jsx(Yo,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(eE,{...t,ref:n})})}),oE=Object.assign(tE,{Root:Vn,Viewport:ka,Content:va,Toolbar:Sr,Menu:Mr,Loading:xa,ColorByChangeType:Pl,AuthorStyle:El,HorizontalRuler:mi,VerticalRuler:fi,DocumentOutline:dc,Navigation:xi,PageSetupDialog:Tr,ParagraphDialog:So,PageNumber:Ti,FontNotice:Ci,HeaderFooterChrome:Ei,NotesChrome:Ri,HyperLink:ki,ContextMenu:Hc,ContentControl:Ai});function aE(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}async function iE(e){return typeof e=="function"?e():e}function lE(e,t={}){let[n,o]=rt.useState(void 0),[r,i]=rt.useState(void 0),[a,l]=rt.useState(null),[c,s]=rt.useState(e!=null),[d,u]=rt.useState(t.fonts===void 0),m=rt.useRef(t);return m.current=t,rt.useEffect(()=>{let g=m.current.fonts;if(g===void 0)return;let p=true;return (async()=>{try{let f=await iE(g);p&&i(editor.composeFontConfiguration(f));}catch{}finally{p&&u(true);}})(),()=>{p=false;}},[]),rt.useEffect(()=>{if(e==null){o(void 0),l(null),s(false);return}let g=aE(e);if(g){o(g),l(null),s(false);return}let p=true,f=new AbortController;return s(true),l(null),(async()=>{try{let b=await fetch(String(e),{...m.current.fetchOptions,signal:f.signal});if(!b.ok)throw new Error(`could not open the document: ${b.status} ${b.statusText}`);let v=new Uint8Array(await b.arrayBuffer());if(!p)return;o(v),s(!1);}catch(b){if(!p||b instanceof Error&&b.name==="AbortError")return;l(b instanceof Error?b:new Error("could not open the document")),s(false);}})(),()=>{p=false,f.abort();}},[e]),{document:d?n:void 0,fonts:r,error:a,isLoading:c||!d}}function uE(e,...t){let n=rt.useRef({source:e,fragments:t});return n.current={source:e,fragments:t},rt.useMemo(()=>async o=>{let r=n.current,a=[typeof r.source=="function"?await r.source(o):await r.source,...r.fragments].filter(s=>s!==void 0);if(a.length===0)return;let{epoch:l,...c}=editor.composeFontConfiguration(a[0],...a.slice(1));return c},[])}var Wf=[],fE=()=>{};function gE(){let e=H(),t=rt.useCallback(n=>{if(!e)return fE;let o=gl(n),r=e.on("change",o),i=e.on("selectionChange",o);return ()=>{r(),i();}},[e]);return rt.useSyncExternalStore(t,()=>e?.getReviewAuthors()??Wf,()=>Wf)}function vE(e){let n=e?.surface?.state?.().selection?.head;return n&&typeof n.paragraphId=="string"&&Number.isFinite(n.offset)?n:null}function yE(){let e=H(),t=rt.useRef(null),n=rt.useCallback(r=>{if(!e)return ()=>{};let i=e.on("selectionChange",r),a=e.on("change",r);return ()=>{i(),a();}},[e]),o=rt.useCallback(()=>{let r=vE(e),i=t.current;return (r===null?i===null:i!==null&&xE(i,r))?i:(t.current=r,r)},[e]);return rt.useSyncExternalStore(n,o,()=>null)}function xE(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}function Bc({source:e,scale:t,measurer:n,onStateChange:o,onError:r,className:i,documentFontFamily:a,ref:l}){let c=rt.useRef(null),s=rt.useRef(null),[d,u]=rt.useState(null),m=rt.useRef(o);m.current=o;let g=rt.useRef(r);return g.current=r,rt.useEffect(()=>{let p=c.current;if(!p)return;let f=editor.mountPaginatedSurface(p,e,{...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onChange:v=>{u(v),m.current?.(v);}});if(!f.ok){g.current?.(f.reason,f.detail);return}s.current=f.surface;let b=f.surface.state();return u(b),m.current?.(b),()=>{f.surface.destroy(),s.current=null;}},[e,n]),rt.useImperativeHandle(l,()=>({focus:()=>s.current?.focus(),type:p=>s.current?.type(p),undo:()=>s.current?.undo(),redo:()=>s.current?.redo(),selectAll:()=>s.current?.selectAll(),navigate:(p,f)=>s.current?.navigate(p,f),toggleRunProperty:(p,f)=>s.current?.toggleRunProperty(p,f),setRunProperty:(p,f)=>s.current?.setRunProperty(p,f),setParagraphProperty:(p,f,b)=>s.current?.setParagraphProperty(p,f,b),formatting:()=>s.current?.formatting()??null,sectionProperties:()=>s.current?.sectionProperties()??null,save:()=>{let p=s.current;return p?(p.flushPendingInput(),p.session.save()):null}}),[]),jsxRuntime.jsx("div",{ref:c,style:{margin:"24px auto",...a?{fontFamily:a}:{}},className:i?`docx-paginated-surface ${i}`:"docx-paginated-surface","data-revision":d?.revision??0,"data-page-count":d?.pageCount??0})}var oa=rt.createContext(null);function jf(){let e=rt.useContext(oa);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function ME(e){return "type"in e&&e.type==="separator"}var Jf={display:"flex",alignItems:"center",gap:2,padding:"2px 8px",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",fontSize:13,fontWeight:400,color:"var(--doc-text)",whiteSpace:"nowrap",height:28,lineHeight:"28px"},IE={...Jf,background:"var(--doc-bg-hover)"},Qf={display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap"},_E={...Qf,opacity:.4,cursor:"default"},DE={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},NE={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},LE={position:"absolute",left:"100%",top:-4,marginLeft:2,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:8,zIndex:1001};function na({label:e,items:t,disabled:n,showChevron:o=false}){let[r,i]=rt.useState(false),[a,l]=rt.useState(null),c=rt.useRef(null),s=rt.useRef(null),[d,u]=rt.useState({top:0,left:0}),m=rt.useCallback(()=>{i(false),l(null);},[]);rt.useEffect(()=>{if(!r||!c.current)return;let p=c.current.getBoundingClientRect();u({top:p.bottom+2,left:p.left});},[r]),rt.useEffect(()=>{if(!r)return;function p(v){let P=v.target;c.current&&!c.current.contains(P)&&s.current&&!s.current.contains(P)&&m();}function f(v){v.key==="Escape"&&m();}function b(){m();}return document.addEventListener("mousedown",p),document.addEventListener("keydown",f),window.addEventListener("scroll",b,true),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",f),window.removeEventListener("scroll",b,true);}},[r,m]);let g=p=>{p.disabled||p.submenuContent||p.onClick&&(p.onClick(),m());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:c,type:"button",onClick:()=>!n&&i(!r),onMouseDown:p=>p.preventDefault(),disabled:n,style:r?IE:Jf,children:[e,o&&jsxRuntime.jsx(K,{name:"arrow_drop_down",size:16})]}),r&&jsxRuntime.jsx("div",{ref:s,style:{position:"fixed",top:d.top,left:d.left,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",padding:"4px 0",zIndex:1e4,minWidth:200},onMouseDown:p=>p.preventDefault(),children:t.map((p,f)=>{if(ME(p))return jsxRuntime.jsx("div",{style:DE},`sep-${f}`);let b=p;if(b.customContent)return jsxRuntime.jsx("div",{onMouseDown:y=>y.preventDefault(),children:b.customContent},b.label);let v=!!b.submenuContent,P=a===b.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>v&&l(b.label),onMouseLeave:()=>v&&l(null),children:[jsxRuntime.jsxs("button",{type:"button",style:b.disabled?_E:Qf,onClick:()=>g(b),onMouseDown:y=>y.preventDefault(),onMouseOver:y=>{b.disabled||(y.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:y=>{y.currentTarget.style.backgroundColor="transparent";},disabled:b.disabled,children:[b.icon&&jsxRuntime.jsx(K,{name:b.icon,size:18}),jsxRuntime.jsx("span",{children:b.label}),b.shortcut&&jsxRuntime.jsx("span",{style:NE,children:b.shortcut}),v&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(K,{name:"keyboard_arrow_right",size:16})})]}),v&&P&&jsxRuntime.jsx("div",{style:LE,onMouseDown:y=>y.preventDefault(),children:b.submenuContent(m)})]},b.label)})})]})}var Kc=18,AE=2,t0={width:Kc,height:Kc,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},HE={...t0,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},OE={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function o0({onInsert:e,gridRows:t=6,gridColumns:n=6}){let[o,r]=rt.useState(0),[i,a]=rt.useState(0),l=rt.useCallback(()=>{o>0&&i>0&&e(o,i);},[o,i,e]),c=[];for(let d=1;d<=t;d++)for(let u=1;u<=n;u++){let m=d<=o&&u<=i;c.push(jsxRuntime.jsx("div",{style:m?HE:t0,onMouseEnter:()=>{r(d),a(u);},onClick:l,role:"gridcell","aria-selected":m},`${d}-${u}`));}let s=o>0&&i>0?`${i} \xD7 ${o}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:AE,gridTemplateColumns:`repeat(${n}, ${Kc}px)`},onMouseLeave:()=>{r(0),a(0);},role:"grid","aria-label":"Table size selector",children:c}),jsxRuntime.jsx("div",{style:OE,children:s})]})}function KE({items:e,closeMenu:t}){return jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",minWidth:220},children:e.map(n=>{let o=!n.onClick;return jsxRuntime.jsxs("button",{type:"button",disabled:o,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 12px",border:"none",background:"transparent",cursor:o?"default":"pointer",fontSize:13,color:"var(--doc-text)",width:"100%",textAlign:"left",whiteSpace:"nowrap",opacity:o?.4:1},onMouseDown:r=>r.preventDefault(),onClick:()=>{o||(n.onClick?.(),t());},onMouseOver:r=>{o||(r.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:r=>{r.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx(K,{name:n.icon,size:18}),jsxRuntime.jsx("span",{children:n.label})]},n.label)})})}function zE(){return jsxRuntime.jsxs("svg",{width:"32",height:"40",viewBox:"0 0 32 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 0C0.9 0 0 0.9 0 2V38C0 39.1 0.9 40 2 40H30C31.1 40 32 39.1 32 38V10L22 0H2Z",fill:"#cbd5e1"}),jsxRuntime.jsx("path",{d:"M22 0L32 10H24C22.9 10 22 9.1 22 8V0Z",fill:"#94a3b8"}),jsxRuntime.jsx("rect",{x:"7",y:"18",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"23",width:"18",height:"2",rx:"1",fill:"#fff"}),jsxRuntime.jsx("rect",{x:"7",y:"28",width:"12",height:"2",rx:"1",fill:"#fff"})]})}function Bi({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function $E(e){return e.replace(/\.docx$/i,"")}function $c({value:e,onChange:t,placeholder:n,editable:o=true}){let{t:r}=_(),i=n??r("titleBar.untitled"),a=$E(e)??"";return o?jsxRuntime.jsx("input",{type:"text",value:a,onChange:l=>{let c=l.target.value;t?.(c.endsWith(".docx")?c:c+".docx");},placeholder:i,className:"text-base font-normal text-foreground bg-transparent border-0 outline-none px-2 py-0 rounded hover:bg-muted focus:bg-doc-bg-input focus:ring-1 focus:ring-ring min-w-[100px] max-w-[300px] truncate leading-tight","aria-label":r("titleBar.documentNameAriaLabel")}):jsxRuntime.jsx("span",{className:"text-base font-normal text-foreground px-2 py-0 min-w-[100px] max-w-[300px] truncate leading-tight",children:a||i})}function Zi({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function qi(){let{t:e}=_(),t=jf(),{disabled:n=false,onFormat:o,onPrint:r,onOpen:i,onSave:a,onPageSetup:l,onInsertImage:c,onInsertTable:s,showTableInsert:d=true,showHelpMenu:u=true,onInsertPageBreak:m,onInsertSectionBreakNextPage:g,onInsertSectionBreakContinuous:p,onInsertTOC:f,onWatermark:b,onRefocusEditor:v}=t,P=rt.useCallback(x=>{!n&&o&&o(x);},[n,o]),y=rt.useCallback((x,T)=>{!n&&s&&(s(x,T),requestAnimationFrame(()=>v?.()));},[n,s,v]),S=!!r||!!l,h=S||i||a;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[h&&jsxRuntime.jsx(na,{label:e("toolbar.file"),disabled:n,items:[...i?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:i}]:[],...a?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:a}]:[],...(i||a)&&S?[{type:"separator"}]:[],...r?[{icon:"print",label:e("toolbar.print"),shortcut:e("toolbar.printShortcut"),onClick:r}]:[],...l?[{icon:"settings",label:e("toolbar.pageSetup"),onClick:l}]:[]]}),jsxRuntime.jsx(na,{label:e("toolbar.format"),disabled:n,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>P("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>P("setRtl")}]}),jsxRuntime.jsx(na,{label:e("toolbar.insert"),disabled:n,items:[...c?[{icon:"image",label:e("toolbar.image"),onClick:c}]:[],...d&&s?[{icon:"grid_on",label:e("toolbar.table"),submenuContent:x=>jsxRuntime.jsx(o0,{onInsert:(T,k)=>{y(T,k),x();}})}]:[],...c||d&&s?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:x=>jsxRuntime.jsx(KE,{closeMenu:x,items:[{icon:"page_break",label:e("toolbar.pageBreak"),onClick:m},{icon:"horizontal_rule",label:e("toolbar.sectionBreakNextPage"),onClick:g},{icon:"border_horizontal",label:e("toolbar.sectionBreakContinuous"),onClick:p}]})},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:f,disabled:!f},...b?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:b}]:[]]}),u&&jsxRuntime.jsx(na,{label:e("toolbar.help"),disabled:n,items:[{label:e("toolbar.reportIssue"),onClick:()=>Pr()}]})]})}function Vc({children:e}){let t=null,n=null,o=[],r=[];rt.Children.forEach(e,a=>{rt.isValidElement(a)&&(a.type===Bi?t=a:a.type===Zi?n=a:a.type===qi?r.push(a):o.push(a));});let i=rt.useCallback(a=>{let l=a.target;l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.tagName==="SELECT"||l.tagName==="OPTION"||a.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-doc-surface pt-2 pb-1",onMouseDown:i,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx(zE,{})}),jsxRuntime.jsxs("div",{className:"flex flex-col justify-center flex-1 min-w-0 py-1",children:[o.length>0&&jsxRuntime.jsx("div",{className:"flex items-center gap-2 px-1",children:o}),r.length>0&&jsxRuntime.jsx("div",{className:"flex items-center px-1",children:r})]}),n&&jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 px-3",children:n})]})}var Ki={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},GE={black:"000000",blue:"0000FF",cyan:"00FFFF",darkBlue:"00008B",darkCyan:"008B8B",darkGray:"A9A9A9",darkGreen:"006400",darkMagenta:"8B008B",darkRed:"8B0000",darkYellow:"808000",green:"00FF00",lightGray:"D3D3D3",magenta:"FF00FF",red:"FF0000",white:"FFFFFF",yellow:"FFFF00",none:""},n0={dk1:"dk1",lt1:"lt1",dk2:"dk2",lt2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hlink:"hlink",folHlink:"folHlink",dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",hyperlink:"hlink",followedHyperlink:"folHlink",background1:"lt1",text1:"dk1",background2:"lt2",text2:"dk2",tx1:"dk1",tx2:"dk2",bg1:"lt1",bg2:"lt2"};function jE(e,t){let n=n0[t]??n0[t.toLowerCase()]??t,r=e?.colorScheme?.[n];return typeof r=="string"&&r?r:Ki[n]??"000000"}function r0(e){let t=e.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/.test(t))return t;if(/^[0-9A-F]{3}$/.test(t))return t.split("").map(n=>n+n).join("")}function Uc(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex")return `#${r0(e.value)??n}`;let o=Object.entries(t?.colorScheme??Ki).map(([i,a])=>({slot:i,hex:String(a)})),r=editor.resolveThemeColorHex(e,o);return `#${r.ok?r.hex:jE(t,e.slot)}`}function Zt(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?r0(e.value):Uc(e,t).slice(1)}function a0(e){if(!e||e==="none")return "";let t=GE[e];return t?`#${t}`:""}var YE=[{slot:"lt1",name:"Background 1"},{slot:"dk1",name:"Text 1"},{slot:"lt2",name:"Background 2"},{slot:"dk2",name:"Text 2"},{slot:"accent1",name:"Accent 1"},{slot:"accent2",name:"Accent 2"},{slot:"accent3",name:"Accent 3"},{slot:"accent4",name:"Accent 4"},{slot:"accent5",name:"Accent 5"},{slot:"accent6",name:"Accent 6"}],XE=[{type:"base",keep:1,labelSuffix:""},{type:"tint",keep:.2,labelSuffix:", Lighter 80%"},{type:"tint",keep:.4,labelSuffix:", Lighter 60%"},{type:"tint",keep:.6,labelSuffix:", Lighter 40%"},{type:"shade",keep:.75,labelSuffix:", Darker 25%"},{type:"shade",keep:.5,labelSuffix:", Darker 50%"}];function i0(e){let t=e??Ki;return XE.map(n=>YE.map(o=>{let r=t[o.slot]??Ki[o.slot]??"000000",a={hex:n.type==="base"?r.toUpperCase():n.type==="tint"?editor.applyThemeTint(r,n.keep):editor.applyThemeShade(r,n.keep),themeSlot:o.slot,label:`${o.name}${n.labelSuffix}`};return n.type==="tint"?a.tint=n.keep:n.type==="shade"&&(a.shade=n.keep),a}))}function ee(...e){return clsx.clsx(e)}var e2=classVarianceAuthority.cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),Ae=rt__namespace.forwardRef(({className:e,variant:t,size:n,...o},r)=>jsxRuntime.jsx("button",{className:ee(e2({variant:t,size:n,className:e})),ref:r,...o}));Ae.displayName="Button";function ct({content:e,children:t,side:n="bottom",delayMs:o=400}){let[r,i]=rt__namespace.useState(false),[a,l]=rt__namespace.useState({x:0,y:0}),c=rt__namespace.useRef(null),s=rt__namespace.useRef(null),d=rt__namespace.useCallback(()=>{s.current=setTimeout(()=>{if(c.current){let p=c.current.getBoundingClientRect(),f=p.left+p.width/2,b=n==="top"?p.top-8:p.bottom+8;l({x:f,y:b});}i(true);},o);},[o,n]),u=rt__namespace.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),i(false);},[]);rt__namespace.useEffect(()=>()=>{s.current&&clearTimeout(s.current);},[]);let m=t.props,g=rt__namespace.cloneElement(t,{ref:c,onMouseEnter:p=>{d(),m.onMouseEnter?.(p);},onMouseLeave:p=>{u(),m.onMouseLeave?.(p);}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g,r&&jsxRuntime.jsx("div",{className:"fixed z-50 px-2 py-1 text-xs font-medium text-white bg-foreground dark:bg-muted dark:text-foreground rounded-md shadow-lg",style:{left:a.x,top:a.y,transform:n==="top"?"translate(-50%, -100%)":n==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var to=ye__namespace.Root,oo=ye__namespace.Group,zi=ye__namespace.Value;function no({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(ye__namespace.Trigger,{className:ee("flex h-8 items-center justify-between gap-1 rounded px-2 py-1","text-sm text-foreground bg-transparent","hover:bg-muted/80 focus:outline-none focus:bg-muted/80","disabled:cursor-not-allowed disabled:opacity-50","transition-colors duration-150","[&>span]:truncate",e),onMouseDown:r=>{r.preventDefault(),n?.(r);},...o,children:[t,jsxRuntime.jsx(ye__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(a2,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function ro({className:e,children:t,position:n="popper",onCloseAutoFocus:o,...r}){let i=typeof document<"u"&&!!document.querySelector(".docx-editor.dark");return jsxRuntime.jsx(ye__namespace.Portal,{children:jsxRuntime.jsx("div",{className:ee("docx-editor",i&&"dark"),children:jsxRuntime.jsx(ye__namespace.Content,{className:ee("relative z-50 max-h-72 min-w-[8rem] overflow-hidden","rounded-lg border border-border bg-popover text-popover-foreground shadow-lg","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",e),position:n,onCloseAutoFocus:a=>{a.preventDefault(),o?.(a);},...r,children:jsxRuntime.jsx(ye__namespace.Viewport,{className:ee("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:a=>a.preventDefault(),children:t})})})})}function Zo({className:e,...t}){return jsxRuntime.jsx(ye__namespace.Label,{className:ee("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t})}function dt({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(ye__namespace.Item,{className:ee("relative flex w-full cursor-pointer select-none items-center","rounded px-2 py-1.5 text-sm text-foreground outline-none","hover:bg-muted focus:bg-muted","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onMouseDown:r=>{r.preventDefault(),n?.(r);},...o,children:[jsxRuntime.jsx(ye__namespace.ItemText,{children:t}),jsxRuntime.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:jsxRuntime.jsx(ye__namespace.ItemIndicator,{children:jsxRuntime.jsx(i2,{className:"h-4 w-4"})})})]})}function qo({className:e,...t}){return jsxRuntime.jsx(ye__namespace.Separator,{className:ee("-mx-1 my-1 h-px bg-muted",e),...t})}function a2({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})})}function i2({className:e}){return jsxRuntime.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"})})}function Wc(e){let t=e.trim();if(!t)return "";let n=null,o="";for(let r of t){if((r==='"'||r==="'")&&n===null){n=r,o+=r;continue}if(r===n){n=null,o+=r;continue}if(r===","&&n===null)break;o+=r;}return o.trim().replace(/^['"]|['"]$/g,"")}var l2=[{name:"Arial",fontFamily:"Arial, Helvetica, sans-serif",category:"sans-serif"},{name:"Calibri",fontFamily:'"Calibri", Arial, sans-serif',category:"sans-serif"},{name:"Helvetica",fontFamily:"Helvetica, Arial, sans-serif",category:"sans-serif"},{name:"Verdana",fontFamily:"Verdana, Geneva, sans-serif",category:"sans-serif"},{name:"Open Sans",fontFamily:'"Open Sans", sans-serif',category:"sans-serif"},{name:"Roboto",fontFamily:"Roboto, sans-serif",category:"sans-serif"},{name:"Times New Roman",fontFamily:'"Times New Roman", Times, serif',category:"serif"},{name:"Georgia",fontFamily:"Georgia, serif",category:"serif"},{name:"Cambria",fontFamily:"Cambria, Georgia, serif",category:"serif"},{name:"Garamond",fontFamily:"Garamond, serif",category:"serif"},{name:"Courier New",fontFamily:'"Courier New", Courier, monospace',category:"monospace"},{name:"Consolas",fontFamily:"Consolas, monospace",category:"monospace"}];function c0({value:e,onChange:t,fonts:n=l2,documentFonts:o,disabled:r=false,className:i,placeholder:a="Arial",width:l=120,showPreview:c=true}){let{t:s}=_(),d=rt__namespace.useMemo(()=>{if(!o)return [];let f=new Set(n.map(b=>b.name.toLowerCase()));return o.filter(b=>!f.has(b.name.toLowerCase()))},[o,n]),u=rt__namespace.useMemo(()=>[...d,...n],[d,n]),m=rt__namespace.useMemo(()=>e?u.find(b=>b.fontFamily===e||b.name.toLowerCase()===e.toLowerCase()||Wc(b.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:a,[e,u,a]),g=rt__namespace.useCallback(f=>{let b=u.find(v=>v.name===f);b&&t?.(Wc(b.fontFamily)||b.name);},[t,u]),p=rt__namespace.useMemo(()=>{let f={"sans-serif":[],serif:[],monospace:[],other:[]};return n.forEach(b=>{let v=b.category||"other";f[v].push(b);}),f},[n]);return jsxRuntime.jsxs(to,{value:m,onValueChange:g,disabled:r,children:[jsxRuntime.jsx(no,{className:ee("h-8 text-sm",i),style:{minWidth:typeof l=="number"?`${l}px`:l},"aria-label":s("font.selectAriaLabel"),children:jsxRuntime.jsx(zi,{placeholder:a,children:m})}),jsxRuntime.jsxs(ro,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(oo,{children:[jsxRuntime.jsx(Zo,{children:s("font.documentFonts")}),d.map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},`doc-${f.name}`))]}),jsxRuntime.jsx(qo,{})]}),p["sans-serif"].length>0&&jsxRuntime.jsxs(oo,{children:[jsxRuntime.jsx(Zo,{children:s("font.sansSerif")}),p["sans-serif"].map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]}),p.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qo,{}),jsxRuntime.jsxs(oo,{children:[jsxRuntime.jsx(Zo,{children:s("font.serif")}),p.serif.map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]})]}),p.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qo,{}),jsxRuntime.jsxs(oo,{children:[jsxRuntime.jsx(Zo,{children:s("font.monospace")}),p.monospace.map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]})]}),p.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qo,{}),jsxRuntime.jsx(oo,{children:p.other.map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))})]})]})]})}function Gc(e){if(e===void 0)return;let t=e.map(n=>typeof n=="string"?{name:n,fontFamily:n,category:"other"}:n);return t}function u2(e,t,n,o){let i=Math.max(8,window.innerWidth-n-8),a=Math.max(8,window.innerHeight-o-8);return {top:Math.min(Math.max(8,e),a),left:Math.min(Math.max(8,t),i)}}function et({isOpen:e,onClose:t,align:n="left"}){let o=rt.useRef(null),r=rt.useRef(null),[i,a]=rt.useState({top:0,left:0});rt.useEffect(()=>{if(!e||!o.current)return;let s=o.current.getBoundingClientRect();n==="right"?requestAnimationFrame(()=>{if(r.current){let d=r.current.getBoundingClientRect(),u=u2(s.bottom+4,s.right-d.width,d.width,d.height);a(u);}else a({top:s.bottom+4,left:s.left});}):a({top:s.bottom+4,left:s.left});},[e,n]),rt.useEffect(()=>{if(!e)return;let s=performance.now()+150,d=g=>{let p=g.target;o.current&&!o.current.contains(p)&&r.current&&!r.current.contains(p)&&t();},u=g=>{g.key==="Escape"&&t();},m=g=>{if(performance.now()<s)return;let p=g.target;p&&r.current&&r.current.contains(p)||p instanceof Element&&p!==document.documentElement&&p!==document.body&&o.current&&p.contains(o.current)||t();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",u),window.addEventListener("scroll",m,true),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",u),window.removeEventListener("scroll",m,true);}},[e,t]);let l=rt.useCallback(s=>{s.preventDefault(),s.stopPropagation();},[]),c={position:"fixed",top:i.top,left:i.left,zIndex:1e4};return {containerRef:o,dropdownRef:r,dropdownStyle:c,handleMouseDown:l}}var f2=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],g2=1,b2=400;function p0(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function m0(e,t,n){for(let o=t.length-1;o>=0;o--)if(t[o]<e)return t[o];return Math.max(e-1,n)}function f0({value:e,onChange:t,sizes:n=f2,disabled:o=false,className:r,placeholder:i="11",minSize:a=g2,maxSize:l=b2}){let{t:c}=_(),[s,d]=rt.useState(false),[u,m]=rt.useState(""),[g,p]=rt.useState(false),f=rt.useRef(null),b=rt.useCallback(()=>{p(false),d(false);},[]),{containerRef:v,dropdownRef:P,dropdownStyle:y}=et({isOpen:g,onClose:b}),S=e??(parseInt(i,10)||11),h=e!==void 0?e.toString():i,x=rt.useCallback(I=>{if(I.preventDefault(),o)return;let N=m0(S,n,a);t?.(N);},[S,n,a,o,t]),T=rt.useCallback(I=>{if(I.preventDefault(),o)return;let N=p0(S,n,l);t?.(N);},[S,n,l,o,t]),k=rt.useCallback(I=>{I.preventDefault(),!o&&(d(true),m(h),p(true),requestAnimationFrame(()=>{f.current?.focus(),f.current?.select();}));},[o,h]),E=rt.useCallback(I=>{m(I.target.value);},[]),w=rt.useCallback(()=>{d(false);let I=parseFloat(u);if(!isNaN(I)&&I>=a&&I<=l){let N=Math.round(I*2)/2;t?.(N);}},[u,a,l,t]),D=rt.useCallback(I=>{if(I.key==="Enter")I.preventDefault(),w(),p(false);else if(I.key==="Escape")d(false),p(false);else if(I.key==="ArrowUp"){I.preventDefault();let N=p0(S,n,l);m(N.toString()),t?.(N);}else if(I.key==="ArrowDown"){I.preventDefault();let N=m0(S,n,a);m(N.toString()),t?.(N);}},[w,S,n,l,a,t]),F=rt.useCallback(I=>{t?.(I),p(false),d(false);},[t]),A=rt.useCallback(I=>{I.target.tagName!=="INPUT"&&I.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:v,className:ee("flex items-center",r),onMouseDown:A,children:[jsxRuntime.jsx(Ae,{variant:"ghost",size:"icon-sm",className:ee("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:x,disabled:o||S<=a,"aria-label":c("fontSize.decrease"),"data-testid":"font-size-decrease",children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsx("div",{className:"relative",children:s?jsxRuntime.jsx("input",{ref:f,type:"text",value:u,onChange:E,onBlur:w,onKeyDown:D,className:ee("h-7 w-10 text-center text-sm border border-input bg-doc-bg-input text-doc-text","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none"),"aria-label":c("fontSize.label"),"data-testid":"font-size-input"}):jsxRuntime.jsx("button",{type:"button",onClick:k,className:ee("h-7 w-10 text-center text-sm border border-border bg-doc-bg-input text-doc-text","hover:border-input hover:bg-doc-bg-hover","focus:outline-none focus:ring-1 focus:ring-ring","rounded-none",o&&"opacity-50 cursor-not-allowed"),disabled:o,"aria-label":c("fontSize.label"),"aria-haspopup":"listbox","aria-expanded":g,"data-testid":"font-size-display",children:h})}),g&&jsxRuntime.jsx("div",{ref:P,style:{...y,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:6,boxShadow:"0 4px 12px var(--doc-shadow)",maxHeight:240,overflowY:"auto",minWidth:60},role:"listbox","aria-label":c("fontSize.listLabel"),children:n.map(I=>jsxRuntime.jsx("button",{type:"button",onClick:()=>F(I),className:ee("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",I===S&&"bg-muted font-medium"),role:"option","aria-selected":I===S,children:I},I))}),jsxRuntime.jsx(Ae,{variant:"ghost",size:"icon-sm",className:ee("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:T,disabled:o||S>=l,"aria-label":c("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var y2=[{name:"Dark Red",nameKey:"colorPicker.colors.darkRed",hex:"C00000"},{name:"Red",nameKey:"colorPicker.colors.red",hex:"FF0000"},{name:"Orange",nameKey:"colorPicker.colors.orange",hex:"FFC000"},{name:"Yellow",nameKey:"colorPicker.colors.yellow",hex:"FFFF00"},{name:"Light Green",nameKey:"colorPicker.colors.lightGreen",hex:"92D050"},{name:"Green",nameKey:"colorPicker.colors.green",hex:"00B050"},{name:"Light Blue",nameKey:"colorPicker.colors.lightBlue",hex:"00B0F0"},{name:"Blue",nameKey:"colorPicker.colors.blue",hex:"0070C0"},{name:"Dark Blue",nameKey:"colorPicker.colors.darkBlue",hex:"002060"},{name:"Purple",nameKey:"colorPicker.colors.purple",hex:"7030A0"}],Vi=18,x2=2,S2={position:"relative",display:"inline-block"},T2={display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"32px",padding:"2px 6px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},C2={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},Xc={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},Jc={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},h0={display:"grid",gap:`${x2}px`},Ui={width:`${Vi}px`,height:`${Vi}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},v0={...Ui,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},y0={...Ui,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},P2={display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"5px 8px",border:"1px solid var(--doc-border-dark)",borderRadius:"4px",backgroundColor:"var(--doc-surface)",cursor:"pointer",fontSize:"12px",color:"var(--doc-text)"},E2={display:"flex",alignItems:"center",gap:"6px"},w2={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},k2={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},g0={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},R2={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},M2={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:0,width:"28px",padding:"2px 4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},I2={display:"flex",alignItems:"center",justifyContent:"center",width:"18px",padding:0,border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"};function Qc(e,t,n){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let o=a0(e);return o||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return Uc(e,n)}function b0(e){let t=e.replace(/^#/,"");if(t.length!==6)return false;let n=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return (n*299+o*587+r*114)/1e3>230}function x0(e,t,n){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():Zt(e,n))===t.toUpperCase():false}function _2({matrix:e,selectedColor:t,theme:n,onSelect:o}){let[r,i]=rt.useState(null);return jsxRuntime.jsx("div",{style:{...h0,gridTemplateColumns:`repeat(10, ${Vi}px)`},children:e.flatMap((a,l)=>a.map((c,s)=>{let d=`${l}-${s}`,u=r===d,m=x0(t,c.hex,n);return jsxRuntime.jsx("button",{type:"button",style:{...m?y0:u?v0:Ui,backgroundColor:`#${c.hex}`},title:c.label,"aria-label":c.label,"aria-selected":m,onClick:()=>o(c),onMouseDown:g=>g.preventDefault(),onMouseEnter:()=>i(d),onMouseLeave:()=>i(null)},d)}))})}function D2({selectedColor:e,theme:t,onSelect:n}){let[o,r]=rt.useState(null),{t:i}=_();return jsxRuntime.jsx("div",{style:{...h0,gridTemplateColumns:`repeat(10, ${Vi}px)`},children:y2.map((a,l)=>{let c=o===l,s=x0(e,a.hex,t),d=i(a.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...s?y0:c?v0:Ui,backgroundColor:`#${a.hex}`},title:d,"aria-label":d,"aria-selected":s,onClick:()=>n(a.hex),onMouseDown:u=>u.preventDefault(),onMouseEnter:()=>r(l),onMouseLeave:()=>r(null)},a.hex)})})}function $o({mode:e,value:t,onChange:n,theme:o,disabled:r=false,className:i,style:a,title:l,icon:c,autoLabel:s,splitButton:d=true,defaultColor:u}){let[m,g]=rt.useState(false),[p,f]=rt.useState(false),[b,v]=rt.useState(false),[P,y]=rt.useState(false),[S,h]=rt.useState(""),[x,T]=rt.useState(()=>u??(e==="highlight"?"FFFF00":e==="border"?{kind:"hex",value:"000000"}:{kind:"hex",value:"FF0000"})),{t:k}=_();rt.useEffect(()=>{let W=Qc(t,e,o).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(W)&&h(W.toUpperCase());},[t,e,o]);let E=rt.useCallback(()=>g(false),[]),{containerRef:w,dropdownRef:D,dropdownStyle:F}=et({isOpen:m,onClose:E}),A=o?.colorScheme??null,I=rt.useMemo(()=>i0(A),[A]),N=rt.useMemo(()=>Qc(t,e,o),[t,e,o]),R=rt.useMemo(()=>Qc(x,e,o),[x,e,o]),M=rt.useCallback(()=>{r||g(W=>!W);},[r]),ae=rt.useCallback(W=>{let B;e==="highlight"?B=W.hex:B={kind:"theme",slot:W.themeSlot,...W.tint!==void 0?{tint:W.tint}:{},...W.shade!==void 0?{shade:W.shade}:{}},T(B),n?.(B),g(false);},[e,n]),z=rt.useCallback(W=>{let B=e==="highlight"?W:{kind:"hex",value:W};T(B),n?.(B),g(false);},[e,n]),$=rt.useCallback(()=>{n?.(e==="highlight"?"none":{kind:"auto"}),g(false);},[e,n]),V=rt.useCallback(()=>{let W=S.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(W)){let B=e==="highlight"?W:{kind:"hex",value:W};T(B),n?.(B),g(false),h("");}},[e,S,n]),oe=rt.useCallback(()=>{r||n?.(x);},[r,x,n]),ne={...T2,...r?{cursor:"default",opacity:.38}:m?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:p?{backgroundColor:"var(--doc-bg-hover)"}:{}},be=k(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),he=c??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:w,className:`docx-color-picker ${i||""}`,style:{...S2,...a},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...R2,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...M2,...r?{cursor:"default"}:b?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:oe,onMouseDown:W=>W.preventDefault(),onMouseEnter:()=>v(true),onMouseLeave:()=>v(false),disabled:r,title:l||be,"aria-label":l||be,children:[jsxRuntime.jsx(K,{name:he,size:18}),jsxRuntime.jsx("div",{style:{...g0,backgroundColor:R==="transparent"?"#fff":R,outline:R==="transparent"||b0(R)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...I2,...r?{cursor:"default"}:m?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:P?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:M,onMouseDown:W=>W.preventDefault(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),disabled:r,title:l||be,"aria-label":l||be,"aria-haspopup":"true","aria-expanded":m,children:jsxRuntime.jsx(K,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:ne,onClick:M,onMouseDown:W=>W.preventDefault(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),disabled:r,title:l||be,"aria-label":l||be,"aria-haspopup":"true","aria-expanded":m,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(K,{name:he,size:18}),jsxRuntime.jsx("div",{style:{...g0,backgroundColor:N==="transparent"?"#fff":N,outline:N==="transparent"||b0(N)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14})]}),m&&jsxRuntime.jsx("div",{ref:D,className:"docx-color-picker-dropdown",style:{...F,...C2},role:"dialog","aria-label":`${be} picker`,onMouseDown:W=>{W.target.tagName!=="INPUT"&&W.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:P2,onClick:$,onMouseDown:W=>W.preventDefault(),children:[e==="highlight"?jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",border:"1px solid #ccc",borderRadius:"2px",position:"relative",backgroundColor:"#fff"},children:jsxRuntime.jsx("span",{style:{position:"absolute",top:"50%",left:"-1px",right:"-1px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"}})}):jsxRuntime.jsx("span",{style:{display:"inline-block",width:"16px",height:"16px",backgroundColor:"#000",borderRadius:"2px"}}),s??k(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:Jc}),jsxRuntime.jsx("div",{style:Xc,children:k("colorPicker.themeColors")}),jsxRuntime.jsx(_2,{matrix:I,selectedColor:t,theme:o,onSelect:ae}),jsxRuntime.jsx("div",{style:Jc}),jsxRuntime.jsx("div",{style:Xc,children:k("colorPicker.standardColors")}),jsxRuntime.jsx(D2,{selectedColor:t,theme:o,onSelect:z}),jsxRuntime.jsx("div",{style:Jc}),jsxRuntime.jsx("div",{style:Xc,children:k("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:E2,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:w2,value:S,onChange:W=>h(W.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:W=>{W.key==="Enter"&&V();},onMouseDown:W=>{W.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...k2,opacity:/^[0-9A-Fa-f]{6}$/.test(S)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(S)?"pointer":"default"},onClick:V,onMouseDown:W=>W.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(S),children:k("common.apply")})]})]})})]})}var aa=20,ed=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_left",size:aa}),iconName:"format_align_left",shortcut:"Ctrl+L"},{value:"center",label:"Center",labelKey:"alignment.center",shortcutKey:"alignment.centerShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_center",size:aa}),iconName:"format_align_center",shortcut:"Ctrl+E"},{value:"right",label:"Align Right",labelKey:"alignment.alignRight",shortcutKey:"alignment.alignRightShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_right",size:aa}),iconName:"format_align_right",shortcut:"Ctrl+R"},{value:"both",label:"Justify",labelKey:"alignment.justify",shortcutKey:"alignment.justifyShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_justify",size:aa}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function C0({value:e="left",onChange:t,disabled:n=false}){let{t:o}=_(),[r,i]=rt.useState(false),a=rt.useCallback(()=>i(false),[]),{containerRef:l,dropdownRef:c,dropdownStyle:s,handleMouseDown:d}=et({isOpen:r,onClose:a}),u=rt.useCallback(v=>{n||t?.(v),i(false);},[n,t]),m=ed.find(v=>v.value===e)||ed[0],g=o(m.labelKey),p=m.shortcutKey?o(m.shortcutKey):void 0,f=`${g}${p?` (${p})`:""}`,b=jsxRuntime.jsxs(Ae,{variant:"ghost",size:"icon-sm",className:ee("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",n&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!n&&i(v=>!v),disabled:n,"aria-label":f,"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(K,{name:m.iconName,size:aa}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:l,style:{position:"relative",display:"inline-block"},children:[r?b:jsxRuntime.jsx(ct,{content:f,children:b}),r&&!n&&jsxRuntime.jsx("div",{ref:c,style:{...s,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:v=>v.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:ed.map(v=>{let P=e===v.value,y=o(v.labelKey),S=v.shortcutKey?o(v.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${y}${S?` (${S})`:""}`,"data-testid":`alignment-${v.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:P?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:P?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:h=>h.preventDefault(),onMouseEnter:h=>{P||(h.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:h=>{h.currentTarget.style.backgroundColor=P?"var(--doc-primary-light)":"transparent";},onClick:()=>u(v.value),children:jsxRuntime.jsx(K,{name:v.iconName,size:18})},v.value)})})})]})}function Wi(){return {type:"none",level:0,isInList:false}}var H2={display:"inline-flex",alignItems:"center",gap:"4px"},P0={display:"inline-flex",alignItems:"center",gap:"4px"},Xi={display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",padding:"4px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},O2={...Xi,backgroundColor:"var(--doc-bg-hover)"},B2={...Xi,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},Z2={...Xi,cursor:"default",opacity:.38},q2={width:"28px",height:"28px",padding:"2px"},K2={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},Gi=20;function ji({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,style:a}){let[l,c]=rt.useState(false),s={...t?Z2:e?B2:l?O2:Xi,...a},d=u=>{u.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${i||""}`,style:s,onMouseDown:d,onClick:t?void 0:o,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-disabled":t||void 0,tabIndex:t?-1:void 0,title:n,"aria-label":n,"aria-pressed":e,role:"button",children:r})}function E0({listState:e,onBulletList:t,onNumberedList:n,onIndent:o,onOutdent:r,disabled:i=false,className:a,style:l,showIndentButtons:c=true,compact:s=false,hasIndent:d=false}){let{t:u}=_(),m=rt.useCallback(()=>s?{...q2}:{},[s]),g=e?.type==="bullet",p=e?.type==="numbered",b=(e?.isInList||g||p)&&(e?.level??0)>0||d;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${a||""}`,style:{...H2,...l},role:"group","aria-label":u("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:P0,role:"group","aria-label":u("lists.typeAriaLabel"),children:[jsxRuntime.jsx(ji,{active:g,disabled:i,title:u("lists.bulletList"),onClick:t,style:m(),children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:Gi})}),jsxRuntime.jsx(ji,{active:p,disabled:i,title:u("lists.numberedList"),onClick:n,style:m(),children:jsxRuntime.jsx(K,{name:"format_list_numbered",size:Gi})})]}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:K2,role:"separator"}),jsxRuntime.jsxs("div",{style:P0,role:"group","aria-label":u("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(ji,{active:false,disabled:i||!b,title:u("lists.decreaseIndent"),onClick:r,style:m(),children:jsxRuntime.jsx(K,{name:"format_indent_decrease",size:Gi})}),jsxRuntime.jsx(ji,{active:false,disabled:i,title:u("lists.increaseIndent"),onClick:o,style:m(),children:jsxRuntime.jsx(K,{name:"format_indent_increase",size:Gi})})]})]})]})}var $2=[{label:"Single",labelKey:"lineSpacing.single",value:1,twipsValue:240},{label:"1.15",value:1.15,twipsValue:276},{label:"1.5",value:1.5,twipsValue:360},{label:"Double",labelKey:"lineSpacing.double",value:2,twipsValue:480}];function k0({value:e,onChange:t,options:n=$2,disabled:o=false,className:r}){let{t:i}=_(),a=rt__namespace.useMemo(()=>e===void 0?n[0]:n.find(s=>s.twipsValue===e)||n[0],[e,n]),l=rt__namespace.useCallback(s=>{let d=parseInt(s,10);isNaN(d)||t?.(d);},[t]),c=s=>s.labelKey?i(s.labelKey):s.label;return jsxRuntime.jsxs(to,{value:a.twipsValue.toString(),onValueChange:l,disabled:o,children:[jsxRuntime.jsx(no,{className:ee("h-8 text-sm gap-0.5 px-2",r),style:{width:"auto"},"aria-label":i("lineSpacing.label"),title:i("lineSpacing.lineSpacingTitle",{label:c(a)}),children:jsxRuntime.jsx(sc,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(ro,{children:[n.map(s=>jsxRuntime.jsx(dt,{value:s.twipsValue.toString(),children:c(s)},s.twipsValue)),jsxRuntime.jsx(qo,{}),jsxRuntime.jsx(oo,{children:jsxRuntime.jsx(Zo,{children:i("lineSpacing.blockSpacingRules")})})]})]})}var R0=[{styleId:"Normal",name:"Normal text",nameKey:"styles.normalText",type:"paragraph",isDefault:true,priority:0,qFormat:true,fontSize:22},{styleId:"Title",name:"Title",nameKey:"styles.title",type:"paragraph",priority:1,qFormat:true,fontSize:52,bold:true},{styleId:"Subtitle",name:"Subtitle",nameKey:"styles.subtitle",type:"paragraph",priority:2,qFormat:true,fontSize:30,color:"666666"},{styleId:"Heading1",name:"Heading 1",nameKey:"styles.heading1",type:"paragraph",priority:3,qFormat:true,fontSize:40,bold:true},{styleId:"Heading2",name:"Heading 2",nameKey:"styles.heading2",type:"paragraph",priority:4,qFormat:true,fontSize:32,bold:true},{styleId:"Heading3",name:"Heading 3",nameKey:"styles.heading3",type:"paragraph",priority:5,qFormat:true,fontSize:28,bold:true}];function M0({value:e,onChange:t,styles:n,disabled:o=false,className:r,width:i=120}){let{t:a}=_(),l=rt__namespace.useMemo(()=>{let g=Rp(n);return g.length===0?R0:g.map(p=>({...p,type:"paragraph",nameKey:R0.find(f=>f.styleId===p.styleId)?.nameKey}))},[n]),c=rt__namespace.useCallback(g=>{t?.(g);},[t]),s=g=>g.nameKey?a(g.nameKey):g.name,d=e||"Normal",u=l.find(g=>g.styleId===d),m=u?s(u):d;return jsxRuntime.jsxs(to,{value:d,onValueChange:c,disabled:o,children:[jsxRuntime.jsx(no,{className:ee("h-8 text-sm",r),style:{width:typeof i=="number"?`${i}px`:i},"aria-label":a("styles.selectAriaLabel"),children:jsxRuntime.jsx("span",{className:"truncate",children:m})}),jsxRuntime.jsx(ro,{className:"min-w-[260px] max-h-[400px]",children:l.map(g=>jsxRuntime.jsx(dt,{value:g.styleId,className:"py-2.5 px-3",children:jsxRuntime.jsx("span",{style:kp(g),children:s(g)})},g.styleId))})]})}var U2=[{value:.5,label:"50%"},{value:.75,label:"75%"},{value:1,label:"100%"},{value:1.25,label:"125%"},{value:1.5,label:"150%"},{value:2,label:"200%"}];function _0({value:e=1,onChange:t,levels:n=U2,disabled:o=false,className:r,compact:i=false}){let{t:a}=_(),l=rt__namespace.useMemo(()=>{let g=n.find(p=>Math.abs(p.value-e)<.001);return g?g.label:`${Math.round(e*100)}%`},[n,e]),c=rt__namespace.useCallback(g=>{let p=parseFloat(g);isNaN(p)||t?.(p);},[t]),s=rt__namespace.useMemo(()=>[...n].sort((g,p)=>g.value-p.value),[n]),d=rt__namespace.useMemo(()=>[...s].reverse().find(g=>g.value<e-.001),[s,e]),u=rt__namespace.useMemo(()=>s.find(g=>g.value>e+.001),[s,e]),m=i?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Ae,{variant:"ghost",size:"icon-sm",className:ee(m,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",(o||!d)&&"opacity-30 cursor-not-allowed"),onClick:()=>d&&t?.(d.value),disabled:o||!d,"aria-label":a("zoom.zoomOut"),children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsxs(to,{value:e.toString(),onValueChange:c,disabled:o,children:[jsxRuntime.jsx(no,{className:ee(i?"h-7 min-w-[55px] text-xs":"h-8 min-w-[64px] text-sm","rounded-none",r),"aria-label":a("zoom.ariaLabel",{label:l}),children:jsxRuntime.jsx(zi,{placeholder:"100%",children:l})}),jsxRuntime.jsx(ro,{children:n.map(g=>jsxRuntime.jsx(dt,{value:g.value.toString(),children:g.label},g.value))})]}),jsxRuntime.jsx(Ae,{variant:"ghost",size:"icon-sm",className:ee(m,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(o||!u)&&"opacity-30 cursor-not-allowed"),onClick:()=>u&&t?.(u.value),disabled:o||!u,"aria-label":a("zoom.zoomIn"),children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var G2=[{action:"borderAll",icon:"border_all",labelKey:"table.borders.all"},{action:"borderOutside",icon:"border_outer",labelKey:"table.borders.outside"},{action:"borderInside",icon:"border_inner",labelKey:"table.borders.inside"},{action:"borderTop",icon:"border_top",labelKey:"table.borders.top"},{action:"borderBottom",icon:"border_bottom",labelKey:"table.borders.bottom"},{action:"borderLeft",icon:"border_left",labelKey:"table.borders.left"},{action:"borderRight",icon:"border_right",labelKey:"table.borders.right"},{action:"borderNone",icon:"border_clear",labelKey:"table.borders.none"}];function L0({onAction:e,disabled:t=false}){let{t:n}=_(),[o,r]=rt.useState(false),i=rt.useCallback(()=>r(false),[]),{containerRef:a,dropdownRef:l,dropdownStyle:c,handleMouseDown:s}=et({isOpen:o,onClose:i}),d=rt.useCallback(m=>{e(m),r(false);},[e]),u=jsxRuntime.jsxs(Ae,{variant:"ghost",size:"icon-sm",className:ee("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:s,onClick:()=>!t&&r(m=>!m),disabled:t,"aria-label":n("table.borders.styleAriaLabel"),"aria-expanded":o,"aria-haspopup":"true","data-testid":"toolbar-table-borders",children:[jsxRuntime.jsx(K,{name:"border_all",size:20}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[o?u:jsxRuntime.jsx(ct,{content:n("table.borders.tooltip"),children:u}),o&&!t&&jsxRuntime.jsx("div",{ref:l,style:{...c,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:m=>m.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:G2.map(({action:m,icon:g,labelKey:p})=>jsxRuntime.jsx("button",{type:"button",title:n(p),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:"transparent",cursor:"pointer",color:"var(--doc-text)"},onMouseDown:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(m),children:jsxRuntime.jsx(K,{name:g,size:18})},typeof m=="string"?m:m.type))})})]})}function F0({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=_(),i=rt.useCallback(a=>{if(typeof a=="string"){e({type:"borderColor",color:a.replace(/^#/,"")});return}let l=a.kind==="auto"?"000000":Zt(a,n);l&&e({type:"borderColor",color:l});},[e,n]);return jsxRuntime.jsx($o,{mode:"border",value:o,onChange:i,theme:n,disabled:t,title:r("table.borderColor")})}var J2=[{size:4,label:"0.5 pt",thickness:.5},{size:8,label:"1 pt",thickness:1},{size:12,label:"1.5 pt",thickness:1.5},{size:16,label:"2 pt",thickness:2},{size:24,label:"3 pt",thickness:3}];function H0({onAction:e,disabled:t=false}){let[n,o]=rt.useState(false),{t:r}=_(),i=rt.useCallback(()=>o(false),[]),{containerRef:a,dropdownRef:l,dropdownStyle:c,handleMouseDown:s}=et({isOpen:n,onClose:i}),d=rt.useCallback(m=>{e({type:"borderWidth",size:m}),o(false);},[e]),u=jsxRuntime.jsxs(Ae,{variant:"ghost",size:"icon-sm",className:ee("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:s,onClick:()=>!t&&o(m=>!m),disabled:t,"aria-label":r("table.borderWidth"),"aria-expanded":n,"aria-haspopup":"true","data-testid":"toolbar-table-border-width",children:[jsxRuntime.jsx(K,{name:"line_weight",size:20}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[n?u:jsxRuntime.jsx(ct,{content:r("table.borderWidth"),children:u}),n&&!t&&jsxRuntime.jsx("div",{ref:l,style:{...c,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:120},onMouseDown:m=>m.stopPropagation(),children:J2.map(({size:m,label:g,thickness:p})=>jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",width:"100%",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:12,color:"var(--doc-text)"},onMouseDown:f=>f.preventDefault(),onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},onClick:()=>d(m),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(p,1),backgroundColor:"#000",borderRadius:p>2?1:0}}),jsxRuntime.jsx("span",{children:g})]},m))})]})}function B0({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=_(),i=rt.useCallback(a=>{typeof a=="string"&&e(a==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:a.replace(/^#/,"")});},[e]);return jsxRuntime.jsx("div",{"data-testid":"toolbar-table-cell-fill",style:{display:"inline-block"},children:jsxRuntime.jsx($o,{mode:"highlight",value:o,onChange:i,theme:n,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var ew={display:"flex",alignItems:"center",gap:10,padding:"7px 14px",fontSize:13,color:"var(--doc-text)",cursor:"pointer",border:"none",backgroundColor:"transparent",width:"100%",textAlign:"left"},Wo={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},K0={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function z0({onAction:e,disabled:t=false,tableContext:n}){let{t:o}=_(),[r,i]=rt.useState(false),[a,l]=rt.useState(null),c=rt.useCallback(()=>i(false),[]),{containerRef:s,dropdownRef:d,dropdownStyle:u,handleMouseDown:m}=et({isOpen:r,onClose:c,align:"right"}),g=n?.table?.attrs?.justification??"left",p=rt.useCallback(v=>{e(v),i(false);},[e]),f=(v,P,y,S,h)=>{let x=t||h?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...ew,backgroundColor:a===v&&!x?"var(--doc-bg-hover)":"transparent",color:x?"var(--doc-text-muted)":h?.danger?"var(--doc-error)":"var(--doc-text)",cursor:x?"not-allowed":"pointer"},onClick:()=>!x&&p(S),onMouseEnter:()=>l(v),onMouseLeave:()=>l(null),disabled:x,children:[jsxRuntime.jsx(K,{name:P,size:16,className:h?.danger&&!x?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:y})]},v)},b=jsxRuntime.jsx(Ae,{variant:"ghost",size:"icon-sm",className:ee("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:m,onClick:()=>!t&&i(v=>!v),disabled:t,"aria-label":o("table.moreOptions"),"aria-expanded":r,"aria-haspopup":"menu","data-testid":"toolbar-table-more",children:jsxRuntime.jsx(K,{name:"more_vert",size:20})});return jsxRuntime.jsxs("div",{ref:s,style:{position:"relative",display:"inline-block"},children:[r?b:jsxRuntime.jsx(ct,{content:o("table.moreOptions"),children:b}),r&&!t&&jsxRuntime.jsxs("div",{ref:d,style:{...u,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:"4px 0",minWidth:200,maxHeight:"70vh",overflowY:"auto"},role:"menu",onMouseDown:v=>v.stopPropagation(),children:[f("addRowAbove","add",o("table.insertRowAbove"),"addRowAbove"),f("addRowBelow","add",o("table.insertRowBelow"),"addRowBelow"),f("addColumnLeft","add",o("table.insertColumnLeft"),"addColumnLeft"),f("addColumnRight","add",o("table.insertColumnRight"),"addColumnRight"),jsxRuntime.jsx("div",{style:Wo,role:"separator"}),f("mergeCells","call_merge",o("table.mergeCells"),"mergeCells",{itemDisabled:!n?.hasMultiCellSelection}),f("splitCell","call_split",o("table.splitCell"),"splitCell",{itemDisabled:!n?.canSplitCell}),jsxRuntime.jsx("div",{style:Wo,role:"separator"}),f("selectTable","select_all",o("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:Wo,role:"separator"}),f("deleteRow","delete",o("table.deleteRow"),"deleteRow",{danger:true,itemDisabled:(n?.rowCount??0)<=1}),f("deleteColumn","delete",o("table.deleteColumn"),"deleteColumn",{danger:true,itemDisabled:(n?.columnCount??0)<=1}),f("deleteTable","delete",o("table.deleteTable"),"deleteTable",{danger:true}),jsxRuntime.jsx("div",{style:Wo,role:"separator"}),jsxRuntime.jsx("div",{style:K0,children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(v=>{let P={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:o({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[v]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:S=>S.preventDefault(),onMouseEnter:S=>{S.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},onClick:()=>p({type:"cellVerticalAlign",align:v}),children:jsxRuntime.jsx(K,{name:P[v],size:16})},v)})}),jsxRuntime.jsx("div",{style:Wo,role:"separator"}),jsxRuntime.jsx("div",{style:K0,children:o("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(v=>{let P={left:"format_align_left",center:"format_align_center",right:"format_align_right"},y=g===v;return jsxRuntime.jsx("button",{type:"button",title:o({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[v]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:y?"var(--doc-primary-light)":"transparent",borderColor:y?"var(--doc-primary)":"var(--doc-border)",color:y?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:S=>S.preventDefault(),onClick:()=>p({type:"tableProperties",props:{justification:v}}),children:jsxRuntime.jsx(K,{name:P[v],size:16})},v)})}),jsxRuntime.jsx("div",{style:Wo,role:"separator"}),f("headerRow","table_rows",o("tableAdvanced.toggleHeaderRow"),{type:"toggleHeaderRow"}),f("distribute","view_column",o("tableAdvanced.distributeColumns"),{type:"distributeColumns"}),f("autoFit","fit_width",o("tableAdvanced.autoFit"),{type:"autoFitContents"}),f("noWrap","wrap_text",o("tableAdvanced.toggleNoWrap"),{type:"toggleNoWrap"}),jsxRuntime.jsx("div",{style:Wo,role:"separator"}),f("properties","settings",o("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var ow=20;function el({options:e,activeValue:t,triggerIcon:n,tooltipContent:o,onSelect:r,disabled:i=false,ariaLabel:a,testId:l,showLabels:c=false}){let[s,d]=rt.useState(false),u=rt.useCallback(()=>d(false),[]),{containerRef:m,dropdownRef:g,dropdownStyle:p,handleMouseDown:f}=et({isOpen:s,onClose:u}),b=rt.useCallback(P=>{i||r(P),d(false);},[i,r]),v=jsxRuntime.jsxs(Ae,{variant:"ghost",size:"icon-sm",className:ee("text-muted-foreground hover:text-foreground hover:bg-muted/80",s&&"bg-muted",i&&"opacity-30 cursor-not-allowed"),onMouseDown:f,onClick:()=>!i&&d(P=>!P),disabled:i,"aria-label":a??o,"aria-expanded":s,"aria-haspopup":"true","data-testid":l,children:[jsxRuntime.jsx(K,{name:n,size:ow}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:m,style:{position:"relative",display:"inline-block"},children:[s?v:jsxRuntime.jsx(ct,{content:o,children:v}),s&&!i&&jsxRuntime.jsx("div",{ref:g,style:{...p,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:P=>P.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:c?"column":"row",gap:c?1:2,minWidth:c?200:void 0},children:e.map(P=>{let y=t===P.value;return jsxRuntime.jsxs("button",{type:"button",title:P.label,"data-testid":l?`${l}-${P.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:y?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:y?"var(--doc-primary)":"var(--doc-text)",...c?{width:"100%",gap:10,padding:"0 10px",justifyContent:"flex-start",fontSize:13,textAlign:"left"}:{width:32,justifyContent:"center"}},onMouseDown:S=>S.preventDefault(),onMouseEnter:S=>{y||(S.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=y?"var(--doc-primary-light)":"transparent";},onClick:()=>b(P.value),children:[jsxRuntime.jsx(K,{name:P.iconName,size:18}),c&&jsxRuntime.jsx("span",{style:{flex:1},children:P.label})]},P.value)})})})]})}var nw=[{value:"inline",labelKey:"imageWrap.inline",iconName:"wrap_text"},{value:"wrapRight",labelKey:"imageWrap.floatLeft",iconName:"format_image_left"},{value:"wrapLeft",labelKey:"imageWrap.floatRight",iconName:"format_image_right"},{value:"behind",labelKey:"imageWrap.behindText",iconName:"flip_to_back"},{value:"inFront",labelKey:"imageWrap.inFrontOfText",iconName:"flip_to_front"}];function rw(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function V0({imageContext:e,onChange:t,disabled:n=false}){let{t:o}=_(),r=nw.map(l=>({...l,label:o(l.labelKey)})),i=rw(e),a=r.find(l=>l.value===i)||r[0];return jsxRuntime.jsx(el,{options:r,activeValue:i,triggerIcon:a.iconName,tooltipContent:`Wrap: ${a.label}`,onSelect:t,disabled:n,testId:"toolbar-image-wrap",showLabels:true})}var iw=[{value:"rotateCW",labelKey:"imageTransform.rotateClockwise",iconName:"rotate_right"},{value:"rotateCCW",labelKey:"imageTransform.rotateCounterClockwise",iconName:"rotate_left"},{value:"flipH",labelKey:"imageTransform.flipHorizontal",iconName:"swap_horiz"},{value:"flipV",labelKey:"imageTransform.flipVertical",iconName:"swap_vert"}];function U0({onTransform:e,disabled:t=false}){let{t:n}=_(),o=iw.map(r=>({...r,label:n(r.labelKey)}));return jsxRuntime.jsx(el,{options:o,triggerIcon:"rotate_right",tooltipContent:n("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var Tt=18;function ut({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,ariaLabel:a}){let l=a?.toLowerCase().replace(/\s+/g,"-")||n?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),c=d=>{d.preventDefault();},s=jsxRuntime.jsx(Ae,{variant:"ghost",size:"icon-sm",className:ee("docx-editor-toolbar-toggle text-muted-foreground",t&&"opacity-30 cursor-not-allowed",i),"data-active":e?"true":void 0,onMouseDown:c,onClick:t?void 0:o,"aria-disabled":t||void 0,tabIndex:t?-1:void 0,"aria-pressed":!!e,"aria-label":a||n,"data-testid":l?`toolbar-${l}`:void 0,children:r});return n?jsxRuntime.jsx(ct,{content:n,children:s}):s}function Ct({label:e,children:t,className:n}){return jsxRuntime.jsx("div",{className:ee("flex items-center gap-px px-1.5 border-r border-border/50 last:border-r-0 first:pl-0",n),role:"group","aria-label":e,children:t})}function uw(e){let t=rt__namespace.default.useContext(oa);return t?{...t,...pw(e)}:e}function pw(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function rd(e){let{t}=_(),n=uw(e),{currentFormatting:o={},onFormat:r,onUndo:i,onRedo:a,canUndo:l=false,canRedo:c=false,disabled:s=false,className:d,style:u,enableShortcuts:m=true,editorRef:g,children:p,showFontPicker:f=true,fontFamilies:b,documentFonts:v,showFontSizePicker:P=true,showTextColorPicker:y=true,showHighlightColorPicker:S=true,showAlignmentButtons:h=true,showListButtons:x=true,showLineSpacingPicker:T=true,showStylePicker:k=true,documentStyles:E,theme:w,showZoomControl:D=true,zoom:F,onZoomChange:A,onRefocusEditor:I,imageContext:N,onImageWrapType:R,onImageTransform:M,onOpenImageProperties:ae,tableContext:z,onTableAction:$,inline:V=false}=n,oe=rt.useRef(null),ne=rt.useCallback(pe=>{!s&&r&&r(pe);},[s,r]),be=rt.useCallback(()=>{!s&&l&&i&&i();},[s,l,i]),he=rt.useCallback(()=>{!s&&c&&a&&a();},[s,c,a]),W=rt.useCallback(pe=>{!s&&r&&r({type:"fontFamily",value:pe});},[s,r]),B=rt__namespace.default.useMemo(()=>Gc(b),[b]),Ee=rt.useCallback(pe=>{!s&&r&&r({type:"fontSize",value:pe});},[s,r]),ce=rt.useCallback(pe=>{!s&&r&&r({type:"textColor",value:pe});},[s,r]),de=rt.useCallback(pe=>{!s&&r&&r({type:"highlightColor",value:typeof pe=="string"?pe:""});},[s,r]),Ve=rt.useCallback(pe=>{!s&&r&&r({type:"alignment",value:pe});},[s,r]),uo=rt.useCallback(()=>{!s&&r&&r("bulletList");},[s,r]),mt=rt.useCallback(()=>{!s&&r&&r("numberedList");},[s,r]),po=rt.useCallback(()=>{!s&&r&&r("indent");},[s,r]),Re=rt.useCallback(()=>{!s&&r&&r("outdent");},[s,r]),il=rt.useCallback(pe=>{!s&&r&&(r({type:"lineSpacing",value:pe}),requestAnimationFrame(()=>I?.()));},[s,r,I]),Dn=rt.useCallback(pe=>{!s&&r&&r({type:"applyStyle",value:pe});},[s,r]),Pt=rt.useCallback(pe=>{!s&&$&&($(pe),requestAnimationFrame(()=>I?.()));},[s,$,I]);rt.useEffect(()=>{if(!m)return;let pe=me=>{if(me.defaultPrevented)return;let at=me.target,Ln=g?.current,sa=oe.current,mo=Ln?.contains(at),ld=sa?.contains(at);if(!mo&&!ld)return;if((me.ctrlKey||me.metaKey)&&!me.altKey)switch(me.key.toLowerCase()){case "b":me.preventDefault(),ne("bold");break;case "i":me.preventDefault(),ne("italic");break;case "u":me.preventDefault(),ne("underline");break;case "=":me.shiftKey?(me.preventDefault(),ne("superscript")):(me.preventDefault(),ne("subscript"));break;case "l":me.preventDefault(),Ve("left");break;case "e":me.preventDefault(),Ve("center");break;case "r":me.preventDefault(),Ve("right");break;case "j":me.preventDefault(),Ve("both");break;case "k":me.preventDefault(),ne("insertLink");break}};return document.addEventListener("keydown",pe),()=>{document.removeEventListener("keydown",pe);}},[m,ne,Ve,g]);let Nn=rt.useCallback(pe=>{let me=pe.target;me.tagName==="INPUT"||me.tagName==="TEXTAREA"||me.tagName==="SELECT"||me.tagName==="OPTION"||pe.preventDefault();},[]),jo=rt.useCallback(pe=>{let me=pe.target,at=document.activeElement;me.tagName==="SELECT"||me.tagName==="OPTION"||at?.tagName==="SELECT"||requestAnimationFrame(()=>{I?.();});},[I]);return jsxRuntime.jsxs("div",{ref:oe,className:ee(!V&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",d),style:V?{display:"contents",...u}:u,role:V?void 0:"toolbar","aria-label":V?void 0:t("toolbar.ariaLabel"),"data-testid":V?void 0:"formatting-bar",onMouseDown:V?void 0:Nn,onMouseUp:V?void 0:jo,children:[jsxRuntime.jsxs(Ct,{label:t("formattingBar.groups.history"),children:[jsxRuntime.jsx(ut,{onClick:be,disabled:s||!l,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(K,{name:"undo",size:Tt})}),jsxRuntime.jsx(ut,{onClick:he,disabled:s||!c,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(K,{name:"redo",size:Tt})})]}),D&&jsxRuntime.jsx(Ct,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(_0,{value:F,onChange:A,disabled:s,compact:true})}),k&&jsxRuntime.jsx(Ct,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(M0,{value:o.styleId||"Normal",onChange:Dn,styles:E,theme:w,disabled:s,width:120})}),(f||P)&&jsxRuntime.jsxs(Ct,{label:t("formattingBar.groups.font"),children:[f&&jsxRuntime.jsx(c0,{value:o.fontFamily||"Arial",onChange:W,fonts:B,documentFonts:v,disabled:s,width:60,placeholder:"Arial"}),P&&jsxRuntime.jsx(f0,{value:o.fontSize!==void 0?Al(o.fontSize):11,onChange:Ee,disabled:s,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(Ct,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(ut,{onClick:()=>ne("bold"),active:o.bold,disabled:s,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(K,{name:"format_bold",size:Tt})}),jsxRuntime.jsx(ut,{onClick:()=>ne("italic"),active:o.italic,disabled:s,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(K,{name:"format_italic",size:Tt})}),jsxRuntime.jsx(ut,{onClick:()=>ne("underline"),active:o.underline,disabled:s,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(K,{name:"format_underlined",size:Tt})}),jsxRuntime.jsx(ut,{onClick:()=>ne("strikethrough"),active:o.strike,disabled:s,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(K,{name:"strikethrough_s",size:Tt})}),y&&jsxRuntime.jsx($o,{mode:"text",value:o.color?.replace(/^#/,""),onChange:ce,theme:w,disabled:s,title:t("formattingBar.fontColor")}),S&&jsxRuntime.jsx($o,{mode:"highlight",value:o.highlight,onChange:de,theme:w,disabled:s,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(ut,{onClick:()=>ne("insertLink"),disabled:s,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(K,{name:"link",size:Tt})})]}),jsxRuntime.jsxs(Ct,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(ut,{onClick:()=>ne("superscript"),active:o.superscript,disabled:s,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(K,{name:"superscript",size:Tt})}),jsxRuntime.jsx(ut,{onClick:()=>ne("subscript"),active:o.subscript,disabled:s,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(K,{name:"subscript",size:Tt})})]}),h&&jsxRuntime.jsx(Ct,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(C0,{value:o.alignment||"left",onChange:Ve,disabled:s})}),(x||T)&&jsxRuntime.jsxs(Ct,{label:t("formattingBar.groups.listFormatting"),children:[x&&jsxRuntime.jsx(E0,{listState:o.listState||Wi(),onBulletList:uo,onNumberedList:mt,onIndent:po,onOutdent:Re,disabled:s,showIndentButtons:true,compact:true,hasIndent:(o.indentLeft??0)>0}),T&&jsxRuntime.jsx(k0,{value:o.lineSpacing,onChange:il,disabled:s})]}),N&&R&&jsxRuntime.jsxs(Ct,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(V0,{imageContext:N,onChange:R,disabled:s}),M&&jsxRuntime.jsx(U0,{onTransform:M,disabled:s}),ae&&jsxRuntime.jsx(ut,{onClick:ae,disabled:s,title:t("formattingBar.imagePropertiesShortcut"),ariaLabel:t("formattingBar.imageProperties"),children:jsxRuntime.jsx(K,{name:"tune",size:Tt})})]}),z?.isInTable&&$&&jsxRuntime.jsxs(Ct,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(L0,{onAction:Pt,disabled:s}),jsxRuntime.jsx(F0,{onAction:Pt,disabled:s,theme:w,value:Zt(z?.cellBorderColor,w)}),jsxRuntime.jsx(H0,{onAction:Pt,disabled:s}),jsxRuntime.jsx(B0,{onAction:Pt,disabled:s,theme:w,value:z?.cellBackgroundColor}),jsxRuntime.jsx(z0,{onAction:Pt,disabled:s,tableContext:z})]}),jsxRuntime.jsx(ut,{onClick:()=>ne("clearFormatting"),disabled:s,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(K,{name:"format_clear",size:Tt})}),p]})}function mw({children:e,className:t,style:n,...o}){return jsxRuntime.jsx(oa.Provider,{value:o,children:jsxRuntime.jsx("div",{className:ee("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:Qe.toolbar,...n},"data-testid":"editor-toolbar",children:e})})}var tt=mw;tt.TitleBar=Vc;tt.Logo=Bi;tt.DocumentName=$c;tt.MenuBar=qi;tt.TitleBarRight=Zi;tt.Toolbar=rd;var bw=new Map([["#ffff00","yellow"],["#00ff00","green"],["#00ffff","cyan"],["#ff00ff","magenta"],["#0000ff","blue"],["#ff0000","red"],["#000080","darkBlue"],["#008080","darkCyan"],["#008000","darkGreen"],["#800080","darkMagenta"],["#800000","darkRed"],["#808000","darkYellow"],["#808080","darkGray"],["#c0c0c0","lightGray"],["#ffffff","white"]]),hw=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function vw({source:e,scale:t,measurer:n,documentName:o,onStateChange:r,onError:i,onSave:a,renderTitleBarLeft:l,renderTitleBarRight:c,ref:s,colorMode:d,onZoomChange:u,documentFontFamily:m,className:g}){let p=rt.useRef(null),[f,b]=rt.useState(null),[v,P]=rt.useState({}),[y,S]=rt.useState(null),h=rt.useCallback(E=>{b(E);let w=p.current?.formatting();w&&P({bold:w.bold,italic:w.italic,underline:w.underline,strike:w.strikethrough,superscript:w.superscript,subscript:w.subscript,...w.fontFamily?{fontFamily:w.fontFamily}:{},...w.fontSizeHalfPoints?{fontSize:w.fontSizeHalfPoints}:{},...w.alignment?{alignment:w.alignment}:{},...w.styleId?{styleId:w.styleId}:{},...w.color?{color:`#${w.color}`}:{},...w.highlight?{highlight:w.highlight}:{}}),S(p.current?.sectionProperties()??null),r?.(E);},[r]),x=rt.useCallback(E=>{let w=p.current;if(w){if(typeof E=="string")switch(E){case "bold":return w.toggleRunProperty("b");case "italic":return w.toggleRunProperty("i");case "underline":return w.toggleRunProperty("u",{val:"single"});case "strikethrough":return w.toggleRunProperty("strike");case "superscript":return w.setRunProperty("vertAlign",{val:"superscript"});case "subscript":return w.setRunProperty("vertAlign",{val:"subscript"});case "clearFormatting":w.setRunProperty("b",{val:"0"}),w.setRunProperty("i",{val:"0"}),w.setRunProperty("u",{val:"none"}),w.setRunProperty("strike",{val:"0"}),w.setRunProperty("vertAlign",{val:"baseline"});return;default:return}switch(E.type){case "fontFamily":return w.setRunProperty("rFonts",{ascii:E.value,hAnsi:E.value});case "fontSize":return w.setRunProperty("sz",{val:String(Math.round(E.value*2))});case "textColor":{let D=E.value,F=typeof D=="string"?hw(D):Zt(D,null)??null;return F?w.setRunProperty("color",{val:F}):void 0}case "highlightColor":{let D=E.value.trim().toLowerCase();if(D==="none"||D==="")return w.setRunProperty("highlight",{val:"none"});let F=bw.get(D.startsWith("#")?D:`#${D}`);return F?w.setRunProperty("highlight",{val:F}):void 0}case "alignment":return w.setParagraphProperty("jc",{val:String(E.value)});case "lineSpacing":return w.setParagraphProperty("spacing",{line:String(Math.round(E.value)),lineRule:"auto"},{mergeAttributes:true});case "applyStyle":return w.setParagraphProperty("pStyle",{val:E.value});default:return}}},[]);rt.useImperativeHandle(s,()=>p.current,[]);let T=t===void 0?1:t/(96/72),k=y?{pageWidthTwips:y.pageSize.widthTwips,pageHeightTwips:y.pageSize.heightTwips,orientation:y.landscape?"landscape":"portrait",marginsTwips:{top:y.margins.topTwips,right:y.margins.rightTwips,bottom:y.margins.bottomTwips,left:y.margins.leftTwips}}:null;return jsxRuntime.jsxs("div",{className:["docx-editor docx-paginated-shell",d==="dark"?"dark":"",g??""].filter(Boolean).join(" "),style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,background:"var(--doc-bg)",color:"var(--doc-text)"},"data-testid":"paginated-shell",children:[jsxRuntime.jsxs(tt,{currentFormatting:v,onFormat:x,onUndo:()=>p.current?.undo(),onRedo:()=>p.current?.redo(),canUndo:f?.canUndo??false,canRedo:f?.canRedo??false,zoom:T,onZoomChange:u,onSave:()=>{let E=p.current?.save();E&&a?.(E);},children:[jsxRuntime.jsxs(tt.TitleBar,{children:[l&&jsxRuntime.jsx(tt.Logo,{children:l()}),jsxRuntime.jsx(tt.DocumentName,{value:o??"Document",editable:false}),c&&jsxRuntime.jsx(tt.TitleBarRight,{children:c()}),jsxRuntime.jsx(tt.MenuBar,{})]}),jsxRuntime.jsx(tt.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[k?jsxRuntime.jsx("div",{style:{padding:"4px 0"},children:jsxRuntime.jsx(Mo,{pageSetup:k,zoom:T})}):null,jsxRuntime.jsx(Bc,{ref:p,source:e,...m?{documentFontFamily:m}:{},...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onStateChange:h,...i?{onError:i}:{}})]})]})}var ol=class{listeners=new Set;snapshot;constructor(t){this.snapshot=t;}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t);});getSnapshot=()=>this.snapshot;setSnapshot(t){this.snapshot=t,this.notify();}notify(){for(let t of this.listeners)t();}};var nl=class extends ol{notifications=[];idCounter=0;timers=new Set;constructor(){super({notifications:[]});}showError(t,n){return this.addNotification(t,"error",n)}showWarning(t,n){return this.addNotification(t,"warning",n)}showInfo(t,n){return this.addNotification(t,"info",n)}dismiss(t){this.notifications=this.notifications.map(o=>o.id===t?{...o,dismissed:true}:o),this.emitSnapshot();let n=setTimeout(()=>{this.timers.delete(n),this.notifications=this.notifications.filter(o=>o.id!==t),this.emitSnapshot();},300);this.timers.add(n);}clearAll(){this.notifications=[];for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.emitSnapshot();}destroy(){for(let t of this.timers)clearTimeout(t);this.timers.clear(),this.notifications=[];}addNotification(t,n,o){let r=`error-${++this.idCounter}-${Date.now()}`,i={id:r,message:t,severity:n,details:o,timestamp:Date.now()};if(this.notifications=[...this.notifications,i],this.emitSnapshot(),n!=="error"){let a=setTimeout(()=>{this.timers.delete(a),this.dismiss(r);},5e3);this.timers.add(a);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var Pw=rt.createContext(null);function X0({children:e}){let t=rt.useMemo(()=>new nl,[]),n=rt.useSyncExternalStore(t.subscribe,t.getSnapshot),o=rt.useCallback((s,d)=>{t.showError(s,d);},[t]),r=rt.useCallback((s,d)=>{t.showWarning(s,d);},[t]),i=rt.useCallback((s,d)=>{t.showInfo(s,d);},[t]),a=rt.useCallback(s=>{t.dismiss(s);},[t]),l=rt.useCallback(()=>{t.clearAll();},[t]),c=rt.useMemo(()=>({notifications:n.notifications,showError:o,showWarning:r,showInfo:i,dismissNotification:a,clearNotifications:l}),[n.notifications,o,r,i,a,l]);return jsxRuntime.jsxs(Pw.Provider,{value:c,children:[e,jsxRuntime.jsx(Ew,{notifications:n.notifications,onDismiss:a})]})}function Ew({notifications:e,onDismiss:t}){let n=e.filter(r=>!r.dismissed);return n.length===0?null:jsxRuntime.jsx("div",{className:"docx-notification-container",style:{position:"fixed",top:"16px",right:"16px",zIndex:10001,display:"flex",flexDirection:"column",gap:"8px",maxWidth:"400px"},children:n.map(r=>jsxRuntime.jsx(ww,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function ww({notification:e,onDismiss:t}){let{t:n}=_(),[o,r]=rt.useState(false),a=(f=>{switch(f){case "error":return {bg:"var(--doc-error-bg)",border:"var(--doc-error)",text:"var(--doc-error)",icon:"var(--doc-error)"};case "warning":return {bg:"var(--doc-warning-bg)",border:"var(--doc-warning)",text:"var(--doc-warning-text)",icon:"var(--doc-warning)"};case "info":return {bg:"var(--doc-primary-light)",border:"var(--doc-primary)",text:"var(--doc-primary)",icon:"var(--doc-primary)"}}})(e.severity),l={background:a.bg,border:`1px solid ${a.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px var(--doc-shadow)",animation:"slideIn 0.3s ease-out"},c={display:"flex",alignItems:"flex-start",gap:"8px"},s={color:a.icon,flexShrink:0},d={flex:1,minWidth:0},u={color:a.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},m={marginTop:"8px",padding:"8px",background:"var(--doc-shadow-subtle)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",color:a.text,maxHeight:"200px",overflow:"auto"},g={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:a.text},p=f=>{switch(f){case "error":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 6v5M10 13v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "warning":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("path",{d:"M10 3L18 17H2L10 3z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M10 8v4M10 14v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "info":return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M10 9v5M10 6v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}};return jsxRuntime.jsxs("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:l,children:[jsxRuntime.jsx("style",{children:`
3
3
  @keyframes slideIn {
4
4
  from {
5
5
  opacity: 0;
@@ -10,9 +10,9 @@
10
10
  transform: translateX(0);
11
11
  }
12
12
  }
13
- `}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("span",{style:s,children:p(e.severity)}),jsxRuntime.jsxs("div",{style:d,children:[jsxRuntime.jsx("div",{style:u,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>r(!o),style:{...g,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:n(o?"errors.hideDetails":"errors.showDetails")}),o&&jsxRuntime.jsx("div",{style:m,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:g,title:n("common.dismiss"),children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})}var Di=class extends je.Component{constructor(t){super(t),this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(t){return {hasError:true,error:t}}componentDidCatch(t,n){this.setState({errorInfo:n}),console.error("ErrorBoundary caught an error:",t,n),this.props.onError&&this.props.onError(t,n);}resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};render(){if(this.state.hasError){let{fallback:t,showDetails:n=true}=this.props,{error:o,errorInfo:r}=this.state;return t?typeof t=="function"?t(o,this.resetError):t:jsxRuntime.jsx(f2,{error:o,errorInfo:r,showDetails:n,onReset:this.resetError})}return this.props.children}};function f2({error:e,errorInfo:t,showDetails:n,onReset:o}){let{t:r}=_(),i={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",minHeight:"200px",background:"var(--doc-surface)",borderRadius:"8px",border:"1px solid var(--doc-border)",margin:"20px"},a={color:"var(--doc-error)",marginBottom:"16px"},l={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},c={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},s={width:"100%",maxWidth:"600px",marginBottom:"16px",padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"200px",overflow:"auto"},d={padding:"10px 20px",background:"var(--doc-primary)",color:"var(--doc-on-primary)",border:"none",borderRadius:"4px",fontSize:"14px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:"docx-error-fallback",style:i,children:[jsxRuntime.jsx("div",{style:a,children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M24 14v12M24 30v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h2",{style:l,children:r("errors.somethingWentWrong")}),jsxRuntime.jsx("p",{style:c,children:r("errors.errorDescription")}),n&&jsxRuntime.jsxs("div",{style:s,children:[jsxRuntime.jsx("strong",{children:r("errors.errorLabel")})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
13
+ `}),jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("span",{style:s,children:p(e.severity)}),jsxRuntime.jsxs("div",{style:d,children:[jsxRuntime.jsx("div",{style:u,children:e.message}),e.details&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{type:"button",onClick:()=>r(!o),style:{...g,marginTop:"4px",fontSize:"12px",padding:"2px 8px"},children:n(o?"errors.hideDetails":"errors.showDetails")}),o&&jsxRuntime.jsx("div",{style:m,children:e.details})]})]}),jsxRuntime.jsx("button",{type:"button",onClick:t,style:g,title:n("common.dismiss"),children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})}var rl=class extends rt.Component{constructor(t){super(t),this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(t){return {hasError:true,error:t}}componentDidCatch(t,n){this.setState({errorInfo:n}),console.error("ErrorBoundary caught an error:",t,n),this.props.onError&&this.props.onError(t,n);}resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};render(){if(this.state.hasError){let{fallback:t,showDetails:n=true}=this.props,{error:o,errorInfo:r}=this.state;return t?typeof t=="function"?t(o,this.resetError):t:jsxRuntime.jsx(kw,{error:o,errorInfo:r,showDetails:n,onReset:this.resetError})}return this.props.children}};function kw({error:e,errorInfo:t,showDetails:n,onReset:o}){let{t:r}=_(),i={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px",textAlign:"center",minHeight:"200px",background:"var(--doc-surface)",borderRadius:"8px",border:"1px solid var(--doc-border)",margin:"20px"},a={color:"var(--doc-error)",marginBottom:"16px"},l={fontSize:"18px",fontWeight:600,color:"var(--doc-text)",marginBottom:"8px"},c={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"16px",maxWidth:"400px"},s={width:"100%",maxWidth:"600px",marginBottom:"16px",padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"200px",overflow:"auto"},d={padding:"10px 20px",background:"var(--doc-primary)",color:"var(--doc-on-primary)",border:"none",borderRadius:"4px",fontSize:"14px",cursor:"pointer"};return jsxRuntime.jsxs("div",{className:"docx-error-fallback",style:i,children:[jsxRuntime.jsx("div",{style:a,children:jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"24",cy:"24",r:"20",stroke:"currentColor",strokeWidth:"2"}),jsxRuntime.jsx("path",{d:"M24 14v12M24 30v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),jsxRuntime.jsx("h2",{style:l,children:r("errors.somethingWentWrong")}),jsxRuntime.jsx("p",{style:c,children:r("errors.errorDescription")}),n&&jsxRuntime.jsxs("div",{style:s,children:[jsxRuntime.jsx("strong",{children:r("errors.errorLabel")})," ",e.message,t&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[`
14
14
 
15
- `,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:d,children:r("errors.tryAgain")})]})}function c0({onClick:e,topPx:t,scrollLeft:n=0,leftOffset:o=$o}){let{t:r}=_();return jsxRuntime.jsx("button",{className:"docx-outline-toggle",onClick:e,onMouseDown:i=>i.stopPropagation(),title:r("editor.showDocumentOutline"),"aria-label":r("editor.showDocumentOutline"),style:{position:"absolute",left:o-n,top:t,zIndex:Ve.outline},children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:20})})}function kc({currentPage:e,totalPages:t,visible:n}){let{t:o}=_();return jsxRuntime.jsx("div",{style:{position:"absolute",right:24,top:"50%",transform:"translateY(-50%)",backgroundColor:"var(--doc-overlay)",color:"#fff",padding:"6px 12px",borderRadius:"4px",fontSize:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3,opacity:n?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:o("viewer.pageIndicator",{current:e,total:t})})}function b2({i18n:e,isDark:t,onEditorError:n,containerRef:o,scrollContainerRef:r,editorContentRef:i,className:a,containerStyle:l,mainContentStyle:c,editorContainerStyle:s,showRuler:d,readOnlyProp:u,showOutline:m,showOutlineButton:g,sidebarOpen:p,minLayoutWidth:f,toolbarHeight:b,editorScrollLeft:h,expandedSidebarItem:P,trackedChanges:x,onScrollContainerMouseDown:C,onEditorBgMouseDown:v,onEditorContextMenu:y,horizontalRulerProps:T,verticalRulerProps:M,outlineProps:w,onToggleOutline:E,scrollPageInfo:D,toolbar:A,pagedArea:H,overlays:k,dialogs:L,fileInputs:R}){return jsxRuntime.jsx(oo.Provider,{value:true,children:jsxRuntime.jsx(_o,{i18n:e,children:jsxRuntime.jsx(i0,{children:jsxRuntime.jsx(Di,{onError:n,children:jsxRuntime.jsxs("div",{ref:o,className:J("docx-editor",t&&"dark",a),style:l,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:c,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[A,jsxRuntime.jsxs("div",{ref:r,className:"docx-editor__scroll-container",style:s,onMouseDown:C,children:[d&&jsxRuntime.jsx("div",{className:"flex py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:Ve.ruler,paddingLeft:20,paddingRight:20+(p?352:0),minWidth:f,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(co,{...T})}),jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative",minWidth:f},children:jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",flex:1,minWidth:0},onMouseDown:v,onContextMenu:y,children:[d&&!u&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:Ve.ruler,paddingTop:48},children:jsxRuntime.jsx(sr,{...M})}),P&&P.startsWith("comment-")&&jsxRuntime.jsx("style",{children:`.paged-editor__pages [data-comment-id="${P.replace("comment-","")}"] { background-color: var(--doc-comment-active-bg) !important; border-bottom-width: 2px !important; border-bottom-style: solid !important; border-bottom-color: var(--doc-comment-active-border) !important; }`}),P?.startsWith("tc-")&&(()=>{let I=P.split("-")[1],Z=x.find(V=>String(V.id)===I)?.id??I;return jsxRuntime.jsx("style",{children:`
16
- .paged-editor__pages .docx-insertion[data-revision-id="${Z}"] { background-color: rgba(52, 168, 83, 0.2) !important; border-bottom: 2px solid #2e7d32 !important; }
17
- .paged-editor__pages .docx-deletion[data-revision-id="${Z}"] { background-color: rgba(211, 47, 47, 0.2) !important; text-decoration-thickness: 2px !important; }
18
- `})})(),H]})})]}),D.totalPages>1&&jsxRuntime.jsx(kc,{currentPage:D.currentPage,totalPages:D.totalPages,visible:D.visible}),m&&jsxRuntime.jsx(dr,{...w,leftOffset:cr+(d?Wo:0)}),g&&!m&&jsxRuntime.jsx(c0,{onClick:E,topPx:b+(d?30:0)+48,scrollLeft:h,leftOffset:$o+(d?Wo:0)})]})}),k,L,R]})})})})})}function C2(e){let[t,n]=je.useState(0);return je.useEffect(()=>{if(!e)return;let o=()=>n(a=>a+1),r=e.on("change",o),i=e.on("selectionChange",o);return o(),()=>{r(),i();}},[e]),t}Object.defineProperty(exports,"CHROME_GROUPS",{enumerable:true,get:function(){return editor.CHROME_GROUPS}});Object.defineProperty(exports,"CHROME_MENUS",{enumerable:true,get:function(){return editor.CHROME_MENUS}});Object.defineProperty(exports,"LOADING_SNAPSHOT",{enumerable:true,get:function(){return editor.LOADING_SNAPSHOT}});Object.defineProperty(exports,"MAX_RESOLVER_FAMILIES",{enumerable:true,get:function(){return editor.MAX_RESOLVER_FAMILIES}});Object.defineProperty(exports,"PX_PER_CM",{enumerable:true,get:function(){return editor.PX_PER_CM}});Object.defineProperty(exports,"PX_PER_INCH",{enumerable:true,get:function(){return editor.PX_PER_INCH}});Object.defineProperty(exports,"WORD_DEFAULT_FONT",{enumerable:true,get:function(){return editor.WORD_DEFAULT_FONT}});Object.defineProperty(exports,"chromeMenuSlots",{enumerable:true,get:function(){return editor.chromeMenuSlots}});Object.defineProperty(exports,"commandForSlot",{enumerable:true,get:function(){return editor.commandForSlot}});Object.defineProperty(exports,"composeFontConfiguration",{enumerable:true,get:function(){return editor.composeFontConfiguration}});Object.defineProperty(exports,"createFontSource",{enumerable:true,get:function(){return editor.createFontSource}});Object.defineProperty(exports,"generateRulerTicks",{enumerable:true,get:function(){return editor.generateRulerTicks}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return editor.loadFonts}});Object.defineProperty(exports,"rulerPageBox",{enumerable:true,get:function(){return editor.rulerPageBox}});Object.defineProperty(exports,"runToolbarCommand",{enumerable:true,get:function(){return editor.runToolbarCommand}});Object.defineProperty(exports,"toolbarCommandState",{enumerable:true,get:function(){return editor.toolbarCommandState}});Object.defineProperty(exports,"EditorFontError",{enumerable:true,get:function(){return editor$1.EditorFontError}});exports.CONTENT_CONTROL_SLOTS=Be;exports.ContextMenuCellVerticalAlignment=yo;exports.ContextMenuCopy=Er;exports.ContextMenuCut=Pr;exports.ContextMenuDelete=wr;exports.ContextMenuDeleteTable=rn;exports.ContextMenuDeleteTableColumn=nn;exports.ContextMenuDeleteTableRow=on;exports.ContextMenuInsertColumnLeft=en;exports.ContextMenuInsertColumnRight=tn;exports.ContextMenuInsertRowAbove=Qo;exports.ContextMenuInsertRowBelow=Jo;exports.ContextMenuItem=ii;exports.ContextMenuPaste=Xo;exports.ContextMenuRefreshToc=an;exports.ContextMenuRefreshTocPageNumbers=ln;exports.ContextMenuSelectAll=Mr;exports.DocumentName=fc;exports.DocumentOutline=dr;exports.DocxEditor=ZP;exports.DocxEditorAuthorStyle=Qi;exports.DocxEditorColorByChangeType=Xi;exports.DocxEditorContent=Gr;exports.DocxEditorContentControl=di;exports.DocxEditorContextMenu=Ir;exports.DocxEditorDocumentOutline=Ls;exports.DocxEditorFontNotice=Xa;exports.DocxEditorHeaderFooterChrome=Ja;exports.DocxEditorHorizontalRuler=qa;exports.DocxEditorHyperLink=ti;exports.DocxEditorImagePropertiesDialog=Il;exports.DocxEditorLoading=jr;exports.DocxEditorLoadingSpinner=ji;exports.DocxEditorMenu=ar;exports.DocxEditorNavigation=Ks;exports.DocxEditorNotesChrome=oi;exports.DocxEditorPageNumber=ja;exports.DocxEditorPageSetupDialog=Qn;exports.DocxEditorRoot=Pn;exports.DocxEditorShell=b2;exports.DocxEditorToolbar=Xn;exports.DocxEditorVerticalRuler=Ka;exports.DocxEditorViewport=na;exports.HorizontalRuler=co;exports.ImageAltText=pa;exports.ImageInsertProvider=Vr;exports.ImageInsertTrigger=Wr;exports.ImagePropertiesTrigger=ba;exports.ImageWrap=ua;exports.LocaleProvider=_o;exports.Logo=mi;exports.MenuBar=gi;exports.NAVIGATION_PANE_GAP=um;exports.NAVIGATION_PANE_INSET=za;exports.NAVIGATION_PANE_WIDTH=Uo;exports.NavigationClose=fr;exports.NavigationFind=yr;exports.NavigationHeader=mr;exports.NavigationHeadings=vr;exports.NavigationTab=hr;exports.NavigationTabs=br;exports.NavigationTitle=gr;exports.NavigationToggle=xr;exports.OUTLINE_BUTTON_LEFT_OFFSET=$o;exports.OUTLINE_BUTTON_RESERVED_SPACE=HS;exports.OUTLINE_LEFT_OFFSET=cr;exports.OUTLINE_RESERVED_SPACE=NS;exports.PageIndicator=kc;exports.PageNumberTranslationContext=Ya;exports.PaginatedDocxEditor=cc;exports.PaginatedDocxEditorShell=a2;exports.REVIEW_MARKERS_GUTTER=dl;exports.REVIEW_PANE_GUTTER=ul;exports.RULER_WIDTH=Wo;exports.ReviewRailContext=rt;exports.SEARCH_DEBOUNCE_MS=Os;exports.SEARCH_MATCH_LIMIT=Zs;exports.Slot=$;exports.TitleBar=gc;exports.TitleBarRight=fi;exports.Toolbar=Rc;exports.ToolbarButton=ot;exports.ToolbarContext=jt;exports.ToolbarGroup=pt;exports.ToolbarImageProperties=Zo;exports.VERSION=x0;exports.VerticalRuler=sr;exports.editorStateActiveSubscriptionCount=I0;exports.isFieldLink=yn;exports.navigationPaneReservation=mo;exports.navigationShift=Va;exports.normalizeImageBytes=Br;exports.notificationYieldsToTask=zc;exports.provideDocxEditor=$g;exports.reviewGutter=vd;exports.useChromeTranslate=Kc;exports.useContentControl=mt;exports.useContentControlInstance=Jr;exports.useContextMenuTarget=Im;exports.useDocumentOutline=Wa;exports.useDocumentSearch=$a;exports.useDocxEditor=F;exports.useDocxSource=VP;exports.useEditorCaret=o1;exports.useEditorCommand=ne;exports.useEditorEvent=es;exports.useEditorSnapshot=C2;exports.useEditorState=B;exports.useEditorValueCommand=In;exports.useFontFamily=xa;exports.useFonts=GP;exports.useHeaderFooterState=Vs;exports.useHyperlinkPopup=Ji;exports.useHyperlinkPopupInstance=Qr;exports.useNavigationPane=Ua;exports.useNavigationShift=to;exports.useNotePropertiesState=oc;exports.useNoteScopeState=tc;exports.usePageSetup=ro;exports.useParagraphIndent=Rs;exports.useParagraphStyle=Ta;exports.useReviewAuthors=QP;exports.useReviewGutter=Ho;exports.useScopeClassName=Ye;exports.useScopedChromeAnchor=Tr;exports.useTableBorderTargetLabel=pp;exports.useToolbarContext=A0;exports.useToolbarLabel=j;exports.useToolbarLabelFor=qr;exports.useTranslation=_;exports.useZoom=Dl;
15
+ `,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:d,children:r("errors.tryAgain")})]})}function eg({onClick:e,topPx:t,scrollLeft:n=0,leftOffset:o=mn}){let{t:r}=_();return jsxRuntime.jsx("button",{className:"docx-outline-toggle",onClick:e,onMouseDown:i=>i.stopPropagation(),title:r("editor.showDocumentOutline"),"aria-label":r("editor.showDocumentOutline"),style:{position:"absolute",left:o-n,top:t,zIndex:Qe.outline},children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:20})})}function id({currentPage:e,totalPages:t,visible:n}){let{t:o}=_();return jsxRuntime.jsx("div",{style:{position:"absolute",right:24,top:"50%",transform:"translateY(-50%)",backgroundColor:"var(--doc-overlay)",color:"#fff",padding:"6px 12px",borderRadius:"4px",fontSize:"12px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontWeight:500,whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e3,opacity:n?1:0,transition:"opacity 0.3s ease",userSelect:"none"},"aria-live":"polite",role:"status",children:o("viewer.pageIndicator",{current:e,total:t})})}function Mw({i18n:e,isDark:t,onEditorError:n,containerRef:o,scrollContainerRef:r,editorContentRef:i,className:a,containerStyle:l,mainContentStyle:c,editorContainerStyle:s,showRuler:d,readOnlyProp:u,showOutline:m,showOutlineButton:g,sidebarOpen:p,minLayoutWidth:f,toolbarHeight:b,editorScrollLeft:v,expandedSidebarItem:P,trackedChanges:y,onScrollContainerMouseDown:S,onEditorBgMouseDown:h,onEditorContextMenu:x,horizontalRulerProps:T,verticalRulerProps:k,outlineProps:E,onToggleOutline:w,scrollPageInfo:D,toolbar:F,pagedArea:A,overlays:I,dialogs:N,fileInputs:R}){return jsxRuntime.jsx(xo.Provider,{value:true,children:jsxRuntime.jsx(Yo,{i18n:e,children:jsxRuntime.jsx(X0,{children:jsxRuntime.jsx(rl,{onError:n,children:jsxRuntime.jsxs("div",{ref:o,className:ee("docx-editor",t&&"dark",a),style:l,"data-testid":"docx-editor",children:[jsxRuntime.jsx("div",{style:c,children:jsxRuntime.jsxs("div",{style:{position:"relative",flex:1,minHeight:0,minWidth:0,display:"flex",flexDirection:"column"},children:[F,jsxRuntime.jsxs("div",{ref:r,className:"docx-editor__scroll-container",style:s,onMouseDown:S,children:[d&&jsxRuntime.jsx("div",{className:"flex py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:Qe.ruler,paddingLeft:20,paddingRight:20+(p?352:0),minWidth:f,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(Mo,{...T})}),jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative",minWidth:f},children:jsxRuntime.jsxs("div",{ref:i,style:{position:"relative",flex:1,minWidth:0},onMouseDown:h,onContextMenu:x,children:[d&&!u&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:Qe.ruler,paddingTop:48},children:jsxRuntime.jsx(Dr,{...k})}),P&&P.startsWith("comment-")&&jsxRuntime.jsx("style",{children:`.paged-editor__pages [data-comment-id="${P.replace("comment-","")}"] { background-color: var(--doc-comment-active-bg) !important; border-bottom-width: 2px !important; border-bottom-style: solid !important; border-bottom-color: var(--doc-comment-active-border) !important; }`}),P?.startsWith("tc-")&&(()=>{let M=P.split("-")[1],z=y.find($=>String($.id)===M)?.id??M;return jsxRuntime.jsx("style",{children:`
16
+ .paged-editor__pages .docx-insertion[data-revision-id="${z}"] { background-color: rgba(52, 168, 83, 0.2) !important; border-bottom: 2px solid #2e7d32 !important; }
17
+ .paged-editor__pages .docx-deletion[data-revision-id="${z}"] { background-color: rgba(211, 47, 47, 0.2) !important; text-decoration-thickness: 2px !important; }
18
+ `})})(),A]})})]}),D.totalPages>1&&jsxRuntime.jsx(id,{currentPage:D.currentPage,totalPages:D.totalPages,visible:D.visible}),m&&jsxRuntime.jsx(Lr,{...E,leftOffset:Nr+(d?pn:0)}),g&&!m&&jsxRuntime.jsx(eg,{onClick:w,topPx:b+(d?30:0)+48,scrollLeft:v,leftOffset:mn+(d?pn:0)})]})}),I,N,R]})})})})})}function Aw(e){let[t,n]=rt.useState(0);return rt.useEffect(()=>{if(!e)return;let o=()=>n(a=>a+1),r=e.on("change",o),i=e.on("selectionChange",o);return o(),()=>{r(),i();}},[e]),t}Object.defineProperty(exports,"CHROME_GROUPS",{enumerable:true,get:function(){return editor.CHROME_GROUPS}});Object.defineProperty(exports,"CHROME_MENUS",{enumerable:true,get:function(){return editor.CHROME_MENUS}});Object.defineProperty(exports,"LOADING_SNAPSHOT",{enumerable:true,get:function(){return editor.LOADING_SNAPSHOT}});Object.defineProperty(exports,"MAX_RESOLVER_FAMILIES",{enumerable:true,get:function(){return editor.MAX_RESOLVER_FAMILIES}});Object.defineProperty(exports,"PX_PER_CM",{enumerable:true,get:function(){return editor.PX_PER_CM}});Object.defineProperty(exports,"PX_PER_INCH",{enumerable:true,get:function(){return editor.PX_PER_INCH}});Object.defineProperty(exports,"WORD_DEFAULT_FONT",{enumerable:true,get:function(){return editor.WORD_DEFAULT_FONT}});Object.defineProperty(exports,"chromeMenuSlots",{enumerable:true,get:function(){return editor.chromeMenuSlots}});Object.defineProperty(exports,"commandForSlot",{enumerable:true,get:function(){return editor.commandForSlot}});Object.defineProperty(exports,"composeFontConfiguration",{enumerable:true,get:function(){return editor.composeFontConfiguration}});Object.defineProperty(exports,"createFontSource",{enumerable:true,get:function(){return editor.createFontSource}});Object.defineProperty(exports,"generateRulerTicks",{enumerable:true,get:function(){return editor.generateRulerTicks}});Object.defineProperty(exports,"loadFonts",{enumerable:true,get:function(){return editor.loadFonts}});Object.defineProperty(exports,"rulerPageBox",{enumerable:true,get:function(){return editor.rulerPageBox}});Object.defineProperty(exports,"runToolbarCommand",{enumerable:true,get:function(){return editor.runToolbarCommand}});Object.defineProperty(exports,"toolbarCommandState",{enumerable:true,get:function(){return editor.toolbarCommandState}});Object.defineProperty(exports,"EditorFontError",{enumerable:true,get:function(){return editor$1.EditorFontError}});exports.CONTENT_CONTROL_SLOTS=Ye;exports.ContextMenuCellVerticalAlignment=Oo;exports.ContextMenuCopy=jr;exports.ContextMenuCut=Gr;exports.ContextMenuDelete=Yr;exports.ContextMenuDeleteTable=En;exports.ContextMenuDeleteTableColumn=Pn;exports.ContextMenuDeleteTableRow=Cn;exports.ContextMenuInsertColumnLeft=Sn;exports.ContextMenuInsertColumnRight=Tn;exports.ContextMenuInsertRowAbove=yn;exports.ContextMenuInsertRowBelow=xn;exports.ContextMenuItem=Di;exports.ContextMenuPaste=vn;exports.ContextMenuRefreshToc=wn;exports.ContextMenuRefreshTocPageNumbers=kn;exports.ContextMenuSelectAll=Xr;exports.DocumentName=$c;exports.DocumentOutline=Lr;exports.DocxEditor=oE;exports.DocxEditorAuthorStyle=El;exports.DocxEditorColorByChangeType=Pl;exports.DocxEditorContent=va;exports.DocxEditorContentControl=Ai;exports.DocxEditorContextMenu=Qr;exports.DocxEditorDocumentOutline=dc;exports.DocxEditorFontNotice=Ci;exports.DocxEditorHeaderFooterChrome=Ei;exports.DocxEditorHorizontalRuler=mi;exports.DocxEditorHyperLink=ki;exports.DocxEditorImagePropertiesDialog=rs;exports.DocxEditorLoading=xa;exports.DocxEditorLoadingSpinner=Cl;exports.DocxEditorMenu=Mr;exports.DocxEditorNavigation=vc;exports.DocxEditorNotesChrome=Ri;exports.DocxEditorPageNumber=Ti;exports.DocxEditorPageSetupDialog=Tr;exports.DocxEditorParagraphDialog=So;exports.DocxEditorRoot=Vn;exports.DocxEditorShell=Mw;exports.DocxEditorToolbar=Sr;exports.DocxEditorVerticalRuler=fi;exports.DocxEditorViewport=ka;exports.HorizontalRuler=Mo;exports.ImageAltText=Ba;exports.ImageInsertProvider=fa;exports.ImageInsertTrigger=ga;exports.ImagePropertiesTrigger=za;exports.ImageWrap=Oa;exports.LocaleProvider=Yo;exports.Logo=Bi;exports.MenuBar=qi;exports.NAVIGATION_PANE_GAP=rf;exports.NAVIGATION_PANE_INSET=gi;exports.NAVIGATION_PANE_WIDTH=fn;exports.NavigationClose=Or;exports.NavigationFind=zr;exports.NavigationHeader=Hr;exports.NavigationHeadings=Kr;exports.NavigationTab=qr;exports.NavigationTabs=Zr;exports.NavigationTitle=Br;exports.NavigationToggle=$r;exports.OUTLINE_BUTTON_LEFT_OFFSET=mn;exports.OUTLINE_BUTTON_RESERVED_SPACE=JC;exports.OUTLINE_LEFT_OFFSET=Nr;exports.OUTLINE_RESERVED_SPACE=YC;exports.PageIndicator=id;exports.PageNumberTranslationContext=Si;exports.PaginatedDocxEditor=Bc;exports.PaginatedDocxEditorShell=vw;exports.REVIEW_MARKERS_GUTTER=Hl;exports.REVIEW_PANE_GUTTER=Ol;exports.RULER_WIDTH=pn;exports.ReviewRailContext=ft;exports.SEARCH_DEBOUNCE_MS=fc;exports.SEARCH_MATCH_LIMIT=gc;exports.Slot=j;exports.TitleBar=Vc;exports.TitleBarRight=Zi;exports.Toolbar=rd;exports.ToolbarButton=ut;exports.ToolbarContext=fo;exports.ToolbarGroup=Ct;exports.ToolbarImageProperties=rn;exports.VERSION=ng;exports.VerticalRuler=Dr;exports.editorStateActiveSubscriptionCount=pg;exports.isFieldLink=Zn;exports.navigationPaneReservation=Do;exports.navigationShift=bi;exports.normalizeImageBytes=da;exports.notificationYieldsToTask=xd;exports.provideDocxEditor=Mb;exports.reviewGutter=jd;exports.useChromeTranslate=yd;exports.useContentControl=Et;exports.useContentControlInstance=Ca;exports.useContextMenuTarget=Cf;exports.useDocumentOutline=hi;exports.useDocumentSearch=vi;exports.useDocxEditor=H;exports.useDocxSource=lE;exports.useEditorCaret=yE;exports.useEditorCommand=le;exports.useEditorEvent=Is;exports.useEditorSnapshot=Aw;exports.useEditorState=q;exports.useEditorValueCommand=er;exports.useFontFamily=Wa;exports.useFonts=uE;exports.useHeaderFooterState=xc;exports.useHyperlinkPopup=wl;exports.useHyperlinkPopupInstance=Ta;exports.useNavigationPane=yi;exports.useNavigationShift=yo;exports.useNotePropertiesState=Dc;exports.useNoteScopeState=_c;exports.usePageSetup=Po;exports.useParagraphFormat=zl;exports.useParagraphIndent=rc;exports.useParagraphStyle=Ga;exports.useReviewAuthors=gE;exports.useReviewGutter=en;exports.useScopeClassName=ot;exports.useScopedChromeAnchor=Vr;exports.useTableBorderTargetLabel=rm;exports.useToolbarContext=yg;exports.useToolbarLabel=X;exports.useToolbarLabelFor=ua;exports.useTranslation=_;exports.useZoom=ls;