@docx-editor.dev/react 2.14.1 → 2.15.1

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,4 +1,4 @@
1
- 'use strict';var nt=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 nt__namespace=/*#__PURE__*/_interopNamespace(nt);var ye__namespace=/*#__PURE__*/_interopNamespace(ye);var Bd={version:"2.14.1"};var O0=Bd.version;var Zd="(prefers-color-scheme: dark)";function qd(){return typeof window<"u"&&typeof window.matchMedia=="function"}function Kd(){return qd()?window.matchMedia(Zd).matches:false}function zd(e,t){return e==="dark"||e==="system"&&t}function Vd(e){if(!qd())return ()=>{};let t=window.matchMedia(Zd);e(t.matches);let n=o=>e(o.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}var El=nt.createContext(null);function A(){return nt.useContext(El)}var mt=nt.createContext(null);var wl=nt.createContext(i18n.en),Rl=nt.createContext("en");function tn({i18n:e,children:t}){let n=nt.useContext(wl),o=nt.useContext(Rl),r=typeof e?._lang=="string"?e._lang:o,a=nt.useMemo(()=>i18n.deepMerge(n,e),[n,e]);return jsxRuntime.jsx(Rl.Provider,{value:r,children:jsxRuntime.jsx(wl.Provider,{value:a,children:t})})}function D(){let e=nt.useContext(wl),t=nt.useContext(Rl);return {t:nt.useMemo(()=>i18n.createT(e,t),[e,t]),catalogue:e}}function jd(e){let{t}=D();return nt.useCallback((n,o)=>e?.get(n)??t(n,o),[e,t])}var kl=0,Ml=false,Il=false;function Yd(){let e=globalThis.navigator?.scheduling;return typeof e?.isInputPending!="function"?false:e.isInputPending({includeContinuous:true})?true:(Ml||(Ml=true,kl+=1,queueMicrotask(()=>{Ml=false;}),Il||(Il=true,setTimeout(()=>{Il=false,kl=0;},0))),kl>16)}function Xd(e){let t=false;return ()=>{if(t)return;t=true;let n=()=>{t=false,e();};Yd()?setTimeout(n,0):queueMicrotask(n);}}var W0=()=>{},Dl=0;function U0(){return Dl}function Nl(e){return Xd(e)}function O(e,t=Object.is,n){let o=A(),r=n?.onSubscribe,a=n?.onUnsubscribe,i=nt.useCallback(d=>{if(!o)return W0;let p=false;Dl++,r?.();let m=Nl(()=>{p||d();}),g=[o.on("change",m),o.on("selectionChange",m),o.on("error",m)];return ()=>{p=true,Dl--,a?.();for(let u of g)u();}},[o,r,a]),l=nt.useMemo(()=>{let d=false,p,m;return g=>{if(d&&g===p)return m;let u=e(g);return d&&t(m,u)?(p=g,m):(d=true,p=g,m=u,u)}},[o,e,t]),c=nt.useCallback(()=>l(o?o.snapshot():editor.LOADING_SNAPSHOT),[o,l]),s=nt.useCallback(()=>l(editor.LOADING_SNAPSHOT),[l]);return nt.useSyncExternalStore(i,c,s)}var Qd=12700,Jd=96;function X0(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function J0(e,t,n,o){let r=e*72/n,a=t*72/o;return {widthPoints:Math.max(1,Math.round(r*100)/100),heightPoints:Math.max(1,Math.round(a*100)/100)}}function Sa(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(!X0(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:a,heightPoints:i}=J0(o.pixelWidth,o.pixelHeight,o.dpiX??Jd,o.dpiY??Jd);return Object.freeze({ok:true,bytes:e,mime:n,widthPoints:a,heightPoints:i})}function Wt(e){return Math.round(e/Qd*100)/100}function Wn(e){return Math.round(e*Qd)}var yo=nt.createContext({t:void 0,onSave:void 0});function eb(){return nt.useContext(yo)}function Ta(e){let{t}=D();return n=>e?.(n)??t(n)}function J(){let{t:e}=nt.useContext(yo);return Ta(e)}function ib(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason&&e.value===t.value}function Ll(e){return typeof e=="string"}function le(e){let t=A(),{t:n}=D(),o=Ll(e)?e:editor.editorCommandKey(e),r=nt.useRef(e);r.current=e;let a=nt.useCallback(c=>{let s=r.current;if(Ll(s)){let p=editor.toolbarCommandState(t,s);return {active:p.active,enabled:p.enabled,disabledReason:i18n.localizeDisabledReason(p.disabledReason,n),value:p.value??null}}if(!t)return {active:false,enabled:false,disabledReason:null,value:null};let d=t.can(s);return {active:t.isActive(s),enabled:d.ok,disabledReason:d.ok?null:i18n.localizeDisabledReason(d.reason??null,n),value:null}},[t,o,n]),i=O(a,ib),l=nt.useCallback(()=>{let c=r.current;return Ll(c)?editor.runToolbarCommand(t,c).ok:t?t.exec(c).ok:false},[t,o]);return nt.useMemo(()=>({execute:l,isActive:i.active,isEnabled:i.enabled,disabledReason:i.disabledReason,value:i.value}),[l,i])}var db=()=>()=>{},ub=()=>true,pb=()=>false;function nn(){let e=nt.useSyncExternalStore(db,ub,pb);return nt.useCallback(t=>e?i18n.platformShortcut(t):t,[e])}function bb(e,t){return typeof t!="function"?e:typeof e!="function"?t:n=>{e(n),n.defaultPrevented||t(n);}}function hb(e,t){let n={...e,...t};for(let o of Object.keys(e))/^on[A-Z]/.test(o)?n[o]=bb(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=nt.Children.only(e);if(!nt.isValidElement(n))return null;let o=n.props,r=hb(t,o),a=n.ref,i=t.ref;return (a||i)&&(r.ref=l=>{for(let c of [a,i])typeof c=="function"?c(l):c&&typeof c=="object"&&(c.current=l);}),nt.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 Q(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 B(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function xo(e){let{slot:t,icon:n,asChild:o,className:r,children:a,hidden:i}=e,{execute:l,isActive:c,isEnabled:s,disabledReason:d,value:p}=le(t),m=J(),g=nn();if(i)return null;let u=X(t),f=g(m(u?.labelKey??t)),b=editor.chromeSlotIsToggle(t),x={onClick:()=>l(),onMouseDown:B,disabled:!s,"data-slot":t,className:`docx-toolbar__button${r?` ${r}`:""}`,...c?{"data-active":""}:{},...s?{}:{"data-disabled":""},...b?{"aria-pressed":c}:{},...p!==null?{"data-value":p}:{},"aria-label":f,title:d??f};return o?jsxRuntime.jsx(j,{...x,children:a}):jsxRuntime.jsx("button",{type:"button",...x,children:n??a??Q(u?.paths)})}xo.docxToolbarPart=true;var wb="image/png,image/jpeg,image/gif",Al=nt.createContext(null);function au(){let e=nt.useContext(Al);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function Un(){return nt.useContext(Al)}function Pa({children:e}){let t=A(),{t:n}=D(),o=nt.useRef(null),r=nt.useRef(false),a=nt.useCallback(()=>editor.toolbarCommandState(t,"image.insert"),[t]),i=O(a,(f,b)=>f.enabled===b.enabled&&f.disabledReason===b.disabledReason),l=i.enabled,c=i18n.localizeDisabledReason(i.disabledReason,n),s=nt.useCallback(async f=>{if(!t||r.current)return;let b=Sa(f);if(!b.ok){window.alert(n(b.reasonKey));return}let x={type:"insertImage",data:b.bytes,mime:b.mime,widthPoints:b.widthPoints,heightPoints:b.heightPoints},T=t.canExecuteImageCommand?.(x);if(T&&!T.ok){window.alert(T.reason??n("imageInsert.errors.refused"));return}r.current=true;try{let h=await editor.executeImageCommand(t,x);h.ok?t.focus():window.alert(h.reason??n("imageInsert.errors.refused"));}finally{r.current=false;}},[t,n]),d=nt.useCallback(async f=>{let b=f?.[0];if(!b)return;let x=await b.arrayBuffer();await s(new Uint8Array(x));},[s]),p=nt.useCallback(async f=>{if(!f)return;let b=[...f.files].find(x=>x.type.startsWith("image/"));if(b){await d([b]);return}for(let x of f.items){if(x.kind!=="file"||!x.type.startsWith("image/"))continue;let T=x.getAsFile();if(!T)continue;let h=await T.arrayBuffer();await s(new Uint8Array(h));return}},[s,d]),m=nt.useCallback(()=>{l&&o.current?.click();},[l]),g=nt.useCallback(async f=>{let b=f.currentTarget;await d(b.files),b.value="";},[d]),u=nt.useMemo(()=>({openFilePicker:m,insertFromFileList:d,insertFromDataTransfer:p,isEnabled:l,disabledReason:c,inputRef:o,onInputChange:g}),[m,d,p,l,c,g]);return jsxRuntime.jsxs(Al.Provider,{value:u,children:[jsxRuntime.jsx("input",{ref:o,type:"file",accept:wb,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:g,onMouseDown:f=>f.stopPropagation()}),e]})}function Ea({className:e,hidden:t,asChild:n,children:o}){let{openFilePicker:r,isEnabled:a,disabledReason:i}=au(),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:!a,...a?{}:{"data-disabled":""},"aria-label":s,title:i??s,onMouseDown:B,onClick:r};return n?jsxRuntime.jsx(j,{...d,children:o}):jsxRuntime.jsx("button",{...d,children:o??Q(c?.paths)})}Ea.docxSlot="image.insert";var Gn=Object.assign(Ea,{docxSlot:"image.insert"});var Bb=["nw","n","ne","e","se","s","sw","w"],cu=40,du=12;function Zb(e){return `imageOverlay.handle.${e}`}function qb(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 Kb(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 zb(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 Ol({containerRef:e,portalRef:t,scrollPort:n}){let o=A(),{t:r}=D(),[a,i]=nt.useState(null),[l,c]=nt.useState(null),[s,d]=nt.useState({left:0,top:0}),p=nt.useRef(null);p.current=l;let m=nt.useRef(null),g=nt.useRef(null),u=nt.useRef(null),f=nt.useRef(null),b=nt.useRef(null);nt.useEffect(()=>{let C=e.current;if(!C)return;let k=R=>{let L=(R.target instanceof Element?R.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");f.current=L??null,L&&L===a?.id&&queueMicrotask(()=>u.current?.focus({preventScroll:true}));};return C.addEventListener("pointerdown",k,{capture:true}),()=>C.removeEventListener("pointerdown",k,{capture:true})},[e,a?.id]),nt.useEffect(()=>{if(!o){i(null);return}let C=()=>{i(editor.selectedDrawingOverlayTargetOf(o.surface));},k=()=>{queueMicrotask(C);};C();let R=[o.on("change",k),o.on("selectionChange",C)];return ()=>{for(let N of R)N();}},[o]);let x=nt.useCallback(()=>{d(C=>{let k=editor.overlayHostOrigin(e.current);return k.left===C.left&&k.top===C.top?C:k});},[e]);nt.useEffect(()=>{x();let C=t.current;if(!C||typeof ResizeObserver!="function")return;let k=new ResizeObserver(x);k.observe(C);let R=e.current;return R&&k.observe(R),()=>k.disconnect()},[e,t,x,a]),nt.useEffect(()=>{if(n){b.current=n;return}let C=e.current;if(!C||!o?.surface)return;let k=C.closest(".docx-editor__scroll-container");if(!k)return;let R=o.surface.overlayCoordinates();return b.current=editor.createImageOverlayScrollPort(k,R.paintScale),()=>{b.current=null;}},[e,o,n]);let T=nt.useCallback(()=>{c(null),m.current=null;let C=g.current;if(g.current=null,C)try{C.releasePointerCapture(C._lastPointerId??0);}catch{}},[]),h=nt.useCallback((C,k,R,N,L,H,_)=>{if(!o?.surface)return;let M=o.surface.layout(),E=editor.captureImageMutationPreconditions(o);if(E){m.current=Object.freeze({x:N,y:L}),g.current=H,H._lastPointerId=_;try{H.setPointerCapture(_);}catch{}c({session:Object.freeze({drawingNodeId:R.id,startBounds:Object.freeze({x:R.x,y:R.y,width:R.width,height:R.height}),startWidthEmu:R.widthEmu,startHeightEmu:R.heightEmu,startPosition:R.position,anchorFrameOrigin:R.anchorFrameOrigin,transform:R.transform,mode:C,handle:k,preconditions:E,layoutRevision:M.revision,packageRevision:o.surface.session.packageRevision(),kind:R.kind}),bounds:R,accumulatedScrollPt:0}),u.current?.focus({preventScroll:true});}},[o]),v=nt.useCallback((C,k,R,N,L)=>{if(!o)return;if(editor.isStaleImageInteractionCommit(o,C)){T();return}C.mode==="resize"?o.exec({type:"setImageProperties",widthEmu:k,heightEmu:R,...L?.mode==="simple"?{horizontalEmu:L.horizontalEmu,verticalEmu:L.verticalEmu}:{},...L?.mode==="frame"?{...L.horizontalEmu!==void 0?{horizontalEmu:L.horizontalEmu}:{},...L.verticalEmu!==void 0?{verticalEmu:L.verticalEmu}:{}}:{}}):C.mode==="move"&&L&&o.exec({type:"setImagePosition",...L}),T();},[T,o]),y=nt.useCallback(C=>{if(!o)return;let k=p.current?.bounds??editor.selectedDrawingOverlayTargetOf(o.surface);if(!k)return;if(p.current&&C.key==="Escape"){C.preventDefault(),C.stopPropagation(),T();return}if(p.current)return;let R=C.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(C.key==="Delete"||C.key==="Backspace"){C.preventDefault(),C.stopPropagation(),o.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(C.key))return;C.preventDefault(),C.stopPropagation();let N=C.key==="ArrowLeft"?-R:C.key==="ArrowRight"?R:0,L=C.key==="ArrowUp"?-R:C.key==="ArrowDown"?R:0;if(C.altKey){if(!k.canResize)return;let _=zb(N,L),M=editor.computeImageResizeResult({handle:_,startWidthEmu:k.widthEmu,startHeightEmu:k.heightEmu,startBounds:{x:k.x,y:k.y,width:k.width,height:k.height},startPosition:k.position,anchorFrameOrigin:k.anchorFrameOrigin,deltaXPt:N,deltaYPt:L,transform:k.transform,preserveAspect:editor.resizePreservesAspect(_,k.aspectLocked,C.shiftKey),kind:k.kind});o.exec({type:"setImageProperties",widthEmu:M.widthEmu,heightEmu:M.heightEmu,...M.position?.mode==="simple"?{horizontalEmu:M.position.horizontalEmu,verticalEmu:M.position.verticalEmu}:{},...M.position?.mode==="frame"?{...M.position.horizontalEmu!==void 0?{horizontalEmu:M.position.horizontalEmu}:{},...M.position.verticalEmu!==void 0?{verticalEmu:M.position.verticalEmu}:{}}:{}});return}if(k.kind!=="anchored"||!k.canMove||!k.position)return;let H=editor.computeMovedImagePosition(k.position,N,L);o.exec({type:"setImagePosition",...H});},[T,o]);nt.useEffect(()=>{if(!l||!o?.surface)return;let C=o.surface.overlayCoordinates(),k=N=>{let L=p.current,H=m.current;if(!L||!H)return;let _=editor.cssPixelsToLayoutPoints(N.clientX-H.x,C.paintScale),M=editor.cssPixelsToLayoutPoints(N.clientY-H.y,C.paintScale);if(L.session.mode==="move"){let I=0,ae=b.current,z=e.current?.closest(".docx-editor__scroll-container");if(ae&&z){let $=z.getBoundingClientRect();N.clientY>$.bottom-cu?I=du:N.clientY<$.top+cu&&(I=-du),I!==0&&(I=ae.scrollBy(I));}let V=L.accumulatedScrollPt+I;c({...L,accumulatedScrollPt:V,bounds:Object.freeze({...L.bounds,x:L.session.startBounds.x+_,y:L.session.startBounds.y+M+V})});return}if(!L.session.handle)return;let E=editor.computeImageResizeResult({handle:L.session.handle,startWidthEmu:L.session.startWidthEmu,startHeightEmu:L.session.startHeightEmu,startBounds:L.session.startBounds,startPosition:L.session.startPosition,anchorFrameOrigin:L.session.anchorFrameOrigin,deltaXPt:_,deltaYPt:M,transform:L.session.transform,preserveAspect:editor.resizePreservesAspect(L.session.handle,L.bounds.aspectLocked,N.shiftKey),kind:L.session.kind});c({...L,bounds:Object.freeze({...L.bounds,x:E.previewBounds.x,y:E.previewBounds.y,width:E.previewBounds.width,height:E.previewBounds.height,widthEmu:E.widthEmu,heightEmu:E.heightEmu})});},R=N=>{let L=p.current;if(L)if(N.type==="pointerup"){let H=editor.cssPixelsToLayoutPoints(N.clientX-(m.current?.x??N.clientX),C.paintScale),_=editor.cssPixelsToLayoutPoints(N.clientY-(m.current?.y??N.clientY),C.paintScale),M=editor.finalizeImageOverlayInteraction({session:L.session,deltaXPt:H,deltaYPt:_,accumulatedScrollPt:L.accumulatedScrollPt,aspectLocked:L.bounds.aspectLocked,shiftKey:N.shiftKey,anchorFrameOrigin:L.session.anchorFrameOrigin});v(L.session,M.widthEmu,M.heightEmu,M.previewBounds,M.position);}else T();};return window.addEventListener("pointermove",k),window.addEventListener("pointerup",R),window.addEventListener("pointercancel",R),()=>{window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",R),window.removeEventListener("pointercancel",R);}},[T,v,e,o,l]),nt.useEffect(()=>{!a||f.current!==a.id||(f.current=null,u.current?.focus({preventScroll:true}));},[a]);let S=l?.bounds??a,w=nt.useMemo(()=>{if(!o?.surface||!S)return null;let C=o.surface.publishedLayout(),k=o.surface.overlayCoordinates(),R=editor.overlayFrameToSheetCssPixels(C,{pageIndex:S.pageIndex,x:S.x,y:S.y,width:S.width,height:S.height},k),N={left:R.left+s.left,top:R.top+s.top,width:R.width,height:R.height},L=S.canResize,H=S.kind==="anchored"&&S.canMove;return jsxRuntime.jsxs("div",{ref:u,className:"docx-image-selection-overlay","data-drawing-node-id":S.id,tabIndex:0,onKeyDown:y,children:[jsxRuntime.jsx("div",{className:`docx-image-selection-overlay__frame${H?" docx-editor-one-surface__overlay-control":""}`,role:"group","aria-label":r("imageOverlay.selection"),style:{left:`${N.left}px`,top:`${N.top}px`,width:`${N.width}px`,height:`${N.height}px`,cursor:H?"move":"default"},onPointerDown:_=>{B(_),!(!H||!S.position)&&_.button===0&&(_.preventDefault(),_.stopPropagation(),h("move",null,S,_.clientX,_.clientY,_.currentTarget,_.pointerId));}}),L?Bb.map(_=>{let M=Kb(_);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(Zb(_)),tabIndex:0,style:{left:`calc(${N.left}px + ${N.width}px * ${parseFloat(M.x)/100} - 5px)`,top:`calc(${N.top}px + ${N.height}px * ${parseFloat(M.y)/100} - 5px)`,cursor:qb(_)},onPointerDown:E=>{B(E),E.button===0&&(E.preventDefault(),E.stopPropagation(),h("resize",_,S,E.clientX,E.clientY,E.currentTarget,E.pointerId));}},_)}):null]})},[S,h,o,y,s.left,s.top,r]);return !w||!t.current?null:reactDom.createPortal(w,t.current)}function Zl(e){return [...e.items].some(t=>t.kind==="file"&&t.type.startsWith("image/"))}function Ra({className:e}){let t=A(),n=Un(),o=nt.useRef(null),r=nt.useRef(null);nt.useLayoutEffect(()=>{let c=o.current;if(!(!t||!c))return t.attach(c),()=>{t.detach();}},[t]);let a=nt.useCallback(c=>{if(!n?.isEnabled)return;let s=c.clipboardData;s&&Zl(s)&&(editor.clipboardPasteLandsContent(s)||(c.preventDefault(),n.insertFromDataTransfer(s)));},[n]),i=nt.useCallback(c=>{!n?.isEnabled||!Zl(c.dataTransfer)||c.preventDefault();},[n]),l=nt.useCallback(c=>{if(n?.isEnabled&&Zl(c.dataTransfer)){if(editor.clipboardDropLandsText(c.dataTransfer)){if((c.target instanceof Element?c.target:null)?.closest("[contenteditable]")?.getAttribute("contenteditable")==="true")return;c.preventDefault();return}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:a,onDragOver:i,onDrop:l}),t?jsxRuntime.jsx(Ol,{containerRef:o,portalRef:r}):null]})}function Ee(e){return e/1440*96}function ka(e){return e/96*1440}function je(e){return `${Math.round(e*100)/100}px`}function ql(e){return e/2}var jb=e=>e.isLoading||e.isOpening===true,Yb=e=>({width:Ee(e.pageSetup?.pageWidthTwips??12240)*e.zoom,height:Ee(e.pageSetup?.pageHeightTwips??15840)*e.zoom}),Xb=(e,t)=>e.width===t.width&&e.height===t.height;function Kl({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}function Jb({when:e=false,overlay:t=false,className:n,style:o,children:r}){let a=O(jb),i=O(Yb,Xb),{t:l}=D();if(!e&&!a)return null;let c=`docx-editor docx-editor__loading${t?" docx-editor__loading--overlay":""}${n?` ${n}`:""}`;return jsxRuntime.jsx("div",{className:c,style:o,role:"status","aria-live":"polite",children:r??jsxRuntime.jsx("div",{className:"docx-paginated-surface docx-editor__loading-surface",style:{width:i.width,height:i.height},children:jsxRuntime.jsx("div",{className:"docx-pages",children:jsxRuntime.jsx("div",{className:"docx-page docx-editor__loading-page",children:jsxRuntime.jsxs("div",{className:"docx-editor__loading-page-status",children:[jsxRuntime.jsx(Kl,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:l("loading.label")})]})})})})})}var Ma=Object.assign(Jb,{Spinner:Kl});function fu(){let e=new Set,t=new Map,n=new Map,o=0,r=null,a=false;function i(){if(e.size===0&&t.size===0)return;if(t.size===0)return "kind";let m=Object.create(null),g=[...t].sort((u,f)=>(n.get(u[0])??0)-(n.get(f[0])??0));for(let[,{author:u,style:f}]of g)m[u]=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(([u,f])=>`${u}\0${JSON.stringify(f)}`).sort();return `${m.others??"kind"}${g.join("")}`}function d(){if(!r)return;let m=i(),g=s(m);if(g!==l){if(m===void 0){a&&(r.setRevisionStyles("author"),a=false,l=g);return}r.setRevisionStyles(m),a=true,l=g;}}function p(){!r||c||(c=true,queueMicrotask(()=>{c=false,d();}));}return {registerScheme(m){e.add(m),p();},register(m,g,u){n.has(m)||n.set(m,o++),t.set(m,{author:g,style:u}),p();},unregister(m){(e.delete(m)||t.delete(m))&&p();},connect(m){r=m;let g=i();a=m!==null&&g!==void 0,l=m===null?null:s(g),p();},current:i}}var Yn=nt.createContext(null);function hu(){let e=nt.useRef(null);return e.current===null&&(e.current=Symbol("revision-style-declaration")),e.current}function zl(){let e=nt.useContext(Yn),t=hu();return nt.useEffect(()=>{if(e)return e.registerScheme(t),()=>e.unregister(t)},[e,t]),null}function Vl(e){let{author:t,color:n,background:o,spanClassName:r,avatarUrl:a}=e,i=nt.useContext(Yn),l=hu();return nt.useEffect(()=>{if(i)return i.register(l,t,{...n!==void 0?{color:n}:{},...o!==void 0?{background:o}:{},...r!==void 0?{spanClassName:r}:{},...a!==void 0?{avatarUrl:a}:{}}),()=>i.unregister(l)},[i,l,t,n,o,r,a]),null}function Xn(e){return e.paragraphId===""}var To=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),ih=e=>e;function lh(){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,i=(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.getBoundingClientRect();if(e(i))return {left:i.left,top:i.bottom}}return null}var Jn=nt.createContext(null);function $l(){let e=nt.useContext(Jn),t=_a(e===null);return e??t}function _a(e=true){let t=A(),[n,o]=nt.useState(To),r=nt.useRef(null),a=nt.useRef(n);a.current=n;let i=O(ih),l=t?t.can({type:"insertText",text:""}).ok:false,c=nt.useCallback(()=>{let h=r.current;h&&(h.editor.releaseSelection(h.pin),r.current=null);},[]),s=nt.useCallback((h,v)=>{c(),o({mode:h?"reading":"editing",link:h??null,anchor:v??null,text:h?.text??"",url:h?h.kind==="internal"?`#${h.anchor??""}`:h.authored:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,c]),d=nt.useCallback(()=>{c(),o(To);},[c]);nt.useEffect(()=>c,[c]);let p=nt.useCallback(()=>{let h=lh();c();let v=t?.surface?.hyperlinks.linkAtCaret()??t?.surface?.hyperlinks.fieldLinkAtCaret()??null;if(v&&Xn(v)){s(v,h);return}if(v){o({mode:"editing",link:v,anchor:h,text:v.text,url:v.kind==="internal"?`#${v.anchor??""}`:v.authored,copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});return}let y=t?.query({type:"selectedText"})??"",S=t?.retainSelection()??null;t&&S&&(r.current={editor:t,pin:S}),o({mode:"editing",link:null,anchor:h,text:y,url:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,s,c]);nt.useEffect(()=>{if(!(!t||!e))return t.setHyperlinkChrome({onPopover:h=>s(h.link,{left:h.rect.left,top:h.rect.bottom}),onRequest:p})},[t,e,s,p]),nt.useEffect(()=>{let h=a.current;if(h.mode!=="reading"||!h.link)return;let v=Xn(h.link)?t?.surface?.hyperlinks.fieldLinkAtCaret()??null:t?.surface?.hyperlinks.linkAtCaret()??null;v&&v.id===h.link.id||o(To);},[i,t]),nt.useEffect(()=>{let h=a.current;if(h.mode!=="editing"||h.link)return;let v=t?.surface;!v||v.retainedSelection()||o(To);},[i,t]);let m=nt.useCallback(async()=>{let h=a.current.link?.href;if(!h)return false;try{await navigator.clipboard.writeText(h);}catch{return false}return o(v=>({...v,copied:true})),true},[]),g=nt.useCallback(()=>{o(h=>({...h,mode:"editing",copied:false,error:false}));},[]),u=nt.useCallback(h=>{o(v=>({...v,text:h,copied:false,error:false}));},[]),f=nt.useCallback(h=>{o(v=>({...v,url:h,copied:false,error:false}));},[]),b=nt.useCallback(()=>{let h=a.current,v=t?.surface?.hyperlinks;if(!v)return false;let y=h.url.trim();if(y.length===0)return o(C=>({...C,error:true})),false;let S=y.startsWith("#");return v.applyHyperlink({...S?{anchor:y.slice(1)}:{url:y},...h.text.trim().length>0?{text:h.text}:{}})?(d(),true):(o(C=>({...C,error:true})),false)},[t,d]),x=nt.useCallback(()=>{let h=t?.surface?.hyperlinks,v=a.current.link;if(!h)return false;let y=h.removeHyperlink(v?.id);return y&&d(),y},[t,d]),T=nt.useCallback(()=>{let h=t?.surface?.navigation,v=a.current.link;if(!h||!v)return false;if(v.kind==="internal"){let S=v.anchor?h.goToBookmark(v.anchor):false;return S&&o(To),S}let y=h.openExternal(v.href);return y&&o(To),y},[t]);return nt.useMemo(()=>({state:n.mode==="closed"?To:{...n,canEdit:l},open:s,openAtCaret:p,close:d,copy:m,beginEdit:g,setText:u,setUrl:f,commitEdit:b,unlink:x,openTarget:T}),[n,l,s,p,d,m,g,u,f,b,x,T])}var Ye={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function uh(e){return e==="sdtLocked"||e==="sdtContentLocked"}function ph(e){return e==="contentLocked"||e==="sdtContentLocked"}function Ul(e,t){return !e.ok&&e.code===t}function Et(){let e=nt.useContext(Gl),t=Da();return e??t}function Da(){let e=A(),[t,n]=nt.useState(false),[o,r]=nt.useState(false),[a,i]=nt.useState(false),l=O(w=>w),c=e?.surface??null,s=c?.contentControls;nt.useEffect(()=>{r(s?.showAll()??c?.state().contentControls.showAll??false),i(s?.formFill()??c?.state().contentControls.formFill??false);},[l,s,c]);let d=nt.useMemo(()=>{if(!e)return null;let w=s?.atCaret()??null;if(w){let E=s?.disabledReason(w.id,"edit")??null,I=s?.disabledReason(w.id,"remove")??null;return {id:w.id,tag:w.tag??null,alias:w.alias??null,controlType:w.controlType,locked:ph(w.effectiveLock)||E==="locked",removalLocked:uh(w.effectiveLock)||I==="locked",placeholder:w.placeholder,bound:w.bound||E==="bound",effectiveLock:w.effectiveLock}}let C=e.query({type:"contentControlAt"});if(!C)return null;let k=s?.disabledReason(C.id,"edit")??null,R=s?.disabledReason(C.id,"remove")??null,N=e.can({type:"setContentControlValue",value:""}),L=e.can({type:"removeContentControl"}),H=C.locked===true||k==="locked"||Ul(N,"locked"),_=k==="bound"||Ul(N,"bound"),M=R==="locked"||Ul(L,"locked");return {id:C.id,tag:C.tag??null,alias:C.alias??null,controlType:C.controlType,locked:H,removalLocked:M,placeholder:false,bound:_,effectiveLock:null}},[e,l,s]),p=nt.useMemo(()=>e?e.query({type:"contentControls"}):[],[e,l]),m=nt.useCallback(w=>{s?.setShowAll(w),r(w);},[s]),g=nt.useCallback(w=>{s?.setFormFill(w),i(w);},[s]),u=nt.useCallback(()=>m(!o),[m,o]),f=nt.useCallback(()=>g(!a),[g,a]),b=nt.useCallback(()=>n(true),[]),x=nt.useCallback(()=>n(false),[]),T=nt.useCallback(()=>n(w=>!w),[]),h=nt.useMemo(()=>{if(!d)return "no content control at the current selection";if(s){let C=s.disabledReason(d.id,"edit");return C==="locked"?"the content control is locked":C==="bound"?"the content control is bound to external data":C==="notFound"?"the content control was not found":C}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 w=e.can({type:"setContentControlValue",value:""});return w.ok?null:w.reason},[d,s,e]),v=nt.useMemo(()=>{if(!d)return "no content control at the current selection";if(s){let C=s.disabledReason(d.id,"remove");return C==="locked"?"the content control is locked":C==="notFound"?"the content control was not found":C}if(d.removalLocked)return "the content control is locked";if(!e)return "no document is loaded";let w=e.can({type:"removeContentControl"});return w.ok?null:w.reason},[d,s,e]),y=nt.useCallback(w=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(s&&d){let C=s.disabledReason(d.id,"edit");if(C)return {ok:false,code:C==="bound"?"bound":C==="locked"?"locked":"notFound",reason:C==="bound"?"the content control is bound to external data":C==="locked"?"the content control is locked":"the content control was not found"}}return e.exec({type:"setContentControlValue",value:w})},[e,s,d]),S=nt.useCallback(()=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(s){let w=d?.id;if(!w)return {ok:false,code:"notFound",reason:"no content control at the current selection"};let C=s.disabledReason(w,"remove");return C?{ok:false,code:C==="locked"?"locked":"notFound",reason:C==="locked"?"the content control is locked":"the content control was not found"}:s.remove(w)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:"the edit was refused"}}return e.exec({type:"removeContentControl"})},[e,s,d]);return nt.useMemo(()=>({control:d,controls:p,showAll:o,formFill:a,inspectorOpen:t,canSetValue:h===null&&d!==null,canRemove:v===null&&d!==null,setValueDisabledReason:h,removeDisabledReason:v,setShowAll:m,toggleShowAll:u,setFormFill:g,toggleFormFill:f,openInspector:b,closeInspector:x,toggleInspector:T,remove:S,setValue:y}),[d,p,o,a,t,h,v,m,u,g,f,b,x,T,S,y])}var Gl=nt.createContext(null);function yu(){let e=0,t=0,n=null,o=new Set,r=new Set,a=new Set,i=l=>{for(let c of [...l])c();};return {getShift:()=>e,setShift(l){let c=Math.max(0,Math.round(l));c!==e&&(e=c,i(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,i(r));},subscribeReservation(l){return r.add(l),()=>r.delete(l)},getViewport:()=>n,setViewport(l){l!==n&&(n=l,i(a));},subscribeViewport(l){return a.add(l),()=>a.delete(l)}}}var Yl=nt.createContext(null);function Po(){return nt.useContext(Yl)}var xu=()=>0,Xl=()=>()=>{};function Eo(){let e=Po(),t=nt.useCallback(o=>e?e.subscribeShift(o):Xl(),[e]),n=nt.useCallback(()=>e?e.getShift():0,[e]);return nt.useSyncExternalStore(t,n,xu)}function Su(){let e=Po(),t=nt.useCallback(o=>e?e.subscribeReservation(o):Xl(),[e]),n=nt.useCallback(()=>e?e.getReservation():0,[e]);return nt.useSyncExternalStore(t,n,xu)}function At(){let e=Po(),t=nt.useCallback(r=>e?e.subscribeViewport(r):Xl(),[e]),n=nt.useCallback(()=>e?e.getViewport():null,[e]),o=nt.useCallback(()=>null,[]);return nt.useSyncExternalStore(t,n,o)}function yh(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 xh(e){let t=nt.useRef(e);t.current=e;let[n,o]=nt.useState(null),{onReady:r,onChange:a,onFontError:i,...l}=e,c=nt.useMemo(()=>({onReady:s=>{o(s),t.current.onReady?.(s);},onChange:s=>t.current.onChange?.(s),onFontError:s=>t.current.onFontError?.(s)}),[]);return {DocxEditorRoot:or,rootProps:l,rootListeners:c,editorRef:n}}function or(e){let{document:t,fonts:n,zoom:o,zoomMode:r,tableInteractionLabel:a,imageDecodePort:i,children:l}=e,{t:c}=D(),s=nt.useCallback((y,S)=>c(y,S),[c]),d=nt.useRef(e);d.current=e;let[p,m]=nt.useState(null),g=nt.useRef(null);g.current??=fu();let u=g.current;nt.useEffect(()=>{let y=d.current,S=y.translate??s,w=u.current(),C=editor.createDocxEditor({...y.document!==void 0?{document:y.document}:{},...y.fonts?{fonts:y.fonts}:{},...y.author!==void 0?{author:y.author}:{},...y.locale!==void 0?{locale:y.locale}:{},translate:S,...y.mode!==void 0?{mode:y.mode}:{},...w!==void 0?{revisionStyles:w}:{},...y.modules!==void 0?{modules:y.modules}:{},...y.zoom!==void 0?{zoom:y.zoom}:{},...y.zoomMode!==void 0?{zoomMode:y.zoomMode}:{},...y.tableInteractionLabel?{tableInteractionLabel:y.tableInteractionLabel}:{},...y.imageDecodePort?{imageDecodePort:y.imageDecodePort}:{},onFontError:R=>d.current.onFontError?.(R)}),k=C.on("change",R=>d.current.onChange?.(R));return m(C),()=>{k(),C.destroy(),m(R=>R===C?null:R);}},[t,n,s,i,u]),nt.useEffect(()=>{if(!p)return;if(!p.snapshot().isOpening){d.current.onReady?.(p);return}let y=p.on("change",()=>{y(),d.current.onReady?.(p);});return y},[p]);let f=nt.useRef({editor:null,zoom:void 0,mode:void 0});nt.useEffect(()=>{if(!p)return;f.current.editor!==p&&(f.current={editor:p,zoom:void 0,mode:void 0});let S=false;o!==void 0&&o!==f.current.zoom&&(f.current.zoom=o,p.setZoom(o),S=true);let w=f.current.mode,C=r!==void 0&&(w===void 0||!yh(w,r)),k=r===void 0?null:editor.resolveZoomMode(r),R=S&&r!==void 0&&k!==null&&k.type==="fit";(C||R)&&(f.current.mode=r,p.setZoomMode(r));},[p,o,r]),nt.useEffect(()=>{p&&p.setTableInteractionLabel(a??editor.defaultTableLabel);},[p,a]);let[b,x]=nt.useState(0),T=nt.useRef([]),h=nt.useMemo(()=>({mounted:b,register:()=>(x(y=>y+1),()=>x(y=>Math.max(0,y-1))),registerCommentDraft:y=>(T.current.push(y),()=>{let S=T.current.indexOf(y);S!==-1&&T.current.splice(S,1);}),requestCommentDraft:()=>{let y=T.current.at(-1);return y?(y(),true):false}}),[b]),v=nt.useMemo(yu,[]);return nt.useEffect(()=>(u.connect(p),()=>u.connect(null)),[u,p]),jsxRuntime.jsx(mt.Provider,{value:h,children:jsxRuntime.jsx(El.Provider,{value:p,children:jsxRuntime.jsx(Yl.Provider,{value:v,children:jsxRuntime.jsx(Yn.Provider,{value:u,children:jsxRuntime.jsx(Sh,{children:jsxRuntime.jsx(Th,{children:jsxRuntime.jsx(Pa,{children:l})})})})})})})}function Sh({children:e}){let t=_a(true);return jsxRuntime.jsx(Jn.Provider,{value:t,children:e})}function Th({children:e}){let t=Da();return jsxRuntime.jsx(Gl.Provider,{value:t,children:e})}var os=316,ts=44,Rh=24,Na={inlineStart:0,inlineEnd:os},Tu={inlineStart:ts,inlineEnd:ts},kh={inlineStart:0,inlineEnd:0};function Eu({open:e,viewportWidth:t,pageWidthPx:n,inlineStartReservation:o=0,docked:r=false}){if(!e)return Tu;if(r||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0)return Na;let a=Number.isFinite(o)&&o>0?o:0;return t-a-n-2*Rh>=os?Na:Tu}var Mh=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}},Ih=(e,t)=>e.reviewPaneOpen===t.reviewPaneOpen&&e.entitledZoom===t.entitledZoom&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function wu(){let e=At(),[t,n]=nt.useState(null);return nt.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 sn(){let e=nt.useContext(mt),{pageSetup:t,reviewPaneOpen:n,entitledZoom:o}=O(Mh,Ih),r=At(),a=Su(),i=nt.useRef(null);t&&(i.current=t.pageWidthTwips);let l=t?.pageWidthTwips??i.current,c=(e?.mounted??0)>0,s=nt.useCallback(m=>c?Eu({open:n,viewportWidth:m??0,pageWidthPx:l===null||o===null?0:Ee(l)*o,inlineStartReservation:a,docked:o===null}):kh,[c,n,l,o,a]),[d,p]=nt.useState(()=>s(r?r.clientWidth:null));return nt.useEffect(()=>{let m=()=>p(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 La=[.25,.5,.75,1,1.25,1.5,2];function nr(e,t){return t==="in"?La.find(o=>o>e+.001)??null:[...La].reverse().find(o=>o<e-.001)??null}function Ru(e,t){return e==="0"?1:e==="+"||e==="="?nr(t,"in")??t:e==="-"?nr(t,"out")??t:null}var wo=nt.createContext(false);function tt(){return nt.useContext(wo)?"":"docx-editor "}var Lh=e=>e.reviewPaneOpen??true,Fh=e=>e.zoomMode?.type==="fit";function Fa({className:e,style:t,children:n}){let o=tt(),r=A(),a=O(Lh),i=sn(),l=O(Fh),s=(nt.useContext(mt)?.mounted??0)>0,d=Po(),p=Eo(),m=nt.useCallback(u=>d?.setViewport(u),[d]),g=nt.useCallback(u=>{if(!r||!(u.metaKey||u.ctrlKey)||u.altKey)return;let f=u.target;if(f instanceof Element&&f.closest('input, textarea, select, [role="dialog"]'))return;let b=Ru(u.key,r.getZoom());b!==null&&(u.preventDefault(),r.setZoom(b));},[r]);return jsxRuntime.jsx("div",{ref:m,"data-testid":"docx-editor-scroll",onKeyDownCapture:g,...s?{"data-review-pane":a?"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":`${p}px`,...s?{"--docx-review-gutter":`${i.inlineEnd}px`,"--docx-review-gutter-start":`${i.inlineStart}px`}:{}},children:jsxRuntime.jsx(wo.Provider,{value:true,children:n})})}var Hh=editor.LOADING_SNAPSHOT;function Iu({ref:e,editorRef:t}){nt.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)??Hh}),[t]);}var zh=e=>e.editingMode??"editing",Vh=e=>e.isLoading||e.isOpening===true,rs=[{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"}],$h="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function Ha({className:e,hidden:t}){let n=A(),o=O(zh),r=O(Vh),a=J(),{t:i}=D(),[l,c]=nt.useState(false),s=nt.useRef(null),d=nt.useRef(null),p=nt.useRef(null);nt.useEffect(()=>{if(!l)return;let T=p.current?.querySelectorAll('[role="menuitemradio"]');(p.current?.querySelector('[aria-checked="true"]')??T?.[0]??void 0)?.focus();},[l]);let m=nt.useCallback(T=>{let h=[...p.current?.querySelectorAll('[role="menuitemradio"]')??[]],v=h.indexOf(document.activeElement),y=S=>{T.preventDefault(),h[(S+h.length)%h.length]?.focus();};T.key==="ArrowDown"?y(v+1):T.key==="ArrowUp"?y(v-1):T.key==="Home"?y(0):T.key==="End"&&y(h.length-1);},[]);nt.useEffect(()=>{if(!l)return;let T=v=>{let y=s.current;y&&v.target instanceof Node&&y.contains(v.target)||c(false);},h=v=>{v.key==="Escape"&&(v.preventDefault(),c(false));};return document.addEventListener("mousedown",T,true),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",T,true),document.removeEventListener("keydown",h);}},[l]);let g=nt.useCallback(T=>{c(false),editor.runToolbarCommand(n,"review.editingMode",T),n?.focus();},[n]),u=editor.toolbarCommandState(n,"review.editingMode"),f=i18n.localizeDisabledReason(u.disabledReason,i),b=nt.useMemo(()=>rs.find(T=>T.mode===o)??rs[0],[o]);if(t)return null;let x=X("review.editingMode");return jsxRuntime.jsxs("div",{ref:s,className:`docx-toolbar__mode${e?` ${e}`:""}`,"data-slot":"review.editingMode",children:[jsxRuntime.jsxs("button",{ref:d,type:"button",className:"docx-toolbar__picker","data-testid":"editing-mode-trigger","data-mode":o,"aria-haspopup":"menu","aria-expanded":l,"aria-label":a(x?.labelKey??"editingMode.label"),disabled:r||!u.enabled,...f?{title:f}:{},onMouseDown:B,onClick:()=>c(T=>!T),children:[as(b.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:a(b.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),l?jsxRuntime.jsx("div",{ref:p,className:"docx-toolbar__mode-menu",role:"menu","aria-label":a(x?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:m,children:rs.map(T=>jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":T.mode===o,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${T.mode}`,onMouseDown:B,onClick:()=>g(T.mode),children:[as(T.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:a(T.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:a(T.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:T.mode===o?as($h):null})]},T.mode))}):null]})}Ha.docxSlot="review.editingMode";function as(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"})})}var Nu=[],Gh=()=>{};function rr(){let e=A(),t=nt.useCallback(n=>{if(!e)return Gh;let o=Nl(n),r=e.on("change",o),a=e.on("selectionChange",o);return ()=>{r(),a();}},[e]);return nt.useSyncExternalStore(t,()=>e?.getReviewAuthors()??Nu,()=>Nu)}var ev=e=>e.hiddenReviewAuthors??[];function Ba({className:e,hidden:t,icon:n}){let o=A(),r=rr(),a=O(ev),i=new Set(a),l=r.every(v=>!i.has(v.author)),[c,s]=nt.useState(false),d=nt.useRef(null),p=nt.useRef(null),m=nt.useRef(null),g=J(),{t:u}=D();nt.useEffect(()=>{if(!c)return;m.current?.querySelector('[role="menuitemcheckbox"]')?.focus();let v=S=>{d.current?.contains(S.target)||s(false);},y=S=>{S.key==="Escape"&&(S.preventDefault(),s(false),p.current?.focus());};return document.addEventListener("mousedown",v,true),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",v,true),document.removeEventListener("keydown",y);}},[c]);let f=nt.useCallback(v=>{let y=[...m.current?.querySelectorAll('[role="menuitemcheckbox"]')??[]],S=y.indexOf(document.activeElement),w=C=>{v.preventDefault(),y[(C+y.length)%y.length]?.focus();};v.key==="ArrowDown"?w(S+1):v.key==="ArrowUp"?w(S-1):v.key==="Home"?w(0):v.key==="End"?w(y.length-1):v.key==="Tab"&&s(false);},[]);if(t)return null;let b=X("review.authors"),x=editor.toolbarCommandState(o,"review.authors"),T=i18n.localizeDisabledReason(x.disabledReason,u),h=g(b?.labelKey??"reviewers.label");return jsxRuntime.jsxs("div",{ref:d,className:`docx-toolbar__reviewers${e?` ${e}`:""}`,"data-slot":"review.authors",children:[jsxRuntime.jsxs("button",{ref:p,type:"button",className:"docx-toolbar__picker","data-testid":"reviewers-trigger","aria-haspopup":"menu","aria-expanded":c,"aria-label":h,disabled:!x.enabled,title:T??h,onMouseDown:B,onClick:()=>s(v=>!v),children:[n??Q(b?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:h}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),c?jsxRuntime.jsxs("div",{ref:m,className:"docx-toolbar__reviewers-menu",role:"menu","aria-label":h,"data-testid":"reviewers-menu",onKeyDown:f,children:[jsxRuntime.jsx(Lu,{checked:l,label:u("reviewers.all"),testId:"reviewer-all",onChoose:()=>o?.setAllReviewAuthorsVisible(!l)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),r.map(v=>jsxRuntime.jsx(Lu,{checked:!i.has(v.author),label:v.author||"\u2014",testId:`reviewer-${v.slot}`,color:v.color,onChoose:()=>o?.setReviewAuthorVisible(v.author,i.has(v.author))},v.author))]}):null]})}Ba.docxSlot="review.authors";function Lu(e){return jsxRuntime.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":e.checked,className:"docx-toolbar__reviewer-item","data-testid":e.testId,onMouseDown:B,onClick:e.onChoose,children:[jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:e.checked?"\u2713":""}),e.color?jsxRuntime.jsx("span",{className:"docx-toolbar__reviewer-swatch",style:{background:e.color}}):null,jsxRuntime.jsx("span",{className:"docx-toolbar__reviewer-name",children:e.label})]})}function cn(e,t){if(!nt.isValidElement(e)||e.type!==nt.Fragment)return null;let o=nt.Children.toArray(e.props.children).map(t).filter(r=>r!==null);return o.length===1?o[0]:null}function qa({entries:e,children:t,preset:n,keyOfEntry:o,keyOfChild:r,renderEntry:a}){if(!n)return t;let i=new Map,l=[];for(let p of nt.Children.toArray(t)){let m=r(p);m?i.set(m,p):l.push(p);}let c=e.map((p,m)=>{let g=o(p,m),u=i.get(g);return u?jsxRuntime.jsx(nt.Fragment,{children:u},g):jsxRuntime.jsx(nt.Fragment,{children:a(p,m)},g)}),s=new Set(e.map(o)),d=[...i.entries()].filter(([p])=>!s.has(p)).map(([p,m])=>jsxRuntime.jsx(nt.Fragment,{children:m},p));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,d,l]})}var iv={contextualSpacing:null,keepNext:null,keepLines:null,widowControl:null,pageBreakBefore:null},lv=e=>{let t=e.formatting??null;if(!t)return null;let n=t.indent,o=t.paragraphFlags??iv;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}}},sv=["alignment","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops","indentLeft","indentRight","indentFirstLine"],cv=(e,t)=>sv.every(n=>e.disagrees[n]===t.disagrees[n]),dv=(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&&cv(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")),uv=e=>e.editable;function ss(){let e=A(),t=O(lv,dv),n=O(uv),o=nt.useMemo(()=>n&&e!==null&&e.can({type:"setParagraphFormat",alignment:"left"}).ok,[e,n]),r=nt.useCallback(a=>{if(!e)return false;let i={type:"setParagraphFormat",...a};return e.can(i).ok?e.exec(i).ok:false},[e]);return {format:t,isEnabled:o,apply:r}}var ar=e=>Math.round(e/1440*100)/100,cs=e=>ar(e).toLocaleString(void 0,{maximumFractionDigits:2}),Ka=e=>Math.round(e*1440),Au={left:"dialogs.paragraph.tabAlignLeft",center:"dialogs.paragraph.tabAlignCenter",right:"dialogs.paragraph.tabAlignRight",decimal:"dialogs.paragraph.tabAlignDecimal",bar:"dialogs.paragraph.tabAlignBar"},pv=e=>e===null||e===0?"none":e<0?"hanging":"firstLine",mv=(e,t)=>e==="none"?0:e==="hanging"?-Math.abs(t):Math.abs(t);function Hu(e){let t=e.indentFirstLineTwips;return {alignment:e.alignment??"left",indentLeft:e.indentLeftTwips??0,indentRight:e.indentRightTwips??0,special:pv(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 za={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 Ou(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 fv(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 Bu(e,t,n=za,o=n){let r={},a=false,i=(c,s)=>{r[c]=s,a=true;},l=c=>n[c]&&!o[c];return (e.alignment!==t.alignment||l("alignment"))&&i("alignment",t.alignment),(e.indentLeft!==t.indentLeft||l("indentLeft"))&&i("indentLeftTwips",t.indentLeft),(e.indentRight!==t.indentRight||l("indentRight"))&&i("indentRightTwips",t.indentRight),(e.special!==t.special||e.specialBy!==t.specialBy||l("special"))&&i("indentFirstLineTwips",mv(t.special,t.specialBy)),(e.spaceBefore!==t.spaceBefore||l("spaceBefore"))&&i("spaceBeforePt",t.spaceBefore),(e.spaceAfter!==t.spaceAfter||l("spaceAfter"))&&i("spaceAfterPt",t.spaceAfter),!o.lineSpacing&&(e.lineRule!==t.lineRule||e.lineValue!==t.lineValue||l("lineSpacing"))&&i("lineSpacing",{rule:t.lineRule,value:t.lineValue}),(e.contextualSpacing!==t.contextualSpacing||l("contextualSpacing"))&&i("contextualSpacing",t.contextualSpacing),(e.keepNext!==t.keepNext||l("keepNext"))&&i("keepNext",t.keepNext),(e.keepLines!==t.keepLines||l("keepLines"))&&i("keepLines",t.keepLines),(e.widowControl!==t.widowControl||l("widowControl"))&&i("widowControl",t.widowControl),(e.pageBreakBefore!==t.pageBreakBefore||l("pageBreakBefore"))&&i("pageBreakBefore",t.pageBreakBefore),(!fv(e.tabStops,t.tabStops)||l("tabStops")&&t.clearedAllTabStops)&&i("tabStops",t.tabStops),a?r:null}function Zu(e,t){return [...e.filter(o=>o.positionTwips!==t.positionTwips),t].sort((o,r)=>o.positionTwips-r.positionTwips)}function qu(e,t){if(t.key!=="Tab")return false;let n=[...e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(i=>!i.hasAttribute("disabled")&&i.tabIndex!==-1);if(n.length===0)return false;let o=n[0],r=n[n.length-1],a=e.ownerDocument.activeElement;return t.shiftKey&&(a===o||a===e)?(r.focus(),true):!t.shiftKey&&a===r?(o.focus(),true):false}var hv={marginRight:"auto",fontSize:"12px",color:"var(--doc-danger)"},vv={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},yv={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},xv={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",flexShrink:0,fontSize:16,fontWeight:600,color:"var(--doc-text)"},Sv={padding:"16px 20px",overflowY:"auto",minHeight:0},Tv={display:"grid",gridTemplateColumns:"1fr 1fr",gap:28},Vu={display:"flex",flexDirection:"column",gap:14,minWidth:0},ir={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},it={display:"flex",alignItems:"center",gap:12},gt={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)"},lr={fontSize:11,color:"var(--doc-text-muted)",width:20},Cv={display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--doc-text)"},Pv={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,flexShrink:0},sr={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"};function Ro({open:e,onClose:t,className:n}){let{t:o}=D(),{format:r,isEnabled:a,apply:i}=ss(),[l,c]=nt.useState("left"),[s,d]=nt.useState(0),[p,m]=nt.useState(0),[g,u]=nt.useState("none"),[f,b]=nt.useState(0),[x,T]=nt.useState(0),[h,v]=nt.useState(0),[y,S]=nt.useState("multiple"),[w,C]=nt.useState(1.08),[k,R]=nt.useState(false),[N,L]=nt.useState(false),[H,_]=nt.useState(false),[M,E]=nt.useState(true),[I,ae]=nt.useState(false),[z,V]=nt.useState([]),[$,ne]=nt.useState(false),[re,be]=nt.useState(0),[he,U]=nt.useState("left"),[Z,Re]=nt.useState("none"),[ce,de]=nt.useState(za),[We,bo]=nt.useState(false),pt=q=>o(We&&(q==="indentLeft"||q==="indentRight"||q==="special")?"dialogs.paragraph.notShown":"dialogs.paragraph.mixed"),ho=nt.useRef(za),Ie=nt.useId(),[Pl,Kn]=nt.useState(false),Pt=nt.useRef(null),zn=nt.useRef(false),en=nt.useRef(null);nt.useEffect(()=>{if(!e){zn.current=false;return}if(zn.current||r===null)return;let q=Hu(r);c(q.alignment),d(q.indentLeft),m(q.indentRight),u(q.special),b(q.specialBy),T(q.spaceBefore),v(q.spaceAfter),S(q.lineRule),C(q.lineValue),R(q.contextualSpacing),L(q.keepNext),_(q.keepLines),E(q.widowControl),ae(q.pageBreakBefore),V(q.tabStops),ne(false);let ve=Ou(r);de(ve),bo(r.indentUnknown),be(0),U("left"),Re("none"),ho.current=ve,Kn(false),en.current=q,zn.current=true;},[e,r]),nt.useEffect(()=>{e&&Pt.current?.focus();},[e]);let pe=nt.useCallback(()=>{let q=en.current,ve=q===null?null:Bu(q,{alignment:l,indentLeft:s,indentRight:p,special:g,specialBy:f,spaceBefore:x,spaceAfter:h,lineRule:y,lineValue:w,contextualSpacing:k,keepNext:N,keepLines:H,widowControl:M,pageBreakBefore:I,tabStops:z,clearedAllTabStops:$},ho.current,ce);if(ve===null){t();return}if(i(ve)){Kn(false),t();return}Kn(true);},[i,t,ce,$,l,s,p,g,f,x,h,y,w,k,N,H,M,I,z]),me=nt.useCallback(()=>{let q=Math.round(re);return q<=0?false:(de(ve=>({...ve,tabStops:false})),V(Zu(z,{positionTwips:q,alignment:he,...Z!=="none"?{leader:Z}:{}})),be(0),U("left"),Re("none"),true)},[z,re,he,Z]);if(!e)return null;let at=q=>de(ve=>({...ve,[q]:false})),Vn=(q,ve,$t,Ue)=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-${q}`,children:o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("input",{id:`${Ie}-${q}`,type:"number",style:wt,min:0,step:.1,value:ce[Ue]?"":ar(ve),placeholder:ce[Ue]?pt(Ue):void 0,onChange:$n=>{at(Ue),$t(Ka(Number($n.target.value)||0));},"aria-label":o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("span",{style:lr,children:o("dialogs.paragraph.unitInches")})]}),ya=(q,ve,$t,Ue)=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-${q}`,children:o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("input",{id:`${Ie}-${q}`,type:"number",style:wt,min:0,step:1,value:ce[Ue]?"":ve,placeholder:ce[Ue]?pt(Ue):void 0,onChange:$n=>{at(Ue),$t(Math.max(0,Number($n.target.value)||0));},"aria-label":o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("span",{style:lr,children:o("dialogs.paragraph.unitPoints")})]}),vo=(q,ve,$t)=>jsxRuntime.jsxs("label",{style:Cv,children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ve,ref:Ue=>{Ue&&(Ue.indeterminate=ce[q]);},onChange:Ue=>{de($n=>({...$n,[q]:false})),$t(Ue.target.checked);}}),o(`dialogs.paragraph.${q}`)]}),Od=`docx-editor${document.querySelector(".docx-editor")?.classList.contains("dark")?" dark":""}`;return reactDom.createPortal(jsxRuntime.jsx("div",{className:Od,style:{display:"contents"},children:jsxRuntime.jsx("div",{className:n,style:vv,onClick:t,onKeyDown:q=>{q.key==="Escape"&&t(),Pt.current&&qu(Pt.current,q.nativeEvent)&&q.preventDefault();let ve=q.target instanceof HTMLButtonElement||q.target instanceof HTMLSelectElement;if(q.key==="Enter"&&!ve){let $t=q.target;if($t instanceof HTMLElement&&$t.dataset.docxTabEntry!==void 0){me();return}a&&pe();}},children:jsxRuntime.jsxs("div",{ref:Pt,role:"dialog","aria-modal":"true","aria-label":o("dialogs.paragraph.title"),tabIndex:-1,style:yv,onClick:q=>q.stopPropagation(),onMouseDown:q=>q.stopPropagation(),children:[jsxRuntime.jsx("div",{style:xv,children:o("dialogs.paragraph.title")}),jsxRuntime.jsx("div",{style:Sv,children:jsxRuntime.jsxs("div",{style:Tv,children:[jsxRuntime.jsxs("div",{style:Vu,children:[jsxRuntime.jsx("div",{style:ir,children:o("dialogs.paragraph.general")}),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-alignment`,children:o("dialogs.paragraph.alignment")}),jsxRuntime.jsxs("select",{id:`${Ie}-alignment`,style:wt,value:ce.alignment?"":l,onChange:q=>{at("alignment"),c(q.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:ir,children:o("dialogs.paragraph.indentation")}),Vn("beforeText",s,d,"indentLeft"),Vn("afterText",p,m,"indentRight"),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-special`,children:o("dialogs.paragraph.special")}),jsxRuntime.jsxs("select",{id:`${Ie}-special`,style:wt,value:ce.special?"":g,onChange:q=>{at("special"),u(q.target.value);},"aria-label":o("dialogs.paragraph.special"),children:[ce.special?jsxRuntime.jsx("option",{value:"",children:pt("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:gt,htmlFor:`${Ie}-by`,children:o("dialogs.paragraph.by")}),jsxRuntime.jsx("input",{id:`${Ie}-by`,type:"number",style:wt,min:0,step:.1,value:ce.special?"":ar(f),placeholder:ce.special?pt("special"):void 0,onChange:q=>{at("special"),b(Math.max(0,Ka(Number(q.target.value)||0)));},"aria-label":o("dialogs.paragraph.by")}),jsxRuntime.jsx("span",{style:lr,children:o("dialogs.paragraph.unitInches")})]}):null,jsxRuntime.jsx("div",{style:ir,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(q=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("span",{style:{...gt,color:"var(--doc-text)"},children:o("dialogs.paragraph.tabPositionLabel",{position:cs(q.positionTwips)})}),jsxRuntime.jsx("span",{style:{flex:1,fontSize:13,color:"var(--doc-text-muted)"},children:o(Au[q.alignment])}),jsxRuntime.jsx("button",{type:"button",style:sr,onClick:()=>V(z.filter(ve=>ve!==q)),"aria-label":o("dialogs.paragraph.tabRemoveAt",{position:cs(q.positionTwips)}),children:o("dialogs.paragraph.tabRemove")})]},q.positionTwips)),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-tabPosition`,children:o("dialogs.paragraph.tabPosition")}),jsxRuntime.jsx("input",{id:`${Ie}-tabPosition`,type:"number",style:wt,min:0,step:.1,value:ar(re),onChange:q=>be(Math.max(0,Ka(Number(q.target.value)||0))),"aria-label":o("dialogs.paragraph.tabPosition"),"data-docx-tab-entry":""}),jsxRuntime.jsx("span",{style:lr,children:o("dialogs.paragraph.unitInches")})]}),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-tabAlignment`,children:o("dialogs.paragraph.tabAlignment")}),jsxRuntime.jsxs("select",{id:`${Ie}-tabAlignment`,style:wt,value:he,onChange:q=>U(q.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:gt,htmlFor:`${Ie}-tabLeader`,children:o("dialogs.paragraph.tabLeader")}),jsxRuntime.jsxs("select",{id:`${Ie}-tabLeader`,style:wt,value:Z,onChange:q=>Re(q.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:sr,onClick:me,children:o("dialogs.paragraph.tabAdd")}),jsxRuntime.jsx("button",{type:"button",style:sr,onClick:()=>{de(q=>({...q,tabStops:false})),ne(true),V([]);},children:o("dialogs.paragraph.tabClearAll")})]})]}),jsxRuntime.jsxs("div",{style:Vu,children:[jsxRuntime.jsx("div",{style:ir,children:o("dialogs.paragraph.spacing")}),ya("spaceBefore",x,T,"spaceBefore"),ya("spaceAfter",h,v,"spaceAfter"),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-lineSpacing`,children:o("dialogs.paragraph.lineSpacing")}),jsxRuntime.jsxs("select",{id:`${Ie}-lineSpacing`,style:wt,value:ce.lineSpacing?"":y,onChange:q=>{let ve=q.target.value;at("lineSpacing"),S(ve),C(ve===en.current?.lineRule?en.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:gt,htmlFor:`${Ie}-at`,children:o("dialogs.paragraph.at")}),jsxRuntime.jsx("input",{id:`${Ie}-at`,type:"number",style:wt,min:.01,step:y==="multiple"?.01:1,value:ce.lineSpacing?"":w,disabled:ce.lineSpacing,onChange:q=>{let ve=q.target.value.trim();C(ve===""?y==="multiple"?1.08:12:Number(ve)||0);},"aria-label":o("dialogs.paragraph.at")}),jsxRuntime.jsx("span",{style:lr,children:y==="multiple"?"":o("dialogs.paragraph.unitPoints")})]}),vo("contextualSpacing",k,R),jsxRuntime.jsx("div",{style:ir,children:o("dialogs.paragraph.pagination")}),vo("keepNext",N,L),vo("widowControl",M,E),vo("keepLines",H,_),vo("pageBreakBefore",I,ae)]})]})}),jsxRuntime.jsxs("div",{style:Pv,children:[Pl?jsxRuntime.jsx("span",{role:"alert",style:hv,children:o("dialogs.paragraph.refused")}):null,jsxRuntime.jsx("button",{type:"button",style:sr,onClick:t,children:o("dialogs.paragraph.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...sr,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)",opacity:a?1:.5},disabled:!a,onClick:pe,children:o("dialogs.paragraph.ok")})]})]})})}),document.body)}var $u=nt.createContext(null);function Wu({children:e}){let[t,n]=nt.useState(false),o=nt.useRef(null),r=nt.useMemo(()=>({open:i=>{o.current=i??document.activeElement,n(true);}}),[]),a=nt.useCallback(()=>{n(false);let i=o.current;o.current=null,i instanceof HTMLElement&&i.isConnected&&i.focus({preventScroll:true});},[]);return jsxRuntime.jsxs($u.Provider,{value:r,children:[e,jsxRuntime.jsx(Ro,{open:t,onClose:a})]})}function Uu(){return nt.useContext($u)}var Nv=["zoom","script","format","list","alignment","styles","font","text","history"],ds=new Set(["review"]),us=24,ju=new Set;function Yu(e,t=Nv){let n=t.filter(r=>e.includes(r));return [...e.filter(r=>!t.includes(r)).reverse(),...n]}function Gu(e,t){let{widths:n,groups:o,order:r,fixed:a,more:i}=e,l=a;for(let s of o)l+=n.get(s)??0;if(l<=t)return ju;l+=i;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 Xu(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 Ju=Xu;function Qu(e){if(!(e.available>0))return ju;let t=Gu(e,e.available),n=e.previous;if(!n||n.size===0||t.size>=n.size)return t;let o=Gu(e,e.available-(e.hysteresis));return Xu(o,n)?n:o}function ep(e,t,n,o){return e+t+n+o*2}function tp(e,t){return e+t}function ms(e,t){return e+t}function op(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 ps(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function np(e){return ps(e.columnGap)}function rp(e,t){return e.clientWidth-ps(t.paddingLeft)-ps(t.paddingRight)}var dn="data-toolbar-group",dr="data-toolbar-fixed",gs="data-toolbar-more",Hv=34,fs=new Set;function ip(e,t,n){let o=nt.useRef(null),r=nt.useRef(new Map),a=nt.useRef(Hv),[i,l]=nt.useState(fs),c=nt.useRef(i);c.current=i;let s=nt.useRef({groups:t,order:n});s.current={groups:t,order:n};let d=t.join("\0"),p=n.join("\0"),m=nt.useCallback(()=>{let u=o.current;if(!u||!e)return;let f=getComputedStyle(u),b=np(f),x=rp(u,f),T=u.querySelector(".docx-toolbar__separator"),h=b*2;if(T){let C=getComputedStyle(T),k=op(C);h=ep(T.offsetWidth,k.start,k.end,b);}for(let C of u.querySelectorAll(`[${dn}]`)){let k=C.getAttribute(dn);k&&C.offsetWidth>0&&r.current.set(k,tp(C.offsetWidth,h));}let v=0;for(let C of u.querySelectorAll(`[${dr}]`))C.offsetWidth>0&&(v+=ms(C.offsetWidth,b));let y=u.querySelector(`[${gs}]`);y&&y.offsetWidth>0&&(a.current=ms(y.offsetWidth,b));let S={available:x,widths:r.current,groups:s.current.groups,order:s.current.order,fixed:v,more:a.current,previous:c.current,hysteresis:us},w=Qu(S);Ju(w,c.current)||(c.current=w,l(w));},[e]),g=nt.useCallback(u=>{o.current=u;},[]);return nt.useLayoutEffect(()=>{if(!e){c.current.size>0&&(c.current=fs,l(fs));return}m();},[e,d,m,p]),nt.useEffect(()=>{let u=o.current;if(!e||!u||typeof ResizeObserver>"u")return;let f=0,b=new ResizeObserver(()=>{f===0&&(f=requestAnimationFrame(()=>{f=0,m();}));});b.observe(u);for(let x of u.querySelectorAll(`[${dn}], [${dr}]`))b.observe(x);return ()=>{f!==0&&cancelAnimationFrame(f),b.disconnect();}},[e,d,m,p,i]),{attach:g,overflow:i}}var $v=["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"],sp=nt.createContext({close:()=>{}});function Wv(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function cp({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 dp({slot:e}){let t=J(),n=nn(),{close:o}=nt.useContext(sp),{execute:r,isActive:a,isEnabled:i,disabledReason:l,value:c}=le(e),s=X(e),d=editor.chromeSlotIsToggle(e),p=n(t(s?.labelKey??e));return jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__more-command","data-slot":e,disabled:!i,...l?{title:l}:{},...d?{"aria-pressed":a}:{},...a?{"data-active":""}:{},...c!==null?{"data-value":c}:{},onMouseDown:B,onClick:m=>{r(),o(m.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:Q(s?.paths)}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:p})]})}function up({sections:e,className:t}){let n=J(),[o,r]=nt.useState(false),a=nt.useRef(null),i=nt.useRef(null),l=nt.useRef(null),c=nt.useRef(false),s=nt.useId(),d=n("formattingBar.more"),p=nt.useCallback(u=>{r(false),u&&i.current?.focus();},[]),m=nt.useMemo(()=>({close:p}),[p]);nt.useEffect(()=>{if(!o)return;let u=f=>{let b=f.target;b instanceof Node&&a.current?.contains(b)||r(false);};return document.addEventListener("mousedown",u,true),()=>document.removeEventListener("mousedown",u,true)},[o]),nt.useEffect(()=>{if(!o||!c.current)return;c.current=false;let u=l.current;u&&Wv(u);},[o]);let g=u=>{u.key!=="Escape"||u.defaultPrevented||(u.preventDefault(),p(true));};return jsxRuntime.jsxs("div",{ref:a,className:`docx-toolbar__more${t?` ${t}`:""}`,[gs]:"",children:[jsxRuntime.jsx("button",{ref:i,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:B,onClick:()=>r(u=>!u),onKeyDown:u=>{u.key==="ArrowDown"&&(u.preventDefault(),c.current=true,r(true));},children:Q($v)}),o?jsxRuntime.jsx(sp.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(u=>jsxRuntime.jsxs("div",{className:"docx-toolbar__more-section",role:"group","aria-label":n(u.labelKey),children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-heading","aria-hidden":"true",children:n(u.labelKey)}),u.children]},u.id))})}):null]})}function Xv(e,t){return e.value===t.value&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function ur(e){let t=A(),n=nt.useRef(e);n.current=e;let o=nt.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=O(o,Xv),a=nt.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]),i=nt.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"?a:i}var hs=[{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 Ga({className:e,hidden:t,asChild:n,children:o}){let{t:r}=D(),a=J(),{execute:i,value:l,isEnabled:c,disabledReason:s}=ur("image.wrap"),[d,p]=nt.useState(false),m=nt.useRef(null),g=nt.useRef(null),u=nt.useRef(null),f=nt.useId(),b=nt.useMemo(()=>hs.find(S=>S.value===l)??hs[0],[l]),x=X("image.wrap"),T=a(x?.labelKey??"formattingBar.imageWrap");nt.useEffect(()=>{if(!d)return;let S=C=>{let k=m.current;k&&C.target instanceof Node&&k.contains(C.target)||p(false);},w=C=>{C.key==="Escape"&&(C.preventDefault(),p(false),g.current?.focus());};return document.addEventListener("mousedown",S,true),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",S,true),document.removeEventListener("keydown",w);}},[d]);let h=nt.useCallback(S=>{p(false),i(S);},[i]);if(t)return null;let v=r("imageWrap.tooltipPrefix",{label:r(b.labelKey)}),y={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":T,title:s??v,onMouseDown:B,onClick:()=>p(S=>!S)};return jsxRuntime.jsxs("div",{ref:m,className:"docx-toolbar__image-wrap",children:[n?jsxRuntime.jsx(j,{...y,children:o}):jsxRuntime.jsx("button",{...y,children:o??Q(x?.paths)}),d?jsxRuntime.jsx("div",{ref:u,id:f,role:"menu",className:"docx-toolbar__image-wrap-menu","aria-label":r("imageWrap.menu.ariaLabel"),onMouseDown:S=>S.stopPropagation(),children:hs.map(S=>jsxRuntime.jsx("button",{type:"button",role:"menuitemradio",className:"docx-toolbar__image-wrap-item","aria-checked":l===S.value,...l===S.value?{"data-active":""}:{},onMouseDown:B,onClick:()=>h(S.value),children:r(S.labelKey)},S.value))}):null]})}Ga.docxSlot="image.wrap";var pr=Object.assign(Ga,{docxSlot:"image.wrap"});function ja({className:e,hidden:t,asChild:n,children:o}){let{t:r}=D(),a=J(),{execute:i,value:l,isEnabled:c,disabledReason:s}=ur("image.altText"),[d,p]=nt.useState(false),[m,g]=nt.useState(""),u=nt.useRef(null),f=nt.useRef(null),b=nt.useId();nt.useEffect(()=>{d&&g(l??"");},[d,l]),nt.useEffect(()=>{if(!d)return;let y=w=>{let C=u.current;C&&w.target instanceof Node&&C.contains(w.target)||p(false);},S=w=>{w.key==="Escape"&&(w.preventDefault(),p(false),f.current?.focus());};return document.addEventListener("mousedown",y,true),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",y,true),document.removeEventListener("keydown",S);}},[d]);let x=nt.useCallback(()=>{i(m),p(false);},[m,i]);if(t)return null;let T=X("image.altText"),h=a(T?.labelKey??"formattingBar.altText"),v={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":h,title:s??h,onMouseDown:B,onClick:()=>p(y=>!y)};return jsxRuntime.jsxs("div",{ref:u,className:"docx-toolbar__alt-text",children:[n?jsxRuntime.jsx(j,{...v,children:o}):jsxRuntime.jsx("button",{...v,children:o??h}),d?jsxRuntime.jsxs("div",{id:b,role:"dialog","aria-label":r("imageAltText.panelTitle"),className:"docx-toolbar__alt-text-panel",onMouseDown:y=>y.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:y=>g(y.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:()=>p(false),children:r("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:x,children:r("common.apply")})]})]}):null]})}ja.docxSlot="image.altText";var mr=Object.assign(ja,{docxSlot:"image.altText"});var yp=e=>e.image;function vp(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 py(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Ts(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(Wt(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(Wt(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String(Wt(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(Wt(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function my(e,t){let n=Ts(t);return e.horizontalPoints!==n.horizontalPoints||e.verticalPoints!==n.verticalPoints||e.relativeToH!==n.relativeToH||e.relativeToV!==n.relativeToV}function Ya(e){if(e.trim()==="")return null;let t=Number(e);if(!Number.isFinite(t))return null;let n=Wn(t);return Number.isInteger(n)?n:null}function fy(e,t){let n=Ts(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let s=e.horizontalPoints!==n.horizontalPoints,d=e.verticalPoints!==n.verticalPoints,p=s?Ya(e.horizontalPoints):t.position?.horizontalEmu,m=d?Ya(e.verticalPoints):t.position?.verticalEmu;return s&&p===null?{ok:false}:d&&m===null?{ok:false}:p===void 0||m===void 0?{ok:false}:{ok:true,value:{horizontalEmu:p,verticalEmu:m}}}let o=e.horizontalPoints!==n.horizontalPoints,r=e.verticalPoints!==n.verticalPoints,a=e.relativeToH!==n.relativeToH,i=e.relativeToV!==n.relativeToV,l=o?Ya(e.horizontalPoints):t.position?.horizontalEmu,c=r?Ya(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}:{},...a||o||r?{relativeToH:e.relativeToH}:{},...i||o||r?{relativeToV:e.relativeToV}:{}}}}function Xa(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function Ja(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function Cs({open:e,onClose:t,className:n,triggerRef:o}){let r=A(),{t:a}=D(),i=O(yp),l=nt.useId(),c=nt.useId(),s=nt.useId(),d=nt.useRef(null),p=nt.useRef(null),m=nt.useRef(null),g=nt.useRef(null),[u,f]=nt.useState(null),[b,x]=nt.useState(null),T=p.current,h=T?.canCrop===false,v=T?.canResize===false,y=T?.locks.changeAspect===true,S=T?.kind==="anchored"&&T.canMove===true,w=T?.kind==="inline",C=T?.kind==="anchored"&&T.canMove===false;nt.useEffect(()=>{if(!e){p.current=null,m.current=null,g.current=null;return}if(!i)return;if(p.current=i,r?.surface){let{anchor:ae}=r.surface.state().selection;m.current={paragraphId:ae.paragraphId,offset:ae.offset},g.current=r.surface.session.packageRevision();}x(null);let E=Ts(i),I=i.crop;f({widthPoints:String(Wt(i.widthEmu)),heightPoints:String(Wt(i.heightEmu)),cropLeft:String(I.left),cropTop:String(I.top),cropRight:String(I.right),cropBottom:String(I.bottom),title:i.title,description:i.description,hyperlink:i.hyperlink??"",wrap:i.wrap,lockAspect:i.locks.changeAspect,...E});},[e,i?.id,i?.widthEmu,i?.heightEmu,r]);let k=nt.useCallback(()=>{o?.current?.focus(),r?.focus();},[r,o]),R=nt.useCallback(()=>{t(),k();},[t,k]);nt.useEffect(()=>{if(!e)return;let E=d.current;if(!E)return;let I=vp(E);(I.find(V=>V.id==="image-prop-width"&&!V.hasAttribute("disabled"))??I.find(V=>!V.hasAttribute("disabled"))??E).focus();let z=V=>{if(V.key==="Escape"){V.preventDefault(),R();return}if(V.key!=="Tab")return;let $=vp(E);if($.length===0)return;let ne=document.activeElement,re=$.findIndex(he=>he===ne);if(re===-1)return;V.preventDefault();let be=V.shiftKey?(re-1+$.length)%$.length:(re+1)%$.length;$[be]?.focus();};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[e,R]);let N=nt.useMemo(()=>{let E=T??i;return !E||E.widthEmu<=0?1:E.widthEmu/E.heightEmu},[i,T]),L=nt.useCallback(E=>{f(I=>{if(!I)return I;if(!I.lockAspect)return {...I,widthPoints:E};let ae=Ja(E);if(ae===null)return {...I,widthPoints:E};let z=Math.round(ae/N*100)/100;return {...I,widthPoints:E,heightPoints:String(z)}});},[N]),H=nt.useCallback(E=>{f(I=>{if(!I)return I;if(!I.lockAspect)return {...I,heightPoints:E};let ae=Ja(E);if(ae===null)return {...I,heightPoints:E};let z=Math.round(ae*N*100)/100;return {...I,widthPoints:String(z),heightPoints:E}});},[N]),_=nt.useCallback(()=>{let E=p.current;if(!E?.intrinsic)return;let I=E.intrinsic.pixelWidth*72/E.intrinsic.dpiX,ae=E.intrinsic.pixelHeight*72/E.intrinsic.dpiY;f(z=>z&&{...z,widthPoints:String(Math.round(I*100)/100),heightPoints:String(Math.round(ae*100)/100)});},[i]),M=nt.useCallback(()=>{let E=p.current,I=m.current,ae=g.current;if(!r||!E||!u||!I||ae===null)return;let z={type:"setImageProperties",drawingNodeId:E.id,expectedPackageRevision:ae,selectionParagraphId:I.paragraphId,selectionOffset:I.offset};if(!v){let he=Ja(u.widthPoints),U=Ja(u.heightPoints);if(he===null||U===null){x("imageProperties.errors.invalidDimensions");return}let Z=Wn(he),Re=Wn(U);Z!==E.widthEmu&&(z.widthEmu=Z),Re!==E.heightEmu&&(z.heightEmu=Re);}if(E.canCrop&&!h){let he=Xa(u.cropLeft),U=Xa(u.cropTop),Z=Xa(u.cropRight),Re=Xa(u.cropBottom);if(he===null||U===null||Z===null||Re===null){x("imageProperties.errors.invalidCrop");return}let ce=E.crop;(he!==ce.left||U!==ce.top||Z!==ce.right||Re!==ce.bottom)&&(z.crop={left:he,top:U,right:Z,bottom:Re});}u.title!==E.title&&(z.title=u.title),u.description!==E.description&&(z.description=u.description);let V=u.hyperlink.trim();if(V!==(E.hyperlink??"")&&(z.hyperlink=V===""?null:V),E.canChangeWrap&&u.wrap!==E.wrap&&(z.wrap=u.wrap),E.kind==="anchored"&&E.canMove&&my(u,E)){let he=fy(u,E);if(!he.ok){x("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(he.value,E))){x("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)){R();return}if(!r.can(z).ok){x("imageProperties.errors.refused");return}if(!r.exec(z).ok){x("imageProperties.errors.refused");return}R();},[r,u,h,v,R]);return !e||!u?null:jsxRuntime.jsx("div",{className:`docx-dialog-overlay${n?` ${n}`:""}`,onClick:R,onMouseDown:E=>{E.stopPropagation(),py(E);},children:jsxRuntime.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-labelledby":l,className:"docx-dialog docx-image-properties-dialog",onClick:E=>E.stopPropagation(),onMouseDown:E=>E.stopPropagation(),children:[jsxRuntime.jsx("div",{id:l,className:"docx-dialog__header",children:a("dialogs.imageProperties.title")}),jsxRuntime.jsxs("div",{className:"docx-dialog__body",children:[b?jsxRuntime.jsx("p",{className:"docx-dialog__error",children:a(b)}):null,jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.imageProperties.dimensions")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-width",children:a("dialogs.imageProperties.widthLabel")}),jsxRuntime.jsx("input",{id:"image-prop-width",className:"docx-dialog__input",value:u.widthPoints,disabled:v,onChange:E=>L(E.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-height",children:a("dialogs.imageProperties.heightLabel")}),jsxRuntime.jsx("input",{id:"image-prop-height",className:"docx-dialog__input",value:u.heightPoints,disabled:v,onChange:E=>H(E.target.value)}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]}),jsxRuntime.jsxs("label",{className:"docx-dialog__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:u.lockAspect,disabled:y,onChange:E=>f(I=>I&&{...I,lockAspect:E.target.checked})}),a("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:h||!T?.intrinsic,onClick:_,children:a("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.position")}),w?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:a("imageProperties.positionUnavailable")}):null,C?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:a("imageProperties.positionLocked")}):null,S?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u.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:a("imageProperties.relativeToHorizontal")}),jsxRuntime.jsx("select",{id:"image-pos-rel-h",className:"docx-dialog__select",value:u.relativeToH??"page",onChange:E=>f(I=>I&&{...I,relativeToH:E.target.value}),children:editor.DRAWING_REL_FROM_H.map(E=>jsxRuntime.jsx("option",{value:E,children:a(`dialogs.imagePosition.relativeOptions.${E}`)},E))})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-rel-v",children:a("imageProperties.relativeToVertical")}),jsxRuntime.jsx("select",{id:"image-pos-rel-v",className:"docx-dialog__select",value:u.relativeToV??"line",onChange:E=>f(I=>I&&{...I,relativeToV:E.target.value}),children:editor.DRAWING_REL_FROM_V.map(E=>jsxRuntime.jsx("option",{value:E,children:a(`dialogs.imagePosition.relativeOptions.${E}`)},E))})]})]}):null,jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-h",children:a("imageProperties.horizontalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-h",className:"docx-dialog__input",value:u.horizontalPoints,onChange:E=>f(I=>I&&{...I,horizontalPoints:E.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-pos-v",children:a("imageProperties.verticalOffset")}),jsxRuntime.jsx("input",{id:"image-pos-v",className:"docx-dialog__input",value:u.verticalPoints,onChange:E=>f(I=>I&&{...I,verticalPoints:E.target.value})}),jsxRuntime.jsx("span",{className:"docx-dialog__unit",children:a("imageProperties.units.points")})]})]}):null]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.imageProperties.altText")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-title",children:a("imageAltText.title")}),jsxRuntime.jsx("input",{id:"image-prop-title",className:"docx-dialog__input",value:u.title,onChange:E=>f(I=>I&&{...I,title:E.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-prop-description",children:a("imageAltText.description")}),jsxRuntime.jsx("textarea",{id:"image-prop-description",className:"docx-dialog__textarea",value:u.description,onChange:E=>f(I=>I&&{...I,description:E.target.value}),placeholder:a("dialogs.imageProperties.altTextPlaceholder")})]})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.hyperlink")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:s,children:a("hyperlinkPopup.urlLabel")}),jsxRuntime.jsx("input",{id:s,className:"docx-dialog__input docx-dialog__input--full",value:u.hyperlink,onChange:E=>f(I=>I&&{...I,hyperlink:E.target.value}),placeholder:a("hyperlinkPopup.urlPlaceholder")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("dialogs.imageProperties.textWrapping")}),jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:c,children:a("formattingBar.imageWrap")}),jsxRuntime.jsx("select",{id:c,className:"docx-dialog__select docx-dialog__input--full",value:u.wrap,disabled:T?.canChangeWrap===false,onChange:E=>f(I=>I&&{...I,wrap:E.target.value}),children:editor.IMAGE_WRAP_TARGETS.map(E=>jsxRuntime.jsx("option",{value:E,children:a(`imageWrap.targets.${E}`)},E))})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:a("imageProperties.crop")}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-left",children:a("imageProperties.cropLeft")}),jsxRuntime.jsx("input",{id:"image-crop-left",className:"docx-dialog__input",disabled:h,value:u.cropLeft,onChange:E=>f(I=>I&&{...I,cropLeft:E.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-top",children:a("imageProperties.cropTop")}),jsxRuntime.jsx("input",{id:"image-crop-top",className:"docx-dialog__input",disabled:h,value:u.cropTop,onChange:E=>f(I=>I&&{...I,cropTop:E.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-right",children:a("imageProperties.cropRight")}),jsxRuntime.jsx("input",{id:"image-crop-right",className:"docx-dialog__input",disabled:h,value:u.cropRight,onChange:E=>f(I=>I&&{...I,cropRight:E.target.value})})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__row",children:[jsxRuntime.jsx("label",{className:"docx-dialog__field-label",htmlFor:"image-crop-bottom",children:a("imageProperties.cropBottom")}),jsxRuntime.jsx("input",{id:"image-crop-bottom",className:"docx-dialog__input",disabled:h,value:u.cropBottom,onChange:E=>f(I=>I&&{...I,cropBottom:E.target.value})})]}),h?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:a("imageProperties.nonPictureHint")}):null]})]}),jsxRuntime.jsxs("div",{className:"docx-dialog__footer",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button",onClick:R,children:a("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:M,children:a("common.apply")})]})]})})}function Qa({className:e,hidden:t,asChild:n,children:o}){let r=A(),{t:a}=D(),i=O(yp),[l,c]=nt.useState(false),s=nt.useRef(null),d={type:"setImageProperties",description:"probe"},p=r&&i?r.can(d):null,m=p?.ok===true,g=p&&!p.ok?p.reason:null;if(t)return null;let u=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":a("formattingBar.imagePropertiesShortcut"),title:g??a("formattingBar.imagePropertiesShortcut"),onMouseDown:B,onClick:()=>c(true)};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n?jsxRuntime.jsx(j,{...f,children:o}):jsxRuntime.jsx("button",{...f,children:o??Q(u?.paths)}),jsxRuntime.jsx(Cs,{open:l,onClose:()=>c(false),triggerRef:s})]})}Qa.docxSlot="image.properties";var mn=Object.assign(Qa,{docxSlot:"image.properties"});function Ae(e){return Object.assign(n=>jsxRuntime.jsx(xo,{slot:e,...n}),{docxSlot:e})}var xp=Ae("history.undo"),Sp=Ae("history.redo"),Tp=Ae("text.bold"),Cp=Ae("text.italic"),Pp=Ae("text.underline"),Ep=Ae("text.strike"),wp=Ae("format.clear"),Rp=Ae("script.super"),kp=Ae("script.sub"),Mp=Ae("alignment.left"),Ip=Ae("alignment.center"),_p=Ae("alignment.right"),Dp=Ae("alignment.justify"),Np=Ae("list.bullet"),Lp=Ae("list.numbered"),Fp=Ae("list.outdent"),Ap=Ae("list.indent");var Hp=Ae("table.insert"),Op=Ae("review.comments");function vy({className:e,hidden:t,icon:n,asChild:o,children:r}){let a=A(),{openAtCaret:i}=$l(),l=editor.chromeProbeForSlot("text.link"),c=a&&l?a.can(l):null,s=c?.ok===true,{t:d}=D(),p=i18n.localizeDisabledReason(c&&!c.ok?c.reason:null,d),m=J();if(t)return null;let g=X("text.link"),u=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":u,title:p??u,onMouseDown:B,onClick:()=>i()};return o?jsxRuntime.jsx(j,{...f,children:r}):jsxRuntime.jsx("button",{...f,children:n??r??Q(g?.paths)})}var Ps=Object.assign(vy,{docxSlot:"text.link"});function yy({className:e,hidden:t}){let n=A(),{onSave:o}=nt.useContext(yo),r=J();if(t)return null;let a=X("file.save"),i=r(a?.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":i,title:i,onMouseDown:B,onClick:()=>o?.(),children:Q(a?.paths)})}var Es=Object.assign(yy,{docxSlot:"file.save"});function ko({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}function fn(e){let t=e?.closest(".docx-editor")??null;for(;t&&!t.querySelector(".docx-pages");)t=t.parentElement?.closest(".docx-editor")??null;return t}var Ty=e=>({zoom:e.zoom,mode:e.zoomMode}),Cy=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,Zp={type:"fixed"};function ws(){let e=A(),{zoom:t,mode:n}=O(Ty,Cy),o=nt.useCallback(a=>{e?.setZoom(a);},[e]),r=nt.useCallback(a=>{e?.setZoomMode(a);},[e]);return nt.useMemo(()=>{let a=n??Zp,i=nr(t,"out"),l=nr(t,"in");return {zoom:t,mode:a,isFit:a.type==="fit",setZoom:o,setMode:r,fitToWidth:()=>r(editor.FIT_WIDTH_ZOOM_MODE),auto:()=>r("auto"),reset:()=>{r(Zp),o(1);},zoomIn:()=>l!==null&&o(l),zoomOut:()=>i!==null&&o(i),canZoomIn:!!e&&l!==null,canZoomOut:!!e&&i!==null,levels:La}},[e,t,n,o,r])}var hr=2,vr=3276,br=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],wy=e=>e.formatting?.fontSizePt??null;function zp(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Vp(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 Wp(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:B,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:B,onClick:e.onIncrease,children:"+"})]})}function Ry(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<hr||o>vr?null:o}function ky({className:e,hidden:t}){let n=A(),o=O(wy),{isEnabled:r,disabledReason:a}=le("font.size"),i=J(),[l,c]=nt.useState(false),[s,d]=nt.useState(null),p=nt.useRef(null),m=nt.useRef(null),g=nt.useCallback(y=>{if(!n)return;let S=editor.commandForSlotValue("font.size",y);S&&n.can(S).ok&&n.exec(S);},[n]),u=nt.useCallback(y=>{g(Math.min(vr,Math.max(hr,Math.round(y*2))));},[g]),f=nt.useCallback(y=>{c(false),d(null),m.current?.blur(),y&&My(p.current);},[]);if(nt.useEffect(()=>{if(!l)return;let y=S=>{let w=p.current;w&&S.target instanceof Node&&w.contains(S.target)||(c(false),d(null));};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]),t)return null;let b=r&&o!==null,x=o===null?"\u2014":String(Math.round(o*2)/2),T=s??x,h=o===null?null:Math.round(o*2)/2,v=()=>{if(s===null)return;let y=Ry(s);y!==null&&g(y);};return jsxRuntime.jsxs("span",{ref:p,className:"docx-toolbar__font-size","data-slot":"font.size",title:a??void 0,children:[jsxRuntime.jsx(Wp,{className:e,groupLabel:i("fontSize.label"),decreaseLabel:i("fontSize.decrease"),increaseLabel:i("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:T,disabled:!r,role:"combobox","aria-expanded":l,"aria-haspopup":"listbox","aria-label":i("fontSize.label"),autoComplete:"off",onChange:y=>{d(y.target.value),c(true);},onFocus:y=>{y.target.select(),c(true);},onClick:()=>c(true),onKeyDown:y=>{y.key==="Enter"?(y.preventDefault(),v(),f(true)):y.key==="Escape"?(y.preventDefault(),f(true)):(y.key==="ArrowDown"||y.key==="ArrowUp")&&(y.preventDefault(),c(true),o!==null&&u(y.key==="ArrowDown"?Vp(o,br,hr/2):zp(o,br,vr/2)));},onBlur:()=>{v(),d(null);}}),canDecrease:b&&Math.round(o*2)>hr,canIncrease:b&&Math.round(o*2)<vr,onDecrease:()=>u(Vp(o??0,br,hr/2)),onIncrease:()=>u(zp(o??0,br,vr/2))}),l&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox","aria-label":i("fontSize.listLabel"),children:br.map(y=>{let S=h===y;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":S,...S?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>{u(y),f(true);},children:y},y)})}):null]})}function My(e){(fn(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}var Ms=Object.assign(ky,{docxSlot:"font.size"});function Iy({className:e,hidden:t}){let n=A(),{zoom:o,isFit:r,mode:a,setZoom:i,setMode:l,zoomIn:c,zoomOut:s,canZoomIn:d,canZoomOut:p,levels:m}=ws(),g=J(),[u,f]=nt.useState(false),b=nt.useRef(null);nt.useEffect(()=>{if(!u)return;let S=w=>{let C=b.current;C&&w.target instanceof Node&&C.contains(w.target)||f(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[u]);let x=nt.useCallback(S=>{f(false),i(S);},[i]),T=nt.useCallback(S=>{f(false),l(S==="auto"?"auto":editor.FIT_WIDTH_ZOOM_MODE);},[l]);if(t)return null;let h=`${Math.round(o*100)}%`,v=editor.sameZoomMode(a,editor.AUTO_ZOOM_MODE),y=editor.sameZoomMode(a,editor.FIT_WIDTH_ZOOM_MODE);return jsxRuntime.jsxs("span",{ref:b,className:"docx-toolbar__zoom","data-slot":"zoom.level",children:[jsxRuntime.jsx(Wp,{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":u,"aria-label":g("zoom.zoomLevel"),onMouseDown:B,onClick:()=>f(S=>!S),children:[h,jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),canDecrease:p,canIncrease:d,onDecrease:s,onIncrease:c}),u?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":v,...v?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>T("auto"),children:g("zoom.automatic")}),jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":y,...y?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>T("fit-width"),children:g("zoom.fitWidth")}),jsxRuntime.jsx("hr",{className:"docx-toolbar__menu-separator",role:"presentation"}),m.map(S=>{let w=!r&&Math.abs(S-o)<.001;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":w,...w?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>x(S),children:`${Math.round(S*100)}%`},S)})]}):null]})}var Is=Object.assign(Iy,{docxSlot:"zoom.level"});var Ly=[1,1.15,1.5,2,2.5,3],jp=10,Yp=0,Fy=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),Ay=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function Hy({className:e,hidden:t}){let n=A(),o=O(Fy,Ay),{isEnabled:r,disabledReason:a}=le("list.lineSpacing"),i=le("paragraph.dialog"),l=Uu(),c=J(),[s,d]=nt.useState(false),p=nt.useRef(null),m=nt.useRef(null);nt.useEffect(()=>{if(!s)return;let h=v=>{let y=p.current;y&&v.target instanceof Node&&y.contains(v.target)||d(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]);let g=nt.useCallback(h=>{if(d(false),!n)return;let v=editor.commandForSlotValue("list.lineSpacing",h);v&&n.can(v).ok&&n.exec(v);},[n]),u=nt.useCallback((h,v)=>{if(d(false),!n)return;let y={type:"setParagraphSpacing",[h]:v};n.can(y).ok&&n.exec(y);},[n]);if(t)return null;let f=X("list.lineSpacing"),b=(o.spaceBeforePt??0)>0,x=(o.spaceAfterPt??0)>0,T=o.lineSpacing?.rule==="multiple"?o.lineSpacing?.value??null:null;return jsxRuntime.jsxs("span",{ref:p,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:a??c("lineSpacing.label"),onMouseDown:B,onClick:()=>d(h=>!h),children:[Q(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:[Ly.map(h=>{let v=T===h;return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":v,...v?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>g(h),children:Number.isInteger(h*10)?h.toFixed(1):h.toFixed(2)},h)}),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:!i.isEnabled,title:i.disabledReason??void 0,onMouseDown:B,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:B,onClick:()=>u("beforePt",b?Yp:jp),children:c(b?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>u("afterPt",x?Yp:jp),children:c(x?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var Ds=Object.assign(Hy,{docxSlot:"list.lineSpacing"});var zy=[{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"}],Xp=[{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"}],Jp=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],ei=["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"],Yt=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 Vy(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?[Yt(50),Yt(35),Yt(25),Yt(15),Yt(5)]:n>=.8?[st(10),st(25),st(50),st(75),st(90)]:[Yt(80),Yt(60),Yt(40),st(25),st(50)]}var $y=/^[0-9A-Fa-f]{6}$/;function Wy(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 Uy(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 ti({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":""}:{},...Uy(t.replace("#",""))?{"data-light":""}:{},onMouseDown:B,onClick:()=>r(e)})}function Gy({apply:e,label:t,current:n,themeHexes:o}){let r=o.map(Vy),a=[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((i,l)=>jsxRuntime.jsx(ti,{value:i,css:`#${i.toLowerCase()}`,title:t(ei[l]),selected:n===i,apply:e},`base-${l}`)),a.map(i=>o.map((l,c)=>{let s=r[c][i],d=Wy(l,s.apply);return jsxRuntime.jsx(ti,{value:d,css:`#${d.toLowerCase()}`,title:`${t(ei[c])}, ${t(s.labelKey)}`,selected:n===d,apply:e},`${i}-${c}`)}))]})]})}function jy(e){let{apply:t,label:n,current:o}=e,[r,a]=nt.useState(""),i=$y.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Gy,{...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:zy.map(l=>jsxRuntime.jsx(ti,{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=>a(l.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:l=>{l.key==="Enter"&&i&&t(r.toUpperCase());}}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__swatch-apply",disabled:!i,onMouseDown:B,onClick:()=>t(r.toUpperCase()),children:n("colorPicker.apply")})]})]})]})}function Ls({apply:e,current:t}){let n=A(),o=J(),r=n?.getDocumentThemeColors()??[],a=r.length===ei.length?r.map(l=>l.hex):Jp,i=t?.toUpperCase()??null;return jsxRuntime.jsx(jy,{apply:e,label:o,current:i,themeHexes:a})}var Yy=Xp.filter(e=>e.value!=="white");function Xy({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:Yy.map(o=>jsxRuntime.jsx(ti,{value:o.value,css:o.css,title:t(o.labelKey),selected:n===o.value,apply:e},o.value))})]})}function Qp(e){let{slot:t,defaultValue:n,cssOf:o,clear:r,body:a}=e,i=t==="text.color";return Object.assign(({className:c,hidden:s,icon:d})=>{let p=A(),{isEnabled:m,disabledReason:g}=le(t),u=J(),[f,b]=nt.useState(false),[x,T]=nt.useState(n),h=nt.useRef(null),v=O(R=>{if(i){let N=R.formatting?.color;return N&&N.kind==="hex"?N.value.toUpperCase():null}return R.formatting?.highlight??null}),y=p?.getDocumentThemeColors()??[],S=y.length===ei.length?y.map(R=>R.hex):Jp;nt.useEffect(()=>{if(!f)return;let R=N=>{let L=h.current;L&&N.target instanceof Node&&L.contains(N.target)||b(false);};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[f]);let w=nt.useCallback(R=>{if(b(false),!p)return;let N=editor.commandForSlotValue(t,R);N&&p.can(N).ok&&(p.exec(N),R!==r.value&&T(R));},[p]),C=nt.useMemo(()=>X(t),[]);if(s)return null;let k=u(C?.labelKey??t);return jsxRuntime.jsxs("div",{ref:h,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":k,title:g??k,onMouseDown:B,onClick:()=>w(x),children:[d??Q(C?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:o(x)},"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":k,title:g??k,onMouseDown:B,onClick:()=>b(R=>!R),children:"\u25BE"}),f?jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-popup",role:"dialog","aria-label":k,onMouseDown:B,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:B,onClick:()=>w(r.value),children:[jsxRuntime.jsx("span",{className:`docx-toolbar__swatch-clear-chip${r.value==="none"?" docx-toolbar__swatch-clear-chip--none":""}`,"aria-hidden":"true"}),u(r.labelKey)]}),a({apply:w,label:u,current:v,themeHexes:S})]}):null]})},{docxSlot:t})}var Jy=new Map(Xp.map(e=>[e.value,e.css])),Fs=Qp({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(Ls,{apply:e.apply,current:e.current})}),As=Qp({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>Jy.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(Xy,{...e})});var nx=["alignment.left","alignment.center","alignment.right","alignment.justify"];function rx({className:e,hidden:t}){let n=le("alignment.left"),o=le("alignment.center"),r=le("alignment.right"),a=le("alignment.justify"),i=J(),[l,c]=nt.useState(false),s=nt.useRef(null);if(nt.useEffect(()=>{if(!l)return;let f=b=>{let x=s.current;x&&b.target instanceof Node&&x.contains(b.target)||c(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[l]),t)return null;let d=[n,o,r,a],p=nx.map((f,b)=>({slot:f,control:X(f),state:d[b]})),m=p.find(f=>f.state.isActive)??p[0],g=p.some(f=>f.state.isEnabled),u=i(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":u,title:g?u:m.state.disabledReason??u,onMouseDown:B,onClick:()=>c(f=>!f),children:[Q(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:p.map(f=>{let b=i(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:B,onClick:()=>{f.state.execute(),c(false);},children:Q(f.control?.paths)},f.slot)})}):null]})}var oi=Object.assign(rx,{docxSlot:"alignment"});function Os(e){let{label:t,icon:n,active:o,disabled:r,disabledReason:a,onSelect:i,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?a??t:t,onMouseDown:p=>B(p),onClick:r?void 0:i};return l?jsxRuntime.jsx(j,{...d,children:s}):jsxRuntime.jsx("button",{...d,children:n??s})}var px=Object.freeze([]),mx=e=>e.formatting?.fontFamily??null,fx=e=>e;function ni(){let e=A(),t=O(mx),n=O(fx),o=nt.useMemo(()=>e&&!n.isLoading?e.getAvailableFonts():px,[e,n]),{isEnabled:r}=le("font.family"),a=nt.useCallback(i=>{if(!e)return;let l=editor.commandForSlotValue("font.family",i);l&&e.can(l).ok&&e.exec(l);},[e]);return nt.useMemo(()=>({value:t,setValue:a,options:o,isEnabled:r}),[t,a,o,r])}var om=nt.createContext(null);function Zs(){return nt.useContext(om)}function qs({asChild:e,className:t,children:n}){let o=Zs(),r=J();if(!o)return null;let a=r(X("font.family")?.labelKey??"font.family"),i={onClick:()=>o.setOpen(!o.open),onMouseDown:B,disabled:!o.isEnabled,className:`docx-toolbar__font-family-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":a,title:a},l=n??jsxRuntime.jsx("span",{children:o.value??"\u2014"});return e?jsxRuntime.jsx(j,{...i,children:l}):jsxRuntime.jsx("button",{type:"button",...i,children:l})}qs.docxToolbarPart=true;var gx=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"]]),bx=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function nm({asChild:e,className:t,children:n}){let o=Zs(),r=J();if(!o||!o.open)return null;let a={role:"listbox",className:`docx-toolbar__menu docx-toolbar__font-family-content${t?` ${t}`:""}`},i;return n!==void 0?i=n:i=bx.map(c=>({...c,fonts:o.options.filter(s=>(gx.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(rm,{value:d},d))]},c.category)),e?jsxRuntime.jsx(j,{...a,children:i}):jsxRuntime.jsx("div",{...a,children:i})}function rm({value:e,asChild:t,className:n,children:o}){let r=Zs();if(!r)return null;let a=r.value===e,i={role:"option","aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:B,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,{...i,children:l}):jsxRuntime.jsxs("button",{type:"button",...i,children:[l,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function hx({hidden:e,asChild:t,className:n,children:o}){let r=ni(),[a,i]=nt.useState(false),l=nt.useRef(null);nt.useEffect(()=>{if(!a)return;let p=m=>{let g=l.current;g&&m.target instanceof Node&&g.contains(m.target)||i(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]);let c=nt.useMemo(()=>({...r,open:a,setOpen:i}),[r,a]);if(e)return null;let s={className:`docx-toolbar__font-family${n?` ${n}`:""}`,"data-slot":"font.family"},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qs,{}),jsxRuntime.jsx(nm,{})]});return jsxRuntime.jsx(om.Provider,{value:c,children:t?jsxRuntime.jsx(j,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var Ks=Object.assign(hx,{docxSlot:"font.family",Trigger:qs,Content:nm,Item:rm});var yx={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},xx=new Set(["Title","Heading1","Heading2","Heading3"]),Sx={Subtitle:"666666"},Tx="#4a6c8c";function am(e){let t=yx[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??xx.has(e.styleId))&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let r=e.color??Sx[e.styleId];return r?o.color=`#${r}`:e.styleId.startsWith("Heading")&&(o.color=Tx),o}var Cx=/^heading ([1-9])$/;function Vs(e,t){let n=e||t,o=Cx.exec(n);return o?`Heading ${o[1]}`:n}function im(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:Vs(t.name,t.styleId),priority:99}))}function _x(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 Dx=Object.freeze([]),Nx=e=>e.formatting?.styleId??null,Lx=e=>e;function ri(){let e=A(),t=O(Nx),n=O(Lx),o=nt.useMemo(()=>e&&!n.isLoading?e.getDocumentStyles().filter(i=>i.type==="paragraph").map(i=>({styleId:i.styleId,name:Vs(i.name,i.styleId),preview:i.preview})):Dx,[e,n]),{isEnabled:r}=le("styles.style"),a=nt.useCallback(i=>{if(!e)return;let l=editor.commandForSlotValue("styles.style",i);l&&e.can(l).ok&&e.exec(l);},[e]);return nt.useMemo(()=>({value:t,setValue:a,options:o,isEnabled:r}),[t,a,o,r])}var lm=nt.createContext(null);function Ws(){return nt.useContext(lm)}function Us({asChild:e,className:t,children:n}){let o=Ws(),r=J();if(!o)return null;let a=X("styles.style"),i=r(a?.labelKey??"styles.style"),l={onClick:()=>o.setOpen(!o.open),onMouseDown:B,disabled:!o.isEnabled,className:`docx-toolbar__style-trigger${t?` ${t}`:""}`,...o.isEnabled?{}:{"data-disabled":""},"aria-haspopup":"listbox","aria-expanded":o.open,"aria-label":i,title:i},c=o.options.find(d=>d.styleId===o.value),s=n??(o.value===null?jsxRuntime.jsx("span",{children:a?.valueKey?r(a.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})}Us.docxToolbarPart=true;function sm({asChild:e,className:t,children:n}){let o=Ws();if(!o||!o.open)return null;let r={role:"listbox",className:`docx-toolbar__menu docx-toolbar__style-content${t?` ${t}`:""}`},a=n??o.options.map(i=>jsxRuntime.jsx(cm,{value:i.styleId},i.styleId));return e?jsxRuntime.jsx(j,{...r,children:a}):jsxRuntime.jsx("div",{...r,children:a})}function cm({value:e,asChild:t,className:n,children:o}){let r=Ws();if(!r)return null;let a=r.value===e,i=r.options.find(s=>s.styleId===e),l={role:"option","aria-selected":a,...a?{"data-selected":""}:{},onMouseDown:B,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__style-item${n?` ${n}`:""}`},c=o??jsxRuntime.jsx("span",{style:i?_x(i.preview):void 0,children:i?.name??e});return t?jsxRuntime.jsx(j,{...l,children:c}):jsxRuntime.jsxs("button",{type:"button",...l,children:[c,a?jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:"\u2713"}):null]})}function Fx({hidden:e,asChild:t,className:n,children:o}){let r=ri(),[a,i]=nt.useState(false),l=nt.useRef(null);nt.useEffect(()=>{if(!a)return;let p=m=>{let g=l.current;g&&m.target instanceof Node&&g.contains(m.target)||i(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[a]);let c=nt.useMemo(()=>({...r,open:a,setOpen:i}),[r,a]);if(e)return null;let s={className:`docx-toolbar__style${n?` ${n}`:""}`,"data-slot":"styles.style"},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Us,{}),jsxRuntime.jsx(sm,{})]});return jsxRuntime.jsx(lm.Provider,{value:c,children:t?jsxRuntime.jsx(j,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var Gs=Object.assign(Fx,{docxSlot:"styles.style",Trigger:Us,Content:sm,Item:cm});function um(e,t){let n=e;return Object.assign(({className:r,hidden:a,icon:i,asChild:l,children:c})=>{let{isEnabled:s,disabledReason:d}=le(n),p=Et(),m=t==="showAll"?p.showAll:p.formFill,g=J();if(a)return null;let u=X(n),f=g(u?.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:B,onClick:()=>{t==="showAll"?p.toggleShowAll():p.toggleFormFill();}};return l?jsxRuntime.jsx(j,{...b,children:c}):jsxRuntime.jsx("button",{...b,children:i??c??Q(u?.paths)})},{docxSlot:n})}function Hx({className:e,hidden:t,icon:n,asChild:o,children:r}){let a=Ye.inspector,{isEnabled:i,disabledReason:l}=le(a),{inspectorOpen:c,openInspector:s}=Et(),d=J();if(t)return null;let p=X(a),m=d(p?.labelKey??"contentControl.inspector"),g={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Ye.inspector,disabled:!i,...i?{}:{"data-disabled":""},...c?{"data-active":""}:{},"aria-pressed":c,"aria-label":m,title:l??m,onMouseDown:B,onClick:()=>s()};return o?jsxRuntime.jsx(j,{...g,children:r}):jsxRuntime.jsx("button",{...g,children:n??r??Q(p?.paths)})}function Ox({className:e,hidden:t,icon:n,asChild:o,children:r}){let{canRemove:a,removeDisabledReason:i,remove:l}=Et(),c=J();if(t)return null;let s=Ye.remove,d=X(s),p=c(d?.labelKey??"contentControl.remove"),m={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Ye.remove,disabled:!a,...a?{}:{"data-disabled":""},"aria-label":p,title:i??p,onMouseDown:B,onClick:()=>{l();}};return o?jsxRuntime.jsx(j,{...m,children:r}):jsxRuntime.jsx("button",{...m,children:n??r??Q(d?.paths)})}var ai=um(Ye.showAll,"showAll"),ii=um(Ye.formFill,"formFill"),li=Object.assign(Ox,{docxSlot:Ye.remove}),si=Object.assign(Hx,{docxSlot:Ye.inspector}),pm={[Ye.showAll]:ai,[Ye.formFill]:ii,[Ye.inspector]:si,[Ye.remove]:li};function js(e,t){let n=A(),o=nt.useRef(t);o.current=t,nt.useEffect(()=>{if(!n)return;let r=((...a)=>{o.current(...a);});return n.on(e,r)},[n,e]);}var $x=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Xs=nt.createContext(null);function ym(){let e=nt.useContext(Xs);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function Ux(e,t){let n=t.table,r=(e?.getSelectedTable()??null)?.blockId??"",a=n?`${r}|${n.rows}|${n.columns}|${n.rowIndex}|${n.columnIndex}`:"",i=t.selection,l=i?`${i.from&&"paraId"in i.from?i.from.paraId:""}|${i.to&&"paraId"in i.to?i.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:a,selectionKey:l,cellSelectionKey:s,editable:t.editable,editingMode:t.editingMode??"editing"}}function Gx(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function jx(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var hm={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function Yx(e,t){let n={};for(let o of $x){let r=editor.tableChromeToolbarState(e,o,t);n[o]={enabled:r.enabled,disabledReason:r.disabledReason};}return n}function Js({children:e}){let t=A(),[n,o]=nt.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,a]=nt.useState(hm);nt.useEffect(()=>(()=>{}),[]);let i=O(nt.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:""}),[]),Gx,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),l=nt.useCallback(()=>{if(!t){a(hm);return}let m=Ux(t,t.snapshot());a(g=>jx(g,m)?g:m);},[t]);nt.useEffect(()=>{l();},[l,i]),js("selectionChange",nt.useCallback(()=>{l();},[l]));let c=r.tableKey!=="",s=nt.useMemo(()=>t?Yx(t,n):{},[t,n,r.tableKey,r.selectionKey,r.cellSelectionKey,r.editable,r.editingMode]),d=nt.useCallback((m,g)=>{if(!t)return;let{result:u,nextDraft:f}=editor.runTableChromeCommand(t,m,g,n);u.ok&&f&&o(f);},[t,n]),p=nt.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(Xs.Provider,{value:p,children:e})}function Xx(){let e=nt.useContext(Xs);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function di(e){let t=Xx(),n=t.slotState(e);return nt.useMemo(()=>({visible:t.visible,enabled:n.enabled,disabledReason:n.disabledReason,draft:t.draft,apply:o=>t.apply(e,o)}),[t,e,n])}var Qx='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function Io(e){return [...e.querySelectorAll(Qx)].filter(t=>t.closest('[role="menu"]')===e)}function Qs(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function ht(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 vt(e,t){let n=t==="first"?e[0]:e[e.length-1];return n?(n.focus(),true):false}function ui(e){(fn(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function tc(e,t,n){nt.useEffect(()=>{if(!e)return;let o=r=>{let a=n.current;a&&r.target instanceof Node&&a.contains(r.target)||t(false);};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,t,n]);}function pi({enabled:e,disabledReason:t,ariaLabel:n}){let{t:o}=D(),r=i18n.localizeDisabledReason(t,o),a=nt.useId(),i=!e&&r?a:void 0;return {reasonId:a,shared:{type:"button",onMouseDown:B,"aria-label":n,...i?{"aria-describedby":i}:{},...r?{title:r}:{},...e?{}:{"data-disabled":"","aria-disabled":true}},reasonNode:i&&r?jsxRuntime.jsx("span",{id:a,className:"docx-editor-sr-only",children:r}):null}}var oS='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function xm(e,t,n,o){nt.useEffect(()=>{if(!e)return;let r=n.current,a=o.current;if(!r)return;let i=()=>[...r.querySelectorAll(oS)].filter(s=>s.closest('[role="menu"]')===r);queueMicrotask(()=>{let s=i();(s.find(p=>p.hasAttribute("data-selected")||p.hasAttribute("data-active"))??s[0])?.focus();});let c=s=>{let d=i();if(s.key==="Escape"){s.preventDefault(),t(false),a?.focus();return}if(s.key==="ArrowDown"){s.preventDefault(),ht(d,document.activeElement,1);return}if(s.key==="ArrowUp"){s.preventDefault(),ht(d,document.activeElement,-1);return}if(s.key==="Home"){s.preventDefault(),vt(d,"first");return}if(s.key==="End"){s.preventDefault(),vt(d,"last");return}if(s.key==="Enter"||s.key===" "){let p=document.activeElement;p instanceof HTMLElement&&d.includes(p)&&(s.preventDefault(),p.click());}};return r.addEventListener("keydown",c),()=>r.removeEventListener("keydown",c)},[e,t,n,o]);}function Sm(e,t,n,o){nt.useEffect(()=>{if(!e)return;let r=n.current,a=o.current;if(!r)return;let i=()=>[...r.querySelectorAll('button:not([aria-disabled="true"])')].filter(c=>c.closest('[role="dialog"]')===r);queueMicrotask(()=>{i()[0]?.focus();});let l=c=>{if(c.key==="Escape"){c.preventDefault(),t(false),a?.focus();return}if(c.key==="Enter"||c.key===" "){let s=document.activeElement,d=i();s instanceof HTMLElement&&d.includes(s)&&(c.preventDefault(),s.click());}};return r.addEventListener("keydown",l),()=>r.removeEventListener("keydown",l)},[e,t,n,o]);}function wm(e,t,n){if(e)return o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(!t));}}function cS(e){return Q(editor.tableChromeIconPaths(e))}function Rm(){return nt.createContext(null)}function Ot(e){let t=nt.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function nc(e,t,n){let o=Rm();function r({hidden:l,asChild:c,className:s,children:d}){let{visible:p,enabled:m,disabledReason:g,draft:u,apply:f}=di(e),[b,x]=nt.useState(false),T=nt.useRef(null),h=nt.useRef(null);tc(b,x,T);let v=nt.useMemo(()=>({open:b,setOpen:x,enabled:m,disabledReason:g,apply:f,draft:u,triggerRef:h}),[b,m,g,f,u]);if(l||!p)return null;let y={className:`${t}${s?` ${s}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},S=d??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(a,{}),jsxRuntime.jsx(i,{})]});return jsxRuntime.jsx(o.Provider,{value:v,children:c?jsxRuntime.jsx(j,{...y,ref:T,children:S}):jsxRuntime.jsx("div",{ref:T,...y,children:S})})}function a({asChild:l,className:c,children:s}){let{open:d,setOpen:p,enabled:m,disabledReason:g,triggerRef:u}=Ot(o),f=J(),b=X(e),x=f(b?.labelKey??n),{shared:T,reasonNode:h}=pi({enabled:m,disabledReason:g,ariaLabel:x}),v={...T,ref:u,className:`docx-toolbar__button docx-table-chrome__trigger${c?` ${c}`:""}`,"aria-haspopup":"menu","aria-expanded":d,onClick:m?()=>p(!d):void 0,...l?{tabIndex:m?0:-1,role:"button",onKeyDown:wm(m,d,p)}:{}},y=s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Q(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,{...v,children:y}),h]}):jsxRuntime.jsxs("button",{...v,children:[y,h]})}a.docxToolbarPart=true;function i({asChild:l,className:c,children:s}){let{open:d,setOpen:p,enabled:m,triggerRef:g}=Ot(o),u=J(),f=nt.useRef(null);if(xm(d&&m,p,f,g),!d||!m)return null;let b=X(e),x=u(b?.labelKey??n),T={ref:f,role:"menu","aria-label":x,className:`docx-table-chrome__panel${c?` ${c}`:""}`,onMouseDown:B};return l?jsxRuntime.jsx(j,{...T,children:s}):jsxRuntime.jsx("div",{...T,children:s})}return {Root:r,Trigger:a,Content:i,Ctx:o}}var Sr=nc("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function km({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Ot(Sr.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===i.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:B,onClick:()=>{a(false),r(c.value);}},p=o??cS(c.icon);return t?jsxRuntime.jsx(j,{...d,children:p}):jsxRuntime.jsx("button",{...d,children:p})}function Mm(e){let{children:t}=e;return jsxRuntime.jsx(Sr.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(n=>jsxRuntime.jsx(km,{value:n.value},n.value))})})}function dS(e){let{children:t}=e,n=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Sr.Trigger,{}),jsxRuntime.jsx(Mm,{})]});return jsxRuntime.jsx(Sr.Root,{...e,children:n})}var wr=Object.assign(dS,{docxSlot:"table.borderTarget",Trigger:Sr.Trigger,Content:Mm,Item:km}),Tr=nc("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function Im({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Ot(Tr.Ctx),l=J(),c=editor.TABLE_BORDER_STYLE_OPTIONS.find(m=>m.value===e);if(!c)return null;let s=c.value===i.spec.style,d={type:"button",role:"menuitemradio","aria-checked":s,...s?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:B,onClick:()=>{a(false),r(c.value);}},p=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:p}):jsxRuntime.jsx("button",{...d,children:p})}function _m(e){let{children:t}=e;return jsxRuntime.jsx(Tr.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(n=>jsxRuntime.jsx(Im,{value:n.value},n.value))})}function uS(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tr.Trigger,{}),jsxRuntime.jsx(_m,{})]});return jsxRuntime.jsx(Tr.Root,{...e,children:t})}var Rr=Object.assign(uS,{docxSlot:"table.borderStyle",Trigger:Tr.Trigger,Content:_m,Item:Im}),Cr=nc("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function Dm({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:a,draft:i}=Ot(Cr.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===i.spec.size,p={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:B,onClick:()=>{a(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,{...p,children:m}):jsxRuntime.jsx("button",{...p,children:m})}function Nm(e){let{children:t}=e;return jsxRuntime.jsx(Cr.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(n=>jsxRuntime.jsx(Dm,{value:String(n.size)},n.size))})}function pS(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Cr.Trigger,{}),jsxRuntime.jsx(Nm,{})]});return jsxRuntime.jsx(Cr.Root,{...e,children:t})}var kr=Object.assign(pS,{docxSlot:"table.borderWidth",Trigger:Cr.Trigger,Content:Nm,Item:Dm});function Lm(e,t,n){let o=n?.defaultHex??"FF0000",r=Rm();function a({hidden:d,asChild:p,className:m,children:g}){let{visible:u,enabled:f,disabledReason:b,draft:x,apply:T}=di(e),[h,v]=nt.useState(false),[y,S]=nt.useState(o),w=nt.useRef(null),C=nt.useRef(null);tc(h,v,w);let k=nt.useMemo(()=>({open:h,setOpen:v,enabled:f,disabledReason:b,apply:T,draft:x,triggerRef:C,lastHex:y,setLastHex:S}),[h,f,b,T,x,y]);if(d||!u)return null;let R={className:`docx-toolbar__colorsplit docx-table-chrome${m?` ${m}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},N=g??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(i,{}),jsxRuntime.jsx(l,{}),jsxRuntime.jsx(c,{clearFill:n?.clearFill??false})]});return jsxRuntime.jsx(r.Provider,{value:k,children:p?jsxRuntime.jsx(j,{...R,ref:w,children:N}):jsxRuntime.jsx("div",{ref:w,...R,children:N})})}function i({asChild:d,className:p,children:m}){let{enabled:g,disabledReason:u,apply:f,draft:b,lastHex:x}=Ot(r),T=J(),h=X(e),v=T(h?.labelKey??t),{shared:y,reasonNode:S}=pi({enabled:g,disabledReason:u,ariaLabel:v}),w=e==="table.borderColor"&&b.spec.color.kind==="hex"?b.spec.color.value:x??o,C={...y,className:`docx-toolbar__button docx-toolbar__colorsplit-main${p?` ${p}`:""}`,onClick:g?()=>f({kind:"hex",value:w}):void 0},k=m??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Q(h?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:`#${w.toLowerCase()}`},"aria-hidden":"true"})]});return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...C,children:k}),S]}):jsxRuntime.jsxs("button",{...C,children:[k,S]})}i.docxToolbarPart=true;function l({asChild:d,className:p,children:m}){let{open:g,setOpen:u,enabled:f,disabledReason:b,triggerRef:x}=Ot(r),T=J(),h=X(e),v=T(h?.labelKey??t),{shared:y,reasonNode:S}=pi({enabled:f,disabledReason:b,ariaLabel:v}),w={...y,ref:x,className:`docx-toolbar__colorsplit-caret${p?` ${p}`:""}`,"aria-haspopup":"dialog","aria-expanded":g,onClick:f?()=>u(!g):void 0,...d?{tabIndex:f?0:-1,role:"button",onKeyDown:wm(f,g,u)}:{}},C=m??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...w,children:C}),S]}):jsxRuntime.jsxs("button",{...w,children:[C,S]})}l.docxToolbarPart=true;function c({asChild:d,className:p,children:m,clearFill:g}){let{open:u,setOpen:f,enabled:b,apply:x,draft:T,triggerRef:h,lastHex:v,setLastHex:y}=Ot(r),S=J(),w=nt.useRef(null);if(Sm(u&&b,f,w,h),!u||!b)return null;let C=S(t),k=e==="table.borderColor"&&T.spec.color.kind==="hex"?T.spec.color.value:v??o,R={ref:w,role:"dialog","aria-label":C,className:`docx-toolbar__swatch-popup docx-table-chrome__panel${p?` ${p}`:""}`,onMouseDown:B},N=m??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g?jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:B,onClick:()=>{f(false),x(null),ui(h.current);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__swatch-clear-chip docx-toolbar__swatch-clear-chip--none","aria-hidden":"true"}),S("table.clearCellFill")]}):null,jsxRuntime.jsx(Ls,{apply:L=>{f(false),y?.(L),x({kind:"hex",value:L}),ui(h.current);},current:k})]});return d?jsxRuntime.jsx(j,{...R,children:N}):jsxRuntime.jsx("div",{...R,children:N})}function s({value:d,css:p,labelKey:m,asChild:g,className:u,children:f}){let{apply:b,setOpen:x,setLastHex:T,triggerRef:h}=Ot(r),v=J(),y=p??`#${d.toLowerCase()}`,S=m?v(m):d,w={type:"button",className:`docx-toolbar__swatch docx-table-chrome__swatch${u?` ${u}`:""}`,style:{backgroundColor:y},"data-value":d,"aria-label":S,title:S,onMouseDown:B,onClick:()=>{x(false),T?.(d),b({kind:"hex",value:d}),ui(h.current);}};return g?jsxRuntime.jsx(j,{...w,children:f}):jsxRuntime.jsx("button",{...w,children:f})}return {Root:a,Main:i,Trigger:l,Content:c,Item:s,Ctx:r}}var Pr=Lm("table.borderColor","table.borderColor",{defaultHex:"000000"});function mS(e){return jsxRuntime.jsx(Pr.Content,{...e,clearFill:false})}function fS(e){return jsxRuntime.jsx(Pr.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function gS(e){return jsxRuntime.jsx(Pr.Root,{...e})}var Mr=Object.assign(gS,{docxSlot:"table.borderColor",Trigger:Pr.Trigger,Content:mS,Item:fS,Main:Pr.Main}),Er=Lm("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function bS(e){return jsxRuntime.jsx(Er.Content,{...e,clearFill:true})}function hS(e){return jsxRuntime.jsx(Er.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function vS(e){return jsxRuntime.jsx(Er.Root,{...e})}var Ir=Object.assign(vS,{docxSlot:"table.cellFill",Trigger:Er.Trigger,Content:bS,Item:hS,Main:Er.Main});function Fm({overrides:e=new Map,separator:t=true}){return ym()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(ko,{}):null,[wr,Mr,Rr,kr,Ir].map(r=>{let a=e.get(r.docxSlot);return a?jsxRuntime.jsx(nt.Fragment,{children:a},r.docxSlot):jsxRuntime.jsx(r,{},r.docxSlot)})]}):null}function Am(){let e=J(),{draft:t}=di("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var ic=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],gi="contextual-table",lc={"zoom.level":Is,"styles.style":Gs,"font.family":Ks,"font.size":Ms,"text.color":Fs,"text.highlight":As,"text.link":Ps,"list.lineSpacing":Ds,"review.editingMode":Ha,"review.authors":Ba,"file.save":Es,...pm,"table.borderTarget":wr,"table.borderColor":Mr,"table.borderStyle":Rr,"table.borderWidth":kr,"table.cellFill":Ir,"image.insert":Gn,"image.properties":mn,"image.wrap":pr,"image.altText":mr},mi={id:gi,labelKey:"formattingBar.groups.table",entries:ic.map(e=>({slot:e,Part:lc[e]}))},Hm=new Map;function SS(e){let t=Hm.get(e);return t||(t=n=>jsxRuntime.jsx(xo,{slot:e,...n}),Hm.set(e,t)),t}function TS(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:oi}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(n=>{let o=editor.chromeSlotId(t,n);return {slot:o,Part:lc[o]??SS(o)}})})}var CS=e=>e.image,PS=e=>e.isLoading||e.isOpening===true,ES=e=>e.table!==null;function wS(e){return e==="alignment"||e in lc}function hi(e){let t=cn(e,hi);if(t!==null)return t;if(!nt.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 rc(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(rc);let t=hi(e);return t!=null&&ic.includes(t)?true:nt.isValidElement(e)?nt.Children.toArray(e.props.children).some(rc):false}function RS(e,t){return t?true:nt.Children.toArray(e).some(rc)}function kS(e){let t=tt(),{className:n,t:o,onSave:r,preset:a=true,overflow:i=true,children:l}=e,c=nt.useMemo(()=>({t:o,onSave:r}),[o,r]),s=Ta(o),d=O(CS),p=O(PS),m=O(ES),g=nt.useMemo(()=>TS(d),[d]),u=nt.useMemo(()=>new Set(g.flatMap(y=>y.entries.map(S=>S.slot))),[g]),f=nt.useMemo(()=>[...g.map(y=>y.id).filter(y=>!ds.has(y)),...m?[gi]:[]],[g,m]),b=nt.useMemo(()=>Yu(f),[f]),x=a&&i,{attach:T,overflow:h}=ip(x,f,b),v;if(!a)v=l;else {let y=nt.Children.toArray(l),S=new Map,w=new Map,C=[];for(let M of y){let E=hi(M);E&&u.has(E)?S.set(E,M):E&&ic.includes(E)?w.set(E,M):C.push(M);}let k=M=>{let E=S.get(M.slot);if(E)return E;let I=M.Part;return jsxRuntime.jsx(I,{})},R=M=>{let E=w.get(M.slot);if(E)return E;let I=M.Part;return jsxRuntime.jsx(I,{})},N=[],L=[],H=0;for(let M of g){if(h.has(M.id)){let I=M.entries.flatMap(ae=>{let z=Om(ae,S,s,M.labelKey,k);return z===null?[]:[jsxRuntime.jsx(nt.Fragment,{children:z},ae.slot)]});if(I.length===0)continue;L.push({id:M.id,labelKey:M.labelKey,children:I});continue}H>0&&N.push(jsxRuntime.jsx(ko,{},`separator-${M.id}`)),H+=1;let E=ds.has(M.id);N.push(jsxRuntime.jsx("div",{className:"docx-toolbar__group",...E?{[dr]:""}:{[dn]:M.id},children:M.entries.map(I=>jsxRuntime.jsx(nt.Fragment,{children:k(I)},I.slot))},M.id));}let _=h.has(gi);if(m&&_){let M=mi.entries.flatMap(E=>{let I=Om(E,w,s,mi.labelKey,R);return I===null?[]:[jsxRuntime.jsx(nt.Fragment,{children:I},E.slot)]});M.length>0&&L.unshift({id:mi.id,labelKey:mi.labelKey,children:M});}v=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[N,m&&!_?jsxRuntime.jsx(ko,{},"separator-contextual-table"):null,_?null:jsxRuntime.jsx("div",{className:"docx-toolbar__contextual",[dn]:gi,children:jsxRuntime.jsx(Fm,{overrides:w,separator:false})}),C.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[dr]:"",children:C}):null,L.length>0?jsxRuntime.jsx(up,{sections:L}):null]});}return jsxRuntime.jsx(yo.Provider,{value:c,children:jsxRuntime.jsx(Wu,{children:jsxRuntime.jsx("fieldset",{ref:T,disabled:p,role:"toolbar","data-testid":"docx-toolbar",className:`${t}docx-toolbar${n?` ${n}`:""}`,...x?{"data-overflow":""}:{},onMouseDown:B,children:RS(l,a)?jsxRuntime.jsx(Js,{children:v}):v})})})}function Bm(e){if(!e)return false;if(e.type===nt.Fragment){let t=nt.Children.toArray(e.props.children).find(n=>hi(n)!==null);return nt.isValidElement(t)?Bm(t):false}return !!e.props.hidden}function Om(e,t,n,o,r){let a=t.get(e.slot);return Bm(a)?null:a||wS(e.slot)?jsxRuntime.jsx(cp,{label:MS(n,e,o),children:r(e)}):jsxRuntime.jsx(dp,{slot:e.slot})}function MS(e,t,n){let o=t.slot==="alignment"?null:X(t.slot);return e(o?.labelKey??n)}var Dr=Object.assign(kS,{Button:xo,Action:Os,Separator:ko,Undo:xp,Redo:Sp,Bold:Tp,Italic:Cp,Underline:Pp,Strike:Ep,Link:Ps,ClearFormatting:wp,Superscript:Rp,Subscript:kp,Alignment:oi,AlignLeft:Mp,AlignCenter:Ip,AlignRight:_p,AlignJustify:Dp,LineSpacing:Ds,BulletList:Np,NumberedList:Lp,Outdent:Fp,Indent:Ap,ImageInsert:Gn,ImageProperties:mn,ImageWrap:pr,ImageAltText:mr,TableInsert:Hp,TableBorderTarget:wr,TableBorderColor:Mr,TableBorderStyle:Rr,TableBorderWidth:kr,TableCellFill:Ir,Comments:Op,FontFamily:Ks,FontSize:Ms,FontColor:Fs,Highlight:As,Zoom:Is,StylePicker:Gs,EditingMode:Ha,Reviewers:Ba,Save:Es,ContentControlShowAll:ai,ContentControlFormFill:ii,ContentControlInspector:si,ContentControlRemove:li});var NS=e=>e.pageSetup??null,LS=e=>e.editable;function _o(){let e=A(),t=O(NS),n=O(LS),o=nt.useMemo(()=>n&&e!==null&&e.can({type:"setPageSetup",marginTop:0}).ok,[e,n]),r=nt.useCallback(a=>e?e.exec({...a.pageWidthTwips!==void 0?{pageWidth:a.pageWidthTwips}:{},...a.pageHeightTwips!==void 0?{pageHeight:a.pageHeightTwips}:{},...a.orientation!==void 0?{orientation:a.orientation}:{},...a.marginTopTwips!==void 0?{marginTop:a.marginTopTwips}:{},...a.marginRightTwips!==void 0?{marginRight:a.marginRightTwips}:{},...a.marginBottomTwips!==void 0?{marginBottom:a.marginBottomTwips}:{},...a.marginLeftTwips!==void 0?{marginLeft:a.marginLeftTwips}:{},...a.scope!==void 0?{scope:a.scope}:{},type:"setPageSetup"}).ok:false,[e]);return nt.useMemo(()=>({pageSetup:t,isEnabled:o,apply:r}),[t,o,r])}var cc=[{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}],Um=1440,FS=e=>Math.round(e/Um*100)/100,AS=e=>Math.round(e*Um);function HS(e,t){let n=Math.min(e,t),o=Math.max(e,t);return cc.findIndex(r=>Math.abs(r.width-n)<20&&Math.abs(r.height-o)<20)}var OS={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},BS={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},ZS={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600,color:"var(--doc-text)"},qS={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},zm={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},vi={display:"flex",alignItems:"center",gap:12},yi={width:80,fontSize:13,color:"var(--doc-text-muted)"},xi={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13,backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},KS={fontSize:11,color:"var(--doc-text-muted)",width:16},zS={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},Vm={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},$m=12240,Wm=15840,Jt=1440;function Nr({open:e,onClose:t,className:n}){let{t:o}=D(),{pageSetup:r,isEnabled:a,apply:i}=_o(),[l,c]=nt.useState($m),[s,d]=nt.useState(Wm),[p,m]=nt.useState("portrait"),[g,u]=nt.useState(Jt),[f,b]=nt.useState(Jt),[x,T]=nt.useState(Jt),[h,v]=nt.useState(Jt),[y,S]=nt.useState("document"),w=nt.useRef(null),C=nt.useRef("no");nt.useEffect(()=>{if(!e){C.current="no";return}if(C.current==="yes"&&r===null){C.current="no";return}C.current==="yes"||C.current==="loading"&&r===null||(c(r?.pageWidthTwips??$m),d(r?.pageHeightTwips??Wm),m(r?.orientation??"portrait"),u(r?.marginsTwips.top??Jt),b(r?.marginsTwips.bottom??Jt),T(r?.marginsTwips.left??Jt),v(r?.marginsTwips.right??Jt),S("document"),C.current=r===null?"loading":"yes");},[e,r]),nt.useEffect(()=>{e&&w.current?.focus();},[e]);let k=nt.useCallback(_=>{let M=cc[_];M&&(c(p==="landscape"?M.height:M.width),d(p==="landscape"?M.width:M.height));},[p]),R=nt.useCallback(_=>{_!==p&&(m(_),c(s),d(l));},[p,l,s]),N=nt.useCallback(()=>{i({pageWidthTwips:l,pageHeightTwips:s,orientation:p,marginTopTwips:g,marginRightTwips:h,marginBottomTwips:f,marginLeftTwips:x,scope:y})&&t();},[i,l,s,p,g,h,f,x,y,t]);if(!e)return null;let L=HS(l,s),H=(_,M,E)=>jsxRuntime.jsxs("div",{style:vi,children:[jsxRuntime.jsx("label",{style:yi,children:o(`dialogs.pageSetup.${_}`)}),jsxRuntime.jsx("input",{type:"number",style:xi,min:0,max:22,step:.1,value:FS(M),onChange:I=>E(Math.max(0,AS(Number(I.target.value)||0))),"aria-label":o(`dialogs.pageSetup.${_}`)}),jsxRuntime.jsx("span",{style:KS,children:"in"})]});return jsxRuntime.jsx("div",{className:n,style:OS,onClick:t,onKeyDown:_=>{_.key==="Escape"&&t(),_.key==="Enter"&&N();},children:jsxRuntime.jsxs("div",{ref:w,tabIndex:-1,style:BS,onClick:_=>_.stopPropagation(),onMouseDown:_=>_.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o("dialogs.pageSetup.title"),children:[jsxRuntime.jsx("div",{style:ZS,children:o("dialogs.pageSetup.title")}),jsxRuntime.jsxs("div",{style:qS,children:[jsxRuntime.jsx("div",{style:zm,children:o("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{style:vi,children:[jsxRuntime.jsx("label",{style:yi,children:o("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{style:xi,value:L,onChange:_=>k(Number(_.target.value)),"aria-label":o("dialogs.pageSetup.sizeLabel"),children:[cc.map((_,M)=>jsxRuntime.jsx("option",{value:M,children:o(_.labelKey)},_.labelKey)),L<0&&jsxRuntime.jsx("option",{value:-1,children:o("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{style:vi,children:[jsxRuntime.jsx("label",{style:yi,children:o("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{style:xi,value:p,onChange:_=>R(_.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:{...zm,marginTop:4},children:o("dialogs.pageSetup.margins")}),H("top",g,u),H("bottom",f,b),H("left",x,T),H("right",h,v),jsxRuntime.jsxs("div",{style:vi,children:[jsxRuntime.jsx("label",{style:yi,children:o("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{style:xi,value:y,onChange:_=>S(_.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:zS,children:[jsxRuntime.jsx("button",{type:"button",style:Vm,onClick:t,children:o("common.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...Vm,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)",opacity:a?1:.5},disabled:!a,onClick:N,children:o("common.apply")})]})]})})}var Lr=nt.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 ot(){return nt.useContext(Lr)}function De(){let{t:e}=ot(),{t}=D();return n=>e?.(n)??t(n)}var WS=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i,US=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var Gm=new TextEncoder;function GS(e,t){if(Gm.encode(e).length<=t)return e;let n=0,o="";for(let r of e){let a=Gm.encode(r).length;if(n+a>t)break;n+=a,o+=r;}return o}function jm(e){let t=GS((e??"").replace(/\.docx$/i,"").replace(US," ").replace(/\s+/g," ").trim().replace(/^[.\s]+/,"").replace(/[.\s]+$/,""),200).trim();return !t||WS.test(t)?"document.docx":`${t}.docx`}function Ym(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 jS="https://github.com/eigenpal/docx-editor/issues/new";function YS(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function Xm(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??YS()}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${t}`,""].join(`
2
- `),a=new URLSearchParams({title:"[Bug] ",body:r});return `${jS}?${a.toString()}`}function Fr(e){typeof window>"u"||window.open(Xm(e),"_blank","noopener,noreferrer");}var dc=6,Qm=6;function Ne(e){let{icon:t,shortcut:n,disabled:o,title:r,active:a,selected:i,slot:l,onSelect:c,className:s,children:d}=e,p=e["data-value"],m=nn(),g=nt.useId(),u=o&&r?g:void 0;return jsxRuntime.jsxs("button",{type:"button",role:a===void 0?"menuitem":i===void 0?"menuitemcheckbox":"menuitemradio",className:`docx-toolbar__menu-item docx-menubar__item${s?` ${s}`:""}`,tabIndex:-1,...l?{"data-slot":l}:{},...p!==void 0?{"data-value":p}:{},...a?{"data-active":""}:{},...o?{"data-disabled":"","aria-disabled":true}:{},...a!==void 0?{"aria-checked":a}:{},...u?{"aria-describedby":u}:{},...r?{title:r}:{},onMouseDown:B,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:m(n)}):null,u?jsxRuntime.jsx("span",{id:g,className:"docx-editor-sr-only",children:r}):null]})}function Hr({label:e,labelKey:t,className:n,hidden:o,children:r}){let a=De();if(o)return null;let i=e??(t===void 0?void 0:a(t));return jsxRuntime.jsxs("div",{role:"group",className:`docx-menubar__group${n?` ${n}`:""}`,...i?{"aria-label":i}:{},children:[i?jsxRuntime.jsx("div",{className:"docx-menubar__group-label","aria-hidden":"true",children:i}):null,r]})}function Bt({slot:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let{execute:a,isActive:i,isEnabled:l,disabledReason:c,value:s}=le(e),{setOpenMenu:d}=ot(),p=De();if(r)return null;let m=X(e),g=p(t??m?.labelKey??e),u=editor.chromeSlotIsToggle(e),f=editor.commandForSlot(e)?.type==="setAlignment";return jsxRuntime.jsx(Ne,{slot:e,icon:Q(m?.paths),...n?{shortcut:p(n)}:{},disabled:!l,...c?{title:c}:{},...u?{active:i}:{},...f?{selected:true}:{},...s!==null?{"data-value":s}:{},onSelect:()=>{a(),d(null);},...o?{className:o}:{},children:g})}Bt.docxMenuRow=true;function tf(e,t,n,o){return Object.assign(({className:a,hidden:i})=>{let l=ot(),c=De(),s=o(l);if(i)return null;let d=X(e),p=c(t??d?.labelKey??e);return jsxRuntime.jsx(Ne,{slot:e,icon:Q(d?.paths),...n?{shortcut:c(n)}:{},disabled:!s,onSelect:()=>{s?.(),l.setOpenMenu(null);},...a?{className:a}:{},children:p})},{docxSlot:e})}var pc=tf("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),mc=tf("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave);function oT({className:e,hidden:t}){let n=A(),o=ot(),r=De(),a=editor.chromeProbeForSlot("file.pageSetup"),i=n&&a?n.can(a):null,l=i?.ok===true,c=i&&!i.ok?i.reason:null;if(t)return null;let s=X("file.pageSetup"),d=r(s?.labelKey??"file.pageSetup"),p=l&&!!o.onPageSetup;return jsxRuntime.jsx(Ne,{slot:"file.pageSetup",icon:Q(s?.paths),disabled:!p,...c?{title:c}:{},onSelect:()=>{o.onPageSetup?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}function nT({className:e,hidden:t}){let n=A(),o=ot(),r=De(),a=editor.chromeProbeForSlot("paragraph.dialog"),i=n&&a?n.can(a):null,l=i?.ok===true,c=i&&!i.ok?i.reason:null;if(t)return null;let s=X("paragraph.dialog"),d=r(s?.labelKey??"lineSpacing.options"),p=l&&!!o.onParagraphDialog;return jsxRuntime.jsx(Ne,{slot:"paragraph.dialog",icon:Q(s?.paths),disabled:!p,...c?{title:c}:{},onSelect:()=>{o.onParagraphDialog?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}var rT=Object.assign(nT,{docxSlot:"paragraph.dialog"}),fc=Object.assign(oT,{docxSlot:"file.pageSetup"});function aT({className:e,hidden:t}){let n=Un(),o=ot(),r=De();if(t)return null;let a=X("image.insert"),i=r(a?.labelKey??"toolbar.image"),l=n?.isEnabled??false,c=n?.disabledReason??null;return jsxRuntime.jsx(Ne,{slot:"image.insert",icon:Q(a?.paths),disabled:!l,...c?{title:c}:{},onSelect:()=>{n?.openFilePicker(),o.setOpenMenu(null);},...e?{className:e}:{},children:i})}var gc=Object.assign(aT,{docxSlot:"image.insert"}),Ar=8;function kt({labelKey:e,paths:t,className:n,children:o}){let r=De(),[a,i]=nt.useState(false),l=nt.useRef(null),c=nt.useRef(null),s=nt.useId(),d=r(e),[p,m]=nt.useState(null);return nt.useLayoutEffect(()=>{if(!a){m(null);return}let g=l.current,u=c.current,f=g?.ownerDocument.defaultView;if(!g||!u||!f)return;let b=g.getBoundingClientRect(),x=u.offsetWidth,T=u.offsetHeight,h=b.right+x>f.innerWidth-Ar;m({left:h?Math.max(Ar,b.left-x):Math.min(b.right,f.innerWidth-x-Ar),top:Math.max(Ar,Math.min(b.top-4,f.innerHeight-T-Ar))});},[a]),jsxRuntime.jsxs("div",{role:"none",className:`docx-menubar__submenu${n?` ${n}`:""}`,onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),onKeyDown:g=>{g.key==="ArrowRight"&&document.activeElement===l.current?(g.preventDefault(),i(true),queueMicrotask(()=>{c.current&&vt(Io(c.current),"first");})):(g.key==="ArrowLeft"||g.key==="Escape")&&a&&(g.preventDefault(),g.stopPropagation(),i(false),l.current?.focus());},onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||i(false);},children:[jsxRuntime.jsxs("button",{ref:l,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?s:void 0,className:"docx-toolbar__menu-item docx-menubar__item",tabIndex:-1,...a?{"data-open":""}:{},onMouseDown:B,onFocus:()=>i(true),onClick:()=>i(true),children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:Q(t)}),jsxRuntime.jsx("span",{className:"docx-menubar__item-label",children:d}),jsxRuntime.jsx("span",{className:"docx-menubar__item-caret","aria-hidden":"true",children:"\u203A"})]}),a?jsxRuntime.jsx("div",{ref:c,id:s,className:"docx-toolbar__menu docx-menubar__menu docx-menubar__submenu-panel",role:"menu","aria-label":d,style:p?{position:"fixed",left:p.left,top:p.top}:{position:"fixed",visibility:"hidden"},onKeyDown:g=>{let u=c.current;if(!u)return;let f=Io(u);g.key==="ArrowDown"?(g.preventDefault(),g.stopPropagation(),ht(f,document.activeElement,1)):g.key==="ArrowUp"&&(g.preventDefault(),g.stopPropagation(),ht(f,document.activeElement,-1));},children:o}):null]})}function Ti({slot:e="table.insert",className:t}){let n=A(),{isEnabled:o}=le(e),{setOpenMenu:r}=ot(),a=De(),[i,l]=nt.useState(null),[c,s]=nt.useState({rows:1,cols:1}),d=nt.useRef(null),p=nt.useCallback((u,f)=>{if(!n||!o)return;let b={type:"insertTable",rows:u,cols:f};n.can(b).ok&&(n.exec(b),r(null),n.focus());},[n,o,r]),m=nt.useCallback(u=>{s(f=>{let b={rows:Math.min(Qm,Math.max(1,f.rows+(u.rows??0))),cols:Math.min(dc,Math.max(1,u.toCol??f.cols+(u.cols??0)))};return l(b),queueMicrotask(()=>d.current?.querySelector(`[data-cell="${b.rows}x${b.cols}"]`)?.focus()),b});},[]),g=[];for(let u=1;u<=Qm;u+=1){let f=[];for(let b=1;b<=dc;b+=1){let x=!!i&&u<=i.rows&&b<=i.cols;f.push(jsxRuntime.jsx("button",{type:"button",role:"gridcell","data-cell":`${u}x${b}`,className:"docx-menubar__grid-cell",tabIndex:c.rows===u&&c.cols===b?0:-1,...x?{"data-filled":""}:{},"aria-label":`${b} \xD7 ${u}`,onMouseDown:B,onMouseEnter:()=>l({rows:u,cols:b}),onFocus:()=>l({rows:u,cols:b}),onClick:()=>p(u,b)},b));}g.push(jsxRuntime.jsx("div",{role:"row",className:"docx-menubar__grid-row",children:f},u));}return jsxRuntime.jsxs("div",{ref:d,role:"grid","aria-label":a("toolbar.insertTable"),className:`docx-menubar__grid${t?` ${t}`:""}`,onMouseLeave:()=>l(null),onKeyDown:u=>{if(u.key==="ArrowRight")m({cols:1});else if(u.key==="ArrowLeft")m({cols:-1});else if(u.key==="ArrowDown")m({rows:1});else if(u.key==="ArrowUp")m({rows:-1});else if(u.key==="Home")m({toCol:1});else if(u.key==="End")m({toCol:dc});else return;u.preventDefault(),u.stopPropagation();},children:[jsxRuntime.jsx("div",{className:"docx-menubar__grid-cells",children:g}),jsxRuntime.jsx("div",{className:"docx-menubar__grid-caption","aria-hidden":"true",children:i?`${i.cols} \xD7 ${i.rows}`:""})]})}function iT({entry:e}){let{isEnabled:t}=le(e.slot),n=X(e.slot);return t?jsxRuntime.jsx(kt,{labelKey:e.labelKey??n?.labelKey??e.slot,paths:n?.paths,children:jsxRuntime.jsx(Ti,{slot:e.slot})}):jsxRuntime.jsx(Bt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function No({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function Or({entry:e}){return e.kind==="separator"?jsxRuntime.jsx(No,{}):e.kind==="submenu"?jsxRuntime.jsx(kt,{labelKey:e.labelKey,paths:e.paths,children:e.items.map((t,n)=>jsxRuntime.jsx(Or,{entry:t},n))}):e.slot==="file.open"?jsxRuntime.jsx(pc,{}):e.slot==="file.save"?jsxRuntime.jsx(mc,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(fc,{}):e.slot==="paragraph.dialog"?jsxRuntime.jsx(rT,{}):e.slot==="image.insert"?jsxRuntime.jsx(gc,{}):e.picker==="tableGrid"?jsxRuntime.jsx(iT,{entry:e}):jsxRuntime.jsx(Bt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function of(e){if(!nt.isValidElement(e))return null;let t=cn(e,of);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 lT(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function sT(e,t,n){return qa({entries:e??[],children:t,preset:n,keyOfEntry:lT,keyOfChild:of,renderEntry:o=>jsxRuntime.jsx(Or,{entry:o})})}function eo({id:e,labelKey:t,label:n,icon:o,className:r,hidden:a,preset:i=true,children:l}){let{openMenu:c,setOpenMenu:s,activeMenu:d}=ot(),p=De(),m=nt.useId(),g=nt.useRef(null),u=nt.useRef(null),f=nt.useRef(false),b=nt.useRef(false),x=editor.CHROME_MENUS.find(S=>S.id===e),T=c===e;if(a)return null;let h=n??p(t??x?.labelKey??e),v=sT(x?.entries,l,i),y=()=>{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":T,"aria-controls":T?m:void 0,className:"docx-menubar__trigger",tabIndex:d===e?0:-1,...T?{"data-open":""}:{},onMouseDown:B,onKeyDown:S=>{S.key==="ArrowDown"||S.key==="Enter"||S.key===" "||S.key==="ArrowUp"?(S.preventDefault(),f.current=true,s(e)):S.key==="Escape"&&T&&(S.preventDefault(),y());},onClick:()=>{if(b.current){b.current=false;return}s(T?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,h]}),T?jsxRuntime.jsx("div",{ref:S=>{u.current=S,S&&f.current&&(f.current=false,vt(Io(S),"first"));},id:m,role:"menu","aria-label":h,className:"docx-toolbar__menu docx-menubar__menu",onKeyDown:S=>{let w=u.current;if(!w)return;let C=Io(w),k=document.activeElement;S.key==="ArrowDown"?(S.preventDefault(),ht(C,k,1)):S.key==="ArrowUp"?(S.preventDefault(),ht(C,k,-1)):S.key==="Home"?(S.preventDefault(),vt(C,"first")):S.key==="End"?(S.preventDefault(),vt(C,"last")):S.key==="Escape"?(S.preventDefault(),S.stopPropagation(),y()):S.key==="Tab"&&s(null);},children:v}):null]})}function bc(e){return Object.assign(n=>jsxRuntime.jsx(eo,{id:e,...n}),{docxMenu:e})}var hc=bc("file"),vc=bc("format"),yc=bc("insert");function cT({className:e,hidden:t,onSelect:n}){let{setOpenMenu:o,onReportIssue:r,reportIssue:a}=ot(),i=De();if(t||a===false)return null;let l=n??r??Fr;return jsxRuntime.jsx(Ne,{slot:"help.reportIssue",onSelect:()=>{l(),o(null);},...e?{className:e}:{},children:i("toolbar.reportIssue")})}var Ci=Object.assign(cT,{docxSlot:"help.reportIssue"});function dT({children:e,...t}){let{reportIssue:n}=ot();return e===void 0&&n===false?null:jsxRuntime.jsxs(eo,{id:"help",...t,children:[jsxRuntime.jsx(Ci,{}),e]})}var xc=Object.assign(dT,{docxMenu:"help"});var mT=e=>e.hiddenReviewAuthors??[];function Pi({className:e,hidden:t}){let n=A(),o=rr(),r=O(mT),a=De(),{t:i}=D();if(t)return null;let l=a("reviewers.label"),c=editor.toolbarCommandState(n,"review.authors"),s=i18n.localizeDisabledReason(c.disabledReason,i);if(!c.enabled)return jsxRuntime.jsx(Ne,{disabled:true,title:s??void 0,slot:"review.authors",children:l});let d=new Set(r),p=o.every(m=>!d.has(m.author));return jsxRuntime.jsxs(kt,{labelKey:"reviewers.label",className:e,children:[jsxRuntime.jsx(nf,{checked:p,label:a("reviewers.all"),slot:"reviewer-all",onChoose:()=>n?.setAllReviewAuthorsVisible(!p)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),o.map(m=>jsxRuntime.jsx(nf,{checked:!d.has(m.author),label:m.author||"\u2014",slot:`reviewer-${m.slot}`,onChoose:()=>n?.setReviewAuthorVisible(m.author,d.has(m.author))},m.author))]})}function nf(e){return jsxRuntime.jsx(Ne,{active:e.checked,slot:e.slot,className:"docx-menubar__reviewer-item",icon:jsxRuntime.jsx("span",{className:"docx-menubar__reviewer-check",children:e.checked?"\u2713":""}),onSelect:e.onChoose,children:e.label})}function fT({children:e,...t}){return jsxRuntime.jsxs(eo,{id:"review",...t,children:[jsxRuntime.jsx(kt,{labelKey:"reviewers.markupOptions",className:"docx-menubar__markup-options",children:jsxRuntime.jsx(Pi,{className:"docx-menubar__reviewers-submenu"})}),e]})}var Ei=Object.assign(fT,{docxMenu:"review"});var hT={file:hc,format:vc,insert:yc,review:Ei,help:xc},vT=new Set(editor.CHROME_MENUS.map(e=>e.id));function pf(e){if(!nt.isValidElement(e))return null;if(e.type===nt.Fragment){let o=nt.Children.toArray(e.props.children).map(pf).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===eo){let n=e.props.id;if(typeof n=="string"&&vT.has(n))return n}return null}function yT(e){let t=tt(),{className:n,t:o,fileName:r,onOpen:a,onOpenFile:i,onSave:l,onPageSetup:c,onReportIssue:s,reportIssue:d,preset:p=true,children:m}=e,g=A(),{t:u}=D(),[f,b]=nt.useState(null),[x,T]=nt.useState(null),[h,v]=nt.useState(null),[y,S]=nt.useState(false),[w,C]=nt.useState(false),k=nt.useRef(null),R=nt.useRef(null);nt.useEffect(()=>{if(f===null)return;let V=ne=>{let re=k.current;re&&ne.target instanceof Node&&re.contains(ne.target)||b(null);},$=ne=>{ne.key==="Escape"&&b(null);};return document.addEventListener("mousedown",V),document.addEventListener("keydown",$),()=>{document.removeEventListener("mousedown",V),document.removeEventListener("keydown",$);}},[f]);let N=nt.useCallback(V=>{b(V),V!==null&&v(V);},[]),L=nt.useCallback(()=>R.current?.click(),[]),H=nt.useCallback(()=>{g&&g.save().then(V=>Ym(V,jm(r??x??void 0))).catch(V=>{console.error("[docx-editor] save failed",V);});},[g,r,x]),_=nt.useCallback(()=>S(true),[]),M=g?a??L:void 0,E=g?l??H:void 0,I=g?c??_:void 0;nt.useEffect(()=>{let V=$=>{if(!($.metaKey||$.ctrlKey)||$.altKey||$.shiftKey)return;let ne=$.key.toLowerCase();if(ne!=="s"&&ne!=="o")return;let re=$.target,be=fn(k.current)??k.current;!re||!be?.contains(re)||(ne==="s"&&E?($.preventDefault(),E()):ne==="o"&&M&&($.preventDefault(),M()));};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[M,E]);let ae=nt.useMemo(()=>({t:o,openMenu:f,setOpenMenu:N,activeMenu:h,onOpen:M,onSave:E,onPageSetup:I,onParagraphDialog:()=>C(true),onReportIssue:s,reportIssue:d}),[o,f,N,h,M,E,I,s,d]),z;if(!p)z=m;else {let V=new Map,$=[];for(let ne of nt.Children.toArray(m)){let re=pf(ne);re?V.set(re,ne):$.push(ne);}z=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[editor.CHROME_MENUS.map(ne=>{let re=V.get(ne.id);if(re)return jsxRuntime.jsx(nt.Fragment,{children:re},ne.id);let be=hT[ne.id];return jsxRuntime.jsx(be,{},ne.id)}),$]});}return jsxRuntime.jsxs(Lr.Provider,{value:ae,children:[jsxRuntime.jsx("div",{ref:V=>{if(k.current=V,V&&h===null){let $=Qs(V)[0]?.closest("[data-menu]")?.getAttribute("data-menu");$&&v($);}},role:"menubar","aria-label":o?.("titleBar.menuBarAriaLabel")??u("titleBar.menuBarAriaLabel"),"data-testid":"docx-menubar",className:`${t}docx-menubar${n?` ${n}`:""}`,onMouseDown:B,onKeyDown:V=>{if(V.key!=="ArrowLeft"&&V.key!=="ArrowRight")return;let $=k.current;if(!$)return;let ne=Qs($),re=ne.indexOf(document.activeElement);if(re===-1)return;V.preventDefault();let be=V.key==="ArrowRight"?1:-1,he=ne[(re+be+ne.length)%ne.length],U=he?.closest("[data-menu]")?.getAttribute("data-menu");U&&(v(U),he?.focus(),f!==null&&b(U));},children:z}),jsxRuntime.jsx("input",{ref:R,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:V=>{let $=V.target.files?.[0];V.target.value="",!(!$||!g)&&(T($.name),i?.($),$.arrayBuffer().then(ne=>g.load(new Uint8Array(ne))).catch(ne=>{console.error("[docx-editor] could not open the file",ne);}));}}),jsxRuntime.jsx(Nr,{open:y,onClose:()=>S(false)}),jsxRuntime.jsx(Ro,{open:w,onClose:()=>C(false)})]})}var Zr=Object.assign(yT,{Menu:eo,File:hc,Format:vc,Insert:yc,Review:Ei,Help:xc,Item:Bt,Row:Ne,Group:Hr,Separator:No,Submenu:kt,TableGrid:Ti,Entry:Or,Open:pc,Save:mc,PageSetup:fc,ImageInsert:gc,Reviewers:Pi,ReportIssue:Ci});var PT=12240,gf=1440,vf=1440,yf=567,Lo=20,Tc=6,Pc=Lo+Tc+2,ET="var(--doc-text-muted)",wT="var(--doc-text-subtle)",bf="var(--doc-shadow-subtle)",RT="var(--doc-primary)",kT="var(--doc-primary-hover)",MT="var(--doc-text-subtle)",Kr=5,qr=7,IT={left:0,right:0,firstLine:0};function hf(e,t){return t==="inch"?(e/vf).toFixed(2)+'"':(e/yf).toFixed(1)+" cm"}function _T(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function Fo({pageSetup:e,zoom:t=1,editable:n=false,onLeftMarginChange:o,onRightMarginChange:r,onMarginDragEnd:a,showIndentHandles:i=false,indent:l,indentEditable:c=false,onIndentChange:s,onIndentDragEnd:d,unit:p="inch",className:m="",style:g,tabMarks:u,onTabMarkRemove:f}){let{t:b}=D(),[x,T]=nt.useState(null),[h,v]=nt.useState(null),[y,S]=nt.useState(null),[w,C]=nt.useState(null),k=nt.useRef(null),R=e?.pageWidthTwips??PT,N=e?.marginsTwips.left??gf,L=e?.marginsTwips.right??gf,H=e?.gutterTwips??0,_={pageWidth:R,leftMargin:N,rightMargin:L},M=l??IT,E=Ee(R)*t,I=Ee(N)*t,ae=Ee(L)*t,z=nt.useCallback(Z=>{let Re=k.current?.getBoundingClientRect();return Re?ka((Z-Re.left)/t):null},[t]),V=nt.useCallback((Z,Re,ce)=>{let de=z(Re);if(de===null)return;if(C(Ee(de)*t),Z==="leftMargin"||Z==="rightMargin"){if(Z==="leftMargin"){let bo=R-L-H-720,pt=Math.round(Math.max(0,Math.min(de,bo)));S(pt),o?.(pt);}else {let bo=R-de,pt=R-N-H-720,ho=Math.round(Math.max(0,Math.min(bo,pt)));S(ho),r?.(ho);}return}let We=editor.dragIndent(Z,de,M,_,{unit:p,precise:ce});S(Z==="right"?We.right:Z==="firstLine"?We.firstLine:We.left),s?.(We);},[z,t,R,N,L,H,o,r,s,M,_,p]),$=nt.useCallback(Z=>{Z==="leftMargin"||Z==="rightMargin"?a?.():d?.(),T(null),S(null),C(null);},[a,d]),ne=nt.useCallback((Z,Re,ce)=>{let de=editor.handlePosition(Z,M,_),We=editor.dragIndent(Z,de+Re*_T(p,ce),M,_,{unit:p,precise:true});s?.(We),d?.();},[M,_,p,s,d]),re=HT(R,t,p),be=i&&c&&s!==void 0,he=Z=>Ee(editor.handlePosition(Z,M,_))*t,U=(Z,Re,ce)=>({positionPx:he(Z),editable:be,isDragging:x===Z,isHovered:h===Z,onPointerEnter:()=>v(Z),onPointerLeave:()=>v(null),onPointerDown:de=>{be&&(de.preventDefault(),de.stopPropagation(),de.currentTarget.setPointerCapture(de.pointerId),T(Z));},onPointerMove:de=>{x===Z&&V(Z,de.clientX,de.altKey);},onPointerUp:de=>{x===Z&&(de.currentTarget.releasePointerCapture(de.pointerId),$(Z));},onKeyDown:de=>{be&&(de.key!=="ArrowLeft"&&de.key!=="ArrowRight"||(de.preventDefault(),ne(Z,de.key==="ArrowLeft"?-1:1,de.shiftKey)));},label:b(Re),valueNow:ce,valueText:hf(ce,p),pageWidthTwips:R});return jsxRuntime.jsxs("div",{ref:k,className:`docx-horizontal-ruler ${m}`,style:{position:"relative",width:je(E),height:Pc,backgroundColor:"transparent",overflow:"visible",userSelect:"none",touchAction:"none",cursor:x?"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:je(I),height:Lo,backgroundColor:bf,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&o?Z=>{Z.preventDefault(),Z.currentTarget.setPointerCapture(Z.pointerId),T("leftMargin");}:void 0,onPointerMove:Z=>x==="leftMargin"&&V("leftMargin",Z.clientX,Z.altKey),onPointerUp:Z=>{x==="leftMargin"&&(Z.currentTarget.releasePointerCapture(Z.pointerId),$("leftMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:je(ae),height:Lo,backgroundColor:bf,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&r?Z=>{Z.preventDefault(),Z.currentTarget.setPointerCapture(Z.pointerId),T("rightMargin");}:void 0,onPointerMove:Z=>x==="rightMargin"&&V("rightMargin",Z.clientX,Z.altKey),onPointerUp:Z=>{x==="rightMargin"&&(Z.currentTarget.releasePointerCapture(Z.pointerId),$("rightMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:Lo,pointerEvents:"none"},children:re.map((Z,Re)=>jsxRuntime.jsx(DT,{tick:Z},Re))}),u?.map(Z=>jsxRuntime.jsx(AT,{tabMark:Z,positionPx:Ee(Z.position)*t,onDoubleClick:()=>f?.(Z.position)},Z.position)),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Sc,{direction:"down",anchor:"top",...U("firstLine","ruler.firstLineIndent",M.firstLine)}),jsxRuntime.jsx(Sc,{direction:"up",anchor:"strip",...U("hanging","ruler.hangingIndent",M.left)}),jsxRuntime.jsx(NT,{...U("left","ruler.leftIndent",M.left)}),jsxRuntime.jsx(Sc,{direction:"up",anchor:"strip",...U("right","ruler.rightIndent",M.right)})]}),x&&y!==null&&w!==null&&jsxRuntime.jsx(LT,{value:hf(y,p),positionPx:w})]})}function DT({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:je(e.position),bottom:0,width:1,height:e.height,backgroundColor:wT}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:je(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:ET,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function xf(e){return e.editable?e.isDragging||e.isHovered?kT:RT:MT}function Sf(e,t,n){return {position:"absolute",left:je(e.positionPx-t/2),width:t,cursor:e.editable?"ew-resize":"default",zIndex:e.isDragging?10:4,touchAction:"none",...n}}function Tf(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 Sc({direction:e,anchor:t,...n}){let o=xf(n),r=t==="top"?{top:0,height:qr+1}:{top:Lo-qr,height:qr};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:Sf(n,Kr*2,r),onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,onPointerDown:n.onPointerDown,onPointerMove:n.onPointerMove,onPointerUp:n.onPointerUp,onKeyDown:n.onKeyDown,...Tf(n),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${Kr}px solid transparent`,borderRight:`${Kr}px solid transparent`,...e==="down"?{top:0,borderTop:`${qr}px solid ${o}`}:{bottom:0,borderBottom:`${qr}px solid ${o}`},transition:"border-color 0.1s"}})})}function NT(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:Sf(e,Kr*2,{top:Lo+1,height:Tc}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...Tf(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:Kr*2-2,height:Tc,backgroundColor:xf(e),borderRadius:1,transition:"background-color 0.1s"}})})}function LT({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:je(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 FT={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function AT({tabMark:e,positionPx:t,onDoubleClick:n}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:je(t-5),top:Lo-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:FT[e.alignment]||"L"})}function HT(e,t,n){let o=[];if(n==="inch"){let r=vf/8,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let l=i*r;if(l>e)break;let c=Ee(l)*t;i%8===0?o.push({position:c,height:8,label:i/8>0?String(i/8):void 0}):i%4===0?o.push({position:c,height:5}):i%2===0?o.push({position:c,height:3}):o.push({position:c,height:2});}}else {let r=yf/10,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let l=i*r;if(l>e)break;let c=Ee(l)*t;i%10===0?o.push({position:c,height:8,label:i/10>0?String(i/10):void 0}):i%5===0?o.push({position:c,height:5}):o.push({position:c,height:3});}}return o}var ZT=15840,Ef=1440,qT=1440,KT=567,vn=20,zT="var(--doc-text-muted)",VT="var(--doc-text-subtle)",$T="var(--doc-primary)",WT="var(--doc-primary)",UT="var(--doc-primary-hover)";function zr({pageSetup:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,onMarginDragEnd:a,unit:i="inch",className:l="",style:c}){let{t:s}=D(),[d,p]=nt.useState(null),[m,g]=nt.useState(null),u=nt.useRef(null),f=e?.pageHeightTwips??ZT,b=e?.marginsTwips.top??Ef,x=e?.marginsTwips.bottom??Ef,T=Ee(f)*t,h=Ee(b)*t,v=Ee(x)*t,y=nt.useCallback((R,N)=>{n&&(R.preventDefault(),p(N));},[n]),S=nt.useCallback(R=>{if(!d||!u.current)return;let N=u.current.getBoundingClientRect(),L=R.clientY-N.top,H=ka(L/t);if(d==="topMargin"){let _=f-x-720,M=Math.max(0,Math.min(H,_));o?.(Math.round(M));}else if(d==="bottomMargin"){let _=f-H,M=f-b-720,E=Math.max(0,Math.min(_,M));r?.(Math.round(E));}},[d,t,f,b,x,o,r]),w=nt.useCallback(()=>{d!==null&&a?.(),p(null);},[d,a]);nt.useEffect(()=>{if(d)return document.addEventListener("mousemove",S),document.addEventListener("mouseup",w),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",w);}},[d,S,w]);let C=jT(f,t,i),k={position:"relative",width:vn,height:je(T),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ns-resize":"default",...c};return jsxRuntime.jsxs("div",{ref:u,className:`docx-vertical-ruler ${l}`,style:k,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:C.map((R,N)=>jsxRuntime.jsx(GT,{tick:R},N))}),jsxRuntime.jsx(wf,{type:"topMargin",position:h,editable:n,isDragging:d==="topMargin",isHovered:m==="topMargin",onMouseEnter:()=>g("topMargin"),onMouseLeave:()=>g(null),onMouseDown:R=>y(R,"topMargin")}),jsxRuntime.jsx(wf,{type:"bottomMargin",position:T-v,editable:n,isDragging:d==="bottomMargin",isHovered:m==="bottomMargin",onMouseEnter:()=>g("bottomMargin"),onMouseLeave:()=>g(null),onMouseDown:R=>y(R,"bottomMargin")})]})}function GT({tick:e}){let t={position:"absolute",top:je(e.position),right:0,height:1,width:e.width,backgroundColor:VT},n={position:"absolute",top:je(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:zT,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 wf({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:a,onMouseLeave:i,onMouseDown:l}){let{t:c}=D(),s=o?UT:r?WT:$T,d={position:"absolute",top:je(t-5),right:0,width:vn,height:10,cursor:n?"ns-resize":"default",zIndex:o?10:1},p={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:a,onMouseLeave:i,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:p})})}function jT(e,t,n){let o=[];if(n==="inch"){let r=qT/8,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let l=i*r;if(l>e)break;let c=Ee(l)*t;if(i%8===0){let s=i/8;o.push({position:c,width:10,label:s>0?String(s):void 0});}else i%4===0?o.push({position:c,width:6}):i%2===0?o.push({position:c,width:4}):o.push({position:c,width:2});}}else {let r=KT/10,a=Math.ceil(e/r);for(let i=0;i<=a;i++){let l=i*r;if(l>e)break;let c=Ee(l)*t;if(i%10===0){let s=i/10;o.push({position:c,width:10,label:s>0?String(s):void 0});}else i%5===0?o.push({position:c,width:6}):o.push({position:c,width:3});}}return o}var Ao=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var JT=e=>e.formatting?.indent??null,QT=e=>e.editable;function wc(){let e=A(),t=O(JT),n=O(QT),o=nt.useMemo(()=>n&&e!==null&&e.can({type:"setIndent",left:0}).ok,[e,n]),r=nt.useCallback(a=>e?e.exec({...a.left!==void 0?{left:a.left}:{},...a.right!==void 0?{right:a.right}:{},...a.firstLine!==void 0?{firstLine:a.firstLine}:{},type:"setIndent"}).ok:false,[e]);return nt.useMemo(()=>({indent:t,isEnabled:o,apply:r}),[t,o,r])}var _f=e=>e.zoom,tC=e=>e.isOpening===true;function Df(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function Nf(){let{apply:e}=_o(),[t,n]=nt.useState({}),o=nt.useRef({}),r=nt.useCallback(i=>l=>{o.current={...o.current,[i]:Math.round(l)},n(o.current);},[]),a=nt.useCallback(()=>{let i=o.current;o.current={},n({}),Object.keys(i).length!==0&&e({...i.top!==void 0?{marginTopTwips:i.top}:{},...i.right!==void 0?{marginRightTwips:i.right}:{},...i.bottom!==void 0?{marginBottomTwips:i.bottom}:{},...i.left!==void 0?{marginLeftTwips:i.left}:{},scope:"section"});},[e]);return {pending:t,preview:r,commit:a}}function If(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function oC(){let e=A(),{indent:t,isEnabled:n,apply:o}=wc(),[r,a]=nt.useState(null),i=nt.useRef(null),l=nt.useRef(null),c=nt.useCallback(p=>{l.current===null&&(l.current=If(e)),i.current=p,a(p);},[e]),s=nt.useCallback(()=>{let p=i.current,m=l.current;i.current=null,l.current=null,a(null),p&&(m!==null&&m!==If(e)||o({left:p.left,right:p.right,firstLine:p.firstLine}));},[e,o]),d=nt.useMemo(()=>r??(t?{left:t.left,right:t.right,firstLine:t.firstLine}:null),[r,t]);return nt.useMemo(()=>({indent:d,isEnabled:n,preview:c,commit:s}),[d,n,c,s])}function nC(){let e=At(),[t,n]=nt.useState(0);return nt.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 Ii(e){let t=O(Ao),n=O(tC),{pageSetup:o,isEnabled:r}=_o(),a=O(_f),{pending:i,preview:l,commit:c}=Nf(),s=oC(),d=Eo(),p=sn(),m=nC();return t?null:jsxRuntime.jsx("div",{className:`docx-ruler-frame${n?" docx-ruler-frame--opening":""}`,style:{paddingInlineStart:d+p.inlineStart,paddingRight:p.inlineEnd},children:jsxRuntime.jsx(Fo,{pageSetup:Df(o,i),zoom:a,editable:r,onLeftMarginChange:l("left"),onRightMarginChange:l("right"),onMarginDragEnd:c,showIndentHandles:s.indent!==null,indent:s.indent,indentEditable:s.isEnabled,onIndentChange:s.preview,onIndentDragEnd:s.commit,unit:e.unit??"inch",className:e.className??"",style:{...e.style,transform:`${e.style?.transform?`${e.style.transform} `:""}translateX(${-m}px)`,clipPath:d>0&&m>0?`inset(0 0 0 ${m}px)`:e.style?.clipPath}})})}function _i(e){let t=O(Ao),{pageSetup:n,isEnabled:o}=_o(),r=O(_f),{pending:a,preview:i,commit:l}=Nf(),c=Eo(),s=sn(),d=wu();return t||d!==null&&d>0&&n&&Ee(n.pageWidthTwips)*r>d-c-s.inlineStart-s.inlineEnd?null:jsxRuntime.jsx(zr,{pageSetup:Df(n,a),zoom:r,editable:o,onTopMarginChange:i("top"),onBottomMarginChange:i("bottom"),onMarginDragEnd:l,unit:e.unit??"inch",className:e.className??"",style:e.style})}function F({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 aC(e){return jsxRuntime.jsx(F,{...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 iC(e){return jsxRuntime.jsx(F,{...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 lC(e){return jsxRuntime.jsx(F,{...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 sC(e){return jsxRuntime.jsx(F,{...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 cC(e){return jsxRuntime.jsx(F,{...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 dC(e){return jsxRuntime.jsx(F,{...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 uC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function pC(e){return jsxRuntime.jsx(F,{...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 mC(e){return jsxRuntime.jsx(F,{...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 fC(e){return jsxRuntime.jsx(F,{...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 gC(e){return jsxRuntime.jsx(F,{...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 bC(e){return jsxRuntime.jsx(F,{...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 hC(e){return jsxRuntime.jsx(F,{...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 vC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function yC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function xC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function SC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function Ic(e){return jsxRuntime.jsx(F,{...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 TC(e){return jsxRuntime.jsx(F,{...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 CC(e){return jsxRuntime.jsx(F,{...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 PC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function EC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function wC(e){return jsxRuntime.jsx(F,{...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 RC(e){return jsxRuntime.jsx(F,{...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 kC(e){return jsxRuntime.jsx(F,{...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 MC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function IC(e){return jsxRuntime.jsx(F,{...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 _C(e){return jsxRuntime.jsx(F,{...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 DC(e){return jsxRuntime.jsx(F,{...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 NC(e){return jsxRuntime.jsx(F,{...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 LC(e){return jsxRuntime.jsx(F,{...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 Lf(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function FC(e){return jsxRuntime.jsx(F,{...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 AC(e){return jsxRuntime.jsx(F,{...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 HC(e){return jsxRuntime.jsx(F,{...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 OC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function BC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function ZC(e){return jsxRuntime.jsx(F,{...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 qC(e){return jsxRuntime.jsx(F,{...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 KC(e){return jsxRuntime.jsx(F,{...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 zC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function VC(e){return jsxRuntime.jsx(F,{...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 $C(e){return jsxRuntime.jsx(F,{...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 WC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function UC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function GC(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function jC(e){return jsxRuntime.jsx(F,{...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 YC(e){return jsxRuntime.jsx(F,{...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 XC(e){return jsxRuntime.jsx(F,{...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 JC(e){return jsxRuntime.jsx(F,{...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 QC(e){return jsxRuntime.jsx(F,{...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 eP(e){return jsxRuntime.jsx(F,{...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 tP(e){return jsxRuntime.jsx(F,{...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 oP(e){return jsxRuntime.jsx(F,{...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 nP(e){return jsxRuntime.jsx(F,{...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 rP(e){return jsxRuntime.jsx(F,{...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 aP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function iP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function lP(e){return jsxRuntime.jsx(F,{...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 sP(e){return jsxRuntime.jsx(F,{...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 cP(e){return jsxRuntime.jsx(F,{...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 dP(e){return jsxRuntime.jsx(F,{...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 uP(e){return jsxRuntime.jsx(F,{...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 pP(e){return jsxRuntime.jsx(F,{...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 mP(e){return jsxRuntime.jsx(F,{...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 fP(e){return jsxRuntime.jsx(F,{...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 gP(e){return jsxRuntime.jsx(F,{...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 bP(e){return jsxRuntime.jsx(F,{...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 hP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function vP(e){return jsxRuntime.jsx(F,{...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 yP(e){return jsxRuntime.jsx(F,{...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 xP(e){return jsxRuntime.jsx(F,{...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 SP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function TP(e){return jsxRuntime.jsx(F,{...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 CP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function PP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function EP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function wP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function RP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function kP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function MP(e){return jsxRuntime.jsx(F,{...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 IP(e){return jsxRuntime.jsx(F,{...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 _P(e){return jsxRuntime.jsx(F,{...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 DP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function NP(e){return jsxRuntime.jsx(F,{...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 LP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function FP(e){return jsxRuntime.jsx(F,{...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 AP(e){return jsxRuntime.jsx(F,{...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 HP(e){return jsxRuntime.jsx(F,{...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 OP(e){return jsxRuntime.jsxs(F,{...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 BP(e){return jsxRuntime.jsx(F,{...e,children:jsxRuntime.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function ZP(e){return jsxRuntime.jsx(F,{...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 qP(e){return jsxRuntime.jsx(F,{...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 KP(e){return jsxRuntime.jsx(F,{...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 zP(e){return jsxRuntime.jsx(F,{...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 VP(e){return jsxRuntime.jsx(F,{...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 $P(e){return jsxRuntime.jsx(F,{...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 WP(e){return jsxRuntime.jsx(F,{...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 UP(e){return jsxRuntime.jsx(F,{...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 GP(e){return jsxRuntime.jsx(F,{...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 jP={undo:aC,redo:iC,print:lC,file_download:sC,file_upload:cC,format_bold:dC,format_italic:uC,format_underlined:pC,strikethrough_s:mC,superscript:fC,subscript:gC,link:bC,format_clear:hC,format_align_left:vC,format_align_center:yC,format_align_right:xC,format_align_justify:SC,format_line_spacing:Ic,format_list_bulleted:TC,format_list_numbered:CC,format_indent_increase:PC,format_indent_decrease:EC,format_color_text:wC,ink_highlighter:RC,format_color_reset:kC,arrow_drop_down:MC,table:IC,table_chart:_C,grid_on:DC,table_rows:NC,view_column:LC,border_all:Lf,select_all:Lf,border_outer:FC,border_inner:AC,border_clear:HC,add:OC,remove:BC,delete:ZC,delete_sweep:qC,call_merge:KC,call_split:zC,drag_indicator:VC,image:$C,format_image_left:WC,format_image_right:UC,horizontal_rule:GC,flip_to_back:jC,flip_to_front:YC,open_with:XC,tune:JC,rotate_right:QC,rotate_left:eP,swap_horiz:tP,swap_vert:oP,shapes:nP,format_paint:rP,expand_more:aP,expand_less:iP,border_top:lP,border_bottom:sP,border_left:cP,border_right:dP,border_horizontal:uP,border_vertical:pP,padding:mP,text_rotation_none:fP,wrap_text:gP,height:bP,fit_width:hP,settings:vP,border_color:yP,format_color_fill:xP,vertical_align_top:SP,vertical_align_center:TP,vertical_align_bottom:CP,line_weight:PP,keyboard_arrow_up:EP,keyboard_arrow_down:wP,keyboard_arrow_left:RP,keyboard_arrow_right:kP,more_vert:MP,page_break:IP,branding_watermark:_P,arrow_back:DP,search:NP,toc:LP,done_all:FP,check_circle:AP,chat_bubble_outline:HP,chat_bubble_check:OP,check:BP,close:ZP,add_comment:qP,comment:KP,edit_note:zP,rate_review:VP,visibility:$P,format_textdirection_l_to_r:WP,format_textdirection_r_to_l:UP,"agent-sparkle":GP};function K({name:e,size:t=20,className:n="",style:o}){let r=jP[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 Vr=12,_c=240,Af=16,eE=24,tE=Vr+_c+Af,yn=12,oE=36,nE=yn+oE+Af,$r=nt__namespace.default.memo(function({headings:t,onHeadingClick:n,onClose:o,topOffset:r=0,scrollLeft:a=0,leftOffset:i=Vr}){let{t:l}=D(),[c,s]=nt.useState(false),d=t.length?Math.min(...t.map(p=>p.level)):0;return nt.useEffect(()=>{requestAnimationFrame(()=>s(true));},[]),jsxRuntime.jsxs("nav",{className:"docx-outline-nav",role:"navigation","aria-label":l("documentOutline.ariaLabel"),style:{position:"absolute",top:r,left:i-a,bottom:0,width:_c,paddingTop:eE,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:c?"translateX(0)":`translateX(-${i+_c}px)`,transition:"transform 0.15s ease-out"},onMouseDown:p=>p.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((p,m)=>jsxRuntime.jsx("div",{style:{marginLeft:(p.level-d)*16},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>n(p.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:p.text,children:p.text})},`${p.blockId}-${m}`))})]})});var iE=e=>e,lE=Object.freeze([]),sE=()=>{};function Dc(e){let t=A(),n=O(iE),o=nt.useMemo(()=>t&&!n.isLoading?t.getOutline():lE,[t,n]),r=nt.useCallback(a=>{if(!t)return;t.focus();let i={paragraphId:a,offset:0};t.exec({type:"setSelection",range:{anchor:i,head:i}}),t.scrollToBlock(a);},[t]);return Ao(n)?null:jsxRuntime.jsx($r,{headings:o,onHeadingClick:r,onClose:e.onClose??sE,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var Nc=nt.createContext(null);function no(e){let t=nt.useContext(Nc);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var xn=280,Di=32,Hf=16;function Oo(e=280){return 32+e+16}function Ni({viewportWidth:e,pageWidthPx:t,reservation:n,inlineEndReservation:o=0,inlineStartReservation:r=0,docked:a=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 i=(e-o-t)/2,l=i>=n?0:!a&&n<=2*i?2*(n-i):n;return Math.ceil(Math.max(0,l-r))}var fE=Object.freeze([]),gE=e=>e;function Li(){let e=A(),t=O(gE),[n,o]=nt.useState(null),r=nt.useMemo(()=>e&&!t.isLoading?e.getOutline():fE,[e,t]),a=nt.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]),i=nt.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:a,selectedBlockId:n,goTo:i,isEmpty:r.length===0}}var Ac=150,Hc=2e3,Fc=Object.freeze([]),vE=e=>e;function Fi(){let e=A(),t=O(vE),[n,o]=nt.useState(""),[r,a]=nt.useState(""),[i,l]=nt.useState(false),[c,s]=nt.useState(false),[d,p]=nt.useState(Fc),[m,g]=nt.useState(-1);nt.useEffect(()=>{if(n===r)return;let S=setTimeout(()=>a(n),Ac);return ()=>clearTimeout(S)},[n,r]);let u=nt.useMemo(()=>({matchCase:i,wholeWord:c}),[i,c]);nt.useEffect(()=>{if(!e||r.length===0){p(Fc),g(-1);return}let S=e.findMatches(r,u);p(w=>w===S?w:S);},[e,r,u,t]);let f=nt.useRef(d);nt.useEffect(()=>{f.current!==d&&(f.current=d,g(S=>S>=0&&S<d.length?S:-1));},[d]);let b=nt.useCallback(S=>{if(!e)return;let w=d[S];if(!w)return;e.focus(),e.selectMatch(w).ok&&g(S);},[e,d]),x=nt.useCallback(S=>{if(d.length===0)return;let C=((m<0?S>0?-1:0:m)+S+d.length)%d.length;b(C);},[m,b,d.length]),T=nt.useCallback(()=>x(1),[x]),h=nt.useCallback(()=>x(-1),[x]),v=nt.useCallback(S=>o(S),[]),y=nt.useCallback(()=>{o(""),a(""),p(Fc),g(-1);},[]);return {query:n,setQuery:v,matchCase:i,setMatchCase:l,wholeWord:c,setWholeWord:s,matches:d,truncated:d.length>=Hc,activeIndex:m,goTo:b,next:T,previous:h,clear:y,isPending:n!==r}}var PE=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)}},EE=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Ai(e={}){let{defaultOpen:t=false,defaultTab:n="headings",paneWidth:o=280}=e,[r,a]=nt.useState(t),[i,l]=nt.useState(n),c=e.open??r,s=e.tab??i,{onOpenChange:d,onTabChange:p}=e,m=e.open!==void 0,g=e.tab!==void 0,u=nt.useCallback(I=>{m||a(I),d?.(I);},[m,d]),f=nt.useCallback(()=>u(!c),[c,u]),b=nt.useCallback(I=>{g||l(I),p?.(I);},[g,p]),x=Po(),T=At(),h=nt.useContext(mt),{pageSetup:v,zoom:y,reviewPaneOpen:S,fitting:w}=O(PE,EE),[C,k]=nt.useState(0),[R,N]=nt.useState(0),[L,H]=nt.useState(0);nt.useEffect(()=>{if(!T){k(0),N(0),H(0);return}let I=()=>{k(T.clientWidth);let z=getComputedStyle(T),V=Number.parseFloat(z.paddingInlineEnd);N(Number.isFinite(V)?V:0);let $=Number.parseFloat(z.getPropertyValue("--docx-review-gutter-start"));H(Number.isFinite($)?$:0);};if(I(),typeof ResizeObserver>"u")return;let ae=new ResizeObserver(I);return ae.observe(T),()=>ae.disconnect()},[T,c,S,h?.mounted]);let _=nt.useRef(null);v&&(_.current=v.pageWidthTwips);let M=v?.pageWidthTwips??_.current,E=nt.useMemo(()=>!c||M===null?0:Ni({viewportWidth:C,pageWidthPx:Ee(M)*y,reservation:Oo(o),inlineEndReservation:R,inlineStartReservation:L,docked:w}),[c,M,y,C,o,R,L,w]);return nt.useEffect(()=>{if(x)return x.setShift(E),()=>x.setShift(0)},[x,E]),nt.useEffect(()=>{if(x)return x.setReservation(c?Oo(o):0),()=>x.setReservation(0)},[x,c,o]),{open:c,setOpen:u,toggle:f,tab:s,setTab:b,paneWidth:o,shift:E}}var Ur=["headings","find"],It=(...e)=>e.filter(Boolean).join(" ");function Gr({className:e,style:t,children:n}){return jsxRuntime.jsx("div",{className:It("docx-nav__header",e),style:t,children:n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(jr,{}),jsxRuntime.jsx(Yr,{})]})})}function jr({className:e,style:t,children:n}){let{pane:o,t:r}=no("Close");return jsxRuntime.jsx("button",{type:"button",className:It("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 Yr({className:e,style:t,children:n}){let{t:o}=no("Title");return jsxRuntime.jsx("h2",{className:It("docx-nav__title",e),style:t,children:n??o("navigation.title")})}function Xr({className:e,style:t,children:n}){let{pane:o,t:r}=no("Tabs"),a=nt.useCallback(i=>{let l=i.key==="ArrowRight"?1:i.key==="ArrowLeft"?-1:0;if(l===0)return;i.preventDefault();let c=Ur.indexOf(o.tab);o.setTab(Ur[(c+l+Ur.length)%Ur.length]);},[o]);return jsxRuntime.jsx("div",{className:It("docx-nav__tabs",e),style:t,role:"tablist","aria-label":r("navigation.title"),onKeyDown:a,children:n??Ur.map(i=>jsxRuntime.jsx(Jr,{value:i},i))})}function Jr({value:e,className:t,style:n,children:o}){let{pane:r,t:a}=no("Tab"),i=r.tab===e;return jsxRuntime.jsx("button",{type:"button",role:"tab",id:`docx-nav-tab-${e}`,"aria-selected":i,"aria-controls":`docx-nav-panel-${e}`,tabIndex:i?0:-1,className:It("docx-nav__tab",i&&"docx-nav__tab--selected",t),style:n,onClick:()=>r.setTab(e),children:o??a(`navigation.tabs.${e}`)})}function Bf({value:e,onChange:t,onClear:n,placeholder:o,label:r,clearLabel:a,autoFocus:i}){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:i,onChange:l=>t(l.target.value)}),e.length>0&&jsxRuntime.jsx("button",{type:"button",className:"docx-nav__search-clear","aria-label":a,onClick:n,children:jsxRuntime.jsx(K,{name:"close",size:16})})]})}function Qr({className:e,style:t}){let{pane:n,outline:o,t:r}=no("Headings"),[a,i]=nt.useState(""),l=O(Ao),c=nt.useMemo(()=>{let d=a.trim().toLowerCase();return d.length===0?o.items:o.items.filter(p=>p.heading.text.toLowerCase().includes(d))},[o.items,a]),s=n.tab!=="headings";return jsxRuntime.jsxs("div",{className:It("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-headings","aria-labelledby":"docx-nav-tab-headings",hidden:s,children:[jsxRuntime.jsx(Bf,{value:a,onChange:i,onClear:()=>i(""),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,p)=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:It("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}-${p}`))})]})}function ME({match:e,active:t,onSelect:n}){return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:It("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 ea({className:e,style:t}){let{pane:n,search:o,t:r}=no("Find"),a=n.tab!=="find",i=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:It("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-find","aria-labelledby":"docx-nav-tab-find",hidden:a,children:[jsxRuntime.jsx(Bf,{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:i?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(ME,{match:c,active:s===o.activeIndex,onSelect:()=>o.goTo(s)},`${c.blockId}-${c.start}-${s}`))})]})}function ta({className:e,style:t,children:n}){let{pane:o,t:r}=no("Toggle");return jsxRuntime.jsx("button",{type:"button",className:It("docx-nav__toggle",e),style:t,"aria-label":r("navigation.openAriaLabel"),"aria-expanded":o.open,title:r("navigation.openTitle"),onMouseDown:a=>a.preventDefault(),onClick:o.toggle,children:n??jsxRuntime.jsx(K,{name:"toc",size:20})})}function Zc(e){let t=tt(),{t:n,toggle:o=true,className:r,style:a,children:i,...l}=e,c=Ai(l),s=Li(),d=Fi(),{t:p}=D(),m=nt.useMemo(()=>({pane:c,outline:s,search:d,t:n??((u,f)=>p(u,f))}),[c,s,d,n,p]),g=e.paneWidth??280;return jsxRuntime.jsx(Nc.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":`${Oo(g)}px`,...a},children:[o!==false&&!c.open&&jsxRuntime.jsx(ta,{...typeof o=="object"?o:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":m.t("navigation.ariaLabel"),inert:!c.open,children:i??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Gr,{}),jsxRuntime.jsx(Xr,{}),jsxRuntime.jsx(Qr,{}),jsxRuntime.jsx(ea,{})]})})]})})}var Hi=Object.assign(Zc,{Header:Gr,Close:jr,Title:Yr,Tabs:Xr,Tab:Jr,Headings:Qr,Find:ea,Toggle:ta});var AE=600,HE=e=>e.page.total,Oi=nt.createContext(null);function Bi({className:e,style:t}){let n=tt(),o=A(),r=At(),a=O(HE),{t:i}=D(),l=nt.useContext(Oi),[c,s]=nt.useState(1),[d,p]=nt.useState(false);if(nt.useEffect(()=>{if(p(false),!o||!r||a<=1)return;s(o.getCurrentPage("viewport"));let g=null,u=()=>{s(o.getCurrentPage("viewport")),p(true),g&&clearTimeout(g),g=setTimeout(()=>p(false),AE);};return r.addEventListener("scroll",u,{passive:true}),()=>{r.removeEventListener("scroll",u),g&&clearTimeout(g);}},[o,a,r]),a<=1)return null;let m=l?l("viewer.pageIndicator").replace(/\{current\}/g,String(c)).replace(/\{total\}/g,String(a)):i("viewer.pageIndicator",{current:c,total:a});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 ZE=[],qE=e=>e.fontSubstitutions??ZE;function Zi({className:e,style:t,t:n}){let o=O(qE),{t:r}=D(),a=n??r,[i,l]=nt.useState(null);if(o.length===0)return null;let c=o.join("\0");return i===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:a("editor.fontSubstitutionNotice",{fonts:o.join(", ")}).replace("{fonts}",o.join(", "))}),jsxRuntime.jsx("button",{type:"button",className:"docx-font-notice__dismiss",onClick:()=>l(c),children:a("common.dismiss")})]})}var Je={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function qc(e){return Math.round(e/1440*100)/100}function zf(e){return Math.round(e*1440)}function VE(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 Kc(){let e=A(),t=nt.useCallback(n=>e?.getHeaderFooterState()??null,[e]);return O(t,VE)}function Cn(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 oa(e,t){let[n,o]=nt.useState(null),r=nt.useCallback(l=>o(l),[]),[a,i]=nt.useState({visibility:"hidden"});return nt.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,p=new ResizeObserver(()=>g()),m=()=>{s=0;let f=e(c);if(f!==d&&(p.disconnect(),p.observe(c),p.observe(n),f&&p.observe(f),d=f),!f||!f.isConnected){i({visibility:"hidden"});return}let b=f.getBoundingClientRect(),x=t==="story-label"?Math.max(n.offsetHeight,28):n.offsetHeight,T=t==="story-label"?6:4,h=l===c,v=t==="after"?b.bottom+6:b.top-x-T,y=h?Cn(c,b.left,v):{left:b.left,top:v},S=y.left,w=y.top,C=h?c.scrollLeft+8:8;i({position:h?"absolute":"fixed",left:t==="story-label"?S:Math.max(C,S+8),top:t==="story-label"?w:Math.max(h?c.scrollTop+8:8,w),...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));};p.observe(c),p.observe(n);let u=new MutationObserver(g);return u.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),p.disconnect(),u.disconnect(),c.removeEventListener("scroll",g),window.removeEventListener("resize",g);}},[n,e,t]),{ref:r,style:a}}function jE(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 YE=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function na(e){let t=A();return nt.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 XE(e){let{state:t,onMouseDown:n}=e,{t:o}=D(),r=A(),[a,i]=nt.useState(false),l=nt.useRef(null),[c,s]=nt.useState(""),[d,p]=nt.useState("");nt.useEffect(()=>{a&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(s(String(qc(t.headerDistanceTwips))),p(String(qc(t.footerDistanceTwips)))));},[a,t.headerDistanceTwips,t.footerDistanceTwips]),nt.useEffect(()=>{if(!a)return;let w=C=>{l.current?.contains(C.target)||i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[a]);let m=nt.useMemo(()=>({type:"setHeaderFooterOptions",titlePage:!t.titlePage}),[t.titlePage]),g=nt.useMemo(()=>({type:"setHeaderFooterOptions",evenAndOddHeaders:!t.evenAndOddHeaders}),[t.evenAndOddHeaders]),u=nt.useMemo(()=>({type:"linkHeaderFooterToPrevious"}),[]),f=nt.useMemo(()=>({type:"unlinkHeaderFooterFromPrevious"}),[]),b=nt.useMemo(()=>({type:"removeHeaderFooter",position:t.editing}),[t.editing]),x=na(m),T=na(g),h=na(u),v=na(f),y=na(b),S=(w,C)=>{if(!r)return;let k=Number.parseFloat(C);Number.isFinite(k)&&r.exec({type:"setHeaderFooterOptions",[w]:zf(k)});};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":a,"aria-haspopup":"menu",onClick:()=>i(w=>!w),onMouseDown:n,children:o("headerFooter.options")}),a?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:n,children:[YE.map(w=>{let C={type:"insertPageField",field:w.field},k=r?.can(C);return jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!k?.ok,title:k&&!k.ok?k.reason:void 0,onClick:()=>{r?.exec(C),i(false);},onMouseDown:n,children:o(w.labelKey)},w.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:!x.enabled,title:x.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:!T.enabled,title:T.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:!v.enabled,title:v.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:!h.enabled,title:h.reason??void 0,onClick:()=>r?.exec(u),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:w=>s(w.target.value),onBlur:()=>S("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:w=>p(w.target.value),onBlur:()=>S("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:!y.enabled,title:y.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"}),i(false);},onMouseDown:n,children:o("common.close")})]}):null]})}function qi({className:e}){let{t}=D(),n=Kc(),o=nt.useCallback(l=>l.querySelector("[data-docx-hf-active]"),[]),r=oa(o,"story-label"),a=B;if(!n?.editing)return null;let i=jE(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:a,style:{...r.style,zIndex:Je.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(i)}),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(XE,{state:n,onMouseDown:a})]})}function qo(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var Ki=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"})}),r1="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",a1="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",i1="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",l1="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 s1({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let a=_t(),i=nt.useRef(null),{state:l,close:c}=a;nt.useEffect(()=>{if(l.mode==="closed")return;let f=x=>{x.key==="Escape"&&(x.preventDefault(),c());},b=x=>{let T=i.current;T&&x.target instanceof Node&&T.contains(x.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]=nt.useState(null);nt.useLayoutEffect(()=>{let f=l.anchor,b=i.current;if(!f||!b){d(null);return}let x=b.offsetParent;if(!x){d(null);return}let{left:T,top:h}=Cn(x,f.left,f.top),v=Math.max(0,x.scrollWidth-b.offsetWidth);d({left:Math.max(0,Math.min(T,v)),top:h});},[l.anchor]);let{t:p}=D(),m=l.mode==="editing"?p(l.link?"hyperlinkPopup.editTitle":"hyperlinkPopup.insertTitle"):p("hyperlinkPopup.editLink"),g=r?jsxRuntime.jsx(c1,{children:o}):o;if(n)return l.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:o});let u={ref:i,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":l.mode,role:"dialog","aria-modal":false,onMouseDown:qo,style:s??void 0,"aria-label":m};return l.mode==="closed"?null:t?jsxRuntime.jsx(j,{...u,children:o}):jsxRuntime.jsx("div",{...u,children:g})}function c1({children:e}){let{state:t}=_t(),n=nt.useMemo(()=>d1(e),[e]),o=(a,i)=>a in n?n[a]:i;if(t.mode==="editing")return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Fields",jsxRuntime.jsx(jc,{})),o("Error",jsxRuntime.jsx(Xc,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Apply",jsxRuntime.jsx(Yc,{})),o("Cancel",jsxRuntime.jsx(Jc,{}))]}),n.__extra]});let r=t.canEdit&&!(t.link&&Xn(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Url",jsxRuntime.jsx($c,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Copy",jsxRuntime.jsx(Wc,{})),r?o("Edit",jsxRuntime.jsx(Uc,{})):null,r?o("Unlink",jsxRuntime.jsx(Gc,{})):null]}),n.__extra]})}function d1(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===nt.Fragment){o(r.props.children);return}let a=r.type.docxHyperLinkPart;a?t[a]=r:n.push(r);};return o(e),n.length>0&&(t.__extra=n),t}function _t(){return nt.useContext(Jn)??u1}var u1={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 $c({className:e,asChild:t,hidden:n,children:o}){let{state:r,openTarget:a}=_t(),{t:i}=D();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=i(l?"hyperlinkPopup.inertTarget":c?"hyperlinkPopup.bookmarkTarget":"hyperlinkPopup.openLink"),p={className:`docx-hyperlink-popup__url${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-url",...l?{"data-inert":""}:{},title:d,onMouseDown:qo,...l?{}:{onClick:()=>a(),type:"button"}};return t?jsxRuntime.jsx(j,{...p,children:o}):l?jsxRuntime.jsxs("span",{...p,children:[o??s,jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:d})]}):jsxRuntime.jsxs("button",{...p,children:[o??s,Ki(l1)]})}$c.docxHyperLinkPart="Url";function Wc({className:e,asChild:t,hidden:n,children:o,icon:r}){let{state:a,copy:i}=_t(),{t:l}=D();if(n||!a.link?.href)return null;let c=a.copied?l("editor.linkCopied"):l("hyperlinkPopup.copyLink"),s={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-copy",...a.copied?{"data-copied":""}:{},"aria-label":c,title:c,onMouseDown:qo,onClick:()=>{i();}};return t?jsxRuntime.jsx(j,{...s,children:o}):jsxRuntime.jsx("button",{...s,children:r??o??Ki(r1)})}Wc.docxHyperLinkPart="Copy";function Uc({className:e,asChild:t,hidden:n,children:o,icon:r}){let{beginEdit:a}=_t(),{t:i}=D();if(n)return null;let l=i("hyperlinkPopup.editLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-edit","aria-label":l,title:l,onMouseDown:qo,onClick:()=>a()};return t?jsxRuntime.jsx(j,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??Ki(a1)})}Uc.docxHyperLinkPart="Edit";function Gc({className:e,asChild:t,hidden:n,children:o,icon:r}){let{unlink:a}=_t(),{t:i}=D();if(n)return null;let l=i("hyperlinkPopup.removeLink"),c={type:"button",className:`docx-hyperlink-popup__action${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-unlink","aria-label":l,title:l,onMouseDown:qo,onClick:()=>a()};return t?jsxRuntime.jsx(j,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??Ki(i1)})}Gc.docxHyperLinkPart="Unlink";function jc({className:e,hidden:t}){let{state:n,setText:o,setUrl:r,commitEdit:a,close:i}=_t(),{t:l}=D(),c=nt.useRef(null),s=nt.useId(),d=nt.useId();nt.useEffect(()=>{n.mode==="editing"&&(c.current?.focus({preventScroll:true}),c.current?.select());},[n.mode]);let p=nt.useCallback(m=>{if(m.key==="Enter"){m.preventDefault(),a();return}m.key==="Escape"&&(m.preventDefault(),i());},[a,i]);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:p}),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:p})]})}jc.docxHyperLinkPart="Fields";function Yc({className:e,asChild:t,hidden:n,children:o}){let{state:r,commitEdit:a}=_t(),{t:i}=D();if(n)return null;let l=i("hyperlinkPopup.apply"),c={type:"button",className:`docx-hyperlink-popup__apply${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-apply",disabled:r.url.trim().length===0,onMouseDown:qo,onClick:()=>a()};return t?jsxRuntime.jsx(j,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:o??l})}function Xc({className:e,hidden:t}){let{state:n}=_t(),{t:o}=D();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")})}Xc.docxHyperLinkPart="Error";Yc.docxHyperLinkPart="Apply";function Jc({className:e,asChild:t,hidden:n,children:o}){let{close:r}=_t(),{t:a}=D();if(n)return null;let i=a("hyperlinkPopup.cancel"),l={type:"button",className:`docx-hyperlink-popup__cancel${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-cancel",onMouseDown:qo,onClick:()=>r()};return t?jsxRuntime.jsx(j,{...l,children:o}):jsxRuntime.jsx("button",{...l,children:o??i})}Jc.docxHyperLinkPart="Cancel";var zi=Object.assign(s1,{Url:$c,Copy:Wc,Edit:Uc,Unlink:Gc,Fields:jc,Error:Xc,Apply:Yc,Cancel:Jc});var g1=e=>e;function nd(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Vi(){let e=A(),{t}=D(),[n,o]=nt.useState(null),[r,a]=nt.useState(null),i=nt.useRef(null),l=nt.useRef(null),c=nt.useRef(null),s=nt.useId(),d=nt.useId(),p=nt.useId(),m=n?.activation??null,g=O(g1),u=nt.useMemo(()=>{if(!e?.surface||!m)return {replaceEnabled:false,removeEnabled:false,reason:null};let h=e.surface.equations.can(m.equation.id,"replace"),v=e.surface.equations.can(m.equation.id,"remove"),y=h.ok?v.ok?null:v.reason:h.reason;return {replaceEnabled:h.ok,removeEnabled:v.ok,reason:y?i18n.localizeDisabledReason(y,t):null}},[m,e,g,t]),f=nt.useCallback((h=false)=>{c.current?.(),c.current=null,o(null),h&&e&&queueMicrotask(()=>e.focus());},[e]);nt.useEffect(()=>{if(!e)return;let h=e.setEquationChrome({onPopover:v=>{c.current?.();let y=e.surface;if(y&&typeof y.retainSelection=="function"){let S=y.retainSelection();c.current=()=>y.releaseSelection(S);}else c.current=null;o({activation:v,mountGeneration:e.mountGeneration,draft:v.equation.linear,error:false});}});return ()=>{h(),c.current?.(),c.current=null,o(null);}},[e,f]),nt.useEffect(()=>{if(!n||!e?.surface)return;(e.mountGeneration!==n.mountGeneration||!e.surface.equations.equationById(n.activation.equation.id))&&f();},[e,g,n,f]),nt.useEffect(()=>{if(!n)return;let h=i.current,v=h?.ownerDocument,y=v?.defaultView;if(!h||!v||!y)return;let S=C=>{C.key==="Escape"&&(C.preventDefault(),f(true));},w=C=>{C.target instanceof y.Node&&h.contains(C.target)||f();};return v.addEventListener("keydown",S),v.addEventListener("pointerdown",w,true),()=>{v.removeEventListener("keydown",S),v.removeEventListener("pointerdown",w,true);}},[n,f]),nt.useLayoutEffect(()=>{if(!m){a(null);return}let h=i.current;if(!h)return;let v=h.offsetParent;if(!v){a(null);return}let y=m.rect,S=Cn(v,y.left,y.bottom),w=Math.max(0,v.scrollWidth-h.offsetWidth);a({left:Math.max(0,Math.min(S.left,w)),top:S.top}),l.current?.focus({preventScroll:true}),l.current?.select();},[m]);let b=nt.useCallback(()=>{if(!n||!e?.surface||!u.replaceEnabled)return false;let h=e.surface.equations.applyEquation(n.activation.equation.id,n.draft);return h?f(true):o(v=>v&&{...v,error:true}),h},[e,n,f,u.replaceEnabled]),x=nt.useCallback(()=>{if(!n||!e?.surface||!u.removeEnabled)return false;let h=e.surface.equations.removeEquation(n.activation.equation.id);return h?f(true):o(v=>v&&{...v,error:true}),h},[e,n,f,u.removeEnabled]);if(!n)return null;let T=[n.error?d:null,u.reason?p:null].filter(Boolean).join(" ");return jsxRuntime.jsxs("div",{ref:i,className:"docx-equation-popup","data-testid":"equation-popup",role:"dialog","aria-modal":false,"aria-label":t("equationPopup.title"),style:r??void 0,onMouseDown:nd,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:s,children:t("equationPopup.inputLabel")}),jsxRuntime.jsx("input",{id:s,ref:l,className:"docx-equation-popup__input","data-testid":"equation-popup-input",value:n.draft,placeholder:t("equationPopup.placeholder"),spellCheck:false,"aria-describedby":T||void 0,onChange:h=>o(v=>v&&{...v,draft:h.target.value,error:false}),onKeyDown:h=>{h.key!=="Enter"||h.nativeEvent.isComposing||(h.preventDefault(),b());}}),n.error?jsxRuntime.jsx("div",{id:d,className:"docx-equation-popup__error","data-testid":"equation-popup-error",role:"alert",children:t("equationPopup.refused")}):null,u.reason?jsxRuntime.jsx("div",{id:p,className:"docx-equation-popup__error","data-testid":"equation-popup-disabled-reason",role:"status",children:u.reason}):null,jsxRuntime.jsxs("div",{className:"docx-equation-popup__actions",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-equation-popup__apply","data-testid":"equation-popup-apply",disabled:!u.replaceEnabled,title:u.reason??void 0,onMouseDown:nd,onClick:b,children:t("equationPopup.apply")}),jsxRuntime.jsx("button",{type:"button",className:"docx-equation-popup__delete","data-testid":"equation-popup-delete",disabled:!u.removeEnabled,title:u.reason??void 0,onMouseDown:nd,onClick:x,children:t("equationPopup.delete")})]})]})}function b1(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 rd(){let e=A(),t=nt.useCallback(o=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),n=O(t,b1);return n?.kind==="note"?n:null}function Xf(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 Jf(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&&Xf(e.documentAuthored,t.documentAuthored)&&Xf(e.sectionAuthored,t.sectionAuthored)}function h1(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&Jf(e.footnote,t.footnote)&&Jf(e.endnote,t.endnote)}function ad(){let e=A(),t=nt.useCallback(n=>e?.getNotePropertiesState()??null,[e]);return O(t,h1)}var v1=/^(footnote|endnote):(-?\d{1,10})$/;function eg(e){let t=v1.exec(e);if(!t)return null;let n=Number(t[2]);return Number.isInteger(n)?{noteKind:t[1],noteId:n}:null}function y1(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function ld(e){let t=A();return nt.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 x1(e){let{t}=D(),[n,o]=nt.useState(false),r=nt.useRef(null);return nt.useEffect(()=>{if(!n)return;let a=i=>{r.current?.contains(i.target)||o(false);};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[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:B,onClick:()=>o(a=>!a),children:t("headerFooter.options")}),n?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:B,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 $i({className:e}){let{t}=D(),n=A(),o=rd(),[r,a]=nt.useState(null),[i,l]=nt.useState(null),[c,s]=nt.useState(false),d=nt.useRef(null),p=nt.useCallback(k=>{if(!o)return null;let N=[...k.querySelectorAll("[data-docx-note-scope]")].find(L=>L.matches("[data-docx-note]")&&L.dataset.docxNoteScope===o.id)??null;return N?.closest("[data-docx-notes]")??N},[o]),m=oa(p,"story-label"),g=nt.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=null,a(null);},[]);nt.useEffect(()=>{if(!n)return;let k=document.querySelector(".docx-pages");if(!k)return;let R=H=>{let _=H.target;if(!_)return;let M=_.closest("[data-docx-note-ref]");if(M?.dataset.docxNoteScope){H.preventDefault(),g(),l(null),n.setActiveScope({kind:"note",id:M.dataset.docxNoteScope});return}_.closest("[data-docx-note-mark-back]")&&(H.preventDefault(),g(),l(null),n.setActiveScope({kind:"body"}));},N=H=>{let _=H,E=_.target?.closest("[data-docx-note-scope]");E?.dataset.docxNoteScope&&(_.preventDefault(),l({scopeId:E.dataset.docxNoteScope,x:_.clientX,y:_.clientY}));},L=H=>{if(y1())return;let M=H.target?.closest("[data-docx-note-ref]");if(!M?.dataset.docxNoteScope){g();return}let E=M.dataset.docxNoteScope,ae=n.getNotePreviewText(E)??M.getAttribute("aria-description")??t("notes.previewFallback"),z=M.getBoundingClientRect();d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{a({scopeId:E,text:ae,x:z.left,y:z.bottom+4});},400);};return k.addEventListener("click",R),k.addEventListener("contextmenu",N),k.addEventListener("pointerover",L),k.addEventListener("scroll",g,true),()=>{k.removeEventListener("click",R),k.removeEventListener("contextmenu",N),k.removeEventListener("pointerover",L),k.removeEventListener("scroll",g,true),g();}},[n,g,t]);let u=nt.useCallback(k=>{n&&(n.exec(k),l(null));},[n]),f=i?eg(i.scopeId):null,b=nt.useMemo(()=>f?{type:"deleteNote",noteKind:f.noteKind,noteId:f.noteId}:null,[f]),x=nt.useMemo(()=>f?{type:"convertNote",fromKind:f.noteKind,noteId:f.noteId}:null,[f]),T=nt.useMemo(()=>f?{type:"convertAllNotes",fromKind:f.noteKind}:null,[f]),h=ld(b??{type:"deleteNote",noteKind:"footnote",noteId:0}),v=ld(x??{type:"convertNote",fromKind:"footnote",noteId:0}),y=ld(T??{type:"convertAllNotes",fromKind:"footnote"}),S=nt.useMemo(()=>({position:"fixed",left:r?.x??0,top:r?.y??0,zIndex:Je.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]),w=o?eg(o.id):null,C=w?t("notes.editingRegion",{kind:w.noteKind==="footnote"?t("notes.footnoteKind"):t("notes.endnoteKind"),number:w.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&&w?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:Je.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:C}),jsxRuntime.jsx(x1,{onOpenProperties:()=>s(true),onClose:()=>n.setActiveScope({kind:"body"})})]}):null,r?jsxRuntime.jsx("div",{role:"tooltip","data-testid":"docx-notes-preview",style:S,onMouseDown:k=>{k.preventDefault(),k.stopPropagation();},children:r.text}):null,i&&f?jsxRuntime.jsxs("div",{role:"menu","data-testid":"docx-notes-menu",style:{position:"fixed",left:i.x,top:i.y,zIndex:Je.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:B,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-delete",disabled:!h.enabled,title:h.reason??void 0,onClick:()=>b&&u(b),children:t("notes.delete")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert",disabled:!v.enabled,title:v.reason??void 0,onClick:()=>x&&u(x),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:!y.enabled,title:y.reason??void 0,onClick:()=>T&&u(T),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(S1,{onClose:()=>s(false),onApply:k=>{u(k),s(false);}}):null]}):null}function S1(e){let{t}=D(),n=A(),o=ad(),[r,a]=nt.useState("document"),[i,l]=nt.useState("decimal"),[c,s]=nt.useState("continuous"),[d,p]=nt.useState("pageBottom"),[m,g]=nt.useState("decimal"),[u,f]=nt.useState("continuous"),[b,x]=nt.useState("docEnd");nt.useEffect(()=>{o&&(l(o.footnote.resolved.numFmt),s(o.footnote.resolved.numRestart),p(o.footnote.resolved.pos),g(o.endnote.resolved.numFmt),f(o.endnote.resolved.numRestart),x(o.endnote.resolved.pos));},[o]);let T=!o?.footnote.documentAuthored&&!o?.footnote.sectionAuthored,h=!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:Je.modal},onClick:e.onClose,onKeyDown:v=>{v.key==="Escape"&&e.onClose();},children:jsxRuntime.jsxs("div",{className:"docx-note-properties__panel",onClick:v=>v.stopPropagation(),onMouseDown:v=>v.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:v=>a(v.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")}),T?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:i,onChange:v=>l(v.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:v=>s(v.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:v=>p(v.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")}),h?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:v=>g(v.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:u,onChange:v=>f(v.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:v=>x(v.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 v={type:"setNoteProperties",scope:r,sectionIndex:r==="section"?o?.sectionIndex:void 0,footnote:{numFmt:i,numRestart:c,position:d},endnote:{numFmt:m,numRestart:u,position:b}};n.can(v).ok&&e.onApply(v);},children:t("common.apply")})]})]})})}var Wi=nt.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function ro(){return nt.useContext(Wi)}function ng(){return nt.useContext(Wi).target}var rg=["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"],ag=["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"],cd=["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"],ig=["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"],lg=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],sg=["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"],cg=["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 wn(e,t,n){return Object.assign(({icon:r,labelKey:a,shortcutKey:i,className:l,hidden:c})=>{let s=A(),{close:d}=ro(),p=De(),{isEnabled:m,disabledReason:g}=le(t);return c?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??Q(n.paths),shortcut:p(i??n.shortcutKey),disabled:!m,...g?{title:g}:{},onSelect:()=>{s?.exec(t),d(true);},...l?{className:l}:{},children:p(a??n.labelKey)})},{docxRow:e})}var aa=wn("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:rg}),ia=wn("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:ag}),la=wn("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:ig}),sa=wn("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:cg});function Rn({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let a=A(),{close:i,clipboardRefusal:l,reportClipboardRefusal:c}=ro(),s=De(),d=nt.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:p,disabledReason:m}=le(d);if(r)return null;let g=l!==null;return jsxRuntime.jsx(Ne,{slot:"edit.paste",icon:e??Q(cd),shortcut:s(n??"contextMenu.pasteShortcut"),disabled:!p||g,...l??m?{title:l??m??""}:{},onSelect:()=>{(async()=>{try{let{text:u,html:f}=await P1();(u||f)&&a?.exec({type:"paste",text:u,...f?{html:f}:{}});}catch(u){c(u instanceof Error?u.message:"the clipboard is not readable");}finally{i(true);}})();},...o?{className:o}:{},children:s(t??"contextMenu.paste")})}Rn.docxRow="edit.paste";async function P1(){let e=navigator.clipboard;if(typeof e.read=="function"&&typeof ClipboardItem<"u")try{let t=await e.read(),n="",o=null;for(let r of t)r.types.includes("text/plain")&&(n=await(await r.getType("text/plain")).text()),r.types.includes("text/html")&&(o=await(await r.getType("text/html")).text());if(n||o)return {text:n,html:o}}catch{}return {text:await e.readText(),html:null}}function kn({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let a=A(),{close:i,clipboardRefusal:l,reportClipboardRefusal:c}=ro(),s=De(),d=nt.useMemo(()=>({type:"pasteWithoutFormatting",text:" "}),[]),{isEnabled:p,disabledReason:m}=le(d);if(r)return null;let g=l!==null;return jsxRuntime.jsx(Ne,{slot:"edit.pasteWithoutFormatting",icon:e??Q(cd),shortcut:s(n??"contextMenu.pasteWithoutFormattingShortcut"),disabled:!p||g,...l??m?{title:l??m??""}:{},onSelect:()=>{(async()=>{try{let u=await navigator.clipboard.readText();u&&a?.exec({type:"pasteWithoutFormatting",text:u});}catch(u){c(u instanceof Error?u.message:"the clipboard is not readable");}finally{i(true);}})();},...o?{className:o}:{},children:s(t??"contextMenu.pasteWithoutFormatting")})}kn.docxRow="edit.pasteWithoutFormatting";var dg=X("format.painter")?.paths??[],Ui=wn("format.copyFormatting",{type:"copyFormatting"},{labelKey:"contextMenu.copyFormatting",shortcutKey:"contextMenu.copyFormattingShortcut",paths:dg}),Gi=wn("format.pasteFormatting",{type:"pasteFormatting"},{labelKey:"contextMenu.pasteFormatting",shortcutKey:"contextMenu.pasteFormattingShortcut",paths:dg});function Ko(e,t,n){return Object.assign(({icon:r,labelKey:a,className:i,hidden:l,destructive:c})=>{let{close:s}=ro(),d=De(),p=ji(),{isEnabled:m,disabledReason:g,execute:u}=le(t);return l||!p?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??Q(n.paths),disabled:!m,...g?{title:g}:{},className:`${c??n.destructive?"docx-table-chrome__destructive-row":""}${i?` ${i}`:""}`,onSelect:()=>{u()&&s(true);},children:d(a??n.labelKey)})},{docxRow:e})}var Mn=Ko("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),In=Ko("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),_n=Ko("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),Dn=Ko("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),Nn=Ko("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),Ln=Ko("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),Fn=Ko("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),E1=[{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 zo({hidden:e}){let{close:t}=ro(),n=De(),o=ji(),r=le({type:"setTableCellVerticalAlignment",alignment:"top"}),a=le({type:"setTableCellVerticalAlignment",alignment:"center"}),i=le({type:"setTableCellVerticalAlignment",alignment:"bottom"}),l=[r,a,i];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:E1.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:p=>{p.preventDefault(),p.stopPropagation();},onClick:()=>{d.execute()&&t(true);},children:Q(editor.tableChromeIconPaths(c.icon))},c.alignment)})})]})}zo.docxRow="table.cellVerticalAlignment";function ug(e,t,n){return Object.assign(({icon:r,labelKey:a,className:i,hidden:l})=>{let c=A(),{close:s,tocId:d}=ro(),p=De(),m=nt.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:g,disabledReason:u}=le(m);return l||d===null?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??Q(n.paths),disabled:!g,...u?{title:u}:{},onSelect:()=>{c?.exec(m),s(true);},...i?{className:i}:{},children:p(a??n.labelKey)})},{docxRow:e})}var An=ug("toc.refresh","entire",{labelKey:"toc.refresh",paths:lg}),Hn=ug("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:sg});function ji(){return O(nt.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function Yi({label:e,icon:t,shortcut:n,disabled:o,disabledReason:r,active:a,onSelect:i,className:l}){let{close:c}=ro();return jsxRuntime.jsx(Ne,{...t?{icon:t}:{},...n?{shortcut:n}:{},...o?{disabled:o}:{},...o&&r?{title:r}:{},...a!==void 0?{active:a}:{},onSelect:()=>{i?.(),c(true);},...l?{className:l}:{},children:e})}var Qi=8,M1=e=>e.editingMode==="viewing";function I1(){let e=A(),t=nt.useContext(mt),n=ot(),o=De(),r=e?.can({type:"toggleReviewPane"}),a=O(M1),i=!r?.ok||a||(t?.mounted??0)===0||e?.getSelectionPlacement()===null,l=X("review.comments");return jsxRuntime.jsx(Ne,{icon:Q(l?.paths),slot:"review.comments",disabled:i,title:r&&!r.ok?r.reason:a?o("editingMode.viewingHint"):void 0,onSelect:()=>{t?.requestCommentDraft()&&n.setOpenMenu(null);},children:o("comments.addComment")})}var _1=[{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(aa,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(ia,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(Rn,{})},{kind:"row",id:"edit.pasteWithoutFormatting",render:()=>jsxRuntime.jsx(kn,{})},{kind:"row",id:"format.copyFormatting",render:()=>jsxRuntime.jsx(Ui,{})},{kind:"row",id:"format.pasteFormatting",render:()=>jsxRuntime.jsx(Gi,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(la,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(sa,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(Bt,{slot:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.comments",render:()=>jsxRuntime.jsx(I1,{})}];function D1(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:Mn.docxRow,render:()=>jsxRuntime.jsx(Mn,{})},{kind:"row",id:In.docxRow,render:()=>jsxRuntime.jsx(In,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:_n.docxRow,render:()=>jsxRuntime.jsx(_n,{})},{kind:"row",id:Dn.docxRow,render:()=>jsxRuntime.jsx(Dn,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:Nn.docxRow,render:()=>jsxRuntime.jsx(Nn,{})},{kind:"row",id:Ln.docxRow,render:()=>jsxRuntime.jsx(Ln,{})},{kind:"row",id:Fn.docxRow,render:()=>jsxRuntime.jsx(Fn,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:zo.docxRow,render:()=>jsxRuntime.jsx(zo,{})}]}function N1(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:An.docxRow,render:()=>jsxRuntime.jsx(An,{})},{kind:"row",id:Hn.docxRow,render:()=>jsxRuntime.jsx(Hn,{})}]}function L1(e,t=false){return [..._1,...e?D1():[],...t?N1():[]]}function bg(e){if(!nt.isValidElement(e))return null;let t=cn(e,bg);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 fg(e){if(!nt.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function F1(e){return e?.closest(".docx-editor__scroll-container")??null}function da({className:e,t,preset:n=true,disabled:o,onOpenChange:r,children:a}){let i=tt(),l=A(),{t:c}=D(),s=ji(),d=nt.useRef(null),p=nt.useRef(null),[m,g]=nt.useState(null),[u,f]=nt.useState(null),[b,x]=nt.useState(null),T=nt.useMemo(()=>L1(s,u!==null),[s,u]),[h,v]=nt.useState(null),y=nt.useCallback((H=false)=>{g(null),v(null),f(null),x(null),H&&l?.focus();},[l]);nt.useEffect(()=>{if(o)return;let H=F1(d.current);if(!H)return;let _=M=>{M.preventDefault();let E=M.button===-1||M.clientX===0&&M.clientY===0,I=H.getBoundingClientRect();f(l?.snapshot().tocContext?.id??null),x(E||!(M.target instanceof HTMLElement)?null:M.target),g(E?{x:I.left+16,y:I.top+16}:{x:M.clientX,y:M.clientY});};return H.addEventListener("contextmenu",_),()=>H.removeEventListener("contextmenu",_)},[o,l]),nt.useEffect(()=>{o&&y();},[o,y]),nt.useEffect(()=>{if(!m)return;let H=E=>{p.current?.contains(E.target)||y();},_=E=>{E.key==="Escape"?(E.preventDefault(),y(true)):E.key==="Tab"&&y();},M=()=>y();return document.addEventListener("pointerdown",H,true),document.addEventListener("keydown",_),document.addEventListener("scroll",M,{capture:true,passive:true}),window.addEventListener("blur",M),window.addEventListener("resize",M),()=>{document.removeEventListener("pointerdown",H,true),document.removeEventListener("keydown",_),document.removeEventListener("scroll",M,true),window.removeEventListener("blur",M),window.removeEventListener("resize",M);}},[m,y]),nt.useLayoutEffect(()=>{let H=p.current;if(!m||!H)return;let{width:_,height:M}=H.getBoundingClientRect(),E=window.innerWidth-_-Qi,I=window.innerHeight-M-Qi,ae=Math.max(Qi,m.x>E?m.x-_:m.x),z=Math.max(Qi,m.y>I?m.y-M:m.y);v({x:ae,y:z});},[m]),nt.useLayoutEffect(()=>{h&&p.current?.focus({preventScroll:true});},[h]);let S=nt.useRef(r);S.current=r;let w=nt.useRef(false);nt.useEffect(()=>{let H=m!==null;H!==w.current&&(w.current=H,S.current?.(H));},[m]);let C=nt.useMemo(()=>({t,openMenu:null,setOpenMenu:()=>y(true),activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onParagraphDialog:void 0,onReportIssue:void 0,reportIssue:void 0}),[t,y]),[k,R]=nt.useState(null),N=nt.useMemo(()=>({close:y,anchor:m,tocId:u,target:b,clipboardRefusal:k,reportClipboardRefusal:R}),[y,m,u,b,k]),L={position:"fixed",left:(h??m)?.x??0,top:(h??m)?.y??0,visibility:h?"visible":"hidden"};return jsxRuntime.jsx("div",{ref:d,style:{display:"contents"},children:m?jsxRuntime.jsx(Lr.Provider,{value:C,children:jsxRuntime.jsx(Wi.Provider,{value:N,children:jsxRuntime.jsxs("div",{ref:p,role:"menu","aria-label":t?.("contextMenu.ariaLabel")??c("contextMenu.ariaLabel"),tabIndex:-1,className:`${i}docx-toolbar__menu docx-contextmenu${e?` ${e}`:""}`,style:L,onKeyDown:H=>{let _=p.current;if(!_)return;let M=Io(_);H.key==="ArrowDown"?(H.preventDefault(),ht(M,document.activeElement,1)):H.key==="ArrowUp"?(H.preventDefault(),ht(M,document.activeElement,-1)):H.key==="Home"?(H.preventDefault(),vt(M,"first")):H.key==="End"&&(H.preventDefault(),vt(M,"last"));},children:[nt.Children.toArray(a).filter(fg),qa({entries:T,children:nt.Children.toArray(a).filter(H=>!fg(H)),preset:n,keyOfEntry:H=>H.id,keyOfChild:bg,renderEntry:H=>H.kind==="separator"?jsxRuntime.jsx(No,{}):H.render()})]})})}):null})}var pd=Object.assign(da,{Cut:aa,Copy:ia,Paste:Rn,PasteWithoutFormatting:kn,Delete:la,SelectAll:sa,InsertRowAbove:Mn,InsertRowBelow:In,InsertColumnLeft:_n,InsertColumnRight:Dn,DeleteTableRow:Nn,DeleteTableColumn:Ln,DeleteTable:Fn,CellVerticalAlignment:zo,RefreshToc:An,RefreshTocPageNumbers:Hn,Item:Yi,Slot:Bt,Row:Ne,Group:Hr,Separator:No,Submenu:kt});function md(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var vg=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"})}),B1="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",Z1="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",q1={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},K1={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},z1={color:"var(--doc-text-muted)",flexShrink:0},V1={textAlign:"right",wordBreak:"break-word"},$1={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},W1={display:"flex",gap:8,marginTop:4},yg={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 U1(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 G1(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 On({label:e,value:t,testId:n}){return jsxRuntime.jsxs("div",{style:K1,"data-testid":n,children:[jsxRuntime.jsx("span",{style:z1,children:e}),jsxRuntime.jsx("span",{style:V1,children:t})]})}function j1({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let a=Et(),i=nt.useRef(null),l=nt.useId(),{t:c}=D(),{control:s,inspectorOpen:d,closeInspector:p}=a;if(nt.useEffect(()=>{if(!d)return;let f=x=>{x.key==="Escape"&&(x.preventDefault(),p());},b=x=>{let T=i.current;T&&x.target instanceof Node&&T.contains(x.target)||p();};return document.addEventListener("keydown",f),document.addEventListener("mousedown",b,true),()=>{document.removeEventListener("keydown",f),document.removeEventListener("mousedown",b,true);}},[d,p]),nt.useEffect(()=>{d&&!s&&p();},[d,s,p]),n||!d||!s)return null;let m=r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(xg,{}),jsxRuntime.jsx(Sg,{}),jsxRuntime.jsx("div",{style:W1,children:jsxRuntime.jsx(Tg,{})}),o]}):o,g={ref:i,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:q1,onMouseDown:f=>{md(f),f.stopPropagation();}},u=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:u}):jsxRuntime.jsx("div",{...g,children:u})}function xg({className:e,asChild:t,hidden:n,children:o}){let{closeInspector:r}=Et(),{t:a}=D();if(n)return null;let i={style:$1,className:e??void 0,"data-testid":"content-control-inspector-header"},l=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:o??a("contentControl.inspectorPanel.title")}),jsxRuntime.jsx("button",{type:"button","data-testid":"content-control-inspector-close","aria-label":a("common.close"),title:a("common.close"),style:{...yg,padding:4,border:"none",background:"transparent"},onMouseDown:md,onClick:()=>r(),children:vg(B1)})]});return t?jsxRuntime.jsx(j,{...i,children:l}):jsxRuntime.jsx("div",{...i,children:l})}function Sg({className:e,asChild:t,hidden:n,children:o}){let{control:r}=Et(),{t:a}=D();if(n||!r)return null;let i=a("contentControl.inspectorPanel.empty"),l=a("contentControl.inspectorPanel.yes"),c=a("contentControl.inspectorPanel.no"),s=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(On,{label:a("contentControl.inspectorPanel.alias"),value:r.alias??i,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(On,{label:a("contentControl.inspectorPanel.tag"),value:r.tag??i,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(On,{label:a("contentControl.inspectorPanel.type"),value:a(U1(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(On,{label:a("contentControl.inspectorPanel.lock"),value:a(G1(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(On,{label:a("contentControl.inspectorPanel.placeholder"),value:r.placeholder?l:c,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(On,{label:a("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:a("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:a("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 Tg({className:e,asChild:t,hidden:n,icon:o,children:r}){let{canRemove:a,removeDisabledReason:i,remove:l,closeInspector:c}=Et(),{t:s}=D();if(n)return null;let d=s("contentControl.remove"),p={type:"button",className:`docx-content-control-inspector__remove${e?` ${e}`:""}`,"data-testid":"content-control-inspector-remove","data-slot":"contentControl.remove",disabled:!a,...a?{}:{"data-disabled":""},"aria-label":d,title:i??d,style:yg,onMouseDown:md,onClick:()=>{l().ok&&c();}},m=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o??r??vg(Z1),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(j,{...p,children:m}):jsxRuntime.jsx("button",{...p,children:m})}var el=Object.assign(j1,{Header:xg,Fields:Sg,Remove:Tg});var Q1={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},e2={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},t2={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},o2={flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",scrollbarGutter:"stable both-edges",backgroundColor:"var(--doc-bg)"},n2={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},r2={flex:"none",display:"flex",flexDirection:"column",position:"relative",zIndex:"var(--doc-z-overlay)",backgroundColor:"var(--doc-surface)",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:"var(--doc-border)",boxShadow:"0 1px 3px var(--doc-shadow-subtle)"},a2={padding:"8px 12px"},i2={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},l2={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},s2={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function c2({forwardedRef:e}){let t=A(),n=nt.useRef(null);return n.current=t,Iu({ref:e,editorRef:n}),null}var d2=nt.forwardRef(function(t,n){let{document:o,fonts:r,className:a,t:i,chrome:l=true,title:c,onTitleChange:s,renderTitleBarLeft:d,renderTitleBarRight:p,colorMode:m="light",author:g,locale:u,mode:f="edit",modules:b,zoom:x,zoomMode:T,onReady:h,onChange:v,onFontError:y,onOpen:S,onSave:w,hyperlinkPopup:C,contextMenu:k=true,menu:R=true,navigation:N=true,rulers:L=true}=t,[H,_]=nt.useState(Kd);nt.useEffect(()=>{if(m==="system")return Vd(_)},[m]);let M=zd(m,H),{t:E}=D(),I=nt.useCallback(($,ne)=>i?i($,ne):E($,ne),[i,E]),ae=jsxRuntime.jsxs(Fa,{className:l?M?"dark":void 0:a,style:l?e2:void 0,children:[l?jsxRuntime.jsx(qi,{}):null,l?jsxRuntime.jsx($i,{}):null,jsxRuntime.jsx(Ra,{}),jsxRuntime.jsx(zi,{hidden:C===false}),jsxRuntime.jsx(Vi,{}),k===false?null:jsxRuntime.jsx(da,{t:I,...typeof k=="object"?k:{}}),jsxRuntime.jsx(el,{}),L&&l?jsxRuntime.jsx("div",{style:n2,"aria-hidden":"true",children:jsxRuntime.jsx(_i,{})}):null,t.children]}),z=l?jsxRuntime.jsxs("div",{className:`docx-editor${M?" dark":""}${a?` ${a}`:""}`,style:Q1,children:[jsxRuntime.jsxs("div",{style:r2,children:[jsxRuntime.jsxs("div",{style:i2,children:[d?.(),jsxRuntime.jsxs("div",{style:l2,children:[s?jsxRuntime.jsx("input",{"aria-label":I("titleBar.documentNameAriaLabel"),value:c??"",placeholder:I("titleBar.untitled"),onChange:$=>s($.target.value),style:s2}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??I("titleBar.untitled")}),R!==false?jsxRuntime.jsx(Zr,{t:I,...c!==void 0?{fileName:c}:{},...S?{onOpen:S}:{},...w?{onSave:w}:{},...typeof R=="object"?R:{}}):null]}),p?.()]}),jsxRuntime.jsx("div",{style:a2,children:jsxRuntime.jsx(Dr,{t:I})})]}),L?jsxRuntime.jsx("div",{style:o2,"data-testid":"docx-editor-ruler-row",children:jsxRuntime.jsx(Ii,{})}):null,jsxRuntime.jsx(Zi,{t:I}),jsxRuntime.jsxs("div",{style:t2,children:[N?jsxRuntime.jsx(Hi,{t:I}):null,ae,jsxRuntime.jsx(Oi.Provider,{value:I,children:jsxRuntime.jsx(Bi,{})}),jsxRuntime.jsx(Ma,{overlay:true})]})]}):ae,V=nt.useCallback($=>I($),[I]);return jsxRuntime.jsxs(or,{...o!==void 0?{document:o}:{},...r?{fonts:r}:{},...g!==void 0?{author:g}:{},...u!==void 0?{locale:u}:{},translate:I,mode:f,...b!==void 0?{modules:b}:{},...x!==void 0?{zoom:x}:{},...T!==void 0?{zoomMode:T}:{},tableInteractionLabel:V,...h?{onReady:h}:{},...v?{onChange:v}:{},...y?{onFontError:y}:{},children:[jsxRuntime.jsx(c2,{forwardedRef:n}),jsxRuntime.jsx(wo.Provider,{value:l,children:z})]})}),u2=nt.forwardRef(function(t,n){return jsxRuntime.jsx(tn,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(d2,{...t,ref:n})})}),p2=Object.assign(u2,{Root:or,Viewport:Fa,Content:Ra,Toolbar:Dr,Menu:Zr,Loading:Ma,ColorByChangeType:zl,AuthorStyle:Vl,HorizontalRuler:Ii,VerticalRuler:_i,DocumentOutline:Dc,Navigation:Hi,PageSetupDialog:Nr,ParagraphDialog:Ro,PageNumber:Bi,FontNotice:Zi,HeaderFooterChrome:qi,NotesChrome:$i,Equation:Vi,HyperLink:zi,ContextMenu:pd,ContentControl:el});function h2(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function fd(e){return Array.isArray(e)?e:[e]}function v2(e){if(typeof e!="function"||editor.isFontResolver(e))return e;let t=e;return editor.defineFontResolver(async()=>t())}function wg(e){return e!==void 0&&fd(e).some(t=>editor.isFontResolver(t))}async function y2(e){return typeof e!="function"?await e:await e()}function x2(e,t={}){let[n,o]=nt.useState(void 0),[r,a]=nt.useState(void 0),[i,l]=nt.useState(null),[c,s]=nt.useState(e!=null),d=wg(t.fonts),p=t.fonts===void 0?"absent":d?"on-demand":"eager",[m,g]=nt.useState(t.fonts===void 0),u=nt.useRef(t);u.current=t;let f=nt.useMemo(()=>editor.defineFontResolver(b=>editor.composeFontOrigins(fd(u.current.fonts??[]).map(v2),b)),[]);return nt.useEffect(()=>{let b=u.current.fonts;if(b===void 0){a(void 0),g(true);return}if(wg(b)){g(true);return}g(false);let x=true;return (async()=>{try{let T=await Promise.allSettled(fd(b).map(y2)),h=[];for(let v of T){if(v.status==="rejected"){console.warn("[fonts] font loading failed for one origin; the others still compose",v.reason);continue}v.value!==void 0&&h.push(v.value);}x&&h.length>0&&a(editor.composeFontConfiguration(h[0],...h.slice(1)));}catch(T){console.warn("[fonts] font loading failed; the fixed measurer stays in effect",T);}finally{x&&g(true);}})(),()=>{x=false;}},[p]),nt.useEffect(()=>{if(e==null){o(void 0),l(null),s(false);return}let b=h2(e);if(b){o(b),l(null),s(false);return}let x=true,T=new AbortController;return s(true),l(null),(async()=>{try{let h=await fetch(String(e),{...u.current.fetchOptions,signal:T.signal});if(!h.ok)throw new Error(`could not open the document: ${h.status} ${h.statusText}`);let v=new Uint8Array(await h.arrayBuffer());if(!x)return;o(v),s(!1);}catch(h){if(!x||h instanceof Error&&h.name==="AbortError")return;l(h instanceof Error?h:new Error("could not open the document")),s(false);}})(),()=>{x=false,T.abort();}},[e]),{document:m?n:void 0,fonts:d?f:r,error:i,isLoading:c||!m}}function E2(...e){let t=nt.useRef(e);return t.current=e,nt.useMemo(()=>editor.defineFontResolver(n=>editor.composeFontOrigins(t.current,n)),[])}function k2(e){let n=e?.surface?.state?.().selection?.head;return n&&typeof n.paragraphId=="string"&&Number.isFinite(n.offset)?n:null}function M2(){let e=A(),t=nt.useRef(null),n=nt.useCallback(r=>{if(!e)return ()=>{};let a=e.on("selectionChange",r),i=e.on("change",r);return ()=>{a(),i();}},[e]),o=nt.useCallback(()=>{let r=k2(e),a=t.current;return (r===null?a===null:a!==null&&I2(a,r))?a:(t.current=r,r)},[e]);return nt.useSyncExternalStore(n,o,()=>null)}function I2(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}function gd({source:e,scale:t,measurer:n,onStateChange:o,onError:r,className:a,documentFontFamily:i,ref:l}){let c=nt.useRef(null),s=nt.useRef(null),[d,p]=nt.useState(null),m=nt.useRef(o);m.current=o;let g=nt.useRef(r);return g.current=r,nt.useEffect(()=>{let u=c.current;if(!u)return;let f=editor.mountPaginatedSurface(u,e,{...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onChange:x=>{p(x),m.current?.(x);}});if(!f.ok){g.current?.(f.reason,f.detail);return}s.current=f.surface;let b=f.surface.state();return p(b),m.current?.(b),()=>{f.surface.destroy(),s.current=null;}},[e,n]),nt.useImperativeHandle(l,()=>({focus:()=>s.current?.focus(),type:u=>s.current?.type(u),undo:()=>s.current?.undo(),redo:()=>s.current?.redo(),selectAll:()=>s.current?.selectAll(),navigate:(u,f)=>s.current?.navigate(u,f),toggleRunProperty:(u,f)=>s.current?.toggleRunProperty(u,f),setRunProperty:(u,f)=>s.current?.setRunProperty(u,f),setParagraphProperty:(u,f,b)=>s.current?.setParagraphProperty(u,f,b),formatting:()=>s.current?.formatting()??null,sectionProperties:()=>s.current?.sectionProperties()??null,save:()=>{let u=s.current;return u?(u.flushPendingInput(),u.session.save()):null}}),[]),jsxRuntime.jsx("div",{ref:c,style:{margin:"24px auto",...i?{fontFamily:i}:{}},className:a?`docx-paginated-surface ${a}`:"docx-paginated-surface","data-revision":d?.revision??0,"data-page-count":d?.pageCount??0})}var ma=nt.createContext(null);function Ig(){let e=nt.useContext(ma);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function B2(e){return "type"in e&&e.type==="separator"}var Ng={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"},Z2={...Ng,background:"var(--doc-bg-hover)"},Lg={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"},q2={...Lg,opacity:.4,cursor:"default"},K2={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},z2={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},V2={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 fa({label:e,items:t,disabled:n,showChevron:o=false}){let[r,a]=nt.useState(false),[i,l]=nt.useState(null),c=nt.useRef(null),s=nt.useRef(null),[d,p]=nt.useState({top:0,left:0}),m=nt.useCallback(()=>{a(false),l(null);},[]);nt.useEffect(()=>{if(!r||!c.current)return;let u=c.current.getBoundingClientRect();p({top:u.bottom+2,left:u.left});},[r]),nt.useEffect(()=>{if(!r)return;function u(x){let T=x.target;c.current&&!c.current.contains(T)&&s.current&&!s.current.contains(T)&&m();}function f(x){x.key==="Escape"&&m();}function b(){m();}return document.addEventListener("mousedown",u),document.addEventListener("keydown",f),window.addEventListener("scroll",b,true),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f),window.removeEventListener("scroll",b,true);}},[r,m]);let g=u=>{u.disabled||u.submenuContent||u.onClick&&(u.onClick(),m());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:c,type:"button",onClick:()=>!n&&a(!r),onMouseDown:u=>u.preventDefault(),disabled:n,style:r?Z2:Ng,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:u=>u.preventDefault(),children:t.map((u,f)=>{if(B2(u))return jsxRuntime.jsx("div",{style:K2},`sep-${f}`);let b=u;if(b.customContent)return jsxRuntime.jsx("div",{onMouseDown:h=>h.preventDefault(),children:b.customContent},b.label);let x=!!b.submenuContent,T=i===b.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>x&&l(b.label),onMouseLeave:()=>x&&l(null),children:[jsxRuntime.jsxs("button",{type:"button",style:b.disabled?q2:Lg,onClick:()=>g(b),onMouseDown:h=>h.preventDefault(),onMouseOver:h=>{b.disabled||(h.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:h=>{h.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:z2,children:b.shortcut}),x&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(K,{name:"keyboard_arrow_right",size:16})})]}),x&&T&&jsxRuntime.jsx("div",{style:V2,onMouseDown:h=>h.preventDefault(),children:b.submenuContent(m)})]},b.label)})})]})}var vd=18,W2=2,Ag={width:vd,height:vd,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},U2={...Ag,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},G2={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function Hg({onInsert:e,gridRows:t=6,gridColumns:n=6}){let[o,r]=nt.useState(0),[a,i]=nt.useState(0),l=nt.useCallback(()=>{o>0&&a>0&&e(o,a);},[o,a,e]),c=[];for(let d=1;d<=t;d++)for(let p=1;p<=n;p++){let m=d<=o&&p<=a;c.push(jsxRuntime.jsx("div",{style:m?U2:Ag,onMouseEnter:()=>{r(d),i(p);},onClick:l,role:"gridcell","aria-selected":m},`${d}-${p}`));}let s=o>0&&a>0?`${a} \xD7 ${o}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:W2,gridTemplateColumns:`repeat(${n}, ${vd}px)`},onMouseLeave:()=>{r(0),i(0);},role:"grid","aria-label":"Table size selector",children:c}),jsxRuntime.jsx("div",{style:G2,children:s})]})}function J2({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 Q2(){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 nl({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function ew(e){return e.replace(/\.docx$/i,"")}function xd({value:e,onChange:t,placeholder:n,editable:o=true}){let{t:r}=D(),a=n??r("titleBar.untitled"),i=ew(e)??"";return o?jsxRuntime.jsx("input",{type:"text",value:i,onChange:l=>{let c=l.target.value;t?.(c.endsWith(".docx")?c:c+".docx");},placeholder:a,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:i||a})}function rl({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function al(){let{t:e}=D(),t=Ig(),{disabled:n=false,onFormat:o,onPrint:r,onOpen:a,onSave:i,onPageSetup:l,onInsertImage:c,onInsertTable:s,showTableInsert:d=true,showHelpMenu:p=true,onInsertPageBreak:m,onInsertSectionBreakNextPage:g,onInsertSectionBreakContinuous:u,onInsertTOC:f,onWatermark:b,onRefocusEditor:x}=t,T=nt.useCallback(S=>{!n&&o&&o(S);},[n,o]),h=nt.useCallback((S,w)=>{!n&&s&&(s(S,w),requestAnimationFrame(()=>x?.()));},[n,s,x]),v=!!r||!!l,y=v||a||i;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[y&&jsxRuntime.jsx(fa,{label:e("toolbar.file"),disabled:n,items:[...a?[{icon:"file_upload",label:e("toolbar.open"),shortcut:e("toolbar.openShortcut"),onClick:a}]:[],...i?[{icon:"file_download",label:e("toolbar.save"),shortcut:e("toolbar.saveShortcut"),onClick:i}]:[],...(a||i)&&v?[{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(fa,{label:e("toolbar.format"),disabled:n,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>T("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>T("setRtl")}]}),jsxRuntime.jsx(fa,{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:S=>jsxRuntime.jsx(Hg,{onInsert:(w,C)=>{h(w,C),S();}})}]:[],...c||d&&s?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:S=>jsxRuntime.jsx(J2,{closeMenu:S,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:u}]})},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:f,disabled:!f},...b?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:b}]:[]]}),p&&jsxRuntime.jsx(fa,{label:e("toolbar.help"),disabled:n,items:[{label:e("toolbar.reportIssue"),onClick:()=>Fr()}]})]})}function Sd({children:e}){let t=null,n=null,o=[],r=[];nt.Children.forEach(e,i=>{nt.isValidElement(i)&&(i.type===nl?t=i:i.type===rl?n=i:i.type===al?r.push(i):o.push(i));});let a=nt.useCallback(i=>{let l=i.target;l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.tagName==="SELECT"||l.tagName==="OPTION"||i.preventDefault();},[]);return jsxRuntime.jsxs("div",{className:"flex items-stretch bg-doc-surface pt-2 pb-1",onMouseDown:a,"data-testid":"title-bar",children:[jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0 pl-3 pr-1",children:t||jsxRuntime.jsx(Q2,{})}),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 il={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},rw={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:""},Og={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 aw(e,t){let n=Og[t]??Og[t.toLowerCase()]??t,r=e?.colorScheme?.[n];return typeof r=="string"&&r?r:il[n]??"000000"}function Bg(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 Td(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex")return `#${Bg(e.value)??n}`;let o=Object.entries(t?.colorScheme??il).map(([a,i])=>({slot:a,hex:String(i)})),r=editor.resolveThemeColorHex(e,o);return `#${r.ok?r.hex:aw(t,e.slot)}`}function Kt(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?Bg(e.value):Td(e,t).slice(1)}function Zg(e){if(!e||e==="none")return "";let t=rw[e];return t?`#${t}`:""}var iw=[{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"}],lw=[{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 qg(e){let t=e??il;return lw.map(n=>iw.map(o=>{let r=t[o.slot]??il[o.slot]??"000000",i={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"?i.tint=n.keep:n.type==="shade"&&(i.shade=n.keep),i}))}function te(...e){return clsx.clsx(e)}var dw=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"}}),Oe=nt__namespace.forwardRef(({className:e,variant:t,size:n,...o},r)=>jsxRuntime.jsx("button",{className:te(dw({variant:t,size:n,className:e})),ref:r,...o}));Oe.displayName="Button";function ct({content:e,children:t,side:n="bottom",delayMs:o=400}){let[r,a]=nt__namespace.useState(false),[i,l]=nt__namespace.useState({x:0,y:0}),c=nt__namespace.useRef(null),s=nt__namespace.useRef(null),d=nt__namespace.useCallback(()=>{s.current=setTimeout(()=>{if(c.current){let u=c.current.getBoundingClientRect(),f=u.left+u.width/2,b=n==="top"?u.top-8:u.bottom+8;l({x:f,y:b});}a(true);},o);},[o,n]),p=nt__namespace.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),a(false);},[]);nt__namespace.useEffect(()=>()=>{s.current&&clearTimeout(s.current);},[]);let m=t.props,g=nt__namespace.cloneElement(t,{ref:c,onMouseEnter:u=>{d(),m.onMouseEnter?.(u);},onMouseLeave:u=>{p(),m.onMouseLeave?.(u);}});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:i.x,top:i.y,transform:n==="top"?"translate(-50%, -100%)":n==="bottom"?"translate(-50%, 0)":void 0},children:e})]})}var io=ye__namespace.Root,lo=ye__namespace.Group,ll=ye__namespace.Value;function so({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(ye__namespace.Trigger,{className:te("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(gw,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function co({className:e,children:t,position:n="popper",onCloseAutoFocus:o,...r}){let a=typeof document<"u"&&!!document.querySelector(".docx-editor.dark");return jsxRuntime.jsx(ye__namespace.Portal,{children:jsxRuntime.jsx("div",{className:te("docx-editor",a&&"dark"),children:jsxRuntime.jsx(ye__namespace.Content,{className:te("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:i=>{i.preventDefault(),o?.(i);},...r,children:jsxRuntime.jsx(ye__namespace.Viewport,{className:te("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),onMouseDown:i=>i.preventDefault(),children:t})})})})}function $o({className:e,...t}){return jsxRuntime.jsx(ye__namespace.Label,{className:te("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:te("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(bw,{className:"h-4 w-4"})})})]})}function Wo({className:e,...t}){return jsxRuntime.jsx(ye__namespace.Separator,{className:te("-mx-1 my-1 h-px bg-muted",e),...t})}function gw({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 bw({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 Cd(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 hw=[{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 Vg({value:e,onChange:t,fonts:n=hw,documentFonts:o,disabled:r=false,className:a,placeholder:i="Arial",width:l=120,showPreview:c=true}){let{t:s}=D(),d=nt__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]),p=nt__namespace.useMemo(()=>[...d,...n],[d,n]),m=nt__namespace.useMemo(()=>e?p.find(b=>b.fontFamily===e||b.name.toLowerCase()===e.toLowerCase()||Cd(b.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:i,[e,p,i]),g=nt__namespace.useCallback(f=>{let b=p.find(x=>x.name===f);b&&t?.(Cd(b.fontFamily)||b.name);},[t,p]),u=nt__namespace.useMemo(()=>{let f={"sans-serif":[],serif:[],monospace:[],other:[]};return n.forEach(b=>{let x=b.category||"other";f[x].push(b);}),f},[n]);return jsxRuntime.jsxs(io,{value:m,onValueChange:g,disabled:r,children:[jsxRuntime.jsx(so,{className:te("h-8 text-sm",a),style:{minWidth:typeof l=="number"?`${l}px`:l},"aria-label":s("font.selectAriaLabel"),children:jsxRuntime.jsx(ll,{placeholder:i,children:m})}),jsxRuntime.jsxs(co,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(lo,{children:[jsxRuntime.jsx($o,{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(Wo,{})]}),u["sans-serif"].length>0&&jsxRuntime.jsxs(lo,{children:[jsxRuntime.jsx($o,{children:s("font.sansSerif")}),u["sans-serif"].map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]}),u.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Wo,{}),jsxRuntime.jsxs(lo,{children:[jsxRuntime.jsx($o,{children:s("font.serif")}),u.serif.map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]})]}),u.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Wo,{}),jsxRuntime.jsxs(lo,{children:[jsxRuntime.jsx($o,{children:s("font.monospace")}),u.monospace.map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]})]}),u.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Wo,{}),jsxRuntime.jsx(lo,{children:u.other.map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))})]})]})]})}function Pd(e){if(e===void 0)return;let t=e.map(n=>typeof n=="string"?{name:n,fontFamily:n,category:"other"}:n);return t}function Sw(e,t,n,o){let a=Math.max(8,window.innerWidth-n-8),i=Math.max(8,window.innerHeight-o-8);return {top:Math.min(Math.max(8,e),i),left:Math.min(Math.max(8,t),a)}}function Qe({isOpen:e,onClose:t,align:n="left"}){let o=nt.useRef(null),r=nt.useRef(null),[a,i]=nt.useState({top:0,left:0});nt.useEffect(()=>{if(!e||!o.current)return;let s=o.current.getBoundingClientRect();n==="right"?requestAnimationFrame(()=>{if(r.current){let d=r.current.getBoundingClientRect(),p=Sw(s.bottom+4,s.right-d.width,d.width,d.height);i(p);}else i({top:s.bottom+4,left:s.left});}):i({top:s.bottom+4,left:s.left});},[e,n]),nt.useEffect(()=>{if(!e)return;let s=performance.now()+150,d=g=>{let u=g.target;o.current&&!o.current.contains(u)&&r.current&&!r.current.contains(u)&&t();},p=g=>{g.key==="Escape"&&t();},m=g=>{if(performance.now()<s)return;let u=g.target;u&&r.current&&r.current.contains(u)||u instanceof Element&&u!==document.documentElement&&u!==document.body&&o.current&&u.contains(o.current)||t();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",p),window.addEventListener("scroll",m,true),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",p),window.removeEventListener("scroll",m,true);}},[e,t]);let l=nt.useCallback(s=>{s.preventDefault(),s.stopPropagation();},[]),c={position:"fixed",top:a.top,left:a.left,zIndex:1e4};return {containerRef:o,dropdownRef:r,dropdownStyle:c,handleMouseDown:l}}var Pw=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Ew=1,ww=400;function Ug(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Gg(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 jg({value:e,onChange:t,sizes:n=Pw,disabled:o=false,className:r,placeholder:a="11",minSize:i=Ew,maxSize:l=ww}){let{t:c}=D(),[s,d]=nt.useState(false),[p,m]=nt.useState(""),[g,u]=nt.useState(false),f=nt.useRef(null),b=nt.useCallback(()=>{u(false),d(false);},[]),{containerRef:x,dropdownRef:T,dropdownStyle:h}=Qe({isOpen:g,onClose:b}),v=e??(parseInt(a,10)||11),y=e!==void 0?e.toString():a,S=nt.useCallback(_=>{if(_.preventDefault(),o)return;let M=Gg(v,n,i);t?.(M);},[v,n,i,o,t]),w=nt.useCallback(_=>{if(_.preventDefault(),o)return;let M=Ug(v,n,l);t?.(M);},[v,n,l,o,t]),C=nt.useCallback(_=>{_.preventDefault(),!o&&(d(true),m(y),u(true),requestAnimationFrame(()=>{f.current?.focus(),f.current?.select();}));},[o,y]),k=nt.useCallback(_=>{m(_.target.value);},[]),R=nt.useCallback(()=>{d(false);let _=parseFloat(p);if(!isNaN(_)&&_>=i&&_<=l){let M=Math.round(_*2)/2;t?.(M);}},[p,i,l,t]),N=nt.useCallback(_=>{if(_.key==="Enter")_.preventDefault(),R(),u(false);else if(_.key==="Escape")d(false),u(false);else if(_.key==="ArrowUp"){_.preventDefault();let M=Ug(v,n,l);m(M.toString()),t?.(M);}else if(_.key==="ArrowDown"){_.preventDefault();let M=Gg(v,n,i);m(M.toString()),t?.(M);}},[R,v,n,l,i,t]),L=nt.useCallback(_=>{t?.(_),u(false),d(false);},[t]),H=nt.useCallback(_=>{_.target.tagName!=="INPUT"&&_.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:x,className:te("flex items-center",r),onMouseDown:H,children:[jsxRuntime.jsx(Oe,{variant:"ghost",size:"icon-sm",className:te("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-r-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:S,disabled:o||v<=i,"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:p,onChange:k,onBlur:R,onKeyDown:N,className:te("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:C,className:te("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:y})}),g&&jsxRuntime.jsx("div",{ref:T,style:{...h,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(_=>jsxRuntime.jsx("button",{type:"button",onClick:()=>L(_),className:te("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",_===v&&"bg-muted font-medium"),role:"option","aria-selected":_===v,children:_},_))}),jsxRuntime.jsx(Oe,{variant:"ghost",size:"icon-sm",className:te("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:w,disabled:o||v>=l,"aria-label":c("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var Mw=[{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"}],cl=18,Iw=2,_w={position:"relative",display:"inline-block"},Dw={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)"},Nw={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},Rd={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},kd={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},Jg={display:"grid",gap:`${Iw}px`},dl={width:`${cl}px`,height:`${cl}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},Qg={...dl,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},e0={...dl,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},Lw={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)"},Fw={display:"flex",alignItems:"center",gap:"6px"},Aw={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},Hw={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},Yg={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},Ow={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},Bw={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)"},Zw={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 Md(e,t,n){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let o=Zg(e);return o||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return Td(e,n)}function Xg(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 t0(e,t,n){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():Kt(e,n))===t.toUpperCase():false}function qw({matrix:e,selectedColor:t,theme:n,onSelect:o}){let[r,a]=nt.useState(null);return jsxRuntime.jsx("div",{style:{...Jg,gridTemplateColumns:`repeat(10, ${cl}px)`},children:e.flatMap((i,l)=>i.map((c,s)=>{let d=`${l}-${s}`,p=r===d,m=t0(t,c.hex,n);return jsxRuntime.jsx("button",{type:"button",style:{...m?e0:p?Qg:dl,backgroundColor:`#${c.hex}`},title:c.label,"aria-label":c.label,"aria-selected":m,onClick:()=>o(c),onMouseDown:g=>g.preventDefault(),onMouseEnter:()=>a(d),onMouseLeave:()=>a(null)},d)}))})}function Kw({selectedColor:e,theme:t,onSelect:n}){let[o,r]=nt.useState(null),{t:a}=D();return jsxRuntime.jsx("div",{style:{...Jg,gridTemplateColumns:`repeat(10, ${cl}px)`},children:Mw.map((i,l)=>{let c=o===l,s=t0(e,i.hex,t),d=a(i.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...s?e0:c?Qg:dl,backgroundColor:`#${i.hex}`},title:d,"aria-label":d,"aria-selected":s,onClick:()=>n(i.hex),onMouseDown:p=>p.preventDefault(),onMouseEnter:()=>r(l),onMouseLeave:()=>r(null)},i.hex)})})}function jo({mode:e,value:t,onChange:n,theme:o,disabled:r=false,className:a,style:i,title:l,icon:c,autoLabel:s,splitButton:d=true,defaultColor:p}){let[m,g]=nt.useState(false),[u,f]=nt.useState(false),[b,x]=nt.useState(false),[T,h]=nt.useState(false),[v,y]=nt.useState(""),[S,w]=nt.useState(()=>p??(e==="highlight"?"FFFF00":e==="border"?{kind:"hex",value:"000000"}:{kind:"hex",value:"FF0000"})),{t:C}=D();nt.useEffect(()=>{let U=Md(t,e,o).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(U)&&y(U.toUpperCase());},[t,e,o]);let k=nt.useCallback(()=>g(false),[]),{containerRef:R,dropdownRef:N,dropdownStyle:L}=Qe({isOpen:m,onClose:k}),H=o?.colorScheme??null,_=nt.useMemo(()=>qg(H),[H]),M=nt.useMemo(()=>Md(t,e,o),[t,e,o]),E=nt.useMemo(()=>Md(S,e,o),[S,e,o]),I=nt.useCallback(()=>{r||g(U=>!U);},[r]),ae=nt.useCallback(U=>{let Z;e==="highlight"?Z=U.hex:Z={kind:"theme",slot:U.themeSlot,...U.tint!==void 0?{tint:U.tint}:{},...U.shade!==void 0?{shade:U.shade}:{}},w(Z),n?.(Z),g(false);},[e,n]),z=nt.useCallback(U=>{let Z=e==="highlight"?U:{kind:"hex",value:U};w(Z),n?.(Z),g(false);},[e,n]),V=nt.useCallback(()=>{n?.(e==="highlight"?"none":{kind:"auto"}),g(false);},[e,n]),$=nt.useCallback(()=>{let U=v.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(U)){let Z=e==="highlight"?U:{kind:"hex",value:U};w(Z),n?.(Z),g(false),y("");}},[e,v,n]),ne=nt.useCallback(()=>{r||n?.(S);},[r,S,n]),re={...Dw,...r?{cursor:"default",opacity:.38}:m?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:u?{backgroundColor:"var(--doc-bg-hover)"}:{}},be=C(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:R,className:`docx-color-picker ${a||""}`,style:{..._w,...i},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...Ow,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...Bw,...r?{cursor:"default"}:b?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:ne,onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>x(true),onMouseLeave:()=>x(false),disabled:r,title:l||be,"aria-label":l||be,children:[jsxRuntime.jsx(K,{name:he,size:18}),jsxRuntime.jsx("div",{style:{...Yg,backgroundColor:E==="transparent"?"#fff":E,outline:E==="transparent"||Xg(E)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...Zw,...r?{cursor:"default"}:m?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:T?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:I,onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(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:re,onClick:I,onMouseDown:U=>U.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:{...Yg,backgroundColor:M==="transparent"?"#fff":M,outline:M==="transparent"||Xg(M)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14})]}),m&&jsxRuntime.jsx("div",{ref:N,className:"docx-color-picker-dropdown",style:{...L,...Nw},role:"dialog","aria-label":`${be} picker`,onMouseDown:U=>{U.target.tagName!=="INPUT"&&U.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:Lw,onClick:V,onMouseDown:U=>U.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??C(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:kd}),jsxRuntime.jsx("div",{style:Rd,children:C("colorPicker.themeColors")}),jsxRuntime.jsx(qw,{matrix:_,selectedColor:t,theme:o,onSelect:ae}),jsxRuntime.jsx("div",{style:kd}),jsxRuntime.jsx("div",{style:Rd,children:C("colorPicker.standardColors")}),jsxRuntime.jsx(Kw,{selectedColor:t,theme:o,onSelect:z}),jsxRuntime.jsx("div",{style:kd}),jsxRuntime.jsx("div",{style:Rd,children:C("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:Fw,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:Aw,value:v,onChange:U=>y(U.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:U=>{U.key==="Enter"&&$();},onMouseDown:U=>{U.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...Hw,opacity:/^[0-9A-Fa-f]{6}$/.test(v)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(v)?"pointer":"default"},onClick:$,onMouseDown:U=>U.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(v),children:C("common.apply")})]})]})})]})}var ba=20,Id=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_left",size:ba}),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:ba}),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:ba}),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:ba}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function r0({value:e="left",onChange:t,disabled:n=false}){let{t:o}=D(),[r,a]=nt.useState(false),i=nt.useCallback(()=>a(false),[]),{containerRef:l,dropdownRef:c,dropdownStyle:s,handleMouseDown:d}=Qe({isOpen:r,onClose:i}),p=nt.useCallback(x=>{n||t?.(x),a(false);},[n,t]),m=Id.find(x=>x.value===e)||Id[0],g=o(m.labelKey),u=m.shortcutKey?o(m.shortcutKey):void 0,f=`${g}${u?` (${u})`:""}`,b=jsxRuntime.jsxs(Oe,{variant:"ghost",size:"icon-sm",className:te("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",n&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!n&&a(x=>!x),disabled:n,"aria-label":f,"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(K,{name:m.iconName,size:ba}),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:x=>x.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:Id.map(x=>{let T=e===x.value,h=o(x.labelKey),v=x.shortcutKey?o(x.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${h}${v?` (${v})`:""}`,"data-testid":`alignment-${x.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:T?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:T?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:y=>y.preventDefault(),onMouseEnter:y=>{T||(y.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:y=>{y.currentTarget.style.backgroundColor=T?"var(--doc-primary-light)":"transparent";},onClick:()=>p(x.value),children:jsxRuntime.jsx(K,{name:x.iconName,size:18})},x.value)})})})]})}function ul(){return {type:"none",level:0,isInList:false}}var Uw={display:"inline-flex",alignItems:"center",gap:"4px"},a0={display:"inline-flex",alignItems:"center",gap:"4px"},gl={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)"},Gw={...gl,backgroundColor:"var(--doc-bg-hover)"},jw={...gl,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},Yw={...gl,cursor:"default",opacity:.38},Xw={width:"28px",height:"28px",padding:"2px"},Jw={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},pl=20;function ml({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:a,style:i}){let[l,c]=nt.useState(false),s={...t?Yw:e?jw:l?Gw:gl,...i},d=p=>{p.preventDefault();};return jsxRuntime.jsx("button",{type:"button",className:`docx-list-button ${e?"docx-list-button-active":""} ${t?"docx-list-button-disabled":""} ${a||""}`,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 i0({listState:e,onBulletList:t,onNumberedList:n,onIndent:o,onOutdent:r,disabled:a=false,className:i,style:l,showIndentButtons:c=true,compact:s=false,hasIndent:d=false}){let{t:p}=D(),m=nt.useCallback(()=>s?{...Xw}:{},[s]),g=e?.type==="bullet",u=e?.type==="numbered",b=(e?.isInList||g||u)&&(e?.level??0)>0||d;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${i||""}`,style:{...Uw,...l},role:"group","aria-label":p("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:a0,role:"group","aria-label":p("lists.typeAriaLabel"),children:[jsxRuntime.jsx(ml,{active:g,disabled:a,title:p("lists.bulletList"),onClick:t,style:m(),children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:pl})}),jsxRuntime.jsx(ml,{active:u,disabled:a,title:p("lists.numberedList"),onClick:n,style:m(),children:jsxRuntime.jsx(K,{name:"format_list_numbered",size:pl})})]}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:Jw,role:"separator"}),jsxRuntime.jsxs("div",{style:a0,role:"group","aria-label":p("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(ml,{active:false,disabled:a||!b,title:p("lists.decreaseIndent"),onClick:r,style:m(),children:jsxRuntime.jsx(K,{name:"format_indent_decrease",size:pl})}),jsxRuntime.jsx(ml,{active:false,disabled:a,title:p("lists.increaseIndent"),onClick:o,style:m(),children:jsxRuntime.jsx(K,{name:"format_indent_increase",size:pl})})]})]})]})}var e8=[{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 s0({value:e,onChange:t,options:n=e8,disabled:o=false,className:r}){let{t:a}=D(),i=nt__namespace.useMemo(()=>e===void 0?n[0]:n.find(s=>s.twipsValue===e)||n[0],[e,n]),l=nt__namespace.useCallback(s=>{let d=parseInt(s,10);isNaN(d)||t?.(d);},[t]),c=s=>s.labelKey?a(s.labelKey):s.label;return jsxRuntime.jsxs(io,{value:i.twipsValue.toString(),onValueChange:l,disabled:o,children:[jsxRuntime.jsx(so,{className:te("h-8 text-sm gap-0.5 px-2",r),style:{width:"auto"},"aria-label":a("lineSpacing.label"),title:a("lineSpacing.lineSpacingTitle",{label:c(i)}),children:jsxRuntime.jsx(Ic,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(co,{children:[n.map(s=>jsxRuntime.jsx(dt,{value:s.twipsValue.toString(),children:c(s)},s.twipsValue)),jsxRuntime.jsx(Wo,{}),jsxRuntime.jsx(lo,{children:jsxRuntime.jsx($o,{children:a("lineSpacing.blockSpacingRules")})})]})]})}var c0=[{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 d0({value:e,onChange:t,styles:n,disabled:o=false,className:r,width:a=120}){let{t:i}=D(),l=nt__namespace.useMemo(()=>{let g=im(n);return g.length===0?c0:g.map(u=>({...u,type:"paragraph",nameKey:c0.find(f=>f.styleId===u.styleId)?.nameKey}))},[n]),c=nt__namespace.useCallback(g=>{t?.(g);},[t]),s=g=>g.nameKey?i(g.nameKey):g.name,d=e||"Normal",p=l.find(g=>g.styleId===d),m=p?s(p):d;return jsxRuntime.jsxs(io,{value:d,onValueChange:c,disabled:o,children:[jsxRuntime.jsx(so,{className:te("h-8 text-sm",r),style:{width:typeof a=="number"?`${a}px`:a},"aria-label":i("styles.selectAriaLabel"),children:jsxRuntime.jsx("span",{className:"truncate",children:m})}),jsxRuntime.jsx(co,{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:am(g),children:s(g)})},g.styleId))})]})}var o8=[{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 p0({value:e=1,onChange:t,levels:n=o8,disabled:o=false,className:r,compact:a=false}){let{t:i}=D(),l=nt__namespace.useMemo(()=>{let g=n.find(u=>Math.abs(u.value-e)<.001);return g?g.label:`${Math.round(e*100)}%`},[n,e]),c=nt__namespace.useCallback(g=>{let u=parseFloat(g);isNaN(u)||t?.(u);},[t]),s=nt__namespace.useMemo(()=>[...n].sort((g,u)=>g.value-u.value),[n]),d=nt__namespace.useMemo(()=>[...s].reverse().find(g=>g.value<e-.001),[s,e]),p=nt__namespace.useMemo(()=>s.find(g=>g.value>e+.001),[s,e]),m=a?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Oe,{variant:"ghost",size:"icon-sm",className:te(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":i("zoom.zoomOut"),children:jsxRuntime.jsx(K,{name:"remove",size:18})}),jsxRuntime.jsxs(io,{value:e.toString(),onValueChange:c,disabled:o,children:[jsxRuntime.jsx(so,{className:te(a?"h-7 min-w-[55px] text-xs":"h-8 min-w-[64px] text-sm","rounded-none",r),"aria-label":i("zoom.ariaLabel",{label:l}),children:jsxRuntime.jsx(ll,{placeholder:"100%",children:l})}),jsxRuntime.jsx(co,{children:n.map(g=>jsxRuntime.jsx(dt,{value:g.value.toString(),children:g.label},g.value))})]}),jsxRuntime.jsx(Oe,{variant:"ghost",size:"icon-sm",className:te(m,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(o||!p)&&"opacity-30 cursor-not-allowed"),onClick:()=>p&&t?.(p.value),disabled:o||!p,"aria-label":i("zoom.zoomIn"),children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var r8=[{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 g0({onAction:e,disabled:t=false}){let{t:n}=D(),[o,r]=nt.useState(false),a=nt.useCallback(()=>r(false),[]),{containerRef:i,dropdownRef:l,dropdownStyle:c,handleMouseDown:s}=Qe({isOpen:o,onClose:a}),d=nt.useCallback(m=>{e(m),r(false);},[e]),p=jsxRuntime.jsxs(Oe,{variant:"ghost",size:"icon-sm",className:te("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:i,style:{position:"relative",display:"inline-block"},children:[o?p:jsxRuntime.jsx(ct,{content:n("table.borders.tooltip"),children:p}),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:r8.map(({action:m,icon:g,labelKey:u})=>jsxRuntime.jsx("button",{type:"button",title:n(u),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 b0({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=D(),a=nt.useCallback(i=>{if(typeof i=="string"){e({type:"borderColor",color:i.replace(/^#/,"")});return}let l=i.kind==="auto"?"000000":Kt(i,n);l&&e({type:"borderColor",color:l});},[e,n]);return jsxRuntime.jsx(jo,{mode:"border",value:o,onChange:a,theme:n,disabled:t,title:r("table.borderColor")})}var s8=[{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 v0({onAction:e,disabled:t=false}){let[n,o]=nt.useState(false),{t:r}=D(),a=nt.useCallback(()=>o(false),[]),{containerRef:i,dropdownRef:l,dropdownStyle:c,handleMouseDown:s}=Qe({isOpen:n,onClose:a}),d=nt.useCallback(m=>{e({type:"borderWidth",size:m}),o(false);},[e]),p=jsxRuntime.jsxs(Oe,{variant:"ghost",size:"icon-sm",className:te("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:i,style:{position:"relative",display:"inline-block"},children:[n?p:jsxRuntime.jsx(ct,{content:r("table.borderWidth"),children:p}),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:s8.map(({size:m,label:g,thickness:u})=>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(u,1),backgroundColor:"#000",borderRadius:u>2?1:0}}),jsxRuntime.jsx("span",{children:g})]},m))})]})}function x0({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=D(),a=nt.useCallback(i=>{typeof i=="string"&&e(i==="none"?{type:"cellFillColor",color:null}:{type:"cellFillColor",color:i.replace(/^#/,"")});},[e]);return jsxRuntime.jsx("div",{"data-testid":"toolbar-table-cell-fill",style:{display:"inline-block"},children:jsxRuntime.jsx(jo,{mode:"highlight",value:o,onChange:a,theme:n,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var d8={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"},Jo={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},C0={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function P0({onAction:e,disabled:t=false,tableContext:n}){let{t:o}=D(),[r,a]=nt.useState(false),[i,l]=nt.useState(null),c=nt.useCallback(()=>a(false),[]),{containerRef:s,dropdownRef:d,dropdownStyle:p,handleMouseDown:m}=Qe({isOpen:r,onClose:c,align:"right"}),g=n?.table?.attrs?.justification??"left",u=nt.useCallback(x=>{e(x),a(false);},[e]),f=(x,T,h,v,y)=>{let S=t||y?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...d8,backgroundColor:i===x&&!S?"var(--doc-bg-hover)":"transparent",color:S?"var(--doc-text-muted)":y?.danger?"var(--doc-error)":"var(--doc-text)",cursor:S?"not-allowed":"pointer"},onClick:()=>!S&&u(v),onMouseEnter:()=>l(x),onMouseLeave:()=>l(null),disabled:S,children:[jsxRuntime.jsx(K,{name:T,size:16,className:y?.danger&&!S?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:h})]},x)},b=jsxRuntime.jsx(Oe,{variant:"ghost",size:"icon-sm",className:te("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:m,onClick:()=>!t&&a(x=>!x),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:{...p,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:x=>x.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:Jo,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:Jo,role:"separator"}),f("selectTable","select_all",o("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:Jo,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:Jo,role:"separator"}),jsxRuntime.jsx("div",{style:C0,children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(x=>{let T={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"}[x]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:v=>v.preventDefault(),onMouseEnter:v=>{v.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent";},onClick:()=>u({type:"cellVerticalAlign",align:x}),children:jsxRuntime.jsx(K,{name:T[x],size:16})},x)})}),jsxRuntime.jsx("div",{style:Jo,role:"separator"}),jsxRuntime.jsx("div",{style:C0,children:o("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(x=>{let T={left:"format_align_left",center:"format_align_center",right:"format_align_right"},h=g===x;return jsxRuntime.jsx("button",{type:"button",title:o({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[x]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:h?"var(--doc-primary-light)":"transparent",borderColor:h?"var(--doc-primary)":"var(--doc-border)",color:h?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:v=>v.preventDefault(),onClick:()=>u({type:"tableProperties",props:{justification:x}}),children:jsxRuntime.jsx(K,{name:T[x],size:16})},x)})}),jsxRuntime.jsx("div",{style:Jo,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:Jo,role:"separator"}),f("properties","settings",o("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var p8=20;function vl({options:e,activeValue:t,triggerIcon:n,tooltipContent:o,onSelect:r,disabled:a=false,ariaLabel:i,testId:l,showLabels:c=false}){let[s,d]=nt.useState(false),p=nt.useCallback(()=>d(false),[]),{containerRef:m,dropdownRef:g,dropdownStyle:u,handleMouseDown:f}=Qe({isOpen:s,onClose:p}),b=nt.useCallback(T=>{a||r(T),d(false);},[a,r]),x=jsxRuntime.jsxs(Oe,{variant:"ghost",size:"icon-sm",className:te("text-muted-foreground hover:text-foreground hover:bg-muted/80",s&&"bg-muted",a&&"opacity-30 cursor-not-allowed"),onMouseDown:f,onClick:()=>!a&&d(T=>!T),disabled:a,"aria-label":i??o,"aria-expanded":s,"aria-haspopup":"true","data-testid":l,children:[jsxRuntime.jsx(K,{name:n,size:p8}),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?x:jsxRuntime.jsx(ct,{content:o,children:x}),s&&!a&&jsxRuntime.jsx("div",{ref:g,style:{...u,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:T=>T.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:c?"column":"row",gap:c?1:2,minWidth:c?200:void 0},children:e.map(T=>{let h=t===T.value;return jsxRuntime.jsxs("button",{type:"button",title:T.label,"data-testid":l?`${l}-${T.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:h?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:h?"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:v=>v.preventDefault(),onMouseEnter:v=>{h||(v.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=h?"var(--doc-primary-light)":"transparent";},onClick:()=>b(T.value),children:[jsxRuntime.jsx(K,{name:T.iconName,size:18}),c&&jsxRuntime.jsx("span",{style:{flex:1},children:T.label})]},T.value)})})})]})}var m8=[{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 f8(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function w0({imageContext:e,onChange:t,disabled:n=false}){let{t:o}=D(),r=m8.map(l=>({...l,label:o(l.labelKey)})),a=f8(e),i=r.find(l=>l.value===a)||r[0];return jsxRuntime.jsx(vl,{options:r,activeValue:a,triggerIcon:i.iconName,tooltipContent:`Wrap: ${i.label}`,onSelect:t,disabled:n,testId:"toolbar-image-wrap",showLabels:true})}var b8=[{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 R0({onTransform:e,disabled:t=false}){let{t:n}=D(),o=b8.map(r=>({...r,label:n(r.labelKey)}));return jsxRuntime.jsx(vl,{options:o,triggerIcon:"rotate_right",tooltipContent:n("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var St=18;function ut({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:a,ariaLabel:i}){let l=i?.toLowerCase().replace(/\s+/g,"-")||n?.toLowerCase().replace(/\s+/g,"-").replace(/\([^()]*\)/g,"").trim(),c=d=>{d.preventDefault();},s=jsxRuntime.jsx(Oe,{variant:"ghost",size:"icon-sm",className:te("docx-editor-toolbar-toggle text-muted-foreground",t&&"opacity-30 cursor-not-allowed",a),"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":i||n,"data-testid":l?`toolbar-${l}`:void 0,children:r});return n?jsxRuntime.jsx(ct,{content:n,children:s}):s}function Tt({label:e,children:t,className:n}){return jsxRuntime.jsx("div",{className:te("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 S8(e){let t=nt__namespace.default.useContext(ma);return t?{...t,...T8(e)}:e}function T8(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function Ld(e){let{t}=D(),n=S8(e),{currentFormatting:o={},onFormat:r,onUndo:a,onRedo:i,canUndo:l=false,canRedo:c=false,disabled:s=false,className:d,style:p,enableShortcuts:m=true,editorRef:g,children:u,showFontPicker:f=true,fontFamilies:b,documentFonts:x,showFontSizePicker:T=true,showTextColorPicker:h=true,showHighlightColorPicker:v=true,showAlignmentButtons:y=true,showListButtons:S=true,showLineSpacingPicker:w=true,showStylePicker:C=true,documentStyles:k,theme:R,showZoomControl:N=true,zoom:L,onZoomChange:H,onRefocusEditor:_,imageContext:M,onImageWrapType:E,onImageTransform:I,onOpenImageProperties:ae,tableContext:z,onTableAction:V,inline:$=false}=n,ne=nt.useRef(null),re=nt.useCallback(pe=>{!s&&r&&r(pe);},[s,r]),be=nt.useCallback(()=>{!s&&l&&a&&a();},[s,l,a]),he=nt.useCallback(()=>{!s&&c&&i&&i();},[s,c,i]),U=nt.useCallback(pe=>{!s&&r&&r({type:"fontFamily",value:pe});},[s,r]),Z=nt__namespace.default.useMemo(()=>Pd(b),[b]),Re=nt.useCallback(pe=>{!s&&r&&r({type:"fontSize",value:pe});},[s,r]),ce=nt.useCallback(pe=>{!s&&r&&r({type:"textColor",value:pe});},[s,r]),de=nt.useCallback(pe=>{!s&&r&&r({type:"highlightColor",value:typeof pe=="string"?pe:""});},[s,r]),We=nt.useCallback(pe=>{!s&&r&&r({type:"alignment",value:pe});},[s,r]),bo=nt.useCallback(()=>{!s&&r&&r("bulletList");},[s,r]),pt=nt.useCallback(()=>{!s&&r&&r("numberedList");},[s,r]),ho=nt.useCallback(()=>{!s&&r&&r("indent");},[s,r]),Ie=nt.useCallback(()=>{!s&&r&&r("outdent");},[s,r]),Pl=nt.useCallback(pe=>{!s&&r&&(r({type:"lineSpacing",value:pe}),requestAnimationFrame(()=>_?.()));},[s,r,_]),Kn=nt.useCallback(pe=>{!s&&r&&r({type:"applyStyle",value:pe});},[s,r]),Pt=nt.useCallback(pe=>{!s&&V&&(V(pe),requestAnimationFrame(()=>_?.()));},[s,V,_]);nt.useEffect(()=>{if(!m)return;let pe=me=>{if(me.defaultPrevented)return;let at=me.target,Vn=g?.current,ya=ne.current,vo=Vn?.contains(at),Hd=ya?.contains(at);if(!vo&&!Hd)return;if((me.ctrlKey||me.metaKey)&&!me.altKey)switch(me.key.toLowerCase()){case "b":me.preventDefault(),re("bold");break;case "i":me.preventDefault(),re("italic");break;case "u":me.preventDefault(),re("underline");break;case "=":me.shiftKey?(me.preventDefault(),re("superscript")):(me.preventDefault(),re("subscript"));break;case "l":me.preventDefault(),We("left");break;case "e":me.preventDefault(),We("center");break;case "r":me.preventDefault(),We("right");break;case "j":me.preventDefault(),We("both");break;case "k":me.preventDefault(),re("insertLink");break}};return document.addEventListener("keydown",pe),()=>{document.removeEventListener("keydown",pe);}},[m,re,We,g]);let zn=nt.useCallback(pe=>{let me=pe.target;me.tagName==="INPUT"||me.tagName==="TEXTAREA"||me.tagName==="SELECT"||me.tagName==="OPTION"||pe.preventDefault();},[]),en=nt.useCallback(pe=>{let me=pe.target,at=document.activeElement;me.tagName==="SELECT"||me.tagName==="OPTION"||at?.tagName==="SELECT"||requestAnimationFrame(()=>{_?.();});},[_]);return jsxRuntime.jsxs("div",{ref:ne,className:te(!$&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",d),style:$?{display:"contents",...p}:p,role:$?void 0:"toolbar","aria-label":$?void 0:t("toolbar.ariaLabel"),"data-testid":$?void 0:"formatting-bar",onMouseDown:$?void 0:zn,onMouseUp:$?void 0:en,children:[jsxRuntime.jsxs(Tt,{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:St})}),jsxRuntime.jsx(ut,{onClick:he,disabled:s||!c,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(K,{name:"redo",size:St})})]}),N&&jsxRuntime.jsx(Tt,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(p0,{value:L,onChange:H,disabled:s,compact:true})}),C&&jsxRuntime.jsx(Tt,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(d0,{value:o.styleId||"Normal",onChange:Kn,styles:k,theme:R,disabled:s,width:120})}),(f||T)&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.font"),children:[f&&jsxRuntime.jsx(Vg,{value:o.fontFamily||"Arial",onChange:U,fonts:Z,documentFonts:x,disabled:s,width:60,placeholder:"Arial"}),T&&jsxRuntime.jsx(jg,{value:o.fontSize!==void 0?ql(o.fontSize):11,onChange:Re,disabled:s,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(ut,{onClick:()=>re("bold"),active:o.bold,disabled:s,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(K,{name:"format_bold",size:St})}),jsxRuntime.jsx(ut,{onClick:()=>re("italic"),active:o.italic,disabled:s,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(K,{name:"format_italic",size:St})}),jsxRuntime.jsx(ut,{onClick:()=>re("underline"),active:o.underline,disabled:s,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(K,{name:"format_underlined",size:St})}),jsxRuntime.jsx(ut,{onClick:()=>re("strikethrough"),active:o.strike,disabled:s,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(K,{name:"strikethrough_s",size:St})}),h&&jsxRuntime.jsx(jo,{mode:"text",value:o.color?.replace(/^#/,""),onChange:ce,theme:R,disabled:s,title:t("formattingBar.fontColor")}),v&&jsxRuntime.jsx(jo,{mode:"highlight",value:o.highlight,onChange:de,theme:R,disabled:s,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(ut,{onClick:()=>re("insertLink"),disabled:s,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(K,{name:"link",size:St})})]}),jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(ut,{onClick:()=>re("superscript"),active:o.superscript,disabled:s,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(K,{name:"superscript",size:St})}),jsxRuntime.jsx(ut,{onClick:()=>re("subscript"),active:o.subscript,disabled:s,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(K,{name:"subscript",size:St})})]}),y&&jsxRuntime.jsx(Tt,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(r0,{value:o.alignment||"left",onChange:We,disabled:s})}),(S||w)&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.listFormatting"),children:[S&&jsxRuntime.jsx(i0,{listState:o.listState||ul(),onBulletList:bo,onNumberedList:pt,onIndent:ho,onOutdent:Ie,disabled:s,showIndentButtons:true,compact:true,hasIndent:(o.indentLeft??0)>0}),w&&jsxRuntime.jsx(s0,{value:o.lineSpacing,onChange:Pl,disabled:s})]}),M&&E&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(w0,{imageContext:M,onChange:E,disabled:s}),I&&jsxRuntime.jsx(R0,{onTransform:I,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:St})})]}),z?.isInTable&&V&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(g0,{onAction:Pt,disabled:s}),jsxRuntime.jsx(b0,{onAction:Pt,disabled:s,theme:R,value:Kt(z?.cellBorderColor,R)}),jsxRuntime.jsx(v0,{onAction:Pt,disabled:s}),jsxRuntime.jsx(x0,{onAction:Pt,disabled:s,theme:R,value:z?.cellBackgroundColor}),jsxRuntime.jsx(P0,{onAction:Pt,disabled:s,tableContext:z})]}),jsxRuntime.jsx(ut,{onClick:()=>re("clearFormatting"),disabled:s,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(K,{name:"format_clear",size:St})}),u]})}function C8({children:e,className:t,style:n,...o}){return jsxRuntime.jsx(ma.Provider,{value:o,children:jsxRuntime.jsx("div",{className:te("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:Je.toolbar,...n},"data-testid":"editor-toolbar",children:e})})}var et=C8;et.TitleBar=Sd;et.Logo=nl;et.DocumentName=xd;et.MenuBar=al;et.TitleBarRight=rl;et.Toolbar=Ld;var w8=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"]]),R8=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function k8({source:e,scale:t,measurer:n,documentName:o,onStateChange:r,onError:a,onSave:i,renderTitleBarLeft:l,renderTitleBarRight:c,ref:s,colorMode:d,onZoomChange:p,documentFontFamily:m,className:g}){let u=nt.useRef(null),[f,b]=nt.useState(null),[x,T]=nt.useState({}),[h,v]=nt.useState(null),y=nt.useCallback(k=>{b(k);let R=u.current?.formatting();R&&T({bold:R.bold,italic:R.italic,underline:R.underline,strike:R.strikethrough,superscript:R.superscript,subscript:R.subscript,...R.fontFamily?{fontFamily:R.fontFamily}:{},...R.fontSizeHalfPoints?{fontSize:R.fontSizeHalfPoints}:{},...R.alignment?{alignment:R.alignment}:{},...R.styleId?{styleId:R.styleId}:{},...R.color?{color:`#${R.color}`}:{},...R.highlight?{highlight:R.highlight}:{}}),v(u.current?.sectionProperties()??null),r?.(k);},[r]),S=nt.useCallback(k=>{let R=u.current;if(R){if(typeof k=="string")switch(k){case "bold":return R.toggleRunProperty("b");case "italic":return R.toggleRunProperty("i");case "underline":return R.toggleRunProperty("u",{val:"single"});case "strikethrough":return R.toggleRunProperty("strike");case "superscript":return R.setRunProperty("vertAlign",{val:"superscript"});case "subscript":return R.setRunProperty("vertAlign",{val:"subscript"});case "clearFormatting":R.setRunProperty("b",{val:"0"}),R.setRunProperty("i",{val:"0"}),R.setRunProperty("u",{val:"none"}),R.setRunProperty("strike",{val:"0"}),R.setRunProperty("vertAlign",{val:"baseline"});return;default:return}switch(k.type){case "fontFamily":return R.setRunProperty("rFonts",{ascii:k.value,hAnsi:k.value});case "fontSize":return R.setRunProperty("sz",{val:String(Math.round(k.value*2))});case "textColor":{let N=k.value,L=typeof N=="string"?R8(N):Kt(N,null)??null;return L?R.setRunProperty("color",{val:L}):void 0}case "highlightColor":{let N=k.value.trim().toLowerCase();if(N==="none"||N==="")return R.setRunProperty("highlight",{val:"none"});let L=w8.get(N.startsWith("#")?N:`#${N}`);return L?R.setRunProperty("highlight",{val:L}):void 0}case "alignment":return R.setParagraphProperty("jc",{val:String(k.value)});case "lineSpacing":return R.setParagraphProperty("spacing",{line:String(Math.round(k.value)),lineRule:"auto"},{mergeAttributes:true});case "applyStyle":return R.setParagraphProperty("pStyle",{val:k.value});default:return}}},[]);nt.useImperativeHandle(s,()=>u.current,[]);let w=t===void 0?1:t/(96/72),C=h?{pageWidthTwips:h.pageSize.widthTwips,pageHeightTwips:h.pageSize.heightTwips,orientation:h.landscape?"landscape":"portrait",marginsTwips:{top:h.margins.topTwips,right:h.margins.rightTwips,bottom:h.margins.bottomTwips,left:h.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(et,{currentFormatting:x,onFormat:S,onUndo:()=>u.current?.undo(),onRedo:()=>u.current?.redo(),canUndo:f?.canUndo??false,canRedo:f?.canRedo??false,zoom:w,onZoomChange:p,onSave:()=>{let k=u.current?.save();k&&i?.(k);},children:[jsxRuntime.jsxs(et.TitleBar,{children:[l&&jsxRuntime.jsx(et.Logo,{children:l()}),jsxRuntime.jsx(et.DocumentName,{value:o??"Document",editable:false}),c&&jsxRuntime.jsx(et.TitleBarRight,{children:c()}),jsxRuntime.jsx(et.MenuBar,{})]}),jsxRuntime.jsx(et.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[C?jsxRuntime.jsx("div",{style:{padding:"4px 0"},children:jsxRuntime.jsx(Fo,{pageSetup:C,zoom:w})}):null,jsxRuntime.jsx(gd,{ref:u,source:e,...m?{documentFontFamily:m}:{},...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onStateChange:y,...a?{onError:a}:{}})]})]})}var xl=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 Sl=class extends xl{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()}`,a={id:r,message:t,severity:n,details:o,timestamp:Date.now()};if(this.notifications=[...this.notifications,a],this.emitSnapshot(),n!=="error"){let i=setTimeout(()=>{this.timers.delete(i),this.dismiss(r);},5e3);this.timers.add(i);}return r}emitSnapshot(){this.setSnapshot({notifications:this.notifications});}};var L8=nt.createContext(null);function D0({children:e}){let t=nt.useMemo(()=>new Sl,[]),n=nt.useSyncExternalStore(t.subscribe,t.getSnapshot),o=nt.useCallback((s,d)=>{t.showError(s,d);},[t]),r=nt.useCallback((s,d)=>{t.showWarning(s,d);},[t]),a=nt.useCallback((s,d)=>{t.showInfo(s,d);},[t]),i=nt.useCallback(s=>{t.dismiss(s);},[t]),l=nt.useCallback(()=>{t.clearAll();},[t]),c=nt.useMemo(()=>({notifications:n.notifications,showError:o,showWarning:r,showInfo:a,dismissNotification:i,clearNotifications:l}),[n.notifications,o,r,a,i,l]);return jsxRuntime.jsxs(L8.Provider,{value:c,children:[e,jsxRuntime.jsx(F8,{notifications:n.notifications,onDismiss:i})]})}function F8({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(A8,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function A8({notification:e,onDismiss:t}){let{t:n}=D(),[o,r]=nt.useState(false),i=(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:i.bg,border:`1px solid ${i.border}`,borderRadius:"8px",padding:"12px 16px",boxShadow:"0 2px 8px var(--doc-shadow)",animation:"docx-notification-slide-in 0.3s ease-out"},c={display:"flex",alignItems:"flex-start",gap:"8px"},s={color:i.icon,flexShrink:0},d={flex:1,minWidth:0},p={color:i.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:i.text,maxHeight:"200px",overflow:"auto"},g={background:"transparent",border:"none",cursor:"pointer",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",color:i.text},u=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.jsx("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:l,children:jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("span",{style:s,children:u(e.severity)}),jsxRuntime.jsxs("div",{style:d,children:[jsxRuntime.jsx("div",{style:p,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 Tl=class extends nt.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(H8,{error:o,errorInfo:r,showDetails:n,onReset:this.resetError})}return this.props.children}};function H8({error:e,errorInfo:t,showDetails:n,onReset:o}){let{t:r}=D(),a={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"},i={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:a,children:[jsxRuntime.jsx("div",{style:i,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:[`
1
+ 'use strict';var nt=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 nt__namespace=/*#__PURE__*/_interopNamespace(nt);var ye__namespace=/*#__PURE__*/_interopNamespace(ye);var Bd={version:"2.15.1"};var O0=Bd.version;var Zd="(prefers-color-scheme: dark)";function qd(){return typeof window<"u"&&typeof window.matchMedia=="function"}function Kd(){return qd()?window.matchMedia(Zd).matches:false}function zd(e,t){return e==="dark"||e==="system"&&t}function Vd(e){if(!qd())return ()=>{};let t=window.matchMedia(Zd);e(t.matches);let n=o=>e(o.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}var El=nt.createContext(null);function H(){return nt.useContext(El)}var mt=nt.createContext(null);var wl=nt.createContext(i18n.en),Rl=nt.createContext("en");function nn({i18n:e,children:t}){let n=nt.useContext(wl),o=nt.useContext(Rl),r=typeof e?._lang=="string"?e._lang:o,i=nt.useMemo(()=>i18n.deepMerge(n,e),[n,e]);return jsxRuntime.jsx(Rl.Provider,{value:r,children:jsxRuntime.jsx(wl.Provider,{value:i,children:t})})}function N(){let e=nt.useContext(wl),t=nt.useContext(Rl);return {t:nt.useMemo(()=>i18n.createT(e,t),[e,t]),catalogue:e}}function jd(e){let{t}=N();return nt.useCallback((n,o)=>e?.get(n)??t(n,o),[e,t])}var kl=0,Ml=false,Il=false;function Yd(){let e=globalThis.navigator?.scheduling;return typeof e?.isInputPending!="function"?false:e.isInputPending({includeContinuous:true})?true:(Ml||(Ml=true,kl+=1,queueMicrotask(()=>{Ml=false;}),Il||(Il=true,setTimeout(()=>{Il=false,kl=0;},0))),kl>16)}function Xd(e){let t=false;return ()=>{if(t)return;t=true;let n=()=>{t=false,e();};Yd()?setTimeout(n,0):queueMicrotask(n);}}var W0=()=>{},Dl=0;function U0(){return Dl}function Nl(e){return Xd(e)}function O(e,t=Object.is,n){let o=H(),r=n?.onSubscribe,i=n?.onUnsubscribe,a=nt.useCallback(d=>{if(!o)return W0;let m=false;Dl++,r?.();let p=Nl(()=>{m||d();}),g=[o.on("change",p),o.on("selectionChange",p),o.on("error",p)];return ()=>{m=true,Dl--,i?.();for(let u of g)u();}},[o,r,i]),l=nt.useMemo(()=>{let d=false,m,p;return g=>{if(d&&g===m)return p;let u=e(g);return d&&t(p,u)?(m=g,p):(d=true,m=g,p=u,u)}},[o,e,t]),c=nt.useCallback(()=>l(o?o.snapshot():editor.LOADING_SNAPSHOT),[o,l]),s=nt.useCallback(()=>l(editor.LOADING_SNAPSHOT),[l]);return nt.useSyncExternalStore(a,c,s)}var Qd=12700,Jd=96;function X0(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function J0(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 Sa(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(!X0(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}=J0(o.pixelWidth,o.pixelHeight,o.dpiX??Jd,o.dpiY??Jd);return Object.freeze({ok:true,bytes:e,mime:n,widthPoints:i,heightPoints:a})}function Ut(e){return Math.round(e/Qd*100)/100}function Gn(e){return Math.round(e*Qd)}var xo=nt.createContext({t:void 0,onSave:void 0});function eb(){return nt.useContext(xo)}function Ta(e){let{t}=N();return n=>e?.(n)??t(n)}function J(){let{t:e}=nt.useContext(xo);return Ta(e)}function ib(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason&&e.value===t.value}function Ll(e){return typeof e=="string"}function le(e){let t=H(),{t:n}=N(),o=Ll(e)?e:editor.editorCommandKey(e),r=nt.useRef(e);r.current=e;let i=nt.useCallback(c=>{let s=r.current;if(Ll(s)){let m=editor.toolbarCommandState(t,s);return {active:m.active,enabled:m.enabled,disabledReason:i18n.localizeDisabledReason(m.disabledReason,n),value:m.value??null}}if(!t)return {active:false,enabled:false,disabledReason:null,value:null};let d=t.can(s);return {active:t.isActive(s),enabled:d.ok,disabledReason:d.ok?null:i18n.localizeDisabledReason(d.reason??null,n),value:null}},[t,o,n]),a=O(i,ib),l=nt.useCallback(()=>{let c=r.current;return Ll(c)?editor.runToolbarCommand(t,c).ok:t?t.exec(c).ok:false},[t,o]);return nt.useMemo(()=>({execute:l,isActive:a.active,isEnabled:a.enabled,disabledReason:a.disabledReason,value:a.value}),[l,a])}var db=()=>()=>{},ub=()=>true,pb=()=>false;function an(){let e=nt.useSyncExternalStore(db,ub,pb);return nt.useCallback(t=>e?i18n.platformShortcut(t):t,[e])}function bb(e,t){return typeof t!="function"?e:typeof e!="function"?t:n=>{e(n),n.defaultPrevented||t(n);}}function hb(e,t){let n={...e,...t};for(let o of Object.keys(e))/^on[A-Z]/.test(o)?n[o]=bb(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=nt.Children.only(e);if(!nt.isValidElement(n))return null;let o=n.props,r=hb(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);}),nt.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 Q(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 B(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function So(e){let{slot:t,icon:n,asChild:o,className:r,children:i,hidden:a}=e,{execute:l,isActive:c,isEnabled:s,disabledReason:d,value:m}=le(t),p=J(),g=an();if(a)return null;let u=X(t),f=g(p(u?.labelKey??t)),b=editor.chromeSlotIsToggle(t),y={onClick:()=>l(),onMouseDown:B,disabled:!s,"data-slot":t,className:`docx-toolbar__button${r?` ${r}`:""}`,...c?{"data-active":""}:{},...s?{}:{"data-disabled":""},...b?{"aria-pressed":c}:{},...m!==null?{"data-value":m}:{},"aria-label":f,title:d??f};return o?jsxRuntime.jsx(j,{...y,children:i}):jsxRuntime.jsx("button",{type:"button",...y,children:n??i??Q(u?.paths)})}So.docxToolbarPart=true;var wb="image/png,image/jpeg,image/gif",Al=nt.createContext(null);function au(){let e=nt.useContext(Al);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function jn(){return nt.useContext(Al)}function Pa({children:e}){let t=H(),{t:n}=N(),o=nt.useRef(null),r=nt.useRef(false),i=nt.useCallback(()=>editor.toolbarCommandState(t,"image.insert"),[t]),a=O(i,(f,b)=>f.enabled===b.enabled&&f.disabledReason===b.disabledReason),l=a.enabled,c=i18n.localizeDisabledReason(a.disabledReason,n),s=nt.useCallback(async f=>{if(!t||r.current)return;let b=Sa(f);if(!b.ok){window.alert(n(b.reasonKey));return}let y={type:"insertImage",data:b.bytes,mime:b.mime,widthPoints:b.widthPoints,heightPoints:b.heightPoints},T=t.canExecuteImageCommand?.(y);if(T&&!T.ok){window.alert(T.reason??n("imageInsert.errors.refused"));return}r.current=true;try{let h=await editor.executeImageCommand(t,y);h.ok?t.focus():window.alert(h.reason??n("imageInsert.errors.refused"));}finally{r.current=false;}},[t,n]),d=nt.useCallback(async f=>{let b=f?.[0];if(!b)return;let y=await b.arrayBuffer();await s(new Uint8Array(y));},[s]),m=nt.useCallback(async f=>{if(!f)return;let b=[...f.files].find(y=>y.type.startsWith("image/"));if(b){await d([b]);return}for(let y of f.items){if(y.kind!=="file"||!y.type.startsWith("image/"))continue;let T=y.getAsFile();if(!T)continue;let h=await T.arrayBuffer();await s(new Uint8Array(h));return}},[s,d]),p=nt.useCallback(()=>{l&&o.current?.click();},[l]),g=nt.useCallback(async f=>{let b=f.currentTarget;await d(b.files),b.value="";},[d]),u=nt.useMemo(()=>({openFilePicker:p,insertFromFileList:d,insertFromDataTransfer:m,isEnabled:l,disabledReason:c,inputRef:o,onInputChange:g}),[p,d,m,l,c,g]);return jsxRuntime.jsxs(Al.Provider,{value:u,children:[jsxRuntime.jsx("input",{ref:o,type:"file",accept:wb,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:g,onMouseDown:f=>f.stopPropagation()}),e]})}function Ea({className:e,hidden:t,asChild:n,children:o}){let{openFilePicker:r,isEnabled:i,disabledReason:a}=au(),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:B,onClick:r};return n?jsxRuntime.jsx(j,{...d,children:o}):jsxRuntime.jsx("button",{...d,children:o??Q(c?.paths)})}Ea.docxSlot="image.insert";var Yn=Object.assign(Ea,{docxSlot:"image.insert"});var Bb=["nw","n","ne","e","se","s","sw","w"],cu=40,du=12;function Zb(e){return `imageOverlay.handle.${e}`}function qb(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 Kb(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 zb(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 Ol({containerRef:e,portalRef:t,scrollPort:n}){let o=H(),{t:r}=N(),[i,a]=nt.useState(null),[l,c]=nt.useState(null),[s,d]=nt.useState({left:0,top:0}),m=nt.useRef(null);m.current=l;let p=nt.useRef(null),g=nt.useRef(null),u=nt.useRef(null),f=nt.useRef(null),b=nt.useRef(null);nt.useEffect(()=>{let C=e.current;if(!C)return;let k=R=>{let L=(R.target instanceof Element?R.target:null)?.closest("[data-drawing-node-id]")?.getAttribute("data-drawing-node-id");f.current=L??null,L&&L===i?.id&&queueMicrotask(()=>u.current?.focus({preventScroll:true}));};return C.addEventListener("pointerdown",k,{capture:true}),()=>C.removeEventListener("pointerdown",k,{capture:true})},[e,i?.id]),nt.useEffect(()=>{if(!o){a(null);return}let C=()=>{a(editor.selectedDrawingOverlayTargetOf(o.surface));},k=()=>{queueMicrotask(C);};C();let R=[o.on("change",k),o.on("selectionChange",C)];return ()=>{for(let _ of R)_();}},[o]);let y=nt.useCallback(()=>{d(C=>{let k=editor.overlayHostOrigin(e.current);return k.left===C.left&&k.top===C.top?C:k});},[e]);nt.useEffect(()=>{y();let C=t.current;if(!C||typeof ResizeObserver!="function")return;let k=new ResizeObserver(y);k.observe(C);let R=e.current;return R&&k.observe(R),()=>k.disconnect()},[e,t,y,i]),nt.useEffect(()=>{if(n){b.current=n;return}let C=e.current;if(!C||!o?.surface)return;let k=C.closest(".docx-editor__scroll-container");if(!k)return;let R=o.surface.overlayCoordinates();return b.current=editor.createImageOverlayScrollPort(k,R.paintScale),()=>{b.current=null;}},[e,o,n]);let T=nt.useCallback(()=>{c(null),p.current=null;let C=g.current;if(g.current=null,C)try{C.releasePointerCapture(C._lastPointerId??0);}catch{}},[]),h=nt.useCallback((C,k,R,_,L,F,I)=>{if(!o?.surface)return;let M=o.surface.layout(),E=editor.captureImageMutationPreconditions(o);if(E){p.current=Object.freeze({x:_,y:L}),g.current=F,F._lastPointerId=I;try{F.setPointerCapture(I);}catch{}c({session:Object.freeze({drawingNodeId:R.id,startBounds:Object.freeze({x:R.x,y:R.y,width:R.width,height:R.height}),startWidthEmu:R.widthEmu,startHeightEmu:R.heightEmu,startPosition:R.position,anchorFrameOrigin:R.anchorFrameOrigin,transform:R.transform,mode:C,handle:k,preconditions:E,layoutRevision:M.revision,packageRevision:o.surface.session.packageRevision(),kind:R.kind}),bounds:R,accumulatedScrollPt:0}),u.current?.focus({preventScroll:true});}},[o]),v=nt.useCallback((C,k,R,_,L)=>{if(!o)return;if(editor.isStaleImageInteractionCommit(o,C)){T();return}C.mode==="resize"?o.exec({type:"setImageProperties",widthEmu:k,heightEmu:R,...L?.mode==="simple"?{horizontalEmu:L.horizontalEmu,verticalEmu:L.verticalEmu}:{},...L?.mode==="frame"?{...L.horizontalEmu!==void 0?{horizontalEmu:L.horizontalEmu}:{},...L.verticalEmu!==void 0?{verticalEmu:L.verticalEmu}:{}}:{}}):C.mode==="move"&&L&&o.exec({type:"setImagePosition",...L}),T();},[T,o]),S=nt.useCallback(C=>{if(!o)return;let k=m.current?.bounds??editor.selectedDrawingOverlayTargetOf(o.surface);if(!k)return;if(m.current&&C.key==="Escape"){C.preventDefault(),C.stopPropagation(),T();return}if(m.current)return;let R=C.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(C.key==="Delete"||C.key==="Backspace"){C.preventDefault(),C.stopPropagation(),o.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(C.key))return;C.preventDefault(),C.stopPropagation();let _=C.key==="ArrowLeft"?-R:C.key==="ArrowRight"?R:0,L=C.key==="ArrowUp"?-R:C.key==="ArrowDown"?R:0;if(C.altKey){if(!k.canResize)return;let I=zb(_,L),M=editor.computeImageResizeResult({handle:I,startWidthEmu:k.widthEmu,startHeightEmu:k.heightEmu,startBounds:{x:k.x,y:k.y,width:k.width,height:k.height},startPosition:k.position,anchorFrameOrigin:k.anchorFrameOrigin,deltaXPt:_,deltaYPt:L,transform:k.transform,preserveAspect:editor.resizePreservesAspect(I,k.aspectLocked,C.shiftKey),kind:k.kind});o.exec({type:"setImageProperties",widthEmu:M.widthEmu,heightEmu:M.heightEmu,...M.position?.mode==="simple"?{horizontalEmu:M.position.horizontalEmu,verticalEmu:M.position.verticalEmu}:{},...M.position?.mode==="frame"?{...M.position.horizontalEmu!==void 0?{horizontalEmu:M.position.horizontalEmu}:{},...M.position.verticalEmu!==void 0?{verticalEmu:M.position.verticalEmu}:{}}:{}});return}if(k.kind!=="anchored"||!k.canMove||!k.position)return;let F=editor.computeMovedImagePosition(k.position,_,L);o.exec({type:"setImagePosition",...F});},[T,o]);nt.useEffect(()=>{if(!l||!o?.surface)return;let C=o.surface.overlayCoordinates(),k=_=>{let L=m.current,F=p.current;if(!L||!F)return;let I=editor.cssPixelsToLayoutPoints(_.clientX-F.x,C.paintScale),M=editor.cssPixelsToLayoutPoints(_.clientY-F.y,C.paintScale);if(L.session.mode==="move"){let D=0,ae=b.current,z=e.current?.closest(".docx-editor__scroll-container");if(ae&&z){let $=z.getBoundingClientRect();_.clientY>$.bottom-cu?D=du:_.clientY<$.top+cu&&(D=-du),D!==0&&(D=ae.scrollBy(D));}let V=L.accumulatedScrollPt+D;c({...L,accumulatedScrollPt:V,bounds:Object.freeze({...L.bounds,x:L.session.startBounds.x+I,y:L.session.startBounds.y+M+V})});return}if(!L.session.handle)return;let E=editor.computeImageResizeResult({handle:L.session.handle,startWidthEmu:L.session.startWidthEmu,startHeightEmu:L.session.startHeightEmu,startBounds:L.session.startBounds,startPosition:L.session.startPosition,anchorFrameOrigin:L.session.anchorFrameOrigin,deltaXPt:I,deltaYPt:M,transform:L.session.transform,preserveAspect:editor.resizePreservesAspect(L.session.handle,L.bounds.aspectLocked,_.shiftKey),kind:L.session.kind});c({...L,bounds:Object.freeze({...L.bounds,x:E.previewBounds.x,y:E.previewBounds.y,width:E.previewBounds.width,height:E.previewBounds.height,widthEmu:E.widthEmu,heightEmu:E.heightEmu})});},R=_=>{let L=m.current;if(L)if(_.type==="pointerup"){let F=editor.cssPixelsToLayoutPoints(_.clientX-(p.current?.x??_.clientX),C.paintScale),I=editor.cssPixelsToLayoutPoints(_.clientY-(p.current?.y??_.clientY),C.paintScale),M=editor.finalizeImageOverlayInteraction({session:L.session,deltaXPt:F,deltaYPt:I,accumulatedScrollPt:L.accumulatedScrollPt,aspectLocked:L.bounds.aspectLocked,shiftKey:_.shiftKey,anchorFrameOrigin:L.session.anchorFrameOrigin});v(L.session,M.widthEmu,M.heightEmu,M.previewBounds,M.position);}else T();};return window.addEventListener("pointermove",k),window.addEventListener("pointerup",R),window.addEventListener("pointercancel",R),()=>{window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",R),window.removeEventListener("pointercancel",R);}},[T,v,e,o,l]),nt.useEffect(()=>{!i||f.current!==i.id||(f.current=null,u.current?.focus({preventScroll:true}));},[i]);let x=l?.bounds??i,w=nt.useMemo(()=>{if(!o?.surface||!x)return null;let C=o.surface.publishedLayout(),k=o.surface.overlayCoordinates(),R=editor.overlayFrameToSheetCssPixels(C,{pageIndex:x.pageIndex,x:x.x,y:x.y,width:x.width,height:x.height},k),_={left:R.left+s.left,top:R.top+s.top,width:R.width,height:R.height},L=x.canResize,F=x.kind==="anchored"&&x.canMove;return jsxRuntime.jsxs("div",{ref:u,className:"docx-image-selection-overlay","data-drawing-node-id":x.id,tabIndex:0,onKeyDown:S,children:[jsxRuntime.jsx("div",{className:`docx-image-selection-overlay__frame${F?" docx-editor-one-surface__overlay-control":""}`,role:"group","aria-label":r("imageOverlay.selection"),style:{left:`${_.left}px`,top:`${_.top}px`,width:`${_.width}px`,height:`${_.height}px`,cursor:F?"move":"default"},onPointerDown:I=>{B(I),!(!F||!x.position)&&I.button===0&&(I.preventDefault(),I.stopPropagation(),h("move",null,x,I.clientX,I.clientY,I.currentTarget,I.pointerId));}}),L?Bb.map(I=>{let M=Kb(I);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(Zb(I)),tabIndex:0,style:{left:`calc(${_.left}px + ${_.width}px * ${parseFloat(M.x)/100} - 5px)`,top:`calc(${_.top}px + ${_.height}px * ${parseFloat(M.y)/100} - 5px)`,cursor:qb(I)},onPointerDown:E=>{B(E),E.button===0&&(E.preventDefault(),E.stopPropagation(),h("resize",I,x,E.clientX,E.clientY,E.currentTarget,E.pointerId));}},I)}):null]})},[x,h,o,S,s.left,s.top,r]);return !w||!t.current?null:reactDom.createPortal(w,t.current)}function Zl(e){return [...e.items].some(t=>t.kind==="file"&&t.type.startsWith("image/"))}function Ra({className:e}){let t=H(),n=jn(),o=nt.useRef(null),r=nt.useRef(null);nt.useLayoutEffect(()=>{let c=o.current;if(!(!t||!c))return t.attach(c),()=>{t.detach();}},[t]);let i=nt.useCallback(c=>{if(!n?.isEnabled)return;let s=c.clipboardData;s&&Zl(s)&&(editor.clipboardPasteLandsContent(s)||(c.preventDefault(),n.insertFromDataTransfer(s)));},[n]),a=nt.useCallback(c=>{!n?.isEnabled||!Zl(c.dataTransfer)||c.preventDefault();},[n]),l=nt.useCallback(c=>{if(n?.isEnabled&&Zl(c.dataTransfer)){if(editor.clipboardDropLandsText(c.dataTransfer)){if((c.target instanceof Element?c.target:null)?.closest("[contenteditable]")?.getAttribute("contenteditable")==="true")return;c.preventDefault();return}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(Ol,{containerRef:o,portalRef:r}):null]})}function Ee(e){return e/1440*96}function ka(e){return e/96*1440}function je(e){return `${Math.round(e*100)/100}px`}function ql(e){return e/2}var jb=e=>e.isLoading||e.isOpening===true,Yb=e=>({width:Ee(e.pageSetup?.pageWidthTwips??12240)*e.zoom,height:Ee(e.pageSetup?.pageHeightTwips??15840)*e.zoom}),Xb=(e,t)=>e.width===t.width&&e.height===t.height;function Kl({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}function Jb({when:e=false,overlay:t=false,className:n,style:o,children:r}){let i=O(jb),a=O(Yb,Xb),{t:l}=N();if(!e&&!i)return null;let c=`docx-editor docx-editor__loading${t?" docx-editor__loading--overlay":""}${n?` ${n}`:""}`;return jsxRuntime.jsx("div",{className:c,style:o,role:"status","aria-live":"polite",children:r??jsxRuntime.jsx("div",{className:"docx-paginated-surface docx-editor__loading-surface",style:{width:a.width,height:a.height},children:jsxRuntime.jsx("div",{className:"docx-pages",children:jsxRuntime.jsx("div",{className:"docx-page docx-editor__loading-page",children:jsxRuntime.jsxs("div",{className:"docx-editor__loading-page-status",children:[jsxRuntime.jsx(Kl,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:l("loading.label")})]})})})})})}var Ma=Object.assign(Jb,{Spinner:Kl});function fu(){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 p=Object.create(null),g=[...t].sort((u,f)=>(n.get(u[0])??0)-(n.get(f[0])??0));for(let[,{author:u,style:f}]of g)p[u]=f;return {authors:p,others:e.size>0?"kind":"author"}}let l=null,c=false;function s(p){if(p===void 0)return "none";if(typeof p=="string")return p;let g=Object.entries(p.authors).map(([u,f])=>`${u}\0${JSON.stringify(f)}`).sort();return `${p.others??"kind"}${g.join("")}`}function d(){if(!r)return;let p=a(),g=s(p);if(g!==l){if(p===void 0){i&&(r.setRevisionStyles("author"),i=false,l=g);return}r.setRevisionStyles(p),i=true,l=g;}}function m(){!r||c||(c=true,queueMicrotask(()=>{c=false,d();}));}return {registerScheme(p){e.add(p),m();},register(p,g,u){n.has(p)||n.set(p,o++),t.set(p,{author:g,style:u}),m();},unregister(p){(e.delete(p)||t.delete(p))&&m();},connect(p){r=p;let g=a();i=p!==null&&g!==void 0,l=p===null?null:s(g),m();},current:a}}var Jn=nt.createContext(null);function hu(){let e=nt.useRef(null);return e.current===null&&(e.current=Symbol("revision-style-declaration")),e.current}function zl(){let e=nt.useContext(Jn),t=hu();return nt.useEffect(()=>{if(e)return e.registerScheme(t),()=>e.unregister(t)},[e,t]),null}function Vl(e){let{author:t,color:n,background:o,spanClassName:r,avatarUrl:i}=e,a=nt.useContext(Jn),l=hu();return nt.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 Qn(e){return e.paragraphId===""}var Co=Object.freeze({mode:"closed",link:null,anchor:null,text:"",url:"",copied:false,error:false,canEdit:true}),ih=e=>e;function lh(){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 er=nt.createContext(null);function $l(){let e=nt.useContext(er),t=_a(e===null);return e??t}function _a(e=true){let t=H(),[n,o]=nt.useState(Co),r=nt.useRef(null),i=nt.useRef(n);i.current=n;let a=O(ih),l=t?t.can({type:"insertText",text:""}).ok:false,c=nt.useCallback(()=>{let h=r.current;h&&(h.editor.releaseSelection(h.pin),r.current=null);},[]),s=nt.useCallback((h,v)=>{c(),o({mode:h?"reading":"editing",link:h??null,anchor:v??null,text:h?.text??"",url:h?h.kind==="internal"?`#${h.anchor??""}`:h.authored:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,c]),d=nt.useCallback(()=>{c(),o(Co);},[c]);nt.useEffect(()=>c,[c]);let m=nt.useCallback(()=>{let h=lh();c();let v=t?.surface?.hyperlinks.linkAtCaret()??t?.surface?.hyperlinks.fieldLinkAtCaret()??null;if(v&&Qn(v)){s(v,h);return}if(v){o({mode:"editing",link:v,anchor:h,text:v.text,url:v.kind==="internal"?`#${v.anchor??""}`:v.authored,copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});return}let S=t?.query({type:"selectedText"})??"",x=t?.retainSelection()??null;t&&x&&(r.current={editor:t,pin:x}),o({mode:"editing",link:null,anchor:h,text:S,url:"",copied:false,error:false,canEdit:t?t.can({type:"insertText",text:""}).ok:false});},[t,s,c]);nt.useEffect(()=>{if(!(!t||!e))return t.setHyperlinkChrome({onPopover:h=>s(h.link,{left:h.rect.left,top:h.rect.bottom}),onRequest:m})},[t,e,s,m]),nt.useEffect(()=>{let h=i.current;if(h.mode!=="reading"||!h.link)return;let v=Qn(h.link)?t?.surface?.hyperlinks.fieldLinkAtCaret()??null:t?.surface?.hyperlinks.linkAtCaret()??null;v&&v.id===h.link.id||o(Co);},[a,t]),nt.useEffect(()=>{let h=i.current;if(h.mode!=="editing"||h.link)return;let v=t?.surface;!v||v.retainedSelection()||o(Co);},[a,t]);let p=nt.useCallback(async()=>{let h=i.current.link?.href;if(!h)return false;try{await navigator.clipboard.writeText(h);}catch{return false}return o(v=>({...v,copied:true})),true},[]),g=nt.useCallback(()=>{o(h=>({...h,mode:"editing",copied:false,error:false}));},[]),u=nt.useCallback(h=>{o(v=>({...v,text:h,copied:false,error:false}));},[]),f=nt.useCallback(h=>{o(v=>({...v,url:h,copied:false,error:false}));},[]),b=nt.useCallback(()=>{let h=i.current,v=t?.surface?.hyperlinks;if(!v)return false;let S=h.url.trim();if(S.length===0)return o(C=>({...C,error:true})),false;let x=S.startsWith("#");return v.applyHyperlink({...x?{anchor:S.slice(1)}:{url:S},...h.text.trim().length>0?{text:h.text}:{}})?(d(),true):(o(C=>({...C,error:true})),false)},[t,d]),y=nt.useCallback(()=>{let h=t?.surface?.hyperlinks,v=i.current.link;if(!h)return false;let S=h.removeHyperlink(v?.id);return S&&d(),S},[t,d]),T=nt.useCallback(()=>{let h=t?.surface?.navigation,v=i.current.link;if(!h||!v)return false;if(v.kind==="internal"){let x=v.anchor?h.goToBookmark(v.anchor):false;return x&&o(Co),x}let S=h.openExternal(v.href);return S&&o(Co),S},[t]);return nt.useMemo(()=>({state:n.mode==="closed"?Co:{...n,canEdit:l},open:s,openAtCaret:m,close:d,copy:p,beginEdit:g,setText:u,setUrl:f,commitEdit:b,unlink:y,openTarget:T}),[n,l,s,m,d,p,g,u,f,b,y,T])}var Ye={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function uh(e){return e==="sdtLocked"||e==="sdtContentLocked"}function ph(e){return e==="contentLocked"||e==="sdtContentLocked"}function Ul(e,t){return !e.ok&&e.code===t}function Et(){let e=nt.useContext(Gl),t=Da();return e??t}function Da(){let e=H(),[t,n]=nt.useState(false),[o,r]=nt.useState(false),[i,a]=nt.useState(false),l=O(w=>w),c=e?.surface??null,s=c?.contentControls;nt.useEffect(()=>{r(s?.showAll()??c?.state().contentControls.showAll??false),a(s?.formFill()??c?.state().contentControls.formFill??false);},[l,s,c]);let d=nt.useMemo(()=>{if(!e)return null;let w=s?.atCaret()??null;if(w){let E=s?.disabledReason(w.id,"edit")??null,D=s?.disabledReason(w.id,"remove")??null;return {id:w.id,tag:w.tag??null,alias:w.alias??null,controlType:w.controlType,locked:ph(w.effectiveLock)||E==="locked",removalLocked:uh(w.effectiveLock)||D==="locked",placeholder:w.placeholder,bound:w.bound||E==="bound",effectiveLock:w.effectiveLock}}let C=e.query({type:"contentControlAt"});if(!C)return null;let k=s?.disabledReason(C.id,"edit")??null,R=s?.disabledReason(C.id,"remove")??null,_=e.can({type:"setContentControlValue",value:""}),L=e.can({type:"removeContentControl"}),F=C.locked===true||k==="locked"||Ul(_,"locked"),I=k==="bound"||Ul(_,"bound"),M=R==="locked"||Ul(L,"locked");return {id:C.id,tag:C.tag??null,alias:C.alias??null,controlType:C.controlType,locked:F,removalLocked:M,placeholder:false,bound:I,effectiveLock:null}},[e,l,s]),m=nt.useMemo(()=>e?e.query({type:"contentControls"}):[],[e,l]),p=nt.useCallback(w=>{s?.setShowAll(w),r(w);},[s]),g=nt.useCallback(w=>{s?.setFormFill(w),a(w);},[s]),u=nt.useCallback(()=>p(!o),[p,o]),f=nt.useCallback(()=>g(!i),[g,i]),b=nt.useCallback(()=>n(true),[]),y=nt.useCallback(()=>n(false),[]),T=nt.useCallback(()=>n(w=>!w),[]),h=nt.useMemo(()=>{if(!d)return "no content control at the current selection";if(s){let C=s.disabledReason(d.id,"edit");return C==="locked"?"the content control is locked":C==="bound"?"the content control is bound to external data":C==="notFound"?"the content control was not found":C}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 w=e.can({type:"setContentControlValue",value:""});return w.ok?null:w.reason},[d,s,e]),v=nt.useMemo(()=>{if(!d)return "no content control at the current selection";if(s){let C=s.disabledReason(d.id,"remove");return C==="locked"?"the content control is locked":C==="notFound"?"the content control was not found":C}if(d.removalLocked)return "the content control is locked";if(!e)return "no document is loaded";let w=e.can({type:"removeContentControl"});return w.ok?null:w.reason},[d,s,e]),S=nt.useCallback(w=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(s&&d){let C=s.disabledReason(d.id,"edit");if(C)return {ok:false,code:C==="bound"?"bound":C==="locked"?"locked":"notFound",reason:C==="bound"?"the content control is bound to external data":C==="locked"?"the content control is locked":"the content control was not found"}}return e.exec({type:"setContentControlValue",value:w})},[e,s,d]),x=nt.useCallback(()=>{if(!e)return {ok:false,code:"notFound",reason:"no document is loaded"};if(s){let w=d?.id;if(!w)return {ok:false,code:"notFound",reason:"no content control at the current selection"};let C=s.disabledReason(w,"remove");return C?{ok:false,code:C==="locked"?"locked":"notFound",reason:C==="locked"?"the content control is locked":"the content control was not found"}:s.remove(w)?{ok:true,changed:true}:{ok:false,code:"unsupported",reason:"the edit was refused"}}return e.exec({type:"removeContentControl"})},[e,s,d]);return nt.useMemo(()=>({control:d,controls:m,showAll:o,formFill:i,inspectorOpen:t,canSetValue:h===null&&d!==null,canRemove:v===null&&d!==null,setValueDisabledReason:h,removeDisabledReason:v,setShowAll:p,toggleShowAll:u,setFormFill:g,toggleFormFill:f,openInspector:b,closeInspector:y,toggleInspector:T,remove:x,setValue:S}),[d,m,o,i,t,h,v,p,u,g,f,b,y,T,x,S])}var Gl=nt.createContext(null);function yu(){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 Yl=nt.createContext(null);function Eo(){return nt.useContext(Yl)}var xu=()=>0,Xl=()=>()=>{};function wo(){let e=Eo(),t=nt.useCallback(o=>e?e.subscribeShift(o):Xl(),[e]),n=nt.useCallback(()=>e?e.getShift():0,[e]);return nt.useSyncExternalStore(t,n,xu)}function Su(){let e=Eo(),t=nt.useCallback(o=>e?e.subscribeReservation(o):Xl(),[e]),n=nt.useCallback(()=>e?e.getReservation():0,[e]);return nt.useSyncExternalStore(t,n,xu)}function At(){let e=Eo(),t=nt.useCallback(r=>e?e.subscribeViewport(r):Xl(),[e]),n=nt.useCallback(()=>e?e.getViewport():null,[e]),o=nt.useCallback(()=>null,[]);return nt.useSyncExternalStore(t,n,o)}function yh(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 xh(e){let t=nt.useRef(e);t.current=e;let[n,o]=nt.useState(null),{onReady:r,onChange:i,onFontError:a,...l}=e,c=nt.useMemo(()=>({onReady:s=>{o(s),t.current.onReady?.(s);},onChange:s=>t.current.onChange?.(s),onFontError:s=>t.current.onFontError?.(s)}),[]);return {DocxEditorRoot:or,rootProps:l,rootListeners:c,editorRef:n}}function or(e){let{document:t,fonts:n,author:o,locale:r,translate:i,mode:a,zoom:l,zoomMode:c,tableInteractionLabel:s,imageDecodePort:d,children:m}=e,{t:p}=N(),g=nt.useCallback((_,L)=>p(_,L),[p]),u=nt.useRef(g);u.current=g;let f=nt.useRef(e);f.current=e;let[b,y]=nt.useState(null),T=nt.useRef(null);T.current??=fu();let h=T.current;nt.useEffect(()=>{let _=f.current,L=_.translate??u.current,F=h.current(),I=editor.createDocxEditor({..._.document!==void 0?{document:_.document}:{},..._.fonts?{fonts:_.fonts}:{},..._.author!==void 0?{author:_.author}:{},..._.locale!==void 0?{locale:_.locale}:{},translate:L,..._.mode!==void 0?{mode:_.mode}:{},...F!==void 0?{revisionStyles:F}:{},..._.modules!==void 0?{modules:_.modules}:{},..._.zoom!==void 0?{zoom:_.zoom}:{},..._.zoomMode!==void 0?{zoomMode:_.zoomMode}:{},..._.tableInteractionLabel?{tableInteractionLabel:_.tableInteractionLabel}:{},..._.imageDecodePort?{imageDecodePort:_.imageDecodePort}:{},onFontError:E=>f.current.onFontError?.(E)}),M=I.on("change",E=>f.current.onChange?.(E));return y(I),()=>{M(),I.destroy(),y(E=>E===I?null:E);}},[t,n,d,h]),nt.useEffect(()=>{if(!b)return;if(!b.snapshot().isOpening){f.current.onReady?.(b);return}let _=b.on("change",()=>{_(),f.current.onReady?.(b);});return _},[b]);let v=nt.useRef({editor:null,zoom:void 0,mode:void 0});nt.useEffect(()=>{if(!b)return;v.current.editor!==b&&(v.current={editor:b,zoom:void 0,mode:void 0});let L=false;l!==void 0&&l!==v.current.zoom&&(v.current.zoom=l,b.setZoom(l),L=true);let F=v.current.mode,I=c!==void 0&&(F===void 0||!yh(F,c)),M=c===void 0?null:editor.resolveZoomMode(c),E=L&&c!==void 0&&M!==null&&M.type==="fit";(I||E)&&(v.current.mode=c,b.setZoomMode(c));},[b,l,c]),nt.useEffect(()=>{b&&b.setAuthor(o);},[b,o]);let S=nt.useRef({editor:null,value:void 0});nt.useEffect(()=>{if(b){if(S.current.editor!==b){S.current={editor:b,value:a};return}S.current.value!==a&&(S.current.value=a,b.setMode(a));}},[b,a]),nt.useEffect(()=>{b&&b.setTranslate(i??g);},[b,i,g]),nt.useEffect(()=>{b&&b.setLocale(r);},[b,r]),nt.useEffect(()=>{b&&b.setTableInteractionLabel(s??editor.defaultTableLabel);},[b,s]);let[x,w]=nt.useState(0),C=nt.useRef([]),k=nt.useMemo(()=>({mounted:x,register:()=>(w(_=>_+1),()=>w(_=>Math.max(0,_-1))),registerCommentDraft:_=>(C.current.push(_),()=>{let L=C.current.indexOf(_);L!==-1&&C.current.splice(L,1);}),requestCommentDraft:()=>{let _=C.current.at(-1);return _?(_(),true):false}}),[x]),R=nt.useMemo(yu,[]);return nt.useEffect(()=>(h.connect(b),()=>h.connect(null)),[h,b]),jsxRuntime.jsx(mt.Provider,{value:k,children:jsxRuntime.jsx(El.Provider,{value:b,children:jsxRuntime.jsx(Yl.Provider,{value:R,children:jsxRuntime.jsx(Jn.Provider,{value:h,children:jsxRuntime.jsx(Sh,{children:jsxRuntime.jsx(Th,{children:jsxRuntime.jsx(Pa,{children:m})})})})})})})}function Sh({children:e}){let t=_a(true);return jsxRuntime.jsx(er.Provider,{value:t,children:e})}function Th({children:e}){let t=Da();return jsxRuntime.jsx(Gl.Provider,{value:t,children:e})}var os=316,ts=44,Rh=24,Na={inlineStart:0,inlineEnd:os},Tu={inlineStart:ts,inlineEnd:ts},kh={inlineStart:0,inlineEnd:0};function Eu({open:e,viewportWidth:t,pageWidthPx:n,inlineStartReservation:o=0,docked:r=false}){if(!e)return Tu;if(r||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0)return Na;let i=Number.isFinite(o)&&o>0?o:0;return t-i-n-2*Rh>=os?Na:Tu}var Mh=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}},Ih=(e,t)=>e.reviewPaneOpen===t.reviewPaneOpen&&e.entitledZoom===t.entitledZoom&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function wu(){let e=At(),[t,n]=nt.useState(null);return nt.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 dn(){let e=nt.useContext(mt),{pageSetup:t,reviewPaneOpen:n,entitledZoom:o}=O(Mh,Ih),r=At(),i=Su(),a=nt.useRef(null);t&&(a.current=t.pageWidthTwips);let l=t?.pageWidthTwips??a.current,c=(e?.mounted??0)>0,s=nt.useCallback(p=>c?Eu({open:n,viewportWidth:p??0,pageWidthPx:l===null||o===null?0:Ee(l)*o,inlineStartReservation:i,docked:o===null}):kh,[c,n,l,o,i]),[d,m]=nt.useState(()=>s(r?r.clientWidth:null));return nt.useEffect(()=>{let p=()=>m(s(r?r.clientWidth:null));if(p(),!r||typeof ResizeObserver>"u")return;let g=new ResizeObserver(p);return g.observe(r),()=>g.disconnect()},[r,s]),d}var La=[.25,.5,.75,1,1.25,1.5,2];function nr(e,t){return t==="in"?La.find(o=>o>e+.001)??null:[...La].reverse().find(o=>o<e-.001)??null}function Ru(e,t){return e==="0"?1:e==="+"||e==="="?nr(t,"in")??t:e==="-"?nr(t,"out")??t:null}var ko=nt.createContext(false);function tt(){return nt.useContext(ko)?"":"docx-editor "}var Lh=e=>e.reviewPaneOpen??true,Fh=e=>e.zoomMode?.type==="fit";function Fa({className:e,style:t,children:n}){let o=tt(),r=H(),i=O(Lh),a=dn(),l=O(Fh),s=(nt.useContext(mt)?.mounted??0)>0,d=Eo(),m=wo(),p=nt.useCallback(u=>d?.setViewport(u),[d]),g=nt.useCallback(u=>{if(!r||!(u.metaKey||u.ctrlKey)||u.altKey)return;let f=u.target;if(f instanceof Element&&f.closest('input, textarea, select, [role="dialog"]'))return;let b=Ru(u.key,r.getZoom());b!==null&&(u.preventDefault(),r.setZoom(b));},[r]);return jsxRuntime.jsx("div",{ref:p,"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":`${m}px`,...s?{"--docx-review-gutter":`${a.inlineEnd}px`,"--docx-review-gutter-start":`${a.inlineStart}px`}:{}},children:jsxRuntime.jsx(ko.Provider,{value:true,children:n})})}var Hh=editor.LOADING_SNAPSHOT;function Iu({ref:e,editorRef:t}){nt.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)??Hh}),[t]);}var zh=e=>e.editingMode??"editing",Vh=e=>e.isLoading||e.isOpening===true,rs=[{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"}],$h="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function Ha({className:e,hidden:t}){let n=H(),o=O(zh),r=O(Vh),i=J(),{t:a}=N(),[l,c]=nt.useState(false),s=nt.useRef(null),d=nt.useRef(null),m=nt.useRef(null);nt.useEffect(()=>{if(!l)return;let T=m.current?.querySelectorAll('[role="menuitemradio"]');(m.current?.querySelector('[aria-checked="true"]')??T?.[0]??void 0)?.focus();},[l]);let p=nt.useCallback(T=>{let h=[...m.current?.querySelectorAll('[role="menuitemradio"]')??[]],v=h.indexOf(document.activeElement),S=x=>{T.preventDefault(),h[(x+h.length)%h.length]?.focus();};T.key==="ArrowDown"?S(v+1):T.key==="ArrowUp"?S(v-1):T.key==="Home"?S(0):T.key==="End"&&S(h.length-1);},[]);nt.useEffect(()=>{if(!l)return;let T=v=>{let S=s.current;S&&v.target instanceof Node&&S.contains(v.target)||c(false);},h=v=>{v.key==="Escape"&&(v.preventDefault(),c(false));};return document.addEventListener("mousedown",T,true),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",T,true),document.removeEventListener("keydown",h);}},[l]);let g=nt.useCallback(T=>{c(false),editor.runToolbarCommand(n,"review.editingMode",T),n?.focus();},[n]),u=editor.toolbarCommandState(n,"review.editingMode"),f=i18n.localizeDisabledReason(u.disabledReason,a),b=nt.useMemo(()=>rs.find(T=>T.mode===o)??rs[0],[o]);if(t)return null;let y=X("review.editingMode");return jsxRuntime.jsxs("div",{ref:s,className:`docx-toolbar__mode${e?` ${e}`:""}`,"data-slot":"review.editingMode",children:[jsxRuntime.jsxs("button",{ref:d,type:"button",className:"docx-toolbar__picker","data-testid":"editing-mode-trigger","data-mode":o,"aria-haspopup":"menu","aria-expanded":l,"aria-label":i(y?.labelKey??"editingMode.label"),disabled:r||!u.enabled,...f?{title:f}:{},onMouseDown:B,onClick:()=>c(T=>!T),children:[as(b.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:i(b.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),l?jsxRuntime.jsx("div",{ref:m,className:"docx-toolbar__mode-menu",role:"menu","aria-label":i(y?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:p,children:rs.map(T=>jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":T.mode===o,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${T.mode}`,onMouseDown:B,onClick:()=>g(T.mode),children:[as(T.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:i(T.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:i(T.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:T.mode===o?as($h):null})]},T.mode))}):null]})}Ha.docxSlot="review.editingMode";function as(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"})})}var Nu=[],Gh=()=>{};function rr(){let e=H(),t=nt.useCallback(n=>{if(!e)return Gh;let o=Nl(n),r=e.on("change",o),i=e.on("selectionChange",o);return ()=>{r(),i();}},[e]);return nt.useSyncExternalStore(t,()=>e?.getReviewAuthors()??Nu,()=>Nu)}var ev=e=>e.hiddenReviewAuthors??[];function Ba({className:e,hidden:t,icon:n}){let o=H(),r=rr(),i=O(ev),a=new Set(i),l=r.every(v=>!a.has(v.author)),[c,s]=nt.useState(false),d=nt.useRef(null),m=nt.useRef(null),p=nt.useRef(null),g=J(),{t:u}=N();nt.useEffect(()=>{if(!c)return;p.current?.querySelector('[role="menuitemcheckbox"]')?.focus();let v=x=>{d.current?.contains(x.target)||s(false);},S=x=>{x.key==="Escape"&&(x.preventDefault(),s(false),m.current?.focus());};return document.addEventListener("mousedown",v,true),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",v,true),document.removeEventListener("keydown",S);}},[c]);let f=nt.useCallback(v=>{let S=[...p.current?.querySelectorAll('[role="menuitemcheckbox"]')??[]],x=S.indexOf(document.activeElement),w=C=>{v.preventDefault(),S[(C+S.length)%S.length]?.focus();};v.key==="ArrowDown"?w(x+1):v.key==="ArrowUp"?w(x-1):v.key==="Home"?w(0):v.key==="End"?w(S.length-1):v.key==="Tab"&&s(false);},[]);if(t)return null;let b=X("review.authors"),y=editor.toolbarCommandState(o,"review.authors"),T=i18n.localizeDisabledReason(y.disabledReason,u),h=g(b?.labelKey??"reviewers.label");return jsxRuntime.jsxs("div",{ref:d,className:`docx-toolbar__reviewers${e?` ${e}`:""}`,"data-slot":"review.authors",children:[jsxRuntime.jsxs("button",{ref:m,type:"button",className:"docx-toolbar__picker","data-testid":"reviewers-trigger","aria-haspopup":"menu","aria-expanded":c,"aria-label":h,disabled:!y.enabled,title:T??h,onMouseDown:B,onClick:()=>s(v=>!v),children:[n??Q(b?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:h}),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),c?jsxRuntime.jsxs("div",{ref:p,className:"docx-toolbar__reviewers-menu",role:"menu","aria-label":h,"data-testid":"reviewers-menu",onKeyDown:f,children:[jsxRuntime.jsx(Lu,{checked:l,label:u("reviewers.all"),testId:"reviewer-all",onChoose:()=>o?.setAllReviewAuthorsVisible(!l)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),r.map(v=>jsxRuntime.jsx(Lu,{checked:!a.has(v.author),label:v.author||"\u2014",testId:`reviewer-${v.slot}`,color:v.color,onChoose:()=>o?.setReviewAuthorVisible(v.author,a.has(v.author))},v.author))]}):null]})}Ba.docxSlot="review.authors";function Lu(e){return jsxRuntime.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":e.checked,className:"docx-toolbar__reviewer-item","data-testid":e.testId,onMouseDown:B,onClick:e.onChoose,children:[jsxRuntime.jsx("span",{className:"docx-toolbar__menu-check","aria-hidden":"true",children:e.checked?"\u2713":""}),e.color?jsxRuntime.jsx("span",{className:"docx-toolbar__reviewer-swatch",style:{background:e.color}}):null,jsxRuntime.jsx("span",{className:"docx-toolbar__reviewer-name",children:e.label})]})}function un(e,t){if(!nt.isValidElement(e)||e.type!==nt.Fragment)return null;let o=nt.Children.toArray(e.props.children).map(t).filter(r=>r!==null);return o.length===1?o[0]:null}function qa({entries:e,children:t,preset:n,keyOfEntry:o,keyOfChild:r,renderEntry:i}){if(!n)return t;let a=new Map,l=[];for(let m of nt.Children.toArray(t)){let p=r(m);p?a.set(p,m):l.push(m);}let c=e.map((m,p)=>{let g=o(m,p),u=a.get(g);return u?jsxRuntime.jsx(nt.Fragment,{children:u},g):jsxRuntime.jsx(nt.Fragment,{children:i(m,p)},g)}),s=new Set(e.map(o)),d=[...a.entries()].filter(([m])=>!s.has(m)).map(([m,p])=>jsxRuntime.jsx(nt.Fragment,{children:p},m));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,d,l]})}var iv={contextualSpacing:null,keepNext:null,keepLines:null,widowControl:null,pageBreakBefore:null},lv=e=>{let t=e.formatting??null;if(!t)return null;let n=t.indent,o=t.paragraphFlags??iv;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}}},sv=["alignment","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops","indentLeft","indentRight","indentFirstLine"],cv=(e,t)=>sv.every(n=>e.disagrees[n]===t.disagrees[n]),dv=(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&&cv(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")),uv=e=>e.editable;function ss(){let e=H(),t=O(lv,dv),n=O(uv),o=nt.useMemo(()=>n&&e!==null&&e.can({type:"setParagraphFormat",alignment:"left"}).ok,[e,n]),r=nt.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 ar=e=>Math.round(e/1440*100)/100,cs=e=>ar(e).toLocaleString(void 0,{maximumFractionDigits:2}),Ka=e=>Math.round(e*1440),Au={left:"dialogs.paragraph.tabAlignLeft",center:"dialogs.paragraph.tabAlignCenter",right:"dialogs.paragraph.tabAlignRight",decimal:"dialogs.paragraph.tabAlignDecimal",bar:"dialogs.paragraph.tabAlignBar"},pv=e=>e===null||e===0?"none":e<0?"hanging":"firstLine",mv=(e,t)=>e==="none"?0:e==="hanging"?-Math.abs(t):Math.abs(t);function Hu(e){let t=e.indentFirstLineTwips;return {alignment:e.alignment??"left",indentLeft:e.indentLeftTwips??0,indentRight:e.indentRightTwips??0,special:pv(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 za={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 Ou(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 fv(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 Bu(e,t,n=za,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",mv(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),(!fv(e.tabStops,t.tabStops)||l("tabStops")&&t.clearedAllTabStops)&&a("tabStops",t.tabStops),i?r:null}function Zu(e,t){return [...e.filter(o=>o.positionTwips!==t.positionTwips),t].sort((o,r)=>o.positionTwips-r.positionTwips)}function qu(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 hv={marginRight:"auto",fontSize:"12px",color:"var(--doc-danger)"},vv={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},yv={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},xv={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",flexShrink:0,fontSize:16,fontWeight:600,color:"var(--doc-text)"},Sv={padding:"16px 20px",overflowY:"auto",minHeight:0},Tv={display:"grid",gridTemplateColumns:"1fr 1fr",gap:28},Vu={display:"flex",flexDirection:"column",gap:14,minWidth:0},ir={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},it={display:"flex",alignItems:"center",gap:12},gt={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)"},lr={fontSize:11,color:"var(--doc-text-muted)",width:20},Cv={display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--doc-text)"},Pv={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,flexShrink:0},sr={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"};function Mo({open:e,onClose:t,className:n}){let{t:o}=N(),{format:r,isEnabled:i,apply:a}=ss(),[l,c]=nt.useState("left"),[s,d]=nt.useState(0),[m,p]=nt.useState(0),[g,u]=nt.useState("none"),[f,b]=nt.useState(0),[y,T]=nt.useState(0),[h,v]=nt.useState(0),[S,x]=nt.useState("multiple"),[w,C]=nt.useState(1.08),[k,R]=nt.useState(false),[_,L]=nt.useState(false),[F,I]=nt.useState(false),[M,E]=nt.useState(true),[D,ae]=nt.useState(false),[z,V]=nt.useState([]),[$,ne]=nt.useState(false),[re,be]=nt.useState(0),[he,U]=nt.useState("left"),[Z,Re]=nt.useState("none"),[ce,de]=nt.useState(za),[We,ho]=nt.useState(false),pt=q=>o(We&&(q==="indentLeft"||q==="indentRight"||q==="special")?"dialogs.paragraph.notShown":"dialogs.paragraph.mixed"),vo=nt.useRef(za),Ie=nt.useId(),[Pl,Vn]=nt.useState(false),Pt=nt.useRef(null),$n=nt.useRef(false),on=nt.useRef(null);nt.useEffect(()=>{if(!e){$n.current=false;return}if($n.current||r===null)return;let q=Hu(r);c(q.alignment),d(q.indentLeft),p(q.indentRight),u(q.special),b(q.specialBy),T(q.spaceBefore),v(q.spaceAfter),x(q.lineRule),C(q.lineValue),R(q.contextualSpacing),L(q.keepNext),I(q.keepLines),E(q.widowControl),ae(q.pageBreakBefore),V(q.tabStops),ne(false);let ve=Ou(r);de(ve),ho(r.indentUnknown),be(0),U("left"),Re("none"),vo.current=ve,Vn(false),on.current=q,$n.current=true;},[e,r]),nt.useEffect(()=>{e&&Pt.current?.focus();},[e]);let pe=nt.useCallback(()=>{let q=on.current,ve=q===null?null:Bu(q,{alignment:l,indentLeft:s,indentRight:m,special:g,specialBy:f,spaceBefore:y,spaceAfter:h,lineRule:S,lineValue:w,contextualSpacing:k,keepNext:_,keepLines:F,widowControl:M,pageBreakBefore:D,tabStops:z,clearedAllTabStops:$},vo.current,ce);if(ve===null){t();return}if(a(ve)){Vn(false),t();return}Vn(true);},[a,t,ce,$,l,s,m,g,f,y,h,S,w,k,_,F,M,D,z]),me=nt.useCallback(()=>{let q=Math.round(re);return q<=0?false:(de(ve=>({...ve,tabStops:false})),V(Zu(z,{positionTwips:q,alignment:he,...Z!=="none"?{leader:Z}:{}})),be(0),U("left"),Re("none"),true)},[z,re,he,Z]);if(!e)return null;let at=q=>de(ve=>({...ve,[q]:false})),Wn=(q,ve,Wt,Ue)=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-${q}`,children:o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("input",{id:`${Ie}-${q}`,type:"number",style:wt,min:0,step:.1,value:ce[Ue]?"":ar(ve),placeholder:ce[Ue]?pt(Ue):void 0,onChange:Un=>{at(Ue),Wt(Ka(Number(Un.target.value)||0));},"aria-label":o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("span",{style:lr,children:o("dialogs.paragraph.unitInches")})]}),ya=(q,ve,Wt,Ue)=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-${q}`,children:o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("input",{id:`${Ie}-${q}`,type:"number",style:wt,min:0,step:1,value:ce[Ue]?"":ve,placeholder:ce[Ue]?pt(Ue):void 0,onChange:Un=>{at(Ue),Wt(Math.max(0,Number(Un.target.value)||0));},"aria-label":o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("span",{style:lr,children:o("dialogs.paragraph.unitPoints")})]}),yo=(q,ve,Wt)=>jsxRuntime.jsxs("label",{style:Cv,children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ve,ref:Ue=>{Ue&&(Ue.indeterminate=ce[q]);},onChange:Ue=>{de(Un=>({...Un,[q]:false})),Wt(Ue.target.checked);}}),o(`dialogs.paragraph.${q}`)]}),Od=`docx-editor${document.querySelector(".docx-editor")?.classList.contains("dark")?" dark":""}`;return reactDom.createPortal(jsxRuntime.jsx("div",{className:Od,style:{display:"contents"},children:jsxRuntime.jsx("div",{className:n,style:vv,onClick:t,onKeyDown:q=>{q.key==="Escape"&&t(),Pt.current&&qu(Pt.current,q.nativeEvent)&&q.preventDefault();let ve=q.target instanceof HTMLButtonElement||q.target instanceof HTMLSelectElement;if(q.key==="Enter"&&!ve){let Wt=q.target;if(Wt instanceof HTMLElement&&Wt.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:yv,onClick:q=>q.stopPropagation(),onMouseDown:q=>q.stopPropagation(),children:[jsxRuntime.jsx("div",{style:xv,children:o("dialogs.paragraph.title")}),jsxRuntime.jsx("div",{style:Sv,children:jsxRuntime.jsxs("div",{style:Tv,children:[jsxRuntime.jsxs("div",{style:Vu,children:[jsxRuntime.jsx("div",{style:ir,children:o("dialogs.paragraph.general")}),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-alignment`,children:o("dialogs.paragraph.alignment")}),jsxRuntime.jsxs("select",{id:`${Ie}-alignment`,style:wt,value:ce.alignment?"":l,onChange:q=>{at("alignment"),c(q.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:ir,children:o("dialogs.paragraph.indentation")}),Wn("beforeText",s,d,"indentLeft"),Wn("afterText",m,p,"indentRight"),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-special`,children:o("dialogs.paragraph.special")}),jsxRuntime.jsxs("select",{id:`${Ie}-special`,style:wt,value:ce.special?"":g,onChange:q=>{at("special"),u(q.target.value);},"aria-label":o("dialogs.paragraph.special"),children:[ce.special?jsxRuntime.jsx("option",{value:"",children:pt("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:gt,htmlFor:`${Ie}-by`,children:o("dialogs.paragraph.by")}),jsxRuntime.jsx("input",{id:`${Ie}-by`,type:"number",style:wt,min:0,step:.1,value:ce.special?"":ar(f),placeholder:ce.special?pt("special"):void 0,onChange:q=>{at("special"),b(Math.max(0,Ka(Number(q.target.value)||0)));},"aria-label":o("dialogs.paragraph.by")}),jsxRuntime.jsx("span",{style:lr,children:o("dialogs.paragraph.unitInches")})]}):null,jsxRuntime.jsx("div",{style:ir,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(q=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("span",{style:{...gt,color:"var(--doc-text)"},children:o("dialogs.paragraph.tabPositionLabel",{position:cs(q.positionTwips)})}),jsxRuntime.jsx("span",{style:{flex:1,fontSize:13,color:"var(--doc-text-muted)"},children:o(Au[q.alignment])}),jsxRuntime.jsx("button",{type:"button",style:sr,onClick:()=>V(z.filter(ve=>ve!==q)),"aria-label":o("dialogs.paragraph.tabRemoveAt",{position:cs(q.positionTwips)}),children:o("dialogs.paragraph.tabRemove")})]},q.positionTwips)),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-tabPosition`,children:o("dialogs.paragraph.tabPosition")}),jsxRuntime.jsx("input",{id:`${Ie}-tabPosition`,type:"number",style:wt,min:0,step:.1,value:ar(re),onChange:q=>be(Math.max(0,Ka(Number(q.target.value)||0))),"aria-label":o("dialogs.paragraph.tabPosition"),"data-docx-tab-entry":""}),jsxRuntime.jsx("span",{style:lr,children:o("dialogs.paragraph.unitInches")})]}),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-tabAlignment`,children:o("dialogs.paragraph.tabAlignment")}),jsxRuntime.jsxs("select",{id:`${Ie}-tabAlignment`,style:wt,value:he,onChange:q=>U(q.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:gt,htmlFor:`${Ie}-tabLeader`,children:o("dialogs.paragraph.tabLeader")}),jsxRuntime.jsxs("select",{id:`${Ie}-tabLeader`,style:wt,value:Z,onChange:q=>Re(q.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:sr,onClick:me,children:o("dialogs.paragraph.tabAdd")}),jsxRuntime.jsx("button",{type:"button",style:sr,onClick:()=>{de(q=>({...q,tabStops:false})),ne(true),V([]);},children:o("dialogs.paragraph.tabClearAll")})]})]}),jsxRuntime.jsxs("div",{style:Vu,children:[jsxRuntime.jsx("div",{style:ir,children:o("dialogs.paragraph.spacing")}),ya("spaceBefore",y,T,"spaceBefore"),ya("spaceAfter",h,v,"spaceAfter"),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${Ie}-lineSpacing`,children:o("dialogs.paragraph.lineSpacing")}),jsxRuntime.jsxs("select",{id:`${Ie}-lineSpacing`,style:wt,value:ce.lineSpacing?"":S,onChange:q=>{let ve=q.target.value;at("lineSpacing"),x(ve),C(ve===on.current?.lineRule?on.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:gt,htmlFor:`${Ie}-at`,children:o("dialogs.paragraph.at")}),jsxRuntime.jsx("input",{id:`${Ie}-at`,type:"number",style:wt,min:.01,step:S==="multiple"?.01:1,value:ce.lineSpacing?"":w,disabled:ce.lineSpacing,onChange:q=>{let ve=q.target.value.trim();C(ve===""?S==="multiple"?1.08:12:Number(ve)||0);},"aria-label":o("dialogs.paragraph.at")}),jsxRuntime.jsx("span",{style:lr,children:S==="multiple"?"":o("dialogs.paragraph.unitPoints")})]}),yo("contextualSpacing",k,R),jsxRuntime.jsx("div",{style:ir,children:o("dialogs.paragraph.pagination")}),yo("keepNext",_,L),yo("widowControl",M,E),yo("keepLines",F,I),yo("pageBreakBefore",D,ae)]})]})}),jsxRuntime.jsxs("div",{style:Pv,children:[Pl?jsxRuntime.jsx("span",{role:"alert",style:hv,children:o("dialogs.paragraph.refused")}):null,jsxRuntime.jsx("button",{type:"button",style:sr,onClick:t,children:o("dialogs.paragraph.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...sr,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 $u=nt.createContext(null);function Wu({children:e}){let[t,n]=nt.useState(false),o=nt.useRef(null),r=nt.useMemo(()=>({open:a=>{o.current=a??document.activeElement,n(true);}}),[]),i=nt.useCallback(()=>{n(false);let a=o.current;o.current=null,a instanceof HTMLElement&&a.isConnected&&a.focus({preventScroll:true});},[]);return jsxRuntime.jsxs($u.Provider,{value:r,children:[e,jsxRuntime.jsx(Mo,{open:t,onClose:i})]})}function Uu(){return nt.useContext($u)}var Nv=["zoom","script","format","list","alignment","styles","font","text","history"],ds=new Set(["review"]),us=24,ju=new Set;function Yu(e,t=Nv){let n=t.filter(r=>e.includes(r));return [...e.filter(r=>!t.includes(r)).reverse(),...n]}function Gu(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 ju;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 Xu(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 Ju=Xu;function Qu(e){if(!(e.available>0))return ju;let t=Gu(e,e.available),n=e.previous;if(!n||n.size===0||t.size>=n.size)return t;let o=Gu(e,e.available-(e.hysteresis));return Xu(o,n)?n:o}function ep(e,t,n,o){return e+t+n+o*2}function tp(e,t){return e+t}function ms(e,t){return e+t}function op(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 ps(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function np(e){return ps(e.columnGap)}function rp(e,t){return e.clientWidth-ps(t.paddingLeft)-ps(t.paddingRight)}var pn="data-toolbar-group",dr="data-toolbar-fixed",gs="data-toolbar-more",Hv=34,fs=new Set;function ip(e,t,n){let o=nt.useRef(null),r=nt.useRef(new Map),i=nt.useRef(Hv),[a,l]=nt.useState(fs),c=nt.useRef(a);c.current=a;let s=nt.useRef({groups:t,order:n});s.current={groups:t,order:n};let d=t.join("\0"),m=n.join("\0"),p=nt.useCallback(()=>{let u=o.current;if(!u||!e)return;let f=getComputedStyle(u),b=np(f),y=rp(u,f),T=u.querySelector(".docx-toolbar__separator"),h=b*2;if(T){let C=getComputedStyle(T),k=op(C);h=ep(T.offsetWidth,k.start,k.end,b);}for(let C of u.querySelectorAll(`[${pn}]`)){let k=C.getAttribute(pn);k&&C.offsetWidth>0&&r.current.set(k,tp(C.offsetWidth,h));}let v=0;for(let C of u.querySelectorAll(`[${dr}]`))C.offsetWidth>0&&(v+=ms(C.offsetWidth,b));let S=u.querySelector(`[${gs}]`);S&&S.offsetWidth>0&&(i.current=ms(S.offsetWidth,b));let x={available:y,widths:r.current,groups:s.current.groups,order:s.current.order,fixed:v,more:i.current,previous:c.current,hysteresis:us},w=Qu(x);Ju(w,c.current)||(c.current=w,l(w));},[e]),g=nt.useCallback(u=>{o.current=u;},[]);return nt.useLayoutEffect(()=>{if(!e){c.current.size>0&&(c.current=fs,l(fs));return}p();},[e,d,p,m]),nt.useEffect(()=>{let u=o.current;if(!e||!u||typeof ResizeObserver>"u")return;let f=0,b=new ResizeObserver(()=>{f===0&&(f=requestAnimationFrame(()=>{f=0,p();}));});b.observe(u);for(let y of u.querySelectorAll(`[${pn}], [${dr}]`))b.observe(y);return ()=>{f!==0&&cancelAnimationFrame(f),b.disconnect();}},[e,d,p,m,a]),{attach:g,overflow:a}}var $v=["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"],sp=nt.createContext({close:()=>{}});function Wv(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function cp({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 dp({slot:e}){let t=J(),n=an(),{close:o}=nt.useContext(sp),{execute:r,isActive:i,isEnabled:a,disabledReason:l,value:c}=le(e),s=X(e),d=editor.chromeSlotIsToggle(e),m=n(t(s?.labelKey??e));return jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__more-command","data-slot":e,disabled:!a,...l?{title:l}:{},...d?{"aria-pressed":i}:{},...i?{"data-active":""}:{},...c!==null?{"data-value":c}:{},onMouseDown:B,onClick:p=>{r(),o(p.detail===0);},children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-icon","aria-hidden":"true",children:Q(s?.paths)}),jsxRuntime.jsx("span",{className:"docx-toolbar__more-command-label",children:m})]})}function up({sections:e,className:t}){let n=J(),[o,r]=nt.useState(false),i=nt.useRef(null),a=nt.useRef(null),l=nt.useRef(null),c=nt.useRef(false),s=nt.useId(),d=n("formattingBar.more"),m=nt.useCallback(u=>{r(false),u&&a.current?.focus();},[]),p=nt.useMemo(()=>({close:m}),[m]);nt.useEffect(()=>{if(!o)return;let u=f=>{let b=f.target;b instanceof Node&&i.current?.contains(b)||r(false);};return document.addEventListener("mousedown",u,true),()=>document.removeEventListener("mousedown",u,true)},[o]),nt.useEffect(()=>{if(!o||!c.current)return;c.current=false;let u=l.current;u&&Wv(u);},[o]);let g=u=>{u.key!=="Escape"||u.defaultPrevented||(u.preventDefault(),m(true));};return jsxRuntime.jsxs("div",{ref:i,className:`docx-toolbar__more${t?` ${t}`:""}`,[gs]:"",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:B,onClick:()=>r(u=>!u),onKeyDown:u=>{u.key==="ArrowDown"&&(u.preventDefault(),c.current=true,r(true));},children:Q($v)}),o?jsxRuntime.jsx(sp.Provider,{value:p,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(u=>jsxRuntime.jsxs("div",{className:"docx-toolbar__more-section",role:"group","aria-label":n(u.labelKey),children:[jsxRuntime.jsx("span",{className:"docx-toolbar__more-heading","aria-hidden":"true",children:n(u.labelKey)}),u.children]},u.id))})}):null]})}function Xv(e,t){return e.value===t.value&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function ur(e){let t=H(),n=nt.useRef(e);n.current=e;let o=nt.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=O(o,Xv),i=nt.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=nt.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 hs=[{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 Ga({className:e,hidden:t,asChild:n,children:o}){let{t:r}=N(),i=J(),{execute:a,value:l,isEnabled:c,disabledReason:s}=ur("image.wrap"),[d,m]=nt.useState(false),p=nt.useRef(null),g=nt.useRef(null),u=nt.useRef(null),f=nt.useId(),b=nt.useMemo(()=>hs.find(x=>x.value===l)??hs[0],[l]),y=X("image.wrap"),T=i(y?.labelKey??"formattingBar.imageWrap");nt.useEffect(()=>{if(!d)return;let x=C=>{let k=p.current;k&&C.target instanceof Node&&k.contains(C.target)||m(false);},w=C=>{C.key==="Escape"&&(C.preventDefault(),m(false),g.current?.focus());};return document.addEventListener("mousedown",x,true),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",x,true),document.removeEventListener("keydown",w);}},[d]);let h=nt.useCallback(x=>{m(false),a(x);},[a]);if(t)return null;let v=r("imageWrap.tooltipPrefix",{label:r(b.labelKey)}),S={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":T,title:s??v,onMouseDown:B,onClick:()=>m(x=>!x)};return jsxRuntime.jsxs("div",{ref:p,className:"docx-toolbar__image-wrap",children:[n?jsxRuntime.jsx(j,{...S,children:o}):jsxRuntime.jsx("button",{...S,children:o??Q(y?.paths)}),d?jsxRuntime.jsx("div",{ref:u,id:f,role:"menu",className:"docx-toolbar__image-wrap-menu","aria-label":r("imageWrap.menu.ariaLabel"),onMouseDown:x=>x.stopPropagation(),children:hs.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:B,onClick:()=>h(x.value),children:r(x.labelKey)},x.value))}):null]})}Ga.docxSlot="image.wrap";var pr=Object.assign(Ga,{docxSlot:"image.wrap"});function ja({className:e,hidden:t,asChild:n,children:o}){let{t:r}=N(),i=J(),{execute:a,value:l,isEnabled:c,disabledReason:s}=ur("image.altText"),[d,m]=nt.useState(false),[p,g]=nt.useState(""),u=nt.useRef(null),f=nt.useRef(null),b=nt.useId();nt.useEffect(()=>{d&&g(l??"");},[d,l]),nt.useEffect(()=>{if(!d)return;let S=w=>{let C=u.current;C&&w.target instanceof Node&&C.contains(w.target)||m(false);},x=w=>{w.key==="Escape"&&(w.preventDefault(),m(false),f.current?.focus());};return document.addEventListener("mousedown",S,true),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",S,true),document.removeEventListener("keydown",x);}},[d]);let y=nt.useCallback(()=>{a(p),m(false);},[p,a]);if(t)return null;let T=X("image.altText"),h=i(T?.labelKey??"formattingBar.altText"),v={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":h,title:s??h,onMouseDown:B,onClick:()=>m(S=>!S)};return jsxRuntime.jsxs("div",{ref:u,className:"docx-toolbar__alt-text",children:[n?jsxRuntime.jsx(j,{...v,children:o}):jsxRuntime.jsx("button",{...v,children:o??h}),d?jsxRuntime.jsxs("div",{id:b,role:"dialog","aria-label":r("imageAltText.panelTitle"),className:"docx-toolbar__alt-text-panel",onMouseDown:S=>S.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:p,onChange:S=>g(S.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:()=>m(false),children:r("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:y,children:r("common.apply")})]})]}):null]})}ja.docxSlot="image.altText";var mr=Object.assign(ja,{docxSlot:"image.altText"});var yp=e=>e.image;function vp(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 py(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Ts(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(Ut(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(Ut(t.verticalEmu)):"",relativeToH:"page",relativeToV:"line"}:{positionMode:"frame",horizontalPoints:t.horizontalEmu!==void 0?String(Ut(t.horizontalEmu)):"",verticalPoints:t.verticalEmu!==void 0?String(Ut(t.verticalEmu)):"",relativeToH:t.relativeToH??"page",relativeToV:t.relativeToV??"line"}}function my(e,t){let n=Ts(t);return e.horizontalPoints!==n.horizontalPoints||e.verticalPoints!==n.verticalPoints||e.relativeToH!==n.relativeToH||e.relativeToV!==n.relativeToV}function Ya(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 fy(e,t){let n=Ts(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let s=e.horizontalPoints!==n.horizontalPoints,d=e.verticalPoints!==n.verticalPoints,m=s?Ya(e.horizontalPoints):t.position?.horizontalEmu,p=d?Ya(e.verticalPoints):t.position?.verticalEmu;return s&&m===null?{ok:false}:d&&p===null?{ok:false}:m===void 0||p===void 0?{ok:false}:{ok:true,value:{horizontalEmu:m,verticalEmu:p}}}let o=e.horizontalPoints!==n.horizontalPoints,r=e.verticalPoints!==n.verticalPoints,i=e.relativeToH!==n.relativeToH,a=e.relativeToV!==n.relativeToV,l=o?Ya(e.horizontalPoints):t.position?.horizontalEmu,c=r?Ya(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 Xa(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function Ja(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function Cs({open:e,onClose:t,className:n,triggerRef:o}){let r=H(),{t:i}=N(),a=O(yp),l=nt.useId(),c=nt.useId(),s=nt.useId(),d=nt.useRef(null),m=nt.useRef(null),p=nt.useRef(null),g=nt.useRef(null),[u,f]=nt.useState(null),[b,y]=nt.useState(null),T=m.current,h=T?.canCrop===false,v=T?.canResize===false,S=T?.locks.changeAspect===true,x=T?.kind==="anchored"&&T.canMove===true,w=T?.kind==="inline",C=T?.kind==="anchored"&&T.canMove===false;nt.useEffect(()=>{if(!e){m.current=null,p.current=null,g.current=null;return}if(!a)return;if(m.current=a,r?.surface){let{anchor:ae}=r.surface.state().selection;p.current={paragraphId:ae.paragraphId,offset:ae.offset},g.current=r.surface.session.packageRevision();}y(null);let E=Ts(a),D=a.crop;f({widthPoints:String(Ut(a.widthEmu)),heightPoints:String(Ut(a.heightEmu)),cropLeft:String(D.left),cropTop:String(D.top),cropRight:String(D.right),cropBottom:String(D.bottom),title:a.title,description:a.description,hyperlink:a.hyperlink??"",wrap:a.wrap,lockAspect:a.locks.changeAspect,...E});},[e,a?.id,a?.widthEmu,a?.heightEmu,r]);let k=nt.useCallback(()=>{o?.current?.focus(),r?.focus();},[r,o]),R=nt.useCallback(()=>{t(),k();},[t,k]);nt.useEffect(()=>{if(!e)return;let E=d.current;if(!E)return;let D=vp(E);(D.find(V=>V.id==="image-prop-width"&&!V.hasAttribute("disabled"))??D.find(V=>!V.hasAttribute("disabled"))??E).focus();let z=V=>{if(V.key==="Escape"){V.preventDefault(),R();return}if(V.key!=="Tab")return;let $=vp(E);if($.length===0)return;let ne=document.activeElement,re=$.findIndex(he=>he===ne);if(re===-1)return;V.preventDefault();let be=V.shiftKey?(re-1+$.length)%$.length:(re+1)%$.length;$[be]?.focus();};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[e,R]);let _=nt.useMemo(()=>{let E=T??a;return !E||E.widthEmu<=0?1:E.widthEmu/E.heightEmu},[a,T]),L=nt.useCallback(E=>{f(D=>{if(!D)return D;if(!D.lockAspect)return {...D,widthPoints:E};let ae=Ja(E);if(ae===null)return {...D,widthPoints:E};let z=Math.round(ae/_*100)/100;return {...D,widthPoints:E,heightPoints:String(z)}});},[_]),F=nt.useCallback(E=>{f(D=>{if(!D)return D;if(!D.lockAspect)return {...D,heightPoints:E};let ae=Ja(E);if(ae===null)return {...D,heightPoints:E};let z=Math.round(ae*_*100)/100;return {...D,widthPoints:String(z),heightPoints:E}});},[_]),I=nt.useCallback(()=>{let E=m.current;if(!E?.intrinsic)return;let D=E.intrinsic.pixelWidth*72/E.intrinsic.dpiX,ae=E.intrinsic.pixelHeight*72/E.intrinsic.dpiY;f(z=>z&&{...z,widthPoints:String(Math.round(D*100)/100),heightPoints:String(Math.round(ae*100)/100)});},[a]),M=nt.useCallback(()=>{let E=m.current,D=p.current,ae=g.current;if(!r||!E||!u||!D||ae===null)return;let z={type:"setImageProperties",drawingNodeId:E.id,expectedPackageRevision:ae,selectionParagraphId:D.paragraphId,selectionOffset:D.offset};if(!v){let he=Ja(u.widthPoints),U=Ja(u.heightPoints);if(he===null||U===null){y("imageProperties.errors.invalidDimensions");return}let Z=Gn(he),Re=Gn(U);Z!==E.widthEmu&&(z.widthEmu=Z),Re!==E.heightEmu&&(z.heightEmu=Re);}if(E.canCrop&&!h){let he=Xa(u.cropLeft),U=Xa(u.cropTop),Z=Xa(u.cropRight),Re=Xa(u.cropBottom);if(he===null||U===null||Z===null||Re===null){y("imageProperties.errors.invalidCrop");return}let ce=E.crop;(he!==ce.left||U!==ce.top||Z!==ce.right||Re!==ce.bottom)&&(z.crop={left:he,top:U,right:Z,bottom:Re});}u.title!==E.title&&(z.title=u.title),u.description!==E.description&&(z.description=u.description);let V=u.hyperlink.trim();if(V!==(E.hyperlink??"")&&(z.hyperlink=V===""?null:V),E.canChangeWrap&&u.wrap!==E.wrap&&(z.wrap=u.wrap),E.kind==="anchored"&&E.canMove&&my(u,E)){let he=fy(u,E);if(!he.ok){y("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(he.value,E))){y("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)){R();return}if(!r.can(z).ok){y("imageProperties.errors.refused");return}if(!r.exec(z).ok){y("imageProperties.errors.refused");return}R();},[r,u,h,v,R]);return !e||!u?null:jsxRuntime.jsx("div",{className:`docx-dialog-overlay${n?` ${n}`:""}`,onClick:R,onMouseDown:E=>{E.stopPropagation(),py(E);},children:jsxRuntime.jsxs("div",{ref:d,role:"dialog","aria-modal":"true","aria-labelledby":l,className:"docx-dialog docx-image-properties-dialog",onClick:E=>E.stopPropagation(),onMouseDown:E=>E.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:u.widthPoints,disabled:v,onChange:E=>L(E.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:u.heightPoints,disabled:v,onChange:E=>F(E.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:u.lockAspect,disabled:S,onChange:E=>f(D=>D&&{...D,lockAspect:E.target.checked})}),i("dialogs.imageProperties.lockAspectRatio")]}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__link-button",disabled:h||!T?.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")}),w?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionUnavailable")}):null,C?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionLocked")}):null,x?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u.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:u.relativeToH??"page",onChange:E=>f(D=>D&&{...D,relativeToH:E.target.value}),children:editor.DRAWING_REL_FROM_H.map(E=>jsxRuntime.jsx("option",{value:E,children:i(`dialogs.imagePosition.relativeOptions.${E}`)},E))})]}),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:u.relativeToV??"line",onChange:E=>f(D=>D&&{...D,relativeToV:E.target.value}),children:editor.DRAWING_REL_FROM_V.map(E=>jsxRuntime.jsx("option",{value:E,children:i(`dialogs.imagePosition.relativeOptions.${E}`)},E))})]})]}):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:u.horizontalPoints,onChange:E=>f(D=>D&&{...D,horizontalPoints:E.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:u.verticalPoints,onChange:E=>f(D=>D&&{...D,verticalPoints:E.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:u.title,onChange:E=>f(D=>D&&{...D,title:E.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:u.description,onChange:E=>f(D=>D&&{...D,description:E.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:u.hyperlink,onChange:E=>f(D=>D&&{...D,hyperlink:E.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:u.wrap,disabled:T?.canChangeWrap===false,onChange:E=>f(D=>D&&{...D,wrap:E.target.value}),children:editor.IMAGE_WRAP_TARGETS.map(E=>jsxRuntime.jsx("option",{value:E,children:i(`imageWrap.targets.${E}`)},E))})]}),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:h,value:u.cropLeft,onChange:E=>f(D=>D&&{...D,cropLeft:E.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:h,value:u.cropTop,onChange:E=>f(D=>D&&{...D,cropTop:E.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:h,value:u.cropRight,onChange:E=>f(D=>D&&{...D,cropRight:E.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:h,value:u.cropBottom,onChange:E=>f(D=>D&&{...D,cropBottom:E.target.value})})]}),h?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:R,children:i("common.cancel")}),jsxRuntime.jsx("button",{type:"button",className:"docx-dialog__button docx-dialog__button--primary",onClick:M,children:i("common.apply")})]})]})})}function Qa({className:e,hidden:t,asChild:n,children:o}){let r=H(),{t:i}=N(),a=O(yp),[l,c]=nt.useState(false),s=nt.useRef(null),d={type:"setImageProperties",description:"probe"},m=r&&a?r.can(d):null,p=m?.ok===true,g=m&&!m.ok?m.reason:null;if(t)return null;let u=X("image.properties"),f={type:"button",ref:s,className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"image.properties",disabled:!p,...p?{}:{"data-disabled":""},"aria-label":i("formattingBar.imagePropertiesShortcut"),title:g??i("formattingBar.imagePropertiesShortcut"),onMouseDown:B,onClick:()=>c(true)};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n?jsxRuntime.jsx(j,{...f,children:o}):jsxRuntime.jsx("button",{...f,children:o??Q(u?.paths)}),jsxRuntime.jsx(Cs,{open:l,onClose:()=>c(false),triggerRef:s})]})}Qa.docxSlot="image.properties";var gn=Object.assign(Qa,{docxSlot:"image.properties"});function Ae(e){return Object.assign(n=>jsxRuntime.jsx(So,{slot:e,...n}),{docxSlot:e})}var xp=Ae("history.undo"),Sp=Ae("history.redo"),Tp=Ae("text.bold"),Cp=Ae("text.italic"),Pp=Ae("text.underline"),Ep=Ae("text.strike"),wp=Ae("format.clear"),Rp=Ae("script.super"),kp=Ae("script.sub"),Mp=Ae("alignment.left"),Ip=Ae("alignment.center"),_p=Ae("alignment.right"),Dp=Ae("alignment.justify"),Np=Ae("list.bullet"),Lp=Ae("list.numbered"),Fp=Ae("list.outdent"),Ap=Ae("list.indent");var Hp=Ae("table.insert"),Op=Ae("review.comments");function vy({className:e,hidden:t,icon:n,asChild:o,children:r}){let i=H(),{openAtCaret:a}=$l(),l=editor.chromeProbeForSlot("text.link"),c=i&&l?i.can(l):null,s=c?.ok===true,{t:d}=N(),m=i18n.localizeDisabledReason(c&&!c.ok?c.reason:null,d),p=J();if(t)return null;let g=X("text.link"),u=p(g?.labelKey??"text.link"),f={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":"text.link",disabled:!s,...s?{}:{"data-disabled":""},"aria-label":u,title:m??u,onMouseDown:B,onClick:()=>a()};return o?jsxRuntime.jsx(j,{...f,children:r}):jsxRuntime.jsx("button",{...f,children:n??r??Q(g?.paths)})}var Ps=Object.assign(vy,{docxSlot:"text.link"});function yy({className:e,hidden:t}){let n=H(),{onSave:o}=nt.useContext(xo),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:B,onClick:()=>o?.(),children:Q(i?.paths)})}var Es=Object.assign(yy,{docxSlot:"file.save"});function Io({className:e}){return jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical",className:`docx-toolbar__separator${e?` ${e}`:""}`})}function bn(e){let t=e?.closest(".docx-editor")??null;for(;t&&!t.querySelector(".docx-pages");)t=t.parentElement?.closest(".docx-editor")??null;return t}var Ty=e=>({zoom:e.zoom,mode:e.zoomMode}),Cy=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,Zp={type:"fixed"};function ws(){let e=H(),{zoom:t,mode:n}=O(Ty,Cy),o=nt.useCallback(i=>{e?.setZoom(i);},[e]),r=nt.useCallback(i=>{e?.setZoomMode(i);},[e]);return nt.useMemo(()=>{let i=n??Zp,a=nr(t,"out"),l=nr(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(Zp),o(1);},zoomIn:()=>l!==null&&o(l),zoomOut:()=>a!==null&&o(a),canZoomIn:!!e&&l!==null,canZoomOut:!!e&&a!==null,levels:La}},[e,t,n,o,r])}var hr=2,vr=3276,br=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],wy=e=>e.formatting?.fontSizePt??null;function zp(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Vp(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 Wp(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:B,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:B,onClick:e.onIncrease,children:"+"})]})}function Ry(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<hr||o>vr?null:o}function ky({className:e,hidden:t}){let n=H(),o=O(wy),{isEnabled:r,disabledReason:i}=le("font.size"),a=J(),[l,c]=nt.useState(false),[s,d]=nt.useState(null),m=nt.useRef(null),p=nt.useRef(null),g=nt.useCallback(S=>{if(!n)return;let x=editor.commandForSlotValue("font.size",S);x&&n.can(x).ok&&n.exec(x);},[n]),u=nt.useCallback(S=>{g(Math.min(vr,Math.max(hr,Math.round(S*2))));},[g]),f=nt.useCallback(S=>{c(false),d(null),p.current?.blur(),S&&My(m.current);},[]);if(nt.useEffect(()=>{if(!l)return;let S=x=>{let w=m.current;w&&x.target instanceof Node&&w.contains(x.target)||(c(false),d(null));};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]),t)return null;let b=r&&o!==null,y=o===null?"\u2014":String(Math.round(o*2)/2),T=s??y,h=o===null?null:Math.round(o*2)/2,v=()=>{if(s===null)return;let S=Ry(s);S!==null&&g(S);};return jsxRuntime.jsxs("span",{ref:m,className:"docx-toolbar__font-size","data-slot":"font.size",title:i??void 0,children:[jsxRuntime.jsx(Wp,{className:e,groupLabel:a("fontSize.label"),decreaseLabel:a("fontSize.decrease"),increaseLabel:a("fontSize.increase"),middle:jsxRuntime.jsx("input",{ref:p,type:"text",inputMode:"decimal",className:"docx-toolbar__stepper-value docx-toolbar__stepper-value--boxed docx-toolbar__font-size-input",value:T,disabled:!r,role:"combobox","aria-expanded":l,"aria-haspopup":"listbox","aria-label":a("fontSize.label"),autoComplete:"off",onChange:S=>{d(S.target.value),c(true);},onFocus:S=>{S.target.select(),c(true);},onClick:()=>c(true),onKeyDown:S=>{S.key==="Enter"?(S.preventDefault(),v(),f(true)):S.key==="Escape"?(S.preventDefault(),f(true)):(S.key==="ArrowDown"||S.key==="ArrowUp")&&(S.preventDefault(),c(true),o!==null&&u(S.key==="ArrowDown"?Vp(o,br,hr/2):zp(o,br,vr/2)));},onBlur:()=>{v(),d(null);}}),canDecrease:b&&Math.round(o*2)>hr,canIncrease:b&&Math.round(o*2)<vr,onDecrease:()=>u(Vp(o??0,br,hr/2)),onIncrease:()=>u(zp(o??0,br,vr/2))}),l&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox","aria-label":a("fontSize.listLabel"),children:br.map(S=>{let x=h===S;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":x,...x?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>{u(S),f(true);},children:S},S)})}):null]})}function My(e){(bn(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}var Ms=Object.assign(ky,{docxSlot:"font.size"});function Iy({className:e,hidden:t}){let n=H(),{zoom:o,isFit:r,mode:i,setZoom:a,setMode:l,zoomIn:c,zoomOut:s,canZoomIn:d,canZoomOut:m,levels:p}=ws(),g=J(),[u,f]=nt.useState(false),b=nt.useRef(null);nt.useEffect(()=>{if(!u)return;let x=w=>{let C=b.current;C&&w.target instanceof Node&&C.contains(w.target)||f(false);};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[u]);let y=nt.useCallback(x=>{f(false),a(x);},[a]),T=nt.useCallback(x=>{f(false),l(x==="auto"?"auto":editor.FIT_WIDTH_ZOOM_MODE);},[l]);if(t)return null;let h=`${Math.round(o*100)}%`,v=editor.sameZoomMode(i,editor.AUTO_ZOOM_MODE),S=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(Wp,{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":u,"aria-label":g("zoom.zoomLevel"),onMouseDown:B,onClick:()=>f(x=>!x),children:[h,jsxRuntime.jsx("span",{className:"docx-toolbar__picker-caret","aria-hidden":"true",children:"\u25BE"})]}),canDecrease:m,canIncrease:d,onDecrease:s,onIncrease:c}),u?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":v,...v?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>T("auto"),children:g("zoom.automatic")}),jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":S,...S?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>T("fit-width"),children:g("zoom.fitWidth")}),jsxRuntime.jsx("hr",{className:"docx-toolbar__menu-separator",role:"presentation"}),p.map(x=>{let w=!r&&Math.abs(x-o)<.001;return jsxRuntime.jsx("button",{type:"button",role:"option","aria-selected":w,...w?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>y(x),children:`${Math.round(x*100)}%`},x)})]}):null]})}var Is=Object.assign(Iy,{docxSlot:"zoom.level"});var Ly=[1,1.15,1.5,2,2.5,3],jp=10,Yp=0,Fy=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),Ay=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function Hy({className:e,hidden:t}){let n=H(),o=O(Fy,Ay),{isEnabled:r,disabledReason:i}=le("list.lineSpacing"),a=le("paragraph.dialog"),l=Uu(),c=J(),[s,d]=nt.useState(false),m=nt.useRef(null),p=nt.useRef(null);nt.useEffect(()=>{if(!s)return;let h=v=>{let S=m.current;S&&v.target instanceof Node&&S.contains(v.target)||d(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]);let g=nt.useCallback(h=>{if(d(false),!n)return;let v=editor.commandForSlotValue("list.lineSpacing",h);v&&n.can(v).ok&&n.exec(v);},[n]),u=nt.useCallback((h,v)=>{if(d(false),!n)return;let S={type:"setParagraphSpacing",[h]:v};n.can(S).ok&&n.exec(S);},[n]);if(t)return null;let f=X("list.lineSpacing"),b=(o.spaceBeforePt??0)>0,y=(o.spaceAfterPt??0)>0,T=o.lineSpacing?.rule==="multiple"?o.lineSpacing?.value??null:null;return jsxRuntime.jsxs("span",{ref:m,className:"docx-toolbar__line-spacing","data-slot":"list.lineSpacing",children:[jsxRuntime.jsxs("button",{ref:p,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:B,onClick:()=>d(h=>!h),children:[Q(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:[Ly.map(h=>{let v=T===h;return jsxRuntime.jsx("button",{type:"button",role:"menuitemradio","aria-checked":v,...v?{"data-selected":""}:{},className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>g(h),children:Number.isInteger(h*10)?h.toFixed(1):h.toFixed(2)},h)}),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:B,onClick:()=>{d(false),l?.open(p.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:B,onClick:()=>u("beforePt",b?Yp:jp),children:c(b?"lineSpacing.removeSpaceBefore":"lineSpacing.addSpaceBefore")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-toolbar__menu-item",onMouseDown:B,onClick:()=>u("afterPt",y?Yp:jp),children:c(y?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var Ds=Object.assign(Hy,{docxSlot:"list.lineSpacing"});var zy=[{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"}],Xp=[{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"}],Jp=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],ei=["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"],Xt=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 Vy(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?[Xt(50),Xt(35),Xt(25),Xt(15),Xt(5)]:n>=.8?[st(10),st(25),st(50),st(75),st(90)]:[Xt(80),Xt(60),Xt(40),st(25),st(50)]}var $y=/^[0-9A-Fa-f]{6}$/;function Wy(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 Uy(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 ti({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":""}:{},...Uy(t.replace("#",""))?{"data-light":""}:{},onMouseDown:B,onClick:()=>r(e)})}function Gy({apply:e,label:t,current:n,themeHexes:o}){let r=o.map(Vy),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(ti,{value:a,css:`#${a.toLowerCase()}`,title:t(ei[l]),selected:n===a,apply:e},`base-${l}`)),i.map(a=>o.map((l,c)=>{let s=r[c][a],d=Wy(l,s.apply);return jsxRuntime.jsx(ti,{value:d,css:`#${d.toLowerCase()}`,title:`${t(ei[c])}, ${t(s.labelKey)}`,selected:n===d,apply:e},`${a}-${c}`)}))]})]})}function jy(e){let{apply:t,label:n,current:o}=e,[r,i]=nt.useState(""),a=$y.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Gy,{...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:zy.map(l=>jsxRuntime.jsx(ti,{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:B,onClick:()=>t(r.toUpperCase()),children:n("colorPicker.apply")})]})]})]})}function Ls({apply:e,current:t}){let n=H(),o=J(),r=n?.getDocumentThemeColors()??[],i=r.length===ei.length?r.map(l=>l.hex):Jp,a=t?.toUpperCase()??null;return jsxRuntime.jsx(jy,{apply:e,label:o,current:a,themeHexes:i})}var Yy=Xp.filter(e=>e.value!=="white");function Xy({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:Yy.map(o=>jsxRuntime.jsx(ti,{value:o.value,css:o.css,title:t(o.labelKey),selected:n===o.value,apply:e},o.value))})]})}function Qp(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 m=H(),{isEnabled:p,disabledReason:g}=le(t),u=J(),[f,b]=nt.useState(false),[y,T]=nt.useState(n),h=nt.useRef(null),v=O(R=>{if(a){let _=R.formatting?.color;return _&&_.kind==="hex"?_.value.toUpperCase():null}return R.formatting?.highlight??null}),S=m?.getDocumentThemeColors()??[],x=S.length===ei.length?S.map(R=>R.hex):Jp;nt.useEffect(()=>{if(!f)return;let R=_=>{let L=h.current;L&&_.target instanceof Node&&L.contains(_.target)||b(false);};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[f]);let w=nt.useCallback(R=>{if(b(false),!m)return;let _=editor.commandForSlotValue(t,R);_&&m.can(_).ok&&(m.exec(_),R!==r.value&&T(R));},[m]),C=nt.useMemo(()=>X(t),[]);if(s)return null;let k=u(C?.labelKey??t);return jsxRuntime.jsxs("div",{ref:h,className:`docx-toolbar__colorsplit${c?` ${c}`:""}`,"data-slot":t,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__button docx-toolbar__colorsplit-main",disabled:!p,...p?{}:{"data-disabled":""},"aria-label":k,title:g??k,onMouseDown:B,onClick:()=>w(y),children:[d??Q(C?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:o(y)},"aria-hidden":"true"})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-toolbar__colorsplit-caret",disabled:!p,...p?{}:{"data-disabled":""},"aria-haspopup":"true","aria-expanded":f,"aria-label":k,title:g??k,onMouseDown:B,onClick:()=>b(R=>!R),children:"\u25BE"}),f?jsxRuntime.jsxs("div",{className:"docx-toolbar__swatch-popup",role:"dialog","aria-label":k,onMouseDown:B,children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:B,onClick:()=>w(r.value),children:[jsxRuntime.jsx("span",{className:`docx-toolbar__swatch-clear-chip${r.value==="none"?" docx-toolbar__swatch-clear-chip--none":""}`,"aria-hidden":"true"}),u(r.labelKey)]}),i({apply:w,label:u,current:v,themeHexes:x})]}):null]})},{docxSlot:t})}var Jy=new Map(Xp.map(e=>[e.value,e.css])),Fs=Qp({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(Ls,{apply:e.apply,current:e.current})}),As=Qp({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>Jy.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(Xy,{...e})});var nx=["alignment.left","alignment.center","alignment.right","alignment.justify"];function rx({className:e,hidden:t}){let n=le("alignment.left"),o=le("alignment.center"),r=le("alignment.right"),i=le("alignment.justify"),a=J(),[l,c]=nt.useState(false),s=nt.useRef(null);if(nt.useEffect(()=>{if(!l)return;let f=b=>{let y=s.current;y&&b.target instanceof Node&&y.contains(b.target)||c(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[l]),t)return null;let d=[n,o,r,i],m=nx.map((f,b)=>({slot:f,control:X(f),state:d[b]})),p=m.find(f=>f.state.isActive)??m[0],g=m.some(f=>f.state.isEnabled),u=a(p.control?.labelKey??p.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":u,title:g?u:p.state.disabledReason??u,onMouseDown:B,onClick:()=>c(f=>!f),children:[Q(p.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:m.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:B,onClick:()=>{f.state.execute(),c(false);},children:Q(f.control?.paths)},f.slot)})}):null]})}var oi=Object.assign(rx,{docxSlot:"alignment"});function Os(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:m=>B(m),onClick:r?void 0:a};return l?jsxRuntime.jsx(j,{...d,children:s}):jsxRuntime.jsx("button",{...d,children:n??s})}var px=Object.freeze([]),mx=e=>e.formatting?.fontFamily??null,fx=e=>e;function ni(){let e=H(),t=O(mx),n=O(fx),o=nt.useMemo(()=>e&&!n.isLoading?e.getAvailableFonts():px,[e,n]),{isEnabled:r}=le("font.family"),i=nt.useCallback(a=>{if(!e)return;let l=editor.commandForSlotValue("font.family",a);l&&e.can(l).ok&&e.exec(l);},[e]);return nt.useMemo(()=>({value:t,setValue:i,options:o,isEnabled:r}),[t,i,o,r])}var om=nt.createContext(null);function Zs(){return nt.useContext(om)}function qs({asChild:e,className:t,children:n}){let o=Zs(),r=J();if(!o)return null;let i=r(X("font.family")?.labelKey??"font.family"),a={onClick:()=>o.setOpen(!o.open),onMouseDown:B,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})}qs.docxToolbarPart=true;var gx=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"]]),bx=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function nm({asChild:e,className:t,children:n}){let o=Zs(),r=J();if(!o||!o.open)return null;let i={role:"listbox",className:`docx-toolbar__menu docx-toolbar__font-family-content${t?` ${t}`:""}`},a;return n!==void 0?a=n:a=bx.map(c=>({...c,fonts:o.options.filter(s=>(gx.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(rm,{value:d},d))]},c.category)),e?jsxRuntime.jsx(j,{...i,children:a}):jsxRuntime.jsx("div",{...i,children:a})}function rm({value:e,asChild:t,className:n,children:o}){let r=Zs();if(!r)return null;let i=r.value===e,a={role:"option","aria-selected":i,...i?{"data-selected":""}:{},onMouseDown:B,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 hx({hidden:e,asChild:t,className:n,children:o}){let r=ni(),[i,a]=nt.useState(false),l=nt.useRef(null);nt.useEffect(()=>{if(!i)return;let m=p=>{let g=l.current;g&&p.target instanceof Node&&g.contains(p.target)||a(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[i]);let c=nt.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"},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qs,{}),jsxRuntime.jsx(nm,{})]});return jsxRuntime.jsx(om.Provider,{value:c,children:t?jsxRuntime.jsx(j,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var Ks=Object.assign(hx,{docxSlot:"font.family",Trigger:qs,Content:nm,Item:rm});var yx={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},xx=new Set(["Title","Heading1","Heading2","Heading3"]),Sx={Subtitle:"666666"},Tx="#4a6c8c";function am(e){let t=yx[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??xx.has(e.styleId))&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let r=e.color??Sx[e.styleId];return r?o.color=`#${r}`:e.styleId.startsWith("Heading")&&(o.color=Tx),o}var Cx=/^heading ([1-9])$/;function Vs(e,t){let n=e||t,o=Cx.exec(n);return o?`Heading ${o[1]}`:n}function im(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:Vs(t.name,t.styleId),priority:99}))}function _x(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 Dx=Object.freeze([]),Nx=e=>e.formatting?.styleId??null,Lx=e=>e;function ri(){let e=H(),t=O(Nx),n=O(Lx),o=nt.useMemo(()=>e&&!n.isLoading?e.getDocumentStyles().filter(a=>a.type==="paragraph").map(a=>({styleId:a.styleId,name:Vs(a.name,a.styleId),preview:a.preview})):Dx,[e,n]),{isEnabled:r}=le("styles.style"),i=nt.useCallback(a=>{if(!e)return;let l=editor.commandForSlotValue("styles.style",a);l&&e.can(l).ok&&e.exec(l);},[e]);return nt.useMemo(()=>({value:t,setValue:i,options:o,isEnabled:r}),[t,i,o,r])}var lm=nt.createContext(null);function Ws(){return nt.useContext(lm)}function Us({asChild:e,className:t,children:n}){let o=Ws(),r=J();if(!o)return null;let i=X("styles.style"),a=r(i?.labelKey??"styles.style"),l={onClick:()=>o.setOpen(!o.open),onMouseDown:B,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})}Us.docxToolbarPart=true;function sm({asChild:e,className:t,children:n}){let o=Ws();if(!o||!o.open)return null;let r={role:"listbox",className:`docx-toolbar__menu docx-toolbar__style-content${t?` ${t}`:""}`},i=n??o.options.map(a=>jsxRuntime.jsx(cm,{value:a.styleId},a.styleId));return e?jsxRuntime.jsx(j,{...r,children:i}):jsxRuntime.jsx("div",{...r,children:i})}function cm({value:e,asChild:t,className:n,children:o}){let r=Ws();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:B,onClick:()=>{r.setValue(e),r.setOpen(false);},className:`docx-toolbar__style-item${n?` ${n}`:""}`},c=o??jsxRuntime.jsx("span",{style:a?_x(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 Fx({hidden:e,asChild:t,className:n,children:o}){let r=ri(),[i,a]=nt.useState(false),l=nt.useRef(null);nt.useEffect(()=>{if(!i)return;let m=p=>{let g=l.current;g&&p.target instanceof Node&&g.contains(p.target)||a(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[i]);let c=nt.useMemo(()=>({...r,open:i,setOpen:a}),[r,i]);if(e)return null;let s={className:`docx-toolbar__style${n?` ${n}`:""}`,"data-slot":"styles.style"},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Us,{}),jsxRuntime.jsx(sm,{})]});return jsxRuntime.jsx(lm.Provider,{value:c,children:t?jsxRuntime.jsx(j,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var Gs=Object.assign(Fx,{docxSlot:"styles.style",Trigger:Us,Content:sm,Item:cm});function um(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),m=Et(),p=t==="showAll"?m.showAll:m.formFill,g=J();if(i)return null;let u=X(n),f=g(u?.labelKey??e),b={type:"button",className:`docx-toolbar__button${r?` ${r}`:""}`,"data-slot":e,disabled:!s,...s?{}:{"data-disabled":""},...p?{"data-active":""}:{},"aria-pressed":p,"aria-label":f,title:d??f,onMouseDown:B,onClick:()=>{t==="showAll"?m.toggleShowAll():m.toggleFormFill();}};return l?jsxRuntime.jsx(j,{...b,children:c}):jsxRuntime.jsx("button",{...b,children:a??c??Q(u?.paths)})},{docxSlot:n})}function Hx({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=J();if(t)return null;let m=X(i),p=d(m?.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":p,title:l??p,onMouseDown:B,onClick:()=>s()};return o?jsxRuntime.jsx(j,{...g,children:r}):jsxRuntime.jsx("button",{...g,children:n??r??Q(m?.paths)})}function Ox({className:e,hidden:t,icon:n,asChild:o,children:r}){let{canRemove:i,removeDisabledReason:a,remove:l}=Et(),c=J();if(t)return null;let s=Ye.remove,d=X(s),m=c(d?.labelKey??"contentControl.remove"),p={type:"button",className:`docx-toolbar__button${e?` ${e}`:""}`,"data-slot":Ye.remove,disabled:!i,...i?{}:{"data-disabled":""},"aria-label":m,title:a??m,onMouseDown:B,onClick:()=>{l();}};return o?jsxRuntime.jsx(j,{...p,children:r}):jsxRuntime.jsx("button",{...p,children:n??r??Q(d?.paths)})}var ai=um(Ye.showAll,"showAll"),ii=um(Ye.formFill,"formFill"),li=Object.assign(Ox,{docxSlot:Ye.remove}),si=Object.assign(Hx,{docxSlot:Ye.inspector}),pm={[Ye.showAll]:ai,[Ye.formFill]:ii,[Ye.inspector]:si,[Ye.remove]:li};function js(e,t){let n=H(),o=nt.useRef(t);o.current=t,nt.useEffect(()=>{if(!n)return;let r=((...i)=>{o.current(...i);});return n.on(e,r)},[n,e]);}var $x=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Xs=nt.createContext(null);function ym(){let e=nt.useContext(Xs);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function Ux(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 Gx(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function jx(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var hm={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function Yx(e,t){let n={};for(let o of $x){let r=editor.tableChromeToolbarState(e,o,t);n[o]={enabled:r.enabled,disabledReason:r.disabledReason};}return n}function Js({children:e}){let t=H(),[n,o]=nt.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,i]=nt.useState(hm);nt.useEffect(()=>(()=>{}),[]);let a=O(nt.useCallback(p=>({table:p.table,editable:p.editable,editingMode:p.editingMode??"editing",headParagraphId:p.selection?.to&&"paraId"in p.selection.to?p.selection.to.paraId:p.selection?.from&&"paraId"in p.selection.from?p.selection.from.paraId:""}),[]),Gx,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),l=nt.useCallback(()=>{if(!t){i(hm);return}let p=Ux(t,t.snapshot());i(g=>jx(g,p)?g:p);},[t]);nt.useEffect(()=>{l();},[l,a]),js("selectionChange",nt.useCallback(()=>{l();},[l]));let c=r.tableKey!=="",s=nt.useMemo(()=>t?Yx(t,n):{},[t,n,r.tableKey,r.selectionKey,r.cellSelectionKey,r.editable,r.editingMode]),d=nt.useCallback((p,g)=>{if(!t)return;let{result:u,nextDraft:f}=editor.runTableChromeCommand(t,p,g,n);u.ok&&f&&o(f);},[t,n]),m=nt.useMemo(()=>({visible:c,draft:n,setDraft:o,slotState:p=>s[p]??{enabled:false,disabledReason:"editor is not ready"},apply:d}),[c,n,s,d]);return jsxRuntime.jsx(Xs.Provider,{value:m,children:e})}function Xx(){let e=nt.useContext(Xs);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function di(e){let t=Xx(),n=t.slotState(e);return nt.useMemo(()=>({visible:t.visible,enabled:n.enabled,disabledReason:n.disabledReason,draft:t.draft,apply:o=>t.apply(e,o)}),[t,e,n])}var Qx='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function Do(e){return [...e.querySelectorAll(Qx)].filter(t=>t.closest('[role="menu"]')===e)}function Qs(e){return [...e.querySelectorAll(".docx-menubar__trigger")]}function ht(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 vt(e,t){let n=t==="first"?e[0]:e[e.length-1];return n?(n.focus(),true):false}function ui(e){(bn(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function tc(e,t,n){nt.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 pi({enabled:e,disabledReason:t,ariaLabel:n}){let{t:o}=N(),r=i18n.localizeDisabledReason(t,o),i=nt.useId(),a=!e&&r?i:void 0;return {reasonId:i,shared:{type:"button",onMouseDown:B,"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 oS='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function xm(e,t,n,o){nt.useEffect(()=>{if(!e)return;let r=n.current,i=o.current;if(!r)return;let a=()=>[...r.querySelectorAll(oS)].filter(s=>s.closest('[role="menu"]')===r);queueMicrotask(()=>{let s=a();(s.find(m=>m.hasAttribute("data-selected")||m.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(),ht(d,document.activeElement,1);return}if(s.key==="ArrowUp"){s.preventDefault(),ht(d,document.activeElement,-1);return}if(s.key==="Home"){s.preventDefault(),vt(d,"first");return}if(s.key==="End"){s.preventDefault(),vt(d,"last");return}if(s.key==="Enter"||s.key===" "){let m=document.activeElement;m instanceof HTMLElement&&d.includes(m)&&(s.preventDefault(),m.click());}};return r.addEventListener("keydown",c),()=>r.removeEventListener("keydown",c)},[e,t,n,o]);}function Sm(e,t,n,o){nt.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 wm(e,t,n){if(e)return o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(!t));}}function cS(e){return Q(editor.tableChromeIconPaths(e))}function Rm(){return nt.createContext(null)}function Bt(e){let t=nt.useContext(e);if(!t)throw new Error("table chrome compound part used outside its root");return t}function nc(e,t,n){let o=Rm();function r({hidden:l,asChild:c,className:s,children:d}){let{visible:m,enabled:p,disabledReason:g,draft:u,apply:f}=di(e),[b,y]=nt.useState(false),T=nt.useRef(null),h=nt.useRef(null);tc(b,y,T);let v=nt.useMemo(()=>({open:b,setOpen:y,enabled:p,disabledReason:g,apply:f,draft:u,triggerRef:h}),[b,p,g,f,u]);if(l||!m)return null;let S={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:v,children:c?jsxRuntime.jsx(j,{...S,ref:T,children:x}):jsxRuntime.jsx("div",{ref:T,...S,children:x})})}function i({asChild:l,className:c,children:s}){let{open:d,setOpen:m,enabled:p,disabledReason:g,triggerRef:u}=Bt(o),f=J(),b=X(e),y=f(b?.labelKey??n),{shared:T,reasonNode:h}=pi({enabled:p,disabledReason:g,ariaLabel:y}),v={...T,ref:u,className:`docx-toolbar__button docx-table-chrome__trigger${c?` ${c}`:""}`,"aria-haspopup":"menu","aria-expanded":d,onClick:p?()=>m(!d):void 0,...l?{tabIndex:p?0:-1,role:"button",onKeyDown:wm(p,d,m)}:{}},S=s??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Q(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,{...v,children:S}),h]}):jsxRuntime.jsxs("button",{...v,children:[S,h]})}i.docxToolbarPart=true;function a({asChild:l,className:c,children:s}){let{open:d,setOpen:m,enabled:p,triggerRef:g}=Bt(o),u=J(),f=nt.useRef(null);if(xm(d&&p,m,f,g),!d||!p)return null;let b=X(e),y=u(b?.labelKey??n),T={ref:f,role:"menu","aria-label":y,className:`docx-table-chrome__panel${c?` ${c}`:""}`,onMouseDown:B};return l?jsxRuntime.jsx(j,{...T,children:s}):jsxRuntime.jsx("div",{...T,children:s})}return {Root:r,Trigger:i,Content:a,Ctx:o}}var Sr=nc("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");function km({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Bt(Sr.Ctx),l=J(),c=editor.TABLE_BORDER_TARGET_OPTIONS.find(p=>p.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:B,onClick:()=>{i(false),r(c.value);}},m=o??cS(c.icon);return t?jsxRuntime.jsx(j,{...d,children:m}):jsxRuntime.jsx("button",{...d,children:m})}function Mm(e){let{children:t}=e;return jsxRuntime.jsx(Sr.Content,{...e,children:t??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(n=>jsxRuntime.jsx(km,{value:n.value},n.value))})})}function dS(e){let{children:t}=e,n=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Sr.Trigger,{}),jsxRuntime.jsx(Mm,{})]});return jsxRuntime.jsx(Sr.Root,{...e,children:n})}var wr=Object.assign(dS,{docxSlot:"table.borderTarget",Trigger:Sr.Trigger,Content:Mm,Item:km}),Tr=nc("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function Im({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Bt(Tr.Ctx),l=J(),c=editor.TABLE_BORDER_STYLE_OPTIONS.find(p=>p.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:B,onClick:()=>{i(false),r(c.value);}},m=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:m}):jsxRuntime.jsx("button",{...d,children:m})}function _m(e){let{children:t}=e;return jsxRuntime.jsx(Tr.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(n=>jsxRuntime.jsx(Im,{value:n.value},n.value))})}function uS(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tr.Trigger,{}),jsxRuntime.jsx(_m,{})]});return jsxRuntime.jsx(Tr.Root,{...e,children:t})}var Rr=Object.assign(uS,{docxSlot:"table.borderStyle",Trigger:Tr.Trigger,Content:_m,Item:Im}),Cr=nc("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function Dm({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Bt(Cr.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,m={type:"button",role:"menuitemradio","aria-checked":d,...d?{"data-selected":""}:{},className:`docx-table-chrome__width-row${n?` ${n}`:""}`,onMouseDown:B,onClick:()=>{i(false),r(s.size);}},p=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,{...m,children:p}):jsxRuntime.jsx("button",{...m,children:p})}function Nm(e){let{children:t}=e;return jsxRuntime.jsx(Cr.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(n=>jsxRuntime.jsx(Dm,{value:String(n.size)},n.size))})}function pS(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Cr.Trigger,{}),jsxRuntime.jsx(Nm,{})]});return jsxRuntime.jsx(Cr.Root,{...e,children:t})}var kr=Object.assign(pS,{docxSlot:"table.borderWidth",Trigger:Cr.Trigger,Content:Nm,Item:Dm});function Lm(e,t,n){let o=n?.defaultHex??"FF0000",r=Rm();function i({hidden:d,asChild:m,className:p,children:g}){let{visible:u,enabled:f,disabledReason:b,draft:y,apply:T}=di(e),[h,v]=nt.useState(false),[S,x]=nt.useState(o),w=nt.useRef(null),C=nt.useRef(null);tc(h,v,w);let k=nt.useMemo(()=>({open:h,setOpen:v,enabled:f,disabledReason:b,apply:T,draft:y,triggerRef:C,lastHex:S,setLastHex:x}),[h,f,b,T,y,S]);if(d||!u)return null;let R={className:`docx-toolbar__colorsplit docx-table-chrome${p?` ${p}`:""}`,"data-slot":e,style:{position:"relative",display:"inline-flex",alignItems:"center",verticalAlign:"middle"}},_=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:k,children:m?jsxRuntime.jsx(j,{...R,ref:w,children:_}):jsxRuntime.jsx("div",{ref:w,...R,children:_})})}function a({asChild:d,className:m,children:p}){let{enabled:g,disabledReason:u,apply:f,draft:b,lastHex:y}=Bt(r),T=J(),h=X(e),v=T(h?.labelKey??t),{shared:S,reasonNode:x}=pi({enabled:g,disabledReason:u,ariaLabel:v}),w=e==="table.borderColor"&&b.spec.color.kind==="hex"?b.spec.color.value:y??o,C={...S,className:`docx-toolbar__button docx-toolbar__colorsplit-main${m?` ${m}`:""}`,onClick:g?()=>f({kind:"hex",value:w}):void 0},k=p??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Q(h?.paths),jsxRuntime.jsx("span",{className:"docx-toolbar__colorsplit-bar",style:{backgroundColor:`#${w.toLowerCase()}`},"aria-hidden":"true"})]});return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...C,children:k}),x]}):jsxRuntime.jsxs("button",{...C,children:[k,x]})}a.docxToolbarPart=true;function l({asChild:d,className:m,children:p}){let{open:g,setOpen:u,enabled:f,disabledReason:b,triggerRef:y}=Bt(r),T=J(),h=X(e),v=T(h?.labelKey??t),{shared:S,reasonNode:x}=pi({enabled:f,disabledReason:b,ariaLabel:v}),w={...S,ref:y,className:`docx-toolbar__colorsplit-caret${m?` ${m}`:""}`,"aria-haspopup":"dialog","aria-expanded":g,onClick:f?()=>u(!g):void 0,...d?{tabIndex:f?0:-1,role:"button",onKeyDown:wm(f,g,u)}:{}},C=p??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...w,children:C}),x]}):jsxRuntime.jsxs("button",{...w,children:[C,x]})}l.docxToolbarPart=true;function c({asChild:d,className:m,children:p,clearFill:g}){let{open:u,setOpen:f,enabled:b,apply:y,draft:T,triggerRef:h,lastHex:v,setLastHex:S}=Bt(r),x=J(),w=nt.useRef(null);if(Sm(u&&b,f,w,h),!u||!b)return null;let C=x(t),k=e==="table.borderColor"&&T.spec.color.kind==="hex"?T.spec.color.value:v??o,R={ref:w,role:"dialog","aria-label":C,className:`docx-toolbar__swatch-popup docx-table-chrome__panel${m?` ${m}`:""}`,onMouseDown:B},_=p??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[g?jsxRuntime.jsxs("button",{type:"button",className:"docx-toolbar__swatch-clear",onMouseDown:B,onClick:()=>{f(false),y(null),ui(h.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(Ls,{apply:L=>{f(false),S?.(L),y({kind:"hex",value:L}),ui(h.current);},current:k})]});return d?jsxRuntime.jsx(j,{...R,children:_}):jsxRuntime.jsx("div",{...R,children:_})}function s({value:d,css:m,labelKey:p,asChild:g,className:u,children:f}){let{apply:b,setOpen:y,setLastHex:T,triggerRef:h}=Bt(r),v=J(),S=m??`#${d.toLowerCase()}`,x=p?v(p):d,w={type:"button",className:`docx-toolbar__swatch docx-table-chrome__swatch${u?` ${u}`:""}`,style:{backgroundColor:S},"data-value":d,"aria-label":x,title:x,onMouseDown:B,onClick:()=>{y(false),T?.(d),b({kind:"hex",value:d}),ui(h.current);}};return g?jsxRuntime.jsx(j,{...w,children:f}):jsxRuntime.jsx("button",{...w,children:f})}return {Root:i,Main:a,Trigger:l,Content:c,Item:s,Ctx:r}}var Pr=Lm("table.borderColor","table.borderColor",{defaultHex:"000000"});function mS(e){return jsxRuntime.jsx(Pr.Content,{...e,clearFill:false})}function fS(e){return jsxRuntime.jsx(Pr.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function gS(e){return jsxRuntime.jsx(Pr.Root,{...e})}var Mr=Object.assign(gS,{docxSlot:"table.borderColor",Trigger:Pr.Trigger,Content:mS,Item:fS,Main:Pr.Main}),Er=Lm("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function bS(e){return jsxRuntime.jsx(Er.Content,{...e,clearFill:true})}function hS(e){return jsxRuntime.jsx(Er.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function vS(e){return jsxRuntime.jsx(Er.Root,{...e})}var Ir=Object.assign(vS,{docxSlot:"table.cellFill",Trigger:Er.Trigger,Content:bS,Item:hS,Main:Er.Main});function Fm({overrides:e=new Map,separator:t=true}){return ym()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(Io,{}):null,[wr,Mr,Rr,kr,Ir].map(r=>{let i=e.get(r.docxSlot);return i?jsxRuntime.jsx(nt.Fragment,{children:i},r.docxSlot):jsxRuntime.jsx(r,{},r.docxSlot)})]}):null}function Am(){let e=J(),{draft:t}=di("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var ic=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],gi="contextual-table",lc={"zoom.level":Is,"styles.style":Gs,"font.family":Ks,"font.size":Ms,"text.color":Fs,"text.highlight":As,"text.link":Ps,"list.lineSpacing":Ds,"review.editingMode":Ha,"review.authors":Ba,"file.save":Es,...pm,"table.borderTarget":wr,"table.borderColor":Mr,"table.borderStyle":Rr,"table.borderWidth":kr,"table.cellFill":Ir,"image.insert":Yn,"image.properties":gn,"image.wrap":pr,"image.altText":mr},mi={id:gi,labelKey:"formattingBar.groups.table",entries:ic.map(e=>({slot:e,Part:lc[e]}))},Hm=new Map;function SS(e){let t=Hm.get(e);return t||(t=n=>jsxRuntime.jsx(So,{slot:e,...n}),Hm.set(e,t)),t}function TS(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:oi}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(n=>{let o=editor.chromeSlotId(t,n);return {slot:o,Part:lc[o]??SS(o)}})})}var CS=e=>e.image,PS=e=>e.isLoading||e.isOpening===true,ES=e=>e.table!==null;function wS(e){return e==="alignment"||e in lc}function hi(e){let t=un(e,hi);if(t!==null)return t;if(!nt.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 rc(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(rc);let t=hi(e);return t!=null&&ic.includes(t)?true:nt.isValidElement(e)?nt.Children.toArray(e.props.children).some(rc):false}function RS(e,t){return t?true:nt.Children.toArray(e).some(rc)}function kS(e){let t=tt(),{className:n,t:o,onSave:r,preset:i=true,overflow:a=true,children:l}=e,c=nt.useMemo(()=>({t:o,onSave:r}),[o,r]),s=Ta(o),d=O(CS),m=O(PS),p=O(ES),g=nt.useMemo(()=>TS(d),[d]),u=nt.useMemo(()=>new Set(g.flatMap(S=>S.entries.map(x=>x.slot))),[g]),f=nt.useMemo(()=>[...g.map(S=>S.id).filter(S=>!ds.has(S)),...p?[gi]:[]],[g,p]),b=nt.useMemo(()=>Yu(f),[f]),y=i&&a,{attach:T,overflow:h}=ip(y,f,b),v;if(!i)v=l;else {let S=nt.Children.toArray(l),x=new Map,w=new Map,C=[];for(let M of S){let E=hi(M);E&&u.has(E)?x.set(E,M):E&&ic.includes(E)?w.set(E,M):C.push(M);}let k=M=>{let E=x.get(M.slot);if(E)return E;let D=M.Part;return jsxRuntime.jsx(D,{})},R=M=>{let E=w.get(M.slot);if(E)return E;let D=M.Part;return jsxRuntime.jsx(D,{})},_=[],L=[],F=0;for(let M of g){if(h.has(M.id)){let D=M.entries.flatMap(ae=>{let z=Om(ae,x,s,M.labelKey,k);return z===null?[]:[jsxRuntime.jsx(nt.Fragment,{children:z},ae.slot)]});if(D.length===0)continue;L.push({id:M.id,labelKey:M.labelKey,children:D});continue}F>0&&_.push(jsxRuntime.jsx(Io,{},`separator-${M.id}`)),F+=1;let E=ds.has(M.id);_.push(jsxRuntime.jsx("div",{className:"docx-toolbar__group",...E?{[dr]:""}:{[pn]:M.id},children:M.entries.map(D=>jsxRuntime.jsx(nt.Fragment,{children:k(D)},D.slot))},M.id));}let I=h.has(gi);if(p&&I){let M=mi.entries.flatMap(E=>{let D=Om(E,w,s,mi.labelKey,R);return D===null?[]:[jsxRuntime.jsx(nt.Fragment,{children:D},E.slot)]});M.length>0&&L.unshift({id:mi.id,labelKey:mi.labelKey,children:M});}v=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[_,p&&!I?jsxRuntime.jsx(Io,{},"separator-contextual-table"):null,I?null:jsxRuntime.jsx("div",{className:"docx-toolbar__contextual",[pn]:gi,children:jsxRuntime.jsx(Fm,{overrides:w,separator:false})}),C.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[dr]:"",children:C}):null,L.length>0?jsxRuntime.jsx(up,{sections:L}):null]});}return jsxRuntime.jsx(xo.Provider,{value:c,children:jsxRuntime.jsx(Wu,{children:jsxRuntime.jsx("fieldset",{ref:T,disabled:m,role:"toolbar","data-testid":"docx-toolbar",className:`${t}docx-toolbar${n?` ${n}`:""}`,...y?{"data-overflow":""}:{},onMouseDown:B,children:RS(l,i)?jsxRuntime.jsx(Js,{children:v}):v})})})}function Bm(e){if(!e)return false;if(e.type===nt.Fragment){let t=nt.Children.toArray(e.props.children).find(n=>hi(n)!==null);return nt.isValidElement(t)?Bm(t):false}return !!e.props.hidden}function Om(e,t,n,o,r){let i=t.get(e.slot);return Bm(i)?null:i||wS(e.slot)?jsxRuntime.jsx(cp,{label:MS(n,e,o),children:r(e)}):jsxRuntime.jsx(dp,{slot:e.slot})}function MS(e,t,n){let o=t.slot==="alignment"?null:X(t.slot);return e(o?.labelKey??n)}var Dr=Object.assign(kS,{Button:So,Action:Os,Separator:Io,Undo:xp,Redo:Sp,Bold:Tp,Italic:Cp,Underline:Pp,Strike:Ep,Link:Ps,ClearFormatting:wp,Superscript:Rp,Subscript:kp,Alignment:oi,AlignLeft:Mp,AlignCenter:Ip,AlignRight:_p,AlignJustify:Dp,LineSpacing:Ds,BulletList:Np,NumberedList:Lp,Outdent:Fp,Indent:Ap,ImageInsert:Yn,ImageProperties:gn,ImageWrap:pr,ImageAltText:mr,TableInsert:Hp,TableBorderTarget:wr,TableBorderColor:Mr,TableBorderStyle:Rr,TableBorderWidth:kr,TableCellFill:Ir,Comments:Op,FontFamily:Ks,FontSize:Ms,FontColor:Fs,Highlight:As,Zoom:Is,StylePicker:Gs,EditingMode:Ha,Reviewers:Ba,Save:Es,ContentControlShowAll:ai,ContentControlFormFill:ii,ContentControlInspector:si,ContentControlRemove:li});var NS=e=>e.pageSetup??null,LS=e=>e.editable;function No(){let e=H(),t=O(NS),n=O(LS),o=nt.useMemo(()=>n&&e!==null&&e.can({type:"setPageSetup",marginTop:0}).ok,[e,n]),r=nt.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 nt.useMemo(()=>({pageSetup:t,isEnabled:o,apply:r}),[t,o,r])}var cc=[{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}],Um=1440,FS=e=>Math.round(e/Um*100)/100,AS=e=>Math.round(e*Um);function HS(e,t){let n=Math.min(e,t),o=Math.max(e,t);return cc.findIndex(r=>Math.abs(r.width-n)<20&&Math.abs(r.height-o)<20)}var OS={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},BS={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},ZS={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600,color:"var(--doc-text)"},qS={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},zm={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},vi={display:"flex",alignItems:"center",gap:12},yi={width:80,fontSize:13,color:"var(--doc-text-muted)"},xi={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13,backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},KS={fontSize:11,color:"var(--doc-text-muted)",width:16},zS={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},Vm={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},$m=12240,Wm=15840,Qt=1440;function Nr({open:e,onClose:t,className:n}){let{t:o}=N(),{pageSetup:r,isEnabled:i,apply:a}=No(),[l,c]=nt.useState($m),[s,d]=nt.useState(Wm),[m,p]=nt.useState("portrait"),[g,u]=nt.useState(Qt),[f,b]=nt.useState(Qt),[y,T]=nt.useState(Qt),[h,v]=nt.useState(Qt),[S,x]=nt.useState("document"),w=nt.useRef(null),C=nt.useRef("no");nt.useEffect(()=>{if(!e){C.current="no";return}if(C.current==="yes"&&r===null){C.current="no";return}C.current==="yes"||C.current==="loading"&&r===null||(c(r?.pageWidthTwips??$m),d(r?.pageHeightTwips??Wm),p(r?.orientation??"portrait"),u(r?.marginsTwips.top??Qt),b(r?.marginsTwips.bottom??Qt),T(r?.marginsTwips.left??Qt),v(r?.marginsTwips.right??Qt),x("document"),C.current=r===null?"loading":"yes");},[e,r]),nt.useEffect(()=>{e&&w.current?.focus();},[e]);let k=nt.useCallback(I=>{let M=cc[I];M&&(c(m==="landscape"?M.height:M.width),d(m==="landscape"?M.width:M.height));},[m]),R=nt.useCallback(I=>{I!==m&&(p(I),c(s),d(l));},[m,l,s]),_=nt.useCallback(()=>{a({pageWidthTwips:l,pageHeightTwips:s,orientation:m,marginTopTwips:g,marginRightTwips:h,marginBottomTwips:f,marginLeftTwips:y,scope:S})&&t();},[a,l,s,m,g,h,f,y,S,t]);if(!e)return null;let L=HS(l,s),F=(I,M,E)=>jsxRuntime.jsxs("div",{style:vi,children:[jsxRuntime.jsx("label",{style:yi,children:o(`dialogs.pageSetup.${I}`)}),jsxRuntime.jsx("input",{type:"number",style:xi,min:0,max:22,step:.1,value:FS(M),onChange:D=>E(Math.max(0,AS(Number(D.target.value)||0))),"aria-label":o(`dialogs.pageSetup.${I}`)}),jsxRuntime.jsx("span",{style:KS,children:"in"})]});return jsxRuntime.jsx("div",{className:n,style:OS,onClick:t,onKeyDown:I=>{I.key==="Escape"&&t(),I.key==="Enter"&&_();},children:jsxRuntime.jsxs("div",{ref:w,tabIndex:-1,style:BS,onClick:I=>I.stopPropagation(),onMouseDown:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o("dialogs.pageSetup.title"),children:[jsxRuntime.jsx("div",{style:ZS,children:o("dialogs.pageSetup.title")}),jsxRuntime.jsxs("div",{style:qS,children:[jsxRuntime.jsx("div",{style:zm,children:o("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{style:vi,children:[jsxRuntime.jsx("label",{style:yi,children:o("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{style:xi,value:L,onChange:I=>k(Number(I.target.value)),"aria-label":o("dialogs.pageSetup.sizeLabel"),children:[cc.map((I,M)=>jsxRuntime.jsx("option",{value:M,children:o(I.labelKey)},I.labelKey)),L<0&&jsxRuntime.jsx("option",{value:-1,children:o("dialogs.pageSetup.custom")})]})]}),jsxRuntime.jsxs("div",{style:vi,children:[jsxRuntime.jsx("label",{style:yi,children:o("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{style:xi,value:m,onChange:I=>R(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:{...zm,marginTop:4},children:o("dialogs.pageSetup.margins")}),F("top",g,u),F("bottom",f,b),F("left",y,T),F("right",h,v),jsxRuntime.jsxs("div",{style:vi,children:[jsxRuntime.jsx("label",{style:yi,children:o("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{style:xi,value:S,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:zS,children:[jsxRuntime.jsx("button",{type:"button",style:Vm,onClick:t,children:o("common.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...Vm,backgroundColor:"var(--doc-primary)",color:"var(--doc-on-primary)",borderColor:"var(--doc-primary)",opacity:i?1:.5},disabled:!i,onClick:_,children:o("common.apply")})]})]})})}var Lr=nt.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 ot(){return nt.useContext(Lr)}function De(){let{t:e}=ot(),{t}=N();return n=>e?.(n)??t(n)}var WS=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i,US=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var Gm=new TextEncoder;function GS(e,t){if(Gm.encode(e).length<=t)return e;let n=0,o="";for(let r of e){let i=Gm.encode(r).length;if(n+i>t)break;n+=i,o+=r;}return o}function jm(e){let t=GS((e??"").replace(/\.docx$/i,"").replace(US," ").replace(/\s+/g," ").trim().replace(/^[.\s]+/,"").replace(/[.\s]+$/,""),200).trim();return !t||WS.test(t)?"document.docx":`${t}.docx`}function Ym(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 jS="https://github.com/eigenpal/docx-editor/issues/new";function YS(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function Xm(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??YS()}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${t}`,""].join(`
2
+ `),i=new URLSearchParams({title:"[Bug] ",body:r});return `${jS}?${i.toString()}`}function Fr(e){typeof window>"u"||window.open(Xm(e),"_blank","noopener,noreferrer");}var dc=6,Qm=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,m=e["data-value"],p=an(),g=nt.useId(),u=o&&r?g: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}:{},...m!==void 0?{"data-value":m}:{},...i?{"data-active":""}:{},...o?{"data-disabled":"","aria-disabled":true}:{},...i!==void 0?{"aria-checked":i}:{},...u?{"aria-describedby":u}:{},...r?{title:r}:{},onMouseDown:B,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:p(n)}):null,u?jsxRuntime.jsx("span",{id:g,className:"docx-editor-sr-only",children:r}):null]})}function Hr({label:e,labelKey:t,className:n,hidden:o,children:r}){let i=De();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 Zt({slot:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let{execute:i,isActive:a,isEnabled:l,disabledReason:c,value:s}=le(e),{setOpenMenu:d}=ot(),m=De();if(r)return null;let p=X(e),g=m(t??p?.labelKey??e),u=editor.chromeSlotIsToggle(e),f=editor.commandForSlot(e)?.type==="setAlignment";return jsxRuntime.jsx(Ne,{slot:e,icon:Q(p?.paths),...n?{shortcut:m(n)}:{},disabled:!l,...c?{title:c}:{},...u?{active:a}:{},...f?{selected:true}:{},...s!==null?{"data-value":s}:{},onSelect:()=>{i(),d(null);},...o?{className:o}:{},children:g})}Zt.docxMenuRow=true;function tf(e,t,n,o){return Object.assign(({className:i,hidden:a})=>{let l=ot(),c=De(),s=o(l);if(a)return null;let d=X(e),m=c(t??d?.labelKey??e);return jsxRuntime.jsx(Ne,{slot:e,icon:Q(d?.paths),...n?{shortcut:c(n)}:{},disabled:!s,onSelect:()=>{s?.(),l.setOpenMenu(null);},...i?{className:i}:{},children:m})},{docxSlot:e})}var pc=tf("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),mc=tf("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave);function oT({className:e,hidden:t}){let n=H(),o=ot(),r=De(),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"),m=l&&!!o.onPageSetup;return jsxRuntime.jsx(Ne,{slot:"file.pageSetup",icon:Q(s?.paths),disabled:!m,...c?{title:c}:{},onSelect:()=>{o.onPageSetup?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}function nT({className:e,hidden:t}){let n=H(),o=ot(),r=De(),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=X("paragraph.dialog"),d=r(s?.labelKey??"lineSpacing.options"),m=l&&!!o.onParagraphDialog;return jsxRuntime.jsx(Ne,{slot:"paragraph.dialog",icon:Q(s?.paths),disabled:!m,...c?{title:c}:{},onSelect:()=>{o.onParagraphDialog?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}var rT=Object.assign(nT,{docxSlot:"paragraph.dialog"}),fc=Object.assign(oT,{docxSlot:"file.pageSetup"});function aT({className:e,hidden:t}){let n=jn(),o=ot(),r=De();if(t)return null;let i=X("image.insert"),a=r(i?.labelKey??"toolbar.image"),l=n?.isEnabled??false,c=n?.disabledReason??null;return jsxRuntime.jsx(Ne,{slot:"image.insert",icon:Q(i?.paths),disabled:!l,...c?{title:c}:{},onSelect:()=>{n?.openFilePicker(),o.setOpenMenu(null);},...e?{className:e}:{},children:a})}var gc=Object.assign(aT,{docxSlot:"image.insert"}),Ar=8;function kt({labelKey:e,paths:t,className:n,children:o}){let r=De(),[i,a]=nt.useState(false),l=nt.useRef(null),c=nt.useRef(null),s=nt.useId(),d=r(e),[m,p]=nt.useState(null);return nt.useLayoutEffect(()=>{if(!i){p(null);return}let g=l.current,u=c.current,f=g?.ownerDocument.defaultView;if(!g||!u||!f)return;let b=g.getBoundingClientRect(),y=u.offsetWidth,T=u.offsetHeight,h=b.right+y>f.innerWidth-Ar;p({left:h?Math.max(Ar,b.left-y):Math.min(b.right,f.innerWidth-y-Ar),top:Math.max(Ar,Math.min(b.top-4,f.innerHeight-T-Ar))});},[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&&vt(Do(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:B,onFocus:()=>a(true),onClick:()=>a(true),children:[jsxRuntime.jsx("span",{className:"docx-menubar__item-icon","aria-hidden":"true",children:Q(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:m?{position:"fixed",left:m.left,top:m.top}:{position:"fixed",visibility:"hidden"},onKeyDown:g=>{let u=c.current;if(!u)return;let f=Do(u);g.key==="ArrowDown"?(g.preventDefault(),g.stopPropagation(),ht(f,document.activeElement,1)):g.key==="ArrowUp"&&(g.preventDefault(),g.stopPropagation(),ht(f,document.activeElement,-1));},children:o}):null]})}function Ti({slot:e="table.insert",className:t}){let n=H(),{isEnabled:o}=le(e),{setOpenMenu:r}=ot(),i=De(),[a,l]=nt.useState(null),[c,s]=nt.useState({rows:1,cols:1}),d=nt.useRef(null),m=nt.useCallback((u,f)=>{if(!n||!o)return;let b={type:"insertTable",rows:u,cols:f};n.can(b).ok&&(n.exec(b),r(null),n.focus());},[n,o,r]),p=nt.useCallback(u=>{s(f=>{let b={rows:Math.min(Qm,Math.max(1,f.rows+(u.rows??0))),cols:Math.min(dc,Math.max(1,u.toCol??f.cols+(u.cols??0)))};return l(b),queueMicrotask(()=>d.current?.querySelector(`[data-cell="${b.rows}x${b.cols}"]`)?.focus()),b});},[]),g=[];for(let u=1;u<=Qm;u+=1){let f=[];for(let b=1;b<=dc;b+=1){let y=!!a&&u<=a.rows&&b<=a.cols;f.push(jsxRuntime.jsx("button",{type:"button",role:"gridcell","data-cell":`${u}x${b}`,className:"docx-menubar__grid-cell",tabIndex:c.rows===u&&c.cols===b?0:-1,...y?{"data-filled":""}:{},"aria-label":`${b} \xD7 ${u}`,onMouseDown:B,onMouseEnter:()=>l({rows:u,cols:b}),onFocus:()=>l({rows:u,cols:b}),onClick:()=>m(u,b)},b));}g.push(jsxRuntime.jsx("div",{role:"row",className:"docx-menubar__grid-row",children:f},u));}return jsxRuntime.jsxs("div",{ref:d,role:"grid","aria-label":i("toolbar.insertTable"),className:`docx-menubar__grid${t?` ${t}`:""}`,onMouseLeave:()=>l(null),onKeyDown:u=>{if(u.key==="ArrowRight")p({cols:1});else if(u.key==="ArrowLeft")p({cols:-1});else if(u.key==="ArrowDown")p({rows:1});else if(u.key==="ArrowUp")p({rows:-1});else if(u.key==="Home")p({toCol:1});else if(u.key==="End")p({toCol:dc});else return;u.preventDefault(),u.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 iT({entry:e}){let{isEnabled:t}=le(e.slot),n=X(e.slot);return t?jsxRuntime.jsx(kt,{labelKey:e.labelKey??n?.labelKey??e.slot,paths:n?.paths,children:jsxRuntime.jsx(Ti,{slot:e.slot})}):jsxRuntime.jsx(Zt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{}})}function Fo({className:e}){return jsxRuntime.jsx("div",{role:"separator",className:`docx-toolbar__menu-separator${e?` ${e}`:""}`})}function Or({entry:e}){return e.kind==="separator"?jsxRuntime.jsx(Fo,{}):e.kind==="submenu"?jsxRuntime.jsx(kt,{labelKey:e.labelKey,paths:e.paths,children:e.items.map((t,n)=>jsxRuntime.jsx(Or,{entry:t},n))}):e.slot==="file.open"?jsxRuntime.jsx(pc,{}):e.slot==="file.save"?jsxRuntime.jsx(mc,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(fc,{}):e.slot==="paragraph.dialog"?jsxRuntime.jsx(rT,{}):e.slot==="image.insert"?jsxRuntime.jsx(gc,{}):e.picker==="tableGrid"?jsxRuntime.jsx(iT,{entry:e}):jsxRuntime.jsx(Zt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function of(e){if(!nt.isValidElement(e))return null;let t=un(e,of);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 lT(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function sT(e,t,n){return qa({entries:e??[],children:t,preset:n,keyOfEntry:lT,keyOfChild:of,renderEntry:o=>jsxRuntime.jsx(Or,{entry:o})})}function to({id:e,labelKey:t,label:n,icon:o,className:r,hidden:i,preset:a=true,children:l}){let{openMenu:c,setOpenMenu:s,activeMenu:d}=ot(),m=De(),p=nt.useId(),g=nt.useRef(null),u=nt.useRef(null),f=nt.useRef(false),b=nt.useRef(false),y=editor.CHROME_MENUS.find(x=>x.id===e),T=c===e;if(i)return null;let h=n??m(t??y?.labelKey??e),v=sT(y?.entries,l,a),S=()=>{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":T,"aria-controls":T?p:void 0,className:"docx-menubar__trigger",tabIndex:d===e?0:-1,...T?{"data-open":""}:{},onMouseDown:B,onKeyDown:x=>{x.key==="ArrowDown"||x.key==="Enter"||x.key===" "||x.key==="ArrowUp"?(x.preventDefault(),f.current=true,s(e)):x.key==="Escape"&&T&&(x.preventDefault(),S());},onClick:()=>{if(b.current){b.current=false;return}s(T?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,h]}),T?jsxRuntime.jsx("div",{ref:x=>{u.current=x,x&&f.current&&(f.current=false,vt(Do(x),"first"));},id:p,role:"menu","aria-label":h,className:"docx-toolbar__menu docx-menubar__menu",onKeyDown:x=>{let w=u.current;if(!w)return;let C=Do(w),k=document.activeElement;x.key==="ArrowDown"?(x.preventDefault(),ht(C,k,1)):x.key==="ArrowUp"?(x.preventDefault(),ht(C,k,-1)):x.key==="Home"?(x.preventDefault(),vt(C,"first")):x.key==="End"?(x.preventDefault(),vt(C,"last")):x.key==="Escape"?(x.preventDefault(),x.stopPropagation(),S()):x.key==="Tab"&&s(null);},children:v}):null]})}function bc(e){return Object.assign(n=>jsxRuntime.jsx(to,{id:e,...n}),{docxMenu:e})}var hc=bc("file"),vc=bc("format"),yc=bc("insert");function cT({className:e,hidden:t,onSelect:n}){let{setOpenMenu:o,onReportIssue:r,reportIssue:i}=ot(),a=De();if(t||i===false)return null;let l=n??r??Fr;return jsxRuntime.jsx(Ne,{slot:"help.reportIssue",onSelect:()=>{l(),o(null);},...e?{className:e}:{},children:a("toolbar.reportIssue")})}var Ci=Object.assign(cT,{docxSlot:"help.reportIssue"});function dT({children:e,...t}){let{reportIssue:n}=ot();return e===void 0&&n===false?null:jsxRuntime.jsxs(to,{id:"help",...t,children:[jsxRuntime.jsx(Ci,{}),e]})}var xc=Object.assign(dT,{docxMenu:"help"});var mT=e=>e.hiddenReviewAuthors??[];function Pi({className:e,hidden:t}){let n=H(),o=rr(),r=O(mT),i=De(),{t:a}=N();if(t)return null;let l=i("reviewers.label"),c=editor.toolbarCommandState(n,"review.authors"),s=i18n.localizeDisabledReason(c.disabledReason,a);if(!c.enabled)return jsxRuntime.jsx(Ne,{disabled:true,title:s??void 0,slot:"review.authors",children:l});let d=new Set(r),m=o.every(p=>!d.has(p.author));return jsxRuntime.jsxs(kt,{labelKey:"reviewers.label",className:e,children:[jsxRuntime.jsx(nf,{checked:m,label:i("reviewers.all"),slot:"reviewer-all",onChoose:()=>n?.setAllReviewAuthorsVisible(!m)}),jsxRuntime.jsx("div",{className:"docx-toolbar__menu-separator",role:"separator"}),o.map(p=>jsxRuntime.jsx(nf,{checked:!d.has(p.author),label:p.author||"\u2014",slot:`reviewer-${p.slot}`,onChoose:()=>n?.setReviewAuthorVisible(p.author,d.has(p.author))},p.author))]})}function nf(e){return jsxRuntime.jsx(Ne,{active:e.checked,slot:e.slot,className:"docx-menubar__reviewer-item",icon:jsxRuntime.jsx("span",{className:"docx-menubar__reviewer-check",children:e.checked?"\u2713":""}),onSelect:e.onChoose,children:e.label})}function fT({children:e,...t}){return jsxRuntime.jsxs(to,{id:"review",...t,children:[jsxRuntime.jsx(kt,{labelKey:"reviewers.markupOptions",className:"docx-menubar__markup-options",children:jsxRuntime.jsx(Pi,{className:"docx-menubar__reviewers-submenu"})}),e]})}var Ei=Object.assign(fT,{docxMenu:"review"});var hT={file:hc,format:vc,insert:yc,review:Ei,help:xc},vT=new Set(editor.CHROME_MENUS.map(e=>e.id));function pf(e){if(!nt.isValidElement(e))return null;if(e.type===nt.Fragment){let o=nt.Children.toArray(e.props.children).map(pf).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===to){let n=e.props.id;if(typeof n=="string"&&vT.has(n))return n}return null}function yT(e){let t=tt(),{className:n,t:o,fileName:r,onOpen:i,onOpenFile:a,onSave:l,onPageSetup:c,onReportIssue:s,reportIssue:d,preset:m=true,children:p}=e,g=H(),{t:u}=N(),[f,b]=nt.useState(null),[y,T]=nt.useState(null),[h,v]=nt.useState(null),[S,x]=nt.useState(false),[w,C]=nt.useState(false),k=nt.useRef(null),R=nt.useRef(null);nt.useEffect(()=>{if(f===null)return;let V=ne=>{let re=k.current;re&&ne.target instanceof Node&&re.contains(ne.target)||b(null);},$=ne=>{ne.key==="Escape"&&b(null);};return document.addEventListener("mousedown",V),document.addEventListener("keydown",$),()=>{document.removeEventListener("mousedown",V),document.removeEventListener("keydown",$);}},[f]);let _=nt.useCallback(V=>{b(V),V!==null&&v(V);},[]),L=nt.useCallback(()=>R.current?.click(),[]),F=nt.useCallback(()=>{g&&g.save().then(V=>Ym(V,jm(r??y??void 0))).catch(V=>{console.error("[docx-editor] save failed",V);});},[g,r,y]),I=nt.useCallback(()=>x(true),[]),M=g?i??L:void 0,E=g?l??F:void 0,D=g?c??I:void 0;nt.useEffect(()=>{let V=$=>{if(!($.metaKey||$.ctrlKey)||$.altKey||$.shiftKey)return;let ne=$.key.toLowerCase();if(ne!=="s"&&ne!=="o")return;let re=$.target,be=bn(k.current)??k.current;!re||!be?.contains(re)||(ne==="s"&&E?($.preventDefault(),E()):ne==="o"&&M&&($.preventDefault(),M()));};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[M,E]);let ae=nt.useMemo(()=>({t:o,openMenu:f,setOpenMenu:_,activeMenu:h,onOpen:M,onSave:E,onPageSetup:D,onParagraphDialog:()=>C(true),onReportIssue:s,reportIssue:d}),[o,f,_,h,M,E,D,s,d]),z;if(!m)z=p;else {let V=new Map,$=[];for(let ne of nt.Children.toArray(p)){let re=pf(ne);re?V.set(re,ne):$.push(ne);}z=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[editor.CHROME_MENUS.map(ne=>{let re=V.get(ne.id);if(re)return jsxRuntime.jsx(nt.Fragment,{children:re},ne.id);let be=hT[ne.id];return jsxRuntime.jsx(be,{},ne.id)}),$]});}return jsxRuntime.jsxs(Lr.Provider,{value:ae,children:[jsxRuntime.jsx("div",{ref:V=>{if(k.current=V,V&&h===null){let $=Qs(V)[0]?.closest("[data-menu]")?.getAttribute("data-menu");$&&v($);}},role:"menubar","aria-label":o?.("titleBar.menuBarAriaLabel")??u("titleBar.menuBarAriaLabel"),"data-testid":"docx-menubar",className:`${t}docx-menubar${n?` ${n}`:""}`,onMouseDown:B,onKeyDown:V=>{if(V.key!=="ArrowLeft"&&V.key!=="ArrowRight")return;let $=k.current;if(!$)return;let ne=Qs($),re=ne.indexOf(document.activeElement);if(re===-1)return;V.preventDefault();let be=V.key==="ArrowRight"?1:-1,he=ne[(re+be+ne.length)%ne.length],U=he?.closest("[data-menu]")?.getAttribute("data-menu");U&&(v(U),he?.focus(),f!==null&&b(U));},children:z}),jsxRuntime.jsx("input",{ref:R,type:"file",accept:".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document",style:{display:"none"},onChange:V=>{let $=V.target.files?.[0];V.target.value="",!(!$||!g)&&(T($.name),a?.($),$.arrayBuffer().then(ne=>g.load(new Uint8Array(ne))).catch(ne=>{console.error("[docx-editor] could not open the file",ne);}));}}),jsxRuntime.jsx(Nr,{open:S,onClose:()=>x(false)}),jsxRuntime.jsx(Mo,{open:w,onClose:()=>C(false)})]})}var Zr=Object.assign(yT,{Menu:to,File:hc,Format:vc,Insert:yc,Review:Ei,Help:xc,Item:Zt,Row:Ne,Group:Hr,Separator:Fo,Submenu:kt,TableGrid:Ti,Entry:Or,Open:pc,Save:mc,PageSetup:fc,ImageInsert:gc,Reviewers:Pi,ReportIssue:Ci});var PT=12240,gf=1440,vf=1440,yf=567,Ao=20,Tc=6,Pc=Ao+Tc+2,ET="var(--doc-text-muted)",wT="var(--doc-text-subtle)",bf="var(--doc-shadow-subtle)",RT="var(--doc-primary)",kT="var(--doc-primary-hover)",MT="var(--doc-text-subtle)",Kr=5,qr=7,IT={left:0,right:0,firstLine:0};function hf(e,t){return t==="inch"?(e/vf).toFixed(2)+'"':(e/yf).toFixed(1)+" cm"}function _T(e,t){return t?1:Math.round(e==="cm"?editor.SNAP_TWIPS_CM:editor.SNAP_TWIPS_INCH)}function Ho({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:m="inch",className:p="",style:g,tabMarks:u,onTabMarkRemove:f}){let{t:b}=N(),[y,T]=nt.useState(null),[h,v]=nt.useState(null),[S,x]=nt.useState(null),[w,C]=nt.useState(null),k=nt.useRef(null),R=e?.pageWidthTwips??PT,_=e?.marginsTwips.left??gf,L=e?.marginsTwips.right??gf,F=e?.gutterTwips??0,I={pageWidth:R,leftMargin:_,rightMargin:L},M=l??IT,E=Ee(R)*t,D=Ee(_)*t,ae=Ee(L)*t,z=nt.useCallback(Z=>{let Re=k.current?.getBoundingClientRect();return Re?ka((Z-Re.left)/t):null},[t]),V=nt.useCallback((Z,Re,ce)=>{let de=z(Re);if(de===null)return;if(C(Ee(de)*t),Z==="leftMargin"||Z==="rightMargin"){if(Z==="leftMargin"){let ho=R-L-F-720,pt=Math.round(Math.max(0,Math.min(de,ho)));x(pt),o?.(pt);}else {let ho=R-de,pt=R-_-F-720,vo=Math.round(Math.max(0,Math.min(ho,pt)));x(vo),r?.(vo);}return}let We=editor.dragIndent(Z,de,M,I,{unit:m,precise:ce});x(Z==="right"?We.right:Z==="firstLine"?We.firstLine:We.left),s?.(We);},[z,t,R,_,L,F,o,r,s,M,I,m]),$=nt.useCallback(Z=>{Z==="leftMargin"||Z==="rightMargin"?i?.():d?.(),T(null),x(null),C(null);},[i,d]),ne=nt.useCallback((Z,Re,ce)=>{let de=editor.handlePosition(Z,M,I),We=editor.dragIndent(Z,de+Re*_T(m,ce),M,I,{unit:m,precise:true});s?.(We),d?.();},[M,I,m,s,d]),re=HT(R,t,m),be=a&&c&&s!==void 0,he=Z=>Ee(editor.handlePosition(Z,M,I))*t,U=(Z,Re,ce)=>({positionPx:he(Z),editable:be,isDragging:y===Z,isHovered:h===Z,onPointerEnter:()=>v(Z),onPointerLeave:()=>v(null),onPointerDown:de=>{be&&(de.preventDefault(),de.stopPropagation(),de.currentTarget.setPointerCapture(de.pointerId),T(Z));},onPointerMove:de=>{y===Z&&V(Z,de.clientX,de.altKey);},onPointerUp:de=>{y===Z&&(de.currentTarget.releasePointerCapture(de.pointerId),$(Z));},onKeyDown:de=>{be&&(de.key!=="ArrowLeft"&&de.key!=="ArrowRight"||(de.preventDefault(),ne(Z,de.key==="ArrowLeft"?-1:1,de.shiftKey)));},label:b(Re),valueNow:ce,valueText:hf(ce,m),pageWidthTwips:R});return jsxRuntime.jsxs("div",{ref:k,className:`docx-horizontal-ruler ${p}`,style:{position:"relative",width:je(E),height:Pc,backgroundColor:"transparent",overflow:"visible",userSelect:"none",touchAction:"none",cursor:y?"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:je(D),height:Ao,backgroundColor:bf,borderRight:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&o?Z=>{Z.preventDefault(),Z.currentTarget.setPointerCapture(Z.pointerId),T("leftMargin");}:void 0,onPointerMove:Z=>y==="leftMargin"&&V("leftMargin",Z.clientX,Z.altKey),onPointerUp:Z=>{y==="leftMargin"&&(Z.currentTarget.releasePointerCapture(Z.pointerId),$("leftMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,right:0,width:je(ae),height:Ao,backgroundColor:bf,borderLeft:"1px solid var(--doc-shadow-subtle)",cursor:n?"ew-resize":"default",zIndex:1},onPointerDown:n&&r?Z=>{Z.preventDefault(),Z.currentTarget.setPointerCapture(Z.pointerId),T("rightMargin");}:void 0,onPointerMove:Z=>y==="rightMargin"&&V("rightMargin",Z.clientX,Z.altKey),onPointerUp:Z=>{y==="rightMargin"&&(Z.currentTarget.releasePointerCapture(Z.pointerId),$("rightMargin"));}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:Ao,pointerEvents:"none"},children:re.map((Z,Re)=>jsxRuntime.jsx(DT,{tick:Z},Re))}),u?.map(Z=>jsxRuntime.jsx(AT,{tabMark:Z,positionPx:Ee(Z.position)*t,onDoubleClick:()=>f?.(Z.position)},Z.position)),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Sc,{direction:"down",anchor:"top",...U("firstLine","ruler.firstLineIndent",M.firstLine)}),jsxRuntime.jsx(Sc,{direction:"up",anchor:"strip",...U("hanging","ruler.hangingIndent",M.left)}),jsxRuntime.jsx(NT,{...U("left","ruler.leftIndent",M.left)}),jsxRuntime.jsx(Sc,{direction:"up",anchor:"strip",...U("right","ruler.rightIndent",M.right)})]}),y&&S!==null&&w!==null&&jsxRuntime.jsx(LT,{value:hf(S,m),positionPx:w})]})}function DT({tick:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:{position:"absolute",left:je(e.position),bottom:0,width:1,height:e.height,backgroundColor:wT}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:je(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:ET,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function xf(e){return e.editable?e.isDragging||e.isHovered?kT:RT:MT}function Sf(e,t,n){return {position:"absolute",left:je(e.positionPx-t/2),width:t,cursor:e.editable?"ew-resize":"default",zIndex:e.isDragging?10:4,touchAction:"none",...n}}function Tf(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 Sc({direction:e,anchor:t,...n}){let o=xf(n),r=t==="top"?{top:0,height:qr+1}:{top:Ao-qr,height:qr};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:Sf(n,Kr*2,r),onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,onPointerDown:n.onPointerDown,onPointerMove:n.onPointerMove,onPointerUp:n.onPointerUp,onKeyDown:n.onKeyDown,...Tf(n),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${Kr}px solid transparent`,borderRight:`${Kr}px solid transparent`,...e==="down"?{top:0,borderTop:`${qr}px solid ${o}`}:{bottom:0,borderBottom:`${qr}px solid ${o}`},transition:"border-color 0.1s"}})})}function NT(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:Sf(e,Kr*2,{top:Ao+1,height:Tc}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...Tf(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:Kr*2-2,height:Tc,backgroundColor:xf(e),borderRadius:1,transition:"background-color 0.1s"}})})}function LT({value:e,positionPx:t}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:je(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 FT={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function AT({tabMark:e,positionPx:t,onDoubleClick:n}){return jsxRuntime.jsx("div",{style:{position:"absolute",left:je(t-5),top:Ao-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:FT[e.alignment]||"L"})}function HT(e,t,n){let o=[];if(n==="inch"){let r=vf/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=Ee(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=yf/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=Ee(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 ZT=15840,Ef=1440,qT=1440,KT=567,xn=20,zT="var(--doc-text-muted)",VT="var(--doc-text-subtle)",$T="var(--doc-primary)",WT="var(--doc-primary)",UT="var(--doc-primary-hover)";function zr({pageSetup:e,zoom:t=1,editable:n=false,onTopMarginChange:o,onBottomMarginChange:r,onMarginDragEnd:i,unit:a="inch",className:l="",style:c}){let{t:s}=N(),[d,m]=nt.useState(null),[p,g]=nt.useState(null),u=nt.useRef(null),f=e?.pageHeightTwips??ZT,b=e?.marginsTwips.top??Ef,y=e?.marginsTwips.bottom??Ef,T=Ee(f)*t,h=Ee(b)*t,v=Ee(y)*t,S=nt.useCallback((R,_)=>{n&&(R.preventDefault(),m(_));},[n]),x=nt.useCallback(R=>{if(!d||!u.current)return;let _=u.current.getBoundingClientRect(),L=R.clientY-_.top,F=ka(L/t);if(d==="topMargin"){let I=f-y-720,M=Math.max(0,Math.min(F,I));o?.(Math.round(M));}else if(d==="bottomMargin"){let I=f-F,M=f-b-720,E=Math.max(0,Math.min(I,M));r?.(Math.round(E));}},[d,t,f,b,y,o,r]),w=nt.useCallback(()=>{d!==null&&i?.(),m(null);},[d,i]);nt.useEffect(()=>{if(d)return document.addEventListener("mousemove",x),document.addEventListener("mouseup",w),()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",w);}},[d,x,w]);let C=jT(f,t,a),k={position:"relative",width:xn,height:je(T),backgroundColor:"transparent",overflow:"visible",userSelect:"none",cursor:d?"ns-resize":"default",...c};return jsxRuntime.jsxs("div",{ref:u,className:`docx-vertical-ruler ${l}`,style:k,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:C.map((R,_)=>jsxRuntime.jsx(GT,{tick:R},_))}),jsxRuntime.jsx(wf,{type:"topMargin",position:h,editable:n,isDragging:d==="topMargin",isHovered:p==="topMargin",onMouseEnter:()=>g("topMargin"),onMouseLeave:()=>g(null),onMouseDown:R=>S(R,"topMargin")}),jsxRuntime.jsx(wf,{type:"bottomMargin",position:T-v,editable:n,isDragging:d==="bottomMargin",isHovered:p==="bottomMargin",onMouseEnter:()=>g("bottomMargin"),onMouseLeave:()=>g(null),onMouseDown:R=>S(R,"bottomMargin")})]})}function GT({tick:e}){let t={position:"absolute",top:je(e.position),right:0,height:1,width:e.width,backgroundColor:VT},n={position:"absolute",top:je(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:zT,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 wf({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:l}){let{t:c}=N(),s=o?UT:r?WT:$T,d={position:"absolute",top:je(t-5),right:0,width:xn,height:10,cursor:n?"ns-resize":"default",zIndex:o?10:1},m={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:m})})}function jT(e,t,n){let o=[];if(n==="inch"){let r=qT/8,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=Ee(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=KT/10,i=Math.ceil(e/r);for(let a=0;a<=i;a++){let l=a*r;if(l>e)break;let c=Ee(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 Oo=e=>e.isLoading||e.parseError!==null||e.pageSetup==null;var JT=e=>e.formatting?.indent??null,QT=e=>e.editable;function wc(){let e=H(),t=O(JT),n=O(QT),o=nt.useMemo(()=>n&&e!==null&&e.can({type:"setIndent",left:0}).ok,[e,n]),r=nt.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 nt.useMemo(()=>({indent:t,isEnabled:o,apply:r}),[t,o,r])}var _f=e=>e.zoom,tC=e=>e.isOpening===true;function Df(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function Nf(){let{apply:e}=No(),[t,n]=nt.useState({}),o=nt.useRef({}),r=nt.useCallback(a=>l=>{o.current={...o.current,[a]:Math.round(l)},n(o.current);},[]),i=nt.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 If(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function oC(){let e=H(),{indent:t,isEnabled:n,apply:o}=wc(),[r,i]=nt.useState(null),a=nt.useRef(null),l=nt.useRef(null),c=nt.useCallback(m=>{l.current===null&&(l.current=If(e)),a.current=m,i(m);},[e]),s=nt.useCallback(()=>{let m=a.current,p=l.current;a.current=null,l.current=null,i(null),m&&(p!==null&&p!==If(e)||o({left:m.left,right:m.right,firstLine:m.firstLine}));},[e,o]),d=nt.useMemo(()=>r??(t?{left:t.left,right:t.right,firstLine:t.firstLine}:null),[r,t]);return nt.useMemo(()=>({indent:d,isEnabled:n,preview:c,commit:s}),[d,n,c,s])}function nC(){let e=At(),[t,n]=nt.useState(0);return nt.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 Ii(e){let t=O(Oo),n=O(tC),{pageSetup:o,isEnabled:r}=No(),i=O(_f),{pending:a,preview:l,commit:c}=Nf(),s=oC(),d=wo(),m=dn(),p=nC();return t?null:jsxRuntime.jsx("div",{className:`docx-ruler-frame${n?" docx-ruler-frame--opening":""}`,style:{paddingInlineStart:d+m.inlineStart,paddingRight:m.inlineEnd},children:jsxRuntime.jsx(Ho,{pageSetup:Df(o,a),zoom:i,editable:r,onLeftMarginChange:l("left"),onRightMarginChange:l("right"),onMarginDragEnd:c,showIndentHandles:s.indent!==null,indent:s.indent,indentEditable:s.isEnabled,onIndentChange:s.preview,onIndentDragEnd:s.commit,unit:e.unit??"inch",className:e.className??"",style:{...e.style,transform:`${e.style?.transform?`${e.style.transform} `:""}translateX(${-p}px)`,clipPath:d>0&&p>0?`inset(0 0 0 ${p}px)`:e.style?.clipPath}})})}function _i(e){let t=O(Oo),{pageSetup:n,isEnabled:o}=No(),r=O(_f),{pending:i,preview:a,commit:l}=Nf(),c=wo(),s=dn(),d=wu();return t||d!==null&&d>0&&n&&Ee(n.pageWidthTwips)*r>d-c-s.inlineStart-s.inlineEnd?null:jsxRuntime.jsx(zr,{pageSetup:Df(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 A({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 aC(e){return jsxRuntime.jsx(A,{...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 iC(e){return jsxRuntime.jsx(A,{...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 lC(e){return jsxRuntime.jsx(A,{...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 sC(e){return jsxRuntime.jsx(A,{...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 cC(e){return jsxRuntime.jsx(A,{...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 dC(e){return jsxRuntime.jsx(A,{...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 uC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function pC(e){return jsxRuntime.jsx(A,{...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 mC(e){return jsxRuntime.jsx(A,{...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 fC(e){return jsxRuntime.jsx(A,{...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 gC(e){return jsxRuntime.jsx(A,{...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 bC(e){return jsxRuntime.jsx(A,{...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 hC(e){return jsxRuntime.jsx(A,{...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 vC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function yC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function xC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function SC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function Ic(e){return jsxRuntime.jsx(A,{...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 TC(e){return jsxRuntime.jsx(A,{...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 CC(e){return jsxRuntime.jsx(A,{...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 PC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm0 440v-320l160 160-160 160Z"})})}function EC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm320-160v-80h400v80H440Zm0-160v-80h400v80H440Zm0-160v-80h400v80H440ZM120-760v-80h720v80H120Zm160 440L120-480l160-160v320Z"})})}function wC(e){return jsxRuntime.jsx(A,{...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 RC(e){return jsxRuntime.jsx(A,{...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 kC(e){return jsxRuntime.jsx(A,{...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 MC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function IC(e){return jsxRuntime.jsx(A,{...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 _C(e){return jsxRuntime.jsx(A,{...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 DC(e){return jsxRuntime.jsx(A,{...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 NC(e){return jsxRuntime.jsx(A,{...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 LC(e){return jsxRuntime.jsx(A,{...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 Lf(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function FC(e){return jsxRuntime.jsx(A,{...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 AC(e){return jsxRuntime.jsx(A,{...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 HC(e){return jsxRuntime.jsx(A,{...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 OC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function BC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function ZC(e){return jsxRuntime.jsx(A,{...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 qC(e){return jsxRuntime.jsx(A,{...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 KC(e){return jsxRuntime.jsx(A,{...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 zC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-160v-304L240-664v104h-80v-240h240v80H296l224 224v336h-80Zm154-376-58-58 128-126H560v-80h240v240h-80v-104L594-536Z"})})}function VC(e){return jsxRuntime.jsx(A,{...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 $C(e){return jsxRuntime.jsx(A,{...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 WC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-280v-400h400v400H120Zm80-80h240v-240H200v240Zm-80-400v-80h720v80H120Zm480 160v-80h240v80H600Zm0 160v-80h240v80H600Zm0 160v-80h240v80H600ZM120-120v-80h720v80H120Z"})})}function UC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-280v-400h400v400H440Zm80-80h240v-240H520v240ZM120-120v-80h720v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h240v80H120Zm0-160v-80h720v80H120Z"})})}function GC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function jC(e){return jsxRuntime.jsx(A,{...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 YC(e){return jsxRuntime.jsx(A,{...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 XC(e){return jsxRuntime.jsx(A,{...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 JC(e){return jsxRuntime.jsx(A,{...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 QC(e){return jsxRuntime.jsx(A,{...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 eP(e){return jsxRuntime.jsx(A,{...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 tP(e){return jsxRuntime.jsx(A,{...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 oP(e){return jsxRuntime.jsx(A,{...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 nP(e){return jsxRuntime.jsx(A,{...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 rP(e){return jsxRuntime.jsx(A,{...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 aP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z"})})}function iP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z"})})}function lP(e){return jsxRuntime.jsx(A,{...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 sP(e){return jsxRuntime.jsx(A,{...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 cP(e){return jsxRuntime.jsx(A,{...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 dP(e){return jsxRuntime.jsx(A,{...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 uP(e){return jsxRuntime.jsx(A,{...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 pP(e){return jsxRuntime.jsx(A,{...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 mP(e){return jsxRuntime.jsx(A,{...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 fP(e){return jsxRuntime.jsx(A,{...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 gP(e){return jsxRuntime.jsx(A,{...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 bP(e){return jsxRuntime.jsx(A,{...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 hP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h80v720h-80Zm640 0v-720h80v720h-80ZM280-440v-80h80v80h-80Zm160 0v-80h80v80h-80Zm160 0v-80h80v80h-80Z"})})}function vP(e){return jsxRuntime.jsx(A,{...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 yP(e){return jsxRuntime.jsx(A,{...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 xP(e){return jsxRuntime.jsx(A,{...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 SP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-760v-80h640v80H160Zm280 640v-408L336-424l-56-56 200-200 200 200-56 56-104-104v408h-80Z"})})}function TP(e){return jsxRuntime.jsx(A,{...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 CP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-120v-80h640v80H160Zm320-160L280-480l56-56 104 104v-408h80v408l104-104 56 56-200 200Z"})})}function PP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function EP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"})})}function wP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"})})}function RP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z"})})}function kP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z"})})}function MP(e){return jsxRuntime.jsx(A,{...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 IP(e){return jsxRuntime.jsx(A,{...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 _P(e){return jsxRuntime.jsx(A,{...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 DP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M313-440l224 224-57 56-320-320 320-320 57 56-224 224h487v80H313Z"})})}function NP(e){return jsxRuntime.jsx(A,{...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 LP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function FP(e){return jsxRuntime.jsx(A,{...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 AP(e){return jsxRuntime.jsx(A,{...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 HP(e){return jsxRuntime.jsx(A,{...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 OP(e){return jsxRuntime.jsxs(A,{...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 BP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"})})}function ZP(e){return jsxRuntime.jsx(A,{...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 qP(e){return jsxRuntime.jsx(A,{...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 KP(e){return jsxRuntime.jsx(A,{...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 zP(e){return jsxRuntime.jsx(A,{...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 VP(e){return jsxRuntime.jsx(A,{...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 $P(e){return jsxRuntime.jsx(A,{...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 WP(e){return jsxRuntime.jsx(A,{...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 UP(e){return jsxRuntime.jsx(A,{...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 GP(e){return jsxRuntime.jsx(A,{...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 jP={undo:aC,redo:iC,print:lC,file_download:sC,file_upload:cC,format_bold:dC,format_italic:uC,format_underlined:pC,strikethrough_s:mC,superscript:fC,subscript:gC,link:bC,format_clear:hC,format_align_left:vC,format_align_center:yC,format_align_right:xC,format_align_justify:SC,format_line_spacing:Ic,format_list_bulleted:TC,format_list_numbered:CC,format_indent_increase:PC,format_indent_decrease:EC,format_color_text:wC,ink_highlighter:RC,format_color_reset:kC,arrow_drop_down:MC,table:IC,table_chart:_C,grid_on:DC,table_rows:NC,view_column:LC,border_all:Lf,select_all:Lf,border_outer:FC,border_inner:AC,border_clear:HC,add:OC,remove:BC,delete:ZC,delete_sweep:qC,call_merge:KC,call_split:zC,drag_indicator:VC,image:$C,format_image_left:WC,format_image_right:UC,horizontal_rule:GC,flip_to_back:jC,flip_to_front:YC,open_with:XC,tune:JC,rotate_right:QC,rotate_left:eP,swap_horiz:tP,swap_vert:oP,shapes:nP,format_paint:rP,expand_more:aP,expand_less:iP,border_top:lP,border_bottom:sP,border_left:cP,border_right:dP,border_horizontal:uP,border_vertical:pP,padding:mP,text_rotation_none:fP,wrap_text:gP,height:bP,fit_width:hP,settings:vP,border_color:yP,format_color_fill:xP,vertical_align_top:SP,vertical_align_center:TP,vertical_align_bottom:CP,line_weight:PP,keyboard_arrow_up:EP,keyboard_arrow_down:wP,keyboard_arrow_left:RP,keyboard_arrow_right:kP,more_vert:MP,page_break:IP,branding_watermark:_P,arrow_back:DP,search:NP,toc:LP,done_all:FP,check_circle:AP,chat_bubble_outline:HP,chat_bubble_check:OP,check:BP,close:ZP,add_comment:qP,comment:KP,edit_note:zP,rate_review:VP,visibility:$P,format_textdirection_l_to_r:WP,format_textdirection_r_to_l:UP,"agent-sparkle":GP};function K({name:e,size:t=20,className:n="",style:o}){let r=jP[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 Vr=12,_c=240,Af=16,eE=24,tE=Vr+_c+Af,Sn=12,oE=36,nE=Sn+oE+Af,$r=nt__namespace.default.memo(function({headings:t,onHeadingClick:n,onClose:o,topOffset:r=0,scrollLeft:i=0,leftOffset:a=Vr}){let{t:l}=N(),[c,s]=nt.useState(false),d=t.length?Math.min(...t.map(m=>m.level)):0;return nt.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:_c,paddingTop:eE,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:c?"translateX(0)":`translateX(-${a+_c}px)`,transition:"transform 0.15s ease-out"},onMouseDown:m=>m.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((m,p)=>jsxRuntime.jsx("div",{style:{marginLeft:(m.level-d)*16},children:jsxRuntime.jsx("button",{className:"docx-outline-heading-btn",onClick:()=>n(m.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:m.text,children:m.text})},`${m.blockId}-${p}`))})]})});var iE=e=>e,lE=Object.freeze([]),sE=()=>{};function Dc(e){let t=H(),n=O(iE),o=nt.useMemo(()=>t&&!n.isLoading?t.getOutline():lE,[t,n]),r=nt.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 Oo(n)?null:jsxRuntime.jsx($r,{headings:o,onHeadingClick:r,onClose:e.onClose??sE,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var Nc=nt.createContext(null);function ro(e){let t=nt.useContext(Nc);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var Tn=280,Di=32,Hf=16;function Zo(e=280){return 32+e+16}function Ni({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 fE=Object.freeze([]),gE=e=>e;function Li(){let e=H(),t=O(gE),[n,o]=nt.useState(null),r=nt.useMemo(()=>e&&!t.isLoading?e.getOutline():fE,[e,t]),i=nt.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=nt.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 Ac=150,Hc=2e3,Fc=Object.freeze([]),vE=e=>e;function Fi(){let e=H(),t=O(vE),[n,o]=nt.useState(""),[r,i]=nt.useState(""),[a,l]=nt.useState(false),[c,s]=nt.useState(false),[d,m]=nt.useState(Fc),[p,g]=nt.useState(-1);nt.useEffect(()=>{if(n===r)return;let x=setTimeout(()=>i(n),Ac);return ()=>clearTimeout(x)},[n,r]);let u=nt.useMemo(()=>({matchCase:a,wholeWord:c}),[a,c]);nt.useEffect(()=>{if(!e||r.length===0){m(Fc),g(-1);return}let x=e.findMatches(r,u);m(w=>w===x?w:x);},[e,r,u,t]);let f=nt.useRef(d);nt.useEffect(()=>{f.current!==d&&(f.current=d,g(x=>x>=0&&x<d.length?x:-1));},[d]);let b=nt.useCallback(x=>{if(!e)return;let w=d[x];if(!w)return;e.focus(),e.selectMatch(w).ok&&g(x);},[e,d]),y=nt.useCallback(x=>{if(d.length===0)return;let C=((p<0?x>0?-1:0:p)+x+d.length)%d.length;b(C);},[p,b,d.length]),T=nt.useCallback(()=>y(1),[y]),h=nt.useCallback(()=>y(-1),[y]),v=nt.useCallback(x=>o(x),[]),S=nt.useCallback(()=>{o(""),i(""),m(Fc),g(-1);},[]);return {query:n,setQuery:v,matchCase:a,setMatchCase:l,wholeWord:c,setWholeWord:s,matches:d,truncated:d.length>=Hc,activeIndex:p,goTo:b,next:T,previous:h,clear:S,isPending:n!==r}}var PE=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)}},EE=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Ai(e={}){let{defaultOpen:t=false,defaultTab:n="headings",paneWidth:o=280}=e,[r,i]=nt.useState(t),[a,l]=nt.useState(n),c=e.open??r,s=e.tab??a,{onOpenChange:d,onTabChange:m}=e,p=e.open!==void 0,g=e.tab!==void 0,u=nt.useCallback(D=>{p||i(D),d?.(D);},[p,d]),f=nt.useCallback(()=>u(!c),[c,u]),b=nt.useCallback(D=>{g||l(D),m?.(D);},[g,m]),y=Eo(),T=At(),h=nt.useContext(mt),{pageSetup:v,zoom:S,reviewPaneOpen:x,fitting:w}=O(PE,EE),[C,k]=nt.useState(0),[R,_]=nt.useState(0),[L,F]=nt.useState(0);nt.useEffect(()=>{if(!T){k(0),_(0),F(0);return}let D=()=>{k(T.clientWidth);let z=getComputedStyle(T),V=Number.parseFloat(z.paddingInlineEnd);_(Number.isFinite(V)?V:0);let $=Number.parseFloat(z.getPropertyValue("--docx-review-gutter-start"));F(Number.isFinite($)?$:0);};if(D(),typeof ResizeObserver>"u")return;let ae=new ResizeObserver(D);return ae.observe(T),()=>ae.disconnect()},[T,c,x,h?.mounted]);let I=nt.useRef(null);v&&(I.current=v.pageWidthTwips);let M=v?.pageWidthTwips??I.current,E=nt.useMemo(()=>!c||M===null?0:Ni({viewportWidth:C,pageWidthPx:Ee(M)*S,reservation:Zo(o),inlineEndReservation:R,inlineStartReservation:L,docked:w}),[c,M,S,C,o,R,L,w]);return nt.useEffect(()=>{if(y)return y.setShift(E),()=>y.setShift(0)},[y,E]),nt.useEffect(()=>{if(y)return y.setReservation(c?Zo(o):0),()=>y.setReservation(0)},[y,c,o]),{open:c,setOpen:u,toggle:f,tab:s,setTab:b,paneWidth:o,shift:E}}var Ur=["headings","find"],It=(...e)=>e.filter(Boolean).join(" ");function Gr({className:e,style:t,children:n}){return jsxRuntime.jsx("div",{className:It("docx-nav__header",e),style:t,children:n??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(jr,{}),jsxRuntime.jsx(Yr,{})]})})}function jr({className:e,style:t,children:n}){let{pane:o,t:r}=ro("Close");return jsxRuntime.jsx("button",{type:"button",className:It("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 Yr({className:e,style:t,children:n}){let{t:o}=ro("Title");return jsxRuntime.jsx("h2",{className:It("docx-nav__title",e),style:t,children:n??o("navigation.title")})}function Xr({className:e,style:t,children:n}){let{pane:o,t:r}=ro("Tabs"),i=nt.useCallback(a=>{let l=a.key==="ArrowRight"?1:a.key==="ArrowLeft"?-1:0;if(l===0)return;a.preventDefault();let c=Ur.indexOf(o.tab);o.setTab(Ur[(c+l+Ur.length)%Ur.length]);},[o]);return jsxRuntime.jsx("div",{className:It("docx-nav__tabs",e),style:t,role:"tablist","aria-label":r("navigation.title"),onKeyDown:i,children:n??Ur.map(a=>jsxRuntime.jsx(Jr,{value:a},a))})}function Jr({value:e,className:t,style:n,children:o}){let{pane:r,t:i}=ro("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:It("docx-nav__tab",a&&"docx-nav__tab--selected",t),style:n,onClick:()=>r.setTab(e),children:o??i(`navigation.tabs.${e}`)})}function Bf({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 Qr({className:e,style:t}){let{pane:n,outline:o,t:r}=ro("Headings"),[i,a]=nt.useState(""),l=O(Oo),c=nt.useMemo(()=>{let d=i.trim().toLowerCase();return d.length===0?o.items:o.items.filter(m=>m.heading.text.toLowerCase().includes(d))},[o.items,i]),s=n.tab!=="headings";return jsxRuntime.jsxs("div",{className:It("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-headings","aria-labelledby":"docx-nav-tab-headings",hidden:s,children:[jsxRuntime.jsx(Bf,{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,m)=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:It("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}-${m}`))})]})}function ME({match:e,active:t,onSelect:n}){return jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{type:"button",className:It("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 ea({className:e,style:t}){let{pane:n,search:o,t:r}=ro("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:It("docx-nav__panel",e),style:t,role:"tabpanel",id:"docx-nav-panel-find","aria-labelledby":"docx-nav-tab-find",hidden:i,children:[jsxRuntime.jsx(Bf,{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(ME,{match:c,active:s===o.activeIndex,onSelect:()=>o.goTo(s)},`${c.blockId}-${c.start}-${s}`))})]})}function ta({className:e,style:t,children:n}){let{pane:o,t:r}=ro("Toggle");return jsxRuntime.jsx("button",{type:"button",className:It("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 Zc(e){let t=tt(),{t:n,toggle:o=true,className:r,style:i,children:a,...l}=e,c=Ai(l),s=Li(),d=Fi(),{t:m}=N(),p=nt.useMemo(()=>({pane:c,outline:s,search:d,t:n??((u,f)=>m(u,f))}),[c,s,d,n,m]),g=e.paneWidth??280;return jsxRuntime.jsx(Nc.Provider,{value:p,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":`${Zo(g)}px`,...i},children:[o!==false&&!c.open&&jsxRuntime.jsx(ta,{...typeof o=="object"?o:{}}),jsxRuntime.jsx("aside",{className:"docx-nav__panel-shell","aria-label":p.t("navigation.ariaLabel"),inert:!c.open,children:a??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Gr,{}),jsxRuntime.jsx(Xr,{}),jsxRuntime.jsx(Qr,{}),jsxRuntime.jsx(ea,{})]})})]})})}var Hi=Object.assign(Zc,{Header:Gr,Close:jr,Title:Yr,Tabs:Xr,Tab:Jr,Headings:Qr,Find:ea,Toggle:ta});var AE=600,HE=e=>e.page.total,Oi=nt.createContext(null);function Bi({className:e,style:t}){let n=tt(),o=H(),r=At(),i=O(HE),{t:a}=N(),l=nt.useContext(Oi),[c,s]=nt.useState(1),[d,m]=nt.useState(false);if(nt.useEffect(()=>{if(m(false),!o||!r||i<=1)return;s(o.getCurrentPage("viewport"));let g=null,u=()=>{s(o.getCurrentPage("viewport")),m(true),g&&clearTimeout(g),g=setTimeout(()=>m(false),AE);};return r.addEventListener("scroll",u,{passive:true}),()=>{r.removeEventListener("scroll",u),g&&clearTimeout(g);}},[o,i,r]),i<=1)return null;let p=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:p})}var ZE=[],qE=e=>e.fontSubstitutions??ZE;function Zi({className:e,style:t,t:n}){let o=O(qE),{t:r}=N(),i=n??r,[a,l]=nt.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 Je={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function qc(e){return Math.round(e/1440*100)/100}function zf(e){return Math.round(e*1440)}function VE(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 Kc(){let e=H(),t=nt.useCallback(n=>e?.getHeaderFooterState()??null,[e]);return O(t,VE)}function En(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 oa(e,t){let[n,o]=nt.useState(null),r=nt.useCallback(l=>o(l),[]),[i,a]=nt.useState({visibility:"hidden"});return nt.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,m=new ResizeObserver(()=>g()),p=()=>{s=0;let f=e(c);if(f!==d&&(m.disconnect(),m.observe(c),m.observe(n),f&&m.observe(f),d=f),!f||!f.isConnected){a({visibility:"hidden"});return}let b=f.getBoundingClientRect(),y=t==="story-label"?Math.max(n.offsetHeight,28):n.offsetHeight,T=t==="story-label"?6:4,h=l===c,v=t==="after"?b.bottom+6:b.top-y-T,S=h?En(c,b.left,v):{left:b.left,top:v},x=S.left,w=S.top,C=h?c.scrollLeft+8:8;a({position:h?"absolute":"fixed",left:t==="story-label"?x:Math.max(C,x+8),top:t==="story-label"?w:Math.max(h?c.scrollTop+8:8,w),...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(p));};m.observe(c),m.observe(n);let u=new MutationObserver(g);return u.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),p(),()=>{s&&cancelAnimationFrame(s),m.disconnect(),u.disconnect(),c.removeEventListener("scroll",g),window.removeEventListener("resize",g);}},[n,e,t]),{ref:r,style:i}}function jE(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 YE=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function na(e){let t=H();return nt.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 XE(e){let{state:t,onMouseDown:n}=e,{t:o}=N(),r=H(),[i,a]=nt.useState(false),l=nt.useRef(null),[c,s]=nt.useState(""),[d,m]=nt.useState("");nt.useEffect(()=>{i&&(t.headerDistanceTwips===void 0||t.footerDistanceTwips===void 0||(s(String(qc(t.headerDistanceTwips))),m(String(qc(t.footerDistanceTwips)))));},[i,t.headerDistanceTwips,t.footerDistanceTwips]),nt.useEffect(()=>{if(!i)return;let w=C=>{l.current?.contains(C.target)||a(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[i]);let p=nt.useMemo(()=>({type:"setHeaderFooterOptions",titlePage:!t.titlePage}),[t.titlePage]),g=nt.useMemo(()=>({type:"setHeaderFooterOptions",evenAndOddHeaders:!t.evenAndOddHeaders}),[t.evenAndOddHeaders]),u=nt.useMemo(()=>({type:"linkHeaderFooterToPrevious"}),[]),f=nt.useMemo(()=>({type:"unlinkHeaderFooterFromPrevious"}),[]),b=nt.useMemo(()=>({type:"removeHeaderFooter",position:t.editing}),[t.editing]),y=na(p),T=na(g),h=na(u),v=na(f),S=na(b),x=(w,C)=>{if(!r)return;let k=Number.parseFloat(C);Number.isFinite(k)&&r.exec({type:"setHeaderFooterOptions",[w]:zf(k)});};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(w=>!w),onMouseDown:n,children:o("headerFooter.options")}),i?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:n,children:[YE.map(w=>{let C={type:"insertPageField",field:w.field},k=r?.can(C);return jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!k?.ok,title:k&&!k.ok?k.reason:void 0,onClick:()=>{r?.exec(C),a(false);},onMouseDown:n,children:o(w.labelKey)},w.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:!y.enabled,title:y.reason??void 0,onChange:()=>r?.exec(p)}),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:!T.enabled,title:T.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:!v.enabled,title:v.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:!h.enabled,title:h.reason??void 0,onClick:()=>r?.exec(u),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:w=>s(w.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:w=>m(w.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:!S.enabled,title:S.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 qi({className:e}){let{t}=N(),n=Kc(),o=nt.useCallback(l=>l.querySelector("[data-docx-hf-active]"),[]),r=oa(o,"story-label"),i=B;if(!n?.editing)return null;let a=jE(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:Je.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(XE,{state:n,onMouseDown:i})]})}function zo(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var Ki=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"})}),r1="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",a1="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",i1="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",l1="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 s1({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let i=_t(),a=nt.useRef(null),{state:l,close:c}=i;nt.useEffect(()=>{if(l.mode==="closed")return;let f=y=>{y.key==="Escape"&&(y.preventDefault(),c());},b=y=>{let T=a.current;T&&y.target instanceof Node&&T.contains(y.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]=nt.useState(null);nt.useLayoutEffect(()=>{let f=l.anchor,b=a.current;if(!f||!b){d(null);return}let y=b.offsetParent;if(!y){d(null);return}let{left:T,top:h}=En(y,f.left,f.top),v=Math.max(0,y.scrollWidth-b.offsetWidth);d({left:Math.max(0,Math.min(T,v)),top:h});},[l.anchor]);let{t:m}=N(),p=l.mode==="editing"?m(l.link?"hyperlinkPopup.editTitle":"hyperlinkPopup.insertTitle"):m("hyperlinkPopup.editLink"),g=r?jsxRuntime.jsx(c1,{children:o}):o;if(n)return l.mode==="closed"?null:jsxRuntime.jsx(jsxRuntime.Fragment,{children:o});let u={ref:a,className:`docx-hyperlink-popup${e?` ${e}`:""}`,"data-testid":"hyperlink-popup","data-mode":l.mode,role:"dialog","aria-modal":false,onMouseDown:zo,style:s??void 0,"aria-label":p};return l.mode==="closed"?null:t?jsxRuntime.jsx(j,{...u,children:o}):jsxRuntime.jsx("div",{...u,children:g})}function c1({children:e}){let{state:t}=_t(),n=nt.useMemo(()=>d1(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(jc,{})),o("Error",jsxRuntime.jsx(Xc,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Apply",jsxRuntime.jsx(Yc,{})),o("Cancel",jsxRuntime.jsx(Jc,{}))]}),n.__extra]});let r=t.canEdit&&!(t.link&&Qn(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Url",jsxRuntime.jsx($c,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Copy",jsxRuntime.jsx(Wc,{})),r?o("Edit",jsxRuntime.jsx(Uc,{})):null,r?o("Unlink",jsxRuntime.jsx(Gc,{})):null]}),n.__extra]})}function d1(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===nt.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 _t(){return nt.useContext(er)??u1}var u1={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 $c({className:e,asChild:t,hidden:n,children:o}){let{state:r,openTarget:i}=_t(),{t:a}=N();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"),m={className:`docx-hyperlink-popup__url${e?` ${e}`:""}`,"data-testid":"hyperlink-popup-url",...l?{"data-inert":""}:{},title:d,onMouseDown:zo,...l?{}:{onClick:()=>i(),type:"button"}};return t?jsxRuntime.jsx(j,{...m,children:o}):l?jsxRuntime.jsxs("span",{...m,children:[o??s,jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:d})]}):jsxRuntime.jsxs("button",{...m,children:[o??s,Ki(l1)]})}$c.docxHyperLinkPart="Url";function Wc({className:e,asChild:t,hidden:n,children:o,icon:r}){let{state:i,copy:a}=_t(),{t:l}=N();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:zo,onClick:()=>{a();}};return t?jsxRuntime.jsx(j,{...s,children:o}):jsxRuntime.jsx("button",{...s,children:r??o??Ki(r1)})}Wc.docxHyperLinkPart="Copy";function Uc({className:e,asChild:t,hidden:n,children:o,icon:r}){let{beginEdit:i}=_t(),{t:a}=N();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:zo,onClick:()=>i()};return t?jsxRuntime.jsx(j,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??Ki(a1)})}Uc.docxHyperLinkPart="Edit";function Gc({className:e,asChild:t,hidden:n,children:o,icon:r}){let{unlink:i}=_t(),{t:a}=N();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:zo,onClick:()=>i()};return t?jsxRuntime.jsx(j,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:r??o??Ki(i1)})}Gc.docxHyperLinkPart="Unlink";function jc({className:e,hidden:t}){let{state:n,setText:o,setUrl:r,commitEdit:i,close:a}=_t(),{t:l}=N(),c=nt.useRef(null),s=nt.useId(),d=nt.useId();nt.useEffect(()=>{n.mode==="editing"&&(c.current?.focus({preventScroll:true}),c.current?.select());},[n.mode]);let m=nt.useCallback(p=>{if(p.key==="Enter"){p.preventDefault(),i();return}p.key==="Escape"&&(p.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:p=>o(p.target.value),onKeyDown:m}),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:p=>r(p.target.value),onKeyDown:m})]})}jc.docxHyperLinkPart="Fields";function Yc({className:e,asChild:t,hidden:n,children:o}){let{state:r,commitEdit:i}=_t(),{t:a}=N();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:zo,onClick:()=>i()};return t?jsxRuntime.jsx(j,{...c,children:o}):jsxRuntime.jsx("button",{...c,children:o??l})}function Xc({className:e,hidden:t}){let{state:n}=_t(),{t:o}=N();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")})}Xc.docxHyperLinkPart="Error";Yc.docxHyperLinkPart="Apply";function Jc({className:e,asChild:t,hidden:n,children:o}){let{close:r}=_t(),{t:i}=N();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:zo,onClick:()=>r()};return t?jsxRuntime.jsx(j,{...l,children:o}):jsxRuntime.jsx("button",{...l,children:o??a})}Jc.docxHyperLinkPart="Cancel";var zi=Object.assign(s1,{Url:$c,Copy:Wc,Edit:Uc,Unlink:Gc,Fields:jc,Error:Xc,Apply:Yc,Cancel:Jc});var g1=e=>e;function nd(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Vi(){let e=H(),{t}=N(),[n,o]=nt.useState(null),[r,i]=nt.useState(null),a=nt.useRef(null),l=nt.useRef(null),c=nt.useRef(null),s=nt.useId(),d=nt.useId(),m=nt.useId(),p=n?.activation??null,g=O(g1),u=nt.useMemo(()=>{if(!e?.surface||!p)return {replaceEnabled:false,removeEnabled:false,reason:null};let h=e.surface.equations.can(p.equation.id,"replace"),v=e.surface.equations.can(p.equation.id,"remove"),S=h.ok?v.ok?null:v.reason:h.reason;return {replaceEnabled:h.ok,removeEnabled:v.ok,reason:S?i18n.localizeDisabledReason(S,t):null}},[p,e,g,t]),f=nt.useCallback((h=false)=>{c.current?.(),c.current=null,o(null),h&&e&&queueMicrotask(()=>e.focus());},[e]);nt.useEffect(()=>{if(!e)return;let h=e.setEquationChrome({onPopover:v=>{c.current?.();let S=e.surface;if(S&&typeof S.retainSelection=="function"){let x=S.retainSelection();c.current=()=>S.releaseSelection(x);}else c.current=null;o({activation:v,mountGeneration:e.mountGeneration,draft:v.equation.linear,error:false});}});return ()=>{h(),c.current?.(),c.current=null,o(null);}},[e,f]),nt.useEffect(()=>{if(!n||!e?.surface)return;(e.mountGeneration!==n.mountGeneration||!e.surface.equations.equationById(n.activation.equation.id))&&f();},[e,g,n,f]),nt.useEffect(()=>{if(!n)return;let h=a.current,v=h?.ownerDocument,S=v?.defaultView;if(!h||!v||!S)return;let x=C=>{C.key==="Escape"&&(C.preventDefault(),f(true));},w=C=>{C.target instanceof S.Node&&h.contains(C.target)||f();};return v.addEventListener("keydown",x),v.addEventListener("pointerdown",w,true),()=>{v.removeEventListener("keydown",x),v.removeEventListener("pointerdown",w,true);}},[n,f]),nt.useLayoutEffect(()=>{if(!p){i(null);return}let h=a.current;if(!h)return;let v=h.offsetParent;if(!v){i(null);return}let S=p.rect,x=En(v,S.left,S.bottom),w=Math.max(0,v.scrollWidth-h.offsetWidth);i({left:Math.max(0,Math.min(x.left,w)),top:x.top}),l.current?.focus({preventScroll:true}),l.current?.select();},[p]);let b=nt.useCallback(()=>{if(!n||!e?.surface||!u.replaceEnabled)return false;let h=e.surface.equations.applyEquation(n.activation.equation.id,n.draft);return h?f(true):o(v=>v&&{...v,error:true}),h},[e,n,f,u.replaceEnabled]),y=nt.useCallback(()=>{if(!n||!e?.surface||!u.removeEnabled)return false;let h=e.surface.equations.removeEquation(n.activation.equation.id);return h?f(true):o(v=>v&&{...v,error:true}),h},[e,n,f,u.removeEnabled]);if(!n)return null;let T=[n.error?d:null,u.reason?m:null].filter(Boolean).join(" ");return jsxRuntime.jsxs("div",{ref:a,className:"docx-equation-popup","data-testid":"equation-popup",role:"dialog","aria-modal":false,"aria-label":t("equationPopup.title"),style:r??void 0,onMouseDown:nd,children:[jsxRuntime.jsx("label",{className:"docx-editor-sr-only",htmlFor:s,children:t("equationPopup.inputLabel")}),jsxRuntime.jsx("input",{id:s,ref:l,className:"docx-equation-popup__input","data-testid":"equation-popup-input",value:n.draft,placeholder:t("equationPopup.placeholder"),spellCheck:false,"aria-describedby":T||void 0,onChange:h=>o(v=>v&&{...v,draft:h.target.value,error:false}),onKeyDown:h=>{h.key!=="Enter"||h.nativeEvent.isComposing||(h.preventDefault(),b());}}),n.error?jsxRuntime.jsx("div",{id:d,className:"docx-equation-popup__error","data-testid":"equation-popup-error",role:"alert",children:t("equationPopup.refused")}):null,u.reason?jsxRuntime.jsx("div",{id:m,className:"docx-equation-popup__error","data-testid":"equation-popup-disabled-reason",role:"status",children:u.reason}):null,jsxRuntime.jsxs("div",{className:"docx-equation-popup__actions",children:[jsxRuntime.jsx("button",{type:"button",className:"docx-equation-popup__apply","data-testid":"equation-popup-apply",disabled:!u.replaceEnabled,title:u.reason??void 0,onMouseDown:nd,onClick:b,children:t("equationPopup.apply")}),jsxRuntime.jsx("button",{type:"button",className:"docx-equation-popup__delete","data-testid":"equation-popup-delete",disabled:!u.removeEnabled,title:u.reason??void 0,onMouseDown:nd,onClick:y,children:t("equationPopup.delete")})]})]})}function b1(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 rd(){let e=H(),t=nt.useCallback(o=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),n=O(t,b1);return n?.kind==="note"?n:null}function Xf(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 Jf(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&&Xf(e.documentAuthored,t.documentAuthored)&&Xf(e.sectionAuthored,t.sectionAuthored)}function h1(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&Jf(e.footnote,t.footnote)&&Jf(e.endnote,t.endnote)}function ad(){let e=H(),t=nt.useCallback(n=>e?.getNotePropertiesState()??null,[e]);return O(t,h1)}var v1=/^(footnote|endnote):(-?\d{1,10})$/;function eg(e){let t=v1.exec(e);if(!t)return null;let n=Number(t[2]);return Number.isInteger(n)?{noteKind:t[1],noteId:n}:null}function y1(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function ld(e){let t=H();return nt.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 x1(e){let{t}=N(),[n,o]=nt.useState(false),r=nt.useRef(null);return nt.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:B,onClick:()=>o(i=>!i),children:t("headerFooter.options")}),n?jsxRuntime.jsxs("div",{className:"docx-hf-chrome__options-menu",role:"menu",onMouseDown:B,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 $i({className:e}){let{t}=N(),n=H(),o=rd(),[r,i]=nt.useState(null),[a,l]=nt.useState(null),[c,s]=nt.useState(false),d=nt.useRef(null),m=nt.useCallback(k=>{if(!o)return null;let _=[...k.querySelectorAll("[data-docx-note-scope]")].find(L=>L.matches("[data-docx-note]")&&L.dataset.docxNoteScope===o.id)??null;return _?.closest("[data-docx-notes]")??_},[o]),p=oa(m,"story-label"),g=nt.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=null,i(null);},[]);nt.useEffect(()=>{if(!n)return;let k=document.querySelector(".docx-pages");if(!k)return;let R=F=>{let I=F.target;if(!I)return;let M=I.closest("[data-docx-note-ref]");if(M?.dataset.docxNoteScope){F.preventDefault(),g(),l(null),n.setActiveScope({kind:"note",id:M.dataset.docxNoteScope});return}I.closest("[data-docx-note-mark-back]")&&(F.preventDefault(),g(),l(null),n.setActiveScope({kind:"body"}));},_=F=>{let I=F,E=I.target?.closest("[data-docx-note-scope]");E?.dataset.docxNoteScope&&(I.preventDefault(),l({scopeId:E.dataset.docxNoteScope,x:I.clientX,y:I.clientY}));},L=F=>{if(y1())return;let M=F.target?.closest("[data-docx-note-ref]");if(!M?.dataset.docxNoteScope){g();return}let E=M.dataset.docxNoteScope,ae=n.getNotePreviewText(E)??M.getAttribute("aria-description")??t("notes.previewFallback"),z=M.getBoundingClientRect();d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{i({scopeId:E,text:ae,x:z.left,y:z.bottom+4});},400);};return k.addEventListener("click",R),k.addEventListener("contextmenu",_),k.addEventListener("pointerover",L),k.addEventListener("scroll",g,true),()=>{k.removeEventListener("click",R),k.removeEventListener("contextmenu",_),k.removeEventListener("pointerover",L),k.removeEventListener("scroll",g,true),g();}},[n,g,t]);let u=nt.useCallback(k=>{n&&(n.exec(k),l(null));},[n]),f=a?eg(a.scopeId):null,b=nt.useMemo(()=>f?{type:"deleteNote",noteKind:f.noteKind,noteId:f.noteId}:null,[f]),y=nt.useMemo(()=>f?{type:"convertNote",fromKind:f.noteKind,noteId:f.noteId}:null,[f]),T=nt.useMemo(()=>f?{type:"convertAllNotes",fromKind:f.noteKind}:null,[f]),h=ld(b??{type:"deleteNote",noteKind:"footnote",noteId:0}),v=ld(y??{type:"convertNote",fromKind:"footnote",noteId:0}),S=ld(T??{type:"convertAllNotes",fromKind:"footnote"}),x=nt.useMemo(()=>({position:"fixed",left:r?.x??0,top:r?.y??0,zIndex:Je.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]),w=o?eg(o.id):null,C=w?t("notes.editingRegion",{kind:w.noteKind==="footnote"?t("notes.footnoteKind"):t("notes.endnoteKind"),number:w.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&&w?jsxRuntime.jsxs("div",{ref:p.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:{...p.style,zIndex:Je.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:C}),jsxRuntime.jsx(x1,{onOpenProperties:()=>s(true),onClose:()=>n.setActiveScope({kind:"body"})})]}):null,r?jsxRuntime.jsx("div",{role:"tooltip","data-testid":"docx-notes-preview",style:x,onMouseDown:k=>{k.preventDefault(),k.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:Je.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:B,children:[jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-delete",disabled:!h.enabled,title:h.reason??void 0,onClick:()=>b&&u(b),children:t("notes.delete")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem","data-testid":"docx-notes-menu-convert",disabled:!v.enabled,title:v.reason??void 0,onClick:()=>y&&u(y),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:!S.enabled,title:S.reason??void 0,onClick:()=>T&&u(T),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(S1,{onClose:()=>s(false),onApply:k=>{u(k),s(false);}}):null]}):null}function S1(e){let{t}=N(),n=H(),o=ad(),[r,i]=nt.useState("document"),[a,l]=nt.useState("decimal"),[c,s]=nt.useState("continuous"),[d,m]=nt.useState("pageBottom"),[p,g]=nt.useState("decimal"),[u,f]=nt.useState("continuous"),[b,y]=nt.useState("docEnd");nt.useEffect(()=>{o&&(l(o.footnote.resolved.numFmt),s(o.footnote.resolved.numRestart),m(o.footnote.resolved.pos),g(o.endnote.resolved.numFmt),f(o.endnote.resolved.numRestart),y(o.endnote.resolved.pos));},[o]);let T=!o?.footnote.documentAuthored&&!o?.footnote.sectionAuthored,h=!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:Je.modal},onClick:e.onClose,onKeyDown:v=>{v.key==="Escape"&&e.onClose();},children:jsxRuntime.jsxs("div",{className:"docx-note-properties__panel",onClick:v=>v.stopPropagation(),onMouseDown:v=>v.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:v=>i(v.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")}),T?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:v=>l(v.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:v=>s(v.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:v=>m(v.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")}),h?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:p,onChange:v=>g(v.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:u,onChange:v=>f(v.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:v=>y(v.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 v={type:"setNoteProperties",scope:r,sectionIndex:r==="section"?o?.sectionIndex:void 0,footnote:{numFmt:a,numRestart:c,position:d},endnote:{numFmt:p,numRestart:u,position:b}};n.can(v).ok&&e.onApply(v);},children:t("common.apply")})]})]})})}var Wi=nt.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function ao(){return nt.useContext(Wi)}function ng(){return nt.useContext(Wi).target}var rg=["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"],ag=["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"],cd=["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"],ig=["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"],lg=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],sg=["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"],cg=["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 kn(e,t,n){return Object.assign(({icon:r,labelKey:i,shortcutKey:a,className:l,hidden:c})=>{let s=H(),{close:d}=ao(),m=De(),{isEnabled:p,disabledReason:g}=le(t);return c?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??Q(n.paths),shortcut:m(a??n.shortcutKey),disabled:!p,...g?{title:g}:{},onSelect:()=>{s?.exec(t),d(true);},...l?{className:l}:{},children:m(i??n.labelKey)})},{docxRow:e})}var aa=kn("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:rg}),ia=kn("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:ag}),la=kn("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:ig}),sa=kn("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:cg});function Mn({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let i=H(),{close:a,clipboardRefusal:l,reportClipboardRefusal:c}=ao(),s=De(),d=nt.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:m,disabledReason:p}=le(d);if(r)return null;let g=l!==null;return jsxRuntime.jsx(Ne,{slot:"edit.paste",icon:e??Q(cd),shortcut:s(n??"contextMenu.pasteShortcut"),disabled:!m||g,...l??p?{title:l??p??""}:{},onSelect:()=>{(async()=>{try{let{text:u,html:f}=await P1();(u||f)&&i?.exec({type:"paste",text:u,...f?{html:f}:{}});}catch(u){c(u instanceof Error?u.message:"the clipboard is not readable");}finally{a(true);}})();},...o?{className:o}:{},children:s(t??"contextMenu.paste")})}Mn.docxRow="edit.paste";async function P1(){let e=navigator.clipboard;if(typeof e.read=="function"&&typeof ClipboardItem<"u")try{let t=await e.read(),n="",o=null;for(let r of t)r.types.includes("text/plain")&&(n=await(await r.getType("text/plain")).text()),r.types.includes("text/html")&&(o=await(await r.getType("text/html")).text());if(n||o)return {text:n,html:o}}catch{}return {text:await e.readText(),html:null}}function In({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let i=H(),{close:a,clipboardRefusal:l,reportClipboardRefusal:c}=ao(),s=De(),d=nt.useMemo(()=>({type:"pasteWithoutFormatting",text:" "}),[]),{isEnabled:m,disabledReason:p}=le(d);if(r)return null;let g=l!==null;return jsxRuntime.jsx(Ne,{slot:"edit.pasteWithoutFormatting",icon:e??Q(cd),shortcut:s(n??"contextMenu.pasteWithoutFormattingShortcut"),disabled:!m||g,...l??p?{title:l??p??""}:{},onSelect:()=>{(async()=>{try{let u=await navigator.clipboard.readText();u&&i?.exec({type:"pasteWithoutFormatting",text:u});}catch(u){c(u instanceof Error?u.message:"the clipboard is not readable");}finally{a(true);}})();},...o?{className:o}:{},children:s(t??"contextMenu.pasteWithoutFormatting")})}In.docxRow="edit.pasteWithoutFormatting";var dg=X("format.painter")?.paths??[],Ui=kn("format.copyFormatting",{type:"copyFormatting"},{labelKey:"contextMenu.copyFormatting",shortcutKey:"contextMenu.copyFormattingShortcut",paths:dg}),Gi=kn("format.pasteFormatting",{type:"pasteFormatting"},{labelKey:"contextMenu.pasteFormatting",shortcutKey:"contextMenu.pasteFormattingShortcut",paths:dg});function Vo(e,t,n){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l,destructive:c})=>{let{close:s}=ao(),d=De(),m=ji(),{isEnabled:p,disabledReason:g,execute:u}=le(t);return l||!m?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??Q(n.paths),disabled:!p,...g?{title:g}:{},className:`${c??n.destructive?"docx-table-chrome__destructive-row":""}${a?` ${a}`:""}`,onSelect:()=>{u()&&s(true);},children:d(i??n.labelKey)})},{docxRow:e})}var _n=Vo("table.insertRowAbove",{type:"insertRow",where:"above"},{labelKey:"table.insertRowAbove",paths:editor.tableChromeIconPaths("table_rows")}),Dn=Vo("table.insertRowBelow",{type:"insertRow",where:"below"},{labelKey:"table.insertRowBelow",paths:editor.tableChromeIconPaths("table_rows")}),Nn=Vo("table.insertColumnLeft",{type:"insertColumn",where:"left"},{labelKey:"table.insertColumnLeft",paths:editor.tableChromeIconPaths("view_column")}),Ln=Vo("table.insertColumnRight",{type:"insertColumn",where:"right"},{labelKey:"table.insertColumnRight",paths:editor.tableChromeIconPaths("view_column")}),Fn=Vo("table.deleteRow",{type:"deleteRow"},{labelKey:"table.deleteRow",paths:editor.tableChromeIconPaths("delete_sweep"),destructive:true}),An=Vo("table.deleteColumn",{type:"deleteColumn"},{labelKey:"table.deleteColumn",paths:editor.tableChromeIconPaths("view_column"),destructive:true}),Hn=Vo("table.deleteTable",{type:"deleteTable"},{labelKey:"table.deleteTable",paths:editor.tableChromeIconPaths("delete"),destructive:true}),E1=[{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 $o({hidden:e}){let{close:t}=ao(),n=De(),o=ji(),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:E1.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:m=>{m.preventDefault(),m.stopPropagation();},onClick:()=>{d.execute()&&t(true);},children:Q(editor.tableChromeIconPaths(c.icon))},c.alignment)})})]})}$o.docxRow="table.cellVerticalAlignment";function ug(e,t,n){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l})=>{let c=H(),{close:s,tocId:d}=ao(),m=De(),p=nt.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:g,disabledReason:u}=le(p);return l||d===null?null:jsxRuntime.jsx(Ne,{slot:e,icon:r??Q(n.paths),disabled:!g,...u?{title:u}:{},onSelect:()=>{c?.exec(p),s(true);},...a?{className:a}:{},children:m(i??n.labelKey)})},{docxRow:e})}var On=ug("toc.refresh","entire",{labelKey:"toc.refresh",paths:lg}),Bn=ug("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:sg});function ji(){return O(nt.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function Yi({label:e,icon:t,shortcut:n,disabled:o,disabledReason:r,active:i,onSelect:a,className:l}){let{close:c}=ao();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 Qi=8,M1=e=>e.editingMode==="viewing";function I1(){let e=H(),t=nt.useContext(mt),n=ot(),o=De(),r=e?.can({type:"toggleReviewPane"}),i=O(M1),a=!r?.ok||i||(t?.mounted??0)===0||e?.getSelectionPlacement()===null,l=X("review.comments");return jsxRuntime.jsx(Ne,{icon:Q(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 _1=[{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(aa,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(ia,{})},{kind:"row",id:"edit.paste",render:()=>jsxRuntime.jsx(Mn,{})},{kind:"row",id:"edit.pasteWithoutFormatting",render:()=>jsxRuntime.jsx(In,{})},{kind:"row",id:"format.copyFormatting",render:()=>jsxRuntime.jsx(Ui,{})},{kind:"row",id:"format.pasteFormatting",render:()=>jsxRuntime.jsx(Gi,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(la,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(sa,{})},{kind:"separator",id:"sep.selection"},{kind:"row",id:"text.link",render:()=>jsxRuntime.jsx(Zt,{slot:"text.link",labelKey:"formattingBar.insertLink"})},{kind:"row",id:"review.comments",render:()=>jsxRuntime.jsx(I1,{})}];function D1(){return [{kind:"separator",id:"sep.table"},{kind:"row",id:_n.docxRow,render:()=>jsxRuntime.jsx(_n,{})},{kind:"row",id:Dn.docxRow,render:()=>jsxRuntime.jsx(Dn,{})},{kind:"separator",id:"sep.table.columns"},{kind:"row",id:Nn.docxRow,render:()=>jsxRuntime.jsx(Nn,{})},{kind:"row",id:Ln.docxRow,render:()=>jsxRuntime.jsx(Ln,{})},{kind:"separator",id:"sep.table.destructive"},{kind:"row",id:Fn.docxRow,render:()=>jsxRuntime.jsx(Fn,{})},{kind:"row",id:An.docxRow,render:()=>jsxRuntime.jsx(An,{})},{kind:"row",id:Hn.docxRow,render:()=>jsxRuntime.jsx(Hn,{})},{kind:"separator",id:"sep.table.alignment"},{kind:"row",id:$o.docxRow,render:()=>jsxRuntime.jsx($o,{})}]}function N1(){return [{kind:"separator",id:"sep.toc"},{kind:"row",id:On.docxRow,render:()=>jsxRuntime.jsx(On,{})},{kind:"row",id:Bn.docxRow,render:()=>jsxRuntime.jsx(Bn,{})}]}function L1(e,t=false){return [..._1,...e?D1():[],...t?N1():[]]}function bg(e){if(!nt.isValidElement(e))return null;let t=un(e,bg);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 fg(e){if(!nt.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function F1(e){return e?.closest(".docx-editor__scroll-container")??null}function da({className:e,t,preset:n=true,disabled:o,onOpenChange:r,children:i}){let a=tt(),l=H(),{t:c}=N(),s=ji(),d=nt.useRef(null),m=nt.useRef(null),[p,g]=nt.useState(null),[u,f]=nt.useState(null),[b,y]=nt.useState(null),T=nt.useMemo(()=>L1(s,u!==null),[s,u]),[h,v]=nt.useState(null),S=nt.useCallback((F=false)=>{g(null),v(null),f(null),y(null),F&&l?.focus();},[l]);nt.useEffect(()=>{if(o)return;let F=F1(d.current);if(!F)return;let I=M=>{M.preventDefault();let E=M.button===-1||M.clientX===0&&M.clientY===0,D=F.getBoundingClientRect();f(l?.snapshot().tocContext?.id??null),y(E||!(M.target instanceof HTMLElement)?null:M.target),g(E?{x:D.left+16,y:D.top+16}:{x:M.clientX,y:M.clientY});};return F.addEventListener("contextmenu",I),()=>F.removeEventListener("contextmenu",I)},[o,l]),nt.useEffect(()=>{o&&S();},[o,S]),nt.useEffect(()=>{if(!p)return;let F=E=>{m.current?.contains(E.target)||S();},I=E=>{E.key==="Escape"?(E.preventDefault(),S(true)):E.key==="Tab"&&S();},M=()=>S();return document.addEventListener("pointerdown",F,true),document.addEventListener("keydown",I),document.addEventListener("scroll",M,{capture:true,passive:true}),window.addEventListener("blur",M),window.addEventListener("resize",M),()=>{document.removeEventListener("pointerdown",F,true),document.removeEventListener("keydown",I),document.removeEventListener("scroll",M,true),window.removeEventListener("blur",M),window.removeEventListener("resize",M);}},[p,S]),nt.useLayoutEffect(()=>{let F=m.current;if(!p||!F)return;let{width:I,height:M}=F.getBoundingClientRect(),E=window.innerWidth-I-Qi,D=window.innerHeight-M-Qi,ae=Math.max(Qi,p.x>E?p.x-I:p.x),z=Math.max(Qi,p.y>D?p.y-M:p.y);v({x:ae,y:z});},[p]),nt.useLayoutEffect(()=>{h&&m.current?.focus({preventScroll:true});},[h]);let x=nt.useRef(r);x.current=r;let w=nt.useRef(false);nt.useEffect(()=>{let F=p!==null;F!==w.current&&(w.current=F,x.current?.(F));},[p]);let C=nt.useMemo(()=>({t,openMenu:null,setOpenMenu:()=>S(true),activeMenu:null,onOpen:void 0,onSave:void 0,onPageSetup:void 0,onParagraphDialog:void 0,onReportIssue:void 0,reportIssue:void 0}),[t,S]),[k,R]=nt.useState(null),_=nt.useMemo(()=>({close:S,anchor:p,tocId:u,target:b,clipboardRefusal:k,reportClipboardRefusal:R}),[S,p,u,b,k]),L={position:"fixed",left:(h??p)?.x??0,top:(h??p)?.y??0,visibility:h?"visible":"hidden"};return jsxRuntime.jsx("div",{ref:d,style:{display:"contents"},children:p?jsxRuntime.jsx(Lr.Provider,{value:C,children:jsxRuntime.jsx(Wi.Provider,{value:_,children:jsxRuntime.jsxs("div",{ref:m,role:"menu","aria-label":t?.("contextMenu.ariaLabel")??c("contextMenu.ariaLabel"),tabIndex:-1,className:`${a}docx-toolbar__menu docx-contextmenu${e?` ${e}`:""}`,style:L,onKeyDown:F=>{let I=m.current;if(!I)return;let M=Do(I);F.key==="ArrowDown"?(F.preventDefault(),ht(M,document.activeElement,1)):F.key==="ArrowUp"?(F.preventDefault(),ht(M,document.activeElement,-1)):F.key==="Home"?(F.preventDefault(),vt(M,"first")):F.key==="End"&&(F.preventDefault(),vt(M,"last"));},children:[nt.Children.toArray(i).filter(fg),qa({entries:T,children:nt.Children.toArray(i).filter(F=>!fg(F)),preset:n,keyOfEntry:F=>F.id,keyOfChild:bg,renderEntry:F=>F.kind==="separator"?jsxRuntime.jsx(Fo,{}):F.render()})]})})}):null})}var pd=Object.assign(da,{Cut:aa,Copy:ia,Paste:Mn,PasteWithoutFormatting:In,Delete:la,SelectAll:sa,InsertRowAbove:_n,InsertRowBelow:Dn,InsertColumnLeft:Nn,InsertColumnRight:Ln,DeleteTableRow:Fn,DeleteTableColumn:An,DeleteTable:Hn,CellVerticalAlignment:$o,RefreshToc:On,RefreshTocPageNumbers:Bn,Item:Yi,Slot:Zt,Row:Ne,Group:Hr,Separator:Fo,Submenu:kt});function md(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var vg=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"})}),B1="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",Z1="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",q1={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},K1={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},z1={color:"var(--doc-text-muted)",flexShrink:0},V1={textAlign:"right",wordBreak:"break-word"},$1={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},W1={display:"flex",gap:8,marginTop:4},yg={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 U1(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 G1(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 Zn({label:e,value:t,testId:n}){return jsxRuntime.jsxs("div",{style:K1,"data-testid":n,children:[jsxRuntime.jsx("span",{style:z1,children:e}),jsxRuntime.jsx("span",{style:V1,children:t})]})}function j1({className:e,asChild:t,hidden:n,children:o,preset:r=true}){let i=Et(),a=nt.useRef(null),l=nt.useId(),{t:c}=N(),{control:s,inspectorOpen:d,closeInspector:m}=i;if(nt.useEffect(()=>{if(!d)return;let f=y=>{y.key==="Escape"&&(y.preventDefault(),m());},b=y=>{let T=a.current;T&&y.target instanceof Node&&T.contains(y.target)||m();};return document.addEventListener("keydown",f),document.addEventListener("mousedown",b,true),()=>{document.removeEventListener("keydown",f),document.removeEventListener("mousedown",b,true);}},[d,m]),nt.useEffect(()=>{d&&!s&&m();},[d,s,m]),n||!d||!s)return null;let p=r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(xg,{}),jsxRuntime.jsx(Sg,{}),jsxRuntime.jsx("div",{style:W1,children:jsxRuntime.jsx(Tg,{})}),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:q1,onMouseDown:f=>{md(f),f.stopPropagation();}},u=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{id:l,className:"docx-editor-sr-only",children:c("contentControl.inspectorPanel.title")}),p]});return t?jsxRuntime.jsx(j,{...g,children:u}):jsxRuntime.jsx("div",{...g,children:u})}function xg({className:e,asChild:t,hidden:n,children:o}){let{closeInspector:r}=Et(),{t:i}=N();if(n)return null;let a={style:$1,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:{...yg,padding:4,border:"none",background:"transparent"},onMouseDown:md,onClick:()=>r(),children:vg(B1)})]});return t?jsxRuntime.jsx(j,{...a,children:l}):jsxRuntime.jsx("div",{...a,children:l})}function Sg({className:e,asChild:t,hidden:n,children:o}){let{control:r}=Et(),{t:i}=N();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(Zn,{label:i("contentControl.inspectorPanel.alias"),value:r.alias??a,testId:"content-control-inspector-alias"}),jsxRuntime.jsx(Zn,{label:i("contentControl.inspectorPanel.tag"),value:r.tag??a,testId:"content-control-inspector-tag"}),jsxRuntime.jsx(Zn,{label:i("contentControl.inspectorPanel.type"),value:i(U1(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(Zn,{label:i("contentControl.inspectorPanel.lock"),value:i(G1(r)),testId:"content-control-inspector-lock"}),jsxRuntime.jsx(Zn,{label:i("contentControl.inspectorPanel.placeholder"),value:r.placeholder?l:c,testId:"content-control-inspector-placeholder"}),jsxRuntime.jsx(Zn,{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 Tg({className:e,asChild:t,hidden:n,icon:o,children:r}){let{canRemove:i,removeDisabledReason:a,remove:l,closeInspector:c}=Et(),{t:s}=N();if(n)return null;let d=s("contentControl.remove"),m={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:yg,onMouseDown:md,onClick:()=>{l().ok&&c();}},p=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o??r??vg(Z1),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(j,{...m,children:p}):jsxRuntime.jsx("button",{...m,children:p})}var el=Object.assign(j1,{Header:xg,Fields:Sg,Remove:Tg});var Q1={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},e2={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},t2={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},o2={flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",scrollbarGutter:"stable both-edges",backgroundColor:"var(--doc-bg)"},n2={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},r2={flex:"none",display:"flex",flexDirection:"column",position:"relative",zIndex:"var(--doc-z-overlay)",backgroundColor:"var(--doc-surface)",borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:"var(--doc-border)",boxShadow:"0 1px 3px var(--doc-shadow-subtle)"},a2={padding:"8px 12px"},i2={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},l2={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},s2={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function c2({forwardedRef:e}){let t=H(),n=nt.useRef(null);return n.current=t,Iu({ref:e,editorRef:n}),null}var d2=nt.forwardRef(function(t,n){let{document:o,fonts:r,className:i,t:a,chrome:l=true,title:c,onTitleChange:s,renderTitleBarLeft:d,renderTitleBarRight:m,colorMode:p="light",author:g,locale:u,mode:f="edit",modules:b,zoom:y,zoomMode:T,onReady:h,onChange:v,onFontError:S,onOpen:x,onSave:w,hyperlinkPopup:C,contextMenu:k=true,menu:R=true,navigation:_=true,rulers:L=true}=t,[F,I]=nt.useState(Kd);nt.useEffect(()=>{if(p==="system")return Vd(I)},[p]);let M=zd(p,F),{t:E}=N(),D=nt.useCallback(($,ne)=>a?a($,ne):E($,ne),[a,E]),ae=jsxRuntime.jsxs(Fa,{className:l?M?"dark":void 0:i,style:l?e2:void 0,children:[l?jsxRuntime.jsx(qi,{}):null,l?jsxRuntime.jsx($i,{}):null,jsxRuntime.jsx(Ra,{}),jsxRuntime.jsx(zi,{hidden:C===false}),jsxRuntime.jsx(Vi,{}),k===false?null:jsxRuntime.jsx(da,{t:D,...typeof k=="object"?k:{}}),jsxRuntime.jsx(el,{}),L&&l?jsxRuntime.jsx("div",{style:n2,"aria-hidden":"true",children:jsxRuntime.jsx(_i,{})}):null,t.children]}),z=l?jsxRuntime.jsxs("div",{className:`docx-editor${M?" dark":""}${i?` ${i}`:""}`,style:Q1,children:[jsxRuntime.jsxs("div",{style:r2,children:[jsxRuntime.jsxs("div",{style:i2,children:[d?.(),jsxRuntime.jsxs("div",{style:l2,children:[s?jsxRuntime.jsx("input",{"aria-label":D("titleBar.documentNameAriaLabel"),value:c??"",placeholder:D("titleBar.untitled"),onChange:$=>s($.target.value),style:s2}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??D("titleBar.untitled")}),R!==false?jsxRuntime.jsx(Zr,{t:D,...c!==void 0?{fileName:c}:{},...x?{onOpen:x}:{},...w?{onSave:w}:{},...typeof R=="object"?R:{}}):null]}),m?.()]}),jsxRuntime.jsx("div",{style:a2,children:jsxRuntime.jsx(Dr,{t:D})})]}),L?jsxRuntime.jsx("div",{style:o2,"data-testid":"docx-editor-ruler-row",children:jsxRuntime.jsx(Ii,{})}):null,jsxRuntime.jsx(Zi,{t:D}),jsxRuntime.jsxs("div",{style:t2,children:[_?jsxRuntime.jsx(Hi,{t:D}):null,ae,jsxRuntime.jsx(Oi.Provider,{value:D,children:jsxRuntime.jsx(Bi,{})}),jsxRuntime.jsx(Ma,{overlay:true})]})]}):ae,V=nt.useCallback($=>D($),[D]);return jsxRuntime.jsxs(or,{...o!==void 0?{document:o}:{},...r?{fonts:r}:{},...g!==void 0?{author:g}:{},...u!==void 0?{locale:u}:{},translate:D,mode:f,...b!==void 0?{modules:b}:{},...y!==void 0?{zoom:y}:{},...T!==void 0?{zoomMode:T}:{},tableInteractionLabel:V,...h?{onReady:h}:{},...v?{onChange:v}:{},...S?{onFontError:S}:{},children:[jsxRuntime.jsx(c2,{forwardedRef:n}),jsxRuntime.jsx(ko.Provider,{value:l,children:z})]})}),u2=nt.forwardRef(function(t,n){return jsxRuntime.jsx(nn,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(d2,{...t,ref:n})})}),p2=Object.assign(u2,{Root:or,Viewport:Fa,Content:Ra,Toolbar:Dr,Menu:Zr,Loading:Ma,ColorByChangeType:zl,AuthorStyle:Vl,HorizontalRuler:Ii,VerticalRuler:_i,DocumentOutline:Dc,Navigation:Hi,PageSetupDialog:Nr,ParagraphDialog:Mo,PageNumber:Bi,FontNotice:Zi,HeaderFooterChrome:qi,NotesChrome:$i,Equation:Vi,HyperLink:zi,ContextMenu:pd,ContentControl:el});function h2(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function fd(e){return Array.isArray(e)?e:[e]}function v2(e){if(typeof e!="function"||editor.isFontResolver(e))return e;let t=e;return editor.defineFontResolver(async()=>t())}function wg(e){return e!==void 0&&fd(e).some(t=>editor.isFontResolver(t))}async function y2(e){return typeof e!="function"?await e:await e()}function x2(e,t={}){let[n,o]=nt.useState(void 0),[r,i]=nt.useState(void 0),[a,l]=nt.useState(null),[c,s]=nt.useState(e!=null),d=wg(t.fonts),m=t.fonts===void 0?"absent":d?"on-demand":"eager",[p,g]=nt.useState(t.fonts===void 0),u=nt.useRef(t);u.current=t;let f=nt.useMemo(()=>editor.defineFontResolver(b=>editor.composeFontOrigins(fd(u.current.fonts??[]).map(v2),b)),[]);return nt.useEffect(()=>{let b=u.current.fonts;if(b===void 0){i(void 0),g(true);return}if(wg(b)){g(true);return}g(false);let y=true;return (async()=>{try{let T=await Promise.allSettled(fd(b).map(y2)),h=[];for(let v of T){if(v.status==="rejected"){console.warn("[fonts] font loading failed for one origin; the others still compose",v.reason);continue}v.value!==void 0&&h.push(v.value);}y&&h.length>0&&i(editor.composeFontConfiguration(h[0],...h.slice(1)));}catch(T){console.warn("[fonts] font loading failed; the fixed measurer stays in effect",T);}finally{y&&g(true);}})(),()=>{y=false;}},[m]),nt.useEffect(()=>{if(e==null){o(void 0),l(null),s(false);return}let b=h2(e);if(b){o(b),l(null),s(false);return}let y=true,T=new AbortController;return s(true),l(null),(async()=>{try{let h=await fetch(String(e),{...u.current.fetchOptions,signal:T.signal});if(!h.ok)throw new Error(`could not open the document: ${h.status} ${h.statusText}`);let v=new Uint8Array(await h.arrayBuffer());if(!y)return;o(v),s(!1);}catch(h){if(!y||h instanceof Error&&h.name==="AbortError")return;l(h instanceof Error?h:new Error("could not open the document")),s(false);}})(),()=>{y=false,T.abort();}},[e]),{document:p?n:void 0,fonts:d?f:r,error:a,isLoading:c||!p}}function E2(...e){let t=nt.useRef(e);return t.current=e,nt.useMemo(()=>editor.defineFontResolver(n=>editor.composeFontOrigins(t.current,n)),[])}function k2(e){let n=e?.surface?.state?.().selection?.head;return n&&typeof n.paragraphId=="string"&&Number.isFinite(n.offset)?n:null}function M2(){let e=H(),t=nt.useRef(null),n=nt.useCallback(r=>{if(!e)return ()=>{};let i=e.on("selectionChange",r),a=e.on("change",r);return ()=>{i(),a();}},[e]),o=nt.useCallback(()=>{let r=k2(e),i=t.current;return (r===null?i===null:i!==null&&I2(i,r))?i:(t.current=r,r)},[e]);return nt.useSyncExternalStore(n,o,()=>null)}function I2(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}function gd({source:e,scale:t,measurer:n,onStateChange:o,onError:r,className:i,documentFontFamily:a,ref:l}){let c=nt.useRef(null),s=nt.useRef(null),[d,m]=nt.useState(null),p=nt.useRef(o);p.current=o;let g=nt.useRef(r);return g.current=r,nt.useEffect(()=>{let u=c.current;if(!u)return;let f=editor.mountPaginatedSurface(u,e,{...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onChange:y=>{m(y),p.current?.(y);}});if(!f.ok){g.current?.(f.reason,f.detail);return}s.current=f.surface;let b=f.surface.state();return m(b),p.current?.(b),()=>{f.surface.destroy(),s.current=null;}},[e,n]),nt.useImperativeHandle(l,()=>({focus:()=>s.current?.focus(),type:u=>s.current?.type(u),undo:()=>s.current?.undo(),redo:()=>s.current?.redo(),selectAll:()=>s.current?.selectAll(),navigate:(u,f)=>s.current?.navigate(u,f),toggleRunProperty:(u,f)=>s.current?.toggleRunProperty(u,f),setRunProperty:(u,f)=>s.current?.setRunProperty(u,f),setParagraphProperty:(u,f,b)=>s.current?.setParagraphProperty(u,f,b),formatting:()=>s.current?.formatting()??null,sectionProperties:()=>s.current?.sectionProperties()??null,save:()=>{let u=s.current;return u?(u.flushPendingInput(),u.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 ma=nt.createContext(null);function Ig(){let e=nt.useContext(ma);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function B2(e){return "type"in e&&e.type==="separator"}var Ng={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"},Z2={...Ng,background:"var(--doc-bg-hover)"},Lg={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"},q2={...Lg,opacity:.4,cursor:"default"},K2={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},z2={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},V2={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 fa({label:e,items:t,disabled:n,showChevron:o=false}){let[r,i]=nt.useState(false),[a,l]=nt.useState(null),c=nt.useRef(null),s=nt.useRef(null),[d,m]=nt.useState({top:0,left:0}),p=nt.useCallback(()=>{i(false),l(null);},[]);nt.useEffect(()=>{if(!r||!c.current)return;let u=c.current.getBoundingClientRect();m({top:u.bottom+2,left:u.left});},[r]),nt.useEffect(()=>{if(!r)return;function u(y){let T=y.target;c.current&&!c.current.contains(T)&&s.current&&!s.current.contains(T)&&p();}function f(y){y.key==="Escape"&&p();}function b(){p();}return document.addEventListener("mousedown",u),document.addEventListener("keydown",f),window.addEventListener("scroll",b,true),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f),window.removeEventListener("scroll",b,true);}},[r,p]);let g=u=>{u.disabled||u.submenuContent||u.onClick&&(u.onClick(),p());};return jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.jsxs("button",{ref:c,type:"button",onClick:()=>!n&&i(!r),onMouseDown:u=>u.preventDefault(),disabled:n,style:r?Z2:Ng,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:u=>u.preventDefault(),children:t.map((u,f)=>{if(B2(u))return jsxRuntime.jsx("div",{style:K2},`sep-${f}`);let b=u;if(b.customContent)return jsxRuntime.jsx("div",{onMouseDown:h=>h.preventDefault(),children:b.customContent},b.label);let y=!!b.submenuContent,T=a===b.label;return jsxRuntime.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>y&&l(b.label),onMouseLeave:()=>y&&l(null),children:[jsxRuntime.jsxs("button",{type:"button",style:b.disabled?q2:Lg,onClick:()=>g(b),onMouseDown:h=>h.preventDefault(),onMouseOver:h=>{b.disabled||(h.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseOut:h=>{h.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:z2,children:b.shortcut}),y&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(K,{name:"keyboard_arrow_right",size:16})})]}),y&&T&&jsxRuntime.jsx("div",{style:V2,onMouseDown:h=>h.preventDefault(),children:b.submenuContent(p)})]},b.label)})})]})}var vd=18,W2=2,Ag={width:vd,height:vd,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},U2={...Ag,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},G2={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function Hg({onInsert:e,gridRows:t=6,gridColumns:n=6}){let[o,r]=nt.useState(0),[i,a]=nt.useState(0),l=nt.useCallback(()=>{o>0&&i>0&&e(o,i);},[o,i,e]),c=[];for(let d=1;d<=t;d++)for(let m=1;m<=n;m++){let p=d<=o&&m<=i;c.push(jsxRuntime.jsx("div",{style:p?U2:Ag,onMouseEnter:()=>{r(d),a(m);},onClick:l,role:"gridcell","aria-selected":p},`${d}-${m}`));}let s=o>0&&i>0?`${i} \xD7 ${o}`:"Select size";return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{display:"grid",gap:W2,gridTemplateColumns:`repeat(${n}, ${vd}px)`},onMouseLeave:()=>{r(0),a(0);},role:"grid","aria-label":"Table size selector",children:c}),jsxRuntime.jsx("div",{style:G2,children:s})]})}function J2({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 Q2(){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 nl({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function ew(e){return e.replace(/\.docx$/i,"")}function xd({value:e,onChange:t,placeholder:n,editable:o=true}){let{t:r}=N(),i=n??r("titleBar.untitled"),a=ew(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 rl({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function al(){let{t:e}=N(),t=Ig(),{disabled:n=false,onFormat:o,onPrint:r,onOpen:i,onSave:a,onPageSetup:l,onInsertImage:c,onInsertTable:s,showTableInsert:d=true,showHelpMenu:m=true,onInsertPageBreak:p,onInsertSectionBreakNextPage:g,onInsertSectionBreakContinuous:u,onInsertTOC:f,onWatermark:b,onRefocusEditor:y}=t,T=nt.useCallback(x=>{!n&&o&&o(x);},[n,o]),h=nt.useCallback((x,w)=>{!n&&s&&(s(x,w),requestAnimationFrame(()=>y?.()));},[n,s,y]),v=!!r||!!l,S=v||i||a;return jsxRuntime.jsxs("div",{className:"flex items-center",role:"menubar","aria-label":e("titleBar.menuBarAriaLabel"),children:[S&&jsxRuntime.jsx(fa,{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)&&v?[{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(fa,{label:e("toolbar.format"),disabled:n,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>T("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>T("setRtl")}]}),jsxRuntime.jsx(fa,{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(Hg,{onInsert:(w,C)=>{h(w,C),x();}})}]:[],...c||d&&s?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:x=>jsxRuntime.jsx(J2,{closeMenu:x,items:[{icon:"page_break",label:e("toolbar.pageBreak"),onClick:p},{icon:"horizontal_rule",label:e("toolbar.sectionBreakNextPage"),onClick:g},{icon:"border_horizontal",label:e("toolbar.sectionBreakContinuous"),onClick:u}]})},{icon:"format_list_numbered",label:e("toolbar.tableOfContents"),onClick:f,disabled:!f},...b?[{icon:"branding_watermark",label:e("toolbar.watermark"),onClick:b}]:[]]}),m&&jsxRuntime.jsx(fa,{label:e("toolbar.help"),disabled:n,items:[{label:e("toolbar.reportIssue"),onClick:()=>Fr()}]})]})}function Sd({children:e}){let t=null,n=null,o=[],r=[];nt.Children.forEach(e,a=>{nt.isValidElement(a)&&(a.type===nl?t=a:a.type===rl?n=a:a.type===al?r.push(a):o.push(a));});let i=nt.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(Q2,{})}),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 il={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},rw={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:""},Og={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 aw(e,t){let n=Og[t]??Og[t.toLowerCase()]??t,r=e?.colorScheme?.[n];return typeof r=="string"&&r?r:il[n]??"000000"}function Bg(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 Td(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex")return `#${Bg(e.value)??n}`;let o=Object.entries(t?.colorScheme??il).map(([i,a])=>({slot:i,hex:String(a)})),r=editor.resolveThemeColorHex(e,o);return `#${r.ok?r.hex:aw(t,e.slot)}`}function zt(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?Bg(e.value):Td(e,t).slice(1)}function Zg(e){if(!e||e==="none")return "";let t=rw[e];return t?`#${t}`:""}var iw=[{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"}],lw=[{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 qg(e){let t=e??il;return lw.map(n=>iw.map(o=>{let r=t[o.slot]??il[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 te(...e){return clsx.clsx(e)}var dw=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"}}),Oe=nt__namespace.forwardRef(({className:e,variant:t,size:n,...o},r)=>jsxRuntime.jsx("button",{className:te(dw({variant:t,size:n,className:e})),ref:r,...o}));Oe.displayName="Button";function ct({content:e,children:t,side:n="bottom",delayMs:o=400}){let[r,i]=nt__namespace.useState(false),[a,l]=nt__namespace.useState({x:0,y:0}),c=nt__namespace.useRef(null),s=nt__namespace.useRef(null),d=nt__namespace.useCallback(()=>{s.current=setTimeout(()=>{if(c.current){let u=c.current.getBoundingClientRect(),f=u.left+u.width/2,b=n==="top"?u.top-8:u.bottom+8;l({x:f,y:b});}i(true);},o);},[o,n]),m=nt__namespace.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),i(false);},[]);nt__namespace.useEffect(()=>()=>{s.current&&clearTimeout(s.current);},[]);let p=t.props,g=nt__namespace.cloneElement(t,{ref:c,onMouseEnter:u=>{d(),p.onMouseEnter?.(u);},onMouseLeave:u=>{m(),p.onMouseLeave?.(u);}});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 lo=ye__namespace.Root,so=ye__namespace.Group,ll=ye__namespace.Value;function co({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(ye__namespace.Trigger,{className:te("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(gw,{className:"h-4 w-4 text-muted-foreground shrink-0"})})]})}function uo({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:te("docx-editor",i&&"dark"),children:jsxRuntime.jsx(ye__namespace.Content,{className:te("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:te("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 Uo({className:e,...t}){return jsxRuntime.jsx(ye__namespace.Label,{className:te("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:te("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(bw,{className:"h-4 w-4"})})})]})}function Go({className:e,...t}){return jsxRuntime.jsx(ye__namespace.Separator,{className:te("-mx-1 my-1 h-px bg-muted",e),...t})}function gw({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 bw({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 Cd(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 hw=[{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 Vg({value:e,onChange:t,fonts:n=hw,documentFonts:o,disabled:r=false,className:i,placeholder:a="Arial",width:l=120,showPreview:c=true}){let{t:s}=N(),d=nt__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]),m=nt__namespace.useMemo(()=>[...d,...n],[d,n]),p=nt__namespace.useMemo(()=>e?m.find(b=>b.fontFamily===e||b.name.toLowerCase()===e.toLowerCase()||Cd(b.fontFamily).toLowerCase()===e.toLowerCase())?.name||e:a,[e,m,a]),g=nt__namespace.useCallback(f=>{let b=m.find(y=>y.name===f);b&&t?.(Cd(b.fontFamily)||b.name);},[t,m]),u=nt__namespace.useMemo(()=>{let f={"sans-serif":[],serif:[],monospace:[],other:[]};return n.forEach(b=>{let y=b.category||"other";f[y].push(b);}),f},[n]);return jsxRuntime.jsxs(lo,{value:p,onValueChange:g,disabled:r,children:[jsxRuntime.jsx(co,{className:te("h-8 text-sm",i),style:{minWidth:typeof l=="number"?`${l}px`:l},"aria-label":s("font.selectAriaLabel"),children:jsxRuntime.jsx(ll,{placeholder:a,children:p})}),jsxRuntime.jsxs(uo,{className:"max-h-[300px]",children:[d.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(so,{children:[jsxRuntime.jsx(Uo,{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(Go,{})]}),u["sans-serif"].length>0&&jsxRuntime.jsxs(so,{children:[jsxRuntime.jsx(Uo,{children:s("font.sansSerif")}),u["sans-serif"].map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]}),u.serif.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Go,{}),jsxRuntime.jsxs(so,{children:[jsxRuntime.jsx(Uo,{children:s("font.serif")}),u.serif.map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]})]}),u.monospace.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Go,{}),jsxRuntime.jsxs(so,{children:[jsxRuntime.jsx(Uo,{children:s("font.monospace")}),u.monospace.map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))]})]}),u.other.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Go,{}),jsxRuntime.jsx(so,{children:u.other.map(f=>jsxRuntime.jsx(dt,{value:f.name,style:c?{fontFamily:f.fontFamily}:void 0,children:f.name},f.name))})]})]})]})}function Pd(e){if(e===void 0)return;let t=e.map(n=>typeof n=="string"?{name:n,fontFamily:n,category:"other"}:n);return t}function Sw(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 Qe({isOpen:e,onClose:t,align:n="left"}){let o=nt.useRef(null),r=nt.useRef(null),[i,a]=nt.useState({top:0,left:0});nt.useEffect(()=>{if(!e||!o.current)return;let s=o.current.getBoundingClientRect();n==="right"?requestAnimationFrame(()=>{if(r.current){let d=r.current.getBoundingClientRect(),m=Sw(s.bottom+4,s.right-d.width,d.width,d.height);a(m);}else a({top:s.bottom+4,left:s.left});}):a({top:s.bottom+4,left:s.left});},[e,n]),nt.useEffect(()=>{if(!e)return;let s=performance.now()+150,d=g=>{let u=g.target;o.current&&!o.current.contains(u)&&r.current&&!r.current.contains(u)&&t();},m=g=>{g.key==="Escape"&&t();},p=g=>{if(performance.now()<s)return;let u=g.target;u&&r.current&&r.current.contains(u)||u instanceof Element&&u!==document.documentElement&&u!==document.body&&o.current&&u.contains(o.current)||t();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),window.addEventListener("scroll",p,true),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m),window.removeEventListener("scroll",p,true);}},[e,t]);let l=nt.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 Pw=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Ew=1,ww=400;function Ug(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Gg(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 jg({value:e,onChange:t,sizes:n=Pw,disabled:o=false,className:r,placeholder:i="11",minSize:a=Ew,maxSize:l=ww}){let{t:c}=N(),[s,d]=nt.useState(false),[m,p]=nt.useState(""),[g,u]=nt.useState(false),f=nt.useRef(null),b=nt.useCallback(()=>{u(false),d(false);},[]),{containerRef:y,dropdownRef:T,dropdownStyle:h}=Qe({isOpen:g,onClose:b}),v=e??(parseInt(i,10)||11),S=e!==void 0?e.toString():i,x=nt.useCallback(I=>{if(I.preventDefault(),o)return;let M=Gg(v,n,a);t?.(M);},[v,n,a,o,t]),w=nt.useCallback(I=>{if(I.preventDefault(),o)return;let M=Ug(v,n,l);t?.(M);},[v,n,l,o,t]),C=nt.useCallback(I=>{I.preventDefault(),!o&&(d(true),p(S),u(true),requestAnimationFrame(()=>{f.current?.focus(),f.current?.select();}));},[o,S]),k=nt.useCallback(I=>{p(I.target.value);},[]),R=nt.useCallback(()=>{d(false);let I=parseFloat(m);if(!isNaN(I)&&I>=a&&I<=l){let M=Math.round(I*2)/2;t?.(M);}},[m,a,l,t]),_=nt.useCallback(I=>{if(I.key==="Enter")I.preventDefault(),R(),u(false);else if(I.key==="Escape")d(false),u(false);else if(I.key==="ArrowUp"){I.preventDefault();let M=Ug(v,n,l);p(M.toString()),t?.(M);}else if(I.key==="ArrowDown"){I.preventDefault();let M=Gg(v,n,a);p(M.toString()),t?.(M);}},[R,v,n,l,a,t]),L=nt.useCallback(I=>{t?.(I),u(false),d(false);},[t]),F=nt.useCallback(I=>{I.target.tagName!=="INPUT"&&I.preventDefault();},[]);return jsxRuntime.jsxs("div",{ref:y,className:te("flex items-center",r),onMouseDown:F,children:[jsxRuntime.jsx(Oe,{variant:"ghost",size:"icon-sm",className:te("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||v<=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:m,onChange:k,onBlur:R,onKeyDown:_,className:te("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:C,className:te("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:S})}),g&&jsxRuntime.jsx("div",{ref:T,style:{...h,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:()=>L(I),className:te("w-full px-3 py-1.5 text-sm text-left","hover:bg-muted",I===v&&"bg-muted font-medium"),role:"option","aria-selected":I===v,children:I},I))}),jsxRuntime.jsx(Oe,{variant:"ghost",size:"icon-sm",className:te("h-7 w-7 text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",o&&"opacity-30 cursor-not-allowed"),onMouseDown:w,disabled:o||v>=l,"aria-label":c("fontSize.increase"),"data-testid":"font-size-increase",children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var Mw=[{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"}],cl=18,Iw=2,_w={position:"relative",display:"inline-block"},Dw={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)"},Nw={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},Rd={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},kd={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},Jg={display:"grid",gap:`${Iw}px`},dl={width:`${cl}px`,height:`${cl}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},Qg={...dl,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},e0={...dl,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},Lw={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)"},Fw={display:"flex",alignItems:"center",gap:"6px"},Aw={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},Hw={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},Yg={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},Ow={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},Bw={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)"},Zw={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 Md(e,t,n){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let o=Zg(e);return o||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return Td(e,n)}function Xg(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 t0(e,t,n){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():zt(e,n))===t.toUpperCase():false}function qw({matrix:e,selectedColor:t,theme:n,onSelect:o}){let[r,i]=nt.useState(null);return jsxRuntime.jsx("div",{style:{...Jg,gridTemplateColumns:`repeat(10, ${cl}px)`},children:e.flatMap((a,l)=>a.map((c,s)=>{let d=`${l}-${s}`,m=r===d,p=t0(t,c.hex,n);return jsxRuntime.jsx("button",{type:"button",style:{...p?e0:m?Qg:dl,backgroundColor:`#${c.hex}`},title:c.label,"aria-label":c.label,"aria-selected":p,onClick:()=>o(c),onMouseDown:g=>g.preventDefault(),onMouseEnter:()=>i(d),onMouseLeave:()=>i(null)},d)}))})}function Kw({selectedColor:e,theme:t,onSelect:n}){let[o,r]=nt.useState(null),{t:i}=N();return jsxRuntime.jsx("div",{style:{...Jg,gridTemplateColumns:`repeat(10, ${cl}px)`},children:Mw.map((a,l)=>{let c=o===l,s=t0(e,a.hex,t),d=i(a.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...s?e0:c?Qg:dl,backgroundColor:`#${a.hex}`},title:d,"aria-label":d,"aria-selected":s,onClick:()=>n(a.hex),onMouseDown:m=>m.preventDefault(),onMouseEnter:()=>r(l),onMouseLeave:()=>r(null)},a.hex)})})}function Xo({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:m}){let[p,g]=nt.useState(false),[u,f]=nt.useState(false),[b,y]=nt.useState(false),[T,h]=nt.useState(false),[v,S]=nt.useState(""),[x,w]=nt.useState(()=>m??(e==="highlight"?"FFFF00":e==="border"?{kind:"hex",value:"000000"}:{kind:"hex",value:"FF0000"})),{t:C}=N();nt.useEffect(()=>{let U=Md(t,e,o).replace(/^#/,"");/^[0-9A-Fa-f]{6}$/.test(U)&&S(U.toUpperCase());},[t,e,o]);let k=nt.useCallback(()=>g(false),[]),{containerRef:R,dropdownRef:_,dropdownStyle:L}=Qe({isOpen:p,onClose:k}),F=o?.colorScheme??null,I=nt.useMemo(()=>qg(F),[F]),M=nt.useMemo(()=>Md(t,e,o),[t,e,o]),E=nt.useMemo(()=>Md(x,e,o),[x,e,o]),D=nt.useCallback(()=>{r||g(U=>!U);},[r]),ae=nt.useCallback(U=>{let Z;e==="highlight"?Z=U.hex:Z={kind:"theme",slot:U.themeSlot,...U.tint!==void 0?{tint:U.tint}:{},...U.shade!==void 0?{shade:U.shade}:{}},w(Z),n?.(Z),g(false);},[e,n]),z=nt.useCallback(U=>{let Z=e==="highlight"?U:{kind:"hex",value:U};w(Z),n?.(Z),g(false);},[e,n]),V=nt.useCallback(()=>{n?.(e==="highlight"?"none":{kind:"auto"}),g(false);},[e,n]),$=nt.useCallback(()=>{let U=v.replace(/^#/,"").toUpperCase();if(/^[0-9A-F]{6}$/i.test(U)){let Z=e==="highlight"?U:{kind:"hex",value:U};w(Z),n?.(Z),g(false),S("");}},[e,v,n]),ne=nt.useCallback(()=>{r||n?.(x);},[r,x,n]),re={...Dw,...r?{cursor:"default",opacity:.38}:p?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:u?{backgroundColor:"var(--doc-bg-hover)"}:{}},be=C(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:R,className:`docx-color-picker ${i||""}`,style:{..._w,...a},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...Ow,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...Bw,...r?{cursor:"default"}:b?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:ne,onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),disabled:r,title:l||be,"aria-label":l||be,children:[jsxRuntime.jsx(K,{name:he,size:18}),jsxRuntime.jsx("div",{style:{...Yg,backgroundColor:E==="transparent"?"#fff":E,outline:E==="transparent"||Xg(E)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...Zw,...r?{cursor:"default"}:p?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:T?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:D,onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),disabled:r,title:l||be,"aria-label":l||be,"aria-haspopup":"true","aria-expanded":p,children:jsxRuntime.jsx(K,{name:"arrow_drop_down",size:18})})]}):jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:re,onClick:D,onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),disabled:r,title:l||be,"aria-label":l||be,"aria-haspopup":"true","aria-expanded":p,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:{...Yg,backgroundColor:M==="transparent"?"#fff":M,outline:M==="transparent"||Xg(M)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14})]}),p&&jsxRuntime.jsx("div",{ref:_,className:"docx-color-picker-dropdown",style:{...L,...Nw},role:"dialog","aria-label":`${be} picker`,onMouseDown:U=>{U.target.tagName!=="INPUT"&&U.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:Lw,onClick:V,onMouseDown:U=>U.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??C(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:kd}),jsxRuntime.jsx("div",{style:Rd,children:C("colorPicker.themeColors")}),jsxRuntime.jsx(qw,{matrix:I,selectedColor:t,theme:o,onSelect:ae}),jsxRuntime.jsx("div",{style:kd}),jsxRuntime.jsx("div",{style:Rd,children:C("colorPicker.standardColors")}),jsxRuntime.jsx(Kw,{selectedColor:t,theme:o,onSelect:z}),jsxRuntime.jsx("div",{style:kd}),jsxRuntime.jsx("div",{style:Rd,children:C("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:Fw,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:Aw,value:v,onChange:U=>S(U.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:U=>{U.key==="Enter"&&$();},onMouseDown:U=>{U.stopPropagation();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:{...Hw,opacity:/^[0-9A-Fa-f]{6}$/.test(v)?1:.4,cursor:/^[0-9A-Fa-f]{6}$/.test(v)?"pointer":"default"},onClick:$,onMouseDown:U=>U.preventDefault(),disabled:!/^[0-9A-Fa-f]{6}$/.test(v),children:C("common.apply")})]})]})})]})}var ba=20,Id=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_left",size:ba}),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:ba}),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:ba}),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:ba}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function r0({value:e="left",onChange:t,disabled:n=false}){let{t:o}=N(),[r,i]=nt.useState(false),a=nt.useCallback(()=>i(false),[]),{containerRef:l,dropdownRef:c,dropdownStyle:s,handleMouseDown:d}=Qe({isOpen:r,onClose:a}),m=nt.useCallback(y=>{n||t?.(y),i(false);},[n,t]),p=Id.find(y=>y.value===e)||Id[0],g=o(p.labelKey),u=p.shortcutKey?o(p.shortcutKey):void 0,f=`${g}${u?` (${u})`:""}`,b=jsxRuntime.jsxs(Oe,{variant:"ghost",size:"icon-sm",className:te("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",n&&"opacity-30 cursor-not-allowed"),onMouseDown:d,onClick:()=>!n&&i(y=>!y),disabled:n,"aria-label":f,"aria-expanded":r,"aria-haspopup":"true","data-testid":"toolbar-alignment",children:[jsxRuntime.jsx(K,{name:p.iconName,size:ba}),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:y=>y.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",gap:2},children:Id.map(y=>{let T=e===y.value,h=o(y.labelKey),v=y.shortcutKey?o(y.shortcutKey):void 0;return jsxRuntime.jsx("button",{type:"button",title:`${h}${v?` (${v})`:""}`,"data-testid":`alignment-${y.value}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:T?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:T?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:S=>S.preventDefault(),onMouseEnter:S=>{T||(S.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=T?"var(--doc-primary-light)":"transparent";},onClick:()=>m(y.value),children:jsxRuntime.jsx(K,{name:y.iconName,size:18})},y.value)})})})]})}function ul(){return {type:"none",level:0,isInList:false}}var Uw={display:"inline-flex",alignItems:"center",gap:"4px"},a0={display:"inline-flex",alignItems:"center",gap:"4px"},gl={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)"},Gw={...gl,backgroundColor:"var(--doc-bg-hover)"},jw={...gl,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},Yw={...gl,cursor:"default",opacity:.38},Xw={width:"28px",height:"28px",padding:"2px"},Jw={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},pl=20;function ml({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,style:a}){let[l,c]=nt.useState(false),s={...t?Yw:e?jw:l?Gw:gl,...a},d=m=>{m.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 i0({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:m}=N(),p=nt.useCallback(()=>s?{...Xw}:{},[s]),g=e?.type==="bullet",u=e?.type==="numbered",b=(e?.isInList||g||u)&&(e?.level??0)>0||d;return jsxRuntime.jsxs("div",{className:`docx-list-buttons ${a||""}`,style:{...Uw,...l},role:"group","aria-label":m("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:a0,role:"group","aria-label":m("lists.typeAriaLabel"),children:[jsxRuntime.jsx(ml,{active:g,disabled:i,title:m("lists.bulletList"),onClick:t,style:p(),children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:pl})}),jsxRuntime.jsx(ml,{active:u,disabled:i,title:m("lists.numberedList"),onClick:n,style:p(),children:jsxRuntime.jsx(K,{name:"format_list_numbered",size:pl})})]}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:Jw,role:"separator"}),jsxRuntime.jsxs("div",{style:a0,role:"group","aria-label":m("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(ml,{active:false,disabled:i||!b,title:m("lists.decreaseIndent"),onClick:r,style:p(),children:jsxRuntime.jsx(K,{name:"format_indent_decrease",size:pl})}),jsxRuntime.jsx(ml,{active:false,disabled:i,title:m("lists.increaseIndent"),onClick:o,style:p(),children:jsxRuntime.jsx(K,{name:"format_indent_increase",size:pl})})]})]})]})}var e8=[{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 s0({value:e,onChange:t,options:n=e8,disabled:o=false,className:r}){let{t:i}=N(),a=nt__namespace.useMemo(()=>e===void 0?n[0]:n.find(s=>s.twipsValue===e)||n[0],[e,n]),l=nt__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(lo,{value:a.twipsValue.toString(),onValueChange:l,disabled:o,children:[jsxRuntime.jsx(co,{className:te("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(Ic,{className:"h-5 w-5 shrink-0"})}),jsxRuntime.jsxs(uo,{children:[n.map(s=>jsxRuntime.jsx(dt,{value:s.twipsValue.toString(),children:c(s)},s.twipsValue)),jsxRuntime.jsx(Go,{}),jsxRuntime.jsx(so,{children:jsxRuntime.jsx(Uo,{children:i("lineSpacing.blockSpacingRules")})})]})]})}var c0=[{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 d0({value:e,onChange:t,styles:n,disabled:o=false,className:r,width:i=120}){let{t:a}=N(),l=nt__namespace.useMemo(()=>{let g=im(n);return g.length===0?c0:g.map(u=>({...u,type:"paragraph",nameKey:c0.find(f=>f.styleId===u.styleId)?.nameKey}))},[n]),c=nt__namespace.useCallback(g=>{t?.(g);},[t]),s=g=>g.nameKey?a(g.nameKey):g.name,d=e||"Normal",m=l.find(g=>g.styleId===d),p=m?s(m):d;return jsxRuntime.jsxs(lo,{value:d,onValueChange:c,disabled:o,children:[jsxRuntime.jsx(co,{className:te("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:p})}),jsxRuntime.jsx(uo,{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:am(g),children:s(g)})},g.styleId))})]})}var o8=[{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 p0({value:e=1,onChange:t,levels:n=o8,disabled:o=false,className:r,compact:i=false}){let{t:a}=N(),l=nt__namespace.useMemo(()=>{let g=n.find(u=>Math.abs(u.value-e)<.001);return g?g.label:`${Math.round(e*100)}%`},[n,e]),c=nt__namespace.useCallback(g=>{let u=parseFloat(g);isNaN(u)||t?.(u);},[t]),s=nt__namespace.useMemo(()=>[...n].sort((g,u)=>g.value-u.value),[n]),d=nt__namespace.useMemo(()=>[...s].reverse().find(g=>g.value<e-.001),[s,e]),m=nt__namespace.useMemo(()=>s.find(g=>g.value>e+.001),[s,e]),p=i?"h-7 w-7":"h-8 w-8";return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Oe,{variant:"ghost",size:"icon-sm",className:te(p,"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(lo,{value:e.toString(),onValueChange:c,disabled:o,children:[jsxRuntime.jsx(co,{className:te(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(ll,{placeholder:"100%",children:l})}),jsxRuntime.jsx(uo,{children:n.map(g=>jsxRuntime.jsx(dt,{value:g.value.toString(),children:g.label},g.value))})]}),jsxRuntime.jsx(Oe,{variant:"ghost",size:"icon-sm",className:te(p,"text-muted-foreground hover:text-foreground hover:bg-muted/80 rounded-l-none",(o||!m)&&"opacity-30 cursor-not-allowed"),onClick:()=>m&&t?.(m.value),disabled:o||!m,"aria-label":a("zoom.zoomIn"),children:jsxRuntime.jsx(K,{name:"add",size:18})})]})}var r8=[{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 g0({onAction:e,disabled:t=false}){let{t:n}=N(),[o,r]=nt.useState(false),i=nt.useCallback(()=>r(false),[]),{containerRef:a,dropdownRef:l,dropdownStyle:c,handleMouseDown:s}=Qe({isOpen:o,onClose:i}),d=nt.useCallback(p=>{e(p),r(false);},[e]),m=jsxRuntime.jsxs(Oe,{variant:"ghost",size:"icon-sm",className:te("text-muted-foreground hover:text-foreground hover:bg-muted/80",o&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:s,onClick:()=>!t&&r(p=>!p),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?m:jsxRuntime.jsx(ct,{content:n("table.borders.tooltip"),children:m}),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:p=>p.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:2},children:r8.map(({action:p,icon:g,labelKey:u})=>jsxRuntime.jsx("button",{type:"button",title:n(u),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(p),children:jsxRuntime.jsx(K,{name:g,size:18})},typeof p=="string"?p:p.type))})})]})}function b0({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=N(),i=nt.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(Xo,{mode:"border",value:o,onChange:i,theme:n,disabled:t,title:r("table.borderColor")})}var s8=[{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 v0({onAction:e,disabled:t=false}){let[n,o]=nt.useState(false),{t:r}=N(),i=nt.useCallback(()=>o(false),[]),{containerRef:a,dropdownRef:l,dropdownStyle:c,handleMouseDown:s}=Qe({isOpen:n,onClose:i}),d=nt.useCallback(p=>{e({type:"borderWidth",size:p}),o(false);},[e]),m=jsxRuntime.jsxs(Oe,{variant:"ghost",size:"icon-sm",className:te("text-muted-foreground hover:text-foreground hover:bg-muted/80",n&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:s,onClick:()=>!t&&o(p=>!p),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?m:jsxRuntime.jsx(ct,{content:r("table.borderWidth"),children:m}),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:p=>p.stopPropagation(),children:s8.map(({size:p,label:g,thickness:u})=>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(p),children:[jsxRuntime.jsx("div",{style:{width:50,height:Math.max(u,1),backgroundColor:"#000",borderRadius:u>2?1:0}}),jsxRuntime.jsx("span",{children:g})]},p))})]})}function x0({onAction:e,disabled:t=false,theme:n,value:o}){let{t:r}=N(),i=nt.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(Xo,{mode:"highlight",value:o,onChange:i,theme:n,disabled:t,title:r("table.cellFillColor"),icon:"format_color_fill",autoLabel:r("colorPicker.noColor")})})}var d8={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"},en={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},C0={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function P0({onAction:e,disabled:t=false,tableContext:n}){let{t:o}=N(),[r,i]=nt.useState(false),[a,l]=nt.useState(null),c=nt.useCallback(()=>i(false),[]),{containerRef:s,dropdownRef:d,dropdownStyle:m,handleMouseDown:p}=Qe({isOpen:r,onClose:c,align:"right"}),g=n?.table?.attrs?.justification??"left",u=nt.useCallback(y=>{e(y),i(false);},[e]),f=(y,T,h,v,S)=>{let x=t||S?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...d8,backgroundColor:a===y&&!x?"var(--doc-bg-hover)":"transparent",color:x?"var(--doc-text-muted)":S?.danger?"var(--doc-error)":"var(--doc-text)",cursor:x?"not-allowed":"pointer"},onClick:()=>!x&&u(v),onMouseEnter:()=>l(y),onMouseLeave:()=>l(null),disabled:x,children:[jsxRuntime.jsx(K,{name:T,size:16,className:S?.danger&&!x?"text-destructive":""}),jsxRuntime.jsx("span",{style:{flex:1},children:h})]},y)},b=jsxRuntime.jsx(Oe,{variant:"ghost",size:"icon-sm",className:te("text-muted-foreground hover:text-foreground hover:bg-muted/80",r&&"bg-muted",t&&"opacity-30 cursor-not-allowed"),onMouseDown:p,onClick:()=>!t&&i(y=>!y),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:{...m,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:y=>y.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:en,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:en,role:"separator"}),f("selectTable","select_all",o("table.selectTable"),"selectTable"),jsxRuntime.jsx("div",{style:en,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:en,role:"separator"}),jsxRuntime.jsx("div",{style:C0,children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(y=>{let T={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"}[y]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:"transparent",cursor:"pointer"},onMouseDown:v=>v.preventDefault(),onMouseEnter:v=>{v.currentTarget.style.backgroundColor="var(--doc-bg-hover)";},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent";},onClick:()=>u({type:"cellVerticalAlign",align:y}),children:jsxRuntime.jsx(K,{name:T[y],size:16})},y)})}),jsxRuntime.jsx("div",{style:en,role:"separator"}),jsxRuntime.jsx("div",{style:C0,children:o("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(y=>{let T={left:"format_align_left",center:"format_align_center",right:"format_align_right"},h=g===y;return jsxRuntime.jsx("button",{type:"button",title:o({left:"tableAdvanced.alignTableLeft",center:"tableAdvanced.alignTableCenter",right:"tableAdvanced.alignTableRight"}[y]),style:{display:"flex",alignItems:"center",justifyContent:"center",width:32,height:28,border:"1px solid var(--doc-border)",borderRadius:4,backgroundColor:h?"var(--doc-primary-light)":"transparent",borderColor:h?"var(--doc-primary)":"var(--doc-border)",color:h?"var(--doc-primary)":"var(--doc-text)",cursor:"pointer"},onMouseDown:v=>v.preventDefault(),onClick:()=>u({type:"tableProperties",props:{justification:y}}),children:jsxRuntime.jsx(K,{name:T[y],size:16})},y)})}),jsxRuntime.jsx("div",{style:en,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:en,role:"separator"}),f("properties","settings",o("tableAdvanced.tableProperties"),{type:"openTableProperties"})]})]})}var p8=20;function vl({options:e,activeValue:t,triggerIcon:n,tooltipContent:o,onSelect:r,disabled:i=false,ariaLabel:a,testId:l,showLabels:c=false}){let[s,d]=nt.useState(false),m=nt.useCallback(()=>d(false),[]),{containerRef:p,dropdownRef:g,dropdownStyle:u,handleMouseDown:f}=Qe({isOpen:s,onClose:m}),b=nt.useCallback(T=>{i||r(T),d(false);},[i,r]),y=jsxRuntime.jsxs(Oe,{variant:"ghost",size:"icon-sm",className:te("text-muted-foreground hover:text-foreground hover:bg-muted/80",s&&"bg-muted",i&&"opacity-30 cursor-not-allowed"),onMouseDown:f,onClick:()=>!i&&d(T=>!T),disabled:i,"aria-label":a??o,"aria-expanded":s,"aria-haspopup":"true","data-testid":l,children:[jsxRuntime.jsx(K,{name:n,size:p8}),jsxRuntime.jsx(K,{name:"arrow_drop_down",size:14,className:"-ml-1"})]});return jsxRuntime.jsxs("div",{ref:p,style:{position:"relative",display:"inline-block"},children:[s?y:jsxRuntime.jsx(ct,{content:o,children:y}),s&&!i&&jsxRuntime.jsx("div",{ref:g,style:{...u,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:8,boxShadow:"0 4px 16px var(--doc-shadow)",padding:6},onMouseDown:T=>T.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:c?"column":"row",gap:c?1:2,minWidth:c?200:void 0},children:e.map(T=>{let h=t===T.value;return jsxRuntime.jsxs("button",{type:"button",title:T.label,"data-testid":l?`${l}-${T.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor:h?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:h?"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:v=>v.preventDefault(),onMouseEnter:v=>{h||(v.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:v=>{v.currentTarget.style.backgroundColor=h?"var(--doc-primary-light)":"transparent";},onClick:()=>b(T.value),children:[jsxRuntime.jsx(K,{name:T.iconName,size:18}),c&&jsxRuntime.jsx("span",{style:{flex:1},children:T.label})]},T.value)})})})]})}var m8=[{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 f8(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function w0({imageContext:e,onChange:t,disabled:n=false}){let{t:o}=N(),r=m8.map(l=>({...l,label:o(l.labelKey)})),i=f8(e),a=r.find(l=>l.value===i)||r[0];return jsxRuntime.jsx(vl,{options:r,activeValue:i,triggerIcon:a.iconName,tooltipContent:`Wrap: ${a.label}`,onSelect:t,disabled:n,testId:"toolbar-image-wrap",showLabels:true})}var b8=[{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 R0({onTransform:e,disabled:t=false}){let{t:n}=N(),o=b8.map(r=>({...r,label:n(r.labelKey)}));return jsxRuntime.jsx(vl,{options:o,triggerIcon:"rotate_right",tooltipContent:n("imageTransform.tooltip"),onSelect:e,disabled:t,testId:"toolbar-image-transform"})}var St=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(Oe,{variant:"ghost",size:"icon-sm",className:te("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 Tt({label:e,children:t,className:n}){return jsxRuntime.jsx("div",{className:te("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 S8(e){let t=nt__namespace.default.useContext(ma);return t?{...t,...T8(e)}:e}function T8(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function Ld(e){let{t}=N(),n=S8(e),{currentFormatting:o={},onFormat:r,onUndo:i,onRedo:a,canUndo:l=false,canRedo:c=false,disabled:s=false,className:d,style:m,enableShortcuts:p=true,editorRef:g,children:u,showFontPicker:f=true,fontFamilies:b,documentFonts:y,showFontSizePicker:T=true,showTextColorPicker:h=true,showHighlightColorPicker:v=true,showAlignmentButtons:S=true,showListButtons:x=true,showLineSpacingPicker:w=true,showStylePicker:C=true,documentStyles:k,theme:R,showZoomControl:_=true,zoom:L,onZoomChange:F,onRefocusEditor:I,imageContext:M,onImageWrapType:E,onImageTransform:D,onOpenImageProperties:ae,tableContext:z,onTableAction:V,inline:$=false}=n,ne=nt.useRef(null),re=nt.useCallback(pe=>{!s&&r&&r(pe);},[s,r]),be=nt.useCallback(()=>{!s&&l&&i&&i();},[s,l,i]),he=nt.useCallback(()=>{!s&&c&&a&&a();},[s,c,a]),U=nt.useCallback(pe=>{!s&&r&&r({type:"fontFamily",value:pe});},[s,r]),Z=nt__namespace.default.useMemo(()=>Pd(b),[b]),Re=nt.useCallback(pe=>{!s&&r&&r({type:"fontSize",value:pe});},[s,r]),ce=nt.useCallback(pe=>{!s&&r&&r({type:"textColor",value:pe});},[s,r]),de=nt.useCallback(pe=>{!s&&r&&r({type:"highlightColor",value:typeof pe=="string"?pe:""});},[s,r]),We=nt.useCallback(pe=>{!s&&r&&r({type:"alignment",value:pe});},[s,r]),ho=nt.useCallback(()=>{!s&&r&&r("bulletList");},[s,r]),pt=nt.useCallback(()=>{!s&&r&&r("numberedList");},[s,r]),vo=nt.useCallback(()=>{!s&&r&&r("indent");},[s,r]),Ie=nt.useCallback(()=>{!s&&r&&r("outdent");},[s,r]),Pl=nt.useCallback(pe=>{!s&&r&&(r({type:"lineSpacing",value:pe}),requestAnimationFrame(()=>I?.()));},[s,r,I]),Vn=nt.useCallback(pe=>{!s&&r&&r({type:"applyStyle",value:pe});},[s,r]),Pt=nt.useCallback(pe=>{!s&&V&&(V(pe),requestAnimationFrame(()=>I?.()));},[s,V,I]);nt.useEffect(()=>{if(!p)return;let pe=me=>{if(me.defaultPrevented)return;let at=me.target,Wn=g?.current,ya=ne.current,yo=Wn?.contains(at),Hd=ya?.contains(at);if(!yo&&!Hd)return;if((me.ctrlKey||me.metaKey)&&!me.altKey)switch(me.key.toLowerCase()){case "b":me.preventDefault(),re("bold");break;case "i":me.preventDefault(),re("italic");break;case "u":me.preventDefault(),re("underline");break;case "=":me.shiftKey?(me.preventDefault(),re("superscript")):(me.preventDefault(),re("subscript"));break;case "l":me.preventDefault(),We("left");break;case "e":me.preventDefault(),We("center");break;case "r":me.preventDefault(),We("right");break;case "j":me.preventDefault(),We("both");break;case "k":me.preventDefault(),re("insertLink");break}};return document.addEventListener("keydown",pe),()=>{document.removeEventListener("keydown",pe);}},[p,re,We,g]);let $n=nt.useCallback(pe=>{let me=pe.target;me.tagName==="INPUT"||me.tagName==="TEXTAREA"||me.tagName==="SELECT"||me.tagName==="OPTION"||pe.preventDefault();},[]),on=nt.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:ne,className:te(!$&&"flex items-center px-2 py-1 bg-muted rounded-full min-h-[36px] overflow-x-auto mx-2 mb-1",d),style:$?{display:"contents",...m}:m,role:$?void 0:"toolbar","aria-label":$?void 0:t("toolbar.ariaLabel"),"data-testid":$?void 0:"formatting-bar",onMouseDown:$?void 0:$n,onMouseUp:$?void 0:on,children:[jsxRuntime.jsxs(Tt,{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:St})}),jsxRuntime.jsx(ut,{onClick:he,disabled:s||!c,title:t("formattingBar.redoShortcut"),ariaLabel:t("formattingBar.redo"),children:jsxRuntime.jsx(K,{name:"redo",size:St})})]}),_&&jsxRuntime.jsx(Tt,{label:t("formattingBar.groups.zoom"),children:jsxRuntime.jsx(p0,{value:L,onChange:F,disabled:s,compact:true})}),C&&jsxRuntime.jsx(Tt,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(d0,{value:o.styleId||"Normal",onChange:Vn,styles:k,theme:R,disabled:s,width:120})}),(f||T)&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.font"),children:[f&&jsxRuntime.jsx(Vg,{value:o.fontFamily||"Arial",onChange:U,fonts:Z,documentFonts:y,disabled:s,width:60,placeholder:"Arial"}),T&&jsxRuntime.jsx(jg,{value:o.fontSize!==void 0?ql(o.fontSize):11,onChange:Re,disabled:s,width:42,placeholder:"11"})]}),jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.textFormatting"),children:[jsxRuntime.jsx(ut,{onClick:()=>re("bold"),active:o.bold,disabled:s,title:t("formattingBar.boldShortcut"),ariaLabel:t("formattingBar.bold"),children:jsxRuntime.jsx(K,{name:"format_bold",size:St})}),jsxRuntime.jsx(ut,{onClick:()=>re("italic"),active:o.italic,disabled:s,title:t("formattingBar.italicShortcut"),ariaLabel:t("formattingBar.italic"),children:jsxRuntime.jsx(K,{name:"format_italic",size:St})}),jsxRuntime.jsx(ut,{onClick:()=>re("underline"),active:o.underline,disabled:s,title:t("formattingBar.underlineShortcut"),ariaLabel:t("formattingBar.underline"),children:jsxRuntime.jsx(K,{name:"format_underlined",size:St})}),jsxRuntime.jsx(ut,{onClick:()=>re("strikethrough"),active:o.strike,disabled:s,title:t("formattingBar.strikethrough"),ariaLabel:t("formattingBar.strikethrough"),children:jsxRuntime.jsx(K,{name:"strikethrough_s",size:St})}),h&&jsxRuntime.jsx(Xo,{mode:"text",value:o.color?.replace(/^#/,""),onChange:ce,theme:R,disabled:s,title:t("formattingBar.fontColor")}),v&&jsxRuntime.jsx(Xo,{mode:"highlight",value:o.highlight,onChange:de,theme:R,disabled:s,title:t("formattingBar.highlightColor")}),jsxRuntime.jsx(ut,{onClick:()=>re("insertLink"),disabled:s,title:t("formattingBar.insertLinkShortcut"),ariaLabel:t("formattingBar.insertLink"),children:jsxRuntime.jsx(K,{name:"link",size:St})})]}),jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.script"),children:[jsxRuntime.jsx(ut,{onClick:()=>re("superscript"),active:o.superscript,disabled:s,title:t("formattingBar.superscriptShortcut"),ariaLabel:t("formattingBar.superscript"),children:jsxRuntime.jsx(K,{name:"superscript",size:St})}),jsxRuntime.jsx(ut,{onClick:()=>re("subscript"),active:o.subscript,disabled:s,title:t("formattingBar.subscriptShortcut"),ariaLabel:t("formattingBar.subscript"),children:jsxRuntime.jsx(K,{name:"subscript",size:St})})]}),S&&jsxRuntime.jsx(Tt,{label:t("formattingBar.groups.alignment"),children:jsxRuntime.jsx(r0,{value:o.alignment||"left",onChange:We,disabled:s})}),(x||w)&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.listFormatting"),children:[x&&jsxRuntime.jsx(i0,{listState:o.listState||ul(),onBulletList:ho,onNumberedList:pt,onIndent:vo,onOutdent:Ie,disabled:s,showIndentButtons:true,compact:true,hasIndent:(o.indentLeft??0)>0}),w&&jsxRuntime.jsx(s0,{value:o.lineSpacing,onChange:Pl,disabled:s})]}),M&&E&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(w0,{imageContext:M,onChange:E,disabled:s}),D&&jsxRuntime.jsx(R0,{onTransform:D,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:St})})]}),z?.isInTable&&V&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.table"),children:[jsxRuntime.jsx(g0,{onAction:Pt,disabled:s}),jsxRuntime.jsx(b0,{onAction:Pt,disabled:s,theme:R,value:zt(z?.cellBorderColor,R)}),jsxRuntime.jsx(v0,{onAction:Pt,disabled:s}),jsxRuntime.jsx(x0,{onAction:Pt,disabled:s,theme:R,value:z?.cellBackgroundColor}),jsxRuntime.jsx(P0,{onAction:Pt,disabled:s,tableContext:z})]}),jsxRuntime.jsx(ut,{onClick:()=>re("clearFormatting"),disabled:s,title:t("formattingBar.clearFormatting"),ariaLabel:t("formattingBar.clearFormatting"),children:jsxRuntime.jsx(K,{name:"format_clear",size:St})}),u]})}function C8({children:e,className:t,style:n,...o}){return jsxRuntime.jsx(ma.Provider,{value:o,children:jsxRuntime.jsx("div",{className:te("flex flex-col bg-doc-surface shadow-sm flex-shrink-0",t),style:{position:"relative",zIndex:Je.toolbar,...n},"data-testid":"editor-toolbar",children:e})})}var et=C8;et.TitleBar=Sd;et.Logo=nl;et.DocumentName=xd;et.MenuBar=al;et.TitleBarRight=rl;et.Toolbar=Ld;var w8=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"]]),R8=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function k8({source:e,scale:t,measurer:n,documentName:o,onStateChange:r,onError:i,onSave:a,renderTitleBarLeft:l,renderTitleBarRight:c,ref:s,colorMode:d,onZoomChange:m,documentFontFamily:p,className:g}){let u=nt.useRef(null),[f,b]=nt.useState(null),[y,T]=nt.useState({}),[h,v]=nt.useState(null),S=nt.useCallback(k=>{b(k);let R=u.current?.formatting();R&&T({bold:R.bold,italic:R.italic,underline:R.underline,strike:R.strikethrough,superscript:R.superscript,subscript:R.subscript,...R.fontFamily?{fontFamily:R.fontFamily}:{},...R.fontSizeHalfPoints?{fontSize:R.fontSizeHalfPoints}:{},...R.alignment?{alignment:R.alignment}:{},...R.styleId?{styleId:R.styleId}:{},...R.color?{color:`#${R.color}`}:{},...R.highlight?{highlight:R.highlight}:{}}),v(u.current?.sectionProperties()??null),r?.(k);},[r]),x=nt.useCallback(k=>{let R=u.current;if(R){if(typeof k=="string")switch(k){case "bold":return R.toggleRunProperty("b");case "italic":return R.toggleRunProperty("i");case "underline":return R.toggleRunProperty("u",{val:"single"});case "strikethrough":return R.toggleRunProperty("strike");case "superscript":return R.setRunProperty("vertAlign",{val:"superscript"});case "subscript":return R.setRunProperty("vertAlign",{val:"subscript"});case "clearFormatting":R.setRunProperty("b",{val:"0"}),R.setRunProperty("i",{val:"0"}),R.setRunProperty("u",{val:"none"}),R.setRunProperty("strike",{val:"0"}),R.setRunProperty("vertAlign",{val:"baseline"});return;default:return}switch(k.type){case "fontFamily":return R.setRunProperty("rFonts",{ascii:k.value,hAnsi:k.value});case "fontSize":return R.setRunProperty("sz",{val:String(Math.round(k.value*2))});case "textColor":{let _=k.value,L=typeof _=="string"?R8(_):zt(_,null)??null;return L?R.setRunProperty("color",{val:L}):void 0}case "highlightColor":{let _=k.value.trim().toLowerCase();if(_==="none"||_==="")return R.setRunProperty("highlight",{val:"none"});let L=w8.get(_.startsWith("#")?_:`#${_}`);return L?R.setRunProperty("highlight",{val:L}):void 0}case "alignment":return R.setParagraphProperty("jc",{val:String(k.value)});case "lineSpacing":return R.setParagraphProperty("spacing",{line:String(Math.round(k.value)),lineRule:"auto"},{mergeAttributes:true});case "applyStyle":return R.setParagraphProperty("pStyle",{val:k.value});default:return}}},[]);nt.useImperativeHandle(s,()=>u.current,[]);let w=t===void 0?1:t/(96/72),C=h?{pageWidthTwips:h.pageSize.widthTwips,pageHeightTwips:h.pageSize.heightTwips,orientation:h.landscape?"landscape":"portrait",marginsTwips:{top:h.margins.topTwips,right:h.margins.rightTwips,bottom:h.margins.bottomTwips,left:h.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(et,{currentFormatting:y,onFormat:x,onUndo:()=>u.current?.undo(),onRedo:()=>u.current?.redo(),canUndo:f?.canUndo??false,canRedo:f?.canRedo??false,zoom:w,onZoomChange:m,onSave:()=>{let k=u.current?.save();k&&a?.(k);},children:[jsxRuntime.jsxs(et.TitleBar,{children:[l&&jsxRuntime.jsx(et.Logo,{children:l()}),jsxRuntime.jsx(et.DocumentName,{value:o??"Document",editable:false}),c&&jsxRuntime.jsx(et.TitleBarRight,{children:c()}),jsxRuntime.jsx(et.MenuBar,{})]}),jsxRuntime.jsx(et.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[C?jsxRuntime.jsx("div",{style:{padding:"4px 0"},children:jsxRuntime.jsx(Ho,{pageSetup:C,zoom:w})}):null,jsxRuntime.jsx(gd,{ref:u,source:e,...p?{documentFontFamily:p}:{},...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onStateChange:S,...i?{onError:i}:{}})]})]})}var xl=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 Sl=class extends xl{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 L8=nt.createContext(null);function D0({children:e}){let t=nt.useMemo(()=>new Sl,[]),n=nt.useSyncExternalStore(t.subscribe,t.getSnapshot),o=nt.useCallback((s,d)=>{t.showError(s,d);},[t]),r=nt.useCallback((s,d)=>{t.showWarning(s,d);},[t]),i=nt.useCallback((s,d)=>{t.showInfo(s,d);},[t]),a=nt.useCallback(s=>{t.dismiss(s);},[t]),l=nt.useCallback(()=>{t.clearAll();},[t]),c=nt.useMemo(()=>({notifications:n.notifications,showError:o,showWarning:r,showInfo:i,dismissNotification:a,clearNotifications:l}),[n.notifications,o,r,i,a,l]);return jsxRuntime.jsxs(L8.Provider,{value:c,children:[e,jsxRuntime.jsx(F8,{notifications:n.notifications,onDismiss:a})]})}function F8({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(A8,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function A8({notification:e,onDismiss:t}){let{t:n}=N(),[o,r]=nt.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:"docx-notification-slide-in 0.3s ease-out"},c={display:"flex",alignItems:"flex-start",gap:"8px"},s={color:a.icon,flexShrink:0},d={flex:1,minWidth:0},m={color:a.text,fontSize:"14px",fontWeight:500,wordBreak:"break-word"},p={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},u=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.jsx("div",{className:`docx-notification-toast docx-notification-${e.severity}`,style:l,children:jsxRuntime.jsxs("div",{style:c,children:[jsxRuntime.jsx("span",{style:s,children:u(e.severity)}),jsxRuntime.jsxs("div",{style:d,children:[jsxRuntime.jsx("div",{style:m,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:p,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 Tl=class extends nt.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(H8,{error:o,errorInfo:r,showDetails:n,onReset:this.resetError})}return this.props.children}};function H8({error:e,errorInfo:t,showDetails:n,onReset:o}){let{t:r}=N(),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:[`
3
3
 
4
- `,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:d,children:r("errors.tryAgain")})]})}function F0({onClick:e,topPx:t,scrollLeft:n=0,leftOffset:o=yn}){let{t:r}=D();return jsxRuntime.jsx("button",{className:"docx-outline-toggle",onClick:e,onMouseDown:a=>a.stopPropagation(),title:r("editor.showDocumentOutline"),"aria-label":r("editor.showDocumentOutline"),style:{position:"absolute",left:o-n,top:t,zIndex:Je.outline},children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:20})})}function Ad({currentPage:e,totalPages:t,visible:n}){let{t:o}=D();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 B8({i18n:e,isDark:t,onEditorError:n,containerRef:o,scrollContainerRef:r,editorContentRef:a,className:i,containerStyle:l,mainContentStyle:c,editorContainerStyle:s,showRuler:d,readOnlyProp:p,showOutline:m,showOutlineButton:g,sidebarOpen:u,minLayoutWidth:f,toolbarHeight:b,editorScrollLeft:x,onScrollContainerMouseDown:T,onEditorBgMouseDown:h,onEditorContextMenu:v,horizontalRulerProps:y,verticalRulerProps:S,outlineProps:w,onToggleOutline:C,scrollPageInfo:k,toolbar:R,pagedArea:N,overlays:L,dialogs:H,fileInputs:_}){let M=d&&!p;return jsxRuntime.jsx(wo.Provider,{value:true,children:jsxRuntime.jsx(tn,{i18n:e,children:jsxRuntime.jsx(D0,{children:jsxRuntime.jsx(Tl,{onError:n,children:jsxRuntime.jsxs("div",{ref:o,className:te("docx-editor",t&&"dark",i),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:[R,jsxRuntime.jsxs("div",{ref:r,className:"docx-editor__scroll-container",style:s,onMouseDown:T,children:[d&&jsxRuntime.jsx("div",{className:"flex py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:Je.ruler,paddingLeft:20,paddingRight:20+(u?352:0),minWidth:f,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(Fo,{...y})}),jsxRuntime.jsx("div",{style:{display:"flex",flex:1,minHeight:0,position:"relative",minWidth:f},children:jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",flex:1,minWidth:0},onMouseDown:h,onContextMenu:v,children:[M&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:Je.ruler,paddingTop:48},children:jsxRuntime.jsx(zr,{...S})}),N]})})]}),k.totalPages>1&&jsxRuntime.jsx(Ad,{currentPage:k.currentPage,totalPages:k.totalPages,visible:k.visible}),m&&jsxRuntime.jsx($r,{...w,leftOffset:Vr+(M?vn:0)}),g&&!m&&jsxRuntime.jsx(F0,{onClick:C,topPx:b+(d?Pc+8:0)+48,scrollLeft:x,leftOffset:yn+(M?vn:0)})]})}),L,H,_]})})})})})}function W8(e){let[t,n]=nt.useState(0);return nt.useEffect(()=>{if(!e)return;let o=()=>n(i=>i+1),r=e.on("change",o),a=e.on("selectionChange",o);return o(),()=>{r(),a();}},[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,"composeFontOrigins",{enumerable:true,get:function(){return editor.composeFontOrigins}});Object.defineProperty(exports,"createFontSource",{enumerable:true,get:function(){return editor.createFontSource}});Object.defineProperty(exports,"defineFontResolver",{enumerable:true,get:function(){return editor.defineFontResolver}});Object.defineProperty(exports,"generateRulerTicks",{enumerable:true,get:function(){return editor.generateRulerTicks}});Object.defineProperty(exports,"isFontResolver",{enumerable:true,get:function(){return editor.isFontResolver}});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=zo;exports.ContextMenuCopy=ia;exports.ContextMenuCopyFormatting=Ui;exports.ContextMenuCut=aa;exports.ContextMenuDelete=la;exports.ContextMenuDeleteTable=Fn;exports.ContextMenuDeleteTableColumn=Ln;exports.ContextMenuDeleteTableRow=Nn;exports.ContextMenuInsertColumnLeft=_n;exports.ContextMenuInsertColumnRight=Dn;exports.ContextMenuInsertRowAbove=Mn;exports.ContextMenuInsertRowBelow=In;exports.ContextMenuItem=Yi;exports.ContextMenuPaste=Rn;exports.ContextMenuPasteFormatting=Gi;exports.ContextMenuPasteWithoutFormatting=kn;exports.ContextMenuRefreshToc=An;exports.ContextMenuRefreshTocPageNumbers=Hn;exports.ContextMenuSelectAll=sa;exports.DocumentName=xd;exports.DocumentOutline=$r;exports.DocxEditor=p2;exports.DocxEditorAuthorStyle=Vl;exports.DocxEditorColorByChangeType=zl;exports.DocxEditorContent=Ra;exports.DocxEditorContentControl=el;exports.DocxEditorContextMenu=da;exports.DocxEditorDocumentOutline=Dc;exports.DocxEditorEquation=Vi;exports.DocxEditorFontNotice=Zi;exports.DocxEditorHeaderFooterChrome=qi;exports.DocxEditorHorizontalRuler=Ii;exports.DocxEditorHyperLink=zi;exports.DocxEditorImagePropertiesDialog=Cs;exports.DocxEditorLoading=Ma;exports.DocxEditorLoadingSpinner=Kl;exports.DocxEditorMenu=Zr;exports.DocxEditorNavigation=Zc;exports.DocxEditorNotesChrome=$i;exports.DocxEditorPageNumber=Bi;exports.DocxEditorPageSetupDialog=Nr;exports.DocxEditorParagraphDialog=Ro;exports.DocxEditorRoot=or;exports.DocxEditorShell=B8;exports.DocxEditorToolbar=Dr;exports.DocxEditorVerticalRuler=_i;exports.DocxEditorViewport=Fa;exports.HorizontalRuler=Fo;exports.ImageAltText=ja;exports.ImageInsertProvider=Pa;exports.ImageInsertTrigger=Ea;exports.ImagePropertiesTrigger=Qa;exports.ImageWrap=Ga;exports.LocaleProvider=tn;exports.Logo=nl;exports.MenuBar=al;exports.NAVIGATION_PANE_GAP=Hf;exports.NAVIGATION_PANE_INSET=Di;exports.NAVIGATION_PANE_WIDTH=xn;exports.NavigationClose=jr;exports.NavigationFind=ea;exports.NavigationHeader=Gr;exports.NavigationHeadings=Qr;exports.NavigationTab=Jr;exports.NavigationTabs=Xr;exports.NavigationTitle=Yr;exports.NavigationToggle=ta;exports.OUTLINE_BUTTON_LEFT_OFFSET=yn;exports.OUTLINE_BUTTON_RESERVED_SPACE=nE;exports.OUTLINE_LEFT_OFFSET=Vr;exports.OUTLINE_RESERVED_SPACE=tE;exports.PageIndicator=Ad;exports.PageNumberTranslationContext=Oi;exports.PaginatedDocxEditor=gd;exports.PaginatedDocxEditorShell=k8;exports.REVIEW_MARKERS_GUTTER=ts;exports.REVIEW_PANE_GUTTER=os;exports.RULER_WIDTH=vn;exports.ReviewRailContext=mt;exports.SEARCH_DEBOUNCE_MS=Ac;exports.SEARCH_MATCH_LIMIT=Hc;exports.Slot=j;exports.TitleBar=Sd;exports.TitleBarRight=rl;exports.Toolbar=Ld;exports.ToolbarButton=ut;exports.ToolbarContext=yo;exports.ToolbarGroup=Tt;exports.ToolbarImageProperties=mn;exports.VERSION=O0;exports.VerticalRuler=zr;exports.editorStateActiveSubscriptionCount=U0;exports.isFieldLink=Xn;exports.navigationPaneReservation=Oo;exports.navigationShift=Ni;exports.normalizeImageBytes=Sa;exports.notificationYieldsToTask=Yd;exports.provideDocxEditor=xh;exports.reviewGutter=Eu;exports.useChromeTranslate=jd;exports.useContentControl=Et;exports.useContentControlInstance=Da;exports.useContextMenuTarget=ng;exports.useDocumentOutline=Li;exports.useDocumentSearch=Fi;exports.useDocxEditor=A;exports.useDocxSource=x2;exports.useEditorCaret=M2;exports.useEditorCommand=le;exports.useEditorEvent=js;exports.useEditorSnapshot=W8;exports.useEditorState=O;exports.useEditorValueCommand=ur;exports.useFontFamily=ni;exports.useFonts=E2;exports.useHeaderFooterState=Kc;exports.useHyperlinkPopup=$l;exports.useHyperlinkPopupInstance=_a;exports.useNavigationPane=Ai;exports.useNavigationShift=Eo;exports.useNotePropertiesState=ad;exports.useNoteScopeState=rd;exports.usePageSetup=_o;exports.useParagraphFormat=ss;exports.useParagraphIndent=wc;exports.useParagraphStyle=ri;exports.useReviewAuthors=rr;exports.useReviewGutter=sn;exports.useScopeClassName=tt;exports.useScopedChromeAnchor=oa;exports.useTableBorderTargetLabel=Am;exports.useToolbarContext=eb;exports.useToolbarLabel=J;exports.useToolbarLabelFor=Ta;exports.useTranslation=D;exports.useZoom=ws;
4
+ `,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:d,children:r("errors.tryAgain")})]})}function F0({onClick:e,topPx:t,scrollLeft:n=0,leftOffset:o=Sn}){let{t:r}=N();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:Je.outline},children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:20})})}function Ad({currentPage:e,totalPages:t,visible:n}){let{t:o}=N();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 B8({i18n:e,isDark:t,onEditorError:n,containerRef:o,scrollContainerRef:r,editorContentRef:i,className:a,containerStyle:l,mainContentStyle:c,editorContainerStyle:s,showRuler:d,readOnlyProp:m,showOutline:p,showOutlineButton:g,sidebarOpen:u,minLayoutWidth:f,toolbarHeight:b,editorScrollLeft:y,onScrollContainerMouseDown:T,onEditorBgMouseDown:h,onEditorContextMenu:v,horizontalRulerProps:S,verticalRulerProps:x,outlineProps:w,onToggleOutline:C,scrollPageInfo:k,toolbar:R,pagedArea:_,overlays:L,dialogs:F,fileInputs:I}){let M=d&&!m;return jsxRuntime.jsx(ko.Provider,{value:true,children:jsxRuntime.jsx(nn,{i18n:e,children:jsxRuntime.jsx(D0,{children:jsxRuntime.jsx(Tl,{onError:n,children:jsxRuntime.jsxs("div",{ref:o,className:te("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:[R,jsxRuntime.jsxs("div",{ref:r,className:"docx-editor__scroll-container",style:s,onMouseDown:T,children:[d&&jsxRuntime.jsx("div",{className:"flex py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:Je.ruler,paddingLeft:20,paddingRight:20+(u?352:0),minWidth:f,transition:"padding 0.2s ease"},children:jsxRuntime.jsx(Ho,{...S})}),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:v,children:[M&&jsxRuntime.jsx("div",{style:{position:"absolute",left:0,top:0,zIndex:Je.ruler,paddingTop:48},children:jsxRuntime.jsx(zr,{...x})}),_]})})]}),k.totalPages>1&&jsxRuntime.jsx(Ad,{currentPage:k.currentPage,totalPages:k.totalPages,visible:k.visible}),p&&jsxRuntime.jsx($r,{...w,leftOffset:Vr+(M?xn:0)}),g&&!p&&jsxRuntime.jsx(F0,{onClick:C,topPx:b+(d?Pc+8:0)+48,scrollLeft:y,leftOffset:Sn+(M?xn:0)})]})}),L,F,I]})})})})})}function W8(e){let[t,n]=nt.useState(0);return nt.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,"composeFontOrigins",{enumerable:true,get:function(){return editor.composeFontOrigins}});Object.defineProperty(exports,"createFontSource",{enumerable:true,get:function(){return editor.createFontSource}});Object.defineProperty(exports,"defineFontResolver",{enumerable:true,get:function(){return editor.defineFontResolver}});Object.defineProperty(exports,"generateRulerTicks",{enumerable:true,get:function(){return editor.generateRulerTicks}});Object.defineProperty(exports,"isFontResolver",{enumerable:true,get:function(){return editor.isFontResolver}});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=$o;exports.ContextMenuCopy=ia;exports.ContextMenuCopyFormatting=Ui;exports.ContextMenuCut=aa;exports.ContextMenuDelete=la;exports.ContextMenuDeleteTable=Hn;exports.ContextMenuDeleteTableColumn=An;exports.ContextMenuDeleteTableRow=Fn;exports.ContextMenuInsertColumnLeft=Nn;exports.ContextMenuInsertColumnRight=Ln;exports.ContextMenuInsertRowAbove=_n;exports.ContextMenuInsertRowBelow=Dn;exports.ContextMenuItem=Yi;exports.ContextMenuPaste=Mn;exports.ContextMenuPasteFormatting=Gi;exports.ContextMenuPasteWithoutFormatting=In;exports.ContextMenuRefreshToc=On;exports.ContextMenuRefreshTocPageNumbers=Bn;exports.ContextMenuSelectAll=sa;exports.DocumentName=xd;exports.DocumentOutline=$r;exports.DocxEditor=p2;exports.DocxEditorAuthorStyle=Vl;exports.DocxEditorColorByChangeType=zl;exports.DocxEditorContent=Ra;exports.DocxEditorContentControl=el;exports.DocxEditorContextMenu=da;exports.DocxEditorDocumentOutline=Dc;exports.DocxEditorEquation=Vi;exports.DocxEditorFontNotice=Zi;exports.DocxEditorHeaderFooterChrome=qi;exports.DocxEditorHorizontalRuler=Ii;exports.DocxEditorHyperLink=zi;exports.DocxEditorImagePropertiesDialog=Cs;exports.DocxEditorLoading=Ma;exports.DocxEditorLoadingSpinner=Kl;exports.DocxEditorMenu=Zr;exports.DocxEditorNavigation=Zc;exports.DocxEditorNotesChrome=$i;exports.DocxEditorPageNumber=Bi;exports.DocxEditorPageSetupDialog=Nr;exports.DocxEditorParagraphDialog=Mo;exports.DocxEditorRoot=or;exports.DocxEditorShell=B8;exports.DocxEditorToolbar=Dr;exports.DocxEditorVerticalRuler=_i;exports.DocxEditorViewport=Fa;exports.HorizontalRuler=Ho;exports.ImageAltText=ja;exports.ImageInsertProvider=Pa;exports.ImageInsertTrigger=Ea;exports.ImagePropertiesTrigger=Qa;exports.ImageWrap=Ga;exports.LocaleProvider=nn;exports.Logo=nl;exports.MenuBar=al;exports.NAVIGATION_PANE_GAP=Hf;exports.NAVIGATION_PANE_INSET=Di;exports.NAVIGATION_PANE_WIDTH=Tn;exports.NavigationClose=jr;exports.NavigationFind=ea;exports.NavigationHeader=Gr;exports.NavigationHeadings=Qr;exports.NavigationTab=Jr;exports.NavigationTabs=Xr;exports.NavigationTitle=Yr;exports.NavigationToggle=ta;exports.OUTLINE_BUTTON_LEFT_OFFSET=Sn;exports.OUTLINE_BUTTON_RESERVED_SPACE=nE;exports.OUTLINE_LEFT_OFFSET=Vr;exports.OUTLINE_RESERVED_SPACE=tE;exports.PageIndicator=Ad;exports.PageNumberTranslationContext=Oi;exports.PaginatedDocxEditor=gd;exports.PaginatedDocxEditorShell=k8;exports.REVIEW_MARKERS_GUTTER=ts;exports.REVIEW_PANE_GUTTER=os;exports.RULER_WIDTH=xn;exports.ReviewRailContext=mt;exports.SEARCH_DEBOUNCE_MS=Ac;exports.SEARCH_MATCH_LIMIT=Hc;exports.Slot=j;exports.TitleBar=Sd;exports.TitleBarRight=rl;exports.Toolbar=Ld;exports.ToolbarButton=ut;exports.ToolbarContext=xo;exports.ToolbarGroup=Tt;exports.ToolbarImageProperties=gn;exports.VERSION=O0;exports.VerticalRuler=zr;exports.editorStateActiveSubscriptionCount=U0;exports.isFieldLink=Qn;exports.navigationPaneReservation=Zo;exports.navigationShift=Ni;exports.normalizeImageBytes=Sa;exports.notificationYieldsToTask=Yd;exports.provideDocxEditor=xh;exports.reviewGutter=Eu;exports.useChromeTranslate=jd;exports.useContentControl=Et;exports.useContentControlInstance=Da;exports.useContextMenuTarget=ng;exports.useDocumentOutline=Li;exports.useDocumentSearch=Fi;exports.useDocxEditor=H;exports.useDocxSource=x2;exports.useEditorCaret=M2;exports.useEditorCommand=le;exports.useEditorEvent=js;exports.useEditorSnapshot=W8;exports.useEditorState=O;exports.useEditorValueCommand=ur;exports.useFontFamily=ni;exports.useFonts=E2;exports.useHeaderFooterState=Kc;exports.useHyperlinkPopup=$l;exports.useHyperlinkPopupInstance=_a;exports.useNavigationPane=Ai;exports.useNavigationShift=wo;exports.useNotePropertiesState=ad;exports.useNoteScopeState=rd;exports.usePageSetup=No;exports.useParagraphFormat=ss;exports.useParagraphIndent=wc;exports.useParagraphStyle=ri;exports.useReviewAuthors=rr;exports.useReviewGutter=dn;exports.useScopeClassName=tt;exports.useScopedChromeAnchor=oa;exports.useTableBorderTargetLabel=Am;exports.useToolbarContext=eb;exports.useToolbarLabel=J;exports.useToolbarLabelFor=Ta;exports.useTranslation=N;exports.useZoom=ws;