@docx-editor.dev/react 2.16.0 → 2.16.2

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'),xe=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 xe__namespace=/*#__PURE__*/_interopNamespace(xe);var Zd={version:"2.16.0"};var Z0=Zd.version;var qd="(prefers-color-scheme: dark)";function Kd(){return typeof window<"u"&&typeof window.matchMedia=="function"}function zd(){return Kd()?window.matchMedia(qd).matches:false}function Vd(e,t){return e==="dark"||e==="system"&&t}function $d(e){if(!Kd())return ()=>{};let t=window.matchMedia(qd);e(t.matches);let n=o=>e(o.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}var wl=nt.createContext(null);function H(){return nt.useContext(wl)}var mt=nt.createContext(null);var Rl=nt.createContext(i18n.en),kl=nt.createContext("en");function nn({i18n:e,children:t}){let n=nt.useContext(Rl),o=nt.useContext(kl),r=typeof e?._lang=="string"?e._lang:o,i=nt.useMemo(()=>i18n.deepMerge(n,e),[n,e]);return jsxRuntime.jsx(kl.Provider,{value:r,children:jsxRuntime.jsx(Rl.Provider,{value:i,children:t})})}function N(){let e=nt.useContext(Rl),t=nt.useContext(kl);return {t:nt.useMemo(()=>i18n.createT(e,t),[e,t]),catalogue:e}}function Yd(e){let{t}=N();return nt.useCallback((n,o)=>e?.get(n)??t(n,o),[e,t])}var Ml=0,Il=false,_l=false;function Xd(){let e=globalThis.navigator?.scheduling;return typeof e?.isInputPending!="function"?false:e.isInputPending({includeContinuous:true})?true:(Il||(Il=true,Ml+=1,queueMicrotask(()=>{Il=false;}),_l||(_l=true,setTimeout(()=>{_l=false,Ml=0;},0))),Ml>16)}function Jd(e){let t=false;return ()=>{if(t)return;t=true;let n=()=>{t=false,e();};Xd()?setTimeout(n,0):queueMicrotask(n);}}var G0=()=>{},Nl=0;function j0(){return Nl}function Ll(e){return Jd(e)}function O(e,t=Object.is,n){let o=H(),r=n?.onSubscribe,i=n?.onUnsubscribe,a=nt.useCallback(d=>{if(!o)return G0;let m=false;Nl++,r?.();let p=Ll(()=>{m||d();}),g=[o.on("change",p),o.on("selectionChange",p),o.on("error",p)];return ()=>{m=true,Nl--,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 eu=12700,Qd=96;function Q0(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function eb(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 Ta(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(!Q0(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}=eb(o.pixelWidth,o.pixelHeight,o.dpiX??Qd,o.dpiY??Qd);return Object.freeze({ok:true,bytes:e,mime:n,widthPoints:i,heightPoints:a})}function Ut(e){return Math.round(e/eu*100)/100}function Gn(e){return Math.round(e*eu)}var xo=nt.createContext({t:void 0,onSave:void 0});function ob(){return nt.useContext(xo)}function Ca(e){let{t}=N();return n=>e?.(n)??t(n)}function J(){let{t:e}=nt.useContext(xo);return Ca(e)}function sb(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason&&e.value===t.value}function Fl(e){return typeof e=="string"}function le(e){let t=H(),{t:n}=N(),o=Fl(e)?e:editor.editorCommandKey(e),r=nt.useRef(e);r.current=e;let i=nt.useCallback(c=>{let s=r.current;if(Fl(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,sb),l=nt.useCallback(()=>{let c=r.current;return Fl(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 pb=()=>()=>{},mb=()=>true,fb=()=>false;function an(){let e=nt.useSyncExternalStore(pb,mb,fb);return nt.useCallback(t=>e?i18n.platformShortcut(t):t,[e])}function vb(e,t){return typeof t!="function"?e:typeof e!="function"?t:n=>{e(n),n.defaultPrevented||t(n);}}function yb(e,t){let n={...e,...t};for(let o of Object.keys(e))/^on[A-Z]/.test(o)?n[o]=vb(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=yb(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 kb="image/png,image/jpeg,image/gif",Hl=nt.createContext(null);function iu(){let e=nt.useContext(Hl);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function jn(){return nt.useContext(Hl)}function Ea({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=Ta(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},P=t.canExecuteImageCommand?.(y);if(P&&!P.ok){window.alert(P.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 P=y.getAsFile();if(!P)continue;let h=await P.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(Hl.Provider,{value:u,children:[jsxRuntime.jsx("input",{ref:o,type:"file",accept:kb,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:g,onMouseDown:f=>f.stopPropagation()}),e]})}function wa({className:e,hidden:t,asChild:n,children:o}){let{openFilePicker:r,isEnabled:i,disabledReason:a}=iu(),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)})}wa.docxSlot="image.insert";var Yn=Object.assign(wa,{docxSlot:"image.insert"});var qb=["nw","n","ne","e","se","s","sw","w"],du=40,uu=12;function Kb(e){return `imageOverlay.handle.${e}`}function zb(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 Vb(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 $b(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 Bl({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 T=e.current;if(!T)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 T.addEventListener("pointerdown",k,{capture:true}),()=>T.removeEventListener("pointerdown",k,{capture:true})},[e,i?.id]),nt.useEffect(()=>{if(!o){a(null);return}let T=()=>{a(editor.selectedDrawingOverlayTargetOf(o.surface));},k=()=>{queueMicrotask(T);};T();let R=[o.on("change",k),o.on("selectionChange",T)];return ()=>{for(let _ of R)_();}},[o]);let y=nt.useCallback(()=>{d(T=>{let k=editor.overlayHostOrigin(e.current);return k.left===T.left&&k.top===T.top?T:k});},[e]);nt.useEffect(()=>{y();let T=t.current;if(!T||typeof ResizeObserver!="function")return;let k=new ResizeObserver(y);k.observe(T);let R=e.current;return R&&k.observe(R),()=>k.disconnect()},[e,t,y,i]),nt.useEffect(()=>{if(n){b.current=n;return}let T=e.current;if(!T||!o?.surface)return;let k=T.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 P=nt.useCallback(()=>{c(null),p.current=null;let T=g.current;if(g.current=null,T)try{T.releasePointerCapture(T._lastPointerId??0);}catch{}},[]),h=nt.useCallback((T,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:T,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((T,k,R,_,L)=>{if(!o)return;if(editor.isStaleImageInteractionCommit(o,T)){P();return}T.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}:{}}:{}}):T.mode==="move"&&L&&o.exec({type:"setImagePosition",...L}),P();},[P,o]),S=nt.useCallback(T=>{if(!o)return;let k=m.current?.bounds??editor.selectedDrawingOverlayTargetOf(o.surface);if(!k)return;if(m.current&&T.key==="Escape"){T.preventDefault(),T.stopPropagation(),P();return}if(m.current)return;let R=T.shiftKey?editor.IMAGE_OVERLAY_NUDGE_SHIFT_PT:editor.IMAGE_OVERLAY_NUDGE_PT;if(T.key==="Delete"||T.key==="Backspace"){T.preventDefault(),T.stopPropagation(),o.exec({type:"deleteImage"});return}if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(T.key))return;T.preventDefault(),T.stopPropagation();let _=T.key==="ArrowLeft"?-R:T.key==="ArrowRight"?R:0,L=T.key==="ArrowUp"?-R:T.key==="ArrowDown"?R:0;if(T.altKey){if(!k.canResize)return;let I=$b(_,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,T.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});},[P,o]);nt.useEffect(()=>{if(!l||!o?.surface)return;let T=o.surface.overlayCoordinates(),k=_=>{let L=m.current,F=p.current;if(!L||!F)return;let I=editor.cssPixelsToLayoutPoints(_.clientX-F.x,T.paintScale),M=editor.cssPixelsToLayoutPoints(_.clientY-F.y,T.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-du?D=uu:_.clientY<$.top+du&&(D=-uu),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),T.paintScale),I=editor.cssPixelsToLayoutPoints(_.clientY-(p.current?.y??_.clientY),T.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 P();};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);}},[P,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 T=o.surface.publishedLayout(),k=o.surface.overlayCoordinates(),R=editor.overlayFrameToSheetCssPixels(T,{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?qb.map(I=>{let M=Vb(I);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(Kb(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:zb(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 ql(e){return [...e.items].some(t=>t.kind==="file"&&t.type.startsWith("image/"))}function ka({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&&ql(s)&&(editor.clipboardPasteLandsContent(s)||(c.preventDefault(),n.insertFromDataTransfer(s)));},[n]),a=nt.useCallback(c=>{!n?.isEnabled||!ql(c.dataTransfer)||c.preventDefault();},[n]),l=nt.useCallback(c=>{if(n?.isEnabled&&ql(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(Bl,{containerRef:o,portalRef:r}):null]})}function Ee(e){return e/1440*96}function Ma(e){return e/96*1440}function je(e){return `${Math.round(e*100)/100}px`}function Kl(e){return e/2}var Xb=e=>e.isLoading||e.isOpening===true,Jb=e=>({width:Ee(e.pageSetup?.pageWidthTwips??12240)*e.zoom,height:Ee(e.pageSetup?.pageHeightTwips??15840)*e.zoom}),Qb=(e,t)=>e.width===t.width&&e.height===t.height;function zl({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}function eh({when:e=false,overlay:t=false,className:n,style:o,children:r}){let i=O(Xb),a=O(Jb,Qb),{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(zl,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:l("loading.label")})]})})})})})}var Ia=Object.assign(eh,{Spinner:zl});function gu(){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 vu(){let e=nt.useRef(null);return e.current===null&&(e.current=Symbol("revision-style-declaration")),e.current}function Vl(){let e=nt.useContext(Jn),t=vu();return nt.useEffect(()=>{if(e)return e.registerScheme(t),()=>e.unregister(t)},[e,t]),null}function $l(e){let{author:t,color:n,background:o,spanClassName:r,avatarUrl:i}=e,a=nt.useContext(Jn),l=vu();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}),sh=e=>e;function ch(){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 Wl(){let e=nt.useContext(er),t=Da(e===null);return e??t}function Da(e=true){let t=H(),[n,o]=nt.useState(Co),r=nt.useRef(null),i=nt.useRef(n);i.current=n;let a=O(sh),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=ch();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(T=>({...T,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(T=>({...T,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]),P=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:P}),[n,l,s,m,d,p,g,u,f,b,y,P])}var Ye={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function mh(e){return e==="sdtLocked"||e==="sdtContentLocked"}function fh(e){return e==="contentLocked"||e==="sdtContentLocked"}function Gl(e,t){return !e.ok&&e.code===t}function Et(){let e=nt.useContext(jl),t=Na();return e??t}function Na(){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:fh(w.effectiveLock)||E==="locked",removalLocked:mh(w.effectiveLock)||D==="locked",placeholder:w.placeholder,bound:w.bound||E==="bound",effectiveLock:w.effectiveLock}}let T=e.query({type:"contentControlAt"});if(!T)return null;let k=s?.disabledReason(T.id,"edit")??null,R=s?.disabledReason(T.id,"remove")??null,_=e.can({type:"setContentControlValue",value:""}),L=e.can({type:"removeContentControl"}),F=T.locked===true||k==="locked"||Gl(_,"locked"),I=k==="bound"||Gl(_,"bound"),M=R==="locked"||Gl(L,"locked");return {id:T.id,tag:T.tag??null,alias:T.alias??null,controlType:T.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),[]),P=nt.useCallback(()=>n(w=>!w),[]),h=nt.useMemo(()=>{if(!d)return "no content control at the current selection";if(s){let T=s.disabledReason(d.id,"edit");return T==="locked"?"the content control is locked":T==="bound"?"the content control is bound to external data":T==="notFound"?"the content control was not found":T}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 T=s.disabledReason(d.id,"remove");return T==="locked"?"the content control is locked":T==="notFound"?"the content control was not found":T}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 T=s.disabledReason(d.id,"edit");if(T)return {ok:false,code:T==="bound"?"bound":T==="locked"?"locked":"notFound",reason:T==="bound"?"the content control is bound to external data":T==="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 T=s.disabledReason(w,"remove");return T?{ok:false,code:T==="locked"?"locked":"notFound",reason:T==="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:P,remove:x,setValue:S}),[d,m,o,i,t,h,v,p,u,g,f,b,y,P,x,S])}var jl=nt.createContext(null);function xu(){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 Xl=nt.createContext(null);function Eo(){return nt.useContext(Xl)}var Su=()=>0,Jl=()=>()=>{};function wo(){let e=Eo(),t=nt.useCallback(o=>e?e.subscribeShift(o):Jl(),[e]),n=nt.useCallback(()=>e?e.getShift():0,[e]);return nt.useSyncExternalStore(t,n,Su)}function Tu(){let e=Eo(),t=nt.useCallback(o=>e?e.subscribeReservation(o):Jl(),[e]),n=nt.useCallback(()=>e?e.getReservation():0,[e]);return nt.useSyncExternalStore(t,n,Su)}function At(){let e=Eo(),t=nt.useCallback(r=>e?e.subscribeViewport(r):Jl(),[e]),n=nt.useCallback(()=>e?e.getViewport():null,[e]),o=nt.useCallback(()=>null,[]);return nt.useSyncExternalStore(t,n,o)}function Sh(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 Th(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),P=nt.useRef(null);P.current??=gu();let h=P.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||!Sh(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),T=nt.useRef([]),k=nt.useMemo(()=>({mounted:x,register:()=>(w(_=>_+1),()=>w(_=>Math.max(0,_-1))),registerCommentDraft:_=>(T.current.push(_),()=>{let L=T.current.indexOf(_);L!==-1&&T.current.splice(L,1);}),requestCommentDraft:()=>{let _=T.current.at(-1);return _?(_(),true):false}}),[x]),R=nt.useMemo(xu,[]);return nt.useEffect(()=>(h.connect(b),()=>h.connect(null)),[h,b]),jsxRuntime.jsx(mt.Provider,{value:k,children:jsxRuntime.jsx(wl.Provider,{value:b,children:jsxRuntime.jsx(Xl.Provider,{value:R,children:jsxRuntime.jsx(Jn.Provider,{value:h,children:jsxRuntime.jsx(Ch,{children:jsxRuntime.jsx(Ph,{children:jsxRuntime.jsx(Ea,{children:m})})})})})})})}function Ch({children:e}){let t=Da(true);return jsxRuntime.jsx(er.Provider,{value:t,children:e})}function Ph({children:e}){let t=Na();return jsxRuntime.jsx(jl.Provider,{value:t,children:e})}var ns=316,os=44,Mh=24,La={inlineStart:0,inlineEnd:ns},Cu={inlineStart:os,inlineEnd:os},Ih={inlineStart:0,inlineEnd:0};function wu({open:e,viewportWidth:t,pageWidthPx:n,inlineStartReservation:o=0,docked:r=false}){if(!e)return Cu;if(r||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0)return La;let i=Number.isFinite(o)&&o>0?o:0;return t-i-n-2*Mh>=ns?La:Cu}var _h=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}},Dh=(e,t)=>e.reviewPaneOpen===t.reviewPaneOpen&&e.entitledZoom===t.entitledZoom&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Ru(){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(_h,Dh),r=At(),i=Tu(),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?wu({open:n,viewportWidth:p??0,pageWidthPx:l===null||o===null?0:Ee(l)*o,inlineStartReservation:i,docked:o===null}):Ih,[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 Fa=[.25,.5,.75,1,1.25,1.5,2];function nr(e,t){return t==="in"?Fa.find(o=>o>e+.001)??null:[...Fa].reverse().find(o=>o<e-.001)??null}function ku(e,t){return e==="0"?1:e==="+"||e==="="?nr(t,"in")??t:e==="-"?nr(t,"out")??t:null}var ko=nt.createContext(false);function ot(){return nt.useContext(ko)?"":"docx-editor "}var Ah=e=>e.reviewPaneOpen??true,Hh=e=>e.zoomMode?.type==="fit";function Aa({className:e,style:t,children:n}){let o=ot(),r=H(),i=O(Ah),a=dn(),l=O(Hh),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=ku(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 Bh=editor.LOADING_SNAPSHOT;function _u({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)??Bh}),[t]);}var Vh=e=>e.editingMode??"editing",as='[role="menuitemradio"]:not([disabled])',$h=(e,t)=>e.length===t.length&&e.every((n,o)=>n===t[o]),Wh=e=>e.isLoading||e.isOpening===true,rr=[{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"}],Uh=Object.freeze(rr.map(()=>null));function Gh(e){return e?rr.map(t=>{let n=e.can({type:"setEditingMode",mode:t.mode});return n.ok?null:n.reason}):Uh}var jh="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function Oa({className:e,hidden:t}){let n=H(),o=O(Vh),r=O(Wh),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 h=m.current?.querySelectorAll(as);(m.current?.querySelector(`${as}[aria-checked="true"]`)??h?.[0]??void 0)?.focus();},[l]);let p=nt.useCallback(h=>{let v=[...m.current?.querySelectorAll(as)??[]],S=v.indexOf(document.activeElement),x=w=>{h.preventDefault(),v[(w+v.length)%v.length]?.focus();};h.key==="ArrowDown"?x(S+1):h.key==="ArrowUp"?x(S-1):h.key==="Home"?x(0):h.key==="End"&&x(v.length-1);},[]);nt.useEffect(()=>{if(!l)return;let h=S=>{let x=s.current;x&&S.target instanceof Node&&x.contains(S.target)||c(false);},v=S=>{S.key==="Escape"&&(S.preventDefault(),c(false));};return document.addEventListener("mousedown",h,true),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",h,true),document.removeEventListener("keydown",v);}},[l]);let g=nt.useCallback(h=>{c(false),editor.runToolbarCommand(n,"review.editingMode",h),n?.focus();},[n]),u=editor.toolbarCommandState(n,"review.editingMode"),f=i18n.localizeDisabledReason(u.disabledReason,a),b=O(()=>Gh(n),$h),y=nt.useMemo(()=>rr.find(h=>h.mode===o)??rr[0],[o]);if(t)return null;let P=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(P?.labelKey??"editingMode.label"),disabled:r||!u.enabled,...f?{title:f}:{},onMouseDown:B,onClick:()=>c(h=>!h),children:[is(y.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:i(y.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(P?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:p,children:rr.map((h,v)=>{let S=i18n.localizeDisabledReason(b[v]??null,a);return jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h.mode===o,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${h.mode}`,disabled:S!==null,...S?{title:S}:{},onMouseDown:B,onClick:()=>g(h.mode),children:[is(h.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:i(h.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:i(h.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:h.mode===o?is(jh):null})]},h.mode)})}):null]})}Oa.docxSlot="review.editingMode";function is(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 Fu=[],Jh=()=>{};function ar(){let e=H(),t=nt.useCallback(n=>{if(!e)return Jh;let o=Ll(n),r=e.on("change",o),i=e.on("selectionChange",o);return ()=>{r(),i();}},[e]);return nt.useSyncExternalStore(t,()=>e?.getReviewAuthors()??Fu,()=>Fu)}var rv=e=>e.hiddenReviewAuthors??[];function Za({className:e,hidden:t,icon:n}){let o=H(),r=ar(),i=O(rv),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=T=>{v.preventDefault(),S[(T+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"),P=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:P??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(Au,{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(Au,{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]})}Za.docxSlot="review.authors";function Au(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 Ka({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 dv={contextualSpacing:null,keepNext:null,keepLines:null,widowControl:null,pageBreakBefore:null},uv=e=>{let t=e.formatting??null;if(!t)return null;let n=t.indent,o=t.paragraphFlags??dv;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}}},pv=["alignment","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops","indentLeft","indentRight","indentFirstLine"],mv=(e,t)=>pv.every(n=>e.disagrees[n]===t.disagrees[n]),fv=(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&&mv(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")),gv=e=>e.editable;function cs(){let e=H(),t=O(uv,fv),n=O(gv),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 ir=e=>Math.round(e/1440*100)/100,ds=e=>ir(e).toLocaleString(void 0,{maximumFractionDigits:2}),za=e=>Math.round(e*1440),Ou={left:"dialogs.paragraph.tabAlignLeft",center:"dialogs.paragraph.tabAlignCenter",right:"dialogs.paragraph.tabAlignRight",decimal:"dialogs.paragraph.tabAlignDecimal",bar:"dialogs.paragraph.tabAlignBar"},bv=e=>e===null||e===0?"none":e<0?"hanging":"firstLine",hv=(e,t)=>e==="none"?0:e==="hanging"?-Math.abs(t):Math.abs(t);function Bu(e){let t=e.indentFirstLineTwips;return {alignment:e.alignment??"left",indentLeft:e.indentLeftTwips??0,indentRight:e.indentRightTwips??0,special:bv(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 Va={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 Zu(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 vv(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 qu(e,t,n=Va,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",hv(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),(!vv(e.tabStops,t.tabStops)||l("tabStops")&&t.clearedAllTabStops)&&a("tabStops",t.tabStops),i?r:null}function Ku(e,t){return [...e.filter(o=>o.positionTwips!==t.positionTwips),t].sort((o,r)=>o.positionTwips-r.positionTwips)}function zu(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 Sv={marginRight:"auto",fontSize:"12px",color:"var(--doc-danger)"},Tv={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Cv={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},Pv={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",flexShrink:0,fontSize:16,fontWeight:600,color:"var(--doc-text)"},Ev={padding:"16px 20px",overflowY:"auto",minHeight:0},wv={display:"grid",gridTemplateColumns:"1fr 1fr",gap:28},Wu={display:"flex",flexDirection:"column",gap:14,minWidth:0},lr={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)"},sr={fontSize:11,color:"var(--doc-text-muted)",width:20},Rv={display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--doc-text)"},kv={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,flexShrink:0},cr={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}=cs(),[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,P]=nt.useState(0),[h,v]=nt.useState(0),[S,x]=nt.useState("multiple"),[w,T]=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,he]=nt.useState(0),[ve,U]=nt.useState("left"),[Z,Re]=nt.useState("none"),[ce,de]=nt.useState(Va),[We,ho]=nt.useState(false),pt=q=>o(We&&(q==="indentLeft"||q==="indentRight"||q==="special")?"dialogs.paragraph.notShown":"dialogs.paragraph.mixed"),vo=nt.useRef(Va),De=nt.useId(),[El,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=Bu(r);c(q.alignment),d(q.indentLeft),p(q.indentRight),u(q.special),b(q.specialBy),P(q.spaceBefore),v(q.spaceAfter),x(q.lineRule),T(q.lineValue),R(q.contextualSpacing),L(q.keepNext),I(q.keepLines),E(q.widowControl),ae(q.pageBreakBefore),V(q.tabStops),ne(false);let ye=Zu(r);de(ye),ho(r.indentUnknown),he(0),U("left"),Re("none"),vo.current=ye,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,ye=q===null?null:qu(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(ye===null){t();return}if(a(ye)){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(ye=>({...ye,tabStops:false})),V(Ku(z,{positionTwips:q,alignment:ve,...Z!=="none"?{leader:Z}:{}})),he(0),U("left"),Re("none"),true)},[z,re,ve,Z]);if(!e)return null;let at=q=>de(ye=>({...ye,[q]:false})),Wn=(q,ye,Wt,Ue)=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${De}-${q}`,children:o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("input",{id:`${De}-${q}`,type:"number",style:wt,min:0,step:.1,value:ce[Ue]?"":ir(ye),placeholder:ce[Ue]?pt(Ue):void 0,onChange:Un=>{at(Ue),Wt(za(Number(Un.target.value)||0));},"aria-label":o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("span",{style:sr,children:o("dialogs.paragraph.unitInches")})]}),xa=(q,ye,Wt,Ue)=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${De}-${q}`,children:o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("input",{id:`${De}-${q}`,type:"number",style:wt,min:0,step:1,value:ce[Ue]?"":ye,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:sr,children:o("dialogs.paragraph.unitPoints")})]}),yo=(q,ye,Wt)=>jsxRuntime.jsxs("label",{style:Rv,children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ye,ref:Ue=>{Ue&&(Ue.indeterminate=ce[q]);},onChange:Ue=>{de(Un=>({...Un,[q]:false})),Wt(Ue.target.checked);}}),o(`dialogs.paragraph.${q}`)]}),Bd=`docx-editor${document.querySelector(".docx-editor")?.classList.contains("dark")?" dark":""}`;return reactDom.createPortal(jsxRuntime.jsx("div",{className:Bd,style:{display:"contents"},children:jsxRuntime.jsx("div",{className:n,style:Tv,onClick:t,onKeyDown:q=>{q.key==="Escape"&&t(),Pt.current&&zu(Pt.current,q.nativeEvent)&&q.preventDefault();let ye=q.target instanceof HTMLButtonElement||q.target instanceof HTMLSelectElement;if(q.key==="Enter"&&!ye){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:Cv,onClick:q=>q.stopPropagation(),onMouseDown:q=>q.stopPropagation(),children:[jsxRuntime.jsx("div",{style:Pv,children:o("dialogs.paragraph.title")}),jsxRuntime.jsx("div",{style:Ev,children:jsxRuntime.jsxs("div",{style:wv,children:[jsxRuntime.jsxs("div",{style:Wu,children:[jsxRuntime.jsx("div",{style:lr,children:o("dialogs.paragraph.general")}),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${De}-alignment`,children:o("dialogs.paragraph.alignment")}),jsxRuntime.jsxs("select",{id:`${De}-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:lr,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:`${De}-special`,children:o("dialogs.paragraph.special")}),jsxRuntime.jsxs("select",{id:`${De}-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:`${De}-by`,children:o("dialogs.paragraph.by")}),jsxRuntime.jsx("input",{id:`${De}-by`,type:"number",style:wt,min:0,step:.1,value:ce.special?"":ir(f),placeholder:ce.special?pt("special"):void 0,onChange:q=>{at("special"),b(Math.max(0,za(Number(q.target.value)||0)));},"aria-label":o("dialogs.paragraph.by")}),jsxRuntime.jsx("span",{style:sr,children:o("dialogs.paragraph.unitInches")})]}):null,jsxRuntime.jsx("div",{style:lr,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:ds(q.positionTwips)})}),jsxRuntime.jsx("span",{style:{flex:1,fontSize:13,color:"var(--doc-text-muted)"},children:o(Ou[q.alignment])}),jsxRuntime.jsx("button",{type:"button",style:cr,onClick:()=>V(z.filter(ye=>ye!==q)),"aria-label":o("dialogs.paragraph.tabRemoveAt",{position:ds(q.positionTwips)}),children:o("dialogs.paragraph.tabRemove")})]},q.positionTwips)),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${De}-tabPosition`,children:o("dialogs.paragraph.tabPosition")}),jsxRuntime.jsx("input",{id:`${De}-tabPosition`,type:"number",style:wt,min:0,step:.1,value:ir(re),onChange:q=>he(Math.max(0,za(Number(q.target.value)||0))),"aria-label":o("dialogs.paragraph.tabPosition"),"data-docx-tab-entry":""}),jsxRuntime.jsx("span",{style:sr,children:o("dialogs.paragraph.unitInches")})]}),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${De}-tabAlignment`,children:o("dialogs.paragraph.tabAlignment")}),jsxRuntime.jsxs("select",{id:`${De}-tabAlignment`,style:wt,value:ve,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:`${De}-tabLeader`,children:o("dialogs.paragraph.tabLeader")}),jsxRuntime.jsxs("select",{id:`${De}-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:cr,onClick:me,children:o("dialogs.paragraph.tabAdd")}),jsxRuntime.jsx("button",{type:"button",style:cr,onClick:()=>{de(q=>({...q,tabStops:false})),ne(true),V([]);},children:o("dialogs.paragraph.tabClearAll")})]})]}),jsxRuntime.jsxs("div",{style:Wu,children:[jsxRuntime.jsx("div",{style:lr,children:o("dialogs.paragraph.spacing")}),xa("spaceBefore",y,P,"spaceBefore"),xa("spaceAfter",h,v,"spaceAfter"),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${De}-lineSpacing`,children:o("dialogs.paragraph.lineSpacing")}),jsxRuntime.jsxs("select",{id:`${De}-lineSpacing`,style:wt,value:ce.lineSpacing?"":S,onChange:q=>{let ye=q.target.value;at("lineSpacing"),x(ye),T(ye===on.current?.lineRule?on.current.lineValue:ye==="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:`${De}-at`,children:o("dialogs.paragraph.at")}),jsxRuntime.jsx("input",{id:`${De}-at`,type:"number",style:wt,min:.01,step:S==="multiple"?.01:1,value:ce.lineSpacing?"":w,disabled:ce.lineSpacing,onChange:q=>{let ye=q.target.value.trim();T(ye===""?S==="multiple"?1.08:12:Number(ye)||0);},"aria-label":o("dialogs.paragraph.at")}),jsxRuntime.jsx("span",{style:sr,children:S==="multiple"?"":o("dialogs.paragraph.unitPoints")})]}),yo("contextualSpacing",k,R),jsxRuntime.jsx("div",{style:lr,children:o("dialogs.paragraph.pagination")}),yo("keepNext",_,L),yo("widowControl",M,E),yo("keepLines",F,I),yo("pageBreakBefore",D,ae)]})]})}),jsxRuntime.jsxs("div",{style:kv,children:[El?jsxRuntime.jsx("span",{role:"alert",style:Sv,children:o("dialogs.paragraph.refused")}):null,jsxRuntime.jsx("button",{type:"button",style:cr,onClick:t,children:o("dialogs.paragraph.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...cr,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 Uu=nt.createContext(null);function Gu({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(Uu.Provider,{value:r,children:[e,jsxRuntime.jsx(Mo,{open:t,onClose:i})]})}function ju(){return nt.useContext(Uu)}var Hv=["zoom","script","format","list","alignment","styles","font","text","history"],us=new Set(["review"]),ps=24,Xu=new Set;function Ju(e,t=Hv){let n=t.filter(r=>e.includes(r));return [...e.filter(r=>!t.includes(r)).reverse(),...n]}function Yu(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 Xu;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 Qu(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 ep=Qu;function tp(e){if(!(e.available>0))return Xu;let t=Yu(e,e.available),n=e.previous;if(!n||n.size===0||t.size>=n.size)return t;let o=Yu(e,e.available-(e.hysteresis));return Qu(o,n)?n:o}function op(e,t,n,o){return e+t+n+o*2}function np(e,t){return e+t}function fs(e,t){return e+t}function rp(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 ms(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function ap(e){return ms(e.columnGap)}function ip(e,t){return e.clientWidth-ms(t.paddingLeft)-ms(t.paddingRight)}var pn="data-toolbar-group",ur="data-toolbar-fixed",bs="data-toolbar-more",qv=34,gs=new Set;function sp(e,t,n){let o=nt.useRef(null),r=nt.useRef(new Map),i=nt.useRef(qv),[a,l]=nt.useState(gs),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=ap(f),y=ip(u,f),P=u.querySelector(".docx-toolbar__separator"),h=b*2;if(P){let T=getComputedStyle(P),k=rp(T);h=op(P.offsetWidth,k.start,k.end,b);}for(let T of u.querySelectorAll(`[${pn}]`)){let k=T.getAttribute(pn);k&&T.offsetWidth>0&&r.current.set(k,np(T.offsetWidth,h));}let v=0;for(let T of u.querySelectorAll(`[${ur}]`))T.offsetWidth>0&&(v+=fs(T.offsetWidth,b));let S=u.querySelector(`[${bs}]`);S&&S.offsetWidth>0&&(i.current=fs(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:ps},w=tp(x);ep(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=gs,l(gs));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}], [${ur}]`))b.observe(y);return ()=>{f!==0&&cancelAnimationFrame(f),b.disconnect();}},[e,d,p,m,a]),{attach:g,overflow:a}}var jv=["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"],dp=nt.createContext({close:()=>{}});function Yv(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function up({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 pp({slot:e}){let t=J(),n=an(),{close:o}=nt.useContext(dp),{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 mp({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&&Yv(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}`:""}`,[bs]:"",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(jv)}),o?jsxRuntime.jsx(dp.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 ty(e,t){return e.value===t.value&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function pr(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,ty),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 vs=[{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 ja({className:e,hidden:t,asChild:n,children:o}){let{t:r}=N(),i=J(),{execute:a,value:l,isEnabled:c,disabledReason:s}=pr("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(()=>vs.find(x=>x.value===l)??vs[0],[l]),y=X("image.wrap"),P=i(y?.labelKey??"formattingBar.imageWrap");nt.useEffect(()=>{if(!d)return;let x=T=>{let k=p.current;k&&T.target instanceof Node&&k.contains(T.target)||m(false);},w=T=>{T.key==="Escape"&&(T.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":P,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:vs.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]})}ja.docxSlot="image.wrap";var mr=Object.assign(ja,{docxSlot:"image.wrap"});function Ya({className:e,hidden:t,asChild:n,children:o}){let{t:r}=N(),i=J(),{execute:a,value:l,isEnabled:c,disabledReason:s}=pr("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 T=u.current;T&&w.target instanceof Node&&T.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 P=X("image.altText"),h=i(P?.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]})}Ya.docxSlot="image.altText";var fr=Object.assign(Ya,{docxSlot:"image.altText"});var Sp=e=>e.image;function xp(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 by(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Cs(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 hy(e,t){let n=Cs(t);return e.horizontalPoints!==n.horizontalPoints||e.verticalPoints!==n.verticalPoints||e.relativeToH!==n.relativeToH||e.relativeToV!==n.relativeToV}function Xa(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 vy(e,t){let n=Cs(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let s=e.horizontalPoints!==n.horizontalPoints,d=e.verticalPoints!==n.verticalPoints,m=s?Xa(e.horizontalPoints):t.position?.horizontalEmu,p=d?Xa(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?Xa(e.horizontalPoints):t.position?.horizontalEmu,c=r?Xa(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 Ja(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function Qa(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function Ps({open:e,onClose:t,className:n,triggerRef:o}){let r=H(),{t:i}=N(),a=O(Sp),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),P=m.current,h=P?.canCrop===false,v=P?.canResize===false,S=P?.locks.changeAspect===true,x=P?.kind==="anchored"&&P.canMove===true,w=P?.kind==="inline",T=P?.kind==="anchored"&&P.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=Cs(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=xp(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 $=xp(E);if($.length===0)return;let ne=document.activeElement,re=$.findIndex(ve=>ve===ne);if(re===-1)return;V.preventDefault();let he=V.shiftKey?(re-1+$.length)%$.length:(re+1)%$.length;$[he]?.focus();};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[e,R]);let _=nt.useMemo(()=>{let E=P??a;return !E||E.widthEmu<=0?1:E.widthEmu/E.heightEmu},[a,P]),L=nt.useCallback(E=>{f(D=>{if(!D)return D;if(!D.lockAspect)return {...D,widthPoints:E};let ae=Qa(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=Qa(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 ve=Qa(u.widthPoints),U=Qa(u.heightPoints);if(ve===null||U===null){y("imageProperties.errors.invalidDimensions");return}let Z=Gn(ve),Re=Gn(U);Z!==E.widthEmu&&(z.widthEmu=Z),Re!==E.heightEmu&&(z.heightEmu=Re);}if(E.canCrop&&!h){let ve=Ja(u.cropLeft),U=Ja(u.cropTop),Z=Ja(u.cropRight),Re=Ja(u.cropBottom);if(ve===null||U===null||Z===null||Re===null){y("imageProperties.errors.invalidCrop");return}let ce=E.crop;(ve!==ce.left||U!==ce.top||Z!==ce.right||Re!==ce.bottom)&&(z.crop={left:ve,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&&hy(u,E)){let ve=vy(u,E);if(!ve.ok){y("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(ve.value,E))){y("imageProperties.errors.invalidPosition");return}Object.assign(z,ve.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(),by(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||!P?.intrinsic,onClick:I,children:i("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.position")}),w?jsxRuntime.jsx("p",{className:"docx-dialog__hint",children:i("imageProperties.positionUnavailable")}):null,T?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:P?.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 ei({className:e,hidden:t,asChild:n,children:o}){let r=H(),{t:i}=N(),a=O(Sp),[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(Ps,{open:l,onClose:()=>c(false),triggerRef:s})]})}ei.docxSlot="image.properties";var gn=Object.assign(ei,{docxSlot:"image.properties"});function Ae(e){return Object.assign(n=>jsxRuntime.jsx(So,{slot:e,...n}),{docxSlot:e})}var Tp=Ae("history.undo"),Cp=Ae("history.redo"),Pp=Ae("text.bold"),Ep=Ae("text.italic"),wp=Ae("text.underline"),Rp=Ae("text.strike"),kp=Ae("format.clear"),Mp=Ae("script.super"),Ip=Ae("script.sub"),_p=Ae("alignment.left"),Dp=Ae("alignment.center"),Np=Ae("alignment.right"),Lp=Ae("alignment.justify"),Fp=Ae("list.bullet"),Ap=Ae("list.numbered"),Hp=Ae("list.outdent"),Op=Ae("list.indent");var Bp=Ae("table.insert"),Zp=Ae("review.comments");function Ty({className:e,hidden:t,icon:n,asChild:o,children:r}){let i=H(),{openAtCaret:a}=Wl(),l=editor.chromeProbeForSlot("text.link"),c=i&&l?i.can(l):null,s=c?.ok===true,{t:d}=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 Es=Object.assign(Ty,{docxSlot:"text.link"});function Cy({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 ws=Object.assign(Cy,{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 wy=e=>({zoom:e.zoom,mode:e.zoomMode}),Ry=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,Kp={type:"fixed"};function Rs(){let e=H(),{zoom:t,mode:n}=O(wy,Ry),o=nt.useCallback(i=>{e?.setZoom(i);},[e]),r=nt.useCallback(i=>{e?.setZoomMode(i);},[e]);return nt.useMemo(()=>{let i=n??Kp,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(Kp),o(1);},zoomIn:()=>l!==null&&o(l),zoomOut:()=>a!==null&&o(a),canZoomIn:!!e&&l!==null,canZoomOut:!!e&&a!==null,levels:Fa}},[e,t,n,o,r])}var vr=2,yr=3276,hr=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Iy=e=>e.formatting?.fontSizePt??null;function $p(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Wp(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 Gp(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 _y(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<vr||o>yr?null:o}function Dy({className:e,hidden:t}){let n=H(),o=O(Iy),{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(yr,Math.max(vr,Math.round(S*2))));},[g]),f=nt.useCallback(S=>{c(false),d(null),p.current?.blur(),S&&Ny(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),P=s??y,h=o===null?null:Math.round(o*2)/2,v=()=>{if(s===null)return;let S=_y(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(Gp,{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:P,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"?Wp(o,hr,vr/2):$p(o,hr,yr/2)));},onBlur:()=>{v(),d(null);}}),canDecrease:b&&Math.round(o*2)>vr,canIncrease:b&&Math.round(o*2)<yr,onDecrease:()=>u(Wp(o??0,hr,vr/2)),onIncrease:()=>u($p(o??0,hr,yr/2))}),l&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox","aria-label":a("fontSize.listLabel"),children:hr.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 Ny(e){(bn(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}var Is=Object.assign(Dy,{docxSlot:"font.size"});function Ly({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}=Rs(),g=J(),[u,f]=nt.useState(false),b=nt.useRef(null);nt.useEffect(()=>{if(!u)return;let x=w=>{let T=b.current;T&&w.target instanceof Node&&T.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]),P=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(Gp,{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:()=>P("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:()=>P("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 _s=Object.assign(Ly,{docxSlot:"zoom.level"});var Oy=[1,1.15,1.5,2,2.5,3],Xp=10,Jp=0,By=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),Zy=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function qy({className:e,hidden:t}){let n=H(),o=O(By,Zy),{isEnabled:r,disabledReason:i}=le("list.lineSpacing"),a=le("paragraph.dialog"),l=ju(),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,P=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:[Oy.map(h=>{let v=P===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?Jp:Xp),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?Jp:Xp),children:c(y?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var Ns=Object.assign(qy,{docxSlot:"list.lineSpacing"});var Uy=[{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"}],Qp=[{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"}],em=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],ti=["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 Gy(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 jy=/^[0-9A-Fa-f]{6}$/;function Yy(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 Xy(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 oi({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":""}:{},...Xy(t.replace("#",""))?{"data-light":""}:{},onMouseDown:B,onClick:()=>r(e)})}function Jy({apply:e,label:t,current:n,themeHexes:o}){let r=o.map(Gy),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(oi,{value:a,css:`#${a.toLowerCase()}`,title:t(ti[l]),selected:n===a,apply:e},`base-${l}`)),i.map(a=>o.map((l,c)=>{let s=r[c][a],d=Yy(l,s.apply);return jsxRuntime.jsx(oi,{value:d,css:`#${d.toLowerCase()}`,title:`${t(ti[c])}, ${t(s.labelKey)}`,selected:n===d,apply:e},`${a}-${c}`)}))]})]})}function Qy(e){let{apply:t,label:n,current:o}=e,[r,i]=nt.useState(""),a=jy.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jy,{...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:Uy.map(l=>jsxRuntime.jsx(oi,{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 Fs({apply:e,current:t}){let n=H(),o=J(),r=n?.getDocumentThemeColors()??[],i=r.length===ti.length?r.map(l=>l.hex):em,a=t?.toUpperCase()??null;return jsxRuntime.jsx(Qy,{apply:e,label:o,current:a,themeHexes:i})}var ex=Qp.filter(e=>e.value!=="white");function tx({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:ex.map(o=>jsxRuntime.jsx(oi,{value:o.value,css:o.css,title:t(o.labelKey),selected:n===o.value,apply:e},o.value))})]})}function tm(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,P]=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===ti.length?S.map(R=>R.hex):em;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&&P(R));},[m]),T=nt.useMemo(()=>X(t),[]);if(s)return null;let k=u(T?.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(T?.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 ox=new Map(Qp.map(e=>[e.value,e.css])),As=tm({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(Fs,{apply:e.apply,current:e.current})}),Hs=tm({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>ox.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(tx,{...e})});var lx=["alignment.left","alignment.center","alignment.right","alignment.justify"];function sx({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=lx.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 ni=Object.assign(sx,{docxSlot:"alignment"});function Bs(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 bx=Object.freeze([]),hx=e=>e.formatting?.fontFamily??null,vx=e=>e;function ri(){let e=H(),t=O(hx),n=O(vx),o=nt.useMemo(()=>e&&!n.isLoading?e.getAvailableFonts():bx,[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 rm=nt.createContext(null);function qs(){return nt.useContext(rm)}function Ks({asChild:e,className:t,children:n}){let o=qs(),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})}Ks.docxToolbarPart=true;var yx=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"]]),xx=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function am({asChild:e,className:t,children:n}){let o=qs(),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=xx.map(c=>({...c,fonts:o.options.filter(s=>(yx.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(im,{value:d},d))]},c.category)),e?jsxRuntime.jsx(j,{...i,children:a}):jsxRuntime.jsx("div",{...i,children:a})}function im({value:e,asChild:t,className:n,children:o}){let r=qs();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 Sx({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__font-family${n?` ${n}`:""}`,"data-slot":"font.family"},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ks,{}),jsxRuntime.jsx(am,{})]});return jsxRuntime.jsx(rm.Provider,{value:c,children:t?jsxRuntime.jsx(j,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var zs=Object.assign(Sx,{docxSlot:"font.family",Trigger:Ks,Content:am,Item:im});var Cx={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},Px=new Set(["Title","Heading1","Heading2","Heading3"]),Ex={Subtitle:"666666"},wx="#4a6c8c";function lm(e){let t=Cx[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??Px.has(e.styleId))&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let r=e.color??Ex[e.styleId];return r?o.color=`#${r}`:e.styleId.startsWith("Heading")&&(o.color=wx),o}var Rx=/^heading ([1-9])$/;function $s(e,t){let n=e||t,o=Rx.exec(n);return o?`Heading ${o[1]}`:n}function sm(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:$s(t.name,t.styleId),priority:99}))}function Fx(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 Ax=Object.freeze([]),Hx=e=>e.formatting?.styleId??null,Ox=e=>e;function ai(){let e=H(),t=O(Hx),n=O(Ox),o=nt.useMemo(()=>e&&!n.isLoading?e.getDocumentStyles().filter(a=>a.type==="paragraph").map(a=>({styleId:a.styleId,name:$s(a.name,a.styleId),preview:a.preview})):Ax,[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 cm=nt.createContext(null);function Us(){return nt.useContext(cm)}function Gs({asChild:e,className:t,children:n}){let o=Us(),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})}Gs.docxToolbarPart=true;function dm({asChild:e,className:t,children:n}){let o=Us();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(um,{value:a.styleId},a.styleId));return e?jsxRuntime.jsx(j,{...r,children:i}):jsxRuntime.jsx("div",{...r,children:i})}function um({value:e,asChild:t,className:n,children:o}){let r=Us();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?Fx(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 Bx({hidden:e,asChild:t,className:n,children:o}){let r=ai(),[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(Gs,{}),jsxRuntime.jsx(dm,{})]});return jsxRuntime.jsx(cm.Provider,{value:c,children:t?jsxRuntime.jsx(j,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var js=Object.assign(Bx,{docxSlot:"styles.style",Trigger:Gs,Content:dm,Item:um});function mm(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 qx({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 Kx({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 ii=mm(Ye.showAll,"showAll"),li=mm(Ye.formFill,"formFill"),si=Object.assign(Kx,{docxSlot:Ye.remove}),ci=Object.assign(qx,{docxSlot:Ye.inspector}),fm={[Ye.showAll]:ii,[Ye.formFill]:li,[Ye.inspector]:ci,[Ye.remove]:si};function Ys(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 jx=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Js=nt.createContext(null);function Sm(){let e=nt.useContext(Js);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function Xx(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 Jx(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function Qx(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var ym={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function eS(e,t){let n={};for(let o of jx){let r=editor.tableChromeToolbarState(e,o,t);n[o]={enabled:r.enabled,disabledReason:r.disabledReason};}return n}function Qs({children:e}){let t=H(),[n,o]=nt.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,i]=nt.useState(ym);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:""}),[]),Jx,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),l=nt.useCallback(()=>{if(!t){i(ym);return}let p=Xx(t,t.snapshot());i(g=>Qx(g,p)?g:p);},[t]);nt.useEffect(()=>{l();},[l,a]),Ys("selectionChange",nt.useCallback(()=>{l();},[l]));let c=r.tableKey!=="",s=nt.useMemo(()=>t?eS(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(Js.Provider,{value:m,children:e})}function tS(){let e=nt.useContext(Js);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function ui(e){let t=tS(),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 nS='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function Do(e){return [...e.querySelectorAll(nS)].filter(t=>t.closest('[role="menu"]')===e)}function ec(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 pi(e){(bn(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function oc(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 mi({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 iS='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function Tm(e,t,n,o){nt.useEffect(()=>{if(!e)return;let r=n.current,i=o.current;if(!r)return;let a=()=>[...r.querySelectorAll(iS)].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 Cm(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 km(e,t,n){if(e)return o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(!t));}}function mS(e){return Q(editor.tableChromeIconPaths(e))}function Mm(){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 rc(e,t,n){let o=Mm();function r({hidden:l,asChild:c,className:s,children:d}){let{visible:m,enabled:p,disabledReason:g,draft:u,apply:f}=ui(e),[b,y]=nt.useState(false),P=nt.useRef(null),h=nt.useRef(null);oc(b,y,P);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:P,children:x}):jsxRuntime.jsx("div",{ref:P,...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:P,reasonNode:h}=mi({enabled:p,disabledReason:g,ariaLabel:y}),v={...P,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:km(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(Tm(d&&p,m,f,g),!d||!p)return null;let b=X(e),y=u(b?.labelKey??n),P={ref:f,role:"menu","aria-label":y,className:`docx-table-chrome__panel${c?` ${c}`:""}`,onMouseDown:B};return l?jsxRuntime.jsx(j,{...P,children:s}):jsxRuntime.jsx("div",{...P,children:s})}return {Root:r,Trigger:i,Content:a,Ctx:o}}var Tr=rc("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");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_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??mS(c.icon);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??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(n=>jsxRuntime.jsx(Im,{value:n.value},n.value))})})}function fS(e){let{children:t}=e,n=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tr.Trigger,{}),jsxRuntime.jsx(_m,{})]});return jsxRuntime.jsx(Tr.Root,{...e,children:n})}var Rr=Object.assign(fS,{docxSlot:"table.borderTarget",Trigger:Tr.Trigger,Content:_m,Item:Im}),Cr=rc("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function Dm({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Bt(Cr.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 Nm(e){let{children:t}=e;return jsxRuntime.jsx(Cr.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(n=>jsxRuntime.jsx(Dm,{value:n.value},n.value))})}function gS(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(gS,{docxSlot:"table.borderStyle",Trigger:Cr.Trigger,Content:Nm,Item:Dm}),Pr=rc("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function Lm({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Bt(Pr.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 Fm(e){let{children:t}=e;return jsxRuntime.jsx(Pr.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(n=>jsxRuntime.jsx(Lm,{value:String(n.size)},n.size))})}function bS(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pr.Trigger,{}),jsxRuntime.jsx(Fm,{})]});return jsxRuntime.jsx(Pr.Root,{...e,children:t})}var Mr=Object.assign(bS,{docxSlot:"table.borderWidth",Trigger:Pr.Trigger,Content:Fm,Item:Lm});function Am(e,t,n){let o=n?.defaultHex??"FF0000",r=Mm();function i({hidden:d,asChild:m,className:p,children:g}){let{visible:u,enabled:f,disabledReason:b,draft:y,apply:P}=ui(e),[h,v]=nt.useState(false),[S,x]=nt.useState(o),w=nt.useRef(null),T=nt.useRef(null);oc(h,v,w);let k=nt.useMemo(()=>({open:h,setOpen:v,enabled:f,disabledReason:b,apply:P,draft:y,triggerRef:T,lastHex:S,setLastHex:x}),[h,f,b,P,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),P=J(),h=X(e),v=P(h?.labelKey??t),{shared:S,reasonNode:x}=mi({enabled:g,disabledReason:u,ariaLabel:v}),w=e==="table.borderColor"&&b.spec.color.kind==="hex"?b.spec.color.value:y??o,T={...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,{...T,children:k}),x]}):jsxRuntime.jsxs("button",{...T,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),P=J(),h=X(e),v=P(h?.labelKey??t),{shared:S,reasonNode:x}=mi({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:km(f,g,u)}:{}},T=p??"\u25BE";return d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(j,{...w,children:T}),x]}):jsxRuntime.jsxs("button",{...w,children:[T,x]})}l.docxToolbarPart=true;function c({asChild:d,className:m,children:p,clearFill:g}){let{open:u,setOpen:f,enabled:b,apply:y,draft:P,triggerRef:h,lastHex:v,setLastHex:S}=Bt(r),x=J(),w=nt.useRef(null);if(Cm(u&&b,f,w,h),!u||!b)return null;let T=x(t),k=e==="table.borderColor"&&P.spec.color.kind==="hex"?P.spec.color.value:v??o,R={ref:w,role:"dialog","aria-label":T,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),pi(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(Fs,{apply:L=>{f(false),S?.(L),y({kind:"hex",value:L}),pi(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:P,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),P?.(d),b({kind:"hex",value:d}),pi(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 Er=Am("table.borderColor","table.borderColor",{defaultHex:"000000"});function hS(e){return jsxRuntime.jsx(Er.Content,{...e,clearFill:false})}function vS(e){return jsxRuntime.jsx(Er.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function yS(e){return jsxRuntime.jsx(Er.Root,{...e})}var Ir=Object.assign(yS,{docxSlot:"table.borderColor",Trigger:Er.Trigger,Content:hS,Item:vS,Main:Er.Main}),wr=Am("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function xS(e){return jsxRuntime.jsx(wr.Content,{...e,clearFill:true})}function SS(e){return jsxRuntime.jsx(wr.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function TS(e){return jsxRuntime.jsx(wr.Root,{...e})}var _r=Object.assign(TS,{docxSlot:"table.cellFill",Trigger:wr.Trigger,Content:xS,Item:SS,Main:wr.Main});function Hm({overrides:e=new Map,separator:t=true}){return Sm()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(Io,{}):null,[Rr,Ir,kr,Mr,_r].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 Om(){let e=J(),{draft:t}=ui("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var lc=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],bi="contextual-table",sc={"zoom.level":_s,"styles.style":js,"font.family":zs,"font.size":Is,"text.color":As,"text.highlight":Hs,"text.link":Es,"list.lineSpacing":Ns,"review.editingMode":Oa,"review.authors":Za,"file.save":ws,...fm,"table.borderTarget":Rr,"table.borderColor":Ir,"table.borderStyle":kr,"table.borderWidth":Mr,"table.cellFill":_r,"image.insert":Yn,"image.properties":gn,"image.wrap":mr,"image.altText":fr},fi={id:bi,labelKey:"formattingBar.groups.table",entries:lc.map(e=>({slot:e,Part:sc[e]}))},Bm=new Map;function ES(e){let t=Bm.get(e);return t||(t=n=>jsxRuntime.jsx(So,{slot:e,...n}),Bm.set(e,t)),t}function wS(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:ni}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(n=>{let o=editor.chromeSlotId(t,n);return {slot:o,Part:sc[o]??ES(o)}})})}var RS=e=>e.image,kS=e=>e.isLoading||e.isOpening===true,MS=e=>e.table!==null;function IS(e){return e==="alignment"||e in sc}function vi(e){let t=un(e,vi);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 ac(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(ac);let t=vi(e);return t!=null&&lc.includes(t)?true:nt.isValidElement(e)?nt.Children.toArray(e.props.children).some(ac):false}function _S(e,t){return t?true:nt.Children.toArray(e).some(ac)}function DS(e){let t=ot(),{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=Ca(o),d=O(RS),m=O(kS),p=O(MS),g=nt.useMemo(()=>wS(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=>!us.has(S)),...p?[bi]:[]],[g,p]),b=nt.useMemo(()=>Ju(f),[f]),y=i&&a,{attach:P,overflow:h}=sp(y,f,b),v;if(!i)v=l;else {let S=nt.Children.toArray(l),x=new Map,w=new Map,T=[];for(let M of S){let E=vi(M);E&&u.has(E)?x.set(E,M):E&&lc.includes(E)?w.set(E,M):T.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=Zm(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=us.has(M.id);_.push(jsxRuntime.jsx("div",{className:"docx-toolbar__group",...E?{[ur]:""}:{[pn]:M.id},children:M.entries.map(D=>jsxRuntime.jsx(nt.Fragment,{children:k(D)},D.slot))},M.id));}let I=h.has(bi);if(p&&I){let M=fi.entries.flatMap(E=>{let D=Zm(E,w,s,fi.labelKey,R);return D===null?[]:[jsxRuntime.jsx(nt.Fragment,{children:D},E.slot)]});M.length>0&&L.unshift({id:fi.id,labelKey:fi.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]:bi,children:jsxRuntime.jsx(Hm,{overrides:w,separator:false})}),T.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[ur]:"",children:T}):null,L.length>0?jsxRuntime.jsx(mp,{sections:L}):null]});}return jsxRuntime.jsx(xo.Provider,{value:c,children:jsxRuntime.jsx(Gu,{children:jsxRuntime.jsx("fieldset",{ref:P,disabled:m,role:"toolbar","data-testid":"docx-toolbar",className:`${t}docx-toolbar${n?` ${n}`:""}`,...y?{"data-overflow":""}:{},onMouseDown:B,children:_S(l,i)?jsxRuntime.jsx(Qs,{children:v}):v})})})}function qm(e){if(!e)return false;if(e.type===nt.Fragment){let t=nt.Children.toArray(e.props.children).find(n=>vi(n)!==null);return nt.isValidElement(t)?qm(t):false}return !!e.props.hidden}function Zm(e,t,n,o,r){let i=t.get(e.slot);return qm(i)?null:i||IS(e.slot)?jsxRuntime.jsx(up,{label:NS(n,e,o),children:r(e)}):jsxRuntime.jsx(pp,{slot:e.slot})}function NS(e,t,n){let o=t.slot==="alignment"?null:X(t.slot);return e(o?.labelKey??n)}var Nr=Object.assign(DS,{Button:So,Action:Bs,Separator:Io,Undo:Tp,Redo:Cp,Bold:Pp,Italic:Ep,Underline:wp,Strike:Rp,Link:Es,ClearFormatting:kp,Superscript:Mp,Subscript:Ip,Alignment:ni,AlignLeft:_p,AlignCenter:Dp,AlignRight:Np,AlignJustify:Lp,LineSpacing:Ns,BulletList:Fp,NumberedList:Ap,Outdent:Hp,Indent:Op,ImageInsert:Yn,ImageProperties:gn,ImageWrap:mr,ImageAltText:fr,TableInsert:Bp,TableBorderTarget:Rr,TableBorderColor:Ir,TableBorderStyle:kr,TableBorderWidth:Mr,TableCellFill:_r,Comments:Zp,FontFamily:zs,FontSize:Is,FontColor:As,Highlight:Hs,Zoom:_s,StylePicker:js,EditingMode:Oa,Reviewers:Za,Save:ws,ContentControlShowAll:ii,ContentControlFormFill:li,ContentControlInspector:ci,ContentControlRemove:si});var HS=e=>e.pageSetup??null,OS=e=>e.editable;function No(){let e=H(),t=O(HS),n=O(OS),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 dc=[{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}],jm=1440,BS=e=>Math.round(e/jm*100)/100,ZS=e=>Math.round(e*jm);function qS(e,t){let n=Math.min(e,t),o=Math.max(e,t);return dc.findIndex(r=>Math.abs(r.width-n)<20&&Math.abs(r.height-o)<20)}var KS={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},zS={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},VS={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600,color:"var(--doc-text)"},$S={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},$m={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},yi={display:"flex",alignItems:"center",gap:12},xi={width:80,fontSize:13,color:"var(--doc-text-muted)"},Si={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13,backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},WS={fontSize:11,color:"var(--doc-text-muted)",width:16},US={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},Wm={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},Um=12240,Gm=15840,Qt=1440;function Lr({open:e,onClose:t,className:n}){let{t:o}=N(),{pageSetup:r,isEnabled:i,apply:a}=No(),[l,c]=nt.useState(Um),[s,d]=nt.useState(Gm),[m,p]=nt.useState("portrait"),[g,u]=nt.useState(Qt),[f,b]=nt.useState(Qt),[y,P]=nt.useState(Qt),[h,v]=nt.useState(Qt),[S,x]=nt.useState("document"),w=nt.useRef(null),T=nt.useRef("no");nt.useEffect(()=>{if(!e){T.current="no";return}if(T.current==="yes"&&r===null){T.current="no";return}T.current==="yes"||T.current==="loading"&&r===null||(c(r?.pageWidthTwips??Um),d(r?.pageHeightTwips??Gm),p(r?.orientation??"portrait"),u(r?.marginsTwips.top??Qt),b(r?.marginsTwips.bottom??Qt),P(r?.marginsTwips.left??Qt),v(r?.marginsTwips.right??Qt),x("document"),T.current=r===null?"loading":"yes");},[e,r]),nt.useEffect(()=>{e&&w.current?.focus();},[e]);let k=nt.useCallback(I=>{let M=dc[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=qS(l,s),F=(I,M,E)=>jsxRuntime.jsxs("div",{style:yi,children:[jsxRuntime.jsx("label",{style:xi,children:o(`dialogs.pageSetup.${I}`)}),jsxRuntime.jsx("input",{type:"number",style:Si,min:0,max:22,step:.1,value:BS(M),onChange:D=>E(Math.max(0,ZS(Number(D.target.value)||0))),"aria-label":o(`dialogs.pageSetup.${I}`)}),jsxRuntime.jsx("span",{style:WS,children:"in"})]});return jsxRuntime.jsx("div",{className:n,style:KS,onClick:t,onKeyDown:I=>{I.key==="Escape"&&t(),I.key==="Enter"&&_();},children:jsxRuntime.jsxs("div",{ref:w,tabIndex:-1,style:zS,onClick:I=>I.stopPropagation(),onMouseDown:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o("dialogs.pageSetup.title"),children:[jsxRuntime.jsx("div",{style:VS,children:o("dialogs.pageSetup.title")}),jsxRuntime.jsxs("div",{style:$S,children:[jsxRuntime.jsx("div",{style:$m,children:o("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{style:yi,children:[jsxRuntime.jsx("label",{style:xi,children:o("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{style:Si,value:L,onChange:I=>k(Number(I.target.value)),"aria-label":o("dialogs.pageSetup.sizeLabel"),children:[dc.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:yi,children:[jsxRuntime.jsx("label",{style:xi,children:o("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{style:Si,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:{...$m,marginTop:4},children:o("dialogs.pageSetup.margins")}),F("top",g,u),F("bottom",f,b),F("left",y,P),F("right",h,v),jsxRuntime.jsxs("div",{style:yi,children:[jsxRuntime.jsx("label",{style:xi,children:o("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{style:Si,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:US,children:[jsxRuntime.jsx("button",{type:"button",style:Wm,onClick:t,children:o("common.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...Wm,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 Fr=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 Je(){return nt.useContext(Fr)}function Me(){let{t:e}=Je(),{t}=N();return n=>e?.(n)??t(n)}var YS=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i,XS=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var Ym=new TextEncoder;function JS(e,t){if(Ym.encode(e).length<=t)return e;let n=0,o="";for(let r of e){let i=Ym.encode(r).length;if(n+i>t)break;n+=i,o+=r;}return o}function Xm(e){let t=JS((e??"").replace(/\.docx$/i,"").replace(XS," ").replace(/\s+/g," ").trim().replace(/^[.\s]+/,"").replace(/[.\s]+$/,""),200).trim();return !t||YS.test(t)?"document.docx":`${t}.docx`}function Jm(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 QS="https://github.com/eigenpal/docx-editor/issues/new";function eT(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function Qm(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??eT()}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${t}`,""].join(`
2
- `),i=new URLSearchParams({title:"[Bug] ",body:r});return `${QS}?${i.toString()}`}function Ar(e){typeof window>"u"||window.open(Qm(e),"_blank","noopener,noreferrer");}var uc=6,tf=6;function Ie(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 Or({label:e,labelKey:t,className:n,hidden:o,children:r}){let i=Me();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}=Je(),m=Me();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(Ie,{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 nf(e,t,n,o){return Object.assign(({className:i,hidden:a})=>{let l=Je(),c=Me(),s=o(l);if(a)return null;let d=X(e),m=c(t??d?.labelKey??e);return jsxRuntime.jsx(Ie,{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 mc=nf("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),fc=nf("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave);function iT({className:e,hidden:t}){let n=H(),o=Je(),r=Me(),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(Ie,{slot:"file.pageSetup",icon:Q(s?.paths),disabled:!m,...c?{title:c}:{},onSelect:()=>{o.onPageSetup?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}function lT({className:e,hidden:t}){let n=H(),o=Je(),r=Me(),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(Ie,{slot:"paragraph.dialog",icon:Q(s?.paths),disabled:!m,...c?{title:c}:{},onSelect:()=>{o.onParagraphDialog?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}var sT=Object.assign(lT,{docxSlot:"paragraph.dialog"}),gc=Object.assign(iT,{docxSlot:"file.pageSetup"});function cT({className:e,hidden:t}){let n=jn(),o=Je(),r=Me();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(Ie,{slot:"image.insert",icon:Q(i?.paths),disabled:!l,...c?{title:c}:{},onSelect:()=>{n?.openFilePicker(),o.setOpenMenu(null);},...e?{className:e}:{},children:a})}var bc=Object.assign(cT,{docxSlot:"image.insert"}),Hr=8;function kt({labelKey:e,paths:t,className:n,children:o}){let r=Me(),[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,P=u.offsetHeight,h=b.right+y>f.innerWidth-Hr;p({left:h?Math.max(Hr,b.left-y):Math.min(b.right,f.innerWidth-y-Hr),top:Math.max(Hr,Math.min(b.top-4,f.innerHeight-P-Hr))});},[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 Ci({slot:e="table.insert",className:t}){let n=H(),{isEnabled:o}=le(e),{setOpenMenu:r}=Je(),i=Me(),[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(tf,Math.max(1,f.rows+(u.rows??0))),cols:Math.min(uc,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<=tf;u+=1){let f=[];for(let b=1;b<=uc;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:uc});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 dT({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(Ci,{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 Br({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(Br,{entry:t},n))}):e.slot==="file.open"?jsxRuntime.jsx(mc,{}):e.slot==="file.save"?jsxRuntime.jsx(fc,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(gc,{}):e.slot==="paragraph.dialog"?jsxRuntime.jsx(sT,{}):e.slot==="image.insert"?jsxRuntime.jsx(bc,{}):e.picker==="tableGrid"?jsxRuntime.jsx(dT,{entry:e}):jsxRuntime.jsx(Zt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function rf(e){if(!nt.isValidElement(e))return null;let t=un(e,rf);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 uT(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function pT(e,t,n){return Ka({entries:e??[],children:t,preset:n,keyOfEntry:uT,keyOfChild:rf,renderEntry:o=>jsxRuntime.jsx(Br,{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}=Je(),m=Me(),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),P=c===e;if(i)return null;let h=n??m(t??y?.labelKey??e),v=pT(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":P,"aria-controls":P?p:void 0,className:"docx-menubar__trigger",tabIndex:d===e?0:-1,...P?{"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"&&P&&(x.preventDefault(),S());},onClick:()=>{if(b.current){b.current=false;return}s(P?null:e);},onMouseEnter:()=>{c!==null&&c!==e&&(b.current=true,s(e));},onMouseLeave:()=>{b.current=false;},children:[o?jsxRuntime.jsx("span",{className:"docx-menubar__trigger-icon","aria-hidden":"true",children:o}):null,h]}),P?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 T=Do(w),k=document.activeElement;x.key==="ArrowDown"?(x.preventDefault(),ht(T,k,1)):x.key==="ArrowUp"?(x.preventDefault(),ht(T,k,-1)):x.key==="Home"?(x.preventDefault(),vt(T,"first")):x.key==="End"?(x.preventDefault(),vt(T,"last")):x.key==="Escape"?(x.preventDefault(),x.stopPropagation(),S()):x.key==="Tab"&&s(null);},children:v}):null]})}function hc(e){return Object.assign(n=>jsxRuntime.jsx(to,{id:e,...n}),{docxMenu:e})}var vc=hc("file"),yc=hc("format"),xc=hc("insert");function mT({className:e,hidden:t,onSelect:n}){let{setOpenMenu:o,onReportIssue:r,reportIssue:i}=Je(),a=Me();if(t||i===false)return null;let l=n??r??Ar;return jsxRuntime.jsx(Ie,{slot:"help.reportIssue",onSelect:()=>{l(),o(null);},...e?{className:e}:{},children:a("toolbar.reportIssue")})}var Pi=Object.assign(mT,{docxSlot:"help.reportIssue"});function fT({children:e,...t}){let{reportIssue:n}=Je();return e===void 0&&n===false?null:jsxRuntime.jsxs(to,{id:"help",...t,children:[jsxRuntime.jsx(Pi,{}),e]})}var Sc=Object.assign(fT,{docxMenu:"help"});var hT=e=>e.hiddenReviewAuthors??[];function Ei({className:e,hidden:t}){let n=H(),o=ar(),r=O(hT),i=Me(),{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(Ie,{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(af,{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(af,{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 af(e){return jsxRuntime.jsx(Ie,{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 vT({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(Ei,{className:"docx-menubar__reviewers-submenu"})}),e]})}var wi=Object.assign(vT,{docxMenu:"review"});var ST={file:vc,format:yc,insert:xc,review:wi,help:Sc},TT=new Set(editor.CHROME_MENUS.map(e=>e.id));function ff(e){if(!nt.isValidElement(e))return null;if(e.type===nt.Fragment){let o=nt.Children.toArray(e.props.children).map(ff).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"&&TT.has(n))return n}return null}function CT(e){let t=ot(),{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,P]=nt.useState(null),[h,v]=nt.useState(null),[S,x]=nt.useState(false),[w,T]=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=>Jm(V,Xm(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,he=bn(k.current)??k.current;!re||!he?.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:()=>T(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=ff(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 he=ST[ne.id];return jsxRuntime.jsx(he,{},ne.id)}),$]});}return jsxRuntime.jsxs(Fr.Provider,{value:ae,children:[jsxRuntime.jsx("div",{ref:V=>{if(k.current=V,V&&h===null){let $=ec(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=ec($),re=ne.indexOf(document.activeElement);if(re===-1)return;V.preventDefault();let he=V.key==="ArrowRight"?1:-1,ve=ne[(re+he+ne.length)%ne.length],U=ve?.closest("[data-menu]")?.getAttribute("data-menu");U&&(v(U),ve?.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)&&(P($.name),a?.($),$.arrayBuffer().then(ne=>g.load(new Uint8Array(ne))).catch(ne=>{console.error("[docx-editor] could not open the file",ne);}));}}),jsxRuntime.jsx(Lr,{open:S,onClose:()=>x(false)}),jsxRuntime.jsx(Mo,{open:w,onClose:()=>T(false)})]})}var qr=Object.assign(CT,{Menu:to,File:vc,Format:yc,Insert:xc,Review:wi,Help:Sc,Item:Zt,Row:Ie,Group:Or,Separator:Fo,Submenu:kt,TableGrid:Ci,Entry:Br,Open:mc,Save:fc,PageSetup:gc,ImageInsert:bc,Reviewers:Ei,ReportIssue:Pi});var kT=12240,hf=1440,xf=1440,Sf=567,Ao=20,Cc=6,Ec=Ao+Cc+2,MT="var(--doc-text-muted)",IT="var(--doc-text-subtle)",vf="var(--doc-shadow-subtle)",_T="var(--doc-primary)",DT="var(--doc-primary-hover)",NT="var(--doc-text-subtle)",zr=5,Kr=7,LT={left:0,right:0,firstLine:0};function yf(e,t){return t==="inch"?(e/xf).toFixed(2)+'"':(e/Sf).toFixed(1)+" cm"}function FT(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,P]=nt.useState(null),[h,v]=nt.useState(null),[S,x]=nt.useState(null),[w,T]=nt.useState(null),k=nt.useRef(null),R=e?.pageWidthTwips??kT,_=e?.marginsTwips.left??hf,L=e?.marginsTwips.right??hf,F=e?.gutterTwips??0,I={pageWidth:R,leftMargin:_,rightMargin:L},M=l??LT,E=Ee(R)*t,D=Ee(_)*t,ae=Ee(L)*t,z=nt.useCallback(Z=>{let Re=k.current?.getBoundingClientRect();return Re?Ma((Z-Re.left)/t):null},[t]),V=nt.useCallback((Z,Re,ce)=>{let de=z(Re);if(de===null)return;if(T(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?.(),P(null),x(null),T(null);},[i,d]),ne=nt.useCallback((Z,Re,ce)=>{let de=editor.handlePosition(Z,M,I),We=editor.dragIndent(Z,de+Re*FT(m,ce),M,I,{unit:m,precise:true});s?.(We),d?.();},[M,I,m,s,d]),re=qT(R,t,m),he=a&&c&&s!==void 0,ve=Z=>Ee(editor.handlePosition(Z,M,I))*t,U=(Z,Re,ce)=>({positionPx:ve(Z),editable:he,isDragging:y===Z,isHovered:h===Z,onPointerEnter:()=>v(Z),onPointerLeave:()=>v(null),onPointerDown:de=>{he&&(de.preventDefault(),de.stopPropagation(),de.currentTarget.setPointerCapture(de.pointerId),P(Z));},onPointerMove:de=>{y===Z&&V(Z,de.clientX,de.altKey);},onPointerUp:de=>{y===Z&&(de.currentTarget.releasePointerCapture(de.pointerId),$(Z));},onKeyDown:de=>{he&&(de.key!=="ArrowLeft"&&de.key!=="ArrowRight"||(de.preventDefault(),ne(Z,de.key==="ArrowLeft"?-1:1,de.shiftKey)));},label:b(Re),valueNow:ce,valueText:yf(ce,m),pageWidthTwips:R});return jsxRuntime.jsxs("div",{ref:k,className:`docx-horizontal-ruler ${p}`,style:{position:"relative",width:je(E),height:Ec,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:vf,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),P("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:vf,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),P("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(AT,{tick:Z},Re))}),u?.map(Z=>jsxRuntime.jsx(ZT,{tabMark:Z,positionPx:Ee(Z.position)*t,onDoubleClick:()=>f?.(Z.position)},Z.position)),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tc,{direction:"down",anchor:"top",...U("firstLine","ruler.firstLineIndent",M.firstLine)}),jsxRuntime.jsx(Tc,{direction:"up",anchor:"strip",...U("hanging","ruler.hangingIndent",M.left)}),jsxRuntime.jsx(HT,{...U("left","ruler.leftIndent",M.left)}),jsxRuntime.jsx(Tc,{direction:"up",anchor:"strip",...U("right","ruler.rightIndent",M.right)})]}),y&&S!==null&&w!==null&&jsxRuntime.jsx(OT,{value:yf(S,m),positionPx:w})]})}function AT({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:IT}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:je(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:MT,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Tf(e){return e.editable?e.isDragging||e.isHovered?DT:_T:NT}function Cf(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 Pf(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 Tc({direction:e,anchor:t,...n}){let o=Tf(n),r=t==="top"?{top:0,height:Kr+1}:{top:Ao-Kr,height:Kr};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:Cf(n,zr*2,r),onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,onPointerDown:n.onPointerDown,onPointerMove:n.onPointerMove,onPointerUp:n.onPointerUp,onKeyDown:n.onKeyDown,...Pf(n),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${zr}px solid transparent`,borderRight:`${zr}px solid transparent`,...e==="down"?{top:0,borderTop:`${Kr}px solid ${o}`}:{bottom:0,borderBottom:`${Kr}px solid ${o}`},transition:"border-color 0.1s"}})})}function HT(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:Cf(e,zr*2,{top:Ao+1,height:Cc}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...Pf(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:zr*2-2,height:Cc,backgroundColor:Tf(e),borderRadius:1,transition:"background-color 0.1s"}})})}function OT({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 BT={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function ZT({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:BT[e.alignment]||"L"})}function qT(e,t,n){let o=[];if(n==="inch"){let r=xf/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=Sf/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 VT=15840,Rf=1440,$T=1440,WT=567,xn=20,UT="var(--doc-text-muted)",GT="var(--doc-text-subtle)",jT="var(--doc-primary)",YT="var(--doc-primary)",XT="var(--doc-primary-hover)";function Vr({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??VT,b=e?.marginsTwips.top??Rf,y=e?.marginsTwips.bottom??Rf,P=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=Ma(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 T=QT(f,t,a),k={position:"relative",width:xn,height:je(P),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:T.map((R,_)=>jsxRuntime.jsx(JT,{tick:R},_))}),jsxRuntime.jsx(kf,{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(kf,{type:"bottomMargin",position:P-v,editable:n,isDragging:d==="bottomMargin",isHovered:p==="bottomMargin",onMouseEnter:()=>g("bottomMargin"),onMouseLeave:()=>g(null),onMouseDown:R=>S(R,"bottomMargin")})]})}function JT({tick:e}){let t={position:"absolute",top:je(e.position),right:0,height:1,width:e.width,backgroundColor:GT},n={position:"absolute",top:je(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:UT,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 kf({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:l}){let{t:c}=N(),s=o?XT:r?YT:jT,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 QT(e,t,n){let o=[];if(n==="inch"){let r=$T/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=WT/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 oC=e=>e.formatting?.indent??null,nC=e=>e.editable;function Rc(){let e=H(),t=O(oC),n=O(nC),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 Nf=e=>e.zoom,aC=e=>e.isOpening===true;function Lf(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function Ff(){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 Df(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function iC(){let e=H(),{indent:t,isEnabled:n,apply:o}=Rc(),[r,i]=nt.useState(null),a=nt.useRef(null),l=nt.useRef(null),c=nt.useCallback(m=>{l.current===null&&(l.current=Df(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!==Df(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 lC(){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 _i(e){let t=O(Oo),n=O(aC),{pageSetup:o,isEnabled:r}=No(),i=O(Nf),{pending:a,preview:l,commit:c}=Ff(),s=iC(),d=wo(),m=dn(),p=lC();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:Lf(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 Di(e){let t=O(Oo),{pageSetup:n,isEnabled:o}=No(),r=O(Nf),{pending:i,preview:a,commit:l}=Ff(),c=wo(),s=dn(),d=Ru();return t||d!==null&&d>0&&n&&Ee(n.pageWidthTwips)*r>d-c-s.inlineStart-s.inlineEnd?null:jsxRuntime.jsx(Vr,{pageSetup:Lf(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 cC(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 dC(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 uC(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 pC(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 mC(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 fC(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 gC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function bC(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 hC(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 vC(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 yC(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 xC(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 SC(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 TC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function CC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function PC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function EC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function _c(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 wC(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 RC(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 kC(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 MC(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 IC(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 _C(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 DC(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 NC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function LC(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 FC(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 AC(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 HC(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 OC(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 Af(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function BC(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 ZC(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 qC(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 KC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function zC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function VC(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 $C(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 WC(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 UC(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 GC(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 jC(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 YC(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 XC(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 JC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function QC(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 eP(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 tP(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 oP(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 nP(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 rP(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 aP(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 iP(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 lP(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 sP(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 cP(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 dP(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 uP(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 pP(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 mP(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 fP(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 gP(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 bP(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 hP(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 vP(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 yP(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 xP(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 SP(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 TP(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 CP(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 PP(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 EP(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 wP(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 RP(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 kP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function MP(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 IP(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 _P(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 DP(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 NP(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 LP(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 FP(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 AP(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 HP(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 OP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function BP(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 ZP(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 qP(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 KP(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 zP(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 VP(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 $P(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 WP(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 UP(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 GP(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 jP(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 YP(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 XP(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 JP(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 QP={undo:cC,redo:dC,print:uC,file_download:pC,file_upload:mC,format_bold:fC,format_italic:gC,format_underlined:bC,strikethrough_s:hC,superscript:vC,subscript:yC,link:xC,format_clear:SC,format_align_left:TC,format_align_center:CC,format_align_right:PC,format_align_justify:EC,format_line_spacing:_c,format_list_bulleted:wC,format_list_numbered:RC,format_indent_increase:kC,format_indent_decrease:MC,format_color_text:IC,ink_highlighter:_C,format_color_reset:DC,arrow_drop_down:NC,table:LC,table_chart:FC,grid_on:AC,table_rows:HC,view_column:OC,border_all:Af,select_all:Af,border_outer:BC,border_inner:ZC,border_clear:qC,add:KC,remove:zC,delete:VC,delete_sweep:$C,call_merge:WC,call_split:UC,drag_indicator:GC,image:jC,format_image_left:YC,format_image_right:XC,horizontal_rule:JC,flip_to_back:QC,flip_to_front:eP,open_with:tP,tune:oP,rotate_right:nP,rotate_left:rP,swap_horiz:aP,swap_vert:iP,shapes:lP,format_paint:sP,expand_more:cP,expand_less:dP,border_top:uP,border_bottom:pP,border_left:mP,border_right:fP,border_horizontal:gP,border_vertical:bP,padding:hP,text_rotation_none:vP,wrap_text:yP,height:xP,fit_width:SP,settings:TP,border_color:CP,format_color_fill:PP,vertical_align_top:EP,vertical_align_center:wP,vertical_align_bottom:RP,line_weight:kP,keyboard_arrow_up:MP,keyboard_arrow_down:IP,keyboard_arrow_left:_P,keyboard_arrow_right:DP,more_vert:NP,page_break:LP,branding_watermark:FP,arrow_back:AP,search:HP,toc:OP,done_all:BP,check_circle:ZP,chat_bubble_outline:qP,chat_bubble_check:KP,check:zP,close:VP,add_comment:$P,comment:WP,edit_note:UP,rate_review:GP,visibility:jP,format_textdirection_l_to_r:YP,format_textdirection_r_to_l:XP,"agent-sparkle":JP};function K({name:e,size:t=20,className:n="",style:o}){let r=QP[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 $r=12,Dc=240,Of=16,rE=24,aE=$r+Dc+Of,Sn=12,iE=36,lE=Sn+iE+Of,Wr=nt__namespace.default.memo(function({headings:t,onHeadingClick:n,onClose:o,topOffset:r=0,scrollLeft:i=0,leftOffset:a=$r}){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:Dc,paddingTop:rE,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:c?"translateX(0)":`translateX(-${a+Dc}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 dE=e=>e,uE=Object.freeze([]),pE=()=>{};function Nc(e){let t=H(),n=O(dE),o=nt.useMemo(()=>t&&!n.isLoading?t.getOutline():uE,[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(Wr,{headings:o,onHeadingClick:r,onClose:e.onClose??pE,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var Lc=nt.createContext(null);function ro(e){let t=nt.useContext(Lc);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var Tn=280,Ni=32,Bf=16;function Zo(e=280){return 32+e+16}function Li({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 vE=Object.freeze([]),yE=e=>e;function Fi(){let e=H(),t=O(yE),[n,o]=nt.useState(null),r=nt.useMemo(()=>e&&!t.isLoading?e.getOutline():vE,[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 Hc=150,Oc=2e3,Ac=Object.freeze([]),TE=e=>e;function Ai(){let e=H(),t=O(TE),[n,o]=nt.useState(""),[r,i]=nt.useState(""),[a,l]=nt.useState(false),[c,s]=nt.useState(false),[d,m]=nt.useState(Ac),[p,g]=nt.useState(-1);nt.useEffect(()=>{if(n===r)return;let x=setTimeout(()=>i(n),Hc);return ()=>clearTimeout(x)},[n,r]);let u=nt.useMemo(()=>({matchCase:a,wholeWord:c}),[a,c]);nt.useEffect(()=>{if(!e||r.length===0){m(Ac),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 T=((p<0?x>0?-1:0:p)+x+d.length)%d.length;b(T);},[p,b,d.length]),P=nt.useCallback(()=>y(1),[y]),h=nt.useCallback(()=>y(-1),[y]),v=nt.useCallback(x=>o(x),[]),S=nt.useCallback(()=>{o(""),i(""),m(Ac),g(-1);},[]);return {query:n,setQuery:v,matchCase:a,setMatchCase:l,wholeWord:c,setWholeWord:s,matches:d,truncated:d.length>=Oc,activeIndex:p,goTo:b,next:P,previous:h,clear:S,isPending:n!==r}}var kE=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)}},ME=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Hi(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(),P=At(),h=nt.useContext(mt),{pageSetup:v,zoom:S,reviewPaneOpen:x,fitting:w}=O(kE,ME),[T,k]=nt.useState(0),[R,_]=nt.useState(0),[L,F]=nt.useState(0);nt.useEffect(()=>{if(!P){k(0),_(0),F(0);return}let D=()=>{k(P.clientWidth);let z=getComputedStyle(P),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(P),()=>ae.disconnect()},[P,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:Li({viewportWidth:T,pageWidthPx:Ee(M)*S,reservation:Zo(o),inlineEndReservation:R,inlineStartReservation:L,docked:w}),[c,M,S,T,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 Gr=["headings","find"],It=(...e)=>e.filter(Boolean).join(" ");function jr({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(Yr,{}),jsxRuntime.jsx(Xr,{})]})})}function Yr({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 Xr({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 Jr({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=Gr.indexOf(o.tab);o.setTab(Gr[(c+l+Gr.length)%Gr.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??Gr.map(a=>jsxRuntime.jsx(Qr,{value:a},a))})}function Qr({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 qf({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 ea({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(qf,{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 NE({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 ta({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(qf,{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(NE,{match:c,active:s===o.activeIndex,onSelect:()=>o.goTo(s)},`${c.blockId}-${c.start}-${s}`))})]})}function oa({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 qc(e){let t=ot(),{t:n,toggle:o=true,className:r,style:i,children:a,...l}=e,c=Hi(l),s=Fi(),d=Ai(),{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(Lc.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(oa,{...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(jr,{}),jsxRuntime.jsx(Jr,{}),jsxRuntime.jsx(ea,{}),jsxRuntime.jsx(ta,{})]})})]})})}var Oi=Object.assign(qc,{Header:jr,Close:Yr,Title:Xr,Tabs:Jr,Tab:Qr,Headings:ea,Find:ta,Toggle:oa});var ZE=600,qE=e=>e.page.total,Bi=nt.createContext(null);function Zi({className:e,style:t}){let n=ot(),o=H(),r=At(),i=O(qE),{t:a}=N(),l=nt.useContext(Bi),[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),ZE);};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 VE=[],$E=e=>e.fontSubstitutions??VE;function qi({className:e,style:t,t:n}){let o=O($E),{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 Qe={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function Kc(e){return Math.round(e/1440*100)/100}function $f(e){return Math.round(e*1440)}function GE(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 zc(){let e=H(),t=nt.useCallback(n=>e?.getHeaderFooterState()??null,[e]);return O(t,GE)}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 na(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,P=t==="story-label"?6:4,h=l===c,v=t==="after"?b.bottom+6:b.top-y-P,S=h?En(c,b.left,v):{left:b.left,top:v},x=S.left,w=S.top,T=h?c.scrollLeft+8:8;a({position:h?"absolute":"fixed",left:t==="story-label"?x:Math.max(T,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 QE(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 e1=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function ra(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 t1(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(Kc(t.headerDistanceTwips))),m(String(Kc(t.footerDistanceTwips)))));},[i,t.headerDistanceTwips,t.footerDistanceTwips]),nt.useEffect(()=>{if(!i)return;let w=T=>{l.current?.contains(T.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=ra(p),P=ra(g),h=ra(u),v=ra(f),S=ra(b),x=(w,T)=>{if(!r)return;let k=Number.parseFloat(T);Number.isFinite(k)&&r.exec({type:"setHeaderFooterOptions",[w]:$f(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:[e1.map(w=>{let T={type:"insertPageField",field:w.field},k=r?.can(T);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(T),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:!P.enabled,title:P.reason??void 0,onChange:()=>r?.exec(g)}),jsxRuntime.jsxs("span",{children:[o("headerFooter.differentOddEven"),jsxRuntime.jsx("span",{className:"docx-hf-chrome__menu-hint",children:o("headerFooter.differentOddEvenHint")})]})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),t.inherited?jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!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 Ki({className:e}){let{t}=N(),n=zc(),o=nt.useCallback(l=>l.querySelector("[data-docx-hf-active]"),[]),r=na(o,"story-label"),i=B;if(!n?.editing)return null;let a=QE(n.editing,n.variant);return jsxRuntime.jsxs("div",{ref:r.ref,className:`docx-context-bar docx-hf-chrome${e?` ${e}`:""}`,role:"region","aria-label":t("headerFooter.chromeAriaLabel"),"data-testid":"docx-hf-chrome",onMouseDown:i,style:{...r.style,zIndex:Qe.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(a)}),n.inherited?jsxRuntime.jsx("span",{className:"docx-context-bar__status","data-testid":"docx-hf-inherited",title:t("headerFooter.sameAsPreviousHint"),children:t("headerFooter.sameAsPrevious")}):null]}),jsxRuntime.jsx(t1,{state:n,onMouseDown:i})]})}function zo(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var zi=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"})}),s1="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",c1="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",d1="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",u1="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 p1({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 P=a.current;P&&y.target instanceof Node&&P.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:P,top:h}=En(y,f.left,f.top),v=Math.max(0,y.scrollWidth-b.offsetWidth);d({left:Math.max(0,Math.min(P,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(m1,{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 m1({children:e}){let{state:t}=_t(),n=nt.useMemo(()=>f1(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(Yc,{})),o("Error",jsxRuntime.jsx(Jc,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Apply",jsxRuntime.jsx(Xc,{})),o("Cancel",jsxRuntime.jsx(Qc,{}))]}),n.__extra]});let r=t.canEdit&&!(t.link&&Qn(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Url",jsxRuntime.jsx(Wc,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Copy",jsxRuntime.jsx(Uc,{})),r?o("Edit",jsxRuntime.jsx(Gc,{})):null,r?o("Unlink",jsxRuntime.jsx(jc,{})):null]}),n.__extra]})}function f1(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)??g1}var g1={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 Wc({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,zi(u1)]})}Wc.docxHyperLinkPart="Url";function Uc({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??zi(s1)})}Uc.docxHyperLinkPart="Copy";function Gc({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??zi(c1)})}Gc.docxHyperLinkPart="Edit";function jc({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??zi(d1)})}jc.docxHyperLinkPart="Unlink";function Yc({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})]})}Yc.docxHyperLinkPart="Fields";function Xc({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 Jc({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")})}Jc.docxHyperLinkPart="Error";Xc.docxHyperLinkPart="Apply";function Qc({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})}Qc.docxHyperLinkPart="Cancel";var Vi=Object.assign(p1,{Url:Wc,Copy:Uc,Edit:Gc,Unlink:jc,Fields:Yc,Error:Jc,Apply:Xc,Cancel:Qc});var y1=e=>e;function rd(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function $i(){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(y1),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=T=>{T.key==="Escape"&&(T.preventDefault(),f(true));},w=T=>{T.target instanceof S.Node&&h.contains(T.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 P=[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:rd,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":P||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:rd,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:rd,onClick:y,children:t("equationPopup.delete")})]})]})}function x1(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 ad(){let e=H(),t=nt.useCallback(o=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),n=O(t,x1);return n?.kind==="note"?n:null}function Qf(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 eg(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&&Qf(e.documentAuthored,t.documentAuthored)&&Qf(e.sectionAuthored,t.sectionAuthored)}function S1(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&eg(e.footnote,t.footnote)&&eg(e.endnote,t.endnote)}function id(){let e=H(),t=nt.useCallback(n=>e?.getNotePropertiesState()??null,[e]);return O(t,S1)}var T1=/^(footnote|endnote):(-?\d{1,10})$/;function og(e){let t=T1.exec(e);if(!t)return null;let n=Number(t[2]);return Number.isInteger(n)?{noteKind:t[1],noteId:n}:null}function C1(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function sd(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 P1(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 Wi({className:e}){let{t}=N(),n=H(),o=ad(),[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=na(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(C1())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?og(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]),P=nt.useMemo(()=>f?{type:"convertAllNotes",fromKind:f.noteKind}:null,[f]),h=sd(b??{type:"deleteNote",noteKind:"footnote",noteId:0}),v=sd(y??{type:"convertNote",fromKind:"footnote",noteId:0}),S=sd(P??{type:"convertAllNotes",fromKind:"footnote"}),x=nt.useMemo(()=>({position:"fixed",left:r?.x??0,top:r?.y??0,zIndex:Qe.popover,maxWidth:280,maxHeight:"40vh",overflowY:"auto",padding:"8px 10px",background:"var(--doc-popover-bg, #fff)",color:"var(--doc-popover-fg, #111)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",fontSize:12,lineHeight:1.4,pointerEvents:"none"}),[r]),w=o?og(o.id):null,T=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:Qe.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:T}),jsxRuntime.jsx(P1,{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:Qe.popover,minWidth:160,background:"var(--doc-popover-bg, #fff)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",padding:4},onMouseDown: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:()=>P&&u(P),children:f.noteKind==="footnote"?t("notes.convertAllFootnotes"):t("notes.convertAllEndnotes")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",onClick:()=>s(true),children:t("dialogs.footnoteProperties.title")})]}):null,c?jsxRuntime.jsx(E1,{onClose:()=>s(false),onApply:k=>{u(k),s(false);}}):null]}):null}function E1(e){let{t}=N(),n=H(),o=id(),[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 P=!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:Qe.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")}),P?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:a,onChange: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 Ui=nt.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function ao(){return nt.useContext(Ui)}function ag(){return nt.useContext(Ui).target}var ig=["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"],lg=["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"],dd=["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"],sg=["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"],cg=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],dg=["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"],ug=["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=Me(),{isEnabled:p,disabledReason:g}=le(t);return c?null:jsxRuntime.jsx(Ie,{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 ia=kn("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:ig}),la=kn("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:lg}),sa=kn("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:sg}),ca=kn("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:ug});function Mn({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let i=H(),{close:a,clipboardRefusal:l,reportClipboardRefusal:c}=ao(),s=Me(),d=nt.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:m,disabledReason:p}=le(d);if(r)return null;let g=l!==null;return jsxRuntime.jsx(Ie,{slot:"edit.paste",icon:e??Q(dd),shortcut:s(n??"contextMenu.pasteShortcut"),disabled:!m||g,...l??p?{title:l??p??""}:{},onSelect:()=>{(async()=>{try{let{text:u,html:f}=await k1();(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 k1(){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=Me(),d=nt.useMemo(()=>({type:"pasteWithoutFormatting",text:" "}),[]),{isEnabled:m,disabledReason:p}=le(d);if(r)return null;let g=l!==null;return jsxRuntime.jsx(Ie,{slot:"edit.pasteWithoutFormatting",icon:e??Q(dd),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 pg=X("format.painter")?.paths??[],Gi=kn("format.copyFormatting",{type:"copyFormatting"},{labelKey:"contextMenu.copyFormatting",shortcutKey:"contextMenu.copyFormattingShortcut",paths:pg}),ji=kn("format.pasteFormatting",{type:"pasteFormatting"},{labelKey:"contextMenu.pasteFormatting",shortcutKey:"contextMenu.pasteFormattingShortcut",paths:pg});function Vo(e,t,n){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l,destructive:c})=>{let{close:s}=ao(),d=Me(),m=Yi(),{isEnabled:p,disabledReason:g,execute:u}=le(t);return l||!m?null:jsxRuntime.jsx(Ie,{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}),M1=[{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=Me(),o=Yi(),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:M1.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 mg(e,t,n){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l})=>{let c=H(),{close:s,tocId:d}=ao(),m=Me(),p=nt.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:g,disabledReason:u}=le(p);return l||d===null?null:jsxRuntime.jsx(Ie,{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=mg("toc.refresh","entire",{labelKey:"toc.refresh",paths:cg}),Bn=mg("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:dg});function Yi(){return O(nt.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function Xi({label:e,icon:t,shortcut:n,disabled:o,disabledReason:r,active:i,onSelect:a,className:l}){let{close:c}=ao();return jsxRuntime.jsx(Ie,{...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 el=8,N1=e=>e.editingMode==="viewing";function L1(){let e=H(),t=nt.useContext(mt),n=Je(),o=Me(),r=e?.can({type:"toggleReviewPane"}),i=O(N1),a=!r?.ok||i||(t?.mounted??0)===0||e?.getSelectionPlacement()===null,l=X("review.comments");return jsxRuntime.jsx(Ie,{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")})}function F1(){let e=H(),t=Je(),n=Me();return e?.can({type:"editTextFormField"}).ok?jsxRuntime.jsx(Ie,{slot:"field.edit",onSelect:()=>{t.setOpenMenu(null),e.exec({type:"editTextFormField"});},children:n("textFormField.edit")}):null}var A1=[{kind:"row",id:"field.edit",render:()=>jsxRuntime.jsx(F1,{})},{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(ia,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(la,{})},{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(Gi,{})},{kind:"row",id:"format.pasteFormatting",render:()=>jsxRuntime.jsx(ji,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(sa,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(ca,{})},{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(L1,{})}];function H1(){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 O1(){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 B1(e,t=false){return [...A1,...e?H1():[],...t?O1():[]]}function vg(e){if(!nt.isValidElement(e))return null;let t=un(e,vg);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 bg(e){if(!nt.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function Z1(e){return e?.closest(".docx-editor__scroll-container")??null}function ua({className:e,t,preset:n=true,disabled:o,onOpenChange:r,children:i}){let a=ot(),l=H(),{t:c}=N(),s=Yi(),d=nt.useRef(null),m=nt.useRef(null),[p,g]=nt.useState(null),[u,f]=nt.useState(null),[b,y]=nt.useState(null),P=nt.useMemo(()=>B1(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=Z1(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-el,D=window.innerHeight-M-el,ae=Math.max(el,p.x>E?p.x-I:p.x),z=Math.max(el,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 T=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(Fr.Provider,{value:T,children:jsxRuntime.jsx(Ui.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(bg),Ka({entries:P,children:nt.Children.toArray(i).filter(F=>!bg(F)),preset:n,keyOfEntry:F=>F.id,keyOfChild:vg,renderEntry:F=>F.kind==="separator"?jsxRuntime.jsx(Fo,{}):F.render()})]})})}):null})}var md=Object.assign(ua,{Cut:ia,Copy:la,Paste:Mn,PasteWithoutFormatting:In,Delete:sa,SelectAll:ca,InsertRowAbove:_n,InsertRowBelow:Dn,InsertColumnLeft:Nn,InsertColumnRight:Ln,DeleteTableRow:Fn,DeleteTableColumn:An,DeleteTable:Hn,CellVerticalAlignment:$o,RefreshToc:On,RefreshTocPageNumbers:Bn,Item:Xi,Slot:Zt,Row:Ie,Group:Or,Separator:Fo,Submenu:kt});function fd(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var xg=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"})}),V1="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",$1="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",W1={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},U1={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},G1={color:"var(--doc-text-muted)",flexShrink:0},j1={textAlign:"right",wordBreak:"break-word"},Y1={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},X1={display:"flex",gap:8,marginTop:4},Sg={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 J1(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 Q1(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:U1,"data-testid":n,children:[jsxRuntime.jsx("span",{style:G1,children:e}),jsxRuntime.jsx("span",{style:j1,children:t})]})}function e2({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 P=a.current;P&&y.target instanceof Node&&P.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(Tg,{}),jsxRuntime.jsx(Cg,{}),jsxRuntime.jsx("div",{style:X1,children:jsxRuntime.jsx(Pg,{})}),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:W1,onMouseDown:f=>{fd(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 Tg({className:e,asChild:t,hidden:n,children:o}){let{closeInspector:r}=Et(),{t:i}=N();if(n)return null;let a={style:Y1,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:{...Sg,padding:4,border:"none",background:"transparent"},onMouseDown:fd,onClick:()=>r(),children:xg(V1)})]});return t?jsxRuntime.jsx(j,{...a,children:l}):jsxRuntime.jsx("div",{...a,children:l})}function Cg({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(J1(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(Zn,{label:i("contentControl.inspectorPanel.lock"),value:i(Q1(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 Pg({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:Sg,onMouseDown:fd,onClick:()=>{l().ok&&c();}},p=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o??r??xg($1),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(j,{...m,children:p}):jsxRuntime.jsx("button",{...m,children:p})}var tl=Object.assign(e2,{Header:Tg,Fields:Cg,Remove:Pg});var r2={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},a2={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},i2={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},l2={flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",scrollbarGutter:"stable both-edges",backgroundColor:"var(--doc-bg)"},s2={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},c2={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)"},d2={padding:"8px 12px"},u2={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},p2={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},m2={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function f2({forwardedRef:e}){let t=H(),n=nt.useRef(null);return n.current=t,_u({ref:e,editorRef:n}),null}var g2=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:P,onReady:h,onChange:v,onFontError:S,onOpen:x,onSave:w,hyperlinkPopup:T,contextMenu:k=true,menu:R=true,navigation:_=true,rulers:L=true}=t,[F,I]=nt.useState(zd);nt.useEffect(()=>{if(p==="system")return $d(I)},[p]);let M=Vd(p,F),{t:E}=N(),D=nt.useCallback(($,ne)=>a?a($,ne):E($,ne),[a,E]),ae=jsxRuntime.jsxs(Aa,{className:l?M?"dark":void 0:i,style:l?a2:void 0,children:[l?jsxRuntime.jsx(Ki,{}):null,l?jsxRuntime.jsx(Wi,{}):null,jsxRuntime.jsx(ka,{}),jsxRuntime.jsx(Vi,{hidden:T===false}),jsxRuntime.jsx($i,{}),k===false?null:jsxRuntime.jsx(ua,{t:D,...typeof k=="object"?k:{}}),jsxRuntime.jsx(tl,{}),L&&l?jsxRuntime.jsx("div",{style:s2,"aria-hidden":"true",children:jsxRuntime.jsx(Di,{})}):null,t.children]}),z=l?jsxRuntime.jsxs("div",{className:`docx-editor${M?" dark":""}${i?` ${i}`:""}`,style:r2,children:[jsxRuntime.jsxs("div",{style:c2,children:[jsxRuntime.jsxs("div",{style:u2,children:[d?.(),jsxRuntime.jsxs("div",{style:p2,children:[s?jsxRuntime.jsx("input",{"aria-label":D("titleBar.documentNameAriaLabel"),value:c??"",placeholder:D("titleBar.untitled"),onChange:$=>s($.target.value),style:m2}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??D("titleBar.untitled")}),R!==false?jsxRuntime.jsx(qr,{t:D,...c!==void 0?{fileName:c}:{},...x?{onOpen:x}:{},...w?{onSave:w}:{},...typeof R=="object"?R:{}}):null]}),m?.()]}),jsxRuntime.jsx("div",{style:d2,children:jsxRuntime.jsx(Nr,{t:D})})]}),L?jsxRuntime.jsx("div",{style:l2,"data-testid":"docx-editor-ruler-row",children:jsxRuntime.jsx(_i,{})}):null,jsxRuntime.jsx(qi,{t:D}),jsxRuntime.jsxs("div",{style:i2,children:[_?jsxRuntime.jsx(Oi,{t:D}):null,ae,jsxRuntime.jsx(Bi.Provider,{value:D,children:jsxRuntime.jsx(Zi,{})}),jsxRuntime.jsx(Ia,{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}:{},...P!==void 0?{zoomMode:P}:{},tableInteractionLabel:V,...h?{onReady:h}:{},...v?{onChange:v}:{},...S?{onFontError:S}:{},children:[jsxRuntime.jsx(f2,{forwardedRef:n}),jsxRuntime.jsx(ko.Provider,{value:l,children:z})]})}),b2=nt.forwardRef(function(t,n){return jsxRuntime.jsx(nn,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(g2,{...t,ref:n})})}),h2=Object.assign(b2,{Root:or,Viewport:Aa,Content:ka,Toolbar:Nr,Menu:qr,Loading:Ia,ColorByChangeType:Vl,AuthorStyle:$l,HorizontalRuler:_i,VerticalRuler:Di,DocumentOutline:Nc,Navigation:Oi,PageSetupDialog:Lr,ParagraphDialog:Mo,PageNumber:Zi,FontNotice:qi,HeaderFooterChrome:Ki,NotesChrome:Wi,Equation:$i,HyperLink:Vi,ContextMenu:md,ContentControl:tl});function T2(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function gd(e){return Array.isArray(e)?e:[e]}function C2(e){if(typeof e!="function"||editor.isFontResolver(e))return e;let t=e;return editor.defineFontResolver(async()=>t())}function kg(e){return e!==void 0&&gd(e).some(t=>editor.isFontResolver(t))}async function P2(e){return typeof e!="function"?await e:await e()}function E2(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=kg(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(gd(u.current.fonts??[]).map(C2),b)),[]);return nt.useEffect(()=>{let b=u.current.fonts;if(b===void 0){i(void 0),g(true);return}if(kg(b)){g(true);return}g(false);let y=true;return (async()=>{try{let P=await Promise.allSettled(gd(b).map(P2)),h=[];for(let v of P){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(P){console.warn("[fonts] font loading failed; the fixed measurer stays in effect",P);}finally{y&&g(true);}})(),()=>{y=false;}},[m]),nt.useEffect(()=>{if(e==null){o(void 0),l(null),s(false);return}let b=T2(e);if(b){o(b),l(null),s(false);return}let y=true,P=new AbortController;return s(true),l(null),(async()=>{try{let h=await fetch(String(e),{...u.current.fetchOptions,signal:P.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,P.abort();}},[e]),{document:p?n:void 0,fonts:d?f:r,error:a,isLoading:c||!p}}function I2(...e){let t=nt.useRef(e);return t.current=e,nt.useMemo(()=>editor.defineFontResolver(n=>editor.composeFontOrigins(t.current,n)),[])}function N2(e){let n=e?.surface?.state?.().selection?.head;return n&&typeof n.paragraphId=="string"&&Number.isFinite(n.offset)?n:null}function L2(){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=N2(e),i=t.current;return (r===null?i===null:i!==null&&F2(i,r))?i:(t.current=r,r)},[e]);return nt.useSyncExternalStore(n,o,()=>null)}function F2(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}function bd({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:()=>s.current?.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 fa=nt.createContext(null);function Dg(){let e=nt.useContext(fa);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function V2(e){return "type"in e&&e.type==="separator"}var Fg={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"},$2={...Fg,background:"var(--doc-bg-hover)"},Ag={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"},W2={...Ag,opacity:.4,cursor:"default"},U2={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},G2={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},j2={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 ga({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 P=y.target;c.current&&!c.current.contains(P)&&s.current&&!s.current.contains(P)&&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?$2:Fg,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(V2(u))return jsxRuntime.jsx("div",{style:U2},`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,P=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?W2:Ag,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:G2,children:b.shortcut}),y&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(K,{name:"keyboard_arrow_right",size:16})})]}),y&&P&&jsxRuntime.jsx("div",{style:j2,onMouseDown:h=>h.preventDefault(),children:b.submenuContent(p)})]},b.label)})})]})}var yd=18,X2=2,Og={width:yd,height:yd,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},J2={...Og,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},Q2={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function Bg({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?J2:Og,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:X2,gridTemplateColumns:`repeat(${n}, ${yd}px)`},onMouseLeave:()=>{r(0),a(0);},role:"grid","aria-label":"Table size selector",children:c}),jsxRuntime.jsx("div",{style:Q2,children:s})]})}function nw({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 rw(){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 rl({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function aw(e){return e.replace(/\.docx$/i,"")}function Sd({value:e,onChange:t,placeholder:n,editable:o=true}){let{t:r}=N(),i=n??r("titleBar.untitled"),a=aw(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 al({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function il(){let{t:e}=N(),t=Dg(),{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,P=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(ga,{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(ga,{label:e("toolbar.format"),disabled:n,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>P("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>P("setRtl")}]}),jsxRuntime.jsx(ga,{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(Bg,{onInsert:(w,T)=>{h(w,T),x();}})}]:[],...c||d&&s?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:x=>jsxRuntime.jsx(nw,{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(ga,{label:e("toolbar.help"),disabled:n,items:[{label:e("toolbar.reportIssue"),onClick:()=>Ar()}]})]})}function Td({children:e}){let t=null,n=null,o=[],r=[];nt.Children.forEach(e,a=>{nt.isValidElement(a)&&(a.type===rl?t=a:a.type===al?n=a:a.type===il?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(rw,{})}),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 ll={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},cw={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:""},Zg={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 dw(e,t){let n=Zg[t]??Zg[t.toLowerCase()]??t,r=e?.colorScheme?.[n];return typeof r=="string"&&r?r:ll[n]??"000000"}function qg(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 Cd(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex")return `#${qg(e.value)??n}`;let o=Object.entries(t?.colorScheme??ll).map(([i,a])=>({slot:i,hex:String(a)})),r=editor.resolveThemeColorHex(e,o);return `#${r.ok?r.hex:dw(t,e.slot)}`}function zt(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?qg(e.value):Cd(e,t).slice(1)}function Kg(e){if(!e||e==="none")return "";let t=cw[e];return t?`#${t}`:""}var uw=[{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"}],pw=[{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 zg(e){let t=e??ll;return pw.map(n=>uw.map(o=>{let r=t[o.slot]??ll[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 gw=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(gw({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=xe__namespace.Root,so=xe__namespace.Group,sl=xe__namespace.Value;function co({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(xe__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(xe__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(xw,{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(xe__namespace.Portal,{children:jsxRuntime.jsx("div",{className:te("docx-editor",i&&"dark"),children:jsxRuntime.jsx(xe__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(xe__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(xe__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(xe__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(xe__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(xe__namespace.ItemIndicator,{children:jsxRuntime.jsx(Sw,{className:"h-4 w-4"})})})]})}function Go({className:e,...t}){return jsxRuntime.jsx(xe__namespace.Separator,{className:te("-mx-1 my-1 h-px bg-muted",e),...t})}function xw({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 Sw({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 Pd(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 Tw=[{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 Wg({value:e,onChange:t,fonts:n=Tw,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()||Pd(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?.(Pd(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(sl,{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 Ed(e){if(e===void 0)return;let t=e.map(n=>typeof n=="string"?{name:n,fontFamily:n,category:"other"}:n);return t}function ww(e,t,n,o){let i=Math.max(8,window.innerWidth-n-8),a=Math.max(8,window.innerHeight-o-8);return {top:Math.min(Math.max(8,e),a),left:Math.min(Math.max(8,t),i)}}function et({isOpen:e,onClose:t,align:n="left"}){let o=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=ww(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 Mw=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Iw=1,_w=400;function jg(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Yg(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 Xg({value:e,onChange:t,sizes:n=Mw,disabled:o=false,className:r,placeholder:i="11",minSize:a=Iw,maxSize:l=_w}){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:P,dropdownStyle:h}=et({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=Yg(v,n,a);t?.(M);},[v,n,a,o,t]),w=nt.useCallback(I=>{if(I.preventDefault(),o)return;let M=jg(v,n,l);t?.(M);},[v,n,l,o,t]),T=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=jg(v,n,l);p(M.toString()),t?.(M);}else if(I.key==="ArrowDown"){I.preventDefault();let M=Yg(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:T,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:P,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 Lw=[{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"}],dl=18,Fw=2,Aw={position:"relative",display:"inline-block"},Hw={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)"},Ow={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},kd={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},Md={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},e0={display:"grid",gap:`${Fw}px`},ul={width:`${dl}px`,height:`${dl}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},t0={...ul,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},o0={...ul,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},Bw={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)"},Zw={display:"flex",alignItems:"center",gap:"6px"},qw={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},Kw={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},Jg={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},zw={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},Vw={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)"},$w={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 Id(e,t,n){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let o=Kg(e);return o||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return Cd(e,n)}function Qg(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 n0(e,t,n){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():zt(e,n))===t.toUpperCase():false}function Ww({matrix:e,selectedColor:t,theme:n,onSelect:o}){let[r,i]=nt.useState(null);return jsxRuntime.jsx("div",{style:{...e0,gridTemplateColumns:`repeat(10, ${dl}px)`},children:e.flatMap((a,l)=>a.map((c,s)=>{let d=`${l}-${s}`,m=r===d,p=n0(t,c.hex,n);return jsxRuntime.jsx("button",{type:"button",style:{...p?o0:m?t0:ul,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 Uw({selectedColor:e,theme:t,onSelect:n}){let[o,r]=nt.useState(null),{t:i}=N();return jsxRuntime.jsx("div",{style:{...e0,gridTemplateColumns:`repeat(10, ${dl}px)`},children:Lw.map((a,l)=>{let c=o===l,s=n0(e,a.hex,t),d=i(a.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...s?o0:c?t0:ul,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),[P,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:T}=N();nt.useEffect(()=>{let U=Id(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}=et({isOpen:p,onClose:k}),F=o?.colorScheme??null,I=nt.useMemo(()=>zg(F),[F]),M=nt.useMemo(()=>Id(t,e,o),[t,e,o]),E=nt.useMemo(()=>Id(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={...Hw,...r?{cursor:"default",opacity:.38}:p?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:u?{backgroundColor:"var(--doc-bg-hover)"}:{}},he=T(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),ve=c??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:R,className:`docx-color-picker ${i||""}`,style:{...Aw,...a},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...zw,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...Vw,...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||he,"aria-label":l||he,children:[jsxRuntime.jsx(K,{name:ve,size:18}),jsxRuntime.jsx("div",{style:{...Jg,backgroundColor:E==="transparent"?"#fff":E,outline:E==="transparent"||Qg(E)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...$w,...r?{cursor:"default"}:p?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:P?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:D,onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),disabled:r,title:l||he,"aria-label":l||he,"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||he,"aria-label":l||he,"aria-haspopup":"true","aria-expanded":p,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(K,{name:ve,size:18}),jsxRuntime.jsx("div",{style:{...Jg,backgroundColor:M==="transparent"?"#fff":M,outline:M==="transparent"||Qg(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,...Ow},role:"dialog","aria-label":`${he} picker`,onMouseDown:U=>{U.target.tagName!=="INPUT"&&U.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:Bw,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??T(e==="highlight"?"colorPicker.noColor":"colorPicker.automatic")]}),jsxRuntime.jsx("div",{style:Md}),jsxRuntime.jsx("div",{style:kd,children:T("colorPicker.themeColors")}),jsxRuntime.jsx(Ww,{matrix:I,selectedColor:t,theme:o,onSelect:ae}),jsxRuntime.jsx("div",{style:Md}),jsxRuntime.jsx("div",{style:kd,children:T("colorPicker.standardColors")}),jsxRuntime.jsx(Uw,{selectedColor:t,theme:o,onSelect:z}),jsxRuntime.jsx("div",{style:Md}),jsxRuntime.jsx("div",{style:kd,children:T("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:Zw,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:qw,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:{...Kw,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:T("common.apply")})]})]})})]})}var ha=20,_d=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_left",size:ha}),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:ha}),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:ha}),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:ha}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function i0({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}=et({isOpen:r,onClose:a}),m=nt.useCallback(y=>{n||t?.(y),i(false);},[n,t]),p=_d.find(y=>y.value===e)||_d[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:ha}),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:_d.map(y=>{let P=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:P?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:P?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:S=>S.preventDefault(),onMouseEnter:S=>{P||(S.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=P?"var(--doc-primary-light)":"transparent";},onClick:()=>m(y.value),children:jsxRuntime.jsx(K,{name:y.iconName,size:18})},y.value)})})})]})}function pl(){return {type:"none",level:0,isInList:false}}var Jw={display:"inline-flex",alignItems:"center",gap:"4px"},l0={display:"inline-flex",alignItems:"center",gap:"4px"},bl={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)"},Qw={...bl,backgroundColor:"var(--doc-bg-hover)"},e8={...bl,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},t8={...bl,cursor:"default",opacity:.38},o8={width:"28px",height:"28px",padding:"2px"},n8={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},ml=20;function fl({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,style:a}){let[l,c]=nt.useState(false),s={...t?t8:e?e8:l?Qw:bl,...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 s0({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?{...o8}:{},[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:{...Jw,...l},role:"group","aria-label":m("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:l0,role:"group","aria-label":m("lists.typeAriaLabel"),children:[jsxRuntime.jsx(fl,{active:g,disabled:i,title:m("lists.bulletList"),onClick:t,style:p(),children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:ml})}),jsxRuntime.jsx(fl,{active:u,disabled:i,title:m("lists.numberedList"),onClick:n,style:p(),children:jsxRuntime.jsx(K,{name:"format_list_numbered",size:ml})})]}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:n8,role:"separator"}),jsxRuntime.jsxs("div",{style:l0,role:"group","aria-label":m("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(fl,{active:false,disabled:i||!b,title:m("lists.decreaseIndent"),onClick:r,style:p(),children:jsxRuntime.jsx(K,{name:"format_indent_decrease",size:ml})}),jsxRuntime.jsx(fl,{active:false,disabled:i,title:m("lists.increaseIndent"),onClick:o,style:p(),children:jsxRuntime.jsx(K,{name:"format_indent_increase",size:ml})})]})]})]})}var a8=[{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 d0({value:e,onChange:t,options:n=a8,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(_c,{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 u0=[{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 p0({value:e,onChange:t,styles:n,disabled:o=false,className:r,width:i=120}){let{t:a}=N(),l=nt__namespace.useMemo(()=>{let g=sm(n);return g.length===0?u0:g.map(u=>({...u,type:"paragraph",nameKey:u0.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:lm(g),children:s(g)})},g.styleId))})]})}var l8=[{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 f0({value:e=1,onChange:t,levels:n=l8,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(sl,{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 c8=[{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 h0({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}=et({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:c8.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 v0({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 m8=[{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 x0({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}=et({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:m8.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 T0({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 g8={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"},E0={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function w0({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}=et({isOpen:r,onClose:c,align:"right"}),g=n?.table?.attrs?.justification??"left",u=nt.useCallback(y=>{e(y),i(false);},[e]),f=(y,P,h,v,S)=>{let x=t||S?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...g8,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:P,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:E0,children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(y=>{let P={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:o({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[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:P[y],size:16})},y)})}),jsxRuntime.jsx("div",{style:en,role:"separator"}),jsxRuntime.jsx("div",{style:E0,children:o("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(y=>{let P={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:P[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 h8=20;function yl({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}=et({isOpen:s,onClose:m}),b=nt.useCallback(P=>{i||r(P),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(P=>!P),disabled:i,"aria-label":a??o,"aria-expanded":s,"aria-haspopup":"true","data-testid":l,children:[jsxRuntime.jsx(K,{name:n,size:h8}),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:P=>P.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:c?"column":"row",gap:c?1:2,minWidth:c?200:void 0},children:e.map(P=>{let h=t===P.value;return jsxRuntime.jsxs("button",{type:"button",title:P.label,"data-testid":l?`${l}-${P.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor: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(P.value),children:[jsxRuntime.jsx(K,{name:P.iconName,size:18}),c&&jsxRuntime.jsx("span",{style:{flex:1},children:P.label})]},P.value)})})})]})}var v8=[{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 y8(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function k0({imageContext:e,onChange:t,disabled:n=false}){let{t:o}=N(),r=v8.map(l=>({...l,label:o(l.labelKey)})),i=y8(e),a=r.find(l=>l.value===i)||r[0];return jsxRuntime.jsx(yl,{options:r,activeValue:i,triggerIcon:a.iconName,tooltipContent:`Wrap: ${a.label}`,onSelect:t,disabled:n,testId:"toolbar-image-wrap",showLabels:true})}var S8=[{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 M0({onTransform:e,disabled:t=false}){let{t:n}=N(),o=S8.map(r=>({...r,label:n(r.labelKey)}));return jsxRuntime.jsx(yl,{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 w8(e){let t=nt__namespace.default.useContext(fa);return t?{...t,...R8(e)}:e}function R8(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function Fd(e){let{t}=N(),n=w8(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:P=true,showTextColorPicker:h=true,showHighlightColorPicker:v=true,showAlignmentButtons:S=true,showListButtons:x=true,showLineSpacingPicker:w=true,showStylePicker:T=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]),he=nt.useCallback(()=>{!s&&l&&i&&i();},[s,l,i]),ve=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(()=>Ed(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]),De=nt.useCallback(()=>{!s&&r&&r("outdent");},[s,r]),El=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,xa=ne.current,yo=Wn?.contains(at),Od=xa?.contains(at);if(!yo&&!Od)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:he,disabled:s||!l,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(K,{name:"undo",size:St})}),jsxRuntime.jsx(ut,{onClick:ve,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(f0,{value:L,onChange:F,disabled:s,compact:true})}),T&&jsxRuntime.jsx(Tt,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(p0,{value:o.styleId||"Normal",onChange:Vn,styles:k,theme:R,disabled:s,width:120})}),(f||P)&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.font"),children:[f&&jsxRuntime.jsx(Wg,{value:o.fontFamily||"Arial",onChange:U,fonts:Z,documentFonts:y,disabled:s,width:60,placeholder:"Arial"}),P&&jsxRuntime.jsx(Xg,{value:o.fontSize!==void 0?Kl(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(i0,{value:o.alignment||"left",onChange:We,disabled:s})}),(x||w)&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.listFormatting"),children:[x&&jsxRuntime.jsx(s0,{listState:o.listState||pl(),onBulletList:ho,onNumberedList:pt,onIndent:vo,onOutdent:De,disabled:s,showIndentButtons:true,compact:true,hasIndent:(o.indentLeft??0)>0}),w&&jsxRuntime.jsx(d0,{value:o.lineSpacing,onChange:El,disabled:s})]}),M&&E&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(k0,{imageContext:M,onChange:E,disabled:s}),D&&jsxRuntime.jsx(M0,{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(h0,{onAction:Pt,disabled:s}),jsxRuntime.jsx(v0,{onAction:Pt,disabled:s,theme:R,value:zt(z?.cellBorderColor,R)}),jsxRuntime.jsx(x0,{onAction:Pt,disabled:s}),jsxRuntime.jsx(T0,{onAction:Pt,disabled:s,theme:R,value:z?.cellBackgroundColor}),jsxRuntime.jsx(w0,{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 k8({children:e,className:t,style:n,...o}){return jsxRuntime.jsx(fa.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:Qe.toolbar,...n},"data-testid":"editor-toolbar",children:e})})}var tt=k8;tt.TitleBar=Td;tt.Logo=rl;tt.DocumentName=Sd;tt.MenuBar=il;tt.TitleBarRight=al;tt.Toolbar=Fd;var _8=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"]]),D8=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function N8({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,P]=nt.useState({}),[h,v]=nt.useState(null),S=nt.useCallback(k=>{b(k);let R=u.current?.formatting();R&&P({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"?D8(_):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=_8.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),T=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(tt,{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(tt.TitleBar,{children:[l&&jsxRuntime.jsx(tt.Logo,{children:l()}),jsxRuntime.jsx(tt.DocumentName,{value:o??"Document",editable:false}),c&&jsxRuntime.jsx(tt.TitleBarRight,{children:c()}),jsxRuntime.jsx(tt.MenuBar,{})]}),jsxRuntime.jsx(tt.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[T?jsxRuntime.jsx("div",{style:{padding:"4px 0"},children:jsxRuntime.jsx(Ho,{pageSetup:T,zoom:w})}):null,jsxRuntime.jsx(bd,{ref:u,source:e,...p?{documentFontFamily:p}:{},...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onStateChange:S,...i?{onError:i}:{}})]})]})}var Sl=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 Tl=class extends Sl{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 B8=nt.createContext(null);function L0({children:e}){let t=nt.useMemo(()=>new Tl,[]),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(B8.Provider,{value:c,children:[e,jsxRuntime.jsx(Z8,{notifications:n.notifications,onDismiss:a})]})}function Z8({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(q8,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function q8({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 Cl=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(K8,{error:o,errorInfo:r,showDetails:n,onReset:this.resetError})}return this.props.children}};function K8({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:[`
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'),xe=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 xe__namespace=/*#__PURE__*/_interopNamespace(xe);var Zd={version:"2.16.2"};var Z0=Zd.version;var qd="(prefers-color-scheme: dark)";function Kd(){return typeof window<"u"&&typeof window.matchMedia=="function"}function zd(){return Kd()?window.matchMedia(qd).matches:false}function Vd(e,t){return e==="dark"||e==="system"&&t}function $d(e){if(!Kd())return ()=>{};let t=window.matchMedia(qd);e(t.matches);let n=o=>e(o.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}var wl=nt.createContext(null);function H(){return nt.useContext(wl)}var mt=nt.createContext(null);var Rl=nt.createContext(i18n.en),kl=nt.createContext("en");function nn({i18n:e,children:t}){let n=nt.useContext(Rl),o=nt.useContext(kl),r=typeof e?._lang=="string"?e._lang:o,i=nt.useMemo(()=>i18n.deepMerge(n,e),[n,e]);return jsxRuntime.jsx(kl.Provider,{value:r,children:jsxRuntime.jsx(Rl.Provider,{value:i,children:t})})}function N(){let e=nt.useContext(Rl),t=nt.useContext(kl);return {t:nt.useMemo(()=>i18n.createT(e,t),[e,t]),catalogue:e}}function Yd(e){let{t}=N();return nt.useCallback((n,o)=>e?.get(n)??t(n,o),[e,t])}var Ml=0,Il=false,_l=false;function Xd(){let e=globalThis.navigator?.scheduling;return typeof e?.isInputPending!="function"?false:e.isInputPending({includeContinuous:true})?true:(Il||(Il=true,Ml+=1,queueMicrotask(()=>{Il=false;}),_l||(_l=true,setTimeout(()=>{_l=false,Ml=0;},0))),Ml>16)}function Jd(e){let t=false;return ()=>{if(t)return;t=true;let n=()=>{t=false,e();};Xd()?setTimeout(n,0):queueMicrotask(n);}}var G0=()=>{},Nl=0;function j0(){return Nl}function Ll(e){return Jd(e)}function O(e,t=Object.is,n){let o=H(),r=n?.onSubscribe,i=n?.onUnsubscribe,a=nt.useCallback(d=>{if(!o)return G0;let m=false;Nl++,r?.();let p=Ll(()=>{m||d();}),g=[o.on("change",p),o.on("selectionChange",p),o.on("error",p)];return ()=>{m=true,Nl--,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 eu=12700,Qd=96;function Q0(e){return e==="image/png"||e==="image/jpeg"||e==="image/gif"}function eb(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 Ta(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(!Q0(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}=eb(o.pixelWidth,o.pixelHeight,o.dpiX??Qd,o.dpiY??Qd);return Object.freeze({ok:true,bytes:e,mime:n,widthPoints:i,heightPoints:a})}function Ut(e){return Math.round(e/eu*100)/100}function Gn(e){return Math.round(e*eu)}var xo=nt.createContext({t:void 0,onSave:void 0});function ob(){return nt.useContext(xo)}function Ca(e){let{t}=N();return n=>e?.(n)??t(n)}function J(){let{t:e}=nt.useContext(xo);return Ca(e)}function sb(e,t){return e.active===t.active&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason&&e.value===t.value}function Fl(e){return typeof e=="string"}function le(e){let t=H(),{t:n}=N(),o=Fl(e)?e:editor.editorCommandKey(e),r=nt.useRef(e);r.current=e;let i=nt.useCallback(c=>{let s=r.current;if(Fl(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,sb),l=nt.useCallback(()=>{let c=r.current;return Fl(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 pb=()=>()=>{},mb=()=>true,fb=()=>false;function an(){let e=nt.useSyncExternalStore(pb,mb,fb);return nt.useCallback(t=>e?i18n.platformShortcut(t):t,[e])}function vb(e,t){return typeof t!="function"?e:typeof e!="function"?t:n=>{e(n),n.defaultPrevented||t(n);}}function yb(e,t){let n={...e,...t};for(let o of Object.keys(e))/^on[A-Z]/.test(o)?n[o]=vb(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=yb(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 kb="image/png,image/jpeg,image/gif",Hl=nt.createContext(null);function iu(){let e=nt.useContext(Hl);if(!e)throw new Error("useImageInsert must be used within ImageInsertProvider");return e}function jn(){return nt.useContext(Hl)}function Ea({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=Ta(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},P=t.canExecuteImageCommand?.(y);if(P&&!P.ok){window.alert(P.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 P=y.getAsFile();if(!P)continue;let h=await P.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(Hl.Provider,{value:u,children:[jsxRuntime.jsx("input",{ref:o,type:"file",accept:kb,className:"docx-image-insert__input",tabIndex:-1,"aria-hidden":"true",onChange:g,onMouseDown:f=>f.stopPropagation()}),e]})}function wa({className:e,hidden:t,asChild:n,children:o}){let{openFilePicker:r,isEnabled:i,disabledReason:a}=iu(),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)})}wa.docxSlot="image.insert";var Yn=Object.assign(wa,{docxSlot:"image.insert"});var qb=["nw","n","ne","e","se","s","sw","w"],du=40,uu=12;function Kb(e){return `imageOverlay.handle.${e}`}function zb(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 Vb(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 $b(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 Bl({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 P=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)){P();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}),P();},[P,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(),P();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=$b(_,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});},[P,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-du?D=uu:_.clientY<$.top+du&&(D=-uu),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 P();};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);}},[P,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?qb.map(I=>{let M=Vb(I);return jsxRuntime.jsx("button",{type:"button",className:"docx-image-selection-overlay__handle","aria-label":r(Kb(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:zb(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 ql(e){return [...e.items].some(t=>t.kind==="file"&&t.type.startsWith("image/"))}function ka({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&&ql(s)&&(editor.clipboardPasteLandsContent(s)||(c.preventDefault(),n.insertFromDataTransfer(s)));},[n]),a=nt.useCallback(c=>{!n?.isEnabled||!ql(c.dataTransfer)||c.preventDefault();},[n]),l=nt.useCallback(c=>{if(n?.isEnabled&&ql(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(Bl,{containerRef:o,portalRef:r}):null]})}function Ee(e){return e/1440*96}function Ma(e){return e/96*1440}function je(e){return `${Math.round(e*100)/100}px`}function Kl(e){return e/2}var Xb=e=>e.isLoading||e.isOpening===true,Jb=e=>({width:Ee(e.pageSetup?.pageWidthTwips??12240)*e.zoom,height:Ee(e.pageSetup?.pageHeightTwips??15840)*e.zoom}),Qb=(e,t)=>e.width===t.width&&e.height===t.height;function zl({className:e}){return jsxRuntime.jsx("span",{className:`docx-editor__loading-spinner${e?` ${e}`:""}`,"aria-hidden":"true"})}function eh({when:e=false,overlay:t=false,className:n,style:o,children:r}){let i=O(Xb),a=O(Jb,Qb),{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(zl,{}),jsxRuntime.jsx("span",{className:"docx-editor-sr-only",children:l("loading.label")})]})})})})})}var Ia=Object.assign(eh,{Spinner:zl});function gu(){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 vu(){let e=nt.useRef(null);return e.current===null&&(e.current=Symbol("revision-style-declaration")),e.current}function Vl(){let e=nt.useContext(Jn),t=vu();return nt.useEffect(()=>{if(e)return e.registerScheme(t),()=>e.unregister(t)},[e,t]),null}function $l(e){let{author:t,color:n,background:o,spanClassName:r,avatarUrl:i}=e,a=nt.useContext(Jn),l=vu();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}),sh=e=>e;function ch(){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 Wl(){let e=nt.useContext(er),t=Da(e===null);return e??t}function Da(e=true){let t=H(),[n,o]=nt.useState(Co),r=nt.useRef(null),i=nt.useRef(n);i.current=n;let a=O(sh),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=ch();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]),P=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:P}),[n,l,s,m,d,p,g,u,f,b,y,P])}var Ye={showAll:"contentControl.showAll",formFill:"contentControl.formFill",inspector:"contentControl.inspector",remove:"contentControl.remove"};function mh(e){return e==="sdtLocked"||e==="sdtContentLocked"}function fh(e){return e==="contentLocked"||e==="sdtContentLocked"}function Gl(e,t){return !e.ok&&e.code===t}function Et(){let e=nt.useContext(jl),t=Na();return e??t}function Na(){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:fh(w.effectiveLock)||E==="locked",removalLocked:mh(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"||Gl(_,"locked"),I=k==="bound"||Gl(_,"bound"),M=R==="locked"||Gl(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),[]),P=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:P,remove:x,setValue:S}),[d,m,o,i,t,h,v,p,u,g,f,b,y,P,x,S])}var jl=nt.createContext(null);function xu(){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 Xl=nt.createContext(null);function Eo(){return nt.useContext(Xl)}var Su=()=>0,Jl=()=>()=>{};function wo(){let e=Eo(),t=nt.useCallback(o=>e?e.subscribeShift(o):Jl(),[e]),n=nt.useCallback(()=>e?e.getShift():0,[e]);return nt.useSyncExternalStore(t,n,Su)}function Tu(){let e=Eo(),t=nt.useCallback(o=>e?e.subscribeReservation(o):Jl(),[e]),n=nt.useCallback(()=>e?e.getReservation():0,[e]);return nt.useSyncExternalStore(t,n,Su)}function At(){let e=Eo(),t=nt.useCallback(r=>e?e.subscribeViewport(r):Jl(),[e]),n=nt.useCallback(()=>e?e.getViewport():null,[e]),o=nt.useCallback(()=>null,[]);return nt.useSyncExternalStore(t,n,o)}function Sh(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 Th(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),P=nt.useRef(null);P.current??=gu();let h=P.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||!Sh(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(xu,[]);return nt.useEffect(()=>(h.connect(b),()=>h.connect(null)),[h,b]),jsxRuntime.jsx(mt.Provider,{value:k,children:jsxRuntime.jsx(wl.Provider,{value:b,children:jsxRuntime.jsx(Xl.Provider,{value:R,children:jsxRuntime.jsx(Jn.Provider,{value:h,children:jsxRuntime.jsx(Ch,{children:jsxRuntime.jsx(Ph,{children:jsxRuntime.jsx(Ea,{children:m})})})})})})})}function Ch({children:e}){let t=Da(true);return jsxRuntime.jsx(er.Provider,{value:t,children:e})}function Ph({children:e}){let t=Na();return jsxRuntime.jsx(jl.Provider,{value:t,children:e})}var ns=316,os=44,Mh=24,La={inlineStart:0,inlineEnd:ns},Cu={inlineStart:os,inlineEnd:os},Ih={inlineStart:0,inlineEnd:0};function wu({open:e,viewportWidth:t,pageWidthPx:n,inlineStartReservation:o=0,docked:r=false}){if(!e)return Cu;if(r||!Number.isFinite(t)||t<=0||!Number.isFinite(n)||n<=0)return La;let i=Number.isFinite(o)&&o>0?o:0;return t-i-n-2*Mh>=ns?La:Cu}var _h=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}},Dh=(e,t)=>e.reviewPaneOpen===t.reviewPaneOpen&&e.entitledZoom===t.entitledZoom&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Ru(){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(_h,Dh),r=At(),i=Tu(),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?wu({open:n,viewportWidth:p??0,pageWidthPx:l===null||o===null?0:Ee(l)*o,inlineStartReservation:i,docked:o===null}):Ih,[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 Fa=[.25,.5,.75,1,1.25,1.5,2];function nr(e,t){return t==="in"?Fa.find(o=>o>e+.001)??null:[...Fa].reverse().find(o=>o<e-.001)??null}function ku(e,t){return e==="0"?1:e==="+"||e==="="?nr(t,"in")??t:e==="-"?nr(t,"out")??t:null}var ko=nt.createContext(false);function ot(){return nt.useContext(ko)?"":"docx-editor "}var Ah=e=>e.reviewPaneOpen??true,Hh=e=>e.zoomMode?.type==="fit";function Aa({className:e,style:t,children:n}){let o=ot(),r=H(),i=O(Ah),a=dn(),l=O(Hh),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=ku(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 Bh=editor.LOADING_SNAPSHOT;function _u({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)??Bh}),[t]);}var Vh=e=>e.editingMode??"editing",as='[role="menuitemradio"]:not([disabled])',$h=(e,t)=>e.length===t.length&&e.every((n,o)=>n===t[o]),Wh=e=>e.isLoading||e.isOpening===true,rr=[{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"}],Uh=Object.freeze(rr.map(()=>null));function Gh(e){return e?rr.map(t=>{let n=e.can({type:"setEditingMode",mode:t.mode});return n.ok?null:n.reason}):Uh}var jh="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z";function Oa({className:e,hidden:t}){let n=H(),o=O(Vh),r=O(Wh),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 h=m.current?.querySelectorAll(as);(m.current?.querySelector(`${as}[aria-checked="true"]`)??h?.[0]??void 0)?.focus();},[l]);let p=nt.useCallback(h=>{let v=[...m.current?.querySelectorAll(as)??[]],S=v.indexOf(document.activeElement),x=w=>{h.preventDefault(),v[(w+v.length)%v.length]?.focus();};h.key==="ArrowDown"?x(S+1):h.key==="ArrowUp"?x(S-1):h.key==="Home"?x(0):h.key==="End"&&x(v.length-1);},[]);nt.useEffect(()=>{if(!l)return;let h=S=>{let x=s.current;x&&S.target instanceof Node&&x.contains(S.target)||c(false);},v=S=>{S.key==="Escape"&&(S.preventDefault(),c(false));};return document.addEventListener("mousedown",h,true),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",h,true),document.removeEventListener("keydown",v);}},[l]);let g=nt.useCallback(h=>{c(false),editor.runToolbarCommand(n,"review.editingMode",h),n?.focus();},[n]),u=editor.toolbarCommandState(n,"review.editingMode"),f=i18n.localizeDisabledReason(u.disabledReason,a),b=O(()=>Gh(n),$h),y=nt.useMemo(()=>rr.find(h=>h.mode===o)??rr[0],[o]);if(t)return null;let P=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(P?.labelKey??"editingMode.label"),disabled:r||!u.enabled,...f?{title:f}:{},onMouseDown:B,onClick:()=>c(h=>!h),children:[is(y.path),jsxRuntime.jsx("span",{className:"docx-toolbar__picker-value",children:i(y.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(P?.labelKey??"editingMode.label"),"data-testid":"editing-mode-menu",onKeyDown:p,children:rr.map((h,v)=>{let S=i18n.localizeDisabledReason(b[v]??null,a);return jsxRuntime.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":h.mode===o,className:"docx-toolbar__mode-item","data-testid":`editing-mode-${h.mode}`,disabled:S!==null,...S?{title:S}:{},onMouseDown:B,onClick:()=>g(h.mode),children:[is(h.path),jsxRuntime.jsxs("span",{className:"docx-toolbar__mode-text",children:[jsxRuntime.jsx("span",{className:"docx-toolbar__mode-label",children:i(h.labelKey)}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-hint",children:i(h.hintKey)})]}),jsxRuntime.jsx("span",{className:"docx-toolbar__mode-check","aria-hidden":"true",children:h.mode===o?is(jh):null})]},h.mode)})}):null]})}Oa.docxSlot="review.editingMode";function is(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 Fu=[],Jh=()=>{};function ar(){let e=H(),t=nt.useCallback(n=>{if(!e)return Jh;let o=Ll(n),r=e.on("change",o),i=e.on("selectionChange",o);return ()=>{r(),i();}},[e]);return nt.useSyncExternalStore(t,()=>e?.getReviewAuthors()??Fu,()=>Fu)}var rv=e=>e.hiddenReviewAuthors??[];function Za({className:e,hidden:t,icon:n}){let o=H(),r=ar(),i=O(rv),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"),P=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:P??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(Au,{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(Au,{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]})}Za.docxSlot="review.authors";function Au(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 Ka({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 dv={contextualSpacing:null,keepNext:null,keepLines:null,widowControl:null,pageBreakBefore:null},uv=e=>{let t=e.formatting??null;if(!t)return null;let n=t.indent,o=t.paragraphFlags??dv;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}}},pv=["alignment","spaceBeforePt","spaceAfterPt","lineSpacing","tabStops","indentLeft","indentRight","indentFirstLine"],mv=(e,t)=>pv.every(n=>e.disagrees[n]===t.disagrees[n]),fv=(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&&mv(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")),gv=e=>e.editable;function cs(){let e=H(),t=O(uv,fv),n=O(gv),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 ir=e=>Math.round(e/1440*100)/100,ds=e=>ir(e).toLocaleString(void 0,{maximumFractionDigits:2}),za=e=>Math.round(e*1440),Ou={left:"dialogs.paragraph.tabAlignLeft",center:"dialogs.paragraph.tabAlignCenter",right:"dialogs.paragraph.tabAlignRight",decimal:"dialogs.paragraph.tabAlignDecimal",bar:"dialogs.paragraph.tabAlignBar"},bv=e=>e===null||e===0?"none":e<0?"hanging":"firstLine",hv=(e,t)=>e==="none"?0:e==="hanging"?-Math.abs(t):Math.abs(t);function Bu(e){let t=e.indentFirstLineTwips;return {alignment:e.alignment??"left",indentLeft:e.indentLeftTwips??0,indentRight:e.indentRightTwips??0,special:bv(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 Va={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 Zu(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 vv(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 qu(e,t,n=Va,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",hv(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),(!vv(e.tabStops,t.tabStops)||l("tabStops")&&t.clearedAllTabStops)&&a("tabStops",t.tabStops),i?r:null}function Ku(e,t){return [...e.filter(o=>o.positionTwips!==t.positionTwips),t].sort((o,r)=>o.positionTwips-r.positionTwips)}function zu(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 Sv={marginRight:"auto",fontSize:"12px",color:"var(--doc-danger)"},Tv={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Cv={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},Pv={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",flexShrink:0,fontSize:16,fontWeight:600,color:"var(--doc-text)"},Ev={padding:"16px 20px",overflowY:"auto",minHeight:0},wv={display:"grid",gridTemplateColumns:"1fr 1fr",gap:28},Wu={display:"flex",flexDirection:"column",gap:14,minWidth:0},lr={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)"},sr={fontSize:11,color:"var(--doc-text-muted)",width:20},Rv={display:"flex",alignItems:"center",gap:8,fontSize:13,color:"var(--doc-text)"},kv={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,flexShrink:0},cr={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}=cs(),[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,P]=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,he]=nt.useState(0),[ve,U]=nt.useState("left"),[Z,Re]=nt.useState("none"),[ce,de]=nt.useState(Va),[We,ho]=nt.useState(false),pt=q=>o(We&&(q==="indentLeft"||q==="indentRight"||q==="special")?"dialogs.paragraph.notShown":"dialogs.paragraph.mixed"),vo=nt.useRef(Va),De=nt.useId(),[El,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=Bu(r);c(q.alignment),d(q.indentLeft),p(q.indentRight),u(q.special),b(q.specialBy),P(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 ye=Zu(r);de(ye),ho(r.indentUnknown),he(0),U("left"),Re("none"),vo.current=ye,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,ye=q===null?null:qu(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(ye===null){t();return}if(a(ye)){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(ye=>({...ye,tabStops:false})),V(Ku(z,{positionTwips:q,alignment:ve,...Z!=="none"?{leader:Z}:{}})),he(0),U("left"),Re("none"),true)},[z,re,ve,Z]);if(!e)return null;let at=q=>de(ye=>({...ye,[q]:false})),Wn=(q,ye,Wt,Ue)=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${De}-${q}`,children:o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("input",{id:`${De}-${q}`,type:"number",style:wt,min:0,step:.1,value:ce[Ue]?"":ir(ye),placeholder:ce[Ue]?pt(Ue):void 0,onChange:Un=>{at(Ue),Wt(za(Number(Un.target.value)||0));},"aria-label":o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("span",{style:sr,children:o("dialogs.paragraph.unitInches")})]}),xa=(q,ye,Wt,Ue)=>jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${De}-${q}`,children:o(`dialogs.paragraph.${q}`)}),jsxRuntime.jsx("input",{id:`${De}-${q}`,type:"number",style:wt,min:0,step:1,value:ce[Ue]?"":ye,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:sr,children:o("dialogs.paragraph.unitPoints")})]}),yo=(q,ye,Wt)=>jsxRuntime.jsxs("label",{style:Rv,children:[jsxRuntime.jsx("input",{type:"checkbox",checked:ye,ref:Ue=>{Ue&&(Ue.indeterminate=ce[q]);},onChange:Ue=>{de(Un=>({...Un,[q]:false})),Wt(Ue.target.checked);}}),o(`dialogs.paragraph.${q}`)]}),Bd=`docx-editor${document.querySelector(".docx-editor")?.classList.contains("dark")?" dark":""}`;return reactDom.createPortal(jsxRuntime.jsx("div",{className:Bd,style:{display:"contents"},children:jsxRuntime.jsx("div",{className:n,style:Tv,onClick:t,onKeyDown:q=>{q.key==="Escape"&&t(),Pt.current&&zu(Pt.current,q.nativeEvent)&&q.preventDefault();let ye=q.target instanceof HTMLButtonElement||q.target instanceof HTMLSelectElement;if(q.key==="Enter"&&!ye){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:Cv,onClick:q=>q.stopPropagation(),onMouseDown:q=>q.stopPropagation(),children:[jsxRuntime.jsx("div",{style:Pv,children:o("dialogs.paragraph.title")}),jsxRuntime.jsx("div",{style:Ev,children:jsxRuntime.jsxs("div",{style:wv,children:[jsxRuntime.jsxs("div",{style:Wu,children:[jsxRuntime.jsx("div",{style:lr,children:o("dialogs.paragraph.general")}),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${De}-alignment`,children:o("dialogs.paragraph.alignment")}),jsxRuntime.jsxs("select",{id:`${De}-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:lr,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:`${De}-special`,children:o("dialogs.paragraph.special")}),jsxRuntime.jsxs("select",{id:`${De}-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:`${De}-by`,children:o("dialogs.paragraph.by")}),jsxRuntime.jsx("input",{id:`${De}-by`,type:"number",style:wt,min:0,step:.1,value:ce.special?"":ir(f),placeholder:ce.special?pt("special"):void 0,onChange:q=>{at("special"),b(Math.max(0,za(Number(q.target.value)||0)));},"aria-label":o("dialogs.paragraph.by")}),jsxRuntime.jsx("span",{style:sr,children:o("dialogs.paragraph.unitInches")})]}):null,jsxRuntime.jsx("div",{style:lr,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:ds(q.positionTwips)})}),jsxRuntime.jsx("span",{style:{flex:1,fontSize:13,color:"var(--doc-text-muted)"},children:o(Ou[q.alignment])}),jsxRuntime.jsx("button",{type:"button",style:cr,onClick:()=>V(z.filter(ye=>ye!==q)),"aria-label":o("dialogs.paragraph.tabRemoveAt",{position:ds(q.positionTwips)}),children:o("dialogs.paragraph.tabRemove")})]},q.positionTwips)),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${De}-tabPosition`,children:o("dialogs.paragraph.tabPosition")}),jsxRuntime.jsx("input",{id:`${De}-tabPosition`,type:"number",style:wt,min:0,step:.1,value:ir(re),onChange:q=>he(Math.max(0,za(Number(q.target.value)||0))),"aria-label":o("dialogs.paragraph.tabPosition"),"data-docx-tab-entry":""}),jsxRuntime.jsx("span",{style:sr,children:o("dialogs.paragraph.unitInches")})]}),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${De}-tabAlignment`,children:o("dialogs.paragraph.tabAlignment")}),jsxRuntime.jsxs("select",{id:`${De}-tabAlignment`,style:wt,value:ve,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:`${De}-tabLeader`,children:o("dialogs.paragraph.tabLeader")}),jsxRuntime.jsxs("select",{id:`${De}-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:cr,onClick:me,children:o("dialogs.paragraph.tabAdd")}),jsxRuntime.jsx("button",{type:"button",style:cr,onClick:()=>{de(q=>({...q,tabStops:false})),ne(true),V([]);},children:o("dialogs.paragraph.tabClearAll")})]})]}),jsxRuntime.jsxs("div",{style:Wu,children:[jsxRuntime.jsx("div",{style:lr,children:o("dialogs.paragraph.spacing")}),xa("spaceBefore",y,P,"spaceBefore"),xa("spaceAfter",h,v,"spaceAfter"),jsxRuntime.jsxs("div",{style:it,children:[jsxRuntime.jsx("label",{style:gt,htmlFor:`${De}-lineSpacing`,children:o("dialogs.paragraph.lineSpacing")}),jsxRuntime.jsxs("select",{id:`${De}-lineSpacing`,style:wt,value:ce.lineSpacing?"":S,onChange:q=>{let ye=q.target.value;at("lineSpacing"),x(ye),C(ye===on.current?.lineRule?on.current.lineValue:ye==="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:`${De}-at`,children:o("dialogs.paragraph.at")}),jsxRuntime.jsx("input",{id:`${De}-at`,type:"number",style:wt,min:.01,step:S==="multiple"?.01:1,value:ce.lineSpacing?"":w,disabled:ce.lineSpacing,onChange:q=>{let ye=q.target.value.trim();C(ye===""?S==="multiple"?1.08:12:Number(ye)||0);},"aria-label":o("dialogs.paragraph.at")}),jsxRuntime.jsx("span",{style:sr,children:S==="multiple"?"":o("dialogs.paragraph.unitPoints")})]}),yo("contextualSpacing",k,R),jsxRuntime.jsx("div",{style:lr,children:o("dialogs.paragraph.pagination")}),yo("keepNext",_,L),yo("widowControl",M,E),yo("keepLines",F,I),yo("pageBreakBefore",D,ae)]})]})}),jsxRuntime.jsxs("div",{style:kv,children:[El?jsxRuntime.jsx("span",{role:"alert",style:Sv,children:o("dialogs.paragraph.refused")}):null,jsxRuntime.jsx("button",{type:"button",style:cr,onClick:t,children:o("dialogs.paragraph.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...cr,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 Uu=nt.createContext(null);function Gu({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(Uu.Provider,{value:r,children:[e,jsxRuntime.jsx(Mo,{open:t,onClose:i})]})}function ju(){return nt.useContext(Uu)}var Hv=["zoom","script","format","list","alignment","styles","font","text","history"],us=new Set(["review"]),ps=24,Xu=new Set;function Ju(e,t=Hv){let n=t.filter(r=>e.includes(r));return [...e.filter(r=>!t.includes(r)).reverse(),...n]}function Yu(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 Xu;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 Qu(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 ep=Qu;function tp(e){if(!(e.available>0))return Xu;let t=Yu(e,e.available),n=e.previous;if(!n||n.size===0||t.size>=n.size)return t;let o=Yu(e,e.available-(e.hysteresis));return Qu(o,n)?n:o}function op(e,t,n,o){return e+t+n+o*2}function np(e,t){return e+t}function fs(e,t){return e+t}function rp(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 ms(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function ap(e){return ms(e.columnGap)}function ip(e,t){return e.clientWidth-ms(t.paddingLeft)-ms(t.paddingRight)}var pn="data-toolbar-group",ur="data-toolbar-fixed",bs="data-toolbar-more",qv=34,gs=new Set;function sp(e,t,n){let o=nt.useRef(null),r=nt.useRef(new Map),i=nt.useRef(qv),[a,l]=nt.useState(gs),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=ap(f),y=ip(u,f),P=u.querySelector(".docx-toolbar__separator"),h=b*2;if(P){let C=getComputedStyle(P),k=rp(C);h=op(P.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,np(C.offsetWidth,h));}let v=0;for(let C of u.querySelectorAll(`[${ur}]`))C.offsetWidth>0&&(v+=fs(C.offsetWidth,b));let S=u.querySelector(`[${bs}]`);S&&S.offsetWidth>0&&(i.current=fs(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:ps},w=tp(x);ep(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=gs,l(gs));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}], [${ur}]`))b.observe(y);return ()=>{f!==0&&cancelAnimationFrame(f),b.disconnect();}},[e,d,p,m,a]),{attach:g,overflow:a}}var jv=["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"],dp=nt.createContext({close:()=>{}});function Yv(e){e.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus();}function up({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 pp({slot:e}){let t=J(),n=an(),{close:o}=nt.useContext(dp),{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 mp({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&&Yv(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}`:""}`,[bs]:"",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(jv)}),o?jsxRuntime.jsx(dp.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 ty(e,t){return e.value===t.value&&e.enabled===t.enabled&&e.disabledReason===t.disabledReason}function pr(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,ty),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 vs=[{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 ja({className:e,hidden:t,asChild:n,children:o}){let{t:r}=N(),i=J(),{execute:a,value:l,isEnabled:c,disabledReason:s}=pr("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(()=>vs.find(x=>x.value===l)??vs[0],[l]),y=X("image.wrap"),P=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":P,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:vs.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]})}ja.docxSlot="image.wrap";var mr=Object.assign(ja,{docxSlot:"image.wrap"});function Ya({className:e,hidden:t,asChild:n,children:o}){let{t:r}=N(),i=J(),{execute:a,value:l,isEnabled:c,disabledReason:s}=pr("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 P=X("image.altText"),h=i(P?.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]})}Ya.docxSlot="image.altText";var fr=Object.assign(Ya,{docxSlot:"image.altText"});var Sp=e=>e.image;function xp(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 by(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function Cs(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 hy(e,t){let n=Cs(t);return e.horizontalPoints!==n.horizontalPoints||e.verticalPoints!==n.verticalPoints||e.relativeToH!==n.relativeToH||e.relativeToV!==n.relativeToV}function Xa(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 vy(e,t){let n=Cs(t);if(e.positionMode==="simple"||t.position?.mode==="simple"){let s=e.horizontalPoints!==n.horizontalPoints,d=e.verticalPoints!==n.verticalPoints,m=s?Xa(e.horizontalPoints):t.position?.horizontalEmu,p=d?Xa(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?Xa(e.horizontalPoints):t.position?.horizontalEmu,c=r?Xa(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 Ja(e){let t=Number(e);return !Number.isFinite(t)||t<0||t>100?null:t}function Qa(e){let t=Number(e);return !Number.isFinite(t)||t<=0?null:t}function Ps({open:e,onClose:t,className:n,triggerRef:o}){let r=H(),{t:i}=N(),a=O(Sp),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),P=m.current,h=P?.canCrop===false,v=P?.canResize===false,S=P?.locks.changeAspect===true,x=P?.kind==="anchored"&&P.canMove===true,w=P?.kind==="inline",C=P?.kind==="anchored"&&P.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=Cs(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=xp(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 $=xp(E);if($.length===0)return;let ne=document.activeElement,re=$.findIndex(ve=>ve===ne);if(re===-1)return;V.preventDefault();let he=V.shiftKey?(re-1+$.length)%$.length:(re+1)%$.length;$[he]?.focus();};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[e,R]);let _=nt.useMemo(()=>{let E=P??a;return !E||E.widthEmu<=0?1:E.widthEmu/E.heightEmu},[a,P]),L=nt.useCallback(E=>{f(D=>{if(!D)return D;if(!D.lockAspect)return {...D,widthPoints:E};let ae=Qa(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=Qa(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 ve=Qa(u.widthPoints),U=Qa(u.heightPoints);if(ve===null||U===null){y("imageProperties.errors.invalidDimensions");return}let Z=Gn(ve),Re=Gn(U);Z!==E.widthEmu&&(z.widthEmu=Z),Re!==E.heightEmu&&(z.heightEmu=Re);}if(E.canCrop&&!h){let ve=Ja(u.cropLeft),U=Ja(u.cropTop),Z=Ja(u.cropRight),Re=Ja(u.cropBottom);if(ve===null||U===null||Z===null||Re===null){y("imageProperties.errors.invalidCrop");return}let ce=E.crop;(ve!==ce.left||U!==ce.top||Z!==ce.right||Re!==ce.bottom)&&(z.crop={left:ve,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&&hy(u,E)){let ve=vy(u,E);if(!ve.ok){y("imageProperties.errors.invalidPosition");return}if(!editor.validateDrawingPositionInput(editor.positionInputFromPropertiesCommand(ve.value,E))){y("imageProperties.errors.invalidPosition");return}Object.assign(z,ve.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(),by(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||!P?.intrinsic,onClick:I,children:i("imageProperties.resetNaturalSize")})]}),jsxRuntime.jsxs("section",{className:"docx-dialog__section",children:[jsxRuntime.jsx("div",{className:"docx-dialog__section-label",children:i("imageProperties.position")}),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:P?.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 ei({className:e,hidden:t,asChild:n,children:o}){let r=H(),{t:i}=N(),a=O(Sp),[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(Ps,{open:l,onClose:()=>c(false),triggerRef:s})]})}ei.docxSlot="image.properties";var gn=Object.assign(ei,{docxSlot:"image.properties"});function Ae(e){return Object.assign(n=>jsxRuntime.jsx(So,{slot:e,...n}),{docxSlot:e})}var Tp=Ae("history.undo"),Cp=Ae("history.redo"),Pp=Ae("text.bold"),Ep=Ae("text.italic"),wp=Ae("text.underline"),Rp=Ae("text.strike"),kp=Ae("format.clear"),Mp=Ae("script.super"),Ip=Ae("script.sub"),_p=Ae("alignment.left"),Dp=Ae("alignment.center"),Np=Ae("alignment.right"),Lp=Ae("alignment.justify"),Fp=Ae("list.bullet"),Ap=Ae("list.numbered"),Hp=Ae("list.outdent"),Op=Ae("list.indent");var Bp=Ae("table.insert"),Zp=Ae("review.comments");function Ty({className:e,hidden:t,icon:n,asChild:o,children:r}){let i=H(),{openAtCaret:a}=Wl(),l=editor.chromeProbeForSlot("text.link"),c=i&&l?i.can(l):null,s=c?.ok===true,{t:d}=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 Es=Object.assign(Ty,{docxSlot:"text.link"});function Cy({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 ws=Object.assign(Cy,{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 wy=e=>({zoom:e.zoom,mode:e.zoomMode}),Ry=(e,t)=>e.zoom===t.zoom&&e.mode===t.mode,Kp={type:"fixed"};function Rs(){let e=H(),{zoom:t,mode:n}=O(wy,Ry),o=nt.useCallback(i=>{e?.setZoom(i);},[e]),r=nt.useCallback(i=>{e?.setZoomMode(i);},[e]);return nt.useMemo(()=>{let i=n??Kp,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(Kp),o(1);},zoomIn:()=>l!==null&&o(l),zoomOut:()=>a!==null&&o(a),canZoomIn:!!e&&l!==null,canZoomOut:!!e&&a!==null,levels:Fa}},[e,t,n,o,r])}var vr=2,yr=3276,hr=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Iy=e=>e.formatting?.fontSizePt??null;function $p(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Wp(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 Gp(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 _y(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<vr||o>yr?null:o}function Dy({className:e,hidden:t}){let n=H(),o=O(Iy),{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(yr,Math.max(vr,Math.round(S*2))));},[g]),f=nt.useCallback(S=>{c(false),d(null),p.current?.blur(),S&&Ny(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),P=s??y,h=o===null?null:Math.round(o*2)/2,v=()=>{if(s===null)return;let S=_y(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(Gp,{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:P,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"?Wp(o,hr,vr/2):$p(o,hr,yr/2)));},onBlur:()=>{v(),d(null);}}),canDecrease:b&&Math.round(o*2)>vr,canIncrease:b&&Math.round(o*2)<yr,onDecrease:()=>u(Wp(o??0,hr,vr/2)),onIncrease:()=>u($p(o??0,hr,yr/2))}),l&&r?jsxRuntime.jsx("div",{className:"docx-toolbar__menu docx-toolbar__font-size-menu",role:"listbox","aria-label":a("fontSize.listLabel"),children:hr.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 Ny(e){(bn(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}var Is=Object.assign(Dy,{docxSlot:"font.size"});function Ly({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}=Rs(),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]),P=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(Gp,{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:()=>P("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:()=>P("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 _s=Object.assign(Ly,{docxSlot:"zoom.level"});var Oy=[1,1.15,1.5,2,2.5,3],Xp=10,Jp=0,By=e=>({lineSpacing:e.formatting?.lineSpacing??null,spaceBeforePt:e.formatting?.spaceBeforePt??null,spaceAfterPt:e.formatting?.spaceAfterPt??null}),Zy=(e,t)=>e.spaceBeforePt===t.spaceBeforePt&&e.spaceAfterPt===t.spaceAfterPt&&e.lineSpacing?.rule===t.lineSpacing?.rule&&e.lineSpacing?.value===t.lineSpacing?.value;function qy({className:e,hidden:t}){let n=H(),o=O(By,Zy),{isEnabled:r,disabledReason:i}=le("list.lineSpacing"),a=le("paragraph.dialog"),l=ju(),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,P=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:[Oy.map(h=>{let v=P===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?Jp:Xp),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?Jp:Xp),children:c(y?"lineSpacing.removeSpaceAfter":"lineSpacing.addSpaceAfter")})]}):null]})}var Ns=Object.assign(qy,{docxSlot:"list.lineSpacing"});var Uy=[{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"}],Qp=[{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"}],em=["FFFFFF","000000","E7E6E6","44546A","4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47"],ti=["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 Gy(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 jy=/^[0-9A-Fa-f]{6}$/;function Yy(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 Xy(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 oi({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":""}:{},...Xy(t.replace("#",""))?{"data-light":""}:{},onMouseDown:B,onClick:()=>r(e)})}function Jy({apply:e,label:t,current:n,themeHexes:o}){let r=o.map(Gy),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(oi,{value:a,css:`#${a.toLowerCase()}`,title:t(ti[l]),selected:n===a,apply:e},`base-${l}`)),i.map(a=>o.map((l,c)=>{let s=r[c][a],d=Yy(l,s.apply);return jsxRuntime.jsx(oi,{value:d,css:`#${d.toLowerCase()}`,title:`${t(ti[c])}, ${t(s.labelKey)}`,selected:n===d,apply:e},`${a}-${c}`)}))]})]})}function Qy(e){let{apply:t,label:n,current:o}=e,[r,i]=nt.useState(""),a=jy.test(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Jy,{...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:Uy.map(l=>jsxRuntime.jsx(oi,{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 Fs({apply:e,current:t}){let n=H(),o=J(),r=n?.getDocumentThemeColors()??[],i=r.length===ti.length?r.map(l=>l.hex):em,a=t?.toUpperCase()??null;return jsxRuntime.jsx(Qy,{apply:e,label:o,current:a,themeHexes:i})}var ex=Qp.filter(e=>e.value!=="white");function tx({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:ex.map(o=>jsxRuntime.jsx(oi,{value:o.value,css:o.css,title:t(o.labelKey),selected:n===o.value,apply:e},o.value))})]})}function tm(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,P]=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===ti.length?S.map(R=>R.hex):em;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&&P(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 ox=new Map(Qp.map(e=>[e.value,e.css])),As=tm({slot:"text.color",defaultValue:"FF0000",cssOf:e=>e==="auto"?"#000000":`#${e}`,clear:{value:"auto",labelKey:"colorPicker.automatic"},body:e=>jsxRuntime.jsx(Fs,{apply:e.apply,current:e.current})}),Hs=tm({slot:"text.highlight",defaultValue:"yellow",cssOf:e=>ox.get(e)??"#ffff00",clear:{value:"none",labelKey:"colorPicker.noColor"},body:e=>jsxRuntime.jsx(tx,{...e})});var lx=["alignment.left","alignment.center","alignment.right","alignment.justify"];function sx({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=lx.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 ni=Object.assign(sx,{docxSlot:"alignment"});function Bs(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 bx=Object.freeze([]),hx=e=>e.formatting?.fontFamily??null,vx=e=>e;function ri(){let e=H(),t=O(hx),n=O(vx),o=nt.useMemo(()=>e&&!n.isLoading?e.getAvailableFonts():bx,[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 rm=nt.createContext(null);function qs(){return nt.useContext(rm)}function Ks({asChild:e,className:t,children:n}){let o=qs(),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})}Ks.docxToolbarPart=true;var yx=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"]]),xx=[{category:"sansSerif",labelKey:"font.sansSerif"},{category:"serif",labelKey:"font.serif"},{category:"monospace",labelKey:"font.monospace"},{category:"other",labelKey:null}];function am({asChild:e,className:t,children:n}){let o=qs(),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=xx.map(c=>({...c,fonts:o.options.filter(s=>(yx.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(im,{value:d},d))]},c.category)),e?jsxRuntime.jsx(j,{...i,children:a}):jsxRuntime.jsx("div",{...i,children:a})}function im({value:e,asChild:t,className:n,children:o}){let r=qs();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 Sx({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__font-family${n?` ${n}`:""}`,"data-slot":"font.family"},d=o??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ks,{}),jsxRuntime.jsx(am,{})]});return jsxRuntime.jsx(rm.Provider,{value:c,children:t?jsxRuntime.jsx(j,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var zs=Object.assign(Sx,{docxSlot:"font.family",Trigger:Ks,Content:am,Item:im});var Cx={Title:26,Subtitle:18,Heading1:24,Heading2:18,Heading3:16,Heading4:14,Heading5:13,Heading6:13,Normal:14},Px=new Set(["Title","Heading1","Heading2","Heading3"]),Ex={Subtitle:"666666"},wx="#4a6c8c";function lm(e){let t=Cx[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??Px.has(e.styleId))&&(o.fontWeight="bold"),e.italic&&(o.fontStyle="italic");let r=e.color??Ex[e.styleId];return r?o.color=`#${r}`:e.styleId.startsWith("Heading")&&(o.color=wx),o}var Rx=/^heading ([1-9])$/;function $s(e,t){let n=e||t,o=Rx.exec(n);return o?`Heading ${o[1]}`:n}function sm(e){return !e||e.length===0?[]:e.filter(t=>t.type==="paragraph").map(t=>({styleId:t.styleId,name:$s(t.name,t.styleId),priority:99}))}function Fx(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 Ax=Object.freeze([]),Hx=e=>e.formatting?.styleId??null,Ox=e=>e;function ai(){let e=H(),t=O(Hx),n=O(Ox),o=nt.useMemo(()=>e&&!n.isLoading?e.getDocumentStyles().filter(a=>a.type==="paragraph").map(a=>({styleId:a.styleId,name:$s(a.name,a.styleId),preview:a.preview})):Ax,[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 cm=nt.createContext(null);function Us(){return nt.useContext(cm)}function Gs({asChild:e,className:t,children:n}){let o=Us(),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})}Gs.docxToolbarPart=true;function dm({asChild:e,className:t,children:n}){let o=Us();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(um,{value:a.styleId},a.styleId));return e?jsxRuntime.jsx(j,{...r,children:i}):jsxRuntime.jsx("div",{...r,children:i})}function um({value:e,asChild:t,className:n,children:o}){let r=Us();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?Fx(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 Bx({hidden:e,asChild:t,className:n,children:o}){let r=ai(),[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(Gs,{}),jsxRuntime.jsx(dm,{})]});return jsxRuntime.jsx(cm.Provider,{value:c,children:t?jsxRuntime.jsx(j,{...s,ref:l,children:d}):jsxRuntime.jsx("div",{ref:l,...s,children:d})})}var js=Object.assign(Bx,{docxSlot:"styles.style",Trigger:Gs,Content:dm,Item:um});function mm(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 qx({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 Kx({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 ii=mm(Ye.showAll,"showAll"),li=mm(Ye.formFill,"formFill"),si=Object.assign(Kx,{docxSlot:Ye.remove}),ci=Object.assign(qx,{docxSlot:Ye.inspector}),fm={[Ye.showAll]:ii,[Ye.formFill]:li,[Ye.inspector]:ci,[Ye.remove]:si};function Ys(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 jx=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],Js=nt.createContext(null);function Sm(){let e=nt.useContext(Js);if(!e)throw new Error("table chrome group must render inside TableChromeProvider");return e.visible}function Xx(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 Jx(e,t){return e.table===t.table&&e.editable===t.editable&&e.editingMode===t.editingMode&&e.headParagraphId===t.headParagraphId}function Qx(e,t){return e.tableKey===t.tableKey&&e.selectionKey===t.selectionKey&&e.cellSelectionKey===t.cellSelectionKey&&e.editable===t.editable&&e.editingMode===t.editingMode}var ym={tableKey:"",selectionKey:"",cellSelectionKey:"",editable:false,editingMode:"editing"};function eS(e,t){let n={};for(let o of jx){let r=editor.tableChromeToolbarState(e,o,t);n[o]={enabled:r.enabled,disabledReason:r.disabledReason};}return n}function Qs({children:e}){let t=H(),[n,o]=nt.useState(editor.DEFAULT_TABLE_CHROME_DRAFT),[r,i]=nt.useState(ym);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:""}),[]),Jx,{onSubscribe:()=>{},onUnsubscribe:()=>{}}),l=nt.useCallback(()=>{if(!t){i(ym);return}let p=Xx(t,t.snapshot());i(g=>Qx(g,p)?g:p);},[t]);nt.useEffect(()=>{l();},[l,a]),Ys("selectionChange",nt.useCallback(()=>{l();},[l]));let c=r.tableKey!=="",s=nt.useMemo(()=>t?eS(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(Js.Provider,{value:m,children:e})}function tS(){let e=nt.useContext(Js);if(!e)throw new Error("table chrome parts must render inside TableChromeProvider");return e}function ui(e){let t=tS(),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 nS='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]';function Do(e){return [...e.querySelectorAll(nS)].filter(t=>t.closest('[role="menu"]')===e)}function ec(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 pi(e){(bn(e)??e?.ownerDocument?.body)?.querySelector(".docx-pages")?.focus();}function oc(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 mi({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 iS='[role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]';function Tm(e,t,n,o){nt.useEffect(()=>{if(!e)return;let r=n.current,i=o.current;if(!r)return;let a=()=>[...r.querySelectorAll(iS)].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 Cm(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 km(e,t,n){if(e)return o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(!t));}}function mS(e){return Q(editor.tableChromeIconPaths(e))}function Mm(){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 rc(e,t,n){let o=Mm();function r({hidden:l,asChild:c,className:s,children:d}){let{visible:m,enabled:p,disabledReason:g,draft:u,apply:f}=ui(e),[b,y]=nt.useState(false),P=nt.useRef(null),h=nt.useRef(null);oc(b,y,P);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:P,children:x}):jsxRuntime.jsx("div",{ref:P,...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:P,reasonNode:h}=mi({enabled:p,disabledReason:g,ariaLabel:y}),v={...P,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:km(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(Tm(d&&p,m,f,g),!d||!p)return null;let b=X(e),y=u(b?.labelKey??n),P={ref:f,role:"menu","aria-label":y,className:`docx-table-chrome__panel${c?` ${c}`:""}`,onMouseDown:B};return l?jsxRuntime.jsx(j,{...P,children:s}):jsxRuntime.jsx("div",{...P,children:s})}return {Root:r,Trigger:i,Content:a,Ctx:o}}var Tr=rc("table.borderTarget","docx-table-chrome docx-table-chrome--target","table.borders.tooltip");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_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??mS(c.icon);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??jsxRuntime.jsx("div",{className:"docx-table-chrome__target-grid",children:editor.TABLE_BORDER_TARGET_OPTIONS.map(n=>jsxRuntime.jsx(Im,{value:n.value},n.value))})})}function fS(e){let{children:t}=e,n=t??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tr.Trigger,{}),jsxRuntime.jsx(_m,{})]});return jsxRuntime.jsx(Tr.Root,{...e,children:n})}var Rr=Object.assign(fS,{docxSlot:"table.borderTarget",Trigger:Tr.Trigger,Content:_m,Item:Im}),Cr=rc("table.borderStyle","docx-table-chrome docx-table-chrome--style","table.borders.styleAriaLabel");function Dm({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Bt(Cr.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 Nm(e){let{children:t}=e;return jsxRuntime.jsx(Cr.Content,{...e,children:t??editor.TABLE_BORDER_STYLE_OPTIONS.map(n=>jsxRuntime.jsx(Dm,{value:n.value},n.value))})}function gS(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(gS,{docxSlot:"table.borderStyle",Trigger:Cr.Trigger,Content:Nm,Item:Dm}),Pr=rc("table.borderWidth","docx-table-chrome docx-table-chrome--width","table.borderWidth");function Lm({value:e,asChild:t,className:n,children:o}){let{apply:r,setOpen:i,draft:a}=Bt(Pr.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 Fm(e){let{children:t}=e;return jsxRuntime.jsx(Pr.Content,{...e,children:t??editor.TABLE_BORDER_WIDTH_OPTIONS.map(n=>jsxRuntime.jsx(Lm,{value:String(n.size)},n.size))})}function bS(e){let t=e.children??jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pr.Trigger,{}),jsxRuntime.jsx(Fm,{})]});return jsxRuntime.jsx(Pr.Root,{...e,children:t})}var Mr=Object.assign(bS,{docxSlot:"table.borderWidth",Trigger:Pr.Trigger,Content:Fm,Item:Lm});function Am(e,t,n){let o=n?.defaultHex??"FF0000",r=Mm();function i({hidden:d,asChild:m,className:p,children:g}){let{visible:u,enabled:f,disabledReason:b,draft:y,apply:P}=ui(e),[h,v]=nt.useState(false),[S,x]=nt.useState(o),w=nt.useRef(null),C=nt.useRef(null);oc(h,v,w);let k=nt.useMemo(()=>({open:h,setOpen:v,enabled:f,disabledReason:b,apply:P,draft:y,triggerRef:C,lastHex:S,setLastHex:x}),[h,f,b,P,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),P=J(),h=X(e),v=P(h?.labelKey??t),{shared:S,reasonNode:x}=mi({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),P=J(),h=X(e),v=P(h?.labelKey??t),{shared:S,reasonNode:x}=mi({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:km(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:P,triggerRef:h,lastHex:v,setLastHex:S}=Bt(r),x=J(),w=nt.useRef(null);if(Cm(u&&b,f,w,h),!u||!b)return null;let C=x(t),k=e==="table.borderColor"&&P.spec.color.kind==="hex"?P.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),pi(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(Fs,{apply:L=>{f(false),S?.(L),y({kind:"hex",value:L}),pi(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:P,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),P?.(d),b({kind:"hex",value:d}),pi(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 Er=Am("table.borderColor","table.borderColor",{defaultHex:"000000"});function hS(e){return jsxRuntime.jsx(Er.Content,{...e,clearFill:false})}function vS(e){return jsxRuntime.jsx(Er.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function yS(e){return jsxRuntime.jsx(Er.Root,{...e})}var Ir=Object.assign(yS,{docxSlot:"table.borderColor",Trigger:Er.Trigger,Content:hS,Item:vS,Main:Er.Main}),wr=Am("table.cellFill","table.cellFillColor",{clearFill:true,defaultHex:"FFFF00"});function xS(e){return jsxRuntime.jsx(wr.Content,{...e,clearFill:true})}function SS(e){return jsxRuntime.jsx(wr.Item,{...e,css:`#${e.value.toLowerCase()}`,labelKey:"colorPicker.customColor"})}function TS(e){return jsxRuntime.jsx(wr.Root,{...e})}var _r=Object.assign(TS,{docxSlot:"table.cellFill",Trigger:wr.Trigger,Content:xS,Item:SS,Main:wr.Main});function Hm({overrides:e=new Map,separator:t=true}){return Sm()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx(Io,{}):null,[Rr,Ir,kr,Mr,_r].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 Om(){let e=J(),{draft:t}=ui("table.borderTarget");return e(editor.tableChromeLabelKeyForTarget(t.activeTarget))}var lc=["table.borderTarget","table.borderColor","table.borderStyle","table.borderWidth","table.cellFill"],bi="contextual-table",sc={"zoom.level":_s,"styles.style":js,"font.family":zs,"font.size":Is,"text.color":As,"text.highlight":Hs,"text.link":Es,"list.lineSpacing":Ns,"review.editingMode":Oa,"review.authors":Za,"file.save":ws,...fm,"table.borderTarget":Rr,"table.borderColor":Ir,"table.borderStyle":kr,"table.borderWidth":Mr,"table.cellFill":_r,"image.insert":Yn,"image.properties":gn,"image.wrap":mr,"image.altText":fr},fi={id:bi,labelKey:"formattingBar.groups.table",entries:lc.map(e=>({slot:e,Part:sc[e]}))},Bm=new Map;function ES(e){let t=Bm.get(e);return t||(t=n=>jsxRuntime.jsx(So,{slot:e,...n}),Bm.set(e,t)),t}function wS(e){return editor.formattingBarChromeGroups(e).map(t=>t.id==="alignment"?{id:t.id,labelKey:t.labelKey,entries:[{slot:"alignment",Part:ni}]}:{id:t.id,labelKey:t.labelKey,entries:t.controls.map(n=>{let o=editor.chromeSlotId(t,n);return {slot:o,Part:sc[o]??ES(o)}})})}var RS=e=>e.image,kS=e=>e.isLoading||e.isOpening===true,MS=e=>e.table!==null;function IS(e){return e==="alignment"||e in sc}function vi(e){let t=un(e,vi);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 ac(e){if(e==null||typeof e=="boolean")return false;if(Array.isArray(e))return e.some(ac);let t=vi(e);return t!=null&&lc.includes(t)?true:nt.isValidElement(e)?nt.Children.toArray(e.props.children).some(ac):false}function _S(e,t){return t?true:nt.Children.toArray(e).some(ac)}function DS(e){let t=ot(),{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=Ca(o),d=O(RS),m=O(kS),p=O(MS),g=nt.useMemo(()=>wS(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=>!us.has(S)),...p?[bi]:[]],[g,p]),b=nt.useMemo(()=>Ju(f),[f]),y=i&&a,{attach:P,overflow:h}=sp(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=vi(M);E&&u.has(E)?x.set(E,M):E&&lc.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=Zm(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=us.has(M.id);_.push(jsxRuntime.jsx("div",{className:"docx-toolbar__group",...E?{[ur]:""}:{[pn]:M.id},children:M.entries.map(D=>jsxRuntime.jsx(nt.Fragment,{children:k(D)},D.slot))},M.id));}let I=h.has(bi);if(p&&I){let M=fi.entries.flatMap(E=>{let D=Zm(E,w,s,fi.labelKey,R);return D===null?[]:[jsxRuntime.jsx(nt.Fragment,{children:D},E.slot)]});M.length>0&&L.unshift({id:fi.id,labelKey:fi.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]:bi,children:jsxRuntime.jsx(Hm,{overrides:w,separator:false})}),C.length>0?jsxRuntime.jsx("div",{className:"docx-toolbar__group",[ur]:"",children:C}):null,L.length>0?jsxRuntime.jsx(mp,{sections:L}):null]});}return jsxRuntime.jsx(xo.Provider,{value:c,children:jsxRuntime.jsx(Gu,{children:jsxRuntime.jsx("fieldset",{ref:P,disabled:m,role:"toolbar","data-testid":"docx-toolbar",className:`${t}docx-toolbar${n?` ${n}`:""}`,...y?{"data-overflow":""}:{},onMouseDown:B,children:_S(l,i)?jsxRuntime.jsx(Qs,{children:v}):v})})})}function qm(e){if(!e)return false;if(e.type===nt.Fragment){let t=nt.Children.toArray(e.props.children).find(n=>vi(n)!==null);return nt.isValidElement(t)?qm(t):false}return !!e.props.hidden}function Zm(e,t,n,o,r){let i=t.get(e.slot);return qm(i)?null:i||IS(e.slot)?jsxRuntime.jsx(up,{label:NS(n,e,o),children:r(e)}):jsxRuntime.jsx(pp,{slot:e.slot})}function NS(e,t,n){let o=t.slot==="alignment"?null:X(t.slot);return e(o?.labelKey??n)}var Nr=Object.assign(DS,{Button:So,Action:Bs,Separator:Io,Undo:Tp,Redo:Cp,Bold:Pp,Italic:Ep,Underline:wp,Strike:Rp,Link:Es,ClearFormatting:kp,Superscript:Mp,Subscript:Ip,Alignment:ni,AlignLeft:_p,AlignCenter:Dp,AlignRight:Np,AlignJustify:Lp,LineSpacing:Ns,BulletList:Fp,NumberedList:Ap,Outdent:Hp,Indent:Op,ImageInsert:Yn,ImageProperties:gn,ImageWrap:mr,ImageAltText:fr,TableInsert:Bp,TableBorderTarget:Rr,TableBorderColor:Ir,TableBorderStyle:kr,TableBorderWidth:Mr,TableCellFill:_r,Comments:Zp,FontFamily:zs,FontSize:Is,FontColor:As,Highlight:Hs,Zoom:_s,StylePicker:js,EditingMode:Oa,Reviewers:Za,Save:ws,ContentControlShowAll:ii,ContentControlFormFill:li,ContentControlInspector:ci,ContentControlRemove:si});var HS=e=>e.pageSetup??null,OS=e=>e.editable;function No(){let e=H(),t=O(HS),n=O(OS),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 dc=[{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}],jm=1440,BS=e=>Math.round(e/jm*100)/100,ZS=e=>Math.round(e*jm);function qS(e,t){let n=Math.min(e,t),o=Math.max(e,t);return dc.findIndex(r=>Math.abs(r.width-n)<20&&Math.abs(r.height-o)<20)}var KS={position:"fixed",inset:0,backgroundColor:"var(--doc-overlay)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},zS={backgroundColor:"var(--doc-surface)",borderRadius:8,boxShadow:"0 4px 20px var(--doc-shadow)",minWidth:400,maxWidth:480,width:"100%",margin:20},VS={padding:"16px 20px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:16,fontWeight:600,color:"var(--doc-text)"},$S={padding:"16px 20px",display:"flex",flexDirection:"column",gap:14},$m={fontSize:12,fontWeight:600,color:"var(--doc-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},yi={display:"flex",alignItems:"center",gap:12},xi={width:80,fontSize:13,color:"var(--doc-text-muted)"},Si={flex:1,padding:"6px 8px",border:"1px solid var(--doc-border)",borderRadius:4,fontSize:13,backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},WS={fontSize:11,color:"var(--doc-text-muted)",width:16},US={padding:"12px 20px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"flex-end",gap:8},Wm={padding:"6px 16px",fontSize:13,border:"1px solid var(--doc-border)",borderRadius:4,cursor:"pointer",backgroundColor:"var(--doc-surface)",color:"var(--doc-text)"},Um=12240,Gm=15840,Qt=1440;function Lr({open:e,onClose:t,className:n}){let{t:o}=N(),{pageSetup:r,isEnabled:i,apply:a}=No(),[l,c]=nt.useState(Um),[s,d]=nt.useState(Gm),[m,p]=nt.useState("portrait"),[g,u]=nt.useState(Qt),[f,b]=nt.useState(Qt),[y,P]=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??Um),d(r?.pageHeightTwips??Gm),p(r?.orientation??"portrait"),u(r?.marginsTwips.top??Qt),b(r?.marginsTwips.bottom??Qt),P(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=dc[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=qS(l,s),F=(I,M,E)=>jsxRuntime.jsxs("div",{style:yi,children:[jsxRuntime.jsx("label",{style:xi,children:o(`dialogs.pageSetup.${I}`)}),jsxRuntime.jsx("input",{type:"number",style:Si,min:0,max:22,step:.1,value:BS(M),onChange:D=>E(Math.max(0,ZS(Number(D.target.value)||0))),"aria-label":o(`dialogs.pageSetup.${I}`)}),jsxRuntime.jsx("span",{style:WS,children:"in"})]});return jsxRuntime.jsx("div",{className:n,style:KS,onClick:t,onKeyDown:I=>{I.key==="Escape"&&t(),I.key==="Enter"&&_();},children:jsxRuntime.jsxs("div",{ref:w,tabIndex:-1,style:zS,onClick:I=>I.stopPropagation(),onMouseDown:I=>I.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":o("dialogs.pageSetup.title"),children:[jsxRuntime.jsx("div",{style:VS,children:o("dialogs.pageSetup.title")}),jsxRuntime.jsxs("div",{style:$S,children:[jsxRuntime.jsx("div",{style:$m,children:o("dialogs.pageSetup.pageSize")}),jsxRuntime.jsxs("div",{style:yi,children:[jsxRuntime.jsx("label",{style:xi,children:o("dialogs.pageSetup.sizeLabel")}),jsxRuntime.jsxs("select",{style:Si,value:L,onChange:I=>k(Number(I.target.value)),"aria-label":o("dialogs.pageSetup.sizeLabel"),children:[dc.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:yi,children:[jsxRuntime.jsx("label",{style:xi,children:o("dialogs.pageSetup.orientation")}),jsxRuntime.jsxs("select",{style:Si,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:{...$m,marginTop:4},children:o("dialogs.pageSetup.margins")}),F("top",g,u),F("bottom",f,b),F("left",y,P),F("right",h,v),jsxRuntime.jsxs("div",{style:yi,children:[jsxRuntime.jsx("label",{style:xi,children:o("dialogs.pageSetup.applyTo")}),jsxRuntime.jsxs("select",{style:Si,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:US,children:[jsxRuntime.jsx("button",{type:"button",style:Wm,onClick:t,children:o("common.cancel")}),jsxRuntime.jsx("button",{type:"button",style:{...Wm,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 Fr=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 Je(){return nt.useContext(Fr)}function Me(){let{t:e}=Je(),{t}=N();return n=>e?.(n)??t(n)}var YS=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i,XS=/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff<>:"/\\|?*]/g;var Ym=new TextEncoder;function JS(e,t){if(Ym.encode(e).length<=t)return e;let n=0,o="";for(let r of e){let i=Ym.encode(r).length;if(n+i>t)break;n+=i,o+=r;}return o}function Xm(e){let t=JS((e??"").replace(/\.docx$/i,"").replace(XS," ").replace(/\s+/g," ").trim().replace(/^[.\s]+/,"").replace(/[.\s]+$/,""),200).trim();return !t||YS.test(t)?"document.docx":`${t}.docx`}function Jm(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 QS="https://github.com/eigenpal/docx-editor/issues/new";function eT(){if(typeof window>"u")return "";try{let e=new URL(window.location.href);return `${e.origin}${e.pathname}`}catch{return ""}}function Qm(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??eT()}`,`- Viewport: ${n.width} x ${n.height}`,`- User agent: ${t}`,""].join(`
2
+ `),i=new URLSearchParams({title:"[Bug] ",body:r});return `${QS}?${i.toString()}`}function Ar(e){typeof window>"u"||window.open(Qm(e),"_blank","noopener,noreferrer");}var uc=6,tf=6;function Ie(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 Or({label:e,labelKey:t,className:n,hidden:o,children:r}){let i=Me();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}=Je(),m=Me();if(r)return null;let p=X(e),g=m(t??p?.labelKey??e),u=editor.chromeSlotIsToggle(e),f=["setAlignment","setReviewDisplayMode"].includes(editor.commandForSlot(e)?.type??"");return jsxRuntime.jsx(Ie,{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 nf(e,t,n,o){return Object.assign(({className:i,hidden:a})=>{let l=Je(),c=Me(),s=o(l);if(a)return null;let d=X(e),m=c(t??d?.labelKey??e);return jsxRuntime.jsx(Ie,{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 mc=nf("file.open","toolbar.open","toolbar.openShortcut",e=>e.onOpen),fc=nf("file.save","toolbar.save","toolbar.saveShortcut",e=>e.onSave);function iT({className:e,hidden:t}){let n=H(),o=Je(),r=Me(),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(Ie,{slot:"file.pageSetup",icon:Q(s?.paths),disabled:!m,...c?{title:c}:{},onSelect:()=>{o.onPageSetup?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}function lT({className:e,hidden:t}){let n=H(),o=Je(),r=Me(),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(Ie,{slot:"paragraph.dialog",icon:Q(s?.paths),disabled:!m,...c?{title:c}:{},onSelect:()=>{o.onParagraphDialog?.(),o.setOpenMenu(null);},...e?{className:e}:{},children:d})}var sT=Object.assign(lT,{docxSlot:"paragraph.dialog"}),gc=Object.assign(iT,{docxSlot:"file.pageSetup"});function cT({className:e,hidden:t}){let n=jn(),o=Je(),r=Me();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(Ie,{slot:"image.insert",icon:Q(i?.paths),disabled:!l,...c?{title:c}:{},onSelect:()=>{n?.openFilePicker(),o.setOpenMenu(null);},...e?{className:e}:{},children:a})}var bc=Object.assign(cT,{docxSlot:"image.insert"}),Hr=8;function kt({labelKey:e,paths:t,className:n,children:o}){let r=Me(),[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,P=u.offsetHeight,h=b.right+y>f.innerWidth-Hr;p({left:h?Math.max(Hr,b.left-y):Math.min(b.right,f.innerWidth-y-Hr),top:Math.max(Hr,Math.min(b.top-4,f.innerHeight-P-Hr))});},[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 Ci({slot:e="table.insert",className:t}){let n=H(),{isEnabled:o}=le(e),{setOpenMenu:r}=Je(),i=Me(),[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(tf,Math.max(1,f.rows+(u.rows??0))),cols:Math.min(uc,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<=tf;u+=1){let f=[];for(let b=1;b<=uc;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:uc});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 dT({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(Ci,{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 Br({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(Br,{entry:t},n))}):e.slot==="file.open"?jsxRuntime.jsx(mc,{}):e.slot==="file.save"?jsxRuntime.jsx(fc,{}):e.slot==="file.pageSetup"?jsxRuntime.jsx(gc,{}):e.slot==="paragraph.dialog"?jsxRuntime.jsx(sT,{}):e.slot==="image.insert"?jsxRuntime.jsx(bc,{}):e.picker==="tableGrid"?jsxRuntime.jsx(dT,{entry:e}):jsxRuntime.jsx(Zt,{slot:e.slot,...e.labelKey?{labelKey:e.labelKey}:{},...e.shortcutKey?{shortcutKey:e.shortcutKey}:{}})}function rf(e){if(!nt.isValidElement(e))return null;let t=un(e,rf);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 uT(e,t){return e.kind==="item"?e.slot:e.kind==="submenu"?`submenu:${e.labelKey}`:`separator:${t}`}function pT(e,t,n){return Ka({entries:e??[],children:t,preset:n,keyOfEntry:uT,keyOfChild:rf,renderEntry:o=>jsxRuntime.jsx(Br,{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}=Je(),m=Me(),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),P=c===e;if(i)return null;let h=n??m(t??y?.labelKey??e),v=pT(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":P,"aria-controls":P?p:void 0,className:"docx-menubar__trigger",tabIndex:d===e?0:-1,...P?{"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"&&P&&(x.preventDefault(),S());},onClick:()=>{if(b.current){b.current=false;return}s(P?null:e);},onMouseEnter:()=>{c!==null&&c!==e&&(b.current=true,s(e));},onMouseLeave:()=>{b.current=false;},children:[o?jsxRuntime.jsx("span",{className:"docx-menubar__trigger-icon","aria-hidden":"true",children:o}):null,h]}),P?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 hc(e){return Object.assign(n=>jsxRuntime.jsx(to,{id:e,...n}),{docxMenu:e})}var vc=hc("file"),yc=hc("format"),xc=hc("insert");function mT({className:e,hidden:t,onSelect:n}){let{setOpenMenu:o,onReportIssue:r,reportIssue:i}=Je(),a=Me();if(t||i===false)return null;let l=n??r??Ar;return jsxRuntime.jsx(Ie,{slot:"help.reportIssue",onSelect:()=>{l(),o(null);},...e?{className:e}:{},children:a("toolbar.reportIssue")})}var Pi=Object.assign(mT,{docxSlot:"help.reportIssue"});function fT({children:e,...t}){let{reportIssue:n}=Je();return e===void 0&&n===false?null:jsxRuntime.jsxs(to,{id:"help",...t,children:[jsxRuntime.jsx(Pi,{}),e]})}var Sc=Object.assign(fT,{docxMenu:"help"});var hT=e=>e.hiddenReviewAuthors??[];function Ei({className:e,hidden:t}){let n=H(),o=ar(),r=O(hT),i=Me(),{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(Ie,{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(af,{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(af,{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 af(e){return jsxRuntime.jsx(Ie,{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 vT({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(Ei,{className:"docx-menubar__reviewers-submenu"})}),e]})}var wi=Object.assign(vT,{docxMenu:"review"});var ST={file:vc,format:yc,insert:xc,review:wi,help:Sc},TT=new Set(editor.CHROME_MENUS.map(e=>e.id));function ff(e){if(!nt.isValidElement(e))return null;if(e.type===nt.Fragment){let o=nt.Children.toArray(e.props.children).map(ff).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"&&TT.has(n))return n}return null}function CT(e){let t=ot(),{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,P]=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=>Jm(V,Xm(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,he=bn(k.current)??k.current;!re||!he?.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=ff(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 he=ST[ne.id];return jsxRuntime.jsx(he,{},ne.id)}),$]});}return jsxRuntime.jsxs(Fr.Provider,{value:ae,children:[jsxRuntime.jsx("div",{ref:V=>{if(k.current=V,V&&h===null){let $=ec(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=ec($),re=ne.indexOf(document.activeElement);if(re===-1)return;V.preventDefault();let he=V.key==="ArrowRight"?1:-1,ve=ne[(re+he+ne.length)%ne.length],U=ve?.closest("[data-menu]")?.getAttribute("data-menu");U&&(v(U),ve?.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)&&(P($.name),a?.($),$.arrayBuffer().then(ne=>g.load(new Uint8Array(ne))).catch(ne=>{console.error("[docx-editor] could not open the file",ne);}));}}),jsxRuntime.jsx(Lr,{open:S,onClose:()=>x(false)}),jsxRuntime.jsx(Mo,{open:w,onClose:()=>C(false)})]})}var qr=Object.assign(CT,{Menu:to,File:vc,Format:yc,Insert:xc,Review:wi,Help:Sc,Item:Zt,Row:Ie,Group:Or,Separator:Fo,Submenu:kt,TableGrid:Ci,Entry:Br,Open:mc,Save:fc,PageSetup:gc,ImageInsert:bc,Reviewers:Ei,ReportIssue:Pi});var kT=12240,hf=1440,xf=1440,Sf=567,Ao=20,Cc=6,Ec=Ao+Cc+2,MT="var(--doc-text-muted)",IT="var(--doc-text-subtle)",vf="var(--doc-shadow-subtle)",_T="var(--doc-primary)",DT="var(--doc-primary-hover)",NT="var(--doc-text-subtle)",zr=5,Kr=7,LT={left:0,right:0,firstLine:0};function yf(e,t){return t==="inch"?(e/xf).toFixed(2)+'"':(e/Sf).toFixed(1)+" cm"}function FT(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,P]=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??kT,_=e?.marginsTwips.left??hf,L=e?.marginsTwips.right??hf,F=e?.gutterTwips??0,I={pageWidth:R,leftMargin:_,rightMargin:L},M=l??LT,E=Ee(R)*t,D=Ee(_)*t,ae=Ee(L)*t,z=nt.useCallback(Z=>{let Re=k.current?.getBoundingClientRect();return Re?Ma((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?.(),P(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*FT(m,ce),M,I,{unit:m,precise:true});s?.(We),d?.();},[M,I,m,s,d]),re=qT(R,t,m),he=a&&c&&s!==void 0,ve=Z=>Ee(editor.handlePosition(Z,M,I))*t,U=(Z,Re,ce)=>({positionPx:ve(Z),editable:he,isDragging:y===Z,isHovered:h===Z,onPointerEnter:()=>v(Z),onPointerLeave:()=>v(null),onPointerDown:de=>{he&&(de.preventDefault(),de.stopPropagation(),de.currentTarget.setPointerCapture(de.pointerId),P(Z));},onPointerMove:de=>{y===Z&&V(Z,de.clientX,de.altKey);},onPointerUp:de=>{y===Z&&(de.currentTarget.releasePointerCapture(de.pointerId),$(Z));},onKeyDown:de=>{he&&(de.key!=="ArrowLeft"&&de.key!=="ArrowRight"||(de.preventDefault(),ne(Z,de.key==="ArrowLeft"?-1:1,de.shiftKey)));},label:b(Re),valueNow:ce,valueText:yf(ce,m),pageWidthTwips:R});return jsxRuntime.jsxs("div",{ref:k,className:`docx-horizontal-ruler ${p}`,style:{position:"relative",width:je(E),height:Ec,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:vf,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),P("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:vf,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),P("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(AT,{tick:Z},Re))}),u?.map(Z=>jsxRuntime.jsx(ZT,{tabMark:Z,positionPx:Ee(Z.position)*t,onDoubleClick:()=>f?.(Z.position)},Z.position)),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tc,{direction:"down",anchor:"top",...U("firstLine","ruler.firstLineIndent",M.firstLine)}),jsxRuntime.jsx(Tc,{direction:"up",anchor:"strip",...U("hanging","ruler.hangingIndent",M.left)}),jsxRuntime.jsx(HT,{...U("left","ruler.leftIndent",M.left)}),jsxRuntime.jsx(Tc,{direction:"up",anchor:"strip",...U("right","ruler.rightIndent",M.right)})]}),y&&S!==null&&w!==null&&jsxRuntime.jsx(OT,{value:yf(S,m),positionPx:w})]})}function AT({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:IT}}),e.label&&jsxRuntime.jsx("div",{style:{position:"absolute",left:je(e.position),top:2,transform:"translateX(-50%)",fontSize:"9px",color:MT,fontFamily:"sans-serif",whiteSpace:"nowrap"},children:e.label})]})}function Tf(e){return e.editable?e.isDragging||e.isHovered?DT:_T:NT}function Cf(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 Pf(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 Tc({direction:e,anchor:t,...n}){let o=Tf(n),r=t==="top"?{top:0,height:Kr+1}:{top:Ao-Kr,height:Kr};return jsxRuntime.jsx("div",{className:"docx-ruler-indent",style:Cf(n,zr*2,r),onPointerEnter:n.onPointerEnter,onPointerLeave:n.onPointerLeave,onPointerDown:n.onPointerDown,onPointerMove:n.onPointerMove,onPointerUp:n.onPointerUp,onKeyDown:n.onKeyDown,...Pf(n),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:0,width:0,height:0,borderLeft:`${zr}px solid transparent`,borderRight:`${zr}px solid transparent`,...e==="down"?{top:0,borderTop:`${Kr}px solid ${o}`}:{bottom:0,borderBottom:`${Kr}px solid ${o}`},transition:"border-color 0.1s"}})})}function HT(e){return jsxRuntime.jsx("div",{className:"docx-ruler-indent docx-ruler-indent--box",style:Cf(e,zr*2,{top:Ao+1,height:Cc}),onPointerEnter:e.onPointerEnter,onPointerLeave:e.onPointerLeave,onPointerDown:e.onPointerDown,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onKeyDown:e.onKeyDown,...Pf(e),children:jsxRuntime.jsx("div",{style:{position:"absolute",left:1,top:0,width:zr*2-2,height:Cc,backgroundColor:Tf(e),borderRadius:1,transition:"background-color 0.1s"}})})}function OT({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 BT={left:"L",center:"C",right:"R",decimal:"D",bar:"|"};function ZT({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:BT[e.alignment]||"L"})}function qT(e,t,n){let o=[];if(n==="inch"){let r=xf/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=Sf/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 VT=15840,Rf=1440,$T=1440,WT=567,xn=20,UT="var(--doc-text-muted)",GT="var(--doc-text-subtle)",jT="var(--doc-primary)",YT="var(--doc-primary)",XT="var(--doc-primary-hover)";function Vr({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??VT,b=e?.marginsTwips.top??Rf,y=e?.marginsTwips.bottom??Rf,P=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=Ma(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=QT(f,t,a),k={position:"relative",width:xn,height:je(P),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(JT,{tick:R},_))}),jsxRuntime.jsx(kf,{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(kf,{type:"bottomMargin",position:P-v,editable:n,isDragging:d==="bottomMargin",isHovered:p==="bottomMargin",onMouseEnter:()=>g("bottomMargin"),onMouseLeave:()=>g(null),onMouseDown:R=>S(R,"bottomMargin")})]})}function JT({tick:e}){let t={position:"absolute",top:je(e.position),right:0,height:1,width:e.width,backgroundColor:GT},n={position:"absolute",top:je(e.position),left:2,transform:"translateY(-50%)",fontSize:"9px",color:UT,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 kf({type:e,position:t,editable:n,isDragging:o,isHovered:r,onMouseEnter:i,onMouseLeave:a,onMouseDown:l}){let{t:c}=N(),s=o?XT:r?YT:jT,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 QT(e,t,n){let o=[];if(n==="inch"){let r=$T/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=WT/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 oC=e=>e.formatting?.indent??null,nC=e=>e.editable;function Rc(){let e=H(),t=O(oC),n=O(nC),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 Nf=e=>e.zoom,aC=e=>e.isOpening===true;function Lf(e,t){return !e||Object.keys(t).length===0?e:{...e,marginsTwips:{...e.marginsTwips,...t}}}function Ff(){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 Df(e){let t=e?.snapshot().selection??null;return t?JSON.stringify(t):""}function iC(){let e=H(),{indent:t,isEnabled:n,apply:o}=Rc(),[r,i]=nt.useState(null),a=nt.useRef(null),l=nt.useRef(null),c=nt.useCallback(m=>{l.current===null&&(l.current=Df(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!==Df(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 lC(){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 _i(e){let t=O(Oo),n=O(aC),{pageSetup:o,isEnabled:r}=No(),i=O(Nf),{pending:a,preview:l,commit:c}=Ff(),s=iC(),d=wo(),m=dn(),p=lC();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:Lf(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 Di(e){let t=O(Oo),{pageSetup:n,isEnabled:o}=No(),r=O(Nf),{pending:i,preview:a,commit:l}=Ff(),c=wo(),s=dn(),d=Ru();return t||d!==null&&d>0&&n&&Ee(n.pageWidthTwips)*r>d-c-s.inlineStart-s.inlineEnd?null:jsxRuntime.jsx(Vr,{pageSetup:Lf(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 cC(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 dC(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 uC(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 pC(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 mC(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 fC(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 gC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"})})}function bC(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 hC(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 vC(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 yC(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 xC(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 SC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z"})})}function TC(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 CC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Zm0-160v-80h480v80H120Zm0-160v-80h720v80H120Z"})})}function PC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm160-160v-80h400v80H280ZM120-440v-80h720v80H120Zm160-160v-80h400v80H280ZM120-760v-80h720v80H120Z"})})}function EC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-760v-80h720v80H120Zm240 160v-80h480v80H360ZM120-440v-80h720v80H120Zm240 160v-80h480v80H360ZM120-120v-80h720v80H120Z"})})}function wC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Zm0-160v-80h720v80H120Z"})})}function _c(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 RC(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 kC(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 MC(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 IC(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 _C(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 DC(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 NC(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 LC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M480-360 280-560h400L480-360Z"})})}function FC(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 AC(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 HC(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 OC(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 BC(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 Af(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-120v-720h720v720H120Zm640-80v-240H520v240h240Zm0-560H520v240h240v-240Zm-560 0v240h240v-240H200Zm0 560h240v-240H200v240Z"})})}function ZC(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 qC(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 KC(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 zC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"})})}function VC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M200-440v-80h560v80H200Z"})})}function $C(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 WC(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 UC(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 GC(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 jC(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 YC(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 XC(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 JC(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 QC(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M160-440v-80h640v80H160Z"})})}function eP(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 tP(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 oP(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 nP(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 rP(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 aP(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 iP(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 lP(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 sP(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 cP(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 dP(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 uP(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 pP(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 mP(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 fP(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 gP(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 bP(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 hP(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 vP(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 yP(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 xP(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 SP(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 TP(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 CP(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 PP(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 EP(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 wP(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 RP(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 kP(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 MP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-160v-40h720v40H120Zm0-120v-80h720v80H120Zm0-160v-120h720v120H120Zm0-200v-160h720v160H120Z"})})}function IP(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 _P(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 DP(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 NP(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 LP(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 FP(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 AP(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 HP(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 OP(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 BP(e){return jsxRuntime.jsx(A,{...e,children:jsxRuntime.jsx("path",{d:"M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"})})}function ZP(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 qP(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 KP(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 zP(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 VP(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 $P(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 WP(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 UP(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 GP(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 jP(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 YP(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 XP(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 JP(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 QP(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 eE={undo:cC,redo:dC,print:uC,file_download:pC,file_upload:mC,format_bold:fC,format_italic:gC,format_underlined:bC,strikethrough_s:hC,superscript:vC,subscript:yC,link:xC,format_clear:TC,format_paragraph:SC,format_align_left:CC,format_align_center:PC,format_align_right:EC,format_align_justify:wC,format_line_spacing:_c,format_list_bulleted:RC,format_list_numbered:kC,format_indent_increase:MC,format_indent_decrease:IC,format_color_text:_C,ink_highlighter:DC,format_color_reset:NC,arrow_drop_down:LC,table:FC,table_chart:AC,grid_on:HC,table_rows:OC,view_column:BC,border_all:Af,select_all:Af,border_outer:ZC,border_inner:qC,border_clear:KC,add:zC,remove:VC,delete:$C,delete_sweep:WC,call_merge:UC,call_split:GC,drag_indicator:jC,image:YC,format_image_left:XC,format_image_right:JC,horizontal_rule:QC,flip_to_back:eP,flip_to_front:tP,open_with:oP,tune:nP,rotate_right:rP,rotate_left:aP,swap_horiz:iP,swap_vert:lP,shapes:sP,format_paint:cP,expand_more:dP,expand_less:uP,border_top:pP,border_bottom:mP,border_left:fP,border_right:gP,border_horizontal:bP,border_vertical:hP,padding:vP,text_rotation_none:yP,wrap_text:xP,height:SP,fit_width:TP,settings:CP,border_color:PP,format_color_fill:EP,vertical_align_top:wP,vertical_align_center:RP,vertical_align_bottom:kP,line_weight:MP,keyboard_arrow_up:IP,keyboard_arrow_down:_P,keyboard_arrow_left:DP,keyboard_arrow_right:NP,more_vert:LP,page_break:FP,branding_watermark:AP,arrow_back:HP,search:OP,toc:BP,done_all:ZP,check_circle:qP,chat_bubble_outline:KP,chat_bubble_check:zP,check:VP,close:$P,add_comment:WP,comment:UP,edit_note:GP,rate_review:jP,visibility:YP,format_textdirection_l_to_r:XP,format_textdirection_r_to_l:JP,"agent-sparkle":QP};function K({name:e,size:t=20,className:n="",style:o}){let r=eE[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 $r=12,Dc=240,Of=16,aE=24,iE=$r+Dc+Of,Sn=12,lE=36,sE=Sn+lE+Of,Wr=nt__namespace.default.memo(function({headings:t,onHeadingClick:n,onClose:o,topOffset:r=0,scrollLeft:i=0,leftOffset:a=$r}){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:Dc,paddingTop:aE,display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"'Google Sans', Roboto, Arial, sans-serif",zIndex:40,transform:c?"translateX(0)":`translateX(-${a+Dc}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 uE=e=>e,pE=Object.freeze([]),mE=()=>{};function Nc(e){let t=H(),n=O(uE),o=nt.useMemo(()=>t&&!n.isLoading?t.getOutline():pE,[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(Wr,{headings:o,onHeadingClick:r,onClose:e.onClose??mE,topOffset:e.topOffset??0,...e.leftOffset!==void 0?{leftOffset:e.leftOffset}:{}})}var Lc=nt.createContext(null);function ro(e){let t=nt.useContext(Lc);if(!t)throw new Error(`<DocxEditor.Navigation.${e}> must be rendered inside <DocxEditor.Navigation>`);return t}var Tn=280,Ni=32,Bf=16;function Zo(e=280){return 32+e+16}function Li({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 yE=Object.freeze([]),xE=e=>e;function Fi(){let e=H(),t=O(xE),[n,o]=nt.useState(null),r=nt.useMemo(()=>e&&!t.isLoading?e.getOutline():yE,[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 Hc=150,Oc=2e3,Ac=Object.freeze([]),CE=e=>e;function Ai(){let e=H(),t=O(CE),[n,o]=nt.useState(""),[r,i]=nt.useState(""),[a,l]=nt.useState(false),[c,s]=nt.useState(false),[d,m]=nt.useState(Ac),[p,g]=nt.useState(-1);nt.useEffect(()=>{if(n===r)return;let x=setTimeout(()=>i(n),Hc);return ()=>clearTimeout(x)},[n,r]);let u=nt.useMemo(()=>({matchCase:a,wholeWord:c}),[a,c]);nt.useEffect(()=>{if(!e||r.length===0){m(Ac),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]),P=nt.useCallback(()=>y(1),[y]),h=nt.useCallback(()=>y(-1),[y]),v=nt.useCallback(x=>o(x),[]),S=nt.useCallback(()=>{o(""),i(""),m(Ac),g(-1);},[]);return {query:n,setQuery:v,matchCase:a,setMatchCase:l,wholeWord:c,setWholeWord:s,matches:d,truncated:d.length>=Oc,activeIndex:p,goTo:b,next:P,previous:h,clear:S,isPending:n!==r}}var ME=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)}},IE=(e,t)=>e.zoom===t.zoom&&e.reviewPaneOpen===t.reviewPaneOpen&&e.fitting===t.fitting&&e.pageSetup?.pageWidthTwips===t.pageSetup?.pageWidthTwips;function Hi(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(),P=At(),h=nt.useContext(mt),{pageSetup:v,zoom:S,reviewPaneOpen:x,fitting:w}=O(ME,IE),[C,k]=nt.useState(0),[R,_]=nt.useState(0),[L,F]=nt.useState(0);nt.useEffect(()=>{if(!P){k(0),_(0),F(0);return}let D=()=>{k(P.clientWidth);let z=getComputedStyle(P),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(P),()=>ae.disconnect()},[P,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:Li({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 Gr=["headings","find"],It=(...e)=>e.filter(Boolean).join(" ");function jr({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(Yr,{}),jsxRuntime.jsx(Xr,{})]})})}function Yr({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 Xr({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 Jr({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=Gr.indexOf(o.tab);o.setTab(Gr[(c+l+Gr.length)%Gr.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??Gr.map(a=>jsxRuntime.jsx(Qr,{value:a},a))})}function Qr({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 qf({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 ea({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(qf,{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 LE({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 ta({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(qf,{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(LE,{match:c,active:s===o.activeIndex,onSelect:()=>o.goTo(s)},`${c.blockId}-${c.start}-${s}`))})]})}function oa({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 qc(e){let t=ot(),{t:n,toggle:o=true,className:r,style:i,children:a,...l}=e,c=Hi(l),s=Fi(),d=Ai(),{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(Lc.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(oa,{...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(jr,{}),jsxRuntime.jsx(Jr,{}),jsxRuntime.jsx(ea,{}),jsxRuntime.jsx(ta,{})]})})]})})}var Oi=Object.assign(qc,{Header:jr,Close:Yr,Title:Xr,Tabs:Jr,Tab:Qr,Headings:ea,Find:ta,Toggle:oa});var qE=600,KE=e=>e.page.total,Bi=nt.createContext(null);function Zi({className:e,style:t}){let n=ot(),o=H(),r=At(),i=O(KE),{t:a}=N(),l=nt.useContext(Bi),[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),qE);};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 $E=[],WE=e=>e.fontSubstitutions??$E;function qi({className:e,style:t,t:n}){let o=O(WE),{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 Qe={hfInlineEditor:10,chrome:50,ruler:30,outline:40,popover:100,toolbar:100,modal:1e4};function Kc(e){return Math.round(e/1440*100)/100}function $f(e){return Math.round(e*1440)}function jE(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 zc(){let e=H(),t=nt.useCallback(n=>e?.getHeaderFooterState()??null,[e]);return O(t,jE)}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 na(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,P=t==="story-label"?6:4,h=l===c,v=t==="after"?b.bottom+6:b.top-y-P,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 e1(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 t1=[{field:"PAGE",labelKey:"headerFooter.insertPageNumber"},{field:"NUMPAGES",labelKey:"headerFooter.insertTotalPages"},{field:"SECTIONPAGES",labelKey:"headerFooter.insertSectionPages"},{field:"PAGE_X_OF_Y",labelKey:"headerFooter.insertPageXofY"}];function ra(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 o1(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(Kc(t.headerDistanceTwips))),m(String(Kc(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=ra(p),P=ra(g),h=ra(u),v=ra(f),S=ra(b),x=(w,C)=>{if(!r)return;let k=Number.parseFloat(C);Number.isFinite(k)&&r.exec({type:"setHeaderFooterOptions",[w]:$f(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:[t1.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:!P.enabled,title:P.reason??void 0,onChange:()=>r?.exec(g)}),jsxRuntime.jsxs("span",{children:[o("headerFooter.differentOddEven"),jsxRuntime.jsx("span",{className:"docx-hf-chrome__menu-hint",children:o("headerFooter.differentOddEvenHint")})]})]}),jsxRuntime.jsx("div",{className:"docx-hf-chrome__menu-separator",role:"separator"}),t.inherited?jsxRuntime.jsx("button",{type:"button",role:"menuitem",className:"docx-hf-chrome__menu-item",disabled:!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 Ki({className:e}){let{t}=N(),n=zc(),o=nt.useCallback(l=>l.querySelector("[data-docx-hf-active]"),[]),r=na(o,"story-label"),i=B;if(!n?.editing)return null;let a=e1(n.editing,n.variant);return jsxRuntime.jsxs("div",{ref:r.ref,className:`docx-context-bar docx-hf-chrome${e?` ${e}`:""}`,role:"region","aria-label":t("headerFooter.chromeAriaLabel"),"data-testid":"docx-hf-chrome",onMouseDown:i,style:{...r.style,zIndex:Qe.hfInlineEditor},children:[jsxRuntime.jsxs("div",{className:"docx-context-bar__label",children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:t(a)}),n.inherited?jsxRuntime.jsx("span",{className:"docx-context-bar__status","data-testid":"docx-hf-inherited",title:t("headerFooter.sameAsPreviousHint"),children:t("headerFooter.sameAsPrevious")}):null]}),jsxRuntime.jsx(o1,{state:n,onMouseDown:i})]})}function zo(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var zi=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"})}),c1="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",d1="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",u1="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",p1="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 m1({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 P=a.current;P&&y.target instanceof Node&&P.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:P,top:h}=En(y,f.left,f.top),v=Math.max(0,y.scrollWidth-b.offsetWidth);d({left:Math.max(0,Math.min(P,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(f1,{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 f1({children:e}){let{state:t}=_t(),n=nt.useMemo(()=>g1(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(Yc,{})),o("Error",jsxRuntime.jsx(Jc,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Apply",jsxRuntime.jsx(Xc,{})),o("Cancel",jsxRuntime.jsx(Qc,{}))]}),n.__extra]});let r=t.canEdit&&!(t.link&&Qn(t.link));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o("Url",jsxRuntime.jsx(Wc,{})),jsxRuntime.jsxs("div",{className:"docx-hyperlink-popup__actions",children:[o("Copy",jsxRuntime.jsx(Uc,{})),r?o("Edit",jsxRuntime.jsx(Gc,{})):null,r?o("Unlink",jsxRuntime.jsx(jc,{})):null]}),n.__extra]})}function g1(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)??b1}var b1={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 Wc({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,zi(p1)]})}Wc.docxHyperLinkPart="Url";function Uc({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??zi(c1)})}Uc.docxHyperLinkPart="Copy";function Gc({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??zi(d1)})}Gc.docxHyperLinkPart="Edit";function jc({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??zi(u1)})}jc.docxHyperLinkPart="Unlink";function Yc({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})]})}Yc.docxHyperLinkPart="Fields";function Xc({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 Jc({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")})}Jc.docxHyperLinkPart="Error";Xc.docxHyperLinkPart="Apply";function Qc({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})}Qc.docxHyperLinkPart="Cancel";var Vi=Object.assign(m1,{Url:Wc,Copy:Uc,Edit:Gc,Unlink:jc,Fields:Yc,Error:Jc,Apply:Xc,Cancel:Qc});var x1=e=>e;function rd(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}function $i(){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(x1),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 P=[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:rd,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":P||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:rd,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:rd,onClick:y,children:t("equationPopup.delete")})]})]})}function S1(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 ad(){let e=H(),t=nt.useCallback(o=>{let r=e?.getActiveScope();return r?.kind==="note"?r:null},[e]),n=O(t,S1);return n?.kind==="note"?n:null}function Qf(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 eg(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&&Qf(e.documentAuthored,t.documentAuthored)&&Qf(e.sectionAuthored,t.sectionAuthored)}function T1(e,t){return e===t?true:!e||!t?false:e.sectionIndex===t.sectionIndex&&eg(e.footnote,t.footnote)&&eg(e.endnote,t.endnote)}function id(){let e=H(),t=nt.useCallback(n=>e?.getNotePropertiesState()??null,[e]);return O(t,T1)}var C1=/^(footnote|endnote):(-?\d{1,10})$/;function og(e){let t=C1.exec(e);if(!t)return null;let n=Number(t[2]);return Number.isInteger(n)?{noteKind:t[1],noteId:n}:null}function P1(){return typeof window>"u"?false:window.matchMedia("(pointer: coarse)").matches}function sd(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 E1(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 Wi({className:e}){let{t}=N(),n=H(),o=ad(),[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=na(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(P1())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?og(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]),P=nt.useMemo(()=>f?{type:"convertAllNotes",fromKind:f.noteKind}:null,[f]),h=sd(b??{type:"deleteNote",noteKind:"footnote",noteId:0}),v=sd(y??{type:"convertNote",fromKind:"footnote",noteId:0}),S=sd(P??{type:"convertAllNotes",fromKind:"footnote"}),x=nt.useMemo(()=>({position:"fixed",left:r?.x??0,top:r?.y??0,zIndex:Qe.popover,maxWidth:280,maxHeight:"40vh",overflowY:"auto",padding:"8px 10px",background:"var(--doc-popover-bg, #fff)",color:"var(--doc-popover-fg, #111)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",fontSize:12,lineHeight:1.4,pointerEvents:"none"}),[r]),w=o?og(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:Qe.chrome},children:[jsxRuntime.jsx("span",{className:"docx-context-bar__title",children:C}),jsxRuntime.jsx(E1,{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:Qe.popover,minWidth:160,background:"var(--doc-popover-bg, #fff)",border:"1px solid var(--doc-border, #ddd)",boxShadow:"var(--doc-shadow, 0 4px 16px rgba(0,0,0,.12))",padding:4},onMouseDown: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:()=>P&&u(P),children:f.noteKind==="footnote"?t("notes.convertAllFootnotes"):t("notes.convertAllEndnotes")}),jsxRuntime.jsx("button",{type:"button",role:"menuitem",onClick:()=>s(true),children:t("dialogs.footnoteProperties.title")})]}):null,c?jsxRuntime.jsx(w1,{onClose:()=>s(false),onApply:k=>{u(k),s(false);}}):null]}):null}function w1(e){let{t}=N(),n=H(),o=id(),[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 P=!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:Qe.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")}),P?jsxRuntime.jsx("span",{className:"docx-note-properties__badge",children:t("notes.inheritedValue")}):null]}),jsxRuntime.jsxs("div",{className:"docx-note-properties__fields",children:[jsxRuntime.jsxs("label",{className:"docx-note-properties__field",children:[jsxRuntime.jsx("span",{children:t("dialogs.footnoteProperties.numberFormat")}),jsxRuntime.jsxs("select",{className:"docx-note-properties__select",value:a,onChange: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 Ui=nt.createContext({close:()=>{},anchor:null,tocId:null,target:null,clipboardRefusal:null,reportClipboardRefusal:()=>{}});function ao(){return nt.useContext(Ui)}function ag(){return nt.useContext(Ui).target}var ig=["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"],lg=["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"],dd=["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"],sg=["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"],cg=["M120-240v-80h240v80H120Zm0-200v-80h480v80H120Zm0-200v-80h720v80H120Z"],dg=["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"],ug=["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=Me(),{isEnabled:p,disabledReason:g}=le(t);return c?null:jsxRuntime.jsx(Ie,{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 ia=kn("edit.cut",{type:"cut"},{labelKey:"contextMenu.cut",shortcutKey:"contextMenu.cutShortcut",paths:ig}),la=kn("edit.copy",{type:"copy"},{labelKey:"contextMenu.copy",shortcutKey:"contextMenu.copyShortcut",paths:lg}),sa=kn("edit.delete",{type:"deleteText"},{labelKey:"contextMenu.delete",shortcutKey:"contextMenu.deleteShortcut",paths:sg}),ca=kn("edit.selectAll",{type:"selectAll"},{labelKey:"contextMenu.selectAll",shortcutKey:"contextMenu.selectAllShortcut",paths:ug});function Mn({icon:e,labelKey:t,shortcutKey:n,className:o,hidden:r}){let i=H(),{close:a,clipboardRefusal:l,reportClipboardRefusal:c}=ao(),s=Me(),d=nt.useMemo(()=>({type:"paste",text:" "}),[]),{isEnabled:m,disabledReason:p}=le(d);if(r)return null;let g=l!==null;return jsxRuntime.jsx(Ie,{slot:"edit.paste",icon:e??Q(dd),shortcut:s(n??"contextMenu.pasteShortcut"),disabled:!m||g,...l??p?{title:l??p??""}:{},onSelect:()=>{(async()=>{try{let{text:u,html:f}=await M1();(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 M1(){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=Me(),d=nt.useMemo(()=>({type:"pasteWithoutFormatting",text:" "}),[]),{isEnabled:m,disabledReason:p}=le(d);if(r)return null;let g=l!==null;return jsxRuntime.jsx(Ie,{slot:"edit.pasteWithoutFormatting",icon:e??Q(dd),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 pg=X("format.painter")?.paths??[],Gi=kn("format.copyFormatting",{type:"copyFormatting"},{labelKey:"contextMenu.copyFormatting",shortcutKey:"contextMenu.copyFormattingShortcut",paths:pg}),ji=kn("format.pasteFormatting",{type:"pasteFormatting"},{labelKey:"contextMenu.pasteFormatting",shortcutKey:"contextMenu.pasteFormattingShortcut",paths:pg});function Vo(e,t,n){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l,destructive:c})=>{let{close:s}=ao(),d=Me(),m=Yi(),{isEnabled:p,disabledReason:g,execute:u}=le(t);return l||!m?null:jsxRuntime.jsx(Ie,{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}),I1=[{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=Me(),o=Yi(),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:I1.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 mg(e,t,n){return Object.assign(({icon:r,labelKey:i,className:a,hidden:l})=>{let c=H(),{close:s,tocId:d}=ao(),m=Me(),p=nt.useMemo(()=>({type:"refreshToc",mode:t,...d?{tocId:d}:{}}),[d]),{isEnabled:g,disabledReason:u}=le(p);return l||d===null?null:jsxRuntime.jsx(Ie,{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=mg("toc.refresh","entire",{labelKey:"toc.refresh",paths:cg}),Bn=mg("toc.refreshPageNumbers","pageNumbers",{labelKey:"toc.refreshPageNumbers",paths:dg});function Yi(){return O(nt.useCallback(e=>e.table!=null,[]),(e,t)=>e===t)}function Xi({label:e,icon:t,shortcut:n,disabled:o,disabledReason:r,active:i,onSelect:a,className:l}){let{close:c}=ao();return jsxRuntime.jsx(Ie,{...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 el=8,L1=e=>e.editingMode==="viewing";function F1(){let e=H(),t=nt.useContext(mt),n=Je(),o=Me(),r=e?.can({type:"toggleReviewPane"}),i=O(L1),a=!r?.ok||i||(t?.mounted??0)===0||e?.getSelectionPlacement()===null,l=X("review.comments");return jsxRuntime.jsx(Ie,{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")})}function A1(){let e=H(),t=Je(),n=Me();return e?.can({type:"editTextFormField"}).ok?jsxRuntime.jsx(Ie,{slot:"field.edit",onSelect:()=>{t.setOpenMenu(null),e.exec({type:"editTextFormField"});},children:n("textFormField.edit")}):null}var H1=[{kind:"row",id:"field.edit",render:()=>jsxRuntime.jsx(A1,{})},{kind:"row",id:"edit.cut",render:()=>jsxRuntime.jsx(ia,{})},{kind:"row",id:"edit.copy",render:()=>jsxRuntime.jsx(la,{})},{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(Gi,{})},{kind:"row",id:"format.pasteFormatting",render:()=>jsxRuntime.jsx(ji,{})},{kind:"separator",id:"sep.clipboard"},{kind:"row",id:"edit.delete",render:()=>jsxRuntime.jsx(sa,{})},{kind:"row",id:"edit.selectAll",render:()=>jsxRuntime.jsx(ca,{})},{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(F1,{})}];function O1(){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 B1(){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 Z1(e,t=false){return [...H1,...e?O1():[],...t?B1():[]]}function vg(e){if(!nt.isValidElement(e))return null;let t=un(e,vg);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 bg(e){if(!nt.isValidElement(e))return false;let t=e.type;return typeof t!="function"&&typeof t!="object"?false:t.docxRowPlacement==="start"}function q1(e){return e?.closest(".docx-editor__scroll-container")??null}function ua({className:e,t,preset:n=true,disabled:o,onOpenChange:r,children:i}){let a=ot(),l=H(),{t:c}=N(),s=Yi(),d=nt.useRef(null),m=nt.useRef(null),[p,g]=nt.useState(null),[u,f]=nt.useState(null),[b,y]=nt.useState(null),P=nt.useMemo(()=>Z1(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=q1(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-el,D=window.innerHeight-M-el,ae=Math.max(el,p.x>E?p.x-I:p.x),z=Math.max(el,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(Fr.Provider,{value:C,children:jsxRuntime.jsx(Ui.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(bg),Ka({entries:P,children:nt.Children.toArray(i).filter(F=>!bg(F)),preset:n,keyOfEntry:F=>F.id,keyOfChild:vg,renderEntry:F=>F.kind==="separator"?jsxRuntime.jsx(Fo,{}):F.render()})]})})}):null})}var md=Object.assign(ua,{Cut:ia,Copy:la,Paste:Mn,PasteWithoutFormatting:In,Delete:sa,SelectAll:ca,InsertRowAbove:_n,InsertRowBelow:Dn,InsertColumnLeft:Nn,InsertColumnRight:Ln,DeleteTableRow:Fn,DeleteTableColumn:An,DeleteTable:Hn,CellVerticalAlignment:$o,RefreshToc:On,RefreshTocPageNumbers:Bn,Item:Xi,Slot:Zt,Row:Ie,Group:Or,Separator:Fo,Submenu:kt});function fd(e){let t=e.target?.tagName;t==="INPUT"||t==="SELECT"||t==="TEXTAREA"||e.preventDefault();}var xg=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"})}),$1="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",W1="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",U1={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},G1={display:"flex",justifyContent:"space-between",gap:12,alignItems:"baseline"},j1={color:"var(--doc-text-muted)",flexShrink:0},Y1={textAlign:"right",wordBreak:"break-word"},X1={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,fontWeight:600},J1={display:"flex",gap:8,marginTop:4},Sg={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 Q1(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 e2(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:G1,"data-testid":n,children:[jsxRuntime.jsx("span",{style:j1,children:e}),jsxRuntime.jsx("span",{style:Y1,children:t})]})}function t2({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 P=a.current;P&&y.target instanceof Node&&P.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(Tg,{}),jsxRuntime.jsx(Cg,{}),jsxRuntime.jsx("div",{style:J1,children:jsxRuntime.jsx(Pg,{})}),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:U1,onMouseDown:f=>{fd(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 Tg({className:e,asChild:t,hidden:n,children:o}){let{closeInspector:r}=Et(),{t:i}=N();if(n)return null;let a={style:X1,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:{...Sg,padding:4,border:"none",background:"transparent"},onMouseDown:fd,onClick:()=>r(),children:xg($1)})]});return t?jsxRuntime.jsx(j,{...a,children:l}):jsxRuntime.jsx("div",{...a,children:l})}function Cg({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(Q1(r.controlType)),testId:"content-control-inspector-type"}),jsxRuntime.jsx(Zn,{label:i("contentControl.inspectorPanel.lock"),value:i(e2(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 Pg({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:Sg,onMouseDown:fd,onClick:()=>{l().ok&&c();}},p=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o??r??xg(W1),jsxRuntime.jsx("span",{children:d})]});return t?jsxRuntime.jsx(j,{...m,children:p}):jsxRuntime.jsx("button",{...m,children:p})}var tl=Object.assign(t2,{Header:Tg,Fields:Cg,Remove:Pg});var a2={display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"var(--doc-bg)"},i2={flex:1,minHeight:0,minWidth:0,overflowAnchor:"none"},l2={position:"relative",display:"flex",flex:1,minHeight:0,minWidth:0},s2={flex:"none",minHeight:34,padding:"6px 0 2px",overflow:"hidden",scrollbarGutter:"stable both-edges",backgroundColor:"var(--doc-bg)"},c2={position:"absolute",top:40,left:0,zIndex:10,pointerEvents:"none"},d2={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)"},u2={padding:"8px 12px"},p2={display:"flex",alignItems:"center",gap:8,padding:"8px 12px 0",color:"var(--doc-text)"},m2={display:"flex",flexDirection:"column",flex:1,minWidth:0,gap:2},f2={flex:1,minWidth:0,font:"inherit",color:"inherit",backgroundColor:"transparent",border:"1px solid transparent",borderRadius:4,padding:"2px 6px"};function g2({forwardedRef:e}){let t=H(),n=nt.useRef(null);return n.current=t,_u({ref:e,editorRef:n}),null}var b2=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:P,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(zd);nt.useEffect(()=>{if(p==="system")return $d(I)},[p]);let M=Vd(p,F),{t:E}=N(),D=nt.useCallback(($,ne)=>a?a($,ne):E($,ne),[a,E]),ae=jsxRuntime.jsxs(Aa,{className:l?M?"dark":void 0:i,style:l?i2:void 0,children:[l?jsxRuntime.jsx(Ki,{}):null,l?jsxRuntime.jsx(Wi,{}):null,jsxRuntime.jsx(ka,{}),jsxRuntime.jsx(Vi,{hidden:C===false}),jsxRuntime.jsx($i,{}),k===false?null:jsxRuntime.jsx(ua,{t:D,...typeof k=="object"?k:{}}),jsxRuntime.jsx(tl,{}),L&&l?jsxRuntime.jsx("div",{style:c2,"aria-hidden":"true",children:jsxRuntime.jsx(Di,{})}):null,t.children]}),z=l?jsxRuntime.jsxs("div",{className:`docx-editor${M?" dark":""}${i?` ${i}`:""}`,style:a2,children:[jsxRuntime.jsxs("div",{style:d2,children:[jsxRuntime.jsxs("div",{style:p2,children:[d?.(),jsxRuntime.jsxs("div",{style:m2,children:[s?jsxRuntime.jsx("input",{"aria-label":D("titleBar.documentNameAriaLabel"),value:c??"",placeholder:D("titleBar.untitled"),onChange:$=>s($.target.value),style:f2}):jsxRuntime.jsx("span",{style:{minWidth:0,padding:"2px 6px"},children:c??D("titleBar.untitled")}),R!==false?jsxRuntime.jsx(qr,{t:D,...c!==void 0?{fileName:c}:{},...x?{onOpen:x}:{},...w?{onSave:w}:{},...typeof R=="object"?R:{}}):null]}),m?.()]}),jsxRuntime.jsx("div",{style:u2,children:jsxRuntime.jsx(Nr,{t:D})})]}),L?jsxRuntime.jsx("div",{style:s2,"data-testid":"docx-editor-ruler-row",children:jsxRuntime.jsx(_i,{})}):null,jsxRuntime.jsx(qi,{t:D}),jsxRuntime.jsxs("div",{style:l2,children:[_?jsxRuntime.jsx(Oi,{t:D}):null,ae,jsxRuntime.jsx(Bi.Provider,{value:D,children:jsxRuntime.jsx(Zi,{})}),jsxRuntime.jsx(Ia,{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}:{},...P!==void 0?{zoomMode:P}:{},tableInteractionLabel:V,...h?{onReady:h}:{},...v?{onChange:v}:{},...S?{onFontError:S}:{},children:[jsxRuntime.jsx(g2,{forwardedRef:n}),jsxRuntime.jsx(ko.Provider,{value:l,children:z})]})}),h2=nt.forwardRef(function(t,n){return jsxRuntime.jsx(nn,{...t.i18n!==void 0?{i18n:t.i18n}:{},children:jsxRuntime.jsx(b2,{...t,ref:n})})}),v2=Object.assign(h2,{Root:or,Viewport:Aa,Content:ka,Toolbar:Nr,Menu:qr,Loading:Ia,ColorByChangeType:Vl,AuthorStyle:$l,HorizontalRuler:_i,VerticalRuler:Di,DocumentOutline:Nc,Navigation:Oi,PageSetupDialog:Lr,ParagraphDialog:Mo,PageNumber:Zi,FontNotice:qi,HeaderFooterChrome:Ki,NotesChrome:Wi,Equation:$i,HyperLink:Vi,ContextMenu:md,ContentControl:tl});function C2(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):null}function gd(e){return Array.isArray(e)?e:[e]}function P2(e){if(typeof e!="function"||editor.isFontResolver(e))return e;let t=e;return editor.defineFontResolver(async()=>t())}function kg(e){return e!==void 0&&gd(e).some(t=>editor.isFontResolver(t))}async function E2(e){return typeof e!="function"?await e:await e()}function w2(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=kg(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(gd(u.current.fonts??[]).map(P2),b)),[]);return nt.useEffect(()=>{let b=u.current.fonts;if(b===void 0){i(void 0),g(true);return}if(kg(b)){g(true);return}g(false);let y=true;return (async()=>{try{let P=await Promise.allSettled(gd(b).map(E2)),h=[];for(let v of P){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(P){console.warn("[fonts] font loading failed; the fixed measurer stays in effect",P);}finally{y&&g(true);}})(),()=>{y=false;}},[m]),nt.useEffect(()=>{if(e==null){o(void 0),l(null),s(false);return}let b=C2(e);if(b){o(b),l(null),s(false);return}let y=true,P=new AbortController;return s(true),l(null),(async()=>{try{let h=await fetch(String(e),{...u.current.fetchOptions,signal:P.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,P.abort();}},[e]),{document:p?n:void 0,fonts:d?f:r,error:a,isLoading:c||!p}}function _2(...e){let t=nt.useRef(e);return t.current=e,nt.useMemo(()=>editor.defineFontResolver(n=>editor.composeFontOrigins(t.current,n)),[])}function L2(e){let n=e?.surface?.state?.().selection?.head;return n&&typeof n.paragraphId=="string"&&Number.isFinite(n.offset)?n:null}function F2(){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=L2(e),i=t.current;return (r===null?i===null:i!==null&&A2(i,r))?i:(t.current=r,r)},[e]);return nt.useSyncExternalStore(n,o,()=>null)}function A2(e,t){return e.paragraphId===t.paragraphId&&e.offset===t.offset}function bd({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:()=>s.current?.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 fa=nt.createContext(null);function Dg(){let e=nt.useContext(fa);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function $2(e){return "type"in e&&e.type==="separator"}var Fg={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"},W2={...Fg,background:"var(--doc-bg-hover)"},Ag={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"},U2={...Ag,opacity:.4,cursor:"default"},G2={height:1,backgroundColor:"var(--doc-border)",margin:"4px 0"},j2={marginLeft:"auto",fontSize:12,color:"var(--doc-text-muted)"},Y2={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 ga({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 P=y.target;c.current&&!c.current.contains(P)&&s.current&&!s.current.contains(P)&&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?W2:Fg,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($2(u))return jsxRuntime.jsx("div",{style:G2},`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,P=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?U2:Ag,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:j2,children:b.shortcut}),y&&jsxRuntime.jsx("span",{style:{marginLeft:"auto"},children:jsxRuntime.jsx(K,{name:"keyboard_arrow_right",size:16})})]}),y&&P&&jsxRuntime.jsx("div",{style:Y2,onMouseDown:h=>h.preventDefault(),children:b.submenuContent(p)})]},b.label)})})]})}var yd=18,J2=2,Og={width:yd,height:yd,backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border)",borderRadius:2,transition:"background-color 0.1s, border-color 0.1s",cursor:"pointer"},Q2={...Og,backgroundColor:"var(--doc-primary)",border:"1px solid var(--doc-primary)"},ew={marginTop:6,fontSize:11,fontWeight:500,color:"var(--doc-text)",textAlign:"center"};function Bg({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?Q2:Og,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:J2,gridTemplateColumns:`repeat(${n}, ${yd}px)`},onMouseLeave:()=>{r(0),a(0);},role:"grid","aria-label":"Table size selector",children:c}),jsxRuntime.jsx("div",{style:ew,children:s})]})}function rw({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 aw(){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 rl({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center flex-shrink-0",children:e})}function iw(e){return e.replace(/\.docx$/i,"")}function Sd({value:e,onChange:t,placeholder:n,editable:o=true}){let{t:r}=N(),i=n??r("titleBar.untitled"),a=iw(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 al({children:e}){return jsxRuntime.jsx("div",{className:"flex items-center gap-2 ml-auto flex-shrink-0",children:e})}function il(){let{t:e}=N(),t=Dg(),{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,P=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(ga,{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(ga,{label:e("toolbar.format"),disabled:n,items:[{icon:"format_textdirection_l_to_r",label:e("toolbar.leftToRight"),onClick:()=>P("setLtr")},{icon:"format_textdirection_r_to_l",label:e("toolbar.rightToLeft"),onClick:()=>P("setRtl")}]}),jsxRuntime.jsx(ga,{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(Bg,{onInsert:(w,C)=>{h(w,C),x();}})}]:[],...c||d&&s?[{type:"separator"}]:[],{icon:"page_break",label:e("toolbar.break"),submenuContent:x=>jsxRuntime.jsx(rw,{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(ga,{label:e("toolbar.help"),disabled:n,items:[{label:e("toolbar.reportIssue"),onClick:()=>Ar()}]})]})}function Td({children:e}){let t=null,n=null,o=[],r=[];nt.Children.forEach(e,a=>{nt.isValidElement(a)&&(a.type===rl?t=a:a.type===al?n=a:a.type===il?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(aw,{})}),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 ll={dk1:"000000",lt1:"FFFFFF",dk2:"44546A",lt2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hlink:"0563C1",folHlink:"954F72"},dw={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:""},Zg={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 uw(e,t){let n=Zg[t]??Zg[t.toLowerCase()]??t,r=e?.colorScheme?.[n];return typeof r=="string"&&r?r:ll[n]??"000000"}function qg(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 Cd(e,t,n="000000"){if(!e||e.kind==="auto")return `#${n}`;if(e.kind==="hex")return `#${qg(e.value)??n}`;let o=Object.entries(t?.colorScheme??ll).map(([i,a])=>({slot:i,hex:String(a)})),r=editor.resolveThemeColorHex(e,o);return `#${r.ok?r.hex:uw(t,e.slot)}`}function zt(e,t){if(!(!e||e.kind==="auto"))return e.kind==="hex"?qg(e.value):Cd(e,t).slice(1)}function Kg(e){if(!e||e==="none")return "";let t=dw[e];return t?`#${t}`:""}var pw=[{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"}],mw=[{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 zg(e){let t=e??ll;return mw.map(n=>pw.map(o=>{let r=t[o.slot]??ll[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 bw=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(bw({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=xe__namespace.Root,so=xe__namespace.Group,sl=xe__namespace.Value;function co({className:e,children:t,onMouseDown:n,...o}){return jsxRuntime.jsxs(xe__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(xe__namespace.Icon,{asChild:true,children:jsxRuntime.jsx(Sw,{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(xe__namespace.Portal,{children:jsxRuntime.jsx("div",{className:te("docx-editor",i&&"dark"),children:jsxRuntime.jsx(xe__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(xe__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(xe__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(xe__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(xe__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(xe__namespace.ItemIndicator,{children:jsxRuntime.jsx(Tw,{className:"h-4 w-4"})})})]})}function Go({className:e,...t}){return jsxRuntime.jsx(xe__namespace.Separator,{className:te("-mx-1 my-1 h-px bg-muted",e),...t})}function Sw({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 Tw({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 Pd(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 Cw=[{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 Wg({value:e,onChange:t,fonts:n=Cw,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()||Pd(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?.(Pd(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(sl,{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 Ed(e){if(e===void 0)return;let t=e.map(n=>typeof n=="string"?{name:n,fontFamily:n,category:"other"}:n);return t}function Rw(e,t,n,o){let i=Math.max(8,window.innerWidth-n-8),a=Math.max(8,window.innerHeight-o-8);return {top:Math.min(Math.max(8,e),a),left:Math.min(Math.max(8,t),i)}}function et({isOpen:e,onClose:t,align:n="left"}){let o=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=Rw(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 Iw=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],_w=1,Dw=400;function jg(e,t,n){for(let o of t)if(o>e)return o;return Math.min(e+1,n)}function Yg(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 Xg({value:e,onChange:t,sizes:n=Iw,disabled:o=false,className:r,placeholder:i="11",minSize:a=_w,maxSize:l=Dw}){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:P,dropdownStyle:h}=et({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=Yg(v,n,a);t?.(M);},[v,n,a,o,t]),w=nt.useCallback(I=>{if(I.preventDefault(),o)return;let M=jg(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=jg(v,n,l);p(M.toString()),t?.(M);}else if(I.key==="ArrowDown"){I.preventDefault();let M=Yg(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:P,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 Fw=[{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"}],dl=18,Aw=2,Hw={position:"relative",display:"inline-block"},Ow={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)"},Bw={padding:"10px",backgroundColor:"var(--doc-surface)",border:"1px solid var(--doc-border-dark)",borderRadius:"6px",boxShadow:"0 4px 16px var(--doc-shadow)",width:"auto"},kd={fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px",fontWeight:500},Md={height:"1px",backgroundColor:"var(--doc-border)",margin:"8px 0"},e0={display:"grid",gap:`${Aw}px`},ul={width:`${dl}px`,height:`${dl}px`,border:"1px solid var(--doc-border-input)",borderRadius:"2px",cursor:"pointer",padding:0,transition:"transform 0.1s, border-color 0.1s"},t0={...ul,transform:"scale(1.15)",borderColor:"var(--doc-text)",zIndex:1},o0={...ul,borderWidth:"2px",borderColor:"var(--doc-primary)",boxShadow:"0 0 0 1px var(--doc-primary)"},Zw={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)"},qw={display:"flex",alignItems:"center",gap:"6px"},Kw={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",fontSize:"12px"},zw={height:"24px",padding:"0 10px",border:"1px solid var(--doc-border-input)",borderRadius:"3px",backgroundColor:"var(--doc-bg-subtle)",fontSize:"12px",cursor:"pointer"},Jg={width:"16px",height:"4px",borderRadius:"1px",marginTop:"-2px"},Vw={display:"inline-flex",alignItems:"stretch",height:"32px",gap:"2px"},$w={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)"},Ww={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 Id(e,t,n){if(!e)return t==="text"||t==="border"?"#000000":"transparent";if(typeof e=="string"){if(t==="highlight"){let o=Kg(e);return o||(e==="none"?"transparent":e.startsWith("#")?e:`#${e}`)}return e.startsWith("#")?e:`#${e}`}return Cd(e,n)}function Qg(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 n0(e,t,n){return e?(typeof e=="string"?e.replace(/^#/,"").toUpperCase():zt(e,n))===t.toUpperCase():false}function Uw({matrix:e,selectedColor:t,theme:n,onSelect:o}){let[r,i]=nt.useState(null);return jsxRuntime.jsx("div",{style:{...e0,gridTemplateColumns:`repeat(10, ${dl}px)`},children:e.flatMap((a,l)=>a.map((c,s)=>{let d=`${l}-${s}`,m=r===d,p=n0(t,c.hex,n);return jsxRuntime.jsx("button",{type:"button",style:{...p?o0:m?t0:ul,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 Gw({selectedColor:e,theme:t,onSelect:n}){let[o,r]=nt.useState(null),{t:i}=N();return jsxRuntime.jsx("div",{style:{...e0,gridTemplateColumns:`repeat(10, ${dl}px)`},children:Fw.map((a,l)=>{let c=o===l,s=n0(e,a.hex,t),d=i(a.nameKey);return jsxRuntime.jsx("button",{type:"button",style:{...s?o0:c?t0:ul,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),[P,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=Id(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}=et({isOpen:p,onClose:k}),F=o?.colorScheme??null,I=nt.useMemo(()=>zg(F),[F]),M=nt.useMemo(()=>Id(t,e,o),[t,e,o]),E=nt.useMemo(()=>Id(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={...Ow,...r?{cursor:"default",opacity:.38}:p?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:u?{backgroundColor:"var(--doc-bg-hover)"}:{}},he=C(e==="text"?"formattingBar.fontColor":e==="highlight"?"formattingBar.highlightColor":"table.borderColor"),ve=c??(e==="text"?"format_color_text":e==="highlight"?"ink_highlighter":"border_color");return jsxRuntime.jsxs("div",{ref:R,className:`docx-color-picker ${i||""}`,style:{...Hw,...a},children:[d?jsxRuntime.jsxs("div",{className:"docx-color-picker-split",style:{...Vw,...r?{opacity:.38,cursor:"default"}:null},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-apply",style:{...$w,...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||he,"aria-label":l||he,children:[jsxRuntime.jsx(K,{name:ve,size:18}),jsxRuntime.jsx("div",{style:{...Jg,backgroundColor:E==="transparent"?"#fff":E,outline:E==="transparent"||Qg(E)?"1px solid #bbb":"none"}})]}),jsxRuntime.jsx("button",{type:"button",className:"docx-color-picker-arrow",style:{...Ww,...r?{cursor:"default"}:p?{backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"}:P?{backgroundColor:"var(--doc-bg-hover)"}:null},onClick:D,onMouseDown:U=>U.preventDefault(),onMouseEnter:()=>h(true),onMouseLeave:()=>h(false),disabled:r,title:l||he,"aria-label":l||he,"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||he,"aria-label":l||he,"aria-haspopup":"true","aria-expanded":p,children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:0},children:[jsxRuntime.jsx(K,{name:ve,size:18}),jsxRuntime.jsx("div",{style:{...Jg,backgroundColor:M==="transparent"?"#fff":M,outline:M==="transparent"||Qg(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,...Bw},role:"dialog","aria-label":`${he} picker`,onMouseDown:U=>{U.target.tagName!=="INPUT"&&U.preventDefault();},children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",style:Zw,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:Md}),jsxRuntime.jsx("div",{style:kd,children:C("colorPicker.themeColors")}),jsxRuntime.jsx(Uw,{matrix:I,selectedColor:t,theme:o,onSelect:ae}),jsxRuntime.jsx("div",{style:Md}),jsxRuntime.jsx("div",{style:kd,children:C("colorPicker.standardColors")}),jsxRuntime.jsx(Gw,{selectedColor:t,theme:o,onSelect:z}),jsxRuntime.jsx("div",{style:Md}),jsxRuntime.jsx("div",{style:kd,children:C("colorPicker.customColor")}),jsxRuntime.jsxs("div",{style:qw,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:Kw,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:{...zw,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 ha=20,_d=[{value:"left",label:"Align Left",labelKey:"alignment.alignLeft",shortcutKey:"alignment.alignLeftShortcut",icon:jsxRuntime.jsx(K,{name:"format_align_left",size:ha}),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:ha}),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:ha}),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:ha}),iconName:"format_align_justify",shortcut:"Ctrl+J"}];function i0({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}=et({isOpen:r,onClose:a}),m=nt.useCallback(y=>{n||t?.(y),i(false);},[n,t]),p=_d.find(y=>y.value===e)||_d[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:ha}),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:_d.map(y=>{let P=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:P?"var(--doc-primary-light)":"transparent",cursor:"pointer",color:P?"var(--doc-primary)":"var(--doc-text)"},onMouseDown:S=>S.preventDefault(),onMouseEnter:S=>{P||(S.currentTarget.style.backgroundColor="var(--doc-bg-hover)");},onMouseLeave:S=>{S.currentTarget.style.backgroundColor=P?"var(--doc-primary-light)":"transparent";},onClick:()=>m(y.value),children:jsxRuntime.jsx(K,{name:y.iconName,size:18})},y.value)})})})]})}function pl(){return {type:"none",level:0,isInList:false}}var Qw={display:"inline-flex",alignItems:"center",gap:"4px"},l0={display:"inline-flex",alignItems:"center",gap:"4px"},bl={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)"},e8={...bl,backgroundColor:"var(--doc-bg-hover)"},t8={...bl,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},o8={...bl,cursor:"default",opacity:.38},n8={width:"28px",height:"28px",padding:"2px"},r8={width:"1px",height:"20px",backgroundColor:"var(--doc-border)",margin:"0 6px"},ml=20;function fl({active:e=false,disabled:t=false,title:n,onClick:o,children:r,className:i,style:a}){let[l,c]=nt.useState(false),s={...t?o8:e?t8:l?e8:bl,...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 s0({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?{...n8}:{},[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:{...Qw,...l},role:"group","aria-label":m("lists.ariaLabel"),children:[jsxRuntime.jsxs("div",{style:l0,role:"group","aria-label":m("lists.typeAriaLabel"),children:[jsxRuntime.jsx(fl,{active:g,disabled:i,title:m("lists.bulletList"),onClick:t,style:p(),children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:ml})}),jsxRuntime.jsx(fl,{active:u,disabled:i,title:m("lists.numberedList"),onClick:n,style:p(),children:jsxRuntime.jsx(K,{name:"format_list_numbered",size:ml})})]}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:r8,role:"separator"}),jsxRuntime.jsxs("div",{style:l0,role:"group","aria-label":m("lists.indentationAriaLabel"),children:[jsxRuntime.jsx(fl,{active:false,disabled:i||!b,title:m("lists.decreaseIndent"),onClick:r,style:p(),children:jsxRuntime.jsx(K,{name:"format_indent_decrease",size:ml})}),jsxRuntime.jsx(fl,{active:false,disabled:i,title:m("lists.increaseIndent"),onClick:o,style:p(),children:jsxRuntime.jsx(K,{name:"format_indent_increase",size:ml})})]})]})]})}var i8=[{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 d0({value:e,onChange:t,options:n=i8,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(_c,{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 u0=[{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 p0({value:e,onChange:t,styles:n,disabled:o=false,className:r,width:i=120}){let{t:a}=N(),l=nt__namespace.useMemo(()=>{let g=sm(n);return g.length===0?u0:g.map(u=>({...u,type:"paragraph",nameKey:u0.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:lm(g),children:s(g)})},g.styleId))})]})}var s8=[{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 f0({value:e=1,onChange:t,levels:n=s8,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(sl,{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 d8=[{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 h0({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}=et({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:d8.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 v0({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 f8=[{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 x0({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}=et({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:f8.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 T0({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 b8={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"},E0={padding:"6px 14px 2px",fontSize:11,color:"var(--doc-text-muted)",fontWeight:500};function w0({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}=et({isOpen:r,onClose:c,align:"right"}),g=n?.table?.attrs?.justification??"left",u=nt.useCallback(y=>{e(y),i(false);},[e]),f=(y,P,h,v,S)=>{let x=t||S?.itemDisabled;return jsxRuntime.jsxs("button",{type:"button",role:"menuitem",style:{...b8,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:P,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:E0,children:o("tableAdvanced.verticalAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["top","center","bottom"].map(y=>{let P={top:"vertical_align_top",center:"vertical_align_center",bottom:"vertical_align_bottom"};return jsxRuntime.jsx("button",{type:"button",title:o({top:"tableAdvanced.top",center:"tableAdvanced.middle",bottom:"tableAdvanced.bottom"}[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:P[y],size:16})},y)})}),jsxRuntime.jsx("div",{style:en,role:"separator"}),jsxRuntime.jsx("div",{style:E0,children:o("tableAdvanced.tableAlignment")}),jsxRuntime.jsx("div",{style:{display:"flex",gap:4,padding:"4px 14px"},children:["left","center","right"].map(y=>{let P={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:P[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 v8=20;function yl({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}=et({isOpen:s,onClose:m}),b=nt.useCallback(P=>{i||r(P),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(P=>!P),disabled:i,"aria-label":a??o,"aria-expanded":s,"aria-haspopup":"true","data-testid":l,children:[jsxRuntime.jsx(K,{name:n,size:v8}),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:P=>P.stopPropagation(),children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:c?"column":"row",gap:c?1:2,minWidth:c?200:void 0},children:e.map(P=>{let h=t===P.value;return jsxRuntime.jsxs("button",{type:"button",title:P.label,"data-testid":l?`${l}-${P.value}`:void 0,style:{display:"flex",alignItems:"center",height:32,border:"1px solid transparent",borderRadius:4,backgroundColor: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(P.value),children:[jsxRuntime.jsx(K,{name:P.iconName,size:18}),c&&jsxRuntime.jsx("span",{style:{flex:1},children:P.label})]},P.value)})})})]})}var y8=[{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 x8(e){return e.displayMode==="float"&&e.cssFloat==="left"?"wrapRight":e.displayMode==="float"&&e.cssFloat==="right"?"wrapLeft":e.wrapType}function k0({imageContext:e,onChange:t,disabled:n=false}){let{t:o}=N(),r=y8.map(l=>({...l,label:o(l.labelKey)})),i=x8(e),a=r.find(l=>l.value===i)||r[0];return jsxRuntime.jsx(yl,{options:r,activeValue:i,triggerIcon:a.iconName,tooltipContent:`Wrap: ${a.label}`,onSelect:t,disabled:n,testId:"toolbar-image-wrap",showLabels:true})}var T8=[{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 M0({onTransform:e,disabled:t=false}){let{t:n}=N(),o=T8.map(r=>({...r,label:n(r.labelKey)}));return jsxRuntime.jsx(yl,{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 R8(e){let t=nt__namespace.default.useContext(fa);return t?{...t,...k8(e)}:e}function k8(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function Fd(e){let{t}=N(),n=R8(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:P=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]),he=nt.useCallback(()=>{!s&&l&&i&&i();},[s,l,i]),ve=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(()=>Ed(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]),De=nt.useCallback(()=>{!s&&r&&r("outdent");},[s,r]),El=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,xa=ne.current,yo=Wn?.contains(at),Od=xa?.contains(at);if(!yo&&!Od)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:he,disabled:s||!l,title:t("formattingBar.undoShortcut"),ariaLabel:t("formattingBar.undo"),children:jsxRuntime.jsx(K,{name:"undo",size:St})}),jsxRuntime.jsx(ut,{onClick:ve,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(f0,{value:L,onChange:F,disabled:s,compact:true})}),C&&jsxRuntime.jsx(Tt,{label:t("formattingBar.groups.styles"),children:jsxRuntime.jsx(p0,{value:o.styleId||"Normal",onChange:Vn,styles:k,theme:R,disabled:s,width:120})}),(f||P)&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.font"),children:[f&&jsxRuntime.jsx(Wg,{value:o.fontFamily||"Arial",onChange:U,fonts:Z,documentFonts:y,disabled:s,width:60,placeholder:"Arial"}),P&&jsxRuntime.jsx(Xg,{value:o.fontSize!==void 0?Kl(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(i0,{value:o.alignment||"left",onChange:We,disabled:s})}),(x||w)&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.listFormatting"),children:[x&&jsxRuntime.jsx(s0,{listState:o.listState||pl(),onBulletList:ho,onNumberedList:pt,onIndent:vo,onOutdent:De,disabled:s,showIndentButtons:true,compact:true,hasIndent:(o.indentLeft??0)>0}),w&&jsxRuntime.jsx(d0,{value:o.lineSpacing,onChange:El,disabled:s})]}),M&&E&&jsxRuntime.jsxs(Tt,{label:t("formattingBar.groups.image"),children:[jsxRuntime.jsx(k0,{imageContext:M,onChange:E,disabled:s}),D&&jsxRuntime.jsx(M0,{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(h0,{onAction:Pt,disabled:s}),jsxRuntime.jsx(v0,{onAction:Pt,disabled:s,theme:R,value:zt(z?.cellBorderColor,R)}),jsxRuntime.jsx(x0,{onAction:Pt,disabled:s}),jsxRuntime.jsx(T0,{onAction:Pt,disabled:s,theme:R,value:z?.cellBackgroundColor}),jsxRuntime.jsx(w0,{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 M8({children:e,className:t,style:n,...o}){return jsxRuntime.jsx(fa.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:Qe.toolbar,...n},"data-testid":"editor-toolbar",children:e})})}var tt=M8;tt.TitleBar=Td;tt.Logo=rl;tt.DocumentName=Sd;tt.MenuBar=il;tt.TitleBarRight=al;tt.Toolbar=Fd;var D8=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"]]),N8=e=>{let t=/^#?([0-9a-fA-F]{6})$/.exec(e.trim());return t?t[1].toUpperCase():null};function L8({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,P]=nt.useState({}),[h,v]=nt.useState(null),S=nt.useCallback(k=>{b(k);let R=u.current?.formatting();R&&P({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"?N8(_):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=D8.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(tt,{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(tt.TitleBar,{children:[l&&jsxRuntime.jsx(tt.Logo,{children:l()}),jsxRuntime.jsx(tt.DocumentName,{value:o??"Document",editable:false}),c&&jsxRuntime.jsx(tt.TitleBarRight,{children:c()}),jsxRuntime.jsx(tt.MenuBar,{})]}),jsxRuntime.jsx(tt.Toolbar,{})]}),jsxRuntime.jsxs("div",{className:"docx-editor__scroll-container",style:{flex:1,minHeight:0,overflow:"auto",background:"var(--doc-bg)"},children:[C?jsxRuntime.jsx("div",{style:{padding:"4px 0"},children:jsxRuntime.jsx(Ho,{pageSetup:C,zoom:w})}):null,jsxRuntime.jsx(bd,{ref:u,source:e,...p?{documentFontFamily:p}:{},...t===void 0?{}:{scale:t},...n?{measurer:n}:{},onStateChange:S,...i?{onError:i}:{}})]})]})}var Sl=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 Tl=class extends Sl{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 Z8=nt.createContext(null);function L0({children:e}){let t=nt.useMemo(()=>new Tl,[]),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(Z8.Provider,{value:c,children:[e,jsxRuntime.jsx(q8,{notifications:n.notifications,onDismiss:a})]})}function q8({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(K8,{notification:r,onDismiss:()=>t(r.id)},r.id))})}function K8({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 Cl=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(z8,{error:o,errorInfo:r,showDetails:n,onReset:this.resetError})}return this.props.children}};function z8({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 H0({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:Qe.outline},children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:20})})}function Hd({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 V8({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:P,onEditorBgMouseDown:h,onEditorContextMenu:v,horizontalRulerProps:S,verticalRulerProps:x,outlineProps:w,onToggleOutline:T,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(L0,{children:jsxRuntime.jsx(Cl,{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:P,children:[d&&jsxRuntime.jsx("div",{className:"flex py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:Qe.ruler,paddingLeft:20,paddingRight:20+(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:Qe.ruler,paddingTop:48},children:jsxRuntime.jsx(Vr,{...x})}),_]})})]}),k.totalPages>1&&jsxRuntime.jsx(Hd,{currentPage:k.currentPage,totalPages:k.totalPages,visible:k.visible}),p&&jsxRuntime.jsx(Wr,{...w,leftOffset:$r+(M?xn:0)}),g&&!p&&jsxRuntime.jsx(H0,{onClick:T,topPx:b+(d?Ec+8:0)+48,scrollLeft:y,leftOffset:Sn+(M?xn:0)})]})}),L,F,I]})})})})})}function X8(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=la;exports.ContextMenuCopyFormatting=Gi;exports.ContextMenuCut=ia;exports.ContextMenuDelete=sa;exports.ContextMenuDeleteTable=Hn;exports.ContextMenuDeleteTableColumn=An;exports.ContextMenuDeleteTableRow=Fn;exports.ContextMenuInsertColumnLeft=Nn;exports.ContextMenuInsertColumnRight=Ln;exports.ContextMenuInsertRowAbove=_n;exports.ContextMenuInsertRowBelow=Dn;exports.ContextMenuItem=Xi;exports.ContextMenuPaste=Mn;exports.ContextMenuPasteFormatting=ji;exports.ContextMenuPasteWithoutFormatting=In;exports.ContextMenuRefreshToc=On;exports.ContextMenuRefreshTocPageNumbers=Bn;exports.ContextMenuSelectAll=ca;exports.DocumentName=Sd;exports.DocumentOutline=Wr;exports.DocxEditor=h2;exports.DocxEditorAuthorStyle=$l;exports.DocxEditorColorByChangeType=Vl;exports.DocxEditorContent=ka;exports.DocxEditorContentControl=tl;exports.DocxEditorContextMenu=ua;exports.DocxEditorDocumentOutline=Nc;exports.DocxEditorEquation=$i;exports.DocxEditorFontNotice=qi;exports.DocxEditorHeaderFooterChrome=Ki;exports.DocxEditorHorizontalRuler=_i;exports.DocxEditorHyperLink=Vi;exports.DocxEditorImagePropertiesDialog=Ps;exports.DocxEditorLoading=Ia;exports.DocxEditorLoadingSpinner=zl;exports.DocxEditorMenu=qr;exports.DocxEditorNavigation=qc;exports.DocxEditorNotesChrome=Wi;exports.DocxEditorPageNumber=Zi;exports.DocxEditorPageSetupDialog=Lr;exports.DocxEditorParagraphDialog=Mo;exports.DocxEditorRoot=or;exports.DocxEditorShell=V8;exports.DocxEditorToolbar=Nr;exports.DocxEditorVerticalRuler=Di;exports.DocxEditorViewport=Aa;exports.HorizontalRuler=Ho;exports.ImageAltText=Ya;exports.ImageInsertProvider=Ea;exports.ImageInsertTrigger=wa;exports.ImagePropertiesTrigger=ei;exports.ImageWrap=ja;exports.LocaleProvider=nn;exports.Logo=rl;exports.MenuBar=il;exports.NAVIGATION_PANE_GAP=Bf;exports.NAVIGATION_PANE_INSET=Ni;exports.NAVIGATION_PANE_WIDTH=Tn;exports.NavigationClose=Yr;exports.NavigationFind=ta;exports.NavigationHeader=jr;exports.NavigationHeadings=ea;exports.NavigationTab=Qr;exports.NavigationTabs=Jr;exports.NavigationTitle=Xr;exports.NavigationToggle=oa;exports.OUTLINE_BUTTON_LEFT_OFFSET=Sn;exports.OUTLINE_BUTTON_RESERVED_SPACE=lE;exports.OUTLINE_LEFT_OFFSET=$r;exports.OUTLINE_RESERVED_SPACE=aE;exports.PageIndicator=Hd;exports.PageNumberTranslationContext=Bi;exports.PaginatedDocxEditor=bd;exports.PaginatedDocxEditorShell=N8;exports.REVIEW_MARKERS_GUTTER=os;exports.REVIEW_PANE_GUTTER=ns;exports.RULER_WIDTH=xn;exports.ReviewRailContext=mt;exports.SEARCH_DEBOUNCE_MS=Hc;exports.SEARCH_MATCH_LIMIT=Oc;exports.Slot=j;exports.TitleBar=Td;exports.TitleBarRight=al;exports.Toolbar=Fd;exports.ToolbarButton=ut;exports.ToolbarContext=xo;exports.ToolbarGroup=Tt;exports.ToolbarImageProperties=gn;exports.VERSION=Z0;exports.VerticalRuler=Vr;exports.editorStateActiveSubscriptionCount=j0;exports.isFieldLink=Qn;exports.navigationPaneReservation=Zo;exports.navigationShift=Li;exports.normalizeImageBytes=Ta;exports.notificationYieldsToTask=Xd;exports.provideDocxEditor=Th;exports.reviewGutter=wu;exports.useChromeTranslate=Yd;exports.useContentControl=Et;exports.useContentControlInstance=Na;exports.useContextMenuTarget=ag;exports.useDocumentOutline=Fi;exports.useDocumentSearch=Ai;exports.useDocxEditor=H;exports.useDocxSource=E2;exports.useEditorCaret=L2;exports.useEditorCommand=le;exports.useEditorEvent=Ys;exports.useEditorSnapshot=X8;exports.useEditorState=O;exports.useEditorValueCommand=pr;exports.useFontFamily=ri;exports.useFonts=I2;exports.useHeaderFooterState=zc;exports.useHyperlinkPopup=Wl;exports.useHyperlinkPopupInstance=Da;exports.useNavigationPane=Hi;exports.useNavigationShift=wo;exports.useNotePropertiesState=id;exports.useNoteScopeState=ad;exports.usePageSetup=No;exports.useParagraphFormat=cs;exports.useParagraphIndent=Rc;exports.useParagraphStyle=ai;exports.useReviewAuthors=ar;exports.useReviewGutter=dn;exports.useScopeClassName=ot;exports.useScopedChromeAnchor=na;exports.useTableBorderTargetLabel=Om;exports.useToolbarContext=ob;exports.useToolbarLabel=J;exports.useToolbarLabelFor=Ca;exports.useTranslation=N;exports.useZoom=Rs;
4
+ `,jsxRuntime.jsx("strong",{children:r("errors.componentStack")}),t.componentStack]})]}),jsxRuntime.jsx("button",{type:"button",onClick:o,style:d,children:r("errors.tryAgain")})]})}function H0({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:Qe.outline},children:jsxRuntime.jsx(K,{name:"format_list_bulleted",size:20})})}function Hd({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 $8({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:P,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(L0,{children:jsxRuntime.jsx(Cl,{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:P,children:[d&&jsxRuntime.jsx("div",{className:"flex py-1 flex-shrink-0 bg-doc-bg",style:{position:"sticky",top:0,zIndex:Qe.ruler,paddingLeft:20,paddingRight:20+(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:Qe.ruler,paddingTop:48},children:jsxRuntime.jsx(Vr,{...x})}),_]})})]}),k.totalPages>1&&jsxRuntime.jsx(Hd,{currentPage:k.currentPage,totalPages:k.totalPages,visible:k.visible}),p&&jsxRuntime.jsx(Wr,{...w,leftOffset:$r+(M?xn:0)}),g&&!p&&jsxRuntime.jsx(H0,{onClick:C,topPx:b+(d?Ec+8:0)+48,scrollLeft:y,leftOffset:Sn+(M?xn:0)})]})}),L,F,I]})})})})})}function J8(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=la;exports.ContextMenuCopyFormatting=Gi;exports.ContextMenuCut=ia;exports.ContextMenuDelete=sa;exports.ContextMenuDeleteTable=Hn;exports.ContextMenuDeleteTableColumn=An;exports.ContextMenuDeleteTableRow=Fn;exports.ContextMenuInsertColumnLeft=Nn;exports.ContextMenuInsertColumnRight=Ln;exports.ContextMenuInsertRowAbove=_n;exports.ContextMenuInsertRowBelow=Dn;exports.ContextMenuItem=Xi;exports.ContextMenuPaste=Mn;exports.ContextMenuPasteFormatting=ji;exports.ContextMenuPasteWithoutFormatting=In;exports.ContextMenuRefreshToc=On;exports.ContextMenuRefreshTocPageNumbers=Bn;exports.ContextMenuSelectAll=ca;exports.DocumentName=Sd;exports.DocumentOutline=Wr;exports.DocxEditor=v2;exports.DocxEditorAuthorStyle=$l;exports.DocxEditorColorByChangeType=Vl;exports.DocxEditorContent=ka;exports.DocxEditorContentControl=tl;exports.DocxEditorContextMenu=ua;exports.DocxEditorDocumentOutline=Nc;exports.DocxEditorEquation=$i;exports.DocxEditorFontNotice=qi;exports.DocxEditorHeaderFooterChrome=Ki;exports.DocxEditorHorizontalRuler=_i;exports.DocxEditorHyperLink=Vi;exports.DocxEditorImagePropertiesDialog=Ps;exports.DocxEditorLoading=Ia;exports.DocxEditorLoadingSpinner=zl;exports.DocxEditorMenu=qr;exports.DocxEditorNavigation=qc;exports.DocxEditorNotesChrome=Wi;exports.DocxEditorPageNumber=Zi;exports.DocxEditorPageSetupDialog=Lr;exports.DocxEditorParagraphDialog=Mo;exports.DocxEditorRoot=or;exports.DocxEditorShell=$8;exports.DocxEditorToolbar=Nr;exports.DocxEditorVerticalRuler=Di;exports.DocxEditorViewport=Aa;exports.HorizontalRuler=Ho;exports.ImageAltText=Ya;exports.ImageInsertProvider=Ea;exports.ImageInsertTrigger=wa;exports.ImagePropertiesTrigger=ei;exports.ImageWrap=ja;exports.LocaleProvider=nn;exports.Logo=rl;exports.MenuBar=il;exports.NAVIGATION_PANE_GAP=Bf;exports.NAVIGATION_PANE_INSET=Ni;exports.NAVIGATION_PANE_WIDTH=Tn;exports.NavigationClose=Yr;exports.NavigationFind=ta;exports.NavigationHeader=jr;exports.NavigationHeadings=ea;exports.NavigationTab=Qr;exports.NavigationTabs=Jr;exports.NavigationTitle=Xr;exports.NavigationToggle=oa;exports.OUTLINE_BUTTON_LEFT_OFFSET=Sn;exports.OUTLINE_BUTTON_RESERVED_SPACE=sE;exports.OUTLINE_LEFT_OFFSET=$r;exports.OUTLINE_RESERVED_SPACE=iE;exports.PageIndicator=Hd;exports.PageNumberTranslationContext=Bi;exports.PaginatedDocxEditor=bd;exports.PaginatedDocxEditorShell=L8;exports.REVIEW_MARKERS_GUTTER=os;exports.REVIEW_PANE_GUTTER=ns;exports.RULER_WIDTH=xn;exports.ReviewRailContext=mt;exports.SEARCH_DEBOUNCE_MS=Hc;exports.SEARCH_MATCH_LIMIT=Oc;exports.Slot=j;exports.TitleBar=Td;exports.TitleBarRight=al;exports.Toolbar=Fd;exports.ToolbarButton=ut;exports.ToolbarContext=xo;exports.ToolbarGroup=Tt;exports.ToolbarImageProperties=gn;exports.VERSION=Z0;exports.VerticalRuler=Vr;exports.editorStateActiveSubscriptionCount=j0;exports.isFieldLink=Qn;exports.navigationPaneReservation=Zo;exports.navigationShift=Li;exports.normalizeImageBytes=Ta;exports.notificationYieldsToTask=Xd;exports.provideDocxEditor=Th;exports.reviewGutter=wu;exports.useChromeTranslate=Yd;exports.useContentControl=Et;exports.useContentControlInstance=Na;exports.useContextMenuTarget=ag;exports.useDocumentOutline=Fi;exports.useDocumentSearch=Ai;exports.useDocxEditor=H;exports.useDocxSource=w2;exports.useEditorCaret=F2;exports.useEditorCommand=le;exports.useEditorEvent=Ys;exports.useEditorSnapshot=J8;exports.useEditorState=O;exports.useEditorValueCommand=pr;exports.useFontFamily=ri;exports.useFonts=_2;exports.useHeaderFooterState=zc;exports.useHyperlinkPopup=Wl;exports.useHyperlinkPopupInstance=Da;exports.useNavigationPane=Hi;exports.useNavigationShift=wo;exports.useNotePropertiesState=id;exports.useNoteScopeState=ad;exports.usePageSetup=No;exports.useParagraphFormat=cs;exports.useParagraphIndent=Rc;exports.useParagraphStyle=ai;exports.useReviewAuthors=ar;exports.useReviewGutter=dn;exports.useScopeClassName=ot;exports.useScopedChromeAnchor=na;exports.useTableBorderTargetLabel=Om;exports.useToolbarContext=ob;exports.useToolbarLabel=J;exports.useToolbarLabelFor=Ca;exports.useTranslation=N;exports.useZoom=Rs;